@frontfriend/sdk 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/cli.js +171 -170
- package/dist/lib/core/adoption.js +1 -1
- package/dist/lib/core/application-adoption.js +20 -20
- package/dist/mcp.cjs +102 -102
- package/dist/next.js +1 -1
- package/dist/package.json +1 -1
- package/dist/vite.js +1 -1
- package/package.json +1 -1
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)}function
|
|
3
|
-
`)?r.body.slice(0,-1):r.body;return["<!-- frontfriend design mirror \u2014 DO NOT EDIT (overwritten by `frontfriend design sync`)",`slug: ${r.slug}`,`maturity: ${r.maturity}`,`implemented: ${r.implemented}`,`implementation: ${r.implementation||"unknown"}`,`version: ${r.version}`,"-->","",
|
|
4
|
-
`)}function
|
|
5
|
-
`)}function
|
|
6
|
-
`;)u+=1;else if(h==="/"&&l[u+1]==="*"){let f=l.indexOf("*/",u+2);if(f===-1)throw new Error(`Cannot read ${n}: unterminated comment.`);c+=l.slice(u,f+2).replace(/[^\n]/g," "),u=f+2}else c+=h,u+=1}let p="";for(let h=0;h<c.length;h+=1){let f=c[h];if(f==='"'){let g=h+1;for(;g<c.length&&c[g]!=='"';)g+=c[g]==="\\"?2:1;p+=c.slice(h,g+1),h=g;continue}if(f===","){let g=h+1;for(;g<c.length&&/\s/.test(c[g]);)g+=1;if(c[g]==="}"||c[g]==="]")continue}p+=f}try{return p.trim()?JSON.parse(p):{}}catch(h){throw new Error(`Cannot read ${n}: ${h.message}`)}}function or(r){return ar(ei.readFileSync(r,"utf8"),r)}var _t=r=>{try{return ei.statSync(r).isFile()}catch{return!1}};function cr(r,n){if(typeof r!="string"||!r)throw new Error('tsconfig "extends" must be a non-empty string.');let c=u=>_t(u)?u:!u.endsWith(".json")&&_t(`${u}.json`)?`${u}.json`:null;if(r.startsWith(".")||ce.isAbsolute(r)){let u=c(ce.resolve(n,r));if(u)return u;throw new Error(`File '${r}' not found (tsconfig extends, from ${n}).`)}for(let u=n;;u=ce.dirname(u)){let l=ce.join(u,"node_modules",r),p=c(l);if(p)return p;let h=null;try{h=JSON.parse(ei.readFileSync(ce.join(l,"package.json"),"utf8"))}catch{h=null}if(h&&typeof h.tsconfig=="string"&&_t(ce.join(l,h.tsconfig)))return ce.join(l,h.tsconfig);if(_t(ce.join(l,"tsconfig.json")))return ce.join(l,"tsconfig.json");if(ce.dirname(u)===u)break}for(let u of[r,`${r}/tsconfig.json`,`${r}.json`])try{return require.resolve(u,{paths:[n]})}catch{}throw new Error(`File '${r}' not found (tsconfig extends, from ${n}).`)}function ur(r,n,c=new Set){let u=ce.resolve(r);if(c.has(u))throw new Error(`Circularity detected while resolving configuration: ${u}`);let l=new Set(c).add(u),p=or(u),h=ce.dirname(u),f={},g=p.extends===void 0?[]:Array.isArray(p.extends)?p.extends:[p.extends];for(let C of g)f={...f,...ur(cr(C,h),n,l)};let b=p.compilerOptions&&typeof p.compilerOptions=="object"?p.compilerOptions:{},w=C=>typeof C=="string"?C.replace(/\$\{configDir\}/g,n):C;return typeof b.baseUrl=="string"&&(f.baseUrl=ce.resolve(h,w(b.baseUrl))),b.paths&&typeof b.paths=="object"&&(f.paths=Object.fromEntries(Object.entries(b.paths).map(([C,I])=>[C,Array.isArray(I)?I.map(w):I])),f.pathsBasePath=h),f}function $s(r){let n=ur(r,ce.dirname(ce.resolve(r)));return n.paths?{base:n.baseUrl||n.pathsBasePath||ce.dirname(r),paths:n.paths}:null}lr.exports={parseJsonc:ar,readJsonc:or,resolveExtends:cr,readConfigPaths:$s}});var Pt={};zt(Pt,{materializeInstallationPath:()=>ri,readProjectPaths:()=>pr,resolveCanonicalUiDirectory:()=>fr,resolveConfiguredAlias:()=>Et});function hr(r){try{return JSON.parse(Ke.default.readFileSync(r,"utf8"))}catch{return null}}function pr(r){for(let n of["tsconfig.json","tsconfig.app.json","jsconfig.json"]){let c=ue.default.join(r,n);if(!Ke.default.existsSync(c))continue;let u=Us(c);if(u)return u}return{base:r,paths:{"@/*":[Ke.default.existsSync(ue.default.join(r,"src"))?"src/*":"*"]}}}function Et(r,n,c=pr(r)){for(let[u,l]of Object.entries(c.paths)){if(!Array.isArray(l)||typeof l[0]!="string")continue;let[p,h=""]=u.split("*");if(!n.startsWith(p)||!n.endsWith(h)||!u.includes("*")&&n!==u)continue;let f=n.slice(p.length,h?-h.length:void 0);return ue.default.resolve(c.base,l[0].replace("*",f))}return n.startsWith("@/")?ue.default.resolve(r,Ke.default.existsSync(ue.default.join(r,"src"))?"src":".",n.slice(2)):ue.default.resolve(r,n)}function ii(r,n){let c=ue.default.relative(r,n).replace(/\\/g,"/");if(!c||c===".."||c.startsWith("../")||ue.default.posix.isAbsolute(c))throw new Error("The canonical ui alias must stay inside the Application root.");return c}function fr(r,n){if(n)return ii(r,Et(r,n));let u=hr(ue.default.join(r,"components.json"))?.aliases?.ui;return typeof u=="string"&&u?ii(r,Et(r,u)):Ke.default.existsSync(ue.default.join(r,"src"))?"src/components/ui":"components/ui"}function ri(r){if(r.installationLayout==="shadcn"&&/^(?:lib|hooks|components)\//.test(r.path)){let u=hr(ue.default.join(r.root,"components.json"))?.aliases||{},l=/^lib\/utils\.[^.]+$/.test(r.path),p=r.path.split("/")[0],h=l&&u.utils?u.utils:u[p]||`@/${p}`,f=Et(r.root,h);return ii(r.root,l&&u.utils?f+ue.default.extname(r.path):ue.default.join(f,r.path.slice(p.length+1)))}if(r.source!=="canonical"&&r.installationLayout!=="shadcn"||!r.path.startsWith("ui/"))return r.path;let n=r.path.slice(3);return ue.default.posix.join(fr(r.root,r.configuredUiPath),n)}var Ke,ue,Us,ot=Ji(()=>{Ke=Je(require("node:fs")),ue=Je(require("node:path")),{readConfigPaths:Us}=ti()});var mr=Se((ra,Hs)=>{Hs.exports={name:"@frontfriend/sdk",version:"1.2.1"}});var vr=Se((sa,gr)=>{var{name:zs}=mr();gr.exports={PACKAGE_NAME:zs}});var ni=Se((na,yr)=>{var{PACKAGE_NAME:Rt}=vr(),Oe=require("fs"),Gs=require("http"),Js=require("https"),me=require("path"),Nt=["contracts","tokens","components"],Ks=["app/globals.css","src/app/globals.css","styles/globals.css","src/styles/globals.css","src/styles.css","src/index.css","src/style.css"],Qs={next:["next.config.js","next.config.mjs","next.config.ts"],vite:["vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"]},Ys=["primereact","@mui/material","antd","@chakra-ui/react","@mantine/core","@fluentui/react"],Xs=["style-dictionary","@tokens-studio/sd-transforms","@vanilla-extract/css","styled-components","@emotion/react"];function xr(r){try{return JSON.parse(Oe.readFileSync(r,"utf8"))}catch{return{}}}function si(r){if(r===void 0)return null;if(!Array.isArray(r)){let u=new Error("`adopt` in frontfriend.config.js must be an array.");throw u.code="FRONTFRIEND_CONFIG_VALIDATION",u}let n=r.filter(u=>!Nt.includes(u));if(n.length>0){let u=new Error(`Unknown Frontfriend adoption level: ${n.join(", ")}.`);throw u.code="FRONTFRIEND_CONFIG_VALIDATION",u}let c=r.includes("components")?2:r.includes("tokens")?1:0;return Nt.slice(0,c+1)}function Zs(r){for(let[n,c]of Object.entries(Qs)){let u=c.find(p=>Oe.existsSync(me.join(r,p)));if(!u)continue;let l=Oe.readFileSync(me.join(r,u),"utf8");return{buildTool:n,present:l.includes(`${Rt}/${n}`)}}return{buildTool:null,present:!1}}function en(r){let n=[me.join(r,"components","ui"),me.join(r,"src","components","ui"),me.join(r,"app","components","ui")].filter(l=>Oe.existsSync(l)),c=new Set;function u(l){for(let p of Oe.readdirSync(l,{withFileTypes:!0})){let h=me.join(l,p.name);if(p.isDirectory())u(h);else if(/\.(js|jsx|ts|tsx|vue)$/.test(p.name)){if(!Oe.readFileSync(h,"utf8").includes(Rt))continue;let g=me.basename(p.name,me.extname(p.name));c.add(g.toLowerCase()==="index"?me.basename(l):g.toLowerCase())}}}return n.forEach(u),[...c].sort()}function tn(r){let n=xr(me.join(r,"package.json")),c={...n.dependencies||{},...n.devDependencies||{}},u=c.tailwindcss||null,p=[xr(me.join(r,"components.json"))?.tailwind?.css,...Ks].filter(Boolean).find(g=>Oe.existsSync(me.join(r,g))),h=p?Oe.readFileSync(me.join(r,p),"utf8"):"",f=Xs.filter(g=>c[g]);return!f.length&&/:root[\s\S]*--(?:color|spacing|font|radius)-[\w-]+\s*:/.test(h)&&!h.includes(`${Rt}/theme.css`)&&f.push("css-custom-properties"),{nativeTokens:{present:h.includes("/* Frontfriend managed native tokens: start */"),file:p||null},tailwind:{present:!!u,version:u,major:u&&Number((String(u).match(/\d+/)||[])[0])||null},componentsJson:Oe.existsSync(me.join(r,"components.json")),themeImport:{present:h.includes(`${Rt}/theme.css`)||/@import\s+["'][^"']*node_modules\/\.cache\/frontfriend\/theme\.css["']/.test(h),file:p||null},plugin:Zs(r),frontfriendComponents:en(r),foreignComponentLibraries:Ys.filter(g=>c[g]),foreignTokenSystems:f}}function rn(r,n){let c=si(r)||Nt,u=c.includes("tokens"),l=c.includes("components"),p=[];return u&&!n.themeImport.present&&!n.nativeTokens?.present&&p.push("Config adopts tokens, but the Frontfriend theme import was not observed."),!u&&n.themeImport.present&&p.push("Frontfriend tokens are present in CSS but are not adopted in config."),l&&!n.componentsJson&&p.push("Config adopts components, but components.json was not observed."),!l&&n.frontfriendComponents.length>0&&p.push("Frontfriend components are installed but are not adopted in config."),p}function sn({apiUrl:r,token:n,ffId:c,name:u,adopt:l,observed:p,framework:h,primitive:f}){if(!r||!n||!c||!u||!h||f===void 0)return Promise.resolve({reported:!1,unavailable:!0});let g=new URL("/api/apps/sync",r),b=JSON.stringify({ffId:c,name:u,adopt:si(l),observed:p,runtime:"sdk",framework:h,primitive:f}),w=g.protocol==="https:"?Js:Gs;return new Promise(C=>{let I=w.request(g,{method:"POST",headers:{authorization:`Bearer ${n}`,"content-type":"application/json","content-length":Buffer.byteLength(b)}},E=>{E.resume(),E.on("end",()=>{E.statusCode>=200&&E.statusCode<300?C({reported:!0,unavailable:!1}):C({reported:!1,unavailable:!0})})});I.on("error",()=>C({reported:!1,unavailable:!0})),I.setTimeout(1500,()=>{I.destroy(),C({reported:!1,unavailable:!0})}),I.end(b)})}yr.exports={ADOPTION_LEVELS:Nt,normalizeAdopt:si,probeAdoption:tn,adoptionWarnings:rn,reportAdoption:sn}});var wr=Se((Tt,br)=>{(function(r,n){typeof Tt=="object"&&typeof br<"u"?n(Tt):typeof define=="function"&&define.amd?define(["exports"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.acorn={}))})(Tt,function(r){"use strict";var n=[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],c=[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],u="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",l="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",p={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"},h="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",f={5:h,"5module":h+" export import",6:h+" const class extends export import super"},g=/^in(stanceof)?$/,b=new RegExp("["+l+"]"),w=new RegExp("["+l+u+"]");function C(e,t){for(var i=65536,s=0;s<t.length;s+=2){if(i+=t[s],i>e)return!1;if(i+=t[s+1],i>=e)return!0}return!1}function I(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&b.test(String.fromCharCode(e)):t===!1?!1:C(e,c)}function E(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&w.test(String.fromCharCode(e)):t===!1?!1:C(e,c)||C(e,n)}var _=function(t,i){i===void 0&&(i={}),this.label=t,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function O(e,t){return new _(e,{beforeExpr:!0,binop:t})}var N={beforeExpr:!0},B={startsExpr:!0},Z={};function V(e,t){return t===void 0&&(t={}),t.keyword=e,Z[e]=new _(e,t)}var a={num:new _("num",B),regexp:new _("regexp",B),string:new _("string",B),name:new _("name",B),privateId:new _("privateId",B),eof:new _("eof"),bracketL:new _("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new _("]"),braceL:new _("{",{beforeExpr:!0,startsExpr:!0}),braceR:new _("}"),parenL:new _("(",{beforeExpr:!0,startsExpr:!0}),parenR:new _(")"),comma:new _(",",N),semi:new _(";",N),colon:new _(":",N),dot:new _("."),question:new _("?",N),questionDot:new _("?."),arrow:new _("=>",N),template:new _("template"),invalidTemplate:new _("invalidTemplate"),ellipsis:new _("...",N),backQuote:new _("`",B),dollarBraceL:new _("${",{beforeExpr:!0,startsExpr:!0}),eq:new _("=",{beforeExpr:!0,isAssign:!0}),assign:new _("_=",{beforeExpr:!0,isAssign:!0}),incDec:new _("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new _("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:O("||",1),logicalAND:O("&&",2),bitwiseOR:O("|",3),bitwiseXOR:O("^",4),bitwiseAND:O("&",5),equality:O("==/!=/===/!==",6),relational:O("</>/<=/>=",7),bitShift:O("<</>>/>>>",8),plusMin:new _("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:O("%",10),star:O("*",10),slash:O("/",10),starstar:new _("**",{beforeExpr:!0}),coalesce:O("??",1),_break:V("break"),_case:V("case",N),_catch:V("catch"),_continue:V("continue"),_debugger:V("debugger"),_default:V("default",N),_do:V("do",{isLoop:!0,beforeExpr:!0}),_else:V("else",N),_finally:V("finally"),_for:V("for",{isLoop:!0}),_function:V("function",B),_if:V("if"),_return:V("return",N),_switch:V("switch"),_throw:V("throw",N),_try:V("try"),_var:V("var"),_const:V("const"),_while:V("while",{isLoop:!0}),_with:V("with"),_new:V("new",{beforeExpr:!0,startsExpr:!0}),_this:V("this",B),_super:V("super",B),_class:V("class",B),_extends:V("extends",N),_export:V("export"),_import:V("import",B),_null:V("null",B),_true:V("true",B),_false:V("false",B),_in:V("in",{beforeExpr:!0,binop:7}),_instanceof:V("instanceof",{beforeExpr:!0,binop:7}),_typeof:V("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:V("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:V("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},x=/\r\n?|\n|\u2028|\u2029/,P=new RegExp(x.source,"g");function $(e){return e===10||e===13||e===8232||e===8233}function H(e,t,i){i===void 0&&(i=e.length);for(var s=t;s<i;s++){var o=e.charCodeAt(s);if($(o))return s<i-1&&o===13&&e.charCodeAt(s+1)===10?s+2:s+1}return-1}var ee=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,G=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,te=Object.prototype,Ie=te.hasOwnProperty,A=te.toString,T=Object.hasOwn||function(e,t){return Ie.call(e,t)},ie=Array.isArray||function(e){return A.call(e)==="[object Array]"},Ae=Object.create(null);function ge(e){return Ae[e]||(Ae[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function q(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var Q=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,W=function(t,i){this.line=t,this.column=i};W.prototype.offset=function(t){return new W(this.line,this.column+t)};var re=function(t,i,s){this.start=i,this.end=s,t.sourceFile!==null&&(this.source=t.sourceFile)};function pe(e,t){for(var i=1,s=0;;){var o=H(e,s,t);if(o<0)return new W(i,t-s);++i,s=o}}var je={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,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Ue=!1;function ke(e){var t={};for(var i in je)t[i]=e&&T(e,i)?e[i]:je[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Ue&&typeof console=="object"&&console.warn&&(Ue=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
7
|
-
Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),
|
|
8
|
-
`,s-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(x).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=a.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=t.sourceType==="module",this.strict=this.inModule||t.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&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?Ce:se),this.regexpState=null,this.privateNameStack=[]},xe={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}};Y.prototype.parse=function(){var t=this,i=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return t.parseTopLevel(i)})},xe.inFunction.get=function(){return(this.currentVarScope().flags&Ce)>0},xe.inGenerator.get=function(){return(this.currentVarScope().flags&ne)>0},xe.inAsync.get=function(){return(this.currentVarScope().flags&fe)>0},xe.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(Be|Ze))return!1;if(i&Ce)return(i&fe)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},xe.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&se)},xe.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags;return(t&pt)>0||this.options.allowSuperOutsideMethod},xe.allowDirectSuper.get=function(){return(this.currentThisScope().flags&vi)>0},xe.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},xe.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(Be|Ze)||i&Ce&&!(i&qe))return!0}return!1},xe.allowUsing.get=function(){var e=this.currentScope(),t=e.flags;return!(t&xi||!this.inModule&&t&se)},xe.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Be)>0},Y.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var s=this,o=0;o<t.length;o++)s=t[o](s);return s},Y.parse=function(t,i){return new this(i,t).parse()},Y.parseExpressionAt=function(t,i,s){var o=new this(s,t,i);return o.nextToken(),o.parseExpression()},Y.tokenizer=function(t,i){return new this(i,t)},Object.defineProperties(Y.prototype,xe);var ae=Y.prototype,zr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;ae.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){G.lastIndex=e,e+=G.exec(this.input)[0].length;var t=zr.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){G.lastIndex=e+t[0].length;var i=G.exec(this.input),s=i.index+i[0].length,o=this.input.charAt(s);return o===";"||o==="}"||x.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(o)||o==="!"&&this.input.charAt(s+1)==="=")}e+=t[0].length,G.lastIndex=e,e+=G.exec(this.input)[0].length,this.input[e]===";"&&e++}},ae.eat=function(e){return this.type===e?(this.next(),!0):!1},ae.isContextual=function(e){return this.type===a.name&&this.value===e&&!this.containsEsc},ae.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},ae.catchStackOverflow=function(e){try{return e()}catch(t){if(t instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(t.message)||/\btoo much recursion\b/i.test(t.message)))this.raise(this.start,"Not enough stack space to parse input");else throw t}},ae.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},ae.canInsertSemicolon=function(){return this.type===a.eof||this.type===a.braceR||x.test(this.input.slice(this.lastTokEnd,this.start))},ae.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},ae.semicolon=function(){!this.eat(a.semi)&&!this.insertSemicolon()&&this.unexpected()},ae.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},ae.expect=function(e){this.eat(e)||this.unexpected()},ae.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var mt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ae.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}},ae.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,s=e.doubleProto;if(!t)return i>=0||s>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),s>=0&&this.raiseRecoverable(s,"Redefinition of __proto__ property")},ae.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},ae.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var k=Y.prototype;k.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==a.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var s=0,o=Object.keys(this.undefinedExports);s<o.length;s+=1){var d=o[s];this.raiseRecoverable(this.undefinedExports[d].start,"Export '"+d+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(e,"Program")};var Ut={kind:"loop"},Gr={kind:"switch"};k.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;G.lastIndex=this.pos;var t=G.exec(this.input),i=this.pos+t[0].length,s=this.fullCharCodeAt(i);if(s===91||s===92)return!0;if(e)return!1;if(s===123)return!0;if(I(s)){var o=i;do i+=s<=65535?1:2;while(E(s=this.fullCharCodeAt(i)));if(s===92)return!0;var d=this.input.slice(o,i);if(!g.test(d))return!0}return!1},k.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;G.lastIndex=this.pos;var e=G.exec(this.input),t=this.pos+e[0].length,i;return!x.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(E(i=this.fullCharCodeAt(t+8))||i===92))},k.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return!1;G.lastIndex=this.pos;var i=G.exec(this.input),s=this.pos+i[0].length;if(x.test(this.input.slice(this.pos,s)))return!1;if(e){var o=s+5,d;if(this.input.slice(s,o)!=="using"||o===this.input.length||E(d=this.fullCharCodeAt(o))||d===92)return!1;G.lastIndex=o;var m=G.exec(this.input);if(s=o+m[0].length,m&&x.test(this.input.slice(o,s)))return!1}var v=this.fullCharCodeAt(s);if(!I(v)&&v!==92)return!1;var y=s;do s+=v<=65535?1:2;while(E(v=this.fullCharCodeAt(s)));if(v===92)return!0;var L=this.input.slice(y,s);if(g.test(L))return!1;if(t&&!e&&L==="of"){G.lastIndex=s;var M=G.exec(this.input);if(s=s+M[0].length,this.input.charCodeAt(s)!==61||(v=this.input.charCodeAt(s+1))===61||v===62)return!1}return!0},k.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},k.isUsing=function(e){return this.isUsingKeyword(!1,e)},k.parseStatement=function(e,t,i){var s=this.type,o=this.startNode(),d;switch(this.isLet(e)&&(s=a._var,d="let"),s){case a._break:case a._continue:return this.parseBreakContinueStatement(o,s.keyword);case a._debugger:return this.parseDebuggerStatement(o);case a._do:return this.parseDoStatement(o);case a._for:return this.parseForStatement(o);case a._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(o,!1,!e);case a._class:return e&&this.unexpected(),this.parseClass(o,!0);case a._if:return this.parseIfStatement(o);case a._return:return this.parseReturnStatement(o);case a._switch:return this.parseSwitchStatement(o);case a._throw:return this.parseThrowStatement(o);case a._try:return this.parseTryStatement(o);case a._const:case a._var:return d=d||this.value,e&&d!=="var"&&this.unexpected(),this.parseVarStatement(o,d);case a._while:return this.parseWhileStatement(o);case a._with:return this.parseWithStatement(o);case a.braceL:return this.parseBlock(!0,o);case a.semi:return this.parseEmptyStatement(o);case a._export:case a._import:if(this.options.ecmaVersion>10&&s===a._import){G.lastIndex=this.pos;var m=G.exec(this.input),v=this.pos+m[0].length,y=this.input.charCodeAt(v);if(y===40||y===46)return this.parseExpressionStatement(o,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),s===a._import?this.parseImport(o):this.parseExport(o,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(o,!0,!e);var L=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(L)return 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"),e&&this.raise(this.start,"Using declaration is not allowed in single-statement positions"),L==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(o,!1,L),this.semicolon(),this.finishNode(o,"VariableDeclaration");var M=this.value,K=this.parseExpression();return s===a.name&&K.type==="Identifier"&&this.eat(a.colon)?this.parseLabeledStatement(o,M,K,e):this.parseExpressionStatement(o,K)}},k.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(a.semi)||this.insertSemicolon()?e.label=null:this.type!==a.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var s=0;s<this.labels.length;++s){var o=this.labels[s];if((e.label==null||o.name===e.label.name)&&(o.kind!=null&&(i||o.kind==="loop")||e.label&&i))break}return s===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")},k.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},k.parseDoStatement=function(e){return this.next(),this.labels.push(Ut),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(a._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(a.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},k.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Ut),this.enterScope(0),this.expect(a.parenL),this.type===a.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===a._var||this.type===a._const||i){var s=this.startNode(),o=i?"let":this.value;return this.next(),this.parseVar(s,!0,o),this.finishNode(s,"VariableDeclaration"),this.parseForAfterInit(e,s,t)}var d=this.isContextual("let"),m=!1,v=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(v){var y=this.startNode();return this.next(),v==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(y,!0,v),this.finishNode(y,"VariableDeclaration"),this.parseForAfterInit(e,y,t)}var L=this.containsEsc,M=new mt,K=this.start,oe=t>-1?this.parseExprSubscripts(M,"await"):this.parseExpression(!0,M);return this.type===a._in||(m=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===a._in&&this.unexpected(t),e.await=!0):m&&this.options.ecmaVersion>=8&&(oe.start===K&&!L&&oe.type==="Identifier"&&oe.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),d&&m&&this.raise(oe.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(oe,!1,M),this.checkLValPattern(oe),this.parseForIn(e,oe)):(this.checkExpressionErrors(M,!0),t>-1&&this.unexpected(t),this.parseFor(e,oe))},k.parseForAfterInit=function(e,t,i){return(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&t.declarations.length===1?(this.type===a._in?((t.kind==="using"||t.kind==="await using")&&!t.declarations[0].init&&this.raise(this.start,"Using declaration is not allowed in for-in loops"),this.options.ecmaVersion>=9&&i>-1&&this.unexpected(i)):this.options.ecmaVersion>=9&&(e.await=i>-1),this.parseForIn(e,t)):(i>-1&&this.unexpected(i),this.parseFor(e,t))},k.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,et|(i?0:qt),!1,t)},k.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(a._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},k.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(a.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},k.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(a.braceL),this.labels.push(Gr),this.enterScope(xi);for(var t,i=!1;this.type!==a.braceR;)if(this.type===a._case||this.type===a._default){var s=this.type===a._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),s?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(a.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},k.parseThrowStatement=function(e){return this.next(),x.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Jr=[];k.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?ht:0),this.checkLValPattern(e,t?bi:Re),this.expect(a.parenR),e},k.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===a._catch){var t=this.startNode();this.next(),this.eat(a.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(a._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},k.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")},k.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Ut),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},k.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")},k.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},k.parseLabeledStatement=function(e,t,i,s){for(var o=0,d=this.labels;o<d.length;o+=1){var m=d[o];m.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var v=this.type.isLoop?"loop":this.type===a._switch?"switch":null,y=this.labels.length-1;y>=0;y--){var L=this.labels[y];if(L.statementStart===e.start)L.statementStart=this.start,L.kind=v;else break}return this.labels.push({name:t,kind:v,statementStart:this.start}),e.body=this.parseStatement(s?s.indexOf("label")===-1?s+"label":s:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")},k.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},k.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(a.braceL),e&&this.enterScope(0);this.type!==a.braceR;){var s=this.parseStatement(null);t.body.push(s)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},k.parseFor=function(e,t){return e.init=t,this.expect(a.semi),e.test=this.type===a.semi?null:this.parseExpression(),this.expect(a.semi),e.update=this.type===a.parenR?null:this.parseExpression(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},k.parseForIn=function(e,t){var i=this.type===a._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")},k.parseVar=function(e,t,i,s){for(e.declarations=[],e.kind=i;;){var o=this.startNode();if(this.parseVarId(o,i),this.eat(a.eq)?o.init=this.parseMaybeAssign(t):!s&&i==="const"&&!(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!s&&(i==="using"||i==="await using")&&this.options.ecmaVersion>=17&&this.type!==a._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+i+" declaration"):!s&&o.id.type!=="Identifier"&&!(t&&(this.type===a._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):o.init=null,e.declarations.push(this.finishNode(o,"VariableDeclarator")),!this.eat(a.comma))break}return e},k.parseVarId=function(e,t){e.id=t==="using"||t==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?$t:Re,!1)};var et=1,qt=2,Si=4;k.parseFunction=function(e,t,i,s,o){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!s)&&(this.type===a.star&&t&qt&&this.unexpected(),e.generator=this.eat(a.star)),this.options.ecmaVersion>=8&&(e.async=!!s),t&et&&(e.id=t&Si&&this.type!==a.name?null:this.parseIdent(),e.id&&!(t&qt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?$t:Re:yi));var d=this.yieldPos,m=this.awaitPos,v=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Bt(e.async,e.generator)),t&et||(e.id=this.type===a.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,o),this.yieldPos=d,this.awaitPos=m,this.awaitIdentPos=v,this.finishNode(e,t&et?"FunctionDeclaration":"FunctionExpression")},k.parseFunctionParams=function(e){this.expect(a.parenL),e.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},k.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var s=this.enterClassBody(),o=this.startNode(),d=!1;for(o.body=[],this.expect(a.braceL);this.type!==a.braceR;){var m=this.parseClassElement(e.superClass!==null);m&&(o.body.push(m),m.type==="MethodDefinition"&&m.kind==="constructor"?(d&&this.raiseRecoverable(m.start,"Duplicate constructor in the same class"),d=!0):m.key&&m.key.type==="PrivateIdentifier"&&Kr(s,m)&&this.raiseRecoverable(m.key.start,"Identifier '#"+m.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(o,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},k.parseClassElement=function(e){if(this.eat(a.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),s="",o=!1,d=!1,m="method",v=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(a.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===a.star?v=!0:s="static"}if(i.static=v,!s&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===a.star)&&!this.canInsertSemicolon()?d=!0:s="async"),!s&&(t>=9||!d)&&this.eat(a.star)&&(o=!0),!s&&!d&&!o){var y=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?m=y:s=y)}if(s?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=s,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===a.parenL||m!=="method"||o||d){var L=!i.static&>(i,"constructor"),M=L&&e;L&&m!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=L?"constructor":m,this.parseClassMethod(i,o,d,M)}else this.parseClassField(i);return i},k.isClassElementNameStart=function(){return this.type===a.name||this.type===a.privateId||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword},k.parseClassElementName=function(e){this.type===a.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},k.parseClassMethod=function(e,t,i,s){var o=e.key;e.kind==="constructor"?(t&&this.raise(o.start,"Constructor can't be a generator"),i&&this.raise(o.start,"Constructor can't be an async method")):e.static&>(e,"prototype")&&this.raise(o.start,"Classes may not have a static property named prototype");var d=e.value=this.parseMethod(t,i,s);return e.kind==="get"&&d.params.length!==0&&this.raiseRecoverable(d.start,"getter should have no params"),e.kind==="set"&&d.params.length!==1&&this.raiseRecoverable(d.start,"setter should have exactly one param"),e.kind==="set"&&d.params[0].type==="RestElement"&&this.raiseRecoverable(d.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},k.parseClassField=function(e){return gt(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&>(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(a.eq)?(this.enterScope(Ze|pt),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")},k.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(Be|pt);this.type!==a.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},k.parseClassId=function(e,t){this.type===a.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Re,!1)):(t===!0&&this.unexpected(),e.id=null)},k.parseClassSuper=function(e){e.superClass=this.eat(a._extends)?this.parseExprSubscripts(null,!1):null},k.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},k.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var s=this.privateNameStack.length,o=s===0?null:this.privateNameStack[s-1],d=0;d<i.length;++d){var m=i[d];T(t,m.name)||(o?o.used.push(m):this.raiseRecoverable(m.start,"Private field '#"+m.name+"' must be declared in an enclosing class"))}};function Kr(e,t){var i=t.key.name,s=e[i],o="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(o=(t.static?"s":"i")+t.kind),s==="iget"&&o==="iset"||s==="iset"&&o==="iget"||s==="sget"&&o==="sset"||s==="sset"&&o==="sget"?(e[i]="true",!1):s?!0:(e[i]=o,!1)}function gt(e,t){var i=e.computed,s=e.key;return!i&&(s.type==="Identifier"&&s.name===t||s.type==="Literal"&&s.value===t)}k.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==a.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},k.parseExport=function(e,t){if(this.next(),this.eat(a.star))return this.parseExportAllDeclaration(e,t);if(this.eat(a._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==a.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var i=0,s=e.specifiers;i<s.length;i+=1){var o=s[i];this.checkUnreserved(o.local),this.checkLocalExport(o.local),o.local.type==="Literal"&&this.raise(o.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},k.parseExportDeclaration=function(e){return this.parseStatement(null)},k.parseExportDefaultDeclaration=function(){var e;if(this.type===a._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,et|Si,!1,e)}else if(this.type===a._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var s=this.parseMaybeAssign();return this.semicolon(),s}},k.checkExport=function(e,t,i){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),T(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)},k.checkPatternExport=function(e,t){var i=t.type;if(i==="Identifier")this.checkExport(e,t,t.start);else if(i==="ObjectPattern")for(var s=0,o=t.properties;s<o.length;s+=1){var d=o[s];this.checkPatternExport(e,d)}else if(i==="ArrayPattern")for(var m=0,v=t.elements;m<v.length;m+=1){var y=v[m];y&&this.checkPatternExport(e,y)}else i==="Property"?this.checkPatternExport(e,t.value):i==="AssignmentPattern"?this.checkPatternExport(e,t.left):i==="RestElement"&&this.checkPatternExport(e,t.argument)},k.checkVariableExport=function(e,t){if(e)for(var i=0,s=t;i<s.length;i+=1){var o=s[i];this.checkPatternExport(e,o.id)}},k.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},k.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")},k.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(a.braceL);!this.eat(a.braceR);){if(i)i=!1;else if(this.expect(a.comma),this.afterTrailingComma(a.braceR))break;t.push(this.parseExportSpecifier(e))}return t},k.parseImport=function(e){return this.next(),this.type===a.string?(e.specifiers=Jr,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===a.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},k.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,Re),this.finishNode(e,"ImportSpecifier")},k.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Re),this.finishNode(e,"ImportDefaultSpecifier")},k.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,Re),this.finishNode(e,"ImportNamespaceSpecifier")},k.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===a.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(a.comma)))return e;if(this.type===a.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(a.braceL);!this.eat(a.braceR);){if(t)t=!1;else if(this.expect(a.comma),this.afterTrailingComma(a.braceR))break;e.push(this.parseImportSpecifier())}return e},k.parseWithClause=function(){var e=[];if(!this.eat(a._with))return e;this.expect(a.braceL);for(var t={},i=!0;!this.eat(a.braceR);){if(i)i=!1;else if(this.expect(a.comma),this.afterTrailingComma(a.braceR))break;var s=this.parseImportAttribute(),o=s.key.type==="Identifier"?s.key.name:s.key.value;T(t,o)&&this.raiseRecoverable(s.key.start,"Duplicate attribute key '"+o+"'"),t[o]=!0,e.push(s)}return e},k.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===a.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(a.colon),this.type!==a.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},k.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===a.string){var e=this.parseLiteral(this.value);return Q.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},k.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},k.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var ye=Y.prototype;ye.toAssignable=function(e,t,i){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var s=0,o=e.properties;s<o.length;s+=1){var d=o[s];this.toAssignable(d,t),d.type==="RestElement"&&(d.argument.type==="ArrayPattern"||d.argument.type==="ObjectPattern")&&this.raise(d.argument.start,"Unexpected token")}break;case"Property":e.kind!=="init"&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",i&&this.checkPatternErrors(i,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),e.argument.type==="AssignmentPattern"&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":e.operator!=="="&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,i);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else i&&this.checkPatternErrors(i,!0);return e},ye.toAssignableList=function(e,t){for(var i=e.length,s=0;s<i;s++){var o=e[s];o&&this.toAssignable(o,t)}if(i){var d=e[i-1];this.options.ecmaVersion===6&&t&&d&&d.type==="RestElement"&&d.argument.type!=="Identifier"&&this.unexpected(d.argument.start)}return e},ye.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},ye.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==a.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},ye.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case a.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(a.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case a.braceL:return this.parseObj(!0)}return this.parseIdent()},ye.parseBindingList=function(e,t,i,s){for(var o=[],d=!0;!this.eat(e);)if(d?d=!1:this.expect(a.comma),t&&this.type===a.comma)o.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===a.ellipsis){var m=this.parseRestBinding();this.parseBindingListItem(m),o.push(m),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else o.push(this.parseAssignableListItem(s))}return o},ye.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},ye.parseBindingListItem=function(e){return e},ye.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(a.eq))return i;var s=this.startNodeAt(e,t);return s.left=i,s.right=this.parseMaybeAssign(),this.finishNode(s,"AssignmentPattern")},ye.checkLValSimple=function(e,t,i){t===void 0&&(t=dt);var s=t!==dt;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(s?"Binding ":"Assigning to ")+e.name+" in strict mode"),s&&(t===Re&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(T(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==wi&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":s&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return s&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(s?"Binding":"Assigning to")+" rvalue")}},ye.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=dt),e.type){case"ObjectPattern":for(var s=0,o=e.properties;s<o.length;s+=1){var d=o[s];this.checkLValInnerPattern(d,t,i)}break;case"ArrayPattern":for(var m=0,v=e.elements;m<v.length;m+=1){var y=v[m];y&&this.checkLValInnerPattern(y,t,i)}break;default:this.checkLValSimple(e,t,i)}},ye.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=dt),e.type){case"Property":this.checkLValInnerPattern(e.value,t,i);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,i);break;case"RestElement":this.checkLValPattern(e.argument,t,i);break;default:this.checkLValPattern(e,t,i)}};var be=function(t,i,s,o,d){this.token=t,this.isExpr=!!i,this.preserveSpace=!!s,this.override=o,this.generator=!!d},J={b_stat:new be("{",!1),b_expr:new be("{",!0),b_tmpl:new be("${",!1),p_stat:new be("(",!1),p_expr:new be("(",!0),q_tmpl:new be("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new be("function",!1),f_expr:new be("function",!0),f_expr_gen:new be("function",!0,!1,null,!0),f_gen:new be("function",!1,!1,null,!0)},We=Y.prototype;We.initialContext=function(){return[J.b_stat]},We.curContext=function(){return this.context[this.context.length-1]},We.braceIsBlock=function(e){var t=this.curContext();return t===J.f_expr||t===J.f_stat?!0:e===a.colon&&(t===J.b_stat||t===J.b_expr)?!t.isExpr:e===a._return||e===a.name&&this.exprAllowed?x.test(this.input.slice(this.lastTokEnd,this.start)):e===a._else||e===a.semi||e===a.eof||e===a.parenR||e===a.arrow?!0:e===a.braceL?t===J.b_stat:e===a._var||e===a._const||e===a.name?!1:!this.exprAllowed},We.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token==="function")return t.generator}return!1},We.updateContext=function(e){var t,i=this.type;i.keyword&&e===a.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr},We.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},a.parenR.updateContext=a.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===J.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},a.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?J.b_stat:J.b_expr),this.exprAllowed=!0},a.dollarBraceL.updateContext=function(){this.context.push(J.b_tmpl),this.exprAllowed=!0},a.parenL.updateContext=function(e){var t=e===a._if||e===a._for||e===a._with||e===a._while;this.context.push(t?J.p_stat:J.p_expr),this.exprAllowed=!0},a.incDec.updateContext=function(){},a._function.updateContext=a._class.updateContext=function(e){e.beforeExpr&&e!==a._else&&!(e===a.semi&&this.curContext()!==J.p_stat)&&!(e===a._return&&x.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===a.colon||e===a.braceL)&&this.curContext()===J.b_stat)?this.context.push(J.f_expr):this.context.push(J.f_stat),this.exprAllowed=!1},a.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},a.backQuote.updateContext=function(){this.curContext()===J.q_tmpl?this.context.pop():this.context.push(J.q_tmpl),this.exprAllowed=!1},a.star.updateContext=function(e){if(e===a._function){var t=this.context.length-1;this.context[t]===J.f_expr?this.context[t]=J.f_expr_gen:this.context[t]=J.f_gen}this.exprAllowed=!0},a.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==a.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var j=Y.prototype;j.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var s=e.key,o;switch(s.type){case"Identifier":o=s.name;break;case"Literal":o=String(s.value);break;default:return}var d=e.kind;if(this.options.ecmaVersion>=6){o==="__proto__"&&d==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=s.start):this.raiseRecoverable(s.start,"Redefinition of __proto__ property")),t.proto=!0);return}o="$"+o;var m=t[o];if(m){var v;d==="init"?v=this.strict&&m.init||m.get||m.set:v=m.init||m[d],v&&this.raiseRecoverable(s.start,"Redefinition of property")}else m=t[o]={init:!1,get:!1,set:!1};m[d]=!0}},j.parseExpression=function(e,t){var i=this;return this.catchStackOverflow(function(){var s=i.start,o=i.startLoc,d=i.parseMaybeAssign(e,t);if(i.type===a.comma){var m=i.startNodeAt(s,o);for(m.expressions=[d];i.eat(a.comma);)m.expressions.push(i.parseMaybeAssign(e,t));return i.finishNode(m,"SequenceExpression")}return d})},j.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var s=!1,o=-1,d=-1,m=-1;t?(o=t.parenthesizedAssign,d=t.trailingComma,m=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new mt,s=!0);var v=this.start,y=this.startLoc;(this.type===a.parenL||this.type===a.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var L=this.parseMaybeConditional(e,t);if(i&&(L=i.call(this,L,v,y)),this.type.isAssign){var M=this.startNodeAt(v,y);return M.operator=this.value,this.type===a.eq&&(L=this.toAssignable(L,!1,t)),s||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=L.start&&(t.shorthandAssign=-1),this.type===a.eq?this.checkLValPattern(L):this.checkLValSimple(L),M.left=L,this.next(),M.right=this.parseMaybeAssign(e),m>-1&&(t.doubleProto=m),this.finishNode(M,"AssignmentExpression")}else s&&this.checkExpressionErrors(t,!0);return o>-1&&(t.parenthesizedAssign=o),d>-1&&(t.trailingComma=d),L},j.parseMaybeConditional=function(e,t){var i=this.start,s=this.startLoc,o=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return o;if(!(o.type==="ArrowFunctionExpression"&&o.start===i)&&this.eat(a.question)){var d=this.startNodeAt(i,s);return d.test=o,d.consequent=this.parseMaybeAssign(),this.expect(a.colon),d.alternate=this.parseMaybeAssign(e),this.finishNode(d,"ConditionalExpression")}return o},j.parseExprOps=function(e,t){var i=this.start,s=this.startLoc,o=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||o.start===i&&o.type==="ArrowFunctionExpression"?o:this.parseExprOp(o,i,s,-1,e)},j.parseExprOp=function(e,t,i,s,o){var d=this.type.binop;if(d!=null&&(!o||this.type!==a._in)&&d>s){var m=this.type===a.logicalOR||this.type===a.logicalAND,v=this.type===a.coalesce;v&&(d=a.logicalAND.binop);var y=this.value;this.next();var L=this.start,M=this.startLoc,K=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,o),L,M,d,o),oe=this.buildBinary(t,i,e,K,y,m||v);return(m&&this.type===a.coalesce||v&&(this.type===a.logicalOR||this.type===a.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(oe,t,i,s,o)}return e},j.buildBinary=function(e,t,i,s,o,d){s.type==="PrivateIdentifier"&&this.raise(s.start,"Private identifier can only be left side of binary expression");var m=this.startNodeAt(e,t);return m.left=i,m.operator=o,m.right=s,this.finishNode(m,d?"LogicalExpression":"BinaryExpression")},j.parseMaybeUnary=function(e,t,i,s){var o=this.start,d=this.startLoc,m;if(this.isContextual("await")&&this.canAwait)m=this.parseAwait(s),t=!0;else if(this.type.prefix){var v=this.startNode(),y=this.type===a.incDec;v.operator=this.value,v.prefix=!0,this.next(),v.argument=this.parseMaybeUnary(null,!0,y,s),this.checkExpressionErrors(e,!0),y?this.checkLValSimple(v.argument):this.strict&&v.operator==="delete"&&ki(v.argument)?this.raiseRecoverable(v.start,"Deleting local variable in strict mode"):v.operator==="delete"&&Wt(v.argument)?this.raiseRecoverable(v.start,"Private fields can not be deleted"):t=!0,m=this.finishNode(v,y?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===a.privateId)(s||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),m=this.parsePrivateIdent(),this.type!==a._in&&this.unexpected();else{if(m=this.parseExprSubscripts(e,s),this.checkExpressionErrors(e))return m;for(;this.type.postfix&&!this.canInsertSemicolon();){var L=this.startNodeAt(o,d);L.operator=this.value,L.prefix=!1,L.argument=m,this.checkLValSimple(m),this.next(),m=this.finishNode(L,"UpdateExpression")}}if(!i&&this.eat(a.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(o,d,m,this.parseMaybeUnary(null,!1,!1,s),"**",!1);else return m};function ki(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&ki(e.expression)}function Wt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&Wt(e.expression)||e.type==="ParenthesizedExpression"&&Wt(e.expression)}j.parseExprSubscripts=function(e,t){var i=this.start,s=this.startLoc,o=this.parseExprAtom(e,t);if(o.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return o;var d=this.parseSubscripts(o,i,s,!1,t);return e&&d.type==="MemberExpression"&&(e.parenthesizedAssign>=d.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=d.start&&(e.parenthesizedBind=-1),e.trailingComma>=d.start&&(e.trailingComma=-1)),d},j.parseSubscripts=function(e,t,i,s,o){for(var d=this.options.ecmaVersion>=8&&e.type==="Identifier"&&e.name==="async"&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,m=!1;;){var v=this.parseSubscript(e,t,i,s,d,m,o);if(v.optional&&(m=!0),v===e||v.type==="ArrowFunctionExpression"){if(m){var y=this.startNodeAt(t,i);y.expression=v,v=this.finishNode(y,"ChainExpression")}return v}e=v}},j.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(a.arrow)},j.parseSubscriptAsyncArrow=function(e,t,i,s){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,s)},j.parseSubscript=function(e,t,i,s,o,d,m){var v=this.options.ecmaVersion>=11,y=v&&this.eat(a.questionDot);s&&y&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var L=this.eat(a.bracketL);if(L||y&&this.type!==a.parenL&&this.type!==a.backQuote||this.eat(a.dot)){var M=this.startNodeAt(t,i);M.object=e,L?(M.property=this.parseExpression(),this.expect(a.bracketR)):this.type===a.privateId&&e.type!=="Super"?M.property=this.parsePrivateIdent():M.property=this.parseIdent(this.options.allowReserved!=="never"),M.computed=!!L,v&&(M.optional=y),e=this.finishNode(M,"MemberExpression")}else if(!s&&this.eat(a.parenL)){var K=new mt,oe=this.yieldPos,rt=this.awaitPos,He=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var wt=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1,K);if(o&&!y&&this.shouldParseAsyncArrow())return this.checkPatternErrors(K,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=oe,this.awaitPos=rt,this.awaitIdentPos=He,this.parseSubscriptAsyncArrow(t,i,wt,m);this.checkExpressionErrors(K,!0),this.yieldPos=oe||this.yieldPos,this.awaitPos=rt||this.awaitPos,this.awaitIdentPos=He||this.awaitIdentPos;var ze=this.startNodeAt(t,i);ze.callee=e,ze.arguments=wt,v&&(ze.optional=y),e=this.finishNode(ze,"CallExpression")}else if(this.type===a.backQuote){(y||d)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var Ge=this.startNodeAt(t,i);Ge.tag=e,Ge.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(Ge,"TaggedTemplateExpression")}return e},j.parseExprAtom=function(e,t,i){this.type===a.slash&&this.readRegexp();var s,o=this.potentialArrowAt===this.start;switch(this.type){case a._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),s=this.startNode(),this.next(),this.type===a.parenL&&!this.allowDirectSuper&&this.raise(s.start,"super() call outside constructor of a subclass"),this.type!==a.dot&&this.type!==a.bracketL&&this.type!==a.parenL&&this.unexpected(),this.finishNode(s,"Super");case a._this:return s=this.startNode(),this.next(),this.finishNode(s,"ThisExpression");case a.name:var d=this.start,m=this.startLoc,v=this.containsEsc,y=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!v&&y.name==="async"&&!this.canInsertSemicolon()&&this.eat(a._function))return this.overrideContext(J.f_expr),this.parseFunction(this.startNodeAt(d,m),0,!1,!0,t);if(o&&!this.canInsertSemicolon()){if(this.eat(a.arrow))return this.parseArrowExpression(this.startNodeAt(d,m),[y],!1,t);if(this.options.ecmaVersion>=8&&y.name==="async"&&this.type===a.name&&!v&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return y=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(a.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(d,m),[y],!0,t)}return y;case a.regexp:var L=this.value;return s=this.parseLiteral(L.value),s.regex={pattern:L.pattern,flags:L.flags},s;case a.num:case a.string:return this.parseLiteral(this.value);case a._null:case a._true:case a._false:return s=this.startNode(),s.value=this.type===a._null?null:this.type===a._true,s.raw=this.type.keyword,this.next(),this.finishNode(s,"Literal");case a.parenL:var M=this.start,K=this.parseParenAndDistinguishExpression(o,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(K)&&(e.parenthesizedAssign=M),e.parenthesizedBind<0&&(e.parenthesizedBind=M)),K;case a.bracketL:return s=this.startNode(),this.next(),s.elements=this.parseExprList(a.bracketR,!0,!0,e),this.finishNode(s,"ArrayExpression");case a.braceL:return this.overrideContext(J.b_expr),this.parseObj(!1,e);case a._function:return s=this.startNode(),this.next(),this.parseFunction(s,0);case a._class:return this.parseClass(this.startNode(),!1);case a._new:return this.parseNew();case a.backQuote:return this.parseTemplate();case a._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}},j.parseExprAtomDefault=function(){this.unexpected()},j.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===a.parenL&&!e)return this.parseDynamicImport(t);if(this.type===a.dot){var i=this.startNodeAt(t.start,t.loc&&t.loc.start);return i.name="import",t.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(t)}else this.unexpected()},j.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(a.parenR)?e.options=null:(this.expect(a.comma),this.afterTrailingComma(a.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(a.parenR)||(this.expect(a.comma),this.afterTrailingComma(a.parenR)||this.unexpected())));else if(!this.eat(a.parenR)){var t=this.start;this.eat(a.comma)&&this.eat(a.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},j.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")},j.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value!=null?t.value.toString():t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")},j.parseParenExpression=function(){this.expect(a.parenL);var e=this.parseExpression();return this.expect(a.parenR),e},j.shouldParseArrow=function(e){return!this.canInsertSemicolon()},j.parseParenAndDistinguishExpression=function(e,t){var i=this.start,s=this.startLoc,o,d=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var m=this.start,v=this.startLoc,y=[],L=!0,M=!1,K=new mt,oe=this.yieldPos,rt=this.awaitPos,He;for(this.yieldPos=0,this.awaitPos=0;this.type!==a.parenR;)if(L?L=!1:this.expect(a.comma),d&&this.afterTrailingComma(a.parenR,!0)){M=!0;break}else if(this.type===a.ellipsis){He=this.start,y.push(this.parseParenItem(this.parseRestBinding())),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else y.push(this.parseMaybeAssign(!1,K,this.parseParenItem));var wt=this.lastTokEnd,ze=this.lastTokEndLoc;if(this.expect(a.parenR),e&&this.shouldParseArrow(y)&&this.eat(a.arrow))return this.checkPatternErrors(K,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=oe,this.awaitPos=rt,this.parseParenArrowList(i,s,y,t);(!y.length||M)&&this.unexpected(this.lastTokStart),He&&this.unexpected(He),this.checkExpressionErrors(K,!0),this.yieldPos=oe||this.yieldPos,this.awaitPos=rt||this.awaitPos,y.length>1?(o=this.startNodeAt(m,v),o.expressions=y,this.finishNodeAt(o,"SequenceExpression",wt,ze)):o=y[0]}else o=this.parseParenExpression();if(this.options.preserveParens){var Ge=this.startNodeAt(i,s);return Ge.expression=o,this.finishNode(Ge,"ParenthesizedExpression")}else return o},j.parseParenItem=function(e){return e},j.parseParenArrowList=function(e,t,i,s){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,s)};var Qr=[];j.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===a.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var s=this.start,o=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),s,o,!0,!1),e.callee.type==="Super"&&this.raiseRecoverable(s,"Invalid use of 'super'"),this.eat(a.parenL)?e.arguments=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Qr,this.finishNode(e,"NewExpression")},j.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===a.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,`
|
|
1
|
+
var As=Object.create;var Ct=Object.defineProperty;var _s=Object.getOwnPropertyDescriptor;var Es=Object.getOwnPropertyNames;var Ps=Object.getPrototypeOf,Rs=Object.prototype.hasOwnProperty;var Yi=(r,s)=>()=>(r&&(s=r(r=0)),s);var Ce=(r,s)=>()=>(s||r((s={exports:{}}).exports,s),s.exports),Kt=(r,s)=>{for(var c in s)Ct(r,c,{get:s[c],enumerable:!0})},Xi=(r,s,c,u)=>{if(s&&typeof s=="object"||typeof s=="function")for(let l of Es(s))!Rs.call(r,l)&&l!==c&&Ct(r,l,{get:()=>s[l],enumerable:!(u=_s(s,l))||u.enumerable});return r};var Ge=(r,s,c)=>(c=r!=null?As(Ps(r)):{},Xi(s||!r||!r.__esModule?Ct(c,"default",{value:r,enumerable:!0}):c,r)),nt=r=>Xi(Ct({},"__esModule",{value:!0}),r);var tr={};Kt(tr,{ProjectTargetError:()=>je,SUPPORTED_PROJECT_TARGETS:()=>Zi,assertMatchingProjectTargets:()=>er,defaultV4ProjectTarget:()=>Ts,parseProjectTarget:()=>xe,projectTargetKey:()=>Ne,registryRoute:()=>Os,resolveProjectTarget:()=>Ls});function Ne(r){return`${r.framework}/${r.primitive}`}function xe(r,s="Project target"){let c=r,u=typeof c?.framework=="string"?c.framework.trim().toLowerCase():"",l=typeof c?.primitive=="string"?c.primitive.trim().toLowerCase():"",p=`${u}/${l}`;if(!u||!l||!Ns.has(p))throw new je("INVALID_PROJECT_TARGET",`${s} must be exactly one of react/radix, react/base, react/aria, or vue/reka; received ${p}.`,{framework:u||null,primitive:l||null});return{framework:u,primitive:l}}function Ts(r="react"){return xe({framework:r,primitive:r==="vue"?"reka":"base"})}function er(r){let s=Object.entries(r).filter(([,l])=>l!=null).map(([l,p])=>[l,xe(p,l)]);if(s.length===0)throw new je("PROJECT_TARGET_REQUIRED","A persisted or configured Project target is required.");let c=Ne(s[0][1]);if(s.find(([,l])=>Ne(l)!==c))throw new je("PROJECT_TARGET_MISMATCH",`Project target mismatch: ${s.map(([l,p])=>`${l}=${Ne(p)}`).join(", ")}.`,{targets:Object.fromEntries(s)});return s[0][1]}function Ls({persisted:r,configured:s,app:c,release:u,lock:l,proposed:p}={}){let h={persisted:r,configured:s,app:c,release:u,lock:l};if(Object.values(h).some(f=>f!=null))return er(h);if(p)return xe(p,"migration proposal");throw new je("PROJECT_TARGET_REQUIRED","A Project target is required; package detection may only propose one during migration.")}function Os(r,s){throw xe(r),String(s||"").trim(),new je("CURRENT_ROUTE_RETIRED","Components resolve only from an authenticated immutable Design System Release.")}var Zi,Ns,je,It=Yi(()=>{Zi=Object.freeze([Object.freeze({framework:"react",primitive:"radix"}),Object.freeze({framework:"react",primitive:"base"}),Object.freeze({framework:"react",primitive:"aria"}),Object.freeze({framework:"vue",primitive:"reka"})]),Ns=new Set(Zi.map(r=>`${r.framework}/${r.primitive}`)),je=class extends Error{constructor(s,c,u={}){super(c),this.name="ProjectTargetError",this.code=s,Object.assign(this,u)}}});var ti=Ce((ia,or)=>{var Te=require("fs"),_e=require("path"),{createHash:nr}=require("crypto"),Fs=".frontfriend/design",Ds=".frontfriend/.gitignore";function Ms(){return["# Managed by `frontfriend design sync`.","# audit/ holds regenerable capture artifacts (screenshots, probes) \u2014 never commit.","# design/ is the committed read-only contract mirror \u2014 keep it tracked.","audit/","# design-working/ is an explicit, disposable working preview.","design-working/",""].join(`
|
|
2
|
+
`)}function ot(r){return typeof r!="string"||r.length===0||r.startsWith("/")||r.includes("\\")?!1:r.split("/").every(s=>s!==""&&s!=="."&&s!=="..")}function Xt(r){let s=r.body.endsWith(`
|
|
3
|
+
`)?r.body.slice(0,-1):r.body;return["<!-- frontfriend design mirror \u2014 DO NOT EDIT (overwritten by `frontfriend design sync`)",`slug: ${r.slug}`,`maturity: ${r.maturity}`,`implemented: ${r.implemented}`,`implementation: ${r.implementation||"unknown"}`,`version: ${r.version}`,"-->","",s,""].join(`
|
|
4
|
+
`)}function Zt(r){return[`# Frontfriend design mirror \u2014 ${r.name}`,"","This directory is a READ-ONLY mirror of the Design System design contracts",`(Design System "${r.name}", ff-id \`${r.ff_id}\`) managed on the Frontfriend platform.`,"","Every file here is overwritten by `frontfriend design sync`. Do not edit by","hand: local changes are discarded on the next sync, and files whose contract","was removed upstream are deleted. Edit contracts on the platform instead.",""].join(`
|
|
5
|
+
`)}function ar({design_system:r,contracts:s}){let c=[...s].filter(l=>ot(l.slug)).sort((l,p)=>l.kind.localeCompare(p.kind)||l.slug.localeCompare(p.slug)),u={"README.md":Zt(r)};for(let l of c)u[l.slug]=Xt(l);return u}function Yt(r,s){let c={};for(let[l,p]of Object.entries(r))s[l]!==p&&(c[l]=p);let u=Object.keys(s).filter(l=>!(l in r)).sort();return{writes:c,deletes:u}}var ei=r=>nr("sha256").update(r).digest("hex");function Bs(r){return Object.fromEntries(Object.entries(r).filter(([s])=>s!=="README.md"&&ot(s)).map(([s,c])=>[s,ei(c)]))}function $s(r,s){let c=()=>{throw new Error("Invalid or incomplete mirror response. No local files were changed; retry sync.")};(!r||typeof r.design_system?.ff_id!="string"||typeof r.design_system?.name!="string"||!Array.isArray(r.contracts))&&c();let u=new Map;for(let h of r.contracts)(!h||!ot(h.slug)||h.slug==="README.md"||typeof h.body!="string"||typeof h.kind!="string"||typeof h.maturity!="string"||typeof h.implemented!="boolean"||!Number.isSafeInteger(h.version)||h.version<1||u.has(h.slug))&&c(),u.set(h.slug,Xt(h));if(r.protocol===void 0)return r.manifest!==void 0&&c(),Yt(ar(r),s);(r.protocol!==1||!Array.isArray(r.manifest))&&c();let l={"README.md":Zt(r.design_system)},p=new Set;for(let h of r.manifest){(!h||!ot(h.slug)||h.slug==="README.md"||!/^[a-f0-9]{64}$/.test(h.hash)||p.has(h.slug))&&c(),p.add(h.slug);let f=u.get(h.slug)??s[h.slug];(typeof f!="string"||ei(f)!==h.hash)&&c(),Object.defineProperty(l,h.slug,{value:f,enumerable:!0})}return[...u.keys()].some(h=>!p.has(h))&&c(),Yt(l,s)}function Us(r){let s={};if(!Te.existsSync(r))return s;let c=u=>{for(let l of Te.readdirSync(u,{withFileTypes:!0})){let p=_e.join(u,l.name);if(l.isDirectory())c(p);else if(l.isFile()){let h=_e.relative(r,p).split(_e.sep).join("/");s[h]=Te.readFileSync(p,"utf8")}}};return c(r),s}function qs(r,s){for(let[c,u]of Object.entries(s.writes)){let l=_e.join(r,...c.split("/"));Te.mkdirSync(_e.dirname(l),{recursive:!0}),Te.writeFileSync(l,u)}for(let c of s.deletes){let u=_e.join(r,...c.split("/"));Te.rmSync(u,{force:!0});let l=_e.dirname(u),p=_e.resolve(r);for(;_e.resolve(l)!==p&&Te.existsSync(l)&&Te.readdirSync(l).length===0;)Te.rmdirSync(l),l=_e.dirname(l)}}function Ws(r,s,c){if(!s||r.contract_selection!==1||r.selection?.design_snapshot_id!==s.snapshotId||r.selection?.digest!==s.snapshotDigest||r.app?.id!==s.appId||r.design_system?.ff_id!==c)throw new Error("Contract mirror does not match the selected App snapshot.");let u=[...s.sharedContracts,...s.contracts],l=r.manifest??r.contracts,p=new Map(u.map(h=>[h.slug,h]));if(!Array.isArray(l)||!Array.isArray(r.contracts)||l.length!==u.length||new Set(l.map(h=>h.slug)).size!==u.length||l.some(h=>!p.has(h.slug)))throw new Error("Contract mirror inventory does not match the snapshot.");for(let h of r.contracts){let f=p.get(h.slug);if(!f||h.revision_id!==f.revisionId||h.digest!==f.digest||h.version!==f.version||h.kind!==f.kind)throw new Error("Contract body identity does not match its snapshot pin.");let m={appId:s.contracts.some(w=>w.slug===f.slug)?s.appId:null,body:h.body,designSystemId:s.designSystemId,kind:h.kind,maturity:h.maturity,slug:h.slug,title:h.title};if(nr("sha256").update(JSON.stringify(m)).digest("hex")!==f.digest)throw new Error("Contract content does not match its immutable digest.")}return u}or.exports={validatePinnedMirror:Ws,MIRROR_DIR:Fs,FRONTFRIEND_GITIGNORE_PATH:Ds,renderFrontfriendGitignore:Ms,isSafeSlug:ot,renderContractFile:Xt,renderMirrorReadme:Zt,buildMirrorTree:ar,planMirrorSync:Yt,hashMirrorFile:ei,knownMirrorHashes:Bs,planMirrorResponse:$s,readMirrorTree:Us,applyMirrorPlan:qs}});var si=Ce((oa,fr)=>{var ri=require("fs"),le=require("path");function ur(r,s="JSON"){let c="",u=0,l=r.charCodeAt(0)===65279?r.slice(1):r;for(;u<l.length;){let h=l[u];if(h==='"'){let f=u+1;for(;f<l.length&&l[f]!=='"';)f+=l[f]==="\\"?2:1;c+=l.slice(u,f+1),u=f+1}else if(h==="/"&&l[u+1]==="/")for(;u<l.length&&l[u]!==`
|
|
6
|
+
`;)u+=1;else if(h==="/"&&l[u+1]==="*"){let f=l.indexOf("*/",u+2);if(f===-1)throw new Error(`Cannot read ${s}: unterminated comment.`);c+=l.slice(u,f+2).replace(/[^\n]/g," "),u=f+2}else c+=h,u+=1}let p="";for(let h=0;h<c.length;h+=1){let f=c[h];if(f==='"'){let m=h+1;for(;m<c.length&&c[m]!=='"';)m+=c[m]==="\\"?2:1;p+=c.slice(h,m+1),h=m;continue}if(f===","){let m=h+1;for(;m<c.length&&/\s/.test(c[m]);)m+=1;if(c[m]==="}"||c[m]==="]")continue}p+=f}try{return p.trim()?JSON.parse(p):{}}catch(h){throw new Error(`Cannot read ${s}: ${h.message}`)}}function lr(r){return ur(ri.readFileSync(r,"utf8"),r)}var Pt=r=>{try{return ri.statSync(r).isFile()}catch{return!1}};function hr(r,s){if(typeof r!="string"||!r)throw new Error('tsconfig "extends" must be a non-empty string.');let c=u=>Pt(u)?u:!u.endsWith(".json")&&Pt(`${u}.json`)?`${u}.json`:null;if(r.startsWith(".")||le.isAbsolute(r)){let u=c(le.resolve(s,r));if(u)return u;throw new Error(`File '${r}' not found (tsconfig extends, from ${s}).`)}for(let u=s;;u=le.dirname(u)){let l=le.join(u,"node_modules",r),p=c(l);if(p)return p;let h=null;try{h=JSON.parse(ri.readFileSync(le.join(l,"package.json"),"utf8"))}catch{h=null}if(h&&typeof h.tsconfig=="string"&&Pt(le.join(l,h.tsconfig)))return le.join(l,h.tsconfig);if(Pt(le.join(l,"tsconfig.json")))return le.join(l,"tsconfig.json");if(le.dirname(u)===u)break}for(let u of[r,`${r}/tsconfig.json`,`${r}.json`])try{return require.resolve(u,{paths:[s]})}catch{}throw new Error(`File '${r}' not found (tsconfig extends, from ${s}).`)}function pr(r,s,c=new Set){let u=le.resolve(r);if(c.has(u))throw new Error(`Circularity detected while resolving configuration: ${u}`);let l=new Set(c).add(u),p=lr(u),h=le.dirname(u),f={},m=p.extends===void 0?[]:Array.isArray(p.extends)?p.extends:[p.extends];for(let I of m)f={...f,...pr(hr(I,h),s,l)};let x=p.compilerOptions&&typeof p.compilerOptions=="object"?p.compilerOptions:{},w=I=>typeof I=="string"?I.replace(/\$\{configDir\}/g,s):I;return typeof x.baseUrl=="string"&&(f.baseUrl=le.resolve(h,w(x.baseUrl))),x.paths&&typeof x.paths=="object"&&(f.paths=Object.fromEntries(Object.entries(x.paths).map(([I,_])=>[I,Array.isArray(_)?_.map(w):_])),f.pathsBasePath=h),f}function zs(r){let s=pr(r,le.dirname(le.resolve(r)));return s.paths?{base:s.baseUrl||s.pathsBasePath||le.dirname(r),paths:s.paths}:null}fr.exports={parseJsonc:ur,readJsonc:lr,resolveExtends:hr,readConfigPaths:zs}});var Nt={};Kt(Nt,{materializeInstallationPath:()=>ai,readProjectPaths:()=>mr,resolveCanonicalUiDirectory:()=>gr,resolveConfiguredAlias:()=>Rt});function dr(r){try{return JSON.parse(Je.default.readFileSync(r,"utf8"))}catch{return null}}function mr(r){for(let s of["tsconfig.json","tsconfig.app.json","jsconfig.json"]){let c=he.default.join(r,s);if(!Je.default.existsSync(c))continue;let u=Gs(c);if(u)return u}return{base:r,paths:{"@/*":[Je.default.existsSync(he.default.join(r,"src"))?"src/*":"*"]}}}function Rt(r,s,c=mr(r)){for(let[u,l]of Object.entries(c.paths)){if(!Array.isArray(l)||typeof l[0]!="string")continue;let[p,h=""]=u.split("*");if(!s.startsWith(p)||!s.endsWith(h)||!u.includes("*")&&s!==u)continue;let f=s.slice(p.length,h?-h.length:void 0);return he.default.resolve(c.base,l[0].replace("*",f))}return s.startsWith("@/")?he.default.resolve(r,Je.default.existsSync(he.default.join(r,"src"))?"src":".",s.slice(2)):he.default.resolve(r,s)}function ni(r,s){let c=he.default.relative(r,s).replace(/\\/g,"/");if(!c||c===".."||c.startsWith("../")||he.default.posix.isAbsolute(c))throw new Error("The canonical ui alias must stay inside the Application root.");return c}function gr(r,s){if(s)return ni(r,Rt(r,s));let u=dr(he.default.join(r,"components.json"))?.aliases?.ui;return typeof u=="string"&&u?ni(r,Rt(r,u)):Je.default.existsSync(he.default.join(r,"src"))?"src/components/ui":"components/ui"}function ai(r){if(r.installationLayout==="shadcn"&&/^(?:lib|hooks|components)\//.test(r.path)){let u=dr(he.default.join(r.root,"components.json"))?.aliases||{},l=/^lib\/utils\.[^.]+$/.test(r.path),p=r.path.split("/")[0],h=l&&u.utils?u.utils:u[p]||`@/${p}`,f=Rt(r.root,h);return ni(r.root,l&&u.utils?f+he.default.extname(r.path):he.default.join(f,r.path.slice(p.length+1)))}if(r.source!=="canonical"&&r.installationLayout!=="shadcn"||!r.path.startsWith("ui/"))return r.path;let s=r.path.slice(3);return he.default.posix.join(gr(r.root,r.configuredUiPath),s)}var Je,he,Gs,ct=Yi(()=>{Je=Ge(require("node:fs")),he=Ge(require("node:path")),{readConfigPaths:Gs}=si()});var xr=Ce((ua,Qs)=>{Qs.exports={name:"@frontfriend/sdk",version:"1.2.2"}});var br=Ce((la,yr)=>{var{name:Ys}=xr();yr.exports={PACKAGE_NAME:Ys}});var ci=Ce((ha,Sr)=>{var{PACKAGE_NAME:Tt}=br(),Le=require("fs"),Xs=require("http"),Zs=require("https"),ge=require("path"),Lt=["contracts","tokens","components"],en=["app/globals.css","src/app/globals.css","styles/globals.css","src/styles/globals.css","src/styles.css","src/index.css","src/style.css"],tn={next:["next.config.js","next.config.mjs","next.config.ts"],vite:["vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"]},rn=["primereact","@mui/material","antd","@chakra-ui/react","@mantine/core","@fluentui/react"],sn=["style-dictionary","@tokens-studio/sd-transforms","@vanilla-extract/css","styled-components","@emotion/react"];function wr(r){try{return JSON.parse(Le.readFileSync(r,"utf8"))}catch{return{}}}function oi(r){if(r===void 0)return null;if(!Array.isArray(r)){let u=new Error("`adopt` in frontfriend.config.js must be an array.");throw u.code="FRONTFRIEND_CONFIG_VALIDATION",u}let s=r.filter(u=>!Lt.includes(u));if(s.length>0){let u=new Error(`Unknown Frontfriend adoption level: ${s.join(", ")}.`);throw u.code="FRONTFRIEND_CONFIG_VALIDATION",u}let c=r.includes("components")?2:r.includes("tokens")?1:0;return Lt.slice(0,c+1)}function nn(r){for(let[s,c]of Object.entries(tn)){let u=c.find(p=>Le.existsSync(ge.join(r,p)));if(!u)continue;let l=Le.readFileSync(ge.join(r,u),"utf8");return{buildTool:s,present:l.includes(`${Tt}/${s}`)}}return{buildTool:null,present:!1}}function an(r){let s=[ge.join(r,"components","ui"),ge.join(r,"src","components","ui"),ge.join(r,"app","components","ui")].filter(l=>Le.existsSync(l)),c=new Set;function u(l){for(let p of Le.readdirSync(l,{withFileTypes:!0})){let h=ge.join(l,p.name);if(p.isDirectory())u(h);else if(/\.(js|jsx|ts|tsx|vue)$/.test(p.name)){if(!Le.readFileSync(h,"utf8").includes(Tt))continue;let m=ge.basename(p.name,ge.extname(p.name));c.add(m.toLowerCase()==="index"?ge.basename(l):m.toLowerCase())}}}return s.forEach(u),[...c].sort()}function on(r){let s=wr(ge.join(r,"package.json")),c={...s.dependencies||{},...s.devDependencies||{}},u=c.tailwindcss||null,p=[wr(ge.join(r,"components.json"))?.tailwind?.css,...en].filter(Boolean).find(m=>Le.existsSync(ge.join(r,m))),h=p?Le.readFileSync(ge.join(r,p),"utf8"):"",f=sn.filter(m=>c[m]);return!f.length&&/:root[\s\S]*--(?:color|spacing|font|radius)-[\w-]+\s*:/.test(h)&&!h.includes(`${Tt}/theme.css`)&&f.push("css-custom-properties"),{nativeTokens:{present:h.includes("/* Frontfriend managed native tokens: start */"),file:p||null},tailwind:{present:!!u,version:u,major:u&&Number((String(u).match(/\d+/)||[])[0])||null},componentsJson:Le.existsSync(ge.join(r,"components.json")),themeImport:{present:h.includes(`${Tt}/theme.css`)||/@import\s+["'][^"']*node_modules\/\.cache\/frontfriend\/theme\.css["']/.test(h),file:p||null},plugin:nn(r),frontfriendComponents:an(r),foreignComponentLibraries:rn.filter(m=>c[m]),foreignTokenSystems:f}}function cn(r,s){let c=oi(r)||Lt,u=c.includes("tokens"),l=c.includes("components"),p=[];return u&&!s.themeImport.present&&!s.nativeTokens?.present&&p.push("Config adopts tokens, but the Frontfriend theme import was not observed."),!u&&s.themeImport.present&&p.push("Frontfriend tokens are present in CSS but are not adopted in config."),l&&!s.componentsJson&&p.push("Config adopts components, but components.json was not observed."),!l&&s.frontfriendComponents.length>0&&p.push("Frontfriend components are installed but are not adopted in config."),p}function un({apiUrl:r,token:s,ffId:c,name:u,adopt:l,observed:p,framework:h,primitive:f}){if(!r||!s||!c||!u||!h||f===void 0)return Promise.resolve({reported:!1,unavailable:!0});let m=new URL("/api/apps/sync",r),x=JSON.stringify({ffId:c,name:u,adopt:oi(l),observed:p,runtime:"sdk",framework:h,primitive:f}),w=m.protocol==="https:"?Zs:Xs;return new Promise(I=>{let _=w.request(m,{method:"POST",headers:{authorization:`Bearer ${s}`,"content-type":"application/json","content-length":Buffer.byteLength(x)}},M=>{M.resume(),M.on("end",()=>{M.statusCode>=200&&M.statusCode<300?I({reported:!0,unavailable:!1}):I({reported:!1,unavailable:!0})})});_.on("error",()=>I({reported:!1,unavailable:!0})),_.setTimeout(1500,()=>{_.destroy(),I({reported:!1,unavailable:!0})}),_.end(x)})}Sr.exports={ADOPTION_LEVELS:Lt,normalizeAdopt:oi,probeAdoption:on,adoptionWarnings:cn,reportAdoption:un}});var Cr=Ce((Ot,kr)=>{(function(r,s){typeof Ot=="object"&&typeof kr<"u"?s(Ot):typeof define=="function"&&define.amd?define(["exports"],s):(r=typeof globalThis<"u"?globalThis:r||self,s(r.acorn={}))})(Ot,function(r){"use strict";var s=[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],c=[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],u="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",l="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",p={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"},h="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",f={5:h,"5module":h+" export import",6:h+" const class extends export import super"},m=/^in(stanceof)?$/,x=new RegExp("["+l+"]"),w=new RegExp("["+l+u+"]");function I(e,t){for(var i=65536,n=0;n<t.length;n+=2){if(i+=t[n],i>e)return!1;if(i+=t[n+1],i>=e)return!0}return!1}function _(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&x.test(String.fromCharCode(e)):t===!1?!1:I(e,c)}function M(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&w.test(String.fromCharCode(e)):t===!1?!1:I(e,c)||I(e,s)}var S=function(t,i){i===void 0&&(i={}),this.label=t,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function T(e,t){return new S(e,{beforeExpr:!0,binop:t})}var P={beforeExpr:!0},B={startsExpr:!0},re={};function R(e,t){return t===void 0&&(t={}),t.keyword=e,re[e]=new S(e,t)}var a={num:new S("num",B),regexp:new S("regexp",B),string:new S("string",B),name:new S("name",B),privateId:new S("privateId",B),eof:new S("eof"),bracketL:new S("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new S("]"),braceL:new S("{",{beforeExpr:!0,startsExpr:!0}),braceR:new S("}"),parenL:new S("(",{beforeExpr:!0,startsExpr:!0}),parenR:new S(")"),comma:new S(",",P),semi:new S(";",P),colon:new S(":",P),dot:new S("."),question:new S("?",P),questionDot:new S("?."),arrow:new S("=>",P),template:new S("template"),invalidTemplate:new S("invalidTemplate"),ellipsis:new S("...",P),backQuote:new S("`",B),dollarBraceL:new S("${",{beforeExpr:!0,startsExpr:!0}),eq:new S("=",{beforeExpr:!0,isAssign:!0}),assign:new S("_=",{beforeExpr:!0,isAssign:!0}),incDec:new S("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new S("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:T("||",1),logicalAND:T("&&",2),bitwiseOR:T("|",3),bitwiseXOR:T("^",4),bitwiseAND:T("&",5),equality:T("==/!=/===/!==",6),relational:T("</>/<=/>=",7),bitShift:T("<</>>/>>>",8),plusMin:new S("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:T("%",10),star:T("*",10),slash:T("/",10),starstar:new S("**",{beforeExpr:!0}),coalesce:T("??",1),_break:R("break"),_case:R("case",P),_catch:R("catch"),_continue:R("continue"),_debugger:R("debugger"),_default:R("default",P),_do:R("do",{isLoop:!0,beforeExpr:!0}),_else:R("else",P),_finally:R("finally"),_for:R("for",{isLoop:!0}),_function:R("function",B),_if:R("if"),_return:R("return",P),_switch:R("switch"),_throw:R("throw",P),_try:R("try"),_var:R("var"),_const:R("const"),_while:R("while",{isLoop:!0}),_with:R("with"),_new:R("new",{beforeExpr:!0,startsExpr:!0}),_this:R("this",B),_super:R("super",B),_class:R("class",B),_extends:R("extends",P),_export:R("export"),_import:R("import",B),_null:R("null",B),_true:R("true",B),_false:R("false",B),_in:R("in",{beforeExpr:!0,binop:7}),_instanceof:R("instanceof",{beforeExpr:!0,binop:7}),_typeof:R("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:R("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:R("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},b=/\r\n?|\n|\u2028|\u2029/,F=new RegExp(b.source,"g");function j(e){return e===10||e===13||e===8232||e===8233}function $(e,t,i){i===void 0&&(i=e.length);for(var n=t;n<i;n++){var o=e.charCodeAt(n);if(j(o))return n<i-1&&o===13&&e.charCodeAt(n+1)===10?n+2:n+1}return-1}var te=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,z=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ie=Object.prototype,ft=ie.hasOwnProperty,Ye=ie.toString,X=Object.hasOwn||function(e,t){return ft.call(e,t)},A=Array.isArray||function(e){return Ye.call(e)==="[object Array]"},q=Object.create(null);function J(e){return q[e]||(q[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function se(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var $e=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,W=function(t,i){this.line=t,this.column=i};W.prototype.offset=function(t){return new W(this.line,this.column+t)};var G=function(t,i,n){this.start=i,this.end=n,t.sourceFile!==null&&(this.source=t.sourceFile)};function H(e,t){for(var i=1,n=0;;){var o=$(e,n,t);if(o<0)return new W(i,t-n);++i,n=o}}var ae={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,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},ve=!1;function Xe(e){var t={};for(var i in ae)t[i]=e&&X(e,i)?e[i]:ae[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!ve&&typeof console=="object"&&console.warn&&(ve=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
7
|
+
Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),A(t.onToken)){var n=t.onToken;t.onToken=function(o){return n.push(o)}}if(A(t.onComment)&&(t.onComment=Ze(t,t.onComment)),t.sourceType==="commonjs"&&t.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return t}function Ze(e,t){return function(i,n,o,d,g,v){var y={type:i?"Block":"Line",value:n,start:o,end:d};e.locations&&(y.loc=new G(this,g,v)),e.ranges&&(y.range=[o,d]),t.push(y)}}var ne=1,Ie=2,ye=4,Ue=8,de=16,oe=32,Me=64,dt=128,Be=256,et=512,wi=1024,mt=ne|Ie|Be;function qt(e,t){return Ie|(e?ye:0)|(t?Ue:0)}var gt=0,Wt=1,Pe=2,Si=3,ki=4,Ci=5,Z=function(t,i,n){this.options=t=Xe(t),this.sourceFile=t.sourceFile,this.keywords=J(f[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var o="";t.allowReserved!==!0&&(o=p[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(o+=" await")),this.reservedWords=J(o);var d=(o?o+" ":"")+p.strict;this.reservedWordsStrict=J(d),this.reservedWordsStrictBind=J(d+" "+p.strictBind),this.input=String(i),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
|
|
8
|
+
`,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(b).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=a.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=t.sourceType==="module",this.strict=this.inModule||t.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&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?Ie:ne),this.regexpState=null,this.privateNameStack=[]},be={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}};Z.prototype.parse=function(){var t=this,i=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return t.parseTopLevel(i)})},be.inFunction.get=function(){return(this.currentVarScope().flags&Ie)>0},be.inGenerator.get=function(){return(this.currentVarScope().flags&Ue)>0},be.inAsync.get=function(){return(this.currentVarScope().flags&ye)>0},be.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(Be|et))return!1;if(i&Ie)return(i&ye)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},be.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&ne)},be.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags;return(t&Me)>0||this.options.allowSuperOutsideMethod},be.allowDirectSuper.get=function(){return(this.currentThisScope().flags&dt)>0},be.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},be.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(Be|et)||i&Ie&&!(i&de))return!0}return!1},be.allowUsing.get=function(){var e=this.currentScope(),t=e.flags;return!(t&wi||!this.inModule&&t&ne)},be.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Be)>0},Z.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var n=this,o=0;o<t.length;o++)n=t[o](n);return n},Z.parse=function(t,i){return new this(i,t).parse()},Z.parseExpressionAt=function(t,i,n){var o=new this(n,t,i);return o.nextToken(),o.parseExpression()},Z.tokenizer=function(t,i){return new this(i,t)},Object.defineProperties(Z.prototype,be);var ce=Z.prototype,Yr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;ce.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){z.lastIndex=e,e+=z.exec(this.input)[0].length;var t=Yr.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){z.lastIndex=e+t[0].length;var i=z.exec(this.input),n=i.index+i[0].length,o=this.input.charAt(n);return o===";"||o==="}"||b.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(o)||o==="!"&&this.input.charAt(n+1)==="=")}e+=t[0].length,z.lastIndex=e,e+=z.exec(this.input)[0].length,this.input[e]===";"&&e++}},ce.eat=function(e){return this.type===e?(this.next(),!0):!1},ce.isContextual=function(e){return this.type===a.name&&this.value===e&&!this.containsEsc},ce.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},ce.catchStackOverflow=function(e){try{return e()}catch(t){if(t instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(t.message)||/\btoo much recursion\b/i.test(t.message)))this.raise(this.start,"Not enough stack space to parse input");else throw t}},ce.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},ce.canInsertSemicolon=function(){return this.type===a.eof||this.type===a.braceR||b.test(this.input.slice(this.lastTokEnd,this.start))},ce.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},ce.semicolon=function(){!this.eat(a.semi)&&!this.insertSemicolon()&&this.unexpected()},ce.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},ce.expect=function(e){this.eat(e)||this.unexpected()},ce.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var vt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ce.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}},ce.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,n=e.doubleProto;if(!t)return i>=0||n>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),n>=0&&this.raiseRecoverable(n,"Redefinition of __proto__ property")},ce.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},ce.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var C=Z.prototype;C.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==a.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var n=0,o=Object.keys(this.undefinedExports);n<o.length;n+=1){var d=o[n];this.raiseRecoverable(this.undefinedExports[d].start,"Export '"+d+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(e,"Program")};var Ht={kind:"loop"},Xr={kind:"switch"};C.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;z.lastIndex=this.pos;var t=z.exec(this.input),i=this.pos+t[0].length,n=this.fullCharCodeAt(i);if(n===91||n===92)return!0;if(e)return!1;if(n===123)return!0;if(_(n)){var o=i;do i+=n<=65535?1:2;while(M(n=this.fullCharCodeAt(i)));if(n===92)return!0;var d=this.input.slice(o,i);if(!m.test(d))return!0}return!1},C.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;z.lastIndex=this.pos;var e=z.exec(this.input),t=this.pos+e[0].length,i;return!b.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(M(i=this.fullCharCodeAt(t+8))||i===92))},C.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return!1;z.lastIndex=this.pos;var i=z.exec(this.input),n=this.pos+i[0].length;if(b.test(this.input.slice(this.pos,n)))return!1;if(e){var o=n+5,d;if(this.input.slice(n,o)!=="using"||o===this.input.length||M(d=this.fullCharCodeAt(o))||d===92)return!1;z.lastIndex=o;var g=z.exec(this.input);if(n=o+g[0].length,g&&b.test(this.input.slice(o,n)))return!1}var v=this.fullCharCodeAt(n);if(!_(v)&&v!==92)return!1;var y=n;do n+=v<=65535?1:2;while(M(v=this.fullCharCodeAt(n)));if(v===92)return!0;var N=this.input.slice(y,n);if(m.test(N))return!1;if(t&&!e&&N==="of"){z.lastIndex=n;var D=z.exec(this.input);if(n=n+D[0].length,this.input.charCodeAt(n)!==61||(v=this.input.charCodeAt(n+1))===61||v===62)return!1}return!0},C.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},C.isUsing=function(e){return this.isUsingKeyword(!1,e)},C.parseStatement=function(e,t,i){var n=this.type,o=this.startNode(),d;switch(this.isLet(e)&&(n=a._var,d="let"),n){case a._break:case a._continue:return this.parseBreakContinueStatement(o,n.keyword);case a._debugger:return this.parseDebuggerStatement(o);case a._do:return this.parseDoStatement(o);case a._for:return this.parseForStatement(o);case a._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(o,!1,!e);case a._class:return e&&this.unexpected(),this.parseClass(o,!0);case a._if:return this.parseIfStatement(o);case a._return:return this.parseReturnStatement(o);case a._switch:return this.parseSwitchStatement(o);case a._throw:return this.parseThrowStatement(o);case a._try:return this.parseTryStatement(o);case a._const:case a._var:return d=d||this.value,e&&d!=="var"&&this.unexpected(),this.parseVarStatement(o,d);case a._while:return this.parseWhileStatement(o);case a._with:return this.parseWithStatement(o);case a.braceL:return this.parseBlock(!0,o);case a.semi:return this.parseEmptyStatement(o);case a._export:case a._import:if(this.options.ecmaVersion>10&&n===a._import){z.lastIndex=this.pos;var g=z.exec(this.input),v=this.pos+g[0].length,y=this.input.charCodeAt(v);if(y===40||y===46)return this.parseExpressionStatement(o,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),n===a._import?this.parseImport(o):this.parseExport(o,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(o,!0,!e);var N=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(N)return 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"),e&&this.raise(this.start,"Using declaration is not allowed in single-statement positions"),N==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(o,!1,N),this.semicolon(),this.finishNode(o,"VariableDeclaration");var D=this.value,Y=this.parseExpression();return n===a.name&&Y.type==="Identifier"&&this.eat(a.colon)?this.parseLabeledStatement(o,D,Y,e):this.parseExpressionStatement(o,Y)}},C.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(a.semi)||this.insertSemicolon()?e.label=null:this.type!==a.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var n=0;n<this.labels.length;++n){var o=this.labels[n];if((e.label==null||o.name===e.label.name)&&(o.kind!=null&&(i||o.kind==="loop")||e.label&&i))break}return n===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")},C.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},C.parseDoStatement=function(e){return this.next(),this.labels.push(Ht),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(a._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(a.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},C.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Ht),this.enterScope(0),this.expect(a.parenL),this.type===a.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===a._var||this.type===a._const||i){var n=this.startNode(),o=i?"let":this.value;return this.next(),this.parseVar(n,!0,o),this.finishNode(n,"VariableDeclaration"),this.parseForAfterInit(e,n,t)}var d=this.isContextual("let"),g=!1,v=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(v){var y=this.startNode();return this.next(),v==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(y,!0,v),this.finishNode(y,"VariableDeclaration"),this.parseForAfterInit(e,y,t)}var N=this.containsEsc,D=new vt,Y=this.start,ue=t>-1?this.parseExprSubscripts(D,"await"):this.parseExpression(!0,D);return this.type===a._in||(g=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===a._in&&this.unexpected(t),e.await=!0):g&&this.options.ecmaVersion>=8&&(ue.start===Y&&!N&&ue.type==="Identifier"&&ue.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),d&&g&&this.raise(ue.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(ue,!1,D),this.checkLValPattern(ue),this.parseForIn(e,ue)):(this.checkExpressionErrors(D,!0),t>-1&&this.unexpected(t),this.parseFor(e,ue))},C.parseForAfterInit=function(e,t,i){return(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&t.declarations.length===1?(this.type===a._in?((t.kind==="using"||t.kind==="await using")&&!t.declarations[0].init&&this.raise(this.start,"Using declaration is not allowed in for-in loops"),this.options.ecmaVersion>=9&&i>-1&&this.unexpected(i)):this.options.ecmaVersion>=9&&(e.await=i>-1),this.parseForIn(e,t)):(i>-1&&this.unexpected(i),this.parseFor(e,t))},C.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,tt|(i?0:zt),!1,t)},C.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(a._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},C.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(a.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},C.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(a.braceL),this.labels.push(Xr),this.enterScope(wi);for(var t,i=!1;this.type!==a.braceR;)if(this.type===a._case||this.type===a._default){var n=this.type===a._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),n?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(a.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},C.parseThrowStatement=function(e){return this.next(),b.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Zr=[];C.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?oe:0),this.checkLValPattern(e,t?ki:Pe),this.expect(a.parenR),e},C.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===a._catch){var t=this.startNode();this.next(),this.eat(a.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(a._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},C.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")},C.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Ht),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},C.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")},C.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},C.parseLabeledStatement=function(e,t,i,n){for(var o=0,d=this.labels;o<d.length;o+=1){var g=d[o];g.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var v=this.type.isLoop?"loop":this.type===a._switch?"switch":null,y=this.labels.length-1;y>=0;y--){var N=this.labels[y];if(N.statementStart===e.start)N.statementStart=this.start,N.kind=v;else break}return this.labels.push({name:t,kind:v,statementStart:this.start}),e.body=this.parseStatement(n?n.indexOf("label")===-1?n+"label":n:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")},C.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},C.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(a.braceL),e&&this.enterScope(0);this.type!==a.braceR;){var n=this.parseStatement(null);t.body.push(n)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},C.parseFor=function(e,t){return e.init=t,this.expect(a.semi),e.test=this.type===a.semi?null:this.parseExpression(),this.expect(a.semi),e.update=this.type===a.parenR?null:this.parseExpression(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},C.parseForIn=function(e,t){var i=this.type===a._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")},C.parseVar=function(e,t,i,n){for(e.declarations=[],e.kind=i;;){var o=this.startNode();if(this.parseVarId(o,i),this.eat(a.eq)?o.init=this.parseMaybeAssign(t):!n&&i==="const"&&!(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!n&&(i==="using"||i==="await using")&&this.options.ecmaVersion>=17&&this.type!==a._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+i+" declaration"):!n&&o.id.type!=="Identifier"&&!(t&&(this.type===a._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):o.init=null,e.declarations.push(this.finishNode(o,"VariableDeclarator")),!this.eat(a.comma))break}return e},C.parseVarId=function(e,t){e.id=t==="using"||t==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?Wt:Pe,!1)};var tt=1,zt=2,Ii=4;C.parseFunction=function(e,t,i,n,o){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!n)&&(this.type===a.star&&t&zt&&this.unexpected(),e.generator=this.eat(a.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&tt&&(e.id=t&Ii&&this.type!==a.name?null:this.parseIdent(),e.id&&!(t&zt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Wt:Pe:Si));var d=this.yieldPos,g=this.awaitPos,v=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(qt(e.async,e.generator)),t&tt||(e.id=this.type===a.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,o),this.yieldPos=d,this.awaitPos=g,this.awaitIdentPos=v,this.finishNode(e,t&tt?"FunctionDeclaration":"FunctionExpression")},C.parseFunctionParams=function(e){this.expect(a.parenL),e.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},C.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var n=this.enterClassBody(),o=this.startNode(),d=!1;for(o.body=[],this.expect(a.braceL);this.type!==a.braceR;){var g=this.parseClassElement(e.superClass!==null);g&&(o.body.push(g),g.type==="MethodDefinition"&&g.kind==="constructor"?(d&&this.raiseRecoverable(g.start,"Duplicate constructor in the same class"),d=!0):g.key&&g.key.type==="PrivateIdentifier"&&es(n,g)&&this.raiseRecoverable(g.key.start,"Identifier '#"+g.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(o,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},C.parseClassElement=function(e){if(this.eat(a.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),n="",o=!1,d=!1,g="method",v=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(a.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===a.star?v=!0:n="static"}if(i.static=v,!n&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===a.star)&&!this.canInsertSemicolon()?d=!0:n="async"),!n&&(t>=9||!d)&&this.eat(a.star)&&(o=!0),!n&&!d&&!o){var y=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?g=y:n=y)}if(n?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=n,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===a.parenL||g!=="method"||o||d){var N=!i.static&&xt(i,"constructor"),D=N&&e;N&&g!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=N?"constructor":g,this.parseClassMethod(i,o,d,D)}else this.parseClassField(i);return i},C.isClassElementNameStart=function(){return this.type===a.name||this.type===a.privateId||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword},C.parseClassElementName=function(e){this.type===a.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},C.parseClassMethod=function(e,t,i,n){var o=e.key;e.kind==="constructor"?(t&&this.raise(o.start,"Constructor can't be a generator"),i&&this.raise(o.start,"Constructor can't be an async method")):e.static&&xt(e,"prototype")&&this.raise(o.start,"Classes may not have a static property named prototype");var d=e.value=this.parseMethod(t,i,n);return e.kind==="get"&&d.params.length!==0&&this.raiseRecoverable(d.start,"getter should have no params"),e.kind==="set"&&d.params.length!==1&&this.raiseRecoverable(d.start,"setter should have exactly one param"),e.kind==="set"&&d.params[0].type==="RestElement"&&this.raiseRecoverable(d.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},C.parseClassField=function(e){return xt(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&xt(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(a.eq)?(this.enterScope(et|Me),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")},C.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(Be|Me);this.type!==a.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},C.parseClassId=function(e,t){this.type===a.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Pe,!1)):(t===!0&&this.unexpected(),e.id=null)},C.parseClassSuper=function(e){e.superClass=this.eat(a._extends)?this.parseExprSubscripts(null,!1):null},C.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},C.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var n=this.privateNameStack.length,o=n===0?null:this.privateNameStack[n-1],d=0;d<i.length;++d){var g=i[d];X(t,g.name)||(o?o.used.push(g):this.raiseRecoverable(g.start,"Private field '#"+g.name+"' must be declared in an enclosing class"))}};function es(e,t){var i=t.key.name,n=e[i],o="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(o=(t.static?"s":"i")+t.kind),n==="iget"&&o==="iset"||n==="iset"&&o==="iget"||n==="sget"&&o==="sset"||n==="sset"&&o==="sget"?(e[i]="true",!1):n?!0:(e[i]=o,!1)}function xt(e,t){var i=e.computed,n=e.key;return!i&&(n.type==="Identifier"&&n.name===t||n.type==="Literal"&&n.value===t)}C.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==a.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},C.parseExport=function(e,t){if(this.next(),this.eat(a.star))return this.parseExportAllDeclaration(e,t);if(this.eat(a._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==a.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var i=0,n=e.specifiers;i<n.length;i+=1){var o=n[i];this.checkUnreserved(o.local),this.checkLocalExport(o.local),o.local.type==="Literal"&&this.raise(o.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},C.parseExportDeclaration=function(e){return this.parseStatement(null)},C.parseExportDefaultDeclaration=function(){var e;if(this.type===a._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,tt|Ii,!1,e)}else if(this.type===a._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var n=this.parseMaybeAssign();return this.semicolon(),n}},C.checkExport=function(e,t,i){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),X(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)},C.checkPatternExport=function(e,t){var i=t.type;if(i==="Identifier")this.checkExport(e,t,t.start);else if(i==="ObjectPattern")for(var n=0,o=t.properties;n<o.length;n+=1){var d=o[n];this.checkPatternExport(e,d)}else if(i==="ArrayPattern")for(var g=0,v=t.elements;g<v.length;g+=1){var y=v[g];y&&this.checkPatternExport(e,y)}else i==="Property"?this.checkPatternExport(e,t.value):i==="AssignmentPattern"?this.checkPatternExport(e,t.left):i==="RestElement"&&this.checkPatternExport(e,t.argument)},C.checkVariableExport=function(e,t){if(e)for(var i=0,n=t;i<n.length;i+=1){var o=n[i];this.checkPatternExport(e,o.id)}},C.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},C.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")},C.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(a.braceL);!this.eat(a.braceR);){if(i)i=!1;else if(this.expect(a.comma),this.afterTrailingComma(a.braceR))break;t.push(this.parseExportSpecifier(e))}return t},C.parseImport=function(e){return this.next(),this.type===a.string?(e.specifiers=Zr,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===a.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},C.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,Pe),this.finishNode(e,"ImportSpecifier")},C.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Pe),this.finishNode(e,"ImportDefaultSpecifier")},C.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,Pe),this.finishNode(e,"ImportNamespaceSpecifier")},C.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===a.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(a.comma)))return e;if(this.type===a.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(a.braceL);!this.eat(a.braceR);){if(t)t=!1;else if(this.expect(a.comma),this.afterTrailingComma(a.braceR))break;e.push(this.parseImportSpecifier())}return e},C.parseWithClause=function(){var e=[];if(!this.eat(a._with))return e;this.expect(a.braceL);for(var t={},i=!0;!this.eat(a.braceR);){if(i)i=!1;else if(this.expect(a.comma),this.afterTrailingComma(a.braceR))break;var n=this.parseImportAttribute(),o=n.key.type==="Identifier"?n.key.name:n.key.value;X(t,o)&&this.raiseRecoverable(n.key.start,"Duplicate attribute key '"+o+"'"),t[o]=!0,e.push(n)}return e},C.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===a.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(a.colon),this.type!==a.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},C.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===a.string){var e=this.parseLiteral(this.value);return $e.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},C.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},C.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var we=Z.prototype;we.toAssignable=function(e,t,i){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var n=0,o=e.properties;n<o.length;n+=1){var d=o[n];this.toAssignable(d,t),d.type==="RestElement"&&(d.argument.type==="ArrayPattern"||d.argument.type==="ObjectPattern")&&this.raise(d.argument.start,"Unexpected token")}break;case"Property":e.kind!=="init"&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",i&&this.checkPatternErrors(i,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),e.argument.type==="AssignmentPattern"&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":e.operator!=="="&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,i);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else i&&this.checkPatternErrors(i,!0);return e},we.toAssignableList=function(e,t){for(var i=e.length,n=0;n<i;n++){var o=e[n];o&&this.toAssignable(o,t)}if(i){var d=e[i-1];this.options.ecmaVersion===6&&t&&d&&d.type==="RestElement"&&d.argument.type!=="Identifier"&&this.unexpected(d.argument.start)}return e},we.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},we.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==a.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},we.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case a.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(a.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case a.braceL:return this.parseObj(!0)}return this.parseIdent()},we.parseBindingList=function(e,t,i,n){for(var o=[],d=!0;!this.eat(e);)if(d?d=!1:this.expect(a.comma),t&&this.type===a.comma)o.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===a.ellipsis){var g=this.parseRestBinding();this.parseBindingListItem(g),o.push(g),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else o.push(this.parseAssignableListItem(n))}return o},we.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},we.parseBindingListItem=function(e){return e},we.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(a.eq))return i;var n=this.startNodeAt(e,t);return n.left=i,n.right=this.parseMaybeAssign(),this.finishNode(n,"AssignmentPattern")},we.checkLValSimple=function(e,t,i){t===void 0&&(t=gt);var n=t!==gt;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(n?"Binding ":"Assigning to ")+e.name+" in strict mode"),n&&(t===Pe&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(X(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==Ci&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":n&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return n&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(n?"Binding":"Assigning to")+" rvalue")}},we.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=gt),e.type){case"ObjectPattern":for(var n=0,o=e.properties;n<o.length;n+=1){var d=o[n];this.checkLValInnerPattern(d,t,i)}break;case"ArrayPattern":for(var g=0,v=e.elements;g<v.length;g+=1){var y=v[g];y&&this.checkLValInnerPattern(y,t,i)}break;default:this.checkLValSimple(e,t,i)}},we.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=gt),e.type){case"Property":this.checkLValInnerPattern(e.value,t,i);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,i);break;case"RestElement":this.checkLValPattern(e.argument,t,i);break;default:this.checkLValPattern(e,t,i)}};var Se=function(t,i,n,o,d){this.token=t,this.isExpr=!!i,this.preserveSpace=!!n,this.override=o,this.generator=!!d},Q={b_stat:new Se("{",!1),b_expr:new Se("{",!0),b_tmpl:new Se("${",!1),p_stat:new Se("(",!1),p_expr:new Se("(",!0),q_tmpl:new Se("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Se("function",!1),f_expr:new Se("function",!0),f_expr_gen:new Se("function",!0,!1,null,!0),f_gen:new Se("function",!1,!1,null,!0)},qe=Z.prototype;qe.initialContext=function(){return[Q.b_stat]},qe.curContext=function(){return this.context[this.context.length-1]},qe.braceIsBlock=function(e){var t=this.curContext();return t===Q.f_expr||t===Q.f_stat?!0:e===a.colon&&(t===Q.b_stat||t===Q.b_expr)?!t.isExpr:e===a._return||e===a.name&&this.exprAllowed?b.test(this.input.slice(this.lastTokEnd,this.start)):e===a._else||e===a.semi||e===a.eof||e===a.parenR||e===a.arrow?!0:e===a.braceL?t===Q.b_stat:e===a._var||e===a._const||e===a.name?!1:!this.exprAllowed},qe.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token==="function")return t.generator}return!1},qe.updateContext=function(e){var t,i=this.type;i.keyword&&e===a.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr},qe.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},a.parenR.updateContext=a.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===Q.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},a.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?Q.b_stat:Q.b_expr),this.exprAllowed=!0},a.dollarBraceL.updateContext=function(){this.context.push(Q.b_tmpl),this.exprAllowed=!0},a.parenL.updateContext=function(e){var t=e===a._if||e===a._for||e===a._with||e===a._while;this.context.push(t?Q.p_stat:Q.p_expr),this.exprAllowed=!0},a.incDec.updateContext=function(){},a._function.updateContext=a._class.updateContext=function(e){e.beforeExpr&&e!==a._else&&!(e===a.semi&&this.curContext()!==Q.p_stat)&&!(e===a._return&&b.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===a.colon||e===a.braceL)&&this.curContext()===Q.b_stat)?this.context.push(Q.f_expr):this.context.push(Q.f_stat),this.exprAllowed=!1},a.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},a.backQuote.updateContext=function(){this.curContext()===Q.q_tmpl?this.context.pop():this.context.push(Q.q_tmpl),this.exprAllowed=!1},a.star.updateContext=function(e){if(e===a._function){var t=this.context.length-1;this.context[t]===Q.f_expr?this.context[t]=Q.f_expr_gen:this.context[t]=Q.f_gen}this.exprAllowed=!0},a.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==a.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var L=Z.prototype;L.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var n=e.key,o;switch(n.type){case"Identifier":o=n.name;break;case"Literal":o=String(n.value);break;default:return}var d=e.kind;if(this.options.ecmaVersion>=6){o==="__proto__"&&d==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=n.start):this.raiseRecoverable(n.start,"Redefinition of __proto__ property")),t.proto=!0);return}o="$"+o;var g=t[o];if(g){var v;d==="init"?v=this.strict&&g.init||g.get||g.set:v=g.init||g[d],v&&this.raiseRecoverable(n.start,"Redefinition of property")}else g=t[o]={init:!1,get:!1,set:!1};g[d]=!0}},L.parseExpression=function(e,t){var i=this;return this.catchStackOverflow(function(){var n=i.start,o=i.startLoc,d=i.parseMaybeAssign(e,t);if(i.type===a.comma){var g=i.startNodeAt(n,o);for(g.expressions=[d];i.eat(a.comma);)g.expressions.push(i.parseMaybeAssign(e,t));return i.finishNode(g,"SequenceExpression")}return d})},L.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var n=!1,o=-1,d=-1,g=-1;t?(o=t.parenthesizedAssign,d=t.trailingComma,g=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new vt,n=!0);var v=this.start,y=this.startLoc;(this.type===a.parenL||this.type===a.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var N=this.parseMaybeConditional(e,t);if(i&&(N=i.call(this,N,v,y)),this.type.isAssign){var D=this.startNodeAt(v,y);return D.operator=this.value,this.type===a.eq&&(N=this.toAssignable(N,!1,t)),n||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=N.start&&(t.shorthandAssign=-1),this.type===a.eq?this.checkLValPattern(N):this.checkLValSimple(N),D.left=N,this.next(),D.right=this.parseMaybeAssign(e),g>-1&&(t.doubleProto=g),this.finishNode(D,"AssignmentExpression")}else n&&this.checkExpressionErrors(t,!0);return o>-1&&(t.parenthesizedAssign=o),d>-1&&(t.trailingComma=d),N},L.parseMaybeConditional=function(e,t){var i=this.start,n=this.startLoc,o=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return o;if(!(o.type==="ArrowFunctionExpression"&&o.start===i)&&this.eat(a.question)){var d=this.startNodeAt(i,n);return d.test=o,d.consequent=this.parseMaybeAssign(),this.expect(a.colon),d.alternate=this.parseMaybeAssign(e),this.finishNode(d,"ConditionalExpression")}return o},L.parseExprOps=function(e,t){var i=this.start,n=this.startLoc,o=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||o.start===i&&o.type==="ArrowFunctionExpression"?o:this.parseExprOp(o,i,n,-1,e)},L.parseExprOp=function(e,t,i,n,o){var d=this.type.binop;if(d!=null&&(!o||this.type!==a._in)&&d>n){var g=this.type===a.logicalOR||this.type===a.logicalAND,v=this.type===a.coalesce;v&&(d=a.logicalAND.binop);var y=this.value;this.next();var N=this.start,D=this.startLoc,Y=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,o),N,D,d,o),ue=this.buildBinary(t,i,e,Y,y,g||v);return(g&&this.type===a.coalesce||v&&(this.type===a.logicalOR||this.type===a.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(ue,t,i,n,o)}return e},L.buildBinary=function(e,t,i,n,o,d){n.type==="PrivateIdentifier"&&this.raise(n.start,"Private identifier can only be left side of binary expression");var g=this.startNodeAt(e,t);return g.left=i,g.operator=o,g.right=n,this.finishNode(g,d?"LogicalExpression":"BinaryExpression")},L.parseMaybeUnary=function(e,t,i,n){var o=this.start,d=this.startLoc,g;if(this.isContextual("await")&&this.canAwait)g=this.parseAwait(n),t=!0;else if(this.type.prefix){var v=this.startNode(),y=this.type===a.incDec;v.operator=this.value,v.prefix=!0,this.next(),v.argument=this.parseMaybeUnary(null,!0,y,n),this.checkExpressionErrors(e,!0),y?this.checkLValSimple(v.argument):this.strict&&v.operator==="delete"&&Ai(v.argument)?this.raiseRecoverable(v.start,"Deleting local variable in strict mode"):v.operator==="delete"&&Gt(v.argument)?this.raiseRecoverable(v.start,"Private fields can not be deleted"):t=!0,g=this.finishNode(v,y?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===a.privateId)(n||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),g=this.parsePrivateIdent(),this.type!==a._in&&this.unexpected();else{if(g=this.parseExprSubscripts(e,n),this.checkExpressionErrors(e))return g;for(;this.type.postfix&&!this.canInsertSemicolon();){var N=this.startNodeAt(o,d);N.operator=this.value,N.prefix=!1,N.argument=g,this.checkLValSimple(g),this.next(),g=this.finishNode(N,"UpdateExpression")}}if(!i&&this.eat(a.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(o,d,g,this.parseMaybeUnary(null,!1,!1,n),"**",!1);else return g};function Ai(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&Ai(e.expression)}function Gt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&Gt(e.expression)||e.type==="ParenthesizedExpression"&&Gt(e.expression)}L.parseExprSubscripts=function(e,t){var i=this.start,n=this.startLoc,o=this.parseExprAtom(e,t);if(o.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return o;var d=this.parseSubscripts(o,i,n,!1,t);return e&&d.type==="MemberExpression"&&(e.parenthesizedAssign>=d.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=d.start&&(e.parenthesizedBind=-1),e.trailingComma>=d.start&&(e.trailingComma=-1)),d},L.parseSubscripts=function(e,t,i,n,o){for(var d=this.options.ecmaVersion>=8&&e.type==="Identifier"&&e.name==="async"&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,g=!1;;){var v=this.parseSubscript(e,t,i,n,d,g,o);if(v.optional&&(g=!0),v===e||v.type==="ArrowFunctionExpression"){if(g){var y=this.startNodeAt(t,i);y.expression=v,v=this.finishNode(y,"ChainExpression")}return v}e=v}},L.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(a.arrow)},L.parseSubscriptAsyncArrow=function(e,t,i,n){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,n)},L.parseSubscript=function(e,t,i,n,o,d,g){var v=this.options.ecmaVersion>=11,y=v&&this.eat(a.questionDot);n&&y&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var N=this.eat(a.bracketL);if(N||y&&this.type!==a.parenL&&this.type!==a.backQuote||this.eat(a.dot)){var D=this.startNodeAt(t,i);D.object=e,N?(D.property=this.parseExpression(),this.expect(a.bracketR)):this.type===a.privateId&&e.type!=="Super"?D.property=this.parsePrivateIdent():D.property=this.parseIdent(this.options.allowReserved!=="never"),D.computed=!!N,v&&(D.optional=y),e=this.finishNode(D,"MemberExpression")}else if(!n&&this.eat(a.parenL)){var Y=new vt,ue=this.yieldPos,st=this.awaitPos,We=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var kt=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1,Y);if(o&&!y&&this.shouldParseAsyncArrow())return this.checkPatternErrors(Y,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=ue,this.awaitPos=st,this.awaitIdentPos=We,this.parseSubscriptAsyncArrow(t,i,kt,g);this.checkExpressionErrors(Y,!0),this.yieldPos=ue||this.yieldPos,this.awaitPos=st||this.awaitPos,this.awaitIdentPos=We||this.awaitIdentPos;var He=this.startNodeAt(t,i);He.callee=e,He.arguments=kt,v&&(He.optional=y),e=this.finishNode(He,"CallExpression")}else if(this.type===a.backQuote){(y||d)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var ze=this.startNodeAt(t,i);ze.tag=e,ze.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(ze,"TaggedTemplateExpression")}return e},L.parseExprAtom=function(e,t,i){this.type===a.slash&&this.readRegexp();var n,o=this.potentialArrowAt===this.start;switch(this.type){case a._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),n=this.startNode(),this.next(),this.type===a.parenL&&!this.allowDirectSuper&&this.raise(n.start,"super() call outside constructor of a subclass"),this.type!==a.dot&&this.type!==a.bracketL&&this.type!==a.parenL&&this.unexpected(),this.finishNode(n,"Super");case a._this:return n=this.startNode(),this.next(),this.finishNode(n,"ThisExpression");case a.name:var d=this.start,g=this.startLoc,v=this.containsEsc,y=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!v&&y.name==="async"&&!this.canInsertSemicolon()&&this.eat(a._function))return this.overrideContext(Q.f_expr),this.parseFunction(this.startNodeAt(d,g),0,!1,!0,t);if(o&&!this.canInsertSemicolon()){if(this.eat(a.arrow))return this.parseArrowExpression(this.startNodeAt(d,g),[y],!1,t);if(this.options.ecmaVersion>=8&&y.name==="async"&&this.type===a.name&&!v&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return y=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(a.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(d,g),[y],!0,t)}return y;case a.regexp:var N=this.value;return n=this.parseLiteral(N.value),n.regex={pattern:N.pattern,flags:N.flags},n;case a.num:case a.string:return this.parseLiteral(this.value);case a._null:case a._true:case a._false:return n=this.startNode(),n.value=this.type===a._null?null:this.type===a._true,n.raw=this.type.keyword,this.next(),this.finishNode(n,"Literal");case a.parenL:var D=this.start,Y=this.parseParenAndDistinguishExpression(o,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(Y)&&(e.parenthesizedAssign=D),e.parenthesizedBind<0&&(e.parenthesizedBind=D)),Y;case a.bracketL:return n=this.startNode(),this.next(),n.elements=this.parseExprList(a.bracketR,!0,!0,e),this.finishNode(n,"ArrayExpression");case a.braceL:return this.overrideContext(Q.b_expr),this.parseObj(!1,e);case a._function:return n=this.startNode(),this.next(),this.parseFunction(n,0);case a._class:return this.parseClass(this.startNode(),!1);case a._new:return this.parseNew();case a.backQuote:return this.parseTemplate();case a._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}},L.parseExprAtomDefault=function(){this.unexpected()},L.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===a.parenL&&!e)return this.parseDynamicImport(t);if(this.type===a.dot){var i=this.startNodeAt(t.start,t.loc&&t.loc.start);return i.name="import",t.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(t)}else this.unexpected()},L.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(a.parenR)?e.options=null:(this.expect(a.comma),this.afterTrailingComma(a.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(a.parenR)||(this.expect(a.comma),this.afterTrailingComma(a.parenR)||this.unexpected())));else if(!this.eat(a.parenR)){var t=this.start;this.eat(a.comma)&&this.eat(a.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},L.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")},L.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value!=null?t.value.toString():t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")},L.parseParenExpression=function(){this.expect(a.parenL);var e=this.parseExpression();return this.expect(a.parenR),e},L.shouldParseArrow=function(e){return!this.canInsertSemicolon()},L.parseParenAndDistinguishExpression=function(e,t){var i=this.start,n=this.startLoc,o,d=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var g=this.start,v=this.startLoc,y=[],N=!0,D=!1,Y=new vt,ue=this.yieldPos,st=this.awaitPos,We;for(this.yieldPos=0,this.awaitPos=0;this.type!==a.parenR;)if(N?N=!1:this.expect(a.comma),d&&this.afterTrailingComma(a.parenR,!0)){D=!0;break}else if(this.type===a.ellipsis){We=this.start,y.push(this.parseParenItem(this.parseRestBinding())),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else y.push(this.parseMaybeAssign(!1,Y,this.parseParenItem));var kt=this.lastTokEnd,He=this.lastTokEndLoc;if(this.expect(a.parenR),e&&this.shouldParseArrow(y)&&this.eat(a.arrow))return this.checkPatternErrors(Y,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=ue,this.awaitPos=st,this.parseParenArrowList(i,n,y,t);(!y.length||D)&&this.unexpected(this.lastTokStart),We&&this.unexpected(We),this.checkExpressionErrors(Y,!0),this.yieldPos=ue||this.yieldPos,this.awaitPos=st||this.awaitPos,y.length>1?(o=this.startNodeAt(g,v),o.expressions=y,this.finishNodeAt(o,"SequenceExpression",kt,He)):o=y[0]}else o=this.parseParenExpression();if(this.options.preserveParens){var ze=this.startNodeAt(i,n);return ze.expression=o,this.finishNode(ze,"ParenthesizedExpression")}else return o},L.parseParenItem=function(e){return e},L.parseParenArrowList=function(e,t,i,n){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,n)};var ts=[];L.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===a.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var n=this.start,o=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),n,o,!0,!1),e.callee.type==="Super"&&this.raiseRecoverable(n,"Invalid use of 'super'"),this.eat(a.parenL)?e.arguments=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1):e.arguments=ts,this.finishNode(e,"NewExpression")},L.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===a.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,`
|
|
9
9
|
`),cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
10
|
-
`),cooked:this.value},this.next(),i.tail=this.type===a.backQuote,this.finishNode(i,"TemplateElement")},j.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var s=this.parseTemplateElement({isTagged:t});for(i.quasis=[s];!s.tail;)this.type===a.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(a.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(a.braceR),i.quasis.push(s=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")},j.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===a.name||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===a.star)&&!x.test(this.input.slice(this.lastTokEnd,this.start))},j.parseObj=function(e,t){var i=this.startNode(),s=!0,o={};for(i.properties=[],this.next();!this.eat(a.braceR);){if(s)s=!1;else if(this.expect(a.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(a.braceR))break;var d=this.parseProperty(e,t);e||this.checkPropClash(d,o,t),i.properties.push(d)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")},j.parseProperty=function(e,t){var i=this.startNode(),s,o,d,m;if(this.options.ecmaVersion>=9&&this.eat(a.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,t),this.type===a.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(e||t)&&(d=this.start,m=this.startLoc),e||(s=this.eat(a.star)));var v=this.containsEsc;return this.parsePropertyName(i),!e&&!v&&this.options.ecmaVersion>=8&&!s&&this.isAsyncProp(i)?(o=!0,s=this.options.ecmaVersion>=9&&this.eat(a.star),this.parsePropertyName(i)):o=!1,this.parsePropertyValue(i,e,s,o,d,m,t,v),this.finishNode(i,"Property")},j.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var i=e.kind==="get"?0:1;if(e.value.params.length!==i){var s=e.value.start;e.kind==="get"?this.raiseRecoverable(s,"getter should have no params"):this.raiseRecoverable(s,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")},j.parsePropertyValue=function(e,t,i,s,o,d,m,v){(i||s)&&this.type===a.colon&&this.unexpected(),this.eat(a.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,m),e.kind="init"):this.options.ecmaVersion>=6&&this.type===a.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(i,s),e.kind="init"):!t&&!v&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==a.comma&&this.type!==a.braceR&&this.type!==a.eq?((i||s)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((i||s)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=o),t?e.value=this.parseMaybeDefault(o,d,this.copyNode(e.key)):this.type===a.eq&&m?(m.shorthandAssign<0&&(m.shorthandAssign=this.start),e.value=this.parseMaybeDefault(o,d,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=!0):this.unexpected()},j.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(a.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(a.bracketR),e.key;e.computed=!1}return e.key=this.type===a.num||this.type===a.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")},j.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},j.parseMethod=function(e,t,i){var s=this.startNode(),o=this.yieldPos,d=this.awaitPos,m=this.awaitIdentPos;return this.initFunction(s),this.options.ecmaVersion>=6&&(s.generator=e),this.options.ecmaVersion>=8&&(s.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Bt(t,s.generator)|pt|(i?vi:0)),this.expect(a.parenL),s.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(s,!1,!0,!1),this.yieldPos=o,this.awaitPos=d,this.awaitIdentPos=m,this.finishNode(s,"FunctionExpression")},j.parseArrowExpression=function(e,t,i,s){var o=this.yieldPos,d=this.awaitPos,m=this.awaitIdentPos;return this.enterScope(Bt(i,!1)|qe),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,s),this.yieldPos=o,this.awaitPos=d,this.awaitIdentPos=m,this.finishNode(e,"ArrowFunctionExpression")},j.parseFunctionBody=function(e,t,i,s){var o=t&&this.type!==a.braceL,d=this.strict,m=!1;if(o)e.body=this.parseMaybeAssign(s),e.expression=!0,this.checkParams(e,!1);else{var v=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!d||v)&&(m=this.strictDirective(this.end),m&&v&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var y=this.labels;this.labels=[],m&&(this.strict=!0),this.checkParams(e,!d&&!m&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,wi),e.body=this.parseBlock(!1,void 0,m&&!d),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=y}this.exitScope()},j.isSimpleParamList=function(e){for(var t=0,i=e;t<i.length;t+=1){var s=i[t];if(s.type!=="Identifier")return!1}return!0},j.checkParams=function(e,t){for(var i=Object.create(null),s=0,o=e.params;s<o.length;s+=1){var d=o[s];this.checkLValInnerPattern(d,$t,t?null:i)}},j.parseExprList=function(e,t,i,s){for(var o=[],d=!0;!this.eat(e);){if(d)d=!1;else if(this.expect(a.comma),t&&this.afterTrailingComma(e))break;var m=void 0;i&&this.type===a.comma?m=null:this.type===a.ellipsis?(m=this.parseSpread(s),s&&this.type===a.comma&&s.trailingComma<0&&(s.trailingComma=this.start)):m=this.parseMaybeAssign(!1,s),o.push(m)}return o},j.checkUnreserved=function(e){var t=e.start,i=e.end,s=e.name;if(this.inGenerator&&s==="yield"&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&s==="await"&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&ft)&&s==="arguments"&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(s==="arguments"||s==="await")&&this.raise(t,"Cannot use "+s+" in class static initialization block"),this.keywords.test(s)&&this.raise(t,"Unexpected keyword '"+s+"'"),!(this.options.ecmaVersion<6&&this.input.slice(t,i).indexOf("\\")!==-1)){var o=this.strict?this.reservedWordsStrict:this.reservedWords;o.test(s)&&(!this.inAsync&&s==="await"&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+s+"' is reserved"))}},j.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),t.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},j.parseIdentNode=function(){var e=this.startNode();return this.type===a.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name==="class"||e.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=a.name):this.unexpected(),e},j.parsePrivateIdent=function(){var e=this.startNode();return this.type===a.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},j.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===a.semi||this.canInsertSemicolon()||this.type!==a.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(a.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},j.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var vt=Y.prototype;vt.raise=function(e,t){var i=pe(this.input,e);t+=" ("+i.line+":"+i.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var s=new SyntaxError(t);throw s.pos=e,s.loc=i,s.raisedAt=this.pos,s},vt.raiseRecoverable=vt.raise,vt.curPosition=function(){if(this.options.locations)return new W(this.curLine,this.pos-this.lineStart)};var Ve=Y.prototype,Yr=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};Ve.enterScope=function(e){this.scopeStack.push(new Yr(e))},Ve.exitScope=function(){this.scopeStack.pop()},Ve.treatFunctionsAsVarInScope=function(e){return e.flags&Ce||!this.inModule&&e.flags&se},Ve.declareName=function(e,t,i){var s=!1;if(t===Re){var o=this.currentScope();s=o.lexical.indexOf(e)>-1||o.functions.indexOf(e)>-1||o.var.indexOf(e)>-1,o.lexical.push(e),this.inModule&&o.flags&se&&delete this.undefinedExports[e]}else if(t===bi){var d=this.currentScope();d.lexical.push(e)}else if(t===yi){var m=this.currentScope();this.treatFunctionsAsVar?s=m.lexical.indexOf(e)>-1:s=m.lexical.indexOf(e)>-1||m.var.indexOf(e)>-1,m.functions.push(e)}else for(var v=this.scopeStack.length-1;v>=0;--v){var y=this.scopeStack[v];if(y.lexical.indexOf(e)>-1&&!(y.flags&ht&&y.lexical[0]===e)||!this.treatFunctionsAsVarInScope(y)&&y.functions.indexOf(e)>-1){s=!0;break}if(y.var.push(e),this.inModule&&y.flags&se&&delete this.undefinedExports[e],y.flags&ft)break}s&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")},Ve.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},Ve.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Ve.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(ft|Ze|Be))return t}},Ve.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(ft|Ze|Be)&&!(t.flags&qe))return t}};var tt=function(t,i,s){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new re(t,s)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},it=Y.prototype;it.startNode=function(){return new tt(this,this.start,this.startLoc)},it.startNodeAt=function(e,t){return new tt(this,e,t)};function Ci(e,t,i,s){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=s),this.options.ranges&&(e.range[1]=i),e}it.finishNode=function(e,t){return Ci.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},it.finishNodeAt=function(e,t,i,s){return Ci.call(this,e,t,i,s)},it.copyNode=function(e){var t=new tt(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var Xr="Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz",Ii="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Ai=Ii+" Extended_Pictographic",_i=Ai,Ei=_i+" EBase EComp EMod EPres ExtPict",Pi=Ei,Zr=Pi,es={9:Ii,10:Ai,11:_i,12:Ei,13:Pi,14:Zr},ts="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",is={9:"",10:"",11:"",12:"",13:"",14:ts},Ri="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Ni="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Ti=Ni+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Li=Ti+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Oi=Li+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",ji=Oi+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",rs=ji+" "+Xr,ss={9:Ni,10:Ti,11:Li,12:Oi,13:ji,14:rs},Vi={};function ns(e){var t=Vi[e]={binary:ge(es[e]+" "+Ri),binaryOfStrings:ge(is[e]),nonBinary:{General_Category:ge(Ri),Script:ge(ss[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Ht=0,Fi=[9,10,11,12,13,14];Ht<Fi.length;Ht+=1){var as=Fi[Ht];ns(as)}var S=Y.prototype,xt=function(t,i){this.parent=t,this.base=i||this};xt.prototype.separatedFrom=function(t){for(var i=this;i;i=i.parent)for(var s=t;s;s=s.parent)if(i.base===s.base&&i!==s)return!0;return!1},xt.prototype.sibling=function(){return new xt(this.parent,this.base)};var _e=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Vi[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};_e.prototype.reset=function(t,i,s){var o=s.indexOf("v")!==-1,d=s.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=s,o&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=d&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=d&&this.parser.options.ecmaVersion>=9)},_e.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},_e.prototype.at=function(t,i){i===void 0&&(i=!1);var s=this.source,o=s.length;if(t>=o)return-1;var d=s.charCodeAt(t);if(!(i||this.switchU)||d<=55295||d>=57344||t+1>=o)return d;var m=s.charCodeAt(t+1);return m>=56320&&m<=57343?(d<<10)+m-56613888:d},_e.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var s=this.source,o=s.length;if(t>=o)return o;var d=s.charCodeAt(t),m;return!(i||this.switchU)||d<=55295||d>=57344||t+1>=o||(m=s.charCodeAt(t+1))<56320||m>57343?t+1:t+2},_e.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)},_e.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},_e.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)},_e.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1},_e.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var s=this.pos,o=0,d=t;o<d.length;o+=1){var m=d[o],v=this.at(s,i);if(v===-1||v!==m)return!1;s=this.nextIndex(s,i)}return this.pos=s,!0},S.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,s=!1,o=!1,d=0;d<i.length;d++){var m=i.charAt(d);t.indexOf(m)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(m,d+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),m==="u"&&(s=!0),m==="v"&&(o=!0)}this.options.ecmaVersion>=15&&s&&o&&this.raise(e.start,"Invalid regular expression flag")};function os(e){for(var t in e)return!0;return!1}S.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&os(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},S.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,i=e.backReferenceNames;t<i.length;t+=1){var s=i[t];e.groupNames[s]||e.raise("Invalid named capture referenced")}},S.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new xt(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")},S.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},S.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1},S.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var i=!1;if(this.options.ecmaVersion>=9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!0}return e.pos=t,!1},S.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},S.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},S.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var s=0,o=-1;if(this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(o=e.lastIntValue),e.eat(125)))return o!==-1&&o<s&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}return!1},S.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},S.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},S.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var i=this.regexp_eatModifiers(e),s=e.eat(45);if(i||s){for(var o=0;o<i.length;o++){var d=i.charAt(o);i.indexOf(d,o+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(s){var m=this.regexp_eatModifiers(e);!i&&!m&&e.current()===58&&e.raise("Invalid regular expression modifiers");for(var v=0;v<m.length;v++){var y=m.charAt(v);(m.indexOf(y,v+1)>-1||i.indexOf(y)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1},S.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1},S.regexp_eatModifiers=function(e){for(var t="",i=0;(i=e.current())!==-1&&cs(i);)t+=q(i),e.advance();return t};function cs(e){return e===105||e===109||e===115}S.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},S.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},S.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Di(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Di(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}S.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!Di(i);)e.advance();return e.pos!==t},S.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1},S.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,i=e.groupNames[e.lastStringValue];if(i)if(t)for(var s=0,o=i;s<o.length;s+=1){var d=o[s];d.separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(i||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},S.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1},S.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=q(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=q(e.lastIntValue);return!0}return!1},S.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,s=e.current(i);return e.advance(i),s===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(s=e.lastIntValue),us(s)?(e.lastIntValue=s,!0):(e.pos=t,!1)};function us(e){return I(e,!0)||e===36||e===95}S.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,s=e.current(i);return e.advance(i),s===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(s=e.lastIntValue),ls(s)?(e.lastIntValue=s,!0):(e.pos=t,!1)};function ls(e){return E(e,!0)||e===36||e===95||e===8204||e===8205}S.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)},S.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=e.numCapturingParens)return!0;e.pos=t}return!1},S.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1},S.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},S.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},S.regexp_eatZero=function(e){return e.current()===48&&!yt(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1},S.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1},S.regexp_eatControlLetter=function(e){var t=e.current();return Mi(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Mi(e){return e>=65&&e<=90||e>=97&&e<=122}S.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var i=e.pos,s=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(s&&o>=55296&&o<=56319){var d=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var m=e.lastIntValue;if(m>=56320&&m<=57343)return e.lastIntValue=(o-55296)*1024+(m-56320)+65536,!0}e.pos=d,e.lastIntValue=o}return!0}if(s&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&hs(e.lastIntValue))return!0;s&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function hs(e){return e>=0&&e<=1114111}S.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1},S.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Bi=0,Ne=1,we=2;S.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(ps(t))return e.lastIntValue=-1,e.advance(),Ne;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=t===80)||t===112)){e.lastIntValue=-1,e.advance();var s;if(e.eat(123)&&(s=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&s===we&&e.raise("Invalid property name"),s;e.raise("Invalid property name")}return Bi};function ps(e){return e===100||e===68||e===115||e===83||e===119||e===87}S.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,s),Ne}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var o=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,o)}return Bi},S.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){T(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")},S.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Ne;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return we;e.raise("Invalid property name")},S.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";$i(t=e.current());)e.lastStringValue+=q(t),e.advance();return e.lastStringValue!==""};function $i(e){return Mi(e)||e===95}S.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";fs(t=e.current());)e.lastStringValue+=q(t),e.advance();return e.lastStringValue!==""};function fs(e){return $i(e)||yt(e)}S.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},S.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&i===we&&e.raise("Negated character class may contain strings"),!0}return!1},S.regexp_classContents=function(e){return e.current()===93?Ne:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Ne)},S.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;e.switchU&&(t===-1||i===-1)&&e.raise("Invalid character class"),t!==-1&&i!==-1&&t>i&&e.raise("Range out of order in character class")}}},S.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var i=e.current();(i===99||Wi(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var s=e.current();return s!==93?(e.lastIntValue=s,e.advance(),!0):!1},S.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},S.regexp_classSetExpression=function(e){var t=Ne,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===we&&(t=we);for(var s=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==we&&(t=Ne);continue}e.raise("Invalid character in character class")}if(s!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(s!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(i=this.regexp_eatClassSetOperand(e),!i)return t;i===we&&(t=we)}},S.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var s=e.lastIntValue;return i!==-1&&s!==-1&&i>s&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},S.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Ne:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},S.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),s=this.regexp_classContents(e);if(e.eat(93))return i&&s===we&&e.raise("Negated character class may contain strings"),s;e.pos=t}if(e.eat(92)){var o=this.regexp_eatCharacterClassEscape(e);if(o)return o;e.pos=t}return null},S.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}else e.raise("Invalid escape");e.pos=t}return null},S.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===we&&(t=we);return t},S.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Ne:we},S.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var i=e.current();return i<0||i===e.lookahead()&&ds(i)||ms(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function ds(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function ms(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}S.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return gs(t)?(e.lastIntValue=t,e.advance(),!0):!1};function gs(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}S.regexp_eatClassControlLetter=function(e){var t=e.current();return yt(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},S.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1},S.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;yt(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function yt(e){return e>=48&&e<=57}S.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Ui(i=e.current());)e.lastIntValue=16*e.lastIntValue+qi(i),e.advance();return e.pos!==t};function Ui(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function qi(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}S.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+i*8+e.lastIntValue:e.lastIntValue=t*8+i}else e.lastIntValue=t;return!0}return!1},S.regexp_eatOctalDigit=function(e){var t=e.current();return Wi(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Wi(e){return e>=48&&e<=55}S.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var s=0;s<t;++s){var o=e.current();if(!Ui(o))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+qi(o),e.advance()}return!0};var bt=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new re(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},U=Y.prototype;U.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new bt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},U.getToken=function(){return this.next(),new bt(this)},typeof Symbol<"u"&&(U[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===a.eof,value:t}}}}),U.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(a.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},U.readToken=function(e){return I(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},U.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var i=this.input.charCodeAt(e+1);return i<=56319||i>=57344?t:(t<<10)+i-56613888},U.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},U.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var s=void 0,o=t;(s=H(this.input,o,this.pos))>-1;)++this.curLine,o=this.lineStart=s;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())},U.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),s=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!$(s);)s=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,i,this.curPosition())},U.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(e>8&&e<14||e>=5760&&ee.test(String.fromCharCode(e)))++this.pos;else break e}}},U.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)},U.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(a.ellipsis)):(++this.pos,this.finishToken(a.dot))},U.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(a.assign,2):this.finishOp(a.slash,1)},U.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,s=e===42?a.star:a.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,s=a.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(a.assign,i+1):this.finishOp(s,i)},U.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(a.assign,3)}return this.finishOp(e===124?a.logicalOR:a.logicalAND,2)}return t===61?this.finishOp(a.assign,2):this.finishOp(e===124?a.bitwiseOR:a.bitwiseAND,1)},U.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(a.assign,2):this.finishOp(a.bitwiseXOR,1)},U.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||x.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(a.incDec,2):t===61?this.finishOp(a.assign,2):this.finishOp(a.plusMin,1)},U.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(a.assign,i+1):this.finishOp(a.bitShift,i)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(i=2),this.finishOp(a.relational,i))},U.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(a.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(a.arrow)):this.finishOp(e===61?a.eq:a.prefix,1)},U.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(a.questionDot,2)}if(t===63){if(e>=12){var s=this.input.charCodeAt(this.pos+2);if(s===61)return this.finishOp(a.assign,3)}return this.finishOp(a.coalesce,2)}}return this.finishOp(a.question,1)},U.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),I(t,!0)||t===92))return this.finishToken(a.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+q(t)+"'")},U.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(a.parenL);case 41:return++this.pos,this.finishToken(a.parenR);case 59:return++this.pos,this.finishToken(a.semi);case 44:return++this.pos,this.finishToken(a.comma);case 91:return++this.pos,this.finishToken(a.bracketL);case 93:return++this.pos,this.finishToken(a.bracketR);case 123:return++this.pos,this.finishToken(a.braceL);case 125:return++this.pos,this.finishToken(a.braceR);case 58:return++this.pos,this.finishToken(a.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(a.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===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(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(a.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+q(e)+"'")},U.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)},U.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var s=this.input.charAt(this.pos);if(x.test(s)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if(s==="[")t=!0;else if(s==="]"&&t)t=!1;else if(s==="/"&&!t)break;e=s==="\\"}++this.pos}var o=this.input.slice(i,this.pos);++this.pos;var d=this.pos,m=this.readWord1();this.containsEsc&&this.unexpected(d);var v=this.regexpState||(this.regexpState=new _e(this));v.reset(i,o,m),this.validateRegExpFlags(v),this.validateRegExpPattern(v);var y=null;try{y=new RegExp(o,m)}catch{}return this.finishToken(a.regexp,{pattern:o,flags:m,value:y})},U.readInt=function(e,t,i){for(var s=this.options.ecmaVersion>=12&&t===void 0,o=i&&this.input.charCodeAt(this.pos)===48,d=this.pos,m=0,v=0,y=0,L=t??1/0;y<L;++y,++this.pos){var M=this.input.charCodeAt(this.pos),K=void 0;if(s&&M===95){o&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),v===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),y===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),v=M;continue}if(M>=97?K=M-97+10:M>=65?K=M-65+10:M>=48&&M<=57?K=M-48:K=1/0,K>=e)break;v=M,m=m*e+K}return s&&v===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===d||t!=null&&this.pos-d!==t?null:m};function vs(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Hi(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}U.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return i==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=Hi(this.input.slice(t,this.pos)),++this.pos):I(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,i)},U.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var i=this.pos-t>=2&&this.input.charCodeAt(t)===48;i&&this.strict&&this.raise(t,"Invalid number");var s=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&s===110){var o=Hi(this.input.slice(t,this.pos));return++this.pos,I(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,o)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),s===46&&!i&&(++this.pos,this.readInt(10),s=this.input.charCodeAt(this.pos)),(s===69||s===101)&&!i&&(s=this.input.charCodeAt(++this.pos),(s===43||s===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),I(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var d=vs(this.input.slice(t,this.pos),i);return this.finishToken(a.num,d)},U.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else t=this.readHexChar(4);return t},U.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var s=this.input.charCodeAt(this.pos);if(s===e)break;s===92?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):s===8232||s===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):($(s)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(a.string,t)};var zi={};U.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===zi)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},U.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw zi;this.raise(e,t)},U.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===a.template||this.type===a.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(a.dollarBraceL)):(++this.pos,this.finishToken(a.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(a.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if($(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
|
|
10
|
+
`),cooked:this.value},this.next(),i.tail=this.type===a.backQuote,this.finishNode(i,"TemplateElement")},L.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var n=this.parseTemplateElement({isTagged:t});for(i.quasis=[n];!n.tail;)this.type===a.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(a.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(a.braceR),i.quasis.push(n=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")},L.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===a.name||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===a.star)&&!b.test(this.input.slice(this.lastTokEnd,this.start))},L.parseObj=function(e,t){var i=this.startNode(),n=!0,o={};for(i.properties=[],this.next();!this.eat(a.braceR);){if(n)n=!1;else if(this.expect(a.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(a.braceR))break;var d=this.parseProperty(e,t);e||this.checkPropClash(d,o,t),i.properties.push(d)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")},L.parseProperty=function(e,t){var i=this.startNode(),n,o,d,g;if(this.options.ecmaVersion>=9&&this.eat(a.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,t),this.type===a.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(e||t)&&(d=this.start,g=this.startLoc),e||(n=this.eat(a.star)));var v=this.containsEsc;return this.parsePropertyName(i),!e&&!v&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(i)?(o=!0,n=this.options.ecmaVersion>=9&&this.eat(a.star),this.parsePropertyName(i)):o=!1,this.parsePropertyValue(i,e,n,o,d,g,t,v),this.finishNode(i,"Property")},L.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var i=e.kind==="get"?0:1;if(e.value.params.length!==i){var n=e.value.start;e.kind==="get"?this.raiseRecoverable(n,"getter should have no params"):this.raiseRecoverable(n,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")},L.parsePropertyValue=function(e,t,i,n,o,d,g,v){(i||n)&&this.type===a.colon&&this.unexpected(),this.eat(a.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,g),e.kind="init"):this.options.ecmaVersion>=6&&this.type===a.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(i,n),e.kind="init"):!t&&!v&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==a.comma&&this.type!==a.braceR&&this.type!==a.eq?((i||n)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((i||n)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=o),t?e.value=this.parseMaybeDefault(o,d,this.copyNode(e.key)):this.type===a.eq&&g?(g.shorthandAssign<0&&(g.shorthandAssign=this.start),e.value=this.parseMaybeDefault(o,d,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=!0):this.unexpected()},L.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(a.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(a.bracketR),e.key;e.computed=!1}return e.key=this.type===a.num||this.type===a.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")},L.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},L.parseMethod=function(e,t,i){var n=this.startNode(),o=this.yieldPos,d=this.awaitPos,g=this.awaitIdentPos;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(qt(t,n.generator)|Me|(i?dt:0)),this.expect(a.parenL),n.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1,!0,!1),this.yieldPos=o,this.awaitPos=d,this.awaitIdentPos=g,this.finishNode(n,"FunctionExpression")},L.parseArrowExpression=function(e,t,i,n){var o=this.yieldPos,d=this.awaitPos,g=this.awaitIdentPos;return this.enterScope(qt(i,!1)|de),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,n),this.yieldPos=o,this.awaitPos=d,this.awaitIdentPos=g,this.finishNode(e,"ArrowFunctionExpression")},L.parseFunctionBody=function(e,t,i,n){var o=t&&this.type!==a.braceL,d=this.strict,g=!1;if(o)e.body=this.parseMaybeAssign(n),e.expression=!0,this.checkParams(e,!1);else{var v=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!d||v)&&(g=this.strictDirective(this.end),g&&v&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var y=this.labels;this.labels=[],g&&(this.strict=!0),this.checkParams(e,!d&&!g&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Ci),e.body=this.parseBlock(!1,void 0,g&&!d),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=y}this.exitScope()},L.isSimpleParamList=function(e){for(var t=0,i=e;t<i.length;t+=1){var n=i[t];if(n.type!=="Identifier")return!1}return!0},L.checkParams=function(e,t){for(var i=Object.create(null),n=0,o=e.params;n<o.length;n+=1){var d=o[n];this.checkLValInnerPattern(d,Wt,t?null:i)}},L.parseExprList=function(e,t,i,n){for(var o=[],d=!0;!this.eat(e);){if(d)d=!1;else if(this.expect(a.comma),t&&this.afterTrailingComma(e))break;var g=void 0;i&&this.type===a.comma?g=null:this.type===a.ellipsis?(g=this.parseSpread(n),n&&this.type===a.comma&&n.trailingComma<0&&(n.trailingComma=this.start)):g=this.parseMaybeAssign(!1,n),o.push(g)}return o},L.checkUnreserved=function(e){var t=e.start,i=e.end,n=e.name;if(this.inGenerator&&n==="yield"&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&n==="await"&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&mt)&&n==="arguments"&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(n==="arguments"||n==="await")&&this.raise(t,"Cannot use "+n+" in class static initialization block"),this.keywords.test(n)&&this.raise(t,"Unexpected keyword '"+n+"'"),!(this.options.ecmaVersion<6&&this.input.slice(t,i).indexOf("\\")!==-1)){var o=this.strict?this.reservedWordsStrict:this.reservedWords;o.test(n)&&(!this.inAsync&&n==="await"&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+n+"' is reserved"))}},L.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),t.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},L.parseIdentNode=function(){var e=this.startNode();return this.type===a.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name==="class"||e.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=a.name):this.unexpected(),e},L.parsePrivateIdent=function(){var e=this.startNode();return this.type===a.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},L.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===a.semi||this.canInsertSemicolon()||this.type!==a.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(a.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},L.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var yt=Z.prototype;yt.raise=function(e,t){var i=H(this.input,e);t+=" ("+i.line+":"+i.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var n=new SyntaxError(t);throw n.pos=e,n.loc=i,n.raisedAt=this.pos,n},yt.raiseRecoverable=yt.raise,yt.curPosition=function(){if(this.options.locations)return new W(this.curLine,this.pos-this.lineStart)};var Oe=Z.prototype,is=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};Oe.enterScope=function(e){this.scopeStack.push(new is(e))},Oe.exitScope=function(){this.scopeStack.pop()},Oe.treatFunctionsAsVarInScope=function(e){return e.flags&Ie||!this.inModule&&e.flags&ne},Oe.declareName=function(e,t,i){var n=!1;if(t===Pe){var o=this.currentScope();n=o.lexical.indexOf(e)>-1||o.functions.indexOf(e)>-1||o.var.indexOf(e)>-1,o.lexical.push(e),this.inModule&&o.flags&ne&&delete this.undefinedExports[e]}else if(t===ki){var d=this.currentScope();d.lexical.push(e)}else if(t===Si){var g=this.currentScope();this.treatFunctionsAsVar?n=g.lexical.indexOf(e)>-1:n=g.lexical.indexOf(e)>-1||g.var.indexOf(e)>-1,g.functions.push(e)}else for(var v=this.scopeStack.length-1;v>=0;--v){var y=this.scopeStack[v];if(y.lexical.indexOf(e)>-1&&!(y.flags&oe&&y.lexical[0]===e)||!this.treatFunctionsAsVarInScope(y)&&y.functions.indexOf(e)>-1){n=!0;break}if(y.var.push(e),this.inModule&&y.flags&ne&&delete this.undefinedExports[e],y.flags&mt)break}n&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")},Oe.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},Oe.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Oe.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(mt|et|Be))return t}},Oe.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(mt|et|Be)&&!(t.flags&de))return t}};var it=function(t,i,n){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new G(t,n)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},rt=Z.prototype;rt.startNode=function(){return new it(this,this.start,this.startLoc)},rt.startNodeAt=function(e,t){return new it(this,e,t)};function _i(e,t,i,n){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=n),this.options.ranges&&(e.range[1]=i),e}rt.finishNode=function(e,t){return _i.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},rt.finishNodeAt=function(e,t,i,n){return _i.call(this,e,t,i,n)},rt.copyNode=function(e){var t=new it(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var rs="Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz",Ei="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Pi=Ei+" Extended_Pictographic",Ri=Pi,Ni=Ri+" EBase EComp EMod EPres ExtPict",Ti=Ni,ss=Ti,ns={9:Ei,10:Pi,11:Ri,12:Ni,13:Ti,14:ss},as="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",os={9:"",10:"",11:"",12:"",13:"",14:as},Li="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Oi="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",ji=Oi+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Vi=ji+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Fi=Vi+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Di=Fi+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",cs=Di+" "+rs,us={9:Oi,10:ji,11:Vi,12:Fi,13:Di,14:cs},Mi={};function ls(e){var t=Mi[e]={binary:J(ns[e]+" "+Li),binaryOfStrings:J(os[e]),nonBinary:{General_Category:J(Li),Script:J(us[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Jt=0,Bi=[9,10,11,12,13,14];Jt<Bi.length;Jt+=1){var hs=Bi[Jt];ls(hs)}var k=Z.prototype,bt=function(t,i){this.parent=t,this.base=i||this};bt.prototype.separatedFrom=function(t){for(var i=this;i;i=i.parent)for(var n=t;n;n=n.parent)if(i.base===n.base&&i!==n)return!0;return!1},bt.prototype.sibling=function(){return new bt(this.parent,this.base)};var Ae=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Mi[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Ae.prototype.reset=function(t,i,n){var o=n.indexOf("v")!==-1,d=n.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=n,o&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=d&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=d&&this.parser.options.ecmaVersion>=9)},Ae.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},Ae.prototype.at=function(t,i){i===void 0&&(i=!1);var n=this.source,o=n.length;if(t>=o)return-1;var d=n.charCodeAt(t);if(!(i||this.switchU)||d<=55295||d>=57344||t+1>=o)return d;var g=n.charCodeAt(t+1);return g>=56320&&g<=57343?(d<<10)+g-56613888:d},Ae.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var n=this.source,o=n.length;if(t>=o)return o;var d=n.charCodeAt(t),g;return!(i||this.switchU)||d<=55295||d>=57344||t+1>=o||(g=n.charCodeAt(t+1))<56320||g>57343?t+1:t+2},Ae.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)},Ae.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},Ae.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)},Ae.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1},Ae.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var n=this.pos,o=0,d=t;o<d.length;o+=1){var g=d[o],v=this.at(n,i);if(v===-1||v!==g)return!1;n=this.nextIndex(n,i)}return this.pos=n,!0},k.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,n=!1,o=!1,d=0;d<i.length;d++){var g=i.charAt(d);t.indexOf(g)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(g,d+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),g==="u"&&(n=!0),g==="v"&&(o=!0)}this.options.ecmaVersion>=15&&n&&o&&this.raise(e.start,"Invalid regular expression flag")};function ps(e){for(var t in e)return!0;return!1}k.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&ps(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},k.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,i=e.backReferenceNames;t<i.length;t+=1){var n=i[t];e.groupNames[n]||e.raise("Invalid named capture referenced")}},k.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new bt(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")},k.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},k.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1},k.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var i=!1;if(this.options.ecmaVersion>=9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!0}return e.pos=t,!1},k.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},k.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},k.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var n=0,o=-1;if(this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(o=e.lastIntValue),e.eat(125)))return o!==-1&&o<n&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}return!1},k.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},k.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},k.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var i=this.regexp_eatModifiers(e),n=e.eat(45);if(i||n){for(var o=0;o<i.length;o++){var d=i.charAt(o);i.indexOf(d,o+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(n){var g=this.regexp_eatModifiers(e);!i&&!g&&e.current()===58&&e.raise("Invalid regular expression modifiers");for(var v=0;v<g.length;v++){var y=g.charAt(v);(g.indexOf(y,v+1)>-1||i.indexOf(y)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1},k.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1},k.regexp_eatModifiers=function(e){for(var t="",i=0;(i=e.current())!==-1&&fs(i);)t+=se(i),e.advance();return t};function fs(e){return e===105||e===109||e===115}k.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},k.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},k.regexp_eatSyntaxCharacter=function(e){var t=e.current();return $i(t)?(e.lastIntValue=t,e.advance(),!0):!1};function $i(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}k.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!$i(i);)e.advance();return e.pos!==t},k.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1},k.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,i=e.groupNames[e.lastStringValue];if(i)if(t)for(var n=0,o=i;n<o.length;n+=1){var d=o[n];d.separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(i||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},k.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1},k.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=se(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=se(e.lastIntValue);return!0}return!1},k.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,n=e.current(i);return e.advance(i),n===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(n=e.lastIntValue),ds(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function ds(e){return _(e,!0)||e===36||e===95}k.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,n=e.current(i);return e.advance(i),n===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(n=e.lastIntValue),ms(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function ms(e){return M(e,!0)||e===36||e===95||e===8204||e===8205}k.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)},k.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=e.numCapturingParens)return!0;e.pos=t}return!1},k.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1},k.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},k.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},k.regexp_eatZero=function(e){return e.current()===48&&!wt(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1},k.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1},k.regexp_eatControlLetter=function(e){var t=e.current();return Ui(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Ui(e){return e>=65&&e<=90||e>=97&&e<=122}k.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var i=e.pos,n=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(n&&o>=55296&&o<=56319){var d=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var g=e.lastIntValue;if(g>=56320&&g<=57343)return e.lastIntValue=(o-55296)*1024+(g-56320)+65536,!0}e.pos=d,e.lastIntValue=o}return!0}if(n&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&gs(e.lastIntValue))return!0;n&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function gs(e){return e>=0&&e<=1114111}k.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1},k.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var qi=0,Re=1,ke=2;k.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(vs(t))return e.lastIntValue=-1,e.advance(),Re;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=t===80)||t===112)){e.lastIntValue=-1,e.advance();var n;if(e.eat(123)&&(n=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&n===ke&&e.raise("Invalid property name"),n;e.raise("Invalid property name")}return qi};function vs(e){return e===100||e===68||e===115||e===83||e===119||e===87}k.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,n),Re}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var o=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,o)}return qi},k.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){X(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")},k.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Re;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return ke;e.raise("Invalid property name")},k.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Wi(t=e.current());)e.lastStringValue+=se(t),e.advance();return e.lastStringValue!==""};function Wi(e){return Ui(e)||e===95}k.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";xs(t=e.current());)e.lastStringValue+=se(t),e.advance();return e.lastStringValue!==""};function xs(e){return Wi(e)||wt(e)}k.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},k.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&i===ke&&e.raise("Negated character class may contain strings"),!0}return!1},k.regexp_classContents=function(e){return e.current()===93?Re:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Re)},k.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;e.switchU&&(t===-1||i===-1)&&e.raise("Invalid character class"),t!==-1&&i!==-1&&t>i&&e.raise("Range out of order in character class")}}},k.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var i=e.current();(i===99||Gi(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var n=e.current();return n!==93?(e.lastIntValue=n,e.advance(),!0):!1},k.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},k.regexp_classSetExpression=function(e){var t=Re,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===ke&&(t=ke);for(var n=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==ke&&(t=Re);continue}e.raise("Invalid character in character class")}if(n!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(n!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(i=this.regexp_eatClassSetOperand(e),!i)return t;i===ke&&(t=ke)}},k.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;return i!==-1&&n!==-1&&i>n&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},k.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Re:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},k.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),n=this.regexp_classContents(e);if(e.eat(93))return i&&n===ke&&e.raise("Negated character class may contain strings"),n;e.pos=t}if(e.eat(92)){var o=this.regexp_eatCharacterClassEscape(e);if(o)return o;e.pos=t}return null},k.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}else e.raise("Invalid escape");e.pos=t}return null},k.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===ke&&(t=ke);return t},k.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Re:ke},k.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var i=e.current();return i<0||i===e.lookahead()&&ys(i)||bs(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function ys(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function bs(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}k.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return ws(t)?(e.lastIntValue=t,e.advance(),!0):!1};function ws(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}k.regexp_eatClassControlLetter=function(e){var t=e.current();return wt(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},k.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1},k.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;wt(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function wt(e){return e>=48&&e<=57}k.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Hi(i=e.current());)e.lastIntValue=16*e.lastIntValue+zi(i),e.advance();return e.pos!==t};function Hi(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function zi(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}k.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+i*8+e.lastIntValue:e.lastIntValue=t*8+i}else e.lastIntValue=t;return!0}return!1},k.regexp_eatOctalDigit=function(e){var t=e.current();return Gi(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Gi(e){return e>=48&&e<=55}k.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var n=0;n<t;++n){var o=e.current();if(!Hi(o))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+zi(o),e.advance()}return!0};var St=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new G(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},U=Z.prototype;U.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new St(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},U.getToken=function(){return this.next(),new St(this)},typeof Symbol<"u"&&(U[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===a.eof,value:t}}}}),U.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(a.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},U.readToken=function(e){return _(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},U.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var i=this.input.charCodeAt(e+1);return i<=56319||i>=57344?t:(t<<10)+i-56613888},U.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},U.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var n=void 0,o=t;(n=$(this.input,o,this.pos))>-1;)++this.curLine,o=this.lineStart=n;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())},U.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),n=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!j(n);)n=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,i,this.curPosition())},U.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(e>8&&e<14||e>=5760&&te.test(String.fromCharCode(e)))++this.pos;else break e}}},U.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)},U.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(a.ellipsis)):(++this.pos,this.finishToken(a.dot))},U.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(a.assign,2):this.finishOp(a.slash,1)},U.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,n=e===42?a.star:a.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,n=a.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(a.assign,i+1):this.finishOp(n,i)},U.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(a.assign,3)}return this.finishOp(e===124?a.logicalOR:a.logicalAND,2)}return t===61?this.finishOp(a.assign,2):this.finishOp(e===124?a.bitwiseOR:a.bitwiseAND,1)},U.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(a.assign,2):this.finishOp(a.bitwiseXOR,1)},U.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||b.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(a.incDec,2):t===61?this.finishOp(a.assign,2):this.finishOp(a.plusMin,1)},U.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(a.assign,i+1):this.finishOp(a.bitShift,i)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(i=2),this.finishOp(a.relational,i))},U.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(a.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(a.arrow)):this.finishOp(e===61?a.eq:a.prefix,1)},U.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(a.questionDot,2)}if(t===63){if(e>=12){var n=this.input.charCodeAt(this.pos+2);if(n===61)return this.finishOp(a.assign,3)}return this.finishOp(a.coalesce,2)}}return this.finishOp(a.question,1)},U.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),_(t,!0)||t===92))return this.finishToken(a.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+se(t)+"'")},U.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(a.parenL);case 41:return++this.pos,this.finishToken(a.parenR);case 59:return++this.pos,this.finishToken(a.semi);case 44:return++this.pos,this.finishToken(a.comma);case 91:return++this.pos,this.finishToken(a.bracketL);case 93:return++this.pos,this.finishToken(a.bracketR);case 123:return++this.pos,this.finishToken(a.braceL);case 125:return++this.pos,this.finishToken(a.braceR);case 58:return++this.pos,this.finishToken(a.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(a.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===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(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(a.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+se(e)+"'")},U.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)},U.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var n=this.input.charAt(this.pos);if(b.test(n)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if(n==="[")t=!0;else if(n==="]"&&t)t=!1;else if(n==="/"&&!t)break;e=n==="\\"}++this.pos}var o=this.input.slice(i,this.pos);++this.pos;var d=this.pos,g=this.readWord1();this.containsEsc&&this.unexpected(d);var v=this.regexpState||(this.regexpState=new Ae(this));v.reset(i,o,g),this.validateRegExpFlags(v),this.validateRegExpPattern(v);var y=null;try{y=new RegExp(o,g)}catch{}return this.finishToken(a.regexp,{pattern:o,flags:g,value:y})},U.readInt=function(e,t,i){for(var n=this.options.ecmaVersion>=12&&t===void 0,o=i&&this.input.charCodeAt(this.pos)===48,d=this.pos,g=0,v=0,y=0,N=t??1/0;y<N;++y,++this.pos){var D=this.input.charCodeAt(this.pos),Y=void 0;if(n&&D===95){o&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),v===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),y===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),v=D;continue}if(D>=97?Y=D-97+10:D>=65?Y=D-65+10:D>=48&&D<=57?Y=D-48:Y=1/0,Y>=e)break;v=D,g=g*e+Y}return n&&v===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===d||t!=null&&this.pos-d!==t?null:g};function Ss(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Ji(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}U.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return i==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=Ji(this.input.slice(t,this.pos)),++this.pos):_(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,i)},U.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var i=this.pos-t>=2&&this.input.charCodeAt(t)===48;i&&this.strict&&this.raise(t,"Invalid number");var n=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&n===110){var o=Ji(this.input.slice(t,this.pos));return++this.pos,_(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,o)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),n===46&&!i&&(++this.pos,this.readInt(10),n=this.input.charCodeAt(this.pos)),(n===69||n===101)&&!i&&(n=this.input.charCodeAt(++this.pos),(n===43||n===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),_(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var d=Ss(this.input.slice(t,this.pos),i);return this.finishToken(a.num,d)},U.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else t=this.readHexChar(4);return t},U.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var n=this.input.charCodeAt(this.pos);if(n===e)break;n===92?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):n===8232||n===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(j(n)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(a.string,t)};var Ki={};U.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Ki)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},U.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ki;this.raise(e,t)},U.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===a.template||this.type===a.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(a.dollarBraceL)):(++this.pos,this.finishToken(a.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(a.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(j(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
|
|
11
11
|
`;break;default:e+=String.fromCharCode(i);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},U.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(a.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
|
|
12
12
|
`&&++this.pos;case`
|
|
13
13
|
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},U.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
|
|
14
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return
|
|
15
|
-
`,{mode:384}),
|
|
16
|
-
${
|
|
14
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return se(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var n=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],o=parseInt(n,8);return o>255&&(n=n.slice(0,-1),o=parseInt(n,8)),this.pos+=n.length-1,t=this.input.charCodeAt(this.pos),(n!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-n.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(o)}return j(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},U.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i},U.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,n=this.options.ecmaVersion>=6;this.pos<this.input.length;){var o=this.fullCharCodeAtPos();if(M(o,n))this.pos+=o<=65535?1:2;else if(o===92){this.containsEsc=!0,e+=this.input.slice(i,this.pos);var d=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var g=this.readCodePoint();(t?_:M)(g,n)||this.invalidStringToken(d,"Invalid Unicode escape"),e+=se(g),i=this.pos}else break;t=!1}return e+this.input.slice(i,this.pos)},U.readWord=function(){var e=this.readWord1(),t=a.name;return this.keywords.test(e)&&(t=re[e]),this.finishToken(t,e)};var Qi="8.17.0";Z.acorn={Parser:Z,version:Qi,defaultOptions:ae,Position:W,SourceLocation:G,getLineInfo:H,Node:it,TokenType:S,tokTypes:a,keywordTypes:re,TokContext:Se,tokContexts:Q,isIdentifierChar:M,isIdentifierStart:_,Token:St,isNewLine:j,lineBreak:b,lineBreakG:F,nonASCIIwhitespace:te};function ks(e,t){return Z.parse(e,t)}function Cs(e,t,i){return Z.parseExpressionAt(e,t,i)}function Is(e,t){return Z.tokenizer(e,t)}r.Node=it,r.Parser=Z,r.Position=W,r.SourceLocation=G,r.TokContext=Se,r.Token=St,r.TokenType=S,r.defaultOptions=ae,r.getLineInfo=H,r.isIdentifierChar=M,r.isIdentifierStart=_,r.isNewLine=j,r.keywordTypes=re,r.lineBreak=b,r.lineBreakG=F,r.nonASCIIwhitespace=te,r.parse=ks,r.parseExpressionAt=Cs,r.tokContexts=Q,r.tokTypes=a,r.tokenizer=Is,r.version=Qi})});var Er=Ce((pa,_r)=>{var{parse:ln}=Cr();function Ke(){let r=new Error("Configuration reads require a data-only object export. Remove executable statements from frontfriend.config.js.");return r.code="FRONTFRIEND_CONFIG_VALIDATION",r}function Ar(r){if(r.type!=="Property"||r.computed||r.method||r.kind!=="init")throw Ke();let s=r.key.type==="Identifier"?r.key.name:r.key.value;if(typeof s!="string"||["__proto__","constructor","prototype"].includes(s))throw Ke();return s}function Ir(r){if(r.type==="ExportDefaultDeclaration")return r.declaration;let s=r.type==="ExpressionStatement"?r.expression:null;return s?.type==="AssignmentExpression"&&s.operator==="="&&s.left.type==="MemberExpression"&&!s.left.computed&&s.left.object.name==="module"&&s.left.property.name==="exports"?s.right:null}function hn(r,s){if(r.type!=="VariableDeclaration"||r.declarations.length!==1)return null;let[c]=r.declarations;return c.id.type!=="Identifier"||s?.type!=="Identifier"||s.name!==c.id.name?null:c.init}function pn(r){let c=ln(r,{ecmaVersion:"latest",sourceType:"module"}).body.filter(p=>p.type!=="EmptyStatement"&&!p.directive),u=c.length===1?Ir(c[0]):c.length===2?hn(c[0],Ir(c[1])):null;if(u?.type!=="ObjectExpression")throw Ke();function l(p,h=0){if(h>64)throw Ke();if(p.type==="Literal"&&(p.value===null||["string","number","boolean"].includes(typeof p.value)))return p.value;if(p.type==="ArrayExpression")return p.elements.map(f=>{if(!f)throw Ke();return l(f,h+1)});if(p.type==="ObjectExpression")return Object.fromEntries(p.properties.map(f=>[Ar(f),l(f.value,h+1)]));if(p.type==="UnaryExpression"&&["-","+"].includes(p.operator)&&p.argument.type==="Literal"&&typeof p.argument.value=="number")return p.operator==="-"?-p.argument.value:p.argument.value;if(p.type==="TemplateLiteral"&&p.expressions.length===0)return p.quasis[0].value.cooked;if(p.type==="MemberExpression"&&!p.computed&&p.object.type==="MemberExpression"&&!p.object.computed&&p.object.object.name==="process"&&p.object.property.name==="env")return process.env[p.property.name];if(p.type==="LogicalExpression"&&["||","??"].includes(p.operator)){let f=l(p.left,h+1);return p.operator==="||"?f||l(p.right,h+1):f??l(p.right,h+1)}throw Ke()}return{config:l(u),expression:u}}_r.exports={parseStaticConfig:pn,propertyName:Ar}});var Rr=Ce((fa,Pr)=>{var ee=require("fs");function fn(r){try{let s=ee.readFileSync(r,"utf8");return JSON.parse(s)}catch(s){if(s.code==="ENOENT")return null;throw s}}function dn(r){try{return ee.readFileSync(r,"utf8").replace(/^\uFEFF/,"")}catch(s){if(s.code==="ENOENT")return null;throw s}}function mn(r,s,c=2){let u=JSON.stringify(s,null,c);ee.writeFileSync(r,u,"utf8")}function gn(r,s){ee.writeFileSync(r,s,"utf8")}function vn(r,s){if(s==null||typeof s=="object"&&Object.keys(s).length===0||Array.isArray(s)&&s.length===0){let u=`module.exports = ${Array.isArray(s)?"[]":"{}"};`;ee.writeFileSync(r,u,"utf8")}else{let c=`module.exports = ${JSON.stringify(s,null,2)};`;ee.writeFileSync(r,c,"utf8")}}function xn(r){return ee.existsSync(r)}function yn(r){ee.mkdirSync(r,{recursive:!0})}function bn(r){ee.rmSync(r,{recursive:!0,force:!0})}function wn(r){ee.rmSync(r,{force:!0})}function Sn(r,s){ee.mkdirSync(require("path").dirname(r),{recursive:!0,mode:448});let c=`${r}.${process.pid}.${Date.now()}.tmp`;try{ee.writeFileSync(c,`${JSON.stringify(s,null,2)}
|
|
15
|
+
`,{mode:384}),ee.renameSync(c,r);try{ee.chmodSync(r,384)}catch{}}finally{ee.rmSync(c,{force:!0})}}async function kn(r,s,c){ee.mkdirSync(require("path").dirname(r),{recursive:!0,mode:448});let u=`${r}.lock`,l=Date.now()+2e4,p;for(;p===void 0;)try{p=ee.openSync(u,"wx",384),ee.writeFileSync(p,String(process.pid))}catch(h){if(h.code!=="EEXIST")throw h;try{let f=Number(ee.readFileSync(u,"utf8"));if(Number.isInteger(f)&&f>0)try{process.kill(f,0)}catch(m){if(m.code==="ESRCH"){ee.unlinkSync(u);continue}}}catch(f){if(f.code==="ENOENT")continue}if(Date.now()>=l)throw c();await new Promise(f=>setTimeout(f,50))}try{return await s()}finally{ee.closeSync(p),ee.unlinkSync(u)}}Pr.exports={writePrivateJsonFileAtomic:Sn,withPrivateFileLock:kn,readJsonFileSafe:fn,readFileSafe:dn,writeJsonFile:mn,writeTextFile:gn,writeModuleExportsFile:vn,fileExists:xn,ensureDirectoryExists:yn,removeDirectory:bn,removeFile:wn}});var jr=Ce((da,Or)=>{var{parseStaticConfig:ui,propertyName:jt}=Er(),{fileExists:Nr,readFileSafe:li,writeTextFile:hi,readJsonFileSafe:Cn}=Rr(),Qe=require("path"),{normalizeAdopt:Tr}=ci(),{parseProjectTarget:In}=(It(),nt(tr));function Lr(r){try{return Cn(r)??{}}catch{return{}}}function An(r){return Lr(Qe.join(r,"package.json")).name||Qe.basename(r)}function _n(r={}){let s={...r};return delete s.ffId,delete s.appRoot,delete s.adoptExplicit,delete s["auth-token"],delete s.authToken,s}function En(r,s,{ffId:c,name:u,adopt:l,framework:p,primitive:h,apiUrl:f,baseLibrary:m,tag:x}){let w=In({framework:p,primitive:h},"Setup Project target"),I=_n(s),_={name:u.trim(),"ff-id":c.trim(),adopt:Tr(l),framework:w.framework,primitive:w.primitive};if(x!==void 0){if(typeof x!="string"||!x.trim())throw new Error("Release tag must not be empty.");_.tag=x.trim()}if(m!==void 0){if(!["frontfriend","shadcn"].includes(m))throw new Error("Base library must be frontfriend or shadcn.");_.baseLibrary=m}f&&(_["api-url"]=String(f).replace(/\/+$/,""),delete I.apiUrl);for(let[T,P]of Object.entries(I))T in _||(_[T]=P);let M=Qe.join(r,"frontfriend.config.js"),S;if(Nr(M)){let T=li(M),{expression:P}=ui(T),B=new Set(["name","ff-id","adopt","framework","primitive",...x!==void 0?["tag","releaseTagId"]:[],...f?["api-url","apiUrl"]:[],...m!==void 0?["baseLibrary"]:[]]),re=new Set(["auth-token","authToken","ffId","appRoot","adoptExplicit"]),R=P.properties.filter(b=>!B.has(jt(b))&&!re.has(jt(b))).map(b=>T.slice(b.start,b.end));S=[...Object.entries(_).filter(([b])=>B.has(b)).map(([b,F])=>`${JSON.stringify(b)}: ${JSON.stringify(F)}`),...R]}else S=Object.entries(_).map(([T,P])=>`${JSON.stringify(T)}: ${JSON.stringify(P)}`);return hi(M,pi(r,S)),_}function pi(r,s){let c=`{
|
|
16
|
+
${s.join(`,
|
|
17
17
|
`)}
|
|
18
|
-
}`;return
|
|
18
|
+
}`;return Lr(Qe.join(r,"package.json")).type==="module"?`const config = ${c};
|
|
19
19
|
|
|
20
20
|
export default config;
|
|
21
21
|
`:`module.exports = ${c};
|
|
22
|
-
`}function
|
|
23
|
-
`):p}function Pn(r,n,c={}){return Vr(r,n,c,!0)}function Rn(r,n={}){return Vr(r.content,r.path,n,!1)}Fr.exports={PORTABLE_ALIASES:jt,importStrings:li,normalizedSource:Pn,normalizeNativeImports:Rn}});var $r=Se((pa,Br)=>{var le=require("fs"),z=require("path"),{normalizeAdopt:Nn,ADOPTION_LEVELS:Tn}=ni(),{readJsonc:Ln}=ti(),{defaultAppName:On}=Tr(),{PORTABLE_ALIASES:hi,importStrings:Ft,normalizedSource:ct}=Dr(),{readProjectPaths:Mr,resolveConfiguredAlias:jn}=(ot(),st(Pt));function Dt(r){try{return Ln(r)}catch{throw new Error(`Cannot read ${r}.`)}}function Me(r,n){let c=z.relative(r,n);if(!c||c.startsWith(`..${z.sep}`)||c===".."||z.isAbsolute(c))throw new Error(`Source must stay inside the Application: ${n}`);if(le.existsSync(n)&&le.realpathSync(n)!==z.join(le.realpathSync(r),c))throw new Error(`Linked source cannot be imported: ${c}`);return c.replace(/\\/g,"/")}function Vt(r,n,c){let u=jn(r,n,c);return Me(r,u),u}function Vn(r,n,c,u={},l=n){let p=ct(r,n,u);for(let h of Ft(p,n).reverse()){if(h.value.startsWith("@frontfriend-local/")){let g=h.value.slice(19);if(!g||g.split("/").some(w=>w===".."||w==="."))throw new Error("Unsafe local source dependency.");let b=z.posix.relative(z.posix.dirname(l),g);b.startsWith(".")||(b=`./${b}`),p=p.slice(0,h.start)+JSON.stringify(b)+p.slice(h.end);continue}let f=Object.entries(hi).sort((g,b)=>b[1].length-g[1].length).find(([g,b])=>c[g]&&(h.value===b||h.value.startsWith(`${b}/`)));f&&(p=p.slice(0,h.start)+JSON.stringify(c[f[0]]+h.value.slice(f[1].length))+p.slice(h.end))}return p}function pi(r){return le.existsSync(r)?le.readdirSync(r,{withFileTypes:!0}).sort((n,c)=>n.name.localeCompare(c.name)).flatMap(n=>{let c=z.join(r,n.name);if(n.isSymbolicLink())throw new Error(`Linked source cannot be imported: ${c}`);return n.isDirectory()?pi(c):/\.(?:[cm]?[jt]sx?|vue|css)$/.test(n.name)?[c]:[]}):[]}function Fn(r,n,c){let{materializeInstallationPath:u}=(ot(),st(Pt)),l=Mr(r),p=n.aliases||{},h=Vt(r,p.ui||"@/components/ui",l);if(!le.existsSync(h)||!le.statSync(h).isDirectory())throw new Error("The configured UI directory does not exist. Check components.json and TypeScript aliases before import.");let f=new Map((c.canonical||[]).map(a=>[a.canonicalName,a])),g=new Map([...f.values()].flatMap(a=>(a.files||[]).map(x=>[x.path,x]))),b=["",".ts",".tsx",".js",".jsx",".vue","/index.ts","/index.tsx"],w=a=>{let x=a.replace(/\.(?:[cm]?[jt]sx?)$/,"");return x.startsWith("ui/")?`@/components/${x}`:/^(lib|hooks|components)\//.test(x)?`@/${x}`:`@frontfriend-local/${a}`},C=a=>{let x=ct(a.content,a.path,{});for(let P of Ft(x,a.path).reverse()){let $=P.value.startsWith(".")?z.posix.normalize(z.posix.join(z.posix.dirname(a.path),P.value)):P.value.startsWith("@/components/ui/")?P.value.slice(13):P.value.startsWith("@/")?P.value.slice(2):null,H=$&&b.map(ee=>$+ee).find(ee=>g.has(ee));H&&(x=x.slice(0,P.start)+JSON.stringify(w(H))+x.slice(P.end))}return x},I=new Map,E=new Map,_={...Dt(z.join(r,"package.json")).devDependencies,...Dt(z.join(r,"package.json")).dependencies},O=(a,x)=>({source:Me(r,a),target:x,content:le.readFileSync(a,"utf8")}),N=(a,x,P=f.get(a))=>{let $={name:a,files:x,standard:P,dependencies:new Set,npm:new Set};I.set(a,$);for(let H of x){let ee=E.get(H.source);if(ee&&ee!==a)throw new Error(`Source has two component owners: ${H.source}`);E.set(H.source,a)}return $},B=new Map;for(let a of pi(h)){let x=z.relative(h,a).replace(/\\/g,"/"),P=(x.includes("/")?x.split("/")[0]:x.replace(/\.[^.]+$/,"")).replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase(),$=B.get(P)||[];$.push(O(a,`ui/${x}`)),B.set(P,$)}for(let[a,x]of B)N(a,x);for(let[a,x]of f){if(I.has(a)||!x.files?.length||x.files.some($=>$.path.startsWith("ui/")))continue;let P=x.files.map($=>({file:$,relative:u({root:r,source:"canonical",path:$.path,installationLayout:"shadcn"})}));P.every($=>le.existsSync(z.join(r,$.relative)))&&N(a,P.map($=>O(z.join(r,$.relative),$.file.path)),x)}let Z=a=>{let x=Me(r,a);for(let[P,$]of Object.entries(p).sort((H,ee)=>String(ee[1]).length-String(H[1]).length)){if(!hi[P])continue;let H=Vt(r,$,l);if(P==="utils"&&a===H+z.extname(a))return`lib/utils${z.extname(a)}`;if(a.startsWith(`${H}${z.sep}`))return`${P}/${z.relative(H,a).replace(/\\/g,"/")}`}return x},V=(a,x)=>{let P=ct(`import ${JSON.stringify(a)}`,x.source,p).slice(7).trim(),$=JSON.parse(P),H=Object.keys(l.paths).some(te=>a.startsWith(te.split("*")[0]));if(!a.startsWith(".")&&!$.startsWith("@/")&&!H)return null;let ee=a.startsWith(".")?z.resolve(r,z.dirname(x.source),a):Vt(r,a,l),G=b.map(te=>ee+te).find(te=>le.existsSync(te)&&le.statSync(te).isFile());if(!G)throw new Error(`Missing local dependency ${a} in ${x.source}.`);return G};for(let a of I.values()){for(let x of a.files){let P=[];for(let H of Ft(x.content,x.source)){let ee=V(H.value,x);if(!ee){let T=H.value.startsWith("@")?H.value.split("/").slice(0,2).join("/"):H.value.split("/")[0];_[T]&&a.npm.add(`${T}@${_[T]}`);continue}let G=Me(r,ee),te=E.get(G);if(!te){let T=Z(ee);if(te=`support/${T.replace(/\.[^.]+$/,"").replace(/[^a-z0-9/_-]/gi,"-").toLowerCase()}`,I.has(te))throw new Error(`Source address collision: custom/${te}`);N(te,[O(ee,T)],null)}te!==a.name&&a.dependencies.add(te);let Ie=I.get(te).files.find(T=>T.source===G),A=w(Ie.target);P.push({...H,value:A})}let $=x.content;for(let H of P.reverse())$=$.slice(0,H.start)+JSON.stringify(H.value)+$.slice(H.end);x.portable=ct($,x.source,p)}a.identical=!!(a.standard&&a.files.length===a.standard.files.length&&a.files.every(x=>{let P=a.standard.files.find($=>$.path===x.target);return P&&x.portable===C(P)}))}return[...I.values()].filter(a=>!a.identical).map(a=>({name:a.name,address:`custom/${a.name}`,semver:"1.0.0",changelog:"Import the existing Application source.",...a.standard?{replacesCanonical:a.standard.canonicalName}:{},installationLayout:"shadcn",sourceAliases:hi,files:a.files.map(({portable:x,...P})=>({...P,content:x})),npmDependencies:[...a.npm].sort(),componentRequirements:[...a.dependencies].sort().map(x=>{let P=I.get(x);return P.standard&&P.identical?{kind:"canonical",name:P.standard.canonicalName,range:"*",framework:c.projectTarget.framework,primitive:c.projectTarget.primitive}:{kind:"private",name:`custom/${x}`,range:"1.0.0"}})}))}async function Dn({config:r,client:n,dryRun:c=!1}){let u=Nn(r.adopt)||Tn,l=Dt(z.join(r.appRoot,"components.json")),p={appName:r.name||On(r.appRoot),framework:r.framework,primitive:r.primitive,style:l.style,adopt:u},h=await n.importShadcn({phase:"prepare",...p});if(h.initialized)return{...h,skipped:!0};let f=h.release;if(!f?.releaseId||f.baseLibrary!=="shadcn")throw new Error("Initial import requires a pinned shadcn Release.");if(f.projectTarget.framework!==r.framework||f.projectTarget.primitive!==r.primitive)throw new Error("Import target differs from the pinned shadcn Release.");if(f.baseProvenance?.style&&f.baseProvenance.style!==l.style)throw new Error("Import style differs from the pinned shadcn Release.");let g=l.tailwind?.css,b="";if(u.includes("tokens")){if(!g)throw new Error("components.json must declare tailwind.css for native token import.");let C=z.resolve(r.appRoot,g);Me(r.appRoot,C),b=le.readFileSync(C,"utf8")}let w={phase:"complete",...p,sourceReleaseId:f.releaseId,themeCss:b,componentsJson:l,components:u.includes("components")?Fn(r.appRoot,l,f):[]};return c?{dryRun:!0,payload:w}:n.importShadcn(w)}function Mn(r,n){let{materializeInstallationPath:c}=(ot(),st(Pt)),u=Dt(z.join(r.appRoot,"components.json")),l=Vt(r.appRoot,u.aliases?.ui||"@/components/ui",Mr(r.appRoot)),p=new Map(pi(l).map(h=>{let f=z.relative(l,h).replace(/\\/g,"/"),g=Me(r.appRoot,h);return[g,{path:g,target:`ui/${f}`,component:f.split("/")[0].replace(/\.[^.]+$/,""),content:le.readFileSync(h,"utf8")}]}));for(let h of[...n.canonical||[],...n.private||[]])for(let f of h.files||[]){let g=c({root:r.appRoot,source:h.kind,path:f.path,configuredUiPath:r.aliases?.ui,installationLayout:h.installationLayout||(h.source==="shadcn"?"shadcn":void 0)}),b=z.join(r.appRoot,g);le.existsSync(b)&&(Me(r.appRoot,b),p.set(g,{path:g,target:f.path,component:h.address||h.canonicalName,content:le.readFileSync(b,"utf8")}))}return[...p.values()]}Br.exports={importShadcnApplication:Dn,collectNativeMigrationFiles:Mn,normalizedSource:ct,materializeSource:Vn,importStrings:Ft,inside:Me}});var zn={};zt(zn,{AdoptionConflictError:()=>R,ApplicationAdoption:()=>mi,adoptionDigest:()=>At,hashContent:()=>de,parseApplicationLock:()=>$e,serializeApplicationLock:()=>Zt,threeWayMerge:()=>Gt,validateInstallationPath:()=>he,withdrawalWarningsForLock:()=>Hn});module.exports=st(zn);var gi=Je(require("node:crypto")),F=Je(require("node:fs")),D=Je(require("node:path"));kt();function De(r){return r&&typeof r=="object"&&"code"in r?String(r.code):void 0}function Ct(r){return r instanceof Error?r.message:String(r)}var R=class extends Error{constructor(c,u=[]){super(c);this.code="ADOPTION_CONFLICT";this.name="AdoptionConflictError",this.conflicts=u}};kt();var tr=Je(require("node:crypto")),Rs=2e6,Zi=1e5;function de(r){return tr.default.createHash("sha256").update(Buffer.from(r)).digest("hex")}function nt(r){return String(r).match(/.*(?:\n|$)/g).filter(n=>n!=="")}function er(r,n){let c=nt(r),u=nt(n),l=Array.from({length:c.length+1},()=>new Uint32Array(u.length+1));for(let w=c.length-1;w>=0;w-=1)for(let C=u.length-1;C>=0;C-=1)l[w][C]=c[w]===u[C]?l[w+1][C+1]+1:Math.max(l[w+1][C],l[w][C+1]);let p=[],h=0,f=0,g=null,b=()=>{g&&p.push(g),g=null};for(;h<c.length||f<u.length;)h<c.length&&f<u.length&&c[h]===u[f]?(b(),h+=1,f+=1):f<u.length&&(h===c.length||l[h][f+1]>l[h+1][f])?(g||={start:h,end:h,replacement:[]},g.replacement.push(u[f]),f+=1):(g||={start:h,end:h,replacement:[]},h+=1,g.end=h);return b(),{base:c,hunks:p}}function Ns(r,n){return r.start===r.end&&n.start===n.end?r.start===n.start:r.start===r.end?r.start>=n.start&&r.start<n.end:n.start===n.end?n.start>=r.start&&n.start<r.end:r.start<n.end&&n.start<r.end}function Gt(r,n,c){let u=nt(r).length,l=Math.max(nt(n).length,nt(c).length);if(u>Zi||l>Zi||(u+1)*(l+1)>Rs)return null;let p=er(r,n),h=er(r,c),f=[...p.hunks];for(let w of h.hunks){let C=f.find(I=>Ns(I,w));if(C){if(C.start===w.start&&C.end===w.end&&C.replacement.join("")===w.replacement.join(""))continue;return null}f.push(w)}let g="",b=0;for(let w of f.sort((C,I)=>C.start-I.start||C.end-I.end))g+=p.base.slice(b,w.start).join(""),g+=w.replacement.join(""),b=w.end;return g+p.base.slice(b).join("")}var{isSafeSlug:Bs}=Xt();function Pe(r){return Object.fromEntries(Object.entries(r).sort(([n],[c])=>n.localeCompare(c)).map(([n,c])=>[n,c&&typeof c=="object"&&!Array.isArray(c)?{...c,...Array.isArray(c.files)?{files:[...c.files].sort((u,l)=>u.path.localeCompare(l.path))}:{}}:c]))}function It(r){return Array.isArray(r)?r.map(It):r&&typeof r=="object"?Object.fromEntries(Object.keys(r).filter(n=>n!=="adoptionDigest").sort().map(n=>[n,It(r[n])])):r}function At(r){return de(JSON.stringify(It(r)))}function nr(r){let n=r;if(!n||![1,2,3].includes(Number(n.schemaVersion))||typeof n.components!="object"||n.components===null)throw new R("Unsupported or malformed frontfriend.lock.json.");let c=Object.fromEntries(Object.entries(n.components).map(([f,g])=>{let b=g;if(!b||!["canonical","private"].includes(String(b.source))||typeof b.versionId!="string"||typeof b.semver!="string")throw new R(`Unsupported source kind for ${f}.`);return[f,b]})),u={releaseId:n.releaseId==null?null:String(n.releaseId),tokenVersionId:String(n.tokenVersionId),projectTarget:n.schemaVersion===3&&n.projectTarget===null&&Object.keys(c).length===0?null:ve(n.projectTarget,"Application lock target"),components:c};for(let f of Object.values(c)){if(!f.projectTarget)continue;let g=ve(f.projectTarget,"Component adoption target");if(!u.projectTarget||g.framework!==u.projectTarget.framework||g.primitive!==u.projectTarget.primitive)throw new R("Component adoption belongs to another Project target.")}if(n.schemaVersion===1)return{...u,projectTarget:ve(n.projectTarget,"Application lock target"),schemaVersion:1,components:c};if(typeof n.designSystemId!="string"||!n.designSystemId||typeof n.ffId!="string"||!n.ffId||typeof n.adoptionDigest!="string"||!n.adoptionDigest||typeof n.tokenSourceReleaseId!="string"||!n.tokenSourceReleaseId||!Array.isArray(n.sourceReleaseIds))throw new R("Malformed v2 Frontfriend adoption snapshot.");let l={...u,schemaVersion:n.schemaVersion===3?3:2,...n.schemaVersion===3?{design:n.design}:{},designSystemId:n.designSystemId,ffId:n.ffId,...n.baseLibrary!==void 0?{baseLibrary:n.baseLibrary}:{},...n.baseProvenance!==void 0?{baseProvenance:n.baseProvenance}:{},...n.replacements!==void 0?{replacements:n.replacements}:{},adoptionDigest:n.adoptionDigest,tokenSourceReleaseId:n.tokenSourceReleaseId,sourceReleaseIds:[...new Set(n.sourceReleaseIds.map(String))].sort(),components:c};if(l.baseLibrary!==void 0&&!["frontfriend","shadcn"].includes(l.baseLibrary))throw new R("Unsupported base library in Application lock.");if(l.schemaVersion===3){let f=l.design;if(!f||f.designSystemId!==l.designSystemId||!f.appId||!f.snapshotId||!f.sharedSourceReleaseId||!Array.isArray(f.contracts)||!Array.isArray(f.sharedContracts))throw new R("Malformed Application design adoption.");let g=[...f.sharedContracts,...f.contracts];if(new Set(g.map(w=>w.slug)).size!==g.length||g.some(w=>w.designSystemId!==l.designSystemId||!w.revisionId||!w.contractId||!Bs(w.slug)||!w.slug.endsWith(".md")||!Number.isInteger(w.version)||w.version<1||!/^[a-f0-9]{64}$/.test(w.digest)))throw new R("Invalid contract revision pins in the Application lock.");if(f.sharedContracts.some(w=>!["guidelines","design-context","guideline-chapter","layout","pattern"].includes(w.kind))||f.contracts.some(w=>!["app-context","page"].includes(w.kind)))throw new R("Contract pins have invalid shared or App ownership.");if(de(JSON.stringify(It({schemaVersion:1,appId:f.appId,sharedSourceReleaseId:f.sharedSourceReleaseId,contracts:[...f.contracts].sort((w,C)=>w.slug.localeCompare(C.slug))})))!==f.snapshotDigest)throw new R("Application design snapshot digest does not match its manifest.")}else if(n.design!==void 0)throw new R("Contract pins require a schema version 3 Application lock.");let p=Object.values(l.components).map(f=>{if(typeof f.sourceReleaseId!="string"||!f.sourceReleaseId)throw new R("Every v2 component adoption must identify its immutable source Release.");return f.sourceReleaseId}),h=[...new Set([l.tokenSourceReleaseId,...p,...l.design?[l.design.sharedSourceReleaseId]:[]])].sort();if(JSON.stringify(h)!==JSON.stringify(l.sourceReleaseIds))throw new R("The adoption source Releases do not match the token and component provenance.");if(l.releaseId&&(h.length!==1||h[0]!==l.releaseId))throw new R("A lock may reference a Release only when its complete closure matches that Release.");if(At(l)!==l.adoptionDigest)throw new R("The adoption snapshot digest does not match its manifest.");return l}function $e(r){try{return nr(typeof r=="string"?JSON.parse(r):r)}catch(n){throw n instanceof R?n:new R(`Invalid frontfriend.lock.json: ${n instanceof Error?n.message:String(n)}`)}}function Zt(r){let n=nr(r);return`${JSON.stringify({...n,components:Pe(n.components)},null,2)}
|
|
24
|
-
`}
|
|
25
|
-
`),p}catch(p){if(De(p)!=="EEXIST"||!l)throw p;let h;try{h=JSON.parse(F.default.readFileSync(n,"utf8"))}catch{throw new R("Another update holds an invalid mutation lock; remove it only after verifying no updater is active.")}if(h?.schemaVersion!==1||!Number.isInteger(h.pid))throw new R("Another update holds an invalid mutation lock; remove it only after verifying no updater is active.");try{throw process.kill(h.pid,0),new R(`Another Frontfriend update is active (pid ${h.pid}).`)}catch(f){if(f instanceof R||De(f)!=="ESRCH")throw f}return F.default.unlinkSync(n),c(!1)}};try{this.mutationLockFd=c(!0)}catch(l){throw l instanceof R?l:new R(`Could not acquire the application update lock: ${Ct(l)}`)}this.mutationLockDepth=1;let u=!1;return()=>{u||(u=!0,this.mutationLockDepth-=1,this.mutationLockDepth===0&&(F.default.closeSync(this.mutationLockFd),this.mutationLockFd=null,F.default.unlinkSync(n)))}}recoverPendingTransactions(){if(this.usesFilesystem&&this.mutationLockDepth===0)throw new R("Recovery requires the exclusive application update lock.");if(F.default.existsSync(this.root))for(let n of F.default.readdirSync(this.root)){if(!/^\.frontfriend-transaction-\d+-[0-9a-f]{12}$/.test(n))continue;let c=D.default.join(this.root,n),u=D.default.join(c,"journal.json"),l;try{l=JSON.parse(F.default.readFileSync(u,"utf8"))}catch{throw new R(`Cannot recover ${n}: its transaction journal is missing or corrupt.`)}if(l?.schemaVersion!==1||!["prepared","committing","committed"].includes(l.state)||!Array.isArray(l.paths)||l.renames!=null&&!Array.isArray(l.renames))throw new R(`Cannot recover ${n}: invalid transaction journal.`);if(l.state==="committing"){for(let p of l.paths||[]){let h=he(p.path),f=D.default.join(this.root,h),g=D.default.join(c,"backup",h);if(p.existed)F.default.mkdirSync(D.default.dirname(f),{recursive:!0}),F.default.copyFileSync(g,f);else try{F.default.unlinkSync(f)}catch(b){if(De(b)!=="ENOENT")throw b}}Wr(this.root,c,l.renames)}F.default.rmSync(c,{recursive:!0,force:!0})}}inspect(n,c={}){Ur(n);let u=ve(n.projectTarget,"Resolved Release target"),l=null;if(c.currentLock){if(l=$e(c.currentLock),l.projectTarget&&Te(l.projectTarget)!==Te(u))throw new R("Project target mismatch between Release and lock.");if(l.schemaVersion!==1&&(l.designSystemId!==n.designSystemId||l.ffId!==n.ffId))throw new R("Design System mismatch between Release and lock.");qr(l,n)}let p={},h=[],f=[];for(let g of lt(n)){let b=di(g),w=l?.components?.[b]||null,C=g.files.map(N=>{let B=this.installationPath(g,N.path),Z=this.readFile(B);return{path:B,status:Z==null?"available":de(Z)===de(this.installationSource(g,N.path,N.content))?"exact":"drifted"}}),I=new Set(C.map(N=>N.status)),E=w&&(w.files||[]).some(N=>{let B=this.readFile(N.path);return B==null||de(B)!==N.baselineHash}),_=w&&w.versionId!==g.id,O=E?"drifted":_?"update-available":I.has("drifted")?"drifted":I.has("available")?"available":"exact";p[b]={source:fi(g),status:O,versionId:g.id,semver:g.semver,changelog:g.changelog,files:C},(!w||_)&&g.changelog&&!h.includes(g.changelog)&&h.push(g.changelog),g.withdrawnAt&&f.push(`${b}@${g.semver} is withdrawn${g.withdrawalReason?`: ${g.withdrawalReason}`:"."}${g.correctedVersionId?` Use corrected version ${g.correctedVersionId}.`:""}`)}return{releaseId:n.releaseId,tokenVersionId:n.tokenVersionId,projectTarget:u,token:{versionId:n.tokenVersionId,status:l?l.tokenVersionId===n.tokenVersionId?"exact":"update-available":"available"},components:p,changelogs:h,warnings:f}}diff(n){let c=$e(n),u=[];for(let[l,p]of Object.entries(c.components))for(let h of p.files||[]){let f=this.readFile(h.path);u.push({component:l,source:p.source,path:h.path,baselineHash:h.baselineHash,currentHash:f==null?null:de(f),status:f==null?"missing":de(f)===h.baselineHash?"unchanged":"modified"})}return u.sort((l,p)=>l.path.localeCompare(p.path))}planUpdate(n,c={}){Ur(n);let u=c.currentLock?$e(c.currentLock):null;if(n.contractsOnly&&(!c.design||c.components?.length!==0||lt(n).length))throw new R("Contract-only resolution requires an exact design selection and no incoming component source.");let l=n.contractsOnly?u?.projectTarget??null:ve(n.projectTarget,"Resolved Release target");if(!n.contractsOnly&&l&&u?.projectTarget&&Te(u.projectTarget)!==Te(l))throw new R("Project target mismatch between config, Release and lock.");if(u&&u.schemaVersion!==1&&(u.designSystemId!==n.designSystemId||u.ffId!==n.ffId))throw new R("Design System mismatch between config, Release and lock.");qr(u,n);let p=c.components?new Set(c.components):null,h=new Set,f=u?{...u.components}:{},g={},b=new Set,w=[],C=[],I=new Set,E=[],_=new Map,O=new Map,N=new Map;for(let[A,T]of Object.entries(u?.components||{}))for(let ie of T.files||[])N.set(ie.path.toLocaleLowerCase("en-US"),A);for(let A of lt(n)){let T=di(A);if(p&&!p.has(T))continue;for(let q of A.npmDependencies||[])I.add(q);let ie=u?.components?.[T]||null;if(A.kind==="private"&&n.capabilities?.freshPrivateSelection!==!0&&ie?.versionId!==A.id){E.push({component:T,reason:"the current subscription permits only the exact private version already pinned in frontfriend.lock.json"});continue}if(A.kind==="canonical"&&!n.capabilities?.freshCanonicalSelection?.includes(T)&&ie?.versionId!==A.id){E.push({component:T,reason:"the current catalogue permits only the exact canonical version already pinned in frontfriend.lock.json"});continue}if(A.withdrawnAt&&ie?.versionId!==A.id){E.push({component:T,reason:`${T}@${A.semver} is withdrawn and cannot be freshly installed${A.withdrawalReason?`: ${A.withdrawalReason}`:""}`});continue}let Ae=[];for(let q of A.files){let Q={...q,content:this.installationSource(A,q.path,q.content)},W=this.installationPath(A,Q.path),re=W.toLocaleLowerCase("en-US"),pe=N.get(re);if(pe&&pe!==T){if(!c.allowReplacement){E.push({path:W,reason:`owned by ${pe}; explicit replacement is required`});continue}let ne=f[pe];if(ne){let qe=(ne.files||[]).filter(ht=>ht.path.toLocaleLowerCase("en-US")!==re);qe.length===0?delete f[pe]:f[pe]={...ne,files:qe}}}let je=_.get(re),Ue=O.get(re);if(Ue&&Ue!==T){E.push({path:W,reason:`also claimed by ${Ue}`});continue}if(je&&je!==W){E.push({path:W,reason:`case collision with ${je}`});continue}_.set(re,W),O.set(re,T);let ke=ie?.files?.find(ne=>ne.path===W)||ie?.files?.find(ne=>ne.path.toLocaleLowerCase("en-US")===re)||(c.allowReplacement&&pe?u?.components?.[pe]?.files?.find(ne=>ne.path.toLocaleLowerCase("en-US")===re):null),Xe=ke&&ke.path!==W&&ke.path.toLocaleLowerCase("en-US")===re;if(Xe&&D.default.posix.dirname(ke.path)!==D.default.posix.dirname(W)){E.push({path:W,reason:"case-only parent directory renames require an explicit filesystem migration"});continue}let se=this.readFile(Xe?ke.path:W),Ce=ke?.baseline??null,fe=se;if(se==null)g[W]=Q.content,fe=Q.content;else if(ke)if(de(se)===ke.baselineHash)g[W]=Q.content,fe=Q.content;else if(Ce===Q.content||se===Q.content)fe=se;else{let ne=Ce==null?null:Gt(Ce,se,Q.content);ne==null?E.push({path:W,reason:"local and incoming source both changed"}):(g[W]=ne,fe=ne)}else se===Q.content?fe=se:c.allowReplacement?(g[W]=Q.content,fe=Q.content):E.push({path:W,reason:"unmanaged file already exists"});Xe&&fe!=null&&(g[W]=fe,w.push({from:ke.path,to:W})),Ae.push({path:W,installedHash:fe==null?null:de(fe),baselineHash:de(Q.content),baseline:Q.content})}let ge=new Set(Ae.map(q=>q.path.toLocaleLowerCase("en-US")));for(let q of ie?.files||[]){if(ge.has(q.path.toLocaleLowerCase("en-US")))continue;let Q=this.readFile(q.path);Q!=null&&(de(Q)===q.baselineHash?b.add(q.path):E.push({path:q.path,reason:"removed upstream but modified locally"}))}f[T]={source:fi(A),versionId:A.id,semver:A.semver,manifestHash:A.digest,sourceReleaseId:n.releaseId,...A.projectTarget?{projectTarget:ve(A.projectTarget,"Component Project target")}:{},files:Ae},h.add(T),(!ie||ie.versionId!==A.id)&&C.push(A.changelog)}if(E.length>0)throw new R(`Update plan has conflicts; files and lock were not changed: ${E[0].reason}.`,E);let B=!!p,Z=B&&u&&!c.adoptTokens,V=Z?u.tokenVersionId:n.tokenVersionId,a=Z&&(("tokenSourceReleaseId"in u?u.tokenSourceReleaseId:void 0)||u.releaseId)||n.releaseId,x=u&&u.schemaVersion!==1?u.design:void 0,P=c.design??(B?x:void 0);if(!B&&n.contracts!==void 0&&!P)throw new R("Select an exact Application design snapshot before adopting this Release.");if(!B&&x&&!P)throw new R("A Release without contract pins cannot silently remove adopted contract pins.");if(P&&P.designSystemId!==n.designSystemId)throw new R("Design snapshot belongs to another Design System.");if(c.design&&JSON.stringify(Pe(Object.fromEntries(c.design.sharedContracts.map(A=>[A.slug,A]))))!==JSON.stringify(Pe(Object.fromEntries((n.contracts??[]).map(A=>[A.slug,A])))))throw new R("Design snapshot does not match the selected Release contract set.");let $=[...new Set([a,...P?[P.sharedSourceReleaseId]:[],...Object.values(f).map(A=>A.sourceReleaseId||u?.releaseId||n.releaseId)].filter(Boolean))].sort(),H=(n.replacements||[]).filter(A=>{let T=f[A.privateAddress],ie=n.private?.find(Ae=>Ae.address===A.privateAddress);return A.framework===l?.framework&&A.primitive===l?.primitive&&T?.source==="private"&&T.sourceReleaseId===n.releaseId&&T.versionId===ie?.id}),ee=new Set(H.map(ut)),te=[...(u&&"replacements"in u?u.replacements||[]:[]).filter(A=>{let T=f[A.privateAddress],ie=u?.components[A.privateAddress];return T?.source==="private"&&T.versionId===ie?.versionId&&T.sourceReleaseId===ie?.sourceReleaseId&&!h.has(A.privateAddress)&&!h.has(A.canonicalName)&&!ee.has(ut(A))}),...H].sort((A,T)=>ut(A).localeCompare(ut(T))),Ie={schemaVersion:P?3:2,...P?{design:P}:{},...n.replacements!==void 0||u&&"replacements"in u?{replacements:te}:{},designSystemId:n.designSystemId,ffId:n.ffId,...(Z&&"baseLibrary"in u?u.baseLibrary:n.baseLibrary)?{baseLibrary:Z&&"baseLibrary"in u?u.baseLibrary:n.baseLibrary}:{},...(Z&&"baseProvenance"in u?u.baseProvenance:n.baseProvenance)?{baseProvenance:Z&&"baseProvenance"in u?u.baseProvenance:n.baseProvenance}:{},releaseId:null,tokenVersionId:V,tokenSourceReleaseId:a,sourceReleaseIds:$,projectTarget:l,components:f,adoptionDigest:""};if(Hr(Ie,n)&&(Ie.releaseId=n.releaseId),Ie.adoptionDigest=At(Ie),$e(Ie),c.designMirror){let A=c.designMirror,T;try{T=Un(A,P,n.ffId)}catch(q){throw new R(Ct(q))}let ie=new Set([...Object.keys($n(D.default.join(this.root,Mt))),...x?[...x.sharedContracts,...x.contracts].map(q=>q.slug):[],...T.map(q=>q.slug),"README.md"]),Ae=Object.fromEntries([...ie].flatMap(q=>{let Q=this.readFile(`${Mt}/${q}`);return Q===null?[]:[[q,Q]]})),ge=Bn(A,Ae);for(let[q,Q]of Object.entries(ge.writes)){let W=he(`${Mt}/${q}`);if(g[W]!==void 0||Object.values(f).some(re=>re.files?.some(pe=>pe.path===W)))throw new R("A component cannot own a contract mirror path.");g[W]=Q}for(let q of ge.deletes)b.add(he(`${Mt}/${q}`))}else if(c.design&&(c.design.contracts.length||c.design.sharedContracts.length))throw new R("Fetch the exact contract mirror before applying a new design adoption.");return{valid:!0,writes:Pe(g),deletes:[...b].filter(A=>!Object.keys(g).some(T=>T.toLocaleLowerCase("en-US")===A.toLocaleLowerCase("en-US"))).sort(),renames:w.sort((A,T)=>A.from.localeCompare(T.from)),nextLock:Ie,changelogs:C.filter(Boolean),npmDependencies:[...I].sort()}}apply(n,c={}){if(!n?.valid)throw new R("Only a validated update plan can be applied.");let u=this.mutationLockDepth===0?this.acquireMutationLock():()=>{};try{this.usesFilesystem&&this.recoverPendingTransactions();let l="frontfriend.lock.json",p=[...new Set([...Object.keys(n.writes),...n.deletes||[],...(n.renames||[]).flatMap(C=>[C.from,C.to]),l])],h=D.default.join(this.root,`.frontfriend-transaction-${process.pid}-${gi.default.randomBytes(6).toString("hex")}`),f=D.default.join(h,"stage"),g=D.default.join(h,"backup"),b=p.map(C=>({path:he(C),existed:this.readFile(C)!=null})),w=!1;try{F.default.mkdirSync(f,{recursive:!0});for(let[O,N]of Object.entries(n.writes)){let B=D.default.join(f,he(O));F.default.mkdirSync(D.default.dirname(B),{recursive:!0}),F.default.writeFileSync(B,N)}F.default.writeFileSync(D.default.join(f,l),Zt(n.nextLock));for(let O of b){if(!O.existed)continue;let N=D.default.join(g,O.path);F.default.mkdirSync(D.default.dirname(N),{recursive:!0}),F.default.copyFileSync(D.default.join(this.root,O.path),N)}let C=D.default.join(h,"journal.json"),I={schemaVersion:1,state:"prepared",paths:b,renames:n.renames||[]};F.default.writeFileSync(C,`${JSON.stringify(I)}
|
|
26
|
-
`),
|
|
27
|
-
`);let
|
|
28
|
-
`),w=!0,
|
|
22
|
+
`}function Pn(r,s){let c=Qe.join(r,"frontfriend.config.js");if(!s||!Nr(c))return!1;let u=li(c),{config:l,expression:p}=ui(u);if(l["api-url"]||l.apiUrl)return!1;let h=[...p.properties.map(f=>u.slice(f.start,f.end)),`${JSON.stringify("api-url")}: ${JSON.stringify(String(s).replace(/\/+$/,""))}`];return hi(c,pi(r,h)),!0}function Rn(r,s){let c=Qe.join(r,"frontfriend.config.js"),u=li(c),{expression:l}=ui(u),p=Tr(s),h=`${JSON.stringify("adopt")}: ${JSON.stringify(p)}`,f=l.properties.map(m=>jt(m)==="adopt"?h:u.slice(m.start,m.end));return l.properties.some(m=>jt(m)==="adopt")||f.push(h),hi(c,pi(r,f)),p}Or.exports={defaultAppName:An,writeSetupConfig:En,writeConfigApiUrl:Pn,writeConfigAdopt:Rn}});var Dr=Ce((ma,Fr)=>{var Vr=require("path"),{createRequire:Nn}=require("module"),Vt;function Tn(r){if(Vt)return Vt;let s=[null,r&&Vr.isAbsolute(r)?r:null,Vr.join(process.cwd(),"package.json")];for(let u of s)try{return Vt=u?Nn(u)("typescript"):require("typescript"),Vt}catch{}let c=new Error("Reading component source or build configuration needs TypeScript: install it in the Application (npm i -D typescript).");throw c.code="FF_TYPESCRIPT_UNAVAILABLE",c}Fr.exports={loadTypeScript:Tn}});var $r=Ce((va,Br)=>{var ga=require("path"),{loadTypeScript:Ln}=Dr(),Ft={ui:"@/components/ui",components:"@/components",utils:"@/lib/utils",lib:"@/lib",hooks:"@/hooks"};function fi(r,s){if(s.endsWith(".vue"))return[...r.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/gi)].flatMap(h=>{let f=h.index+h[0].indexOf(">")+1;return fi(h[1],`${s}.ts`).map(m=>({...m,start:m.start+f,end:m.end+f}))});let c=Ln(s),u=c.createSourceFile(s,r,c.ScriptTarget.Latest,!0,s.endsWith(".tsx")?c.ScriptKind.TSX:c.ScriptKind.TS),l=[],p=h=>{let f=c.isImportDeclaration(h)||c.isExportDeclaration(h)?h.moduleSpecifier:c.isCallExpression(h)&&(h.expression.kind===c.SyntaxKind.ImportKeyword||h.expression.getText(u)==="require")?h.arguments[0]:null;f&&c.isStringLiteral(f)&&l.push({value:f.text,start:f.getStart(u),end:f.end}),c.forEachChild(h,p)};return p(u),l}function Mr(r,s,c,u){let l=fi(r,s).map(h=>{let f=h.value.replace(/^@\/registry\/(?:bases\/)?[^/]+\/(ui|lib|hooks|components)\//,(m,x)=>`${Ft[x]}/`);for(let[m,x]of Object.entries(c).sort((w,I)=>String(I[1]).length-String(w[1]).length))if(Ft[m]&&(f===x||f.startsWith(`${x}/`))){f=Ft[m]+f.slice(x.length);break}return{...h,normalized:f}}),p=r;for(let h of l.reverse())(u||h.value!==h.normalized)&&(p=p.slice(0,h.start)+JSON.stringify(h.normalized)+p.slice(h.end));return u?p.replace(/\r\n/g,`
|
|
23
|
+
`):p}function On(r,s,c={}){return Mr(r,s,c,!0)}function jn(r,s={}){return Mr(r.content,r.path,s,!1)}Br.exports={PORTABLE_ALIASES:Ft,importStrings:fi,normalizedSource:On,normalizeNativeImports:jn}});var Wr=Ce((xa,qr)=>{var pe=require("fs"),K=require("path"),{normalizeAdopt:Vn,ADOPTION_LEVELS:Fn}=ci(),{readJsonc:Dn}=si(),{defaultAppName:Mn}=jr(),{PORTABLE_ALIASES:di,importStrings:Mt,normalizedSource:ut}=$r(),{readProjectPaths:Ur,resolveConfiguredAlias:Bn}=(ct(),nt(Nt));function Bt(r){try{return Dn(r)}catch{throw new Error(`Cannot read ${r}.`)}}function De(r,s){let c=K.relative(r,s);if(!c||c.startsWith(`..${K.sep}`)||c===".."||K.isAbsolute(c))throw new Error(`Source must stay inside the Application: ${s}`);if(pe.existsSync(s)&&pe.realpathSync(s)!==K.join(pe.realpathSync(r),c))throw new Error(`Linked source cannot be imported: ${c}`);return c.replace(/\\/g,"/")}function Dt(r,s,c){let u=Bn(r,s,c);return De(r,u),u}function $n(r,s,c,u={},l=s){let p=ut(r,s,u);for(let h of Mt(p,s).reverse()){if(h.value.startsWith("@frontfriend-local/")){let m=h.value.slice(19);if(!m||m.split("/").some(w=>w===".."||w==="."))throw new Error("Unsafe local source dependency.");let x=K.posix.relative(K.posix.dirname(l),m);x.startsWith(".")||(x=`./${x}`),p=p.slice(0,h.start)+JSON.stringify(x)+p.slice(h.end);continue}let f=Object.entries(di).sort((m,x)=>x[1].length-m[1].length).find(([m,x])=>c[m]&&(h.value===x||h.value.startsWith(`${x}/`)));f&&(p=p.slice(0,h.start)+JSON.stringify(c[f[0]]+h.value.slice(f[1].length))+p.slice(h.end))}return p}function mi(r){return pe.existsSync(r)?pe.readdirSync(r,{withFileTypes:!0}).sort((s,c)=>s.name.localeCompare(c.name)).flatMap(s=>{let c=K.join(r,s.name);if(s.isSymbolicLink())throw new Error(`Linked source cannot be imported: ${c}`);return s.isDirectory()?mi(c):/\.(?:[cm]?[jt]sx?|vue|css)$/.test(s.name)?[c]:[]}):[]}function Un(r,s,c){let{materializeInstallationPath:u}=(ct(),nt(Nt)),l=Ur(r),p=s.aliases||{},h=Dt(r,p.ui||"@/components/ui",l);if(!pe.existsSync(h)||!pe.statSync(h).isDirectory())throw new Error("The configured UI directory does not exist. Check components.json and TypeScript aliases before import.");let f=new Map((c.canonical||[]).map(a=>[a.canonicalName,a])),m=new Map([...f.values()].flatMap(a=>(a.files||[]).map(b=>[b.path,b]))),x=["",".ts",".tsx",".js",".jsx",".vue","/index.ts","/index.tsx"],w=a=>{let b=a.replace(/\.(?:[cm]?[jt]sx?)$/,"");return b.startsWith("ui/")?`@/components/${b}`:/^(lib|hooks|components)\//.test(b)?`@/${b}`:`@frontfriend-local/${a}`},I=a=>{let b=ut(a.content,a.path,{});for(let F of Mt(b,a.path).reverse()){let j=F.value.startsWith(".")?K.posix.normalize(K.posix.join(K.posix.dirname(a.path),F.value)):F.value.startsWith("@/components/ui/")?F.value.slice(13):F.value.startsWith("@/")?F.value.slice(2):null,$=j&&x.map(te=>j+te).find(te=>m.has(te));$&&(b=b.slice(0,F.start)+JSON.stringify(w($))+b.slice(F.end))}return b},_=new Map,M=new Map,S={...Bt(K.join(r,"package.json")).devDependencies,...Bt(K.join(r,"package.json")).dependencies},T=(a,b)=>({source:De(r,a),target:b,content:pe.readFileSync(a,"utf8")}),P=(a,b,F=f.get(a))=>{let j={name:a,files:b,standard:F,dependencies:new Set,npm:new Set};_.set(a,j);for(let $ of b){let te=M.get($.source);if(te&&te!==a)throw new Error(`Source has two component owners: ${$.source}`);M.set($.source,a)}return j},B=new Map;for(let a of mi(h)){let b=K.relative(h,a).replace(/\\/g,"/"),F=(b.includes("/")?b.split("/")[0]:b.replace(/\.[^.]+$/,"")).replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase(),j=B.get(F)||[];j.push(T(a,`ui/${b}`)),B.set(F,j)}for(let[a,b]of B)P(a,b);for(let[a,b]of f){if(_.has(a)||!b.files?.length||b.files.some(j=>j.path.startsWith("ui/")))continue;let F=b.files.map(j=>({file:j,relative:u({root:r,source:"canonical",path:j.path,installationLayout:"shadcn"})}));F.every(j=>pe.existsSync(K.join(r,j.relative)))&&P(a,F.map(j=>T(K.join(r,j.relative),j.file.path)),b)}let re=a=>{let b=De(r,a);for(let[F,j]of Object.entries(p).sort(($,te)=>String(te[1]).length-String($[1]).length)){if(!di[F])continue;let $=Dt(r,j,l);if(F==="utils"&&a===$+K.extname(a))return`lib/utils${K.extname(a)}`;if(a.startsWith(`${$}${K.sep}`))return`${F}/${K.relative($,a).replace(/\\/g,"/")}`}return b},R=(a,b)=>{let F=ut(`import ${JSON.stringify(a)}`,b.source,p).slice(7).trim(),j=JSON.parse(F),$=Object.keys(l.paths).some(ie=>a.startsWith(ie.split("*")[0]));if(!a.startsWith(".")&&!j.startsWith("@/")&&!$)return null;let te=a.startsWith(".")?K.resolve(r,K.dirname(b.source),a):Dt(r,a,l),z=x.map(ie=>te+ie).find(ie=>pe.existsSync(ie)&&pe.statSync(ie).isFile());if(!z)throw new Error(`Missing local dependency ${a} in ${b.source}.`);return z};for(let a of _.values()){for(let b of a.files){let F=[];for(let $ of Mt(b.content,b.source)){let te=R($.value,b);if(!te){let X=$.value.startsWith("@")?$.value.split("/").slice(0,2).join("/"):$.value.split("/")[0];S[X]&&a.npm.add(`${X}@${S[X]}`);continue}let z=De(r,te),ie=M.get(z);if(!ie){let X=re(te);if(ie=`support/${X.replace(/\.[^.]+$/,"").replace(/[^a-z0-9/_-]/gi,"-").toLowerCase()}`,_.has(ie))throw new Error(`Source address collision: custom/${ie}`);P(ie,[T(te,X)],null)}ie!==a.name&&a.dependencies.add(ie);let ft=_.get(ie).files.find(X=>X.source===z),Ye=w(ft.target);F.push({...$,value:Ye})}let j=b.content;for(let $ of F.reverse())j=j.slice(0,$.start)+JSON.stringify($.value)+j.slice($.end);b.portable=ut(j,b.source,p)}a.identical=!!(a.standard&&a.files.length===a.standard.files.length&&a.files.every(b=>{let F=a.standard.files.find(j=>j.path===b.target);return F&&b.portable===I(F)}))}return[..._.values()].filter(a=>!a.identical).map(a=>({name:a.name,address:`custom/${a.name}`,semver:"1.0.0",changelog:"Import the existing Application source.",...a.standard?{replacesCanonical:a.standard.canonicalName}:{},installationLayout:"shadcn",sourceAliases:di,files:a.files.map(({portable:b,...F})=>({...F,content:b})),npmDependencies:[...a.npm].sort(),componentRequirements:[...a.dependencies].sort().map(b=>{let F=_.get(b);return F.standard&&F.identical?{kind:"canonical",name:F.standard.canonicalName,range:"*",framework:c.projectTarget.framework,primitive:c.projectTarget.primitive}:{kind:"private",name:`custom/${b}`,range:"1.0.0"}})}))}async function qn({config:r,client:s,dryRun:c=!1}){let u=Vn(r.adopt)||Fn,l=Bt(K.join(r.appRoot,"components.json")),p={appName:r.name||Mn(r.appRoot),framework:r.framework,primitive:r.primitive,style:l.style,adopt:u},h=await s.importShadcn({phase:"prepare",...p});if(h.initialized)return{...h,skipped:!0};let f=h.release;if(!f?.releaseId||f.baseLibrary!=="shadcn")throw new Error("Initial import requires a pinned shadcn Release.");if(f.projectTarget.framework!==r.framework||f.projectTarget.primitive!==r.primitive)throw new Error("Import target differs from the pinned shadcn Release.");if(f.baseProvenance?.style&&f.baseProvenance.style!==l.style)throw new Error("Import style differs from the pinned shadcn Release.");let m=l.tailwind?.css,x="";if(u.includes("tokens")){if(!m)throw new Error("components.json must declare tailwind.css for native token import.");let I=K.resolve(r.appRoot,m);De(r.appRoot,I),x=pe.readFileSync(I,"utf8")}let w={phase:"complete",...p,sourceReleaseId:f.releaseId,themeCss:x,componentsJson:l,components:u.includes("components")?Un(r.appRoot,l,f):[]};return c?{dryRun:!0,payload:w}:s.importShadcn(w)}function Wn(r,s){let{materializeInstallationPath:c}=(ct(),nt(Nt)),u=Bt(K.join(r.appRoot,"components.json")),l=Dt(r.appRoot,u.aliases?.ui||"@/components/ui",Ur(r.appRoot)),p=new Map(mi(l).map(h=>{let f=K.relative(l,h).replace(/\\/g,"/"),m=De(r.appRoot,h);return[m,{path:m,target:`ui/${f}`,component:f.split("/")[0].replace(/\.[^.]+$/,""),content:pe.readFileSync(h,"utf8")}]}));for(let h of[...s.canonical||[],...s.private||[]])for(let f of h.files||[]){let m=c({root:r.appRoot,source:h.kind,path:f.path,configuredUiPath:r.aliases?.ui,installationLayout:h.installationLayout||(h.source==="shadcn"?"shadcn":void 0)}),x=K.join(r.appRoot,m);pe.existsSync(x)&&(De(r.appRoot,x),p.set(m,{path:m,target:f.path,component:h.address||h.canonicalName,content:pe.readFileSync(x,"utf8")}))}return[...p.values()]}qr.exports={importShadcnApplication:qn,collectNativeMigrationFiles:Wn,normalizedSource:ut,materializeSource:$n,importStrings:Mt,inside:De}});var Xn={};Kt(Xn,{AdoptionConflictError:()=>E,ApplicationAdoption:()=>xi,COMPONENT_DELETED:()=>Ut,adoptionDigest:()=>Et,deletedComponentLocation:()=>bi,deletedComponentMessage:()=>Qn,deletedComponentsForLock:()=>Jr,deletedPinMessage:()=>Kr,deletedVersionIds:()=>pt,hashContent:()=>me,parseApplicationLock:()=>Fe,serializeApplicationLock:()=>ii,threeWayMerge:()=>Qt,validateInstallationPath:()=>fe,withdrawalWarningsForLock:()=>Yn});module.exports=nt(Xn);var yi=Ge(require("node:crypto")),V=Ge(require("node:fs")),O=Ge(require("node:path"));It();function Ve(r){return r&&typeof r=="object"&&"code"in r?String(r.code):void 0}function At(r){return r instanceof Error?r.message:String(r)}var E=class extends Error{constructor(c,u=[]){super(c);this.code="ADOPTION_CONFLICT";this.name="AdoptionConflictError",this.conflicts=u}};It();var sr=Ge(require("node:crypto")),js=2e6,ir=1e5;function me(r){return sr.default.createHash("sha256").update(Buffer.from(r)).digest("hex")}function at(r){return String(r).match(/.*(?:\n|$)/g).filter(s=>s!=="")}function rr(r,s){let c=at(r),u=at(s),l=Array.from({length:c.length+1},()=>new Uint32Array(u.length+1));for(let w=c.length-1;w>=0;w-=1)for(let I=u.length-1;I>=0;I-=1)l[w][I]=c[w]===u[I]?l[w+1][I+1]+1:Math.max(l[w+1][I],l[w][I+1]);let p=[],h=0,f=0,m=null,x=()=>{m&&p.push(m),m=null};for(;h<c.length||f<u.length;)h<c.length&&f<u.length&&c[h]===u[f]?(x(),h+=1,f+=1):f<u.length&&(h===c.length||l[h][f+1]>l[h+1][f])?(m||={start:h,end:h,replacement:[]},m.replacement.push(u[f]),f+=1):(m||={start:h,end:h,replacement:[]},h+=1,m.end=h);return x(),{base:c,hunks:p}}function Vs(r,s){return r.start===r.end&&s.start===s.end?r.start===s.start:r.start===r.end?r.start>=s.start&&r.start<s.end:s.start===s.end?s.start>=r.start&&s.start<r.end:r.start<s.end&&s.start<r.end}function Qt(r,s,c){let u=at(r).length,l=Math.max(at(s).length,at(c).length);if(u>ir||l>ir||(u+1)*(l+1)>js)return null;let p=rr(r,s),h=rr(r,c),f=[...p.hunks];for(let w of h.hunks){let I=f.find(_=>Vs(_,w));if(I){if(I.start===w.start&&I.end===w.end&&I.replacement.join("")===w.replacement.join(""))continue;return null}f.push(w)}let m="",x=0;for(let w of f.sort((I,_)=>I.start-_.start||I.end-_.end))m+=p.base.slice(x,w.start).join(""),m+=w.replacement.join(""),x=w.end;return m+p.base.slice(x).join("")}var{isSafeSlug:Hs}=ti();function Ee(r){return Object.fromEntries(Object.entries(r).sort(([s],[c])=>s.localeCompare(c)).map(([s,c])=>[s,c&&typeof c=="object"&&!Array.isArray(c)?{...c,...Array.isArray(c.files)?{files:[...c.files].sort((u,l)=>u.path.localeCompare(l.path))}:{}}:c]))}function _t(r){return Array.isArray(r)?r.map(_t):r&&typeof r=="object"?Object.fromEntries(Object.keys(r).filter(s=>s!=="adoptionDigest").sort().map(s=>[s,_t(r[s])])):r}function Et(r){return me(JSON.stringify(_t(r)))}function cr(r){let s=r;if(!s||![1,2,3].includes(Number(s.schemaVersion))||typeof s.components!="object"||s.components===null)throw new E("Unsupported or malformed frontfriend.lock.json.");let c=Object.fromEntries(Object.entries(s.components).map(([f,m])=>{let x=m;if(!x||!["canonical","private"].includes(String(x.source))||typeof x.versionId!="string"||typeof x.semver!="string")throw new E(`Unsupported source kind for ${f}.`);return[f,x]})),u={releaseId:s.releaseId==null?null:String(s.releaseId),tokenVersionId:String(s.tokenVersionId),projectTarget:s.schemaVersion===3&&s.projectTarget===null&&Object.keys(c).length===0?null:xe(s.projectTarget,"Application lock target"),components:c};for(let f of Object.values(c)){if(!f.projectTarget)continue;let m=xe(f.projectTarget,"Component adoption target");if(!u.projectTarget||m.framework!==u.projectTarget.framework||m.primitive!==u.projectTarget.primitive)throw new E("Component adoption belongs to another Project target.")}if(s.schemaVersion===1)return{...u,projectTarget:xe(s.projectTarget,"Application lock target"),schemaVersion:1,components:c};if(typeof s.designSystemId!="string"||!s.designSystemId||typeof s.ffId!="string"||!s.ffId||typeof s.adoptionDigest!="string"||!s.adoptionDigest||typeof s.tokenSourceReleaseId!="string"||!s.tokenSourceReleaseId||!Array.isArray(s.sourceReleaseIds))throw new E("Malformed v2 Frontfriend adoption snapshot.");let l={...u,schemaVersion:s.schemaVersion===3?3:2,...s.schemaVersion===3?{design:s.design}:{},designSystemId:s.designSystemId,ffId:s.ffId,...s.baseLibrary!==void 0?{baseLibrary:s.baseLibrary}:{},...s.baseProvenance!==void 0?{baseProvenance:s.baseProvenance}:{},...s.replacements!==void 0?{replacements:s.replacements}:{},adoptionDigest:s.adoptionDigest,tokenSourceReleaseId:s.tokenSourceReleaseId,sourceReleaseIds:[...new Set(s.sourceReleaseIds.map(String))].sort(),components:c};if(l.baseLibrary!==void 0&&!["frontfriend","shadcn"].includes(l.baseLibrary))throw new E("Unsupported base library in Application lock.");if(l.schemaVersion===3){let f=l.design;if(!f||f.designSystemId!==l.designSystemId||!f.appId||!f.snapshotId||!f.sharedSourceReleaseId||!Array.isArray(f.contracts)||!Array.isArray(f.sharedContracts))throw new E("Malformed Application design adoption.");let m=[...f.sharedContracts,...f.contracts];if(new Set(m.map(w=>w.slug)).size!==m.length||m.some(w=>w.designSystemId!==l.designSystemId||!w.revisionId||!w.contractId||!Hs(w.slug)||!w.slug.endsWith(".md")||!Number.isInteger(w.version)||w.version<1||!/^[a-f0-9]{64}$/.test(w.digest)))throw new E("Invalid contract revision pins in the Application lock.");if(f.sharedContracts.some(w=>!["guidelines","design-context","guideline-chapter","layout","pattern"].includes(w.kind))||f.contracts.some(w=>!["app-context","page"].includes(w.kind)))throw new E("Contract pins have invalid shared or App ownership.");if(me(JSON.stringify(_t({schemaVersion:1,appId:f.appId,sharedSourceReleaseId:f.sharedSourceReleaseId,contracts:[...f.contracts].sort((w,I)=>w.slug.localeCompare(I.slug))})))!==f.snapshotDigest)throw new E("Application design snapshot digest does not match its manifest.")}else if(s.design!==void 0)throw new E("Contract pins require a schema version 3 Application lock.");let p=Object.values(l.components).map(f=>{if(typeof f.sourceReleaseId!="string"||!f.sourceReleaseId)throw new E("Every v2 component adoption must identify its immutable source Release.");return f.sourceReleaseId}),h=[...new Set([l.tokenSourceReleaseId,...p,...l.design?[l.design.sharedSourceReleaseId]:[]])].sort();if(JSON.stringify(h)!==JSON.stringify(l.sourceReleaseIds))throw new E("The adoption source Releases do not match the token and component provenance.");if(l.releaseId&&(h.length!==1||h[0]!==l.releaseId))throw new E("A lock may reference a Release only when its complete closure matches that Release.");if(Et(l)!==l.adoptionDigest)throw new E("The adoption snapshot digest does not match its manifest.");return l}function Fe(r){try{return cr(typeof r=="string"?JSON.parse(r):r)}catch(s){throw s instanceof E?s:new E(`Invalid frontfriend.lock.json: ${s instanceof Error?s.message:String(s)}`)}}function ii(r){let s=cr(r);return`${JSON.stringify({...s,components:Ee(s.components)},null,2)}
|
|
24
|
+
`}ct();function Js(r){let s=r.projectTarget;return(r.replacements||[]).filter(c=>!s||c.framework===s.framework&&c.primitive===s.primitive)}function vr(r){let s=Js(r),c=new Map(s.map(l=>[`${l.framework}/${l.primitive}/${l.canonicalName}`,l.privateAddress]));for(let l of s)if(!(r.private||[]).some(p=>p.address===l.privateAddress))throw new Error(`Replacement ${l.privateAddress} is absent from the selected Release.`);let u=new Set;return(r.installOrder||[...r.canonical||[],...r.private||[]]).filter(l=>{let p=r.projectTarget;if(l.projectTarget&&p&&(l.projectTarget.framework!==p.framework||l.projectTarget.primitive!==p.primitive)||l.kind==="canonical"&&c.has(`${l.framework}/${l.primitive}/${l.canonicalName}`))return!1;let h=Ks(l);return u.has(h)?!1:(u.add(h),!0)})}function Ks(r){return r.kind==="private"?`private:${r.address}`:`canonical:${r.framework}/${r.primitive}/${r.canonicalName}`}var{planMirrorResponse:Hn,readMirrorTree:zn,validatePinnedMirror:Gn,MIRROR_DIR:$t}=ti(),{materializeSource:Jn}=Wr(),Kn=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i;function fe(r){if(typeof r!="string"||!r||r.includes("\0"))throw new E("Installation paths must be non-empty and contain no null bytes.");let s=r.replace(/\\/g,"/"),c=s.split("/");if(O.default.posix.isAbsolute(s)||/^[A-Za-z]:\//.test(s)||c.some(u=>!u||u==="."||u==="..")||c.some(u=>Kn.test(u)))throw new E(`Unsafe installation path: ${r}`);return s}function vi(r){return r.kind==="private"?r.address:r.canonicalName}function gi(r){return r.kind==="private"?"private":"canonical"}function ht(r){return vr(r)}var Ut="COMPONENT_DELETED";function pt(r,s=[]){let c=new Set(s);for(let u of r)for(let l of u?.warnings??[])l?.reason===Ut&&typeof l.versionId=="string"&&c.add(l.versionId);return c}function Jr(r,s){if(!r)return[];let c=Fe(r),u=s instanceof Set?s:pt(s);return Object.entries(c.components).filter(([,l])=>l.source==="private"&&u.has(l.versionId)).map(([l,p])=>({component:l,versionId:p.versionId,semver:p.semver,paths:(p.files||[]).map(h=>h.path).sort()})).sort((l,p)=>l.component.localeCompare(p.component))}function bi(r){if(r.length<=1)return r[0]??"";let s=r.map(l=>O.default.posix.dirname(l).split("/")),c=[];for(let[l,p]of s[0].entries()){if(s.some(h=>h[l]!==p))break;c.push(p)}let u=c.join("/");return u&&u!=="."?u:r.join(", ")}function Qn(r){return r.paths.length?`${r.component} was deleted from the design system. Its files in ${bi(r.paths)} were kept; remove them and their imports if you no longer use them.`:`${r.component} was deleted from the design system. Remove its imports if you no longer use it.`}function Kr(r){let s=bi(r.paths);return`${r.component}@${r.semver} was deleted from the design system. Run \`frontfriend update\` to drop it from frontfriend.lock.json${s?`; its files in ${s} stay until you remove them and their imports.`:"."}`}function Yn(r,s){let c=Fe(r),u=new Map(Object.entries(c.components).map(([p,h])=>[h.versionId,p])),l=new Map;for(let p of s){for(let h of p.warnings??[]){let f=u.get(h.versionId);if(!(!f||h.code!=="WITHDRAWN_HISTORICAL_VERSION"||h.severity!=="urgent")){if(h.reason===Ut){let m=c.components[f];l.set(h.versionId,{code:"WITHDRAWN_HISTORICAL_VERSION",severity:"urgent",identity:f,versionId:h.versionId,reason:Ut,message:Kr({component:f,versionId:m.versionId,semver:m.semver,paths:(m.files||[]).map(x=>x.path).sort()})});continue}l.set(h.versionId,{code:"WITHDRAWN_HISTORICAL_VERSION",severity:"urgent",identity:f,versionId:h.versionId,message:`${f}@${c.components[f].semver} is withdrawn: ${h.message}${h.correctedVersionId?` Use corrected version ${h.correctedVersionId}.`:""}`})}}for(let h of ht(p)){let f=u.get(h.id);if(!f||!h.withdrawnAt)continue;let m=`${f}@${h.semver} is withdrawn${h.withdrawalReason?`: ${h.withdrawalReason}.`:"."}${h.correctedVersionId?` Use corrected version ${h.correctedVersionId}.`:""}`;l.set(h.id,{code:"WITHDRAWN_HISTORICAL_VERSION",severity:"urgent",identity:f,versionId:h.id,message:m})}}return[...l.values()].sort((p,h)=>p.identity.localeCompare(h.identity))}function Hr(r){if(!r.designSystemId||!r.ffId||!r.releaseId||!r.tokenVersionId)throw new E("Resolved Releases must include their Release, token, Design System id and ff-id.")}function lt(r){return`${r.framework}/${r.primitive}/${r.canonicalName}`}function Qr(r,s,c=pt([s])){if(s.contractsOnly||r.tokenVersionId!==s.tokenVersionId||"baseLibrary"in r&&r.baseLibrary!==(s.baseLibrary||"frontfriend")||"baseProvenance"in r&&JSON.stringify(Ee(r.baseProvenance||{}))!==JSON.stringify(Ee(s.baseProvenance||{})))return!1;let u=new Map(ht(s).map(m=>[vi(m),m.id])),l=new Set(Object.entries(r.components).filter(([m,x])=>x.source==="private"&&c.has(x.versionId)&&!u.has(m)).map(([m])=>m)),p=(m=[])=>Ee(Object.fromEntries(m.filter(x=>!l.has(x.privateAddress)).map(x=>[lt(x),x.privateAddress])));if("replacements"in r&&JSON.stringify(p(r.replacements))!==JSON.stringify(p(s.replacements))||r.schemaVersion!==1&&r.sourceReleaseIds.some(m=>m!==s.releaseId))return!1;if(r.schemaVersion!==1&&r.design){if(r.design.sharedSourceReleaseId!==s.releaseId||JSON.stringify(Ee(Object.fromEntries(r.design.sharedContracts.map(m=>[m.slug,m]))))!==JSON.stringify(Ee(Object.fromEntries((s.contracts??[]).map(m=>[m.slug,m])))))return!1}else if(s.contracts!==void 0)return!1;let h=Object.entries(r.components).filter(([m])=>!l.has(m)),f="replacements"in r?(r.replacements||[]).filter(m=>l.has(m.privateAddress)).map(m=>m.canonicalName).filter(m=>!r.components[m]):[];for(let m of f)u.delete(m);return h.length===u.size&&h.every(([m,x])=>u.get(m)===x.versionId)}function zr(r,s,c){if(!s.contractsOnly&&r&&r.schemaVersion!==1&&r.releaseId===s.releaseId&&!Qr(r,s,c))throw new E("The same immutable Release cannot resolve to a different token or component closure.")}function Gr(r,s,c=[]){for(let u of[...c].reverse()){let l=O.default.join(r,fe(u.from)),p=O.default.join(r,fe(u.to));if(!V.default.existsSync(p))continue;let h=O.default.join(s,`case-rollback-${yi.default.randomBytes(6).toString("hex")}`);V.default.renameSync(p,h),V.default.mkdirSync(O.default.dirname(l),{recursive:!0}),V.default.renameSync(h,l)}}var xi=class{constructor(s={}){this.root=O.default.resolve(s.root||process.cwd()),this.canonicalUiPath=s.canonicalUiPath??null,this.usesFilesystem=!s.readFile&&!s.writeFile,this.mutationLockDepth=0,this.mutationLockFd=null,this.readFile=s.readFile||(c=>{let u=O.default.join(this.root,fe(c));try{return V.default.readFileSync(u,"utf8")}catch(l){if(Ve(l)==="ENOENT")return null;throw l}}),this.writeFile=s.writeFile||((c,u)=>{let l=O.default.join(this.root,fe(c));V.default.mkdirSync(O.default.dirname(l),{recursive:!0}),V.default.writeFileSync(l,u)})}installationPath(s,c){return fe(ai({root:this.root,source:gi(s),path:fe(c),configuredUiPath:this.canonicalUiPath,installationLayout:s.installationLayout||(s.source==="shadcn"?"shadcn":void 0)}))}installationSource(s,c,u){if(s.source!=="shadcn"&&s.installationLayout!=="shadcn")return u;let l={};try{l=JSON.parse(V.default.readFileSync(O.default.join(this.root,"components.json"),"utf8")).aliases||{}}catch{}return Jn(u,c,l,s.sourceAliases,this.installationPath(s,c))}acquireMutationLock(){if(!this.usesFilesystem)return()=>{};if(this.mutationLockDepth>0)return this.mutationLockDepth+=1,()=>{this.mutationLockDepth-=1};V.default.mkdirSync(this.root,{recursive:!0});let s=O.default.join(this.root,".frontfriend-update.lock"),c=l=>{try{let p=V.default.openSync(s,"wx");return V.default.writeFileSync(p,`${JSON.stringify({schemaVersion:1,pid:process.pid})}
|
|
25
|
+
`),p}catch(p){if(Ve(p)!=="EEXIST"||!l)throw p;let h;try{h=JSON.parse(V.default.readFileSync(s,"utf8"))}catch{throw new E("Another update holds an invalid mutation lock; remove it only after verifying no updater is active.")}if(h?.schemaVersion!==1||!Number.isInteger(h.pid))throw new E("Another update holds an invalid mutation lock; remove it only after verifying no updater is active.");try{throw process.kill(h.pid,0),new E(`Another Frontfriend update is active (pid ${h.pid}).`)}catch(f){if(f instanceof E||Ve(f)!=="ESRCH")throw f}return V.default.unlinkSync(s),c(!1)}};try{this.mutationLockFd=c(!0)}catch(l){throw l instanceof E?l:new E(`Could not acquire the application update lock: ${At(l)}`)}this.mutationLockDepth=1;let u=!1;return()=>{u||(u=!0,this.mutationLockDepth-=1,this.mutationLockDepth===0&&(V.default.closeSync(this.mutationLockFd),this.mutationLockFd=null,V.default.unlinkSync(s)))}}recoverPendingTransactions(){if(this.usesFilesystem&&this.mutationLockDepth===0)throw new E("Recovery requires the exclusive application update lock.");if(V.default.existsSync(this.root))for(let s of V.default.readdirSync(this.root)){if(!/^\.frontfriend-transaction-\d+-[0-9a-f]{12}$/.test(s))continue;let c=O.default.join(this.root,s),u=O.default.join(c,"journal.json"),l;try{l=JSON.parse(V.default.readFileSync(u,"utf8"))}catch{throw new E(`Cannot recover ${s}: its transaction journal is missing or corrupt.`)}if(l?.schemaVersion!==1||!["prepared","committing","committed"].includes(l.state)||!Array.isArray(l.paths)||l.renames!=null&&!Array.isArray(l.renames))throw new E(`Cannot recover ${s}: invalid transaction journal.`);if(l.state==="committing"){for(let p of l.paths||[]){let h=fe(p.path),f=O.default.join(this.root,h),m=O.default.join(c,"backup",h);if(p.existed)V.default.mkdirSync(O.default.dirname(f),{recursive:!0}),V.default.copyFileSync(m,f);else try{V.default.unlinkSync(f)}catch(x){if(Ve(x)!=="ENOENT")throw x}}Gr(this.root,c,l.renames)}V.default.rmSync(c,{recursive:!0,force:!0})}}inspect(s,c={}){Hr(s);let u=xe(s.projectTarget,"Resolved Release target"),l=null;if(c.currentLock){if(l=Fe(c.currentLock),l.projectTarget&&Ne(l.projectTarget)!==Ne(u))throw new E("Project target mismatch between Release and lock.");if(l.schemaVersion!==1&&(l.designSystemId!==s.designSystemId||l.ffId!==s.ffId))throw new E("Design System mismatch between Release and lock.");zr(l,s,pt([s],c.deletedVersionIds))}let p={},h=[],f=[];for(let m of ht(s)){let x=vi(m),w=l?.components?.[x]||null,I=m.files.map(P=>{let B=this.installationPath(m,P.path),re=this.readFile(B);return{path:B,status:re==null?"available":me(re)===me(this.installationSource(m,P.path,P.content))?"exact":"drifted"}}),_=new Set(I.map(P=>P.status)),M=w&&(w.files||[]).some(P=>{let B=this.readFile(P.path);return B==null||me(B)!==P.baselineHash}),S=w&&w.versionId!==m.id,T=M?"drifted":S?"update-available":_.has("drifted")?"drifted":_.has("available")?"available":"exact";p[x]={source:gi(m),status:T,versionId:m.id,semver:m.semver,changelog:m.changelog,files:I},(!w||S)&&m.changelog&&!h.includes(m.changelog)&&h.push(m.changelog),m.withdrawnAt&&f.push(`${x}@${m.semver} is withdrawn${m.withdrawalReason?`: ${m.withdrawalReason}`:"."}${m.correctedVersionId?` Use corrected version ${m.correctedVersionId}.`:""}`)}return{releaseId:s.releaseId,tokenVersionId:s.tokenVersionId,projectTarget:u,token:{versionId:s.tokenVersionId,status:l?l.tokenVersionId===s.tokenVersionId?"exact":"update-available":"available"},components:p,changelogs:h,warnings:f}}diff(s){let c=Fe(s),u=[];for(let[l,p]of Object.entries(c.components))for(let h of p.files||[]){let f=this.readFile(h.path);u.push({component:l,source:p.source,path:h.path,baselineHash:h.baselineHash,currentHash:f==null?null:me(f),status:f==null?"missing":me(f)===h.baselineHash?"unchanged":"modified"})}return u.sort((l,p)=>l.path.localeCompare(p.path))}planUpdate(s,c={}){Hr(s);let u=c.currentLock?Fe(c.currentLock):null;if(s.contractsOnly&&(!c.design||c.components?.length!==0||ht(s).length))throw new E("Contract-only resolution requires an exact design selection and no incoming component source.");let l=s.contractsOnly?u?.projectTarget??null:xe(s.projectTarget,"Resolved Release target");if(!s.contractsOnly&&l&&u?.projectTarget&&Ne(u.projectTarget)!==Ne(l))throw new E("Project target mismatch between config, Release and lock.");if(u&&u.schemaVersion!==1&&(u.designSystemId!==s.designSystemId||u.ffId!==s.ffId))throw new E("Design System mismatch between config, Release and lock.");let p=pt([s],c.deletedVersionIds);zr(u,s,p);let h=c.components?new Set(c.components):null,f=new Set,m=u?{...u.components}:{},x={},w=new Set,I=[],_=[],M=new Set,S=[],T=new Map,P=new Map,B=new Map;for(let[A,q]of Object.entries(u?.components||{}))for(let J of q.files||[])B.set(J.path.toLocaleLowerCase("en-US"),A);for(let A of ht(s)){let q=vi(A);if(h&&!h.has(q))continue;for(let W of A.npmDependencies||[])M.add(W);let J=u?.components?.[q]||null;if(A.kind==="private"&&s.capabilities?.freshPrivateSelection!==!0&&J?.versionId!==A.id){S.push({component:q,reason:"the current subscription permits only the exact private version already pinned in frontfriend.lock.json"});continue}if(A.kind==="canonical"&&!s.capabilities?.freshCanonicalSelection?.includes(q)&&J?.versionId!==A.id){S.push({component:q,reason:"the current catalogue permits only the exact canonical version already pinned in frontfriend.lock.json"});continue}if(A.withdrawnAt&&J?.versionId!==A.id){S.push({component:q,reason:`${q}@${A.semver} is withdrawn and cannot be freshly installed${A.withdrawalReason?`: ${A.withdrawalReason}`:""}`});continue}let se=[];for(let W of A.files){let G={...W,content:this.installationSource(A,W.path,W.content)},H=this.installationPath(A,G.path),ae=H.toLocaleLowerCase("en-US"),ve=B.get(ae);if(ve&&ve!==q){if(!c.allowReplacement){S.push({path:H,reason:`owned by ${ve}; explicit replacement is required`});continue}let oe=m[ve];if(oe){let Me=(oe.files||[]).filter(dt=>dt.path.toLocaleLowerCase("en-US")!==ae);Me.length===0?delete m[ve]:m[ve]={...oe,files:Me}}}let Xe=T.get(ae),Ze=P.get(ae);if(Ze&&Ze!==q){S.push({path:H,reason:`also claimed by ${Ze}`});continue}if(Xe&&Xe!==H){S.push({path:H,reason:`case collision with ${Xe}`});continue}T.set(ae,H),P.set(ae,q);let ne=J?.files?.find(oe=>oe.path===H)||J?.files?.find(oe=>oe.path.toLocaleLowerCase("en-US")===ae)||(c.allowReplacement&&ve?u?.components?.[ve]?.files?.find(oe=>oe.path.toLocaleLowerCase("en-US")===ae):null),Ie=ne&&ne.path!==H&&ne.path.toLocaleLowerCase("en-US")===ae;if(Ie&&O.default.posix.dirname(ne.path)!==O.default.posix.dirname(H)){S.push({path:H,reason:"case-only parent directory renames require an explicit filesystem migration"});continue}let ye=this.readFile(Ie?ne.path:H),Ue=ne?.baseline??null,de=ye;if(ye==null)x[H]=G.content,de=G.content;else if(ne)if(me(ye)===ne.baselineHash)x[H]=G.content,de=G.content;else if(Ue===G.content||ye===G.content)de=ye;else{let oe=Ue==null?null:Qt(Ue,ye,G.content);oe==null?S.push({path:H,reason:"local and incoming source both changed"}):(x[H]=oe,de=oe)}else ye===G.content?de=ye:c.allowReplacement?(x[H]=G.content,de=G.content):S.push({path:H,reason:"unmanaged file already exists"});Ie&&de!=null&&(x[H]=de,I.push({from:ne.path,to:H})),se.push({path:H,installedHash:de==null?null:me(de),baselineHash:me(G.content),baseline:G.content})}let $e=new Set(se.map(W=>W.path.toLocaleLowerCase("en-US")));for(let W of J?.files||[]){if($e.has(W.path.toLocaleLowerCase("en-US")))continue;let G=this.readFile(W.path);G!=null&&(me(G)===W.baselineHash?w.add(W.path):S.push({path:W.path,reason:"removed upstream but modified locally"}))}m[q]={source:gi(A),versionId:A.id,semver:A.semver,manifestHash:A.digest,sourceReleaseId:s.releaseId,...A.projectTarget?{projectTarget:xe(A.projectTarget,"Component Project target")}:{},files:se},f.add(q),(!J||J.versionId!==A.id)&&_.push(A.changelog)}if(S.length>0)throw new E(`Update plan has conflicts; files and lock were not changed: ${S[0].reason}.`,S);let re=Jr(u,p).filter(A=>!f.has(A.component));for(let A of re)delete m[A.component];let R=!!h,a=R&&u&&!c.adoptTokens,b=a?u.tokenVersionId:s.tokenVersionId,F=a&&(("tokenSourceReleaseId"in u?u.tokenSourceReleaseId:void 0)||u.releaseId)||s.releaseId,j=u&&u.schemaVersion!==1?u.design:void 0,$=c.design??(R?j:void 0);if(!R&&s.contracts!==void 0&&!$)throw new E("Select an exact Application design snapshot before adopting this Release.");if(!R&&j&&!$)throw new E("A Release without contract pins cannot silently remove adopted contract pins.");if($&&$.designSystemId!==s.designSystemId)throw new E("Design snapshot belongs to another Design System.");if(c.design&&JSON.stringify(Ee(Object.fromEntries(c.design.sharedContracts.map(A=>[A.slug,A]))))!==JSON.stringify(Ee(Object.fromEntries((s.contracts??[]).map(A=>[A.slug,A])))))throw new E("Design snapshot does not match the selected Release contract set.");let te=[...new Set([F,...$?[$.sharedSourceReleaseId]:[],...Object.values(m).map(A=>A.sourceReleaseId||u?.releaseId||s.releaseId)].filter(Boolean))].sort(),z=(s.replacements||[]).filter(A=>{let q=m[A.privateAddress],J=s.private?.find(se=>se.address===A.privateAddress);return A.framework===l?.framework&&A.primitive===l?.primitive&&q?.source==="private"&&q.sourceReleaseId===s.releaseId&&q.versionId===J?.id}),ie=new Set(z.map(lt)),Ye=[...(u&&"replacements"in u?u.replacements||[]:[]).filter(A=>{let q=m[A.privateAddress],J=u?.components[A.privateAddress];return q?.source==="private"&&q.versionId===J?.versionId&&q.sourceReleaseId===J?.sourceReleaseId&&!f.has(A.privateAddress)&&!f.has(A.canonicalName)&&!ie.has(lt(A))}),...z].sort((A,q)=>lt(A).localeCompare(lt(q))),X={schemaVersion:$?3:2,...$?{design:$}:{},...s.replacements!==void 0||u&&"replacements"in u?{replacements:Ye}:{},designSystemId:s.designSystemId,ffId:s.ffId,...(a&&"baseLibrary"in u?u.baseLibrary:s.baseLibrary)?{baseLibrary:a&&"baseLibrary"in u?u.baseLibrary:s.baseLibrary}:{},...(a&&"baseProvenance"in u?u.baseProvenance:s.baseProvenance)?{baseProvenance:a&&"baseProvenance"in u?u.baseProvenance:s.baseProvenance}:{},releaseId:null,tokenVersionId:b,tokenSourceReleaseId:F,sourceReleaseIds:te,projectTarget:l,components:m,adoptionDigest:""};if(Qr(X,s)&&(X.releaseId=s.releaseId),X.adoptionDigest=Et(X),Fe(X),c.designMirror){let A=c.designMirror,q;try{q=Gn(A,$,s.ffId)}catch(W){throw new E(At(W))}let J=new Set([...Object.keys(zn(O.default.join(this.root,$t))),...j?[...j.sharedContracts,...j.contracts].map(W=>W.slug):[],...q.map(W=>W.slug),"README.md"]),se=Object.fromEntries([...J].flatMap(W=>{let G=this.readFile(`${$t}/${W}`);return G===null?[]:[[W,G]]})),$e=Hn(A,se);for(let[W,G]of Object.entries($e.writes)){let H=fe(`${$t}/${W}`);if(x[H]!==void 0||Object.values(m).some(ae=>ae.files?.some(ve=>ve.path===H)))throw new E("A component cannot own a contract mirror path.");x[H]=G}for(let W of $e.deletes)w.add(fe(`${$t}/${W}`))}else if(c.design&&(c.design.contracts.length||c.design.sharedContracts.length))throw new E("Fetch the exact contract mirror before applying a new design adoption.");return{valid:!0,writes:Ee(x),deletes:[...w].filter(A=>!Object.keys(x).some(q=>q.toLocaleLowerCase("en-US")===A.toLocaleLowerCase("en-US"))).sort(),renames:I.sort((A,q)=>A.from.localeCompare(q.from)),nextLock:X,changelogs:_.filter(Boolean),npmDependencies:[...M].sort(),removed:re}}apply(s,c={}){if(!s?.valid)throw new E("Only a validated update plan can be applied.");let u=this.mutationLockDepth===0?this.acquireMutationLock():()=>{};try{this.usesFilesystem&&this.recoverPendingTransactions();let l="frontfriend.lock.json",p=[...new Set([...Object.keys(s.writes),...s.deletes||[],...(s.renames||[]).flatMap(I=>[I.from,I.to]),l])],h=O.default.join(this.root,`.frontfriend-transaction-${process.pid}-${yi.default.randomBytes(6).toString("hex")}`),f=O.default.join(h,"stage"),m=O.default.join(h,"backup"),x=p.map(I=>({path:fe(I),existed:this.readFile(I)!=null})),w=!1;try{V.default.mkdirSync(f,{recursive:!0});for(let[T,P]of Object.entries(s.writes)){let B=O.default.join(f,fe(T));V.default.mkdirSync(O.default.dirname(B),{recursive:!0}),V.default.writeFileSync(B,P)}V.default.writeFileSync(O.default.join(f,l),ii(s.nextLock));for(let T of x){if(!T.existed)continue;let P=O.default.join(m,T.path);V.default.mkdirSync(O.default.dirname(P),{recursive:!0}),V.default.copyFileSync(O.default.join(this.root,T.path),P)}let I=O.default.join(h,"journal.json"),_={schemaVersion:1,state:"prepared",paths:x,renames:s.renames||[]};V.default.writeFileSync(I,`${JSON.stringify(_)}
|
|
26
|
+
`),V.default.writeFileSync(I,`${JSON.stringify({..._,state:"committing"})}
|
|
27
|
+
`);let M=0,S=new Set;for(let T of s.renames||[]){let P=fe(T.from),B=fe(T.to);c.beforeCommitFile?.(B,M);try{V.default.unlinkSync(O.default.join(this.root,P))}catch(R){if(Ve(R)!=="ENOENT")throw R}let re=O.default.join(this.root,B);V.default.mkdirSync(O.default.dirname(re),{recursive:!0}),V.default.renameSync(O.default.join(f,B),re),S.add(B),M+=1}for(let T of Object.keys(s.writes)){if(S.has(T))continue;c.beforeCommitFile?.(T,M);let P=O.default.join(this.root,T);V.default.mkdirSync(O.default.dirname(P),{recursive:!0}),V.default.renameSync(O.default.join(f,T),P),M+=1}for(let T of s.deletes||[]){c.beforeCommitFile?.(T,M);try{V.default.unlinkSync(O.default.join(this.root,fe(T)))}catch(P){if(Ve(P)!=="ENOENT")throw P}M+=1}return c.beforeCommitFile?.(l,M),V.default.renameSync(O.default.join(f,l),O.default.join(this.root,l)),V.default.writeFileSync(I,`${JSON.stringify({..._,state:"committed"})}
|
|
28
|
+
`),w=!0,s.nextLock}catch(I){try{for(let _ of x){let M=O.default.join(this.root,_.path);if(_.existed){let S=O.default.join(m,_.path);V.default.mkdirSync(O.default.dirname(M),{recursive:!0}),V.default.copyFileSync(S,M)}else try{V.default.unlinkSync(M)}catch(S){if(Ve(S)!=="ENOENT")throw S}}Gr(this.root,h,s.renames),w=!0}catch(_){throw new E(`Update failed and rollback could not complete; recovery data was preserved at ${h}: ${At(_)}`)}throw I}finally{w&&V.default.rmSync(h,{recursive:!0,force:!0})}}finally{u()}}};0&&(module.exports={AdoptionConflictError,ApplicationAdoption,COMPONENT_DELETED,adoptionDigest,deletedComponentLocation,deletedComponentMessage,deletedComponentsForLock,deletedPinMessage,deletedVersionIds,hashContent,parseApplicationLock,serializeApplicationLock,threeWayMerge,validateInstallationPath,withdrawalWarningsForLock});
|