@frontfriend/sdk 1.2.7 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -355
- package/dist/THIRD_PARTY_NOTICES +22 -0
- package/dist/cli.js +2 -2
- package/dist/component-recipes.d.ts +3 -1
- package/dist/lib/core/adoption.js +1 -1
- package/dist/lib/core/application-adoption.js +1 -1
- package/dist/lib/core/component-recipes.js +554 -5
- package/dist/lib/core/token-processor.js +553 -4
- package/dist/mcp.cjs +2 -2
- package/dist/next.js +1 -1
- package/dist/package.json +1 -1
- package/dist/vite.js +1 -1
- package/package.json +1 -1
package/dist/mcp.cjs
CHANGED
|
@@ -15,7 +15,7 @@ Defaulting to 2020, but this will stop working in the future.`)),R.ecmaVersion=1
|
|
|
15
15
|
`;break;default:l+=String.fromCharCode(k);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),R=this.pos}else++this.pos}},tt.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(m.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
|
|
16
16
|
`&&++this.pos;case`
|
|
17
17
|
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},tt.readEscapedChar=function(l){var R=this.input.charCodeAt(++this.pos);switch(++this.pos,R){case 110:return`
|
|
18
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return we(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),l){var k=this.pos-1;this.invalidStringToken(k,"Invalid escape sequence in template string")}default:if(R>=48&&R<=55){var q=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],J=parseInt(q,8);return J>255&&(q=q.slice(0,-1),J=parseInt(q,8)),this.pos+=q.length-1,R=this.input.charCodeAt(this.pos),(q!=="0"||R===56||R===57)&&(this.strict||l)&&this.invalidStringToken(this.pos-1-q.length,l?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(J)}return E(R)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(R)}},tt.readHexChar=function(l){var R=this.pos,k=this.readInt(16,l);return k===null&&this.invalidStringToken(R,"Bad character escape sequence"),k},tt.readWord1=function(){this.containsEsc=!1;for(var l="",R=!0,k=this.pos,q=this.options.ecmaVersion>=6;this.pos<this.input.length;){var J=this.fullCharCodeAtPos();if(_(J,q))this.pos+=J<=65535?1:2;else if(J===92){this.containsEsc=!0,l+=this.input.slice(k,this.pos);var ae=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var le=this.readCodePoint();(R?p:_)(le,q)||this.invalidStringToken(ae,"Invalid Unicode escape"),l+=we(le),k=this.pos}else break;R=!1}return l+this.input.slice(k,this.pos)},tt.readWord=function(){var l=this.readWord1(),R=m.name;return this.keywords.test(l)&&(R=w[l]),this.finishToken(R,l)};var dt="8.17.0";lt.acorn={Parser:lt,version:dt,defaultOptions:C,Position:j,SourceLocation:U,getLineInfo:B,Node:sn,TokenType:h,tokTypes:m,keywordTypes:w,TokContext:cr,tokContexts:Rt,isIdentifierChar:_,isIdentifierStart:p,Token:Gr,isNewLine:E,lineBreak:O,lineBreakG:P,nonASCIIwhitespace:D};function ln(l,R){return lt.parse(l,R)}function Nt(l,R,k){return lt.parseExpressionAt(l,R,k)}function Cu(l,R){return lt.tokenizer(l,R)}e.Node=sn,e.Parser=lt,e.Position=j,e.SourceLocation=U,e.TokContext=cr,e.Token=Gr,e.TokenType=h,e.defaultOptions=C,e.getLineInfo=B,e.isIdentifierChar=_,e.isIdentifierStart=p,e.isNewLine=E,e.keywordTypes=w,e.lineBreak=O,e.lineBreakG=P,e.nonASCIIwhitespace=D,e.parse=ln,e.parseExpressionAt=Nt,e.tokContexts=Rt,e.tokTypes=m,e.tokenizer=Cu,e.version=dt})});var ey=ee((m_e,oE)=>{var{parse:z6}=rE();function _c(){let e=new Error("Configuration reads require a data-only object export. Remove executable statements from frontfriend.config.js.");return e.code="FRONTFRIEND_CONFIG_VALIDATION",e}function iE(e){if(e.type!=="Property"||e.computed||e.method||e.kind!=="init")throw _c();let t=e.key.type==="Identifier"?e.key.name:e.key.value;if(typeof t!="string"||["__proto__","constructor","prototype"].includes(t))throw _c();return t}function nE(e){if(e.type==="ExportDefaultDeclaration")return e.declaration;let t=e.type==="ExpressionStatement"?e.expression:null;return t?.type==="AssignmentExpression"&&t.operator==="="&&t.left.type==="MemberExpression"&&!t.left.computed&&t.left.object.name==="module"&&t.left.property.name==="exports"?t.right:null}function V6(e,t){if(e.type!=="VariableDeclaration"||e.declarations.length!==1)return null;let[r]=e.declarations;return r.id.type!=="Identifier"||t?.type!=="Identifier"||t.name!==r.id.name?null:r.init}function F6(e){let r=z6(e,{ecmaVersion:"latest",sourceType:"module"}).body.filter(o=>o.type!=="EmptyStatement"&&!o.directive),i=r.length===1?nE(r[0]):r.length===2?V6(r[0],nE(r[1])):null;if(i?.type!=="ObjectExpression")throw _c();function n(o,a=0){if(a>64)throw _c();if(o.type==="Literal"&&(o.value===null||["string","number","boolean"].includes(typeof o.value)))return o.value;if(o.type==="ArrayExpression")return o.elements.map(s=>{if(!s)throw _c();return n(s,a+1)});if(o.type==="ObjectExpression")return Object.fromEntries(o.properties.map(s=>[iE(s),n(s.value,a+1)]));if(o.type==="UnaryExpression"&&["-","+"].includes(o.operator)&&o.argument.type==="Literal"&&typeof o.argument.value=="number")return o.operator==="-"?-o.argument.value:o.argument.value;if(o.type==="TemplateLiteral"&&o.expressions.length===0)return o.quasis[0].value.cooked;if(o.type==="MemberExpression"&&!o.computed&&o.object.type==="MemberExpression"&&!o.object.computed&&o.object.object.name==="process"&&o.object.property.name==="env")return process.env[o.property.name];if(o.type==="LogicalExpression"&&["||","??"].includes(o.operator)){let s=n(o.left,a+1);return o.operator==="||"?s||n(o.right,a+1):s??n(o.right,a+1)}throw _c()}return{config:n(i),expression:i}}oE.exports={parseStaticConfig:F6,propertyName:iE}});var cE=ee((h_e,sE)=>{var bo=require("path"),{fileExists:ty}=rs();function aE(e,t=process.cwd()){let r=t;for(;r!==bo.parse(r).root;){let i=bo.join(r,e);if(ty(i))return i;r=bo.dirname(r)}return null}function J6(e,t=process.cwd(),r=null){let i=[],n=t,o=10;for(let a=0;a<o;a++){i.push(bo.join(n,e)),a<3&&i.push(bo.join(n,"../".repeat(a+1)+e));let s=bo.dirname(n);if(s===n)break;n=s}i.push(bo.join(__dirname,"../../../",e));for(let a of i)if(ty(a)&&(!r||r(a)))return a;return null}function Z6(e,t=process.cwd()){let r=e.map(i=>bo.isAbsolute(i)?i:bo.join(t,i));for(let i of r)if(ty(i))return i;return null}function H6(e=process.cwd()){let t=aE("frontfriend.config.js",e);return t?bo.dirname(t):e}sE.exports={findFileUpward:aE,findDirectoryUpward:J6,findDirectoryWithPaths:Z6,resolveProjectRoot:H6}});var Os=ee((g_e,B6)=>{B6.exports={name:"@frontfriend/sdk",version:"1.2.7"}});var xu=ee((y_e,uE)=>{var{name:K6}=Os();uE.exports={PACKAGE_NAME:K6}});var Is=ee((v_e,dE)=>{var{PACKAGE_NAME:Nd}=xu(),Ua=require("fs"),W6=require("http"),G6=require("https"),ti=require("path"),Md=["contracts","tokens","components"],Y6=["app/globals.css","src/app/globals.css","styles/globals.css","src/styles/globals.css","src/styles.css","src/index.css","src/style.css"],X6={next:["next.config.js","next.config.mjs","next.config.ts"],vite:["vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"]},Q6=["primereact","@mui/material","antd","@chakra-ui/react","@mantine/core","@fluentui/react"],eF=["style-dictionary","@tokens-studio/sd-transforms","@vanilla-extract/css","styled-components","@emotion/react"];function lE(e){try{return JSON.parse(Ua.readFileSync(e,"utf8"))}catch{return{}}}function ry(e){if(e===void 0)return null;if(!Array.isArray(e)){let i=new Error("`adopt` in frontfriend.config.js must be an array.");throw i.code="FRONTFRIEND_CONFIG_VALIDATION",i}let t=e.filter(i=>!Md.includes(i));if(t.length>0){let i=new Error(`Unknown Frontfriend adoption level: ${t.join(", ")}.`);throw i.code="FRONTFRIEND_CONFIG_VALIDATION",i}let r=e.includes("components")?2:e.includes("tokens")?1:0;return Md.slice(0,r+1)}function tF(e){for(let[t,r]of Object.entries(X6)){let i=r.find(o=>Ua.existsSync(ti.join(e,o)));if(!i)continue;let n=Ua.readFileSync(ti.join(e,i),"utf8");return{buildTool:t,present:n.includes(`${Nd}/${t}`)}}return{buildTool:null,present:!1}}function rF(e){let t=[ti.join(e,"components","ui"),ti.join(e,"src","components","ui"),ti.join(e,"app","components","ui")].filter(n=>Ua.existsSync(n)),r=new Set;function i(n){for(let o of Ua.readdirSync(n,{withFileTypes:!0})){let a=ti.join(n,o.name);if(o.isDirectory())i(a);else if(/\.(js|jsx|ts|tsx|vue)$/.test(o.name)){if(!Ua.readFileSync(a,"utf8").includes(Nd))continue;let c=ti.basename(o.name,ti.extname(o.name));r.add(c.toLowerCase()==="index"?ti.basename(n):c.toLowerCase())}}}return t.forEach(i),[...r].sort()}function nF(e){let t=lE(ti.join(e,"package.json")),r={...t.dependencies||{},...t.devDependencies||{}},i=r.tailwindcss||null,o=[lE(ti.join(e,"components.json"))?.tailwind?.css,...Y6].filter(Boolean).find(c=>Ua.existsSync(ti.join(e,c))),a=o?Ua.readFileSync(ti.join(e,o),"utf8"):"",s=eF.filter(c=>r[c]);return!s.length&&/:root[\s\S]*--(?:color|spacing|font|radius)-[\w-]+\s*:/.test(a)&&!a.includes(`${Nd}/theme.css`)&&s.push("css-custom-properties"),{nativeTokens:{present:a.includes("/* Frontfriend managed native tokens: start */"),file:o||null},tailwind:{present:!!i,version:i,major:i&&Number((String(i).match(/\d+/)||[])[0])||null},componentsJson:Ua.existsSync(ti.join(e,"components.json")),themeImport:{present:a.includes(`${Nd}/theme.css`)||/@import\s+["'][^"']*node_modules\/\.cache\/frontfriend\/theme\.css["']/.test(a),file:o||null},plugin:tF(e),frontfriendComponents:rF(e),foreignComponentLibraries:Q6.filter(c=>r[c]),foreignTokenSystems:s}}function iF(e,t,{baseLibrary:r}={}){let i=ry(e)||Md,n=i.includes("tokens"),o=i.includes("components"),a=[];return n&&!t.themeImport.present&&!t.nativeTokens?.present&&a.push("Config adopts tokens, but the Frontfriend theme import was not observed."),!n&&t.themeImport.present&&a.push("Frontfriend tokens are present in CSS but are not adopted in config."),o&&r==="shadcn"&&!t.componentsJson&&a.push("Config adopts components, but components.json was not observed."),!o&&t.frontfriendComponents.length>0&&a.push("Frontfriend components are installed but are not adopted in config."),a}function oF({apiUrl:e,token:t,ffId:r,name:i,adopt:n,observed:o,framework:a,primitive:s}){if(!e||!t||!r||!i||!a||s===void 0)return Promise.resolve({reported:!1,unavailable:!0});let c=new URL("/api/apps/sync",e),u=JSON.stringify({ffId:r,name:i,adopt:ry(n),observed:o,runtime:"sdk",framework:a,primitive:s}),d=c.protocol==="https:"?G6:W6;return new Promise(f=>{let p=d.request(c,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json","content-length":Buffer.byteLength(u)}},_=>{_.resume(),_.on("end",()=>{_.statusCode>=200&&_.statusCode<300?f({reported:!0,unavailable:!1}):f({reported:!1,unavailable:!0})})});p.on("error",()=>f({reported:!1,unavailable:!0})),p.setTimeout(1500,()=>{p.destroy(),f({reported:!1,unavailable:!0})}),p.end(u)})}dE.exports={ADOPTION_LEVELS:Md,normalizeAdopt:ry,probeAdoption:nF,adoptionWarnings:iF,reportAdoption:oF}});var xd=ee((b_e,pE)=>{var qu=require("path"),{parseStaticConfig:aF}=ey(),{findFileUpward:sF}=cE(),{fileExists:__e,readJsonFileSafe:fE,readFileSafe:cF}=rs(),{normalizeAdopt:uF}=Is();function ny(e,t){let r=qu.dirname(t),i={...e,ffId:e["ff-id"]||null,appRoot:r};if(!i.name){let n=fE(qu.join(r,"package.json"))?.name;n&&(i.name=n)}return e.adopt!==void 0&&(i.adopt=uF(e.adopt),i.adoptExplicit=!0),i}async function lF(e){return aF(cF(e)).config}var iy=class{findConfigFile(t=process.cwd()){return sF("frontfriend.config.js",t)}isESModule(t){try{let r=qu.join(t,"package.json"),i=fE(r);if(i)return i.type==="module"}catch{}return!1}async load({startDir:t=process.cwd(),strict:r=!1,fresh:i=!1}={}){let n=this.findConfigFile(t);if(n)try{if(i)return ny(await lF(n),n);let o,a=qu.dirname(n);if(n.endsWith(".js")&&this.isESModule(a)){let u=await import(`file://${n}`);o=u.default||u}else o=require(n);return ny(o,n)}catch(o){if(r||o.code==="FRONTFRIEND_CONFIG_VALIDATION")throw o;console.error("Error loading frontfriend.config.js:",o.message)}return{ffId:null,appRoot:t}}loadSync(){let t=this.findConfigFile();if(t)try{let r=qu.dirname(t);if(t.endsWith(".js")&&this.isESModule(r))console.error("Error: frontfriend.config.js is an ES module. Please use the async load() method");else{let n=require(t);return ny(n,t)}}catch(r){if(r.code==="FRONTFRIEND_CONFIG_VALIDATION")throw r;console.error("Error loading frontfriend.config.js:",r.message)}return{ffId:null,appRoot:process.cwd()}}};pE.exports=iy});var qd={};go(qd,{ProjectTargetError:()=>os,SUPPORTED_PROJECT_TARGETS:()=>mE,assertMatchingProjectTargets:()=>hE,defaultV4ProjectTarget:()=>fF,parseProjectTarget:()=>jn,projectTargetKey:()=>za,registryRoute:()=>mF,resolveProjectTarget:()=>pF});function za(e){return`${e.framework}/${e.primitive}`}function jn(e,t="Project target"){let r=e,i=typeof r?.framework=="string"?r.framework.trim().toLowerCase():"",n=typeof r?.primitive=="string"?r.primitive.trim().toLowerCase():"",o=`${i}/${n}`;if(!i||!n||!dF.has(o))throw new os("INVALID_PROJECT_TARGET",`${t} must be exactly one of react/radix, react/base, react/aria, or vue/reka; received ${o}.`,{framework:i||null,primitive:n||null});return{framework:i,primitive:n}}function fF(e="react"){return jn({framework:e,primitive:e==="vue"?"reka":"base"})}function hE(e){let t=Object.entries(e).filter(([,n])=>n!=null).map(([n,o])=>[n,jn(o,n)]);if(t.length===0)throw new os("PROJECT_TARGET_REQUIRED","A persisted or configured Project target is required.");let r=za(t[0][1]);if(t.find(([,n])=>za(n)!==r))throw new os("PROJECT_TARGET_MISMATCH",`Project target mismatch: ${t.map(([n,o])=>`${n}=${za(o)}`).join(", ")}.`,{targets:Object.fromEntries(t)});return t[0][1]}function pF({persisted:e,configured:t,app:r,release:i,lock:n,proposed:o}={}){let a={persisted:e,configured:t,app:r,release:i,lock:n};if(Object.values(a).some(s=>s!=null))return hE(a);if(o)return jn(o,"migration proposal");throw new os("PROJECT_TARGET_REQUIRED","A Project target is required; package detection may only propose one during migration.")}function mF(e,t){throw jn(e),String(t||"").trim(),new os("CURRENT_ROUTE_RETIRED","Components resolve only from an authenticated immutable Design System Release.")}var mE,dF,os,Cs=Ve(()=>{mE=Object.freeze([Object.freeze({framework:"react",primitive:"radix"}),Object.freeze({framework:"react",primitive:"base"}),Object.freeze({framework:"react",primitive:"aria"}),Object.freeze({framework:"vue",primitive:"reka"})]),dF=new Set(mE.map(e=>`${e.framework}/${e.primitive}`)),os=class extends Error{constructor(t,r,i={}){super(r),this.name="ProjectTargetError",this.code=t,Object.assign(this,i)}}});var wE=ee((S_e,SE)=>{var gE=require("fs"),yE=require("path"),{parseProjectTarget:hF,ProjectTargetError:gF}=(Cs(),ei(qd)),yF=[["radix",e=>e==="radix-ui"||e.startsWith("@radix-ui/")&&e!=="@radix-ui/react-slot"],["base",e=>e==="@base-ui-components/react"||e==="@base-ui/react"],["aria",e=>e==="react-aria-components"||e==="react-aria"],["reka",e=>e==="reka-ui"||e==="radix-vue"]];function vE(e){return JSON.parse(gE.readFileSync(e,"utf8"))}function _E(e){try{let t=vE(yE.join(e,"package.json"));return{...t.dependencies||{},...t.devDependencies||{}}}catch{return{}}}function bE(e){let t=_E(e);return t.vue||t["@vitejs/plugin-vue"]||t.nuxt?"vue":"react"}var Dd=e=>`${e.framework}/${e.primitive}`;function oy(e,t){try{return{status:"supported",target:hF(e),...t}}catch(r){if(!(r instanceof gF))throw r;return{status:"unsupported",detected:e,reason:r.message,...t}}}function vF(e,{persisted:t,declared:r,allowMissingComponents:i=!1}={}){let n=yE.join(e,"components.json"),o=gE.existsSync(n),a=_E(e),s=bE(e),c=t?.framework&&t?.primitive?t:r,u=c?.framework===s&&c?.primitive&&(s==="react"?a.react:a.vue||a.nuxt);if(!o&&!u&&!i)return{status:"not_shadcn",reason:"components.json was not found: this is not a shadcn application. Run `npx shadcn@latest init` (`npx shadcn-vue@latest init` for Vue) first, or run connect in the application directory."};let d;try{d=o?vE(n):{}}catch(w){return{status:i?"unsupported":"not_shadcn",reason:`components.json is not valid JSON (${w.message}).`}}let f=typeof d?.style=="string"?d.style:null,p=o?[`components.json${f?` (style ${f})`:""}`]:["Explicit Project target for a new application"],_=s==="vue"?["vue","@vitejs/plugin-vue","nuxt"].find(w=>a[w]):a.react?"react":null;_&&p.push(`package.json: ${_}`);let h=new Map;for(let[w,$]of yF){let m=Object.keys(a).sort().find($);m&&h.set(w,`package.json: ${m}`)}let y=f&&/^(radix|base|aria|reka)-/.exec(f)?.[1];y&&!h.has(y)&&h.set(y,`components.json: style ${f}`),p.push(...h.values());let v={components_json:o?"components.json":null,evidence:p};if(t?.framework&&t?.primitive)return oy({framework:t.framework,primitive:t.primitive},v);if(h.size>1)return{status:"conflict",reason:`Evidence for several primitives (${[...h.keys()].join(", ")}): a project uses one Project target. Remove the unused primitive, then run connect again.`,...v};let g=h.size===1?{framework:[...h.keys()][0]==="reka"?"vue":s,primitive:[...h.keys()][0]}:null;if(r?.framework||r?.primitive){let w={framework:r.framework||s,primitive:r.primitive||g?.primitive};return w.primitive?g&&Dd(g)!==Dd(w)?{status:"conflict",reason:`The declared target ${Dd(w)} conflicts with the project, which shows ${Dd(g)}.`,...v}:oy(w,v):{status:"undetermined",reason:"The primitive cannot be determined. Pass --primitive with --framework.",...v}}return g?oy(g,v):{status:"undetermined",reason:"components.json exists, but no primitive package is installed yet, so the primitive cannot be determined. Pass --primitive: radix, base or aria for React, reka for Vue.",...v}}SE.exports={detectShadcnProject:vF,detectProjectFramework:bE}});var Ud=ee((w_e,PE)=>{var{parseStaticConfig:ay,propertyName:Ld}=ey(),{fileExists:$E,readFileSafe:sy,writeTextFile:cy,readJsonFileSafe:_F}=rs(),bc=require("path"),{normalizeAdopt:RE}=Is(),{parseProjectTarget:bF}=(Cs(),ei(qd));function EE(e){try{return _F(e)??{}}catch{return{}}}function SF(e){return EE(bc.join(e,"package.json")).name||bc.basename(e)}function wF(e={}){let t={...e};return delete t.ffId,delete t.appRoot,delete t.adoptExplicit,delete t["auth-token"],delete t.authToken,t}function $F(e,t,{ffId:r,name:i,adopt:n,framework:o,primitive:a,apiUrl:s,baseLibrary:c,tag:u}){let d=bF({framework:o,primitive:a},"Setup Project target"),f=wF(t),p={name:i.trim(),"ff-id":r.trim(),adopt:RE(n),framework:d.framework,primitive:d.primitive};if(u!==void 0){if(typeof u!="string"||!u.trim())throw new Error("Release tag must not be empty.");p.tag=u.trim()}if(c!==void 0){if(!["frontfriend","shadcn"].includes(c))throw new Error("Base library must be frontfriend or shadcn.");p.baseLibrary=c}s&&(p["api-url"]=String(s).replace(/\/+$/,""),delete f.apiUrl);for(let[y,v]of Object.entries(f))y in p||(p[y]=v);let _=bc.join(e,"frontfriend.config.js"),h;if($E(_)){let y=sy(_),{expression:v}=ay(y),g=new Set(["name","ff-id","adopt","framework","primitive",...u!==void 0?["tag","releaseTagId"]:[],...s?["api-url","apiUrl"]:[],...c!==void 0?["baseLibrary"]:[]]),w=new Set(["auth-token","authToken","ffId","appRoot","adoptExplicit"]),$=v.properties.filter(O=>!g.has(Ld(O))&&!w.has(Ld(O))).map(O=>y.slice(O.start,O.end));h=[...Object.entries(p).filter(([O])=>g.has(O)).map(([O,P])=>`${JSON.stringify(O)}: ${JSON.stringify(P)}`),...$]}else h=Object.entries(p).map(([y,v])=>`${JSON.stringify(y)}: ${JSON.stringify(v)}`);return cy(_,uy(e,h)),p}function uy(e,t){let r=`{
|
|
18
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return we(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),l){var k=this.pos-1;this.invalidStringToken(k,"Invalid escape sequence in template string")}default:if(R>=48&&R<=55){var q=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],J=parseInt(q,8);return J>255&&(q=q.slice(0,-1),J=parseInt(q,8)),this.pos+=q.length-1,R=this.input.charCodeAt(this.pos),(q!=="0"||R===56||R===57)&&(this.strict||l)&&this.invalidStringToken(this.pos-1-q.length,l?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(J)}return E(R)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(R)}},tt.readHexChar=function(l){var R=this.pos,k=this.readInt(16,l);return k===null&&this.invalidStringToken(R,"Bad character escape sequence"),k},tt.readWord1=function(){this.containsEsc=!1;for(var l="",R=!0,k=this.pos,q=this.options.ecmaVersion>=6;this.pos<this.input.length;){var J=this.fullCharCodeAtPos();if(_(J,q))this.pos+=J<=65535?1:2;else if(J===92){this.containsEsc=!0,l+=this.input.slice(k,this.pos);var ae=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var le=this.readCodePoint();(R?p:_)(le,q)||this.invalidStringToken(ae,"Invalid Unicode escape"),l+=we(le),k=this.pos}else break;R=!1}return l+this.input.slice(k,this.pos)},tt.readWord=function(){var l=this.readWord1(),R=m.name;return this.keywords.test(l)&&(R=w[l]),this.finishToken(R,l)};var dt="8.17.0";lt.acorn={Parser:lt,version:dt,defaultOptions:C,Position:j,SourceLocation:U,getLineInfo:B,Node:sn,TokenType:h,tokTypes:m,keywordTypes:w,TokContext:cr,tokContexts:Rt,isIdentifierChar:_,isIdentifierStart:p,Token:Gr,isNewLine:E,lineBreak:O,lineBreakG:P,nonASCIIwhitespace:D};function ln(l,R){return lt.parse(l,R)}function Nt(l,R,k){return lt.parseExpressionAt(l,R,k)}function Cu(l,R){return lt.tokenizer(l,R)}e.Node=sn,e.Parser=lt,e.Position=j,e.SourceLocation=U,e.TokContext=cr,e.Token=Gr,e.TokenType=h,e.defaultOptions=C,e.getLineInfo=B,e.isIdentifierChar=_,e.isIdentifierStart=p,e.isNewLine=E,e.keywordTypes=w,e.lineBreak=O,e.lineBreakG=P,e.nonASCIIwhitespace=D,e.parse=ln,e.parseExpressionAt=Nt,e.tokContexts=Rt,e.tokTypes=m,e.tokenizer=Cu,e.version=dt})});var ey=ee((m_e,oE)=>{var{parse:z6}=rE();function _c(){let e=new Error("Configuration reads require a data-only object export. Remove executable statements from frontfriend.config.js.");return e.code="FRONTFRIEND_CONFIG_VALIDATION",e}function iE(e){if(e.type!=="Property"||e.computed||e.method||e.kind!=="init")throw _c();let t=e.key.type==="Identifier"?e.key.name:e.key.value;if(typeof t!="string"||["__proto__","constructor","prototype"].includes(t))throw _c();return t}function nE(e){if(e.type==="ExportDefaultDeclaration")return e.declaration;let t=e.type==="ExpressionStatement"?e.expression:null;return t?.type==="AssignmentExpression"&&t.operator==="="&&t.left.type==="MemberExpression"&&!t.left.computed&&t.left.object.name==="module"&&t.left.property.name==="exports"?t.right:null}function V6(e,t){if(e.type!=="VariableDeclaration"||e.declarations.length!==1)return null;let[r]=e.declarations;return r.id.type!=="Identifier"||t?.type!=="Identifier"||t.name!==r.id.name?null:r.init}function F6(e){let r=z6(e,{ecmaVersion:"latest",sourceType:"module"}).body.filter(o=>o.type!=="EmptyStatement"&&!o.directive),i=r.length===1?nE(r[0]):r.length===2?V6(r[0],nE(r[1])):null;if(i?.type!=="ObjectExpression")throw _c();function n(o,a=0){if(a>64)throw _c();if(o.type==="Literal"&&(o.value===null||["string","number","boolean"].includes(typeof o.value)))return o.value;if(o.type==="ArrayExpression")return o.elements.map(s=>{if(!s)throw _c();return n(s,a+1)});if(o.type==="ObjectExpression")return Object.fromEntries(o.properties.map(s=>[iE(s),n(s.value,a+1)]));if(o.type==="UnaryExpression"&&["-","+"].includes(o.operator)&&o.argument.type==="Literal"&&typeof o.argument.value=="number")return o.operator==="-"?-o.argument.value:o.argument.value;if(o.type==="TemplateLiteral"&&o.expressions.length===0)return o.quasis[0].value.cooked;if(o.type==="MemberExpression"&&!o.computed&&o.object.type==="MemberExpression"&&!o.object.computed&&o.object.object.name==="process"&&o.object.property.name==="env")return process.env[o.property.name];if(o.type==="LogicalExpression"&&["||","??"].includes(o.operator)){let s=n(o.left,a+1);return o.operator==="||"?s||n(o.right,a+1):s??n(o.right,a+1)}throw _c()}return{config:n(i),expression:i}}oE.exports={parseStaticConfig:F6,propertyName:iE}});var cE=ee((h_e,sE)=>{var bo=require("path"),{fileExists:ty}=rs();function aE(e,t=process.cwd()){let r=t;for(;r!==bo.parse(r).root;){let i=bo.join(r,e);if(ty(i))return i;r=bo.dirname(r)}return null}function J6(e,t=process.cwd(),r=null){let i=[],n=t,o=10;for(let a=0;a<o;a++){i.push(bo.join(n,e)),a<3&&i.push(bo.join(n,"../".repeat(a+1)+e));let s=bo.dirname(n);if(s===n)break;n=s}i.push(bo.join(__dirname,"../../../",e));for(let a of i)if(ty(a)&&(!r||r(a)))return a;return null}function Z6(e,t=process.cwd()){let r=e.map(i=>bo.isAbsolute(i)?i:bo.join(t,i));for(let i of r)if(ty(i))return i;return null}function H6(e=process.cwd()){let t=aE("frontfriend.config.js",e);return t?bo.dirname(t):e}sE.exports={findFileUpward:aE,findDirectoryUpward:J6,findDirectoryWithPaths:Z6,resolveProjectRoot:H6}});var Os=ee((g_e,B6)=>{B6.exports={name:"@frontfriend/sdk",version:"1.3.0"}});var xu=ee((y_e,uE)=>{var{name:K6}=Os();uE.exports={PACKAGE_NAME:K6}});var Is=ee((v_e,dE)=>{var{PACKAGE_NAME:Nd}=xu(),Ua=require("fs"),W6=require("http"),G6=require("https"),ti=require("path"),Md=["contracts","tokens","components"],Y6=["app/globals.css","src/app/globals.css","styles/globals.css","src/styles/globals.css","src/styles.css","src/index.css","src/style.css"],X6={next:["next.config.js","next.config.mjs","next.config.ts"],vite:["vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"]},Q6=["primereact","@mui/material","antd","@chakra-ui/react","@mantine/core","@fluentui/react"],eF=["style-dictionary","@tokens-studio/sd-transforms","@vanilla-extract/css","styled-components","@emotion/react"];function lE(e){try{return JSON.parse(Ua.readFileSync(e,"utf8"))}catch{return{}}}function ry(e){if(e===void 0)return null;if(!Array.isArray(e)){let i=new Error("`adopt` in frontfriend.config.js must be an array.");throw i.code="FRONTFRIEND_CONFIG_VALIDATION",i}let t=e.filter(i=>!Md.includes(i));if(t.length>0){let i=new Error(`Unknown Frontfriend adoption level: ${t.join(", ")}.`);throw i.code="FRONTFRIEND_CONFIG_VALIDATION",i}let r=e.includes("components")?2:e.includes("tokens")?1:0;return Md.slice(0,r+1)}function tF(e){for(let[t,r]of Object.entries(X6)){let i=r.find(o=>Ua.existsSync(ti.join(e,o)));if(!i)continue;let n=Ua.readFileSync(ti.join(e,i),"utf8");return{buildTool:t,present:n.includes(`${Nd}/${t}`)}}return{buildTool:null,present:!1}}function rF(e){let t=[ti.join(e,"components","ui"),ti.join(e,"src","components","ui"),ti.join(e,"app","components","ui")].filter(n=>Ua.existsSync(n)),r=new Set;function i(n){for(let o of Ua.readdirSync(n,{withFileTypes:!0})){let a=ti.join(n,o.name);if(o.isDirectory())i(a);else if(/\.(js|jsx|ts|tsx|vue)$/.test(o.name)){if(!Ua.readFileSync(a,"utf8").includes(Nd))continue;let c=ti.basename(o.name,ti.extname(o.name));r.add(c.toLowerCase()==="index"?ti.basename(n):c.toLowerCase())}}}return t.forEach(i),[...r].sort()}function nF(e){let t=lE(ti.join(e,"package.json")),r={...t.dependencies||{},...t.devDependencies||{}},i=r.tailwindcss||null,o=[lE(ti.join(e,"components.json"))?.tailwind?.css,...Y6].filter(Boolean).find(c=>Ua.existsSync(ti.join(e,c))),a=o?Ua.readFileSync(ti.join(e,o),"utf8"):"",s=eF.filter(c=>r[c]);return!s.length&&/:root[\s\S]*--(?:color|spacing|font|radius)-[\w-]+\s*:/.test(a)&&!a.includes(`${Nd}/theme.css`)&&s.push("css-custom-properties"),{nativeTokens:{present:a.includes("/* Frontfriend managed native tokens: start */"),file:o||null},tailwind:{present:!!i,version:i,major:i&&Number((String(i).match(/\d+/)||[])[0])||null},componentsJson:Ua.existsSync(ti.join(e,"components.json")),themeImport:{present:a.includes(`${Nd}/theme.css`)||/@import\s+["'][^"']*node_modules\/\.cache\/frontfriend\/theme\.css["']/.test(a),file:o||null},plugin:tF(e),frontfriendComponents:rF(e),foreignComponentLibraries:Q6.filter(c=>r[c]),foreignTokenSystems:s}}function iF(e,t,{baseLibrary:r}={}){let i=ry(e)||Md,n=i.includes("tokens"),o=i.includes("components"),a=[];return n&&!t.themeImport.present&&!t.nativeTokens?.present&&a.push("Config adopts tokens, but the Frontfriend theme import was not observed."),!n&&t.themeImport.present&&a.push("Frontfriend tokens are present in CSS but are not adopted in config."),o&&r==="shadcn"&&!t.componentsJson&&a.push("Config adopts components, but components.json was not observed."),!o&&t.frontfriendComponents.length>0&&a.push("Frontfriend components are installed but are not adopted in config."),a}function oF({apiUrl:e,token:t,ffId:r,name:i,adopt:n,observed:o,framework:a,primitive:s}){if(!e||!t||!r||!i||!a||s===void 0)return Promise.resolve({reported:!1,unavailable:!0});let c=new URL("/api/apps/sync",e),u=JSON.stringify({ffId:r,name:i,adopt:ry(n),observed:o,runtime:"sdk",framework:a,primitive:s}),d=c.protocol==="https:"?G6:W6;return new Promise(f=>{let p=d.request(c,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json","content-length":Buffer.byteLength(u)}},_=>{_.resume(),_.on("end",()=>{_.statusCode>=200&&_.statusCode<300?f({reported:!0,unavailable:!1}):f({reported:!1,unavailable:!0})})});p.on("error",()=>f({reported:!1,unavailable:!0})),p.setTimeout(1500,()=>{p.destroy(),f({reported:!1,unavailable:!0})}),p.end(u)})}dE.exports={ADOPTION_LEVELS:Md,normalizeAdopt:ry,probeAdoption:nF,adoptionWarnings:iF,reportAdoption:oF}});var xd=ee((b_e,pE)=>{var qu=require("path"),{parseStaticConfig:aF}=ey(),{findFileUpward:sF}=cE(),{fileExists:__e,readJsonFileSafe:fE,readFileSafe:cF}=rs(),{normalizeAdopt:uF}=Is();function ny(e,t){let r=qu.dirname(t),i={...e,ffId:e["ff-id"]||null,appRoot:r};if(!i.name){let n=fE(qu.join(r,"package.json"))?.name;n&&(i.name=n)}return e.adopt!==void 0&&(i.adopt=uF(e.adopt),i.adoptExplicit=!0),i}async function lF(e){return aF(cF(e)).config}var iy=class{findConfigFile(t=process.cwd()){return sF("frontfriend.config.js",t)}isESModule(t){try{let r=qu.join(t,"package.json"),i=fE(r);if(i)return i.type==="module"}catch{}return!1}async load({startDir:t=process.cwd(),strict:r=!1,fresh:i=!1}={}){let n=this.findConfigFile(t);if(n)try{if(i)return ny(await lF(n),n);let o,a=qu.dirname(n);if(n.endsWith(".js")&&this.isESModule(a)){let u=await import(`file://${n}`);o=u.default||u}else o=require(n);return ny(o,n)}catch(o){if(r||o.code==="FRONTFRIEND_CONFIG_VALIDATION")throw o;console.error("Error loading frontfriend.config.js:",o.message)}return{ffId:null,appRoot:t}}loadSync(){let t=this.findConfigFile();if(t)try{let r=qu.dirname(t);if(t.endsWith(".js")&&this.isESModule(r))console.error("Error: frontfriend.config.js is an ES module. Please use the async load() method");else{let n=require(t);return ny(n,t)}}catch(r){if(r.code==="FRONTFRIEND_CONFIG_VALIDATION")throw r;console.error("Error loading frontfriend.config.js:",r.message)}return{ffId:null,appRoot:process.cwd()}}};pE.exports=iy});var qd={};go(qd,{ProjectTargetError:()=>os,SUPPORTED_PROJECT_TARGETS:()=>mE,assertMatchingProjectTargets:()=>hE,defaultV4ProjectTarget:()=>fF,parseProjectTarget:()=>jn,projectTargetKey:()=>za,registryRoute:()=>mF,resolveProjectTarget:()=>pF});function za(e){return`${e.framework}/${e.primitive}`}function jn(e,t="Project target"){let r=e,i=typeof r?.framework=="string"?r.framework.trim().toLowerCase():"",n=typeof r?.primitive=="string"?r.primitive.trim().toLowerCase():"",o=`${i}/${n}`;if(!i||!n||!dF.has(o))throw new os("INVALID_PROJECT_TARGET",`${t} must be exactly one of react/radix, react/base, react/aria, or vue/reka; received ${o}.`,{framework:i||null,primitive:n||null});return{framework:i,primitive:n}}function fF(e="react"){return jn({framework:e,primitive:e==="vue"?"reka":"base"})}function hE(e){let t=Object.entries(e).filter(([,n])=>n!=null).map(([n,o])=>[n,jn(o,n)]);if(t.length===0)throw new os("PROJECT_TARGET_REQUIRED","A persisted or configured Project target is required.");let r=za(t[0][1]);if(t.find(([,n])=>za(n)!==r))throw new os("PROJECT_TARGET_MISMATCH",`Project target mismatch: ${t.map(([n,o])=>`${n}=${za(o)}`).join(", ")}.`,{targets:Object.fromEntries(t)});return t[0][1]}function pF({persisted:e,configured:t,app:r,release:i,lock:n,proposed:o}={}){let a={persisted:e,configured:t,app:r,release:i,lock:n};if(Object.values(a).some(s=>s!=null))return hE(a);if(o)return jn(o,"migration proposal");throw new os("PROJECT_TARGET_REQUIRED","A Project target is required; package detection may only propose one during migration.")}function mF(e,t){throw jn(e),String(t||"").trim(),new os("CURRENT_ROUTE_RETIRED","Components resolve only from an authenticated immutable Design System Release.")}var mE,dF,os,Cs=Ve(()=>{mE=Object.freeze([Object.freeze({framework:"react",primitive:"radix"}),Object.freeze({framework:"react",primitive:"base"}),Object.freeze({framework:"react",primitive:"aria"}),Object.freeze({framework:"vue",primitive:"reka"})]),dF=new Set(mE.map(e=>`${e.framework}/${e.primitive}`)),os=class extends Error{constructor(t,r,i={}){super(r),this.name="ProjectTargetError",this.code=t,Object.assign(this,i)}}});var wE=ee((S_e,SE)=>{var gE=require("fs"),yE=require("path"),{parseProjectTarget:hF,ProjectTargetError:gF}=(Cs(),ei(qd)),yF=[["radix",e=>e==="radix-ui"||e.startsWith("@radix-ui/")&&e!=="@radix-ui/react-slot"],["base",e=>e==="@base-ui-components/react"||e==="@base-ui/react"],["aria",e=>e==="react-aria-components"||e==="react-aria"],["reka",e=>e==="reka-ui"||e==="radix-vue"]];function vE(e){return JSON.parse(gE.readFileSync(e,"utf8"))}function _E(e){try{let t=vE(yE.join(e,"package.json"));return{...t.dependencies||{},...t.devDependencies||{}}}catch{return{}}}function bE(e){let t=_E(e);return t.vue||t["@vitejs/plugin-vue"]||t.nuxt?"vue":"react"}var Dd=e=>`${e.framework}/${e.primitive}`;function oy(e,t){try{return{status:"supported",target:hF(e),...t}}catch(r){if(!(r instanceof gF))throw r;return{status:"unsupported",detected:e,reason:r.message,...t}}}function vF(e,{persisted:t,declared:r,allowMissingComponents:i=!1}={}){let n=yE.join(e,"components.json"),o=gE.existsSync(n),a=_E(e),s=bE(e),c=t?.framework&&t?.primitive?t:r,u=c?.framework===s&&c?.primitive&&(s==="react"?a.react:a.vue||a.nuxt);if(!o&&!u&&!i)return{status:"not_shadcn",reason:"components.json was not found: this is not a shadcn application. Run `npx shadcn@latest init` (`npx shadcn-vue@latest init` for Vue) first, or run connect in the application directory."};let d;try{d=o?vE(n):{}}catch(w){return{status:i?"unsupported":"not_shadcn",reason:`components.json is not valid JSON (${w.message}).`}}let f=typeof d?.style=="string"?d.style:null,p=o?[`components.json${f?` (style ${f})`:""}`]:["Explicit Project target for a new application"],_=s==="vue"?["vue","@vitejs/plugin-vue","nuxt"].find(w=>a[w]):a.react?"react":null;_&&p.push(`package.json: ${_}`);let h=new Map;for(let[w,$]of yF){let m=Object.keys(a).sort().find($);m&&h.set(w,`package.json: ${m}`)}let y=f&&/^(radix|base|aria|reka)-/.exec(f)?.[1];y&&!h.has(y)&&h.set(y,`components.json: style ${f}`),p.push(...h.values());let v={components_json:o?"components.json":null,evidence:p};if(t?.framework&&t?.primitive)return oy({framework:t.framework,primitive:t.primitive},v);if(h.size>1)return{status:"conflict",reason:`Evidence for several primitives (${[...h.keys()].join(", ")}): a project uses one Project target. Remove the unused primitive, then run connect again.`,...v};let g=h.size===1?{framework:[...h.keys()][0]==="reka"?"vue":s,primitive:[...h.keys()][0]}:null;if(r?.framework||r?.primitive){let w={framework:r.framework||s,primitive:r.primitive||g?.primitive};return w.primitive?g&&Dd(g)!==Dd(w)?{status:"conflict",reason:`The declared target ${Dd(w)} conflicts with the project, which shows ${Dd(g)}.`,...v}:oy(w,v):{status:"undetermined",reason:"The primitive cannot be determined. Pass --primitive with --framework.",...v}}return g?oy(g,v):{status:"undetermined",reason:"components.json exists, but no primitive package is installed yet, so the primitive cannot be determined. Pass --primitive: radix, base or aria for React, reka for Vue.",...v}}SE.exports={detectShadcnProject:vF,detectProjectFramework:bE}});var Ud=ee((w_e,PE)=>{var{parseStaticConfig:ay,propertyName:Ld}=ey(),{fileExists:$E,readFileSafe:sy,writeTextFile:cy,readJsonFileSafe:_F}=rs(),bc=require("path"),{normalizeAdopt:RE}=Is(),{parseProjectTarget:bF}=(Cs(),ei(qd));function EE(e){try{return _F(e)??{}}catch{return{}}}function SF(e){return EE(bc.join(e,"package.json")).name||bc.basename(e)}function wF(e={}){let t={...e};return delete t.ffId,delete t.appRoot,delete t.adoptExplicit,delete t["auth-token"],delete t.authToken,t}function $F(e,t,{ffId:r,name:i,adopt:n,framework:o,primitive:a,apiUrl:s,baseLibrary:c,tag:u}){let d=bF({framework:o,primitive:a},"Setup Project target"),f=wF(t),p={name:i.trim(),"ff-id":r.trim(),adopt:RE(n),framework:d.framework,primitive:d.primitive};if(u!==void 0){if(typeof u!="string"||!u.trim())throw new Error("Release tag must not be empty.");p.tag=u.trim()}if(c!==void 0){if(!["frontfriend","shadcn"].includes(c))throw new Error("Base library must be frontfriend or shadcn.");p.baseLibrary=c}s&&(p["api-url"]=String(s).replace(/\/+$/,""),delete f.apiUrl);for(let[y,v]of Object.entries(f))y in p||(p[y]=v);let _=bc.join(e,"frontfriend.config.js"),h;if($E(_)){let y=sy(_),{expression:v}=ay(y),g=new Set(["name","ff-id","adopt","framework","primitive",...u!==void 0?["tag","releaseTagId"]:[],...s?["api-url","apiUrl"]:[],...c!==void 0?["baseLibrary"]:[]]),w=new Set(["auth-token","authToken","ffId","appRoot","adoptExplicit"]),$=v.properties.filter(O=>!g.has(Ld(O))&&!w.has(Ld(O))).map(O=>y.slice(O.start,O.end));h=[...Object.entries(p).filter(([O])=>g.has(O)).map(([O,P])=>`${JSON.stringify(O)}: ${JSON.stringify(P)}`),...$]}else h=Object.entries(p).map(([y,v])=>`${JSON.stringify(y)}: ${JSON.stringify(v)}`);return cy(_,uy(e,h)),p}function uy(e,t){let r=`{
|
|
19
19
|
${t.join(`,
|
|
20
20
|
`)}
|
|
21
21
|
}`;return EE(bc.join(e,"package.json")).type==="module"?`const config = ${r};
|
|
@@ -29,7 +29,7 @@ export default config;
|
|
|
29
29
|
`)}function NE({design_system:e,contracts:t}){let r=[...t].filter(n=>Lu(n.slug)).sort((n,o)=>n.kind.localeCompare(o.kind)||n.slug.localeCompare(o.slug)),i={"README.md":gy(e)};for(let n of r)i[n.slug]=hy(n);return i}function my(e,t){let r={};for(let[n,o]of Object.entries(e))t[n]!==o&&(r[n]=o);let i=Object.keys(t).filter(n=>!(n in e)).sort();return{writes:r,deletes:i}}var yy=e=>AE("sha256").update(e).digest("hex");function JF(e){return Object.fromEntries(Object.entries(e).filter(([t])=>t!=="README.md"&&Lu(t)).map(([t,r])=>[t,yy(r)]))}function ZF(e,t){let r=()=>{throw new Error("Invalid or incomplete mirror response. No local files were changed; retry sync.")};(!e||typeof e.design_system?.ff_id!="string"||typeof e.design_system?.name!="string"||!Array.isArray(e.contracts))&&r();let i=new Map;for(let a of e.contracts)(!a||!Lu(a.slug)||a.slug==="README.md"||typeof a.body!="string"||typeof a.kind!="string"||typeof a.maturity!="string"||typeof a.implemented!="boolean"||!Number.isSafeInteger(a.version)||a.version<1||i.has(a.slug))&&r(),i.set(a.slug,hy(a));if(e.protocol===void 0)return e.manifest!==void 0&&r(),my(NE(e),t);(e.protocol!==1||!Array.isArray(e.manifest))&&r();let n={"README.md":gy(e.design_system)},o=new Set;for(let a of e.manifest){(!a||!Lu(a.slug)||a.slug==="README.md"||!/^[a-f0-9]{64}$/.test(a.hash)||o.has(a.slug))&&r(),o.add(a.slug);let s=i.get(a.slug)??t[a.slug];(typeof s!="string"||yy(s)!==a.hash)&&r(),Object.defineProperty(n,a.slug,{value:s,enumerable:!0})}return[...i.keys()].some(a=>!o.has(a))&&r(),my(n,t)}function HF(e){let t={};if(!Va.existsSync(e))return t;let r=i=>{for(let n of Va.readdirSync(i,{withFileTypes:!0})){let o=So.join(i,n.name);if(n.isDirectory())r(o);else if(n.isFile()){let a=So.relative(e,o).split(So.sep).join("/");t[a]=Va.readFileSync(o,"utf8")}}};return r(e),t}function BF(e,t){for(let[r,i]of Object.entries(t.writes)){let n=So.join(e,...r.split("/"));Va.mkdirSync(So.dirname(n),{recursive:!0}),Va.writeFileSync(n,i)}for(let r of t.deletes){let i=So.join(e,...r.split("/"));Va.rmSync(i,{force:!0});let n=So.dirname(i),o=So.resolve(e);for(;So.resolve(n)!==o&&Va.existsSync(n)&&Va.readdirSync(n).length===0;)Va.rmdirSync(n),n=So.dirname(n)}}function KF(e,t,r){if(!t||e.contract_selection!==1||e.selection?.design_snapshot_id!==t.snapshotId||e.selection?.digest!==t.snapshotDigest||e.app?.id!==t.appId||e.design_system?.ff_id!==r)throw new Error("Contract mirror does not match the selected App snapshot.");let i=[...t.sharedContracts,...t.contracts],n=e.manifest??e.contracts,o=new Map(i.map(a=>[a.slug,a]));if(!Array.isArray(n)||!Array.isArray(e.contracts)||n.length!==i.length||new Set(n.map(a=>a.slug)).size!==i.length||n.some(a=>!o.has(a.slug)))throw new Error("Contract mirror inventory does not match the snapshot.");for(let a of e.contracts){let s=o.get(a.slug);if(!s||a.revision_id!==s.revisionId||a.digest!==s.digest||a.version!==s.version||a.kind!==s.kind)throw new Error("Contract body identity does not match its snapshot pin.");let c={appId:t.contracts.some(d=>d.slug===s.slug)?t.appId:null,body:a.body,designSystemId:t.designSystemId,kind:a.kind,maturity:a.maturity,slug:a.slug,title:a.title};if(AE("sha256").update(JSON.stringify(c)).digest("hex")!==s.digest)throw new Error("Contract content does not match its immutable digest.")}return i}ME.exports={validatePinnedMirror:KF,MIRROR_DIR:zF,FRONTFRIEND_GITIGNORE_PATH:VF,renderFrontfriendGitignore:FF,isSafeSlug:Lu,renderContractFile:hy,renderMirrorReadme:gy,buildMirrorTree:NE,planMirrorSync:my,hashMirrorFile:yy,knownMirrorHashes:JF,planMirrorResponse:ZF,readMirrorTree:HF,applyMirrorPlan:BF}});var wy={};go(wy,{adoptionDigest:()=>Ts,canonicalApplicationLock:()=>xE,canonicalDesignAdoption:()=>Fd,hasValidAdoptionDigest:()=>qE,normalizeLock:()=>Sy,parseApplicationLock:()=>wo,sameAdoption:()=>by,serializeApplicationLock:()=>Jd,sortContractPins:()=>_y,sortedObject:()=>Qi});function Qi(e){return Object.fromEntries(Object.entries(e).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>[t,r&&typeof r=="object"&&!Array.isArray(r)?{...r,...Array.isArray(r.files)?{files:[...r.files].sort((i,n)=>i.path.localeCompare(n.path))}:{}}:r]))}function Uu(e){return Array.isArray(e)?e.map(Uu):e&&typeof e=="object"?Object.fromEntries(Object.keys(e).filter(t=>t!=="adoptionDigest").sort().map(t=>[t,Uu(e[t])])):e}function _y(e){return[...e].sort((t,r)=>vy(t.slug,r.slug)||vy(t.kind,r.kind))}function Fd(e){return{...e,contracts:_y(e.contracts),sharedContracts:_y(e.sharedContracts)}}function xE(e){return{...e,...e.design?{design:Fd(e.design)}:{},...Array.isArray(e.sourceReleaseIds)?{sourceReleaseIds:[...new Set(e.sourceReleaseIds)].sort(vy)}:{},...e.components?{components:Object.fromEntries(Object.entries(e.components).map(([t,r])=>[t,Array.isArray(r?.files)?{...r,files:[...r.files].sort((i,n)=>i.path.localeCompare(n.path))}:r]))}:{}}}function Ts(e){return Vr(JSON.stringify(Uu(xE(e))))}function GF(e){return Vr(JSON.stringify(Uu(e)))}function qE(e){return typeof e.adoptionDigest=="string"&&(Ts(e)===e.adoptionDigest||GF(e)===e.adoptionDigest)}function by(e,t){return Ts(e)===Ts(t)}function Sy(e){let t=e;if(!t||![1,2,3].includes(Number(t.schemaVersion))||typeof t.components!="object"||t.components===null)throw new ot("Unsupported or malformed frontfriend.lock.json.");let r=Object.fromEntries(Object.entries(t.components).map(([s,c])=>{let u=c;if(!u||!["canonical","private"].includes(String(u.source))||typeof u.versionId!="string"||typeof u.semver!="string")throw new ot(`Unsupported source kind for ${s}.`);return[s,u]})),i={releaseId:t.releaseId==null?null:String(t.releaseId),tokenVersionId:String(t.tokenVersionId),projectTarget:t.schemaVersion===3&&t.projectTarget===null&&Object.keys(r).length===0?null:jn(t.projectTarget,"Application lock target"),components:r};for(let s of Object.values(r)){if(!s.projectTarget)continue;let c=jn(s.projectTarget,"Component adoption target");if(!i.projectTarget||c.framework!==i.projectTarget.framework||c.primitive!==i.projectTarget.primitive)throw new ot("Component adoption belongs to another Project target.")}if(t.schemaVersion===1)return{...i,projectTarget:jn(t.projectTarget,"Application lock target"),schemaVersion:1,components:r};if(typeof t.designSystemId!="string"||!t.designSystemId||typeof t.ffId!="string"||!t.ffId||typeof t.adoptionDigest!="string"||!t.adoptionDigest||typeof t.tokenSourceReleaseId!="string"||!t.tokenSourceReleaseId||!Array.isArray(t.sourceReleaseIds))throw new ot("Malformed v2 Frontfriend adoption snapshot.");let n={...i,schemaVersion:t.schemaVersion===3?3:2,...t.schemaVersion===3?{design:t.design}:{},designSystemId:t.designSystemId,ffId:t.ffId,...t.baseLibrary!==void 0?{baseLibrary:t.baseLibrary}:{},...t.baseProvenance!==void 0?{baseProvenance:t.baseProvenance}:{},...t.replacements!==void 0?{replacements:t.replacements}:{},adoptionDigest:t.adoptionDigest,tokenSourceReleaseId:t.tokenSourceReleaseId,sourceReleaseIds:[...new Set(t.sourceReleaseIds.map(String))].sort(),components:r};if(n.baseLibrary!==void 0&&!["frontfriend","shadcn"].includes(n.baseLibrary))throw new ot("Unsupported base library in Application lock.");if(n.schemaVersion===3){let s=n.design;if(!s||s.designSystemId!==n.designSystemId||!s.appId||!s.snapshotId||!s.sharedSourceReleaseId||!Array.isArray(s.contracts)||!Array.isArray(s.sharedContracts))throw new ot("Malformed Application design adoption.");let c=[...s.sharedContracts,...s.contracts];if(new Set(c.map(d=>d.slug)).size!==c.length||c.some(d=>d.designSystemId!==n.designSystemId||!d.revisionId||!d.contractId||!WF(d.slug)||!d.slug.endsWith(".md")||!Number.isInteger(d.version)||d.version<1||!/^[a-f0-9]{64}$/.test(d.digest)))throw new ot("Invalid contract revision pins in the Application lock.");if(s.sharedContracts.some(d=>!["guidelines","design-context","guideline-chapter","layout","pattern"].includes(d.kind))||s.contracts.some(d=>!["app-context","page"].includes(d.kind)))throw new ot("Contract pins have invalid shared or App ownership.");if(Vr(JSON.stringify(Uu({schemaVersion:1,appId:s.appId,sharedSourceReleaseId:s.sharedSourceReleaseId,contracts:[...s.contracts].sort((d,f)=>d.slug.localeCompare(f.slug))})))!==s.snapshotDigest)throw new ot("Application design snapshot digest does not match its manifest.")}else if(t.design!==void 0)throw new ot("Contract pins require a schema version 3 Application lock.");let o=Object.values(n.components).map(s=>{if(typeof s.sourceReleaseId!="string"||!s.sourceReleaseId)throw new ot("Every v2 component adoption must identify its immutable source Release.");return s.sourceReleaseId}),a=[...new Set([n.tokenSourceReleaseId,...o,...n.design?[n.design.sharedSourceReleaseId]:[]])].sort();if(JSON.stringify(a)!==JSON.stringify(n.sourceReleaseIds))throw new ot("The adoption source Releases do not match the token and component provenance.");if(n.releaseId&&(a.length!==1||a[0]!==n.releaseId))throw new ot("A lock may reference a Release only when its complete closure matches that Release.");if(!qE(n))throw new ot("The adoption snapshot digest does not match its manifest.");return n}function wo(e){try{return Sy(typeof e=="string"?JSON.parse(e):e)}catch(t){throw t instanceof ot?t:new ot(`Invalid frontfriend.lock.json: ${t instanceof Error?t.message:String(t)}`)}}function Jd(e){let t=Sy(e);return`${JSON.stringify({...t,components:Qi(t.components)},null,2)}
|
|
30
30
|
`}var WF,vy,Zd=Ve(()=>{Cs();dy();py();({isSafeSlug:WF}=Sc());vy=(e,t)=>e<t?-1:e>t?1:0});var Kd=ee((T_e,zE)=>{"use strict";var Fr=require("node:fs"),Ni=require("node:path"),Hd=".frontfriend/rules",Ry="index.json",YF=["component-property-layer.md"];function Bd(e){return typeof e=="string"&&e.length>0&&!Ni.isAbsolute(e)&&!e.includes("\\")&&!e.split("/").some(t=>t===""||t==="."||t==="..")&&/^[a-z0-9][a-z0-9._/-]*$/i.test(e)}var $y=e=>e.startsWith("packs/");function DE(e){let t=e.files.filter(r=>!$y(r.path)).map(r=>{if(r.path!=="rules.json"&&r.path!==Ry)return r;let i=JSON.parse(r.content);return r.path==="rules.json"&&(i.rules=i.rules.map(n=>{if(!n.source?.pack)return n;let{id:o,label:a,nature:s,maturity:c,scope:u,checks:d,area:f,enabled:p,source:_}=n;return{id:o,label:a,nature:s,maturity:c,scope:u,checks:d,area:f,enabled:p,source:_}})),Array.isArray(i.files)&&(i.files=i.files.filter(n=>!$y(n))),{...r,content:`${JSON.stringify(i,null,2)}
|
|
31
31
|
`}});return{...e,files:t}}async function XF({url:e,token:t,fetchImpl:r=fetch}){let i=await r(e,{headers:{accept:"application/json",authorization:`Bearer ${t}`},signal:AbortSignal.timeout(6e4)}),n=await i.text(),o;try{o=JSON.parse(n)}catch{throw new Error(`Expected JSON from the FrontFriend rules endpoint (HTTP ${i.status}). Check --api-url.`)}if(!i.ok)throw new Error(o?.error||`Rules request failed (HTTP ${i.status}).`);if(o.rules_protocol!==1||!Array.isArray(o.files))throw new Error("Rules response is not a Frontfriend rules mirror.");for(let a of o.files)if(!a||!Bd(a.path)||typeof a.content!="string")throw new Error(`Rules response contains an unsafe or invalid file entry: ${JSON.stringify(a?.path)}`);return DE(o)}function QF(e){try{let t=JSON.parse(Fr.readFileSync(Ni.join(e,Ry),"utf8"));return Array.isArray(t.files)?t.files.filter(Bd):[]}catch{return null}}function LE(e,t=""){return Fr.existsSync(e)?Fr.readdirSync(e,{withFileTypes:!0}).flatMap(r=>r.isDirectory()?LE(Ni.join(e,r.name),`${t}${r.name}/`):[`${t}${r.name}`]):[]}function UE(e){let t=Ni.join(e,...Hd.split("/")),r=`${t}-previous`;!Fr.existsSync(t)&&Fr.existsSync(r)&&Fr.renameSync(r,t)}function eJ(e,t){UE(e);let r=Ni.join(e,...Hd.split("/")),i=`${r}-staging-${process.pid}`,n=`${r}-previous`,o=DE(t).files.filter(u=>Bd(u.path)),a=QF(r),s=new Set(a??(Fr.existsSync(r)?YF:[])),c=new Set(o.map(u=>u.path));Fr.rmSync(i,{recursive:!0,force:!0}),Fr.rmSync(n,{recursive:!0,force:!0});try{for(let u of LE(r)){if($y(u)||s.has(u)||c.has(u)||u===Ry)continue;let d=Ni.join(i,...u.split("/"));Fr.mkdirSync(Ni.dirname(d),{recursive:!0}),Fr.copyFileSync(Ni.join(r,...u.split("/")),d)}for(let u of o){let d=Ni.join(i,...u.path.split("/"));Fr.mkdirSync(Ni.dirname(d),{recursive:!0}),Fr.writeFileSync(d,u.content)}return Fr.mkdirSync(Ni.dirname(r),{recursive:!0}),Fr.existsSync(r)&&Fr.renameSync(r,n),Fr.renameSync(i,r),Fr.rmSync(n,{recursive:!0,force:!0}),o.map(u=>Ni.join(Hd,u.path))}finally{Fr.rmSync(i,{recursive:!0,force:!0})}}zE.exports={RULES_DIR:Hd,fetchDesignRules:XF,writeDesignRules:eJ,recoverRules:UE,isSafeRulePath:Bd}});var VE=ee((k_e,tJ)=>{tJ.exports={steps:["low","mid","strong","subtle"],states:["hover","active","selected","disabled"],family_intents:{brand:"Brand identity and primary actions.",neutral:"Default surfaces, borders, and content.",inverse:"Content and surfaces on an inverted background.",interactive:"Interactive controls and affordances.",highlight:"Highlighted or emphasized content.",info:"Informational status and feedback.",positive:"Success and positive status.",negative:"Errors, danger, and destructive actions.",warning:"Warnings and cautionary status.",onbrand:"Foreground content placed on brand surfaces.",oninteractive:"Foreground content placed on interactive surfaces.",onhighlight:"Foreground content placed on highlight surfaces.",oninfo:"Foreground content placed on informational surfaces.",onpositive:"Foreground content placed on positive surfaces.",onnegative:"Foreground content placed on negative surfaces.",onwarning:"Foreground content placed on warning surfaces.",layer:"Page, panel, control, popover, and dialog surfaces.",overlay:"Scrims placed between content layers.",disabled:"Disabled controls and content."},shadcn_mapping:{primary:"brand-mid","primary-foreground":"onbrand-mid",secondary:"neutral-subtle","secondary-foreground":"neutral-strong",destructive:"negative-mid","destructive-foreground":"onnegative-mid",background:"layer-below",foreground:"neutral-strong",card:"layer-raised","card-foreground":"neutral-strong",popover:"layer-popover","popover-foreground":"neutral-strong",muted:"neutral-subtle","muted-foreground":"neutral-mid",accent:"neutral-subtle","accent-foreground":"neutral-strong",border:"neutral-subtle",ring:"brand-mid","input background":"layer-control","input border or ring":"neutral-subtle",success:"positive-mid","success-foreground":"onpositive-mid",info:"info-mid","info-foreground":"oninfo-mid",warning:"warning-mid","warning-foreground":"onwarning-mid",invert:"inverse-mid","invert-foreground":"neutral-low",scrim:"overlay"}}});var GE=ee((j_e,WE)=>{var zu=require("fs"),Vu=require("path"),Wd=VE(),ZE=".frontfriend/foundation.md",Ey=Wd.steps,rJ=Wd.states,nJ=Wd.family_intents,iJ=Object.entries(Wd.shadcn_mapping),oJ={alertDialog:"alert-dialog",alertdialog:"alert-dialog",avatarGroup:"avatar-group",avatargroup:"avatar-group",checkboxField:"checkboxfield",datePicker:"datepicker",dateInput:"dateinput",dateSlider:"dateslider",dropdown:"dropdown-menu",dropdownmenu:"dropdown-menu",fileUploader:"fileupload",fileuploader:"fileupload",inputOTP:"input-otp",inputotp:"input-otp",multiSelect:"multi-select",multiselect:"multi-select",pdfViewer:"pdfviewer",phoneInput:"phoneinput",radioGroup:"radio-group",radiogroup:"radio-group",radioGroupField:"radiogroupfield",radiogroupeField:"radiogroupfield",tabBar:"tabbar",themeProvider:"themeprovider",themePicker:"themepicker",tagsInput:"tagsinput",timePicker:"timepicker",numberField:"number-field",numberfield:"number-field",scrollArea:"scroll-area",scrollarea:"scroll-area",hoverCard:"hover-card",hovercard:"hover-card",contextMenu:"context-menu",contextmenu:"context-menu",navigationMenu:"navigation-menu",navigationmenu:"navigation-menu",messageScroller:"message-scroller",messagescroller:"message-scroller",aspectRatio:"aspect-ratio",aspectratio:"aspect-ratio",toggleGroup:"toggle-group",togglegroup:"toggle-group",buttonGroup:"button-group",buttongroup:"button-group",inputGroup:"input-group",inputgroup:"input-group",nativeSelect:"native-select",nativeselect:"native-select"};function HE(e){return oJ[e]||e.toLowerCase()}function FE(e){if(e.startsWith("layer-"))return"layer";if(e==="overlay"||e.startsWith("overlay-"))return"overlay";if(e==="disabled")return"disabled";let t=e.split("-"),r=t.findIndex(i=>Ey.includes(i));return(r===-1?t[0]:t.slice(0,r).join("-"))||e}function aJ(e={}){let t=new Map,r=new Set([...Object.keys(e.semanticVariables||{}),...Object.keys(e.semanticDarkVariables||{})]),i=(a,s)=>{t.has(a)||t.set(a,new Set),t.get(a).add(s)};for(let a of r){let s=a.match(/^--(bg|text|border)-(.+)$/);if(s){i(FE(s[2]),`${s[1]}-${s[2]}`);continue}if(s=a.match(/^--icon-(.+)$/),s){let c=FE(s[1]);i(c,`icon-${s[1]}`),i(c,`text-icon-${s[1]}`);continue}if(s=a.match(/^--layer-(.+)$/),s){i("layer",`bg-layer-${s[1]}`);continue}s=a.match(/^--overlay-(.+)$/),s&&i("overlay",`bg-overlay-${s[1]}`)}let n=Object.keys(e.fontFamilies||e.tokens?.fontFamily||e.utilities?.fontFamily||{}).map(a=>`font-${a.replace(/^--font-/,"")}`).sort(),o=Object.keys(e.animations||{}).map(a=>`animate-${a}`).sort();return{byFamily:t,fonts:n,animations:o}}function gi(e,t="None detected."){return e.length?e.map(r=>`\`${r}\``).join(", "):t}function sJ(){return["Component APIs come from the Frontfriend MCP for this App's Release: `list_components`, then `get_component_api` for exports, Frontfriend-owned props (type, default, required), variants and the values this Design System styles, parts, slots, composition dependencies, a usage example, provenance and any `missing` data. ","","Use `get_component_source` for the pinned source and `get_add_command` for the Release-pinned `frontfriend update` command. Install missing components instead of recreating them.",""]}var cJ=/^--(?:background|foreground|primary|secondary|destructive|muted|accent|popover|card|border|input|ring|chart|sidebar)(?:-|$)/,uJ=["bg","text","border","ring","fill","stroke"],lJ=["shadow-2xs","shadow-xs","shadow-sm","shadow","shadow-md","shadow-lg","shadow-xl","shadow-2xl"],dJ=["font-sans","font-serif","font-mono"];function fJ(e){let t=e.theme||{},r=Object.keys(t),i=p=>r.filter(_=>_.startsWith(`--${p}-`)&&!_.endsWith("*")).map(_=>_.slice(p.length+3)),n=p=>r.includes(`--${p}-*`),o=i("color"),a=[...new Set([...Object.keys(e.light||{}),...Object.keys(e.dark||{})])].filter(p=>cJ.test(p)).map(p=>p.slice(2)),s=[...new Set([...o,...a])].sort().flatMap(p=>uJ.map(_=>`${_}-${p}`)),c=i("radius").map(p=>`rounded-${p}`).sort(),u=[...new Set([...n("font")?[]:dJ,...i("font").map(p=>`font-${p}`)])].sort(),d=[...new Set([...n("shadow")?[]:lJ,...i("shadow").map(p=>`shadow-${p}`)])].sort(),f=i("animate").map(p=>`animate-${p}`).sort();return{colors:s,radius:c,fonts:u,shadows:d,animations:f}}function pJ(e,t){let r=e.nativeTokens||{},{colors:i,radius:n,fonts:o,shadows:a,animations:s}=fJ(r),c=t||e.iconLibrary||null;return["<!-- Generated by Frontfriend from the selected immutable Release. -->","# shadcn foundation","","This Design System uses native shadcn tokens. Keep their names and values. Style & Foundations is authoritative after the initial import.","","Use list_components, get_component_api and get_component_source for the selected Release. An explicit custom replacement is the effective component. Read its source; do not assume standard props or invent missing documentation.","","Release adoption is explicit: use the adopt_design tool of the local Frontfriend MCP bridge, or frontfriend update. Local token and component changes do not publish themselves. Conversion to Frontfriend is optional and uses frontfriend migrate on the same Design System.","","First Application: frontfriend connect performs the native import (Release, token and component adoption, init). The import is a direct publication of the existing code and needs no admin review. Other Applications adopt the configured Release without an initial import. The admin review and Connect activation cover Design contracts only.","","## Native color utilities","",gi(i),"","## Native theme utilities","","Spacing, sizing, layout and type scale are standard Tailwind utilities. Radius, fonts, shadows and animations come from this theme and the Tailwind defaults it keeps.","",`Radius: ${gi(n)}`,"",`Fonts: ${gi(o)}`,"",`Shadows: ${gi(a)}`,"",`Animations: ${gi(s)}`,"","## Icons","",c?`Icon library: \`${c}\`. Import icons from this library only; icon names must exist in it.`:"No icon library is declared for this Design System.","",...["light","dark","theme"].flatMap(u=>[`## ${u}`,"",...Object.entries(r[u]||{}).map(([d,f])=>`- \`${d}\`: \`${f}\``),""])].join(`
|
|
32
|
-
`)}function BE({processedData:e={},componentsConfig:t={},installedComponents:r=[],iconLibrary:i,framework:n="react"}={}){if(e.base==="shadcn")return pJ(e,i);let{byFamily:o,fonts:a,animations:s}=aJ(e),c=[...new Set(Object.keys(t).map(HE))].sort(),u=[...new Set(r)].filter(f=>c.includes(f)).sort(),d=[...o.entries()].sort(([f],[p])=>f.localeCompare(p)).flatMap(([f,p])=>{let _=[...p].sort(),h=Ey.filter(y=>_.some(v=>new RegExp(`-${y}(?:-|$)`).test(v)));return[`### ${f}`,"",nJ[f]||`Semantic ${f} roles defined by this design system.`,"",`Steps present: ${gi(h)}`,"",gi(_),""]});return["<!-- Generated by Frontfriend. Read-only: hand edits are overwritten by `frontfriend init` and `frontfriend design sync`. Commit this file to git. -->","","# Frontfriend foundation","","Read this file before writing or changing UI. Use only the concrete semantic classes listed below; never invent token names or write literal color or spacing values.","","## Static grammar","","- Shape: `{utility}-{family}-{step}[-{state}]`.","- Utility prefixes: `bg-`, `text-`, `border-`, `icon-`, `text-icon-`.",`- Steps: ${gi(Ey)}.`,`- States: ${gi(rJ)}. State variants may wrap a class, for example \`hover:bg-brand-mid-hover\`.`,"- Surfaces use `bg-layer-*`; scrims use `bg-overlay-*`.","- Fonts use `font-*`; animations use `animate-*`.","-
|
|
32
|
+
`)}function BE({processedData:e={},componentsConfig:t={},installedComponents:r=[],iconLibrary:i,framework:n="react"}={}){if(e.base==="shadcn")return pJ(e,i);let{byFamily:o,fonts:a,animations:s}=aJ(e),c=[...new Set(Object.keys(t).map(HE))].sort(),u=[...new Set(r)].filter(f=>c.includes(f)).sort(),d=[...o.entries()].sort(([f],[p])=>f.localeCompare(p)).flatMap(([f,p])=>{let _=[...p].sort(),h=Ey.filter(y=>_.some(v=>new RegExp(`-${y}(?:-|$)`).test(v)));return[`### ${f}`,"",nJ[f]||`Semantic ${f} roles defined by this design system.`,"",`Steps present: ${gi(h)}`,"",gi(_),""]});return["<!-- Generated by Frontfriend. Read-only: hand edits are overwritten by `frontfriend init` and `frontfriend design sync`. Commit this file to git. -->","","# Frontfriend foundation","","Read this file before writing or changing UI. Use only the concrete semantic classes listed below; never invent token names or write literal color or spacing values.","","## Static grammar","","- Shape: `{utility}-{family}-{step}[-{state}]`.","- Utility prefixes: `bg-`, `text-`, `border-`, `icon-`, `text-icon-`.",`- Steps: ${gi(Ey)}.`,`- States: ${gi(rJ)}. State variants may wrap a class, for example \`hover:bg-brand-mid-hover\`.`,"- Surfaces use `bg-layer-*`; scrims use `bg-overlay-*`.","- Fonts use `font-*`; animations use `animate-*`.","- Spacing, type scale, radius, shadows, blur, easing and breakpoints are standard Tailwind utilities (`p-4`, `text-sm`, `shadow-md`, `md:`) that resolve to this design system's values.","- Layout widths, gutters, opacity, border widths and durations are variables: write `max-w-(--max-width-content)`, `opacity-(--opacity-disabled)`, `duration-(--duration-normal)`.","","### shadcn to Frontfriend mapping","","| shadcn token | Frontfriend semantic token |","|---|---|",...iJ.map(([f,p])=>`| \`${f}\` | \`${p}\` |`),"","Keep the utility prefix when translating, such as `bg-primary` to `bg-brand-mid`.","","## This design system","","### Semantic class vocabulary","",...d,"### Fonts","",gi(a),"","### Animations","",gi(s),"","### Icons","",`Icon library: \`${i||"lucide"}\`. Import \`Icon\` from the installed \`@/components/ui/icon\` component and use it as \`<Icon name="Check" />\`. Do not import the icon library directly. Icon names must come from the active library.`,"","### Components","",`Framework: \`${n}\`.`,"",`Installed: ${gi(u)}`,"",`Available: ${gi(c)}`,"",...sJ()].join(`
|
|
33
33
|
`)}function mJ(e,t={}){let r=["components/ui","src/components/ui"],i=t.aliases?.ui;if(i){let n=i.replace(/^[@~]\//,"");r.unshift(n,Vu.join("src",n))}return[...new Set(r.map(n=>Vu.join(e,n)))]}var JE=/\.(?:[jt]sx?|vue)$/;function hJ(e,t={}){let r=new Set;for(let i of mJ(e,t))if(zu.existsSync(i))for(let n of zu.readdirSync(i,{withFileTypes:!0}))n.isDirectory()?r.add(n.name):n.isFile()&&JE.test(n.name)&&r.add(n.name.replace(JE,""));return[...r].map(HE).sort()}function KE(e,t){if(t?.iconLibrary||t?.processedData?.base!=="shadcn")return t?.iconLibrary;try{let r=JSON.parse(zu.readFileSync(Vu.join(e,"components.json"),"utf8")).iconLibrary;if(typeof r=="string"&&r.trim())return r.trim()}catch{}return t.processedData.iconLibrary}function gJ(e,t){let r=Vu.join(e,ZE),i=BE({...t,iconLibrary:KE(e,t)});return zu.mkdirSync(Vu.dirname(r),{recursive:!0}),zu.writeFileSync(r,i),r}WE.exports={FOUNDATION_PATH:ZE,nativeIconLibrary:KE,renderFoundation:BE,findInstalledComponents:hJ,writeFoundation:gJ}});var YE=Ve(()=>{"use strict"});function Gd(e){let t=[],r=0,i;for(let o of e.match(/[^\n]*\n|[^\n]+$/g)??[]){let a=o.match(/^ {0,3}(`{3,}|~{3,})(.*)/);if(i)a&&a[1][0]===i.char&&a[1].length>=i.length&&!a[2].trim()&&(i=void 0);else if(a)i={char:a[1][0],length:a[1].length};else{let s=o.match(/^##[ \t]+(.+?)[ \t]*\r?\n?$/)?.[1];s&&t.push({heading:s,start:r})}r+=o.length}return t.map((o,a)=>({...o,end:t[a+1]?.start??e.length}))}var XE=Ve(()=>{"use strict"});function SJ(e){return Fu.find(t=>t.slug===e)}function wJ(e){return Oy.get(Py(_J(e)))}function RJ(e){return e.match(vJ)?.[1]}function EJ(e){let t=SJ(e);return t?t.title:e.replace(/^guidelines\//,"").replace(/\.md$/,"").replace(/^custom-/,"").split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" ")}function PJ(e,t){let r=e.slice(t.start,t.end).split(/\r?\n/),i=r[1]!==void 0?RJ(r[1]):void 0;return i||wJ(t.heading)?.slug}function eP(e){let t=Fu.findIndex(r=>r.slug===e);return t<0?Fu.length:t}function rP(e){return Object.keys(e).filter(t=>bJ(t)).sort((t,r)=>eP(t)-eP(r)||t.localeCompare(r))}function OJ(e){let t=e[Yd]!==void 0?Yd:tP,r=e[t]??"",i=new Set(rP(e)),n=r;for(let o of[...Gd(r)].reverse()){let a=PJ(r,o);a&&i.has(a)&&(n=n.slice(0,o.start)+n.slice(o.end))}return{slug:t,body:n}}function nP(e){let{parts:t,sections:r}=IJ(e);return{body:t.join(""),sections:r}}function IJ(e,t=!0){let r=rP(e),i=e[Yd]!==void 0?Yd:tP,n=e[i]??"",o=Gd(n),a=OJ(e).body,s=[];if(!r.length)return{parts:[n],sections:o.map(h=>({heading:h.heading,slug:i}))};let c=Gd(a),u=a.slice(0,c[0]?.start??a.length),d=c.map(h=>a.slice(h.start,h.end));for(let h of c)s.push({heading:h.heading,slug:i});let f=[],p=[];for(let h of r){let v=(e[h]??"").trimEnd().split(`
|
|
34
34
|
`),g=v.findIndex(m=>/^##\s+/.test(m)),w=g>=0?v[g].replace(/^##\s+/,"").trim():EJ(h),$=g>=0?v.slice(g):[`## ${w}`,...v];t&&$.splice(1,0,$J(h)),f.push(QE($.join(`
|
|
35
35
|
`))),p.push({heading:w,slug:h})}return{parts:[u.trim()?QE(u):u,...f,...d],sections:[...p,...s]}}var Yd,tP,yJ,vJ,Fu,Py,_J,Oy,bJ,$J,QE,iP=Ve(()=>{"use strict";YE();XE();Yd="design-context.md",tP="design-guidelines.md",yJ=/^guidelines\/custom-[a-z0-9]+(?:-[a-z0-9]+)*\.md$/,vJ=/^\s*<!--\s*ff:chapter=([^\s>]+)\s*-->\s*$/,Fu=[{code:"NST",area:"north-star",slug:"guidelines/north-star.md",title:"North Star",aliases:[]},{code:"COL",area:"color",slug:"guidelines/color.md",title:"Color",aliases:["Colour","Colors","Colours"]},{code:"TYP",area:"typography",slug:"guidelines/typography.md",title:"Typography",aliases:["Type"]},{code:"SPC",area:"spacing",slug:"guidelines/spacing.md",title:"Spacing & sizing",aliases:["Spacing","Spacing and sizing","Sizing"]},{code:"SHP",area:"shape",slug:"guidelines/shape.md",title:"Shape & elevation",aliases:["Shape","Shape and elevation","Radius & elevation","Elevation","Shadows","Radius"]},{code:"ICO",area:"iconography",slug:"guidelines/iconography.md",title:"Iconography",aliases:["Icons","Icon"]},{code:"NAV",area:"navigation",slug:"guidelines/navigation.md",title:"Navigation & structure",aliases:["Navigation","Navigation and structure"]},{code:"FRM",area:"forms",slug:"guidelines/forms.md",title:"Forms",aliases:["Form"]},{code:"FBK",area:"feedback",slug:"guidelines/feedback.md",title:"Feedback & states",aliases:["Feedback","Feedback and states","States"]},{code:"VOX",area:"voice",slug:"guidelines/voice.md",title:"Language & voice",aliases:["Language and voice","Voice & tone","Voice and tone","Voice"]},{code:"TRM",area:"terminology",slug:"guidelines/terminology.md",title:"Terminology",aliases:["Glossary"]},{code:"A11Y",area:"accessibility",slug:"guidelines/accessibility.md",title:"Accessibility",aliases:["A11y"]},{code:"ANT",area:"anti-patterns",slug:"guidelines/anti-patterns.md",title:"Anti-patterns",aliases:["Anti patterns","Antipatterns","Do & Don't","Do and Don't"]}],Py=e=>e.toLowerCase().replace(/[`*_]/g,"").replace(/\band\b/g,"&").replace(/[^a-z0-9&]+/g," ").trim(),_J=e=>String(e||"").replace(/^\s*(?:§\s*)?\d+(?:\.\d+)*[.)]?\s+/,"").trim(),Oy=new Map;for(let e of Fu){Oy.set(Py(e.title),e);for(let t of e.aliases)Oy.set(Py(t),e)}bJ=e=>Fu.some(t=>t.slug===e)||yJ.test(String(e||""));$J=e=>`<!-- ff:chapter=${e} -->`;QE=e=>`${e.trimEnd()}
|
package/dist/next.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var w=(r,i)=>()=>(i||r((i={exports:{}}).exports,i),i.exports);var gr=w((Lf,Oo)=>{Oo.exports={name:"@frontfriend/sdk",version:"1.
|
|
1
|
+
var w=(r,i)=>()=>(i||r((i={exports:{}}).exports,i),i.exports);var gr=w((Lf,Oo)=>{Oo.exports={name:"@frontfriend/sdk",version:"1.3.0"}});var yr=w((Of,vr)=>{var{name:Vo}=gr();vr.exports={PACKAGE_NAME:Vo}});var Me=w((Vf,Er)=>{var Fo="https://app.frontfriend.dev",Do=".cache/frontfriend",$o={JS:["tokens.js","variables.js","semanticVariables.js","semanticDarkVariables.js","keyframes.js","animations.js","safelist.js","custom.js"],JSON:["fonts.json","icons.json","components-config.json","iconLibrary.json","version.json","versionMetadata.json","metadata.json","base.json","nativeTokens.json"]},qo={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_AUTH_TOKEN:"FF_AUTH_TOKEN",FF_MACHINE_TOKEN:"FRONTFRIEND_MACHINE_TOKEN"};function jo(r){if(!r)return null;try{let i=new URL(r);return i.hostname.startsWith("app.")?`${i.protocol}//${i.hostname.replace(/^app\./,"registry.")}`:null}catch{return null}}Er.exports={DEFAULT_API_URL:Fo,CACHE_DIR_NAME:Do,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:$o,ENV_VARS:qo,deriveRegistryFromApiUrl:jo}});var Sr=w((Ff,br)=>{var qt=class extends Error{constructor(i,n,o){super(i),this.name="APIError",this.statusCode=n,this.url=o,this.code=`API_${n}`}},jt=class extends Error{constructor(i,n){super(i),this.name="CacheError",this.operation=n,this.code=`CACHE_${n.toUpperCase()}`}},Bt=class extends Error{constructor(i,n){super(i),this.name="ConfigError",this.field=n,this.code=n?`CONFIG_${String(n).toUpperCase()}`:"CONFIG_ERROR"}},Ut=class extends Error{constructor(i,n){super(i),this.name="ProcessingError",this.token=n,this.code="PROCESSING_ERROR"}};br.exports={APIError:qt,CacheError:jt,ConfigError:Bt,ProcessingError:Ut}});var Ge=w((Df,wr)=>{var j=require("fs");function Bo(r){try{let i=j.readFileSync(r,"utf8");return JSON.parse(i)}catch(i){if(i.code==="ENOENT")return null;throw i}}function Uo(r){try{return j.readFileSync(r,"utf8").replace(/^\uFEFF/,"")}catch(i){if(i.code==="ENOENT")return null;throw i}}function Mo(r,i,n=2){let o=JSON.stringify(i,null,n);j.writeFileSync(r,o,"utf8")}function Go(r,i){j.writeFileSync(r,i,"utf8")}function Ho(r,i){if(i==null||typeof i=="object"&&Object.keys(i).length===0||Array.isArray(i)&&i.length===0){let o=`module.exports = ${Array.isArray(i)?"[]":"{}"};`;j.writeFileSync(r,o,"utf8")}else{let n=`module.exports = ${JSON.stringify(i,null,2)};`;j.writeFileSync(r,n,"utf8")}}function Wo(r){return j.existsSync(r)}function Xo(r){j.mkdirSync(r,{recursive:!0})}function zo(r){j.rmSync(r,{recursive:!0,force:!0})}function Ko(r){j.rmSync(r,{force:!0})}function Yo(r,i){j.mkdirSync(require("path").dirname(r),{recursive:!0,mode:448});let n=`${r}.${process.pid}.${Date.now()}.tmp`;try{j.writeFileSync(n,`${JSON.stringify(i,null,2)}
|
|
2
2
|
`,{mode:384}),j.renameSync(n,r);try{j.chmodSync(r,384)}catch{}}finally{j.rmSync(n,{force:!0})}}async function Jo(r,i,n){j.mkdirSync(require("path").dirname(r),{recursive:!0,mode:448});let o=`${r}.lock`,l=Date.now()+2e4,h;for(;h===void 0;)try{h=j.openSync(o,"wx",384),j.writeFileSync(h,String(process.pid))}catch(f){if(f.code!=="EEXIST")throw f;try{let m=Number(j.readFileSync(o,"utf8"));if(Number.isInteger(m)&&m>0)try{process.kill(m,0)}catch(y){if(y.code==="ESRCH"){j.unlinkSync(o);continue}}}catch(m){if(m.code==="ENOENT")continue}if(Date.now()>=l)throw n();await new Promise(m=>setTimeout(m,50))}try{return await i()}finally{j.closeSync(h),j.unlinkSync(o)}}wr.exports={writePrivateJsonFileAtomic:Yo,withPrivateFileLock:Jo,readJsonFileSafe:Bo,readFileSafe:Uo,writeJsonFile:Mo,writeTextFile:Go,writeModuleExportsFile:Ho,fileExists:Wo,ensureDirectoryExists:Xo,removeDirectory:zo,removeFile:Ko}});var _r=w(($f,Cr)=>{var Qo="classes.txt",Zo="classes.css";Cr.exports={CLASSES_SOURCE_FILE:Qo,CSS_CLASSES_SOURCE_FILE:Zo}});var Pr=w((qf,Rr)=>{var Q=require("path"),{CACHE_DIR_NAME:eu,CACHE_TTL_MS:tu,CACHE_FILES:Ir}=Me(),{CacheError:Mt}=Sr(),{readJsonFileSafe:ut,readFileSafe:iu,writeJsonFile:kr,writeTextFile:Ar,writeModuleExportsFile:Nr,fileExists:Gt,ensureDirectoryExists:ru,removeDirectory:su,removeFile:nu}=Ge(),{CLASSES_SOURCE_FILE:au,CSS_CLASSES_SOURCE_FILE:ou}=_r(),Ht=class r{constructor(i=process.cwd()){this.appRoot=i,this.cacheDir=Q.join(i,"node_modules",eu),this.metadataFile=Q.join(this.cacheDir,"metadata.json"),this.maxAge=tu}getCacheDir(){return this.cacheDir}isLocalOnly(){return ut(this.metadataFile)?.version==="local-components"}getIconLibrary(){let i=Q.join(this.cacheDir,"iconLibrary.json");return Gt(i)?ut(i):null}exists(){return Gt(this.cacheDir)}isValid(){if(!this.exists())return!1;try{let i=ut(this.metadataFile);if(!i)return!1;let n=new Date(i.timestamp).getTime();return Date.now()-n<this.maxAge}catch{return!1}}load(){if(!this.exists())return null;try{let i={};for(let n of Ir.JS){let o=Q.join(this.cacheDir,n);if(Gt(o)){let l=n.replace(".js","");try{let h=iu(o);if(h!==null){let f={},m={exports:f};new Function("module","exports",h)(m,f),i[l]=m.exports}}catch(h){console.warn(`[Frontfriend] Failed to load ${n}: ${h.message}`),(h.message.includes("Unexpected token")||h.message.includes("Invalid character"))&&console.warn("[Frontfriend] This might be a BOM or encoding issue. Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again.")}}}for(let n of Ir.JSON){let o=Q.join(this.cacheDir,n),l=n.replace(".json",""),h=ut(o);h!==null&&(i[l]=h)}return i["components-config"]&&(i.componentsConfig=i["components-config"],delete i["components-config"]),i.cls&&!i.safelist&&(i.safelist=i.cls,delete i.cls),i}catch(i){throw new Mt(`Failed to load cache: ${i.message}`,"read")}}save(i){try{ru(this.cacheDir);let n={timestamp:new Date().toISOString(),version:i.metadata?.version||"2.0.0",ffId:i.metadata?.ffId},o=["tokens","variables","semanticVariables","semanticDarkVariables","keyframes","animations","safelist","custom"];for(let h of o)if(i[h]!==void 0){let f=Q.join(this.cacheDir,`${h}.js`);Nr(f,i[h])}if(i.safelist&&Array.isArray(i.safelist)){let h=Q.join(this.cacheDir,"safelist.js");Nr(h,i.safelist)}let l={fonts:i.fonts,icons:i.icons||i.iconSet,"components-config":i.componentsConfig,iconLibrary:i.iconLibrary,version:i.version,versionMetadata:i.versionMetadata,base:i.base,nativeTokens:i.nativeTokens};for(let[h,f]of Object.entries(l))if(f!==void 0){let m=Q.join(this.cacheDir,`${h}.json`);kr(m,f)}i.themeCSS!==void 0&&Ar(Q.join(this.cacheDir,"theme.css"),i.themeCSS),i.classesContent!==void 0&&(Ar(Q.join(this.cacheDir,au),i.classesContent),nu(Q.join(this.cacheDir,ou))),kr(this.metadataFile,n)}catch(n){throw new Mt(`Failed to save cache: ${n.message}`,"write")}}saveAtomic(i,n=()=>{}){let o=require("node:fs"),{randomUUID:l}=require("node:crypto");o.mkdirSync(Q.dirname(this.cacheDir),{recursive:!0});let h=`${this.cacheDir}.write-lock`,f;try{f=o.openSync(h,"wx")}catch(x){if(x.code!=="EEXIST")throw x;let I=Number(o.readFileSync(h,"utf8")),g=!0;if(I>0)try{process.kill(I,0)}catch(S){g=S.code!=="ESRCH"}if(g)throw new Mt("Another process is installing tokens. Retry after it completes.","write");o.unlinkSync(h),f=o.openSync(h,"wx")}let m=`${this.cacheDir}.previous`,y=`${this.cacheDir}.${l()}.pending`;try{o.writeFileSync(f,String(process.pid)),!o.existsSync(this.cacheDir)&&o.existsSync(m)&&o.renameSync(m,this.cacheDir);let x=new r(this.appRoot);x.cacheDir=y,x.metadataFile=Q.join(y,"metadata.json"),x.save(i),o.existsSync(m)&&o.rmSync(m,{recursive:!0}),o.existsSync(this.cacheDir)&&o.renameSync(this.cacheDir,m);try{o.renameSync(y,this.cacheDir),n()}catch(I){throw o.rmSync(this.cacheDir,{recursive:!0,force:!0}),o.existsSync(m)&&o.renameSync(m,this.cacheDir),I}o.rmSync(m,{recursive:!0,force:!0})}finally{o.rmSync(y,{recursive:!0,force:!0}),o.closeSync(f),o.rmSync(h,{force:!0})}}clear(){this.exists()&&su(this.cacheDir)}};Rr.exports=Ht});var Vr=w((jf,Or)=>{function pe(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function Wt(r,i){if(!pe(r)||!pe(i))return i===void 0?r:i;let n={...r};for(let[o,l]of Object.entries(i))n[o]=o in n?Wt(n[o],l):l;return n}function Xt(r,i,n=[],o=[]){if(r===void 0||i===void 0)return o;if(!pe(r)||!pe(i))return o.push(n.join(".")),o;for(let l of Object.keys(r))l in i&&Xt(r[l],i[l],[...n,l],o);return o}function Tr(r){return pe(r)&&("styles"in r||"behavior"in r)}function Lr(r,i="component"){if(!Tr(r)||!pe(r.styles)||r.behavior!==void 0&&!pe(r.behavior)||Object.keys(r).some(o=>!["styles","behavior"].includes(o)))throw new TypeError(`Component ${i} must use the styles/behavior envelope`);let n=Xt(r.styles,r.behavior,[i]);if(n.length>0)throw new Error(`Component config styles/behavior conflict at ${n.join(", ")}`);return Wt(r.styles||{},r.behavior||{})}function uu(r){if(!pe(r))return r;let i=!1,n={};for(let[o,l]of Object.entries(r))n[o]=Lr(l,o),n[o]!==l&&(i=!0);return i?n:r}Or.exports={isPlainObject:pe,deepMerge:Wt,findTreeConflicts:Xt,isComponentEnvelope:Tr,toRuntimeComponentConfig:Lr,toRuntimeComponentsConfig:uu}});var jr=w((Bf,qr)=>{qr.exports=$r;$r.sync=hu;var Fr=require("fs");function cu(r,i){var n=i.pathExt!==void 0?i.pathExt:process.env.PATHEXT;if(!n||(n=n.split(";"),n.indexOf("")!==-1))return!0;for(var o=0;o<n.length;o++){var l=n[o].toLowerCase();if(l&&r.substr(-l.length).toLowerCase()===l)return!0}return!1}function Dr(r,i,n){return!r.isSymbolicLink()&&!r.isFile()?!1:cu(i,n)}function $r(r,i,n){Fr.stat(r,function(o,l){n(o,o?!1:Dr(l,r,i))})}function hu(r,i){return Dr(Fr.statSync(r),r,i)}});var Hr=w((Uf,Gr)=>{Gr.exports=Ur;Ur.sync=lu;var Br=require("fs");function Ur(r,i,n){Br.stat(r,function(o,l){n(o,o?!1:Mr(l,i))})}function lu(r,i){return Mr(Br.statSync(r),i)}function Mr(r,i){return r.isFile()&&fu(r,i)}function fu(r,i){var n=r.mode,o=r.uid,l=r.gid,h=i.uid!==void 0?i.uid:process.getuid&&process.getuid(),f=i.gid!==void 0?i.gid:process.getgid&&process.getgid(),m=parseInt("100",8),y=parseInt("010",8),x=parseInt("001",8),I=m|y,g=n&x||n&y&&l===f||n&m&&o===h||n&I&&h===0;return g}});var Xr=w((Gf,Wr)=>{var Mf=require("fs"),ct;process.platform==="win32"||global.TESTING_WINDOWS?ct=jr():ct=Hr();Wr.exports=zt;zt.sync=pu;function zt(r,i,n){if(typeof i=="function"&&(n=i,i={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,l){zt(r,i||{},function(h,f){h?l(h):o(f)})})}ct(r,i||{},function(o,l){o&&(o.code==="EACCES"||i&&i.ignoreErrors)&&(o=null,l=!1),n(o,l)})}function pu(r,i){try{return ct.sync(r,i||{})}catch(n){if(i&&i.ignoreErrors||n.code==="EACCES")return!1;throw n}}});var es=w((Hf,Zr)=>{var Re=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",zr=require("path"),du=Re?";":":",Kr=Xr(),Yr=r=>Object.assign(new Error(`not found: ${r}`),{code:"ENOENT"}),Jr=(r,i)=>{let n=i.colon||du,o=r.match(/\//)||Re&&r.match(/\\/)?[""]:[...Re?[process.cwd()]:[],...(i.path||process.env.PATH||"").split(n)],l=Re?i.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",h=Re?l.split(n):[""];return Re&&r.indexOf(".")!==-1&&h[0]!==""&&h.unshift(""),{pathEnv:o,pathExt:h,pathExtExe:l}},Qr=(r,i,n)=>{typeof i=="function"&&(n=i,i={}),i||(i={});let{pathEnv:o,pathExt:l,pathExtExe:h}=Jr(r,i),f=[],m=x=>new Promise((I,g)=>{if(x===o.length)return i.all&&f.length?I(f):g(Yr(r));let S=o[x],E=/^".*"$/.test(S)?S.slice(1,-1):S,N=zr.join(E,r),B=!E&&/^\.[\\\/]/.test(r)?r.slice(0,2)+N:N;I(y(B,x,0))}),y=(x,I,g)=>new Promise((S,E)=>{if(g===l.length)return S(m(I+1));let N=l[g];Kr(x+N,{pathExt:h},(B,Y)=>{if(!B&&Y)if(i.all)f.push(x+N);else return S(x+N);return S(y(x,I,g+1))})});return n?m(0).then(x=>n(null,x),n):m(0)},mu=(r,i)=>{i=i||{};let{pathEnv:n,pathExt:o,pathExtExe:l}=Jr(r,i),h=[];for(let f=0;f<n.length;f++){let m=n[f],y=/^".*"$/.test(m)?m.slice(1,-1):m,x=zr.join(y,r),I=!y&&/^\.[\\\/]/.test(r)?r.slice(0,2)+x:x;for(let g=0;g<o.length;g++){let S=I+o[g];try{if(Kr.sync(S,{pathExt:l}))if(i.all)h.push(S);else return S}catch{}}}if(i.all&&h.length)return h;if(i.nothrow)return null;throw Yr(r)};Zr.exports=Qr;Qr.sync=mu});var is=w((Wf,Kt)=>{"use strict";var ts=(r={})=>{let i=r.env||process.env;return(r.platform||process.platform)!=="win32"?"PATH":Object.keys(i).reverse().find(o=>o.toUpperCase()==="PATH")||"Path"};Kt.exports=ts;Kt.exports.default=ts});var as=w((Xf,ns)=>{"use strict";var rs=require("path"),xu=es(),gu=is();function ss(r,i){let n=r.options.env||process.env,o=process.cwd(),l=r.options.cwd!=null,h=l&&process.chdir!==void 0&&!process.chdir.disabled;if(h)try{process.chdir(r.options.cwd)}catch{}let f;try{f=xu.sync(r.command,{path:n[gu({env:n})],pathExt:i?rs.delimiter:void 0})}catch{}finally{h&&process.chdir(o)}return f&&(f=rs.resolve(l?r.options.cwd:"",f)),f}function vu(r){return ss(r)||ss(r,!0)}ns.exports=vu});var os=w((zf,Jt)=>{"use strict";var Yt=/([()\][%!^"`<>&|;, *?])/g;function yu(r){return r=r.replace(Yt,"^$1"),r}function Eu(r,i){return r=`${r}`,r=r.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),r=r.replace(/(?=(\\+?)?)\1$/,"$1$1"),r=`"${r}"`,r=r.replace(Yt,"^$1"),i&&(r=r.replace(Yt,"^$1")),r}Jt.exports.command=yu;Jt.exports.argument=Eu});var cs=w((Kf,us)=>{"use strict";us.exports=/^#!(.*)/});var ls=w((Yf,hs)=>{"use strict";var bu=cs();hs.exports=(r="")=>{let i=r.match(bu);if(!i)return null;let[n,o]=i[0].replace(/#! ?/,"").split(" "),l=n.split("/").pop();return l==="env"?o:o?`${l} ${o}`:l}});var ps=w((Jf,fs)=>{"use strict";var Qt=require("fs"),Su=ls();function wu(r){let n=Buffer.alloc(150),o;try{o=Qt.openSync(r,"r"),Qt.readSync(o,n,0,150,0),Qt.closeSync(o)}catch{}return Su(n.toString())}fs.exports=wu});var gs=w((Qf,xs)=>{"use strict";var Cu=require("path"),ds=as(),ms=os(),_u=ps(),Iu=process.platform==="win32",ku=/\.(?:com|exe)$/i,Au=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Nu(r){r.file=ds(r);let i=r.file&&_u(r.file);return i?(r.args.unshift(r.file),r.command=i,ds(r)):r.file}function Ru(r){if(!Iu)return r;let i=Nu(r),n=!ku.test(i);if(r.options.forceShell||n){let o=Au.test(i);r.command=Cu.normalize(r.command),r.command=ms.command(r.command),r.args=r.args.map(h=>ms.argument(h,o));let l=[r.command].concat(r.args).join(" ");r.args=["/d","/s","/c",`"${l}"`],r.command=process.env.comspec||"cmd.exe",r.options.windowsVerbatimArguments=!0}return r}function Pu(r,i,n){i&&!Array.isArray(i)&&(n=i,i=null),i=i?i.slice(0):[],n=Object.assign({},n);let o={command:r,args:i,options:n,file:void 0,original:{command:r,args:i}};return n.shell?o:Ru(o)}xs.exports=Pu});var Es=w((Zf,ys)=>{"use strict";var Zt=process.platform==="win32";function ei(r,i){return Object.assign(new Error(`${i} ${r.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${i} ${r.command}`,path:r.command,spawnargs:r.args})}function Tu(r,i){if(!Zt)return;let n=r.emit;r.emit=function(o,l){if(o==="exit"){let h=vs(l,i);if(h)return n.call(r,"error",h)}return n.apply(r,arguments)}}function vs(r,i){return Zt&&r===1&&!i.file?ei(i.original,"spawn"):null}function Lu(r,i){return Zt&&r===1&&!i.file?ei(i.original,"spawnSync"):null}ys.exports={hookChildProcess:Tu,verifyENOENT:vs,verifyENOENTSync:Lu,notFoundError:ei}});var ws=w((ep,Pe)=>{"use strict";var bs=require("child_process"),ti=gs(),ii=Es();function Ss(r,i,n){let o=ti(r,i,n),l=bs.spawn(o.command,o.args,o.options);return ii.hookChildProcess(l,o),l}function Ou(r,i,n){let o=ti(r,i,n),l=bs.spawnSync(o.command,o.args,o.options);return l.error=l.error||ii.verifyENOENTSync(l.status,o),l}Pe.exports=Ss;Pe.exports.spawn=Ss;Pe.exports.sync=Ou;Pe.exports._parse=ti;Pe.exports._enoent=ii});var Te=w((tp,Cs)=>{"use strict";var Vu="2.0.0",Fu=Number.MAX_SAFE_INTEGER||9007199254740991,Du=16,$u=250,qu=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Cs.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Du,MAX_SAFE_BUILD_LENGTH:$u,MAX_SAFE_INTEGER:Fu,RELEASE_TYPES:qu,SEMVER_SPEC_VERSION:Vu,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var He=w((ip,_s)=>{"use strict";var ju=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};_s.exports=ju});var Le=w((ue,Is)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:ri,MAX_SAFE_BUILD_LENGTH:Bu,MAX_LENGTH:Uu}=Te(),Mu=He();ue=Is.exports={};var Gu=ue.re=[],Hu=ue.safeRe=[],C=ue.src=[],Wu=ue.safeSrc=[],_=ue.t={},Xu=0,si="[a-zA-Z0-9-]",zu=[["\\s",1],["\\d",Uu],[si,Bu]],Ku=r=>{for(let[i,n]of zu)r=r.split(`${i}*`).join(`${i}{0,${n}}`).split(`${i}+`).join(`${i}{1,${n}}`);return r},T=(r,i,n)=>{let o=Ku(i),l=Xu++;Mu(r,l,i),_[r]=l,C[l]=i,Wu[l]=o,Gu[l]=new RegExp(i,n?"g":void 0),Hu[l]=new RegExp(o,n?"g":void 0)};T("NUMERICIDENTIFIER","0|[1-9]\\d*");T("NUMERICIDENTIFIERLOOSE","\\d+");T("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${si}*`);T("MAINVERSION",`(${C[_.NUMERICIDENTIFIER]})\\.(${C[_.NUMERICIDENTIFIER]})\\.(${C[_.NUMERICIDENTIFIER]})`);T("MAINVERSIONLOOSE",`(${C[_.NUMERICIDENTIFIERLOOSE]})\\.(${C[_.NUMERICIDENTIFIERLOOSE]})\\.(${C[_.NUMERICIDENTIFIERLOOSE]})`);T("PRERELEASEIDENTIFIER",`(?:${C[_.NONNUMERICIDENTIFIER]}|${C[_.NUMERICIDENTIFIER]})`);T("PRERELEASEIDENTIFIERLOOSE",`(?:${C[_.NONNUMERICIDENTIFIER]}|${C[_.NUMERICIDENTIFIERLOOSE]})`);T("PRERELEASE",`(?:-(${C[_.PRERELEASEIDENTIFIER]}(?:\\.${C[_.PRERELEASEIDENTIFIER]})*))`);T("PRERELEASELOOSE",`(?:-?(${C[_.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${C[_.PRERELEASEIDENTIFIERLOOSE]})*))`);T("BUILDIDENTIFIER",`${si}+`);T("BUILD",`(?:\\+(${C[_.BUILDIDENTIFIER]}(?:\\.${C[_.BUILDIDENTIFIER]})*))`);T("FULLPLAIN",`v?${C[_.MAINVERSION]}${C[_.PRERELEASE]}?${C[_.BUILD]}?`);T("FULL",`^${C[_.FULLPLAIN]}$`);T("LOOSEPLAIN",`[v=\\s]*${C[_.MAINVERSIONLOOSE]}${C[_.PRERELEASELOOSE]}?${C[_.BUILD]}?`);T("LOOSE",`^${C[_.LOOSEPLAIN]}$`);T("GTLT","((?:<|>)?=?)");T("XRANGEIDENTIFIERLOOSE",`${C[_.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);T("XRANGEIDENTIFIER",`${C[_.NUMERICIDENTIFIER]}|x|X|\\*`);T("XRANGEPLAIN",`[v=\\s]*(${C[_.XRANGEIDENTIFIER]})(?:\\.(${C[_.XRANGEIDENTIFIER]})(?:\\.(${C[_.XRANGEIDENTIFIER]})(?:${C[_.PRERELEASE]})?${C[_.BUILD]}?)?)?`);T("XRANGEPLAINLOOSE",`[v=\\s]*(${C[_.XRANGEIDENTIFIERLOOSE]})(?:\\.(${C[_.XRANGEIDENTIFIERLOOSE]})(?:\\.(${C[_.XRANGEIDENTIFIERLOOSE]})(?:${C[_.PRERELEASELOOSE]})?${C[_.BUILD]}?)?)?`);T("XRANGE",`^${C[_.GTLT]}\\s*${C[_.XRANGEPLAIN]}$`);T("XRANGELOOSE",`^${C[_.GTLT]}\\s*${C[_.XRANGEPLAINLOOSE]}$`);T("COERCEPLAIN",`(^|[^\\d])(\\d{1,${ri}})(?:\\.(\\d{1,${ri}}))?(?:\\.(\\d{1,${ri}}))?`);T("COERCE",`${C[_.COERCEPLAIN]}(?:$|[^\\d])`);T("COERCEFULL",C[_.COERCEPLAIN]+`(?:${C[_.PRERELEASE]})?(?:${C[_.BUILD]})?(?:$|[^\\d])`);T("COERCERTL",C[_.COERCE],!0);T("COERCERTLFULL",C[_.COERCEFULL],!0);T("LONETILDE","(?:~>?)");T("TILDETRIM",`(\\s*)${C[_.LONETILDE]}\\s+`,!0);ue.tildeTrimReplace="$1~";T("TILDE",`^${C[_.LONETILDE]}${C[_.XRANGEPLAIN]}$`);T("TILDELOOSE",`^${C[_.LONETILDE]}${C[_.XRANGEPLAINLOOSE]}$`);T("LONECARET","(?:\\^)");T("CARETTRIM",`(\\s*)${C[_.LONECARET]}\\s+`,!0);ue.caretTrimReplace="$1^";T("CARET",`^${C[_.LONECARET]}${C[_.XRANGEPLAIN]}$`);T("CARETLOOSE",`^${C[_.LONECARET]}${C[_.XRANGEPLAINLOOSE]}$`);T("COMPARATORLOOSE",`^${C[_.GTLT]}\\s*(${C[_.LOOSEPLAIN]})$|^$`);T("COMPARATOR",`^${C[_.GTLT]}\\s*(${C[_.FULLPLAIN]})$|^$`);T("COMPARATORTRIM",`(\\s*)${C[_.GTLT]}\\s*(${C[_.LOOSEPLAIN]}|${C[_.XRANGEPLAIN]})`,!0);ue.comparatorTrimReplace="$1$2$3";T("HYPHENRANGE",`^\\s*(${C[_.XRANGEPLAIN]})\\s+-\\s+(${C[_.XRANGEPLAIN]})\\s*$`);T("HYPHENRANGELOOSE",`^\\s*(${C[_.XRANGEPLAINLOOSE]})\\s+-\\s+(${C[_.XRANGEPLAINLOOSE]})\\s*$`);T("STAR","(<|>)?=?\\s*\\*");T("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");T("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var ht=w((rp,ks)=>{"use strict";var Yu=Object.freeze({loose:!0}),Ju=Object.freeze({}),Qu=r=>r?typeof r!="object"?Yu:r:Ju;ks.exports=Qu});var ni=w((sp,Rs)=>{"use strict";var As=/^[0-9]+$/,Ns=(r,i)=>{if(typeof r=="number"&&typeof i=="number")return r===i?0:r<i?-1:1;let n=As.test(r),o=As.test(i);return n&&o&&(r=+r,i=+i),r===i?0:n&&!o?-1:o&&!n?1:r<i?-1:1},Zu=(r,i)=>Ns(i,r);Rs.exports={compareIdentifiers:Ns,rcompareIdentifiers:Zu}});var G=w((np,Ts)=>{"use strict";var lt=He(),{MAX_LENGTH:Ps,MAX_SAFE_INTEGER:ft}=Te(),{safeRe:pt,t:dt}=Le(),ec=ht(),{compareIdentifiers:ai}=ni(),tc=(r,i)=>{let n=i.split(".");if(n.length>r.length)return!1;for(let o=0;o<n.length;o++)if(ai(r[o],n[o])!==0)return!1;return!0},oi=class r{constructor(i,n){if(n=ec(n),i instanceof r){if(i.loose===!!n.loose&&i.includePrerelease===!!n.includePrerelease)return i;i=i.version}else if(typeof i!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof i}".`);if(i.length>Ps)throw new TypeError(`version is longer than ${Ps} characters`);lt("SemVer",i,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let o=i.trim().match(n.loose?pt[dt.LOOSE]:pt[dt.FULL]);if(!o)throw new TypeError(`Invalid Version: ${i}`);if(this.raw=i,this.major=+o[1],this.minor=+o[2],this.patch=+o[3],this.major>ft||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ft||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ft||this.patch<0)throw new TypeError("Invalid patch version");o[4]?this.prerelease=o[4].split(".").map(l=>{if(/^[0-9]+$/.test(l)){let h=+l;if(h>=0&&h<ft)return h}return l}):this.prerelease=[],this.build=o[5]?o[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(i){if(lt("SemVer.compare",this.version,this.options,i),!(i instanceof r)){if(typeof i=="string"&&i===this.version)return 0;i=new r(i,this.options)}return i.version===this.version?0:this.compareMain(i)||this.comparePre(i)}compareMain(i){return i instanceof r||(i=new r(i,this.options)),this.major<i.major?-1:this.major>i.major?1:this.minor<i.minor?-1:this.minor>i.minor?1:this.patch<i.patch?-1:this.patch>i.patch?1:0}comparePre(i){if(i instanceof r||(i=new r(i,this.options)),this.prerelease.length&&!i.prerelease.length)return-1;if(!this.prerelease.length&&i.prerelease.length)return 1;if(!this.prerelease.length&&!i.prerelease.length)return 0;let n=0;do{let o=this.prerelease[n],l=i.prerelease[n];if(lt("prerelease compare",n,o,l),o===void 0&&l===void 0)return 0;if(l===void 0)return 1;if(o===void 0)return-1;if(o===l)continue;return ai(o,l)}while(++n)}compareBuild(i){i instanceof r||(i=new r(i,this.options));let n=0;do{let o=this.build[n],l=i.build[n];if(lt("build compare",n,o,l),o===void 0&&l===void 0)return 0;if(l===void 0)return 1;if(o===void 0)return-1;if(o===l)continue;return ai(o,l)}while(++n)}inc(i,n,o){if(i.startsWith("pre")){if(!n&&o===!1)throw new Error("invalid increment argument: identifier is empty");if(n){let l=`-${n}`.match(this.options.loose?pt[dt.PRERELEASELOOSE]:pt[dt.PRERELEASE]);if(!l||l[1]!==n)throw new Error(`invalid identifier: ${n}`)}}switch(i){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,o);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,o);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,o),this.inc("pre",n,o);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,o),this.inc("pre",n,o);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let l=Number(o)?1:0;if(this.prerelease.length===0)this.prerelease=[l];else{let h=this.prerelease.length;for(;--h>=0;)typeof this.prerelease[h]=="number"&&(this.prerelease[h]++,h=-2);if(h===-1){if(n===this.prerelease.join(".")&&o===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(l)}}if(n){let h=[n,l];if(o===!1&&(h=[n]),tc(this.prerelease,n)){let f=this.prerelease[n.split(".").length];isNaN(f)&&(this.prerelease=h)}else this.prerelease=h}break}default:throw new Error(`invalid increment argument: ${i}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Ts.exports=oi});var ge=w((ap,Os)=>{"use strict";var Ls=G(),ic=(r,i,n=!1)=>{if(r instanceof Ls)return r;try{return new Ls(r,i)}catch(o){if(!n)return null;throw o}};Os.exports=ic});var Fs=w((op,Vs)=>{"use strict";var rc=ge(),sc=(r,i)=>{let n=rc(r,i);return n?n.version:null};Vs.exports=sc});var $s=w((up,Ds)=>{"use strict";var nc=ge(),ac=(r,i)=>{let n=nc(r.trim().replace(/^[=v]+/,""),i);return n?n.version:null};Ds.exports=ac});var Bs=w((cp,js)=>{"use strict";var qs=G(),oc=(r,i,n,o,l)=>{typeof n=="string"&&(l=o,o=n,n=void 0);try{return new qs(r instanceof qs?r.version:r,n).inc(i,o,l).version}catch{return null}};js.exports=oc});var Gs=w((hp,Ms)=>{"use strict";var Us=ge(),uc=(r,i)=>{let n=Us(r,null,!0),o=Us(i,null,!0),l=n.compare(o);if(l===0)return null;let h=l>0,f=h?n:o,m=h?o:n,y=!!f.prerelease.length;if(!!m.prerelease.length&&!y){if(!m.patch&&!m.minor)return"major";if(m.compareMain(f)===0)return m.minor&&!m.patch?"minor":"patch"}let I=y?"pre":"";return n.major!==o.major?I+"major":n.minor!==o.minor?I+"minor":n.patch!==o.patch?I+"patch":"prerelease"};Ms.exports=uc});var Ws=w((lp,Hs)=>{"use strict";var cc=G(),hc=(r,i)=>new cc(r,i).major;Hs.exports=hc});var zs=w((fp,Xs)=>{"use strict";var lc=G(),fc=(r,i)=>new lc(r,i).minor;Xs.exports=fc});var Ys=w((pp,Ks)=>{"use strict";var pc=G(),dc=(r,i)=>new pc(r,i).patch;Ks.exports=dc});var Qs=w((dp,Js)=>{"use strict";var mc=ge(),xc=(r,i)=>{let n=mc(r,i);return n&&n.prerelease.length?n.prerelease:null};Js.exports=xc});var re=w((mp,en)=>{"use strict";var Zs=G(),gc=(r,i,n)=>new Zs(r,n).compare(new Zs(i,n));en.exports=gc});var rn=w((xp,tn)=>{"use strict";var vc=re(),yc=(r,i,n)=>vc(i,r,n);tn.exports=yc});var nn=w((gp,sn)=>{"use strict";var Ec=re(),bc=(r,i)=>Ec(r,i,!0);sn.exports=bc});var mt=w((vp,on)=>{"use strict";var an=G(),Sc=(r,i,n)=>{let o=new an(r,n),l=new an(i,n);return o.compare(l)||o.compareBuild(l)};on.exports=Sc});var cn=w((yp,un)=>{"use strict";var wc=mt(),Cc=(r,i)=>r.sort((n,o)=>wc(n,o,i));un.exports=Cc});var ln=w((Ep,hn)=>{"use strict";var _c=mt(),Ic=(r,i)=>r.sort((n,o)=>_c(o,n,i));hn.exports=Ic});var We=w((bp,fn)=>{"use strict";var kc=re(),Ac=(r,i,n)=>kc(r,i,n)>0;fn.exports=Ac});var xt=w((Sp,pn)=>{"use strict";var Nc=re(),Rc=(r,i,n)=>Nc(r,i,n)<0;pn.exports=Rc});var ui=w((wp,dn)=>{"use strict";var Pc=re(),Tc=(r,i,n)=>Pc(r,i,n)===0;dn.exports=Tc});var ci=w((Cp,mn)=>{"use strict";var Lc=re(),Oc=(r,i,n)=>Lc(r,i,n)!==0;mn.exports=Oc});var gt=w((_p,xn)=>{"use strict";var Vc=re(),Fc=(r,i,n)=>Vc(r,i,n)>=0;xn.exports=Fc});var vt=w((Ip,gn)=>{"use strict";var Dc=re(),$c=(r,i,n)=>Dc(r,i,n)<=0;gn.exports=$c});var hi=w((kp,vn)=>{"use strict";var qc=ui(),jc=ci(),Bc=We(),Uc=gt(),Mc=xt(),Gc=vt(),Hc=(r,i,n,o)=>{switch(i){case"===":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r===n;case"!==":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r!==n;case"":case"=":case"==":return qc(r,n,o);case"!=":return jc(r,n,o);case">":return Bc(r,n,o);case">=":return Uc(r,n,o);case"<":return Mc(r,n,o);case"<=":return Gc(r,n,o);default:throw new TypeError(`Invalid operator: ${i}`)}};vn.exports=Hc});var En=w((Ap,yn)=>{"use strict";var Wc=G(),Xc=ge(),{safeRe:yt,t:Et}=Le(),zc=(r,i)=>{if(r instanceof Wc)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;i=i||{};let n=null;if(!i.rtl)n=r.match(i.includePrerelease?yt[Et.COERCEFULL]:yt[Et.COERCE]);else{let y=i.includePrerelease?yt[Et.COERCERTLFULL]:yt[Et.COERCERTL],x;for(;(x=y.exec(r))&&(!n||n.index+n[0].length!==r.length);)(!n||x.index+x[0].length!==n.index+n[0].length)&&(n=x),y.lastIndex=x.index+x[1].length+x[2].length;y.lastIndex=-1}if(n===null)return null;let o=n[2],l=n[3]||"0",h=n[4]||"0",f=i.includePrerelease&&n[5]?`-${n[5]}`:"",m=i.includePrerelease&&n[6]?`+${n[6]}`:"";return Xc(`${o}.${l}.${h}${f}${m}`,i)};yn.exports=zc});var Sn=w((Np,bn)=>{"use strict";var Kc=ge(),Yc=Te(),Jc=G(),Qc=(r,i,n)=>{if(!Yc.RELEASE_TYPES.includes(i))return null;let o=Zc(r,n);return o&&eh(o,i)},Zc=(r,i)=>{let n=r instanceof Jc?r.version:r;return Kc(n,i)},eh=(r,i)=>{if(th(i))return r.version;switch(r.prerelease=[],i){case"major":r.minor=0,r.patch=0;break;case"minor":r.patch=0;break}return r.format()},th=r=>r.startsWith("pre");bn.exports=Qc});var Cn=w((Rp,wn)=>{"use strict";var li=class{constructor(){this.max=1e3,this.map=new Map}get(i){let n=this.map.get(i);if(n!==void 0)return this.map.delete(i),this.map.set(i,n),n}delete(i){return this.map.delete(i)}set(i,n){if(!this.delete(i)&&n!==void 0){if(this.map.size>=this.max){let l=this.map.keys().next().value;this.delete(l)}this.map.set(i,n)}return this}};wn.exports=li});var se=w((Pp,An)=>{"use strict";var ih=/\s+/g,fi=class r{constructor(i,n){if(n=sh(n),i instanceof r)return i.loose===!!n.loose&&i.includePrerelease===!!n.includePrerelease?i:new r(i.raw,n);if(i instanceof pi)return this.raw=i.value,this.set=[[i]],this.formatted=void 0,this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=i.trim().replace(ih," "),this.set=this.raw.split("||").map(o=>this.parseRange(o.trim())).filter(o=>o.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let o=this.set[0];if(this.set=this.set.filter(l=>!In(l[0])),this.set.length===0)this.set=[o];else if(this.set.length>1){for(let l of this.set)if(l.length===1&&ph(l[0])){this.set=[l];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let i=0;i<this.set.length;i++){i>0&&(this.formatted+="||");let n=this.set[i];for(let o=0;o<n.length;o++)o>0&&(this.formatted+=" "),this.formatted+=n[o].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(i){i=i.replace(fh,"");let o=((this.options.includePrerelease&&hh)|(this.options.loose&&lh))+":"+i,l=_n.get(o);if(l)return l;let h=this.options.loose,f=h?K[H.HYPHENRANGELOOSE]:K[H.HYPHENRANGE];i=i.replace(f,Ch(this.options.includePrerelease)),$("hyphen replace",i),i=i.replace(K[H.COMPARATORTRIM],oh),$("comparator trim",i),i=i.replace(K[H.TILDETRIM],uh),$("tilde trim",i),i=i.replace(K[H.CARETTRIM],ch),$("caret trim",i);let m=i.split(" ").map(g=>dh(g,this.options)).join(" ").split(/\s+/).map(g=>wh(g,this.options));h&&(m=m.filter(g=>($("loose invalid filter",g,this.options),!!g.match(K[H.COMPARATORLOOSE])))),$("range list",m);let y=new Map,x=m.map(g=>new pi(g,this.options));for(let g of x){if(In(g))return[g];y.set(g.value,g)}y.size>1&&y.has("")&&y.delete("");let I=[...y.values()];return _n.set(o,I),I}intersects(i,n){if(!(i instanceof r))throw new TypeError("a Range is required");return this.set.some(o=>kn(o,n)&&i.set.some(l=>kn(l,n)&&o.every(h=>l.every(f=>h.intersects(f,n)))))}test(i){if(!i)return!1;if(typeof i=="string")try{i=new nh(i,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(_h(this.set[n],i,this.options))return!0;return!1}};An.exports=fi;var rh=Cn(),_n=new rh,sh=ht(),pi=Xe(),$=He(),nh=G(),{safeRe:K,src:ah,t:H,comparatorTrimReplace:oh,tildeTrimReplace:uh,caretTrimReplace:ch}=Le(),{FLAG_INCLUDE_PRERELEASE:hh,FLAG_LOOSE:lh}=Te(),fh=new RegExp(ah[H.BUILD],"g"),In=r=>r.value==="<0.0.0-0",ph=r=>r.value==="",kn=(r,i)=>{let n=!0,o=r.slice(),l=o.pop();for(;n&&o.length;)n=o.every(h=>l.intersects(h,i)),l=o.pop();return n},dh=(r,i)=>(r=r.replace(K[H.BUILD],""),$("comp",r,i),r=vh(r,i),$("caret",r),r=xh(r,i),$("tildes",r),r=Eh(r,i),$("xrange",r),r=Sh(r,i),$("stars",r),r),U=r=>!r||r.toLowerCase()==="x"||r==="*",mh=(r,i,n)=>U(r)&&!U(i)||U(i)&&n&&!U(n),xh=(r,i)=>r.trim().split(/\s+/).map(n=>gh(n,i)).join(" "),gh=(r,i)=>{let n=i.loose?K[H.TILDELOOSE]:K[H.TILDE],o=i.includePrerelease?"-0":"";return r.replace(n,(l,h,f,m,y)=>{$("tilde",r,l,h,f,m,y);let x;return U(h)?x="":U(f)?x=`>=${h}.0.0${o} <${+h+1}.0.0-0`:U(m)?x=`>=${h}.${f}.0${o} <${h}.${+f+1}.0-0`:y?($("replaceTilde pr",y),x=`>=${h}.${f}.${m}-${y} <${h}.${+f+1}.0-0`):x=`>=${h}.${f}.${m} <${h}.${+f+1}.0-0`,$("tilde return",x),x})},vh=(r,i)=>r.trim().split(/\s+/).map(n=>yh(n,i)).join(" "),yh=(r,i)=>{$("caret",r,i);let n=i.loose?K[H.CARETLOOSE]:K[H.CARET],o=i.includePrerelease?"-0":"";return r.replace(n,(l,h,f,m,y)=>{$("caret",r,l,h,f,m,y);let x;return U(h)?x="":U(f)?x=`>=${h}.0.0${o} <${+h+1}.0.0-0`:U(m)?h==="0"?x=`>=${h}.${f}.0${o} <${h}.${+f+1}.0-0`:x=`>=${h}.${f}.0${o} <${+h+1}.0.0-0`:y?($("replaceCaret pr",y),h==="0"?f==="0"?x=`>=${h}.${f}.${m}-${y} <${h}.${f}.${+m+1}-0`:x=`>=${h}.${f}.${m}-${y} <${h}.${+f+1}.0-0`:x=`>=${h}.${f}.${m}-${y} <${+h+1}.0.0-0`):($("no pr"),h==="0"?f==="0"?x=`>=${h}.${f}.${m} <${h}.${f}.${+m+1}-0`:x=`>=${h}.${f}.${m} <${h}.${+f+1}.0-0`:x=`>=${h}.${f}.${m} <${+h+1}.0.0-0`),$("caret return",x),x})},Eh=(r,i)=>($("replaceXRanges",r,i),r.split(/\s+/).map(n=>bh(n,i)).join(" ")),bh=(r,i)=>{r=r.trim();let n=i.loose?K[H.XRANGELOOSE]:K[H.XRANGE];return r.replace(n,(o,l,h,f,m,y)=>{if($("xRange",r,o,l,h,f,m,y),mh(h,f,m))return r;let x=U(h),I=x||U(f),g=I||U(m),S=g;return l==="="&&S&&(l=""),y=i.includePrerelease?"-0":"",x?l===">"||l==="<"?o="<0.0.0-0":o="*":l&&S?(I&&(f=0),m=0,l===">"?(l=">=",I?(h=+h+1,f=0,m=0):(f=+f+1,m=0)):l==="<="&&(l="<",I?h=+h+1:f=+f+1),l==="<"&&(y="-0"),o=`${l+h}.${f}.${m}${y}`):I?o=`>=${h}.0.0${y} <${+h+1}.0.0-0`:g&&(o=`>=${h}.${f}.0${y} <${h}.${+f+1}.0-0`),$("xRange return",o),o})},Sh=(r,i)=>($("replaceStars",r,i),r.trim().replace(K[H.STAR],"")),wh=(r,i)=>($("replaceGTE0",r,i),r.trim().replace(K[i.includePrerelease?H.GTE0PRE:H.GTE0],"")),Ch=r=>(i,n,o,l,h,f,m,y,x,I,g,S)=>(U(o)?n="":U(l)?n=`>=${o}.0.0${r?"-0":""}`:U(h)?n=`>=${o}.${l}.0${r?"-0":""}`:f?n=`>=${n}`:n=`>=${n}${r?"-0":""}`,U(x)?y="":U(I)?y=`<${+x+1}.0.0-0`:U(g)?y=`<${x}.${+I+1}.0-0`:S?y=`<=${x}.${I}.${g}-${S}`:r?y=`<${x}.${I}.${+g+1}-0`:y=`<=${y}`,`${n} ${y}`.trim()),_h=(r,i,n)=>{for(let o=0;o<r.length;o++)if(!r[o].test(i))return!1;if(i.prerelease.length&&!n.includePrerelease){for(let o=0;o<r.length;o++)if($(r[o].semver),r[o].semver!==pi.ANY&&r[o].semver.prerelease.length>0){let l=r[o].semver;if(l.major===i.major&&l.minor===i.minor&&l.patch===i.patch)return!0}return!1}return!0}});var Xe=w((Tp,On)=>{"use strict";var ze=Symbol("SemVer ANY"),xi=class r{static get ANY(){return ze}constructor(i,n){if(n=Nn(n),i instanceof r){if(i.loose===!!n.loose)return i;i=i.value}i=i.trim().split(/\s+/).join(" "),mi("comparator",i,n),this.options=n,this.loose=!!n.loose,this.parse(i),this.semver===ze?this.value="":this.value=this.operator+this.semver.version,mi("comp",this)}parse(i){let n=this.options.loose?Rn[Pn.COMPARATORLOOSE]:Rn[Pn.COMPARATOR],o=i.match(n);if(!o)throw new TypeError(`Invalid comparator: ${i}`);this.operator=o[1]!==void 0?o[1]:"",this.operator==="="&&(this.operator=""),o[2]?this.semver=new Tn(o[2],this.options.loose):this.semver=ze}toString(){return this.value}test(i){if(mi("Comparator.test",i,this.options.loose),this.semver===ze||i===ze)return!0;if(typeof i=="string")try{i=new Tn(i,this.options)}catch{return!1}return di(i,this.operator,this.semver,this.options)}intersects(i,n){if(!(i instanceof r))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Ln(i.value,n).test(this.value):i.operator===""?i.value===""?!0:new Ln(this.value,n).test(i.semver):(n=Nn(n),n.includePrerelease&&(this.value==="<0.0.0-0"||i.value==="<0.0.0-0")||!n.includePrerelease&&(this.value.startsWith("<0.0.0")||i.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&i.operator.startsWith(">")||this.operator.startsWith("<")&&i.operator.startsWith("<")||this.semver.version===i.semver.version&&this.operator.includes("=")&&i.operator.includes("=")||di(this.semver,"<",i.semver,n)&&this.operator.startsWith(">")&&i.operator.startsWith("<")||di(this.semver,">",i.semver,n)&&this.operator.startsWith("<")&&i.operator.startsWith(">")))}};On.exports=xi;var Nn=ht(),{safeRe:Rn,t:Pn}=Le(),di=hi(),mi=He(),Tn=G(),Ln=se()});var Ke=w((Lp,Vn)=>{"use strict";var Ih=se(),kh=(r,i,n)=>{try{i=new Ih(i,n)}catch{return!1}return i.test(r)};Vn.exports=kh});var Dn=w((Op,Fn)=>{"use strict";var Ah=se(),Nh=(r,i)=>new Ah(r,i).set.map(n=>n.map(o=>o.value).join(" ").trim().split(" "));Fn.exports=Nh});var qn=w((Vp,$n)=>{"use strict";var Rh=G(),Ph=se(),Th=(r,i,n)=>{let o=null,l=null,h=null;try{h=new Ph(i,n)}catch{return null}return r.forEach(f=>{h.test(f)&&(!o||l.compare(f)===-1)&&(o=f,l=new Rh(o,n))}),o};$n.exports=Th});var Bn=w((Fp,jn)=>{"use strict";var Lh=G(),Oh=se(),Vh=(r,i,n)=>{let o=null,l=null,h=null;try{h=new Oh(i,n)}catch{return null}return r.forEach(f=>{h.test(f)&&(!o||l.compare(f)===1)&&(o=f,l=new Lh(o,n))}),o};jn.exports=Vh});var Gn=w((Dp,Mn)=>{"use strict";var gi=G(),Fh=se(),Un=We(),Dh=(r,i)=>{r=new Fh(r,i);let n=new gi("0.0.0");if(r.test(n)||(n=new gi("0.0.0-0"),r.test(n)))return n;n=null;for(let o=0;o<r.set.length;++o){let l=r.set[o],h=null;l.forEach(f=>{let m=new gi(f.semver.version);switch(f.operator){case">":m.prerelease.length===0?m.patch++:m.prerelease.push(0),m.raw=m.format();case"":case">=":(!h||Un(m,h))&&(h=m);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${f.operator}`)}}),h&&(!n||Un(n,h))&&(n=h)}return n&&r.test(n)?n:null};Mn.exports=Dh});var Wn=w(($p,Hn)=>{"use strict";var $h=se(),qh=(r,i)=>{try{return new $h(r,i).range||"*"}catch{return null}};Hn.exports=qh});var bt=w((qp,Yn)=>{"use strict";var jh=G(),Kn=Xe(),{ANY:Bh}=Kn,Uh=se(),Mh=Ke(),Xn=We(),zn=xt(),Gh=vt(),Hh=gt(),Wh=(r,i,n,o)=>{r=new jh(r,o),i=new Uh(i,o);let l,h,f,m,y;switch(n){case">":l=Xn,h=Gh,f=zn,m=">",y=">=";break;case"<":l=zn,h=Hh,f=Xn,m="<",y="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Mh(r,i,o))return!1;for(let x=0;x<i.set.length;++x){let I=i.set[x],g=null,S=null;if(I.forEach(E=>{E.semver===Bh&&(E=new Kn(">=0.0.0")),g=g||E,S=S||E,l(E.semver,g.semver,o)?g=E:f(E.semver,S.semver,o)&&(S=E)}),g.operator===m||g.operator===y||(!S.operator||S.operator===m)&&h(r,S.semver))return!1;if(S.operator===y&&f(r,S.semver))return!1}return!0};Yn.exports=Wh});var Qn=w((jp,Jn)=>{"use strict";var Xh=bt(),zh=(r,i,n)=>Xh(r,i,">",n);Jn.exports=zh});var ea=w((Bp,Zn)=>{"use strict";var Kh=bt(),Yh=(r,i,n)=>Kh(r,i,"<",n);Zn.exports=Yh});var ra=w((Up,ia)=>{"use strict";var ta=se(),Jh=(r,i,n)=>(r=new ta(r,n),i=new ta(i,n),r.intersects(i,n));ia.exports=Jh});var na=w((Mp,sa)=>{"use strict";var Qh=Ke(),Zh=re();sa.exports=(r,i,n)=>{let o=[],l=null,h=null,f=r.sort((I,g)=>Zh(I,g,n));for(let I of f)Qh(I,i,n)?(h=I,l||(l=I)):(h&&o.push([l,h]),h=null,l=null);l&&o.push([l,null]);let m=[];for(let[I,g]of o)I===g?m.push(I):!g&&I===f[0]?m.push("*"):g?I===f[0]?m.push(`<=${g}`):m.push(`${I} - ${g}`):m.push(`>=${I}`);let y=m.join(" || "),x=typeof i.raw=="string"?i.raw:String(i);return y.length<x.length?y:i}});var la=w((Gp,ha)=>{"use strict";var aa=se(),Ei=Xe(),{ANY:vi}=Ei,yi=Ke(),bi=re(),el=(r,i,n={})=>{if(r===i)return!0;r=new aa(r,n),i=new aa(i,n);let o=!1;e:for(let l of r.set){for(let h of i.set){let f=il(l,h,n);if(o=o||f!==null,f)continue e}if(o)return!1}return!0},tl=[new Ei(">=0.0.0-0")],oa=[new Ei(">=0.0.0")],il=(r,i,n)=>{if(r===i)return!0;if(r.length===1&&r[0].semver===vi){if(i.length===1&&i[0].semver===vi)return!0;n.includePrerelease?r=tl:r=oa}if(i.length===1&&i[0].semver===vi){if(n.includePrerelease)return!0;i=oa}let o=new Set,l,h;for(let E of r)E.operator===">"||E.operator===">="?l=ua(l,E,n):E.operator==="<"||E.operator==="<="?h=ca(h,E,n):o.add(E.semver);if(o.size>1)return null;let f;if(l&&h){if(f=bi(l.semver,h.semver,n),f>0)return null;if(f===0&&(l.operator!==">="||h.operator!=="<="))return null}for(let E of o){if(l&&!yi(E,String(l),n)||h&&!yi(E,String(h),n))return null;for(let N of i)if(!yi(E,String(N),n))return!1;return!0}let m,y,x,I,g=h&&!n.includePrerelease&&h.semver.prerelease.length?h.semver:!1,S=l&&!n.includePrerelease&&l.semver.prerelease.length?l.semver:!1;g&&g.prerelease.length===1&&h.operator==="<"&&g.prerelease[0]===0&&(g=!1);for(let E of i){if(I=I||E.operator===">"||E.operator===">=",x=x||E.operator==="<"||E.operator==="<=",l){if(S&&E.semver.prerelease&&E.semver.prerelease.length&&E.semver.major===S.major&&E.semver.minor===S.minor&&E.semver.patch===S.patch&&(S=!1),E.operator===">"||E.operator===">="){if(m=ua(l,E,n),m===E&&m!==l)return!1}else if(l.operator===">="&&!E.test(l.semver))return!1}if(h){if(g&&E.semver.prerelease&&E.semver.prerelease.length&&E.semver.major===g.major&&E.semver.minor===g.minor&&E.semver.patch===g.patch&&(g=!1),E.operator==="<"||E.operator==="<="){if(y=ca(h,E,n),y===E&&y!==h)return!1}else if(h.operator==="<="&&!E.test(h.semver))return!1}if(!E.operator&&(h||l)&&f!==0)return!1}return!(l&&x&&!h&&f!==0||h&&I&&!l&&f!==0||S||g)},ua=(r,i,n)=>{if(!r)return i;let o=bi(r.semver,i.semver,n);return o>0?r:o<0||i.operator===">"&&r.operator===">="?i:r},ca=(r,i,n)=>{if(!r)return i;let o=bi(r.semver,i.semver,n);return o<0?r:o>0||i.operator==="<"&&r.operator==="<="?i:r};ha.exports=el});var ma=w((Hp,da)=>{"use strict";var Si=Le(),fa=Te(),rl=G(),pa=ni(),sl=ge(),nl=Fs(),al=$s(),ol=Bs(),ul=Gs(),cl=Ws(),hl=zs(),ll=Ys(),fl=Qs(),pl=re(),dl=rn(),ml=nn(),xl=mt(),gl=cn(),vl=ln(),yl=We(),El=xt(),bl=ui(),Sl=ci(),wl=gt(),Cl=vt(),_l=hi(),Il=En(),kl=Sn(),Al=Xe(),Nl=se(),Rl=Ke(),Pl=Dn(),Tl=qn(),Ll=Bn(),Ol=Gn(),Vl=Wn(),Fl=bt(),Dl=Qn(),$l=ea(),ql=ra(),jl=na(),Bl=la();da.exports={parse:sl,valid:nl,clean:al,inc:ol,diff:ul,major:cl,minor:hl,patch:ll,prerelease:fl,compare:pl,rcompare:dl,compareLoose:ml,compareBuild:xl,sort:gl,rsort:vl,gt:yl,lt:El,eq:bl,neq:Sl,gte:wl,lte:Cl,cmp:_l,coerce:Il,truncate:kl,Comparator:Al,Range:Nl,satisfies:Rl,toComparators:Pl,maxSatisfying:Tl,minSatisfying:Ll,minVersion:Ol,validRange:Vl,outside:Fl,gtr:Dl,ltr:$l,intersects:ql,simplifyRange:jl,subset:Bl,SemVer:rl,re:Si.re,src:Si.src,tokens:Si.t,SEMVER_SPEC_VERSION:fa.SEMVER_SPEC_VERSION,RELEASE_TYPES:fa.RELEASE_TYPES,compareIdentifiers:pa.compareIdentifiers,rcompareIdentifiers:pa.rcompareIdentifiers}});var Ii=w((Wp,Ia)=>{var ve=require("fs"),ne=require("path"),ga=ws(),ae=ma(),{DEFAULT_API_URL:Ul}=Me(),va=["dependencies","devDependencies","optionalDependencies","peerDependencies"];function wi(r){let i=typeof r=="string"&&r.match(/^((?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*)(?:@([^\r\n]+))?$/);if(!i)throw new Error(`Invalid npm dependency: ${String(r)}`);return{name:i[1],version:i[2]}}function Ci(r){let i=new Map;for(let n of r){let{name:o,version:l}=wi(n),h=i.get(o);i.set(o,h&&l?ya(o,h,l):l||h)}return i}function ya(r,i,n){if(i===n)return i;let o=ae.validRange(i),l=ae.validRange(n);if(o&&l)try{if(ae.subset(l,o))return n;if(ae.subset(o,l))return i}catch{}throw new Error(`Conflicting registry versions for ${r}: ${i} and ${n}`)}function Ml(r,i){let n=typeof r=="string"&&ae.validRange(r),o=ae.validRange(i);if(!n||!o)return!1;try{return ae.subset(n,o)}catch{return!1}}function wt(r,i){if(Ml(r,i))return"satisfied";let n=typeof r=="string"&&ae.validRange(r),o=ae.validRange(i);if(!n||!o)return"incomparable";try{let l=ae.minVersion(n),h=ae.minVersion(o);return!l||!h?"incomparable":ae.lt(l,h)?"lower":"newer"}catch{return"incomparable"}}function St(r,i){let n=va.find(o=>Object.hasOwn(r[o]||{},i));return n?{section:n,existing:r[n][i]}:null}function Ea(r,i){let n=Ci(i);if(n.size===0)return;let o=ne.join(r,"package.json"),l=JSON.parse(ve.readFileSync(o,"utf8"));for(let[h,f]of n){let m=St(l,h),y=m?.section||"dependencies";l[y]||={};let x=m?.existing;l[y][h]=x===void 0?f||"latest":f&&wt(x,f)==="lower"?f:x}ve.writeFileSync(o,`${JSON.stringify(l,null,2)}
|
|
3
3
|
`)}function Ct(r){let i=[["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["bun.lock","bun"],["bun.lockb","bun"],["package-lock.json","npm"],["npm-shrinkwrap.json","npm"]];for(let n=ne.resolve(r);;n=ne.dirname(n)){let o=ne.join(n,"package.json");if(ve.existsSync(o)){let l=JSON.parse(ve.readFileSync(o,"utf8")),h=String(l.packageManager||"").split("@")[0];if(["npm","pnpm","yarn","bun"].includes(h))return h}for(let[l,h]of i)if(ve.existsSync(ne.join(n,l)))return h;if(ne.dirname(n)===n)return"npm"}}var xa={npm:"npx",pnpm:"pnpm exec",yarn:"yarn",bun:"bunx"};function ba(r,i=process.cwd()){let n;try{n=Ct(i)}catch{n="npm"}return`${xa[n]||xa.npm} frontfriend ${r}`}function Gl(r,i=process.cwd()){let n=null;try{n=r?new URL(r).origin:null}catch{n=null}return ba(n&&n!==new URL(Ul).origin?`login --api-url ${n}`:"login",i)}function Sa(r){return JSON.parse(ve.readFileSync(ne.join(r,"package.json"),"utf8"))}function _i(r,i){let n=Ci(i);if(n.size===0)return[];let o=Sa(r),l=[];for(let[h,f]of n){let m=St(o,h);m&&(!f||wt(m.existing,f)!=="lower")||l.push(f?`${h}@${f}`:h)}return l}function Hl(r,i){let n=i.filter(g=>g.required),o=Ci(n.flatMap(g=>g.dependencies)),l=(g,S)=>S.filter(E=>E.dependencies.some(N=>wi(N).name===g)).map(E=>E.component).filter(Boolean),h=i.filter(g=>!g.required);if(o.size===0&&h.length===0)return{missing:[],kept:[],repair:[]};let f=Sa(r),m=[],y=[];for(let[g,S]of o){let E=St(f,g);if(!E){m.push(S?`${g}@${S}`:g);continue}if(!S)continue;let N=wt(E.existing,S);N==="lower"?m.push(`${g}@${S}`):N!=="satisfied"&&y.push({name:g,current:E.existing,declared:S,components:l(g,n)})}let x=new Map;for(let g of h.flatMap(S=>S.dependencies)){let{name:S,version:E}=wi(g);if(o.has(S)||St(f,S))continue;let N=x.get(S),B=E||N?.version;if(N?.version&&E&&N.version!==E)try{B=ya(S,N.version,E)}catch{B=N.version}x.set(S,{version:B})}let I=[...x].map(([g,{version:S}])=>({request:S?`${g}@${S}`:g,components:l(g,h)}));return{missing:m,kept:y,repair:I}}function wa(r,i){return[r==="npm"?"install":"add",...i]}function Wl(r){return/^[\w@/.:^~=+-]+$/.test(r)?r:`'${r.replace(/'/g,"'\\''")}'`}function Ca(r,i){let n=Ct(r);return[n,...wa(n,i)].map(Wl).join(" ")}function _a(r,i,{stdio:n="inherit"}={}){let o=_i(r,i);if(o.length===0)return;let l=Ct(r),h=ga.sync(l,wa(l,o),{cwd:r,stdio:n});if(h.error||h.status!==0)throw Ea(r,i),h.error||new Error(`${l} dependency installation failed with status ${h.status}. Dependencies were saved; run ${l} install.`)}function Xl(r,i,{install:n=!0,stdio:o="inherit",log:l=console.log}={}){let h=_i(r,i);if(h.length===0)return{missing:h,command:null,installed:!1};let f=Ca(r,h);if(!n)return l(`\u{1F4E6} Component dependencies missing from package.json. Install them with:
|
|
4
4
|
${f}`),{missing:h,command:f,installed:!1};l(`\u{1F4E6} Installing component dependencies: ${f}`);try{return _a(r,h,{stdio:o}),{missing:h,command:f,installed:!0}}catch(m){return l(`\u26A0\uFE0F Component dependencies were not installed: ${m.message}
|
package/dist/package.json
CHANGED
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var C=(r,i)=>()=>(i||r((i={exports:{}}).exports,i),i.exports);var Er=C(($f,Oo)=>{Oo.exports={name:"@frontfriend/sdk",version:"1.
|
|
1
|
+
var C=(r,i)=>()=>(i||r((i={exports:{}}).exports,i),i.exports);var Er=C(($f,Oo)=>{Oo.exports={name:"@frontfriend/sdk",version:"1.3.0"}});var Sr=C((qf,br)=>{var{name:Fo}=Er();br.exports={PACKAGE_NAME:Fo}});var Ge=C((jf,wr)=>{var Vo="https://app.frontfriend.dev",Do=".cache/frontfriend",$o={JS:["tokens.js","variables.js","semanticVariables.js","semanticDarkVariables.js","keyframes.js","animations.js","safelist.js","custom.js"],JSON:["fonts.json","icons.json","components-config.json","iconLibrary.json","version.json","versionMetadata.json","metadata.json","base.json","nativeTokens.json"]},qo={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_AUTH_TOKEN:"FF_AUTH_TOKEN",FF_MACHINE_TOKEN:"FRONTFRIEND_MACHINE_TOKEN"};function jo(r){if(!r)return null;try{let i=new URL(r);return i.hostname.startsWith("app.")?`${i.protocol}//${i.hostname.replace(/^app\./,"registry.")}`:null}catch{return null}}wr.exports={DEFAULT_API_URL:Vo,CACHE_DIR_NAME:Do,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:$o,ENV_VARS:qo,deriveRegistryFromApiUrl:jo}});var _r=C((Bf,Cr)=>{var Bt=class extends Error{constructor(i,n,o){super(i),this.name="APIError",this.statusCode=n,this.url=o,this.code=`API_${n}`}},Ut=class extends Error{constructor(i,n){super(i),this.name="CacheError",this.operation=n,this.code=`CACHE_${n.toUpperCase()}`}},Mt=class extends Error{constructor(i,n){super(i),this.name="ConfigError",this.field=n,this.code=n?`CONFIG_${String(n).toUpperCase()}`:"CONFIG_ERROR"}},Gt=class extends Error{constructor(i,n){super(i),this.name="ProcessingError",this.token=n,this.code="PROCESSING_ERROR"}};Cr.exports={APIError:Bt,CacheError:Ut,ConfigError:Mt,ProcessingError:Gt}});var He=C((Uf,Ir)=>{var j=require("fs");function Bo(r){try{let i=j.readFileSync(r,"utf8");return JSON.parse(i)}catch(i){if(i.code==="ENOENT")return null;throw i}}function Uo(r){try{return j.readFileSync(r,"utf8").replace(/^\uFEFF/,"")}catch(i){if(i.code==="ENOENT")return null;throw i}}function Mo(r,i,n=2){let o=JSON.stringify(i,null,n);j.writeFileSync(r,o,"utf8")}function Go(r,i){j.writeFileSync(r,i,"utf8")}function Ho(r,i){if(i==null||typeof i=="object"&&Object.keys(i).length===0||Array.isArray(i)&&i.length===0){let o=`module.exports = ${Array.isArray(i)?"[]":"{}"};`;j.writeFileSync(r,o,"utf8")}else{let n=`module.exports = ${JSON.stringify(i,null,2)};`;j.writeFileSync(r,n,"utf8")}}function Wo(r){return j.existsSync(r)}function Xo(r){j.mkdirSync(r,{recursive:!0})}function zo(r){j.rmSync(r,{recursive:!0,force:!0})}function Ko(r){j.rmSync(r,{force:!0})}function Yo(r,i){j.mkdirSync(require("path").dirname(r),{recursive:!0,mode:448});let n=`${r}.${process.pid}.${Date.now()}.tmp`;try{j.writeFileSync(n,`${JSON.stringify(i,null,2)}
|
|
2
2
|
`,{mode:384}),j.renameSync(n,r);try{j.chmodSync(r,384)}catch{}}finally{j.rmSync(n,{force:!0})}}async function Jo(r,i,n){j.mkdirSync(require("path").dirname(r),{recursive:!0,mode:448});let o=`${r}.lock`,l=Date.now()+2e4,h;for(;h===void 0;)try{h=j.openSync(o,"wx",384),j.writeFileSync(h,String(process.pid))}catch(f){if(f.code!=="EEXIST")throw f;try{let m=Number(j.readFileSync(o,"utf8"));if(Number.isInteger(m)&&m>0)try{process.kill(m,0)}catch(y){if(y.code==="ESRCH"){j.unlinkSync(o);continue}}}catch(m){if(m.code==="ENOENT")continue}if(Date.now()>=l)throw n();await new Promise(m=>setTimeout(m,50))}try{return await i()}finally{j.closeSync(h),j.unlinkSync(o)}}Ir.exports={writePrivateJsonFileAtomic:Yo,withPrivateFileLock:Jo,readJsonFileSafe:Bo,readFileSafe:Uo,writeJsonFile:Mo,writeTextFile:Go,writeModuleExportsFile:Ho,fileExists:Wo,ensureDirectoryExists:Xo,removeDirectory:zo,removeFile:Ko}});var Ht=C((Mf,kr)=>{var Qo="classes.txt",Zo="classes.css";kr.exports={CLASSES_SOURCE_FILE:Qo,CSS_CLASSES_SOURCE_FILE:Zo}});var Lr=C((Gf,Tr)=>{var Q=require("path"),{CACHE_DIR_NAME:eu,CACHE_TTL_MS:tu,CACHE_FILES:Ar}=Ge(),{CacheError:Wt}=_r(),{readJsonFileSafe:ht,readFileSafe:iu,writeJsonFile:Nr,writeTextFile:Rr,writeModuleExportsFile:Pr,fileExists:Xt,ensureDirectoryExists:ru,removeDirectory:su,removeFile:nu}=He(),{CLASSES_SOURCE_FILE:au,CSS_CLASSES_SOURCE_FILE:ou}=Ht(),zt=class r{constructor(i=process.cwd()){this.appRoot=i,this.cacheDir=Q.join(i,"node_modules",eu),this.metadataFile=Q.join(this.cacheDir,"metadata.json"),this.maxAge=tu}getCacheDir(){return this.cacheDir}isLocalOnly(){return ht(this.metadataFile)?.version==="local-components"}getIconLibrary(){let i=Q.join(this.cacheDir,"iconLibrary.json");return Xt(i)?ht(i):null}exists(){return Xt(this.cacheDir)}isValid(){if(!this.exists())return!1;try{let i=ht(this.metadataFile);if(!i)return!1;let n=new Date(i.timestamp).getTime();return Date.now()-n<this.maxAge}catch{return!1}}load(){if(!this.exists())return null;try{let i={};for(let n of Ar.JS){let o=Q.join(this.cacheDir,n);if(Xt(o)){let l=n.replace(".js","");try{let h=iu(o);if(h!==null){let f={},m={exports:f};new Function("module","exports",h)(m,f),i[l]=m.exports}}catch(h){console.warn(`[Frontfriend] Failed to load ${n}: ${h.message}`),(h.message.includes("Unexpected token")||h.message.includes("Invalid character"))&&console.warn("[Frontfriend] This might be a BOM or encoding issue. Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again.")}}}for(let n of Ar.JSON){let o=Q.join(this.cacheDir,n),l=n.replace(".json",""),h=ht(o);h!==null&&(i[l]=h)}return i["components-config"]&&(i.componentsConfig=i["components-config"],delete i["components-config"]),i.cls&&!i.safelist&&(i.safelist=i.cls,delete i.cls),i}catch(i){throw new Wt(`Failed to load cache: ${i.message}`,"read")}}save(i){try{ru(this.cacheDir);let n={timestamp:new Date().toISOString(),version:i.metadata?.version||"2.0.0",ffId:i.metadata?.ffId},o=["tokens","variables","semanticVariables","semanticDarkVariables","keyframes","animations","safelist","custom"];for(let h of o)if(i[h]!==void 0){let f=Q.join(this.cacheDir,`${h}.js`);Pr(f,i[h])}if(i.safelist&&Array.isArray(i.safelist)){let h=Q.join(this.cacheDir,"safelist.js");Pr(h,i.safelist)}let l={fonts:i.fonts,icons:i.icons||i.iconSet,"components-config":i.componentsConfig,iconLibrary:i.iconLibrary,version:i.version,versionMetadata:i.versionMetadata,base:i.base,nativeTokens:i.nativeTokens};for(let[h,f]of Object.entries(l))if(f!==void 0){let m=Q.join(this.cacheDir,`${h}.json`);Nr(m,f)}i.themeCSS!==void 0&&Rr(Q.join(this.cacheDir,"theme.css"),i.themeCSS),i.classesContent!==void 0&&(Rr(Q.join(this.cacheDir,au),i.classesContent),nu(Q.join(this.cacheDir,ou))),Nr(this.metadataFile,n)}catch(n){throw new Wt(`Failed to save cache: ${n.message}`,"write")}}saveAtomic(i,n=()=>{}){let o=require("node:fs"),{randomUUID:l}=require("node:crypto");o.mkdirSync(Q.dirname(this.cacheDir),{recursive:!0});let h=`${this.cacheDir}.write-lock`,f;try{f=o.openSync(h,"wx")}catch(x){if(x.code!=="EEXIST")throw x;let w=Number(o.readFileSync(h,"utf8")),g=!0;if(w>0)try{process.kill(w,0)}catch(S){g=S.code!=="ESRCH"}if(g)throw new Wt("Another process is installing tokens. Retry after it completes.","write");o.unlinkSync(h),f=o.openSync(h,"wx")}let m=`${this.cacheDir}.previous`,y=`${this.cacheDir}.${l()}.pending`;try{o.writeFileSync(f,String(process.pid)),!o.existsSync(this.cacheDir)&&o.existsSync(m)&&o.renameSync(m,this.cacheDir);let x=new r(this.appRoot);x.cacheDir=y,x.metadataFile=Q.join(y,"metadata.json"),x.save(i),o.existsSync(m)&&o.rmSync(m,{recursive:!0}),o.existsSync(this.cacheDir)&&o.renameSync(this.cacheDir,m);try{o.renameSync(y,this.cacheDir),n()}catch(w){throw o.rmSync(this.cacheDir,{recursive:!0,force:!0}),o.existsSync(m)&&o.renameSync(m,this.cacheDir),w}o.rmSync(m,{recursive:!0,force:!0})}finally{o.rmSync(y,{recursive:!0,force:!0}),o.closeSync(f),o.rmSync(h,{force:!0})}}clear(){this.exists()&&su(this.cacheDir)}};Tr.exports=zt});var Dr=C((Hf,Vr)=>{function de(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function Kt(r,i){if(!de(r)||!de(i))return i===void 0?r:i;let n={...r};for(let[o,l]of Object.entries(i))n[o]=o in n?Kt(n[o],l):l;return n}function Yt(r,i,n=[],o=[]){if(r===void 0||i===void 0)return o;if(!de(r)||!de(i))return o.push(n.join(".")),o;for(let l of Object.keys(r))l in i&&Yt(r[l],i[l],[...n,l],o);return o}function Or(r){return de(r)&&("styles"in r||"behavior"in r)}function Fr(r,i="component"){if(!Or(r)||!de(r.styles)||r.behavior!==void 0&&!de(r.behavior)||Object.keys(r).some(o=>!["styles","behavior"].includes(o)))throw new TypeError(`Component ${i} must use the styles/behavior envelope`);let n=Yt(r.styles,r.behavior,[i]);if(n.length>0)throw new Error(`Component config styles/behavior conflict at ${n.join(", ")}`);return Kt(r.styles||{},r.behavior||{})}function uu(r){if(!de(r))return r;let i=!1,n={};for(let[o,l]of Object.entries(r))n[o]=Fr(l,o),n[o]!==l&&(i=!0);return i?n:r}Vr.exports={isPlainObject:de,deepMerge:Kt,findTreeConflicts:Yt,isComponentEnvelope:Or,toRuntimeComponentConfig:Fr,toRuntimeComponentsConfig:uu}});var Ur=C((Wf,Br)=>{Br.exports=jr;jr.sync=hu;var $r=require("fs");function cu(r,i){var n=i.pathExt!==void 0?i.pathExt:process.env.PATHEXT;if(!n||(n=n.split(";"),n.indexOf("")!==-1))return!0;for(var o=0;o<n.length;o++){var l=n[o].toLowerCase();if(l&&r.substr(-l.length).toLowerCase()===l)return!0}return!1}function qr(r,i,n){return!r.isSymbolicLink()&&!r.isFile()?!1:cu(i,n)}function jr(r,i,n){$r.stat(r,function(o,l){n(o,o?!1:qr(l,r,i))})}function hu(r,i){return qr($r.statSync(r),r,i)}});var Xr=C((Xf,Wr)=>{Wr.exports=Gr;Gr.sync=lu;var Mr=require("fs");function Gr(r,i,n){Mr.stat(r,function(o,l){n(o,o?!1:Hr(l,i))})}function lu(r,i){return Hr(Mr.statSync(r),i)}function Hr(r,i){return r.isFile()&&fu(r,i)}function fu(r,i){var n=r.mode,o=r.uid,l=r.gid,h=i.uid!==void 0?i.uid:process.getuid&&process.getuid(),f=i.gid!==void 0?i.gid:process.getgid&&process.getgid(),m=parseInt("100",8),y=parseInt("010",8),x=parseInt("001",8),w=m|y,g=n&x||n&y&&l===f||n&m&&o===h||n&w&&h===0;return g}});var Kr=C((Kf,zr)=>{var zf=require("fs"),lt;process.platform==="win32"||global.TESTING_WINDOWS?lt=Ur():lt=Xr();zr.exports=Jt;Jt.sync=pu;function Jt(r,i,n){if(typeof i=="function"&&(n=i,i={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,l){Jt(r,i||{},function(h,f){h?l(h):o(f)})})}lt(r,i||{},function(o,l){o&&(o.code==="EACCES"||i&&i.ignoreErrors)&&(o=null,l=!1),n(o,l)})}function pu(r,i){try{return lt.sync(r,i||{})}catch(n){if(i&&i.ignoreErrors||n.code==="EACCES")return!1;throw n}}});var is=C((Yf,ts)=>{var Pe=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Yr=require("path"),du=Pe?";":":",Jr=Kr(),Qr=r=>Object.assign(new Error(`not found: ${r}`),{code:"ENOENT"}),Zr=(r,i)=>{let n=i.colon||du,o=r.match(/\//)||Pe&&r.match(/\\/)?[""]:[...Pe?[process.cwd()]:[],...(i.path||process.env.PATH||"").split(n)],l=Pe?i.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",h=Pe?l.split(n):[""];return Pe&&r.indexOf(".")!==-1&&h[0]!==""&&h.unshift(""),{pathEnv:o,pathExt:h,pathExtExe:l}},es=(r,i,n)=>{typeof i=="function"&&(n=i,i={}),i||(i={});let{pathEnv:o,pathExt:l,pathExtExe:h}=Zr(r,i),f=[],m=x=>new Promise((w,g)=>{if(x===o.length)return i.all&&f.length?w(f):g(Qr(r));let S=o[x],E=/^".*"$/.test(S)?S.slice(1,-1):S,k=Yr.join(E,r),B=!E&&/^\.[\\\/]/.test(r)?r.slice(0,2)+k:k;w(y(B,x,0))}),y=(x,w,g)=>new Promise((S,E)=>{if(g===l.length)return S(m(w+1));let k=l[g];Jr(x+k,{pathExt:h},(B,Y)=>{if(!B&&Y)if(i.all)f.push(x+k);else return S(x+k);return S(y(x,w,g+1))})});return n?m(0).then(x=>n(null,x),n):m(0)},mu=(r,i)=>{i=i||{};let{pathEnv:n,pathExt:o,pathExtExe:l}=Zr(r,i),h=[];for(let f=0;f<n.length;f++){let m=n[f],y=/^".*"$/.test(m)?m.slice(1,-1):m,x=Yr.join(y,r),w=!y&&/^\.[\\\/]/.test(r)?r.slice(0,2)+x:x;for(let g=0;g<o.length;g++){let S=w+o[g];try{if(Jr.sync(S,{pathExt:l}))if(i.all)h.push(S);else return S}catch{}}}if(i.all&&h.length)return h;if(i.nothrow)return null;throw Qr(r)};ts.exports=es;es.sync=mu});var ss=C((Jf,Qt)=>{"use strict";var rs=(r={})=>{let i=r.env||process.env;return(r.platform||process.platform)!=="win32"?"PATH":Object.keys(i).reverse().find(o=>o.toUpperCase()==="PATH")||"Path"};Qt.exports=rs;Qt.exports.default=rs});var us=C((Qf,os)=>{"use strict";var ns=require("path"),xu=is(),gu=ss();function as(r,i){let n=r.options.env||process.env,o=process.cwd(),l=r.options.cwd!=null,h=l&&process.chdir!==void 0&&!process.chdir.disabled;if(h)try{process.chdir(r.options.cwd)}catch{}let f;try{f=xu.sync(r.command,{path:n[gu({env:n})],pathExt:i?ns.delimiter:void 0})}catch{}finally{h&&process.chdir(o)}return f&&(f=ns.resolve(l?r.options.cwd:"",f)),f}function vu(r){return as(r)||as(r,!0)}os.exports=vu});var cs=C((Zf,ei)=>{"use strict";var Zt=/([()\][%!^"`<>&|;, *?])/g;function yu(r){return r=r.replace(Zt,"^$1"),r}function Eu(r,i){return r=`${r}`,r=r.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),r=r.replace(/(?=(\\+?)?)\1$/,"$1$1"),r=`"${r}"`,r=r.replace(Zt,"^$1"),i&&(r=r.replace(Zt,"^$1")),r}ei.exports.command=yu;ei.exports.argument=Eu});var ls=C((ep,hs)=>{"use strict";hs.exports=/^#!(.*)/});var ps=C((tp,fs)=>{"use strict";var bu=ls();fs.exports=(r="")=>{let i=r.match(bu);if(!i)return null;let[n,o]=i[0].replace(/#! ?/,"").split(" "),l=n.split("/").pop();return l==="env"?o:o?`${l} ${o}`:l}});var ms=C((ip,ds)=>{"use strict";var ti=require("fs"),Su=ps();function wu(r){let n=Buffer.alloc(150),o;try{o=ti.openSync(r,"r"),ti.readSync(o,n,0,150,0),ti.closeSync(o)}catch{}return Su(n.toString())}ds.exports=wu});var ys=C((rp,vs)=>{"use strict";var Cu=require("path"),xs=us(),gs=cs(),_u=ms(),Iu=process.platform==="win32",ku=/\.(?:com|exe)$/i,Au=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Nu(r){r.file=xs(r);let i=r.file&&_u(r.file);return i?(r.args.unshift(r.file),r.command=i,xs(r)):r.file}function Ru(r){if(!Iu)return r;let i=Nu(r),n=!ku.test(i);if(r.options.forceShell||n){let o=Au.test(i);r.command=Cu.normalize(r.command),r.command=gs.command(r.command),r.args=r.args.map(h=>gs.argument(h,o));let l=[r.command].concat(r.args).join(" ");r.args=["/d","/s","/c",`"${l}"`],r.command=process.env.comspec||"cmd.exe",r.options.windowsVerbatimArguments=!0}return r}function Pu(r,i,n){i&&!Array.isArray(i)&&(n=i,i=null),i=i?i.slice(0):[],n=Object.assign({},n);let o={command:r,args:i,options:n,file:void 0,original:{command:r,args:i}};return n.shell?o:Ru(o)}vs.exports=Pu});var Ss=C((sp,bs)=>{"use strict";var ii=process.platform==="win32";function ri(r,i){return Object.assign(new Error(`${i} ${r.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${i} ${r.command}`,path:r.command,spawnargs:r.args})}function Tu(r,i){if(!ii)return;let n=r.emit;r.emit=function(o,l){if(o==="exit"){let h=Es(l,i);if(h)return n.call(r,"error",h)}return n.apply(r,arguments)}}function Es(r,i){return ii&&r===1&&!i.file?ri(i.original,"spawn"):null}function Lu(r,i){return ii&&r===1&&!i.file?ri(i.original,"spawnSync"):null}bs.exports={hookChildProcess:Tu,verifyENOENT:Es,verifyENOENTSync:Lu,notFoundError:ri}});var _s=C((np,Te)=>{"use strict";var ws=require("child_process"),si=ys(),ni=Ss();function Cs(r,i,n){let o=si(r,i,n),l=ws.spawn(o.command,o.args,o.options);return ni.hookChildProcess(l,o),l}function Ou(r,i,n){let o=si(r,i,n),l=ws.spawnSync(o.command,o.args,o.options);return l.error=l.error||ni.verifyENOENTSync(l.status,o),l}Te.exports=Cs;Te.exports.spawn=Cs;Te.exports.sync=Ou;Te.exports._parse=si;Te.exports._enoent=ni});var Le=C((ap,Is)=>{"use strict";var Fu="2.0.0",Vu=Number.MAX_SAFE_INTEGER||9007199254740991,Du=16,$u=250,qu=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Is.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Du,MAX_SAFE_BUILD_LENGTH:$u,MAX_SAFE_INTEGER:Vu,RELEASE_TYPES:qu,SEMVER_SPEC_VERSION:Fu,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var We=C((op,ks)=>{"use strict";var ju=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};ks.exports=ju});var Oe=C((ce,As)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:ai,MAX_SAFE_BUILD_LENGTH:Bu,MAX_LENGTH:Uu}=Le(),Mu=We();ce=As.exports={};var Gu=ce.re=[],Hu=ce.safeRe=[],_=ce.src=[],Wu=ce.safeSrc=[],I=ce.t={},Xu=0,oi="[a-zA-Z0-9-]",zu=[["\\s",1],["\\d",Uu],[oi,Bu]],Ku=r=>{for(let[i,n]of zu)r=r.split(`${i}*`).join(`${i}{0,${n}}`).split(`${i}+`).join(`${i}{1,${n}}`);return r},T=(r,i,n)=>{let o=Ku(i),l=Xu++;Mu(r,l,i),I[r]=l,_[l]=i,Wu[l]=o,Gu[l]=new RegExp(i,n?"g":void 0),Hu[l]=new RegExp(o,n?"g":void 0)};T("NUMERICIDENTIFIER","0|[1-9]\\d*");T("NUMERICIDENTIFIERLOOSE","\\d+");T("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${oi}*`);T("MAINVERSION",`(${_[I.NUMERICIDENTIFIER]})\\.(${_[I.NUMERICIDENTIFIER]})\\.(${_[I.NUMERICIDENTIFIER]})`);T("MAINVERSIONLOOSE",`(${_[I.NUMERICIDENTIFIERLOOSE]})\\.(${_[I.NUMERICIDENTIFIERLOOSE]})\\.(${_[I.NUMERICIDENTIFIERLOOSE]})`);T("PRERELEASEIDENTIFIER",`(?:${_[I.NONNUMERICIDENTIFIER]}|${_[I.NUMERICIDENTIFIER]})`);T("PRERELEASEIDENTIFIERLOOSE",`(?:${_[I.NONNUMERICIDENTIFIER]}|${_[I.NUMERICIDENTIFIERLOOSE]})`);T("PRERELEASE",`(?:-(${_[I.PRERELEASEIDENTIFIER]}(?:\\.${_[I.PRERELEASEIDENTIFIER]})*))`);T("PRERELEASELOOSE",`(?:-?(${_[I.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${_[I.PRERELEASEIDENTIFIERLOOSE]})*))`);T("BUILDIDENTIFIER",`${oi}+`);T("BUILD",`(?:\\+(${_[I.BUILDIDENTIFIER]}(?:\\.${_[I.BUILDIDENTIFIER]})*))`);T("FULLPLAIN",`v?${_[I.MAINVERSION]}${_[I.PRERELEASE]}?${_[I.BUILD]}?`);T("FULL",`^${_[I.FULLPLAIN]}$`);T("LOOSEPLAIN",`[v=\\s]*${_[I.MAINVERSIONLOOSE]}${_[I.PRERELEASELOOSE]}?${_[I.BUILD]}?`);T("LOOSE",`^${_[I.LOOSEPLAIN]}$`);T("GTLT","((?:<|>)?=?)");T("XRANGEIDENTIFIERLOOSE",`${_[I.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);T("XRANGEIDENTIFIER",`${_[I.NUMERICIDENTIFIER]}|x|X|\\*`);T("XRANGEPLAIN",`[v=\\s]*(${_[I.XRANGEIDENTIFIER]})(?:\\.(${_[I.XRANGEIDENTIFIER]})(?:\\.(${_[I.XRANGEIDENTIFIER]})(?:${_[I.PRERELEASE]})?${_[I.BUILD]}?)?)?`);T("XRANGEPLAINLOOSE",`[v=\\s]*(${_[I.XRANGEIDENTIFIERLOOSE]})(?:\\.(${_[I.XRANGEIDENTIFIERLOOSE]})(?:\\.(${_[I.XRANGEIDENTIFIERLOOSE]})(?:${_[I.PRERELEASELOOSE]})?${_[I.BUILD]}?)?)?`);T("XRANGE",`^${_[I.GTLT]}\\s*${_[I.XRANGEPLAIN]}$`);T("XRANGELOOSE",`^${_[I.GTLT]}\\s*${_[I.XRANGEPLAINLOOSE]}$`);T("COERCEPLAIN",`(^|[^\\d])(\\d{1,${ai}})(?:\\.(\\d{1,${ai}}))?(?:\\.(\\d{1,${ai}}))?`);T("COERCE",`${_[I.COERCEPLAIN]}(?:$|[^\\d])`);T("COERCEFULL",_[I.COERCEPLAIN]+`(?:${_[I.PRERELEASE]})?(?:${_[I.BUILD]})?(?:$|[^\\d])`);T("COERCERTL",_[I.COERCE],!0);T("COERCERTLFULL",_[I.COERCEFULL],!0);T("LONETILDE","(?:~>?)");T("TILDETRIM",`(\\s*)${_[I.LONETILDE]}\\s+`,!0);ce.tildeTrimReplace="$1~";T("TILDE",`^${_[I.LONETILDE]}${_[I.XRANGEPLAIN]}$`);T("TILDELOOSE",`^${_[I.LONETILDE]}${_[I.XRANGEPLAINLOOSE]}$`);T("LONECARET","(?:\\^)");T("CARETTRIM",`(\\s*)${_[I.LONECARET]}\\s+`,!0);ce.caretTrimReplace="$1^";T("CARET",`^${_[I.LONECARET]}${_[I.XRANGEPLAIN]}$`);T("CARETLOOSE",`^${_[I.LONECARET]}${_[I.XRANGEPLAINLOOSE]}$`);T("COMPARATORLOOSE",`^${_[I.GTLT]}\\s*(${_[I.LOOSEPLAIN]})$|^$`);T("COMPARATOR",`^${_[I.GTLT]}\\s*(${_[I.FULLPLAIN]})$|^$`);T("COMPARATORTRIM",`(\\s*)${_[I.GTLT]}\\s*(${_[I.LOOSEPLAIN]}|${_[I.XRANGEPLAIN]})`,!0);ce.comparatorTrimReplace="$1$2$3";T("HYPHENRANGE",`^\\s*(${_[I.XRANGEPLAIN]})\\s+-\\s+(${_[I.XRANGEPLAIN]})\\s*$`);T("HYPHENRANGELOOSE",`^\\s*(${_[I.XRANGEPLAINLOOSE]})\\s+-\\s+(${_[I.XRANGEPLAINLOOSE]})\\s*$`);T("STAR","(<|>)?=?\\s*\\*");T("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");T("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var ft=C((up,Ns)=>{"use strict";var Yu=Object.freeze({loose:!0}),Ju=Object.freeze({}),Qu=r=>r?typeof r!="object"?Yu:r:Ju;Ns.exports=Qu});var ui=C((cp,Ts)=>{"use strict";var Rs=/^[0-9]+$/,Ps=(r,i)=>{if(typeof r=="number"&&typeof i=="number")return r===i?0:r<i?-1:1;let n=Rs.test(r),o=Rs.test(i);return n&&o&&(r=+r,i=+i),r===i?0:n&&!o?-1:o&&!n?1:r<i?-1:1},Zu=(r,i)=>Ps(i,r);Ts.exports={compareIdentifiers:Ps,rcompareIdentifiers:Zu}});var G=C((hp,Os)=>{"use strict";var pt=We(),{MAX_LENGTH:Ls,MAX_SAFE_INTEGER:dt}=Le(),{safeRe:mt,t:xt}=Oe(),ec=ft(),{compareIdentifiers:ci}=ui(),tc=(r,i)=>{let n=i.split(".");if(n.length>r.length)return!1;for(let o=0;o<n.length;o++)if(ci(r[o],n[o])!==0)return!1;return!0},hi=class r{constructor(i,n){if(n=ec(n),i instanceof r){if(i.loose===!!n.loose&&i.includePrerelease===!!n.includePrerelease)return i;i=i.version}else if(typeof i!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof i}".`);if(i.length>Ls)throw new TypeError(`version is longer than ${Ls} characters`);pt("SemVer",i,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let o=i.trim().match(n.loose?mt[xt.LOOSE]:mt[xt.FULL]);if(!o)throw new TypeError(`Invalid Version: ${i}`);if(this.raw=i,this.major=+o[1],this.minor=+o[2],this.patch=+o[3],this.major>dt||this.major<0)throw new TypeError("Invalid major version");if(this.minor>dt||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>dt||this.patch<0)throw new TypeError("Invalid patch version");o[4]?this.prerelease=o[4].split(".").map(l=>{if(/^[0-9]+$/.test(l)){let h=+l;if(h>=0&&h<dt)return h}return l}):this.prerelease=[],this.build=o[5]?o[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(i){if(pt("SemVer.compare",this.version,this.options,i),!(i instanceof r)){if(typeof i=="string"&&i===this.version)return 0;i=new r(i,this.options)}return i.version===this.version?0:this.compareMain(i)||this.comparePre(i)}compareMain(i){return i instanceof r||(i=new r(i,this.options)),this.major<i.major?-1:this.major>i.major?1:this.minor<i.minor?-1:this.minor>i.minor?1:this.patch<i.patch?-1:this.patch>i.patch?1:0}comparePre(i){if(i instanceof r||(i=new r(i,this.options)),this.prerelease.length&&!i.prerelease.length)return-1;if(!this.prerelease.length&&i.prerelease.length)return 1;if(!this.prerelease.length&&!i.prerelease.length)return 0;let n=0;do{let o=this.prerelease[n],l=i.prerelease[n];if(pt("prerelease compare",n,o,l),o===void 0&&l===void 0)return 0;if(l===void 0)return 1;if(o===void 0)return-1;if(o===l)continue;return ci(o,l)}while(++n)}compareBuild(i){i instanceof r||(i=new r(i,this.options));let n=0;do{let o=this.build[n],l=i.build[n];if(pt("build compare",n,o,l),o===void 0&&l===void 0)return 0;if(l===void 0)return 1;if(o===void 0)return-1;if(o===l)continue;return ci(o,l)}while(++n)}inc(i,n,o){if(i.startsWith("pre")){if(!n&&o===!1)throw new Error("invalid increment argument: identifier is empty");if(n){let l=`-${n}`.match(this.options.loose?mt[xt.PRERELEASELOOSE]:mt[xt.PRERELEASE]);if(!l||l[1]!==n)throw new Error(`invalid identifier: ${n}`)}}switch(i){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,o);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,o);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,o),this.inc("pre",n,o);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,o),this.inc("pre",n,o);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let l=Number(o)?1:0;if(this.prerelease.length===0)this.prerelease=[l];else{let h=this.prerelease.length;for(;--h>=0;)typeof this.prerelease[h]=="number"&&(this.prerelease[h]++,h=-2);if(h===-1){if(n===this.prerelease.join(".")&&o===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(l)}}if(n){let h=[n,l];if(o===!1&&(h=[n]),tc(this.prerelease,n)){let f=this.prerelease[n.split(".").length];isNaN(f)&&(this.prerelease=h)}else this.prerelease=h}break}default:throw new Error(`invalid increment argument: ${i}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Os.exports=hi});var ve=C((lp,Vs)=>{"use strict";var Fs=G(),ic=(r,i,n=!1)=>{if(r instanceof Fs)return r;try{return new Fs(r,i)}catch(o){if(!n)return null;throw o}};Vs.exports=ic});var $s=C((fp,Ds)=>{"use strict";var rc=ve(),sc=(r,i)=>{let n=rc(r,i);return n?n.version:null};Ds.exports=sc});var js=C((pp,qs)=>{"use strict";var nc=ve(),ac=(r,i)=>{let n=nc(r.trim().replace(/^[=v]+/,""),i);return n?n.version:null};qs.exports=ac});var Ms=C((dp,Us)=>{"use strict";var Bs=G(),oc=(r,i,n,o,l)=>{typeof n=="string"&&(l=o,o=n,n=void 0);try{return new Bs(r instanceof Bs?r.version:r,n).inc(i,o,l).version}catch{return null}};Us.exports=oc});var Ws=C((mp,Hs)=>{"use strict";var Gs=ve(),uc=(r,i)=>{let n=Gs(r,null,!0),o=Gs(i,null,!0),l=n.compare(o);if(l===0)return null;let h=l>0,f=h?n:o,m=h?o:n,y=!!f.prerelease.length;if(!!m.prerelease.length&&!y){if(!m.patch&&!m.minor)return"major";if(m.compareMain(f)===0)return m.minor&&!m.patch?"minor":"patch"}let w=y?"pre":"";return n.major!==o.major?w+"major":n.minor!==o.minor?w+"minor":n.patch!==o.patch?w+"patch":"prerelease"};Hs.exports=uc});var zs=C((xp,Xs)=>{"use strict";var cc=G(),hc=(r,i)=>new cc(r,i).major;Xs.exports=hc});var Ys=C((gp,Ks)=>{"use strict";var lc=G(),fc=(r,i)=>new lc(r,i).minor;Ks.exports=fc});var Qs=C((vp,Js)=>{"use strict";var pc=G(),dc=(r,i)=>new pc(r,i).patch;Js.exports=dc});var en=C((yp,Zs)=>{"use strict";var mc=ve(),xc=(r,i)=>{let n=mc(r,i);return n&&n.prerelease.length?n.prerelease:null};Zs.exports=xc});var re=C((Ep,rn)=>{"use strict";var tn=G(),gc=(r,i,n)=>new tn(r,n).compare(new tn(i,n));rn.exports=gc});var nn=C((bp,sn)=>{"use strict";var vc=re(),yc=(r,i,n)=>vc(i,r,n);sn.exports=yc});var on=C((Sp,an)=>{"use strict";var Ec=re(),bc=(r,i)=>Ec(r,i,!0);an.exports=bc});var gt=C((wp,cn)=>{"use strict";var un=G(),Sc=(r,i,n)=>{let o=new un(r,n),l=new un(i,n);return o.compare(l)||o.compareBuild(l)};cn.exports=Sc});var ln=C((Cp,hn)=>{"use strict";var wc=gt(),Cc=(r,i)=>r.sort((n,o)=>wc(n,o,i));hn.exports=Cc});var pn=C((_p,fn)=>{"use strict";var _c=gt(),Ic=(r,i)=>r.sort((n,o)=>_c(o,n,i));fn.exports=Ic});var Xe=C((Ip,dn)=>{"use strict";var kc=re(),Ac=(r,i,n)=>kc(r,i,n)>0;dn.exports=Ac});var vt=C((kp,mn)=>{"use strict";var Nc=re(),Rc=(r,i,n)=>Nc(r,i,n)<0;mn.exports=Rc});var li=C((Ap,xn)=>{"use strict";var Pc=re(),Tc=(r,i,n)=>Pc(r,i,n)===0;xn.exports=Tc});var fi=C((Np,gn)=>{"use strict";var Lc=re(),Oc=(r,i,n)=>Lc(r,i,n)!==0;gn.exports=Oc});var yt=C((Rp,vn)=>{"use strict";var Fc=re(),Vc=(r,i,n)=>Fc(r,i,n)>=0;vn.exports=Vc});var Et=C((Pp,yn)=>{"use strict";var Dc=re(),$c=(r,i,n)=>Dc(r,i,n)<=0;yn.exports=$c});var pi=C((Tp,En)=>{"use strict";var qc=li(),jc=fi(),Bc=Xe(),Uc=yt(),Mc=vt(),Gc=Et(),Hc=(r,i,n,o)=>{switch(i){case"===":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r===n;case"!==":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r!==n;case"":case"=":case"==":return qc(r,n,o);case"!=":return jc(r,n,o);case">":return Bc(r,n,o);case">=":return Uc(r,n,o);case"<":return Mc(r,n,o);case"<=":return Gc(r,n,o);default:throw new TypeError(`Invalid operator: ${i}`)}};En.exports=Hc});var Sn=C((Lp,bn)=>{"use strict";var Wc=G(),Xc=ve(),{safeRe:bt,t:St}=Oe(),zc=(r,i)=>{if(r instanceof Wc)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;i=i||{};let n=null;if(!i.rtl)n=r.match(i.includePrerelease?bt[St.COERCEFULL]:bt[St.COERCE]);else{let y=i.includePrerelease?bt[St.COERCERTLFULL]:bt[St.COERCERTL],x;for(;(x=y.exec(r))&&(!n||n.index+n[0].length!==r.length);)(!n||x.index+x[0].length!==n.index+n[0].length)&&(n=x),y.lastIndex=x.index+x[1].length+x[2].length;y.lastIndex=-1}if(n===null)return null;let o=n[2],l=n[3]||"0",h=n[4]||"0",f=i.includePrerelease&&n[5]?`-${n[5]}`:"",m=i.includePrerelease&&n[6]?`+${n[6]}`:"";return Xc(`${o}.${l}.${h}${f}${m}`,i)};bn.exports=zc});var Cn=C((Op,wn)=>{"use strict";var Kc=ve(),Yc=Le(),Jc=G(),Qc=(r,i,n)=>{if(!Yc.RELEASE_TYPES.includes(i))return null;let o=Zc(r,n);return o&&eh(o,i)},Zc=(r,i)=>{let n=r instanceof Jc?r.version:r;return Kc(n,i)},eh=(r,i)=>{if(th(i))return r.version;switch(r.prerelease=[],i){case"major":r.minor=0,r.patch=0;break;case"minor":r.patch=0;break}return r.format()},th=r=>r.startsWith("pre");wn.exports=Qc});var In=C((Fp,_n)=>{"use strict";var di=class{constructor(){this.max=1e3,this.map=new Map}get(i){let n=this.map.get(i);if(n!==void 0)return this.map.delete(i),this.map.set(i,n),n}delete(i){return this.map.delete(i)}set(i,n){if(!this.delete(i)&&n!==void 0){if(this.map.size>=this.max){let l=this.map.keys().next().value;this.delete(l)}this.map.set(i,n)}return this}};_n.exports=di});var se=C((Vp,Rn)=>{"use strict";var ih=/\s+/g,mi=class r{constructor(i,n){if(n=sh(n),i instanceof r)return i.loose===!!n.loose&&i.includePrerelease===!!n.includePrerelease?i:new r(i.raw,n);if(i instanceof xi)return this.raw=i.value,this.set=[[i]],this.formatted=void 0,this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=i.trim().replace(ih," "),this.set=this.raw.split("||").map(o=>this.parseRange(o.trim())).filter(o=>o.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let o=this.set[0];if(this.set=this.set.filter(l=>!An(l[0])),this.set.length===0)this.set=[o];else if(this.set.length>1){for(let l of this.set)if(l.length===1&&ph(l[0])){this.set=[l];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let i=0;i<this.set.length;i++){i>0&&(this.formatted+="||");let n=this.set[i];for(let o=0;o<n.length;o++)o>0&&(this.formatted+=" "),this.formatted+=n[o].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(i){i=i.replace(fh,"");let o=((this.options.includePrerelease&&hh)|(this.options.loose&&lh))+":"+i,l=kn.get(o);if(l)return l;let h=this.options.loose,f=h?K[H.HYPHENRANGELOOSE]:K[H.HYPHENRANGE];i=i.replace(f,Ch(this.options.includePrerelease)),$("hyphen replace",i),i=i.replace(K[H.COMPARATORTRIM],oh),$("comparator trim",i),i=i.replace(K[H.TILDETRIM],uh),$("tilde trim",i),i=i.replace(K[H.CARETTRIM],ch),$("caret trim",i);let m=i.split(" ").map(g=>dh(g,this.options)).join(" ").split(/\s+/).map(g=>wh(g,this.options));h&&(m=m.filter(g=>($("loose invalid filter",g,this.options),!!g.match(K[H.COMPARATORLOOSE])))),$("range list",m);let y=new Map,x=m.map(g=>new xi(g,this.options));for(let g of x){if(An(g))return[g];y.set(g.value,g)}y.size>1&&y.has("")&&y.delete("");let w=[...y.values()];return kn.set(o,w),w}intersects(i,n){if(!(i instanceof r))throw new TypeError("a Range is required");return this.set.some(o=>Nn(o,n)&&i.set.some(l=>Nn(l,n)&&o.every(h=>l.every(f=>h.intersects(f,n)))))}test(i){if(!i)return!1;if(typeof i=="string")try{i=new nh(i,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(_h(this.set[n],i,this.options))return!0;return!1}};Rn.exports=mi;var rh=In(),kn=new rh,sh=ft(),xi=ze(),$=We(),nh=G(),{safeRe:K,src:ah,t:H,comparatorTrimReplace:oh,tildeTrimReplace:uh,caretTrimReplace:ch}=Oe(),{FLAG_INCLUDE_PRERELEASE:hh,FLAG_LOOSE:lh}=Le(),fh=new RegExp(ah[H.BUILD],"g"),An=r=>r.value==="<0.0.0-0",ph=r=>r.value==="",Nn=(r,i)=>{let n=!0,o=r.slice(),l=o.pop();for(;n&&o.length;)n=o.every(h=>l.intersects(h,i)),l=o.pop();return n},dh=(r,i)=>(r=r.replace(K[H.BUILD],""),$("comp",r,i),r=vh(r,i),$("caret",r),r=xh(r,i),$("tildes",r),r=Eh(r,i),$("xrange",r),r=Sh(r,i),$("stars",r),r),U=r=>!r||r.toLowerCase()==="x"||r==="*",mh=(r,i,n)=>U(r)&&!U(i)||U(i)&&n&&!U(n),xh=(r,i)=>r.trim().split(/\s+/).map(n=>gh(n,i)).join(" "),gh=(r,i)=>{let n=i.loose?K[H.TILDELOOSE]:K[H.TILDE],o=i.includePrerelease?"-0":"";return r.replace(n,(l,h,f,m,y)=>{$("tilde",r,l,h,f,m,y);let x;return U(h)?x="":U(f)?x=`>=${h}.0.0${o} <${+h+1}.0.0-0`:U(m)?x=`>=${h}.${f}.0${o} <${h}.${+f+1}.0-0`:y?($("replaceTilde pr",y),x=`>=${h}.${f}.${m}-${y} <${h}.${+f+1}.0-0`):x=`>=${h}.${f}.${m} <${h}.${+f+1}.0-0`,$("tilde return",x),x})},vh=(r,i)=>r.trim().split(/\s+/).map(n=>yh(n,i)).join(" "),yh=(r,i)=>{$("caret",r,i);let n=i.loose?K[H.CARETLOOSE]:K[H.CARET],o=i.includePrerelease?"-0":"";return r.replace(n,(l,h,f,m,y)=>{$("caret",r,l,h,f,m,y);let x;return U(h)?x="":U(f)?x=`>=${h}.0.0${o} <${+h+1}.0.0-0`:U(m)?h==="0"?x=`>=${h}.${f}.0${o} <${h}.${+f+1}.0-0`:x=`>=${h}.${f}.0${o} <${+h+1}.0.0-0`:y?($("replaceCaret pr",y),h==="0"?f==="0"?x=`>=${h}.${f}.${m}-${y} <${h}.${f}.${+m+1}-0`:x=`>=${h}.${f}.${m}-${y} <${h}.${+f+1}.0-0`:x=`>=${h}.${f}.${m}-${y} <${+h+1}.0.0-0`):($("no pr"),h==="0"?f==="0"?x=`>=${h}.${f}.${m} <${h}.${f}.${+m+1}-0`:x=`>=${h}.${f}.${m} <${h}.${+f+1}.0-0`:x=`>=${h}.${f}.${m} <${+h+1}.0.0-0`),$("caret return",x),x})},Eh=(r,i)=>($("replaceXRanges",r,i),r.split(/\s+/).map(n=>bh(n,i)).join(" ")),bh=(r,i)=>{r=r.trim();let n=i.loose?K[H.XRANGELOOSE]:K[H.XRANGE];return r.replace(n,(o,l,h,f,m,y)=>{if($("xRange",r,o,l,h,f,m,y),mh(h,f,m))return r;let x=U(h),w=x||U(f),g=w||U(m),S=g;return l==="="&&S&&(l=""),y=i.includePrerelease?"-0":"",x?l===">"||l==="<"?o="<0.0.0-0":o="*":l&&S?(w&&(f=0),m=0,l===">"?(l=">=",w?(h=+h+1,f=0,m=0):(f=+f+1,m=0)):l==="<="&&(l="<",w?h=+h+1:f=+f+1),l==="<"&&(y="-0"),o=`${l+h}.${f}.${m}${y}`):w?o=`>=${h}.0.0${y} <${+h+1}.0.0-0`:g&&(o=`>=${h}.${f}.0${y} <${h}.${+f+1}.0-0`),$("xRange return",o),o})},Sh=(r,i)=>($("replaceStars",r,i),r.trim().replace(K[H.STAR],"")),wh=(r,i)=>($("replaceGTE0",r,i),r.trim().replace(K[i.includePrerelease?H.GTE0PRE:H.GTE0],"")),Ch=r=>(i,n,o,l,h,f,m,y,x,w,g,S)=>(U(o)?n="":U(l)?n=`>=${o}.0.0${r?"-0":""}`:U(h)?n=`>=${o}.${l}.0${r?"-0":""}`:f?n=`>=${n}`:n=`>=${n}${r?"-0":""}`,U(x)?y="":U(w)?y=`<${+x+1}.0.0-0`:U(g)?y=`<${x}.${+w+1}.0-0`:S?y=`<=${x}.${w}.${g}-${S}`:r?y=`<${x}.${w}.${+g+1}-0`:y=`<=${y}`,`${n} ${y}`.trim()),_h=(r,i,n)=>{for(let o=0;o<r.length;o++)if(!r[o].test(i))return!1;if(i.prerelease.length&&!n.includePrerelease){for(let o=0;o<r.length;o++)if($(r[o].semver),r[o].semver!==xi.ANY&&r[o].semver.prerelease.length>0){let l=r[o].semver;if(l.major===i.major&&l.minor===i.minor&&l.patch===i.patch)return!0}return!1}return!0}});var ze=C((Dp,Vn)=>{"use strict";var Ke=Symbol("SemVer ANY"),yi=class r{static get ANY(){return Ke}constructor(i,n){if(n=Pn(n),i instanceof r){if(i.loose===!!n.loose)return i;i=i.value}i=i.trim().split(/\s+/).join(" "),vi("comparator",i,n),this.options=n,this.loose=!!n.loose,this.parse(i),this.semver===Ke?this.value="":this.value=this.operator+this.semver.version,vi("comp",this)}parse(i){let n=this.options.loose?Tn[Ln.COMPARATORLOOSE]:Tn[Ln.COMPARATOR],o=i.match(n);if(!o)throw new TypeError(`Invalid comparator: ${i}`);this.operator=o[1]!==void 0?o[1]:"",this.operator==="="&&(this.operator=""),o[2]?this.semver=new On(o[2],this.options.loose):this.semver=Ke}toString(){return this.value}test(i){if(vi("Comparator.test",i,this.options.loose),this.semver===Ke||i===Ke)return!0;if(typeof i=="string")try{i=new On(i,this.options)}catch{return!1}return gi(i,this.operator,this.semver,this.options)}intersects(i,n){if(!(i instanceof r))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Fn(i.value,n).test(this.value):i.operator===""?i.value===""?!0:new Fn(this.value,n).test(i.semver):(n=Pn(n),n.includePrerelease&&(this.value==="<0.0.0-0"||i.value==="<0.0.0-0")||!n.includePrerelease&&(this.value.startsWith("<0.0.0")||i.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&i.operator.startsWith(">")||this.operator.startsWith("<")&&i.operator.startsWith("<")||this.semver.version===i.semver.version&&this.operator.includes("=")&&i.operator.includes("=")||gi(this.semver,"<",i.semver,n)&&this.operator.startsWith(">")&&i.operator.startsWith("<")||gi(this.semver,">",i.semver,n)&&this.operator.startsWith("<")&&i.operator.startsWith(">")))}};Vn.exports=yi;var Pn=ft(),{safeRe:Tn,t:Ln}=Oe(),gi=pi(),vi=We(),On=G(),Fn=se()});var Ye=C(($p,Dn)=>{"use strict";var Ih=se(),kh=(r,i,n)=>{try{i=new Ih(i,n)}catch{return!1}return i.test(r)};Dn.exports=kh});var qn=C((qp,$n)=>{"use strict";var Ah=se(),Nh=(r,i)=>new Ah(r,i).set.map(n=>n.map(o=>o.value).join(" ").trim().split(" "));$n.exports=Nh});var Bn=C((jp,jn)=>{"use strict";var Rh=G(),Ph=se(),Th=(r,i,n)=>{let o=null,l=null,h=null;try{h=new Ph(i,n)}catch{return null}return r.forEach(f=>{h.test(f)&&(!o||l.compare(f)===-1)&&(o=f,l=new Rh(o,n))}),o};jn.exports=Th});var Mn=C((Bp,Un)=>{"use strict";var Lh=G(),Oh=se(),Fh=(r,i,n)=>{let o=null,l=null,h=null;try{h=new Oh(i,n)}catch{return null}return r.forEach(f=>{h.test(f)&&(!o||l.compare(f)===1)&&(o=f,l=new Lh(o,n))}),o};Un.exports=Fh});var Wn=C((Up,Hn)=>{"use strict";var Ei=G(),Vh=se(),Gn=Xe(),Dh=(r,i)=>{r=new Vh(r,i);let n=new Ei("0.0.0");if(r.test(n)||(n=new Ei("0.0.0-0"),r.test(n)))return n;n=null;for(let o=0;o<r.set.length;++o){let l=r.set[o],h=null;l.forEach(f=>{let m=new Ei(f.semver.version);switch(f.operator){case">":m.prerelease.length===0?m.patch++:m.prerelease.push(0),m.raw=m.format();case"":case">=":(!h||Gn(m,h))&&(h=m);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${f.operator}`)}}),h&&(!n||Gn(n,h))&&(n=h)}return n&&r.test(n)?n:null};Hn.exports=Dh});var zn=C((Mp,Xn)=>{"use strict";var $h=se(),qh=(r,i)=>{try{return new $h(r,i).range||"*"}catch{return null}};Xn.exports=qh});var wt=C((Gp,Qn)=>{"use strict";var jh=G(),Jn=ze(),{ANY:Bh}=Jn,Uh=se(),Mh=Ye(),Kn=Xe(),Yn=vt(),Gh=Et(),Hh=yt(),Wh=(r,i,n,o)=>{r=new jh(r,o),i=new Uh(i,o);let l,h,f,m,y;switch(n){case">":l=Kn,h=Gh,f=Yn,m=">",y=">=";break;case"<":l=Yn,h=Hh,f=Kn,m="<",y="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Mh(r,i,o))return!1;for(let x=0;x<i.set.length;++x){let w=i.set[x],g=null,S=null;if(w.forEach(E=>{E.semver===Bh&&(E=new Jn(">=0.0.0")),g=g||E,S=S||E,l(E.semver,g.semver,o)?g=E:f(E.semver,S.semver,o)&&(S=E)}),g.operator===m||g.operator===y||(!S.operator||S.operator===m)&&h(r,S.semver))return!1;if(S.operator===y&&f(r,S.semver))return!1}return!0};Qn.exports=Wh});var ea=C((Hp,Zn)=>{"use strict";var Xh=wt(),zh=(r,i,n)=>Xh(r,i,">",n);Zn.exports=zh});var ia=C((Wp,ta)=>{"use strict";var Kh=wt(),Yh=(r,i,n)=>Kh(r,i,"<",n);ta.exports=Yh});var na=C((Xp,sa)=>{"use strict";var ra=se(),Jh=(r,i,n)=>(r=new ra(r,n),i=new ra(i,n),r.intersects(i,n));sa.exports=Jh});var oa=C((zp,aa)=>{"use strict";var Qh=Ye(),Zh=re();aa.exports=(r,i,n)=>{let o=[],l=null,h=null,f=r.sort((w,g)=>Zh(w,g,n));for(let w of f)Qh(w,i,n)?(h=w,l||(l=w)):(h&&o.push([l,h]),h=null,l=null);l&&o.push([l,null]);let m=[];for(let[w,g]of o)w===g?m.push(w):!g&&w===f[0]?m.push("*"):g?w===f[0]?m.push(`<=${g}`):m.push(`${w} - ${g}`):m.push(`>=${w}`);let y=m.join(" || "),x=typeof i.raw=="string"?i.raw:String(i);return y.length<x.length?y:i}});var pa=C((Kp,fa)=>{"use strict";var ua=se(),wi=ze(),{ANY:bi}=wi,Si=Ye(),Ci=re(),el=(r,i,n={})=>{if(r===i)return!0;r=new ua(r,n),i=new ua(i,n);let o=!1;e:for(let l of r.set){for(let h of i.set){let f=il(l,h,n);if(o=o||f!==null,f)continue e}if(o)return!1}return!0},tl=[new wi(">=0.0.0-0")],ca=[new wi(">=0.0.0")],il=(r,i,n)=>{if(r===i)return!0;if(r.length===1&&r[0].semver===bi){if(i.length===1&&i[0].semver===bi)return!0;n.includePrerelease?r=tl:r=ca}if(i.length===1&&i[0].semver===bi){if(n.includePrerelease)return!0;i=ca}let o=new Set,l,h;for(let E of r)E.operator===">"||E.operator===">="?l=ha(l,E,n):E.operator==="<"||E.operator==="<="?h=la(h,E,n):o.add(E.semver);if(o.size>1)return null;let f;if(l&&h){if(f=Ci(l.semver,h.semver,n),f>0)return null;if(f===0&&(l.operator!==">="||h.operator!=="<="))return null}for(let E of o){if(l&&!Si(E,String(l),n)||h&&!Si(E,String(h),n))return null;for(let k of i)if(!Si(E,String(k),n))return!1;return!0}let m,y,x,w,g=h&&!n.includePrerelease&&h.semver.prerelease.length?h.semver:!1,S=l&&!n.includePrerelease&&l.semver.prerelease.length?l.semver:!1;g&&g.prerelease.length===1&&h.operator==="<"&&g.prerelease[0]===0&&(g=!1);for(let E of i){if(w=w||E.operator===">"||E.operator===">=",x=x||E.operator==="<"||E.operator==="<=",l){if(S&&E.semver.prerelease&&E.semver.prerelease.length&&E.semver.major===S.major&&E.semver.minor===S.minor&&E.semver.patch===S.patch&&(S=!1),E.operator===">"||E.operator===">="){if(m=ha(l,E,n),m===E&&m!==l)return!1}else if(l.operator===">="&&!E.test(l.semver))return!1}if(h){if(g&&E.semver.prerelease&&E.semver.prerelease.length&&E.semver.major===g.major&&E.semver.minor===g.minor&&E.semver.patch===g.patch&&(g=!1),E.operator==="<"||E.operator==="<="){if(y=la(h,E,n),y===E&&y!==h)return!1}else if(h.operator==="<="&&!E.test(h.semver))return!1}if(!E.operator&&(h||l)&&f!==0)return!1}return!(l&&x&&!h&&f!==0||h&&w&&!l&&f!==0||S||g)},ha=(r,i,n)=>{if(!r)return i;let o=Ci(r.semver,i.semver,n);return o>0?r:o<0||i.operator===">"&&r.operator===">="?i:r},la=(r,i,n)=>{if(!r)return i;let o=Ci(r.semver,i.semver,n);return o<0?r:o>0||i.operator==="<"&&r.operator==="<="?i:r};fa.exports=el});var ga=C((Yp,xa)=>{"use strict";var _i=Oe(),da=Le(),rl=G(),ma=ui(),sl=ve(),nl=$s(),al=js(),ol=Ms(),ul=Ws(),cl=zs(),hl=Ys(),ll=Qs(),fl=en(),pl=re(),dl=nn(),ml=on(),xl=gt(),gl=ln(),vl=pn(),yl=Xe(),El=vt(),bl=li(),Sl=fi(),wl=yt(),Cl=Et(),_l=pi(),Il=Sn(),kl=Cn(),Al=ze(),Nl=se(),Rl=Ye(),Pl=qn(),Tl=Bn(),Ll=Mn(),Ol=Wn(),Fl=zn(),Vl=wt(),Dl=ea(),$l=ia(),ql=na(),jl=oa(),Bl=pa();xa.exports={parse:sl,valid:nl,clean:al,inc:ol,diff:ul,major:cl,minor:hl,patch:ll,prerelease:fl,compare:pl,rcompare:dl,compareLoose:ml,compareBuild:xl,sort:gl,rsort:vl,gt:yl,lt:El,eq:bl,neq:Sl,gte:wl,lte:Cl,cmp:_l,coerce:Il,truncate:kl,Comparator:Al,Range:Nl,satisfies:Rl,toComparators:Pl,maxSatisfying:Tl,minSatisfying:Ll,minVersion:Ol,validRange:Fl,outside:Vl,gtr:Dl,ltr:$l,intersects:ql,simplifyRange:jl,subset:Bl,SemVer:rl,re:_i.re,src:_i.src,tokens:_i.t,SEMVER_SPEC_VERSION:da.SEMVER_SPEC_VERSION,RELEASE_TYPES:da.RELEASE_TYPES,compareIdentifiers:ma.compareIdentifiers,rcompareIdentifiers:ma.rcompareIdentifiers}});var Ni=C((Jp,Aa)=>{var ye=require("fs"),ne=require("path"),ya=_s(),ae=ga(),{DEFAULT_API_URL:Ul}=Ge(),Ea=["dependencies","devDependencies","optionalDependencies","peerDependencies"];function Ii(r){let i=typeof r=="string"&&r.match(/^((?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*)(?:@([^\r\n]+))?$/);if(!i)throw new Error(`Invalid npm dependency: ${String(r)}`);return{name:i[1],version:i[2]}}function ki(r){let i=new Map;for(let n of r){let{name:o,version:l}=Ii(n),h=i.get(o);i.set(o,h&&l?ba(o,h,l):l||h)}return i}function ba(r,i,n){if(i===n)return i;let o=ae.validRange(i),l=ae.validRange(n);if(o&&l)try{if(ae.subset(l,o))return n;if(ae.subset(o,l))return i}catch{}throw new Error(`Conflicting registry versions for ${r}: ${i} and ${n}`)}function Ml(r,i){let n=typeof r=="string"&&ae.validRange(r),o=ae.validRange(i);if(!n||!o)return!1;try{return ae.subset(n,o)}catch{return!1}}function _t(r,i){if(Ml(r,i))return"satisfied";let n=typeof r=="string"&&ae.validRange(r),o=ae.validRange(i);if(!n||!o)return"incomparable";try{let l=ae.minVersion(n),h=ae.minVersion(o);return!l||!h?"incomparable":ae.lt(l,h)?"lower":"newer"}catch{return"incomparable"}}function Ct(r,i){let n=Ea.find(o=>Object.hasOwn(r[o]||{},i));return n?{section:n,existing:r[n][i]}:null}function Sa(r,i){let n=ki(i);if(n.size===0)return;let o=ne.join(r,"package.json"),l=JSON.parse(ye.readFileSync(o,"utf8"));for(let[h,f]of n){let m=Ct(l,h),y=m?.section||"dependencies";l[y]||={};let x=m?.existing;l[y][h]=x===void 0?f||"latest":f&&_t(x,f)==="lower"?f:x}ye.writeFileSync(o,`${JSON.stringify(l,null,2)}
|
|
3
3
|
`)}function It(r){let i=[["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["bun.lock","bun"],["bun.lockb","bun"],["package-lock.json","npm"],["npm-shrinkwrap.json","npm"]];for(let n=ne.resolve(r);;n=ne.dirname(n)){let o=ne.join(n,"package.json");if(ye.existsSync(o)){let l=JSON.parse(ye.readFileSync(o,"utf8")),h=String(l.packageManager||"").split("@")[0];if(["npm","pnpm","yarn","bun"].includes(h))return h}for(let[l,h]of i)if(ye.existsSync(ne.join(n,l)))return h;if(ne.dirname(n)===n)return"npm"}}var va={npm:"npx",pnpm:"pnpm exec",yarn:"yarn",bun:"bunx"};function wa(r,i=process.cwd()){let n;try{n=It(i)}catch{n="npm"}return`${va[n]||va.npm} frontfriend ${r}`}function Gl(r,i=process.cwd()){let n=null;try{n=r?new URL(r).origin:null}catch{n=null}return wa(n&&n!==new URL(Ul).origin?`login --api-url ${n}`:"login",i)}function Ca(r){return JSON.parse(ye.readFileSync(ne.join(r,"package.json"),"utf8"))}function Ai(r,i){let n=ki(i);if(n.size===0)return[];let o=Ca(r),l=[];for(let[h,f]of n){let m=Ct(o,h);m&&(!f||_t(m.existing,f)!=="lower")||l.push(f?`${h}@${f}`:h)}return l}function Hl(r,i){let n=i.filter(g=>g.required),o=ki(n.flatMap(g=>g.dependencies)),l=(g,S)=>S.filter(E=>E.dependencies.some(k=>Ii(k).name===g)).map(E=>E.component).filter(Boolean),h=i.filter(g=>!g.required);if(o.size===0&&h.length===0)return{missing:[],kept:[],repair:[]};let f=Ca(r),m=[],y=[];for(let[g,S]of o){let E=Ct(f,g);if(!E){m.push(S?`${g}@${S}`:g);continue}if(!S)continue;let k=_t(E.existing,S);k==="lower"?m.push(`${g}@${S}`):k!=="satisfied"&&y.push({name:g,current:E.existing,declared:S,components:l(g,n)})}let x=new Map;for(let g of h.flatMap(S=>S.dependencies)){let{name:S,version:E}=Ii(g);if(o.has(S)||Ct(f,S))continue;let k=x.get(S),B=E||k?.version;if(k?.version&&E&&k.version!==E)try{B=ba(S,k.version,E)}catch{B=k.version}x.set(S,{version:B})}let w=[...x].map(([g,{version:S}])=>({request:S?`${g}@${S}`:g,components:l(g,h)}));return{missing:m,kept:y,repair:w}}function _a(r,i){return[r==="npm"?"install":"add",...i]}function Wl(r){return/^[\w@/.:^~=+-]+$/.test(r)?r:`'${r.replace(/'/g,"'\\''")}'`}function Ia(r,i){let n=It(r);return[n,..._a(n,i)].map(Wl).join(" ")}function ka(r,i,{stdio:n="inherit"}={}){let o=Ai(r,i);if(o.length===0)return;let l=It(r),h=ya.sync(l,_a(l,o),{cwd:r,stdio:n});if(h.error||h.status!==0)throw Sa(r,i),h.error||new Error(`${l} dependency installation failed with status ${h.status}. Dependencies were saved; run ${l} install.`)}function Xl(r,i,{install:n=!0,stdio:o="inherit",log:l=console.log}={}){let h=Ai(r,i);if(h.length===0)return{missing:h,command:null,installed:!1};let f=Ia(r,h);if(!n)return l(`\u{1F4E6} Component dependencies missing from package.json. Install them with:
|
|
4
4
|
${f}`),{missing:h,command:f,installed:!1};l(`\u{1F4E6} Installing component dependencies: ${f}`);try{return ka(r,h,{stdio:o}),{missing:h,command:f,installed:!0}}catch(m){return l(`\u26A0\uFE0F Component dependencies were not installed: ${m.message}
|
package/package.json
CHANGED