@frontfriend/sdk 1.1.0 → 1.2.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.
@@ -3,7 +3,7 @@ var ws=Object.create;var St=Object.defineProperty;var Ss=Object.getOwnPropertyDe
3
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
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
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.
6
+ `;)u+=1;else if(h==="/"&&l[u+1]==="*"){let f=l.indexOf("*/",u+2);if(f===-1)throw new Error(`Cannot read ${n}: unterminated comment.`);c+=l.slice(u,f+2).replace(/[^\n]/g," "),u=f+2}else c+=h,u+=1}let p="";for(let h=0;h<c.length;h+=1){let f=c[h];if(f==='"'){let g=h+1;for(;g<c.length&&c[g]!=='"';)g+=c[g]==="\\"?2:1;p+=c.slice(h,g+1),h=g;continue}if(f===","){let g=h+1;for(;g<c.length&&/\s/.test(c[g]);)g+=1;if(c[g]==="}"||c[g]==="]")continue}p+=f}try{return p.trim()?JSON.parse(p):{}}catch(h){throw new Error(`Cannot read ${n}: ${h.message}`)}}function or(r){return ar(ei.readFileSync(r,"utf8"),r)}var _t=r=>{try{return ei.statSync(r).isFile()}catch{return!1}};function cr(r,n){if(typeof r!="string"||!r)throw new Error('tsconfig "extends" must be a non-empty string.');let c=u=>_t(u)?u:!u.endsWith(".json")&&_t(`${u}.json`)?`${u}.json`:null;if(r.startsWith(".")||ce.isAbsolute(r)){let u=c(ce.resolve(n,r));if(u)return u;throw new Error(`File '${r}' not found (tsconfig extends, from ${n}).`)}for(let u=n;;u=ce.dirname(u)){let l=ce.join(u,"node_modules",r),p=c(l);if(p)return p;let h=null;try{h=JSON.parse(ei.readFileSync(ce.join(l,"package.json"),"utf8"))}catch{h=null}if(h&&typeof h.tsconfig=="string"&&_t(ce.join(l,h.tsconfig)))return ce.join(l,h.tsconfig);if(_t(ce.join(l,"tsconfig.json")))return ce.join(l,"tsconfig.json");if(ce.dirname(u)===u)break}for(let u of[r,`${r}/tsconfig.json`,`${r}.json`])try{return require.resolve(u,{paths:[n]})}catch{}throw new Error(`File '${r}' not found (tsconfig extends, from ${n}).`)}function ur(r,n,c=new Set){let u=ce.resolve(r);if(c.has(u))throw new Error(`Circularity detected while resolving configuration: ${u}`);let l=new Set(c).add(u),p=or(u),h=ce.dirname(u),f={},g=p.extends===void 0?[]:Array.isArray(p.extends)?p.extends:[p.extends];for(let C of g)f={...f,...ur(cr(C,h),n,l)};let b=p.compilerOptions&&typeof p.compilerOptions=="object"?p.compilerOptions:{},w=C=>typeof C=="string"?C.replace(/\$\{configDir\}/g,n):C;return typeof b.baseUrl=="string"&&(f.baseUrl=ce.resolve(h,w(b.baseUrl))),b.paths&&typeof b.paths=="object"&&(f.paths=Object.fromEntries(Object.entries(b.paths).map(([C,I])=>[C,Array.isArray(I)?I.map(w):I])),f.pathsBasePath=h),f}function $s(r){let n=ur(r,ce.dirname(ce.resolve(r)));return n.paths?{base:n.baseUrl||n.pathsBasePath||ce.dirname(r),paths:n.paths}:null}lr.exports={parseJsonc:ar,readJsonc:or,resolveExtends:cr,readConfigPaths:$s}});var Pt={};zt(Pt,{materializeInstallationPath:()=>ri,readProjectPaths:()=>pr,resolveCanonicalUiDirectory:()=>fr,resolveConfiguredAlias:()=>Et});function hr(r){try{return JSON.parse(Ke.default.readFileSync(r,"utf8"))}catch{return null}}function pr(r){for(let n of["tsconfig.json","tsconfig.app.json","jsconfig.json"]){let c=ue.default.join(r,n);if(!Ke.default.existsSync(c))continue;let u=Us(c);if(u)return u}return{base:r,paths:{"@/*":[Ke.default.existsSync(ue.default.join(r,"src"))?"src/*":"*"]}}}function Et(r,n,c=pr(r)){for(let[u,l]of Object.entries(c.paths)){if(!Array.isArray(l)||typeof l[0]!="string")continue;let[p,h=""]=u.split("*");if(!n.startsWith(p)||!n.endsWith(h)||!u.includes("*")&&n!==u)continue;let f=n.slice(p.length,h?-h.length:void 0);return ue.default.resolve(c.base,l[0].replace("*",f))}return n.startsWith("@/")?ue.default.resolve(r,Ke.default.existsSync(ue.default.join(r,"src"))?"src":".",n.slice(2)):ue.default.resolve(r,n)}function ii(r,n){let c=ue.default.relative(r,n).replace(/\\/g,"/");if(!c||c===".."||c.startsWith("../")||ue.default.posix.isAbsolute(c))throw new Error("The canonical ui alias must stay inside the Application root.");return c}function fr(r,n){if(n)return ii(r,Et(r,n));let u=hr(ue.default.join(r,"components.json"))?.aliases?.ui;return typeof u=="string"&&u?ii(r,Et(r,u)):Ke.default.existsSync(ue.default.join(r,"src"))?"src/components/ui":"components/ui"}function ri(r){if(r.installationLayout==="shadcn"&&/^(?:lib|hooks|components)\//.test(r.path)){let u=hr(ue.default.join(r.root,"components.json"))?.aliases||{},l=/^lib\/utils\.[^.]+$/.test(r.path),p=r.path.split("/")[0],h=l&&u.utils?u.utils:u[p]||`@/${p}`,f=Et(r.root,h);return ii(r.root,l&&u.utils?f+ue.default.extname(r.path):ue.default.join(f,r.path.slice(p.length+1)))}if(r.source!=="canonical"&&r.installationLayout!=="shadcn"||!r.path.startsWith("ui/"))return r.path;let n=r.path.slice(3);return ue.default.posix.join(fr(r.root,r.configuredUiPath),n)}var Ke,ue,Us,ot=Ji(()=>{Ke=Je(require("node:fs")),ue=Je(require("node:path")),{readConfigPaths:Us}=ti()});var mr=Se((ra,Hs)=>{Hs.exports={name:"@frontfriend/sdk",version:"1.2.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
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
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&&gt(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&&gt(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&&gt(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
9
  `),cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
@@ -1 +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};
1
+ var s="classes.txt",S="classes.css";module.exports={CLASSES_SOURCE_FILE:s,CSS_CLASSES_SOURCE_FILE:S};
@@ -1 +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};
1
+ var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var m=T((W,h)=>{var E=new Set(["after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]),C=new Set(["active","focus","focus-visible","focus-within","hover"]),S=new Set(["sm","md","lg","xl","2xl","any-pointer-coarse","any-pointer-fine","any-pointer-none","contrast-less","contrast-more","forced-colors","inverted-colors","landscape","motion-reduce","motion-safe","noscript","pointer-coarse","pointer-fine","pointer-none","portrait","print","starting"]),A=/^(?:min-|max-|@|supports-|in-(?!range$))/,j=/^\[&(?::(?:active|focus|focus-visible|focus-within|hover))+\]$/;function P(t){let e=[],n=0,s=0;for(let o=0;o<t.length;o+=1){let i=t[o];i==="["||i==="("?n+=1:(i==="]"||i===")")&&n>0?n-=1:i===":"&&n===0&&(e.push(t.slice(s,o)),s=o+1)}return e.push(t.slice(s)),{variants:e.slice(0,-1),utility:e[e.length-1]}}function u(t){return t.replace(/\/[\w-]+$/,"")}function l(t){let e=u(t);return E.has(e)||e.startsWith("[")&&e.includes("::")}function a(t){let e=u(t);return C.has(e)||S.has(e)?!0:e.startsWith("[")?e.startsWith("[@")||j.test(e):e.startsWith("not-")?a(e.slice(4)):A.test(e)}function d(t){if(typeof t!="string"||!t.includes(":"))return null;let e=t.startsWith("!")?"!":"",{variants:n,utility:s}=P(t.slice(e.length)),o=null,i=[];for(let r of n)o!==null&&!a(r)&&i.push(r),o===null&&l(r)&&(o=r);if(i.length===0)return null;let c=n.reduce((r,g,v)=>l(g)?v:r,-1),y=n.slice(0,c).filter(r=>!l(r)),f=n.slice(c+1),$=`${e}${[...y,...f.filter(r=>!a(r)),n[c],...f.filter(a),s].join(":")}`,p=n.filter(l),b=p.length>1?`${p.join(" and ")} are pseudo-elements, and a selector can hold only one`:`${i.join(", ")} cannot follow the pseudo-element ${o}; only hover, focus, focus-visible, focus-within, active, in-* and media, container or supports variants can`;return{className:t,pseudoElement:o,chained:i,suggestion:$,reason:b}}function R(t){return d(t)===null}h.exports={isCompilableClass:R,uncompilableClass:d}});var{isCompilableClass:_,uncompilableClass:w}=m(),I={$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(t){return typeof t=="string"&&t.trim().length>0}module.exports={componentsConfigSchema:I,isCSSClassString:O,isCompilableClass:_,uncompilableClass:w};
@@ -1,5 +1,5 @@
1
- var C=(l,e)=>()=>(e||l((e={exports:{}}).exports,e),e.exports);var _=C((Ce,R)=>{var m=require("fs");function Z(l){try{let e=m.readFileSync(l,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}function Q(l){try{return m.readFileSync(l,"utf8").replace(/^\uFEFF/,"")}catch(e){if(e.code==="ENOENT")return null;throw e}}function Y(l,e,t=2){let o=JSON.stringify(e,null,t);m.writeFileSync(l,o,"utf8")}function D(l,e){m.writeFileSync(l,e,"utf8")}function ee(l,e){if(e==null||typeof e=="object"&&Object.keys(e).length===0||Array.isArray(e)&&e.length===0){let o=`module.exports = ${Array.isArray(e)?"[]":"{}"};`;m.writeFileSync(l,o,"utf8")}else{let t=`module.exports = ${JSON.stringify(e,null,2)};`;m.writeFileSync(l,t,"utf8")}}function te(l){return m.existsSync(l)}function re(l){m.mkdirSync(l,{recursive:!0})}function oe(l){m.rmSync(l,{recursive:!0,force:!0})}function se(l){m.rmSync(l,{force:!0})}function ne(l,e){m.mkdirSync(require("path").dirname(l),{recursive:!0,mode:448});let t=`${l}.${process.pid}.${Date.now()}.tmp`;try{m.writeFileSync(t,`${JSON.stringify(e,null,2)}
2
- `,{mode:384}),m.renameSync(t,l);try{m.chmodSync(l,384)}catch{}}finally{m.rmSync(t,{force:!0})}}async function ie(l,e,t){m.mkdirSync(require("path").dirname(l),{recursive:!0,mode:448});let o=`${l}.lock`,n=Date.now()+2e4,c;for(;c===void 0;)try{c=m.openSync(o,"wx",384),m.writeFileSync(c,String(process.pid))}catch(f){if(f.code!=="EEXIST")throw f;try{let r=Number(m.readFileSync(o,"utf8"));if(Number.isInteger(r)&&r>0)try{process.kill(r,0)}catch(s){if(s.code==="ESRCH"){m.unlinkSync(o);continue}}}catch(r){if(r.code==="ENOENT")continue}if(Date.now()>=n)throw t();await new Promise(r=>setTimeout(r,50))}try{return await e()}finally{m.closeSync(c),m.unlinkSync(o)}}R.exports={writePrivateJsonFileAtomic:ne,withPrivateFileLock:ie,readJsonFileSafe:Z,readFileSafe:Q,writeJsonFile:Y,writeTextFile:D,writeModuleExportsFile:ee,fileExists:te,ensureDirectoryExists:re,removeDirectory:oe,removeFile:se}});var I=C((Se,L)=>{var x=class extends Error{constructor(e,t,o){super(e),this.name="APIError",this.statusCode=t,this.url=o,this.code=`API_${t}`}},w=class extends Error{constructor(e,t){super(e),this.name="CacheError",this.operation=t,this.code=`CACHE_${t.toUpperCase()}`}},F=class extends Error{constructor(e,t){super(e),this.name="ConfigError",this.field=t,this.code=t?`CONFIG_${String(t).toUpperCase()}`:"CONFIG_ERROR"}},O=class extends Error{constructor(e,t){super(e),this.name="ProcessingError",this.token=t,this.code="PROCESSING_ERROR"}};L.exports={APIError:x,CacheError:w,ConfigError:F,ProcessingError:O}});var U=C((xe,K)=>{var M=["open","closed","checked","unchecked","indeterminate","active"],W={open:['[data-expanded]:not([data-expanded="false"])','[data-popup-open]:not([data-popup-open="false"])','[data-panel-open]:not([data-panel-open="false"])']},P="on",q=["/* Dark mode follows the root class the theme picker toggles. */","@custom-variant dark {"," &:is(.dark, .dark *) {"," @slot;"," }","}",""],E=[...q,"/* Cross-primitive state variants (Radix `data-state=x`, Base UI `data-x`). */",...M.flatMap(l=>{let e=[`[data-state="${l}"]`,`[data-${l}]:not([data-${l}="false"])`,...W[l]||[]];return[`@custom-variant data-${l} {`,...e.map((t,o)=>` &:where(${t})${o===e.length-1?" {":","}`)," @slot;"," }","}",""]}),`@custom-variant data-${P} {`,' &: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(l=>[`@custom-variant data-${l} {`,` &:where([data-orientation="${l}"]) {`," @slot;"," }","}",""])],ae=E.filter(l=>l.startsWith("@custom-variant ")).map(l=>l.slice(16).replace(" {",""));function ce(){return E.join(`
3
- `)}K.exports={CROSS_PRIMITIVE_STATES:M,DARK_VARIANT_CSS:q,EXTRA_STATE_MATCHERS:W,PRESSED_STATE:P,STATE_VARIANT_CSS:E,STATE_VARIANT_NAMES:ae,stateVariantCss:ce}});var J=C((we,H)=>{var le="classes.txt",fe="classes.css",ue=new Set(["after","backdrop","before","file","first-letter","first-line","marker","placeholder","selection"]);function de(l){if(typeof l!="string")return!0;let e=l.split(":").slice(0,-1);return e.every((t,o)=>!ue.has(t)||o===e.length-1)}H.exports={CLASSES_SOURCE_FILE:le,CSS_CLASSES_SOURCE_FILE:fe,isCompilableClass:de}});var{fileExists:Fe,readJsonFileSafe:Oe}=_(),me=require("color"),he=require("https"),Ee=require("fs"),je=require("path"),{ProcessingError:be}=I(),{STATE_VARIANT_CSS:pe}=U(),{CLASSES_SOURCE_FILE:ye,isCompilableClass:G}=J(),ge={"--background":"oklch(1 0 0)","--foreground":"oklch(0.145 0 0)","--card":"oklch(1 0 0)","--card-foreground":"oklch(0.145 0 0)","--popover":"oklch(1 0 0)","--popover-foreground":"oklch(0.145 0 0)","--primary":"oklch(0.205 0 0)","--primary-foreground":"oklch(0.985 0 0)","--secondary":"oklch(0.97 0 0)","--secondary-foreground":"oklch(0.205 0 0)","--muted":"oklch(0.97 0 0)","--muted-foreground":"oklch(0.556 0 0)","--accent":"oklch(0.97 0 0)","--accent-foreground":"oklch(0.205 0 0)","--destructive":"oklch(0.577 0.245 27.325)","--destructive-foreground":"oklch(0.985 0 0)","--border":"oklch(0.922 0 0)","--input":"oklch(0.922 0 0)","--ring":"oklch(0.708 0 0)","--sidebar":"oklch(0.985 0 0)","--sidebar-foreground":"oklch(0.145 0 0)","--sidebar-primary":"oklch(0.205 0 0)","--sidebar-primary-foreground":"oklch(0.985 0 0)","--sidebar-accent":"oklch(0.97 0 0)","--sidebar-accent-foreground":"oklch(0.205 0 0)","--sidebar-border":"oklch(0.922 0 0)","--sidebar-ring":"oklch(0.708 0 0)","--chart-1":"oklch(0.646 0.222 41.116)","--chart-2":"oklch(0.6 0.118 184.704)","--chart-3":"oklch(0.398 0.07 227.392)","--chart-4":"oklch(0.828 0.189 84.429)","--chart-5":"oklch(0.769 0.188 70.08)"},ve={"--background":["--bg-default","--bg-neutral-low","--layer-base"],"--foreground":["--text-neutral-strong","--text-default"],"--card":["--layer-1","--bg-neutral-low","--bg-default"],"--card-foreground":["--text-neutral-strong","--text-default"],"--popover":["--layer-1","--bg-neutral-low","--bg-default"],"--popover-foreground":["--text-neutral-strong","--text-default"],"--primary":["--bg-brand-mid","--bg-brand-strong"],"--primary-foreground":["--text-onbrand-strong","--text-inverse-low"],"--secondary":["--bg-interactive-subtle","--bg-neutral-low"],"--secondary-foreground":["--text-oninteractive-subtle","--text-neutral-strong"],"--muted":["--bg-neutral-low","--bg-disabled"],"--muted-foreground":["--text-neutral-subtle","--text-disabled"],"--accent":["--bg-interactive-low","--bg-brand-low","--bg-neutral-low"],"--accent-foreground":["--text-oninteractive-low","--text-brand-strong","--text-neutral-strong"],"--destructive":["--bg-negative-mid","--bg-negative-subtle"],"--destructive-foreground":["--text-onnegative-subtle","--text-inverse-low"],"--border":["--border-neutral-subtle","--border-default"],"--input":["--border-neutral-subtle","--border-default"],"--ring":["--border-brand-mid","--bg-brand-mid"],"--sidebar":["--layer-1","--bg-neutral-low","--bg-default"],"--sidebar-foreground":["--text-neutral-strong","--text-default"],"--sidebar-primary":["--bg-brand-mid","--bg-brand-strong"],"--sidebar-primary-foreground":["--text-onbrand-strong","--text-inverse-low"],"--sidebar-accent":["--bg-interactive-low","--bg-neutral-low"],"--sidebar-accent-foreground":["--text-oninteractive-low","--text-neutral-strong"],"--sidebar-border":["--border-neutral-subtle","--border-default"],"--sidebar-ring":["--border-brand-mid","--bg-brand-mid"],"--chart-1":["--bg-brand-mid","--bg-brand-strong"],"--chart-2":["--bg-interactive-mid","--bg-interactive-low"],"--chart-3":["--bg-positive-mid","--bg-positive-subtle"],"--chart-4":["--bg-warning-mid","--bg-warning-subtle"],"--chart-5":["--bg-negative-mid","--bg-negative-subtle"]};function $e(l,e,t){for(let o of e||[])if(l[o])return l[o];return t}function z(l={}){return Object.fromEntries(Object.entries(l?.radius||{}).filter(([,e])=>typeof e?.$value=="string").map(([e,t])=>[e.toLowerCase(),t.$value.replace(/\{([^}]+)\}/g,(o,n)=>`var(--${n.replace(/\./g,"-").toLowerCase()})`)]))}function B(l={},e={}){let t={};for(let[n,c]of Object.entries(ve))t[n]=$e(l,c,ge[n]);let o=e.borderRadius||{};return t["--radius"]=o.default||o.md||o.lg||"0.625rem",t["--radius-sm"]=o.sm||"calc(var(--radius) - 4px)",t["--radius-md"]=o.md||"calc(var(--radius) - 2px)",t["--radius-lg"]=o.lg||"var(--radius)",t["--radius-xl"]=o.xl||"calc(var(--radius) + 4px)",t}var j=class{constructor(e={}){this.config=e}hexToOklch(e){if(typeof e=="string"&&/^oklch\(.*\)$/i.test(e.trim()))return e.trim();try{let t=me(e),o=t.rgb(),n=o.red()/255,c=o.green()/255,f=o.blue()/255,r=k=>k<=.04045?k/12.92:Math.pow((k+.055)/1.055,2.4),s=r(n),i=r(c),a=r(f),d=s*.4124564+i*.3575761+a*.1804375,u=s*.2126729+i*.7151522+a*.072175,h=s*.0193339+i*.119192+a*.9503041,b=Math.cbrt(.8189330101*d+.3618667424*u-.1288597137*h),y=Math.cbrt(.0329845436*d+.9293118715*u+.0361456387*h),p=Math.cbrt(.0482003018*d+.2643662691*u+.633851707*h),g=.2104542553*b+.793617785*y-.0040720468*p,$=1.9779984951*b-2.428592205*y+.4505937099*p,v=.0259040371*b+.7827717662*y-.808675766*p,X=Math.sqrt($*$+v*v),S=Math.atan2(v,$)*180/Math.PI;S<0&&(S+=360);let V=Math.round(g*1e3)/1e3,A=Math.round(X*1e3)/1e3,N=Math.round(S*100)/100,T=t.alpha();if(T<1){let k=Math.round(T*100)/100;return`oklch(${V} ${A} ${N} / ${k})`}return`oklch(${V} ${A} ${N})`}catch(t){throw new be(`Failed to convert color ${e}: ${t.message}`,e)}}processColors(e){let t={},o={},n={backgroundColor:{},textColor:{},borderColor:{}};if(!e||typeof e!="object")return console.log(" \u26A0\uFE0F No valid color data to process"),{variables:t,colorMap:o,utilities:n};let c=(f,r="")=>{for(let[s,i]of Object.entries(f))if(i&&typeof i=="object")if(i.$value){let a=r?`${r}-${s}`:s,d=`--color-${a}`,u=this.hexToOklch(i.$value);t[d]=u,o[a]=d;let h=`var(${d})`;n.backgroundColor[a]=h,n.textColor[a]=h,n.borderColor[a]=h}else{let a=r?`${r}-${s}`:s;c(i,a)}};return e&&(e.colors?c(e.colors):c(e)),{variables:t,colorMap:o,utilities:n}}processSemanticTokens(e,t){let o={},n={backgroundColor:{},textColor:{},borderColor:{}},c=s=>s.replace(/ /g,"").replace(/\./g,"-").toLowerCase(),f=s=>{if(typeof s!="string")return null;let i=s.match(/^\{(.+)\}$/);if(!i)return null;let a=i[1].split(".");return a[0]==="colors"&&a.length>1?a[1]==="colors"&&a.length>2?a.slice(2).join("-"):a.slice(1).join("-"):a.join("-")},r=(s,i)=>{if(e[s])for(let[a,d]of Object.entries(e[s])){if(a==="disabled"){let u=f(d.$value);if(u){let h=t[u];if(h){let b=`--${s}-disabled`;o[b]=`var(${h})`,n[i].disabled=`var(${b})`}}continue}for(let[u,h]of Object.entries(d))for(let[b,y]of Object.entries(h)){let p=c(`${a}-${u}-${b}`);p.endsWith("-default")&&(p=p.slice(0,-8));let g=`--${s}-${p}`,$=f(y.$value);if($){let v=t[$];v&&(o[g]=`var(${v})`,n[i][p]=`var(${g})`)}else if(y.$value){let v=this.hexToOklch(y.$value);o[g]=v,n[i][p]=`var(${g})`}}}};if(r("bg","backgroundColor"),r("text","textColor"),r("border","borderColor"),e.layer)for(let[s,i]of Object.entries(e.layer)){let a=`--layer-${s}`,d=f(i.$value);if(d){let u=d.replace(/\./g,"-").toLowerCase();if(u.endsWith("-default")&&(u=u.slice(0,-8)),u.startsWith("bg-")||u.startsWith("text-")||u.startsWith("border-")){let h=`--${u}`;o[a]=`var(${h})`,n.backgroundColor[`layer-${s}`]=`var(${a})`}else{let h=t[u];h&&(o[a]=`var(${h})`,n.backgroundColor[`layer-${s}`]=`var(${a})`)}}else if(i.$value){let u=this.hexToOklch(i.$value);o[a]=u,n.backgroundColor[`layer-${s}`]=`var(${a})`}}if(e.overlay)for(let[s,i]of Object.entries(e.overlay)){let a=`--overlay-${s}`;i.$value&&(o[a]=i.$value,n.backgroundColor[`overlay-${s}`]=`var(${a})`)}if(e.icon){n.fill||(n.fill={});for(let[s,i]of Object.entries(e.icon)){if(s==="disabled"){let a=f(i.$value);if(a){let d=t[a];if(d){let u="--icon-disabled";o[u]=`var(${d})`,n.textColor["icon-disabled"]=`var(${u})`,n.fill["icon-disabled"]=`var(${u})`}}continue}for(let[a,d]of Object.entries(i))for(let[u,h]of Object.entries(d)){let b=c(`icon-${s}-${a}-${u}`);b.endsWith("-default")&&(b=b.slice(0,-8));let y=`--${b}`,p=f(h.$value);if(p){let g=t[p];g&&(o[y]=`var(${g})`,n.textColor[b]=`var(${y})`,n.fill[b]=`var(${y})`)}}}}return{semanticVariables:o,tokens:n}}async fetchFontCss(e,{timeoutMs:t=1e4}={}){if(!Number.isFinite(t)||t<=0)throw new Error("Font CSS timeout must be positive");return new Promise((o,n)=>{let c,f=setTimeout(()=>{let s=new Error("Font CSS request timed out");n(s),c?.destroy(s)},t);f.unref?.();let r=s=>{clearTimeout(f),n(s)};try{c=he.get(e,s=>{let i="";if(s.on("error",r),s.on("aborted",()=>r(new Error("Font CSS response was interrupted"))),s.statusCode!==200){r(new Error(`Failed to fetch font CSS: ${s.statusCode}`)),s.destroy?.();return}s.on("data",a=>{i+=a}),s.on("end",()=>{clearTimeout(f),o(i)})}),c.on("error",r)}catch(s){r(s)}})}parseFontFaces(e){let t=/@font-face\s*{([^}]+)}/g,o=[],n;for(;(n=t.exec(e))!==null;){let c=n[1].trim().split(";").filter(Boolean),f={};c.forEach(r=>{let s=r.indexOf(":");if(s!==-1){let i=r.slice(0,s).trim(),a=r.slice(s+1).trim();i==="font-family"?f[i]=a.replace(/["']/g,""):f[i]=a}}),f.src&&(f.src=f.src.replace(/url\(["']?/,"url('").replace(/["']?\)/,"')")),o.push(f)}return o}async processFonts(e){let t=[];if(!e||typeof e!="object")return t;let o=Object.keys(e).filter(n=>n.startsWith("font"));for(let n of o){let c=e[n];if(typeof c=="string"&&c.startsWith("http"))try{let f=await this.fetchFontCss(c),r=this.parseFontFaces(f);r.length>0&&t.push(...r)}catch(f){console.warn(`Failed to process font ${n}:`,f.message)}}return t}processFontFamilies(e){let t={};if(!e||!e.font||!e.font.family)return t;let o=e.font.family;for(let[n,c]of Object.entries(o))if(c&&c.$value){let f=n.toLowerCase(),r=c.$value;typeof r=="string"&&r.startsWith("{")&&r.endsWith("}")&&(r=r.slice(1,-1));let s=i=>i.split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1).toLowerCase()).join(" ");if(r.includes(","))t[f]=r;else{let i=s(r);i.includes(" ")&&!i.startsWith('"')&&!i.startsWith("'")?t[f]=`"${i}", sans-serif`:t[f]=`${i}, sans-serif`}}return t}processAnimations(e){let t={},o={};if(!e||typeof e!="object")return{keyframes:t,animations:o};for(let[n,c]of Object.entries(e))if(c&&typeof c=="object"){let f=`${n}`;if(c.keyframes){let s={};for(let[i,a]of Object.entries(c.keyframes))a&&typeof a=="object"&&(s[i]=a);t[f]=s}let r=[f,c.duration||"1s",c.easing||"ease",c.delay||"0s",c.iterations||"1",c.direction||"normal",c.fillMode||"none"].join(" ");o[n]=r}return{keyframes:t,animations:o}}generateSafelistClasses(e){let t=[];if(e.backgroundColor)for(let o of Object.keys(e.backgroundColor))t.push(`bg-${o}`);if(e.textColor)for(let o of Object.keys(e.textColor))t.push(`text-${o}`);if(e.borderColor)for(let o of Object.keys(e.borderColor))t.push(`border-${o}`);if(e.fill)for(let o of Object.keys(e.fill))t.push(`fill-${o}`),o.startsWith("icon-")&&t.push(`text-${o}`);if(e.fontFamily)for(let o of Object.keys(e.fontFamily))t.push(`font-${o}`);if(e.animations)for(let o of Object.keys(e.animations))t.push(`animate-${o}`);return t}extractClassesFromComponentsConfig(e){let t=new Set,o=c=>{typeof c=="string"&&c.split(/\s+/).filter(r=>r.length>0).forEach(r=>{t.add(r)})},n=c=>{if(!(!c||typeof c!="object"))for(let f in c){if(f==="icons")continue;let r=c[f];typeof r=="string"?o(r):typeof r=="object"&&n(r)}};return e&&n(e),Array.from(t).filter(G).sort()}generateClassesContent(e=[]){e=e.filter(G);let t=["/*"," * Frontfriend Component Classes"," *"," * This file contains all classes used in Frontfriend component configs."," * Tailwind v4 scans this file via @source to generate utilities."," * DO NOT EDIT - Auto-generated by frontfriend CLI"," */","","/*"," * Classes:"],o=" * ";for(let n of[...new Set(e)].sort())o.length+n.length+1>100?(t.push(o),o=` * ${n}`):o+=(o===" * "?"":" ")+n;return o!==" * "&&t.push(o),t.push(" */"),t.join(`
4
- `)}processCustomCss(e){return!e||typeof e!="string"?{}:{raw:e}}async process(e){try{let t={variables:{},semanticVariables:{},semanticDarkVariables:{},utilities:{},fontFaces:[],keyframes:{},animations:{},safelist:[],metadata:{},custom:e.customCss?this.processCustomCss(e.customCss):{}},o=e.colors;if(o){let n=this.processColors(o);t.variables={...t.variables,...n.variables},t.utilities={...t.utilities,...n.utilities},t.colorMap=n.colorMap||{}}else t.colorMap={};if(e.semantic&&t.colorMap){let n=this.processSemanticTokens(e.semantic,t.colorMap);t.semanticVariables=n.semanticVariables,n.tokens&&(t.tokens=n.tokens,t.utilities=n.tokens)}if(e.semanticDark&&t.colorMap){let n=this.processSemanticTokens(e.semanticDark,t.colorMap);t.semanticDarkVariables=n.semanticVariables}if(e.fonts&&(t.fontFaces=await this.processFonts(e.fonts)),e.globalTokens){t.fontFamilies=this.processFontFamilies(e.globalTokens);let n=z(e.globalTokens);Object.keys(n).length&&(t.utilities.borderRadius=n),t.fontFamilies&&(t.utilities.fontFamily||(t.utilities.fontFamily={}),Object.assign(t.utilities.fontFamily,t.fontFamilies))}if(e.animations){let n=this.processAnimations(e.animations);t.keyframes=n.keyframes,t.animations=n.animations}return t.safelist=this.generateSafelistClasses(t.tokens||t.utilities),t.metadata={timestamp:new Date().toISOString(),version:e.version||"2.0.0",ffId:e.ffId},t}catch(t){throw console.error("Error processing tokens:",t),t}}buildSemanticColorNamespaces(e){let t=[["","border","--border-"],["layer-","layer","--layer-"],["overlay-","overlay","--overlay-"],["icon-","icon","--icon-"]],o=[["","bg","--bg-"],["layer-","layer","--layer-"],["overlay-","overlay","--overlay-"],["icon-","icon","--icon-"]],c=[{namespace:"--background-color",roles:o},{namespace:"--text-color",roles:[["","text","--text-"],["layer-","layer","--layer-"],["overlay-","overlay","--overlay-"],["icon-","icon","--icon-"]]},{namespace:"--border-color",roles:t},{namespace:"--ring-color",roles:t},{namespace:"--outline-color",roles:t},{namespace:"--stroke",roles:t},{namespace:"--ring-offset-color",roles:o},{namespace:"--fill",roles:o}],f=[];for(let{namespace:r,roles:s}of c)for(let[i,a,d]of s)for(let u of e[a]||[])f.push(` ${r}-${i}${u}: var(${d}${u});`);return f.length===0?[]:["","@theme {",...f,"}"]}generateThemeCSSFromProcessedTokens(e){return this.generateThemeCSS({variables:e.variables||{},semanticVariables:e.semanticVariables||{},semanticDarkVariables:e.semanticDarkVariables||{},fontFamilies:e.tokens?.fontFamily||{},utilities:{borderRadius:z(e.globalTokens)},fontFaces:e.fonts||[],keyframes:e.keyframes||{},animations:e.animations||{},custom:e.custom||{}})}generateThemeCSS(e){let t=['@import "tw-animate-css";',"",...pe,"@theme {"];for(let[r,s]of Object.entries(e.variables||{}))t.push(` ${r}: ${s};`);for(let[r,s]of Object.entries(e.fontFamilies||{})){let i=r.startsWith("--")?r:`--font-${r}`,a=Array.isArray(s)?s.join(", "):s;t.push(` ${i}: ${a};`)}e.fontFamilies?.primary&&!e.fontFamilies.sans&&t.push(" --font-sans: var(--font-primary);");for(let[r,s]of Object.entries(e.utilities?.spacing||{})){let i=r.startsWith("--")?r:`--spacing-${r}`;t.push(` ${i}: ${s};`)}for(let[r,s]of Object.entries(e.utilities?.borderRadius||{})){let i=r.startsWith("--")?r:`--radius-${r}`;t.push(` ${i}: ${s};`)}t.push("}","");let o=e.semanticVariables||{},n=B(o,e.utilities||{});t.push(":root:not(.dark) {");for(let[r,s]of Object.entries(n))t.push(` ${r}: ${s};`);for(let[r,s]of Object.entries(o))t.push(` ${r}: ${s};`);if(t.push("}"),e.semanticDarkVariables&&Object.keys(e.semanticDarkVariables).length>0){let r={...o,...e.semanticDarkVariables},s=B(r,e.utilities||{});t.push("",":root.dark {");for(let[i,a]of Object.entries(s))t.push(` ${i}: ${a};`);for(let[i,a]of Object.entries(e.semanticDarkVariables))t.push(` ${i}: ${a};`);t.push("}")}let c={bg:[],text:[],border:[],icon:[],layer:[],overlay:[]};for(let r of Object.keys(e.semanticVariables||{}))r.startsWith("--bg-")&&c.bg.push(r.slice(5)),r.startsWith("--text-")&&c.text.push(r.slice(7)),r.startsWith("--border-")&&c.border.push(r.slice(9)),r.startsWith("--icon-")&&c.icon.push(r.slice(7)),r.startsWith("--layer-")&&c.layer.push(r.slice(8)),r.startsWith("--overlay-")&&c.overlay.push(r.slice(10));let f=(r,s)=>{t.push("",`@utility ${r} {`);for(let i of s)t.push(` ${i}`);t.push("}")};for(let r of c.icon)f(`icon-${r}`,[`color: var(--icon-${r});`]);t.push(...this.buildSemanticColorNamespaces(c));for(let r of e.fontFaces||[]){t.push("","@font-face {");for(let[s,i]of Object.entries(r)){let a=s.replace(/([A-Z])/g,"-$1").toLowerCase(),d=Array.isArray(i)?i.join(", "):i;t.push(` ${a}: ${d};`)}t.push("}")}for(let[r,s]of Object.entries(e.keyframes||{})){t.push("",`@keyframes ${r} {`);for(let[i,a]of Object.entries(s)){t.push(` ${i} {`);for(let[d,u]of Object.entries(a)){let h=d.replace(/([A-Z])/g,"-$1").toLowerCase();t.push(` ${h}: ${u};`)}t.push(" }")}t.push("}")}for(let[r,s]of Object.entries(e.animations||{}))f(`animate-${r}`,[`animation: ${s};`]);return e.custom?.raw&&t.push("","/* Custom CSS */",e.custom.raw),t.push("","/* Component classes for Tailwind scanning */",`@source './${ye}';`),t.join(`
5
- `)}};module.exports=j;
1
+ var S=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var L=S((Re,I)=>{var m=require("fs");function re(i){try{let e=m.readFileSync(i,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}function oe(i){try{return m.readFileSync(i,"utf8").replace(/^\uFEFF/,"")}catch(e){if(e.code==="ENOENT")return null;throw e}}function ne(i,e,t=2){let o=JSON.stringify(e,null,t);m.writeFileSync(i,o,"utf8")}function se(i,e){m.writeFileSync(i,e,"utf8")}function ie(i,e){if(e==null||typeof e=="object"&&Object.keys(e).length===0||Array.isArray(e)&&e.length===0){let o=`module.exports = ${Array.isArray(e)?"[]":"{}"};`;m.writeFileSync(i,o,"utf8")}else{let t=`module.exports = ${JSON.stringify(e,null,2)};`;m.writeFileSync(i,t,"utf8")}}function ae(i){return m.existsSync(i)}function ce(i){m.mkdirSync(i,{recursive:!0})}function le(i){m.rmSync(i,{recursive:!0,force:!0})}function ue(i){m.rmSync(i,{force:!0})}function fe(i,e){m.mkdirSync(require("path").dirname(i),{recursive:!0,mode:448});let t=`${i}.${process.pid}.${Date.now()}.tmp`;try{m.writeFileSync(t,`${JSON.stringify(e,null,2)}
2
+ `,{mode:384}),m.renameSync(t,i);try{m.chmodSync(i,384)}catch{}}finally{m.rmSync(t,{force:!0})}}async function de(i,e,t){m.mkdirSync(require("path").dirname(i),{recursive:!0,mode:448});let o=`${i}.lock`,n=Date.now()+2e4,a;for(;a===void 0;)try{a=m.openSync(o,"wx",384),m.writeFileSync(a,String(process.pid))}catch(u){if(u.code!=="EEXIST")throw u;try{let r=Number(m.readFileSync(o,"utf8"));if(Number.isInteger(r)&&r>0)try{process.kill(r,0)}catch(s){if(s.code==="ESRCH"){m.unlinkSync(o);continue}}}catch(r){if(r.code==="ENOENT")continue}if(Date.now()>=n)throw t();await new Promise(r=>setTimeout(r,50))}try{return await e()}finally{m.closeSync(a),m.unlinkSync(o)}}I.exports={writePrivateJsonFileAtomic:fe,withPrivateFileLock:de,readJsonFileSafe:re,readFileSafe:oe,writeJsonFile:ne,writeTextFile:se,writeModuleExportsFile:ie,fileExists:ae,ensureDirectoryExists:ce,removeDirectory:le,removeFile:ue}});var M=S((Ne,W)=>{var F=class extends Error{constructor(e,t,o){super(e),this.name="APIError",this.statusCode=t,this.url=o,this.code=`API_${t}`}},O=class extends Error{constructor(e,t){super(e),this.name="CacheError",this.operation=t,this.code=`CACHE_${t.toUpperCase()}`}},E=class extends Error{constructor(e,t){super(e),this.name="ConfigError",this.field=t,this.code=t?`CONFIG_${String(t).toUpperCase()}`:"CONFIG_ERROR"}},j=class extends Error{constructor(e,t){super(e),this.name="ProcessingError",this.token=t,this.code="PROCESSING_ERROR"}};W.exports={APIError:F,CacheError:O,ConfigError:E,ProcessingError:j}});var J=S((_e,H)=>{var P=["open","closed","checked","unchecked","indeterminate","active"],q={open:['[data-expanded]:not([data-expanded="false"])','[data-popup-open]:not([data-popup-open="false"])','[data-panel-open]:not([data-panel-open="false"])']},U="on",K=["/* Dark mode follows the root class the theme picker toggles. */","@custom-variant dark {"," &:is(.dark, .dark *) {"," @slot;"," }","}",""],A=[...K,"/* Cross-primitive state variants (Radix `data-state=x`, Base UI `data-x`). */",...P.flatMap(i=>{let e=[`[data-state="${i}"]`,`[data-${i}]:not([data-${i}="false"])`,...q[i]||[]];return[`@custom-variant data-${i} {`,...e.map((t,o)=>` &:where(${t})${o===e.length-1?" {":","}`)," @slot;"," }","}",""]}),`@custom-variant data-${U} {`,' &: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(i=>[`@custom-variant data-${i} {`,` &:where([data-orientation="${i}"]) {`," @slot;"," }","}",""])],he=A.filter(i=>i.startsWith("@custom-variant ")).map(i=>i.slice(16).replace(" {",""));function me(){return A.join(`
3
+ `)}H.exports={CROSS_PRIMITIVE_STATES:P,DARK_VARIANT_CSS:K,EXTRA_STATE_MATCHERS:q,PRESSED_STATE:U,STATE_VARIANT_CSS:A,STATE_VARIANT_NAMES:he,stateVariantCss:me}});var z=S((Ie,G)=>{var be="classes.txt",pe="classes.css";G.exports={CLASSES_SOURCE_FILE:be,CSS_CLASSES_SOURCE_FILE:pe}});var Z=S((Le,Y)=>{var ye=new Set(["after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]),ge=new Set(["active","focus","focus-visible","focus-within","hover"]),ve=new Set(["sm","md","lg","xl","2xl","any-pointer-coarse","any-pointer-fine","any-pointer-none","contrast-less","contrast-more","forced-colors","inverted-colors","landscape","motion-reduce","motion-safe","noscript","pointer-coarse","pointer-fine","pointer-none","portrait","print","starting"]),$e=/^(?:min-|max-|@|supports-|in-(?!range$))/,ke=/^\[&(?::(?:active|focus|focus-visible|focus-within|hover))+\]$/;function Se(i){let e=[],t=0,o=0;for(let n=0;n<i.length;n+=1){let a=i[n];a==="["||a==="("?t+=1:(a==="]"||a===")")&&t>0?t-=1:a===":"&&t===0&&(e.push(i.slice(o,n)),o=n+1)}return e.push(i.slice(o)),{variants:e.slice(0,-1),utility:e[e.length-1]}}function B(i){return i.replace(/\/[\w-]+$/,"")}function C(i){let e=B(i);return ye.has(e)||e.startsWith("[")&&e.includes("::")}function w(i){let e=B(i);return ge.has(e)||ve.has(e)?!0:e.startsWith("[")?e.startsWith("[@")||ke.test(e):e.startsWith("not-")?w(e.slice(4)):$e.test(e)}function X(i){if(typeof i!="string"||!i.includes(":"))return null;let e=i.startsWith("!")?"!":"",{variants:t,utility:o}=Se(i.slice(e.length)),n=null,a=[];for(let f of t)n!==null&&!w(f)&&a.push(f),n===null&&C(f)&&(n=f);if(a.length===0)return null;let u=t.reduce((f,h,b)=>C(h)?b:f,-1),r=t.slice(0,u).filter(f=>!C(f)),s=t.slice(u+1),c=`${e}${[...r,...s.filter(f=>!w(f)),t[u],...s.filter(w),o].join(":")}`,l=t.filter(C),d=l.length>1?`${l.join(" and ")} are pseudo-elements, and a selector can hold only one`:`${a.join(", ")} cannot follow the pseudo-element ${n}; only hover, focus, focus-visible, focus-within, active, in-* and media, container or supports variants can`;return{className:i,pseudoElement:n,chained:a,suggestion:c,reason:d}}function Ce(i){return X(i)===null}Y.exports={isCompilableClass:Ce,uncompilableClass:X}});var{fileExists:We,readJsonFileSafe:Me}=L(),we=require("color"),xe=require("https"),Pe=require("fs"),qe=require("path"),{ProcessingError:Fe}=M(),{STATE_VARIANT_CSS:Oe}=J(),{CLASSES_SOURCE_FILE:Ee}=z(),{isCompilableClass:Q}=Z(),je={"--background":"oklch(1 0 0)","--foreground":"oklch(0.145 0 0)","--card":"oklch(1 0 0)","--card-foreground":"oklch(0.145 0 0)","--popover":"oklch(1 0 0)","--popover-foreground":"oklch(0.145 0 0)","--primary":"oklch(0.205 0 0)","--primary-foreground":"oklch(0.985 0 0)","--secondary":"oklch(0.97 0 0)","--secondary-foreground":"oklch(0.205 0 0)","--muted":"oklch(0.97 0 0)","--muted-foreground":"oklch(0.556 0 0)","--accent":"oklch(0.97 0 0)","--accent-foreground":"oklch(0.205 0 0)","--destructive":"oklch(0.577 0.245 27.325)","--destructive-foreground":"oklch(0.985 0 0)","--border":"oklch(0.922 0 0)","--input":"oklch(0.922 0 0)","--ring":"oklch(0.708 0 0)","--sidebar":"oklch(0.985 0 0)","--sidebar-foreground":"oklch(0.145 0 0)","--sidebar-primary":"oklch(0.205 0 0)","--sidebar-primary-foreground":"oklch(0.985 0 0)","--sidebar-accent":"oklch(0.97 0 0)","--sidebar-accent-foreground":"oklch(0.205 0 0)","--sidebar-border":"oklch(0.922 0 0)","--sidebar-ring":"oklch(0.708 0 0)","--chart-1":"oklch(0.646 0.222 41.116)","--chart-2":"oklch(0.6 0.118 184.704)","--chart-3":"oklch(0.398 0.07 227.392)","--chart-4":"oklch(0.828 0.189 84.429)","--chart-5":"oklch(0.769 0.188 70.08)"},Ae={"--background":["--bg-default","--bg-neutral-low","--layer-base"],"--foreground":["--text-neutral-strong","--text-default"],"--card":["--layer-1","--bg-neutral-low","--bg-default"],"--card-foreground":["--text-neutral-strong","--text-default"],"--popover":["--layer-1","--bg-neutral-low","--bg-default"],"--popover-foreground":["--text-neutral-strong","--text-default"],"--primary":["--bg-brand-mid","--bg-brand-strong"],"--primary-foreground":["--text-onbrand-strong","--text-inverse-low"],"--secondary":["--bg-interactive-subtle","--bg-neutral-low"],"--secondary-foreground":["--text-oninteractive-subtle","--text-neutral-strong"],"--muted":["--bg-neutral-low","--bg-disabled"],"--muted-foreground":["--text-neutral-subtle","--text-disabled"],"--accent":["--bg-interactive-low","--bg-brand-low","--bg-neutral-low"],"--accent-foreground":["--text-oninteractive-low","--text-brand-strong","--text-neutral-strong"],"--destructive":["--bg-negative-mid","--bg-negative-subtle"],"--destructive-foreground":["--text-onnegative-subtle","--text-inverse-low"],"--border":["--border-neutral-subtle","--border-default"],"--input":["--border-neutral-subtle","--border-default"],"--ring":["--border-brand-mid","--bg-brand-mid"],"--sidebar":["--layer-1","--bg-neutral-low","--bg-default"],"--sidebar-foreground":["--text-neutral-strong","--text-default"],"--sidebar-primary":["--bg-brand-mid","--bg-brand-strong"],"--sidebar-primary-foreground":["--text-onbrand-strong","--text-inverse-low"],"--sidebar-accent":["--bg-interactive-low","--bg-neutral-low"],"--sidebar-accent-foreground":["--text-oninteractive-low","--text-neutral-strong"],"--sidebar-border":["--border-neutral-subtle","--border-default"],"--sidebar-ring":["--border-brand-mid","--bg-brand-mid"],"--chart-1":["--bg-brand-mid","--bg-brand-strong"],"--chart-2":["--bg-interactive-mid","--bg-interactive-low"],"--chart-3":["--bg-positive-mid","--bg-positive-subtle"],"--chart-4":["--bg-warning-mid","--bg-warning-subtle"],"--chart-5":["--bg-negative-mid","--bg-negative-subtle"]};function Ve(i,e,t){for(let o of e||[])if(i[o])return i[o];return t}function D(i={}){return Object.fromEntries(Object.entries(i?.radius||{}).filter(([,e])=>typeof e?.$value=="string").map(([e,t])=>[e.toLowerCase(),t.$value.replace(/\{([^}]+)\}/g,(o,n)=>`var(--${n.replace(/\./g,"-").toLowerCase()})`)]))}function ee(i={},e={}){let t={};for(let[n,a]of Object.entries(Ae))t[n]=Ve(i,a,je[n]);let o=e.borderRadius||{};return t["--radius"]=o.default||o.md||o.lg||"0.625rem",t["--radius-sm"]=o.sm||"calc(var(--radius) - 4px)",t["--radius-md"]=o.md||"calc(var(--radius) - 2px)",t["--radius-lg"]=o.lg||"var(--radius)",t["--radius-xl"]=o.xl||"calc(var(--radius) + 4px)",t}var V=class{constructor(e={}){this.config=e}hexToOklch(e){if(typeof e=="string"&&/^oklch\(.*\)$/i.test(e.trim()))return e.trim();try{let t=we(e),o=t.rgb(),n=o.red()/255,a=o.green()/255,u=o.blue()/255,r=k=>k<=.04045?k/12.92:Math.pow((k+.055)/1.055,2.4),s=r(n),c=r(a),l=r(u),d=s*.4124564+c*.3575761+l*.1804375,f=s*.2126729+c*.7151522+l*.072175,h=s*.0193339+c*.119192+l*.9503041,b=Math.cbrt(.8189330101*d+.3618667424*f-.1288597137*h),y=Math.cbrt(.0329845436*d+.9293118715*f+.0361456387*h),p=Math.cbrt(.0482003018*d+.2643662691*f+.633851707*h),g=.2104542553*b+.793617785*y-.0040720468*p,$=1.9779984951*b-2.428592205*y+.4505937099*p,v=.0259040371*b+.7827717662*y-.808675766*p,te=Math.sqrt($*$+v*v),x=Math.atan2(v,$)*180/Math.PI;x<0&&(x+=360);let T=Math.round(g*1e3)/1e3,R=Math.round(te*1e3)/1e3,N=Math.round(x*100)/100,_=t.alpha();if(_<1){let k=Math.round(_*100)/100;return`oklch(${T} ${R} ${N} / ${k})`}return`oklch(${T} ${R} ${N})`}catch(t){throw new Fe(`Failed to convert color ${e}: ${t.message}`,e)}}processColors(e){let t={},o={},n={backgroundColor:{},textColor:{},borderColor:{}};if(!e||typeof e!="object")return console.log(" \u26A0\uFE0F No valid color data to process"),{variables:t,colorMap:o,utilities:n};let a=(u,r="")=>{for(let[s,c]of Object.entries(u))if(c&&typeof c=="object")if(c.$value){let l=r?`${r}-${s}`:s,d=`--color-${l}`,f=this.hexToOklch(c.$value);t[d]=f,o[l]=d;let h=`var(${d})`;n.backgroundColor[l]=h,n.textColor[l]=h,n.borderColor[l]=h}else{let l=r?`${r}-${s}`:s;a(c,l)}};return e&&(e.colors?a(e.colors):a(e)),{variables:t,colorMap:o,utilities:n}}processSemanticTokens(e,t){let o={},n={backgroundColor:{},textColor:{},borderColor:{}},a=s=>s.replace(/ /g,"").replace(/\./g,"-").toLowerCase(),u=s=>{if(typeof s!="string")return null;let c=s.match(/^\{(.+)\}$/);if(!c)return null;let l=c[1].split(".");return l[0]==="colors"&&l.length>1?l[1]==="colors"&&l.length>2?l.slice(2).join("-"):l.slice(1).join("-"):l.join("-")},r=(s,c)=>{if(e[s])for(let[l,d]of Object.entries(e[s])){if(l==="disabled"){let f=u(d.$value);if(f){let h=t[f];if(h){let b=`--${s}-disabled`;o[b]=`var(${h})`,n[c].disabled=`var(${b})`}}continue}for(let[f,h]of Object.entries(d))for(let[b,y]of Object.entries(h)){let p=a(`${l}-${f}-${b}`);p.endsWith("-default")&&(p=p.slice(0,-8));let g=`--${s}-${p}`,$=u(y.$value);if($){let v=t[$];v&&(o[g]=`var(${v})`,n[c][p]=`var(${g})`)}else if(y.$value){let v=this.hexToOklch(y.$value);o[g]=v,n[c][p]=`var(${g})`}}}};if(r("bg","backgroundColor"),r("text","textColor"),r("border","borderColor"),e.layer)for(let[s,c]of Object.entries(e.layer)){let l=`--layer-${s}`,d=u(c.$value);if(d){let f=d.replace(/\./g,"-").toLowerCase();if(f.endsWith("-default")&&(f=f.slice(0,-8)),f.startsWith("bg-")||f.startsWith("text-")||f.startsWith("border-")){let h=`--${f}`;o[l]=`var(${h})`,n.backgroundColor[`layer-${s}`]=`var(${l})`}else{let h=t[f];h&&(o[l]=`var(${h})`,n.backgroundColor[`layer-${s}`]=`var(${l})`)}}else if(c.$value){let f=this.hexToOklch(c.$value);o[l]=f,n.backgroundColor[`layer-${s}`]=`var(${l})`}}if(e.overlay)for(let[s,c]of Object.entries(e.overlay)){let l=`--overlay-${s}`;c.$value&&(o[l]=c.$value,n.backgroundColor[`overlay-${s}`]=`var(${l})`)}if(e.icon){n.fill||(n.fill={});for(let[s,c]of Object.entries(e.icon)){if(s==="disabled"){let l=u(c.$value);if(l){let d=t[l];if(d){let f="--icon-disabled";o[f]=`var(${d})`,n.textColor["icon-disabled"]=`var(${f})`,n.fill["icon-disabled"]=`var(${f})`}}continue}for(let[l,d]of Object.entries(c))for(let[f,h]of Object.entries(d)){let b=a(`icon-${s}-${l}-${f}`);b.endsWith("-default")&&(b=b.slice(0,-8));let y=`--${b}`,p=u(h.$value);if(p){let g=t[p];g&&(o[y]=`var(${g})`,n.textColor[b]=`var(${y})`,n.fill[b]=`var(${y})`)}}}}return{semanticVariables:o,tokens:n}}async fetchFontCss(e,{timeoutMs:t=1e4}={}){if(!Number.isFinite(t)||t<=0)throw new Error("Font CSS timeout must be positive");return new Promise((o,n)=>{let a,u=setTimeout(()=>{let s=new Error("Font CSS request timed out");n(s),a?.destroy(s)},t);u.unref?.();let r=s=>{clearTimeout(u),n(s)};try{a=xe.get(e,s=>{let c="";if(s.on("error",r),s.on("aborted",()=>r(new Error("Font CSS response was interrupted"))),s.statusCode!==200){r(new Error(`Failed to fetch font CSS: ${s.statusCode}`)),s.destroy?.();return}s.on("data",l=>{c+=l}),s.on("end",()=>{clearTimeout(u),o(c)})}),a.on("error",r)}catch(s){r(s)}})}parseFontFaces(e){let t=/@font-face\s*{([^}]+)}/g,o=[],n;for(;(n=t.exec(e))!==null;){let a=n[1].trim().split(";").filter(Boolean),u={};a.forEach(r=>{let s=r.indexOf(":");if(s!==-1){let c=r.slice(0,s).trim(),l=r.slice(s+1).trim();c==="font-family"?u[c]=l.replace(/["']/g,""):u[c]=l}}),u.src&&(u.src=u.src.replace(/url\(["']?/,"url('").replace(/["']?\)/,"')")),o.push(u)}return o}async processFonts(e){let t=[];if(!e||typeof e!="object")return t;let o=Object.keys(e).filter(n=>n.startsWith("font"));for(let n of o){let a=e[n];if(typeof a=="string"&&a.startsWith("http"))try{let u=await this.fetchFontCss(a),r=this.parseFontFaces(u);r.length>0&&t.push(...r)}catch(u){console.warn(`Failed to process font ${n}:`,u.message)}}return t}processFontFamilies(e){let t={};if(!e||!e.font||!e.font.family)return t;let o=e.font.family;for(let[n,a]of Object.entries(o))if(a&&a.$value){let u=n.toLowerCase(),r=a.$value;typeof r=="string"&&r.startsWith("{")&&r.endsWith("}")&&(r=r.slice(1,-1));let s=c=>c.split(" ").map(l=>l.charAt(0).toUpperCase()+l.slice(1).toLowerCase()).join(" ");if(r.includes(","))t[u]=r;else{let c=s(r);c.includes(" ")&&!c.startsWith('"')&&!c.startsWith("'")?t[u]=`"${c}", sans-serif`:t[u]=`${c}, sans-serif`}}return t}processAnimations(e){let t={},o={};if(!e||typeof e!="object")return{keyframes:t,animations:o};for(let[n,a]of Object.entries(e))if(a&&typeof a=="object"){let u=`${n}`;if(a.keyframes){let s={};for(let[c,l]of Object.entries(a.keyframes))l&&typeof l=="object"&&(s[c]=l);t[u]=s}let r=[u,a.duration||"1s",a.easing||"ease",a.delay||"0s",a.iterations||"1",a.direction||"normal",a.fillMode||"none"].join(" ");o[n]=r}return{keyframes:t,animations:o}}generateSafelistClasses(e){let t=[];if(e.backgroundColor)for(let o of Object.keys(e.backgroundColor))t.push(`bg-${o}`);if(e.textColor)for(let o of Object.keys(e.textColor))t.push(`text-${o}`);if(e.borderColor)for(let o of Object.keys(e.borderColor))t.push(`border-${o}`);if(e.fill)for(let o of Object.keys(e.fill))t.push(`fill-${o}`),o.startsWith("icon-")&&t.push(`text-${o}`);if(e.fontFamily)for(let o of Object.keys(e.fontFamily))t.push(`font-${o}`);if(e.animations)for(let o of Object.keys(e.animations))t.push(`animate-${o}`);return t}extractClassesFromComponentsConfig(e){let t=new Set,o=a=>{typeof a=="string"&&a.split(/\s+/).filter(r=>r.length>0).forEach(r=>{t.add(r)})},n=a=>{if(!(!a||typeof a!="object"))for(let u in a){if(u==="icons")continue;let r=a[u];typeof r=="string"?o(r):typeof r=="object"&&n(r)}};return e&&n(e),Array.from(t).filter(Q).sort()}generateClassesContent(e=[]){e=e.filter(Q);let t=["/*"," * Frontfriend Component Classes"," *"," * This file contains all classes used in Frontfriend component configs."," * Tailwind v4 scans this file via @source to generate utilities."," * DO NOT EDIT - Auto-generated by frontfriend CLI"," */","","/*"," * Classes:"],o=" * ";for(let n of[...new Set(e)].sort())o.length+n.length+1>100?(t.push(o),o=` * ${n}`):o+=(o===" * "?"":" ")+n;return o!==" * "&&t.push(o),t.push(" */"),t.join(`
4
+ `)}processCustomCss(e){return!e||typeof e!="string"?{}:{raw:e}}async process(e){try{let t={variables:{},semanticVariables:{},semanticDarkVariables:{},utilities:{},fontFaces:[],keyframes:{},animations:{},safelist:[],metadata:{},custom:e.customCss?this.processCustomCss(e.customCss):{}},o=e.colors;if(o){let n=this.processColors(o);t.variables={...t.variables,...n.variables},t.utilities={...t.utilities,...n.utilities},t.colorMap=n.colorMap||{}}else t.colorMap={};if(e.semantic&&t.colorMap){let n=this.processSemanticTokens(e.semantic,t.colorMap);t.semanticVariables=n.semanticVariables,n.tokens&&(t.tokens=n.tokens,t.utilities=n.tokens)}if(e.semanticDark&&t.colorMap){let n=this.processSemanticTokens(e.semanticDark,t.colorMap);t.semanticDarkVariables=n.semanticVariables}if(e.fonts&&(t.fontFaces=await this.processFonts(e.fonts)),e.globalTokens){t.fontFamilies=this.processFontFamilies(e.globalTokens);let n=D(e.globalTokens);Object.keys(n).length&&(t.utilities.borderRadius=n),t.fontFamilies&&(t.utilities.fontFamily||(t.utilities.fontFamily={}),Object.assign(t.utilities.fontFamily,t.fontFamilies))}if(e.animations){let n=this.processAnimations(e.animations);t.keyframes=n.keyframes,t.animations=n.animations}return t.safelist=this.generateSafelistClasses(t.tokens||t.utilities),t.metadata={timestamp:new Date().toISOString(),version:e.version||"2.0.0",ffId:e.ffId},t}catch(t){throw console.error("Error processing tokens:",t),t}}buildSemanticColorNamespaces(e){let t=[["","border","--border-"],["layer-","layer","--layer-"],["overlay-","overlay","--overlay-"],["icon-","icon","--icon-"]],o=[["","bg","--bg-"],["layer-","layer","--layer-"],["overlay-","overlay","--overlay-"],["icon-","icon","--icon-"]],a=[{namespace:"--background-color",roles:o},{namespace:"--text-color",roles:[["","text","--text-"],["layer-","layer","--layer-"],["overlay-","overlay","--overlay-"],["icon-","icon","--icon-"]]},{namespace:"--border-color",roles:t},{namespace:"--ring-color",roles:t},{namespace:"--outline-color",roles:t},{namespace:"--stroke",roles:t},{namespace:"--ring-offset-color",roles:o},{namespace:"--fill",roles:o}],u=[];for(let{namespace:r,roles:s}of a)for(let[c,l,d]of s)for(let f of e[l]||[])u.push(` ${r}-${c}${f}: var(${d}${f});`);return u.length===0?[]:["","@theme {",...u,"}"]}generateThemeCSSFromProcessedTokens(e){return this.generateThemeCSS({variables:e.variables||{},semanticVariables:e.semanticVariables||{},semanticDarkVariables:e.semanticDarkVariables||{},fontFamilies:e.tokens?.fontFamily||{},utilities:{borderRadius:D(e.globalTokens)},fontFaces:e.fonts||[],keyframes:e.keyframes||{},animations:e.animations||{},custom:e.custom||{}})}generateThemeCSS(e){let t=['@import "tw-animate-css";',"",...Oe,"@theme {"];for(let[r,s]of Object.entries(e.variables||{}))t.push(` ${r}: ${s};`);for(let[r,s]of Object.entries(e.fontFamilies||{})){let c=r.startsWith("--")?r:`--font-${r}`,l=Array.isArray(s)?s.join(", "):s;t.push(` ${c}: ${l};`)}e.fontFamilies?.primary&&!e.fontFamilies.sans&&t.push(" --font-sans: var(--font-primary);");for(let[r,s]of Object.entries(e.utilities?.spacing||{})){let c=r.startsWith("--")?r:`--spacing-${r}`;t.push(` ${c}: ${s};`)}for(let[r,s]of Object.entries(e.utilities?.borderRadius||{})){let c=r.startsWith("--")?r:`--radius-${r}`;t.push(` ${c}: ${s};`)}t.push("}","");let o=e.semanticVariables||{},n=ee(o,e.utilities||{});t.push(":root:not(.dark) {");for(let[r,s]of Object.entries(n))t.push(` ${r}: ${s};`);for(let[r,s]of Object.entries(o))t.push(` ${r}: ${s};`);if(t.push("}"),e.semanticDarkVariables&&Object.keys(e.semanticDarkVariables).length>0){let r={...o,...e.semanticDarkVariables},s=ee(r,e.utilities||{});t.push("",":root.dark {");for(let[c,l]of Object.entries(s))t.push(` ${c}: ${l};`);for(let[c,l]of Object.entries(e.semanticDarkVariables))t.push(` ${c}: ${l};`);t.push("}")}let a={bg:[],text:[],border:[],icon:[],layer:[],overlay:[]};for(let r of Object.keys(e.semanticVariables||{}))r.startsWith("--bg-")&&a.bg.push(r.slice(5)),r.startsWith("--text-")&&a.text.push(r.slice(7)),r.startsWith("--border-")&&a.border.push(r.slice(9)),r.startsWith("--icon-")&&a.icon.push(r.slice(7)),r.startsWith("--layer-")&&a.layer.push(r.slice(8)),r.startsWith("--overlay-")&&a.overlay.push(r.slice(10));let u=(r,s)=>{t.push("",`@utility ${r} {`);for(let c of s)t.push(` ${c}`);t.push("}")};for(let r of a.icon)u(`icon-${r}`,[`color: var(--icon-${r});`]);t.push(...this.buildSemanticColorNamespaces(a));for(let r of e.fontFaces||[]){t.push("","@font-face {");for(let[s,c]of Object.entries(r)){let l=s.replace(/([A-Z])/g,"-$1").toLowerCase(),d=Array.isArray(c)?c.join(", "):c;t.push(` ${l}: ${d};`)}t.push("}")}for(let[r,s]of Object.entries(e.keyframes||{})){t.push("",`@keyframes ${r} {`);for(let[c,l]of Object.entries(s)){t.push(` ${c} {`);for(let[d,f]of Object.entries(l)){let h=d.replace(/([A-Z])/g,"-$1").toLowerCase();t.push(` ${h}: ${f};`)}t.push(" }")}t.push("}")}for(let[r,s]of Object.entries(e.animations||{}))u(`animate-${r}`,[`animation: ${s};`]);return e.custom?.raw&&t.push("","/* Custom CSS */",e.custom.raw),t.push("","/* Component classes for Tailwind scanning */",`@source './${Ee}';`),t.join(`
5
+ `)}};module.exports=V;