create-prisma-php-app 4.0.0-alpha.82 → 4.0.0-alpha.83

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 Ut=Object.defineProperty,Wt=(e,t,s)=>t in e?Ut(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,d=(e,t,s)=>Wt(e,"symbol"!=typeof t?t+"":t,s),Ht=[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],tt=[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],zt="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",st="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Me={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"},Le="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",qt={5:Le,"5module":Le+" export import",6:Le+" const class extends export import super"},Xt=/^in(stanceof)?$/,Gt=new RegExp("["+st+"]"),Kt=new RegExp("["+st+zt+"]");function Oe(e,t){for(var s=65536,n=0;n<t.length;n+=2){if((s+=t[n])>e)return!1;if((s+=t[n+1])>=e)return!0}return!1}function H(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&Gt.test(String.fromCharCode(e)):!1!==t&&Oe(e,tt)))}function ee(e,t){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&Kt.test(String.fromCharCode(e)):!1!==t&&(Oe(e,tt)||Oe(e,Ht)))))}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 D(e,t){return new T(e,{beforeExpr:!0,binop:t})}var B={beforeExpr:!0},O={startsExpr:!0},$e={};function w(e,t){return void 0===t&&(t={}),t.keyword=e,$e[e]=new T(e,t)}var u={num:new T("num",O),regexp:new T("regexp",O),string:new T("string",O),name:new T("name",O),privateId:new T("privateId",O),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(",",B),semi:new T(";",B),colon:new T(":",B),dot:new T("."),question:new T("?",B),questionDot:new T("?."),arrow:new T("=>",B),template:new T("template"),invalidTemplate:new T("invalidTemplate"),ellipsis:new T("...",B),backQuote:new T("`",O),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:D("||",1),logicalAND:D("&&",2),bitwiseOR:D("|",3),bitwiseXOR:D("^",4),bitwiseAND:D("&",5),equality:D("==/!=/===/!==",6),relational:D("</>/<=/>=",7),bitShift:D("<</>>/>>>",8),plusMin:new T("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:D("%",10),star:D("*",10),slash:D("/",10),starstar:new T("**",{beforeExpr:!0}),coalesce:D("??",1),_break:w("break"),_case:w("case",B),_catch:w("catch"),_continue:w("continue"),_debugger:w("debugger"),_default:w("default",B),_do:w("do",{isLoop:!0,beforeExpr:!0}),_else:w("else",B),_finally:w("finally"),_for:w("for",{isLoop:!0}),_function:w("function",O),_if:w("if"),_return:w("return",B),_switch:w("switch"),_throw:w("throw",B),_try:w("try"),_var:w("var"),_const:w("const"),_while:w("while",{isLoop:!0}),_with:w("with"),_new:w("new",{beforeExpr:!0,startsExpr:!0}),_this:w("this",O),_super:w("super",O),_class:w("class",O),_extends:w("extends",B),_export:w("export"),_import:w("import",O),_null:w("null",O),_true:w("true",O),_false:w("false",O),_in:w("in",{beforeExpr:!0,binop:7}),_instanceof:w("instanceof",{beforeExpr:!0,binop:7}),_typeof:w("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:w("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:w("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},V=/\r\n?|\n|\u2028|\u2029/,Qt=new RegExp(V.source,"g");function ce(e){return 10===e||13===e||8232===e||8233===e}function it(e,t,s){void 0===s&&(s=e.length);for(var n=t;n<s;n++){var i=e.charCodeAt(n);if(ce(i))return n<s-1&&13===i&&10===e.charCodeAt(n+1)?n+2:n+1}return-1}var nt=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,L=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,rt=Object.prototype,Zt=rt.hasOwnProperty,Jt=rt.toString,ue=Object.hasOwn||function(e,t){return Zt.call(e,t)},Ke=Array.isArray||function(e){return"[object Array]"===Jt.call(e)},Qe=Object.create(null);function Y(e){return Qe[e]||(Qe[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function G(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var Yt=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,de=function(e,t){this.line=e,this.column=t};de.prototype.offset=function(e){return new de(this.line,this.column+e)};var Te=function(e,t,s){this.start=t,this.end=s,null!==e.sourceFile&&(this.source=e.sourceFile)};function at(e,t){for(var s=1,n=0;;){var i=it(e,n,t);if(i<0)return new de(s,t-n);++s,n=i}}var Ve={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},Ze=!1;function es(e){var t={};for(var s in Ve)t[s]=e&&ue(e,s)?e[s]:Ve[s];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!Ze&&"object"==typeof console&&console.warn&&(Ze=!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),Ke(t.onToken)){var n=t.onToken;t.onToken=function(e){return n.push(e)}}return Ke(t.onComment)&&(t.onComment=ts(t,t.onComment)),t}function ts(e,t){return function(s,n,i,r,a,o){var c={type:s?"Block":"Line",value:n,start:i,end:r};e.locations&&(c.loc=new Te(this,a,o)),e.ranges&&(c.range=[i,r]),t.push(c)}}var me=1,le=2,je=4,ot=8,Ue=16,ct=32,_e=64,ut=128,re=256,ge=512,Ae=me|le|re;function We(e,t){return le|(e?je:0)|(t?ot:0)}var Ee=0,He=1,Q=2,lt=3,pt=4,ht=5,P=function(e,t,s){this.options=e=es(e),this.sourceFile=e.sourceFile,this.keywords=Y(qt[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var n="";!0!==e.allowReserved&&(n=Me[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(n+=" await")),this.reservedWords=Y(n);var i=(n?n+" ":"")+Me.strict;this.reservedWordsStrict=Y(i),this.reservedWordsStrictBind=Y(i+" "+Me.strictBind),this.input=String(t),this.containsEsc=!1,s?(this.pos=s,this.lineStart=this.input.lastIndexOf("\n",s-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(V).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(me),this.regexpState=null,this.privateNameStack=[]},z={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}};P.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},z.inFunction.get=function(){return(this.currentVarScope().flags&le)>0},z.inGenerator.get=function(){return(this.currentVarScope().flags&ot)>0},z.inAsync.get=function(){return(this.currentVarScope().flags&je)>0},z.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(re|ge))return!1;if(t&le)return(t&je)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},z.allowSuper.get=function(){return(this.currentThisScope().flags&_e)>0||this.options.allowSuperOutsideMethod},z.allowDirectSuper.get=function(){return(this.currentThisScope().flags&ut)>0},z.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},z.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(re|ge)||t&le&&!(t&Ue))return!0}return!1},z.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&re)>0},P.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var s=this,n=0;n<e.length;n++)s=e[n](s);return s},P.parse=function(e,t){return new this(t,e).parse()},P.parseExpressionAt=function(e,t,s){var n=new this(s,e,t);return n.nextToken(),n.parseExpression()},P.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(P.prototype,z);var R=P.prototype,ss=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;R.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){L.lastIndex=e,e+=L.exec(this.input)[0].length;var t=ss.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){L.lastIndex=e+t[0].length;var s=L.exec(this.input),n=s.index+s[0].length,i=this.input.charAt(n);return";"===i||"}"===i||V.test(s[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||"!"===i&&"="===this.input.charAt(n+1))}e+=t[0].length,L.lastIndex=e,e+=L.exec(this.input)[0].length,";"===this.input[e]&&e++}},R.eat=function(e){return this.type===e&&(this.next(),!0)},R.isContextual=function(e){return this.type===u.name&&this.value===e&&!this.containsEsc},R.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},R.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},R.canInsertSemicolon=function(){return this.type===u.eof||this.type===u.braceR||V.test(this.input.slice(this.lastTokEnd,this.start))},R.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},R.semicolon=function(){!this.eat(u.semi)&&!this.insertSemicolon()&&this.unexpected()},R.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},R.expect=function(e){this.eat(e)||this.unexpected()},R.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var Ie=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};R.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var s=t?e.parenthesizedAssign:e.parenthesizedBind;s>-1&&this.raiseRecoverable(s,t?"Assigning to rvalue":"Parenthesized pattern")}},R.checkExpressionErrors=function(e,t){if(!e)return!1;var s=e.shorthandAssign,n=e.doubleProto;if(!t)return s>=0||n>=0;s>=0&&this.raise(s,"Shorthand property assignments are valid only in destructuring patterns"),n>=0&&this.raiseRecoverable(n,"Redefinition of __proto__ property")},R.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")},R.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var b=P.prototype;b.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==u.eof;){var s=this.parseStatement(null,!0,t);e.body.push(s)}if(this.inModule)for(var n=0,i=Object.keys(this.undefinedExports);n<i.length;n+=1){var r=i[n];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 ze={kind:"loop"},is={kind:"switch"};b.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;L.lastIndex=this.pos;var t=L.exec(this.input),s=this.pos+t[0].length,n=this.input.charCodeAt(s);if(91===n||92===n)return!0;if(e)return!1;if(123===n||n>55295&&n<56320)return!0;if(H(n,!0)){for(var i=s+1;ee(n=this.input.charCodeAt(i),!0);)++i;if(92===n||n>55295&&n<56320)return!0;var r=this.input.slice(s,i);if(!Xt.test(r))return!0}return!1},b.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;L.lastIndex=this.pos;var e,t=L.exec(this.input),s=this.pos+t[0].length;return!(V.test(this.input.slice(this.pos,s))||"function"!==this.input.slice(s,s+8)||s+8!==this.input.length&&(ee(e=this.input.charCodeAt(s+8))||e>55295&&e<56320))},b.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return!1;L.lastIndex=this.pos;var s=L.exec(this.input),n=this.pos+s[0].length;if(V.test(this.input.slice(this.pos,n)))return!1;if(e){var i,r=n+5;if("using"!==this.input.slice(n,r)||r===this.input.length||ee(i=this.input.charCodeAt(r))||i>55295&&i<56320)return!1;L.lastIndex=r;var a=L.exec(this.input);if(a&&V.test(this.input.slice(r,r+a[0].length)))return!1}if(t){var o,c=n+2;if(!("of"!==this.input.slice(n,c)||c!==this.input.length&&(ee(o=this.input.charCodeAt(c))||o>55295&&o<56320)))return!1}var p=this.input.charCodeAt(n);return H(p,!0)||92===p},b.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},b.isUsing=function(e){return this.isUsingKeyword(!1,e)},b.parseStatement=function(e,t,s){var n,i=this.type,r=this.startNode();switch(this.isLet(e)&&(i=u._var,n="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 n=n||this.value,e&&"var"!==n&&this.unexpected(),this.parseVarStatement(r,n);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){L.lastIndex=this.pos;var a=L.exec(this.input),o=this.pos+a[0].length,c=this.input.charCodeAt(o);if(40===c||46===c)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,s);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!e);var p=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(p)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"===p&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(r,!1,p),this.semicolon(),this.finishNode(r,"VariableDeclaration");var h=this.value,l=this.parseExpression();return i===u.name&&"Identifier"===l.type&&this.eat(u.colon)?this.parseLabeledStatement(r,h,l,e):this.parseExpressionStatement(r,l)}},b.parseBreakContinueStatement=function(e,t){var s="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 n=0;n<this.labels.length;++n){var i=this.labels[n];if((null==e.label||i.name===e.label.name)&&(null!=i.kind&&(s||"loop"===i.kind)||e.label&&s))break}return n===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,s?"BreakStatement":"ContinueStatement")},b.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},b.parseDoStatement=function(e){return this.next(),this.labels.push(ze),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")},b.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(ze),this.enterScope(0),this.expect(u.parenL),this.type===u.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var s=this.isLet();if(this.type===u._var||this.type===u._const||s){var n=this.startNode(),i=s?"let":this.value;return this.next(),this.parseVar(n,!0,i),this.finishNode(n,"VariableDeclaration"),this.parseForAfterInit(e,n,t)}var r=this.isContextual("let"),a=!1,o=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(o){var c=this.startNode();return this.next(),"await using"===o&&this.next(),this.parseVar(c,!0,o),this.finishNode(c,"VariableDeclaration"),this.parseForAfterInit(e,c,t)}var p=this.containsEsc,h=new Ie,l=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!==l||p||"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))},b.parseForAfterInit=function(e,t,s){return(this.type===u._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===t.declarations.length?(this.options.ecmaVersion>=9&&(this.type===u._in?s>-1&&this.unexpected(s):e.await=s>-1),this.parseForIn(e,t)):(s>-1&&this.unexpected(s),this.parseFor(e,t))},b.parseFunctionStatement=function(e,t,s){return this.next(),this.parseFunction(e,fe|(s?0:Fe),!1,t)},b.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")},b.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")},b.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(u.braceL),this.labels.push(is),this.enterScope(0);for(var t,s=!1;this.type!==u.braceR;)if(this.type===u._case||this.type===u._default){var n=this.type===u._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),n?t.test=this.parseExpression():(s&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),s=!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")},b.parseThrowStatement=function(e){return this.next(),V.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 ns=[];b.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t="Identifier"===e.type;return this.enterScope(t?ct:0),this.checkLValPattern(e,t?pt:Q),this.expect(u.parenR),e},b.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")},b.parseVarStatement=function(e,t,s){return this.next(),this.parseVar(e,!1,t,s),this.semicolon(),this.finishNode(e,"VariableDeclaration")},b.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(ze),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},b.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")},b.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},b.parseLabeledStatement=function(e,t,s,n){for(var i=0,r=this.labels;i<r.length;i+=1){r[i].name===t&&this.raise(s.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 c=this.labels[o];if(c.statementStart!==e.start)break;c.statementStart=this.start,c.kind=a}return this.labels.push({name:t,kind:a,statementStart:this.start}),e.body=this.parseStatement(n?-1===n.indexOf("label")?n+"label":n:"label"),this.labels.pop(),e.label=s,this.finishNode(e,"LabeledStatement")},b.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},b.parseBlock=function(e,t,s){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 n=this.parseStatement(null);t.body.push(n)}return s&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},b.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")},b.parseForIn=function(e,t){var s=this.type===u._in;return this.next(),"VariableDeclaration"===t.type&&null!=t.declarations[0].init&&(!s||this.options.ecmaVersion<8||this.strict||"var"!==t.kind||"Identifier"!==t.declarations[0].id.type)&&this.raise(t.start,(s?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=s?this.parseExpression():this.parseMaybeAssign(),this.expect(u.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,s?"ForInStatement":"ForOfStatement")},b.parseVar=function(e,t,s,n){for(e.declarations=[],e.kind=s;;){var i=this.startNode();if(this.parseVarId(i,s),this.eat(u.eq)?i.init=this.parseMaybeAssign(t):n||"const"!==s||this.type===u._in||this.options.ecmaVersion>=6&&this.isContextual("of")?n||"using"!==s&&"await using"!==s||!(this.options.ecmaVersion>=17)||this.type===u._in||this.isContextual("of")?n||"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 "+s+" declaration"):this.unexpected(),e.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat(u.comma))break}return e},b.parseVarId=function(e,t){e.id="using"===t||"await using"===t?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,"var"===t?He:Q,!1)};var fe=1,Fe=2,ft=4;function rs(e,t){var s=t.key.name,n=e[s],i="true";return"MethodDefinition"===t.type&&("get"===t.kind||"set"===t.kind)&&(i=(t.static?"s":"i")+t.kind),"iget"===n&&"iset"===i||"iset"===n&&"iget"===i||"sget"===n&&"sset"===i||"sset"===n&&"sget"===i?(e[s]="true",!1):!!n||(e[s]=i,!1)}function ve(e,t){var s=e.computed,n=e.key;return!s&&("Identifier"===n.type&&n.name===t||"Literal"===n.type&&n.value===t)}b.parseFunction=function(e,t,s,n,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!n)&&(this.type===u.star&&t&Fe&&this.unexpected(),e.generator=this.eat(u.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&fe&&(e.id=t&ft&&this.type!==u.name?null:this.parseIdent(),e.id&&!(t&Fe)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?He:Q:lt));var r=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(We(e.async,e.generator)),t&fe||(e.id=this.type===u.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,s,!1,i),this.yieldPos=r,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&fe?"FunctionDeclaration":"FunctionExpression")},b.parseFunctionParams=function(e){this.expect(u.parenL),e.params=this.parseBindingList(u.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},b.parseClass=function(e,t){this.next();var s=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var n=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&&rs(n,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=s,this.next(),e.body=this.finishNode(i,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},b.parseClassElement=function(e){if(this.eat(u.semi))return null;var t=this.options.ecmaVersion,s=this.startNode(),n="",i=!1,r=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(u.braceL))return this.parseClassStaticBlock(s),s;this.isClassElementNameStart()||this.type===u.star?o=!0:n="static"}if(s.static=o,!n&&t>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==u.star||this.canInsertSemicolon()?n="async":r=!0),!n&&(t>=9||!r)&&this.eat(u.star)&&(i=!0),!n&&!r&&!i){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=c:n=c)}if(n?(s.computed=!1,s.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),s.key.name=n,this.finishNode(s.key,"Identifier")):this.parseClassElementName(s),t<13||this.type===u.parenL||"method"!==a||i||r){var p=!s.static&&ve(s,"constructor"),h=p&&e;p&&"method"!==a&&this.raise(s.key.start,"Constructor can't have get/set modifier"),s.kind=p?"constructor":a,this.parseClassMethod(s,i,r,h)}else this.parseClassField(s);return s},b.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},b.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)},b.parseClassMethod=function(e,t,s,n){var i=e.key;"constructor"===e.kind?(t&&this.raise(i.start,"Constructor can't be a generator"),s&&this.raise(i.start,"Constructor can't be an async method")):e.static&&ve(e,"prototype")&&this.raise(i.start,"Classes may not have a static property named prototype");var r=e.value=this.parseMethod(t,s,n);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")},b.parseClassField=function(e){return ve(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&ve(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(u.eq)?(this.enterScope(ge|_e),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")},b.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(re|_e);this.type!==u.braceR;){var s=this.parseStatement(null);e.body.push(s)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},b.parseClassId=function(e,t){this.type===u.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Q,!1)):(!0===t&&this.unexpected(),e.id=null)},b.parseClassSuper=function(e){e.superClass=this.eat(u._extends)?this.parseExprSubscripts(null,!1):null},b.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},b.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,s=e.used;if(this.options.checkPrivateFields)for(var n=this.privateNameStack.length,i=0===n?null:this.privateNameStack[n-1],r=0;r<s.length;++r){var a=s[r];ue(t,a.name)||(i?i.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}},b.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")},b.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 s=0,n=e.specifiers;s<n.length;s+=1){var i=n[s];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")},b.parseExportDeclaration=function(e){return this.parseStatement(null)},b.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,fe|ft,!1,e)}if(this.type===u._class){var s=this.startNode();return this.parseClass(s,"nullableID")}var n=this.parseMaybeAssign();return this.semicolon(),n},b.checkExport=function(e,t,s){e&&("string"!=typeof t&&(t="Identifier"===t.type?t.name:t.value),ue(e,t)&&this.raiseRecoverable(s,"Duplicate export '"+t+"'"),e[t]=!0)},b.checkPatternExport=function(e,t){var s=t.type;if("Identifier"===s)this.checkExport(e,t,t.start);else if("ObjectPattern"===s)for(var n=0,i=t.properties;n<i.length;n+=1){var r=i[n];this.checkPatternExport(e,r)}else if("ArrayPattern"===s)for(var a=0,o=t.elements;a<o.length;a+=1){var c=o[a];c&&this.checkPatternExport(e,c)}else"Property"===s?this.checkPatternExport(e,t.value):"AssignmentPattern"===s?this.checkPatternExport(e,t.left):"RestElement"===s&&this.checkPatternExport(e,t.argument)},b.checkVariableExport=function(e,t){if(e)for(var s=0,n=t;s<n.length;s+=1){var i=n[s];this.checkPatternExport(e,i.id)}},b.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},b.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")},b.parseExportSpecifiers=function(e){var t=[],s=!0;for(this.expect(u.braceL);!this.eat(u.braceR);){if(s)s=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;t.push(this.parseExportSpecifier(e))}return t},b.parseImport=function(e){return this.next(),this.type===u.string?(e.specifiers=ns,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")},b.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,Q),this.finishNode(e,"ImportSpecifier")},b.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Q),this.finishNode(e,"ImportDefaultSpecifier")},b.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,Q),this.finishNode(e,"ImportNamespaceSpecifier")},b.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},b.parseWithClause=function(){var e=[];if(!this.eat(u._with))return e;this.expect(u.braceL);for(var t={},s=!0;!this.eat(u.braceR);){if(s)s=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;var n=this.parseImportAttribute(),i="Identifier"===n.key.type?n.key.name:n.key.value;ue(t,i)&&this.raiseRecoverable(n.key.start,"Duplicate attribute key '"+i+"'"),t[i]=!0,e.push(n)}return e},b.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")},b.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===u.string){var e=this.parseLiteral(this.value);return Yt.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},b.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)},b.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 j=P.prototype;j.toAssignable=function(e,t,s){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",s&&this.checkPatternErrors(s,!0);for(var n=0,i=e.properties;n<i.length;n+=1){var r=i[n];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",s&&this.checkPatternErrors(s,!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,s);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 s&&this.checkPatternErrors(s,!0);return e},j.toAssignableList=function(e,t){for(var s=e.length,n=0;n<s;n++){var i=e[n];i&&this.toAssignable(i,t)}if(s){var r=e[s-1];6===this.options.ecmaVersion&&t&&r&&"RestElement"===r.type&&"Identifier"!==r.argument.type&&this.unexpected(r.argument.start)}return e},j.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},j.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")},j.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()},j.parseBindingList=function(e,t,s,n){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(s&&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(n))}return i},j.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},j.parseBindingListItem=function(e){return e},j.parseMaybeDefault=function(e,t,s){if(s=s||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(u.eq))return s;var n=this.startNodeAt(e,t);return n.left=s,n.right=this.parseMaybeAssign(),this.finishNode(n,"AssignmentPattern")},j.checkLValSimple=function(e,t,s){void 0===t&&(t=Ee);var n=t!==Ee;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(n?"Binding ":"Assigning to ")+e.name+" in strict mode"),n&&(t===Q&&"let"===e.name&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),s&&(ue(s,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),s[e.name]=!0),t!==ht&&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":n&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return n&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,s);default:this.raise(e.start,(n?"Binding":"Assigning to")+" rvalue")}},j.checkLValPattern=function(e,t,s){switch(void 0===t&&(t=Ee),e.type){case"ObjectPattern":for(var n=0,i=e.properties;n<i.length;n+=1){var r=i[n];this.checkLValInnerPattern(r,t,s)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var c=o[a];c&&this.checkLValInnerPattern(c,t,s)}break;default:this.checkLValSimple(e,t,s)}},j.checkLValInnerPattern=function(e,t,s){switch(void 0===t&&(t=Ee),e.type){case"Property":this.checkLValInnerPattern(e.value,t,s);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,s);break;case"RestElement":this.checkLValPattern(e.argument,t,s);break;default:this.checkLValPattern(e,t,s)}};var U=function(e,t,s,n,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!s,this.override=n,this.generator=!!i},I={b_stat:new U("{",!1),b_expr:new U("{",!0),b_tmpl:new U("${",!1),p_stat:new U("(",!1),p_expr:new U("(",!0),q_tmpl:new U("`",!0,!0,(function(e){return e.tryReadTemplateToken()})),f_stat:new U("function",!1),f_expr:new U("function",!0),f_expr_gen:new U("function",!0,!1,null,!0),f_gen:new U("function",!1,!1,null,!0)},pe=P.prototype;pe.initialContext=function(){return[I.b_stat]},pe.curContext=function(){return this.context[this.context.length-1]},pe.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?V.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)},pe.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},pe.updateContext=function(e){var t,s=this.type;s.keyword&&e===u.dot?this.exprAllowed=!1:(t=s.updateContext)?t.call(this,e):this.exprAllowed=s.beforeExpr},pe.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&&V.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 y=P.prototype;function dt(e){return"Identifier"===e.type||"ParenthesizedExpression"===e.type&&dt(e.expression)}function De(e){return"MemberExpression"===e.type&&"PrivateIdentifier"===e.property.type||"ChainExpression"===e.type&&De(e.expression)||"ParenthesizedExpression"===e.type&&De(e.expression)}y.checkPropClash=function(e,t,s){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===e.type||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var n,i=e.key;switch(i.type){case"Identifier":n=i.name;break;case"Literal":n=String(i.value);break;default:return}var r=e.kind;if(this.options.ecmaVersion>=6)return void("__proto__"===n&&"init"===r&&(t.proto&&(s?s.doubleProto<0&&(s.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),t.proto=!0));var a=t[n="$"+n];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[n]={init:!1,get:!1,set:!1};a[r]=!0}},y.parseExpression=function(e,t){var s=this.start,n=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===u.comma){var r=this.startNodeAt(s,n);for(r.expressions=[i];this.eat(u.comma);)r.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(r,"SequenceExpression")}return i},y.parseMaybeAssign=function(e,t,s){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var n=!1,i=-1,r=-1,a=-1;t?(i=t.parenthesizedAssign,r=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Ie,n=!0);var o=this.start,c=this.startLoc;(this.type===u.parenL||this.type===u.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===e);var p=this.parseMaybeConditional(e,t);if(s&&(p=s.call(this,p,o,c)),this.type.isAssign){var h=this.startNodeAt(o,c);return h.operator=this.value,this.type===u.eq&&(p=this.toAssignable(p,!1,t)),n||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=p.start&&(t.shorthandAssign=-1),this.type===u.eq?this.checkLValPattern(p):this.checkLValSimple(p),h.left=p,this.next(),h.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(h,"AssignmentExpression")}return n&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),r>-1&&(t.trailingComma=r),p},y.parseMaybeConditional=function(e,t){var s=this.start,n=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(u.question)){var r=this.startNodeAt(s,n);return r.test=i,r.consequent=this.parseMaybeAssign(),this.expect(u.colon),r.alternate=this.parseMaybeAssign(e),this.finishNode(r,"ConditionalExpression")}return i},y.parseExprOps=function(e,t){var s=this.start,n=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===s&&"ArrowFunctionExpression"===i.type?i:this.parseExprOp(i,s,n,-1,e)},y.parseExprOp=function(e,t,s,n,i){var r=this.type.binop;if(null!=r&&(!i||this.type!==u._in)&&r>n){var a=this.type===u.logicalOR||this.type===u.logicalAND,o=this.type===u.coalesce;o&&(r=u.logicalAND.binop);var c=this.value;this.next();var p=this.start,h=this.startLoc,l=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),p,h,r,i),d=this.buildBinary(t,s,e,l,c,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,s,n,i)}return e},y.buildBinary=function(e,t,s,n,i,r){"PrivateIdentifier"===n.type&&this.raise(n.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=s,a.operator=i,a.right=n,this.finishNode(a,r?"LogicalExpression":"BinaryExpression")},y.parseMaybeUnary=function(e,t,s,n){var i,r=this.start,a=this.startLoc;if(this.isContextual("await")&&this.canAwait)i=this.parseAwait(n),t=!0;else if(this.type.prefix){var o=this.startNode(),c=this.type===u.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,c,n),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(o.argument):this.strict&&"delete"===o.operator&&dt(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):"delete"===o.operator&&De(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,i=this.finishNode(o,c?"UpdateExpression":"UnaryExpression")}else if(t||this.type!==u.privateId){if(i=this.parseExprSubscripts(e,n),this.checkExpressionErrors(e))return i;for(;this.type.postfix&&!this.canInsertSemicolon();){var p=this.startNodeAt(r,a);p.operator=this.value,p.prefix=!1,p.argument=i,this.checkLValSimple(i),this.next(),i=this.finishNode(p,"UpdateExpression")}}else(n||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),i=this.parsePrivateIdent(),this.type!==u._in&&this.unexpected();return s||!this.eat(u.starstar)?i:t?void this.unexpected(this.lastTokStart):this.buildBinary(r,a,i,this.parseMaybeUnary(null,!1,!1,n),"**",!1)},y.parseExprSubscripts=function(e,t){var s=this.start,n=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,s,n,!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},y.parseSubscripts=function(e,t,s,n,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,s,n,r,a,i);if(o.optional&&(a=!0),o===e||"ArrowFunctionExpression"===o.type){if(a){var c=this.startNodeAt(t,s);c.expression=o,o=this.finishNode(c,"ChainExpression")}return o}e=o}},y.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(u.arrow)},y.parseSubscriptAsyncArrow=function(e,t,s,n){return this.parseArrowExpression(this.startNodeAt(e,t),s,!0,n)},y.parseSubscript=function(e,t,s,n,i,r,a){var o=this.options.ecmaVersion>=11,c=o&&this.eat(u.questionDot);n&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var p=this.eat(u.bracketL);if(p||c&&this.type!==u.parenL&&this.type!==u.backQuote||this.eat(u.dot)){var h=this.startNodeAt(t,s);h.object=e,p?(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=!!p,o&&(h.optional=c),e=this.finishNode(h,"MemberExpression")}else if(!n&&this.eat(u.parenL)){var l=new Ie,d=this.yieldPos,m=this.awaitPos,f=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(u.parenR,this.options.ecmaVersion>=8,!1,l);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(l,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=d,this.awaitPos=m,this.awaitIdentPos=f,this.parseSubscriptAsyncArrow(t,s,g,a);this.checkExpressionErrors(l,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=m||this.awaitPos,this.awaitIdentPos=f||this.awaitIdentPos;var x=this.startNodeAt(t,s);x.callee=e,x.arguments=g,o&&(x.optional=c),e=this.finishNode(x,"CallExpression")}else if(this.type===u.backQuote){(c||r)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var E=this.startNodeAt(t,s);E.tag=e,E.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(E,"TaggedTemplateExpression")}return e},y.parseExprAtom=function(e,t,s){this.type===u.slash&&this.readRegexp();var n,i=this.potentialArrowAt===this.start;switch(this.type){case u._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),n=this.startNode(),this.next(),this.type===u.parenL&&!this.allowDirectSuper&&this.raise(n.start,"super() call outside constructor of a subclass"),this.type!==u.dot&&this.type!==u.bracketL&&this.type!==u.parenL&&this.unexpected(),this.finishNode(n,"Super");case u._this:return n=this.startNode(),this.next(),this.finishNode(n,"ThisExpression");case u.name:var r=this.start,a=this.startLoc,o=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&"async"===c.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),[c],!1,t);if(this.options.ecmaVersion>=8&&"async"===c.name&&this.type===u.name&&!o&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(u.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(r,a),[c],!0,t)}return c;case u.regexp:var p=this.value;return(n=this.parseLiteral(p.value)).regex={pattern:p.pattern,flags:p.flags},n;case u.num:case u.string:return this.parseLiteral(this.value);case u._null:case u._true:case u._false:return(n=this.startNode()).value=this.type===u._null?null:this.type===u._true,n.raw=this.type.keyword,this.next(),this.finishNode(n,"Literal");case u.parenL:var h=this.start,l=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(l)&&(e.parenthesizedAssign=h),e.parenthesizedBind<0&&(e.parenthesizedBind=h)),l;case u.bracketL:return n=this.startNode(),this.next(),n.elements=this.parseExprList(u.bracketR,!0,!0,e),this.finishNode(n,"ArrayExpression");case u.braceL:return this.overrideContext(I.b_expr),this.parseObj(!1,e);case u._function:return n=this.startNode(),this.next(),this.parseFunction(n,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(s):this.unexpected();default:return this.parseExprAtomDefault()}},y.parseExprAtomDefault=function(){this.unexpected()},y.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 s=this.startNodeAt(t.start,t.loc&&t.loc.start);return s.name="import",t.meta=this.finishNode(s,"Identifier"),this.parseImportMeta(t)}this.unexpected()},y.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")},y.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")},y.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")},y.parseParenExpression=function(){this.expect(u.parenL);var e=this.parseExpression();return this.expect(u.parenR),e},y.shouldParseArrow=function(e){return!this.canInsertSemicolon()},y.parseParenAndDistinguishExpression=function(e,t){var s,n=this.start,i=this.startLoc,r=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a,o=this.start,c=this.startLoc,p=[],h=!0,l=!1,d=new Ie,m=this.yieldPos,f=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)){l=!0;break}if(this.type===u.ellipsis){a=this.start,p.push(this.parseParenItem(this.parseRestBinding())),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}p.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var g=this.lastTokEnd,x=this.lastTokEndLoc;if(this.expect(u.parenR),e&&this.shouldParseArrow(p)&&this.eat(u.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=m,this.awaitPos=f,this.parseParenArrowList(n,i,p,t);(!p.length||l)&&this.unexpected(this.lastTokStart),a&&this.unexpected(a),this.checkExpressionErrors(d,!0),this.yieldPos=m||this.yieldPos,this.awaitPos=f||this.awaitPos,p.length>1?((s=this.startNodeAt(o,c)).expressions=p,this.finishNodeAt(s,"SequenceExpression",g,x)):s=p[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var E=this.startNodeAt(n,i);return E.expression=s,this.finishNode(E,"ParenthesizedExpression")}return s},y.parseParenItem=function(e){return e},y.parseParenArrowList=function(e,t,s,n){return this.parseArrowExpression(this.startNodeAt(e,t),s,!1,n)};var as=[];y.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 s=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'"),s&&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 n=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),n,i,!0,!1),this.eat(u.parenL)?e.arguments=this.parseExprList(u.parenR,this.options.ecmaVersion>=8,!1):e.arguments=as,this.finishNode(e,"NewExpression")},y.parseTemplateElement=function(e){var t=e.isTagged,s=this.startNode();return this.type===u.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),s.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):s.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),s.tail=this.type===u.backQuote,this.finishNode(s,"TemplateElement")},y.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var s=this.startNode();this.next(),s.expressions=[];var n=this.parseTemplateElement({isTagged:t});for(s.quasis=[n];!n.tail;)this.type===u.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(u.dollarBraceL),s.expressions.push(this.parseExpression()),this.expect(u.braceR),s.quasis.push(n=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(s,"TemplateLiteral")},y.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)&&!V.test(this.input.slice(this.lastTokEnd,this.start))},y.parseObj=function(e,t){var s=this.startNode(),n=!0,i={};for(s.properties=[],this.next();!this.eat(u.braceR);){if(n)n=!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),s.properties.push(r)}return this.finishNode(s,e?"ObjectPattern":"ObjectExpression")},y.parseProperty=function(e,t){var s,n,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||(s=this.eat(u.star)));var o=this.containsEsc;return this.parsePropertyName(a),!e&&!o&&this.options.ecmaVersion>=8&&!s&&this.isAsyncProp(a)?(n=!0,s=this.options.ecmaVersion>=9&&this.eat(u.star),this.parsePropertyName(a)):n=!1,this.parsePropertyValue(a,e,s,n,i,r,t,o),this.finishNode(a,"Property")},y.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var s="get"===e.kind?0:1;if(e.value.params.length!==s){var n=e.value.start;"get"===e.kind?this.raiseRecoverable(n,"getter should have no params"):this.raiseRecoverable(n,"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")},y.parsePropertyValue=function(e,t,s,n,i,r,a,o){(s||n)&&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(s,n),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?((s||n)&&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():((s||n)&&this.unexpected(),this.parseGetterSetter(e))},y.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)},y.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},y.parseMethod=function(e,t,s){var n=this.startNode(),i=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(We(t,n.generator)|_e|(s?ut:0)),this.expect(u.parenL),n.params=this.parseBindingList(u.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1,!0,!1),this.yieldPos=i,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(n,"FunctionExpression")},y.parseArrowExpression=function(e,t,s,n){var i=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(We(s,!1)|Ue),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!s),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,n),this.yieldPos=i,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")},y.parseFunctionBody=function(e,t,s,n){var i=t&&this.type!==u.braceL,r=this.strict,a=!1;if(i)e.body=this.parseMaybeAssign(n),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 c=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!r&&!a&&!t&&!s&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,ht),e.body=this.parseBlock(!1,void 0,a&&!r),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},y.isSimpleParamList=function(e){for(var t=0,s=e;t<s.length;t+=1){if("Identifier"!==s[t].type)return!1}return!0},y.checkParams=function(e,t){for(var s=Object.create(null),n=0,i=e.params;n<i.length;n+=1){var r=i[n];this.checkLValInnerPattern(r,He,t?null:s)}},y.parseExprList=function(e,t,s,n){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;s&&this.type===u.comma?a=null:this.type===u.ellipsis?(a=this.parseSpread(n),n&&this.type===u.comma&&n.trailingComma<0&&(n.trailingComma=this.start)):a=this.parseMaybeAssign(!1,n),i.push(a)}return i},y.checkUnreserved=function(e){var t=e.start,s=e.end,n=e.name;(this.inGenerator&&"yield"===n&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===n&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Ae)&&"arguments"===n&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&("arguments"===n||"await"===n)&&this.raise(t,"Cannot use "+n+" in class static initialization block"),this.keywords.test(n)&&this.raise(t,"Unexpected keyword '"+n+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(t,s).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(n)&&(!this.inAsync&&"await"===n&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+n+"' is reserved"))},y.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},y.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},y.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},y.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")},y.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 ye=P.prototype;ye.raise=function(e,t){var s=at(this.input,e);t+=" ("+s.line+":"+s.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var n=new SyntaxError(t);throw n.pos=e,n.loc=s,n.raisedAt=this.pos,n},ye.raiseRecoverable=ye.raise,ye.curPosition=function(){if(this.options.locations)return new de(this.curLine,this.pos-this.lineStart)};var te=P.prototype,os=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};te.enterScope=function(e){this.scopeStack.push(new os(e))},te.exitScope=function(){this.scopeStack.pop()},te.treatFunctionsAsVarInScope=function(e){return e.flags&le||!this.inModule&&e.flags&me},te.declareName=function(e,t,s){var n=!1;if(t===Q){var i=this.currentScope();n=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&me&&delete this.undefinedExports[e]}else if(t===pt){this.currentScope().lexical.push(e)}else if(t===lt){var r=this.currentScope();n=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&ct&&o.lexical[0]===e)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(e)>-1){n=!0;break}if(o.var.push(e),this.inModule&&o.flags&me&&delete this.undefinedExports[e],o.flags&Ae)break}n&&this.raiseRecoverable(s,"Identifier '"+e+"' has already been declared")},te.checkLocalExport=function(e){-1===this.scopeStack[0].lexical.indexOf(e.name)&&-1===this.scopeStack[0].var.indexOf(e.name)&&(this.undefinedExports[e.name]=e)},te.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},te.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Ae|ge|re))return t}},te.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Ae|ge|re)&&!(t.flags&Ue))return t}};var Pe=function(e,t,s){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new Te(e,s)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},xe=P.prototype;function mt(e,t,s,n){return e.type=t,e.end=s,this.options.locations&&(e.loc.end=n),this.options.ranges&&(e.range[1]=s),e}xe.startNode=function(){return new Pe(this,this.start,this.startLoc)},xe.startNodeAt=function(e,t){return new Pe(this,e,t)},xe.finishNode=function(e,t){return mt.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},xe.finishNodeAt=function(e,t,s,n){return mt.call(this,e,t,s,n)},xe.copyNode=function(e){var t=new Pe(this,e.start,this.startLoc);for(var s in e)t[s]=e[s];return t};var cs="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",gt="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",xt=gt+" Extended_Pictographic",bt=xt,Et=xt+" EBase EComp EMod EPres ExtPict",vt=Et,us=Et,ls={9:gt,10:xt,11:xt,12:Et,13:Et,14:us},ps="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",hs={9:"",10:"",11:"",12:"",13:"",14:ps},Je="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",yt="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",Ct=yt+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",St=Ct+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",wt=St+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Tt=wt+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",fs=Tt+" "+cs,ds={9:yt,10:Ct,11:St,12:wt,13:Tt,14:fs},_t={};function ms(e){var t=_t[e]={binary:Y(ls[e]+" "+Je),binaryOfStrings:Y(hs[e]),nonBinary:{General_Category:Y(Je),Script:Y(ds[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 Re=0,Ye=[9,10,11,12,13,14];Re<Ye.length;Re+=1){var gs=Ye[Re];ms(gs)}var x=P.prototype,Ce=function(e,t){this.parent=e,this.base=t||this};Ce.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var s=e;s;s=s.parent)if(t.base===s.base&&t!==s)return!0;return!1},Ce.prototype.sibling=function(){return new Ce(this.parent,this.base)};var q=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=_t[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 xs(e){for(var t in e)return!0;return!1}function bs(e){return 105===e||109===e||115===e}function At(e){return 36===e||e>=40&&e<=43||46===e||63===e||e>=91&&e<=94||e>=123&&e<=125}function Es(e){return H(e,!0)||36===e||95===e}function vs(e){return ee(e,!0)||36===e||95===e||8204===e||8205===e}function It(e){return e>=65&&e<=90||e>=97&&e<=122}function ys(e){return e>=0&&e<=1114111}q.prototype.reset=function(e,t,s){var n=-1!==s.indexOf("v"),i=-1!==s.indexOf("u");this.start=0|e,this.source=t+"",this.flags=s,n&&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)},q.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},q.prototype.at=function(e,t){void 0===t&&(t=!1);var s=this.source,n=s.length;if(e>=n)return-1;var i=s.charCodeAt(e);if(!t&&!this.switchU||i<=55295||i>=57344||e+1>=n)return i;var r=s.charCodeAt(e+1);return r>=56320&&r<=57343?(i<<10)+r-56613888:i},q.prototype.nextIndex=function(e,t){void 0===t&&(t=!1);var s=this.source,n=s.length;if(e>=n)return n;var i,r=s.charCodeAt(e);return!t&&!this.switchU||r<=55295||r>=57344||e+1>=n||(i=s.charCodeAt(e+1))<56320||i>57343?e+1:e+2},q.prototype.current=function(e){return void 0===e&&(e=!1),this.at(this.pos,e)},q.prototype.lookahead=function(e){return void 0===e&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},q.prototype.advance=function(e){void 0===e&&(e=!1),this.pos=this.nextIndex(this.pos,e)},q.prototype.eat=function(e,t){return void 0===t&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},q.prototype.eatChars=function(e,t){void 0===t&&(t=!1);for(var s=this.pos,n=0,i=e;n<i.length;n+=1){var r=i[n],a=this.at(s,t);if(-1===a||a!==r)return!1;s=this.nextIndex(s,t)}return this.pos=s,!0},x.validateRegExpFlags=function(e){for(var t=e.validFlags,s=e.flags,n=!1,i=!1,r=0;r<s.length;r++){var a=s.charAt(r);-1===t.indexOf(a)&&this.raise(e.start,"Invalid regular expression flag"),s.indexOf(a,r+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),"u"===a&&(n=!0),"v"===a&&(i=!0)}this.options.ecmaVersion>=15&&n&&i&&this.raise(e.start,"Invalid regular expression flag")},x.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&xs(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,s=e.backReferenceNames;t<s.length;t+=1){var n=s[t];e.groupNames[n]||e.raise("Invalid named capture referenced")}},x.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Ce(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 s=!1;if(this.options.ecmaVersion>=9&&(s=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!s,!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 s=e.pos;if(e.eat(123)){var n=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return-1!==i&&i<n&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=s}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 s=this.regexp_eatModifiers(e),n=e.eat(45);if(s||n){for(var i=0;i<s.length;i++){var r=s.charAt(i);s.indexOf(r,i+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(n){var a=this.regexp_eatModifiers(e);!s&&!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||s.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="",s=0;-1!==(s=e.current())&&bs(s);)t+=G(s),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!!At(t)&&(e.lastIntValue=t,e.advance(),!0)},x.regexp_eatPatternCharacters=function(e){for(var t=e.pos,s=0;-1!==(s=e.current())&&!At(s);)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,s=e.groupNames[e.lastStringValue];if(s)if(t)for(var n=0,i=s;n<i.length;n+=1){i[n].separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(s||(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+=G(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=G(e.lastIntValue);return!0}return!1},x.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,s=this.options.ecmaVersion>=11,n=e.current(s);return e.advance(s),92===n&&this.regexp_eatRegExpUnicodeEscapeSequence(e,s)&&(n=e.lastIntValue),Es(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)},x.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,s=this.options.ecmaVersion>=11,n=e.current(s);return e.advance(s),92===n&&this.regexp_eatRegExpUnicodeEscapeSequence(e,s)&&(n=e.lastIntValue),vs(n)?(e.lastIntValue=n,!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 s=e.lastIntValue;if(e.switchU)return s>e.maxBackReference&&(e.maxBackReference=s),!0;if(s<=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()&&!ke(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!!It(t)&&(e.lastIntValue=t%32,e.advance(),!0)},x.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){void 0===t&&(t=!1);var s=e.pos,n=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(n&&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(n&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&ys(e.lastIntValue))return!0;n&&e.raise("Invalid unicode escape"),e.pos=s}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 Pt=0,K=1,$=2;function Cs(e){return 100===e||68===e||115===e||83===e||119===e||87===e}function kt(e){return It(e)||95===e}function Ss(e){return kt(e)||ke(e)}function ws(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 Ts(e){return 40===e||41===e||45===e||47===e||e>=91&&e<=93||e>=123&&e<=125}function _s(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 ke(e){return e>=48&&e<=57}function Nt(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Mt(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function Lt(e){return e>=48&&e<=55}x.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Cs(t))return e.lastIntValue=-1,e.advance(),K;var s=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((s=80===t)||112===t)){var n;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(n=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return s&&n===$&&e.raise("Invalid property name"),n;e.raise("Invalid property name")}return Pt},x.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var s=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,s,n),K}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return Pt},x.regexp_validateUnicodePropertyNameAndValue=function(e,t,s){ue(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(s)||e.raise("Invalid property value")},x.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?K:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?$:void e.raise("Invalid property name")},x.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";kt(t=e.current());)e.lastStringValue+=G(t),e.advance();return""!==e.lastStringValue},x.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Ss(t=e.current());)e.lastStringValue+=G(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),s=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&s===$&&e.raise("Negated character class may contain strings"),!0}return!1},x.regexp_classContents=function(e){return 93===e.current()?K:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),K)},x.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var s=e.lastIntValue;e.switchU&&(-1===t||-1===s)&&e.raise("Invalid character class"),-1!==t&&-1!==s&&t>s&&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 s=e.current();(99===s||Lt(s))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var n=e.current();return 93!==n&&(e.lastIntValue=n,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,s=K;if(!this.regexp_eatClassSetRange(e))if(t=this.regexp_eatClassSetOperand(e)){t===$&&(s=$);for(var n=e.pos;e.eatChars([38,38]);)38!==e.current()&&(t=this.regexp_eatClassSetOperand(e))?t!==$&&(s=K):e.raise("Invalid character in character class");if(n!==e.pos)return s;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(n!==e.pos)return s}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return s;t===$&&(s=$)}},x.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var s=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;return-1!==s&&-1!==n&&s>n&&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)?K:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},x.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var s=e.eat(94),n=this.regexp_classContents(e);if(e.eat(93))return s&&n===$&&e.raise("Negated character class may contain strings"),n;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 s=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return s}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)===$&&(t=$);return t},x.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return 1===t?K:$},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 s=e.current();return!(s<0||s===e.lookahead()&&ws(s)||Ts(s))&&(e.advance(),e.lastIntValue=s,!0)},x.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return!!_s(t)&&(e.lastIntValue=t,e.advance(),!0)},x.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!ke(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,s=0;for(e.lastIntValue=0;ke(s=e.current());)e.lastIntValue=10*e.lastIntValue+(s-48),e.advance();return e.pos!==t},x.regexp_eatHexDigits=function(e){var t=e.pos,s=0;for(e.lastIntValue=0;Nt(s=e.current());)e.lastIntValue=16*e.lastIntValue+Mt(s),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 s=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=64*t+8*s+e.lastIntValue:e.lastIntValue=8*t+s}else e.lastIntValue=t;return!0}return!1},x.regexp_eatOctalDigit=function(e){var t=e.current();return Lt(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},x.regexp_eatFixedHexDigits=function(e,t){var s=e.pos;e.lastIntValue=0;for(var n=0;n<t;++n){var i=e.current();if(!Nt(i))return e.pos=s,!1;e.lastIntValue=16*e.lastIntValue+Mt(i),e.advance()}return!0};var qe=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new Te(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},S=P.prototype;function As(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Rt(e){return"function"!=typeof BigInt?null:BigInt(e.replace(/_/g,""))}S.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 qe(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},S.getToken=function(){return this.next(),new qe(this)},typeof Symbol<"u"&&(S[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===u.eof,value:t}}}}),S.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())},S.readToken=function(e){return H(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},S.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},S.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,s=this.input.indexOf("*/",this.pos+=2);if(-1===s&&this.raise(this.pos-2,"Unterminated comment"),this.pos=s+2,this.options.locations)for(var n=void 0,i=t;(n=it(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=n;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,s),t,this.pos,e,this.curPosition())},S.skipLineComment=function(e){for(var t=this.pos,s=this.options.onComment&&this.curPosition(),n=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!ce(n);)n=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,s,this.curPosition())},S.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&&nt.test(String.fromCharCode(e))))break e;++this.pos}}},S.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var s=this.type;this.type=e,this.value=t,this.updateContext(s)},S.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))},S.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)},S.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),s=1,n=42===e?u.star:u.modulo;return this.options.ecmaVersion>=7&&42===e&&42===t&&(++s,n=u.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(u.assign,s+1):this.finishOp(n,s)},S.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)},S.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(u.assign,2):this.finishOp(u.bitwiseXOR,1)},S.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&&!V.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)},S.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),s=1;return t===e?(s=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+s)?this.finishOp(u.assign,s+1):this.finishOp(u.bitShift,s)):33!==t||60!==e||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===t&&(s=2),this.finishOp(u.relational,s)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},S.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)},S.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(46===t){var s=this.input.charCodeAt(this.pos+2);if(s<48||s>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)},S.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,H(e=this.fullCharCodeAtPos(),!0)||92===e))return this.finishToken(u.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+G(e)+"'")},S.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 '"+G(e)+"'")},S.finishOp=function(e,t){var s=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,s)},S.readRegexp=function(){for(var e,t,s=this.pos;;){this.pos>=this.input.length&&this.raise(s,"Unterminated regular expression");var n=this.input.charAt(this.pos);if(V.test(n)&&this.raise(s,"Unterminated regular expression"),e)e=!1;else{if("["===n)t=!0;else if("]"===n&&t)t=!1;else if("/"===n&&!t)break;e="\\"===n}++this.pos}var i=this.input.slice(s,this.pos);++this.pos;var r=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(r);var o=this.regexpState||(this.regexpState=new q(this));o.reset(s,i,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var c=null;try{c=new RegExp(i,a)}catch{}return this.finishToken(u.regexp,{pattern:i,flags:a,value:c})},S.readInt=function(e,t,s){for(var n=this.options.ecmaVersion>=12&&void 0===t,i=s&&48===this.input.charCodeAt(this.pos),r=this.pos,a=0,o=0,c=0,p=t??1/0;c<p;++c,++this.pos){var h=this.input.charCodeAt(this.pos),l=void 0;if(n&&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((l=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+l}}return n&&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},S.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var s=this.readInt(e);return null==s&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(s=Rt(this.input.slice(t,this.pos)),++this.pos):H(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(u.num,s)},S.readNumber=function(e){var t=this.pos;!e&&null===this.readInt(10,void 0,!0)&&this.raise(t,"Invalid number");var s=this.pos-t>=2&&48===this.input.charCodeAt(t);s&&this.strict&&this.raise(t,"Invalid number");var n=this.input.charCodeAt(this.pos);if(!s&&!e&&this.options.ecmaVersion>=11&&110===n){var i=Rt(this.input.slice(t,this.pos));return++this.pos,H(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(u.num,i)}s&&/[89]/.test(this.input.slice(t,this.pos))&&(s=!1),46===n&&!s&&(++this.pos,this.readInt(10),n=this.input.charCodeAt(this.pos)),(69===n||101===n)&&!s&&((43===(n=this.input.charCodeAt(++this.pos))||45===n)&&++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number")),H(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var r=As(this.input.slice(t,this.pos),s);return this.finishToken(u.num,r)},S.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},S.readString=function(e){for(var t="",s=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var n=this.input.charCodeAt(this.pos);if(n===e)break;92===n?(t+=this.input.slice(s,this.pos),t+=this.readEscapedChar(!1),s=this.pos):8232===n||8233===n?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(ce(n)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(s,this.pos++),this.finishToken(u.string,t)};var Ot={};S.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==Ot)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},S.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ot;this.raise(e,t)},S.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var s=this.input.charCodeAt(this.pos);if(96===s||36===s&&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===s?(this.pos+=2,this.finishToken(u.dollarBraceL)):(++this.pos,this.finishToken(u.backQuote));if(92===s)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(ce(s)){switch(e+=this.input.slice(t,this.pos),++this.pos,s){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(s)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},S.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")},S.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 G(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 s=this.pos-1;this.invalidStringToken(s,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var n=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(n,8);return i>255&&(n=n.slice(0,-1),i=parseInt(n,8)),this.pos+=n.length-1,t=this.input.charCodeAt(this.pos),("0"!==n||56===t||57===t)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-n.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)}},S.readHexChar=function(e){var t=this.pos,s=this.readInt(16,e);return null===s&&this.invalidStringToken(t,"Bad character escape sequence"),s},S.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,s=this.pos,n=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(ee(i,n))this.pos+=i<=65535?1:2;else{if(92!==i)break;this.containsEsc=!0,e+=this.input.slice(s,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?H:ee)(a,n)||this.invalidStringToken(r,"Invalid Unicode escape"),e+=G(a),s=this.pos}t=!1}return e+this.input.slice(s,this.pos)},S.readWord=function(){var e=this.readWord1(),t=u.name;return this.keywords.test(e)&&(t=$e[e]),this.finishToken(t,e)};var Is="8.15.0";function ne(e,t){return P.parse(e,t)}function J(e,t,s,n,i){s||(s=m),function e(n,i,r){var a=r||n.type;s[a](n,i,e),t[a]&&t[a](n,i)}(e,n,i)}function Ps(e,t,s,n,i){var r=[];s||(s=m),function e(n,i,a){var o=a||n.type,c=n!==r[r.length-1];c&&r.push(n),s[o](n,i,e),t[o]&&t[o](n,i||r,r),c&&r.pop()}(e,n,i)}function Xe(e,t,s){s(e,t)}function ae(e,t,s){}P.acorn={Parser:P,version:Is,defaultOptions:Ve,Position:de,SourceLocation:Te,getLineInfo:at,Node:Pe,TokenType:T,tokTypes:u,keywordTypes:$e,TokContext:U,tokContexts:I,isIdentifierChar:ee,isIdentifierStart:H,Token:qe,isNewLine:ce,lineBreak:V,lineBreakG:Qt,nonASCIIwhitespace:nt};var m={};m.Program=m.BlockStatement=m.StaticBlock=function(e,t,s){for(var n=0,i=e.body;n<i.length;n+=1){s(i[n],t,"Statement")}},m.Statement=Xe,m.EmptyStatement=ae,m.ExpressionStatement=m.ParenthesizedExpression=m.ChainExpression=function(e,t,s){return s(e.expression,t,"Expression")},m.IfStatement=function(e,t,s){s(e.test,t,"Expression"),s(e.consequent,t,"Statement"),e.alternate&&s(e.alternate,t,"Statement")},m.LabeledStatement=function(e,t,s){return s(e.body,t,"Statement")},m.BreakStatement=m.ContinueStatement=ae,m.WithStatement=function(e,t,s){s(e.object,t,"Expression"),s(e.body,t,"Statement")},m.SwitchStatement=function(e,t,s){s(e.discriminant,t,"Expression");for(var n=0,i=e.cases;n<i.length;n+=1){s(i[n],t)}},m.SwitchCase=function(e,t,s){e.test&&s(e.test,t,"Expression");for(var n=0,i=e.consequent;n<i.length;n+=1){s(i[n],t,"Statement")}},m.ReturnStatement=m.YieldExpression=m.AwaitExpression=function(e,t,s){e.argument&&s(e.argument,t,"Expression")},m.ThrowStatement=m.SpreadElement=function(e,t,s){return s(e.argument,t,"Expression")},m.TryStatement=function(e,t,s){s(e.block,t,"Statement"),e.handler&&s(e.handler,t),e.finalizer&&s(e.finalizer,t,"Statement")},m.CatchClause=function(e,t,s){e.param&&s(e.param,t,"Pattern"),s(e.body,t,"Statement")},m.WhileStatement=m.DoWhileStatement=function(e,t,s){s(e.test,t,"Expression"),s(e.body,t,"Statement")},m.ForStatement=function(e,t,s){e.init&&s(e.init,t,"ForInit"),e.test&&s(e.test,t,"Expression"),e.update&&s(e.update,t,"Expression"),s(e.body,t,"Statement")},m.ForInStatement=m.ForOfStatement=function(e,t,s){s(e.left,t,"ForInit"),s(e.right,t,"Expression"),s(e.body,t,"Statement")},m.ForInit=function(e,t,s){"VariableDeclaration"===e.type?s(e,t):s(e,t,"Expression")},m.DebuggerStatement=ae,m.FunctionDeclaration=function(e,t,s){return s(e,t,"Function")},m.VariableDeclaration=function(e,t,s){for(var n=0,i=e.declarations;n<i.length;n+=1){s(i[n],t)}},m.VariableDeclarator=function(e,t,s){s(e.id,t,"Pattern"),e.init&&s(e.init,t,"Expression")},m.Function=function(e,t,s){e.id&&s(e.id,t,"Pattern");for(var n=0,i=e.params;n<i.length;n+=1){s(i[n],t,"Pattern")}s(e.body,t,e.expression?"Expression":"Statement")},m.Pattern=function(e,t,s){"Identifier"===e.type?s(e,t,"VariablePattern"):"MemberExpression"===e.type?s(e,t,"MemberPattern"):s(e,t)},m.VariablePattern=ae,m.MemberPattern=Xe,m.RestElement=function(e,t,s){return s(e.argument,t,"Pattern")},m.ArrayPattern=function(e,t,s){for(var n=0,i=e.elements;n<i.length;n+=1){var r=i[n];r&&s(r,t,"Pattern")}},m.ObjectPattern=function(e,t,s){for(var n=0,i=e.properties;n<i.length;n+=1){var r=i[n];"Property"===r.type?(r.computed&&s(r.key,t,"Expression"),s(r.value,t,"Pattern")):"RestElement"===r.type&&s(r.argument,t,"Pattern")}},m.Expression=Xe,m.ThisExpression=m.Super=m.MetaProperty=ae,m.ArrayExpression=function(e,t,s){for(var n=0,i=e.elements;n<i.length;n+=1){var r=i[n];r&&s(r,t,"Expression")}},m.ObjectExpression=function(e,t,s){for(var n=0,i=e.properties;n<i.length;n+=1){s(i[n],t)}},m.FunctionExpression=m.ArrowFunctionExpression=m.FunctionDeclaration,m.SequenceExpression=function(e,t,s){for(var n=0,i=e.expressions;n<i.length;n+=1){s(i[n],t,"Expression")}},m.TemplateLiteral=function(e,t,s){for(var n=0,i=e.quasis;n<i.length;n+=1){s(i[n],t)}for(var r=0,a=e.expressions;r<a.length;r+=1){s(a[r],t,"Expression")}},m.TemplateElement=ae,m.UnaryExpression=m.UpdateExpression=function(e,t,s){s(e.argument,t,"Expression")},m.BinaryExpression=m.LogicalExpression=function(e,t,s){s(e.left,t,"Expression"),s(e.right,t,"Expression")},m.AssignmentExpression=m.AssignmentPattern=function(e,t,s){s(e.left,t,"Pattern"),s(e.right,t,"Expression")},m.ConditionalExpression=function(e,t,s){s(e.test,t,"Expression"),s(e.consequent,t,"Expression"),s(e.alternate,t,"Expression")},m.NewExpression=m.CallExpression=function(e,t,s){if(s(e.callee,t,"Expression"),e.arguments)for(var n=0,i=e.arguments;n<i.length;n+=1){s(i[n],t,"Expression")}},m.MemberExpression=function(e,t,s){s(e.object,t,"Expression"),e.computed&&s(e.property,t,"Expression")},m.ExportNamedDeclaration=m.ExportDefaultDeclaration=function(e,t,s){e.declaration&&s(e.declaration,t,"ExportNamedDeclaration"===e.type||e.declaration.id?"Statement":"Expression"),e.source&&s(e.source,t,"Expression")},m.ExportAllDeclaration=function(e,t,s){e.exported&&s(e.exported,t),s(e.source,t,"Expression")},m.ImportDeclaration=function(e,t,s){for(var n=0,i=e.specifiers;n<i.length;n+=1){s(i[n],t)}s(e.source,t,"Expression")},m.ImportExpression=function(e,t,s){s(e.source,t,"Expression")},m.ImportSpecifier=m.ImportDefaultSpecifier=m.ImportNamespaceSpecifier=m.Identifier=m.PrivateIdentifier=m.Literal=ae,m.TaggedTemplateExpression=function(e,t,s){s(e.tag,t,"Expression"),s(e.quasi,t,"Expression")},m.ClassDeclaration=m.ClassExpression=function(e,t,s){return s(e,t,"Class")},m.Class=function(e,t,s){e.id&&s(e.id,t,"Pattern"),e.superClass&&s(e.superClass,t,"Expression"),s(e.body,t)},m.ClassBody=function(e,t,s){for(var n=0,i=e.body;n<i.length;n+=1){s(i[n],t)}},m.MethodDefinition=m.PropertyDefinition=m.Property=function(e,t,s){e.computed&&s(e.key,t,"Expression"),e.value&&s(e.value,t,"Expression")};const g={ATTR_PREFIXES:{COMPONENT:"pp-component",CONTEXT:"pp-context",LOOP:"pp-for",SPREAD:"pp-spread"},SCRIPT_TYPE:"text/pp",MAX_CACHE_SIZE:500,DEBOUNCE_MS:16,POOL_SIZE:10,MUSTACHE_PATTERN:/\{((?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*)\}/,MUSTACHE_SINGLE_PATTERN:/^\{((?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*)\}$/},Vt=new Set(["true","false","null","undefined","this","window","document","console","Math","Date","JSON","Object","Array","return","let","const","var","if","else","for","while","switch","case","break","continue","function","new","in","of","typeof","instanceof","void","delete","try","catch","finally","class","extends","super","thisElement","eventObject"]);function ks(e,t){let s;return(...n)=>{clearTimeout(s),s=window.setTimeout((()=>e(...n)),t)}}function Ft(e){return e.charAt(0).toUpperCase()+e.slice(1)}function k(e){if(null==e||"boolean"==typeof e||"function"==typeof e||Array.isArray(e)&&0===e.length||"object"==typeof e&&0===Object.keys(e).length)return"";if("number"==typeof e)return String(e);if("string"==typeof e)return e;if(Array.isArray(e))return e.map((e=>k(e))).filter((e=>""!==e)).join("");if("object"==typeof e)try{return JSON.stringify(e)}catch{return"[object Object]"}return String(e)}const W=class e{constructor(){d(this,"stateVariables",new Set)}static getInstance(){return e.instance||(e.instance=new e),e.instance}transformEffectDeclarations(e){try{const t=ne(e,{ecmaVersion:2022,sourceType:"script",allowReturnOutsideFunction:!0});let s=e;const n=[];return J(t,{CallExpression:t=>{const s=this.transformEffectCall(t,e);s&&n.push(s)}}),n.sort(((e,t)=>t.start-e.start)).forEach((e=>{s=s.slice(0,e.start)+e.replacement+s.slice(e.end)})),s}catch(t){return console.error("Effect transformation error:",t),e}}transformEffectCall(e,t){if(!this.isPPEffectCall(e))return null;const s=e.arguments;if(s.length<2)return null;const n=s[1];if("ArrayExpression"!==n.type||!n.elements.some((e=>!!e&&("Identifier"===e.type||"MemberExpression"===e.type))))return null;const i=n.elements.map((e=>e?"Identifier"===e.type?`"${e.name}"`:"MemberExpression"===e.type?`"${this.extractMemberExpression(e,t)}"`:t.slice(e.start,e.end):"null")),r=t.slice(s[0].start,s[0].end),a=s.slice(2).map((e=>t.slice(e.start,e.end))).join(", "),o=`[${i.join(", ")}]`,c=a?`pp.effect(${r}, ${o}, ${a})`:`pp.effect(${r}, ${o})`;return{start:e.start,end:e.end,replacement:c}}extractMemberExpression(e,t){if("MemberExpression"!==e.type)return"Identifier"===e.type?e.name:t.slice(e.start,e.end);const s=this.extractMemberExpression(e.object,t);if(e.computed){return`${s}[${t.slice(e.property.start,e.property.end)}]`}return`${s}.${e.property.name||t.slice(e.property.start,e.property.end)}`}isPPEffectCall(e){var t,s,n;return"MemberExpression"===(null==(t=e.callee)?void 0:t.type)&&"Identifier"===(null==(s=e.callee.object)?void 0:s.type)&&"pp"===e.callee.object.name&&"Identifier"===(null==(n=e.callee.property)?void 0:n.type)&&"effect"===e.callee.property.name}transformStateDeclarations(e){this.stateVariables.clear();let t=this.transformStateDeclarationsOnly(e);return t=this.transformEffectDeclarations(t),t=this.transformUnsupportedStateUsages(t),t}transformStateDeclarationsOnlyOriginal(e){try{const t=ne(e,{ecmaVersion:2022,sourceType:"script",allowReturnOutsideFunction:!0});let s=e;const n=[];return J(t,{VariableDeclarator:t=>{const s=this.transformStateDeclarator(t,e);s&&n.push(s)}}),n.sort(((e,t)=>t.start-e.start)).forEach((e=>{s=s.slice(0,e.start)+e.replacement+s.slice(e.end)})),s}catch(t){return console.error("AST transformation error:",t),e}}transformStateDeclarationsOnly(e){let t=this.transformStateDeclarationsOnlyOriginal(e);return t=this.transformDestructuringAssignments(t),t}transformUnsupportedStateUsages(e){try{const t=ne(e,{ecmaVersion:2022,sourceType:"script",allowReturnOutsideFunction:!0});this.collectStateVariables(t);let s=e;const n=[];return J(t,{SpreadElement:e=>{const t=this.transformSpreadElement(e,s);t&&n.push(t)},UnaryExpression:e=>{const t=this.transformUnaryExpression(e,s);t&&n.push(t)},BinaryExpression:e=>{const t=this.transformBinaryExpression(e,s);t&&n.push(t)},LogicalExpression:e=>{const t=this.transformLogicalExpression(e,s);t&&n.push(t)},ConditionalExpression:e=>{const t=this.transformConditionalExpression(e,s);t&&n.push(t)},IfStatement:e=>{const t=this.transformIfStatement(e,s);t&&n.push(t)},WhileStatement:e=>{const t=this.transformWhileStatement(e,s);t&&n.push(t)},ForStatement:e=>{const t=this.transformForStatement(e,s);t&&n.push(t)},ReturnStatement:e=>{const t=this.transformReturnStatement(e,s);t&&n.push(t)},VariableDeclarator:e=>{const t=this.transformVariableDeclarator(e,s);t&&n.push(t)},AssignmentExpression:e=>{const t=this.transformAssignmentExpression(e,s);t&&n.push(t)},CallExpression:e=>{const t=this.transformGeneralCallExpression(e,s);t&&n.push(t)}}),Ps(t,{Identifier:(e,t)=>{n.some((t=>e.start>=t.start&&e.end<=t.end))||this.stateVariables.has(e.name)&&(this.alreadyHasValue(e,s)||this.isPartOfStateDeclaration(e,t)||this.isPropertyName(e,t)||this.isMethodCallObject(e,t)||this.isPartOfPPCall(e,t)||this.isPartOfDestructuring(e,t)||n.push({start:e.start,end:e.end,replacement:`${e.name}.value`}))}}),n.sort(((e,t)=>t.start-e.start)).forEach((e=>{s=s.slice(0,e.start)+e.replacement+s.slice(e.end)})),s=this.transformMultipleCallArguments(s),s}catch(t){return console.error("State usage transformation error:",t),e}}transformLogicalExpression(e,t){var s,n;return"Identifier"===(null==(s=e.left)?void 0:s.type)&&this.stateVariables.has(e.left.name)&&!this.alreadyHasValue(e.left,t)?{start:e.left.start,end:e.left.end,replacement:`${e.left.name}.value`}:"Identifier"===(null==(n=e.right)?void 0:n.type)&&this.stateVariables.has(e.right.name)&&!this.alreadyHasValue(e.right,t)?{start:e.right.start,end:e.right.end,replacement:`${e.right.name}.value`}:null}transformConditionalExpression(e,t){var s,n,i;return"Identifier"===(null==(s=e.test)?void 0:s.type)&&this.stateVariables.has(e.test.name)&&!this.alreadyHasValue(e.test,t)?{start:e.test.start,end:e.test.end,replacement:`${e.test.name}.value`}:"Identifier"===(null==(n=e.consequent)?void 0:n.type)&&this.stateVariables.has(e.consequent.name)&&!this.alreadyHasValue(e.consequent,t)?{start:e.consequent.start,end:e.consequent.end,replacement:`${e.consequent.name}.value`}:"Identifier"===(null==(i=e.alternate)?void 0:i.type)&&this.stateVariables.has(e.alternate.name)&&!this.alreadyHasValue(e.alternate,t)?{start:e.alternate.start,end:e.alternate.end,replacement:`${e.alternate.name}.value`}:null}transformIfStatement(e,t){return this.transformExpressionNode(e.test,t)}transformWhileStatement(e,t){return this.transformExpressionNode(e.test,t)}transformForStatement(e,t){return e.test?this.transformExpressionNode(e.test,t):null}transformReturnStatement(e,t){return e.argument?this.transformExpressionNode(e.argument,t):null}transformVariableDeclarator(e,t){var s,n,i;return this.isStateDeclaration(e)||"ArrayPattern"===(null==(s=e.id)?void 0:s.type)||"ObjectPattern"===(null==(n=e.id)?void 0:n.type)?null:"Identifier"===(null==(i=e.init)?void 0:i.type)&&this.stateVariables.has(e.init.name)&&!this.alreadyHasValue(e.init,t)?{start:e.init.start,end:e.init.end,replacement:`${e.init.name}.value`}:null}transformAssignmentExpression(e,t){var s,n,i;return"ArrayPattern"===(null==(s=e.left)?void 0:s.type)||"ObjectPattern"===(null==(n=e.left)?void 0:n.type)?null:"Identifier"===(null==(i=e.right)?void 0:i.type)&&this.stateVariables.has(e.right.name)&&!this.alreadyHasValue(e.right,t)?{start:e.right.start,end:e.right.end,replacement:`${e.right.name}.value`}:null}transformGeneralCallExpression(t,s){var n,i;const r=s.slice(t.callee.start,t.callee.end);if("MemberExpression"===(null==(n=t.callee)?void 0:n.type)&&"Identifier"===(null==(i=t.callee.object)?void 0:i.type)&&this.stateVariables.has(t.callee.object.name)||this.isPPCall(t))return null;if(!e.isFunctionNeedingValueTransform(r)&&t.arguments.length>0)for(const e of t.arguments)if("Identifier"===e.type&&this.stateVariables.has(e.name)&&!this.alreadyHasValue(e,s))return{start:e.start,end:e.end,replacement:`${e.name}.value`};return null}static isFunctionNeedingValueTransform(e){return this.FUNCTIONS_NEEDING_VALUE_TRANSFORM.some((t=>t.includes(".")?e===t:e===t||e.endsWith("."+t)))}transformExpressionNode(e,t){return"Identifier"===(null==e?void 0:e.type)&&this.stateVariables.has(e.name)&&!this.alreadyHasValue(e,t)?{start:e.start,end:e.end,replacement:`${e.name}.value`}:null}isPPCall(e){var t,s,n;return"MemberExpression"===(null==(t=e.callee)?void 0:t.type)&&"Identifier"===(null==(s=e.callee.object)?void 0:s.type)&&"pp"===e.callee.object.name&&"Identifier"===(null==(n=e.callee.property)?void 0:n.type)&&("state"===e.callee.property.name||"effect"===e.callee.property.name)}isPartOfStateDeclaration(e,t){var s,n;if(!t||!Array.isArray(t))return!1;for(const e of t)if("VariableDeclarator"===e.type&&"ArrayPattern"===(null==(s=e.id)?void 0:s.type)&&"CallExpression"===(null==(n=e.init)?void 0:n.type)&&this.isPPStateCall(e.init))return!0;return!1}isPropertyName(e,t){if(!t||0===t.length)return!1;const s=t[t.length-1];return"Property"===(null==s?void 0:s.type)&&s.key===e||"MemberExpression"===(null==s?void 0:s.type)&&s.property===e&&!s.computed}isMethodCallObject(e,t){if(!t||0===t.length)return!1;const s=t[t.length-1];if("MemberExpression"===(null==s?void 0:s.type)&&s.object===e&&t.length>=2){const e=t[t.length-2];if("CallExpression"===(null==e?void 0:e.type)&&e.callee===s)return!0}return!1}isPartOfPPCall(e,t){var s,n,i;if(!t||!Array.isArray(t))return!1;for(const e of t)if("CallExpression"===e.type&&"MemberExpression"===(null==(s=e.callee)?void 0:s.type)&&"Identifier"===(null==(n=e.callee.object)?void 0:n.type)&&"pp"===e.callee.object.name&&"Identifier"===(null==(i=e.callee.property)?void 0:i.type)&&("state"===e.callee.property.name||"effect"===e.callee.property.name))return!0;return!1}isPartOfDestructuring(e,t){if(!t||!Array.isArray(t))return!1;for(let s=0;s<t.length;s++){const n=t[s];if("ArrayPattern"===n.type||"ObjectPattern"===n.type){if(s+1<t.length){const i=t[s+1];if("VariableDeclarator"===(null==i?void 0:i.type)&&i.id===n&&i.init===e)return!1}return!0}}return!1}collectStateVariables(e){J(e,{VariableDeclarator:e=>{if(this.isStateDeclaration(e)){const t=e.id.elements[0];"Identifier"===(null==t?void 0:t.type)&&this.stateVariables.add(t.name)}}})}isStateDeclaration(e){var t,s;return"ArrayPattern"===(null==(t=e.id)?void 0:t.type)&&"CallExpression"===(null==(s=e.init)?void 0:s.type)&&this.isPPStateCall(e.init)}transformSpreadElement(e,t){var s;return"Identifier"===(null==(s=e.argument)?void 0:s.type)&&this.stateVariables.has(e.argument.name)?this.alreadyHasValue(e.argument,t)?null:{start:e.argument.start,end:e.argument.end,replacement:`${e.argument.name}.value`}:null}transformUnaryExpression(e,t){var s;return"Identifier"===(null==(s=e.argument)?void 0:s.type)&&this.stateVariables.has(e.argument.name)&&["typeof","!","+","-","~","void","delete"].includes(e.operator)&&!this.alreadyHasValue(e.argument,t)?{start:e.argument.start,end:e.argument.end,replacement:`${e.argument.name}.value`}:null}transformBinaryExpression(e,t){var s,n;if(["===","!==","==","!=",">","<",">=","<=","+","-","*","/","%","**","&","|","^","<<",">>",">>>","in","instanceof"].includes(e.operator)){if("Identifier"===(null==(s=e.left)?void 0:s.type)&&this.stateVariables.has(e.left.name)&&!this.alreadyHasValue(e.left,t))return{start:e.left.start,end:e.left.end,replacement:`${e.left.name}.value`};if("Identifier"===(null==(n=e.right)?void 0:n.type)&&this.stateVariables.has(e.right.name)&&!this.alreadyHasValue(e.right,t))return{start:e.right.start,end:e.right.end,replacement:`${e.right.name}.value`}}return null}transformMultipleCallArguments(t){try{const s=ne(t,{ecmaVersion:2022,sourceType:"script",allowReturnOutsideFunction:!0});let n=t;const i=[];return J(s,{CallExpression:t=>{const s=n.slice(t.callee.start,t.callee.end);if(e.isFunctionNeedingValueTransform(s)&&t.arguments.length>0)for(const e of t.arguments)"Identifier"===e.type&&this.stateVariables.has(e.name)&&(this.alreadyHasValue(e,n)||i.push({start:e.start,end:e.end,replacement:`${e.name}.value`}))}}),i.sort(((e,t)=>t.start-e.start)).forEach((e=>{n=n.slice(0,e.start)+e.replacement+n.slice(e.end)})),n}catch(e){return console.error("Multiple call arguments transformation error:",e),t}}transformDestructuringAssignments(e){try{const t=ne(e,{ecmaVersion:2022,sourceType:"script",allowReturnOutsideFunction:!0});let s=e;const n=[];return J(t,{VariableDeclarator:t=>{var s,i,r;this.isStateDeclaration(t)||("ArrayPattern"===(null==(s=t.id)?void 0:s.type)||"ObjectPattern"===(null==(i=t.id)?void 0:i.type))&&"Identifier"===(null==(r=t.init)?void 0:r.type)&&this.stateVariables.has(t.init.name)&&(this.alreadyHasValue(t.init,e)||n.push({start:t.init.start,end:t.init.end,replacement:`${t.init.name}.value`}))},AssignmentExpression:t=>{var s,i,r;("ArrayPattern"===(null==(s=t.left)?void 0:s.type)||"ObjectPattern"===(null==(i=t.left)?void 0:i.type))&&"Identifier"===(null==(r=t.right)?void 0:r.type)&&this.stateVariables.has(t.right.name)&&(this.alreadyHasValue(t.right,e)||n.push({start:t.right.start,end:t.right.end,replacement:`${t.right.name}.value`}))}}),n.sort(((e,t)=>t.start-e.start)).forEach((e=>{s=s.slice(0,e.start)+e.replacement+s.slice(e.end)})),s}catch(t){return console.error("Destructuring transformation error:",t),e}}alreadyHasValue(e,t){const s=e.end;return t.slice(s,s+6).startsWith(".value")}transformStateDeclarator(e,t){var s,n;if("ArrayPattern"!==(null==(s=e.id)?void 0:s.type)||"CallExpression"!==(null==(n=e.init)?void 0:n.type))return null;const i=e.init;if(!this.isPPStateCall(i))return null;const r=e.id.elements[0];if(!r||"Identifier"!==r.type)return null;const a=r.name,o=`set${this.capitalize(a)}`,c=e.id.elements[1];return"Identifier"===(null==c?void 0:c.type)&&c.name!==o&&console.warn(`Setter name mismatch: expected ${o}, got ${c.name}`),this.createTransformation(i,a,t)}isPPStateCall(e){var t,s,n;return"MemberExpression"===(null==(t=e.callee)?void 0:t.type)&&"Identifier"===(null==(s=e.callee.object)?void 0:s.type)&&"pp"===e.callee.object.name&&"Identifier"===(null==(n=e.callee.property)?void 0:n.type)&&"state"===e.callee.property.name}createTransformation(e,t,s){const n=e.arguments;if(0===n.length){const s=`pp.state("${t}")`;return{start:e.start,end:e.end,replacement:s}}const i=n[0];if("Literal"===i.type&&"string"==typeof i.value&&i.value===t)return null;if(1===n.length){const n=`pp.state("${t}", ${s.slice(i.start,i.end)})`;return{start:e.start,end:e.end,replacement:n}}const r=`pp.state("${t}", ${s.slice(e.arguments[0].start,e.arguments[e.arguments.length-1].end)})`;return{start:e.start,end:e.end,replacement:r}}looksLikeVariableName(e){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)&&e.length<=50&&!e.includes(" ")}extractStateDeclarations(e){const t=[];try{J(ne(e,{ecmaVersion:2022,sourceType:"script",allowReturnOutsideFunction:!0,locations:!0}),{VariableDeclarator:s=>{const n=this.extractStateFromDeclarator(s,e);n&&t.push(n)}})}catch(e){console.error("State extraction error:",e)}return t}extractStateFromDeclarator(e,t){var s,n,i,r;if("ArrayPattern"!==(null==(s=e.id)?void 0:s.type)||"CallExpression"!==(null==(n=e.init)?void 0:n.type)||!this.isPPStateCall(e.init))return null;const a=e.id.elements[0],o=e.id.elements[1];if("Identifier"!==(null==a?void 0:a.type)||"Identifier"!==(null==o?void 0:o.type))return null;const c=e.init.arguments;let p,h=a.name;return c.length>=1&&("Literal"===c[0].type&&"string"==typeof c[0].value?this.looksLikeVariableName(c[0].value)?(h=c[0].value,c.length>=2&&(p=this.extractLiteralValue(c[1]))):(h=a.name,p=this.extractLiteralValue(c[0])):p=this.extractLiteralValue(c[0])),{variableName:a.name,setterName:o.name,stateKey:h,initialValue:p,line:(null==(i=e.loc)?void 0:i.start.line)||0,column:(null==(r=e.loc)?void 0:r.start.column)||0}}extractFunctionDeclarations(e){const t=[];try{J(ne(e,{ecmaVersion:2022,sourceType:"script",allowReturnOutsideFunction:!0,locations:!0}),{FunctionDeclaration:e=>{var s,n;"Identifier"===(null==(s=e.id)?void 0:s.type)&&t.push({name:e.id.name,type:"function",params:e.params.map((e=>"Identifier"===e.type?e.name:"")),line:(null==(n=e.loc)?void 0:n.start.line)||0})},VariableDeclarator:e=>{var s,n,i,r;if("Identifier"===(null==(s=e.id)?void 0:s.type)&&("ArrowFunctionExpression"===(null==(n=e.init)?void 0:n.type)||"FunctionExpression"===(null==(i=e.init)?void 0:i.type))){const s=e.init;t.push({name:e.id.name,type:"ArrowFunctionExpression"===s.type?"arrow":"function",params:s.params.map((e=>"Identifier"===e.type?e.name:"")),line:(null==(r=e.loc)?void 0:r.start.line)||0})}}})}catch(e){console.error("Function extraction error:",e)}return t}extractLiteralValue(e){if("Literal"===e.type)return e.value;"Identifier"===e.type&&e.name}capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}};d(W,"instance"),d(W,"FUNCTIONS_NEEDING_VALUE_TRANSFORM",["console.log","console.warn","console.error","console.info","console.debug","console.dir","console.table","console.trace","console.assert","JSON.stringify","JSON.parse","Object.keys","Object.values","Object.entries","Array.from","Array.isArray","Math.max","Math.min","Math.abs","Math.floor","Math.ceil","Math.round","alert","confirm","prompt","parseInt","parseFloat","Number","String","Boolean"]);let Se=W;class Ge{constructor(e){this.evaluator=e}render(e,t,s){const n=N.isSingleExpression(e);if(n)return this.evaluator.evaluateExpression(n,t,s);let i="";for(const n of N.parse(e))if("static"===n.type)i+=n.content;else if(n.expression)try{i+=k(this.evaluator.evaluateExpression(n.expression,t,s))}catch{}return i}dependencies(e,t,s){const n=N.extractExpressions(e),i=new Set;for(const e of n)for(const n of this.evaluator.extractDependencies(e,t,s))i.add(n);return[...i]}}class Dt{static containsMustacheExpression(e){if(g.MUSTACHE_PATTERN.test(e))return!0;const t=N.decodeEntities(e);return g.MUSTACHE_PATTERN.test(t)}}class C{static getContextComponent(e){const t=e.getAttribute(g.ATTR_PREFIXES.CONTEXT);if(t){if("parent"===t){const t=C.getElementComponent(e);return C.getParentOfComponent(t,e)}return"app"===t?"app":t}return C.getElementComponent(e)}static getParentOfComponent(e,t){if("app"===e)return"app";let s=t;for(;s&&s.getAttribute(g.ATTR_PREFIXES.COMPONENT)!==e;)s=s.parentElement;if(!s)return"app";let n=s.parentElement;for(;n;){const e=n.getAttribute(g.ATTR_PREFIXES.COMPONENT);if(e)return e;n=n.parentElement}return"app"}static findElementForComponent(e,t){return"app"===t?document.body:document.querySelectorAll(`[${g.ATTR_PREFIXES.COMPONENT}="${t}"]`)[0]||null}static getElementDepth(e){let t=0,s=e.parentElement;for(;s&&s!==document.body;)t++,s=s.parentElement;return t}static getParentComponentForElement(e){let t=e.parentElement;for(;t;){const e=t.getAttribute(g.ATTR_PREFIXES.COMPONENT);if(e)return e;t=t.parentElement}return"app"}static isTextNodeInsideScript(e){let t=e.parentElement;for(;t&&t!==document.body;){const e=t.tagName.toLowerCase();if("script"===e||"style"===e)return!0;t=t.parentElement}return!1}static getComponentForNode(e){let t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;for(;t;){const e=t.getAttribute(g.ATTR_PREFIXES.COMPONENT);if(e)return e;t=t.parentElement}return"app"}static getElementComponent(e){const t=e.getAttribute(g.ATTR_PREFIXES.COMPONENT);if(t)return t;let s=e.parentElement;for(;s;){const e=s.getAttribute(g.ATTR_PREFIXES.COMPONENT);if(e)return e;s=s.parentElement}return"app"}}class he{static isEventAttribute(e){return e.startsWith("on")&&e.length>2&&!e.includes("-")}}class we{static findExistingStateKey(e,t,s){return[`${t}.${e}`,`app.${e}`,e].find((e=>e in s))||null}}class Ns{static isBooleanAttribute(e){return["checked","disabled","hidden","readonly","required","multiple","selected","autofocus","autoplay","controls","defer","loop","muted","open","reversed","async","default","formnovalidate","novalidate","allowfullscreen","capture","itemscope"].includes(e)}}class et{constructor(){d(this,"pendingUpdates",new Map),d(this,"batchTimeout",null),d(this,"componentManager"),d(this,"domBindingManager")}setManagers(e,t){this.componentManager=e,this.domBindingManager=t}scheduleUpdate(e,t){this.pendingUpdates.has(e)||this.pendingUpdates.set(e,new Set),this.pendingUpdates.get(e).add(t),null===this.batchTimeout&&(this.batchTimeout=window.setTimeout((()=>{this.processBatchedUpdates()}),0))}processBatchedUpdates(){const e=new Map(this.pendingUpdates);this.pendingUpdates.clear(),this.batchTimeout=null;const t=this.sortUpdatesByDependency(e);for(const[e,s]of t)this.processComponentUpdate(e,s)}sortUpdatesByDependency(e){return Array.from(e.entries()).sort((([,e],[,t])=>Math.min(...Array.from(e).map((e=>C.getElementDepth(e))))-Math.min(...Array.from(t).map((e=>C.getElementDepth(e))))))}processComponentUpdate(e,t){if(!this.componentManager||!this.domBindingManager)return;this.componentManager.invalidateComponent(e);const s=[],n=[],i=[];for(const r of t){if(!document.contains(r))continue;const t=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null);let a;for(;a=t.nextNode();)s.push(a);const o=this.domBindingManager.loopManager;if(o){const t=o.getAllLoops();for(const[s,i]of t)i.component===e&&r.contains(s)&&n.push([s,i])}i.push(r)}this.updateTextNodesBatch(s,e),this.updateLoopsBatch(n),this.updateElementsBatch(i,e)}updateTextNodesBatch(e,t){const s=this.domBindingManager.textNodeManager;s&&e.forEach((e=>{document.contains(e)&&C.getComponentForNode(e)===t&&s.updateTextNode(e)}))}updateLoopsBatch(e){const t=this.domBindingManager.loopManager;if(!t)return;const s=new Map;e.forEach((([e,t])=>{const n=C.getElementDepth(e);s.has(n)||s.set(n,[]),s.get(n).push([e,t])}));const n=Array.from(s.keys()).sort(((e,t)=>e-t));for(const e of n)s.get(e).forEach((([e,s])=>{document.contains(e)&&t.renderLoop(s,s.iterableExpr)}))}updateElementsBatch(e,t){e.forEach((e=>{document.contains(e)&&this.domBindingManager.processElementBindings(e,!0)}))}}class Bt{constructor(e,t){d(this,"loopBindings",new Map),d(this,"stateManager"),d(this,"expressionEvaluator"),d(this,"componentManager"),d(this,"domBindingManager"),d(this,"cleanupObserver"),d(this,"loopCounter",0),d(this,"pendingTemplates",[]),d(this,"loopItemElements",new WeakSet),d(this,"loopItemContexts",new WeakMap),d(this,"templateRenderer"),d(this,"contextCache",new Map),d(this,"contextCacheTimestamps",new Map),this.stateManager=e,this.expressionEvaluator=t,this.cleanupObserver=new MutationObserver((e=>{this.cleanupDetachedTemplates(e)})),this.cleanupObserver.observe(document.body,{childList:!0,subtree:!0}),this.templateRenderer=new Ge(t)}getLoopContextForElement(e){if(!this.domBindingManager)return null;const t=this.domBindingManager.loopManager;if(!t)return null;let s=e.parentElement;for(;s;){if(t.isLoopItem&&t.isLoopItem(s))return t.getLoopItemContext(s);s=s.parentElement}const n=t.getAllLoops();for(const[t,s]of n)for(const t of s.renderedItems)if(t.element.contains(e))return t.context;return null}setDependencies(e,t){this.componentManager=e,this.domBindingManager=t}queueTemplate(e,t){this.loopBindings.has(e)||this.pendingTemplates.push({template:e,component:t})}processPendingTemplates(){const e=[...this.pendingTemplates];this.pendingTemplates=[];for(const{template:t,component:s}of e)document.contains(t)&&this.processTemplate(t,s)}processTemplate(e,t){const s=e.getAttribute("pp-for");if(!s||this.loopBindings.has(e))return;const n=this.parseLoopExpression(s);if(!n)return void console.error(`Invalid pp-for syntax: "${s}"`);const i=e.parentElement,r=document.createComment(`pp-for: ${s}`);i.insertBefore(r,e);const a={template:e,expression:s,itemVar:n.itemVar,indexVar:n.indexVar,component:t,subscriptionIds:[],renderedItems:[],keyExpression:void 0,parentElement:i,placeholder:r,iterableExpr:n.iterableExpr};this.loopBindings.set(e,a),this.setupLoopReactivity(a,n.iterableExpr),this.renderLoop(a,n.iterableExpr)}parseLoopExpression(e){const t=e.match(/^\s*([a-zA-Z_$][\w$]*)\s+in\s+(.+)$/);if(t)return{itemVar:t[1],iterableExpr:t[2].trim()};const s=e.match(/^\s*\(\s*([a-zA-Z_$][\w$]*)\s*,\s*([a-zA-Z_$][\w$]*)\s*\)\s+in\s+(.+)$/);return s?{itemVar:s[1],indexVar:s[2],iterableExpr:s[3].trim()}:null}setupLoopReactivity(e,t){const s=`loop_${Date.now()}_${++this.loopCounter}`,n=this.expressionEvaluator.extractDependencies(t,e.component,this.stateManager),i=this.findComponentElementForLoop(e);if(i&&this.componentManager){const t=this.componentManager.getComponentPropDependencies(i,e.component);n.push(...t)}const r={id:s,selector:"",dependencies:new Set(n),callback:()=>{this.renderLoop(e,e.iterableExpr)},element:e.parentElement,component:e.component};this.stateManager.addSubscription(r),e.subscriptionIds.push(s)}renderLoop(e,t){if(this.componentManager&&this.domBindingManager)try{const s=this.findComponentElementForLoop(e);let n;const i=this.findParentLoopContext(e.template);n=i?{...this.componentManager.buildComponentContextWithProps(e.component,s),...i}:this.componentManager.buildComponentContextWithProps(e.component,s);const r=this.expressionEvaluator.evaluateExpression(t,n,e.component);if(!Array.isArray(r))return console.warn(`Loop expression "${t}" did not return an array:`,r,`Available context keys: [${Object.keys(n).join(", ")}]`,"Parent loop context:",i),void this.clearRenderedItems(e);this.updateRenderedItems(e,r)}catch(s){console.error(`Error evaluating loop expression "${t}":`,s),this.clearRenderedItems(e)}}findParentLoopContext(e){const t=[];let s=e.parentElement;for(;s&&s!==document.body;){if(this.loopItemElements.has(s)){const e=this.loopItemContexts.get(s);e&&t.unshift(e)}for(const[n,i]of this.loopBindings)if(i.template!==e)for(const n of i.renderedItems)if(n.element===s||n.element.contains(e)){t.unshift(n.context);break}s=s.parentElement}return t.length>0?t.reduce(((e,t)=>({...e,...t})),{}):null}findComponentElementForLoop(e){let t=e.parentElement;for(;t;){if(t.getAttribute(g.ATTR_PREFIXES.COMPONENT)===e.component)return t;t=t.parentElement}return document.querySelectorAll(`[${g.ATTR_PREFIXES.COMPONENT}="${e.component}"]`)[0]||void 0}updateRenderedItems(e,t){const s=e.renderedItems,n=[],i=new Set,r=new Map;s.forEach((e=>{r.set(e.key,e)})),t.forEach(((t,s)=>{const a=this.generateItemKey(e,t,s),o=r.get(a);if(o&&!i.has(o.element))i.add(o.element),this.updateItemContext(e,o,t,s),n.push(o);else{const i=this.createLoopItem(e,t,s,a);i&&(n.push(i),this.processNestedLoopsInItem(i,e.component))}})),s.forEach((e=>{i.has(e.element)||this.cleanupLoopItem(e)})),this.updateDOMOrder(e,n),e.renderedItems=n}processNestedLoopsInItem(e,t){e.element.querySelectorAll("template[pp-for]").forEach((s=>{const n=s;this.loopBindings.has(n)||this.processNestedTemplate(n,t,e.context)}))}generateItemKey(e,t,s){const n=e.template.content.firstElementChild;if(n&&n.hasAttribute("key")){const i=n.getAttribute("key");try{const n=this.createItemContextWithParentContext(e,t,s),r=N.isSingleExpression(i);if(r){const t=this.expressionEvaluator.evaluateExpression(r,n,e.component);return String(t)}{const t=N.parse(i);let s="";for(const i of t)if("static"===i.type)s+=i.content;else if(i.expression){s+=k(this.expressionEvaluator.evaluateExpression(i.expression,n,e.component))}return s}}catch(n){console.warn(`Error evaluating key expression "${i}":`,n,"Available context keys:",Object.keys(this.createItemContextWithParentContext(e,t,s)))}}return t&&"object"==typeof t&&"id"in t?String(t.id):`${e.expression}_${s}`}createItemContextWithParentContext(e,t,s){if(!this.componentManager)return{};e.component,e.expression;const n={...this.componentManager.buildComponentContext(e.component),...this.getAllParentLoopContexts(e.template),[e.itemVar]:t};return e.indexVar&&(n[e.indexVar]=s),n}getAllParentLoopContexts(e){const t=[];let s=e.parentElement;for(;s&&s!==document.body;){if(this.loopItemElements.has(s)){const e=this.loopItemContexts.get(s);e&&t.unshift(e)}for(const[n,i]of this.loopBindings)if(n!==e)for(const n of i.renderedItems)if(n.element===s||n.element.contains(e)){t.unshift(n.context);break}s=s.parentElement}return t.reduce(((e,t)=>({...e,...t})),{})}createItemContext(e,t,s){if(!this.componentManager)return{};const n={...this.componentManager.buildComponentContext(e.component),...this.findAllParentLoopContexts(e.template),[e.itemVar]:t};return e.indexVar&&(n[e.indexVar]=s),n}findAllParentLoopContexts(e){const t={};let s=e.parentElement;for(;s&&s!==document.body;){if(this.loopItemElements.has(s)){const e=this.loopItemContexts.get(s);if(e)for(const[s,n]of Object.entries(e))s in t||(t[s]=n)}for(const[n,i]of this.loopBindings)if(n!==e)for(const e of i.renderedItems)if(e.element===s){for(const[s,n]of Object.entries(e.context))s in t||(t[s]=n);break}s=s.parentElement}return t}createLoopItem(e,t,s,n){if(!this.domBindingManager)return null;try{const i=this.createItemContextWithParentContext(e,t,s),r=document.importNode(e.template.content,!0),a=document.createElement("div");a.appendChild(r);const o=a.firstElementChild;if(!o)return console.warn("Template content must contain exactly one root element"),null;a.removeChild(o),this.loopItemElements.add(o),this.loopItemContexts.set(o,i),o.getAttribute("key")&&o.removeAttribute("key");const c={key:n,element:o,context:i,subscriptionIds:[],textNodeTemplates:new Map,attributeTemplates:new Map};return this.executeComponentScriptsInLoopItem(o),this.processElementWithContext(o,i,e.component,c),this.cleanupRawMustacheAttributes(o),c}catch(e){return console.error("Error creating loop item:",e),null}}executeComponentScriptsInLoopItem(e){if(!this.componentManager)return;const t=[e],s=e.querySelectorAll(`[${g.ATTR_PREFIXES.COMPONENT}]`);t.push(...Array.from(s)),t.forEach((e=>{if(e.hasAttribute(g.ATTR_PREFIXES.COMPONENT)){const t=e.getAttribute(g.ATTR_PREFIXES.COMPONENT);if(t){const s=this.getLoopItemContextForElement(e),n=`${t}_${this.generateInstanceId(s)}`;e.setAttribute(g.ATTR_PREFIXES.COMPONENT,n),e.__originalComponentName=t,e.__uniqueComponentName=n,this.componentManager.pushComponent(n),this.getComponentScripts(e).forEach((e=>{this.componentManager.executeScript(e)})),this.componentManager.popComponent()}}}))}getLoopItemContextForElement(e){let t=e;for(;t;){if(this.loopItemElements.has(t)){const e=this.loopItemContexts.get(t);if(e)return e}t=t.parentElement}for(const[t,s]of this.loopBindings)for(const t of s.renderedItems)if(t.element===e||t.element.contains(e))return t.context;return console.warn("⚠️ No loop item context found, using empty context"),{}}generateInstanceId(e){const t={};for(const[s,n]of Object.entries(e))"function"==typeof n||s.startsWith("set")||s.endsWith("Getter")||"getContext"===s||"withContext"===s||"__getProp"===s||(n&&"object"==typeof n&&"id"in n||"object"!=typeof n||Array.isArray(n))&&(t[s]=n);return 0===Object.keys(t).length?`${Date.now()}_${Math.random().toString(36).substring(2,7)}`:Object.keys(t).sort().map((e=>{const s=t[e];return s&&"object"==typeof s&&"id"in s?`${e}_${s.id}`:"string"==typeof s||"number"==typeof s?`${e}_${s}`:`${e}_${JSON.stringify(s)}`})).join("_").replace(/[^a-zA-Z0-9_]/g,"").substring(0,20)||`fallback_${Date.now()}`}getComponentScripts(e){const t=[];return e.querySelectorAll(`script[type="${g.SCRIPT_TYPE}"]`).forEach((s=>{const n=s;let i=n.parentElement,r=!1;for(;i&&i!==e.parentElement;){if(i===e){r=!0;break}if(i.hasAttribute(g.ATTR_PREFIXES.COMPONENT)&&i!==e)break;i=i.parentElement}r&&t.push(n)})),t}cleanupRawMustacheAttributes(e){this.cleanupElementMustacheAttributes(e);const t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null);let s;for(;s=t.nextNode();)this.cleanupElementMustacheAttributes(s)}cleanupElementMustacheAttributes(e){const t=Array.from(e.attributes);for(const s of t)s.value&&g.MUSTACHE_PATTERN.test(s.value)&&(Ns.isBooleanAttribute(s.name),e.removeAttribute(s.name))}processElementWithContext(e,t,s,n){if(!this.domBindingManager||!this.componentManager)return;const i=(e,s)=>{const n=this.componentManager.buildComponentContext(s),i=e.getAttribute(g.ATTR_PREFIXES.COMPONENT);if(i&&i!==s){const e=this.componentManager.buildComponentContext(i);return{...t,...n,...e}}return{...t,...n}},r=this.componentManager.buildComponentContextWithProps.bind(this.componentManager);this.componentManager.buildComponentContextWithProps=(t,s)=>s&&(s===e||e.contains(s))?i(s,t):r(t,s);try{this.bindLoopItemElement(e,t,s,n),this.setupEventBindingsForLoopItem(e,s);const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,{acceptNode:t=>{if(t===e)return NodeFilter.FILTER_SKIP;if(t.nodeType===Node.TEXT_NODE){const e=t;if(C.isTextNodeInsideScript(e))return NodeFilter.FILTER_REJECT;if(e.textContent&&g.MUSTACHE_PATTERN.test(e.textContent))return NodeFilter.FILTER_ACCEPT}else if(t.nodeType===Node.ELEMENT_NODE)return"script"===t.tagName.toLowerCase()?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT;return NodeFilter.FILTER_SKIP}});let a;for(;a=r.nextNode();)if(a.nodeType===Node.TEXT_NODE){const e=a;if(e.textContent&&g.MUSTACHE_PATTERN.test(e.textContent)){const t=this.getComponentForTextNode(e),s=i(e.parentElement,t);this.processTextNodeWithLoopContext(e,s,t,n)}}else if(a.nodeType===Node.ELEMENT_NODE){const e=a,t=C.getElementComponent(e),s=i(e,t);this.bindLoopItemElement(e,s,t,n),this.setupEventBindingsForLoopItem(e,t)}e.querySelectorAll("template[pp-for]").forEach((e=>{this.processNestedTemplate(e,s,t)}))}finally{this.componentManager.buildComponentContextWithProps=r}}getComponentForTextNode(e){let t=e.parentElement;for(;t;){const e=t.getAttribute(g.ATTR_PREFIXES.COMPONENT);if(e)return e;t=t.parentElement}return"app"}processNestedTemplate(e,t,s){const n=e.getAttribute("pp-for");if(!n||this.loopBindings.has(e))return;const i=this.parseLoopExpression(n);if(!i)return void console.error(`Invalid pp-for syntax: "${n}"`);const r=e.parentElement,a=document.createComment(`pp-for: ${n}`);r.insertBefore(a,e);const o=this.findComponentElementForTemplate(e);let c={...s};const p=this.findParentLoopContextForNestedTemplate(e);if(p&&(c={...c,...p}),o&&this.componentManager){const e=o.getAttribute(g.ATTR_PREFIXES.COMPONENT);if(e){const t=C.getParentComponentForElement(o);this.componentManager.hasStoredProps(o)||this.componentManager.setupProps(o,t);const s=this.evaluateComponentPropsWithContext(o,c);c={...this.componentManager.buildComponentContext(e),...s,...c}}}const h={template:e,expression:n,itemVar:i.itemVar,indexVar:i.indexVar,iterableExpr:i.iterableExpr,component:t,subscriptionIds:[],renderedItems:[],keyExpression:void 0,parentElement:r,placeholder:a};this.loopBindings.set(e,h),this.setupNestedLoopReactivity(h,i.iterableExpr,c),this.renderNestedLoop(h,i.iterableExpr,c)}findParentLoopContextForNestedTemplate(e){let t=e.parentElement;const s={};let n=0;for(;t&&t!==document.body&&n<10;){if(n++,this.loopItemElements.has(t)){const e=this.loopItemContexts.get(t);if(e)for(const[t,n]of Object.entries(e))t in s||(s[t]=n)}for(const[n,i]of this.loopBindings)for(const n of i.renderedItems)(n.element.contains(e)||n.element===t)&&(i.itemVar in s||(s[i.itemVar]=n.context[i.itemVar]),i.indexVar&&!(i.indexVar in s)&&(s[i.indexVar]=n.context[i.indexVar]));t=t.parentElement}return Object.keys(s).length>0?s:null}evaluateComponentPropsWithContext(e,t){const s={};if(!this.componentManager||!this.expressionEvaluator)return s;const n=this.componentManager.extractProps(e,"app");for(const[e,i]of n)try{const n=this.templateRenderer.render(i.expression,t,i.component);s[e]=n}catch(t){console.error(`Failed to evaluate prop "${e}":`,t),s[e]=void 0}return s}findComponentElementForTemplate(e){let t=e.parentElement;for(;t;){if(t.hasAttribute(g.ATTR_PREFIXES.COMPONENT))return t;t=t.parentElement}return null}setupNestedLoopReactivity(e,t,s){const n=`nested_loop_${Date.now()}_${++this.loopCounter}`;let i=this.expressionEvaluator.extractDependencies(t,e.component,this.stateManager);const r={id:n,selector:"",dependencies:new Set(i),callback:()=>{const n=e.template,i=this.findComponentElementForTemplate(n);let r=s;if(n.parentElement){const e=this.getParentLoopContextForElement(n);e&&(r={...r,...e})}if(i&&this.componentManager){const t=i.getAttribute(g.ATTR_PREFIXES.COMPONENT);if(t){const n=this.extractParentLoopContextFromBinding(e,s),a=this.evaluateComponentPropsWithContext(i,n),o=this.componentManager.buildComponentContext(t);r={...n,...o,...a}}}this.renderNestedLoop(e,t,r)},element:e.parentElement,component:e.component};this.stateManager.addSubscription(r),e.subscriptionIds.push(n)}getParentLoopContextForElement(e){let t=e.parentElement;for(;t;){if(this.loopItemElements.has(t)){const e=this.loopItemContexts.get(t);if(e)return e}t=t.parentElement}return null}extractParentLoopContextFromBinding(e,t){const s=new Set;for(const[t,n]of this.loopBindings)if(n!==e)for(const t of n.renderedItems)if(t.element.contains(e.template)){s.add(n.itemVar),n.indexVar&&s.add(n.indexVar);break}const n={};for(const[e,i]of Object.entries(t))(s.has(e)||e.startsWith("users")||e.startsWith("set")||e.includes("Getter")||"function"==typeof i)&&(n[e]=i);return n}renderNestedLoop(e,t,s){if(this.componentManager&&this.domBindingManager)try{const n=this.expressionEvaluator.evaluateExpression(t,s,e.component);if(!Array.isArray(n))return console.warn(`Nested loop expression "${t}" did not return an array:`,n,`Available context keys: [${Object.keys(s).join(", ")}]`),void this.clearRenderedItems(e);this.updateNestedRenderedItems(e,n,s)}catch(n){console.error(`Error evaluating nested loop expression "${t}":`,n,`Available context keys: [${Object.keys(s).join(", ")}]`),this.clearRenderedItems(e)}}updateNestedRenderedItems(e,t,s){const n=e.renderedItems,i=[],r=new Set,a=new Map;n.forEach((e=>{a.set(e.key,e)})),t.forEach(((t,n)=>{const o=this.generateNestedItemKey(e,t,n,s),c=a.get(o);if(c&&!r.has(c.element))r.add(c.element),this.updateNestedItemContext(e,c,t,n,s),i.push(c);else{const r=this.createNestedLoopItem(e,t,n,o,s);r&&i.push(r)}})),n.forEach((e=>{r.has(e.element)||this.cleanupLoopItem(e)})),this.updateDOMOrder(e,i),e.renderedItems=i}generateNestedItemKey(e,t,s,n){return t&&"object"==typeof t&&"id"in t?String(t.id):`${e.expression}_${s}_${JSON.stringify(n[e.itemVar]||{})}`}createNestedLoopItem(e,t,s,n,i){if(!this.domBindingManager)return null;try{const r={...i,[e.itemVar]:t};e.indexVar&&(r[e.indexVar]=s);const a=document.importNode(e.template.content,!0),o=document.createElement("div");o.appendChild(a);const c=o.firstElementChild;if(!c)return console.warn("Template content must contain exactly one root element"),null;o.removeChild(c),this.loopItemElements.add(c),this.loopItemContexts.set(c,r),c.getAttribute("key")&&c.removeAttribute("key");const p={key:n,element:c,context:r,subscriptionIds:[],textNodeTemplates:new Map,attributeTemplates:new Map};return this.processElementWithContext(c,r,e.component,p),this.cleanupRawMustacheAttributes(c),p}catch(e){return console.error("Error creating nested loop item:",e),null}}updateNestedItemContext(e,t,s,n,i){const r={...i};r[e.itemVar]=s,e.indexVar&&(r[e.indexVar]=n);const a=this.gatherAllComponentContextsInLoopItem(t.element),o={...r,...a};if(t.context=o,this.loopItemContexts.set(t.element,o),t.textNodeTemplates)for(const[e,s]of t.textNodeTemplates)document.contains(e)&&this.updateTextNodeWithContext(e,s,o,this.getTextNodeComponent(e));if(t.attributeTemplates)for(const[e,s]of t.attributeTemplates)document.contains(e)&&s.forEach(((t,s)=>{var n;try{const i=C.getElementComponent(e),r=this.buildElementSpecificContext(e,o),a=this.templateRenderer.render(t,r,i);null==(n=this.domBindingManager)||n.updateElementProperty(e,s,a)}catch(e){console.error(`Nested binding update error for "${t}":`,e)}}))}bindLoopItemElement(e,t,s,n){const i=this.extractMustacheBindings(e);n&&i.size>0&&(n.attributeTemplates||(n.attributeTemplates=new Map),n.attributeTemplates.set(e,new Map(i))),i.forEach(((i,r)=>{this.createLoopItemBinding(e,r,i,t,s,n)}))}setupEventBindingsForLoopItem(e,t){const s=this.domBindingManager.eventDelegation;if(!s)return void console.warn("No event delegation manager available");const n=Array.from(e.attributes);for(const i of n)if(he.isEventAttribute(i.name)){const n=i.name.substring(2);s.registerEventHandler(e,n,i.value,t),e.removeAttribute(i.name)}}processTextNodeWithLoopContext(e,t,s,n){if(C.isTextNodeInsideScript(e))return;const i=e.textContent||"";if(!N.parse(i).some((e=>"expression"===e.type)))return;n&&(n.textNodeTemplates||(n.textNodeTemplates=new Map),n.textNodeTemplates.set(e,i));const r=this.findActualComponentForTextNode(e);this.updateTextNodeWithContext(e,i,t,r);const a=`loop_text_${Date.now()}_${Math.random()}`,o=this.templateRenderer.dependencies(i,r,this.stateManager),c=new Set(o),p={id:a,selector:"",dependencies:c,callback:()=>{if(!document.contains(e))return void this.stateManager.removeSubscription(a);let t={};if(this.componentManager&&(t=this.componentManager.buildComponentContext(r)),n){const e={};let s=null;for(const[e,t]of this.loopBindings)if(t.renderedItems.includes(n)){s=t;break}if(s){e[s.itemVar]=n.context[s.itemVar],s.indexVar&&(e[s.indexVar]=n.context[s.indexVar]);const t=this.findParentLoopContext(s.template);t&&Object.assign(e,t)}t={...t,...e}}this.updateTextNodeWithContext(e,i,t,r)},component:r};this.stateManager.addSubscription(p),n&&n.subscriptionIds.push(a)}findActualComponentForTextNode(e){let t=e.parentElement;for(;t;){const e=t.getAttribute(g.ATTR_PREFIXES.COMPONENT);if(e){return t.__uniqueComponentName||e}t=t.parentElement}return"app"}updateTextNodeWithContext(e,t,s,n){const i=N.parse(t);let r="";for(const e of i)if("static"===e.type)r+=e.content;else if(e.expression)try{r+=k(this.expressionEvaluator.evaluateExpression(e.expression,s,n))}catch(t){console.warn(`Loop text evaluation error for "${e.expression}":`,t,"Available context keys:",Object.keys(s)),r+=""}e.textContent!==r&&(e.textContent=r)}extractMustacheBindings(e){const t=new Map,s=e.attributes;for(let e=0;e<s.length;e++){const n=s[e];if(n.name!==g.ATTR_PREFIXES.COMPONENT&&"key"!==n.name&&!n.name.startsWith("on")&&n.value){const e=g.MUSTACHE_PATTERN.test(n.value),s=N.decodeEntities(n.value),i=g.MUSTACHE_PATTERN.test(s);(e||i)&&t.set(n.name,s)}}return t}createLoopItemBinding(e,t,s,n,i,r){const a=`loop_item_${Date.now()}_${Math.random()}`,o=this.templateRenderer.dependencies(s,i,this.stateManager),c=new Set(o);let p=!1,h=0;const l=()=>{var o;if(!p)if(document.contains(e)){h=0;try{const a=this.componentManager.buildComponentContext(i);let c;if(r){c={...a};let e=null;for(const[t,s]of this.loopBindings)if(s.renderedItems.includes(r)){e=s;break}e&&(c[e.itemVar]=r.context[e.itemVar],e.indexVar&&(c[e.indexVar]=r.context[e.indexVar]));for(const[e,t]of Object.entries(r.context))e in c||(c[e]=t)}else c=n;const p=this.templateRenderer.render(s,c,i);null==(o=this.domBindingManager)||o.updateElementProperty(e,t,p)}catch(e){console.error(`Loop item binding evaluation error for "${s}":`,e),console.error("Available context keys:",Object.keys(n))}}else if(h++,h<5){const e=10*Math.pow(2,h-1);setTimeout((()=>{p||l()}),e)}else p=!0,this.stateManager.removeSubscription(a)},u={id:a,selector:"",dependencies:c,callback:()=>{p||l()},element:e,component:i};if(this.stateManager.addSubscription(u),r){r.subscriptionIds.push(a);const e=this.cleanupLoopItem.bind(this);this.cleanupLoopItem=t=>{t===r&&(p=!0),e(t)}}(()=>{document.contains(e)?l():Promise.resolve().then((()=>{if(!p&&document.contains(e))l();else if(!p&&h<5){h++;const e=10*Math.pow(2,h-1);setTimeout((()=>{p||l()}),e)}else!p&&h>=5&&(p=!0,this.stateManager.removeSubscription(a))}))})()}updateItemContext(e,t,s,n){const i={...this.createItemContext(e,s,n),...this.gatherAllComponentContextsInLoopItem(t.element)};if(t.context=i,this.loopItemContexts.set(t.element,i),t.textNodeTemplates)for(const[e,s]of t.textNodeTemplates)document.contains(e)&&this.updateTextNodeWithContext(e,s,i,this.getTextNodeComponent(e));if(t.attributeTemplates)for(const[e,s]of t.attributeTemplates)document.contains(e)&&s.forEach(((t,s)=>{var n;try{const r=C.getElementComponent(e),a=this.buildElementSpecificContext(e,i),o=this.templateRenderer.render(t,a,r);null==(n=this.domBindingManager)||n.updateElementProperty(e,s,o)}catch(e){console.error(`Attribute binding update error for "${t}":`,e)}}))}gatherAllComponentContextsInLoopItem(e){if(!this.componentManager)return{};const t={};if(e.hasAttribute(g.ATTR_PREFIXES.COMPONENT)){const s=e.getAttribute(g.ATTR_PREFIXES.COMPONENT),n=this.componentManager.buildComponentContext(s);Object.assign(t,n)}return e.querySelectorAll(`[${g.ATTR_PREFIXES.COMPONENT}]`).forEach((e=>{var s;const n=e.getAttribute(g.ATTR_PREFIXES.COMPONENT),i=null==(s=this.componentManager)?void 0:s.buildComponentContext(n);Object.assign(t,i)})),t}buildElementSpecificContext(e,t){if(!this.componentManager)return t;const s=C.getElementComponent(e),n=this.componentManager.buildComponentContext(s);return{...t,...n}}getTextNodeComponent(e){let t=e.parentElement;for(;t;){const e=t.getAttribute(g.ATTR_PREFIXES.COMPONENT);if(e)return e;t=t.parentElement}return"app"}updateDOMOrder(e,t){let s=e.placeholder;t.forEach((t=>{(t.element.parentElement!==e.parentElement||t.element!==s.nextSibling)&&e.parentElement.insertBefore(t.element,s.nextSibling),s=t.element}))}clearRenderedItems(e){e.renderedItems.forEach((e=>{this.cleanupLoopItem(e)})),e.renderedItems=[]}cleanupLoopItem(e){this.loopItemElements.delete(e.element),this.loopItemContexts.delete(e.element),e.element.parentElement&&e.element.parentElement.removeChild(e.element),e.subscriptionIds.forEach((e=>{this.stateManager.removeSubscription(e)}))}isLoopItem(e){return this.loopItemElements.has(e)}getLoopItemContext(e){return this.loopItemContexts.get(e)}cleanupDetachedTemplates(e){for(const t of e)"childList"===t.type&&t.removedNodes.forEach((e=>{if(e.nodeType===Node.ELEMENT_NODE){const t=e;"TEMPLATE"===t.tagName&&t.hasAttribute("pp-for")&&this.cleanupTemplate(t),t.querySelectorAll("template[pp-for]").forEach((e=>{this.cleanupTemplate(e)}))}}))}cleanupTemplate(e){const t=this.loopBindings.get(e);t&&(this.clearRenderedItems(t),t.subscriptionIds.forEach((e=>{this.stateManager.removeSubscription(e)})),t.placeholder.parentElement&&t.placeholder.parentElement.removeChild(t.placeholder),this.loopBindings.delete(e))}getAllLoops(){return new Map(this.loopBindings)}destroy(){this.cleanupObserver.disconnect(),Array.from(this.loopBindings.keys()).forEach((e=>{this.cleanupTemplate(e)})),this.loopItemContexts=new WeakMap}}class oe{constructor(e){d(this,"cache",new Map),d(this,"maxSize"),this.maxSize=e}get(e){const t=this.cache.get(e);return void 0!==t&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){const e=this.cache.keys().next().value;void 0!==e&&this.cache.delete(e)}this.cache.set(e,t)}has(e){return this.cache.has(e)}delete(e){return this.cache.delete(e)}clear(){this.cache.clear()}}const F=class e{static parseSpreadDirective(e){const t=e.replace(/^\s*\{\s*|\s*\}\s*$/g,""),s=this.parseSpreadParts(t),n=[],i=[];for(const e of s){const t=e.trim();if(t.startsWith("..."))n.push(t.substring(3).trim());else if(t.startsWith("{")&&t.endsWith("}")){const e=t.slice(1,-1).trim();if(e){const t=this.parseObjectProperties(e);i.push(t)}}else console.warn(`Invalid spread directive part: "${t}". Expected ...spread or {object}`)}return{spreads:n,objects:i}}static parseSpreadParts(e){const t=[];let s="",n=0,i=!1,r="",a=0;for(;a<e.length;){const o=e[a],c=a>0?e[a-1]:"";if(i||'"'!==o&&"'"!==o?i&&o===r&&"\\"!==c&&(i=!1,r=""):(i=!0,r=o),!i)if("{"===o)n++;else if("}"===o)n--;else if(","===o&&0===n){t.push(s.trim()),s="",a++;continue}s+=o,a++}return s.trim()&&t.push(s.trim()),t}static parseObjectProperties(e){const t=[],s=this.parseObjectParts(e);for(const e of s){const s=e.trim(),n=this.findPropertySeparator(s);if(-1!==n){const e=s.substring(0,n).trim().replace(/['"]/g,""),i=s.substring(n+1).trim();t.push({key:e,value:i})}else console.warn(`Invalid object property: "${s}". Expected key: value format.`)}return t}static parseObjectParts(e){const t=[];let s="",n=0,i=!1,r="";for(let a=0;a<e.length;a++){const o=e[a],c=a>0?e[a-1]:"";if(i||'"'!==o&&"'"!==o?i&&o===r&&"\\"!==c&&(i=!1,r=""):(i=!0,r=o),!i)if("{"===o||"["===o||"("===o)n++;else if("}"===o||"]"===o||")"===o)n--;else if(","===o&&0===n){t.push(s.trim()),s="";continue}s+=o}return s.trim()&&t.push(s.trim()),t}static findPropertySeparator(e){let t=0,s=!1,n="";for(let i=0;i<e.length;i++){const r=e[i],a=i>0?e[i-1]:"";if(s||'"'!==r&&"'"!==r?s&&r===n&&"\\"!==a&&(s=!1,n=""):(s=!0,n=r),!s)if("{"===r||"["===r||"("===r)t++;else if("}"===r||"]"===r||")"===r)t--;else if(":"===r&&0===t)return i}return-1}static splitMixedExpression(e){const t=[];let s="",n=0,i=!1,r="";for(let a=0;a<e.length;a++){const o=e[a],c=a>0?e[a-1]:"";if(i||'"'!==o&&"'"!==o?i&&o===r&&"\\"!==c&&(i=!1,r=""):(i=!0,r=o),!i)if("{"===o||"["===o||"("===o)n++;else if("}"===o||"]"===o||")"===o)n--;else if(","===o&&0===n){t.push(s.trim()),s="";continue}s+=o}return s.trim()&&t.push(s.trim()),t}static parse(t){const s=e.decodeEntities(t);if(e.EXPRESSION_CACHE.has(s))return e.EXPRESSION_CACHE.get(s);const n=e.parseContentWithNesting(s);return e.EXPRESSION_CACHE.set(s,n),n}static parseContentWithNesting(e){const t=[],s=e.length;let n=0,i=0;for(;n<s;)if("{"===e[n]){n>i&&t.push({type:"static",content:e.substring(i,n),expression:null});const s=this.extractNestedExpression(e,n);-1!==s.endIndex?(t.push({type:"expression",content:e.substring(n,s.endIndex+1),expression:s.expression.trim()}),n=s.endIndex+1,i=n):n++}else n++;return i<s&&t.push({type:"static",content:e.substring(i),expression:null}),t}static extractNestedExpression(e,t){let s=1,n=t+1,i=!1,r="",a=!1;for(;n<e.length&&s>0;){const t=e[n],o=n>0?e[n-1]:"";i||'"'!==t&&"'"!==t?i&&t===r&&"\\"!==o&&(i=!1,r=""):(i=!0,r=t),!i&&"`"===t&&"\\"!==o&&(a=!a),!i&&!a&&("{"===t?s++:"}"===t&&s--),n++}if(0===s){return{endIndex:n-1,expression:e.slice(t+1,n-1)}}return{endIndex:-1,expression:""}}static isSingleExpression(t){const s=e.decodeEntities(t),n=e.parseContentWithNesting(s);return 1===n.length&&"expression"===n[0].type?n[0].expression:null}static extractExpressions(t){const s=e.decodeEntities(t);return e.parseContentWithNesting(s).filter((e=>"expression"===e.type)).map((e=>e.expression)).filter((e=>e))}};d(F,"EXPRESSION_CACHE",new oe(1e3)),d(F,"decodeEntities",(e=>{const t=document.createElement("textarea");t.innerHTML=e;let s=t.value;for(;s.includes("&");){t.innerHTML=s;const e=t.value;if(e===s)break;s=e}return s}));let N=F;class Ms{constructor(e,t){d(this,"textNodeBindings",new Map),d(this,"expressionEvaluator"),d(this,"stateManager"),d(this,"componentManager"),d(this,"cleanupObserver"),d(this,"bindingCount",0),this.expressionEvaluator=e,this.stateManager=t,this.cleanupObserver=new MutationObserver((e=>{this.cleanupDetachedNodes(e)})),this.cleanupObserver.observe(document.body,{childList:!0,subtree:!0})}cleanupDetachedNodes(e){for(const t of e)"childList"===t.type&&t.removedNodes.forEach((e=>{if(e.nodeType===Node.TEXT_NODE)this.cleanupTextNode(e);else if(e.nodeType===Node.ELEMENT_NODE){const t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let s;for(;s=t.nextNode();)this.cleanupTextNode(s)}}));const t=[];for(const[e]of this.textNodeBindings)document.contains(e)||t.push(e);t.forEach((e=>this.cleanupTextNode(e)))}processTextNode(e,t){if(this.textNodeBindings.has(e)||C.isTextNodeInsideScript(e)||this.isInsideLoopItem(e))return;const s=e.textContent||"",n=N.parse(s);if(!n.some((e=>"expression"===e.type)))return;const i={originalContent:s,expressions:n,subscriptionIds:[]};n.filter((e=>"expression"===e.type)).forEach((s=>{if(!s.expression)return;const n=`text_${Date.now()}_${Math.random()}`,r=this.expressionEvaluator.extractDependencies(s.expression,t,this.stateManager),a={id:n,selector:"",dependencies:new Set(r),callback:()=>{this.updateTextNode(e)},element:e.parentElement??void 0,component:t};this.stateManager.addSubscription(a),i.subscriptionIds.push(n)})),this.textNodeBindings.set(e,i),this.bindingCount++,this.updateTextNode(e)}isInsideLoopItem(e){var t,s,n;let i=e.parentElement;for(;i&&i!==document.body;){const e=i.previousSibling;if(e&&e.nodeType===Node.COMMENT_NODE&&null!=(t=e.textContent)&&t.startsWith("pp-for:"))return!0;let r=(null==(s=i.parentElement)?void 0:s.firstChild)||null;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&null!=(n=r.textContent)&&n.startsWith("pp-for:")&&r!==i)return!0;r=r.nextSibling}i=i.parentElement}return!1}updateTextNode(e){const t=this.textNodeBindings.get(e);if(!t||!e.parentElement)return;const s=C.getComponentForNode(e),n=this.resolveComponentRootForElement(e,s),i=this.getContextForComponent(s,n);let r="";for(const e of t.expressions)if("static"===e.type)r+=e.content;else if(e.expression)try{r+=k(this.expressionEvaluator.evaluateExpression(e.expression,i,s))}catch(t){const s="object"==typeof t&&null!==t&&"message"in t?t.message:String(t);console.warn(`Text binding evaluation warning for "${e.expression}": ${s}`),r+=""}e.textContent!==r&&(e.textContent=r)}resolveComponentRootForElement(e,t){let s=e.parentElement;for(;s&&s.nodeType===Node.ELEMENT_NODE;){const e=s;if(e.getAttribute(g.ATTR_PREFIXES.COMPONENT)===t)return e;s=s.parentElement}}getContextForComponent(e,t){return this.componentManager?this.componentManager.buildComponentContextWithProps(e,t):{}}cleanupTextNode(e){const t=this.textNodeBindings.get(e);t&&(t.subscriptionIds.forEach((e=>{this.stateManager.removeSubscription(e)})),this.textNodeBindings.delete(e),this.bindingCount=Math.max(0,this.bindingCount-1))}getBindingCount(){return this.textNodeBindings.size}getAllBindings(){return new Map(this.textNodeBindings)}clearAllBindings(){for(const[e]of this.textNodeBindings)this.cleanupTextNode(e)}destroy(){this.cleanupObserver.disconnect(),this.clearAllBindings()}}class Ls{constructor(){d(this,"listeners",new Map)}on(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>this.off(e,t)}off(e,t){var s;null==(s=this.listeners.get(e))||s.delete(t)}emit(e,...t){const s=this.listeners.get(e);s&&s.forEach((s=>{try{s(...t)}catch(t){console.error(`Event listener error for ${e}:`,t)}}))}}class Rs{constructor(){d(this,"stateStore",{}),d(this,"subscriptions",new Map),d(this,"keyIndex",new Map),d(this,"updateQueue",new Set),d(this,"isUpdating",!1),d(this,"eventBus",new Ls),d(this,"contextCache",new Map),d(this,"previousValues",new Map),d(this,"scheduleFlush",ks((()=>{this.flushUpdates()}),g.DEBOUNCE_MS)),this.setupGlobalStateProxy()}batchStateUpdates(e){const t=this.isUpdating;this.isUpdating=!0;try{return e()}finally{this.isUpdating=t,!this.isUpdating&&this.updateQueue.size>0&&this.scheduleFlush()}}invalidateContextCache(){this.contextCache.clear()}setupGlobalStateProxy(){this.stateStore=new Proxy(this.stateStore,{set:(e,t,s,n)=>{const i=e[t],r=Reflect.set(e,t,s,n);return i!==s&&this.notifySubscribers(t),r},get:(e,t)=>Reflect.get(e,t)})}notifySubscribers(e){if(this.eventBus.emit("stateChanged",e),this.updateQueue.add(e),e.includes(".")){const t=e.split(".")[0];this.updateQueue.add(t)}this.notifyPathBasedSubscribers(e),this.isUpdating||this.scheduleFlush()}notifyPathBasedSubscribers(e){var t;const s=this.stateStore[e],n=null==(t=this.previousValues)?void 0:t.get(e);for(const[t,i]of this.subscriptions)for(const t of i.dependencies)if(this.isPathDependency(t)&&t.startsWith(e+".")){const i=t.substring(e.length+1),r=this.getPathValue(n,i),a=this.getPathValue(s,i);this.deepEqual(r,a)||this.updateQueue.add(t)}}isPathDependency(e){return e.includes(".")&&e.split(".").length>1}getPathValue(e,t){if(!e||"object"!=typeof e)return;const s=t.split(".");let n=e;for(const e of s){if(null==n)return;if(Array.isArray(n))return"length"===e?n.length:n.map((t=>null==t?void 0:t[e])).filter((e=>void 0!==e));n=n[e]}return n}deepEqual(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((e,s)=>this.deepEqual(e,t[s])));if("object"==typeof e&&"object"==typeof t){const s=Object.keys(e),n=Object.keys(t);return s.length===n.length&&s.every((s=>this.deepEqual(e[s],t[s])))}return!1}flushUpdates(){if(!this.isUpdating){this.isUpdating=!0;try{const e=new Set,t=this.keyIndex.get("*");if(t&&t.size>0&&this.updateQueue.size>0)for(const e of Array.from(t)){const t=this.subscriptions.get(e);if(!t)continue;if(t.element&&!document.contains(t.element)){this.removeSubscription(e);continue}const s=t.element??document.body;try{const e=Array.from(this.updateQueue)[0];t.callback(s,{key:e})}catch(e){console.error("Wildcard subscription callback failed:",e)}}for(const t of this.updateQueue){if(e.has(t))continue;e.add(t);const s=this.keyIndex.get(t);if(s)for(const e of Array.from(s)){const s=this.subscriptions.get(e);if(!s)continue;if(s.element&&!document.contains(s.element)){this.removeSubscription(e);continue}const n=s.element??document.body;try{s.callback(n,{key:t})}catch(e){console.error("Subscription callback failed:",e)}}}}finally{this.updateQueue.clear(),this.isUpdating=!1}}}getState(){return this.stateStore}setState(e,t){if(this.previousValues.set(e,this.stateStore[e]),this.stateStore[e]=t,this.previousValues.size>100){const e=this.previousValues.keys().next().value;"string"==typeof e&&this.previousValues.delete(e)}}hasState(e){return e in this.stateStore}addSubscription(e){this.subscriptions.set(e.id,e);for(const t of e.dependencies)this.keyIndex.has(t)||this.keyIndex.set(t,new Set),this.keyIndex.get(t).add(e.id)}removeSubscription(e){var t,s;const n=this.subscriptions.get(e);if(n){for(const i of n.dependencies)null==(t=this.keyIndex.get(i))||t.delete(e),0===(null==(s=this.keyIndex.get(i))?void 0:s.size)&&this.keyIndex.delete(i);this.subscriptions.delete(e)}}onStateChange(e){return this.eventBus.on("stateChanged",e)}batch(e){const t=this.isUpdating;this.isUpdating=!0;try{return e()}finally{this.isUpdating=t,!this.isUpdating&&this.updateQueue.size&&this.flushUpdates()}}getSubscriptions(){return this.subscriptions}getKeyIndex(){return this.keyIndex}}class Os{constructor(){d(this,"expressionCache",new oe(g.MAX_CACHE_SIZE)),d(this,"dependencyCache",new oe(g.MAX_CACHE_SIZE)),d(this,"dependencyParser",new Vs),d(this,"commonExpressions",new Map),this.precompileCommonExpressions()}normalizeExpression(e){return e.replace(/\r\n/g," ").replace(/\r/g," ").replace(/\n/g," ").replace(/\s+/g," ").trim()}precompileCommonExpressions(){["true","false","null","undefined"].forEach((e=>{const t={fn:new Function("return "+e),contextMap:new Map,dependencies:[e],timestamp:Date.now(),hitCount:0};this.commonExpressions.set(e,t)}))}extractDependencies(e,t,s){const n=this.normalizeExpression(e),i=`${t}:${n}`;if(this.dependencyCache.has(i))return this.dependencyCache.get(i);const r=this.dependencyParser.extract(n,t,s);return this.dependencyCache.set(i,r),r}evaluateExpression(e,t,s){const n=this.normalizeExpression(e);if(this.commonExpressions.has(n)){const e=this.commonExpressions.get(n);e.hitCount++;try{return e.fn()}catch(e){return void console.error(`Common expression evaluation failed: "${n}"`,e)}}const i=`${s}:${n}`;let r=this.expressionCache.get(i);(!r||this.isStale(r))&&(r=this.compileExpression(n,t,s),this.expressionCache.set(i,r)),r.hitCount++;try{const e=this.buildArguments(r.contextMap,t);return r.fn(...e)}catch(e){return console.error(`Expression evaluation failed: "${n}"`,e),void console.error("Available context:",Object.keys(t))}}compileExpression(e,t,s){const n=this.prepareSafeContext(t),i=new Map,r=[];Object.keys(n).forEach(((e,t)=>{i.set(e,t),r.push(e)}));const a=this.dependencyParser.extract(e,s);return{fn:new Function(...r,`return (${e})`),contextMap:i,dependencies:a,timestamp:Date.now(),hitCount:0}}buildArguments(e,t){const s=new Array(e.size);for(const[n,i]of e)s[i]=t[n];return s}isStale(e){return Date.now()-e.timestamp>3e5}prepareSafeContext(e){const t={};for(const[s,n]of Object.entries(e))"this"===s||"arguments"===s||"eval"===s||"function"===s||(t[s]=n);return t}invalidateCache(e){if(!e)return this.expressionCache.clear(),this.dependencyCache.clear(),void this.dependencyParser.clearCache();const t=`${e}:`;for(const[e]of this.expressionCache.cache)"string"==typeof e&&e.startsWith(t)&&(this.expressionCache.delete(e),this.dependencyCache.delete(e))}}class Vs{constructor(){d(this,"parseCache",new oe(500))}extract(e,t,s){const n=this.normalizeExpression(e),i=`${t}:${n}`;if(this.parseCache.has(i))return this.parseCache.get(i);const r=this.parseExpression(n,t,s);return this.parseCache.set(i,r),r}normalizeExpression(e){return e.replace(/\r\n/g," ").replace(/\r/g," ").replace(/\n/g," ").replace(/\s+/g," ").trim()}parseExpression(e,t,s){const n=this.extractIdentifiers(e),i=[],r=(null==s?void 0:s.getState())||{};for(const e of n){if(Vt.has(e))continue;const s=e.indexOf("."),n=-1===s?e:e.substring(0,s),a=we.findExistingStateKey(n,t,r);if(a)i.push(a);else{const e="app"===t?[`app.${n}`]:[`${t}.${n}`,`app.${n}`];i.push(...e)}if(-1!==s){const e="app"===t?[`app.${n}`]:[`${t}.${n}`,`app.${n}`];i.push(...e)}}return Array.from(new Set(i))}extractIdentifiers(e){const t=[];let s=0;for(;s<e.length;){const n=e[s];if("'"!==n)if('"'!==n)if("`"!==n)if(this.isIdentifierStart(n)){const n=this.extractIdentifier(e,s);t.push(n.value),s=n.endIndex}else s++;else s=this.skipTemplateLiteral(e,s,t);else s=this.skipString(e,s,'"');else s=this.skipString(e,s,"'")}return t}skipString(e,t,s){let n=t+1;for(;n<e.length&&e[n]!==s;)"\\"===e[n]&&n++,n++;return n+1}skipTemplateLiteral(e,t,s){let n=t+1;for(;n<e.length&&"`"!==e[n];)if("$"===e[n]&&n+1<e.length&&"{"===e[n+1]){n+=2;let t=1;for(;n<e.length&&t>0;){const i=e[n];if('"'!==i&&"'"!==i){if("{"===i?t++:"}"===i&&t--,t>0&&this.isIdentifierStart(i)){const t=this.extractIdentifier(e,n);s.push(t.value),n=t.endIndex-1}n++}else n=this.skipString(e,n,i)}}else"\\"===e[n]&&n++,n++;return n+1}extractIdentifier(e,t){let s=t;for(;s<e.length&&(this.isIdentifierPart(e[s])||"."===e[s]);)s++;return{value:e.substring(t,s),endIndex:s}}isIdentifierStart(e){return/[a-zA-Z_$]/.test(e)}isIdentifierPart(e){return/[a-zA-Z0-9_$]/.test(e)}clearCache(){this.parseCache.clear()}getCacheSize(){return this.parseCache.cache.size}}class Fs{constructor(e){d(this,"componentStack",["app"]),d(this,"contextCache",new oe(100)),d(this,"contextIndex",new Map),d(this,"contextInvalidated",new Set),d(this,"stateManager"),d(this,"processedScripts",new WeakSet),d(this,"componentFunctions",new Map),d(this,"elementProps",new WeakMap),d(this,"expressionEvaluator"),d(this,"domBindingManager"),d(this,"loopManager"),d(this,"templateRenderer"),d(this,"updateTimeouts"),d(this,"updateBatcher",new et),d(this,"propDependencyCache",new Map),this.stateManager=e,this.updateBatcher=new et,this.stateManager.onStateChange((e=>this.invalidateContextCache(e)))}getPropDependencies(e,t){var s;const n=this.findElementWithProps(t);if(!n)return[];const i=this.elementProps.get(n);if(!i||!i.has(e))return[];const r=i.get(e);return(null==(s=this.templateRenderer)?void 0:s.dependencies(r.expression,r.component,this.stateManager))||[]}buildRestrictedComponentContext(e,t=!1){const s={};window[e]&&Object.assign(s,window[e]);const n=this.componentFunctions.get(e);if(n)for(const[e,t]of n)s[e]=t;const i=this.stateManager.getState();for(const t of Object.keys(i))if(t.startsWith(e+".")){const n=t.substring(e.length+1);n in s||(s[n]=i[t])}if(t){if(window.app)for(const[e,t]of Object.entries(window.app))e in s||(s[e]=t);const e=this.componentFunctions.get("app");if(e)for(const[t,n]of e)t in s||(s[t]=n);for(const e of Object.keys(i))if(e.startsWith("app.")){const t=e.substring(4);t in s||(s[t]=i[e])}}return s}getComponentPropDependencies(e,t){if(this.propDependencyCache.has(e))return this.propDependencyCache.get(e);const s=[],n=this.elementProps.get(e);n&&this.templateRenderer&&n.forEach((e=>{var t;const n=null==(t=this.templateRenderer)?void 0:t.dependencies(e.expression,e.component,this.stateManager);s.push(...n??[])}));const i=Array.from(new Set(s));return this.propDependencyCache.set(e,i),i}setDOMBindingManager(e){this.domBindingManager=e,this.updateBatcher.setManagers(this,e)}hasStoredProps(e){return this.elementProps.has(e)&&this.elementProps.get(e).size>0}setExpressionEvaluator(e){this.expressionEvaluator=e,this.templateRenderer=new Ge(e),this.loopManager=new Bt(this.stateManager,e)}extractProps(e,t){const s=new Map,n=e.attributes;for(let e=0;e<n.length;e++){const i=n[e];if(i.name!==g.ATTR_PREFIXES.COMPONENT&&i.value&&Dt.containsMustacheExpression(i.value)){const e=this.attributeToPropName(i.name),n={name:e,expression:i.value,component:t,subscriptionIds:[]};s.set(e,n)}}return s}attributeToPropName(e){return e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase()))}setupProps(e,t){const s=this.extractProps(e,t);0!==s.size&&(this.elementProps.set(e,s),this.expressionEvaluator&&s.forEach(((t,s)=>{this.setupPropBinding(e,t)})))}setupPropBinding(e,t){var s;if(!this.expressionEvaluator)return;const n=`prop_${Date.now()}_${Math.random()}`,i=(null==(s=this.templateRenderer)?void 0:s.dependencies(t.expression,t.component,this.stateManager))||[],r={id:n,selector:"",dependencies:new Set(i),callback:()=>{const t=e.getAttribute(g.ATTR_PREFIXES.COMPONENT);t&&(this.updateBatcher.scheduleUpdate(t,e),this.refreshComponentBindings(e,t))},element:e,component:t.component};this.stateManager.addSubscription(r),t.subscriptionIds.push(n)}refreshComponentBindings(e,t){this.contextInvalidated.add(t),this.contextCache.delete(t),this.domBindingManager&&this.domBindingManager.refreshComponentElement(e,t)}evaluateProps(e){const t={},s=this.elementProps.get(e);if(!s||!this.expressionEvaluator)return t;const n=s.values().next().value;if(!n)return t;const i=this.buildComponentContext(n.component);return s.forEach(((e,s)=>{var n;try{const r=null==(n=this.templateRenderer)?void 0:n.render(e.expression,i,e.component);t[s]="function"==typeof r?(...e)=>r.apply(this,e):r}catch(e){console.error(`❌ Failed to evaluate prop "${s}":`,e),t[s]=void 0}})),t}cleanupProps(e){const t=this.elementProps.get(e);t&&(t.forEach((e=>{e.subscriptionIds.forEach((e=>{this.stateManager.removeSubscription(e)}))})),this.elementProps.delete(e))}buildComponentContextWithProps(e,t){const s=this.buildComponentContext(e);let n=this.findElementWithProps(e);if(t&&this.elementProps.has(t)&&(n=t),n)try{const i=this.evaluatePropsWithContext(n,e,t);Object.keys(i).length>0&&Object.keys(i).forEach((e=>{s[e]=i[e]}))}catch(t){console.error(`❌ Error evaluating props for ${e}:`,t)}return s}evaluatePropsWithContext(e,t,s){var n;const i={},r=this.elementProps.get(e);if(!r||!this.expressionEvaluator)return i;const a=r.values().next().value;if(!a)return i;let o=this.buildComponentContext(a.component);const c=null==(n=this.loopManager)?void 0:n.getLoopContextForElement(e);return c&&(o={...o,...c}),r.forEach(((e,t)=>{var s;try{const n=null==(s=this.templateRenderer)?void 0:s.render(e.expression,o,e.component);"function"==typeof n?this.isFunctionExplicitlyPassed(e.expression)?i[t]=(...e)=>n.apply(this,e):(console.warn(`⚠️ Function "${t}" not passed - not from shared namespace or explicitly passed`),i[t]=void 0):i[t]=n}catch(e){console.error(`❌ Failed to evaluate prop "${t}":`,e),i[t]=void 0}})),i}isFunctionExplicitlyPassed(e){const t=N.isSingleExpression(e);return!!t&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t.trim())}findElementWithProps(e){const t=document.querySelectorAll(`[${g.ATTR_PREFIXES.COMPONENT}="${e}"]`);for(const e of t){const t=this.elementProps.get(e);if(t&&t.size>0)return e}return null}pushComponent(e){this.componentStack.push(e)}popComponent(){return this.componentStack.pop()}getCurrentComponent(){return this.componentStack[this.componentStack.length-1]}buildComponentContext(e){if(!this.contextInvalidated.has(e)&&this.contextCache.has(e))return this.contextCache.get(e);const t=this.computeComponentContext(e);return this.contextCache.set(e,t),this.contextInvalidated.delete(e),t}computeComponentContext(e){const t={};"app"!==e&&window[e]&&Object.assign(t,window[e]),"app"===e&&window.app&&Object.assign(t,window.app);const s=this.componentFunctions.get(e);if(s)for(const[e,n]of s)t[e]=n;if("app"===e){const e=this.componentFunctions.get("app");if(e)for(const[s,n]of e)s in t||(t[s]=n)}const n=this.stateManager.getState();for(const s of Object.keys(n))if(s.startsWith(e+".")){const i=s.substring(e.length+1);i in t||(t[i]=n[s])}return t}invalidateContextCache(e){if(e.startsWith("app.")){for(const e of this.contextCache.cache.keys())this.invalidateComponent(e);return}const t=e.indexOf(".");if(-1!==t){const s=e.slice(0,t);this.invalidateComponent(s)}}invalidateComponent(e){this.contextInvalidated.add(e),this.contextIndex.delete(e)}executePhpScripts(e){const t=this.componentStack.length,s=e.getAttribute(g.ATTR_PREFIXES.COMPONENT),n=e===document.body;if(s||n){if(s){this.pushComponent(s);const t=this.getParentComponent(e);this.setupProps(e,t)}this.getRelevantScripts(e,n).forEach((e=>{const t=e.getAttribute(g.ATTR_PREFIXES.COMPONENT);t&&t!==s?(this.pushComponent(t),this.executeScript(e),this.popComponent()):this.executeScript(e)}))}for(Array.from(e.children).forEach((e=>this.executePhpScripts(e)));this.componentStack.length>t;)this.popComponent();document.body.hidden=!1}getParentComponent(e){let t=e.parentElement;for(;t;){const e=t.getAttribute(g.ATTR_PREFIXES.COMPONENT);if(e)return e;t=t.parentElement}return"app"}getRelevantScripts(e,t){return Array.from(e.querySelectorAll(`script[type="${g.SCRIPT_TYPE}"]`)).filter((s=>{if(this.processedScripts.has(s))return!1;if(t)return!!s.hasAttribute(g.ATTR_PREFIXES.COMPONENT)||!s.closest(`[${g.ATTR_PREFIXES.COMPONENT}]`);let n=s.parentElement;for(;n&&n!==e;){if(n.hasAttribute(g.ATTR_PREFIXES.COMPONENT))return!1;n=n.parentElement}return n===e||e.contains(s)}))}executeScript(e){if(this.processedScripts.has(e))return;this.processedScripts.add(e);const t=this.getCurrentComponent(),s=e.textContent||"",n=N.decodeEntities(s);try{const s=this.findComponentElementForScript(e,t);if(s===e){const t=this.getParentComponent(e);this.setupProps(e,t)}const i=this.buildComponentContextWithProps(t,s);window[t]||(window[t]={}),this.executeScriptFunctions(n,t,i)}catch(e){console.error(`Script execution failed in component ${t}:`,e),console.error("Script content:",n)}}findComponentElementForScript(e,t){if(e.getAttribute(g.ATTR_PREFIXES.COMPONENT)===t)return e;let s=e.parentElement;for(;s;){if(s.getAttribute(g.ATTR_PREFIXES.COMPONENT)===t)return s;s=s.parentElement}const n=document.querySelectorAll(`[${g.ATTR_PREFIXES.COMPONENT}="${t}"]`);for(const e of n)if(this.elementProps.has(e))return e;return n[0]||void 0}executeScriptFunctions(e,t,s){const n=this.extractFunctionNames(e),i=this.findElementWithProps(t),r=this.extractVariableDeclarations(e);let a={...s};if(r.forEach((e=>{delete a[e];const t=`set${Ft(e)}`,s=`${e}Getter`;delete a[t],delete a[s]})),i){const e=this.evaluateProps(i);Object.assign(a,e)}a.getContext=()=>this.buildComponentContextWithProps(t),a.withContext=e=>{const s=this.buildComponentContextWithProps(t);return e.call(s,s)},a.__getProp=e=>{if(i)return this.evaluateProps(i)[e]};let o=Se.getInstance().transformStateDeclarations(e);o=this.modifyScriptForReactiveProps(o,t,i||void 0);const c=`\n ${o}\n\n ${n.map((e=>`\n if (typeof ${e} === 'function') {\n this['${e}'] = ${e};\n }\n `)).join("\n")}\n `,p=Object.keys(a),h=p.map((e=>a[e]));if(this.checkIfInLoopItem()){const e=this.extractLoopItemContext();this.domBindingManager.stateManager.currentLoopContext=e}try{new Function(...p,c).call(window[t],...h),window[t].getContext=a.getContext,window[t].withContext=a.withContext,window[t].__getProp=a.__getProp;for(const e of n){const s=window[t][e];"function"==typeof s&&this.storeFunctionForComponent(t,e,s)}this.invalidateComponent(t)}catch(s){console.error("Script execution failed:",s),console.error("Component:",t),console.error("Original script:",e),console.error("Processed script:",o),console.error("Execution context keys:",Object.keys(a))}finally{this.domBindingManager.stateManager.currentLoopContext=null}}checkIfInLoopItem(){return!1}extractLoopItemContext(){return{}}extractVariableDeclarations(e){const t=Se.getInstance().extractStateDeclarations(e).map((e=>e.variableName)),s=[],n=/(?:const|let|var)\s*\[\s*([^,\]]+)(?:\s*,\s*([^,\]]+))?\s*\]/g;let i;for(;null!==(i=n.exec(e));)i[1]&&!t.includes(i[1].trim())&&s.push(i[1].trim()),i[2]&&!t.includes(i[2].trim())&&s.push(i[2].trim());const r=/(?:const|let|var)\s+([a-zA-Z_$][\w$]*)/g;for(;null!==(i=r.exec(e));)t.includes(i[1])||s.push(i[1]);return[...t,...s]}modifyScriptForReactiveProps(e,t,s){if(!s||!this.elementProps.has(s))return e;const n=this.elementProps.get(s),i=Array.from(n.keys());let r=e;return i.forEach((e=>{r=this.replacePropOutsideStrings(r,e)})),r}replacePropOutsideStrings(e,t){let s="",n=0;const i=e.length;for(;n<i;){const r=e[n];if("'"!==r)if('"'!==r)if("`"!==r){if("/"===r&&n+1<i){if("/"===e[n+1]){const t=e.indexOf("\n",n),r=-1===t?i:t;s+=e.slice(n,r),n=r;continue}if("*"===e[n+1]){const t=e.indexOf("*/",n+2),r=-1===t?i:t+2;s+=e.slice(n,r),n=r;continue}}this.matchesPropName(e,n,t)?(s+=`__getProp('${t}')`,n+=t.length):(s+=r,n++)}else{const t=this.findTemplateEnd(e,n);s+=e.slice(n,t+1),n=t+1}else{const t=this.findStringEnd(e,n,'"');s+=e.slice(n,t+1),n=t+1}else{const t=this.findStringEnd(e,n,"'");s+=e.slice(n,t+1),n=t+1}}return s}findStringEnd(e,t,s){let n=t+1;for(;n<e.length;){if(e[n]===s&&"\\"!==e[n-1])return n;"\\"===e[n]&&n++,n++}return e.length-1}findTemplateEnd(e,t){let s=t+1,n=0;for(;s<e.length;){const t=e[s];if("`"===t&&0===n)return s;"$"===t&&s+1<e.length&&"{"===e[s+1]?(n++,s++):"}"===t&&n>0?n--:"\\"===t&&s++,s++}return e.length-1}matchesPropName(e,t,s){if(t+s.length>e.length||e.substr(t,s.length)!==s)return!1;const n=t>0?e[t-1]:"",i=t+s.length<e.length?e[t+s.length]:"",r=0===t||!/[a-zA-Z0-9_$]/.test(n),a=t+s.length===e.length||!/[a-zA-Z0-9_$]/.test(i);if(!r||!a)return!1;const o=e.slice(t+s.length);return!/^\s*[=:]/.test(o)}extractFunctionNames(e){const t=[],s=/function\s+([a-zA-Z_$][\w$]*)\s*\(/g;let n;for(;null!==(n=s.exec(e));)t.push(n[1]);const i=/(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:\([^)]*\)|[^)]*)\s*=>/g;for(;null!==(n=i.exec(e));)t.push(n[1]);return t}storeFunctionForComponent(e,t,s){this.componentFunctions.has(e)||this.componentFunctions.set(e,new Map),this.componentFunctions.get(e).set(t,s),window[e]||(window[e]={}),window[e][t]=s}getComponentFunctions(e){return this.componentFunctions.get(e)}destroy(){if(this.updateTimeouts){for(const e of this.updateTimeouts.values())clearTimeout(e);this.updateTimeouts.clear()}}}class Ds{constructor(e,t,s){d(this,"stateManager"),d(this,"componentManager"),d(this,"expressionEvaluator"),d(this,"textNodeManager"),d(this,"observer"),d(this,"listeners",new WeakMap),d(this,"pendingBindings",[]),d(this,"pendingTextNodes",[]),d(this,"applyingUpdates",!1),d(this,"elementCache",new WeakMap),d(this,"batchedUpdates",new Set),d(this,"processingRAF",null),d(this,"updateQueue",new Map),d(this,"eventDelegation",new Be),d(this,"processedElements",new WeakSet),d(this,"loopManager"),d(this,"templateRenderer"),d(this,"isRelevantMutation",(e=>{if(this.applyingUpdates&&"attributes"===e.type)return!1;if("childList"===e.type||"characterData"===e.type)return!0;if("attributes"===e.type){const t=e.attributeName;return t===g.ATTR_PREFIXES.COMPONENT||null!==t&&he.isEventAttribute(t)}return!1})),this.stateManager=e,this.componentManager=t,this.expressionEvaluator=s,this.textNodeManager=new Ms(s,e),this.textNodeManager.componentManager=this.componentManager,this.componentManager.setDOMBindingManager(this),this.setupMutationObserver(),this.eventDelegation.setupEventDelegation(),this.loopManager=new Bt(e,s),this.loopManager.setDependencies(t,this),this.loopManager.eventDelegation=this.eventDelegation,this.eventDelegation.setDependencies(this.componentManager,this.expressionEvaluator,this.loopManager),this.templateRenderer=new Ge(s)}refreshComponentElement(e,t){this.elementCache.delete(e),this.processedElements.delete(e);const s=[...this.componentManager.componentStack];this.componentManager.componentStack=["app"],"app"!==t&&this.componentManager.componentStack.push(t);try{const s=this.componentManager.buildComponentContextWithProps(t,e);this.processElementInContext(e,s,t,!0),this.walkComponentChildren(e,t),this.refreshComponentTextNodes(e,t)}finally{this.componentManager.componentStack=s}}refreshComponentTextNodes(e,t){const s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:e=>{const s=e;return!s.textContent||!g.MUSTACHE_PATTERN.test(s.textContent)||C.isTextNodeInsideScript(s)||this.isTextNodeInsideLoopItem(s)||C.getComponentForNode(s)!==t?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let n;const i=[];for(;n=s.nextNode();)i.push(n);i.forEach((e=>{this.textNodeManager.cleanupTextNode(e),this.textNodeManager.cleanupTextNode(e),this.textNodeManager.processTextNode(e,t)}))}walkComponentChildren(e,t){const s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const n=s;return C.getElementComponent(n)!==t?NodeFilter.FILTER_REJECT:n===e?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});let n;const i=[];for(;n=s.nextNode();){const e=n;i.push(e)}i.forEach((s=>{this.elementCache.delete(s),this.processedElements.delete(s);const n=this.componentManager.buildComponentContextWithProps(t,e);this.processElementInContext(s,n,t,!0)}))}createSpreadDirectiveBinding(e,t,s){const n=`spread_${Date.now()}_${Math.random()}`,i=N.parseSpreadDirective(t);if(0===i.spreads.length&&0===i.objects.length)return void console.warn(`Invalid pp-spread directive: ${t}`);const r=new Set,a=()=>{if(document.contains(e))try{const t=this.componentManager.buildComponentContextWithProps(s,e);this.clearSpreadAttributes(e,r);for(const n of i.spreads){const i=this.expressionEvaluator.evaluateExpression(n,t,s);i&&"object"==typeof i&&this.applySpreadObject(e,i,r)}for(const n of i.objects)this.applyObjectProperties(e,n,t,s,r)}catch(e){console.error(`Spread directive evaluation error for "${t}":`,e)}else this.stateManager.removeSubscription(n)},o=new Set;for(const e of i.spreads)this.templateRenderer.dependencies(e,s,this.stateManager).forEach((e=>o.add(e)));for(const e of i.objects)for(const t of e)this.templateRenderer.dependencies(t.value,s,this.stateManager).forEach((e=>o.add(e)));const c={id:n,selector:"",dependencies:o,callback:a,element:e,component:s};this.stateManager.addSubscription(c),this.storeSpreadSubscription(e,n),a()}applyObjectProperties(e,t,s,n,i){for(const r of t)try{const t=this.expressionEvaluator.evaluateExpression(r.value,s,n);if(this.isEventProperty(r.key)){this.handleSpreadEventProperty(e,r.key,t);continue}const a=this.normalizeAttributeName(r.key);this.updateElementProperty(e,a,t),i.add(a)}catch(e){console.error(`Error evaluating object property "${r.key}: ${r.value}":`,e)}}applySpreadObject(e,t,s){for(const[n,i]of Object.entries(t))if(null!=i){if(this.isEventProperty(n)){this.handleSpreadEventProperty(e,n,i);continue}const t=this.normalizeAttributeName(n);(!e.hasAttribute(t)||s.has(t))&&(this.updateElementProperty(e,t,i),s.add(t))}}isEventProperty(e){return e.startsWith("on")&&e.length>2}handleSpreadEventProperty(e,t,s){const n=t.substring(2).toLowerCase();if("function"==typeof s){const t=t=>{var n;try{const i=C.getContextComponent(e),r=(null==(n=this.componentManager)?void 0:n.buildComponentContextWithProps(i,e))||{};s.call(r,t)}catch(e){console.error("Spread event handler error:",e)}};return e.addEventListener(n,t),void this.storeDirectEventListener(e,n,t)}if("string"==typeof s){const t=C.getContextComponent(e);this.eventDelegation.registerEventHandler(e,n,s,t)}}storeDirectEventListener(e,t,s){e.__directEventListeners||(e.__directEventListeners=[]),e.__directEventListeners.push({eventType:t,listener:s})}clearSpreadAttributes(e,t){for(const s of t)e.hasAttribute(s)&&e.removeAttribute(s);t.clear()}normalizeAttributeName(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}storeSpreadSubscription(e,t){e.__spreadSubscriptions||(e.__spreadSubscriptions=[]),e.__spreadSubscriptions.push(t)}setupMutationObserver(){this.observer=new MutationObserver((e=>{const t=e.filter(this.isRelevantMutation);0!==t.length&&this.processMutationsBatch(t)})),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0,attributeFilter:[g.ATTR_PREFIXES.COMPONENT]})}processElement(e,t=!0){if(e===document.body){const s=Array.from(document.querySelectorAll(`[${g.ATTR_PREFIXES.COMPONENT}]`)).sort(((e,t)=>C.getElementDepth(e)-C.getElementDepth(t)));this.processElementsBatch([e],t),s.forEach((e=>{this.processElementsBatch([e],t)})),t&&this.loopManager.processPendingTemplates()}else this.processElementsBatch([e],t)}processElementsBatch(e,t=!0){for(const s of e)this.processSingleElement(s,t);t&&(e.forEach((e=>{this.componentManager.executePhpScripts(e)})),this.processPendingBindings())}processSingleElement(e,t){const s=C.getElementComponent(e),n=C.getParentComponentForElement(e),i=this.componentManager.componentStack.length;"app"!==s&&(this.componentManager.pushComponent(s),this.componentManager.setupProps(e,n)),t&&this.componentManager.executePhpScripts(e),this.processLoopTemplates(e,s);const r=t?this.componentManager.buildComponentContextWithProps(s,e):{};for(this.processElementInContext(e,r,s,t),this.walkDOM(e,r,s,t);this.componentManager.componentStack.length>i;)this.componentManager.popComponent()}processLoopTemplates(e,t){this.getDirectComponentTemplates(e,t).forEach((e=>{this.loopManager.queueTemplate(e,t)}))}getDirectComponentTemplates(e,t){const s=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:t=>{const s=t;return s!==e&&s.hasAttribute(g.ATTR_PREFIXES.COMPONENT)?NodeFilter.FILTER_REJECT:"TEMPLATE"===s.tagName&&s.hasAttribute("pp-for")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let i;for(;i=n.nextNode();)s.push(i);return s}walkDOM(e,t,s,n){const i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,{acceptNode:t=>{if(t.nodeType===Node.ELEMENT_NODE){const n=t;if("script"===n.tagName.toLowerCase()||this.loopManager.isLoopItem(n))return NodeFilter.FILTER_REJECT;let i=n.parentElement;for(;i&&i!==e;){if(this.loopManager.isLoopItem(i))return NodeFilter.FILTER_REJECT;i=i.parentElement}const r=C.getElementComponent(n);if(n===e)return NodeFilter.FILTER_ACCEPT;if(r!==s)return NodeFilter.FILTER_REJECT}else if(t.nodeType===Node.TEXT_NODE){const e=t;if(C.isTextNodeInsideScript(e)||this.isTextNodeInsideLoopItem(e)||C.getComponentForNode(e)!==s)return NodeFilter.FILTER_REJECT}return NodeFilter.FILTER_ACCEPT}});let r;const a=[],o=[];for(;r=i.nextNode();)if(r.nodeType===Node.TEXT_NODE){const e=r;e.textContent&&g.MUSTACHE_PATTERN.test(e.textContent)&&C.getComponentForNode(e)===s&&a.push(e)}else if(r.nodeType===Node.ELEMENT_NODE){const e=r;this.loopManager.isLoopItem(e)||C.getElementComponent(e)===s&&!this.processedElements.has(e)&&(o.push(e),this.processedElements.add(e))}a.forEach((e=>{n?this.textNodeManager.processTextNode(e,s):this.pendingTextNodes.push({textNode:e,component:s})})),o.forEach((e=>{this.processElementInContext(e,t,s,n)}))}isTextNodeInsideLoopItem(e){let t=e.parentElement;for(;t&&t!==document.body;){if(this.loopManager.isLoopItem(t))return!0;t=t.parentElement}return!1}processElementInContext(e,t,s,n){if(e.hasAttribute(g.ATTR_PREFIXES.SPREAD)){const t=e.getAttribute(g.ATTR_PREFIXES.SPREAD);n&&this.createSpreadDirectiveBinding(e,t,s),e.removeAttribute(g.ATTR_PREFIXES.SPREAD)}if(this.loopManager.isLoopItem(e)||this.isElementInLoopItem(e))return;const i=this.extractDomMustacheBindings(e),r=this.elementCache.get(e),a=this.getElementHash(e);if(r&&r.hash===a&&this.isCacheValid(r)&&n)return void this.applyBindingsFromCache(e,r,t);const o={bindings:i,component:s,listeners:[],lastProcessed:Date.now(),hash:a};n?this.applyBindings(e,i,t,s):i.forEach(((t,n)=>{this.pendingBindings.push({element:e,property:n,expression:t,component:s})})),this.setupEventBindings(e,s),this.elementCache.set(e,o)}isElementInLoopItem(e){let t=e;for(;t;){if(this.loopManager.isLoopItem(t))return!0;t=t.parentElement}return!1}extractDomMustacheBindings(e){const t=new Map,s=e.attributes;for(let n=0;n<s.length;n++){const i=s[n];if(i.name===g.ATTR_PREFIXES.COMPONENT||he.isEventAttribute(i.name))continue;const r=e.hasAttribute(g.ATTR_PREFIXES.COMPONENT);if(!(r&&i.value&&Dt.containsMustacheExpression(i.value))&&!r&&i.value){const e=g.MUSTACHE_PATTERN.test(i.value),s=N.decodeEntities(i.value),n=g.MUSTACHE_PATTERN.test(s);(e||n)&&t.set(i.name,i.value)}}return t}applyBindings(e,t,s,n){t.forEach(((t,s)=>{this.createMustacheBinding(e,s,t)})),this.setupEventBindings(e,n)}applyBindingsFromCache(e,t,s){t.bindings.forEach(((s,n)=>{try{const i=this.componentManager.buildComponentContextWithProps(t.component,e),r=this.templateRenderer.render(s,i,t.component);this.updateElementProperty(e,n,r)}catch(e){console.error(`Cached binding evaluation error for "${s}":`,e)}}))}createMustacheBinding(e,t,s){const n=`mustache_${Date.now()}_${Math.random()}`,i=this.componentManager.getCurrentComponent(),r=new Set;this.templateRenderer.dependencies(s,i,this.stateManager).forEach((e=>r.add(e)));const a=()=>{if(document.contains(e))try{const n=this.componentManager.buildComponentContextWithProps(i,e),r=this.templateRenderer.render(s,n,i);this.scheduleElementUpdate(e,t,r)}catch(e){console.error(`Mustache binding evaluation error for "${s}":`,e)}else this.stateManager.removeSubscription(n)},o={id:n,selector:"",dependencies:r,callback:a,element:e,component:i};this.stateManager.addSubscription(o),this.setupTwoWayBindingIfNeeded(e,t,s,i),a()}setupEventBindings(e,t){for(let t=0;t<e.attributes.length;t++){const s=e.attributes[t];if(he.isEventAttribute(s.name)){const t=s.name.substring(2),n=C.getContextComponent(e);this.eventDelegation.registerEventHandler(e,t,s.value,n),e.removeAttribute(s.name)}}}setupTwoWayBindingIfNeeded(e,t,s,n){const i=N.isSingleExpression(s);i&&("value"===t&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)?this.setupTwoWayBinding(e,i,n):"checked"===t&&e instanceof HTMLInputElement&&("checkbox"===e.type||"radio"===e.type)&&this.setupTwoWayBinding(e,i,n,!0))}setupTwoWayBinding(e,t,s,n=!1){const i=this.findStateTarget(t,s);if(!i)return;const r=()=>{try{const t=n?e.checked:e.value,s=n?!!t:t;if(!i.tailPath)return void this.stateManager.setState(i.fullRoot,s);const r=this.stateManager.getState()[i.fullRoot],a=r&&"object"==typeof r?{...r}:{};this.setPath(a,i.tailPath,s),this.stateManager.setState(i.fullRoot,a)}catch(e){console.error("Two-way binding error:",e)}},a=n?"change":"input";e.addEventListener(a,r);const o=this.listeners.get(e)||[];o.push({type:a,fn:r}),this.listeners.set(e,o)}findStateTarget(e,t){const s=e.match(/^([a-zA-Z_$][\w$]*(?:\.[\w$]+)*)$/);if(!s)return null;const[n,...i]=s[1].split("."),r=we.findExistingStateKey(n,t,this.stateManager.getState());return r?{fullRoot:r,tailPath:i.join(".")}:null}setPath(e,t,s){if(!t)return;const n=t.split("."),i=n.pop();let r=e;for(const e of n)r=r[e]=r[e]||{};r[i]=s}scheduleElementUpdate(e,t,s){this.updateQueue.has(e)||(this.updateQueue.set(e,new Set),this.batchedUpdates.add(e)),this.updateQueue.get(e).add(t),this.processingRAF||(this.processingRAF=requestAnimationFrame((()=>{this.processBatchedElementUpdates()}))),e[`__pending_${t}`]=s}processBatchedElementUpdates(){this.applyingUpdates=!0;try{for(const e of this.batchedUpdates){const t=this.updateQueue.get(e);if(t)for(const s of t){const t=e[`__pending_${s}`];this.updateElementProperty(e,s,t),delete e[`__pending_${s}`]}}}finally{this.batchedUpdates.clear(),this.updateQueue.clear(),this.processingRAF=null,this.applyingUpdates=!1}}updateElementProperty(e,t,s){try{switch(t){case"textContent":const n=k(s);e.textContent!==n&&(e.textContent=n);break;case"innerHTML":const i=k(s);e.innerHTML!==i&&(e.innerHTML=i);break;case"value":if(e instanceof HTMLOptionElement){const t=k(s);e.value!==t&&(e.value=t,e.setAttribute("value",t));break}if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement){const t=k(s);e.value!==t&&(e.value=t)}break;case"selectedIndex":if(e instanceof HTMLSelectElement){const t=Number(s);e.selectedIndex!==t&&(e.selectedIndex=t)}break;case"checked":case"disabled":case"hidden":case"readonly":case"required":case"multiple":case"selected":case"autofocus":case"autoplay":case"controls":case"defer":case"loop":case"muted":case"open":case"reversed":case"async":case"default":case"formnovalidate":case"novalidate":case"allowfullscreen":case"capture":case"itemscope":if(e instanceof HTMLElement){const n=!!s;e[t]!==n&&(e[t]=n)}break;case"indeterminate":if(e instanceof HTMLInputElement&&"checkbox"===e.type){const t=!!s;e.indeterminate!==t&&(e.indeterminate=t)}break;case"class":const r=k(s);e.className!==r&&(e.className=r);break;case"htmlFor":case"for":if(e instanceof HTMLLabelElement){const t=k(s);e.htmlFor!==t&&(e.htmlFor=t)}break;case"style":if(e instanceof HTMLElement)if("object"==typeof s&&s&&!Array.isArray(s))Object.assign(e.style,s);else{const t=k(s);e.style.cssText!==t&&(e.style.cssText=t)}break;case"tabIndex":if(e instanceof HTMLElement){const t=null==s?-1:Number(s);e.tabIndex!==t&&(e.tabIndex=t)}break;case"contentEditable":if(e instanceof HTMLElement){const t=!0===s?"true":!1===s?"false":String(s);e.contentEditable!==t&&(e.contentEditable=t)}break;case"draggable":if(e instanceof HTMLElement){const t=!0===s?"true":"false";e.draggable.toString()!==t&&(e.draggable=!0===s),e.getAttribute("draggable")!==t&&e.setAttribute("draggable",t)}break;case"spellcheck":if(e instanceof HTMLElement){const t=!0===s?"true":"false";e.spellcheck!==!!s&&(e.spellcheck=!!s),e.getAttribute("spellcheck")!==t&&e.setAttribute("spellcheck",t)}break;case"src":case"href":case"action":case"alt":case"title":case"placeholder":case"id":case"name":case"type":case"method":case"target":case"rel":case"pattern":case"accept":case"autocomplete":case"enctype":case"wrap":case"download":case"ping":case"referrerpolicy":case"crossorigin":case"integrity":case"loading":case"decoding":case"srcset":case"sizes":case"dir":case"lang":case"translate":case"role":const a=k(s);e.getAttribute(t)!==a&&(null==s?e.removeAttribute(t):e.setAttribute(t,a));break;case"min":case"max":case"step":case"maxLength":case"minLength":case"size":case"rows":case"cols":case"rowSpan":case"colSpan":if(e instanceof HTMLElement){const n=String(s);e.getAttribute(t)!==n&&(null==s?e.removeAttribute(t):e.setAttribute(t,n))}break;default:if(t.startsWith("aria-")){const n=k(s);e.getAttribute(t)!==n&&(null==s||!1===s?e.removeAttribute(t):e.setAttribute(t,n));break}if(t.startsWith("data-")){const n=k(s);e.getAttribute(t)!==n&&(null==s?e.removeAttribute(t):e.setAttribute(t,n));break}const o=k(s);e.getAttribute(t)!==o&&(null==s||!1===s?e.removeAttribute(t):e.setAttribute(t,o))}}catch(s){console.error(`Failed to update property "${t}" on element:`,e,s)}}processPendingBindings(){const e=[...this.pendingBindings];this.pendingBindings=[];const t=new Map;for(const s of e)t.has(s.component)||t.set(s.component,[]),t.get(s.component).push(s);for(const[e,s]of t){const t=[...this.componentManager.componentStack];this.componentManager.componentStack="app"!==e?["app",e]:["app"];for(const t of s)try{if(!document.contains(t.element))continue;this.createMustacheBinding(t.element,t.property,t.expression)}catch(t){console.error(`❌ Failed to create binding for ${e}:`,t)}this.componentManager.componentStack=t}this.processTextNodesPending()}processTextNodesPending(){const e=new Map;for(const t of this.pendingTextNodes)e.has(t.component)||e.set(t.component,[]),e.get(t.component).push(t);this.pendingTextNodes=[];for(const[t,s]of e){const e=[...this.componentManager.componentStack];this.componentManager.componentStack="app"!==t?["app",t]:["app"];for(const{textNode:e,component:t}of s)if(document.contains(e))try{this.textNodeManager.processTextNode(e,t)}catch(e){console.error(`❌ Failed to process text node for ${t}:`,e)}this.componentManager.componentStack=e}}processMutationsBatch(e){const t=new Set,s=new Set,n=new Set,i=new Set;for(const r of e)if("childList"===r.type&&(r.addedNodes.forEach((e=>{if(e.nodeType===Node.ELEMENT_NODE)t.add(e);else if(e.nodeType===Node.TEXT_NODE){const t=e;t.textContent&&g.MUSTACHE_PATTERN.test(t.textContent)&&i.add(t)}})),r.removedNodes.forEach((e=>{e.nodeType===Node.ELEMENT_NODE?s.add(e):e.nodeType===Node.TEXT_NODE&&this.textNodeManager.cleanupTextNode(e)}))),"attributes"===r.type&&r.target&&n.add(r.target),"characterData"===r.type&&r.target){const e=r.target;e.textContent&&g.MUSTACHE_PATTERN.test(e.textContent)&&i.add(e)}s.size>0&&this.cleanupElementsBatch(Array.from(s)),t.size>0&&this.processElementsBatch(Array.from(t)),i.size>0&&this.processTextNodesBatch(Array.from(i)),n.size>0&&this.rebindChangedElements(Array.from(n))}processTextNodesBatch(e){const t=new Map;for(const s of e){const e=C.getComponentForNode(s);t.has(e)||t.set(e,[]),t.get(e).push(s)}for(const[e,s]of t)s.forEach((t=>{this.textNodeManager.processTextNode(t,e)}))}rebindChangedElements(e){e.forEach((e=>{this.processElementBindings(e,!0)}))}processElementBindings(e,t=!0){const s=this.extractDomMustacheBindings(e),n=C.getElementComponent(e);s.forEach(((s,i)=>{t?this.createMustacheBinding(e,i,s):this.pendingBindings.push({element:e,property:i,expression:s,component:n})})),t&&this.setupEventBindings(e,n)}cleanupElementsBatch(e){e.forEach((e=>this.cleanupElement(e)))}cleanupElement(e){const t=this.listeners.get(e)||[];for(const{type:s,fn:n}of t)e.removeEventListener(s,n);this.listeners.delete(e),this.elementCache.delete(e),this.processedElements.delete(e),this.componentManager.cleanupProps(e),this.cleanupSubscriptions(e);const s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let n;for(;n=s.nextNode();)this.textNodeManager.cleanupTextNode(n);"TEMPLATE"===e.tagName&&e.hasAttribute("pp-for")&&this.loopManager.cleanupTemplate(e),e.querySelectorAll("template[pp-for]").forEach((e=>{this.loopManager.cleanupTemplate(e)}));const i=e.__directEventListeners;i&&(i.forEach((({eventType:t,listener:s})=>{e.removeEventListener(t,s)})),delete e.__directEventListeners);const r=e.__spreadEventHandlers;r&&(r.forEach((e=>{window.__spreadHandlers&&window.__spreadHandlers.delete(e)})),delete e.__spreadEventHandlers)}cleanupSubscriptions(e){const t=[];for(const[s,n]of this.stateManager.getSubscriptions())(n.element===e||n.element&&e.contains(n.element)||n.element&&!document.contains(n.element))&&t.push(s);t.forEach((e=>this.stateManager.removeSubscription(e)))}getElementHash(e){const t=[];for(let s=0;s<e.attributes.length;s++){const n=e.attributes[s];(n.name===g.ATTR_PREFIXES.COMPONENT||he.isEventAttribute(n.name)||n.value&&g.MUSTACHE_PATTERN.test(n.value))&&t.push(`${n.name}=${n.value}`)}return t.sort().join("|")}isCacheValid(e){return Date.now()-e.lastProcessed<3e4}refreshAllBindings(){this.elementCache=new WeakMap,this.processedElements=new WeakSet,this.processElement(document.body,!0)}destroy(){this.observer&&this.observer.disconnect(),this.eventDelegation.cleanup(),this.batchedUpdates.clear(),this.updateQueue.clear(),this.processingRAF&&cancelAnimationFrame(this.processingRAF),this.elementCache=new WeakMap,this.listeners=new WeakMap,this.processedElements=new WeakSet,this.loopManager.destroy()}}const X=class e{constructor(){d(this,"delegatedEvents",new Map),d(this,"elementHandlers",new WeakMap),d(this,"handlerCache",new oe(200)),d(this,"componentManager"),d(this,"expressionEvaluator"),d(this,"loopManager")}static getAllAvailableEvents(){if(e.eventCache)return e.eventCache;const t=new Set;try{Object.getOwnPropertyNames(HTMLElement.prototype).filter((e=>e.startsWith("on")&&e.length>2)).map((e=>e.substring(2).toLowerCase())).forEach((e=>t.add(e)))}catch(e){console.warn("Could not get HTMLElement events:",e)}try{Object.getOwnPropertyNames(Document.prototype).filter((e=>e.startsWith("on")&&e.length>2)).map((e=>e.substring(2).toLowerCase())).forEach((e=>t.add(e)))}catch(e){console.warn("Could not get Document events:",e)}try{Object.getOwnPropertyNames(Window.prototype).filter((e=>e.startsWith("on")&&e.length>2)).map((e=>e.substring(2).toLowerCase())).forEach((e=>t.add(e)))}catch(e){console.warn("Could not get Window events:",e)}try{Object.getOwnPropertyNames(Element.prototype).filter((e=>e.startsWith("on")&&e.length>2)).map((e=>e.substring(2).toLowerCase())).forEach((e=>t.add(e)))}catch(e){console.warn("Could not get Element events:",e)}return new Set(["beforeunload","unload","pagehide","pageshow","popstate","hashchange","storage","message","messageerror","offline","online","languagechange","rejectionhandled","unhandledrejection","afterprint","beforeprint","devicemotion","deviceorientation","deviceorientationabsolute"]).forEach((e=>t.delete(e))),e.eventCache=t,t}setupEventDelegation(){const t=e.getAllAvailableEvents();for(const e of t){const t=this.createDelegatedListener(e),s=this.getEventOptions(e);document.addEventListener(e,t,s),this.delegatedEvents.set(e,{listener:t,elements:new WeakSet})}}getEventOptions(e){const t={capture:!0,passive:!1};return["wheel","touchstart","touchmove","touchend","scroll","mousewheel"].includes(e)&&(t.passive=!0),("focusin"===e||"focusout"===e)&&(t.capture=!1),t}isEventSupported(t){return e.getAllAvailableEvents().has(t.toLowerCase())}getAllSupportedEvents(){return Array.from(e.getAllAvailableEvents()).sort()}getDelegatedEvents(){return Array.from(this.delegatedEvents.keys()).sort()}setDependencies(e,t,s){this.componentManager=e,this.expressionEvaluator=t,this.loopManager=s}createDelegatedListener(e){return t=>{const s=t.target;if(!s)return;const n=this.findHandler(s,e);n&&this.executeHandler(n.handler,n.element,t)}}registerEventHandler(e,t,s,n){const i=t.toLowerCase();if(!this.isEventSupported(i))return void console.warn(`⚠️ Event type "${t}" is not supported`);const r=C.getContextComponent(e);this.elementHandlers.has(e)||this.elementHandlers.set(e,new Map);const a={code:s,component:r};this.elementHandlers.get(e).set(i,a);const o=this.delegatedEvents.get(i);o?o.elements.add(e):(console.warn(`⚠️ No delegated listener for ${i}, attaching directly`),this.attachDirectListener(e,i,a))}findHandler(e,t){let s=e;for(;s;){const e=this.elementHandlers.get(s);if(null!=e&&e.has(t))return{handler:e.get(t),element:s};s=s.parentElement}return null}compileHandler(e,t){const s=`${t}:${e}`;if(this.handlerCache.has(s))return this.handlerCache.get(s);let n=e;n.includes("this")&&(n=n.replace(/\bthis\b/g,"thisElement")),n.includes("event")&&(n=n.replace(/\bevent\b/g,"eventObject"));const i=new Function("eventObject","thisElement","context",`\n try {\n with(context) {\n ${n}\n }\n } catch(error) {\n console.error('Event handler execution error:', error);\n console.error('Handler code:', ${JSON.stringify(e)});\n console.error('Component:', '${t}');\n console.error('Available context keys:', Object.keys(context));\n }\n `);return this.handlerCache.set(s,i),i}executeHandler(e,t,s){var n;if(this.componentManager&&this.expressionEvaluator)try{let i=e.component,r=t;for(;r;){const e=r.__uniqueComponentName;if(e){i=e;break}r=r.parentElement}const a=t.getAttribute(g.ATTR_PREFIXES.CONTEXT),o="app"===a||"parent"===a,c="app"===C.getElementComponent(t),p=C.findElementForComponent(t,i);let h;if(o||c)h=this.componentManager.buildComponentContextWithProps("app"===i||"app"===a?"app":i,p||void 0);else if(h=this.componentManager.buildRestrictedComponentContext(i,!1),p){const e=this.componentManager.evaluateProps(p);Object.assign(h,e)}const l=null==(n=this.loopManager)?void 0:n.getLoopContextForElement(t);if(l){const e={};for(const[t,s]of Object.entries(l))"function"!=typeof s&&(e[t]=s);h={...e,...h}}e.compiledFn||(e.compiledFn=this.compileHandler(e.code,i)),e.compiledFn&&e.compiledFn(s,t,h)}catch(t){console.error("💥 Event handler execution failed:",t),console.error("Handler code:",e.code),console.error("Handler component:",e.component)}else console.warn("EventDelegationManager dependencies not set")}extractComponentFunctions(e){const t={};for(const[s,n]of Object.entries(e))"function"==typeof n&&(t[s]=n);return t}attachDirectListener(e,t,s){const n=t=>{this.executeHandler(s,e,t)};e.addEventListener(t,n),e[`__${t}_listener`]=n}removeEventHandler(e,t){var s,n;const i=this.elementHandlers.get(e);i&&(i.delete(t),0===i.size&&this.elementHandlers.delete(e));const r=this.delegatedEvents.get(t);r&&(null==(n=(s=r.elements).delete)||n.call(s,e));const a=e[`__${t}_listener`];a&&(e.removeEventListener(t,a),delete e[`__${t}_listener`])}cleanup(){for(const[e,t]of this.delegatedEvents)document.removeEventListener(e,t.listener,!0);this.delegatedEvents.clear(),this.handlerCache.clear()}};d(X,"eventCache",null);let Be=X;class Bs{constructor(){d(this,"stateManager",new Rs),d(this,"expressionEvaluator",new Os),d(this,"componentManager",new Fs(this.stateManager)),d(this,"domBindingManager",new Ds(this.stateManager,this.componentManager,this.expressionEvaluator)),d(this,"initialized",!1),d(this,"currentLoopContext",null),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>this.initialize())):setTimeout((()=>this.initialize()),0)}initialize(){this.initialized||(this.initialized=!0,this.componentManager.setExpressionEvaluator(this.expressionEvaluator),this.domBindingManager.processElement(document.body,!0),this.componentManager.executePhpScripts(document.body),this.domBindingManager.processPendingBindings())}state(e,t){const s=this.componentManager.getCurrentComponent();let n,i,r;"string"==typeof e&&2===arguments.length?(n=e,i=t):"string"==typeof e&&1===arguments.length?this.looksLikeVariableName(e)?(n=e,i=void 0):(console.warn("pp.state() called with string that doesn't look like variable name:",e),n="unknownState",i=e):(console.warn("pp.state() called without explicit key - this should be handled by AST transformation"),n="unknownState",i=e);const a=this.getLoopExecutionContext();if(a){const e=this.generateLoopInstanceId(a);r=`${s}.${e}.${n}`}else r=`${s}.${n}`;this.stateManager.hasState(r)||this.stateManager.setState(r,i);const o=()=>this.stateManager.getState()[r],c=new Proxy(o,{get(e,t,s){if("__pphp_key"===t||"__pphp_fullKey"===t||"__pphp_component"===t||"value"===t||"valueOf"===t||"toString"===t)return Reflect.get(e,t,s);const n=e();if(null!=n){if(t in Object(n)){const e=n[t];return"function"==typeof e?e.bind(n):e}return Reflect.get(e,t,s)}},has(e,t){if("__pphp_key"===t||"__pphp_fullKey"===t||"__pphp_component"===t||"value"===t||"valueOf"===t||"toString"===t)return Reflect.has(e,t);const s=e();return null!=s&&t in Object(s)||Reflect.has(e,t)},apply:(e,t,s)=>Reflect.apply(e,t,s)});Object.defineProperty(c,"__pphp_key",{value:n,enumerable:!1,writable:!1}),Object.defineProperty(c,"__pphp_fullKey",{value:r,enumerable:!1,writable:!1}),Object.defineProperty(c,"__pphp_component",{value:s,enumerable:!1,writable:!1}),Object.defineProperty(c,"value",{get:()=>this.stateManager.getState()[r],enumerable:!0,configurable:!0}),o.valueOf=()=>this.stateManager.getState()[r],o.toString=()=>k(this.stateManager.getState()[r]);const p=e=>{const t=this.stateManager.getState()[r],s="function"==typeof e?e(t):e;this.stateManager.setState(r,s)};return this.createComponentScopedGlobals(s,n,c,p),[c,p]}getLoopExecutionContext(){return this.currentLoopContext}generateLoopInstanceId(e){const t=Object.keys(e).sort().map((t=>{const s=e[t];return s&&"object"==typeof s&&"id"in s?`${t}:${s.id}`:`${t}:${JSON.stringify(s)}`}));return`loop_${btoa(t.join("|")).replace(/[^a-zA-Z0-9]/g,"").substring(0,8)}`}looksLikeVariableName(e){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)&&e.length<=50&&!e.includes(" ")&&!Vt.has(e)}effect(e,t){const s=`effect_${Date.now()}_${Math.random()}`,n=this.componentManager.getCurrentComponent();let i,r,a,o=!1;if(1===arguments.length)r="always",a={immediate:!0,detectDeps:!0};else if(Array.isArray(t)){const e=this.extractDependencyNames(t,n);0===e.length?(r="once",a={deps:e,immediate:!0}):(r="deps",a={deps:e,immediate:!0})}else{const e={immediate:!0,...t||{}};if(e.deps&&0!==e.deps.length){r="deps",a={deps:this.extractDependencyNames(e.deps,n),immediate:e.immediate,detectDeps:e.detectDeps}}else r="always",a={immediate:e.immediate,detectDeps:!0}}const c=()=>{if(!o){if(i&&"function"==typeof i)try{i()}catch(e){console.error("Effect cleanup error:",e)}try{i=e()}catch(e){console.error("Effect callback error:",e)}}};switch(r){case"always":const e={id:s,selector:"",dependencies:new Set(["*"]),callback:c,component:n};this.stateManager.addSubscription(e);break;case"once":break;case"deps":const t=this.resolveDependencies(a.deps,n);if(t.length){const e={id:s,selector:"",dependencies:new Set(t),callback:c,component:n};this.stateManager.addSubscription(e)}}return!1!==a.immediate&&c(),()=>{if(o=!0,i&&"function"==typeof i)try{i()}catch(e){console.error("Effect cleanup error:",e)}this.stateManager.removeSubscription(s)}}extractDependencyNames(e,t){const s=[];for(const t of e)"string"==typeof t?s.push(t):"function"==typeof t&&t.__pphp_key?s.push(t.__pphp_key):console.warn("Invalid dependency in effect:",t);return s.filter(Boolean)}resolveDependencies(e,t){const s=[],n=this.stateManager.getState();for(const i of e)if(i.includes(".")){const e=i.split("."),r=e[0],a=e.slice(1).join("."),o=this.componentManager.getPropDependencies(r,t);if(o.length>0)s.push(...o);else{const e=we.findExistingStateKey(r,t,n);e?s.push(`${e}.${a}`):s.push(`${t}.${i}`)}}else{const e=this.componentManager.getPropDependencies(i,t);if(e.length>0)s.push(...e);else{const e=we.findExistingStateKey(i,t,n);e?s.push(e):s.push(`${t}.${i}`)}}return Array.from(new Set(s))}createComponentScopedGlobals(e,t,s,n){window[e]||(window[e]={});const i=`set${Ft(t)}`;Object.defineProperty(window[e],t,{get:()=>s.valueOf(),configurable:!0,enumerable:!0}),window[e][i]=n,window[e][`${t}Getter`]=s}}const $t=new Bs;window.pp=$t,globalThis.pp=$t;
1
+ var Ut=Object.defineProperty,Wt=(e,t,s)=>t in e?Ut(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,d=(e,t,s)=>Wt(e,"symbol"!=typeof t?t+"":t,s),Ht=[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],tt=[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],qt="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",st="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Me={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"},Le="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",zt={5:Le,"5module":Le+" export import",6:Le+" const class extends export import super"},Xt=/^in(stanceof)?$/,Gt=new RegExp("["+st+"]"),Kt=new RegExp("["+st+qt+"]");function Oe(e,t){for(var s=65536,n=0;n<t.length;n+=2){if((s+=t[n])>e)return!1;if((s+=t[n+1])>=e)return!0}return!1}function H(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&Gt.test(String.fromCharCode(e)):!1!==t&&Oe(e,tt)))}function te(e,t){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&Kt.test(String.fromCharCode(e)):!1!==t&&(Oe(e,tt)||Oe(e,Ht)))))}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 D(e,t){return new T(e,{beforeExpr:!0,binop:t})}var B={beforeExpr:!0},O={startsExpr:!0},$e={};function w(e,t){return void 0===t&&(t={}),t.keyword=e,$e[e]=new T(e,t)}var u={num:new T("num",O),regexp:new T("regexp",O),string:new T("string",O),name:new T("name",O),privateId:new T("privateId",O),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(",",B),semi:new T(";",B),colon:new T(":",B),dot:new T("."),question:new T("?",B),questionDot:new T("?."),arrow:new T("=>",B),template:new T("template"),invalidTemplate:new T("invalidTemplate"),ellipsis:new T("...",B),backQuote:new T("`",O),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:D("||",1),logicalAND:D("&&",2),bitwiseOR:D("|",3),bitwiseXOR:D("^",4),bitwiseAND:D("&",5),equality:D("==/!=/===/!==",6),relational:D("</>/<=/>=",7),bitShift:D("<</>>/>>>",8),plusMin:new T("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:D("%",10),star:D("*",10),slash:D("/",10),starstar:new T("**",{beforeExpr:!0}),coalesce:D("??",1),_break:w("break"),_case:w("case",B),_catch:w("catch"),_continue:w("continue"),_debugger:w("debugger"),_default:w("default",B),_do:w("do",{isLoop:!0,beforeExpr:!0}),_else:w("else",B),_finally:w("finally"),_for:w("for",{isLoop:!0}),_function:w("function",O),_if:w("if"),_return:w("return",B),_switch:w("switch"),_throw:w("throw",B),_try:w("try"),_var:w("var"),_const:w("const"),_while:w("while",{isLoop:!0}),_with:w("with"),_new:w("new",{beforeExpr:!0,startsExpr:!0}),_this:w("this",O),_super:w("super",O),_class:w("class",O),_extends:w("extends",B),_export:w("export"),_import:w("import",O),_null:w("null",O),_true:w("true",O),_false:w("false",O),_in:w("in",{beforeExpr:!0,binop:7}),_instanceof:w("instanceof",{beforeExpr:!0,binop:7}),_typeof:w("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:w("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:w("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},V=/\r\n?|\n|\u2028|\u2029/,Qt=new RegExp(V.source,"g");function ce(e){return 10===e||13===e||8232===e||8233===e}function it(e,t,s){void 0===s&&(s=e.length);for(var n=t;n<s;n++){var i=e.charCodeAt(n);if(ce(i))return n<s-1&&13===i&&10===e.charCodeAt(n+1)?n+2:n+1}return-1}var nt=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,L=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,rt=Object.prototype,Zt=rt.hasOwnProperty,Jt=rt.toString,ue=Object.hasOwn||function(e,t){return Zt.call(e,t)},Ke=Array.isArray||function(e){return"[object Array]"===Jt.call(e)},Qe=Object.create(null);function ee(e){return Qe[e]||(Qe[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function K(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var Yt=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,me=function(e,t){this.line=e,this.column=t};me.prototype.offset=function(e){return new me(this.line,this.column+e)};var Te=function(e,t,s){this.start=t,this.end=s,null!==e.sourceFile&&(this.source=e.sourceFile)};function at(e,t){for(var s=1,n=0;;){var i=it(e,n,t);if(i<0)return new me(s,t-n);++s,n=i}}var Ve={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},Ze=!1;function es(e){var t={};for(var s in Ve)t[s]=e&&ue(e,s)?e[s]:Ve[s];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!Ze&&"object"==typeof console&&console.warn&&(Ze=!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),Ke(t.onToken)){var n=t.onToken;t.onToken=function(e){return n.push(e)}}return Ke(t.onComment)&&(t.onComment=ts(t,t.onComment)),t}function ts(e,t){return function(s,n,i,r,a,o){var c={type:s?"Block":"Line",value:n,start:i,end:r};e.locations&&(c.loc=new Te(this,a,o)),e.ranges&&(c.range=[i,r]),t.push(c)}}var xe=1,le=2,je=4,ot=8,Ue=16,ct=32,_e=64,ut=128,re=256,ge=512,Ae=xe|le|re;function We(e,t){return le|(e?je:0)|(t?ot:0)}var ve=0,He=1,Z=2,lt=3,pt=4,ht=5,P=function(e,t,s){this.options=e=es(e),this.sourceFile=e.sourceFile,this.keywords=ee(zt[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var n="";!0!==e.allowReserved&&(n=Me[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(n+=" await")),this.reservedWords=ee(n);var i=(n?n+" ":"")+Me.strict;this.reservedWordsStrict=ee(i),this.reservedWordsStrictBind=ee(i+" "+Me.strictBind),this.input=String(t),this.containsEsc=!1,s?(this.pos=s,this.lineStart=this.input.lastIndexOf("\n",s-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(V).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(xe),this.regexpState=null,this.privateNameStack=[]},q={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}};P.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},q.inFunction.get=function(){return(this.currentVarScope().flags&le)>0},q.inGenerator.get=function(){return(this.currentVarScope().flags&ot)>0},q.inAsync.get=function(){return(this.currentVarScope().flags&je)>0},q.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(re|ge))return!1;if(t&le)return(t&je)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},q.allowSuper.get=function(){return(this.currentThisScope().flags&_e)>0||this.options.allowSuperOutsideMethod},q.allowDirectSuper.get=function(){return(this.currentThisScope().flags&ut)>0},q.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},q.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(re|ge)||t&le&&!(t&Ue))return!0}return!1},q.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&re)>0},P.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var s=this,n=0;n<e.length;n++)s=e[n](s);return s},P.parse=function(e,t){return new this(t,e).parse()},P.parseExpressionAt=function(e,t,s){var n=new this(s,e,t);return n.nextToken(),n.parseExpression()},P.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(P.prototype,q);var R=P.prototype,ss=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;R.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){L.lastIndex=e,e+=L.exec(this.input)[0].length;var t=ss.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){L.lastIndex=e+t[0].length;var s=L.exec(this.input),n=s.index+s[0].length,i=this.input.charAt(n);return";"===i||"}"===i||V.test(s[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||"!"===i&&"="===this.input.charAt(n+1))}e+=t[0].length,L.lastIndex=e,e+=L.exec(this.input)[0].length,";"===this.input[e]&&e++}},R.eat=function(e){return this.type===e&&(this.next(),!0)},R.isContextual=function(e){return this.type===u.name&&this.value===e&&!this.containsEsc},R.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},R.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},R.canInsertSemicolon=function(){return this.type===u.eof||this.type===u.braceR||V.test(this.input.slice(this.lastTokEnd,this.start))},R.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},R.semicolon=function(){!this.eat(u.semi)&&!this.insertSemicolon()&&this.unexpected()},R.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},R.expect=function(e){this.eat(e)||this.unexpected()},R.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var Ie=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};R.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var s=t?e.parenthesizedAssign:e.parenthesizedBind;s>-1&&this.raiseRecoverable(s,t?"Assigning to rvalue":"Parenthesized pattern")}},R.checkExpressionErrors=function(e,t){if(!e)return!1;var s=e.shorthandAssign,n=e.doubleProto;if(!t)return s>=0||n>=0;s>=0&&this.raise(s,"Shorthand property assignments are valid only in destructuring patterns"),n>=0&&this.raiseRecoverable(n,"Redefinition of __proto__ property")},R.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")},R.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var E=P.prototype;E.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==u.eof;){var s=this.parseStatement(null,!0,t);e.body.push(s)}if(this.inModule)for(var n=0,i=Object.keys(this.undefinedExports);n<i.length;n+=1){var r=i[n];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 qe={kind:"loop"},is={kind:"switch"};E.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;L.lastIndex=this.pos;var t=L.exec(this.input),s=this.pos+t[0].length,n=this.input.charCodeAt(s);if(91===n||92===n)return!0;if(e)return!1;if(123===n||n>55295&&n<56320)return!0;if(H(n,!0)){for(var i=s+1;te(n=this.input.charCodeAt(i),!0);)++i;if(92===n||n>55295&&n<56320)return!0;var r=this.input.slice(s,i);if(!Xt.test(r))return!0}return!1},E.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;L.lastIndex=this.pos;var e,t=L.exec(this.input),s=this.pos+t[0].length;return!(V.test(this.input.slice(this.pos,s))||"function"!==this.input.slice(s,s+8)||s+8!==this.input.length&&(te(e=this.input.charCodeAt(s+8))||e>55295&&e<56320))},E.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return!1;L.lastIndex=this.pos;var s=L.exec(this.input),n=this.pos+s[0].length;if(V.test(this.input.slice(this.pos,n)))return!1;if(e){var i,r=n+5;if("using"!==this.input.slice(n,r)||r===this.input.length||te(i=this.input.charCodeAt(r))||i>55295&&i<56320)return!1;L.lastIndex=r;var a=L.exec(this.input);if(a&&V.test(this.input.slice(r,r+a[0].length)))return!1}if(t){var o,c=n+2;if(!("of"!==this.input.slice(n,c)||c!==this.input.length&&(te(o=this.input.charCodeAt(c))||o>55295&&o<56320)))return!1}var p=this.input.charCodeAt(n);return H(p,!0)||92===p},E.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},E.isUsing=function(e){return this.isUsingKeyword(!1,e)},E.parseStatement=function(e,t,s){var n,i=this.type,r=this.startNode();switch(this.isLet(e)&&(i=u._var,n="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 n=n||this.value,e&&"var"!==n&&this.unexpected(),this.parseVarStatement(r,n);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){L.lastIndex=this.pos;var a=L.exec(this.input),o=this.pos+a[0].length,c=this.input.charCodeAt(o);if(40===c||46===c)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,s);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!e);var p=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(p)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"===p&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(r,!1,p),this.semicolon(),this.finishNode(r,"VariableDeclaration");var h=this.value,l=this.parseExpression();return i===u.name&&"Identifier"===l.type&&this.eat(u.colon)?this.parseLabeledStatement(r,h,l,e):this.parseExpressionStatement(r,l)}},E.parseBreakContinueStatement=function(e,t){var s="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 n=0;n<this.labels.length;++n){var i=this.labels[n];if((null==e.label||i.name===e.label.name)&&(null!=i.kind&&(s||"loop"===i.kind)||e.label&&s))break}return n===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,s?"BreakStatement":"ContinueStatement")},E.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},E.parseDoStatement=function(e){return this.next(),this.labels.push(qe),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")},E.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(qe),this.enterScope(0),this.expect(u.parenL),this.type===u.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var s=this.isLet();if(this.type===u._var||this.type===u._const||s){var n=this.startNode(),i=s?"let":this.value;return this.next(),this.parseVar(n,!0,i),this.finishNode(n,"VariableDeclaration"),this.parseForAfterInit(e,n,t)}var r=this.isContextual("let"),a=!1,o=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(o){var c=this.startNode();return this.next(),"await using"===o&&this.next(),this.parseVar(c,!0,o),this.finishNode(c,"VariableDeclaration"),this.parseForAfterInit(e,c,t)}var p=this.containsEsc,h=new Ie,l=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!==l||p||"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))},E.parseForAfterInit=function(e,t,s){return(this.type===u._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===t.declarations.length?(this.options.ecmaVersion>=9&&(this.type===u._in?s>-1&&this.unexpected(s):e.await=s>-1),this.parseForIn(e,t)):(s>-1&&this.unexpected(s),this.parseFor(e,t))},E.parseFunctionStatement=function(e,t,s){return this.next(),this.parseFunction(e,fe|(s?0:Fe),!1,t)},E.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")},E.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")},E.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(u.braceL),this.labels.push(is),this.enterScope(0);for(var t,s=!1;this.type!==u.braceR;)if(this.type===u._case||this.type===u._default){var n=this.type===u._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),n?t.test=this.parseExpression():(s&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),s=!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")},E.parseThrowStatement=function(e){return this.next(),V.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 ns=[];E.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t="Identifier"===e.type;return this.enterScope(t?ct:0),this.checkLValPattern(e,t?pt:Z),this.expect(u.parenR),e},E.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")},E.parseVarStatement=function(e,t,s){return this.next(),this.parseVar(e,!1,t,s),this.semicolon(),this.finishNode(e,"VariableDeclaration")},E.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(qe),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},E.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")},E.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},E.parseLabeledStatement=function(e,t,s,n){for(var i=0,r=this.labels;i<r.length;i+=1){r[i].name===t&&this.raise(s.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 c=this.labels[o];if(c.statementStart!==e.start)break;c.statementStart=this.start,c.kind=a}return this.labels.push({name:t,kind:a,statementStart:this.start}),e.body=this.parseStatement(n?-1===n.indexOf("label")?n+"label":n:"label"),this.labels.pop(),e.label=s,this.finishNode(e,"LabeledStatement")},E.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},E.parseBlock=function(e,t,s){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 n=this.parseStatement(null);t.body.push(n)}return s&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},E.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")},E.parseForIn=function(e,t){var s=this.type===u._in;return this.next(),"VariableDeclaration"===t.type&&null!=t.declarations[0].init&&(!s||this.options.ecmaVersion<8||this.strict||"var"!==t.kind||"Identifier"!==t.declarations[0].id.type)&&this.raise(t.start,(s?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=s?this.parseExpression():this.parseMaybeAssign(),this.expect(u.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,s?"ForInStatement":"ForOfStatement")},E.parseVar=function(e,t,s,n){for(e.declarations=[],e.kind=s;;){var i=this.startNode();if(this.parseVarId(i,s),this.eat(u.eq)?i.init=this.parseMaybeAssign(t):n||"const"!==s||this.type===u._in||this.options.ecmaVersion>=6&&this.isContextual("of")?n||"using"!==s&&"await using"!==s||!(this.options.ecmaVersion>=17)||this.type===u._in||this.isContextual("of")?n||"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 "+s+" declaration"):this.unexpected(),e.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat(u.comma))break}return e},E.parseVarId=function(e,t){e.id="using"===t||"await using"===t?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,"var"===t?He:Z,!1)};var fe=1,Fe=2,ft=4;function rs(e,t){var s=t.key.name,n=e[s],i="true";return"MethodDefinition"===t.type&&("get"===t.kind||"set"===t.kind)&&(i=(t.static?"s":"i")+t.kind),"iget"===n&&"iset"===i||"iset"===n&&"iget"===i||"sget"===n&&"sset"===i||"sset"===n&&"sget"===i?(e[s]="true",!1):!!n||(e[s]=i,!1)}function ye(e,t){var s=e.computed,n=e.key;return!s&&("Identifier"===n.type&&n.name===t||"Literal"===n.type&&n.value===t)}E.parseFunction=function(e,t,s,n,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!n)&&(this.type===u.star&&t&Fe&&this.unexpected(),e.generator=this.eat(u.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&fe&&(e.id=t&ft&&this.type!==u.name?null:this.parseIdent(),e.id&&!(t&Fe)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?He:Z:lt));var r=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(We(e.async,e.generator)),t&fe||(e.id=this.type===u.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,s,!1,i),this.yieldPos=r,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&fe?"FunctionDeclaration":"FunctionExpression")},E.parseFunctionParams=function(e){this.expect(u.parenL),e.params=this.parseBindingList(u.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},E.parseClass=function(e,t){this.next();var s=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var n=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&&rs(n,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=s,this.next(),e.body=this.finishNode(i,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},E.parseClassElement=function(e){if(this.eat(u.semi))return null;var t=this.options.ecmaVersion,s=this.startNode(),n="",i=!1,r=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(u.braceL))return this.parseClassStaticBlock(s),s;this.isClassElementNameStart()||this.type===u.star?o=!0:n="static"}if(s.static=o,!n&&t>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==u.star||this.canInsertSemicolon()?n="async":r=!0),!n&&(t>=9||!r)&&this.eat(u.star)&&(i=!0),!n&&!r&&!i){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=c:n=c)}if(n?(s.computed=!1,s.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),s.key.name=n,this.finishNode(s.key,"Identifier")):this.parseClassElementName(s),t<13||this.type===u.parenL||"method"!==a||i||r){var p=!s.static&&ye(s,"constructor"),h=p&&e;p&&"method"!==a&&this.raise(s.key.start,"Constructor can't have get/set modifier"),s.kind=p?"constructor":a,this.parseClassMethod(s,i,r,h)}else this.parseClassField(s);return s},E.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},E.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)},E.parseClassMethod=function(e,t,s,n){var i=e.key;"constructor"===e.kind?(t&&this.raise(i.start,"Constructor can't be a generator"),s&&this.raise(i.start,"Constructor can't be an async method")):e.static&&ye(e,"prototype")&&this.raise(i.start,"Classes may not have a static property named prototype");var r=e.value=this.parseMethod(t,s,n);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")},E.parseClassField=function(e){return ye(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&ye(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(u.eq)?(this.enterScope(ge|_e),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")},E.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(re|_e);this.type!==u.braceR;){var s=this.parseStatement(null);e.body.push(s)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},E.parseClassId=function(e,t){this.type===u.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Z,!1)):(!0===t&&this.unexpected(),e.id=null)},E.parseClassSuper=function(e){e.superClass=this.eat(u._extends)?this.parseExprSubscripts(null,!1):null},E.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},E.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,s=e.used;if(this.options.checkPrivateFields)for(var n=this.privateNameStack.length,i=0===n?null:this.privateNameStack[n-1],r=0;r<s.length;++r){var a=s[r];ue(t,a.name)||(i?i.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}},E.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")},E.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 s=0,n=e.specifiers;s<n.length;s+=1){var i=n[s];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")},E.parseExportDeclaration=function(e){return this.parseStatement(null)},E.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,fe|ft,!1,e)}if(this.type===u._class){var s=this.startNode();return this.parseClass(s,"nullableID")}var n=this.parseMaybeAssign();return this.semicolon(),n},E.checkExport=function(e,t,s){e&&("string"!=typeof t&&(t="Identifier"===t.type?t.name:t.value),ue(e,t)&&this.raiseRecoverable(s,"Duplicate export '"+t+"'"),e[t]=!0)},E.checkPatternExport=function(e,t){var s=t.type;if("Identifier"===s)this.checkExport(e,t,t.start);else if("ObjectPattern"===s)for(var n=0,i=t.properties;n<i.length;n+=1){var r=i[n];this.checkPatternExport(e,r)}else if("ArrayPattern"===s)for(var a=0,o=t.elements;a<o.length;a+=1){var c=o[a];c&&this.checkPatternExport(e,c)}else"Property"===s?this.checkPatternExport(e,t.value):"AssignmentPattern"===s?this.checkPatternExport(e,t.left):"RestElement"===s&&this.checkPatternExport(e,t.argument)},E.checkVariableExport=function(e,t){if(e)for(var s=0,n=t;s<n.length;s+=1){var i=n[s];this.checkPatternExport(e,i.id)}},E.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},E.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")},E.parseExportSpecifiers=function(e){var t=[],s=!0;for(this.expect(u.braceL);!this.eat(u.braceR);){if(s)s=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;t.push(this.parseExportSpecifier(e))}return t},E.parseImport=function(e){return this.next(),this.type===u.string?(e.specifiers=ns,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")},E.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,Z),this.finishNode(e,"ImportSpecifier")},E.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Z),this.finishNode(e,"ImportDefaultSpecifier")},E.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,Z),this.finishNode(e,"ImportNamespaceSpecifier")},E.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},E.parseWithClause=function(){var e=[];if(!this.eat(u._with))return e;this.expect(u.braceL);for(var t={},s=!0;!this.eat(u.braceR);){if(s)s=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;var n=this.parseImportAttribute(),i="Identifier"===n.key.type?n.key.name:n.key.value;ue(t,i)&&this.raiseRecoverable(n.key.start,"Duplicate attribute key '"+i+"'"),t[i]=!0,e.push(n)}return e},E.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")},E.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===u.string){var e=this.parseLiteral(this.value);return Yt.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},E.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)},E.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 j=P.prototype;j.toAssignable=function(e,t,s){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",s&&this.checkPatternErrors(s,!0);for(var n=0,i=e.properties;n<i.length;n+=1){var r=i[n];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",s&&this.checkPatternErrors(s,!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,s);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 s&&this.checkPatternErrors(s,!0);return e},j.toAssignableList=function(e,t){for(var s=e.length,n=0;n<s;n++){var i=e[n];i&&this.toAssignable(i,t)}if(s){var r=e[s-1];6===this.options.ecmaVersion&&t&&r&&"RestElement"===r.type&&"Identifier"!==r.argument.type&&this.unexpected(r.argument.start)}return e},j.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},j.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")},j.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()},j.parseBindingList=function(e,t,s,n){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(s&&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(n))}return i},j.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},j.parseBindingListItem=function(e){return e},j.parseMaybeDefault=function(e,t,s){if(s=s||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(u.eq))return s;var n=this.startNodeAt(e,t);return n.left=s,n.right=this.parseMaybeAssign(),this.finishNode(n,"AssignmentPattern")},j.checkLValSimple=function(e,t,s){void 0===t&&(t=ve);var n=t!==ve;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(n?"Binding ":"Assigning to ")+e.name+" in strict mode"),n&&(t===Z&&"let"===e.name&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),s&&(ue(s,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),s[e.name]=!0),t!==ht&&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":n&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return n&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,s);default:this.raise(e.start,(n?"Binding":"Assigning to")+" rvalue")}},j.checkLValPattern=function(e,t,s){switch(void 0===t&&(t=ve),e.type){case"ObjectPattern":for(var n=0,i=e.properties;n<i.length;n+=1){var r=i[n];this.checkLValInnerPattern(r,t,s)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var c=o[a];c&&this.checkLValInnerPattern(c,t,s)}break;default:this.checkLValSimple(e,t,s)}},j.checkLValInnerPattern=function(e,t,s){switch(void 0===t&&(t=ve),e.type){case"Property":this.checkLValInnerPattern(e.value,t,s);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,s);break;case"RestElement":this.checkLValPattern(e.argument,t,s);break;default:this.checkLValPattern(e,t,s)}};var U=function(e,t,s,n,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!s,this.override=n,this.generator=!!i},I={b_stat:new U("{",!1),b_expr:new U("{",!0),b_tmpl:new U("${",!1),p_stat:new U("(",!1),p_expr:new U("(",!0),q_tmpl:new U("`",!0,!0,(function(e){return e.tryReadTemplateToken()})),f_stat:new U("function",!1),f_expr:new U("function",!0),f_expr_gen:new U("function",!0,!1,null,!0),f_gen:new U("function",!1,!1,null,!0)},pe=P.prototype;pe.initialContext=function(){return[I.b_stat]},pe.curContext=function(){return this.context[this.context.length-1]},pe.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?V.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)},pe.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},pe.updateContext=function(e){var t,s=this.type;s.keyword&&e===u.dot?this.exprAllowed=!1:(t=s.updateContext)?t.call(this,e):this.exprAllowed=s.beforeExpr},pe.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&&V.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 y=P.prototype;function dt(e){return"Identifier"===e.type||"ParenthesizedExpression"===e.type&&dt(e.expression)}function De(e){return"MemberExpression"===e.type&&"PrivateIdentifier"===e.property.type||"ChainExpression"===e.type&&De(e.expression)||"ParenthesizedExpression"===e.type&&De(e.expression)}y.checkPropClash=function(e,t,s){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===e.type||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var n,i=e.key;switch(i.type){case"Identifier":n=i.name;break;case"Literal":n=String(i.value);break;default:return}var r=e.kind;if(this.options.ecmaVersion>=6)return void("__proto__"===n&&"init"===r&&(t.proto&&(s?s.doubleProto<0&&(s.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),t.proto=!0));var a=t[n="$"+n];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[n]={init:!1,get:!1,set:!1};a[r]=!0}},y.parseExpression=function(e,t){var s=this.start,n=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===u.comma){var r=this.startNodeAt(s,n);for(r.expressions=[i];this.eat(u.comma);)r.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(r,"SequenceExpression")}return i},y.parseMaybeAssign=function(e,t,s){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var n=!1,i=-1,r=-1,a=-1;t?(i=t.parenthesizedAssign,r=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Ie,n=!0);var o=this.start,c=this.startLoc;(this.type===u.parenL||this.type===u.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===e);var p=this.parseMaybeConditional(e,t);if(s&&(p=s.call(this,p,o,c)),this.type.isAssign){var h=this.startNodeAt(o,c);return h.operator=this.value,this.type===u.eq&&(p=this.toAssignable(p,!1,t)),n||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=p.start&&(t.shorthandAssign=-1),this.type===u.eq?this.checkLValPattern(p):this.checkLValSimple(p),h.left=p,this.next(),h.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(h,"AssignmentExpression")}return n&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),r>-1&&(t.trailingComma=r),p},y.parseMaybeConditional=function(e,t){var s=this.start,n=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(u.question)){var r=this.startNodeAt(s,n);return r.test=i,r.consequent=this.parseMaybeAssign(),this.expect(u.colon),r.alternate=this.parseMaybeAssign(e),this.finishNode(r,"ConditionalExpression")}return i},y.parseExprOps=function(e,t){var s=this.start,n=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===s&&"ArrowFunctionExpression"===i.type?i:this.parseExprOp(i,s,n,-1,e)},y.parseExprOp=function(e,t,s,n,i){var r=this.type.binop;if(null!=r&&(!i||this.type!==u._in)&&r>n){var a=this.type===u.logicalOR||this.type===u.logicalAND,o=this.type===u.coalesce;o&&(r=u.logicalAND.binop);var c=this.value;this.next();var p=this.start,h=this.startLoc,l=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),p,h,r,i),d=this.buildBinary(t,s,e,l,c,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,s,n,i)}return e},y.buildBinary=function(e,t,s,n,i,r){"PrivateIdentifier"===n.type&&this.raise(n.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=s,a.operator=i,a.right=n,this.finishNode(a,r?"LogicalExpression":"BinaryExpression")},y.parseMaybeUnary=function(e,t,s,n){var i,r=this.start,a=this.startLoc;if(this.isContextual("await")&&this.canAwait)i=this.parseAwait(n),t=!0;else if(this.type.prefix){var o=this.startNode(),c=this.type===u.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,c,n),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(o.argument):this.strict&&"delete"===o.operator&&dt(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):"delete"===o.operator&&De(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,i=this.finishNode(o,c?"UpdateExpression":"UnaryExpression")}else if(t||this.type!==u.privateId){if(i=this.parseExprSubscripts(e,n),this.checkExpressionErrors(e))return i;for(;this.type.postfix&&!this.canInsertSemicolon();){var p=this.startNodeAt(r,a);p.operator=this.value,p.prefix=!1,p.argument=i,this.checkLValSimple(i),this.next(),i=this.finishNode(p,"UpdateExpression")}}else(n||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),i=this.parsePrivateIdent(),this.type!==u._in&&this.unexpected();return s||!this.eat(u.starstar)?i:t?void this.unexpected(this.lastTokStart):this.buildBinary(r,a,i,this.parseMaybeUnary(null,!1,!1,n),"**",!1)},y.parseExprSubscripts=function(e,t){var s=this.start,n=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,s,n,!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},y.parseSubscripts=function(e,t,s,n,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,s,n,r,a,i);if(o.optional&&(a=!0),o===e||"ArrowFunctionExpression"===o.type){if(a){var c=this.startNodeAt(t,s);c.expression=o,o=this.finishNode(c,"ChainExpression")}return o}e=o}},y.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(u.arrow)},y.parseSubscriptAsyncArrow=function(e,t,s,n){return this.parseArrowExpression(this.startNodeAt(e,t),s,!0,n)},y.parseSubscript=function(e,t,s,n,i,r,a){var o=this.options.ecmaVersion>=11,c=o&&this.eat(u.questionDot);n&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var p=this.eat(u.bracketL);if(p||c&&this.type!==u.parenL&&this.type!==u.backQuote||this.eat(u.dot)){var h=this.startNodeAt(t,s);h.object=e,p?(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=!!p,o&&(h.optional=c),e=this.finishNode(h,"MemberExpression")}else if(!n&&this.eat(u.parenL)){var l=new Ie,d=this.yieldPos,m=this.awaitPos,f=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(u.parenR,this.options.ecmaVersion>=8,!1,l);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(l,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=d,this.awaitPos=m,this.awaitIdentPos=f,this.parseSubscriptAsyncArrow(t,s,g,a);this.checkExpressionErrors(l,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=m||this.awaitPos,this.awaitIdentPos=f||this.awaitIdentPos;var x=this.startNodeAt(t,s);x.callee=e,x.arguments=g,o&&(x.optional=c),e=this.finishNode(x,"CallExpression")}else if(this.type===u.backQuote){(c||r)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var E=this.startNodeAt(t,s);E.tag=e,E.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(E,"TaggedTemplateExpression")}return e},y.parseExprAtom=function(e,t,s){this.type===u.slash&&this.readRegexp();var n,i=this.potentialArrowAt===this.start;switch(this.type){case u._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),n=this.startNode(),this.next(),this.type===u.parenL&&!this.allowDirectSuper&&this.raise(n.start,"super() call outside constructor of a subclass"),this.type!==u.dot&&this.type!==u.bracketL&&this.type!==u.parenL&&this.unexpected(),this.finishNode(n,"Super");case u._this:return n=this.startNode(),this.next(),this.finishNode(n,"ThisExpression");case u.name:var r=this.start,a=this.startLoc,o=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&"async"===c.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),[c],!1,t);if(this.options.ecmaVersion>=8&&"async"===c.name&&this.type===u.name&&!o&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(u.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(r,a),[c],!0,t)}return c;case u.regexp:var p=this.value;return(n=this.parseLiteral(p.value)).regex={pattern:p.pattern,flags:p.flags},n;case u.num:case u.string:return this.parseLiteral(this.value);case u._null:case u._true:case u._false:return(n=this.startNode()).value=this.type===u._null?null:this.type===u._true,n.raw=this.type.keyword,this.next(),this.finishNode(n,"Literal");case u.parenL:var h=this.start,l=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(l)&&(e.parenthesizedAssign=h),e.parenthesizedBind<0&&(e.parenthesizedBind=h)),l;case u.bracketL:return n=this.startNode(),this.next(),n.elements=this.parseExprList(u.bracketR,!0,!0,e),this.finishNode(n,"ArrayExpression");case u.braceL:return this.overrideContext(I.b_expr),this.parseObj(!1,e);case u._function:return n=this.startNode(),this.next(),this.parseFunction(n,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(s):this.unexpected();default:return this.parseExprAtomDefault()}},y.parseExprAtomDefault=function(){this.unexpected()},y.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 s=this.startNodeAt(t.start,t.loc&&t.loc.start);return s.name="import",t.meta=this.finishNode(s,"Identifier"),this.parseImportMeta(t)}this.unexpected()},y.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")},y.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")},y.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")},y.parseParenExpression=function(){this.expect(u.parenL);var e=this.parseExpression();return this.expect(u.parenR),e},y.shouldParseArrow=function(e){return!this.canInsertSemicolon()},y.parseParenAndDistinguishExpression=function(e,t){var s,n=this.start,i=this.startLoc,r=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a,o=this.start,c=this.startLoc,p=[],h=!0,l=!1,d=new Ie,m=this.yieldPos,f=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)){l=!0;break}if(this.type===u.ellipsis){a=this.start,p.push(this.parseParenItem(this.parseRestBinding())),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}p.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var g=this.lastTokEnd,x=this.lastTokEndLoc;if(this.expect(u.parenR),e&&this.shouldParseArrow(p)&&this.eat(u.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=m,this.awaitPos=f,this.parseParenArrowList(n,i,p,t);(!p.length||l)&&this.unexpected(this.lastTokStart),a&&this.unexpected(a),this.checkExpressionErrors(d,!0),this.yieldPos=m||this.yieldPos,this.awaitPos=f||this.awaitPos,p.length>1?((s=this.startNodeAt(o,c)).expressions=p,this.finishNodeAt(s,"SequenceExpression",g,x)):s=p[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var E=this.startNodeAt(n,i);return E.expression=s,this.finishNode(E,"ParenthesizedExpression")}return s},y.parseParenItem=function(e){return e},y.parseParenArrowList=function(e,t,s,n){return this.parseArrowExpression(this.startNodeAt(e,t),s,!1,n)};var as=[];y.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 s=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'"),s&&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 n=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),n,i,!0,!1),this.eat(u.parenL)?e.arguments=this.parseExprList(u.parenR,this.options.ecmaVersion>=8,!1):e.arguments=as,this.finishNode(e,"NewExpression")},y.parseTemplateElement=function(e){var t=e.isTagged,s=this.startNode();return this.type===u.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),s.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):s.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),s.tail=this.type===u.backQuote,this.finishNode(s,"TemplateElement")},y.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var s=this.startNode();this.next(),s.expressions=[];var n=this.parseTemplateElement({isTagged:t});for(s.quasis=[n];!n.tail;)this.type===u.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(u.dollarBraceL),s.expressions.push(this.parseExpression()),this.expect(u.braceR),s.quasis.push(n=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(s,"TemplateLiteral")},y.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)&&!V.test(this.input.slice(this.lastTokEnd,this.start))},y.parseObj=function(e,t){var s=this.startNode(),n=!0,i={};for(s.properties=[],this.next();!this.eat(u.braceR);){if(n)n=!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),s.properties.push(r)}return this.finishNode(s,e?"ObjectPattern":"ObjectExpression")},y.parseProperty=function(e,t){var s,n,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||(s=this.eat(u.star)));var o=this.containsEsc;return this.parsePropertyName(a),!e&&!o&&this.options.ecmaVersion>=8&&!s&&this.isAsyncProp(a)?(n=!0,s=this.options.ecmaVersion>=9&&this.eat(u.star),this.parsePropertyName(a)):n=!1,this.parsePropertyValue(a,e,s,n,i,r,t,o),this.finishNode(a,"Property")},y.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var s="get"===e.kind?0:1;if(e.value.params.length!==s){var n=e.value.start;"get"===e.kind?this.raiseRecoverable(n,"getter should have no params"):this.raiseRecoverable(n,"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")},y.parsePropertyValue=function(e,t,s,n,i,r,a,o){(s||n)&&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(s,n),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?((s||n)&&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():((s||n)&&this.unexpected(),this.parseGetterSetter(e))},y.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)},y.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},y.parseMethod=function(e,t,s){var n=this.startNode(),i=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(We(t,n.generator)|_e|(s?ut:0)),this.expect(u.parenL),n.params=this.parseBindingList(u.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1,!0,!1),this.yieldPos=i,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(n,"FunctionExpression")},y.parseArrowExpression=function(e,t,s,n){var i=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(We(s,!1)|Ue),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!s),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,n),this.yieldPos=i,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")},y.parseFunctionBody=function(e,t,s,n){var i=t&&this.type!==u.braceL,r=this.strict,a=!1;if(i)e.body=this.parseMaybeAssign(n),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 c=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!r&&!a&&!t&&!s&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,ht),e.body=this.parseBlock(!1,void 0,a&&!r),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},y.isSimpleParamList=function(e){for(var t=0,s=e;t<s.length;t+=1){if("Identifier"!==s[t].type)return!1}return!0},y.checkParams=function(e,t){for(var s=Object.create(null),n=0,i=e.params;n<i.length;n+=1){var r=i[n];this.checkLValInnerPattern(r,He,t?null:s)}},y.parseExprList=function(e,t,s,n){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;s&&this.type===u.comma?a=null:this.type===u.ellipsis?(a=this.parseSpread(n),n&&this.type===u.comma&&n.trailingComma<0&&(n.trailingComma=this.start)):a=this.parseMaybeAssign(!1,n),i.push(a)}return i},y.checkUnreserved=function(e){var t=e.start,s=e.end,n=e.name;(this.inGenerator&&"yield"===n&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===n&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Ae)&&"arguments"===n&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&("arguments"===n||"await"===n)&&this.raise(t,"Cannot use "+n+" in class static initialization block"),this.keywords.test(n)&&this.raise(t,"Unexpected keyword '"+n+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(t,s).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(n)&&(!this.inAsync&&"await"===n&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+n+"' is reserved"))},y.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},y.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},y.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},y.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")},y.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 Ce=P.prototype;Ce.raise=function(e,t){var s=at(this.input,e);t+=" ("+s.line+":"+s.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var n=new SyntaxError(t);throw n.pos=e,n.loc=s,n.raisedAt=this.pos,n},Ce.raiseRecoverable=Ce.raise,Ce.curPosition=function(){if(this.options.locations)return new me(this.curLine,this.pos-this.lineStart)};var se=P.prototype,os=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};se.enterScope=function(e){this.scopeStack.push(new os(e))},se.exitScope=function(){this.scopeStack.pop()},se.treatFunctionsAsVarInScope=function(e){return e.flags&le||!this.inModule&&e.flags&xe},se.declareName=function(e,t,s){var n=!1;if(t===Z){var i=this.currentScope();n=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&xe&&delete this.undefinedExports[e]}else if(t===pt){this.currentScope().lexical.push(e)}else if(t===lt){var r=this.currentScope();n=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&ct&&o.lexical[0]===e)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(e)>-1){n=!0;break}if(o.var.push(e),this.inModule&&o.flags&xe&&delete this.undefinedExports[e],o.flags&Ae)break}n&&this.raiseRecoverable(s,"Identifier '"+e+"' has already been declared")},se.checkLocalExport=function(e){-1===this.scopeStack[0].lexical.indexOf(e.name)&&-1===this.scopeStack[0].var.indexOf(e.name)&&(this.undefinedExports[e.name]=e)},se.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},se.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Ae|ge|re))return t}},se.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Ae|ge|re)&&!(t.flags&Ue))return t}};var Pe=function(e,t,s){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new Te(e,s)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},Ee=P.prototype;function mt(e,t,s,n){return e.type=t,e.end=s,this.options.locations&&(e.loc.end=n),this.options.ranges&&(e.range[1]=s),e}Ee.startNode=function(){return new Pe(this,this.start,this.startLoc)},Ee.startNodeAt=function(e,t){return new Pe(this,e,t)},Ee.finishNode=function(e,t){return mt.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},Ee.finishNodeAt=function(e,t,s,n){return mt.call(this,e,t,s,n)},Ee.copyNode=function(e){var t=new Pe(this,e.start,this.startLoc);for(var s in e)t[s]=e[s];return t};var cs="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",xt="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",gt=xt+" Extended_Pictographic",Et=gt,bt=gt+" EBase EComp EMod EPres ExtPict",vt=bt,us=bt,ls={9:xt,10:gt,11:gt,12:bt,13:bt,14:us},ps="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",hs={9:"",10:"",11:"",12:"",13:"",14:ps},Je="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",yt="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",Ct=yt+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",St=Ct+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",wt=St+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Tt=wt+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",fs=Tt+" "+cs,ds={9:yt,10:Ct,11:St,12:wt,13:Tt,14:fs},_t={};function ms(e){var t=_t[e]={binary:ee(ls[e]+" "+Je),binaryOfStrings:ee(hs[e]),nonBinary:{General_Category:ee(Je),Script:ee(ds[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 Re=0,Ye=[9,10,11,12,13,14];Re<Ye.length;Re+=1){var xs=Ye[Re];ms(xs)}var g=P.prototype,Se=function(e,t){this.parent=e,this.base=t||this};Se.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var s=e;s;s=s.parent)if(t.base===s.base&&t!==s)return!0;return!1},Se.prototype.sibling=function(){return new Se(this.parent,this.base)};var z=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=_t[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 gs(e){for(var t in e)return!0;return!1}function Es(e){return 105===e||109===e||115===e}function At(e){return 36===e||e>=40&&e<=43||46===e||63===e||e>=91&&e<=94||e>=123&&e<=125}function bs(e){return H(e,!0)||36===e||95===e}function vs(e){return te(e,!0)||36===e||95===e||8204===e||8205===e}function It(e){return e>=65&&e<=90||e>=97&&e<=122}function ys(e){return e>=0&&e<=1114111}z.prototype.reset=function(e,t,s){var n=-1!==s.indexOf("v"),i=-1!==s.indexOf("u");this.start=0|e,this.source=t+"",this.flags=s,n&&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)},z.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},z.prototype.at=function(e,t){void 0===t&&(t=!1);var s=this.source,n=s.length;if(e>=n)return-1;var i=s.charCodeAt(e);if(!t&&!this.switchU||i<=55295||i>=57344||e+1>=n)return i;var r=s.charCodeAt(e+1);return r>=56320&&r<=57343?(i<<10)+r-56613888:i},z.prototype.nextIndex=function(e,t){void 0===t&&(t=!1);var s=this.source,n=s.length;if(e>=n)return n;var i,r=s.charCodeAt(e);return!t&&!this.switchU||r<=55295||r>=57344||e+1>=n||(i=s.charCodeAt(e+1))<56320||i>57343?e+1:e+2},z.prototype.current=function(e){return void 0===e&&(e=!1),this.at(this.pos,e)},z.prototype.lookahead=function(e){return void 0===e&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},z.prototype.advance=function(e){void 0===e&&(e=!1),this.pos=this.nextIndex(this.pos,e)},z.prototype.eat=function(e,t){return void 0===t&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},z.prototype.eatChars=function(e,t){void 0===t&&(t=!1);for(var s=this.pos,n=0,i=e;n<i.length;n+=1){var r=i[n],a=this.at(s,t);if(-1===a||a!==r)return!1;s=this.nextIndex(s,t)}return this.pos=s,!0},g.validateRegExpFlags=function(e){for(var t=e.validFlags,s=e.flags,n=!1,i=!1,r=0;r<s.length;r++){var a=s.charAt(r);-1===t.indexOf(a)&&this.raise(e.start,"Invalid regular expression flag"),s.indexOf(a,r+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),"u"===a&&(n=!0),"v"===a&&(i=!0)}this.options.ecmaVersion>=15&&n&&i&&this.raise(e.start,"Invalid regular expression flag")},g.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&gs(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},g.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,s=e.backReferenceNames;t<s.length;t+=1){var n=s[t];e.groupNames[n]||e.raise("Invalid named capture referenced")}},g.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Se(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")},g.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},g.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)},g.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 s=!1;if(this.options.ecmaVersion>=9&&(s=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!s,!0}return e.pos=t,!1},g.regexp_eatQuantifier=function(e,t){return void 0===t&&(t=!1),!!this.regexp_eatQuantifierPrefix(e,t)&&(e.eat(63),!0)},g.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},g.regexp_eatBracedQuantifier=function(e,t){var s=e.pos;if(e.eat(123)){var n=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return-1!==i&&i<n&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=s}return!1},g.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)},g.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},g.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var s=this.regexp_eatModifiers(e),n=e.eat(45);if(s||n){for(var i=0;i<s.length;i++){var r=s.charAt(i);s.indexOf(r,i+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(n){var a=this.regexp_eatModifiers(e);!s&&!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||s.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},g.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},g.regexp_eatModifiers=function(e){for(var t="",s=0;-1!==(s=e.current())&&Es(s);)t+=K(s),e.advance();return t},g.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)},g.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},g.regexp_eatSyntaxCharacter=function(e){var t=e.current();return!!At(t)&&(e.lastIntValue=t,e.advance(),!0)},g.regexp_eatPatternCharacters=function(e){for(var t=e.pos,s=0;-1!==(s=e.current())&&!At(s);)e.advance();return e.pos!==t},g.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)},g.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,s=e.groupNames[e.lastStringValue];if(s)if(t)for(var n=0,i=s;n<i.length;n+=1){i[n].separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(s||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},g.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},g.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=K(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=K(e.lastIntValue);return!0}return!1},g.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,s=this.options.ecmaVersion>=11,n=e.current(s);return e.advance(s),92===n&&this.regexp_eatRegExpUnicodeEscapeSequence(e,s)&&(n=e.lastIntValue),bs(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)},g.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,s=this.options.ecmaVersion>=11,n=e.current(s);return e.advance(s),92===n&&this.regexp_eatRegExpUnicodeEscapeSequence(e,s)&&(n=e.lastIntValue),vs(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)},g.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)},g.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var s=e.lastIntValue;if(e.switchU)return s>e.maxBackReference&&(e.maxBackReference=s),!0;if(s<=e.numCapturingParens)return!0;e.pos=t}return!1},g.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},g.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)},g.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},g.regexp_eatZero=function(e){return 48===e.current()&&!Ne(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},g.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)},g.regexp_eatControlLetter=function(e){var t=e.current();return!!It(t)&&(e.lastIntValue=t%32,e.advance(),!0)},g.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){void 0===t&&(t=!1);var s=e.pos,n=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(n&&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(n&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&ys(e.lastIntValue))return!0;n&&e.raise("Invalid unicode escape"),e.pos=s}return!1},g.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)},g.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 Pt=0,Q=1,$=2;function Cs(e){return 100===e||68===e||115===e||83===e||119===e||87===e}function Nt(e){return It(e)||95===e}function Ss(e){return Nt(e)||Ne(e)}function ws(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 Ts(e){return 40===e||41===e||45===e||47===e||e>=91&&e<=93||e>=123&&e<=125}function _s(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 Ne(e){return e>=48&&e<=57}function kt(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Mt(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function Lt(e){return e>=48&&e<=55}g.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Cs(t))return e.lastIntValue=-1,e.advance(),Q;var s=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((s=80===t)||112===t)){var n;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(n=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return s&&n===$&&e.raise("Invalid property name"),n;e.raise("Invalid property name")}return Pt},g.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var s=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,s,n),Q}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return Pt},g.regexp_validateUnicodePropertyNameAndValue=function(e,t,s){ue(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(s)||e.raise("Invalid property value")},g.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?Q:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?$:void e.raise("Invalid property name")},g.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Nt(t=e.current());)e.lastStringValue+=K(t),e.advance();return""!==e.lastStringValue},g.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Ss(t=e.current());)e.lastStringValue+=K(t),e.advance();return""!==e.lastStringValue},g.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},g.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),s=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&s===$&&e.raise("Negated character class may contain strings"),!0}return!1},g.regexp_classContents=function(e){return 93===e.current()?Q:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Q)},g.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var s=e.lastIntValue;e.switchU&&(-1===t||-1===s)&&e.raise("Invalid character class"),-1!==t&&-1!==s&&t>s&&e.raise("Range out of order in character class")}}},g.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var s=e.current();(99===s||Lt(s))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var n=e.current();return 93!==n&&(e.lastIntValue=n,e.advance(),!0)},g.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)},g.regexp_classSetExpression=function(e){var t,s=Q;if(!this.regexp_eatClassSetRange(e))if(t=this.regexp_eatClassSetOperand(e)){t===$&&(s=$);for(var n=e.pos;e.eatChars([38,38]);)38!==e.current()&&(t=this.regexp_eatClassSetOperand(e))?t!==$&&(s=Q):e.raise("Invalid character in character class");if(n!==e.pos)return s;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(n!==e.pos)return s}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return s;t===$&&(s=$)}},g.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var s=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;return-1!==s&&-1!==n&&s>n&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},g.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Q:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},g.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var s=e.eat(94),n=this.regexp_classContents(e);if(e.eat(93))return s&&n===$&&e.raise("Negated character class may contain strings"),n;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},g.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var s=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return s}else e.raise("Invalid escape");e.pos=t}return null},g.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===$&&(t=$);return t},g.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return 1===t?Q:$},g.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 s=e.current();return!(s<0||s===e.lookahead()&&ws(s)||Ts(s))&&(e.advance(),e.lastIntValue=s,!0)},g.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return!!_s(t)&&(e.lastIntValue=t,e.advance(),!0)},g.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!Ne(t)&&95!==t)&&(e.lastIntValue=t%32,e.advance(),!0)},g.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},g.regexp_eatDecimalDigits=function(e){var t=e.pos,s=0;for(e.lastIntValue=0;Ne(s=e.current());)e.lastIntValue=10*e.lastIntValue+(s-48),e.advance();return e.pos!==t},g.regexp_eatHexDigits=function(e){var t=e.pos,s=0;for(e.lastIntValue=0;kt(s=e.current());)e.lastIntValue=16*e.lastIntValue+Mt(s),e.advance();return e.pos!==t},g.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var s=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=64*t+8*s+e.lastIntValue:e.lastIntValue=8*t+s}else e.lastIntValue=t;return!0}return!1},g.regexp_eatOctalDigit=function(e){var t=e.current();return Lt(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},g.regexp_eatFixedHexDigits=function(e,t){var s=e.pos;e.lastIntValue=0;for(var n=0;n<t;++n){var i=e.current();if(!kt(i))return e.pos=s,!1;e.lastIntValue=16*e.lastIntValue+Mt(i),e.advance()}return!0};var ze=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new Te(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},S=P.prototype;function As(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Rt(e){return"function"!=typeof BigInt?null:BigInt(e.replace(/_/g,""))}S.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 ze(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},S.getToken=function(){return this.next(),new ze(this)},typeof Symbol<"u"&&(S[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===u.eof,value:t}}}}),S.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())},S.readToken=function(e){return H(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},S.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},S.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,s=this.input.indexOf("*/",this.pos+=2);if(-1===s&&this.raise(this.pos-2,"Unterminated comment"),this.pos=s+2,this.options.locations)for(var n=void 0,i=t;(n=it(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=n;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,s),t,this.pos,e,this.curPosition())},S.skipLineComment=function(e){for(var t=this.pos,s=this.options.onComment&&this.curPosition(),n=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!ce(n);)n=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,s,this.curPosition())},S.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&&nt.test(String.fromCharCode(e))))break e;++this.pos}}},S.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var s=this.type;this.type=e,this.value=t,this.updateContext(s)},S.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))},S.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)},S.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),s=1,n=42===e?u.star:u.modulo;return this.options.ecmaVersion>=7&&42===e&&42===t&&(++s,n=u.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(u.assign,s+1):this.finishOp(n,s)},S.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)},S.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(u.assign,2):this.finishOp(u.bitwiseXOR,1)},S.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&&!V.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)},S.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),s=1;return t===e?(s=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+s)?this.finishOp(u.assign,s+1):this.finishOp(u.bitShift,s)):33!==t||60!==e||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===t&&(s=2),this.finishOp(u.relational,s)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},S.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)},S.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(46===t){var s=this.input.charCodeAt(this.pos+2);if(s<48||s>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)},S.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,H(e=this.fullCharCodeAtPos(),!0)||92===e))return this.finishToken(u.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+K(e)+"'")},S.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 '"+K(e)+"'")},S.finishOp=function(e,t){var s=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,s)},S.readRegexp=function(){for(var e,t,s=this.pos;;){this.pos>=this.input.length&&this.raise(s,"Unterminated regular expression");var n=this.input.charAt(this.pos);if(V.test(n)&&this.raise(s,"Unterminated regular expression"),e)e=!1;else{if("["===n)t=!0;else if("]"===n&&t)t=!1;else if("/"===n&&!t)break;e="\\"===n}++this.pos}var i=this.input.slice(s,this.pos);++this.pos;var r=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(r);var o=this.regexpState||(this.regexpState=new z(this));o.reset(s,i,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var c=null;try{c=new RegExp(i,a)}catch{}return this.finishToken(u.regexp,{pattern:i,flags:a,value:c})},S.readInt=function(e,t,s){for(var n=this.options.ecmaVersion>=12&&void 0===t,i=s&&48===this.input.charCodeAt(this.pos),r=this.pos,a=0,o=0,c=0,p=t??1/0;c<p;++c,++this.pos){var h=this.input.charCodeAt(this.pos),l=void 0;if(n&&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((l=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+l}}return n&&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},S.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var s=this.readInt(e);return null==s&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(s=Rt(this.input.slice(t,this.pos)),++this.pos):H(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(u.num,s)},S.readNumber=function(e){var t=this.pos;!e&&null===this.readInt(10,void 0,!0)&&this.raise(t,"Invalid number");var s=this.pos-t>=2&&48===this.input.charCodeAt(t);s&&this.strict&&this.raise(t,"Invalid number");var n=this.input.charCodeAt(this.pos);if(!s&&!e&&this.options.ecmaVersion>=11&&110===n){var i=Rt(this.input.slice(t,this.pos));return++this.pos,H(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(u.num,i)}s&&/[89]/.test(this.input.slice(t,this.pos))&&(s=!1),46===n&&!s&&(++this.pos,this.readInt(10),n=this.input.charCodeAt(this.pos)),(69===n||101===n)&&!s&&((43===(n=this.input.charCodeAt(++this.pos))||45===n)&&++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number")),H(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var r=As(this.input.slice(t,this.pos),s);return this.finishToken(u.num,r)},S.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},S.readString=function(e){for(var t="",s=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var n=this.input.charCodeAt(this.pos);if(n===e)break;92===n?(t+=this.input.slice(s,this.pos),t+=this.readEscapedChar(!1),s=this.pos):8232===n||8233===n?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(ce(n)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(s,this.pos++),this.finishToken(u.string,t)};var Ot={};S.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==Ot)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},S.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ot;this.raise(e,t)},S.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var s=this.input.charCodeAt(this.pos);if(96===s||36===s&&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===s?(this.pos+=2,this.finishToken(u.dollarBraceL)):(++this.pos,this.finishToken(u.backQuote));if(92===s)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(ce(s)){switch(e+=this.input.slice(t,this.pos),++this.pos,s){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(s)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},S.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")},S.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 K(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 s=this.pos-1;this.invalidStringToken(s,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var n=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(n,8);return i>255&&(n=n.slice(0,-1),i=parseInt(n,8)),this.pos+=n.length-1,t=this.input.charCodeAt(this.pos),("0"!==n||56===t||57===t)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-n.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)}},S.readHexChar=function(e){var t=this.pos,s=this.readInt(16,e);return null===s&&this.invalidStringToken(t,"Bad character escape sequence"),s},S.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,s=this.pos,n=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(te(i,n))this.pos+=i<=65535?1:2;else{if(92!==i)break;this.containsEsc=!0,e+=this.input.slice(s,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?H:te)(a,n)||this.invalidStringToken(r,"Invalid Unicode escape"),e+=K(a),s=this.pos}t=!1}return e+this.input.slice(s,this.pos)},S.readWord=function(){var e=this.readWord1(),t=u.name;return this.keywords.test(e)&&(t=$e[e]),this.finishToken(t,e)};var Is="8.15.0";function Y(e,t){return P.parse(e,t)}function X(e,t,s,n,i){s||(s=m),function e(n,i,r){var a=r||n.type;s[a](n,i,e),t[a]&&t[a](n,i)}(e,n,i)}function Ps(e,t,s,n,i){var r=[];s||(s=m),function e(n,i,a){var o=a||n.type,c=n!==r[r.length-1];c&&r.push(n),s[o](n,i,e),t[o]&&t[o](n,i||r,r),c&&r.pop()}(e,n,i)}function Xe(e,t,s){s(e,t)}function ae(e,t,s){}P.acorn={Parser:P,version:Is,defaultOptions:Ve,Position:me,SourceLocation:Te,getLineInfo:at,Node:Pe,TokenType:T,tokTypes:u,keywordTypes:$e,TokContext:U,tokContexts:I,isIdentifierChar:te,isIdentifierStart:H,Token:ze,isNewLine:ce,lineBreak:V,lineBreakG:Qt,nonASCIIwhitespace:nt};var m={};m.Program=m.BlockStatement=m.StaticBlock=function(e,t,s){for(var n=0,i=e.body;n<i.length;n+=1){s(i[n],t,"Statement")}},m.Statement=Xe,m.EmptyStatement=ae,m.ExpressionStatement=m.ParenthesizedExpression=m.ChainExpression=function(e,t,s){return s(e.expression,t,"Expression")},m.IfStatement=function(e,t,s){s(e.test,t,"Expression"),s(e.consequent,t,"Statement"),e.alternate&&s(e.alternate,t,"Statement")},m.LabeledStatement=function(e,t,s){return s(e.body,t,"Statement")},m.BreakStatement=m.ContinueStatement=ae,m.WithStatement=function(e,t,s){s(e.object,t,"Expression"),s(e.body,t,"Statement")},m.SwitchStatement=function(e,t,s){s(e.discriminant,t,"Expression");for(var n=0,i=e.cases;n<i.length;n+=1){s(i[n],t)}},m.SwitchCase=function(e,t,s){e.test&&s(e.test,t,"Expression");for(var n=0,i=e.consequent;n<i.length;n+=1){s(i[n],t,"Statement")}},m.ReturnStatement=m.YieldExpression=m.AwaitExpression=function(e,t,s){e.argument&&s(e.argument,t,"Expression")},m.ThrowStatement=m.SpreadElement=function(e,t,s){return s(e.argument,t,"Expression")},m.TryStatement=function(e,t,s){s(e.block,t,"Statement"),e.handler&&s(e.handler,t),e.finalizer&&s(e.finalizer,t,"Statement")},m.CatchClause=function(e,t,s){e.param&&s(e.param,t,"Pattern"),s(e.body,t,"Statement")},m.WhileStatement=m.DoWhileStatement=function(e,t,s){s(e.test,t,"Expression"),s(e.body,t,"Statement")},m.ForStatement=function(e,t,s){e.init&&s(e.init,t,"ForInit"),e.test&&s(e.test,t,"Expression"),e.update&&s(e.update,t,"Expression"),s(e.body,t,"Statement")},m.ForInStatement=m.ForOfStatement=function(e,t,s){s(e.left,t,"ForInit"),s(e.right,t,"Expression"),s(e.body,t,"Statement")},m.ForInit=function(e,t,s){"VariableDeclaration"===e.type?s(e,t):s(e,t,"Expression")},m.DebuggerStatement=ae,m.FunctionDeclaration=function(e,t,s){return s(e,t,"Function")},m.VariableDeclaration=function(e,t,s){for(var n=0,i=e.declarations;n<i.length;n+=1){s(i[n],t)}},m.VariableDeclarator=function(e,t,s){s(e.id,t,"Pattern"),e.init&&s(e.init,t,"Expression")},m.Function=function(e,t,s){e.id&&s(e.id,t,"Pattern");for(var n=0,i=e.params;n<i.length;n+=1){s(i[n],t,"Pattern")}s(e.body,t,e.expression?"Expression":"Statement")},m.Pattern=function(e,t,s){"Identifier"===e.type?s(e,t,"VariablePattern"):"MemberExpression"===e.type?s(e,t,"MemberPattern"):s(e,t)},m.VariablePattern=ae,m.MemberPattern=Xe,m.RestElement=function(e,t,s){return s(e.argument,t,"Pattern")},m.ArrayPattern=function(e,t,s){for(var n=0,i=e.elements;n<i.length;n+=1){var r=i[n];r&&s(r,t,"Pattern")}},m.ObjectPattern=function(e,t,s){for(var n=0,i=e.properties;n<i.length;n+=1){var r=i[n];"Property"===r.type?(r.computed&&s(r.key,t,"Expression"),s(r.value,t,"Pattern")):"RestElement"===r.type&&s(r.argument,t,"Pattern")}},m.Expression=Xe,m.ThisExpression=m.Super=m.MetaProperty=ae,m.ArrayExpression=function(e,t,s){for(var n=0,i=e.elements;n<i.length;n+=1){var r=i[n];r&&s(r,t,"Expression")}},m.ObjectExpression=function(e,t,s){for(var n=0,i=e.properties;n<i.length;n+=1){s(i[n],t)}},m.FunctionExpression=m.ArrowFunctionExpression=m.FunctionDeclaration,m.SequenceExpression=function(e,t,s){for(var n=0,i=e.expressions;n<i.length;n+=1){s(i[n],t,"Expression")}},m.TemplateLiteral=function(e,t,s){for(var n=0,i=e.quasis;n<i.length;n+=1){s(i[n],t)}for(var r=0,a=e.expressions;r<a.length;r+=1){s(a[r],t,"Expression")}},m.TemplateElement=ae,m.UnaryExpression=m.UpdateExpression=function(e,t,s){s(e.argument,t,"Expression")},m.BinaryExpression=m.LogicalExpression=function(e,t,s){s(e.left,t,"Expression"),s(e.right,t,"Expression")},m.AssignmentExpression=m.AssignmentPattern=function(e,t,s){s(e.left,t,"Pattern"),s(e.right,t,"Expression")},m.ConditionalExpression=function(e,t,s){s(e.test,t,"Expression"),s(e.consequent,t,"Expression"),s(e.alternate,t,"Expression")},m.NewExpression=m.CallExpression=function(e,t,s){if(s(e.callee,t,"Expression"),e.arguments)for(var n=0,i=e.arguments;n<i.length;n+=1){s(i[n],t,"Expression")}},m.MemberExpression=function(e,t,s){s(e.object,t,"Expression"),e.computed&&s(e.property,t,"Expression")},m.ExportNamedDeclaration=m.ExportDefaultDeclaration=function(e,t,s){e.declaration&&s(e.declaration,t,"ExportNamedDeclaration"===e.type||e.declaration.id?"Statement":"Expression"),e.source&&s(e.source,t,"Expression")},m.ExportAllDeclaration=function(e,t,s){e.exported&&s(e.exported,t),s(e.source,t,"Expression")},m.ImportDeclaration=function(e,t,s){for(var n=0,i=e.specifiers;n<i.length;n+=1){s(i[n],t)}s(e.source,t,"Expression")},m.ImportExpression=function(e,t,s){s(e.source,t,"Expression")},m.ImportSpecifier=m.ImportDefaultSpecifier=m.ImportNamespaceSpecifier=m.Identifier=m.PrivateIdentifier=m.Literal=ae,m.TaggedTemplateExpression=function(e,t,s){s(e.tag,t,"Expression"),s(e.quasi,t,"Expression")},m.ClassDeclaration=m.ClassExpression=function(e,t,s){return s(e,t,"Class")},m.Class=function(e,t,s){e.id&&s(e.id,t,"Pattern"),e.superClass&&s(e.superClass,t,"Expression"),s(e.body,t)},m.ClassBody=function(e,t,s){for(var n=0,i=e.body;n<i.length;n+=1){s(i[n],t)}},m.MethodDefinition=m.PropertyDefinition=m.Property=function(e,t,s){e.computed&&s(e.key,t,"Expression"),e.value&&s(e.value,t,"Expression")};const x={ATTR_PREFIXES:{COMPONENT:"pp-component",CONTEXT:"pp-context",LOOP:"pp-for",SPREAD:"pp-spread"},SCRIPT_TYPE:"text/pp",MAX_CACHE_SIZE:500,DEBOUNCE_MS:16,POOL_SIZE:10,MUSTACHE_PATTERN:/\{((?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*)\}/,MUSTACHE_SINGLE_PATTERN:/^\{((?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*)\}$/},Vt=new Set(["true","false","null","undefined","this","window","document","console","Math","Date","JSON","Object","Array","return","let","const","var","if","else","for","while","switch","case","break","continue","function","new","in","of","typeof","instanceof","void","delete","try","catch","finally","class","extends","super","thisElement","eventObject"]);function Ns(e,t){let s;return(...n)=>{clearTimeout(s),s=window.setTimeout((()=>e(...n)),t)}}function Ft(e){return e.charAt(0).toUpperCase()+e.slice(1)}function N(e){if(null==e||"boolean"==typeof e||"function"==typeof e||Array.isArray(e)&&0===e.length||"object"==typeof e&&0===Object.keys(e).length)return"";if("number"==typeof e)return String(e);if("string"==typeof e)return e;if(Array.isArray(e))return e.map((e=>N(e))).filter((e=>""!==e)).join("");if("object"==typeof e)try{return JSON.stringify(e)}catch{return"[object Object]"}return String(e)}const W=class e{constructor(){d(this,"stateVariables",new Set)}static getInstance(){return e.instance||(e.instance=new e),e.instance}extractFunctionNames(e){const t=[];try{X(Y(e,{ecmaVersion:2022,sourceType:"script",allowReturnOutsideFunction:!0}),{FunctionDeclaration:e=>{var s;"Identifier"===(null==(s=e.id)?void 0:s.type)&&t.push(e.id.name)},VariableDeclarator:e=>{var s,n,i;"Identifier"===(null==(s=e.id)?void 0:s.type)&&("ArrowFunctionExpression"===(null==(n=e.init)?void 0:n.type)||"FunctionExpression"===(null==(i=e.init)?void 0:i.type))&&t.push(e.id.name)},AssignmentExpression:e=>{var s,n,i;"Identifier"===(null==(s=e.left)?void 0:s.type)&&("ArrowFunctionExpression"===(null==(n=e.right)?void 0:n.type)||"FunctionExpression"===(null==(i=e.right)?void 0:i.type))&&t.push(e.left.name)}})}catch(e){console.error("AST function extraction error:",e)}return Array.from(new Set(t))}transformEffectDeclarations(e){try{const t=Y(e,{ecmaVersion:2022,sourceType:"script",allowReturnOutsideFunction:!0});let s=e;const n=[];return X(t,{CallExpression:t=>{const s=this.transformEffectCall(t,e);s&&n.push(s)}}),n.sort(((e,t)=>t.start-e.start)).forEach((e=>{s=s.slice(0,e.start)+e.replacement+s.slice(e.end)})),s}catch(t){return console.error("Effect transformation error:",t),e}}transformEffectCall(e,t){if(!this.isPPEffectCall(e))return null;const s=e.arguments;if(s.length<2)return null;const n=s[1];if("ArrayExpression"!==n.type||!n.elements.some((e=>!!e&&("Identifier"===e.type||"MemberExpression"===e.type))))return null;const i=n.elements.map((e=>e?"Identifier"===e.type?`"${e.name}"`:"MemberExpression"===e.type?`"${this.extractMemberExpression(e,t)}"`:t.slice(e.start,e.end):"null")),r=t.slice(s[0].start,s[0].end),a=s.slice(2).map((e=>t.slice(e.start,e.end))).join(", "),o=`[${i.join(", ")}]`,c=a?`pp.effect(${r}, ${o}, ${a})`:`pp.effect(${r}, ${o})`;return{start:e.start,end:e.end,replacement:c}}extractMemberExpression(e,t){if("MemberExpression"!==e.type)return"Identifier"===e.type?e.name:t.slice(e.start,e.end);const s=this.extractMemberExpression(e.object,t);if(e.computed){return`${s}[${t.slice(e.property.start,e.property.end)}]`}return`${s}.${e.property.name||t.slice(e.property.start,e.property.end)}`}isPPEffectCall(e){var t,s,n;return"MemberExpression"===(null==(t=e.callee)?void 0:t.type)&&"Identifier"===(null==(s=e.callee.object)?void 0:s.type)&&"pp"===e.callee.object.name&&"Identifier"===(null==(n=e.callee.property)?void 0:n.type)&&"effect"===e.callee.property.name}transformStateDeclarations(e){this.stateVariables.clear();let t=this.transformStateDeclarationsOnly(e);return t=this.transformEffectDeclarations(t),t=this.transformUnsupportedStateUsages(t),t}transformStateDeclarationsOnlyOriginal(e){try{const t=Y(e,{ecmaVersion:2022,sourceType:"script",allowReturnOutsideFunction:!0});let s=e;const n=[];return X(t,{VariableDeclarator:t=>{const s=this.transformStateDeclarator(t,e);s&&n.push(s)}}),n.sort(((e,t)=>t.start-e.start)).forEach((e=>{s=s.slice(0,e.start)+e.replacement+s.slice(e.end)})),s}catch(t){return console.error("AST transformation error:",t),e}}transformStateDeclarationsOnly(e){let t=this.transformStateDeclarationsOnlyOriginal(e);return t=this.transformDestructuringAssignments(t),t}transformUnsupportedStateUsages(e){try{const t=Y(e,{ecmaVersion:2022,sourceType:"script",allowReturnOutsideFunction:!0});this.collectStateVariables(t);let s=e;const n=[];return X(t,{SpreadElement:e=>{const t=this.transformSpreadElement(e,s);t&&n.push(t)},UnaryExpression:e=>{const t=this.transformUnaryExpression(e,s);t&&n.push(t)},BinaryExpression:e=>{const t=this.transformBinaryExpression(e,s);t&&n.push(t)},LogicalExpression:e=>{const t=this.transformLogicalExpression(e,s);t&&n.push(t)},ConditionalExpression:e=>{const t=this.transformConditionalExpression(e,s);t&&n.push(t)},IfStatement:e=>{const t=this.transformIfStatement(e,s);t&&n.push(t)},WhileStatement:e=>{const t=this.transformWhileStatement(e,s);t&&n.push(t)},ForStatement:e=>{const t=this.transformForStatement(e,s);t&&n.push(t)},ReturnStatement:e=>{const t=this.transformReturnStatement(e,s);t&&n.push(t)},VariableDeclarator:e=>{const t=this.transformVariableDeclarator(e,s);t&&n.push(t)},AssignmentExpression:e=>{const t=this.transformAssignmentExpression(e,s);t&&n.push(t)},CallExpression:e=>{const t=this.transformGeneralCallExpression(e,s);t&&n.push(t)}}),Ps(t,{Identifier:(e,t)=>{n.some((t=>e.start>=t.start&&e.end<=t.end))||this.stateVariables.has(e.name)&&(this.alreadyHasValue(e,s)||this.isPartOfStateDeclaration(e,t)||this.isPropertyName(e,t)||this.isMethodCallObject(e,t)||this.isPartOfPPCall(e,t)||this.isPartOfDestructuring(e,t)||n.push({start:e.start,end:e.end,replacement:`${e.name}.value`}))}}),n.sort(((e,t)=>t.start-e.start)).forEach((e=>{s=s.slice(0,e.start)+e.replacement+s.slice(e.end)})),s=this.transformMultipleCallArguments(s),s}catch(t){return console.error("State usage transformation error:",t),e}}transformLogicalExpression(e,t){var s,n;return"Identifier"===(null==(s=e.left)?void 0:s.type)&&this.stateVariables.has(e.left.name)&&!this.alreadyHasValue(e.left,t)?{start:e.left.start,end:e.left.end,replacement:`${e.left.name}.value`}:"Identifier"===(null==(n=e.right)?void 0:n.type)&&this.stateVariables.has(e.right.name)&&!this.alreadyHasValue(e.right,t)?{start:e.right.start,end:e.right.end,replacement:`${e.right.name}.value`}:null}transformConditionalExpression(e,t){var s,n,i;return"Identifier"===(null==(s=e.test)?void 0:s.type)&&this.stateVariables.has(e.test.name)&&!this.alreadyHasValue(e.test,t)?{start:e.test.start,end:e.test.end,replacement:`${e.test.name}.value`}:"Identifier"===(null==(n=e.consequent)?void 0:n.type)&&this.stateVariables.has(e.consequent.name)&&!this.alreadyHasValue(e.consequent,t)?{start:e.consequent.start,end:e.consequent.end,replacement:`${e.consequent.name}.value`}:"Identifier"===(null==(i=e.alternate)?void 0:i.type)&&this.stateVariables.has(e.alternate.name)&&!this.alreadyHasValue(e.alternate,t)?{start:e.alternate.start,end:e.alternate.end,replacement:`${e.alternate.name}.value`}:null}transformIfStatement(e,t){return this.transformExpressionNode(e.test,t)}transformWhileStatement(e,t){return this.transformExpressionNode(e.test,t)}transformForStatement(e,t){return e.test?this.transformExpressionNode(e.test,t):null}transformReturnStatement(e,t){return e.argument?this.transformExpressionNode(e.argument,t):null}transformVariableDeclarator(e,t){var s,n,i;return this.isStateDeclaration(e)||"ArrayPattern"===(null==(s=e.id)?void 0:s.type)||"ObjectPattern"===(null==(n=e.id)?void 0:n.type)?null:"Identifier"===(null==(i=e.init)?void 0:i.type)&&this.stateVariables.has(e.init.name)&&!this.alreadyHasValue(e.init,t)?{start:e.init.start,end:e.init.end,replacement:`${e.init.name}.value`}:null}transformAssignmentExpression(e,t){var s,n,i;return"ArrayPattern"===(null==(s=e.left)?void 0:s.type)||"ObjectPattern"===(null==(n=e.left)?void 0:n.type)?null:"Identifier"===(null==(i=e.right)?void 0:i.type)&&this.stateVariables.has(e.right.name)&&!this.alreadyHasValue(e.right,t)?{start:e.right.start,end:e.right.end,replacement:`${e.right.name}.value`}:null}transformGeneralCallExpression(t,s){var n,i;const r=s.slice(t.callee.start,t.callee.end);if("MemberExpression"===(null==(n=t.callee)?void 0:n.type)&&"Identifier"===(null==(i=t.callee.object)?void 0:i.type)&&this.stateVariables.has(t.callee.object.name)||this.isPPCall(t))return null;if(!e.isFunctionNeedingValueTransform(r)&&t.arguments.length>0)for(const e of t.arguments)if("Identifier"===e.type&&this.stateVariables.has(e.name)&&!this.alreadyHasValue(e,s))return{start:e.start,end:e.end,replacement:`${e.name}.value`};return null}static isFunctionNeedingValueTransform(e){return this.FUNCTIONS_NEEDING_VALUE_TRANSFORM.some((t=>t.includes(".")?e===t:e===t||e.endsWith("."+t)))}transformExpressionNode(e,t){return"Identifier"===(null==e?void 0:e.type)&&this.stateVariables.has(e.name)&&!this.alreadyHasValue(e,t)?{start:e.start,end:e.end,replacement:`${e.name}.value`}:null}isPPCall(e){var t,s,n;return"MemberExpression"===(null==(t=e.callee)?void 0:t.type)&&"Identifier"===(null==(s=e.callee.object)?void 0:s.type)&&"pp"===e.callee.object.name&&"Identifier"===(null==(n=e.callee.property)?void 0:n.type)&&("state"===e.callee.property.name||"effect"===e.callee.property.name)}isPartOfStateDeclaration(e,t){var s,n;if(!t||!Array.isArray(t))return!1;for(const e of t)if("VariableDeclarator"===e.type&&"ArrayPattern"===(null==(s=e.id)?void 0:s.type)&&"CallExpression"===(null==(n=e.init)?void 0:n.type)&&this.isPPStateCall(e.init))return!0;return!1}isPropertyName(e,t){if(!t||0===t.length)return!1;const s=t[t.length-1];return"Property"===(null==s?void 0:s.type)&&s.key===e||"MemberExpression"===(null==s?void 0:s.type)&&s.property===e&&!s.computed}isMethodCallObject(e,t){if(!t||0===t.length)return!1;const s=t[t.length-1];if("MemberExpression"===(null==s?void 0:s.type)&&s.object===e&&t.length>=2){const e=t[t.length-2];if("CallExpression"===(null==e?void 0:e.type)&&e.callee===s)return!0}return!1}isPartOfPPCall(e,t){var s,n,i;if(!t||!Array.isArray(t))return!1;for(const e of t)if("CallExpression"===e.type&&"MemberExpression"===(null==(s=e.callee)?void 0:s.type)&&"Identifier"===(null==(n=e.callee.object)?void 0:n.type)&&"pp"===e.callee.object.name&&"Identifier"===(null==(i=e.callee.property)?void 0:i.type)&&("state"===e.callee.property.name||"effect"===e.callee.property.name))return!0;return!1}isPartOfDestructuring(e,t){if(!t||!Array.isArray(t))return!1;for(let s=0;s<t.length;s++){const n=t[s];if("ArrayPattern"===n.type||"ObjectPattern"===n.type){if(s+1<t.length){const i=t[s+1];if("VariableDeclarator"===(null==i?void 0:i.type)&&i.id===n&&i.init===e)return!1}return!0}}return!1}collectStateVariables(e){X(e,{VariableDeclarator:e=>{if(this.isStateDeclaration(e)){const t=e.id.elements[0];"Identifier"===(null==t?void 0:t.type)&&this.stateVariables.add(t.name)}}})}isStateDeclaration(e){var t,s;return"ArrayPattern"===(null==(t=e.id)?void 0:t.type)&&"CallExpression"===(null==(s=e.init)?void 0:s.type)&&this.isPPStateCall(e.init)}transformSpreadElement(e,t){var s;return"Identifier"===(null==(s=e.argument)?void 0:s.type)&&this.stateVariables.has(e.argument.name)?this.alreadyHasValue(e.argument,t)?null:{start:e.argument.start,end:e.argument.end,replacement:`${e.argument.name}.value`}:null}transformUnaryExpression(e,t){var s;return"Identifier"===(null==(s=e.argument)?void 0:s.type)&&this.stateVariables.has(e.argument.name)&&["typeof","!","+","-","~","void","delete"].includes(e.operator)&&!this.alreadyHasValue(e.argument,t)?{start:e.argument.start,end:e.argument.end,replacement:`${e.argument.name}.value`}:null}transformBinaryExpression(e,t){var s,n;if(["===","!==","==","!=",">","<",">=","<=","+","-","*","/","%","**","&","|","^","<<",">>",">>>","in","instanceof"].includes(e.operator)){if("Identifier"===(null==(s=e.left)?void 0:s.type)&&this.stateVariables.has(e.left.name)&&!this.alreadyHasValue(e.left,t))return{start:e.left.start,end:e.left.end,replacement:`${e.left.name}.value`};if("Identifier"===(null==(n=e.right)?void 0:n.type)&&this.stateVariables.has(e.right.name)&&!this.alreadyHasValue(e.right,t))return{start:e.right.start,end:e.right.end,replacement:`${e.right.name}.value`}}return null}transformMultipleCallArguments(t){try{const s=Y(t,{ecmaVersion:2022,sourceType:"script",allowReturnOutsideFunction:!0});let n=t;const i=[];return X(s,{CallExpression:t=>{const s=n.slice(t.callee.start,t.callee.end);if(e.isFunctionNeedingValueTransform(s)&&t.arguments.length>0)for(const e of t.arguments)"Identifier"===e.type&&this.stateVariables.has(e.name)&&(this.alreadyHasValue(e,n)||i.push({start:e.start,end:e.end,replacement:`${e.name}.value`}))}}),i.sort(((e,t)=>t.start-e.start)).forEach((e=>{n=n.slice(0,e.start)+e.replacement+n.slice(e.end)})),n}catch(e){return console.error("Multiple call arguments transformation error:",e),t}}transformDestructuringAssignments(e){try{const t=Y(e,{ecmaVersion:2022,sourceType:"script",allowReturnOutsideFunction:!0});let s=e;const n=[];return X(t,{VariableDeclarator:t=>{var s,i,r;this.isStateDeclaration(t)||("ArrayPattern"===(null==(s=t.id)?void 0:s.type)||"ObjectPattern"===(null==(i=t.id)?void 0:i.type))&&"Identifier"===(null==(r=t.init)?void 0:r.type)&&this.stateVariables.has(t.init.name)&&(this.alreadyHasValue(t.init,e)||n.push({start:t.init.start,end:t.init.end,replacement:`${t.init.name}.value`}))},AssignmentExpression:t=>{var s,i,r;("ArrayPattern"===(null==(s=t.left)?void 0:s.type)||"ObjectPattern"===(null==(i=t.left)?void 0:i.type))&&"Identifier"===(null==(r=t.right)?void 0:r.type)&&this.stateVariables.has(t.right.name)&&(this.alreadyHasValue(t.right,e)||n.push({start:t.right.start,end:t.right.end,replacement:`${t.right.name}.value`}))}}),n.sort(((e,t)=>t.start-e.start)).forEach((e=>{s=s.slice(0,e.start)+e.replacement+s.slice(e.end)})),s}catch(t){return console.error("Destructuring transformation error:",t),e}}alreadyHasValue(e,t){const s=e.end;return t.slice(s,s+6).startsWith(".value")}transformStateDeclarator(e,t){var s,n;if("ArrayPattern"!==(null==(s=e.id)?void 0:s.type)||"CallExpression"!==(null==(n=e.init)?void 0:n.type))return null;const i=e.init;if(!this.isPPStateCall(i))return null;const r=e.id.elements[0];if(!r||"Identifier"!==r.type)return null;const a=r.name,o=`set${this.capitalize(a)}`,c=e.id.elements[1];return"Identifier"===(null==c?void 0:c.type)&&c.name!==o&&console.warn(`Setter name mismatch: expected ${o}, got ${c.name}`),this.createTransformation(i,a,t)}isPPStateCall(e){var t,s,n;return"MemberExpression"===(null==(t=e.callee)?void 0:t.type)&&"Identifier"===(null==(s=e.callee.object)?void 0:s.type)&&"pp"===e.callee.object.name&&"Identifier"===(null==(n=e.callee.property)?void 0:n.type)&&"state"===e.callee.property.name}createTransformation(e,t,s){const n=e.arguments;if(0===n.length){const s=`pp.state("${t}")`;return{start:e.start,end:e.end,replacement:s}}const i=n[0];if("Literal"===i.type&&"string"==typeof i.value&&i.value===t)return null;if(1===n.length){const n=`pp.state("${t}", ${s.slice(i.start,i.end)})`;return{start:e.start,end:e.end,replacement:n}}const r=`pp.state("${t}", ${s.slice(e.arguments[0].start,e.arguments[e.arguments.length-1].end)})`;return{start:e.start,end:e.end,replacement:r}}looksLikeVariableName(e){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)&&e.length<=50&&!e.includes(" ")}extractStateDeclarations(e){const t=[];try{X(Y(e,{ecmaVersion:2022,sourceType:"script",allowReturnOutsideFunction:!0,locations:!0}),{VariableDeclarator:s=>{const n=this.extractStateFromDeclarator(s,e);n&&t.push(n)}})}catch(e){console.error("State extraction error:",e)}return t}extractStateFromDeclarator(e,t){var s,n,i,r;if("ArrayPattern"!==(null==(s=e.id)?void 0:s.type)||"CallExpression"!==(null==(n=e.init)?void 0:n.type)||!this.isPPStateCall(e.init))return null;const a=e.id.elements[0],o=e.id.elements[1];if("Identifier"!==(null==a?void 0:a.type)||"Identifier"!==(null==o?void 0:o.type))return null;const c=e.init.arguments;let p,h=a.name;return c.length>=1&&("Literal"===c[0].type&&"string"==typeof c[0].value?this.looksLikeVariableName(c[0].value)?(h=c[0].value,c.length>=2&&(p=this.extractLiteralValue(c[1]))):(h=a.name,p=this.extractLiteralValue(c[0])):p=this.extractLiteralValue(c[0])),{variableName:a.name,setterName:o.name,stateKey:h,initialValue:p,line:(null==(i=e.loc)?void 0:i.start.line)||0,column:(null==(r=e.loc)?void 0:r.start.column)||0}}extractFunctionDeclarations(e){const t=[];try{X(Y(e,{ecmaVersion:2022,sourceType:"script",allowReturnOutsideFunction:!0,locations:!0}),{FunctionDeclaration:e=>{var s,n;"Identifier"===(null==(s=e.id)?void 0:s.type)&&t.push({name:e.id.name,type:"function",params:e.params.map((e=>"Identifier"===e.type?e.name:"")),line:(null==(n=e.loc)?void 0:n.start.line)||0})},VariableDeclarator:e=>{var s,n,i,r;if("Identifier"===(null==(s=e.id)?void 0:s.type)&&("ArrowFunctionExpression"===(null==(n=e.init)?void 0:n.type)||"FunctionExpression"===(null==(i=e.init)?void 0:i.type))){const s=e.init;t.push({name:e.id.name,type:"ArrowFunctionExpression"===s.type?"arrow":"function",params:s.params.map((e=>"Identifier"===e.type?e.name:"")),line:(null==(r=e.loc)?void 0:r.start.line)||0})}}})}catch(e){console.error("Function extraction error:",e)}return t}extractLiteralValue(e){if("Literal"===e.type)return e.value;"Identifier"===e.type&&e.name}capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}};d(W,"instance"),d(W,"FUNCTIONS_NEEDING_VALUE_TRANSFORM",["console.log","console.warn","console.error","console.info","console.debug","console.dir","console.table","console.trace","console.assert","JSON.stringify","JSON.parse","Object.keys","Object.values","Object.entries","Array.from","Array.isArray","Math.max","Math.min","Math.abs","Math.floor","Math.ceil","Math.round","alert","confirm","prompt","parseInt","parseFloat","Number","String","Boolean"]);let de=W;class Ge{constructor(e){this.evaluator=e}render(e,t,s){const n=k.isSingleExpression(e);if(n)return this.evaluator.evaluateExpression(n,t,s);let i="";for(const n of k.parse(e))if("static"===n.type)i+=n.content;else if(n.expression)try{i+=N(this.evaluator.evaluateExpression(n.expression,t,s))}catch{}return i}dependencies(e,t,s){const n=k.extractExpressions(e),i=new Set;for(const e of n)for(const n of this.evaluator.extractDependencies(e,t,s))i.add(n);return[...i]}}class Dt{static containsMustacheExpression(e){if(x.MUSTACHE_PATTERN.test(e))return!0;const t=k.decodeEntities(e);return x.MUSTACHE_PATTERN.test(t)}}class C{static getContextComponent(e){const t=e.getAttribute(x.ATTR_PREFIXES.CONTEXT);if(t){if("parent"===t){const t=C.getElementComponent(e);return C.getParentOfComponent(t,e)}return"app"===t?"app":t}return C.getElementComponent(e)}static getParentOfComponent(e,t){if("app"===e)return"app";let s=t;for(;s&&s.getAttribute(x.ATTR_PREFIXES.COMPONENT)!==e;)s=s.parentElement;if(!s)return"app";let n=s.parentElement;for(;n;){const e=n.getAttribute(x.ATTR_PREFIXES.COMPONENT);if(e)return e;n=n.parentElement}return"app"}static findElementForComponent(e,t){return"app"===t?document.body:document.querySelectorAll(`[${x.ATTR_PREFIXES.COMPONENT}="${t}"]`)[0]||null}static getElementDepth(e){let t=0,s=e.parentElement;for(;s&&s!==document.body;)t++,s=s.parentElement;return t}static getParentComponentForElement(e){let t=e.parentElement;for(;t;){const e=t.getAttribute(x.ATTR_PREFIXES.COMPONENT);if(e)return e;t=t.parentElement}return"app"}static isTextNodeInsideScript(e){let t=e.parentElement;for(;t&&t!==document.body;){const e=t.tagName.toLowerCase();if("script"===e||"style"===e)return!0;t=t.parentElement}return!1}static getComponentForNode(e){let t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;for(;t;){const e=t.getAttribute(x.ATTR_PREFIXES.COMPONENT);if(e)return e;t=t.parentElement}return"app"}static getElementComponent(e){const t=e.getAttribute(x.ATTR_PREFIXES.COMPONENT);if(t)return t;let s=e.parentElement;for(;s;){const e=s.getAttribute(x.ATTR_PREFIXES.COMPONENT);if(e)return e;s=s.parentElement}return"app"}}class he{static isEventAttribute(e){return e.startsWith("on")&&e.length>2&&!e.includes("-")}}class we{static findExistingStateKey(e,t,s){return[`${t}.${e}`,`app.${e}`,e].find((e=>e in s))||null}}class ks{static isBooleanAttribute(e){return["checked","disabled","hidden","readonly","required","multiple","selected","autofocus","autoplay","controls","defer","loop","muted","open","reversed","async","default","formnovalidate","novalidate","allowfullscreen","capture","itemscope"].includes(e)}}class et{constructor(){d(this,"pendingUpdates",new Map),d(this,"batchTimeout",null),d(this,"componentManager"),d(this,"domBindingManager")}setManagers(e,t){this.componentManager=e,this.domBindingManager=t}scheduleUpdate(e,t){this.pendingUpdates.has(e)||this.pendingUpdates.set(e,new Set),this.pendingUpdates.get(e).add(t),null===this.batchTimeout&&(this.batchTimeout=window.setTimeout((()=>{this.processBatchedUpdates()}),0))}processBatchedUpdates(){const e=new Map(this.pendingUpdates);this.pendingUpdates.clear(),this.batchTimeout=null;const t=this.sortUpdatesByDependency(e);for(const[e,s]of t)this.processComponentUpdate(e,s)}sortUpdatesByDependency(e){return Array.from(e.entries()).sort((([,e],[,t])=>Math.min(...Array.from(e).map((e=>C.getElementDepth(e))))-Math.min(...Array.from(t).map((e=>C.getElementDepth(e))))))}processComponentUpdate(e,t){if(!this.componentManager||!this.domBindingManager)return;this.componentManager.invalidateComponent(e);const s=[],n=[],i=[];for(const r of t){if(!document.contains(r))continue;const t=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null);let a;for(;a=t.nextNode();)s.push(a);const o=this.domBindingManager.loopManager;if(o){const t=o.getAllLoops();for(const[s,i]of t)i.component===e&&r.contains(s)&&n.push([s,i])}i.push(r)}this.updateTextNodesBatch(s,e),this.updateLoopsBatch(n),this.updateElementsBatch(i,e)}updateTextNodesBatch(e,t){const s=this.domBindingManager.textNodeManager;s&&e.forEach((e=>{document.contains(e)&&C.getComponentForNode(e)===t&&s.updateTextNode(e)}))}updateLoopsBatch(e){const t=this.domBindingManager.loopManager;if(!t)return;const s=new Map;e.forEach((([e,t])=>{const n=C.getElementDepth(e);s.has(n)||s.set(n,[]),s.get(n).push([e,t])}));const n=Array.from(s.keys()).sort(((e,t)=>e-t));for(const e of n)s.get(e).forEach((([e,s])=>{document.contains(e)&&t.renderLoop(s,s.iterableExpr)}))}updateElementsBatch(e,t){e.forEach((e=>{document.contains(e)&&this.domBindingManager.processElementBindings(e,!0)}))}}class Bt{constructor(e,t){d(this,"loopBindings",new Map),d(this,"stateManager"),d(this,"expressionEvaluator"),d(this,"componentManager"),d(this,"domBindingManager"),d(this,"cleanupObserver"),d(this,"loopCounter",0),d(this,"pendingTemplates",[]),d(this,"loopItemElements",new WeakSet),d(this,"loopItemContexts",new WeakMap),d(this,"templateRenderer"),d(this,"contextCache",new Map),d(this,"contextCacheTimestamps",new Map),this.stateManager=e,this.expressionEvaluator=t,this.cleanupObserver=new MutationObserver((e=>{this.cleanupDetachedTemplates(e)})),this.cleanupObserver.observe(document.body,{childList:!0,subtree:!0}),this.templateRenderer=new Ge(t)}getLoopContextForElement(e){if(!this.domBindingManager)return null;const t=this.domBindingManager.loopManager;if(!t)return null;let s=e.parentElement;for(;s;){if(t.isLoopItem&&t.isLoopItem(s))return t.getLoopItemContext(s);s=s.parentElement}const n=t.getAllLoops();for(const[t,s]of n)for(const t of s.renderedItems)if(t.element.contains(e))return t.context;return null}setDependencies(e,t){this.componentManager=e,this.domBindingManager=t}queueTemplate(e,t){this.loopBindings.has(e)||this.pendingTemplates.push({template:e,component:t})}processPendingTemplates(){const e=[...this.pendingTemplates];this.pendingTemplates=[];for(const{template:t,component:s}of e)document.contains(t)&&this.processTemplate(t,s)}processTemplate(e,t){const s=e.getAttribute("pp-for");if(!s||this.loopBindings.has(e))return;const n=this.parseLoopExpression(s);if(!n)return void console.error(`Invalid pp-for syntax: "${s}"`);const i=e.parentElement,r=document.createComment(`pp-for: ${s}`);i.insertBefore(r,e);const a={template:e,expression:s,itemVar:n.itemVar,indexVar:n.indexVar,component:t,subscriptionIds:[],renderedItems:[],keyExpression:void 0,parentElement:i,placeholder:r,iterableExpr:n.iterableExpr};this.loopBindings.set(e,a),this.setupLoopReactivity(a,n.iterableExpr),this.renderLoop(a,n.iterableExpr)}parseLoopExpression(e){const t=e.match(/^\s*([a-zA-Z_$][\w$]*)\s+in\s+(.+)$/);if(t)return{itemVar:t[1],iterableExpr:t[2].trim()};const s=e.match(/^\s*\(\s*([a-zA-Z_$][\w$]*)\s*,\s*([a-zA-Z_$][\w$]*)\s*\)\s+in\s+(.+)$/);return s?{itemVar:s[1],indexVar:s[2],iterableExpr:s[3].trim()}:null}setupLoopReactivity(e,t){const s=`loop_${Date.now()}_${++this.loopCounter}`,n=this.expressionEvaluator.extractDependencies(t,e.component,this.stateManager),i=this.findComponentElementForLoop(e);if(i&&this.componentManager){const t=this.componentManager.getComponentPropDependencies(i,e.component);n.push(...t)}const r={id:s,selector:"",dependencies:new Set(n),callback:()=>{this.renderLoop(e,e.iterableExpr)},element:e.parentElement,component:e.component};this.stateManager.addSubscription(r),e.subscriptionIds.push(s)}renderLoop(e,t){if(this.componentManager&&this.domBindingManager)try{const s=this.findComponentElementForLoop(e);let n;const i=this.findParentLoopContext(e.template);n=i?{...this.componentManager.buildComponentContextWithProps(e.component,s),...i}:this.componentManager.buildComponentContextWithProps(e.component,s);const r=this.expressionEvaluator.evaluateExpression(t,n,e.component);if(!Array.isArray(r))return console.warn(`Loop expression "${t}" did not return an array:`,r,`Available context keys: [${Object.keys(n).join(", ")}]`,"Parent loop context:",i),void this.clearRenderedItems(e);this.updateRenderedItems(e,r)}catch(s){console.error(`Error evaluating loop expression "${t}":`,s),this.clearRenderedItems(e)}}findParentLoopContext(e){const t=[];let s=e.parentElement;for(;s&&s!==document.body;){if(this.loopItemElements.has(s)){const e=this.loopItemContexts.get(s);e&&t.unshift(e)}for(const[n,i]of this.loopBindings)if(i.template!==e)for(const n of i.renderedItems)if(n.element===s||n.element.contains(e)){t.unshift(n.context);break}s=s.parentElement}return t.length>0?t.reduce(((e,t)=>({...e,...t})),{}):null}findComponentElementForLoop(e){let t=e.parentElement;for(;t;){if(t.getAttribute(x.ATTR_PREFIXES.COMPONENT)===e.component)return t;t=t.parentElement}return document.querySelectorAll(`[${x.ATTR_PREFIXES.COMPONENT}="${e.component}"]`)[0]||void 0}updateRenderedItems(e,t){const s=e.renderedItems,n=[],i=new Set,r=new Map;s.forEach((e=>{r.set(e.key,e)})),t.forEach(((t,s)=>{const a=this.generateItemKey(e,t,s),o=r.get(a);if(o&&!i.has(o.element))i.add(o.element),this.updateItemContext(e,o,t,s),n.push(o);else{const i=this.createLoopItem(e,t,s,a);i&&(n.push(i),this.processNestedLoopsInItem(i,e.component))}})),s.forEach((e=>{i.has(e.element)||this.cleanupLoopItem(e)})),this.updateDOMOrder(e,n),e.renderedItems=n}processNestedLoopsInItem(e,t){e.element.querySelectorAll("template[pp-for]").forEach((s=>{const n=s;this.loopBindings.has(n)||this.processNestedTemplate(n,t,e.context)}))}generateItemKey(e,t,s){const n=e.template.content.firstElementChild;if(n&&n.hasAttribute("key")){const i=n.getAttribute("key");try{const n=this.createItemContextWithParentContext(e,t,s),r=k.isSingleExpression(i);if(r){const t=this.expressionEvaluator.evaluateExpression(r,n,e.component);return String(t)}{const t=k.parse(i);let s="";for(const i of t)if("static"===i.type)s+=i.content;else if(i.expression){s+=N(this.expressionEvaluator.evaluateExpression(i.expression,n,e.component))}return s}}catch(n){console.warn(`Error evaluating key expression "${i}":`,n,"Available context keys:",Object.keys(this.createItemContextWithParentContext(e,t,s)))}}return t&&"object"==typeof t&&"id"in t?String(t.id):`${e.expression}_${s}`}createItemContextWithParentContext(e,t,s){if(!this.componentManager)return{};e.component,e.expression;const n={...this.componentManager.buildComponentContext(e.component),...this.getAllParentLoopContexts(e.template),[e.itemVar]:t};return e.indexVar&&(n[e.indexVar]=s),n}getAllParentLoopContexts(e){const t=[];let s=e.parentElement;for(;s&&s!==document.body;){if(this.loopItemElements.has(s)){const e=this.loopItemContexts.get(s);e&&t.unshift(e)}for(const[n,i]of this.loopBindings)if(n!==e)for(const n of i.renderedItems)if(n.element===s||n.element.contains(e)){t.unshift(n.context);break}s=s.parentElement}return t.reduce(((e,t)=>({...e,...t})),{})}createItemContext(e,t,s){if(!this.componentManager)return{};const n={...this.componentManager.buildComponentContext(e.component),...this.findAllParentLoopContexts(e.template),[e.itemVar]:t};return e.indexVar&&(n[e.indexVar]=s),n}findAllParentLoopContexts(e){const t={};let s=e.parentElement;for(;s&&s!==document.body;){if(this.loopItemElements.has(s)){const e=this.loopItemContexts.get(s);if(e)for(const[s,n]of Object.entries(e))s in t||(t[s]=n)}for(const[n,i]of this.loopBindings)if(n!==e)for(const e of i.renderedItems)if(e.element===s){for(const[s,n]of Object.entries(e.context))s in t||(t[s]=n);break}s=s.parentElement}return t}createLoopItem(e,t,s,n){if(!this.domBindingManager)return null;try{const i=this.createItemContextWithParentContext(e,t,s),r=document.importNode(e.template.content,!0),a=document.createElement("div");a.appendChild(r);const o=a.firstElementChild;if(!o)return console.warn("Template content must contain exactly one root element"),null;a.removeChild(o),this.loopItemElements.add(o),this.loopItemContexts.set(o,i),o.getAttribute("key")&&o.removeAttribute("key");const c={key:n,element:o,context:i,subscriptionIds:[],textNodeTemplates:new Map,attributeTemplates:new Map};return this.executeComponentScriptsInLoopItem(o),this.processElementWithContext(o,i,e.component,c),this.cleanupRawMustacheAttributes(o),c}catch(e){return console.error("Error creating loop item:",e),null}}executeComponentScriptsInLoopItem(e){if(!this.componentManager)return;const t=[e],s=e.querySelectorAll(`[${x.ATTR_PREFIXES.COMPONENT}]`);t.push(...Array.from(s)),t.forEach((e=>{if(e.hasAttribute(x.ATTR_PREFIXES.COMPONENT)){const t=e.getAttribute(x.ATTR_PREFIXES.COMPONENT);if(t){const s=this.getLoopItemContextForElement(e),n=`${t}_${this.generateInstanceId(s)}`;e.setAttribute(x.ATTR_PREFIXES.COMPONENT,n),e.__originalComponentName=t,e.__uniqueComponentName=n,this.componentManager.pushComponent(n),this.getComponentScripts(e).forEach((e=>{this.componentManager.executeScript(e)})),this.componentManager.popComponent()}}}))}getLoopItemContextForElement(e){let t=e;for(;t;){if(this.loopItemElements.has(t)){const e=this.loopItemContexts.get(t);if(e)return e}t=t.parentElement}for(const[t,s]of this.loopBindings)for(const t of s.renderedItems)if(t.element===e||t.element.contains(e))return t.context;return console.warn("⚠️ No loop item context found, using empty context"),{}}generateInstanceId(e){const t={};for(const[s,n]of Object.entries(e))"function"==typeof n||s.startsWith("set")||s.endsWith("Getter")||"getContext"===s||"withContext"===s||"__getProp"===s||(n&&"object"==typeof n&&"id"in n||"object"!=typeof n||Array.isArray(n))&&(t[s]=n);return 0===Object.keys(t).length?`${Date.now()}_${Math.random().toString(36).substring(2,7)}`:Object.keys(t).sort().map((e=>{const s=t[e];return s&&"object"==typeof s&&"id"in s?`${e}_${s.id}`:"string"==typeof s||"number"==typeof s?`${e}_${s}`:`${e}_${JSON.stringify(s)}`})).join("_").replace(/[^a-zA-Z0-9_]/g,"").substring(0,20)||`fallback_${Date.now()}`}getComponentScripts(e){const t=[];return e.querySelectorAll(`script[type="${x.SCRIPT_TYPE}"]`).forEach((s=>{const n=s;let i=n.parentElement,r=!1;for(;i&&i!==e.parentElement;){if(i===e){r=!0;break}if(i.hasAttribute(x.ATTR_PREFIXES.COMPONENT)&&i!==e)break;i=i.parentElement}r&&t.push(n)})),t}cleanupRawMustacheAttributes(e){this.cleanupElementMustacheAttributes(e);const t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null);let s;for(;s=t.nextNode();)this.cleanupElementMustacheAttributes(s)}cleanupElementMustacheAttributes(e){const t=Array.from(e.attributes);for(const s of t)s.value&&x.MUSTACHE_PATTERN.test(s.value)&&(ks.isBooleanAttribute(s.name),e.removeAttribute(s.name))}processElementWithContext(e,t,s,n){if(!this.domBindingManager||!this.componentManager)return;const i=(e,s)=>{const n=this.componentManager.buildComponentContext(s),i=e.getAttribute(x.ATTR_PREFIXES.COMPONENT);if(i&&i!==s){const e=this.componentManager.buildComponentContext(i);return{...t,...n,...e}}return{...t,...n}},r=this.componentManager.buildComponentContextWithProps.bind(this.componentManager);this.componentManager.buildComponentContextWithProps=(t,s)=>s&&(s===e||e.contains(s))?i(s,t):r(t,s);try{this.bindLoopItemElement(e,t,s,n),this.setupEventBindingsForLoopItem(e,s);const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,{acceptNode:t=>{if(t===e)return NodeFilter.FILTER_SKIP;if(t.nodeType===Node.TEXT_NODE){const e=t;if(C.isTextNodeInsideScript(e))return NodeFilter.FILTER_REJECT;if(e.textContent&&x.MUSTACHE_PATTERN.test(e.textContent))return NodeFilter.FILTER_ACCEPT}else if(t.nodeType===Node.ELEMENT_NODE)return"script"===t.tagName.toLowerCase()?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT;return NodeFilter.FILTER_SKIP}});let a;for(;a=r.nextNode();)if(a.nodeType===Node.TEXT_NODE){const e=a;if(e.textContent&&x.MUSTACHE_PATTERN.test(e.textContent)){const t=this.getComponentForTextNode(e),s=i(e.parentElement,t);this.processTextNodeWithLoopContext(e,s,t,n)}}else if(a.nodeType===Node.ELEMENT_NODE){const e=a,t=C.getElementComponent(e),s=i(e,t);this.bindLoopItemElement(e,s,t,n),this.setupEventBindingsForLoopItem(e,t)}e.querySelectorAll("template[pp-for]").forEach((e=>{this.processNestedTemplate(e,s,t)}))}finally{this.componentManager.buildComponentContextWithProps=r}}getComponentForTextNode(e){let t=e.parentElement;for(;t;){const e=t.getAttribute(x.ATTR_PREFIXES.COMPONENT);if(e)return e;t=t.parentElement}return"app"}processNestedTemplate(e,t,s){const n=e.getAttribute("pp-for");if(!n||this.loopBindings.has(e))return;const i=this.parseLoopExpression(n);if(!i)return void console.error(`Invalid pp-for syntax: "${n}"`);const r=e.parentElement,a=document.createComment(`pp-for: ${n}`);r.insertBefore(a,e);const o=this.findComponentElementForTemplate(e);let c={...s};const p=this.findParentLoopContextForNestedTemplate(e);if(p&&(c={...c,...p}),o&&this.componentManager){const e=o.getAttribute(x.ATTR_PREFIXES.COMPONENT);if(e){const t=C.getParentComponentForElement(o);this.componentManager.hasStoredProps(o)||this.componentManager.setupProps(o,t);const s=this.evaluateComponentPropsWithContext(o,c);c={...this.componentManager.buildComponentContext(e),...s,...c}}}const h={template:e,expression:n,itemVar:i.itemVar,indexVar:i.indexVar,iterableExpr:i.iterableExpr,component:t,subscriptionIds:[],renderedItems:[],keyExpression:void 0,parentElement:r,placeholder:a};this.loopBindings.set(e,h),this.setupNestedLoopReactivity(h,i.iterableExpr,c),this.renderNestedLoop(h,i.iterableExpr,c)}findParentLoopContextForNestedTemplate(e){let t=e.parentElement;const s={};let n=0;for(;t&&t!==document.body&&n<10;){if(n++,this.loopItemElements.has(t)){const e=this.loopItemContexts.get(t);if(e)for(const[t,n]of Object.entries(e))t in s||(s[t]=n)}for(const[n,i]of this.loopBindings)for(const n of i.renderedItems)(n.element.contains(e)||n.element===t)&&(i.itemVar in s||(s[i.itemVar]=n.context[i.itemVar]),i.indexVar&&!(i.indexVar in s)&&(s[i.indexVar]=n.context[i.indexVar]));t=t.parentElement}return Object.keys(s).length>0?s:null}evaluateComponentPropsWithContext(e,t){const s={};if(!this.componentManager||!this.expressionEvaluator)return s;const n=this.componentManager.extractProps(e,"app");for(const[e,i]of n)try{const n=this.templateRenderer.render(i.expression,t,i.component);s[e]=n}catch(t){console.error(`Failed to evaluate prop "${e}":`,t),s[e]=void 0}return s}findComponentElementForTemplate(e){let t=e.parentElement;for(;t;){if(t.hasAttribute(x.ATTR_PREFIXES.COMPONENT))return t;t=t.parentElement}return null}setupNestedLoopReactivity(e,t,s){const n=`nested_loop_${Date.now()}_${++this.loopCounter}`;let i=this.expressionEvaluator.extractDependencies(t,e.component,this.stateManager);const r={id:n,selector:"",dependencies:new Set(i),callback:()=>{const n=e.template,i=this.findComponentElementForTemplate(n);let r=s;if(n.parentElement){const e=this.getParentLoopContextForElement(n);e&&(r={...r,...e})}if(i&&this.componentManager){const t=i.getAttribute(x.ATTR_PREFIXES.COMPONENT);if(t){const n=this.extractParentLoopContextFromBinding(e,s),a=this.evaluateComponentPropsWithContext(i,n),o=this.componentManager.buildComponentContext(t);r={...n,...o,...a}}}this.renderNestedLoop(e,t,r)},element:e.parentElement,component:e.component};this.stateManager.addSubscription(r),e.subscriptionIds.push(n)}getParentLoopContextForElement(e){let t=e.parentElement;for(;t;){if(this.loopItemElements.has(t)){const e=this.loopItemContexts.get(t);if(e)return e}t=t.parentElement}return null}extractParentLoopContextFromBinding(e,t){const s=new Set;for(const[t,n]of this.loopBindings)if(n!==e)for(const t of n.renderedItems)if(t.element.contains(e.template)){s.add(n.itemVar),n.indexVar&&s.add(n.indexVar);break}const n={};for(const[e,i]of Object.entries(t))(s.has(e)||e.startsWith("users")||e.startsWith("set")||e.includes("Getter")||"function"==typeof i)&&(n[e]=i);return n}renderNestedLoop(e,t,s){if(this.componentManager&&this.domBindingManager)try{const n=this.expressionEvaluator.evaluateExpression(t,s,e.component);if(!Array.isArray(n))return console.warn(`Nested loop expression "${t}" did not return an array:`,n,`Available context keys: [${Object.keys(s).join(", ")}]`),void this.clearRenderedItems(e);this.updateNestedRenderedItems(e,n,s)}catch(n){console.error(`Error evaluating nested loop expression "${t}":`,n,`Available context keys: [${Object.keys(s).join(", ")}]`),this.clearRenderedItems(e)}}updateNestedRenderedItems(e,t,s){const n=e.renderedItems,i=[],r=new Set,a=new Map;n.forEach((e=>{a.set(e.key,e)})),t.forEach(((t,n)=>{const o=this.generateNestedItemKey(e,t,n,s),c=a.get(o);if(c&&!r.has(c.element))r.add(c.element),this.updateNestedItemContext(e,c,t,n,s),i.push(c);else{const r=this.createNestedLoopItem(e,t,n,o,s);r&&i.push(r)}})),n.forEach((e=>{r.has(e.element)||this.cleanupLoopItem(e)})),this.updateDOMOrder(e,i),e.renderedItems=i}generateNestedItemKey(e,t,s,n){return t&&"object"==typeof t&&"id"in t?String(t.id):`${e.expression}_${s}_${JSON.stringify(n[e.itemVar]||{})}`}createNestedLoopItem(e,t,s,n,i){if(!this.domBindingManager)return null;try{const r={...i,[e.itemVar]:t};e.indexVar&&(r[e.indexVar]=s);const a=document.importNode(e.template.content,!0),o=document.createElement("div");o.appendChild(a);const c=o.firstElementChild;if(!c)return console.warn("Template content must contain exactly one root element"),null;o.removeChild(c),this.loopItemElements.add(c),this.loopItemContexts.set(c,r),c.getAttribute("key")&&c.removeAttribute("key");const p={key:n,element:c,context:r,subscriptionIds:[],textNodeTemplates:new Map,attributeTemplates:new Map};return this.processElementWithContext(c,r,e.component,p),this.cleanupRawMustacheAttributes(c),p}catch(e){return console.error("Error creating nested loop item:",e),null}}updateNestedItemContext(e,t,s,n,i){const r={...i};r[e.itemVar]=s,e.indexVar&&(r[e.indexVar]=n);const a=this.gatherAllComponentContextsInLoopItem(t.element),o={...r,...a};if(t.context=o,this.loopItemContexts.set(t.element,o),t.textNodeTemplates)for(const[e,s]of t.textNodeTemplates)document.contains(e)&&this.updateTextNodeWithContext(e,s,o,this.getTextNodeComponent(e));if(t.attributeTemplates)for(const[e,s]of t.attributeTemplates)document.contains(e)&&s.forEach(((t,s)=>{var n;try{const i=C.getElementComponent(e),r=this.buildElementSpecificContext(e,o),a=this.templateRenderer.render(t,r,i);null==(n=this.domBindingManager)||n.updateElementProperty(e,s,a)}catch(e){console.error(`Nested binding update error for "${t}":`,e)}}))}bindLoopItemElement(e,t,s,n){const i=this.extractMustacheBindings(e);n&&i.size>0&&(n.attributeTemplates||(n.attributeTemplates=new Map),n.attributeTemplates.set(e,new Map(i))),i.forEach(((i,r)=>{this.createLoopItemBinding(e,r,i,t,s,n)}))}setupEventBindingsForLoopItem(e,t){const s=this.domBindingManager.eventDelegation;if(!s)return void console.warn("No event delegation manager available");const n=Array.from(e.attributes);for(const i of n)if(he.isEventAttribute(i.name)){const n=i.name.substring(2);s.registerEventHandler(e,n,i.value,t),e.removeAttribute(i.name)}}processTextNodeWithLoopContext(e,t,s,n){if(C.isTextNodeInsideScript(e))return;const i=e.textContent||"";if(!k.parse(i).some((e=>"expression"===e.type)))return;n&&(n.textNodeTemplates||(n.textNodeTemplates=new Map),n.textNodeTemplates.set(e,i));const r=this.findActualComponentForTextNode(e);this.updateTextNodeWithContext(e,i,t,r);const a=`loop_text_${Date.now()}_${Math.random()}`,o=this.templateRenderer.dependencies(i,r,this.stateManager),c=new Set(o),p={id:a,selector:"",dependencies:c,callback:()=>{if(!document.contains(e))return void this.stateManager.removeSubscription(a);let t={};if(this.componentManager&&(t=this.componentManager.buildComponentContext(r)),n){const e={};let s=null;for(const[e,t]of this.loopBindings)if(t.renderedItems.includes(n)){s=t;break}if(s){e[s.itemVar]=n.context[s.itemVar],s.indexVar&&(e[s.indexVar]=n.context[s.indexVar]);const t=this.findParentLoopContext(s.template);t&&Object.assign(e,t)}t={...t,...e}}this.updateTextNodeWithContext(e,i,t,r)},component:r};this.stateManager.addSubscription(p),n&&n.subscriptionIds.push(a)}findActualComponentForTextNode(e){let t=e.parentElement;for(;t;){const e=t.getAttribute(x.ATTR_PREFIXES.COMPONENT);if(e){return t.__uniqueComponentName||e}t=t.parentElement}return"app"}updateTextNodeWithContext(e,t,s,n){const i=k.parse(t);let r="";for(const e of i)if("static"===e.type)r+=e.content;else if(e.expression)try{r+=N(this.expressionEvaluator.evaluateExpression(e.expression,s,n))}catch(t){console.warn(`Loop text evaluation error for "${e.expression}":`,t,"Available context keys:",Object.keys(s)),r+=""}e.textContent!==r&&(e.textContent=r)}extractMustacheBindings(e){const t=new Map,s=e.attributes;for(let e=0;e<s.length;e++){const n=s[e];if(n.name!==x.ATTR_PREFIXES.COMPONENT&&"key"!==n.name&&!n.name.startsWith("on")&&n.value){const e=x.MUSTACHE_PATTERN.test(n.value),s=k.decodeEntities(n.value),i=x.MUSTACHE_PATTERN.test(s);(e||i)&&t.set(n.name,s)}}return t}createLoopItemBinding(e,t,s,n,i,r){const a=`loop_item_${Date.now()}_${Math.random()}`,o=this.templateRenderer.dependencies(s,i,this.stateManager),c=new Set(o);let p=!1,h=0;const l=()=>{var o;if(!p)if(document.contains(e)){h=0;try{const a=this.componentManager.buildComponentContext(i);let c;if(r){c={...a};let e=null;for(const[t,s]of this.loopBindings)if(s.renderedItems.includes(r)){e=s;break}e&&(c[e.itemVar]=r.context[e.itemVar],e.indexVar&&(c[e.indexVar]=r.context[e.indexVar]));for(const[e,t]of Object.entries(r.context))e in c||(c[e]=t)}else c=n;const p=this.templateRenderer.render(s,c,i);null==(o=this.domBindingManager)||o.updateElementProperty(e,t,p)}catch(e){console.error(`Loop item binding evaluation error for "${s}":`,e),console.error("Available context keys:",Object.keys(n))}}else if(h++,h<5){const e=10*Math.pow(2,h-1);setTimeout((()=>{p||l()}),e)}else p=!0,this.stateManager.removeSubscription(a)},u={id:a,selector:"",dependencies:c,callback:()=>{p||l()},element:e,component:i};if(this.stateManager.addSubscription(u),r){r.subscriptionIds.push(a);const e=this.cleanupLoopItem.bind(this);this.cleanupLoopItem=t=>{t===r&&(p=!0),e(t)}}(()=>{document.contains(e)?l():Promise.resolve().then((()=>{if(!p&&document.contains(e))l();else if(!p&&h<5){h++;const e=10*Math.pow(2,h-1);setTimeout((()=>{p||l()}),e)}else!p&&h>=5&&(p=!0,this.stateManager.removeSubscription(a))}))})()}updateItemContext(e,t,s,n){const i={...this.createItemContext(e,s,n),...this.gatherAllComponentContextsInLoopItem(t.element)};if(t.context=i,this.loopItemContexts.set(t.element,i),t.textNodeTemplates)for(const[e,s]of t.textNodeTemplates)document.contains(e)&&this.updateTextNodeWithContext(e,s,i,this.getTextNodeComponent(e));if(t.attributeTemplates)for(const[e,s]of t.attributeTemplates)document.contains(e)&&s.forEach(((t,s)=>{var n;try{const r=C.getElementComponent(e),a=this.buildElementSpecificContext(e,i),o=this.templateRenderer.render(t,a,r);null==(n=this.domBindingManager)||n.updateElementProperty(e,s,o)}catch(e){console.error(`Attribute binding update error for "${t}":`,e)}}))}gatherAllComponentContextsInLoopItem(e){if(!this.componentManager)return{};const t={};if(e.hasAttribute(x.ATTR_PREFIXES.COMPONENT)){const s=e.getAttribute(x.ATTR_PREFIXES.COMPONENT),n=this.componentManager.buildComponentContext(s);Object.assign(t,n)}return e.querySelectorAll(`[${x.ATTR_PREFIXES.COMPONENT}]`).forEach((e=>{var s;const n=e.getAttribute(x.ATTR_PREFIXES.COMPONENT),i=null==(s=this.componentManager)?void 0:s.buildComponentContext(n);Object.assign(t,i)})),t}buildElementSpecificContext(e,t){if(!this.componentManager)return t;const s=C.getElementComponent(e),n=this.componentManager.buildComponentContext(s);return{...t,...n}}getTextNodeComponent(e){let t=e.parentElement;for(;t;){const e=t.getAttribute(x.ATTR_PREFIXES.COMPONENT);if(e)return e;t=t.parentElement}return"app"}updateDOMOrder(e,t){let s=e.placeholder;t.forEach((t=>{(t.element.parentElement!==e.parentElement||t.element!==s.nextSibling)&&e.parentElement.insertBefore(t.element,s.nextSibling),s=t.element}))}clearRenderedItems(e){e.renderedItems.forEach((e=>{this.cleanupLoopItem(e)})),e.renderedItems=[]}cleanupLoopItem(e){this.loopItemElements.delete(e.element),this.loopItemContexts.delete(e.element),e.element.parentElement&&e.element.parentElement.removeChild(e.element),e.subscriptionIds.forEach((e=>{this.stateManager.removeSubscription(e)}))}isLoopItem(e){return this.loopItemElements.has(e)}getLoopItemContext(e){return this.loopItemContexts.get(e)}cleanupDetachedTemplates(e){for(const t of e)"childList"===t.type&&t.removedNodes.forEach((e=>{if(e.nodeType===Node.ELEMENT_NODE){const t=e;"TEMPLATE"===t.tagName&&t.hasAttribute("pp-for")&&this.cleanupTemplate(t),t.querySelectorAll("template[pp-for]").forEach((e=>{this.cleanupTemplate(e)}))}}))}cleanupTemplate(e){const t=this.loopBindings.get(e);t&&(this.clearRenderedItems(t),t.subscriptionIds.forEach((e=>{this.stateManager.removeSubscription(e)})),t.placeholder.parentElement&&t.placeholder.parentElement.removeChild(t.placeholder),this.loopBindings.delete(e))}getAllLoops(){return new Map(this.loopBindings)}destroy(){this.cleanupObserver.disconnect(),Array.from(this.loopBindings.keys()).forEach((e=>{this.cleanupTemplate(e)})),this.loopItemContexts=new WeakMap}}class oe{constructor(e){d(this,"cache",new Map),d(this,"maxSize"),this.maxSize=e}get(e){const t=this.cache.get(e);return void 0!==t&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){const e=this.cache.keys().next().value;void 0!==e&&this.cache.delete(e)}this.cache.set(e,t)}has(e){return this.cache.has(e)}delete(e){return this.cache.delete(e)}clear(){this.cache.clear()}}const F=class e{static parseSpreadDirective(e){const t=e.replace(/^\s*\{\s*|\s*\}\s*$/g,""),s=this.parseSpreadParts(t),n=[],i=[];for(const e of s){const t=e.trim();if(t.startsWith("..."))n.push(t.substring(3).trim());else if(t.startsWith("{")&&t.endsWith("}")){const e=t.slice(1,-1).trim();if(e){const t=this.parseObjectProperties(e);i.push(t)}}else console.warn(`Invalid spread directive part: "${t}". Expected ...spread or {object}`)}return{spreads:n,objects:i}}static parseSpreadParts(e){const t=[];let s="",n=0,i=!1,r="",a=0;for(;a<e.length;){const o=e[a],c=a>0?e[a-1]:"";if(i||'"'!==o&&"'"!==o?i&&o===r&&"\\"!==c&&(i=!1,r=""):(i=!0,r=o),!i)if("{"===o)n++;else if("}"===o)n--;else if(","===o&&0===n){t.push(s.trim()),s="",a++;continue}s+=o,a++}return s.trim()&&t.push(s.trim()),t}static parseObjectProperties(e){const t=[],s=this.parseObjectParts(e);for(const e of s){const s=e.trim(),n=this.findPropertySeparator(s);if(-1!==n){const e=s.substring(0,n).trim().replace(/['"]/g,""),i=s.substring(n+1).trim();t.push({key:e,value:i})}else console.warn(`Invalid object property: "${s}". Expected key: value format.`)}return t}static parseObjectParts(e){const t=[];let s="",n=0,i=!1,r="";for(let a=0;a<e.length;a++){const o=e[a],c=a>0?e[a-1]:"";if(i||'"'!==o&&"'"!==o?i&&o===r&&"\\"!==c&&(i=!1,r=""):(i=!0,r=o),!i)if("{"===o||"["===o||"("===o)n++;else if("}"===o||"]"===o||")"===o)n--;else if(","===o&&0===n){t.push(s.trim()),s="";continue}s+=o}return s.trim()&&t.push(s.trim()),t}static findPropertySeparator(e){let t=0,s=!1,n="";for(let i=0;i<e.length;i++){const r=e[i],a=i>0?e[i-1]:"";if(s||'"'!==r&&"'"!==r?s&&r===n&&"\\"!==a&&(s=!1,n=""):(s=!0,n=r),!s)if("{"===r||"["===r||"("===r)t++;else if("}"===r||"]"===r||")"===r)t--;else if(":"===r&&0===t)return i}return-1}static splitMixedExpression(e){const t=[];let s="",n=0,i=!1,r="";for(let a=0;a<e.length;a++){const o=e[a],c=a>0?e[a-1]:"";if(i||'"'!==o&&"'"!==o?i&&o===r&&"\\"!==c&&(i=!1,r=""):(i=!0,r=o),!i)if("{"===o||"["===o||"("===o)n++;else if("}"===o||"]"===o||")"===o)n--;else if(","===o&&0===n){t.push(s.trim()),s="";continue}s+=o}return s.trim()&&t.push(s.trim()),t}static parse(t){const s=e.decodeEntities(t);if(e.EXPRESSION_CACHE.has(s))return e.EXPRESSION_CACHE.get(s);const n=e.parseContentWithNesting(s);return e.EXPRESSION_CACHE.set(s,n),n}static parseContentWithNesting(e){const t=[],s=e.length;let n=0,i=0;for(;n<s;)if("{"===e[n]){n>i&&t.push({type:"static",content:e.substring(i,n),expression:null});const s=this.extractNestedExpression(e,n);-1!==s.endIndex?(t.push({type:"expression",content:e.substring(n,s.endIndex+1),expression:s.expression.trim()}),n=s.endIndex+1,i=n):n++}else n++;return i<s&&t.push({type:"static",content:e.substring(i),expression:null}),t}static extractNestedExpression(e,t){let s=1,n=t+1,i=!1,r="",a=!1;for(;n<e.length&&s>0;){const t=e[n],o=n>0?e[n-1]:"";i||'"'!==t&&"'"!==t?i&&t===r&&"\\"!==o&&(i=!1,r=""):(i=!0,r=t),!i&&"`"===t&&"\\"!==o&&(a=!a),!i&&!a&&("{"===t?s++:"}"===t&&s--),n++}if(0===s){return{endIndex:n-1,expression:e.slice(t+1,n-1)}}return{endIndex:-1,expression:""}}static isSingleExpression(t){const s=e.decodeEntities(t),n=e.parseContentWithNesting(s);return 1===n.length&&"expression"===n[0].type?n[0].expression:null}static extractExpressions(t){const s=e.decodeEntities(t);return e.parseContentWithNesting(s).filter((e=>"expression"===e.type)).map((e=>e.expression)).filter((e=>e))}};d(F,"EXPRESSION_CACHE",new oe(1e3)),d(F,"decodeEntities",(e=>{const t=document.createElement("textarea");t.innerHTML=e;let s=t.value;for(;s.includes("&");){t.innerHTML=s;const e=t.value;if(e===s)break;s=e}return s}));let k=F;class Ms{constructor(e,t){d(this,"textNodeBindings",new Map),d(this,"expressionEvaluator"),d(this,"stateManager"),d(this,"componentManager"),d(this,"cleanupObserver"),d(this,"bindingCount",0),this.expressionEvaluator=e,this.stateManager=t,this.cleanupObserver=new MutationObserver((e=>{this.cleanupDetachedNodes(e)})),this.cleanupObserver.observe(document.body,{childList:!0,subtree:!0})}cleanupDetachedNodes(e){for(const t of e)"childList"===t.type&&t.removedNodes.forEach((e=>{if(e.nodeType===Node.TEXT_NODE)this.cleanupTextNode(e);else if(e.nodeType===Node.ELEMENT_NODE){const t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let s;for(;s=t.nextNode();)this.cleanupTextNode(s)}}));const t=[];for(const[e]of this.textNodeBindings)document.contains(e)||t.push(e);t.forEach((e=>this.cleanupTextNode(e)))}processTextNode(e,t){if(this.textNodeBindings.has(e)||C.isTextNodeInsideScript(e)||this.isInsideLoopItem(e))return;const s=e.textContent||"",n=k.parse(s);if(!n.some((e=>"expression"===e.type)))return;const i={originalContent:s,expressions:n,subscriptionIds:[]};n.filter((e=>"expression"===e.type)).forEach((s=>{if(!s.expression)return;const n=`text_${Date.now()}_${Math.random()}`,r=this.expressionEvaluator.extractDependencies(s.expression,t,this.stateManager),a={id:n,selector:"",dependencies:new Set(r),callback:()=>{this.updateTextNode(e)},element:e.parentElement??void 0,component:t};this.stateManager.addSubscription(a),i.subscriptionIds.push(n)})),this.textNodeBindings.set(e,i),this.bindingCount++,this.updateTextNode(e)}isInsideLoopItem(e){var t,s,n;let i=e.parentElement;for(;i&&i!==document.body;){const e=i.previousSibling;if(e&&e.nodeType===Node.COMMENT_NODE&&null!=(t=e.textContent)&&t.startsWith("pp-for:"))return!0;let r=(null==(s=i.parentElement)?void 0:s.firstChild)||null;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&null!=(n=r.textContent)&&n.startsWith("pp-for:")&&r!==i)return!0;r=r.nextSibling}i=i.parentElement}return!1}updateTextNode(e){const t=this.textNodeBindings.get(e);if(!t||!e.parentElement)return;const s=C.getComponentForNode(e),n=this.resolveComponentRootForElement(e,s),i=this.getContextForComponent(s,n);let r="";for(const e of t.expressions)if("static"===e.type)r+=e.content;else if(e.expression)try{r+=N(this.expressionEvaluator.evaluateExpression(e.expression,i,s))}catch(t){const s="object"==typeof t&&null!==t&&"message"in t?t.message:String(t);console.warn(`Text binding evaluation warning for "${e.expression}": ${s}`),r+=""}e.textContent!==r&&(e.textContent=r)}resolveComponentRootForElement(e,t){let s=e.parentElement;for(;s&&s.nodeType===Node.ELEMENT_NODE;){const e=s;if(e.getAttribute(x.ATTR_PREFIXES.COMPONENT)===t)return e;s=s.parentElement}}getContextForComponent(e,t){return this.componentManager?this.componentManager.buildComponentContextWithProps(e,t):{}}cleanupTextNode(e){const t=this.textNodeBindings.get(e);t&&(t.subscriptionIds.forEach((e=>{this.stateManager.removeSubscription(e)})),this.textNodeBindings.delete(e),this.bindingCount=Math.max(0,this.bindingCount-1))}getBindingCount(){return this.textNodeBindings.size}getAllBindings(){return new Map(this.textNodeBindings)}clearAllBindings(){for(const[e]of this.textNodeBindings)this.cleanupTextNode(e)}destroy(){this.cleanupObserver.disconnect(),this.clearAllBindings()}}class Ls{constructor(){d(this,"listeners",new Map)}on(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>this.off(e,t)}off(e,t){var s;null==(s=this.listeners.get(e))||s.delete(t)}emit(e,...t){const s=this.listeners.get(e);s&&s.forEach((s=>{try{s(...t)}catch(t){console.error(`Event listener error for ${e}:`,t)}}))}}class Rs{constructor(){d(this,"stateStore",{}),d(this,"subscriptions",new Map),d(this,"keyIndex",new Map),d(this,"updateQueue",new Set),d(this,"isUpdating",!1),d(this,"eventBus",new Ls),d(this,"contextCache",new Map),d(this,"previousValues",new Map),d(this,"scheduleFlush",Ns((()=>{this.flushUpdates()}),x.DEBOUNCE_MS)),this.setupGlobalStateProxy()}batchStateUpdates(e){const t=this.isUpdating;this.isUpdating=!0;try{return e()}finally{this.isUpdating=t,!this.isUpdating&&this.updateQueue.size>0&&this.scheduleFlush()}}invalidateContextCache(){this.contextCache.clear()}setupGlobalStateProxy(){this.stateStore=new Proxy(this.stateStore,{set:(e,t,s,n)=>{const i=e[t],r=Reflect.set(e,t,s,n);return i!==s&&this.notifySubscribers(t),r},get:(e,t)=>Reflect.get(e,t)})}notifySubscribers(e){if(this.eventBus.emit("stateChanged",e),this.updateQueue.add(e),e.includes(".")){const t=e.split(".")[0];this.updateQueue.add(t)}this.notifyPathBasedSubscribers(e),this.isUpdating||this.scheduleFlush()}notifyPathBasedSubscribers(e){var t;const s=this.stateStore[e],n=null==(t=this.previousValues)?void 0:t.get(e);for(const[t,i]of this.subscriptions)for(const t of i.dependencies)if(this.isPathDependency(t)&&t.startsWith(e+".")){const i=t.substring(e.length+1),r=this.getPathValue(n,i),a=this.getPathValue(s,i);this.deepEqual(r,a)||this.updateQueue.add(t)}}isPathDependency(e){return e.includes(".")&&e.split(".").length>1}getPathValue(e,t){if(!e||"object"!=typeof e)return;const s=t.split(".");let n=e;for(const e of s){if(null==n)return;if(Array.isArray(n))return"length"===e?n.length:n.map((t=>null==t?void 0:t[e])).filter((e=>void 0!==e));n=n[e]}return n}deepEqual(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((e,s)=>this.deepEqual(e,t[s])));if("object"==typeof e&&"object"==typeof t){const s=Object.keys(e),n=Object.keys(t);return s.length===n.length&&s.every((s=>this.deepEqual(e[s],t[s])))}return!1}flushUpdates(){if(!this.isUpdating){this.isUpdating=!0;try{const e=new Set,t=this.keyIndex.get("*");if(t&&t.size>0&&this.updateQueue.size>0)for(const e of Array.from(t)){const t=this.subscriptions.get(e);if(!t)continue;if(t.element&&!document.contains(t.element)){this.removeSubscription(e);continue}const s=t.element??document.body;try{const e=Array.from(this.updateQueue)[0];t.callback(s,{key:e})}catch(e){console.error("Wildcard subscription callback failed:",e)}}for(const t of this.updateQueue){if(e.has(t))continue;e.add(t);const s=this.keyIndex.get(t);if(s)for(const e of Array.from(s)){const s=this.subscriptions.get(e);if(!s)continue;if(s.element&&!document.contains(s.element)){this.removeSubscription(e);continue}const n=s.element??document.body;try{s.callback(n,{key:t})}catch(e){console.error("Subscription callback failed:",e)}}}}finally{this.updateQueue.clear(),this.isUpdating=!1}}}getState(){return this.stateStore}setState(e,t){if(this.previousValues.set(e,this.stateStore[e]),this.stateStore[e]=t,this.previousValues.size>100){const e=this.previousValues.keys().next().value;"string"==typeof e&&this.previousValues.delete(e)}}hasState(e){return e in this.stateStore}addSubscription(e){this.subscriptions.set(e.id,e);for(const t of e.dependencies)this.keyIndex.has(t)||this.keyIndex.set(t,new Set),this.keyIndex.get(t).add(e.id)}removeSubscription(e){var t,s;const n=this.subscriptions.get(e);if(n){for(const i of n.dependencies)null==(t=this.keyIndex.get(i))||t.delete(e),0===(null==(s=this.keyIndex.get(i))?void 0:s.size)&&this.keyIndex.delete(i);this.subscriptions.delete(e)}}onStateChange(e){return this.eventBus.on("stateChanged",e)}batch(e){const t=this.isUpdating;this.isUpdating=!0;try{return e()}finally{this.isUpdating=t,!this.isUpdating&&this.updateQueue.size&&this.flushUpdates()}}getSubscriptions(){return this.subscriptions}getKeyIndex(){return this.keyIndex}}class Os{constructor(){d(this,"expressionCache",new oe(x.MAX_CACHE_SIZE)),d(this,"dependencyCache",new oe(x.MAX_CACHE_SIZE)),d(this,"dependencyParser",new Vs),d(this,"commonExpressions",new Map),this.precompileCommonExpressions()}normalizeExpression(e){return e.replace(/\r\n/g," ").replace(/\r/g," ").replace(/\n/g," ").replace(/\s+/g," ").trim()}precompileCommonExpressions(){["true","false","null","undefined"].forEach((e=>{const t={fn:new Function("return "+e),contextMap:new Map,dependencies:[e],timestamp:Date.now(),hitCount:0};this.commonExpressions.set(e,t)}))}extractDependencies(e,t,s){const n=this.normalizeExpression(e),i=`${t}:${n}`;if(this.dependencyCache.has(i))return this.dependencyCache.get(i);const r=this.dependencyParser.extract(n,t,s);return this.dependencyCache.set(i,r),r}evaluateExpression(e,t,s){const n=this.normalizeExpression(e);if(this.commonExpressions.has(n)){const e=this.commonExpressions.get(n);e.hitCount++;try{return e.fn()}catch(e){return void console.error(`Common expression evaluation failed: "${n}"`,e)}}const i=`${s}:${n}`;let r=this.expressionCache.get(i);(!r||this.isStale(r))&&(r=this.compileExpression(n,t,s),this.expressionCache.set(i,r)),r.hitCount++;try{const e=this.buildArguments(r.contextMap,t);return r.fn(...e)}catch(e){return console.error(`Expression evaluation failed: "${n}"`,e),void console.error("Available context:",Object.keys(t))}}compileExpression(e,t,s){const n=this.prepareSafeContext(t),i=new Map,r=[];Object.keys(n).forEach(((e,t)=>{i.set(e,t),r.push(e)}));const a=this.dependencyParser.extract(e,s);return{fn:new Function(...r,`return (${e})`),contextMap:i,dependencies:a,timestamp:Date.now(),hitCount:0}}buildArguments(e,t){const s=new Array(e.size);for(const[n,i]of e)s[i]=t[n];return s}isStale(e){return Date.now()-e.timestamp>3e5}prepareSafeContext(e){const t={};for(const[s,n]of Object.entries(e))"this"===s||"arguments"===s||"eval"===s||"function"===s||(t[s]=n);return t}invalidateCache(e){if(!e)return this.expressionCache.clear(),this.dependencyCache.clear(),void this.dependencyParser.clearCache();const t=`${e}:`;for(const[e]of this.expressionCache.cache)"string"==typeof e&&e.startsWith(t)&&(this.expressionCache.delete(e),this.dependencyCache.delete(e))}}class Vs{constructor(){d(this,"parseCache",new oe(500))}extract(e,t,s){const n=this.normalizeExpression(e),i=`${t}:${n}`;if(this.parseCache.has(i))return this.parseCache.get(i);const r=this.parseExpression(n,t,s);return this.parseCache.set(i,r),r}normalizeExpression(e){return e.replace(/\r\n/g," ").replace(/\r/g," ").replace(/\n/g," ").replace(/\s+/g," ").trim()}parseExpression(e,t,s){const n=this.extractIdentifiers(e),i=[],r=(null==s?void 0:s.getState())||{};for(const e of n){if(Vt.has(e))continue;const s=e.indexOf("."),n=-1===s?e:e.substring(0,s),a=we.findExistingStateKey(n,t,r);if(a)i.push(a);else{const e="app"===t?[`app.${n}`]:[`${t}.${n}`,`app.${n}`];i.push(...e)}if(-1!==s){const e="app"===t?[`app.${n}`]:[`${t}.${n}`,`app.${n}`];i.push(...e)}}return Array.from(new Set(i))}extractIdentifiers(e){const t=[];let s=0;for(;s<e.length;){const n=e[s];if("'"!==n)if('"'!==n)if("`"!==n)if(this.isIdentifierStart(n)){const n=this.extractIdentifier(e,s);t.push(n.value),s=n.endIndex}else s++;else s=this.skipTemplateLiteral(e,s,t);else s=this.skipString(e,s,'"');else s=this.skipString(e,s,"'")}return t}skipString(e,t,s){let n=t+1;for(;n<e.length&&e[n]!==s;)"\\"===e[n]&&n++,n++;return n+1}skipTemplateLiteral(e,t,s){let n=t+1;for(;n<e.length&&"`"!==e[n];)if("$"===e[n]&&n+1<e.length&&"{"===e[n+1]){n+=2;let t=1;for(;n<e.length&&t>0;){const i=e[n];if('"'!==i&&"'"!==i){if("{"===i?t++:"}"===i&&t--,t>0&&this.isIdentifierStart(i)){const t=this.extractIdentifier(e,n);s.push(t.value),n=t.endIndex-1}n++}else n=this.skipString(e,n,i)}}else"\\"===e[n]&&n++,n++;return n+1}extractIdentifier(e,t){let s=t;for(;s<e.length&&(this.isIdentifierPart(e[s])||"."===e[s]);)s++;return{value:e.substring(t,s),endIndex:s}}isIdentifierStart(e){return/[a-zA-Z_$]/.test(e)}isIdentifierPart(e){return/[a-zA-Z0-9_$]/.test(e)}clearCache(){this.parseCache.clear()}getCacheSize(){return this.parseCache.cache.size}}class Fs{constructor(e){d(this,"componentStack",["app"]),d(this,"contextCache",new oe(100)),d(this,"contextIndex",new Map),d(this,"contextInvalidated",new Set),d(this,"stateManager"),d(this,"processedScripts",new WeakSet),d(this,"componentFunctions",new Map),d(this,"elementProps",new WeakMap),d(this,"expressionEvaluator"),d(this,"domBindingManager"),d(this,"loopManager"),d(this,"templateRenderer"),d(this,"updateTimeouts"),d(this,"updateBatcher",new et),d(this,"propDependencyCache",new Map),this.stateManager=e,this.updateBatcher=new et,this.stateManager.onStateChange((e=>this.invalidateContextCache(e)))}getPropDependencies(e,t){var s;const n=this.findElementWithProps(t);if(!n)return[];const i=this.elementProps.get(n);if(!i||!i.has(e))return[];const r=i.get(e);return(null==(s=this.templateRenderer)?void 0:s.dependencies(r.expression,r.component,this.stateManager))||[]}buildRestrictedComponentContext(e,t=!1){const s={};window[e]&&Object.assign(s,window[e]);const n=this.componentFunctions.get(e);if(n)for(const[e,t]of n)s[e]=t;const i=this.stateManager.getState();for(const t of Object.keys(i))if(t.startsWith(e+".")){const n=t.substring(e.length+1);n in s||(s[n]=i[t])}if(t){if(window.app)for(const[e,t]of Object.entries(window.app))e in s||(s[e]=t);const e=this.componentFunctions.get("app");if(e)for(const[t,n]of e)t in s||(s[t]=n);for(const e of Object.keys(i))if(e.startsWith("app.")){const t=e.substring(4);t in s||(s[t]=i[e])}}return s}getComponentPropDependencies(e,t){if(this.propDependencyCache.has(e))return this.propDependencyCache.get(e);const s=[],n=this.elementProps.get(e);n&&this.templateRenderer&&n.forEach((e=>{var t;const n=null==(t=this.templateRenderer)?void 0:t.dependencies(e.expression,e.component,this.stateManager);s.push(...n??[])}));const i=Array.from(new Set(s));return this.propDependencyCache.set(e,i),i}setDOMBindingManager(e){this.domBindingManager=e,this.updateBatcher.setManagers(this,e)}hasStoredProps(e){return this.elementProps.has(e)&&this.elementProps.get(e).size>0}setExpressionEvaluator(e){this.expressionEvaluator=e,this.templateRenderer=new Ge(e),this.loopManager=new Bt(this.stateManager,e)}extractProps(e,t){const s=new Map,n=e.attributes;for(let e=0;e<n.length;e++){const i=n[e];if(i.name!==x.ATTR_PREFIXES.COMPONENT&&i.value&&Dt.containsMustacheExpression(i.value)){const e=this.attributeToPropName(i.name),n={name:e,expression:i.value,component:t,subscriptionIds:[]};s.set(e,n)}}return s}attributeToPropName(e){return e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase()))}setupProps(e,t){const s=this.extractProps(e,t);0!==s.size&&(this.elementProps.set(e,s),this.expressionEvaluator&&s.forEach(((t,s)=>{this.setupPropBinding(e,t)})))}setupPropBinding(e,t){var s;if(!this.expressionEvaluator)return;const n=`prop_${Date.now()}_${Math.random()}`,i=(null==(s=this.templateRenderer)?void 0:s.dependencies(t.expression,t.component,this.stateManager))||[],r={id:n,selector:"",dependencies:new Set(i),callback:()=>{const t=e.getAttribute(x.ATTR_PREFIXES.COMPONENT);t&&(this.updateBatcher.scheduleUpdate(t,e),this.refreshComponentBindings(e,t))},element:e,component:t.component};this.stateManager.addSubscription(r),t.subscriptionIds.push(n)}refreshComponentBindings(e,t){this.contextInvalidated.add(t),this.contextCache.delete(t),this.domBindingManager&&this.domBindingManager.refreshComponentElement(e,t)}evaluateProps(e){const t={},s=this.elementProps.get(e);if(!s||!this.expressionEvaluator)return t;const n=s.values().next().value;if(!n)return t;const i=this.buildComponentContext(n.component);return s.forEach(((e,s)=>{var n;try{const r=null==(n=this.templateRenderer)?void 0:n.render(e.expression,i,e.component);t[s]="function"==typeof r?(...e)=>r.apply(this,e):r}catch(e){console.error(`❌ Failed to evaluate prop "${s}":`,e),t[s]=void 0}})),t}cleanupProps(e){const t=this.elementProps.get(e);t&&(t.forEach((e=>{e.subscriptionIds.forEach((e=>{this.stateManager.removeSubscription(e)}))})),this.elementProps.delete(e))}buildComponentContextWithProps(e,t){const s=this.buildComponentContext(e);let n=this.findElementWithProps(e);if(t&&this.elementProps.has(t)&&(n=t),n)try{const i=this.evaluatePropsWithContext(n,e,t);Object.keys(i).length>0&&Object.keys(i).forEach((e=>{s[e]=i[e]}))}catch(t){console.error(`❌ Error evaluating props for ${e}:`,t)}return s}evaluatePropsWithContext(e,t,s){var n;const i={},r=this.elementProps.get(e);if(!r||!this.expressionEvaluator)return i;const a=r.values().next().value;if(!a)return i;let o=this.buildComponentContext(a.component);const c=null==(n=this.loopManager)?void 0:n.getLoopContextForElement(e);return c&&(o={...o,...c}),r.forEach(((e,t)=>{var s;try{const n=null==(s=this.templateRenderer)?void 0:s.render(e.expression,o,e.component);"function"==typeof n?this.isFunctionExplicitlyPassed(e.expression)?i[t]=(...e)=>n.apply(this,e):(console.warn(`⚠️ Function "${t}" not passed - not from shared namespace or explicitly passed`),i[t]=void 0):i[t]=n}catch(e){console.error(`❌ Failed to evaluate prop "${t}":`,e),i[t]=void 0}})),i}isFunctionExplicitlyPassed(e){const t=k.isSingleExpression(e);return!!t&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t.trim())}findElementWithProps(e){const t=document.querySelectorAll(`[${x.ATTR_PREFIXES.COMPONENT}="${e}"]`);for(const e of t){const t=this.elementProps.get(e);if(t&&t.size>0)return e}return null}pushComponent(e){this.componentStack.push(e)}popComponent(){return this.componentStack.pop()}getCurrentComponent(){return this.componentStack[this.componentStack.length-1]}buildComponentContext(e){if(!this.contextInvalidated.has(e)&&this.contextCache.has(e))return this.contextCache.get(e);const t=this.computeComponentContext(e);return this.contextCache.set(e,t),this.contextInvalidated.delete(e),t}computeComponentContext(e){const t={};"app"!==e&&window[e]&&Object.assign(t,window[e]),"app"===e&&window.app&&Object.assign(t,window.app);const s=this.componentFunctions.get(e);if(s)for(const[e,n]of s)t[e]=n;if("app"===e){const e=this.componentFunctions.get("app");if(e)for(const[s,n]of e)s in t||(t[s]=n)}const n=this.stateManager.getState();for(const s of Object.keys(n))if(s.startsWith(e+".")){const i=s.substring(e.length+1);i in t||(t[i]=n[s])}return t}invalidateContextCache(e){if(e.startsWith("app.")){for(const e of this.contextCache.cache.keys())this.invalidateComponent(e);return}const t=e.indexOf(".");if(-1!==t){const s=e.slice(0,t);this.invalidateComponent(s)}}invalidateComponent(e){this.contextInvalidated.add(e),this.contextIndex.delete(e)}executePhpScripts(e){const t=this.componentStack.length,s=e.getAttribute(x.ATTR_PREFIXES.COMPONENT),n=e===document.body;if(s||n){if(s){this.pushComponent(s);const t=this.getParentComponent(e);this.setupProps(e,t)}this.getRelevantScripts(e,n).forEach((e=>{const t=e.getAttribute(x.ATTR_PREFIXES.COMPONENT);t&&t!==s?(this.pushComponent(t),this.executeScript(e),this.popComponent()):this.executeScript(e)}))}for(Array.from(e.children).forEach((e=>this.executePhpScripts(e)));this.componentStack.length>t;)this.popComponent();document.body.hidden=!1}getParentComponent(e){let t=e.parentElement;for(;t;){const e=t.getAttribute(x.ATTR_PREFIXES.COMPONENT);if(e)return e;t=t.parentElement}return"app"}getRelevantScripts(e,t){return Array.from(e.querySelectorAll(`script[type="${x.SCRIPT_TYPE}"]`)).filter((s=>{if(this.processedScripts.has(s))return!1;if(t)return!!s.hasAttribute(x.ATTR_PREFIXES.COMPONENT)||!s.closest(`[${x.ATTR_PREFIXES.COMPONENT}]`);let n=s.parentElement;for(;n&&n!==e;){if(n.hasAttribute(x.ATTR_PREFIXES.COMPONENT))return!1;n=n.parentElement}return n===e||e.contains(s)}))}executeScript(e){if(this.processedScripts.has(e))return;this.processedScripts.add(e);const t=this.getCurrentComponent(),s=e.textContent||"",n=k.decodeEntities(s);try{const s=this.findComponentElementForScript(e,t);if(s===e){const t=this.getParentComponent(e);this.setupProps(e,t)}const i=this.buildComponentContextWithProps(t,s);window[t]||(window[t]={}),this.executeScriptFunctions(n,t,i)}catch(e){console.error(`Script execution failed in component ${t}:`,e),console.error("Script content:",n)}}findComponentElementForScript(e,t){if(e.getAttribute(x.ATTR_PREFIXES.COMPONENT)===t)return e;let s=e.parentElement;for(;s;){if(s.getAttribute(x.ATTR_PREFIXES.COMPONENT)===t)return s;s=s.parentElement}const n=document.querySelectorAll(`[${x.ATTR_PREFIXES.COMPONENT}="${t}"]`);for(const e of n)if(this.elementProps.has(e))return e;return n[0]||void 0}executeScriptFunctions(e,t,s){const n=this.extractFunctionNames(e),i=this.findElementWithProps(t),r=this.extractVariableDeclarations(e);let a={...s};if(r.forEach((e=>{delete a[e];const t=`set${Ft(e)}`,s=`${e}Getter`;delete a[t],delete a[s]})),i){const e=this.evaluateProps(i);Object.assign(a,e)}a.getContext=()=>this.buildComponentContextWithProps(t),a.withContext=e=>{const s=this.buildComponentContextWithProps(t);return e.call(s,s)},a.__getProp=e=>{if(i)return this.evaluateProps(i)[e]};let o=de.getInstance().transformStateDeclarations(e);o=this.modifyScriptForReactiveProps(o,t,i||void 0);const c=`\n ${o}\n\n ${n.map((e=>`\n if (typeof ${e} === 'function') {\n this['${e}'] = ${e};\n }\n `)).join("\n")}\n `,p=Object.keys(a),h=p.map((e=>a[e]));if(this.checkIfInLoopItem()){const e=this.extractLoopItemContext();this.domBindingManager.stateManager.currentLoopContext=e}try{new Function(...p,c).call(window[t],...h),window[t].getContext=a.getContext,window[t].withContext=a.withContext,window[t].__getProp=a.__getProp;for(const e of n){const s=window[t][e];"function"==typeof s&&this.storeFunctionForComponent(t,e,s)}this.invalidateComponent(t)}catch(s){console.error("Script execution failed:",s),console.error("Component:",t),console.error("Original script:",e),console.error("Processed script:",o),console.error("Execution context keys:",Object.keys(a))}finally{this.domBindingManager.stateManager.currentLoopContext=null}}checkIfInLoopItem(){return!1}extractLoopItemContext(){return{}}extractVariableDeclarations(e){const t=de.getInstance().extractStateDeclarations(e).map((e=>e.variableName)),s=[],n=/(?:const|let|var)\s*\[\s*([^,\]]+)(?:\s*,\s*([^,\]]+))?\s*\]/g;let i;for(;null!==(i=n.exec(e));)i[1]&&!t.includes(i[1].trim())&&s.push(i[1].trim()),i[2]&&!t.includes(i[2].trim())&&s.push(i[2].trim());const r=/(?:const|let|var)\s+([a-zA-Z_$][\w$]*)/g;for(;null!==(i=r.exec(e));)t.includes(i[1])||s.push(i[1]);return[...t,...s]}modifyScriptForReactiveProps(e,t,s){if(!s||!this.elementProps.has(s))return e;const n=this.elementProps.get(s),i=Array.from(n.keys());let r=e;return i.forEach((e=>{r=this.replacePropOutsideStrings(r,e)})),r}replacePropOutsideStrings(e,t){let s="",n=0;const i=e.length;for(;n<i;){const r=e[n];if("'"!==r)if('"'!==r)if("`"!==r){if("/"===r&&n+1<i){if("/"===e[n+1]){const t=e.indexOf("\n",n),r=-1===t?i:t;s+=e.slice(n,r),n=r;continue}if("*"===e[n+1]){const t=e.indexOf("*/",n+2),r=-1===t?i:t+2;s+=e.slice(n,r),n=r;continue}}this.matchesPropName(e,n,t)?(s+=`__getProp('${t}')`,n+=t.length):(s+=r,n++)}else{const t=this.findTemplateEnd(e,n);s+=e.slice(n,t+1),n=t+1}else{const t=this.findStringEnd(e,n,'"');s+=e.slice(n,t+1),n=t+1}else{const t=this.findStringEnd(e,n,"'");s+=e.slice(n,t+1),n=t+1}}return s}findStringEnd(e,t,s){let n=t+1;for(;n<e.length;){if(e[n]===s&&"\\"!==e[n-1])return n;"\\"===e[n]&&n++,n++}return e.length-1}findTemplateEnd(e,t){let s=t+1,n=0;for(;s<e.length;){const t=e[s];if("`"===t&&0===n)return s;"$"===t&&s+1<e.length&&"{"===e[s+1]?(n++,s++):"}"===t&&n>0?n--:"\\"===t&&s++,s++}return e.length-1}matchesPropName(e,t,s){if(t+s.length>e.length||e.substr(t,s.length)!==s)return!1;const n=t>0?e[t-1]:"",i=t+s.length<e.length?e[t+s.length]:"",r=0===t||!/[a-zA-Z0-9_$]/.test(n),a=t+s.length===e.length||!/[a-zA-Z0-9_$]/.test(i);if(!r||!a)return!1;const o=e.slice(t+s.length);return!/^\s*[=:]/.test(o)}extractFunctionNames(e){return de.getInstance().extractFunctionNames(e)}storeFunctionForComponent(e,t,s){this.componentFunctions.has(e)||this.componentFunctions.set(e,new Map),this.componentFunctions.get(e).set(t,s),window[e]||(window[e]={}),window[e][t]=s}getComponentFunctions(e){return this.componentFunctions.get(e)}destroy(){if(this.updateTimeouts){for(const e of this.updateTimeouts.values())clearTimeout(e);this.updateTimeouts.clear()}}}class Ds{constructor(e,t,s){d(this,"stateManager"),d(this,"componentManager"),d(this,"expressionEvaluator"),d(this,"textNodeManager"),d(this,"observer"),d(this,"listeners",new WeakMap),d(this,"pendingBindings",[]),d(this,"pendingTextNodes",[]),d(this,"applyingUpdates",!1),d(this,"elementCache",new WeakMap),d(this,"batchedUpdates",new Set),d(this,"processingRAF",null),d(this,"updateQueue",new Map),d(this,"eventDelegation",new Be),d(this,"processedElements",new WeakSet),d(this,"loopManager"),d(this,"templateRenderer"),d(this,"isRelevantMutation",(e=>{if(this.applyingUpdates&&"attributes"===e.type)return!1;if("childList"===e.type||"characterData"===e.type)return!0;if("attributes"===e.type){const t=e.attributeName;return t===x.ATTR_PREFIXES.COMPONENT||null!==t&&he.isEventAttribute(t)}return!1})),this.stateManager=e,this.componentManager=t,this.expressionEvaluator=s,this.textNodeManager=new Ms(s,e),this.textNodeManager.componentManager=this.componentManager,this.componentManager.setDOMBindingManager(this),this.setupMutationObserver(),this.eventDelegation.setupEventDelegation(),this.loopManager=new Bt(e,s),this.loopManager.setDependencies(t,this),this.loopManager.eventDelegation=this.eventDelegation,this.eventDelegation.setDependencies(this.componentManager,this.expressionEvaluator,this.loopManager),this.templateRenderer=new Ge(s)}refreshComponentElement(e,t){this.elementCache.delete(e),this.processedElements.delete(e);const s=[...this.componentManager.componentStack];this.componentManager.componentStack=["app"],"app"!==t&&this.componentManager.componentStack.push(t);try{const s=this.componentManager.buildComponentContextWithProps(t,e);this.processElementInContext(e,s,t,!0),this.walkComponentChildren(e,t),this.refreshComponentTextNodes(e,t)}finally{this.componentManager.componentStack=s}}refreshComponentTextNodes(e,t){const s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:e=>{const s=e;return!s.textContent||!x.MUSTACHE_PATTERN.test(s.textContent)||C.isTextNodeInsideScript(s)||this.isTextNodeInsideLoopItem(s)||C.getComponentForNode(s)!==t?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let n;const i=[];for(;n=s.nextNode();)i.push(n);i.forEach((e=>{this.textNodeManager.cleanupTextNode(e),this.textNodeManager.cleanupTextNode(e),this.textNodeManager.processTextNode(e,t)}))}walkComponentChildren(e,t){const s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const n=s;return C.getElementComponent(n)!==t?NodeFilter.FILTER_REJECT:n===e?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});let n;const i=[];for(;n=s.nextNode();){const e=n;i.push(e)}i.forEach((s=>{this.elementCache.delete(s),this.processedElements.delete(s);const n=this.componentManager.buildComponentContextWithProps(t,e);this.processElementInContext(s,n,t,!0)}))}createSpreadDirectiveBinding(e,t,s){const n=`spread_${Date.now()}_${Math.random()}`,i=k.parseSpreadDirective(t);if(0===i.spreads.length&&0===i.objects.length)return void console.warn(`Invalid pp-spread directive: ${t}`);const r=new Set,a=()=>{if(document.contains(e))try{const t=this.componentManager.buildComponentContextWithProps(s,e);this.clearSpreadAttributes(e,r);for(const n of i.spreads){const i=this.expressionEvaluator.evaluateExpression(n,t,s);i&&"object"==typeof i&&this.applySpreadObject(e,i,r)}for(const n of i.objects)this.applyObjectProperties(e,n,t,s,r)}catch(e){console.error(`Spread directive evaluation error for "${t}":`,e)}else this.stateManager.removeSubscription(n)},o=new Set;for(const e of i.spreads)this.templateRenderer.dependencies(e,s,this.stateManager).forEach((e=>o.add(e)));for(const e of i.objects)for(const t of e)this.templateRenderer.dependencies(t.value,s,this.stateManager).forEach((e=>o.add(e)));const c={id:n,selector:"",dependencies:o,callback:a,element:e,component:s};this.stateManager.addSubscription(c),this.storeSpreadSubscription(e,n),a()}applyObjectProperties(e,t,s,n,i){for(const r of t)try{const t=this.expressionEvaluator.evaluateExpression(r.value,s,n);if(this.isEventProperty(r.key)){this.handleSpreadEventProperty(e,r.key,t);continue}const a=this.normalizeAttributeName(r.key);this.updateElementProperty(e,a,t),i.add(a)}catch(e){console.error(`Error evaluating object property "${r.key}: ${r.value}":`,e)}}applySpreadObject(e,t,s){for(const[n,i]of Object.entries(t))if(null!=i){if(this.isEventProperty(n)){this.handleSpreadEventProperty(e,n,i);continue}const t=this.normalizeAttributeName(n);(!e.hasAttribute(t)||s.has(t))&&(this.updateElementProperty(e,t,i),s.add(t))}}isEventProperty(e){return e.startsWith("on")&&e.length>2}handleSpreadEventProperty(e,t,s){const n=t.substring(2).toLowerCase();if("function"==typeof s){const t=t=>{var n;try{const i=C.getContextComponent(e),r=(null==(n=this.componentManager)?void 0:n.buildComponentContextWithProps(i,e))||{};s.call(r,t)}catch(e){console.error("Spread event handler error:",e)}};return e.addEventListener(n,t),void this.storeDirectEventListener(e,n,t)}if("string"==typeof s){const t=C.getContextComponent(e);this.eventDelegation.registerEventHandler(e,n,s,t)}}storeDirectEventListener(e,t,s){e.__directEventListeners||(e.__directEventListeners=[]),e.__directEventListeners.push({eventType:t,listener:s})}clearSpreadAttributes(e,t){for(const s of t)e.hasAttribute(s)&&e.removeAttribute(s);t.clear()}normalizeAttributeName(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}storeSpreadSubscription(e,t){e.__spreadSubscriptions||(e.__spreadSubscriptions=[]),e.__spreadSubscriptions.push(t)}setupMutationObserver(){this.observer=new MutationObserver((e=>{const t=e.filter(this.isRelevantMutation);0!==t.length&&this.processMutationsBatch(t)})),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0,attributeFilter:[x.ATTR_PREFIXES.COMPONENT]})}processElement(e,t=!0){if(e===document.body){const s=Array.from(document.querySelectorAll(`[${x.ATTR_PREFIXES.COMPONENT}]`)).sort(((e,t)=>C.getElementDepth(e)-C.getElementDepth(t)));this.processElementsBatch([e],t),s.forEach((e=>{this.processElementsBatch([e],t)})),t&&this.loopManager.processPendingTemplates()}else this.processElementsBatch([e],t)}processElementsBatch(e,t=!0){for(const s of e)this.processSingleElement(s,t);t&&(e.forEach((e=>{this.componentManager.executePhpScripts(e)})),this.processPendingBindings())}processSingleElement(e,t){const s=C.getElementComponent(e),n=C.getParentComponentForElement(e),i=this.componentManager.componentStack.length;"app"!==s&&(this.componentManager.pushComponent(s),this.componentManager.setupProps(e,n)),t&&this.componentManager.executePhpScripts(e),this.processLoopTemplates(e,s);const r=t?this.componentManager.buildComponentContextWithProps(s,e):{};for(this.processElementInContext(e,r,s,t),this.walkDOM(e,r,s,t);this.componentManager.componentStack.length>i;)this.componentManager.popComponent()}processLoopTemplates(e,t){this.getDirectComponentTemplates(e,t).forEach((e=>{this.loopManager.queueTemplate(e,t)}))}getDirectComponentTemplates(e,t){const s=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:t=>{const s=t;return s!==e&&s.hasAttribute(x.ATTR_PREFIXES.COMPONENT)?NodeFilter.FILTER_REJECT:"TEMPLATE"===s.tagName&&s.hasAttribute("pp-for")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let i;for(;i=n.nextNode();)s.push(i);return s}walkDOM(e,t,s,n){const i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,{acceptNode:t=>{if(t.nodeType===Node.ELEMENT_NODE){const n=t;if("script"===n.tagName.toLowerCase()||this.loopManager.isLoopItem(n))return NodeFilter.FILTER_REJECT;let i=n.parentElement;for(;i&&i!==e;){if(this.loopManager.isLoopItem(i))return NodeFilter.FILTER_REJECT;i=i.parentElement}const r=C.getElementComponent(n);if(n===e)return NodeFilter.FILTER_ACCEPT;if(r!==s)return NodeFilter.FILTER_REJECT}else if(t.nodeType===Node.TEXT_NODE){const e=t;if(C.isTextNodeInsideScript(e)||this.isTextNodeInsideLoopItem(e)||C.getComponentForNode(e)!==s)return NodeFilter.FILTER_REJECT}return NodeFilter.FILTER_ACCEPT}});let r;const a=[],o=[];for(;r=i.nextNode();)if(r.nodeType===Node.TEXT_NODE){const e=r;e.textContent&&x.MUSTACHE_PATTERN.test(e.textContent)&&C.getComponentForNode(e)===s&&a.push(e)}else if(r.nodeType===Node.ELEMENT_NODE){const e=r;this.loopManager.isLoopItem(e)||C.getElementComponent(e)===s&&!this.processedElements.has(e)&&(o.push(e),this.processedElements.add(e))}a.forEach((e=>{n?this.textNodeManager.processTextNode(e,s):this.pendingTextNodes.push({textNode:e,component:s})})),o.forEach((e=>{this.processElementInContext(e,t,s,n)}))}isTextNodeInsideLoopItem(e){let t=e.parentElement;for(;t&&t!==document.body;){if(this.loopManager.isLoopItem(t))return!0;t=t.parentElement}return!1}processElementInContext(e,t,s,n){if(e.hasAttribute(x.ATTR_PREFIXES.SPREAD)){const t=e.getAttribute(x.ATTR_PREFIXES.SPREAD);n&&this.createSpreadDirectiveBinding(e,t,s),e.removeAttribute(x.ATTR_PREFIXES.SPREAD)}if(this.loopManager.isLoopItem(e)||this.isElementInLoopItem(e))return;const i=this.extractDomMustacheBindings(e),r=this.elementCache.get(e),a=this.getElementHash(e);if(r&&r.hash===a&&this.isCacheValid(r)&&n)return void this.applyBindingsFromCache(e,r,t);const o={bindings:i,component:s,listeners:[],lastProcessed:Date.now(),hash:a};n?this.applyBindings(e,i,t,s):i.forEach(((t,n)=>{this.pendingBindings.push({element:e,property:n,expression:t,component:s})})),this.setupEventBindings(e,s),this.elementCache.set(e,o)}isElementInLoopItem(e){let t=e;for(;t;){if(this.loopManager.isLoopItem(t))return!0;t=t.parentElement}return!1}extractDomMustacheBindings(e){const t=new Map,s=e.attributes;for(let n=0;n<s.length;n++){const i=s[n];if(i.name===x.ATTR_PREFIXES.COMPONENT||he.isEventAttribute(i.name))continue;const r=e.hasAttribute(x.ATTR_PREFIXES.COMPONENT);if(!(r&&i.value&&Dt.containsMustacheExpression(i.value))&&!r&&i.value){const e=x.MUSTACHE_PATTERN.test(i.value),s=k.decodeEntities(i.value),n=x.MUSTACHE_PATTERN.test(s);(e||n)&&t.set(i.name,i.value)}}return t}applyBindings(e,t,s,n){t.forEach(((t,s)=>{this.createMustacheBinding(e,s,t)})),this.setupEventBindings(e,n)}applyBindingsFromCache(e,t,s){t.bindings.forEach(((s,n)=>{try{const i=this.componentManager.buildComponentContextWithProps(t.component,e),r=this.templateRenderer.render(s,i,t.component);this.updateElementProperty(e,n,r)}catch(e){console.error(`Cached binding evaluation error for "${s}":`,e)}}))}createMustacheBinding(e,t,s){const n=`mustache_${Date.now()}_${Math.random()}`,i=this.componentManager.getCurrentComponent(),r=new Set;this.templateRenderer.dependencies(s,i,this.stateManager).forEach((e=>r.add(e)));const a=()=>{if(document.contains(e))try{const n=this.componentManager.buildComponentContextWithProps(i,e),r=this.templateRenderer.render(s,n,i);this.scheduleElementUpdate(e,t,r)}catch(e){console.error(`Mustache binding evaluation error for "${s}":`,e)}else this.stateManager.removeSubscription(n)},o={id:n,selector:"",dependencies:r,callback:a,element:e,component:i};this.stateManager.addSubscription(o),this.setupTwoWayBindingIfNeeded(e,t,s,i),a()}setupEventBindings(e,t){for(let t=0;t<e.attributes.length;t++){const s=e.attributes[t];if(he.isEventAttribute(s.name)){const t=s.name.substring(2),n=C.getContextComponent(e);this.eventDelegation.registerEventHandler(e,t,s.value,n),e.removeAttribute(s.name)}}}setupTwoWayBindingIfNeeded(e,t,s,n){const i=k.isSingleExpression(s);i&&("value"===t&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)?this.setupTwoWayBinding(e,i,n):"checked"===t&&e instanceof HTMLInputElement&&("checkbox"===e.type||"radio"===e.type)&&this.setupTwoWayBinding(e,i,n,!0))}setupTwoWayBinding(e,t,s,n=!1){const i=this.findStateTarget(t,s);if(!i)return;const r=()=>{try{const t=n?e.checked:e.value,s=n?!!t:t;if(!i.tailPath)return void this.stateManager.setState(i.fullRoot,s);const r=this.stateManager.getState()[i.fullRoot],a=r&&"object"==typeof r?{...r}:{};this.setPath(a,i.tailPath,s),this.stateManager.setState(i.fullRoot,a)}catch(e){console.error("Two-way binding error:",e)}},a=n?"change":"input";e.addEventListener(a,r);const o=this.listeners.get(e)||[];o.push({type:a,fn:r}),this.listeners.set(e,o)}findStateTarget(e,t){const s=e.match(/^([a-zA-Z_$][\w$]*(?:\.[\w$]+)*)$/);if(!s)return null;const[n,...i]=s[1].split("."),r=we.findExistingStateKey(n,t,this.stateManager.getState());return r?{fullRoot:r,tailPath:i.join(".")}:null}setPath(e,t,s){if(!t)return;const n=t.split("."),i=n.pop();let r=e;for(const e of n)r=r[e]=r[e]||{};r[i]=s}scheduleElementUpdate(e,t,s){this.updateQueue.has(e)||(this.updateQueue.set(e,new Set),this.batchedUpdates.add(e)),this.updateQueue.get(e).add(t),this.processingRAF||(this.processingRAF=requestAnimationFrame((()=>{this.processBatchedElementUpdates()}))),e[`__pending_${t}`]=s}processBatchedElementUpdates(){this.applyingUpdates=!0;try{for(const e of this.batchedUpdates){const t=this.updateQueue.get(e);if(t)for(const s of t){const t=e[`__pending_${s}`];this.updateElementProperty(e,s,t),delete e[`__pending_${s}`]}}}finally{this.batchedUpdates.clear(),this.updateQueue.clear(),this.processingRAF=null,this.applyingUpdates=!1}}updateElementProperty(e,t,s){try{switch(t){case"textContent":const n=N(s);e.textContent!==n&&(e.textContent=n);break;case"innerHTML":const i=N(s);e.innerHTML!==i&&(e.innerHTML=i);break;case"value":if(e instanceof HTMLOptionElement){const t=N(s);e.value!==t&&(e.value=t,e.setAttribute("value",t));break}if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement){const t=N(s);e.value!==t&&(e.value=t)}break;case"selectedIndex":if(e instanceof HTMLSelectElement){const t=Number(s);e.selectedIndex!==t&&(e.selectedIndex=t)}break;case"checked":case"disabled":case"hidden":case"readonly":case"required":case"multiple":case"selected":case"autofocus":case"autoplay":case"controls":case"defer":case"loop":case"muted":case"open":case"reversed":case"async":case"default":case"formnovalidate":case"novalidate":case"allowfullscreen":case"capture":case"itemscope":if(e instanceof HTMLElement){const n=!!s;e[t]!==n&&(e[t]=n)}break;case"indeterminate":if(e instanceof HTMLInputElement&&"checkbox"===e.type){const t=!!s;e.indeterminate!==t&&(e.indeterminate=t)}break;case"class":const r=N(s);e.className!==r&&(e.className=r);break;case"htmlFor":case"for":if(e instanceof HTMLLabelElement){const t=N(s);e.htmlFor!==t&&(e.htmlFor=t)}break;case"style":if(e instanceof HTMLElement)if("object"==typeof s&&s&&!Array.isArray(s))Object.assign(e.style,s);else{const t=N(s);e.style.cssText!==t&&(e.style.cssText=t)}break;case"tabIndex":if(e instanceof HTMLElement){const t=null==s?-1:Number(s);e.tabIndex!==t&&(e.tabIndex=t)}break;case"contentEditable":if(e instanceof HTMLElement){const t=!0===s?"true":!1===s?"false":String(s);e.contentEditable!==t&&(e.contentEditable=t)}break;case"draggable":if(e instanceof HTMLElement){const t=!0===s?"true":"false";e.draggable.toString()!==t&&(e.draggable=!0===s),e.getAttribute("draggable")!==t&&e.setAttribute("draggable",t)}break;case"spellcheck":if(e instanceof HTMLElement){const t=!0===s?"true":"false";e.spellcheck!==!!s&&(e.spellcheck=!!s),e.getAttribute("spellcheck")!==t&&e.setAttribute("spellcheck",t)}break;case"src":case"href":case"action":case"alt":case"title":case"placeholder":case"id":case"name":case"type":case"method":case"target":case"rel":case"pattern":case"accept":case"autocomplete":case"enctype":case"wrap":case"download":case"ping":case"referrerpolicy":case"crossorigin":case"integrity":case"loading":case"decoding":case"srcset":case"sizes":case"dir":case"lang":case"translate":case"role":const a=N(s);e.getAttribute(t)!==a&&(null==s?e.removeAttribute(t):e.setAttribute(t,a));break;case"min":case"max":case"step":case"maxLength":case"minLength":case"size":case"rows":case"cols":case"rowSpan":case"colSpan":if(e instanceof HTMLElement){const n=String(s);e.getAttribute(t)!==n&&(null==s?e.removeAttribute(t):e.setAttribute(t,n))}break;default:if(t.startsWith("aria-")){const n=N(s);e.getAttribute(t)!==n&&(null==s||!1===s?e.removeAttribute(t):e.setAttribute(t,n));break}if(t.startsWith("data-")){const n=N(s);e.getAttribute(t)!==n&&(null==s?e.removeAttribute(t):e.setAttribute(t,n));break}const o=N(s);e.getAttribute(t)!==o&&(null==s||!1===s?e.removeAttribute(t):e.setAttribute(t,o))}}catch(s){console.error(`Failed to update property "${t}" on element:`,e,s)}}processPendingBindings(){const e=[...this.pendingBindings];this.pendingBindings=[];const t=new Map;for(const s of e)t.has(s.component)||t.set(s.component,[]),t.get(s.component).push(s);for(const[e,s]of t){const t=[...this.componentManager.componentStack];this.componentManager.componentStack="app"!==e?["app",e]:["app"];for(const t of s)try{if(!document.contains(t.element))continue;this.createMustacheBinding(t.element,t.property,t.expression)}catch(t){console.error(`❌ Failed to create binding for ${e}:`,t)}this.componentManager.componentStack=t}this.processTextNodesPending()}processTextNodesPending(){const e=new Map;for(const t of this.pendingTextNodes)e.has(t.component)||e.set(t.component,[]),e.get(t.component).push(t);this.pendingTextNodes=[];for(const[t,s]of e){const e=[...this.componentManager.componentStack];this.componentManager.componentStack="app"!==t?["app",t]:["app"];for(const{textNode:e,component:t}of s)if(document.contains(e))try{this.textNodeManager.processTextNode(e,t)}catch(e){console.error(`❌ Failed to process text node for ${t}:`,e)}this.componentManager.componentStack=e}}processMutationsBatch(e){const t=new Set,s=new Set,n=new Set,i=new Set;for(const r of e)if("childList"===r.type&&(r.addedNodes.forEach((e=>{if(e.nodeType===Node.ELEMENT_NODE)t.add(e);else if(e.nodeType===Node.TEXT_NODE){const t=e;t.textContent&&x.MUSTACHE_PATTERN.test(t.textContent)&&i.add(t)}})),r.removedNodes.forEach((e=>{e.nodeType===Node.ELEMENT_NODE?s.add(e):e.nodeType===Node.TEXT_NODE&&this.textNodeManager.cleanupTextNode(e)}))),"attributes"===r.type&&r.target&&n.add(r.target),"characterData"===r.type&&r.target){const e=r.target;e.textContent&&x.MUSTACHE_PATTERN.test(e.textContent)&&i.add(e)}s.size>0&&this.cleanupElementsBatch(Array.from(s)),t.size>0&&this.processElementsBatch(Array.from(t)),i.size>0&&this.processTextNodesBatch(Array.from(i)),n.size>0&&this.rebindChangedElements(Array.from(n))}processTextNodesBatch(e){const t=new Map;for(const s of e){const e=C.getComponentForNode(s);t.has(e)||t.set(e,[]),t.get(e).push(s)}for(const[e,s]of t)s.forEach((t=>{this.textNodeManager.processTextNode(t,e)}))}rebindChangedElements(e){e.forEach((e=>{this.processElementBindings(e,!0)}))}processElementBindings(e,t=!0){const s=this.extractDomMustacheBindings(e),n=C.getElementComponent(e);s.forEach(((s,i)=>{t?this.createMustacheBinding(e,i,s):this.pendingBindings.push({element:e,property:i,expression:s,component:n})})),t&&this.setupEventBindings(e,n)}cleanupElementsBatch(e){e.forEach((e=>this.cleanupElement(e)))}cleanupElement(e){const t=this.listeners.get(e)||[];for(const{type:s,fn:n}of t)e.removeEventListener(s,n);this.listeners.delete(e),this.elementCache.delete(e),this.processedElements.delete(e),this.componentManager.cleanupProps(e),this.cleanupSubscriptions(e);const s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let n;for(;n=s.nextNode();)this.textNodeManager.cleanupTextNode(n);"TEMPLATE"===e.tagName&&e.hasAttribute("pp-for")&&this.loopManager.cleanupTemplate(e),e.querySelectorAll("template[pp-for]").forEach((e=>{this.loopManager.cleanupTemplate(e)}));const i=e.__directEventListeners;i&&(i.forEach((({eventType:t,listener:s})=>{e.removeEventListener(t,s)})),delete e.__directEventListeners);const r=e.__spreadEventHandlers;r&&(r.forEach((e=>{window.__spreadHandlers&&window.__spreadHandlers.delete(e)})),delete e.__spreadEventHandlers)}cleanupSubscriptions(e){const t=[];for(const[s,n]of this.stateManager.getSubscriptions())(n.element===e||n.element&&e.contains(n.element)||n.element&&!document.contains(n.element))&&t.push(s);t.forEach((e=>this.stateManager.removeSubscription(e)))}getElementHash(e){const t=[];for(let s=0;s<e.attributes.length;s++){const n=e.attributes[s];(n.name===x.ATTR_PREFIXES.COMPONENT||he.isEventAttribute(n.name)||n.value&&x.MUSTACHE_PATTERN.test(n.value))&&t.push(`${n.name}=${n.value}`)}return t.sort().join("|")}isCacheValid(e){return Date.now()-e.lastProcessed<3e4}refreshAllBindings(){this.elementCache=new WeakMap,this.processedElements=new WeakSet,this.processElement(document.body,!0)}destroy(){this.observer&&this.observer.disconnect(),this.eventDelegation.cleanup(),this.batchedUpdates.clear(),this.updateQueue.clear(),this.processingRAF&&cancelAnimationFrame(this.processingRAF),this.elementCache=new WeakMap,this.listeners=new WeakMap,this.processedElements=new WeakSet,this.loopManager.destroy()}}const G=class e{constructor(){d(this,"delegatedEvents",new Map),d(this,"elementHandlers",new WeakMap),d(this,"handlerCache",new oe(200)),d(this,"componentManager"),d(this,"expressionEvaluator"),d(this,"loopManager")}static getAllAvailableEvents(){if(e.eventCache)return e.eventCache;const t=new Set;try{Object.getOwnPropertyNames(HTMLElement.prototype).filter((e=>e.startsWith("on")&&e.length>2)).map((e=>e.substring(2).toLowerCase())).forEach((e=>t.add(e)))}catch(e){console.warn("Could not get HTMLElement events:",e)}try{Object.getOwnPropertyNames(Document.prototype).filter((e=>e.startsWith("on")&&e.length>2)).map((e=>e.substring(2).toLowerCase())).forEach((e=>t.add(e)))}catch(e){console.warn("Could not get Document events:",e)}try{Object.getOwnPropertyNames(Window.prototype).filter((e=>e.startsWith("on")&&e.length>2)).map((e=>e.substring(2).toLowerCase())).forEach((e=>t.add(e)))}catch(e){console.warn("Could not get Window events:",e)}try{Object.getOwnPropertyNames(Element.prototype).filter((e=>e.startsWith("on")&&e.length>2)).map((e=>e.substring(2).toLowerCase())).forEach((e=>t.add(e)))}catch(e){console.warn("Could not get Element events:",e)}return new Set(["beforeunload","unload","pagehide","pageshow","popstate","hashchange","storage","message","messageerror","offline","online","languagechange","rejectionhandled","unhandledrejection","afterprint","beforeprint","devicemotion","deviceorientation","deviceorientationabsolute"]).forEach((e=>t.delete(e))),e.eventCache=t,t}setupEventDelegation(){const t=e.getAllAvailableEvents();for(const e of t){const t=this.createDelegatedListener(e),s=this.getEventOptions(e);document.addEventListener(e,t,s),this.delegatedEvents.set(e,{listener:t,elements:new WeakSet})}}getEventOptions(e){const t={capture:!0,passive:!1};return["wheel","touchstart","touchmove","touchend","scroll","mousewheel"].includes(e)&&(t.passive=!0),("focusin"===e||"focusout"===e)&&(t.capture=!1),t}isEventSupported(t){return e.getAllAvailableEvents().has(t.toLowerCase())}getAllSupportedEvents(){return Array.from(e.getAllAvailableEvents()).sort()}getDelegatedEvents(){return Array.from(this.delegatedEvents.keys()).sort()}setDependencies(e,t,s){this.componentManager=e,this.expressionEvaluator=t,this.loopManager=s}createDelegatedListener(e){return t=>{const s=t.target;if(!s)return;const n=this.findHandler(s,e);n&&this.executeHandler(n.handler,n.element,t)}}registerEventHandler(e,t,s,n){const i=t.toLowerCase();if(!this.isEventSupported(i))return void console.warn(`⚠️ Event type "${t}" is not supported`);const r=C.getContextComponent(e);this.elementHandlers.has(e)||this.elementHandlers.set(e,new Map);const a={code:s,component:r};this.elementHandlers.get(e).set(i,a);const o=this.delegatedEvents.get(i);o?o.elements.add(e):(console.warn(`⚠️ No delegated listener for ${i}, attaching directly`),this.attachDirectListener(e,i,a))}findHandler(e,t){let s=e;for(;s;){const e=this.elementHandlers.get(s);if(null!=e&&e.has(t))return{handler:e.get(t),element:s};s=s.parentElement}return null}compileHandler(e,t){const s=`${t}:${e}`;if(this.handlerCache.has(s))return this.handlerCache.get(s);let n=e;n.includes("this")&&(n=n.replace(/\bthis\b/g,"thisElement")),n.includes("event")&&(n=n.replace(/\bevent\b/g,"eventObject"));const i=new Function("eventObject","thisElement","context",`\n try {\n with(context) {\n ${n}\n }\n } catch(error) {\n console.error('Event handler execution error:', error);\n console.error('Handler code:', ${JSON.stringify(e)});\n console.error('Component:', '${t}');\n console.error('Available context keys:', Object.keys(context));\n }\n `);return this.handlerCache.set(s,i),i}executeHandler(e,t,s){var n;if(this.componentManager&&this.expressionEvaluator)try{let i=e.component,r=t;for(;r;){const e=r.__uniqueComponentName;if(e){i=e;break}r=r.parentElement}const a=t.getAttribute(x.ATTR_PREFIXES.CONTEXT),o="app"===a||"parent"===a,c="app"===C.getElementComponent(t),p=C.findElementForComponent(t,i);let h;if(o||c)h=this.componentManager.buildComponentContextWithProps("app"===i||"app"===a?"app":i,p||void 0);else if(h=this.componentManager.buildRestrictedComponentContext(i,!1),p){const e=this.componentManager.evaluateProps(p);Object.assign(h,e)}const l=null==(n=this.loopManager)?void 0:n.getLoopContextForElement(t);if(l){const e={};for(const[t,s]of Object.entries(l))"function"!=typeof s&&(e[t]=s);h={...e,...h}}e.compiledFn||(e.compiledFn=this.compileHandler(e.code,i)),e.compiledFn&&e.compiledFn(s,t,h)}catch(t){console.error("💥 Event handler execution failed:",t),console.error("Handler code:",e.code),console.error("Handler component:",e.component)}else console.warn("EventDelegationManager dependencies not set")}extractComponentFunctions(e){const t={};for(const[s,n]of Object.entries(e))"function"==typeof n&&(t[s]=n);return t}attachDirectListener(e,t,s){const n=t=>{this.executeHandler(s,e,t)};e.addEventListener(t,n),e[`__${t}_listener`]=n}removeEventHandler(e,t){var s,n;const i=this.elementHandlers.get(e);i&&(i.delete(t),0===i.size&&this.elementHandlers.delete(e));const r=this.delegatedEvents.get(t);r&&(null==(n=(s=r.elements).delete)||n.call(s,e));const a=e[`__${t}_listener`];a&&(e.removeEventListener(t,a),delete e[`__${t}_listener`])}cleanup(){for(const[e,t]of this.delegatedEvents)document.removeEventListener(e,t.listener,!0);this.delegatedEvents.clear(),this.handlerCache.clear()}};d(G,"eventCache",null);let Be=G;class Bs{constructor(){d(this,"stateManager",new Rs),d(this,"expressionEvaluator",new Os),d(this,"componentManager",new Fs(this.stateManager)),d(this,"domBindingManager",new Ds(this.stateManager,this.componentManager,this.expressionEvaluator)),d(this,"initialized",!1),d(this,"currentLoopContext",null),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>this.initialize())):setTimeout((()=>this.initialize()),0)}initialize(){this.initialized||(this.initialized=!0,this.componentManager.setExpressionEvaluator(this.expressionEvaluator),this.domBindingManager.processElement(document.body,!0),this.componentManager.executePhpScripts(document.body),this.domBindingManager.processPendingBindings())}state(e,t){const s=this.componentManager.getCurrentComponent();let n,i,r;"string"==typeof e&&2===arguments.length?(n=e,i=t):"string"==typeof e&&1===arguments.length?this.looksLikeVariableName(e)?(n=e,i=void 0):(console.warn("pp.state() called with string that doesn't look like variable name:",e),n="unknownState",i=e):(console.warn("pp.state() called without explicit key - this should be handled by AST transformation"),n="unknownState",i=e);const a=this.getLoopExecutionContext();if(a){const e=this.generateLoopInstanceId(a);r=`${s}.${e}.${n}`}else r=`${s}.${n}`;this.stateManager.hasState(r)||this.stateManager.setState(r,i);const o=()=>this.stateManager.getState()[r],c=new Proxy(o,{get(e,t,s){if("__pphp_key"===t||"__pphp_fullKey"===t||"__pphp_component"===t||"value"===t||"valueOf"===t||"toString"===t)return Reflect.get(e,t,s);const n=e();if(null!=n){if(t in Object(n)){const e=n[t];return"function"==typeof e?e.bind(n):e}return Reflect.get(e,t,s)}},has(e,t){if("__pphp_key"===t||"__pphp_fullKey"===t||"__pphp_component"===t||"value"===t||"valueOf"===t||"toString"===t)return Reflect.has(e,t);const s=e();return null!=s&&t in Object(s)||Reflect.has(e,t)},apply:(e,t,s)=>Reflect.apply(e,t,s)});Object.defineProperty(c,"__pphp_key",{value:n,enumerable:!1,writable:!1}),Object.defineProperty(c,"__pphp_fullKey",{value:r,enumerable:!1,writable:!1}),Object.defineProperty(c,"__pphp_component",{value:s,enumerable:!1,writable:!1}),Object.defineProperty(c,"value",{get:()=>this.stateManager.getState()[r],enumerable:!0,configurable:!0}),o.valueOf=()=>this.stateManager.getState()[r],o.toString=()=>N(this.stateManager.getState()[r]);const p=e=>{const t=this.stateManager.getState()[r],s="function"==typeof e?e(t):e;this.stateManager.setState(r,s)};return this.createComponentScopedGlobals(s,n,c,p),[c,p]}getLoopExecutionContext(){return this.currentLoopContext}generateLoopInstanceId(e){const t=Object.keys(e).sort().map((t=>{const s=e[t];return s&&"object"==typeof s&&"id"in s?`${t}:${s.id}`:`${t}:${JSON.stringify(s)}`}));return`loop_${btoa(t.join("|")).replace(/[^a-zA-Z0-9]/g,"").substring(0,8)}`}looksLikeVariableName(e){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)&&e.length<=50&&!e.includes(" ")&&!Vt.has(e)}effect(e,t){const s=`effect_${Date.now()}_${Math.random()}`,n=this.componentManager.getCurrentComponent();let i,r,a,o=!1;if(1===arguments.length)r="always",a={immediate:!0,detectDeps:!0};else if(Array.isArray(t)){const e=this.extractDependencyNames(t,n);0===e.length?(r="once",a={deps:e,immediate:!0}):(r="deps",a={deps:e,immediate:!0})}else{const e={immediate:!0,...t||{}};if(e.deps&&0!==e.deps.length){r="deps",a={deps:this.extractDependencyNames(e.deps,n),immediate:e.immediate,detectDeps:e.detectDeps}}else r="always",a={immediate:e.immediate,detectDeps:!0}}const c=()=>{if(!o){if(i&&"function"==typeof i)try{i()}catch(e){console.error("Effect cleanup error:",e)}try{i=e()}catch(e){console.error("Effect callback error:",e)}}};switch(r){case"always":const e={id:s,selector:"",dependencies:new Set(["*"]),callback:c,component:n};this.stateManager.addSubscription(e);break;case"once":break;case"deps":const t=this.resolveDependencies(a.deps,n);if(t.length){const e={id:s,selector:"",dependencies:new Set(t),callback:c,component:n};this.stateManager.addSubscription(e)}}return!1!==a.immediate&&c(),()=>{if(o=!0,i&&"function"==typeof i)try{i()}catch(e){console.error("Effect cleanup error:",e)}this.stateManager.removeSubscription(s)}}extractDependencyNames(e,t){const s=[];for(const t of e)"string"==typeof t?s.push(t):"function"==typeof t&&t.__pphp_key?s.push(t.__pphp_key):console.warn("Invalid dependency in effect:",t);return s.filter(Boolean)}resolveDependencies(e,t){const s=[],n=this.stateManager.getState();for(const i of e)if(i.includes(".")){const e=i.split("."),r=e[0],a=e.slice(1).join("."),o=this.componentManager.getPropDependencies(r,t);if(o.length>0)s.push(...o);else{const e=we.findExistingStateKey(r,t,n);e?s.push(`${e}.${a}`):s.push(`${t}.${i}`)}}else{const e=this.componentManager.getPropDependencies(i,t);if(e.length>0)s.push(...e);else{const e=we.findExistingStateKey(i,t,n);e?s.push(e):s.push(`${t}.${i}`)}}return Array.from(new Set(s))}createComponentScopedGlobals(e,t,s,n){window[e]||(window[e]={});const i=`set${Ft(t)}`;Object.defineProperty(window[e],t,{get:()=>s.valueOf(),configurable:!0,enumerable:!0}),window[e][i]=n,window[e][`${t}Getter`]=s}}const $t=new Bs;window.pp=$t,globalThis.pp=$t;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "4.0.0-alpha.82",
3
+ "version": "4.0.0-alpha.83",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",