@redocly/cli 2.53.3 → 2.54.1
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 +1 -1
- package/lib/chunks/{T376AHHQ.js → 23QBFBKB.js} +1 -1
- package/lib/chunks/{IMWIJK4I.js → 2MBZI3W3.js} +2 -1
- package/lib/chunks/{BST7IEDL.js → 2NS7AGPD.js} +1 -1
- package/lib/chunks/2TLIBL23.js +8 -0
- package/lib/chunks/{Q3XI4H3K.js → 3BJIJBSJ.js} +1 -1
- package/lib/chunks/3RDMQ5CQ.js +13 -0
- package/lib/chunks/{O6EXHS4S.js → 4G34OIRT.js} +1 -1
- package/lib/chunks/{J2VIXY4S.js → 4JE7GYQB.js} +1 -1
- package/lib/chunks/{NMVCH6CZ.js → 5KMAESVG.js} +1 -1
- package/lib/chunks/7IULUVWX.js +13 -0
- package/lib/chunks/AHGQ4BNI.js +30 -0
- package/lib/chunks/ALXOGCUM.js +8 -0
- package/lib/chunks/AM6FT7EB.js +9 -0
- package/lib/chunks/{C25ULQVR.js → BYIMEGON.js} +1 -1
- package/lib/chunks/{C4FLQ63T.js → C27G2ZXO.js} +1 -1
- package/lib/chunks/{6ER74AF4.js → CI4NGJ3I.js} +3 -3
- package/lib/chunks/{CPXI7K7L.js → CKJYJBJ6.js} +1 -1
- package/lib/chunks/{VL4UXBSF.js → ENDHNS6Y.js} +1 -1
- package/lib/chunks/{XX6OZNQL.js → FIIFOPJG.js} +1 -1
- package/lib/chunks/{CXNOQVEB.js → FTDJMTRX.js} +1 -1
- package/lib/chunks/{BNWXU2OA.js → FUCJM4CG.js} +1 -1
- package/lib/chunks/H4XURXR7.js +47 -0
- package/lib/chunks/{W3YACFG2.js → IPVLUS43.js} +1 -1
- package/lib/chunks/{GM5FQCWY.js → IW2J6X26.js} +4 -4
- package/lib/chunks/{EDS62CRZ.js → IZ2TZVJD.js} +1 -1
- package/lib/chunks/{4BHLSA4G.js → J7GIHRZA.js} +1 -1
- package/lib/chunks/{T2XFX5KV.js → JH4AUZLH.js} +1 -1
- package/lib/chunks/{RI6WFA4F.js → KEF4233Y.js} +6 -6
- package/lib/chunks/{2HTEK7CB.js → KW7NKDOX.js} +1 -1
- package/lib/chunks/{QE555QD2.js → KZMFETIJ.js} +1 -1
- package/lib/chunks/{7V5AWKRU.js → L24E6ZRY.js} +3 -3
- package/lib/chunks/LLGJ3YMR.js +85 -0
- package/lib/chunks/{2LLR76SN.js → LT2PEIAT.js} +1 -1
- package/lib/chunks/{GBTKUMLF.js → MZCEUZSS.js} +1 -1
- package/lib/chunks/{JXAKPU5V.js → Q7ARG2G6.js} +1 -1
- package/lib/chunks/QZBHV7SD.js +7 -0
- package/lib/chunks/{S7LWRM6M.js → RVQFQGGH.js} +1 -1
- package/lib/chunks/{UWKKXZOE.js → RW2ESAIF.js} +80 -80
- package/lib/chunks/{PDTJPHOV.js → S4H3MC5R.js} +1 -1
- package/lib/chunks/SAJRBHEI.js +19 -0
- package/lib/chunks/{MXEA2HJF.js → SZKF6VFY.js} +485 -473
- package/lib/chunks/TZMWTSOQ.js +7 -0
- package/lib/chunks/{MEVUBG5J.js → UAEEHSSK.js} +2 -2
- package/lib/chunks/{TOCY6E4B.js → UWNBPAWG.js} +1 -1
- package/lib/chunks/{TXEDXTQA.js → UYHX7364.js} +1 -1
- package/lib/chunks/VTKYS75A.js +13 -0
- package/lib/chunks/{DFCB4ULY.js → W6X4HEU3.js} +1 -1
- package/lib/chunks/{JT5UMLP2.js → XFRPQNF6.js} +1 -1
- package/lib/chunks/XRZ5NMQ5.js +13 -0
- package/lib/chunks/Y6E4JAM3.js +16 -0
- package/lib/chunks/{GJKYTFLY.js → YDSFHQXH.js} +3 -3
- package/lib/chunks/ZBK7SJHM.js +7 -0
- package/lib/chunks/{4RWMTNRF.js → ZDNSHHXT.js} +1 -1
- package/lib/chunks/ZDQDZTQ7.js +7 -0
- package/lib/eject-assets/generators/cli/docs.ts +1 -1
- package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
- package/lib/eject-assets/generators/cli/index.ts +2 -2
- package/lib/eject-assets/generators/cli/render.ts +1 -1
- package/lib/eject-assets/generators/go/client.ts +1 -1
- package/lib/eject-assets/generators/go/descriptor.ts +1 -1
- package/lib/eject-assets/generators/go/index.ts +2 -2
- package/lib/eject-assets/generators/go/models.ts +1 -1
- package/lib/eject-assets/generators/go/naming.ts +1 -1
- package/lib/eject-assets/generators/go/operations.ts +1 -1
- package/lib/eject-assets/generators/go/pagination.ts +1 -1
- package/lib/eject-assets/generators/go/types.ts +1 -1
- package/lib/eject-assets/generators/mock/faker.ts +1 -1
- package/lib/eject-assets/generators/mock/index.ts +2 -2
- package/lib/eject-assets/generators/mock/render.ts +1 -1
- package/lib/eject-assets/generators/mock/sample.ts +1 -1
- package/lib/eject-assets/generators/mock/values.ts +1 -1
- package/lib/eject-assets/generators/php/client.ts +1 -1
- package/lib/eject-assets/generators/php/descriptor.ts +1 -1
- package/lib/eject-assets/generators/php/index.ts +2 -2
- package/lib/eject-assets/generators/php/models.ts +1 -1
- package/lib/eject-assets/generators/php/naming.ts +1 -1
- package/lib/eject-assets/generators/php/operations.ts +1 -1
- package/lib/eject-assets/generators/php/pagination.ts +1 -1
- package/lib/eject-assets/generators/php/types.ts +1 -1
- package/lib/eject-assets/generators/python/client.ts +1 -1
- package/lib/eject-assets/generators/python/descriptor.ts +1 -1
- package/lib/eject-assets/generators/python/index.ts +2 -2
- package/lib/eject-assets/generators/python/models.ts +1 -1
- package/lib/eject-assets/generators/python/naming.ts +1 -1
- package/lib/eject-assets/generators/python/operations.ts +1 -1
- package/lib/eject-assets/generators/python/pagination.ts +1 -1
- package/lib/eject-assets/generators/python/types.ts +1 -1
- package/lib/eject-assets/generators/swr/index.ts +2 -2
- package/lib/eject-assets/generators/swr/render.ts +1 -1
- package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
- package/lib/eject-assets/generators/tanstack-query/render.ts +1 -1
- package/lib/eject-assets/generators/transformers/index.ts +2 -2
- package/lib/eject-assets/generators/transformers/render.ts +1 -1
- package/lib/eject-assets/generators/typescript/banner.ts +1 -1
- package/lib/eject-assets/generators/typescript/client.ts +1 -1
- package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
- package/lib/eject-assets/generators/typescript/index.ts +2 -2
- package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
- package/lib/eject-assets/generators/typescript/operations.ts +1 -1
- package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
- package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
- package/lib/eject-assets/generators/typescript/types.ts +1 -1
- package/lib/eject-assets/generators/zod/index.ts +2 -2
- package/lib/eject-assets/generators/zod/schemas.ts +1 -1
- package/lib/index.js +157 -276
- package/package.json +1 -1
- package/lib/chunks/32XCOMOR.js +0 -7
- package/lib/chunks/6LHYZTIP.js +0 -48
- package/lib/chunks/6NEJXWUE.js +0 -7
- package/lib/chunks/BGOL5GAO.js +0 -19
- package/lib/chunks/KXHIHQWX.js +0 -13
- package/lib/chunks/OFAMJNQ6.js +0 -7
- package/lib/chunks/P26PQ2RU.js +0 -7
- package/lib/chunks/R6Q6FO6R.js +0 -14
- package/lib/chunks/RS5PUOTT.js +0 -18
- package/lib/chunks/UF33MFZE.js +0 -22
- package/lib/chunks/VH573B5Z.js +0 -7
package/README.md
CHANGED
|
@@ -178,7 +178,7 @@ This allows you to:
|
|
|
178
178
|
|
|
179
179
|
## Data collection
|
|
180
180
|
|
|
181
|
-
This tool [collects data](./docs/usage-data.md) to help Redocly improve our products and services.
|
|
181
|
+
This tool [collects data](./docs/@v2/usage-data.md) to help Redocly improve our products and services.
|
|
182
182
|
You can opt out by setting the `REDOCLY_TELEMETRY` environment variable to `off`.
|
|
183
183
|
|
|
184
184
|
## Update notifications
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as oe,e as ae,f as ue,g as ce,h as b,i as de,k as H,l as V,m as pe,n as le,v as he,w as me}from"./
|
|
7
|
+
import{a as oe,e as ae,f as ue,g as ce,h as b,i as de,k as H,l as V,m as pe,n as le,v as he,w as me}from"./FUCJM4CG.js";import{I as X,L as Je,M as Z,N as g,O,P as ee,Q as $,R as C,T as S,V as y,X as w,Y as te,Z as ne,_ as re,aa as se,c as l,ca as ie,q as Y,v as Q,y as We}from"./RW2ESAIF.js";import{e as J}from"./RFWIIJFG.js";import fe from"node:path";function R(t){return t?t.trim():""}function T(t){let e=R(t.operationId)||R(t.path);return[R(t.ruleId),R(t.severity),R(t.message),e,R(t.target),R(t.schemaPath)].join("")}var F=t=>Z(S(t));function Ye(t){return t==="error"?"error":t==="warning"?"warning":"note"}function Qe(t){if(t==null)return"";let e=String(t);return!e.includes(",")&&!e.includes('"')&&!e.includes(`
|
|
8
8
|
`)?e:`"${e.replace(/"/g,'""')}"`}function Xe(t){return fe.isAbsolute(t)?fe.relative(process.cwd(),t)||".":t}function Ze(t){if(!t)return null;let e=t.operationPathTemplate;return typeof e=="string"&&e.length>0?e:null}function et(t){return Object.entries(t).sort((e,r)=>{let n=r[1]-e[1];return n!==0?n:e[0].localeCompare(r[0])})}function tt(t){let e=[],r=new Map;for(let n of t){let s=T({ruleId:n.ruleId,severity:n.severity,message:n.message,operationId:n.operationId,path:n.path,target:n.target,schemaPath:n.schemaPath}),i=r.get(s);if(i!==void 0){e[i].occurrences+=1;continue}r.set(s,e.length),e.push({finding:n,occurrences:1})}return e}function nt(t){let e=tt(t.findings).map(n=>({occurrences:n.occurrences,exchangeIndex:n.finding.exchangeIndex,ruleId:n.finding.ruleId,severity:n.finding.severity,category:n.finding.category,message:n.finding.message,operationId:n.finding.operationId,specSource:n.finding.specSource,target:n.finding.target,schemaPath:n.finding.schemaPath,dataPath:n.finding.dataPath,details:n.finding.details,method:n.finding.method,url:n.finding.url,path:n.finding.path,status:n.finding.status})),r={run:{id:t.runId,specSource:t.meta.specSource,trafficPath:t.meta.trafficPath,format:t.meta.format,matchMode:t.meta.matchMode,server:t.meta.server,totalExchanges:t.summary.totalExchanges,documentedExchanges:t.summary.documentedExchanges,undocumentedExchanges:t.summary.undocumentedExchanges,skippedExchanges:t.summary.skippedExchanges,findingsBySeverity:t.summary.findingsBySeverity,findingsByRule:t.summary.findingsByRule,totalProblems:t.summary.totalProblemGroups,durationMs:t.summary.durationMs},problems:e};return`${JSON.stringify(r,null,2)}
|
|
9
9
|
`}function rt(t){let e=["run_id","finding_id","exchange_index","severity","category","rule_id","message","method","path","url","status","operation_id","spec_source","target","schema_path","data_path"],r=t.findings.map(s=>[t.runId,s.id,s.exchangeIndex,s.severity,s.category,s.ruleId,s.message,s.method,s.path,s.url,s.status,s.operationId,s.specSource,s.target,s.schemaPath,s.dataPath]);return`${[e,...r].map(s=>s.map(Qe).join(",")).join(`
|
|
10
10
|
`)}
|
|
@@ -4,4 +4,5 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{
|
|
7
|
+
import{l as t}from"./AM6FT7EB.js";import"./BXI4SF2U.js";import{X as o}from"./RW2ESAIF.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function i({version:n}){new t(n).logout(),o.output(`Logged out from the Redocly account. \u270B
|
|
8
|
+
`)}export{i as handleLogout};
|
|
@@ -4,6 +4,6 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a}from"./
|
|
7
|
+
import{a}from"./IPVLUS43.js";import{X as p}from"./RW2ESAIF.js";function g(t,r){let n=t.services.flatMap(e=>e.operations),s=n.filter(e=>e.sse!==void 0);s.length>0&&p.warn(`generate-client: ${r} skipped ${s.length} server-sent-events operation(s) \u2014 iterate the sdk's exported async generators directly: ${s.map(e=>e.name).join(", ")}.
|
|
8
8
|
`);let i=new Set(t.schemas.map(e=>e.name)),o=n.filter(e=>e.sse===void 0&&m(e,i));return o.length>0&&p.warn(`generate-client: ${r} skipped ${o.length} operation(s) whose variables type name collides with a schema \u2014 rename the schema or the operation: ${o.map(e=>e.name).join(", ")}.
|
|
9
9
|
`),n.filter(e=>e.sse===void 0&&!m(e,i))}function m(t,r){let n=a(t);return n.hasInputs&&r.has(n.variablesTypeName)}function x(t){return t.method==="get"||t.method==="head"}function u(t){return a(t).hasInputs}function f(t){return a(t).variablesTypeName}function $(t,r,n){let s=[];return a(t).hasInputs?s.push(r):n&&s.push("{}"),n&&s.push("{ ...init, envelope: undefined }"),`${t.name}(${s.join(", ")})`}function v(t,r,n){let s=t.map(e=>e.name).sort(),i=t.filter(u).map(f).sort();return n&&i.push("RequestOptions"),`import { ${[...s,...i.map(e=>`type ${e}`)].join(", ")} } from ${JSON.stringify(r)};`}export{g as a,x as b,u as c,f as d,$ as e,v as f};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{t as o}from"./H4XURXR7.js";import{Q as t}from"./RW2ESAIF.js";var r=" ",a=" ";function g(i){let p=Math.max(...i.map(n=>o(n).length)),e=p+a.length*2,c=r+t("\u2551"+" ".repeat(e)+"\u2551");return["",r+t("\u2554"+"\u2550".repeat(e)+"\u2557"),c,...i.map(n=>{let h=" ".repeat(p-o(n).length);return`${r}${t("\u2551")}${a}${n}${h}${a}${t("\u2551")}`}),c,r+t("\u255A"+"\u2550".repeat(e)+"\u255D"),"",""].join(`
|
|
8
|
+
`)}export{g as a};
|
|
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a,b,c}from"./
|
|
7
|
+
import{a,b,c}from"./W6X4HEU3.js";import"./2U6O26CV.js";import"./IPVLUS43.js";import"./JH4AUZLH.js";import"./UAEEHSSK.js";import"./WZXA5XPB.js";import"./RW2ESAIF.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{b as typescriptDocs,a as typescriptGenerator,c as typescriptSample};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{b as x,c as P,d as h}from"./AHGQ4BNI.js";import{e as y,g as b,m as w,n as $}from"./AM6FT7EB.js";import"./ALXOGCUM.js";import{f as l}from"./H4XURXR7.js";import"./BXI4SF2U.js";import{P as g,X as n,l as p}from"./RW2ESAIF.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function C({argv:t,config:o,version:c}){let f=performance.now(),A=Date.now(),{organization:s,project:m,"mount-path":F,verbose:I}=t,d=t.domain||b(),e,i,u=[];try{let r=y();if(e=$(t.files,(a,S)=>{n.warn(`File ${a} is overwritten by ${S}
|
|
8
|
+
`)}),!e.length)return l("push",f,"No files to upload");i=(await w({domain:d,apiKey:r,organization:s,project:m,mountPath:F,files:e,defaultBranch:t["default-branch"],commit:{message:t.message,branchName:t.branch,sha:t["commit-sha"],url:t["commit-url"],createdAt:t["created-at"],namespace:t.namespace,repository:t.repository,author:T(t.author)},version:c,onUploadStart:a=>{n.info(`Uploading to ${a.mountPath} ${e.length} ${p("file",e.length)}:
|
|
9
|
+
`)},onSunsetWarning:a=>u.push(a)})).pushId}catch(r){h("push",u),P("\u2717 File upload failed.",r)}for(let r of e)n.info(g(`\u2713 ${r.name}
|
|
10
|
+
`));return n.info(`
|
|
11
|
+
`),n.info(`Push ID: ${i}
|
|
12
|
+
`),h("push",u),t["wait-for-deployment"]&&(n.info(`
|
|
13
|
+
`),await x({argv:{organization:s,project:m,pushId:i,wait:!0,domain:d,"max-execution-time":t["max-execution-time"],"start-time":A,"continue-on-deploy-failures":t["continue-on-deploy-failures"]},config:o,version:c})),I&&l("push",f,`${p("file",e.length)} uploaded to organization ${s}, project ${m}. Push ID: ${i}.`),{pushId:i}}function T(t){let o=t.match(/^(?<name>.+)\s<(?<email>[^<>]+)>$/);if(!o?.groups)throw new Error('Invalid author format. Use "Author Name <author@email.com>"');return{name:o.groups.name.trim(),email:o.groups.email.trim()}}export{C as handlePush};
|
|
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{c as a,d as b}from"./
|
|
7
|
+
import{c as a,d as b}from"./MZCEUZSS.js";import"./UAEEHSSK.js";import"./WZXA5XPB.js";import"./RW2ESAIF.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{b as generateClient,a as runGenerators};
|
|
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as g,b as h,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as B,l as C,m as D,n as F,o as G}from"./
|
|
7
|
+
import{a as g,b as h,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as B,l as C,m as D,n as F,o as G}from"./JH4AUZLH.js";import{a as z,e as A,g as E}from"./UAEEHSSK.js";import{a}from"./WZXA5XPB.js";import"./RW2ESAIF.js";import"./NEWT5A6S.js";import{a as b,b as c,c as d,d as e,e as f,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p,n as q}from"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{x as AUTHORING_HELPER_NAMES,E as GENERATOR_VERSION,a as NotSupportedError,b as Printer,d as RESERVED_WORDS,A as WIRING_NAMES,z as allOperations,c as casing,C as constantCase,y as defineClientSetup,F as defineGenerator,i as deref,k as discriminatorCases,o as docText,n as enumValues,j as flattenAllOf,G as generateClient,B as groupSlug,q as headerCoerceType,e as identifierFor,t as isMultipartBody,l as isNullable,r as jsonSuccessSchema,D as mergeConfig,w as paginationItemSchema,g as paginationRuleFor,h as renderReferencePage,p as resolveSchemaPointer,p as schemaAtPointer,v as securityRequirements,u as serverUrlParts,s as sseResponse,f as uniqueIdentifiers,m as unwrapNullable};
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{h as g}from"./
|
|
7
|
+
import{h as g}from"./IPVLUS43.js";import{k as u,l as m}from"./JH4AUZLH.js";import{c as C,d as j}from"./UAEEHSSK.js";import{X as b}from"./RW2ESAIF.js";import{a as S,b as k}from"./UW4UC7ZI.js";import{join as $}from"node:path";function h(r){return(r??"").replace(/\s+/g," ").trim().replace(/\\/g,"\\\\").replace(/\|/g,"\\|")}function v(r){return[r.group===void 0?void 0:u(r.group),r.name].filter(Boolean).join(" ")}function N(r,e){return[r,v(e),...e.positionals.map(o=>`<${o.name}>`),...e.flags.filter(o=>o.required).map(o=>`--${o.name} <${o.type}>`),...e.body?[e.body.required?"--json '<json>'":"[--json '<json>']"]:[]].filter(o=>o!=="").join(" ")}function T(r,e){r.line("| Flag | Type | Required | Description |"),r.line("| ---- | ---- | -------- | ----------- |");for(let n of e){let o=[h(n.description),n.enum===void 0?"":`One of ${n.enum.map(t=>`\`${t}\``).join(", ")}.`,n.type==="array"?"Repeat the flag for multiple values.":""].filter(t=>t!=="").join(" ");r.line(`| \`--${n.name}\` | ${n.type} | ${n.required?"yes":"no"} | ${o} |`)}r.blank()}function D(r,e,n){if(r.line(`### \`${v(e)}\``),r.blank(),e.summary!==void 0&&(r.line(h(e.summary)),r.blank()),r.line(`\`${e.method} ${e.path}\``),r.blank(),r.line("```sh"),r.line(N(n.name,e)),r.line("```"),r.blank(),e.positionals.length>0){r.line("| Argument | Description |"),r.line("| -------- | ----------- |");for(let t of e.positionals)r.line(`| \`<${t.name}>\` | ${h(t.description)} |`);r.blank()}e.flags.length>0&&T(r,e.flags);let o=[e.body===void 0?"":`Takes a JSON body${e.body.required?" (required)":""}: \`--json '<json>'\`, \`--json @file.json\`, or \`--json @-\` for stdin.`,e.unsupportedBody===void 0?"":`Takes a \`${e.unsupportedBody}\` body, which the CLI cannot build \u2014 call this operation through the generated client instead.`,e.paginated===!0?"Paginated: `--page-all` follows every page, printing one JSON page per line.":"",e.sse===!0?"Streams server-sent events as one JSON object per line.":"",e.blob===!0?"Returns binary content, so `--output <path>` is required.":""].filter(t=>t!=="");for(let t of o)r.line(t);o.length>0&&r.blank()}function w(r,e){let n=new S;e.frontmatter&&(n.line("---"),n.line(`title: ${e.title}`),n.line("---"),n.blank()),n.line(`# ${e.title}`),n.blank(),n.line(`Generated command-line reference for \`${e.name}\`, produced from the API description by \`redocly generate-client\`.`),n.line("Re-run generation to update it \u2014 this file is not hand-edited."),n.blank(),n.line("## Usage"),n.blank(),n.line("```sh"),n.line(`${e.name} <command> [flags]`),n.line(`${e.name} --help`),n.line(`${e.name} schema <command> # request/response schemas`),n.line("```"),n.blank(),n.line("Install the file under any `bin` name: the command takes that name, and the credential variables below do not change."),n.blank(),n.line("## Global flags"),n.blank(),n.line("| Flag | Description |"),n.line("| ---- | ----------- |");let o=e.schemes.some(i=>i.kind==="bearer");for(let[i,s]of[["--server-url <url>","Override the server URL included in the client."],["--format <json\\|ndjson>","Output format."],["--dry-run","Print the prepared request, credentials redacted, without sending it."],["--page-all","Follow pagination, printing one JSON page per line."],["--output <path>","Write the response body to a file. Required for binary responses."],...o?[["--token <token>","Bearer token, overriding the environment."]]:[],["--json <json\\|@file\\|@->","Request body, inline or from a file or stdin."]])n.line(`| \`${i}\` | ${s} |`);n.blank();let t=m(e.name);if(n.line("## Credentials"),n.blank(),e.schemes.length===0)n.line("The description declares no security schemes, so no credentials are read.");else{n.line("Credentials come from the environment:"),n.blank(),n.line("| Scheme | Variable |"),n.line("| ------ | -------- |");for(let i of e.schemes){let s=i.kind==="bearer"?`\`${t}_TOKEN\` (or \`--token\`)`:i.kind==="basic"?`\`${t}_USERNAME\` and \`${t}_PASSWORD\``:`\`${t}_API_KEY_${m(i.key)}\``;n.line(`| ${i.kind} (\`${i.key}\`) | ${s} |`)}}n.blank(),n.line("## Exit codes"),n.blank(),n.line("| Code | Meaning |"),n.line("| ---- | ------- |");for(let[i,s]of[[0,"success"],[1,"API error (status other than 401 or 403)"],[2,"auth error (401 or 403)"],[3,"validation error"],[4,"usage error (unknown command or flag, bad `--json`)"]])n.line(`| ${i} | ${s} |`);n.blank(),n.line("Errors print one JSON object to stderr, so stdout stays clean for piping."),n.blank();let a=[...new Set(r.map(i=>i.group))];for(let i of a){let s=r.filter(l=>l.group===i);i===void 0?(n.line("## Commands"),n.blank()):(n.line(`## ${i}`),n.blank(),n.line(`Addressed as \`${e.name} ${u(i)} <command>\`.`),n.blank());for(let l of s)D(n,l,e)}return n.toString().replace(/\n{3,}/g,`
|
|
8
8
|
|
|
9
9
|
`).trimEnd()+`
|
|
10
10
|
`}function R(){return j["cli.ts"]}function x(){return C["cli.ts"]}var O="// Generated by @redocly/client-generator \u2014 do not edit by hand.\n// Source: OpenAPI description. Re-run `redocly generate-client` to update.";function q(r){return k.snake(r).replace(/_/g,"-")}function E(r){let e=r.schema,n=e.kind==="array"?"array":e.kind==="scalar"&&(e.scalar==="integer"||e.scalar==="number")?"number":e.kind==="scalar"&&e.scalar==="boolean"?"boolean":"string";return{name:q(r.name),param:r.name,type:n,required:r.required,...e.kind==="enum"?{enum:e.values.map(String)}:{},...r.description!==void 0?{description:r.description}:{}}}function F(r){let e=r.successResponses;return e.some(n=>n.contentType.toLowerCase().includes("json"))?!1:e.some(n=>n.contentType.startsWith("image/")||n.contentType==="application/octet-stream")}function M(r){return r.successResponses.find(e=>e.contentType.toLowerCase().includes("json"))?.schema}function U(r,e,n){if(n!=="flat")return{};let o=g(r,e.schemas);return"mergeBody"in o&&o.mergeBody?{merged:!0}:{}}function _(r,e,n){return n!=="flat"?{}:"collisions"in g(r,e.schemas)?{argsStyle:"grouped"}:{}}function f(r,e){let n=[];for(let o of r.services)for(let t of o.operations){let a=t.requestBody?.contentType.toLowerCase().includes("json")?t.requestBody:void 0,i=M(t);n.push({...t.tags.length>0?{group:t.tags[0]}:{},name:t.name,...t.summary!==void 0?{summary:t.summary}:{},method:t.method.toUpperCase(),path:t.path,positionals:t.pathParams.map(s=>({name:s.name,type:E(s).type,...s.description!==void 0?{description:s.description}:{}})),flags:t.queryParams.map(E),...a?{body:{required:a.required,...U(t,r,e.argsStyle)}}:{},...a===void 0&&t.requestBody!==void 0?{unsupportedBody:t.requestBody.contentType}:{},...e.pagination?.has(t.name)===!0?{paginated:!0}:{},..._(t,r,e.argsStyle),...t.sse!==void 0?{sse:!0}:{},...F(t)?{blob:!0}:{},...a!==void 0||i!==void 0?{schemas:{...a?{request:a.schema}:{},...i!==void 0?{response:i}:{}}}:{}})}return n}var P=`function isProcessEntry(): boolean {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as bt,c as Nt}from"./RFWIIJFG.js";var Xt=Nt((Xe,Wt)=>{var Re=Object.prototype.hasOwnProperty,ke=Object.prototype.toString;Wt.exports=function(C,J,_){if(ke.call(J)!=="[object Function]")throw new TypeError("iterator must be a function");var R=C.length;if(R===+R)for(var w=0;w<R;w++)J.call(_,C[w],w,C);else for(var I in C)Re.call(C,I)&&J.call(_,C[I],I,C)}});var Fe=Nt((Ye,Yt)=>{"use strict";var Ve=Xt();Yt.exports=et;function et(Y,C,J){if(arguments.length===3)return et.set(Y,C,J);if(arguments.length===2)return et.get(Y,C);var _=et.bind(et,Y);for(var R in et)et.hasOwnProperty(R)&&(_[R]=et[R].bind(_,Y));return _}et.get=function(C,J){for(var _=Array.isArray(J)?J:et.parse(J),R=0;R<_.length;++R){var w=_[R];if(!(typeof C=="object"&&w in C))throw new Error("Invalid reference token: "+w);C=C[w]}return C};et.set=function(C,J,_){var R=Array.isArray(J)?J:et.parse(J),w=R[0];if(R.length===0)throw Error("Can not set the root object");for(var I=0;I<R.length-1;++I){var h=R[I];typeof h!="string"&&typeof h!="number"&&(h=String(h)),!(h==="__proto__"||h==="constructor"||h==="prototype")&&(h==="-"&&Array.isArray(C)&&(h=C.length),w=R[I+1],h in C||(w.match(/^(\d+|-)$/)?C[h]=[]:C[h]={}),C=C[h])}return w==="-"&&Array.isArray(C)&&(w=C.length),C[w]=_,this};et.remove=function(Y,C){var J=Array.isArray(C)?C:et.parse(C),_=J[J.length-1];if(_===void 0)throw new Error('Invalid JSON pointer for remove: "'+C+'"');var R=et.get(Y,J.slice(0,-1));if(Array.isArray(R)){var w=+_;if(_===""&&isNaN(w))throw new Error('Invalid array index: "'+_+'"');Array.prototype.splice.call(R,w,1)}else delete R[_]};et.dict=function(C,J){var _={};return et.walk(C,function(R,w){_[w]=R},J),_};et.walk=function(C,J,_){var R=[];_=_||function(w){var I=Object.prototype.toString.call(w);return I==="[object Object]"||I==="[object Array]"},(function w(I){Ve(I,function(h,A){R.push(String(A)),_(h)?w(h):J(h,et.compile(R)),R.pop()})})(C)};et.has=function(C,J){try{et.get(C,J)}catch{return!1}return!0};et.escape=function(C){return C.toString().replace(/~/g,"~0").replace(/\//g,"~1")};et.unescape=function(C){return C.replace(/~1/g,"/").replace(/~0/g,"~")};et.parse=function(C){if(C==="")return[];if(C.charAt(0)!=="/")throw new Error("Invalid JSON pointer: "+C);return C.substring(1).split(/\//).map(et.unescape)};et.compile=function(C){return C.length===0?"":"/"+C.map(et.escape).join("/")}});var Ue=Nt((qt,Mt)=>{(function(Y){if(typeof qt=="object"&&typeof Mt<"u")Mt.exports=Y();else if(typeof define=="function"&&define.amd)define([],Y);else{var C;typeof window<"u"?C=window:typeof global<"u"?C=global:typeof self<"u"?C=self:C=this,C.OpenAPISampler=Y()}})(function(){var Y,C,J;return(function(){function _(R,w,I){function h(N,D){if(!w[N]){if(!R[N]){var j=typeof bt=="function"&&bt;if(!D&&j)return j(N,!0);if(A)return A(N,!0);var $=new Error("Cannot find module '"+N+"'");throw $.code="MODULE_NOT_FOUND",$}var l=w[N]={exports:{}};R[N][0].call(l.exports,function(c){var v=R[N][1][c];return h(v||c)},l,l.exports,_,R,w,I)}return w[N].exports}for(var A=typeof bt=="function"&&bt,y=0;y<I.length;y++)h(I[y]);return h}return _})()({1:[function(_,R,w){(()=>{"use strict";var I={d:(r,t)=>{for(var e in t)I.o(t,e)&&!I.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:t[e]})},o:(r,t)=>Object.prototype.hasOwnProperty.call(r,t),r:r=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},h={};I.r(h),I.d(h,{XMLBuilder:()=>$e,XMLParser:()=>_e,XMLValidator:()=>Le});let A=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",y=new RegExp("^["+A+"]["+A+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function N(r,t){let e=[],i=t.exec(r);for(;i;){let n=[];n.startIndex=t.lastIndex-i[0].length;let o=i.length;for(let u=0;u<o;u++)n.push(i[u]);e.push(n),i=t.exec(r)}return e}let D=function(r){return y.exec(r)!=null},j=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],$=["__proto__","constructor","prototype"],l={allowBooleanAttributes:!1,unpairedTags:[]};function c(r,t){t=Object.assign({},l,t);let e=[],i=!1,n=!1;r[0]==="\uFEFF"&&(r=r.substr(1));for(let o=0;o<r.length;o++)if(r[o]==="<"&&r[o+1]==="?"){if(o+=2,o=P(r,o),o.err)return o}else{if(r[o]!=="<"){if(v(r[o]))continue;return m("InvalidChar","char '"+r[o]+"' is not expected.",b(r,o))}{let u=o;if(o++,r[o]==="!"){o=E(r,o);continue}{let s=!1;r[o]==="/"&&(s=!0,o++);let d="";for(;o<r.length&&r[o]!==">"&&r[o]!==" "&&r[o]!==" "&&r[o]!==`
|
|
8
|
+
`&&r[o]!=="\r";o++)d+=r[o];if(d=d.trim(),d[d.length-1]==="/"&&(d=d.substring(0,d.length-1),o--),!x(d)){let O;return O=d.trim().length===0?"Invalid space after '<'.":"Tag '"+d+"' is an invalid name.",m("InvalidTag",O,b(r,o))}let p=W(r,o);if(p===!1)return m("InvalidAttr","Attributes for '"+d+"' have open quote.",b(r,o));let g=p.value;if(o=p.index,g[g.length-1]==="/"){let O=o-g.length;g=g.substring(0,g.length-1);let M=K(g,t);if(M!==!0)return m(M.err.code,M.err.msg,b(r,O+M.err.line));i=!0}else if(s){if(!p.tagClosed)return m("InvalidTag","Closing tag '"+d+"' doesn't have proper closing.",b(r,o));if(g.trim().length>0)return m("InvalidTag","Closing tag '"+d+"' can't have attributes or invalid starting.",b(r,u));if(e.length===0)return m("InvalidTag","Closing tag '"+d+"' has not been opened.",b(r,u));{let O=e.pop();if(d!==O.tagName){let M=b(r,O.tagStartPos);return m("InvalidTag","Expected closing tag '"+O.tagName+"' (opened in line "+M.line+", col "+M.col+") instead of closing tag '"+d+"'.",b(r,u))}e.length==0&&(n=!0)}}else{let O=K(g,t);if(O!==!0)return m(O.err.code,O.err.msg,b(r,o-g.length+O.err.line));if(n===!0)return m("InvalidXml","Multiple possible root nodes found.",b(r,o));t.unpairedTags.indexOf(d)!==-1||e.push({tagName:d,tagStartPos:u}),i=!0}for(o++;o<r.length;o++)if(r[o]==="<"){if(r[o+1]==="!"){o++,o=E(r,o);continue}if(r[o+1]!=="?")break;if(o=P(r,++o),o.err)return o}else if(r[o]==="&"){let O=f(r,o);if(O==-1)return m("InvalidChar","char '&' is not expected.",b(r,o));o=O}else if(n===!0&&!v(r[o]))return m("InvalidXml","Extra text at the end",b(r,o));r[o]==="<"&&o--}}}return i?e.length==1?m("InvalidTag","Unclosed tag '"+e[0].tagName+"'.",b(r,e[0].tagStartPos)):!(e.length>0)||m("InvalidXml","Invalid '"+JSON.stringify(e.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):m("InvalidXml","Start tag expected.",1)}function v(r){return r===" "||r===" "||r===`
|
|
9
|
+
`||r==="\r"}function P(r,t){let e=t;for(;t<r.length;t++)if(r[t]=="?"||r[t]==" "){let i=r.substr(e,t-e);if(t>5&&i==="xml")return m("InvalidXml","XML declaration allowed only at the start of the document.",b(r,t));if(r[t]=="?"&&r[t+1]==">"){t++;break}continue}return t}function E(r,t){if(r.length>t+5&&r[t+1]==="-"&&r[t+2]==="-"){for(t+=3;t<r.length;t++)if(r[t]==="-"&&r[t+1]==="-"&&r[t+2]===">"){t+=2;break}}else if(r.length>t+8&&r[t+1]==="D"&&r[t+2]==="O"&&r[t+3]==="C"&&r[t+4]==="T"&&r[t+5]==="Y"&&r[t+6]==="P"&&r[t+7]==="E"){let e=1;for(t+=8;t<r.length;t++)if(r[t]==="<")e++;else if(r[t]===">"&&(e--,e===0))break}else if(r.length>t+9&&r[t+1]==="["&&r[t+2]==="C"&&r[t+3]==="D"&&r[t+4]==="A"&&r[t+5]==="T"&&r[t+6]==="A"&&r[t+7]==="["){for(t+=8;t<r.length;t++)if(r[t]==="]"&&r[t+1]==="]"&&r[t+2]===">"){t+=2;break}}return t}let F='"',q="'";function W(r,t){let e="",i="",n=!1;for(;t<r.length;t++){if(r[t]===F||r[t]===q)i===""?i=r[t]:i!==r[t]||(i="");else if(r[t]===">"&&i===""){n=!0;break}e+=r[t]}return i===""&&{value:e,index:t,tagClosed:n}}let U=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function K(r,t){let e=N(r,U),i={};for(let n=0;n<e.length;n++){if(e[n][1].length===0)return m("InvalidAttr","Attribute '"+e[n][2]+"' has no space in starting.",T(e[n]));if(e[n][3]!==void 0&&e[n][4]===void 0)return m("InvalidAttr","Attribute '"+e[n][2]+"' is without value.",T(e[n]));if(e[n][3]===void 0&&!t.allowBooleanAttributes)return m("InvalidAttr","boolean attribute '"+e[n][2]+"' is not allowed.",T(e[n]));let o=e[n][2];if(!a(o))return m("InvalidAttr","Attribute '"+o+"' is an invalid name.",T(e[n]));if(Object.prototype.hasOwnProperty.call(i,o))return m("InvalidAttr","Attribute '"+o+"' is repeated.",T(e[n]));i[o]=1}return!0}function f(r,t){if(r[++t]===";")return-1;if(r[t]==="#")return(function(i,n){let o=/\d/;for(i[n]==="x"&&(n++,o=/[\da-fA-F]/);n<i.length;n++){if(i[n]===";")return n;if(!i[n].match(o))break}return-1})(r,++t);let e=0;for(;t<r.length;t++,e++)if(!(r[t].match(/\w/)&&e<20)){if(r[t]===";")break;return-1}return t}function m(r,t,e){return{err:{code:r,msg:t,line:e.line||e,col:e.col}}}function a(r){return D(r)}function x(r){return D(r)}function b(r,t){let e=r.substring(0,t).split(/\r?\n/);return{line:e.length,col:e[e.length-1].length+1}}function T(r){return r.startIndex+r[1].length}let B=r=>j.includes(r)?"__"+r:r,Q={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(r,t){return t},attributeValueProcessor:function(r,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(r,t,e){return r},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:B};function H(r,t){if(typeof r!="string")return;let e=r.toLowerCase();if(j.some(i=>e===i.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${r}" is a reserved JavaScript keyword that could cause prototype pollution`);if($.some(i=>e===i.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${r}" is a reserved JavaScript keyword that could cause prototype pollution`)}function S(r,t){return typeof r=="boolean"?{enabled:r,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:typeof r=="object"&&r!==null?{enabled:r.enabled!==!1,maxEntitySize:Math.max(1,r.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,r.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,r.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,r.maxExpandedLength??1e5),maxEntityCount:Math.max(1,r.maxEntityCount??1e3),allowedTags:r.allowedTags??null,tagFilter:r.tagFilter??null,appliesTo:r.appliesTo??"all"}:S(!0)}let G=function(r){let t=Object.assign({},Q,r),e=[{value:t.attributeNamePrefix,name:"attributeNamePrefix"},{value:t.attributesGroupName,name:"attributesGroupName"},{value:t.textNodeName,name:"textNodeName"},{value:t.cdataPropName,name:"cdataPropName"},{value:t.commentPropName,name:"commentPropName"}];for(let{value:i,name:n}of e)i&&H(i,n);return t.onDangerousProperty===null&&(t.onDangerousProperty=B),t.processEntities=S(t.processEntities,t.htmlEntities),t.unpairedTagsSet=new Set(t.unpairedTags),t.stopNodes&&Array.isArray(t.stopNodes)&&(t.stopNodes=t.stopNodes.map(i=>typeof i=="string"&&i.startsWith("*.")?".."+i.substring(2):i)),t},X;X=typeof Symbol!="function"?"@@xmlMetadata":Symbol("XML Node Metadata");class tt{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,e){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t,e){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),e!==void 0&&(this.child[this.child.length-1][X]={startIndex:e})}static getMetaDataSymbol(){return X}}class Z{constructor(t){this.suppressValidationErr=!t,this.options=t}readDocType(t,e){let i=Object.create(null),n=0;if(t[e+3]!=="O"||t[e+4]!=="C"||t[e+5]!=="T"||t[e+6]!=="Y"||t[e+7]!=="P"||t[e+8]!=="E")throw new Error("Invalid Tag instead of DOCTYPE");{e+=9;let o=1,u=!1,s=!1,d="";for(;e<t.length;e++)if(t[e]!=="<"||s)if(t[e]===">"){if(s?t[e-1]==="-"&&t[e-2]==="-"&&(s=!1,o--):o--,o===0)break}else t[e]==="["?u=!0:d+=t[e];else{if(u&&nt(t,"!ENTITY",e)){let p,g;if(e+=7,[p,g,e]=this.readEntityExp(t,e+1,this.suppressValidationErr),g.indexOf("&")===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&n>=this.options.maxEntityCount)throw new Error(`Entity count (${n+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);i[p]=g,n++}}else if(u&&nt(t,"!ELEMENT",e)){e+=8;let{index:p}=this.readElementExp(t,e+1);e=p}else if(u&&nt(t,"!ATTLIST",e))e+=8;else if(u&&nt(t,"!NOTATION",e)){e+=9;let{index:p}=this.readNotationExp(t,e+1,this.suppressValidationErr);e=p}else{if(!nt(t,"!--",e))throw new Error("Invalid DOCTYPE");s=!0}o++,d=""}if(o!==0)throw new Error("Unclosed DOCTYPE")}return{entities:i,i:e}}readEntityExp(t,e){let i=e=z(t,e);for(;e<t.length&&!/\s/.test(t[e])&&t[e]!=='"'&&t[e]!=="'";)e++;let n=t.substring(i,e);if(ut(n),e=z(t,e),!this.suppressValidationErr){if(t.substring(e,e+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[e]==="%")throw new Error("Parameter entities are not supported")}let o="";if([e,o]=this.readIdentifierVal(t,e,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&o.length>this.options.maxEntitySize)throw new Error(`Entity "${n}" size (${o.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[n,o,--e]}readNotationExp(t,e){let i=e=z(t,e);for(;e<t.length&&!/\s/.test(t[e]);)e++;let n=t.substring(i,e);!this.suppressValidationErr&&ut(n),e=z(t,e);let o=t.substring(e,e+6).toUpperCase();if(!this.suppressValidationErr&&o!=="SYSTEM"&&o!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${o}"`);e+=o.length,e=z(t,e);let u=null,s=null;if(o==="PUBLIC")[e,u]=this.readIdentifierVal(t,e,"publicIdentifier"),t[e=z(t,e)]!=='"'&&t[e]!=="'"||([e,s]=this.readIdentifierVal(t,e,"systemIdentifier"));else if(o==="SYSTEM"&&([e,s]=this.readIdentifierVal(t,e,"systemIdentifier"),!this.suppressValidationErr&&!s))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:n,publicIdentifier:u,systemIdentifier:s,index:--e}}readIdentifierVal(t,e,i){let n="",o=t[e];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);let u=++e;for(;e<t.length&&t[e]!==o;)e++;if(n=t.substring(u,e),t[e]!==o)throw new Error(`Unterminated ${i} value`);return[++e,n]}readElementExp(t,e){let i=e=z(t,e);for(;e<t.length&&!/\s/.test(t[e]);)e++;let n=t.substring(i,e);if(!this.suppressValidationErr&&!D(n))throw new Error(`Invalid element name: "${n}"`);let o="";if(t[e=z(t,e)]==="E"&&nt(t,"MPTY",e))e+=4;else if(t[e]==="A"&&nt(t,"NY",e))e+=2;else if(t[e]==="("){let u=++e;for(;e<t.length&&t[e]!==")";)e++;if(o=t.substring(u,e),t[e]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[e]}"`);return{elementName:n,contentModel:o.trim(),index:e}}readAttlistExp(t,e){let i=e=z(t,e);for(;e<t.length&&!/\s/.test(t[e]);)e++;let n=t.substring(i,e);for(ut(n),i=e=z(t,e);e<t.length&&!/\s/.test(t[e]);)e++;let o=t.substring(i,e);if(!ut(o))throw new Error(`Invalid attribute name: "${o}"`);e=z(t,e);let u="";if(t.substring(e,e+8).toUpperCase()==="NOTATION"){if(u="NOTATION",t[e=z(t,e+=8)]!=="(")throw new Error(`Expected '(', found "${t[e]}"`);e++;let d=[];for(;e<t.length&&t[e]!==")";){let p=e;for(;e<t.length&&t[e]!=="|"&&t[e]!==")";)e++;let g=t.substring(p,e);if(g=g.trim(),!ut(g))throw new Error(`Invalid notation name: "${g}"`);d.push(g),t[e]==="|"&&(e++,e=z(t,e))}if(t[e]!==")")throw new Error("Unterminated list of notations");e++,u+=" ("+d.join("|")+")"}else{let d=e;for(;e<t.length&&!/\s/.test(t[e]);)e++;u+=t.substring(d,e);let p=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!p.includes(u.toUpperCase()))throw new Error(`Invalid attribute type: "${u}"`)}e=z(t,e);let s="";return t.substring(e,e+8).toUpperCase()==="#REQUIRED"?(s="#REQUIRED",e+=8):t.substring(e,e+7).toUpperCase()==="#IMPLIED"?(s="#IMPLIED",e+=7):[e,s]=this.readIdentifierVal(t,e,"ATTLIST"),{elementName:n,attributeName:o,attributeType:u,defaultValue:s,index:e}}}let z=(r,t)=>{for(;t<r.length&&/\s/.test(r[t]);)t++;return t};function nt(r,t,e){for(let i=0;i<t.length;i++)if(t[i]!==r[e+i+1])return!1;return!0}function ut(r){if(D(r))return r;throw new Error(`Invalid entity name ${r}`)}let gt=/^[-+]?0x[a-fA-F0-9]+$/,ht=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Ht={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"},Qt=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;class te{constructor(t){this._matcher=t}get separator(){return this._matcher.separator}getCurrentTag(){let t=this._matcher.path;return t.length>0?t[t.length-1].tag:void 0}getCurrentNamespace(){let t=this._matcher.path;return t.length>0?t[t.length-1].namespace:void 0}getAttrValue(t){let e=this._matcher.path;if(e.length!==0)return e[e.length-1].values?.[t]}hasAttr(t){let e=this._matcher.path;if(e.length===0)return!1;let i=e[e.length-1];return i.values!==void 0&&t in i.values}getPosition(){let t=this._matcher.path;return t.length===0?-1:t[t.length-1].position??0}getCounter(){let t=this._matcher.path;return t.length===0?-1:t[t.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(t,e=!0){return this._matcher.toString(t,e)}toArray(){return this._matcher.path.map(t=>t.tag)}matches(t){return this._matcher.matches(t)}matchesAny(t){return t.matchesAny(this._matcher)}}class Ot{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new te(this)}push(t,e=null,i=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let n=this.path.length;this.siblingStacks[n]||(this.siblingStacks[n]=new Map);let o=this.siblingStacks[n],u=i?`${i}:${t}`:t,s=o.get(u)||0,d=0;for(let g of o.values())d+=g;o.set(u,s+1);let p={tag:t,position:d,counter:s};i!=null&&(p.namespace=i),e!=null&&(p.values=e),this.path.push(p)}pop(){if(this.path.length===0)return;this._pathStringCache=null;let t=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),t}updateCurrent(t){if(this.path.length>0){let e=this.path[this.path.length-1];t!=null&&(e.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(this.path.length!==0)return this.path[this.path.length-1].values?.[t]}hasAttr(t){if(this.path.length===0)return!1;let e=this.path[this.path.length-1];return e.values!==void 0&&t in e.values}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,e=!0){let i=t||this.separator;if(i===this.separator&&e===!0){if(this._pathStringCache!==null)return this._pathStringCache;let n=this.path.map(o=>o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(i);return this._pathStringCache=n,n}return this.path.map(n=>e&&n.namespace?`${n.namespace}:${n.tag}`:n.tag).join(i)}toArray(){return this.path.map(t=>t.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[]}matches(t){let e=t.segments;return e.length!==0&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(e):this._matchSimple(e))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let e=0;e<t.length;e++)if(!this._matchSegment(t[e],this.path[e],e===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(t){let e=this.path.length-1,i=t.length-1;for(;i>=0&&e>=0;){let n=t[i];if(n.type==="deep-wildcard"){if(i--,i<0)return!0;let o=t[i],u=!1;for(let s=e;s>=0;s--)if(this._matchSegment(o,this.path[s],s===this.path.length-1)){e=s-1,i--,u=!0;break}if(!u)return!1}else{if(!this._matchSegment(n,this.path[e],e===this.path.length-1))return!1;e--,i--}}return i<0}_matchSegment(t,e,i){if(t.tag!=="*"&&t.tag!==e.tag||t.namespace!==void 0&&t.namespace!=="*"&&t.namespace!==e.namespace||t.attrName!==void 0&&(!i||!e.values||!(t.attrName in e.values)||t.attrValue!==void 0&&String(e.values[t.attrName])!==String(t.attrValue)))return!1;if(t.position!==void 0){if(!i)return!1;let n=e.counter??0;if(t.position==="first"&&n!==0||t.position==="odd"&&n%2!=1||t.position==="even"&&n%2!=0||t.position==="nth"&&n!==t.positionValue)return!1}return!0}matchesAny(t){return t.matchesAny(this)}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>new Map(t))}}restore(t){this._pathStringCache=null,this.path=t.path.map(e=>({...e})),this.siblingStacks=t.siblingStacks.map(e=>new Map(e))}readOnly(){return this._view}}class vt{constructor(t,e={},i){this.pattern=t,this.separator=e.separator||".",this.segments=this._parse(t),this.data=i,this._hasDeepWildcard=this.segments.some(n=>n.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(n=>n.attrName!==void 0),this._hasPositionSelector=this.segments.some(n=>n.position!==void 0)}_parse(t){let e=[],i=0,n="";for(;i<t.length;)t[i]===this.separator?i+1<t.length&&t[i+1]===this.separator?(n.trim()&&(e.push(this._parseSegment(n.trim())),n=""),e.push({type:"deep-wildcard"}),i+=2):(n.trim()&&e.push(this._parseSegment(n.trim())),n="",i++):(n+=t[i],i++);return n.trim()&&e.push(this._parseSegment(n.trim())),e}_parseSegment(t){let e={type:"tag"},i=null,n=t,o=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(o&&(n=o[1]+o[3],o[2])){let g=o[2].slice(1,-1);g&&(i=g)}let u,s,d=n;if(n.includes("::")){let g=n.indexOf("::");if(u=n.substring(0,g).trim(),d=n.substring(g+2).trim(),!u)throw new Error(`Invalid namespace in pattern: ${t}`)}let p=null;if(d.includes(":")){let g=d.lastIndexOf(":"),O=d.substring(0,g).trim(),M=d.substring(g+1).trim();["first","last","odd","even"].includes(M)||/^nth\(\d+\)$/.test(M)?(s=O,p=M):s=d}else s=d;if(!s)throw new Error(`Invalid segment pattern: ${t}`);if(e.tag=s,u&&(e.namespace=u),i)if(i.includes("=")){let g=i.indexOf("=");e.attrName=i.substring(0,g).trim(),e.attrValue=i.substring(g+1).trim()}else e.attrName=i.trim();if(p){let g=p.match(/^nth\((\d+)\)$/);g?(e.position="nth",e.positionValue=parseInt(g[1],10)):e.position=p}return e}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class ee{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._patterns=new Set,this._sealed=!1}add(t){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(t.pattern))return this;if(this._patterns.add(t.pattern),t.hasDeepWildcard())return this._deepWildcards.push(t),this;let e=t.length,i=t.segments[t.segments.length-1],n=i?.tag;if(n&&n!=="*"){let o=`${e}:${n}`;this._byDepthAndTag.has(o)||this._byDepthAndTag.set(o,[]),this._byDepthAndTag.get(o).push(t)}else this._wildcardByDepth.has(e)||this._wildcardByDepth.set(e,[]),this._wildcardByDepth.get(e).push(t);return this}addAll(t){for(let e of t)this.add(e);return this}has(t){return this._patterns.has(t.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(t){return this.findMatch(t)!==null}findMatch(t){let e=t.getDepth(),i=`${e}:${t.getCurrentTag()}`,n=this._byDepthAndTag.get(i);if(n){for(let u=0;u<n.length;u++)if(t.matches(n[u]))return n[u]}let o=this._wildcardByDepth.get(e);if(o){for(let u=0;u<o.length;u++)if(t.matches(o[u]))return o[u]}for(let u=0;u<this._deepWildcards.length;u++)if(t.matches(this._deepWildcards[u]))return this._deepWildcards[u];return null}}let re={cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",euro:"\u20AC",dollar:"$",euro:"\u20AC",fnof:"\u0192",inr:"\u20B9",af:"\u060B",birr:"\u1265\u122D",peso:"\u20B1",rub:"\u20BD",won:"\u20A9",yuan:"\xA5",cedil:"\xB8"},$t={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},ne={nbsp:"\xA0",copy:"\xA9",reg:"\xAE",trade:"\u2122",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",laquo:"\xAB",raquo:"\xBB",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",bull:"\u2022",para:"\xB6",sect:"\xA7",deg:"\xB0",frac12:"\xBD",frac14:"\xBC",frac34:"\xBE"},ie=new Set("!?\\\\/[]$%{}^&*()<>|+");function Lt(r){if(r[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${r}"`);for(let t of r)if(ie.has(t))throw new Error(`[EntityReplacer] Invalid character '${t}' in entity name: "${r}"`);return r}function Et(...r){let t=Object.create(null);for(let e of r)if(e)for(let i of Object.keys(e)){let n=e[i];if(typeof n=="string")t[i]=n;else if(n&&typeof n=="object"&&n.val!==void 0){let o=n.val;typeof o=="string"&&(t[i]=o)}}return t}let yt="external",wt="base",St="all",lt=Object.freeze({allow:0,leave:1,remove:2,throw:3}),oe=new Set([9,10,13]);class se{constructor(t={}){var e;this._limit=t.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof t.postCheck=="function"?t.postCheck:n=>n,this._limitTiers=(e=this._limit.applyLimitsTo??yt)&&e!==yt?e===St?new Set([St]):e===wt?new Set([wt]):Array.isArray(e)?new Set(e):new Set([yt]):new Set([yt]),this._numericAllowed=t.numericAllowed??!0,this._baseMap=Et($t,t.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(t.remove&&Array.isArray(t.remove)?t.remove:[]),this._leaveSet=new Set(t.leave&&Array.isArray(t.leave)?t.leave:[]);let i=(function(n){if(!n)return{xmlVersion:1,onLevel:lt.allow,nullLevel:lt.remove};let o=n.xmlVersion===1.1?1.1:1,u=lt[n.onNCR]??lt.allow,s=lt[n.nullNCR]??lt.remove;return{xmlVersion:o,onLevel:u,nullLevel:Math.max(s,lt.remove)}})(t.ncr);this._ncrXmlVersion=i.xmlVersion,this._ncrOnLevel=i.onLevel,this._ncrNullLevel=i.nullLevel}setExternalEntities(t){if(t)for(let e of Object.keys(t))Lt(e);this._externalMap=Et(t)}addExternalEntity(t,e){Lt(t),typeof e=="string"&&e.indexOf("&")===-1&&(this._externalMap[t]=e)}addInputEntities(t){this._totalExpansions=0,this._expandedLength=0,this._inputMap=Et(t)}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(t){this._ncrXmlVersion=t===1.1?1.1:1}decode(t){if(typeof t!="string"||t.length===0)return t;let e=t,i=[],n=t.length,o=0,u=0,s=this._maxTotalExpansions>0,d=this._maxExpandedLength>0,p=s||d;for(;u<n;){if(t.charCodeAt(u)!==38){u++;continue}let O=u+1;for(;O<n&&t.charCodeAt(O)!==59&&O-u<=32;)O++;if(O>=n||t.charCodeAt(O)!==59){u++;continue}let M=t.slice(u+1,O);if(M.length===0){u++;continue}let L,k;if(this._removeSet.has(M))L="",k===void 0&&(k=yt);else{if(this._leaveSet.has(M)){u++;continue}if(M.charCodeAt(0)===35){let V=this._resolveNCR(M);if(V===void 0){u++;continue}L=V,k=wt}else{let V=this._resolveName(M);L=V?.value,k=V?.tier}}if(L!==void 0){if(u>o&&i.push(t.slice(o,u)),i.push(L),o=O+1,u=o,p&&this._tierCounts(k)){if(s&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(d){let V=L.length-(M.length+2);if(V>0&&(this._expandedLength+=V,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}else u++}o<n&&i.push(t.slice(o));let g=i.length===0?t:i.join("");return this._postCheck(g,e)}_tierCounts(t){return!!this._limitTiers.has(St)||this._limitTiers.has(t)}_resolveName(t){return t in this._inputMap?{value:this._inputMap[t],tier:yt}:t in this._externalMap?{value:this._externalMap[t],tier:yt}:t in this._baseMap?{value:this._baseMap[t],tier:wt}:void 0}_classifyNCR(t){return t===0?this._ncrNullLevel:t>=55296&&t<=57343||this._ncrXmlVersion===1&&t>=1&&t<=31&&!oe.has(t)?lt.remove:-1}_applyNCRAction(t,e,i){switch(t){case lt.allow:return String.fromCodePoint(i);case lt.remove:return"";case lt.leave:return;case lt.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${e}; (U+${i.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(i)}}_resolveNCR(t){let e=t.charCodeAt(1),i;if(i=e===120||e===88?parseInt(t.slice(2),16):parseInt(t.slice(1),10),Number.isNaN(i)||i<0||i>1114111)return;let n=this._classifyNCR(i);if(!this._numericAllowed&&n<lt.remove)return;let o=n===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,n);return this._applyNCRAction(o,t,i)}}function ae(r,t){if(!r)return{};let e=t.attributesGroupName?r[t.attributesGroupName]:r;if(!e)return{};let i={};for(let n in e)n.startsWith(t.attributeNamePrefix)?i[n.substring(t.attributeNamePrefix.length)]=e[n]:i[n]=e[n];return i}function le(r){if(!r||typeof r!="string")return;let t=r.indexOf(":");if(t!==-1&&t>0){let e=r.substring(0,t);if(e!=="xmlns")return e}}class ue{constructor(t){var e;this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=de,this.parseTextData=pe,this.resolveNameSpace=ce,this.buildAttributesMap=he,this.isItStopNode=be,this.replaceEntitiesValue=ge,this.readStopNodeData=xe,this.saveTextToParentTag=ye,this.addChild=me,this.ignoreAttributesFn=typeof(e=this.options.ignoreAttributes)=="function"?e:Array.isArray(e)?o=>{for(let u of e)if(typeof u=="string"&&o===u||u instanceof RegExp&&u.test(o))return!0}:()=>!1,this.entityExpansionCount=0,this.currentExpandedLength=0;let i={...$t};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities=="object"?i=this.options.htmlEntities:this.options.htmlEntities===!0&&(i={...ne,...re}),this.entityDecoder=new se({namedEntities:i,numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo}})),this.matcher=new Ot,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new ee;let n=this.options.stopNodes;if(n&&n.length>0){for(let o=0;o<n.length;o++){let u=n[o];typeof u=="string"?this.stopNodeExpressionsSet.add(new vt(u)):u instanceof vt&&this.stopNodeExpressionsSet.add(u)}this.stopNodeExpressionsSet.seal()}}}function pe(r,t,e,i,n,o,u){let s=this.options;if(r!==void 0&&(s.trimValues&&!i&&(r=r.trim()),r.length>0)){u||(r=this.replaceEntitiesValue(r,t,e));let d=s.jPath?e.toString():e,p=s.tagValueProcessor(t,r,d,n,o);return p==null?r:typeof p!=typeof r||p!==r?p:s.trimValues||r.trim()===r?Rt(r,s.parseTagValue,s.numberParseOptions):r}}function ce(r){if(this.options.removeNSPrefix){let t=r.split(":"),e=r.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(r=e+t[1])}return r}let fe=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function he(r,t,e,i=!1){let n=this.options;if(i===!0||n.ignoreAttributes!==!0&&typeof r=="string"){let o=N(r,fe),u=o.length,s={},d=new Array(u),p=!1,g={};for(let L=0;L<u;L++){let k=this.resolveNameSpace(o[L][1]),V=o[L][4];if(k.length&&V!==void 0){let rt=V;n.trimValues&&(rt=rt.trim()),rt=this.replaceEntitiesValue(rt,e,this.readonlyMatcher),d[L]=rt,g[k]=rt,p=!0}}p&&typeof t=="object"&&t.updateCurrent&&t.updateCurrent(g);let O=n.jPath?t.toString():this.readonlyMatcher,M=!1;for(let L=0;L<u;L++){let k=this.resolveNameSpace(o[L][1]);if(this.ignoreAttributesFn(k,O))continue;let V=n.attributeNamePrefix+k;if(k.length)if(n.transformAttributeName&&(V=n.transformAttributeName(V)),V=kt(V,n),o[L][4]!==void 0){let rt=d[L],ot=n.attributeValueProcessor(k,rt,O);s[V]=ot==null?rt:typeof ot!=typeof rt||ot!==rt?ot:Rt(rt,n.parseAttributeValue,n.numberParseOptions),M=!0}else n.allowBooleanAttributes&&(s[V]=!0,M=!0)}if(!M)return;if(n.attributesGroupName){let L={};return L[n.attributesGroupName]=s,L}return s}}let de=function(r){r=r.replace(/\r\n?/g,`
|
|
10
|
+
`);let t=new tt("!xml"),e=t,i="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let n=this.options,o=new Z(n.processEntities),u=r.length;for(let s=0;s<u;s++)if(r[s]==="<"){let d=r.charCodeAt(s+1);if(d===47){let p=xt(r,">",s,"Closing Tag is not closed."),g=r.substring(s+2,p).trim();if(n.removeNSPrefix){let M=g.indexOf(":");M!==-1&&(g=g.substr(M+1))}g=Pt(n.transformTagName,g,"",n).tagName,e&&(i=this.saveTextToParentTag(i,e,this.readonlyMatcher));let O=this.matcher.getCurrentTag();if(g&&n.unpairedTagsSet.has(g))throw new Error(`Unpaired tag can not be used as closing tag: </${g}>`);O&&n.unpairedTagsSet.has(O)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,e=this.tagsNodeStack.pop(),i="",s=p}else if(d===63){let p=_t(r,s,!1,"?>");if(!p)throw new Error("Pi Tag is not closed.");i=this.saveTextToParentTag(i,e,this.readonlyMatcher);let g=this.buildAttributesMap(p.tagExp,this.matcher,p.tagName,!0);if(g){let O=g[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(O)||1)}if(!(n.ignoreDeclaration&&p.tagName==="?xml"||n.ignorePiTags)){let O=new tt(p.tagName);O.add(n.textNodeName,""),p.tagName!==p.tagExp&&p.attrExpPresent&&n.ignoreAttributes!==!0&&(O[":@"]=g),this.addChild(e,O,this.readonlyMatcher,s)}s=p.closeIndex+1}else if(d===33&&r.charCodeAt(s+2)===45&&r.charCodeAt(s+3)===45){let p=xt(r,"-->",s+4,"Comment is not closed.");if(n.commentPropName){let g=r.substring(s+4,p-2);i=this.saveTextToParentTag(i,e,this.readonlyMatcher),e.add(n.commentPropName,[{[n.textNodeName]:g}])}s=p}else if(d===33&&r.charCodeAt(s+2)===68){let p=o.readDocType(r,s);this.entityDecoder.addInputEntities(p.entities),s=p.i}else if(d===33&&r.charCodeAt(s+2)===91){let p=xt(r,"]]>",s,"CDATA is not closed.")-2,g=r.substring(s+9,p);i=this.saveTextToParentTag(i,e,this.readonlyMatcher);let O=this.parseTextData(g,e.tagname,this.readonlyMatcher,!0,!1,!0,!0);O==null&&(O=""),n.cdataPropName?e.add(n.cdataPropName,[{[n.textNodeName]:g}]):e.add(n.textNodeName,O),s=p+2}else{let p=_t(r,s,n.removeNSPrefix);if(!p){let at=r.substring(Math.max(0,s-50),Math.min(u,s+50));throw new Error(`readTagExp returned undefined at position ${s}. Context: "${at}"`)}let g=p.tagName,O=p.rawTagName,M=p.tagExp,L=p.attrExpPresent,k=p.closeIndex;if({tagName:g,tagExp:M}=Pt(n.transformTagName,g,M,n),n.strictReservedNames&&(g===n.commentPropName||g===n.cdataPropName||g===n.textNodeName||g===n.attributesGroupName))throw new Error(`Invalid tag name: ${g}`);e&&i&&e.tagname!=="!xml"&&(i=this.saveTextToParentTag(i,e,this.readonlyMatcher,!1));let V=e;V&&n.unpairedTagsSet.has(V.tagname)&&(e=this.tagsNodeStack.pop(),this.matcher.pop());let rt=!1;M.length>0&&M.lastIndexOf("/")===M.length-1&&(rt=!0,g[g.length-1]==="/"?(g=g.substr(0,g.length-1),M=g):M=M.substr(0,M.length-1),L=g!==M);let ot,st=null,dt={};ot=le(O),g!==t.tagname&&this.matcher.push(g,{},ot),g!==M&&L&&(st=this.buildAttributesMap(M,this.matcher,g),st&&(dt=ae(st,n))),g!==t.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let ct=s;if(this.isCurrentNodeStopNode){let at="";if(rt)s=p.closeIndex;else if(n.unpairedTagsSet.has(g))s=p.closeIndex;else{let jt=this.readStopNodeData(r,O,k+1);if(!jt)throw new Error(`Unexpected end of ${O}`);s=jt.i,at=jt.tagContent}let Ct=new tt(g);st&&(Ct[":@"]=st),Ct.add(n.textNodeName,at),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(e,Ct,this.readonlyMatcher,ct)}else{if(rt){({tagName:g,tagExp:M}=Pt(n.transformTagName,g,M,n));let at=new tt(g);st&&(at[":@"]=st),this.addChild(e,at,this.readonlyMatcher,ct),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else{if(n.unpairedTagsSet.has(g)){let at=new tt(g);st&&(at[":@"]=st),this.addChild(e,at,this.readonlyMatcher,ct),this.matcher.pop(),this.isCurrentNodeStopNode=!1,s=p.closeIndex;continue}{let at=new tt(g);if(this.tagsNodeStack.length>n.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(e),st&&(at[":@"]=st),this.addChild(e,at,this.readonlyMatcher,ct),e=at}}i="",s=k}}}else i+=r[s];return t.child};function me(r,t,e,i){this.options.captureMetaData||(i=void 0);let n=this.options.jPath?e.toString():e,o=this.options.updateTag(t.tagname,n,t[":@"]);o===!1||(typeof o=="string"&&(t.tagname=o),r.addChild(t,i))}function ge(r,t,e){let i=this.options.processEntities;if(!i||!i.enabled)return r;if(i.allowedTags){let n=this.options.jPath?e.toString():e;if(!(Array.isArray(i.allowedTags)?i.allowedTags.includes(t):i.allowedTags(t,n)))return r}if(i.tagFilter){let n=this.options.jPath?e.toString():e;if(!i.tagFilter(t,n))return r}return this.entityDecoder.decode(r)}function ye(r,t,e,i){return r&&(i===void 0&&(i=t.child.length===0),(r=this.parseTextData(r,t.tagname,e,!1,!!t[":@"]&&Object.keys(t[":@"]).length!==0,i))!==void 0&&r!==""&&t.add(this.options.textNodeName,r),r=""),r}function be(){return this.stopNodeExpressionsSet.size!==0&&this.matcher.matchesAny(this.stopNodeExpressionsSet)}function xt(r,t,e,i){let n=r.indexOf(t,e);if(n===-1)throw new Error(i);return n+t.length-1}function ve(r,t,e,i){let n=r.indexOf(t,e);if(n===-1)throw new Error(i);return n}function _t(r,t,e,i=">"){let n=(function(O,M,L=">"){let k=0,V=[],rt=O.length,ot=L.charCodeAt(0),st=L.length>1?L.charCodeAt(1):-1;for(let dt=M;dt<rt;dt++){let ct=O.charCodeAt(dt);if(k)ct===k&&(k=0);else if(ct===34||ct===39)k=ct;else if(ct===ot){if(st===-1)return{data:String.fromCharCode(...V),index:dt};if(O.charCodeAt(dt+1)===st)return{data:String.fromCharCode(...V),index:dt}}else if(ct===9){V.push(32);continue}V.push(ct)}})(r,t+1,i);if(!n)return;let o=n.data,u=n.index,s=o.search(/\s/),d=o,p=!0;s!==-1&&(d=o.substring(0,s),o=o.substring(s+1).trimStart());let g=d;if(e){let O=d.indexOf(":");O!==-1&&(d=d.substr(O+1),p=d!==n.data.substr(O+1))}return{tagName:d,tagExp:o,closeIndex:u,attrExpPresent:p,rawTagName:g}}function xe(r,t,e){let i=e,n=1,o=r.length;for(;e<o;e++)if(r[e]==="<"){let u=r.charCodeAt(e+1);if(u===47){let s=ve(r,">",e,`${t} is not closed`);if(r.substring(e+2,s).trim()===t&&(n--,n===0))return{tagContent:r.substring(i,e),i:s};e=s}else if(u===63)e=xt(r,"?>",e+1,"StopNode is not closed.");else if(u===33&&r.charCodeAt(e+2)===45&&r.charCodeAt(e+3)===45)e=xt(r,"-->",e+3,"StopNode is not closed.");else if(u===33&&r.charCodeAt(e+2)===91)e=xt(r,"]]>",e,"StopNode is not closed.")-2;else{let s=_t(r,e,">");s&&((s&&s.tagName)===t&&s.tagExp[s.tagExp.length-1]!=="/"&&n++,e=s.closeIndex)}}}function Rt(r,t,e){if(t&&typeof r=="string"){let i=r.trim();return i==="true"||i!=="false"&&(function(n,o={}){if(o=Object.assign({},Ht,o),!n||typeof n!="string")return n;let u=n.trim();if(u.length===0||o.skipLike!==void 0&&o.skipLike.test(u))return n;if(u==="0")return 0;if(o.hex&>.test(u))return(function(d){if(parseInt)return parseInt(d,16);if(Number.parseInt)return Number.parseInt(d,16);if(window&&window.parseInt)return window.parseInt(d,16);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")})(u);if(isFinite(u)){if(u.includes("e")||u.includes("E"))return(function(d,p,g){if(!g.eNotation)return d;let O=p.match(Qt);if(O){let M=O[1]||"",L=O[3].indexOf("e")===-1?"E":"e",k=O[2],V=M?d[k.length+1]===L:d[k.length]===L;return k.length>1&&V?d:(k.length!==1||!O[3].startsWith(`.${L}`)&&O[3][0]!==L)&&k.length>0?g.leadingZeros&&!V?(p=(O[1]||"")+O[3],Number(p)):d:Number(p)}return d})(n,u,o);{let d=ht.exec(u);if(d){let p=d[1]||"",g=d[2],O=((s=d[3])&&s.indexOf(".")!==-1&&((s=s.replace(/0+$/,""))==="."?s="0":s[0]==="."?s="0"+s:s[s.length-1]==="."&&(s=s.substring(0,s.length-1))),s),M=p?n[g.length+1]===".":n[g.length]===".";if(!o.leadingZeros&&(g.length>1||g.length===1&&!M))return n;{let L=Number(u),k=String(L);if(L===0)return L;if(k.search(/[eE]/)!==-1)return o.eNotation?L:n;if(u.indexOf(".")!==-1)return k==="0"||k===O||k===`${p}${O}`?L:n;let V=g?O:u;return g?V===k||p+V===k?L:n:V===k||V===p+k?L:n}}return n}}var s;return(function(d,p,g){let O=p===1/0;switch(g.infinity.toLowerCase()){case"null":return null;case"infinity":return p;case"string":return O?"Infinity":"-Infinity";default:return d}})(n,Number(u),o)})(r,e)}return r!==void 0?r:""}function Pt(r,t,e,i){if(r){let n=r(t);e===t&&(e=n),t=n}return{tagName:t=kt(t,i),tagExp:e}}function kt(r,t){if($.includes(r))throw new Error(`[SECURITY] Invalid name: "${r}" is a reserved JavaScript keyword that could cause prototype pollution`);return j.includes(r)?t.onDangerousProperty(r):r}let At=tt.getMetaDataSymbol();function Ne(r,t){if(!r||typeof r!="object")return{};if(!t)return r;let e={};for(let i in r)i.startsWith(t)?e[i.substring(t.length)]=r[i]:e[i]=r[i];return e}function we(r,t,e,i){return Vt(r,t,e,i)}function Vt(r,t,e,i){let n,o={};for(let u=0;u<r.length;u++){let s=r[u],d=Oe(s);if(d!==void 0&&d!==t.textNodeName){let p=Ne(s[":@"]||{},t.attributeNamePrefix);e.push(d,p)}if(d===t.textNodeName)n===void 0?n=s[d]:n+=""+s[d];else{if(d===void 0)continue;if(s[d]){let p=Vt(s[d],t,e,i),g=Se(p,t);if(s[":@"]?Ee(p,s[":@"],i,t):Object.keys(p).length!==1||p[t.textNodeName]===void 0||t.alwaysCreateTextNode?Object.keys(p).length===0&&(t.alwaysCreateTextNode?p[t.textNodeName]="":p=""):p=p[t.textNodeName],s[At]!==void 0&&typeof p=="object"&&p!==null&&(p[At]=s[At]),o[d]!==void 0&&Object.prototype.hasOwnProperty.call(o,d))Array.isArray(o[d])||(o[d]=[o[d]]),o[d].push(p);else{let O=t.jPath?i.toString():i;t.isArray(d,O,g)?o[d]=[p]:o[d]=p}d!==void 0&&d!==t.textNodeName&&e.pop()}}}return typeof n=="string"?n.length>0&&(o[t.textNodeName]=n):n!==void 0&&(o[t.textNodeName]=n),o}function Oe(r){let t=Object.keys(r);for(let e=0;e<t.length;e++){let i=t[e];if(i!==":@")return i}}function Ee(r,t,e,i){if(t){let n=Object.keys(t),o=n.length;for(let u=0;u<o;u++){let s=n[u],d=s.startsWith(i.attributeNamePrefix)?s.substring(i.attributeNamePrefix.length):s,p=i.jPath?e.toString()+"."+d:e;i.isArray(s,p,!0,!0)?r[s]=[t[s]]:r[s]=t[s]}}}function Se(r,t){let{textNodeName:e}=t,i=Object.keys(r).length;return i===0||!(i!==1||!r[e]&&typeof r[e]!="boolean"&&r[e]!==0)}class _e{constructor(t){this.externalEntities={},this.options=G(t)}parse(t,e){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(e){e===!0&&(e={});let o=c(t,e);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}let i=new ue(this.options);i.entityDecoder.setExternalEntities(this.externalEntities);let n=i.parseXml(t);return this.options.preserveOrder||n===void 0?n:we(n,this.options,i.matcher,i.readonlyMatcher)}addEntity(t,e){if(e.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(e==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}static getMetaDataSymbol(){return tt.getMetaDataSymbol()}}function Pe(r,t){let e="";t.format&&t.indentBy.length>0&&(e=`
|
|
11
|
+
`);let i=[];if(t.stopNodes&&Array.isArray(t.stopNodes))for(let n=0;n<t.stopNodes.length;n++){let o=t.stopNodes[n];typeof o=="string"?i.push(new vt(o)):o instanceof vt&&i.push(o)}return Ft(r,t,e,new Ot,i)}function Ft(r,t,e,i,n){let o="",u=!1;if(t.maxNestedTags&&i.getDepth()>t.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(r)){if(r!=null){let s=r.toString();return s=Tt(s,t),s}return""}for(let s=0;s<r.length;s++){let d=r[s],p=Gt(d);if(p===void 0)continue;let g=Ae(d[":@"],t);i.push(p,g);let O=Ce(i,n);if(p===t.textNodeName){let V=d[p];O||(V=t.tagValueProcessor(p,V),V=Tt(V,t)),u&&(o+=e),o+=V,u=!1,i.pop();continue}if(p===t.cdataPropName){u&&(o+=e);let V=d[p][0][t.textNodeName];o+=`<![CDATA[${String(V).replace(/\]\]>/g,"]]]]><![CDATA[>")}]]>`,u=!1,i.pop();continue}if(p===t.commentPropName){let V=d[p][0][t.textNodeName];o+=e+`<!--${String(V).replace(/--/g,"- -").replace(/-$/,"- ")}-->`,u=!0,i.pop();continue}if(p[0]==="?"){let V=Bt(d[":@"],t,O),rt=p==="?xml"?"":e,ot=d[p][0][t.textNodeName];ot=ot.length!==0?" "+ot:"",o+=rt+`<${p}${ot}${V}?>`,u=!0,i.pop();continue}let M=e;M!==""&&(M+=t.indentBy);let L=e+`<${p}${Bt(d[":@"],t,O)}`,k;k=O?Ut(d[p],t):Ft(d[p],t,M,i,n),t.unpairedTags.indexOf(p)!==-1?t.suppressUnpairedNode?o+=L+">":o+=L+"/>":k&&k.length!==0||!t.suppressEmptyNode?k&&k.endsWith(">")?o+=L+`>${k}${e}</${p}>`:(o+=L+">",k&&e!==""&&(k.includes("/>")||k.includes("</"))?o+=e+t.indentBy+k+e:o+=k,o+=`</${p}>`):o+=L+"/>",u=!0,i.pop()}return o}function Ae(r,t){if(!r||t.ignoreAttributes)return null;let e={},i=!1;for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n.startsWith(t.attributeNamePrefix)?n.substr(t.attributeNamePrefix.length):n]=r[n],i=!0);return i?e:null}function Ut(r,t){if(!Array.isArray(r))return r!=null?r.toString():"";let e="";for(let i=0;i<r.length;i++){let n=r[i],o=Gt(n);if(o===t.textNodeName)e+=n[o];else if(o===t.cdataPropName)e+=n[o][0][t.textNodeName];else if(o===t.commentPropName)e+=n[o][0][t.textNodeName];else{if(o&&o[0]==="?")continue;if(o){let u=Te(n[":@"],t),s=Ut(n[o],t);s&&s.length!==0?e+=`<${o}${u}>${s}</${o}>`:e+=`<${o}${u}/>`}}}return e}function Te(r,t){let e="";if(r&&!t.ignoreAttributes)for(let i in r){if(!Object.prototype.hasOwnProperty.call(r,i))continue;let n=r[i];n===!0&&t.suppressBooleanAttributes?e+=` ${i.substr(t.attributeNamePrefix.length)}`:e+=` ${i.substr(t.attributeNamePrefix.length)}="${n}"`}return e}function Gt(r){let t=Object.keys(r);for(let e=0;e<t.length;e++){let i=t[e];if(Object.prototype.hasOwnProperty.call(r,i)&&i!==":@")return i}}function Bt(r,t,e){let i="";if(r&&!t.ignoreAttributes)for(let n in r){if(!Object.prototype.hasOwnProperty.call(r,n))continue;let o;e?o=r[n]:(o=t.attributeValueProcessor(n,r[n]),o=Tt(o,t)),o===!0&&t.suppressBooleanAttributes?i+=` ${n.substr(t.attributeNamePrefix.length)}`:i+=` ${n.substr(t.attributeNamePrefix.length)}="${o}"`}return i}function Ce(r,t){if(!t||t.length===0)return!1;for(let e=0;e<t.length;e++)if(r.matches(t[e]))return!0;return!1}function Tt(r,t){if(r&&r.length>0&&t.processEntities)for(let e=0;e<t.entities.length;e++){let i=t.entities[e];r=r.replace(i.regex,i.val)}return r}let je={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(r,t){return t},attributeValueProcessor:function(r,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0};function pt(r){if(this.options=Object.assign({},je,r),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(e=>typeof e=="string"&&e.startsWith("*.")?".."+e.substring(2):e)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let e=0;e<this.options.stopNodes.length;e++){let i=this.options.stopNodes[e];typeof i=="string"?this.stopNodeExpressions.push(new vt(i)):i instanceof vt&&this.stopNodeExpressions.push(i)}var t;this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=typeof(t=this.options.ignoreAttributes)=="function"?t:Array.isArray(t)?e=>{for(let i of t)if(typeof i=="string"&&e===i||i instanceof RegExp&&i.test(e))return!0}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=De),this.processTextOrObjNode=Me,this.options.format?(this.indentate=Ie,this.tagEndChar=`>
|
|
12
|
+
`,this.newLine=`
|
|
13
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function Me(r,t,e,i){let n=this.extractAttributes(r);if(i.push(t,n),this.checkStopNode(i)){let u=this.buildRawContent(r),s=this.buildAttributesForStopNode(r);return i.pop(),this.buildObjectNode(u,t,s,e)}let o=this.j2x(r,e+1,i);return i.pop(),r[this.options.textNodeName]!==void 0&&Object.keys(r).length===1?this.buildTextValNode(r[this.options.textNodeName],t,o.attrStr,e,i):this.buildObjectNode(o.val,t,o.attrStr,e)}function Ie(r){return this.options.indentBy.repeat(r)}function De(r){return!(!r.startsWith(this.options.attributeNamePrefix)||r===this.options.textNodeName)&&r.substr(this.attrPrefixLen)}pt.prototype.build=function(r){if(this.options.preserveOrder)return Pe(r,this.options);{Array.isArray(r)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(r={[this.options.arrayNodeName]:r});let t=new Ot;return this.j2x(r,0,t).val}},pt.prototype.j2x=function(r,t,e){let i="",n="";if(this.options.maxNestedTags&&e.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");let o=this.options.jPath?e.toString():e,u=this.checkStopNode(e);for(let s in r)if(Object.prototype.hasOwnProperty.call(r,s))if(r[s]===void 0)this.isAttribute(s)&&(n+="");else if(r[s]===null)this.isAttribute(s)||s===this.options.cdataPropName?n+="":s[0]==="?"?n+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(r[s]instanceof Date)n+=this.buildTextValNode(r[s],s,"",t,e);else if(typeof r[s]!="object"){let d=this.isAttribute(s);if(d&&!this.ignoreAttributesFn(d,o))i+=this.buildAttrPairStr(d,""+r[s],u);else if(!d)if(s===this.options.textNodeName){let p=this.options.tagValueProcessor(s,""+r[s]);n+=this.replaceEntitiesValue(p)}else{e.push(s);let p=this.checkStopNode(e);if(e.pop(),p){let g=""+r[s];n+=g===""?this.indentate(t)+"<"+s+this.closeTag(s)+this.tagEndChar:this.indentate(t)+"<"+s+">"+g+"</"+s+this.tagEndChar}else n+=this.buildTextValNode(r[s],s,"",t,e)}}else if(Array.isArray(r[s])){let d=r[s].length,p="",g="";for(let O=0;O<d;O++){let M=r[s][O];if(M!==void 0)if(M===null)s[0]==="?"?n+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(typeof M=="object")if(this.options.oneListGroup){e.push(s);let L=this.j2x(M,t+1,e);e.pop(),p+=L.val,this.options.attributesGroupName&&M.hasOwnProperty(this.options.attributesGroupName)&&(g+=L.attrStr)}else p+=this.processTextOrObjNode(M,s,t,e);else if(this.options.oneListGroup){let L=this.options.tagValueProcessor(s,M);L=this.replaceEntitiesValue(L),p+=L}else{e.push(s);let L=this.checkStopNode(e);if(e.pop(),L){let k=""+M;p+=k===""?this.indentate(t)+"<"+s+this.closeTag(s)+this.tagEndChar:this.indentate(t)+"<"+s+">"+k+"</"+s+this.tagEndChar}else p+=this.buildTextValNode(M,s,"",t,e)}}this.options.oneListGroup&&(p=this.buildObjectNode(p,s,g,t)),n+=p}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){let d=Object.keys(r[s]),p=d.length;for(let g=0;g<p;g++)i+=this.buildAttrPairStr(d[g],""+r[s][d[g]],u)}else n+=this.processTextOrObjNode(r[s],s,t,e);return{attrStr:i,val:n}},pt.prototype.buildAttrPairStr=function(r,t,e){return e||(t=this.options.attributeValueProcessor(r,""+t),t=this.replaceEntitiesValue(t)),this.options.suppressBooleanAttributes&&t==="true"?" "+r:" "+r+'="'+t+'"'},pt.prototype.extractAttributes=function(r){if(!r||typeof r!="object")return null;let t={},e=!1;if(this.options.attributesGroupName&&r[this.options.attributesGroupName]){let i=r[this.options.attributesGroupName];for(let n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n.startsWith(this.options.attributeNamePrefix)?n.substring(this.options.attributeNamePrefix.length):n]=i[n],e=!0)}else for(let i in r){if(!Object.prototype.hasOwnProperty.call(r,i))continue;let n=this.isAttribute(i);n&&(t[n]=r[i],e=!0)}return e?t:null},pt.prototype.buildRawContent=function(r){if(typeof r=="string")return r;if(typeof r!="object"||r===null)return String(r);if(r[this.options.textNodeName]!==void 0)return r[this.options.textNodeName];let t="";for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e)||this.isAttribute(e)||this.options.attributesGroupName&&e===this.options.attributesGroupName)continue;let i=r[e];if(e===this.options.textNodeName)t+=i;else if(Array.isArray(i)){for(let n of i)if(typeof n=="string"||typeof n=="number")t+=`<${e}>${n}</${e}>`;else if(typeof n=="object"&&n!==null){let o=this.buildRawContent(n),u=this.buildAttributesForStopNode(n);t+=o===""?`<${e}${u}/>`:`<${e}${u}>${o}</${e}>`}}else if(typeof i=="object"&&i!==null){let n=this.buildRawContent(i),o=this.buildAttributesForStopNode(i);t+=n===""?`<${e}${o}/>`:`<${e}${o}>${n}</${e}>`}else t+=`<${e}>${i}</${e}>`}return t},pt.prototype.buildAttributesForStopNode=function(r){if(!r||typeof r!="object")return"";let t="";if(this.options.attributesGroupName&&r[this.options.attributesGroupName]){let e=r[this.options.attributesGroupName];for(let i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let n=i.startsWith(this.options.attributeNamePrefix)?i.substring(this.options.attributeNamePrefix.length):i,o=e[i];o===!0&&this.options.suppressBooleanAttributes?t+=" "+n:t+=" "+n+'="'+o+'"'}}else for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let i=this.isAttribute(e);if(i){let n=r[e];n===!0&&this.options.suppressBooleanAttributes?t+=" "+i:t+=" "+i+'="'+n+'"'}}return t},pt.prototype.buildObjectNode=function(r,t,e,i){if(r==="")return t[0]==="?"?this.indentate(i)+"<"+t+e+"?"+this.tagEndChar:this.indentate(i)+"<"+t+e+this.closeTag(t)+this.tagEndChar;{let n="</"+t+this.tagEndChar,o="";return t[0]==="?"&&(o="?",n=""),!e&&e!==""||r.indexOf("<")!==-1?this.options.commentPropName!==!1&&t===this.options.commentPropName&&o.length===0?this.indentate(i)+`<!--${r}-->`+this.newLine:this.indentate(i)+"<"+t+e+o+this.tagEndChar+r+this.indentate(i)+n:this.indentate(i)+"<"+t+e+o+">"+r+n}},pt.prototype.closeTag=function(r){let t="";return this.options.unpairedTags.indexOf(r)!==-1?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`></${r}`,t},pt.prototype.checkStopNode=function(r){if(!this.stopNodeExpressions||this.stopNodeExpressions.length===0)return!1;for(let t=0;t<this.stopNodeExpressions.length;t++)if(r.matches(this.stopNodeExpressions[t]))return!0;return!1},pt.prototype.buildTextValNode=function(r,t,e,i,n){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName){let o=String(r).replace(/\]\]>/g,"]]]]><![CDATA[>");return this.indentate(i)+`<![CDATA[${o}]]>`+this.newLine}if(this.options.commentPropName!==!1&&t===this.options.commentPropName){let o=String(r).replace(/--/g,"- -").replace(/-$/,"- ");return this.indentate(i)+`<!--${o}-->`+this.newLine}if(t[0]==="?")return this.indentate(i)+"<"+t+e+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(t,r);return o=this.replaceEntitiesValue(o),o===""?this.indentate(i)+"<"+t+e+this.closeTag(t)+this.tagEndChar:this.indentate(i)+"<"+t+e+">"+o+"</"+t+this.tagEndChar}},pt.prototype.replaceEntitiesValue=function(r){if(r&&r.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let e=this.options.entities[t];r=r.replace(e.regex,e.val)}return r};let $e=pt,Le={validate:c};R.exports=h})()},{}],2:[function(_,R,w){var I=Object.prototype.hasOwnProperty,h=Object.prototype.toString;R.exports=function(y,N,D){if(h.call(N)!=="[object Function]")throw new TypeError("iterator must be a function");var j=y.length;if(j===+j)for(var $=0;$<j;$++)N.call(D,y[$],$,y);else for(var l in y)I.call(y,l)&&N.call(D,y[l],l,y)}},{}],3:[function(_,R,w){"use strict";var I=_("foreach");R.exports=h;function h(A,y,N){if(arguments.length===3)return h.set(A,y,N);if(arguments.length===2)return h.get(A,y);var D=h.bind(h,A);for(var j in h)h.hasOwnProperty(j)&&(D[j]=h[j].bind(D,A));return D}h.get=function(y,N){for(var D=Array.isArray(N)?N:h.parse(N),j=0;j<D.length;++j){var $=D[j];if(!(typeof y=="object"&&$ in y))throw new Error("Invalid reference token: "+$);y=y[$]}return y},h.set=function(y,N,D){var j=Array.isArray(N)?N:h.parse(N),$=j[0];if(j.length===0)throw Error("Can not set the root object");for(var l=0;l<j.length-1;++l){var c=j[l];typeof c!="string"&&typeof c!="number"&&(c=String(c)),!(c==="__proto__"||c==="constructor"||c==="prototype")&&(c==="-"&&Array.isArray(y)&&(c=y.length),$=j[l+1],c in y||($.match(/^(\d+|-)$/)?y[c]=[]:y[c]={}),y=y[c])}return $==="-"&&Array.isArray(y)&&($=y.length),y[$]=D,this},h.remove=function(A,y){var N=Array.isArray(y)?y:h.parse(y),D=N[N.length-1];if(D===void 0)throw new Error('Invalid JSON pointer for remove: "'+y+'"');var j=h.get(A,N.slice(0,-1));if(Array.isArray(j)){var $=+D;if(D===""&&isNaN($))throw new Error('Invalid array index: "'+D+'"');Array.prototype.splice.call(j,$,1)}else delete j[D]},h.dict=function(y,N){var D={};return h.walk(y,function(j,$){D[$]=j},N),D},h.walk=function(y,N,D){var j=[];D=D||function($){var l=Object.prototype.toString.call($);return l==="[object Object]"||l==="[object Array]"},(function $(l){I(l,function(c,v){j.push(String(v)),D(c)?$(c):N(c,h.compile(j)),j.pop()})})(y)},h.has=function(y,N){try{h.get(y,N)}catch{return!1}return!0},h.escape=function(y){return y.toString().replace(/~/g,"~0").replace(/\//g,"~1")},h.unescape=function(y){return y.replace(/~1/g,"/").replace(/~0/g,"~")},h.parse=function(y){if(y==="")return[];if(y.charAt(0)!=="/")throw new Error("Invalid JSON pointer: "+y);return y.substring(1).split(/\//).map(h.unescape)},h.compile=function(y){return y.length===0?"":"/"+y.map(h.escape).join("/")}},{foreach:2}],4:[function(_,R,w){"use strict";Object.defineProperty(w,"__esModule",{value:!0}),w.allOfSample=$;var I=_("./traverse"),h=_("./utils");function A(l,c){var v=Object.keys(l);if(Object.getOwnPropertySymbols){var P=Object.getOwnPropertySymbols(l);c&&(P=P.filter(function(E){return Object.getOwnPropertyDescriptor(l,E).enumerable})),v.push.apply(v,P)}return v}function y(l){for(var c=1;c<arguments.length;c++){var v=arguments[c]!=null?arguments[c]:{};c%2?A(Object(v),!0).forEach(function(P){N(l,P,v[P])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(v)):A(Object(v)).forEach(function(P){Object.defineProperty(l,P,Object.getOwnPropertyDescriptor(v,P))})}return l}function N(l,c,v){return(c=D(c))in l?Object.defineProperty(l,c,{value:v,enumerable:!0,configurable:!0,writable:!0}):l[c]=v,l}function D(l){var c=j(l,"string");return typeof c=="symbol"?c:c+""}function j(l,c){if(typeof l!="object"||!l)return l;var v=l[Symbol.toPrimitive];if(v!==void 0){var P=v.call(l,c||"default");if(typeof P!="object")return P;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(l)}function $(l,c,v,P,E){let F=(0,I.traverse)(l,v,P),q=[];for(let W of c){let{type:U,readOnly:K,writeOnly:f,value:m}=(0,I.traverse)(y({type:F.type},W),v,P,y(y({},E),{},{isAllOfChild:!0}));F.type&&U&&U!==F.type&&(console.warn("allOf: schemas with different types can't be merged"),F.type=U),F.type=F.type||U,F.readOnly=F.readOnly||K,F.writeOnly=F.writeOnly||f,m!=null&&q.push(m)}if(F.type==="object"){F.value=(0,h.mergeDeep)(F.value||{},...q.filter(W=>typeof W=="object"));for(let W in F.value)F.value[W]===h.SKIP_SYMBOL&&delete F.value[W];return F}else{F.type==="array"&&(v.quiet||console.warn('OpenAPI Sampler: found allOf with "array" type. Result may be incorrect'));let W=q[q.length-1];return F.value=W??F.value,F}}},{"./traverse":14,"./utils":15}],5:[function(_,R,w){"use strict";Object.defineProperty(w,"__esModule",{value:!0}),w.inferType=h;let I={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",additionalItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",properties:"object",patternProperties:"object",dependencies:"object"};function h(A){if(A.type!==void 0)return Array.isArray(A.type)?A.type.length===0?null:A.type[0]:A.type;let y=Object.keys(I);for(var N=0;N<y.length;N++){let D=y[N],j=I[D];if(A[D]!==void 0)return j}return null}},{}],6:[function(_,R,w){"use strict";Object.defineProperty(w,"__esModule",{value:!0}),w._registerSampler=l,w._samplers=void 0,Object.defineProperty(w,"inferType",{enumerable:!0,get:function(){return y.inferType}}),w.sample=$;var I=_("./traverse"),h=_("./samplers/index"),A=_("fast-xml-parser"),y=_("./infer"),N=w._samplers={};let D={skipReadOnly:!1,maxSampleDepth:15};function j(c,v){if(!c)throw new Error("Unknown format output for building XML.");if(Array.isArray(c)||Object.keys(c).length>1){var P;c={[(v==null||(P=v.xml)===null||P===void 0?void 0:P.name)||"root"]:c}}return new A.XMLBuilder({ignoreAttributes:!1,format:!0,attributeNamePrefix:"$",textNodeName:"#text",cdataPropName:"#cdata"}).build(c)}function $(c,v,P){let E=Object.assign({},D,v);(0,I.clearCache)();let F=(0,I.traverse)(c,E,P).value;return E?.format==="xml"?j(F,c):F}function l(c,v){N[c]=v}l("array",h.sampleArray),l("boolean",h.sampleBoolean),l("integer",h.sampleNumber),l("number",h.sampleNumber),l("object",h.sampleObject),l("string",h.sampleString)},{"./infer":5,"./samplers/index":9,"./traverse":14,"fast-xml-parser":1}],7:[function(_,R,w){"use strict";Object.defineProperty(w,"__esModule",{value:!0}),w.sampleArray=$;var I=_("../traverse"),h=_("../utils");function A(l,c){var v=Object.keys(l);if(Object.getOwnPropertySymbols){var P=Object.getOwnPropertySymbols(l);c&&(P=P.filter(function(E){return Object.getOwnPropertyDescriptor(l,E).enumerable})),v.push.apply(v,P)}return v}function y(l){for(var c=1;c<arguments.length;c++){var v=arguments[c]!=null?arguments[c]:{};c%2?A(Object(v),!0).forEach(function(P){N(l,P,v[P])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(v)):A(Object(v)).forEach(function(P){Object.defineProperty(l,P,Object.getOwnPropertyDescriptor(v,P))})}return l}function N(l,c,v){return(c=D(c))in l?Object.defineProperty(l,c,{value:v,enumerable:!0,configurable:!0,writable:!0}):l[c]=v,l}function D(l){var c=j(l,"string");return typeof c=="symbol"?c:c+""}function j(l,c){if(typeof l!="object"||!l)return l;var v=l[Symbol.toPrimitive];if(v!==void 0){var P=v.call(l,c||"default");if(typeof P!="object")return P;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(l)}function $(l){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=arguments.length>2?arguments[2]:void 0,P=arguments.length>3?arguments[3]:void 0,E=P&&P.depth||1,F=Math.min(l.maxItems!=null?l.maxItems:1/0,l.minItems||1),q=l.prefixItems||l.items||l.contains;Array.isArray(q)&&(F=Math.max(F,q.length));let W=f=>Array.isArray(q)?q[f]||{}:q||{},U=[];if(!q)return U;for(let f=0;f<F;f++){let m=W(f),{value:a}=(0,I.traverse)(m,c,v,{depth:E+1});if(c?.format==="xml"){let{value:x,propertyName:b}=(0,h.applyXMLAttributes)({value:a},m,P);if(b){var K;(K=U)!==null&&K!==void 0&&K[b]||(U=y(y({},U),{},{[b]:[]})),U[b].push(x)}else U=y(y({},U),x)}else U.push(a)}if(c?.format==="xml"&&E===1){let{value:f,propertyName:m}=(0,h.applyXMLAttributes)({value:null},l,P);m&&(f?U=Array.isArray(U)?{[m]:y(y({},f),U.map(a=>({"#text":y({},a)})))}:{[m]:y(y({},U),f)}:U={[m]:U})}return U}},{"../traverse":14,"../utils":15}],8:[function(_,R,w){"use strict";Object.defineProperty(w,"__esModule",{value:!0}),w.sampleBoolean=I;function I(h){return!0}},{}],9:[function(_,R,w){"use strict";Object.defineProperty(w,"__esModule",{value:!0}),Object.defineProperty(w,"sampleArray",{enumerable:!0,get:function(){return I.sampleArray}}),Object.defineProperty(w,"sampleBoolean",{enumerable:!0,get:function(){return h.sampleBoolean}}),Object.defineProperty(w,"sampleNumber",{enumerable:!0,get:function(){return A.sampleNumber}}),Object.defineProperty(w,"sampleObject",{enumerable:!0,get:function(){return y.sampleObject}}),Object.defineProperty(w,"sampleString",{enumerable:!0,get:function(){return N.sampleString}});var I=_("./array"),h=_("./boolean"),A=_("./number"),y=_("./object"),N=_("./string")},{"./array":7,"./boolean":8,"./number":10,"./object":11,"./string":13}],10:[function(_,R,w){"use strict";Object.defineProperty(w,"__esModule",{value:!0}),w.sampleNumber=I;function I(h){let A=0;if(h.type==="number"&&(h.format==="float"||h.format==="double")&&(A=.1),typeof h.exclusiveMinimum=="boolean"||typeof h.exclusiveMaximum=="boolean"){if(Number.isFinite(h.maximum)&&Number.isFinite(h.minimum))return A=h.exclusiveMinimum?Math.floor(h.minimum)+1:h.minimum,(h.exclusiveMaximum&&A>=h.maximum||!h.exclusiveMaximum&&A>h.maximum)&&(A=(h.maximum+h.minimum)/2),A;if(Number.isFinite(h.minimum))return h.exclusiveMinimum?Math.floor(h.minimum)+1:h.minimum;if(Number.isFinite(h.maximum))return h.exclusiveMaximum?h.maximum>0?0:Math.floor(h.maximum)-1:h.maximum>0?0:h.maximum}else{if(Number.isFinite(h.minimum))return h.minimum;Number.isFinite(h.exclusiveMinimum)?(A=Math.floor(h.exclusiveMinimum)+1,A===h.exclusiveMaximum&&(A=(A+Math.floor(h.exclusiveMaximum)-1)/2)):Number.isFinite(h.exclusiveMaximum)?A=Math.floor(h.exclusiveMaximum)-1:Number.isFinite(h.maximum)&&(A=h.maximum)}return A}},{}],11:[function(_,R,w){"use strict";Object.defineProperty(w,"__esModule",{value:!0}),w.sampleObject=$;var I=_("../traverse"),h=_("../utils");function A(l,c){var v=Object.keys(l);if(Object.getOwnPropertySymbols){var P=Object.getOwnPropertySymbols(l);c&&(P=P.filter(function(E){return Object.getOwnPropertyDescriptor(l,E).enumerable})),v.push.apply(v,P)}return v}function y(l){for(var c=1;c<arguments.length;c++){var v=arguments[c]!=null?arguments[c]:{};c%2?A(Object(v),!0).forEach(function(P){N(l,P,v[P])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(v)):A(Object(v)).forEach(function(P){Object.defineProperty(l,P,Object.getOwnPropertyDescriptor(v,P))})}return l}function N(l,c,v){return(c=D(c))in l?Object.defineProperty(l,c,{value:v,enumerable:!0,configurable:!0,writable:!0}):l[c]=v,l}function D(l){var c=j(l,"string");return typeof c=="symbol"?c:c+""}function j(l,c){if(typeof l!="object"||!l)return l;var v=l[Symbol.toPrimitive];if(v!==void 0){var P=v.call(l,c||"default");if(typeof P!="object")return P;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(l)}function $(l){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=arguments.length>2?arguments[2]:void 0,P=arguments.length>3?arguments[3]:void 0,E={},F=P&&P.depth||1;if(l&&typeof l.properties=="object"){let q=Array.isArray(l.required)?l.required:[],W={};for(let U of q)W[U]=!0;Object.keys(l.properties).forEach(U=>{if(c.skipNonRequired&&!W.hasOwnProperty(U))return;let K=(0,I.traverse)(l.properties[U],c,v,{propertyName:U,depth:F+1});if(c.skipReadOnly&&K.readOnly){P!=null&&P.isAllOfChild&&(E[U]=h.SKIP_SYMBOL);return}if(c.skipWriteOnly&&K.writeOnly){P!=null&&P.isAllOfChild&&(E[U]=h.SKIP_SYMBOL);return}if(c?.format==="xml"){let{propertyName:f,value:m}=(0,h.applyXMLAttributes)(K,l.properties[U],{propertyName:U});f?E[f]=m:m!==null&&typeof m=="object"&&(E=y(y({},E),m))}else E[U]=K.value})}if(l&&typeof l.additionalProperties=="object"){let q=l.additionalProperties["x-additionalPropertiesName"]||"property";E["".concat(String(q),"1")]=(0,I.traverse)(l.additionalProperties,c,v,{depth:F+1}).value,E["".concat(String(q),"2")]=(0,I.traverse)(l.additionalProperties,c,v,{depth:F+1}).value}if(l&&typeof l.properties=="object"&&l.maxProperties!==void 0&&Object.keys(E).length>l.maxProperties){let q={},W=0;(Array.isArray(l.required)?l.required:[]).forEach(K=>{E[K]!==void 0&&(q[K]=E[K],W++)}),Object.keys(E).forEach(K=>{W<l.maxProperties&&!q.hasOwnProperty(K)&&(q[K]=E[K],W++)}),E=q}return E}},{"../traverse":14,"../utils":15}],12:[function(_,R,w){"use strict";Object.defineProperty(w,"__esModule",{value:!0}),w.regexSample=y;function I(){return!0}function h(N,D){return N}function A(N,D,j){let $=1;if(N)switch(N){case"?":{$=I()?0:1;break}case"*":{$=h(0,8);break}case"+":{$=h(1,8);break}default:throw new Error("Unknown quantifier symbol provided.")}else D!=null&&j!=null?$=h(parseInt(D),parseInt(j)):D!=null&&j==null&&($=parseInt(D));return $}function y(N){let D=!1;if(N instanceof RegExp){var j,$;D=N.flags.includes("i"),N=N.toString(),N=(j=($=N.match(/\/(.+?)\//))===null||$===void 0?void 0:$[1])!==null&&j!==void 0?j:""}N=N.replace(/^(\^)?(.*?)(\$)?$/,"$2");let l,c,v,P=/([.A-Za-z0-9])(?:\{(\d+)(?:\,(\d+)|)\}|(\?|\*|\+))(?![^[]*]|[^{]*})/,E=N.match(P);for(;E!=null;){let K=E[2],f=E[3],m=E[4];v=A(m,K,f),N=N.slice(0,E.index)+E[1].repeat(v)+N.slice(E.index+E[0].length),E=N.match(P)}let F=/(\d-\d|\w-\w|\d|\w|[-!@#$&()`.+,/"])/,q=/\[(\^|)(-|)(.+?)\](?:\{(\d+)(?:\,(\d+)|)\}|(\?|\*|\+)|)/;for(E=N.match(q);E!=null;){let K=E[1]==="^",f=E[2]==="-",m=E[4],a=E[5],x=E[6],b=[],T=E[3],B=T.match(F);for(f&&b.push(45);B!=null;){if(B[0].indexOf("-")===-1)D&&isNaN(Number(B[0]))?(b.push(B[0].toUpperCase().charCodeAt(0)),b.push(B[0].toLowerCase().charCodeAt(0))):b.push(B[0].charCodeAt(0));else{let H=B[0].split("-").map(S=>S.charCodeAt(0));if(l=H[0],c=H[1],l>c)throw new Error("Character range provided is out of order.");for(let S=l;S<=c;S++)if(D&&isNaN(Number(String.fromCharCode(S)))){let G=String.fromCharCode(S);b.push(G.toUpperCase().charCodeAt(0)),b.push(G.toLowerCase().charCodeAt(0))}else b.push(S)}T=T.substring(B[0].length),B=T.match(F)}if(v=A(x,m,a),K){let H=-1;for(let S=48;S<=57;S++){if(H=b.indexOf(S),H>-1){b.splice(H,1);continue}b.push(S)}for(let S=65;S<=90;S++){if(H=b.indexOf(S),H>-1){b.splice(H,1);continue}b.push(S)}for(let S=97;S<=122;S++){if(H=b.indexOf(S),H>-1){b.splice(H,1);continue}b.push(S)}}let Q=Array.from({length:v},()=>String.fromCharCode(b[h(0,b.length-1)])).join("");N=N.slice(0,E.index)+Q+N.slice(E.index+E[0].length),E=N.match(q)}let W=/(.)\{(\d+)\,(\d+)\}/;for(E=N.match(W);E!=null;){if(l=parseInt(E[2]),c=parseInt(E[3]),l>c)throw new Error("Numbers out of order in {} quantifier.");v=h(l,c),N=N.slice(0,E.index)+E[1].repeat(v)+N.slice(E.index+E[0].length),E=N.match(W)}let U=/(.)\{(\d+)\}/;for(E=N.match(U);E!=null;)v=parseInt(E[2]),N=N.slice(0,E.index)+E[1].repeat(v)+N.slice(E.index+E[0].length),E=N.match(U);return N}},{}],13:[function(_,R,w){"use strict";Object.defineProperty(w,"__esModule",{value:!0}),w.sampleString=H;var I=_("../utils"),h=A(_("./string-regex"));function A(S,G){if(typeof WeakMap=="function")var X=new WeakMap,tt=new WeakMap;return(A=function(Z,z){if(!z&&Z&&Z.__esModule)return Z;var nt,ut,gt={__proto__:null,default:Z};if(Z===null||typeof Z!="object"&&typeof Z!="function")return gt;if(nt=z?tt:X){if(nt.has(Z))return nt.get(Z);nt.set(Z,gt)}for(let ht in Z)ht!=="default"&&{}.hasOwnProperty.call(Z,ht)&&((ut=(nt=Object.defineProperty)&&Object.getOwnPropertyDescriptor(Z,ht))&&(ut.get||ut.set)?nt(gt,ht,ut):gt[ht]=Z[ht]);return gt})(S,G)}let y="qwerty!@#$%^123456";function N(){return"user@example.com"}function D(){return"\u043F\u043E\u0448\u0442\u0430@\u0443\u043A\u0440.\u043D\u0435\u0442"}function j(S,G){let X="pa$$word";return S>X.length&&(X+="_",X+=(0,I.ensureMinLength)(y,S-X.length).substring(0,S-X.length)),X}function $(S){let{min:G,max:X,omitTime:tt,omitDate:Z}=S,z=(0,I.toRFCDateTime)(new Date("2019-08-24T14:15:22.123Z"),tt,Z,!1);return z.length<G&&console.warn("Using minLength = ".concat(G,' is incorrect with format "date-time"')),X&&z.length>X&&console.warn("Using maxLength = ".concat(X,' is incorrect with format "date-time"')),z}function l(S,G){return $({min:S,max:G,omitTime:!1,omitDate:!1})}function c(S,G){return $({min:S,max:G,omitTime:!0,omitDate:!1})}function v(S,G){return $({min:S,max:G,omitTime:!1,omitDate:!0}).slice(1)}function P(S,G,X,tt){let Z=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(tt&&Z)return h.regexSample(tt);let z=(0,I.ensureMinLength)("string",S);return G&&z.length>G&&(z=z.substring(0,G)),z}function E(){return"192.168.0.1"}function F(){return"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}function q(){return"example.com"}function W(){return"\u043F\u0440\u0438\u043A\u043B\u0430\u0434.\u0443\u043A\u0440"}function U(){return"http://example.com"}function K(){return"../dictionary"}function f(){return"http://example.com/{endpoint}"}function m(){return"http://example.com/entity/1"}function a(){return"/entity/1"}function x(S,G,X){return(0,I.uuid)(X||"id")}function b(){return"/json/pointer"}function T(){return"1/relative/json/pointer"}function B(){return"/regex/"}let Q={email:N,"idn-email":D,password:j,"date-time":l,date:c,time:v,ipv4:E,ipv6:F,hostname:q,"idn-hostname":W,iri:m,"iri-reference":a,uri:U,"uri-reference":K,"uri-template":f,uuid:x,default:P,"json-pointer":b,"relative-json-pointer":T,regex:B};function H(S,G,X,tt){let Z=S.format||"default",z=Q[Z]||P,nt=tt&&tt.propertyName;return z(S.minLength||0,S.maxLength,nt,S.pattern,G?.enablePatterns)}},{"../utils":15,"./string-regex":12}],14:[function(_,R,w){"use strict";Object.defineProperty(w,"__esModule",{value:!0}),w.clearCache=U,w.traverse=m;var I=_("./openapi-sampler"),h=_("./allOf"),A=_("./infer"),y=_("./utils"),N=j(_("json-pointer"));let D=["if","then"];function j(a){return a&&a.__esModule?a:{default:a}}function $(a,x){if(a==null)return{};var b,T,B=l(a,x);if(Object.getOwnPropertySymbols){var Q=Object.getOwnPropertySymbols(a);for(T=0;T<Q.length;T++)b=Q[T],x.indexOf(b)===-1&&{}.propertyIsEnumerable.call(a,b)&&(B[b]=a[b])}return B}function l(a,x){if(a==null)return{};var b={};for(var T in a)if({}.hasOwnProperty.call(a,T)){if(x.indexOf(T)!==-1)continue;b[T]=a[T]}return b}function c(a,x){var b=Object.keys(a);if(Object.getOwnPropertySymbols){var T=Object.getOwnPropertySymbols(a);x&&(T=T.filter(function(B){return Object.getOwnPropertyDescriptor(a,B).enumerable})),b.push.apply(b,T)}return b}function v(a){for(var x=1;x<arguments.length;x++){var b=arguments[x]!=null?arguments[x]:{};x%2?c(Object(b),!0).forEach(function(T){P(a,T,b[T])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):c(Object(b)).forEach(function(T){Object.defineProperty(a,T,Object.getOwnPropertyDescriptor(b,T))})}return a}function P(a,x,b){return(x=E(x))in a?Object.defineProperty(a,x,{value:b,enumerable:!0,configurable:!0,writable:!0}):a[x]=b,a}function E(a){var x=F(a,"string");return typeof x=="symbol"?x:x+""}function F(a,x){if(typeof a!="object"||!a)return a;var b=a[Symbol.toPrimitive];if(b!==void 0){var T=b.call(a,x||"default");if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(x==="string"?String:Number)(a)}let q={},W=[];function U(){q={},W=[]}function K(a){let x;return a.const!==void 0?x=a.const:a.examples!==void 0&&a.examples.length?x=a.examples[0]:a.enum!==void 0&&a.enum.length?x=a.enum[0]:a.default!==void 0&&(x=a.default),x}function f(a){let x=K(a);if(x!==void 0)return{value:x,readOnly:a.readOnly,writeOnly:a.writeOnly,type:null}}function m(a,x,b,T){if(T){if(W.includes(a))return(0,y.getResultForCircular)((0,A.inferType)(a));W.push(a)}if(T&&T.depth>x.maxSampleDepth)return(0,y.popSchemaStack)(W,T),(0,y.getResultForCircular)((0,A.inferType)(a));if(a.$ref){if(!b)throw new Error("Your schema contains $ref. You must provide full specification in the third parameter.");let S=decodeURIComponent(a.$ref);S.startsWith("#")&&(S=S.substring(1));let G=N.default.get(b,S),X;if(q[S]!==!0){q[S]=!0;let tt=m(G,x,b,T);if(x.format==="xml"){let Z=S.split("/").pop(),z=v(v({},T),{},{propertyName:T?.propertyName||Z}),{propertyName:nt,value:ut}=(0,y.applyXMLAttributes)(tt,G,z);X=v(v({},tt),{},{value:{[nt||"root"]:ut}})}else X=tt;q[S]=!1}else{let tt=(0,A.inferType)(G);X=(0,y.getResultForCircular)(tt)}return(0,y.popSchemaStack)(W,T),X}if(a.example!==void 0)return(0,y.popSchemaStack)(W,T),{value:a.example,readOnly:a.readOnly,writeOnly:a.writeOnly,type:a.type};if(a.allOf!==void 0)return(0,y.popSchemaStack)(W,T),f(a)||(0,h.allOfSample)(v(v({},a),{},{allOf:void 0}),a.allOf,x,b,T);if(a.oneOf&&a.oneOf.length){a.anyOf&&(x.quiet||console.warn("oneOf and anyOf are not supported on the same level. Skipping anyOf")),(0,y.popSchemaStack)(W,T);let S=Object.assign({readOnly:a.readOnly,writeOnly:a.writeOnly},a.oneOf[0]);return H(a,S)}if(a.anyOf&&a.anyOf.length){(0,y.popSchemaStack)(W,T);let S=Object.assign({readOnly:a.readOnly,writeOnly:a.writeOnly},a.anyOf[0]);return H(a,S)}if(a.if&&a.then){(0,y.popSchemaStack)(W,T);let{if:S,then:G}=a,X=$(a,D);return m((0,y.mergeDeep)(X,S,G),x,b,T)}let B=K(a),Q=null;if(B===void 0){B=null,Q=a.type,Array.isArray(Q)&&a.type.length>0&&(Q=a.type[0]),Q||(Q=(0,A.inferType)(a));let S=I._samplers[Q];S&&(B=S(a,x,b,T))}return(0,y.popSchemaStack)(W,T),{value:B,readOnly:a.readOnly,writeOnly:a.writeOnly,type:Q};function H(S,G){let X=f(S);if(X!==void 0)return X;let tt=m(v(v({},S),{},{oneOf:void 0,anyOf:void 0}),x,b,T),Z=m(G,x,b,T);if(typeof tt.value=="object"&&typeof Z.value=="object"){let z=(0,y.mergeDeep)(tt.value,Z.value);return v(v({},Z),{},{value:z})}return Z}}},{"./allOf":4,"./infer":5,"./openapi-sampler":6,"./utils":15,"json-pointer":3}],15:[function(_,R,w){"use strict";Object.defineProperty(w,"__esModule",{value:!0}),w.SKIP_SYMBOL=void 0,w.applyXMLAttributes=W,w.ensureMinLength=l,w.getResultForCircular=P,w.getXMLAttributes=F,w.mergeDeep=c,w.popSchemaStack=E,w.toRFCDateTime=$,w.uuid=v;function I(f,m){var a=Object.keys(f);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(f);m&&(x=x.filter(function(b){return Object.getOwnPropertyDescriptor(f,b).enumerable})),a.push.apply(a,x)}return a}function h(f){for(var m=1;m<arguments.length;m++){var a=arguments[m]!=null?arguments[m]:{};m%2?I(Object(a),!0).forEach(function(x){A(f,x,a[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(a)):I(Object(a)).forEach(function(x){Object.defineProperty(f,x,Object.getOwnPropertyDescriptor(a,x))})}return f}function A(f,m,a){return(m=y(m))in f?Object.defineProperty(f,m,{value:a,enumerable:!0,configurable:!0,writable:!0}):f[m]=a,f}function y(f){var m=N(f,"string");return typeof m=="symbol"?m:m+""}function N(f,m){if(typeof f!="object"||!f)return f;var a=f[Symbol.toPrimitive];if(a!==void 0){var x=a.call(f,m||"default");if(typeof x!="object")return x;throw new TypeError("@@toPrimitive must return a primitive value.")}return(m==="string"?String:Number)(f)}let D=w.SKIP_SYMBOL=Symbol("skip");function j(f){return f<10?"0"+f:f}function $(f,m,a,x){var b=a?"":f.getUTCFullYear()+"-"+j(f.getUTCMonth()+1)+"-"+j(f.getUTCDate());return m||(b+="T"+j(f.getUTCHours())+":"+j(f.getUTCMinutes())+":"+j(f.getUTCSeconds())+(x?"."+(f.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5):"")+"Z"),b}function l(f,m){return m>f.length?f.repeat(Math.trunc(m/f.length)+1).substring(0,m):f}function c(){let f=b=>b&&typeof b=="object";for(var m=arguments.length,a=new Array(m),x=0;x<m;x++)a[x]=arguments[x];return a.reduce((b,T)=>(Object.keys(T||{}).forEach(B=>{let Q=b[B],H=T[B];f(Q)&&f(H)?b[B]=c(Q,H):b[B]=H}),b),Array.isArray(a[a.length-1])?[]:{})}function v(f){var m=U(f),a=K(m,m,m,m),x="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,b=>{var T=a()*16%16|0;return(b=="x"?T:T&3|8).toString(16)});return x}function P(f){return{value:f==="object"?{}:f==="array"?[]:void 0}}function E(f,m){m&&f.pop()}function F(f){var m,a,x,b,T,B,Q;return{name:(f==null||(m=f.xml)===null||m===void 0?void 0:m.name)||"",prefix:(f==null||(a=f.xml)===null||a===void 0?void 0:a.prefix)||"",namespace:(f==null||(x=f.xml)===null||x===void 0?void 0:x.namespace)||null,attribute:(b=f==null||(T=f.xml)===null||T===void 0?void 0:T.attribute)!==null&&b!==void 0?b:!1,wrapped:(B=f==null||(Q=f.xml)===null||Q===void 0?void 0:Q.wrapped)!==null&&B!==void 0?B:!1}}function q(f){let m=f?.xml;return m!=null&&m.nodeType?m.nodeType:m?.attribute===!0?"attribute":m?.wrapped===!0&&f?.type==="array"?"element":f!=null&&f.$ref||f!=null&&f.$dynamicRef||f?.type==="array"||f!=null&&f.oneOf||f!=null&&f.anyOf||f!=null&&f.allOf?"none":"element"}function W(f){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{value:x}=f,{propertyName:b}=a,{name:T,prefix:B,namespace:Q}=F(m),H=q(m),S=T||b?"".concat(B?B+":":"").concat(T||b):null,G=typeof x=="object"?Array.isArray(x)?[...x]:h({},x):x;switch(H){case"attribute":S&&(S="$".concat(S));break;case"text":S="#text";break;case"cdata":S="#cdata";break;case"none":if(m.type==="array"){if(S=null,m.example!==void 0){var X;S=((X=m.items)===null||X===void 0||(X=X.xml)===null||X===void 0?void 0:X.name)||S}}else S=null;break;default:m.type==="array"&&Array.isArray(G)&&(G={[S]:[...G]});break}return Q&&H!=="text"&&H!=="cdata"&&H!=="none"&&(typeof G=="object"?G["$xmlns".concat(B?":"+B:"")]=Q:G={["$xmlns".concat(B?":"+B:"")]:Q,"#text":G}),{propertyName:S,value:G}}function U(f){var m=0;if(f.length==0)return m;for(var a=0;a<f.length;a++){var x=f.charCodeAt(a);m=(m<<5)-m+x,m=m&m}return m}function K(f,m,a,x){return function(){f|=0,m|=0,a|=0,x|=0;var b=f-(m<<27|m>>>5)|0;return f=m^(a<<17|a>>>15),m=a+x|0,a=x+b|0,x=f+b|0,(x>>>0)/4294967296}}},{}]},{},[6])(6)})});var zt=Nt((Ke,Kt)=>{"use strict";Kt.exports=(Y,C=process.argv)=>{let J=Y.startsWith("-")?"":Y.length===1?"-":"--",_=C.indexOf(J+Y),R=C.indexOf("--");return _!==-1&&(R===-1||_<R)}});var We=Nt((ze,Zt)=>{"use strict";var Ge=bt("os"),Jt=bt("tty"),ft=zt(),{env:it}=process,mt;ft("no-color")||ft("no-colors")||ft("color=false")||ft("color=never")?mt=0:(ft("color")||ft("colors")||ft("color=true")||ft("color=always"))&&(mt=1);"FORCE_COLOR"in it&&(it.FORCE_COLOR==="true"?mt=1:it.FORCE_COLOR==="false"?mt=0:mt=it.FORCE_COLOR.length===0?1:Math.min(parseInt(it.FORCE_COLOR,10),3));function It(Y){return Y===0?!1:{level:Y,hasBasic:!0,has256:Y>=2,has16m:Y>=3}}function Dt(Y,C){if(mt===0)return 0;if(ft("color=16m")||ft("color=full")||ft("color=truecolor"))return 3;if(ft("color=256"))return 2;if(Y&&!C&&mt===void 0)return 0;let J=mt||0;if(it.TERM==="dumb")return J;if(process.platform==="win32"){let _=Ge.release().split(".");return Number(_[0])>=10&&Number(_[2])>=10586?Number(_[2])>=14931?3:2:1}if("CI"in it)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(_=>_ in it)||it.CI_NAME==="codeship"?1:J;if("TEAMCITY_VERSION"in it)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(it.TEAMCITY_VERSION)?1:0;if(it.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in it){let _=parseInt((it.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(it.TERM_PROGRAM){case"iTerm.app":return _>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(it.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(it.TERM)||"COLORTERM"in it?1:J}function Be(Y){let C=Dt(Y,Y&&Y.isTTY);return It(C)}Zt.exports={supportsColor:Be,stdout:It(Dt(!0,Jt.isatty(1))),stderr:It(Dt(!0,Jt.isatty(2)))}});export{Fe as a,Ue as b,We as c};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as A,d as E,e as B,g as F,o as O,p as h}from"./AM6FT7EB.js";import{a as b}from"./ALXOGCUM.js";import{f as I}from"./H4XURXR7.js";import{O as P,P as v,Q as i,S as u,T as m,X as a,m as c,na as d}from"./RW2ESAIF.js";var y=class extends Error{};async function X({argv:t,version:e}){let n=performance.now(),s=new b,{organization:o,project:p,pushId:$,wait:g}=t,T=t.domain||F(),w=t["continue-on-deploy-failures"]||!1,U=t["start-time"]||Date.now(),S=[];try{let f=B(),R={domain:T,apiKey:f,organization:o,project:p,pushId:$,version:e,onSunsetWarning:l=>S.push(l)},x={...R,maxExecutionTime:t["max-execution-time"],retryIntervalMs:t["retry-interval"]?t["retry-interval"]*1e3:void 0,startTime:U},D=l=>j=>{let{status:C,url:z}=j.status[l].deploy;s.start(M({status:C,url:z,buildType:l,wait:g}))},r=g?await h({...x,buildType:"preview",onRetry:D("preview")}):await O(R);return W({buildType:"preview",spinner:s,push:r,continueOnDeployFailures:w}),L(r.status.preview.scorecard),g&&r.isMainBranch&&r.status.preview.deploy.status==="success"&&(r=await h({...x,buildType:"production",onRetry:D("production")})),r.isMainBranch&&(W({buildType:"production",spinner:s,push:r,continueOnDeployFailures:w}),L(r.status.production.scorecard)),K({organization:o,project:p,pushId:$,startedAt:n}),{preview:r.status.preview,production:r.isMainBranch?r.status.production:null,commit:r.commit}}catch(f){s.stop(),N("\u2717 Failed to get push status.",f)}finally{s.stop(),k("push-status",S)}}function N(t,e){throw e instanceof y?new d(e.message):e instanceof A?new d(`${t} Reason: ${e.message} (status: ${e.status})
|
|
8
|
+
`):new d(`${t} Reason: ${e.message}
|
|
9
|
+
`)}function k(t,e){let n=E(e);if(!n)return;let s='Update to the latest version by running "npm install @redocly/cli@latest".';n.isSunsetExpired?a.error(`The "${t}" command is not compatible with your version of Redocly CLI. ${s}
|
|
10
|
+
|
|
11
|
+
`):a.warn(`The "${t}" command will be incompatible with your version of Redocly CLI after ${n.sunsetDate.toLocaleString()}. ${s}
|
|
12
|
+
|
|
13
|
+
`)}function K({organization:t,project:e,pushId:n,startedAt:s}){a.info(`
|
|
14
|
+
Processed push-status for ${i(t)}, ${i(e)} and pushID ${i(n)}.
|
|
15
|
+
`),I("push-status",s,"Finished")}function W({buildType:t,spinner:e,push:n,continueOnDeployFailures:s}){n.isOutdated||!n.hasChanges?a.warn(`Files not added to your project. Reason: ${n.isOutdated?"outdated":"no changes"}.
|
|
16
|
+
`):H({status:n.status[t].deploy.status,url:n.status[t].deploy.url,buildType:t,spinner:e,continueOnDeployFailures:s})}function L(t){if(!(!t||t.length===0)){a.output(`
|
|
17
|
+
${u("Scorecard")}:`);for(let e of t)a.output(`
|
|
18
|
+
${u("Name")}: ${e.name}
|
|
19
|
+
${u("Status")}: ${e.status}
|
|
20
|
+
${u("URL")}: ${m(e.url)}
|
|
21
|
+
${u("Description")}: ${e.description}
|
|
22
|
+
`);a.output(`
|
|
23
|
+
`)}}function H({status:t,url:e,spinner:n,buildType:s,continueOnDeployFailures:o}){let p=M({status:t,url:e,buildType:s});if(n.stop(),t==="failed"&&!o)throw new y(p);a.output(p)}function M({status:t,url:e,buildType:n,wait:s}){switch(t){case"skipped":return`${i(`Skipped ${n}`)}
|
|
24
|
+
`;case"pending":{let o=`${i(`Pending ${n}`)}`;return s?o:`Status: ${o}
|
|
25
|
+
`}case"running":{let o=`${i(`Running ${n}`)}`;return s?o:`Status: ${o}
|
|
26
|
+
`}case"success":return`${v(`\u{1F680} ${c(n)} deploy success.`)}
|
|
27
|
+
${u(`${c(n)} URL`)}: ${m(e||"No URL yet.")}
|
|
28
|
+
`;case"failed":return`${P(`\u274C ${c(n)} deploy fail.`)}
|
|
29
|
+
${u(`${c(n)} URL`)}: ${m(e||"No URL yet.")}`;default:{let o=`${i(`No status yet for ${n} deploy`)}`;return s?o:`Status: ${o}
|
|
30
|
+
`}}}export{y as a,X as b,N as c,k as d};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{X as t}from"./RW2ESAIF.js";import*as e from"node:process";var o=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],n=class{frames;currentFrame;intervalId;message;constructor(){this.frames=o,this.currentFrame=0,this.intervalId=null,this.message=""}showFrame(){t.info("\r"+this.frames[this.currentFrame]+" "+this.message),this.currentFrame=(this.currentFrame+1)%this.frames.length}start(r){if(this.message!==r){if(this.message=r,!e.stderr.isTTY){t.info(`${r}...
|
|
8
|
+
`);return}this.intervalId===null&&(this.intervalId=setInterval(()=>{this.showFrame()},100))}}stop(){this.intervalId!==null&&(clearInterval(this.intervalId),this.intervalId=null,t.info("\r")),this.message=""}};function h(i){i.stop(),e.stderr.isTTY&&t.info("\x1B[2K")}function m(i,r){let[s]=r.inFlight;if(!s)return;let a=r.inFlight.size>1?` (+${r.inFlight.size-1} more)`:"";i.start(`[${r.position}/${r.total}] ${r.action} ${s}${a}`)}export{n as a,h as b,m as c};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as se}from"./BXI4SF2U.js";import{ea as W,j as L,l as U,la as M,na as p,o as j,p as B}from"./RW2ESAIF.js";import{e as re}from"./RFWIIJFG.js";var $=re(se(),1);function b(){return process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.http_proxy||process.env.https_proxy}function H(o){let t=process.env.NO_PROXY||process.env.no_proxy;if(!t)return!1;let e=t.split(",").map(s=>s.trim().toLowerCase()).filter(Boolean);if(e.length===0)return!1;let r;try{r=new URL(o).hostname.toLowerCase()}catch{return!1}return e.some(s=>!!(s==="*"||r===s||s.startsWith(".")&&r.endsWith(s)||!s.startsWith(".")&&r.endsWith("."+s)))}var q=async(o,{timeout:t,...e}={})=>{let r=b(),s=r&&!H(o),n,i=t?{connect:{timeout:t}}:{};return s?n=new $.ProxyAgent({uri:r,...i}):t&&(n=new $.Agent(i)),await fetch(o,{signal:t?AbortSignal.timeout(t):void 0,...e,dispatcher:n})};var u=class extends Error{status;constructor(t,e){super(t),this.status=e}},y=class{command;version;sunsetWarnings=[];constructor(t,e="2.0"){this.command=t,this.version=e}async request(t,e){let r={...e.headers,"user-agent":`redocly-cli/${this.version} ${this.command}`};try{let s=await q(t,{...e,headers:r});return this.collectSunsetWarning(s),s}catch(s){let n="Failed to fetch.";throw s.cause&&(n+=` Caused by ${s.cause.message||s.cause.name}.`),(s.code||s.cause?.code)&&(n+=` Code: ${s.code||s.cause?.code}`),new Error(n)}}collectSunsetWarning(t){let e=this.getSunsetDate(t);if(!e)return;let r=new Date(e);e>Date.now()?this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!1}):this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!0})}getSunsetDate(t){let{headers:e}=t;if(!e)return;let r=e.get("sunset")||e.get("Sunset");if(r)return Date.parse(r)}},A=class{client;domain;apiKey;constructor(t,e,r){this.client=t,this.domain=e,this.apiKey=r}async getParsedResponse(t){let e=await t.json();if(t.ok)return e;throw new u(`${e.title||t.statusText||"Unknown error"}.`,t.status)}async getDefaultBranch(t,e){try{let r=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/source`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return(await this.getParsedResponse(r)).branchName}catch(r){let s=`Failed to fetch default branch. ${r.message}`;throw r instanceof u?new u(s,r.status):new Error(s)}}async upsert(t,e,r){try{let s=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/remotes`,{timeout:6e3,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({mountPath:r.mountPath,mountBranchName:r.mountBranchName,type:"CICD",autoMerge:!0})});return await this.getParsedResponse(s)}catch(s){let n=`Failed to upsert remote. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}async push(t,e,r,s){let n=new globalThis.FormData;n.append("remoteId",r.remoteId),n.append("commit[message]",r.commit.message),n.append("commit[author][name]",r.commit.author.name),n.append("commit[author][email]",r.commit.author.email),n.append("commit[branchName]",r.commit.branchName),r.commit.url&&n.append("commit[url]",r.commit.url),r.commit.namespace&&n.append("commit[namespaceId]",r.commit.namespace),r.commit.sha&&n.append("commit[sha]",r.commit.sha),r.commit.repository&&n.append("commit[repositoryId]",r.commit.repository),r.commit.createdAt&&n.append("commit[createdAt]",r.commit.createdAt);for(let i of s){let a=Buffer.isBuffer(i.stream)?new Blob([i.stream]):new Blob([await ne(i.stream)]);n.append(`files[${i.path}]`,a,i.path)}r.isMainBranch&&n.append("isMainBranch","true");try{let i=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/pushes`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:n});return await this.getParsedResponse(i)}catch(i){let a=`Failed to push. ${i.message}`;throw i instanceof u?new u(a,i.status):new Error(a)}}async getRemotesList({organizationId:t,projectId:e,mountPath:r}){try{let s=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/remotes?filter=mountPath:/${r}/`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return await this.getParsedResponse(s)}catch(s){let n=`Failed to get remote list. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}async getPush({organizationId:t,projectId:e,pushId:r}){try{let s=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/pushes/${r}`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return await this.getParsedResponse(s)}catch(s){let n=`Failed to get push status. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}},m=class{apiClient;remotes;constructor({domain:t,apiKey:e,command:r,version:s}){this.apiClient=new y(r,s),this.remotes=new A(this.apiClient,t,e)}getSunsetWarning(){return z(this.apiClient.sunsetWarnings)}};function z(o){let[t]=[...o].sort((e,r)=>e.isSunsetExpired!==r.isSunsetExpired?e.isSunsetExpired?-1:1:e.sunsetDate>r.sunsetDate?1:-1);return t}async function ne(o){let t=[];for await(let e of o)t.push(e);return Buffer.concat(t)}function oe(){if(process.env.REDOCLY_AUTHORIZATION)return process.env.REDOCLY_AUTHORIZATION;throw new Error("No api key provided, please use environment variable REDOCLY_AUTHORIZATION.")}var v={us:"https://app.cloud.redocly.com",eu:"https://app.cloud.eu.redocly.com"};function ie(){return process.env.REDOCLY_DOMAIN||v.us}var K=ae((o,t)=>{try{let e=t||o?.resolvedConfig.residency;return ce(e)?v[e]:e?new URL(e).origin:o?.resolvedConfig.scorecard?.fromProjectUrl?new URL(o.resolvedConfig.scorecard.fromProjectUrl).origin:v.us}catch{throw new T}});function I(o){try{K(void 0,o)}catch{return!1}return!0}function ae(o){return(...t)=>{let e=o(...t);if(!e.startsWith("https://"))throw new T;return e}}var T=class extends Error{constructor(){super("Invalid Reunite URL")}};function ce(o){return typeof o=="string"&&o in v}import{Buffer as k}from"node:buffer";import R from"node:crypto";import{mkdirSync as ue,existsSync as V,writeFileSync as le,readFileSync as he,rmSync as de}from"node:fs";import{homedir as pe}from"node:os";import G from"node:path";import*as Y from"node:child_process";var f=class{baseUrl;apiClient;clientName="redocly-cli";constructor(t,e){this.baseUrl=t,this.apiClient=new y("login",e)}async run(t){let e=await this.getDeviceCode();t?.({verificationUri:e.verificationUri,verificationUriComplete:e.verificationUriComplete,userCode:e.userCode}),this.openBrowser(e.verificationUriComplete);let r=await this.pollingAccessToken(e.deviceCode,e.interval,e.expiresIn);return this.withResidency(r)}openBrowser(t){if(!/^https?:\/\//.test(t))return;let[e,r]=process.platform==="win32"?["rundll32",["url.dll,FileProtocolHandler",t]]:process.platform==="darwin"?["open",[t]]:["xdg-open",[t]];Y.spawn(e,r,{stdio:"ignore",detached:!0}).on("error",()=>{}).unref()}async verifyToken(t){try{return!!(await this.sendRequest("/session","GET",void 0,{Cookie:`accessToken=${t};`})).user}catch{return!1}}async verifyApiKey(t){try{return!!(await this.sendRequest("/api-keys-verify","POST",{apiKey:t})).success}catch{return!1}}async refreshToken(t){let e=await this.sendRequest("/device-rotate-token","POST",{grant_type:"refresh_token",client_name:this.clientName,refresh_token:t});if(!e.access_token)throw new Error("Failed to refresh token");return this.withResidency({access_token:e.access_token,refresh_token:e.refresh_token,expires_in:e.expires_in})}async pollingAccessToken(t,e,r){return new Promise((s,n)=>{let i=setInterval(async()=>{let c=await this.getAccessToken(t);c.access_token&&(clearInterval(i),clearTimeout(a),s(c)),c.error&&c.error!=="authorization_pending"&&(clearInterval(i),clearTimeout(a),n(c.error_description))},e*1e3),a=setTimeout(async()=>{clearInterval(i),clearTimeout(a),n("Authorization has expired. Please try again.")},r*1e3)})}async getAccessToken(t){return await this.sendRequest("/device-token","POST",{client_name:this.clientName,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})}async getDeviceCode(){let{device_code:t,user_code:e,verification_uri:r,verification_uri_complete:s,interval:n=10,expires_in:i=300}=await this.sendRequest("/device-authorize","POST",{client_name:this.clientName});return{deviceCode:t,userCode:e,verificationUri:r,verificationUriComplete:s,interval:n,expiresIn:i}}async sendRequest(t,e="GET",r=void 0,s={}){let n=`${this.baseUrl}/api${t}`,i=await this.apiClient.request(n,{body:r&&JSON.stringify(r),method:e,headers:{"Content-Type":"application/json",...s},timeout:6e3});return i.status===204?{success:!0}:await i.json()}withResidency(t){return{...t,residency:this.baseUrl}}};var me="4618dbc9-8aed-4e27-aaf0-225f4603e5a4",X="aes-256-cbc",D=class{version;credentialsFolderPath;credentialsFilePath;credentialsFileName;key;iv;constructor(t){this.version=t;let e=pe();this.credentialsFolderPath=G.join(e,".redocly"),this.credentialsFileName="credentials",this.credentialsFilePath=G.join(this.credentialsFolderPath,this.credentialsFileName),this.key=R.createHash("sha256").update(`${this.credentialsFolderPath}${me}`).digest(),this.iv=R.createHash("md5").update(this.credentialsFolderPath).digest(),ue(this.credentialsFolderPath,{recursive:!0})}async login(t,e){let s=await new f(t,this.version).run(e);if(!s)throw new Error("Failed to login. No credentials received.");await this.saveCredentials(s)}async logout(){try{this.removeCredentials()}catch{}}async isAuthorized(t,e){return e?new f(t,this.version).verifyApiKey(e):!!await this.getAccessToken(t)}getAccessToken=async t=>{let e=new f(t,this.version),r=await this.readCredentials();if(!r||!I(t)||r.residency&&r.residency!==t)return null;if(await e.verifyToken(r.access_token))return r.access_token;try{let n=await e.refreshToken(r.refresh_token);return await this.saveCredentials(n),n.access_token}catch{return null}};async saveCredentials(t){try{let e=this.encryptCredentials(t);le(this.credentialsFilePath,e,"utf8")}catch(e){throw new Error(`Failed to save credentials: ${e.message}`)}}async readCredentials(){if(!V(this.credentialsFilePath))return null;try{let t=he(this.credentialsFilePath,"utf8");return this.decryptCredentials(t)}catch{return null}}async removeCredentials(){V(this.credentialsFilePath)&&de(this.credentialsFilePath)}encryptCredentials(t){let e=R.createCipheriv(X,this.key,this.iv);return k.concat([e.update(JSON.stringify(t),"utf8"),e.final()]).toString("hex")}decryptCredentials(t){let e=R.createDecipheriv(X,this.key,this.iv),r=k.concat([e.update(k.from(t,"hex")),e.final()]);return JSON.parse(r.toString("utf8"))}};import*as g from"node:fs";import*as d from"node:path";async function fe({domain:o,apiKey:t,organization:e,project:r,mountPath:s,files:n,defaultBranch:i,commit:a,version:c,onUploadStart:C,onSunsetWarning:P}){let h=new m({domain:o,apiKey:t,command:"push",version:c});try{let w=await h.remotes.getDefaultBranch(e,r),x=await h.remotes.upsert(e,r,{mountBranchName:w,mountPath:s});C?.(x);let{id:E}=await h.remotes.push(e,r,{remoteId:x.id,commit:a,isMainBranch:i===a.branchName},n.map(l=>({path:j(l.name),stream:g.createReadStream(l.path)})));return{pushId:E}}finally{let w=h.getSunsetWarning();w&&P?.(w)}}function ge(o,t){let e={};for(let s of o)if(g.statSync(s).isDirectory()){let n=s;J(n,[]).forEach(a=>r(a,n))}else r(s,d.dirname(s));function r(s,n){let i=d.relative(n,s);e[i]&&t?.(e[i],s),e[i]=s}return Object.entries(e).map(([s,n])=>({name:s,path:d.resolve(n)}))}function J(o,t){let e=g.readdirSync(o);for(let r of e){let s=d.join(o,r);g.statSync(s).isDirectory()?t=J(s,t):t.push(s)}return t}async function Z({operation:o,condition:t,onConditionNotMet:e,startTime:r=Date.now(),retryTimeoutMs:s=6e5,retryIntervalMs:n=5e3}){async function i(){let a=await o();if(t(a))return a;if(Date.now()-r>s)throw new Error("Timeout exceeded.");return await e?.(a),await L(n),i()}return i()}var we=1200,ye=5e3,ve=["pending","running"];async function Te(o){let t=Q(o);try{return await te(t,o)}finally{ee(t,o)}}async function Ce({buildType:o,maxExecutionTime:t=we,retryIntervalMs:e=ye,startTime:r=Date.now(),onRetry:s,...n}){let i=Q(n);try{return await Z({operation:()=>te(i,n),condition:a=>!ve.includes(a.status[o].deploy.status),onConditionNotMet:s,startTime:r,retryTimeoutMs:t*1e3,retryIntervalMs:e})}finally{ee(i,n)}}function Q({domain:o,apiKey:t,version:e}){return new m({domain:o,apiKey:t,command:"push-status",version:e})}function ee(o,{onSunsetWarning:t}){let e=o.getSunsetWarning();e&&t?.(e)}function te(o,{organization:t,project:e,pushId:r}){return o.remotes.getPush({organizationId:t,projectId:e,pushId:r})}async function Pe({projectUrl:o,auth:t,isApiKey:e=!1,onDebug:r}){let s=xe(o);if(!s)throw new p(`Invalid project URL format: ${o}`);try{let n=await Ee({...s,auth:t,isApiKey:e,onDebug:r}),i=n.config.scorecardClassic||n.config.scorecard;if(!i)throw new Error("No scorecard configuration found.");let a=n.config.pluginsUrl,c=a?await Se(a,r):void 0;return{scorecard:i,plugins:c,pluginsUrl:a}}catch(n){throw new p(n instanceof Error?n.message:String(n))}}function xe(o){let t=new URL(o),e=t.pathname.match(/\/org\/(?<orgSlug>[^/]+)\/project\/(?<projectSlug>[^/]+)/);if(!e?.groups)return;let{orgSlug:r,projectSlug:s}=e.groups;return{residency:t.origin,orgSlug:r,projectSlug:s}}async function Ee({residency:o,orgSlug:t,projectSlug:e,auth:r,isApiKey:s,onDebug:n}){let i=new URL(`${o}/api/orgs/${t}/projects/${e}`),a=await fetch(i,{headers:$e(r,s)});if(n?.(`Project fetch response status: ${a.status}`),a.status===401||a.status===403)throw n?.(`Authentication failed with status ${a.status}.`),n?.("Check that your credentials are valid and have the necessary permissions."),new Error(`Unauthorized access to project: ${e}. Please check your credentials.`);if(a.status!==200)throw new Error(`Failed to fetch project: ${e}. Status: ${a.status}`);return n?.("Successfully received project configuration."),a.json()}async function Se(o,t){t?.(`Fetching plugins from: ${o}`);try{let e=await fetch(o);if(t?.(`Plugins fetch response status: ${e.status}`),e.status!==200){t?.("Failed to fetch plugins");return}return e.text()}catch(e){t?.(`Error fetching plugins: ${e instanceof Error?e.message:String(e)}`);return}}function $e(o,t){return t?{Authorization:`Bearer ${o}`}:{Cookie:`accessToken=${o}`}}async function N(o,t,e=[],r=[],s){let n={};for(let i of e){let a={[i.name]:{root:o,rules:t}},c=await W({apis:a,...i,plugins:r},{configPath:s});n[i.name]=c.forAlias(i.name)}return n}function O(o,t){if(o){for(let e of o)if(Object.entries(e.where?.metadata||{}).every(([s,n])=>Fe(s,n,t)))return e}}function Fe(o,t,e){if(t.match(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}Z)?\/(\d{4}-\d{2}-\d{2})?$/)){if(!e[o])return!1;let[r,s]=t.split("/"),n=new Date(e[o]);return!(n<new Date(r)||s&&n>new Date(s))}else if(t.match(/^\/.*\//)){if(!e[o])return!1;try{return B(t).test(e[o])}catch{throw new p(`Invalid regex in scorecard target "${o}": ${t}`)}}return e[o]===t}import{pathToFileURL as Re}from"node:url";async function _e(o,t){if(!o)return[];let e=Re(t??process.cwd()).href+"/",r=o.replaceAll("__redocly_dirname",`"${e}"`);return(await import(`data:text/javascript;base64,${btoa(r)}`)).default.map(i=>i())}var Ue=".redocly.com";function Ae(o){try{return new URL(o).hostname.toLowerCase().endsWith(Ue)}catch{return!1}}async function Ie({apiPath:o,document:t,externalRefResolver:e,scorecardConfig:r,configPath:s,plugins:n=[],targetLevel:i,metadata:a={},onDebug:c}){let C=[],P=new Map,h=r.levels||[];if(i&&!h.some(l=>l.name===i))throw new p(`Target level "${i}" not found in the scorecard configuration levels.
|
|
8
|
+
`);let w=O(r.targets,a)?.rules,x=await N(o,w,h,n,s||"");for(let l of h){c?.(`
|
|
9
|
+
Validating level: "${l.name}"`),n.length>0&&c?.(`Using ${n.length} ${U("plugin",n.length)} for this level.`),c?.("Linting document against level rules...");let S=(await M({document:t,externalRefResolver:e,config:x[l.name]})).filter(({ignored:_})=>!_).map(_=>({..._,scorecardLevel:l.name}));c?.(`Found ${S.length} ${U("problem",S.length)} for level "${l.name}".`),P.set(l.name,S),C.push(...S)}let E=ke(P,h,i);return{problems:C,achievedLevel:E,targetLevelAchieved:i?E===i:!0}}function ke(o,t,e){let r=null;for(let s of t){if((o.get(s.name)||[]).some(a=>a.severity==="error"))return r||"Non Conformant";if(r=s.name,e&&s.name===e)return s.name}return r||"Non Conformant"}export{u as a,y as b,m as c,z as d,oe as e,v as f,ie as g,K as h,I as i,T as j,f as k,D as l,fe as m,ge as n,Te as o,Ce as p,Pe as q,N as r,O as s,_e as t,Ae as u,Ie as v};
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{b as B}from"./2U6O26CV.js";import{b as X,c as E,d as T,e as W,f as ne,g as te,h as re}from"./T2XFX5KV.js";import{a as Y,c as C,d as p,e as w,f as x,g as D,h as O,i as Z,j,k as I,l as F,n as ee}from"./UW4UC7ZI.js";var U=C.php,q=class extends Y{constructor(){super(" ")}typeName(n){return p(n,{style:"pascal",reserved:U})}memberName(n){return p(n,{style:"camel",reserved:U})}identifier(n){return p(n,{style:"camel",reserved:U})}identifiers(n,s){return w(n,{style:"camel",reserved:U,taken:s})}string(n){return`'${n.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}literal(n){return n==null?"null":typeof n=="boolean"||typeof n=="number"?String(n):typeof n=="string"?this.string(n):Array.isArray(n)?`[${n.map(i=>this.literal(i)).join(", ")}]`:`[${Object.entries(n).map(([i,r])=>`${this.string(i)} => ${this.literal(r)}`).join(", ")}]`}comment(n){for(let s of F(n))this.line(s===""?"//":`// ${s}`);return this}doc(n,s,i=[]){let r=F(s);if(r.length===0&&i.length===0)return this;let t=r.length===0?n:`${n} \u2014 ${r.join(" ")}`;if(i.length===0)return this.line(`/** ${t} */`);this.line("/**"),this.line(` * ${t}`),this.line(" *");for(let a of i)this.line(` * ${a}`);return this.line(" */")}};var h=C.php,G=new q;function y(e){return G.typeName(e)}function b(e){return G.memberName(e)}function c(e){return G.string(e)}function ie(e){return p(e.name,{style:"camel",reserved:h})}function K(e){let n=e.services.flatMap(i=>i.operations),s=w(n.map(i=>i.name),{style:"camel",reserved:h});return new Map(n.map((i,r)=>[i.name,s[r]]))}function de(e){return ne(e).map(s=>s.kind==="literal"?c(s.value):`$${b(s.name)}`).join(" . ")}function se(e,n){let s=n.servers??[];if(s.length===0)return;let i=new Set;e.line("/** The declared servers; variables default to the values from the description. */"),e.line("final class Servers"),e.block("{",()=>{s.forEach((r,t)=>{let a=p(r.description??`server${t+1}`,{style:"camel",reserved:h});i.has(a)&&(a=`${a}${t+1}`),i.add(a);let o=r.variables.map(l=>`string $${b(l.name)} = ${c(l.default)}`);t>0&&e.blank(),e.line(`public static function ${a}(${o.join(", ")}): string`),e.block("{",()=>{e.line(`return ${de(r)};`)},"}")})},"}"),e.blank()}function ae(e,n){let s=te(e,n).map(i=>`[${i.map(t=>t.kind==="apiKey"?`['kind' => 'apiKey', 'scheme' => ${c(t.scheme)}, 'name' => ${c(t.name)}, 'in' => ${c(t.in)}]`:`['kind' => ${c(t.kind)}, 'scheme' => ${c(t.scheme)}]`).join(", ")}]`);if(s.length!==0)return`[${s.join(", ")}]`}function oe(e){return`[${[`'style' => ${c(e.style)}`,...e.param!==void 0?[`'param' => ${c(e.param)}`]:[],...e.nextCursor!==void 0?[`'nextCursor' => ${c(e.nextCursor)}`]:[],...e.hasMore!==void 0?[`'hasMore' => ${c(e.hasMore)}`]:[],...e.limitParam!==void 0?[`'limitParam' => ${c(e.limitParam)}`]:[],...e.items!==void 0?[`'items' => ${c(e.items)}`]:[]].join(", ")}]`}function ce(e,n){let s=new Set;return`[${(e.successResponseHeaders??[]).map(r=>{let t=p(r.name,{style:"camel",reserved:h}),a=2;for(;s.has(t);)t=`${p(r.name,{style:"camel",reserved:h})}_${a++}`;s.add(t);let o=ee(r.schema,n);return`[${c(r.name)}, ${c(t)}, ${c(o)}]`}).join(", ")}]`}function _(e,n){let s=n.schemas.find(t=>t.name===e);if(s===void 0)return"other";let i=s.schema,r=I(i);return r!==void 0&&(r.scalar==="string"||r.scalar==="integer")?"enum":(i.kind==="object"||i.kind==="intersection")&&D(i,n)!==void 0?"class":"other"}function m(e,n,s="string"){if(Z(e)){let i=m(j(e),n,s);return A(i)}switch(e.kind){case"scalar":return s==="Date"&&e.scalar==="string"&&L(e)?"\\DateTimeImmutable":{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"array":case"record":return"array";case"ref":{let i=_(e.name,n);if(i==="class"||i==="enum")return y(e.name);let r=x(e,n);return r===void 0?"mixed":m(r,n,s)}case"enum":return{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"literal":return typeof e.value=="string"?"string":typeof e.value=="boolean"?"bool":"float";case"omit":return y(e.base);case"union":return me(e.members,n,s);case"null":case"object":case"intersection":case"unknown":return"mixed"}}function L(e){let n=e.metadata?.format;return n==="date"||n==="date-time"}function A(e){return e==="mixed"||e.startsWith("?")||e.endsWith("|null")?e:e.includes("|")?`${e}|null`:`?${e}`}function me(e,n,s){let i=[];for(let r of e){if(r.kind==="null")continue;let t=m(r,n,s);if(t==="mixed")return"mixed";let a=t.startsWith("?")?t.slice(1):t;i.includes(a)||i.push(a),t.startsWith("?")&&!i.includes("null")&&i.push("null")}return i.length===0?"mixed":i.join("|")}function J(e,n,s){if(e===void 0)return;let i=j(e);if(i.kind==="ref"){let t=x(i,n);return _(i.name,n)==="other"?J(t,n,s):void 0}if(i.kind!=="array")return;let r=m(i.items,n,s);return r==="mixed"?void 0:r}function le(e,n){let s=n.schemas.find(i=>i.name===e);return s!==void 0&&O(s.schema,n)!==void 0}function v(e,n,s,i){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"&&L(r))return`new \\DateTimeImmutable(${n})`;if(r.kind==="omit")return v({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${y(r.name)}::fromArray(${n})`;if(t==="enum")return`${y(r.name)}::from(${n})`;if(le(r.name,s))return`unmarshal${y(r.name)}(${n})`;let a=x(r,s);return a===void 0?void 0:v(a,n,s,i)}if(r.kind==="array"){let t=v(r.items,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}if(r.kind==="record"){let t=v(r.value,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}}function N(e,n,s,i="string"){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"){if(r.metadata?.format==="date")return`${n}->format('Y-m-d')`;if(r.metadata?.format==="date-time")return`${n}->format(\\DateTimeInterface::ATOM)`}if(r.kind==="omit")return N({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${n}->toArray()`;if(t==="enum")return`${n}->value`;if(le(r.name,s))return`is_object(${n}) ? ${n}->toArray() : ${n}`;let a=x(r,s);return a===void 0?void 0:N(a,n,s,i)}if(r.kind==="array"||r.kind==="record"){let t=r.kind==="array"?r.items:r.value,a=N(t,"$item",s,i);return a===void 0?void 0:`array_map(static fn ($item) => ${a}, ${n})`}}function pe(e,n,s,i,r,t){let a=[...s.filter(o=>o.required),...s.filter(o=>!o.required)];e.doc(y(n),t),e.line(`final class ${y(n)}`),e.block("{",()=>{e.block("public function __construct(",()=>{for(let o of a){let l=m(o.schema,i,r);if(o.required)e.line(`public ${l} $${b(o.name)},`);else{let u=A(l);e.line(`public ${u} $${b(o.name)} = null,`)}}},") {"),e.line("}"),e.blank(),e.line("public static function fromArray(array $data): self"),e.block("{",()=>{e.block("return new self(",()=>{for(let o of a){let l=`$data[${c(o.name)}]`,u=v(o.schema,l,i,r),f=b(o.name);o.required?e.line(`${f}: ${u??l},`):u===void 0?e.line(`${f}: ${l} ?? null,`):e.line(`${f}: isset(${l}) ? ${u} : null,`)}},");")},"}"),e.blank(),e.line("public function toArray(): array"),e.block("{",()=>{e.line("$data = [];");for(let o of a){let l=`$this->${b(o.name)}`,u=N(o.schema,l,i,r)??l;o.required?e.line(`$data[${c(o.name)}] = ${u};`):e.block(`if (${l} !== null) {`,()=>{e.line(`$data[${c(o.name)}] = ${u};`)},"}")}e.line("return $data;")},"}")},"}"),e.blank()}function V(e,n="string"){let s=new q;for(let{name:i,schema:r}of e.schemas){let t=I(r);if(t!==void 0&&(t.scalar==="string"||t.scalar==="integer")){let o=t.scalar==="string"?"string":"int";s.doc(y(i),r.description),s.line(`enum ${y(i)}: ${o}`),s.block("{",()=>{let l=w(t.values.map(u=>String(u)),{style:"pascal",reserved:h});t.values.forEach((u,f)=>{let g=typeof u=="string"?c(u):String(u);s.line(`case ${l[f]} = ${g};`)})},"}"),s.blank();continue}if(r.kind==="object"||r.kind==="intersection"){let o=D(r,e);if(o!==void 0){pe(s,i,o.properties,e,n,o.description??r.description);continue}}let a=O(r,e);if(a!==void 0){let o=y(i),l=a.cases.map(u=>`${u.value} -> ${y(u.schemaName)}`).join(", ");s.line(`/** ${o} is a discriminated union (${c(a.property)}): ${l}. */`),s.line(`function unmarshal${o}(array $data): mixed`),s.block("{",()=>{s.block(`return match ($data[${c(a.property)}] ?? null) {`,()=>{for(let u of a.cases)s.line(`${c(u.value)} => ${y(u.schemaName)}::fromArray($data),`);s.line("default => $data,")},"};")},"}"),s.blank();continue}}return s.toString()}var ue=new Set(["post","put","patch"]),he=["body","headers","idempotencyKey"];function z(e,n,s,i){let r=w([...e.pathParams,...e.queryParams].map(l=>l.name),{style:"camel",reserved:h,taken:he}),t=e.pathParams.map((l,u)=>({php:r[u],wire:l.name,type:m(l.schema,n,i)})),a=e.queryParams.map((l,u)=>{let f=r[e.pathParams.length+u];return{php:f,wire:l.name,type:m(l.schema,n,i),value:N(l.schema,`$${f}`,n,i)??`$${f}`}}),o=[...t.map(({php:l,type:u})=>`${u} $${l}`),...s&&e.requestBody?[`${W(e)?"array":m(e.requestBody.schema,n,i)} $body`]:[],...a.map(({php:l,type:u})=>`${A(u)} $${l} = null`),"?array $headers = null",...s&&ue.has(e.method.toLowerCase())?["?string $idempotencyKey = null"]:[]];return{pathArgs:t,queryArgs:a,signature:o}}function ye(e,n,s){e.line(`$op = OPERATIONS[${c(n.specName??n.name)}];`),e.line("[$authHeaders, $query, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);");for(let{php:r,wire:t,value:a}of s.queryArgs)e.block(`if ($${r} !== null) {`,()=>{e.line(`$query[${c(t)}] = ${a};`)},"}");let i=s.pathArgs.map(({php:r,wire:t})=>`${c(t)} => $${r}`).join(", ");e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${i}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}")}function Q(e,n,s,i,r,t=!1){let a=z(n,i,!0,r),o=T(n),l=E(n),u=o===void 0&&l===void 0&&n.successResponses.some(k=>k.contentType!==""),f=t?"Envelope":o!==void 0?"\\Generator":l!==void 0?m(l,i,r):u?"string":"void",g=t?`${s}WithHeaders`:s,H=t?void 0:J(l,i,r);e.doc(g,t?`Like ${s}(), returning an Envelope with the declared response headers.`:n.summary??`${n.method.toUpperCase()} ${n.path}`,H===void 0?[]:[`@return ${H}[]`]),e.line(`public function ${g}(${a.signature.join(", ")}): ${f}`),e.block("{",()=>{if(ye(e,n,a),o!==void 0){let d=o.schema!==void 0&&o.schema.kind!=="unknown";e.line("$url = appendQuery($url, $query);"),e.block("$open = function (array $extraHeaders) use ($url, $requestHeaders): \\CurlHandle {",()=>{e.line("$handle = curl_init($url);"),e.line("$lines = [];"),e.block("foreach (array_merge($requestHeaders, $extraHeaders) as $name => $value) {",()=>{e.line("$lines[] = $name . ': ' . $value;")},"}"),e.line("curl_setopt($handle, CURLOPT_HTTPHEADER, $lines);"),e.line("return $handle;")},"};"),e.line(`yield from iterSse($open, ${d?"true":"false"});`);return}let k=["'operationId' => $op['id']","'method' => $op['method']","'url' => $url","'headers' => $requestHeaders","'query' => $query"];if(n.requestBody&&W(n))e.line("[$contentType, $encoded] = toMultipart($body);"),k.push("'body' => $encoded","'contentType' => $contentType");else if(n.requestBody){let d=N(n.requestBody.schema,"$body",i,r)??"$body";e.line(`$payload = json_encode(${d});`),k.push("'body' => $payload",`'contentType' => ${c(n.requestBody.contentType)}`)}ue.has(n.method.toLowerCase())&&n.requestBody&&k.push("'idempotencyKey' => $idempotencyKey"),e.line(`$response = send($this->config, [${k.join(", ")}]);`),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}");let $=u?"$response['body']":(l===void 0?void 0:v(l,"decodeJson($response)",i,r))??"decodeJson($response)";if(t){e.line(`$data = ${$};`),e.line(`return new Envelope(data: $data, headers: readEnvelopeHeaders($response, ${ce(n,i)}), status: $response['status']);`);return}if(u){e.line("return $response['body'];");return}if(f==="void"){e.line("decodeJson($response);");return}e.line(`return ${$};`)},"}"),e.blank()}function $e(e,n,s,i,r,t,a,o,l){let u=z(n,i,!1,r),f=s,g=()=>{e.line(`$op = OPERATIONS[${c(n.specName??n.name)}];`),e.line("$base = [];");for(let{php:d,wire:P,value:S}of u.queryArgs)e.block(`if ($${d} !== null) {`,()=>{e.line(`$base[${c(P)}] = ${S};`)},"}");let $=u.pathArgs.map(({php:d,wire:P})=>`${c(P)} => $${d}`).join(", ");e.block("$call = function (array $params) use ($op, $headers): array {",()=>{e.line("[$authHeaders, $authQuery, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);"),e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${$}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}"),e.line("$response = send($this->config, ['operationId' => $op['id'], 'method' => $op['method'], 'url' => $url, 'headers' => $requestHeaders, 'query' => array_merge($params, $authQuery)]);"),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}"),e.line("return [decodeJson($response), $response];")},"};")},H=m(E(n)??{kind:"unknown"},i,r),k=H==="mixed"?"mixed":H;e.line("/**"),e.line(` * ${f} response pages, following the pagination rule automatically.`),e.line(" *"),e.line(` * @return \\Generator<int, ${k}>`),e.line(" */"),e.line(`public function ${f}Pages(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{g(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`yield ${t??"$page"};`)},"}")},"}"),e.blank(),e.line("/**"),e.line(` * The items of every ${f} page.`),e.line(" *"),e.line(` * @return \\Generator<int, ${l}>`),e.line(" */"),e.line(`public function ${f}Items(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{g(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`$items = resolvePointer($page, ${c(o??"")});`),e.block("foreach (is_array($items) ? $items : [] as $item) {",()=>{e.line(`yield ${a??"$item"};`)},"}")},"}")},"}"),e.blank()}function ge(e){let n=e.split(`
|
|
7
|
+
import{b as B}from"./2U6O26CV.js";import{b as X,c as E,d as T,e as W,f as ne,g as te,h as re}from"./JH4AUZLH.js";import{a as Y,c as C,d as p,e as w,f as x,g as D,h as O,i as Z,j,k as I,l as F,n as ee}from"./UW4UC7ZI.js";var U=C.php,q=class extends Y{constructor(){super(" ")}typeName(n){return p(n,{style:"pascal",reserved:U})}memberName(n){return p(n,{style:"camel",reserved:U})}identifier(n){return p(n,{style:"camel",reserved:U})}identifiers(n,s){return w(n,{style:"camel",reserved:U,taken:s})}string(n){return`'${n.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}literal(n){return n==null?"null":typeof n=="boolean"||typeof n=="number"?String(n):typeof n=="string"?this.string(n):Array.isArray(n)?`[${n.map(i=>this.literal(i)).join(", ")}]`:`[${Object.entries(n).map(([i,r])=>`${this.string(i)} => ${this.literal(r)}`).join(", ")}]`}comment(n){for(let s of F(n))this.line(s===""?"//":`// ${s}`);return this}doc(n,s,i=[]){let r=F(s);if(r.length===0&&i.length===0)return this;let t=r.length===0?n:`${n} \u2014 ${r.join(" ")}`;if(i.length===0)return this.line(`/** ${t} */`);this.line("/**"),this.line(` * ${t}`),this.line(" *");for(let a of i)this.line(` * ${a}`);return this.line(" */")}};var h=C.php,G=new q;function y(e){return G.typeName(e)}function b(e){return G.memberName(e)}function c(e){return G.string(e)}function ie(e){return p(e.name,{style:"camel",reserved:h})}function K(e){let n=e.services.flatMap(i=>i.operations),s=w(n.map(i=>i.name),{style:"camel",reserved:h});return new Map(n.map((i,r)=>[i.name,s[r]]))}function de(e){return ne(e).map(s=>s.kind==="literal"?c(s.value):`$${b(s.name)}`).join(" . ")}function se(e,n){let s=n.servers??[];if(s.length===0)return;let i=new Set;e.line("/** The declared servers; variables default to the values from the description. */"),e.line("final class Servers"),e.block("{",()=>{s.forEach((r,t)=>{let a=p(r.description??`server${t+1}`,{style:"camel",reserved:h});i.has(a)&&(a=`${a}${t+1}`),i.add(a);let o=r.variables.map(l=>`string $${b(l.name)} = ${c(l.default)}`);t>0&&e.blank(),e.line(`public static function ${a}(${o.join(", ")}): string`),e.block("{",()=>{e.line(`return ${de(r)};`)},"}")})},"}"),e.blank()}function ae(e,n){let s=te(e,n).map(i=>`[${i.map(t=>t.kind==="apiKey"?`['kind' => 'apiKey', 'scheme' => ${c(t.scheme)}, 'name' => ${c(t.name)}, 'in' => ${c(t.in)}]`:`['kind' => ${c(t.kind)}, 'scheme' => ${c(t.scheme)}]`).join(", ")}]`);if(s.length!==0)return`[${s.join(", ")}]`}function oe(e){return`[${[`'style' => ${c(e.style)}`,...e.param!==void 0?[`'param' => ${c(e.param)}`]:[],...e.nextCursor!==void 0?[`'nextCursor' => ${c(e.nextCursor)}`]:[],...e.hasMore!==void 0?[`'hasMore' => ${c(e.hasMore)}`]:[],...e.limitParam!==void 0?[`'limitParam' => ${c(e.limitParam)}`]:[],...e.items!==void 0?[`'items' => ${c(e.items)}`]:[]].join(", ")}]`}function ce(e,n){let s=new Set;return`[${(e.successResponseHeaders??[]).map(r=>{let t=p(r.name,{style:"camel",reserved:h}),a=2;for(;s.has(t);)t=`${p(r.name,{style:"camel",reserved:h})}_${a++}`;s.add(t);let o=ee(r.schema,n);return`[${c(r.name)}, ${c(t)}, ${c(o)}]`}).join(", ")}]`}function _(e,n){let s=n.schemas.find(t=>t.name===e);if(s===void 0)return"other";let i=s.schema,r=I(i);return r!==void 0&&(r.scalar==="string"||r.scalar==="integer")?"enum":(i.kind==="object"||i.kind==="intersection")&&D(i,n)!==void 0?"class":"other"}function m(e,n,s="string"){if(Z(e)){let i=m(j(e),n,s);return A(i)}switch(e.kind){case"scalar":return s==="Date"&&e.scalar==="string"&&L(e)?"\\DateTimeImmutable":{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"array":case"record":return"array";case"ref":{let i=_(e.name,n);if(i==="class"||i==="enum")return y(e.name);let r=x(e,n);return r===void 0?"mixed":m(r,n,s)}case"enum":return{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"literal":return typeof e.value=="string"?"string":typeof e.value=="boolean"?"bool":"float";case"omit":return y(e.base);case"union":return me(e.members,n,s);case"null":case"object":case"intersection":case"unknown":return"mixed"}}function L(e){let n=e.metadata?.format;return n==="date"||n==="date-time"}function A(e){return e==="mixed"||e.startsWith("?")||e.endsWith("|null")?e:e.includes("|")?`${e}|null`:`?${e}`}function me(e,n,s){let i=[];for(let r of e){if(r.kind==="null")continue;let t=m(r,n,s);if(t==="mixed")return"mixed";let a=t.startsWith("?")?t.slice(1):t;i.includes(a)||i.push(a),t.startsWith("?")&&!i.includes("null")&&i.push("null")}return i.length===0?"mixed":i.join("|")}function J(e,n,s){if(e===void 0)return;let i=j(e);if(i.kind==="ref"){let t=x(i,n);return _(i.name,n)==="other"?J(t,n,s):void 0}if(i.kind!=="array")return;let r=m(i.items,n,s);return r==="mixed"?void 0:r}function le(e,n){let s=n.schemas.find(i=>i.name===e);return s!==void 0&&O(s.schema,n)!==void 0}function v(e,n,s,i){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"&&L(r))return`new \\DateTimeImmutable(${n})`;if(r.kind==="omit")return v({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${y(r.name)}::fromArray(${n})`;if(t==="enum")return`${y(r.name)}::from(${n})`;if(le(r.name,s))return`unmarshal${y(r.name)}(${n})`;let a=x(r,s);return a===void 0?void 0:v(a,n,s,i)}if(r.kind==="array"){let t=v(r.items,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}if(r.kind==="record"){let t=v(r.value,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}}function N(e,n,s,i="string"){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"){if(r.metadata?.format==="date")return`${n}->format('Y-m-d')`;if(r.metadata?.format==="date-time")return`${n}->format(\\DateTimeInterface::ATOM)`}if(r.kind==="omit")return N({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${n}->toArray()`;if(t==="enum")return`${n}->value`;if(le(r.name,s))return`is_object(${n}) ? ${n}->toArray() : ${n}`;let a=x(r,s);return a===void 0?void 0:N(a,n,s,i)}if(r.kind==="array"||r.kind==="record"){let t=r.kind==="array"?r.items:r.value,a=N(t,"$item",s,i);return a===void 0?void 0:`array_map(static fn ($item) => ${a}, ${n})`}}function pe(e,n,s,i,r,t){let a=[...s.filter(o=>o.required),...s.filter(o=>!o.required)];e.doc(y(n),t),e.line(`final class ${y(n)}`),e.block("{",()=>{e.block("public function __construct(",()=>{for(let o of a){let l=m(o.schema,i,r);if(o.required)e.line(`public ${l} $${b(o.name)},`);else{let u=A(l);e.line(`public ${u} $${b(o.name)} = null,`)}}},") {"),e.line("}"),e.blank(),e.line("public static function fromArray(array $data): self"),e.block("{",()=>{e.block("return new self(",()=>{for(let o of a){let l=`$data[${c(o.name)}]`,u=v(o.schema,l,i,r),f=b(o.name);o.required?e.line(`${f}: ${u??l},`):u===void 0?e.line(`${f}: ${l} ?? null,`):e.line(`${f}: isset(${l}) ? ${u} : null,`)}},");")},"}"),e.blank(),e.line("public function toArray(): array"),e.block("{",()=>{e.line("$data = [];");for(let o of a){let l=`$this->${b(o.name)}`,u=N(o.schema,l,i,r)??l;o.required?e.line(`$data[${c(o.name)}] = ${u};`):e.block(`if (${l} !== null) {`,()=>{e.line(`$data[${c(o.name)}] = ${u};`)},"}")}e.line("return $data;")},"}")},"}"),e.blank()}function V(e,n="string"){let s=new q;for(let{name:i,schema:r}of e.schemas){let t=I(r);if(t!==void 0&&(t.scalar==="string"||t.scalar==="integer")){let o=t.scalar==="string"?"string":"int";s.doc(y(i),r.description),s.line(`enum ${y(i)}: ${o}`),s.block("{",()=>{let l=w(t.values.map(u=>String(u)),{style:"pascal",reserved:h});t.values.forEach((u,f)=>{let g=typeof u=="string"?c(u):String(u);s.line(`case ${l[f]} = ${g};`)})},"}"),s.blank();continue}if(r.kind==="object"||r.kind==="intersection"){let o=D(r,e);if(o!==void 0){pe(s,i,o.properties,e,n,o.description??r.description);continue}}let a=O(r,e);if(a!==void 0){let o=y(i),l=a.cases.map(u=>`${u.value} -> ${y(u.schemaName)}`).join(", ");s.line(`/** ${o} is a discriminated union (${c(a.property)}): ${l}. */`),s.line(`function unmarshal${o}(array $data): mixed`),s.block("{",()=>{s.block(`return match ($data[${c(a.property)}] ?? null) {`,()=>{for(let u of a.cases)s.line(`${c(u.value)} => ${y(u.schemaName)}::fromArray($data),`);s.line("default => $data,")},"};")},"}"),s.blank();continue}}return s.toString()}var ue=new Set(["post","put","patch"]),he=["body","headers","idempotencyKey"];function z(e,n,s,i){let r=w([...e.pathParams,...e.queryParams].map(l=>l.name),{style:"camel",reserved:h,taken:he}),t=e.pathParams.map((l,u)=>({php:r[u],wire:l.name,type:m(l.schema,n,i)})),a=e.queryParams.map((l,u)=>{let f=r[e.pathParams.length+u];return{php:f,wire:l.name,type:m(l.schema,n,i),value:N(l.schema,`$${f}`,n,i)??`$${f}`}}),o=[...t.map(({php:l,type:u})=>`${u} $${l}`),...s&&e.requestBody?[`${W(e)?"array":m(e.requestBody.schema,n,i)} $body`]:[],...a.map(({php:l,type:u})=>`${A(u)} $${l} = null`),"?array $headers = null",...s&&ue.has(e.method.toLowerCase())?["?string $idempotencyKey = null"]:[]];return{pathArgs:t,queryArgs:a,signature:o}}function ye(e,n,s){e.line(`$op = OPERATIONS[${c(n.specName??n.name)}];`),e.line("[$authHeaders, $query, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);");for(let{php:r,wire:t,value:a}of s.queryArgs)e.block(`if ($${r} !== null) {`,()=>{e.line(`$query[${c(t)}] = ${a};`)},"}");let i=s.pathArgs.map(({php:r,wire:t})=>`${c(t)} => $${r}`).join(", ");e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${i}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}")}function Q(e,n,s,i,r,t=!1){let a=z(n,i,!0,r),o=T(n),l=E(n),u=o===void 0&&l===void 0&&n.successResponses.some(k=>k.contentType!==""),f=t?"Envelope":o!==void 0?"\\Generator":l!==void 0?m(l,i,r):u?"string":"void",g=t?`${s}WithHeaders`:s,H=t?void 0:J(l,i,r);e.doc(g,t?`Like ${s}(), returning an Envelope with the declared response headers.`:n.summary??`${n.method.toUpperCase()} ${n.path}`,H===void 0?[]:[`@return ${H}[]`]),e.line(`public function ${g}(${a.signature.join(", ")}): ${f}`),e.block("{",()=>{if(ye(e,n,a),o!==void 0){let d=o.schema!==void 0&&o.schema.kind!=="unknown";e.line("$url = appendQuery($url, $query);"),e.block("$open = function (array $extraHeaders) use ($url, $requestHeaders): \\CurlHandle {",()=>{e.line("$handle = curl_init($url);"),e.line("$lines = [];"),e.block("foreach (array_merge($requestHeaders, $extraHeaders) as $name => $value) {",()=>{e.line("$lines[] = $name . ': ' . $value;")},"}"),e.line("curl_setopt($handle, CURLOPT_HTTPHEADER, $lines);"),e.line("return $handle;")},"};"),e.line(`yield from iterSse($open, ${d?"true":"false"});`);return}let k=["'operationId' => $op['id']","'method' => $op['method']","'url' => $url","'headers' => $requestHeaders","'query' => $query"];if(n.requestBody&&W(n))e.line("[$contentType, $encoded] = toMultipart($body);"),k.push("'body' => $encoded","'contentType' => $contentType");else if(n.requestBody){let d=N(n.requestBody.schema,"$body",i,r)??"$body";e.line(`$payload = json_encode(${d});`),k.push("'body' => $payload",`'contentType' => ${c(n.requestBody.contentType)}`)}ue.has(n.method.toLowerCase())&&n.requestBody&&k.push("'idempotencyKey' => $idempotencyKey"),e.line(`$response = send($this->config, [${k.join(", ")}]);`),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}");let $=u?"$response['body']":(l===void 0?void 0:v(l,"decodeJson($response)",i,r))??"decodeJson($response)";if(t){e.line(`$data = ${$};`),e.line(`return new Envelope(data: $data, headers: readEnvelopeHeaders($response, ${ce(n,i)}), status: $response['status']);`);return}if(u){e.line("return $response['body'];");return}if(f==="void"){e.line("decodeJson($response);");return}e.line(`return ${$};`)},"}"),e.blank()}function $e(e,n,s,i,r,t,a,o,l){let u=z(n,i,!1,r),f=s,g=()=>{e.line(`$op = OPERATIONS[${c(n.specName??n.name)}];`),e.line("$base = [];");for(let{php:d,wire:P,value:S}of u.queryArgs)e.block(`if ($${d} !== null) {`,()=>{e.line(`$base[${c(P)}] = ${S};`)},"}");let $=u.pathArgs.map(({php:d,wire:P})=>`${c(P)} => $${d}`).join(", ");e.block("$call = function (array $params) use ($op, $headers): array {",()=>{e.line("[$authHeaders, $authQuery, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);"),e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${$}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}"),e.line("$response = send($this->config, ['operationId' => $op['id'], 'method' => $op['method'], 'url' => $url, 'headers' => $requestHeaders, 'query' => array_merge($params, $authQuery)]);"),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}"),e.line("return [decodeJson($response), $response];")},"};")},H=m(E(n)??{kind:"unknown"},i,r),k=H==="mixed"?"mixed":H;e.line("/**"),e.line(` * ${f} response pages, following the pagination rule automatically.`),e.line(" *"),e.line(` * @return \\Generator<int, ${k}>`),e.line(" */"),e.line(`public function ${f}Pages(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{g(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`yield ${t??"$page"};`)},"}")},"}"),e.blank(),e.line("/**"),e.line(` * The items of every ${f} page.`),e.line(" *"),e.line(` * @return \\Generator<int, ${l}>`),e.line(" */"),e.line(`public function ${f}Items(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{g(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`$items = resolvePointer($page, ${c(o??"")});`),e.block("foreach (is_array($items) ? $items : [] as $item) {",()=>{e.line(`yield ${a??"$item"};`)},"}")},"}")},"}"),e.blank()}function ge(e){let n=e.split(`
|
|
8
8
|
`),s=0;for(let i=0;i<n.length;i++)if(n[i].trim().startsWith("namespace ")){s=i+1;break}return n.slice(s).join(`
|
|
9
9
|
`).trim()}var ln=({model:e,output:n,banner:s,emit:i,pagination:r})=>{let t=new q,a=i.dateType??"string",o=p(e.title,{style:"pascal",reserved:h});t.line("<?php"),t.blank(),t.line(`// Code generated by @redocly/client-generator (php) from ${c(e.title)} ${e.version}. DO NOT EDIT.`),t.line("// Regenerate with `redocly generate-client`. PHP >= 8.1, curl extension \u2014 zero Composer dependencies."),t.blank(),t.line("declare(strict_types=1);"),t.blank(),t.line(`namespace ${o};`),t.blank(),t.line(V(e,a)),se(t,e),i.runtime==="module"?(t.line("// \u2500\u2500\u2500 Runtime (a real file beside this one, written by the same run) \u2500\u2500\u2500"),t.line("require_once __DIR__ . '/runtime.php';"),t.blank()):(t.line("// \u2500\u2500\u2500 Embedded runtime (@redocly/client-generator php runtime) \u2500\u2500\u2500"),t.line(ge(B)),t.blank());let l=e.services.flatMap($=>$.operations),u=K(e),f=new Map;for(let $ of l){let d=r?.get($.name)?.spec;d!==void 0&&f.set($.name,d)}t.block("const OPERATIONS = [",()=>{for(let $ of l){let d=$.specName??$.name,P=ae($,e),S=f.get($.name),M=[`'id' => ${c(d)}`,`'method' => ${c($.method.toUpperCase())}`,`'path' => ${c($.path)}`,...P!==void 0?[`'security' => ${P}`]:[],...S!==void 0?[`'pagination' => ${oe(S)}`]:[]];t.line(`${c(d)} => [${M.join(", ")}],`)}},"];"),t.blank(),t.doc("Client",`Client for ${e.title} (${e.version}).`),t.line("class Client"),t.block("{",()=>{t.line("public function __construct(private Config $config)"),t.block("{",()=>{t.block("if ($this->config->serverUrl === '') {",()=>{t.line(`$this->config->serverUrl = ${c(i.serverUrl??e.serverUrl??"")};`)},"}")},"}"),t.blank();for(let $ of l){let d=u.get($.name);Q(t,$,d,e,a),T($)===void 0&&($.successResponseHeaders?.length??0)>0&&Q(t,$,d,e,a,!0);let P=f.get($.name);if(P===void 0)continue;let S=E($),M=S===void 0?void 0:v(S,"$page",e,a),R=re(S,P.items,e),fe=R===void 0?void 0:v(R,"$item",e,a);$e(t,$,d,e,a,M,fe,P.items,R===void 0?"mixed":m(R,e,a))}},"}");let g={path:n.path.replace(/\.[^.\\/]+$/,".php"),content:t.toString()};if(i.runtime!=="module")return[g];let H=s.map($=>`// ${$}`).join(`
|
|
10
10
|
`),k=B.replace(/^namespace .*$/m,`namespace ${o};`).replace(/^<\?php\n/,`<?php
|
|
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a}from"./
|
|
7
|
+
import{a}from"./S4H3MC5R.js";import"./JH4AUZLH.js";import"./UAEEHSSK.js";import"./WZXA5XPB.js";import"./RW2ESAIF.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as mockGenerator};
|