@redocly/cli 0.0.0-snapshot.1793368718 → 0.0.0-snapshot.1793370998
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/THIRD_PARTY_NOTICES +1 -1
- package/lib/chunks/{VXDYKUC2.js → 24FXQOQU.js} +1 -1
- package/lib/chunks/{T7ZHUHY6.js → 2GKOB43A.js} +1 -1
- package/lib/chunks/{DQ3GUQ7U.js → 34APZKHW.js} +1 -1
- package/lib/chunks/{Q572VCQC.js → 3LLP7NVS.js} +1 -1
- package/lib/chunks/{WLBMOZGR.js → 3LQRQY5M.js} +1 -1
- package/lib/chunks/{G2YE6MW6.js → 3MNJ5EYN.js} +1 -1
- package/lib/chunks/{2ZM3DBGC.js → 4CKXA2IP.js} +1 -1
- package/lib/chunks/{7EICEYGT.js → 5K2MG3I4.js} +1 -1
- package/lib/chunks/{73EAUKOY.js → 625NNWTB.js} +1 -1
- package/lib/chunks/{R4EMA6ZT.js → 6D2X2XQS.js} +1 -1
- package/lib/chunks/{XFVLFV2Q.js → 6R7EEZSA.js} +1 -1
- package/lib/chunks/{3QXKWF5B.js → 6SHX7L3D.js} +1 -1
- package/lib/chunks/{LZHHEPXI.js → 75MSALYF.js} +1 -1
- package/lib/chunks/{YHNVSW6I.js → 7AF2C22X.js} +1 -1
- package/lib/chunks/{QYDIM64Q.js → 7KHR3CM3.js} +1 -1
- package/lib/chunks/{LVFRL5FC.js → 7NC4D3ZJ.js} +2 -2
- package/lib/chunks/{CFGFARGC.js → 7NSWKRD5.js} +1 -1
- package/lib/chunks/{XGX7J22Z.js → 7ZDIZ35Y.js} +1 -1
- package/lib/chunks/{WCI5ASWS.js → ABTURUCR.js} +1 -1
- package/lib/chunks/{G35S3NIW.js → AIRTYPQG.js} +1 -1
- package/lib/chunks/{K7PPRVPX.js → B2ZLNQUA.js} +1 -1
- package/lib/chunks/{MPWGYCL2.js → CIILS77A.js} +1 -1
- package/lib/chunks/{ZBADUPUP.js → D6BKKDZS.js} +1 -1
- package/lib/chunks/{3E4355CR.js → DZAPEGXK.js} +1 -1
- package/lib/chunks/{UAZNVT77.js → ECNM3MTN.js} +1 -1
- package/lib/chunks/{Z3QJWAAI.js → F252KRDN.js} +1 -1
- package/lib/chunks/{AHUJHFHD.js → F4CSHR2G.js} +2 -2
- package/lib/chunks/{SAK47GRK.js → F4G3JJLB.js} +1 -1
- package/lib/chunks/{UXF77HUI.js → FBQOYLDZ.js} +1 -1
- package/lib/chunks/{GJZPK6ZY.js → FKECD45S.js} +1 -1
- package/lib/chunks/{DSKFD2OL.js → FV7F7TBL.js} +1 -1
- package/lib/chunks/{OORTML3X.js → G5KKQI2Q.js} +1 -1
- package/lib/chunks/{ZA4R7SL5.js → GHCKSJDD.js} +1 -1
- package/lib/chunks/{CSW7Z7RS.js → GLRXTU5T.js} +1 -1
- package/lib/chunks/{EPHPF3YO.js → GMDFFSRX.js} +1 -1
- package/lib/chunks/{4WTLZT3E.js → GOUYVBTZ.js} +1 -1
- package/lib/chunks/H5WKHOUJ.js +199 -0
- package/lib/chunks/{DIK6OMN6.js → HX7UNFQC.js} +1 -1
- package/lib/chunks/{OBZAMT7N.js → I3B4TT2D.js} +1 -1
- package/lib/chunks/{BAZXW3ZY.js → I5KNR2DJ.js} +1 -1
- package/lib/chunks/{UFWNO5DL.js → IDJBFYP5.js} +1 -1
- package/lib/chunks/{XNJIDEA7.js → K4W4YRBV.js} +1 -1
- package/lib/chunks/{74SZKDHH.js → KAQZ7LKA.js} +1 -1
- package/lib/chunks/{NBWFZZNM.js → KWFCONP2.js} +1 -1
- package/lib/chunks/{SKW2O7OW.js → L6CS7CNE.js} +2 -2
- package/lib/chunks/{GFOLKQQK.js → LVI4JH7K.js} +1 -1
- package/lib/chunks/{XHY7I7WA.js → LYBB25EQ.js} +1 -1
- package/lib/chunks/{EIG5R4GQ.js → MK6HXFTH.js} +1 -1
- package/lib/chunks/{QFT7RSAH.js → MMNL6TET.js} +1 -1
- package/lib/chunks/{6VLCBKCA.js → O6OLL6RR.js} +1 -1
- package/lib/chunks/{2JKJ7XJ2.js → OHUSCJUU.js} +1 -1
- package/lib/chunks/{KLUCA7EV.js → OW3J4XGD.js} +1 -1
- package/lib/chunks/{BJACD2U7.js → PDGJV622.js} +1 -1
- package/lib/chunks/{4MX2DKL3.js → PHXVE62B.js} +1 -1
- package/lib/chunks/{WKCN3LHS.js → PLFEUPCQ.js} +1 -1
- package/lib/chunks/{2EONLJO3.js → PTUKA6ET.js} +1 -1
- package/lib/chunks/{WQZJM6IZ.js → QMXP2Q77.js} +1 -1
- package/lib/chunks/{VAEWFVCV.js → QTIDFGQX.js} +1 -1
- package/lib/chunks/{33XIPNVV.js → QUDQR4U6.js} +1 -1
- package/lib/chunks/{JRXCZBBR.js → RZQMPUOA.js} +1 -1
- package/lib/chunks/{HMZ3XPWI.js → SAISXQ3H.js} +1 -1
- package/lib/chunks/{DDXAA5G3.js → SIJFHUB2.js} +1 -1
- package/lib/chunks/{YMB4CELV.js → T22VEDMH.js} +1 -1
- package/lib/chunks/{J7KA2J7H.js → TLZMMQMU.js} +1 -1
- package/lib/chunks/{R6XJXMQW.js → URDUFITS.js} +1 -1
- package/lib/chunks/{6M6IICIX.js → UVJB36FJ.js} +1 -1
- package/lib/chunks/{HXWAS7AZ.js → VDE7RR5C.js} +2 -2
- package/lib/chunks/{3SXPOLO7.js → WI63LIAY.js} +1 -1
- package/lib/chunks/{GJ6JEGB4.js → WVANUCLR.js} +1 -1
- package/lib/chunks/{5X6OMRZ5.js → X6GOPUBX.js} +1 -1
- package/lib/chunks/{E7LWJ577.js → XBQU67GR.js} +1 -1
- package/lib/chunks/{54B26OUO.js → XTJBKAOF.js} +1 -1
- package/lib/chunks/{REZCSBM3.js → YRXPFAZ4.js} +1 -1
- package/lib/chunks/{JXMEP3N7.js → YVLHLNRH.js} +2 -2
- package/lib/chunks/{S4BHLBBV.js → ZBYJ6NPK.js} +1 -1
- package/lib/chunks/{V3EQRBVQ.js → ZE2CLVT2.js} +3 -3
- package/lib/chunks/{RTKXD4KK.js → ZRNJC5D2.js} +1 -1
- package/lib/chunks/{OM5QIL7J.js → ZURE3OT2.js} +1 -1
- 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/java/client.ts +1 -1
- package/lib/eject-assets/generators/java/descriptor.ts +1 -1
- package/lib/eject-assets/generators/java/index.ts +2 -2
- package/lib/eject-assets/generators/java/models.ts +1 -1
- package/lib/eject-assets/generators/java/naming.ts +1 -1
- package/lib/eject-assets/generators/java/operations.ts +1 -1
- package/lib/eject-assets/generators/java/pagination.ts +1 -1
- package/lib/eject-assets/generators/java/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 +4 -4
- package/package.json +1 -1
- package/lib/chunks/AQJ3Q2RW.js +0 -199
package/THIRD_PARTY_NOTICES
CHANGED
|
@@ -416,7 +416,7 @@ Packages:
|
|
|
416
416
|
@noble/hashes@1.8.0 — Copyright (c) 2022 Paul Miller (https://paulmillr.com)
|
|
417
417
|
@redocly/ajv@8.18.3 — Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
418
418
|
@redocly/cli-otel@0.3.7 — Copyright 2025 Redocly Inc, all rights reserved.
|
|
419
|
-
@redocly/config@0.
|
|
419
|
+
@redocly/config@0.70.0 — Copyright 2024 Redocly Inc.
|
|
420
420
|
ajv-formats@3.0.1 — Copyright (c) 2020 Evgeny Poberezkin
|
|
421
421
|
ajv@8.20.0 — Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
422
422
|
ansi-regex@6.4.0
|
|
@@ -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 N,c as U,k as C}from"./
|
|
7
|
+
import{b as N,c as U,k as C}from"./PDGJV622.js";import{o as te,p as ne,t as re,u as D,v as oe}from"./VDE7RR5C.js";import{a as y}from"./WZXA5XPB.js";import{Ca as ee,R as V,X as Q,c as x,ka as b,ma as Y,q as v,r as J,ta as Z,u as W,va as R}from"./H5WKHOUJ.js";import{mkdir as ct,readFile as ut,writeFile as pt}from"node:fs/promises";import{dirname as ve,parse as ft,resolve as E,sep as dt}from"node:path";function I(e){return{requires:["typescript"],errorModes:["throw"],load:()=>import("./G5KKQI2Q.js").then(t=>({run:t.tanstackQueryGenerator(e)}))}}var T={outputMode:"it always emits one self-contained file",runtime:"the runtime is always embedded in the generated file",argsStyle:"inputs follow the target language's own idiom",importExt:"the generated file has no relative imports"},G={typescript:{load:()=>import("./QUDQR4U6.js").then(e=>({run:e.typescriptGenerator,sample:e.typescriptSample,docs:e.typescriptDocs}))},zod:{load:()=>import("./PHXVE62B.js").then(e=>({run:e.zodGenerator}))},transformers:{requires:["typescript"],dateTypes:["Date"],load:()=>import("./D6BKKDZS.js").then(e=>({run:e.transformersGenerator}))},"tanstack-query":I("react"),"tanstack-query-vue":I("vue"),"tanstack-query-svelte":I("svelte"),"tanstack-query-solid":I("solid"),swr:{requires:["typescript"],errorModes:["throw"],load:()=>import("./CIILS77A.js").then(e=>({run:e.swrGenerator}))},mock:{requires:["typescript"],load:()=>import("./QTIDFGQX.js").then(e=>({run:e.mockGenerator}))},cli:{requires:["typescript","zod"],errorModes:["throw"],load:()=>import("./MK6HXFTH.js").then(e=>({run:e.cliGenerator,sample:e.cliSample,docs:e.cliDocs}))},python:{notApplicable:T,load:()=>import("./KAQZ7LKA.js").then(e=>({run:e.pythonGenerator,sample:e.pythonSample,docs:e.pythonDocs,options:e.pythonOptions}))},go:{errorModes:["throw"],notApplicable:T,load:()=>import("./F4G3JJLB.js").then(e=>({run:e.goGenerator,sample:e.goSample,docs:e.goDocs}))},php:{errorModes:["throw"],notApplicable:T,load:()=>import("./XTJBKAOF.js").then(e=>({run:e.phpGenerator,sample:e.phpSample,docs:e.phpDocs}))},java:{errorModes:["throw"],notApplicable:T,load:()=>import("./GLRXTU5T.js").then(e=>({run:e.javaGenerator,sample:e.javaSample,docs:e.javaDocs}))}};function se(e,t,n,r){let o=new Set(e);t.goPackage!==void 0&&!o.has("go")&&b.warn(`generate-client: goPackage is ignored \u2014 it declares the Go package clause, and no selected generator uses it (add --generator go).
|
|
8
8
|
`),t.telemetry==="on"&&!o.has("typescript")&&b.warn(`generate-client: telemetry is ignored \u2014 the typescript generator writes the telemetry module, and it is not selected (add --generator typescript).
|
|
9
9
|
`);let s=t.errorMode??"throw",a=t.dateType??"string";for(let i of e){let c=n.get(i);if(!c)throw new y(`Unknown generator: ${i}`);for(let p of c.requires??[])if(!o.has(p)){let f=[...new Set([p,...e])].map(m=>`--generator ${m}`).join(" ");throw new y(`The "${i}" generator requires the "${p}" generator. Add it, e.g. ${f}.`)}if(c.errorModes&&!c.errorModes.includes(s))throw new y(`The "${i}" generator does not support --error-mode "${s}" (supported: ${c.errorModes.join(", ")}).`);if(c.dateTypes&&!c.dateTypes.includes(a))throw new y(`The "${i}" generator requires --date-type ${c.dateTypes.join(" or ")} (got "${a}") so the runtime values match the generated types.`);let u={...t,outputMode:r};for(let[p,f]of Object.entries(c.notApplicable??{}))u[p]!==void 0&&b.warn(`generate-client: the "${i}" generator ignores ${p} \u2014 ${f}.
|
|
10
10
|
`)}}function ie(e,t,n){let r=new Map;for(let o of e){let s=t.get(o)?.options,a=n?.[o];if(s===void 0){a!==void 0&&b.warn(`generate-client: the "${o}" generator declares no options, so client.options.${o} is ignored.
|
|
@@ -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 $,g as xt,h as et}from"./
|
|
7
|
+
import{a as $,g as xt,h as et}from"./GOUYVBTZ.js";import{a as wt}from"./64G5RPLP.js";import{b as lt,f as ut,m as gt,n as ht,s as yt}from"./I5KNR2DJ.js";import{A as pt,X as Z,b as N,ba as D,c as M,ca as G,d as it,da as k,ea as v,g as at,i as U,ka as T,ma as tt,q as E,qa as w,sa as ft,xa as ct,ya as mt}from"./H5WKHOUJ.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";import*as Nt from"node:path";import{performance as jt}from"node:perf_hooks";import*as Ot from"node:path";function dt(t,e){xt(t,o=>{if(E(o)&&et(o.$ref)){let r=Ot.basename(o.$ref);o.$ref=o.$ref.replace(r,e+"_"+r)}else if(M(o.discriminator)&&M(o.discriminator.mapping)){let{mapping:r}=o.discriminator;for(let i of Object.keys(r)){let c=r[i];typeof c=="string"&&et(c)&&(r[i]=c.split("/").map((O,s,p)=>p.length-1===s&&!O.startsWith(e+"_")?e+"_"+O:O).join("/"))}}})}function j(t,e,o){if(!e)return"";if(!t)throw new w("Info section is not found in specification.");if(!t[e])throw new w(`${k(`prefix-${o}-with-info-prop`)} argument value is not found in info section.`);if(!at(t[e]))throw new w(`${k(`prefix-${o}-with-info-prop`)} argument value should be string.`);if(t[e].length>50)throw new w(`${k(`prefix-${o}-with-info-prop`)} argument value length should not exceed 50 characters.`);return t[e].replaceAll(/\s/g,"_")}function ot(t,e){return e?t?.map(o=>{let r={};for(let[i,c]of Object.entries(o))Object.assign(r,{[e+"_"+i]:c});return r}):t}function C(t,e){return e?e+"_"+t:t}import*as Pt from"node:path";function H(t,e){return t.replace(/"(#\/components\/.*?)"/g,o=>{let r=Pt.basename(o);return o.replace(r,C(r,e))})}function B(t){return t.map(e=>({name:e}))}import*as q from"node:path";function bt(t){return q.basename(t,q.extname(t))}function vt(t){return Object.entries(t).filter(([e,o])=>o.length>1)}function rt(t,e){for(let[o,r]of e)T.warn(`Conflict on ${t} : ${D(o)} in files: ${v(r)}
|
|
8
8
|
`)}function Tt(t){T.info(G(`
|
|
9
9
|
${t} conflict(s) on tags.
|
|
10
10
|
Suggestion: please use ${v("prefix-tags-with-filename")}, ${v("prefix-tags-with-info-prop")} or ${v("without-x-tag-groups")} to prevent naming conflicts.
|
|
@@ -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 k,b as E,c as I,d as v}from"./
|
|
7
|
+
import{a as k,b as E,c as I,d as v}from"./WI63LIAY.js";import{a as O}from"./5K2MG3I4.js";import{c as d,d as F}from"./WVANUCLR.js";import{f as A}from"./I5KNR2DJ.js";import{$ as C,ba as R,ca as $,da as S,ga as b,ka as s,qa as g,ra as M}from"./H5WKHOUJ.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";import{mkdir as V,writeFile as W}from"node:fs/promises";import _ from"node:path";import{performance as q}from"node:perf_hooks";var T=20;function B(e){return e.total===0?void 0:Math.floor(e.covered/e.total*100)}function z(e){return e===void 0?"n/a":`${e}%`}function J(e,o){let t=e===void 0?0:Math.floor(e/100*T),r=`${"\u2588".repeat(t)}${"\u2591".repeat(T-t)}`;return!o||e===void 0?r:e>=80?$(r):e>=50?S(r):R(r)}function P(e,o){let t=[["operations",e.totals.operations],["parameters",e.totals.parameters],["schema properties",e.totals.properties],["response codes",e.totals.responses]],r=Math.max(...t.map(([,c])=>`${c.covered}/${c.total}`.length)),n="API coverage",a=[o?C(b(n)):n];for(let[c,i]of t){let f=B(i);a.push(` ${c.padEnd(18)} ${J(f,o)} ${z(f).padStart(5)} ${`${i.covered}/${i.total}`.padStart(r+3)}`)}return`${a.join(`
|
|
8
8
|
`)}
|
|
9
9
|
`}function L(e,o){let t={version:1,meta:{...o,exchanges:e.exchanges},totals:e.totals,operations:e.operations};return`${JSON.stringify(t,null,2)}
|
|
10
10
|
`}async function j(e){let o=await F(e.trafficPath);if(o.length===0)throw new Error("No traffic files found in the provided traffic path.");let t=E.create({openApiIndex:e.openApiIndex,matchMode:e.matchMode,ignoreCookies:e.ignoreCookies,ignoreHeaders:e.ignoreHeaders,previewFindingsLimit:e.previewFindingsLimit,activeRules:e.activeRules,server:e.server,minSeverity:e.minSeverity,coverage:e.coverage}),r=0,n=0;for(let a of o){let c=await O(a,e.format);if(!c){s.warn(`Skipping traffic file with unrecognized format: ${a}
|
|
@@ -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{e as y,k as D}from"./
|
|
7
|
+
import{e as y,k as D}from"./PDGJV622.js";import{g as _}from"./VDE7RR5C.js";import{join as z}from"node:path";var a=" ";function k(t){return`transform${D(t)}`}var W="type __Writable<T> = { -readonly [K in keyof T]: T[K] };",v=!1;function E(t){return{text:t,path:[t]}}function B(t,r){return{text:`${t.text}[${JSON.stringify(r)}]`,path:[...t.path,r]}}function d(t,r,n){if(w(t))return!0;switch(t.kind){case"array":return d(t.items,r,n);case"union":return t.members.some(o=>d(o,r,n));case"ref":{if(n.has(t.name))return!1;let o=r.get(t.name);return o!==void 0&&d(o,r,new Set(n).add(t.name))}default:return!1}}function w(t){return t.kind==="scalar"&&t.scalar==="string"&&(t.metadata?.format==="date-time"||t.metadata?.format==="date")}function $(t,r,n){if(w(t))return!0;switch(t.kind){case"array":return $(t.items,r,n);case"record":return $(t.value,r,n);case"object":return t.properties.some(o=>$(o.schema,r,n));case"union":case"intersection":return t.members.some(o=>$(o,r,n));case"ref":{let o=r.get(t.name);return o!==void 0&&!n.has(t.name)?$(o,r,new Set(n).add(t.name)):!1}default:return!1}}function l(t,r,n,o=!1){return o?[`${n}if (${t}) {`,...r(n+a),`${n}}`]:[`${n}if (${t})`,...r(n+a)]}function O(t,r,n=!1){let o=n?G(t):t.text;return i=>[`${i}${o} = ${r};`]}function T(t){return r=>[`${r}${t};`]}function G(t){if(t.path.length<2)return t.text;v=!0;let r={text:t.text.slice(0,t.text.lastIndexOf("[")),path:t.path.slice(0,-1)},n=t.path[t.path.length-1];return`(${r.text} as __Writable<${K(r)}>)[${JSON.stringify(n)}]`}function K(t){let r=`typeof ${t.path[0]}`;for(let n of t.path.slice(1))r=`NonNullable<${r}>[${JSON.stringify(n)}]`;return`NonNullable<${r}>`}function U(t){return t==="data"?"item":`item${Number(t.slice(4))+1}`}function p(t,r,n,o,i,e,u=!1){if(w(r))return l(`typeof ${t.text} === "string"`,O(t,`new Date(${t.text})`,u),e);switch(r.kind){case"ref":return h(t,r.name,n,o,e,u);case"object":{let f=[];for(let s of r.properties)f.push(...P(B(t,s.name),s.schema,n,o,i,e,s.readOnly===!0));return f}case"array":return R(t,r.items,n,o,i,e,u);case"record":return J(t,r.value,n,o,i,e,!0);case"intersection":{let f=[];for(let s of r.members)f.push(...p(t,s,n,o,i,e,u));return f}case"union":return b(t,r.members,n,o,i,e,u);default:return[]}}function b(t,r,n,o,i,e,u=!1){let f=[],s=e+a,x=[];for(let c of r)if(w(c))f.push(...p(t,c,n,o,i,e,u));else if(c.kind==="ref"){if(!$(c,n,o))continue;let j=`${k(c.name)}(${t.text} as ${c.name})`,m=d(c,n,o)?O(t,j,u):T(j);x.push(...m(s))}else x.push(...p(t,c,n,o,i,s,u));return x.length>0&&f.push(...l(`${t.text} && typeof ${t.text} === "object"`,()=>x,e,!0)),f}function h(t,r,n,o,i,e=!1){let u={kind:"ref",name:r};if(!$(u,n,o))return[];let f=`${k(r)}(${t.text})`;return l(t.text,d(u,n,o)?O(t,f,e):T(f),i)}function P(t,r,n,o,i,e,u=!1){if(r.kind==="ref")return h(t,r.name,n,o,e,u);if(r.kind==="object"){let f=p(t,r,n,o,i,e+a);return f.length===0?[]:l(t.text,()=>f,e,!0)}return p(t,r,n,o,i,e,u)}function A(t,r,n,o,i=0){if(w(r))return`new Date(${t})`;if(r.kind==="ref"&&d(r,n,o))return`${k(r.name)}(${t})`;if(r.kind==="array"){let e=r.items.kind==="array"?I(i+1):"v",u=A(e,r.items,n,o,i+1);return u===null?null:`${t}.map(${e} => ${u})`}return null}function I(t){return t<=1?"row":`row${t}`}function R(t,r,n,o,i,e,u=!1){let f=r.kind==="array"?I(1):"v",s=A(f,r,n,o,1);return s!==null?l(`Array.isArray(${t.text})`,O(t,`${t.text}.map(${f} => ${s})`,u),e):r.kind==="ref"?$(r,n,o)?l(`Array.isArray(${t.text})`,T(`${t.text}.forEach(${k(r.name)})`),e):[]:J(t,r,n,o,i,e,!1)}function J(t,r,n,o,i,e,u){if(u){let c={text:`${t.text}[__k]`,path:[...t.path,"__k"]},j=A(c.text,r,n,o);if(j!==null){let m=w(r)?`typeof ${c.text} === "string"`:`Array.isArray(${c.text})`;return l(t.text,S=>[`${S}for (const __k of Object.keys(${t.text}))`,...l(m,C=>[`${C}${c.text} = ${j};`],S+a)],e)}}let f=U(i),s=p(E(f),r,n,o,f,e+a+a);if(s.length===0)return[];let x=u?`Object.values(${t.text})`:t.text;return l(u?t.text:`Array.isArray(${t.text})`,c=>[`${c}${x}.forEach(${f} => {`,...s,`${c}});`],e)}function q(t,r,n){let o=t.name,i=E("data"),e=t.schema.kind==="ref"?h(i,t.schema.name,n,new Set,a):p(i,t.schema,n,new Set,"data",a),u=(_(t.schema,r)?.properties??[]).filter(s=>s.writeOnly).map(s=>JSON.stringify(s.name));if(u.length===0)return[`export const ${k(t.name)} = (data: ${o}): ${o} => {`,...e,`${a}return data;`,"};"].join(`
|
|
8
8
|
`);let f=`Omit<${o}, ${u.join(" | ")}>`;return[`export const ${k(t.name)} = <T extends ${f}>(input: T): T => {`,`${a}const data: ${f} = input;`,...e,`${a}return input;`,"};"].join(`
|
|
9
9
|
`)}function M(t,r){let n=new Map(t.schemas.map(f=>[f.name,f.schema])),o=t.schemas.filter(f=>$(f.schema,n,new Set));if(o.length===0)return"";let i=o.map(f=>y(f.name)).join(", ");v=!1;let e=o.map(f=>q(f,t,n));return[`import type { ${i} } from ${JSON.stringify(r.sdkModule)};`,...v?[W]:[],...e].join(`
|
|
10
10
|
|
|
@@ -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{i as c,l as a}from"./
|
|
7
|
+
import{i as c,l as a}from"./FBQOYLDZ.js";import"./KFQC57GK.js";import{ka as s}from"./H5WKHOUJ.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";async function g({operation:i,input:r,version:n}){let t=await l(r),e=`${t.protocol}://${t.host}`;if(i!=="get"||!c(e))return"";let o=process.env.REDOCLY_AUTHORIZATION||await new a(n).getAccessToken(e);return o?`username=redocly
|
|
8
8
|
password=${o}
|
|
9
9
|
`:(s.error(`You are not logged in to ${e}. Run \`redocly login --residency ${e}\` or set the REDOCLY_AUTHORIZATION environment variable.
|
|
10
10
|
`),`quit=1
|
|
@@ -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 S,c as N,e as R,j as g,k as _,o as v,q as F,r as U,s as b,v as s}from"./
|
|
7
|
+
import{b as S,c as N,e as R,j as g,k as _,o as v,q as F,r as U,s as b,v as s}from"./I5KNR2DJ.js";import{ca as y,da as $,ea as i,ia as u,ka as n,ra as k,ta as T,u as O,xa as B,ya as E}from"./H5WKHOUJ.js";import{writeFileSync as L}from"fs";import{resolve as j}from"path";import{performance as q}from"perf_hooks";var P={};async function Y({argv:e,config:l,version:W,collectSpecData:G}){let A=await S(e.apis,l),a={errors:0,warnings:0,ignored:0},I=N(l);for(let{path:o,alias:c,output:J}of A)try{let d=q.now(),p=l.forAlias(c);p.skipPreprocessors(e["skip-preprocessor"]),p.skipDecorators(e["skip-decorator"]);let m=e.overlay??p.resolvedConfig.overlays?.map(t=>O(t)?t:j(I,t));m?.length&&(P.bundle_overlays_count=(P.bundle_overlays_count??0)+m.length),c===void 0?n.info(u(`bundling ${s(o)}...
|
|
8
8
|
`)):n.info(u(`bundling ${s(o)} using configuration for api '${c}'...
|
|
9
9
|
`));let{bundle:D,problems:w,...x}=await T({ref:o,config:p,dereference:e.dereferenced,removeUnusedComponents:e["remove-unused-components"],keepUrlRefs:e["keep-url-references"],componentRenamingConflicts:e["component-renaming-conflicts-severity"],componentNamesStrategy:e["component-names-strategy"],overlays:m,collectSpecData:G}),r=B(w),{outputFile:f,ext:K}=F({entrypoint:o,output:J,argvOutput:e.output,ext:e.ext,entries:e?.apis?.length||0});if(r.errors===0||e.force)if(f){let t=g(b(D.parsed),K,e.dereferenced);_(f,t)}else{let t=g(b(D.parsed),e.ext||"yaml",e.dereferenced);n.output(t)}a.errors+=r.errors,a.warnings+=r.warnings,a.ignored+=r.ignored,E(w,{format:"codeframe",totals:r,version:W,command:"bundle"}),e.metafile&&(A.length>1&&n.warn('[WARNING] "--metafile" cannot be used with multiple apis. Skipping...'),L(e.metafile,JSON.stringify(x),"utf-8"));let h=R(d);r.errors>0?e.force?n.info(`\u2753 Created a bundle for ${i(s(o))} at ${i(f||"stdout")} with errors ${y(h)}.
|
|
10
10
|
${$("Errors ignored because of --force")}.
|
|
@@ -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 T,b as O,c as A,d as E}from"./
|
|
7
|
+
import{a as T,b as O,c as A,d as E}from"./WI63LIAY.js";import{c as m,k as C,r as $}from"./WVANUCLR.js";import{a as q}from"./KFQC57GK.js";import{c as H,ka as u,qa as y,ra as R}from"./H5WKHOUJ.js";import"./6RTITFQA.js";import{e as z}from"./RFWIIJFG.js";import{createReadStream as F,createWriteStream as k,existsSync as N}from"node:fs";import{appendFile as V,mkdir as _,rm as j,writeFile as W}from"node:fs/promises";import B from"node:path";import{createInterface as G}from"node:readline";var w=class{outputPath;entriesPath;creatorVersion;writeChain=Promise.resolve();directoryEnsured=!1;started=!1;count=0;constructor(t,r){this.outputPath=B.resolve(process.cwd(),t),this.entriesPath=`${this.outputPath}.entries.tmp`,this.creatorVersion=r}get entryCount(){return this.count}add(t){let r=`${JSON.stringify(t)}
|
|
8
8
|
`,n=this.writeChain.catch(()=>{}).then(()=>this.append(r)).then(()=>{this.count+=1});return this.writeChain=n.catch(()=>{}),n}async finalize(){await this.writeChain.catch(()=>{}),await this.ensureDirectory(),await this.writeDocument(),await j(this.entriesPath,{force:!0})}async append(t){if(await this.ensureDirectory(),!this.started){await W(this.entriesPath,t,"utf8"),this.started=!0;return}await V(this.entriesPath,t,"utf8")}async ensureDirectory(){this.directoryEnsured||(await _(B.dirname(this.outputPath),{recursive:!0}),this.directoryEnsured=!0)}async writeDocument(){let t=k(this.outputPath,{encoding:"utf8"}),r=n=>new Promise((o,s)=>{t.write(n,i=>i?s(i):o())});try{let n=JSON.stringify({name:"redocly-cli proxy",version:this.creatorVersion});await r(`{
|
|
9
9
|
"log": {
|
|
10
10
|
"version": "1.2",
|
|
@@ -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{b as m,j as C,o as a,p,q as T,r as l,s as h,t as f,u as d}from"./
|
|
7
|
+
import{b as m,j as C,o as a,p,q as T,r as l,s as h,t as f,u as d}from"./WVANUCLR.js";import{c as g}from"./H5WKHOUJ.js";import A from"node:path";function L(e,n){if(C(e)!=="application/x-www-form-urlencoded"||!Array.isArray(n))return;let o=new URLSearchParams;for(let s of n){if(!g(s))continue;let t=a(s.name);t!==void 0&&o.append(t,a(s.value)??"")}return o.size>0?o.toString():void 0}function K(e,n,o){let s=e?.request,t=e?.response;if(!s)return null;let r=s?.postData,i=a(r?.mimeType),u=r?.text??L(i,r?.params),c=a(r?.encoding),y=t?.content?.text,S=a(t?.content?.encoding),q=p(t?.status);return l({method:a(s?.method),url:a(s?.url),requestHeaders:s?.headers,requestBody:T(u,c),requestContentType:i,responseStatus:q===0?void 0:q,responseStatusText:a(t?.statusText),responseHeaders:t?.headers,responseBody:T(y,S),responseContentType:a(t?.content?.mimeType),startedAt:a(e?.startedDateTime),raw:e},n,o)}var b=class{id="har";canParse(n,o){if(A.extname(n).toLowerCase()===".har")return!0;let t=o.toLowerCase();return t.includes('"log"')&&t.includes('"entries"')}async*parse(n){let o=0;for await(let s of f(n,"log.entries")){let t=K(s,o,n);t&&(yield t),o+=1}}};import $ from"node:path";function H(e){let n=a(e.url??e.uri);if(n)return{url:n};let o=a(e.host??e.headers?.host),s=a(e.path??e.request_uri),t=a(e.scheme??e.forwarded_proto);return o&&s?{url:`${t??"http"}://${o}${s}`,schemeKnown:!!t}:{url:s,schemeKnown:!!t}}function z(e,n,o){let s=e?.request??e?.req??e?.http?.request;if(!s)return null;let t=e?.response??e?.res??e?.http?.response,r=t?.body??t?.raw_body??t?.payload??t?.data,i=s?.body??s?.raw_body??s?.payload??s?.data,{url:u,schemeKnown:c}=H(s);return l({method:a(s?.method??s?.http_method),url:u,schemeKnown:c,requestHeaders:s?.headers,requestBody:i,requestContentType:d(s?.headers),responseStatus:p(t?.status??t?.statusCode),responseHeaders:t?.headers,responseBody:r,responseContentType:d(t?.headers),startedAt:a(e?.started_at??e?.startedAt??e?.timestamp),raw:e},n,o)}var x=class{id="kong";canParse(n,o){if($.extname(n).toLowerCase()===".kong")return!0;let t=o.toLowerCase();return t.includes('"latencies"')||t.includes('"request"')&&t.includes('"response"')&&t.includes('"route"')}async*parse(n){let o=(await m(n,16)).trim().slice(0,1),s=0;if(o==="["){for await(let t of f(n)){let r=z(t,s,n);r&&(yield r),s+=1}return}for await(let t of h(n)){let r=z(t,s,n);r&&(yield r),s+=1}}};import R from"node:path";function U(e){return e?.request??e?.req??e?.httpRequest??e?.http?.request??e}function I(e){return e?.response??e?.res??e?.httpResponse??e?.http?.response}function O(e,n){let o=a(n?.url??n?.uri??n?.requestUrl??e?.url);if(o)return{url:o};let s=a(n?.host??n?.headers?.host??e?.host),t=a(n?.path??e?.path??n?.pathname),r=a(n?.scheme??e?.scheme);return s&&t?{url:`${r??"http"}://${s}${t}`,schemeKnown:!!r}:{url:t,schemeKnown:!!r}}function k(e,n,o){let s=U(e),t=I(e),r=s?.body??s?.bodyText??s?.payload??s?.data??s?.rawBody,i=t?.body??t?.bodyText??t?.payload??t?.data??t?.rawBody,{url:u,schemeKnown:c}=O(e,s);return l({method:a(s?.method??s?.httpMethod??e?.method??e?.httpMethod),url:u,schemeKnown:c,requestHeaders:s?.headers,requestBody:r,requestContentType:d(s?.headers),responseStatus:p(t?.status??t?.statusCode??e?.status??e?.statusCode),responseHeaders:t?.headers,responseBody:i,responseContentType:d(t?.headers),startedAt:a(e?.startedAt??e?.timestamp??e?.time),raw:e},n,o)}var w=class{id="ndjson";canParse(n,o){let s=R.extname(n).toLowerCase();if(s===".ndjson"||s===".jsonl"||s===".jsonlines")return!0;let t=o.lastIndexOf(`
|
|
8
8
|
`),i=(t===-1?o:o.slice(0,t)).split(`
|
|
9
9
|
`).map(u=>u.trim()).find(Boolean);if(!i?.startsWith("{")||!i.endsWith("}"))return!1;try{return JSON.parse(i),!0}catch{return!1}}async*parse(n){let o=0;for await(let s of h(n)){let t=k(s,o,n);t&&(yield t),o+=1}}};import J from"node:path";function P(e){if(!e)return{};let n=e.trim().split(/\s+/);return n.length<2?{}:{method:n[0],path:n[1],protocol:n[2]}}function W(e,n){let o=a(n?.url??n?.request_uri??n?.uri??e?.url??e?.request_url??e?.absolute_uri),s=P(a(e?.request??n?.request_line)),t=a(n?.request_uri??n?.uri??n?.path??e?.request_uri??e?.uri)??s.path;if(o?.startsWith("http://")||o?.startsWith("https://"))return{url:o};let r=a(n?.host??n?.headers?.host??e?.host??e?.http_host??e?.server_name??e?.vhost),i=a(e?.scheme??n?.scheme??e?.request_scheme),u=!!i;if(r&&(o||t)){let c=i??"http",y=o??t;return y?.startsWith("/")?{url:`${c}://${r}${y}`,schemeKnown:u}:{url:`${c}://${r}/${y}`,schemeKnown:u}}return{url:o??t,schemeKnown:u}}function E(e,n,o){let s=g(e?.request)?e.request:e,t=g(e?.response)?e.response:void 0,r=P(a(e?.request)),i=a(s?.method??s?.request_method??e?.request_method??e?.method)??r.method,{url:u,schemeKnown:c}=W(e,s);return l({method:i,url:u,schemeKnown:c,requestHeaders:s?.headers??s?.request_headers??e?.request_headers??e?.headers,requestBody:s?.body??s?.request_body??e?.request_body??e?.body,requestContentType:d(s?.headers??s?.request_headers??e?.request_headers),responseStatus:p(t?.status??t?.status_code??e?.status??e?.status_code??e?.response_status),responseHeaders:t?.headers??t?.response_headers??e?.response_headers??e?.headers_out,responseBody:t?.body??t?.response_body??e?.response_body,responseContentType:d(t?.headers??t?.response_headers??e?.response_headers),startedAt:a(e?.time_iso8601??e?.timestamp??e?.time??e?.time_local??e?.["@timestamp"]),raw:e},n,o)}async function*j(e){if((await m(e,16)).trim().slice(0,1)==="["){yield*f(e);return}for await(let o of h(e))yield o}var N=class{id="nginx-json";canParse(n,o){let s=J.extname(n).toLowerCase(),t=n.toLowerCase();if(s===".ndjson"&&t.includes("nginx"))return!0;let r=o.toLowerCase();return r.includes('"request_uri"')||r.includes('"time_iso8601"')||r.includes('"upstream_response_time"')||r.includes('"remote_addr"')}async*parse(n){let o=0;for await(let s of j(n)){let t=E(s,o,n);t&&(yield t),o+=1}}},_=class{id="apache-json";canParse(n,o){let s=J.extname(n).toLowerCase(),t=n.toLowerCase();if(s===".ndjson"&&t.includes("apache"))return!0;let r=o.toLowerCase();return r.includes('"request_method"')||r.includes('"request_uri"')||r.includes('"vhost"')||r.includes('"response_status"')}async*parse(n){let o=0;for await(let s of j(n)){let t=E(s,o,n);t&&(yield t),o+=1}}};var B=[new b,new x,new N,new _,new w];async function le(e,n){if(n!=="auto"){let s=B.find(t=>t.id===n);if(!s)throw new Error(`Unsupported parser format: ${n}`);return s}let o=await m(e);return B.find(s=>s.canParse(e,o))}export{le as a};
|
|
@@ -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{b as xe,f as Pe}from"./BAZXW3ZY.js";import{$ as b,A as ue,X as le,Y as he,ba as fe,c as L,ca as de,da as j,f as ie,fa as ye,ga as U,ha as A,ka as k,la as Se,ma as ge,na as Q,oa as K,p as ae,q as pe,qa as Ce,r as ce,ta as be,v as me}from"./AQJ3Q2RW.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";import{performance as mt}from"perf_hooks";var D={thresholds:{maxParamsGood:5,maxDepthGood:4,maxPolymorphismGood:2,maxDependencyDepthGood:3,maxAmbiguousGood:0,maxOperationsForDiscoverability:1e3},weights:{parameterSimplicity:.1,schemaSimplicity:.1,documentationQuality:.18,constraintClarity:.12,exampleCoverage:.18,errorClarity:.12,dependencyClarity:.1,identifierClarity:.05,polymorphismClarity:.05,anyOfPenaltyMultiplier:2,discoverabilityWeight:.1},hotspotLimit:10},Oe=new Set(["id","name","type","value","data","key","status","state","code","result","item","object","resource","entity","input","output","payload","body","content","info"]);function B(e){if(e.length===0)return 0;let r=[...e].sort((o,n)=>o-n),t=Math.floor(r.length/2);return r.length%2!==0?r[t]:(r[t-1]+r[t])/2}function He(e,r,t=D){let{thresholds:o,weights:n}=t,s=x(1-e.parameterCount/(o.maxParamsGood*2)),a=Math.max(e.maxRequestSchemaDepth,e.maxResponseSchemaDepth)/(o.maxDepthGood*2),c=De(e,n.anyOfPenaltyMultiplier)/(o.maxPolymorphismGood*3),h=x(1-a-c),u=(e.operationDescriptionPresent?1:0)+e.paramsWithDescription+e.schemaPropertiesWithDescription,f=1+e.parameterCount+e.totalSchemaProperties,$=f>0?x(u/f):1,O=e.totalSchemaProperties>0?x(e.constraintCount/e.totalSchemaProperties):1,y=(e.requestExamplePresent?1:0)+(e.responseExamplePresent?1:0),g=(e.requestBodyPresent?1:0)+1,M=x(y/g),T=e.totalErrorResponses>0?x(e.structuredErrorResponseCount/e.totalErrorResponses):1,I=x(1-r/(o.maxDependencyDepthGood*2)),l=x(1-e.ambiguousIdentifierCount/Math.max(o.maxAmbiguousGood+3,1)),m=De(e,n.anyOfPenaltyMultiplier),d=m===0?1:e.hasDiscriminator?x(1-m/(o.maxPolymorphismGood*4)):x(1-m/(o.maxPolymorphismGood*2));return{parameterSimplicity:s,schemaSimplicity:h,documentationQuality:$,constraintClarity:O,exampleCoverage:M,errorClarity:T,dependencyClarity:I,identifierClarity:l,polymorphismClarity:d}}function ze(e,r=D){let t=r.weights,o=e.parameterSimplicity*t.parameterSimplicity+e.schemaSimplicity*t.schemaSimplicity+e.documentationQuality*t.documentationQuality+e.constraintClarity*t.constraintClarity+e.exampleCoverage*t.exampleCoverage+e.errorClarity*t.errorClarity+e.dependencyClarity*t.dependencyClarity+e.identifierClarity*t.identifierClarity+e.polymorphismClarity*t.polymorphismClarity;return $e(x(o)*100)}function Re(e,r,t=D){let o=new Map;for(let[n,s]of e.operations){let i=r.get(n)??0,a=He(s,i,t);o.set(n,{agentReadiness:ze(a,t),subscores:a})}return o}function Me(e,r=D){return x(1-e/r.thresholds.maxOperationsForDiscoverability)}function ve(e,r,t=D){if(e.size===0)return{agentReadiness:100};let o=[];for(let i of e.values())o.push(i.agentReadiness);let n=t.weights.discoverabilityWeight,s=r*100;return{agentReadiness:$e(B(o)*(1-n)+s*n)}}function J(e,r,t){return e-r+r*t}function De(e,r){return J(e.polymorphismCount,e.anyOfCount,r)}function x(e){return Math.max(0,Math.min(1,e))}function Ee(e){let r=e.size||1,t={parameterSimplicity:0,schemaSimplicity:0,documentationQuality:0,constraintClarity:0,exampleCoverage:0,errorClarity:0,dependencyClarity:0,identifierClarity:0,polymorphismClarity:0};for(let o of e.values())t.parameterSimplicity+=o.subscores.parameterSimplicity,t.schemaSimplicity+=o.subscores.schemaSimplicity,t.documentationQuality+=o.subscores.documentationQuality,t.constraintClarity+=o.subscores.constraintClarity,t.exampleCoverage+=o.subscores.exampleCoverage,t.errorClarity+=o.subscores.errorClarity,t.dependencyClarity+=o.subscores.dependencyClarity,t.identifierClarity+=o.subscores.identifierClarity,t.polymorphismClarity+=o.subscores.polymorphismClarity;return t.parameterSimplicity/=r,t.schemaSimplicity/=r,t.documentationQuality/=r,t.constraintClarity/=r,t.exampleCoverage/=r,t.errorClarity/=r,t.dependencyClarity/=r,t.identifierClarity/=r,t.polymorphismClarity/=r,t}function $e(e){return Math.round(e*10)/10}function we(e,r,t){let o=Math.max(1,e);return r/o+t/o}function Qe(e,r){return r.totalSchemaProperties>e.totalSchemaProperties?!0:r.totalSchemaProperties<e.totalSchemaProperties?!1:we(r.totalSchemaProperties,r.schemaPropertiesWithDescription,r.constraintCount)>we(e.totalSchemaProperties,e.schemaPropertiesWithDescription,e.constraintCount)}var Ke=["enum","const","format","pattern","minimum","maximum","minLength","maxLength","minItems","maxItems","minProperties","maxProperties","multipleOf","exclusiveMinimum","exclusiveMaximum","uniqueItems"];function Y(){return{depth:-1,maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[],debugEntries:null,pendingRef:null}}function Ie(e){Object.assign(e,Y())}function Le(e){return{ref:{enter(r){typeof r?.$ref=="string"&&(e.refsUsed.push(r.$ref),e.pendingRef=r.$ref)}},Schema:{enter(r,t){e.depth++,e.maxDepth=Math.max(e.maxDepth,e.depth);let o=0;for(let i of Ke)r[i]!==void 0&&(e.constraintCount++,o++);r.discriminator?.propertyName&&(e.hasDiscriminator=!0);let n={};for(let i of["oneOf","anyOf","allOf"]){let a=r[i];Array.isArray(a)&&(e.polymorphismCount+=a.length,i==="anyOf"&&(e.anyOfCount+=a.length),n[i]=a.length)}let s=[];if(L(r.properties)){let i=Object.entries(r.properties);e.totalSchemaProperties+=i.length;for(let[a,c]of i){s.push(a);let h=c&&"$ref"in c&&c.$ref?t.resolve(c)?.node??c:c;h?.description&&e.schemaPropertiesWithDescription++,(h?.example!==void 0||h?.examples)&&(e.hasPropertyExamples=!0),h?.readOnly||e.writableTopLevelFields++}}e.debugEntries!==null&&e.debugEntries.push({ref:e.pendingRef,depth:e.depth,propertyNames:s,polymorphism:Object.keys(n).length>0?n:{},constraintCount:o}),e.pendingRef=null},leave(){e.depth--}}}}function qe(e,r,t){return{operations:new Map,currentPath:"",pathLevelParams:[],current:null,walkSchema:e,anyOfPenaltyMultiplier:r,debugOperationId:t,debugLogs:[]}}function Je(e,r,t){return{path:e,method:r,operationId:t.operationId,operationDescriptionPresent:!!t.description,parameterCount:0,requiredParameterCount:0,paramsWithDescription:0,ambiguousIdentifierCount:0,maxRequestSchemaDepth:0,maxResponseSchemaDepth:0,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,topLevelWritableFieldCount:0,requestBodyPresent:!1,requestExamplePresent:!1,responseExamplePresent:!1,structuredErrorResponseCount:0,totalErrorResponses:0,inRequestBody:!1,inResponse:!1,currentResponseCode:"",errorStructuredCounted:!1,maxEffectivePolymorphism:-1,refsUsed:new Set}}function Ye(e){let{inRequestBody:r,inResponse:t,currentResponseCode:o,errorStructuredCounted:n,maxEffectivePolymorphism:s,...i}=e;return i}function We(e){return{RequestBody:{enter(){e.current&&(e.current.requestBodyPresent=!0,e.current.inRequestBody=!0)},leave(){e.current&&(e.current.inRequestBody=!1)}},Response:{enter(r,t){let o=e.current;if(!o)return;let n=String(t.key);o.inResponse=!0,o.currentResponseCode=n,o.errorStructuredCounted=!1,Te(n)&&(o.totalErrorResponses++,!r.content&&r.description&&(o.structuredErrorResponseCount++,o.errorStructuredCounted=!0))},leave(){e.current&&(e.current.inResponse=!1)}},MediaType:{enter(r){let t=e.current;if(t&&(Ze(r)&&(t.inRequestBody&&(t.requestExamplePresent=!0),t.inResponse&&(t.responseExamplePresent=!0)),t.inResponse&&Te(t.currentResponseCode)&&!t.errorStructuredCounted&&(t.structuredErrorResponseCount++,t.errorStructuredCounted=!0),r.schema)){let o=!!e.debugOperationId&&(t.operationId===e.debugOperationId||`${t.method.toUpperCase()} ${t.path}`===e.debugOperationId),n=e.walkSchema(r.schema,o);Qe(t,n)&&(t.totalSchemaProperties=n.totalSchemaProperties,t.schemaPropertiesWithDescription=n.schemaPropertiesWithDescription,t.constraintCount=n.constraintCount);let s=J(n.polymorphismCount,n.anyOfCount,e.anyOfPenaltyMultiplier);s>t.maxEffectivePolymorphism&&(t.maxEffectivePolymorphism=s,t.polymorphismCount=n.polymorphismCount,t.anyOfCount=n.anyOfCount),n.hasDiscriminator&&(t.hasDiscriminator=!0);for(let i of n.refsUsed)t.refsUsed.add(i);if(n.hasPropertyExamples&&(t.inRequestBody&&(t.requestExamplePresent=!0),t.inResponse&&(t.responseExamplePresent=!0)),t.inRequestBody&&(t.maxRequestSchemaDepth=Math.max(t.maxRequestSchemaDepth,n.maxDepth),t.topLevelWritableFieldCount=Math.max(t.topLevelWritableFieldCount,n.writableTopLevelFields)),t.inResponse&&(t.maxResponseSchemaDepth=Math.max(t.maxResponseSchemaDepth,n.maxDepth)),o&&n.debugEntries){let i=t.inRequestBody?"REQUEST BODY":`RESPONSE ${t.currentResponseCode}`;e.debugLogs.push({context:i,entries:n.debugEntries,totalProperties:n.totalSchemaProperties,totalPolymorphism:n.polymorphismCount,totalConstraints:n.constraintCount,maxDepth:n.maxDepth})}}}},Paths:{PathItem:{enter(r,t){e.currentPath=String(t.key),e.pathLevelParams=r.parameters??[]},Operation:{enter(r,t){let o=String(t.key),n=Je(e.currentPath,o,r);e.current=n;let s=Xe(e.pathLevelParams,r.parameters??[],t.resolve);for(let i of s.values())n.parameterCount++,i.required&&n.requiredParameterCount++,i.description&&n.paramsWithDescription++,et(i)&&n.ambiguousIdentifierCount++},leave(r){let t=e.current;if(!t)return;let o=r.operationId??`${t.method.toUpperCase()} ${t.path}`;e.operations.set(o,Ye(t)),e.current=null}}}}}}function Ue(e){return{operationCount:e.operations.size,operations:e.operations}}function Ae(e,r){return r(e).node}function Xe(e,r,t){let o=new Map;for(let n of e){let s=Ae(n,t);s?.name&&s.in&&o.set(`${s.in}:${s.name}`,s)}for(let n of r){let s=Ae(n,t);s?.name&&s.in&&o.set(`${s.in}:${s.name}`,s)}return o}function Ze(e){return e.example!==void 0||ie(e.examples)}function et(e){if(e.description)return!1;let r=(e.name??"").toLowerCase();return Oe.has(r)}function Te(e){if(e==="default"||/^4xx$/i.test(e)||/^5xx$/i.test(e))return!0;let r=parseInt(e,10);return r>=400&&r<600}function tt(e,r){if(!r.startsWith("#/"))return;let t=e;for(let o of r.slice(2).split("/"))t=t?.[ce(o)];return t}function ke({document:e,types:r,resolvedRefMap:t,ctx:o,debugOperationId:n,scoringConstants:s}){let i=s?.weights.anyOfPenaltyMultiplier??D.weights.anyOfPenaltyMultiplier,a=Y(),c=Le(a),h=Q([{severity:"warn",ruleId:"score-schema",visitor:c}],r),u=(l,m)=>{Ie(a),m&&(a.debugEntries=[]),K({document:{...e,parsed:l},rootType:r.Schema,normalizedVisitors:h,resolvedRefMap:t,ctx:o});let{depth:d,pendingRef:w,debugEntries:_,...N}=a;return{...N,refsUsed:[...a.refsUsed],debugEntries:m?a.debugEntries??void 0:void 0}},f=new Map,$=new WeakSet,O={maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[]};function y(l,m){return{maxDepth:Math.max(l.maxDepth,m.maxDepth),polymorphismCount:l.polymorphismCount+m.polymorphismCount,anyOfCount:l.anyOfCount+m.anyOfCount,hasDiscriminator:l.hasDiscriminator||m.hasDiscriminator,totalSchemaProperties:l.totalSchemaProperties+m.totalSchemaProperties,schemaPropertiesWithDescription:l.schemaPropertiesWithDescription+m.schemaPropertiesWithDescription,constraintCount:l.constraintCount+m.constraintCount,hasPropertyExamples:l.hasPropertyExamples||m.hasPropertyExamples,writableTopLevelFields:l.writableTopLevelFields+m.writableTopLevelFields,refsUsed:[...l.refsUsed,...m.refsUsed],debugEntries:l.debugEntries||m.debugEntries?[...l.debugEntries??[],...m.debugEntries??[]]:void 0}}let g=(l,m=!1)=>{let d=l,w=pe(l)?l.$ref:void 0;if(w){if(!m){let S=f.get(w);if(S)return S}d=tt(e.parsed,w)??l}if(L(d)&&$.has(d))return{...O};L(d)&&$.add(d);let _=d?.oneOf,N=d?.anyOf,Z=Array.isArray(_)&&_.length>1,ee=Array.isArray(N)&&N.length>1,G=Z||ee,te=Array.isArray(d?.allOf)&&d.allOf.length>0,V=d?.discriminator,q=!G&&L(V?.mapping)?Object.values(V.mapping).filter(S=>typeof S=="string"&&me(S)).map(S=>({$ref:S})):null,re=Array.isArray(q)&&q.length>0,C;if(G||te||re){let S={...d},F=null,oe=P=>{F=F?y(F,P):P},ne=(P,v)=>{let E=g(v[0],m);for(let z=1;z<v.length;z++){let se=g(v[z],m);se.totalSchemaProperties>E.totalSchemaProperties&&(E=se)}return{...E,polymorphismCount:E.polymorphismCount+v.length,anyOfCount:E.anyOfCount+(P==="anyOf"?v.length:0),hasDiscriminator:E.hasDiscriminator||!!V}};G&&delete S.discriminator,Z&&(delete S.oneOf,oe(ne("oneOf",_))),ee&&(delete S.anyOf,oe(ne("anyOf",N)));let H=null;if(re){delete S.discriminator;let P=g(q[0],m);for(let v=1;v<q.length;v++){let E=g(q[v],m);E.totalSchemaProperties>P.totalSchemaProperties&&(P=E)}H={...P,polymorphismCount:P.polymorphismCount+q.length,hasDiscriminator:!0}}let W=null;if(te){delete S.allOf,W={...O};for(let P of d.allOf)W=y(W,g(P,m));W.polymorphismCount+=d.allOf.length}C=u(S,m),W&&(C=y(C,W)),F&&(C=y(C,F)),H&&(C=y(C,H)),w&&(C={...C,refsUsed:[w,...C.refsUsed]})}else C=u(l,m);return L(d)&&$.delete(d),w&&!m&&f.set(w,C),C},M=qe(g,i,n),T=We(M),I=Q([{severity:"warn",ruleId:"score",visitor:T}],r);return K({document:e,rootType:r.Root,normalizedVisitors:I,resolvedRefMap:t,ctx:o}),{metrics:Ue(M),debugLogs:M.debugLogs}}function Ne(e){let r=new Map;for(let[n,s]of e)for(let i of s.refsUsed){let a=r.get(i);a||(a=new Set,r.set(i,a)),a.add(n)}let t=new Map;for(let n of e.keys())t.set(n,new Set);for(let n of r.values()){if(n.size<2)continue;let s=Array.from(n);for(let i=0;i<s.length;i++)for(let a=i+1;a<s.length;a++)t.get(s[i]).add(s[a]),t.get(s[a]).add(s[i])}let o=new Map;for(let n of e.keys()){let s=rt(n,t);o.set(n,s)}return o}function rt(e,r){let t=new Set([e]),o=[e],n=0;for(;o.length>0;){let s=[];for(let i of o)for(let a of r.get(i)??[])t.has(a)||(t.add(a),s.push(a));s.length>0&&n++,o=s}return n}function Fe(e){let r={agentReadiness:e.agentReadiness,discoverability:Math.round(e.discoverability*100),subscores:e.subscores,rawMetrics:{operationCount:e.rawMetrics.operationCount,operations:Object.fromEntries(Array.from(e.rawMetrics.operations.entries()).map(([t,o])=>{let{refsUsed:n,...s}=o;return[t,s]}))},operationScores:Object.fromEntries(e.operationScores),dependencyDepths:Object.fromEntries(e.dependencyDepths),hotspots:e.hotspots};k.output(JSON.stringify(r,null,2))}function je(e,r=!1){ot(e),nt(e),it(e),r&&at(e),pt(e)}function _e(e){return e>=80?de:e>=50?j:fe}function Be(e){return _e(e)(b(e.toFixed(1)))}function p(e){k.output(e+`
|
|
7
|
+
import{b as xe,f as Pe}from"./I5KNR2DJ.js";import{$ as b,A as ue,X as le,Y as he,ba as fe,c as L,ca as de,da as j,f as ie,fa as ye,ga as U,ha as A,ka as k,la as Se,ma as ge,na as Q,oa as K,p as ae,q as pe,qa as Ce,r as ce,ta as be,v as me}from"./H5WKHOUJ.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";import{performance as mt}from"perf_hooks";var D={thresholds:{maxParamsGood:5,maxDepthGood:4,maxPolymorphismGood:2,maxDependencyDepthGood:3,maxAmbiguousGood:0,maxOperationsForDiscoverability:1e3},weights:{parameterSimplicity:.1,schemaSimplicity:.1,documentationQuality:.18,constraintClarity:.12,exampleCoverage:.18,errorClarity:.12,dependencyClarity:.1,identifierClarity:.05,polymorphismClarity:.05,anyOfPenaltyMultiplier:2,discoverabilityWeight:.1},hotspotLimit:10},Oe=new Set(["id","name","type","value","data","key","status","state","code","result","item","object","resource","entity","input","output","payload","body","content","info"]);function B(e){if(e.length===0)return 0;let r=[...e].sort((o,n)=>o-n),t=Math.floor(r.length/2);return r.length%2!==0?r[t]:(r[t-1]+r[t])/2}function He(e,r,t=D){let{thresholds:o,weights:n}=t,s=x(1-e.parameterCount/(o.maxParamsGood*2)),a=Math.max(e.maxRequestSchemaDepth,e.maxResponseSchemaDepth)/(o.maxDepthGood*2),c=De(e,n.anyOfPenaltyMultiplier)/(o.maxPolymorphismGood*3),h=x(1-a-c),u=(e.operationDescriptionPresent?1:0)+e.paramsWithDescription+e.schemaPropertiesWithDescription,f=1+e.parameterCount+e.totalSchemaProperties,$=f>0?x(u/f):1,O=e.totalSchemaProperties>0?x(e.constraintCount/e.totalSchemaProperties):1,y=(e.requestExamplePresent?1:0)+(e.responseExamplePresent?1:0),g=(e.requestBodyPresent?1:0)+1,M=x(y/g),T=e.totalErrorResponses>0?x(e.structuredErrorResponseCount/e.totalErrorResponses):1,I=x(1-r/(o.maxDependencyDepthGood*2)),l=x(1-e.ambiguousIdentifierCount/Math.max(o.maxAmbiguousGood+3,1)),m=De(e,n.anyOfPenaltyMultiplier),d=m===0?1:e.hasDiscriminator?x(1-m/(o.maxPolymorphismGood*4)):x(1-m/(o.maxPolymorphismGood*2));return{parameterSimplicity:s,schemaSimplicity:h,documentationQuality:$,constraintClarity:O,exampleCoverage:M,errorClarity:T,dependencyClarity:I,identifierClarity:l,polymorphismClarity:d}}function ze(e,r=D){let t=r.weights,o=e.parameterSimplicity*t.parameterSimplicity+e.schemaSimplicity*t.schemaSimplicity+e.documentationQuality*t.documentationQuality+e.constraintClarity*t.constraintClarity+e.exampleCoverage*t.exampleCoverage+e.errorClarity*t.errorClarity+e.dependencyClarity*t.dependencyClarity+e.identifierClarity*t.identifierClarity+e.polymorphismClarity*t.polymorphismClarity;return $e(x(o)*100)}function Re(e,r,t=D){let o=new Map;for(let[n,s]of e.operations){let i=r.get(n)??0,a=He(s,i,t);o.set(n,{agentReadiness:ze(a,t),subscores:a})}return o}function Me(e,r=D){return x(1-e/r.thresholds.maxOperationsForDiscoverability)}function ve(e,r,t=D){if(e.size===0)return{agentReadiness:100};let o=[];for(let i of e.values())o.push(i.agentReadiness);let n=t.weights.discoverabilityWeight,s=r*100;return{agentReadiness:$e(B(o)*(1-n)+s*n)}}function J(e,r,t){return e-r+r*t}function De(e,r){return J(e.polymorphismCount,e.anyOfCount,r)}function x(e){return Math.max(0,Math.min(1,e))}function Ee(e){let r=e.size||1,t={parameterSimplicity:0,schemaSimplicity:0,documentationQuality:0,constraintClarity:0,exampleCoverage:0,errorClarity:0,dependencyClarity:0,identifierClarity:0,polymorphismClarity:0};for(let o of e.values())t.parameterSimplicity+=o.subscores.parameterSimplicity,t.schemaSimplicity+=o.subscores.schemaSimplicity,t.documentationQuality+=o.subscores.documentationQuality,t.constraintClarity+=o.subscores.constraintClarity,t.exampleCoverage+=o.subscores.exampleCoverage,t.errorClarity+=o.subscores.errorClarity,t.dependencyClarity+=o.subscores.dependencyClarity,t.identifierClarity+=o.subscores.identifierClarity,t.polymorphismClarity+=o.subscores.polymorphismClarity;return t.parameterSimplicity/=r,t.schemaSimplicity/=r,t.documentationQuality/=r,t.constraintClarity/=r,t.exampleCoverage/=r,t.errorClarity/=r,t.dependencyClarity/=r,t.identifierClarity/=r,t.polymorphismClarity/=r,t}function $e(e){return Math.round(e*10)/10}function we(e,r,t){let o=Math.max(1,e);return r/o+t/o}function Qe(e,r){return r.totalSchemaProperties>e.totalSchemaProperties?!0:r.totalSchemaProperties<e.totalSchemaProperties?!1:we(r.totalSchemaProperties,r.schemaPropertiesWithDescription,r.constraintCount)>we(e.totalSchemaProperties,e.schemaPropertiesWithDescription,e.constraintCount)}var Ke=["enum","const","format","pattern","minimum","maximum","minLength","maxLength","minItems","maxItems","minProperties","maxProperties","multipleOf","exclusiveMinimum","exclusiveMaximum","uniqueItems"];function Y(){return{depth:-1,maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[],debugEntries:null,pendingRef:null}}function Ie(e){Object.assign(e,Y())}function Le(e){return{ref:{enter(r){typeof r?.$ref=="string"&&(e.refsUsed.push(r.$ref),e.pendingRef=r.$ref)}},Schema:{enter(r,t){e.depth++,e.maxDepth=Math.max(e.maxDepth,e.depth);let o=0;for(let i of Ke)r[i]!==void 0&&(e.constraintCount++,o++);r.discriminator?.propertyName&&(e.hasDiscriminator=!0);let n={};for(let i of["oneOf","anyOf","allOf"]){let a=r[i];Array.isArray(a)&&(e.polymorphismCount+=a.length,i==="anyOf"&&(e.anyOfCount+=a.length),n[i]=a.length)}let s=[];if(L(r.properties)){let i=Object.entries(r.properties);e.totalSchemaProperties+=i.length;for(let[a,c]of i){s.push(a);let h=c&&"$ref"in c&&c.$ref?t.resolve(c)?.node??c:c;h?.description&&e.schemaPropertiesWithDescription++,(h?.example!==void 0||h?.examples)&&(e.hasPropertyExamples=!0),h?.readOnly||e.writableTopLevelFields++}}e.debugEntries!==null&&e.debugEntries.push({ref:e.pendingRef,depth:e.depth,propertyNames:s,polymorphism:Object.keys(n).length>0?n:{},constraintCount:o}),e.pendingRef=null},leave(){e.depth--}}}}function qe(e,r,t){return{operations:new Map,currentPath:"",pathLevelParams:[],current:null,walkSchema:e,anyOfPenaltyMultiplier:r,debugOperationId:t,debugLogs:[]}}function Je(e,r,t){return{path:e,method:r,operationId:t.operationId,operationDescriptionPresent:!!t.description,parameterCount:0,requiredParameterCount:0,paramsWithDescription:0,ambiguousIdentifierCount:0,maxRequestSchemaDepth:0,maxResponseSchemaDepth:0,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,topLevelWritableFieldCount:0,requestBodyPresent:!1,requestExamplePresent:!1,responseExamplePresent:!1,structuredErrorResponseCount:0,totalErrorResponses:0,inRequestBody:!1,inResponse:!1,currentResponseCode:"",errorStructuredCounted:!1,maxEffectivePolymorphism:-1,refsUsed:new Set}}function Ye(e){let{inRequestBody:r,inResponse:t,currentResponseCode:o,errorStructuredCounted:n,maxEffectivePolymorphism:s,...i}=e;return i}function We(e){return{RequestBody:{enter(){e.current&&(e.current.requestBodyPresent=!0,e.current.inRequestBody=!0)},leave(){e.current&&(e.current.inRequestBody=!1)}},Response:{enter(r,t){let o=e.current;if(!o)return;let n=String(t.key);o.inResponse=!0,o.currentResponseCode=n,o.errorStructuredCounted=!1,Te(n)&&(o.totalErrorResponses++,!r.content&&r.description&&(o.structuredErrorResponseCount++,o.errorStructuredCounted=!0))},leave(){e.current&&(e.current.inResponse=!1)}},MediaType:{enter(r){let t=e.current;if(t&&(Ze(r)&&(t.inRequestBody&&(t.requestExamplePresent=!0),t.inResponse&&(t.responseExamplePresent=!0)),t.inResponse&&Te(t.currentResponseCode)&&!t.errorStructuredCounted&&(t.structuredErrorResponseCount++,t.errorStructuredCounted=!0),r.schema)){let o=!!e.debugOperationId&&(t.operationId===e.debugOperationId||`${t.method.toUpperCase()} ${t.path}`===e.debugOperationId),n=e.walkSchema(r.schema,o);Qe(t,n)&&(t.totalSchemaProperties=n.totalSchemaProperties,t.schemaPropertiesWithDescription=n.schemaPropertiesWithDescription,t.constraintCount=n.constraintCount);let s=J(n.polymorphismCount,n.anyOfCount,e.anyOfPenaltyMultiplier);s>t.maxEffectivePolymorphism&&(t.maxEffectivePolymorphism=s,t.polymorphismCount=n.polymorphismCount,t.anyOfCount=n.anyOfCount),n.hasDiscriminator&&(t.hasDiscriminator=!0);for(let i of n.refsUsed)t.refsUsed.add(i);if(n.hasPropertyExamples&&(t.inRequestBody&&(t.requestExamplePresent=!0),t.inResponse&&(t.responseExamplePresent=!0)),t.inRequestBody&&(t.maxRequestSchemaDepth=Math.max(t.maxRequestSchemaDepth,n.maxDepth),t.topLevelWritableFieldCount=Math.max(t.topLevelWritableFieldCount,n.writableTopLevelFields)),t.inResponse&&(t.maxResponseSchemaDepth=Math.max(t.maxResponseSchemaDepth,n.maxDepth)),o&&n.debugEntries){let i=t.inRequestBody?"REQUEST BODY":`RESPONSE ${t.currentResponseCode}`;e.debugLogs.push({context:i,entries:n.debugEntries,totalProperties:n.totalSchemaProperties,totalPolymorphism:n.polymorphismCount,totalConstraints:n.constraintCount,maxDepth:n.maxDepth})}}}},Paths:{PathItem:{enter(r,t){e.currentPath=String(t.key),e.pathLevelParams=r.parameters??[]},Operation:{enter(r,t){let o=String(t.key),n=Je(e.currentPath,o,r);e.current=n;let s=Xe(e.pathLevelParams,r.parameters??[],t.resolve);for(let i of s.values())n.parameterCount++,i.required&&n.requiredParameterCount++,i.description&&n.paramsWithDescription++,et(i)&&n.ambiguousIdentifierCount++},leave(r){let t=e.current;if(!t)return;let o=r.operationId??`${t.method.toUpperCase()} ${t.path}`;e.operations.set(o,Ye(t)),e.current=null}}}}}}function Ue(e){return{operationCount:e.operations.size,operations:e.operations}}function Ae(e,r){return r(e).node}function Xe(e,r,t){let o=new Map;for(let n of e){let s=Ae(n,t);s?.name&&s.in&&o.set(`${s.in}:${s.name}`,s)}for(let n of r){let s=Ae(n,t);s?.name&&s.in&&o.set(`${s.in}:${s.name}`,s)}return o}function Ze(e){return e.example!==void 0||ie(e.examples)}function et(e){if(e.description)return!1;let r=(e.name??"").toLowerCase();return Oe.has(r)}function Te(e){if(e==="default"||/^4xx$/i.test(e)||/^5xx$/i.test(e))return!0;let r=parseInt(e,10);return r>=400&&r<600}function tt(e,r){if(!r.startsWith("#/"))return;let t=e;for(let o of r.slice(2).split("/"))t=t?.[ce(o)];return t}function ke({document:e,types:r,resolvedRefMap:t,ctx:o,debugOperationId:n,scoringConstants:s}){let i=s?.weights.anyOfPenaltyMultiplier??D.weights.anyOfPenaltyMultiplier,a=Y(),c=Le(a),h=Q([{severity:"warn",ruleId:"score-schema",visitor:c}],r),u=(l,m)=>{Ie(a),m&&(a.debugEntries=[]),K({document:{...e,parsed:l},rootType:r.Schema,normalizedVisitors:h,resolvedRefMap:t,ctx:o});let{depth:d,pendingRef:w,debugEntries:_,...N}=a;return{...N,refsUsed:[...a.refsUsed],debugEntries:m?a.debugEntries??void 0:void 0}},f=new Map,$=new WeakSet,O={maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[]};function y(l,m){return{maxDepth:Math.max(l.maxDepth,m.maxDepth),polymorphismCount:l.polymorphismCount+m.polymorphismCount,anyOfCount:l.anyOfCount+m.anyOfCount,hasDiscriminator:l.hasDiscriminator||m.hasDiscriminator,totalSchemaProperties:l.totalSchemaProperties+m.totalSchemaProperties,schemaPropertiesWithDescription:l.schemaPropertiesWithDescription+m.schemaPropertiesWithDescription,constraintCount:l.constraintCount+m.constraintCount,hasPropertyExamples:l.hasPropertyExamples||m.hasPropertyExamples,writableTopLevelFields:l.writableTopLevelFields+m.writableTopLevelFields,refsUsed:[...l.refsUsed,...m.refsUsed],debugEntries:l.debugEntries||m.debugEntries?[...l.debugEntries??[],...m.debugEntries??[]]:void 0}}let g=(l,m=!1)=>{let d=l,w=pe(l)?l.$ref:void 0;if(w){if(!m){let S=f.get(w);if(S)return S}d=tt(e.parsed,w)??l}if(L(d)&&$.has(d))return{...O};L(d)&&$.add(d);let _=d?.oneOf,N=d?.anyOf,Z=Array.isArray(_)&&_.length>1,ee=Array.isArray(N)&&N.length>1,G=Z||ee,te=Array.isArray(d?.allOf)&&d.allOf.length>0,V=d?.discriminator,q=!G&&L(V?.mapping)?Object.values(V.mapping).filter(S=>typeof S=="string"&&me(S)).map(S=>({$ref:S})):null,re=Array.isArray(q)&&q.length>0,C;if(G||te||re){let S={...d},F=null,oe=P=>{F=F?y(F,P):P},ne=(P,v)=>{let E=g(v[0],m);for(let z=1;z<v.length;z++){let se=g(v[z],m);se.totalSchemaProperties>E.totalSchemaProperties&&(E=se)}return{...E,polymorphismCount:E.polymorphismCount+v.length,anyOfCount:E.anyOfCount+(P==="anyOf"?v.length:0),hasDiscriminator:E.hasDiscriminator||!!V}};G&&delete S.discriminator,Z&&(delete S.oneOf,oe(ne("oneOf",_))),ee&&(delete S.anyOf,oe(ne("anyOf",N)));let H=null;if(re){delete S.discriminator;let P=g(q[0],m);for(let v=1;v<q.length;v++){let E=g(q[v],m);E.totalSchemaProperties>P.totalSchemaProperties&&(P=E)}H={...P,polymorphismCount:P.polymorphismCount+q.length,hasDiscriminator:!0}}let W=null;if(te){delete S.allOf,W={...O};for(let P of d.allOf)W=y(W,g(P,m));W.polymorphismCount+=d.allOf.length}C=u(S,m),W&&(C=y(C,W)),F&&(C=y(C,F)),H&&(C=y(C,H)),w&&(C={...C,refsUsed:[w,...C.refsUsed]})}else C=u(l,m);return L(d)&&$.delete(d),w&&!m&&f.set(w,C),C},M=qe(g,i,n),T=We(M),I=Q([{severity:"warn",ruleId:"score",visitor:T}],r);return K({document:e,rootType:r.Root,normalizedVisitors:I,resolvedRefMap:t,ctx:o}),{metrics:Ue(M),debugLogs:M.debugLogs}}function Ne(e){let r=new Map;for(let[n,s]of e)for(let i of s.refsUsed){let a=r.get(i);a||(a=new Set,r.set(i,a)),a.add(n)}let t=new Map;for(let n of e.keys())t.set(n,new Set);for(let n of r.values()){if(n.size<2)continue;let s=Array.from(n);for(let i=0;i<s.length;i++)for(let a=i+1;a<s.length;a++)t.get(s[i]).add(s[a]),t.get(s[a]).add(s[i])}let o=new Map;for(let n of e.keys()){let s=rt(n,t);o.set(n,s)}return o}function rt(e,r){let t=new Set([e]),o=[e],n=0;for(;o.length>0;){let s=[];for(let i of o)for(let a of r.get(i)??[])t.has(a)||(t.add(a),s.push(a));s.length>0&&n++,o=s}return n}function Fe(e){let r={agentReadiness:e.agentReadiness,discoverability:Math.round(e.discoverability*100),subscores:e.subscores,rawMetrics:{operationCount:e.rawMetrics.operationCount,operations:Object.fromEntries(Array.from(e.rawMetrics.operations.entries()).map(([t,o])=>{let{refsUsed:n,...s}=o;return[t,s]}))},operationScores:Object.fromEntries(e.operationScores),dependencyDepths:Object.fromEntries(e.dependencyDepths),hotspots:e.hotspots};k.output(JSON.stringify(r,null,2))}function je(e,r=!1){ot(e),nt(e),it(e),r&&at(e),pt(e)}function _e(e){return e>=80?de:e>=50?j:fe}function Be(e){return _e(e)(b(e.toFixed(1)))}function p(e){k.output(e+`
|
|
8
8
|
`)}function ot(e){p(""),p(b(A(" Scores"))),p(""),p(` Agent Readiness: ${Be(e.agentReadiness)}/100`),p("")}function nt(e){p(b(A(" Subscores"))),p("");let r=e.subscores;R("Parameter Simplicity",r.parameterSimplicity),R("Schema Simplicity",r.schemaSimplicity),R("Documentation Quality",r.documentationQuality),R("Constraint Clarity",r.constraintClarity),R("Example Coverage",r.exampleCoverage),R("Error Clarity",r.errorClarity),R("Dependency Clarity",r.dependencyClarity),R("Identifier Clarity",r.identifierClarity),R("Polymorphism Clarity",r.polymorphismClarity),R("Discoverability",e.discoverability),p("")}function R(e,r){let t=Math.round(r*100),o=st(r);p(` ${e.padEnd(24)} ${o} ${_e(t)(t+"%")}`)}function st(e){let t=Math.round(e*20);return U("["+"\u2588".repeat(t)+"\u2591".repeat(20-t)+"]")}function it(e){if(p(b(A(" Raw Metrics Summary"))),p(""),p(` Total operations: ${e.rawMetrics.operationCount}`),e.rawMetrics.operationCount===0){p("");return}let r=[],t=[],o=[],n=[],s=0,i=0,a=0;for(let u of e.rawMetrics.operations.values())r.push(u.parameterCount),t.push(Math.max(u.maxRequestSchemaDepth,u.maxResponseSchemaDepth)),o.push(u.polymorphismCount),n.push(u.totalSchemaProperties),u.requestExamplePresent&&s++,u.responseExamplePresent&&i++,u.operationDescriptionPresent&&a++;let c=e.rawMetrics.operationCount;function h(u,f){let O=(f.reduce((T,I)=>T+I,0)/c).toFixed(1),y=B(f).toFixed(1),g=Math.min(...f),M=Math.max(...f);p(` ${u.padEnd(26)} avg ${O.padStart(6)} median ${y.padStart(6)} min ${String(g).padStart(5)} max ${String(M).padStart(5)}`)}h("Parameters/operation:",r),h("Schema depth:",t),h("Polymorphism/operation:",o),h("Properties/operation:",n),p(` Operations with request examples: ${s}/${c} (${X(s,c)})`),p(` Operations with response examples: ${i}/${c} (${X(i,c)})`),p(` Operations with description: ${a}/${c} (${X(a,c)})`),p("")}function X(e,r){return r>0?`${Math.round(e/r*100)}%`:"N/A"}function at(e){p(b(A(" Per-Operation Metrics"))),p("");let r=" "+"Operation".padEnd(50)+"Props".padStart(7)+"Poly".padStart(7)+"Depth".padStart(7)+"Params".padStart(8)+"Constr".padStart(8);p(U(r)),p(U(" "+"\u2500".repeat(r.length-2)));let t=[...e.rawMetrics.operations.entries()].sort(([,o],[,n])=>n.totalSchemaProperties-o.totalSchemaProperties);for(let[,o]of t){let n=(o.operationId??`${o.method.toUpperCase()} ${o.path}`).slice(0,48),s=Math.max(o.maxRequestSchemaDepth,o.maxResponseSchemaDepth),i=" "+n.padEnd(50)+String(o.totalSchemaProperties).padStart(7)+String(o.polymorphismCount).padStart(7)+String(s).padStart(7)+String(o.parameterCount).padStart(8)+String(o.constraintCount).padStart(8);p(i)}p("")}function Ge(e,r){if(p(""),p(b(A(` Debug: ${e} schema breakdown`))),p(""),r.length===0){p(j(` No schemas found for operation "${e}".`)),p(j(' Make sure the value matches an operationId or "METHOD /path" exactly.')),p("");return}for(let t of r){p(b(U(` ${t.context}`))),p(U(" "+"\u2500".repeat(70)));let o=new Map;for(let s of t.entries){let i=s.ref??`(inline depth ${s.depth})`,a=o.get(i);if(a){a.count++,a.totalProps+=s.propertyNames.length;for(let c of s.propertyNames)a.propNames.includes(c)||a.propNames.push(c)}else o.set(i,{count:1,totalProps:s.propertyNames.length,propNames:[...s.propertyNames]})}for(let s of t.entries){let i=s.ref??"(inline)",a=" ".repeat(Math.min(s.depth,6)),c=s.propertyNames.length,h=` ${a}${i}`;c>0&&(h+=` (${c} properties)`);let u=[];if(s.polymorphism.oneOf&&u.push(`oneOf:${s.polymorphism.oneOf}`),s.polymorphism.anyOf&&u.push(`anyOf:${s.polymorphism.anyOf}`),s.polymorphism.allOf&&u.push(`allOf:${s.polymorphism.allOf}`),u.length>0&&(h+=` [${u.join(", ")}]`),s.constraintCount>0&&(h+=` {${s.constraintCount} constraints}`),p(h),c>0&&c<=20)p(` ${a} properties: ${s.propertyNames.join(", ")}`);else if(c>20){let f=s.propertyNames.slice(0,15).join(", ");p(` ${a} properties: ${f}, ... +${c-15} more`)}}p(""),p(` Totals: ${t.totalProperties} properties, ${t.totalPolymorphism} polymorphism items, ${t.totalConstraints} constraints, max depth ${t.maxDepth}`);let n=[...o.entries()].filter(([,s])=>s.totalProps>0).sort(([,s],[,i])=>i.totalProps-s.totalProps).slice(0,10);if(n.length>0){p(""),p(b(" Top schemas by property count:"));for(let[s,i]of n)p(` ${s}: ${i.totalProps} properties`)}p("")}}function pt(e){if(e.hotspots.length===0){p(b(A(" No hotspot operations found."))),p("");return}p(b(A(` Top ${e.hotspots.length} Hotspot Operations`))),p("");for(let r of e.hotspots){let t=r.operationId?`${r.method.toUpperCase()} ${r.path} (${r.operationId})`:`${r.method.toUpperCase()} ${r.path}`;p(b(` ${t}`)),p(` Agent Readiness: ${Be(r.agentReadinessScore)}`);for(let o of r.reasons)p(j(` - ${o}`));p("")}}function Ve(e,r,t,o=D){let n=[];for(let[s,i]of r){let a=e.operations.get(s);if(!a)continue;let c=ct(a,t.get(s)??0,o);c.length!==0&&n.push({path:a.path,method:a.method,operationId:a.operationId,agentReadinessScore:i.agentReadiness,reasons:c})}return n.sort((s,i)=>s.reasons.length!==i.reasons.length?i.reasons.length-s.reasons.length:s.agentReadinessScore-i.agentReadinessScore),n.slice(0,o.hotspotLimit)}function ct(e,r,t){let{thresholds:o}=t,n=[];e.parameterCount>o.maxParamsGood&&n.push(`High parameter count (${e.parameterCount})`);let s=Math.max(e.maxRequestSchemaDepth,e.maxResponseSchemaDepth);s>o.maxDepthGood&&n.push(`Deep schema nesting (depth ${s})`),e.anyOfCount>0&&!e.hasDiscriminator?n.push(`Polymorphism (anyOf) without discriminator (${e.anyOfCount} anyOf)`):e.polymorphismCount>o.maxPolymorphismGood&&n.push(`High polymorphism count (${e.polymorphismCount})`);let i=e.requestBodyPresent&&!e.requestExamplePresent,a=!e.responseExamplePresent;return i&&a?n.push("Missing request and response examples"):i?n.push("Missing request body examples"):a&&n.push("Missing response examples"),e.totalErrorResponses>0&&e.structuredErrorResponseCount===0&&n.push("No structured error responses (4xx/5xx)"),e.operationDescriptionPresent||n.push("Missing operation description"),e.parameterCount>0&&e.paramsWithDescription===0&&n.push("No parameter descriptions"),r>o.maxDependencyDepthGood&&n.push(`High dependency depth (${r})`),e.ambiguousIdentifierCount>o.maxAmbiguousGood&&n.push(`Ambiguous identifiers (${e.ambiguousIdentifierCount})`),n}async function Vt({argv:e,config:r,collectSpecData:t}){let[{path:o}]=await xe(e.api?[e.api]:[],r),n=new le(r.resolve),{bundle:s}=await be({config:r,ref:o});t?.(s);let i=ge(s.parsed);if(Se(i)!=="oas3")throw new Ce(`The score command currently supports only OpenAPI 3.x. Detected: ${i}`);let a=mt.now(),c=ae(r.extendTypes(ue(i),i),r),h=await he({rootDocument:s,rootType:c.Root,externalRefResolver:n}),u=e["debug-operation-id"],{metrics:f,debugLogs:$}=ke({document:s,types:c,resolvedRefMap:h,ctx:{problems:[],specVersion:i,config:r,visitorsData:{}},debugOperationId:u}),O=Ne(f.operations),y=Re(f,O),g=Me(f.operationCount),{agentReadiness:M}=ve(y,g),T=Ve(f,y,O),I={agentReadiness:M,discoverability:g,subscores:Ee(y),rawMetrics:f,hotspots:T,operationScores:y,dependencyDepths:O};ut(I,o,a,e.format,!!e["operation-details"],u?{operationId:u,logs:$}:void 0)}function ut(e,r,t,o,n,s){k.info(`Document: ${ye(r)} score:
|
|
9
9
|
`),o==="json"?Fe(e):je(e,n),s&&Ge(s.operationId,s.logs),Pe("score",t,r)}export{Vt as handleScore};
|
|
@@ -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 fe}from"./BJ6Z66KZ.js";import{b as B,f as U,v as m}from"./
|
|
7
|
+
import{a as fe}from"./BJ6Z66KZ.js";import{b as B,f as U,v as m}from"./I5KNR2DJ.js";import{$ as S,Ea as I,Fa as G,X as M,ba as V,ca as w,ea as _,ia as y,k as F,ka as l,qa as R,ra as q,t as T,w as g,wa as H,x as k,xa as A,y as x,ya as C,z as b}from"./H5WKHOUJ.js";import"./6RTITFQA.js";import{e as ae}from"./RFWIIJFG.js";import{writeFileSync as ye}from"node:fs";var P=ae(fe(),1);function E(e){let o=P.default.parse(e);return o?`${o.major}.${o.minor}.${o.patch}`:void 0}function Y(e,o){return P.default.major(e)===0&&o==="major"?"minor":o}function J(e,o){let n=E(e);return!n||o===void 0?n:P.default.inc(n,Y(n,o))}function Q(e){let{required:o}=e;if(o===void 0)return;let n=E(e.base),i=E(e.revision);if(!n||!i)return"\u274C info.version is not a semver string, so --check-version cannot compare it.";let r=Y(n,o),t=J(n,o);return P.default.gte(i,t)?void 0:`\u274C info.version ${n===i?`stayed ${n}`:`went ${n} \u2192 ${i}`}, but these changes require a ${r} bump (${t})${r===o?"":" while below 1.0"}.`}function W(e,o){if(o==="none")return;let n=[...x].reverse().filter(t=>b(t)>=b(o)&&e[t]>0);if(!n.length)return;let i=n.reduce((t,s)=>t+e[s],0);return`\u274C Diff failed with ${n.map(t=>`${e[t]} ${t}`).join(" and ")} ${F("change",i)}.`}var pe={major:"error"};function K(e){let o=e.changes.flatMap(n=>n.verdicts.flatMap(({ruleId:i,impact:r,message:t,location:s})=>{let a=pe[r];return a?[{message:t,ruleId:i,severity:a,location:[s],suggest:[]}]:[]}));C(o,{format:"github-actions",totals:A(o),maxProblems:o.length})}function $(e){let{start:o}=H(e);return{file:m(e.source.absoluteRef),line:o.line,col:o.col}}function Z(e){let{file:o,line:n,col:i}=$(e);return{file:o,pointer:e.pointer,line:n,col:i}}function X({location:e,value:o}){return{...Z(e),value:o}}function N(e){return{path:e.path,typeName:g(e.node),kind:e.kind,impact:e.impact,verdicts:e.verdicts.map(({location:o,...n})=>({...n,location:Z(o)})),property:e.kind==="modified"?e.property:void 0,base:"base"in e?X(e.base):void 0,revision:"revision"in e?X(e.revision):void 0}}function ee(e){let o={reportVersion:"1",files:{base:m(e.files.base),revision:m(e.files.revision)},specVersions:e.specVersions,infoVersions:e.infoVersions,summary:e.summary,bump:e.bump,changes:e.changes.map(N)};return JSON.stringify(o,null,2)}var L={oas2:"OpenAPI 2.0",oas3_0:"OpenAPI 3.0",oas3_1:"OpenAPI 3.1",oas3_2:"OpenAPI 3.2",async2:"AsyncAPI 2",async3:"AsyncAPI 3",arazzo1:"Arazzo 1.0",arazzo1_1:"Arazzo 1.1",overlay1:"Overlay 1",openrpc1:"OpenRPC 1",graphql:"GraphQL"};function c(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function me(e){let o=e.kind==="modified"?`${e.path} \xB7 ${e.property}`:e.path,{base:n,revision:i}=N(e);return`
|
|
8
8
|
<details class="change ${e.impact}">
|
|
9
9
|
<summary>
|
|
10
10
|
<span class="badge">${c(e.impact)}</span>
|
|
@@ -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 $,b as y,c as I}from"./
|
|
7
|
+
import{a as $,b as y,c as I}from"./F252KRDN.js";import{e as P}from"./I5KNR2DJ.js";import{Ba as x,ka as h}from"./H5WKHOUJ.js";function F(t){let e=t.trim(),n=e.match(/^```(?:ya?ml|json)?\s*\n([\s\S]*?)\n```$/);return n?n[1]:e}async function M(t,e){let r=(await x({source:t,config:e})).filter(o=>o.severity==="error");if(r.length>0){let o=r.slice(0,5).map(s=>`${s.ruleId}: ${s.message}`).join("; ");throw new Error(`the result has ${r.length} validation problem(s): ${o}`)}}import{spawn as v}from"node:child_process";import{mkdtemp as R}from"node:fs/promises";import{tmpdir as S}from"node:os";import L from"node:path";var E=3e5,m=class extends Error{},C;function A(){return C??=R(L.join(S(),"redocly-ai-")),C}async function w(t,e,n,r){let o=await A();return new Promise((s,u)=>{let i=v(t,e,{stdio:["pipe","pipe","pipe"],cwd:o,env:{...process.env,...r}}),l="",f="",g=!1,d=setTimeout(()=>{g=!0,i.kill("SIGKILL")},E);i.stdout.on("data",c=>{l+=c.toString()}),i.stderr.on("data",c=>{f+=c.toString()}),i.on("error",c=>{if(clearTimeout(d),c.code==="ENOENT"){u(new m(`Could not find the "${t}" CLI on PATH. Is it installed?`));return}u(c)}),i.on("close",c=>{if(clearTimeout(d),g){u(new Error(`The "${t}" CLI did not respond within ${E/1e3} seconds.`));return}s({stdout:l,stderr:f,code:c})}),i.stdin.on("error",()=>{}),i.stdin.end(n)})}async function b(t){let e=["-p","--output-format","text","--tools","","--strict-mcp-config","--setting-sources","","--no-session-persistence","--append-system-prompt",t.system];t.model&&e.push("--model",t.model);let{stdout:n,stderr:r,code:o}=await w("claude",e,t.user,{CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:"1"});if(o!==0)throw new Error(`claude CLI exited with code ${o}: ${r.trim()||n.trim()}`);if(!n.trim())throw new Error("claude CLI returned no output.");return{text:n}}async function _(t){let e=["exec","--skip-git-repo-check","--sandbox","read-only","-c","mcp_servers={}","-c","project_doc_max_bytes=0"];t.model&&e.push("--model",t.model),e.push("-");let n=`${t.system}
|
|
8
8
|
|
|
9
9
|
${t.user}`,{stdout:r,stderr:o,code:s}=await w("codex",e,n);if(s!==0)throw new Error(`codex CLI exited with code ${s}: ${o.trim()||r.trim()}`);if(!r.trim())throw new Error("codex CLI returned no output.");return{text:r}}async function k(t){let e=["-p","--output-format","text","--trust"];t.model&&e.push("--model",t.model);let n=`${t.system}
|
|
10
10
|
|
|
@@ -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 B,e as U,g as K,h as O,k as V}from"./
|
|
7
|
+
import{a as B,e as U,g as K,h as O,k as V}from"./PDGJV622.js";import{g as F,i as L,m as q,o as J}from"./VDE7RR5C.js";import{c as g}from"./H5WKHOUJ.js";import{join as he}from"node:path";var j=class{code;constructor(n){this.code=n}};function Y(e,n,r={}){let t=new Map(n.map(o=>[o.name,o.schema])),s=b(e,t,new Set,r.dateType??"string");return s===x?null:s}var x=Symbol("cycle");function Z(e,n){if(e.kind==="union"){for(let t of e.members){let s=Z(t,n);if(s)return s}return}if(e.kind!=="scalar")return;let r=e.metadata?.format;if(r==="binary")return new j("new Blob([])");if(n==="Date"){if(r==="date-time")return new j('new Date("2024-01-01T00:00:00Z")');if(r==="date")return new j('new Date("2024-01-01")')}}function C(e,n){let r=new Map,t=[],s=!1;for(let o of e){if(o.kind==="unknown")continue;let a=ne(o,n);if(a?.kind!=="object"){t.push(o);continue}s=!0;for(let i of a.properties){let u=H(i.schema,n,new Set),c=r.get(i.name);(c===void 0||u>=c.rank)&&r.set(i.name,{schema:i.schema,required:i.required||(c?.required??!1),writeOnly:i.writeOnly===!0||(c?.writeOnly??!1),rank:u})}}return s?{merged:{kind:"object",properties:[...r.entries()].map(([o,a])=>({name:o,schema:a.schema,required:a.required,...a.writeOnly?{writeOnly:!0}:{}}))},rest:t}:{merged:void 0,rest:t}}function ne(e,n){let r=new Set,t=e;for(;t?.kind==="ref";){if(r.has(t.name))return;r.add(t.name),t=n.get(t.name)}return t}function H(e,n,r){switch(e.kind){case"literal":return 40;case"enum":return e.values.length===1?40:30;case"union":return Math.max(0,...e.members.map(t=>H(t,n,r)))-1;case"ref":{if(r.has(e.name))return 20;let t=n.get(e.name);return t===void 0?20:H(t,n,new Set(r).add(e.name))}case"null":case"unknown":return 10;default:return 20}}function b(e,n,r,t){let s=Z(e,t);if(s)return s;let o=e.metadata,a=i=>{if(i===null)return e.kind==="null"||e.kind==="union"&&e.members.some(u=>u.kind==="null");if(e.kind==="enum")return e.values.includes(i);if(e.kind==="literal")return i===e.value;if(e.kind==="scalar"&&(e.scalar==="integer"||e.scalar==="number")&&typeof i=="number"){let{min:u,max:c,step:d}=E(e.scalar,o);return(d===void 0||Number.isInteger(Number((i/d).toPrecision(12))))&&(u===void 0||i>=u)&&(c===void 0||i<=c)}return!0};if(o?.example!==void 0&&a(o.example))return o.example;if(o?.default!==void 0&&a(o.default))return o.default;switch(e.kind){case"scalar":return te(e.scalar,o);case"array":{let i=b(e.items,n,r,t);return i===x?[]:[i]}case"object":return Object.fromEntries(e.properties.flatMap(i=>{if(A(i))return[];let u=b(i.schema,n,r,t);return u===x?i.required?[[i.name,null]]:[]:[[i.name,u]]}));case"record":{let i=b(e.value,n,r,t);return i===x?{}:{key:i}}case"enum":return e.values[0];case"literal":return e.value;case"union":{for(let i of e.members){let u=b(i,n,r,t);if(u!==x)return u}return e.members.length>0?x:null}case"intersection":{let{merged:i,rest:u}=C(e.members,n),c=u.map(m=>b(m,n,r,t)).filter(m=>m!==x);if(i){let m=b(i,n,r,t),y=g(m)?m:{};for(let k of c)g(k)&&Object.assign(y,k);return y}let d=c.filter(g);return d.length>0?d.reduce((m,y)=>Object.assign(m,y),{}):c.length>0?c[0]:{}}case"omit":{let i=n.get(e.base);if(!i)return null;let u=b(i,n,r,t);if(g(u)){let c={...u};for(let d of e.keys)delete c[d];return c}return u}case"ref":{if(r.has(e.name))return x;let i=n.get(e.name);if(!i)return null;r.add(e.name);let u=b(i,n,r,t);return r.delete(e.name),u}case"null":case"unknown":return null}}function A(e){return e.writeOnly===!0&&!e.required}function E(e,n){let r=n?.multipleOf??(e==="integer"?1:void 0),t=(u,c,d)=>Number((d(u/c)*c).toPrecision(15)),s=[],o=[];if(n?.minimum!==void 0){let u=n.minimum;s.push(r===void 0?u:t(u,r,Math.ceil))}if(n?.exclusiveMinimum!==void 0){let u=n.exclusiveMinimum;s.push(r===void 0?u+1:t(u,r,c=>Math.floor(c)+1))}if(n?.maximum!==void 0){let u=n.maximum;o.push(r===void 0?u:t(u,r,Math.floor))}if(n?.exclusiveMaximum!==void 0){let u=n.exclusiveMaximum;o.push(r===void 0?u-1:t(u,r,c=>Math.ceil(c)-1))}let a=s.length>0?Math.max(...s):void 0,i=o.length>0?Math.min(...o):void 0;if(r===void 0&&a!==void 0&&i!==void 0&&a>i){let u=Math.max(n?.minimum??-1/0,n?.exclusiveMinimum??-1/0),c=Math.min(n?.maximum??1/0,n?.exclusiveMaximum??1/0),d=(u+c)/2;return{min:d,max:d}}return{min:a,max:i,step:r}}function re(e,n){let{min:r,max:t}=E(e,n);return r!==void 0&&r>0?r:t!==void 0&&t<0?t:0}function te(e,n){if(e==="boolean")return!0;if(e==="integer"||e==="number")return re(e,n);switch(n?.format){case"email":return"user@example.com";case"uuid":return"00000000-0000-4000-8000-000000000000";case"date-time":return"2024-01-01T00:00:00Z";case"date":return"2024-01-01";case"uri":case"url":return"https://example.com";default:return"string"}}var f=e=>({kind:"expr",text:e}),p=e=>({kind:"object",entries:e});function l(e){return e.kind==="object"}function P(e,n){return l(e)?p([...e.entries,{spread:n}]):e}var G=" ";function w(e,n){switch(e.kind){case"expr":return e.text;case"wrap":return`${e.before}${w(e.value,n)}${e.after}`;case"array":{if(e.items.length===0)return"[]";let r=n+G;return`[
|
|
8
8
|
${e.items.map((s,o)=>`${r}${w(s,r)}${o===e.items.length-1?"":","}`).join(`
|
|
9
9
|
`)}
|
|
10
10
|
${n}]`}case"object":{if(e.entries.length===0)return"{}";let r=n+G;return`{
|
|
@@ -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{Aa as Vi,M as _i,c as le,k as un,m as ga,pa as Ki,ta as jr,u as $i,va as ji,xa as Ji,ya as zi}from"./
|
|
7
|
+
import{Aa as Vi,M as _i,c as le,k as un,m as ga,pa as Ki,ta as jr,u as $i,va as ji,xa as Ji,ya as zi}from"./H5WKHOUJ.js";import{a as Pa,c as we,e as Le}from"./RFWIIJFG.js";var uo=we((hy,lo)=>{var Fc=Object.prototype.hasOwnProperty,$c=Object.prototype.toString;lo.exports=function(a,r,t){if($c.call(r)!=="[object Function]")throw new TypeError("iterator must be a function");var n=a.length;if(n===+n)for(var i=0;i<n;i++)r.call(t,a[i],i,a);else for(var s in a)Fc.call(a,s)&&r.call(t,a[s],s,a)}});var Ur=we((my,co)=>{"use strict";var _c=uo();co.exports=ve;function ve(e,a,r){if(arguments.length===3)return ve.set(e,a,r);if(arguments.length===2)return ve.get(e,a);var t=ve.bind(ve,e);for(var n in ve)ve.hasOwnProperty(n)&&(t[n]=ve[n].bind(t,e));return t}ve.get=function(a,r){for(var t=Array.isArray(r)?r:ve.parse(r),n=0;n<t.length;++n){var i=t[n];if(!(typeof a=="object"&&i in a))throw new Error("Invalid reference token: "+i);a=a[i]}return a};ve.set=function(a,r,t){var n=Array.isArray(r)?r:ve.parse(r),i=n[0];if(n.length===0)throw Error("Can not set the root object");for(var s=0;s<n.length-1;++s){var u=n[s];typeof u!="string"&&typeof u!="number"&&(u=String(u)),!(u==="__proto__"||u==="constructor"||u==="prototype")&&(u==="-"&&Array.isArray(a)&&(u=a.length),i=n[s+1],u in a||(i.match(/^(\d+|-)$/)?a[u]=[]:a[u]={}),a=a[u])}return i==="-"&&Array.isArray(a)&&(i=a.length),a[i]=t,this};ve.remove=function(e,a){var r=Array.isArray(a)?a:ve.parse(a),t=r[r.length-1];if(t===void 0)throw new Error('Invalid JSON pointer for remove: "'+a+'"');var n=ve.get(e,r.slice(0,-1));if(Array.isArray(n)){var i=+t;if(t===""&&isNaN(i))throw new Error('Invalid array index: "'+t+'"');Array.prototype.splice.call(n,i,1)}else delete n[t]};ve.dict=function(a,r){var t={};return ve.walk(a,function(n,i){t[i]=n},r),t};ve.walk=function(a,r,t){var n=[];t=t||function(i){var s=Object.prototype.toString.call(i);return s==="[object Object]"||s==="[object Array]"},(function i(s){_c(s,function(u,h){n.push(String(h)),t(u)?i(u):r(u,ve.compile(n)),n.pop()})})(a)};ve.has=function(a,r){try{ve.get(a,r)}catch{return!1}return!0};ve.escape=function(a){return a.toString().replace(/~/g,"~0").replace(/\//g,"~1")};ve.unescape=function(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")};ve.parse=function(a){if(a==="")return[];if(a.charAt(0)!=="/")throw new Error("Invalid JSON pointer: "+a);return a.substring(1).split(/\//).map(ve.unescape)};ve.compile=function(a){return a.length===0?"":"/"+a.map(ve.escape).join("/")}});var Oo=we((No,bn)=>{(function(e){if(typeof No=="object"&&typeof bn<"u")bn.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var a;typeof window<"u"?a=window:typeof global<"u"?a=global:typeof self<"u"?a=self:a=this,a.OpenAPISampler=e()}})(function(){var e,a,r;return(function(){function t(n,i,s){function u(g,k){if(!i[g]){if(!n[g]){var B=typeof Pa=="function"&&Pa;if(!k&&B)return B(g,!0);if(h)return h(g,!0);var P=new Error("Cannot find module '"+g+"'");throw P.code="MODULE_NOT_FOUND",P}var C=i[g]={exports:{}};n[g][0].call(C.exports,function(A){var T=n[g][1][A];return u(T||A)},C,C.exports,t,n,i,s)}return i[g].exports}for(var h=typeof Pa=="function"&&Pa,m=0;m<s.length;m++)u(s[m]);return u}return t})()({1:[function(t,n,i){(()=>{"use strict";var s={d:(d,o)=>{for(var c in o)s.o(o,c)&&!s.o(d,c)&&Object.defineProperty(d,c,{enumerable:!0,get:o[c]})},o:(d,o)=>Object.prototype.hasOwnProperty.call(d,o),r:d=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(d,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(d,"__esModule",{value:!0})}},u={};s.r(u),s.d(u,{XMLBuilder:()=>Xt,XMLParser:()=>Ut,XMLValidator:()=>Qt});let h=":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",m=new RegExp("^["+h+"]["+h+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function g(d,o){let c=[],l=o.exec(d);for(;l;){let f=[];f.startIndex=o.lastIndex-l[0].length;let b=l.length;for(let D=0;D<b;D++)f.push(l[D]);c.push(f),l=o.exec(d)}return c}let k=function(d){return m.exec(d)!=null},B=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],P=["__proto__","constructor","prototype"],C={allowBooleanAttributes:!1,unpairedTags:[]};function A(d,o){o=Object.assign({},C,o);let c=[],l=!1,f=!1;d[0]==="\uFEFF"&&(d=d.substr(1));for(let b=0;b<d.length;b++)if(d[b]==="<"&&d[b+1]==="?"){if(b+=2,b=S(d,b),b.err)return b}else{if(d[b]!=="<"){if(T(d[b]))continue;return L("InvalidChar","char '"+d[b]+"' is not expected.",H(d,b))}{let D=b;if(b++,d[b]==="!"){b=w(d,b);continue}{let v=!1;d[b]==="/"&&(v=!0,b++);let I="";for(;b<d.length&&d[b]!==">"&&d[b]!==" "&&d[b]!==" "&&d[b]!==`
|
|
8
8
|
`&&d[b]!=="\r";b++)I+=d[b];if(I=I.trim(),I[I.length-1]==="/"&&(I=I.substring(0,I.length-1),b--),!O(I)){let V;return V=I.trim().length===0?"Invalid space after '<'.":"Tag '"+I+"' is an invalid name.",L("InvalidTag",V,H(d,b))}let N=F(d,b);if(N===!1)return L("InvalidAttr","Attributes for '"+I+"' have open quote.",H(d,b));let G=N.value;if(b=N.index,G[G.length-1]==="/"){let V=b-G.length;G=G.substring(0,G.length-1);let Y=U(G,o);if(Y!==!0)return L(Y.err.code,Y.err.msg,H(d,V+Y.err.line));l=!0}else if(v){if(!N.tagClosed)return L("InvalidTag","Closing tag '"+I+"' doesn't have proper closing.",H(d,b));if(G.trim().length>0)return L("InvalidTag","Closing tag '"+I+"' can't have attributes or invalid starting.",H(d,D));if(c.length===0)return L("InvalidTag","Closing tag '"+I+"' has not been opened.",H(d,D));{let V=c.pop();if(I!==V.tagName){let Y=H(d,V.tagStartPos);return L("InvalidTag","Expected closing tag '"+V.tagName+"' (opened in line "+Y.line+", col "+Y.col+") instead of closing tag '"+I+"'.",H(d,D))}c.length==0&&(f=!0)}}else{let V=U(G,o);if(V!==!0)return L(V.err.code,V.err.msg,H(d,b-G.length+V.err.line));if(f===!0)return L("InvalidXml","Multiple possible root nodes found.",H(d,b));o.unpairedTags.indexOf(I)!==-1||c.push({tagName:I,tagStartPos:D}),l=!0}for(b++;b<d.length;b++)if(d[b]==="<"){if(d[b+1]==="!"){b++,b=w(d,b);continue}if(d[b+1]!=="?")break;if(b=S(d,++b),b.err)return b}else if(d[b]==="&"){let V=R(d,b);if(V==-1)return L("InvalidChar","char '&' is not expected.",H(d,b));b=V}else if(f===!0&&!T(d[b]))return L("InvalidXml","Extra text at the end",H(d,b));d[b]==="<"&&b--}}}return l?c.length==1?L("InvalidTag","Unclosed tag '"+c[0].tagName+"'.",H(d,c[0].tagStartPos)):!(c.length>0)||L("InvalidXml","Invalid '"+JSON.stringify(c.map(b=>b.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):L("InvalidXml","Start tag expected.",1)}function T(d){return d===" "||d===" "||d===`
|
|
9
9
|
`||d==="\r"}function S(d,o){let c=o;for(;o<d.length;o++)if(d[o]=="?"||d[o]==" "){let l=d.substr(c,o-c);if(o>5&&l==="xml")return L("InvalidXml","XML declaration allowed only at the start of the document.",H(d,o));if(d[o]=="?"&&d[o+1]==">"){o++;break}continue}return o}function w(d,o){if(d.length>o+5&&d[o+1]==="-"&&d[o+2]==="-"){for(o+=3;o<d.length;o++)if(d[o]==="-"&&d[o+1]==="-"&&d[o+2]===">"){o+=2;break}}else if(d.length>o+8&&d[o+1]==="D"&&d[o+2]==="O"&&d[o+3]==="C"&&d[o+4]==="T"&&d[o+5]==="Y"&&d[o+6]==="P"&&d[o+7]==="E"){let c=1;for(o+=8;o<d.length;o++)if(d[o]==="<")c++;else if(d[o]===">"&&(c--,c===0))break}else if(d.length>o+9&&d[o+1]==="["&&d[o+2]==="C"&&d[o+3]==="D"&&d[o+4]==="A"&&d[o+5]==="T"&&d[o+6]==="A"&&d[o+7]==="["){for(o+=8;o<d.length;o++)if(d[o]==="]"&&d[o+1]==="]"&&d[o+2]===">"){o+=2;break}}return o}let W='"',K="'";function F(d,o){let c="",l="",f=!1;for(;o<d.length;o++){if(d[o]===W||d[o]===K)l===""?l=d[o]:l!==d[o]||(l="");else if(d[o]===">"&&l===""){f=!0;break}c+=d[o]}return l===""&&{value:c,index:o,tagClosed:f}}let _=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function U(d,o){let c=g(d,_),l={};for(let f=0;f<c.length;f++){if(c[f][1].length===0)return L("InvalidAttr","Attribute '"+c[f][2]+"' has no space in starting.",J(c[f]));if(c[f][3]!==void 0&&c[f][4]===void 0)return L("InvalidAttr","Attribute '"+c[f][2]+"' is without value.",J(c[f]));if(c[f][3]===void 0&&!o.allowBooleanAttributes)return L("InvalidAttr","boolean attribute '"+c[f][2]+"' is not allowed.",J(c[f]));let b=c[f][2];if(!x(b))return L("InvalidAttr","Attribute '"+b+"' is an invalid name.",J(c[f]));if(Object.prototype.hasOwnProperty.call(l,b))return L("InvalidAttr","Attribute '"+b+"' is repeated.",J(c[f]));l[b]=1}return!0}function R(d,o){if(d[++o]===";")return-1;if(d[o]==="#")return(function(l,f){let b=/\d/;for(l[f]==="x"&&(f++,b=/[\da-fA-F]/);f<l.length;f++){if(l[f]===";")return f;if(!l[f].match(b))break}return-1})(d,++o);let c=0;for(;o<d.length;o++,c++)if(!(d[o].match(/\w/)&&c<20)){if(d[o]===";")break;return-1}return o}function L(d,o,c){return{err:{code:d,msg:o,line:c.line||c,col:c.col}}}function x(d){return k(d)}function O(d){return k(d)}function H(d,o){let c=d.substring(0,o).split(/\r?\n/);return{line:c.length,col:c[c.length-1].length+1}}function J(d){return d.startIndex+d[1].length}let re=d=>B.includes(d)?"__"+d:d,oe={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(d,o){return o},attributeValueProcessor:function(d,o){return o},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(d,o,c){return d},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:re};function he(d,o){if(typeof d!="string")return;let c=d.toLowerCase();if(B.some(l=>c===l.toLowerCase()))throw new Error(`[SECURITY] Invalid ${o}: "${d}" is a reserved JavaScript keyword that could cause prototype pollution`);if(P.some(l=>c===l.toLowerCase()))throw new Error(`[SECURITY] Invalid ${o}: "${d}" is a reserved JavaScript keyword that could cause prototype pollution`)}function j(d,o){return typeof d=="boolean"?{enabled:d,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:typeof d=="object"&&d!==null?{enabled:d.enabled!==!1,maxEntitySize:Math.max(1,d.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,d.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,d.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,d.maxExpandedLength??1e5),maxEntityCount:Math.max(1,d.maxEntityCount??1e3),allowedTags:d.allowedTags??null,tagFilter:d.tagFilter??null,appliesTo:d.appliesTo??"all"}:j(!0)}let ae=function(d){let o=Object.assign({},oe,d),c=[{value:o.attributeNamePrefix,name:"attributeNamePrefix"},{value:o.attributesGroupName,name:"attributesGroupName"},{value:o.textNodeName,name:"textNodeName"},{value:o.cdataPropName,name:"cdataPropName"},{value:o.commentPropName,name:"commentPropName"}];for(let{value:l,name:f}of c)l&&he(l,f);return o.onDangerousProperty===null&&(o.onDangerousProperty=re),o.processEntities=j(o.processEntities,o.htmlEntities),o.unpairedTagsSet=new Set(o.unpairedTags),o.stopNodes&&Array.isArray(o.stopNodes)&&(o.stopNodes=o.stopNodes.map(l=>typeof l=="string"&&l.startsWith("*.")?".."+l.substring(2):l)),o},ne;ne=typeof Symbol!="function"?"@@xmlMetadata":Symbol("XML Node Metadata");class de{constructor(o){this.tagname=o,this.child=[],this[":@"]=Object.create(null)}add(o,c){o==="__proto__"&&(o="#__proto__"),this.child.push({[o]:c})}addChild(o,c){o.tagname==="__proto__"&&(o.tagname="#__proto__"),o[":@"]&&Object.keys(o[":@"]).length>0?this.child.push({[o.tagname]:o.child,":@":o[":@"]}):this.child.push({[o.tagname]:o.child}),c!==void 0&&(this.child[this.child.length-1][ne]={startIndex:c})}static getMetaDataSymbol(){return ne}}class ue{constructor(o){this.suppressValidationErr=!o,this.options=o}readDocType(o,c){let l=Object.create(null),f=0;if(o[c+3]!=="O"||o[c+4]!=="C"||o[c+5]!=="T"||o[c+6]!=="Y"||o[c+7]!=="P"||o[c+8]!=="E")throw new Error("Invalid Tag instead of DOCTYPE");{c+=9;let b=1,D=!1,v=!1,I="";for(;c<o.length;c++)if(o[c]!=="<"||v)if(o[c]===">"){if(v?o[c-1]==="-"&&o[c-2]==="-"&&(v=!1,b--):b--,b===0)break}else o[c]==="["?D=!0:I+=o[c];else{if(D&&Se(o,"!ENTITY",c)){let N,G;if(c+=7,[N,G,c]=this.readEntityExp(o,c+1,this.suppressValidationErr),G.indexOf("&")===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&f>=this.options.maxEntityCount)throw new Error(`Entity count (${f+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);l[N]=G,f++}}else if(D&&Se(o,"!ELEMENT",c)){c+=8;let{index:N}=this.readElementExp(o,c+1);c=N}else if(D&&Se(o,"!ATTLIST",c))c+=8;else if(D&&Se(o,"!NOTATION",c)){c+=9;let{index:N}=this.readNotationExp(o,c+1,this.suppressValidationErr);c=N}else{if(!Se(o,"!--",c))throw new Error("Invalid DOCTYPE");v=!0}b++,I=""}if(b!==0)throw new Error("Unclosed DOCTYPE")}return{entities:l,i:c}}readEntityExp(o,c){let l=c=se(o,c);for(;c<o.length&&!/\s/.test(o[c])&&o[c]!=='"'&&o[c]!=="'";)c++;let f=o.substring(l,c);if(Ce(f),c=se(o,c),!this.suppressValidationErr){if(o.substring(c,c+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(o[c]==="%")throw new Error("Parameter entities are not supported")}let b="";if([c,b]=this.readIdentifierVal(o,c,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&b.length>this.options.maxEntitySize)throw new Error(`Entity "${f}" size (${b.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[f,b,--c]}readNotationExp(o,c){let l=c=se(o,c);for(;c<o.length&&!/\s/.test(o[c]);)c++;let f=o.substring(l,c);!this.suppressValidationErr&&Ce(f),c=se(o,c);let b=o.substring(c,c+6).toUpperCase();if(!this.suppressValidationErr&&b!=="SYSTEM"&&b!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${b}"`);c+=b.length,c=se(o,c);let D=null,v=null;if(b==="PUBLIC")[c,D]=this.readIdentifierVal(o,c,"publicIdentifier"),o[c=se(o,c)]!=='"'&&o[c]!=="'"||([c,v]=this.readIdentifierVal(o,c,"systemIdentifier"));else if(b==="SYSTEM"&&([c,v]=this.readIdentifierVal(o,c,"systemIdentifier"),!this.suppressValidationErr&&!v))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:f,publicIdentifier:D,systemIdentifier:v,index:--c}}readIdentifierVal(o,c,l){let f="",b=o[c];if(b!=='"'&&b!=="'")throw new Error(`Expected quoted string, found "${b}"`);let D=++c;for(;c<o.length&&o[c]!==b;)c++;if(f=o.substring(D,c),o[c]!==b)throw new Error(`Unterminated ${l} value`);return[++c,f]}readElementExp(o,c){let l=c=se(o,c);for(;c<o.length&&!/\s/.test(o[c]);)c++;let f=o.substring(l,c);if(!this.suppressValidationErr&&!k(f))throw new Error(`Invalid element name: "${f}"`);let b="";if(o[c=se(o,c)]==="E"&&Se(o,"MPTY",c))c+=4;else if(o[c]==="A"&&Se(o,"NY",c))c+=2;else if(o[c]==="("){let D=++c;for(;c<o.length&&o[c]!==")";)c++;if(b=o.substring(D,c),o[c]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${o[c]}"`);return{elementName:f,contentModel:b.trim(),index:c}}readAttlistExp(o,c){let l=c=se(o,c);for(;c<o.length&&!/\s/.test(o[c]);)c++;let f=o.substring(l,c);for(Ce(f),l=c=se(o,c);c<o.length&&!/\s/.test(o[c]);)c++;let b=o.substring(l,c);if(!Ce(b))throw new Error(`Invalid attribute name: "${b}"`);c=se(o,c);let D="";if(o.substring(c,c+8).toUpperCase()==="NOTATION"){if(D="NOTATION",o[c=se(o,c+=8)]!=="(")throw new Error(`Expected '(', found "${o[c]}"`);c++;let I=[];for(;c<o.length&&o[c]!==")";){let N=c;for(;c<o.length&&o[c]!=="|"&&o[c]!==")";)c++;let G=o.substring(N,c);if(G=G.trim(),!Ce(G))throw new Error(`Invalid notation name: "${G}"`);I.push(G),o[c]==="|"&&(c++,c=se(o,c))}if(o[c]!==")")throw new Error("Unterminated list of notations");c++,D+=" ("+I.join("|")+")"}else{let I=c;for(;c<o.length&&!/\s/.test(o[c]);)c++;D+=o.substring(I,c);let N=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!N.includes(D.toUpperCase()))throw new Error(`Invalid attribute type: "${D}"`)}c=se(o,c);let v="";return o.substring(c,c+8).toUpperCase()==="#REQUIRED"?(v="#REQUIRED",c+=8):o.substring(c,c+7).toUpperCase()==="#IMPLIED"?(v="#IMPLIED",c+=7):[c,v]=this.readIdentifierVal(o,c,"ATTLIST"),{elementName:f,attributeName:b,attributeType:D,defaultValue:v,index:c}}}let se=(d,o)=>{for(;o<d.length&&/\s/.test(d[o]);)o++;return o};function Se(d,o,c){for(let l=0;l<o.length;l++)if(o[l]!==d[c+l+1])return!1;return!0}function Ce(d){if(k(d))return d;throw new Error(`Invalid entity name ${d}`)}let We=/^[-+]?0x[a-fA-F0-9]+$/,ie=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,De={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"},Je=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;class ca{constructor(o){this._matcher=o}get separator(){return this._matcher.separator}getCurrentTag(){let o=this._matcher.path;return o.length>0?o[o.length-1].tag:void 0}getCurrentNamespace(){let o=this._matcher.path;return o.length>0?o[o.length-1].namespace:void 0}getAttrValue(o){let c=this._matcher.path;if(c.length!==0)return c[c.length-1].values?.[o]}hasAttr(o){let c=this._matcher.path;if(c.length===0)return!1;let l=c[c.length-1];return l.values!==void 0&&o in l.values}getPosition(){let o=this._matcher.path;return o.length===0?-1:o[o.length-1].position??0}getCounter(){let o=this._matcher.path;return o.length===0?-1:o[o.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(o,c=!0){return this._matcher.toString(o,c)}toArray(){return this._matcher.path.map(o=>o.tag)}matches(o){return this._matcher.matches(o)}matchesAny(o){return o.matchesAny(this._matcher)}}class da{constructor(o={}){this.separator=o.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new ca(this)}push(o,c=null,l=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let f=this.path.length;this.siblingStacks[f]||(this.siblingStacks[f]=new Map);let b=this.siblingStacks[f],D=l?`${l}:${o}`:o,v=b.get(D)||0,I=0;for(let G of b.values())I+=G;b.set(D,v+1);let N={tag:o,position:I,counter:v};l!=null&&(N.namespace=l),c!=null&&(N.values=c),this.path.push(N)}pop(){if(this.path.length===0)return;this._pathStringCache=null;let o=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),o}updateCurrent(o){if(this.path.length>0){let c=this.path[this.path.length-1];o!=null&&(c.values=o)}}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(o){if(this.path.length!==0)return this.path[this.path.length-1].values?.[o]}hasAttr(o){if(this.path.length===0)return!1;let c=this.path[this.path.length-1];return c.values!==void 0&&o in c.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(o,c=!0){let l=o||this.separator;if(l===this.separator&&c===!0){if(this._pathStringCache!==null)return this._pathStringCache;let f=this.path.map(b=>b.namespace?`${b.namespace}:${b.tag}`:b.tag).join(l);return this._pathStringCache=f,f}return this.path.map(f=>c&&f.namespace?`${f.namespace}:${f.tag}`:f.tag).join(l)}toArray(){return this.path.map(o=>o.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[]}matches(o){let c=o.segments;return c.length!==0&&(o.hasDeepWildcard()?this._matchWithDeepWildcard(c):this._matchSimple(c))}_matchSimple(o){if(this.path.length!==o.length)return!1;for(let c=0;c<o.length;c++)if(!this._matchSegment(o[c],this.path[c],c===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(o){let c=this.path.length-1,l=o.length-1;for(;l>=0&&c>=0;){let f=o[l];if(f.type==="deep-wildcard"){if(l--,l<0)return!0;let b=o[l],D=!1;for(let v=c;v>=0;v--)if(this._matchSegment(b,this.path[v],v===this.path.length-1)){c=v-1,l--,D=!0;break}if(!D)return!1}else{if(!this._matchSegment(f,this.path[c],c===this.path.length-1))return!1;c--,l--}}return l<0}_matchSegment(o,c,l){if(o.tag!=="*"&&o.tag!==c.tag||o.namespace!==void 0&&o.namespace!=="*"&&o.namespace!==c.namespace||o.attrName!==void 0&&(!l||!c.values||!(o.attrName in c.values)||o.attrValue!==void 0&&String(c.values[o.attrName])!==String(o.attrValue)))return!1;if(o.position!==void 0){if(!l)return!1;let f=c.counter??0;if(o.position==="first"&&f!==0||o.position==="odd"&&f%2!=1||o.position==="even"&&f%2!=0||o.position==="nth"&&f!==o.positionValue)return!1}return!0}matchesAny(o){return o.matchesAny(this)}snapshot(){return{path:this.path.map(o=>({...o})),siblingStacks:this.siblingStacks.map(o=>new Map(o))}}restore(o){this._pathStringCache=null,this.path=o.path.map(c=>({...c})),this.siblingStacks=o.siblingStacks.map(c=>new Map(c))}readOnly(){return this._view}}class Ve{constructor(o,c={},l){this.pattern=o,this.separator=c.separator||".",this.segments=this._parse(o),this.data=l,this._hasDeepWildcard=this.segments.some(f=>f.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(f=>f.attrName!==void 0),this._hasPositionSelector=this.segments.some(f=>f.position!==void 0)}_parse(o){let c=[],l=0,f="";for(;l<o.length;)o[l]===this.separator?l+1<o.length&&o[l+1]===this.separator?(f.trim()&&(c.push(this._parseSegment(f.trim())),f=""),c.push({type:"deep-wildcard"}),l+=2):(f.trim()&&c.push(this._parseSegment(f.trim())),f="",l++):(f+=o[l],l++);return f.trim()&&c.push(this._parseSegment(f.trim())),c}_parseSegment(o){let c={type:"tag"},l=null,f=o,b=o.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(b&&(f=b[1]+b[3],b[2])){let G=b[2].slice(1,-1);G&&(l=G)}let D,v,I=f;if(f.includes("::")){let G=f.indexOf("::");if(D=f.substring(0,G).trim(),I=f.substring(G+2).trim(),!D)throw new Error(`Invalid namespace in pattern: ${o}`)}let N=null;if(I.includes(":")){let G=I.lastIndexOf(":"),V=I.substring(0,G).trim(),Y=I.substring(G+1).trim();["first","last","odd","even"].includes(Y)||/^nth\(\d+\)$/.test(Y)?(v=V,N=Y):v=I}else v=I;if(!v)throw new Error(`Invalid segment pattern: ${o}`);if(c.tag=v,D&&(c.namespace=D),l)if(l.includes("=")){let G=l.indexOf("=");c.attrName=l.substring(0,G).trim(),c.attrValue=l.substring(G+1).trim()}else c.attrName=l.trim();if(N){let G=N.match(/^nth\((\d+)\)$/);G?(c.position="nth",c.positionValue=parseInt(G[1],10)):c.position=N}return c}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class sr{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._patterns=new Set,this._sealed=!1}add(o){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(o.pattern))return this;if(this._patterns.add(o.pattern),o.hasDeepWildcard())return this._deepWildcards.push(o),this;let c=o.length,l=o.segments[o.segments.length-1],f=l?.tag;if(f&&f!=="*"){let b=`${c}:${f}`;this._byDepthAndTag.has(b)||this._byDepthAndTag.set(b,[]),this._byDepthAndTag.get(b).push(o)}else this._wildcardByDepth.has(c)||this._wildcardByDepth.set(c,[]),this._wildcardByDepth.get(c).push(o);return this}addAll(o){for(let c of o)this.add(c);return this}has(o){return this._patterns.has(o.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(o){return this.findMatch(o)!==null}findMatch(o){let c=o.getDepth(),l=`${c}:${o.getCurrentTag()}`,f=this._byDepthAndTag.get(l);if(f){for(let D=0;D<f.length;D++)if(o.matches(f[D]))return f[D]}let b=this._wildcardByDepth.get(c);if(b){for(let D=0;D<b.length;D++)if(o.matches(b[D]))return b[D]}for(let D=0;D<this._deepWildcards.length;D++)if(o.matches(this._deepWildcards[D]))return this._deepWildcards[D];return null}}let $a={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"},Ba={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},lr={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"},ha=new Set("!?\\\\/[]$%{}^&*()<>|+");function xa(d){if(d[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${d}"`);for(let o of d)if(ha.has(o))throw new Error(`[EntityReplacer] Invalid character '${o}' in entity name: "${d}"`);return d}function ma(...d){let o=Object.create(null);for(let c of d)if(c)for(let l of Object.keys(c)){let f=c[l];if(typeof f=="string")o[l]=f;else if(f&&typeof f=="object"&&f.val!==void 0){let b=f.val;typeof b=="string"&&(o[l]=b)}}return o}let $e="external",Ue="base",pa="all",Ne=Object.freeze({allow:0,leave:1,remove:2,throw:3}),Et=new Set([9,10,13]);class Pt{constructor(o={}){var c;this._limit=o.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof o.postCheck=="function"?o.postCheck:f=>f,this._limitTiers=(c=this._limit.applyLimitsTo??$e)&&c!==$e?c===pa?new Set([pa]):c===Ue?new Set([Ue]):Array.isArray(c)?new Set(c):new Set([$e]):new Set([$e]),this._numericAllowed=o.numericAllowed??!0,this._baseMap=ma(Ba,o.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(o.remove&&Array.isArray(o.remove)?o.remove:[]),this._leaveSet=new Set(o.leave&&Array.isArray(o.leave)?o.leave:[]);let l=(function(f){if(!f)return{xmlVersion:1,onLevel:Ne.allow,nullLevel:Ne.remove};let b=f.xmlVersion===1.1?1.1:1,D=Ne[f.onNCR]??Ne.allow,v=Ne[f.nullNCR]??Ne.remove;return{xmlVersion:b,onLevel:D,nullLevel:Math.max(v,Ne.remove)}})(o.ncr);this._ncrXmlVersion=l.xmlVersion,this._ncrOnLevel=l.onLevel,this._ncrNullLevel=l.nullLevel}setExternalEntities(o){if(o)for(let c of Object.keys(o))xa(c);this._externalMap=ma(o)}addExternalEntity(o,c){xa(o),typeof c=="string"&&c.indexOf("&")===-1&&(this._externalMap[o]=c)}addInputEntities(o){this._totalExpansions=0,this._expandedLength=0,this._inputMap=ma(o)}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(o){this._ncrXmlVersion=o===1.1?1.1:1}decode(o){if(typeof o!="string"||o.length===0)return o;let c=o,l=[],f=o.length,b=0,D=0,v=this._maxTotalExpansions>0,I=this._maxExpandedLength>0,N=v||I;for(;D<f;){if(o.charCodeAt(D)!==38){D++;continue}let V=D+1;for(;V<f&&o.charCodeAt(V)!==59&&V-D<=32;)V++;if(V>=f||o.charCodeAt(V)!==59){D++;continue}let Y=o.slice(D+1,V);if(Y.length===0){D++;continue}let X,te;if(this._removeSet.has(Y))X="",te===void 0&&(te=$e);else{if(this._leaveSet.has(Y)){D++;continue}if(Y.charCodeAt(0)===35){let z=this._resolveNCR(Y);if(z===void 0){D++;continue}X=z,te=Ue}else{let z=this._resolveName(Y);X=z?.value,te=z?.tier}}if(X!==void 0){if(D>b&&l.push(o.slice(b,D)),l.push(X),b=V+1,D=b,N&&this._tierCounts(te)){if(v&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(I){let z=X.length-(Y.length+2);if(z>0&&(this._expandedLength+=z,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}else D++}b<f&&l.push(o.slice(b));let G=l.length===0?o:l.join("");return this._postCheck(G,c)}_tierCounts(o){return!!this._limitTiers.has(pa)||this._limitTiers.has(o)}_resolveName(o){return o in this._inputMap?{value:this._inputMap[o],tier:$e}:o in this._externalMap?{value:this._externalMap[o],tier:$e}:o in this._baseMap?{value:this._baseMap[o],tier:Ue}:void 0}_classifyNCR(o){return o===0?this._ncrNullLevel:o>=55296&&o<=57343||this._ncrXmlVersion===1&&o>=1&&o<=31&&!Et.has(o)?Ne.remove:-1}_applyNCRAction(o,c,l){switch(o){case Ne.allow:return String.fromCodePoint(l);case Ne.remove:return"";case Ne.leave:return;case Ne.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${c}; (U+${l.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(l)}}_resolveNCR(o){let c=o.charCodeAt(1),l;if(l=c===120||c===88?parseInt(o.slice(2),16):parseInt(o.slice(1),10),Number.isNaN(l)||l<0||l>1114111)return;let f=this._classifyNCR(l);if(!this._numericAllowed&&f<Ne.remove)return;let b=f===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,f);return this._applyNCRAction(b,o,l)}}function Rt(d,o){if(!d)return{};let c=o.attributesGroupName?d[o.attributesGroupName]:d;if(!c)return{};let l={};for(let f in c)f.startsWith(o.attributeNamePrefix)?l[f.substring(o.attributeNamePrefix.length)]=c[f]:l[f]=c[f];return l}function Lt(d){if(!d||typeof d!="string")return;let o=d.indexOf(":");if(o!==-1&&o>0){let c=d.substring(0,o);if(c!=="xmlns")return c}}class Dt{constructor(o){var c;this.options=o,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=Ht,this.parseTextData=Nt,this.resolveNameSpace=Dr,this.buildAttributesMap=Ot,this.isItStopNode=Ft,this.replaceEntitiesValue=Wt,this.readStopNodeData=_t,this.saveTextToParentTag=Gt,this.addChild=It,this.ignoreAttributesFn=typeof(c=this.options.ignoreAttributes)=="function"?c:Array.isArray(c)?b=>{for(let D of c)if(typeof D=="string"&&b===D||D instanceof RegExp&&D.test(b))return!0}:()=>!1,this.entityExpansionCount=0,this.currentExpandedLength=0;let l={...Ba};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities=="object"?l=this.options.htmlEntities:this.options.htmlEntities===!0&&(l={...lr,...$a}),this.entityDecoder=new Pt({namedEntities:l,numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo}})),this.matcher=new da,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new sr;let f=this.options.stopNodes;if(f&&f.length>0){for(let b=0;b<f.length;b++){let D=f[b];typeof D=="string"?this.stopNodeExpressionsSet.add(new Ve(D)):D instanceof Ve&&this.stopNodeExpressionsSet.add(D)}this.stopNodeExpressionsSet.seal()}}}function Nt(d,o,c,l,f,b,D){let v=this.options;if(d!==void 0&&(v.trimValues&&!l&&(d=d.trim()),d.length>0)){D||(d=this.replaceEntitiesValue(d,o,c));let I=v.jPath?c.toString():c,N=v.tagValueProcessor(o,d,I,f,b);return N==null?d:typeof N!=typeof d||N!==d?N:v.trimValues||d.trim()===d?Or(d,v.parseTagValue,v.numberParseOptions):d}}function Dr(d){if(this.options.removeNSPrefix){let o=d.split(":"),c=d.charAt(0)==="/"?"/":"";if(o[0]==="xmlns")return"";o.length===2&&(d=c+o[1])}return d}let Nr=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Ot(d,o,c,l=!1){let f=this.options;if(l===!0||f.ignoreAttributes!==!0&&typeof d=="string"){let b=g(d,Nr),D=b.length,v={},I=new Array(D),N=!1,G={};for(let X=0;X<D;X++){let te=this.resolveNameSpace(b[X][1]),z=b[X][4];if(te.length&&z!==void 0){let ye=z;f.trimValues&&(ye=ye.trim()),ye=this.replaceEntitiesValue(ye,c,this.readonlyMatcher),I[X]=ye,G[te]=ye,N=!0}}N&&typeof o=="object"&&o.updateCurrent&&o.updateCurrent(G);let V=f.jPath?o.toString():this.readonlyMatcher,Y=!1;for(let X=0;X<D;X++){let te=this.resolveNameSpace(b[X][1]);if(this.ignoreAttributesFn(te,V))continue;let z=f.attributeNamePrefix+te;if(te.length)if(f.transformAttributeName&&(z=f.transformAttributeName(z)),z=ya(z,f),b[X][4]!==void 0){let ye=I[X],He=f.attributeValueProcessor(te,ye,V);v[z]=He==null?ye:typeof He!=typeof ye||He!==ye?He:Or(ye,f.parseAttributeValue,f.numberParseOptions),Y=!0}else f.allowBooleanAttributes&&(v[z]=!0,Y=!0)}if(!Y)return;if(f.attributesGroupName){let X={};return X[f.attributesGroupName]=v,X}return v}}let Ht=function(d){d=d.replace(/\r\n?/g,`
|
|
10
10
|
`);let o=new de("!xml"),c=o,l="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let f=this.options,b=new ue(f.processEntities),D=d.length;for(let v=0;v<D;v++)if(d[v]==="<"){let I=d.charCodeAt(v+1);if(I===47){let N=fa(d,">",v,"Closing Tag is not closed."),G=d.substring(v+2,N).trim();if(f.removeNSPrefix){let Y=G.indexOf(":");Y!==-1&&(G=G.substr(Y+1))}G=cr(f.transformTagName,G,"",f).tagName,c&&(l=this.saveTextToParentTag(l,c,this.readonlyMatcher));let V=this.matcher.getCurrentTag();if(G&&f.unpairedTagsSet.has(G))throw new Error(`Unpaired tag can not be used as closing tag: </${G}>`);V&&f.unpairedTagsSet.has(V)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,c=this.tagsNodeStack.pop(),l="",v=N}else if(I===63){let N=ur(d,v,!1,"?>");if(!N)throw new Error("Pi Tag is not closed.");l=this.saveTextToParentTag(l,c,this.readonlyMatcher);let G=this.buildAttributesMap(N.tagExp,this.matcher,N.tagName,!0);if(G){let V=G[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(V)||1)}if(!(f.ignoreDeclaration&&N.tagName==="?xml"||f.ignorePiTags)){let V=new de(N.tagName);V.add(f.textNodeName,""),N.tagName!==N.tagExp&&N.attrExpPresent&&f.ignoreAttributes!==!0&&(V[":@"]=G),this.addChild(c,V,this.readonlyMatcher,v)}v=N.closeIndex+1}else if(I===33&&d.charCodeAt(v+2)===45&&d.charCodeAt(v+3)===45){let N=fa(d,"-->",v+4,"Comment is not closed.");if(f.commentPropName){let G=d.substring(v+4,N-2);l=this.saveTextToParentTag(l,c,this.readonlyMatcher),c.add(f.commentPropName,[{[f.textNodeName]:G}])}v=N}else if(I===33&&d.charCodeAt(v+2)===68){let N=b.readDocType(d,v);this.entityDecoder.addInputEntities(N.entities),v=N.i}else if(I===33&&d.charCodeAt(v+2)===91){let N=fa(d,"]]>",v,"CDATA is not closed.")-2,G=d.substring(v+9,N);l=this.saveTextToParentTag(l,c,this.readonlyMatcher);let V=this.parseTextData(G,c.tagname,this.readonlyMatcher,!0,!1,!0,!0);V==null&&(V=""),f.cdataPropName?c.add(f.cdataPropName,[{[f.textNodeName]:G}]):c.add(f.textNodeName,V),v=N+2}else{let N=ur(d,v,f.removeNSPrefix);if(!N){let Re=d.substring(Math.max(0,v-50),Math.min(D,v+50));throw new Error(`readTagExp returned undefined at position ${v}. Context: "${Re}"`)}let G=N.tagName,V=N.rawTagName,Y=N.tagExp,X=N.attrExpPresent,te=N.closeIndex;if({tagName:G,tagExp:Y}=cr(f.transformTagName,G,Y,f),f.strictReservedNames&&(G===f.commentPropName||G===f.cdataPropName||G===f.textNodeName||G===f.attributesGroupName))throw new Error(`Invalid tag name: ${G}`);c&&l&&c.tagname!=="!xml"&&(l=this.saveTextToParentTag(l,c,this.readonlyMatcher,!1));let z=c;z&&f.unpairedTagsSet.has(z.tagname)&&(c=this.tagsNodeStack.pop(),this.matcher.pop());let ye=!1;Y.length>0&&Y.lastIndexOf("/")===Y.length-1&&(ye=!0,G[G.length-1]==="/"?(G=G.substr(0,G.length-1),Y=G):Y=Y.substr(0,Y.length-1),X=G!==Y);let He,Pe=null,Ye={};He=Lt(V),G!==o.tagname&&this.matcher.push(G,{},He),G!==Y&&X&&(Pe=this.buildAttributesMap(Y,this.matcher,G),Pe&&(Ye=Rt(Pe,f))),G!==o.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let Ie=v;if(this.isCurrentNodeStopNode){let Re="";if(ye)v=N.closeIndex;else if(f.unpairedTagsSet.has(G))v=N.closeIndex;else{let pr=this.readStopNodeData(d,V,te+1);if(!pr)throw new Error(`Unexpected end of ${V}`);v=pr.i,Re=pr.tagContent}let ra=new de(G);Pe&&(ra[":@"]=Pe),ra.add(f.textNodeName,Re),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(c,ra,this.readonlyMatcher,Ie)}else{if(ye){({tagName:G,tagExp:Y}=cr(f.transformTagName,G,Y,f));let Re=new de(G);Pe&&(Re[":@"]=Pe),this.addChild(c,Re,this.readonlyMatcher,Ie),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else{if(f.unpairedTagsSet.has(G)){let Re=new de(G);Pe&&(Re[":@"]=Pe),this.addChild(c,Re,this.readonlyMatcher,Ie),this.matcher.pop(),this.isCurrentNodeStopNode=!1,v=N.closeIndex;continue}{let Re=new de(G);if(this.tagsNodeStack.length>f.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(c),Pe&&(Re[":@"]=Pe),this.addChild(c,Re,this.readonlyMatcher,Ie),c=Re}}l="",v=te}}}else l+=d[v];return o.child};function It(d,o,c,l){this.options.captureMetaData||(l=void 0);let f=this.options.jPath?c.toString():c,b=this.options.updateTag(o.tagname,f,o[":@"]);b===!1||(typeof b=="string"&&(o.tagname=b),d.addChild(o,l))}function Wt(d,o,c){let l=this.options.processEntities;if(!l||!l.enabled)return d;if(l.allowedTags){let f=this.options.jPath?c.toString():c;if(!(Array.isArray(l.allowedTags)?l.allowedTags.includes(o):l.allowedTags(o,f)))return d}if(l.tagFilter){let f=this.options.jPath?c.toString():c;if(!l.tagFilter(o,f))return d}return this.entityDecoder.decode(d)}function Gt(d,o,c,l){return d&&(l===void 0&&(l=o.child.length===0),(d=this.parseTextData(d,o.tagname,c,!1,!!o[":@"]&&Object.keys(o[":@"]).length!==0,l))!==void 0&&d!==""&&o.add(this.options.textNodeName,d),d=""),d}function Ft(){return this.stopNodeExpressionsSet.size!==0&&this.matcher.matchesAny(this.stopNodeExpressionsSet)}function fa(d,o,c,l){let f=d.indexOf(o,c);if(f===-1)throw new Error(l);return f+o.length-1}function $t(d,o,c,l){let f=d.indexOf(o,c);if(f===-1)throw new Error(l);return f}function ur(d,o,c,l=">"){let f=(function(V,Y,X=">"){let te=0,z=[],ye=V.length,He=X.charCodeAt(0),Pe=X.length>1?X.charCodeAt(1):-1;for(let Ye=Y;Ye<ye;Ye++){let Ie=V.charCodeAt(Ye);if(te)Ie===te&&(te=0);else if(Ie===34||Ie===39)te=Ie;else if(Ie===He){if(Pe===-1)return{data:String.fromCharCode(...z),index:Ye};if(V.charCodeAt(Ye+1)===Pe)return{data:String.fromCharCode(...z),index:Ye}}else if(Ie===9){z.push(32);continue}z.push(Ie)}})(d,o+1,l);if(!f)return;let b=f.data,D=f.index,v=b.search(/\s/),I=b,N=!0;v!==-1&&(I=b.substring(0,v),b=b.substring(v+1).trimStart());let G=I;if(c){let V=I.indexOf(":");V!==-1&&(I=I.substr(V+1),N=I!==f.data.substr(V+1))}return{tagName:I,tagExp:b,closeIndex:D,attrExpPresent:N,rawTagName:G}}function _t(d,o,c){let l=c,f=1,b=d.length;for(;c<b;c++)if(d[c]==="<"){let D=d.charCodeAt(c+1);if(D===47){let v=$t(d,">",c,`${o} is not closed`);if(d.substring(c+2,v).trim()===o&&(f--,f===0))return{tagContent:d.substring(l,c),i:v};c=v}else if(D===63)c=fa(d,"?>",c+1,"StopNode is not closed.");else if(D===33&&d.charCodeAt(c+2)===45&&d.charCodeAt(c+3)===45)c=fa(d,"-->",c+3,"StopNode is not closed.");else if(D===33&&d.charCodeAt(c+2)===91)c=fa(d,"]]>",c,"StopNode is not closed.")-2;else{let v=ur(d,c,">");v&&((v&&v.tagName)===o&&v.tagExp[v.tagExp.length-1]!=="/"&&f++,c=v.closeIndex)}}}function Or(d,o,c){if(o&&typeof d=="string"){let l=d.trim();return l==="true"||l!=="false"&&(function(f,b={}){if(b=Object.assign({},De,b),!f||typeof f!="string")return f;let D=f.trim();if(D.length===0||b.skipLike!==void 0&&b.skipLike.test(D))return f;if(D==="0")return 0;if(b.hex&&We.test(D))return(function(I){if(parseInt)return parseInt(I,16);if(Number.parseInt)return Number.parseInt(I,16);if(window&&window.parseInt)return window.parseInt(I,16);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")})(D);if(isFinite(D)){if(D.includes("e")||D.includes("E"))return(function(I,N,G){if(!G.eNotation)return I;let V=N.match(Je);if(V){let Y=V[1]||"",X=V[3].indexOf("e")===-1?"E":"e",te=V[2],z=Y?I[te.length+1]===X:I[te.length]===X;return te.length>1&&z?I:(te.length!==1||!V[3].startsWith(`.${X}`)&&V[3][0]!==X)&&te.length>0?G.leadingZeros&&!z?(N=(V[1]||"")+V[3],Number(N)):I:Number(N)}return I})(f,D,b);{let I=ie.exec(D);if(I){let N=I[1]||"",G=I[2],V=((v=I[3])&&v.indexOf(".")!==-1&&((v=v.replace(/0+$/,""))==="."?v="0":v[0]==="."?v="0"+v:v[v.length-1]==="."&&(v=v.substring(0,v.length-1))),v),Y=N?f[G.length+1]===".":f[G.length]===".";if(!b.leadingZeros&&(G.length>1||G.length===1&&!Y))return f;{let X=Number(D),te=String(X);if(X===0)return X;if(te.search(/[eE]/)!==-1)return b.eNotation?X:f;if(D.indexOf(".")!==-1)return te==="0"||te===V||te===`${N}${V}`?X:f;let z=G?V:D;return G?z===te||N+z===te?X:f:z===te||z===N+te?X:f}}return f}}var v;return(function(I,N,G){let V=N===1/0;switch(G.infinity.toLowerCase()){case"null":return null;case"infinity":return N;case"string":return V?"Infinity":"-Infinity";default:return I}})(f,Number(D),b)})(d,c)}return d!==void 0?d:""}function cr(d,o,c,l){if(d){let f=d(o);c===o&&(c=f),o=f}return{tagName:o=ya(o,l),tagExp:c}}function ya(d,o){if(P.includes(d))throw new Error(`[SECURITY] Invalid name: "${d}" is a reserved JavaScript keyword that could cause prototype pollution`);return B.includes(d)?o.onDangerousProperty(d):d}let _a=de.getMetaDataSymbol();function Kt(d,o){if(!d||typeof d!="object")return{};if(!o)return d;let c={};for(let l in d)l.startsWith(o)?c[l.substring(o.length)]=d[l]:c[l]=d[l];return c}function jt(d,o,c,l){return Hr(d,o,c,l)}function Hr(d,o,c,l){let f,b={};for(let D=0;D<d.length;D++){let v=d[D],I=Jt(v);if(I!==void 0&&I!==o.textNodeName){let N=Kt(v[":@"]||{},o.attributeNamePrefix);c.push(I,N)}if(I===o.textNodeName)f===void 0?f=v[I]:f+=""+v[I];else{if(I===void 0)continue;if(v[I]){let N=Hr(v[I],o,c,l),G=Vt(N,o);if(v[":@"]?zt(N,v[":@"],l,o):Object.keys(N).length!==1||N[o.textNodeName]===void 0||o.alwaysCreateTextNode?Object.keys(N).length===0&&(o.alwaysCreateTextNode?N[o.textNodeName]="":N=""):N=N[o.textNodeName],v[_a]!==void 0&&typeof N=="object"&&N!==null&&(N[_a]=v[_a]),b[I]!==void 0&&Object.prototype.hasOwnProperty.call(b,I))Array.isArray(b[I])||(b[I]=[b[I]]),b[I].push(N);else{let V=o.jPath?l.toString():l;o.isArray(I,V,G)?b[I]=[N]:b[I]=N}I!==void 0&&I!==o.textNodeName&&c.pop()}}}return typeof f=="string"?f.length>0&&(b[o.textNodeName]=f):f!==void 0&&(b[o.textNodeName]=f),b}function Jt(d){let o=Object.keys(d);for(let c=0;c<o.length;c++){let l=o[c];if(l!==":@")return l}}function zt(d,o,c,l){if(o){let f=Object.keys(o),b=f.length;for(let D=0;D<b;D++){let v=f[D],I=v.startsWith(l.attributeNamePrefix)?v.substring(l.attributeNamePrefix.length):v,N=l.jPath?c.toString()+"."+I:c;l.isArray(v,N,!0,!0)?d[v]=[o[v]]:d[v]=o[v]}}}function Vt(d,o){let{textNodeName:c}=o,l=Object.keys(d).length;return l===0||!(l!==1||!d[c]&&typeof d[c]!="boolean"&&d[c]!==0)}class Ut{constructor(o){this.externalEntities={},this.options=ae(o)}parse(o,c){if(typeof o!="string"&&o.toString)o=o.toString();else if(typeof o!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(c){c===!0&&(c={});let b=A(o,c);if(b!==!0)throw Error(`${b.err.msg}:${b.err.line}:${b.err.col}`)}let l=new Dt(this.options);l.entityDecoder.setExternalEntities(this.externalEntities);let f=l.parseXml(o);return this.options.preserveOrder||f===void 0?f:jt(f,this.options,l.matcher,l.readonlyMatcher)}addEntity(o,c){if(c.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(o.indexOf("&")!==-1||o.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(c==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[o]=c}static getMetaDataSymbol(){return de.getMetaDataSymbol()}}function Yt(d,o){let c="";o.format&&o.indentBy.length>0&&(c=`
|
|
@@ -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,d,e,f,g}from"./
|
|
7
|
+
import{a,b,c,d,e,f,g}from"./75MSALYF.js";import"./H5WKHOUJ.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";export{d as RESET_ESCAPE_CODE,c as calculateTotals,f as conditionallyMaskSecrets,b as generate,e as maskSecrets,a as parseRuntimeExpression,g as run};
|