sveld 0.38.1 → 0.38.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser.d.ts +9 -48
- package/browser.js +174 -194
- package/chunk-1azsj0zd.js +13 -0
- package/chunk-asxze8b8.js +1 -0
- package/chunk-nv6dzbmp.js +29 -0
- package/chunk-q19n9qm3.js +5 -0
- package/chunk-ssa3mr5n.js +234 -0
- package/cli-entry.js +2 -2
- package/index.d.ts +12 -53
- package/index.js +1 -1
- package/package.json +1 -1
- package/chunk-wpqsw5ca.js +0 -13
- package/chunk-x0hkebcs.js +0 -29
- package/chunk-y5gqpp8d.js +0 -5
- package/chunk-ymq8jc0f.js +0 -254
- package/chunk-ynrmtc58.js +0 -1
package/chunk-ymq8jc0f.js
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
function Jp(B){let X="";for(let he=0;he<B.length;he++){let Ae=B[he];if(Ae==="*"&&B[he+1]==="*"){if(X+=".*",he++,B[he+1]==="/")he++;continue}if(Ae==="*"){X+="[^/]*";continue}if(Ae==="?"){X+="[^/]";continue}X+=".+^$()[]{}|\\".includes(Ae)?`\\${Ae}`:Ae}return X}function Zr(B,X){return new RegExp(`^${Jp(B)}$`).test(X)}var J={"prop-unknown-type":"sveld/prop-unknown-type","context-any-type":"sveld/context-any-type","slot-missing-type":"sveld/slot-missing-type","event-no-source":"sveld/event-no-source","dispatch-escapes":"sveld/dispatch-escapes","example-compile-error":"sveld/example-compile-error","example-syntax-error":"sveld/example-syntax-error","syntax-skipped":"sveld/syntax-skipped","type-syntax-error":"sveld/type-syntax-error","rest-props-unresolved":"sveld/rest-props-unresolved","context-duplicate-key":"sveld/context-duplicate-key","context-key-unresolved":"sveld/context-key-unresolved","context-value-unresolved":"sveld/context-value-unresolved","spread-unresolved":"sveld/spread-unresolved","export-unresolved":"sveld/export-unresolved","module-export-conflict":"sveld/module-export-conflict","extend-props-target-missing":"sveld/extend-props-target-missing","extend-props-duplicate":"sveld/extend-props-duplicate","extend-props-override":"sveld/extend-props-override","jsdoc-unknown-tag":"sveld/jsdoc-unknown-tag","typedef-duplicate":"sveld/typedef-duplicate","property-duplicate":"sveld/property-duplicate","generics-conflict":"sveld/generics-conflict","event-description-ambiguous":"sveld/event-description-ambiguous","jsdoc-tag-dropped":"sveld/jsdoc-tag-dropped","internal-typedef-referenced":"sveld/internal-typedef-referenced","cross-file-unresolved":"sveld/cross-file-unresolved","export-ambiguous":"sveld/export-ambiguous"},Yp={"prop-unknown-type":"warning","context-any-type":"warning","slot-missing-type":"warning","event-no-source":"warning","dispatch-escapes":"warning","example-compile-error":"error","example-syntax-error":"error","syntax-skipped":"error","type-syntax-error":"error","rest-props-unresolved":"warning","context-duplicate-key":"warning","context-key-unresolved":"warning","context-value-unresolved":"warning","spread-unresolved":"warning","export-unresolved":"warning","module-export-conflict":"warning","extend-props-target-missing":"error","extend-props-duplicate":"warning","extend-props-override":"warning","jsdoc-unknown-tag":"warning","typedef-duplicate":"warning","property-duplicate":"warning","generics-conflict":"warning","event-description-ambiguous":"warning","jsdoc-tag-dropped":"warning","internal-typedef-referenced":"error","cross-file-unresolved":"warning","export-ambiguous":"warning"};function s(B){return{...B,code:J[B.kind],severity:Yp[B.kind]}}function Z(B,X){if(X)return B;return B.filter((he)=>he.kind!=="jsdoc-unknown-tag")}function eo(B,X){if(!X)return[];return B.filter((he)=>!he.ignored&&(X!=="errors"||he.severity==="error"))}function Qp(B,X){if(X.code!==void 0&&X.code!==B.code)return!1;if(X.name!==void 0&&X.name!==B.name)return!1;if(X.component!==void 0&&!Zr(X.component,B.component))return!1;return!0}function to(B,X){if(!X||X.length===0)return B;return B.map((he)=>he.ignored||X.some((Ae)=>Qp(he,Ae))?{...he,ignored:!0}:he)}var Zp={"prop-unknown-type":"Props without inferred types","context-any-type":"Context values typed as `any`","slot-missing-type":"@slot/@snippet tags missing a {Type} annotation","event-no-source":"@event tags with no dispatch or callback","dispatch-escapes":"Dispatchers passed to functions sveld can't follow","example-compile-error":"@example blocks that failed to compile","example-syntax-error":"@example blocks that failed to parse","syntax-skipped":"Component syntax sveld skipped","type-syntax-error":"JSDoc types that aren't valid TypeScript","rest-props-unresolved":"$$restProps spread only onto components","context-duplicate-key":"Duplicate setContext keys","context-key-unresolved":"setContext keys sveld couldn't resolve","context-value-unresolved":"setContext values sveld couldn't describe","spread-unresolved":"Unresolved spreads widened to Record<string, any>","export-unresolved":"Unresolved named export specifiers","module-export-conflict":"Module-script exports colliding with generated names","extend-props-target-missing":"@extends/@extendProps targets that couldn't be verified","extend-props-duplicate":"Duplicate @extends/@extendProps tags","extend-props-override":"Own props overriding an @extends target's prop","jsdoc-unknown-tag":"Unknown JSDoc tags","typedef-duplicate":"Duplicate @typedef/@callback names","property-duplicate":"Duplicate @property names","generics-conflict":"Duplicate @generics/@template names","event-description-ambiguous":"Text after an @event read as the next tag's description","jsdoc-tag-dropped":"Passthrough JSDoc tags that couldn't attach","internal-typedef-referenced":"Public types referencing an @internal typedef","cross-file-unresolved":"Imports a standalone parse couldn't read","export-ambiguous":"Ambiguous `export *` names left out of the entry exports"},ec=["prop-unknown-type","context-any-type","slot-missing-type","event-no-source","dispatch-escapes","example-compile-error","example-syntax-error","syntax-skipped","type-syntax-error","rest-props-unresolved","context-duplicate-key","context-key-unresolved","context-value-unresolved","spread-unresolved","export-unresolved","module-export-conflict","extend-props-target-missing","extend-props-duplicate","extend-props-override","jsdoc-unknown-tag","typedef-duplicate","property-duplicate","generics-conflict","event-description-ambiguous","jsdoc-tag-dropped","internal-typedef-referenced","cross-file-unresolved","export-ambiguous"];function no(B){let X=new Set,he=[];for(let Ae of B){let $t=`${Ae.component}:${Ae.kind}:${Ae.name}`;if(X.has($t))continue;X.add($t),he.push(Ae)}return he}function K(B){let X=B.filter((It)=>!It.ignored),he=B.length-X.length,Ae=he>0?` (${he} ignored)`:"";if(X.length===0)return`sveld: no diagnostics${Ae}.`;let $t=[],Lt=(It,Mt)=>`${It} ${Mt}${It===1?"":"s"}`,Ot=X.filter((It)=>It.severity==="error").length,_t=`${Lt(Ot,"error")}, ${Lt(X.length-Ot,"warning")}`;$t.push(`sveld: ${Lt(X.length,"diagnostic")} (${_t})${Ae}.`);for(let It of ec){let Mt=X.filter((Vt)=>Vt.kind===It);if(Mt.length===0)continue;$t.push(""),$t.push(`${Zp[It]} (${Mt.length}):`);let Ft=new Map;for(let Vt of Mt){let Bt=Ft.get(Vt.component)??[];Bt.push(Vt),Ft.set(Vt.component,Bt)}for(let[Vt,Bt]of Ft){$t.push(` ${Vt}`);for(let Gt of Bt){let Wt=Gt.source?` (${Vt}:${Gt.source.start.line}:${Gt.source.start.column})`:"";$t.push(` - ${Gt.message}${Wt} [${Gt.code}]`)}}}return $t.join(`
|
|
2
|
-
`)}var Re=1;function ee(B){return`${JSON.stringify({kind:"diagnostics",schemaVersion:Re,diagnostics:B},null,2)}
|
|
3
|
-
`}function ui(B,X){if(X.length===0)return;B.diagnostics=[...B.diagnostics??[],...X]}var tc=[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,78,5,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,199,7,137,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,55,9,266,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,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],mo=[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,7,25,39,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,5,57,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,24,43,261,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,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,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,208,30,2,2,2,1,2,6,3,4,10,1,225,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,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],nc="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",go="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",hi={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"},di="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",sc={5:di,"5module":di+" export import",6:di+" const class extends export import super"},yo=/^in(stanceof)?$/,ic=new RegExp("["+go+"]"),rc=new RegExp("["+go+nc+"]");function vi(B,X){var he=65536;for(var Ae=0;Ae<X.length;Ae+=2){if(he+=X[Ae],he>B)return!1;if(he+=X[Ae+1],he>=B)return!0}return!1}function f(B,X){if(B<65)return B===36;if(B<91)return!0;if(B<97)return B===95;if(B<123)return!0;if(B<=65535)return B>=170&&ic.test(String.fromCharCode(B));if(X===!1)return!1;return vi(B,mo)}function y(B,X){if(B<48)return B===36;if(B<58)return!0;if(B<65)return!1;if(B<91)return!0;if(B<97)return B===95;if(B<123)return!0;if(B<=65535)return B>=170&&rc.test(String.fromCharCode(B));if(X===!1)return!1;return vi(B,mo)||vi(B,tc)}var Qt=function(B,X){if(X===void 0)X={};this.label=B,this.keyword=X.keyword,this.beforeExpr=!!X.beforeExpr,this.startsExpr=!!X.startsExpr,this.isLoop=!!X.isLoop,this.isAssign=!!X.isAssign,this.prefix=!!X.prefix,this.postfix=!!X.postfix,this.binop=X.binop||null,this.updateContext=null};function dn(B,X){return new Qt(B,{beforeExpr:!0,binop:X})}var fn={beforeExpr:!0},ln={startsExpr:!0},wi={};function Yt(B,X){if(X===void 0)X={};return X.keyword=B,wi[B]=new Qt(B,X)}var jt={num:new Qt("num",ln),regexp:new Qt("regexp",ln),string:new Qt("string",ln),name:new Qt("name",ln),privateId:new Qt("privateId",ln),eof:new Qt("eof"),bracketL:new Qt("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new Qt("]"),braceL:new Qt("{",{beforeExpr:!0,startsExpr:!0}),braceR:new Qt("}"),parenL:new Qt("(",{beforeExpr:!0,startsExpr:!0}),parenR:new Qt(")"),comma:new Qt(",",fn),semi:new Qt(";",fn),colon:new Qt(":",fn),dot:new Qt("."),question:new Qt("?",fn),questionDot:new Qt("?."),arrow:new Qt("=>",fn),template:new Qt("template"),invalidTemplate:new Qt("invalidTemplate"),ellipsis:new Qt("...",fn),backQuote:new Qt("`",ln),dollarBraceL:new Qt("${",{beforeExpr:!0,startsExpr:!0}),eq:new Qt("=",{beforeExpr:!0,isAssign:!0}),assign:new Qt("_=",{beforeExpr:!0,isAssign:!0}),incDec:new Qt("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new Qt("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:dn("||",1),logicalAND:dn("&&",2),bitwiseOR:dn("|",3),bitwiseXOR:dn("^",4),bitwiseAND:dn("&",5),equality:dn("==/!=/===/!==",6),relational:dn("</>/<=/>=",7),bitShift:dn("<</>>/>>>",8),plusMin:new Qt("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:dn("%",10),star:dn("*",10),slash:dn("/",10),starstar:new Qt("**",{beforeExpr:!0}),coalesce:dn("??",1),_break:Yt("break"),_case:Yt("case",fn),_catch:Yt("catch"),_continue:Yt("continue"),_debugger:Yt("debugger"),_default:Yt("default",fn),_do:Yt("do",{isLoop:!0,beforeExpr:!0}),_else:Yt("else",fn),_finally:Yt("finally"),_for:Yt("for",{isLoop:!0}),_function:Yt("function",ln),_if:Yt("if"),_return:Yt("return",fn),_switch:Yt("switch"),_throw:Yt("throw",fn),_try:Yt("try"),_var:Yt("var"),_const:Yt("const"),_while:Yt("while",{isLoop:!0}),_with:Yt("with"),_new:Yt("new",{beforeExpr:!0,startsExpr:!0}),_this:Yt("this",ln),_super:Yt("super",ln),_class:Yt("class",ln),_extends:Yt("extends",fn),_export:Yt("export"),_import:Yt("import",ln),_null:Yt("null",ln),_true:Yt("true",ln),_false:Yt("false",ln),_in:Yt("in",{beforeExpr:!0,binop:7}),_instanceof:Yt("instanceof",{beforeExpr:!0,binop:7}),_typeof:Yt("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:Yt("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:Yt("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},un=/\r\n?|\n|\u2028|\u2029/,oc=new RegExp(un.source,"g");function Hn(B){return B===10||B===13||B===8232||B===8233}function xo(B,X,he){if(he===void 0)he=B.length;for(var Ae=X;Ae<he;Ae++){var $t=B.charCodeAt(Ae);if(Hn($t))return Ae<he-1&&$t===13&&B.charCodeAt(Ae+1)===10?Ae+2:Ae+1}return-1}var vo=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,sn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ac=Object.prototype,{hasOwnProperty:pc,toString:cc}=ac,as=Object.hasOwn||function(B,X){return pc.call(B,X)},so=Array.isArray||function(B){return cc.call(B)==="[object Array]"},io=Object.create(null);function ys(B){return io[B]||(io[B]=new RegExp("^(?:"+B.replace(/ /g,"|")+")$"))}function Ss(B){if(B<=65535)return String.fromCharCode(B);return B-=65536,String.fromCharCode((B>>10)+55296,(B&1023)+56320)}var lc=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,os=function(B,X){this.line=B,this.column=X};os.prototype.offset=function(B){return new os(this.line,this.column+B)};var ws=function(B,X,he){if(this.start=X,this.end=he,B.sourceFile!==null)this.source=B.sourceFile};function Eo(B,X){for(var he=1,Ae=0;;){var $t=xo(B,Ae,X);if($t<0)return new os(he,X-Ae);++he,Ae=$t}}var Ei={ecmaVersion:null,sourceType:"script",strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,startLocation:null,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},ro=!1;function uc(B){var X={};for(var he in Ei)X[he]=B&&as(B,he)?B[he]:Ei[he];if(X.ecmaVersion==="latest")X.ecmaVersion=1e8;else if(X.ecmaVersion==null){if(!ro&&typeof console==="object"&&console.warn)ro=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
4
|
-
Defaulting to 2020, but this will stop working in the future.`);X.ecmaVersion=11}else if(X.ecmaVersion>=2015)X.ecmaVersion-=2009;if(X.allowReserved==null)X.allowReserved=X.ecmaVersion<5;if(!B||B.allowHashBang==null)X.allowHashBang=X.ecmaVersion>=14;if(so(X.onToken)){var Ae=X.onToken;X.onToken=function($t){return Ae.push($t)}}if(so(X.onComment))X.onComment=hc(X,X.onComment);if(X.sourceType==="commonjs"&&X.allowAwaitOutsideFunction)throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return X}function hc(B,X){return function(he,Ae,$t,Lt,Ot,_t){var It={type:he?"Block":"Line",value:Ae,start:$t,end:Lt};if(B.locations)It.loc=new ws(this,Ot,_t);if(B.ranges)It.range=[$t,Lt];X.push(It)}}var Ln=1,On=2,ki=4,bo=8,$i=16,Co=32,ks=64,So=128,Mn=256,ps=512,wo=1024,$s=Ln|On|Mn;function Pi(B,X){return On|(B?ki:0)|(X?bo:0)}var Es=0,Ti=1,kn=2,ko=3,$o=4,Po=5,r=function(B,X,he){this.options=B=uc(B),this.sourceFile=B.sourceFile,this.keywords=ys(sc[B.ecmaVersion>=6?6:B.sourceType==="module"?"5module":5]);var Ae="";if(B.allowReserved!==!0){if(Ae=hi[B.ecmaVersion>=6?6:B.ecmaVersion===5?5:3],B.sourceType==="module")Ae+=" await"}this.reservedWords=ys(Ae);var $t=(Ae?Ae+" ":"")+hi.strict;if(this.reservedWordsStrict=ys($t),this.reservedWordsStrictBind=ys($t+" "+hi.strictBind),this.input=String(X),this.containsEsc=!1,this.pos=he||0,this.curLine=1,B.startLocation)this.lineStart=this.pos-B.startLocation.column,this.curLine=B.startLocation.line;else if(he){if(this.lineStart=this.input.lastIndexOf(`
|
|
5
|
-
`,he-1)+1,this.options.locations)this.curLine=this.input.slice(0,this.lineStart).split(un).length}else this.lineStart=0;if(this.type=jt.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=B.sourceType==="module",this.strict=this.inModule||B.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&B.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?On:Ln),this.regexpState=null,this.privateNameStack=[]},mn={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};r.prototype.parse=function(){var B=this,X=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return B.parseTopLevel(X)})};mn.inFunction.get=function(){return(this.currentVarScope().flags&On)>0};mn.inGenerator.get=function(){return(this.currentVarScope().flags&bo)>0};mn.inAsync.get=function(){return(this.currentVarScope().flags&ki)>0};mn.canAwait.get=function(){for(var B=this.scopeStack.length-1;B>=0;B--){var X=this.scopeStack[B],he=X.flags;if(he&(Mn|ps))return!1;if(he&On)return(he&ki)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};mn.allowReturn.get=function(){if(this.inFunction)return!0;if(this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Ln)return!0;return!1};mn.allowSuper.get=function(){var B=this.currentThisScope(),X=B.flags;return(X&ks)>0||this.options.allowSuperOutsideMethod};mn.allowDirectSuper.get=function(){return(this.currentThisScope().flags&So)>0};mn.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};mn.allowNewDotTarget.get=function(){for(var B=this.scopeStack.length-1;B>=0;B--){var X=this.scopeStack[B],he=X.flags;if(he&(Mn|ps)||he&On&&!(he&$i))return!0}return!1};mn.allowUsing.get=function(){var B=this.currentScope(),X=B.flags;if(X&wo)return!1;if(!this.inModule&&X&Ln)return!1;return!0};mn.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Mn)>0};r.extend=function(){var B=[],X=arguments.length;while(X--)B[X]=arguments[X];var he=this;for(var Ae=0;Ae<B.length;Ae++)he=B[Ae](he);return he};r.parse=function(B,X){return new this(X,B).parse()};r.parseExpressionAt=function(B,X,he){var Ae=new this(he,B,X);return Ae.nextToken(),Ae.parseExpression()};r.tokenizer=function(B,X){return new this(X,B)};Object.defineProperties(r.prototype,mn);var pn=r.prototype,dc=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;pn.strictDirective=function(B){if(this.options.ecmaVersion<5)return!1;for(;;){sn.lastIndex=B,B+=sn.exec(this.input)[0].length;var X=dc.exec(this.input.slice(B));if(!X)return!1;if((X[1]||X[2])==="use strict"){sn.lastIndex=B+X[0].length;var he=sn.exec(this.input),Ae=he.index+he[0].length,$t=this.input.charAt(Ae);return $t===";"||$t==="}"||un.test(he[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test($t)||$t==="!"&&this.input.charAt(Ae+1)==="=")}if(B+=X[0].length,sn.lastIndex=B,B+=sn.exec(this.input)[0].length,this.input[B]===";")B++}};pn.eat=function(B){if(this.type===B)return this.next(),!0;else return!1};pn.isContextual=function(B){return this.type===jt.name&&this.value===B&&!this.containsEsc};pn.eatContextual=function(B){if(!this.isContextual(B))return!1;return this.next(),!0};pn.catchStackOverflow=function(B){try{return B()}catch(X){if(X instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(X.message)||/\btoo much recursion\b/i.test(X.message)))this.raise(this.start,"Not enough stack space to parse input");else throw X}};pn.expectContextual=function(B){if(!this.eatContextual(B))this.unexpected()};pn.canInsertSemicolon=function(){return this.type===jt.eof||this.type===jt.braceR||un.test(this.input.slice(this.lastTokEnd,this.start))};pn.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};pn.semicolon=function(){if(!this.eat(jt.semi)&&!this.insertSemicolon())this.unexpected()};pn.afterTrailingComma=function(B,X){if(this.type===B){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!X)this.next();return!0}};pn.expect=function(B){this.eat(B)||this.unexpected()};pn.unexpected=function(B){this.raise(B!=null?B:this.start,"Unexpected token")};var Ps=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};pn.checkPatternErrors=function(B,X){if(!B)return;if(B.trailingComma>-1)this.raiseRecoverable(B.trailingComma,"Comma is not permitted after the rest element");var he=X?B.parenthesizedAssign:B.parenthesizedBind;if(he>-1)this.raiseRecoverable(he,X?"Assigning to rvalue":"Parenthesized pattern")};pn.checkExpressionErrors=function(B,X){if(!B)return!1;var{shorthandAssign:he,doubleProto:Ae}=B;if(!X)return he>=0||Ae>=0;if(he>=0)this.raise(he,"Shorthand property assignments are valid only in destructuring patterns");if(Ae>=0)this.raiseRecoverable(Ae,"Redefinition of __proto__ property")};pn.checkYieldAwaitInDefaultParams=function(){if(this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos))this.raise(this.yieldPos,"Yield expression cannot be a default value");if(this.awaitPos)this.raise(this.awaitPos,"Await expression cannot be a default value")};pn.isSimpleAssignTarget=function(B){if(B.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(B.expression);return B.type==="Identifier"||B.type==="MemberExpression"};var qt=r.prototype;qt.parseTopLevel=function(B){var X=Object.create(null);if(!B.body)B.body=[];while(this.type!==jt.eof){var he=this.parseStatement(null,!0,X);B.body.push(he)}if(this.inModule)for(var Ae=0,$t=Object.keys(this.undefinedExports);Ae<$t.length;Ae+=1){var Lt=$t[Ae];this.raiseRecoverable(this.undefinedExports[Lt].start,"Export '"+Lt+"' is not defined")}return this.adaptDirectivePrologue(B.body),this.next(),B.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(B,"Program")};var Ai={kind:"loop"},fc={kind:"switch"};qt.isLet=function(B){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;sn.lastIndex=this.pos;var X=sn.exec(this.input),he=this.pos+X[0].length,Ae=this.fullCharCodeAt(he);if(Ae===91||Ae===92)return!0;if(B)return!1;if(Ae===123)return!0;if(f(Ae)){var $t=he;do he+=Ae<=65535?1:2;while(y(Ae=this.fullCharCodeAt(he)));if(Ae===92)return!0;var Lt=this.input.slice($t,he);if(!yo.test(Lt))return!0}return!1};qt.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;sn.lastIndex=this.pos;var B=sn.exec(this.input),X=this.pos+B[0].length,he;return!un.test(this.input.slice(this.pos,X))&&this.input.slice(X,X+8)==="function"&&(X+8===this.input.length||!(y(he=this.fullCharCodeAt(X+8))||he===92))};qt.isUsingKeyword=function(B,X){if(this.options.ecmaVersion<17||!this.isContextual(B?"await":"using"))return!1;sn.lastIndex=this.pos;var he=sn.exec(this.input),Ae=this.pos+he[0].length;if(un.test(this.input.slice(this.pos,Ae)))return!1;if(B){var $t=Ae+5,Lt;if(this.input.slice(Ae,$t)!=="using"||$t===this.input.length||y(Lt=this.fullCharCodeAt($t))||Lt===92)return!1;sn.lastIndex=$t;var Ot=sn.exec(this.input);if(Ae=$t+Ot[0].length,Ot&&un.test(this.input.slice($t,Ae)))return!1}var _t=this.fullCharCodeAt(Ae);if(!f(_t)&&_t!==92)return!1;var It=Ae;do Ae+=_t<=65535?1:2;while(y(_t=this.fullCharCodeAt(Ae)));if(_t===92)return!0;var Mt=this.input.slice(It,Ae);if(yo.test(Mt))return!1;if(X&&!B&&Mt==="of"){sn.lastIndex=Ae;var Ft=sn.exec(this.input);if(Ae=Ae+Ft[0].length,this.input.charCodeAt(Ae)!==61||(_t=this.input.charCodeAt(Ae+1))===61||_t===62)return!1}return!0};qt.isAwaitUsing=function(B){return this.isUsingKeyword(!0,B)};qt.isUsing=function(B){return this.isUsingKeyword(!1,B)};qt.parseStatement=function(B,X,he){var Ae=this.type,$t=this.startNode(),Lt;if(this.isLet(B))Ae=jt._var,Lt="let";switch(Ae){case jt._break:case jt._continue:return this.parseBreakContinueStatement($t,Ae.keyword);case jt._debugger:return this.parseDebuggerStatement($t);case jt._do:return this.parseDoStatement($t);case jt._for:return this.parseForStatement($t);case jt._function:if(B&&(this.strict||B!=="if"&&B!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement($t,!1,!B);case jt._class:if(B)this.unexpected();return this.parseClass($t,!0);case jt._if:return this.parseIfStatement($t);case jt._return:return this.parseReturnStatement($t);case jt._switch:return this.parseSwitchStatement($t);case jt._throw:return this.parseThrowStatement($t);case jt._try:return this.parseTryStatement($t);case jt._const:case jt._var:if(Lt=Lt||this.value,B&&Lt!=="var")this.unexpected();return this.parseVarStatement($t,Lt);case jt._while:return this.parseWhileStatement($t);case jt._with:return this.parseWithStatement($t);case jt.braceL:return this.parseBlock(!0,$t);case jt.semi:return this.parseEmptyStatement($t);case jt._export:case jt._import:if(this.options.ecmaVersion>10&&Ae===jt._import){sn.lastIndex=this.pos;var Ot=sn.exec(this.input),_t=this.pos+Ot[0].length,It=this.input.charCodeAt(_t);if(It===40||It===46)return this.parseExpressionStatement($t,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!X)this.raise(this.start,"'import' and 'export' may only appear at the top level");if(!this.inModule)this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")}return Ae===jt._import?this.parseImport($t):this.parseExport($t,he);default:if(this.isAsyncFunction()){if(B)this.unexpected();return this.next(),this.parseFunctionStatement($t,!0,!B)}var Mt=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(Mt){if(!this.allowUsing)this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement");if(B)this.raise(this.start,"Using declaration is not allowed in single-statement positions");if(Mt==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.next(),this.parseVar($t,!1,Mt),this.semicolon(),this.finishNode($t,"VariableDeclaration")}var Ft=this.value,Vt=this.parseExpression();if(Ae===jt.name&&Vt.type==="Identifier"&&this.eat(jt.colon))return this.parseLabeledStatement($t,Ft,Vt,B);else return this.parseExpressionStatement($t,Vt)}};qt.parseBreakContinueStatement=function(B,X){var he=X==="break";if(this.next(),this.eat(jt.semi)||this.insertSemicolon())B.label=null;else if(this.type!==jt.name)this.unexpected();else B.label=this.parseIdent(),this.semicolon();var Ae=0;for(;Ae<this.labels.length;++Ae){var $t=this.labels[Ae];if(B.label==null||$t.name===B.label.name){if($t.kind!=null&&(he||$t.kind==="loop"))break;if(B.label&&he)break}}if(Ae===this.labels.length)this.raise(B.start,"Unsyntactic "+X);return this.finishNode(B,he?"BreakStatement":"ContinueStatement")};qt.parseDebuggerStatement=function(B){return this.next(),this.semicolon(),this.finishNode(B,"DebuggerStatement")};qt.parseDoStatement=function(B){if(this.next(),this.labels.push(Ai),B.body=this.parseStatement("do"),this.labels.pop(),this.expect(jt._while),B.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(jt.semi);else this.semicolon();return this.finishNode(B,"DoWhileStatement")};qt.parseForStatement=function(B){this.next();var X=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Ai),this.enterScope(0),this.expect(jt.parenL),this.type===jt.semi){if(X>-1)this.unexpected(X);return this.parseFor(B,null)}var he=this.isLet();if(this.type===jt._var||this.type===jt._const||he){var Ae=this.startNode(),$t=he?"let":this.value;return this.next(),this.parseVar(Ae,!0,$t),this.finishNode(Ae,"VariableDeclaration"),this.parseForAfterInit(B,Ae,X)}var Lt=this.isContextual("let"),Ot=!1,_t=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(_t){var It=this.startNode();if(this.next(),_t==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.parseVar(It,!0,_t),this.finishNode(It,"VariableDeclaration"),this.parseForAfterInit(B,It,X)}var Mt=this.containsEsc,Ft=new Ps,Vt=this.start,Bt=X>-1?this.parseExprSubscripts(Ft,"await"):this.parseExpression(!0,Ft);if(this.type===jt._in||(Ot=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(X>-1){if(this.type===jt._in)this.unexpected(X);B.await=!0}else if(Ot&&this.options.ecmaVersion>=8){if(Bt.start===Vt&&!Mt&&Bt.type==="Identifier"&&Bt.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)B.await=!1}if(Lt&&Ot)this.raise(Bt.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable(Bt,!1,Ft),this.checkLValPattern(Bt),this.parseForIn(B,Bt)}else this.checkExpressionErrors(Ft,!0);if(X>-1)this.unexpected(X);return this.parseFor(B,Bt)};qt.parseForAfterInit=function(B,X,he){if((this.type===jt._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&X.declarations.length===1){if(this.type===jt._in){if((X.kind==="using"||X.kind==="await using")&&!X.declarations[0].init)this.raise(this.start,"Using declaration is not allowed in for-in loops");if(this.options.ecmaVersion>=9&&he>-1)this.unexpected(he)}else if(this.options.ecmaVersion>=9)B.await=he>-1;return this.parseForIn(B,X)}if(he>-1)this.unexpected(he);return this.parseFor(B,X)};qt.parseFunctionStatement=function(B,X,he){return this.next(),this.parseFunction(B,rs|(he?0:bi),!1,X)};qt.parseIfStatement=function(B){return this.next(),B.test=this.parseParenExpression(),B.consequent=this.parseStatement("if"),B.alternate=this.eat(jt._else)?this.parseStatement("if"):null,this.finishNode(B,"IfStatement")};qt.parseReturnStatement=function(B){if(!this.allowReturn)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(jt.semi)||this.insertSemicolon())B.argument=null;else B.argument=this.parseExpression(),this.semicolon();return this.finishNode(B,"ReturnStatement")};qt.parseSwitchStatement=function(B){this.next(),B.discriminant=this.parseParenExpression(),B.cases=[],this.expect(jt.braceL),this.labels.push(fc),this.enterScope(wo);var X;for(var he=!1;this.type!==jt.braceR;)if(this.type===jt._case||this.type===jt._default){var Ae=this.type===jt._case;if(X)this.finishNode(X,"SwitchCase");if(B.cases.push(X=this.startNode()),X.consequent=[],this.next(),Ae)X.test=this.parseExpression();else{if(he)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");he=!0,X.test=null}this.expect(jt.colon)}else{if(!X)this.unexpected();X.consequent.push(this.parseStatement(null))}if(this.exitScope(),X)this.finishNode(X,"SwitchCase");return this.next(),this.labels.pop(),this.finishNode(B,"SwitchStatement")};qt.parseThrowStatement=function(B){if(this.next(),un.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return B.argument=this.parseExpression(),this.semicolon(),this.finishNode(B,"ThrowStatement")};var mc=[];qt.parseCatchClauseParam=function(){var B=this.parseBindingAtom(),X=B.type==="Identifier";return this.enterScope(X?Co:0),this.checkLValPattern(B,X?$o:kn),this.expect(jt.parenR),B};qt.parseTryStatement=function(B){if(this.next(),B.block=this.parseBlock(),B.handler=null,this.type===jt._catch){var X=this.startNode();if(this.next(),this.eat(jt.parenL))X.param=this.parseCatchClauseParam();else{if(this.options.ecmaVersion<10)this.unexpected();X.param=null,this.enterScope(0)}X.body=this.parseBlock(!1),this.exitScope(),B.handler=this.finishNode(X,"CatchClause")}if(B.finalizer=this.eat(jt._finally)?this.parseBlock():null,!B.handler&&!B.finalizer)this.raise(B.start,"Missing catch or finally clause");return this.finishNode(B,"TryStatement")};qt.parseVarStatement=function(B,X,he){return this.next(),this.parseVar(B,!1,X,he),this.semicolon(),this.finishNode(B,"VariableDeclaration")};qt.parseWhileStatement=function(B){return this.next(),B.test=this.parseParenExpression(),this.labels.push(Ai),B.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(B,"WhileStatement")};qt.parseWithStatement=function(B){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),B.object=this.parseParenExpression(),B.body=this.parseStatement("with"),this.finishNode(B,"WithStatement")};qt.parseEmptyStatement=function(B){return this.next(),this.finishNode(B,"EmptyStatement")};qt.parseLabeledStatement=function(B,X,he,Ae){for(var $t=0,Lt=this.labels;$t<Lt.length;$t+=1){var Ot=Lt[$t];if(Ot.name===X)this.raise(he.start,"Label '"+X+"' is already declared")}var _t=this.type.isLoop?"loop":this.type===jt._switch?"switch":null;for(var It=this.labels.length-1;It>=0;It--){var Mt=this.labels[It];if(Mt.statementStart===B.start)Mt.statementStart=this.start,Mt.kind=_t;else break}return this.labels.push({name:X,kind:_t,statementStart:this.start}),B.body=this.parseStatement(Ae?Ae.indexOf("label")===-1?Ae+"label":Ae:"label"),this.labels.pop(),B.label=he,this.finishNode(B,"LabeledStatement")};qt.parseExpressionStatement=function(B,X){return B.expression=X,this.semicolon(),this.finishNode(B,"ExpressionStatement")};qt.parseBlock=function(B,X,he){if(B===void 0)B=!0;if(X===void 0)X=this.startNode();if(X.body=[],this.expect(jt.braceL),B)this.enterScope(0);while(this.type!==jt.braceR){var Ae=this.parseStatement(null);X.body.push(Ae)}if(he)this.strict=!1;if(this.next(),B)this.exitScope();return this.finishNode(X,"BlockStatement")};qt.parseFor=function(B,X){return B.init=X,this.expect(jt.semi),B.test=this.type===jt.semi?null:this.parseExpression(),this.expect(jt.semi),B.update=this.type===jt.parenR?null:this.parseExpression(),this.expect(jt.parenR),B.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(B,"ForStatement")};qt.parseForIn=function(B,X){var he=this.type===jt._in;if(this.next(),X.type==="VariableDeclaration"&&X.declarations[0].init!=null&&(!he||this.options.ecmaVersion<8||this.strict||X.kind!=="var"||X.declarations[0].id.type!=="Identifier"))this.raise(X.start,(he?"for-in":"for-of")+" loop variable declaration may not have an initializer");return B.left=X,B.right=he?this.parseExpression():this.parseMaybeAssign(),this.expect(jt.parenR),B.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(B,he?"ForInStatement":"ForOfStatement")};qt.parseVar=function(B,X,he,Ae){B.declarations=[],B.kind=he;for(;;){var $t=this.startNode();if(this.parseVarId($t,he),this.eat(jt.eq))$t.init=this.parseMaybeAssign(X);else if(!Ae&&he==="const"&&!(this.type===jt._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!Ae&&(he==="using"||he==="await using")&&this.options.ecmaVersion>=17&&this.type!==jt._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+he+" declaration");else if(!Ae&&$t.id.type!=="Identifier"&&!(X&&(this.type===jt._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else $t.init=null;if(B.declarations.push(this.finishNode($t,"VariableDeclarator")),!this.eat(jt.comma))break}return B};qt.parseVarId=function(B,X){B.id=X==="using"||X==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(B.id,X==="var"?Ti:kn,!1)};var rs=1,bi=2,To=4;qt.parseFunction=function(B,X,he,Ae,$t){if(this.initFunction(B),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Ae){if(this.type===jt.star&&X&bi)this.unexpected();B.generator=this.eat(jt.star)}if(this.options.ecmaVersion>=8)B.async=!!Ae;if(X&rs){if(B.id=X&To&&this.type!==jt.name?null:this.parseIdent(),B.id&&!(X&bi))this.checkLValSimple(B.id,this.strict||B.generator||B.async?this.treatFunctionsAsVar?Ti:kn:ko)}var Lt=this.yieldPos,Ot=this.awaitPos,_t=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Pi(B.async,B.generator)),!(X&rs))B.id=this.type===jt.name?this.parseIdent():null;return this.parseFunctionParams(B),this.parseFunctionBody(B,he,!1,$t),this.yieldPos=Lt,this.awaitPos=Ot,this.awaitIdentPos=_t,this.finishNode(B,X&rs?"FunctionDeclaration":"FunctionExpression")};qt.parseFunctionParams=function(B){this.expect(jt.parenL),B.params=this.parseBindingList(jt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};qt.parseClass=function(B,X){this.next();var he=this.strict;this.strict=!0,this.parseClassId(B,X),this.parseClassSuper(B);var Ae=this.enterClassBody(),$t=this.startNode(),Lt=!1;$t.body=[],this.expect(jt.braceL);while(this.type!==jt.braceR){var Ot=this.parseClassElement(B.superClass!==null);if(Ot){if($t.body.push(Ot),Ot.type==="MethodDefinition"&&Ot.kind==="constructor"){if(Lt)this.raiseRecoverable(Ot.start,"Duplicate constructor in the same class");Lt=!0}else if(Ot.key&&Ot.key.type==="PrivateIdentifier"&&gc(Ae,Ot))this.raiseRecoverable(Ot.key.start,"Identifier '#"+Ot.key.name+"' has already been declared")}}return this.strict=he,this.next(),B.body=this.finishNode($t,"ClassBody"),this.exitClassBody(),this.finishNode(B,X?"ClassDeclaration":"ClassExpression")};qt.parseClassElement=function(B){if(this.eat(jt.semi))return null;var X=this.options.ecmaVersion,he=this.startNode(),Ae="",$t=!1,Lt=!1,Ot="method",_t=!1;if(this.eatContextual("static")){if(X>=13&&this.eat(jt.braceL))return this.parseClassStaticBlock(he),he;if(this.isClassElementNameStart()||this.type===jt.star)_t=!0;else Ae="static"}if(he.static=_t,!Ae&&X>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===jt.star)&&!this.canInsertSemicolon())Lt=!0;else Ae="async";if(!Ae&&(X>=9||!Lt)&&this.eat(jt.star))$t=!0;if(!Ae&&!Lt&&!$t){var It=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Ot=It;else Ae=It}if(Ae)he.computed=!1,he.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),he.key.name=Ae,this.finishNode(he.key,"Identifier");else this.parseClassElementName(he);if(X<13||this.type===jt.parenL||Ot!=="method"||$t||Lt){var Mt=!he.static&&bs(he,"constructor"),Ft=Mt&&B;if(Mt&&Ot!=="method")this.raise(he.key.start,"Constructor can't have get/set modifier");he.kind=Mt?"constructor":Ot,this.parseClassMethod(he,$t,Lt,Ft)}else this.parseClassField(he);return he};qt.isClassElementNameStart=function(){return this.type===jt.name||this.type===jt.privateId||this.type===jt.num||this.type===jt.string||this.type===jt.bracketL||this.type.keyword};qt.parseClassElementName=function(B){if(this.type===jt.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");B.computed=!1,B.key=this.parsePrivateIdent()}else this.parsePropertyName(B)};qt.parseClassMethod=function(B,X,he,Ae){var $t=B.key;if(B.kind==="constructor"){if(X)this.raise($t.start,"Constructor can't be a generator");if(he)this.raise($t.start,"Constructor can't be an async method")}else if(B.static&&bs(B,"prototype"))this.raise($t.start,"Classes may not have a static property named prototype");var Lt=B.value=this.parseMethod(X,he,Ae);if(B.kind==="get"&&Lt.params.length!==0)this.raiseRecoverable(Lt.start,"getter should have no params");if(B.kind==="set"&&Lt.params.length!==1)this.raiseRecoverable(Lt.start,"setter should have exactly one param");if(B.kind==="set"&&Lt.params[0].type==="RestElement")this.raiseRecoverable(Lt.params[0].start,"Setter cannot use rest params");return this.finishNode(B,"MethodDefinition")};qt.parseClassField=function(B){if(bs(B,"constructor"))this.raise(B.key.start,"Classes can't have a field named 'constructor'");else if(B.static&&bs(B,"prototype"))this.raise(B.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(jt.eq))this.enterScope(ps|ks),B.value=this.parseMaybeAssign(),this.exitScope();else B.value=null;return this.semicolon(),this.finishNode(B,"PropertyDefinition")};qt.parseClassStaticBlock=function(B){B.body=[];var X=this.labels;this.labels=[],this.enterScope(Mn|ks);while(this.type!==jt.braceR){var he=this.parseStatement(null);B.body.push(he)}return this.next(),this.exitScope(),this.labels=X,this.finishNode(B,"StaticBlock")};qt.parseClassId=function(B,X){if(this.type===jt.name){if(B.id=this.parseIdent(),X)this.checkLValSimple(B.id,kn,!1)}else{if(X===!0)this.unexpected();B.id=null}};qt.parseClassSuper=function(B){B.superClass=this.eat(jt._extends)?this.parseExprSubscripts(null,!1):null};qt.enterClassBody=function(){var B={declared:Object.create(null),used:[]};return this.privateNameStack.push(B),B.declared};qt.exitClassBody=function(){var B=this.privateNameStack.pop(),{declared:X,used:he}=B;if(!this.options.checkPrivateFields)return;var Ae=this.privateNameStack.length,$t=Ae===0?null:this.privateNameStack[Ae-1];for(var Lt=0;Lt<he.length;++Lt){var Ot=he[Lt];if(!as(X,Ot.name))if($t)$t.used.push(Ot);else this.raiseRecoverable(Ot.start,"Private field '#"+Ot.name+"' must be declared in an enclosing class")}};function gc(B,X){var he=X.key.name,Ae=B[he],$t="true";if(X.type==="MethodDefinition"&&(X.kind==="get"||X.kind==="set"))$t=(X.static?"s":"i")+X.kind;if(Ae==="iget"&&$t==="iset"||Ae==="iset"&&$t==="iget"||Ae==="sget"&&$t==="sset"||Ae==="sset"&&$t==="sget")return B[he]="true",!1;else if(!Ae)return B[he]=$t,!1;else return!0}function bs(B,X){var{computed:he,key:Ae}=B;return!he&&(Ae.type==="Identifier"&&Ae.name===X||Ae.type==="Literal"&&Ae.value===X)}qt.parseExportAllDeclaration=function(B,X){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))B.exported=this.parseModuleExportName(),this.checkExport(X,B.exported,this.lastTokStart);else B.exported=null;if(this.expectContextual("from"),this.type!==jt.string)this.unexpected();if(B.source=this.parseExprAtom(),this.options.ecmaVersion>=16)B.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(B,"ExportAllDeclaration")};qt.parseExport=function(B,X){if(this.next(),this.eat(jt.star))return this.parseExportAllDeclaration(B,X);if(this.eat(jt._default))return this.checkExport(X,"default",this.lastTokStart),B.declaration=this.parseExportDefaultDeclaration(),this.finishNode(B,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(B.declaration=this.parseExportDeclaration(B),B.declaration.type==="VariableDeclaration")this.checkVariableExport(X,B.declaration.declarations);else this.checkExport(X,B.declaration.id,B.declaration.id.start);if(B.specifiers=[],B.source=null,this.options.ecmaVersion>=16)B.attributes=[]}else{if(B.declaration=null,B.specifiers=this.parseExportSpecifiers(X),this.eatContextual("from")){if(this.type!==jt.string)this.unexpected();if(B.source=this.parseExprAtom(),this.options.ecmaVersion>=16)B.attributes=this.parseWithClause()}else{for(var he=0,Ae=B.specifiers;he<Ae.length;he+=1){var $t=Ae[he];if(this.checkUnreserved($t.local),this.checkLocalExport($t.local),$t.local.type==="Literal")this.raise($t.local.start,"A string literal cannot be used as an exported binding without `from`.")}if(B.source=null,this.options.ecmaVersion>=16)B.attributes=[]}this.semicolon()}return this.finishNode(B,"ExportNamedDeclaration")};qt.parseExportDeclaration=function(B){return this.parseStatement(null)};qt.parseExportDefaultDeclaration=function(){var B;if(this.type===jt._function||(B=this.isAsyncFunction())){var X=this.startNode();if(this.next(),B)this.next();return this.parseFunction(X,rs|To,!1,B)}else if(this.type===jt._class){var he=this.startNode();return this.parseClass(he,"nullableID")}else{var Ae=this.parseMaybeAssign();return this.semicolon(),Ae}};qt.checkExport=function(B,X,he){if(!B)return;if(typeof X!=="string")X=X.type==="Identifier"?X.name:X.value;if(as(B,X))this.raiseRecoverable(he,"Duplicate export '"+X+"'");B[X]=!0};qt.checkPatternExport=function(B,X){var he=X.type;if(he==="Identifier")this.checkExport(B,X,X.start);else if(he==="ObjectPattern")for(var Ae=0,$t=X.properties;Ae<$t.length;Ae+=1){var Lt=$t[Ae];this.checkPatternExport(B,Lt)}else if(he==="ArrayPattern")for(var Ot=0,_t=X.elements;Ot<_t.length;Ot+=1){var It=_t[Ot];if(It)this.checkPatternExport(B,It)}else if(he==="Property")this.checkPatternExport(B,X.value);else if(he==="AssignmentPattern")this.checkPatternExport(B,X.left);else if(he==="RestElement")this.checkPatternExport(B,X.argument)};qt.checkVariableExport=function(B,X){if(!B)return;for(var he=0,Ae=X;he<Ae.length;he+=1){var $t=Ae[he];this.checkPatternExport(B,$t.id)}};qt.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};qt.parseExportSpecifier=function(B){var X=this.startNode();return X.local=this.parseModuleExportName(),X.exported=this.eatContextual("as")?this.parseModuleExportName():X.local,this.checkExport(B,X.exported,X.exported.start),this.finishNode(X,"ExportSpecifier")};qt.parseExportSpecifiers=function(B){var X=[],he=!0;this.expect(jt.braceL);while(!this.eat(jt.braceR)){if(!he){if(this.expect(jt.comma),this.afterTrailingComma(jt.braceR))break}else he=!1;X.push(this.parseExportSpecifier(B))}return X};qt.parseImport=function(B){if(this.next(),this.type===jt.string)B.specifiers=mc,B.source=this.parseExprAtom();else B.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),B.source=this.type===jt.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)B.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(B,"ImportDeclaration")};qt.parseImportSpecifier=function(){var B=this.startNode();if(B.imported=this.parseModuleExportName(),this.eatContextual("as"))B.local=this.parseIdent();else this.checkUnreserved(B.imported),B.local=B.imported;return this.checkLValSimple(B.local,kn),this.finishNode(B,"ImportSpecifier")};qt.parseImportDefaultSpecifier=function(){var B=this.startNode();return B.local=this.parseIdent(),this.checkLValSimple(B.local,kn),this.finishNode(B,"ImportDefaultSpecifier")};qt.parseImportNamespaceSpecifier=function(){var B=this.startNode();return this.next(),this.expectContextual("as"),B.local=this.parseIdent(),this.checkLValSimple(B.local,kn),this.finishNode(B,"ImportNamespaceSpecifier")};qt.parseImportSpecifiers=function(){var B=[],X=!0;if(this.type===jt.name){if(B.push(this.parseImportDefaultSpecifier()),!this.eat(jt.comma))return B}if(this.type===jt.star)return B.push(this.parseImportNamespaceSpecifier()),B;this.expect(jt.braceL);while(!this.eat(jt.braceR)){if(!X){if(this.expect(jt.comma),this.afterTrailingComma(jt.braceR))break}else X=!1;B.push(this.parseImportSpecifier())}return B};qt.parseWithClause=function(){var B=[];if(!this.eat(jt._with))return B;this.expect(jt.braceL);var X={},he=!0;while(!this.eat(jt.braceR)){if(!he){if(this.expect(jt.comma),this.afterTrailingComma(jt.braceR))break}else he=!1;var Ae=this.parseImportAttribute(),$t=Ae.key.type==="Identifier"?Ae.key.name:Ae.key.value;if(as(X,$t))this.raiseRecoverable(Ae.key.start,"Duplicate attribute key '"+$t+"'");X[$t]=!0,B.push(Ae)}return B};qt.parseImportAttribute=function(){var B=this.startNode();if(B.key=this.type===jt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(jt.colon),this.type!==jt.string)this.unexpected();return B.value=this.parseExprAtom(),this.finishNode(B,"ImportAttribute")};qt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===jt.string){var B=this.parseLiteral(this.value);if(lc.test(B.value))this.raise(B.start,"An export name cannot include a lone surrogate.");return B}return this.parseIdent(!0)};qt.adaptDirectivePrologue=function(B){for(var X=0;X<B.length&&this.isDirectiveCandidate(B[X]);++X)B[X].directive=B[X].expression.raw.slice(1,-1)};qt.isDirectiveCandidate=function(B){return this.options.ecmaVersion>=5&&B.type==="ExpressionStatement"&&B.expression.type==="Literal"&&typeof B.expression.value==="string"&&(this.input[B.start]==='"'||this.input[B.start]==="'")};var gn=r.prototype;gn.toAssignable=function(B,X,he){if(this.options.ecmaVersion>=6&&B)switch(B.type){case"Identifier":if(this.inAsync&&B.name==="await")this.raise(B.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(B.type="ObjectPattern",he)this.checkPatternErrors(he,!0);for(var Ae=0,$t=B.properties;Ae<$t.length;Ae+=1){var Lt=$t[Ae];if(this.toAssignable(Lt,X),Lt.type==="RestElement"&&(Lt.argument.type==="ArrayPattern"||Lt.argument.type==="ObjectPattern"))this.raise(Lt.argument.start,"Unexpected token")}break;case"Property":if(B.kind!=="init")this.raise(B.key.start,"Object pattern can't contain getter or setter");this.toAssignable(B.value,X);break;case"ArrayExpression":if(B.type="ArrayPattern",he)this.checkPatternErrors(he,!0);this.toAssignableList(B.elements,X);break;case"SpreadElement":if(B.type="RestElement",this.toAssignable(B.argument,X),B.argument.type==="AssignmentPattern")this.raise(B.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(B.operator!=="=")this.raise(B.left.end,"Only '=' operator can be used for specifying default value.");B.type="AssignmentPattern",delete B.operator,this.toAssignable(B.left,X);break;case"ParenthesizedExpression":this.toAssignable(B.expression,X,he);break;case"ChainExpression":this.raiseRecoverable(B.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!X)break;default:this.raise(B.start,"Assigning to rvalue")}else if(he)this.checkPatternErrors(he,!0);return B};gn.toAssignableList=function(B,X){var he=B.length;for(var Ae=0;Ae<he;Ae++){var $t=B[Ae];if($t)this.toAssignable($t,X)}if(he){var Lt=B[he-1];if(this.options.ecmaVersion===6&&X&&Lt&&Lt.type==="RestElement"&&Lt.argument.type!=="Identifier")this.unexpected(Lt.argument.start)}return B};gn.parseSpread=function(B){var X=this.startNode();return this.next(),X.argument=this.parseMaybeAssign(!1,B),this.finishNode(X,"SpreadElement")};gn.parseRestBinding=function(){var B=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==jt.name)this.unexpected();return B.argument=this.parseBindingAtom(),this.finishNode(B,"RestElement")};gn.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case jt.bracketL:var B=this.startNode();return this.next(),B.elements=this.parseBindingList(jt.bracketR,!0,!0),this.finishNode(B,"ArrayPattern");case jt.braceL:return this.parseObj(!0)}return this.parseIdent()};gn.parseBindingList=function(B,X,he,Ae){var $t=[],Lt=!0;while(!this.eat(B)){if(Lt)Lt=!1;else this.expect(jt.comma);if(X&&this.type===jt.comma)$t.push(null);else if(he&&this.afterTrailingComma(B))break;else if(this.type===jt.ellipsis){var Ot=this.parseRestBinding();if(this.parseBindingListItem(Ot),$t.push(Ot),this.type===jt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(B);break}else $t.push(this.parseAssignableListItem(Ae))}return $t};gn.parseAssignableListItem=function(B){var X=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(X),X};gn.parseBindingListItem=function(B){return B};gn.parseMaybeDefault=function(B,X,he){if(he=he||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(jt.eq))return he;var Ae=this.startNodeAt(B,X);return Ae.left=he,Ae.right=this.parseMaybeAssign(),this.finishNode(Ae,"AssignmentPattern")};gn.checkLValSimple=function(B,X,he){if(X===void 0)X=Es;var Ae=X!==Es;switch(B.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(B.name))this.raiseRecoverable(B.start,(Ae?"Binding ":"Assigning to ")+B.name+" in strict mode");if(Ae){if(X===kn&&B.name==="let")this.raiseRecoverable(B.start,"let is disallowed as a lexically bound name");if(he){if(as(he,B.name))this.raiseRecoverable(B.start,"Argument name clash");he[B.name]=!0}if(X!==Po)this.declareName(B.name,X,B.start)}break;case"ChainExpression":this.raiseRecoverable(B.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(Ae)this.raiseRecoverable(B.start,"Binding member expression");break;case"ParenthesizedExpression":if(Ae)this.raiseRecoverable(B.start,"Binding parenthesized expression");return this.checkLValSimple(B.expression,X,he);default:this.raise(B.start,(Ae?"Binding":"Assigning to")+" rvalue")}};gn.checkLValPattern=function(B,X,he){if(X===void 0)X=Es;switch(B.type){case"ObjectPattern":for(var Ae=0,$t=B.properties;Ae<$t.length;Ae+=1){var Lt=$t[Ae];this.checkLValInnerPattern(Lt,X,he)}break;case"ArrayPattern":for(var Ot=0,_t=B.elements;Ot<_t.length;Ot+=1){var It=_t[Ot];if(It)this.checkLValInnerPattern(It,X,he)}break;default:this.checkLValSimple(B,X,he)}};gn.checkLValInnerPattern=function(B,X,he){if(X===void 0)X=Es;switch(B.type){case"Property":this.checkLValInnerPattern(B.value,X,he);break;case"AssignmentPattern":this.checkLValPattern(B.left,X,he);break;case"RestElement":this.checkLValPattern(B.argument,X,he);break;default:this.checkLValPattern(B,X,he)}};var vn=function(B,X,he,Ae,$t){this.token=B,this.isExpr=!!X,this.preserveSpace=!!he,this.override=Ae,this.generator=!!$t},en={b_stat:new vn("{",!1),b_expr:new vn("{",!0),b_tmpl:new vn("${",!1),p_stat:new vn("(",!1),p_expr:new vn("(",!0),q_tmpl:new vn("`",!0,!0,function(B){return B.tryReadTemplateToken()}),f_stat:new vn("function",!1),f_expr:new vn("function",!0),f_expr_gen:new vn("function",!0,!1,null,!0),f_gen:new vn("function",!1,!1,null,!0)},qn=r.prototype;qn.initialContext=function(){return[en.b_stat]};qn.curContext=function(){return this.context[this.context.length-1]};qn.braceIsBlock=function(B){var X=this.curContext();if(X===en.f_expr||X===en.f_stat)return!0;if(B===jt.colon&&(X===en.b_stat||X===en.b_expr))return!X.isExpr;if(B===jt._return||B===jt.name&&this.exprAllowed)return un.test(this.input.slice(this.lastTokEnd,this.start));if(B===jt._else||B===jt.semi||B===jt.eof||B===jt.parenR||B===jt.arrow)return!0;if(B===jt.braceL)return X===en.b_stat;if(B===jt._var||B===jt._const||B===jt.name)return!1;return!this.exprAllowed};qn.inGeneratorContext=function(){for(var B=this.context.length-1;B>=1;B--){var X=this.context[B];if(X.token==="function")return X.generator}return!1};qn.updateContext=function(B){var X,he=this.type;if(he.keyword&&B===jt.dot)this.exprAllowed=!1;else if(X=he.updateContext)X.call(this,B);else this.exprAllowed=he.beforeExpr};qn.overrideContext=function(B){if(this.curContext()!==B)this.context[this.context.length-1]=B};jt.parenR.updateContext=jt.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var B=this.context.pop();if(B===en.b_stat&&this.curContext().token==="function")B=this.context.pop();this.exprAllowed=!B.isExpr};jt.braceL.updateContext=function(B){this.context.push(this.braceIsBlock(B)?en.b_stat:en.b_expr),this.exprAllowed=!0};jt.dollarBraceL.updateContext=function(){this.context.push(en.b_tmpl),this.exprAllowed=!0};jt.parenL.updateContext=function(B){var X=B===jt._if||B===jt._for||B===jt._with||B===jt._while;this.context.push(X?en.p_stat:en.p_expr),this.exprAllowed=!0};jt.incDec.updateContext=function(){};jt._function.updateContext=jt._class.updateContext=function(B){if(B.beforeExpr&&B!==jt._else&&!(B===jt.semi&&this.curContext()!==en.p_stat)&&!(B===jt._return&&un.test(this.input.slice(this.lastTokEnd,this.start)))&&!((B===jt.colon||B===jt.braceL)&&this.curContext()===en.b_stat))this.context.push(en.f_expr);else this.context.push(en.f_stat);this.exprAllowed=!1};jt.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};jt.backQuote.updateContext=function(){if(this.curContext()===en.q_tmpl)this.context.pop();else this.context.push(en.q_tmpl);this.exprAllowed=!1};jt.star.updateContext=function(B){if(B===jt._function){var X=this.context.length-1;if(this.context[X]===en.f_expr)this.context[X]=en.f_expr_gen;else this.context[X]=en.f_gen}this.exprAllowed=!0};jt.name.updateContext=function(B){var X=!1;if(this.options.ecmaVersion>=6&&B!==jt.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())X=!0}this.exprAllowed=X};var Kt=r.prototype;Kt.checkPropClash=function(B,X,he){if(this.options.ecmaVersion>=9&&B.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(B.computed||B.method||B.shorthand))return;var Ae=B.key,$t;switch(Ae.type){case"Identifier":$t=Ae.name;break;case"Literal":$t=String(Ae.value);break;default:return}var Lt=B.kind;if(this.options.ecmaVersion>=6){if($t==="__proto__"&&Lt==="init"){if(X.proto)if(he){if(he.doubleProto<0)he.doubleProto=Ae.start}else this.raiseRecoverable(Ae.start,"Redefinition of __proto__ property");X.proto=!0}return}$t="$"+$t;var Ot=X[$t];if(Ot){var _t;if(Lt==="init")_t=this.strict&&Ot.init||Ot.get||Ot.set;else _t=Ot.init||Ot[Lt];if(_t)this.raiseRecoverable(Ae.start,"Redefinition of property")}else Ot=X[$t]={init:!1,get:!1,set:!1};Ot[Lt]=!0};Kt.parseExpression=function(B,X){var he=this;return this.catchStackOverflow(function(){var{start:Ae,startLoc:$t}=he,Lt=he.parseMaybeAssign(B,X);if(he.type===jt.comma){var Ot=he.startNodeAt(Ae,$t);Ot.expressions=[Lt];while(he.eat(jt.comma))Ot.expressions.push(he.parseMaybeAssign(B,X));return he.finishNode(Ot,"SequenceExpression")}return Lt})};Kt.parseMaybeAssign=function(B,X,he){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(B);else this.exprAllowed=!1;var Ae=!1,$t=-1,Lt=-1,Ot=-1;if(X)$t=X.parenthesizedAssign,Lt=X.trailingComma,Ot=X.doubleProto,X.parenthesizedAssign=X.trailingComma=-1;else X=new Ps,Ae=!0;var _t=this.start,It=this.startLoc;if(this.type===jt.parenL||this.type===jt.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=B==="await";var Mt=this.parseMaybeConditional(B,X);if(he)Mt=he.call(this,Mt,_t,It);if(this.type.isAssign){var Ft=this.startNodeAt(_t,It);if(Ft.operator=this.value,this.type===jt.eq)Mt=this.toAssignable(Mt,!1,X);if(!Ae)X.parenthesizedAssign=X.trailingComma=X.doubleProto=-1;if(X.shorthandAssign>=Mt.start)X.shorthandAssign=-1;if(this.type===jt.eq)this.checkLValPattern(Mt);else this.checkLValSimple(Mt);if(Ft.left=Mt,this.next(),Ft.right=this.parseMaybeAssign(B),Ot>-1)X.doubleProto=Ot;return this.finishNode(Ft,"AssignmentExpression")}else if(Ae)this.checkExpressionErrors(X,!0);if($t>-1)X.parenthesizedAssign=$t;if(Lt>-1)X.trailingComma=Lt;return Mt};Kt.parseMaybeConditional=function(B,X){var he=this.start,Ae=this.startLoc,$t=this.parseExprOps(B,X);if(this.checkExpressionErrors(X))return $t;if(!($t.type==="ArrowFunctionExpression"&&$t.start===he)&&this.eat(jt.question)){var Lt=this.startNodeAt(he,Ae);return Lt.test=$t,Lt.consequent=this.parseMaybeAssign(),this.expect(jt.colon),Lt.alternate=this.parseMaybeAssign(B),this.finishNode(Lt,"ConditionalExpression")}return $t};Kt.parseExprOps=function(B,X){var he=this.start,Ae=this.startLoc,$t=this.parseMaybeUnary(X,!1,!1,B);if(this.checkExpressionErrors(X))return $t;return $t.start===he&&$t.type==="ArrowFunctionExpression"?$t:this.parseExprOp($t,he,Ae,-1,B)};Kt.parseExprOp=function(B,X,he,Ae,$t){var Lt=this.type.binop;if(Lt!=null&&(!$t||this.type!==jt._in)){if(Lt>Ae){var Ot=this.type===jt.logicalOR||this.type===jt.logicalAND,_t=this.type===jt.coalesce;if(_t)Lt=jt.logicalAND.binop;var It=this.value;this.next();var Mt=this.start,Ft=this.startLoc,Vt=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,$t),Mt,Ft,Lt,$t),Bt=this.buildBinary(X,he,B,Vt,It,Ot||_t);if(Ot&&this.type===jt.coalesce||_t&&(this.type===jt.logicalOR||this.type===jt.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp(Bt,X,he,Ae,$t)}}return B};Kt.buildBinary=function(B,X,he,Ae,$t,Lt){if(Ae.type==="PrivateIdentifier")this.raise(Ae.start,"Private identifier can only be left side of binary expression");var Ot=this.startNodeAt(B,X);return Ot.left=he,Ot.operator=$t,Ot.right=Ae,this.finishNode(Ot,Lt?"LogicalExpression":"BinaryExpression")};Kt.parseMaybeUnary=function(B,X,he,Ae){var $t=this.start,Lt=this.startLoc,Ot;if(this.isContextual("await")&&this.canAwait)Ot=this.parseAwait(Ae),X=!0;else if(this.type.prefix){var _t=this.startNode(),It=this.type===jt.incDec;if(_t.operator=this.value,_t.prefix=!0,this.next(),_t.argument=this.parseMaybeUnary(null,!0,It,Ae),this.checkExpressionErrors(B,!0),It)this.checkLValSimple(_t.argument);else if(this.strict&&_t.operator==="delete"&&Ao(_t.argument))this.raiseRecoverable(_t.start,"Deleting local variable in strict mode");else if(_t.operator==="delete"&&Ci(_t.argument))this.raiseRecoverable(_t.start,"Private fields can not be deleted");else X=!0;Ot=this.finishNode(_t,It?"UpdateExpression":"UnaryExpression")}else if(!X&&this.type===jt.privateId){if((Ae||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(Ot=this.parsePrivateIdent(),this.type!==jt._in)this.unexpected()}else{if(Ot=this.parseExprSubscripts(B,Ae),this.checkExpressionErrors(B))return Ot;while(this.type.postfix&&!this.canInsertSemicolon()){var Mt=this.startNodeAt($t,Lt);Mt.operator=this.value,Mt.prefix=!1,Mt.argument=Ot,this.checkLValSimple(Ot),this.next(),Ot=this.finishNode(Mt,"UpdateExpression")}}if(!he&&!(Ot.type==="ArrowFunctionExpression"&&Ot.start===$t)&&this.eat(jt.starstar))if(X)this.unexpected(this.lastTokStart);else return this.buildBinary($t,Lt,Ot,this.parseMaybeUnary(null,!1,!1,Ae),"**",!1);else return Ot};function Ao(B){return B.type==="Identifier"||B.type==="ParenthesizedExpression"&&Ao(B.expression)}function Ci(B){return B.type==="MemberExpression"&&B.property.type==="PrivateIdentifier"||B.type==="ChainExpression"&&Ci(B.expression)||B.type==="ParenthesizedExpression"&&Ci(B.expression)}Kt.parseExprSubscripts=function(B,X){var he=this.start,Ae=this.startLoc,$t=this.parseExprAtom(B,X);if($t.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return $t;var Lt=this.parseSubscripts($t,he,Ae,!1,X);if(B&&Lt.type==="MemberExpression"){if(B.parenthesizedAssign>=Lt.start)B.parenthesizedAssign=-1;if(B.parenthesizedBind>=Lt.start)B.parenthesizedBind=-1;if(B.trailingComma>=Lt.start)B.trailingComma=-1}return Lt};Kt.parseSubscripts=function(B,X,he,Ae,$t){var Lt=this.options.ecmaVersion>=8&&B.type==="Identifier"&&B.name==="async"&&this.lastTokEnd===B.end&&!this.canInsertSemicolon()&&B.end-B.start===5&&this.potentialArrowAt===B.start,Ot=!1;while(!0){var _t=this.parseSubscript(B,X,he,Ae,Lt,Ot,$t);if(_t.optional)Ot=!0;if(_t===B||_t.type==="ArrowFunctionExpression"){if(Ot){var It=this.startNodeAt(X,he);It.expression=_t,_t=this.finishNode(It,"ChainExpression")}return _t}B=_t}};Kt.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(jt.arrow)};Kt.parseSubscriptAsyncArrow=function(B,X,he,Ae){return this.parseArrowExpression(this.startNodeAt(B,X),he,!0,Ae)};Kt.parseSubscript=function(B,X,he,Ae,$t,Lt,Ot){var _t=this.options.ecmaVersion>=11,It=_t&&this.eat(jt.questionDot);if(Ae&&It)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Mt=this.eat(jt.bracketL);if(Mt||It&&this.type!==jt.parenL&&this.type!==jt.backQuote||this.eat(jt.dot)){var Ft=this.startNodeAt(X,he);if(Ft.object=B,Mt)Ft.property=this.parseExpression(),this.expect(jt.bracketR);else if(this.type===jt.privateId&&B.type!=="Super")Ft.property=this.parsePrivateIdent();else Ft.property=this.parseIdent(this.options.allowReserved!=="never");if(Ft.computed=!!Mt,_t)Ft.optional=It;B=this.finishNode(Ft,"MemberExpression")}else if(!Ae&&this.eat(jt.parenL)){var Vt=new Ps,Bt=this.yieldPos,Gt=this.awaitPos,Wt=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var Ut=this.parseExprList(jt.parenR,this.options.ecmaVersion>=8,!1,Vt);if($t&&!It&&this.shouldParseAsyncArrow()){if(this.checkPatternErrors(Vt,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0)this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function");return this.yieldPos=Bt,this.awaitPos=Gt,this.awaitIdentPos=Wt,this.parseSubscriptAsyncArrow(X,he,Ut,Ot)}this.checkExpressionErrors(Vt,!0),this.yieldPos=Bt||this.yieldPos,this.awaitPos=Gt||this.awaitPos,this.awaitIdentPos=Wt||this.awaitIdentPos;var Ht=this.startNodeAt(X,he);if(Ht.callee=B,Ht.arguments=Ut,_t)Ht.optional=It;B=this.finishNode(Ht,"CallExpression")}else if(this.type===jt.backQuote){if(It||Lt)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var zt=this.startNodeAt(X,he);zt.tag=B,zt.quasi=this.parseTemplate({isTagged:!0}),B=this.finishNode(zt,"TaggedTemplateExpression")}return B};Kt.parseExprAtom=function(B,X,he){if(this.type===jt.slash)this.readRegexp();var Ae,$t=this.potentialArrowAt===this.start;switch(this.type){case jt._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(Ae=this.startNode(),this.next(),this.type===jt.parenL&&!this.allowDirectSuper)this.raise(Ae.start,"super() call outside constructor of a subclass");if(this.type!==jt.dot&&this.type!==jt.bracketL&&this.type!==jt.parenL)this.unexpected();return this.finishNode(Ae,"Super");case jt._this:return Ae=this.startNode(),this.next(),this.finishNode(Ae,"ThisExpression");case jt.name:var Lt=this.start,Ot=this.startLoc,_t=this.containsEsc,It=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!_t&&It.name==="async"&&!this.canInsertSemicolon()&&this.eat(jt._function))return this.overrideContext(en.f_expr),this.parseFunction(this.startNodeAt(Lt,Ot),0,!1,!0,X);if($t&&!this.canInsertSemicolon()){if(this.eat(jt.arrow))return this.parseArrowExpression(this.startNodeAt(Lt,Ot),[It],!1,X);if(this.options.ecmaVersion>=8&&It.name==="async"&&this.type===jt.name&&!_t&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(It=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(jt.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(Lt,Ot),[It],!0,X)}}return It;case jt.regexp:var Mt=this.value;return Ae=this.parseLiteral(Mt.value),Ae.regex={pattern:Mt.pattern,flags:Mt.flags},Ae;case jt.num:case jt.string:return this.parseLiteral(this.value);case jt._null:case jt._true:case jt._false:return Ae=this.startNode(),Ae.value=this.type===jt._null?null:this.type===jt._true,Ae.raw=this.type.keyword,this.next(),this.finishNode(Ae,"Literal");case jt.parenL:var Ft=this.start,Vt=this.parseParenAndDistinguishExpression($t,X);if(B){if(B.parenthesizedAssign<0&&!this.isSimpleAssignTarget(Vt))B.parenthesizedAssign=Ft;if(B.parenthesizedBind<0)B.parenthesizedBind=Ft}return Vt;case jt.bracketL:return Ae=this.startNode(),this.next(),Ae.elements=this.parseExprList(jt.bracketR,!0,!0,B),this.finishNode(Ae,"ArrayExpression");case jt.braceL:return this.overrideContext(en.b_expr),this.parseObj(!1,B);case jt._function:return Ae=this.startNode(),this.next(),this.parseFunction(Ae,0);case jt._class:return this.parseClass(this.startNode(),!1);case jt._new:return this.parseNew();case jt.backQuote:return this.parseTemplate();case jt._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(he);else return this.unexpected();default:return this.parseExprAtomDefault()}};Kt.parseExprAtomDefault=function(){this.unexpected()};Kt.parseExprImport=function(B){var X=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===jt.parenL&&!B)return this.parseDynamicImport(X);else if(this.type===jt.dot){var he=this.startNodeAt(X.start,X.loc&&X.loc.start);return he.name="import",X.meta=this.finishNode(he,"Identifier"),this.parseImportMeta(X)}else this.unexpected()};Kt.parseDynamicImport=function(B){if(this.next(),B.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(jt.parenR))if(this.expect(jt.comma),!this.afterTrailingComma(jt.parenR)){if(B.options=this.parseMaybeAssign(),!this.eat(jt.parenR)){if(this.expect(jt.comma),!this.afterTrailingComma(jt.parenR))this.unexpected()}}else B.options=null;else B.options=null;else if(!this.eat(jt.parenR)){var X=this.start;if(this.eat(jt.comma)&&this.eat(jt.parenR))this.raiseRecoverable(X,"Trailing comma is not allowed in import()");else this.unexpected(X)}return this.finishNode(B,"ImportExpression")};Kt.parseImportMeta=function(B){this.next();var X=this.containsEsc;if(B.property=this.parseIdent(!0),B.property.name!=="meta")this.raiseRecoverable(B.property.start,"The only valid meta property for import is 'import.meta'");if(X)this.raiseRecoverable(B.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(B.start,"Cannot use 'import.meta' outside a module");return this.finishNode(B,"MetaProperty")};Kt.parseLiteral=function(B){var X=this.startNode();if(X.value=B,X.raw=this.input.slice(this.start,this.end),X.raw.charCodeAt(X.raw.length-1)===110)X.bigint=X.value!=null?X.value.toString():X.raw.slice(0,-1).replace(/_/g,"");return this.next(),this.finishNode(X,"Literal")};Kt.parseParenExpression=function(){this.expect(jt.parenL);var B=this.parseExpression();return this.expect(jt.parenR),B};Kt.shouldParseArrow=function(B){return!this.canInsertSemicolon()};Kt.parseParenAndDistinguishExpression=function(B,X){var he=this.start,Ae=this.startLoc,$t,Lt=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var Ot=this.start,_t=this.startLoc,It=[],Mt=!0,Ft=!1,Vt=new Ps,Bt=this.yieldPos,Gt=this.awaitPos,Wt;this.yieldPos=0,this.awaitPos=0;while(this.type!==jt.parenR)if(Mt?Mt=!1:this.expect(jt.comma),Lt&&this.afterTrailingComma(jt.parenR,!0)){Ft=!0;break}else if(this.type===jt.ellipsis){if(Wt=this.start,It.push(this.parseParenItem(this.parseRestBinding())),this.type===jt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else It.push(this.parseMaybeAssign(!1,Vt,this.parseParenItem));var Ut=this.lastTokEnd,Ht=this.lastTokEndLoc;if(this.expect(jt.parenR),B&&this.shouldParseArrow(It)&&this.eat(jt.arrow))return this.checkPatternErrors(Vt,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=Bt,this.awaitPos=Gt,this.parseParenArrowList(he,Ae,It,X);if(!It.length||Ft)this.unexpected(this.lastTokStart);if(Wt)this.unexpected(Wt);if(this.checkExpressionErrors(Vt,!0),this.yieldPos=Bt||this.yieldPos,this.awaitPos=Gt||this.awaitPos,It.length>1)$t=this.startNodeAt(Ot,_t),$t.expressions=It,this.finishNodeAt($t,"SequenceExpression",Ut,Ht);else $t=It[0]}else $t=this.parseParenExpression();if(this.options.preserveParens){var zt=this.startNodeAt(he,Ae);return zt.expression=$t,this.finishNode(zt,"ParenthesizedExpression")}else return $t};Kt.parseParenItem=function(B){return B};Kt.parseParenArrowList=function(B,X,he,Ae){return this.parseArrowExpression(this.startNodeAt(B,X),he,!1,Ae)};var yc=[];Kt.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var B=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===jt.dot){var X=this.startNodeAt(B.start,B.loc&&B.loc.start);X.name="new",B.meta=this.finishNode(X,"Identifier"),this.next();var he=this.containsEsc;if(B.property=this.parseIdent(!0),B.property.name!=="target")this.raiseRecoverable(B.property.start,"The only valid meta property for new is 'new.target'");if(he)this.raiseRecoverable(B.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(B.start,"'new.target' can only be used in functions and class static block");return this.finishNode(B,"MetaProperty")}var Ae=this.start,$t=this.startLoc;if(B.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Ae,$t,!0,!1),B.callee.type==="Super")this.raiseRecoverable(Ae,"Invalid use of 'super'");if(this.eat(jt.parenL))B.arguments=this.parseExprList(jt.parenR,this.options.ecmaVersion>=8,!1);else B.arguments=yc;return this.finishNode(B,"NewExpression")};Kt.parseTemplateElement=function(B){var X=B.isTagged,he=this.startNode();if(this.type===jt.invalidTemplate){if(!X)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");he.value={raw:this.value.replace(/\r\n?/g,`
|
|
6
|
-
`),cooked:null}}else he.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
7
|
-
`),cooked:this.value};return this.next(),he.tail=this.type===jt.backQuote,this.finishNode(he,"TemplateElement")};Kt.parseTemplate=function(B){if(B===void 0)B={};var X=B.isTagged;if(X===void 0)X=!1;var he=this.startNode();this.next(),he.expressions=[];var Ae=this.parseTemplateElement({isTagged:X});he.quasis=[Ae];while(!Ae.tail){if(this.type===jt.eof)this.raise(this.pos,"Unterminated template literal");this.expect(jt.dollarBraceL),he.expressions.push(this.parseExpression()),this.expect(jt.braceR),he.quasis.push(Ae=this.parseTemplateElement({isTagged:X}))}return this.next(),this.finishNode(he,"TemplateLiteral")};Kt.isAsyncProp=function(B){return!B.computed&&B.key.type==="Identifier"&&B.key.name==="async"&&(this.type===jt.name||this.type===jt.num||this.type===jt.string||this.type===jt.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===jt.star)&&!un.test(this.input.slice(this.lastTokEnd,this.start))};Kt.parseObj=function(B,X){var he=this.startNode(),Ae=!0,$t={};he.properties=[],this.next();while(!this.eat(jt.braceR)){if(!Ae){if(this.expect(jt.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(jt.braceR))break}else Ae=!1;var Lt=this.parseProperty(B,X);if(!B)this.checkPropClash(Lt,$t,X);he.properties.push(Lt)}return this.finishNode(he,B?"ObjectPattern":"ObjectExpression")};Kt.parseProperty=function(B,X){var he=this.startNode(),Ae,$t,Lt,Ot;if(this.options.ecmaVersion>=9&&this.eat(jt.ellipsis)){if(B){if(he.argument=this.parseIdent(!1),this.type===jt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(he,"RestElement")}if(he.argument=this.parseMaybeAssign(!1,X),this.type===jt.comma&&X&&X.trailingComma<0)X.trailingComma=this.start;return this.finishNode(he,"SpreadElement")}if(this.options.ecmaVersion>=6){if(he.method=!1,he.shorthand=!1,B||X)Lt=this.start,Ot=this.startLoc;if(!B)Ae=this.eat(jt.star)}var _t=this.containsEsc;if(this.parsePropertyName(he),!B&&!_t&&this.options.ecmaVersion>=8&&!Ae&&this.isAsyncProp(he))$t=!0,Ae=this.options.ecmaVersion>=9&&this.eat(jt.star),this.parsePropertyName(he);else $t=!1;return this.parsePropertyValue(he,B,Ae,$t,Lt,Ot,X,_t),this.finishNode(he,"Property")};Kt.parseGetterSetter=function(B){var X=B.key.name;this.parsePropertyName(B),B.value=this.parseMethod(!1),B.kind=X;var he=B.kind==="get"?0:1;if(B.value.params.length!==he){var Ae=B.value.start;if(B.kind==="get")this.raiseRecoverable(Ae,"getter should have no params");else this.raiseRecoverable(Ae,"setter should have exactly one param")}else if(B.kind==="set"&&B.value.params[0].type==="RestElement")this.raiseRecoverable(B.value.params[0].start,"Setter cannot use rest params")};Kt.parsePropertyValue=function(B,X,he,Ae,$t,Lt,Ot,_t){if((he||Ae)&&this.type===jt.colon)this.unexpected();if(this.eat(jt.colon))B.value=X?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,Ot),B.kind="init";else if(this.options.ecmaVersion>=6&&this.type===jt.parenL){if(X)this.unexpected();B.method=!0,B.value=this.parseMethod(he,Ae),B.kind="init"}else if(!X&&!_t&&this.options.ecmaVersion>=5&&!B.computed&&B.key.type==="Identifier"&&(B.key.name==="get"||B.key.name==="set")&&(this.type!==jt.comma&&this.type!==jt.braceR&&this.type!==jt.eq)){if(he||Ae)this.unexpected();this.parseGetterSetter(B)}else if(this.options.ecmaVersion>=6&&!B.computed&&B.key.type==="Identifier"){if(he||Ae)this.unexpected();if(this.checkUnreserved(B.key),B.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=$t;if(X)B.value=this.parseMaybeDefault($t,Lt,this.copyNode(B.key));else if(this.type===jt.eq&&Ot){if(Ot.shorthandAssign<0)Ot.shorthandAssign=this.start;B.value=this.parseMaybeDefault($t,Lt,this.copyNode(B.key))}else B.value=this.copyNode(B.key);B.kind="init",B.shorthand=!0}else this.unexpected()};Kt.parsePropertyName=function(B){if(this.options.ecmaVersion>=6)if(this.eat(jt.bracketL))return B.computed=!0,B.key=this.parseMaybeAssign(),this.expect(jt.bracketR),B.key;else B.computed=!1;return B.key=this.type===jt.num||this.type===jt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};Kt.initFunction=function(B){if(B.id=null,this.options.ecmaVersion>=6)B.generator=B.expression=!1;if(this.options.ecmaVersion>=8)B.async=!1};Kt.parseMethod=function(B,X,he){var Ae=this.startNode(),$t=this.yieldPos,Lt=this.awaitPos,Ot=this.awaitIdentPos;if(this.initFunction(Ae),this.options.ecmaVersion>=6)Ae.generator=B;if(this.options.ecmaVersion>=8)Ae.async=!!X;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Pi(X,Ae.generator)|ks|(he?So:0)),this.expect(jt.parenL),Ae.params=this.parseBindingList(jt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(Ae,!1,!0,!1),this.yieldPos=$t,this.awaitPos=Lt,this.awaitIdentPos=Ot,this.finishNode(Ae,"FunctionExpression")};Kt.parseArrowExpression=function(B,X,he,Ae){var $t=this.yieldPos,Lt=this.awaitPos,Ot=this.awaitIdentPos;if(this.enterScope(Pi(he,!1)|$i),this.initFunction(B),this.options.ecmaVersion>=8)B.async=!!he;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,B.params=this.toAssignableList(X,!0),this.parseFunctionBody(B,!0,!1,Ae),this.yieldPos=$t,this.awaitPos=Lt,this.awaitIdentPos=Ot,this.finishNode(B,"ArrowFunctionExpression")};Kt.parseFunctionBody=function(B,X,he,Ae){var $t=X&&this.type!==jt.braceL,Lt=this.strict,Ot=!1;if($t)B.body=this.parseMaybeAssign(Ae),B.expression=!0,this.checkParams(B,!1);else{var _t=this.options.ecmaVersion>=7&&!this.isSimpleParamList(B.params);if(!Lt||_t){if(Ot=this.strictDirective(this.end),Ot&&_t)this.raiseRecoverable(B.start,"Illegal 'use strict' directive in function with non-simple parameter list")}var It=this.labels;if(this.labels=[],Ot)this.strict=!0;if(this.checkParams(B,!Lt&&!Ot&&!X&&!he&&this.isSimpleParamList(B.params)),this.strict&&B.id)this.checkLValSimple(B.id,Po);B.body=this.parseBlock(!1,void 0,Ot&&!Lt),B.expression=!1,this.adaptDirectivePrologue(B.body.body),this.labels=It}this.exitScope()};Kt.isSimpleParamList=function(B){for(var X=0,he=B;X<he.length;X+=1){var Ae=he[X];if(Ae.type!=="Identifier")return!1}return!0};Kt.checkParams=function(B,X){var he=Object.create(null);for(var Ae=0,$t=B.params;Ae<$t.length;Ae+=1){var Lt=$t[Ae];this.checkLValInnerPattern(Lt,Ti,X?null:he)}};Kt.parseExprList=function(B,X,he,Ae){var $t=[],Lt=!0;while(!this.eat(B)){if(!Lt){if(this.expect(jt.comma),X&&this.afterTrailingComma(B))break}else Lt=!1;var Ot=void 0;if(he&&this.type===jt.comma)Ot=null;else if(this.type===jt.ellipsis){if(Ot=this.parseSpread(Ae),Ae&&this.type===jt.comma&&Ae.trailingComma<0)Ae.trailingComma=this.start}else Ot=this.parseMaybeAssign(!1,Ae);$t.push(Ot)}return $t};Kt.checkUnreserved=function(B){var{start:X,end:he,name:Ae}=B;if(this.inGenerator&&Ae==="yield")this.raiseRecoverable(X,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&Ae==="await")this.raiseRecoverable(X,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&$s)&&Ae==="arguments")this.raiseRecoverable(X,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(Ae==="arguments"||Ae==="await"))this.raise(X,"Cannot use "+Ae+" in class static initialization block");if(this.keywords.test(Ae))this.raise(X,"Unexpected keyword '"+Ae+"'");if(this.options.ecmaVersion<6&&this.input.slice(X,he).indexOf("\\")!==-1)return;var $t=this.strict?this.reservedWordsStrict:this.reservedWords;if($t.test(Ae)){if(!this.inAsync&&Ae==="await")this.raiseRecoverable(X,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(X,"The keyword '"+Ae+"' is reserved")}};Kt.parseIdent=function(B){var X=this.parseIdentNode();if(this.next(!!B),this.finishNode(X,"Identifier"),!B){if(this.checkUnreserved(X),X.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=X.start}return X};Kt.parseIdentNode=function(){var B=this.startNode();if(this.type===jt.name)B.name=this.value;else if(this.type.keyword){if(B.name=this.type.keyword,(B.name==="class"||B.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=jt.name}else this.unexpected();return B};Kt.parsePrivateIdent=function(){var B=this.startNode();if(this.type===jt.privateId)B.name=this.value;else this.unexpected();if(this.next(),this.finishNode(B,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(B.start,"Private field '#"+B.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(B);return B};Kt.parseYield=function(B){if(!this.yieldPos)this.yieldPos=this.start;var X=this.startNode();if(this.next(),this.type===jt.semi||this.canInsertSemicolon()||this.type!==jt.star&&!this.type.startsExpr)X.delegate=!1,X.argument=null;else X.delegate=this.eat(jt.star),X.argument=this.parseMaybeAssign(B);return this.finishNode(X,"YieldExpression")};Kt.parseAwait=function(B){if(!this.awaitPos)this.awaitPos=this.start;var X=this.startNode();return this.next(),X.argument=this.parseMaybeUnary(null,!0,!1,B),this.finishNode(X,"AwaitExpression")};var Cs=r.prototype;Cs.raise=function(B,X){var he=Eo(this.input,B);if(X+=" ("+he.line+":"+he.column+")",this.sourceFile)X+=" in "+this.sourceFile;var Ae=SyntaxError(X);throw Ae.pos=B,Ae.loc=he,Ae.raisedAt=this.pos,Ae};Cs.raiseRecoverable=Cs.raise;Cs.curPosition=function(){if(this.options.locations)return new os(this.curLine,this.pos-this.lineStart)};var An=r.prototype,xc=function(B){this.flags=B,this.var=[],this.lexical=[],this.functions=[]};An.enterScope=function(B){this.scopeStack.push(new xc(B))};An.exitScope=function(){this.scopeStack.pop()};An.treatFunctionsAsVarInScope=function(B){return B.flags&On||!this.inModule&&B.flags&Ln};An.declareName=function(B,X,he){var Ae=!1;if(X===kn){var $t=this.currentScope();if(Ae=$t.lexical.indexOf(B)>-1||$t.functions.indexOf(B)>-1||$t.var.indexOf(B)>-1,$t.lexical.push(B),this.inModule&&$t.flags&Ln)delete this.undefinedExports[B]}else if(X===$o){var Lt=this.currentScope();Lt.lexical.push(B)}else if(X===ko){var Ot=this.currentScope();if(this.treatFunctionsAsVar)Ae=Ot.lexical.indexOf(B)>-1;else Ae=Ot.lexical.indexOf(B)>-1||Ot.var.indexOf(B)>-1;Ot.functions.push(B)}else for(var _t=this.scopeStack.length-1;_t>=0;--_t){var It=this.scopeStack[_t];if(It.lexical.indexOf(B)>-1&&!(It.flags&Co&&It.lexical[0]===B)||!this.treatFunctionsAsVarInScope(It)&&It.functions.indexOf(B)>-1){Ae=!0;break}if(It.var.push(B),this.inModule&&It.flags&Ln)delete this.undefinedExports[B];if(It.flags&$s)break}if(Ae)this.raiseRecoverable(he,"Identifier '"+B+"' has already been declared")};An.checkLocalExport=function(B){if(this.scopeStack[0].lexical.indexOf(B.name)===-1&&this.scopeStack[0].var.indexOf(B.name)===-1)this.undefinedExports[B.name]=B};An.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};An.currentVarScope=function(){for(var B=this.scopeStack.length-1;;B--){var X=this.scopeStack[B];if(X.flags&($s|ps|Mn))return X}};An.currentThisScope=function(){for(var B=this.scopeStack.length-1;;B--){var X=this.scopeStack[B];if(X.flags&($s|ps|Mn)&&!(X.flags&$i))return X}};var Ts=function(B,X,he){if(this.type="",this.start=X,this.end=0,B.options.locations)this.loc=new ws(B,he);if(B.options.directSourceFile)this.sourceFile=B.options.directSourceFile;if(B.options.ranges)this.range=[X,0]},cs=r.prototype;cs.startNode=function(){return new Ts(this,this.start,this.startLoc)};cs.startNodeAt=function(B,X){return new Ts(this,B,X)};function No(B,X,he,Ae){if(B.type=X,B.end=he,this.options.locations)B.loc.end=Ae;if(this.options.ranges)B.range[1]=he;return B}cs.finishNode=function(B,X){return No.call(this,B,X,this.lastTokEnd,this.lastTokEndLoc)};cs.finishNodeAt=function(B,X,he,Ae){return No.call(this,B,X,he,Ae)};cs.copyNode=function(B){var X=new Ts(this,B.start,this.startLoc);for(var he in B)X[he]=B[he];return X};var _o=function(){};_o.prototype.reset=function(){};r.prototype.validateRegExpFlags=function(){};r.prototype.validateRegExpPattern=function(){};var Ni=function(B){if(this.type=B.type,this.value=B.value,this.start=B.start,this.end=B.end,B.options.locations)this.loc=new ws(B,B.startLoc,B.endLoc);if(B.options.ranges)this.range=[B.start,B.end]},Jt=r.prototype;Jt.next=function(B){if(!B&&this.type.keyword&&this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword);if(this.options.onToken)this.options.onToken(new Ni(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};Jt.getToken=function(){return this.next(),new Ni(this)};if(typeof Symbol<"u")Jt[Symbol.iterator]=function(){var B=this;return{next:function(){var X=B.getToken();return{done:X.type===jt.eof,value:X}}}};Jt.nextToken=function(){var B=this.curContext();if(!B||!B.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(jt.eof);if(B.override)return B.override(this);else this.readToken(this.fullCharCodeAtPos())};Jt.readToken=function(B){if(f(B,this.options.ecmaVersion>=6)||B===92)return this.readWord();return this.getTokenFromCode(B)};Jt.fullCharCodeAt=function(B){var X=this.input.charCodeAt(B);if(X<=55295||X>=56320)return X;var he=this.input.charCodeAt(B+1);return he<=56319||he>=57344?X:(X<<10)+he-56613888};Jt.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};Jt.skipBlockComment=function(){var B=this.options.onComment&&this.curPosition(),X=this.pos,he=this.input.indexOf("*/",this.pos+=2);if(he===-1)this.raise(this.pos-2,"Unterminated comment");if(this.pos=he+2,this.options.locations)for(var Ae=void 0,$t=X;(Ae=xo(this.input,$t,this.pos))>-1;)++this.curLine,$t=this.lineStart=Ae;if(this.options.onComment)this.options.onComment(!0,this.input.slice(X+2,he),X,this.pos,B,this.curPosition())};Jt.skipLineComment=function(B){var X=this.pos,he=this.options.onComment&&this.curPosition(),Ae=this.input.charCodeAt(this.pos+=B);while(this.pos<this.input.length&&!Hn(Ae))Ae=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(X+B,this.pos),X,this.pos,he,this.curPosition())};Jt.skipSpace=function(){e:while(this.pos<this.input.length){var B=this.input.charCodeAt(this.pos);switch(B){case 32:case 160:++this.pos;break;case 13:if(this.input.charCodeAt(this.pos+1)===10)++this.pos;case 10:case 8232:case 8233:if(++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(B>8&&B<14||B>=5760&&vo.test(String.fromCharCode(B)))++this.pos;else break e}}};Jt.finishToken=function(B,X){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var he=this.type;this.type=B,this.value=X,this.updateContext(he)};Jt.readToken_dot=function(){var B=this.input.charCodeAt(this.pos+1);if(B>=48&&B<=57)return this.readNumber(!0);var X=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&B===46&&X===46)return this.pos+=3,this.finishToken(jt.ellipsis);else return++this.pos,this.finishToken(jt.dot)};Jt.readToken_slash=function(){var B=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(B===61)return this.finishOp(jt.assign,2);return this.finishOp(jt.slash,1)};Jt.readToken_mult_modulo_exp=function(B){var X=this.input.charCodeAt(this.pos+1),he=1,Ae=B===42?jt.star:jt.modulo;if(this.options.ecmaVersion>=7&&B===42&&X===42)++he,Ae=jt.starstar,X=this.input.charCodeAt(this.pos+2);if(X===61)return this.finishOp(jt.assign,he+1);return this.finishOp(Ae,he)};Jt.readToken_pipe_amp=function(B){var X=this.input.charCodeAt(this.pos+1);if(X===B){if(this.options.ecmaVersion>=12){var he=this.input.charCodeAt(this.pos+2);if(he===61)return this.finishOp(jt.assign,3)}return this.finishOp(B===124?jt.logicalOR:jt.logicalAND,2)}if(X===61)return this.finishOp(jt.assign,2);return this.finishOp(B===124?jt.bitwiseOR:jt.bitwiseAND,1)};Jt.readToken_caret=function(){var B=this.input.charCodeAt(this.pos+1);if(B===61)return this.finishOp(jt.assign,2);return this.finishOp(jt.bitwiseXOR,1)};Jt.readToken_plus_min=function(B){var X=this.input.charCodeAt(this.pos+1);if(X===B){if(X===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||un.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(jt.incDec,2)}if(X===61)return this.finishOp(jt.assign,2);return this.finishOp(jt.plusMin,1)};Jt.readToken_lt_gt=function(B){var X=this.input.charCodeAt(this.pos+1),he=1;if(X===B){if(he=B===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+he)===61)return this.finishOp(jt.assign,he+1);return this.finishOp(jt.bitShift,he)}if(X===33&&B===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45)return this.skipLineComment(4),this.skipSpace(),this.nextToken();if(X===61)he=2;return this.finishOp(jt.relational,he)};Jt.readToken_eq_excl=function(B){var X=this.input.charCodeAt(this.pos+1);if(X===61)return this.finishOp(jt.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(B===61&&X===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(jt.arrow);return this.finishOp(B===61?jt.eq:jt.prefix,1)};Jt.readToken_question=function(){var B=this.options.ecmaVersion;if(B>=11){var X=this.input.charCodeAt(this.pos+1);if(X===46){var he=this.input.charCodeAt(this.pos+2);if(he<48||he>57)return this.finishOp(jt.questionDot,2)}if(X===63){if(B>=12){var Ae=this.input.charCodeAt(this.pos+2);if(Ae===61)return this.finishOp(jt.assign,3)}return this.finishOp(jt.coalesce,2)}}return this.finishOp(jt.question,1)};Jt.readToken_numberSign=function(){var B=this.options.ecmaVersion,X=35;if(B>=13){if(++this.pos,X=this.fullCharCodeAtPos(),f(X,!0)||X===92)return this.finishToken(jt.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+Ss(X)+"'")};Jt.getTokenFromCode=function(B){switch(B){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(jt.parenL);case 41:return++this.pos,this.finishToken(jt.parenR);case 59:return++this.pos,this.finishToken(jt.semi);case 44:return++this.pos,this.finishToken(jt.comma);case 91:return++this.pos,this.finishToken(jt.bracketL);case 93:return++this.pos,this.finishToken(jt.bracketR);case 123:return++this.pos,this.finishToken(jt.braceL);case 125:return++this.pos,this.finishToken(jt.braceR);case 58:return++this.pos,this.finishToken(jt.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(jt.backQuote);case 48:var X=this.input.charCodeAt(this.pos+1);if(X===120||X===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(X===111||X===79)return this.readRadixNumber(8);if(X===98||X===66)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(B);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(B);case 124:case 38:return this.readToken_pipe_amp(B);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(B);case 60:case 62:return this.readToken_lt_gt(B);case 61:case 33:return this.readToken_eq_excl(B);case 63:return this.readToken_question();case 126:return this.finishOp(jt.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Ss(B)+"'")};Jt.finishOp=function(B,X){var he=this.input.slice(this.pos,this.pos+X);return this.pos+=X,this.finishToken(B,he)};Jt.readRegexp=function(){var B,X,he=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(he,"Unterminated regular expression");var Ae=this.input.charAt(this.pos);if(un.test(Ae))this.raise(he,"Unterminated regular expression");if(!B){if(Ae==="[")X=!0;else if(Ae==="]"&&X)X=!1;else if(Ae==="/"&&!X)break;B=Ae==="\\"}else B=!1;++this.pos}var $t=this.input.slice(he,this.pos);++this.pos;var Lt=this.pos,Ot=this.readWord1();if(this.containsEsc)this.unexpected(Lt);var _t=this.regexpState||(this.regexpState=new _o(this));_t.reset(he,$t,Ot),this.validateRegExpFlags(_t),this.validateRegExpPattern(_t);var It=null;try{It=new RegExp($t,Ot)}catch(Mt){}return this.finishToken(jt.regexp,{pattern:$t,flags:Ot,value:It})};Jt.readInt=function(B,X,he){var Ae=this.options.ecmaVersion>=12&&X===void 0,$t=he&&this.input.charCodeAt(this.pos)===48,Lt=this.pos,Ot=0,_t=0;for(var It=0,Mt=X==null?1/0:X;It<Mt;++It,++this.pos){var Ft=this.input.charCodeAt(this.pos),Vt=void 0;if(Ae&&Ft===95){if($t)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(_t===95)this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore");if(It===0)this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits");_t=Ft;continue}if(Ft>=97)Vt=Ft-97+10;else if(Ft>=65)Vt=Ft-65+10;else if(Ft>=48&&Ft<=57)Vt=Ft-48;else Vt=1/0;if(Vt>=B)break;_t=Ft,Ot=Ot*B+Vt}if(Ae&&_t===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===Lt||X!=null&&this.pos-Lt!==X)return null;return Ot};function vc(B,X){if(X)return parseInt(B,8);return parseFloat(B.replace(/_/g,""))}function Do(B){if(typeof BigInt!=="function")return null;return BigInt(B.replace(/_/g,""))}Jt.readRadixNumber=function(B){var X=this.pos;this.pos+=2;var he=this.readInt(B);if(he==null)this.raise(this.start+2,"Expected number in radix "+B);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)he=Do(this.input.slice(X,this.pos)),++this.pos;else if(f(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(jt.num,he)};Jt.readNumber=function(B){var X=this.pos;if(!B&&this.readInt(10,void 0,!0)===null)this.raise(X,"Invalid number");var he=this.pos-X>=2&&this.input.charCodeAt(X)===48;if(he&&this.strict)this.raise(X,"Invalid number");var Ae=this.input.charCodeAt(this.pos);if(!he&&!B&&this.options.ecmaVersion>=11&&Ae===110){var $t=Do(this.input.slice(X,this.pos));if(++this.pos,f(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(jt.num,$t)}if(he&&/[89]/.test(this.input.slice(X,this.pos)))he=!1;if(Ae===46&&!he)++this.pos,this.readInt(10),Ae=this.input.charCodeAt(this.pos);if((Ae===69||Ae===101)&&!he){if(Ae=this.input.charCodeAt(++this.pos),Ae===43||Ae===45)++this.pos;if(this.readInt(10)===null)this.raise(X,"Invalid number")}if(f(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var Lt=vc(this.input.slice(X,this.pos),he);return this.finishToken(jt.num,Lt)};Jt.readCodePoint=function(){var B=this.input.charCodeAt(this.pos),X;if(B===123){if(this.options.ecmaVersion<6)this.unexpected();var he=++this.pos;if(X=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,X>1114111)this.invalidStringToken(he,"Code point out of bounds")}else X=this.readHexChar(4);return X};Jt.readString=function(B){var X="",he=++this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated string constant");var Ae=this.input.charCodeAt(this.pos);if(Ae===B)break;if(Ae===92)X+=this.input.slice(he,this.pos),X+=this.readEscapedChar(!1),he=this.pos;else if(Ae===8232||Ae===8233){if(this.options.ecmaVersion<10)this.raise(this.start,"Unterminated string constant");if(++this.pos,this.options.locations)this.curLine++,this.lineStart=this.pos}else{if(Hn(Ae))this.raise(this.start,"Unterminated string constant");++this.pos}}return X+=this.input.slice(he,this.pos++),this.finishToken(jt.string,X)};var Ro={};Jt.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(B){if(B===Ro)this.readInvalidTemplateToken();else throw B}this.inTemplateElement=!1};Jt.invalidStringToken=function(B,X){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ro;else this.raise(B,X)};Jt.readTmplToken=function(){var B="",X=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated template");var he=this.input.charCodeAt(this.pos);if(he===96||he===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===jt.template||this.type===jt.invalidTemplate))if(he===36)return this.pos+=2,this.finishToken(jt.dollarBraceL);else return++this.pos,this.finishToken(jt.backQuote);return B+=this.input.slice(X,this.pos),this.finishToken(jt.template,B)}if(he===92)B+=this.input.slice(X,this.pos),B+=this.readEscapedChar(!0),X=this.pos;else if(Hn(he)){switch(B+=this.input.slice(X,this.pos),++this.pos,he){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:B+=`
|
|
8
|
-
`;break;default:B+=String.fromCharCode(he);break}if(this.options.locations)++this.curLine,this.lineStart=this.pos;X=this.pos}else++this.pos}};Jt.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(jt.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":if(this.input[this.pos+1]===`
|
|
9
|
-
`)++this.pos;case`
|
|
10
|
-
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};Jt.readEscapedChar=function(B){var X=this.input.charCodeAt(++this.pos);switch(++this.pos,X){case 110:return`
|
|
11
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Ss(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:if(this.options.locations)this.lineStart=this.pos,++this.curLine;return"";case 56:case 57:if(this.strict)this.invalidStringToken(this.pos-1,"Invalid escape sequence");if(B){var he=this.pos-1;this.invalidStringToken(he,"Invalid escape sequence in template string")}default:if(X>=48&&X<=55){var Ae=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],$t=parseInt(Ae,8);if($t>255)Ae=Ae.slice(0,-1),$t=parseInt(Ae,8);if(this.pos+=Ae.length-1,X=this.input.charCodeAt(this.pos),(Ae!=="0"||X===56||X===57)&&(this.strict||B))this.invalidStringToken(this.pos-1-Ae.length,B?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode($t)}if(Hn(X)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(X)}};Jt.readHexChar=function(B){var X=this.pos,he=this.readInt(16,B);if(he===null)this.invalidStringToken(X,"Bad character escape sequence");return he};Jt.readWord1=function(){this.containsEsc=!1;var B="",X=!0,he=this.pos,Ae=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var $t=this.fullCharCodeAtPos();if(y($t,Ae))this.pos+=$t<=65535?1:2;else if($t===92){this.containsEsc=!0,B+=this.input.slice(he,this.pos);var Lt=this.pos;if(this.input.charCodeAt(++this.pos)!==117)this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX");++this.pos;var Ot=this.readCodePoint();if(!(X?f:y)(Ot,Ae))this.invalidStringToken(Lt,"Invalid Unicode escape");B+=Ss(Ot),he=this.pos}else break;X=!1}return B+this.input.slice(he,this.pos)};Jt.readWord=function(){var B=this.readWord1(),X=jt.name;if(this.keywords.test(B))X=wi[B];return this.finishToken(X,B)};var Ec="8.18.0";r.acorn={Parser:r,version:Ec,defaultOptions:Ei,Position:os,SourceLocation:ws,getLineInfo:Eo,Node:Ts,TokenType:Qt,tokTypes:jt,keywordTypes:wi,TokContext:vn,tokContexts:en,isIdentifierChar:y,isIdentifierStart:f,Token:Ni,isNewLine:Hn,lineBreak:un,lineBreakG:oc,nonASCIIwhitespace:vo};function _i(B){return(X)=>B(X)}function Di(...B){return r.extend(...B)}var fi=/(?:\s|\/\/.*|\/\*[\s\S]*?\*\/)*/g,bc=new Map([["any","TSAnyKeyword"],["bigint","TSBigIntKeyword"],["boolean","TSBooleanKeyword"],["never","TSNeverKeyword"],["null","TSNullKeyword"],["number","TSNumberKeyword"],["object","TSObjectKeyword"],["string","TSStringKeyword"],["symbol","TSSymbolKeyword"],["undefined","TSUndefinedKeyword"],["unknown","TSUnknownKeyword"],["void","TSVoidKeyword"]]),Cc=new Set("public private protected readonly declare abstract override static accessor".split(" ")),Sc=new Set("public private protected readonly override".split(" ")),wc=new Set("var let const function class abstract enum interface type namespace module global".split(" ")),kc=new Set("var let const function class interface enum".split(" ")),oo=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),ao=1,$c=32,Pc=256,Tc=0,Ac=1,is=2,Nc=3,_c=4,mi=6,po=7,Io=256,Si=1024,Dc=8|Si,Rc=is|Io,co=1,Ic=2,lo=40,Lc=41,Oc=44,uo=46,ho=58,xs=61,fo=60,vs=123,Mc=91,gi=42,Fc=35,yi=34,xi=39,jc=SyntaxError("speculative parse failed"),re=_i((B)=>{let{tokTypes:X,keywordTypes:he,isIdentifierChar:Ae,isIdentifierStart:$t}=B.acorn,Lt=new B.acorn.TokenType("@");class Ot extends B{inType=!1;$5=!1;$6=!1;$8=null;$o=null;$p=!1;$q=!1;$i=null;$b=[[]];$r=0;$12=0;constructor(_t,It,Mt){super(_t,It,Mt);let Ft=this.options.onComment;if(typeof Ft==="function")this.options.onComment=(Vt,Bt,Gt,Wt,Ut,Ht)=>{if(Gt<this.$12)return;this.$12=Wt,Ft.call(this,Vt,Bt,Gt,Wt,Ut,Ht)}}getTokenFromCode(_t){if(_t===64)return++this.pos,this.finishToken(Lt);return super.getTokenFromCode(_t)}readToken_lt_gt(_t){if(this.inType)return this.finishOp(X.relational,1);return super.readToken_lt_gt(_t)}$9(_t){let It=this.inType;this.inType=!0;let Mt=_t();if(this.inType=It,!It&&this.type===X.relational)this.pos=this.start,this.nextToken();return Mt}$1(){return this.type===X.relational&&this.value==="<"}$k(){if(this.type===X.bitShift&&this.value==="<<")this.pos=this.start+1,this.finishToken(X.relational,"<");return this.$1()}$c(){return this.type===X.relational&&this.value===">"}$s(){return this.type===X.prefix&&this.value==="!"}hasPrecedingLineBreak(){return this.$13(this.lastTokEnd,this.start)}$13(_t,It){for(let Mt=_t;Mt<It;Mt++){let Ft=this.input.charCodeAt(Mt);if(Ft===10||Ft===13||Ft===8232||Ft===8233)return!0}return!1}$d(_t=this.pos){return fi.lastIndex=_t,fi.exec(this.input),fi.lastIndex}$2(){return this.input.charCodeAt(this.$d())}$3(){let _t=this.$d(),It=_t;while(It<this.input.length&&Ae(this.input.charCodeAt(It)))It++;return this.input.slice(_t,It)}$a(){return!this.$13(this.pos,this.$d())}$14(){return this.$a()&&$t(this.$2())&&!Object.hasOwn(he,this.$3())}$15(){return{pos:this.pos,type:this.type,value:this.value,start:this.start,end:this.end,startLoc:this.startLoc,endLoc:this.endLoc,lastTokStart:this.lastTokStart,lastTokEnd:this.lastTokEnd,lastTokStartLoc:this.lastTokStartLoc,lastTokEndLoc:this.lastTokEndLoc,curLine:this.curLine,lineStart:this.lineStart,context:this.context.slice(),exprAllowed:this.exprAllowed,containsEsc:this.containsEsc,inType:this.inType,$5:this.$5,$6:this.$6,$8:this.$8,scopes:this.scopeStack.length,privateNames:this.privateNameStack.length,labels:this.labels,labelCount:this.labels.length,strict:this.strict,yieldPos:this.yieldPos,awaitPos:this.awaitPos,awaitIdentPos:this.awaitIdentPos,potentialArrowAt:this.potentialArrowAt,potentialArrowInForAwait:this.potentialArrowInForAwait}}$16(_t){this.pos=_t.pos,this.type=_t.type,this.value=_t.value,this.start=_t.start,this.end=_t.end,this.startLoc=_t.startLoc,this.endLoc=_t.endLoc,this.lastTokStart=_t.lastTokStart,this.lastTokEnd=_t.lastTokEnd,this.lastTokStartLoc=_t.lastTokStartLoc,this.lastTokEndLoc=_t.lastTokEndLoc,this.curLine=_t.curLine,this.lineStart=_t.lineStart,this.context=_t.context,this.exprAllowed=_t.exprAllowed,this.containsEsc=_t.containsEsc,this.inType=_t.inType,this.$5=_t.$5,this.$6=_t.$6,this.$8=_t.$8,this.scopeStack.length=_t.scopes,this.privateNameStack.length=_t.privateNames,this.labels=_t.labels,this.labels.length=_t.labelCount,this.strict=_t.strict,this.yieldPos=_t.yieldPos,this.awaitPos=_t.awaitPos,this.awaitIdentPos=_t.awaitIdentPos,this.potentialArrowAt=_t.potentialArrowAt,this.potentialArrowInForAwait=_t.potentialArrowInForAwait}raise(_t,It){if(this.$r>0)throw jc;return super.raise(_t,It)}$1y(_t,It){try{super.raise(_t,It)}catch(Mt){if(Mt instanceof SyntaxError)Mt.$1z=!0;throw Mt}throw Error("unreachable")}$f(_t,It=!1){let Mt=this.$15();this.$r++;try{let Ft=_t();if(It||Ft===void 0)this.$16(Mt);return Ft}catch(Ft){if(!(Ft instanceof SyntaxError)||!It&&Ft.$1z)throw Ft;this.$16(Mt);return}finally{this.$r--}}$t(_t){return this.$f(_t,!0)===!0}$17(_t){if(_t.end=this.lastTokEnd,this.options.locations)_t.loc.end=this.lastTokEndLoc}$l(_t,It){if(_t.start=It.start,this.options.locations)_t.loc.start=It.loc.start}$4(_t=!1){let It=this.startNode();return It.typeAnnotation=this.$9(()=>(this.next(),_t?this.$20():this.$0())),this.finishNode(It,"TSTypeAnnotation")}$g(_t,It){if(It&&this.eat(X.question))_t.optional=!0,this.$17(_t);if(this.type===X.colon)_t.typeAnnotation=this.$4(),this.$17(_t);return _t}$20(){if(this.type!==X.name&&this.type!==X._this)return this.$0();if(this.isContextual("asserts")&&this.$a()&&$t(this.$2())){let _t=this.startNode();if(this.next(),_t.parameterName=this.type===X._this?this.$u():this.parseIdent(),this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.$v(_t,!0);return _t.asserts=!0,_t.typeAnnotation=null,this.finishNode(_t,"TSTypePredicate")}if(this.$3()==="is"&&this.$a()){let _t=this.startNode();return _t.parameterName=this.type===X._this?this.$u():this.parseIdent(!0),this.$v(_t,!1)}return this.$0()}$v(_t,It){this.next();let Mt=this.startNode();return Mt.typeAnnotation=this.$0(),_t.typeAnnotation=this.finishNode(Mt,"TSTypeAnnotation"),_t.asserts=It,this.finishNode(_t,"TSTypePredicate")}$u(){let _t=this.startNode();return this.next(),this.finishNode(_t,"TSThisType")}parseWholeType(){this.inType=!0,this.nextToken();let _t=this.$0();if(this.type!==X.eof)this.unexpected();return _t}$0(){let _t=this.$18();if(this.$5||this.type!==X._extends||this.hasPrecedingLineBreak())return _t;let It=this.startNodeAt(_t.start,_t.loc?.start);return this.next(),It.checkType=_t,It.extendsType=this.$h(!0,()=>this.$18()),this.expect(X.question),It.trueType=this.$h(!1,()=>this.$0()),this.expect(X.colon),It.falseType=this.$h(!1,()=>this.$0()),this.finishNode(It,"TSConditionalType")}$h(_t,It){let Mt=this.$5;this.$5=_t;let Ft=It();return this.$5=Mt,Ft}$18(){if(this.$21())return this.$19("TSFunctionType");if(this.type===X._new||this.isContextual("abstract")&&this.$3()==="new")return this.$19("TSConstructorType");return this.$1a("TSUnionType",X.bitwiseOR,()=>this.$1a("TSIntersectionType",X.bitwiseAND,()=>this.$1b()))}$19(_t){let It=this.startNode();if(_t==="TSConstructorType"){if(It.abstract=this.isContextual("abstract"),It.abstract)this.next();this.next()}return this.$h(!1,()=>this.$m(It,X.arrow)),this.finishNode(It,_t)}$m(_t,It){if(this.$1())_t.typeParameters=this.$7();if(this.expect(X.parenL),_t.parameters=this.parseBindingList(X.parenR,!1,!0),this.type===It)_t.typeAnnotation=this.$4(!0);else if(It===X.arrow)this.unexpected()}$21(){if(this.$1())return!0;if(this.type!==X.parenL)return!1;return this.$t(()=>{if(this.next(),this.type===X.parenR||this.type===X.ellipsis)return!0;if(this.type===X.name||this.type===X._this)this.next();else if(this.type===X.braceL||this.type===X.bracketL)this.parseBindingAtom();else return!1;let _t=this.type;if(_t===X.colon||_t===X.comma||_t===X.question||_t===X.eq)return!0;if(_t!==X.parenR)return!1;return this.next(),this.type===X.arrow})}$1a(_t,It,Mt){let Ft=this.startNode(),Vt=this.eat(It),Bt=[];do Bt.push(Mt());while(this.eat(It));if(Bt.length===1&&!Vt)return Bt[0];return Ft.types=Bt,this.finishNode(Ft,_t)}$1b(){if(this.type===X.name&&!this.containsEsc){let _t=this.value;if(_t==="keyof"||_t==="unique"||_t==="readonly"){let It=this.startNode();return this.next(),It.operator=_t,It.typeAnnotation=this.$1b(),this.finishNode(It,"TSTypeOperator")}if(_t==="infer"){let It=this.startNode();this.next();let Mt=this.startNode();Mt.name=this.$w();let Ft=this.$f(()=>this.$22());if(Ft)Mt.constraint=Ft;return It.typeParameter=this.finishNode(Mt,"TSTypeParameter"),this.finishNode(It,"TSInferType")}}return this.$h(!1,()=>this.$23())}$22(){if(!this.eat(X._extends))return;let _t=this.$h(!0,()=>this.$0());if(this.$5||this.type!==X.question)return _t;return}$w(){if(this.type!==X.name&&!this.type.keyword)this.unexpected();let _t=this.type===X.name?this.value:this.type.keyword;return this.next(),_t}$23(){let _t=this.$24();while(!this.hasPrecedingLineBreak()&&this.eat(X.bracketL)){let It=this.startNodeAt(_t.start,_t.loc?.start);if(this.eat(X.bracketR))It.elementType=_t,_t=this.finishNode(It,"TSArrayType");else It.objectType=_t,It.indexType=this.$0(),this.expect(X.bracketR),_t=this.finishNode(It,"TSIndexedAccessType")}return _t}$24(){switch(this.type){case X.name:case X._void:case X._null:{let _t=bc.get(this.value);if(_t&&(this.type!==X.name||!this.containsEsc&&this.$2()!==uo)){let It=this.startNode();return this.next(),this.finishNode(It,_t)}return this.$1c()}case X.string:case X.num:case X._true:case X._false:{let _t=this.startNode();return _t.literal=this.parseExprAtom(),this.finishNode(_t,"TSLiteralType")}case X.plusMin:{if(this.value!=="-")break;let _t=this.startNode(),It=this.startNode();if(this.next(),this.type!==X.num)this.unexpected();return It.operator="-",It.prefix=!0,It.argument=this.parseExprAtom(),_t.literal=this.finishNode(It,"UnaryExpression"),this.finishNode(_t,"TSLiteralType")}case X.backQuote:return this.$25();case X._this:{let _t=this.$u();if(this.isContextual("is")&&!this.hasPrecedingLineBreak()){let It=this.startNodeAt(_t.start,_t.loc?.start);return It.parameterName=_t,this.$v(It,!1)}return _t}case X._typeof:return this.$26();case X._import:return this.$1d();case X.braceL:return this.$27()?this.$28():this.$29();case X.bracketL:return this.$2a();case X.parenL:{let _t=this.startNode();return this.next(),_t.typeAnnotation=this.$0(),this.expect(X.parenR),this.finishNode(_t,"TSParenthesizedType")}default:if(this.type.keyword)return this.$1c()}return this.unexpected()}$1c(){let _t=this.startNode();if(_t.typeName=this.$j(),!this.hasPrecedingLineBreak()&&this.$1())_t.typeArguments=this.$e();return this.finishNode(_t,"TSTypeReference")}$j(){let _t=this.parseIdent(!0);while(this.eat(X.dot)){let It=this.startNodeAt(_t.start,_t.loc?.start);It.left=_t,It.right=this.parseIdent(!0),_t=this.finishNode(It,"TSQualifiedName")}return _t}$26(){let _t=this.startNode();if(this.next(),_t.exprName=this.type===X._import?this.$1d():this.$j(),!this.hasPrecedingLineBreak()&&this.$1())_t.typeArguments=this.$e();return this.finishNode(_t,"TSTypeQuery")}$1d(){let _t=this.startNode();if(this.next(),_t.argument=this.$1e(),this.eat(X.dot))_t.qualifier=this.$j();if(this.$1())_t.typeArguments=this.$e();return this.finishNode(_t,"TSImportType")}$x(){if(this.type!==X.string)this.unexpected();return this.parseExprAtom()}$1e(){this.expect(X.parenL);let _t=this.$x();return this.expect(X.parenR),_t}$25(){let _t=this.startNode(),It=this.startNode();this.next(),It.expressions=[];let Mt=this.parseTemplateElement({isTagged:!1});It.quasis=[Mt];while(!Mt.tail){if(this.type===X.eof)this.raise(this.pos,"Unterminated template literal");this.expect(X.dollarBraceL),It.expressions.push(this.$0()),this.expect(X.braceR),Mt=this.parseTemplateElement({isTagged:!1}),It.quasis.push(Mt)}return this.next(),_t.literal=this.finishNode(It,"TemplateLiteral"),this.finishNode(_t,"TSLiteralType")}$27(){return this.$t(()=>{if(this.next(),this.type===X.plusMin)return this.next(),this.isContextual("readonly");if(this.isContextual("readonly"))this.next();if(this.type!==X.bracketL)return!1;if(this.next(),this.type!==X.name)return!1;return this.next(),this.type===X._in})}$28(){let _t=this.startNode();if(this.expect(X.braceL),this.type===X.plusMin)_t.readonly=this.value,this.next(),this.expectContextual("readonly");else if(this.eatContextual("readonly"))_t.readonly=!0;this.expect(X.bracketL);let It=this.startNode();if(It.name=this.$w(),this.expect(X._in),It.constraint=this.$0(),_t.typeParameter=this.finishNode(It,"TSTypeParameter"),_t.nameType=this.eatContextual("as")?this.$0():null,this.expect(X.bracketR),this.type===X.plusMin)_t.optional=this.value,this.next(),this.expect(X.question);else if(this.eat(X.question))_t.optional=!0;if(this.eat(X.colon))_t.typeAnnotation=this.$0();return this.semicolon(),this.expect(X.braceR),this.finishNode(_t,"TSMappedType")}$29(){let _t=this.startNode();return _t.members=this.$1f(),this.finishNode(_t,"TSTypeLiteral")}$1f(){this.expect(X.braceL);let _t=[];while(!this.eat(X.braceR))_t.push(this.$2b());return _t}$2b(){let _t=this.startNode(),It="TSPropertySignature",Mt=this.type===X._new?this.$2():-1;if(this.type===X.parenL||this.$1())It="TSCallSignatureDeclaration",this.$m(_t,X.colon);else if(Mt===lo||Mt===fo)It="TSConstructSignatureDeclaration",this.next(),this.$m(_t,X.colon);else{let Ft=this.type===X._new?this.parseIdent(!0):null;if(this.isContextual("readonly")&&this.$n(!0))this.next(),_t.readonly=!0;if(this.type===X.bracketL&&this.$1g())return this.$1h(_t);let Vt="method";if(Ft)_t.key=Ft;else{if((this.isContextual("get")||this.isContextual("set"))&&this.$n(!1))Vt=this.value,this.next();this.parsePropertyName(_t)}if(this.eat(X.question))_t.optional=!0;if(this.type===X.parenL||this.$1()){if(It="TSMethodSignature",Vt!=="method")_t.kind=Vt;this.$m(_t,X.colon),_t.kind=Vt}else if(this.type===X.colon)_t.typeAnnotation=this.$4()}return this.$1i(),this.finishNode(_t,It)}$1i(){if(!this.eat(X.comma))this.semicolon()}$1g(){return this.$t(()=>{if(this.next(),this.type!==X.name)return!1;return this.next(),this.type===X.colon})}$1h(_t){if(this.expect(X.bracketL),_t.parameters=[this.$g(this.parseIdent(),!1)],this.expect(X.bracketR),this.type===X.colon)_t.typeAnnotation=this.$4();return this.$1i(),this.finishNode(_t,"TSIndexSignature")}$2a(){let _t=this.startNode();this.expect(X.bracketL),_t.elementTypes=[];while(!this.eat(X.bracketR))if(_t.elementTypes.push(this.$2c()),this.type!==X.bracketR)this.expect(X.comma);return this.finishNode(_t,"TSTupleType")}$2c(){let _t=this.start,It=this.startLoc,Mt=this.eat(X.ellipsis),Ft;if((this.type===X.name||this.type.keyword)&&this.$2d()){let Vt=this.startNode();Vt.label=this.parseIdent(!0),Vt.optional=this.eat(X.question),this.expect(X.colon),Vt.elementType=this.$0(),Ft=this.finishNode(Vt,"TSNamedTupleMember")}else if(Ft=this.$0(),this.eat(X.question)){let Vt=this.startNodeAt(Ft.start,Ft.loc?.start);Vt.typeAnnotation=Ft,Ft=this.finishNode(Vt,"TSOptionalType")}if(Mt){let Vt=this.startNodeAt(_t,It);Vt.typeAnnotation=Ft,Ft=this.finishNode(Vt,"TSRestType")}return Ft}$2d(){let _t=this.$d();if(this.input.charCodeAt(_t)===63)_t=this.$d(_t+1);return this.input.charCodeAt(_t)===ho}$7(){return this.$9(()=>{let _t=this.startNode();this.next(),_t.params=[];while(!this.$c()){let It=this.startNode();while((this.type===X._const||this.type===X._in||this.isContextual("out"))&&$t(this.$2()))It[this.value]=!0,this.next();if(It.name=this.$w(),this.eat(X._extends))It.constraint=this.$0();if(this.eat(X.eq))It.default=this.$0();if(_t.params.push(this.finishNode(It,"TSTypeParameter")),!this.$c()){if(this.expect(X.comma),this.$c())_t.extra={trailingComma:this.lastTokStart}}}if(this.next(),_t.params.length===0)this.$1y(this.start,"Type parameter list cannot be empty.");return this.finishNode(_t,"TSTypeParameterDeclaration")})}$e(){return this.$9(()=>{let _t=this.startNode();this.next(),_t.params=[];while(!this.$c())if(_t.params.push(this.$0()),!this.$c())this.expect(X.comma);if(_t.params.length===0)this.unexpected();return this.next(),this.finishNode(_t,"TSTypeParameterInstantiation")})}$1j(){let _t=[];do{let It=this.startNode();if(It.expression=this.$j(),this.$1())It.typeParameters=this.$e();_t.push(this.finishNode(It,"TSExpressionWithTypeArguments"))}while(this.eat(X.comma));return _t}$1k(_t=!1){if(this.type!==X.name||this.containsEsc){if(this.type===X._const&&this.$3()==="enum")return this.$y(this.startNode());return}if(!this.$2e(this.value))return;if(this.value==="declare")return this.$2f(_t);return this.$1l(this.startNode(),this.value)}$2e(_t){switch(_t){case"interface":case"type":case"namespace":return this.$14();case"enum":return $t(this.$2());case"abstract":return this.$a()&&this.$3()==="class";case"module":{let It=this.$2();return this.$a()&&(It===yi||It===xi||$t(It))}case"declare":return this.$a()&&wc.has(this.$3());case"global":return this.$a()&&this.$2()===vs}return!1}$1l(_t,It){switch(It){case"interface":return this.$1m(_t);case"type":return this.$2g(_t);case"enum":return this.$y(_t);case"abstract":return this.$1n(_t,!0);case"global":return _t.global=!0,_t.id=this.parseIdent(),_t.body=this.$z(),this.finishNode(_t,"TSModuleDeclaration")}return this.$2h(_t)}$2f(_t){let It=this.$6;this.$6=!0;let Mt=this.startNode();this.next();let Ft=this.value;if(Ft==="const"&&this.$3()==="enum")Mt.const=!0;if(!_t&&kc.has(Ft))Mt.declare=!0;let Vt;if(Mt.const)Vt=this.$y(Mt);else if(Ft==="var"||Ft==="let"||Ft==="const")Vt=this.parseVarStatement(Mt,Ft,!0);else if(Ft==="function")this.next(),Vt=this.parseFunction(Mt,co,!1,!1);else if(Ft==="class")Vt=this.parseClass(Mt,!0);else Vt=this.$1l(Mt,Ft);return Vt.declare=!0,this.$6=It,Vt}$1n(_t,It){return this.next(),_t.abstract=!0,this.parseClass(_t,It)}$1m(_t){if(this.next(),_t.id=this.parseIdent(),this.checkLValSimple(_t.id,po),this.$1())_t.typeParameters=this.$7();return this.$9(()=>{if(this.eat(X._extends))_t.extends=this.$1j();let It=this.startNode();It.body=this.$1f(),_t.body=this.finishNode(It,"TSInterfaceBody")}),this.finishNode(_t,"TSInterfaceDeclaration")}$2g(_t){if(this.next(),_t.id=this.parseIdent(),this.checkLValSimple(_t.id,mi),this.$1())_t.typeParameters=this.$7();return _t.typeAnnotation=this.$9(()=>(this.expect(X.eq),this.$0())),this.semicolon(),this.finishNode(_t,"TSTypeAliasDeclaration")}$y(_t){if(this.type===X._const)_t.const=!0,this.next();this.next(),_t.id=this.parseIdent(),this.checkLValSimple(_t.id,Rc),this.expect(X.braceL),_t.members=[];while(!this.eat(X.braceR)){let It=this.startNode();if(It.id=this.type===X.string?this.parseExprAtom():this.parseIdent(!0),this.eat(X.eq))It.initializer=this.parseMaybeAssign();if(_t.members.push(this.finishNode(It,"TSEnumMember")),this.type!==X.braceR)this.expect(X.comma)}return this.finishNode(_t,"TSEnumDeclaration")}$2h(_t){if(this.next(),this.type===X.string){if(_t.id=this.parseExprAtom(),this.type===X.braceL)_t.body=this.$z();else this.semicolon();return this.finishNode(_t,"TSModuleDeclaration")}return _t.id=this.parseIdent(),this.checkLValSimple(_t.id,Dc),this.$1o(_t)}$1o(_t){if(this.eat(X.dot)){let It=this.startNode();It.id=this.parseIdent(),_t.body=this.$1o(It)}else _t.body=this.$z();return this.finishNode(_t,"TSModuleDeclaration")}$z(){this.enterScope(Pc);let _t=this.startNode();this.enterScope(0),this.expect(X.braceL),_t.body=[];while(!this.eat(X.braceR))_t.body.push(this.parseStatement(null,!0));return this.exitScope(),this.exitScope(),this.finishNode(_t,"TSModuleBlock")}$1p(_t,It){if(_t.isExport=It,_t.id=this.parseIdent(),this.checkLValSimple(_t.id,is),this.expect(X.eq),this.isContextual("require")&&this.$2()===lo){let Mt=this.startNode();this.next(),Mt.expression=this.$1e(),_t.moduleReference=this.finishNode(Mt,"TSExternalModuleReference")}else _t.moduleReference=this.$j();return this.semicolon(),this.finishNode(_t,"TSImportEqualsDeclaration")}$2i(){let _t=this.$d();if(this.input.charCodeAt(_t)!==xs)return!1;let It=this.input.charCodeAt(_t+1);return It!==xs&&It!==62}parseStatement(_t,It,Mt){if(this.type===Lt)this.$1q(!0);let Ft=this.$1k();if(Ft)return Ft;return super.parseStatement(_t,It,Mt)}parseVarStatement(_t,It,Mt){return super.parseVarStatement(_t,It,Mt||this.$6)}parseVarId(_t,It){if(super.parseVarId(_t,It),_t.id.type==="Identifier"&&this.$s()&&!this.hasPrecedingLineBreak())this.next(),_t.definite=!0;this.$g(_t.id,!1)}parseCatchClauseParam(){let _t=this.$g(this.parseBindingAtom(),!1),It=_t.type==="Identifier";return this.enterScope(It?$c:0),this.checkLValPattern(_t,It?_c:is),this.expect(X.parenR),_t}parseImport(_t){if(this.next(),_t.importKind="value",this.type===X.string)_t.specifiers=[],_t.source=this.parseExprAtom();else{if(this.isContextual("type")){let It=this.$2();if(It===vs||It===gi||$t(It)&&this.$3()!=="from")_t.importKind="type",this.next()}if(this.type===X.name&&this.$2i())return this.$1p(_t,!1);_t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),_t.source=this.$x()}return this.$1r(_t),this.semicolon(),this.finishNode(_t,"ImportDeclaration")}parseWithClause(){if(this.isContextual("assert")&&!this.hasPrecedingLineBreak())this.type=X._with;return this.type===X._with?super.parseWithClause():void 0}$1r(_t){let It=this.parseWithClause();if(It)_t.attributes=It}parseImportSpecifier(){return this.$1s("importKind",()=>super.parseImportSpecifier())}parseExportSpecifier(_t){return this.$1s("exportKind",()=>super.parseExportSpecifier(_t))}$1s(_t,It){let Mt=this.isContextual("type")?this.$2():-1;if(Mt===yi||Mt===xi||$t(Mt)&&this.$3()!=="as"){let Vt=this.startNode();this.next();let Bt=It();return this.$l(Bt,Vt),Bt[_t]="type",Bt}let Ft=It();return Ft[_t]="value",Ft}parseExport(_t,It){if(this.next(),this.eat(X._import)){if(_t.importKind="value",this.isContextual("type")&&$t(this.$2())&&this.$3()!=="from")_t.importKind="type",this.next();return this.$1p(_t,!0)}if(this.eat(X.eq))return _t.expression=this.parseExpression(),this.semicolon(),this.finishNode(_t,"TSExportAssignment");if(this.eatContextual("as"))return this.expectContextual("namespace"),_t.id=this.parseIdent(),this.semicolon(),this.finishNode(_t,"TSNamespaceExportDeclaration");if(_t.exportKind="value",this.isContextual("type")){let Vt=this.$2();if(Vt===vs||Vt===gi)_t.exportKind="type",this.next()}if(this.eat(X.star))return this.parseExportAllDeclaration(_t,It);if(this.eat(X._default)){if(this.isContextual("interface")&&this.$14())_t.declaration=this.$1m(this.startNode());else if(this.isContextual("abstract")&&this.$3()==="class")_t.declaration=this.$1n(this.startNode(),"nullableID");else _t.declaration=this.parseExportDefaultDeclaration();return this.finishNode(_t,"ExportDefaultDeclaration")}let Mt=this.isContextual("declare"),Ft=this.$1k(!0);if(Ft||this.shouldParseExportStatement()){if(_t.declaration=Ft??this.parseStatement(null),Mt||_t.declaration.type==="TSInterfaceDeclaration"||_t.declaration.type==="TSTypeAliasDeclaration")_t.exportKind="type";return _t.specifiers=[],_t.source=null,this.finishNode(_t,"ExportNamedDeclaration")}if(_t.declaration=null,_t.specifiers=this.parseExportSpecifiers(It),this.eatContextual("from"))_t.source=this.$x(),this.$1r(_t);else{for(let Vt of _t.specifiers)if(this.checkUnreserved(Vt.local),this.checkLocalExport(Vt.local),Vt.local.type==="Literal")this.raise(Vt.local.start,"A string literal cannot be used as an exported binding without `from`.");_t.source=null}return this.semicolon(),this.finishNode(_t,"ExportNamedDeclaration")}parseFunction(_t,It,Mt,Ft,Vt){let Bt=It&co;if(Bt)this.$i=_t;super.parseFunction(_t,It,Mt,Ft,Vt),this.$i=null;let Gt=!_t.body;if(Gt)_t.type="TSDeclareFunction";if(Bt&&_t.id){if(Gt){if(this.$6&&this.currentScope().flags&ao)this.declareName(_t.id.name,Si,_t.id.start);this.checkLValSimple(_t.id,Tc)}else if(!(It&Ic)){let Wt=Nc;if(this.strict||_t.generator||_t.async)Wt=this.treatFunctionsAsVar?Ac:is;this.checkLValSimple(_t.id,Wt)}}return _t}parseFunctionParams(_t){if(this.$1())_t.typeParameters=this.$7();if(super.parseFunctionParams(_t),this.type===X.colon)_t.returnType=this.$4(!0)}parseFunctionBody(_t,It,Mt,Ft){if(Mt&&this.type===X.colon)_t.returnType=this.$4(!0);if(It||this.type===X.braceL){super.parseFunctionBody(_t,It,Mt,Ft);return}this.semicolon(),this.exitScope()}parseMethod(_t,It,Mt){let Ft=this.$o;this.$o=null;let Vt=super.parseMethod(_t,It,Mt);if(!Vt.body)Vt.type="TSDeclareMethod";if(Ft)Vt.typeParameters=Ft;return Vt}parseBindingList(_t,It,Mt,Ft){let Vt=Ft===!0||this.$p;return this.$p=!1,super.parseBindingList(_t,It,Mt,Vt)}$n(_t){if(!_t&&!this.$a())return!1;let It=this.$2();return It===Mc||It===vs||It===gi||It===uo||It===Fc||It===yi||It===xi||It>=48&&It<=57||$t(It)}parseAssignableListItem(_t){let It=this.$10(),Mt=this.start,Ft=this.startLoc,Vt,Bt=!1,Gt=!1;if(_t)while(this.type===X.name&&Sc.has(this.value)&&!this.containsEsc&&this.$n(!1)){if(this.value==="readonly")Bt=!0;else if(this.value==="override")Gt=!0;else Vt=this.value;this.next()}let Wt;if(this.type===X._this)Wt=this.startNode(),Wt.name="this",this.next(),this.finishNode(Wt,"Identifier");else Wt=this.parseBindingAtom();let Ut=this.type===X.eq?this.parseMaybeDefault(Mt,Ft,Wt):this.parseMaybeDefault(Wt.start,Wt.loc?.start,this.$g(Wt,!0));if(It.length>0)Ut.decorators=It;if(!Vt&&!Bt&&!Gt)return Ut;let Ht=this.startNodeAt(Mt,Ft);if(Vt)Ht.accessibility=Vt;if(Bt)Ht.readonly=!0;if(Gt)Ht.override=!0;return Ht.parameter=Ut,this.finishNode(Ht,"TSParameterProperty")}parseBindingListItem(_t){if(_t.type==="RestElement")this.$g(_t,!0);return _t}checkLValSimple(_t,It,Mt){if(this.$i&&_t===this.$i.id){this.$i=null;return}if(!It&&oo.has(_t.type)){this.checkLValSimple(_t.expression,It,Mt);return}switch(_t.type){case"TSParameterProperty":this.checkLValInnerPattern(_t.parameter,It,Mt);return;case"Identifier":if(_t.name==="this")return}super.checkLValSimple(_t,It,Mt)}toAssignable(_t,It,Mt){if(_t&&!It&&oo.has(_t.type))return _t;return super.toAssignable(_t,It,Mt)}declareName(_t,It,Mt){let Ft=this.currentScope();if(It&Si){this.$1t(Ft,_t),Ft.$1u??=[],Ft.$1u.push(_t);return}if(It===mi||It===po){if(Ft.$11??=[],It===mi&&Ft.$11.includes(_t))this.raise(Mt,`type '${_t}' has already been declared.`);Ft.$11.push(_t),this.$1t(Ft,_t);return}if(It&Io){if(Ft.$1v??=[],Ft.$1v.includes(_t))return;super.declareName(_t,is,Mt),Ft.$1v.push(_t);return}super.declareName(_t,It,Mt)}$1t(_t,It){if(this.inModule&&_t.flags&ao)delete this.undefinedExports[It]}checkLocalExport(_t){for(let It=this.scopeStack.length-1;It>=0;It--){let Mt=this.scopeStack[It];if(Mt.$11?.includes(_t.name)||Mt.$1u?.includes(_t.name))return}super.checkLocalExport(_t)}checkExport(){}raiseRecoverable(_t,It){if(It==="Duplicate constructor in the same class")return;super.raiseRecoverable(_t,It)}$10(){let _t=[];while(this.type===Lt)_t.push(this.$1w());return _t}$1q(_t){let It=this.$b[this.$b.length-1];while(this.type===Lt)It.push(this.$1w());if(this.type===X._export){if(!_t)this.unexpected()}else if(this.type!==X._class&&!((this.isContextual("abstract")||this.isContextual("declare"))&&this.$3()==="class"))this.raise(this.start,"Leading decorators must be attached to a class declaration.")}$1w(){let _t=this.startNode();this.next(),this.$b.push([]);let It=this.start,Mt=this.startLoc,Ft;if(this.type===X.parenL){if(this.next(),Ft=this.parseExpression(),this.expect(X.parenR),this.options.preserveParens){let Bt=this.startNodeAt(It,Mt);Bt.expression=Ft,Ft=this.finishNode(Bt,"ParenthesizedExpression")}}else{Ft=this.parseIdent(!1);while(this.eat(X.dot)){let Bt=this.startNodeAt(It,Mt);Bt.object=Ft,Bt.property=this.parseIdent(!0),Bt.computed=!1,Ft=this.finishNode(Bt,"MemberExpression")}}let Vt=this.$k()?this.$e():void 0;if(this.eat(X.parenL)){let Bt=this.startNodeAt(Ft.start,Ft.loc?.start);if(Bt.callee=Ft,Bt.arguments=this.parseExprList(X.parenR,!1,!1),Vt)Bt.typeArguments=Vt;Ft=this.finishNode(Bt,"CallExpression")}else if(Vt){let Bt=this.startNodeAt(Ft.start,Ft.loc?.start);Bt.expression=Ft,Bt.typeArguments=Vt,Ft=this.finishNode(Bt,"TSInstantiationExpression")}return _t.expression=Ft,this.$b.pop(),this.finishNode(_t,"Decorator")}shouldParseExportStatement(){return this.type===Lt||super.shouldParseExportStatement()}parseExprAtom(_t,It,Mt){if(this.type===Lt)this.$1q(!1);return super.parseExprAtom(_t,It,Mt)}parseProperty(_t,It){if(_t||this.type!==Lt)return super.parseProperty(_t,It);let Mt=this.$10(),Ft=super.parseProperty(_t,It);if(Ft.type==="SpreadElement")this.raise(Ft.start,"Decorators can't be used with SpreadElement");return Ft.decorators=Mt,Ft}parseClassId(_t,It){let Mt=this.$b.length-1,Ft=this.$b[Mt];if(Ft.length>0)_t.decorators=Ft,this.$l(_t,Ft[0]),this.$b[Mt]=[];if(!this.isContextual("implements")||It===!0)super.parseClassId(_t,It);if(this.$1())_t.typeParameters=this.$7()}parseClassSuper(_t){if(super.parseClassSuper(_t),_t.superClass&&this.$1())_t.superTypeParameters=this.$e();if(this.eatContextual("implements"))_t.implements=this.$9(()=>this.$1j())}parseClassElement(_t){if(this.type===Lt){let Gt=this.$10();if(this.type===X.braceR)this.raise(this.start,"Decorators must be attached to a class element.");let Wt=this.parseClassElement(_t);return Wt.decorators=Gt,this.$l(Wt,Gt[0]),Wt}if(this.eat(X.semi))return null;let It=this.startNode();while(this.type===X.name&&Cc.has(this.value)&&!this.containsEsc&&this.$n(this.value==="static")){let Gt=this.value;if(this.next(),Gt==="static"&&this.type===X.braceL)return this.next(),this.parseClassStaticBlock(It),It;if(Gt==="public"||Gt==="private"||Gt==="protected")It.accessibility=Gt;else It[Gt]=!0}if(this.type===X.bracketL&&this.$1g())return this.$1h(It);It.static??=!1;let Mt="",Ft=!1,Vt=!1,Bt="method";if(this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===X.star)&&!this.canInsertSemicolon())Vt=!0;else Mt="async";if(!Mt&&this.eat(X.star))Ft=!0;if(!Mt&&!Vt&&!Ft){let Gt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Bt=Gt;else Mt=Gt}if(Mt)It.computed=!1,It.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),It.key.name=Mt,this.finishNode(It.key,"Identifier");else this.parseClassElementName(It);if(this.eat(X.question))It.optional=!0;if(this.type===X.parenL||this.$1()||Bt!=="method"||Ft||Vt){let Gt=It.key,Wt=!It.static&&!It.computed&&(Gt.type==="Identifier"&&Gt.name==="constructor"||Gt.type==="Literal"&&Gt.value==="constructor");if(It.kind=Wt?"constructor":Bt,this.$1())It.typeParameters=this.$7();this.$p=Wt,this.parseClassMethod(It,Ft,Vt,Wt&&_t)}else{if(!It.optional&&this.$s())this.next(),It.definite=!0;if(this.type===X.colon)It.typeAnnotation=this.$4();this.parseClassField(It)}return It}parseMaybeAssign(_t,It,Mt){if(this.$k()){let Ft=this.$f(()=>{let Vt=this.$7(),Bt=super.parseMaybeAssign(_t,It,Mt);if(Bt.type!=="ArrowFunctionExpression")return;return Bt.typeParameters=Vt,this.$l(Bt,Vt),Bt});if(Ft)return Ft}return super.parseMaybeAssign(_t,It,Mt)}parseMaybeUnary(_t,It,Mt,Ft){if(this.$k()){let Vt=this.startNode();return Vt.typeAnnotation=this.$9(()=>{this.next();let Bt=this.$0();if(!this.$c())this.unexpected();return this.next(),Bt}),Vt.expression=this.parseMaybeUnary(null,!1,!1,Ft),this.finishNode(Vt,"TSTypeAssertion")}return super.parseMaybeUnary(_t,It,Mt,Ft)}parseMaybeConditional(_t,It){let Mt=this.start,Ft=this.startLoc,Vt=this.parseExprOps(_t,It);if(this.checkExpressionErrors(It))return Vt;if(this.type===X.question&&!(Vt.type==="ArrowFunctionExpression"&&Vt.start===Mt)&&!this.$2j()){this.next();let Bt=this.startNodeAt(Mt,Ft);return Bt.test=Vt,Bt.consequent=this.parseMaybeAssign(),this.expect(X.colon),Bt.alternate=this.parseMaybeAssign(_t),this.finishNode(Bt,"ConditionalExpression")}return Vt}$2j(){let _t=this.$d(),It=this.input.charCodeAt(_t);if(It===ho||It===Oc||It===Lc)return!0;return It===xs&&this.input.charCodeAt(_t+1)!==xs}parseParenItem(_t){return this.$g(_t,!0)}$1x(){if(this.type!==X.colon)return!0;let _t=this.$f(()=>{let It=this.$4(!0);return this.type===X.arrow&&!this.canInsertSemicolon()?It:void 0});if(!_t)return!1;return this.$8=_t,!0}shouldParseArrow(_t){return this.$1x()&&super.shouldParseArrow(_t)}shouldParseAsyncArrow(){return this.$1x()&&super.shouldParseAsyncArrow()}parseArrowExpression(_t,It,Mt,Ft){if(this.$8)_t.returnType=this.$8,this.$8=null;return super.parseArrowExpression(_t,It,Mt,Ft)}parseExprList(_t,It,Mt,Ft){if(!this.$q)return super.parseExprList(_t,It,Mt,Ft);this.$q=!1;let Vt=[],Bt=!0;while(!this.eat(_t)){if(Bt)Bt=!1;else if(this.expect(X.comma),It&&this.afterTrailingComma(_t))break;if(this.type===X.ellipsis){let Gt=this.parseSpread(Ft);if(this.eat(X.question))Gt.optional=!0;if(this.type===X.colon)Gt.typeAnnotation=this.$4();Vt.push(Gt)}else Vt.push(this.parseMaybeAssign(!1,Ft,this.parseParenItem))}return Vt}parseSubscript(_t,It,Mt,Ft,Vt,Bt,Gt){if(this.$s()&&!this.hasPrecedingLineBreak()){let Ut=this.startNodeAt(It,Mt);return this.exprAllowed=!1,this.next(),Ut.expression=_t,this.finishNode(Ut,"TSNonNullExpression")}if(Vt&&this.$1()){let Ut=this.$f(()=>this.$2k(It,Mt,Gt));if(Ut)return Ut}let Wt=this.type===X.questionDot&&this.$2()===fo;if(this.$1()||Wt||this.type===X.bitShift&&this.value==="<<"){let Ut=this.$f(()=>{if(Wt)this.next();this.$k();let Ht=this.$e();if(this.type===X.parenL&&!Ft)return Ht;if(this.type===X.backQuote)return Wt?void 0:Ht;if(Wt)return;if(this.$c()||this.type===X.bitShift||this.type.startsExpr&&this.type!==X.parenL&&!this.hasPrecedingLineBreak())return;return Ht});if(Ut){let Ht=this.startNodeAt(It,Mt);if(this.type===X.parenL&&!Ft){if(this.next(),Ht.callee=_t,Ht.arguments=this.parseExprList(X.parenR,!0,!1),Ht.typeArguments=Ut,Wt)_t.optional=!0;if(Wt||Bt)Ht.optional=Wt;return this.finishNode(Ht,"CallExpression")}if(this.type===X.backQuote)return Ht.tag=_t,Ht.quasi=this.parseTemplate({isTagged:!0}),Ht.typeArguments=Ut,this.finishNode(Ht,"TaggedTemplateExpression");return Ht.expression=_t,Ht.typeArguments=Ut,this.finishNode(Ht,"TSInstantiationExpression")}}if(Vt&&this.type===X.parenL)this.$q=!0;return super.parseSubscript(_t,It,Mt,Ft,Vt,Bt,Gt)}$2k(_t,It,Mt){let Ft=this.startNodeAt(_t,It);if(Ft.typeParameters=this.$7(),this.expect(X.parenL),Ft.params=this.parseBindingList(X.parenR,!1,!0),this.type===X.colon)Ft.returnType=this.$4(!0);if(this.type!==X.arrow||this.canInsertSemicolon())return;return this.next(),this.parseArrowExpression(Ft,Ft.params,!0,Mt)}parseDynamicImport(_t){if(this.next(),_t.source=this.parseMaybeAssign(),this.eat(X.comma)&&this.type!==X.parenR)_t.arguments=[this.parseExpression()];return this.expect(X.parenR),this.finishNode(_t,"ImportExpression")}parseNew(){let _t=super.parseNew();if(_t.callee?.type!=="TSInstantiationExpression")return _t;let It=this.startNodeAt(_t.start,_t.loc?.start);return It.callee=_t.callee.expression,It.typeArguments=_t.callee.typeArguments,It.arguments=_t.arguments,this.finishNodeAt(It,"NewExpression",_t.end,_t.loc?.end)}parseExprOp(_t,It,Mt,Ft,Vt){if(X._in.binop>Ft&&this.type===X.name&&(this.value==="as"||this.value==="satisfies")&&!this.containsEsc&&!this.hasPrecedingLineBreak()){let Bt=this.value==="satisfies",Gt=this.startNodeAt(It,Mt);return Gt.expression=_t,Gt.typeAnnotation=this.$9(()=>{if(this.next(),!Bt&&this.type===X._const){let Wt=this.startNode();return Wt.typeName=this.parseIdent(!0),this.finishNode(Wt,"TSTypeReference")}return this.$0()}),this.finishNode(Gt,Bt?"TSSatisfiesExpression":"TSAsExpression"),this.parseExprOp(Gt,It,Mt,Ft,Vt)}return super.parseExprOp(_t,It,Mt,Ft,Vt)}parseGetterSetter(_t){_t.kind=_t.key.name,super.parseGetterSetter(_t)}parsePropertyValue(_t,It,Mt,Ft,Vt,Bt,Gt,Wt){if(!It&&this.$1()){if(this.$o=this.$7(),this.type!==X.parenL)this.unexpected();_t.kind="init"}return super.parsePropertyValue(_t,It,Mt,Ft,Vt,Bt,Gt,Wt)}}return Ot});var Ns="",$n,ls=0;function ie(B){Ns=B,$n=void 0,ls=0}function b(B){if(!$n){$n=[0];let Ae=Ns.indexOf(`
|
|
12
|
-
`);while(Ae!==-1)$n.push(Ae+1),Ae=Ns.indexOf(`
|
|
13
|
-
`,Ae+1)}let X=0,he=$n.length-1;if(B>=$n[ls])X=ls;else he=ls-1;if(X<he&&B<$n[X+1])he=X;while(X<he){let Ae=X+he+1>>>1;if($n[Ae]<=B)X=Ae;else he=Ae-1}return ls=X,{line:X+1,column:B-$n[X],character:B}}function G(B){let{line:X,column:he}=b(B);return{line:X,column:he}}function Bc(){return Ns.split(`
|
|
14
|
-
`)}var Vc=/^\t+/;class e extends Error{name="ParseError";code;reason;position;start;end;frame;constructor(B,X,he){super(`${he}
|
|
15
|
-
https://svelte.dev/e/${X}`);this.code=X,this.reason=he;let Ae=typeof B==="number"?B:B?.start,$t=typeof B==="number"?B:B?.end;if(Ae!==void 0)this.position=[Ae,$t??Ae],this.start=b(this.position[0]),this.end=b(this.position[1]),this.frame=Gc(this.start.line-1,this.end.column)}}var Ri=(B)=>B.replace(Vc,(X)=>" ".repeat(X.length));function Gc(B,X){let he=Bc(),Ae=Math.max(0,B-2),$t=Math.min(B+3,he.length),Lt=String($t+1).length;return he.slice(Ae,$t).map((Ot,_t)=>{let It=String(_t+Ae+1).padStart(Lt," ");if(Ae+_t!==B)return`${It}: ${Ri(Ot)}`;let Mt=`${" ".repeat(Lt+2+Ri(Ot.slice(0,X)).length)}^`;return`${It}: ${Ri(Ot)}
|
|
16
|
-
${Mt}`}).join(`
|
|
17
|
-
`)}function Le(B){throw new e(B,"attribute_duplicate","Attributes need to be unique")}function Oe(B){throw new e(B,"attribute_empty_shorthand","Attribute shorthand cannot be empty")}function Me(B,X){throw new e(B,"block_duplicate_clause",`${X} cannot appear more than once within a block`)}function $e(B){throw new e(B,"block_invalid_continuation_placement","{:...} block is invalid at this position (did you forget to close the preceding element or block?)")}function je(B){throw new e(B,"block_invalid_elseif","'elseif' should be 'else if'")}function qe(B,X,he){throw new e(B,"block_invalid_placement",`{#${X} ...} block cannot be ${he}`)}function Be(B){throw new e(B,"block_unclosed","Block was left open")}function Je(B){throw new e(B,"block_unexpected_close","Unexpected block closing tag")}function Fe(B){throw new e(B,"const_tag_invalid_expression","{@const ...} must consist of a single variable declaration")}function Ve(B){throw new e(B,"css_empty_declaration","Declaration cannot be empty")}function Ee(B){throw new e(B,"css_expected_identifier","Expected a valid CSS identifier")}function Ue(B){throw new e(B,"css_selector_invalid","Invalid selector")}function Ge(B){throw new e(B,"debug_tag_invalid_arguments","{@debug ...} arguments must be identifiers, not arbitrary expressions")}function be(B){throw new e(B,"declaration_tag_invalid_type","Declaration tags must be `let` or `const` declarations")}function We(B){throw new e(B,"directive_invalid_value","Directive value must be a JavaScript expression enclosed in curly braces")}function He(B,X){throw new e(B,"directive_missing_name",`\`${X}\` name cannot be empty`)}function ze(B,X){throw new e(B,"element_invalid_closing_tag",`\`</${X}>\` attempted to close an element that was not open`)}function Xe(B,X,he){throw new e(B,"element_invalid_closing_tag_autoclosed",`\`</${X}>\` attempted to close element that was already automatically closed by \`<${he}>\` (cannot nest \`<${he}>\` inside \`<${X}>\`)`)}function ke(B,X){throw new e(B,"element_unclosed",`\`<${X}>\` was left open`)}function Se(B){throw new e(B,"expected_attribute_value","Expected attribute value")}function Qe(B){throw new e(B,"expected_block_type","Expected 'if', 'each', 'await', 'key' or 'snippet'")}function we(B){throw new e(B,"expected_identifier","Expected an identifier")}function Ye(B){throw new e(B,"expected_pattern","Expected identifier or destructure pattern")}function Ze(B){throw new e(B,"expected_tag","Expected 'html', 'render', 'attach', 'const', or 'debug'")}function k(B,X){throw new e(B,"expected_token",`Expected token ${X}`)}function Ke(B){throw new e(B,"expected_whitespace","Expected whitespace")}function Wc(B,X){throw new e(B,"js_parse_error",`${X}`)}function et(B){throw new e(B,"render_tag_invalid_expression","`{@render ...}` tags can only contain call expressions")}function tt(B){throw new e(B,"script_duplicate","A component can have a single top-level `<script>` element and/or a single top-level `<script module>` element")}function nt(B,X){throw new e(B,"script_invalid_attribute_value",`If the \`${X}\` attribute is supplied, it must be a boolean attribute`)}function rt(B){throw new e(B,"script_invalid_context",'If the context attribute is supplied, its value must be "module"')}function it(B,X){throw new e(B,"script_reserved_attribute",`The \`${X}\` attribute is reserved and cannot be used`)}function st(B){throw new e(B,"style_duplicate","A component can have a single top-level `<style>` element")}function ot(B){throw new e(B,"svelte_component_invalid_this","Invalid component definition — must be an `{expression}`")}function at(B){throw new e(B,"svelte_component_missing_this","`<svelte:component>` must have a 'this' attribute")}function ve(B){throw new e(B,"svelte_element_missing_this","`<svelte:element>` must have a 'this' attribute with a value")}function ct(B,X){throw new e(B,"svelte_meta_duplicate",`A component can only have one \`<${X}>\` element`)}function pt(B,X){throw new e(B,"svelte_meta_invalid_content",`<${X}> cannot have children`)}function ut(B,X){throw new e(B,"svelte_meta_invalid_placement",`\`<${X}>\` tags cannot be inside elements or blocks`)}function lt(B,X){throw new e(B,"svelte_meta_invalid_tag",`Valid \`<svelte:...>\` tag names are ${X}`)}function ft(B){throw new e(B,"svelte_options_deprecated_tag",'"tag" option is deprecated — use "customElement" instead')}function dt(B){throw new e(B,"svelte_options_invalid_attribute","`<svelte:options>` can only receive static attributes")}function se(B,X){throw new e(B,"svelte_options_invalid_attribute_value",`Value must be ${X}, if specified`)}function mt(B){throw new e(B,"svelte_options_invalid_customelement",'"customElement" must be a string literal defining a valid custom element name or an object of the form { tag?: string; shadow?: "open" | "none" | `ShadowRootInit`; props?: { [key: string]: { attribute?: string; reflect?: boolean; type: .. } } }')}function ht(B){throw new e(B,"svelte_options_invalid_customelement_props",'"props" must be a statically analyzable object literal of the form "{ [key: string]: { attribute?: string; reflect?: boolean; type?: "String" | "Boolean" | "Number" | "Array" | "Object" }"')}function gt(B){throw new e(B,"svelte_options_invalid_customelement_shadow",'"shadow" must be either "open", "none" or `ShadowRootInit` object.')}function De(B){throw new e(B,"svelte_options_invalid_tagname","Tag name must be lowercase and hyphenated")}function yt(B){throw new e(B,"svelte_options_reserved_tagname","Tag name is reserved")}function xt(B,X){throw new e(B,"svelte_options_unknown_attribute",`\`<svelte:options>\` unknown attribute '${X}'`)}function Tt(B){throw new e(B,"tag_invalid_name","Expected a valid element or component name. Components must have a valid variable name or dot notation expression")}function Et(B,X,he){throw new e(B,"tag_invalid_placement",`{@${X} ...} tag cannot be ${he}`)}function u(B){throw new e(B,"unexpected_eof","Unexpected end of input")}function bt(B,X){throw new e(B,"unexpected_reserved_word",`'${X}' is a reserved word in JavaScript and cannot be used here`)}function kt(B){throw new e(B,"unterminated_string_constant","Unterminated string constant")}function St(B){throw new e(B,"void_element_invalid_content","Void elements cannot have children or closing tags")}function _s(B){return typeof B==="object"&&B!==null&&"type"in B&&typeof B.type==="string"}function Mo(B){return B}function oe(B,X){let he=Mo(B);for(let Ae in he){let $t=he[Ae];if(Array.isArray($t)){for(let Lt=0;Lt<$t.length;Lt++)if(_s($t[Lt]))$t[Lt]=X($t[Lt])}else if(_s($t))he[Ae]=X($t)}}function W(B,...X){if(!X.some((he)=>he===B.type))throw Error(`expected ${X.join(" or ")}, got ${B.type}`)}var Kn="",Fo=[];function Uc(B,X){Kn=B,Fo=X}function Hc(B,X,he,Ae,$t,Lt){let Ot=X;if(B&&Ot.includes(`
|
|
18
|
-
`)){let It=Kn.lastIndexOf(`
|
|
19
|
-
`,he-1)+1,Mt=It,Ft=Kn.charCodeAt(Mt);while(Ft===32||Ft===9)Ft=Kn.charCodeAt(++Mt);if(Mt>It)Ot=qc(Ot,Kn.slice(It,Mt))}let _t={type:B?"Block":"Line",value:Ot,start:he,end:Ae};if($t&&Lt)_t.loc={start:$t,end:Lt};Fo.push(_t)}function qc(B,X){let he=B.startsWith(X)?X.length:0,Ae="",$t=B.indexOf(`
|
|
20
|
-
`,he);while($t!==-1){if(Ae+=B.slice(he,$t+1),he=$t+1,B.startsWith(X,he))he+=X.length;$t=B.indexOf(`
|
|
21
|
-
`,he)}return Ae+B.slice(he)}function Kc(B,X,he){let Ae=0,$t=X.length;while(Ae<$t){let Lt=Ae+$t>>>1;if(X[Lt].start<he)Ae=Lt+1;else $t=Lt}if(Ae>=X.length)return;if(rn=X.slice(Ae).map(({type:Lt,value:Ot,start:_t,end:It})=>({type:Lt,value:Ot,start:_t,end:It})),on=0,Ii(B,void 0,!1),on<rn.length&&(rn[on].start>=B.end||B.type==="Program")){B.trailingComments??=[];while(on<rn.length)B.trailingComments.push(rn[on++])}}var rn=[],on=0,zc=new Map([["BlockStatement","body"],["Program","body"],["ArrayExpression","elements"],["ObjectExpression","properties"]]);function Lo(B,X){for(let he=B;he<X;he++){let Ae=Kn.charCodeAt(he);if(Ae!==44&&Ae!==41&&Ae!==32&&Ae!==9)return!0}return!1}function Ii(B,X,he){while(on<rn.length&&rn[on].start<B.start)B.leadingComments??=[],B.leadingComments.push(rn[on++]);if(on>=rn.length)return;let Ae=rn[on].start;if(Ae<B.end||!Lo(B.end,Ae)){let $t=Mo(B),Lt=zc.get(B.type),Ot=Lt===void 0?void 0:$t[Lt],_t=Array.isArray(Ot)&&Ot.length===0;for(let It in $t){if(on>=rn.length)return;if(It==="type")continue;let Mt=$t[It];if(Array.isArray(Mt)){let Ft=It===Lt;for(let Vt=0;Vt<Mt.length;Vt++){let Bt=Mt[Vt];if(_s(Bt))Ii(Bt,B,Ft?Vt===Mt.length-1:_t)}}else if(_s(Mt))Ii(Mt,B,_t)}if(on>=rn.length)return}if(X!==void 0&&B.end===X.end)return;if(he)while(on<rn.length){if(X&&rn[on].start>=X.end)break;B.trailingComments??=[],B.trailingComments.push(rn[on++])}else if(B.end<=rn[on].start&&!Lo(B.end,rn[on].start))B.trailingComments=[rn[on++]]}var Li=!1,Oo=new Map;function As(B){if(!(B instanceof RegExp))return B;let X=Oo.get(B);if(!X){let he=new Set(B.source.slice(4,-2).split("|"));X={test:(Ae)=>he.has(Ae)},Oo.set(B,X)}return X}var jo=_i((B)=>{let{keywordTypes:X,tokTypes:he}=B.acorn,Ae=new Map("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 const class extends export import super".split(" ").map(($t)=>[$t,X[$t]]));return class extends B{constructor($t,Lt,Ot){super($t,Lt,Ot);this.keywords=As(this.keywords),this.reservedWords=As(this.reservedWords),this.reservedWordsStrict=As(this.reservedWordsStrict),this.reservedWordsStrictBind=As(this.reservedWordsStrictBind)}parseParenAndDistinguishExpression($t,Lt){let Ot=super.parseParenAndDistinguishExpression($t,Lt);if(Ot.type==="ParenthesizedExpression")Li=!0;return Ot}checkLocalExport(){}skipSpace(){let $t=this.input,Lt=this.options.locations,Ot=this.pos,_t=$t.charCodeAt(Ot);for(;;)if(_t===32||_t===9)_t=$t.charCodeAt(++Ot);else if(_t===10){if(_t=$t.charCodeAt(++Ot),Lt)this.curLine++,this.lineStart=Ot}else break;if(this.pos=Ot,_t===47||_t<33||_t>=128)super.skipSpace()}readWord1(){let $t=this.input,Lt=this.pos,Ot=Lt,_t=$t.charCodeAt(Ot);while(_t>=97&&_t<=122||_t>=65&&_t<=90||_t>=48&&_t<=57||_t===95||_t===36)_t=$t.charCodeAt(++Ot);if(_t>=128||_t===92)return super.readWord1();return this.containsEsc=!1,this.pos=Ot,$t.slice(Lt,Ot)}readWord(){let $t=this.readWord1();return this.finishToken(Ae.get($t)??he.name,$t)}}}),Xc=Di(jo),Jc=Di(re,jo),Yc=/ \(\d+:\d+\)$/;function Ds(B){return B}function Bo(B){return B instanceof SyntaxError&&"pos"in B&&typeof B.pos==="number"}function Oi(B,X,he,Ae,$t,Lt=B.root.comments.length){let Ot=B.root.comments;Uc(X,Ot);let _t={onComment:Hc,sourceType:"module",ecmaVersion:16,locations:B.loc,preserveParens:Ae};if(B.lfOnly)_t.startLocation=b(he);let It;try{It=$t(B.isTypeScript?Jc:Xc,_t)}catch(Mt){if(!Bo(Mt))throw Mt;Wc(Mt.pos,Mt.message.replace(Yc,""))}if(Ot.length>Lt)Kc(Ds(It),Ot,he);return It}function ae(B,X,he=0){return Ds(Oi(B,X,0,!1,(Ae,$t)=>{if(he>0&&$t.locations)$t.startLocation=b(he);let Lt=new Ae($t,X,he).parse();return Lt.start=0,Lt},0))}var Qc={count:0};function I(B,X,he,Ae=!1){Qc.count+=1,Li=!1;let $t=Ds(Oi(B,X,he,!0,(_t,It)=>_t.parseExpressionAt(X,he,It))),Lt=B.root.comments.at(-1),Ot=Lt&&Lt.end>$t.end?Lt.end:$t.end;return{node:Li&&!Ae?Vo($t):$t,end:Ot}}function wt(B,X,he){return Ds(Oi(B,X,he,!1,(Ae,$t)=>{let Lt=new Ae($t,X,he);try{return Lt.nextToken(),Lt.parseStatement(null,!0,Object.create(null))}catch(Ot){if(Bo(Ot)&&Ot.pos===X.length)u(X.length);throw Ot}}))}function Vo(B){let X=B;while(X.type==="ParenthesizedExpression")X=X.expression;return oe(X,Vo),X}function ce(B,X={}){return ie(B),ae({isTypeScript:X.typescript??!1,loc:X.loc??!1,root:{comments:[]}},B)}import Go,{sep as Mi}from"node:path";var Sn=/\.svelte$/,zn=[".ts",".mts",".cts",".tsx",".js",".mjs",".cjs",".jsx",".d.ts"],Wo=/\.(?:svelte|[mc]?ts|[mc]?js|tsx|jsx)$/;function Xn(B){if(!B.endsWith(".svelte"))return!1;let X=B.length-7;if(X===0)return!1;let he=B.charCodeAt(X-1);return he!==47&&(Mi==="/"||he!==92)}function t(B){return Mi==="/"?B:B.split(Mi).join("/")}function Uo(B,X){return t(Go.join(X,Go.normalize(B)))}function us(B){return`${JSON.stringify(B,null,2)}
|
|
22
|
-
`}var Ho="sveld",Rs="0.38.1";var vt={name:Ho,version:Rs,license:"Apache-2.0",description:"Generate TypeScript definitions and component documentation for your Svelte components.",type:"module",main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",default:"./dist/index.js"},"./browser":{types:"./dist/browser.d.ts",import:"./dist/browser.js",default:"./dist/browser.js"},"./schema/component-api.schema.json":"./schema/component-api.schema.json"},scripts:{test:"bun test --parallel","test:update":"SVELD_UPDATE_FIXTURES=1 bun test tests/fixtures.test.ts","test:fixtures-types":"tsc --project tsconfig.fixtures.json","test:types-matrix":"bun scripts/typecheck-option-matrix.ts","test:svelte-versions":"bun scripts/typecheck-svelte-versions.ts","test:e2e":"bun tests/test-e2e.ts",format:"biome format --write .",lint:"biome check --error-on-warnings .","lint:fix":"biome check --write --unsafe .","lint:fix:changed":"biome check --write --unsafe --changed --no-errors-on-unmatched",build:"bun scripts/build.ts",bench:"bun scripts/bench.ts","bench:cache":"bun scripts/bench.ts --cache","bench:ostia":"ostia bench scripts/bench-ostia.ts",typecheck:"tsc --noEmit"},devDependencies:{"@biomejs/biome":"2.5.14","@types/bun":"^1.4.2","@types/jest":"^30.0.0","@typescript/typescript6":"^6.0.2",ajv:"^8.20.0",ostia:"^0.2.7",sveast:"0.4.0",svelte:"^5.57.1",typescript:"^7.0.2"},bin:{sveld:"dist/cli.js"},repository:{type:"git",url:"git+https://github.com/carbon-design-system/sveld.git"},homepage:"https://github.com/carbon-design-system/sveld",bugs:"https://github.com/carbon-design-system/sveld/issues",keywords:["svelte","svelte component","documentation","docgen","typescript","definitions","JSDocs","vite","vite-plugin"],maintainers:["Eric Liu (https://github.com/metonym)"]};var Zc=/\*\//g;function g(B){return B.replace(Zc,"*\\/")}function E(B){return B.map((X)=>`${X.name}${X.optional?"?":""}: ${X.type}`).join(", ")}function a(B){return B===void 0||B===""?void 0:B}var el=new Intl.Collator("en");function c(B,X){return el.compare(B,X)}var hs="5.57.1";var Is=1;function Nn(B){return B.some((X)=>X.internal)?B.filter((X)=>!X.internal):B}function nl(B){return{...B,props:Nn(B.props),moduleExports:Nn(B.moduleExports),slots:Nn(B.slots),events:Nn(B.events),typedefs:Nn(B.typedefs),...B.contexts?{contexts:Nn(B.contexts).map((X)=>({...X,properties:Nn(X.properties)}))}:{}}}function l(B,X={}){let he=Array.from(B,([,Lt])=>{let{diagnostics:Ot,..._t}=Lt;return nl(_t)}).sort((Lt,Ot)=>c(Lt.moduleName,Ot.moduleName)),Ae={schemaVersion:Is,generator:{name:Ho,version:Rs,svelteVersion:hs},total:he.length,components:he},$t=X.entryExports?Nn(X.entryExports):void 0;if($t&&$t.length>0)Ae.totalExports=$t.length,Ae.exports=$t;return Ae}import{readFile as il}from"node:fs/promises";import Bi from"node:path";function Jn(B,X,he=0,Ae=B.length,$t=0){let Lt=$t;for(let Ot=he;Ot<Ae;Ot++){let _t=B.charCodeAt(Ot);if(_t===34||_t===39||_t===96){Ot=sl(B,Ot,Ae);continue}if(_t===123||_t===40||_t===91||_t===60)Lt++;else if(_t===125||_t===41||_t===93||_t===62&&B.charCodeAt(Ot-1)!==61){if(Lt>0)Lt--}if(X?.(Ot,Lt)===!0)break}return Lt}function sl(B,X,he){let Ae=B.charCodeAt(X);for(let $t=X+1;$t<he;$t++){let Lt=B.charCodeAt($t);if(Lt===92)$t++;else if(Lt===Ae)return $t}return he-1}function i(B,X){let he=[],Ae=0;return Jn(B,($t,Lt)=>{if(Lt===0&&X.includes(B[$t]))he.push(B.slice(Ae,$t)),Ae=$t+1;return!1}),he.push(B.slice(Ae)),he}function Q(B,X){let he=-1;return Jn(B,(Ae,$t)=>{if($t===0&&X.includes(B[Ae]))he=Ae;return he!==-1}),he}function ji(B){let X=-1;return Jn(B,(he,Ae)=>{if(Ae===0&&B[he]==="="&&B[he+1]===">")X=he;return X!==-1}),X}function _(B,X){let he=-1;return Jn(B,(Ae,$t)=>{if($t===0)he=Ae;return he!==-1},X),he}function Y(B){if(!B)return;let X=ji(B);if(X===-1)return;return B.slice(X+2).trim()||void 0}var rl=/[:=]/,Ls={none:0,patch:1,minor:2,major:3};function ol(B,X){return Ls[X]>Ls[B]?X:B}function al(B){return B.reduce((X,he)=>ol(X,he.bump),"none")}function Yo(B,X){return Ls[B]>=Ls[X]}function qo(B){return new Set(i(B,"|").map((X)=>X.trim()).filter((X)=>X.length>0))}function Ko(B){let X=ji(B);if(X===-1)return;let he=B.slice(0,X).trim(),Ae=B.slice(X+2).trim();if(!he.startsWith("(")||!he.endsWith(")"))return;let $t=he.slice(1,-1).trim();return{params:$t.length===0?[]:i($t,",").map((Ot)=>Ot.trim()),returnType:Ae}}function pl(B){return(B.split(rl,1)[0]??"").trimEnd().endsWith("?")}function cl(B,X){if(B.returnType!==X.returnType)return"major";if(X.params.length<B.params.length)return"major";for(let Ae=0;Ae<B.params.length;Ae++)if(B.params[Ae]!==X.params[Ae])return"major";if(X.params.length===B.params.length)return"none";return X.params.slice(B.params.length).every(pl)?"minor":"major"}function Vi(B,X){if(B===X)return"none";if(B===void 0||X===void 0)return"major";let he=Ko(B),Ae=Ko(X);if(he&&Ae)return cl(he,Ae);let $t=qo(B),Lt=qo(X),Ot=[...Lt].some((It)=>!$t.has(It)),_t=[...$t].some((It)=>!Lt.has(It));if(!Ot&&!_t)return"none";if(Ot&&!_t)return"minor";if(_t&&!Ot)return"major";return"major"}function zo(B){return B.bindable===!0||B.binding==="writable"}function Xo(B,X,he,Ae){let $t=X==="prop"?"prop":"export",Lt=[],Ot=new Map(he.map((It)=>[It.name,It])),_t=new Map(Ae.map((It)=>[It.name,It]));for(let[It,Mt]of _t){if(Ot.has(It))continue;Lt.push({component:B,kind:X,name:It,bump:Mt.isRequired?"major":"minor",message:`${$t} "${It}" added${Mt.isRequired?" (required)":""}`})}for(let[It]of Ot){if(_t.has(It))continue;Lt.push({component:B,kind:X,name:It,bump:"major",message:`${$t} "${It}" removed`})}for(let[It,Mt]of Ot){let Ft=_t.get(It);if(!Ft)continue;if(Mt.isRequired!==Ft.isRequired)Lt.push({component:B,kind:X,name:It,bump:Ft.isRequired?"major":"minor",message:`${$t} "${It}" became ${Ft.isRequired?"required":"optional"}`});let Vt=Vi(Mt.type,Ft.type);if(Vt!=="none")Lt.push({component:B,kind:X,name:It,bump:Vt,message:`${$t} "${It}" type changed from \`${Mt.type??"unknown"}\` to \`${Ft.type??"unknown"}\``});let Bt=zo(Mt),Gt=zo(Ft);if(Bt!==Gt)Lt.push({component:B,kind:X,name:It,bump:Gt?"minor":"major",message:`${$t} "${It}" ${Gt?"gained a writable binding":"lost its writable binding"}`});if(Mt.value!==Ft.value&&Vt==="none")Lt.push({component:B,kind:X,name:It,bump:"patch",message:`${$t} "${It}" default changed from \`${Mt.value??"none"}\` to \`${Ft.value??"none"}\``});let Wt=Mt.deprecated!==void 0,Ut=Ft.deprecated!==void 0;if(Wt!==Ut)Lt.push({component:B,kind:X,name:It,bump:Ut?"minor":"patch",message:`${$t} "${It}" ${Ut?"marked as deprecated":"no longer deprecated"}`});if(Mt.constant!==Ft.constant)Lt.push({component:B,kind:X,name:It,bump:"minor",message:`${$t} "${It}" ${Ft.constant?"became constant":"became mutable"}`});if(Mt.reactive!==Ft.reactive)Lt.push({component:B,kind:X,name:It,bump:"minor",message:`${$t} "${It}" ${Ft.reactive?"became reactive":"stopped being reactive"}`})}return Lt}function ll(B,X,he){let Ae=[],$t=new Map(X.map((Ot)=>[Ot.name,Ot])),Lt=new Map(he.map((Ot)=>[Ot.name,Ot]));for(let[Ot]of Lt){if($t.has(Ot))continue;Ae.push({component:B,kind:"event",name:Ot,bump:"minor",message:`event "${Ot}" added`})}for(let[Ot]of $t){if(Lt.has(Ot))continue;Ae.push({component:B,kind:"event",name:Ot,bump:"major",message:`event "${Ot}" removed`})}for(let[Ot,_t]of $t){let It=Lt.get(Ot);if(!It)continue;if(_t.type!==It.type){Ae.push({component:B,kind:"event",name:Ot,bump:"major",message:`event "${Ot}" changed from ${_t.type} to ${It.type}`});continue}let Mt=_t.type==="dispatched"?_t.detail:void 0,Ft=It.type==="dispatched"?It.detail:void 0,Vt=Vi(Mt,Ft);if(Vt!=="none")Ae.push({component:B,kind:"event",name:Ot,bump:Vt,message:`event "${Ot}" detail changed from \`${Mt??"unknown"}\` to \`${Ft??"unknown"}\``})}return Ae}function Jo(B){return B.name??"default"}function ul(B,X,he){let Ae=[],$t=new Map(X.map((Ot)=>[Jo(Ot),Ot])),Lt=new Map(he.map((Ot)=>[Jo(Ot),Ot]));for(let[Ot]of Lt){if($t.has(Ot))continue;Ae.push({component:B,kind:"slot",name:Ot,bump:"minor",message:`slot "${Ot}" added`})}for(let[Ot]of $t){if(Lt.has(Ot))continue;Ae.push({component:B,kind:"slot",name:Ot,bump:"major",message:`slot "${Ot}" removed`})}for(let[Ot,_t]of $t){let It=Lt.get(Ot);if(!It)continue;let Mt=Vi(_t.slot_props,It.slot_props);if(Mt!=="none")Ae.push({component:B,kind:"slot",name:Ot,bump:Mt,message:`slot "${Ot}" props changed from \`${_t.slot_props??"none"}\` to \`${It.slot_props??"none"}\``})}return Ae}var hl=new Set(["description","source","componentCommentSource","tags"]);function Os(B){if(Array.isArray(B))return B.map(Os);if(B!==null&&typeof B==="object"){let X={};for(let[he,Ae]of Object.entries(B)){if(hl.has(he))continue;X[he]=Os(Ae)}return X}return B}var dl=["generics","rest_props","extends","contexts","typedefs"];function fl(B,X,he){let Ae=[];for(let $t of dl){let Lt=JSON.stringify(Os(X[$t])),Ot=JSON.stringify(Os(he[$t]));if(Lt!==Ot)Ae.push({component:B,kind:"shape",name:$t,bump:"major",message:`"${$t}" changed (breaking)`})}return Ae}function ml(B,X){let he=X.moduleName;return[...Xo(he,"prop",B.props,X.props),...Xo(he,"moduleExport",B.moduleExports,X.moduleExports),...ll(he,B.events,X.events),...ul(he,B.slots,X.slots),...fl(he,B,X)]}function Dt(B,X){let he=[],Ae=new Map(B.components.map((Lt)=>[Lt.moduleName,Lt])),$t=new Map(X.components.map((Lt)=>[Lt.moduleName,Lt]));for(let[Lt]of $t){if(Ae.has(Lt))continue;he.push({component:Lt,kind:"component",bump:"minor",message:`component "${Lt}" added`})}for(let[Lt]of Ae){if($t.has(Lt))continue;he.push({component:Lt,kind:"component",bump:"major",message:`component "${Lt}" removed`})}for(let[Lt,Ot]of Ae){let _t=$t.get(Lt);if(!_t)continue;he.push(...ml(Ot,_t))}return he}async function gl(B){let X;try{X=await il(Bi.resolve(B),"utf-8")}catch(he){if(he.code==="ENOENT")return null;throw he}try{return JSON.parse(X)}catch{throw Error(`sveld: could not parse "${B}" as JSON. Is it a sveld COMPONENT_API.json snapshot?`)}}function ue(B){if(typeof B.check==="string")return B.check;return B.jsonOptions?.outFile??"COMPONENT_API.json"}function le(B,X){if(!B.json||B.stdout||B.jsonOptions?.outDir)return!1;return Bi.resolve(B.jsonOptions?.outFile??"COMPONENT_API.json")===Bi.resolve(X)}async function L(B,X,he={}){let Ae=await gl(X);if(Ae===null)return{snapshotExists:!1,snapshotFile:X,changes:[],bump:"none"};if(Ae.schemaVersion!==Is)return{snapshotExists:!0,snapshotFile:X,changes:[{component:"*",kind:"schema",bump:"none",message:`snapshot schemaVersion ${Ae.schemaVersion} differs from ${Is}; regenerate the snapshot`}],bump:"none"};let $t=l(B,{entryExports:he.entryExports}),Lt=Dt(Ae,$t);return{snapshotExists:!0,snapshotFile:X,changes:Lt,bump:al(Lt)}}var yl={major:"BREAKING",minor:"additive",patch:"patch",none:"no change"};function fe(B){if(!B.snapshotExists){let $t=B.snapshotFile==="COMPONENT_API.json"?"`sveld --json`":`\`sveld --json\` with \`jsonOptions.outFile: "${B.snapshotFile}"\``;return`sveld --check: no snapshot found at "${B.snapshotFile}". Generate it with ${$t} and commit it.`}if(B.changes.length===0)return`sveld --check: no API changes detected against "${B.snapshotFile}".`;let X=[],he=B.changes.length;X.push(`sveld --check: ${he} API change${he===1?"":"s"} detected against "${B.snapshotFile}".`),X.push(`Suggested semver bump: ${B.bump}.`);let Ae=new Map;for(let $t of B.changes){let Lt=Ae.get($t.component)??[];Lt.push($t),Ae.set($t.component,Lt)}for(let[$t,Lt]of Ae){X.push(""),X.push(` ${$t}`);for(let Ot of Lt){let _t=Ot.kind==="schema"?"schema":yl[Ot.bump];X.push(` [${_t}] ${Ot.message}`)}}return X.join(`
|
|
23
|
-
`)}var Ct=1;function de(B){let X={kind:"check-report",schemaVersion:Ct,...B};return us(X)}import{existsSync as bl}from"node:fs";import{join as Cl}from"node:path";import{pathToFileURL as Sl}from"node:url";function nn(B){return typeof B==="object"&&B!==null}function _e(B){return nn(B)&&B.type==="VariableDeclaration"&&Array.isArray(B.declarations)}function w(B){return nn(B)&&B.type==="Literal"}function n(B){return nn(B)&&B.type==="Identifier"&&typeof B.name==="string"}function A(B){return nn(B)&&B.type==="MemberExpression"}function p(B){return nn(B)&&B.type==="ObjectExpression"&&Array.isArray(B.properties)}function xl(B){return nn(B)&&B.type==="CallExpression"}function d(B,X){if(!xl(B))return!1;return!!B.callee&&nn(B.callee)&&B.callee.type==="Identifier"&&B.callee.name===X}function m(B){return B?.type==="TSAsExpression"||B?.type==="TSSatisfiesExpression"?m(B.expression):B}function Ne(B){return B?.type==="TSAsExpression"||B?.type==="TSSatisfiesExpression"?B.typeAnnotation:void 0}function vl(B){return nn(B)&&B.type==="NewExpression"}function ge(B,X){if(!vl(B))return!1;return!!B.callee&&nn(B.callee)&&B.callee.type==="Identifier"&&B.callee.name===X}function x(B){if(!nn(B)||typeof B.type!=="string")return null;if(B.type==="Literal"){let X=B.value;if(typeof X==="string")return X;return X==null?null:String(X)}if(B.type==="TemplateLiteral"){let X=B.quasis;if(X?.length===1){let he=X[0]?.value?.cooked;return he==null?null:he}}return null}function o(B){if(!B||typeof B!=="object"||!("type"in B))return;if(n(B))return B.name;if(w(B))return B.value==null?void 0:String(B.value);return}function El(B,X){let he=B.length+1,Ae=X.length+1,$t=Array.from({length:he},()=>Array(Ae).fill(0));for(let Lt=0;Lt<he;Lt++)$t[Lt][0]=Lt;for(let Lt=0;Lt<Ae;Lt++)$t[0][Lt]=Lt;for(let Lt=1;Lt<he;Lt++)for(let Ot=1;Ot<Ae;Ot++){let _t=B[Lt-1]===X[Ot-1]?0:1;if($t[Lt][Ot]=Math.min($t[Lt-1][Ot]+1,$t[Lt][Ot-1]+1,$t[Lt-1][Ot-1]+_t),Lt>1&&Ot>1&&B[Lt-1]===X[Ot-2]&&B[Lt-2]===X[Ot-1])$t[Lt][Ot]=Math.min($t[Lt][Ot],$t[Lt-2][Ot-2]+1)}return $t[he-1][Ae-1]}function v(B,X,he=3){let Ae,$t=Number.POSITIVE_INFINITY;for(let Lt of X){let Ot=El(B,Lt);if(Ot<$t)Ae=Lt,$t=Ot}if(Ae===void 0||$t>he)return;return Ae}var wl=["sveld.config.js","sveld.config.mjs","sveld.config.ts"];function Nt(B){return B}function kl(B=process.cwd()){for(let X of wl){let he=Cl(B,X);if(bl(he))return he}return null}async function H(B){let X;try{X=await import(`${Sl(B).href}?t=${Date.now()}`)}catch(Ae){let $t=Ae instanceof Error?Ae.message:String(Ae);throw Error(`sveld: failed to load config file "${B}".
|
|
24
|
-
${$t}`)}let he=X.default;if(!nn(he)||Array.isArray(he))throw Error(`sveld: config file "${B}" must export a configuration object as its default export. Did you forget \`export default defineConfig({ ... })\`?`);return he}async function O(B=process.cwd()){let X=kl(B);if(X===null)return{};return H(X)}function D(...B){let X={};for(let he of B){if(!he)continue;for(let[Ae,$t]of Object.entries(he)){let Lt=X[Ae];X[Ae]=nn(Lt)&&!Array.isArray(Lt)&&nn($t)&&!Array.isArray($t)?{...Lt,...$t}:$t}}return X}var Qo=["entry","glob","quiet","documentExports","types","typesOptions","json","jsonOptions","markdown","markdownOptions","failFast","watch","config","cache","checkExamples","reportDiagnostics","strict","check","checkLevel","stdout","format","diagnostics"],$l={typesOptions:["outDir","preamble","format","transform","indexTypes"],jsonOptions:["outFile","outDir","source"],markdownOptions:["outFile","outDir","onAppend"],diagnostics:["ignore"]};function Zo(B,X,he){let Ae=B===null?X:`${B}.${X}`,$t=v(X,he),Lt=$t===void 0?void 0:B===null?$t:`${B}.${$t}`;console.warn(`sveld: unknown option "${Ae}".${Lt?` Did you mean "${Lt}"?`:""}`)}function M(B){for(let X of Object.keys(B))if(!Qo.includes(X))Zo(null,X,Qo);for(let[X,he]of Object.entries($l)){let Ae=B[X];if(!nn(Ae))continue;for(let $t of Object.keys(Ae))if(!he.includes($t))Zo(X,$t,he)}}function me(B){if(B instanceof e)return B.start?`${B.reason} (${B.start.line}:${B.start.column})`:B.reason;return B instanceof Error?B.message:String(B)}import{dirname as Wp,isAbsolute as Df,resolve as Rf}from"node:path";import{lstatSync as lp}from"node:fs";import{readFile as Jd}from"node:fs/promises";import{resolve as Ar}from"node:path";import{dirname as Gu}from"node:path";var h=Symbol("sveld.parsedComponentTypeScriptMetadata");function ea(B){return B[h]}var Pl=" ",Tl=120,Al=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,Nl=200,ia=/\s/,_l=/\s{2}|[^\S ]/,Dl=/["'`{}/]/g,Rl=/["'`{};/]/g,ra=9,Gi=10,Il=13,ds=32,Fs=34,Ll=38,js=39,Ol=40,Ml=41,Ms=42,ta=46,Ui=47,oa=59,Fl=62,jl=91,Hi=92,Bl=93,Bs=96,qi=123,Vl=124,Ki=125;function Gl(B){return Al.test(B.slice(-200))}var na=[""];function Wl(B){let X=na[B];if(X===void 0)X=Pl.repeat(B),na[B]=X;return X}function Ul(B,X){let he="";for(let Ae=B.length-1;Ae>=0&&he.length<X;Ae--)he=B[Ae]+he;return he.length>X?he.slice(-X):he}function Hl(B){if(B.length===0)return!1;let X=B[B.length-1];return X.charCodeAt(X.length-1)===Gi}function ql(B){while(B.length>0){let X=B[B.length-1],he=X.length;while(he>0){let Ae=X.charCodeAt(he-1);if(Ae!==ds&&Ae!==ra)break;he--}if(he===X.length)return;if(he===0){B.pop();continue}B[B.length-1]=X.slice(0,he);return}}function Kl(B){while(B.length>0){let X=B[B.length-1];if(!ia.test(X[X.length-1]))return;let he=X.trimEnd();if(he.length===X.length)return;if(he.length===0){B.pop();continue}B[B.length-1]=he;return}}function zl(B){if(B.includes("{"))return!1;let X=0,he=0;for(let Ae=0;Ae<B.length;Ae++){let $t=B.charCodeAt(Ae);if(X!==0){if($t===X&&B.charCodeAt(Ae-1)!==Hi)X=0;continue}if($t===Fs||$t===js||$t===Bs){X=$t;continue}if($t===oa&&++he>=2)return!0}return!1}function Xl(B){if(!_l.test(B))return B.trimEnd();let X="",he=null,Ae=!1;for(let $t=0;$t<B.length;$t++){let Lt=B[$t],Ot=B[$t-1];if(he){if(X+=Lt,he==="double"&&Lt==='"'&&Ot!=="\\"||he==="single"&&Lt==="'"&&Ot!=="\\"||he==="template"&&Lt==="`"&&Ot!=="\\")he=null;Ae=!1;continue}if(Lt==='"'||Lt==="'"||Lt==="`"){he=Lt==='"'?"double":Lt==="'"?"single":"template",X+=Lt,Ae=!1;continue}if(ia.test(Lt)){if(!Ae&&X.length>0)X+=" ",Ae=!0;continue}X+=Lt,Ae=!1}return X.trimEnd()}function aa(B,X){let he=B[X],Ae=B.indexOf(he,X+1);while(Ae!==-1&&B.charCodeAt(Ae-1)===Hi)Ae=B.indexOf(he,Ae+1);return Ae}function pa(B,X){let he=B.indexOf("*/",X+1);return he===-1?-1:he+1}function Jl(B){let X=new Map,he=[],Ae=Dl,$t=0;while($t<B.length){if(Ae.lastIndex=$t,!Ae.test(B))break;$t=Ae.lastIndex-1;let Lt=B.charCodeAt($t);if(Lt===Ui){if(B.charCodeAt($t+1)===Ms){let Ot=pa(B,$t);if(Ot===-1)break;$t=Ot}}else if(Lt===Fs||Lt===js||Lt===Bs){let Ot=aa(B,$t);if(Ot===-1)break;$t=Ot}else if(Lt===qi)he.push($t);else if(Lt===Ki&&he.length>0)X.set(he.pop(),$t);$t++}return X}function Yl(B,X,he){for(let Ae=X;Ae<he;Ae++)if(!Wi(B.charCodeAt(Ae)))return!1;return!0}function Wi(B){if(B<=ds)return B===ds||B>=ra&&B<=Il;if(B<160)return!1;return B===160||B===5760||B>=8192&&B<=8202||B===8232||B===8233||B===8239||B===8287||B===12288||B===65279}function ca(B,X,he,Ae){let $t=[],Lt=Rl,Ot=X,_t=X;while(_t<he){if(Lt.lastIndex=_t,!Lt.test(B))break;if(_t=Lt.lastIndex-1,_t>=he)break;let It=B.charCodeAt(_t);if(It===Ui){if(B.charCodeAt(_t+1)===Ms){let Mt=pa(B,_t);if(Mt===-1)break;_t=Mt}_t++;continue}if(It===Fs||It===js||It===Bs){let Mt=aa(B,_t);if(Mt===-1)break;_t=Mt+1;continue}if(It===qi){let Mt=Ae.get(_t);if(Mt===void 0||Mt>=he){_t++;continue}if(Ot<_t)$t.push(B.slice(Ot,_t));let Ft=_t+1;if(Yl(B,Ft,Mt)){$t.push("{}"),_t=Mt+1,Ot=_t;continue}let Vt=B.slice(Ft,Mt),Bt=B.charCodeAt(Ft)===Gi;if(!Bt&&!Vt.includes("/*")&&!zl(Vt)&&!Gl(Ul($t,Nl))){let Gt=ca(B,Ft,Mt,Ae),Wt=Gt.trim();if(!Wt.includes(`
|
|
25
|
-
`)){let Ut=Wt.endsWith(";")?Wt.slice(0,-1):Wt,Ht=`{ ${Xl(Ut)} }`;if(Ht.length<=Tl){$t.push(Ht),_t=Mt+1,Ot=_t;continue}}if($t.push("{"),Gt.charCodeAt(0)!==oa)$t.push(`
|
|
26
|
-
`);if(Gt.length>0)$t.push(Gt);_t=Mt,Ot=Mt;continue}if($t.push("{"),!Bt)$t.push(`
|
|
27
|
-
`);_t=Ft,Ot=Ft;continue}if(It===Ki){if(Ot<_t)$t.push(B.slice(Ot,_t));if(ql($t),!Hl($t))$t.push(`
|
|
28
|
-
`);$t.push("}"),_t++,Ot=_t;continue}if(Ot<_t)$t.push(B.slice(Ot,_t));if(Kl($t),$t.push(";"),B.charCodeAt(_t+1)!==Gi)$t.push(`
|
|
29
|
-
`);_t++,Ot=_t}if(Ot<he)$t.push(B.slice(Ot,he));return $t.join("")}function Ql(B){return ca(B,0,B.length,Jl(B))}function Zl(B){if(!B.includes(" "))return B;let X="",he=0;for(let Ae=0;Ae<B.length;Ae++){let $t=B.charCodeAt(Ae);if(he!==0){if(X+=B[Ae],$t===he&&B.charCodeAt(Ae-1)!==Hi)he=0;continue}if($t===Fs||$t===js||$t===Bs){he=$t,X+=B[Ae];continue}if($t===ds&&X.charCodeAt(X.length-1)===ds)continue;X+=B[Ae]}return X}function eu(B){return B===Ki||B===Bl||B===Ml||B===Fl}function tu(B,X,he){return he-X>=3&&B.charCodeAt(X)===Ui&&B.charCodeAt(X+1)===Ms&&B.charCodeAt(X+2)===Ms}function sa(B,X,he){let Ae=B.indexOf("*/",X);return Ae!==-1&&Ae+2<=he}function nu(B,X,he){let Ae=B.charCodeAt(X);if(Ae===Vl||Ae===Ll)return!0;return Ae===ta&&X+1<he&&B.charCodeAt(X+1)!==ta}function su(B){let X=[],he=[],Ae=B.length,$t=0,Lt=!1,Ot=0,_t=0;while(_t<=Ae){let Ft=B.indexOf(`
|
|
30
|
-
`,_t);if(Ft===-1)Ft=Ae;let Vt=Ft+1,Bt=_t,Gt=Ft;while(Bt<Gt&&Wi(B.charCodeAt(Bt)))Bt++;while(Gt>Bt&&Wi(B.charCodeAt(Gt-1)))Gt--;if(Bt===Gt){let Xt=he.length>0?he[he.length-1]:void 0;if(Xt!==void 0&&Xt!==""){let Zt=Xt.charCodeAt(Xt.length-1);if(Zt!==qi&&Zt!==Ol&&Zt!==jl)X.push(0),he.push("")}_t=Vt;continue}if(Lt){if(X.push(Ot),he.push(` ${B.slice(Bt,Gt)}`),sa(B,Bt,Gt))Lt=!1;_t=Vt;continue}let Wt=tu(B,Bt,Gt),Ut=Wt&&sa(B,Bt,Gt);if(Wt&&!Ut){X.push($t),he.push(B.slice(Bt,Gt)),Lt=!0,Ot=$t,_t=Vt;continue}let Ht=eu(B.charCodeAt(Bt)),zt=Math.max(0,$t-(Ht?1:0))+(nu(B,Bt,Gt)?1:0);if(Ht&&zt===0&&he.length>0&&he[he.length-1]==="")X.pop(),he.pop();if(X.push(zt),he.push(Zl(B.slice(Bt,Gt))),_t=Vt,Ut)continue;$t=Jn(B,void 0,Bt,Gt,$t)}let It=he.length;while(It>0&&he[It-1]==="")It--;let Mt=[];for(let Ft=0;Ft<It;Ft++){if(Ft>0)Mt.push(`
|
|
31
|
-
`);let Vt=X[Ft];if(Vt>0)Mt.push(Wl(Vt));Mt.push(he[Ft])}return Mt.join("")}function la(B){return`${su(Ql(B))}
|
|
32
|
-
`}var En="any",yn="",iu="Record<string, any>",Yi="Record<string, never>",Qi=/^[A-Za-z_$][A-Za-z0-9_$]*$/,ru=/CustomEvent/,ou=/^[A-Z]/,au=/\n/,ma=/=>/,pu=/(?:^|\n)@default\b/,Zi=/\n/g,cu=/^([ \t]*\*) +$/gm,lu=/\s+/g,Yn=/(^|[^.\w])Snippet(?:\s*<|\b)/,uu=/import\s+type\s+[^;]*\bSnippet\b[^;]*from\s+"svelte";/,hu=/[.*+?^${}()|[\]\\]/g,du=/^const\s+/,fu=/^export /,mu=/[^\w$]/g;function er(B){return B.replace(du,"")}function gu(B){if(!B)return;return B.replace(Zi,`
|
|
33
|
-
* `)}function Gs(B){if(!B)return"";return`/** ${g(B)} */`}function Ws(B){if(!B)return"";return`/**
|
|
34
|
-
* ${g(B).replace(Zi,`
|
|
35
|
-
* `)}
|
|
36
|
-
*/`}function ga(B){if(B===void 0)return;return B===!0?"@deprecated":`@deprecated ${B}`}function yu(B){let X=ga(B);if(X===void 0)return;return`* ${X.replace(Zi,`
|
|
37
|
-
* `)}
|
|
38
|
-
`}function xu(B,X){if(!X)return[`@${B}`];if(!X.includes(`
|
|
39
|
-
`))return[`@${B} ${X}`];return[`@${B}`,...X.split(`
|
|
40
|
-
`)]}function tr(B){let X=[];for(let{name:he,body:Ae}of B??[])X.push(...xu(he,Ae));return X}function Vs(B,X,he){let Ae=ga(he),$t=tr(X),Lt=$t.length>0;if(!B&&!Lt&&!Ae)return"";if(!Lt&&!Ae)return B?.includes(`
|
|
41
|
-
`)?Ws(B):Gs(B);let Ot=[];if(B)Ot.push(...B.split(`
|
|
42
|
-
`));if(Ot.push(...$t),Ae)Ot.push(...Ae.split(`
|
|
43
|
-
`));return`/**
|
|
44
|
-
* ${g(Ot.join(`
|
|
45
|
-
* `))}
|
|
46
|
-
*/`}function vu(B){let X=tr(B);if(X.length===0)return"";return X.map((he)=>`* ${he}
|
|
47
|
-
`).join("")}function Us(B){if(B===void 0)return En;return`${B}
|
|
48
|
-
`}function Hs(B){if(B.typedefs.length===0)return yn;return B.typedefs.map((X)=>{let he,Ae=tr(X.tags);if(Ae.length===0)he=X.description?`${Ws(X.description)}
|
|
49
|
-
`:"";else{let $t=X.description?[...X.description.split(`
|
|
50
|
-
`),...Ae]:Ae;he=`/**
|
|
51
|
-
* ${g($t.join(`
|
|
52
|
-
* `))}
|
|
53
|
-
*/
|
|
54
|
-
`}return`${he}export ${X.ts}`.replace(cu,"$1")}).join(`
|
|
55
|
-
|
|
56
|
-
`)}var ua=new Map;function Xi(B,X){let he=ua.get(X);if(he===void 0){let Ae=X.replace(hu,"\\$&");he=new RegExp(`\\b${Ae}\\b`),ua.set(X,he)}return he.test(B)}var ha,da=[];function nr(B){if(B!==ha)ha=B,da=i(B,",");return da}function Eu(B){if(B===null)return[];return B[0].split(",").map((X,he)=>({name:X.trim(),constraint:(nr(B[1]??"")[he]??X).trim()}))}function bu(B,X){let he=Eu(B).filter(({name:Ae})=>Xi(X,Ae));if(he.length===0)return{declSuffix:yn,refSuffix:yn};return{declSuffix:`<${he.map(({constraint:Ae})=>er(Ae)).join(", ")}>`,refSuffix:`<${he.map(({name:Ae})=>Ae).join(", ")}>`}}function ya(B){if(!B.contexts||B.contexts.length===0)return yn;let X=B.generics===null?[]:B.generics[0].split(",").map((he,Ae)=>({name:he.trim(),constraint:(nr(B.generics?.[1]??"")[Ae]??he).trim()}));return B.contexts.map((he)=>{let Ae=he.properties.map((It)=>{let Mt=It.description?`${Gs(It.description)}
|
|
57
|
-
`:"",Ft=It.optional?"?":"";return`${Mt}${It.name}${Ft}: ${It.type};`}).join(`
|
|
58
|
-
`),$t=he.description?`${Ws(he.description)}
|
|
59
|
-
`:"",Lt=X.filter(({name:It})=>he.type!==void 0&&Xi(he.type,It)||he.properties.some((Mt)=>Xi(Mt.type,It))).map(({constraint:It})=>It),Ot=Lt.length>0?`<${Lt.map(er).join(", ")}>`:"";if(he.type!==void 0)return`${$t}export type ${he.typeName}${Ot} = ${he.type};`;if(he.properties.length===0)return he.hasUnresolvedSpread?`${$t}export type ${he.typeName} = Record<string, any>;`:`${$t}export type ${he.typeName} = Record<string, never>;`;let _t=he.hasUnresolvedSpread?" & Record<string, any>":"";return`${$t}export type ${he.typeName}${Ot} = {
|
|
60
|
-
${Ae}
|
|
61
|
-
}${_t};`}).join(`
|
|
62
|
-
|
|
63
|
-
`)}function Fn(B){return Qi.test(B)?B:JSON.stringify(B)}function xa(B,X){if(!B)return;return`* ${X||B}
|
|
64
|
-
`}function Qn(B,X,he){return[xa(gu(B)),yu(X),vu(he)].filter(Boolean).join("")}function jn(B){return B.length>0?`/**
|
|
65
|
-
${g(B)}*/`:yn}function Cu(B){let X=B.props.filter((Ut)=>!Ut.isFunctionDeclaration&&Ut.kind!=="const"),he=new Set([...X.map((Ut)=>Ut.name),...Array.from(B.canonicalPropNames??[])]),Ae=X.map((Ut)=>{let Ht=typeof Ut.value==="string"?Ut.value.replace(lu," "):Ut.value,Xt=pu.test(Ut.description??"")||Ut.value===void 0||Ut.value==="undefined",Zt=[Qn(Ut.description,Ut.deprecated,Ut.tags),xa(Ut.constant,"@constant"),Xt?null:`* @default ${Ht}
|
|
66
|
-
`].filter(Boolean).join(""),tn=Ut.constant&&!Ut.isFunction?Ut.value:Ut.type||En;return`
|
|
67
|
-
${jn(Zt)}
|
|
68
|
-
${Fn(Ut.name)}${Ut.isRequired?"":"?"}: ${tn};`}),$t=B.canonicalPropsType?Ae.filter((Ut,Ht)=>{let zt=X[Ht];return zt?!(B.canonicalPropNames?.has(zt.name)??!1):!0}):Ae,Lt=(B.slots||[]).filter((Ut)=>!Ut.default&&Ut.name!=null&&!he.has(Ut.name)).map((Ut)=>{let Ht=Ut.name,zt=Fn(Ht),Xt=Vs(Ut.description,Ut.tags,Ut.deprecated),Zt=Xt?`${Xt}
|
|
69
|
-
`:"",an=Ut.slot_props&&Ut.slot_props!=="Record<string, never>"?`(this: void, ...args: [${Ut.slot_props}]) => void`:"(this: void) => void";return`
|
|
70
|
-
${Zt}${zt}?: ${an};`}),Ot=(B.slots||[]).find((Ut)=>Ut.default||Ut.name===null),_t=Ot&&!he.has("children")?(()=>{let Ut=Vs(Ot.description,Ot.tags,Ot.deprecated),Ht=Ut?`${Ut}
|
|
71
|
-
`:"",Xt=Ot.slot_props&&Ot.slot_props!=="Record<string, never>"?`(this: void, ...args: [${Ot.slot_props}]) => void`:"(this: void) => void";return`
|
|
72
|
-
${Ht}children?: ${Xt};`})():"",It=[...Lt,_t].filter(Boolean),Mt=[...$t,...It].join(`
|
|
73
|
-
`),Ft=Zn(B.moduleName),Vt=yn,Bt=B.generics?`<${nr(B.generics[1]).map((Ut)=>er(Ut.trim())).join(", ")}>`:"",Gt=B.generics?`<${B.generics[0]}>`:"",Wt=B.canonicalPropsType?`
|
|
74
|
-
type $Props${Bt} = ${B.canonicalPropsType}${Mt.trim()===""?"":` & {${Mt}
|
|
75
|
-
}`};
|
|
76
|
-
`:`
|
|
77
|
-
type $Props${Bt} = {
|
|
78
|
-
${Mt}
|
|
79
|
-
};
|
|
80
|
-
`;if(B.rest_props?.type==="Element"){let Ut;if(B.rest_props.name==="svelte:element")if(B.rest_props.thisValue)Ut=`SvelteHTMLElements["${B.rest_props.thisValue}"]`;else Ut="HTMLAttributes<HTMLElement>";else Ut=B.rest_props.name.split("|").map((Xt)=>`SvelteHTMLElements["${Xt.trim()}"]`).join(" & ");let Ht="[key: `data-${string}`]: unknown;",zt=B.rest_props.description?B.rest_props.description.includes(`
|
|
81
|
-
`)?`${Ws(B.rest_props.description)}
|
|
82
|
-
`:`${Gs(B.rest_props.description)}
|
|
83
|
-
`:"";if(B.extends===void 0)Vt=`
|
|
84
|
-
${zt}${Ut?`type $RestProps = ${Ut};
|
|
85
|
-
`:""}
|
|
86
|
-
${B.canonicalPropsType?`type $Props${Bt} = (${B.canonicalPropsType}) & {${Mt}
|
|
87
|
-
|
|
88
|
-
${Ht}
|
|
89
|
-
};`:`type $Props${Bt} = {
|
|
90
|
-
${Mt}
|
|
91
|
-
|
|
92
|
-
${Ht}
|
|
93
|
-
};`}
|
|
94
|
-
|
|
95
|
-
export type ${Ft}${Bt} = Omit<$RestProps, keyof $Props${Gt}> & $Props${Gt};
|
|
96
|
-
`;else Vt=`
|
|
97
|
-
${zt}${Ut?`type $RestProps = ${Ut};
|
|
98
|
-
`:""}
|
|
99
|
-
${B.canonicalPropsType?`type $Props${Bt} = (${B.canonicalPropsType}) & {${Mt}
|
|
100
|
-
|
|
101
|
-
${Ht}
|
|
102
|
-
};`:`type $Props${Bt} = {
|
|
103
|
-
${Mt}
|
|
104
|
-
|
|
105
|
-
${Ht}
|
|
106
|
-
};`}
|
|
107
|
-
|
|
108
|
-
export type ${Ft}${Bt} = Omit<$RestProps, keyof ($Props${Gt} & ${B.extends.interface})> & Omit<${B.extends.interface}, keyof $Props${Gt}> & $Props${Gt};
|
|
109
|
-
`}else if(Mt.trim()===""&&B.extends===void 0&&!B.canonicalPropsType)Vt=`
|
|
110
|
-
export type ${Ft}${Bt} = ${Yi};
|
|
111
|
-
`;else if(B.canonicalPropsType)Vt=`
|
|
112
|
-
${Wt}
|
|
113
|
-
export type ${Ft}${Bt} = ${B.extends===void 0?"":`Omit<${B.extends.interface}, keyof $Props${Gt}> & `}$Props${Gt};
|
|
114
|
-
`;else if(B.extends===void 0)Vt=`
|
|
115
|
-
export type ${Ft}${Bt} = {
|
|
116
|
-
${Mt}
|
|
117
|
-
};
|
|
118
|
-
`;else Vt=`
|
|
119
|
-
type $Props${Bt} = {
|
|
120
|
-
${Mt}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export type ${Ft}${Bt} = Omit<${B.extends.interface}, keyof $Props${Gt}> & $Props${Gt};
|
|
124
|
-
`;return{props_name:Ft,prop_def:Vt}}function Su(B){if(B.slots.length===0)return Yi;let X=B.slots.map(({name:he,slot_props:Ae,...$t})=>{let Lt=$t.default||he===null?"default":Fn(he??""),Ot=Vs($t.description,$t.tags,$t.deprecated);return`${Ot?`${Ot}
|
|
125
|
-
`:""}${Lt}: ${Us(Ae)};`}).join(`
|
|
126
|
-
`);return B.slots.length===1?`{${X}}`:`{
|
|
127
|
-
${X}
|
|
128
|
-
}`}var wu=()=>"WindowEventMap",ku=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseover","mouseout","mouseenter","mouseleave","contextmenu","wheel","keydown","keyup","keypress","submit","change","input","focus","blur","focusin","focusout","reset","select","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragover","dragenter","dragleave","drop","pointerdown","pointerup","pointermove","pointerover","pointerout","pointerenter","pointerleave","pointercancel","gotpointercapture","lostpointercapture","play","pause","ended","volumechange","timeupdate","loadeddata","loadedmetadata","canplay","canplaythrough","seeking","seeked","playing","waiting","stalled","suspend","abort","error","emptied","ratechange","durationchange","loadstart","progress","loadend","animationstart","animationend","animationiteration","animationcancel","transitionstart","transitionend","transitionrun","transitioncancel","scroll","resize","load","unload","beforeunload","cut","copy","paste","compositionstart","compositionupdate","compositionend"]);function zi(B=En){if(ru.test(B))return B;return`CustomEvent<${B}>`}function $u(B){return ku.has(B)}function Pu(B){switch(B.type){case"dispatched":return zi(B.detail);case"forwarded":{let X=B.element,Ae=!(X&&ou.test(X))||$u(B.name),$t=B.detail!==void 0&&B.detail!=="undefined"&&!(B.detail==="null"&&Ae),Lt=B.detail==="null"&&!Ae;if($t||Lt)return zi(B.detail);else if(Ae)return`${wu()}["${B.name}"]`;else return zi()}default:return B}}function fa(B){if(B.events.length===0)return iu;let X=B.events.map((he)=>{let Ae="",$t=Vs(he.description,he.tags,he.deprecated);if($t)Ae=`${$t}
|
|
129
|
-
`;return`${Ae}${Fn(he.name)}: ${Pu(he)};
|
|
130
|
-
`}).join("");return B.events.length===1?`{${X}}`:`{
|
|
131
|
-
${X}}`}function Tu(B){let X=B.type==="() => any";if(B.type&&ma.test(B.type)&&!X)return B.type;else if(B.params&&B.params.length>0)return`(${E(B.params)}) => ${B.returnType||En}`;else if(B.returnType)return`() => ${B.returnType}`;else return B.type||En}function va(B){return B.props.filter((X)=>X.isFunctionDeclaration||X.kind==="const").map((X)=>{let he=Qn(X.description,X.deprecated,X.tags),Ae=Tu(X);return`
|
|
132
|
-
${jn(he)}
|
|
133
|
-
${Fn(X.name)}: ${Ae};`}).join(`
|
|
134
|
-
`)}function Au(B){let X=fs(B.moduleName),he=va({props:B.props});if(he.trim()==="")return{exports_name:X,exports_ref:X,exports_def:`export type ${X} = ${Yi};`};let{declSuffix:Ae,refSuffix:$t}=bu(B.generics,he);return{exports_name:X,exports_ref:`${X}${$t}`,exports_def:`export type ${X}${Ae} = {${he}
|
|
135
|
-
};`}}function Nu(B){let X=B.props.filter((he)=>he.bindable===!0||he.binding==="writable").map((he)=>JSON.stringify(he.name));return X.length===0?yn:X.join(" | ")}function Ea(B){return B==="default"?"$$Component":B}function _u(B){let X=Ea(B.moduleName),he=B.bindings===yn?'""':B.bindings;return`declare const ${X}: Component<
|
|
136
|
-
${B.propsRef},
|
|
137
|
-
${B.exportsRef},
|
|
138
|
-
${he}
|
|
139
|
-
>;
|
|
140
|
-
export default ${X};`}function Du(B){let X=Ea(B.moduleName),he=`${X}Component`,Ae=B.bindings===yn?'""':B.bindings,$t=B.eventsRef?`$on?<K extends keyof ${B.eventsRef} & string>(type: K, callback: (e: ${B.eventsRef}[K]) => void): () => void;`:"$on?(type: string, callback: (e: any) => void): () => void;";return`interface ${he} {
|
|
141
|
-
new ${B.generic}(
|
|
142
|
-
options: ComponentConstructorOptions<${B.propsRef}>
|
|
143
|
-
): SvelteComponent<${B.propsRef}${B.eventsRef?`, ${B.eventsRef}`:""}> & ${B.exportsRef};
|
|
144
|
-
${B.generic}(
|
|
145
|
-
this: void,
|
|
146
|
-
internals: ComponentInternals,
|
|
147
|
-
props: ${B.propsRef}
|
|
148
|
-
): {
|
|
149
|
-
${$t}
|
|
150
|
-
$set?(props: Partial<${B.propsRef}>): void;
|
|
151
|
-
} & ${B.exportsRef};
|
|
152
|
-
element?: typeof HTMLElement;
|
|
153
|
-
z_$$bindings?: ${Ae};
|
|
154
|
-
}
|
|
155
|
-
declare const ${X}: ${he};
|
|
156
|
-
export default ${X};`}function Ru(B){if(B.extends===void 0)return"";return`import type { ${B.extends.interface} } from ${B.extends.import};`}function Iu(B){if(!B.componentComment)return"";if(!au.test(B.componentComment))return Gs(B.componentComment.trim());return`/*${g(B.componentComment).split(`
|
|
157
|
-
`).map((X)=>`* ${X}`).join(`
|
|
158
|
-
`)}
|
|
159
|
-
*/`}function Ji(B){return Qi.test(B)?B:JSON.stringify(B)}function Lu(B){let X=[],he=new Map;for(let Ae of B.moduleExports){if(Ae.kind!=="re-export"||!Ae.reExport)continue;let{from:$t,imported:Lt}=Ae.reExport,Ot=Qn(Ae.description,Ae.deprecated,Ae.tags),_t=Ji(Ae.name);if(Lt==="*"){let Ft=Ae.name==="*"?"*":`* as ${_t}`;X.push(`${jn(Ot)}
|
|
160
|
-
export ${Ft} from ${JSON.stringify($t)};`);continue}let It=`${$t}\x00${Ot}`,Mt=he.get(It);if(!Mt)Mt={comments:Ot,from:$t,specifiers:[]},he.set(It,Mt),X.push(It);Mt.specifiers.push(Lt===Ae.name?_t:`${Ji(Lt)} as ${_t}`)}return X.map((Ae)=>{let $t=he.get(Ae);if(!$t)return Ae;return`${jn($t.comments)}
|
|
161
|
-
export { ${$t.specifiers.join(", ")} } from ${JSON.stringify($t.from)};`}).join(`
|
|
162
|
-
|
|
163
|
-
`)}function sr(B){let X=[B.static?"static ":"",B.abstract?"abstract ":"",B.readonly?"readonly ":""].join(""),he=B.optional?"?":"";if(B.kind==="property")return`${X}${Fn(B.name)}${he}: ${B.type??En}`;let Ae=E(B.params??[]);if(B.kind==="constructor")return`constructor(${Ae})`;let $t=B.typeParameters?`<${B.typeParameters}>`:"";return`${X}${Fn(B.name)}${he}${$t}(${Ae}): ${B.returnType??En}`}function Ou(B,X){let he=B.localName??B.name,Ae=he!==B.name,$t=`export { ${he}${Ae?` as ${Ji(B.name)}`:""} };`;if(X.has(he))return $t;X.add(he);let Lt=B.typeParameters?`<${B.typeParameters}>`:"",Ot=(B.members??[]).map((Ft)=>[jn(Qn(Ft.description,Ft.deprecated,Ft.tags)),`${sr(Ft)};`].filter(Boolean).join(`
|
|
164
|
-
`)).join(`
|
|
165
|
-
|
|
166
|
-
`),_t=`${B.extends?` extends ${B.extends}`:""}${B.implements?.length?` implements ${B.implements.join(", ")}`:""}`,It=`${Ae?"":"export "}declare ${B.abstract?"abstract ":""}class ${he}${Lt}${_t}`;return`
|
|
167
|
-
${[jn(Qn(B.description,B.deprecated,B.tags)),Ot?`${It} {
|
|
168
|
-
${Ot}
|
|
169
|
-
}`:`${It} {}`,Ae?$t:""].filter(Boolean).join(`
|
|
170
|
-
`)}`}function Mu(B){let X=Lu(B),he=new Set,Ae=B.moduleExports.filter(($t)=>$t.kind!=="re-export").map(($t)=>{if($t.kind==="class")return Ou($t,he);let Lt=!Qi.test($t.name),Ot=Lt?{...$t,name:Fu($t.name)}:$t,_t=Qn(Ot.description,Ot.deprecated,Ot.tags),It,Mt=Ot.type&&ma.test(Ot.type),Ft=Ot.type==="() => any",Vt=Ot.typeParameters?`<${Ot.typeParameters}>`:"";if(Ot.kind==="const"&&!Mt)It=`export declare const ${Ot.name}: ${Ot.type||En};
|
|
171
|
-
`;else if(Ot.params&&Ot.params.length>0)It=`export declare function ${Ot.name}${Vt}(${E(Ot.params)}): ${Ot.returnType||En};`;else if(Ot.returnType)It=`export declare function ${Ot.name}${Vt}(): ${Ot.returnType};`;else if(Mt&&Ot.type&&!Ft){let[Bt,Gt,...Wt]=Ot.type.split("=>"),Ut=Wt.map((Ht)=>` => ${Ht.trim()}`).join("");It=`export declare function ${Ot.name}${Bt.trimEnd()}: ${Gt.trim()}${Ut};`}else if(Mt&&Ot.type){let[Bt,Gt,...Wt]=Ot.type.split("=>"),Ut=Wt.map((Ht)=>` => ${Ht.trim()}`).join("");It=`export declare function ${Ot.name}${Bt.trimEnd()}: ${Gt.trim()}${Ut};`}else if(Ot.kind==="const")It=`export declare const ${Ot.name}: ${Ot.type||En};
|
|
172
|
-
`;else It=`export declare let ${Ot.name}: ${Ot.type||En};`;if(Lt)It=`${It.replace(fu,"").trimEnd()}
|
|
173
|
-
export { ${Ot.name} as ${JSON.stringify($t.name)} };`;return`
|
|
174
|
-
${jn(_t)}
|
|
175
|
-
${It}`}).join(`
|
|
176
|
-
`);return[X,Ae].filter(Boolean).join(`
|
|
177
|
-
|
|
178
|
-
`)}function Fu(B){return`__export_${B.replace(mu,"_")}`}var ju=120;function Bu(B){let he=`export default class ${B.moduleName==="default"?"":B.moduleName}${B.generic} extends SvelteComponentTyped<`,Ae=[B.genericProps,B.events,B.slots];if(B.accessors.trim()===""&&Ae.every(($t)=>!$t.includes(`
|
|
179
|
-
`))){let $t=`${he}${Ae.join(", ")}> {}`;if($t.length<=ju)return $t}return`${he}
|
|
180
|
-
${B.genericProps},
|
|
181
|
-
${B.events},
|
|
182
|
-
${B.slots}
|
|
183
|
-
> {
|
|
184
|
-
${B.accessors}
|
|
185
|
-
}`}function Zn(B){return`${B}Props`}function fs(B){return`${B}Exports`}function ir(B){return{format:B.format}}var Vu={format:"class"};function ba(B){let X=ir(B??{}),he={};for(let[Ae,$t]of Object.entries(X))he[Ae]=$t??Vu[Ae];return JSON.stringify(he)}function rr(B,X){let he=ea(B),{moduleName:Ae,typedefs:$t,generics:Lt,props:Ot,moduleExports:_t,slots:It,events:Mt,rest_props:Ft,extends:Vt,componentComment:Bt,contexts:Gt}=B,Wt=X?.format==="component",Ut=Lt!==null,{props_name:Ht,prop_def:zt}=Cu({moduleName:Ae,props:Ot,rest_props:Ft,extends:Vt,generics:Lt,slots:It,canonicalPropNames:new Set(he?.canonicalPropNames??[]),canonicalPropsType:he?.canonicalPropsType}),Xt=Lt?`<${Lt[1]}>`:"",Zt=Lt?`${Ht}<${Lt[0]}>`:Ht,tn=Wt&&Mt.length>0?`type $Events${Xt} = ${fa({events:Mt})};`:"",an=Lt?`$Events<${Lt[0]}>`:"$Events",In=Wt&&(Ut||tn!==""),ns=Mu({moduleExports:_t}),ss=Hs({typedefs:$t}),hn=ya({contexts:Gt,generics:Lt}),Un=(he?.typeImportStatements??[]).join(`
|
|
186
|
-
`),Xr=[...he?.localTypeDeclarations??[],...he?.moduleTypeDeclarations??[]].join(`
|
|
187
|
-
|
|
188
|
-
`),{exports_ref:Jr,exports_def:Yr}=Wt?Au({props:Ot,moduleName:Ae,generics:Lt}):{exports_ref:yn,exports_def:yn},Qr=Wt?Nu({props:Ot}):yn,li=!uu.test(Un)&&(Yn.test(zt)||Yn.test(ns)||Yn.test(ss)||Yn.test(hn)||Yn.test(Xr)||Yn.test(Yr)),Up=Ft?.type==="Element"&&(Ft.name!=="svelte:element"||Ft.name==="svelte:element"&&Ft.thisValue),Hp=Ft?.type==="Element"&&Ft.name==="svelte:element"&&!Ft.thisValue,qp=[Wt?In?`import type { SvelteComponent, ComponentConstructorOptions, ComponentInternals${li?", Snippet":""} } from "svelte";`:`import type { Component${li?", Snippet":""} } from "svelte";`:`import { SvelteComponentTyped${li?", type Snippet":""} } from "svelte";`,Up?'import type { SvelteHTMLElements } from "svelte/elements";':"",Hp?'import type { HTMLAttributes } from "svelte/elements";':"",Un,Ru({extends:Vt})].filter(Boolean).join(`
|
|
189
|
-
`),Kp=Wt?In?Du({moduleName:Ae,generic:Xt,propsRef:Zt,exportsRef:Jr,bindings:Qr,...tn?{eventsRef:an}:{}}):_u({moduleName:Ae,propsRef:Zt,exportsRef:Jr,bindings:Qr}):Bu({moduleName:Ae,generic:Xt,genericProps:Zt,events:fa({events:Mt}),slots:Su({slots:It}),accessors:va({props:Ot})}),zp=[ns,ss,Xr,hn,zt,Yr,tn,[Iu({componentComment:Bt}),Kp].filter(Boolean).join(`
|
|
190
|
-
`)].map((Xp)=>Xp.trim()).filter(Boolean).join(`
|
|
191
|
-
|
|
192
|
-
`);return la([qp,zp].filter(Boolean).join(`
|
|
193
|
-
|
|
194
|
-
`))}var Wu=[...zn,".svelte"];function Uu(B){let X=B.trim();if(X.length<2)return;let he=X[0],Ae=X[X.length-1];if((he==='"'||he==="'"||he==="`")&&he===Ae)return X.slice(1,-1);return}function Ca(B){let X=[],he=B.moduleExports.filter(($t)=>$t.kind==="re-export");if(he.length===0)return X;let Ae=new Set([Zn(B.moduleName),fs(B.moduleName)]);for(let $t of he){if(!Ae.has($t.name))continue;X.push(s({component:B.filePath,kind:"module-export-conflict",name:$t.name,message:`Re-export "${$t.name}" has the same name as the generated "${$t.name}" type; the .d.ts won't type-check if "${$t.reExport?.from}" exports a type by that name.`,source:$t.source}))}return X}function Sa(B,X,he){let Ae=new Map(Array.from(B.values()).map(($t)=>[X($t.filePath),$t]));return($t)=>{let Lt=$t.extends;if(!Lt)return[];let Ot=Uu(Lt.import);if(Ot===void 0||!Ot.startsWith(".")&&!Ot.startsWith("/"))return[];let _t=X($t.filePath),It=he.resolve(Ot,Gu(_t),Wu);if(It===null)return[s({component:$t.filePath,kind:"extend-props-target-missing",name:Lt.interface,message:`@extends/@extendProps target "${Ot}" was not found on disk.`})];let Mt=Ae.get(It);if(!Mt)return[];let Ft=Zn(Mt.moduleName);if(Lt.interface!==Ft)return[s({component:$t.filePath,kind:"extend-props-target-missing",name:Lt.interface,message:`@extends/@extendProps names "${Lt.interface}", but "${Ot}" generates "${Ft}".`})];let Vt=[];for(let Bt of $t.props){let Gt=Mt.props.find((Wt)=>Wt.name===Bt.name);if(Gt&&Gt.type!==Bt.type)Vt.push(s({component:$t.filePath,kind:"extend-props-override",name:Bt.name,message:`Own prop "${Bt.name}" (${Bt.type}) overrides "${Ft}"'s "${Bt.name}" (${Gt.type}).`}))}return Vt}}import{lstatSync as mh,readFileSync as gh,realpathSync as yh,statSync as xh}from"node:fs";import{basename as vh,dirname as Eh,isAbsolute as bh,join as Oa,parse as Ch,relative as fr,resolve as Xs}from"node:path";function z(B){return B}function Pn(B){if(B==="")return B;return B.startsWith(".")?B:`./${B}`}import{readFileSync as Ia}from"node:fs";import{dirname as hr,join as dh,relative as _a,resolve as Da}from"node:path";import{readFileSync as ih,statSync as rh}from"node:fs";import{basename as ur,dirname as zs,isAbsolute as oh,join as ah,resolve as ph}from"node:path";import{existsSync as Hu,readdirSync as qu}from"node:fs";import{join as Ku}from"node:path";function wa(B){return B.normalize("NFC").toLowerCase()}class or{listings=new Map;clear(){this.listings.clear()}entries(B){return this.read(B)?.entries??null}entry(B,X){let he=this.read(B);if(he===null)return;if(he.byName===void 0){he.byName=new Map;for(let Ae of he.entries)he.byName.set(Ae.name,Ae)}return he.byName.get(X)}has(B,X){let he=this.read(B);if(he===null)return!1;if(he.names.has(X))return!0;if(he.folded===void 0){he.folded=new Map;for(let $t of he.names)he.folded.set(wa($t),$t)}let Ae=he.folded.get(wa(X));return Ae!==void 0&&Ae!==X&&Hu(Ku(B,X))}read(B){let X=this.listings.get(B);if(X!==void 0)return X;try{let he=qu(B,{withFileTypes:!0}),Ae=new Set;for(let $t of he)Ae.add($t.name);X={entries:he,names:Ae}}catch{X=null}return this.listings.set(B,X),X}}var ar=!1;function j(B){ar=B}function Tn(B){if(!ar)console.error(B)}function ka(B){if(!ar)console.error(B)}var ms=null,pr=null;function _n(){if(ms)return Promise.resolve(ms);if(!pr)pr=import("./chunk-ynrmtc58.js").then((B)=>(ms=B,B));return pr}function bn(){if(!ms)throw Error("sveld: internal error, parser stack read before loadParserStack() resolved.");return ms}import{existsSync as qs,readFileSync as zu}from"node:fs";import{dirname as cr,isAbsolute as Xu,join as Ju,relative as Yu,resolve as Ks}from"node:path";function $a(B){if(!nn(B))return{};let X={};if(typeof B.svelte==="string")X.svelte=B.svelte;if(typeof B.name==="string")X.name=B.name;if(typeof B.description==="string")X.description=B.description;return X}function Pa(B){if(!nn(B))return{};let X={};if(typeof B.extends==="string")X.extends=B.extends;if(nn(B.compilerOptions)){let he={};if(typeof B.compilerOptions.baseUrl==="string")he.baseUrl=B.compilerOptions.baseUrl;if(nn(B.compilerOptions.paths)){let Ae={};for(let[$t,Lt]of Object.entries(B.compilerOptions.paths))if(Array.isArray(Lt)&&Lt.every((Ot)=>typeof Ot==="string"))Ae[$t]=Lt;if(Object.keys(Ae).length>0)he.paths=Ae}if(Object.keys(he).length>0)X.compilerOptions=he}return X}var Ta=new Map,Qu=/\/\*[\s\S]*?\*\/|\/\/.*/g,Zu=/[.+?^${}()|[\]\\]/g,eh=[".svelte",...zn];class q extends Error{specifier;fromFile;searched;constructor(B,X,he){super(`cannot resolve "${B}" from ${X||"."} (${he})`);this.name="UnresolvedModuleError",this.specifier=B,this.fromFile=X,this.searched=he}}function th(B){if(qs(B))return!0;return eh.some((X)=>qs(B+X))}function Aa(B){let X=B.indexOf("*");return X===-1?B.length:X}function nh(B){let X=B,he=Ks(X,"/");while(X!==he){for(let Ae of["tsconfig.json","jsconfig.json"]){let $t=Ju(X,Ae);if(qs($t))return $t}X=cr(X)}return null}function Na(B,X){if(X.has(B))return X.get(B)??null;try{let he=zu(B,"utf-8"),Ae;try{Ae=JSON.parse(he)}catch{let Lt=he.replace(Qu,"");Ae=JSON.parse(Lt)}let $t=Pa(Ae);if($t.extends){let Lt=Xu($t.extends)?$t.extends:Ks(cr(B),$t.extends),Ot=Lt.endsWith(".json")?Lt:`${Lt}.json`;if(qs(Ot)){let _t=Na(Ot,X);if(_t)$t.compilerOptions={..._t.compilerOptions,...$t.compilerOptions,paths:{..._t.compilerOptions?.paths,...$t.compilerOptions?.paths}}}}return X.set(B,$t),$t}catch{return X.set(B,null),null}}function sh(B){let X=Ta.get(B);if(!X){let he=B.split("*").map((Ae)=>Ae.replace(Zu,"\\$&")).join("(.*)");X=new RegExp(`^${he}$`),Ta.set(B,X)}return X}class lr{configs=new Map;lookup(B,X){if(B.startsWith(".")||B.startsWith("/"))return{resolved:B,unresolved:!1,searched:""};let he=nh(X);if(!he)return{resolved:B,unresolved:!0,searched:"no tsconfig/jsconfig paths found"};let Ae=Na(he,this.configs);if(!Ae?.compilerOptions?.paths)return{resolved:B,unresolved:!0,searched:"no tsconfig/jsconfig paths found"};let{baseUrl:$t=".",paths:Lt}=Ae.compilerOptions,Ot=cr(he),_t=Ks(Ot,$t),It=Object.entries(Lt).sort(([Mt],[Ft])=>Aa(Ft)-Aa(Mt));for(let[Mt,Ft]of It){let Vt=B.match(sh(Mt));if(!Vt)continue;let Bt;for(let Gt of Ft){let Wt=Gt;for(let Ht=1;Ht<Vt.length;Ht++)Wt=Wt.replace("*",Vt[Ht]);let Ut=Ks(_t,Wt);if(Bt===void 0)Bt=Ut;if(th(Ut))return{resolved:Ut,unresolved:!1,searched:he}}return{resolved:Bt??B,unresolved:!1,searched:he}}return{resolved:B,unresolved:!0,searched:`tsconfig paths (${he})`}}absolute(B,X){return this.lookup(B,X).resolved}relative(B,X){if(B.startsWith(".")||B.startsWith("/"))return B;let he=this.absolute(B,X);if(he===B)return B;let Ae=Yu(X,he);return Ae=t(Ae),Ae.startsWith(".")?Ae:`./${Ae}`}}var ch=/\.[mc]?jsx?$/,lh={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function uh(B){return B==="."||B===".."||B.startsWith("./")||B.startsWith("../")||oh(B)}class Dn{aliases=new lr;listings=new or;modules=new Map;programs=new Map;listDirectory(B){return this.listings.entries(B)}exists(B){return this.listings.has(zs(B),ur(B))}resolve(B,X,he=zn){let Ae=this.aliases.absolute(B,X);if(Ae===B&&!uh(B))return null;let $t=ph(X,Ae),Lt=zs($t),Ot=ur($t);if(this.listings.has(Lt,Ot)){let _t=this.listings.entry(Lt,Ot),It=_t&&!_t.isSymbolicLink()?_t:rh($t,{throwIfNoEntry:!1});if(It?.isFile())return $t;for(let Mt of he)if(this.listings.has(Lt,Ot+Mt))return $t+Mt;if(It?.isDirectory()){for(let Mt of he)if(this.listings.has($t,`index${Mt}`))return ah($t,`index${Mt}`)}return null}for(let _t of he)if(this.listings.has(Lt,Ot+_t))return $t+_t;return this.typeScriptCounterpart($t)??null}parse(B){let X=this.modules.get(B);if(X===void 0)X=hh(B),this.modules.set(B,X);return X}parseJavaScript(B,X){let he=this.programs.get(B);if(he?.source===X)return he.ast;let Ae;try{Ae=ce(X)}catch($t){throw Error(me($t))}return this.programs.set(B,{source:X,ast:Ae}),Ae}invalidate(...B){this.listings.clear();for(let X of B)this.modules.delete(X),this.programs.delete(X)}typeScriptCounterpart(B){let X=ch.exec(B)?.[0];if(X===void 0)return;let he=B.slice(0,-X.length),Ae=zs(he),$t=ur(he);for(let Lt of lh[X]??[])if(this.listings.has(Ae,$t+Lt))return he+Lt;return}}function hh(B){let X;try{X=ih(B,"utf-8")}catch{return null}try{let he;if(B.endsWith(".svelte"))he=bn().parseSvelte(X).module?.content.body??[];else he=bn().parseModule(X,{typescript:!0}).body;return{source:{text:X,filePath:B,dir:zs(B)},body:he}}catch(he){return ka(`Warning: sveld couldn't parse ${B} to read its exports (${me(he)}); skipping it.`),null}}function Ra(B){return B.type==="Identifier"?B.name:B.value}function fh(B,X,he,Ae){let $t=B.resolve(X,he);if(!$t)return null;let Lt=hr($t);if(Ae.has($t))return{dir:Lt,exports:{}};Ae.add($t);try{return{dir:Lt,exports:dr(B,Ia($t,"utf-8"),Lt,Ae,$t)}}catch{return{dir:Lt,exports:{}}}finally{Ae.delete($t)}}function La(B,X,he=new Dn,Ae=new Set){return dr(he,B,X,Ae,X)}function dr(B,X,he,Ae,$t){let Lt=B.parseJavaScript($t,X),Ot={};for(let _t of Lt.body)if(_t.type==="ExportDefaultDeclaration"){if(_t.declaration.type!=="Identifier")continue;let It=_t.declaration.name;if(It in Ot)Ot[It].default=!0;else Ot[It]={source:Pn(""),default:!0}}else if(_t.type==="ExportAllDeclaration"){let It=_t.source.value,Mt=B.resolve(It,he);if(!Mt){let Bt=B.aliases.lookup(It,he);throw new q(It,$t,Bt.unresolved?Bt.searched:"no matching file or index found")}if(Ae.has(Mt))continue;Ae.add(Mt);let Ft=Ia(Mt,"utf-8"),Vt=dr(B,Ft,hr(Mt),Ae,Mt);Ae.delete(Mt);for(let[Bt,Gt]of Object.entries(Vt)){let Wt=Pn(t(Gt.source.startsWith(".")?`./${_a(he,Da(hr(Mt),Gt.source))}`:`./${dh(It,Gt.source)}`));Ot[Bt]={...Gt,source:Wt}}}else if(_t.type==="ExportNamedDeclaration"){let It=_t.source?.value,Mt=It!==void 0&&Sn.test(It);if(Mt){let Bt=B.aliases.lookup(It,he);if(Bt.unresolved)throw new q(It,$t,Bt.searched)}let Vt=It!==void 0&&!Mt?fh(B,It,he,Ae):void 0;if(Vt===null)console.warn(`sveld: could not resolve re-exported module "${It}" from barrel "${he||"."}"; skipping.`);for(let Bt of _t.specifiers){let Gt=Ra(Bt.exported),Wt=Ra(Bt.local),Ut=Gt||Wt;if(Vt===null)continue;let Ht=Vt?.exports[Wt],zt=Ht?Pn(t(`./${_a(he,Da(Vt.dir,Ht.source))}`)):Pn(B.aliases.relative(It??"",he)),Xt=Ht?Ht.default:Wt==="default";if(Ut in Ot){if(Ot[Ut].mixed=!0,!Ot[Ut].source)Ot[Ut].source=zt}else Ot[Ut]={source:zt,default:Xt}}}else if(_t.type==="ImportDeclaration"){let It=_t.specifiers[0];if(!It)continue;let Mt=It.local.name,Ft=_t.source.value;if(Mt in Ot){if(!Ot[Mt].source)Ot[Mt].source=Pn(B.aliases.relative(Ft,he))}else Ot[Mt]={source:Pn(B.aliases.relative(Ft,he)),default:Mt==="default"}}return Ot}var Ma=/-/g,Sh=/[^A-Za-z0-9_$]/g,wh=/^[0-9]/;function Fa(B,X){let he=B.replace(Sh,""),Ae=wh.test(he)?`_${he}`:he;if(Ae!==B&&!X?.has(B))X?.add(B),console.warn(`Warning: "${B}" is not a valid identifier; using "${Ae}" instead.`);return Ae}function ja(B,X,he=[],Ae=new Set,$t){let Lt;try{Lt=$t??yh(X)}catch{return he}if(Ae.has(Lt))return he;Ae.add(Lt);let Ot=B.listDirectory(X);if(Ot===null)return he;for(let _t of Ot){if(_t.name.startsWith("."))continue;let It=Oa(X,_t.name),Mt=_t.isSymbolicLink(),Ft=Mt?xh(It,{throwIfNoEntry:!1}):_t;if(!Ft)continue;if(Ft.isDirectory())ja(B,It,he,Ae,Mt?void 0:Oa(Lt,_t.name));else if(Ft.isFile()&&_t.name.endsWith(".svelte"))he.push(It)}return he}function kh(B,X){return ja(B,X).map((he)=>{let Ae=Fa(vh(he,".svelte").replace(Ma,"")),$t=Pn(t(`./${fr(X,he)}`));return{moduleName:Ae,source:$t}}).sort((he,Ae)=>c(he.source,Ae.source))}function $h(B){return!Xn(B)}function Ph(B,X){let he=B.endsWith("/")?B:`${B}/`;return X.startsWith(he)}function Js(B,X){return{seenPaths:new Set(B.map(([,he])=>X(he.source))),seenModuleNamePaths:new Map(B.map(([he,Ae])=>[he,X(Ae.source)])),warnedModuleNames:new Set}}function mr(B,X,he,Ae,$t,Lt){for(let{moduleName:Ot,source:_t}of kh(B,X)){let It=$t(_t),Mt=he[Ot];if(Mt&&$h(Mt.source)&&Ph(Mt.source,_t)){Lt.seenPaths.delete($t(Mt.source)),Mt.source=_t,Lt.seenPaths.add(It),Lt.seenModuleNamePaths.set(Ot,It);continue}if(Lt.seenPaths.has(It))continue;Lt.seenPaths.add(It);let Ft=Lt.seenModuleNamePaths.get(Ot);if(Ft===void 0)Lt.seenModuleNamePaths.set(Ot,It);else if(Ft!==It&&!Lt.warnedModuleNames.has(Ot))Lt.warnedModuleNames.add(Ot),console.warn(`Warning: multiple components named "${Ot}" found (${t(fr(X,Ft))} and ${t(fr(X,It))}). Both are included in TypeScript definitions, but only one can be the named export.`);Ae.push([Ot,{source:_t,default:!1}])}}function gr(B,X,he,Ae){let $t=mh(B).isFile(),Lt=$t?Eh(B):B,Ot=Xs(Lt),_t=new Map,It=(Vt)=>{let Bt=_t.get(Vt);if(Bt===void 0)Bt=bh(Vt)?Xs(Vt):Xs(Ot,Vt),_t.set(Vt,Bt);return Bt},Mt={};if($t){let Vt=gh(B,"utf-8");try{Mt=La(Vt,Ot,Ae,new Set([Xs(B)]))}catch(Bt){if(!he)throw Bt;let Gt=Bt instanceof Error?Bt.message:String(Bt);console.warn(`Warning: Failed to parse component exports from ${B}: ${Gt}`)}}let Ft=Object.entries(Mt);if(X){let Vt=Js(Ft,It);if(mr(Ae,Ot,Mt,Ft,It,Vt),!$t)Mt=Object.fromEntries(Ft.map(([Bt,Gt])=>[Bt,{...Gt,default:!0}]))}return{exports:Mt,allComponentEntries:Ft,rootDir:Ot,resolveComponentFilePath:It}}function yr(B,X,he,Ae){if(he!==1||B!=="default")return B;return Fa(Ch(X).name.replace(Ma,""),Ae)}import{resolve as Gh}from"node:path";var xr="/**",Ba="*",Ys="*/",Th="```",vr=/^\s+/,Va=/\s/,Ah=/^@[^\s/]+(?=\s|$)/,Nh=/^@(\S+)\s*/,_h=new Set(["extends","extendProps","generics","template","typedef"]);function F(B){let X=0;while(X<B.length){let he=B.charCodeAt(X);if(he!==32&&he!==9&&he!==13&&he!==10&&!Va.test(B[X]))break;X++}return X}function Dh(B,X){let he=B.slice(F(B)),Ae=!1;if(X)he=he.slice(xr.length),Ae=!0;else if(he.startsWith(Ba)&&!he.startsWith(Ys))he=he.slice(Ba.length),Ae=!0;let $t=he.slice(0,F(he));he=he.slice($t.length);let Lt=he.trimEnd(),Ot=Lt.endsWith(Ys)?Lt.slice(0,-Ys.length).trimEnd():he;return{indent:Ae?$t.slice(1):$t,content:Ot}}function Rh(B,X,he){let Ae=he>X&&B.charCodeAt(he-1)===13?he-1:he;return B.slice(X,Ae)}function Ih(B){let X=[],he=0;while(!0){let Ae=B.indexOf(xr,he);if(Ae===-1)break;let $t=B.lastIndexOf(`
|
|
195
|
-
`,Ae-1)+1;if(B.charCodeAt(Ae+xr.length)===42||B.slice($t,Ae).trim()!==""){he=Ae+1;continue}let Lt=[],Ot=$t,_t=!1,It=0;while(Ot<=B.length){let Mt=B.indexOf(`
|
|
196
|
-
`,Ot),Ft=Mt===-1?B.length:Mt,Vt=Rh(B,Ot,Ft),{indent:Bt,content:Gt}=Dh(Vt,Lt.length===0);Lt.push({raw:Vt,start:Ot,number:Lt.length,indent:Bt,content:Gt});let Wt=Vt.trimEnd();if(Wt.endsWith(Ys)){_t=!0,It=Ot+Wt.length,he=Ft;break}if(Mt===-1)break;Ot=Mt+1}if(!_t)break;X.push({start:Ae,end:It,lines:Lt})}return X}function Lh(B){let X=B;if(X.length>0&&X[0].content==="")X=X.slice(1);if(X.length>0&&X[X.length-1].content==="")X=X.slice(0,-1);return X}function Oh(B){let X=[[]],he=!1;for(let Ae of B){if(Ah.test(Ae.content)&&!he)X.push([Ae]);else X[X.length-1].push(Ae);if(V(Ae.content))he=!he}return X}function V(B){return Mh(B,Th)%2===1}function Mh(B,X){let he=0,Ae=B.indexOf(X);while(Ae!==-1)he++,Ae=B.indexOf(X,Ae+X.length);return he}function Ga(B){return B.map((X)=>X.indent+X.content).join(`
|
|
197
|
-
`)}function Fh(B,X){let he=X;while(he<B.length-1&&B[he].content.trim()==="")he++;if(B[he].content[0]!=="{")return null;let Ae=B.slice(he).map((Mt)=>Mt.content).join(`
|
|
198
|
-
`),$t=_(Ae,0);if($t===-1)return null;let Lt=[],Ot=$t+1;for(let Mt=he;Ot>0;Mt++){let Ft=B[Mt].content.length;Lt.push(Math.min(Ot,Ft)),Ot-=Ft+1}let _t=he+Lt.length-1;return{type:Lt.map((Mt,Ft)=>{let Vt=he+Ft,Bt=B[Vt].content.slice(0,Mt);if(B[Vt].content=B[Vt].content.slice(Mt).replace(vr,""),Vt>0)B[Vt].continuesType=!0;return Ft===0?Bt:B[Vt].indent+Bt}).join(`
|
|
199
|
-
`).slice(1,-1),endIndex:_t}}function jh(B){let X=B.content.match(vr)?.[0]??"",he=B.content.slice(X.length),Ae=0,$t=0;for(let Mt of he){if(Ae===0&&Va.test(Mt))break;if(Mt==="[")Ae++;if(Mt==="]")Ae--;$t++}let Lt=Ae===0?he.slice(0,$t):"";if(!Lt)return null;let Ot=Lt,_t=!1,It;if(Lt.startsWith("[")&&Lt.endsWith("]")){_t=!0;let Ft=Lt.slice(1,-1).split("=");if(Ot=Ft[0].trim(),Ft.length>1)It=Ft.slice(1).join("=").trim();if(!Ot)return null}if(Ot.length>1&&(Ot[0]==='"'||Ot[0]==="'")&&Ot[Ot.length-1]===Ot[0])Ot=Ot.slice(1,-1);return B.content=he.slice($t).replace(vr,""),{name:Ot,optional:_t,default:It}}function Bh(B){let X=B[0],he=X.content.match(Nh),Ae=he?he[1]:"",$t=he?X.content.slice(he[0].length):X.content,Lt=$t.trimEnd(),Ot=B.slice(1).map((Gt)=>Gt.indent+Gt.content),_t=(Lt?[Lt,...Ot]:Ot).join(`
|
|
200
|
-
`);X.content=$t,X.tag=Ae;let It=Fh(B,0),Mt=It?.type??"",Ft=It?.endIndex??0;if(_h.has(Ae))while(Ft<B.length-1&&B[Ft].content.trim()==="")Ft++;let Vt=jh(B[Ft]),Bt=Ga(B.slice(Ft));return{tag:Ae,name:Vt?.name??"",type:Mt,optional:Vt?.optional??!1,default:Vt?.default,description:Bt,text:_t,lines:B}}function Vh(B,X,he){let Ae=Lh(B);Ae.forEach((Ot,_t)=>{Ot.number=_t});let $t=Oh(Ae),Lt=$t.slice(1).map(Bh);return{description:Ga($t[0]),tags:Lt,start:X,end:he,lines:Ae}}function T(B){return Ih(B).map(({start:X,end:he,lines:Ae})=>Vh(Ae,X,he))}var Wh=/\r?\n/,Uh=/^\s*\*+/;function Zs(B){return{graph:B,cache:new Map,computing:new Set}}function cn(B){return B?.type==="Identifier"?B.name:void 0}function Hh(B){let X=B.trimEnd();for(;;){let he=X.lastIndexOf(`
|
|
201
|
-
`)+1;if(X.slice(he).trimStart().startsWith("//")){X=X.slice(0,he).trimEnd();continue}let Ae=X.endsWith("*/")?X.lastIndexOf("/*",X.length-3):-1;if(Ae!==-1&&X[Ae+2]!=="*"){X=X.slice(0,Ae).trimEnd();continue}return X}}function qh(B,X){let he=Hh(B.slice(0,X));if(!he.endsWith("*/"))return;let Ae=he.length-2,$t=he.lastIndexOf("/**",Ae);if($t===-1)return;return he.slice($t,Ae+2)}function Kh(B){let X=[];for(let he of B.slice(3,-2).split(Wh)){let Ae=he.replace(Uh,"").trim();if(Ae.startsWith("@"))break;if(Ae)X.push(Ae)}return X.join(" ")||void 0}function Bn(B,X){if(!X)return;return B.text.slice(X.start,X.end)}function zh(B,X){return"typeAnnotation"in X?Bn(B,X.typeAnnotation?.typeAnnotation):void 0}function Er(B,X){return Bn(B,X.returnType?.typeAnnotation)}function br(B,X){let he=X.params.map(($t)=>Bn(B,$t)??"").join(", "),Ae=Er(B,X);return`(${he})${Ae?` => ${Ae}`:""}`}function qa(B){if(B.type==="Literal"){let X=B.value;if(typeof X==="string")return"string";if(typeof X==="number")return"number";if(typeof X==="boolean")return"boolean"}if(B.type==="TemplateLiteral")return"string";return}function Xh(B,X){let he=Bn(B,X);if(he===void 0)return;if(X.type==="Literal"){let $t=X.value;if(typeof $t==="string"||typeof $t==="number"||typeof $t==="boolean")return{raw:he,value:$t,type:typeof $t};return}if(X.type==="UnaryExpression"&&X.operator==="-"){let $t=X.argument;if($t.type==="Literal"&&typeof $t.value==="number")return{raw:he,value:-$t.value,type:"number"};return}let Ae=X.type==="TemplateLiteral"?x(X):null;return Ae===null?void 0:{raw:he,value:Ae,type:"string"}}function Jh(B,X){if(B.type!=="CallExpression"&&B.type!=="NewExpression")return;let he=B.callee;if(!(cn(he)==="Symbol"||he.type==="MemberExpression"&&!he.computed&&cn(he.object)==="Symbol"&&cn(he.property)==="for"))return;return x(B.arguments[0])||X}var Yh=new Set(["any","bigint","boolean","false","never","null","number","object","readonly","string","symbol","true","undefined","unknown","void"]),Qh=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,Zh=/(?<![\w$.])[A-Za-z_$][\w$]*(?![\w$]|\s*\??:)/g;function ed(B,X){let he=X?bn().getCommentTags(T(X)).type?.type.trim():void 0,Ae=B?{type:B,source:"typescript"}:he?{type:he,source:"jsdoc"}:void 0;if(!Ae||Ae.type.includes("`"))return;return(Ae.type.replace(Qh,'""').match(Zh)??[]).every((Lt)=>Yh.has(Lt))?Ae:void 0}function Wa(B){if(B.async||B.generator||B.type==="TSDeclareFunction")return;let X=B.body,he=[];if(X.type==="BlockStatement"){if(Qs(X,he),he.length===0)return}else he.push(X);let Ae;for(let $t of he){if(!$t)return;let Lt=qa($t);if(!Lt)return;if(Ae===void 0)Ae=Lt;else if(Ae!==Lt)return}return Ae}function Qs(B,X){for(let he of B.body)td(he,X)}function td(B,X){switch(B.type){case"ReturnStatement":X.push(B.argument??null);return;case"BlockStatement":Qs(B,X);return;case"IfStatement":if(Ua(B.consequent,X),B.alternate)Ua(B.alternate,X);return;case"ForStatement":case"ForInStatement":case"ForOfStatement":case"WhileStatement":case"DoWhileStatement":case"LabeledStatement":case"WithStatement":if(B.body.type==="BlockStatement")Qs(B.body,X);return}}function Ua(B,X){if(B.type==="BlockStatement")Qs(B,X);else if(B.type==="ReturnStatement")X.push(B.argument??null)}function nd(B){let X=B.initializer;if(!X)return;if(X.type==="Literal"){let he=X.value;return typeof he==="string"||typeof he==="number"?he:void 0}if(X.type==="UnaryExpression"&&X.operator==="-"){let he=X.argument;if(he.type==="Literal"&&typeof he.value==="number")return-he.value}return}function sd(B){let X=B.members;if(X.length===0)return;let he=[],Ae=0;for(let $t of X){if(!$t.initializer){he.push(String(Ae)),Ae+=1;continue}let Lt=nd($t);if(Lt===void 0)return;he.push(typeof Lt==="string"?JSON.stringify(Lt):String(Lt)),Ae=typeof Lt==="number"?Lt+1:Ae}return he.join(" | ")}function Cr(B,X,he,Ae){let $t=B.filePath,Lt=qh(B.text,he),Ot=Lt?Kh(Lt):void 0,_t=Lt?bn().extractJsDocReturnType(Lt):void 0,{deprecated:It,tags:Mt,internal:Ft}=Lt?bn().extractJsDocDeprecatedAndTags(Lt):{deprecated:void 0,tags:void 0,internal:!1},Vt=Ft?{internal:!0}:{};if(X.type==="VariableDeclaration"){let Bt=X.kind==="let"||X.kind==="var"?X.kind:"const",Gt=[];for(let Wt of X.declarations){let Ut=Wt.id,Ht=cn(Ut);if(!Ht)continue;let zt=zh(B,Ut),Xt=zt,Zt,tn,an,In,ns,ss,hn=Wt.init;if(hn)if(hn.type==="ArrowFunctionExpression"||hn.type==="FunctionExpression"){if(ss=hn,!Xt)Xt=br(B,hn);tn=Er(B,hn)??_t??Y(Xt)??Wa(hn)}else{if(Zt=Bn(B,hn),!Xt)Xt=qa(hn);let Un=m(hn);if(an=x(Un)??Jh(Un,Ht),Bt==="const")In=Xh(B,Un),ns=ed(zt,Lt)}Gt.push({name:Ht,kind:Bt,type:Xt,value:Zt,returnType:tn,literalValue:an,primitiveLiteral:In,declaredType:ns,functionNode:ss,description:Ot,deprecated:It,tags:Mt,...Vt,declFile:$t,isTypeOnly:!1})}return Gt}if(X.type==="FunctionDeclaration"||X.type==="TSDeclareFunction"){let Bt=cn(X.id)??Ae;if(!Bt)return[];return[{name:Bt,kind:"function",type:br(B,X),returnType:Er(B,X)??_t??Wa(X),...X.type==="FunctionDeclaration"?{functionNode:X}:{},description:Ot,deprecated:It,tags:Mt,...Vt,declFile:$t,isTypeOnly:!1}]}if(X.type==="ClassDeclaration"){let Bt=cn(X.id),Gt=Bt??Ae;if(!Gt)return[];return[{name:Gt,kind:"class",...Bt?{type:Bt}:{},description:Ot,deprecated:It,tags:Mt,...Vt,declFile:$t,isTypeOnly:!1}]}if(X.type==="TSTypeAliasDeclaration"){let Bt=cn(X.id);if(!Bt)return[];return[{name:Bt,kind:"type",type:Bn(B,X.typeAnnotation),description:Ot,deprecated:It,tags:Mt,...Vt,declFile:$t,isTypeOnly:!0}]}if(X.type==="TSInterfaceDeclaration"){let Bt=cn(X.id);if(!Bt)return[];return[{name:Bt,kind:"interface",type:Bn(B,X.body),description:Ot,deprecated:It,tags:Mt,...Vt,declFile:$t,isTypeOnly:!0}]}if(X.type==="TSEnumDeclaration"){let Bt=cn(X.id);if(!Bt)return[];return[{name:Bt,kind:"enum",type:sd(X)??Bt,description:Ot,deprecated:It,tags:Mt,...Vt,declFile:$t,isTypeOnly:!1}]}return[]}function id(B,X,he){let Ae=X.declaration;if(Ae.type==="FunctionDeclaration"||Ae.type==="TSDeclareFunction"||Ae.type==="ClassDeclaration"){let[Ot]=Cr(B,Ae,X.start,"default");return Ot?{...Ot,name:"default"}:void 0}if(Ae.type==="FunctionExpression"||Ae.type==="ArrowFunctionExpression")return{name:"default",kind:"function",type:br(B,Ae),functionNode:Ae,declFile:B.filePath,isTypeOnly:!1};let $t=cn(Ae),Lt=$t?he($t):null;return Lt?{...Lt,name:"default"}:void 0}function rd(B,X){for(let he of B){if(he.type!=="ImportDeclaration")continue;let Ae=he.source.value;for(let $t of he.specifiers){if($t.local.name!==X)continue;let Lt=he.importKind==="type"||$t.type==="ImportSpecifier"&&$t.importKind==="type";if($t.type==="ImportDefaultSpecifier")return{specifier:Ae,importedName:"default",isTypeOnly:Lt};if($t.type==="ImportNamespaceSpecifier")return{specifier:Ae,importedName:"*",isTypeOnly:Lt};if($t.type==="ImportSpecifier"){let Ot=cn($t.imported)??X;return{specifier:Ae,importedName:Ot,isTypeOnly:Lt}}}}return null}function Ha(B,X,he){return{name:B,kind:"const",declFile:X,namespaceFile:X,isTypeOnly:he}}function ei(B,X){let he=X.cache.get(B);if(he)return he;if(X.computing.has(B))return[];X.computing.add(B);let Ae=X.graph.parse(B);if(!Ae)return X.computing.delete(B),X.cache.set(B,[]),[];let{source:$t,body:Lt}=Ae,Ot=[],_t=new Map;for(let Bt of Lt){let Gt=Bt.type==="ExportNamedDeclaration"?Bt.declaration:Bt;if(!Gt)continue;for(let Wt of Cr($t,Gt,Gt.start))_t.set(Wt.name,Wt)}let It=(Bt,Gt)=>({name:Bt,kind:"const",declFile:Gh($t.dir,Gt),isTypeOnly:!1}),Mt=(Bt)=>{let Gt=_t.get(Bt);if(Gt)return Gt;let Wt=rd(Lt,Bt);if(!Wt)return null;if(Wt.specifier.endsWith(".svelte"))return It(Bt,Wt.specifier);let Ut=X.graph.resolve(Wt.specifier,$t.dir);if(!Ut)return null;if(Wt.importedName==="*")return Ha(Bt,Ut,Wt.isTypeOnly);return Vn(Ut,Wt.importedName,X)??null},Ft=new Map;for(let Bt of Lt){if(Bt.type==="ExportAllDeclaration"){let Ht=Bt.source.value;if(Ht.endsWith(".svelte"))continue;let zt=X.graph.resolve(Ht,$t.dir);if(!zt)continue;let Xt=Bt.exportKind==="type",Zt=cn(Bt.exported);if(Zt){Ot.push(Ha(Zt,zt,Xt));continue}for(let tn of ei(zt,X)){let an=Ft.get(tn.name)??[];an.push(Xt?{...tn,isTypeOnly:!0}:tn),Ft.set(tn.name,an)}continue}if(Bt.type==="ExportDefaultDeclaration"){let Ht=id($t,Bt,Mt);if(Ht)Ot.push(Ht);continue}if(Bt.type!=="ExportNamedDeclaration")continue;let Gt=Bt.declaration;if(Gt){Ot.push(...Cr($t,Gt,Bt.start));continue}let Wt=Bt.source?.value;if(Wt?.endsWith(".svelte")){for(let Ht of Bt.specifiers){let zt=cn(Ht.exported);if(zt)Ot.push(It(zt,Wt))}continue}let Ut=Bt.exportKind==="type";for(let Ht of Bt.specifiers){let zt=cn(Ht.exported),Xt=cn(Ht.local);if(!zt||!Xt)continue;let Zt=Ut||Ht.exportKind==="type",tn=null;if(Wt){let an=X.graph.resolve(Wt,$t.dir);if(an)tn=Vn(an,Xt,X)??null}else tn=Mt(Xt);if(tn)Ot.push({...tn,name:zt,isTypeOnly:tn.isTypeOnly||Zt});else if(Xt!=="default")Ot.push({name:zt,kind:Zt?"type":"const",declFile:B,isTypeOnly:Zt})}}let Vt=new Set(Ot.map((Bt)=>Bt.name));for(let[Bt,Gt]of Ft){if(Vt.has(Bt)||Bt==="default")continue;if(Gt.every((Wt)=>Wt.declFile===Gt[0].declFile))Ot.push(...Gt);else X.onAmbiguousStarExport?.(B,Bt,Gt)}return X.computing.delete(B),X.cache.set(B,Ot),Ot}function Vn(B,X,he){return ei(B,he).findLast((Ae)=>Ae.name===X)}function es(B,{importedName:X,members:he=[]},Ae){let $t=Vn(B,X,Ae);for(let Lt of he){if($t?.namespaceFile===void 0)return;$t=Vn($t.namespaceFile,Lt,Ae)}return $t}import{dirname as od}from"node:path";function Rn(B,X,he){if(B[X]===void 0)delete B[X];B[X]=he}function ti(B,X){return(X.location==="props"?B.props:B.moduleExports).find((Ae)=>Ae.name===X.propName)}function ni(B,X){if(X.location!=="props")return;B.diagnostics=(B.diagnostics??[]).filter((he)=>!(he.kind==="prop-unknown-type"&&he.name===X.propName))}var ad=/\.[^./\\]+$/;function pd(B,X){if(B.endsWith(".d.ts"))return null;let he=B.replace(ad,".d.ts");return X.exists(he)?he:null}function cd(B,X,he){let Ae=od(B);return X.map(($t)=>{if(!$t.importSource||!$t.importedName)return{candidate:$t};let Lt=he.graph.resolve($t.importSource,Ae);if(!Lt)return{candidate:$t,failureReason:"module-not-found"};let Ot=Vn(Lt,$t.importedName,he);if(!Ot)return{candidate:$t,failureReason:"export-not-found"};if(Ot.returnType)return{candidate:$t,type:Ot.returnType};let _t=pd(Lt,he.graph);if(_t){let It=Vn(_t,$t.importedName,he);if(It?.returnType)return{candidate:$t,type:It.returnType}}return{candidate:$t,failureReason:"return-type-unresolved"}})}function ld(B,X){switch(X){case"module-not-found":return`Prop "${B.propName}" default calls "${B.calleeName}()", but "${B.importSource}" could not be resolved; falling back to "any".`;case"export-not-found":return`Prop "${B.propName}" default calls "${B.calleeName}()", but "${B.importedName}" is not exported from "${B.importSource}"; falling back to "any".`;case"return-type-unresolved":return`Prop "${B.propName}" default calls "${B.calleeName}()" imported from "${B.importSource}", but its return type could not be resolved; falling back to "any".`}}function ud(B,X){for(let{candidate:he,type:Ae,failureReason:$t}of X){let Lt=ti(B,he);if(Lt?.typeSource!=="unknown")continue;if(Ae){Rn(Lt,"type",Ae),Rn(Lt,"typeSource","typescript"),ni(B,he);continue}if(he.location==="props"&&$t){let Ot=B.diagnostics?.find((_t)=>_t.kind==="prop-unknown-type"&&_t.name===he.propName);if(Ot)Ot.message=ld(he,$t)}}}var Ka={collect:(B)=>B.pendingCallDefaultCandidates?.filter((X)=>X.importSource!==void 0)??[],resolve:cd,apply:ud};import{dirname as hd}from"node:path";function dd(B,X,he){let Ae=hd(B);return X.map(($t)=>{let Lt=he.graph.resolve($t.importSource,Ae);if(!Lt)return{candidate:$t};let Ot=es(Lt,$t,he);if(!Ot?.primitiveLiteral)return{candidate:$t};return{candidate:$t,literal:Ot.primitiveLiteral,declaredType:Ot.declaredType}})}function fd(B,X){for(let{candidate:he,literal:Ae,declaredType:$t}of X){if(!Ae)continue;let Lt=ti(B,he);if(!Lt)continue;if(Rn(Lt,"value",Ae.raw),Rn(Lt,"defaultValue",{raw:Ae.raw,kind:"literal",value:Ae.value}),Lt.typeSource!=="unknown")continue;Rn(Lt,"type",$t?.type??Ae.type),Rn(Lt,"typeSource",$t?.source??"default"),ni(B,he)}}var za={collect:(B)=>B.pendingConstDefaultCandidates??[],resolve:dd,apply:fd};import{dirname as yd}from"node:path";var md=/(?:_|[^\p{ID_Continue}$])+/u,gd=/^[\p{ID_Start}$]/u;function N(B){let Ae=`${B.split(md).map(($t)=>$t.charAt(0).toUpperCase()+$t.slice(1)).join("")}Context`;return gd.test(Ae)?Ae:`_${Ae}`}function U(B,X){let he=X.source.value;if(typeof he!=="string"||X.importKind==="type")return;for(let Ae of X.specifiers){if(Ae.type!=="ImportSpecifier"||Ae.importKind==="type")continue;let $t=Ae.local.name;if(!$t)continue;let{imported:Lt}=Ae,Ot=Lt.type==="Identifier"?Lt.name:typeof Lt.value==="string"?Lt.value:$t;B.valueImportBindingsByLocalName.set($t,{localName:$t,importedName:Ot,source:he})}}function te(B){return[B.importedName,...B.members??[]].join(".")}function ye(B,X){let he=[],Ae=X;while(Ae.type==="MemberExpression"){if(Ae.computed||!n(Ae.property))return;he.unshift(Ae.property.name),Ae=Ae.object}if(!n(Ae))return;let $t=Ae.name,Lt=(_t,It,Mt)=>Mt.length>0?{source:_t,importedName:It,members:Mt}:{source:_t,importedName:It},Ot=B.valueImportBindingsByLocalName.get($t);if(Ot)return Lt(Ot.source,Ot.importedName,he);for(let _t of[B.parsed?.instance,B.parsed?.module])for(let It of _t?.content.body??[]){if(It.type!=="ImportDeclaration")continue;let Mt=It,Ft=Mt.source.value;if(Mt.importKind==="type"||typeof Ft!=="string")continue;let Vt=Mt.specifiers.find((Bt)=>Bt.local.name===$t);if(Vt?.type==="ImportDefaultSpecifier")return Lt(Ft,"default",he);if(Vt?.type==="ImportNamespaceSpecifier"&&he.length>0)return Lt(Ft,he[0],he.slice(1))}return}function ne(B,X){if(!A(X))return;return ye(B,X)}function Ie(B){let X=new Map;for(let he of B.content.body){if(he.type!=="ImportDeclaration")continue;let Ae=he;if(Ae.importKind==="type")continue;let $t=Ae.source.value;if(typeof $t!=="string")continue;for(let Lt of Ae.specifiers){let Ot=Lt.local.name;if(!Ot||Lt.type==="ImportSpecifier"&&Lt.importKind==="type")continue;let _t;if(Lt.type==="ImportDefaultSpecifier")_t="default";else if(Lt.type==="ImportNamespaceSpecifier")_t="*";else if(Lt.imported.type==="Identifier")_t=Lt.imported.name;else _t=String(Lt.imported.value??Ot);X.set(Ot,{from:$t,imported:_t})}}return X}function xe(B,X){for(let he of X?.content.body??[]){if(he.type==="ImportDeclaration"){U(B,he);continue}let Ae=he.type==="ExportNamedDeclaration"&&he.declaration?he.declaration:he;if(Ae.type==="FunctionDeclaration"&&Ae.id?.name)B.funcDecls.set(Ae.id.name,Ae)}}function xd(B,X,he){let Ae=yd(B);return X.map(($t)=>{let Lt=he.graph.resolve($t.importSource,Ae);if(!Lt)return{candidate:$t};let Ot=es(Lt,$t,he);if(Ot?.kind!=="const"||Ot.literalValue===void 0)return{candidate:$t};return{candidate:$t,key:Ot.literalValue}})}function vd(B,X){for(let{candidate:he,key:Ae}of X){if(!Ae){let _t=te(he);B.diagnostics=[...B.diagnostics??[],s({component:B.filePath,kind:"context-key-unresolved",name:_t,message:`setContext key \`${_t}\` from "${he.importSource}" isn't an \`export const\` string or Symbol() sveld can read; the context is skipped.`,...he.source?{source:he.source}:{}})];continue}let $t=[...B.contexts??[]],Lt=$t.findIndex((_t)=>_t.key===Ae);if(Lt!==-1){let _t=$t[Lt],It=Xa(_t.source,he.source),Mt=It?_t.source:he.source;if(B.diagnostics=[...B.diagnostics??[],s({component:B.filePath,kind:"context-duplicate-key",name:Ae,message:`setContext("${Ae}", ...) was called more than once; only the first call's shape is used.`,...Mt?{source:Mt}:{}})],!It)continue;$t.splice(Lt,1)}let Ot=$t.findIndex((_t)=>Xa(_t.source,he.source));$t.splice(Ot===-1?$t.length:Ot,0,{key:Ae,typeName:N(Ae),...he.type===void 0?{}:{type:he.type},description:he.description,properties:he.properties,...he.hasUnresolvedSpread?{hasUnresolvedSpread:!0}:{},...he.internal?{internal:!0}:{},source:he.source}),B.contexts=$t}}function Xa(B,X){if(!B||!X)return!1;let{line:he,column:Ae}=B.start;return he>X.start.line||he===X.start.line&&Ae>X.start.column}var Ja={collect:(B)=>B.pendingContextKeyCandidates??[],resolve:xd,apply:vd};import{dirname as Ed}from"node:path";function pe(B,X){let he=c(B.name,X.name);if(he!==0)return he;let Ae=c(B.type,X.type);if(Ae!==0)return Ae;if(B.type==="forwarded"&&X.type==="forwarded"){let $t=c(B.element,X.element);if($t!==0)return $t}return c(B.detail??"",X.detail??"")}function Te(B){return B==="TSTypeAnnotation"||B==="TSTypeAliasDeclaration"||B==="TSInterfaceDeclaration"||B==="TSTypeParameterDeclaration"||B==="TSTypeParameterInstantiation"}function R(B,X,he,Ae){Sr(B,null,null,X,he,Ae?.skipTypeOnlySubtrees===!0)}function Sr(B,X,he,Ae,$t,Lt){Ae(B,X,he);let Ot=B,_t=B.type;if((_t==="Identifier"||_t==="Literal"||_t==="Text")&&Ot.typeAnnotation===void 0){if($t)$t(B);return}if(Lt&&_t.charCodeAt(0)===84&&Te(_t)){if($t)$t(B);return}for(let It in Ot){if(It==="leadingComments")continue;let Mt=Ot[It];if(!Mt||typeof Mt!=="object")continue;if(Array.isArray(Mt))for(let Ft=0;Ft<Mt.length;Ft++){let Vt=Mt[Ft];if(Vt&&typeof Vt==="object"&&typeof Vt.type==="string")Sr(Vt,B,It,Ae,$t,Lt)}else if(typeof Mt.type==="string")Sr(Mt,B,It,Ae,$t,Lt)}if($t)$t(B)}function bd(B,X,he){let Ae=Ed(B);return X.map(($t)=>{let Lt=he.graph.resolve($t.importSource,Ae);if(!Lt)return{candidate:$t,failureReason:"module-not-found"};let Ot=es(Lt,$t,he)?.functionNode;if(!Ot)return{candidate:$t,failureReason:"not-a-function"};let _t=Cd(Ot,$t);if(!_t)return{candidate:$t,failureReason:"parameter-not-found"};return kd(Ot,_t,$t)})}function Ya(B){return B?.type==="AssignmentPattern"?B.left:B}function Cd(B,X){let he=Ya(B.params[X.argumentIndex]);if(X.property===void 0)return he?.type==="Identifier"?{name:he.name}:void 0;if(!X.property)return;if(he?.type==="Identifier")return{object:he.name,property:X.property};if(he?.type!=="ObjectPattern")return;for(let Ae of he.properties){if(Ae.type!=="Property"||Ae.computed)continue;if(Ae.key.type!=="Identifier"||Ae.key.name!==X.property)continue;let $t=Ya(Ae.value);return $t?.type==="Identifier"?{name:$t.name}:void 0}return}function wr(B){if(!B)return null;if(B.type==="ConditionalExpression"){let he=wr(B.consequent),Ae=wr(B.alternate);return he&&Ae?[...he,...Ae]:null}let X=x(B);return X?[X]:null}var Sd={variableType:()=>{return}};function wd(B){if(!B)return"null";let{deriveLiteralDetailType:X,literalDetailToTypeText:he}=bn();if(B.type==="Literal")return he(B.value);return X(Sd,B)??"any"}function Qa(B,X){if("name"in X)return B.type==="Identifier"&&B.name===X.name;if(B.type!=="MemberExpression"||B.computed)return!1;return B.object.type==="Identifier"&&B.object.name===X.object&&B.property.type==="Identifier"&&B.property.name===X.property}function kd(B,X,he){let Ae=B.body,$t=new Map,Lt="name"in X?X.name:X.object,Ot;if(R(Ae,(It,Mt,Ft)=>{if(Ot)return;if(It.type==="CallExpression"){if(!Qa(It.callee,X))return;let Bt=It.arguments,Gt=wr(Bt[0]);if(!Gt){Ot="dynamic-event-name";return}for(let Wt of Gt){let Ut=$t.get(Wt)??new Set;Ut.add(wd(Bt[1])),$t.set(Wt,Ut)}return}let Vt=Mt?.type==="CallExpression"&&Ft==="callee";if(It.type==="MemberExpression"&&Qa(It,X)&&!Vt){Ot="passed-on";return}if(It.type!=="Identifier"||It.name!==Lt)return;if(Vt)return;if(!("name"in X)&&Mt?.type==="MemberExpression"&&Ft==="object")return;if(Mt?.type==="MemberExpression"&&Ft==="property"&&!Mt.computed)return;if(Mt?.type==="Property"&&Ft==="key"&&!Mt.computed)return;Ot="passed-on"}),Ot)return{candidate:he,failureReason:Ot};let _t=Array.from($t,([It,Mt])=>{let Ft=Array.from(Mt);return{name:It,detail:Ft.includes("any")?"any":Ft.join(" | ")}});return{candidate:he,events:_t}}function $d(B,X){let he=B.members?`"${B.calleeText}"`:B.importedName==="default"?"the default export":`"${B.importedName}"`;switch(X){case"module-not-found":return`"${B.importSource}" isn't a local module sveld can read`;case"not-a-function":return`${he} isn't a function declared in "${B.importSource}"`;case"parameter-not-found":return`no parameter of ${he} receives it`;case"dynamic-event-name":return"an event name isn't a string literal";case"passed-on":return`${he} passes it on`}}function Pd(B,X,{deferredEventNoSourceDiagnostics:he=[],untypedJsDocEventNames:Ae=[]}){let $t=new Map,Lt=[...B.diagnostics??[]],Ot=!0;for(let{candidate:Gt,events:Wt,failureReason:Ut}of X){if(Ut){Ot=!1,Lt.push(s({component:B.filePath,kind:"dispatch-escapes",name:Gt.dispatcherName,message:`\`${Gt.dispatcherName}\` is passed to \`${Gt.calleeText}\`, but sveld couldn't read the events it dispatches: ${$d(Gt,Ut)}. Document them with @event tags.`,...Gt.source?{source:Gt.source}:{},...Gt.ignored?{ignored:!0}:{}}));continue}for(let Ht of Wt??[]){if($t.has(Ht.name))continue;$t.set(Ht.name,{type:"dispatched",name:Ht.name,detail:Ht.detail,...Gt.source?{source:Gt.source}:{}})}}if(Ot){for(let Gt of he)if(!$t.has(Gt.name))Lt.push(Gt)}if(B.diagnostics=Lt,$t.size===0)return;let _t=new Map,It=new Set;for(let Gt of B.events)if(Gt.type==="dispatched")It.add(Gt.name);else if(!_t.has(Gt.name))_t.set(Gt.name,Gt);let Mt=new Set(Ae),Ft=new Map,Vt=[];for(let Gt of $t.values()){if(It.has(Gt.name)){if(Mt.has(Gt.name)&&Gt.detail!==void 0)Ft.set(Gt.name,Gt.detail);continue}let Wt=_t.get(Gt.name);if(!Wt){Vt.push(Gt);continue}let Ut=Gt.source??Wt.source;Vt.push({type:"dispatched",name:Gt.name,detail:Wt.detail??Gt.detail,...Wt.description?{description:Wt.description}:{},...Wt.deprecated===void 0?{}:{deprecated:Wt.deprecated},...Wt.tags?{tags:Wt.tags}:{},...Wt.internal?{internal:!0}:{},...Ut?{source:Ut}:{}})}if(Vt.length===0&&Ft.size===0)return;let Bt=new Set(Vt.map((Gt)=>Gt.name));B.events=[...B.events.filter((Gt)=>Gt.type==="dispatched"||!Bt.has(Gt.name)).map((Gt)=>{let Wt=Gt.type==="dispatched"?Ft.get(Gt.name):void 0;return Wt===void 0?Gt:{...Gt,detail:Wt}}),...Vt].sort(pe)}var Za={collect:(B)=>B.pendingDispatchEscapeCandidates??[],resolve:bd,apply:Pd};function si(B){return(X)=>{let he=B.collect(X);if(he.length===0)return;return(Ae,$t,Lt)=>B.apply(Ae,B.resolve($t,he,Lt),X)}}var Td=[si(Ka),si(za),si(Ja),si(Za)];async function ep(B,X,he,Ae){let $t=[];for(let Ot of B){let _t=he(Ot);if(_t===void 0)continue;let It=Td.flatMap((Mt)=>Mt(_t)??[]);if(It.length>0)$t.push({component:Ot,passes:It})}let Lt=new Map;if($t.length===0)return Lt;await _n();for(let{component:Ot,passes:_t}of $t){let It=Zs(Ae),Mt=X(Ot.filePath);for(let Ft of _t)Ft(Ot,Mt,It);Lt.set(Ot.filePath,Array.from(It.cache.keys()))}return Lt}var Ad=/^```([\w-]*)\r?\n([\s\S]*?)\r?\n?```$/,Nd=new Set(["","js","jsx","ts","tsx","javascript","typescript"]),_d=new Set(["svelte","html"]);function Dd(B){let X=B.trim();if(X==="")return null;let he=X.match(Ad);if(he){let Ae=he[1].toLowerCase(),$t=he[2].trim();if($t==="")return null;if(Nd.has(Ae))return{kind:"compile",code:$t};if(_d.has(Ae))return{kind:"syntax",code:$t};return null}if(X.startsWith("<"))return null;return{kind:"compile",code:X}}function tp(B){if(!B.isFunction)return"any";return`(${(B.params??[]).map((he)=>`${he.name}${he.optional?"?":""}: any`).join(", ")}) => any`}function ii(B,X,he,Ae,$t){let Lt=(B??[]).filter((_t)=>_t.name==="example"),Ot=[];return Lt.forEach((_t,It)=>{let Mt=Dd(_t.body);if(Mt===null)return;let Ft=Lt.length>1;Ot.push({id:Ft?`${X}#${It}`:X,name:Ft?`${he} (example ${It+1})`:he,type:Ae,code:Mt.code,kind:Mt.kind,...$t?{source:$t}:{}})}),Ot}function np(B){return B.name??"default"}function Rd(B){let X=[];for(let he of B.props)X.push(...ii(he.tags,`prop:${he.name}`,he.name,tp(he),he.source));for(let he of B.moduleExports)X.push(...ii(he.tags,`export:${he.name}`,he.name,tp(he),he.source));for(let he of B.slots)X.push(...ii(he.tags,`slot:${np(he)}`,np(he),"any",he.source));for(let he of B.events)X.push(...ii(he.tags,`event:${he.name}`,he.name,"any",he.source));return X}function Id(B){let X=[];for(let he of B){let Ae=Rd(he);if(Ae.length===0)continue;X.push({component:he,sources:Ae})}return X}function sp(B,X){let he=[];for(let{component:Ae,sources:$t}of B){let Lt=$t.filter((Ot)=>Ot.kind===X);if(Lt.length===0)continue;he.push({component:Ae,sources:Lt})}return he}async function Ld(B){let{formatParseError:X,parseSvelte:he}=await _n(),Ae=new Map;for(let{component:$t,sources:Lt}of B){let Ot=[];for(let _t of Lt)try{he(_t.code)}catch(It){Ot.push(s({component:$t.filePath,kind:"example-syntax-error",name:_t.name,message:X(It),..._t.source?{source:_t.source}:{}}))}Ae.set($t,Ot)}return Ae}async function Od(B,X,he){let Ae=await X.checkExamples(B.map(({component:Lt,sources:Ot})=>({moduleName:Lt.moduleName,filePath:he(Lt.filePath),sources:Ot}))),$t=new Map;for(let{component:Lt,sources:Ot}of B){let _t=Ae.get(he(Lt.filePath));if(!_t||_t.length===0)continue;let It=new Map(Ot.map((Mt)=>[Mt.id,Mt.source]));$t.set(Lt,_t.map((Mt)=>{let Ft=It.get(Mt.id);return s({component:Lt.filePath,kind:"example-compile-error",name:Mt.name,message:Mt.message,...Ft?{source:Ft}:{}})}))}return $t}async function ip(B,X,he,Ae){let $t=Id(B),Lt=X===!0?sp($t,"compile"):[],Ot=sp($t,"syntax"),_t=new Map,It=(Mt)=>{for(let[Ft,Vt]of Mt)_t.set(Ft,[..._t.get(Ft)??[],...Vt])};if(Ot.length>0)It(await Ld(Ot));if(Lt.length>0){let{TypeResolver:Mt}=await import("./chunk-y5gqpp8d.js"),Ft=await Mt.create(he);if(!Ft.ok)throw Error(`sveld: \`checkExamples\` ${Ft.message}.`);let Vt=Ft.resolver;try{It(await Od(Lt,Vt,Ae))}finally{await Vt.dispose()}}return _t}import{hash as Md}from"node:crypto";import{existsSync as Fd,mkdirSync as jd,readFileSync as Bd,renameSync as Vd,writeFileSync as rp}from"node:fs";import{dirname as kr,isAbsolute as Gd,join as ap,resolve as ri}from"node:path";var $r=10,Wd=ap("node_modules",".cache","sveld","parse-cache.json"),Ud="eb74b98ab1b1187a";function Pr(){return`${Rs}+${Ud}+svelte@${hs}`}function Hd(B){for(let X=ri(B);;X=kr(X)){if(Fd(ap(X,"package.json")))return X;if(kr(X)===X)return ri(B)}}function pp(B,X){let he=Hd(B);if(typeof X==="string")return Gd(X)?X:ri(he,X);return ri(he,Wd)}function oi(B){return Md("sha256",B,"hex")}function op(){return{formatVersion:$r,toolchainVersion:Pr(),entries:{}}}function qd(B){try{let X=Bd(B,"utf-8"),he=JSON.parse(X);if(he.formatVersion!==$r||he.toolchainVersion!==Pr())return op();return he}catch{return op()}}class Tr{cacheFilePath;file;next=new Map;dirty=!1;savedEntryCount;constructor(B){this.cacheFilePath=B,this.file=qd(B),this.savedEntryCount=Object.keys(this.file.entries).length}has(B,X){return this.lookup(B,X)!==void 0}lookup(B,X){let he=this.next.get(B);if(he?.hash===X)return he;let Ae=this.file.entries[B];return Ae?.hash===X?Ae:void 0}get(B,X){let he=this.lookup(B,X);if(he===void 0)return null;this.next.set(B,he);let{component:Ae,typeScriptMetadata:$t,pending:Lt}=structuredClone({component:he.component,typeScriptMetadata:he.typeScriptMetadata,pending:he.pending});if($t!==void 0)Ae[h]=$t;return Lt===void 0?{component:Ae}:{component:Ae,pending:Lt}}set(B,X,{component:he,pending:Ae}){this.dirty=!0,this.next.set(B,{hash:X,...structuredClone({component:he,typeScriptMetadata:he[h],pending:Ae})})}getGeneratedText(B,X){let he=this.next.get(B);if(he?.generatedText===void 0||he.generatedText.key!==X)return;return he.generatedText.text}setGeneratedText(B,X,he){let Ae=this.next.get(B);if(Ae===void 0)return;if(Ae.generatedText?.key===X&&Ae.generatedText.text===he)return;Ae.generatedText={key:X,text:he},this.dirty=!0}save(){if(!this.dirty&&this.next.size===this.savedEntryCount)return;this.dirty=!1,this.savedEntryCount=this.next.size,jd(kr(this.cacheFilePath),{recursive:!0});let B={formatVersion:$r,toolchainVersion:Pr(),entries:Object.fromEntries(this.next)},X=JSON.stringify(B),he=`${this.cacheFilePath}.${process.pid}.tmp`;try{rp(he,X),Vd(he,this.cacheFilePath)}catch{try{rp(this.cacheFilePath,X)}catch{}}}}import{dirname as Kd,relative as zd,resolve as Xd}from"node:path";async function cp(B,X={}){await _n();let he=Xd(B),Ae=Kd(he),$t=(_t)=>t(`./${zd(Ae,_t)}`),Lt=ei(he,{...Zs(X.graph??new Dn),onAmbiguousStarExport:(_t,It,Mt)=>{if(_t!==he||!X.diagnostics)return;if(Mt.every((Gt)=>Gt.declFile.endsWith(".svelte")))return;let Ft=Array.from(new Set(Mt.map((Gt)=>$t(Gt.declFile)))),Vt=Ft.map((Gt)=>`"${Gt}"`),Bt=`${Vt.slice(0,-1).join(", ")} and ${Vt[Vt.length-1]}`;X.diagnostics.push(s({component:$t(he),kind:"export-ambiguous",name:It,message:`"${It}" is exported by ${Bt} through \`export *\`, so the barrel doesn't export it and the docs leave it out; export it explicitly from the barrel (e.g. \`export { ${It} } from "${Ft[0]}"\`).`}))}}),Ot=new Map;for(let _t of Lt){if(_t.name==="default"||_t.declFile.endsWith(".svelte"))continue;let{declFile:It,returnType:Mt,literalValue:Ft,primitiveLiteral:Vt,declaredType:Bt,functionNode:Gt,namespaceFile:Wt,...Ut}=_t,Ht=$t(It);if(Wt!==void 0)Ut.type=`typeof import(${JSON.stringify($t(Wt))})`;Ot.set(_t.name,{...Ut,source:Ht})}return Array.from(Ot.values()).sort((_t,It)=>c(_t.name,It.name))}async function Yd(B){let X=await Promise.all(Array.from(B).map(async(he)=>{try{let Ae=await Jd(he,"utf-8");return{path:he,content:Ae}}catch(Ae){return console.warn(`Warning: Failed to read file ${he}:`,Ae),{path:he,content:null}}}));return new Map(X.map(({path:he,content:Ae})=>[he,Ae]))}function up(B){if(B.length===0)return;console.error(`sveld: failed to parse ${B.length} component(s):`);for(let{filePath:X,message:he}of B)console.error(` - ${X}: ${he}`)}class gs{input;glob;options;graph=new Dn;collected;entryFile=null;globMergeState;cache;entryExports=[];entryDiagnostics=[];records=new Map;parseErrors=new Map;canonicalEntries=new Map;warnedModuleNames=new Set;constructor(B,X,he={}){this.input=B,this.glob=X,this.options=he}get documentExports(){return this.options.documentExports===!0}async build(){return this.graph=new Dn,this.collected=gr(this.input,this.glob,this.documentExports,this.graph),this.globMergeState=Js(this.collected.allComponentEntries,this.collected.resolveComponentFilePath),this.entryFile=lp(this.input).isFile()?Ar(this.input):null,this.cache=this.options.cache===!1?void 0:new Tr(pp(this.collected.rootDir,this.options.cache??!0)),await this.readEntryExports(),this.records.clear(),this.parseErrors.clear(),this.indexEntries(),await this.process(this.componentPaths()),up(Array.from(this.parseErrors.values())),this.assemble()}async update(B){let X=B.map((Mt)=>Ar(Mt));if(this.graph.invalidate(...X),X.length===0)return{result:this.assemble(),reparsed:[]};let he=this.entryFile!==null&&X.includes(this.entryFile)?await this.recollect():[];if(this.glob){let{rootDir:Mt,exports:Ft,allComponentEntries:Vt,resolveComponentFilePath:Bt}=this.collected;mr(this.graph,Mt,Ft,Vt,Bt,this.globMergeState)}this.indexEntries();let Ae=this.componentPaths();for(let Mt of this.records.keys())if(!Ae.has(Mt))this.records.delete(Mt);for(let Mt of this.parseErrors.keys())if(!Ae.has(Mt))this.parseErrors.delete(Mt);let $t=Array.from(this.records).flatMap(([Mt,{crossFileReads:Ft}])=>Ft?.some((Vt)=>X.includes(Vt))?[Mt]:[]),Lt=new Set([...X.filter((Mt)=>Sn.test(Mt)),...he,...$t]),Ot=new Set(Array.from(Ae).filter((Mt)=>Lt.has(Mt))),_t=await this.process(Ot),It=this.assemble();return up(It.errors),{result:It,reparsed:_t}}async recollect(){let B=this.collected,X=gr(this.input,this.glob,this.documentExports,this.graph),he=[];for(let[Ae,$t]of Object.entries(X.exports)){let Lt=X.resolveComponentFilePath($t.source),Ot=Object.hasOwn(B.exports,Ae)?B.exports[Ae]:void 0;if(Ot===void 0||B.resolveComponentFilePath(Ot.source)!==Lt)he.push(Lt)}return this.collected=X,this.globMergeState=Js(X.allComponentEntries,X.resolveComponentFilePath),await this.readEntryExports(),he}async readEntryExports(){this.entryDiagnostics=[],this.entryExports=this.documentExports&&lp(this.input).isFile()?await cp(Ar(this.input),{diagnostics:this.entryDiagnostics,graph:this.graph}):[]}componentPaths(){let{exports:B,allComponentEntries:X,resolveComponentFilePath:he}=this.collected,Ae=new Set;for(let[,$t]of[...Object.entries(B),...X])if(Xn($t.source))Ae.add(he($t.source));return Ae}indexEntries(){let{exports:B,allComponentEntries:X,resolveComponentFilePath:he}=this.collected;this.canonicalEntries=new Map;for(let Ae of[Object.entries(B),X])for(let[$t,Lt]of Ae){if(!Xn(Lt.source))continue;this.canonicalEntries.set(he(Lt.source),{moduleName:yr($t,Lt.source,Ae.length,this.warnedModuleNames),filePath:t(Lt.source)})}}canonicalEntry(B){let X=this.canonicalEntries.get(B);if(X===void 0)throw Error(`sveld: no entry lists ${B}.`);return X}async process(B){let X=new Map,he=await this.parse(B,X);this.cache?.save();let Ae=await this.settle(he);for(let $t of B)this.records.delete($t),this.parseErrors.delete($t);for(let[$t,Lt]of Ae)this.records.set($t,Lt);for(let[$t,Lt]of X)this.parseErrors.set($t,Lt);return Array.from(Ae.keys())}async parse(B,X){let he=await Yd(B),Ae=this.cache,$t=new Map,Lt=new Set;if(Ae)for(let[_t,It]of he){if(It===null)continue;let Mt=oi(It);if($t.set(_t,Mt),!Ae.has(_t,Mt))Lt.add(_t)}if(B.size>0&&(!Ae||Lt.size>0))await _n();let Ot=new Map;for(let _t of B){let It=he.get(_t);if(It===null||It===void 0)continue;let Mt=this.parseOne(_t,It,$t.get(_t),X);if(Mt)Ot.set(_t,Mt)}return Ot}parseOne(B,X,he,Ae){let $t=he===void 0?null:this.cache?.get(B,he);if($t)return $t;let{moduleName:Lt,filePath:Ot}=this.canonicalEntry(B),_t;try{_t=new(bn()).ComponentParser().parse(X,{moduleName:Lt,filePath:Ot})}catch(It){if(this.options.failFast)throw It;Ae.set(B,{filePath:Ot,moduleName:Lt,message:It instanceof Error?It.message:String(It),stack:It instanceof Error?It.stack:void 0});return}if(he!==void 0)this.cache?.set(B,he,_t);return _t}async settle(B){let{rootDir:X,resolveComponentFilePath:he}=this.collected,Ae=new Map,$t=new Map;for(let[It,{component:Mt,pending:Ft}]of B){let Vt={...this.canonicalEntry(It),...Mt};Ae.set(It,Vt),$t.set(Vt,Ft)}let{checkExamples:Lt}=this.options;if(Lt){let It=await ip(Ae.values(),Lt,X,he);for(let[Mt,Ft]of It)ui(Mt,Ft)}let Ot=await ep(Ae.values(),he,(It)=>$t.get(It),this.graph),_t=new Map;for(let[It,Mt]of Ae){let{moduleName:Ft,filePath:Vt,...Bt}=Mt,Gt=Ot.get(Vt);_t.set(It,Gt===void 0?{component:Bt}:{component:Bt,crossFileReads:Gt})}return _t}assemble(){let{exports:B,allComponentEntries:X,resolveComponentFilePath:he}=this.collected,Ae=this.cache,$t=(Bt,[Gt,Wt])=>{if(!Xn(Wt.source))return;let Ut=this.records.get(he(Wt.source));if(Ut===void 0)return;return{component:{moduleName:yr(Gt,Wt.source,Bt.length,this.warnedModuleNames),filePath:t(Wt.source),...Ut.component},record:Ut}},Lt=new Map,Ot=Ae?new Map:void 0,_t=Ae?new Map:void 0,It=new Set;for(let Bt of X){let Gt=$t(X,Bt);if(Gt===void 0)continue;if(Lt.set(Gt.component.filePath,Gt.component),Ot?.set(Gt.component.filePath,he(Bt[1].source)),Gt.record.crossFileReads!==void 0)It.add(Gt.component.filePath)}if(Ot&&_t)for(let Bt of Lt.keys()){let Gt=Ot.get(Bt);if(!It.has(Bt)||Gt===void 0)continue;Ot.delete(Bt),_t.set(Bt,Gt)}let Mt=Sa(Lt,he,this.graph);for(let Bt of Lt.values())ui(Bt,[...Mt(Bt),...Ca(Bt)]);let Ft=new Map,Vt=Object.entries(B);for(let Bt of Vt){let Gt=$t(Vt,Bt);if(Gt===void 0)continue;let Wt=Lt.get(Gt.component.filePath);if(Wt)Gt.component.diagnostics=Wt.diagnostics;Ft.set(Gt.component.moduleName,Gt.component)}return{exports:B,entryExports:this.entryExports,components:Ft,allComponentsForTypes:Lt,errors:Array.from(this.parseErrors.values()),diagnostics:to(no([...Array.from(Lt.values()).flatMap((Bt)=>Bt.diagnostics??[]),...this.entryDiagnostics]),this.options.diagnostics?.ignore),cache:Ae,resolvedPathByFilePath:Ot,crossFileResolvedPathByFilePath:_t}}}function S(B){return{failFast:B?.failFast,documentExports:B?.documentExports===!0,cache:B?.cache,checkExamples:B?.checkExamples==="syntax"?"syntax":B?.checkExamples===!0,diagnostics:B?.diagnostics}}async function C(B,X,he={}){return new gs(B,X,he).build()}import{existsSync as Nr,readFileSync as Qd}from"node:fs";import{isAbsolute as Zd,join as dp}from"node:path";function hp(B){return Zd(B)?B:dp(process.cwd(),B)}function Ce(B){if(B){let $t=hp(B);if(Nr($t))return{entry:z(B)};return{entry:null,configured:!0,message:`Invalid entry point: ${$t}. Pass a valid --entry (or "entry" option), or unset it and set the "svelte" field in your package.json instead.`}}let X=dp(process.cwd(),"package.json");if(!Nr(X))return{entry:null,configured:!1,message:'Could not locate a package.json file. Specify an entry point with --entry (or the "entry" option).'};let he;try{he=$a(JSON.parse(Qd(X,"utf-8")))}catch($t){throw console.error("Error reading package.json:",$t),$t}let Ae=he.svelte?.trim();if(!Ae)return{entry:null,configured:!1,message:'Could not determine an entry point. Set the "svelte" field in your package.json, or pass --entry (or the "entry" option).'};if(!Nr(hp(Ae)))return{entry:null,configured:!0,message:`The "svelte" field in package.json points to "${Ae}", which does not exist.`};return{entry:z(Ae)}}function ai(B){let X=Ce(B);if(X.entry===null)console.error(X.message);return X.entry}async function fp(B,X,he={}){let Ae=new gs(B,X,{...he,failFast:!1}),$t=await Ae.build();return{get result(){return Promise.resolve($t)},async update(Lt){let Ot=await Ae.update(Lt);return $t=Ot.result,Ot}}}import Dr from"node:path";function mp(B){let X=new Map;for(let[Ae,$t]of Object.entries(B)){let Lt=X.get($t.source)||[];Lt.push({id:Ae,exportee:$t}),X.set($t.source,Lt)}let he=[];for(let[Ae,$t]of X){let Lt=Sn.test(Ae),Ot=$t.some(({id:Bt,exportee:Gt})=>Bt!=="default"&&Gt.default),_t=$t.some(({exportee:Bt})=>!Bt.default),It=Lt&&Ot&&_t,Mt=[],Ft=[],Vt=[];for(let{id:Bt,exportee:Gt}of $t){if(Bt==="default"){Ft.push(`export { default } from "${Ae}";`);continue}if(Gt.default)if(Gt.mixed)Ft.push(`export { default as ${Bt} } from "${Ae}";`),Ft.push(`export { default } from "${Ae}";`);else Vt.push(`default as ${Bt}`);else if(Lt&&!It)Vt.push(`default as ${Bt}`);else Mt.push(Bt)}if(Vt.length>0&&Mt.length>0)he.push(`export { ${[...Vt,...Mt].join(", ")} } from "${Ae}";`);else{if(Mt.length>0)he.push(`export { ${Mt.join(", ")} } from "${Ae}";`);if(Vt.length>0)he.push(`export { ${Vt.join(", ")} } from "${Ae}";`)}he.push(...Ft)}return he.join(`
|
|
202
|
-
`)}function gp(B){return B.filter((X)=>X.names.length>0).map((X)=>`export type { ${X.names.join(", ")} } from "${X.source}";`).join(`
|
|
203
|
-
`)}function yp(B){return B.replace(Sn,"")}function _r(B){return B.replace(Sn,".svelte.d.ts")}import{mkdir as ef,readFile as tf,writeFile as nf}from"node:fs/promises";import{parse as sf}from"node:path";class wn{ensuredDirs=new Set;async write(B,X){try{if(await tf(B,"utf-8")===X)return!1}catch{}let he=sf(B).dir;if(!this.ensuredDirs.has(he))await ef(he,{recursive:!0}),this.ensuredDirs.add(he);return await nf(B,X),!0}}function rf(B){return typeof B==="object"&&B!==null&&!Array.isArray(B)&&"start"in B&&"end"in B}function pi(B){if(Array.isArray(B))return B.map((X)=>pi(X));if(B!==null&&typeof B==="object"){let X={};for(let[he,Ae]of Object.entries(B)){if((he==="source"||he==="componentCommentSource")&&rf(Ae))continue;X[he]=pi(Ae)}return X}return B}function xp(B,X){return B.map((he)=>({...he,filePath:Uo(he.filePath,X)}))}function of(B,X,he){if(!X)return`${B.moduleName}.api.json`;if(!he.has(B.moduleName))he.add(B.moduleName),console.warn(`Warning: multiple components named "${B.moduleName}" found. Their JSON files are keyed by source path instead of name to avoid overwriting each other.`);return`${yp(B.filePath)}.api.json`}async function af(B,X){let he=l(B),Ae=xp(he.components,X.inputDir);if(X.source===!1)Ae=pi(Ae);let $t=new Map;for(let Ot of Ae)$t.set(Ot.moduleName,($t.get(Ot.moduleName)??0)+1);let Lt=new Set;await Promise.all(Ae.map(async(Ot)=>{let _t=($t.get(Ot.moduleName)??0)>1,It=of(Ot,_t,Lt),Mt=Dr.resolve(Dr.join(X.outDir||"",It)),Vt=await new wn().write(Mt,us(Ot));Tn(`${Vt?"created":"unchanged"} "${Mt}".`)}))}function Rr(B,X){let he=l(B,{entryExports:X.entryExports}),Ae={...he,components:xp(he.components,X.inputDir)};return X.source===!1?pi(Ae):Ae}function Ir(B,X){return us(Rr(B,X))}async function pf(B,X){let he=Ir(B,X),Ae=Dr.resolve(X.outFile),Lt=await new wn().write(Ae,he);Tn(`${Lt?"created":"unchanged"} "${X.outFile}".`)}async function Lr(B,X){if(X.outDir)await af(B,X);else await pf(B,X)}import{join as Bp,resolve as Ur}from"node:path";var vp=/`/g,Ep=/\s+/g,Cn="--",bp=`| Prop name | Required | Kind | Reactive | Binding | Type | Default value | Description |
|
|
204
|
-
| :- | :- | :- | :- | :- | :- | :- | :- |
|
|
205
|
-
`,Cp=`| Slot name | Default | Props | Fallback | Description |
|
|
206
|
-
| :- | :- | :- | :- | :- |
|
|
207
|
-
`,Sp=`| Event name | Type | Detail | Description |
|
|
208
|
-
| :- | :- | :- | :- |
|
|
209
|
-
`,Fr=`| Name | Kind | Type | Description |
|
|
210
|
-
| :- | :- | :- | :- |
|
|
211
|
-
`,cf=`| Member | Signature | Description |
|
|
212
|
-
| :- | :- | :- |
|
|
213
|
-
`,wp=`| Part name | Description |
|
|
214
|
-
| :- | :- |
|
|
215
|
-
`,kp=`| Property name | Type | Default value | Description |
|
|
216
|
-
| :- | :- | :- | :- |
|
|
217
|
-
`,jr=/\|/g,lf=/</g,uf=/>/g,Gn=/\n/g,hf=/^[A-Za-z_$][\w$]*$/,df=/\s*\n\s*/g,ff=/&(?=#?\w+;)|<(?=[A-Za-z/!?])|[|`*]|\\(?=[!-/:-@[-`{-~])|(?<![A-Za-z0-9])_|_(?![A-Za-z0-9])/g,mf=/[&<|`*\\_]/;function Br(B){if(!mf.test(B))return B;return B.replace(ff,(X)=>X==="&"?"&":X==="<"?"<":X==="_"?"_":`&#${X.charCodeAt(0)};`)}function $p(B){return`<code>${Br(B.includes(`
|
|
218
|
-
`)?B.replace(df," "):B)}</code>`}var gf=/\{@link\s+([^{}\s|]+)(?:\|([^{}]+))?\}/g;function yf(B){if(!B.includes("{@link"))return B;return B.replace(gf,(X,he,Ae)=>`[${Ae===void 0?he:Ae.trim()}](${he})`)}function Or(B){return B.includes("```")||B.includes("~~~")}function Mr(B){return Np(yf(B))}var xf=/^([ \t]*)(`{3,}|~{3,})(.*)$/,vf=/^\n/,Ef=/\n$/;function Pp(B){let X=(Lt)=>({kind:"prose",text:Mr(Lt.join(`
|
|
219
|
-
`))});if(!Or(B))return[X([B])];let he=B.split(`
|
|
220
|
-
`),Ae=[],$t=[];for(let Lt=0;Lt<he.length;Lt++){let Ot=xf.exec(he[Lt]),[,_t="",It="",Mt=""]=Ot??[];if(!Ot||It[0]==="`"&&Mt.includes("`")){$t.push(he[Lt]);continue}if($t.push(""),$t.length>1)Ae.push(X($t));let Ft=[],Vt=new RegExp(`^[ \\t]*${It[0]}{${It.length},}[ \\t]*$`);for(Lt++;Lt<he.length&&!Vt.test(he[Lt]);Lt++){let Bt=he[Lt],Gt=0;while(Gt<_t.length&&(Bt[Gt]===" "||Bt[Gt]==="\t"))Gt++;Ft.push(Bt.slice(Gt))}Ae.push({kind:"code",code:Ft.join(`
|
|
221
|
-
`)}),$t=[""]}if($t.length>1||Ae.length===0)Ae.push(X($t));return Ae}function Tp(B){let X="";for(let he=0;he<B.length;he++){let Ae=B[he];if(Ae.kind==="code"){X+=`<pre><code>${Br(Ae.code).replace(Gn,"<br />")}</code></pre>`;continue}let $t=Ae.text;if(B[he-1]?.kind==="code")$t=$t.replace(vf,"");if(B[he+1]?.kind==="code")$t=$t.replace(Ef,"");X+=$t.replace(jr,"|").replace(Gn,"<br />")}return X}function xn(B){if(B===void 0)return Cn;return $p(B)}function Ap(B){if(!B.reExport)return xn(B.type);let{from:X,imported:he}=B.reExport,Ae=he==="*"?"":hf.test(he)?`.${he}`:`[${JSON.stringify(he)}]`;return xn(`typeof import(${JSON.stringify(X)})${Ae}`)}function Np(B){if(!B.includes("<")&&!B.includes(">"))return B;return B.replace(lf,"<").replace(uf,">")}function Vr(B){if(B===void 0)return Cn;return $p(B)}function Wn(B,X){if(X===void 0)return B;let he=typeof X==="string"&&X.trim().length>0?`: ${Np(X).replace(Gn," ").replace(jr,"|")}`:"";return`<s>${B}</s><br />**Deprecated**${he}`}function ci(B){if(B===void 0||B.trim().length===0)return Cn;return Tp(Pp(B))}function _p(B){if(B===void 0||B==="{}")return Cn;return xn(Us(B).replace(Gn," "))}function Dp(B){if(B===void 0)return Cn;return`<code>${Br(B).replace(Gn,"<br />")}</code>`}function ts(B,X){let he=B!==void 0&&B.trim().length>0;if(!(he&&Or(B))&&!X?.some(({body:Ot})=>Ot&&Or(Ot))){let Ot=he?[Mr(B)]:[];for(let{name:_t,body:It}of X??[]){let Mt=It?.trim();Ot.push(Mt?`@${_t} ${Mr(Mt)}`:`@${_t}`)}if(Ot.length===0)return Cn;return Ot.join(`
|
|
222
|
-
`).replace(jr,"|").replace(Gn,"<br />")}let Ae=[],$t=(Ot)=>{let _t=Ae.at(-1);if(_t?.kind==="prose")_t.text+=Ot;else Ae.push({kind:"prose",text:Ot})},Lt=(Ot,_t)=>{if(Ae.length>0)$t(`
|
|
223
|
-
`);if(Ot)$t(Ot);for(let It of Pp(_t))if(It.kind==="prose")$t(It.text);else Ae.push(It)};if(he)Lt("",B);for(let{name:Ot,body:_t}of X??[]){let It=_t?.trim();Lt(It?`@${Ot} `:`@${Ot}`,It??"")}if(Ae.length===0)return Cn;return Tp(Ae)}function Rp(B){if(B===void 0)return Cn;return xn(B.replace(Gn," "))}function bf(B){let X=[B.extends?`Extends ${xn(B.extends)}.`:"",B.implements?.length?`Implements ${B.implements.map((he)=>xn(he)).join(", ")}.`:""].filter(Boolean);return X.length>0?X.join(" "):void 0}function Ip(B,X){let he=new Set;for(let Ae of X){if(Ae.kind!=="class")continue;let $t=bf(Ae);if(!Ae.members?.length&&!$t)continue;let Lt=Ae.localName??Ae.name;if(he.has(Lt))continue;if(he.add(Lt),B.append("h4",`\`${Lt}\` members`),$t)B.append("raw",`${$t}
|
|
224
|
-
|
|
225
|
-
`);if(!Ae.members?.length)continue;B.append("raw",cf);for(let Ot of Ae.members)B.append("raw",`| ${Wn(Ot.name,Ot.deprecated)} | ${xn(sr(Ot))} | ${ts(Ot.description,Ot.tags)} |
|
|
226
|
-
`);B.append("raw",`
|
|
227
|
-
`)}}var Cf=/[^\w\- ]+/g,Sf=/\s+/g;function wf(B,X){let he=B.toLowerCase().replace(vp,"").replace(Cf,"").replace(Sf,"-"),Ae=X.get(he)??0;return X.set(he,Ae+1),Ae===0?he:`${he}-${Ae}`}class Gr{sourceParts=[];hasToC=!1;toc=[];onAppend;constructor(B={}){this.onAppend=B.onAppend}get source(){return this.sourceParts.join("")}appendLineBreaks(){return this.sourceParts.push(`
|
|
228
|
-
|
|
229
|
-
`),this}append(B,X){switch(B){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{let he=Number(B.slice(-1));if(this.sourceParts.push(`${"#".repeat(he)} ${X}`),this.hasToC&&B==="h2")this.toc.push({indent:0,raw:X??""});break}case"quote":this.sourceParts.push(`> ${X}`);break;case"p":this.sourceParts.push(X??"");break;case"divider":this.sourceParts.push("---");break;case"raw":this.sourceParts.push(X??"");break}if(B!=="raw")this.appendLineBreaks();return this.onAppend?.call(this,B,this),this}tableOfContents(){return this.sourceParts.push("<!-- __TOC__ -->"),this.hasToC=!0,this.appendLineBreaks(),this}end(){let B=this.sourceParts.join("");if(!this.hasToC)return B;let X="<!-- __TOC__ -->",he=B.indexOf(X);if(he===-1)return B;let Ae=new Map,$t=this.toc.map(({indent:Lt,raw:Ot})=>`${" ".repeat(Lt)}- [${Ot}](#${wf(Ot,Ae)})`).join(`
|
|
230
|
-
`);return B.slice(0,he)+$t+B.slice(he+X.length)}}function Lp(B,X,he){if(B.append("h1","Component Index"),B.append("h2","Components").tableOfContents(),B.append("divider"),he&&he.length>0)Mp(B,he);let Ae=l(X);for(let $t of Ae.components)jp(B,$t)}function Op(B,X,he){B.append("h1","Component Index"),B.append("h2","Components");for(let Ae of X)B.append("raw",`- [${Ae.moduleName}](./${Ae.moduleName}.md)
|
|
231
|
-
`);if(B.append("raw",`
|
|
232
|
-
`),B.append("divider"),he&&he.length>0)Mp(B,he)}function Mp(B,X){B.append("h2","Exports"),B.append("raw",Fr);for(let he of X){let Ae=(he.type??he.value)?.replace(Ep," ").trim();B.append("raw",`| ${Wn(he.name,he.deprecated)} | ${`<code>${he.kind}</code>`} | ${xn(Ae)} | ${ci(he.description)} |
|
|
233
|
-
`)}B.append("raw",`
|
|
234
|
-
`),B.append("divider")}function kf(B){return B.kind==="const"||B.isFunctionDeclaration}function $f(B,X){B.append("h3","Module exports"),B.append("raw",Fr);for(let he of X)B.append("raw",`| ${Wn(he.name,he.deprecated)} | ${`<code>${he.kind}</code>`} | ${Ap(he)} | ${ts(he.description,he.tags)} |
|
|
235
|
-
`);B.append("raw",`
|
|
236
|
-
`),Ip(B,X)}function Wr(B,X,he,Ae){if(X.length>0)he(),B.append("raw",`
|
|
237
|
-
`);else B.append("p",Ae??"None.")}function Fp(B,X){jp(B,X)}function jp(B,X){if(B.append("h2",`\`${X.moduleName}\``),X.generics)B.append("p",`**Type parameters:** ${xn(`<${X.generics[1]}>`)}`);if(X.typedefs.length>0)B.append("h3","Types").append("raw",`\`\`\`ts
|
|
238
|
-
${Hs({typedefs:X.typedefs})}
|
|
239
|
-
\`\`\`
|
|
240
|
-
|
|
241
|
-
`);if(B.append("h3","Props"),Wr(B,X.props,()=>{B.append("raw",bp);let he=($t)=>$t.reactive?0:$t.constant?2:1,Ae=X.props.map(($t,Lt)=>({prop:$t,index:Lt})).sort(($t,Lt)=>he($t.prop)-he(Lt.prop)||$t.index-Lt.index).map(({prop:$t})=>$t);for(let $t of Ae){let Lt=kf($t)?"accessor":$t.kind;B.append("raw",`| ${Wn($t.name,$t.deprecated)} | ${$t.isRequired?"Yes":"No"} | ${`<code>${Lt}</code>`} | ${$t.reactive?"Yes":"No"} | ${$t.binding??"--"} | ${xn($t.type)} | ${Vr($t.value)} | ${ts($t.description,$t.tags)} |
|
|
242
|
-
`)}}),X.moduleExports.length>0)$f(B,X.moduleExports);if(B.append("h3","Slots"),Wr(B,X.slots,()=>{B.append("raw",Cp);for(let he of X.slots)B.append("raw",`| ${Wn(he.default?Cn:he.name??Cn,he.deprecated)} | ${he.default?"Yes":"No"} | ${_p(he.slot_props)} | ${Dp(he.fallback)} | ${ts(he.description,he.tags)} |
|
|
243
|
-
`)}),B.append("h3","Events"),Wr(B,X.events,()=>{B.append("raw",Sp);for(let he of X.events)B.append("raw",`| ${Wn(he.name,he.deprecated)} | ${he.type} | ${Rp(he.detail)} | ${ts(he.description,he.tags)} |
|
|
244
|
-
`)}),X.cssParts&&X.cssParts.length>0){B.append("h3","CSS Parts"),B.append("raw",wp);for(let he of X.cssParts)B.append("raw",`| ${he.name} | ${ci(he.description)} |
|
|
245
|
-
`);B.append("raw",`
|
|
246
|
-
`)}if(X.cssProperties&&X.cssProperties.length>0){B.append("h3","CSS Custom Properties"),B.append("raw",kp);for(let he of X.cssProperties)B.append("raw",`| ${he.name} | ${xn(he.type)} | ${Vr(he.default)} | ${ci(he.description)} |
|
|
247
|
-
`);B.append("raw",`
|
|
248
|
-
`)}}function Hr(B,X){return new Gr({onAppend:(he,Ae)=>{B.onAppend?.call(null,he,Ae,X)}})}async function Pf(B,X){let he=X.outDir,Ae=l(B,{entryExports:X.entryExports}),$t=new wn,Lt=Hr(X,B);Op(Lt,Ae.components,X.entryExports);let Ot=Ur(Bp(he,"README.md")),_t=await $t.write(Ot,Lt.end());Tn(`${_t?"created":"unchanged"} "${Ot}".`),await Promise.all(Ae.components.map(async(It)=>{let Mt=Hr(X,B);Fp(Mt,It);let Ft=Ur(Bp(he,`${It.moduleName}.md`)),Vt=await $t.write(Ft,Mt.end());Tn(`${Vt?"created":"unchanged"} "${Ft}".`)}))}function qr(B,X){let he=Hr(X,B);return Lp(he,B,X.entryExports),he.end()}async function Kr(B,X){if(X.outDir){await Pf(B,X);return}let he=Ur(X.outFile),Ae=await new wn().write(he,qr(B,X));Tn(`${Ae?"created":"unchanged"} "${X.outFile}".`)}import{join as Tf,resolve as Af}from"node:path";function Nf(B,X){if(!X.indexTypes)return[];let he=X.format==="component",Ae=new Set,$t=[];for(let[,Lt]of Object.entries(X.exports)){if(!Lt.default||!Sn.test(Lt.source))continue;let Ot=t(Lt.source);if(Ae.has(Ot))continue;Ae.add(Ot);let _t=B.components.find((Mt)=>Mt.filePath===Ot);if(!_t)continue;let It=[Zn(_t.moduleName)];if(he)It.push(fs(_t.moduleName));$t.push({source:Lt.source,names:It})}return $t}async function Vp(B,X,he){if(!B)return X;try{let Ae=await B(X,he);if(typeof Ae!=="string")throw TypeError(`must return a string, got ${typeof Ae}`);return Ae}catch(Ae){let $t=Ae instanceof Error?Ae.message:String(Ae);throw Error(`sveld: typesOptions.transform failed for "${he.filePath}": ${$t}`,{cause:Ae})}}function _f(B,X){return`${B}
|
|
249
|
-
${ba(X)}`}async function zr(B,X){let he=Af(X.outDir,"index.d.ts"),Ae=new wn,$t=l(B),Lt=gp(Nf($t,X)),Ot=X.preamble+[mp(X.exports),Lt].filter((Gt)=>Gt!=="").join(`
|
|
250
|
-
|
|
251
|
-
`),_t=ir(X),It=$t.components.map(async(Gt)=>{let Wt=_r(Tf(X.outDir,Gt.filePath)),Ut=t(_r(Gt.filePath)),Ht=X.resolvedPathByFilePath?.get(Gt.filePath),zt=Ht?void 0:X.crossFileResolvedPathByFilePath?.get(Gt.filePath),Xt=Ht??zt,Zt=_f(Gt.moduleName,_t),tn=zt?`${Zt}
|
|
252
|
-
${oi(JSON.stringify(Gt))}`:Zt,an=Xt?X.cache?.getGeneratedText(Xt,tn):void 0;if(an===void 0){if(an=rr(Gt,_t),Xt)X.cache?.setGeneratedText(Xt,tn,an)}let In=await Vp(X.transform,an,{kind:"component",component:Gt,filePath:Ut});return Ae.write(Wt,In)}),Mt=(async()=>{let Gt=await Vp(X.transform,Ot,{kind:"index",filePath:"index.d.ts"});return Ae.write(he,`${Gt}
|
|
253
|
-
`)})(),Ft=(await Promise.all([...It,Mt])).filter(Boolean).length,Vt=It.length+1,Bt=Ft===0?`unchanged ${Vt}`:`created ${Ft} of ${Vt}`;Tn(`${Bt} TypeScript definitions in "${X.outDir}".`)}var Gp='sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.',If=["reportDiagnostics","strict","check","checkLevel","stdout","format"],Lf=50;function Of(B){let X=Promise.resolve();return()=>{X=X.then(B,B)}}function Pt(B){let X=B?.watch===!0,he,Ae,$t=B??{},Lt,Ot=null,_t,It=new Set,Ft=Of(async()=>{if(Ot==null||Ae==null||It.size===0)return;let Bt=Array.from(It);It.clear();try{let{result:Gt}=await Ot.update(Bt);await P(Gt,$t,Ae),Gt.cache?.save()}catch(Gt){console.error("sveld: failed to regenerate types in watch mode:",Gt)}}),Vt=(Bt)=>{if(!X||Ot==null||!Wo.test(Bt))return;It.add(Bt),clearTimeout(_t),_t=setTimeout(Ft,Lf)};return{name:"vite-plugin-sveld",apply:X?void 0:"build",enforce:"post",configResolved(Bt){Lt=Bt.root},async buildStart(){if(B?.config){let Gt=Lt??process.cwd(),Wt=typeof B.config==="string"?await H(Df(B.config)?B.config:Rf(Gt,B.config)):await O(Gt);$t=D(Wt,B)}M($t);let Bt=If.filter((Gt)=>(Gt in $t));if(Bt.length>0)console.warn(`sveld: the Vite plugin ignores ${Bt.map((Gt)=>`"${Gt}"`).join(", ")}; run the sveld CLI or sveld() for them.`);if(j($t.quiet===!0),Ae=ai($t.entry),X&&Ae!=null)try{Ot=await fp(Ae,$t.glob===!0,S($t));let Gt=await Ot.result;await P(Gt,$t,Ae),Gt.cache?.save()}catch(Gt){console.error("sveld: failed to generate initial types in watch mode:",Gt)}},async generateBundle(){if(X)return;if(Ae==null)this.error(Gp);he=await C(Ae,$t.glob===!0,S($t))},async writeBundle(){if(X)return;if(Ae==null)this.error(Gp);await P(he,$t,Ae),he.cache?.save()},handleHotUpdate(Bt){Vt(Bt.file)},watchChange(Bt){Vt(Bt)}}}async function P(B,X,he){let Ae=Wp(he);if(X?.types!==!1)await zr(B.allComponentsForTypes,{outDir:"types",preamble:"",...X?.typesOptions,exports:B.exports,inputDir:Ae,cache:B.cache,resolvedPathByFilePath:B.resolvedPathByFilePath,crossFileResolvedPathByFilePath:B.crossFileResolvedPathByFilePath});if(X?.json)await Lr(B.components,{outFile:"COMPONENT_API.json",...X?.jsonOptions,inputDir:Ae,entryExports:B.entryExports});if(X?.markdown)await Kr(B.components,{outFile:"COMPONENT_INDEX.md",...X?.markdownOptions,entryExports:B.entryExports})}async function At(B,X,he){let Ae=Wp(he);if(X?.json){let $t=Ir(B.components,{...X?.jsonOptions,inputDir:Ae,entryExports:B.entryExports});process.stdout.write($t);return}if(X?.markdown){let $t=qr(B.components,{...X?.markdownOptions,entryExports:B.entryExports});process.stdout.write($t)}}import{dirname as Mf}from"node:path";function Pe(B){if(B.check&&!B.check.snapshotExists&&!B.writesSnapshot)return 1;if(B.check?.changes.some((X)=>X.kind==="schema"))return 1;if(B.errors.length>0)return 2;if(B.check&&Yo(B.check.bump,B.checkLevel??"major"))return 3;if(eo(B.diagnostics,B.strict).length>0)return 4;return 0}async function Rt(B){if(B&&"input"in B)throw Error("sveld: the `input` option was renamed to `entry`.");let{entry:X,...he}=B??{},Ae=await O(),$t=ai(X??Ae.entry);if($t===null)throw Error('sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.');let Lt=D(Ae,he,{entry:$t});M(Lt),j(Lt.quiet===!0);let Ot=await C($t,Lt.glob===!0,S(Lt)),_t;if(Lt.check)_t=await L(Ot.components,ue(Lt),{entryExports:Ot.entryExports});await P(Ot,Lt,$t),Ot.cache?.save();let It=Lt.reportDiagnostics||Lt.strict,Mt=Z(Ot.diagnostics,It);if(It&&Mt.length>0)if(Lt.format==="json")process.stderr.write(ee(Mt));else console.error(K(Mt));let Ft=Pe({errors:Ot.errors,check:_t,writesSnapshot:_t?le(Lt,_t.snapshotFile):!1,checkLevel:Lt.checkLevel,diagnostics:Mt,strict:Lt.strict}),Vt=Rr(Ot.components,{inputDir:Mf($t),entryExports:Ot.entryExports,source:Lt.jsonOptions?.source});return{diagnostics:Mt,check:_t,errors:Ot.errors,document:Vt,exitCode:Ft}}
|
|
254
|
-
export{h,_e,w,n,A,p,d,m,Ne,ge,x,o,i,Q,_,Y,J,s,Z,K,Re,ee,F,V,T,g,E,a,c,N,U,te,ye,ne,Ie,xe,Te,R,f,y,r,re,ie,b,G,e,Le,Oe,Me,$e,je,qe,Be,Je,Fe,Ve,Ee,Ue,Ge,be,We,He,ze,Xe,ke,Se,Qe,we,Ye,Ze,k,Ke,et,tt,nt,rt,it,st,ot,at,ve,ct,pt,ut,lt,ft,dt,se,mt,ht,gt,De,yt,xt,Tt,Et,u,bt,kt,St,oe,W,ae,I,wt,ce,pe,v,t,vt,l,Dt,ue,le,L,fe,Ct,de,Nt,H,O,D,M,z,j,me,q,S,C,Ce,Pt,P,At,Pe,Rt};
|