@telia-ace/alliance-internal-node-utilities 2.0.2-next.0 → 4.0.0-next.10
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/dist/{chunk-MR24SBVV.js → chunk-COPUUGH4.js} +1 -1
- package/dist/chunk-FUASCPVV.js +72 -0
- package/dist/compile-distribution.js +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -2
- package/dist/prompt-OL4WUW3W.js +47 -0
- package/package.json +3 -3
- package/dist/chunk-LXRLKYBE.js +0 -72
- package/dist/prompt-H2QHG6LU.js +0 -47
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as c__createRequire } from 'node:module';
|
|
3
3
|
const require = c__createRequire(import.meta.url);
|
|
4
|
-
import{a as h,b as p,c as x,d as y,e as S,g as j,i as I}from"./chunk-
|
|
5
|
-
`)}function O(e,o=[],t=""){e._errors?.length&&o.push(`${t} - ${e._errors.join(" + ")}`);for(let[r,i]of Object.entries(e))r==="_errors"||!i||typeof i!="object"||Array.isArray(i)||O(i,o,t?`${t}.${r}`:r);return o}function K(e){return Array.isArray(e)?e:e===void 0?[]:[e]}function T(e,o=""){let t=[];for(let r of e)for(let[i,n]of r.entries())t[i]=Math.max(t[i]||0,n.length);return e.map(r=>r.map((i,n)=>o+i[n===0?"padStart":"padEnd"](t[n])).join(" ")).join(`
|
|
4
|
+
import{a as h,b as p,c as x,d as y,e as S,g as j,i as I}from"./chunk-FUASCPVV.js";import"./chunk-COPUUGH4.js";import{existsSync as ce,mkdirSync as le,readFileSync as L,writeFileSync as P}from"fs";import{relative as ue,resolve as w}from"path";var B=h.enum(["necessary","functional","analytics","marketing"]),G=h.object({purpose:h.string().describe("Purpose of the storing the value."),category:B.describe("Category of the storage value - necessary, functional, analytics or marketing."),lifespan:h.string().describe("Basic description of how long the value will be stored.")}),$=h.record(G.describe("Key used when writing to the storage.")),F=h.object({value:h.string().describe("The localization token default value."),description:h.string().describe("The localization token description.")}),V=h.object({localization:h.record(F.describe("Key used when getting the localized text.")).default({}).describe("Translateable texts used in the app")}),_=h.object({common:h.object({order:h.number().optional().describe("Order of the capability in the common capabilities list."),variant:h.enum(["primary","secondary","expressive","destructive","text","primary-white","secondary-white","expressive-white","tertiary-purple"]).default("secondary").describe("Variant of the capability button.")}).optional().describe("Common capability configuration."),label:h.string().optional().describe("Label for the capability.")}),Y=h.object({name:h.string().describe("URL friendly name of the app."),endpoints:h.string().array().default([]).describe("Endpoints that should be communicated with using the API gateway."),permissions:h.string().array().default([]).describe("Permissions that can be added to user roles."),resources:V.default({}).describe("Resources used by the app."),storage:$.default({}).describe("Cookies, session storage, and local storage values that are used by the app."),capabilities:h.record(_.describe("Capability key.")).default({}).describe("Capabilities that the app has.")}).passthrough();function D(e,o){let t=Y.safeParse(e);return t.success?t.data:O(t.error.format(),o?[o]:[]).join(`
|
|
5
|
+
`)}function O(e,o=[],t=""){e._errors?.length&&o.push(`${t} - ${e._errors.join(" + ")}`);for(let[r,i]of Object.entries(e))r==="_errors"||!i||typeof i!="object"||Array.isArray(i)||O(i,o,t?`${t}.${r}`:r);return o}import"tty";function K(e){return Array.isArray(e)?e:e===void 0?[]:[e]}function T(e,o=""){let t=[];for(let r of e)for(let[i,n]of r.entries())t[i]=Math.max(t[i]||0,n.length);return e.map(r=>r.map((i,n)=>o+i[n===0?"padStart":"padEnd"](t[n])).join(" ")).join(`
|
|
6
6
|
`)}function m(e){return typeof e=="function"?e():e}var b=class extends Error{constructor(o,t){super(o),this.code=t,this.name="CLIError"}},J=/\d/,Z=["-","_","/","."];function X(e=""){if(!J.test(e))return e!==e.toLowerCase()}function N(e,o){let t=o??Z,r=[];if(!e||typeof e!="string")return r;let i="",n,u;for(let a of e){let s=t.includes(a);if(s===!0){r.push(i),i="",n=void 0;continue}let c=X(a);if(u===!1){if(n===!1&&c===!0){r.push(i),i=a,n=c;continue}if(n===!0&&c===!1&&i.length>1){let f=i.at(-1);r.push(i.slice(0,Math.max(0,i.length-1))),i=f+a,n=c;continue}}i+=a,n=c,u=s}return r.push(i),r}function W(e){return e?e[0].toUpperCase()+e.slice(1):""}function Q(e){return e?e[0].toLowerCase()+e.slice(1):""}function ee(e,o){return e?(Array.isArray(e)?e:N(e)).map(t=>W(o?.normalize?t.toLowerCase():t)).join(""):""}function oe(e,o){return Q(ee(e||"",o))}function te(e,o){return e?(Array.isArray(e)?e:N(e)).map(t=>t.toLowerCase()).join(o??"-"):""}function E(e){return e==null?[]:Array.isArray(e)?e:[e]}function ie(e,o,t,r){let i,n=e[o],u=~r.string.indexOf(o)?t==null||t===!0?"":String(t):typeof t=="boolean"?t:~r.boolean.indexOf(o)?t==="false"?!1:t==="true"||(e._.push((i=+t,i*0===0?i:t)),!!t):(i=+t,i*0===0?i:t);e[o]=n==null?u:Array.isArray(n)?n.concat(u):[n,u]}function re(e=[],o={}){let t,r,i,n,u,a={_:[]},s=0,c=0,f=0,A=e.length,C=o.alias!==void 0,l=o.unknown!==void 0,d=o.default!==void 0;if(o.alias=o.alias||{},o.string=E(o.string),o.boolean=E(o.boolean),C)for(t in o.alias)for(r=o.alias[t]=E(o.alias[t]),s=0;s<r.length;s++)(o.alias[r[s]]=r.concat(t)).splice(s,1);for(s=o.boolean.length;s-- >0;)for(r=o.alias[o.boolean[s]]||[],c=r.length;c-- >0;)o.boolean.push(r[c]);for(s=o.string.length;s-- >0;)for(r=o.alias[o.string[s]]||[],c=r.length;c-- >0;)o.string.push(r[c]);if(d){for(t in o.default)if(n=typeof o.default[t],r=o.alias[t]=o.alias[t]||[],o[n]!==void 0)for(o[n].push(t),s=0;s<r.length;s++)o[n].push(r[s])}let g=l?Object.keys(o.alias):[];for(s=0;s<A;s++){if(i=e[s],i==="--"){a._=a._.concat(e.slice(++s));break}for(c=0;c<i.length&&i.charCodeAt(c)===45;c++);if(c===0)a._.push(i);else if(i.substring(c,c+3)==="no-"){if(n=i.slice(Math.max(0,c+3)),l&&!~g.indexOf(n))return o.unknown(i);a[n]=!1}else{for(f=c+1;f<i.length&&i.charCodeAt(f)!==61;f++);for(n=i.substring(c,f),u=i.slice(Math.max(0,++f))||s+1===A||(""+e[s+1]).charCodeAt(0)===45||e[++s],r=c===2?[n]:n,f=0;f<r.length;f++){if(n=r[f],l&&!~g.indexOf(n))return o.unknown("-".repeat(c)+n);ie(a,n,f+1<r.length||u,o)}}}if(d)for(t in o.default)a[t]===void 0&&(a[t]=o.default[t]);if(C)for(t in a)for(r=o.alias[t]||[];r.length>0;)a[r.shift()]=a[t];return a}function ae(e,o){let t={boolean:[],string:[],mixed:[],alias:{},default:{}},r=U(o);for(let a of r)a.type!=="positional"&&(a.type==="string"?t.string.push(a.name):a.type==="boolean"&&t.boolean.push(a.name),a.default!==void 0&&(t.default[a.name]=a.default),a.alias&&(t.alias[a.name]=a.alias));let i=re(e,t),[...n]=i._,u=new Proxy(i,{get(a,s){return a[s]??a[oe(s)]??a[te(s)]}});for(let[,a]of r.entries())if(a.type==="positional"){let s=n.shift();if(s!==void 0)u[a.name]=s;else{if(a.default===void 0&&a.required!==!1)throw new b(`Missing required positional argument: ${a.name.toUpperCase()}`,"EARG");u[a.name]=a.default}}else if(a.required&&u[a.name]===void 0)throw new b(`Missing required argument: --${a.name}`,"EARG");return u}function U(e){let o=[];for(let[t,r]of Object.entries(e||{}))o.push({...r,name:t,alias:K(r.alias)});return o}async function R(e,o){let t=await m(e.args||{}),r=ae(o.rawArgs,t),i={rawArgs:o.rawArgs,args:r,data:o.data,cmd:e};typeof e.setup=="function"&&await e.setup(i);let n;try{let u=await m(e.subCommands);if(u&&Object.keys(u).length>0){let a=o.rawArgs.findIndex(c=>!c.startsWith("-")),s=o.rawArgs[a];if(s){if(!u[s])throw new b(`Unknown command \`${s}\``,"E_UNKNOWN_COMMAND");let c=await m(u[s]);c&&await R(c,{rawArgs:o.rawArgs.slice(a+1)})}else if(!e.run)throw new b("No command specified.","E_NO_COMMAND")}typeof e.run=="function"&&(n=await e.run(i))}finally{typeof e.cleanup=="function"&&await e.cleanup(i)}return{result:n}}async function M(e,o,t){let r=await m(e.subCommands);if(r&&Object.keys(r).length>0){let i=o.findIndex(a=>!a.startsWith("-")),n=o[i],u=await m(r[n]);if(u)return M(u,o.slice(i+1),e)}return[e,t]}async function ne(e,o){try{y.log(await se(e,o)+`
|
|
7
7
|
`)}catch(t){y.error(t)}}async function se(e,o){let t=await m(e.meta||{}),r=U(await m(e.args||{})),i=await m(o?.meta||{}),n=`${i.name?`${i.name} `:""}`+(t.name||process.argv[1]),u=[],a=[],s=[],c=[];for(let l of r)if(l.type==="positional"){let d=l.name.toUpperCase(),g=l.required!==!1&&l.default===void 0,k=l.default?`="${l.default}"`:"";a.push(["`"+d+k+"`",l.description||"",l.valueHint?`<${l.valueHint}>`:""]),c.push(g?`<${d}>`:`[${d}]`)}else{let d=l.required===!0&&l.default===void 0,g=(l.type==="boolean"&&l.default===!0?[...(l.alias||[]).map(k=>`--no-${k}`),`--no-${l.name}`].join(", "):[...(l.alias||[]).map(k=>`-${k}`),`--${l.name}`].join(", "))+(l.type==="string"&&(l.valueHint||l.default)?`=${l.valueHint?`<${l.valueHint}>`:`"${l.default||""}"`}`:"");u.push(["`"+g+(d?" (required)":"")+"`",l.description||""]),d&&c.push(g)}if(e.subCommands){let l=[],d=await m(e.subCommands);for(let[g,k]of Object.entries(d)){let z=await m(k),H=await m(z?.meta);s.push([`\`${g}\``,H?.description||""]),l.push(g)}c.push(l.join("|"))}let f=[],A=t.version||i.version;f.push(p.gray(`${t.description} (${n+(A?` v${A}`:"")})`),"");let C=u.length>0||a.length>0;return f.push(`${p.underline(p.bold("USAGE"))} \`${n}${C?" [OPTIONS]":""} ${c.join(" ")}\``,""),a.length>0&&(f.push(p.underline(p.bold("ARGUMENTS")),""),f.push(T(a," ")),f.push("")),u.length>0&&(f.push(p.underline(p.bold("OPTIONS")),""),f.push(T(u," ")),f.push("")),s.length>0&&(f.push(p.underline(p.bold("COMMANDS")),""),f.push(T(s," ")),f.push("",`Use \`${n} <command> --help\` for more information about a command.`)),f.filter(l=>typeof l=="string").join(`
|
|
8
8
|
`)}async function q(e,o={}){let t=o.rawArgs||process.argv.slice(2),r=o.showUsage||ne;try{if(t.includes("--help")||t.includes("-h"))await r(...await M(e,t)),process.exit(0);else if(t.length===1&&t[0]==="--version"){let i=typeof e.meta=="function"?await e.meta():await e.meta;if(!i?.version)throw new b("No version specified","E_NO_VERSION");y.log(i.version)}else await R(e,{rawArgs:t})}catch(i){let n=i instanceof b;n||y.error(i,`
|
package/dist/index.d.ts
CHANGED
|
@@ -147,7 +147,8 @@ declare enum AllianceHeaders {
|
|
|
147
147
|
TargetApp = "alliance-target-app",
|
|
148
148
|
TargetWorkspace = "alliance-target-workspace",
|
|
149
149
|
TargetOrganization = "alliance-target-organization",
|
|
150
|
-
TargetProxy = "alliance-target-proxy"
|
|
150
|
+
TargetProxy = "alliance-target-proxy",
|
|
151
|
+
Language = "alliance-language"
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
declare function createIndexHtml(apps: AppImportInfo[]): string;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as c__createRequire } from 'node:module';
|
|
2
2
|
const require = c__createRequire(import.meta.url);
|
|
3
|
-
import{a as C,f as ce,g as ge,h as
|
|
3
|
+
import{a as C,f as ce,g as ge,h as P,i as le}from"./chunk-FUASCPVV.js";import"./chunk-COPUUGH4.js";import{createPublicKey as fe}from"crypto";import pe from"jsonwebtoken";var me=C.enum(["true","false"]).transform(e=>e==="true"),I=C.string().min(1),K=C.object({AUTH_COOKIE_NAME:I.default("alliance-auth"),AUTH_COOKIE_SECRET:I.default("zlLZBlk7wt8lypP5lA4D"),DB_ENDPOINT:I,JWT_PRIVATE_KEY:I.default("MIIEogIBAAKCAQEAsGqOzjnfQtCYlDqhgGAnKuJOCiPt2WpCmL1Cs+SLBQlyoNn6LT8BJ6ZRj8t/vK8Sw0p51Uq/3k0tazh7bLGkWNMBLY3BqFiNRMMnCqHJfvGIUi/itNXNe2kbP7H3rbyQTu4O7yH/ZAMitdpF2KLucVRlFxrQ/ggZjxwEGso4JUnCwmAnoKct/uupKz9Y2PMTr00WWN79aPfD4LcKi570VJqBT3ISSucdwFLYNqnOkQnEa8O8xbthQhiI0k1GGJT+GCQcATUPeEbaCFXonOrJm+CyuMmQWYLFF3NbE5NllU1jz9PYHzp2hAgAx8WGeretTvpEA1dE2gvXNESGbQ8FxQIDAQABAoIBAAjTJmud1348eGAfLV8CRaij2MAxxenJ9/ozVXfcPIa2+fCelsuBSv8pwbYODvNoVT7xpcs2nwccGI6JgnBl09EhqlMWCT7w7GLT2aBy3A/T6JF76xJICQGzDfWPYygMtlyhv0YqZDUjjFlJHun+/ysqIUMY81AR0FLUAEc6yw41ChcdSvTgIqBM9f5PsBRK7zOgdW1vcVQiZbf2Vqr+7wTJ+6b9A4rWnnAqesGDXqYupx3UJEu3x0wRNQB8FeiG9iJrw4cyD9SmM95doTyKosQ2PWWnUO1NMgmWCR/mWcKZAUcfZUpnQ8rz75WAWept8ZIOOdha8UZ1B/kw3EsVdEECgYEA3iN0BRUqMN0J69bazvlNOWtI+Chc1lYMt/tZ4p78pIJpAZvc3rQ9lAp6JvOEno2IglULA4I+ZLUmpz+lfu7XxKMNOI3cnG7WdiGbiIlwOSwuxzeO1FJqhtnc0U6mNkIjptV8b2etj8U2/SXAC3CC8XgsawAj9A/I7awlCL3NXdECgYEAy07gun3rcd3Y0ISmd3+SbAn/MbGf8uRLcfSc2ls9B6m3pXj25prXJWIrB6DyGuL/HQmHzffQkOeXmwFGHFXyiIFOIITX4z8b9lMnavgUZoPDY+ZFsxp6I7vMn75AetB8wYXpOFFeCG/Ck/VSIYP7oAN8kLw8EHdOuNbZYbu34bUCgYBYd14ZOBiZZS4yUlrJ2tc6atOgoNJ4OcTO8LcXXaHYEmenUF9iAf4UGygSoyDJ1CvtW9kLCK+4g7xlFx/dsVkU4qq9PyIA2tNmMHQ0qCedXU8z35huTnRGSDV81gmzyhtQsezgoTWp8Cy6HHKjG6fKasWlx2SKKk8m+Eu3c396QQKBgBMY2asq4M7VU+RiUXCwHwTe+4Wjda7PGvcdTw6Du3vYyVNVxXtr2AG+8uPIjnVQFT6ZApSqToEOAAOjXv6SZDHGU5xiXhUOfIXq0a0OmHv4rIXZv3pPZmGs5k+rA0uGAfH7riiIHBkWxmQ3ivty9lPVgAHobIvvaQmbxNeVVnRxAoGAUzUmcBiUAiODfjulrpYvWG0tCn5B//yk7g1Tm3Chrh9huA1qGEN3jDoqSsTd5k4Yi5foyAZt5ORgoiUVm4IsfS56aoxIco1CtFG3zeMQRy4uKzTsvUTOdsJ4RlQdjNwpngXR44VL0WelgCDqTqJwn5ubzPvuIHuTj3cBpmJCjOo="),JWT_PUBLIC_CSP_KEY:C.string().min(1).default("BgIAAACkAABSU0ExAAgAAAEAAQDFBQ9thkQ01wvaRFcDRPpOrbd6hsXHAAiEdjof2NPPY02VZZMTW3MXxYJZkMm4suCbyeqc6FUI2kZ4DzUBHCQY/pQYRk3SiBhCYbvFvMNrxAmRzqk22FLAHedKEnJPgZpU9J6LCrfgw/do/d5YFk2vE/PYWD8rqev+LaegJ2DCwkklOMoaBByPGQj+0BoXZVRx7qLYRdq1IgNk/yHvDu5OkLyt97E/G2l7zdW04i9SiPF+yaEKJ8NEjViowY0tAdNYpLFsezhrLU3ev0rVeUrDEq+8f8uPUaYnAT8t+tmgcgkFi+SzQr2YQmrZ7SMKTuIqJ2CAoTqUmNBC3znOjmqw"),SERVICE_LOG_LEVEL:C.enum(["silent","fatal","error","warn","info","debug","trace"]).default("trace"),SERVICE_PORT:I.transform(Number).default("3000"),REDIS_HOST:I,REDIS_PASSWORD:I.optional()});var S=(m=>(m.TargetUrl="alliance-target-url",m.TargetApp="alliance-target-app",m.TargetWorkspace="alliance-target-workspace",m.TargetOrganization="alliance-target-organization",m.TargetProxy="alliance-target-proxy",m.Language="alliance-language",m))(S||{});var Xe=K.pick({JWT_PRIVATE_KEY:!0,JWT_PUBLIC_CSP_KEY:!0});function de({privateKey:e,audience:t,user:n,workspace:u,organization:g,expiration:l="1h"}){return`Bearer ${pe.sign({iss:"Alliance",aud:t,sub:n.id,firstName:n.firstName,lastName:n.lastName,accessToken:n.accessToken,email:n.email,permissions:n.permissions,workspace:u.slug,organization:g.slug,workspaceName:u.name},e,{expiresIn:l,algorithm:"RS256"})}`}function V(e){return`-----BEGIN RSA PRIVATE KEY-----
|
|
4
4
|
${e.JWT_PRIVATE_KEY}
|
|
5
5
|
-----END RSA PRIVATE KEY-----`}function ve(e){let t=V(e),n=fe(t);return{pkcs:n.export({type:"pkcs1",format:"pem"}).toString().trim(),spki:n.export({type:"spki",format:"pem"}).toString().trim(),csp:e.JWT_PUBLIC_CSP_KEY}}function ye(e,t){return t[e].replace("-----BEGIN RSA PUBLIC KEY-----","").replace("-----END RSA PUBLIC KEY-----","").replace("-----BEGIN PUBLIC KEY-----","").replace("-----END PUBLIC KEY-----","").trim().replaceAll(`
|
|
6
|
-
`,"")}var W=(i=>(i[i.NoObjectId=10001]="NoObjectId",i[i.NoTargetAppHeader=10002]="NoTargetAppHeader",i[i.NoTargetWorkspaceHeader=10003]="NoTargetWorkspaceHeader",i[i.NoManifest=10006]="NoManifest",i[i.NoRequestContext=10007]="NoRequestContext",i[i.NoUserInRequestContext=10008]="NoUserInRequestContext",i[i.NoAppInRequestContext=10009]="NoAppInRequestContext",i[i.NoWorkspaceInRequestContext=10010]="NoWorkspaceInRequestContext",i[i.NoUserPermissionsInRequestContext=10012]="NoUserPermissionsInRequestContext",i[i.WorkspacePermissionDenied=10013]="WorkspacePermissionDenied",i[i.NoTargetUrlHeader=10014]="NoTargetUrlHeader",i[i.NoSessionInRedisCache=10015]="NoSessionInRedisCache",i[i.ProhibitedTargetDomain=10016]="ProhibitedTargetDomain",i[i.NoOrganizationInRequestContext=10017]="NoOrganizationInRequestContext",i))(W||{}),F=(n=>(n[n.NoPublicKey=11e3]="NoPublicKey",n[n.NoAuthHeader=11001]="NoAuthHeader",n))(F||{});var Y={10001:{statusCode:401,msg:"No object id available on authenticated user."},10002:{statusCode:400,msg:"Request missing header 'alliance-target-app'."},10003:{statusCode:400,msg:"Request missing header 'alliance-target-workspace'."},10014:{statusCode:400,msg:"Request missing header 'alliance-target-url'."},10015:{statusCode:401,msg:"Could not find user session in Redis server."},10006:{statusCode:500,msg:"Could not find manifest for app '{{appSlug}}'."},10007:{statusCode:500,msg:"No request context."},10008:{statusCode:500,msg:"No user in request context."},10009:{statusCode:500,msg:"No app in request context."},10010:{statusCode:500,msg:"No workspace in request context."},10017:{statusCode:500,msg:"No organization in request context."},10012:{statusCode:500,msg:"No user permissions in request context."},10013:{statusCode:403,msg:"User does not have access to the current workspace."},10016:{statusCode:403,msg:"Request prohibited - REQUEST_DOMAIN_WHITE_LIST does not contain '{{domain}}'."},11e3:{statusCode:401,msg:"No public key available to decode JWT."},11001:{statusCode:401,msg:"No authorization header found."},12e3:{statusCode:401,msg:"No object id found in user claims."}};var z=class extends Error{constructor(n,u={}){let{msg:l,statusCode:g}=Y[n],p=he(l,u);super(p);this.errorCode=n;this.message=p,this.statusCode=g,this.info=`https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${this.errorCode}`}info;statusCode};function he(e,t){return Object.entries(t).reduce((n,[u,l])=>n.replaceAll(`{{${u}}}`,l),e)}function Ie(e){return(t,n,u,l)=>{let g={cause:t.cause,message:t.message,status:t.status||t.statusCode||t.code,info:t.info};e.error("error when processing request",{url:n.url,body:n.body,error:g}),u.status(g.status).json(g)}}import{homedir as Be,tmpdir as Oe}from"node:os";import{resolve as ke}from"node:path";function we(e){return!e||typeof e.then!="function"?Promise.resolve(e):e}function m(e,...t){try{return we(e(...t))}catch(n){return Promise.reject(n)}}function xe(e){let t=typeof e;return e===null||t!=="object"&&t!=="function"}function Ce(e){let t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}function R(e){if(xe(e))return String(e);if(Ce(e)||Array.isArray(e))return JSON.stringify(e);if(typeof e.toJSON=="function")return R(e.toJSON());throw new Error("[unstorage] Cannot stringify value!")}var L="base64:";function _(e){return typeof e=="string"?e:L+Ae(e)}function J(e){return typeof e!="string"||!e.startsWith(L)?e:Ee(e.slice(L.length))}function Ee(e){return globalThis.Buffer?Buffer.from(e,"base64"):Uint8Array.from(globalThis.atob(e),t=>t.codePointAt(0))}function Ae(e){return globalThis.Buffer?Buffer.from(e).toString("base64"):globalThis.btoa(String.fromCodePoint(...e))}var Pe=["has","hasItem","get","getItem","getItemRaw","set","setItem","setItemRaw","del","remove","removeItem","getMeta","setMeta","removeMeta","getKeys","clear","mount","unmount"];function B(e,t){if(t=E(t),!t)return e;let n={...e};for(let u of Pe)n[u]=(l="",...g)=>e[u](t+l,...g);return n.getKeys=(u="",...l)=>e.getKeys(t+u,...l).then(g=>g.map(p=>p.slice(t.length))),n}function f(e){return e&&e.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function H(...e){return f(e.join(":"))}function E(e){return e=f(e),e?e+":":""}function Q(e,t){if(t===void 0)return!0;let n=0,u=e.indexOf(":");for(;u>-1;)n++,u=e.indexOf(":",u+1);return n<=t}function G(e,t){return t?e.startsWith(t)&&e[e.length-1]!=="$":e[e.length-1]!=="$"}var Ne="memory",Re=()=>{let e=new Map;return{name:Ne,getInstance:()=>e,hasItem(t){return e.has(t)},getItem(t){return e.get(t)??null},getItemRaw(t){return e.get(t)??null},setItem(t,n){e.set(t,n)},setItemRaw(t,n){e.set(t,n)},removeItem(t){e.delete(t)},getKeys(){return[...e.keys()]},clear(){e.clear()},dispose(){e.clear()}}};function $(e={}){let t={mounts:{"":e.driver||Re()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=r=>{for(let o of t.mountpoints)if(r.startsWith(o))return{base:o,relativeKey:r.slice(o.length),driver:t.mounts[o]};return{base:"",relativeKey:r,driver:t.mounts[""]}},u=(r,o)=>t.mountpoints.filter(s=>s.startsWith(r)||o&&r.startsWith(s)).map(s=>({relativeBase:r.length>s.length?r.slice(s.length):void 0,mountpoint:s,driver:t.mounts[s]})),l=(r,o)=>{if(t.watching){o=f(o);for(let s of t.watchListeners)s(r,o)}},g=async()=>{if(!t.watching){t.watching=!0;for(let r in t.mounts)t.unwatch[r]=await Z(t.mounts[r],l,r)}},p=async()=>{if(t.watching){for(let r in t.unwatch)await t.unwatch[r]();t.unwatch={},t.watching=!1}},x=(r,o,s)=>{let a=new Map,c=i=>{let v=a.get(i.base);return v||(v={driver:i.driver,base:i.base,items:[]},a.set(i.base,v)),v};for(let i of r){let v=typeof i=="string",y=f(v?i:i.key),b=v?void 0:i.value,A=v||!i.options?o:{...o,...i.options},P=n(y);c(P).items.push({key:y,value:b,relativeKey:P.relativeKey,options:A})}return Promise.all([...a.values()].map(i=>s(i))).then(i=>i.flat())},d={hasItem(r,o={}){r=f(r);let{relativeKey:s,driver:a}=n(r);return m(a.hasItem,s,o)},getItem(r,o={}){r=f(r);let{relativeKey:s,driver:a}=n(r);return m(a.getItem,s,o).then(c=>N(c))},getItems(r,o={}){return x(r,o,s=>s.driver.getItems?m(s.driver.getItems,s.items.map(a=>({key:a.relativeKey,options:a.options})),o).then(a=>a.map(c=>({key:H(s.base,c.key),value:N(c.value)}))):Promise.all(s.items.map(a=>m(s.driver.getItem,a.relativeKey,a.options).then(c=>({key:a.key,value:N(c)})))))},getItemRaw(r,o={}){r=f(r);let{relativeKey:s,driver:a}=n(r);return a.getItemRaw?m(a.getItemRaw,s,o):m(a.getItem,s,o).then(c=>J(c))},async setItem(r,o,s={}){if(o===void 0)return d.removeItem(r);r=f(r);let{relativeKey:a,driver:c}=n(r);c.setItem&&(await m(c.setItem,a,R(o),s),c.watch||l("update",r))},async setItems(r,o){await x(r,o,async s=>{if(s.driver.setItems)return m(s.driver.setItems,s.items.map(a=>({key:a.relativeKey,value:R(a.value),options:a.options})),o);s.driver.setItem&&await Promise.all(s.items.map(a=>m(s.driver.setItem,a.relativeKey,R(a.value),a.options)))})},async setItemRaw(r,o,s={}){if(o===void 0)return d.removeItem(r,s);r=f(r);let{relativeKey:a,driver:c}=n(r);if(c.setItemRaw)await m(c.setItemRaw,a,o,s);else if(c.setItem)await m(c.setItem,a,_(o),s);else return;c.watch||l("update",r)},async removeItem(r,o={}){typeof o=="boolean"&&(o={removeMeta:o}),r=f(r);let{relativeKey:s,driver:a}=n(r);a.removeItem&&(await m(a.removeItem,s,o),(o.removeMeta||o.removeMata)&&await m(a.removeItem,s+"$",o),a.watch||l("remove",r))},async getMeta(r,o={}){typeof o=="boolean"&&(o={nativeOnly:o}),r=f(r);let{relativeKey:s,driver:a}=n(r),c=Object.create(null);if(a.getMeta&&Object.assign(c,await m(a.getMeta,s,o)),!o.nativeOnly){let i=await m(a.getItem,s+"$",o).then(v=>N(v));i&&typeof i=="object"&&(typeof i.atime=="string"&&(i.atime=new Date(i.atime)),typeof i.mtime=="string"&&(i.mtime=new Date(i.mtime)),Object.assign(c,i))}return c},setMeta(r,o,s={}){return this.setItem(r+"$",o,s)},removeMeta(r,o={}){return this.removeItem(r+"$",o)},async getKeys(r,o={}){r=E(r);let s=u(r,!0),a=[],c=[],i=!0;for(let y of s){y.driver.flags?.maxDepth||(i=!1);let b=await m(y.driver.getKeys,y.relativeBase,o);for(let A of b){let P=y.mountpoint+f(A);a.some(ue=>P.startsWith(ue))||c.push(P)}a=[y.mountpoint,...a.filter(A=>!A.startsWith(y.mountpoint))]}let v=o.maxDepth!==void 0&&!i;return c.filter(y=>(!v||Q(y,o.maxDepth))&&G(y,r))},async clear(r,o={}){r=E(r),await Promise.all(u(r,!1).map(async s=>{if(s.driver.clear)return m(s.driver.clear,s.relativeBase,o);if(s.driver.removeItem){let a=await s.driver.getKeys(s.relativeBase||"",o);return Promise.all(a.map(c=>s.driver.removeItem(c,o)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(r=>X(r)))},async watch(r){return await g(),t.watchListeners.push(r),async()=>{t.watchListeners=t.watchListeners.filter(o=>o!==r),t.watchListeners.length===0&&await p()}},async unwatch(){t.watchListeners=[],await p()},mount(r,o){if(r=E(r),r&&t.mounts[r])throw new Error(`already mounted at ${r}`);return r&&(t.mountpoints.push(r),t.mountpoints.sort((s,a)=>a.length-s.length)),t.mounts[r]=o,t.watching&&Promise.resolve(Z(o,l,r)).then(s=>{t.unwatch[r]=s}).catch(console.error),d},async unmount(r,o=!0){r=E(r),!(!r||!t.mounts[r])&&(t.watching&&r in t.unwatch&&(t.unwatch[r]?.(),delete t.unwatch[r]),o&&await X(t.mounts[r]),t.mountpoints=t.mountpoints.filter(s=>s!==r),delete t.mounts[r])},getMount(r=""){r=f(r)+":";let o=n(r);return{driver:o.driver,base:o.base}},getMounts(r="",o={}){return r=f(r),u(r,o.parents).map(a=>({driver:a.driver,base:a.mountpoint}))},keys:(r,o={})=>d.getKeys(r,o),get:(r,o={})=>d.getItem(r,o),set:(r,o,s={})=>d.setItem(r,o,s),has:(r,o={})=>d.hasItem(r,o),del:(r,o={})=>d.removeItem(r,o),remove:(r,o={})=>d.removeItem(r,o)};return d}function Z(e,t,n){return e.watch?e.watch((u,l)=>t(u,n+l)):()=>{}}async function X(e){typeof e.dispose=="function"&&await m(e.dispose)}import{existsSync as be,promises as Ke}from"node:fs";import{resolve as Se,join as ze}from"node:path";function T(e,t,n){let u=new Error(`[unstorage] [${e}] ${t}`,n);return Error.captureStackTrace&&Error.captureStackTrace(u,T),u}function ee(e,t){return Array.isArray(t)?T(e,`Missing some of the required options ${t.map(n=>"`"+n+"`").join(", ")}`):T(e,`Missing required option \`${t}\`.`)}import{existsSync as Te,promises as I}from"node:fs";import{resolve as re,dirname as ne}from"node:path";function O(e){return e.code==="ENOENT"||e.code==="EISDIR"?null:e}function te(e){return e.code==="EEXIST"?null:e}async function k(e,t,n){return await ie(ne(e)),I.writeFile(e,t,n)}function q(e,t){return I.readFile(e,t).catch(O)}function oe(e){return I.unlink(e).catch(O)}function se(e){return I.readdir(e,{withFileTypes:!0}).catch(O).then(t=>t||[])}async function ie(e){Te(e)||(await ie(ne(e)).catch(te),await I.mkdir(e).catch(te))}async function U(e,t,n){if(t&&t(e))return[];let u=await se(e),l=[];return await Promise.all(u.map(async g=>{let p=re(e,g.name);if(g.isDirectory()){if(n===void 0||n>0){let x=await U(p,t,n===void 0?void 0:n-1);l.push(...x.map(d=>g.name+"/"+d))}}else t&&t(g.name)||l.push(g.name)})),l}async function M(e){let t=await se(e);await Promise.all(t.map(n=>{let u=re(e,n.name);return n.isDirectory()?M(u).then(()=>I.rmdir(u)):I.unlink(u)}))}var Le=/\.\.:|\.\.$/,j="fs-lite",ae=(e={})=>{if(!e.base)throw ee(j,"base");e.base=Se(e.base);let t=n=>{if(Le.test(n))throw T(j,`Invalid key: ${JSON.stringify(n)}. It should not contain .. segments`);return ze(e.base,n.replace(/:/g,"/"))};return{name:j,options:e,flags:{maxDepth:!0},hasItem(n){return be(t(n))},getItem(n){return q(t(n),"utf8")},getItemRaw(n){return q(t(n))},async getMeta(n){let{atime:u,mtime:l,size:g,birthtime:p,ctime:x}=await Ke.stat(t(n)).catch(()=>({}));return{atime:u,mtime:l,size:g,birthtime:p,ctime:x}},setItem(n,u){if(!e.readOnly)return k(t(n),u,"utf8")},setItemRaw(n,u){if(!e.readOnly)return k(t(n),u)},removeItem(n){if(!e.readOnly)return oe(t(n))},getKeys(n,u){return U(t("."),e.ignore,u?.maxDepth)},async clear(){e.readOnly||e.noClear||await M(t("."))}}};function qe({prefix:e,logger:t}){return B($({driver:ae({base:Ue({logger:t})})}),e)}function Ue({logger:e}){let t="";try{t=Be()}catch(n){e.error("could not use homedir, trying tmpdir",{error:n?.message})}if(!t)try{t=Oe()}catch(n){e.error("could not use tmpdir, trying process.cwd",{error:n?.message})}if(!t)try{t=process.cwd()}catch(n){e.error("could not use process.cwd, exiting",{error:n?.message}),process.exit(1)}return ke(t,".alliance")}import Me from"pino";function w(e){return t=>(n,u)=>e[t]({...u,msg:n})}function je(e){return D(e,{target:"pino-pretty",options:{colorize:!0,ignore:"time,pid,hostname",messageFormat:"{msg}"}})}function D(e,t){let n=Me({level:e.SERVICE_LOG_LEVEL,redact:["authorization","headers.authorization","req.headers.authorization","res.headers.authorization","req.headers.cookie",'res.headers["set-cookie"]'],transport:t});return{fatal:w(n)("fatal"),error:w(n)("error"),warn:w(n)("warn"),info:w(n)("info"),debug:w(n)("debug"),trace:w(n)("trace"),silent:w(n)("silent"),child:()=>D(e),level:e.SERVICE_LOG_LEVEL}}function De(e){return(t,n,u)=>(e.trace("received request",{url:t.url,params:t.params,query:t.query,body:t.body}),u())}export{z as AllianceError,S as AllianceHeaders,F as DataErrorCode,W as GatewayErrorCode,de as createBearerToken,qe as createFileStorage,ge as createIndexHtml,D as createLogger,je as createPrettyLogger,ve as createPublicKeys,le as getAppManifests,ye as getCleanPublicKey,V as getPrivateKey,Ie as requestErrorHandler,De as requestLoggerHandler,ce as slugify,me as zBooleanEnum,h as zNonEmptyString,K as zSharedConfig};
|
|
6
|
+
`,"")}var W=(i=>(i[i.NoObjectId=10001]="NoObjectId",i[i.NoTargetAppHeader=10002]="NoTargetAppHeader",i[i.NoTargetWorkspaceHeader=10003]="NoTargetWorkspaceHeader",i[i.NoManifest=10006]="NoManifest",i[i.NoRequestContext=10007]="NoRequestContext",i[i.NoUserInRequestContext=10008]="NoUserInRequestContext",i[i.NoAppInRequestContext=10009]="NoAppInRequestContext",i[i.NoWorkspaceInRequestContext=10010]="NoWorkspaceInRequestContext",i[i.NoUserPermissionsInRequestContext=10012]="NoUserPermissionsInRequestContext",i[i.WorkspacePermissionDenied=10013]="WorkspacePermissionDenied",i[i.NoTargetUrlHeader=10014]="NoTargetUrlHeader",i[i.NoSessionInRedisCache=10015]="NoSessionInRedisCache",i[i.ProhibitedTargetDomain=10016]="ProhibitedTargetDomain",i[i.NoOrganizationInRequestContext=10017]="NoOrganizationInRequestContext",i))(W||{}),F=(n=>(n[n.NoPublicKey=11e3]="NoPublicKey",n[n.NoAuthHeader=11001]="NoAuthHeader",n))(F||{});var Y={10001:{statusCode:401,msg:"No object id available on authenticated user."},10002:{statusCode:400,msg:"Request missing header 'alliance-target-app'."},10003:{statusCode:400,msg:"Request missing header 'alliance-target-workspace'."},10014:{statusCode:400,msg:"Request missing header 'alliance-target-url'."},10015:{statusCode:401,msg:"Could not find user session in Redis server."},10006:{statusCode:500,msg:"Could not find manifest for app '{{appSlug}}'."},10007:{statusCode:500,msg:"No request context."},10008:{statusCode:500,msg:"No user in request context."},10009:{statusCode:500,msg:"No app in request context."},10010:{statusCode:500,msg:"No workspace in request context."},10017:{statusCode:500,msg:"No organization in request context."},10012:{statusCode:500,msg:"No user permissions in request context."},10013:{statusCode:403,msg:"User does not have access to the current workspace."},10016:{statusCode:403,msg:"Request prohibited - REQUEST_DOMAIN_WHITE_LIST does not contain '{{domain}}'."},11e3:{statusCode:401,msg:"No public key available to decode JWT."},11001:{statusCode:401,msg:"No authorization header found."},12e3:{statusCode:401,msg:"No object id found in user claims."}};var z=class extends Error{constructor(n,u={}){let{msg:g,statusCode:l}=Y[n],m=he(g,u);super(m);this.errorCode=n;this.message=m,this.statusCode=l,this.info=`https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${this.errorCode}`}info;statusCode};function he(e,t){return Object.entries(t).reduce((n,[u,g])=>n.replaceAll(`{{${u}}}`,g),e)}function Ie(e){let t=[e.status,e.statusCode,e.code];for(let n of t)if(typeof n=="number"&&Number.isInteger(n))return n;return 500}function we(e){return(t,n,u,g)=>{let l={cause:t.cause,message:t.message,status:Ie(t),info:t.info};e.error("error when processing request",{url:n.url,body:n.body,error:l}),u.status(l.status).json(l)}}import{homedir as Be,tmpdir as Oe}from"os";import{resolve as qe}from"path";function xe(e){return!e||typeof e.then!="function"?Promise.resolve(e):e}function f(e,...t){try{return xe(e(...t))}catch(n){return Promise.reject(n)}}function Ce(e){let t=typeof e;return e===null||t!=="object"&&t!=="function"}function Ee(e){let t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}function R(e){if(Ce(e))return String(e);if(Ee(e)||Array.isArray(e))return JSON.stringify(e);if(typeof e.toJSON=="function")return R(e.toJSON());throw new Error("[unstorage] Cannot stringify value!")}var L="base64:";function _(e){return typeof e=="string"?e:L+Ne(e)}function J(e){return typeof e!="string"||!e.startsWith(L)?e:Ae(e.slice(L.length))}function Ae(e){return globalThis.Buffer?Buffer.from(e,"base64"):Uint8Array.from(globalThis.atob(e),t=>t.codePointAt(0))}function Ne(e){return globalThis.Buffer?Buffer.from(e).toString("base64"):globalThis.btoa(String.fromCodePoint(...e))}var Pe=["has","hasItem","get","getItem","getItemRaw","set","setItem","setItemRaw","del","remove","removeItem","getMeta","setMeta","removeMeta","getKeys","clear","mount","unmount"];function k(e,t){if(t=E(t),!t)return e;let n={...e};for(let u of Pe)n[u]=(g="",...l)=>e[u](t+g,...l);return n.getKeys=(u="",...g)=>e.getKeys(t+u,...g).then(l=>l.map(m=>m.slice(t.length))),n.getItems=async(u,g)=>{let l=u.map(d=>typeof d=="string"?t+d:{...d,key:t+d.key});return(await e.getItems(l,g)).map(d=>({key:d.key.slice(t.length),value:d.value}))},n.setItems=async(u,g)=>{let l=u.map(m=>({key:t+m.key,value:m.value,options:m.options}));return e.setItems(l,g)},n}function p(e){return e&&e.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function H(...e){return p(e.join(":"))}function E(e){return e=p(e),e?e+":":""}function Q(e,t){if(t===void 0)return!0;let n=0,u=e.indexOf(":");for(;u>-1;)n++,u=e.indexOf(":",u+1);return n<=t}function G(e,t){return t?e.startsWith(t)&&e[e.length-1]!=="$":e[e.length-1]!=="$"}var Re="memory",Te=()=>{let e=new Map;return{name:Re,getInstance:()=>e,hasItem(t){return e.has(t)},getItem(t){return e.get(t)??null},getItemRaw(t){return e.get(t)??null},setItem(t,n){e.set(t,n)},setItemRaw(t,n){e.set(t,n)},removeItem(t){e.delete(t)},getKeys(){return[...e.keys()]},clear(){e.clear()},dispose(){e.clear()}}};function $(e={}){let t={mounts:{"":e.driver||Te()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=r=>{for(let o of t.mountpoints)if(r.startsWith(o))return{base:o,relativeKey:r.slice(o.length),driver:t.mounts[o]};return{base:"",relativeKey:r,driver:t.mounts[""]}},u=(r,o)=>t.mountpoints.filter(s=>s.startsWith(r)||o&&r.startsWith(s)).map(s=>({relativeBase:r.length>s.length?r.slice(s.length):void 0,mountpoint:s,driver:t.mounts[s]})),g=(r,o)=>{if(t.watching){o=p(o);for(let s of t.watchListeners)s(r,o)}},l=async()=>{if(!t.watching){t.watching=!0;for(let r in t.mounts)t.unwatch[r]=await Z(t.mounts[r],g,r)}},m=async()=>{if(t.watching){for(let r in t.unwatch)await t.unwatch[r]();t.unwatch={},t.watching=!1}},d=(r,o,s)=>{let a=new Map,c=i=>{let y=a.get(i.base);return y||(y={driver:i.driver,base:i.base,items:[]},a.set(i.base,y)),y};for(let i of r){let y=typeof i=="string",h=p(y?i:i.key),b=y?void 0:i.value,A=y||!i.options?o:{...o,...i.options},N=n(h);c(N).items.push({key:h,value:b,relativeKey:N.relativeKey,options:A})}return Promise.all([...a.values()].map(i=>s(i))).then(i=>i.flat())},v={hasItem(r,o={}){r=p(r);let{relativeKey:s,driver:a}=n(r);return f(a.hasItem,s,o)},getItem(r,o={}){r=p(r);let{relativeKey:s,driver:a}=n(r);return f(a.getItem,s,o).then(c=>P(c))},getItems(r,o={}){return d(r,o,s=>s.driver.getItems?f(s.driver.getItems,s.items.map(a=>({key:a.relativeKey,options:a.options})),o).then(a=>a.map(c=>({key:H(s.base,c.key),value:P(c.value)}))):Promise.all(s.items.map(a=>f(s.driver.getItem,a.relativeKey,a.options).then(c=>({key:a.key,value:P(c)})))))},getItemRaw(r,o={}){r=p(r);let{relativeKey:s,driver:a}=n(r);return a.getItemRaw?f(a.getItemRaw,s,o):f(a.getItem,s,o).then(c=>J(c))},async setItem(r,o,s={}){if(o===void 0)return v.removeItem(r);r=p(r);let{relativeKey:a,driver:c}=n(r);c.setItem&&(await f(c.setItem,a,R(o),s),c.watch||g("update",r))},async setItems(r,o){await d(r,o,async s=>{if(s.driver.setItems)return f(s.driver.setItems,s.items.map(a=>({key:a.relativeKey,value:R(a.value),options:a.options})),o);s.driver.setItem&&await Promise.all(s.items.map(a=>f(s.driver.setItem,a.relativeKey,R(a.value),a.options)))})},async setItemRaw(r,o,s={}){if(o===void 0)return v.removeItem(r,s);r=p(r);let{relativeKey:a,driver:c}=n(r);if(c.setItemRaw)await f(c.setItemRaw,a,o,s);else if(c.setItem)await f(c.setItem,a,_(o),s);else return;c.watch||g("update",r)},async removeItem(r,o={}){typeof o=="boolean"&&(o={removeMeta:o}),r=p(r);let{relativeKey:s,driver:a}=n(r);a.removeItem&&(await f(a.removeItem,s,o),(o.removeMeta||o.removeMata)&&await f(a.removeItem,s+"$",o),a.watch||g("remove",r))},async getMeta(r,o={}){typeof o=="boolean"&&(o={nativeOnly:o}),r=p(r);let{relativeKey:s,driver:a}=n(r),c=Object.create(null);if(a.getMeta&&Object.assign(c,await f(a.getMeta,s,o)),!o.nativeOnly){let i=await f(a.getItem,s+"$",o).then(y=>P(y));i&&typeof i=="object"&&(typeof i.atime=="string"&&(i.atime=new Date(i.atime)),typeof i.mtime=="string"&&(i.mtime=new Date(i.mtime)),Object.assign(c,i))}return c},setMeta(r,o,s={}){return this.setItem(r+"$",o,s)},removeMeta(r,o={}){return this.removeItem(r+"$",o)},async getKeys(r,o={}){r=E(r);let s=u(r,!0),a=[],c=[],i=!0;for(let h of s){h.driver.flags?.maxDepth||(i=!1);let b=await f(h.driver.getKeys,h.relativeBase,o);for(let A of b){let N=h.mountpoint+p(A);a.some(ue=>N.startsWith(ue))||c.push(N)}a=[h.mountpoint,...a.filter(A=>!A.startsWith(h.mountpoint))]}let y=o.maxDepth!==void 0&&!i;return c.filter(h=>(!y||Q(h,o.maxDepth))&&G(h,r))},async clear(r,o={}){r=E(r),await Promise.all(u(r,!1).map(async s=>{if(s.driver.clear)return f(s.driver.clear,s.relativeBase,o);if(s.driver.removeItem){let a=await s.driver.getKeys(s.relativeBase||"",o);return Promise.all(a.map(c=>s.driver.removeItem(c,o)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(r=>X(r)))},async watch(r){return await l(),t.watchListeners.push(r),async()=>{t.watchListeners=t.watchListeners.filter(o=>o!==r),t.watchListeners.length===0&&await m()}},async unwatch(){t.watchListeners=[],await m()},mount(r,o){if(r=E(r),r&&t.mounts[r])throw new Error(`already mounted at ${r}`);return r&&(t.mountpoints.push(r),t.mountpoints.sort((s,a)=>a.length-s.length)),t.mounts[r]=o,t.watching&&Promise.resolve(Z(o,g,r)).then(s=>{t.unwatch[r]=s}).catch(console.error),v},async unmount(r,o=!0){r=E(r),!(!r||!t.mounts[r])&&(t.watching&&r in t.unwatch&&(t.unwatch[r]?.(),delete t.unwatch[r]),o&&await X(t.mounts[r]),t.mountpoints=t.mountpoints.filter(s=>s!==r),delete t.mounts[r])},getMount(r=""){r=p(r)+":";let o=n(r);return{driver:o.driver,base:o.base}},getMounts(r="",o={}){return r=p(r),u(r,o.parents).map(a=>({driver:a.driver,base:a.mountpoint}))},keys:(r,o={})=>v.getKeys(r,o),get:(r,o={})=>v.getItem(r,o),set:(r,o,s={})=>v.setItem(r,o,s),has:(r,o={})=>v.hasItem(r,o),del:(r,o={})=>v.removeItem(r,o),remove:(r,o={})=>v.removeItem(r,o)};return v}function Z(e,t,n){return e.watch?e.watch((u,g)=>t(u,n+g)):()=>{}}async function X(e){typeof e.dispose=="function"&&await f(e.dispose)}import{existsSync as Ke,promises as Se}from"fs";import{resolve as ze,join as Le}from"path";function T(e,t,n){let u=new Error(`[unstorage] [${e}] ${t}`,n);return Error.captureStackTrace&&Error.captureStackTrace(u,T),u}function ee(e,t){return Array.isArray(t)?T(e,`Missing some of the required options ${t.map(n=>"`"+n+"`").join(", ")}`):T(e,`Missing required option \`${t}\`.`)}import{existsSync as be,promises as w}from"fs";import{resolve as re,dirname as ne}from"path";function B(e){return e.code==="ENOENT"||e.code==="EISDIR"?null:e}function te(e){return e.code==="EEXIST"?null:e}async function O(e,t,n){return await ie(ne(e)),w.writeFile(e,t,n)}function q(e,t){return w.readFile(e,t).catch(B)}function oe(e){return w.unlink(e).catch(B)}function se(e){return w.readdir(e,{withFileTypes:!0}).catch(B).then(t=>t||[])}async function ie(e){be(e)||(await ie(ne(e)).catch(te),await w.mkdir(e).catch(te))}async function U(e,t,n){if(t&&t(e))return[];let u=await se(e),g=[];return await Promise.all(u.map(async l=>{let m=re(e,l.name);if(l.isDirectory()){if(n===void 0||n>0){let d=await U(m,t,n===void 0?void 0:n-1);g.push(...d.map(v=>l.name+"/"+v))}}else t&&t(l.name)||g.push(l.name)})),g}async function M(e){let t=await se(e);await Promise.all(t.map(n=>{let u=re(e,n.name);return n.isDirectory()?M(u).then(()=>w.rmdir(u)):w.unlink(u)}))}var ke=/\.\.:|\.\.$/,j="fs-lite",ae=(e={})=>{if(!e.base)throw ee(j,"base");e.base=ze(e.base);let t=n=>{if(ke.test(n))throw T(j,`Invalid key: ${JSON.stringify(n)}. It should not contain .. segments`);return Le(e.base,n.replace(/:/g,"/"))};return{name:j,options:e,flags:{maxDepth:!0},hasItem(n){return Ke(t(n))},getItem(n){return q(t(n),"utf8")},getItemRaw(n){return q(t(n))},async getMeta(n){let{atime:u,mtime:g,size:l,birthtime:m,ctime:d}=await Se.stat(t(n)).catch(()=>({}));return{atime:u,mtime:g,size:l,birthtime:m,ctime:d}},setItem(n,u){if(!e.readOnly)return O(t(n),u,"utf8")},setItemRaw(n,u){if(!e.readOnly)return O(t(n),u)},removeItem(n){if(!e.readOnly)return oe(t(n))},getKeys(n,u){return U(t("."),e.ignore,u?.maxDepth)},async clear(){e.readOnly||e.noClear||await M(t("."))}}};function Ue({prefix:e,logger:t}){return k($({driver:ae({base:Me({logger:t})})}),e)}function Me({logger:e}){let t="";try{t=Be()}catch(n){e.error("could not use homedir, trying tmpdir",{error:n?.message})}if(!t)try{t=Oe()}catch(n){e.error("could not use tmpdir, trying process.cwd",{error:n?.message})}if(!t)try{t=process.cwd()}catch(n){e.error("could not use process.cwd, exiting",{error:n?.message}),process.exit(1)}return qe(t,".alliance")}import je from"pino";function x(e){return t=>(n,u)=>e[t]({...u,msg:n})}function De(e){return D(e,{target:"pino-pretty",options:{colorize:!0,ignore:"time,pid,hostname",messageFormat:"{msg}"}})}function D(e,t){let n=je({level:e.SERVICE_LOG_LEVEL,redact:["authorization","headers.authorization","req.headers.authorization","res.headers.authorization","req.headers.cookie",'res.headers["set-cookie"]'],transport:t});return{fatal:x(n)("fatal"),error:x(n)("error"),warn:x(n)("warn"),info:x(n)("info"),debug:x(n)("debug"),trace:x(n)("trace"),silent:x(n)("silent"),child:()=>D(e),level:e.SERVICE_LOG_LEVEL}}function Ve(e){return(t,n,u)=>(e.trace("received request",{url:t.url,params:t.params,query:t.query,body:t.body}),u())}export{z as AllianceError,S as AllianceHeaders,F as DataErrorCode,W as GatewayErrorCode,de as createBearerToken,Ue as createFileStorage,ge as createIndexHtml,D as createLogger,De as createPrettyLogger,ve as createPublicKeys,le as getAppManifests,ye as getCleanPublicKey,V as getPrivateKey,we as requestErrorHandler,Ve as requestLoggerHandler,ce as slugify,me as zBooleanEnum,I as zNonEmptyString,K as zSharedConfig};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createRequire as c__createRequire } from 'node:module';
|
|
2
|
+
const require = c__createRequire(import.meta.url);
|
|
3
|
+
import"./chunk-COPUUGH4.js";import"util";import m,{stdin as iD,stdout as sD}from"process";import P from"readline";import{WriteStream as CD}from"tty";function nD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _,L;function aD(){if(L)return _;L=1;let t="\x1B",u=`${t}[`,e="\x07",r={to(D,n){return n?`${u}${n+1};${D+1}H`:`${u}${D+1}G`},move(D,n){let s="";return D<0?s+=`${u}${-D}D`:D>0&&(s+=`${u}${D}C`),n<0?s+=`${u}${-n}A`:n>0&&(s+=`${u}${n}B`),s},up:(D=1)=>`${u}${D}A`,down:(D=1)=>`${u}${D}B`,forward:(D=1)=>`${u}${D}C`,backward:(D=1)=>`${u}${D}D`,nextLine:(D=1)=>`${u}E`.repeat(D),prevLine:(D=1)=>`${u}F`.repeat(D),left:`${u}G`,hide:`${u}?25l`,show:`${u}?25h`,save:`${t}7`,restore:`${t}8`},F={up:(D=1)=>`${u}S`.repeat(D),down:(D=1)=>`${u}T`.repeat(D)},C={screen:`${u}2J`,up:(D=1)=>`${u}1J`.repeat(D),down:(D=1)=>`${u}J`.repeat(D),line:`${u}2K`,lineEnd:`${u}K`,lineStart:`${u}1K`,lines(D){let n="";for(let s=0;s<D;s++)n+=this.line+(s<D-1?r.up():"");return D&&(n+=r.left),n}};return _={cursor:r,scroll:F,erase:C,beep:e},_}var b=aD(),$={exports:{}},N;function oD(){if(N)return $.exports;N=1;let t=process||{},u=t.argv||[],e=t.env||{},r=!(e.NO_COLOR||u.includes("--no-color"))&&(!!e.FORCE_COLOR||u.includes("--color")||t.platform==="win32"||(t.stdout||{}).isTTY&&e.TERM!=="dumb"||!!e.CI),F=(n,s,E=n)=>c=>{let a=""+c,h=a.indexOf(s,n.length);return~h?n+C(a,s,E,h)+s:n+a+s},C=(n,s,E,c)=>{let a="",h=0;do a+=n.substring(h,c)+E,h=c+s.length,c=n.indexOf(s,h);while(~c);return a+n.substring(h)},D=(n=r)=>{let s=n?F:()=>String;return{isColorSupported:n,reset:s("\x1B[0m","\x1B[0m"),bold:s("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:s("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:s("\x1B[3m","\x1B[23m"),underline:s("\x1B[4m","\x1B[24m"),inverse:s("\x1B[7m","\x1B[27m"),hidden:s("\x1B[8m","\x1B[28m"),strikethrough:s("\x1B[9m","\x1B[29m"),black:s("\x1B[30m","\x1B[39m"),red:s("\x1B[31m","\x1B[39m"),green:s("\x1B[32m","\x1B[39m"),yellow:s("\x1B[33m","\x1B[39m"),blue:s("\x1B[34m","\x1B[39m"),magenta:s("\x1B[35m","\x1B[39m"),cyan:s("\x1B[36m","\x1B[39m"),white:s("\x1B[37m","\x1B[39m"),gray:s("\x1B[90m","\x1B[39m"),bgBlack:s("\x1B[40m","\x1B[49m"),bgRed:s("\x1B[41m","\x1B[49m"),bgGreen:s("\x1B[42m","\x1B[49m"),bgYellow:s("\x1B[43m","\x1B[49m"),bgBlue:s("\x1B[44m","\x1B[49m"),bgMagenta:s("\x1B[45m","\x1B[49m"),bgCyan:s("\x1B[46m","\x1B[49m"),bgWhite:s("\x1B[47m","\x1B[49m"),blackBright:s("\x1B[90m","\x1B[39m"),redBright:s("\x1B[91m","\x1B[39m"),greenBright:s("\x1B[92m","\x1B[39m"),yellowBright:s("\x1B[93m","\x1B[39m"),blueBright:s("\x1B[94m","\x1B[39m"),magentaBright:s("\x1B[95m","\x1B[39m"),cyanBright:s("\x1B[96m","\x1B[39m"),whiteBright:s("\x1B[97m","\x1B[39m"),bgBlackBright:s("\x1B[100m","\x1B[49m"),bgRedBright:s("\x1B[101m","\x1B[49m"),bgGreenBright:s("\x1B[102m","\x1B[49m"),bgYellowBright:s("\x1B[103m","\x1B[49m"),bgBlueBright:s("\x1B[104m","\x1B[49m"),bgMagentaBright:s("\x1B[105m","\x1B[49m"),bgCyanBright:s("\x1B[106m","\x1B[49m"),bgWhiteBright:s("\x1B[107m","\x1B[49m")}};return $.exports=D(),$.exports.createColors=D,$.exports}var ED=oD(),i=nD(ED);function lD({onlyFirst:t=!1}={}){let u=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(u,t?void 0:"g")}var cD=lD();function X(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(cD,"")}function DD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var uD={exports:{}};(function(t){var u={};t.exports=u,u.eastAsianWidth=function(r){var F=r.charCodeAt(0),C=r.length==2?r.charCodeAt(1):0,D=F;return 55296<=F&&F<=56319&&56320<=C&&C<=57343&&(F&=1023,C&=1023,D=F<<10|C,D+=65536),D==12288||65281<=D&&D<=65376||65504<=D&&D<=65510?"F":D==8361||65377<=D&&D<=65470||65474<=D&&D<=65479||65482<=D&&D<=65487||65490<=D&&D<=65495||65498<=D&&D<=65500||65512<=D&&D<=65518?"H":4352<=D&&D<=4447||4515<=D&&D<=4519||4602<=D&&D<=4607||9001<=D&&D<=9002||11904<=D&&D<=11929||11931<=D&&D<=12019||12032<=D&&D<=12245||12272<=D&&D<=12283||12289<=D&&D<=12350||12353<=D&&D<=12438||12441<=D&&D<=12543||12549<=D&&D<=12589||12593<=D&&D<=12686||12688<=D&&D<=12730||12736<=D&&D<=12771||12784<=D&&D<=12830||12832<=D&&D<=12871||12880<=D&&D<=13054||13056<=D&&D<=19903||19968<=D&&D<=42124||42128<=D&&D<=42182||43360<=D&&D<=43388||44032<=D&&D<=55203||55216<=D&&D<=55238||55243<=D&&D<=55291||63744<=D&&D<=64255||65040<=D&&D<=65049||65072<=D&&D<=65106||65108<=D&&D<=65126||65128<=D&&D<=65131||110592<=D&&D<=110593||127488<=D&&D<=127490||127504<=D&&D<=127546||127552<=D&&D<=127560||127568<=D&&D<=127569||131072<=D&&D<=194367||177984<=D&&D<=196605||196608<=D&&D<=262141?"W":32<=D&&D<=126||162<=D&&D<=163||165<=D&&D<=166||D==172||D==175||10214<=D&&D<=10221||10629<=D&&D<=10630?"Na":D==161||D==164||167<=D&&D<=168||D==170||173<=D&&D<=174||176<=D&&D<=180||182<=D&&D<=186||188<=D&&D<=191||D==198||D==208||215<=D&&D<=216||222<=D&&D<=225||D==230||232<=D&&D<=234||236<=D&&D<=237||D==240||242<=D&&D<=243||247<=D&&D<=250||D==252||D==254||D==257||D==273||D==275||D==283||294<=D&&D<=295||D==299||305<=D&&D<=307||D==312||319<=D&&D<=322||D==324||328<=D&&D<=331||D==333||338<=D&&D<=339||358<=D&&D<=359||D==363||D==462||D==464||D==466||D==468||D==470||D==472||D==474||D==476||D==593||D==609||D==708||D==711||713<=D&&D<=715||D==717||D==720||728<=D&&D<=731||D==733||D==735||768<=D&&D<=879||913<=D&&D<=929||931<=D&&D<=937||945<=D&&D<=961||963<=D&&D<=969||D==1025||1040<=D&&D<=1103||D==1105||D==8208||8211<=D&&D<=8214||8216<=D&&D<=8217||8220<=D&&D<=8221||8224<=D&&D<=8226||8228<=D&&D<=8231||D==8240||8242<=D&&D<=8243||D==8245||D==8251||D==8254||D==8308||D==8319||8321<=D&&D<=8324||D==8364||D==8451||D==8453||D==8457||D==8467||D==8470||8481<=D&&D<=8482||D==8486||D==8491||8531<=D&&D<=8532||8539<=D&&D<=8542||8544<=D&&D<=8555||8560<=D&&D<=8569||D==8585||8592<=D&&D<=8601||8632<=D&&D<=8633||D==8658||D==8660||D==8679||D==8704||8706<=D&&D<=8707||8711<=D&&D<=8712||D==8715||D==8719||D==8721||D==8725||D==8730||8733<=D&&D<=8736||D==8739||D==8741||8743<=D&&D<=8748||D==8750||8756<=D&&D<=8759||8764<=D&&D<=8765||D==8776||D==8780||D==8786||8800<=D&&D<=8801||8804<=D&&D<=8807||8810<=D&&D<=8811||8814<=D&&D<=8815||8834<=D&&D<=8835||8838<=D&&D<=8839||D==8853||D==8857||D==8869||D==8895||D==8978||9312<=D&&D<=9449||9451<=D&&D<=9547||9552<=D&&D<=9587||9600<=D&&D<=9615||9618<=D&&D<=9621||9632<=D&&D<=9633||9635<=D&&D<=9641||9650<=D&&D<=9651||9654<=D&&D<=9655||9660<=D&&D<=9661||9664<=D&&D<=9665||9670<=D&&D<=9672||D==9675||9678<=D&&D<=9681||9698<=D&&D<=9701||D==9711||9733<=D&&D<=9734||D==9737||9742<=D&&D<=9743||9748<=D&&D<=9749||D==9756||D==9758||D==9792||D==9794||9824<=D&&D<=9825||9827<=D&&D<=9829||9831<=D&&D<=9834||9836<=D&&D<=9837||D==9839||9886<=D&&D<=9887||9918<=D&&D<=9919||9924<=D&&D<=9933||9935<=D&&D<=9953||D==9955||9960<=D&&D<=9983||D==10045||D==10071||10102<=D&&D<=10111||11093<=D&&D<=11097||12872<=D&&D<=12879||57344<=D&&D<=63743||65024<=D&&D<=65039||D==65533||127232<=D&&D<=127242||127248<=D&&D<=127277||127280<=D&&D<=127337||127344<=D&&D<=127386||917760<=D&&D<=917999||983040<=D&&D<=1048573||1048576<=D&&D<=1114109?"A":"N"},u.characterLength=function(r){var F=this.eastAsianWidth(r);return F=="F"||F=="W"||F=="A"?2:1};function e(r){return r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}u.length=function(r){for(var F=e(r),C=0,D=0;D<F.length;D++)C=C+this.characterLength(F[D]);return C},u.slice=function(r,F,C){textLen=u.length(r),F=F||0,C=C||1,F<0&&(F=textLen+F),C<0&&(C=textLen+C);for(var D="",n=0,s=e(r),E=0;E<s.length;E++){var c=s[E],a=u.length(c);if(n>=F-(a==2?1:0))if(n+a<=C)D+=c;else break;n+=a}return D}})(uD);var hD=uD.exports,BD=DD(hD),mD=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},bD=DD(mD);function f(t,u={}){if(typeof t!="string"||t.length===0||(u={ambiguousIsNarrow:!0,...u},t=X(t),t.length===0))return 0;t=t.replace(bD()," ");let e=u.ambiguousIsNarrow?1:2,r=0;for(let F of t){let C=F.codePointAt(0);if(!(C<=31||C>=127&&C<=159||C>=768&&C<=879))switch(BD.eastAsianWidth(F)){case"F":case"W":r+=2;break;case"A":r+=e;break;default:r+=1}}return r}var k=10,q=(t=0)=>u=>`\x1B[${u+t}m`,z=(t=0)=>u=>`\x1B[${38+t};5;${u}m`,G=(t=0)=>(u,e,r)=>`\x1B[${38+t};2;${u};${e};${r}m`,l={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(l.modifier);var pD=Object.keys(l.color),gD=Object.keys(l.bgColor);[...pD,...gD];function AD(){let t=new Map;for(let[u,e]of Object.entries(l)){for(let[r,F]of Object.entries(e))l[r]={open:`\x1B[${F[0]}m`,close:`\x1B[${F[1]}m`},e[r]=l[r],t.set(F[0],F[1]);Object.defineProperty(l,u,{value:e,enumerable:!1})}return Object.defineProperty(l,"codes",{value:t,enumerable:!1}),l.color.close="\x1B[39m",l.bgColor.close="\x1B[49m",l.color.ansi=q(),l.color.ansi256=z(),l.color.ansi16m=G(),l.bgColor.ansi=q(k),l.bgColor.ansi256=z(k),l.bgColor.ansi16m=G(k),Object.defineProperties(l,{rgbToAnsi256:{value:(u,e,r)=>u===e&&e===r?u<8?16:u>248?231:Math.round((u-8)/247*24)+232:16+36*Math.round(u/255*5)+6*Math.round(e/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:u=>{let e=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!e)return[0,0,0];let[r]=e;r.length===3&&(r=[...r].map(C=>C+C).join(""));let F=Number.parseInt(r,16);return[F>>16&255,F>>8&255,F&255]},enumerable:!1},hexToAnsi256:{value:u=>l.rgbToAnsi256(...l.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value:u=>{if(u<8)return 30+u;if(u<16)return 90+(u-8);let e,r,F;if(u>=232)e=((u-232)*10+8)/255,r=e,F=e;else{u-=16;let n=u%36;e=Math.floor(u/36)/5,r=Math.floor(n/6)/5,F=n%6/5}let C=Math.max(e,r,F)*2;if(C===0)return 30;let D=30+(Math.round(F)<<2|Math.round(r)<<1|Math.round(e));return C===2&&(D+=60),D},enumerable:!1},rgbToAnsi:{value:(u,e,r)=>l.ansi256ToAnsi(l.rgbToAnsi256(u,e,r)),enumerable:!1},hexToAnsi:{value:u=>l.ansi256ToAnsi(l.hexToAnsi256(u)),enumerable:!1}}),l}var dD=AD(),y=new Set(["\x1B","\x9B"]),fD=39,I="\x07",eD="[",$D="]",tD="m",W=`${$D}8;;`,K=t=>`${y.values().next().value}${eD}${t}${tD}`,Y=t=>`${y.values().next().value}${W}${t}${I}`,vD=t=>t.split(" ").map(u=>f(u)),M=(t,u,e)=>{let r=[...u],F=!1,C=!1,D=f(X(t[t.length-1]));for(let[n,s]of r.entries()){let E=f(s);if(D+E<=e?t[t.length-1]+=s:(t.push(s),D=0),y.has(s)&&(F=!0,C=r.slice(n+1).join("").startsWith(W)),F){C?s===I&&(F=!1,C=!1):s===tD&&(F=!1);continue}D+=E,D===e&&n<r.length-1&&(t.push(""),D=0)}!D&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},xD=t=>{let u=t.split(" "),e=u.length;for(;e>0&&!(f(u[e-1])>0);)e--;return e===u.length?t:u.slice(0,e).join(" ")+u.slice(e).join("")},yD=(t,u,e={})=>{if(e.trim!==!1&&t.trim()==="")return"";let r="",F,C,D=vD(t),n=[""];for(let[E,c]of t.split(" ").entries()){e.trim!==!1&&(n[n.length-1]=n[n.length-1].trimStart());let a=f(n[n.length-1]);if(E!==0&&(a>=u&&(e.wordWrap===!1||e.trim===!1)&&(n.push(""),a=0),(a>0||e.trim===!1)&&(n[n.length-1]+=" ",a++)),e.hard&&D[E]>u){let h=u-a,g=1+Math.floor((D[E]-h-1)/u);Math.floor((D[E]-1)/u)<g&&n.push(""),M(n,c,u);continue}if(a+D[E]>u&&a>0&&D[E]>0){if(e.wordWrap===!1&&a<u){M(n,c,u);continue}n.push("")}if(a+D[E]>u&&e.wordWrap===!1){M(n,c,u);continue}n[n.length-1]+=c}e.trim!==!1&&(n=n.map(E=>xD(E)));let s=[...n.join(`
|
|
4
|
+
`)];for(let[E,c]of s.entries()){if(r+=c,y.has(c)){let{groups:h}=new RegExp(`(?:\\${eD}(?<code>\\d+)m|\\${W}(?<uri>.*)${I})`).exec(s.slice(E).join(""))||{groups:{}};if(h.code!==void 0){let g=Number.parseFloat(h.code);F=g===fD?void 0:g}else h.uri!==void 0&&(C=h.uri.length===0?void 0:h.uri)}let a=dD.codes.get(Number(F));s[E+1]===`
|
|
5
|
+
`?(C&&(r+=Y("")),F&&a&&(r+=K(a))):c===`
|
|
6
|
+
`&&(F&&a&&(r+=K(F)),C&&(r+=Y(C)))}return r};function J(t,u,e){return String(t).normalize().replace(/\r\n/g,`
|
|
7
|
+
`).split(`
|
|
8
|
+
`).map(r=>yD(r,u,e)).join(`
|
|
9
|
+
`)}var wD=["up","down","left","right","space","enter","cancel"],x={actions:new Set(wD),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function rD(t,u){if(typeof t=="string")return x.aliases.get(t)===u;for(let e of t)if(e!==void 0&&rD(e,u))return!0;return!1}function _D(t,u){if(t===u)return;let e=t.split(`
|
|
10
|
+
`),r=u.split(`
|
|
11
|
+
`),F=[];for(let C=0;C<Math.max(e.length,r.length);C++)e[C]!==r[C]&&F.push(C);return F}globalThis.process.platform.startsWith("win");var U=Symbol("clack:cancel");function v(t,u){let e=t;e.isTTY&&e.setRawMode(u)}var kD=Object.defineProperty,MD=(t,u,e)=>u in t?kD(t,u,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[u]=e,B=(t,u,e)=>(MD(t,typeof u!="symbol"?u+"":u,e),e),A=class{constructor(u,e=!0){B(this,"input"),B(this,"output"),B(this,"_abortSignal"),B(this,"rl"),B(this,"opts"),B(this,"_render"),B(this,"_track",!1),B(this,"_prevFrame",""),B(this,"_subscribers",new Map),B(this,"_cursor",0),B(this,"state","initial"),B(this,"error",""),B(this,"value");let{input:r=iD,output:F=sD,render:C,signal:D,...n}=u;this.opts=n,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=C.bind(this),this._track=e,this._abortSignal=D,this.input=r,this.output=F}unsubscribe(){this._subscribers.clear()}setSubscriber(u,e){let r=this._subscribers.get(u)??[];r.push(e),this._subscribers.set(u,r)}on(u,e){this.setSubscriber(u,{cb:e})}once(u,e){this.setSubscriber(u,{cb:e,once:!0})}emit(u,...e){let r=this._subscribers.get(u)??[],F=[];for(let C of r)C.cb(...e),C.once&&F.push(()=>r.splice(r.indexOf(C),1));for(let C of F)C()}prompt(){return new Promise((u,e)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),u(U);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let r=new CD(0);r._write=(F,C,D)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),D()},this.input.pipe(r),this.rl=P.createInterface({input:this.input,output:r,tabSize:2,prompt:"",escapeCodeTimeout:50}),P.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),v(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(b.cursor.show),this.output.off("resize",this.render),v(this.input,!1),u(this.value)}),this.once("cancel",()=>{this.output.write(b.cursor.show),this.output.off("resize",this.render),v(this.input,!1),u(U)})})}onKeypress(u,e){if(this.state==="error"&&(this.state="active"),e?.name&&(!this._track&&x.aliases.has(e.name)&&this.emit("cursor",x.aliases.get(e.name)),x.actions.has(e.name)&&this.emit("cursor",e.name)),u&&(u.toLowerCase()==="y"||u.toLowerCase()==="n")&&this.emit("confirm",u.toLowerCase()==="y"),u===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),u&&this.emit("key",u.toLowerCase()),e?.name==="return"){if(this.opts.validate){let r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}rD([u,e?.name,e?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
12
|
+
`),v(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let u=J(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
13
|
+
`).length-1;this.output.write(b.cursor.move(-999,u*-1))}render(){let u=J(this._render(this)??"",process.stdout.columns,{hard:!0});if(u!==this._prevFrame){if(this.state==="initial")this.output.write(b.cursor.hide);else{let e=_D(this._prevFrame,u);if(this.restoreCursor(),e&&e?.length===1){let r=e[0];this.output.write(b.cursor.move(0,r)),this.output.write(b.erase.lines(1));let F=u.split(`
|
|
14
|
+
`);this.output.write(F[r]),this._prevFrame=u,this.output.write(b.cursor.move(0,F.length-r-1));return}if(e&&e?.length>1){let r=e[0];this.output.write(b.cursor.move(0,r)),this.output.write(b.erase.down());let F=u.split(`
|
|
15
|
+
`).slice(r);this.output.write(F.join(`
|
|
16
|
+
`)),this._prevFrame=u;return}this.output.write(b.erase.down())}this.output.write(u),this.state==="initial"&&(this.state="active"),this._prevFrame=u}}},S=class extends A{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(u){super(u,!1),this.value=!!u.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",e=>{this.output.write(b.cursor.move(0,-1)),this.value=e,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}},SD=Object.defineProperty,TD=(t,u,e)=>u in t?SD(t,u,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[u]=e,Z=(t,u,e)=>(TD(t,typeof u!="symbol"?u+"":u,e),e),jD=class extends A{constructor(t){super(t,!1),Z(this,"options"),Z(this,"cursor",0),this.options=t.options,this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:u})=>u===t.cursorAt),0),this.on("key",u=>{u==="a"&&this.toggleAll()}),this.on("cursor",u=>{switch(u){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let t=this.value.length===this.options.length;this.value=t?[]:this.options.map(u=>u.value)}toggleValue(){let t=this.value.includes(this._value);this.value=t?this.value.filter(u=>u!==this._value):[...this.value,this._value]}},OD=Object.defineProperty,RD=(t,u,e)=>u in t?OD(t,u,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[u]=e,H=(t,u,e)=>(RD(t,typeof u!="symbol"?u+"":u,e),e),T=class extends A{constructor(u){super(u,!1),H(this,"options"),H(this,"cursor",0),this.options=u.options,this.cursor=this.options.findIndex(({value:e})=>e===u.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",e=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}},j=class extends A{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let u=this.value.slice(0,this.cursor),[e,...r]=this.value.slice(this.cursor);return`${u}${i.inverse(e)}${r.join("")}`}get cursor(){return this._cursor}constructor(u){super(u),this.on("finalize",()=>{this.value||(this.value=u.defaultValue)})}};function VD(){return m.platform!=="win32"?m.env.TERM!=="linux":!!m.env.CI||!!m.env.WT_SESSION||!!m.env.TERMINUS_SUBLIME||m.env.ConEmuTask==="{cmd::Cmder}"||m.env.TERM_PROGRAM==="Terminus-Sublime"||m.env.TERM_PROGRAM==="vscode"||m.env.TERM==="xterm-256color"||m.env.TERM==="alacritty"||m.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var ID=VD(),p=(t,u)=>ID?t:u,WD=p("\u276F",">"),PD=p("\u25A0","x"),LD=p("\u25B2","x"),ND=p("\u2714","\u221A"),o=p(""),d=p(""),O=p("\u25CF",">"),R=p("\u25CB"," "),qD=p("\u25FB","[\u2022]"),Q=p("\u25FC","[+]"),zD=p("\u25FB","[ ]"),w=t=>{switch(t){case"initial":case"active":return i.cyan(WD);case"cancel":return i.red(PD);case"error":return i.yellow(LD);case"submit":return i.green(ND)}},V=t=>{let{cursor:u,options:e,style:r}=t,F=t.maxItems??Number.POSITIVE_INFINITY,C=Math.max(process.stdout.rows-4,0),D=Math.min(C,Math.max(F,5)),n=0;u>=n+D-3?n=Math.max(Math.min(u-D+3,e.length-D),0):u<n+2&&(n=Math.max(u-2,0));let s=D<e.length&&n>0,E=D<e.length&&n+D<e.length;return e.slice(n,n+D).map((c,a,h)=>{let g=a===0&&s,FD=a===h.length-1&&E;return g||FD?i.dim("..."):r(c,a+n===u)})},GD=t=>new j({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let u=`${i.gray(o)}
|
|
17
|
+
${w(this.state)} ${t.message}
|
|
18
|
+
`,e=t.placeholder?i.inverse(t.placeholder[0])+i.dim(t.placeholder.slice(1)):i.inverse(i.hidden("_")),r=this.value?this.valueWithCursor:e;switch(this.state){case"error":return`${u.trim()}
|
|
19
|
+
${i.yellow(o)} ${r}
|
|
20
|
+
${i.yellow(d)} ${i.yellow(this.error)}
|
|
21
|
+
`;case"submit":return`${u}${i.gray(o)} ${i.dim(this.value||t.placeholder)}`;case"cancel":return`${u}${i.gray(o)} ${i.strikethrough(i.dim(this.value??""))}${this.value?.trim()?`
|
|
22
|
+
${i.gray(o)}`:""}`;default:return`${u}${i.cyan(o)} ${r}
|
|
23
|
+
${i.cyan(d)}
|
|
24
|
+
`}}}).prompt(),KD=t=>{let u=t.active??"Yes",e=t.inactive??"No";return new S({active:u,inactive:e,initialValue:t.initialValue??!0,render(){let r=`${i.gray(o)}
|
|
25
|
+
${w(this.state)} ${t.message}
|
|
26
|
+
`,F=this.value?u:e;switch(this.state){case"submit":return`${r}${i.gray(o)} ${i.dim(F)}`;case"cancel":return`${r}${i.gray(o)} ${i.strikethrough(i.dim(F))}
|
|
27
|
+
${i.gray(o)}`;default:return`${r}${i.cyan(o)} ${this.value?`${i.green(O)} ${u}`:`${i.dim(R)} ${i.dim(u)}`} ${i.dim("/")} ${this.value?`${i.dim(R)} ${i.dim(e)}`:`${i.green(O)} ${e}`}
|
|
28
|
+
${i.cyan(d)}
|
|
29
|
+
`}}}).prompt()},YD=t=>{let u=(e,r)=>{let F=e.label??String(e.value);switch(r){case"selected":return`${i.dim(F)}`;case"active":return`${i.green(O)} ${F} ${e.hint?i.dim(`(${e.hint})`):""}`;case"cancelled":return`${i.strikethrough(i.dim(F))}`;default:return`${i.dim(R)} ${i.dim(F)}`}};return new T({options:t.options,initialValue:t.initialValue,render(){let e=`${i.gray(o)}
|
|
30
|
+
${w(this.state)} ${t.message}
|
|
31
|
+
`;switch(this.state){case"submit":return`${e}${i.gray(o)} ${u(this.options[this.cursor],"selected")}`;case"cancel":return`${e}${i.gray(o)} ${u(this.options[this.cursor],"cancelled")}
|
|
32
|
+
${i.gray(o)}`;default:return`${e}${i.cyan(o)} ${V({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(r,F)=>u(r,F?"active":"inactive")}).join(`
|
|
33
|
+
${i.cyan(o)} `)}
|
|
34
|
+
${i.cyan(d)}
|
|
35
|
+
`}}}).prompt()},JD=t=>{let u=(e,r)=>{let F=e.label??String(e.value);return r==="active"?`${i.cyan(qD)} ${F} ${e.hint?i.dim(`(${e.hint})`):""}`:r==="selected"?`${i.green(Q)} ${i.dim(F)}`:r==="cancelled"?`${i.strikethrough(i.dim(F))}`:r==="active-selected"?`${i.green(Q)} ${F} ${e.hint?i.dim(`(${e.hint})`):""}`:r==="submitted"?`${i.dim(F)}`:`${i.dim(zD)} ${i.dim(F)}`};return new jD({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(e){if(this.required&&e.length===0)return`Please select at least one option.
|
|
36
|
+
${i.reset(i.dim(`Press ${i.gray(i.bgWhite(i.inverse(" space ")))} to select, ${i.gray(i.bgWhite(i.inverse(" enter ")))} to submit`))}`},render(){let e=`${i.gray(o)}
|
|
37
|
+
${w(this.state)} ${t.message}
|
|
38
|
+
`,r=(F,C)=>{let D=this.value.includes(F.value);return C&&D?u(F,"active-selected"):D?u(F,"selected"):u(F,C?"active":"inactive")};switch(this.state){case"submit":return`${e}${i.gray(o)} ${this.options.filter(({value:F})=>this.value.includes(F)).map(F=>u(F,"submitted")).join(i.dim(", "))||i.dim("none")}`;case"cancel":{let F=this.options.filter(({value:C})=>this.value.includes(C)).map(C=>u(C,"cancelled")).join(i.dim(", "));return`${e}${i.gray(o)} ${F.trim()?`${F}
|
|
39
|
+
${i.gray(o)}`:""}`}case"error":{let F=this.error.split(`
|
|
40
|
+
`).map((C,D)=>D===0?`${i.yellow(d)} ${i.yellow(C)}`:` ${C}`).join(`
|
|
41
|
+
`);return`${e+i.yellow(o)} ${V({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:r}).join(`
|
|
42
|
+
${i.yellow(o)} `)}
|
|
43
|
+
${F}
|
|
44
|
+
`}default:return`${e}${i.cyan(o)} ${V({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:r}).join(`
|
|
45
|
+
${i.cyan(o)} `)}
|
|
46
|
+
${i.cyan(d)}
|
|
47
|
+
`}}}).prompt()};`${i.gray(o)}`;var UD=Symbol.for("cancel");async function ZD(t,u={}){let e=r=>{if(typeof r!="symbol"||r.toString()!=="Symbol(clack:cancel)")return r;switch(u.cancel){case"reject":{let F=new Error("Prompt cancelled.");throw F.name="ConsolaPromptCancelledError",Error.captureStackTrace&&Error.captureStackTrace(F,ZD),F}case"undefined":return;case"null":return null;case"symbol":return UD;default:case"default":return u.default??u.initial}};if(!u.type||u.type==="text")return await GD({message:t,defaultValue:u.default,placeholder:u.placeholder,initialValue:u.initial}).then(e);if(u.type==="confirm")return await KD({message:t,initialValue:u.initial}).then(e);if(u.type==="select")return await YD({message:t,options:u.options.map(r=>typeof r=="string"?{value:r,label:r}:r),initialValue:u.initial}).then(e);if(u.type==="multiselect")return await JD({message:t,options:u.options.map(r=>typeof r=="string"?{value:r,label:r}:r),required:u.required,initialValues:u.initial}).then(e);throw new Error(`Unknown prompt type: ${u.type}`)}export{UD as kCancel,ZD as prompt};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/alliance-internal-node-utilities",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-next.10",
|
|
4
4
|
"description": "Utilities used internally by packages developed by team Alliance.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"jsonwebtoken": "^9.0.2",
|
|
24
|
-
"pino": "^9.
|
|
24
|
+
"pino": "^9.7.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"import-from-esm": "^2.0.0",
|
|
28
28
|
"pino-pretty": "^13.0.0",
|
|
29
29
|
"pkg-types": "^2.1.0",
|
|
30
|
-
"@telia-ace/alliance-framework": "^
|
|
30
|
+
"@telia-ace/alliance-framework": "^4.0.0-next.10"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|