@frontfriend/sdk 0.0.0-stage → 1.1.0
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/LICENSE +46 -0
- package/README.md +352 -2
- package/dist/THIRD_PARTY_NOTICES +44 -0
- package/dist/application-adoption-lock.d.ts +31 -0
- package/dist/application-adoption.d.ts +103 -0
- package/dist/browser.mjs +1 -0
- package/dist/cli.js +372 -0
- package/dist/cn.d.ts +2 -0
- package/dist/cn.js +1 -0
- package/dist/cn.mjs +1 -0
- package/dist/component-config.d.ts +330 -0
- package/dist/component-config.mjs +1 -0
- package/dist/component-recipes.d.ts +29 -0
- package/dist/components-config-schema.d.ts +2 -0
- package/dist/components-config-schema.js +1 -0
- package/dist/ffdc.d.ts +17 -0
- package/dist/ffdc.js +1 -0
- package/dist/ffdc.mjs +1 -0
- package/dist/foundation-contract.json +56 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/dist/lib/core/adoption.js +1 -0
- package/dist/lib/core/api-client.js +10 -0
- package/dist/lib/core/application-adoption-lock.js +6 -0
- package/dist/lib/core/application-adoption.js +28 -0
- package/dist/lib/core/cache-manager.js +1 -0
- package/dist/lib/core/cached-components-config.js +1 -0
- package/dist/lib/core/classes-source.js +1 -0
- package/dist/lib/core/component-config.js +1 -0
- package/dist/lib/core/component-recipes.js +8 -0
- package/dist/lib/core/components-config-schema.js +1 -0
- package/dist/lib/core/config-loader.js +1 -0
- package/dist/lib/core/constants.js +1 -0
- package/dist/lib/core/credentials.js +2 -0
- package/dist/lib/core/env-utils.js +2 -0
- package/dist/lib/core/errors.js +1 -0
- package/dist/lib/core/file-utils.js +2 -0
- package/dist/lib/core/nativeSource.d.ts +10 -0
- package/dist/lib/core/nativeSource.js +2 -0
- package/dist/lib/core/package-identity.js +1 -0
- package/dist/lib/core/path-utils.js +2 -0
- package/dist/lib/core/project-target.js +1 -0
- package/dist/lib/core/static-config.js +9 -0
- package/dist/lib/core/token-artifact-client.js +8 -0
- package/dist/lib/core/token-artifact.d.ts +39 -0
- package/dist/lib/core/token-artifact.js +1 -0
- package/dist/lib/core/token-processor.d.ts +23 -0
- package/dist/lib/core/token-processor.js +5 -0
- package/dist/lib/react/utils.d.ts +25 -0
- package/dist/lib/react/utils.mjs +1 -0
- package/dist/lib/vue/utils.d.ts +27 -0
- package/dist/lib/vue/utils.mjs +1 -0
- package/dist/mcp.cjs +226 -0
- package/dist/next.d.ts +11 -0
- package/dist/next.js +2 -0
- package/dist/next.mjs +1 -0
- package/dist/package.json +4 -0
- package/dist/project-target.d.ts +22 -0
- package/dist/runtime.d.ts +15 -0
- package/dist/runtime.js +1 -0
- package/dist/runtime.mjs +1 -0
- package/dist/scripts/generate-icon-types.js +38 -0
- package/dist/theme.css +3 -0
- package/dist/types/index.d.ts +68 -0
- package/dist/vite.d.mts +9 -0
- package/dist/vite.d.ts +8 -0
- package/dist/vite.js +9 -0
- package/dist/vite.mjs +1 -0
- package/package.json +202 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var ws=Object.create;var St=Object.defineProperty;var Ss=Object.getOwnPropertyDescriptor;var ks=Object.getOwnPropertyNames;var Cs=Object.getPrototypeOf,Is=Object.prototype.hasOwnProperty;var Ji=(r,n)=>()=>(r&&(n=r(r=0)),n);var Se=(r,n)=>()=>(n||r((n={exports:{}}).exports,n),n.exports),zt=(r,n)=>{for(var c in n)St(r,c,{get:n[c],enumerable:!0})},Ki=(r,n,c,u)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of ks(n))!Is.call(r,l)&&l!==c&&St(r,l,{get:()=>n[l],enumerable:!(u=Ss(n,l))||u.enumerable});return r};var Je=(r,n,c)=>(c=r!=null?ws(Cs(r)):{},Ki(n||!r||!r.__esModule?St(c,"default",{value:r,enumerable:!0}):c,r)),st=r=>Ki(St({},"__esModule",{value:!0}),r);var Xi={};zt(Xi,{ProjectTargetError:()=>Fe,SUPPORTED_PROJECT_TARGETS:()=>Qi,assertMatchingProjectTargets:()=>Yi,defaultV4ProjectTarget:()=>_s,parseProjectTarget:()=>ve,projectTargetKey:()=>Te,registryRoute:()=>Ps,resolveProjectTarget:()=>Es});function Te(r){return`${r.framework}/${r.primitive}`}function ve(r,n="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||!As.has(p))throw new Fe("INVALID_PROJECT_TARGET",`${n} 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 _s(r="react"){return ve({framework:r,primitive:r==="vue"?"reka":"base"})}function Yi(r){let n=Object.entries(r).filter(([,l])=>l!=null).map(([l,p])=>[l,ve(p,l)]);if(n.length===0)throw new Fe("PROJECT_TARGET_REQUIRED","A persisted or configured Project target is required.");let c=Te(n[0][1]);if(n.find(([,l])=>Te(l)!==c))throw new Fe("PROJECT_TARGET_MISMATCH",`Project target mismatch: ${n.map(([l,p])=>`${l}=${Te(p)}`).join(", ")}.`,{targets:Object.fromEntries(n)});return n[0][1]}function Es({persisted:r,configured:n,app:c,release:u,lock:l,proposed:p}={}){let h={persisted:r,configured:n,app:c,release:u,lock:l};if(Object.values(h).some(f=>f!=null))return Yi(h);if(p)return ve(p,"migration proposal");throw new Fe("PROJECT_TARGET_REQUIRED","A Project target is required; package detection may only propose one during migration.")}function Ps(r,n){throw ve(r),String(n||"").trim(),new Fe("CURRENT_ROUTE_RETIRED","Components resolve only from an authenticated immutable Design System Release.")}var Qi,As,Fe,kt=Ji(()=>{Qi=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"})]),As=new Set(Qi.map(r=>`${r.framework}/${r.primitive}`)),Fe=class extends Error{constructor(n,c,u={}){super(c),this.name="ProjectTargetError",this.code=n,Object.assign(this,u)}}});var Xt=Se((Qn,sr)=>{var Le=require("fs"),Ee=require("path"),{createHash:ir}=require("crypto"),Ts=".frontfriend/design",Ls=".frontfriend/.gitignore";function Os(){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 at(r){return typeof r!="string"||r.length===0||r.startsWith("/")||r.includes("\\")?!1:r.split("/").every(n=>n!==""&&n!=="."&&n!=="..")}function Kt(r){let n=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}`,"-->","",n,""].join(`
|
|
4
|
+
`)}function Qt(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 rr({design_system:r,contracts:n}){let c=[...n].filter(l=>at(l.slug)).sort((l,p)=>l.kind.localeCompare(p.kind)||l.slug.localeCompare(p.slug)),u={"README.md":Qt(r)};for(let l of c)u[l.slug]=Kt(l);return u}function Jt(r,n){let c={};for(let[l,p]of Object.entries(r))n[l]!==p&&(c[l]=p);let u=Object.keys(n).filter(l=>!(l in r)).sort();return{writes:c,deletes:u}}var Yt=r=>ir("sha256").update(r).digest("hex");function js(r){return Object.fromEntries(Object.entries(r).filter(([n])=>n!=="README.md"&&at(n)).map(([n,c])=>[n,Yt(c)]))}function Vs(r,n){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||!at(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,Kt(h));if(r.protocol===void 0)return r.manifest!==void 0&&c(),Jt(rr(r),n);(r.protocol!==1||!Array.isArray(r.manifest))&&c();let l={"README.md":Qt(r.design_system)},p=new Set;for(let h of r.manifest){(!h||!at(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)??n[h.slug];(typeof f!="string"||Yt(f)!==h.hash)&&c(),Object.defineProperty(l,h.slug,{value:f,enumerable:!0})}return[...u.keys()].some(h=>!p.has(h))&&c(),Jt(l,n)}function Fs(r){let n={};if(!Le.existsSync(r))return n;let c=u=>{for(let l of Le.readdirSync(u,{withFileTypes:!0})){let p=Ee.join(u,l.name);if(l.isDirectory())c(p);else if(l.isFile()){let h=Ee.relative(r,p).split(Ee.sep).join("/");n[h]=Le.readFileSync(p,"utf8")}}};return c(r),n}function Ds(r,n){for(let[c,u]of Object.entries(n.writes)){let l=Ee.join(r,...c.split("/"));Le.mkdirSync(Ee.dirname(l),{recursive:!0}),Le.writeFileSync(l,u)}for(let c of n.deletes){let u=Ee.join(r,...c.split("/"));Le.rmSync(u,{force:!0});let l=Ee.dirname(u),p=Ee.resolve(r);for(;Ee.resolve(l)!==p&&Le.existsSync(l)&&Le.readdirSync(l).length===0;)Le.rmdirSync(l),l=Ee.dirname(l)}}function Ms(r,n,c){if(!n||r.contract_selection!==1||r.selection?.design_snapshot_id!==n.snapshotId||r.selection?.digest!==n.snapshotDigest||r.app?.id!==n.appId||r.design_system?.ff_id!==c)throw new Error("Contract mirror does not match the selected App snapshot.");let u=[...n.sharedContracts,...n.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 g={appId:n.contracts.some(w=>w.slug===f.slug)?n.appId:null,body:h.body,designSystemId:n.designSystemId,kind:h.kind,maturity:h.maturity,slug:h.slug,title:h.title};if(ir("sha256").update(JSON.stringify(g)).digest("hex")!==f.digest)throw new Error("Contract content does not match its immutable digest.")}return u}sr.exports={validatePinnedMirror:Ms,MIRROR_DIR:Ts,FRONTFRIEND_GITIGNORE_PATH:Ls,renderFrontfriendGitignore:Os,isSafeSlug:at,renderContractFile:Kt,renderMirrorReadme:Qt,buildMirrorTree:rr,planMirrorSync:Jt,hashMirrorFile:Yt,knownMirrorHashes:js,planMirrorResponse:Vs,readMirrorTree:Fs,applyMirrorPlan:Ds}});var ti=Se((ta,lr)=>{var ei=require("fs"),ce=require("path");function ar(r,n="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 ${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.1.0"}});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),ie(t.onToken)){var s=t.onToken;t.onToken=function(o){return s.push(o)}}if(ie(t.onComment)&&(t.onComment=Xe(t,t.onComment)),t.sourceType==="commonjs"&&t.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return t}function Xe(e,t){return function(i,s,o,d,m,v){var y={type:i?"Block":"Line",value:s,start:o,end:d};e.locations&&(y.loc=new re(this,m,v)),e.ranges&&(y.range=[o,d]),t.push(y)}}var se=1,Ce=2,fe=4,ne=8,qe=16,ht=32,pt=64,vi=128,Be=256,Ze=512,xi=1024,ft=se|Ce|Be;function Bt(e,t){return Ce|(e?fe:0)|(t?ne:0)}var dt=0,$t=1,Re=2,yi=3,bi=4,wi=5,Y=function(t,i,s){this.options=t=ke(t),this.sourceFile=t.sourceFile,this.keywords=ge(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=ge(o);var d=(o?o+" ":"")+p.strict;this.reservedWordsStrict=ge(d),this.reservedWordsStrictBind=ge(d+" "+p.strictBind),this.input=String(i),this.containsEsc=!1,s?(this.pos=s,this.lineStart=this.input.lastIndexOf(`
|
|
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,`
|
|
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+=`
|
|
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
|
+
`&&++this.pos;case`
|
|
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 q(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 s=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],o=parseInt(s,8);return o>255&&(s=s.slice(0,-1),o=parseInt(s,8)),this.pos+=s.length-1,t=this.input.charCodeAt(this.pos),(s!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-s.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(o)}return $(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,s=this.options.ecmaVersion>=6;this.pos<this.input.length;){var o=this.fullCharCodeAtPos();if(E(o,s))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 m=this.readCodePoint();(t?I:E)(m,s)||this.invalidStringToken(d,"Invalid Unicode escape"),e+=q(m),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=Z[e]),this.finishToken(t,e)};var Gi="8.17.0";Y.acorn={Parser:Y,version:Gi,defaultOptions:je,Position:W,SourceLocation:re,getLineInfo:pe,Node:tt,TokenType:_,tokTypes:a,keywordTypes:Z,TokContext:be,tokContexts:J,isIdentifierChar:E,isIdentifierStart:I,Token:bt,isNewLine:$,lineBreak:x,lineBreakG:P,nonASCIIwhitespace:ee};function xs(e,t){return Y.parse(e,t)}function ys(e,t,i){return Y.parseExpressionAt(e,t,i)}function bs(e,t){return Y.tokenizer(e,t)}r.Node=tt,r.Parser=Y,r.Position=W,r.SourceLocation=re,r.TokContext=be,r.Token=bt,r.TokenType=_,r.defaultOptions=je,r.getLineInfo=pe,r.isIdentifierChar=E,r.isIdentifierStart=I,r.isNewLine=$,r.keywordTypes=Z,r.lineBreak=x,r.lineBreakG=P,r.nonASCIIwhitespace=ee,r.parse=xs,r.parseExpressionAt=ys,r.tokContexts=J,r.tokTypes=a,r.tokenizer=bs,r.version=Gi})});var Ir=Se((aa,Cr)=>{var{parse:nn}=wr();function Qe(){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 kr(r){if(r.type!=="Property"||r.computed||r.method||r.kind!=="init")throw Qe();let n=r.key.type==="Identifier"?r.key.name:r.key.value;if(typeof n!="string"||["__proto__","constructor","prototype"].includes(n))throw Qe();return n}function Sr(r){if(r.type==="ExportDefaultDeclaration")return r.declaration;let n=r.type==="ExpressionStatement"?r.expression:null;return n?.type==="AssignmentExpression"&&n.operator==="="&&n.left.type==="MemberExpression"&&!n.left.computed&&n.left.object.name==="module"&&n.left.property.name==="exports"?n.right:null}function an(r,n){if(r.type!=="VariableDeclaration"||r.declarations.length!==1)return null;let[c]=r.declarations;return c.id.type!=="Identifier"||n?.type!=="Identifier"||n.name!==c.id.name?null:c.init}function on(r){let c=nn(r,{ecmaVersion:"latest",sourceType:"module"}).body.filter(p=>p.type!=="EmptyStatement"&&!p.directive),u=c.length===1?Sr(c[0]):c.length===2?an(c[0],Sr(c[1])):null;if(u?.type!=="ObjectExpression")throw Qe();function l(p,h=0){if(h>64)throw Qe();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 Qe();return l(f,h+1)});if(p.type==="ObjectExpression")return Object.fromEntries(p.properties.map(f=>[kr(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 Qe()}return{config:l(u),expression:u}}Cr.exports={parseStaticConfig:on,propertyName:kr}});var _r=Se((oa,Ar)=>{var X=require("fs");function cn(r){try{let n=X.readFileSync(r,"utf8");return JSON.parse(n)}catch(n){if(n.code==="ENOENT")return null;throw n}}function un(r){try{return X.readFileSync(r,"utf8").replace(/^\uFEFF/,"")}catch(n){if(n.code==="ENOENT")return null;throw n}}function ln(r,n,c=2){let u=JSON.stringify(n,null,c);X.writeFileSync(r,u,"utf8")}function hn(r,n){X.writeFileSync(r,n,"utf8")}function pn(r,n){if(n==null||typeof n=="object"&&Object.keys(n).length===0||Array.isArray(n)&&n.length===0){let u=`module.exports = ${Array.isArray(n)?"[]":"{}"};`;X.writeFileSync(r,u,"utf8")}else{let c=`module.exports = ${JSON.stringify(n,null,2)};`;X.writeFileSync(r,c,"utf8")}}function fn(r){return X.existsSync(r)}function dn(r){X.mkdirSync(r,{recursive:!0})}function mn(r){X.rmSync(r,{recursive:!0,force:!0})}function gn(r){X.rmSync(r,{force:!0})}function vn(r,n){X.mkdirSync(require("path").dirname(r),{recursive:!0,mode:448});let c=`${r}.${process.pid}.${Date.now()}.tmp`;try{X.writeFileSync(c,`${JSON.stringify(n,null,2)}
|
|
15
|
+
`,{mode:384}),X.renameSync(c,r);try{X.chmodSync(r,384)}catch{}}finally{X.rmSync(c,{force:!0})}}async function xn(r,n,c){X.mkdirSync(require("path").dirname(r),{recursive:!0,mode:448});let u=`${r}.lock`,l=Date.now()+2e4,p;for(;p===void 0;)try{p=X.openSync(u,"wx",384),X.writeFileSync(p,String(process.pid))}catch(h){if(h.code!=="EEXIST")throw h;try{let f=Number(X.readFileSync(u,"utf8"));if(Number.isInteger(f)&&f>0)try{process.kill(f,0)}catch(g){if(g.code==="ESRCH"){X.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 n()}finally{X.closeSync(p),X.unlinkSync(u)}}Ar.exports={writePrivateJsonFileAtomic:vn,withPrivateFileLock:xn,readJsonFileSafe:cn,readFileSafe:un,writeJsonFile:ln,writeTextFile:hn,writeModuleExportsFile:pn,fileExists:fn,ensureDirectoryExists:dn,removeDirectory:mn,removeFile:gn}});var Tr=Se((ca,Nr)=>{var{parseStaticConfig:ai,propertyName:Lt}=Ir(),{fileExists:Er,readFileSafe:oi,writeTextFile:ci,readJsonFileSafe:yn}=_r(),Ye=require("path"),{normalizeAdopt:Pr}=ni(),{parseProjectTarget:bn}=(kt(),st(Xi));function Rr(r){try{return yn(r)??{}}catch{return{}}}function wn(r){return Rr(Ye.join(r,"package.json")).name||Ye.basename(r)}function Sn(r={}){let n={...r};return delete n.ffId,delete n.appRoot,delete n.adoptExplicit,delete n["auth-token"],delete n.authToken,n}function kn(r,n,{ffId:c,name:u,adopt:l,framework:p,primitive:h,apiUrl:f,baseLibrary:g,tag:b}){let w=bn({framework:p,primitive:h},"Setup Project target"),C=Sn(n),I={name:u.trim(),"ff-id":c.trim(),adopt:Pr(l),framework:w.framework,primitive:w.primitive};if(b!==void 0){if(typeof b!="string"||!b.trim())throw new Error("Release tag must not be empty.");I.tag=b.trim()}if(g!==void 0){if(!["frontfriend","shadcn"].includes(g))throw new Error("Base library must be frontfriend or shadcn.");I.baseLibrary=g}f&&(I["api-url"]=String(f).replace(/\/+$/,""),delete C.apiUrl);for(let[O,N]of Object.entries(C))O in I||(I[O]=N);let E=Ye.join(r,"frontfriend.config.js"),_;if(Er(E)){let O=oi(E),{expression:N}=ai(O),B=new Set(["name","ff-id","adopt","framework","primitive",...b!==void 0?["tag","releaseTagId"]:[],...f?["api-url","apiUrl"]:[],...g!==void 0?["baseLibrary"]:[]]),Z=new Set(["auth-token","authToken","ffId","appRoot","adoptExplicit"]),V=N.properties.filter(x=>!B.has(Lt(x))&&!Z.has(Lt(x))).map(x=>O.slice(x.start,x.end));_=[...Object.entries(I).filter(([x])=>B.has(x)).map(([x,P])=>`${JSON.stringify(x)}: ${JSON.stringify(P)}`),...V]}else _=Object.entries(I).map(([O,N])=>`${JSON.stringify(O)}: ${JSON.stringify(N)}`);return ci(E,ui(r,_)),I}function ui(r,n){let c=`{
|
|
16
|
+
${n.join(`,
|
|
17
|
+
`)}
|
|
18
|
+
}`;return Rr(Ye.join(r,"package.json")).type==="module"?`const config = ${c};
|
|
19
|
+
|
|
20
|
+
export default config;
|
|
21
|
+
`:`module.exports = ${c};
|
|
22
|
+
`}function Cn(r,n){let c=Ye.join(r,"frontfriend.config.js");if(!n||!Er(c))return!1;let u=oi(c),{config:l,expression:p}=ai(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(n).replace(/\/+$/,""))}`];return ci(c,ui(r,h)),!0}function In(r,n){let c=Ye.join(r,"frontfriend.config.js"),u=oi(c),{expression:l}=ai(u),p=Pr(n),h=`${JSON.stringify("adopt")}: ${JSON.stringify(p)}`,f=l.properties.map(g=>Lt(g)==="adopt"?h:u.slice(g.start,g.end));return l.properties.some(g=>Lt(g)==="adopt")||f.push(h),ci(c,ui(r,f)),p}Nr.exports={defaultAppName:wn,writeSetupConfig:kn,writeConfigApiUrl:Cn,writeConfigAdopt:In}});var jr=Se((ua,Or)=>{var Lr=require("path"),{createRequire:An}=require("module"),Ot;function _n(r){if(Ot)return Ot;let n=[null,r&&Lr.isAbsolute(r)?r:null,Lr.join(process.cwd(),"package.json")];for(let u of n)try{return Ot=u?An(u)("typescript"):require("typescript"),Ot}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}Or.exports={loadTypeScript:_n}});var Dr=Se((ha,Fr)=>{var la=require("path"),{loadTypeScript:En}=jr(),jt={ui:"@/components/ui",components:"@/components",utils:"@/lib/utils",lib:"@/lib",hooks:"@/hooks"};function li(r,n){if(n.endsWith(".vue"))return[...r.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/gi)].flatMap(h=>{let f=h.index+h[0].indexOf(">")+1;return li(h[1],`${n}.ts`).map(g=>({...g,start:g.start+f,end:g.end+f}))});let c=En(n),u=c.createSourceFile(n,r,c.ScriptTarget.Latest,!0,n.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 Vr(r,n,c,u){let l=li(r,n).map(h=>{let f=h.value.replace(/^@\/registry\/(?:bases\/)?[^/]+\/(ui|lib|hooks|components)\//,(g,b)=>`${jt[b]}/`);for(let[g,b]of Object.entries(c).sort((w,C)=>String(C[1]).length-String(w[1]).length))if(jt[g]&&(f===b||f.startsWith(`${b}/`))){f=jt[g]+f.slice(b.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 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
|
+
`}ot();function qs(r){let n=r.projectTarget;return(r.replacements||[]).filter(c=>!n||c.framework===n.framework&&c.primitive===n.primitive)}function dr(r){let n=qs(r),c=new Map(n.map(l=>[`${l.framework}/${l.primitive}/${l.canonicalName}`,l.privateAddress]));for(let l of n)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=Ws(l);return u.has(h)?!1:(u.add(h),!0)})}function Ws(r){return r.kind==="private"?`private:${r.address}`:`canonical:${r.framework}/${r.primitive}/${r.canonicalName}`}var{planMirrorResponse:Bn,readMirrorTree:$n,validatePinnedMirror:Un,MIRROR_DIR:Mt}=Xt(),{materializeSource:qn}=$r(),Wn=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i;function he(r){if(typeof r!="string"||!r||r.includes("\0"))throw new R("Installation paths must be non-empty and contain no null bytes.");let n=r.replace(/\\/g,"/"),c=n.split("/");if(D.default.posix.isAbsolute(n)||/^[A-Za-z]:\//.test(n)||c.some(u=>!u||u==="."||u==="..")||c.some(u=>Wn.test(u)))throw new R(`Unsafe installation path: ${r}`);return n}function di(r){return r.kind==="private"?r.address:r.canonicalName}function fi(r){return r.kind==="private"?"private":"canonical"}function lt(r){return dr(r)}function Hn(r,n){let c=$e(r),u=new Map(Object.entries(c.components).map(([p,h])=>[h.versionId,p])),l=new Map;for(let p of n){for(let h of p.warnings??[]){let f=u.get(h.versionId);!f||h.code!=="WITHDRAWN_HISTORICAL_VERSION"||h.severity!=="urgent"||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 lt(p)){let f=u.get(h.id);if(!f||!h.withdrawnAt)continue;let g=`${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:g})}}return[...l.values()].sort((p,h)=>p.identity.localeCompare(h.identity))}function Ur(r){if(!r.designSystemId||!r.ffId||!r.releaseId||!r.tokenVersionId)throw new R("Resolved Releases must include their Release, token, Design System id and ff-id.")}function ut(r){return`${r.framework}/${r.primitive}/${r.canonicalName}`}function Hr(r,n){if(n.contractsOnly||r.tokenVersionId!==n.tokenVersionId||"baseLibrary"in r&&r.baseLibrary!==(n.baseLibrary||"frontfriend")||"baseProvenance"in r&&JSON.stringify(Pe(r.baseProvenance||{}))!==JSON.stringify(Pe(n.baseProvenance||{})))return!1;let c=(p=[])=>Pe(Object.fromEntries(p.map(h=>[ut(h),h.privateAddress])));if("replacements"in r&&JSON.stringify(c(r.replacements))!==JSON.stringify(c(n.replacements))||r.schemaVersion!==1&&r.sourceReleaseIds.some(p=>p!==n.releaseId))return!1;if(r.schemaVersion!==1&&r.design){if(r.design.sharedSourceReleaseId!==n.releaseId||JSON.stringify(Pe(Object.fromEntries(r.design.sharedContracts.map(p=>[p.slug,p]))))!==JSON.stringify(Pe(Object.fromEntries((n.contracts??[]).map(p=>[p.slug,p])))))return!1}else if(n.contracts!==void 0)return!1;let u=new Map(lt(n).map(p=>[di(p),p.id])),l=Object.entries(r.components);return l.length===u.size&&l.every(([p,h])=>u.get(p)===h.versionId)}function qr(r,n){if(!n.contractsOnly&&r&&r.schemaVersion!==1&&r.releaseId===n.releaseId&&!Hr(r,n))throw new R("The same immutable Release cannot resolve to a different token or component closure.")}function Wr(r,n,c=[]){for(let u of[...c].reverse()){let l=D.default.join(r,he(u.from)),p=D.default.join(r,he(u.to));if(!F.default.existsSync(p))continue;let h=D.default.join(n,`case-rollback-${gi.default.randomBytes(6).toString("hex")}`);F.default.renameSync(p,h),F.default.mkdirSync(D.default.dirname(l),{recursive:!0}),F.default.renameSync(h,l)}}var mi=class{constructor(n={}){this.root=D.default.resolve(n.root||process.cwd()),this.canonicalUiPath=n.canonicalUiPath??null,this.usesFilesystem=!n.readFile&&!n.writeFile,this.mutationLockDepth=0,this.mutationLockFd=null,this.readFile=n.readFile||(c=>{let u=D.default.join(this.root,he(c));try{return F.default.readFileSync(u,"utf8")}catch(l){if(De(l)==="ENOENT")return null;throw l}}),this.writeFile=n.writeFile||((c,u)=>{let l=D.default.join(this.root,he(c));F.default.mkdirSync(D.default.dirname(l),{recursive:!0}),F.default.writeFileSync(l,u)})}installationPath(n,c){return he(ri({root:this.root,source:fi(n),path:he(c),configuredUiPath:this.canonicalUiPath,installationLayout:n.installationLayout||(n.source==="shadcn"?"shadcn":void 0)}))}installationSource(n,c,u){if(n.source!=="shadcn"&&n.installationLayout!=="shadcn")return u;let l={};try{l=JSON.parse(F.default.readFileSync(D.default.join(this.root,"components.json"),"utf8")).aliases||{}}catch{}return qn(u,c,l,n.sourceAliases,this.installationPath(n,c))}acquireMutationLock(){if(!this.usesFilesystem)return()=>{};if(this.mutationLockDepth>0)return this.mutationLockDepth+=1,()=>{this.mutationLockDepth-=1};F.default.mkdirSync(this.root,{recursive:!0});let n=D.default.join(this.root,".frontfriend-update.lock"),c=l=>{try{let p=F.default.openSync(n,"wx");return F.default.writeFileSync(p,`${JSON.stringify({schemaVersion:1,pid:process.pid})}
|
|
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
|
+
`),F.default.writeFileSync(C,`${JSON.stringify({...I,state:"committing"})}
|
|
27
|
+
`);let E=0,_=new Set;for(let O of n.renames||[]){let N=he(O.from),B=he(O.to);c.beforeCommitFile?.(B,E);try{F.default.unlinkSync(D.default.join(this.root,N))}catch(V){if(De(V)!=="ENOENT")throw V}let Z=D.default.join(this.root,B);F.default.mkdirSync(D.default.dirname(Z),{recursive:!0}),F.default.renameSync(D.default.join(f,B),Z),_.add(B),E+=1}for(let O of Object.keys(n.writes)){if(_.has(O))continue;c.beforeCommitFile?.(O,E);let N=D.default.join(this.root,O);F.default.mkdirSync(D.default.dirname(N),{recursive:!0}),F.default.renameSync(D.default.join(f,O),N),E+=1}for(let O of n.deletes||[]){c.beforeCommitFile?.(O,E);try{F.default.unlinkSync(D.default.join(this.root,he(O)))}catch(N){if(De(N)!=="ENOENT")throw N}E+=1}return c.beforeCommitFile?.(l,E),F.default.renameSync(D.default.join(f,l),D.default.join(this.root,l)),F.default.writeFileSync(C,`${JSON.stringify({...I,state:"committed"})}
|
|
28
|
+
`),w=!0,n.nextLock}catch(C){try{for(let I of b){let E=D.default.join(this.root,I.path);if(I.existed){let _=D.default.join(g,I.path);F.default.mkdirSync(D.default.dirname(E),{recursive:!0}),F.default.copyFileSync(_,E)}else try{F.default.unlinkSync(E)}catch(_){if(De(_)!=="ENOENT")throw _}}Wr(this.root,h,n.renames),w=!0}catch(I){throw new R(`Update failed and rollback could not complete; recovery data was preserved at ${h}: ${Ct(I)}`)}throw C}finally{w&&F.default.rmSync(h,{recursive:!0,force:!0})}}finally{u()}}};0&&(module.exports={AdoptionConflictError,ApplicationAdoption,adoptionDigest,hashContent,parseApplicationLock,serializeApplicationLock,threeWayMerge,validateInstallationPath,withdrawalWarningsForLock});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const path=require("path"),{CACHE_DIR_NAME,CACHE_TTL_MS,CACHE_FILES}=require("./constants"),{CacheError}=require("./errors"),{readJsonFileSafe,readFileSafe,writeJsonFile,writeTextFile,writeModuleExportsFile,fileExists,ensureDirectoryExists,removeDirectory,removeFile}=require("./file-utils"),{CLASSES_SOURCE_FILE,CSS_CLASSES_SOURCE_FILE}=require("./classes-source");class CacheManager{constructor(e=process.cwd()){this.appRoot=e,this.cacheDir=path.join(e,"node_modules",CACHE_DIR_NAME),this.metadataFile=path.join(this.cacheDir,"metadata.json"),this.maxAge=CACHE_TTL_MS}getCacheDir(){return this.cacheDir}isLocalOnly(){return readJsonFileSafe(this.metadataFile)?.version==="local-components"}getIconLibrary(){const e=path.join(this.cacheDir,"iconLibrary.json");return fileExists(e)?readJsonFileSafe(e):null}exists(){return fileExists(this.cacheDir)}isValid(){if(!this.exists())return!1;try{const e=readJsonFileSafe(this.metadataFile);if(!e)return!1;const s=new Date(e.timestamp).getTime();return Date.now()-s<this.maxAge}catch{return!1}}load(){if(!this.exists())return null;try{const e={};for(const s of CACHE_FILES.JS){const t=path.join(this.cacheDir,s);if(fileExists(t)){const c=s.replace(".js","");try{const i=readFileSafe(t);if(i!==null){const r={},n={exports:r};new Function("module","exports",i)(n,r),e[c]=n.exports}}catch(i){console.warn(`[Frontfriend] Failed to load ${s}: ${i.message}`),(i.message.includes("Unexpected token")||i.message.includes("Invalid character"))&&console.warn("[Frontfriend] This might be a BOM or encoding issue. Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again.")}}}for(const s of CACHE_FILES.JSON){const t=path.join(this.cacheDir,s),c=s.replace(".json",""),i=readJsonFileSafe(t);i!==null&&(e[c]=i)}return e["components-config"]&&(e.componentsConfig=e["components-config"],delete e["components-config"]),e.cls&&!e.safelist&&(e.safelist=e.cls,delete e.cls),e}catch(e){throw new CacheError(`Failed to load cache: ${e.message}`,"read")}}save(e){try{ensureDirectoryExists(this.cacheDir);const s={timestamp:new Date().toISOString(),version:e.metadata?.version||"2.0.0",ffId:e.metadata?.ffId},t=["tokens","variables","semanticVariables","semanticDarkVariables","keyframes","animations","safelist","custom"];for(const i of t)if(e[i]!==void 0){const r=path.join(this.cacheDir,`${i}.js`);writeModuleExportsFile(r,e[i])}if(e.safelist&&Array.isArray(e.safelist)){const i=path.join(this.cacheDir,"safelist.js");writeModuleExportsFile(i,e.safelist)}const c={fonts:e.fonts,icons:e.icons||e.iconSet,"components-config":e.componentsConfig,iconLibrary:e.iconLibrary,version:e.version,versionMetadata:e.versionMetadata,base:e.base,nativeTokens:e.nativeTokens};for(const[i,r]of Object.entries(c))if(r!==void 0){const n=path.join(this.cacheDir,`${i}.json`);writeJsonFile(n,r)}e.themeCSS!==void 0&&writeTextFile(path.join(this.cacheDir,"theme.css"),e.themeCSS),e.classesContent!==void 0&&(writeTextFile(path.join(this.cacheDir,CLASSES_SOURCE_FILE),e.classesContent),removeFile(path.join(this.cacheDir,CSS_CLASSES_SOURCE_FILE))),writeJsonFile(this.metadataFile,s)}catch(s){throw new CacheError(`Failed to save cache: ${s.message}`,"write")}}saveAtomic(e,s=()=>{}){const t=require("node:fs"),{randomUUID:c}=require("node:crypto");t.mkdirSync(path.dirname(this.cacheDir),{recursive:!0});const i=`${this.cacheDir}.write-lock`;let r;try{r=t.openSync(i,"wx")}catch(o){if(o.code!=="EEXIST")throw o;const l=Number(t.readFileSync(i,"utf8"));let h=!0;if(l>0)try{process.kill(l,0)}catch(f){h=f.code!=="ESRCH"}if(h)throw new CacheError("Another process is installing tokens. Retry after it completes.","write");t.unlinkSync(i),r=t.openSync(i,"wx")}const n=`${this.cacheDir}.previous`,a=`${this.cacheDir}.${c()}.pending`;try{t.writeFileSync(r,String(process.pid)),!t.existsSync(this.cacheDir)&&t.existsSync(n)&&t.renameSync(n,this.cacheDir);const o=new CacheManager(this.appRoot);o.cacheDir=a,o.metadataFile=path.join(a,"metadata.json"),o.save(e),t.existsSync(n)&&t.rmSync(n,{recursive:!0}),t.existsSync(this.cacheDir)&&t.renameSync(this.cacheDir,n);try{t.renameSync(a,this.cacheDir),s()}catch(l){throw t.rmSync(this.cacheDir,{recursive:!0,force:!0}),t.existsSync(n)&&t.renameSync(n,this.cacheDir),l}t.rmSync(n,{recursive:!0,force:!0})}finally{t.rmSync(a,{recursive:!0,force:!0}),t.closeSync(r),t.rmSync(i,{force:!0})}}clear(){this.exists()&&removeDirectory(this.cacheDir)}}module.exports=CacheManager;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p=(n,o)=>()=>(o||n((o={exports:{}}).exports,o),o.exports);var y=p((O,d)=>{function i(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function s(n,o){if(!i(n)||!i(o))return o===void 0?n:o;let e={...n};for(let[t,r]of Object.entries(o))e[t]=t in e?s(e[t],r):r;return e}function u(n,o,e=[],t=[]){if(n===void 0||o===void 0)return t;if(!i(n)||!i(o))return t.push(e.join(".")),t;for(let r of Object.keys(n))r in o&&u(n[r],o[r],[...e,r],t);return t}function f(n){return i(n)&&("styles"in n||"behavior"in n)}function a(n,o="component"){if(!f(n)||!i(n.styles)||n.behavior!==void 0&&!i(n.behavior)||Object.keys(n).some(t=>!["styles","behavior"].includes(t)))throw new TypeError(`Component ${o} must use the styles/behavior envelope`);let e=u(n.styles,n.behavior,[o]);if(e.length>0)throw new Error(`Component config styles/behavior conflict at ${e.join(", ")}`);return s(n.styles||{},n.behavior||{})}function C(n){if(!i(n))return n;let o=!1,e={};for(let[t,r]of Object.entries(n))e[t]=a(r,t),e[t]!==r&&(o=!0);return o?e:n}d.exports={isPlainObject:i,deepMerge:s,findTreeConflicts:u,isComponentEnvelope:f,toRuntimeComponentConfig:a,toRuntimeComponentsConfig:C}});var{toRuntimeComponentConfig:h}=y(),c='FrontFriend components configuration not found. Run "npx frontfriend init" or "npx frontfriend sync".',j="FrontFriend components configuration was not returned by the SaaS app. The cache was not updated.";function b(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function m(n,o=c){if(!b(n)||Object.keys(n).length===0)throw new Error(o);for(let[e,t]of Object.entries(n))h(t,e);return n}function E(n){if(!n.exists())throw new Error(c);let o=n.load();return{componentsConfig:m(o?.componentsConfig),icons:b(o.icons)?o.icons:{}}}module.exports={CACHE_ERROR_MESSAGE:c,SAAS_ERROR_MESSAGE:j,assertComponentsConfig:m,loadCachedComponents:E};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n="classes.txt",i="classes.css",l=new Set(["after","backdrop","before","file","first-letter","first-line","marker","placeholder","selection"]);function S(e){if(typeof e!="string")return!0;let t=e.split(":").slice(0,-1);return t.every((s,r)=>!l.has(s)||r===t.length-1)}module.exports={CLASSES_SOURCE_FILE:n,CSS_CLASSES_SOURCE_FILE:i,isCompilableClass:S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var P=(e,o)=>{for(var t in o)g(e,t,{get:o[t],enumerable:!0})},k=(e,o,t,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of I(o))!B.call(e,l)&&l!==t&&g(e,l,{get:()=>o[l],enumerable:!(s=x(o,l))||s.enumerable});return e};var M=e=>k(g({},"__esModule",{value:!0}),e);var J={};P(J,{CONFIGURED_COMPONENTS:()=>H,resolveComponentConfig:()=>q});module.exports=M(J);function m(e){return typeof e=="object"&&e!==null||typeof e=="function"}function n(e,o){return m(e)?e[o]:void 0}function a(e,o){let t=m(e)?e:null,s=t?Object.create(t):{},l=(p,u)=>Object.defineProperty(s,p,{value:u,enumerable:!0,writable:!0,configurable:!0});if(t)for(let p of Object.keys(t))l(p,t[p]);for(let p of Object.keys(o))l(p,o[p]);return s}function D(e,o){let t={};for(let s of o){let l=n(e,s);l!==void 0&&(t[s]=l)}return t}function r(...e){return e.find(o=>o!=null)||""}function d(...e){return e.find(Boolean)||{}}function C(e,o,t){return e[o]||D(e,t)}function y(e){return a(e,{default:r(e.default,e.main),outline:r(e.outline,e.tertiary),linkDestructive:r(e.linkDestructive,e.linkdestructive)})}function z(e){let o=n(e,"variants"),t=d(e.variant,n(o,"variant")),s=d(e.size,n(o,"size")),l=d(e.iconPosition,n(o,"iconPosition")),p=d(e.fullwidth,n(o,"fullwidth")),u=n(e.slots,"icon")||{},v=n(u,"variants"),i=d(u.size,n(v,"size")),O=d(u.color,n(v,"color")),f=N=>{let c=n(l,N);return a(c,{sm:r(n(c,"sm"),n(c,"small")),lg:r(n(c,"lg"),n(c,"large"))})};return a(e,{variant:y(t),size:a(s,{icon:r(s.icon,n(n(l,"default"),"default")),"icon-xs":r(s["icon-xs"],s.xs,s.small,s.sm),"icon-sm":r(s["icon-sm"],s.small,s.sm),"icon-lg":r(s["icon-lg"],s.large,s.lg)}),iconPosition:a(l,{prefix:f("prefix"),suffix:f("suffix"),default:f("default")}),fullwidth:p,slots:a(e.slots,{icon:a(u,{size:a(i,{icon:r(i.icon,i.default),"icon-xs":r(i["icon-xs"],i.xs,i.small,i.sm,i.default),"icon-sm":r(i["icon-sm"],i.sm,i.default),"icon-lg":r(i["icon-lg"],i.lg,i.default)}),color:y(O)})})})}function b(e){let o=e.variant,t=n(o,"subtle");return a(e,{variant:a(o,{default:r(n(o,"default"),n(o,"main")),outline:r(n(o,"outline"),n(o,"tertiary")),ghost:r(n(o,"ghost"),n(o,"tertiary")),link:r(n(o,"link"),n(o,"tertiary")),subtle:a(t,{default:r(n(t,"default"),n(t,"main"))})})})}function h(e){let o=e.slots,t=n(o,"caption");return a(e,{slots:a(o,{caption:a(t,{overlay:n(t,"overlay")??n(t,"root")})})})}function w(e,o={}){let t=n(e.slots,"calendar")??o.calendar,s=n(t,"slots"),l=n(s,"range");return a(e,{slots:a(e.slots,{calendar:a(t,{slots:a(s,{range:a(l,{root:n(l,"root")??n(s,"root"),container:n(l,"container")??n(s,"content"),row:n(l,"row")??n(s,"row")})})})})})}var A=["header","title","description","content","action","footer"],V=["noContent","outside"],G=["footerAlign"];function T(e){return a(e,{slots:C(e,"slots",A),states:C(e,"states",V),props:C(e,"props",G)})}var K=["dialog","input","list","empty","group","separator","item","shortcut","combobox"];function j(e){return a(e,{slots:C(e,"slots",K)})}var _=["addon","button","text","input","textarea"];function E(e){return a(e,{slots:C(e,"slots",_)})}function R(e){return a(e.props,{padding:n(e.props,"padding")||e.padding})}function L(e){return a(e,{props:R(e)})}var U=["horizontal","vertical","container"];function F(e){return a(e,{slots:C(e,"slots",U),props:R(e)})}function $(e){return a(e,{root:e.root,slots:a(e.slots,{track:n(e.slots,"track")})})}var S={button:z,badge:b,calendar:h,card:T,command:j,"date-slider":w,"input-group":E,popover:L,separator:F,spinner:$};function q(e,o,...t){if(!Object.prototype.hasOwnProperty.call(S,e))throw new TypeError(`No component configuration policy for "${String(e)}".`);if(o==null)return o;if(!m(o))throw new TypeError("Component config must be an object.");let s=o;return S[e](s,t[0])}var H=Object.freeze(Object.keys(S));0&&(module.exports={CONFIGURED_COMPONENTS,resolveComponentConfig});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var h=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var g=h((D,y)=>{function f(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function p(e,n){if(!f(e)||!f(n))return n===void 0?e:n;let o={...e};for(let[r,a]of Object.entries(n))o[r]=r in o?p(o[r],a):a;return o}function u(e,n,o=[],r=[]){if(e===void 0||n===void 0)return r;if(!f(e)||!f(n))return r.push(o.join(".")),r;for(let a of Object.keys(e))a in n&&u(e[a],n[a],[...o,a],r);return r}function m(e){return f(e)&&("styles"in e||"behavior"in e)}function b(e,n="component"){if(!m(e)||!f(e.styles)||e.behavior!==void 0&&!f(e.behavior)||Object.keys(e).some(r=>!["styles","behavior"].includes(r)))throw new TypeError(`Component ${n} must use the styles/behavior envelope`);let o=u(e.styles,e.behavior,[n]);if(o.length>0)throw new Error(`Component config styles/behavior conflict at ${o.join(", ")}`);return p(e.styles||{},e.behavior||{})}function E(e){if(!f(e))return e;let n=!1,o={};for(let[r,a]of Object.entries(e))o[r]=b(a,r),o[r]!==a&&(n=!0);return n?o:e}y.exports={isPlainObject:f,deepMerge:p,findTreeConflicts:u,isComponentEnvelope:m,toRuntimeComponentConfig:b,toRuntimeComponentsConfig:E}});var C=h((Z,j)=>{var w=["open","closed","checked","unchecked","indeterminate","active"],A={open:['[data-expanded]:not([data-expanded="false"])','[data-popup-open]:not([data-popup-open="false"])','[data-panel-open]:not([data-panel-open="false"])']},S="on",T=["/* Dark mode follows the root class the theme picker toggles. */","@custom-variant dark {"," &:is(.dark, .dark *) {"," @slot;"," }","}",""],d=[...T,"/* Cross-primitive state variants (Radix `data-state=x`, Base UI `data-x`). */",...w.flatMap(e=>{let n=[`[data-state="${e}"]`,`[data-${e}]:not([data-${e}="false"])`,...A[e]||[]];return[`@custom-variant data-${e} {`,...n.map((o,r)=>` &:where(${o})${r===n.length-1?" {":","}`)," @slot;"," }","}",""]}),`@custom-variant data-${S} {`,' &:where([data-state="on"]),',' &:where([aria-pressed="true"]) {'," @slot;"," }","}","","@custom-variant data-selected {",' &:where([data-selected="true"]) {'," @slot;"," }","}","","@custom-variant data-disabled {",' &:where([data-disabled="true"]),',' &:where([data-disabled]:not([data-disabled="false"])) {'," @slot;"," }","}","",...["horizontal","vertical"].flatMap(e=>[`@custom-variant data-${e} {`,` &:where([data-orientation="${e}"]) {`," @slot;"," }","}",""])],$=d.filter(e=>e.startsWith("@custom-variant ")).map(e=>e.slice(16).replace(" {",""));function R(){return d.join(`
|
|
2
|
+
`)}j.exports={CROSS_PRIMITIVE_STATES:w,DARK_VARIANT_CSS:T,EXTRA_STATE_MATCHERS:A,PRESSED_STATE:S,STATE_VARIANT_CSS:d,STATE_VARIANT_NAMES:$,stateVariantCss:R}});var{findTreeConflicts:v}=g();function k(e){return String(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function _(e,n){let o=e.length-1,r=e.filter((a,l)=>(l===o||!["styles","slots","variants"].includes(a))&&a!=="root");return[n,...r.map(k)].filter(Boolean).join("-")}function M(e){let n=[],o=[];for(let r of e.trim().split(/\s+/))/^(group|peer)(?:\/[^\s]+)?$/.test(r)?n.push(r):o.push(r);return{passthrough:n,recipe:o}}function O(e,n={}){let o=n.prefix||"ff",r=new Map;function a(i,t){if(typeof i=="string"){let s=_(t,o),c=M(i);return r.set(s,{className:c.recipe.join(" "),depth:t.length,base:t[t.length-1]==="root"}),[s,...c.passthrough].join(" ")}if(Array.isArray(i))return i.map((s,c)=>a(s,[...t,String(c)]));if(!i||typeof i!="object")throw new Error(`Style value at ${t.join(".")} must be a string or object`);return Object.fromEntries(Object.entries(i).map(([s,c])=>[s,a(c,[...t,s])]))}let l={};for(let[i,t]of Object.entries(e||{})){if(!t||typeof t!="object"||!("styles"in t))throw new Error(`Component ${i} must use the styles/behavior envelope`);let s=v(t.styles,t.behavior,[i]);if(s.length>0)throw new Error(`Component config styles/behavior conflict at ${s.join(", ")}`);l[i]={styles:a(t.styles,[i,"styles"]),...t.behavior===void 0?{}:{behavior:t.behavior}}}return{config:l,classes:Object.fromEntries([...r.entries()].sort(([,i],[,t])=>i.depth-t.depth||Number(t.base)-Number(i.base)).map(([i,t])=>[i,t.className]))}}function x(e,n=[]){let o=new Map(e.map(([t],s)=>[t,s])),r=new Map(e.map(([t])=>[t,0])),a=new Map(e.map(([t])=>[t,[]]));for(let t of n){let s=t.filter(c=>o.has(c));for(let c=1;c<s.length;c+=1)a.get(s[c-1]).push(s[c]),r.set(s[c],r.get(s[c])+1)}let l=e.map(([t])=>t).filter(t=>r.get(t)===0),i=[];for(;l.length>0;){l.sort((s,c)=>o.get(s)-o.get(c));let t=l.shift();i.push(e[o.get(t)]);for(let s of a.get(t))r.set(s,r.get(s)-1),r.get(s)===0&&l.push(s)}if(i.length!==e.length){let t=e.map(([s])=>s).filter(s=>r.get(s)>0);throw new Error(`Recipe order has a cycle between ${t.join(", ")}`)}return i}function N(e,n={}){let o=n.scope||"default";if(!/^[a-zA-Z0-9_-]+$/.test(o))throw new Error("Recipe scope may only contain letters, numbers, dashes, and underscores");return`@layer base {
|
|
3
|
+
${x(Object.entries(e).filter(([,a])=>typeof a=="string"&&a.trim()),n.order).map(([a,l])=>` :where([data-ff-recipe="${o}"]) .${a} {
|
|
4
|
+
@apply ${l.trim()};
|
|
5
|
+
}`).join(`
|
|
6
|
+
`)}
|
|
7
|
+
}
|
|
8
|
+
`}var{STATE_VARIANT_CSS:I,STATE_VARIANT_NAMES:V,stateVariantCss:P}=C();module.exports={STATE_VARIANT_CSS:I,STATE_VARIANT_NAMES:V,stateVariantCss:P,createComponentRecipe:O,emitComponentRecipeCss:N};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t={$id:"https://frontfriend.dev/schemas/components-config.schema.json",type:"object",additionalProperties:{$ref:"#/$defs/componentConfig"},$defs:{componentConfig:{$ref:"#/$defs/componentEnvelope"},styleTree:{anyOf:[{type:"string"},{type:"object",additionalProperties:{$ref:"#/$defs/styleTree"}}]},behaviorTree:{anyOf:[{type:["string","number","boolean","null"]},{type:"array",items:{$ref:"#/$defs/behaviorTree"}},{type:"object",additionalProperties:{$ref:"#/$defs/behaviorTree"}}]},componentEnvelope:{type:"object",additionalProperties:!1,required:["styles"],properties:{styles:{type:"object",additionalProperties:{$ref:"#/$defs/styleTree"}},behavior:{type:"object",additionalProperties:{$ref:"#/$defs/behaviorTree"}}}}}};function o(e){return typeof e=="string"&&e.trim().length>0}module.exports={componentsConfigSchema:t,isCSSClassString:o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const path=require("path"),{parseStaticConfig}=require("./static-config"),{findFileUpward}=require("./path-utils"),{fileExists,readJsonFileSafe,readFileSafe}=require("./file-utils"),{normalizeAdopt}=require("./adoption");function loadedConfig(i,e){const o=path.dirname(e),n={...i,ffId:i["ff-id"]||null,appRoot:o};if(!n.name){const r=readJsonFileSafe(path.join(o,"package.json"))?.name;r&&(n.name=r)}return i.adopt!==void 0&&(n.adopt=normalizeAdopt(i.adopt),n.adoptExplicit=!0),n}async function readFreshConfig(i){return parseStaticConfig(readFileSafe(i)).config}class ConfigLoader{findConfigFile(e=process.cwd()){return findFileUpward("frontfriend.config.js",e)}isESModule(e){try{const o=path.join(e,"package.json"),n=readJsonFileSafe(o);if(n)return n.type==="module"}catch{}return!1}async load({startDir:e=process.cwd(),strict:o=!1,fresh:n=!1}={}){const r=this.findConfigFile(e);if(r)try{if(n)return loadedConfig(await readFreshConfig(r),r);let t;const a=path.dirname(r);if(r.endsWith(".js")&&this.isESModule(a)){const s=await import(`file://${r}`);t=s.default||s}else t=require(r);return loadedConfig(t,r)}catch(t){if(o||t.code==="FRONTFRIEND_CONFIG_VALIDATION")throw t;console.error("Error loading frontfriend.config.js:",t.message)}return{ffId:null,appRoot:e}}loadSync(){const e=this.findConfigFile();if(e)try{const o=path.dirname(e);if(e.endsWith(".js")&&this.isESModule(o))console.error("Error: frontfriend.config.js is an ES module. Please use the async load() method");else{const r=require(e);return loadedConfig(r,e)}}catch(o){if(o.code==="FRONTFRIEND_CONFIG_VALIDATION")throw o;console.error("Error loading frontfriend.config.js:",o.message)}return{ffId:null,appRoot:process.cwd()}}}module.exports=ConfigLoader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t="https://app.frontfriend.dev",o=".cache/frontfriend";var e={JS:["tokens.js","variables.js","semanticVariables.js","semanticDarkVariables.js","keyframes.js","animations.js","safelist.js","custom.js"],JSON:["fonts.json","icons.json","components-config.json","iconLibrary.json","version.json","versionMetadata.json","metadata.json","base.json","nativeTokens.json"]},r={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_AUTH_TOKEN:"FF_AUTH_TOKEN",FF_MACHINE_TOKEN:"FRONTFRIEND_MACHINE_TOKEN"};function a(n){if(!n)return null;try{let s=new URL(n);return s.hostname.startsWith("app.")?`${s.protocol}//${s.hostname.replace(/^app\./,"registry.")}`:null}catch{return null}}module.exports={DEFAULT_API_URL:t,CACHE_DIR_NAME:o,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:e,ENV_VARS:r,deriveRegistryFromApiUrl:a};
|