@http-forge/core 0.6.2-2.beta.2 → 0.6.2-2.beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +76 -76
- package/dist/index.mjs +76 -76
- package/dist/infrastructure/script/script-executor.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var PL=Object.create;var Eh=Object.defineProperty;var kL=Object.getOwnPropertyDescriptor;var AL=Object.getOwnPropertyNames;var TL=Object.getPrototypeOf,$L=Object.prototype.hasOwnProperty;var _t=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var ae=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var V=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},io=(t,e)=>{for(var r in e)Eh(t,r,{get:e[r],enumerable:!0})},iq=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of AL(e))!$L.call(t,i)&&i!==r&&Eh(t,i,{get:()=>e[i],enumerable:!(n=kL(e,i))||n.enumerable});return t};var Qc=(t,e,r)=>(r=t!=null?PL(TL(t)):{},iq(e||!t||!t.__esModule?Eh(r,"default",{value:t,enumerable:!0}):r,t)),Ql=t=>iq(Eh({},"__esModule",{value:!0}),t);function Vt(t){return t.replace(/[^a-zA-Z0-9-_]/g,"_").replace(/\s+/g,"-").toLowerCase().substring(0,100)}function Pt(t){let e=Date.now().toString(36)+(NL++).toString(36)+Math.random().toString(36).slice(2,7);return t?`${Vt(t)}_${e}`:e}function tS(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function Zc(t,e){let r={},n={};for(let[i,s]of Object.entries(t)){let o=i.toLowerCase();n[o]=i,r[i]=s}for(let[i,s]of Object.entries(e)){let o=i.toLowerCase(),l=n[o];l&&delete r[l],n[o]=i,r[i]=s}return r}function ML(t){return JSON.parse(JSON.stringify(t))}function FL(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function DL(t,e){try{return JSON.parse(t)}catch{return e}}function jL(t){if(t===0)return"0 B";let e=1024,r=["B","KB","MB","GB"],n=Math.floor(Math.log(t)/Math.log(e));return`${parseFloat((t/Math.pow(e,n)).toFixed(1))} ${r[n]}`}function LL(t){return t<1e3?`${t} ms`:`${(t/1e3).toFixed(2)} s`}var NL,jn=ae(()=>{"use strict";NL=0});import*as ht from"fs";import*as bn from"path";function Oh(t){if(!ht.existsSync(t))return;let e={},r=bn.join(t,qh.preRequest);ht.existsSync(r)&&(e.preRequest=ht.readFileSync(r,"utf-8"));let n=bn.join(t,qh.postResponse);return ht.existsSync(n)&&(e.postResponse=ht.readFileSync(n,"utf-8")),Object.keys(e).length>0?e:void 0}async function Ih(t,e){await ht.promises.mkdir(t,{recursive:!0});let r=bn.join(t,qh.preRequest);e.preRequest?await ht.promises.writeFile(r,e.preRequest,"utf-8"):ht.existsSync(r)&&await ht.promises.unlink(r);let n=bn.join(t,qh.postResponse);e.postResponse?await ht.promises.writeFile(n,e.postResponse,"utf-8"):ht.existsSync(n)&&await ht.promises.unlink(n)}function oq(t){for(let[e,r]of Object.entries(sq)){let n=bn.join(t,e);if(ht.existsSync(n))try{let i=ht.readFileSync(n,"utf-8"),s;if(r.type==="graphql")try{s=JSON.parse(i)}catch{s=i}else s=i;return{type:r.type,format:r.format,content:s}}catch(i){console.error(`[FolderIO] Failed to load body from ${n}:`,i)}}}function aq(t){if(!t||t.type==="none")return{bodyForMetadata:t};if(t.type==="raw"){let e=t.format||"json",n={json:"body.json",xml:"body.xml",text:"body.txt",html:"body.html",javascript:"body.js"}[e];if(n){let i=e==="json"?typeof t.content=="string"?t.content:JSON.stringify(t.content,null,2):String(t.content||"");return{bodyForMetadata:{type:t.type,format:t.format},externalBodyFile:{filename:n,content:i}}}}if(t.type==="graphql"){let e=typeof t.content=="string"?t.content:JSON.stringify(t.content,null,2);return{bodyForMetadata:{type:t.type},externalBodyFile:{filename:"body.graphql",content:e}}}return{bodyForMetadata:t}}async function lq(t,e){for(let r of Object.keys(sq))if(r!==e){let n=bn.join(t,r);if(ht.existsSync(n))try{await ht.promises.unlink(n)}catch{}}}function uq(t){if(ht.existsSync(t))try{let e=ht.readFileSync(t,"utf-8");return JSON.parse(e)}catch(e){console.error(`[FolderIO] Failed to load schema file ${t}:`,e);return}}async function cq(t,e,r){let n=bn.join(t,Xc.responseSchema),i=bn.join(t,Xc.bodySchema);e?await ht.promises.writeFile(n,JSON.stringify(e,null,2),"utf-8"):ht.existsSync(n)&&await ht.promises.unlink(n),r?await ht.promises.writeFile(i,JSON.stringify(r,null,2),"utf-8"):ht.existsSync(i)&&await ht.promises.unlink(i)}function rS(t,e){for(let r of t){if(r.id===e)return r;if(r.type==="folder"&&r.items){let n=rS(r.items,e);if(n)return n}}}function nS(t,e){for(let r=0;r<t.length;r++){let n=t[r];if(n.id===e)return t.splice(r,1),!0;if(n.type==="folder"&&n.items&&nS(n.items,e))return!0}return!1}function fq(t,e){let r=new Map(t.map(i=>[i.id,i])),n=[];for(let i of e){let s=r.get(i);s&&(n.push(s),r.delete(i))}for(let i of r.values())n.push(i);return n}function iS(t,e){let r;try{r=ht.readdirSync(t,{withFileTypes:!0})}catch{return}for(let n of r){if(!n.isDirectory()||n.name===Sn)continue;if(n.name===e)return bn.join(t,n.name);let i=iS(bn.join(t,n.name),e);if(i)return i}}function UL(t){for(let e of[Lr.request,Lr.folder]){let r=bn.join(t,e);if(ht.existsSync(r))try{let n=ht.readFileSync(r,"utf-8");return JSON.parse(n).id}catch{return}}}function sS(t,e){let r;try{r=ht.readdirSync(t,{withFileTypes:!0})}catch{return}for(let n of r){if(!n.isDirectory()||n.name===Sn)continue;let i=bn.join(t,n.name);if(UL(i)===e)return i;let s=sS(i,e);if(s)return s}}function Ln(t,e=[]){let r=t.toLowerCase().trim(),n=r.match(/^(get|post|put|patch|delete|head|options)[_\s-]/i),i=n?n[1]:"",s=r.match(/t(\d+)/gi)||[],o=0;for(let y of s){let b=parseInt(y.substring(1));b>o&&(o=b)}let l="";if(o>0)l=`t${o}`;else{let y=r.match(/[_\s-](\d+\.\d+)[_\s-]/);y&&(l=`v${y[1].replace(".","_")}`)}let c=r;n&&(c=c.substring(n[0].length)),c=c.replace(/[_\s-]?t\d+(?:\.\d+)?[_\s-]?/gi,"-"),c=c.replace(/[_\s-]?\d+\.\d+[_\s-]?/g,"-"),c=c.replace(/\([^)]+\)/g,""),c=c.replace(/:[a-z_][a-z0-9_]*/gi,""),c=c.replace(/\{[^}]+\}/g,""),c=c.replace(/\?$/g,"").replace(/[_/\\ ]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"");let d=c.split("-").filter(y=>y.length>0),p=[];i&&p.push(i),p.push(...d),l&&p.push(l);let m=p.join("-");if(m||(m="item"),e.includes(m)){let y=2;for(;e.includes(`${m}-${y}`);)y++;m=`${m}-${y}`}return m}var qh,Lr,sq,Xc,Sn,ma=ae(()=>{"use strict";qh={preRequest:"pre-request.js",postResponse:"post-response.js"},Lr={collection:"collection.json",folder:"folder.json",request:"request.json"},sq={"body.json":{type:"raw",format:"json"},"body.xml":{type:"raw",format:"xml"},"body.txt":{type:"raw",format:"text"},"body.html":{type:"raw",format:"html"},"body.js":{type:"raw",format:"javascript"},"body.graphql":{type:"graphql"}},Xc={responseSchema:"response.schema.json",bodySchema:"body.schema.json"},Sn="scripts"});import*as Ne from"fs";import*as je from"path";var so,Ph=ae(()=>{"use strict";jn();ma();so=class{collectionsDir;cache=new Map;slugToIdMap=new Map;idToSlugMap=new Map;constructor(e){this.collectionsDir=e,this.ensureDirectory()}getSlugById(e){return this.idToSlugMap.get(e)}getIdBySlug(e){return this.slugToIdMap.get(e)}ensureDirectory(){Ne.existsSync(this.collectionsDir)||Ne.mkdirSync(this.collectionsDir,{recursive:!0})}readJsonFileSafe(e,r){let n;try{n=Ne.readFileSync(e,"utf-8")}catch(i){console.error(`[FolderCollectionStore] Failed to read ${r} ${e}:`,i);return}if(n.trim().length!==0)try{return JSON.parse(n)}catch(i){if(i instanceof SyntaxError&&/Unexpected end of JSON input/.test(i.message))return;console.error(`[FolderCollectionStore] Failed to parse ${r} ${e}:`,i);return}}loadAll(){if(this.cache.clear(),this.slugToIdMap.clear(),this.idToSlugMap.clear(),!Ne.existsSync(this.collectionsDir))return[];let e=Ne.readdirSync(this.collectionsDir,{withFileTypes:!0}),r=[];for(let n of e)if(n.isDirectory())try{let i=this.loadCollectionFromFolder(n.name);i&&(this.cache.set(i.id,i),this.slugToIdMap.set(n.name,i.id),this.idToSlugMap.set(i.id,n.name),r.push(i))}catch(i){console.error(`[FolderCollectionStore] Failed to load ${n.name}:`,i)}return r}loadCollectionFromFolder(e){let r=je.join(this.collectionsDir,e),n=je.join(r,Lr.collection);if(!Ne.existsSync(n))return;let i=this.readJsonFileSafe(n,"collection");if(i)try{let s=this.loadScriptsFromDir(je.join(r,Sn)),o=this.loadItemsFromDir(r,i.id,i.order);return{id:i.id,name:i.name,description:i.description,version:i.version,variables:i.variables,auth:i.auth,scripts:s,items:o}}catch(s){console.error(`[FolderCollectionStore] Failed to parse ${n}:`,s);return}}loadItemsFromDir(e,r,n){let i=[],s=new Map,o=Ne.readdirSync(e,{withFileTypes:!0});for(let l of o){if(!l.isDirectory()||l.name===Sn)continue;let c=je.join(e,l.name);if(Ne.existsSync(je.join(c,Lr.folder))){let d=this.loadFolderFromDir(c,l.name);d&&s.set(l.name,d)}else if(Ne.existsSync(je.join(c,Lr.request))){let d=this.loadRequestFromDir(c,l.name);d&&s.set(l.name,d)}}if(n&&n.length>0){for(let l of n){let c=s.get(l);c&&(i.push(c),s.delete(l))}for(let l of s.values())i.push(l)}else for(let l of s.values())i.push(l);return i}loadFolderFromDir(e,r){let n=je.join(e,Lr.folder),i=this.readJsonFileSafe(n,"folder");if(i)try{let s=this.loadScriptsFromDir(je.join(e,Sn)),o=this.loadItemsFromDir(e,i.id,i.order);return this.slugToIdMap.set(r,i.id),this.idToSlugMap.set(i.id,r),{id:i.id,type:"folder",name:i.name,description:i.description,auth:i.auth,scripts:s,items:o}}catch(s){console.error(`[FolderCollectionStore] Failed to load folder ${e}:`,s);return}}loadRequestFromDir(e,r){let n=je.join(e,Lr.request),i=this.readJsonFileSafe(n,"request");if(i)try{let s=this.loadScriptsFromDir(je.join(e,Sn)),o=i.body,l=this.loadBodyFromDir(e);l&&(o=l);let c=this.loadSchemaFile(je.join(e,Xc.responseSchema)),d=this.loadSchemaFile(je.join(e,Xc.bodySchema)),p=je.join(e,"doc.md"),m=Ne.existsSync(p)?Ne.readFileSync(p,"utf-8"):void 0;return this.slugToIdMap.set(r,i.id),this.idToSlugMap.set(i.id,r),{id:i.id,type:"request",name:i.name,description:i.description,method:i.method,url:i.url,params:i.params,query:i.query,headers:i.headers,body:o,bodyContentType:i.bodyContentType,auth:i.auth,settings:i.settings,scripts:s,disabled:i.disabled,deprecated:i.deprecated,operationId:i.operationId,summary:i.summary,tags:i.tags,examples:i.examples,responses:i.responses,security:i.security,...m&&{doc:m},...c&&{responseSchema:c},...d&&{bodySchema:d}}}catch(s){console.error(`[FolderCollectionStore] Failed to load request ${e}:`,s);return}}loadScriptsFromDir(e){return Oh(e)}loadBodyFromDir(e){return oq(e)}loadSchemaFile(e){return uq(e)}async saveSchemaFiles(e,r){return cq(e,r.responseSchema,r.bodySchema)}load(e){if(this.cache.has(e))return this.cache.get(e);let r=this.idToSlugMap.get(e);if(r){let n=this.loadCollectionFromFolder(r);return n&&this.cache.set(e,n),n}return this.loadAll(),this.cache.get(e)}async save(e){if(this.ensureDirectory(),!e.name)throw new Error("Collection name is required");e.id||(e.id=Pt(e.name));let r=this.idToSlugMap.get(e.id);if(!r){let l=Ne.readdirSync(this.collectionsDir);r=Ln(e.name,l),this.idToSlugMap.set(e.id,r),this.slugToIdMap.set(r,e.id)}let n=je.join(this.collectionsDir,r),i=!Ne.existsSync(n);await Ne.promises.mkdir(n,{recursive:!0});let s={id:e.id,name:e.name,description:e.description,version:e.version,variables:e.variables,auth:e.auth},[o]=await Promise.all([this.saveItemsToDir(n,e.items,i),e.scripts?this.saveScriptsToDir(je.join(n,Sn),e.scripts):Promise.resolve()]);o.length>0&&(s.order=o),await Ne.promises.writeFile(je.join(n,Lr.collection),JSON.stringify(s,null,2),"utf-8"),this.cache.set(e.id,e)}async saveItemsToDir(e,r,n=!1){let i=[],s=[];for(let o of r){let l=this.idToSlugMap.get(o.id);l||(l=Ln(o.name,i),this.idToSlugMap.set(o.id,l),this.slugToIdMap.set(l,o.id)),i.push(l),s.push({item:o,slug:l})}return await Promise.all(s.map(async({item:o,slug:l})=>{let c=je.join(e,l);await Ne.promises.mkdir(c,{recursive:!0}),o.type==="folder"?await this.saveFolderToDir(c,o,n):await this.saveRequestToDir(c,o,n)})),i}async saveFolderToDir(e,r,n=!1){let i={id:r.id,name:r.name,description:r.description,auth:r.auth},[s]=await Promise.all([r.items?this.saveItemsToDir(e,r.items,n):Promise.resolve([]),r.scripts?this.saveScriptsToDir(je.join(e,Sn),r.scripts):Promise.resolve()]);s.length>0&&(i.order=s),await Ne.promises.writeFile(je.join(e,Lr.folder),JSON.stringify(i,null,2),"utf-8")}async saveRequestToDir(e,r,n=!1){let{bodyForMetadata:i,externalBodyFile:s}=this.prepareBodyForSave(r.body),o={id:r.id,name:r.name,method:r.method||"GET",url:r.url||"",description:r.description,params:r.params,query:r.query,headers:r.headers,body:i,bodyContentType:r.bodyContentType,auth:r.auth,settings:r.settings,...r.disabled!==void 0&&{disabled:r.disabled},...r.deprecated&&{deprecated:r.deprecated},...r.operationId&&{operationId:r.operationId},...r.summary&&{summary:r.summary},...r.tags&&r.tags.length>0&&{tags:r.tags},...r.examples&&r.examples.length>0&&{examples:r.examples},...r.responses&&Object.keys(r.responses).length>0&&{responses:r.responses},...r.security&&r.security.length>0&&{security:r.security}},l=[Ne.promises.writeFile(je.join(e,Lr.request),JSON.stringify(o,null,2),"utf-8")];s&&l.push(Ne.promises.writeFile(je.join(e,s.filename),s.content,"utf-8")),n||l.push(this.cleanupOldBodyFiles(e,s?.filename)),(!n||r.responseSchema||r.bodySchema)&&l.push(this.saveSchemaFiles(e,r)),r.doc&&l.push(Ne.promises.writeFile(je.join(e,"doc.md"),r.doc,"utf-8")),r.scripts&&l.push(this.saveScriptsToDir(je.join(e,Sn),r.scripts)),await Promise.all(l)}prepareBodyForSave(e){return aq(e)}async cleanupOldBodyFiles(e,r){return lq(e,r)}async saveScriptsToDir(e,r){return Ih(e,r)}async delete(e){let r=this.idToSlugMap.get(e);if(!r&&(this.loadAll(),r=this.idToSlugMap.get(e),!r))return!1;let n=je.join(this.collectionsDir,r);if(!Ne.existsSync(n))return!1;try{return await Ne.promises.rm(n,{recursive:!0,force:!0}),this.cache.delete(e),this.idToSlugMap.delete(e),this.slugToIdMap.delete(r),!0}catch(i){return console.error(`[FolderCollectionStore] Failed to delete collection ${e}:`,i),!1}}exists(e){let r=this.idToSlugMap.get(e);return r?Ne.existsSync(je.join(this.collectionsDir,r,Lr.collection)):!1}getCollectionPath(e){let r=this.idToSlugMap.get(e)||e;return je.join(this.collectionsDir,r)}getItemPath(e,r){return this.findItemPath(e,r)}async create(e,r){let n={id:r||Pt(e),name:e,items:[]};return await this.save(n),n}async saveScripts(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.findItemPath(e,r);if(!s)throw new Error(`Item ${r} not found in collection ${e}`);await this.saveScriptsToDir(je.join(s,Sn),n);let o=this.findItemById(i.items,r);o&&(o.scripts=n)}loadScripts(e,r){let n=this.findItemPath(e,r);if(n)return this.loadScriptsFromDir(je.join(n,Sn))}async updateCollectionMetadata(e,r){let n=this.load(e);if(!n)throw new Error(`Collection ${e} not found`);let i=this.idToSlugMap.get(e);if(!i)throw new Error(`Collection slug not found for ${e}`);let s=je.join(this.collectionsDir,i),o=je.join(s,Lr.collection),l=Ne.readFileSync(o,"utf-8"),d={...JSON.parse(l),...r,id:e};await Ne.promises.writeFile(o,JSON.stringify(d,null,2),"utf-8"),r.name!==void 0&&(n.name=r.name),r.description!==void 0&&(n.description=r.description),r.version!==void 0&&(n.version=r.version),r.variables!==void 0&&(n.variables=r.variables),r.auth!==void 0&&(n.auth=r.auth)}async saveItem(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.idToSlugMap.get(e);if(!s)throw new Error(`Collection slug not found for ${e}`);let o;if(n){let p=this.findItemPath(e,n);if(!p)throw new Error(`Parent folder ${n} not found`);o=p}else o=je.join(this.collectionsDir,s);let l=this.idToSlugMap.get(r.id);if(!l){let p=Ne.readdirSync(o).filter(m=>Ne.statSync(je.join(o,m)).isDirectory()&&m!==Sn);l=Ln(r.name,p),this.idToSlugMap.set(r.id,l),this.slugToIdMap.set(l,r.id)}let c=je.join(o,l);await Ne.promises.mkdir(c,{recursive:!0}),r.type==="folder"?await this.saveFolderToDir(c,r):await this.saveRequestToDir(c,r);let d=this.findItemById(i.items,r.id);if(d)Object.assign(d,r);else if(n){let p=this.findItemById(i.items,n);p&&p.type==="folder"&&(p.items=p.items||[],p.items.push(r))}else i.items.push(r)}async deleteItem(e,r){let n=this.load(e);if(!n)return!1;let i=this.findItemPath(e,r);if(!i||!Ne.existsSync(i))return!1;try{await Ne.promises.rm(i,{recursive:!0,force:!0}),this.deleteItemFromTree(n.items,r);let s=this.idToSlugMap.get(r);return s&&(this.slugToIdMap.delete(s),this.idToSlugMap.delete(r)),!0}catch(s){return console.error(`[FolderCollectionStore] Failed to delete item ${r}:`,s),!1}}async updateItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.findItemPath(e,r);if(!s)return!1;let o=this.findItemById(i.items,r);if(!o)return!1;let{id:l,type:c,items:d,...p}=n;return Object.assign(o,p),o.type==="folder"?await this.saveFolderToDir(s,o):await this.saveRequestToDir(s,o),!0}async moveItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.idToSlugMap.get(e);if(!s)return!1;let o=this.findItemPath(e,r);if(!o||!Ne.existsSync(o))return!1;let l;if(n){let p=this.findItemPath(e,n);if(!p)return!1;l=p}else l=je.join(this.collectionsDir,s);let c=this.idToSlugMap.get(r);if(!c)return!1;let d=je.join(l,c);if(Ne.existsSync(d))return!1;try{await Ne.promises.rename(o,d);let p=this.findItemById(i.items,r);if(p){let m=p.type==="folder"?{...p,items:p.items?[...p.items]:[]}:{...p};if(this.deleteItemFromTree(i.items,r),n){let y=this.findItemById(i.items,n);y&&y.type==="folder"&&(y.items=y.items||[],y.items.push(m))}else i.items.push(m)}return!0}catch(p){return console.error(`[FolderCollectionStore] Failed to move item ${r}:`,p),!1}}async reorderItems(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.idToSlugMap.get(e);if(!s)return!1;let o=[];for(let l of n){let c=this.idToSlugMap.get(l);c&&o.push(c)}try{if(r){let l=this.findItemPath(e,r);if(!l)return!1;let c=je.join(l,Lr.folder),d=Ne.readFileSync(c,"utf-8"),p=JSON.parse(d);p.order=o,await Ne.promises.writeFile(c,JSON.stringify(p,null,2),"utf-8");let m=this.findItemById(i.items,r);m&&m.type==="folder"&&m.items&&(m.items=this.sortItemsByOrder(m.items,n))}else{let l=je.join(this.collectionsDir,s,Lr.collection),c=Ne.readFileSync(l,"utf-8"),d=JSON.parse(c);d.order=o,await Ne.promises.writeFile(l,JSON.stringify(d,null,2),"utf-8"),i.items=this.sortItemsByOrder(i.items,n)}return!0}catch(l){return console.error("[FolderCollectionStore] Failed to reorder items:",l),!1}}sortItemsByOrder(e,r){return fq(e,r)}findItemPath(e,r){let n=this.idToSlugMap.get(e);if(!n)return;let i=je.join(this.collectionsDir,n),s=sS(i,r);if(s)return s;let o=this.load(e);if(o){let c=this.buildSlugPath(o.items,r);if(c)return je.join(i,...c)}let l=this.idToSlugMap.get(r);if(l)return iS(i,l)}buildSlugPath(e,r){for(let n of e){let i=this.idToSlugMap.get(n.id);if(i){if(n.id===r)return[i];if(n.type==="folder"&&n.items){let s=this.buildSlugPath(n.items,r);if(s)return[i,...s]}}}}findItemById(e,r){return rS(e,r)}deleteItemFromTree(e,r){return nS(e,r)}}});var xt,ga=ae(()=>{"use strict";xt=class{static parseSetCookie(e,r){let n=e.split(";").map(p=>p.trim());if(n.length===0)return null;let[i,...s]=n,o=i.indexOf("=");if(o===-1)return null;let l=i.substring(0,o).trim(),c=i.substring(o+1).trim(),d={name:l,value:c,domain:r};for(let p of s){let m=p.indexOf("="),y=(m===-1?p:p.substring(0,m)).toLowerCase(),b=m===-1?"":p.substring(m+1);switch(y){case"domain":d.domain=b.startsWith(".")?b.substring(1):b;break;case"path":d.path=b;break;case"expires":d.expires=b;break;case"max-age":d.maxAge=parseInt(b,10);break;case"httponly":d.httpOnly=!0;break;case"secure":d.secure=!0;break;case"samesite":d.sameSite=b;break}}return d}static parseCookieHeaders(e,r){let n=[],i=e["set-cookie"]||e["Set-Cookie"];if(!i)return n;let s=Array.isArray(i)?i:[i];for(let o of s){let l=this.parseSetCookie(o,r);l&&n.push(l)}return n}static formatCookieHeader(e){return e.map(r=>`${r.name}=${r.value}`).join("; ")}static isExpired(e){return!!(e.expires&&new Date(e.expires).getTime()<Date.now()||e.maxAge!==void 0&&e.maxAge<=0)}static domainMatches(e,r){if(r==="*")return!0;let n=e.toLowerCase().split(".").reverse(),i=r.toLowerCase().split(".").reverse();if(i.length>n.length)return!1;for(let s=0;s<i.length;s++)if(i[s]!==n[s])return!1;return!0}static extractDomain(e){try{return new URL(e).hostname}catch{return""}}static extractPath(e){try{return new URL(e).pathname}catch{return"/"}}}});import*as oo from"fs";import*as ya from"path";function Ah(t){let e=t.toLowerCase();return e==="_global.json"||e==="_global.local.json"||e.endsWith(".local.json")}function nf(t){if(!oo.existsSync(t))return BL();let e=kh(ya.join(t,"_global.json"))||{},r=e.variables||{},n=e.defaultHeaders||{},i=oo.readdirSync(t).filter(d=>d.endsWith(".json")).filter(d=>!d.endsWith(".local.json")).filter(d=>!Ah(d)),s={};for(let d of i){let p=kh(ya.join(t,d))||{},m=ya.basename(d,".json");s[m]={description:p.description,requiresConfirmation:p.requiresConfirmation,variables:p.variables||{},secretVariables:p.secretVariables}}let l=(kh(ya.join(t,"_global.local.json"))||{}).variables||{},c={};for(let d of Object.keys(s)){let p=ya.join(t,`${d}.local.json`);if(oo.existsSync(p)){let m=kh(p)||{};c[d]={variables:m.variables||{}}}}return{globalVariables:r,defaultHeaders:n,environments:s,localVariables:l,localCredentials:c}}function BL(){return{globalVariables:{},defaultHeaders:{},environments:{},localVariables:{},localCredentials:{}}}function kh(t){try{if(!oo.existsSync(t))return null;let e=oo.readFileSync(t,"utf-8");return JSON.parse(e)}catch(e){return console.error(`[environment-file-loader] Failed to load JSON from ${t}:`,e),null}}var Th=ae(()=>{"use strict"});var li,Xl=ae(()=>{"use strict";li=class{buildUrl(e,r={},n={}){let i=e;return i=this.replacePathParams(i,r),i=this.appendQueryParams(i,n),i}replacePathParams(e,r){let n="",i="",s=e,o="",l=e.indexOf("?");l!==-1&&(o=e.substring(l),s=e.substring(0,l));let c=s.match(/^(https?:\/\/)([^\/]*)(\/.*)?$/);c&&(n=c[1],i=c[2],s=c[3]||"/");let d=/:(\w+)(?:\([^)]*\))?(\?)?/g,p=s.replace(d,(m,y,b)=>{let E=r[y];return E!==void 0&&E!==""?encodeURIComponent(E):b?"":(console.warn(`[UrlBuilder] Missing required path parameter: ${y}`),m)});return p=p.replace(/([^:])\/+/g,"$1/"),p.length>1&&p.endsWith("/")&&(p=p.slice(0,-1)),`${n}${i}${p}${o}`}extractPathParams(e){let r=/:(\w+)(?:\([^)]*\))?(\?)?/g,n=[],i;for(;(i=r.exec(e))!==null;)n.push(i[1]);return[...new Set(n)]}appendQueryParams(e,r){let n=e,i={};if(e.includes("?")){let[c,d]=e.split("?");n=c,d&&new URLSearchParams(d).forEach((m,y)=>{i[y]=m})}let s={...i,...r},o=new URLSearchParams;for(let[c,d]of Object.entries(s))d!=null&&o.append(c,d);let l=o.toString();return l?`${n}?${l}`:n}}});function pq(t,e=0){return(pr[t[e+0]]+pr[t[e+1]]+pr[t[e+2]]+pr[t[e+3]]+"-"+pr[t[e+4]]+pr[t[e+5]]+"-"+pr[t[e+6]]+pr[t[e+7]]+"-"+pr[t[e+8]]+pr[t[e+9]]+"-"+pr[t[e+10]]+pr[t[e+11]]+pr[t[e+12]]+pr[t[e+13]]+pr[t[e+14]]+pr[t[e+15]]).toLowerCase()}var pr,hq=ae(()=>{pr=[];for(let t=0;t<256;++t)pr.push((t+256).toString(16).slice(1))});function lS(){return crypto.getRandomValues(VL)}var VL,mq=ae(()=>{VL=new Uint8Array(16)});function WL(t,e,r){return!e&&!t&&crypto.randomUUID?crypto.randomUUID():zL(t,e,r)}function zL(t,e,r){t=t||{};let n=t.random??t.rng?.()??lS();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[r+i]=n[i];return e}return pq(n)}var eu,gq=ae(()=>{mq();hq();eu=WL});var uS=ae(()=>{gq()});function JL(t=0,e=999){return Math.floor(Math.random()*(e-t+1))+t}function GL(){return Date.now()}function yq(){return eu()}function YL(){return eu()}function vq(t=10){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r="";for(let n=0;n<t;n++)r+=e.charAt(Math.floor(Math.random()*e.length));return r}function KL(){let t=vq(8).toLowerCase(),e=["example.com","test.org","mail.dev","sample.net"];return`${t}@${e[Math.floor(Math.random()*e.length)]}`}function QL(){return Math.random()<.5}function ZL(t=10){let e="0123456789abcdef",r="";for(let n=0;n<t;n++)r+=e.charAt(Math.floor(Math.random()*e.length));return r}function XL(){return Math.floor(Date.now()/1e3)}function e2(){return new Date().toISOString()}function t2(){return new Date().toISOString().split("T")[0]}function r2(){return new Date().toISOString().split("T")[1].split(".")[0]}function n2(){return new Date().toISOString()}function i2(t=""){return Buffer.from(String(t)).toString("base64")}function s2(t=""){return Buffer.from(String(t),"base64").toString("utf-8")}function o2(t=""){return encodeURIComponent(String(t))}function a2(t=""){return decodeURIComponent(String(t))}function l2(t){return t?t.split(",").map(e=>{let r=e.trim(),n=Number(r);return!isNaN(n)&&r!==""?n:r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'")?r.slice(1,-1):r}):[]}function ys(t,e){let r=bq[t];return r?e&&e.length>0?r(...e):r():null}function u2(t){return!t||typeof t!="string"?t:t.replace(/\{\{\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?\}\}/g,(e,r,n)=>{try{let i=n?l2(n):void 0,s=ys(r,i);return s===null?e:String(s)}catch{return e}})}function va(t,e){let r=/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,n=null,i;for(;(i=r.exec(t))!==null;){let s=i[0],o=i[1];if(!(s in e)){let l=ys(o);l!==null&&(n||(n={...e}),n[s]=l)}}return n??e}var bq,$h=ae(()=>{"use strict";uS();bq={randomInt:JL,timestamp:GL,guid:YL,uuid:yq,randomUUID:yq,randomString:vq,randomHexadecimal:ZL,randomEmail:KL,randomBoolean:QL,isoTimestamp:n2,timestamp_s:XL,datetime:e2,date:t2,time:r2,base64Encode:i2,base64Decode:s2,urlEncode:o2,urlDecode:a2}});import*as Nh from"vm";function ba(t){let e=t.trim();return!e||/^(\$?)[a-zA-Z_][a-zA-Z0-9_]*(\([^)]*\))?$/.test(e)||/(?<!\|)\|(?!\|)/.test(e)?!1:/[+\-*/%<>=!&|?:~^()[\]{}.,`]/.test(e)}function Ui(t,e={}){try{let r={...e,Math,Date,JSON,Number,String,Boolean,Array,Object,parseInt,parseFloat,isNaN,isFinite,encodeURIComponent,decodeURIComponent,encodeURI,decodeURI,undefined:void 0,null:null,true:!0,false:!1,NaN:NaN,Infinity:1/0},n=Nh.createContext(r);return Nh.runInContext(t,n,{timeout:c2,displayErrors:!1})}catch{return}}var c2,sf=ae(()=>{"use strict";c2=100});import*as Mh from"crypto";function f2(t){if(typeof t=="string"&&t.charCodeAt(0)===30)try{return JSON.parse(t.slice(1))}catch{return t}return t}function af(t){if(!t||!t.includes("|"))return null;let e=d2(t);if(e.length<2)return null;let r=e[0].trim(),n=[];for(let i=1;i<e.length;i++){let s=e[i].trim();if(!s)continue;let o=p2(s);o&&n.push(o)}return n.length===0?null:{input:r,filters:n}}function d2(t){let e=[],r="",n=0,i=!1,s=!1;for(let o=0;o<t.length;o++){let l=t[o],c=o>0?t[o-1]:"",d=o<t.length-1?t[o+1]:"";if(c==="\\"){r+=l;continue}if(l==="'"&&!s)i=!i;else if(l==='"'&&!i)s=!s;else if(l==="("&&!i&&!s)n++;else if(l===")"&&!i&&!s)n--;else if(l==="|"&&n===0&&!i&&!s){if(d==="|"){r+="||",o++;continue}e.push(r),r="";continue}r+=l}return r&&e.push(r),e}function p2(t){let e=t.indexOf("(");if(e===-1)return{name:t.trim(),args:[]};let r=t.substring(0,e).trim(),n=t.substring(e+1,t.lastIndexOf(")"));return{name:r,args:h2(n)}}function h2(t){if(!t||!t.trim())return[];let e=[],r="",n=!1,i=!1;for(let s=0;s<t.length;s++){let o=t[s];if((s>0?t[s-1]:"")==="\\"){r+=o;continue}if(o==="'"&&!i){n=!n,r+=o;continue}else if(o==='"'&&!n){i=!i,r+=o;continue}else if(o===","&&!n&&!i){e.push(r.trim()),r="";continue}r+=o}return r.trim()&&e.push(r.trim()),e}function Wt(t,e){if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);let r=Number(t);if(!isNaN(r)&&t!=="")return r;if(t==="true")return!0;if(t==="false")return!1;if(e&&t in e){let n=f2(e[t]),i=Number(n);return!isNaN(i)&&n!==""?i:n}return t}function lf(t,e,r={}){let n=t;for(let i of e)n=m2(n,i.name,i.args,r);return n}function m2(t,e,r,n){switch(e){case"upper":return String(t).toUpperCase();case"lower":return String(t).toLowerCase();case"trim":return String(t).trim();case"length":return Array.isArray(t)?t.length:String(t).length;case"substring":{let i=Wt(r[0],n),s=r[1]!==void 0?Wt(r[1],n):void 0;return String(t).substring(i<0?String(t).length+i:i,s!==void 0?s<0?String(t).length+s:s:void 0)}case"replace":{let i=r[0]!==void 0?String(Wt(r[0],n)):"",s=r[1]!==void 0?String(Wt(r[1],n)):"";return String(t).replace(new RegExp(y2(i),"g"),s)}case"split":{let i=r[0]!==void 0?String(Wt(r[0],n)):",";return String(t).split(i)}case"join":{let i=r[0]!==void 0?String(Wt(r[0],n)):",";return Array.isArray(t)?t.join(i):String(t)}case"removeQuotes":return String(t).replace(/["']/g,"");case"removeSpaces":return String(t).replace(/\s/g,"");case"format":{let i=r[0]!==void 0?String(Wt(r[0],n)):"{0}";i=i.replace("{0}",String(t));for(let s=1;s<r.length;s++){let o=Wt(r[s],n);i=i.replace(`{${s}}`,String(o))}return i}case"add":{let i=Wt(r[0],n);return Number(t)+i}case"subtract":{let i=Wt(r[0],n);return Number(t)-i}case"multiply":{let i=Wt(r[0],n);return Number(t)*i}case"abs":return Math.abs(Number(t));case"btoa":return Buffer.from(String(t)).toString("base64");case"atob":return Buffer.from(String(t),"base64").toString("utf-8");case"urlEncode":return encodeURIComponent(String(t));case"urlDecode":return decodeURIComponent(String(t));case"hash":{let i=String(r[0]!==void 0?Wt(r[0],n):"md5").toLowerCase(),s=String(r[1]!==void 0?Wt(r[1],n):"base64"),l={md5:"md5",sha1:"sha1",sha256:"sha256",sha512:"sha512"}[i]||"md5";return Mh.createHash(l).update(String(t)).digest(s)}case"hmac":{let i=r[0]?String(Wt(r[0],n)):"",s=String(r[1]!==void 0?Wt(r[1],n):"sha256").toLowerCase(),o=String(r[2]!==void 0?Wt(r[2],n):"base64"),c={md5:"md5",sha1:"sha1",sha256:"sha256",sha512:"sha512"}[s]||"sha256";return Mh.createHmac(c,i).update(String(t)).digest(o)}case"first":return Array.isArray(t)?t[0]:t;case"last":return Array.isArray(t)?t[t.length-1]:t;case"at":{let i=Wt(r[0],n);return Array.isArray(t)?t.at(i):t}case"slice":{let i=Wt(r[0],n),s=r[1]!==void 0?Wt(r[1],n):void 0;return Array.isArray(t)?t.slice(i,s):String(t).slice(i,s)}case"unique":return Array.isArray(t)?[...new Set(t)]:t;case"filter":return!Array.isArray(t)||!r[0]?t:g2(t,r[0],n);case"map":{if(!Array.isArray(t))return t;let i=r.map(s=>String(Wt(s,n)));return i.length===1?t.map(s=>of(s,i[0])):t.map(s=>{let o={};for(let l of i){let c=of(s,l);c!==void 0&&(o[l]=c)}return o})}case"prop":{let i=r[0]!==void 0?String(Wt(r[0],n)):"";if(Array.isArray(t)){let s=t.map(o=>of(o,i)).filter(o=>o!==void 0);return s.length===1?s[0]:s.join(",")}return t&&typeof t=="object"?of(t,i):t}case"parseJSON":try{return JSON.parse(String(t))}catch{return t}case"stringify":try{return JSON.stringify(t)}catch{return String(t)}case"isEmail":return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t));case"isUrl":try{return new URL(String(t)),!0}catch{return!1}case"setIfValue":return t||void 0;case"setNull":return t===null?null:t;default:return t}}function g2(t,e,r){let n=e.match(/^([\w.]+)\s*(>=|<=|!=|\*=|\^=|\$=|>|<|=)\s*(.+)$/);if(!n)return t;let[,i,s,o]=n,l=Wt(o,r);return t.filter(c=>{let d=of(c,i);if(d===void 0)return!1;switch(s){case">":return Number(d)>Number(l);case">=":return Number(d)>=Number(l);case"<":return Number(d)<Number(l);case"<=":return Number(d)<=Number(l);case"=":return String(d)===String(l);case"!=":return String(d)!==String(l);case"*=":return String(d).includes(String(l));case"^=":return String(d).startsWith(String(l));case"$=":return String(d).endsWith(String(l));default:return!0}})}function of(t,e){if(!(!t||typeof t!="object"))return e in t?t[e]:e.split(".").reduce((r,n)=>r?.[n],t)}function y2(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Fh=ae(()=>{"use strict"});function Sq(t,e){if(t)return t.split(",").map(r=>{let n=r.trim();if(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))return n.slice(1,-1);let i=Number(n);if(!isNaN(i)&&n!=="")return i;if(e&&n in e){let s=e[n],o=Number(s);return!isNaN(o)&&s!==""?o:s}return n})}function v2(t){return new Sa(t)}var Sa,wa,uf=ae(()=>{"use strict";$h();sf();Fh();Sa=class t{allVariables;static MAX_RESOLUTION_DEPTH=20;constructor(e){this.allVariables={...e.globals,...e.collectionVariables,...e.environmentVariables,...e.variables}}resolveString(e,r=!1){return typeof e!="string"?e:this.resolveUntilStable(e,this.allVariables,r)}resolveStringWithExtra(e,r,n=!1){if(typeof e!="string")return e;let i={...this.allVariables,...r};return this.resolveUntilStable(e,i,n)}resolveUntilStable(e,r,n){let i=e;for(let s=0;s<t.MAX_RESOLUTION_DEPTH;s++){let o=this.resolveSinglePass(i,r,n);if(o===i)break;i=o}return i}resolveSinglePass(e,r,n){if(!n)return e.replace(/\{\{((?:[^}]|\}(?!\}))+)\}\}/g,(c,d)=>this.resolveTemplateContent(d.trim(),r,c));let i="",s=0,o=/\{\{((?:[^}]|\}(?!\}))+)\}\}/g,l;for(;(l=o.exec(e))!==null;){let c=l[1].trim(),d=this.resolveTemplateContent(c,r,l[0]);if(d!==l[0]){i+=e.slice(s,l.index);let p=this.getStringContext(e,l.index);i+=p?this.escapeForString(String(d),p):String(d)}else i+=e.slice(s,l.index+l[0].length);s=l.index+l[0].length}return i+=e.slice(s),i}resolveObject(e,r=!1){if(typeof e=="string")return this.resolveString(e,r);if(Array.isArray(e))return e.map(n=>this.resolveObject(n,r));if(e!==null&&typeof e=="object"){let n={};for(let[i,s]of Object.entries(e))n[i]=this.resolveObject(s,r);return n}return e}resolveObjectWithExtra(e,r,n=!1){if(typeof e=="string")return this.resolveStringWithExtra(e,r,n);if(Array.isArray(e))return e.map(i=>this.resolveObjectWithExtra(i,r,n));if(e!==null&&typeof e=="object"){let i={};for(let[s,o]of Object.entries(e))i[s]=this.resolveObjectWithExtra(o,r,n);return i}return e}resolveTemplateContent(e,r,n){let i=e.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(i){let l=Sq(i[2],r),c=ys(i[1],l);return c!==null?String(c):n}let s=af(e);if(s){let l=this.resolveFilterInput(s.input,r);if(l!==void 0){let c=lf(l,s.filters,r);return c!==void 0?String(c):n}return n}let o=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(\[.+\]|\..+)$/);if(o){let l=o[1];if(r[l]!==void 0){let c=this.deserializeValue(r[l]),d=o[2],p=this.resolvePropertyAccess(c,d);if(p!==void 0)return typeof p=="object"?JSON.stringify(p):String(p)}}if(r[e]!==void 0){let l=r[e];return typeof l=="string"&&l.charCodeAt(0)===30?l.slice(1):String(l)}if(ba(e)){let l=this.deserializeVariables(r),c=va(e,l),d=Ui(e,c);if(d!==void 0)return String(d)}return n}resolveFilterInput(e,r){if(e==="@")return"";if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1);let n=e.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(n){let s=Sq(n[2],r),o=ys(n[1],s);return o!==null?o:void 0}let i=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(\[.+\]|\..+)$/);if(i){let s=i[1];if(r[s]!==void 0){let o=this.deserializeValue(r[s]),l=this.resolvePropertyAccess(o,i[2]);if(l!==void 0)return l}}if(r[e]!==void 0)return this.deserializeValue(r[e]);if(ba(e)){let s=this.deserializeVariables(r),o=va(e,s),l=Ui(e,o);if(l!==void 0)return l}}deserializeValue(e){if(typeof e=="string"&&e.charCodeAt(0)===30)try{return JSON.parse(e.slice(1))}catch{return e}return e}deserializeVariables(e){let r={};for(let[n,i]of Object.entries(e))r[n]=this.deserializeValue(i);return r}resolvePropertyAccess(e,r){let n=e,i=/\[(\d+|"[^"]*"|'[^']*')\]|\.([a-zA-Z_][a-zA-Z0-9_]*)/g,s;for(;(s=i.exec(r))!==null;){if(n==null)return;if(s[1]!==void 0){let o=s[1];/^\d+$/.test(o)?n=n[Number(o)]:n=n[o.slice(1,-1)]}else s[2]!==void 0&&(n=n[s[2]])}return n}escapeForString(e,r){let n=e.replace(/\\/g,"\\\\");return r==='"'?n=n.replace(/"/g,'\\"'):n=n.replace(/'/g,"\\'"),n.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}getStringContext(e,r){let n=null;for(let i=0;i<r;i++){let s=e[i];(i>0?e[i-1]:"")!=="\\"&&(s==='"'||s==="'")&&(n===null?n=s:n===s&&(n=null))}return n}},wa=class{interpolate(e,r){return!e||typeof e!="string"?e:new Sa({globals:{},collectionVariables:{},environmentVariables:{},variables:r}).resolveString(e,!0)}extractVariables(e){if(!e||typeof e!="string")return[];let r=[],n,i=/\{\{((?:[^}]|\}(?!\}))+)\}\}/g;for(;(n=i.exec(e))!==null;){let s=n[1].trim();!s.startsWith("$")&&!s.includes("|")&&/^[a-zA-Z_]\w*$/.test(s)&&(r.includes(s)||r.push(s))}return r}interpolateObject(e,r){if(e==null)return e;if(typeof e=="string")return this.interpolate(e,r);if(Array.isArray(e))return e.map(n=>this.interpolateObject(n,r));if(typeof e=="object"){let n={};for(let[i,s]of Object.entries(e))n[i]=this.interpolateObject(s,r);return n}return e}}});var vs,cf=ae(()=>{"use strict";vs=class{constructor(e,r,n){this.urlBuilder=e;this.interceptors=r;this.httpClient=n}urlBuilder;interceptors;httpClient;async execute(e){let r={},n;try{n=await this.interceptors.executeRequestInterceptors(e,r)}catch(i){let s=await this.interceptors.executeErrorInterceptors(i,e,r);if(s)return s;throw i}try{let i=await this.httpClient.send(n);return await this.interceptors.executeResponseInterceptors(i,n,r)}catch(i){let s=await this.interceptors.executeErrorInterceptors(i,n,r);if(s)return s;throw i}}buildUrl(e,r={},n={}){return this.urlBuilder.buildUrl(e,r,n)}}});var bs,cS,fS,dS,ff=ae(()=>{"use strict";bs=class{requestInterceptors=[];responseInterceptors=[];errorInterceptors=[];addRequestInterceptor(e){return this.requestInterceptors.push(e),this.sortByPriority(this.requestInterceptors),this}addResponseInterceptor(e){return this.responseInterceptors.push(e),this.sortByPriority(this.responseInterceptors),this}addErrorInterceptor(e){return this.errorInterceptors.push(e),this.sortByPriority(this.errorInterceptors),this}removeRequestInterceptor(e){let r=this.requestInterceptors.findIndex(n=>n.name===e);return r>=0?(this.requestInterceptors.splice(r,1),!0):!1}removeResponseInterceptor(e){let r=this.responseInterceptors.findIndex(n=>n.name===e);return r>=0?(this.responseInterceptors.splice(r,1),!0):!1}removeErrorInterceptor(e){let r=this.errorInterceptors.findIndex(n=>n.name===e);return r>=0?(this.errorInterceptors.splice(r,1),!0):!1}async executeRequestInterceptors(e,r){let n=e;for(let i of this.requestInterceptors)try{n=await i.intercept(n,r)}catch(s){throw console.error(`[InterceptorChain] Request interceptor '${i.name}' failed:`,s),s}return n}async executeResponseInterceptors(e,r,n){let i=e;for(let s of this.responseInterceptors)try{i=await s.intercept(i,r,n)}catch(o){throw console.error(`[InterceptorChain] Response interceptor '${s.name}' failed:`,o),o}return i}async executeErrorInterceptors(e,r,n){for(let i of this.errorInterceptors)try{let s=await i.handle(e,r,n);if(s)return s}catch(s){console.error(`[InterceptorChain] Error interceptor '${i.name}' failed:`,s)}}clear(){this.requestInterceptors=[],this.responseInterceptors=[],this.errorInterceptors=[]}getRegisteredInterceptors(){return{request:this.requestInterceptors.map(e=>e.name),response:this.responseInterceptors.map(e=>e.name),error:this.errorInterceptors.map(e=>e.name)}}sortByPriority(e){e.sort((r,n)=>(r.priority??100)-(n.priority??100))}},cS=class{name="logging";priority=1e3;intercept(e,r){return e}},fS=class{name="timing";priority=1;intercept(e,r,n){return e}},dS=class{name="retry";priority=1;maxRetries;retryableErrors;constructor(e=3,r=["ECONNRESET","ETIMEDOUT"]){this.maxRetries=e,this.retryableErrors=r}handle(e,r,n){let i=this.retryableErrors.some(s=>e.message.includes(s))}}});var wq=V((tu,df)=>{(function(){var t,e="4.18.1",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",s="Invalid `variable` option passed into `_.template`",o="Invalid `imports` option passed into `_.template`",l="__lodash_hash_undefined__",c=500,d="__lodash_placeholder__",p=1,m=2,y=4,b=1,E=2,C=1,v=2,_=4,q=8,k=16,O=32,M=64,j=128,I=256,R=512,A=30,F="...",U=800,D=16,J=1,Q=2,se=3,ce=1/0,Be=9007199254740991,_e=17976931348623157e292,me=NaN,ke=4294967295,mt=ke-1,Nt=ke>>>1,pe=[["ary",j],["bind",C],["bindKey",v],["curry",q],["curryRight",k],["flip",R],["partial",O],["partialRight",M],["rearg",I]],Gt="[object Arguments]",Pr="[object Array]",lt="[object AsyncFunction]",kr="[object Boolean]",vr="[object Date]",Ct="[object DOMException]",St="[object Error]",Wr="[object Function]",Ms="[object GeneratorFunction]",At="[object Map]",Pi="[object Number]",En="[object Null]",te="[object Object]",ne="[object Promise]",Ie="[object Proxy]",ye="[object RegExp]",ve="[object Set]",Ye="[object String]",ur="[object Symbol]",Ae="[object Undefined]",ge="[object WeakMap]",qn="[object WeakSet]",fn="[object ArrayBuffer]",gt="[object DataView]",Ee="[object Float32Array]",On="[object Float64Array]",cl="[object Int8Array]",Fs="[object Int16Array]",Uo="[object Int32Array]",Ds="[object Uint8Array]",ki="[object Uint8ClampedArray]",js="[object Uint16Array]",mc="[object Uint32Array]",fl=/\b__p \+= '';/g,Ly=/\b(__p \+=) '' \+/g,Ho=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ts=/&(?:amp|lt|gt|quot|#39);/g,dl=/[&<>"']/g,pl=RegExp(ts.source),he=RegExp(dl.source),Uy=/<%-([\s\S]+?)%>/g,Hy=/<%([\s\S]+?)%>/g,In=/<%=([\s\S]+?)%>/g,zr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ve=/^\w*$/,gc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ft=/[\\^$.*+?()[\]{}|]/g,Bo=RegExp(ft.source),yc=/^\s+/,hl=/\s/,cr=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Kn=/\{\n\/\* \[wrapped with (.+)\] \*/,Pn=/,? & /,Yt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Jr=/[()=,{}\[\]\/\s]/,Qn=/\\(\\)?/g,rs=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,mp=/\w*$/,By=/^[-+]0x[0-9a-f]+$/i,Vo=/^0b[01]+$/i,gp=/^\[object .+?Constructor\]$/,Vy=/^0o[0-7]+$/i,Ls=/^(?:0|[1-9]\d*)$/,Wo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,zo=/($^)/,Wy=/['\n\r\u2028\u2029\\]/g,ml="\\ud800-\\udfff",zy="\\u0300-\\u036f",Lt="\\ufe20-\\ufe2f",vc="\\u20d0-\\u20ff",yp=zy+Lt+vc,bc="\\u2700-\\u27bf",Sc="a-z\\xdf-\\xf6\\xf8-\\xff",Jy="\\xac\\xb1\\xd7\\xf7",Gy="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Yy="\\u2000-\\u206f",Ky=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",vp="A-Z\\xc0-\\xd6\\xd8-\\xde",bp="\\ufe0e\\ufe0f",wc=Jy+Gy+Yy+Ky,gl="['\u2019]",Qy="["+ml+"]",Sp="["+wc+"]",yl="["+yp+"]",_c="\\d+",Zy="["+bc+"]",Us="["+Sc+"]",Jo="[^"+ml+wc+_c+bc+Sc+vp+"]",vl="\\ud83c[\\udffb-\\udfff]",Go="(?:"+yl+"|"+vl+")",kn="[^"+ml+"]",Rc="(?:\\ud83c[\\udde6-\\uddff]){2}",Cc="[\\ud800-\\udbff][\\udc00-\\udfff]",Hs="["+vp+"]",wp="\\u200d",_p="(?:"+Us+"|"+Jo+")",Xy="(?:"+Hs+"|"+Jo+")",Rp="(?:"+gl+"(?:d|ll|m|re|s|t|ve))?",Cp="(?:"+gl+"(?:D|LL|M|RE|S|T|VE))?",bl=Go+"?",xp="["+bp+"]?",Ep="(?:"+wp+"(?:"+[kn,Rc,Cc].join("|")+")"+xp+bl+")*",ev="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tv="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",qp=xp+bl+Ep,rv="(?:"+[Zy,Rc,Cc].join("|")+")"+qp,nv="(?:"+[kn+yl+"?",yl,Rc,Cc,Qy].join("|")+")",iv=RegExp(gl,"g"),sv=RegExp(yl,"g"),xc=RegExp(vl+"(?="+vl+")|"+nv+qp,"g"),ov=RegExp([Hs+"?"+Us+"+"+Rp+"(?="+[Sp,Hs,"$"].join("|")+")",Xy+"+"+Cp+"(?="+[Sp,Hs+_p,"$"].join("|")+")",Hs+"?"+_p+"+"+Rp,Hs+"+"+Cp,tv,ev,_c,rv].join("|"),"g"),av=RegExp("["+wp+ml+yp+bp+"]"),lv=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,uv=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],cv=-1,It={};It[Ee]=It[On]=It[cl]=It[Fs]=It[Uo]=It[Ds]=It[ki]=It[js]=It[mc]=!0,It[Gt]=It[Pr]=It[fn]=It[kr]=It[gt]=It[vr]=It[St]=It[Wr]=It[At]=It[Pi]=It[te]=It[ye]=It[ve]=It[Ye]=It[ge]=!1;var Et={};Et[Gt]=Et[Pr]=Et[fn]=Et[gt]=Et[kr]=Et[vr]=Et[Ee]=Et[On]=Et[cl]=Et[Fs]=Et[Uo]=Et[At]=Et[Pi]=Et[te]=Et[ye]=Et[ve]=Et[Ye]=Et[ur]=Et[Ds]=Et[ki]=Et[js]=Et[mc]=!0,Et[St]=Et[Wr]=Et[ge]=!1;var Ec={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},qc={"&":"&","<":"<",">":">",'"':""","'":"'"},fv={"&":"&","<":"<",">":">",""":'"',"'":"'"},Op={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ip=parseFloat,dv=parseInt,Pp=typeof global=="object"&&global&&global.Object===Object&&global,pv=typeof self=="object"&&self&&self.Object===Object&&self,Xt=Pp||pv||Function("return this")(),Sl=typeof tu=="object"&&tu&&!tu.nodeType&&tu,dt=Sl&&typeof df=="object"&&df&&!df.nodeType&&df,Bs=dt&&dt.exports===Sl,ns=Bs&&Pp.process,Gr=(function(){try{var W=dt&&dt.require&&dt.require("util").types;return W||ns&&ns.binding&&ns.binding("util")}catch{}})(),Oc=Gr&&Gr.isArrayBuffer,kp=Gr&&Gr.isDate,Ap=Gr&&Gr.isMap,Yo=Gr&&Gr.isRegExp,Zn=Gr&&Gr.isSet,wl=Gr&&Gr.isTypedArray;function Ar(W,Z,Y){switch(Y.length){case 0:return W.call(Z);case 1:return W.call(Z,Y[0]);case 2:return W.call(Z,Y[0],Y[1]);case 3:return W.call(Z,Y[0],Y[1],Y[2])}return W.apply(Z,Y)}function Xn(W,Z,Y,de){for(var Oe=-1,ut=W==null?0:W.length;++Oe<ut;){var vt=W[Oe];Z(de,vt,Y(vt),W)}return de}function Tr(W,Z){for(var Y=-1,de=W==null?0:W.length;++Y<de&&Z(W[Y],Y,W)!==!1;);return W}function Ic(W,Z){for(var Y=W==null?0:W.length;Y--&&Z(W[Y],Y,W)!==!1;);return W}function Tp(W,Z){for(var Y=-1,de=W==null?0:W.length;++Y<de;)if(!Z(W[Y],Y,W))return!1;return!0}function Ai(W,Z){for(var Y=-1,de=W==null?0:W.length,Oe=0,ut=[];++Y<de;){var vt=W[Y];Z(vt,Y,W)&&(ut[Oe++]=vt)}return ut}function _l(W,Z){var Y=W==null?0:W.length;return!!Y&&is(W,Z,0)>-1}function Vs(W,Z,Y){for(var de=-1,Oe=W==null?0:W.length;++de<Oe;)if(Y(Z,W[de]))return!0;return!1}function qt(W,Z){for(var Y=-1,de=W==null?0:W.length,Oe=Array(de);++Y<de;)Oe[Y]=Z(W[Y],Y,W);return Oe}function Ti(W,Z){for(var Y=-1,de=Z.length,Oe=W.length;++Y<de;)W[Oe+Y]=Z[Y];return W}function Pc(W,Z,Y,de){var Oe=-1,ut=W==null?0:W.length;for(de&&ut&&(Y=W[++Oe]);++Oe<ut;)Y=Z(Y,W[Oe],Oe,W);return Y}function hv(W,Z,Y,de){var Oe=W==null?0:W.length;for(de&&Oe&&(Y=W[--Oe]);Oe--;)Y=Z(Y,W[Oe],Oe,W);return Y}function Rl(W,Z){for(var Y=-1,de=W==null?0:W.length;++Y<de;)if(Z(W[Y],Y,W))return!0;return!1}var mv=Ko("length");function gv(W){return W.split("")}function yv(W){return W.match(Yt)||[]}function $p(W,Z,Y){var de;return Y(W,function(Oe,ut,vt){if(Z(Oe,ut,vt))return de=ut,!1}),de}function Cl(W,Z,Y,de){for(var Oe=W.length,ut=Y+(de?1:-1);de?ut--:++ut<Oe;)if(Z(W[ut],ut,W))return ut;return-1}function is(W,Z,Y){return Z===Z?Ev(W,Z,Y):Cl(W,ss,Y)}function vv(W,Z,Y,de){for(var Oe=Y-1,ut=W.length;++Oe<ut;)if(de(W[Oe],Z))return Oe;return-1}function ss(W){return W!==W}function Np(W,Z){var Y=W==null?0:W.length;return Y?Ac(W,Z)/Y:me}function Ko(W){return function(Z){return Z==null?t:Z[W]}}function kc(W){return function(Z){return W==null?t:W[Z]}}function xl(W,Z,Y,de,Oe){return Oe(W,function(ut,vt,Xe){Y=de?(de=!1,ut):Z(Y,ut,vt,Xe)}),Y}function bv(W,Z){var Y=W.length;for(W.sort(Z);Y--;)W[Y]=W[Y].value;return W}function Ac(W,Z){for(var Y,de=-1,Oe=W.length;++de<Oe;){var ut=Z(W[de]);ut!==t&&(Y=Y===t?ut:Y+ut)}return Y}function Tc(W,Z){for(var Y=-1,de=Array(W);++Y<W;)de[Y]=Z(Y);return de}function Sv(W,Z){return qt(Z,function(Y){return[Y,W[Y]]})}function $c(W){return W&&W.slice(0,Lp(W)+1).replace(yc,"")}function $r(W){return function(Z){return W(Z)}}function El(W,Z){return qt(Z,function(Y){return W[Y]})}function yt(W,Z){return W.has(Z)}function Mp(W,Z){for(var Y=-1,de=W.length;++Y<de&&is(Z,W[Y],0)>-1;);return Y}function Fp(W,Z){for(var Y=W.length;Y--&&is(Z,W[Y],0)>-1;);return Y}function Dp(W,Z){for(var Y=W.length,de=0;Y--;)W[Y]===Z&&++de;return de}var wv=kc(Ec),_v=kc(qc);function Rv(W){return"\\"+Op[W]}function Qo(W,Z){return W==null?t:W[Z]}function Ws(W){return av.test(W)}function Cv(W){return lv.test(W)}function xv(W){for(var Z,Y=[];!(Z=W.next()).done;)Y.push(Z.value);return Y}function zs(W){var Z=-1,Y=Array(W.size);return W.forEach(function(de,Oe){Y[++Z]=[Oe,de]}),Y}function Zo(W,Z){return function(Y){return W(Z(Y))}}function An(W,Z){for(var Y=-1,de=W.length,Oe=0,ut=[];++Y<de;){var vt=W[Y];(vt===Z||vt===d)&&(W[Y]=d,ut[Oe++]=Y)}return ut}function ql(W){var Z=-1,Y=Array(W.size);return W.forEach(function(de){Y[++Z]=de}),Y}function jp(W){var Z=-1,Y=Array(W.size);return W.forEach(function(de){Y[++Z]=[de,de]}),Y}function Ev(W,Z,Y){for(var de=Y-1,Oe=W.length;++de<Oe;)if(W[de]===Z)return de;return-1}function Nc(W,Z,Y){for(var de=Y+1;de--;)if(W[de]===Z)return de;return de}function $i(W){return Ws(W)?Ov(W):mv(W)}function Nr(W){return Ws(W)?Iv(W):gv(W)}function Lp(W){for(var Z=W.length;Z--&&hl.test(W.charAt(Z)););return Z}var qv=kc(fv);function Ov(W){for(var Z=xc.lastIndex=0;xc.test(W);)++Z;return Z}function Iv(W){return W.match(xc)||[]}function Pv(W){return W.match(ov)||[]}var kv=(function W(Z){Z=Z==null?Xt:Ni.defaults(Xt.Object(),Z,Ni.pick(Xt,uv));var Y=Z.Array,de=Z.Date,Oe=Z.Error,ut=Z.Function,vt=Z.Math,Xe=Z.Object,Ol=Z.RegExp,Av=Z.String,Mr=Z.TypeError,Xo=Y.prototype,Tv=ut.prototype,Js=Xe.prototype,ea=Z["__core-js_shared__"],Il=Tv.toString,pt=Js.hasOwnProperty,$v=0,Up=(function(){var a=/[^.]+$/.exec(ea&&ea.keys&&ea.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})(),Pl=Js.toString,Nv=Il.call(Xe),Mv=Xt._,Fv=Ol("^"+Il.call(pt).replace(ft,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kl=Bs?Z.Buffer:t,Mi=Z.Symbol,Al=Z.Uint8Array,Hp=kl?kl.allocUnsafe:t,Tl=Zo(Xe.getPrototypeOf,Xe),Bp=Xe.create,ta=Js.propertyIsEnumerable,$l=Xo.splice,Vp=Mi?Mi.isConcatSpreadable:t,ra=Mi?Mi.iterator:t,os=Mi?Mi.toStringTag:t,Nl=(function(){try{var a=da(Xe,"defineProperty");return a({},"",{}),a}catch{}})(),Dv=Z.clearTimeout!==Xt.clearTimeout&&Z.clearTimeout,jv=de&&de.now!==Xt.Date.now&&de.now,Lv=Z.setTimeout!==Xt.setTimeout&&Z.setTimeout,na=vt.ceil,ia=vt.floor,Ml=Xe.getOwnPropertySymbols,Fl=kl?kl.isBuffer:t,as=Z.isFinite,Dl=Xo.join,Wp=Zo(Xe.keys,Xe),Tt=vt.max,ir=vt.min,zp=de.now,Uv=Z.parseInt,Jp=vt.random,Hv=Xo.reverse,Mc=da(Z,"DataView"),sa=da(Z,"Map"),Fc=da(Z,"Promise"),Gs=da(Z,"Set"),oa=da(Z,"WeakMap"),aa=da(Xe,"create"),jl=oa&&new oa,Ys={},Bv=pa(Mc),Vv=pa(sa),Wv=pa(Fc),zv=pa(Gs),Jv=pa(oa),Ll=Mi?Mi.prototype:t,la=Ll?Ll.valueOf:t,Gp=Ll?Ll.toString:t;function $(a){if(Bt(a)&&!$e(a)&&!(a instanceof We)){if(a instanceof br)return a;if(pt.call(a,"__wrapped__"))return _E(a)}return new br(a)}var Ks=(function(){function a(){}return function(u){if(!Ut(u))return{};if(Bp)return Bp(u);a.prototype=u;var h=new a;return a.prototype=t,h}})();function Ul(){}function br(a,u){this.__wrapped__=a,this.__actions__=[],this.__chain__=!!u,this.__index__=0,this.__values__=t}$.templateSettings={escape:Uy,evaluate:Hy,interpolate:In,variable:"",imports:{_:$}},$.prototype=Ul.prototype,$.prototype.constructor=$,br.prototype=Ks(Ul.prototype),br.prototype.constructor=br;function We(a){this.__wrapped__=a,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ke,this.__views__=[]}function Gv(){var a=new We(this.__wrapped__);return a.__actions__=Yr(this.__actions__),a.__dir__=this.__dir__,a.__filtered__=this.__filtered__,a.__iteratees__=Yr(this.__iteratees__),a.__takeCount__=this.__takeCount__,a.__views__=Yr(this.__views__),a}function Yv(){if(this.__filtered__){var a=new We(this);a.__dir__=-1,a.__filtered__=!0}else a=this.clone(),a.__dir__*=-1;return a}function Dc(){var a=this.__wrapped__.value(),u=this.__dir__,h=$e(a),S=u<0,P=h?a.length:0,N=iM(0,P,this.__views__),L=N.start,B=N.end,z=B-L,X=S?B:L-1,ee=this.__iteratees__,re=ee.length,ue=0,be=ir(z,this.__takeCount__);if(!h||!S&&P==z&&be==z)return Wx(a,this.__actions__);var xe=[];e:for(;z--&&ue<be;){X+=u;for(var De=-1,Re=a[X];++De<re;){var Qe=ee[De],et=Qe.iteratee,yn=Qe.type,jr=et(Re);if(yn==Q)Re=jr;else if(!jr){if(yn==J)continue e;break e}}xe[ue++]=Re}return xe}We.prototype=Ks(Ul.prototype),We.prototype.constructor=We;function Tn(a){var u=-1,h=a==null?0:a.length;for(this.clear();++u<h;){var S=a[u];this.set(S[0],S[1])}}function Kv(){this.__data__=aa?aa(null):{},this.size=0}function Qv(a){var u=this.has(a)&&delete this.__data__[a];return this.size-=u?1:0,u}function Zv(a){var u=this.__data__;if(aa){var h=u[a];return h===l?t:h}return pt.call(u,a)?u[a]:t}function Xv(a){var u=this.__data__;return aa?u[a]!==t:pt.call(u,a)}function eb(a,u){var h=this.__data__;return this.size+=this.has(a)?0:1,h[a]=aa&&u===t?l:u,this}Tn.prototype.clear=Kv,Tn.prototype.delete=Qv,Tn.prototype.get=Zv,Tn.prototype.has=Xv,Tn.prototype.set=eb;function ei(a){var u=-1,h=a==null?0:a.length;for(this.clear();++u<h;){var S=a[u];this.set(S[0],S[1])}}function Yp(){this.__data__=[],this.size=0}function tb(a){var u=this.__data__,h=Bl(u,a);if(h<0)return!1;var S=u.length-1;return h==S?u.pop():$l.call(u,h,1),--this.size,!0}function rb(a){var u=this.__data__,h=Bl(u,a);return h<0?t:u[h][1]}function Kp(a){return Bl(this.__data__,a)>-1}function nb(a,u){var h=this.__data__,S=Bl(h,a);return S<0?(++this.size,h.push([a,u])):h[S][1]=u,this}ei.prototype.clear=Yp,ei.prototype.delete=tb,ei.prototype.get=rb,ei.prototype.has=Kp,ei.prototype.set=nb;function ti(a){var u=-1,h=a==null?0:a.length;for(this.clear();++u<h;){var S=a[u];this.set(S[0],S[1])}}function ib(){this.size=0,this.__data__={hash:new Tn,map:new(sa||ei),string:new Tn}}function Fi(a){var u=yh(this,a).delete(a);return this.size-=u?1:0,u}function Qp(a){return yh(this,a).get(a)}function sb(a){return yh(this,a).has(a)}function ob(a,u){var h=yh(this,a),S=h.size;return h.set(a,u),this.size+=h.size==S?0:1,this}ti.prototype.clear=ib,ti.prototype.delete=Fi,ti.prototype.get=Qp,ti.prototype.has=sb,ti.prototype.set=ob;function ls(a){var u=-1,h=a==null?0:a.length;for(this.__data__=new ti;++u<h;)this.add(a[u])}function ie(a){return this.__data__.set(a,l),this}function ab(a){return this.__data__.has(a)}ls.prototype.add=ls.prototype.push=ie,ls.prototype.has=ab;function dn(a){var u=this.__data__=new ei(a);this.size=u.size}function Zp(){this.__data__=new ei,this.size=0}function rt(a){var u=this.__data__,h=u.delete(a);return this.size=u.size,h}function Hl(a){return this.__data__.get(a)}function Xp(a){return this.__data__.has(a)}function jc(a,u){var h=this.__data__;if(h instanceof ei){var S=h.__data__;if(!sa||S.length<r-1)return S.push([a,u]),this.size=++h.size,this;h=this.__data__=new ti(S)}return h.set(a,u),this.size=h.size,this}dn.prototype.clear=Zp,dn.prototype.delete=rt,dn.prototype.get=Hl,dn.prototype.has=Xp,dn.prototype.set=jc;function eh(a,u){var h=$e(a),S=!h&&ha(a),P=!h&&!S&&no(a),N=!h&&!S&&!P&&Yl(a),L=h||S||P||N,B=L?Tc(a.length,Av):[],z=B.length;for(var X in a)(u||pt.call(a,X))&&!(L&&(X=="length"||P&&(X=="offset"||X=="parent")||N&&(X=="buffer"||X=="byteLength"||X=="byteOffset")||ds(X,z)))&&B.push(X);return B}function th(a){var u=a.length;return u?a[Sb(0,u-1)]:t}function lb(a,u){return vh(Yr(a),Di(u,0,a.length))}function ub(a){return vh(Yr(a))}function Lc(a,u,h){(h!==t&&!oi(a[u],h)||h===t&&!(u in a))&&pn(a,u,h)}function Fr(a,u,h){var S=a[u];(!(pt.call(a,u)&&oi(S,h))||h===t&&!(u in a))&&pn(a,u,h)}function Bl(a,u){for(var h=a.length;h--;)if(oi(a[h][0],u))return h;return-1}function rh(a,u,h,S){return ji(a,function(P,N,L){u(S,P,h(P),L)}),S}function nh(a,u){return a&&Li(u,fr(u),a)}function cb(a,u){return a&&Li(u,Qr(u),a)}function pn(a,u,h){u=="__proto__"&&Nl?Nl(a,u,{configurable:!0,enumerable:!0,value:h,writable:!0}):a[u]=h}function Uc(a,u){for(var h=-1,S=u.length,P=Y(S),N=a==null;++h<S;)P[h]=N?t:zb(a,u[h]);return P}function Di(a,u,h){return a===a&&(h!==t&&(a=a<=h?a:h),u!==t&&(a=a>=u?a:u)),a}function Sr(a,u,h,S,P,N){var L,B=u&p,z=u&m,X=u&y;if(h&&(L=P?h(a,S,P,N):h(a)),L!==t)return L;if(!Ut(a))return a;var ee=$e(a);if(ee){if(L=oM(a),!B)return Yr(a,L)}else{var re=wr(a),ue=re==Wr||re==Ms;if(no(a))return Gx(a,B);if(re==te||re==Gt||ue&&!P){if(L=z||ue?{}:pE(a),!B)return z?YN(a,cb(L,a)):GN(a,nh(L,a))}else{if(!Et[re])return P?a:{};L=aM(a,re,B)}}N||(N=new dn);var be=N.get(a);if(be)return be;N.set(a,L),HE(a)?a.forEach(function(Re){L.add(Sr(Re,u,h,Re,a,N))}):LE(a)&&a.forEach(function(Re,Qe){L.set(Qe,Sr(Re,u,h,Qe,a,N))});var xe=X?z?kb:Pb:z?Qr:fr,De=ee?t:xe(a);return Tr(De||a,function(Re,Qe){De&&(Qe=Re,Re=a[Qe]),Fr(L,Qe,Sr(Re,u,h,Qe,a,N))}),L}function fb(a){var u=fr(a);return function(h){return $n(h,a,u)}}function $n(a,u,h){var S=h.length;if(a==null)return!S;for(a=Xe(a);S--;){var P=h[S],N=u[P],L=a[P];if(L===t&&!(P in a)||!N(L))return!1}return!0}function Hc(a,u,h){if(typeof a!="function")throw new Mr(i);return Yc(function(){a.apply(t,h)},u)}function ua(a,u,h,S){var P=-1,N=_l,L=!0,B=a.length,z=[],X=u.length;if(!B)return z;h&&(u=qt(u,$r(h))),S?(N=Vs,L=!1):u.length>=r&&(N=yt,L=!1,u=new ls(u));e:for(;++P<B;){var ee=a[P],re=h==null?ee:h(ee);if(ee=S||ee!==0?ee:0,L&&re===re){for(var ue=X;ue--;)if(u[ue]===re)continue e;z.push(ee)}else N(u,re,S)||z.push(ee)}return z}var ji=Xx(Nn),ih=Xx(ri,!0);function db(a,u){var h=!0;return ji(a,function(S,P,N){return h=!!u(S,P,N),h}),h}function Vl(a,u,h){for(var S=-1,P=a.length;++S<P;){var N=a[S],L=u(N);if(L!=null&&(B===t?L===L&&!gn(L):h(L,B)))var B=L,z=N}return z}function pb(a,u,h,S){var P=a.length;for(h=Me(h),h<0&&(h=-h>P?0:P+h),S=S===t||S>P?P:Me(S),S<0&&(S+=P),S=h>S?0:VE(S);h<S;)a[h++]=u;return a}function sh(a,u){var h=[];return ji(a,function(S,P,N){u(S,P,N)&&h.push(S)}),h}function sr(a,u,h,S,P){var N=-1,L=a.length;for(h||(h=uM),P||(P=[]);++N<L;){var B=a[N];u>0&&h(B)?u>1?sr(B,u-1,h,S,P):Ti(P,B):S||(P[P.length]=B)}return P}var Bc=eE(),oh=eE(!0);function Nn(a,u){return a&&Bc(a,u,fr)}function ri(a,u){return a&&oh(a,u,fr)}function Wl(a,u){return Ai(u,function(h){return ps(a[h])})}function us(a,u){u=to(u,a);for(var h=0,S=u.length;a!=null&&h<S;)a=a[si(u[h++])];return h&&h==S?a:t}function ah(a,u,h){var S=u(a);return $e(a)?S:Ti(S,h(a))}function dr(a){return a==null?a===t?Ae:En:os&&os in Xe(a)?nM(a):gM(a)}function Vc(a,u){return a>u}function hb(a,u){return a!=null&&pt.call(a,u)}function mb(a,u){return a!=null&&u in Xe(a)}function gb(a,u,h){return a>=ir(u,h)&&a<Tt(u,h)}function hn(a,u,h){for(var S=h?Vs:_l,P=a[0].length,N=a.length,L=N,B=Y(N),z=1/0,X=[];L--;){var ee=a[L];L&&u&&(ee=qt(ee,$r(u))),z=ir(ee.length,z),B[L]=!h&&(u||P>=120&&ee.length>=120)?new ls(L&&ee):t}ee=a[0];var re=-1,ue=B[0];e:for(;++re<P&&X.length<z;){var be=ee[re],xe=u?u(be):be;if(be=h||be!==0?be:0,!(ue?yt(ue,xe):S(X,xe,h))){for(L=N;--L;){var De=B[L];if(!(De?yt(De,xe):S(a[L],xe,h)))continue e}ue&&ue.push(xe),X.push(be)}}return X}function Qs(a,u,h,S){return Nn(a,function(P,N,L){u(S,h(P),N,L)}),S}function ca(a,u,h){u=to(u,a),a=yE(a,u);var S=a==null?a:a[si(Fn(u))];return S==null?t:Ar(S,a,h)}function lh(a){return Bt(a)&&dr(a)==Gt}function yb(a){return Bt(a)&&dr(a)==fn}function vb(a){return Bt(a)&&dr(a)==vr}function fa(a,u,h,S,P){return a===u?!0:a==null||u==null||!Bt(a)&&!Bt(u)?a!==a&&u!==u:Wc(a,u,h,S,fa,P)}function Wc(a,u,h,S,P,N){var L=$e(a),B=$e(u),z=L?Pr:wr(a),X=B?Pr:wr(u);z=z==Gt?te:z,X=X==Gt?te:X;var ee=z==te,re=X==te,ue=z==X;if(ue&&no(a)){if(!no(u))return!1;L=!0,ee=!1}if(ue&&!ee)return N||(N=new dn),L||Yl(a)?cE(a,u,h,S,P,N):tM(a,u,z,h,S,P,N);if(!(h&b)){var be=ee&&pt.call(a,"__wrapped__"),xe=re&&pt.call(u,"__wrapped__");if(be||xe){var De=be?a.value():a,Re=xe?u.value():u;return N||(N=new dn),P(De,Re,h,S,N)}}return ue?(N||(N=new dn),rM(a,u,h,S,P,N)):!1}function Zs(a){return Bt(a)&&wr(a)==At}function Xs(a,u,h,S){var P=h.length,N=P,L=!S;if(a==null)return!N;for(a=Xe(a);P--;){var B=h[P];if(L&&B[2]?B[1]!==a[B[0]]:!(B[0]in a))return!1}for(;++P<N;){B=h[P];var z=B[0],X=a[z],ee=B[1];if(L&&B[2]){if(X===t&&!(z in a))return!1}else{var re=new dn;if(S)var ue=S(X,ee,z,a,u,re);if(!(ue===t?fa(ee,X,b|E,S,re):ue))return!1}}return!0}function Ke(a){if(!Ut(a)||fM(a))return!1;var u=ps(a)?Fv:gp;return u.test(pa(a))}function f(a){return Bt(a)&&dr(a)==ye}function g(a){return Bt(a)&&wr(a)==ve}function w(a){return Bt(a)&&Ch(a.length)&&!!It[dr(a)]}function x(a){return typeof a=="function"?a:a==null?Zr:typeof a=="object"?$e(a)?ze(a[0],a[1]):qe(a):rq(a)}function T(a){if(!Gc(a))return Wp(a);var u=[];for(var h in Xe(a))pt.call(a,h)&&h!="constructor"&&u.push(h);return u}function H(a){if(!Ut(a))return mM(a);var u=Gc(a),h=[];for(var S in a)S=="constructor"&&(u||!pt.call(a,S))||h.push(S);return h}function K(a,u){return a<u}function fe(a,u){var h=-1,S=Kr(a)?Y(a.length):[];return ji(a,function(P,N,L){S[++h]=u(P,N,L)}),S}function qe(a){var u=Tb(a);return u.length==1&&u[0][2]?mE(u[0][0],u[0][1]):function(h){return h===a||Xs(h,a,u)}}function ze(a,u){return Nb(a)&&hE(u)?mE(si(a),u):function(h){var S=zb(h,a);return S===t&&S===u?Jb(h,a):fa(u,S,b|E)}}function er(a,u,h,S,P){a!==u&&Bc(u,function(N,L){if(P||(P=new dn),Ut(N))ni(a,u,L,h,er,S,P);else{var B=S?S(Fb(a,L),N,L+"",a,u,P):t;B===t&&(B=N),Lc(a,L,B)}},Qr)}function ni(a,u,h,S,P,N,L){var B=Fb(a,h),z=Fb(u,h),X=L.get(z);if(X){Lc(a,h,X);return}var ee=N?N(B,z,h+"",a,u,L):t,re=ee===t;if(re){var ue=$e(z),be=!ue&&no(z),xe=!ue&&!be&&Yl(z);ee=z,ue||be||xe?$e(B)?ee=B:Kt(B)?ee=Yr(B):be?(re=!1,ee=Gx(z,!0)):xe?(re=!1,ee=Yx(z,!0)):ee=[]:Kc(z)||ha(z)?(ee=B,ha(B)?ee=WE(B):(!Ut(B)||ps(B))&&(ee=pE(z))):re=!1}re&&(L.set(z,ee),P(ee,z,S,N,L),L.delete(z)),Lc(a,h,ee)}function ii(a,u){var h=a.length;if(h)return u+=u<0?h:0,ds(u,h)?a[u]:t}function Dx(a,u,h){u.length?u=qt(u,function(N){return $e(N)?function(L){return us(L,N.length===1?N[0]:N)}:N}):u=[Zr];var S=-1;u=qt(u,$r(Ce()));var P=fe(a,function(N,L,B){var z=qt(u,function(X){return X(N)});return{criteria:z,index:++S,value:N}});return bv(P,function(N,L){return JN(N,L,h)})}function NN(a,u){return jx(a,u,function(h,S){return Jb(a,S)})}function jx(a,u,h){for(var S=-1,P=u.length,N={};++S<P;){var L=u[S],B=us(a,L);h(B,L)&&zc(N,to(L,a),B)}return N}function MN(a){return function(u){return us(u,a)}}function bb(a,u,h,S){var P=S?vv:is,N=-1,L=u.length,B=a;for(a===u&&(u=Yr(u)),h&&(B=qt(a,$r(h)));++N<L;)for(var z=0,X=u[N],ee=h?h(X):X;(z=P(B,ee,z,S))>-1;)B!==a&&$l.call(B,z,1),$l.call(a,z,1);return a}function Lx(a,u){for(var h=a?u.length:0,S=h-1;h--;){var P=u[h];if(h==S||P!==N){var N=P;ds(P)?$l.call(a,P,1):Rb(a,P)}}return a}function Sb(a,u){return a+ia(Jp()*(u-a+1))}function FN(a,u,h,S){for(var P=-1,N=Tt(na((u-a)/(h||1)),0),L=Y(N);N--;)L[S?N:++P]=a,a+=h;return L}function wb(a,u){var h="";if(!a||u<1||u>Be)return h;do u%2&&(h+=a),u=ia(u/2),u&&(a+=a);while(u);return h}function Ue(a,u){return Db(gE(a,u,Zr),a+"")}function DN(a){return th(Kl(a))}function jN(a,u){var h=Kl(a);return vh(h,Di(u,0,h.length))}function zc(a,u,h,S){if(!Ut(a))return a;u=to(u,a);for(var P=-1,N=u.length,L=N-1,B=a;B!=null&&++P<N;){var z=si(u[P]),X=h;if(z==="__proto__"||z==="constructor"||z==="prototype")return a;if(P!=L){var ee=B[z];X=S?S(ee,z,B):t,X===t&&(X=Ut(ee)?ee:ds(u[P+1])?[]:{})}Fr(B,z,X),B=B[z]}return a}var Ux=jl?function(a,u){return jl.set(a,u),a}:Zr,LN=Nl?function(a,u){return Nl(a,"toString",{configurable:!0,enumerable:!1,value:Yb(u),writable:!0})}:Zr;function UN(a){return vh(Kl(a))}function Mn(a,u,h){var S=-1,P=a.length;u<0&&(u=-u>P?0:P+u),h=h>P?P:h,h<0&&(h+=P),P=u>h?0:h-u>>>0,u>>>=0;for(var N=Y(P);++S<P;)N[S]=a[S+u];return N}function HN(a,u){var h;return ji(a,function(S,P,N){return h=u(S,P,N),!h}),!!h}function uh(a,u,h){var S=0,P=a==null?S:a.length;if(typeof u=="number"&&u===u&&P<=Nt){for(;S<P;){var N=S+P>>>1,L=a[N];L!==null&&!gn(L)&&(h?L<=u:L<u)?S=N+1:P=N}return P}return _b(a,u,Zr,h)}function _b(a,u,h,S){var P=0,N=a==null?0:a.length;if(N===0)return 0;u=h(u);for(var L=u!==u,B=u===null,z=gn(u),X=u===t;P<N;){var ee=ia((P+N)/2),re=h(a[ee]),ue=re!==t,be=re===null,xe=re===re,De=gn(re);if(L)var Re=S||xe;else X?Re=xe&&(S||ue):B?Re=xe&&ue&&(S||!be):z?Re=xe&&ue&&!be&&(S||!De):be||De?Re=!1:Re=S?re<=u:re<u;Re?P=ee+1:N=ee}return ir(N,mt)}function Hx(a,u){for(var h=-1,S=a.length,P=0,N=[];++h<S;){var L=a[h],B=u?u(L):L;if(!h||!oi(B,z)){var z=B;N[P++]=L===0?0:L}}return N}function Bx(a){return typeof a=="number"?a:gn(a)?me:+a}function mn(a){if(typeof a=="string")return a;if($e(a))return qt(a,mn)+"";if(gn(a))return Gp?Gp.call(a):"";var u=a+"";return u=="0"&&1/a==-ce?"-0":u}function eo(a,u,h){var S=-1,P=_l,N=a.length,L=!0,B=[],z=B;if(h)L=!1,P=Vs;else if(N>=r){var X=u?null:XN(a);if(X)return ql(X);L=!1,P=yt,z=new ls}else z=u?[]:B;e:for(;++S<N;){var ee=a[S],re=u?u(ee):ee;if(ee=h||ee!==0?ee:0,L&&re===re){for(var ue=z.length;ue--;)if(z[ue]===re)continue e;u&&z.push(re),B.push(ee)}else P(z,re,h)||(z!==B&&z.push(re),B.push(ee))}return B}function Rb(a,u){u=to(u,a);var h=-1,S=u.length;if(!S)return!0;for(;++h<S;){var P=si(u[h]);if(P==="__proto__"&&!pt.call(a,"__proto__")||(P==="constructor"||P==="prototype")&&h<S-1)return!1}var N=yE(a,u);return N==null||delete N[si(Fn(u))]}function Vx(a,u,h,S){return zc(a,u,h(us(a,u)),S)}function ch(a,u,h,S){for(var P=a.length,N=S?P:-1;(S?N--:++N<P)&&u(a[N],N,a););return h?Mn(a,S?0:N,S?N+1:P):Mn(a,S?N+1:0,S?P:N)}function Wx(a,u){var h=a;return h instanceof We&&(h=h.value()),Pc(u,function(S,P){return P.func.apply(P.thisArg,Ti([S],P.args))},h)}function Cb(a,u,h){var S=a.length;if(S<2)return S?eo(a[0]):[];for(var P=-1,N=Y(S);++P<S;)for(var L=a[P],B=-1;++B<S;)B!=P&&(N[P]=ua(N[P]||L,a[B],u,h));return eo(sr(N,1),u,h)}function zx(a,u,h){for(var S=-1,P=a.length,N=u.length,L={};++S<P;){var B=S<N?u[S]:t;h(L,a[S],B)}return L}function xb(a){return Kt(a)?a:[]}function Eb(a){return typeof a=="function"?a:Zr}function to(a,u){return $e(a)?a:Nb(a,u)?[a]:wE(wt(a))}var BN=Ue;function ro(a,u,h){var S=a.length;return h=h===t?S:h,!u&&h>=S?a:Mn(a,u,h)}var Jx=Dv||function(a){return Xt.clearTimeout(a)};function Gx(a,u){if(u)return a.slice();var h=a.length,S=Hp?Hp(h):new a.constructor(h);return a.copy(S),S}function qb(a){var u=new a.constructor(a.byteLength);return new Al(u).set(new Al(a)),u}function VN(a,u){var h=u?qb(a.buffer):a.buffer;return new a.constructor(h,a.byteOffset,a.byteLength)}function WN(a){var u=new a.constructor(a.source,mp.exec(a));return u.lastIndex=a.lastIndex,u}function zN(a){return la?Xe(la.call(a)):{}}function Yx(a,u){var h=u?qb(a.buffer):a.buffer;return new a.constructor(h,a.byteOffset,a.length)}function Kx(a,u){if(a!==u){var h=a!==t,S=a===null,P=a===a,N=gn(a),L=u!==t,B=u===null,z=u===u,X=gn(u);if(!B&&!X&&!N&&a>u||N&&L&&z&&!B&&!X||S&&L&&z||!h&&z||!P)return 1;if(!S&&!N&&!X&&a<u||X&&h&&P&&!S&&!N||B&&h&&P||!L&&P||!z)return-1}return 0}function JN(a,u,h){for(var S=-1,P=a.criteria,N=u.criteria,L=P.length,B=h.length;++S<L;){var z=Kx(P[S],N[S]);if(z){if(S>=B)return z;var X=h[S];return z*(X=="desc"?-1:1)}}return a.index-u.index}function Qx(a,u,h,S){for(var P=-1,N=a.length,L=h.length,B=-1,z=u.length,X=Tt(N-L,0),ee=Y(z+X),re=!S;++B<z;)ee[B]=u[B];for(;++P<L;)(re||P<N)&&(ee[h[P]]=a[P]);for(;X--;)ee[B++]=a[P++];return ee}function Zx(a,u,h,S){for(var P=-1,N=a.length,L=-1,B=h.length,z=-1,X=u.length,ee=Tt(N-B,0),re=Y(ee+X),ue=!S;++P<ee;)re[P]=a[P];for(var be=P;++z<X;)re[be+z]=u[z];for(;++L<B;)(ue||P<N)&&(re[be+h[L]]=a[P++]);return re}function Yr(a,u){var h=-1,S=a.length;for(u||(u=Y(S));++h<S;)u[h]=a[h];return u}function Li(a,u,h,S){var P=!h;h||(h={});for(var N=-1,L=u.length;++N<L;){var B=u[N],z=S?S(h[B],a[B],B,h,a):t;z===t&&(z=a[B]),P?pn(h,B,z):Fr(h,B,z)}return h}function GN(a,u){return Li(a,$b(a),u)}function YN(a,u){return Li(a,fE(a),u)}function fh(a,u){return function(h,S){var P=$e(h)?Xn:rh,N=u?u():{};return P(h,a,Ce(S,2),N)}}function zl(a){return Ue(function(u,h){var S=-1,P=h.length,N=P>1?h[P-1]:t,L=P>2?h[2]:t;for(N=a.length>3&&typeof N=="function"?(P--,N):t,L&&Dr(h[0],h[1],L)&&(N=P<3?t:N,P=1),u=Xe(u);++S<P;){var B=h[S];B&&a(u,B,S,N)}return u})}function Xx(a,u){return function(h,S){if(h==null)return h;if(!Kr(h))return a(h,S);for(var P=h.length,N=u?P:-1,L=Xe(h);(u?N--:++N<P)&&S(L[N],N,L)!==!1;);return h}}function eE(a){return function(u,h,S){for(var P=-1,N=Xe(u),L=S(u),B=L.length;B--;){var z=L[a?B:++P];if(h(N[z],z,N)===!1)break}return u}}function KN(a,u,h){var S=u&C,P=Jc(a);function N(){var L=this&&this!==Xt&&this instanceof N?P:a;return L.apply(S?h:this,arguments)}return N}function tE(a){return function(u){u=wt(u);var h=Ws(u)?Nr(u):t,S=h?h[0]:u.charAt(0),P=h?ro(h,1).join(""):u.slice(1);return S[a]()+P}}function Jl(a){return function(u){return Pc(eq(XE(u).replace(iv,"")),a,"")}}function Jc(a){return function(){var u=arguments;switch(u.length){case 0:return new a;case 1:return new a(u[0]);case 2:return new a(u[0],u[1]);case 3:return new a(u[0],u[1],u[2]);case 4:return new a(u[0],u[1],u[2],u[3]);case 5:return new a(u[0],u[1],u[2],u[3],u[4]);case 6:return new a(u[0],u[1],u[2],u[3],u[4],u[5]);case 7:return new a(u[0],u[1],u[2],u[3],u[4],u[5],u[6])}var h=Ks(a.prototype),S=a.apply(h,u);return Ut(S)?S:h}}function QN(a,u,h){var S=Jc(a);function P(){for(var N=arguments.length,L=Y(N),B=N,z=Gl(P);B--;)L[B]=arguments[B];var X=N<3&&L[0]!==z&&L[N-1]!==z?[]:An(L,z);if(N-=X.length,N<h)return oE(a,u,dh,P.placeholder,t,L,X,t,t,h-N);var ee=this&&this!==Xt&&this instanceof P?S:a;return Ar(ee,this,L)}return P}function rE(a){return function(u,h,S){var P=Xe(u);if(!Kr(u)){var N=Ce(h,3);u=fr(u),h=function(B){return N(P[B],B,P)}}var L=a(u,h,S);return L>-1?P[N?u[L]:L]:t}}function nE(a){return fs(function(u){var h=u.length,S=h,P=br.prototype.thru;for(a&&u.reverse();S--;){var N=u[S];if(typeof N!="function")throw new Mr(i);if(P&&!L&&gh(N)=="wrapper")var L=new br([],!0)}for(S=L?S:h;++S<h;){N=u[S];var B=gh(N),z=B=="wrapper"?Ab(N):t;z&&Mb(z[0])&&z[1]==(j|q|O|I)&&!z[4].length&&z[9]==1?L=L[gh(z[0])].apply(L,z[3]):L=N.length==1&&Mb(N)?L[B]():L.thru(N)}return function(){var X=arguments,ee=X[0];if(L&&X.length==1&&$e(ee))return L.plant(ee).value();for(var re=0,ue=h?u[re].apply(this,X):ee;++re<h;)ue=u[re].call(this,ue);return ue}})}function dh(a,u,h,S,P,N,L,B,z,X){var ee=u&j,re=u&C,ue=u&v,be=u&(q|k),xe=u&R,De=ue?t:Jc(a);function Re(){for(var Qe=arguments.length,et=Y(Qe),yn=Qe;yn--;)et[yn]=arguments[yn];if(be)var jr=Gl(Re),vn=Dp(et,jr);if(S&&(et=Qx(et,S,P,be)),N&&(et=Zx(et,N,L,be)),Qe-=vn,be&&Qe<X){var Qt=An(et,jr);return oE(a,u,dh,Re.placeholder,h,et,Qt,B,z,X-Qe)}var ai=re?h:this,ms=ue?ai[a]:a;return Qe=et.length,B?et=yM(et,B):xe&&Qe>1&&et.reverse(),ee&&z<Qe&&(et.length=z),this&&this!==Xt&&this instanceof Re&&(ms=De||Jc(ms)),ms.apply(ai,et)}return Re}function iE(a,u){return function(h,S){return Qs(h,a,u(S),{})}}function ph(a,u){return function(h,S){var P;if(h===t&&S===t)return u;if(h!==t&&(P=h),S!==t){if(P===t)return S;typeof h=="string"||typeof S=="string"?(h=mn(h),S=mn(S)):(h=Bx(h),S=Bx(S)),P=a(h,S)}return P}}function Ob(a){return fs(function(u){return u=qt(u,$r(Ce())),Ue(function(h){var S=this;return a(u,function(P){return Ar(P,S,h)})})})}function hh(a,u){u=u===t?" ":mn(u);var h=u.length;if(h<2)return h?wb(u,a):u;var S=wb(u,na(a/$i(u)));return Ws(u)?ro(Nr(S),0,a).join(""):S.slice(0,a)}function ZN(a,u,h,S){var P=u&C,N=Jc(a);function L(){for(var B=-1,z=arguments.length,X=-1,ee=S.length,re=Y(ee+z),ue=this&&this!==Xt&&this instanceof L?N:a;++X<ee;)re[X]=S[X];for(;z--;)re[X++]=arguments[++B];return Ar(ue,P?h:this,re)}return L}function sE(a){return function(u,h,S){return S&&typeof S!="number"&&Dr(u,h,S)&&(h=S=t),u=hs(u),h===t?(h=u,u=0):h=hs(h),S=S===t?u<h?1:-1:hs(S),FN(u,h,S,a)}}function mh(a){return function(u,h){return typeof u=="string"&&typeof h=="string"||(u=Dn(u),h=Dn(h)),a(u,h)}}function oE(a,u,h,S,P,N,L,B,z,X){var ee=u&q,re=ee?L:t,ue=ee?t:L,be=ee?N:t,xe=ee?t:N;u|=ee?O:M,u&=~(ee?M:O),u&_||(u&=~(C|v));var De=[a,u,P,be,re,xe,ue,B,z,X],Re=h.apply(t,De);return Mb(a)&&vE(Re,De),Re.placeholder=S,bE(Re,a,u)}function Ib(a){var u=vt[a];return function(h,S){if(h=Dn(h),S=S==null?0:ir(Me(S),292),S&&as(h)){var P=(wt(h)+"e").split("e"),N=u(P[0]+"e"+(+P[1]+S));return P=(wt(N)+"e").split("e"),+(P[0]+"e"+(+P[1]-S))}return u(h)}}var XN=Gs&&1/ql(new Gs([,-0]))[1]==ce?function(a){return new Gs(a)}:Zb;function aE(a){return function(u){var h=wr(u);return h==At?zs(u):h==ve?jp(u):Sv(u,a(u))}}function cs(a,u,h,S,P,N,L,B){var z=u&v;if(!z&&typeof a!="function")throw new Mr(i);var X=S?S.length:0;if(X||(u&=~(O|M),S=P=t),L=L===t?L:Tt(Me(L),0),B=B===t?B:Me(B),X-=P?P.length:0,u&M){var ee=S,re=P;S=P=t}var ue=z?t:Ab(a),be=[a,u,h,S,P,ee,re,N,L,B];if(ue&&hM(be,ue),a=be[0],u=be[1],h=be[2],S=be[3],P=be[4],B=be[9]=be[9]===t?z?0:a.length:Tt(be[9]-X,0),!B&&u&(q|k)&&(u&=~(q|k)),!u||u==C)var xe=KN(a,u,h);else u==q||u==k?xe=QN(a,u,B):(u==O||u==(C|O))&&!P.length?xe=ZN(a,u,h,S):xe=dh.apply(t,be);var De=ue?Ux:vE;return bE(De(xe,be),a,u)}function lE(a,u,h,S){return a===t||oi(a,Js[h])&&!pt.call(S,h)?u:a}function uE(a,u,h,S,P,N){return Ut(a)&&Ut(u)&&(N.set(u,a),er(a,u,t,uE,N),N.delete(u)),a}function eM(a){return Kc(a)?t:a}function cE(a,u,h,S,P,N){var L=h&b,B=a.length,z=u.length;if(B!=z&&!(L&&z>B))return!1;var X=N.get(a),ee=N.get(u);if(X&&ee)return X==u&&ee==a;var re=-1,ue=!0,be=h&E?new ls:t;for(N.set(a,u),N.set(u,a);++re<B;){var xe=a[re],De=u[re];if(S)var Re=L?S(De,xe,re,u,a,N):S(xe,De,re,a,u,N);if(Re!==t){if(Re)continue;ue=!1;break}if(be){if(!Rl(u,function(Qe,et){if(!yt(be,et)&&(xe===Qe||P(xe,Qe,h,S,N)))return be.push(et)})){ue=!1;break}}else if(!(xe===De||P(xe,De,h,S,N))){ue=!1;break}}return N.delete(a),N.delete(u),ue}function tM(a,u,h,S,P,N,L){switch(h){case gt:if(a.byteLength!=u.byteLength||a.byteOffset!=u.byteOffset)return!1;a=a.buffer,u=u.buffer;case fn:return!(a.byteLength!=u.byteLength||!N(new Al(a),new Al(u)));case kr:case vr:case Pi:return oi(+a,+u);case St:return a.name==u.name&&a.message==u.message;case ye:case Ye:return a==u+"";case At:var B=zs;case ve:var z=S&b;if(B||(B=ql),a.size!=u.size&&!z)return!1;var X=L.get(a);if(X)return X==u;S|=E,L.set(a,u);var ee=cE(B(a),B(u),S,P,N,L);return L.delete(a),ee;case ur:if(la)return la.call(a)==la.call(u)}return!1}function rM(a,u,h,S,P,N){var L=h&b,B=Pb(a),z=B.length,X=Pb(u),ee=X.length;if(z!=ee&&!L)return!1;for(var re=z;re--;){var ue=B[re];if(!(L?ue in u:pt.call(u,ue)))return!1}var be=N.get(a),xe=N.get(u);if(be&&xe)return be==u&&xe==a;var De=!0;N.set(a,u),N.set(u,a);for(var Re=L;++re<z;){ue=B[re];var Qe=a[ue],et=u[ue];if(S)var yn=L?S(et,Qe,ue,u,a,N):S(Qe,et,ue,a,u,N);if(!(yn===t?Qe===et||P(Qe,et,h,S,N):yn)){De=!1;break}Re||(Re=ue=="constructor")}if(De&&!Re){var jr=a.constructor,vn=u.constructor;jr!=vn&&"constructor"in a&&"constructor"in u&&!(typeof jr=="function"&&jr instanceof jr&&typeof vn=="function"&&vn instanceof vn)&&(De=!1)}return N.delete(a),N.delete(u),De}function fs(a){return Db(gE(a,t,xE),a+"")}function Pb(a){return ah(a,fr,$b)}function kb(a){return ah(a,Qr,fE)}var Ab=jl?function(a){return jl.get(a)}:Zb;function gh(a){for(var u=a.name+"",h=Ys[u],S=pt.call(Ys,u)?h.length:0;S--;){var P=h[S],N=P.func;if(N==null||N==a)return P.name}return u}function Gl(a){var u=pt.call($,"placeholder")?$:a;return u.placeholder}function Ce(){var a=$.iteratee||Kb;return a=a===Kb?x:a,arguments.length?a(arguments[0],arguments[1]):a}function yh(a,u){var h=a.__data__;return cM(u)?h[typeof u=="string"?"string":"hash"]:h.map}function Tb(a){for(var u=fr(a),h=u.length;h--;){var S=u[h],P=a[S];u[h]=[S,P,hE(P)]}return u}function da(a,u){var h=Qo(a,u);return Ke(h)?h:t}function nM(a){var u=pt.call(a,os),h=a[os];try{a[os]=t;var S=!0}catch{}var P=Pl.call(a);return S&&(u?a[os]=h:delete a[os]),P}var $b=Ml?function(a){return a==null?[]:(a=Xe(a),Ai(Ml(a),function(u){return ta.call(a,u)}))}:Xb,fE=Ml?function(a){for(var u=[];a;)Ti(u,$b(a)),a=Tl(a);return u}:Xb,wr=dr;(Mc&&wr(new Mc(new ArrayBuffer(1)))!=gt||sa&&wr(new sa)!=At||Fc&&wr(Fc.resolve())!=ne||Gs&&wr(new Gs)!=ve||oa&&wr(new oa)!=ge)&&(wr=function(a){var u=dr(a),h=u==te?a.constructor:t,S=h?pa(h):"";if(S)switch(S){case Bv:return gt;case Vv:return At;case Wv:return ne;case zv:return ve;case Jv:return ge}return u});function iM(a,u,h){for(var S=-1,P=h.length;++S<P;){var N=h[S],L=N.size;switch(N.type){case"drop":a+=L;break;case"dropRight":u-=L;break;case"take":u=ir(u,a+L);break;case"takeRight":a=Tt(a,u-L);break}}return{start:a,end:u}}function sM(a){var u=a.match(Kn);return u?u[1].split(Pn):[]}function dE(a,u,h){u=to(u,a);for(var S=-1,P=u.length,N=!1;++S<P;){var L=si(u[S]);if(!(N=a!=null&&h(a,L)))break;a=a[L]}return N||++S!=P?N:(P=a==null?0:a.length,!!P&&Ch(P)&&ds(L,P)&&($e(a)||ha(a)))}function oM(a){var u=a.length,h=new a.constructor(u);return u&&typeof a[0]=="string"&&pt.call(a,"index")&&(h.index=a.index,h.input=a.input),h}function pE(a){return typeof a.constructor=="function"&&!Gc(a)?Ks(Tl(a)):{}}function aM(a,u,h){var S=a.constructor;switch(u){case fn:return qb(a);case kr:case vr:return new S(+a);case gt:return VN(a,h);case Ee:case On:case cl:case Fs:case Uo:case Ds:case ki:case js:case mc:return Yx(a,h);case At:return new S;case Pi:case Ye:return new S(a);case ye:return WN(a);case ve:return new S;case ur:return zN(a)}}function lM(a,u){var h=u.length;if(!h)return a;var S=h-1;return u[S]=(h>1?"& ":"")+u[S],u=u.join(h>2?", ":" "),a.replace(cr,`{
|
|
1
|
+
var PL=Object.create;var Eh=Object.defineProperty;var kL=Object.getOwnPropertyDescriptor;var AL=Object.getOwnPropertyNames;var TL=Object.getPrototypeOf,$L=Object.prototype.hasOwnProperty;var _t=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var ae=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var V=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},io=(t,e)=>{for(var r in e)Eh(t,r,{get:e[r],enumerable:!0})},iq=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of AL(e))!$L.call(t,i)&&i!==r&&Eh(t,i,{get:()=>e[i],enumerable:!(n=kL(e,i))||n.enumerable});return t};var Qc=(t,e,r)=>(r=t!=null?PL(TL(t)):{},iq(e||!t||!t.__esModule?Eh(r,"default",{value:t,enumerable:!0}):r,t)),Ql=t=>iq(Eh({},"__esModule",{value:!0}),t);function Vt(t){return t.replace(/[^a-zA-Z0-9-_]/g,"_").replace(/\s+/g,"-").toLowerCase().substring(0,100)}function Pt(t){let e=Date.now().toString(36)+(NL++).toString(36)+Math.random().toString(36).slice(2,7);return t?`${Vt(t)}_${e}`:e}function tS(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function Zc(t,e){let r={},n={};for(let[i,s]of Object.entries(t)){let o=i.toLowerCase();n[o]=i,r[i]=s}for(let[i,s]of Object.entries(e)){let o=i.toLowerCase(),l=n[o];l&&delete r[l],n[o]=i,r[i]=s}return r}function ML(t){return JSON.parse(JSON.stringify(t))}function FL(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function DL(t,e){try{return JSON.parse(t)}catch{return e}}function jL(t){if(t===0)return"0 B";let e=1024,r=["B","KB","MB","GB"],n=Math.floor(Math.log(t)/Math.log(e));return`${parseFloat((t/Math.pow(e,n)).toFixed(1))} ${r[n]}`}function LL(t){return t<1e3?`${t} ms`:`${(t/1e3).toFixed(2)} s`}var NL,jn=ae(()=>{"use strict";NL=0});import*as ht from"fs";import*as bn from"path";function Oh(t){if(!ht.existsSync(t))return;let e={},r=bn.join(t,qh.preRequest);ht.existsSync(r)&&(e.preRequest=ht.readFileSync(r,"utf-8"));let n=bn.join(t,qh.postResponse);return ht.existsSync(n)&&(e.postResponse=ht.readFileSync(n,"utf-8")),Object.keys(e).length>0?e:void 0}async function Ih(t,e){await ht.promises.mkdir(t,{recursive:!0});let r=bn.join(t,qh.preRequest);e.preRequest?await ht.promises.writeFile(r,e.preRequest,"utf-8"):ht.existsSync(r)&&await ht.promises.unlink(r);let n=bn.join(t,qh.postResponse);e.postResponse?await ht.promises.writeFile(n,e.postResponse,"utf-8"):ht.existsSync(n)&&await ht.promises.unlink(n)}function oq(t){for(let[e,r]of Object.entries(sq)){let n=bn.join(t,e);if(ht.existsSync(n))try{let i=ht.readFileSync(n,"utf-8"),s;if(r.type==="graphql")try{s=JSON.parse(i)}catch{s=i}else s=i;return{type:r.type,format:r.format,content:s}}catch(i){console.error(`[FolderIO] Failed to load body from ${n}:`,i)}}}function aq(t){if(!t||t.type==="none")return{bodyForMetadata:t};if(t.type==="raw"){let e=t.format||"json",n={json:"body.json",xml:"body.xml",text:"body.txt",html:"body.html",javascript:"body.js"}[e];if(n){let i=e==="json"?typeof t.content=="string"?t.content:JSON.stringify(t.content,null,2):String(t.content||"");return{bodyForMetadata:{type:t.type,format:t.format},externalBodyFile:{filename:n,content:i}}}}if(t.type==="graphql"){let e=typeof t.content=="string"?t.content:JSON.stringify(t.content,null,2);return{bodyForMetadata:{type:t.type},externalBodyFile:{filename:"body.graphql",content:e}}}return{bodyForMetadata:t}}async function lq(t,e){for(let r of Object.keys(sq))if(r!==e){let n=bn.join(t,r);if(ht.existsSync(n))try{await ht.promises.unlink(n)}catch{}}}function uq(t){if(ht.existsSync(t))try{let e=ht.readFileSync(t,"utf-8");return JSON.parse(e)}catch(e){console.error(`[FolderIO] Failed to load schema file ${t}:`,e);return}}async function cq(t,e,r){let n=bn.join(t,Xc.responseSchema),i=bn.join(t,Xc.bodySchema);e?await ht.promises.writeFile(n,JSON.stringify(e,null,2),"utf-8"):ht.existsSync(n)&&await ht.promises.unlink(n),r?await ht.promises.writeFile(i,JSON.stringify(r,null,2),"utf-8"):ht.existsSync(i)&&await ht.promises.unlink(i)}function rS(t,e){for(let r of t){if(r.id===e)return r;if(r.type==="folder"&&r.items){let n=rS(r.items,e);if(n)return n}}}function nS(t,e){for(let r=0;r<t.length;r++){let n=t[r];if(n.id===e)return t.splice(r,1),!0;if(n.type==="folder"&&n.items&&nS(n.items,e))return!0}return!1}function fq(t,e){let r=new Map(t.map(i=>[i.id,i])),n=[];for(let i of e){let s=r.get(i);s&&(n.push(s),r.delete(i))}for(let i of r.values())n.push(i);return n}function iS(t,e){let r;try{r=ht.readdirSync(t,{withFileTypes:!0})}catch{return}for(let n of r){if(!n.isDirectory()||n.name===Sn)continue;if(n.name===e)return bn.join(t,n.name);let i=iS(bn.join(t,n.name),e);if(i)return i}}function UL(t){for(let e of[Lr.request,Lr.folder]){let r=bn.join(t,e);if(ht.existsSync(r))try{let n=ht.readFileSync(r,"utf-8");return JSON.parse(n).id}catch{return}}}function sS(t,e){let r;try{r=ht.readdirSync(t,{withFileTypes:!0})}catch{return}for(let n of r){if(!n.isDirectory()||n.name===Sn)continue;let i=bn.join(t,n.name);if(UL(i)===e)return i;let s=sS(i,e);if(s)return s}}function Ln(t,e=[]){let r=t.toLowerCase().trim(),n=r.match(/^(get|post|put|patch|delete|head|options)[_\s-]/i),i=n?n[1]:"",s=r.match(/t(\d+)/gi)||[],o=0;for(let y of s){let b=parseInt(y.substring(1));b>o&&(o=b)}let l="";if(o>0)l=`t${o}`;else{let y=r.match(/[_\s-](\d+\.\d+)[_\s-]/);y&&(l=`v${y[1].replace(".","_")}`)}let c=r;n&&(c=c.substring(n[0].length)),c=c.replace(/[_\s-]?t\d+(?:\.\d+)?[_\s-]?/gi,"-"),c=c.replace(/[_\s-]?\d+\.\d+[_\s-]?/g,"-"),c=c.replace(/\([^)]+\)/g,""),c=c.replace(/:[a-z_][a-z0-9_]*/gi,""),c=c.replace(/\{[^}]+\}/g,""),c=c.replace(/\?$/g,"").replace(/[_/\\ ]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"");let d=c.split("-").filter(y=>y.length>0),p=[];i&&p.push(i),p.push(...d),l&&p.push(l);let m=p.join("-");if(m||(m="item"),e.includes(m)){let y=2;for(;e.includes(`${m}-${y}`);)y++;m=`${m}-${y}`}return m}var qh,Lr,sq,Xc,Sn,ma=ae(()=>{"use strict";qh={preRequest:"pre-request.js",postResponse:"post-response.js"},Lr={collection:"collection.json",folder:"folder.json",request:"request.json"},sq={"body.json":{type:"raw",format:"json"},"body.xml":{type:"raw",format:"xml"},"body.txt":{type:"raw",format:"text"},"body.html":{type:"raw",format:"html"},"body.js":{type:"raw",format:"javascript"},"body.graphql":{type:"graphql"}},Xc={responseSchema:"response.schema.json",bodySchema:"body.schema.json"},Sn="scripts"});import*as Ne from"fs";import*as je from"path";var so,Ph=ae(()=>{"use strict";jn();ma();so=class{collectionsDir;cache=new Map;slugToIdMap=new Map;idToSlugMap=new Map;constructor(e){this.collectionsDir=e,this.ensureDirectory()}getSlugById(e){return this.idToSlugMap.get(e)}getIdBySlug(e){return this.slugToIdMap.get(e)}ensureDirectory(){Ne.existsSync(this.collectionsDir)||Ne.mkdirSync(this.collectionsDir,{recursive:!0})}readJsonFileSafe(e,r){let n;try{n=Ne.readFileSync(e,"utf-8")}catch(i){console.error(`[FolderCollectionStore] Failed to read ${r} ${e}:`,i);return}if(n.trim().length!==0)try{return JSON.parse(n)}catch(i){if(i instanceof SyntaxError&&/Unexpected end of JSON input/.test(i.message))return;console.error(`[FolderCollectionStore] Failed to parse ${r} ${e}:`,i);return}}loadAll(){if(this.cache.clear(),this.slugToIdMap.clear(),this.idToSlugMap.clear(),!Ne.existsSync(this.collectionsDir))return[];let e=Ne.readdirSync(this.collectionsDir,{withFileTypes:!0}),r=[];for(let n of e)if(n.isDirectory())try{let i=this.loadCollectionFromFolder(n.name);i&&(this.cache.set(i.id,i),this.slugToIdMap.set(n.name,i.id),this.idToSlugMap.set(i.id,n.name),r.push(i))}catch(i){console.error(`[FolderCollectionStore] Failed to load ${n.name}:`,i)}return r}loadCollectionFromFolder(e){let r=je.join(this.collectionsDir,e),n=je.join(r,Lr.collection);if(!Ne.existsSync(n))return;let i=this.readJsonFileSafe(n,"collection");if(i)try{let s=this.loadScriptsFromDir(je.join(r,Sn)),o=this.loadItemsFromDir(r,i.id,i.order);return{id:i.id,name:i.name,description:i.description,version:i.version,variables:i.variables,auth:i.auth,scripts:s,items:o}}catch(s){console.error(`[FolderCollectionStore] Failed to parse ${n}:`,s);return}}loadItemsFromDir(e,r,n){let i=[],s=new Map,o=Ne.readdirSync(e,{withFileTypes:!0});for(let l of o){if(!l.isDirectory()||l.name===Sn)continue;let c=je.join(e,l.name);if(Ne.existsSync(je.join(c,Lr.folder))){let d=this.loadFolderFromDir(c,l.name);d&&s.set(l.name,d)}else if(Ne.existsSync(je.join(c,Lr.request))){let d=this.loadRequestFromDir(c,l.name);d&&s.set(l.name,d)}}if(n&&n.length>0){for(let l of n){let c=s.get(l);c&&(i.push(c),s.delete(l))}for(let l of s.values())i.push(l)}else for(let l of s.values())i.push(l);return i}loadFolderFromDir(e,r){let n=je.join(e,Lr.folder),i=this.readJsonFileSafe(n,"folder");if(i)try{let s=this.loadScriptsFromDir(je.join(e,Sn)),o=this.loadItemsFromDir(e,i.id,i.order);return this.slugToIdMap.set(r,i.id),this.idToSlugMap.set(i.id,r),{id:i.id,type:"folder",name:i.name,description:i.description,auth:i.auth,scripts:s,items:o}}catch(s){console.error(`[FolderCollectionStore] Failed to load folder ${e}:`,s);return}}loadRequestFromDir(e,r){let n=je.join(e,Lr.request),i=this.readJsonFileSafe(n,"request");if(i)try{let s=this.loadScriptsFromDir(je.join(e,Sn)),o=i.body,l=this.loadBodyFromDir(e);l&&(o=l);let c=this.loadSchemaFile(je.join(e,Xc.responseSchema)),d=this.loadSchemaFile(je.join(e,Xc.bodySchema)),p=je.join(e,"doc.md"),m=Ne.existsSync(p)?Ne.readFileSync(p,"utf-8"):void 0;return this.slugToIdMap.set(r,i.id),this.idToSlugMap.set(i.id,r),{id:i.id,type:"request",name:i.name,description:i.description,method:i.method,url:i.url,params:i.params,query:i.query,headers:i.headers,body:o,bodyContentType:i.bodyContentType,auth:i.auth,settings:i.settings,scripts:s,disabled:i.disabled,deprecated:i.deprecated,operationId:i.operationId,summary:i.summary,tags:i.tags,examples:i.examples,responses:i.responses,security:i.security,...m&&{doc:m},...c&&{responseSchema:c},...d&&{bodySchema:d}}}catch(s){console.error(`[FolderCollectionStore] Failed to load request ${e}:`,s);return}}loadScriptsFromDir(e){return Oh(e)}loadBodyFromDir(e){return oq(e)}loadSchemaFile(e){return uq(e)}async saveSchemaFiles(e,r){return cq(e,r.responseSchema,r.bodySchema)}load(e){if(this.cache.has(e))return this.cache.get(e);let r=this.idToSlugMap.get(e);if(r){let n=this.loadCollectionFromFolder(r);return n&&this.cache.set(e,n),n}return this.loadAll(),this.cache.get(e)}async save(e){if(this.ensureDirectory(),!e.name)throw new Error("Collection name is required");e.id||(e.id=Pt(e.name));let r=this.idToSlugMap.get(e.id);if(!r){let l=Ne.readdirSync(this.collectionsDir);r=Ln(e.name,l),this.idToSlugMap.set(e.id,r),this.slugToIdMap.set(r,e.id)}let n=je.join(this.collectionsDir,r),i=!Ne.existsSync(n);await Ne.promises.mkdir(n,{recursive:!0});let s={id:e.id,name:e.name,description:e.description,version:e.version,variables:e.variables,auth:e.auth},[o]=await Promise.all([this.saveItemsToDir(n,e.items,i),e.scripts?this.saveScriptsToDir(je.join(n,Sn),e.scripts):Promise.resolve()]);o.length>0&&(s.order=o),await Ne.promises.writeFile(je.join(n,Lr.collection),JSON.stringify(s,null,2),"utf-8"),this.cache.set(e.id,e)}async saveItemsToDir(e,r,n=!1){let i=[],s=[];for(let o of r){let l=this.idToSlugMap.get(o.id);l||(l=Ln(o.name,i),this.idToSlugMap.set(o.id,l),this.slugToIdMap.set(l,o.id)),i.push(l),s.push({item:o,slug:l})}return await Promise.all(s.map(async({item:o,slug:l})=>{let c=je.join(e,l);await Ne.promises.mkdir(c,{recursive:!0}),o.type==="folder"?await this.saveFolderToDir(c,o,n):await this.saveRequestToDir(c,o,n)})),i}async saveFolderToDir(e,r,n=!1){let i={id:r.id,name:r.name,description:r.description,auth:r.auth},[s]=await Promise.all([r.items?this.saveItemsToDir(e,r.items,n):Promise.resolve([]),r.scripts?this.saveScriptsToDir(je.join(e,Sn),r.scripts):Promise.resolve()]);s.length>0&&(i.order=s),await Ne.promises.writeFile(je.join(e,Lr.folder),JSON.stringify(i,null,2),"utf-8")}async saveRequestToDir(e,r,n=!1){let{bodyForMetadata:i,externalBodyFile:s}=this.prepareBodyForSave(r.body),o={id:r.id,name:r.name,method:r.method||"GET",url:r.url||"",description:r.description,params:r.params,query:r.query,headers:r.headers,body:i,bodyContentType:r.bodyContentType,auth:r.auth,settings:r.settings,...r.disabled!==void 0&&{disabled:r.disabled},...r.deprecated&&{deprecated:r.deprecated},...r.operationId&&{operationId:r.operationId},...r.summary&&{summary:r.summary},...r.tags&&r.tags.length>0&&{tags:r.tags},...r.examples&&r.examples.length>0&&{examples:r.examples},...r.responses&&Object.keys(r.responses).length>0&&{responses:r.responses},...r.security&&r.security.length>0&&{security:r.security}},l=[Ne.promises.writeFile(je.join(e,Lr.request),JSON.stringify(o,null,2),"utf-8")];s&&l.push(Ne.promises.writeFile(je.join(e,s.filename),s.content,"utf-8")),n||l.push(this.cleanupOldBodyFiles(e,s?.filename)),(!n||r.responseSchema||r.bodySchema)&&l.push(this.saveSchemaFiles(e,r)),r.doc&&l.push(Ne.promises.writeFile(je.join(e,"doc.md"),r.doc,"utf-8")),r.scripts&&l.push(this.saveScriptsToDir(je.join(e,Sn),r.scripts)),await Promise.all(l)}prepareBodyForSave(e){return aq(e)}async cleanupOldBodyFiles(e,r){return lq(e,r)}async saveScriptsToDir(e,r){return Ih(e,r)}async delete(e){let r=this.idToSlugMap.get(e);if(!r&&(this.loadAll(),r=this.idToSlugMap.get(e),!r))return!1;let n=je.join(this.collectionsDir,r);if(!Ne.existsSync(n))return!1;try{return await Ne.promises.rm(n,{recursive:!0,force:!0}),this.cache.delete(e),this.idToSlugMap.delete(e),this.slugToIdMap.delete(r),!0}catch(i){return console.error(`[FolderCollectionStore] Failed to delete collection ${e}:`,i),!1}}exists(e){let r=this.idToSlugMap.get(e);return r?Ne.existsSync(je.join(this.collectionsDir,r,Lr.collection)):!1}getCollectionPath(e){let r=this.idToSlugMap.get(e)||e;return je.join(this.collectionsDir,r)}getItemPath(e,r){return this.findItemPath(e,r)}async create(e,r){let n={id:r||Pt(e),name:e,items:[]};return await this.save(n),n}async saveScripts(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.findItemPath(e,r);if(!s)throw new Error(`Item ${r} not found in collection ${e}`);await this.saveScriptsToDir(je.join(s,Sn),n);let o=this.findItemById(i.items,r);o&&(o.scripts=n)}loadScripts(e,r){let n=this.findItemPath(e,r);if(n)return this.loadScriptsFromDir(je.join(n,Sn))}async updateCollectionMetadata(e,r){let n=this.load(e);if(!n)throw new Error(`Collection ${e} not found`);let i=this.idToSlugMap.get(e);if(!i)throw new Error(`Collection slug not found for ${e}`);let s=je.join(this.collectionsDir,i),o=je.join(s,Lr.collection),l=Ne.readFileSync(o,"utf-8"),d={...JSON.parse(l),...r,id:e};await Ne.promises.writeFile(o,JSON.stringify(d,null,2),"utf-8"),r.name!==void 0&&(n.name=r.name),r.description!==void 0&&(n.description=r.description),r.version!==void 0&&(n.version=r.version),r.variables!==void 0&&(n.variables=r.variables),r.auth!==void 0&&(n.auth=r.auth)}async saveItem(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.idToSlugMap.get(e);if(!s)throw new Error(`Collection slug not found for ${e}`);let o;if(n){let p=this.findItemPath(e,n);if(!p)throw new Error(`Parent folder ${n} not found`);o=p}else o=je.join(this.collectionsDir,s);let l=this.idToSlugMap.get(r.id);if(!l){let p=Ne.readdirSync(o).filter(m=>Ne.statSync(je.join(o,m)).isDirectory()&&m!==Sn);l=Ln(r.name,p),this.idToSlugMap.set(r.id,l),this.slugToIdMap.set(l,r.id)}let c=je.join(o,l);await Ne.promises.mkdir(c,{recursive:!0}),r.type==="folder"?await this.saveFolderToDir(c,r):await this.saveRequestToDir(c,r);let d=this.findItemById(i.items,r.id);if(d)Object.assign(d,r);else if(n){let p=this.findItemById(i.items,n);p&&p.type==="folder"&&(p.items=p.items||[],p.items.push(r))}else i.items.push(r)}async deleteItem(e,r){let n=this.load(e);if(!n)return!1;let i=this.findItemPath(e,r);if(!i||!Ne.existsSync(i))return!1;try{await Ne.promises.rm(i,{recursive:!0,force:!0}),this.deleteItemFromTree(n.items,r);let s=this.idToSlugMap.get(r);return s&&(this.slugToIdMap.delete(s),this.idToSlugMap.delete(r)),!0}catch(s){return console.error(`[FolderCollectionStore] Failed to delete item ${r}:`,s),!1}}async updateItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.findItemPath(e,r);if(!s)return!1;let o=this.findItemById(i.items,r);if(!o)return!1;let{id:l,type:c,items:d,...p}=n;return Object.assign(o,p),o.type==="folder"?await this.saveFolderToDir(s,o):await this.saveRequestToDir(s,o),!0}async moveItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.idToSlugMap.get(e);if(!s)return!1;let o=this.findItemPath(e,r);if(!o||!Ne.existsSync(o))return!1;let l;if(n){let p=this.findItemPath(e,n);if(!p)return!1;l=p}else l=je.join(this.collectionsDir,s);let c=this.idToSlugMap.get(r);if(!c)return!1;let d=je.join(l,c);if(Ne.existsSync(d))return!1;try{await Ne.promises.rename(o,d);let p=this.findItemById(i.items,r);if(p){let m=p.type==="folder"?{...p,items:p.items?[...p.items]:[]}:{...p};if(this.deleteItemFromTree(i.items,r),n){let y=this.findItemById(i.items,n);y&&y.type==="folder"&&(y.items=y.items||[],y.items.push(m))}else i.items.push(m)}return!0}catch(p){return console.error(`[FolderCollectionStore] Failed to move item ${r}:`,p),!1}}async reorderItems(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.idToSlugMap.get(e);if(!s)return!1;let o=[];for(let l of n){let c=this.idToSlugMap.get(l);c&&o.push(c)}try{if(r){let l=this.findItemPath(e,r);if(!l)return!1;let c=je.join(l,Lr.folder),d=Ne.readFileSync(c,"utf-8"),p=JSON.parse(d);p.order=o,await Ne.promises.writeFile(c,JSON.stringify(p,null,2),"utf-8");let m=this.findItemById(i.items,r);m&&m.type==="folder"&&m.items&&(m.items=this.sortItemsByOrder(m.items,n))}else{let l=je.join(this.collectionsDir,s,Lr.collection),c=Ne.readFileSync(l,"utf-8"),d=JSON.parse(c);d.order=o,await Ne.promises.writeFile(l,JSON.stringify(d,null,2),"utf-8"),i.items=this.sortItemsByOrder(i.items,n)}return!0}catch(l){return console.error("[FolderCollectionStore] Failed to reorder items:",l),!1}}sortItemsByOrder(e,r){return fq(e,r)}findItemPath(e,r){let n=this.idToSlugMap.get(e);if(!n)return;let i=je.join(this.collectionsDir,n),s=sS(i,r);if(s)return s;let o=this.load(e);if(o){let c=this.buildSlugPath(o.items,r);if(c)return je.join(i,...c)}let l=this.idToSlugMap.get(r);if(l)return iS(i,l)}buildSlugPath(e,r){for(let n of e){let i=this.idToSlugMap.get(n.id);if(i){if(n.id===r)return[i];if(n.type==="folder"&&n.items){let s=this.buildSlugPath(n.items,r);if(s)return[i,...s]}}}}findItemById(e,r){return rS(e,r)}deleteItemFromTree(e,r){return nS(e,r)}}});var xt,ga=ae(()=>{"use strict";xt=class{static parseSetCookie(e,r){let n=e.split(";").map(p=>p.trim());if(n.length===0)return null;let[i,...s]=n,o=i.indexOf("=");if(o===-1)return null;let l=i.substring(0,o).trim(),c=i.substring(o+1).trim(),d={name:l,value:c,domain:r};for(let p of s){let m=p.indexOf("="),y=(m===-1?p:p.substring(0,m)).toLowerCase(),b=m===-1?"":p.substring(m+1);switch(y){case"domain":d.domain=b.startsWith(".")?b.substring(1):b;break;case"path":d.path=b;break;case"expires":d.expires=b;break;case"max-age":d.maxAge=parseInt(b,10);break;case"httponly":d.httpOnly=!0;break;case"secure":d.secure=!0;break;case"samesite":d.sameSite=b;break}}return d}static parseCookieHeaders(e,r){let n=[],i=e["set-cookie"]||e["Set-Cookie"];if(!i)return n;let s=Array.isArray(i)?i:[i];for(let o of s){let l=this.parseSetCookie(o,r);l&&n.push(l)}return n}static formatCookieHeader(e){return e.map(r=>`${r.name}=${r.value}`).join("; ")}static isExpired(e){return!!(e.expires&&new Date(e.expires).getTime()<Date.now()||e.maxAge!==void 0&&e.maxAge<=0)}static domainMatches(e,r){if(r==="*")return!0;let n=e.toLowerCase().split(".").reverse(),i=r.toLowerCase().split(".").reverse();if(i.length>n.length)return!1;for(let s=0;s<i.length;s++)if(i[s]!==n[s])return!1;return!0}static extractDomain(e){try{return new URL(e).hostname}catch{return""}}static extractPath(e){try{return new URL(e).pathname}catch{return"/"}}}});import*as oo from"fs";import*as ya from"path";function Ah(t){let e=t.toLowerCase();return e==="_global.json"||e==="_global.local.json"||e.endsWith(".local.json")}function nf(t){if(!oo.existsSync(t))return BL();let e=kh(ya.join(t,"_global.json"))||{},r=e.variables||{},n=e.defaultHeaders||{},i=oo.readdirSync(t).filter(d=>d.endsWith(".json")).filter(d=>!d.endsWith(".local.json")).filter(d=>!Ah(d)),s={};for(let d of i){let p=kh(ya.join(t,d))||{},m=ya.basename(d,".json");s[m]={description:p.description,requiresConfirmation:p.requiresConfirmation,variables:p.variables||{},secretVariables:p.secretVariables}}let l=(kh(ya.join(t,"_global.local.json"))||{}).variables||{},c={};for(let d of Object.keys(s)){let p=ya.join(t,`${d}.local.json`);if(oo.existsSync(p)){let m=kh(p)||{};c[d]={variables:m.variables||{}}}}return{globalVariables:r,defaultHeaders:n,environments:s,localVariables:l,localCredentials:c}}function BL(){return{globalVariables:{},defaultHeaders:{},environments:{},localVariables:{},localCredentials:{}}}function kh(t){try{if(!oo.existsSync(t))return null;let e=oo.readFileSync(t,"utf-8");return JSON.parse(e)}catch(e){return console.error(`[environment-file-loader] Failed to load JSON from ${t}:`,e),null}}var Th=ae(()=>{"use strict"});var li,Xl=ae(()=>{"use strict";li=class{buildUrl(e,r={},n={}){let i=e;return i=this.replacePathParams(i,r),i=this.appendQueryParams(i,n),i}replacePathParams(e,r){let n="",i="",s=e,o="",l=e.indexOf("?");l!==-1&&(o=e.substring(l),s=e.substring(0,l));let c=s.match(/^(https?:\/\/)([^\/]*)(\/.*)?$/);c&&(n=c[1],i=c[2],s=c[3]||"/");let d=/:(\w+)(?:\([^)]*\))?(\?)?/g,p=s.replace(d,(m,y,b)=>{let q=r[y];return q!==void 0&&q!==""?encodeURIComponent(q):b?"":(console.warn(`[UrlBuilder] Missing required path parameter: ${y}`),m)});return p=p.replace(/([^:])\/+/g,"$1/"),p.length>1&&p.endsWith("/")&&(p=p.slice(0,-1)),`${n}${i}${p}${o}`}extractPathParams(e){let r=/:(\w+)(?:\([^)]*\))?(\?)?/g,n=[],i;for(;(i=r.exec(e))!==null;)n.push(i[1]);return[...new Set(n)]}appendQueryParams(e,r){let n=e,i={};if(e.includes("?")){let[c,d]=e.split("?");n=c,d&&new URLSearchParams(d).forEach((m,y)=>{i[y]=m})}let s={...i,...r},o=new URLSearchParams;for(let[c,d]of Object.entries(s))d!=null&&o.append(c,d);let l=o.toString();return l?`${n}?${l}`:n}}});function pq(t,e=0){return(pr[t[e+0]]+pr[t[e+1]]+pr[t[e+2]]+pr[t[e+3]]+"-"+pr[t[e+4]]+pr[t[e+5]]+"-"+pr[t[e+6]]+pr[t[e+7]]+"-"+pr[t[e+8]]+pr[t[e+9]]+"-"+pr[t[e+10]]+pr[t[e+11]]+pr[t[e+12]]+pr[t[e+13]]+pr[t[e+14]]+pr[t[e+15]]).toLowerCase()}var pr,hq=ae(()=>{pr=[];for(let t=0;t<256;++t)pr.push((t+256).toString(16).slice(1))});function lS(){return crypto.getRandomValues(VL)}var VL,mq=ae(()=>{VL=new Uint8Array(16)});function WL(t,e,r){return!e&&!t&&crypto.randomUUID?crypto.randomUUID():zL(t,e,r)}function zL(t,e,r){t=t||{};let n=t.random??t.rng?.()??lS();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[r+i]=n[i];return e}return pq(n)}var eu,gq=ae(()=>{mq();hq();eu=WL});var uS=ae(()=>{gq()});function JL(t=0,e=999){return Math.floor(Math.random()*(e-t+1))+t}function GL(){return Date.now()}function yq(){return eu()}function YL(){return eu()}function vq(t=10){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r="";for(let n=0;n<t;n++)r+=e.charAt(Math.floor(Math.random()*e.length));return r}function KL(){let t=vq(8).toLowerCase(),e=["example.com","test.org","mail.dev","sample.net"];return`${t}@${e[Math.floor(Math.random()*e.length)]}`}function QL(){return Math.random()<.5}function ZL(t=10){let e="0123456789abcdef",r="";for(let n=0;n<t;n++)r+=e.charAt(Math.floor(Math.random()*e.length));return r}function XL(){return Math.floor(Date.now()/1e3)}function e2(){return new Date().toISOString()}function t2(){return new Date().toISOString().split("T")[0]}function r2(){return new Date().toISOString().split("T")[1].split(".")[0]}function n2(){return new Date().toISOString()}function i2(t=""){return Buffer.from(String(t)).toString("base64")}function s2(t=""){return Buffer.from(String(t),"base64").toString("utf-8")}function o2(t=""){return encodeURIComponent(String(t))}function a2(t=""){return decodeURIComponent(String(t))}function l2(t){return t?t.split(",").map(e=>{let r=e.trim(),n=Number(r);return!isNaN(n)&&r!==""?n:r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'")?r.slice(1,-1):r}):[]}function ys(t,e){let r=bq[t];return r?e&&e.length>0?r(...e):r():null}function u2(t){return!t||typeof t!="string"?t:t.replace(/\{\{\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?\}\}/g,(e,r,n)=>{try{let i=n?l2(n):void 0,s=ys(r,i);return s===null?e:String(s)}catch{return e}})}function va(t,e){let r=/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,n=null,i;for(;(i=r.exec(t))!==null;){let s=i[0],o=i[1];if(!(s in e)){let l=ys(o);l!==null&&(n||(n={...e}),n[s]=l)}}return n??e}var bq,$h=ae(()=>{"use strict";uS();bq={randomInt:JL,timestamp:GL,guid:YL,uuid:yq,randomUUID:yq,randomString:vq,randomHexadecimal:ZL,randomEmail:KL,randomBoolean:QL,isoTimestamp:n2,timestamp_s:XL,datetime:e2,date:t2,time:r2,base64Encode:i2,base64Decode:s2,urlEncode:o2,urlDecode:a2}});import*as Nh from"vm";function ba(t){let e=t.trim();return!e||/^(\$?)[a-zA-Z_][a-zA-Z0-9_]*(\([^)]*\))?$/.test(e)||/(?<!\|)\|(?!\|)/.test(e)?!1:/[+\-*/%<>=!&|?:~^()[\]{}.,`]/.test(e)}function Ui(t,e={}){try{let r={...e,Math,Date,JSON,Number,String,Boolean,Array,Object,parseInt,parseFloat,isNaN,isFinite,encodeURIComponent,decodeURIComponent,encodeURI,decodeURI,undefined:void 0,null:null,true:!0,false:!1,NaN:NaN,Infinity:1/0},n=Nh.createContext(r);return Nh.runInContext(t,n,{timeout:c2,displayErrors:!1})}catch{return}}var c2,sf=ae(()=>{"use strict";c2=100});import*as Mh from"crypto";function f2(t){if(typeof t=="string"&&t.charCodeAt(0)===30)try{return JSON.parse(t.slice(1))}catch{return t}return t}function af(t){if(!t||!t.includes("|"))return null;let e=d2(t);if(e.length<2)return null;let r=e[0].trim(),n=[];for(let i=1;i<e.length;i++){let s=e[i].trim();if(!s)continue;let o=p2(s);o&&n.push(o)}return n.length===0?null:{input:r,filters:n}}function d2(t){let e=[],r="",n=0,i=!1,s=!1;for(let o=0;o<t.length;o++){let l=t[o],c=o>0?t[o-1]:"",d=o<t.length-1?t[o+1]:"";if(c==="\\"){r+=l;continue}if(l==="'"&&!s)i=!i;else if(l==='"'&&!i)s=!s;else if(l==="("&&!i&&!s)n++;else if(l===")"&&!i&&!s)n--;else if(l==="|"&&n===0&&!i&&!s){if(d==="|"){r+="||",o++;continue}e.push(r),r="";continue}r+=l}return r&&e.push(r),e}function p2(t){let e=t.indexOf("(");if(e===-1)return{name:t.trim(),args:[]};let r=t.substring(0,e).trim(),n=t.substring(e+1,t.lastIndexOf(")"));return{name:r,args:h2(n)}}function h2(t){if(!t||!t.trim())return[];let e=[],r="",n=!1,i=!1;for(let s=0;s<t.length;s++){let o=t[s];if((s>0?t[s-1]:"")==="\\"){r+=o;continue}if(o==="'"&&!i){n=!n,r+=o;continue}else if(o==='"'&&!n){i=!i,r+=o;continue}else if(o===","&&!n&&!i){e.push(r.trim()),r="";continue}r+=o}return r.trim()&&e.push(r.trim()),e}function Wt(t,e){if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);let r=Number(t);if(!isNaN(r)&&t!=="")return r;if(t==="true")return!0;if(t==="false")return!1;if(e&&t in e){let n=f2(e[t]),i=Number(n);return!isNaN(i)&&n!==""?i:n}return t}function lf(t,e,r={}){let n=t;for(let i of e)n=m2(n,i.name,i.args,r);return n}function m2(t,e,r,n){switch(e){case"upper":return String(t).toUpperCase();case"lower":return String(t).toLowerCase();case"trim":return String(t).trim();case"length":return Array.isArray(t)?t.length:String(t).length;case"substring":{let i=Wt(r[0],n),s=r[1]!==void 0?Wt(r[1],n):void 0;return String(t).substring(i<0?String(t).length+i:i,s!==void 0?s<0?String(t).length+s:s:void 0)}case"replace":{let i=r[0]!==void 0?String(Wt(r[0],n)):"",s=r[1]!==void 0?String(Wt(r[1],n)):"";return String(t).replace(new RegExp(y2(i),"g"),s)}case"split":{let i=r[0]!==void 0?String(Wt(r[0],n)):",";return String(t).split(i)}case"join":{let i=r[0]!==void 0?String(Wt(r[0],n)):",";return Array.isArray(t)?t.join(i):String(t)}case"removeQuotes":return String(t).replace(/["']/g,"");case"removeSpaces":return String(t).replace(/\s/g,"");case"format":{let i=r[0]!==void 0?String(Wt(r[0],n)):"{0}";i=i.replace("{0}",String(t));for(let s=1;s<r.length;s++){let o=Wt(r[s],n);i=i.replace(`{${s}}`,String(o))}return i}case"add":{let i=Wt(r[0],n);return Number(t)+i}case"subtract":{let i=Wt(r[0],n);return Number(t)-i}case"multiply":{let i=Wt(r[0],n);return Number(t)*i}case"abs":return Math.abs(Number(t));case"btoa":return Buffer.from(String(t)).toString("base64");case"atob":return Buffer.from(String(t),"base64").toString("utf-8");case"urlEncode":return encodeURIComponent(String(t));case"urlDecode":return decodeURIComponent(String(t));case"hash":{let i=String(r[0]!==void 0?Wt(r[0],n):"md5").toLowerCase(),s=String(r[1]!==void 0?Wt(r[1],n):"base64"),l={md5:"md5",sha1:"sha1",sha256:"sha256",sha512:"sha512"}[i]||"md5";return Mh.createHash(l).update(String(t)).digest(s)}case"hmac":{let i=r[0]?String(Wt(r[0],n)):"",s=String(r[1]!==void 0?Wt(r[1],n):"sha256").toLowerCase(),o=String(r[2]!==void 0?Wt(r[2],n):"base64"),c={md5:"md5",sha1:"sha1",sha256:"sha256",sha512:"sha512"}[s]||"sha256";return Mh.createHmac(c,i).update(String(t)).digest(o)}case"first":return Array.isArray(t)?t[0]:t;case"last":return Array.isArray(t)?t[t.length-1]:t;case"at":{let i=Wt(r[0],n);return Array.isArray(t)?t.at(i):t}case"slice":{let i=Wt(r[0],n),s=r[1]!==void 0?Wt(r[1],n):void 0;return Array.isArray(t)?t.slice(i,s):String(t).slice(i,s)}case"unique":return Array.isArray(t)?[...new Set(t)]:t;case"filter":return!Array.isArray(t)||!r[0]?t:g2(t,r[0],n);case"map":{if(!Array.isArray(t))return t;let i=r.map(s=>String(Wt(s,n)));return i.length===1?t.map(s=>of(s,i[0])):t.map(s=>{let o={};for(let l of i){let c=of(s,l);c!==void 0&&(o[l]=c)}return o})}case"prop":{let i=r[0]!==void 0?String(Wt(r[0],n)):"";if(Array.isArray(t)){let s=t.map(o=>of(o,i)).filter(o=>o!==void 0);return s.length===1?s[0]:s.join(",")}return t&&typeof t=="object"?of(t,i):t}case"parseJSON":try{return JSON.parse(String(t))}catch{return t}case"stringify":try{return JSON.stringify(t)}catch{return String(t)}case"isEmail":return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t));case"isUrl":try{return new URL(String(t)),!0}catch{return!1}case"setIfValue":return t||void 0;case"setNull":return t===null?null:t;default:return t}}function g2(t,e,r){let n=e.match(/^([\w.]+)\s*(>=|<=|!=|\*=|\^=|\$=|>|<|=)\s*(.+)$/);if(!n)return t;let[,i,s,o]=n,l=Wt(o,r);return t.filter(c=>{let d=of(c,i);if(d===void 0)return!1;switch(s){case">":return Number(d)>Number(l);case">=":return Number(d)>=Number(l);case"<":return Number(d)<Number(l);case"<=":return Number(d)<=Number(l);case"=":return String(d)===String(l);case"!=":return String(d)!==String(l);case"*=":return String(d).includes(String(l));case"^=":return String(d).startsWith(String(l));case"$=":return String(d).endsWith(String(l));default:return!0}})}function of(t,e){if(!(!t||typeof t!="object"))return e in t?t[e]:e.split(".").reduce((r,n)=>r?.[n],t)}function y2(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Fh=ae(()=>{"use strict"});function Sq(t,e){if(t)return t.split(",").map(r=>{let n=r.trim();if(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))return n.slice(1,-1);let i=Number(n);if(!isNaN(i)&&n!=="")return i;if(e&&n in e){let s=e[n],o=Number(s);return!isNaN(o)&&s!==""?o:s}return n})}function v2(t){return new Sa(t)}var Sa,wa,uf=ae(()=>{"use strict";$h();sf();Fh();Sa=class t{allVariables;static MAX_RESOLUTION_DEPTH=20;constructor(e){this.allVariables={...e.globals,...e.collectionVariables,...e.environmentVariables,...e.variables}}resolveString(e,r=!1){return typeof e!="string"?e:this.resolveUntilStable(e,this.allVariables,r)}resolveStringWithExtra(e,r,n=!1){if(typeof e!="string")return e;let i={...this.allVariables,...r};return this.resolveUntilStable(e,i,n)}resolveUntilStable(e,r,n){let i=e;for(let s=0;s<t.MAX_RESOLUTION_DEPTH;s++){let o=this.resolveSinglePass(i,r,n);if(o===i)break;i=o}return i}resolveSinglePass(e,r,n){if(!n)return e.replace(/\{\{((?:[^}]|\}(?!\}))+)\}\}/g,(c,d)=>this.resolveTemplateContent(d.trim(),r,c));let i="",s=0,o=/\{\{((?:[^}]|\}(?!\}))+)\}\}/g,l;for(;(l=o.exec(e))!==null;){let c=l[1].trim(),d=this.resolveTemplateContent(c,r,l[0]);if(d!==l[0]){i+=e.slice(s,l.index);let p=this.getStringContext(e,l.index);i+=p?this.escapeForString(String(d),p):String(d)}else i+=e.slice(s,l.index+l[0].length);s=l.index+l[0].length}return i+=e.slice(s),i}resolveObject(e,r=!1){if(typeof e=="string")return this.resolveString(e,r);if(Array.isArray(e))return e.map(n=>this.resolveObject(n,r));if(e!==null&&typeof e=="object"){let n={};for(let[i,s]of Object.entries(e))n[i]=this.resolveObject(s,r);return n}return e}resolveObjectWithExtra(e,r,n=!1){if(typeof e=="string")return this.resolveStringWithExtra(e,r,n);if(Array.isArray(e))return e.map(i=>this.resolveObjectWithExtra(i,r,n));if(e!==null&&typeof e=="object"){let i={};for(let[s,o]of Object.entries(e))i[s]=this.resolveObjectWithExtra(o,r,n);return i}return e}resolveTemplateContent(e,r,n){let i=e.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(i){let l=Sq(i[2],r),c=ys(i[1],l);return c!==null?String(c):n}let s=af(e);if(s){let l=this.resolveFilterInput(s.input,r);if(l!==void 0){let c=lf(l,s.filters,r);return c!==void 0?String(c):n}return n}let o=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(\[.+\]|\..+)$/);if(o){let l=o[1];if(r[l]!==void 0){let c=this.deserializeValue(r[l]),d=o[2],p=this.resolvePropertyAccess(c,d);if(p!==void 0)return typeof p=="object"?JSON.stringify(p):String(p)}}if(r[e]!==void 0){let l=r[e];if(typeof l=="string"&&l.charCodeAt(0)===30){let c=l.slice(1);return c==="undefined"?"":c}return String(l)}if(ba(e)){let l=this.deserializeVariables(r),c=va(e,l),d=Ui(e,c);if(d!==void 0)return String(d)}return n}resolveFilterInput(e,r){if(e==="@")return"";if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1);let n=e.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(n){let s=Sq(n[2],r),o=ys(n[1],s);return o!==null?o:void 0}let i=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(\[.+\]|\..+)$/);if(i){let s=i[1];if(r[s]!==void 0){let o=this.deserializeValue(r[s]),l=this.resolvePropertyAccess(o,i[2]);if(l!==void 0)return l}}if(r[e]!==void 0)return this.deserializeValue(r[e]);if(ba(e)){let s=this.deserializeVariables(r),o=va(e,s),l=Ui(e,o);if(l!==void 0)return l}}deserializeValue(e){if(typeof e=="string"&&e.charCodeAt(0)===30){let r=e.slice(1);if(r==="undefined")return;try{return JSON.parse(r)}catch{return e}}return e}deserializeVariables(e){let r={};for(let[n,i]of Object.entries(e))r[n]=this.deserializeValue(i);return r}resolvePropertyAccess(e,r){let n=e,i=/\[(\d+|"[^"]*"|'[^']*')\]|\.([a-zA-Z_][a-zA-Z0-9_]*)/g,s;for(;(s=i.exec(r))!==null;){if(n==null)return;if(s[1]!==void 0){let o=s[1];/^\d+$/.test(o)?n=n[Number(o)]:n=n[o.slice(1,-1)]}else s[2]!==void 0&&(n=n[s[2]])}return n}escapeForString(e,r){let n=e.replace(/\\/g,"\\\\");return r==='"'?n=n.replace(/"/g,'\\"'):n=n.replace(/'/g,"\\'"),n.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}getStringContext(e,r){let n=null;for(let i=0;i<r;i++){let s=e[i];(i>0?e[i-1]:"")!=="\\"&&(s==='"'||s==="'")&&(n===null?n=s:n===s&&(n=null))}return n}},wa=class{interpolate(e,r){return!e||typeof e!="string"?e:new Sa({globals:{},collectionVariables:{},environmentVariables:{},variables:r}).resolveString(e,!0)}extractVariables(e){if(!e||typeof e!="string")return[];let r=[],n,i=/\{\{((?:[^}]|\}(?!\}))+)\}\}/g;for(;(n=i.exec(e))!==null;){let s=n[1].trim();!s.startsWith("$")&&!s.includes("|")&&/^[a-zA-Z_]\w*$/.test(s)&&(r.includes(s)||r.push(s))}return r}interpolateObject(e,r){if(e==null)return e;if(typeof e=="string")return this.interpolate(e,r);if(Array.isArray(e))return e.map(n=>this.interpolateObject(n,r));if(typeof e=="object"){let n={};for(let[i,s]of Object.entries(e))n[i]=this.interpolateObject(s,r);return n}return e}}});var vs,cf=ae(()=>{"use strict";vs=class{constructor(e,r,n){this.urlBuilder=e;this.interceptors=r;this.httpClient=n}urlBuilder;interceptors;httpClient;async execute(e){let r={},n;try{n=await this.interceptors.executeRequestInterceptors(e,r)}catch(i){let s=await this.interceptors.executeErrorInterceptors(i,e,r);if(s)return s;throw i}try{let i=await this.httpClient.send(n);return await this.interceptors.executeResponseInterceptors(i,n,r)}catch(i){let s=await this.interceptors.executeErrorInterceptors(i,n,r);if(s)return s;throw i}}buildUrl(e,r={},n={}){return this.urlBuilder.buildUrl(e,r,n)}}});var bs,cS,fS,dS,ff=ae(()=>{"use strict";bs=class{requestInterceptors=[];responseInterceptors=[];errorInterceptors=[];addRequestInterceptor(e){return this.requestInterceptors.push(e),this.sortByPriority(this.requestInterceptors),this}addResponseInterceptor(e){return this.responseInterceptors.push(e),this.sortByPriority(this.responseInterceptors),this}addErrorInterceptor(e){return this.errorInterceptors.push(e),this.sortByPriority(this.errorInterceptors),this}removeRequestInterceptor(e){let r=this.requestInterceptors.findIndex(n=>n.name===e);return r>=0?(this.requestInterceptors.splice(r,1),!0):!1}removeResponseInterceptor(e){let r=this.responseInterceptors.findIndex(n=>n.name===e);return r>=0?(this.responseInterceptors.splice(r,1),!0):!1}removeErrorInterceptor(e){let r=this.errorInterceptors.findIndex(n=>n.name===e);return r>=0?(this.errorInterceptors.splice(r,1),!0):!1}async executeRequestInterceptors(e,r){let n=e;for(let i of this.requestInterceptors)try{n=await i.intercept(n,r)}catch(s){throw console.error(`[InterceptorChain] Request interceptor '${i.name}' failed:`,s),s}return n}async executeResponseInterceptors(e,r,n){let i=e;for(let s of this.responseInterceptors)try{i=await s.intercept(i,r,n)}catch(o){throw console.error(`[InterceptorChain] Response interceptor '${s.name}' failed:`,o),o}return i}async executeErrorInterceptors(e,r,n){for(let i of this.errorInterceptors)try{let s=await i.handle(e,r,n);if(s)return s}catch(s){console.error(`[InterceptorChain] Error interceptor '${i.name}' failed:`,s)}}clear(){this.requestInterceptors=[],this.responseInterceptors=[],this.errorInterceptors=[]}getRegisteredInterceptors(){return{request:this.requestInterceptors.map(e=>e.name),response:this.responseInterceptors.map(e=>e.name),error:this.errorInterceptors.map(e=>e.name)}}sortByPriority(e){e.sort((r,n)=>(r.priority??100)-(n.priority??100))}},cS=class{name="logging";priority=1e3;intercept(e,r){return e}},fS=class{name="timing";priority=1;intercept(e,r,n){return e}},dS=class{name="retry";priority=1;maxRetries;retryableErrors;constructor(e=3,r=["ECONNRESET","ETIMEDOUT"]){this.maxRetries=e,this.retryableErrors=r}handle(e,r,n){let i=this.retryableErrors.some(s=>e.message.includes(s))}}});var wq=V((tu,df)=>{(function(){var t,e="4.18.1",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",s="Invalid `variable` option passed into `_.template`",o="Invalid `imports` option passed into `_.template`",l="__lodash_hash_undefined__",c=500,d="__lodash_placeholder__",p=1,m=2,y=4,b=1,q=2,C=1,v=2,_=4,E=8,k=16,O=32,M=64,j=128,I=256,R=512,A=30,F="...",U=800,D=16,J=1,Q=2,se=3,ce=1/0,Be=9007199254740991,_e=17976931348623157e292,me=NaN,ke=4294967295,mt=ke-1,Nt=ke>>>1,pe=[["ary",j],["bind",C],["bindKey",v],["curry",E],["curryRight",k],["flip",R],["partial",O],["partialRight",M],["rearg",I]],Gt="[object Arguments]",Pr="[object Array]",lt="[object AsyncFunction]",kr="[object Boolean]",vr="[object Date]",Ct="[object DOMException]",St="[object Error]",Wr="[object Function]",Ms="[object GeneratorFunction]",At="[object Map]",Pi="[object Number]",En="[object Null]",te="[object Object]",ne="[object Promise]",Ie="[object Proxy]",ye="[object RegExp]",ve="[object Set]",Ye="[object String]",ur="[object Symbol]",Ae="[object Undefined]",ge="[object WeakMap]",qn="[object WeakSet]",fn="[object ArrayBuffer]",gt="[object DataView]",Ee="[object Float32Array]",On="[object Float64Array]",cl="[object Int8Array]",Fs="[object Int16Array]",Uo="[object Int32Array]",Ds="[object Uint8Array]",ki="[object Uint8ClampedArray]",js="[object Uint16Array]",mc="[object Uint32Array]",fl=/\b__p \+= '';/g,Ly=/\b(__p \+=) '' \+/g,Ho=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ts=/&(?:amp|lt|gt|quot|#39);/g,dl=/[&<>"']/g,pl=RegExp(ts.source),he=RegExp(dl.source),Uy=/<%-([\s\S]+?)%>/g,Hy=/<%([\s\S]+?)%>/g,In=/<%=([\s\S]+?)%>/g,zr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ve=/^\w*$/,gc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ft=/[\\^$.*+?()[\]{}|]/g,Bo=RegExp(ft.source),yc=/^\s+/,hl=/\s/,cr=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Kn=/\{\n\/\* \[wrapped with (.+)\] \*/,Pn=/,? & /,Yt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Jr=/[()=,{}\[\]\/\s]/,Qn=/\\(\\)?/g,rs=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,mp=/\w*$/,By=/^[-+]0x[0-9a-f]+$/i,Vo=/^0b[01]+$/i,gp=/^\[object .+?Constructor\]$/,Vy=/^0o[0-7]+$/i,Ls=/^(?:0|[1-9]\d*)$/,Wo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,zo=/($^)/,Wy=/['\n\r\u2028\u2029\\]/g,ml="\\ud800-\\udfff",zy="\\u0300-\\u036f",Lt="\\ufe20-\\ufe2f",vc="\\u20d0-\\u20ff",yp=zy+Lt+vc,bc="\\u2700-\\u27bf",Sc="a-z\\xdf-\\xf6\\xf8-\\xff",Jy="\\xac\\xb1\\xd7\\xf7",Gy="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Yy="\\u2000-\\u206f",Ky=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",vp="A-Z\\xc0-\\xd6\\xd8-\\xde",bp="\\ufe0e\\ufe0f",wc=Jy+Gy+Yy+Ky,gl="['\u2019]",Qy="["+ml+"]",Sp="["+wc+"]",yl="["+yp+"]",_c="\\d+",Zy="["+bc+"]",Us="["+Sc+"]",Jo="[^"+ml+wc+_c+bc+Sc+vp+"]",vl="\\ud83c[\\udffb-\\udfff]",Go="(?:"+yl+"|"+vl+")",kn="[^"+ml+"]",Rc="(?:\\ud83c[\\udde6-\\uddff]){2}",Cc="[\\ud800-\\udbff][\\udc00-\\udfff]",Hs="["+vp+"]",wp="\\u200d",_p="(?:"+Us+"|"+Jo+")",Xy="(?:"+Hs+"|"+Jo+")",Rp="(?:"+gl+"(?:d|ll|m|re|s|t|ve))?",Cp="(?:"+gl+"(?:D|LL|M|RE|S|T|VE))?",bl=Go+"?",xp="["+bp+"]?",Ep="(?:"+wp+"(?:"+[kn,Rc,Cc].join("|")+")"+xp+bl+")*",ev="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tv="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",qp=xp+bl+Ep,rv="(?:"+[Zy,Rc,Cc].join("|")+")"+qp,nv="(?:"+[kn+yl+"?",yl,Rc,Cc,Qy].join("|")+")",iv=RegExp(gl,"g"),sv=RegExp(yl,"g"),xc=RegExp(vl+"(?="+vl+")|"+nv+qp,"g"),ov=RegExp([Hs+"?"+Us+"+"+Rp+"(?="+[Sp,Hs,"$"].join("|")+")",Xy+"+"+Cp+"(?="+[Sp,Hs+_p,"$"].join("|")+")",Hs+"?"+_p+"+"+Rp,Hs+"+"+Cp,tv,ev,_c,rv].join("|"),"g"),av=RegExp("["+wp+ml+yp+bp+"]"),lv=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,uv=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],cv=-1,It={};It[Ee]=It[On]=It[cl]=It[Fs]=It[Uo]=It[Ds]=It[ki]=It[js]=It[mc]=!0,It[Gt]=It[Pr]=It[fn]=It[kr]=It[gt]=It[vr]=It[St]=It[Wr]=It[At]=It[Pi]=It[te]=It[ye]=It[ve]=It[Ye]=It[ge]=!1;var Et={};Et[Gt]=Et[Pr]=Et[fn]=Et[gt]=Et[kr]=Et[vr]=Et[Ee]=Et[On]=Et[cl]=Et[Fs]=Et[Uo]=Et[At]=Et[Pi]=Et[te]=Et[ye]=Et[ve]=Et[Ye]=Et[ur]=Et[Ds]=Et[ki]=Et[js]=Et[mc]=!0,Et[St]=Et[Wr]=Et[ge]=!1;var Ec={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},qc={"&":"&","<":"<",">":">",'"':""","'":"'"},fv={"&":"&","<":"<",">":">",""":'"',"'":"'"},Op={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ip=parseFloat,dv=parseInt,Pp=typeof global=="object"&&global&&global.Object===Object&&global,pv=typeof self=="object"&&self&&self.Object===Object&&self,Xt=Pp||pv||Function("return this")(),Sl=typeof tu=="object"&&tu&&!tu.nodeType&&tu,dt=Sl&&typeof df=="object"&&df&&!df.nodeType&&df,Bs=dt&&dt.exports===Sl,ns=Bs&&Pp.process,Gr=(function(){try{var W=dt&&dt.require&&dt.require("util").types;return W||ns&&ns.binding&&ns.binding("util")}catch{}})(),Oc=Gr&&Gr.isArrayBuffer,kp=Gr&&Gr.isDate,Ap=Gr&&Gr.isMap,Yo=Gr&&Gr.isRegExp,Zn=Gr&&Gr.isSet,wl=Gr&&Gr.isTypedArray;function Ar(W,Z,Y){switch(Y.length){case 0:return W.call(Z);case 1:return W.call(Z,Y[0]);case 2:return W.call(Z,Y[0],Y[1]);case 3:return W.call(Z,Y[0],Y[1],Y[2])}return W.apply(Z,Y)}function Xn(W,Z,Y,de){for(var Oe=-1,ut=W==null?0:W.length;++Oe<ut;){var vt=W[Oe];Z(de,vt,Y(vt),W)}return de}function Tr(W,Z){for(var Y=-1,de=W==null?0:W.length;++Y<de&&Z(W[Y],Y,W)!==!1;);return W}function Ic(W,Z){for(var Y=W==null?0:W.length;Y--&&Z(W[Y],Y,W)!==!1;);return W}function Tp(W,Z){for(var Y=-1,de=W==null?0:W.length;++Y<de;)if(!Z(W[Y],Y,W))return!1;return!0}function Ai(W,Z){for(var Y=-1,de=W==null?0:W.length,Oe=0,ut=[];++Y<de;){var vt=W[Y];Z(vt,Y,W)&&(ut[Oe++]=vt)}return ut}function _l(W,Z){var Y=W==null?0:W.length;return!!Y&&is(W,Z,0)>-1}function Vs(W,Z,Y){for(var de=-1,Oe=W==null?0:W.length;++de<Oe;)if(Y(Z,W[de]))return!0;return!1}function qt(W,Z){for(var Y=-1,de=W==null?0:W.length,Oe=Array(de);++Y<de;)Oe[Y]=Z(W[Y],Y,W);return Oe}function Ti(W,Z){for(var Y=-1,de=Z.length,Oe=W.length;++Y<de;)W[Oe+Y]=Z[Y];return W}function Pc(W,Z,Y,de){var Oe=-1,ut=W==null?0:W.length;for(de&&ut&&(Y=W[++Oe]);++Oe<ut;)Y=Z(Y,W[Oe],Oe,W);return Y}function hv(W,Z,Y,de){var Oe=W==null?0:W.length;for(de&&Oe&&(Y=W[--Oe]);Oe--;)Y=Z(Y,W[Oe],Oe,W);return Y}function Rl(W,Z){for(var Y=-1,de=W==null?0:W.length;++Y<de;)if(Z(W[Y],Y,W))return!0;return!1}var mv=Ko("length");function gv(W){return W.split("")}function yv(W){return W.match(Yt)||[]}function $p(W,Z,Y){var de;return Y(W,function(Oe,ut,vt){if(Z(Oe,ut,vt))return de=ut,!1}),de}function Cl(W,Z,Y,de){for(var Oe=W.length,ut=Y+(de?1:-1);de?ut--:++ut<Oe;)if(Z(W[ut],ut,W))return ut;return-1}function is(W,Z,Y){return Z===Z?Ev(W,Z,Y):Cl(W,ss,Y)}function vv(W,Z,Y,de){for(var Oe=Y-1,ut=W.length;++Oe<ut;)if(de(W[Oe],Z))return Oe;return-1}function ss(W){return W!==W}function Np(W,Z){var Y=W==null?0:W.length;return Y?Ac(W,Z)/Y:me}function Ko(W){return function(Z){return Z==null?t:Z[W]}}function kc(W){return function(Z){return W==null?t:W[Z]}}function xl(W,Z,Y,de,Oe){return Oe(W,function(ut,vt,Xe){Y=de?(de=!1,ut):Z(Y,ut,vt,Xe)}),Y}function bv(W,Z){var Y=W.length;for(W.sort(Z);Y--;)W[Y]=W[Y].value;return W}function Ac(W,Z){for(var Y,de=-1,Oe=W.length;++de<Oe;){var ut=Z(W[de]);ut!==t&&(Y=Y===t?ut:Y+ut)}return Y}function Tc(W,Z){for(var Y=-1,de=Array(W);++Y<W;)de[Y]=Z(Y);return de}function Sv(W,Z){return qt(Z,function(Y){return[Y,W[Y]]})}function $c(W){return W&&W.slice(0,Lp(W)+1).replace(yc,"")}function $r(W){return function(Z){return W(Z)}}function El(W,Z){return qt(Z,function(Y){return W[Y]})}function yt(W,Z){return W.has(Z)}function Mp(W,Z){for(var Y=-1,de=W.length;++Y<de&&is(Z,W[Y],0)>-1;);return Y}function Fp(W,Z){for(var Y=W.length;Y--&&is(Z,W[Y],0)>-1;);return Y}function Dp(W,Z){for(var Y=W.length,de=0;Y--;)W[Y]===Z&&++de;return de}var wv=kc(Ec),_v=kc(qc);function Rv(W){return"\\"+Op[W]}function Qo(W,Z){return W==null?t:W[Z]}function Ws(W){return av.test(W)}function Cv(W){return lv.test(W)}function xv(W){for(var Z,Y=[];!(Z=W.next()).done;)Y.push(Z.value);return Y}function zs(W){var Z=-1,Y=Array(W.size);return W.forEach(function(de,Oe){Y[++Z]=[Oe,de]}),Y}function Zo(W,Z){return function(Y){return W(Z(Y))}}function An(W,Z){for(var Y=-1,de=W.length,Oe=0,ut=[];++Y<de;){var vt=W[Y];(vt===Z||vt===d)&&(W[Y]=d,ut[Oe++]=Y)}return ut}function ql(W){var Z=-1,Y=Array(W.size);return W.forEach(function(de){Y[++Z]=de}),Y}function jp(W){var Z=-1,Y=Array(W.size);return W.forEach(function(de){Y[++Z]=[de,de]}),Y}function Ev(W,Z,Y){for(var de=Y-1,Oe=W.length;++de<Oe;)if(W[de]===Z)return de;return-1}function Nc(W,Z,Y){for(var de=Y+1;de--;)if(W[de]===Z)return de;return de}function $i(W){return Ws(W)?Ov(W):mv(W)}function Nr(W){return Ws(W)?Iv(W):gv(W)}function Lp(W){for(var Z=W.length;Z--&&hl.test(W.charAt(Z)););return Z}var qv=kc(fv);function Ov(W){for(var Z=xc.lastIndex=0;xc.test(W);)++Z;return Z}function Iv(W){return W.match(xc)||[]}function Pv(W){return W.match(ov)||[]}var kv=(function W(Z){Z=Z==null?Xt:Ni.defaults(Xt.Object(),Z,Ni.pick(Xt,uv));var Y=Z.Array,de=Z.Date,Oe=Z.Error,ut=Z.Function,vt=Z.Math,Xe=Z.Object,Ol=Z.RegExp,Av=Z.String,Mr=Z.TypeError,Xo=Y.prototype,Tv=ut.prototype,Js=Xe.prototype,ea=Z["__core-js_shared__"],Il=Tv.toString,pt=Js.hasOwnProperty,$v=0,Up=(function(){var a=/[^.]+$/.exec(ea&&ea.keys&&ea.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})(),Pl=Js.toString,Nv=Il.call(Xe),Mv=Xt._,Fv=Ol("^"+Il.call(pt).replace(ft,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kl=Bs?Z.Buffer:t,Mi=Z.Symbol,Al=Z.Uint8Array,Hp=kl?kl.allocUnsafe:t,Tl=Zo(Xe.getPrototypeOf,Xe),Bp=Xe.create,ta=Js.propertyIsEnumerable,$l=Xo.splice,Vp=Mi?Mi.isConcatSpreadable:t,ra=Mi?Mi.iterator:t,os=Mi?Mi.toStringTag:t,Nl=(function(){try{var a=da(Xe,"defineProperty");return a({},"",{}),a}catch{}})(),Dv=Z.clearTimeout!==Xt.clearTimeout&&Z.clearTimeout,jv=de&&de.now!==Xt.Date.now&&de.now,Lv=Z.setTimeout!==Xt.setTimeout&&Z.setTimeout,na=vt.ceil,ia=vt.floor,Ml=Xe.getOwnPropertySymbols,Fl=kl?kl.isBuffer:t,as=Z.isFinite,Dl=Xo.join,Wp=Zo(Xe.keys,Xe),Tt=vt.max,ir=vt.min,zp=de.now,Uv=Z.parseInt,Jp=vt.random,Hv=Xo.reverse,Mc=da(Z,"DataView"),sa=da(Z,"Map"),Fc=da(Z,"Promise"),Gs=da(Z,"Set"),oa=da(Z,"WeakMap"),aa=da(Xe,"create"),jl=oa&&new oa,Ys={},Bv=pa(Mc),Vv=pa(sa),Wv=pa(Fc),zv=pa(Gs),Jv=pa(oa),Ll=Mi?Mi.prototype:t,la=Ll?Ll.valueOf:t,Gp=Ll?Ll.toString:t;function $(a){if(Bt(a)&&!$e(a)&&!(a instanceof We)){if(a instanceof br)return a;if(pt.call(a,"__wrapped__"))return _E(a)}return new br(a)}var Ks=(function(){function a(){}return function(u){if(!Ut(u))return{};if(Bp)return Bp(u);a.prototype=u;var h=new a;return a.prototype=t,h}})();function Ul(){}function br(a,u){this.__wrapped__=a,this.__actions__=[],this.__chain__=!!u,this.__index__=0,this.__values__=t}$.templateSettings={escape:Uy,evaluate:Hy,interpolate:In,variable:"",imports:{_:$}},$.prototype=Ul.prototype,$.prototype.constructor=$,br.prototype=Ks(Ul.prototype),br.prototype.constructor=br;function We(a){this.__wrapped__=a,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ke,this.__views__=[]}function Gv(){var a=new We(this.__wrapped__);return a.__actions__=Yr(this.__actions__),a.__dir__=this.__dir__,a.__filtered__=this.__filtered__,a.__iteratees__=Yr(this.__iteratees__),a.__takeCount__=this.__takeCount__,a.__views__=Yr(this.__views__),a}function Yv(){if(this.__filtered__){var a=new We(this);a.__dir__=-1,a.__filtered__=!0}else a=this.clone(),a.__dir__*=-1;return a}function Dc(){var a=this.__wrapped__.value(),u=this.__dir__,h=$e(a),S=u<0,P=h?a.length:0,N=iM(0,P,this.__views__),L=N.start,B=N.end,z=B-L,X=S?B:L-1,ee=this.__iteratees__,re=ee.length,ue=0,be=ir(z,this.__takeCount__);if(!h||!S&&P==z&&be==z)return Wx(a,this.__actions__);var xe=[];e:for(;z--&&ue<be;){X+=u;for(var De=-1,Re=a[X];++De<re;){var Qe=ee[De],et=Qe.iteratee,yn=Qe.type,jr=et(Re);if(yn==Q)Re=jr;else if(!jr){if(yn==J)continue e;break e}}xe[ue++]=Re}return xe}We.prototype=Ks(Ul.prototype),We.prototype.constructor=We;function Tn(a){var u=-1,h=a==null?0:a.length;for(this.clear();++u<h;){var S=a[u];this.set(S[0],S[1])}}function Kv(){this.__data__=aa?aa(null):{},this.size=0}function Qv(a){var u=this.has(a)&&delete this.__data__[a];return this.size-=u?1:0,u}function Zv(a){var u=this.__data__;if(aa){var h=u[a];return h===l?t:h}return pt.call(u,a)?u[a]:t}function Xv(a){var u=this.__data__;return aa?u[a]!==t:pt.call(u,a)}function eb(a,u){var h=this.__data__;return this.size+=this.has(a)?0:1,h[a]=aa&&u===t?l:u,this}Tn.prototype.clear=Kv,Tn.prototype.delete=Qv,Tn.prototype.get=Zv,Tn.prototype.has=Xv,Tn.prototype.set=eb;function ei(a){var u=-1,h=a==null?0:a.length;for(this.clear();++u<h;){var S=a[u];this.set(S[0],S[1])}}function Yp(){this.__data__=[],this.size=0}function tb(a){var u=this.__data__,h=Bl(u,a);if(h<0)return!1;var S=u.length-1;return h==S?u.pop():$l.call(u,h,1),--this.size,!0}function rb(a){var u=this.__data__,h=Bl(u,a);return h<0?t:u[h][1]}function Kp(a){return Bl(this.__data__,a)>-1}function nb(a,u){var h=this.__data__,S=Bl(h,a);return S<0?(++this.size,h.push([a,u])):h[S][1]=u,this}ei.prototype.clear=Yp,ei.prototype.delete=tb,ei.prototype.get=rb,ei.prototype.has=Kp,ei.prototype.set=nb;function ti(a){var u=-1,h=a==null?0:a.length;for(this.clear();++u<h;){var S=a[u];this.set(S[0],S[1])}}function ib(){this.size=0,this.__data__={hash:new Tn,map:new(sa||ei),string:new Tn}}function Fi(a){var u=yh(this,a).delete(a);return this.size-=u?1:0,u}function Qp(a){return yh(this,a).get(a)}function sb(a){return yh(this,a).has(a)}function ob(a,u){var h=yh(this,a),S=h.size;return h.set(a,u),this.size+=h.size==S?0:1,this}ti.prototype.clear=ib,ti.prototype.delete=Fi,ti.prototype.get=Qp,ti.prototype.has=sb,ti.prototype.set=ob;function ls(a){var u=-1,h=a==null?0:a.length;for(this.__data__=new ti;++u<h;)this.add(a[u])}function ie(a){return this.__data__.set(a,l),this}function ab(a){return this.__data__.has(a)}ls.prototype.add=ls.prototype.push=ie,ls.prototype.has=ab;function dn(a){var u=this.__data__=new ei(a);this.size=u.size}function Zp(){this.__data__=new ei,this.size=0}function rt(a){var u=this.__data__,h=u.delete(a);return this.size=u.size,h}function Hl(a){return this.__data__.get(a)}function Xp(a){return this.__data__.has(a)}function jc(a,u){var h=this.__data__;if(h instanceof ei){var S=h.__data__;if(!sa||S.length<r-1)return S.push([a,u]),this.size=++h.size,this;h=this.__data__=new ti(S)}return h.set(a,u),this.size=h.size,this}dn.prototype.clear=Zp,dn.prototype.delete=rt,dn.prototype.get=Hl,dn.prototype.has=Xp,dn.prototype.set=jc;function eh(a,u){var h=$e(a),S=!h&&ha(a),P=!h&&!S&&no(a),N=!h&&!S&&!P&&Yl(a),L=h||S||P||N,B=L?Tc(a.length,Av):[],z=B.length;for(var X in a)(u||pt.call(a,X))&&!(L&&(X=="length"||P&&(X=="offset"||X=="parent")||N&&(X=="buffer"||X=="byteLength"||X=="byteOffset")||ds(X,z)))&&B.push(X);return B}function th(a){var u=a.length;return u?a[Sb(0,u-1)]:t}function lb(a,u){return vh(Yr(a),Di(u,0,a.length))}function ub(a){return vh(Yr(a))}function Lc(a,u,h){(h!==t&&!oi(a[u],h)||h===t&&!(u in a))&&pn(a,u,h)}function Fr(a,u,h){var S=a[u];(!(pt.call(a,u)&&oi(S,h))||h===t&&!(u in a))&&pn(a,u,h)}function Bl(a,u){for(var h=a.length;h--;)if(oi(a[h][0],u))return h;return-1}function rh(a,u,h,S){return ji(a,function(P,N,L){u(S,P,h(P),L)}),S}function nh(a,u){return a&&Li(u,fr(u),a)}function cb(a,u){return a&&Li(u,Qr(u),a)}function pn(a,u,h){u=="__proto__"&&Nl?Nl(a,u,{configurable:!0,enumerable:!0,value:h,writable:!0}):a[u]=h}function Uc(a,u){for(var h=-1,S=u.length,P=Y(S),N=a==null;++h<S;)P[h]=N?t:zb(a,u[h]);return P}function Di(a,u,h){return a===a&&(h!==t&&(a=a<=h?a:h),u!==t&&(a=a>=u?a:u)),a}function Sr(a,u,h,S,P,N){var L,B=u&p,z=u&m,X=u&y;if(h&&(L=P?h(a,S,P,N):h(a)),L!==t)return L;if(!Ut(a))return a;var ee=$e(a);if(ee){if(L=oM(a),!B)return Yr(a,L)}else{var re=wr(a),ue=re==Wr||re==Ms;if(no(a))return Gx(a,B);if(re==te||re==Gt||ue&&!P){if(L=z||ue?{}:pE(a),!B)return z?YN(a,cb(L,a)):GN(a,nh(L,a))}else{if(!Et[re])return P?a:{};L=aM(a,re,B)}}N||(N=new dn);var be=N.get(a);if(be)return be;N.set(a,L),HE(a)?a.forEach(function(Re){L.add(Sr(Re,u,h,Re,a,N))}):LE(a)&&a.forEach(function(Re,Qe){L.set(Qe,Sr(Re,u,h,Qe,a,N))});var xe=X?z?kb:Pb:z?Qr:fr,De=ee?t:xe(a);return Tr(De||a,function(Re,Qe){De&&(Qe=Re,Re=a[Qe]),Fr(L,Qe,Sr(Re,u,h,Qe,a,N))}),L}function fb(a){var u=fr(a);return function(h){return $n(h,a,u)}}function $n(a,u,h){var S=h.length;if(a==null)return!S;for(a=Xe(a);S--;){var P=h[S],N=u[P],L=a[P];if(L===t&&!(P in a)||!N(L))return!1}return!0}function Hc(a,u,h){if(typeof a!="function")throw new Mr(i);return Yc(function(){a.apply(t,h)},u)}function ua(a,u,h,S){var P=-1,N=_l,L=!0,B=a.length,z=[],X=u.length;if(!B)return z;h&&(u=qt(u,$r(h))),S?(N=Vs,L=!1):u.length>=r&&(N=yt,L=!1,u=new ls(u));e:for(;++P<B;){var ee=a[P],re=h==null?ee:h(ee);if(ee=S||ee!==0?ee:0,L&&re===re){for(var ue=X;ue--;)if(u[ue]===re)continue e;z.push(ee)}else N(u,re,S)||z.push(ee)}return z}var ji=Xx(Nn),ih=Xx(ri,!0);function db(a,u){var h=!0;return ji(a,function(S,P,N){return h=!!u(S,P,N),h}),h}function Vl(a,u,h){for(var S=-1,P=a.length;++S<P;){var N=a[S],L=u(N);if(L!=null&&(B===t?L===L&&!gn(L):h(L,B)))var B=L,z=N}return z}function pb(a,u,h,S){var P=a.length;for(h=Me(h),h<0&&(h=-h>P?0:P+h),S=S===t||S>P?P:Me(S),S<0&&(S+=P),S=h>S?0:VE(S);h<S;)a[h++]=u;return a}function sh(a,u){var h=[];return ji(a,function(S,P,N){u(S,P,N)&&h.push(S)}),h}function sr(a,u,h,S,P){var N=-1,L=a.length;for(h||(h=uM),P||(P=[]);++N<L;){var B=a[N];u>0&&h(B)?u>1?sr(B,u-1,h,S,P):Ti(P,B):S||(P[P.length]=B)}return P}var Bc=eE(),oh=eE(!0);function Nn(a,u){return a&&Bc(a,u,fr)}function ri(a,u){return a&&oh(a,u,fr)}function Wl(a,u){return Ai(u,function(h){return ps(a[h])})}function us(a,u){u=to(u,a);for(var h=0,S=u.length;a!=null&&h<S;)a=a[si(u[h++])];return h&&h==S?a:t}function ah(a,u,h){var S=u(a);return $e(a)?S:Ti(S,h(a))}function dr(a){return a==null?a===t?Ae:En:os&&os in Xe(a)?nM(a):gM(a)}function Vc(a,u){return a>u}function hb(a,u){return a!=null&&pt.call(a,u)}function mb(a,u){return a!=null&&u in Xe(a)}function gb(a,u,h){return a>=ir(u,h)&&a<Tt(u,h)}function hn(a,u,h){for(var S=h?Vs:_l,P=a[0].length,N=a.length,L=N,B=Y(N),z=1/0,X=[];L--;){var ee=a[L];L&&u&&(ee=qt(ee,$r(u))),z=ir(ee.length,z),B[L]=!h&&(u||P>=120&&ee.length>=120)?new ls(L&&ee):t}ee=a[0];var re=-1,ue=B[0];e:for(;++re<P&&X.length<z;){var be=ee[re],xe=u?u(be):be;if(be=h||be!==0?be:0,!(ue?yt(ue,xe):S(X,xe,h))){for(L=N;--L;){var De=B[L];if(!(De?yt(De,xe):S(a[L],xe,h)))continue e}ue&&ue.push(xe),X.push(be)}}return X}function Qs(a,u,h,S){return Nn(a,function(P,N,L){u(S,h(P),N,L)}),S}function ca(a,u,h){u=to(u,a),a=yE(a,u);var S=a==null?a:a[si(Fn(u))];return S==null?t:Ar(S,a,h)}function lh(a){return Bt(a)&&dr(a)==Gt}function yb(a){return Bt(a)&&dr(a)==fn}function vb(a){return Bt(a)&&dr(a)==vr}function fa(a,u,h,S,P){return a===u?!0:a==null||u==null||!Bt(a)&&!Bt(u)?a!==a&&u!==u:Wc(a,u,h,S,fa,P)}function Wc(a,u,h,S,P,N){var L=$e(a),B=$e(u),z=L?Pr:wr(a),X=B?Pr:wr(u);z=z==Gt?te:z,X=X==Gt?te:X;var ee=z==te,re=X==te,ue=z==X;if(ue&&no(a)){if(!no(u))return!1;L=!0,ee=!1}if(ue&&!ee)return N||(N=new dn),L||Yl(a)?cE(a,u,h,S,P,N):tM(a,u,z,h,S,P,N);if(!(h&b)){var be=ee&&pt.call(a,"__wrapped__"),xe=re&&pt.call(u,"__wrapped__");if(be||xe){var De=be?a.value():a,Re=xe?u.value():u;return N||(N=new dn),P(De,Re,h,S,N)}}return ue?(N||(N=new dn),rM(a,u,h,S,P,N)):!1}function Zs(a){return Bt(a)&&wr(a)==At}function Xs(a,u,h,S){var P=h.length,N=P,L=!S;if(a==null)return!N;for(a=Xe(a);P--;){var B=h[P];if(L&&B[2]?B[1]!==a[B[0]]:!(B[0]in a))return!1}for(;++P<N;){B=h[P];var z=B[0],X=a[z],ee=B[1];if(L&&B[2]){if(X===t&&!(z in a))return!1}else{var re=new dn;if(S)var ue=S(X,ee,z,a,u,re);if(!(ue===t?fa(ee,X,b|q,S,re):ue))return!1}}return!0}function Ke(a){if(!Ut(a)||fM(a))return!1;var u=ps(a)?Fv:gp;return u.test(pa(a))}function f(a){return Bt(a)&&dr(a)==ye}function g(a){return Bt(a)&&wr(a)==ve}function w(a){return Bt(a)&&Ch(a.length)&&!!It[dr(a)]}function x(a){return typeof a=="function"?a:a==null?Zr:typeof a=="object"?$e(a)?ze(a[0],a[1]):qe(a):rq(a)}function T(a){if(!Gc(a))return Wp(a);var u=[];for(var h in Xe(a))pt.call(a,h)&&h!="constructor"&&u.push(h);return u}function H(a){if(!Ut(a))return mM(a);var u=Gc(a),h=[];for(var S in a)S=="constructor"&&(u||!pt.call(a,S))||h.push(S);return h}function K(a,u){return a<u}function fe(a,u){var h=-1,S=Kr(a)?Y(a.length):[];return ji(a,function(P,N,L){S[++h]=u(P,N,L)}),S}function qe(a){var u=Tb(a);return u.length==1&&u[0][2]?mE(u[0][0],u[0][1]):function(h){return h===a||Xs(h,a,u)}}function ze(a,u){return Nb(a)&&hE(u)?mE(si(a),u):function(h){var S=zb(h,a);return S===t&&S===u?Jb(h,a):fa(u,S,b|q)}}function er(a,u,h,S,P){a!==u&&Bc(u,function(N,L){if(P||(P=new dn),Ut(N))ni(a,u,L,h,er,S,P);else{var B=S?S(Fb(a,L),N,L+"",a,u,P):t;B===t&&(B=N),Lc(a,L,B)}},Qr)}function ni(a,u,h,S,P,N,L){var B=Fb(a,h),z=Fb(u,h),X=L.get(z);if(X){Lc(a,h,X);return}var ee=N?N(B,z,h+"",a,u,L):t,re=ee===t;if(re){var ue=$e(z),be=!ue&&no(z),xe=!ue&&!be&&Yl(z);ee=z,ue||be||xe?$e(B)?ee=B:Kt(B)?ee=Yr(B):be?(re=!1,ee=Gx(z,!0)):xe?(re=!1,ee=Yx(z,!0)):ee=[]:Kc(z)||ha(z)?(ee=B,ha(B)?ee=WE(B):(!Ut(B)||ps(B))&&(ee=pE(z))):re=!1}re&&(L.set(z,ee),P(ee,z,S,N,L),L.delete(z)),Lc(a,h,ee)}function ii(a,u){var h=a.length;if(h)return u+=u<0?h:0,ds(u,h)?a[u]:t}function Dx(a,u,h){u.length?u=qt(u,function(N){return $e(N)?function(L){return us(L,N.length===1?N[0]:N)}:N}):u=[Zr];var S=-1;u=qt(u,$r(Ce()));var P=fe(a,function(N,L,B){var z=qt(u,function(X){return X(N)});return{criteria:z,index:++S,value:N}});return bv(P,function(N,L){return JN(N,L,h)})}function NN(a,u){return jx(a,u,function(h,S){return Jb(a,S)})}function jx(a,u,h){for(var S=-1,P=u.length,N={};++S<P;){var L=u[S],B=us(a,L);h(B,L)&&zc(N,to(L,a),B)}return N}function MN(a){return function(u){return us(u,a)}}function bb(a,u,h,S){var P=S?vv:is,N=-1,L=u.length,B=a;for(a===u&&(u=Yr(u)),h&&(B=qt(a,$r(h)));++N<L;)for(var z=0,X=u[N],ee=h?h(X):X;(z=P(B,ee,z,S))>-1;)B!==a&&$l.call(B,z,1),$l.call(a,z,1);return a}function Lx(a,u){for(var h=a?u.length:0,S=h-1;h--;){var P=u[h];if(h==S||P!==N){var N=P;ds(P)?$l.call(a,P,1):Rb(a,P)}}return a}function Sb(a,u){return a+ia(Jp()*(u-a+1))}function FN(a,u,h,S){for(var P=-1,N=Tt(na((u-a)/(h||1)),0),L=Y(N);N--;)L[S?N:++P]=a,a+=h;return L}function wb(a,u){var h="";if(!a||u<1||u>Be)return h;do u%2&&(h+=a),u=ia(u/2),u&&(a+=a);while(u);return h}function Ue(a,u){return Db(gE(a,u,Zr),a+"")}function DN(a){return th(Kl(a))}function jN(a,u){var h=Kl(a);return vh(h,Di(u,0,h.length))}function zc(a,u,h,S){if(!Ut(a))return a;u=to(u,a);for(var P=-1,N=u.length,L=N-1,B=a;B!=null&&++P<N;){var z=si(u[P]),X=h;if(z==="__proto__"||z==="constructor"||z==="prototype")return a;if(P!=L){var ee=B[z];X=S?S(ee,z,B):t,X===t&&(X=Ut(ee)?ee:ds(u[P+1])?[]:{})}Fr(B,z,X),B=B[z]}return a}var Ux=jl?function(a,u){return jl.set(a,u),a}:Zr,LN=Nl?function(a,u){return Nl(a,"toString",{configurable:!0,enumerable:!1,value:Yb(u),writable:!0})}:Zr;function UN(a){return vh(Kl(a))}function Mn(a,u,h){var S=-1,P=a.length;u<0&&(u=-u>P?0:P+u),h=h>P?P:h,h<0&&(h+=P),P=u>h?0:h-u>>>0,u>>>=0;for(var N=Y(P);++S<P;)N[S]=a[S+u];return N}function HN(a,u){var h;return ji(a,function(S,P,N){return h=u(S,P,N),!h}),!!h}function uh(a,u,h){var S=0,P=a==null?S:a.length;if(typeof u=="number"&&u===u&&P<=Nt){for(;S<P;){var N=S+P>>>1,L=a[N];L!==null&&!gn(L)&&(h?L<=u:L<u)?S=N+1:P=N}return P}return _b(a,u,Zr,h)}function _b(a,u,h,S){var P=0,N=a==null?0:a.length;if(N===0)return 0;u=h(u);for(var L=u!==u,B=u===null,z=gn(u),X=u===t;P<N;){var ee=ia((P+N)/2),re=h(a[ee]),ue=re!==t,be=re===null,xe=re===re,De=gn(re);if(L)var Re=S||xe;else X?Re=xe&&(S||ue):B?Re=xe&&ue&&(S||!be):z?Re=xe&&ue&&!be&&(S||!De):be||De?Re=!1:Re=S?re<=u:re<u;Re?P=ee+1:N=ee}return ir(N,mt)}function Hx(a,u){for(var h=-1,S=a.length,P=0,N=[];++h<S;){var L=a[h],B=u?u(L):L;if(!h||!oi(B,z)){var z=B;N[P++]=L===0?0:L}}return N}function Bx(a){return typeof a=="number"?a:gn(a)?me:+a}function mn(a){if(typeof a=="string")return a;if($e(a))return qt(a,mn)+"";if(gn(a))return Gp?Gp.call(a):"";var u=a+"";return u=="0"&&1/a==-ce?"-0":u}function eo(a,u,h){var S=-1,P=_l,N=a.length,L=!0,B=[],z=B;if(h)L=!1,P=Vs;else if(N>=r){var X=u?null:XN(a);if(X)return ql(X);L=!1,P=yt,z=new ls}else z=u?[]:B;e:for(;++S<N;){var ee=a[S],re=u?u(ee):ee;if(ee=h||ee!==0?ee:0,L&&re===re){for(var ue=z.length;ue--;)if(z[ue]===re)continue e;u&&z.push(re),B.push(ee)}else P(z,re,h)||(z!==B&&z.push(re),B.push(ee))}return B}function Rb(a,u){u=to(u,a);var h=-1,S=u.length;if(!S)return!0;for(;++h<S;){var P=si(u[h]);if(P==="__proto__"&&!pt.call(a,"__proto__")||(P==="constructor"||P==="prototype")&&h<S-1)return!1}var N=yE(a,u);return N==null||delete N[si(Fn(u))]}function Vx(a,u,h,S){return zc(a,u,h(us(a,u)),S)}function ch(a,u,h,S){for(var P=a.length,N=S?P:-1;(S?N--:++N<P)&&u(a[N],N,a););return h?Mn(a,S?0:N,S?N+1:P):Mn(a,S?N+1:0,S?P:N)}function Wx(a,u){var h=a;return h instanceof We&&(h=h.value()),Pc(u,function(S,P){return P.func.apply(P.thisArg,Ti([S],P.args))},h)}function Cb(a,u,h){var S=a.length;if(S<2)return S?eo(a[0]):[];for(var P=-1,N=Y(S);++P<S;)for(var L=a[P],B=-1;++B<S;)B!=P&&(N[P]=ua(N[P]||L,a[B],u,h));return eo(sr(N,1),u,h)}function zx(a,u,h){for(var S=-1,P=a.length,N=u.length,L={};++S<P;){var B=S<N?u[S]:t;h(L,a[S],B)}return L}function xb(a){return Kt(a)?a:[]}function Eb(a){return typeof a=="function"?a:Zr}function to(a,u){return $e(a)?a:Nb(a,u)?[a]:wE(wt(a))}var BN=Ue;function ro(a,u,h){var S=a.length;return h=h===t?S:h,!u&&h>=S?a:Mn(a,u,h)}var Jx=Dv||function(a){return Xt.clearTimeout(a)};function Gx(a,u){if(u)return a.slice();var h=a.length,S=Hp?Hp(h):new a.constructor(h);return a.copy(S),S}function qb(a){var u=new a.constructor(a.byteLength);return new Al(u).set(new Al(a)),u}function VN(a,u){var h=u?qb(a.buffer):a.buffer;return new a.constructor(h,a.byteOffset,a.byteLength)}function WN(a){var u=new a.constructor(a.source,mp.exec(a));return u.lastIndex=a.lastIndex,u}function zN(a){return la?Xe(la.call(a)):{}}function Yx(a,u){var h=u?qb(a.buffer):a.buffer;return new a.constructor(h,a.byteOffset,a.length)}function Kx(a,u){if(a!==u){var h=a!==t,S=a===null,P=a===a,N=gn(a),L=u!==t,B=u===null,z=u===u,X=gn(u);if(!B&&!X&&!N&&a>u||N&&L&&z&&!B&&!X||S&&L&&z||!h&&z||!P)return 1;if(!S&&!N&&!X&&a<u||X&&h&&P&&!S&&!N||B&&h&&P||!L&&P||!z)return-1}return 0}function JN(a,u,h){for(var S=-1,P=a.criteria,N=u.criteria,L=P.length,B=h.length;++S<L;){var z=Kx(P[S],N[S]);if(z){if(S>=B)return z;var X=h[S];return z*(X=="desc"?-1:1)}}return a.index-u.index}function Qx(a,u,h,S){for(var P=-1,N=a.length,L=h.length,B=-1,z=u.length,X=Tt(N-L,0),ee=Y(z+X),re=!S;++B<z;)ee[B]=u[B];for(;++P<L;)(re||P<N)&&(ee[h[P]]=a[P]);for(;X--;)ee[B++]=a[P++];return ee}function Zx(a,u,h,S){for(var P=-1,N=a.length,L=-1,B=h.length,z=-1,X=u.length,ee=Tt(N-B,0),re=Y(ee+X),ue=!S;++P<ee;)re[P]=a[P];for(var be=P;++z<X;)re[be+z]=u[z];for(;++L<B;)(ue||P<N)&&(re[be+h[L]]=a[P++]);return re}function Yr(a,u){var h=-1,S=a.length;for(u||(u=Y(S));++h<S;)u[h]=a[h];return u}function Li(a,u,h,S){var P=!h;h||(h={});for(var N=-1,L=u.length;++N<L;){var B=u[N],z=S?S(h[B],a[B],B,h,a):t;z===t&&(z=a[B]),P?pn(h,B,z):Fr(h,B,z)}return h}function GN(a,u){return Li(a,$b(a),u)}function YN(a,u){return Li(a,fE(a),u)}function fh(a,u){return function(h,S){var P=$e(h)?Xn:rh,N=u?u():{};return P(h,a,Ce(S,2),N)}}function zl(a){return Ue(function(u,h){var S=-1,P=h.length,N=P>1?h[P-1]:t,L=P>2?h[2]:t;for(N=a.length>3&&typeof N=="function"?(P--,N):t,L&&Dr(h[0],h[1],L)&&(N=P<3?t:N,P=1),u=Xe(u);++S<P;){var B=h[S];B&&a(u,B,S,N)}return u})}function Xx(a,u){return function(h,S){if(h==null)return h;if(!Kr(h))return a(h,S);for(var P=h.length,N=u?P:-1,L=Xe(h);(u?N--:++N<P)&&S(L[N],N,L)!==!1;);return h}}function eE(a){return function(u,h,S){for(var P=-1,N=Xe(u),L=S(u),B=L.length;B--;){var z=L[a?B:++P];if(h(N[z],z,N)===!1)break}return u}}function KN(a,u,h){var S=u&C,P=Jc(a);function N(){var L=this&&this!==Xt&&this instanceof N?P:a;return L.apply(S?h:this,arguments)}return N}function tE(a){return function(u){u=wt(u);var h=Ws(u)?Nr(u):t,S=h?h[0]:u.charAt(0),P=h?ro(h,1).join(""):u.slice(1);return S[a]()+P}}function Jl(a){return function(u){return Pc(eq(XE(u).replace(iv,"")),a,"")}}function Jc(a){return function(){var u=arguments;switch(u.length){case 0:return new a;case 1:return new a(u[0]);case 2:return new a(u[0],u[1]);case 3:return new a(u[0],u[1],u[2]);case 4:return new a(u[0],u[1],u[2],u[3]);case 5:return new a(u[0],u[1],u[2],u[3],u[4]);case 6:return new a(u[0],u[1],u[2],u[3],u[4],u[5]);case 7:return new a(u[0],u[1],u[2],u[3],u[4],u[5],u[6])}var h=Ks(a.prototype),S=a.apply(h,u);return Ut(S)?S:h}}function QN(a,u,h){var S=Jc(a);function P(){for(var N=arguments.length,L=Y(N),B=N,z=Gl(P);B--;)L[B]=arguments[B];var X=N<3&&L[0]!==z&&L[N-1]!==z?[]:An(L,z);if(N-=X.length,N<h)return oE(a,u,dh,P.placeholder,t,L,X,t,t,h-N);var ee=this&&this!==Xt&&this instanceof P?S:a;return Ar(ee,this,L)}return P}function rE(a){return function(u,h,S){var P=Xe(u);if(!Kr(u)){var N=Ce(h,3);u=fr(u),h=function(B){return N(P[B],B,P)}}var L=a(u,h,S);return L>-1?P[N?u[L]:L]:t}}function nE(a){return fs(function(u){var h=u.length,S=h,P=br.prototype.thru;for(a&&u.reverse();S--;){var N=u[S];if(typeof N!="function")throw new Mr(i);if(P&&!L&&gh(N)=="wrapper")var L=new br([],!0)}for(S=L?S:h;++S<h;){N=u[S];var B=gh(N),z=B=="wrapper"?Ab(N):t;z&&Mb(z[0])&&z[1]==(j|E|O|I)&&!z[4].length&&z[9]==1?L=L[gh(z[0])].apply(L,z[3]):L=N.length==1&&Mb(N)?L[B]():L.thru(N)}return function(){var X=arguments,ee=X[0];if(L&&X.length==1&&$e(ee))return L.plant(ee).value();for(var re=0,ue=h?u[re].apply(this,X):ee;++re<h;)ue=u[re].call(this,ue);return ue}})}function dh(a,u,h,S,P,N,L,B,z,X){var ee=u&j,re=u&C,ue=u&v,be=u&(E|k),xe=u&R,De=ue?t:Jc(a);function Re(){for(var Qe=arguments.length,et=Y(Qe),yn=Qe;yn--;)et[yn]=arguments[yn];if(be)var jr=Gl(Re),vn=Dp(et,jr);if(S&&(et=Qx(et,S,P,be)),N&&(et=Zx(et,N,L,be)),Qe-=vn,be&&Qe<X){var Qt=An(et,jr);return oE(a,u,dh,Re.placeholder,h,et,Qt,B,z,X-Qe)}var ai=re?h:this,ms=ue?ai[a]:a;return Qe=et.length,B?et=yM(et,B):xe&&Qe>1&&et.reverse(),ee&&z<Qe&&(et.length=z),this&&this!==Xt&&this instanceof Re&&(ms=De||Jc(ms)),ms.apply(ai,et)}return Re}function iE(a,u){return function(h,S){return Qs(h,a,u(S),{})}}function ph(a,u){return function(h,S){var P;if(h===t&&S===t)return u;if(h!==t&&(P=h),S!==t){if(P===t)return S;typeof h=="string"||typeof S=="string"?(h=mn(h),S=mn(S)):(h=Bx(h),S=Bx(S)),P=a(h,S)}return P}}function Ob(a){return fs(function(u){return u=qt(u,$r(Ce())),Ue(function(h){var S=this;return a(u,function(P){return Ar(P,S,h)})})})}function hh(a,u){u=u===t?" ":mn(u);var h=u.length;if(h<2)return h?wb(u,a):u;var S=wb(u,na(a/$i(u)));return Ws(u)?ro(Nr(S),0,a).join(""):S.slice(0,a)}function ZN(a,u,h,S){var P=u&C,N=Jc(a);function L(){for(var B=-1,z=arguments.length,X=-1,ee=S.length,re=Y(ee+z),ue=this&&this!==Xt&&this instanceof L?N:a;++X<ee;)re[X]=S[X];for(;z--;)re[X++]=arguments[++B];return Ar(ue,P?h:this,re)}return L}function sE(a){return function(u,h,S){return S&&typeof S!="number"&&Dr(u,h,S)&&(h=S=t),u=hs(u),h===t?(h=u,u=0):h=hs(h),S=S===t?u<h?1:-1:hs(S),FN(u,h,S,a)}}function mh(a){return function(u,h){return typeof u=="string"&&typeof h=="string"||(u=Dn(u),h=Dn(h)),a(u,h)}}function oE(a,u,h,S,P,N,L,B,z,X){var ee=u&E,re=ee?L:t,ue=ee?t:L,be=ee?N:t,xe=ee?t:N;u|=ee?O:M,u&=~(ee?M:O),u&_||(u&=~(C|v));var De=[a,u,P,be,re,xe,ue,B,z,X],Re=h.apply(t,De);return Mb(a)&&vE(Re,De),Re.placeholder=S,bE(Re,a,u)}function Ib(a){var u=vt[a];return function(h,S){if(h=Dn(h),S=S==null?0:ir(Me(S),292),S&&as(h)){var P=(wt(h)+"e").split("e"),N=u(P[0]+"e"+(+P[1]+S));return P=(wt(N)+"e").split("e"),+(P[0]+"e"+(+P[1]-S))}return u(h)}}var XN=Gs&&1/ql(new Gs([,-0]))[1]==ce?function(a){return new Gs(a)}:Zb;function aE(a){return function(u){var h=wr(u);return h==At?zs(u):h==ve?jp(u):Sv(u,a(u))}}function cs(a,u,h,S,P,N,L,B){var z=u&v;if(!z&&typeof a!="function")throw new Mr(i);var X=S?S.length:0;if(X||(u&=~(O|M),S=P=t),L=L===t?L:Tt(Me(L),0),B=B===t?B:Me(B),X-=P?P.length:0,u&M){var ee=S,re=P;S=P=t}var ue=z?t:Ab(a),be=[a,u,h,S,P,ee,re,N,L,B];if(ue&&hM(be,ue),a=be[0],u=be[1],h=be[2],S=be[3],P=be[4],B=be[9]=be[9]===t?z?0:a.length:Tt(be[9]-X,0),!B&&u&(E|k)&&(u&=~(E|k)),!u||u==C)var xe=KN(a,u,h);else u==E||u==k?xe=QN(a,u,B):(u==O||u==(C|O))&&!P.length?xe=ZN(a,u,h,S):xe=dh.apply(t,be);var De=ue?Ux:vE;return bE(De(xe,be),a,u)}function lE(a,u,h,S){return a===t||oi(a,Js[h])&&!pt.call(S,h)?u:a}function uE(a,u,h,S,P,N){return Ut(a)&&Ut(u)&&(N.set(u,a),er(a,u,t,uE,N),N.delete(u)),a}function eM(a){return Kc(a)?t:a}function cE(a,u,h,S,P,N){var L=h&b,B=a.length,z=u.length;if(B!=z&&!(L&&z>B))return!1;var X=N.get(a),ee=N.get(u);if(X&&ee)return X==u&&ee==a;var re=-1,ue=!0,be=h&q?new ls:t;for(N.set(a,u),N.set(u,a);++re<B;){var xe=a[re],De=u[re];if(S)var Re=L?S(De,xe,re,u,a,N):S(xe,De,re,a,u,N);if(Re!==t){if(Re)continue;ue=!1;break}if(be){if(!Rl(u,function(Qe,et){if(!yt(be,et)&&(xe===Qe||P(xe,Qe,h,S,N)))return be.push(et)})){ue=!1;break}}else if(!(xe===De||P(xe,De,h,S,N))){ue=!1;break}}return N.delete(a),N.delete(u),ue}function tM(a,u,h,S,P,N,L){switch(h){case gt:if(a.byteLength!=u.byteLength||a.byteOffset!=u.byteOffset)return!1;a=a.buffer,u=u.buffer;case fn:return!(a.byteLength!=u.byteLength||!N(new Al(a),new Al(u)));case kr:case vr:case Pi:return oi(+a,+u);case St:return a.name==u.name&&a.message==u.message;case ye:case Ye:return a==u+"";case At:var B=zs;case ve:var z=S&b;if(B||(B=ql),a.size!=u.size&&!z)return!1;var X=L.get(a);if(X)return X==u;S|=q,L.set(a,u);var ee=cE(B(a),B(u),S,P,N,L);return L.delete(a),ee;case ur:if(la)return la.call(a)==la.call(u)}return!1}function rM(a,u,h,S,P,N){var L=h&b,B=Pb(a),z=B.length,X=Pb(u),ee=X.length;if(z!=ee&&!L)return!1;for(var re=z;re--;){var ue=B[re];if(!(L?ue in u:pt.call(u,ue)))return!1}var be=N.get(a),xe=N.get(u);if(be&&xe)return be==u&&xe==a;var De=!0;N.set(a,u),N.set(u,a);for(var Re=L;++re<z;){ue=B[re];var Qe=a[ue],et=u[ue];if(S)var yn=L?S(et,Qe,ue,u,a,N):S(Qe,et,ue,a,u,N);if(!(yn===t?Qe===et||P(Qe,et,h,S,N):yn)){De=!1;break}Re||(Re=ue=="constructor")}if(De&&!Re){var jr=a.constructor,vn=u.constructor;jr!=vn&&"constructor"in a&&"constructor"in u&&!(typeof jr=="function"&&jr instanceof jr&&typeof vn=="function"&&vn instanceof vn)&&(De=!1)}return N.delete(a),N.delete(u),De}function fs(a){return Db(gE(a,t,xE),a+"")}function Pb(a){return ah(a,fr,$b)}function kb(a){return ah(a,Qr,fE)}var Ab=jl?function(a){return jl.get(a)}:Zb;function gh(a){for(var u=a.name+"",h=Ys[u],S=pt.call(Ys,u)?h.length:0;S--;){var P=h[S],N=P.func;if(N==null||N==a)return P.name}return u}function Gl(a){var u=pt.call($,"placeholder")?$:a;return u.placeholder}function Ce(){var a=$.iteratee||Kb;return a=a===Kb?x:a,arguments.length?a(arguments[0],arguments[1]):a}function yh(a,u){var h=a.__data__;return cM(u)?h[typeof u=="string"?"string":"hash"]:h.map}function Tb(a){for(var u=fr(a),h=u.length;h--;){var S=u[h],P=a[S];u[h]=[S,P,hE(P)]}return u}function da(a,u){var h=Qo(a,u);return Ke(h)?h:t}function nM(a){var u=pt.call(a,os),h=a[os];try{a[os]=t;var S=!0}catch{}var P=Pl.call(a);return S&&(u?a[os]=h:delete a[os]),P}var $b=Ml?function(a){return a==null?[]:(a=Xe(a),Ai(Ml(a),function(u){return ta.call(a,u)}))}:Xb,fE=Ml?function(a){for(var u=[];a;)Ti(u,$b(a)),a=Tl(a);return u}:Xb,wr=dr;(Mc&&wr(new Mc(new ArrayBuffer(1)))!=gt||sa&&wr(new sa)!=At||Fc&&wr(Fc.resolve())!=ne||Gs&&wr(new Gs)!=ve||oa&&wr(new oa)!=ge)&&(wr=function(a){var u=dr(a),h=u==te?a.constructor:t,S=h?pa(h):"";if(S)switch(S){case Bv:return gt;case Vv:return At;case Wv:return ne;case zv:return ve;case Jv:return ge}return u});function iM(a,u,h){for(var S=-1,P=h.length;++S<P;){var N=h[S],L=N.size;switch(N.type){case"drop":a+=L;break;case"dropRight":u-=L;break;case"take":u=ir(u,a+L);break;case"takeRight":a=Tt(a,u-L);break}}return{start:a,end:u}}function sM(a){var u=a.match(Kn);return u?u[1].split(Pn):[]}function dE(a,u,h){u=to(u,a);for(var S=-1,P=u.length,N=!1;++S<P;){var L=si(u[S]);if(!(N=a!=null&&h(a,L)))break;a=a[L]}return N||++S!=P?N:(P=a==null?0:a.length,!!P&&Ch(P)&&ds(L,P)&&($e(a)||ha(a)))}function oM(a){var u=a.length,h=new a.constructor(u);return u&&typeof a[0]=="string"&&pt.call(a,"index")&&(h.index=a.index,h.input=a.input),h}function pE(a){return typeof a.constructor=="function"&&!Gc(a)?Ks(Tl(a)):{}}function aM(a,u,h){var S=a.constructor;switch(u){case fn:return qb(a);case kr:case vr:return new S(+a);case gt:return VN(a,h);case Ee:case On:case cl:case Fs:case Uo:case Ds:case ki:case js:case mc:return Yx(a,h);case At:return new S;case Pi:case Ye:return new S(a);case ye:return WN(a);case ve:return new S;case ur:return zN(a)}}function lM(a,u){var h=u.length;if(!h)return a;var S=h-1;return u[S]=(h>1?"& ":"")+u[S],u=u.join(h>2?", ":" "),a.replace(cr,`{
|
|
2
2
|
/* [wrapped with `+u+`] */
|
|
3
|
-
`)}function uM(a){return $e(a)||ha(a)||!!(Vp&&a&&a[Vp])}function ds(a,u){var h=typeof a;return u=u??Be,!!u&&(h=="number"||h!="symbol"&&Ls.test(a))&&a>-1&&a%1==0&&a<u}function Dr(a,u,h){if(!Ut(h))return!1;var S=typeof u;return(S=="number"?Kr(h)&&ds(u,h.length):S=="string"&&u in h)?oi(h[u],a):!1}function Nb(a,u){if($e(a))return!1;var h=typeof a;return h=="number"||h=="symbol"||h=="boolean"||a==null||gn(a)?!0:Ve.test(a)||!zr.test(a)||u!=null&&a in Xe(u)}function cM(a){var u=typeof a;return u=="string"||u=="number"||u=="symbol"||u=="boolean"?a!=="__proto__":a===null}function Mb(a){var u=gh(a),h=$[u];if(typeof h!="function"||!(u in We.prototype))return!1;if(a===h)return!0;var S=Ab(h);return!!S&&a===S[0]}function fM(a){return!!Up&&Up in a}var dM=ea?ps:eS;function Gc(a){var u=a&&a.constructor,h=typeof u=="function"&&u.prototype||Js;return a===h}function hE(a){return a===a&&!Ut(a)}function mE(a,u){return function(h){return h==null?!1:h[a]===u&&(u!==t||a in Xe(h))}}function pM(a){var u=_h(a,function(S){return h.size===c&&h.clear(),S}),h=u.cache;return u}function hM(a,u){var h=a[1],S=u[1],P=h|S,N=P<(C|v|j),L=S==j&&h==q||S==j&&h==I&&a[7].length<=u[8]||S==(j|I)&&u[7].length<=u[8]&&h==q;if(!(N||L))return a;S&C&&(a[2]=u[2],P|=h&C?0:_);var B=u[3];if(B){var z=a[3];a[3]=z?Qx(z,B,u[4]):B,a[4]=z?An(a[3],d):u[4]}return B=u[5],B&&(z=a[5],a[5]=z?Zx(z,B,u[6]):B,a[6]=z?An(a[5],d):u[6]),B=u[7],B&&(a[7]=B),S&j&&(a[8]=a[8]==null?u[8]:ir(a[8],u[8])),a[9]==null&&(a[9]=u[9]),a[0]=u[0],a[1]=P,a}function mM(a){var u=[];if(a!=null)for(var h in Xe(a))u.push(h);return u}function gM(a){return Pl.call(a)}function gE(a,u,h){return u=Tt(u===t?a.length-1:u,0),function(){for(var S=arguments,P=-1,N=Tt(S.length-u,0),L=Y(N);++P<N;)L[P]=S[u+P];P=-1;for(var B=Y(u+1);++P<u;)B[P]=S[P];return B[u]=h(L),Ar(a,this,B)}}function yE(a,u){return u.length<2?a:us(a,Mn(u,0,-1))}function yM(a,u){for(var h=a.length,S=ir(u.length,h),P=Yr(a);S--;){var N=u[S];a[S]=ds(N,h)?P[N]:t}return a}function Fb(a,u){if(!(u==="constructor"&&typeof a[u]=="function")&&u!="__proto__")return a[u]}var vE=SE(Ux),Yc=Lv||function(a,u){return Xt.setTimeout(a,u)},Db=SE(LN);function bE(a,u,h){var S=u+"";return Db(a,lM(S,vM(sM(S),h)))}function SE(a){var u=0,h=0;return function(){var S=zp(),P=D-(S-h);if(h=S,P>0){if(++u>=U)return arguments[0]}else u=0;return a.apply(t,arguments)}}function vh(a,u){var h=-1,S=a.length,P=S-1;for(u=u===t?S:u;++h<u;){var N=Sb(h,P),L=a[N];a[N]=a[h],a[h]=L}return a.length=u,a}var wE=pM(function(a){var u=[];return a.charCodeAt(0)===46&&u.push(""),a.replace(gc,function(h,S,P,N){u.push(P?N.replace(Qn,"$1"):S||h)}),u});function si(a){if(typeof a=="string"||gn(a))return a;var u=a+"";return u=="0"&&1/a==-ce?"-0":u}function pa(a){if(a!=null){try{return Il.call(a)}catch{}try{return a+""}catch{}}return""}function vM(a,u){return Tr(pe,function(h){var S="_."+h[0];u&h[1]&&!_l(a,S)&&a.push(S)}),a.sort()}function _E(a){if(a instanceof We)return a.clone();var u=new br(a.__wrapped__,a.__chain__);return u.__actions__=Yr(a.__actions__),u.__index__=a.__index__,u.__values__=a.__values__,u}function bM(a,u,h){(h?Dr(a,u,h):u===t)?u=1:u=Tt(Me(u),0);var S=a==null?0:a.length;if(!S||u<1)return[];for(var P=0,N=0,L=Y(na(S/u));P<S;)L[N++]=Mn(a,P,P+=u);return L}function SM(a){for(var u=-1,h=a==null?0:a.length,S=0,P=[];++u<h;){var N=a[u];N&&(P[S++]=N)}return P}function wM(){var a=arguments.length;if(!a)return[];for(var u=Y(a-1),h=arguments[0],S=a;S--;)u[S-1]=arguments[S];return Ti($e(h)?Yr(h):[h],sr(u,1))}var _M=Ue(function(a,u){return Kt(a)?ua(a,sr(u,1,Kt,!0)):[]}),RM=Ue(function(a,u){var h=Fn(u);return Kt(h)&&(h=t),Kt(a)?ua(a,sr(u,1,Kt,!0),Ce(h,2)):[]}),CM=Ue(function(a,u){var h=Fn(u);return Kt(h)&&(h=t),Kt(a)?ua(a,sr(u,1,Kt,!0),t,h):[]});function xM(a,u,h){var S=a==null?0:a.length;return S?(u=h||u===t?1:Me(u),Mn(a,u<0?0:u,S)):[]}function EM(a,u,h){var S=a==null?0:a.length;return S?(u=h||u===t?1:Me(u),u=S-u,Mn(a,0,u<0?0:u)):[]}function qM(a,u){return a&&a.length?ch(a,Ce(u,3),!0,!0):[]}function OM(a,u){return a&&a.length?ch(a,Ce(u,3),!0):[]}function IM(a,u,h,S){var P=a==null?0:a.length;return P?(h&&typeof h!="number"&&Dr(a,u,h)&&(h=0,S=P),pb(a,u,h,S)):[]}function RE(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=h==null?0:Me(h);return P<0&&(P=Tt(S+P,0)),Cl(a,Ce(u,3),P)}function CE(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=S-1;return h!==t&&(P=Me(h),P=h<0?Tt(S+P,0):ir(P,S-1)),Cl(a,Ce(u,3),P,!0)}function xE(a){var u=a==null?0:a.length;return u?sr(a,1):[]}function PM(a){var u=a==null?0:a.length;return u?sr(a,ce):[]}function kM(a,u){var h=a==null?0:a.length;return h?(u=u===t?1:Me(u),sr(a,u)):[]}function AM(a){for(var u=-1,h=a==null?0:a.length,S={};++u<h;){var P=a[u];pn(S,P[0],P[1])}return S}function EE(a){return a&&a.length?a[0]:t}function TM(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=h==null?0:Me(h);return P<0&&(P=Tt(S+P,0)),is(a,u,P)}function $M(a){var u=a==null?0:a.length;return u?Mn(a,0,-1):[]}var NM=Ue(function(a){var u=qt(a,xb);return u.length&&u[0]===a[0]?hn(u):[]}),MM=Ue(function(a){var u=Fn(a),h=qt(a,xb);return u===Fn(h)?u=t:h.pop(),h.length&&h[0]===a[0]?hn(h,Ce(u,2)):[]}),FM=Ue(function(a){var u=Fn(a),h=qt(a,xb);return u=typeof u=="function"?u:t,u&&h.pop(),h.length&&h[0]===a[0]?hn(h,t,u):[]});function DM(a,u){return a==null?"":Dl.call(a,u)}function Fn(a){var u=a==null?0:a.length;return u?a[u-1]:t}function jM(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=S;return h!==t&&(P=Me(h),P=P<0?Tt(S+P,0):ir(P,S-1)),u===u?Nc(a,u,P):Cl(a,ss,P,!0)}function LM(a,u){return a&&a.length?ii(a,Me(u)):t}var UM=Ue(qE);function qE(a,u){return a&&a.length&&u&&u.length?bb(a,u):a}function HM(a,u,h){return a&&a.length&&u&&u.length?bb(a,u,Ce(h,2)):a}function BM(a,u,h){return a&&a.length&&u&&u.length?bb(a,u,t,h):a}var VM=fs(function(a,u){var h=a==null?0:a.length,S=Uc(a,u);return Lx(a,qt(u,function(P){return ds(P,h)?+P:P}).sort(Kx)),S});function WM(a,u){var h=[];if(!(a&&a.length))return h;var S=-1,P=[],N=a.length;for(u=Ce(u,3);++S<N;){var L=a[S];u(L,S,a)&&(h.push(L),P.push(S))}return Lx(a,P),h}function jb(a){return a==null?a:Hv.call(a)}function zM(a,u,h){var S=a==null?0:a.length;return S?(h&&typeof h!="number"&&Dr(a,u,h)?(u=0,h=S):(u=u==null?0:Me(u),h=h===t?S:Me(h)),Mn(a,u,h)):[]}function JM(a,u){return uh(a,u)}function GM(a,u,h){return _b(a,u,Ce(h,2))}function YM(a,u){var h=a==null?0:a.length;if(h){var S=uh(a,u);if(S<h&&oi(a[S],u))return S}return-1}function KM(a,u){return uh(a,u,!0)}function QM(a,u,h){return _b(a,u,Ce(h,2),!0)}function ZM(a,u){var h=a==null?0:a.length;if(h){var S=uh(a,u,!0)-1;if(oi(a[S],u))return S}return-1}function XM(a){return a&&a.length?Hx(a):[]}function eF(a,u){return a&&a.length?Hx(a,Ce(u,2)):[]}function tF(a){var u=a==null?0:a.length;return u?Mn(a,1,u):[]}function rF(a,u,h){return a&&a.length?(u=h||u===t?1:Me(u),Mn(a,0,u<0?0:u)):[]}function nF(a,u,h){var S=a==null?0:a.length;return S?(u=h||u===t?1:Me(u),u=S-u,Mn(a,u<0?0:u,S)):[]}function iF(a,u){return a&&a.length?ch(a,Ce(u,3),!1,!0):[]}function sF(a,u){return a&&a.length?ch(a,Ce(u,3)):[]}var oF=Ue(function(a){return eo(sr(a,1,Kt,!0))}),aF=Ue(function(a){var u=Fn(a);return Kt(u)&&(u=t),eo(sr(a,1,Kt,!0),Ce(u,2))}),lF=Ue(function(a){var u=Fn(a);return u=typeof u=="function"?u:t,eo(sr(a,1,Kt,!0),t,u)});function uF(a){return a&&a.length?eo(a):[]}function cF(a,u){return a&&a.length?eo(a,Ce(u,2)):[]}function fF(a,u){return u=typeof u=="function"?u:t,a&&a.length?eo(a,t,u):[]}function Lb(a){if(!(a&&a.length))return[];var u=0;return a=Ai(a,function(h){if(Kt(h))return u=Tt(h.length,u),!0}),Tc(u,function(h){return qt(a,Ko(h))})}function OE(a,u){if(!(a&&a.length))return[];var h=Lb(a);return u==null?h:qt(h,function(S){return Ar(u,t,S)})}var dF=Ue(function(a,u){return Kt(a)?ua(a,u):[]}),pF=Ue(function(a){return Cb(Ai(a,Kt))}),hF=Ue(function(a){var u=Fn(a);return Kt(u)&&(u=t),Cb(Ai(a,Kt),Ce(u,2))}),mF=Ue(function(a){var u=Fn(a);return u=typeof u=="function"?u:t,Cb(Ai(a,Kt),t,u)}),gF=Ue(Lb);function yF(a,u){return zx(a||[],u||[],Fr)}function vF(a,u){return zx(a||[],u||[],zc)}var bF=Ue(function(a){var u=a.length,h=u>1?a[u-1]:t;return h=typeof h=="function"?(a.pop(),h):t,OE(a,h)});function IE(a){var u=$(a);return u.__chain__=!0,u}function SF(a,u){return u(a),a}function bh(a,u){return u(a)}var wF=fs(function(a){var u=a.length,h=u?a[0]:0,S=this.__wrapped__,P=function(N){return Uc(N,a)};return u>1||this.__actions__.length||!(S instanceof We)||!ds(h)?this.thru(P):(S=S.slice(h,+h+(u?1:0)),S.__actions__.push({func:bh,args:[P],thisArg:t}),new br(S,this.__chain__).thru(function(N){return u&&!N.length&&N.push(t),N}))});function _F(){return IE(this)}function RF(){return new br(this.value(),this.__chain__)}function CF(){this.__values__===t&&(this.__values__=BE(this.value()));var a=this.__index__>=this.__values__.length,u=a?t:this.__values__[this.__index__++];return{done:a,value:u}}function xF(){return this}function EF(a){for(var u,h=this;h instanceof Ul;){var S=_E(h);S.__index__=0,S.__values__=t,u?P.__wrapped__=S:u=S;var P=S;h=h.__wrapped__}return P.__wrapped__=a,u}function qF(){var a=this.__wrapped__;if(a instanceof We){var u=a;return this.__actions__.length&&(u=new We(this)),u=u.reverse(),u.__actions__.push({func:bh,args:[jb],thisArg:t}),new br(u,this.__chain__)}return this.thru(jb)}function OF(){return Wx(this.__wrapped__,this.__actions__)}var IF=fh(function(a,u,h){pt.call(a,h)?++a[h]:pn(a,h,1)});function PF(a,u,h){var S=$e(a)?Tp:db;return h&&Dr(a,u,h)&&(u=t),S(a,Ce(u,3))}function kF(a,u){var h=$e(a)?Ai:sh;return h(a,Ce(u,3))}var AF=rE(RE),TF=rE(CE);function $F(a,u){return sr(Sh(a,u),1)}function NF(a,u){return sr(Sh(a,u),ce)}function MF(a,u,h){return h=h===t?1:Me(h),sr(Sh(a,u),h)}function PE(a,u){var h=$e(a)?Tr:ji;return h(a,Ce(u,3))}function kE(a,u){var h=$e(a)?Ic:ih;return h(a,Ce(u,3))}var FF=fh(function(a,u,h){pt.call(a,h)?a[h].push(u):pn(a,h,[u])});function DF(a,u,h,S){a=Kr(a)?a:Kl(a),h=h&&!S?Me(h):0;var P=a.length;return h<0&&(h=Tt(P+h,0)),xh(a)?h<=P&&a.indexOf(u,h)>-1:!!P&&is(a,u,h)>-1}var jF=Ue(function(a,u,h){var S=-1,P=typeof u=="function",N=Kr(a)?Y(a.length):[];return ji(a,function(L){N[++S]=P?Ar(u,L,h):ca(L,u,h)}),N}),LF=fh(function(a,u,h){pn(a,h,u)});function Sh(a,u){var h=$e(a)?qt:fe;return h(a,Ce(u,3))}function UF(a,u,h,S){return a==null?[]:($e(u)||(u=u==null?[]:[u]),h=S?t:h,$e(h)||(h=h==null?[]:[h]),Dx(a,u,h))}var HF=fh(function(a,u,h){a[h?0:1].push(u)},function(){return[[],[]]});function BF(a,u,h){var S=$e(a)?Pc:xl,P=arguments.length<3;return S(a,Ce(u,4),h,P,ji)}function VF(a,u,h){var S=$e(a)?hv:xl,P=arguments.length<3;return S(a,Ce(u,4),h,P,ih)}function WF(a,u){var h=$e(a)?Ai:sh;return h(a,Rh(Ce(u,3)))}function zF(a){var u=$e(a)?th:DN;return u(a)}function JF(a,u,h){(h?Dr(a,u,h):u===t)?u=1:u=Me(u);var S=$e(a)?lb:jN;return S(a,u)}function GF(a){var u=$e(a)?ub:UN;return u(a)}function YF(a){if(a==null)return 0;if(Kr(a))return xh(a)?$i(a):a.length;var u=wr(a);return u==At||u==ve?a.size:T(a).length}function KF(a,u,h){var S=$e(a)?Rl:HN;return h&&Dr(a,u,h)&&(u=t),S(a,Ce(u,3))}var QF=Ue(function(a,u){if(a==null)return[];var h=u.length;return h>1&&Dr(a,u[0],u[1])?u=[]:h>2&&Dr(u[0],u[1],u[2])&&(u=[u[0]]),Dx(a,sr(u,1),[])}),wh=jv||function(){return Xt.Date.now()};function ZF(a,u){if(typeof u!="function")throw new Mr(i);return a=Me(a),function(){if(--a<1)return u.apply(this,arguments)}}function AE(a,u,h){return u=h?t:u,u=a&&u==null?a.length:u,cs(a,j,t,t,t,t,u)}function TE(a,u){var h;if(typeof u!="function")throw new Mr(i);return a=Me(a),function(){return--a>0&&(h=u.apply(this,arguments)),a<=1&&(u=t),h}}var Ub=Ue(function(a,u,h){var S=C;if(h.length){var P=An(h,Gl(Ub));S|=O}return cs(a,S,u,h,P)}),$E=Ue(function(a,u,h){var S=C|v;if(h.length){var P=An(h,Gl($E));S|=O}return cs(u,S,a,h,P)});function NE(a,u,h){u=h?t:u;var S=cs(a,q,t,t,t,t,t,u);return S.placeholder=NE.placeholder,S}function ME(a,u,h){u=h?t:u;var S=cs(a,k,t,t,t,t,t,u);return S.placeholder=ME.placeholder,S}function FE(a,u,h){var S,P,N,L,B,z,X=0,ee=!1,re=!1,ue=!0;if(typeof a!="function")throw new Mr(i);u=Dn(u)||0,Ut(h)&&(ee=!!h.leading,re="maxWait"in h,N=re?Tt(Dn(h.maxWait)||0,u):N,ue="trailing"in h?!!h.trailing:ue);function be(Qt){var ai=S,ms=P;return S=P=t,X=Qt,L=a.apply(ms,ai),L}function xe(Qt){return X=Qt,B=Yc(Qe,u),ee?be(Qt):L}function De(Qt){var ai=Qt-z,ms=Qt-X,nq=u-ai;return re?ir(nq,N-ms):nq}function Re(Qt){var ai=Qt-z,ms=Qt-X;return z===t||ai>=u||ai<0||re&&ms>=N}function Qe(){var Qt=wh();if(Re(Qt))return et(Qt);B=Yc(Qe,De(Qt))}function et(Qt){return B=t,ue&&S?be(Qt):(S=P=t,L)}function yn(){B!==t&&Jx(B),X=0,S=z=P=B=t}function jr(){return B===t?L:et(wh())}function vn(){var Qt=wh(),ai=Re(Qt);if(S=arguments,P=this,z=Qt,ai){if(B===t)return xe(z);if(re)return Jx(B),B=Yc(Qe,u),be(z)}return B===t&&(B=Yc(Qe,u)),L}return vn.cancel=yn,vn.flush=jr,vn}var XF=Ue(function(a,u){return Hc(a,1,u)}),eD=Ue(function(a,u,h){return Hc(a,Dn(u)||0,h)});function tD(a){return cs(a,R)}function _h(a,u){if(typeof a!="function"||u!=null&&typeof u!="function")throw new Mr(i);var h=function(){var S=arguments,P=u?u.apply(this,S):S[0],N=h.cache;if(N.has(P))return N.get(P);var L=a.apply(this,S);return h.cache=N.set(P,L)||N,L};return h.cache=new(_h.Cache||ti),h}_h.Cache=ti;function Rh(a){if(typeof a!="function")throw new Mr(i);return function(){var u=arguments;switch(u.length){case 0:return!a.call(this);case 1:return!a.call(this,u[0]);case 2:return!a.call(this,u[0],u[1]);case 3:return!a.call(this,u[0],u[1],u[2])}return!a.apply(this,u)}}function rD(a){return TE(2,a)}var nD=BN(function(a,u){u=u.length==1&&$e(u[0])?qt(u[0],$r(Ce())):qt(sr(u,1),$r(Ce()));var h=u.length;return Ue(function(S){for(var P=-1,N=ir(S.length,h);++P<N;)S[P]=u[P].call(this,S[P]);return Ar(a,this,S)})}),Hb=Ue(function(a,u){var h=An(u,Gl(Hb));return cs(a,O,t,u,h)}),DE=Ue(function(a,u){var h=An(u,Gl(DE));return cs(a,M,t,u,h)}),iD=fs(function(a,u){return cs(a,I,t,t,t,u)});function sD(a,u){if(typeof a!="function")throw new Mr(i);return u=u===t?u:Me(u),Ue(a,u)}function oD(a,u){if(typeof a!="function")throw new Mr(i);return u=u==null?0:Tt(Me(u),0),Ue(function(h){var S=h[u],P=ro(h,0,u);return S&&Ti(P,S),Ar(a,this,P)})}function aD(a,u,h){var S=!0,P=!0;if(typeof a!="function")throw new Mr(i);return Ut(h)&&(S="leading"in h?!!h.leading:S,P="trailing"in h?!!h.trailing:P),FE(a,u,{leading:S,maxWait:u,trailing:P})}function lD(a){return AE(a,1)}function uD(a,u){return Hb(Eb(u),a)}function cD(){if(!arguments.length)return[];var a=arguments[0];return $e(a)?a:[a]}function fD(a){return Sr(a,y)}function dD(a,u){return u=typeof u=="function"?u:t,Sr(a,y,u)}function pD(a){return Sr(a,p|y)}function hD(a,u){return u=typeof u=="function"?u:t,Sr(a,p|y,u)}function mD(a,u){return u==null||$n(a,u,fr(u))}function oi(a,u){return a===u||a!==a&&u!==u}var gD=mh(Vc),yD=mh(function(a,u){return a>=u}),ha=lh((function(){return arguments})())?lh:function(a){return Bt(a)&&pt.call(a,"callee")&&!ta.call(a,"callee")},$e=Y.isArray,vD=Oc?$r(Oc):yb;function Kr(a){return a!=null&&Ch(a.length)&&!ps(a)}function Kt(a){return Bt(a)&&Kr(a)}function bD(a){return a===!0||a===!1||Bt(a)&&dr(a)==kr}var no=Fl||eS,SD=kp?$r(kp):vb;function wD(a){return Bt(a)&&a.nodeType===1&&!Kc(a)}function _D(a){if(a==null)return!0;if(Kr(a)&&($e(a)||typeof a=="string"||typeof a.splice=="function"||no(a)||Yl(a)||ha(a)))return!a.length;var u=wr(a);if(u==At||u==ve)return!a.size;if(Gc(a))return!T(a).length;for(var h in a)if(pt.call(a,h))return!1;return!0}function RD(a,u){return fa(a,u)}function CD(a,u,h){h=typeof h=="function"?h:t;var S=h?h(a,u):t;return S===t?fa(a,u,t,h):!!S}function Bb(a){if(!Bt(a))return!1;var u=dr(a);return u==St||u==Ct||typeof a.message=="string"&&typeof a.name=="string"&&!Kc(a)}function xD(a){return typeof a=="number"&&as(a)}function ps(a){if(!Ut(a))return!1;var u=dr(a);return u==Wr||u==Ms||u==lt||u==Ie}function jE(a){return typeof a=="number"&&a==Me(a)}function Ch(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=Be}function Ut(a){var u=typeof a;return a!=null&&(u=="object"||u=="function")}function Bt(a){return a!=null&&typeof a=="object"}var LE=Ap?$r(Ap):Zs;function ED(a,u){return a===u||Xs(a,u,Tb(u))}function qD(a,u,h){return h=typeof h=="function"?h:t,Xs(a,u,Tb(u),h)}function OD(a){return UE(a)&&a!=+a}function ID(a){if(dM(a))throw new Oe(n);return Ke(a)}function PD(a){return a===null}function kD(a){return a==null}function UE(a){return typeof a=="number"||Bt(a)&&dr(a)==Pi}function Kc(a){if(!Bt(a)||dr(a)!=te)return!1;var u=Tl(a);if(u===null)return!0;var h=pt.call(u,"constructor")&&u.constructor;return typeof h=="function"&&h instanceof h&&Il.call(h)==Nv}var Vb=Yo?$r(Yo):f;function AD(a){return jE(a)&&a>=-Be&&a<=Be}var HE=Zn?$r(Zn):g;function xh(a){return typeof a=="string"||!$e(a)&&Bt(a)&&dr(a)==Ye}function gn(a){return typeof a=="symbol"||Bt(a)&&dr(a)==ur}var Yl=wl?$r(wl):w;function TD(a){return a===t}function $D(a){return Bt(a)&&wr(a)==ge}function ND(a){return Bt(a)&&dr(a)==qn}var MD=mh(K),FD=mh(function(a,u){return a<=u});function BE(a){if(!a)return[];if(Kr(a))return xh(a)?Nr(a):Yr(a);if(ra&&a[ra])return xv(a[ra]());var u=wr(a),h=u==At?zs:u==ve?ql:Kl;return h(a)}function hs(a){if(!a)return a===0?a:0;if(a=Dn(a),a===ce||a===-ce){var u=a<0?-1:1;return u*_e}return a===a?a:0}function Me(a){var u=hs(a),h=u%1;return u===u?h?u-h:u:0}function VE(a){return a?Di(Me(a),0,ke):0}function Dn(a){if(typeof a=="number")return a;if(gn(a))return me;if(Ut(a)){var u=typeof a.valueOf=="function"?a.valueOf():a;a=Ut(u)?u+"":u}if(typeof a!="string")return a===0?a:+a;a=$c(a);var h=Vo.test(a);return h||Vy.test(a)?dv(a.slice(2),h?2:8):By.test(a)?me:+a}function WE(a){return Li(a,Qr(a))}function DD(a){return a?Di(Me(a),-Be,Be):a===0?a:0}function wt(a){return a==null?"":mn(a)}var jD=zl(function(a,u){if(Gc(u)||Kr(u)){Li(u,fr(u),a);return}for(var h in u)pt.call(u,h)&&Fr(a,h,u[h])}),zE=zl(function(a,u){Li(u,Qr(u),a)}),JE=zl(function(a,u,h,S){Li(u,Qr(u),a,S)}),Wb=zl(function(a,u,h,S){Li(u,fr(u),a,S)}),LD=fs(Uc);function UD(a,u){var h=Ks(a);return u==null?h:nh(h,u)}var HD=Ue(function(a,u){a=Xe(a);var h=-1,S=u.length,P=S>2?u[2]:t;for(P&&Dr(u[0],u[1],P)&&(S=1);++h<S;)for(var N=u[h],L=Qr(N),B=-1,z=L.length;++B<z;){var X=L[B],ee=a[X];(ee===t||oi(ee,Js[X])&&!pt.call(a,X))&&(a[X]=N[X])}return a}),BD=Ue(function(a){return a.push(t,uE),Ar(GE,t,a)});function VD(a,u){return $p(a,Ce(u,3),Nn)}function WD(a,u){return $p(a,Ce(u,3),ri)}function zD(a,u){return a==null?a:Bc(a,Ce(u,3),Qr)}function JD(a,u){return a==null?a:oh(a,Ce(u,3),Qr)}function GD(a,u){return a&&Nn(a,Ce(u,3))}function YD(a,u){return a&&ri(a,Ce(u,3))}function KD(a){return a==null?[]:Wl(a,fr(a))}function QD(a){return a==null?[]:Wl(a,Qr(a))}function zb(a,u,h){var S=a==null?t:us(a,u);return S===t?h:S}function ZD(a,u){return a!=null&&dE(a,u,hb)}function Jb(a,u){return a!=null&&dE(a,u,mb)}var XD=iE(function(a,u,h){u!=null&&typeof u.toString!="function"&&(u=Pl.call(u)),a[u]=h},Yb(Zr)),ej=iE(function(a,u,h){u!=null&&typeof u.toString!="function"&&(u=Pl.call(u)),pt.call(a,u)?a[u].push(h):a[u]=[h]},Ce),tj=Ue(ca);function fr(a){return Kr(a)?eh(a):T(a)}function Qr(a){return Kr(a)?eh(a,!0):H(a)}function rj(a,u){var h={};return u=Ce(u,3),Nn(a,function(S,P,N){pn(h,u(S,P,N),S)}),h}function nj(a,u){var h={};return u=Ce(u,3),Nn(a,function(S,P,N){pn(h,P,u(S,P,N))}),h}var ij=zl(function(a,u,h){er(a,u,h)}),GE=zl(function(a,u,h,S){er(a,u,h,S)}),sj=fs(function(a,u){var h={};if(a==null)return h;var S=!1;u=qt(u,function(N){return N=to(N,a),S||(S=N.length>1),N}),Li(a,kb(a),h),S&&(h=Sr(h,p|m|y,eM));for(var P=u.length;P--;)Rb(h,u[P]);return h});function oj(a,u){return YE(a,Rh(Ce(u)))}var aj=fs(function(a,u){return a==null?{}:NN(a,u)});function YE(a,u){if(a==null)return{};var h=qt(kb(a),function(S){return[S]});return u=Ce(u),jx(a,h,function(S,P){return u(S,P[0])})}function lj(a,u,h){u=to(u,a);var S=-1,P=u.length;for(P||(P=1,a=t);++S<P;){var N=a==null?t:a[si(u[S])];N===t&&(S=P,N=h),a=ps(N)?N.call(a):N}return a}function uj(a,u,h){return a==null?a:zc(a,u,h)}function cj(a,u,h,S){return S=typeof S=="function"?S:t,a==null?a:zc(a,u,h,S)}var KE=aE(fr),QE=aE(Qr);function fj(a,u,h){var S=$e(a),P=S||no(a)||Yl(a);if(u=Ce(u,4),h==null){var N=a&&a.constructor;P?h=S?new N:[]:Ut(a)?h=ps(N)?Ks(Tl(a)):{}:h={}}return(P?Tr:Nn)(a,function(L,B,z){return u(h,L,B,z)}),h}function dj(a,u){return a==null?!0:Rb(a,u)}function pj(a,u,h){return a==null?a:Vx(a,u,Eb(h))}function hj(a,u,h,S){return S=typeof S=="function"?S:t,a==null?a:Vx(a,u,Eb(h),S)}function Kl(a){return a==null?[]:El(a,fr(a))}function mj(a){return a==null?[]:El(a,Qr(a))}function gj(a,u,h){return h===t&&(h=u,u=t),h!==t&&(h=Dn(h),h=h===h?h:0),u!==t&&(u=Dn(u),u=u===u?u:0),Di(Dn(a),u,h)}function yj(a,u,h){return u=hs(u),h===t?(h=u,u=0):h=hs(h),a=Dn(a),gb(a,u,h)}function vj(a,u,h){if(h&&typeof h!="boolean"&&Dr(a,u,h)&&(u=h=t),h===t&&(typeof u=="boolean"?(h=u,u=t):typeof a=="boolean"&&(h=a,a=t)),a===t&&u===t?(a=0,u=1):(a=hs(a),u===t?(u=a,a=0):u=hs(u)),a>u){var S=a;a=u,u=S}if(h||a%1||u%1){var P=Jp();return ir(a+P*(u-a+Ip("1e-"+((P+"").length-1))),u)}return Sb(a,u)}var bj=Jl(function(a,u,h){return u=u.toLowerCase(),a+(h?ZE(u):u)});function ZE(a){return Gb(wt(a).toLowerCase())}function XE(a){return a=wt(a),a&&a.replace(Wo,wv).replace(sv,"")}function Sj(a,u,h){a=wt(a),u=mn(u);var S=a.length;h=h===t?S:Di(Me(h),0,S);var P=h;return h-=u.length,h>=0&&a.slice(h,P)==u}function wj(a){return a=wt(a),a&&he.test(a)?a.replace(dl,_v):a}function _j(a){return a=wt(a),a&&Bo.test(a)?a.replace(ft,"\\$&"):a}var Rj=Jl(function(a,u,h){return a+(h?"-":"")+u.toLowerCase()}),Cj=Jl(function(a,u,h){return a+(h?" ":"")+u.toLowerCase()}),xj=tE("toLowerCase");function Ej(a,u,h){a=wt(a),u=Me(u);var S=u?$i(a):0;if(!u||S>=u)return a;var P=(u-S)/2;return hh(ia(P),h)+a+hh(na(P),h)}function qj(a,u,h){a=wt(a),u=Me(u);var S=u?$i(a):0;return u&&S<u?a+hh(u-S,h):a}function Oj(a,u,h){a=wt(a),u=Me(u);var S=u?$i(a):0;return u&&S<u?hh(u-S,h)+a:a}function Ij(a,u,h){return h||u==null?u=0:u&&(u=+u),Uv(wt(a).replace(yc,""),u||0)}function Pj(a,u,h){return(h?Dr(a,u,h):u===t)?u=1:u=Me(u),wb(wt(a),u)}function kj(){var a=arguments,u=wt(a[0]);return a.length<3?u:u.replace(a[1],a[2])}var Aj=Jl(function(a,u,h){return a+(h?"_":"")+u.toLowerCase()});function Tj(a,u,h){return h&&typeof h!="number"&&Dr(a,u,h)&&(u=h=t),h=h===t?ke:h>>>0,h?(a=wt(a),a&&(typeof u=="string"||u!=null&&!Vb(u))&&(u=mn(u),!u&&Ws(a))?ro(Nr(a),0,h):a.split(u,h)):[]}var $j=Jl(function(a,u,h){return a+(h?" ":"")+Gb(u)});function Nj(a,u,h){return a=wt(a),h=h==null?0:Di(Me(h),0,a.length),u=mn(u),a.slice(h,h+u.length)==u}function Mj(a,u,h){var S=$.templateSettings;h&&Dr(a,u,h)&&(u=t),a=wt(a),u=Wb({},u,S,lE);var P=Wb({},u.imports,S.imports,lE),N=fr(P),L=El(P,N);Tr(N,function(Re){if(Jr.test(Re))throw new Oe(o)});var B,z,X=0,ee=u.interpolate||zo,re="__p += '",ue=Ol((u.escape||zo).source+"|"+ee.source+"|"+(ee===In?rs:zo).source+"|"+(u.evaluate||zo).source+"|$","g"),be="//# sourceURL="+(pt.call(u,"sourceURL")?(u.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++cv+"]")+`
|
|
3
|
+
`)}function uM(a){return $e(a)||ha(a)||!!(Vp&&a&&a[Vp])}function ds(a,u){var h=typeof a;return u=u??Be,!!u&&(h=="number"||h!="symbol"&&Ls.test(a))&&a>-1&&a%1==0&&a<u}function Dr(a,u,h){if(!Ut(h))return!1;var S=typeof u;return(S=="number"?Kr(h)&&ds(u,h.length):S=="string"&&u in h)?oi(h[u],a):!1}function Nb(a,u){if($e(a))return!1;var h=typeof a;return h=="number"||h=="symbol"||h=="boolean"||a==null||gn(a)?!0:Ve.test(a)||!zr.test(a)||u!=null&&a in Xe(u)}function cM(a){var u=typeof a;return u=="string"||u=="number"||u=="symbol"||u=="boolean"?a!=="__proto__":a===null}function Mb(a){var u=gh(a),h=$[u];if(typeof h!="function"||!(u in We.prototype))return!1;if(a===h)return!0;var S=Ab(h);return!!S&&a===S[0]}function fM(a){return!!Up&&Up in a}var dM=ea?ps:eS;function Gc(a){var u=a&&a.constructor,h=typeof u=="function"&&u.prototype||Js;return a===h}function hE(a){return a===a&&!Ut(a)}function mE(a,u){return function(h){return h==null?!1:h[a]===u&&(u!==t||a in Xe(h))}}function pM(a){var u=_h(a,function(S){return h.size===c&&h.clear(),S}),h=u.cache;return u}function hM(a,u){var h=a[1],S=u[1],P=h|S,N=P<(C|v|j),L=S==j&&h==E||S==j&&h==I&&a[7].length<=u[8]||S==(j|I)&&u[7].length<=u[8]&&h==E;if(!(N||L))return a;S&C&&(a[2]=u[2],P|=h&C?0:_);var B=u[3];if(B){var z=a[3];a[3]=z?Qx(z,B,u[4]):B,a[4]=z?An(a[3],d):u[4]}return B=u[5],B&&(z=a[5],a[5]=z?Zx(z,B,u[6]):B,a[6]=z?An(a[5],d):u[6]),B=u[7],B&&(a[7]=B),S&j&&(a[8]=a[8]==null?u[8]:ir(a[8],u[8])),a[9]==null&&(a[9]=u[9]),a[0]=u[0],a[1]=P,a}function mM(a){var u=[];if(a!=null)for(var h in Xe(a))u.push(h);return u}function gM(a){return Pl.call(a)}function gE(a,u,h){return u=Tt(u===t?a.length-1:u,0),function(){for(var S=arguments,P=-1,N=Tt(S.length-u,0),L=Y(N);++P<N;)L[P]=S[u+P];P=-1;for(var B=Y(u+1);++P<u;)B[P]=S[P];return B[u]=h(L),Ar(a,this,B)}}function yE(a,u){return u.length<2?a:us(a,Mn(u,0,-1))}function yM(a,u){for(var h=a.length,S=ir(u.length,h),P=Yr(a);S--;){var N=u[S];a[S]=ds(N,h)?P[N]:t}return a}function Fb(a,u){if(!(u==="constructor"&&typeof a[u]=="function")&&u!="__proto__")return a[u]}var vE=SE(Ux),Yc=Lv||function(a,u){return Xt.setTimeout(a,u)},Db=SE(LN);function bE(a,u,h){var S=u+"";return Db(a,lM(S,vM(sM(S),h)))}function SE(a){var u=0,h=0;return function(){var S=zp(),P=D-(S-h);if(h=S,P>0){if(++u>=U)return arguments[0]}else u=0;return a.apply(t,arguments)}}function vh(a,u){var h=-1,S=a.length,P=S-1;for(u=u===t?S:u;++h<u;){var N=Sb(h,P),L=a[N];a[N]=a[h],a[h]=L}return a.length=u,a}var wE=pM(function(a){var u=[];return a.charCodeAt(0)===46&&u.push(""),a.replace(gc,function(h,S,P,N){u.push(P?N.replace(Qn,"$1"):S||h)}),u});function si(a){if(typeof a=="string"||gn(a))return a;var u=a+"";return u=="0"&&1/a==-ce?"-0":u}function pa(a){if(a!=null){try{return Il.call(a)}catch{}try{return a+""}catch{}}return""}function vM(a,u){return Tr(pe,function(h){var S="_."+h[0];u&h[1]&&!_l(a,S)&&a.push(S)}),a.sort()}function _E(a){if(a instanceof We)return a.clone();var u=new br(a.__wrapped__,a.__chain__);return u.__actions__=Yr(a.__actions__),u.__index__=a.__index__,u.__values__=a.__values__,u}function bM(a,u,h){(h?Dr(a,u,h):u===t)?u=1:u=Tt(Me(u),0);var S=a==null?0:a.length;if(!S||u<1)return[];for(var P=0,N=0,L=Y(na(S/u));P<S;)L[N++]=Mn(a,P,P+=u);return L}function SM(a){for(var u=-1,h=a==null?0:a.length,S=0,P=[];++u<h;){var N=a[u];N&&(P[S++]=N)}return P}function wM(){var a=arguments.length;if(!a)return[];for(var u=Y(a-1),h=arguments[0],S=a;S--;)u[S-1]=arguments[S];return Ti($e(h)?Yr(h):[h],sr(u,1))}var _M=Ue(function(a,u){return Kt(a)?ua(a,sr(u,1,Kt,!0)):[]}),RM=Ue(function(a,u){var h=Fn(u);return Kt(h)&&(h=t),Kt(a)?ua(a,sr(u,1,Kt,!0),Ce(h,2)):[]}),CM=Ue(function(a,u){var h=Fn(u);return Kt(h)&&(h=t),Kt(a)?ua(a,sr(u,1,Kt,!0),t,h):[]});function xM(a,u,h){var S=a==null?0:a.length;return S?(u=h||u===t?1:Me(u),Mn(a,u<0?0:u,S)):[]}function EM(a,u,h){var S=a==null?0:a.length;return S?(u=h||u===t?1:Me(u),u=S-u,Mn(a,0,u<0?0:u)):[]}function qM(a,u){return a&&a.length?ch(a,Ce(u,3),!0,!0):[]}function OM(a,u){return a&&a.length?ch(a,Ce(u,3),!0):[]}function IM(a,u,h,S){var P=a==null?0:a.length;return P?(h&&typeof h!="number"&&Dr(a,u,h)&&(h=0,S=P),pb(a,u,h,S)):[]}function RE(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=h==null?0:Me(h);return P<0&&(P=Tt(S+P,0)),Cl(a,Ce(u,3),P)}function CE(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=S-1;return h!==t&&(P=Me(h),P=h<0?Tt(S+P,0):ir(P,S-1)),Cl(a,Ce(u,3),P,!0)}function xE(a){var u=a==null?0:a.length;return u?sr(a,1):[]}function PM(a){var u=a==null?0:a.length;return u?sr(a,ce):[]}function kM(a,u){var h=a==null?0:a.length;return h?(u=u===t?1:Me(u),sr(a,u)):[]}function AM(a){for(var u=-1,h=a==null?0:a.length,S={};++u<h;){var P=a[u];pn(S,P[0],P[1])}return S}function EE(a){return a&&a.length?a[0]:t}function TM(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=h==null?0:Me(h);return P<0&&(P=Tt(S+P,0)),is(a,u,P)}function $M(a){var u=a==null?0:a.length;return u?Mn(a,0,-1):[]}var NM=Ue(function(a){var u=qt(a,xb);return u.length&&u[0]===a[0]?hn(u):[]}),MM=Ue(function(a){var u=Fn(a),h=qt(a,xb);return u===Fn(h)?u=t:h.pop(),h.length&&h[0]===a[0]?hn(h,Ce(u,2)):[]}),FM=Ue(function(a){var u=Fn(a),h=qt(a,xb);return u=typeof u=="function"?u:t,u&&h.pop(),h.length&&h[0]===a[0]?hn(h,t,u):[]});function DM(a,u){return a==null?"":Dl.call(a,u)}function Fn(a){var u=a==null?0:a.length;return u?a[u-1]:t}function jM(a,u,h){var S=a==null?0:a.length;if(!S)return-1;var P=S;return h!==t&&(P=Me(h),P=P<0?Tt(S+P,0):ir(P,S-1)),u===u?Nc(a,u,P):Cl(a,ss,P,!0)}function LM(a,u){return a&&a.length?ii(a,Me(u)):t}var UM=Ue(qE);function qE(a,u){return a&&a.length&&u&&u.length?bb(a,u):a}function HM(a,u,h){return a&&a.length&&u&&u.length?bb(a,u,Ce(h,2)):a}function BM(a,u,h){return a&&a.length&&u&&u.length?bb(a,u,t,h):a}var VM=fs(function(a,u){var h=a==null?0:a.length,S=Uc(a,u);return Lx(a,qt(u,function(P){return ds(P,h)?+P:P}).sort(Kx)),S});function WM(a,u){var h=[];if(!(a&&a.length))return h;var S=-1,P=[],N=a.length;for(u=Ce(u,3);++S<N;){var L=a[S];u(L,S,a)&&(h.push(L),P.push(S))}return Lx(a,P),h}function jb(a){return a==null?a:Hv.call(a)}function zM(a,u,h){var S=a==null?0:a.length;return S?(h&&typeof h!="number"&&Dr(a,u,h)?(u=0,h=S):(u=u==null?0:Me(u),h=h===t?S:Me(h)),Mn(a,u,h)):[]}function JM(a,u){return uh(a,u)}function GM(a,u,h){return _b(a,u,Ce(h,2))}function YM(a,u){var h=a==null?0:a.length;if(h){var S=uh(a,u);if(S<h&&oi(a[S],u))return S}return-1}function KM(a,u){return uh(a,u,!0)}function QM(a,u,h){return _b(a,u,Ce(h,2),!0)}function ZM(a,u){var h=a==null?0:a.length;if(h){var S=uh(a,u,!0)-1;if(oi(a[S],u))return S}return-1}function XM(a){return a&&a.length?Hx(a):[]}function eF(a,u){return a&&a.length?Hx(a,Ce(u,2)):[]}function tF(a){var u=a==null?0:a.length;return u?Mn(a,1,u):[]}function rF(a,u,h){return a&&a.length?(u=h||u===t?1:Me(u),Mn(a,0,u<0?0:u)):[]}function nF(a,u,h){var S=a==null?0:a.length;return S?(u=h||u===t?1:Me(u),u=S-u,Mn(a,u<0?0:u,S)):[]}function iF(a,u){return a&&a.length?ch(a,Ce(u,3),!1,!0):[]}function sF(a,u){return a&&a.length?ch(a,Ce(u,3)):[]}var oF=Ue(function(a){return eo(sr(a,1,Kt,!0))}),aF=Ue(function(a){var u=Fn(a);return Kt(u)&&(u=t),eo(sr(a,1,Kt,!0),Ce(u,2))}),lF=Ue(function(a){var u=Fn(a);return u=typeof u=="function"?u:t,eo(sr(a,1,Kt,!0),t,u)});function uF(a){return a&&a.length?eo(a):[]}function cF(a,u){return a&&a.length?eo(a,Ce(u,2)):[]}function fF(a,u){return u=typeof u=="function"?u:t,a&&a.length?eo(a,t,u):[]}function Lb(a){if(!(a&&a.length))return[];var u=0;return a=Ai(a,function(h){if(Kt(h))return u=Tt(h.length,u),!0}),Tc(u,function(h){return qt(a,Ko(h))})}function OE(a,u){if(!(a&&a.length))return[];var h=Lb(a);return u==null?h:qt(h,function(S){return Ar(u,t,S)})}var dF=Ue(function(a,u){return Kt(a)?ua(a,u):[]}),pF=Ue(function(a){return Cb(Ai(a,Kt))}),hF=Ue(function(a){var u=Fn(a);return Kt(u)&&(u=t),Cb(Ai(a,Kt),Ce(u,2))}),mF=Ue(function(a){var u=Fn(a);return u=typeof u=="function"?u:t,Cb(Ai(a,Kt),t,u)}),gF=Ue(Lb);function yF(a,u){return zx(a||[],u||[],Fr)}function vF(a,u){return zx(a||[],u||[],zc)}var bF=Ue(function(a){var u=a.length,h=u>1?a[u-1]:t;return h=typeof h=="function"?(a.pop(),h):t,OE(a,h)});function IE(a){var u=$(a);return u.__chain__=!0,u}function SF(a,u){return u(a),a}function bh(a,u){return u(a)}var wF=fs(function(a){var u=a.length,h=u?a[0]:0,S=this.__wrapped__,P=function(N){return Uc(N,a)};return u>1||this.__actions__.length||!(S instanceof We)||!ds(h)?this.thru(P):(S=S.slice(h,+h+(u?1:0)),S.__actions__.push({func:bh,args:[P],thisArg:t}),new br(S,this.__chain__).thru(function(N){return u&&!N.length&&N.push(t),N}))});function _F(){return IE(this)}function RF(){return new br(this.value(),this.__chain__)}function CF(){this.__values__===t&&(this.__values__=BE(this.value()));var a=this.__index__>=this.__values__.length,u=a?t:this.__values__[this.__index__++];return{done:a,value:u}}function xF(){return this}function EF(a){for(var u,h=this;h instanceof Ul;){var S=_E(h);S.__index__=0,S.__values__=t,u?P.__wrapped__=S:u=S;var P=S;h=h.__wrapped__}return P.__wrapped__=a,u}function qF(){var a=this.__wrapped__;if(a instanceof We){var u=a;return this.__actions__.length&&(u=new We(this)),u=u.reverse(),u.__actions__.push({func:bh,args:[jb],thisArg:t}),new br(u,this.__chain__)}return this.thru(jb)}function OF(){return Wx(this.__wrapped__,this.__actions__)}var IF=fh(function(a,u,h){pt.call(a,h)?++a[h]:pn(a,h,1)});function PF(a,u,h){var S=$e(a)?Tp:db;return h&&Dr(a,u,h)&&(u=t),S(a,Ce(u,3))}function kF(a,u){var h=$e(a)?Ai:sh;return h(a,Ce(u,3))}var AF=rE(RE),TF=rE(CE);function $F(a,u){return sr(Sh(a,u),1)}function NF(a,u){return sr(Sh(a,u),ce)}function MF(a,u,h){return h=h===t?1:Me(h),sr(Sh(a,u),h)}function PE(a,u){var h=$e(a)?Tr:ji;return h(a,Ce(u,3))}function kE(a,u){var h=$e(a)?Ic:ih;return h(a,Ce(u,3))}var FF=fh(function(a,u,h){pt.call(a,h)?a[h].push(u):pn(a,h,[u])});function DF(a,u,h,S){a=Kr(a)?a:Kl(a),h=h&&!S?Me(h):0;var P=a.length;return h<0&&(h=Tt(P+h,0)),xh(a)?h<=P&&a.indexOf(u,h)>-1:!!P&&is(a,u,h)>-1}var jF=Ue(function(a,u,h){var S=-1,P=typeof u=="function",N=Kr(a)?Y(a.length):[];return ji(a,function(L){N[++S]=P?Ar(u,L,h):ca(L,u,h)}),N}),LF=fh(function(a,u,h){pn(a,h,u)});function Sh(a,u){var h=$e(a)?qt:fe;return h(a,Ce(u,3))}function UF(a,u,h,S){return a==null?[]:($e(u)||(u=u==null?[]:[u]),h=S?t:h,$e(h)||(h=h==null?[]:[h]),Dx(a,u,h))}var HF=fh(function(a,u,h){a[h?0:1].push(u)},function(){return[[],[]]});function BF(a,u,h){var S=$e(a)?Pc:xl,P=arguments.length<3;return S(a,Ce(u,4),h,P,ji)}function VF(a,u,h){var S=$e(a)?hv:xl,P=arguments.length<3;return S(a,Ce(u,4),h,P,ih)}function WF(a,u){var h=$e(a)?Ai:sh;return h(a,Rh(Ce(u,3)))}function zF(a){var u=$e(a)?th:DN;return u(a)}function JF(a,u,h){(h?Dr(a,u,h):u===t)?u=1:u=Me(u);var S=$e(a)?lb:jN;return S(a,u)}function GF(a){var u=$e(a)?ub:UN;return u(a)}function YF(a){if(a==null)return 0;if(Kr(a))return xh(a)?$i(a):a.length;var u=wr(a);return u==At||u==ve?a.size:T(a).length}function KF(a,u,h){var S=$e(a)?Rl:HN;return h&&Dr(a,u,h)&&(u=t),S(a,Ce(u,3))}var QF=Ue(function(a,u){if(a==null)return[];var h=u.length;return h>1&&Dr(a,u[0],u[1])?u=[]:h>2&&Dr(u[0],u[1],u[2])&&(u=[u[0]]),Dx(a,sr(u,1),[])}),wh=jv||function(){return Xt.Date.now()};function ZF(a,u){if(typeof u!="function")throw new Mr(i);return a=Me(a),function(){if(--a<1)return u.apply(this,arguments)}}function AE(a,u,h){return u=h?t:u,u=a&&u==null?a.length:u,cs(a,j,t,t,t,t,u)}function TE(a,u){var h;if(typeof u!="function")throw new Mr(i);return a=Me(a),function(){return--a>0&&(h=u.apply(this,arguments)),a<=1&&(u=t),h}}var Ub=Ue(function(a,u,h){var S=C;if(h.length){var P=An(h,Gl(Ub));S|=O}return cs(a,S,u,h,P)}),$E=Ue(function(a,u,h){var S=C|v;if(h.length){var P=An(h,Gl($E));S|=O}return cs(u,S,a,h,P)});function NE(a,u,h){u=h?t:u;var S=cs(a,E,t,t,t,t,t,u);return S.placeholder=NE.placeholder,S}function ME(a,u,h){u=h?t:u;var S=cs(a,k,t,t,t,t,t,u);return S.placeholder=ME.placeholder,S}function FE(a,u,h){var S,P,N,L,B,z,X=0,ee=!1,re=!1,ue=!0;if(typeof a!="function")throw new Mr(i);u=Dn(u)||0,Ut(h)&&(ee=!!h.leading,re="maxWait"in h,N=re?Tt(Dn(h.maxWait)||0,u):N,ue="trailing"in h?!!h.trailing:ue);function be(Qt){var ai=S,ms=P;return S=P=t,X=Qt,L=a.apply(ms,ai),L}function xe(Qt){return X=Qt,B=Yc(Qe,u),ee?be(Qt):L}function De(Qt){var ai=Qt-z,ms=Qt-X,nq=u-ai;return re?ir(nq,N-ms):nq}function Re(Qt){var ai=Qt-z,ms=Qt-X;return z===t||ai>=u||ai<0||re&&ms>=N}function Qe(){var Qt=wh();if(Re(Qt))return et(Qt);B=Yc(Qe,De(Qt))}function et(Qt){return B=t,ue&&S?be(Qt):(S=P=t,L)}function yn(){B!==t&&Jx(B),X=0,S=z=P=B=t}function jr(){return B===t?L:et(wh())}function vn(){var Qt=wh(),ai=Re(Qt);if(S=arguments,P=this,z=Qt,ai){if(B===t)return xe(z);if(re)return Jx(B),B=Yc(Qe,u),be(z)}return B===t&&(B=Yc(Qe,u)),L}return vn.cancel=yn,vn.flush=jr,vn}var XF=Ue(function(a,u){return Hc(a,1,u)}),eD=Ue(function(a,u,h){return Hc(a,Dn(u)||0,h)});function tD(a){return cs(a,R)}function _h(a,u){if(typeof a!="function"||u!=null&&typeof u!="function")throw new Mr(i);var h=function(){var S=arguments,P=u?u.apply(this,S):S[0],N=h.cache;if(N.has(P))return N.get(P);var L=a.apply(this,S);return h.cache=N.set(P,L)||N,L};return h.cache=new(_h.Cache||ti),h}_h.Cache=ti;function Rh(a){if(typeof a!="function")throw new Mr(i);return function(){var u=arguments;switch(u.length){case 0:return!a.call(this);case 1:return!a.call(this,u[0]);case 2:return!a.call(this,u[0],u[1]);case 3:return!a.call(this,u[0],u[1],u[2])}return!a.apply(this,u)}}function rD(a){return TE(2,a)}var nD=BN(function(a,u){u=u.length==1&&$e(u[0])?qt(u[0],$r(Ce())):qt(sr(u,1),$r(Ce()));var h=u.length;return Ue(function(S){for(var P=-1,N=ir(S.length,h);++P<N;)S[P]=u[P].call(this,S[P]);return Ar(a,this,S)})}),Hb=Ue(function(a,u){var h=An(u,Gl(Hb));return cs(a,O,t,u,h)}),DE=Ue(function(a,u){var h=An(u,Gl(DE));return cs(a,M,t,u,h)}),iD=fs(function(a,u){return cs(a,I,t,t,t,u)});function sD(a,u){if(typeof a!="function")throw new Mr(i);return u=u===t?u:Me(u),Ue(a,u)}function oD(a,u){if(typeof a!="function")throw new Mr(i);return u=u==null?0:Tt(Me(u),0),Ue(function(h){var S=h[u],P=ro(h,0,u);return S&&Ti(P,S),Ar(a,this,P)})}function aD(a,u,h){var S=!0,P=!0;if(typeof a!="function")throw new Mr(i);return Ut(h)&&(S="leading"in h?!!h.leading:S,P="trailing"in h?!!h.trailing:P),FE(a,u,{leading:S,maxWait:u,trailing:P})}function lD(a){return AE(a,1)}function uD(a,u){return Hb(Eb(u),a)}function cD(){if(!arguments.length)return[];var a=arguments[0];return $e(a)?a:[a]}function fD(a){return Sr(a,y)}function dD(a,u){return u=typeof u=="function"?u:t,Sr(a,y,u)}function pD(a){return Sr(a,p|y)}function hD(a,u){return u=typeof u=="function"?u:t,Sr(a,p|y,u)}function mD(a,u){return u==null||$n(a,u,fr(u))}function oi(a,u){return a===u||a!==a&&u!==u}var gD=mh(Vc),yD=mh(function(a,u){return a>=u}),ha=lh((function(){return arguments})())?lh:function(a){return Bt(a)&&pt.call(a,"callee")&&!ta.call(a,"callee")},$e=Y.isArray,vD=Oc?$r(Oc):yb;function Kr(a){return a!=null&&Ch(a.length)&&!ps(a)}function Kt(a){return Bt(a)&&Kr(a)}function bD(a){return a===!0||a===!1||Bt(a)&&dr(a)==kr}var no=Fl||eS,SD=kp?$r(kp):vb;function wD(a){return Bt(a)&&a.nodeType===1&&!Kc(a)}function _D(a){if(a==null)return!0;if(Kr(a)&&($e(a)||typeof a=="string"||typeof a.splice=="function"||no(a)||Yl(a)||ha(a)))return!a.length;var u=wr(a);if(u==At||u==ve)return!a.size;if(Gc(a))return!T(a).length;for(var h in a)if(pt.call(a,h))return!1;return!0}function RD(a,u){return fa(a,u)}function CD(a,u,h){h=typeof h=="function"?h:t;var S=h?h(a,u):t;return S===t?fa(a,u,t,h):!!S}function Bb(a){if(!Bt(a))return!1;var u=dr(a);return u==St||u==Ct||typeof a.message=="string"&&typeof a.name=="string"&&!Kc(a)}function xD(a){return typeof a=="number"&&as(a)}function ps(a){if(!Ut(a))return!1;var u=dr(a);return u==Wr||u==Ms||u==lt||u==Ie}function jE(a){return typeof a=="number"&&a==Me(a)}function Ch(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=Be}function Ut(a){var u=typeof a;return a!=null&&(u=="object"||u=="function")}function Bt(a){return a!=null&&typeof a=="object"}var LE=Ap?$r(Ap):Zs;function ED(a,u){return a===u||Xs(a,u,Tb(u))}function qD(a,u,h){return h=typeof h=="function"?h:t,Xs(a,u,Tb(u),h)}function OD(a){return UE(a)&&a!=+a}function ID(a){if(dM(a))throw new Oe(n);return Ke(a)}function PD(a){return a===null}function kD(a){return a==null}function UE(a){return typeof a=="number"||Bt(a)&&dr(a)==Pi}function Kc(a){if(!Bt(a)||dr(a)!=te)return!1;var u=Tl(a);if(u===null)return!0;var h=pt.call(u,"constructor")&&u.constructor;return typeof h=="function"&&h instanceof h&&Il.call(h)==Nv}var Vb=Yo?$r(Yo):f;function AD(a){return jE(a)&&a>=-Be&&a<=Be}var HE=Zn?$r(Zn):g;function xh(a){return typeof a=="string"||!$e(a)&&Bt(a)&&dr(a)==Ye}function gn(a){return typeof a=="symbol"||Bt(a)&&dr(a)==ur}var Yl=wl?$r(wl):w;function TD(a){return a===t}function $D(a){return Bt(a)&&wr(a)==ge}function ND(a){return Bt(a)&&dr(a)==qn}var MD=mh(K),FD=mh(function(a,u){return a<=u});function BE(a){if(!a)return[];if(Kr(a))return xh(a)?Nr(a):Yr(a);if(ra&&a[ra])return xv(a[ra]());var u=wr(a),h=u==At?zs:u==ve?ql:Kl;return h(a)}function hs(a){if(!a)return a===0?a:0;if(a=Dn(a),a===ce||a===-ce){var u=a<0?-1:1;return u*_e}return a===a?a:0}function Me(a){var u=hs(a),h=u%1;return u===u?h?u-h:u:0}function VE(a){return a?Di(Me(a),0,ke):0}function Dn(a){if(typeof a=="number")return a;if(gn(a))return me;if(Ut(a)){var u=typeof a.valueOf=="function"?a.valueOf():a;a=Ut(u)?u+"":u}if(typeof a!="string")return a===0?a:+a;a=$c(a);var h=Vo.test(a);return h||Vy.test(a)?dv(a.slice(2),h?2:8):By.test(a)?me:+a}function WE(a){return Li(a,Qr(a))}function DD(a){return a?Di(Me(a),-Be,Be):a===0?a:0}function wt(a){return a==null?"":mn(a)}var jD=zl(function(a,u){if(Gc(u)||Kr(u)){Li(u,fr(u),a);return}for(var h in u)pt.call(u,h)&&Fr(a,h,u[h])}),zE=zl(function(a,u){Li(u,Qr(u),a)}),JE=zl(function(a,u,h,S){Li(u,Qr(u),a,S)}),Wb=zl(function(a,u,h,S){Li(u,fr(u),a,S)}),LD=fs(Uc);function UD(a,u){var h=Ks(a);return u==null?h:nh(h,u)}var HD=Ue(function(a,u){a=Xe(a);var h=-1,S=u.length,P=S>2?u[2]:t;for(P&&Dr(u[0],u[1],P)&&(S=1);++h<S;)for(var N=u[h],L=Qr(N),B=-1,z=L.length;++B<z;){var X=L[B],ee=a[X];(ee===t||oi(ee,Js[X])&&!pt.call(a,X))&&(a[X]=N[X])}return a}),BD=Ue(function(a){return a.push(t,uE),Ar(GE,t,a)});function VD(a,u){return $p(a,Ce(u,3),Nn)}function WD(a,u){return $p(a,Ce(u,3),ri)}function zD(a,u){return a==null?a:Bc(a,Ce(u,3),Qr)}function JD(a,u){return a==null?a:oh(a,Ce(u,3),Qr)}function GD(a,u){return a&&Nn(a,Ce(u,3))}function YD(a,u){return a&&ri(a,Ce(u,3))}function KD(a){return a==null?[]:Wl(a,fr(a))}function QD(a){return a==null?[]:Wl(a,Qr(a))}function zb(a,u,h){var S=a==null?t:us(a,u);return S===t?h:S}function ZD(a,u){return a!=null&&dE(a,u,hb)}function Jb(a,u){return a!=null&&dE(a,u,mb)}var XD=iE(function(a,u,h){u!=null&&typeof u.toString!="function"&&(u=Pl.call(u)),a[u]=h},Yb(Zr)),ej=iE(function(a,u,h){u!=null&&typeof u.toString!="function"&&(u=Pl.call(u)),pt.call(a,u)?a[u].push(h):a[u]=[h]},Ce),tj=Ue(ca);function fr(a){return Kr(a)?eh(a):T(a)}function Qr(a){return Kr(a)?eh(a,!0):H(a)}function rj(a,u){var h={};return u=Ce(u,3),Nn(a,function(S,P,N){pn(h,u(S,P,N),S)}),h}function nj(a,u){var h={};return u=Ce(u,3),Nn(a,function(S,P,N){pn(h,P,u(S,P,N))}),h}var ij=zl(function(a,u,h){er(a,u,h)}),GE=zl(function(a,u,h,S){er(a,u,h,S)}),sj=fs(function(a,u){var h={};if(a==null)return h;var S=!1;u=qt(u,function(N){return N=to(N,a),S||(S=N.length>1),N}),Li(a,kb(a),h),S&&(h=Sr(h,p|m|y,eM));for(var P=u.length;P--;)Rb(h,u[P]);return h});function oj(a,u){return YE(a,Rh(Ce(u)))}var aj=fs(function(a,u){return a==null?{}:NN(a,u)});function YE(a,u){if(a==null)return{};var h=qt(kb(a),function(S){return[S]});return u=Ce(u),jx(a,h,function(S,P){return u(S,P[0])})}function lj(a,u,h){u=to(u,a);var S=-1,P=u.length;for(P||(P=1,a=t);++S<P;){var N=a==null?t:a[si(u[S])];N===t&&(S=P,N=h),a=ps(N)?N.call(a):N}return a}function uj(a,u,h){return a==null?a:zc(a,u,h)}function cj(a,u,h,S){return S=typeof S=="function"?S:t,a==null?a:zc(a,u,h,S)}var KE=aE(fr),QE=aE(Qr);function fj(a,u,h){var S=$e(a),P=S||no(a)||Yl(a);if(u=Ce(u,4),h==null){var N=a&&a.constructor;P?h=S?new N:[]:Ut(a)?h=ps(N)?Ks(Tl(a)):{}:h={}}return(P?Tr:Nn)(a,function(L,B,z){return u(h,L,B,z)}),h}function dj(a,u){return a==null?!0:Rb(a,u)}function pj(a,u,h){return a==null?a:Vx(a,u,Eb(h))}function hj(a,u,h,S){return S=typeof S=="function"?S:t,a==null?a:Vx(a,u,Eb(h),S)}function Kl(a){return a==null?[]:El(a,fr(a))}function mj(a){return a==null?[]:El(a,Qr(a))}function gj(a,u,h){return h===t&&(h=u,u=t),h!==t&&(h=Dn(h),h=h===h?h:0),u!==t&&(u=Dn(u),u=u===u?u:0),Di(Dn(a),u,h)}function yj(a,u,h){return u=hs(u),h===t?(h=u,u=0):h=hs(h),a=Dn(a),gb(a,u,h)}function vj(a,u,h){if(h&&typeof h!="boolean"&&Dr(a,u,h)&&(u=h=t),h===t&&(typeof u=="boolean"?(h=u,u=t):typeof a=="boolean"&&(h=a,a=t)),a===t&&u===t?(a=0,u=1):(a=hs(a),u===t?(u=a,a=0):u=hs(u)),a>u){var S=a;a=u,u=S}if(h||a%1||u%1){var P=Jp();return ir(a+P*(u-a+Ip("1e-"+((P+"").length-1))),u)}return Sb(a,u)}var bj=Jl(function(a,u,h){return u=u.toLowerCase(),a+(h?ZE(u):u)});function ZE(a){return Gb(wt(a).toLowerCase())}function XE(a){return a=wt(a),a&&a.replace(Wo,wv).replace(sv,"")}function Sj(a,u,h){a=wt(a),u=mn(u);var S=a.length;h=h===t?S:Di(Me(h),0,S);var P=h;return h-=u.length,h>=0&&a.slice(h,P)==u}function wj(a){return a=wt(a),a&&he.test(a)?a.replace(dl,_v):a}function _j(a){return a=wt(a),a&&Bo.test(a)?a.replace(ft,"\\$&"):a}var Rj=Jl(function(a,u,h){return a+(h?"-":"")+u.toLowerCase()}),Cj=Jl(function(a,u,h){return a+(h?" ":"")+u.toLowerCase()}),xj=tE("toLowerCase");function Ej(a,u,h){a=wt(a),u=Me(u);var S=u?$i(a):0;if(!u||S>=u)return a;var P=(u-S)/2;return hh(ia(P),h)+a+hh(na(P),h)}function qj(a,u,h){a=wt(a),u=Me(u);var S=u?$i(a):0;return u&&S<u?a+hh(u-S,h):a}function Oj(a,u,h){a=wt(a),u=Me(u);var S=u?$i(a):0;return u&&S<u?hh(u-S,h)+a:a}function Ij(a,u,h){return h||u==null?u=0:u&&(u=+u),Uv(wt(a).replace(yc,""),u||0)}function Pj(a,u,h){return(h?Dr(a,u,h):u===t)?u=1:u=Me(u),wb(wt(a),u)}function kj(){var a=arguments,u=wt(a[0]);return a.length<3?u:u.replace(a[1],a[2])}var Aj=Jl(function(a,u,h){return a+(h?"_":"")+u.toLowerCase()});function Tj(a,u,h){return h&&typeof h!="number"&&Dr(a,u,h)&&(u=h=t),h=h===t?ke:h>>>0,h?(a=wt(a),a&&(typeof u=="string"||u!=null&&!Vb(u))&&(u=mn(u),!u&&Ws(a))?ro(Nr(a),0,h):a.split(u,h)):[]}var $j=Jl(function(a,u,h){return a+(h?" ":"")+Gb(u)});function Nj(a,u,h){return a=wt(a),h=h==null?0:Di(Me(h),0,a.length),u=mn(u),a.slice(h,h+u.length)==u}function Mj(a,u,h){var S=$.templateSettings;h&&Dr(a,u,h)&&(u=t),a=wt(a),u=Wb({},u,S,lE);var P=Wb({},u.imports,S.imports,lE),N=fr(P),L=El(P,N);Tr(N,function(Re){if(Jr.test(Re))throw new Oe(o)});var B,z,X=0,ee=u.interpolate||zo,re="__p += '",ue=Ol((u.escape||zo).source+"|"+ee.source+"|"+(ee===In?rs:zo).source+"|"+(u.evaluate||zo).source+"|$","g"),be="//# sourceURL="+(pt.call(u,"sourceURL")?(u.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++cv+"]")+`
|
|
4
4
|
`;a.replace(ue,function(Re,Qe,et,yn,jr,vn){return et||(et=yn),re+=a.slice(X,vn).replace(Wy,Rv),Qe&&(B=!0,re+=`' +
|
|
5
5
|
__e(`+Qe+`) +
|
|
6
6
|
'`),jr&&(z=!0,re+=`';
|
|
@@ -17,17 +17,17 @@ __p += '`),et&&(re+=`' +
|
|
|
17
17
|
function print() { __p += __j.call(arguments, '') }
|
|
18
18
|
`:`;
|
|
19
19
|
`)+re+`return __p
|
|
20
|
-
}`;var De=tq(function(){return ut(N,be+"return "+re).apply(t,L)});if(De.source=re,Bb(De))throw De;return De}function Fj(a){return wt(a).toLowerCase()}function Dj(a){return wt(a).toUpperCase()}function jj(a,u,h){if(a=wt(a),a&&(h||u===t))return $c(a);if(!a||!(u=mn(u)))return a;var S=Nr(a),P=Nr(u),N=Mp(S,P),L=Fp(S,P)+1;return ro(S,N,L).join("")}function Lj(a,u,h){if(a=wt(a),a&&(h||u===t))return a.slice(0,Lp(a)+1);if(!a||!(u=mn(u)))return a;var S=Nr(a),P=Fp(S,Nr(u))+1;return ro(S,0,P).join("")}function Uj(a,u,h){if(a=wt(a),a&&(h||u===t))return a.replace(yc,"");if(!a||!(u=mn(u)))return a;var S=Nr(a),P=Mp(S,Nr(u));return ro(S,P).join("")}function Hj(a,u){var h=A,S=F;if(Ut(u)){var P="separator"in u?u.separator:P;h="length"in u?Me(u.length):h,S="omission"in u?mn(u.omission):S}a=wt(a);var N=a.length;if(Ws(a)){var L=Nr(a);N=L.length}if(h>=N)return a;var B=h-$i(S);if(B<1)return S;var z=L?ro(L,0,B).join(""):a.slice(0,B);if(P===t)return z+S;if(L&&(B+=z.length-B),Vb(P)){if(a.slice(B).search(P)){var X,ee=z;for(P.global||(P=Ol(P.source,wt(mp.exec(P))+"g")),P.lastIndex=0;X=P.exec(ee);)var re=X.index;z=z.slice(0,re===t?B:re)}}else if(a.indexOf(mn(P),B)!=B){var ue=z.lastIndexOf(P);ue>-1&&(z=z.slice(0,ue))}return z+S}function Bj(a){return a=wt(a),a&&pl.test(a)?a.replace(ts,qv):a}var Vj=Jl(function(a,u,h){return a+(h?" ":"")+u.toUpperCase()}),Gb=tE("toUpperCase");function eq(a,u,h){return a=wt(a),u=h?t:u,u===t?Cv(a)?Pv(a):yv(a):a.match(u)||[]}var tq=Ue(function(a,u){try{return Ar(a,t,u)}catch(h){return Bb(h)?h:new Oe(h)}}),Wj=fs(function(a,u){return Tr(u,function(h){h=si(h),pn(a,h,Ub(a[h],a))}),a});function zj(a){var u=a==null?0:a.length,h=Ce();return a=u?qt(a,function(S){if(typeof S[1]!="function")throw new Mr(i);return[h(S[0]),S[1]]}):[],Ue(function(S){for(var P=-1;++P<u;){var N=a[P];if(Ar(N[0],this,S))return Ar(N[1],this,S)}})}function Jj(a){return fb(Sr(a,p))}function Yb(a){return function(){return a}}function Gj(a,u){return a==null||a!==a?u:a}var Yj=nE(),Kj=nE(!0);function Zr(a){return a}function Kb(a){return x(typeof a=="function"?a:Sr(a,p))}function Qj(a){return qe(Sr(a,p))}function Zj(a,u){return ze(a,Sr(u,p))}var Xj=Ue(function(a,u){return function(h){return ca(h,a,u)}}),eL=Ue(function(a,u){return function(h){return ca(a,h,u)}});function Qb(a,u,h){var S=fr(u),P=Wl(u,S);h==null&&!(Ut(u)&&(P.length||!S.length))&&(h=u,u=a,a=this,P=Wl(u,fr(u)));var N=!(Ut(h)&&"chain"in h)||!!h.chain,L=ps(a);return Tr(P,function(B){var z=u[B];a[B]=z,L&&(a.prototype[B]=function(){var X=this.__chain__;if(N||X){var ee=a(this.__wrapped__),re=ee.__actions__=Yr(this.__actions__);return re.push({func:z,args:arguments,thisArg:a}),ee.__chain__=X,ee}return z.apply(a,Ti([this.value()],arguments))})}),a}function tL(){return Xt._===this&&(Xt._=Mv),this}function Zb(){}function rL(a){return a=Me(a),Ue(function(u){return ii(u,a)})}var nL=Ob(qt),iL=Ob(Tp),sL=Ob(Rl);function rq(a){return Nb(a)?Ko(si(a)):MN(a)}function oL(a){return function(u){return a==null?t:us(a,u)}}var aL=sE(),lL=sE(!0);function Xb(){return[]}function eS(){return!1}function uL(){return{}}function cL(){return""}function fL(){return!0}function dL(a,u){if(a=Me(a),a<1||a>Be)return[];var h=ke,S=ir(a,ke);u=Ce(u),a-=ke;for(var P=Tc(S,u);++h<a;)u(h);return P}function pL(a){return $e(a)?qt(a,si):gn(a)?[a]:Yr(wE(wt(a)))}function hL(a){var u=++$v;return wt(a)+u}var mL=ph(function(a,u){return a+u},0),gL=Ib("ceil"),yL=ph(function(a,u){return a/u},1),vL=Ib("floor");function bL(a){return a&&a.length?Vl(a,Zr,Vc):t}function SL(a,u){return a&&a.length?Vl(a,Ce(u,2),Vc):t}function wL(a){return Np(a,Zr)}function _L(a,u){return Np(a,Ce(u,2))}function RL(a){return a&&a.length?Vl(a,Zr,K):t}function CL(a,u){return a&&a.length?Vl(a,Ce(u,2),K):t}var xL=ph(function(a,u){return a*u},1),EL=Ib("round"),qL=ph(function(a,u){return a-u},0);function OL(a){return a&&a.length?Ac(a,Zr):0}function IL(a,u){return a&&a.length?Ac(a,Ce(u,2)):0}return $.after=ZF,$.ary=AE,$.assign=jD,$.assignIn=zE,$.assignInWith=JE,$.assignWith=Wb,$.at=LD,$.before=TE,$.bind=Ub,$.bindAll=Wj,$.bindKey=$E,$.castArray=cD,$.chain=IE,$.chunk=bM,$.compact=SM,$.concat=wM,$.cond=zj,$.conforms=Jj,$.constant=Yb,$.countBy=IF,$.create=UD,$.curry=NE,$.curryRight=ME,$.debounce=FE,$.defaults=HD,$.defaultsDeep=BD,$.defer=XF,$.delay=eD,$.difference=_M,$.differenceBy=RM,$.differenceWith=CM,$.drop=xM,$.dropRight=EM,$.dropRightWhile=qM,$.dropWhile=OM,$.fill=IM,$.filter=kF,$.flatMap=$F,$.flatMapDeep=NF,$.flatMapDepth=MF,$.flatten=xE,$.flattenDeep=PM,$.flattenDepth=kM,$.flip=tD,$.flow=Yj,$.flowRight=Kj,$.fromPairs=AM,$.functions=KD,$.functionsIn=QD,$.groupBy=FF,$.initial=$M,$.intersection=NM,$.intersectionBy=MM,$.intersectionWith=FM,$.invert=XD,$.invertBy=ej,$.invokeMap=jF,$.iteratee=Kb,$.keyBy=LF,$.keys=fr,$.keysIn=Qr,$.map=Sh,$.mapKeys=rj,$.mapValues=nj,$.matches=Qj,$.matchesProperty=Zj,$.memoize=_h,$.merge=ij,$.mergeWith=GE,$.method=Xj,$.methodOf=eL,$.mixin=Qb,$.negate=Rh,$.nthArg=rL,$.omit=sj,$.omitBy=oj,$.once=rD,$.orderBy=UF,$.over=nL,$.overArgs=nD,$.overEvery=iL,$.overSome=sL,$.partial=Hb,$.partialRight=DE,$.partition=HF,$.pick=aj,$.pickBy=YE,$.property=rq,$.propertyOf=oL,$.pull=UM,$.pullAll=qE,$.pullAllBy=HM,$.pullAllWith=BM,$.pullAt=VM,$.range=aL,$.rangeRight=lL,$.rearg=iD,$.reject=WF,$.remove=WM,$.rest=sD,$.reverse=jb,$.sampleSize=JF,$.set=uj,$.setWith=cj,$.shuffle=GF,$.slice=zM,$.sortBy=QF,$.sortedUniq=XM,$.sortedUniqBy=eF,$.split=Tj,$.spread=oD,$.tail=tF,$.take=rF,$.takeRight=nF,$.takeRightWhile=iF,$.takeWhile=sF,$.tap=SF,$.throttle=aD,$.thru=bh,$.toArray=BE,$.toPairs=KE,$.toPairsIn=QE,$.toPath=pL,$.toPlainObject=WE,$.transform=fj,$.unary=lD,$.union=oF,$.unionBy=aF,$.unionWith=lF,$.uniq=uF,$.uniqBy=cF,$.uniqWith=fF,$.unset=dj,$.unzip=Lb,$.unzipWith=OE,$.update=pj,$.updateWith=hj,$.values=Kl,$.valuesIn=mj,$.without=dF,$.words=eq,$.wrap=uD,$.xor=pF,$.xorBy=hF,$.xorWith=mF,$.zip=gF,$.zipObject=yF,$.zipObjectDeep=vF,$.zipWith=bF,$.entries=KE,$.entriesIn=QE,$.extend=zE,$.extendWith=JE,Qb($,$),$.add=mL,$.attempt=tq,$.camelCase=bj,$.capitalize=ZE,$.ceil=gL,$.clamp=gj,$.clone=fD,$.cloneDeep=pD,$.cloneDeepWith=hD,$.cloneWith=dD,$.conformsTo=mD,$.deburr=XE,$.defaultTo=Gj,$.divide=yL,$.endsWith=Sj,$.eq=oi,$.escape=wj,$.escapeRegExp=_j,$.every=PF,$.find=AF,$.findIndex=RE,$.findKey=VD,$.findLast=TF,$.findLastIndex=CE,$.findLastKey=WD,$.floor=vL,$.forEach=PE,$.forEachRight=kE,$.forIn=zD,$.forInRight=JD,$.forOwn=GD,$.forOwnRight=YD,$.get=zb,$.gt=gD,$.gte=yD,$.has=ZD,$.hasIn=Jb,$.head=EE,$.identity=Zr,$.includes=DF,$.indexOf=TM,$.inRange=yj,$.invoke=tj,$.isArguments=ha,$.isArray=$e,$.isArrayBuffer=vD,$.isArrayLike=Kr,$.isArrayLikeObject=Kt,$.isBoolean=bD,$.isBuffer=no,$.isDate=SD,$.isElement=wD,$.isEmpty=_D,$.isEqual=RD,$.isEqualWith=CD,$.isError=Bb,$.isFinite=xD,$.isFunction=ps,$.isInteger=jE,$.isLength=Ch,$.isMap=LE,$.isMatch=ED,$.isMatchWith=qD,$.isNaN=OD,$.isNative=ID,$.isNil=kD,$.isNull=PD,$.isNumber=UE,$.isObject=Ut,$.isObjectLike=Bt,$.isPlainObject=Kc,$.isRegExp=Vb,$.isSafeInteger=AD,$.isSet=HE,$.isString=xh,$.isSymbol=gn,$.isTypedArray=Yl,$.isUndefined=TD,$.isWeakMap=$D,$.isWeakSet=ND,$.join=DM,$.kebabCase=Rj,$.last=Fn,$.lastIndexOf=jM,$.lowerCase=Cj,$.lowerFirst=xj,$.lt=MD,$.lte=FD,$.max=bL,$.maxBy=SL,$.mean=wL,$.meanBy=_L,$.min=RL,$.minBy=CL,$.stubArray=Xb,$.stubFalse=eS,$.stubObject=uL,$.stubString=cL,$.stubTrue=fL,$.multiply=xL,$.nth=LM,$.noConflict=tL,$.noop=Zb,$.now=wh,$.pad=Ej,$.padEnd=qj,$.padStart=Oj,$.parseInt=Ij,$.random=vj,$.reduce=BF,$.reduceRight=VF,$.repeat=Pj,$.replace=kj,$.result=lj,$.round=EL,$.runInContext=W,$.sample=zF,$.size=YF,$.snakeCase=Aj,$.some=KF,$.sortedIndex=JM,$.sortedIndexBy=GM,$.sortedIndexOf=YM,$.sortedLastIndex=KM,$.sortedLastIndexBy=QM,$.sortedLastIndexOf=ZM,$.startCase=$j,$.startsWith=Nj,$.subtract=qL,$.sum=OL,$.sumBy=IL,$.template=Mj,$.times=dL,$.toFinite=hs,$.toInteger=Me,$.toLength=VE,$.toLower=Fj,$.toNumber=Dn,$.toSafeInteger=DD,$.toString=wt,$.toUpper=Dj,$.trim=jj,$.trimEnd=Lj,$.trimStart=Uj,$.truncate=Hj,$.unescape=Bj,$.uniqueId=hL,$.upperCase=Vj,$.upperFirst=Gb,$.each=PE,$.eachRight=kE,$.first=EE,Qb($,(function(){var a={};return Nn($,function(u,h){pt.call($.prototype,h)||(a[h]=u)}),a})(),{chain:!1}),$.VERSION=e,Tr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(a){$[a].placeholder=$}),Tr(["drop","take"],function(a,u){We.prototype[a]=function(h){h=h===t?1:Tt(Me(h),0);var S=this.__filtered__&&!u?new We(this):this.clone();return S.__filtered__?S.__takeCount__=ir(h,S.__takeCount__):S.__views__.push({size:ir(h,ke),type:a+(S.__dir__<0?"Right":"")}),S},We.prototype[a+"Right"]=function(h){return this.reverse()[a](h).reverse()}}),Tr(["filter","map","takeWhile"],function(a,u){var h=u+1,S=h==J||h==se;We.prototype[a]=function(P){var N=this.clone();return N.__iteratees__.push({iteratee:Ce(P,3),type:h}),N.__filtered__=N.__filtered__||S,N}}),Tr(["head","last"],function(a,u){var h="take"+(u?"Right":"");We.prototype[a]=function(){return this[h](1).value()[0]}}),Tr(["initial","tail"],function(a,u){var h="drop"+(u?"":"Right");We.prototype[a]=function(){return this.__filtered__?new We(this):this[h](1)}}),We.prototype.compact=function(){return this.filter(Zr)},We.prototype.find=function(a){return this.filter(a).head()},We.prototype.findLast=function(a){return this.reverse().find(a)},We.prototype.invokeMap=Ue(function(a,u){return typeof a=="function"?new We(this):this.map(function(h){return ca(h,a,u)})}),We.prototype.reject=function(a){return this.filter(Rh(Ce(a)))},We.prototype.slice=function(a,u){a=Me(a);var h=this;return h.__filtered__&&(a>0||u<0)?new We(h):(a<0?h=h.takeRight(-a):a&&(h=h.drop(a)),u!==t&&(u=Me(u),h=u<0?h.dropRight(-u):h.take(u-a)),h)},We.prototype.takeRightWhile=function(a){return this.reverse().takeWhile(a).reverse()},We.prototype.toArray=function(){return this.take(ke)},Nn(We.prototype,function(a,u){var h=/^(?:filter|find|map|reject)|While$/.test(u),S=/^(?:head|last)$/.test(u),P=$[S?"take"+(u=="last"?"Right":""):u],N=S||/^find/.test(u);P&&($.prototype[u]=function(){var L=this.__wrapped__,B=S?[1]:arguments,z=L instanceof We,X=B[0],ee=z||$e(L),re=function(Qe){var et=P.apply($,Ti([Qe],B));return S&&ue?et[0]:et};ee&&h&&typeof X=="function"&&X.length!=1&&(z=ee=!1);var ue=this.__chain__,be=!!this.__actions__.length,xe=N&&!ue,De=z&&!be;if(!N&&ee){L=De?L:new We(this);var Re=a.apply(L,B);return Re.__actions__.push({func:bh,args:[re],thisArg:t}),new br(Re,ue)}return xe&&De?a.apply(this,B):(Re=this.thru(re),xe?S?Re.value()[0]:Re.value():Re)})}),Tr(["pop","push","shift","sort","splice","unshift"],function(a){var u=Xo[a],h=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",S=/^(?:pop|shift)$/.test(a);$.prototype[a]=function(){var P=arguments;if(S&&!this.__chain__){var N=this.value();return u.apply($e(N)?N:[],P)}return this[h](function(L){return u.apply($e(L)?L:[],P)})}}),Nn(We.prototype,function(a,u){var h=$[u];if(h){var S=h.name+"";pt.call(Ys,S)||(Ys[S]=[]),Ys[S].push({name:u,func:h})}}),Ys[dh(t,v).name]=[{name:"wrapper",func:t}],We.prototype.clone=Gv,We.prototype.reverse=Yv,We.prototype.value=Dc,$.prototype.at=wF,$.prototype.chain=_F,$.prototype.commit=RF,$.prototype.next=CF,$.prototype.plant=EF,$.prototype.reverse=qF,$.prototype.toJSON=$.prototype.valueOf=$.prototype.value=OF,$.prototype.first=$.prototype.head,ra&&($.prototype[ra]=xF),$}),Ni=kv();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Xt._=Ni,define(function(){return Ni})):dt?((dt.exports=Ni)._=Ni,Sl._=Ni):Xt._=Ni}).call(tu)});var _q=V((pS,ru)=>{(function(t,e){typeof pS=="object"&&typeof ru<"u"?ru.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(pS,(function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(f){t=f}function n(f){return f instanceof Array||Object.prototype.toString.call(f)==="[object Array]"}function i(f){return f!=null&&Object.prototype.toString.call(f)==="[object Object]"}function s(f,g){return Object.prototype.hasOwnProperty.call(f,g)}function o(f){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(f).length===0;var g;for(g in f)if(s(f,g))return!1;return!0}function l(f){return f===void 0}function c(f){return typeof f=="number"||Object.prototype.toString.call(f)==="[object Number]"}function d(f){return f instanceof Date||Object.prototype.toString.call(f)==="[object Date]"}function p(f,g){var w=[],x,T=f.length;for(x=0;x<T;++x)w.push(g(f[x],x));return w}function m(f,g){for(var w in g)s(g,w)&&(f[w]=g[w]);return s(g,"toString")&&(f.toString=g.toString),s(g,"valueOf")&&(f.valueOf=g.valueOf),f}function y(f,g,w,x){return El(f,g,w,x,!0).utc()}function b(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function E(f){return f._pf==null&&(f._pf=b()),f._pf}var C;Array.prototype.some?C=Array.prototype.some:C=function(f){var g=Object(this),w=g.length>>>0,x;for(x=0;x<w;x++)if(x in g&&f.call(this,g[x],x,g))return!0;return!1};function v(f){var g=null,w=!1,x=f._d&&!isNaN(f._d.getTime());if(x&&(g=E(f),w=C.call(g.parsedDateParts,function(T){return T!=null}),x=g.overflow<0&&!g.empty&&!g.invalidEra&&!g.invalidMonth&&!g.invalidWeekday&&!g.weekdayMismatch&&!g.nullInput&&!g.invalidFormat&&!g.userInvalidated&&(!g.meridiem||g.meridiem&&w),f._strict&&(x=x&&g.charsLeftOver===0&&g.unusedTokens.length===0&&g.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(f))f._isValid=x;else return x;return f._isValid}function _(f){var g=y(NaN);return f!=null?m(E(g),f):E(g).userInvalidated=!0,g}var q=e.momentProperties=[],k=!1;function O(f,g){var w,x,T,H=q.length;if(l(g._isAMomentObject)||(f._isAMomentObject=g._isAMomentObject),l(g._i)||(f._i=g._i),l(g._f)||(f._f=g._f),l(g._l)||(f._l=g._l),l(g._strict)||(f._strict=g._strict),l(g._tzm)||(f._tzm=g._tzm),l(g._isUTC)||(f._isUTC=g._isUTC),l(g._offset)||(f._offset=g._offset),l(g._pf)||(f._pf=E(g)),l(g._locale)||(f._locale=g._locale),H>0)for(w=0;w<H;w++)x=q[w],T=g[x],l(T)||(f[x]=T);return f}function M(f){O(this,f),this._d=new Date(f._d!=null?f._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),k===!1&&(k=!0,e.updateOffset(this),k=!1)}function j(f){return f instanceof M||f!=null&&f._isAMomentObject!=null}function I(f){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+f)}function R(f,g){var w=!0;return m(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,f),w){var x=[],T,H,K,fe=arguments.length;for(H=0;H<fe;H++){if(T="",typeof arguments[H]=="object"){T+=`
|
|
20
|
+
}`;var De=tq(function(){return ut(N,be+"return "+re).apply(t,L)});if(De.source=re,Bb(De))throw De;return De}function Fj(a){return wt(a).toLowerCase()}function Dj(a){return wt(a).toUpperCase()}function jj(a,u,h){if(a=wt(a),a&&(h||u===t))return $c(a);if(!a||!(u=mn(u)))return a;var S=Nr(a),P=Nr(u),N=Mp(S,P),L=Fp(S,P)+1;return ro(S,N,L).join("")}function Lj(a,u,h){if(a=wt(a),a&&(h||u===t))return a.slice(0,Lp(a)+1);if(!a||!(u=mn(u)))return a;var S=Nr(a),P=Fp(S,Nr(u))+1;return ro(S,0,P).join("")}function Uj(a,u,h){if(a=wt(a),a&&(h||u===t))return a.replace(yc,"");if(!a||!(u=mn(u)))return a;var S=Nr(a),P=Mp(S,Nr(u));return ro(S,P).join("")}function Hj(a,u){var h=A,S=F;if(Ut(u)){var P="separator"in u?u.separator:P;h="length"in u?Me(u.length):h,S="omission"in u?mn(u.omission):S}a=wt(a);var N=a.length;if(Ws(a)){var L=Nr(a);N=L.length}if(h>=N)return a;var B=h-$i(S);if(B<1)return S;var z=L?ro(L,0,B).join(""):a.slice(0,B);if(P===t)return z+S;if(L&&(B+=z.length-B),Vb(P)){if(a.slice(B).search(P)){var X,ee=z;for(P.global||(P=Ol(P.source,wt(mp.exec(P))+"g")),P.lastIndex=0;X=P.exec(ee);)var re=X.index;z=z.slice(0,re===t?B:re)}}else if(a.indexOf(mn(P),B)!=B){var ue=z.lastIndexOf(P);ue>-1&&(z=z.slice(0,ue))}return z+S}function Bj(a){return a=wt(a),a&&pl.test(a)?a.replace(ts,qv):a}var Vj=Jl(function(a,u,h){return a+(h?" ":"")+u.toUpperCase()}),Gb=tE("toUpperCase");function eq(a,u,h){return a=wt(a),u=h?t:u,u===t?Cv(a)?Pv(a):yv(a):a.match(u)||[]}var tq=Ue(function(a,u){try{return Ar(a,t,u)}catch(h){return Bb(h)?h:new Oe(h)}}),Wj=fs(function(a,u){return Tr(u,function(h){h=si(h),pn(a,h,Ub(a[h],a))}),a});function zj(a){var u=a==null?0:a.length,h=Ce();return a=u?qt(a,function(S){if(typeof S[1]!="function")throw new Mr(i);return[h(S[0]),S[1]]}):[],Ue(function(S){for(var P=-1;++P<u;){var N=a[P];if(Ar(N[0],this,S))return Ar(N[1],this,S)}})}function Jj(a){return fb(Sr(a,p))}function Yb(a){return function(){return a}}function Gj(a,u){return a==null||a!==a?u:a}var Yj=nE(),Kj=nE(!0);function Zr(a){return a}function Kb(a){return x(typeof a=="function"?a:Sr(a,p))}function Qj(a){return qe(Sr(a,p))}function Zj(a,u){return ze(a,Sr(u,p))}var Xj=Ue(function(a,u){return function(h){return ca(h,a,u)}}),eL=Ue(function(a,u){return function(h){return ca(a,h,u)}});function Qb(a,u,h){var S=fr(u),P=Wl(u,S);h==null&&!(Ut(u)&&(P.length||!S.length))&&(h=u,u=a,a=this,P=Wl(u,fr(u)));var N=!(Ut(h)&&"chain"in h)||!!h.chain,L=ps(a);return Tr(P,function(B){var z=u[B];a[B]=z,L&&(a.prototype[B]=function(){var X=this.__chain__;if(N||X){var ee=a(this.__wrapped__),re=ee.__actions__=Yr(this.__actions__);return re.push({func:z,args:arguments,thisArg:a}),ee.__chain__=X,ee}return z.apply(a,Ti([this.value()],arguments))})}),a}function tL(){return Xt._===this&&(Xt._=Mv),this}function Zb(){}function rL(a){return a=Me(a),Ue(function(u){return ii(u,a)})}var nL=Ob(qt),iL=Ob(Tp),sL=Ob(Rl);function rq(a){return Nb(a)?Ko(si(a)):MN(a)}function oL(a){return function(u){return a==null?t:us(a,u)}}var aL=sE(),lL=sE(!0);function Xb(){return[]}function eS(){return!1}function uL(){return{}}function cL(){return""}function fL(){return!0}function dL(a,u){if(a=Me(a),a<1||a>Be)return[];var h=ke,S=ir(a,ke);u=Ce(u),a-=ke;for(var P=Tc(S,u);++h<a;)u(h);return P}function pL(a){return $e(a)?qt(a,si):gn(a)?[a]:Yr(wE(wt(a)))}function hL(a){var u=++$v;return wt(a)+u}var mL=ph(function(a,u){return a+u},0),gL=Ib("ceil"),yL=ph(function(a,u){return a/u},1),vL=Ib("floor");function bL(a){return a&&a.length?Vl(a,Zr,Vc):t}function SL(a,u){return a&&a.length?Vl(a,Ce(u,2),Vc):t}function wL(a){return Np(a,Zr)}function _L(a,u){return Np(a,Ce(u,2))}function RL(a){return a&&a.length?Vl(a,Zr,K):t}function CL(a,u){return a&&a.length?Vl(a,Ce(u,2),K):t}var xL=ph(function(a,u){return a*u},1),EL=Ib("round"),qL=ph(function(a,u){return a-u},0);function OL(a){return a&&a.length?Ac(a,Zr):0}function IL(a,u){return a&&a.length?Ac(a,Ce(u,2)):0}return $.after=ZF,$.ary=AE,$.assign=jD,$.assignIn=zE,$.assignInWith=JE,$.assignWith=Wb,$.at=LD,$.before=TE,$.bind=Ub,$.bindAll=Wj,$.bindKey=$E,$.castArray=cD,$.chain=IE,$.chunk=bM,$.compact=SM,$.concat=wM,$.cond=zj,$.conforms=Jj,$.constant=Yb,$.countBy=IF,$.create=UD,$.curry=NE,$.curryRight=ME,$.debounce=FE,$.defaults=HD,$.defaultsDeep=BD,$.defer=XF,$.delay=eD,$.difference=_M,$.differenceBy=RM,$.differenceWith=CM,$.drop=xM,$.dropRight=EM,$.dropRightWhile=qM,$.dropWhile=OM,$.fill=IM,$.filter=kF,$.flatMap=$F,$.flatMapDeep=NF,$.flatMapDepth=MF,$.flatten=xE,$.flattenDeep=PM,$.flattenDepth=kM,$.flip=tD,$.flow=Yj,$.flowRight=Kj,$.fromPairs=AM,$.functions=KD,$.functionsIn=QD,$.groupBy=FF,$.initial=$M,$.intersection=NM,$.intersectionBy=MM,$.intersectionWith=FM,$.invert=XD,$.invertBy=ej,$.invokeMap=jF,$.iteratee=Kb,$.keyBy=LF,$.keys=fr,$.keysIn=Qr,$.map=Sh,$.mapKeys=rj,$.mapValues=nj,$.matches=Qj,$.matchesProperty=Zj,$.memoize=_h,$.merge=ij,$.mergeWith=GE,$.method=Xj,$.methodOf=eL,$.mixin=Qb,$.negate=Rh,$.nthArg=rL,$.omit=sj,$.omitBy=oj,$.once=rD,$.orderBy=UF,$.over=nL,$.overArgs=nD,$.overEvery=iL,$.overSome=sL,$.partial=Hb,$.partialRight=DE,$.partition=HF,$.pick=aj,$.pickBy=YE,$.property=rq,$.propertyOf=oL,$.pull=UM,$.pullAll=qE,$.pullAllBy=HM,$.pullAllWith=BM,$.pullAt=VM,$.range=aL,$.rangeRight=lL,$.rearg=iD,$.reject=WF,$.remove=WM,$.rest=sD,$.reverse=jb,$.sampleSize=JF,$.set=uj,$.setWith=cj,$.shuffle=GF,$.slice=zM,$.sortBy=QF,$.sortedUniq=XM,$.sortedUniqBy=eF,$.split=Tj,$.spread=oD,$.tail=tF,$.take=rF,$.takeRight=nF,$.takeRightWhile=iF,$.takeWhile=sF,$.tap=SF,$.throttle=aD,$.thru=bh,$.toArray=BE,$.toPairs=KE,$.toPairsIn=QE,$.toPath=pL,$.toPlainObject=WE,$.transform=fj,$.unary=lD,$.union=oF,$.unionBy=aF,$.unionWith=lF,$.uniq=uF,$.uniqBy=cF,$.uniqWith=fF,$.unset=dj,$.unzip=Lb,$.unzipWith=OE,$.update=pj,$.updateWith=hj,$.values=Kl,$.valuesIn=mj,$.without=dF,$.words=eq,$.wrap=uD,$.xor=pF,$.xorBy=hF,$.xorWith=mF,$.zip=gF,$.zipObject=yF,$.zipObjectDeep=vF,$.zipWith=bF,$.entries=KE,$.entriesIn=QE,$.extend=zE,$.extendWith=JE,Qb($,$),$.add=mL,$.attempt=tq,$.camelCase=bj,$.capitalize=ZE,$.ceil=gL,$.clamp=gj,$.clone=fD,$.cloneDeep=pD,$.cloneDeepWith=hD,$.cloneWith=dD,$.conformsTo=mD,$.deburr=XE,$.defaultTo=Gj,$.divide=yL,$.endsWith=Sj,$.eq=oi,$.escape=wj,$.escapeRegExp=_j,$.every=PF,$.find=AF,$.findIndex=RE,$.findKey=VD,$.findLast=TF,$.findLastIndex=CE,$.findLastKey=WD,$.floor=vL,$.forEach=PE,$.forEachRight=kE,$.forIn=zD,$.forInRight=JD,$.forOwn=GD,$.forOwnRight=YD,$.get=zb,$.gt=gD,$.gte=yD,$.has=ZD,$.hasIn=Jb,$.head=EE,$.identity=Zr,$.includes=DF,$.indexOf=TM,$.inRange=yj,$.invoke=tj,$.isArguments=ha,$.isArray=$e,$.isArrayBuffer=vD,$.isArrayLike=Kr,$.isArrayLikeObject=Kt,$.isBoolean=bD,$.isBuffer=no,$.isDate=SD,$.isElement=wD,$.isEmpty=_D,$.isEqual=RD,$.isEqualWith=CD,$.isError=Bb,$.isFinite=xD,$.isFunction=ps,$.isInteger=jE,$.isLength=Ch,$.isMap=LE,$.isMatch=ED,$.isMatchWith=qD,$.isNaN=OD,$.isNative=ID,$.isNil=kD,$.isNull=PD,$.isNumber=UE,$.isObject=Ut,$.isObjectLike=Bt,$.isPlainObject=Kc,$.isRegExp=Vb,$.isSafeInteger=AD,$.isSet=HE,$.isString=xh,$.isSymbol=gn,$.isTypedArray=Yl,$.isUndefined=TD,$.isWeakMap=$D,$.isWeakSet=ND,$.join=DM,$.kebabCase=Rj,$.last=Fn,$.lastIndexOf=jM,$.lowerCase=Cj,$.lowerFirst=xj,$.lt=MD,$.lte=FD,$.max=bL,$.maxBy=SL,$.mean=wL,$.meanBy=_L,$.min=RL,$.minBy=CL,$.stubArray=Xb,$.stubFalse=eS,$.stubObject=uL,$.stubString=cL,$.stubTrue=fL,$.multiply=xL,$.nth=LM,$.noConflict=tL,$.noop=Zb,$.now=wh,$.pad=Ej,$.padEnd=qj,$.padStart=Oj,$.parseInt=Ij,$.random=vj,$.reduce=BF,$.reduceRight=VF,$.repeat=Pj,$.replace=kj,$.result=lj,$.round=EL,$.runInContext=W,$.sample=zF,$.size=YF,$.snakeCase=Aj,$.some=KF,$.sortedIndex=JM,$.sortedIndexBy=GM,$.sortedIndexOf=YM,$.sortedLastIndex=KM,$.sortedLastIndexBy=QM,$.sortedLastIndexOf=ZM,$.startCase=$j,$.startsWith=Nj,$.subtract=qL,$.sum=OL,$.sumBy=IL,$.template=Mj,$.times=dL,$.toFinite=hs,$.toInteger=Me,$.toLength=VE,$.toLower=Fj,$.toNumber=Dn,$.toSafeInteger=DD,$.toString=wt,$.toUpper=Dj,$.trim=jj,$.trimEnd=Lj,$.trimStart=Uj,$.truncate=Hj,$.unescape=Bj,$.uniqueId=hL,$.upperCase=Vj,$.upperFirst=Gb,$.each=PE,$.eachRight=kE,$.first=EE,Qb($,(function(){var a={};return Nn($,function(u,h){pt.call($.prototype,h)||(a[h]=u)}),a})(),{chain:!1}),$.VERSION=e,Tr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(a){$[a].placeholder=$}),Tr(["drop","take"],function(a,u){We.prototype[a]=function(h){h=h===t?1:Tt(Me(h),0);var S=this.__filtered__&&!u?new We(this):this.clone();return S.__filtered__?S.__takeCount__=ir(h,S.__takeCount__):S.__views__.push({size:ir(h,ke),type:a+(S.__dir__<0?"Right":"")}),S},We.prototype[a+"Right"]=function(h){return this.reverse()[a](h).reverse()}}),Tr(["filter","map","takeWhile"],function(a,u){var h=u+1,S=h==J||h==se;We.prototype[a]=function(P){var N=this.clone();return N.__iteratees__.push({iteratee:Ce(P,3),type:h}),N.__filtered__=N.__filtered__||S,N}}),Tr(["head","last"],function(a,u){var h="take"+(u?"Right":"");We.prototype[a]=function(){return this[h](1).value()[0]}}),Tr(["initial","tail"],function(a,u){var h="drop"+(u?"":"Right");We.prototype[a]=function(){return this.__filtered__?new We(this):this[h](1)}}),We.prototype.compact=function(){return this.filter(Zr)},We.prototype.find=function(a){return this.filter(a).head()},We.prototype.findLast=function(a){return this.reverse().find(a)},We.prototype.invokeMap=Ue(function(a,u){return typeof a=="function"?new We(this):this.map(function(h){return ca(h,a,u)})}),We.prototype.reject=function(a){return this.filter(Rh(Ce(a)))},We.prototype.slice=function(a,u){a=Me(a);var h=this;return h.__filtered__&&(a>0||u<0)?new We(h):(a<0?h=h.takeRight(-a):a&&(h=h.drop(a)),u!==t&&(u=Me(u),h=u<0?h.dropRight(-u):h.take(u-a)),h)},We.prototype.takeRightWhile=function(a){return this.reverse().takeWhile(a).reverse()},We.prototype.toArray=function(){return this.take(ke)},Nn(We.prototype,function(a,u){var h=/^(?:filter|find|map|reject)|While$/.test(u),S=/^(?:head|last)$/.test(u),P=$[S?"take"+(u=="last"?"Right":""):u],N=S||/^find/.test(u);P&&($.prototype[u]=function(){var L=this.__wrapped__,B=S?[1]:arguments,z=L instanceof We,X=B[0],ee=z||$e(L),re=function(Qe){var et=P.apply($,Ti([Qe],B));return S&&ue?et[0]:et};ee&&h&&typeof X=="function"&&X.length!=1&&(z=ee=!1);var ue=this.__chain__,be=!!this.__actions__.length,xe=N&&!ue,De=z&&!be;if(!N&&ee){L=De?L:new We(this);var Re=a.apply(L,B);return Re.__actions__.push({func:bh,args:[re],thisArg:t}),new br(Re,ue)}return xe&&De?a.apply(this,B):(Re=this.thru(re),xe?S?Re.value()[0]:Re.value():Re)})}),Tr(["pop","push","shift","sort","splice","unshift"],function(a){var u=Xo[a],h=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",S=/^(?:pop|shift)$/.test(a);$.prototype[a]=function(){var P=arguments;if(S&&!this.__chain__){var N=this.value();return u.apply($e(N)?N:[],P)}return this[h](function(L){return u.apply($e(L)?L:[],P)})}}),Nn(We.prototype,function(a,u){var h=$[u];if(h){var S=h.name+"";pt.call(Ys,S)||(Ys[S]=[]),Ys[S].push({name:u,func:h})}}),Ys[dh(t,v).name]=[{name:"wrapper",func:t}],We.prototype.clone=Gv,We.prototype.reverse=Yv,We.prototype.value=Dc,$.prototype.at=wF,$.prototype.chain=_F,$.prototype.commit=RF,$.prototype.next=CF,$.prototype.plant=EF,$.prototype.reverse=qF,$.prototype.toJSON=$.prototype.valueOf=$.prototype.value=OF,$.prototype.first=$.prototype.head,ra&&($.prototype[ra]=xF),$}),Ni=kv();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Xt._=Ni,define(function(){return Ni})):dt?((dt.exports=Ni)._=Ni,Sl._=Ni):Xt._=Ni}).call(tu)});var _q=V((pS,ru)=>{(function(t,e){typeof pS=="object"&&typeof ru<"u"?ru.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(pS,(function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(f){t=f}function n(f){return f instanceof Array||Object.prototype.toString.call(f)==="[object Array]"}function i(f){return f!=null&&Object.prototype.toString.call(f)==="[object Object]"}function s(f,g){return Object.prototype.hasOwnProperty.call(f,g)}function o(f){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(f).length===0;var g;for(g in f)if(s(f,g))return!1;return!0}function l(f){return f===void 0}function c(f){return typeof f=="number"||Object.prototype.toString.call(f)==="[object Number]"}function d(f){return f instanceof Date||Object.prototype.toString.call(f)==="[object Date]"}function p(f,g){var w=[],x,T=f.length;for(x=0;x<T;++x)w.push(g(f[x],x));return w}function m(f,g){for(var w in g)s(g,w)&&(f[w]=g[w]);return s(g,"toString")&&(f.toString=g.toString),s(g,"valueOf")&&(f.valueOf=g.valueOf),f}function y(f,g,w,x){return El(f,g,w,x,!0).utc()}function b(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function q(f){return f._pf==null&&(f._pf=b()),f._pf}var C;Array.prototype.some?C=Array.prototype.some:C=function(f){var g=Object(this),w=g.length>>>0,x;for(x=0;x<w;x++)if(x in g&&f.call(this,g[x],x,g))return!0;return!1};function v(f){var g=null,w=!1,x=f._d&&!isNaN(f._d.getTime());if(x&&(g=q(f),w=C.call(g.parsedDateParts,function(T){return T!=null}),x=g.overflow<0&&!g.empty&&!g.invalidEra&&!g.invalidMonth&&!g.invalidWeekday&&!g.weekdayMismatch&&!g.nullInput&&!g.invalidFormat&&!g.userInvalidated&&(!g.meridiem||g.meridiem&&w),f._strict&&(x=x&&g.charsLeftOver===0&&g.unusedTokens.length===0&&g.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(f))f._isValid=x;else return x;return f._isValid}function _(f){var g=y(NaN);return f!=null?m(q(g),f):q(g).userInvalidated=!0,g}var E=e.momentProperties=[],k=!1;function O(f,g){var w,x,T,H=E.length;if(l(g._isAMomentObject)||(f._isAMomentObject=g._isAMomentObject),l(g._i)||(f._i=g._i),l(g._f)||(f._f=g._f),l(g._l)||(f._l=g._l),l(g._strict)||(f._strict=g._strict),l(g._tzm)||(f._tzm=g._tzm),l(g._isUTC)||(f._isUTC=g._isUTC),l(g._offset)||(f._offset=g._offset),l(g._pf)||(f._pf=q(g)),l(g._locale)||(f._locale=g._locale),H>0)for(w=0;w<H;w++)x=E[w],T=g[x],l(T)||(f[x]=T);return f}function M(f){O(this,f),this._d=new Date(f._d!=null?f._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),k===!1&&(k=!0,e.updateOffset(this),k=!1)}function j(f){return f instanceof M||f!=null&&f._isAMomentObject!=null}function I(f){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+f)}function R(f,g){var w=!0;return m(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,f),w){var x=[],T,H,K,fe=arguments.length;for(H=0;H<fe;H++){if(T="",typeof arguments[H]=="object"){T+=`
|
|
21
21
|
[`+H+"] ";for(K in arguments[0])s(arguments[0],K)&&(T+=K+": "+arguments[0][K]+", ");T=T.slice(0,-2)}else T=arguments[H];x.push(T)}I(f+`
|
|
22
22
|
Arguments: `+Array.prototype.slice.call(x).join("")+`
|
|
23
|
-
`+new Error().stack),w=!1}return g.apply(this,arguments)},g)}var A={};function F(f,g){e.deprecationHandler!=null&&e.deprecationHandler(f,g),A[f]||(I(g),A[f]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function U(f){return typeof Function<"u"&&f instanceof Function||Object.prototype.toString.call(f)==="[object Function]"}function D(f){var g,w;for(w in f)s(f,w)&&(g=f[w],U(g)?this[w]=g:this["_"+w]=g);this._config=f,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function J(f,g){var w=m({},f),x;for(x in g)s(g,x)&&(i(f[x])&&i(g[x])?(w[x]={},m(w[x],f[x]),m(w[x],g[x])):g[x]!=null?w[x]=g[x]:delete w[x]);for(x in f)s(f,x)&&!s(g,x)&&i(f[x])&&(w[x]=m({},w[x]));return w}function Q(f){f!=null&&this.set(f)}var se;Object.keys?se=Object.keys:se=function(f){var g,w=[];for(g in f)s(f,g)&&w.push(g);return w};var ce={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function Be(f,g,w){var x=this._calendar[f]||this._calendar.sameElse;return U(x)?x.call(g,w):x}function _e(f,g,w){var x=""+Math.abs(f),T=g-x.length,H=f>=0;return(H?w?"+":"":"-")+Math.pow(10,Math.max(0,T)).toString().substr(1)+x}var me=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,ke=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,mt={},Nt={};function pe(f,g,w,x){var T=x;typeof x=="string"&&(T=function(){return this[x]()}),f&&(Nt[f]=T),g&&(Nt[g[0]]=function(){return _e(T.apply(this,arguments),g[1],g[2])}),w&&(Nt[w]=function(){return this.localeData().ordinal(T.apply(this,arguments),f)})}function Gt(f){return f.match(/\[[\s\S]/)?f.replace(/^\[|\]$/g,""):f.replace(/\\/g,"")}function Pr(f){var g=f.match(me),w,x;for(w=0,x=g.length;w<x;w++)Nt[g[w]]?g[w]=Nt[g[w]]:g[w]=Gt(g[w]);return function(T){var H="",K;for(K=0;K<x;K++)H+=U(g[K])?g[K].call(T,f):g[K];return H}}function lt(f,g){return f.isValid()?(g=kr(g,f.localeData()),mt[g]=mt[g]||Pr(g),mt[g](f)):f.localeData().invalidDate()}function kr(f,g){var w=5;function x(T){return g.longDateFormat(T)||T}for(ke.lastIndex=0;w>=0&&ke.test(f);)f=f.replace(ke,x),ke.lastIndex=0,w-=1;return f}var vr={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Ct(f){var g=this._longDateFormat[f],w=this._longDateFormat[f.toUpperCase()];return g||!w?g:(this._longDateFormat[f]=w.match(me).map(function(x){return x==="MMMM"||x==="MM"||x==="DD"||x==="dddd"?x.slice(1):x}).join(""),this._longDateFormat[f])}var St="Invalid date";function Wr(){return this._invalidDate}var Ms="%d",At=/\d{1,2}/;function Pi(f){return this._ordinal.replace("%d",f)}var En={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function te(f,g,w,x){var T=this._relativeTime[w];return U(T)?T(f,g,w,x):T.replace(/%d/i,f)}function ne(f,g){var w=this._relativeTime[f>0?"future":"past"];return U(w)?w(g):w.replace(/%s/i,g)}var Ie={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ye(f){return typeof f=="string"?Ie[f]||Ie[f.toLowerCase()]:void 0}function ve(f){var g={},w,x;for(x in f)s(f,x)&&(w=ye(x),w&&(g[w]=f[x]));return g}var Ye={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function ur(f){var g=[],w;for(w in f)s(f,w)&&g.push({unit:w,priority:Ye[w]});return g.sort(function(x,T){return x.priority-T.priority}),g}var Ae=/\d/,ge=/\d\d/,qn=/\d{3}/,fn=/\d{4}/,gt=/[+-]?\d{6}/,Ee=/\d\d?/,On=/\d\d\d\d?/,cl=/\d\d\d\d\d\d?/,Fs=/\d{1,3}/,Uo=/\d{1,4}/,Ds=/[+-]?\d{1,6}/,ki=/\d+/,js=/[+-]?\d+/,mc=/Z|[+-]\d\d:?\d\d/gi,fl=/Z|[+-]\d\d(?::?\d\d)?/gi,Ly=/[+-]?\d+(\.\d{1,3})?/,Ho=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,ts=/^[1-9]\d?/,dl=/^([1-9]\d|\d)/,pl;pl={};function he(f,g,w){pl[f]=U(g)?g:function(x,T){return x&&w?w:g}}function Uy(f,g){return s(pl,f)?pl[f](g._strict,g._locale):new RegExp(Hy(f))}function Hy(f){return In(f.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(g,w,x,T,H){return w||x||T||H}))}function In(f){return f.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function zr(f){return f<0?Math.ceil(f)||0:Math.floor(f)}function Ve(f){var g=+f,w=0;return g!==0&&isFinite(g)&&(w=zr(g)),w}var gc={};function ft(f,g){var w,x=g,T;for(typeof f=="string"&&(f=[f]),c(g)&&(x=function(H,K){K[g]=Ve(H)}),T=f.length,w=0;w<T;w++)gc[f[w]]=x}function Bo(f,g){ft(f,function(w,x,T,H){T._w=T._w||{},g(w,T._w,T,H)})}function yc(f,g,w){g!=null&&s(gc,f)&&gc[f](g,w._a,w,f)}function hl(f){return f%4===0&&f%100!==0||f%400===0}var cr=0,Kn=1,Pn=2,Yt=3,Jr=4,Qn=5,rs=6,mp=7,By=8;pe("Y",0,0,function(){var f=this.year();return f<=9999?_e(f,4):"+"+f}),pe(0,["YY",2],0,function(){return this.year()%100}),pe(0,["YYYY",4],0,"year"),pe(0,["YYYYY",5],0,"year"),pe(0,["YYYYYY",6,!0],0,"year"),he("Y",js),he("YY",Ee,ge),he("YYYY",Uo,fn),he("YYYYY",Ds,gt),he("YYYYYY",Ds,gt),ft(["YYYYY","YYYYYY"],cr),ft("YYYY",function(f,g){g[cr]=f.length===2?e.parseTwoDigitYear(f):Ve(f)}),ft("YY",function(f,g){g[cr]=e.parseTwoDigitYear(f)}),ft("Y",function(f,g){g[cr]=parseInt(f,10)});function Vo(f){return hl(f)?366:365}e.parseTwoDigitYear=function(f){return Ve(f)+(Ve(f)>68?1900:2e3)};var gp=Ls("FullYear",!0);function Vy(){return hl(this.year())}function Ls(f,g){return function(w){return w!=null?(zo(this,f,w),e.updateOffset(this,g),this):Wo(this,f)}}function Wo(f,g){if(!f.isValid())return NaN;var w=f._d,x=f._isUTC;switch(g){case"Milliseconds":return x?w.getUTCMilliseconds():w.getMilliseconds();case"Seconds":return x?w.getUTCSeconds():w.getSeconds();case"Minutes":return x?w.getUTCMinutes():w.getMinutes();case"Hours":return x?w.getUTCHours():w.getHours();case"Date":return x?w.getUTCDate():w.getDate();case"Day":return x?w.getUTCDay():w.getDay();case"Month":return x?w.getUTCMonth():w.getMonth();case"FullYear":return x?w.getUTCFullYear():w.getFullYear();default:return NaN}}function zo(f,g,w){var x,T,H,K,fe;if(!(!f.isValid()||isNaN(w))){switch(x=f._d,T=f._isUTC,g){case"Milliseconds":return void(T?x.setUTCMilliseconds(w):x.setMilliseconds(w));case"Seconds":return void(T?x.setUTCSeconds(w):x.setSeconds(w));case"Minutes":return void(T?x.setUTCMinutes(w):x.setMinutes(w));case"Hours":return void(T?x.setUTCHours(w):x.setHours(w));case"Date":return void(T?x.setUTCDate(w):x.setDate(w));case"FullYear":break;default:return}H=w,K=f.month(),fe=f.date(),fe=fe===29&&K===1&&!hl(H)?28:fe,T?x.setUTCFullYear(H,K,fe):x.setFullYear(H,K,fe)}}function Wy(f){return f=ye(f),U(this[f])?this[f]():this}function ml(f,g){if(typeof f=="object"){f=ve(f);var w=ur(f),x,T=w.length;for(x=0;x<T;x++)this[w[x].unit](f[w[x].unit])}else if(f=ye(f),U(this[f]))return this[f](g);return this}function zy(f,g){return(f%g+g)%g}var Lt;Array.prototype.indexOf?Lt=Array.prototype.indexOf:Lt=function(f){var g;for(g=0;g<this.length;++g)if(this[g]===f)return g;return-1};function vc(f,g){if(isNaN(f)||isNaN(g))return NaN;var w=zy(g,12);return f+=(g-w)/12,w===1?hl(f)?29:28:31-w%7%2}pe("M",["MM",2],"Mo",function(){return this.month()+1}),pe("MMM",0,0,function(f){return this.localeData().monthsShort(this,f)}),pe("MMMM",0,0,function(f){return this.localeData().months(this,f)}),he("M",Ee,ts),he("MM",Ee,ge),he("MMM",function(f,g){return g.monthsShortRegex(f)}),he("MMMM",function(f,g){return g.monthsRegex(f)}),ft(["M","MM"],function(f,g){g[Kn]=Ve(f)-1}),ft(["MMM","MMMM"],function(f,g,w,x){var T=w._locale.monthsParse(f,x,w._strict);T!=null?g[Kn]=T:E(w).invalidMonth=f});var yp="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),bc="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Sc=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Jy=Ho,Gy=Ho;function Yy(f,g){return f?n(this._months)?this._months[f.month()]:this._months[(this._months.isFormat||Sc).test(g)?"format":"standalone"][f.month()]:n(this._months)?this._months:this._months.standalone}function Ky(f,g){return f?n(this._monthsShort)?this._monthsShort[f.month()]:this._monthsShort[Sc.test(g)?"format":"standalone"][f.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function vp(f,g,w){var x,T,H,K=f.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],x=0;x<12;++x)H=y([2e3,x]),this._shortMonthsParse[x]=this.monthsShort(H,"").toLocaleLowerCase(),this._longMonthsParse[x]=this.months(H,"").toLocaleLowerCase();return w?g==="MMM"?(T=Lt.call(this._shortMonthsParse,K),T!==-1?T:null):(T=Lt.call(this._longMonthsParse,K),T!==-1?T:null):g==="MMM"?(T=Lt.call(this._shortMonthsParse,K),T!==-1?T:(T=Lt.call(this._longMonthsParse,K),T!==-1?T:null)):(T=Lt.call(this._longMonthsParse,K),T!==-1?T:(T=Lt.call(this._shortMonthsParse,K),T!==-1?T:null))}function bp(f,g,w){var x,T,H;if(this._monthsParseExact)return vp.call(this,f,g,w);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),x=0;x<12;x++){if(T=y([2e3,x]),w&&!this._longMonthsParse[x]&&(this._longMonthsParse[x]=new RegExp("^"+this.months(T,"").replace(".","")+"$","i"),this._shortMonthsParse[x]=new RegExp("^"+this.monthsShort(T,"").replace(".","")+"$","i")),!w&&!this._monthsParse[x]&&(H="^"+this.months(T,"")+"|^"+this.monthsShort(T,""),this._monthsParse[x]=new RegExp(H.replace(".",""),"i")),w&&g==="MMMM"&&this._longMonthsParse[x].test(f))return x;if(w&&g==="MMM"&&this._shortMonthsParse[x].test(f))return x;if(!w&&this._monthsParse[x].test(f))return x}}function wc(f,g){if(!f.isValid())return f;if(typeof g=="string"){if(/^\d+$/.test(g))g=Ve(g);else if(g=f.localeData().monthsParse(g),!c(g))return f}var w=g,x=f.date();return x=x<29?x:Math.min(x,vc(f.year(),w)),f._isUTC?f._d.setUTCMonth(w,x):f._d.setMonth(w,x),f}function gl(f){return f!=null?(wc(this,f),e.updateOffset(this,!0),this):Wo(this,"Month")}function Qy(){return vc(this.year(),this.month())}function Sp(f){return this._monthsParseExact?(s(this,"_monthsRegex")||_c.call(this),f?this._monthsShortStrictRegex:this._monthsShortRegex):(s(this,"_monthsShortRegex")||(this._monthsShortRegex=Jy),this._monthsShortStrictRegex&&f?this._monthsShortStrictRegex:this._monthsShortRegex)}function yl(f){return this._monthsParseExact?(s(this,"_monthsRegex")||_c.call(this),f?this._monthsStrictRegex:this._monthsRegex):(s(this,"_monthsRegex")||(this._monthsRegex=Gy),this._monthsStrictRegex&&f?this._monthsStrictRegex:this._monthsRegex)}function _c(){function f(qe,ze){return ze.length-qe.length}var g=[],w=[],x=[],T,H,K,fe;for(T=0;T<12;T++)H=y([2e3,T]),K=In(this.monthsShort(H,"")),fe=In(this.months(H,"")),g.push(K),w.push(fe),x.push(fe),x.push(K);g.sort(f),w.sort(f),x.sort(f),this._monthsRegex=new RegExp("^("+x.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+w.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+g.join("|")+")","i")}function Zy(f,g,w,x,T,H,K){var fe;return f<100&&f>=0?(fe=new Date(f+400,g,w,x,T,H,K),isFinite(fe.getFullYear())&&fe.setFullYear(f)):fe=new Date(f,g,w,x,T,H,K),fe}function Us(f){var g,w;return f<100&&f>=0?(w=Array.prototype.slice.call(arguments),w[0]=f+400,g=new Date(Date.UTC.apply(null,w)),isFinite(g.getUTCFullYear())&&g.setUTCFullYear(f)):g=new Date(Date.UTC.apply(null,arguments)),g}function Jo(f,g,w){var x=7+g-w,T=(7+Us(f,0,x).getUTCDay()-g)%7;return-T+x-1}function vl(f,g,w,x,T){var H=(7+w-x)%7,K=Jo(f,x,T),fe=1+7*(g-1)+H+K,qe,ze;return fe<=0?(qe=f-1,ze=Vo(qe)+fe):fe>Vo(f)?(qe=f+1,ze=fe-Vo(f)):(qe=f,ze=fe),{year:qe,dayOfYear:ze}}function Go(f,g,w){var x=Jo(f.year(),g,w),T=Math.floor((f.dayOfYear()-x-1)/7)+1,H,K;return T<1?(K=f.year()-1,H=T+kn(K,g,w)):T>kn(f.year(),g,w)?(H=T-kn(f.year(),g,w),K=f.year()+1):(K=f.year(),H=T),{week:H,year:K}}function kn(f,g,w){var x=Jo(f,g,w),T=Jo(f+1,g,w);return(Vo(f)-x+T)/7}pe("w",["ww",2],"wo","week"),pe("W",["WW",2],"Wo","isoWeek"),he("w",Ee,ts),he("ww",Ee,ge),he("W",Ee,ts),he("WW",Ee,ge),Bo(["w","ww","W","WW"],function(f,g,w,x){g[x.substr(0,1)]=Ve(f)});function Rc(f){return Go(f,this._week.dow,this._week.doy).week}var Cc={dow:0,doy:6};function Hs(){return this._week.dow}function wp(){return this._week.doy}function _p(f){var g=this.localeData().week(this);return f==null?g:this.add((f-g)*7,"d")}function Xy(f){var g=Go(this,1,4).week;return f==null?g:this.add((f-g)*7,"d")}pe("d",0,"do","day"),pe("dd",0,0,function(f){return this.localeData().weekdaysMin(this,f)}),pe("ddd",0,0,function(f){return this.localeData().weekdaysShort(this,f)}),pe("dddd",0,0,function(f){return this.localeData().weekdays(this,f)}),pe("e",0,0,"weekday"),pe("E",0,0,"isoWeekday"),he("d",Ee),he("e",Ee),he("E",Ee),he("dd",function(f,g){return g.weekdaysMinRegex(f)}),he("ddd",function(f,g){return g.weekdaysShortRegex(f)}),he("dddd",function(f,g){return g.weekdaysRegex(f)}),Bo(["dd","ddd","dddd"],function(f,g,w,x){var T=w._locale.weekdaysParse(f,x,w._strict);T!=null?g.d=T:E(w).invalidWeekday=f}),Bo(["d","e","E"],function(f,g,w,x){g[x]=Ve(f)});function Rp(f,g){return typeof f!="string"?f:isNaN(f)?(f=g.weekdaysParse(f),typeof f=="number"?f:null):parseInt(f,10)}function Cp(f,g){return typeof f=="string"?g.weekdaysParse(f)%7||7:isNaN(f)?null:f}function bl(f,g){return f.slice(g,7).concat(f.slice(0,g))}var xp="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ep="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),ev="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),tv=Ho,qp=Ho,rv=Ho;function nv(f,g){var w=n(this._weekdays)?this._weekdays:this._weekdays[f&&f!==!0&&this._weekdays.isFormat.test(g)?"format":"standalone"];return f===!0?bl(w,this._week.dow):f?w[f.day()]:w}function iv(f){return f===!0?bl(this._weekdaysShort,this._week.dow):f?this._weekdaysShort[f.day()]:this._weekdaysShort}function sv(f){return f===!0?bl(this._weekdaysMin,this._week.dow):f?this._weekdaysMin[f.day()]:this._weekdaysMin}function xc(f,g,w){var x,T,H,K=f.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],x=0;x<7;++x)H=y([2e3,1]).day(x),this._minWeekdaysParse[x]=this.weekdaysMin(H,"").toLocaleLowerCase(),this._shortWeekdaysParse[x]=this.weekdaysShort(H,"").toLocaleLowerCase(),this._weekdaysParse[x]=this.weekdays(H,"").toLocaleLowerCase();return w?g==="dddd"?(T=Lt.call(this._weekdaysParse,K),T!==-1?T:null):g==="ddd"?(T=Lt.call(this._shortWeekdaysParse,K),T!==-1?T:null):(T=Lt.call(this._minWeekdaysParse,K),T!==-1?T:null):g==="dddd"?(T=Lt.call(this._weekdaysParse,K),T!==-1||(T=Lt.call(this._shortWeekdaysParse,K),T!==-1)?T:(T=Lt.call(this._minWeekdaysParse,K),T!==-1?T:null)):g==="ddd"?(T=Lt.call(this._shortWeekdaysParse,K),T!==-1||(T=Lt.call(this._weekdaysParse,K),T!==-1)?T:(T=Lt.call(this._minWeekdaysParse,K),T!==-1?T:null)):(T=Lt.call(this._minWeekdaysParse,K),T!==-1||(T=Lt.call(this._weekdaysParse,K),T!==-1)?T:(T=Lt.call(this._shortWeekdaysParse,K),T!==-1?T:null))}function ov(f,g,w){var x,T,H;if(this._weekdaysParseExact)return xc.call(this,f,g,w);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),x=0;x<7;x++){if(T=y([2e3,1]).day(x),w&&!this._fullWeekdaysParse[x]&&(this._fullWeekdaysParse[x]=new RegExp("^"+this.weekdays(T,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[x]=new RegExp("^"+this.weekdaysShort(T,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[x]=new RegExp("^"+this.weekdaysMin(T,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[x]||(H="^"+this.weekdays(T,"")+"|^"+this.weekdaysShort(T,"")+"|^"+this.weekdaysMin(T,""),this._weekdaysParse[x]=new RegExp(H.replace(".",""),"i")),w&&g==="dddd"&&this._fullWeekdaysParse[x].test(f))return x;if(w&&g==="ddd"&&this._shortWeekdaysParse[x].test(f))return x;if(w&&g==="dd"&&this._minWeekdaysParse[x].test(f))return x;if(!w&&this._weekdaysParse[x].test(f))return x}}function av(f){if(!this.isValid())return f!=null?this:NaN;var g=Wo(this,"Day");return f!=null?(f=Rp(f,this.localeData()),this.add(f-g,"d")):g}function lv(f){if(!this.isValid())return f!=null?this:NaN;var g=(this.day()+7-this.localeData()._week.dow)%7;return f==null?g:this.add(f-g,"d")}function uv(f){if(!this.isValid())return f!=null?this:NaN;if(f!=null){var g=Cp(f,this.localeData());return this.day(this.day()%7?g:g-7)}else return this.day()||7}function cv(f){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Ec.call(this),f?this._weekdaysStrictRegex:this._weekdaysRegex):(s(this,"_weekdaysRegex")||(this._weekdaysRegex=tv),this._weekdaysStrictRegex&&f?this._weekdaysStrictRegex:this._weekdaysRegex)}function It(f){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Ec.call(this),f?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(s(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=qp),this._weekdaysShortStrictRegex&&f?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Et(f){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Ec.call(this),f?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(s(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=rv),this._weekdaysMinStrictRegex&&f?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ec(){function f(er,ni){return ni.length-er.length}var g=[],w=[],x=[],T=[],H,K,fe,qe,ze;for(H=0;H<7;H++)K=y([2e3,1]).day(H),fe=In(this.weekdaysMin(K,"")),qe=In(this.weekdaysShort(K,"")),ze=In(this.weekdays(K,"")),g.push(fe),w.push(qe),x.push(ze),T.push(fe),T.push(qe),T.push(ze);g.sort(f),w.sort(f),x.sort(f),T.sort(f),this._weekdaysRegex=new RegExp("^("+T.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+x.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+w.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}function qc(){return this.hours()%12||12}function fv(){return this.hours()||24}pe("H",["HH",2],0,"hour"),pe("h",["hh",2],0,qc),pe("k",["kk",2],0,fv),pe("hmm",0,0,function(){return""+qc.apply(this)+_e(this.minutes(),2)}),pe("hmmss",0,0,function(){return""+qc.apply(this)+_e(this.minutes(),2)+_e(this.seconds(),2)}),pe("Hmm",0,0,function(){return""+this.hours()+_e(this.minutes(),2)}),pe("Hmmss",0,0,function(){return""+this.hours()+_e(this.minutes(),2)+_e(this.seconds(),2)});function Op(f,g){pe(f,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),g)})}Op("a",!0),Op("A",!1);function Ip(f,g){return g._meridiemParse}he("a",Ip),he("A",Ip),he("H",Ee,dl),he("h",Ee,ts),he("k",Ee,ts),he("HH",Ee,ge),he("hh",Ee,ge),he("kk",Ee,ge),he("hmm",On),he("hmmss",cl),he("Hmm",On),he("Hmmss",cl),ft(["H","HH"],Yt),ft(["k","kk"],function(f,g,w){var x=Ve(f);g[Yt]=x===24?0:x}),ft(["a","A"],function(f,g,w){w._isPm=w._locale.isPM(f),w._meridiem=f}),ft(["h","hh"],function(f,g,w){g[Yt]=Ve(f),E(w).bigHour=!0}),ft("hmm",function(f,g,w){var x=f.length-2;g[Yt]=Ve(f.substr(0,x)),g[Jr]=Ve(f.substr(x)),E(w).bigHour=!0}),ft("hmmss",function(f,g,w){var x=f.length-4,T=f.length-2;g[Yt]=Ve(f.substr(0,x)),g[Jr]=Ve(f.substr(x,2)),g[Qn]=Ve(f.substr(T)),E(w).bigHour=!0}),ft("Hmm",function(f,g,w){var x=f.length-2;g[Yt]=Ve(f.substr(0,x)),g[Jr]=Ve(f.substr(x))}),ft("Hmmss",function(f,g,w){var x=f.length-4,T=f.length-2;g[Yt]=Ve(f.substr(0,x)),g[Jr]=Ve(f.substr(x,2)),g[Qn]=Ve(f.substr(T))});function dv(f){return(f+"").toLowerCase().charAt(0)==="p"}var Pp=/[ap]\.?m?\.?/i,pv=Ls("Hours",!0);function Xt(f,g,w){return f>11?w?"pm":"PM":w?"am":"AM"}var Sl={calendar:ce,longDateFormat:vr,invalidDate:St,ordinal:Ms,dayOfMonthOrdinalParse:At,relativeTime:En,months:yp,monthsShort:bc,week:Cc,weekdays:xp,weekdaysMin:ev,weekdaysShort:Ep,meridiemParse:Pp},dt={},Bs={},ns;function Gr(f,g){var w,x=Math.min(f.length,g.length);for(w=0;w<x;w+=1)if(f[w]!==g[w])return w;return x}function Oc(f){return f&&f.toLowerCase().replace("_","-")}function kp(f){for(var g=0,w,x,T,H;g<f.length;){for(H=Oc(f[g]).split("-"),w=H.length,x=Oc(f[g+1]),x=x?x.split("-"):null;w>0;){if(T=Yo(H.slice(0,w).join("-")),T)return T;if(x&&x.length>=w&&Gr(H,x)>=w-1)break;w--}g++}return ns}function Ap(f){return!!(f&&f.match("^[^/\\\\]*$"))}function Yo(f){var g=null,w;if(dt[f]===void 0&&typeof ru<"u"&&ru&&ru.exports&&Ap(f))try{g=ns._abbr,w=_t,w("./locale/"+f),Zn(g)}catch{dt[f]=null}return dt[f]}function Zn(f,g){var w;return f&&(l(g)?w=Xn(f):w=wl(f,g),w?ns=w:typeof console<"u"&&console.warn&&console.warn("Locale "+f+" not found. Did you forget to load it?")),ns._abbr}function wl(f,g){if(g!==null){var w,x=Sl;if(g.abbr=f,dt[f]!=null)F("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),x=dt[f]._config;else if(g.parentLocale!=null)if(dt[g.parentLocale]!=null)x=dt[g.parentLocale]._config;else if(w=Yo(g.parentLocale),w!=null)x=w._config;else return Bs[g.parentLocale]||(Bs[g.parentLocale]=[]),Bs[g.parentLocale].push({name:f,config:g}),null;return dt[f]=new Q(J(x,g)),Bs[f]&&Bs[f].forEach(function(T){wl(T.name,T.config)}),Zn(f),dt[f]}else return delete dt[f],null}function Ar(f,g){if(g!=null){var w,x,T=Sl;dt[f]!=null&&dt[f].parentLocale!=null?dt[f].set(J(dt[f]._config,g)):(x=Yo(f),x!=null&&(T=x._config),g=J(T,g),x==null&&(g.abbr=f),w=new Q(g),w.parentLocale=dt[f],dt[f]=w),Zn(f)}else dt[f]!=null&&(dt[f].parentLocale!=null?(dt[f]=dt[f].parentLocale,f===Zn()&&Zn(f)):dt[f]!=null&&delete dt[f]);return dt[f]}function Xn(f){var g;if(f&&f._locale&&f._locale._abbr&&(f=f._locale._abbr),!f)return ns;if(!n(f)){if(g=Yo(f),g)return g;f=[f]}return kp(f)}function Tr(){return se(dt)}function Ic(f){var g,w=f._a;return w&&E(f).overflow===-2&&(g=w[Kn]<0||w[Kn]>11?Kn:w[Pn]<1||w[Pn]>vc(w[cr],w[Kn])?Pn:w[Yt]<0||w[Yt]>24||w[Yt]===24&&(w[Jr]!==0||w[Qn]!==0||w[rs]!==0)?Yt:w[Jr]<0||w[Jr]>59?Jr:w[Qn]<0||w[Qn]>59?Qn:w[rs]<0||w[rs]>999?rs:-1,E(f)._overflowDayOfYear&&(g<cr||g>Pn)&&(g=Pn),E(f)._overflowWeeks&&g===-1&&(g=mp),E(f)._overflowWeekday&&g===-1&&(g=By),E(f).overflow=g),f}var Tp=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ai=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_l=/Z|[+-]\d\d(?::?\d\d)?/,Vs=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],qt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ti=/^\/?Date\((-?\d+)/i,Pc=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,hv={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Rl(f){var g,w,x=f._i,T=Tp.exec(x)||Ai.exec(x),H,K,fe,qe,ze=Vs.length,er=qt.length;if(T){for(E(f).iso=!0,g=0,w=ze;g<w;g++)if(Vs[g][1].exec(T[1])){K=Vs[g][0],H=Vs[g][2]!==!1;break}if(K==null){f._isValid=!1;return}if(T[3]){for(g=0,w=er;g<w;g++)if(qt[g][1].exec(T[3])){fe=(T[2]||" ")+qt[g][0];break}if(fe==null){f._isValid=!1;return}}if(!H&&fe!=null){f._isValid=!1;return}if(T[4])if(_l.exec(T[4]))qe="Z";else{f._isValid=!1;return}f._f=K+(fe||"")+(qe||""),xl(f)}else f._isValid=!1}function mv(f,g,w,x,T,H){var K=[gv(f),bc.indexOf(g),parseInt(w,10),parseInt(x,10),parseInt(T,10)];return H&&K.push(parseInt(H,10)),K}function gv(f){var g=parseInt(f,10);return g<=49?2e3+g:g<=999?1900+g:g}function yv(f){return f.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function $p(f,g,w){if(f){var x=Ep.indexOf(f),T=new Date(g[0],g[1],g[2]).getDay();if(x!==T)return E(w).weekdayMismatch=!0,w._isValid=!1,!1}return!0}function Cl(f,g,w){if(f)return hv[f];if(g)return 0;var x=parseInt(w,10),T=x%100,H=(x-T)/100;return H*60+T}function is(f){var g=Pc.exec(yv(f._i)),w;if(g){if(w=mv(g[4],g[3],g[2],g[5],g[6],g[7]),!$p(g[1],w,f))return;f._a=w,f._tzm=Cl(g[8],g[9],g[10]),f._d=Us.apply(null,f._a),f._d.setUTCMinutes(f._d.getUTCMinutes()-f._tzm),E(f).rfc2822=!0}else f._isValid=!1}function vv(f){var g=Ti.exec(f._i);if(g!==null){f._d=new Date(+g[1]);return}if(Rl(f),f._isValid===!1)delete f._isValid;else return;if(is(f),f._isValid===!1)delete f._isValid;else return;f._strict?f._isValid=!1:e.createFromInputFallback(f)}e.createFromInputFallback=R("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(f){f._d=new Date(f._i+(f._useUTC?" UTC":""))});function ss(f,g,w){return f??g??w}function Np(f){var g=new Date(e.now());return f._useUTC?[g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()]:[g.getFullYear(),g.getMonth(),g.getDate()]}function Ko(f){var g,w,x=[],T,H,K;if(!f._d){for(T=Np(f),f._w&&f._a[Pn]==null&&f._a[Kn]==null&&kc(f),f._dayOfYear!=null&&(K=ss(f._a[cr],T[cr]),(f._dayOfYear>Vo(K)||f._dayOfYear===0)&&(E(f)._overflowDayOfYear=!0),w=Us(K,0,f._dayOfYear),f._a[Kn]=w.getUTCMonth(),f._a[Pn]=w.getUTCDate()),g=0;g<3&&f._a[g]==null;++g)f._a[g]=x[g]=T[g];for(;g<7;g++)f._a[g]=x[g]=f._a[g]==null?g===2?1:0:f._a[g];f._a[Yt]===24&&f._a[Jr]===0&&f._a[Qn]===0&&f._a[rs]===0&&(f._nextDay=!0,f._a[Yt]=0),f._d=(f._useUTC?Us:Zy).apply(null,x),H=f._useUTC?f._d.getUTCDay():f._d.getDay(),f._tzm!=null&&f._d.setUTCMinutes(f._d.getUTCMinutes()-f._tzm),f._nextDay&&(f._a[Yt]=24),f._w&&typeof f._w.d<"u"&&f._w.d!==H&&(E(f).weekdayMismatch=!0)}}function kc(f){var g,w,x,T,H,K,fe,qe,ze;g=f._w,g.GG!=null||g.W!=null||g.E!=null?(H=1,K=4,w=ss(g.GG,f._a[cr],Go(yt(),1,4).year),x=ss(g.W,1),T=ss(g.E,1),(T<1||T>7)&&(qe=!0)):(H=f._locale._week.dow,K=f._locale._week.doy,ze=Go(yt(),H,K),w=ss(g.gg,f._a[cr],ze.year),x=ss(g.w,ze.week),g.d!=null?(T=g.d,(T<0||T>6)&&(qe=!0)):g.e!=null?(T=g.e+H,(g.e<0||g.e>6)&&(qe=!0)):T=H),x<1||x>kn(w,H,K)?E(f)._overflowWeeks=!0:qe!=null?E(f)._overflowWeekday=!0:(fe=vl(w,x,T,H,K),f._a[cr]=fe.year,f._dayOfYear=fe.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function xl(f){if(f._f===e.ISO_8601){Rl(f);return}if(f._f===e.RFC_2822){is(f);return}f._a=[],E(f).empty=!0;var g=""+f._i,w,x,T,H,K,fe=g.length,qe=0,ze,er;for(T=kr(f._f,f._locale).match(me)||[],er=T.length,w=0;w<er;w++)H=T[w],x=(g.match(Uy(H,f))||[])[0],x&&(K=g.substr(0,g.indexOf(x)),K.length>0&&E(f).unusedInput.push(K),g=g.slice(g.indexOf(x)+x.length),qe+=x.length),Nt[H]?(x?E(f).empty=!1:E(f).unusedTokens.push(H),yc(H,x,f)):f._strict&&!x&&E(f).unusedTokens.push(H);E(f).charsLeftOver=fe-qe,g.length>0&&E(f).unusedInput.push(g),f._a[Yt]<=12&&E(f).bigHour===!0&&f._a[Yt]>0&&(E(f).bigHour=void 0),E(f).parsedDateParts=f._a.slice(0),E(f).meridiem=f._meridiem,f._a[Yt]=bv(f._locale,f._a[Yt],f._meridiem),ze=E(f).era,ze!==null&&(f._a[cr]=f._locale.erasConvertYear(ze,f._a[cr])),Ko(f),Ic(f)}function bv(f,g,w){var x;return w==null?g:f.meridiemHour!=null?f.meridiemHour(g,w):(f.isPM!=null&&(x=f.isPM(w),x&&g<12&&(g+=12),!x&&g===12&&(g=0)),g)}function Ac(f){var g,w,x,T,H,K,fe=!1,qe=f._f.length;if(qe===0){E(f).invalidFormat=!0,f._d=new Date(NaN);return}for(T=0;T<qe;T++)H=0,K=!1,g=O({},f),f._useUTC!=null&&(g._useUTC=f._useUTC),g._f=f._f[T],xl(g),v(g)&&(K=!0),H+=E(g).charsLeftOver,H+=E(g).unusedTokens.length*10,E(g).score=H,fe?H<x&&(x=H,w=g):(x==null||H<x||K)&&(x=H,w=g,K&&(fe=!0));m(f,w||g)}function Tc(f){if(!f._d){var g=ve(f._i),w=g.day===void 0?g.date:g.day;f._a=p([g.year,g.month,w,g.hour,g.minute,g.second,g.millisecond],function(x){return x&&parseInt(x,10)}),Ko(f)}}function Sv(f){var g=new M(Ic($c(f)));return g._nextDay&&(g.add(1,"d"),g._nextDay=void 0),g}function $c(f){var g=f._i,w=f._f;return f._locale=f._locale||Xn(f._l),g===null||w===void 0&&g===""?_({nullInput:!0}):(typeof g=="string"&&(f._i=g=f._locale.preparse(g)),j(g)?new M(Ic(g)):(d(g)?f._d=g:n(w)?Ac(f):w?xl(f):$r(f),v(f)||(f._d=null),f))}function $r(f){var g=f._i;l(g)?f._d=new Date(e.now()):d(g)?f._d=new Date(g.valueOf()):typeof g=="string"?vv(f):n(g)?(f._a=p(g.slice(0),function(w){return parseInt(w,10)}),Ko(f)):i(g)?Tc(f):c(g)?f._d=new Date(g):e.createFromInputFallback(f)}function El(f,g,w,x,T){var H={};return(g===!0||g===!1)&&(x=g,g=void 0),(w===!0||w===!1)&&(x=w,w=void 0),(i(f)&&o(f)||n(f)&&f.length===0)&&(f=void 0),H._isAMomentObject=!0,H._useUTC=H._isUTC=T,H._l=w,H._i=f,H._f=g,H._strict=x,Sv(H)}function yt(f,g,w,x){return El(f,g,w,x,!1)}var Mp=R("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var f=yt.apply(null,arguments);return this.isValid()&&f.isValid()?f<this?this:f:_()}),Fp=R("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var f=yt.apply(null,arguments);return this.isValid()&&f.isValid()?f>this?this:f:_()});function Dp(f,g){var w,x;if(g.length===1&&n(g[0])&&(g=g[0]),!g.length)return yt();for(w=g[0],x=1;x<g.length;++x)(!g[x].isValid()||g[x][f](w))&&(w=g[x]);return w}function wv(){var f=[].slice.call(arguments,0);return Dp("isBefore",f)}function _v(){var f=[].slice.call(arguments,0);return Dp("isAfter",f)}var Rv=function(){return Date.now?Date.now():+new Date},Qo=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ws(f){var g,w=!1,x,T=Qo.length;for(g in f)if(s(f,g)&&!(Lt.call(Qo,g)!==-1&&(f[g]==null||!isNaN(f[g]))))return!1;for(x=0;x<T;++x)if(f[Qo[x]]){if(w)return!1;parseFloat(f[Qo[x]])!==Ve(f[Qo[x]])&&(w=!0)}return!0}function Cv(){return this._isValid}function xv(){return vt(NaN)}function zs(f){var g=ve(f),w=g.year||0,x=g.quarter||0,T=g.month||0,H=g.week||g.isoWeek||0,K=g.day||0,fe=g.hour||0,qe=g.minute||0,ze=g.second||0,er=g.millisecond||0;this._isValid=Ws(g),this._milliseconds=+er+ze*1e3+qe*6e4+fe*1e3*60*60,this._days=+K+H*7,this._months=+T+x*3+w*12,this._data={},this._locale=Xn(),this._bubble()}function Zo(f){return f instanceof zs}function An(f){return f<0?Math.round(-1*f)*-1:Math.round(f)}function ql(f,g,w){var x=Math.min(f.length,g.length),T=Math.abs(f.length-g.length),H=0,K;for(K=0;K<x;K++)(w&&f[K]!==g[K]||!w&&Ve(f[K])!==Ve(g[K]))&&H++;return H+T}function jp(f,g){pe(f,0,0,function(){var w=this.utcOffset(),x="+";return w<0&&(w=-w,x="-"),x+_e(~~(w/60),2)+g+_e(~~w%60,2)})}jp("Z",":"),jp("ZZ",""),he("Z",fl),he("ZZ",fl),ft(["Z","ZZ"],function(f,g,w){w._useUTC=!0,w._tzm=Nc(fl,f)});var Ev=/([\+\-]|\d\d)/gi;function Nc(f,g){var w=(g||"").match(f),x,T,H;return w===null?null:(x=w[w.length-1]||[],T=(x+"").match(Ev)||["-",0,0],H=+(T[1]*60)+Ve(T[2]),H===0?0:T[0]==="+"?H:-H)}function $i(f,g){var w,x;return g._isUTC?(w=g.clone(),x=(j(f)||d(f)?f.valueOf():yt(f).valueOf())-w.valueOf(),w._d.setTime(w._d.valueOf()+x),e.updateOffset(w,!1),w):yt(f).local()}function Nr(f){return-Math.round(f._d.getTimezoneOffset())}e.updateOffset=function(){};function Lp(f,g,w){var x=this._offset||0,T;if(!this.isValid())return f!=null?this:NaN;if(f!=null){if(typeof f=="string"){if(f=Nc(fl,f),f===null)return this}else Math.abs(f)<16&&!w&&(f=f*60);return!this._isUTC&&g&&(T=Nr(this)),this._offset=f,this._isUTC=!0,T!=null&&this.add(T,"m"),x!==f&&(!g||this._changeInProgress?Xo(this,vt(f-x,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?x:Nr(this)}function qv(f,g){return f!=null?(typeof f!="string"&&(f=-f),this.utcOffset(f,g),this):-this.utcOffset()}function Ov(f){return this.utcOffset(0,f)}function Iv(f){return this._isUTC&&(this.utcOffset(0,f),this._isUTC=!1,f&&this.subtract(Nr(this),"m")),this}function Pv(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var f=Nc(mc,this._i);f!=null?this.utcOffset(f):this.utcOffset(0,!0)}return this}function kv(f){return this.isValid()?(f=f?yt(f).utcOffset():0,(this.utcOffset()-f)%60===0):!1}function Ni(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function W(){if(!l(this._isDSTShifted))return this._isDSTShifted;var f={},g;return O(f,this),f=$c(f),f._a?(g=f._isUTC?y(f._a):yt(f._a),this._isDSTShifted=this.isValid()&&ql(f._a,g.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Z(){return this.isValid()?!this._isUTC:!1}function Y(){return this.isValid()?this._isUTC:!1}function de(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Oe=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,ut=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function vt(f,g){var w=f,x=null,T,H,K;return Zo(f)?w={ms:f._milliseconds,d:f._days,M:f._months}:c(f)||!isNaN(+f)?(w={},g?w[g]=+f:w.milliseconds=+f):(x=Oe.exec(f))?(T=x[1]==="-"?-1:1,w={y:0,d:Ve(x[Pn])*T,h:Ve(x[Yt])*T,m:Ve(x[Jr])*T,s:Ve(x[Qn])*T,ms:Ve(An(x[rs]*1e3))*T}):(x=ut.exec(f))?(T=x[1]==="-"?-1:1,w={y:Xe(x[2],T),M:Xe(x[3],T),w:Xe(x[4],T),d:Xe(x[5],T),h:Xe(x[6],T),m:Xe(x[7],T),s:Xe(x[8],T)}):w==null?w={}:typeof w=="object"&&("from"in w||"to"in w)&&(K=Av(yt(w.from),yt(w.to)),w={},w.ms=K.milliseconds,w.M=K.months),H=new zs(w),Zo(f)&&s(f,"_locale")&&(H._locale=f._locale),Zo(f)&&s(f,"_isValid")&&(H._isValid=f._isValid),H}vt.fn=zs.prototype,vt.invalid=xv;function Xe(f,g){var w=f&&parseFloat(f.replace(",","."));return(isNaN(w)?0:w)*g}function Ol(f,g){var w={};return w.months=g.month()-f.month()+(g.year()-f.year())*12,f.clone().add(w.months,"M").isAfter(g)&&--w.months,w.milliseconds=+g-+f.clone().add(w.months,"M"),w}function Av(f,g){var w;return f.isValid()&&g.isValid()?(g=$i(g,f),f.isBefore(g)?w=Ol(f,g):(w=Ol(g,f),w.milliseconds=-w.milliseconds,w.months=-w.months),w):{milliseconds:0,months:0}}function Mr(f,g){return function(w,x){var T,H;return x!==null&&!isNaN(+x)&&(F(g,"moment()."+g+"(period, number) is deprecated. Please use moment()."+g+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),H=w,w=x,x=H),T=vt(w,x),Xo(this,T,f),this}}function Xo(f,g,w,x){var T=g._milliseconds,H=An(g._days),K=An(g._months);f.isValid()&&(x=x??!0,K&&wc(f,Wo(f,"Month")+K*w),H&&zo(f,"Date",Wo(f,"Date")+H*w),T&&f._d.setTime(f._d.valueOf()+T*w),x&&e.updateOffset(f,H||K))}var Tv=Mr(1,"add"),Js=Mr(-1,"subtract");function ea(f){return typeof f=="string"||f instanceof String}function Il(f){return j(f)||d(f)||ea(f)||c(f)||$v(f)||pt(f)||f===null||f===void 0}function pt(f){var g=i(f)&&!o(f),w=!1,x=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],T,H,K=x.length;for(T=0;T<K;T+=1)H=x[T],w=w||s(f,H);return g&&w}function $v(f){var g=n(f),w=!1;return g&&(w=f.filter(function(x){return!c(x)&&ea(f)}).length===0),g&&w}function Up(f){var g=i(f)&&!o(f),w=!1,x=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],T,H;for(T=0;T<x.length;T+=1)H=x[T],w=w||s(f,H);return g&&w}function Pl(f,g){var w=f.diff(g,"days",!0);return w<-6?"sameElse":w<-1?"lastWeek":w<0?"lastDay":w<1?"sameDay":w<2?"nextDay":w<7?"nextWeek":"sameElse"}function Nv(f,g){arguments.length===1&&(arguments[0]?Il(arguments[0])?(f=arguments[0],g=void 0):Up(arguments[0])&&(g=arguments[0],f=void 0):(f=void 0,g=void 0));var w=f||yt(),x=$i(w,this).startOf("day"),T=e.calendarFormat(this,x)||"sameElse",H=g&&(U(g[T])?g[T].call(this,w):g[T]);return this.format(H||this.localeData().calendar(T,this,yt(w)))}function Mv(){return new M(this)}function Fv(f,g){var w=j(f)?f:yt(f);return this.isValid()&&w.isValid()?(g=ye(g)||"millisecond",g==="millisecond"?this.valueOf()>w.valueOf():w.valueOf()<this.clone().startOf(g).valueOf()):!1}function kl(f,g){var w=j(f)?f:yt(f);return this.isValid()&&w.isValid()?(g=ye(g)||"millisecond",g==="millisecond"?this.valueOf()<w.valueOf():this.clone().endOf(g).valueOf()<w.valueOf()):!1}function Mi(f,g,w,x){var T=j(f)?f:yt(f),H=j(g)?g:yt(g);return this.isValid()&&T.isValid()&&H.isValid()?(x=x||"()",(x[0]==="("?this.isAfter(T,w):!this.isBefore(T,w))&&(x[1]===")"?this.isBefore(H,w):!this.isAfter(H,w))):!1}function Al(f,g){var w=j(f)?f:yt(f),x;return this.isValid()&&w.isValid()?(g=ye(g)||"millisecond",g==="millisecond"?this.valueOf()===w.valueOf():(x=w.valueOf(),this.clone().startOf(g).valueOf()<=x&&x<=this.clone().endOf(g).valueOf())):!1}function Hp(f,g){return this.isSame(f,g)||this.isAfter(f,g)}function Tl(f,g){return this.isSame(f,g)||this.isBefore(f,g)}function Bp(f,g,w){var x,T,H;if(!this.isValid())return NaN;if(x=$i(f,this),!x.isValid())return NaN;switch(T=(x.utcOffset()-this.utcOffset())*6e4,g=ye(g),g){case"year":H=ta(this,x)/12;break;case"month":H=ta(this,x);break;case"quarter":H=ta(this,x)/3;break;case"second":H=(this-x)/1e3;break;case"minute":H=(this-x)/6e4;break;case"hour":H=(this-x)/36e5;break;case"day":H=(this-x-T)/864e5;break;case"week":H=(this-x-T)/6048e5;break;default:H=this-x}return w?H:zr(H)}function ta(f,g){if(f.date()<g.date())return-ta(g,f);var w=(g.year()-f.year())*12+(g.month()-f.month()),x=f.clone().add(w,"months"),T,H;return g-x<0?(T=f.clone().add(w-1,"months"),H=(g-x)/(x-T)):(T=f.clone().add(w+1,"months"),H=(g-x)/(T-x)),-(w+H)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function $l(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function Vp(f){if(!this.isValid())return null;var g=f!==!0,w=g?this.clone().utc():this;return w.year()<0||w.year()>9999?lt(w,g?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):U(Date.prototype.toISOString)?g?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",lt(w,"Z")):lt(w,g?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function ra(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var f="moment",g="",w,x,T,H;return this.isLocal()||(f=this.utcOffset()===0?"moment.utc":"moment.parseZone",g="Z"),w="["+f+'("]',x=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",T="-MM-DD[T]HH:mm:ss.SSS",H=g+'[")]',this.format(w+x+T+H)}function os(f){f||(f=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var g=lt(this,f);return this.localeData().postformat(g)}function Nl(f,g){return this.isValid()&&(j(f)&&f.isValid()||yt(f).isValid())?vt({to:this,from:f}).locale(this.locale()).humanize(!g):this.localeData().invalidDate()}function Dv(f){return this.from(yt(),f)}function jv(f,g){return this.isValid()&&(j(f)&&f.isValid()||yt(f).isValid())?vt({from:this,to:f}).locale(this.locale()).humanize(!g):this.localeData().invalidDate()}function Lv(f){return this.to(yt(),f)}function na(f){var g;return f===void 0?this._locale._abbr:(g=Xn(f),g!=null&&(this._locale=g),this)}var ia=R("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(f){return f===void 0?this.localeData():this.locale(f)});function Ml(){return this._locale}var Fl=1e3,as=60*Fl,Dl=60*as,Wp=(365*400+97)*24*Dl;function Tt(f,g){return(f%g+g)%g}function ir(f,g,w){return f<100&&f>=0?new Date(f+400,g,w)-Wp:new Date(f,g,w).valueOf()}function zp(f,g,w){return f<100&&f>=0?Date.UTC(f+400,g,w)-Wp:Date.UTC(f,g,w)}function Uv(f){var g,w;if(f=ye(f),f===void 0||f==="millisecond"||!this.isValid())return this;switch(w=this._isUTC?zp:ir,f){case"year":g=w(this.year(),0,1);break;case"quarter":g=w(this.year(),this.month()-this.month()%3,1);break;case"month":g=w(this.year(),this.month(),1);break;case"week":g=w(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":g=w(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":g=w(this.year(),this.month(),this.date());break;case"hour":g=this._d.valueOf(),g-=Tt(g+(this._isUTC?0:this.utcOffset()*as),Dl);break;case"minute":g=this._d.valueOf(),g-=Tt(g,as);break;case"second":g=this._d.valueOf(),g-=Tt(g,Fl);break}return this._d.setTime(g),e.updateOffset(this,!0),this}function Jp(f){var g,w;if(f=ye(f),f===void 0||f==="millisecond"||!this.isValid())return this;switch(w=this._isUTC?zp:ir,f){case"year":g=w(this.year()+1,0,1)-1;break;case"quarter":g=w(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":g=w(this.year(),this.month()+1,1)-1;break;case"week":g=w(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":g=w(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":g=w(this.year(),this.month(),this.date()+1)-1;break;case"hour":g=this._d.valueOf(),g+=Dl-Tt(g+(this._isUTC?0:this.utcOffset()*as),Dl)-1;break;case"minute":g=this._d.valueOf(),g+=as-Tt(g,as)-1;break;case"second":g=this._d.valueOf(),g+=Fl-Tt(g,Fl)-1;break}return this._d.setTime(g),e.updateOffset(this,!0),this}function Hv(){return this._d.valueOf()-(this._offset||0)*6e4}function Mc(){return Math.floor(this.valueOf()/1e3)}function sa(){return new Date(this.valueOf())}function Fc(){var f=this;return[f.year(),f.month(),f.date(),f.hour(),f.minute(),f.second(),f.millisecond()]}function Gs(){var f=this;return{years:f.year(),months:f.month(),date:f.date(),hours:f.hours(),minutes:f.minutes(),seconds:f.seconds(),milliseconds:f.milliseconds()}}function oa(){return this.isValid()?this.toISOString():null}function aa(){return v(this)}function jl(){return m({},E(this))}function Ys(){return E(this).overflow}function Bv(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}pe("N",0,0,"eraAbbr"),pe("NN",0,0,"eraAbbr"),pe("NNN",0,0,"eraAbbr"),pe("NNNN",0,0,"eraName"),pe("NNNNN",0,0,"eraNarrow"),pe("y",["y",1],"yo","eraYear"),pe("y",["yy",2],0,"eraYear"),pe("y",["yyy",3],0,"eraYear"),pe("y",["yyyy",4],0,"eraYear"),he("N",br),he("NN",br),he("NNN",br),he("NNNN",We),he("NNNNN",Gv),ft(["N","NN","NNN","NNNN","NNNNN"],function(f,g,w,x){var T=w._locale.erasParse(f,x,w._strict);T?E(w).era=T:E(w).invalidEra=f}),he("y",ki),he("yy",ki),he("yyy",ki),he("yyyy",ki),he("yo",Yv),ft(["y","yy","yyy","yyyy"],cr),ft(["yo"],function(f,g,w,x){var T;w._locale._eraYearOrdinalRegex&&(T=f.match(w._locale._eraYearOrdinalRegex)),w._locale.eraYearOrdinalParse?g[cr]=w._locale.eraYearOrdinalParse(f,T):g[cr]=parseInt(f,10)});function Vv(f,g){var w,x,T,H=this._eras||Xn("en")._eras;for(w=0,x=H.length;w<x;++w)switch(typeof H[w].since==="string"&&(T=e(H[w].since).startOf("day"),H[w].since=T.valueOf()),typeof H[w].until){case"undefined":H[w].until=1/0;break;case"string":T=e(H[w].until).startOf("day").valueOf(),H[w].until=T.valueOf();break}return H}function Wv(f,g,w){var x,T,H=this.eras(),K,fe,qe;for(f=f.toUpperCase(),x=0,T=H.length;x<T;++x)if(K=H[x].name.toUpperCase(),fe=H[x].abbr.toUpperCase(),qe=H[x].narrow.toUpperCase(),w)switch(g){case"N":case"NN":case"NNN":if(fe===f)return H[x];break;case"NNNN":if(K===f)return H[x];break;case"NNNNN":if(qe===f)return H[x];break}else if([K,fe,qe].indexOf(f)>=0)return H[x]}function zv(f,g){var w=f.since<=f.until?1:-1;return g===void 0?e(f.since).year():e(f.since).year()+(g-f.offset)*w}function Jv(){var f,g,w,x=this.localeData().eras();for(f=0,g=x.length;f<g;++f)if(w=this.clone().startOf("day").valueOf(),x[f].since<=w&&w<=x[f].until||x[f].until<=w&&w<=x[f].since)return x[f].name;return""}function Ll(){var f,g,w,x=this.localeData().eras();for(f=0,g=x.length;f<g;++f)if(w=this.clone().startOf("day").valueOf(),x[f].since<=w&&w<=x[f].until||x[f].until<=w&&w<=x[f].since)return x[f].narrow;return""}function la(){var f,g,w,x=this.localeData().eras();for(f=0,g=x.length;f<g;++f)if(w=this.clone().startOf("day").valueOf(),x[f].since<=w&&w<=x[f].until||x[f].until<=w&&w<=x[f].since)return x[f].abbr;return""}function Gp(){var f,g,w,x,T=this.localeData().eras();for(f=0,g=T.length;f<g;++f)if(w=T[f].since<=T[f].until?1:-1,x=this.clone().startOf("day").valueOf(),T[f].since<=x&&x<=T[f].until||T[f].until<=x&&x<=T[f].since)return(this.year()-e(T[f].since).year())*w+T[f].offset;return this.year()}function $(f){return s(this,"_erasNameRegex")||Dc.call(this),f?this._erasNameRegex:this._erasRegex}function Ks(f){return s(this,"_erasAbbrRegex")||Dc.call(this),f?this._erasAbbrRegex:this._erasRegex}function Ul(f){return s(this,"_erasNarrowRegex")||Dc.call(this),f?this._erasNarrowRegex:this._erasRegex}function br(f,g){return g.erasAbbrRegex(f)}function We(f,g){return g.erasNameRegex(f)}function Gv(f,g){return g.erasNarrowRegex(f)}function Yv(f,g){return g._eraYearOrdinalRegex||ki}function Dc(){var f=[],g=[],w=[],x=[],T,H,K,fe,qe,ze=this.eras();for(T=0,H=ze.length;T<H;++T)K=In(ze[T].name),fe=In(ze[T].abbr),qe=In(ze[T].narrow),g.push(K),f.push(fe),w.push(qe),x.push(K),x.push(fe),x.push(qe);this._erasRegex=new RegExp("^("+x.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+g.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+f.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+w.join("|")+")","i")}pe(0,["gg",2],0,function(){return this.weekYear()%100}),pe(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Tn(f,g){pe(0,[f,f.length],0,g)}Tn("gggg","weekYear"),Tn("ggggg","weekYear"),Tn("GGGG","isoWeekYear"),Tn("GGGGG","isoWeekYear"),he("G",js),he("g",js),he("GG",Ee,ge),he("gg",Ee,ge),he("GGGG",Uo,fn),he("gggg",Uo,fn),he("GGGGG",Ds,gt),he("ggggg",Ds,gt),Bo(["gggg","ggggg","GGGG","GGGGG"],function(f,g,w,x){g[x.substr(0,2)]=Ve(f)}),Bo(["gg","GG"],function(f,g,w,x){g[x]=e.parseTwoDigitYear(f)});function Kv(f){return Yp.call(this,f,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function Qv(f){return Yp.call(this,f,this.isoWeek(),this.isoWeekday(),1,4)}function Zv(){return kn(this.year(),1,4)}function Xv(){return kn(this.isoWeekYear(),1,4)}function eb(){var f=this.localeData()._week;return kn(this.year(),f.dow,f.doy)}function ei(){var f=this.localeData()._week;return kn(this.weekYear(),f.dow,f.doy)}function Yp(f,g,w,x,T){var H;return f==null?Go(this,x,T).year:(H=kn(f,x,T),g>H&&(g=H),tb.call(this,f,g,w,x,T))}function tb(f,g,w,x,T){var H=vl(f,g,w,x,T),K=Us(H.year,0,H.dayOfYear);return this.year(K.getUTCFullYear()),this.month(K.getUTCMonth()),this.date(K.getUTCDate()),this}pe("Q",0,"Qo","quarter"),he("Q",Ae),ft("Q",function(f,g){g[Kn]=(Ve(f)-1)*3});function rb(f){return f==null?Math.ceil((this.month()+1)/3):this.month((f-1)*3+this.month()%3)}pe("D",["DD",2],"Do","date"),he("D",Ee,ts),he("DD",Ee,ge),he("Do",function(f,g){return f?g._dayOfMonthOrdinalParse||g._ordinalParse:g._dayOfMonthOrdinalParseLenient}),ft(["D","DD"],Pn),ft("Do",function(f,g){g[Pn]=Ve(f.match(Ee)[0])});var Kp=Ls("Date",!0);pe("DDD",["DDDD",3],"DDDo","dayOfYear"),he("DDD",Fs),he("DDDD",qn),ft(["DDD","DDDD"],function(f,g,w){w._dayOfYear=Ve(f)});function nb(f){var g=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return f==null?g:this.add(f-g,"d")}pe("m",["mm",2],0,"minute"),he("m",Ee,dl),he("mm",Ee,ge),ft(["m","mm"],Jr);var ti=Ls("Minutes",!1);pe("s",["ss",2],0,"second"),he("s",Ee,dl),he("ss",Ee,ge),ft(["s","ss"],Qn);var ib=Ls("Seconds",!1);pe("S",0,0,function(){return~~(this.millisecond()/100)}),pe(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),pe(0,["SSS",3],0,"millisecond"),pe(0,["SSSS",4],0,function(){return this.millisecond()*10}),pe(0,["SSSSS",5],0,function(){return this.millisecond()*100}),pe(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),pe(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),pe(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),pe(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),he("S",Fs,Ae),he("SS",Fs,ge),he("SSS",Fs,qn);var Fi,Qp;for(Fi="SSSS";Fi.length<=9;Fi+="S")he(Fi,ki);function sb(f,g){g[rs]=Ve(("0."+f)*1e3)}for(Fi="S";Fi.length<=9;Fi+="S")ft(Fi,sb);Qp=Ls("Milliseconds",!1),pe("z",0,0,"zoneAbbr"),pe("zz",0,0,"zoneName");function ob(){return this._isUTC?"UTC":""}function ls(){return this._isUTC?"Coordinated Universal Time":""}var ie=M.prototype;ie.add=Tv,ie.calendar=Nv,ie.clone=Mv,ie.diff=Bp,ie.endOf=Jp,ie.format=os,ie.from=Nl,ie.fromNow=Dv,ie.to=jv,ie.toNow=Lv,ie.get=Wy,ie.invalidAt=Ys,ie.isAfter=Fv,ie.isBefore=kl,ie.isBetween=Mi,ie.isSame=Al,ie.isSameOrAfter=Hp,ie.isSameOrBefore=Tl,ie.isValid=aa,ie.lang=ia,ie.locale=na,ie.localeData=Ml,ie.max=Fp,ie.min=Mp,ie.parsingFlags=jl,ie.set=ml,ie.startOf=Uv,ie.subtract=Js,ie.toArray=Fc,ie.toObject=Gs,ie.toDate=sa,ie.toISOString=Vp,ie.inspect=ra,typeof Symbol<"u"&&Symbol.for!=null&&(ie[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),ie.toJSON=oa,ie.toString=$l,ie.unix=Mc,ie.valueOf=Hv,ie.creationData=Bv,ie.eraName=Jv,ie.eraNarrow=Ll,ie.eraAbbr=la,ie.eraYear=Gp,ie.year=gp,ie.isLeapYear=Vy,ie.weekYear=Kv,ie.isoWeekYear=Qv,ie.quarter=ie.quarters=rb,ie.month=gl,ie.daysInMonth=Qy,ie.week=ie.weeks=_p,ie.isoWeek=ie.isoWeeks=Xy,ie.weeksInYear=eb,ie.weeksInWeekYear=ei,ie.isoWeeksInYear=Zv,ie.isoWeeksInISOWeekYear=Xv,ie.date=Kp,ie.day=ie.days=av,ie.weekday=lv,ie.isoWeekday=uv,ie.dayOfYear=nb,ie.hour=ie.hours=pv,ie.minute=ie.minutes=ti,ie.second=ie.seconds=ib,ie.millisecond=ie.milliseconds=Qp,ie.utcOffset=Lp,ie.utc=Ov,ie.local=Iv,ie.parseZone=Pv,ie.hasAlignedHourOffset=kv,ie.isDST=Ni,ie.isLocal=Z,ie.isUtcOffset=Y,ie.isUtc=de,ie.isUTC=de,ie.zoneAbbr=ob,ie.zoneName=ls,ie.dates=R("dates accessor is deprecated. Use date instead.",Kp),ie.months=R("months accessor is deprecated. Use month instead",gl),ie.years=R("years accessor is deprecated. Use year instead",gp),ie.zone=R("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",qv),ie.isDSTShifted=R("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",W);function ab(f){return yt(f*1e3)}function dn(){return yt.apply(null,arguments).parseZone()}function Zp(f){return f}var rt=Q.prototype;rt.calendar=Be,rt.longDateFormat=Ct,rt.invalidDate=Wr,rt.ordinal=Pi,rt.preparse=Zp,rt.postformat=Zp,rt.relativeTime=te,rt.pastFuture=ne,rt.set=D,rt.eras=Vv,rt.erasParse=Wv,rt.erasConvertYear=zv,rt.erasAbbrRegex=Ks,rt.erasNameRegex=$,rt.erasNarrowRegex=Ul,rt.months=Yy,rt.monthsShort=Ky,rt.monthsParse=bp,rt.monthsRegex=yl,rt.monthsShortRegex=Sp,rt.week=Rc,rt.firstDayOfYear=wp,rt.firstDayOfWeek=Hs,rt.weekdays=nv,rt.weekdaysMin=sv,rt.weekdaysShort=iv,rt.weekdaysParse=ov,rt.weekdaysRegex=cv,rt.weekdaysShortRegex=It,rt.weekdaysMinRegex=Et,rt.isPM=dv,rt.meridiem=Xt;function Hl(f,g,w,x){var T=Xn(),H=y().set(x,g);return T[w](H,f)}function Xp(f,g,w){if(c(f)&&(g=f,f=void 0),f=f||"",g!=null)return Hl(f,g,w,"month");var x,T=[];for(x=0;x<12;x++)T[x]=Hl(f,x,w,"month");return T}function jc(f,g,w,x){typeof f=="boolean"?(c(g)&&(w=g,g=void 0),g=g||""):(g=f,w=g,f=!1,c(g)&&(w=g,g=void 0),g=g||"");var T=Xn(),H=f?T._week.dow:0,K,fe=[];if(w!=null)return Hl(g,(w+H)%7,x,"day");for(K=0;K<7;K++)fe[K]=Hl(g,(K+H)%7,x,"day");return fe}function eh(f,g){return Xp(f,g,"months")}function th(f,g){return Xp(f,g,"monthsShort")}function lb(f,g,w){return jc(f,g,w,"weekdays")}function ub(f,g,w){return jc(f,g,w,"weekdaysShort")}function Lc(f,g,w){return jc(f,g,w,"weekdaysMin")}Zn("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(f){var g=f%10,w=Ve(f%100/10)===1?"th":g===1?"st":g===2?"nd":g===3?"rd":"th";return f+w}}),e.lang=R("moment.lang is deprecated. Use moment.locale instead.",Zn),e.langData=R("moment.langData is deprecated. Use moment.localeData instead.",Xn);var Fr=Math.abs;function Bl(){var f=this._data;return this._milliseconds=Fr(this._milliseconds),this._days=Fr(this._days),this._months=Fr(this._months),f.milliseconds=Fr(f.milliseconds),f.seconds=Fr(f.seconds),f.minutes=Fr(f.minutes),f.hours=Fr(f.hours),f.months=Fr(f.months),f.years=Fr(f.years),this}function rh(f,g,w,x){var T=vt(g,w);return f._milliseconds+=x*T._milliseconds,f._days+=x*T._days,f._months+=x*T._months,f._bubble()}function nh(f,g){return rh(this,f,g,1)}function cb(f,g){return rh(this,f,g,-1)}function pn(f){return f<0?Math.floor(f):Math.ceil(f)}function Uc(){var f=this._milliseconds,g=this._days,w=this._months,x=this._data,T,H,K,fe,qe;return f>=0&&g>=0&&w>=0||f<=0&&g<=0&&w<=0||(f+=pn(Sr(w)+g)*864e5,g=0,w=0),x.milliseconds=f%1e3,T=zr(f/1e3),x.seconds=T%60,H=zr(T/60),x.minutes=H%60,K=zr(H/60),x.hours=K%24,g+=zr(K/24),qe=zr(Di(g)),w+=qe,g-=pn(Sr(qe)),fe=zr(w/12),w%=12,x.days=g,x.months=w,x.years=fe,this}function Di(f){return f*4800/146097}function Sr(f){return f*146097/4800}function fb(f){if(!this.isValid())return NaN;var g,w,x=this._milliseconds;if(f=ye(f),f==="month"||f==="quarter"||f==="year")switch(g=this._days+x/864e5,w=this._months+Di(g),f){case"month":return w;case"quarter":return w/3;case"year":return w/12}else switch(g=this._days+Math.round(Sr(this._months)),f){case"week":return g/7+x/6048e5;case"day":return g+x/864e5;case"hour":return g*24+x/36e5;case"minute":return g*1440+x/6e4;case"second":return g*86400+x/1e3;case"millisecond":return Math.floor(g*864e5)+x;default:throw new Error("Unknown unit "+f)}}function $n(f){return function(){return this.as(f)}}var Hc=$n("ms"),ua=$n("s"),ji=$n("m"),ih=$n("h"),db=$n("d"),Vl=$n("w"),pb=$n("M"),sh=$n("Q"),sr=$n("y"),Bc=Hc;function oh(){return vt(this)}function Nn(f){return f=ye(f),this.isValid()?this[f+"s"]():NaN}function ri(f){return function(){return this.isValid()?this._data[f]:NaN}}var Wl=ri("milliseconds"),us=ri("seconds"),ah=ri("minutes"),dr=ri("hours"),Vc=ri("days"),hb=ri("months"),mb=ri("years");function gb(){return zr(this.days()/7)}var hn=Math.round,Qs={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function ca(f,g,w,x,T){return T.relativeTime(g||1,!!w,f,x)}function lh(f,g,w,x){var T=vt(f).abs(),H=hn(T.as("s")),K=hn(T.as("m")),fe=hn(T.as("h")),qe=hn(T.as("d")),ze=hn(T.as("M")),er=hn(T.as("w")),ni=hn(T.as("y")),ii=H<=w.ss&&["s",H]||H<w.s&&["ss",H]||K<=1&&["m"]||K<w.m&&["mm",K]||fe<=1&&["h"]||fe<w.h&&["hh",fe]||qe<=1&&["d"]||qe<w.d&&["dd",qe];return w.w!=null&&(ii=ii||er<=1&&["w"]||er<w.w&&["ww",er]),ii=ii||ze<=1&&["M"]||ze<w.M&&["MM",ze]||ni<=1&&["y"]||["yy",ni],ii[2]=g,ii[3]=+f>0,ii[4]=x,ca.apply(null,ii)}function yb(f){return f===void 0?hn:typeof f=="function"?(hn=f,!0):!1}function vb(f,g){return Qs[f]===void 0?!1:g===void 0?Qs[f]:(Qs[f]=g,f==="s"&&(Qs.ss=g-1),!0)}function fa(f,g){if(!this.isValid())return this.localeData().invalidDate();var w=!1,x=Qs,T,H;return typeof f=="object"&&(g=f,f=!1),typeof f=="boolean"&&(w=f),typeof g=="object"&&(x=Object.assign({},Qs,g),g.s!=null&&g.ss==null&&(x.ss=g.s-1)),T=this.localeData(),H=lh(this,!w,x,T),w&&(H=T.pastFuture(+this,H)),T.postformat(H)}var Wc=Math.abs;function Zs(f){return(f>0)-(f<0)||+f}function Xs(){if(!this.isValid())return this.localeData().invalidDate();var f=Wc(this._milliseconds)/1e3,g=Wc(this._days),w=Wc(this._months),x,T,H,K,fe=this.asSeconds(),qe,ze,er,ni;return fe?(x=zr(f/60),T=zr(x/60),f%=60,x%=60,H=zr(w/12),w%=12,K=f?f.toFixed(3).replace(/\.?0+$/,""):"",qe=fe<0?"-":"",ze=Zs(this._months)!==Zs(fe)?"-":"",er=Zs(this._days)!==Zs(fe)?"-":"",ni=Zs(this._milliseconds)!==Zs(fe)?"-":"",qe+"P"+(H?ze+H+"Y":"")+(w?ze+w+"M":"")+(g?er+g+"D":"")+(T||x||f?"T":"")+(T?ni+T+"H":"")+(x?ni+x+"M":"")+(f?ni+K+"S":"")):"P0D"}var Ke=zs.prototype;Ke.isValid=Cv,Ke.abs=Bl,Ke.add=nh,Ke.subtract=cb,Ke.as=fb,Ke.asMilliseconds=Hc,Ke.asSeconds=ua,Ke.asMinutes=ji,Ke.asHours=ih,Ke.asDays=db,Ke.asWeeks=Vl,Ke.asMonths=pb,Ke.asQuarters=sh,Ke.asYears=sr,Ke.valueOf=Bc,Ke._bubble=Uc,Ke.clone=oh,Ke.get=Nn,Ke.milliseconds=Wl,Ke.seconds=us,Ke.minutes=ah,Ke.hours=dr,Ke.days=Vc,Ke.weeks=gb,Ke.months=hb,Ke.years=mb,Ke.humanize=fa,Ke.toISOString=Xs,Ke.toString=Xs,Ke.toJSON=Xs,Ke.locale=na,Ke.localeData=Ml,Ke.toIsoString=R("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Xs),Ke.lang=ia,pe("X",0,0,"unix"),pe("x",0,0,"valueOf"),he("x",js),he("X",Ly),ft("X",function(f,g,w){w._d=new Date(parseFloat(f)*1e3)}),ft("x",function(f,g,w){w._d=new Date(Ve(f))});return e.version="2.30.1",r(yt),e.fn=ie,e.min=wv,e.max=_v,e.now=Rv,e.utc=y,e.unix=ab,e.months=eh,e.isDate=d,e.locale=Zn,e.invalid=_,e.duration=vt,e.isMoment=j,e.weekdays=lb,e.parseZone=dn,e.localeData=Xn,e.isDuration=Zo,e.monthsShort=th,e.weekdaysMin=Lc,e.defineLocale=wl,e.updateLocale=Ar,e.locales=Tr,e.weekdaysShort=ub,e.normalizeUnits=ye,e.relativeTimeRounding=yb,e.relativeTimeThreshold=vb,e.calendarFormat=Pl,e.prototype=ie,e.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},e}))});var Cq=V((Rq,Dh)=>{(function(t,e){typeof define=="function"&&define.amd?define([],e):typeof Dh<"u"&&Dh.exports?Dh.exports=e():t.tv4=e()})(Rq,function(){Object.keys||(Object.keys=(function(){var I=Object.prototype.hasOwnProperty,R=!{toString:null}.propertyIsEnumerable("toString"),A=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],F=A.length;return function(U){if(typeof U!="object"&&typeof U!="function"||U===null)throw new TypeError("Object.keys called on non-object");var D=[];for(var J in U)I.call(U,J)&&D.push(J);if(R)for(var Q=0;Q<F;Q++)I.call(U,A[Q])&&D.push(A[Q]);return D}})()),Object.create||(Object.create=(function(){function I(){}return function(R){if(arguments.length!==1)throw new Error("Object.create implementation only accepts one parameter.");return I.prototype=R,new I}})()),Array.isArray||(Array.isArray=function(I){return Object.prototype.toString.call(I)==="[object Array]"}),Array.prototype.indexOf||(Array.prototype.indexOf=function(I){if(this===null)throw new TypeError;var R=Object(this),A=R.length>>>0;if(A===0)return-1;var F=0;if(arguments.length>1&&(F=Number(arguments[1]),F!==F?F=0:F!==0&&F!==1/0&&F!==-1/0&&(F=(F>0||-1)*Math.floor(Math.abs(F)))),F>=A)return-1;for(var U=F>=0?F:Math.max(A-Math.abs(F),0);U<A;U++)if(U in R&&R[U]===I)return U;return-1}),Object.isFrozen||(Object.isFrozen=function(I){for(var R="tv4_test_frozen_key";I.hasOwnProperty(R);)R+=Math.random();try{return I[R]=!0,delete I[R],!1}catch{return!0}});var t={"+":!0,"#":!0,".":!0,"/":!0,";":!0,"?":!0,"&":!0},e={"*":!0};function r(I){return encodeURI(I).replace(/%25[0-9][0-9]/g,function(R){return"%"+R.substring(3)})}function n(I){var R="";t[I.charAt(0)]&&(R=I.charAt(0),I=I.substring(1));var A="",F="",U=!0,D=!1,J=!1;R==="+"?U=!1:R==="."?(F=".",A="."):R==="/"?(F="/",A="/"):R==="#"?(F="#",U=!1):R===";"?(F=";",A=";",D=!0,J=!0):R==="?"?(F="?",A="&",D=!0):R==="&"&&(F="&",A="&",D=!0);for(var Q=[],se=I.split(","),ce=[],Be={},_e=0;_e<se.length;_e++){var me=se[_e],ke=null;if(me.indexOf(":")!==-1){var mt=me.split(":");me=mt[0],ke=parseInt(mt[1],10)}for(var Nt={};e[me.charAt(me.length-1)];)Nt[me.charAt(me.length-1)]=!0,me=me.substring(0,me.length-1);var pe={truncate:ke,name:me,suffices:Nt};ce.push(pe),Be[me]=pe,Q.push(me)}var Gt=function(Pr){for(var lt="",kr=0,vr=0;vr<ce.length;vr++){var Ct=ce[vr],St=Pr(Ct.name);if(St==null||Array.isArray(St)&&St.length===0||typeof St=="object"&&Object.keys(St).length===0){kr++;continue}if(vr===kr?lt+=F:lt+=A||",",Array.isArray(St)){D&&(lt+=Ct.name+"=");for(var Wr=0;Wr<St.length;Wr++)Wr>0&&(lt+=Ct.suffices["*"]&&A||",",Ct.suffices["*"]&&D&&(lt+=Ct.name+"=")),lt+=U?encodeURIComponent(St[Wr]).replace(/!/g,"%21"):r(St[Wr])}else if(typeof St=="object"){D&&!Ct.suffices["*"]&&(lt+=Ct.name+"=");var Ms=!0;for(var At in St)Ms||(lt+=Ct.suffices["*"]&&A||","),Ms=!1,lt+=U?encodeURIComponent(At).replace(/!/g,"%21"):r(At),lt+=Ct.suffices["*"]?"=":",",lt+=U?encodeURIComponent(St[At]).replace(/!/g,"%21"):r(St[At])}else D&&(lt+=Ct.name,(!J||St!=="")&&(lt+="=")),Ct.truncate!=null&&(St=St.substring(0,Ct.truncate)),lt+=U?encodeURIComponent(St).replace(/!/g,"%21"):r(St)}return lt};return Gt.varNames=Q,{prefix:F,substitution:Gt}}function i(I){if(!(this instanceof i))return new i(I);for(var R=I.split("{"),A=[R.shift()],F=[],U=[],D=[];R.length>0;){var J=R.shift(),Q=J.split("}")[0],se=J.substring(Q.length+1),ce=n(Q);U.push(ce.substitution),F.push(ce.prefix),A.push(se),D=D.concat(ce.substitution.varNames)}this.fill=function(Be){for(var _e=A[0],me=0;me<U.length;me++){var ke=U[me];_e+=ke(Be),_e+=A[me+1]}return _e},this.varNames=D,this.template=I}i.prototype={toString:function(){return this.template},fillFromObject:function(I){return this.fill(function(R){return I[R]})}};var s=function(R,A,F,U,D){if(this.missing=[],this.missingMap={},this.formatValidators=R?Object.create(R.formatValidators):{},this.schemas=R?Object.create(R.schemas):{},this.collectMultiple=A,this.errors=[],this.handleError=A?this.collectError:this.returnError,U&&(this.checkRecursive=!0,this.scanned=[],this.scannedFrozen=[],this.scannedFrozenSchemas=[],this.scannedFrozenValidationErrors=[],this.validatedSchemasKey="tv4_validation_id",this.validationErrorsKey="tv4_validation_errors_id"),D&&(this.trackUnknownProperties=!0,this.knownPropertyPaths={},this.unknownPropertyPaths={}),this.errorReporter=F||b("en"),typeof this.errorReporter=="string")throw new Error("debug");if(this.definedKeywords={},R)for(var J in R.definedKeywords)this.definedKeywords[J]=R.definedKeywords[J].slice(0)};s.prototype.defineKeyword=function(I,R){this.definedKeywords[I]=this.definedKeywords[I]||[],this.definedKeywords[I].push(R)},s.prototype.createError=function(I,R,A,F,U,D,J){var Q=new q(I,R,A,F,U);return Q.message=this.errorReporter(Q,D,J),Q},s.prototype.returnError=function(I){return I},s.prototype.collectError=function(I){return I&&this.errors.push(I),null},s.prototype.prefixErrors=function(I,R,A){for(var F=I;F<this.errors.length;F++)this.errors[F]=this.errors[F].prefixWith(R,A);return this},s.prototype.banUnknownProperties=function(I,R){for(var A in this.unknownPropertyPaths){var F=this.createError(E.UNKNOWN_PROPERTY,{path:A},A,"",null,I,R),U=this.handleError(F);if(U)return U}return null},s.prototype.addFormat=function(I,R){if(typeof I=="object"){for(var A in I)this.addFormat(A,I[A]);return this}this.formatValidators[I]=R},s.prototype.resolveRefs=function(I,R){if(I.$ref!==void 0){if(R=R||{},R[I.$ref])return this.createError(E.CIRCULAR_REFERENCE,{urls:Object.keys(R).join(", ")},"","",null,void 0,I);R[I.$ref]=!0,I=this.getSchema(I.$ref,R)}return I},s.prototype.getSchema=function(I,R){var A;if(this.schemas[I]!==void 0)return A=this.schemas[I],this.resolveRefs(A,R);var F=I,U="";if(I.indexOf("#")!==-1&&(U=I.substring(I.indexOf("#")+1),F=I.substring(0,I.indexOf("#"))),typeof this.schemas[F]=="object"){A=this.schemas[F];var D=decodeURIComponent(U);if(D==="")return this.resolveRefs(A,R);if(D.charAt(0)!=="/")return;for(var J=D.split("/").slice(1),Q=0;Q<J.length;Q++){var se=J[Q].replace(/~1/g,"/").replace(/~0/g,"~");if(A[se]===void 0){A=void 0;break}A=A[se]}if(A!==void 0)return this.resolveRefs(A,R)}this.missing[F]===void 0&&(this.missing.push(F),this.missing[F]=F,this.missingMap[F]=F)},s.prototype.searchSchemas=function(I,R){if(Array.isArray(I))for(var A=0;A<I.length;A++)this.searchSchemas(I[A],R);else if(I&&typeof I=="object"){typeof I.id=="string"&&k(R,I.id)&&this.schemas[I.id]===void 0&&(this.schemas[I.id]=I);for(var F in I)if(F!=="enum"){if(typeof I[F]=="object")this.searchSchemas(I[F],R);else if(F==="$ref"){var U=m(I[F]);U&&this.schemas[U]===void 0&&this.missingMap[U]===void 0&&(this.missingMap[U]=U)}}}},s.prototype.addSchema=function(I,R){if(typeof I!="string"||typeof R>"u")if(typeof I=="object"&&typeof I.id=="string")R=I,I=R.id;else return;I===m(I)+"#"&&(I=m(I)),this.schemas[I]=R,delete this.missingMap[I],y(R,I),this.searchSchemas(R,I)},s.prototype.getSchemaMap=function(){var I={};for(var R in this.schemas)I[R]=this.schemas[R];return I},s.prototype.getSchemaUris=function(I){var R=[];for(var A in this.schemas)(!I||I.test(A))&&R.push(A);return R},s.prototype.getMissingUris=function(I){var R=[];for(var A in this.missingMap)(!I||I.test(A))&&R.push(A);return R},s.prototype.dropSchemas=function(){this.schemas={},this.reset()},s.prototype.reset=function(){this.missing=[],this.missingMap={},this.errors=[]},s.prototype.validateAll=function(I,R,A,F,U){var D;if(R=this.resolveRefs(R),R){if(R instanceof q)return this.errors.push(R),R}else return null;var J=this.errors.length,Q,se=null,ce=null;if(this.checkRecursive&&I&&typeof I=="object"){if(D=!this.scanned.length,I[this.validatedSchemasKey]){var Be=I[this.validatedSchemasKey].indexOf(R);if(Be!==-1)return this.errors=this.errors.concat(I[this.validationErrorsKey][Be]),null}if(Object.isFrozen(I)&&(Q=this.scannedFrozen.indexOf(I),Q!==-1)){var _e=this.scannedFrozenSchemas[Q].indexOf(R);if(_e!==-1)return this.errors=this.errors.concat(this.scannedFrozenValidationErrors[Q][_e]),null}if(this.scanned.push(I),Object.isFrozen(I))Q===-1&&(Q=this.scannedFrozen.length,this.scannedFrozen.push(I),this.scannedFrozenSchemas.push([])),se=this.scannedFrozenSchemas[Q].length,this.scannedFrozenSchemas[Q][se]=R,this.scannedFrozenValidationErrors[Q][se]=[];else{if(!I[this.validatedSchemasKey])try{Object.defineProperty(I,this.validatedSchemasKey,{value:[],configurable:!0}),Object.defineProperty(I,this.validationErrorsKey,{value:[],configurable:!0})}catch{I[this.validatedSchemasKey]=[],I[this.validationErrorsKey]=[]}ce=I[this.validatedSchemasKey].length,I[this.validatedSchemasKey][ce]=R,I[this.validationErrorsKey][ce]=[]}}var me=this.errors.length,ke=this.validateBasic(I,R,U)||this.validateNumeric(I,R,U)||this.validateString(I,R,U)||this.validateArray(I,R,U)||this.validateObject(I,R,U)||this.validateCombinations(I,R,U)||this.validateHypermedia(I,R,U)||this.validateFormat(I,R,U)||this.validateDefinedKeywords(I,R,U)||null;if(D){for(;this.scanned.length;){var mt=this.scanned.pop();delete mt[this.validatedSchemasKey]}this.scannedFrozen=[],this.scannedFrozenSchemas=[]}if(ke||me!==this.errors.length)for(;A&&A.length||F&&F.length;){var Nt=A&&A.length?""+A.pop():null,pe=F&&F.length?""+F.pop():null;ke&&(ke=ke.prefixWith(Nt,pe)),this.prefixErrors(me,Nt,pe)}return se!==null?this.scannedFrozenValidationErrors[Q][se]=this.errors.slice(J):ce!==null&&(I[this.validationErrorsKey][ce]=this.errors.slice(J)),this.handleError(ke)},s.prototype.validateFormat=function(I,R){if(typeof R.format!="string"||!this.formatValidators[R.format])return null;var A=this.formatValidators[R.format].call(null,I,R);return typeof A=="string"||typeof A=="number"?this.createError(E.FORMAT_CUSTOM,{message:A},"","/format",null,I,R):A&&typeof A=="object"?this.createError(E.FORMAT_CUSTOM,{message:A.message||"?"},A.dataPath||"",A.schemaPath||"/format",null,I,R):null},s.prototype.validateDefinedKeywords=function(I,R,A){for(var F in this.definedKeywords)if(!(typeof R[F]>"u"))for(var U=this.definedKeywords[F],D=0;D<U.length;D++){var J=U[D],Q=J(I,R[F],R,A);if(typeof Q=="string"||typeof Q=="number")return this.createError(E.KEYWORD_CUSTOM,{key:F,message:Q},"","",null,I,R).prefixWith(null,F);if(Q&&typeof Q=="object"){var se=Q.code;if(typeof se=="string"){if(!E[se])throw new Error("Undefined error code (use defineError): "+se);se=E[se]}else typeof se!="number"&&(se=E.KEYWORD_CUSTOM);var ce=typeof Q.message=="object"?Q.message:{key:F,message:Q.message||"?"},Be=Q.schemaPath||"/"+F.replace(/~/g,"~0").replace(/\//g,"~1");return this.createError(se,ce,Q.dataPath||null,Be,null,I,R)}}return null};function o(I,R){if(I===R)return!0;if(I&&R&&typeof I=="object"&&typeof R=="object"){if(Array.isArray(I)!==Array.isArray(R))return!1;if(Array.isArray(I)){if(I.length!==R.length)return!1;for(var A=0;A<I.length;A++)if(!o(I[A],R[A]))return!1}else{var F;for(F in I)if(R[F]===void 0&&I[F]!==void 0)return!1;for(F in R)if(I[F]===void 0&&R[F]!==void 0)return!1;for(F in I)if(!o(I[F],R[F]))return!1}return!0}return!1}s.prototype.validateBasic=function(R,A,F){var U;return(U=this.validateType(R,A,F))||(U=this.validateEnum(R,A,F))?U.prefixWith(null,"type"):null},s.prototype.validateType=function(R,A){if(A.type===void 0)return null;var F=typeof R;R===null?F="null":Array.isArray(R)&&(F="array");var U=A.type;Array.isArray(U)||(U=[U]);for(var D=0;D<U.length;D++){var J=U[D];if(J===F||J==="integer"&&F==="number"&&R%1===0)return null}return this.createError(E.INVALID_TYPE,{type:F,expected:U.join("/")},"","",null,R,A)},s.prototype.validateEnum=function(R,A){if(A.enum===void 0)return null;for(var F=0;F<A.enum.length;F++){var U=A.enum[F];if(o(R,U))return null}return this.createError(E.ENUM_MISMATCH,{value:typeof JSON<"u"?JSON.stringify(R):R},"","",null,R,A)},s.prototype.validateNumeric=function(R,A,F){return this.validateMultipleOf(R,A,F)||this.validateMinMax(R,A,F)||this.validateNaN(R,A,F)||null};var l=Math.pow(2,-51),c=1-l;s.prototype.validateMultipleOf=function(R,A){var F=A.multipleOf||A.divisibleBy;if(F===void 0)return null;if(typeof R=="number"){var U=R/F%1;if(U>=l&&U<c)return this.createError(E.NUMBER_MULTIPLE_OF,{value:R,multipleOf:F},"","",null,R,A)}return null},s.prototype.validateMinMax=function(R,A){if(typeof R!="number")return null;if(A.minimum!==void 0){if(R<A.minimum)return this.createError(E.NUMBER_MINIMUM,{value:R,minimum:A.minimum},"","/minimum",null,R,A);if(A.exclusiveMinimum&&R===A.minimum)return this.createError(E.NUMBER_MINIMUM_EXCLUSIVE,{value:R,minimum:A.minimum},"","/exclusiveMinimum",null,R,A)}if(A.maximum!==void 0){if(R>A.maximum)return this.createError(E.NUMBER_MAXIMUM,{value:R,maximum:A.maximum},"","/maximum",null,R,A);if(A.exclusiveMaximum&&R===A.maximum)return this.createError(E.NUMBER_MAXIMUM_EXCLUSIVE,{value:R,maximum:A.maximum},"","/exclusiveMaximum",null,R,A)}return null},s.prototype.validateNaN=function(R,A){return typeof R!="number"?null:isNaN(R)===!0||R===1/0||R===-1/0?this.createError(E.NUMBER_NOT_A_NUMBER,{value:R},"","/type",null,R,A):null},s.prototype.validateString=function(R,A,F){return this.validateStringLength(R,A,F)||this.validateStringPattern(R,A,F)||null},s.prototype.validateStringLength=function(R,A){return typeof R!="string"?null:A.minLength!==void 0&&R.length<A.minLength?this.createError(E.STRING_LENGTH_SHORT,{length:R.length,minimum:A.minLength},"","/minLength",null,R,A):A.maxLength!==void 0&&R.length>A.maxLength?this.createError(E.STRING_LENGTH_LONG,{length:R.length,maximum:A.maxLength},"","/maxLength",null,R,A):null},s.prototype.validateStringPattern=function(R,A){if(typeof R!="string"||typeof A.pattern!="string"&&!(A.pattern instanceof RegExp))return null;var F;if(A.pattern instanceof RegExp)F=A.pattern;else{var U,D="",J=A.pattern.match(/^\/(.+)\/([img]*)$/);J?(U=J[1],D=J[2]):U=A.pattern,F=new RegExp(U,D)}return F.test(R)?null:this.createError(E.STRING_PATTERN,{pattern:A.pattern},"","/pattern",null,R,A)},s.prototype.validateArray=function(R,A,F){return Array.isArray(R)&&(this.validateArrayLength(R,A,F)||this.validateArrayUniqueItems(R,A,F)||this.validateArrayItems(R,A,F))||null},s.prototype.validateArrayLength=function(R,A){var F;return A.minItems!==void 0&&R.length<A.minItems&&(F=this.createError(E.ARRAY_LENGTH_SHORT,{length:R.length,minimum:A.minItems},"","/minItems",null,R,A),this.handleError(F))||A.maxItems!==void 0&&R.length>A.maxItems&&(F=this.createError(E.ARRAY_LENGTH_LONG,{length:R.length,maximum:A.maxItems},"","/maxItems",null,R,A),this.handleError(F))?F:null},s.prototype.validateArrayUniqueItems=function(R,A){if(A.uniqueItems){for(var F=0;F<R.length;F++)for(var U=F+1;U<R.length;U++)if(o(R[F],R[U])){var D=this.createError(E.ARRAY_UNIQUE,{match1:F,match2:U},"","/uniqueItems",null,R,A);if(this.handleError(D))return D}}return null},s.prototype.validateArrayItems=function(R,A,F){if(A.items===void 0)return null;var U,D;if(Array.isArray(A.items)){for(D=0;D<R.length;D++)if(D<A.items.length){if(U=this.validateAll(R[D],A.items[D],[D],["items",D],F+"/"+D))return U}else if(A.additionalItems!==void 0){if(typeof A.additionalItems=="boolean"){if(!A.additionalItems&&(U=this.createError(E.ARRAY_ADDITIONAL_ITEMS,{},"/"+D,"/additionalItems",null,R,A),this.handleError(U)))return U}else if(U=this.validateAll(R[D],A.additionalItems,[D],["additionalItems"],F+"/"+D))return U}}else for(D=0;D<R.length;D++)if(U=this.validateAll(R[D],A.items,[D],["items"],F+"/"+D))return U;return null},s.prototype.validateObject=function(R,A,F){return typeof R!="object"||R===null||Array.isArray(R)?null:this.validateObjectMinMaxProperties(R,A,F)||this.validateObjectRequiredProperties(R,A,F)||this.validateObjectProperties(R,A,F)||this.validateObjectDependencies(R,A,F)||null},s.prototype.validateObjectMinMaxProperties=function(R,A){var F=Object.keys(R),U;return A.minProperties!==void 0&&F.length<A.minProperties&&(U=this.createError(E.OBJECT_PROPERTIES_MINIMUM,{propertyCount:F.length,minimum:A.minProperties},"","/minProperties",null,R,A),this.handleError(U))||A.maxProperties!==void 0&&F.length>A.maxProperties&&(U=this.createError(E.OBJECT_PROPERTIES_MAXIMUM,{propertyCount:F.length,maximum:A.maxProperties},"","/maxProperties",null,R,A),this.handleError(U))?U:null},s.prototype.validateObjectRequiredProperties=function(R,A){if(A.required!==void 0)for(var F=0;F<A.required.length;F++){var U=A.required[F];if(R[U]===void 0){var D=this.createError(E.OBJECT_REQUIRED,{key:U},"","/required/"+F,null,R,A);if(this.handleError(D))return D}}return null},s.prototype.validateObjectProperties=function(R,A,F){var U;for(var D in R){var J=F+"/"+D.replace(/~/g,"~0").replace(/\//g,"~1"),Q=!1;if(A.properties!==void 0&&A.properties[D]!==void 0&&(Q=!0,U=this.validateAll(R[D],A.properties[D],[D],["properties",D],J)))return U;if(A.patternProperties!==void 0)for(var se in A.patternProperties){var ce=new RegExp(se);if(ce.test(D)&&(Q=!0,U=this.validateAll(R[D],A.patternProperties[se],[D],["patternProperties",se],J)))return U}if(Q)this.trackUnknownProperties&&(this.knownPropertyPaths[J]=!0,delete this.unknownPropertyPaths[J]);else if(A.additionalProperties!==void 0){if(this.trackUnknownProperties&&(this.knownPropertyPaths[J]=!0,delete this.unknownPropertyPaths[J]),typeof A.additionalProperties=="boolean"){if(!A.additionalProperties&&(U=this.createError(E.OBJECT_ADDITIONAL_PROPERTIES,{key:D},"","/additionalProperties",null,R,A).prefixWith(D,null),this.handleError(U)))return U}else if(U=this.validateAll(R[D],A.additionalProperties,[D],["additionalProperties"],J))return U}else this.trackUnknownProperties&&!this.knownPropertyPaths[J]&&(this.unknownPropertyPaths[J]=!0)}return null},s.prototype.validateObjectDependencies=function(R,A,F){var U;if(A.dependencies!==void 0){for(var D in A.dependencies)if(R[D]!==void 0){var J=A.dependencies[D];if(typeof J=="string"){if(R[J]===void 0&&(U=this.createError(E.OBJECT_DEPENDENCY_KEY,{key:D,missing:J},"","",null,R,A).prefixWith(null,D).prefixWith(null,"dependencies"),this.handleError(U)))return U}else if(Array.isArray(J))for(var Q=0;Q<J.length;Q++){var se=J[Q];if(R[se]===void 0&&(U=this.createError(E.OBJECT_DEPENDENCY_KEY,{key:D,missing:se},"","/"+Q,null,R,A).prefixWith(null,D).prefixWith(null,"dependencies"),this.handleError(U)))return U}else if(U=this.validateAll(R,J,[],["dependencies",D],F))return U}}return null},s.prototype.validateCombinations=function(R,A,F){return this.validateAllOf(R,A,F)||this.validateAnyOf(R,A,F)||this.validateOneOf(R,A,F)||this.validateNot(R,A,F)||null},s.prototype.validateAllOf=function(R,A,F){if(A.allOf===void 0)return null;for(var U,D=0;D<A.allOf.length;D++){var J=A.allOf[D];if(U=this.validateAll(R,J,[],["allOf",D],F))return U}return null},s.prototype.validateAnyOf=function(R,A,F){if(A.anyOf===void 0)return null;var U=[],D=this.errors.length,J,Q;this.trackUnknownProperties&&(J=this.unknownPropertyPaths,Q=this.knownPropertyPaths);for(var se=!0,ce=0;ce<A.anyOf.length;ce++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var Be=A.anyOf[ce],_e=this.errors.length,me=this.validateAll(R,Be,[],["anyOf",ce],F);if(me===null&&_e===this.errors.length){if(this.errors=this.errors.slice(0,D),this.trackUnknownProperties){for(var ke in this.knownPropertyPaths)Q[ke]=!0,delete J[ke];for(var mt in this.unknownPropertyPaths)Q[mt]||(J[mt]=!0);se=!1;continue}return null}me&&U.push(me.prefixWith(null,""+ce).prefixWith(null,"anyOf"))}if(this.trackUnknownProperties&&(this.unknownPropertyPaths=J,this.knownPropertyPaths=Q),se)return U=U.concat(this.errors.slice(D)),this.errors=this.errors.slice(0,D),this.createError(E.ANY_OF_MISSING,{},"","/anyOf",U,R,A)},s.prototype.validateOneOf=function(R,A,F){if(A.oneOf===void 0)return null;var U=null,D=[],J=this.errors.length,Q,se;this.trackUnknownProperties&&(Q=this.unknownPropertyPaths,se=this.knownPropertyPaths);for(var ce=0;ce<A.oneOf.length;ce++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var Be=A.oneOf[ce],_e=this.errors.length,me=this.validateAll(R,Be,[],["oneOf",ce],F);if(me===null&&_e===this.errors.length){if(U===null)U=ce;else return this.errors=this.errors.slice(0,J),this.createError(E.ONE_OF_MULTIPLE,{index1:U,index2:ce},"","/oneOf",null,R,A);if(this.trackUnknownProperties){for(var ke in this.knownPropertyPaths)se[ke]=!0,delete Q[ke];for(var mt in this.unknownPropertyPaths)se[mt]||(Q[mt]=!0)}}else me&&D.push(me)}return this.trackUnknownProperties&&(this.unknownPropertyPaths=Q,this.knownPropertyPaths=se),U===null?(D=D.concat(this.errors.slice(J)),this.errors=this.errors.slice(0,J),this.createError(E.ONE_OF_MISSING,{},"","/oneOf",D,R,A)):(this.errors=this.errors.slice(0,J),null)},s.prototype.validateNot=function(R,A,F){if(A.not===void 0)return null;var U=this.errors.length,D,J;this.trackUnknownProperties&&(D=this.unknownPropertyPaths,J=this.knownPropertyPaths,this.unknownPropertyPaths={},this.knownPropertyPaths={});var Q=this.validateAll(R,A.not,null,null,F),se=this.errors.slice(U);return this.errors=this.errors.slice(0,U),this.trackUnknownProperties&&(this.unknownPropertyPaths=D,this.knownPropertyPaths=J),Q===null&&se.length===0?this.createError(E.NOT_PASSED,{},"","/not",null,R,A):null},s.prototype.validateHypermedia=function(R,A,F){if(!A.links)return null;for(var U,D=0;D<A.links.length;D++){var J=A.links[D];if(J.rel==="describedby"){for(var Q=new i(J.href),se=!0,ce=0;ce<Q.varNames.length;ce++)if(!(Q.varNames[ce]in R)){se=!1;break}if(se){var Be=Q.fillFromObject(R),_e={$ref:Be};if(U=this.validateAll(R,_e,[],["links",D],F))return U}}}};function d(I){var R=String(I).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return R?{href:R[0]||"",protocol:R[1]||"",authority:R[2]||"",host:R[3]||"",hostname:R[4]||"",port:R[5]||"",pathname:R[6]||"",search:R[7]||"",hash:R[8]||""}:null}function p(I,R){function A(F){var U=[];return F.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(D){D==="/.."?U.pop():U.push(D)}),U.join("").replace(/^\//,F.charAt(0)==="/"?"/":"")}return R=d(R||""),I=d(I||""),!R||!I?null:(R.protocol||I.protocol)+(R.protocol||R.authority?R.authority:I.authority)+A(R.protocol||R.authority||R.pathname.charAt(0)==="/"?R.pathname:R.pathname?(I.authority&&!I.pathname?"/":"")+I.pathname.slice(0,I.pathname.lastIndexOf("/")+1)+R.pathname:I.pathname)+(R.protocol||R.authority||R.pathname?R.search:R.search||I.search)+R.hash}function m(I){return I.split("#")[0]}function y(I,R){if(I&&typeof I=="object")if(R===void 0?R=I.id:typeof I.id=="string"&&(R=p(R,I.id),I.id=R),Array.isArray(I))for(var A=0;A<I.length;A++)y(I[A],R);else{typeof I.$ref=="string"&&(I.$ref=p(R,I.$ref));for(var F in I)F!=="enum"&&y(I[F],R)}}function b(I){I=I||"en";var R=O[I];return function(A){var F=R[A.code]||_[A.code];if(typeof F!="string")return"Unknown error code "+A.code+": "+JSON.stringify(A.messageParams);var U=A.params;return F.replace(/\{([^{}]*)\}/g,function(D,J){var Q=U[J];return typeof Q=="string"||typeof Q=="number"?Q:D})}}var E={INVALID_TYPE:0,ENUM_MISMATCH:1,ANY_OF_MISSING:10,ONE_OF_MISSING:11,ONE_OF_MULTIPLE:12,NOT_PASSED:13,NUMBER_MULTIPLE_OF:100,NUMBER_MINIMUM:101,NUMBER_MINIMUM_EXCLUSIVE:102,NUMBER_MAXIMUM:103,NUMBER_MAXIMUM_EXCLUSIVE:104,NUMBER_NOT_A_NUMBER:105,STRING_LENGTH_SHORT:200,STRING_LENGTH_LONG:201,STRING_PATTERN:202,OBJECT_PROPERTIES_MINIMUM:300,OBJECT_PROPERTIES_MAXIMUM:301,OBJECT_REQUIRED:302,OBJECT_ADDITIONAL_PROPERTIES:303,OBJECT_DEPENDENCY_KEY:304,ARRAY_LENGTH_SHORT:400,ARRAY_LENGTH_LONG:401,ARRAY_UNIQUE:402,ARRAY_ADDITIONAL_ITEMS:403,FORMAT_CUSTOM:500,KEYWORD_CUSTOM:501,CIRCULAR_REFERENCE:600,UNKNOWN_PROPERTY:1e3},C={};for(var v in E)C[E[v]]=v;var _={INVALID_TYPE:"Invalid type: {type} (expected {expected})",ENUM_MISMATCH:"No enum match for: {value}",ANY_OF_MISSING:'Data does not match any schemas from "anyOf"',ONE_OF_MISSING:'Data does not match any schemas from "oneOf"',ONE_OF_MULTIPLE:'Data is valid against more than one schema from "oneOf": indices {index1} and {index2}',NOT_PASSED:'Data matches schema from "not"',NUMBER_MULTIPLE_OF:"Value {value} is not a multiple of {multipleOf}",NUMBER_MINIMUM:"Value {value} is less than minimum {minimum}",NUMBER_MINIMUM_EXCLUSIVE:"Value {value} is equal to exclusive minimum {minimum}",NUMBER_MAXIMUM:"Value {value} is greater than maximum {maximum}",NUMBER_MAXIMUM_EXCLUSIVE:"Value {value} is equal to exclusive maximum {maximum}",NUMBER_NOT_A_NUMBER:"Value {value} is not a valid number",STRING_LENGTH_SHORT:"String is too short ({length} chars), minimum {minimum}",STRING_LENGTH_LONG:"String is too long ({length} chars), maximum {maximum}",STRING_PATTERN:"String does not match pattern: {pattern}",OBJECT_PROPERTIES_MINIMUM:"Too few properties defined ({propertyCount}), minimum {minimum}",OBJECT_PROPERTIES_MAXIMUM:"Too many properties defined ({propertyCount}), maximum {maximum}",OBJECT_REQUIRED:"Missing required property: {key}",OBJECT_ADDITIONAL_PROPERTIES:"Additional properties not allowed",OBJECT_DEPENDENCY_KEY:"Dependency failed - key must exist: {missing} (due to key: {key})",ARRAY_LENGTH_SHORT:"Array is too short ({length}), minimum {minimum}",ARRAY_LENGTH_LONG:"Array is too long ({length}), maximum {maximum}",ARRAY_UNIQUE:"Array items are not unique (indices {match1} and {match2})",ARRAY_ADDITIONAL_ITEMS:"Additional items not allowed",FORMAT_CUSTOM:"Format validation failed ({message})",KEYWORD_CUSTOM:"Keyword failed: {key} ({message})",CIRCULAR_REFERENCE:"Circular $refs: {urls}",UNKNOWN_PROPERTY:"Unknown property (not in schema)"};function q(I,R,A,F,U){if(Error.call(this),I===void 0)throw new Error("No error code supplied: "+F);this.message="",this.params=R,this.code=I,this.dataPath=A||"",this.schemaPath=F||"",this.subErrors=U||null;var D=new Error(this.message);if(this.stack=D.stack||D.stacktrace,!this.stack)try{throw D}catch(J){this.stack=J.stack||J.stacktrace}}q.prototype=Object.create(Error.prototype),q.prototype.constructor=q,q.prototype.name="ValidationError",q.prototype.prefixWith=function(I,R){if(I!==null&&(I=I.replace(/~/g,"~0").replace(/\//g,"~1"),this.dataPath="/"+I+this.dataPath),R!==null&&(R=R.replace(/~/g,"~0").replace(/\//g,"~1"),this.schemaPath="/"+R+this.schemaPath),this.subErrors!==null)for(var A=0;A<this.subErrors.length;A++)this.subErrors[A].prefixWith(I,R);return this};function k(I,R){if(R.substring(0,I.length)===I){var A=R.substring(I.length);if(R.length>0&&R.charAt(I.length-1)==="/"||A.charAt(0)==="#"||A.charAt(0)==="?")return!0}return!1}var O={};function M(I){var R=new s,A,F,U={setErrorReporter:function(D){return typeof D=="string"?this.language(D):(F=D,!0)},addFormat:function(){R.addFormat.apply(R,arguments)},language:function(D){return D?(O[D]||(D=D.split("-")[0]),O[D]?(A=D,D):!1):A},addLanguage:function(D,J){var Q;for(Q in E)J[Q]&&!J[E[Q]]&&(J[E[Q]]=J[Q]);var se=D.split("-")[0];if(!O[se])O[D]=J,O[se]=J;else{O[D]=Object.create(O[se]);for(Q in J)typeof O[se][Q]>"u"&&(O[se][Q]=J[Q]),O[D][Q]=J[Q]}return this},freshApi:function(D){var J=M();return D&&J.language(D),J},validate:function(D,J,Q,se){var ce=b(A),Be=F?function(ke,mt,Nt){return F(ke,mt,Nt)||ce(ke,mt,Nt)}:ce,_e=new s(R,!1,Be,Q,se);typeof J=="string"&&(J={$ref:J}),_e.addSchema("",J);var me=_e.validateAll(D,J,null,null,"");return!me&&se&&(me=_e.banUnknownProperties(D,J)),this.error=me,this.missing=_e.missing,this.valid=me===null,this.valid},validateResult:function(){var D={toString:function(){return this.valid?"valid":this.error.message}};return this.validate.apply(D,arguments),D},validateMultiple:function(D,J,Q,se){var ce=b(A),Be=F?function(ke,mt,Nt){return F(ke,mt,Nt)||ce(ke,mt,Nt)}:ce,_e=new s(R,!0,Be,Q,se);typeof J=="string"&&(J={$ref:J}),_e.addSchema("",J),_e.validateAll(D,J,null,null,""),se&&_e.banUnknownProperties(D,J);var me={toString:function(){return this.valid?"valid":this.error.message}};return me.errors=_e.errors,me.missing=_e.missing,me.valid=me.errors.length===0,me},addSchema:function(){return R.addSchema.apply(R,arguments)},getSchema:function(){return R.getSchema.apply(R,arguments)},getSchemaMap:function(){return R.getSchemaMap.apply(R,arguments)},getSchemaUris:function(){return R.getSchemaUris.apply(R,arguments)},getMissingUris:function(){return R.getMissingUris.apply(R,arguments)},dropSchemas:function(){R.dropSchemas.apply(R,arguments)},defineKeyword:function(){R.defineKeyword.apply(R,arguments)},defineError:function(D,J,Q){if(typeof D!="string"||!/^[A-Z]+(_[A-Z]+)*$/.test(D))throw new Error("Code name must be a string in UPPER_CASE_WITH_UNDERSCORES");if(typeof J!="number"||J%1!==0||J<1e4)throw new Error("Code number must be an integer > 10000");if(typeof E[D]<"u")throw new Error("Error already defined: "+D+" as "+E[D]);if(typeof C[J]<"u")throw new Error("Error code already used: "+C[J]+" as "+J);E[D]=J,C[J]=D,_[D]=_[J]=Q;for(var se in O){var ce=O[se];ce[D]&&(ce[J]=ce[J]||ce[D])}},reset:function(){R.reset(),this.error=null,this.missing=[],this.valid=!0},missing:[],error:null,valid:!0,normSchema:y,resolveUrl:p,getDocumentUri:m,errorCodes:E};return U.language(I||"en"),U}var j=M();return j.addLanguage("en-gb",_),j.tv4=j,j})});var mf=V(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.regexpCode=ct.getEsmExportName=ct.getProperty=ct.safeStringify=ct.stringify=ct.strConcat=ct.addCodeArg=ct.str=ct._=ct.nil=ct._Code=ct.Name=ct.IDENTIFIER=ct._CodeOrName=void 0;var pf=class{};ct._CodeOrName=pf;ct.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var _a=class extends pf{constructor(e){if(super(),!ct.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ct.Name=_a;var Un=class extends pf{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof _a&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ct._Code=Un;ct.nil=new Un("");function xq(t,...e){let r=[t[0]],n=0;for(;n<e.length;)mS(r,e[n]),r.push(t[++n]);return new Un(r)}ct._=xq;var hS=new Un("+");function Eq(t,...e){let r=[hf(t[0])],n=0;for(;n<e.length;)r.push(hS),mS(r,e[n]),r.push(hS,hf(t[++n]));return b2(r),new Un(r)}ct.str=Eq;function mS(t,e){e instanceof Un?t.push(...e._items):e instanceof _a?t.push(e):t.push(_2(e))}ct.addCodeArg=mS;function b2(t){let e=1;for(;e<t.length-1;){if(t[e]===hS){let r=S2(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function S2(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof _a||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof _a))return`"${t}${e.slice(1)}`}function w2(t,e){return e.emptyStr()?t:t.emptyStr()?e:Eq`${t}${e}`}ct.strConcat=w2;function _2(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:hf(Array.isArray(t)?t.join(","):t)}function R2(t){return new Un(hf(t))}ct.stringify=R2;function hf(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ct.safeStringify=hf;function C2(t){return typeof t=="string"&&ct.IDENTIFIER.test(t)?new Un(`.${t}`):xq`[${t}]`}ct.getProperty=C2;function x2(t){if(typeof t=="string"&&ct.IDENTIFIER.test(t))return new Un(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ct.getEsmExportName=x2;function E2(t){return new Un(t.toString())}ct.regexpCode=E2});var vS=V(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.ValueScope=en.ValueScopeName=en.Scope=en.varKinds=en.UsedValueState=void 0;var Xr=mf(),gS=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},jh;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(jh||(en.UsedValueState=jh={}));en.varKinds={const:new Xr.Name("const"),let:new Xr.Name("let"),var:new Xr.Name("var")};var Lh=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Xr.Name?e:this.name(e)}name(e){return new Xr.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};en.Scope=Lh;var Uh=class extends Xr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Xr._)`.${new Xr.Name(r)}[${n}]`}};en.ValueScopeName=Uh;var q2=(0,Xr._)`\n`,yS=class extends Lh{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?q2:Xr.nil}}get(){return this._scope}name(e){return new Uh(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,l=this._values[s];if(l){let p=l.get(o);if(p)return p}else l=this._values[s]=new Map;l.set(o,i);let c=this._scope[s]||(this._scope[s]=[]),d=c.length;return c[d]=r.ref,i.setValue(r,{property:s,itemIndex:d}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Xr._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let s=Xr.nil;for(let o in e){let l=e[o];if(!l)continue;let c=n[o]=n[o]||new Map;l.forEach(d=>{if(c.has(d))return;c.set(d,jh.Started);let p=r(d);if(p){let m=this.opts.es5?en.varKinds.var:en.varKinds.const;s=(0,Xr._)`${s}${m} ${d} = ${p};${this.opts._n}`}else if(p=i?.(d))s=(0,Xr._)`${s}${p}${this.opts._n}`;else throw new gS(d);c.set(d,jh.Completed)})}return s}};en.ValueScope=yS});var Je=V(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.or=He.and=He.not=He.CodeGen=He.operators=He.varKinds=He.ValueScopeName=He.ValueScope=He.Scope=He.Name=He.regexpCode=He.stringify=He.getProperty=He.nil=He.strConcat=He.str=He._=void 0;var tt=mf(),ui=vS(),lo=mf();Object.defineProperty(He,"_",{enumerable:!0,get:function(){return lo._}});Object.defineProperty(He,"str",{enumerable:!0,get:function(){return lo.str}});Object.defineProperty(He,"strConcat",{enumerable:!0,get:function(){return lo.strConcat}});Object.defineProperty(He,"nil",{enumerable:!0,get:function(){return lo.nil}});Object.defineProperty(He,"getProperty",{enumerable:!0,get:function(){return lo.getProperty}});Object.defineProperty(He,"stringify",{enumerable:!0,get:function(){return lo.stringify}});Object.defineProperty(He,"regexpCode",{enumerable:!0,get:function(){return lo.regexpCode}});Object.defineProperty(He,"Name",{enumerable:!0,get:function(){return lo.Name}});var Wh=vS();Object.defineProperty(He,"Scope",{enumerable:!0,get:function(){return Wh.Scope}});Object.defineProperty(He,"ValueScope",{enumerable:!0,get:function(){return Wh.ValueScope}});Object.defineProperty(He,"ValueScopeName",{enumerable:!0,get:function(){return Wh.ValueScopeName}});Object.defineProperty(He,"varKinds",{enumerable:!0,get:function(){return Wh.varKinds}});He.operators={GT:new tt._Code(">"),GTE:new tt._Code(">="),LT:new tt._Code("<"),LTE:new tt._Code("<="),EQ:new tt._Code("==="),NEQ:new tt._Code("!=="),NOT:new tt._Code("!"),OR:new tt._Code("||"),AND:new tt._Code("&&"),ADD:new tt._Code("+")};var Ss=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},bS=class extends Ss{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?ui.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=iu(this.rhs,e,r)),this}get names(){return this.rhs instanceof tt._CodeOrName?this.rhs.names:{}}},Hh=class extends Ss{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof tt.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=iu(this.rhs,e,r),this}get names(){let e=this.lhs instanceof tt.Name?{}:{...this.lhs.names};return Vh(e,this.rhs)}},SS=class extends Hh{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},wS=class extends Ss{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},_S=class extends Ss{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},RS=class extends Ss{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},CS=class extends Ss{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=iu(this.code,e,r),this}get names(){return this.code instanceof tt._CodeOrName?this.code.names:{}}},gf=class extends Ss{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(e,r)||(O2(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>xa(e,r.names),{})}},ws=class extends gf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},xS=class extends gf{},nu=class extends ws{};nu.kind="else";var Ra=class t extends ws{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new nu(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(qq(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=iu(this.condition,e,r),this}get names(){let e=super.names;return Vh(e,this.condition),this.else&&xa(e,this.else.names),e}};Ra.kind="if";var Ca=class extends ws{};Ca.kind="for";var ES=class extends Ca{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=iu(this.iteration,e,r),this}get names(){return xa(super.names,this.iteration.names)}},qS=class extends Ca{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?ui.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=Vh(super.names,this.from);return Vh(e,this.to)}},Bh=class extends Ca{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=iu(this.iterable,e,r),this}get names(){return xa(super.names,this.iterable.names)}},yf=class extends ws{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};yf.kind="func";var vf=class extends gf{render(e){return"return "+super.render(e)}};vf.kind="return";var OS=class extends ws{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&xa(e,this.catch.names),this.finally&&xa(e,this.finally.names),e}},bf=class extends ws{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};bf.kind="catch";var Sf=class extends ws{render(e){return"finally"+super.render(e)}};Sf.kind="finally";var IS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
23
|
+
`+new Error().stack),w=!1}return g.apply(this,arguments)},g)}var A={};function F(f,g){e.deprecationHandler!=null&&e.deprecationHandler(f,g),A[f]||(I(g),A[f]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function U(f){return typeof Function<"u"&&f instanceof Function||Object.prototype.toString.call(f)==="[object Function]"}function D(f){var g,w;for(w in f)s(f,w)&&(g=f[w],U(g)?this[w]=g:this["_"+w]=g);this._config=f,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function J(f,g){var w=m({},f),x;for(x in g)s(g,x)&&(i(f[x])&&i(g[x])?(w[x]={},m(w[x],f[x]),m(w[x],g[x])):g[x]!=null?w[x]=g[x]:delete w[x]);for(x in f)s(f,x)&&!s(g,x)&&i(f[x])&&(w[x]=m({},w[x]));return w}function Q(f){f!=null&&this.set(f)}var se;Object.keys?se=Object.keys:se=function(f){var g,w=[];for(g in f)s(f,g)&&w.push(g);return w};var ce={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function Be(f,g,w){var x=this._calendar[f]||this._calendar.sameElse;return U(x)?x.call(g,w):x}function _e(f,g,w){var x=""+Math.abs(f),T=g-x.length,H=f>=0;return(H?w?"+":"":"-")+Math.pow(10,Math.max(0,T)).toString().substr(1)+x}var me=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,ke=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,mt={},Nt={};function pe(f,g,w,x){var T=x;typeof x=="string"&&(T=function(){return this[x]()}),f&&(Nt[f]=T),g&&(Nt[g[0]]=function(){return _e(T.apply(this,arguments),g[1],g[2])}),w&&(Nt[w]=function(){return this.localeData().ordinal(T.apply(this,arguments),f)})}function Gt(f){return f.match(/\[[\s\S]/)?f.replace(/^\[|\]$/g,""):f.replace(/\\/g,"")}function Pr(f){var g=f.match(me),w,x;for(w=0,x=g.length;w<x;w++)Nt[g[w]]?g[w]=Nt[g[w]]:g[w]=Gt(g[w]);return function(T){var H="",K;for(K=0;K<x;K++)H+=U(g[K])?g[K].call(T,f):g[K];return H}}function lt(f,g){return f.isValid()?(g=kr(g,f.localeData()),mt[g]=mt[g]||Pr(g),mt[g](f)):f.localeData().invalidDate()}function kr(f,g){var w=5;function x(T){return g.longDateFormat(T)||T}for(ke.lastIndex=0;w>=0&&ke.test(f);)f=f.replace(ke,x),ke.lastIndex=0,w-=1;return f}var vr={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Ct(f){var g=this._longDateFormat[f],w=this._longDateFormat[f.toUpperCase()];return g||!w?g:(this._longDateFormat[f]=w.match(me).map(function(x){return x==="MMMM"||x==="MM"||x==="DD"||x==="dddd"?x.slice(1):x}).join(""),this._longDateFormat[f])}var St="Invalid date";function Wr(){return this._invalidDate}var Ms="%d",At=/\d{1,2}/;function Pi(f){return this._ordinal.replace("%d",f)}var En={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function te(f,g,w,x){var T=this._relativeTime[w];return U(T)?T(f,g,w,x):T.replace(/%d/i,f)}function ne(f,g){var w=this._relativeTime[f>0?"future":"past"];return U(w)?w(g):w.replace(/%s/i,g)}var Ie={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ye(f){return typeof f=="string"?Ie[f]||Ie[f.toLowerCase()]:void 0}function ve(f){var g={},w,x;for(x in f)s(f,x)&&(w=ye(x),w&&(g[w]=f[x]));return g}var Ye={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function ur(f){var g=[],w;for(w in f)s(f,w)&&g.push({unit:w,priority:Ye[w]});return g.sort(function(x,T){return x.priority-T.priority}),g}var Ae=/\d/,ge=/\d\d/,qn=/\d{3}/,fn=/\d{4}/,gt=/[+-]?\d{6}/,Ee=/\d\d?/,On=/\d\d\d\d?/,cl=/\d\d\d\d\d\d?/,Fs=/\d{1,3}/,Uo=/\d{1,4}/,Ds=/[+-]?\d{1,6}/,ki=/\d+/,js=/[+-]?\d+/,mc=/Z|[+-]\d\d:?\d\d/gi,fl=/Z|[+-]\d\d(?::?\d\d)?/gi,Ly=/[+-]?\d+(\.\d{1,3})?/,Ho=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,ts=/^[1-9]\d?/,dl=/^([1-9]\d|\d)/,pl;pl={};function he(f,g,w){pl[f]=U(g)?g:function(x,T){return x&&w?w:g}}function Uy(f,g){return s(pl,f)?pl[f](g._strict,g._locale):new RegExp(Hy(f))}function Hy(f){return In(f.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(g,w,x,T,H){return w||x||T||H}))}function In(f){return f.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function zr(f){return f<0?Math.ceil(f)||0:Math.floor(f)}function Ve(f){var g=+f,w=0;return g!==0&&isFinite(g)&&(w=zr(g)),w}var gc={};function ft(f,g){var w,x=g,T;for(typeof f=="string"&&(f=[f]),c(g)&&(x=function(H,K){K[g]=Ve(H)}),T=f.length,w=0;w<T;w++)gc[f[w]]=x}function Bo(f,g){ft(f,function(w,x,T,H){T._w=T._w||{},g(w,T._w,T,H)})}function yc(f,g,w){g!=null&&s(gc,f)&&gc[f](g,w._a,w,f)}function hl(f){return f%4===0&&f%100!==0||f%400===0}var cr=0,Kn=1,Pn=2,Yt=3,Jr=4,Qn=5,rs=6,mp=7,By=8;pe("Y",0,0,function(){var f=this.year();return f<=9999?_e(f,4):"+"+f}),pe(0,["YY",2],0,function(){return this.year()%100}),pe(0,["YYYY",4],0,"year"),pe(0,["YYYYY",5],0,"year"),pe(0,["YYYYYY",6,!0],0,"year"),he("Y",js),he("YY",Ee,ge),he("YYYY",Uo,fn),he("YYYYY",Ds,gt),he("YYYYYY",Ds,gt),ft(["YYYYY","YYYYYY"],cr),ft("YYYY",function(f,g){g[cr]=f.length===2?e.parseTwoDigitYear(f):Ve(f)}),ft("YY",function(f,g){g[cr]=e.parseTwoDigitYear(f)}),ft("Y",function(f,g){g[cr]=parseInt(f,10)});function Vo(f){return hl(f)?366:365}e.parseTwoDigitYear=function(f){return Ve(f)+(Ve(f)>68?1900:2e3)};var gp=Ls("FullYear",!0);function Vy(){return hl(this.year())}function Ls(f,g){return function(w){return w!=null?(zo(this,f,w),e.updateOffset(this,g),this):Wo(this,f)}}function Wo(f,g){if(!f.isValid())return NaN;var w=f._d,x=f._isUTC;switch(g){case"Milliseconds":return x?w.getUTCMilliseconds():w.getMilliseconds();case"Seconds":return x?w.getUTCSeconds():w.getSeconds();case"Minutes":return x?w.getUTCMinutes():w.getMinutes();case"Hours":return x?w.getUTCHours():w.getHours();case"Date":return x?w.getUTCDate():w.getDate();case"Day":return x?w.getUTCDay():w.getDay();case"Month":return x?w.getUTCMonth():w.getMonth();case"FullYear":return x?w.getUTCFullYear():w.getFullYear();default:return NaN}}function zo(f,g,w){var x,T,H,K,fe;if(!(!f.isValid()||isNaN(w))){switch(x=f._d,T=f._isUTC,g){case"Milliseconds":return void(T?x.setUTCMilliseconds(w):x.setMilliseconds(w));case"Seconds":return void(T?x.setUTCSeconds(w):x.setSeconds(w));case"Minutes":return void(T?x.setUTCMinutes(w):x.setMinutes(w));case"Hours":return void(T?x.setUTCHours(w):x.setHours(w));case"Date":return void(T?x.setUTCDate(w):x.setDate(w));case"FullYear":break;default:return}H=w,K=f.month(),fe=f.date(),fe=fe===29&&K===1&&!hl(H)?28:fe,T?x.setUTCFullYear(H,K,fe):x.setFullYear(H,K,fe)}}function Wy(f){return f=ye(f),U(this[f])?this[f]():this}function ml(f,g){if(typeof f=="object"){f=ve(f);var w=ur(f),x,T=w.length;for(x=0;x<T;x++)this[w[x].unit](f[w[x].unit])}else if(f=ye(f),U(this[f]))return this[f](g);return this}function zy(f,g){return(f%g+g)%g}var Lt;Array.prototype.indexOf?Lt=Array.prototype.indexOf:Lt=function(f){var g;for(g=0;g<this.length;++g)if(this[g]===f)return g;return-1};function vc(f,g){if(isNaN(f)||isNaN(g))return NaN;var w=zy(g,12);return f+=(g-w)/12,w===1?hl(f)?29:28:31-w%7%2}pe("M",["MM",2],"Mo",function(){return this.month()+1}),pe("MMM",0,0,function(f){return this.localeData().monthsShort(this,f)}),pe("MMMM",0,0,function(f){return this.localeData().months(this,f)}),he("M",Ee,ts),he("MM",Ee,ge),he("MMM",function(f,g){return g.monthsShortRegex(f)}),he("MMMM",function(f,g){return g.monthsRegex(f)}),ft(["M","MM"],function(f,g){g[Kn]=Ve(f)-1}),ft(["MMM","MMMM"],function(f,g,w,x){var T=w._locale.monthsParse(f,x,w._strict);T!=null?g[Kn]=T:q(w).invalidMonth=f});var yp="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),bc="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Sc=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Jy=Ho,Gy=Ho;function Yy(f,g){return f?n(this._months)?this._months[f.month()]:this._months[(this._months.isFormat||Sc).test(g)?"format":"standalone"][f.month()]:n(this._months)?this._months:this._months.standalone}function Ky(f,g){return f?n(this._monthsShort)?this._monthsShort[f.month()]:this._monthsShort[Sc.test(g)?"format":"standalone"][f.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function vp(f,g,w){var x,T,H,K=f.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],x=0;x<12;++x)H=y([2e3,x]),this._shortMonthsParse[x]=this.monthsShort(H,"").toLocaleLowerCase(),this._longMonthsParse[x]=this.months(H,"").toLocaleLowerCase();return w?g==="MMM"?(T=Lt.call(this._shortMonthsParse,K),T!==-1?T:null):(T=Lt.call(this._longMonthsParse,K),T!==-1?T:null):g==="MMM"?(T=Lt.call(this._shortMonthsParse,K),T!==-1?T:(T=Lt.call(this._longMonthsParse,K),T!==-1?T:null)):(T=Lt.call(this._longMonthsParse,K),T!==-1?T:(T=Lt.call(this._shortMonthsParse,K),T!==-1?T:null))}function bp(f,g,w){var x,T,H;if(this._monthsParseExact)return vp.call(this,f,g,w);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),x=0;x<12;x++){if(T=y([2e3,x]),w&&!this._longMonthsParse[x]&&(this._longMonthsParse[x]=new RegExp("^"+this.months(T,"").replace(".","")+"$","i"),this._shortMonthsParse[x]=new RegExp("^"+this.monthsShort(T,"").replace(".","")+"$","i")),!w&&!this._monthsParse[x]&&(H="^"+this.months(T,"")+"|^"+this.monthsShort(T,""),this._monthsParse[x]=new RegExp(H.replace(".",""),"i")),w&&g==="MMMM"&&this._longMonthsParse[x].test(f))return x;if(w&&g==="MMM"&&this._shortMonthsParse[x].test(f))return x;if(!w&&this._monthsParse[x].test(f))return x}}function wc(f,g){if(!f.isValid())return f;if(typeof g=="string"){if(/^\d+$/.test(g))g=Ve(g);else if(g=f.localeData().monthsParse(g),!c(g))return f}var w=g,x=f.date();return x=x<29?x:Math.min(x,vc(f.year(),w)),f._isUTC?f._d.setUTCMonth(w,x):f._d.setMonth(w,x),f}function gl(f){return f!=null?(wc(this,f),e.updateOffset(this,!0),this):Wo(this,"Month")}function Qy(){return vc(this.year(),this.month())}function Sp(f){return this._monthsParseExact?(s(this,"_monthsRegex")||_c.call(this),f?this._monthsShortStrictRegex:this._monthsShortRegex):(s(this,"_monthsShortRegex")||(this._monthsShortRegex=Jy),this._monthsShortStrictRegex&&f?this._monthsShortStrictRegex:this._monthsShortRegex)}function yl(f){return this._monthsParseExact?(s(this,"_monthsRegex")||_c.call(this),f?this._monthsStrictRegex:this._monthsRegex):(s(this,"_monthsRegex")||(this._monthsRegex=Gy),this._monthsStrictRegex&&f?this._monthsStrictRegex:this._monthsRegex)}function _c(){function f(qe,ze){return ze.length-qe.length}var g=[],w=[],x=[],T,H,K,fe;for(T=0;T<12;T++)H=y([2e3,T]),K=In(this.monthsShort(H,"")),fe=In(this.months(H,"")),g.push(K),w.push(fe),x.push(fe),x.push(K);g.sort(f),w.sort(f),x.sort(f),this._monthsRegex=new RegExp("^("+x.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+w.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+g.join("|")+")","i")}function Zy(f,g,w,x,T,H,K){var fe;return f<100&&f>=0?(fe=new Date(f+400,g,w,x,T,H,K),isFinite(fe.getFullYear())&&fe.setFullYear(f)):fe=new Date(f,g,w,x,T,H,K),fe}function Us(f){var g,w;return f<100&&f>=0?(w=Array.prototype.slice.call(arguments),w[0]=f+400,g=new Date(Date.UTC.apply(null,w)),isFinite(g.getUTCFullYear())&&g.setUTCFullYear(f)):g=new Date(Date.UTC.apply(null,arguments)),g}function Jo(f,g,w){var x=7+g-w,T=(7+Us(f,0,x).getUTCDay()-g)%7;return-T+x-1}function vl(f,g,w,x,T){var H=(7+w-x)%7,K=Jo(f,x,T),fe=1+7*(g-1)+H+K,qe,ze;return fe<=0?(qe=f-1,ze=Vo(qe)+fe):fe>Vo(f)?(qe=f+1,ze=fe-Vo(f)):(qe=f,ze=fe),{year:qe,dayOfYear:ze}}function Go(f,g,w){var x=Jo(f.year(),g,w),T=Math.floor((f.dayOfYear()-x-1)/7)+1,H,K;return T<1?(K=f.year()-1,H=T+kn(K,g,w)):T>kn(f.year(),g,w)?(H=T-kn(f.year(),g,w),K=f.year()+1):(K=f.year(),H=T),{week:H,year:K}}function kn(f,g,w){var x=Jo(f,g,w),T=Jo(f+1,g,w);return(Vo(f)-x+T)/7}pe("w",["ww",2],"wo","week"),pe("W",["WW",2],"Wo","isoWeek"),he("w",Ee,ts),he("ww",Ee,ge),he("W",Ee,ts),he("WW",Ee,ge),Bo(["w","ww","W","WW"],function(f,g,w,x){g[x.substr(0,1)]=Ve(f)});function Rc(f){return Go(f,this._week.dow,this._week.doy).week}var Cc={dow:0,doy:6};function Hs(){return this._week.dow}function wp(){return this._week.doy}function _p(f){var g=this.localeData().week(this);return f==null?g:this.add((f-g)*7,"d")}function Xy(f){var g=Go(this,1,4).week;return f==null?g:this.add((f-g)*7,"d")}pe("d",0,"do","day"),pe("dd",0,0,function(f){return this.localeData().weekdaysMin(this,f)}),pe("ddd",0,0,function(f){return this.localeData().weekdaysShort(this,f)}),pe("dddd",0,0,function(f){return this.localeData().weekdays(this,f)}),pe("e",0,0,"weekday"),pe("E",0,0,"isoWeekday"),he("d",Ee),he("e",Ee),he("E",Ee),he("dd",function(f,g){return g.weekdaysMinRegex(f)}),he("ddd",function(f,g){return g.weekdaysShortRegex(f)}),he("dddd",function(f,g){return g.weekdaysRegex(f)}),Bo(["dd","ddd","dddd"],function(f,g,w,x){var T=w._locale.weekdaysParse(f,x,w._strict);T!=null?g.d=T:q(w).invalidWeekday=f}),Bo(["d","e","E"],function(f,g,w,x){g[x]=Ve(f)});function Rp(f,g){return typeof f!="string"?f:isNaN(f)?(f=g.weekdaysParse(f),typeof f=="number"?f:null):parseInt(f,10)}function Cp(f,g){return typeof f=="string"?g.weekdaysParse(f)%7||7:isNaN(f)?null:f}function bl(f,g){return f.slice(g,7).concat(f.slice(0,g))}var xp="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ep="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),ev="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),tv=Ho,qp=Ho,rv=Ho;function nv(f,g){var w=n(this._weekdays)?this._weekdays:this._weekdays[f&&f!==!0&&this._weekdays.isFormat.test(g)?"format":"standalone"];return f===!0?bl(w,this._week.dow):f?w[f.day()]:w}function iv(f){return f===!0?bl(this._weekdaysShort,this._week.dow):f?this._weekdaysShort[f.day()]:this._weekdaysShort}function sv(f){return f===!0?bl(this._weekdaysMin,this._week.dow):f?this._weekdaysMin[f.day()]:this._weekdaysMin}function xc(f,g,w){var x,T,H,K=f.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],x=0;x<7;++x)H=y([2e3,1]).day(x),this._minWeekdaysParse[x]=this.weekdaysMin(H,"").toLocaleLowerCase(),this._shortWeekdaysParse[x]=this.weekdaysShort(H,"").toLocaleLowerCase(),this._weekdaysParse[x]=this.weekdays(H,"").toLocaleLowerCase();return w?g==="dddd"?(T=Lt.call(this._weekdaysParse,K),T!==-1?T:null):g==="ddd"?(T=Lt.call(this._shortWeekdaysParse,K),T!==-1?T:null):(T=Lt.call(this._minWeekdaysParse,K),T!==-1?T:null):g==="dddd"?(T=Lt.call(this._weekdaysParse,K),T!==-1||(T=Lt.call(this._shortWeekdaysParse,K),T!==-1)?T:(T=Lt.call(this._minWeekdaysParse,K),T!==-1?T:null)):g==="ddd"?(T=Lt.call(this._shortWeekdaysParse,K),T!==-1||(T=Lt.call(this._weekdaysParse,K),T!==-1)?T:(T=Lt.call(this._minWeekdaysParse,K),T!==-1?T:null)):(T=Lt.call(this._minWeekdaysParse,K),T!==-1||(T=Lt.call(this._weekdaysParse,K),T!==-1)?T:(T=Lt.call(this._shortWeekdaysParse,K),T!==-1?T:null))}function ov(f,g,w){var x,T,H;if(this._weekdaysParseExact)return xc.call(this,f,g,w);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),x=0;x<7;x++){if(T=y([2e3,1]).day(x),w&&!this._fullWeekdaysParse[x]&&(this._fullWeekdaysParse[x]=new RegExp("^"+this.weekdays(T,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[x]=new RegExp("^"+this.weekdaysShort(T,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[x]=new RegExp("^"+this.weekdaysMin(T,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[x]||(H="^"+this.weekdays(T,"")+"|^"+this.weekdaysShort(T,"")+"|^"+this.weekdaysMin(T,""),this._weekdaysParse[x]=new RegExp(H.replace(".",""),"i")),w&&g==="dddd"&&this._fullWeekdaysParse[x].test(f))return x;if(w&&g==="ddd"&&this._shortWeekdaysParse[x].test(f))return x;if(w&&g==="dd"&&this._minWeekdaysParse[x].test(f))return x;if(!w&&this._weekdaysParse[x].test(f))return x}}function av(f){if(!this.isValid())return f!=null?this:NaN;var g=Wo(this,"Day");return f!=null?(f=Rp(f,this.localeData()),this.add(f-g,"d")):g}function lv(f){if(!this.isValid())return f!=null?this:NaN;var g=(this.day()+7-this.localeData()._week.dow)%7;return f==null?g:this.add(f-g,"d")}function uv(f){if(!this.isValid())return f!=null?this:NaN;if(f!=null){var g=Cp(f,this.localeData());return this.day(this.day()%7?g:g-7)}else return this.day()||7}function cv(f){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Ec.call(this),f?this._weekdaysStrictRegex:this._weekdaysRegex):(s(this,"_weekdaysRegex")||(this._weekdaysRegex=tv),this._weekdaysStrictRegex&&f?this._weekdaysStrictRegex:this._weekdaysRegex)}function It(f){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Ec.call(this),f?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(s(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=qp),this._weekdaysShortStrictRegex&&f?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Et(f){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Ec.call(this),f?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(s(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=rv),this._weekdaysMinStrictRegex&&f?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ec(){function f(er,ni){return ni.length-er.length}var g=[],w=[],x=[],T=[],H,K,fe,qe,ze;for(H=0;H<7;H++)K=y([2e3,1]).day(H),fe=In(this.weekdaysMin(K,"")),qe=In(this.weekdaysShort(K,"")),ze=In(this.weekdays(K,"")),g.push(fe),w.push(qe),x.push(ze),T.push(fe),T.push(qe),T.push(ze);g.sort(f),w.sort(f),x.sort(f),T.sort(f),this._weekdaysRegex=new RegExp("^("+T.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+x.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+w.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}function qc(){return this.hours()%12||12}function fv(){return this.hours()||24}pe("H",["HH",2],0,"hour"),pe("h",["hh",2],0,qc),pe("k",["kk",2],0,fv),pe("hmm",0,0,function(){return""+qc.apply(this)+_e(this.minutes(),2)}),pe("hmmss",0,0,function(){return""+qc.apply(this)+_e(this.minutes(),2)+_e(this.seconds(),2)}),pe("Hmm",0,0,function(){return""+this.hours()+_e(this.minutes(),2)}),pe("Hmmss",0,0,function(){return""+this.hours()+_e(this.minutes(),2)+_e(this.seconds(),2)});function Op(f,g){pe(f,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),g)})}Op("a",!0),Op("A",!1);function Ip(f,g){return g._meridiemParse}he("a",Ip),he("A",Ip),he("H",Ee,dl),he("h",Ee,ts),he("k",Ee,ts),he("HH",Ee,ge),he("hh",Ee,ge),he("kk",Ee,ge),he("hmm",On),he("hmmss",cl),he("Hmm",On),he("Hmmss",cl),ft(["H","HH"],Yt),ft(["k","kk"],function(f,g,w){var x=Ve(f);g[Yt]=x===24?0:x}),ft(["a","A"],function(f,g,w){w._isPm=w._locale.isPM(f),w._meridiem=f}),ft(["h","hh"],function(f,g,w){g[Yt]=Ve(f),q(w).bigHour=!0}),ft("hmm",function(f,g,w){var x=f.length-2;g[Yt]=Ve(f.substr(0,x)),g[Jr]=Ve(f.substr(x)),q(w).bigHour=!0}),ft("hmmss",function(f,g,w){var x=f.length-4,T=f.length-2;g[Yt]=Ve(f.substr(0,x)),g[Jr]=Ve(f.substr(x,2)),g[Qn]=Ve(f.substr(T)),q(w).bigHour=!0}),ft("Hmm",function(f,g,w){var x=f.length-2;g[Yt]=Ve(f.substr(0,x)),g[Jr]=Ve(f.substr(x))}),ft("Hmmss",function(f,g,w){var x=f.length-4,T=f.length-2;g[Yt]=Ve(f.substr(0,x)),g[Jr]=Ve(f.substr(x,2)),g[Qn]=Ve(f.substr(T))});function dv(f){return(f+"").toLowerCase().charAt(0)==="p"}var Pp=/[ap]\.?m?\.?/i,pv=Ls("Hours",!0);function Xt(f,g,w){return f>11?w?"pm":"PM":w?"am":"AM"}var Sl={calendar:ce,longDateFormat:vr,invalidDate:St,ordinal:Ms,dayOfMonthOrdinalParse:At,relativeTime:En,months:yp,monthsShort:bc,week:Cc,weekdays:xp,weekdaysMin:ev,weekdaysShort:Ep,meridiemParse:Pp},dt={},Bs={},ns;function Gr(f,g){var w,x=Math.min(f.length,g.length);for(w=0;w<x;w+=1)if(f[w]!==g[w])return w;return x}function Oc(f){return f&&f.toLowerCase().replace("_","-")}function kp(f){for(var g=0,w,x,T,H;g<f.length;){for(H=Oc(f[g]).split("-"),w=H.length,x=Oc(f[g+1]),x=x?x.split("-"):null;w>0;){if(T=Yo(H.slice(0,w).join("-")),T)return T;if(x&&x.length>=w&&Gr(H,x)>=w-1)break;w--}g++}return ns}function Ap(f){return!!(f&&f.match("^[^/\\\\]*$"))}function Yo(f){var g=null,w;if(dt[f]===void 0&&typeof ru<"u"&&ru&&ru.exports&&Ap(f))try{g=ns._abbr,w=_t,w("./locale/"+f),Zn(g)}catch{dt[f]=null}return dt[f]}function Zn(f,g){var w;return f&&(l(g)?w=Xn(f):w=wl(f,g),w?ns=w:typeof console<"u"&&console.warn&&console.warn("Locale "+f+" not found. Did you forget to load it?")),ns._abbr}function wl(f,g){if(g!==null){var w,x=Sl;if(g.abbr=f,dt[f]!=null)F("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),x=dt[f]._config;else if(g.parentLocale!=null)if(dt[g.parentLocale]!=null)x=dt[g.parentLocale]._config;else if(w=Yo(g.parentLocale),w!=null)x=w._config;else return Bs[g.parentLocale]||(Bs[g.parentLocale]=[]),Bs[g.parentLocale].push({name:f,config:g}),null;return dt[f]=new Q(J(x,g)),Bs[f]&&Bs[f].forEach(function(T){wl(T.name,T.config)}),Zn(f),dt[f]}else return delete dt[f],null}function Ar(f,g){if(g!=null){var w,x,T=Sl;dt[f]!=null&&dt[f].parentLocale!=null?dt[f].set(J(dt[f]._config,g)):(x=Yo(f),x!=null&&(T=x._config),g=J(T,g),x==null&&(g.abbr=f),w=new Q(g),w.parentLocale=dt[f],dt[f]=w),Zn(f)}else dt[f]!=null&&(dt[f].parentLocale!=null?(dt[f]=dt[f].parentLocale,f===Zn()&&Zn(f)):dt[f]!=null&&delete dt[f]);return dt[f]}function Xn(f){var g;if(f&&f._locale&&f._locale._abbr&&(f=f._locale._abbr),!f)return ns;if(!n(f)){if(g=Yo(f),g)return g;f=[f]}return kp(f)}function Tr(){return se(dt)}function Ic(f){var g,w=f._a;return w&&q(f).overflow===-2&&(g=w[Kn]<0||w[Kn]>11?Kn:w[Pn]<1||w[Pn]>vc(w[cr],w[Kn])?Pn:w[Yt]<0||w[Yt]>24||w[Yt]===24&&(w[Jr]!==0||w[Qn]!==0||w[rs]!==0)?Yt:w[Jr]<0||w[Jr]>59?Jr:w[Qn]<0||w[Qn]>59?Qn:w[rs]<0||w[rs]>999?rs:-1,q(f)._overflowDayOfYear&&(g<cr||g>Pn)&&(g=Pn),q(f)._overflowWeeks&&g===-1&&(g=mp),q(f)._overflowWeekday&&g===-1&&(g=By),q(f).overflow=g),f}var Tp=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ai=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_l=/Z|[+-]\d\d(?::?\d\d)?/,Vs=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],qt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ti=/^\/?Date\((-?\d+)/i,Pc=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,hv={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Rl(f){var g,w,x=f._i,T=Tp.exec(x)||Ai.exec(x),H,K,fe,qe,ze=Vs.length,er=qt.length;if(T){for(q(f).iso=!0,g=0,w=ze;g<w;g++)if(Vs[g][1].exec(T[1])){K=Vs[g][0],H=Vs[g][2]!==!1;break}if(K==null){f._isValid=!1;return}if(T[3]){for(g=0,w=er;g<w;g++)if(qt[g][1].exec(T[3])){fe=(T[2]||" ")+qt[g][0];break}if(fe==null){f._isValid=!1;return}}if(!H&&fe!=null){f._isValid=!1;return}if(T[4])if(_l.exec(T[4]))qe="Z";else{f._isValid=!1;return}f._f=K+(fe||"")+(qe||""),xl(f)}else f._isValid=!1}function mv(f,g,w,x,T,H){var K=[gv(f),bc.indexOf(g),parseInt(w,10),parseInt(x,10),parseInt(T,10)];return H&&K.push(parseInt(H,10)),K}function gv(f){var g=parseInt(f,10);return g<=49?2e3+g:g<=999?1900+g:g}function yv(f){return f.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function $p(f,g,w){if(f){var x=Ep.indexOf(f),T=new Date(g[0],g[1],g[2]).getDay();if(x!==T)return q(w).weekdayMismatch=!0,w._isValid=!1,!1}return!0}function Cl(f,g,w){if(f)return hv[f];if(g)return 0;var x=parseInt(w,10),T=x%100,H=(x-T)/100;return H*60+T}function is(f){var g=Pc.exec(yv(f._i)),w;if(g){if(w=mv(g[4],g[3],g[2],g[5],g[6],g[7]),!$p(g[1],w,f))return;f._a=w,f._tzm=Cl(g[8],g[9],g[10]),f._d=Us.apply(null,f._a),f._d.setUTCMinutes(f._d.getUTCMinutes()-f._tzm),q(f).rfc2822=!0}else f._isValid=!1}function vv(f){var g=Ti.exec(f._i);if(g!==null){f._d=new Date(+g[1]);return}if(Rl(f),f._isValid===!1)delete f._isValid;else return;if(is(f),f._isValid===!1)delete f._isValid;else return;f._strict?f._isValid=!1:e.createFromInputFallback(f)}e.createFromInputFallback=R("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(f){f._d=new Date(f._i+(f._useUTC?" UTC":""))});function ss(f,g,w){return f??g??w}function Np(f){var g=new Date(e.now());return f._useUTC?[g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()]:[g.getFullYear(),g.getMonth(),g.getDate()]}function Ko(f){var g,w,x=[],T,H,K;if(!f._d){for(T=Np(f),f._w&&f._a[Pn]==null&&f._a[Kn]==null&&kc(f),f._dayOfYear!=null&&(K=ss(f._a[cr],T[cr]),(f._dayOfYear>Vo(K)||f._dayOfYear===0)&&(q(f)._overflowDayOfYear=!0),w=Us(K,0,f._dayOfYear),f._a[Kn]=w.getUTCMonth(),f._a[Pn]=w.getUTCDate()),g=0;g<3&&f._a[g]==null;++g)f._a[g]=x[g]=T[g];for(;g<7;g++)f._a[g]=x[g]=f._a[g]==null?g===2?1:0:f._a[g];f._a[Yt]===24&&f._a[Jr]===0&&f._a[Qn]===0&&f._a[rs]===0&&(f._nextDay=!0,f._a[Yt]=0),f._d=(f._useUTC?Us:Zy).apply(null,x),H=f._useUTC?f._d.getUTCDay():f._d.getDay(),f._tzm!=null&&f._d.setUTCMinutes(f._d.getUTCMinutes()-f._tzm),f._nextDay&&(f._a[Yt]=24),f._w&&typeof f._w.d<"u"&&f._w.d!==H&&(q(f).weekdayMismatch=!0)}}function kc(f){var g,w,x,T,H,K,fe,qe,ze;g=f._w,g.GG!=null||g.W!=null||g.E!=null?(H=1,K=4,w=ss(g.GG,f._a[cr],Go(yt(),1,4).year),x=ss(g.W,1),T=ss(g.E,1),(T<1||T>7)&&(qe=!0)):(H=f._locale._week.dow,K=f._locale._week.doy,ze=Go(yt(),H,K),w=ss(g.gg,f._a[cr],ze.year),x=ss(g.w,ze.week),g.d!=null?(T=g.d,(T<0||T>6)&&(qe=!0)):g.e!=null?(T=g.e+H,(g.e<0||g.e>6)&&(qe=!0)):T=H),x<1||x>kn(w,H,K)?q(f)._overflowWeeks=!0:qe!=null?q(f)._overflowWeekday=!0:(fe=vl(w,x,T,H,K),f._a[cr]=fe.year,f._dayOfYear=fe.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function xl(f){if(f._f===e.ISO_8601){Rl(f);return}if(f._f===e.RFC_2822){is(f);return}f._a=[],q(f).empty=!0;var g=""+f._i,w,x,T,H,K,fe=g.length,qe=0,ze,er;for(T=kr(f._f,f._locale).match(me)||[],er=T.length,w=0;w<er;w++)H=T[w],x=(g.match(Uy(H,f))||[])[0],x&&(K=g.substr(0,g.indexOf(x)),K.length>0&&q(f).unusedInput.push(K),g=g.slice(g.indexOf(x)+x.length),qe+=x.length),Nt[H]?(x?q(f).empty=!1:q(f).unusedTokens.push(H),yc(H,x,f)):f._strict&&!x&&q(f).unusedTokens.push(H);q(f).charsLeftOver=fe-qe,g.length>0&&q(f).unusedInput.push(g),f._a[Yt]<=12&&q(f).bigHour===!0&&f._a[Yt]>0&&(q(f).bigHour=void 0),q(f).parsedDateParts=f._a.slice(0),q(f).meridiem=f._meridiem,f._a[Yt]=bv(f._locale,f._a[Yt],f._meridiem),ze=q(f).era,ze!==null&&(f._a[cr]=f._locale.erasConvertYear(ze,f._a[cr])),Ko(f),Ic(f)}function bv(f,g,w){var x;return w==null?g:f.meridiemHour!=null?f.meridiemHour(g,w):(f.isPM!=null&&(x=f.isPM(w),x&&g<12&&(g+=12),!x&&g===12&&(g=0)),g)}function Ac(f){var g,w,x,T,H,K,fe=!1,qe=f._f.length;if(qe===0){q(f).invalidFormat=!0,f._d=new Date(NaN);return}for(T=0;T<qe;T++)H=0,K=!1,g=O({},f),f._useUTC!=null&&(g._useUTC=f._useUTC),g._f=f._f[T],xl(g),v(g)&&(K=!0),H+=q(g).charsLeftOver,H+=q(g).unusedTokens.length*10,q(g).score=H,fe?H<x&&(x=H,w=g):(x==null||H<x||K)&&(x=H,w=g,K&&(fe=!0));m(f,w||g)}function Tc(f){if(!f._d){var g=ve(f._i),w=g.day===void 0?g.date:g.day;f._a=p([g.year,g.month,w,g.hour,g.minute,g.second,g.millisecond],function(x){return x&&parseInt(x,10)}),Ko(f)}}function Sv(f){var g=new M(Ic($c(f)));return g._nextDay&&(g.add(1,"d"),g._nextDay=void 0),g}function $c(f){var g=f._i,w=f._f;return f._locale=f._locale||Xn(f._l),g===null||w===void 0&&g===""?_({nullInput:!0}):(typeof g=="string"&&(f._i=g=f._locale.preparse(g)),j(g)?new M(Ic(g)):(d(g)?f._d=g:n(w)?Ac(f):w?xl(f):$r(f),v(f)||(f._d=null),f))}function $r(f){var g=f._i;l(g)?f._d=new Date(e.now()):d(g)?f._d=new Date(g.valueOf()):typeof g=="string"?vv(f):n(g)?(f._a=p(g.slice(0),function(w){return parseInt(w,10)}),Ko(f)):i(g)?Tc(f):c(g)?f._d=new Date(g):e.createFromInputFallback(f)}function El(f,g,w,x,T){var H={};return(g===!0||g===!1)&&(x=g,g=void 0),(w===!0||w===!1)&&(x=w,w=void 0),(i(f)&&o(f)||n(f)&&f.length===0)&&(f=void 0),H._isAMomentObject=!0,H._useUTC=H._isUTC=T,H._l=w,H._i=f,H._f=g,H._strict=x,Sv(H)}function yt(f,g,w,x){return El(f,g,w,x,!1)}var Mp=R("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var f=yt.apply(null,arguments);return this.isValid()&&f.isValid()?f<this?this:f:_()}),Fp=R("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var f=yt.apply(null,arguments);return this.isValid()&&f.isValid()?f>this?this:f:_()});function Dp(f,g){var w,x;if(g.length===1&&n(g[0])&&(g=g[0]),!g.length)return yt();for(w=g[0],x=1;x<g.length;++x)(!g[x].isValid()||g[x][f](w))&&(w=g[x]);return w}function wv(){var f=[].slice.call(arguments,0);return Dp("isBefore",f)}function _v(){var f=[].slice.call(arguments,0);return Dp("isAfter",f)}var Rv=function(){return Date.now?Date.now():+new Date},Qo=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ws(f){var g,w=!1,x,T=Qo.length;for(g in f)if(s(f,g)&&!(Lt.call(Qo,g)!==-1&&(f[g]==null||!isNaN(f[g]))))return!1;for(x=0;x<T;++x)if(f[Qo[x]]){if(w)return!1;parseFloat(f[Qo[x]])!==Ve(f[Qo[x]])&&(w=!0)}return!0}function Cv(){return this._isValid}function xv(){return vt(NaN)}function zs(f){var g=ve(f),w=g.year||0,x=g.quarter||0,T=g.month||0,H=g.week||g.isoWeek||0,K=g.day||0,fe=g.hour||0,qe=g.minute||0,ze=g.second||0,er=g.millisecond||0;this._isValid=Ws(g),this._milliseconds=+er+ze*1e3+qe*6e4+fe*1e3*60*60,this._days=+K+H*7,this._months=+T+x*3+w*12,this._data={},this._locale=Xn(),this._bubble()}function Zo(f){return f instanceof zs}function An(f){return f<0?Math.round(-1*f)*-1:Math.round(f)}function ql(f,g,w){var x=Math.min(f.length,g.length),T=Math.abs(f.length-g.length),H=0,K;for(K=0;K<x;K++)(w&&f[K]!==g[K]||!w&&Ve(f[K])!==Ve(g[K]))&&H++;return H+T}function jp(f,g){pe(f,0,0,function(){var w=this.utcOffset(),x="+";return w<0&&(w=-w,x="-"),x+_e(~~(w/60),2)+g+_e(~~w%60,2)})}jp("Z",":"),jp("ZZ",""),he("Z",fl),he("ZZ",fl),ft(["Z","ZZ"],function(f,g,w){w._useUTC=!0,w._tzm=Nc(fl,f)});var Ev=/([\+\-]|\d\d)/gi;function Nc(f,g){var w=(g||"").match(f),x,T,H;return w===null?null:(x=w[w.length-1]||[],T=(x+"").match(Ev)||["-",0,0],H=+(T[1]*60)+Ve(T[2]),H===0?0:T[0]==="+"?H:-H)}function $i(f,g){var w,x;return g._isUTC?(w=g.clone(),x=(j(f)||d(f)?f.valueOf():yt(f).valueOf())-w.valueOf(),w._d.setTime(w._d.valueOf()+x),e.updateOffset(w,!1),w):yt(f).local()}function Nr(f){return-Math.round(f._d.getTimezoneOffset())}e.updateOffset=function(){};function Lp(f,g,w){var x=this._offset||0,T;if(!this.isValid())return f!=null?this:NaN;if(f!=null){if(typeof f=="string"){if(f=Nc(fl,f),f===null)return this}else Math.abs(f)<16&&!w&&(f=f*60);return!this._isUTC&&g&&(T=Nr(this)),this._offset=f,this._isUTC=!0,T!=null&&this.add(T,"m"),x!==f&&(!g||this._changeInProgress?Xo(this,vt(f-x,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?x:Nr(this)}function qv(f,g){return f!=null?(typeof f!="string"&&(f=-f),this.utcOffset(f,g),this):-this.utcOffset()}function Ov(f){return this.utcOffset(0,f)}function Iv(f){return this._isUTC&&(this.utcOffset(0,f),this._isUTC=!1,f&&this.subtract(Nr(this),"m")),this}function Pv(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var f=Nc(mc,this._i);f!=null?this.utcOffset(f):this.utcOffset(0,!0)}return this}function kv(f){return this.isValid()?(f=f?yt(f).utcOffset():0,(this.utcOffset()-f)%60===0):!1}function Ni(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function W(){if(!l(this._isDSTShifted))return this._isDSTShifted;var f={},g;return O(f,this),f=$c(f),f._a?(g=f._isUTC?y(f._a):yt(f._a),this._isDSTShifted=this.isValid()&&ql(f._a,g.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Z(){return this.isValid()?!this._isUTC:!1}function Y(){return this.isValid()?this._isUTC:!1}function de(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Oe=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,ut=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function vt(f,g){var w=f,x=null,T,H,K;return Zo(f)?w={ms:f._milliseconds,d:f._days,M:f._months}:c(f)||!isNaN(+f)?(w={},g?w[g]=+f:w.milliseconds=+f):(x=Oe.exec(f))?(T=x[1]==="-"?-1:1,w={y:0,d:Ve(x[Pn])*T,h:Ve(x[Yt])*T,m:Ve(x[Jr])*T,s:Ve(x[Qn])*T,ms:Ve(An(x[rs]*1e3))*T}):(x=ut.exec(f))?(T=x[1]==="-"?-1:1,w={y:Xe(x[2],T),M:Xe(x[3],T),w:Xe(x[4],T),d:Xe(x[5],T),h:Xe(x[6],T),m:Xe(x[7],T),s:Xe(x[8],T)}):w==null?w={}:typeof w=="object"&&("from"in w||"to"in w)&&(K=Av(yt(w.from),yt(w.to)),w={},w.ms=K.milliseconds,w.M=K.months),H=new zs(w),Zo(f)&&s(f,"_locale")&&(H._locale=f._locale),Zo(f)&&s(f,"_isValid")&&(H._isValid=f._isValid),H}vt.fn=zs.prototype,vt.invalid=xv;function Xe(f,g){var w=f&&parseFloat(f.replace(",","."));return(isNaN(w)?0:w)*g}function Ol(f,g){var w={};return w.months=g.month()-f.month()+(g.year()-f.year())*12,f.clone().add(w.months,"M").isAfter(g)&&--w.months,w.milliseconds=+g-+f.clone().add(w.months,"M"),w}function Av(f,g){var w;return f.isValid()&&g.isValid()?(g=$i(g,f),f.isBefore(g)?w=Ol(f,g):(w=Ol(g,f),w.milliseconds=-w.milliseconds,w.months=-w.months),w):{milliseconds:0,months:0}}function Mr(f,g){return function(w,x){var T,H;return x!==null&&!isNaN(+x)&&(F(g,"moment()."+g+"(period, number) is deprecated. Please use moment()."+g+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),H=w,w=x,x=H),T=vt(w,x),Xo(this,T,f),this}}function Xo(f,g,w,x){var T=g._milliseconds,H=An(g._days),K=An(g._months);f.isValid()&&(x=x??!0,K&&wc(f,Wo(f,"Month")+K*w),H&&zo(f,"Date",Wo(f,"Date")+H*w),T&&f._d.setTime(f._d.valueOf()+T*w),x&&e.updateOffset(f,H||K))}var Tv=Mr(1,"add"),Js=Mr(-1,"subtract");function ea(f){return typeof f=="string"||f instanceof String}function Il(f){return j(f)||d(f)||ea(f)||c(f)||$v(f)||pt(f)||f===null||f===void 0}function pt(f){var g=i(f)&&!o(f),w=!1,x=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],T,H,K=x.length;for(T=0;T<K;T+=1)H=x[T],w=w||s(f,H);return g&&w}function $v(f){var g=n(f),w=!1;return g&&(w=f.filter(function(x){return!c(x)&&ea(f)}).length===0),g&&w}function Up(f){var g=i(f)&&!o(f),w=!1,x=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],T,H;for(T=0;T<x.length;T+=1)H=x[T],w=w||s(f,H);return g&&w}function Pl(f,g){var w=f.diff(g,"days",!0);return w<-6?"sameElse":w<-1?"lastWeek":w<0?"lastDay":w<1?"sameDay":w<2?"nextDay":w<7?"nextWeek":"sameElse"}function Nv(f,g){arguments.length===1&&(arguments[0]?Il(arguments[0])?(f=arguments[0],g=void 0):Up(arguments[0])&&(g=arguments[0],f=void 0):(f=void 0,g=void 0));var w=f||yt(),x=$i(w,this).startOf("day"),T=e.calendarFormat(this,x)||"sameElse",H=g&&(U(g[T])?g[T].call(this,w):g[T]);return this.format(H||this.localeData().calendar(T,this,yt(w)))}function Mv(){return new M(this)}function Fv(f,g){var w=j(f)?f:yt(f);return this.isValid()&&w.isValid()?(g=ye(g)||"millisecond",g==="millisecond"?this.valueOf()>w.valueOf():w.valueOf()<this.clone().startOf(g).valueOf()):!1}function kl(f,g){var w=j(f)?f:yt(f);return this.isValid()&&w.isValid()?(g=ye(g)||"millisecond",g==="millisecond"?this.valueOf()<w.valueOf():this.clone().endOf(g).valueOf()<w.valueOf()):!1}function Mi(f,g,w,x){var T=j(f)?f:yt(f),H=j(g)?g:yt(g);return this.isValid()&&T.isValid()&&H.isValid()?(x=x||"()",(x[0]==="("?this.isAfter(T,w):!this.isBefore(T,w))&&(x[1]===")"?this.isBefore(H,w):!this.isAfter(H,w))):!1}function Al(f,g){var w=j(f)?f:yt(f),x;return this.isValid()&&w.isValid()?(g=ye(g)||"millisecond",g==="millisecond"?this.valueOf()===w.valueOf():(x=w.valueOf(),this.clone().startOf(g).valueOf()<=x&&x<=this.clone().endOf(g).valueOf())):!1}function Hp(f,g){return this.isSame(f,g)||this.isAfter(f,g)}function Tl(f,g){return this.isSame(f,g)||this.isBefore(f,g)}function Bp(f,g,w){var x,T,H;if(!this.isValid())return NaN;if(x=$i(f,this),!x.isValid())return NaN;switch(T=(x.utcOffset()-this.utcOffset())*6e4,g=ye(g),g){case"year":H=ta(this,x)/12;break;case"month":H=ta(this,x);break;case"quarter":H=ta(this,x)/3;break;case"second":H=(this-x)/1e3;break;case"minute":H=(this-x)/6e4;break;case"hour":H=(this-x)/36e5;break;case"day":H=(this-x-T)/864e5;break;case"week":H=(this-x-T)/6048e5;break;default:H=this-x}return w?H:zr(H)}function ta(f,g){if(f.date()<g.date())return-ta(g,f);var w=(g.year()-f.year())*12+(g.month()-f.month()),x=f.clone().add(w,"months"),T,H;return g-x<0?(T=f.clone().add(w-1,"months"),H=(g-x)/(x-T)):(T=f.clone().add(w+1,"months"),H=(g-x)/(T-x)),-(w+H)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function $l(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function Vp(f){if(!this.isValid())return null;var g=f!==!0,w=g?this.clone().utc():this;return w.year()<0||w.year()>9999?lt(w,g?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):U(Date.prototype.toISOString)?g?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",lt(w,"Z")):lt(w,g?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function ra(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var f="moment",g="",w,x,T,H;return this.isLocal()||(f=this.utcOffset()===0?"moment.utc":"moment.parseZone",g="Z"),w="["+f+'("]',x=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",T="-MM-DD[T]HH:mm:ss.SSS",H=g+'[")]',this.format(w+x+T+H)}function os(f){f||(f=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var g=lt(this,f);return this.localeData().postformat(g)}function Nl(f,g){return this.isValid()&&(j(f)&&f.isValid()||yt(f).isValid())?vt({to:this,from:f}).locale(this.locale()).humanize(!g):this.localeData().invalidDate()}function Dv(f){return this.from(yt(),f)}function jv(f,g){return this.isValid()&&(j(f)&&f.isValid()||yt(f).isValid())?vt({from:this,to:f}).locale(this.locale()).humanize(!g):this.localeData().invalidDate()}function Lv(f){return this.to(yt(),f)}function na(f){var g;return f===void 0?this._locale._abbr:(g=Xn(f),g!=null&&(this._locale=g),this)}var ia=R("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(f){return f===void 0?this.localeData():this.locale(f)});function Ml(){return this._locale}var Fl=1e3,as=60*Fl,Dl=60*as,Wp=(365*400+97)*24*Dl;function Tt(f,g){return(f%g+g)%g}function ir(f,g,w){return f<100&&f>=0?new Date(f+400,g,w)-Wp:new Date(f,g,w).valueOf()}function zp(f,g,w){return f<100&&f>=0?Date.UTC(f+400,g,w)-Wp:Date.UTC(f,g,w)}function Uv(f){var g,w;if(f=ye(f),f===void 0||f==="millisecond"||!this.isValid())return this;switch(w=this._isUTC?zp:ir,f){case"year":g=w(this.year(),0,1);break;case"quarter":g=w(this.year(),this.month()-this.month()%3,1);break;case"month":g=w(this.year(),this.month(),1);break;case"week":g=w(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":g=w(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":g=w(this.year(),this.month(),this.date());break;case"hour":g=this._d.valueOf(),g-=Tt(g+(this._isUTC?0:this.utcOffset()*as),Dl);break;case"minute":g=this._d.valueOf(),g-=Tt(g,as);break;case"second":g=this._d.valueOf(),g-=Tt(g,Fl);break}return this._d.setTime(g),e.updateOffset(this,!0),this}function Jp(f){var g,w;if(f=ye(f),f===void 0||f==="millisecond"||!this.isValid())return this;switch(w=this._isUTC?zp:ir,f){case"year":g=w(this.year()+1,0,1)-1;break;case"quarter":g=w(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":g=w(this.year(),this.month()+1,1)-1;break;case"week":g=w(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":g=w(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":g=w(this.year(),this.month(),this.date()+1)-1;break;case"hour":g=this._d.valueOf(),g+=Dl-Tt(g+(this._isUTC?0:this.utcOffset()*as),Dl)-1;break;case"minute":g=this._d.valueOf(),g+=as-Tt(g,as)-1;break;case"second":g=this._d.valueOf(),g+=Fl-Tt(g,Fl)-1;break}return this._d.setTime(g),e.updateOffset(this,!0),this}function Hv(){return this._d.valueOf()-(this._offset||0)*6e4}function Mc(){return Math.floor(this.valueOf()/1e3)}function sa(){return new Date(this.valueOf())}function Fc(){var f=this;return[f.year(),f.month(),f.date(),f.hour(),f.minute(),f.second(),f.millisecond()]}function Gs(){var f=this;return{years:f.year(),months:f.month(),date:f.date(),hours:f.hours(),minutes:f.minutes(),seconds:f.seconds(),milliseconds:f.milliseconds()}}function oa(){return this.isValid()?this.toISOString():null}function aa(){return v(this)}function jl(){return m({},q(this))}function Ys(){return q(this).overflow}function Bv(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}pe("N",0,0,"eraAbbr"),pe("NN",0,0,"eraAbbr"),pe("NNN",0,0,"eraAbbr"),pe("NNNN",0,0,"eraName"),pe("NNNNN",0,0,"eraNarrow"),pe("y",["y",1],"yo","eraYear"),pe("y",["yy",2],0,"eraYear"),pe("y",["yyy",3],0,"eraYear"),pe("y",["yyyy",4],0,"eraYear"),he("N",br),he("NN",br),he("NNN",br),he("NNNN",We),he("NNNNN",Gv),ft(["N","NN","NNN","NNNN","NNNNN"],function(f,g,w,x){var T=w._locale.erasParse(f,x,w._strict);T?q(w).era=T:q(w).invalidEra=f}),he("y",ki),he("yy",ki),he("yyy",ki),he("yyyy",ki),he("yo",Yv),ft(["y","yy","yyy","yyyy"],cr),ft(["yo"],function(f,g,w,x){var T;w._locale._eraYearOrdinalRegex&&(T=f.match(w._locale._eraYearOrdinalRegex)),w._locale.eraYearOrdinalParse?g[cr]=w._locale.eraYearOrdinalParse(f,T):g[cr]=parseInt(f,10)});function Vv(f,g){var w,x,T,H=this._eras||Xn("en")._eras;for(w=0,x=H.length;w<x;++w)switch(typeof H[w].since==="string"&&(T=e(H[w].since).startOf("day"),H[w].since=T.valueOf()),typeof H[w].until){case"undefined":H[w].until=1/0;break;case"string":T=e(H[w].until).startOf("day").valueOf(),H[w].until=T.valueOf();break}return H}function Wv(f,g,w){var x,T,H=this.eras(),K,fe,qe;for(f=f.toUpperCase(),x=0,T=H.length;x<T;++x)if(K=H[x].name.toUpperCase(),fe=H[x].abbr.toUpperCase(),qe=H[x].narrow.toUpperCase(),w)switch(g){case"N":case"NN":case"NNN":if(fe===f)return H[x];break;case"NNNN":if(K===f)return H[x];break;case"NNNNN":if(qe===f)return H[x];break}else if([K,fe,qe].indexOf(f)>=0)return H[x]}function zv(f,g){var w=f.since<=f.until?1:-1;return g===void 0?e(f.since).year():e(f.since).year()+(g-f.offset)*w}function Jv(){var f,g,w,x=this.localeData().eras();for(f=0,g=x.length;f<g;++f)if(w=this.clone().startOf("day").valueOf(),x[f].since<=w&&w<=x[f].until||x[f].until<=w&&w<=x[f].since)return x[f].name;return""}function Ll(){var f,g,w,x=this.localeData().eras();for(f=0,g=x.length;f<g;++f)if(w=this.clone().startOf("day").valueOf(),x[f].since<=w&&w<=x[f].until||x[f].until<=w&&w<=x[f].since)return x[f].narrow;return""}function la(){var f,g,w,x=this.localeData().eras();for(f=0,g=x.length;f<g;++f)if(w=this.clone().startOf("day").valueOf(),x[f].since<=w&&w<=x[f].until||x[f].until<=w&&w<=x[f].since)return x[f].abbr;return""}function Gp(){var f,g,w,x,T=this.localeData().eras();for(f=0,g=T.length;f<g;++f)if(w=T[f].since<=T[f].until?1:-1,x=this.clone().startOf("day").valueOf(),T[f].since<=x&&x<=T[f].until||T[f].until<=x&&x<=T[f].since)return(this.year()-e(T[f].since).year())*w+T[f].offset;return this.year()}function $(f){return s(this,"_erasNameRegex")||Dc.call(this),f?this._erasNameRegex:this._erasRegex}function Ks(f){return s(this,"_erasAbbrRegex")||Dc.call(this),f?this._erasAbbrRegex:this._erasRegex}function Ul(f){return s(this,"_erasNarrowRegex")||Dc.call(this),f?this._erasNarrowRegex:this._erasRegex}function br(f,g){return g.erasAbbrRegex(f)}function We(f,g){return g.erasNameRegex(f)}function Gv(f,g){return g.erasNarrowRegex(f)}function Yv(f,g){return g._eraYearOrdinalRegex||ki}function Dc(){var f=[],g=[],w=[],x=[],T,H,K,fe,qe,ze=this.eras();for(T=0,H=ze.length;T<H;++T)K=In(ze[T].name),fe=In(ze[T].abbr),qe=In(ze[T].narrow),g.push(K),f.push(fe),w.push(qe),x.push(K),x.push(fe),x.push(qe);this._erasRegex=new RegExp("^("+x.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+g.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+f.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+w.join("|")+")","i")}pe(0,["gg",2],0,function(){return this.weekYear()%100}),pe(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Tn(f,g){pe(0,[f,f.length],0,g)}Tn("gggg","weekYear"),Tn("ggggg","weekYear"),Tn("GGGG","isoWeekYear"),Tn("GGGGG","isoWeekYear"),he("G",js),he("g",js),he("GG",Ee,ge),he("gg",Ee,ge),he("GGGG",Uo,fn),he("gggg",Uo,fn),he("GGGGG",Ds,gt),he("ggggg",Ds,gt),Bo(["gggg","ggggg","GGGG","GGGGG"],function(f,g,w,x){g[x.substr(0,2)]=Ve(f)}),Bo(["gg","GG"],function(f,g,w,x){g[x]=e.parseTwoDigitYear(f)});function Kv(f){return Yp.call(this,f,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function Qv(f){return Yp.call(this,f,this.isoWeek(),this.isoWeekday(),1,4)}function Zv(){return kn(this.year(),1,4)}function Xv(){return kn(this.isoWeekYear(),1,4)}function eb(){var f=this.localeData()._week;return kn(this.year(),f.dow,f.doy)}function ei(){var f=this.localeData()._week;return kn(this.weekYear(),f.dow,f.doy)}function Yp(f,g,w,x,T){var H;return f==null?Go(this,x,T).year:(H=kn(f,x,T),g>H&&(g=H),tb.call(this,f,g,w,x,T))}function tb(f,g,w,x,T){var H=vl(f,g,w,x,T),K=Us(H.year,0,H.dayOfYear);return this.year(K.getUTCFullYear()),this.month(K.getUTCMonth()),this.date(K.getUTCDate()),this}pe("Q",0,"Qo","quarter"),he("Q",Ae),ft("Q",function(f,g){g[Kn]=(Ve(f)-1)*3});function rb(f){return f==null?Math.ceil((this.month()+1)/3):this.month((f-1)*3+this.month()%3)}pe("D",["DD",2],"Do","date"),he("D",Ee,ts),he("DD",Ee,ge),he("Do",function(f,g){return f?g._dayOfMonthOrdinalParse||g._ordinalParse:g._dayOfMonthOrdinalParseLenient}),ft(["D","DD"],Pn),ft("Do",function(f,g){g[Pn]=Ve(f.match(Ee)[0])});var Kp=Ls("Date",!0);pe("DDD",["DDDD",3],"DDDo","dayOfYear"),he("DDD",Fs),he("DDDD",qn),ft(["DDD","DDDD"],function(f,g,w){w._dayOfYear=Ve(f)});function nb(f){var g=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return f==null?g:this.add(f-g,"d")}pe("m",["mm",2],0,"minute"),he("m",Ee,dl),he("mm",Ee,ge),ft(["m","mm"],Jr);var ti=Ls("Minutes",!1);pe("s",["ss",2],0,"second"),he("s",Ee,dl),he("ss",Ee,ge),ft(["s","ss"],Qn);var ib=Ls("Seconds",!1);pe("S",0,0,function(){return~~(this.millisecond()/100)}),pe(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),pe(0,["SSS",3],0,"millisecond"),pe(0,["SSSS",4],0,function(){return this.millisecond()*10}),pe(0,["SSSSS",5],0,function(){return this.millisecond()*100}),pe(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),pe(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),pe(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),pe(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),he("S",Fs,Ae),he("SS",Fs,ge),he("SSS",Fs,qn);var Fi,Qp;for(Fi="SSSS";Fi.length<=9;Fi+="S")he(Fi,ki);function sb(f,g){g[rs]=Ve(("0."+f)*1e3)}for(Fi="S";Fi.length<=9;Fi+="S")ft(Fi,sb);Qp=Ls("Milliseconds",!1),pe("z",0,0,"zoneAbbr"),pe("zz",0,0,"zoneName");function ob(){return this._isUTC?"UTC":""}function ls(){return this._isUTC?"Coordinated Universal Time":""}var ie=M.prototype;ie.add=Tv,ie.calendar=Nv,ie.clone=Mv,ie.diff=Bp,ie.endOf=Jp,ie.format=os,ie.from=Nl,ie.fromNow=Dv,ie.to=jv,ie.toNow=Lv,ie.get=Wy,ie.invalidAt=Ys,ie.isAfter=Fv,ie.isBefore=kl,ie.isBetween=Mi,ie.isSame=Al,ie.isSameOrAfter=Hp,ie.isSameOrBefore=Tl,ie.isValid=aa,ie.lang=ia,ie.locale=na,ie.localeData=Ml,ie.max=Fp,ie.min=Mp,ie.parsingFlags=jl,ie.set=ml,ie.startOf=Uv,ie.subtract=Js,ie.toArray=Fc,ie.toObject=Gs,ie.toDate=sa,ie.toISOString=Vp,ie.inspect=ra,typeof Symbol<"u"&&Symbol.for!=null&&(ie[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),ie.toJSON=oa,ie.toString=$l,ie.unix=Mc,ie.valueOf=Hv,ie.creationData=Bv,ie.eraName=Jv,ie.eraNarrow=Ll,ie.eraAbbr=la,ie.eraYear=Gp,ie.year=gp,ie.isLeapYear=Vy,ie.weekYear=Kv,ie.isoWeekYear=Qv,ie.quarter=ie.quarters=rb,ie.month=gl,ie.daysInMonth=Qy,ie.week=ie.weeks=_p,ie.isoWeek=ie.isoWeeks=Xy,ie.weeksInYear=eb,ie.weeksInWeekYear=ei,ie.isoWeeksInYear=Zv,ie.isoWeeksInISOWeekYear=Xv,ie.date=Kp,ie.day=ie.days=av,ie.weekday=lv,ie.isoWeekday=uv,ie.dayOfYear=nb,ie.hour=ie.hours=pv,ie.minute=ie.minutes=ti,ie.second=ie.seconds=ib,ie.millisecond=ie.milliseconds=Qp,ie.utcOffset=Lp,ie.utc=Ov,ie.local=Iv,ie.parseZone=Pv,ie.hasAlignedHourOffset=kv,ie.isDST=Ni,ie.isLocal=Z,ie.isUtcOffset=Y,ie.isUtc=de,ie.isUTC=de,ie.zoneAbbr=ob,ie.zoneName=ls,ie.dates=R("dates accessor is deprecated. Use date instead.",Kp),ie.months=R("months accessor is deprecated. Use month instead",gl),ie.years=R("years accessor is deprecated. Use year instead",gp),ie.zone=R("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",qv),ie.isDSTShifted=R("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",W);function ab(f){return yt(f*1e3)}function dn(){return yt.apply(null,arguments).parseZone()}function Zp(f){return f}var rt=Q.prototype;rt.calendar=Be,rt.longDateFormat=Ct,rt.invalidDate=Wr,rt.ordinal=Pi,rt.preparse=Zp,rt.postformat=Zp,rt.relativeTime=te,rt.pastFuture=ne,rt.set=D,rt.eras=Vv,rt.erasParse=Wv,rt.erasConvertYear=zv,rt.erasAbbrRegex=Ks,rt.erasNameRegex=$,rt.erasNarrowRegex=Ul,rt.months=Yy,rt.monthsShort=Ky,rt.monthsParse=bp,rt.monthsRegex=yl,rt.monthsShortRegex=Sp,rt.week=Rc,rt.firstDayOfYear=wp,rt.firstDayOfWeek=Hs,rt.weekdays=nv,rt.weekdaysMin=sv,rt.weekdaysShort=iv,rt.weekdaysParse=ov,rt.weekdaysRegex=cv,rt.weekdaysShortRegex=It,rt.weekdaysMinRegex=Et,rt.isPM=dv,rt.meridiem=Xt;function Hl(f,g,w,x){var T=Xn(),H=y().set(x,g);return T[w](H,f)}function Xp(f,g,w){if(c(f)&&(g=f,f=void 0),f=f||"",g!=null)return Hl(f,g,w,"month");var x,T=[];for(x=0;x<12;x++)T[x]=Hl(f,x,w,"month");return T}function jc(f,g,w,x){typeof f=="boolean"?(c(g)&&(w=g,g=void 0),g=g||""):(g=f,w=g,f=!1,c(g)&&(w=g,g=void 0),g=g||"");var T=Xn(),H=f?T._week.dow:0,K,fe=[];if(w!=null)return Hl(g,(w+H)%7,x,"day");for(K=0;K<7;K++)fe[K]=Hl(g,(K+H)%7,x,"day");return fe}function eh(f,g){return Xp(f,g,"months")}function th(f,g){return Xp(f,g,"monthsShort")}function lb(f,g,w){return jc(f,g,w,"weekdays")}function ub(f,g,w){return jc(f,g,w,"weekdaysShort")}function Lc(f,g,w){return jc(f,g,w,"weekdaysMin")}Zn("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(f){var g=f%10,w=Ve(f%100/10)===1?"th":g===1?"st":g===2?"nd":g===3?"rd":"th";return f+w}}),e.lang=R("moment.lang is deprecated. Use moment.locale instead.",Zn),e.langData=R("moment.langData is deprecated. Use moment.localeData instead.",Xn);var Fr=Math.abs;function Bl(){var f=this._data;return this._milliseconds=Fr(this._milliseconds),this._days=Fr(this._days),this._months=Fr(this._months),f.milliseconds=Fr(f.milliseconds),f.seconds=Fr(f.seconds),f.minutes=Fr(f.minutes),f.hours=Fr(f.hours),f.months=Fr(f.months),f.years=Fr(f.years),this}function rh(f,g,w,x){var T=vt(g,w);return f._milliseconds+=x*T._milliseconds,f._days+=x*T._days,f._months+=x*T._months,f._bubble()}function nh(f,g){return rh(this,f,g,1)}function cb(f,g){return rh(this,f,g,-1)}function pn(f){return f<0?Math.floor(f):Math.ceil(f)}function Uc(){var f=this._milliseconds,g=this._days,w=this._months,x=this._data,T,H,K,fe,qe;return f>=0&&g>=0&&w>=0||f<=0&&g<=0&&w<=0||(f+=pn(Sr(w)+g)*864e5,g=0,w=0),x.milliseconds=f%1e3,T=zr(f/1e3),x.seconds=T%60,H=zr(T/60),x.minutes=H%60,K=zr(H/60),x.hours=K%24,g+=zr(K/24),qe=zr(Di(g)),w+=qe,g-=pn(Sr(qe)),fe=zr(w/12),w%=12,x.days=g,x.months=w,x.years=fe,this}function Di(f){return f*4800/146097}function Sr(f){return f*146097/4800}function fb(f){if(!this.isValid())return NaN;var g,w,x=this._milliseconds;if(f=ye(f),f==="month"||f==="quarter"||f==="year")switch(g=this._days+x/864e5,w=this._months+Di(g),f){case"month":return w;case"quarter":return w/3;case"year":return w/12}else switch(g=this._days+Math.round(Sr(this._months)),f){case"week":return g/7+x/6048e5;case"day":return g+x/864e5;case"hour":return g*24+x/36e5;case"minute":return g*1440+x/6e4;case"second":return g*86400+x/1e3;case"millisecond":return Math.floor(g*864e5)+x;default:throw new Error("Unknown unit "+f)}}function $n(f){return function(){return this.as(f)}}var Hc=$n("ms"),ua=$n("s"),ji=$n("m"),ih=$n("h"),db=$n("d"),Vl=$n("w"),pb=$n("M"),sh=$n("Q"),sr=$n("y"),Bc=Hc;function oh(){return vt(this)}function Nn(f){return f=ye(f),this.isValid()?this[f+"s"]():NaN}function ri(f){return function(){return this.isValid()?this._data[f]:NaN}}var Wl=ri("milliseconds"),us=ri("seconds"),ah=ri("minutes"),dr=ri("hours"),Vc=ri("days"),hb=ri("months"),mb=ri("years");function gb(){return zr(this.days()/7)}var hn=Math.round,Qs={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function ca(f,g,w,x,T){return T.relativeTime(g||1,!!w,f,x)}function lh(f,g,w,x){var T=vt(f).abs(),H=hn(T.as("s")),K=hn(T.as("m")),fe=hn(T.as("h")),qe=hn(T.as("d")),ze=hn(T.as("M")),er=hn(T.as("w")),ni=hn(T.as("y")),ii=H<=w.ss&&["s",H]||H<w.s&&["ss",H]||K<=1&&["m"]||K<w.m&&["mm",K]||fe<=1&&["h"]||fe<w.h&&["hh",fe]||qe<=1&&["d"]||qe<w.d&&["dd",qe];return w.w!=null&&(ii=ii||er<=1&&["w"]||er<w.w&&["ww",er]),ii=ii||ze<=1&&["M"]||ze<w.M&&["MM",ze]||ni<=1&&["y"]||["yy",ni],ii[2]=g,ii[3]=+f>0,ii[4]=x,ca.apply(null,ii)}function yb(f){return f===void 0?hn:typeof f=="function"?(hn=f,!0):!1}function vb(f,g){return Qs[f]===void 0?!1:g===void 0?Qs[f]:(Qs[f]=g,f==="s"&&(Qs.ss=g-1),!0)}function fa(f,g){if(!this.isValid())return this.localeData().invalidDate();var w=!1,x=Qs,T,H;return typeof f=="object"&&(g=f,f=!1),typeof f=="boolean"&&(w=f),typeof g=="object"&&(x=Object.assign({},Qs,g),g.s!=null&&g.ss==null&&(x.ss=g.s-1)),T=this.localeData(),H=lh(this,!w,x,T),w&&(H=T.pastFuture(+this,H)),T.postformat(H)}var Wc=Math.abs;function Zs(f){return(f>0)-(f<0)||+f}function Xs(){if(!this.isValid())return this.localeData().invalidDate();var f=Wc(this._milliseconds)/1e3,g=Wc(this._days),w=Wc(this._months),x,T,H,K,fe=this.asSeconds(),qe,ze,er,ni;return fe?(x=zr(f/60),T=zr(x/60),f%=60,x%=60,H=zr(w/12),w%=12,K=f?f.toFixed(3).replace(/\.?0+$/,""):"",qe=fe<0?"-":"",ze=Zs(this._months)!==Zs(fe)?"-":"",er=Zs(this._days)!==Zs(fe)?"-":"",ni=Zs(this._milliseconds)!==Zs(fe)?"-":"",qe+"P"+(H?ze+H+"Y":"")+(w?ze+w+"M":"")+(g?er+g+"D":"")+(T||x||f?"T":"")+(T?ni+T+"H":"")+(x?ni+x+"M":"")+(f?ni+K+"S":"")):"P0D"}var Ke=zs.prototype;Ke.isValid=Cv,Ke.abs=Bl,Ke.add=nh,Ke.subtract=cb,Ke.as=fb,Ke.asMilliseconds=Hc,Ke.asSeconds=ua,Ke.asMinutes=ji,Ke.asHours=ih,Ke.asDays=db,Ke.asWeeks=Vl,Ke.asMonths=pb,Ke.asQuarters=sh,Ke.asYears=sr,Ke.valueOf=Bc,Ke._bubble=Uc,Ke.clone=oh,Ke.get=Nn,Ke.milliseconds=Wl,Ke.seconds=us,Ke.minutes=ah,Ke.hours=dr,Ke.days=Vc,Ke.weeks=gb,Ke.months=hb,Ke.years=mb,Ke.humanize=fa,Ke.toISOString=Xs,Ke.toString=Xs,Ke.toJSON=Xs,Ke.locale=na,Ke.localeData=Ml,Ke.toIsoString=R("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Xs),Ke.lang=ia,pe("X",0,0,"unix"),pe("x",0,0,"valueOf"),he("x",js),he("X",Ly),ft("X",function(f,g,w){w._d=new Date(parseFloat(f)*1e3)}),ft("x",function(f,g,w){w._d=new Date(Ve(f))});return e.version="2.30.1",r(yt),e.fn=ie,e.min=wv,e.max=_v,e.now=Rv,e.utc=y,e.unix=ab,e.months=eh,e.isDate=d,e.locale=Zn,e.invalid=_,e.duration=vt,e.isMoment=j,e.weekdays=lb,e.parseZone=dn,e.localeData=Xn,e.isDuration=Zo,e.monthsShort=th,e.weekdaysMin=Lc,e.defineLocale=wl,e.updateLocale=Ar,e.locales=Tr,e.weekdaysShort=ub,e.normalizeUnits=ye,e.relativeTimeRounding=yb,e.relativeTimeThreshold=vb,e.calendarFormat=Pl,e.prototype=ie,e.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},e}))});var Cq=V((Rq,Dh)=>{(function(t,e){typeof define=="function"&&define.amd?define([],e):typeof Dh<"u"&&Dh.exports?Dh.exports=e():t.tv4=e()})(Rq,function(){Object.keys||(Object.keys=(function(){var I=Object.prototype.hasOwnProperty,R=!{toString:null}.propertyIsEnumerable("toString"),A=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],F=A.length;return function(U){if(typeof U!="object"&&typeof U!="function"||U===null)throw new TypeError("Object.keys called on non-object");var D=[];for(var J in U)I.call(U,J)&&D.push(J);if(R)for(var Q=0;Q<F;Q++)I.call(U,A[Q])&&D.push(A[Q]);return D}})()),Object.create||(Object.create=(function(){function I(){}return function(R){if(arguments.length!==1)throw new Error("Object.create implementation only accepts one parameter.");return I.prototype=R,new I}})()),Array.isArray||(Array.isArray=function(I){return Object.prototype.toString.call(I)==="[object Array]"}),Array.prototype.indexOf||(Array.prototype.indexOf=function(I){if(this===null)throw new TypeError;var R=Object(this),A=R.length>>>0;if(A===0)return-1;var F=0;if(arguments.length>1&&(F=Number(arguments[1]),F!==F?F=0:F!==0&&F!==1/0&&F!==-1/0&&(F=(F>0||-1)*Math.floor(Math.abs(F)))),F>=A)return-1;for(var U=F>=0?F:Math.max(A-Math.abs(F),0);U<A;U++)if(U in R&&R[U]===I)return U;return-1}),Object.isFrozen||(Object.isFrozen=function(I){for(var R="tv4_test_frozen_key";I.hasOwnProperty(R);)R+=Math.random();try{return I[R]=!0,delete I[R],!1}catch{return!0}});var t={"+":!0,"#":!0,".":!0,"/":!0,";":!0,"?":!0,"&":!0},e={"*":!0};function r(I){return encodeURI(I).replace(/%25[0-9][0-9]/g,function(R){return"%"+R.substring(3)})}function n(I){var R="";t[I.charAt(0)]&&(R=I.charAt(0),I=I.substring(1));var A="",F="",U=!0,D=!1,J=!1;R==="+"?U=!1:R==="."?(F=".",A="."):R==="/"?(F="/",A="/"):R==="#"?(F="#",U=!1):R===";"?(F=";",A=";",D=!0,J=!0):R==="?"?(F="?",A="&",D=!0):R==="&"&&(F="&",A="&",D=!0);for(var Q=[],se=I.split(","),ce=[],Be={},_e=0;_e<se.length;_e++){var me=se[_e],ke=null;if(me.indexOf(":")!==-1){var mt=me.split(":");me=mt[0],ke=parseInt(mt[1],10)}for(var Nt={};e[me.charAt(me.length-1)];)Nt[me.charAt(me.length-1)]=!0,me=me.substring(0,me.length-1);var pe={truncate:ke,name:me,suffices:Nt};ce.push(pe),Be[me]=pe,Q.push(me)}var Gt=function(Pr){for(var lt="",kr=0,vr=0;vr<ce.length;vr++){var Ct=ce[vr],St=Pr(Ct.name);if(St==null||Array.isArray(St)&&St.length===0||typeof St=="object"&&Object.keys(St).length===0){kr++;continue}if(vr===kr?lt+=F:lt+=A||",",Array.isArray(St)){D&&(lt+=Ct.name+"=");for(var Wr=0;Wr<St.length;Wr++)Wr>0&&(lt+=Ct.suffices["*"]&&A||",",Ct.suffices["*"]&&D&&(lt+=Ct.name+"=")),lt+=U?encodeURIComponent(St[Wr]).replace(/!/g,"%21"):r(St[Wr])}else if(typeof St=="object"){D&&!Ct.suffices["*"]&&(lt+=Ct.name+"=");var Ms=!0;for(var At in St)Ms||(lt+=Ct.suffices["*"]&&A||","),Ms=!1,lt+=U?encodeURIComponent(At).replace(/!/g,"%21"):r(At),lt+=Ct.suffices["*"]?"=":",",lt+=U?encodeURIComponent(St[At]).replace(/!/g,"%21"):r(St[At])}else D&&(lt+=Ct.name,(!J||St!=="")&&(lt+="=")),Ct.truncate!=null&&(St=St.substring(0,Ct.truncate)),lt+=U?encodeURIComponent(St).replace(/!/g,"%21"):r(St)}return lt};return Gt.varNames=Q,{prefix:F,substitution:Gt}}function i(I){if(!(this instanceof i))return new i(I);for(var R=I.split("{"),A=[R.shift()],F=[],U=[],D=[];R.length>0;){var J=R.shift(),Q=J.split("}")[0],se=J.substring(Q.length+1),ce=n(Q);U.push(ce.substitution),F.push(ce.prefix),A.push(se),D=D.concat(ce.substitution.varNames)}this.fill=function(Be){for(var _e=A[0],me=0;me<U.length;me++){var ke=U[me];_e+=ke(Be),_e+=A[me+1]}return _e},this.varNames=D,this.template=I}i.prototype={toString:function(){return this.template},fillFromObject:function(I){return this.fill(function(R){return I[R]})}};var s=function(R,A,F,U,D){if(this.missing=[],this.missingMap={},this.formatValidators=R?Object.create(R.formatValidators):{},this.schemas=R?Object.create(R.schemas):{},this.collectMultiple=A,this.errors=[],this.handleError=A?this.collectError:this.returnError,U&&(this.checkRecursive=!0,this.scanned=[],this.scannedFrozen=[],this.scannedFrozenSchemas=[],this.scannedFrozenValidationErrors=[],this.validatedSchemasKey="tv4_validation_id",this.validationErrorsKey="tv4_validation_errors_id"),D&&(this.trackUnknownProperties=!0,this.knownPropertyPaths={},this.unknownPropertyPaths={}),this.errorReporter=F||b("en"),typeof this.errorReporter=="string")throw new Error("debug");if(this.definedKeywords={},R)for(var J in R.definedKeywords)this.definedKeywords[J]=R.definedKeywords[J].slice(0)};s.prototype.defineKeyword=function(I,R){this.definedKeywords[I]=this.definedKeywords[I]||[],this.definedKeywords[I].push(R)},s.prototype.createError=function(I,R,A,F,U,D,J){var Q=new E(I,R,A,F,U);return Q.message=this.errorReporter(Q,D,J),Q},s.prototype.returnError=function(I){return I},s.prototype.collectError=function(I){return I&&this.errors.push(I),null},s.prototype.prefixErrors=function(I,R,A){for(var F=I;F<this.errors.length;F++)this.errors[F]=this.errors[F].prefixWith(R,A);return this},s.prototype.banUnknownProperties=function(I,R){for(var A in this.unknownPropertyPaths){var F=this.createError(q.UNKNOWN_PROPERTY,{path:A},A,"",null,I,R),U=this.handleError(F);if(U)return U}return null},s.prototype.addFormat=function(I,R){if(typeof I=="object"){for(var A in I)this.addFormat(A,I[A]);return this}this.formatValidators[I]=R},s.prototype.resolveRefs=function(I,R){if(I.$ref!==void 0){if(R=R||{},R[I.$ref])return this.createError(q.CIRCULAR_REFERENCE,{urls:Object.keys(R).join(", ")},"","",null,void 0,I);R[I.$ref]=!0,I=this.getSchema(I.$ref,R)}return I},s.prototype.getSchema=function(I,R){var A;if(this.schemas[I]!==void 0)return A=this.schemas[I],this.resolveRefs(A,R);var F=I,U="";if(I.indexOf("#")!==-1&&(U=I.substring(I.indexOf("#")+1),F=I.substring(0,I.indexOf("#"))),typeof this.schemas[F]=="object"){A=this.schemas[F];var D=decodeURIComponent(U);if(D==="")return this.resolveRefs(A,R);if(D.charAt(0)!=="/")return;for(var J=D.split("/").slice(1),Q=0;Q<J.length;Q++){var se=J[Q].replace(/~1/g,"/").replace(/~0/g,"~");if(A[se]===void 0){A=void 0;break}A=A[se]}if(A!==void 0)return this.resolveRefs(A,R)}this.missing[F]===void 0&&(this.missing.push(F),this.missing[F]=F,this.missingMap[F]=F)},s.prototype.searchSchemas=function(I,R){if(Array.isArray(I))for(var A=0;A<I.length;A++)this.searchSchemas(I[A],R);else if(I&&typeof I=="object"){typeof I.id=="string"&&k(R,I.id)&&this.schemas[I.id]===void 0&&(this.schemas[I.id]=I);for(var F in I)if(F!=="enum"){if(typeof I[F]=="object")this.searchSchemas(I[F],R);else if(F==="$ref"){var U=m(I[F]);U&&this.schemas[U]===void 0&&this.missingMap[U]===void 0&&(this.missingMap[U]=U)}}}},s.prototype.addSchema=function(I,R){if(typeof I!="string"||typeof R>"u")if(typeof I=="object"&&typeof I.id=="string")R=I,I=R.id;else return;I===m(I)+"#"&&(I=m(I)),this.schemas[I]=R,delete this.missingMap[I],y(R,I),this.searchSchemas(R,I)},s.prototype.getSchemaMap=function(){var I={};for(var R in this.schemas)I[R]=this.schemas[R];return I},s.prototype.getSchemaUris=function(I){var R=[];for(var A in this.schemas)(!I||I.test(A))&&R.push(A);return R},s.prototype.getMissingUris=function(I){var R=[];for(var A in this.missingMap)(!I||I.test(A))&&R.push(A);return R},s.prototype.dropSchemas=function(){this.schemas={},this.reset()},s.prototype.reset=function(){this.missing=[],this.missingMap={},this.errors=[]},s.prototype.validateAll=function(I,R,A,F,U){var D;if(R=this.resolveRefs(R),R){if(R instanceof E)return this.errors.push(R),R}else return null;var J=this.errors.length,Q,se=null,ce=null;if(this.checkRecursive&&I&&typeof I=="object"){if(D=!this.scanned.length,I[this.validatedSchemasKey]){var Be=I[this.validatedSchemasKey].indexOf(R);if(Be!==-1)return this.errors=this.errors.concat(I[this.validationErrorsKey][Be]),null}if(Object.isFrozen(I)&&(Q=this.scannedFrozen.indexOf(I),Q!==-1)){var _e=this.scannedFrozenSchemas[Q].indexOf(R);if(_e!==-1)return this.errors=this.errors.concat(this.scannedFrozenValidationErrors[Q][_e]),null}if(this.scanned.push(I),Object.isFrozen(I))Q===-1&&(Q=this.scannedFrozen.length,this.scannedFrozen.push(I),this.scannedFrozenSchemas.push([])),se=this.scannedFrozenSchemas[Q].length,this.scannedFrozenSchemas[Q][se]=R,this.scannedFrozenValidationErrors[Q][se]=[];else{if(!I[this.validatedSchemasKey])try{Object.defineProperty(I,this.validatedSchemasKey,{value:[],configurable:!0}),Object.defineProperty(I,this.validationErrorsKey,{value:[],configurable:!0})}catch{I[this.validatedSchemasKey]=[],I[this.validationErrorsKey]=[]}ce=I[this.validatedSchemasKey].length,I[this.validatedSchemasKey][ce]=R,I[this.validationErrorsKey][ce]=[]}}var me=this.errors.length,ke=this.validateBasic(I,R,U)||this.validateNumeric(I,R,U)||this.validateString(I,R,U)||this.validateArray(I,R,U)||this.validateObject(I,R,U)||this.validateCombinations(I,R,U)||this.validateHypermedia(I,R,U)||this.validateFormat(I,R,U)||this.validateDefinedKeywords(I,R,U)||null;if(D){for(;this.scanned.length;){var mt=this.scanned.pop();delete mt[this.validatedSchemasKey]}this.scannedFrozen=[],this.scannedFrozenSchemas=[]}if(ke||me!==this.errors.length)for(;A&&A.length||F&&F.length;){var Nt=A&&A.length?""+A.pop():null,pe=F&&F.length?""+F.pop():null;ke&&(ke=ke.prefixWith(Nt,pe)),this.prefixErrors(me,Nt,pe)}return se!==null?this.scannedFrozenValidationErrors[Q][se]=this.errors.slice(J):ce!==null&&(I[this.validationErrorsKey][ce]=this.errors.slice(J)),this.handleError(ke)},s.prototype.validateFormat=function(I,R){if(typeof R.format!="string"||!this.formatValidators[R.format])return null;var A=this.formatValidators[R.format].call(null,I,R);return typeof A=="string"||typeof A=="number"?this.createError(q.FORMAT_CUSTOM,{message:A},"","/format",null,I,R):A&&typeof A=="object"?this.createError(q.FORMAT_CUSTOM,{message:A.message||"?"},A.dataPath||"",A.schemaPath||"/format",null,I,R):null},s.prototype.validateDefinedKeywords=function(I,R,A){for(var F in this.definedKeywords)if(!(typeof R[F]>"u"))for(var U=this.definedKeywords[F],D=0;D<U.length;D++){var J=U[D],Q=J(I,R[F],R,A);if(typeof Q=="string"||typeof Q=="number")return this.createError(q.KEYWORD_CUSTOM,{key:F,message:Q},"","",null,I,R).prefixWith(null,F);if(Q&&typeof Q=="object"){var se=Q.code;if(typeof se=="string"){if(!q[se])throw new Error("Undefined error code (use defineError): "+se);se=q[se]}else typeof se!="number"&&(se=q.KEYWORD_CUSTOM);var ce=typeof Q.message=="object"?Q.message:{key:F,message:Q.message||"?"},Be=Q.schemaPath||"/"+F.replace(/~/g,"~0").replace(/\//g,"~1");return this.createError(se,ce,Q.dataPath||null,Be,null,I,R)}}return null};function o(I,R){if(I===R)return!0;if(I&&R&&typeof I=="object"&&typeof R=="object"){if(Array.isArray(I)!==Array.isArray(R))return!1;if(Array.isArray(I)){if(I.length!==R.length)return!1;for(var A=0;A<I.length;A++)if(!o(I[A],R[A]))return!1}else{var F;for(F in I)if(R[F]===void 0&&I[F]!==void 0)return!1;for(F in R)if(I[F]===void 0&&R[F]!==void 0)return!1;for(F in I)if(!o(I[F],R[F]))return!1}return!0}return!1}s.prototype.validateBasic=function(R,A,F){var U;return(U=this.validateType(R,A,F))||(U=this.validateEnum(R,A,F))?U.prefixWith(null,"type"):null},s.prototype.validateType=function(R,A){if(A.type===void 0)return null;var F=typeof R;R===null?F="null":Array.isArray(R)&&(F="array");var U=A.type;Array.isArray(U)||(U=[U]);for(var D=0;D<U.length;D++){var J=U[D];if(J===F||J==="integer"&&F==="number"&&R%1===0)return null}return this.createError(q.INVALID_TYPE,{type:F,expected:U.join("/")},"","",null,R,A)},s.prototype.validateEnum=function(R,A){if(A.enum===void 0)return null;for(var F=0;F<A.enum.length;F++){var U=A.enum[F];if(o(R,U))return null}return this.createError(q.ENUM_MISMATCH,{value:typeof JSON<"u"?JSON.stringify(R):R},"","",null,R,A)},s.prototype.validateNumeric=function(R,A,F){return this.validateMultipleOf(R,A,F)||this.validateMinMax(R,A,F)||this.validateNaN(R,A,F)||null};var l=Math.pow(2,-51),c=1-l;s.prototype.validateMultipleOf=function(R,A){var F=A.multipleOf||A.divisibleBy;if(F===void 0)return null;if(typeof R=="number"){var U=R/F%1;if(U>=l&&U<c)return this.createError(q.NUMBER_MULTIPLE_OF,{value:R,multipleOf:F},"","",null,R,A)}return null},s.prototype.validateMinMax=function(R,A){if(typeof R!="number")return null;if(A.minimum!==void 0){if(R<A.minimum)return this.createError(q.NUMBER_MINIMUM,{value:R,minimum:A.minimum},"","/minimum",null,R,A);if(A.exclusiveMinimum&&R===A.minimum)return this.createError(q.NUMBER_MINIMUM_EXCLUSIVE,{value:R,minimum:A.minimum},"","/exclusiveMinimum",null,R,A)}if(A.maximum!==void 0){if(R>A.maximum)return this.createError(q.NUMBER_MAXIMUM,{value:R,maximum:A.maximum},"","/maximum",null,R,A);if(A.exclusiveMaximum&&R===A.maximum)return this.createError(q.NUMBER_MAXIMUM_EXCLUSIVE,{value:R,maximum:A.maximum},"","/exclusiveMaximum",null,R,A)}return null},s.prototype.validateNaN=function(R,A){return typeof R!="number"?null:isNaN(R)===!0||R===1/0||R===-1/0?this.createError(q.NUMBER_NOT_A_NUMBER,{value:R},"","/type",null,R,A):null},s.prototype.validateString=function(R,A,F){return this.validateStringLength(R,A,F)||this.validateStringPattern(R,A,F)||null},s.prototype.validateStringLength=function(R,A){return typeof R!="string"?null:A.minLength!==void 0&&R.length<A.minLength?this.createError(q.STRING_LENGTH_SHORT,{length:R.length,minimum:A.minLength},"","/minLength",null,R,A):A.maxLength!==void 0&&R.length>A.maxLength?this.createError(q.STRING_LENGTH_LONG,{length:R.length,maximum:A.maxLength},"","/maxLength",null,R,A):null},s.prototype.validateStringPattern=function(R,A){if(typeof R!="string"||typeof A.pattern!="string"&&!(A.pattern instanceof RegExp))return null;var F;if(A.pattern instanceof RegExp)F=A.pattern;else{var U,D="",J=A.pattern.match(/^\/(.+)\/([img]*)$/);J?(U=J[1],D=J[2]):U=A.pattern,F=new RegExp(U,D)}return F.test(R)?null:this.createError(q.STRING_PATTERN,{pattern:A.pattern},"","/pattern",null,R,A)},s.prototype.validateArray=function(R,A,F){return Array.isArray(R)&&(this.validateArrayLength(R,A,F)||this.validateArrayUniqueItems(R,A,F)||this.validateArrayItems(R,A,F))||null},s.prototype.validateArrayLength=function(R,A){var F;return A.minItems!==void 0&&R.length<A.minItems&&(F=this.createError(q.ARRAY_LENGTH_SHORT,{length:R.length,minimum:A.minItems},"","/minItems",null,R,A),this.handleError(F))||A.maxItems!==void 0&&R.length>A.maxItems&&(F=this.createError(q.ARRAY_LENGTH_LONG,{length:R.length,maximum:A.maxItems},"","/maxItems",null,R,A),this.handleError(F))?F:null},s.prototype.validateArrayUniqueItems=function(R,A){if(A.uniqueItems){for(var F=0;F<R.length;F++)for(var U=F+1;U<R.length;U++)if(o(R[F],R[U])){var D=this.createError(q.ARRAY_UNIQUE,{match1:F,match2:U},"","/uniqueItems",null,R,A);if(this.handleError(D))return D}}return null},s.prototype.validateArrayItems=function(R,A,F){if(A.items===void 0)return null;var U,D;if(Array.isArray(A.items)){for(D=0;D<R.length;D++)if(D<A.items.length){if(U=this.validateAll(R[D],A.items[D],[D],["items",D],F+"/"+D))return U}else if(A.additionalItems!==void 0){if(typeof A.additionalItems=="boolean"){if(!A.additionalItems&&(U=this.createError(q.ARRAY_ADDITIONAL_ITEMS,{},"/"+D,"/additionalItems",null,R,A),this.handleError(U)))return U}else if(U=this.validateAll(R[D],A.additionalItems,[D],["additionalItems"],F+"/"+D))return U}}else for(D=0;D<R.length;D++)if(U=this.validateAll(R[D],A.items,[D],["items"],F+"/"+D))return U;return null},s.prototype.validateObject=function(R,A,F){return typeof R!="object"||R===null||Array.isArray(R)?null:this.validateObjectMinMaxProperties(R,A,F)||this.validateObjectRequiredProperties(R,A,F)||this.validateObjectProperties(R,A,F)||this.validateObjectDependencies(R,A,F)||null},s.prototype.validateObjectMinMaxProperties=function(R,A){var F=Object.keys(R),U;return A.minProperties!==void 0&&F.length<A.minProperties&&(U=this.createError(q.OBJECT_PROPERTIES_MINIMUM,{propertyCount:F.length,minimum:A.minProperties},"","/minProperties",null,R,A),this.handleError(U))||A.maxProperties!==void 0&&F.length>A.maxProperties&&(U=this.createError(q.OBJECT_PROPERTIES_MAXIMUM,{propertyCount:F.length,maximum:A.maxProperties},"","/maxProperties",null,R,A),this.handleError(U))?U:null},s.prototype.validateObjectRequiredProperties=function(R,A){if(A.required!==void 0)for(var F=0;F<A.required.length;F++){var U=A.required[F];if(R[U]===void 0){var D=this.createError(q.OBJECT_REQUIRED,{key:U},"","/required/"+F,null,R,A);if(this.handleError(D))return D}}return null},s.prototype.validateObjectProperties=function(R,A,F){var U;for(var D in R){var J=F+"/"+D.replace(/~/g,"~0").replace(/\//g,"~1"),Q=!1;if(A.properties!==void 0&&A.properties[D]!==void 0&&(Q=!0,U=this.validateAll(R[D],A.properties[D],[D],["properties",D],J)))return U;if(A.patternProperties!==void 0)for(var se in A.patternProperties){var ce=new RegExp(se);if(ce.test(D)&&(Q=!0,U=this.validateAll(R[D],A.patternProperties[se],[D],["patternProperties",se],J)))return U}if(Q)this.trackUnknownProperties&&(this.knownPropertyPaths[J]=!0,delete this.unknownPropertyPaths[J]);else if(A.additionalProperties!==void 0){if(this.trackUnknownProperties&&(this.knownPropertyPaths[J]=!0,delete this.unknownPropertyPaths[J]),typeof A.additionalProperties=="boolean"){if(!A.additionalProperties&&(U=this.createError(q.OBJECT_ADDITIONAL_PROPERTIES,{key:D},"","/additionalProperties",null,R,A).prefixWith(D,null),this.handleError(U)))return U}else if(U=this.validateAll(R[D],A.additionalProperties,[D],["additionalProperties"],J))return U}else this.trackUnknownProperties&&!this.knownPropertyPaths[J]&&(this.unknownPropertyPaths[J]=!0)}return null},s.prototype.validateObjectDependencies=function(R,A,F){var U;if(A.dependencies!==void 0){for(var D in A.dependencies)if(R[D]!==void 0){var J=A.dependencies[D];if(typeof J=="string"){if(R[J]===void 0&&(U=this.createError(q.OBJECT_DEPENDENCY_KEY,{key:D,missing:J},"","",null,R,A).prefixWith(null,D).prefixWith(null,"dependencies"),this.handleError(U)))return U}else if(Array.isArray(J))for(var Q=0;Q<J.length;Q++){var se=J[Q];if(R[se]===void 0&&(U=this.createError(q.OBJECT_DEPENDENCY_KEY,{key:D,missing:se},"","/"+Q,null,R,A).prefixWith(null,D).prefixWith(null,"dependencies"),this.handleError(U)))return U}else if(U=this.validateAll(R,J,[],["dependencies",D],F))return U}}return null},s.prototype.validateCombinations=function(R,A,F){return this.validateAllOf(R,A,F)||this.validateAnyOf(R,A,F)||this.validateOneOf(R,A,F)||this.validateNot(R,A,F)||null},s.prototype.validateAllOf=function(R,A,F){if(A.allOf===void 0)return null;for(var U,D=0;D<A.allOf.length;D++){var J=A.allOf[D];if(U=this.validateAll(R,J,[],["allOf",D],F))return U}return null},s.prototype.validateAnyOf=function(R,A,F){if(A.anyOf===void 0)return null;var U=[],D=this.errors.length,J,Q;this.trackUnknownProperties&&(J=this.unknownPropertyPaths,Q=this.knownPropertyPaths);for(var se=!0,ce=0;ce<A.anyOf.length;ce++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var Be=A.anyOf[ce],_e=this.errors.length,me=this.validateAll(R,Be,[],["anyOf",ce],F);if(me===null&&_e===this.errors.length){if(this.errors=this.errors.slice(0,D),this.trackUnknownProperties){for(var ke in this.knownPropertyPaths)Q[ke]=!0,delete J[ke];for(var mt in this.unknownPropertyPaths)Q[mt]||(J[mt]=!0);se=!1;continue}return null}me&&U.push(me.prefixWith(null,""+ce).prefixWith(null,"anyOf"))}if(this.trackUnknownProperties&&(this.unknownPropertyPaths=J,this.knownPropertyPaths=Q),se)return U=U.concat(this.errors.slice(D)),this.errors=this.errors.slice(0,D),this.createError(q.ANY_OF_MISSING,{},"","/anyOf",U,R,A)},s.prototype.validateOneOf=function(R,A,F){if(A.oneOf===void 0)return null;var U=null,D=[],J=this.errors.length,Q,se;this.trackUnknownProperties&&(Q=this.unknownPropertyPaths,se=this.knownPropertyPaths);for(var ce=0;ce<A.oneOf.length;ce++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var Be=A.oneOf[ce],_e=this.errors.length,me=this.validateAll(R,Be,[],["oneOf",ce],F);if(me===null&&_e===this.errors.length){if(U===null)U=ce;else return this.errors=this.errors.slice(0,J),this.createError(q.ONE_OF_MULTIPLE,{index1:U,index2:ce},"","/oneOf",null,R,A);if(this.trackUnknownProperties){for(var ke in this.knownPropertyPaths)se[ke]=!0,delete Q[ke];for(var mt in this.unknownPropertyPaths)se[mt]||(Q[mt]=!0)}}else me&&D.push(me)}return this.trackUnknownProperties&&(this.unknownPropertyPaths=Q,this.knownPropertyPaths=se),U===null?(D=D.concat(this.errors.slice(J)),this.errors=this.errors.slice(0,J),this.createError(q.ONE_OF_MISSING,{},"","/oneOf",D,R,A)):(this.errors=this.errors.slice(0,J),null)},s.prototype.validateNot=function(R,A,F){if(A.not===void 0)return null;var U=this.errors.length,D,J;this.trackUnknownProperties&&(D=this.unknownPropertyPaths,J=this.knownPropertyPaths,this.unknownPropertyPaths={},this.knownPropertyPaths={});var Q=this.validateAll(R,A.not,null,null,F),se=this.errors.slice(U);return this.errors=this.errors.slice(0,U),this.trackUnknownProperties&&(this.unknownPropertyPaths=D,this.knownPropertyPaths=J),Q===null&&se.length===0?this.createError(q.NOT_PASSED,{},"","/not",null,R,A):null},s.prototype.validateHypermedia=function(R,A,F){if(!A.links)return null;for(var U,D=0;D<A.links.length;D++){var J=A.links[D];if(J.rel==="describedby"){for(var Q=new i(J.href),se=!0,ce=0;ce<Q.varNames.length;ce++)if(!(Q.varNames[ce]in R)){se=!1;break}if(se){var Be=Q.fillFromObject(R),_e={$ref:Be};if(U=this.validateAll(R,_e,[],["links",D],F))return U}}}};function d(I){var R=String(I).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return R?{href:R[0]||"",protocol:R[1]||"",authority:R[2]||"",host:R[3]||"",hostname:R[4]||"",port:R[5]||"",pathname:R[6]||"",search:R[7]||"",hash:R[8]||""}:null}function p(I,R){function A(F){var U=[];return F.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(D){D==="/.."?U.pop():U.push(D)}),U.join("").replace(/^\//,F.charAt(0)==="/"?"/":"")}return R=d(R||""),I=d(I||""),!R||!I?null:(R.protocol||I.protocol)+(R.protocol||R.authority?R.authority:I.authority)+A(R.protocol||R.authority||R.pathname.charAt(0)==="/"?R.pathname:R.pathname?(I.authority&&!I.pathname?"/":"")+I.pathname.slice(0,I.pathname.lastIndexOf("/")+1)+R.pathname:I.pathname)+(R.protocol||R.authority||R.pathname?R.search:R.search||I.search)+R.hash}function m(I){return I.split("#")[0]}function y(I,R){if(I&&typeof I=="object")if(R===void 0?R=I.id:typeof I.id=="string"&&(R=p(R,I.id),I.id=R),Array.isArray(I))for(var A=0;A<I.length;A++)y(I[A],R);else{typeof I.$ref=="string"&&(I.$ref=p(R,I.$ref));for(var F in I)F!=="enum"&&y(I[F],R)}}function b(I){I=I||"en";var R=O[I];return function(A){var F=R[A.code]||_[A.code];if(typeof F!="string")return"Unknown error code "+A.code+": "+JSON.stringify(A.messageParams);var U=A.params;return F.replace(/\{([^{}]*)\}/g,function(D,J){var Q=U[J];return typeof Q=="string"||typeof Q=="number"?Q:D})}}var q={INVALID_TYPE:0,ENUM_MISMATCH:1,ANY_OF_MISSING:10,ONE_OF_MISSING:11,ONE_OF_MULTIPLE:12,NOT_PASSED:13,NUMBER_MULTIPLE_OF:100,NUMBER_MINIMUM:101,NUMBER_MINIMUM_EXCLUSIVE:102,NUMBER_MAXIMUM:103,NUMBER_MAXIMUM_EXCLUSIVE:104,NUMBER_NOT_A_NUMBER:105,STRING_LENGTH_SHORT:200,STRING_LENGTH_LONG:201,STRING_PATTERN:202,OBJECT_PROPERTIES_MINIMUM:300,OBJECT_PROPERTIES_MAXIMUM:301,OBJECT_REQUIRED:302,OBJECT_ADDITIONAL_PROPERTIES:303,OBJECT_DEPENDENCY_KEY:304,ARRAY_LENGTH_SHORT:400,ARRAY_LENGTH_LONG:401,ARRAY_UNIQUE:402,ARRAY_ADDITIONAL_ITEMS:403,FORMAT_CUSTOM:500,KEYWORD_CUSTOM:501,CIRCULAR_REFERENCE:600,UNKNOWN_PROPERTY:1e3},C={};for(var v in q)C[q[v]]=v;var _={INVALID_TYPE:"Invalid type: {type} (expected {expected})",ENUM_MISMATCH:"No enum match for: {value}",ANY_OF_MISSING:'Data does not match any schemas from "anyOf"',ONE_OF_MISSING:'Data does not match any schemas from "oneOf"',ONE_OF_MULTIPLE:'Data is valid against more than one schema from "oneOf": indices {index1} and {index2}',NOT_PASSED:'Data matches schema from "not"',NUMBER_MULTIPLE_OF:"Value {value} is not a multiple of {multipleOf}",NUMBER_MINIMUM:"Value {value} is less than minimum {minimum}",NUMBER_MINIMUM_EXCLUSIVE:"Value {value} is equal to exclusive minimum {minimum}",NUMBER_MAXIMUM:"Value {value} is greater than maximum {maximum}",NUMBER_MAXIMUM_EXCLUSIVE:"Value {value} is equal to exclusive maximum {maximum}",NUMBER_NOT_A_NUMBER:"Value {value} is not a valid number",STRING_LENGTH_SHORT:"String is too short ({length} chars), minimum {minimum}",STRING_LENGTH_LONG:"String is too long ({length} chars), maximum {maximum}",STRING_PATTERN:"String does not match pattern: {pattern}",OBJECT_PROPERTIES_MINIMUM:"Too few properties defined ({propertyCount}), minimum {minimum}",OBJECT_PROPERTIES_MAXIMUM:"Too many properties defined ({propertyCount}), maximum {maximum}",OBJECT_REQUIRED:"Missing required property: {key}",OBJECT_ADDITIONAL_PROPERTIES:"Additional properties not allowed",OBJECT_DEPENDENCY_KEY:"Dependency failed - key must exist: {missing} (due to key: {key})",ARRAY_LENGTH_SHORT:"Array is too short ({length}), minimum {minimum}",ARRAY_LENGTH_LONG:"Array is too long ({length}), maximum {maximum}",ARRAY_UNIQUE:"Array items are not unique (indices {match1} and {match2})",ARRAY_ADDITIONAL_ITEMS:"Additional items not allowed",FORMAT_CUSTOM:"Format validation failed ({message})",KEYWORD_CUSTOM:"Keyword failed: {key} ({message})",CIRCULAR_REFERENCE:"Circular $refs: {urls}",UNKNOWN_PROPERTY:"Unknown property (not in schema)"};function E(I,R,A,F,U){if(Error.call(this),I===void 0)throw new Error("No error code supplied: "+F);this.message="",this.params=R,this.code=I,this.dataPath=A||"",this.schemaPath=F||"",this.subErrors=U||null;var D=new Error(this.message);if(this.stack=D.stack||D.stacktrace,!this.stack)try{throw D}catch(J){this.stack=J.stack||J.stacktrace}}E.prototype=Object.create(Error.prototype),E.prototype.constructor=E,E.prototype.name="ValidationError",E.prototype.prefixWith=function(I,R){if(I!==null&&(I=I.replace(/~/g,"~0").replace(/\//g,"~1"),this.dataPath="/"+I+this.dataPath),R!==null&&(R=R.replace(/~/g,"~0").replace(/\//g,"~1"),this.schemaPath="/"+R+this.schemaPath),this.subErrors!==null)for(var A=0;A<this.subErrors.length;A++)this.subErrors[A].prefixWith(I,R);return this};function k(I,R){if(R.substring(0,I.length)===I){var A=R.substring(I.length);if(R.length>0&&R.charAt(I.length-1)==="/"||A.charAt(0)==="#"||A.charAt(0)==="?")return!0}return!1}var O={};function M(I){var R=new s,A,F,U={setErrorReporter:function(D){return typeof D=="string"?this.language(D):(F=D,!0)},addFormat:function(){R.addFormat.apply(R,arguments)},language:function(D){return D?(O[D]||(D=D.split("-")[0]),O[D]?(A=D,D):!1):A},addLanguage:function(D,J){var Q;for(Q in q)J[Q]&&!J[q[Q]]&&(J[q[Q]]=J[Q]);var se=D.split("-")[0];if(!O[se])O[D]=J,O[se]=J;else{O[D]=Object.create(O[se]);for(Q in J)typeof O[se][Q]>"u"&&(O[se][Q]=J[Q]),O[D][Q]=J[Q]}return this},freshApi:function(D){var J=M();return D&&J.language(D),J},validate:function(D,J,Q,se){var ce=b(A),Be=F?function(ke,mt,Nt){return F(ke,mt,Nt)||ce(ke,mt,Nt)}:ce,_e=new s(R,!1,Be,Q,se);typeof J=="string"&&(J={$ref:J}),_e.addSchema("",J);var me=_e.validateAll(D,J,null,null,"");return!me&&se&&(me=_e.banUnknownProperties(D,J)),this.error=me,this.missing=_e.missing,this.valid=me===null,this.valid},validateResult:function(){var D={toString:function(){return this.valid?"valid":this.error.message}};return this.validate.apply(D,arguments),D},validateMultiple:function(D,J,Q,se){var ce=b(A),Be=F?function(ke,mt,Nt){return F(ke,mt,Nt)||ce(ke,mt,Nt)}:ce,_e=new s(R,!0,Be,Q,se);typeof J=="string"&&(J={$ref:J}),_e.addSchema("",J),_e.validateAll(D,J,null,null,""),se&&_e.banUnknownProperties(D,J);var me={toString:function(){return this.valid?"valid":this.error.message}};return me.errors=_e.errors,me.missing=_e.missing,me.valid=me.errors.length===0,me},addSchema:function(){return R.addSchema.apply(R,arguments)},getSchema:function(){return R.getSchema.apply(R,arguments)},getSchemaMap:function(){return R.getSchemaMap.apply(R,arguments)},getSchemaUris:function(){return R.getSchemaUris.apply(R,arguments)},getMissingUris:function(){return R.getMissingUris.apply(R,arguments)},dropSchemas:function(){R.dropSchemas.apply(R,arguments)},defineKeyword:function(){R.defineKeyword.apply(R,arguments)},defineError:function(D,J,Q){if(typeof D!="string"||!/^[A-Z]+(_[A-Z]+)*$/.test(D))throw new Error("Code name must be a string in UPPER_CASE_WITH_UNDERSCORES");if(typeof J!="number"||J%1!==0||J<1e4)throw new Error("Code number must be an integer > 10000");if(typeof q[D]<"u")throw new Error("Error already defined: "+D+" as "+q[D]);if(typeof C[J]<"u")throw new Error("Error code already used: "+C[J]+" as "+J);q[D]=J,C[J]=D,_[D]=_[J]=Q;for(var se in O){var ce=O[se];ce[D]&&(ce[J]=ce[J]||ce[D])}},reset:function(){R.reset(),this.error=null,this.missing=[],this.valid=!0},missing:[],error:null,valid:!0,normSchema:y,resolveUrl:p,getDocumentUri:m,errorCodes:q};return U.language(I||"en"),U}var j=M();return j.addLanguage("en-gb",_),j.tv4=j,j})});var mf=V(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.regexpCode=ct.getEsmExportName=ct.getProperty=ct.safeStringify=ct.stringify=ct.strConcat=ct.addCodeArg=ct.str=ct._=ct.nil=ct._Code=ct.Name=ct.IDENTIFIER=ct._CodeOrName=void 0;var pf=class{};ct._CodeOrName=pf;ct.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var _a=class extends pf{constructor(e){if(super(),!ct.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ct.Name=_a;var Un=class extends pf{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof _a&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ct._Code=Un;ct.nil=new Un("");function xq(t,...e){let r=[t[0]],n=0;for(;n<e.length;)mS(r,e[n]),r.push(t[++n]);return new Un(r)}ct._=xq;var hS=new Un("+");function Eq(t,...e){let r=[hf(t[0])],n=0;for(;n<e.length;)r.push(hS),mS(r,e[n]),r.push(hS,hf(t[++n]));return b2(r),new Un(r)}ct.str=Eq;function mS(t,e){e instanceof Un?t.push(...e._items):e instanceof _a?t.push(e):t.push(_2(e))}ct.addCodeArg=mS;function b2(t){let e=1;for(;e<t.length-1;){if(t[e]===hS){let r=S2(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function S2(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof _a||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof _a))return`"${t}${e.slice(1)}`}function w2(t,e){return e.emptyStr()?t:t.emptyStr()?e:Eq`${t}${e}`}ct.strConcat=w2;function _2(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:hf(Array.isArray(t)?t.join(","):t)}function R2(t){return new Un(hf(t))}ct.stringify=R2;function hf(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ct.safeStringify=hf;function C2(t){return typeof t=="string"&&ct.IDENTIFIER.test(t)?new Un(`.${t}`):xq`[${t}]`}ct.getProperty=C2;function x2(t){if(typeof t=="string"&&ct.IDENTIFIER.test(t))return new Un(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ct.getEsmExportName=x2;function E2(t){return new Un(t.toString())}ct.regexpCode=E2});var vS=V(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.ValueScope=en.ValueScopeName=en.Scope=en.varKinds=en.UsedValueState=void 0;var Xr=mf(),gS=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},jh;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(jh||(en.UsedValueState=jh={}));en.varKinds={const:new Xr.Name("const"),let:new Xr.Name("let"),var:new Xr.Name("var")};var Lh=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Xr.Name?e:this.name(e)}name(e){return new Xr.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};en.Scope=Lh;var Uh=class extends Xr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Xr._)`.${new Xr.Name(r)}[${n}]`}};en.ValueScopeName=Uh;var q2=(0,Xr._)`\n`,yS=class extends Lh{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?q2:Xr.nil}}get(){return this._scope}name(e){return new Uh(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,l=this._values[s];if(l){let p=l.get(o);if(p)return p}else l=this._values[s]=new Map;l.set(o,i);let c=this._scope[s]||(this._scope[s]=[]),d=c.length;return c[d]=r.ref,i.setValue(r,{property:s,itemIndex:d}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Xr._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let s=Xr.nil;for(let o in e){let l=e[o];if(!l)continue;let c=n[o]=n[o]||new Map;l.forEach(d=>{if(c.has(d))return;c.set(d,jh.Started);let p=r(d);if(p){let m=this.opts.es5?en.varKinds.var:en.varKinds.const;s=(0,Xr._)`${s}${m} ${d} = ${p};${this.opts._n}`}else if(p=i?.(d))s=(0,Xr._)`${s}${p}${this.opts._n}`;else throw new gS(d);c.set(d,jh.Completed)})}return s}};en.ValueScope=yS});var Je=V(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.or=He.and=He.not=He.CodeGen=He.operators=He.varKinds=He.ValueScopeName=He.ValueScope=He.Scope=He.Name=He.regexpCode=He.stringify=He.getProperty=He.nil=He.strConcat=He.str=He._=void 0;var tt=mf(),ui=vS(),lo=mf();Object.defineProperty(He,"_",{enumerable:!0,get:function(){return lo._}});Object.defineProperty(He,"str",{enumerable:!0,get:function(){return lo.str}});Object.defineProperty(He,"strConcat",{enumerable:!0,get:function(){return lo.strConcat}});Object.defineProperty(He,"nil",{enumerable:!0,get:function(){return lo.nil}});Object.defineProperty(He,"getProperty",{enumerable:!0,get:function(){return lo.getProperty}});Object.defineProperty(He,"stringify",{enumerable:!0,get:function(){return lo.stringify}});Object.defineProperty(He,"regexpCode",{enumerable:!0,get:function(){return lo.regexpCode}});Object.defineProperty(He,"Name",{enumerable:!0,get:function(){return lo.Name}});var Wh=vS();Object.defineProperty(He,"Scope",{enumerable:!0,get:function(){return Wh.Scope}});Object.defineProperty(He,"ValueScope",{enumerable:!0,get:function(){return Wh.ValueScope}});Object.defineProperty(He,"ValueScopeName",{enumerable:!0,get:function(){return Wh.ValueScopeName}});Object.defineProperty(He,"varKinds",{enumerable:!0,get:function(){return Wh.varKinds}});He.operators={GT:new tt._Code(">"),GTE:new tt._Code(">="),LT:new tt._Code("<"),LTE:new tt._Code("<="),EQ:new tt._Code("==="),NEQ:new tt._Code("!=="),NOT:new tt._Code("!"),OR:new tt._Code("||"),AND:new tt._Code("&&"),ADD:new tt._Code("+")};var Ss=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},bS=class extends Ss{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?ui.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=iu(this.rhs,e,r)),this}get names(){return this.rhs instanceof tt._CodeOrName?this.rhs.names:{}}},Hh=class extends Ss{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof tt.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=iu(this.rhs,e,r),this}get names(){let e=this.lhs instanceof tt.Name?{}:{...this.lhs.names};return Vh(e,this.rhs)}},SS=class extends Hh{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},wS=class extends Ss{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},_S=class extends Ss{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},RS=class extends Ss{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},CS=class extends Ss{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=iu(this.code,e,r),this}get names(){return this.code instanceof tt._CodeOrName?this.code.names:{}}},gf=class extends Ss{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(e,r)||(O2(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>xa(e,r.names),{})}},ws=class extends gf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},xS=class extends gf{},nu=class extends ws{};nu.kind="else";var Ra=class t extends ws{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new nu(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(qq(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=iu(this.condition,e,r),this}get names(){let e=super.names;return Vh(e,this.condition),this.else&&xa(e,this.else.names),e}};Ra.kind="if";var Ca=class extends ws{};Ca.kind="for";var ES=class extends Ca{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=iu(this.iteration,e,r),this}get names(){return xa(super.names,this.iteration.names)}},qS=class extends Ca{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?ui.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=Vh(super.names,this.from);return Vh(e,this.to)}},Bh=class extends Ca{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=iu(this.iterable,e,r),this}get names(){return xa(super.names,this.iterable.names)}},yf=class extends ws{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};yf.kind="func";var vf=class extends gf{render(e){return"return "+super.render(e)}};vf.kind="return";var OS=class extends ws{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&xa(e,this.catch.names),this.finally&&xa(e,this.finally.names),e}},bf=class extends ws{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};bf.kind="catch";var Sf=class extends ws{render(e){return"finally"+super.render(e)}};Sf.kind="finally";var IS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
24
24
|
`:""},this._extScope=e,this._scope=new ui.Scope({parent:e}),this._nodes=[new xS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let s=this._scope.toName(r);return n!==void 0&&i&&(this._constants[s.str]=n),this._leafNode(new bS(e,s,n)),s}const(e,r,n){return this._def(ui.varKinds.const,e,r,n)}let(e,r,n){return this._def(ui.varKinds.let,e,r,n)}var(e,r,n){return this._def(ui.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Hh(e,r,n))}add(e,r){return this._leafNode(new SS(e,He.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==tt.nil&&this._leafNode(new CS(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,tt.addCodeArg)(r,i));return r.push("}"),new tt._Code(r)}if(e,r,n){if(this._blockNode(new Ra(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Ra(e))}else(){return this._elseNode(new nu)}endIf(){return this._endBlockNode(Ra,nu)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new ES(e),r)}forRange(e,r,n,i,s=this.opts.es5?ui.varKinds.var:ui.varKinds.let){let o=this._scope.toName(e);return this._for(new qS(s,o,r,n),()=>i(o))}forOf(e,r,n,i=ui.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=r instanceof tt.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,tt._)`${o}.length`,l=>{this.var(s,(0,tt._)`${o}[${l}]`),n(s)})}return this._for(new Bh("of",i,s,r),()=>n(s))}forIn(e,r,n,i=this.opts.es5?ui.varKinds.var:ui.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,tt._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new Bh("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(Ca)}label(e){return this._leafNode(new wS(e))}break(e){return this._leafNode(new _S(e))}return(e){let r=new vf;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(vf)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new OS;if(this._blockNode(i),this.code(e),r){let s=this.name("e");this._currNode=i.catch=new bf(s),r(s)}return n&&(this._currNode=i.finally=new Sf,this.code(n)),this._endBlockNode(bf,Sf)}throw(e){return this._leafNode(new RS(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=tt.nil,n,i){return this._blockNode(new yf(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(yf)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Ra))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};He.CodeGen=IS;function xa(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Vh(t,e){return e instanceof tt._CodeOrName?xa(t,e.names):t}function iu(t,e,r){if(t instanceof tt.Name)return n(t);if(!i(t))return t;return new tt._Code(t._items.reduce((s,o)=>(o instanceof tt.Name&&(o=n(o)),o instanceof tt._Code?s.push(...o._items):s.push(o),s),[]));function n(s){let o=r[s.str];return o===void 0||e[s.str]!==1?s:(delete e[s.str],o)}function i(s){return s instanceof tt._Code&&s._items.some(o=>o instanceof tt.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function O2(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function qq(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,tt._)`!${PS(t)}`}He.not=qq;var I2=Oq(He.operators.AND);function P2(...t){return t.reduce(I2)}He.and=P2;var k2=Oq(He.operators.OR);function A2(...t){return t.reduce(k2)}He.or=A2;function Oq(t){return(e,r)=>e===tt.nil?r:r===tt.nil?e:(0,tt._)`${PS(e)} ${t} ${PS(r)}`}function PS(t){return t instanceof tt.Name?t:(0,tt._)`(${t})`}});var nt=V(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.checkStrictMode=Ge.getErrorPath=Ge.Type=Ge.useFunc=Ge.setEvaluated=Ge.evaluatedPropsToName=Ge.mergeEvaluated=Ge.eachItem=Ge.unescapeJsonPointer=Ge.escapeJsonPointer=Ge.escapeFragment=Ge.unescapeFragment=Ge.schemaRefOrVal=Ge.schemaHasRulesButRef=Ge.schemaHasRules=Ge.checkUnknownRules=Ge.alwaysValidSchema=Ge.toHash=void 0;var kt=Je(),T2=mf();function $2(t){let e={};for(let r of t)e[r]=!0;return e}Ge.toHash=$2;function N2(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(kq(t,e),!Aq(e,t.self.RULES.all))}Ge.alwaysValidSchema=N2;function kq(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let s in e)i[s]||Nq(t,`unknown keyword: "${s}"`)}Ge.checkUnknownRules=kq;function Aq(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Ge.schemaHasRules=Aq;function M2(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Ge.schemaHasRulesButRef=M2;function F2({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,kt._)`${r}`}return(0,kt._)`${t}${e}${(0,kt.getProperty)(n)}`}Ge.schemaRefOrVal=F2;function D2(t){return Tq(decodeURIComponent(t))}Ge.unescapeFragment=D2;function j2(t){return encodeURIComponent(AS(t))}Ge.escapeFragment=j2;function AS(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Ge.escapeJsonPointer=AS;function Tq(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Ge.unescapeJsonPointer=Tq;function L2(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Ge.eachItem=L2;function Iq({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,s,o,l)=>{let c=o===void 0?s:o instanceof kt.Name?(s instanceof kt.Name?t(i,s,o):e(i,s,o),o):s instanceof kt.Name?(e(i,o,s),s):r(s,o);return l===kt.Name&&!(c instanceof kt.Name)?n(i,c):c}}Ge.mergeEvaluated={props:Iq({mergeNames:(t,e,r)=>t.if((0,kt._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,kt._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,kt._)`${r} || {}`).code((0,kt._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,kt._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,kt._)`${r} || {}`),TS(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:$q}),items:Iq({mergeNames:(t,e,r)=>t.if((0,kt._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,kt._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,kt._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,kt._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function $q(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,kt._)`{}`);return e!==void 0&&TS(t,r,e),r}Ge.evaluatedPropsToName=$q;function TS(t,e,r){Object.keys(r).forEach(n=>t.assign((0,kt._)`${e}${(0,kt.getProperty)(n)}`,!0))}Ge.setEvaluated=TS;var Pq={};function U2(t,e){return t.scopeValue("func",{ref:e,code:Pq[e.code]||(Pq[e.code]=new T2._Code(e.code))})}Ge.useFunc=U2;var kS;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(kS||(Ge.Type=kS={}));function H2(t,e,r){if(t instanceof kt.Name){let n=e===kS.Num;return r?n?(0,kt._)`"[" + ${t} + "]"`:(0,kt._)`"['" + ${t} + "']"`:n?(0,kt._)`"/" + ${t}`:(0,kt._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,kt.getProperty)(t).toString():"/"+AS(t)}Ge.getErrorPath=H2;function Nq(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Ge.checkStrictMode=Nq});var _s=V($S=>{"use strict";Object.defineProperty($S,"__esModule",{value:!0});var _r=Je(),B2={data:new _r.Name("data"),valCxt:new _r.Name("valCxt"),instancePath:new _r.Name("instancePath"),parentData:new _r.Name("parentData"),parentDataProperty:new _r.Name("parentDataProperty"),rootData:new _r.Name("rootData"),dynamicAnchors:new _r.Name("dynamicAnchors"),vErrors:new _r.Name("vErrors"),errors:new _r.Name("errors"),this:new _r.Name("this"),self:new _r.Name("self"),scope:new _r.Name("scope"),json:new _r.Name("json"),jsonPos:new _r.Name("jsonPos"),jsonLen:new _r.Name("jsonLen"),jsonPart:new _r.Name("jsonPart")};$S.default=B2});var wf=V(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.extendErrors=Rr.resetErrorsCount=Rr.reportExtraError=Rr.reportError=Rr.keyword$DataError=Rr.keywordError=void 0;var it=Je(),zh=nt(),Ur=_s();Rr.keywordError={message:({keyword:t})=>(0,it.str)`must pass "${t}" keyword validation`};Rr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,it.str)`"${t}" keyword must be ${e} ($data)`:(0,it.str)`"${t}" keyword is invalid ($data)`};function V2(t,e=Rr.keywordError,r,n){let{it:i}=t,{gen:s,compositeRule:o,allErrors:l}=i,c=Dq(t,e,r);n??(o||l)?Mq(s,c):Fq(i,(0,it._)`[${c}]`)}Rr.reportError=V2;function W2(t,e=Rr.keywordError,r){let{it:n}=t,{gen:i,compositeRule:s,allErrors:o}=n,l=Dq(t,e,r);Mq(i,l),s||o||Fq(n,Ur.default.vErrors)}Rr.reportExtraError=W2;function z2(t,e){t.assign(Ur.default.errors,e),t.if((0,it._)`${Ur.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,it._)`${Ur.default.vErrors}.length`,e),()=>t.assign(Ur.default.vErrors,null)))}Rr.resetErrorsCount=z2;function J2({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,Ur.default.errors,l=>{t.const(o,(0,it._)`${Ur.default.vErrors}[${l}]`),t.if((0,it._)`${o}.instancePath === undefined`,()=>t.assign((0,it._)`${o}.instancePath`,(0,it.strConcat)(Ur.default.instancePath,s.errorPath))),t.assign((0,it._)`${o}.schemaPath`,(0,it.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,it._)`${o}.schema`,r),t.assign((0,it._)`${o}.data`,n))})}Rr.extendErrors=J2;function Mq(t,e){let r=t.const("err",e);t.if((0,it._)`${Ur.default.vErrors} === null`,()=>t.assign(Ur.default.vErrors,(0,it._)`[${r}]`),(0,it._)`${Ur.default.vErrors}.push(${r})`),t.code((0,it._)`${Ur.default.errors}++`)}function Fq(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,it._)`new ${t.ValidationError}(${e})`):(r.assign((0,it._)`${n}.errors`,e),r.return(!1))}var Ea={keyword:new it.Name("keyword"),schemaPath:new it.Name("schemaPath"),params:new it.Name("params"),propertyName:new it.Name("propertyName"),message:new it.Name("message"),schema:new it.Name("schema"),parentSchema:new it.Name("parentSchema")};function Dq(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,it._)`{}`:G2(t,e,r)}function G2(t,e,r={}){let{gen:n,it:i}=t,s=[Y2(i,r),K2(t,r)];return Q2(t,e,s),n.object(...s)}function Y2({errorPath:t},{instancePath:e}){let r=e?(0,it.str)`${t}${(0,zh.getErrorPath)(e,zh.Type.Str)}`:t;return[Ur.default.instancePath,(0,it.strConcat)(Ur.default.instancePath,r)]}function K2({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,it.str)`${e}/${t}`;return r&&(i=(0,it.str)`${i}${(0,zh.getErrorPath)(r,zh.Type.Str)}`),[Ea.schemaPath,i]}function Q2(t,{params:e,message:r},n){let{keyword:i,data:s,schemaValue:o,it:l}=t,{opts:c,propertyName:d,topSchemaRef:p,schemaPath:m}=l;n.push([Ea.keyword,i],[Ea.params,typeof e=="function"?e(t):e||(0,it._)`{}`]),c.messages&&n.push([Ea.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Ea.schema,o],[Ea.parentSchema,(0,it._)`${p}${m}`],[Ur.default.data,s]),d&&n.push([Ea.propertyName,d])}});var Lq=V(su=>{"use strict";Object.defineProperty(su,"__esModule",{value:!0});su.boolOrEmptySchema=su.topBoolOrEmptySchema=void 0;var Z2=wf(),X2=Je(),eU=_s(),tU={message:"boolean schema is false"};function rU(t){let{gen:e,schema:r,validateName:n}=t;r===!1?jq(t,!1):typeof r=="object"&&r.$async===!0?e.return(eU.default.data):(e.assign((0,X2._)`${n}.errors`,null),e.return(!0))}su.topBoolOrEmptySchema=rU;function nU(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),jq(t)):r.var(e,!0)}su.boolOrEmptySchema=nU;function jq(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Z2.reportError)(i,tU,void 0,e)}});var NS=V(ou=>{"use strict";Object.defineProperty(ou,"__esModule",{value:!0});ou.getRules=ou.isJSONType=void 0;var iU=["string","number","integer","boolean","null","object","array"],sU=new Set(iU);function oU(t){return typeof t=="string"&&sU.has(t)}ou.isJSONType=oU;function aU(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}ou.getRules=aU});var MS=V(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.shouldUseRule=uo.shouldUseGroup=uo.schemaHasRulesForType=void 0;function lU({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Uq(t,n)}uo.schemaHasRulesForType=lU;function Uq(t,e){return e.rules.some(r=>Hq(t,r))}uo.shouldUseGroup=Uq;function Hq(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}uo.shouldUseRule=Hq});var _f=V(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.reportTypeError=Cr.checkDataTypes=Cr.checkDataType=Cr.coerceAndCheckDataType=Cr.getJSONTypes=Cr.getSchemaTypes=Cr.DataType=void 0;var uU=NS(),cU=MS(),fU=wf(),Fe=Je(),Bq=nt(),au;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(au||(Cr.DataType=au={}));function dU(t){let e=Vq(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Cr.getSchemaTypes=dU;function Vq(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(uU.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Cr.getJSONTypes=Vq;function pU(t,e){let{gen:r,data:n,opts:i}=t,s=hU(e,i.coerceTypes),o=e.length>0&&!(s.length===0&&e.length===1&&(0,cU.schemaHasRulesForType)(t,e[0]));if(o){let l=DS(e,n,i.strictNumbers,au.Wrong);r.if(l,()=>{s.length?mU(t,e,s):jS(t)})}return o}Cr.coerceAndCheckDataType=pU;var Wq=new Set(["string","number","integer","boolean","null"]);function hU(t,e){return e?t.filter(r=>Wq.has(r)||e==="array"&&r==="array"):[]}function mU(t,e,r){let{gen:n,data:i,opts:s}=t,o=n.let("dataType",(0,Fe._)`typeof ${i}`),l=n.let("coerced",(0,Fe._)`undefined`);s.coerceTypes==="array"&&n.if((0,Fe._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,Fe._)`${i}[0]`).assign(o,(0,Fe._)`typeof ${i}`).if(DS(e,i,s.strictNumbers),()=>n.assign(l,i))),n.if((0,Fe._)`${l} !== undefined`);for(let d of r)(Wq.has(d)||d==="array"&&s.coerceTypes==="array")&&c(d);n.else(),jS(t),n.endIf(),n.if((0,Fe._)`${l} !== undefined`,()=>{n.assign(i,l),gU(t,l)});function c(d){switch(d){case"string":n.elseIf((0,Fe._)`${o} == "number" || ${o} == "boolean"`).assign(l,(0,Fe._)`"" + ${i}`).elseIf((0,Fe._)`${i} === null`).assign(l,(0,Fe._)`""`);return;case"number":n.elseIf((0,Fe._)`${o} == "boolean" || ${i} === null
|
|
25
25
|
|| (${o} == "string" && ${i} && ${i} == +${i})`).assign(l,(0,Fe._)`+${i}`);return;case"integer":n.elseIf((0,Fe._)`${o} === "boolean" || ${i} === null
|
|
26
26
|
|| (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(l,(0,Fe._)`+${i}`);return;case"boolean":n.elseIf((0,Fe._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(l,!1).elseIf((0,Fe._)`${i} === "true" || ${i} === 1`).assign(l,!0);return;case"null":n.elseIf((0,Fe._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(l,null);return;case"array":n.elseIf((0,Fe._)`${o} === "string" || ${o} === "number"
|
|
27
|
-
|| ${o} === "boolean" || ${i} === null`).assign(l,(0,Fe._)`[${i}]`)}}}function gU({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,Fe._)`${e} !== undefined`,()=>t.assign((0,Fe._)`${e}[${r}]`,n))}function FS(t,e,r,n=au.Correct){let i=n===au.Correct?Fe.operators.EQ:Fe.operators.NEQ,s;switch(t){case"null":return(0,Fe._)`${e} ${i} null`;case"array":s=(0,Fe._)`Array.isArray(${e})`;break;case"object":s=(0,Fe._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=o((0,Fe._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=o();break;default:return(0,Fe._)`typeof ${e} ${i} ${t}`}return n===au.Correct?s:(0,Fe.not)(s);function o(l=Fe.nil){return(0,Fe.and)((0,Fe._)`typeof ${e} == "number"`,l,r?(0,Fe._)`isFinite(${e})`:Fe.nil)}}Cr.checkDataType=FS;function DS(t,e,r,n){if(t.length===1)return FS(t[0],e,r,n);let i,s=(0,Bq.toHash)(t);if(s.array&&s.object){let o=(0,Fe._)`typeof ${e} != "object"`;i=s.null?o:(0,Fe._)`!${e} || ${o}`,delete s.null,delete s.array,delete s.object}else i=Fe.nil;s.number&&delete s.integer;for(let o in s)i=(0,Fe.and)(i,FS(o,e,r,n));return i}Cr.checkDataTypes=DS;var yU={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Fe._)`{type: ${t}}`:(0,Fe._)`{type: ${e}}`};function jS(t){let e=vU(t);(0,fU.reportError)(e,yU)}Cr.reportTypeError=jS;function vU(t){let{gen:e,data:r,schema:n}=t,i=(0,Bq.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var Jq=V(Jh=>{"use strict";Object.defineProperty(Jh,"__esModule",{value:!0});Jh.assignDefaults=void 0;var lu=Je(),bU=nt();function SU(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)zq(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,s)=>zq(t,s,i.default))}Jh.assignDefaults=SU;function zq(t,e,r){let{gen:n,compositeRule:i,data:s,opts:o}=t;if(r===void 0)return;let l=(0,lu._)`${s}${(0,lu.getProperty)(e)}`;if(i){(0,bU.checkStrictMode)(t,`default is ignored for: ${l}`);return}let c=(0,lu._)`${l} === undefined`;o.useDefaults==="empty"&&(c=(0,lu._)`${c} || ${l} === null || ${l} === ""`),n.if(c,(0,lu._)`${l} = ${(0,lu.stringify)(r)}`)}});var Hn=V(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.validateUnion=Ot.validateArray=Ot.usePattern=Ot.callValidateCode=Ot.schemaProperties=Ot.allSchemaProperties=Ot.noPropertyInData=Ot.propertyInData=Ot.isOwnProperty=Ot.hasPropFunc=Ot.reportMissingProp=Ot.checkMissingProp=Ot.checkReportMissingProp=void 0;var Mt=Je(),LS=nt(),co=_s(),wU=nt();function _U(t,e){let{gen:r,data:n,it:i}=t;r.if(HS(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Mt._)`${e}`},!0),t.error()})}Ot.checkReportMissingProp=_U;function RU({gen:t,data:e,it:{opts:r}},n,i){return(0,Mt.or)(...n.map(s=>(0,Mt.and)(HS(t,e,s,r.ownProperties),(0,Mt._)`${i} = ${s}`)))}Ot.checkMissingProp=RU;function CU(t,e){t.setParams({missingProperty:e},!0),t.error()}Ot.reportMissingProp=CU;function Gq(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Mt._)`Object.prototype.hasOwnProperty`})}Ot.hasPropFunc=Gq;function US(t,e,r){return(0,Mt._)`${Gq(t)}.call(${e}, ${r})`}Ot.isOwnProperty=US;function xU(t,e,r,n){let i=(0,Mt._)`${e}${(0,Mt.getProperty)(r)} !== undefined`;return n?(0,Mt._)`${i} && ${US(t,e,r)}`:i}Ot.propertyInData=xU;function HS(t,e,r,n){let i=(0,Mt._)`${e}${(0,Mt.getProperty)(r)} === undefined`;return n?(0,Mt.or)(i,(0,Mt.not)(US(t,e,r))):i}Ot.noPropertyInData=HS;function Yq(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Ot.allSchemaProperties=Yq;function EU(t,e){return Yq(e).filter(r=>!(0,LS.alwaysValidSchema)(t,e[r]))}Ot.schemaProperties=EU;function qU({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:s},it:o},l,c,d){let p=d?(0,Mt._)`${t}, ${e}, ${n}${i}`:e,m=[[co.default.instancePath,(0,Mt.strConcat)(co.default.instancePath,s)],[co.default.parentData,o.parentData],[co.default.parentDataProperty,o.parentDataProperty],[co.default.rootData,co.default.rootData]];o.opts.dynamicRef&&m.push([co.default.dynamicAnchors,co.default.dynamicAnchors]);let y=(0,Mt._)`${p}, ${r.object(...m)}`;return c!==Mt.nil?(0,Mt._)`${l}.call(${c}, ${y})`:(0,Mt._)`${l}(${y})`}Ot.callValidateCode=qU;var OU=(0,Mt._)`new RegExp`;function IU({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,s=i(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,Mt._)`${i.code==="new RegExp"?OU:(0,wU.useFunc)(t,i)}(${r}, ${n})`})}Ot.usePattern=IU;function PU(t){let{gen:e,data:r,keyword:n,it:i}=t,s=e.name("valid");if(i.allErrors){let l=e.let("valid",!0);return o(()=>e.assign(l,!1)),l}return e.var(s,!0),o(()=>e.break()),s;function o(l){let c=e.const("len",(0,Mt._)`${r}.length`);e.forRange("i",0,c,d=>{t.subschema({keyword:n,dataProp:d,dataPropType:LS.Type.Num},s),e.if((0,Mt.not)(s),l)})}}Ot.validateArray=PU;function kU(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,LS.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),l=e.name("_valid");e.block(()=>r.forEach((c,d)=>{let p=t.subschema({keyword:n,schemaProp:d,compositeRule:!0},l);e.assign(o,(0,Mt._)`${o} || ${l}`),t.mergeValidEvaluated(p,l)||e.if((0,Mt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}Ot.validateUnion=kU});var Zq=V(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.validateKeywordUsage=Hi.validSchemaType=Hi.funcKeywordCode=Hi.macroKeywordCode=void 0;var Hr=Je(),qa=_s(),AU=Hn(),TU=wf();function $U(t,e){let{gen:r,keyword:n,schema:i,parentSchema:s,it:o}=t,l=e.macro.call(o.self,i,s,o),c=Qq(r,n,l);o.opts.validateSchema!==!1&&o.self.validateSchema(l,!0);let d=r.name("valid");t.subschema({schema:l,schemaPath:Hr.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},d),t.pass(d,()=>t.error(!0))}Hi.macroKeywordCode=$U;function NU(t,e){var r;let{gen:n,keyword:i,schema:s,parentSchema:o,$data:l,it:c}=t;FU(c,e);let d=!l&&e.compile?e.compile.call(c.self,s,o,c):e.validate,p=Qq(n,i,d),m=n.let("valid");t.block$data(m,y),t.ok((r=e.valid)!==null&&r!==void 0?r:m);function y(){if(e.errors===!1)C(),e.modifying&&Kq(t),v(()=>t.error());else{let _=e.async?b():E();e.modifying&&Kq(t),v(()=>MU(t,_))}}function b(){let _=n.let("ruleErrs",null);return n.try(()=>C((0,Hr._)`await `),q=>n.assign(m,!1).if((0,Hr._)`${q} instanceof ${c.ValidationError}`,()=>n.assign(_,(0,Hr._)`${q}.errors`),()=>n.throw(q))),_}function E(){let _=(0,Hr._)`${p}.errors`;return n.assign(_,null),C(Hr.nil),_}function C(_=e.async?(0,Hr._)`await `:Hr.nil){let q=c.opts.passContext?qa.default.this:qa.default.self,k=!("compile"in e&&!l||e.schema===!1);n.assign(m,(0,Hr._)`${_}${(0,AU.callValidateCode)(t,p,q,k)}`,e.modifying)}function v(_){var q;n.if((0,Hr.not)((q=e.valid)!==null&&q!==void 0?q:m),_)}}Hi.funcKeywordCode=NU;function Kq(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Hr._)`${n.parentData}[${n.parentDataProperty}]`))}function MU(t,e){let{gen:r}=t;r.if((0,Hr._)`Array.isArray(${e})`,()=>{r.assign(qa.default.vErrors,(0,Hr._)`${qa.default.vErrors} === null ? ${e} : ${qa.default.vErrors}.concat(${e})`).assign(qa.default.errors,(0,Hr._)`${qa.default.vErrors}.length`),(0,TU.extendErrors)(t)},()=>t.error())}function FU({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Qq(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Hr.stringify)(r)})}function DU(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Hi.validSchemaType=DU;function jU({schema:t,opts:e,self:r,errSchemaPath:n},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(l=>!Object.prototype.hasOwnProperty.call(t,l)))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Hi.validateKeywordUsage=jU});var eO=V(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.extendSubschemaMode=fo.extendSubschemaData=fo.getSubschema=void 0;var Bi=Je(),Xq=nt();function LU(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:s,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let l=t.schema[e];return r===void 0?{schema:l,schemaPath:(0,Bi._)`${t.schemaPath}${(0,Bi.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:l[r],schemaPath:(0,Bi._)`${t.schemaPath}${(0,Bi.getProperty)(e)}${(0,Bi.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Xq.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||s===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}fo.getSubschema=LU;function UU(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:s,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:l}=e;if(r!==void 0){let{errorPath:d,dataPathArr:p,opts:m}=e,y=l.let("data",(0,Bi._)`${e.data}${(0,Bi.getProperty)(r)}`,!0);c(y),t.errorPath=(0,Bi.str)`${d}${(0,Xq.getErrorPath)(r,n,m.jsPropertySyntax)}`,t.parentDataProperty=(0,Bi._)`${r}`,t.dataPathArr=[...p,t.parentDataProperty]}if(i!==void 0){let d=i instanceof Bi.Name?i:l.let("data",i,!0);c(d),o!==void 0&&(t.propertyName=o)}s&&(t.dataTypes=s);function c(d){t.data=d,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,d]}}fo.extendSubschemaData=UU;function HU(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:s}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}fo.extendSubschemaMode=HU});var BS=V((PQ,tO)=>{"use strict";tO.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;i--!==0;){var o=s[i];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var nO=V((kQ,rO)=>{"use strict";var po=rO.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};Gh(e,n,i,t,"",t)};po.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};po.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};po.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};po.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Gh(t,e,r,n,i,s,o,l,c,d){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,s,o,l,c,d);for(var p in n){var m=n[p];if(Array.isArray(m)){if(p in po.arrayKeywords)for(var y=0;y<m.length;y++)Gh(t,e,r,m[y],i+"/"+p+"/"+y,s,i,p,n,y)}else if(p in po.propsKeywords){if(m&&typeof m=="object")for(var b in m)Gh(t,e,r,m[b],i+"/"+p+"/"+BU(b),s,i,p,n,b)}else(p in po.keywords||t.allKeys&&!(p in po.skipKeywords))&&Gh(t,e,r,m,i+"/"+p,s,i,p,n)}r(n,i,s,o,l,c,d)}}function BU(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Rf=V(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.getSchemaRefs=tn.resolveUrl=tn.normalizeId=tn._getFullPath=tn.getFullPath=tn.inlineRef=void 0;var VU=nt(),WU=BS(),zU=nO(),JU=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function GU(t,e=!0){return typeof t=="boolean"?!0:e===!0?!VS(t):e?iO(t)<=e:!1}tn.inlineRef=GU;var YU=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function VS(t){for(let e in t){if(YU.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(VS)||typeof r=="object"&&VS(r))return!0}return!1}function iO(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!JU.has(r)&&(typeof t[r]=="object"&&(0,VU.eachItem)(t[r],n=>e+=iO(n)),e===1/0))return 1/0}return e}function sO(t,e="",r){r!==!1&&(e=uu(e));let n=t.parse(e);return oO(t,n)}tn.getFullPath=sO;function oO(t,e){return t.serialize(e).split("#")[0]+"#"}tn._getFullPath=oO;var KU=/#\/?$/;function uu(t){return t?t.replace(KU,""):""}tn.normalizeId=uu;function QU(t,e,r){return r=uu(r),t.resolve(e,r)}tn.resolveUrl=QU;var ZU=/^[a-z_][-a-z0-9._]*$/i;function XU(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=uu(t[r]||e),s={"":i},o=sO(n,i,!1),l={},c=new Set;return zU(t,{allKeys:!0},(m,y,b,E)=>{if(E===void 0)return;let C=o+y,v=s[E];typeof m[r]=="string"&&(v=_.call(this,m[r])),q.call(this,m.$anchor),q.call(this,m.$dynamicAnchor),s[y]=v;function _(k){let O=this.opts.uriResolver.resolve;if(k=uu(v?O(v,k):k),c.has(k))throw p(k);c.add(k);let M=this.refs[k];return typeof M=="string"&&(M=this.refs[M]),typeof M=="object"?d(m,M.schema,k):k!==uu(C)&&(k[0]==="#"?(d(m,l[k],k),l[k]=m):this.refs[k]=C),k}function q(k){if(typeof k=="string"){if(!ZU.test(k))throw new Error(`invalid anchor "${k}"`);_.call(this,`#${k}`)}}}),l;function d(m,y,b){if(y!==void 0&&!WU(m,y))throw p(b)}function p(m){return new Error(`reference "${m}" resolves to more than one schema`)}}tn.getSchemaRefs=XU});var Ef=V(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.getData=ho.KeywordCxt=ho.validateFunctionCode=void 0;var fO=Lq(),aO=_f(),zS=MS(),Yh=_f(),eH=Jq(),xf=Zq(),WS=eO(),we=Je(),Pe=_s(),tH=Rf(),Rs=nt(),Cf=wf();function rH(t){if(hO(t)&&(mO(t),pO(t))){sH(t);return}dO(t,()=>(0,fO.topBoolOrEmptySchema)(t))}ho.validateFunctionCode=rH;function dO({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},s){i.code.es5?t.func(e,(0,we._)`${Pe.default.data}, ${Pe.default.valCxt}`,n.$async,()=>{t.code((0,we._)`"use strict"; ${lO(r,i)}`),iH(t,i),t.code(s)}):t.func(e,(0,we._)`${Pe.default.data}, ${nH(i)}`,n.$async,()=>t.code(lO(r,i)).code(s))}function nH(t){return(0,we._)`{${Pe.default.instancePath}="", ${Pe.default.parentData}, ${Pe.default.parentDataProperty}, ${Pe.default.rootData}=${Pe.default.data}${t.dynamicRef?(0,we._)`, ${Pe.default.dynamicAnchors}={}`:we.nil}}={}`}function iH(t,e){t.if(Pe.default.valCxt,()=>{t.var(Pe.default.instancePath,(0,we._)`${Pe.default.valCxt}.${Pe.default.instancePath}`),t.var(Pe.default.parentData,(0,we._)`${Pe.default.valCxt}.${Pe.default.parentData}`),t.var(Pe.default.parentDataProperty,(0,we._)`${Pe.default.valCxt}.${Pe.default.parentDataProperty}`),t.var(Pe.default.rootData,(0,we._)`${Pe.default.valCxt}.${Pe.default.rootData}`),e.dynamicRef&&t.var(Pe.default.dynamicAnchors,(0,we._)`${Pe.default.valCxt}.${Pe.default.dynamicAnchors}`)},()=>{t.var(Pe.default.instancePath,(0,we._)`""`),t.var(Pe.default.parentData,(0,we._)`undefined`),t.var(Pe.default.parentDataProperty,(0,we._)`undefined`),t.var(Pe.default.rootData,Pe.default.data),e.dynamicRef&&t.var(Pe.default.dynamicAnchors,(0,we._)`{}`)})}function sH(t){let{schema:e,opts:r,gen:n}=t;dO(t,()=>{r.$comment&&e.$comment&&yO(t),cH(t),n.let(Pe.default.vErrors,null),n.let(Pe.default.errors,0),r.unevaluated&&oH(t),gO(t),pH(t)})}function oH(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,we._)`${r}.evaluated`),e.if((0,we._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,we._)`${t.evaluated}.props`,(0,we._)`undefined`)),e.if((0,we._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,we._)`${t.evaluated}.items`,(0,we._)`undefined`))}function lO(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,we._)`/*# sourceURL=${r} */`:we.nil}function aH(t,e){if(hO(t)&&(mO(t),pO(t))){lH(t,e);return}(0,fO.boolOrEmptySchema)(t,e)}function pO({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function hO(t){return typeof t.schema!="boolean"}function lH(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&yO(t),fH(t),dH(t);let s=n.const("_errs",Pe.default.errors);gO(t,s),n.var(e,(0,we._)`${s} === ${Pe.default.errors}`)}function mO(t){(0,Rs.checkUnknownRules)(t),uH(t)}function gO(t,e){if(t.opts.jtd)return uO(t,[],!1,e);let r=(0,aO.getSchemaTypes)(t.schema),n=(0,aO.coerceAndCheckDataType)(t,r);uO(t,r,!n,e)}function uH(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Rs.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function cH(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Rs.checkStrictMode)(t,"default is ignored in the schema root")}function fH(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,tH.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function dH(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function yO({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let s=r.$comment;if(i.$comment===!0)t.code((0,we._)`${Pe.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){let o=(0,we.str)`${n}/$comment`,l=t.scopeValue("root",{ref:e.root});t.code((0,we._)`${Pe.default.self}.opts.$comment(${s}, ${o}, ${l}.schema)`)}}function pH(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:s}=t;r.$async?e.if((0,we._)`${Pe.default.errors} === 0`,()=>e.return(Pe.default.data),()=>e.throw((0,we._)`new ${i}(${Pe.default.vErrors})`)):(e.assign((0,we._)`${n}.errors`,Pe.default.vErrors),s.unevaluated&&hH(t),e.return((0,we._)`${Pe.default.errors} === 0`))}function hH({gen:t,evaluated:e,props:r,items:n}){r instanceof we.Name&&t.assign((0,we._)`${e}.props`,r),n instanceof we.Name&&t.assign((0,we._)`${e}.items`,n)}function uO(t,e,r,n){let{gen:i,schema:s,data:o,allErrors:l,opts:c,self:d}=t,{RULES:p}=d;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Rs.schemaHasRulesButRef)(s,p))){i.block(()=>bO(t,"$ref",p.all.$ref.definition));return}c.jtd||mH(t,e),i.block(()=>{for(let y of p.rules)m(y);m(p.post)});function m(y){(0,zS.shouldUseGroup)(s,y)&&(y.type?(i.if((0,Yh.checkDataType)(y.type,o,c.strictNumbers)),cO(t,y),e.length===1&&e[0]===y.type&&r&&(i.else(),(0,Yh.reportTypeError)(t)),i.endIf()):cO(t,y),l||i.if((0,we._)`${Pe.default.errors} === ${n||0}`))}}function cO(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,eH.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,zS.shouldUseRule)(n,s)&&bO(t,s.keyword,s.definition,e.type)})}function mH(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(gH(t,e),t.opts.allowUnionTypes||yH(t,e),vH(t,t.dataTypes))}function gH(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{vO(t.dataTypes,r)||JS(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),SH(t,e)}}function yH(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&JS(t,"use allowUnionTypes to allow union type keyword")}function vH(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,zS.shouldUseRule)(t.schema,i)){let{type:s}=i.definition;s.length&&!s.some(o=>bH(e,o))&&JS(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function bH(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function vO(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function SH(t,e){let r=[];for(let n of t.dataTypes)vO(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function JS(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Rs.checkStrictMode)(t,e,t.opts.strictTypes)}var Kh=class{constructor(e,r,n){if((0,xf.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Rs.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",SO(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,xf.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",Pe.default.errors))}result(e,r,n){this.failResult((0,we.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,we.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,we._)`${r} !== undefined && (${(0,we.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Cf.reportExtraError:Cf.reportError)(this,this.def.error,r)}$dataError(){(0,Cf.reportError)(this,this.def.$dataError||Cf.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Cf.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=we.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=we.nil,r=we.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:s,def:o}=this;n.if((0,we.or)((0,we._)`${i} === undefined`,r)),e!==we.nil&&n.assign(e,!0),(s.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==we.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:s}=this;return(0,we.or)(o(),l());function o(){if(n.length){if(!(r instanceof we.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,we._)`${(0,Yh.checkDataTypes)(c,r,s.opts.strictNumbers,Yh.DataType.Wrong)}`}return we.nil}function l(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,we._)`!${c}(${r})`}return we.nil}}subschema(e,r){let n=(0,WS.getSubschema)(this.it,e);(0,WS.extendSubschemaData)(n,this.it,e),(0,WS.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return aH(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Rs.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Rs.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,we.Name)),!0}};ho.KeywordCxt=Kh;function bO(t,e,r,n){let i=new Kh(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,xf.funcKeywordCode)(i,r):"macro"in r?(0,xf.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,xf.funcKeywordCode)(i,r)}var wH=/^\/(?:[^~]|~0|~1)*$/,_H=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function SO(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,s;if(t==="")return Pe.default.rootData;if(t[0]==="/"){if(!wH.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=Pe.default.rootData}else{let d=_H.exec(t);if(!d)throw new Error(`Invalid JSON-pointer: ${t}`);let p=+d[1];if(i=d[2],i==="#"){if(p>=e)throw new Error(c("property/index",p));return n[e-p]}if(p>e)throw new Error(c("data",p));if(s=r[e-p],!i)return s}let o=s,l=i.split("/");for(let d of l)d&&(s=(0,we._)`${s}${(0,we.getProperty)((0,Rs.unescapeJsonPointer)(d))}`,o=(0,we._)`${o} && ${s}`);return o;function c(d,p){return`Cannot access ${d} ${p} levels up, current level is ${e}`}}ho.getData=SO});var Qh=V(YS=>{"use strict";Object.defineProperty(YS,"__esModule",{value:!0});var GS=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};YS.default=GS});var qf=V(ZS=>{"use strict";Object.defineProperty(ZS,"__esModule",{value:!0});var KS=Rf(),QS=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,KS.resolveUrl)(e,r,n),this.missingSchema=(0,KS.normalizeId)((0,KS.getFullPath)(e,this.missingRef))}};ZS.default=QS});var Xh=V(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.resolveSchema=Bn.getCompilingSchema=Bn.resolveRef=Bn.compileSchema=Bn.SchemaEnv=void 0;var ci=Je(),RH=Qh(),Oa=_s(),fi=Rf(),wO=nt(),CH=Ef(),cu=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,fi.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Bn.SchemaEnv=cu;function ew(t){let e=_O.call(this,t);if(e)return e;let r=(0,fi.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new ci.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),l;t.$async&&(l=o.scopeValue("Error",{ref:RH.default,code:(0,ci._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");t.validateName=c;let d={gen:o,allErrors:this.opts.allErrors,data:Oa.default.data,parentData:Oa.default.parentData,parentDataProperty:Oa.default.parentDataProperty,dataNames:[Oa.default.data],dataPathArr:[ci.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,ci.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:l,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:ci.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ci._)`""`,opts:this.opts,self:this},p;try{this._compilations.add(t),(0,CH.validateFunctionCode)(d),o.optimize(this.opts.code.optimize);let m=o.toString();p=`${o.scopeRefs(Oa.default.scope)}return ${m}`,this.opts.code.process&&(p=this.opts.code.process(p,t));let b=new Function(`${Oa.default.self}`,`${Oa.default.scope}`,p)(this,this.scope.get());if(this.scope.value(c,{ref:b}),b.errors=null,b.schema=t.schema,b.schemaEnv=t,t.$async&&(b.$async=!0),this.opts.code.source===!0&&(b.source={validateName:c,validateCode:m,scopeValues:o._values}),this.opts.unevaluated){let{props:E,items:C}=d;b.evaluated={props:E instanceof ci.Name?void 0:E,items:C instanceof ci.Name?void 0:C,dynamicProps:E instanceof ci.Name,dynamicItems:C instanceof ci.Name},b.source&&(b.source.evaluated=(0,ci.stringify)(b.evaluated))}return t.validate=b,t}catch(m){throw delete t.validate,delete t.validateName,p&&this.logger.error("Error compiling schema, function code:",p),m}finally{this._compilations.delete(t)}}Bn.compileSchema=ew;function xH(t,e,r){var n;r=(0,fi.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let s=OH.call(this,t,r);if(s===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:l}=this.opts;o&&(s=new cu({schema:o,schemaId:l,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=EH.call(this,s)}Bn.resolveRef=xH;function EH(t){return(0,fi.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:ew.call(this,t)}function _O(t){for(let e of this._compilations)if(qH(e,t))return e}Bn.getCompilingSchema=_O;function qH(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function OH(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Zh.call(this,t,e)}function Zh(t,e){let r=this.opts.uriResolver.parse(e),n=(0,fi._getFullPath)(this.opts.uriResolver,r),i=(0,fi.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return XS.call(this,r,t);let s=(0,fi.normalizeId)(n),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){let l=Zh.call(this,t,o);return typeof l?.schema!="object"?void 0:XS.call(this,r,l)}if(typeof o?.schema=="object"){if(o.validate||ew.call(this,o),s===(0,fi.normalizeId)(e)){let{schema:l}=o,{schemaId:c}=this.opts,d=l[c];return d&&(i=(0,fi.resolveUrl)(this.opts.uriResolver,i,d)),new cu({schema:l,schemaId:c,root:t,baseId:i})}return XS.call(this,r,o)}}Bn.resolveSchema=Zh;var IH=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function XS(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let l of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,wO.unescapeFragment)(l)];if(c===void 0)return;r=c;let d=typeof r=="object"&&r[this.opts.schemaId];!IH.has(l)&&d&&(e=(0,fi.resolveUrl)(this.opts.uriResolver,e,d))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,wO.schemaHasRulesButRef)(r,this.RULES)){let l=(0,fi.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=Zh.call(this,n,l)}let{schemaId:o}=this.opts;if(s=s||new cu({schema:r,schemaId:o,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var RO=V((FQ,PH)=>{PH.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var nw=V((DQ,IO)=>{"use strict";var kH=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),xO=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),tw=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),EO=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),AH=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function rw(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var TH=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function CO(t){return t.length=0,!0}function $H(t,e,r){if(t.length){let n=rw(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function NH(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],s=!1,o=!1,l=$H;for(let c=0;c<t.length;c++){let d=t[c];if(!(d==="["||d==="]"))if(d===":"){if(s===!0&&(o=!0),!l(i,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),n.push(":");continue}else if(d==="%"){if(!l(i,n,r))break;l=CO}else{i.push(d);continue}}return i.length&&(l===CO?r.zone=i.join(""):o?n.push(i.join("")):n.push(rw(i))),r.address=n.join(""),r}function qO(t){if(MH(t,":")<2)return{host:t,isIPV6:!1};let e=NH(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function MH(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function FH(t){let e=t,r=[],n=-1,i=0;for(;i=e.length;){if(i===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(i===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(i===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}var DH={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},jH=/[@/?#:]/g,LH=/[@/?#]/g;function OO(t,e){let r=e?LH:jH;return r.lastIndex=0,t.replace(r,n=>DH[n])}function UH(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let i=t.slice(n+1,n+3);if(tw(i)){let s=i.toUpperCase(),o=String.fromCharCode(parseInt(s,16));e&&EO(o)?r+=o:r+="%"+s,n+=2;continue}}r+=t[n]}return r}function HH(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(tw(n)){let i=n.toUpperCase(),s=String.fromCharCode(parseInt(i,16));s!=="."&&EO(s)?e+=s:e+="%"+i,r+=2;continue}}AH(t[r])?e+=t[r]:e+=escape(t[r])}return e}function BH(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(tw(n)){e+="%"+n.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function VH(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!xO(r)){let n=qO(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=OO(r,!1)}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}IO.exports={nonSimpleDomain:TH,recomposeAuthority:VH,reescapeHostDelimiters:OO,normalizePercentEncoding:UH,normalizePathEncoding:HH,escapePreservingEscapes:BH,removeDotSegments:FH,isIPv4:xO,isUUID:kH,normalizeIPv6:qO,stringArrayToHexStripped:rw}});var $O=V((jQ,TO)=>{"use strict";var{isUUID:WH}=nw(),zH=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,JH=["http","https","ws","wss","urn","urn:uuid"];function GH(t){return JH.indexOf(t)!==-1}function iw(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function PO(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function kO(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function YH(t){return t.secure=iw(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function KH(t){if((t.port===(iw(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function QH(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(zH);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,s=sw(i);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function ZH(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,s=sw(i);s&&(t=s.serialize(t,e));let o=t,l=t.nss;return o.path=`${n||e.nid}:${l}`,e.skipEscape=!0,o}function XH(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!WH(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function eB(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var AO={scheme:"http",domainHost:!0,parse:PO,serialize:kO},tB={scheme:"https",domainHost:AO.domainHost,parse:PO,serialize:kO},em={scheme:"ws",domainHost:!0,parse:YH,serialize:KH},rB={scheme:"wss",domainHost:em.domainHost,parse:em.parse,serialize:em.serialize},nB={scheme:"urn",parse:QH,serialize:ZH,skipNormalize:!0},iB={scheme:"urn:uuid",parse:XH,serialize:eB,skipNormalize:!0},tm={http:AO,https:tB,ws:em,wss:rB,urn:nB,"urn:uuid":iB};Object.setPrototypeOf(tm,null);function sw(t){return t&&(tm[t]||tm[t.toLowerCase()])||void 0}TO.exports={wsIsSecure:iw,SCHEMES:tm,isValidSchemeName:GH,getSchemeHandler:sw}});var LO=V((LQ,rm)=>{"use strict";var{normalizeIPv6:sB,removeDotSegments:Of,recomposeAuthority:oB,normalizePercentEncoding:aB,normalizePathEncoding:lB,escapePreservingEscapes:uB,reescapeHostDelimiters:cB,isIPv4:fB,nonSimpleDomain:dB}=nw(),{SCHEMES:pB,getSchemeHandler:MO}=$O();function hB(t,e){return typeof t=="string"?t=bB(t,e):typeof t=="object"&&(t=fu(Ia(t,e),e)),t}function mB(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=FO(fu(t,n),fu(e,n),n,!0);return n.skipEscape=!0,Ia(i,n)}function FO(t,e,r,n){let i={};return n||(t=fu(Ia(t,r),r),e=fu(Ia(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Of(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Of(e.path||""),i.query=e.query):(e.path?(e.path[0]==="/"?i.path=Of(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=Of(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function gB(t,e,r){let n=NO(t,r),i=NO(e,r);return n!==void 0&&i!==void 0&&n.toLowerCase()===i.toLowerCase()}function Ia(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[],s=MO(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=aB(r.path):(r.path=uB(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let o=oB(r);if(o!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(o),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let l=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(l=Of(l)),o===void 0&&l[0]==="/"&&l[1]==="/"&&(l="/%2F"+l.slice(2)),i.push(l)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var yB=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function vB(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function DO(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1,s=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let o=t.match(yB);if(o){n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]);let l=vB(n,o);if(l!==void 0&&(n.error=n.error||l,i=!0),n.host)if(fB(n.host)===!1){let p=sB(n.host);n.host=p.host.toLowerCase(),s=p.isIPV6}else s=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let c=MO(r.scheme||n.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&n.host&&(r.domainHost||c&&c.domainHost)&&s===!1&&dB(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(d){n.error=n.error||"Host's domain name can not be converted to ASCII: "+d}if((!c||c&&!c.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=cB(unescape(n.host),s))),n.path&&(n.path=lB(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}c&&c.parse&&c.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:i}}function fu(t,e){return DO(t,e).parsed}function bB(t,e){return jO(t,e).normalized}function jO(t,e){let{parsed:r,malformedAuthorityOrPort:n}=DO(t,e);return{normalized:n?t:Ia(r,e),malformedAuthorityOrPort:n}}function NO(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:n}=jO(t,e);return n?void 0:r}if(typeof t=="object")return Ia(t,e)}var ow={SCHEMES:pB,normalize:hB,resolve:mB,resolveComponent:FO,equal:gB,serialize:Ia,parse:fu};rm.exports=ow;rm.exports.default=ow;rm.exports.fastUri=ow});var HO=V(aw=>{"use strict";Object.defineProperty(aw,"__esModule",{value:!0});var UO=LO();UO.code='require("ajv/dist/runtime/uri").default';aw.default=UO});var KO=V(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.CodeGen=hr.Name=hr.nil=hr.stringify=hr.str=hr._=hr.KeywordCxt=void 0;var SB=Ef();Object.defineProperty(hr,"KeywordCxt",{enumerable:!0,get:function(){return SB.KeywordCxt}});var du=Je();Object.defineProperty(hr,"_",{enumerable:!0,get:function(){return du._}});Object.defineProperty(hr,"str",{enumerable:!0,get:function(){return du.str}});Object.defineProperty(hr,"stringify",{enumerable:!0,get:function(){return du.stringify}});Object.defineProperty(hr,"nil",{enumerable:!0,get:function(){return du.nil}});Object.defineProperty(hr,"Name",{enumerable:!0,get:function(){return du.Name}});Object.defineProperty(hr,"CodeGen",{enumerable:!0,get:function(){return du.CodeGen}});var wB=Qh(),JO=qf(),_B=NS(),If=Xh(),RB=Je(),Pf=Rf(),nm=_f(),uw=nt(),BO=RO(),CB=HO(),GO=(t,e)=>new RegExp(t,e);GO.code="new RegExp";var xB=["removeAdditional","useDefaults","coerceTypes"],EB=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),qB={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},OB={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},VO=200;function IB(t){var e,r,n,i,s,o,l,c,d,p,m,y,b,E,C,v,_,q,k,O,M,j,I,R,A;let F=t.strict,U=(e=t.code)===null||e===void 0?void 0:e.optimize,D=U===!0||U===void 0?1:U||0,J=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:GO,Q=(i=t.uriResolver)!==null&&i!==void 0?i:CB.default;return{strictSchema:(o=(s=t.strictSchema)!==null&&s!==void 0?s:F)!==null&&o!==void 0?o:!0,strictNumbers:(c=(l=t.strictNumbers)!==null&&l!==void 0?l:F)!==null&&c!==void 0?c:!0,strictTypes:(p=(d=t.strictTypes)!==null&&d!==void 0?d:F)!==null&&p!==void 0?p:"log",strictTuples:(y=(m=t.strictTuples)!==null&&m!==void 0?m:F)!==null&&y!==void 0?y:"log",strictRequired:(E=(b=t.strictRequired)!==null&&b!==void 0?b:F)!==null&&E!==void 0?E:!1,code:t.code?{...t.code,optimize:D,regExp:J}:{optimize:D,regExp:J},loopRequired:(C=t.loopRequired)!==null&&C!==void 0?C:VO,loopEnum:(v=t.loopEnum)!==null&&v!==void 0?v:VO,meta:(_=t.meta)!==null&&_!==void 0?_:!0,messages:(q=t.messages)!==null&&q!==void 0?q:!0,inlineRefs:(k=t.inlineRefs)!==null&&k!==void 0?k:!0,schemaId:(O=t.schemaId)!==null&&O!==void 0?O:"$id",addUsedSchema:(M=t.addUsedSchema)!==null&&M!==void 0?M:!0,validateSchema:(j=t.validateSchema)!==null&&j!==void 0?j:!0,validateFormats:(I=t.validateFormats)!==null&&I!==void 0?I:!0,unicodeRegExp:(R=t.unicodeRegExp)!==null&&R!==void 0?R:!0,int32range:(A=t.int32range)!==null&&A!==void 0?A:!0,uriResolver:Q}}var kf=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...IB(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new RB.ValueScope({scope:{},prefixes:EB,es5:r,lines:n}),this.logger=NB(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,_B.getRules)(),WO.call(this,qB,e,"NOT SUPPORTED"),WO.call(this,OB,e,"DEPRECATED","warn"),this._metaOpts=TB.call(this),e.formats&&kB.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&AB.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),PB.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=BO;n==="id"&&(i={...BO},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(p,m){await s.call(this,p.$schema);let y=this._addSchema(p,m);return y.validate||o.call(this,y)}async function s(p){p&&!this.getSchema(p)&&await i.call(this,{$ref:p},!0)}async function o(p){try{return this._compileSchemaEnv(p)}catch(m){if(!(m instanceof JO.default))throw m;return l.call(this,m),await c.call(this,m.missingSchema),o.call(this,p)}}function l({missingSchema:p,missingRef:m}){if(this.refs[p])throw new Error(`AnySchema ${p} is loaded but ${m} cannot be resolved`)}async function c(p){let m=await d.call(this,p);this.refs[p]||await s.call(this,m.$schema),this.refs[p]||this.addSchema(m,p,r)}async function d(p){let m=this._loading[p];if(m)return m;try{return await(this._loading[p]=n(p))}finally{delete this._loading[p]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let s;if(typeof e=="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw new Error(`schema ${o} must be string`)}return r=(0,Pf.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return i}getSchema(e){let r;for(;typeof(r=zO.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new If.SchemaEnv({schema:{},schemaId:n});if(r=If.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=zO.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Pf.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(FB.call(this,n,r),!r)return(0,uw.eachItem)(n,s=>lw.call(this,s)),this;jB.call(this,r);let i={...r,type:(0,nm.getJSONTypes)(r.type),schemaType:(0,nm.getJSONTypes)(r.schemaType)};return(0,uw.eachItem)(n,i.type.length===0?s=>lw.call(this,s,i):s=>i.type.forEach(o=>lw.call(this,s,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(s=>s.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,s)=>i+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let s=i.split("/").slice(1),o=e;for(let l of s)o=o[l];for(let l in n){let c=n[l];if(typeof c!="object")continue;let{$data:d}=c.definition,p=o[l];d&&p&&(o[l]=YO(p))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:l}=this.opts;if(typeof e=="object")o=e[l];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Pf.normalizeId)(o||n);let d=Pf.getSchemaRefs.call(this,e,n);return c=new If.SchemaEnv({schema:e,schemaId:l,meta:r,baseId:n,localRefs:d}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):If.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{If.compileSchema.call(this,e)}finally{this.opts=r}}};kf.ValidationError=wB.default;kf.MissingRefError=JO.default;hr.default=kf;function WO(t,e,r,n="error"){for(let i in t){let s=i;s in e&&this.logger[n](`${r}: option ${i}. ${t[s]}`)}}function zO(t){return t=(0,Pf.normalizeId)(t),this.schemas[t]||this.refs[t]}function PB(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function kB(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function AB(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function TB(){let t={...this.opts};for(let e of xB)delete t[e];return t}var $B={log(){},warn(){},error(){}};function NB(t){if(t===!1)return $B;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var MB=/^[a-z_$][a-z0-9_$:-]*$/i;function FB(t,e){let{RULES:r}=this;if((0,uw.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!MB.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function lw(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,o=i?s.post:s.rules.find(({type:c})=>c===r);if(o||(o={type:r,rules:[]},s.rules.push(o)),s.keywords[t]=!0,!e)return;let l={keyword:t,definition:{...e,type:(0,nm.getJSONTypes)(e.type),schemaType:(0,nm.getJSONTypes)(e.schemaType)}};e.before?DB.call(this,o,l,e.before):o.rules.push(l),s.all[t]=l,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function DB(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function jB(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=YO(e)),t.validateSchema=this.compile(e,!0))}var LB={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function YO(t){return{anyOf:[t,LB]}}});var QO=V(cw=>{"use strict";Object.defineProperty(cw,"__esModule",{value:!0});var UB={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};cw.default=UB});var tI=V(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.callRef=Pa.getValidate=void 0;var HB=qf(),ZO=Hn(),rn=Je(),pu=_s(),XO=Xh(),im=nt(),BB={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:s,validateName:o,opts:l,self:c}=n,{root:d}=s;if((r==="#"||r==="#/")&&i===d.baseId)return m();let p=XO.resolveRef.call(c,d,i,r);if(p===void 0)throw new HB.default(n.opts.uriResolver,i,r);if(p instanceof XO.SchemaEnv)return y(p);return b(p);function m(){if(s===d)return sm(t,o,s,s.$async);let E=e.scopeValue("root",{ref:d});return sm(t,(0,rn._)`${E}.validate`,d,d.$async)}function y(E){let C=eI(t,E);sm(t,C,E,E.$async)}function b(E){let C=e.scopeValue("schema",l.code.source===!0?{ref:E,code:(0,rn.stringify)(E)}:{ref:E}),v=e.name("valid"),_=t.subschema({schema:E,dataTypes:[],schemaPath:rn.nil,topSchemaRef:C,errSchemaPath:r},v);t.mergeEvaluated(_),t.ok(v)}}};function eI(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,rn._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Pa.getValidate=eI;function sm(t,e,r,n){let{gen:i,it:s}=t,{allErrors:o,schemaEnv:l,opts:c}=s,d=c.passContext?pu.default.this:rn.nil;n?p():m();function p(){if(!l.$async)throw new Error("async schema referenced by sync schema");let E=i.let("valid");i.try(()=>{i.code((0,rn._)`await ${(0,ZO.callValidateCode)(t,e,d)}`),b(e),o||i.assign(E,!0)},C=>{i.if((0,rn._)`!(${C} instanceof ${s.ValidationError})`,()=>i.throw(C)),y(C),o||i.assign(E,!1)}),t.ok(E)}function m(){t.result((0,ZO.callValidateCode)(t,e,d),()=>b(e),()=>y(e))}function y(E){let C=(0,rn._)`${E}.errors`;i.assign(pu.default.vErrors,(0,rn._)`${pu.default.vErrors} === null ? ${C} : ${pu.default.vErrors}.concat(${C})`),i.assign(pu.default.errors,(0,rn._)`${pu.default.vErrors}.length`)}function b(E){var C;if(!s.opts.unevaluated)return;let v=(C=r?.validate)===null||C===void 0?void 0:C.evaluated;if(s.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(s.props=im.mergeEvaluated.props(i,v.props,s.props));else{let _=i.var("props",(0,rn._)`${E}.evaluated.props`);s.props=im.mergeEvaluated.props(i,_,s.props,rn.Name)}if(s.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(s.items=im.mergeEvaluated.items(i,v.items,s.items));else{let _=i.var("items",(0,rn._)`${E}.evaluated.items`);s.items=im.mergeEvaluated.items(i,_,s.items,rn.Name)}}}Pa.callRef=sm;Pa.default=BB});var rI=V(fw=>{"use strict";Object.defineProperty(fw,"__esModule",{value:!0});var VB=QO(),WB=tI(),zB=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",VB.default,WB.default];fw.default=zB});var nI=V(dw=>{"use strict";Object.defineProperty(dw,"__esModule",{value:!0});var om=Je(),mo=om.operators,am={maximum:{okStr:"<=",ok:mo.LTE,fail:mo.GT},minimum:{okStr:">=",ok:mo.GTE,fail:mo.LT},exclusiveMaximum:{okStr:"<",ok:mo.LT,fail:mo.GTE},exclusiveMinimum:{okStr:">",ok:mo.GT,fail:mo.LTE}},JB={message:({keyword:t,schemaCode:e})=>(0,om.str)`must be ${am[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,om._)`{comparison: ${am[t].okStr}, limit: ${e}}`},GB={keyword:Object.keys(am),type:"number",schemaType:"number",$data:!0,error:JB,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,om._)`${r} ${am[e].fail} ${n} || isNaN(${r})`)}};dw.default=GB});var iI=V(pw=>{"use strict";Object.defineProperty(pw,"__esModule",{value:!0});var Af=Je(),YB={message:({schemaCode:t})=>(0,Af.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Af._)`{multipleOf: ${t}}`},KB={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:YB,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),l=s?(0,Af._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,Af._)`${o} !== parseInt(${o})`;t.fail$data((0,Af._)`(${n} === 0 || (${o} = ${r}/${n}, ${l}))`)}};pw.default=KB});var oI=V(hw=>{"use strict";Object.defineProperty(hw,"__esModule",{value:!0});function sI(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}hw.default=sI;sI.code='require("ajv/dist/runtime/ucs2length").default'});var aI=V(mw=>{"use strict";Object.defineProperty(mw,"__esModule",{value:!0});var ka=Je(),QB=nt(),ZB=oI(),XB={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,ka.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,ka._)`{limit: ${t}}`},eV={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:XB,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,s=e==="maxLength"?ka.operators.GT:ka.operators.LT,o=i.opts.unicode===!1?(0,ka._)`${r}.length`:(0,ka._)`${(0,QB.useFunc)(t.gen,ZB.default)}(${r})`;t.fail$data((0,ka._)`${o} ${s} ${n}`)}};mw.default=eV});var lI=V(gw=>{"use strict";Object.defineProperty(gw,"__esModule",{value:!0});var tV=Hn(),rV=nt(),hu=Je(),nV={message:({schemaCode:t})=>(0,hu.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,hu._)`{pattern: ${t}}`},iV={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:nV,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t,l=o.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=o.opts.code,d=c.code==="new RegExp"?(0,hu._)`new RegExp`:(0,rV.useFunc)(e,c),p=e.let("valid");e.try(()=>e.assign(p,(0,hu._)`${d}(${s}, ${l}).test(${r})`),()=>e.assign(p,!1)),t.fail$data((0,hu._)`!${p}`)}else{let c=(0,tV.usePattern)(t,i);t.fail$data((0,hu._)`!${c}.test(${r})`)}}};gw.default=iV});var uI=V(yw=>{"use strict";Object.defineProperty(yw,"__esModule",{value:!0});var Tf=Je(),sV={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Tf.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Tf._)`{limit: ${t}}`},oV={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:sV,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?Tf.operators.GT:Tf.operators.LT;t.fail$data((0,Tf._)`Object.keys(${r}).length ${i} ${n}`)}};yw.default=oV});var cI=V(vw=>{"use strict";Object.defineProperty(vw,"__esModule",{value:!0});var $f=Hn(),Nf=Je(),aV=nt(),lV={message:({params:{missingProperty:t}})=>(0,Nf.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Nf._)`{missingProperty: ${t}}`},uV={keyword:"required",type:"object",schemaType:"array",$data:!0,error:lV,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:s,it:o}=t,{opts:l}=o;if(!s&&r.length===0)return;let c=r.length>=l.loopRequired;if(o.allErrors?d():p(),l.strictRequired){let b=t.parentSchema.properties,{definedProperties:E}=t.it;for(let C of r)if(b?.[C]===void 0&&!E.has(C)){let v=o.schemaEnv.baseId+o.errSchemaPath,_=`required property "${C}" is not defined at "${v}" (strictRequired)`;(0,aV.checkStrictMode)(o,_,o.opts.strictRequired)}}function d(){if(c||s)t.block$data(Nf.nil,m);else for(let b of r)(0,$f.checkReportMissingProp)(t,b)}function p(){let b=e.let("missing");if(c||s){let E=e.let("valid",!0);t.block$data(E,()=>y(b,E)),t.ok(E)}else e.if((0,$f.checkMissingProp)(t,r,b)),(0,$f.reportMissingProp)(t,b),e.else()}function m(){e.forOf("prop",n,b=>{t.setParams({missingProperty:b}),e.if((0,$f.noPropertyInData)(e,i,b,l.ownProperties),()=>t.error())})}function y(b,E){t.setParams({missingProperty:b}),e.forOf(b,n,()=>{e.assign(E,(0,$f.propertyInData)(e,i,b,l.ownProperties)),e.if((0,Nf.not)(E),()=>{t.error(),e.break()})},Nf.nil)}}};vw.default=uV});var fI=V(bw=>{"use strict";Object.defineProperty(bw,"__esModule",{value:!0});var Mf=Je(),cV={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Mf.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Mf._)`{limit: ${t}}`},fV={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:cV,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?Mf.operators.GT:Mf.operators.LT;t.fail$data((0,Mf._)`${r}.length ${i} ${n}`)}};bw.default=fV});var lm=V(Sw=>{"use strict";Object.defineProperty(Sw,"__esModule",{value:!0});var dI=BS();dI.code='require("ajv/dist/runtime/equal").default';Sw.default=dI});var pI=V(_w=>{"use strict";Object.defineProperty(_w,"__esModule",{value:!0});var ww=_f(),mr=Je(),dV=nt(),pV=lm(),hV={message:({params:{i:t,j:e}})=>(0,mr.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,mr._)`{i: ${t}, j: ${e}}`},mV={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:hV,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:s,schemaCode:o,it:l}=t;if(!n&&!i)return;let c=e.let("valid"),d=s.items?(0,ww.getSchemaTypes)(s.items):[];t.block$data(c,p,(0,mr._)`${o} === false`),t.ok(c);function p(){let E=e.let("i",(0,mr._)`${r}.length`),C=e.let("j");t.setParams({i:E,j:C}),e.assign(c,!0),e.if((0,mr._)`${E} > 1`,()=>(m()?y:b)(E,C))}function m(){return d.length>0&&!d.some(E=>E==="object"||E==="array")}function y(E,C){let v=e.name("item"),_=(0,ww.checkDataTypes)(d,v,l.opts.strictNumbers,ww.DataType.Wrong),q=e.const("indices",(0,mr._)`{}`);e.for((0,mr._)`;${E}--;`,()=>{e.let(v,(0,mr._)`${r}[${E}]`),e.if(_,(0,mr._)`continue`),d.length>1&&e.if((0,mr._)`typeof ${v} == "string"`,(0,mr._)`${v} += "_"`),e.if((0,mr._)`typeof ${q}[${v}] == "number"`,()=>{e.assign(C,(0,mr._)`${q}[${v}]`),t.error(),e.assign(c,!1).break()}).code((0,mr._)`${q}[${v}] = ${E}`)})}function b(E,C){let v=(0,dV.useFunc)(e,pV.default),_=e.name("outer");e.label(_).for((0,mr._)`;${E}--;`,()=>e.for((0,mr._)`${C} = ${E}; ${C}--;`,()=>e.if((0,mr._)`${v}(${r}[${E}], ${r}[${C}])`,()=>{t.error(),e.assign(c,!1).break(_)})))}}};_w.default=mV});var hI=V(Cw=>{"use strict";Object.defineProperty(Cw,"__esModule",{value:!0});var Rw=Je(),gV=nt(),yV=lm(),vV={message:"must be equal to constant",params:({schemaCode:t})=>(0,Rw._)`{allowedValue: ${t}}`},bV={keyword:"const",$data:!0,error:vV,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,Rw._)`!${(0,gV.useFunc)(e,yV.default)}(${r}, ${i})`):t.fail((0,Rw._)`${s} !== ${r}`)}};Cw.default=bV});var mI=V(xw=>{"use strict";Object.defineProperty(xw,"__esModule",{value:!0});var Ff=Je(),SV=nt(),wV=lm(),_V={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Ff._)`{allowedValues: ${t}}`},RV={keyword:"enum",schemaType:"array",$data:!0,error:_V,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let l=i.length>=o.opts.loopEnum,c,d=()=>c??(c=(0,SV.useFunc)(e,wV.default)),p;if(l||n)p=e.let("valid"),t.block$data(p,m);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let b=e.const("vSchema",s);p=(0,Ff.or)(...i.map((E,C)=>y(b,C)))}t.pass(p);function m(){e.assign(p,!1),e.forOf("v",s,b=>e.if((0,Ff._)`${d()}(${r}, ${b})`,()=>e.assign(p,!0).break()))}function y(b,E){let C=i[E];return typeof C=="object"&&C!==null?(0,Ff._)`${d()}(${r}, ${b}[${E}])`:(0,Ff._)`${r} === ${C}`}}};xw.default=RV});var gI=V(Ew=>{"use strict";Object.defineProperty(Ew,"__esModule",{value:!0});var CV=nI(),xV=iI(),EV=aI(),qV=lI(),OV=uI(),IV=cI(),PV=fI(),kV=pI(),AV=hI(),TV=mI(),$V=[CV.default,xV.default,EV.default,qV.default,OV.default,IV.default,PV.default,kV.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},AV.default,TV.default];Ew.default=$V});var Ow=V(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});Df.validateAdditionalItems=void 0;var Aa=Je(),qw=nt(),NV={message:({params:{len:t}})=>(0,Aa.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Aa._)`{limit: ${t}}`},MV={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:NV,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,qw.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}yI(t,n)}};function yI(t,e){let{gen:r,schema:n,data:i,keyword:s,it:o}=t;o.items=!0;let l=r.const("len",(0,Aa._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Aa._)`${l} <= ${e.length}`);else if(typeof n=="object"&&!(0,qw.alwaysValidSchema)(o,n)){let d=r.var("valid",(0,Aa._)`${l} <= ${e.length}`);r.if((0,Aa.not)(d),()=>c(d)),t.ok(d)}function c(d){r.forRange("i",e.length,l,p=>{t.subschema({keyword:s,dataProp:p,dataPropType:qw.Type.Num},d),o.allErrors||r.if((0,Aa.not)(d),()=>r.break())})}}Df.validateAdditionalItems=yI;Df.default=MV});var Iw=V(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});jf.validateTuple=void 0;var vI=Je(),um=nt(),FV=Hn(),DV={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return bI(t,"additionalItems",e);r.items=!0,!(0,um.alwaysValidSchema)(r,e)&&t.ok((0,FV.validateArray)(t))}};function bI(t,e,r=t.schema){let{gen:n,parentSchema:i,data:s,keyword:o,it:l}=t;p(i),l.opts.unevaluated&&r.length&&l.items!==!0&&(l.items=um.mergeEvaluated.items(n,r.length,l.items));let c=n.name("valid"),d=n.const("len",(0,vI._)`${s}.length`);r.forEach((m,y)=>{(0,um.alwaysValidSchema)(l,m)||(n.if((0,vI._)`${d} > ${y}`,()=>t.subschema({keyword:o,schemaProp:y,dataProp:y},c)),t.ok(c))});function p(m){let{opts:y,errSchemaPath:b}=l,E=r.length,C=E===m.minItems&&(E===m.maxItems||m[e]===!1);if(y.strictTuples&&!C){let v=`"${o}" is ${E}-tuple, but minItems or maxItems/${e} are not specified or different at path "${b}"`;(0,um.checkStrictMode)(l,v,y.strictTuples)}}}jf.validateTuple=bI;jf.default=DV});var SI=V(Pw=>{"use strict";Object.defineProperty(Pw,"__esModule",{value:!0});var jV=Iw(),LV={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,jV.validateTuple)(t,"items")};Pw.default=LV});var _I=V(kw=>{"use strict";Object.defineProperty(kw,"__esModule",{value:!0});var wI=Je(),UV=nt(),HV=Hn(),BV=Ow(),VV={message:({params:{len:t}})=>(0,wI.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,wI._)`{limit: ${t}}`},WV={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:VV,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,UV.alwaysValidSchema)(n,e)&&(i?(0,BV.validateAdditionalItems)(t,i):t.ok((0,HV.validateArray)(t)))}};kw.default=WV});var RI=V(Aw=>{"use strict";Object.defineProperty(Aw,"__esModule",{value:!0});var Vn=Je(),cm=nt(),zV={message:({params:{min:t,max:e}})=>e===void 0?(0,Vn.str)`must contain at least ${t} valid item(s)`:(0,Vn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Vn._)`{minContains: ${t}}`:(0,Vn._)`{minContains: ${t}, maxContains: ${e}}`},JV={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:zV,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t,o,l,{minContains:c,maxContains:d}=n;s.opts.next?(o=c===void 0?1:c,l=d):o=1;let p=e.const("len",(0,Vn._)`${i}.length`);if(t.setParams({min:o,max:l}),l===void 0&&o===0){(0,cm.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(l!==void 0&&o>l){(0,cm.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,cm.alwaysValidSchema)(s,r)){let C=(0,Vn._)`${p} >= ${o}`;l!==void 0&&(C=(0,Vn._)`${C} && ${p} <= ${l}`),t.pass(C);return}s.items=!0;let m=e.name("valid");l===void 0&&o===1?b(m,()=>e.if(m,()=>e.break())):o===0?(e.let(m,!0),l!==void 0&&e.if((0,Vn._)`${i}.length > 0`,y)):(e.let(m,!1),y()),t.result(m,()=>t.reset());function y(){let C=e.name("_valid"),v=e.let("count",0);b(C,()=>e.if(C,()=>E(v)))}function b(C,v){e.forRange("i",0,p,_=>{t.subschema({keyword:"contains",dataProp:_,dataPropType:cm.Type.Num,compositeRule:!0},C),v()})}function E(C){e.code((0,Vn._)`${C}++`),l===void 0?e.if((0,Vn._)`${C} >= ${o}`,()=>e.assign(m,!0).break()):(e.if((0,Vn._)`${C} > ${l}`,()=>e.assign(m,!1).break()),o===1?e.assign(m,!0):e.if((0,Vn._)`${C} >= ${o}`,()=>e.assign(m,!0)))}}};Aw.default=JV});var EI=V(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.validateSchemaDeps=Vi.validatePropertyDeps=Vi.error=void 0;var Tw=Je(),GV=nt(),Lf=Hn();Vi.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,Tw.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,Tw._)`{property: ${t},
|
|
27
|
+
|| ${o} === "boolean" || ${i} === null`).assign(l,(0,Fe._)`[${i}]`)}}}function gU({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,Fe._)`${e} !== undefined`,()=>t.assign((0,Fe._)`${e}[${r}]`,n))}function FS(t,e,r,n=au.Correct){let i=n===au.Correct?Fe.operators.EQ:Fe.operators.NEQ,s;switch(t){case"null":return(0,Fe._)`${e} ${i} null`;case"array":s=(0,Fe._)`Array.isArray(${e})`;break;case"object":s=(0,Fe._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=o((0,Fe._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=o();break;default:return(0,Fe._)`typeof ${e} ${i} ${t}`}return n===au.Correct?s:(0,Fe.not)(s);function o(l=Fe.nil){return(0,Fe.and)((0,Fe._)`typeof ${e} == "number"`,l,r?(0,Fe._)`isFinite(${e})`:Fe.nil)}}Cr.checkDataType=FS;function DS(t,e,r,n){if(t.length===1)return FS(t[0],e,r,n);let i,s=(0,Bq.toHash)(t);if(s.array&&s.object){let o=(0,Fe._)`typeof ${e} != "object"`;i=s.null?o:(0,Fe._)`!${e} || ${o}`,delete s.null,delete s.array,delete s.object}else i=Fe.nil;s.number&&delete s.integer;for(let o in s)i=(0,Fe.and)(i,FS(o,e,r,n));return i}Cr.checkDataTypes=DS;var yU={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Fe._)`{type: ${t}}`:(0,Fe._)`{type: ${e}}`};function jS(t){let e=vU(t);(0,fU.reportError)(e,yU)}Cr.reportTypeError=jS;function vU(t){let{gen:e,data:r,schema:n}=t,i=(0,Bq.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var Jq=V(Jh=>{"use strict";Object.defineProperty(Jh,"__esModule",{value:!0});Jh.assignDefaults=void 0;var lu=Je(),bU=nt();function SU(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)zq(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,s)=>zq(t,s,i.default))}Jh.assignDefaults=SU;function zq(t,e,r){let{gen:n,compositeRule:i,data:s,opts:o}=t;if(r===void 0)return;let l=(0,lu._)`${s}${(0,lu.getProperty)(e)}`;if(i){(0,bU.checkStrictMode)(t,`default is ignored for: ${l}`);return}let c=(0,lu._)`${l} === undefined`;o.useDefaults==="empty"&&(c=(0,lu._)`${c} || ${l} === null || ${l} === ""`),n.if(c,(0,lu._)`${l} = ${(0,lu.stringify)(r)}`)}});var Hn=V(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.validateUnion=Ot.validateArray=Ot.usePattern=Ot.callValidateCode=Ot.schemaProperties=Ot.allSchemaProperties=Ot.noPropertyInData=Ot.propertyInData=Ot.isOwnProperty=Ot.hasPropFunc=Ot.reportMissingProp=Ot.checkMissingProp=Ot.checkReportMissingProp=void 0;var Mt=Je(),LS=nt(),co=_s(),wU=nt();function _U(t,e){let{gen:r,data:n,it:i}=t;r.if(HS(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Mt._)`${e}`},!0),t.error()})}Ot.checkReportMissingProp=_U;function RU({gen:t,data:e,it:{opts:r}},n,i){return(0,Mt.or)(...n.map(s=>(0,Mt.and)(HS(t,e,s,r.ownProperties),(0,Mt._)`${i} = ${s}`)))}Ot.checkMissingProp=RU;function CU(t,e){t.setParams({missingProperty:e},!0),t.error()}Ot.reportMissingProp=CU;function Gq(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Mt._)`Object.prototype.hasOwnProperty`})}Ot.hasPropFunc=Gq;function US(t,e,r){return(0,Mt._)`${Gq(t)}.call(${e}, ${r})`}Ot.isOwnProperty=US;function xU(t,e,r,n){let i=(0,Mt._)`${e}${(0,Mt.getProperty)(r)} !== undefined`;return n?(0,Mt._)`${i} && ${US(t,e,r)}`:i}Ot.propertyInData=xU;function HS(t,e,r,n){let i=(0,Mt._)`${e}${(0,Mt.getProperty)(r)} === undefined`;return n?(0,Mt.or)(i,(0,Mt.not)(US(t,e,r))):i}Ot.noPropertyInData=HS;function Yq(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Ot.allSchemaProperties=Yq;function EU(t,e){return Yq(e).filter(r=>!(0,LS.alwaysValidSchema)(t,e[r]))}Ot.schemaProperties=EU;function qU({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:s},it:o},l,c,d){let p=d?(0,Mt._)`${t}, ${e}, ${n}${i}`:e,m=[[co.default.instancePath,(0,Mt.strConcat)(co.default.instancePath,s)],[co.default.parentData,o.parentData],[co.default.parentDataProperty,o.parentDataProperty],[co.default.rootData,co.default.rootData]];o.opts.dynamicRef&&m.push([co.default.dynamicAnchors,co.default.dynamicAnchors]);let y=(0,Mt._)`${p}, ${r.object(...m)}`;return c!==Mt.nil?(0,Mt._)`${l}.call(${c}, ${y})`:(0,Mt._)`${l}(${y})`}Ot.callValidateCode=qU;var OU=(0,Mt._)`new RegExp`;function IU({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,s=i(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,Mt._)`${i.code==="new RegExp"?OU:(0,wU.useFunc)(t,i)}(${r}, ${n})`})}Ot.usePattern=IU;function PU(t){let{gen:e,data:r,keyword:n,it:i}=t,s=e.name("valid");if(i.allErrors){let l=e.let("valid",!0);return o(()=>e.assign(l,!1)),l}return e.var(s,!0),o(()=>e.break()),s;function o(l){let c=e.const("len",(0,Mt._)`${r}.length`);e.forRange("i",0,c,d=>{t.subschema({keyword:n,dataProp:d,dataPropType:LS.Type.Num},s),e.if((0,Mt.not)(s),l)})}}Ot.validateArray=PU;function kU(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,LS.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),l=e.name("_valid");e.block(()=>r.forEach((c,d)=>{let p=t.subschema({keyword:n,schemaProp:d,compositeRule:!0},l);e.assign(o,(0,Mt._)`${o} || ${l}`),t.mergeValidEvaluated(p,l)||e.if((0,Mt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}Ot.validateUnion=kU});var Zq=V(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.validateKeywordUsage=Hi.validSchemaType=Hi.funcKeywordCode=Hi.macroKeywordCode=void 0;var Hr=Je(),qa=_s(),AU=Hn(),TU=wf();function $U(t,e){let{gen:r,keyword:n,schema:i,parentSchema:s,it:o}=t,l=e.macro.call(o.self,i,s,o),c=Qq(r,n,l);o.opts.validateSchema!==!1&&o.self.validateSchema(l,!0);let d=r.name("valid");t.subschema({schema:l,schemaPath:Hr.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},d),t.pass(d,()=>t.error(!0))}Hi.macroKeywordCode=$U;function NU(t,e){var r;let{gen:n,keyword:i,schema:s,parentSchema:o,$data:l,it:c}=t;FU(c,e);let d=!l&&e.compile?e.compile.call(c.self,s,o,c):e.validate,p=Qq(n,i,d),m=n.let("valid");t.block$data(m,y),t.ok((r=e.valid)!==null&&r!==void 0?r:m);function y(){if(e.errors===!1)C(),e.modifying&&Kq(t),v(()=>t.error());else{let _=e.async?b():q();e.modifying&&Kq(t),v(()=>MU(t,_))}}function b(){let _=n.let("ruleErrs",null);return n.try(()=>C((0,Hr._)`await `),E=>n.assign(m,!1).if((0,Hr._)`${E} instanceof ${c.ValidationError}`,()=>n.assign(_,(0,Hr._)`${E}.errors`),()=>n.throw(E))),_}function q(){let _=(0,Hr._)`${p}.errors`;return n.assign(_,null),C(Hr.nil),_}function C(_=e.async?(0,Hr._)`await `:Hr.nil){let E=c.opts.passContext?qa.default.this:qa.default.self,k=!("compile"in e&&!l||e.schema===!1);n.assign(m,(0,Hr._)`${_}${(0,AU.callValidateCode)(t,p,E,k)}`,e.modifying)}function v(_){var E;n.if((0,Hr.not)((E=e.valid)!==null&&E!==void 0?E:m),_)}}Hi.funcKeywordCode=NU;function Kq(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Hr._)`${n.parentData}[${n.parentDataProperty}]`))}function MU(t,e){let{gen:r}=t;r.if((0,Hr._)`Array.isArray(${e})`,()=>{r.assign(qa.default.vErrors,(0,Hr._)`${qa.default.vErrors} === null ? ${e} : ${qa.default.vErrors}.concat(${e})`).assign(qa.default.errors,(0,Hr._)`${qa.default.vErrors}.length`),(0,TU.extendErrors)(t)},()=>t.error())}function FU({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Qq(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Hr.stringify)(r)})}function DU(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Hi.validSchemaType=DU;function jU({schema:t,opts:e,self:r,errSchemaPath:n},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(l=>!Object.prototype.hasOwnProperty.call(t,l)))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Hi.validateKeywordUsage=jU});var eO=V(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.extendSubschemaMode=fo.extendSubschemaData=fo.getSubschema=void 0;var Bi=Je(),Xq=nt();function LU(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:s,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let l=t.schema[e];return r===void 0?{schema:l,schemaPath:(0,Bi._)`${t.schemaPath}${(0,Bi.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:l[r],schemaPath:(0,Bi._)`${t.schemaPath}${(0,Bi.getProperty)(e)}${(0,Bi.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Xq.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||s===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}fo.getSubschema=LU;function UU(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:s,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:l}=e;if(r!==void 0){let{errorPath:d,dataPathArr:p,opts:m}=e,y=l.let("data",(0,Bi._)`${e.data}${(0,Bi.getProperty)(r)}`,!0);c(y),t.errorPath=(0,Bi.str)`${d}${(0,Xq.getErrorPath)(r,n,m.jsPropertySyntax)}`,t.parentDataProperty=(0,Bi._)`${r}`,t.dataPathArr=[...p,t.parentDataProperty]}if(i!==void 0){let d=i instanceof Bi.Name?i:l.let("data",i,!0);c(d),o!==void 0&&(t.propertyName=o)}s&&(t.dataTypes=s);function c(d){t.data=d,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,d]}}fo.extendSubschemaData=UU;function HU(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:s}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}fo.extendSubschemaMode=HU});var BS=V((PQ,tO)=>{"use strict";tO.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;i--!==0;){var o=s[i];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var nO=V((kQ,rO)=>{"use strict";var po=rO.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};Gh(e,n,i,t,"",t)};po.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};po.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};po.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};po.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Gh(t,e,r,n,i,s,o,l,c,d){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,s,o,l,c,d);for(var p in n){var m=n[p];if(Array.isArray(m)){if(p in po.arrayKeywords)for(var y=0;y<m.length;y++)Gh(t,e,r,m[y],i+"/"+p+"/"+y,s,i,p,n,y)}else if(p in po.propsKeywords){if(m&&typeof m=="object")for(var b in m)Gh(t,e,r,m[b],i+"/"+p+"/"+BU(b),s,i,p,n,b)}else(p in po.keywords||t.allKeys&&!(p in po.skipKeywords))&&Gh(t,e,r,m,i+"/"+p,s,i,p,n)}r(n,i,s,o,l,c,d)}}function BU(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Rf=V(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.getSchemaRefs=tn.resolveUrl=tn.normalizeId=tn._getFullPath=tn.getFullPath=tn.inlineRef=void 0;var VU=nt(),WU=BS(),zU=nO(),JU=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function GU(t,e=!0){return typeof t=="boolean"?!0:e===!0?!VS(t):e?iO(t)<=e:!1}tn.inlineRef=GU;var YU=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function VS(t){for(let e in t){if(YU.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(VS)||typeof r=="object"&&VS(r))return!0}return!1}function iO(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!JU.has(r)&&(typeof t[r]=="object"&&(0,VU.eachItem)(t[r],n=>e+=iO(n)),e===1/0))return 1/0}return e}function sO(t,e="",r){r!==!1&&(e=uu(e));let n=t.parse(e);return oO(t,n)}tn.getFullPath=sO;function oO(t,e){return t.serialize(e).split("#")[0]+"#"}tn._getFullPath=oO;var KU=/#\/?$/;function uu(t){return t?t.replace(KU,""):""}tn.normalizeId=uu;function QU(t,e,r){return r=uu(r),t.resolve(e,r)}tn.resolveUrl=QU;var ZU=/^[a-z_][-a-z0-9._]*$/i;function XU(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=uu(t[r]||e),s={"":i},o=sO(n,i,!1),l={},c=new Set;return zU(t,{allKeys:!0},(m,y,b,q)=>{if(q===void 0)return;let C=o+y,v=s[q];typeof m[r]=="string"&&(v=_.call(this,m[r])),E.call(this,m.$anchor),E.call(this,m.$dynamicAnchor),s[y]=v;function _(k){let O=this.opts.uriResolver.resolve;if(k=uu(v?O(v,k):k),c.has(k))throw p(k);c.add(k);let M=this.refs[k];return typeof M=="string"&&(M=this.refs[M]),typeof M=="object"?d(m,M.schema,k):k!==uu(C)&&(k[0]==="#"?(d(m,l[k],k),l[k]=m):this.refs[k]=C),k}function E(k){if(typeof k=="string"){if(!ZU.test(k))throw new Error(`invalid anchor "${k}"`);_.call(this,`#${k}`)}}}),l;function d(m,y,b){if(y!==void 0&&!WU(m,y))throw p(b)}function p(m){return new Error(`reference "${m}" resolves to more than one schema`)}}tn.getSchemaRefs=XU});var Ef=V(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.getData=ho.KeywordCxt=ho.validateFunctionCode=void 0;var fO=Lq(),aO=_f(),zS=MS(),Yh=_f(),eH=Jq(),xf=Zq(),WS=eO(),we=Je(),Pe=_s(),tH=Rf(),Rs=nt(),Cf=wf();function rH(t){if(hO(t)&&(mO(t),pO(t))){sH(t);return}dO(t,()=>(0,fO.topBoolOrEmptySchema)(t))}ho.validateFunctionCode=rH;function dO({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},s){i.code.es5?t.func(e,(0,we._)`${Pe.default.data}, ${Pe.default.valCxt}`,n.$async,()=>{t.code((0,we._)`"use strict"; ${lO(r,i)}`),iH(t,i),t.code(s)}):t.func(e,(0,we._)`${Pe.default.data}, ${nH(i)}`,n.$async,()=>t.code(lO(r,i)).code(s))}function nH(t){return(0,we._)`{${Pe.default.instancePath}="", ${Pe.default.parentData}, ${Pe.default.parentDataProperty}, ${Pe.default.rootData}=${Pe.default.data}${t.dynamicRef?(0,we._)`, ${Pe.default.dynamicAnchors}={}`:we.nil}}={}`}function iH(t,e){t.if(Pe.default.valCxt,()=>{t.var(Pe.default.instancePath,(0,we._)`${Pe.default.valCxt}.${Pe.default.instancePath}`),t.var(Pe.default.parentData,(0,we._)`${Pe.default.valCxt}.${Pe.default.parentData}`),t.var(Pe.default.parentDataProperty,(0,we._)`${Pe.default.valCxt}.${Pe.default.parentDataProperty}`),t.var(Pe.default.rootData,(0,we._)`${Pe.default.valCxt}.${Pe.default.rootData}`),e.dynamicRef&&t.var(Pe.default.dynamicAnchors,(0,we._)`${Pe.default.valCxt}.${Pe.default.dynamicAnchors}`)},()=>{t.var(Pe.default.instancePath,(0,we._)`""`),t.var(Pe.default.parentData,(0,we._)`undefined`),t.var(Pe.default.parentDataProperty,(0,we._)`undefined`),t.var(Pe.default.rootData,Pe.default.data),e.dynamicRef&&t.var(Pe.default.dynamicAnchors,(0,we._)`{}`)})}function sH(t){let{schema:e,opts:r,gen:n}=t;dO(t,()=>{r.$comment&&e.$comment&&yO(t),cH(t),n.let(Pe.default.vErrors,null),n.let(Pe.default.errors,0),r.unevaluated&&oH(t),gO(t),pH(t)})}function oH(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,we._)`${r}.evaluated`),e.if((0,we._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,we._)`${t.evaluated}.props`,(0,we._)`undefined`)),e.if((0,we._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,we._)`${t.evaluated}.items`,(0,we._)`undefined`))}function lO(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,we._)`/*# sourceURL=${r} */`:we.nil}function aH(t,e){if(hO(t)&&(mO(t),pO(t))){lH(t,e);return}(0,fO.boolOrEmptySchema)(t,e)}function pO({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function hO(t){return typeof t.schema!="boolean"}function lH(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&yO(t),fH(t),dH(t);let s=n.const("_errs",Pe.default.errors);gO(t,s),n.var(e,(0,we._)`${s} === ${Pe.default.errors}`)}function mO(t){(0,Rs.checkUnknownRules)(t),uH(t)}function gO(t,e){if(t.opts.jtd)return uO(t,[],!1,e);let r=(0,aO.getSchemaTypes)(t.schema),n=(0,aO.coerceAndCheckDataType)(t,r);uO(t,r,!n,e)}function uH(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Rs.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function cH(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Rs.checkStrictMode)(t,"default is ignored in the schema root")}function fH(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,tH.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function dH(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function yO({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let s=r.$comment;if(i.$comment===!0)t.code((0,we._)`${Pe.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){let o=(0,we.str)`${n}/$comment`,l=t.scopeValue("root",{ref:e.root});t.code((0,we._)`${Pe.default.self}.opts.$comment(${s}, ${o}, ${l}.schema)`)}}function pH(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:s}=t;r.$async?e.if((0,we._)`${Pe.default.errors} === 0`,()=>e.return(Pe.default.data),()=>e.throw((0,we._)`new ${i}(${Pe.default.vErrors})`)):(e.assign((0,we._)`${n}.errors`,Pe.default.vErrors),s.unevaluated&&hH(t),e.return((0,we._)`${Pe.default.errors} === 0`))}function hH({gen:t,evaluated:e,props:r,items:n}){r instanceof we.Name&&t.assign((0,we._)`${e}.props`,r),n instanceof we.Name&&t.assign((0,we._)`${e}.items`,n)}function uO(t,e,r,n){let{gen:i,schema:s,data:o,allErrors:l,opts:c,self:d}=t,{RULES:p}=d;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Rs.schemaHasRulesButRef)(s,p))){i.block(()=>bO(t,"$ref",p.all.$ref.definition));return}c.jtd||mH(t,e),i.block(()=>{for(let y of p.rules)m(y);m(p.post)});function m(y){(0,zS.shouldUseGroup)(s,y)&&(y.type?(i.if((0,Yh.checkDataType)(y.type,o,c.strictNumbers)),cO(t,y),e.length===1&&e[0]===y.type&&r&&(i.else(),(0,Yh.reportTypeError)(t)),i.endIf()):cO(t,y),l||i.if((0,we._)`${Pe.default.errors} === ${n||0}`))}}function cO(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,eH.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,zS.shouldUseRule)(n,s)&&bO(t,s.keyword,s.definition,e.type)})}function mH(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(gH(t,e),t.opts.allowUnionTypes||yH(t,e),vH(t,t.dataTypes))}function gH(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{vO(t.dataTypes,r)||JS(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),SH(t,e)}}function yH(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&JS(t,"use allowUnionTypes to allow union type keyword")}function vH(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,zS.shouldUseRule)(t.schema,i)){let{type:s}=i.definition;s.length&&!s.some(o=>bH(e,o))&&JS(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function bH(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function vO(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function SH(t,e){let r=[];for(let n of t.dataTypes)vO(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function JS(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Rs.checkStrictMode)(t,e,t.opts.strictTypes)}var Kh=class{constructor(e,r,n){if((0,xf.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Rs.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",SO(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,xf.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",Pe.default.errors))}result(e,r,n){this.failResult((0,we.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,we.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,we._)`${r} !== undefined && (${(0,we.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Cf.reportExtraError:Cf.reportError)(this,this.def.error,r)}$dataError(){(0,Cf.reportError)(this,this.def.$dataError||Cf.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Cf.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=we.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=we.nil,r=we.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:s,def:o}=this;n.if((0,we.or)((0,we._)`${i} === undefined`,r)),e!==we.nil&&n.assign(e,!0),(s.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==we.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:s}=this;return(0,we.or)(o(),l());function o(){if(n.length){if(!(r instanceof we.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,we._)`${(0,Yh.checkDataTypes)(c,r,s.opts.strictNumbers,Yh.DataType.Wrong)}`}return we.nil}function l(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,we._)`!${c}(${r})`}return we.nil}}subschema(e,r){let n=(0,WS.getSubschema)(this.it,e);(0,WS.extendSubschemaData)(n,this.it,e),(0,WS.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return aH(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Rs.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Rs.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,we.Name)),!0}};ho.KeywordCxt=Kh;function bO(t,e,r,n){let i=new Kh(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,xf.funcKeywordCode)(i,r):"macro"in r?(0,xf.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,xf.funcKeywordCode)(i,r)}var wH=/^\/(?:[^~]|~0|~1)*$/,_H=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function SO(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,s;if(t==="")return Pe.default.rootData;if(t[0]==="/"){if(!wH.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=Pe.default.rootData}else{let d=_H.exec(t);if(!d)throw new Error(`Invalid JSON-pointer: ${t}`);let p=+d[1];if(i=d[2],i==="#"){if(p>=e)throw new Error(c("property/index",p));return n[e-p]}if(p>e)throw new Error(c("data",p));if(s=r[e-p],!i)return s}let o=s,l=i.split("/");for(let d of l)d&&(s=(0,we._)`${s}${(0,we.getProperty)((0,Rs.unescapeJsonPointer)(d))}`,o=(0,we._)`${o} && ${s}`);return o;function c(d,p){return`Cannot access ${d} ${p} levels up, current level is ${e}`}}ho.getData=SO});var Qh=V(YS=>{"use strict";Object.defineProperty(YS,"__esModule",{value:!0});var GS=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};YS.default=GS});var qf=V(ZS=>{"use strict";Object.defineProperty(ZS,"__esModule",{value:!0});var KS=Rf(),QS=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,KS.resolveUrl)(e,r,n),this.missingSchema=(0,KS.normalizeId)((0,KS.getFullPath)(e,this.missingRef))}};ZS.default=QS});var Xh=V(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.resolveSchema=Bn.getCompilingSchema=Bn.resolveRef=Bn.compileSchema=Bn.SchemaEnv=void 0;var ci=Je(),RH=Qh(),Oa=_s(),fi=Rf(),wO=nt(),CH=Ef(),cu=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,fi.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Bn.SchemaEnv=cu;function ew(t){let e=_O.call(this,t);if(e)return e;let r=(0,fi.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new ci.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),l;t.$async&&(l=o.scopeValue("Error",{ref:RH.default,code:(0,ci._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");t.validateName=c;let d={gen:o,allErrors:this.opts.allErrors,data:Oa.default.data,parentData:Oa.default.parentData,parentDataProperty:Oa.default.parentDataProperty,dataNames:[Oa.default.data],dataPathArr:[ci.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,ci.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:l,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:ci.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ci._)`""`,opts:this.opts,self:this},p;try{this._compilations.add(t),(0,CH.validateFunctionCode)(d),o.optimize(this.opts.code.optimize);let m=o.toString();p=`${o.scopeRefs(Oa.default.scope)}return ${m}`,this.opts.code.process&&(p=this.opts.code.process(p,t));let b=new Function(`${Oa.default.self}`,`${Oa.default.scope}`,p)(this,this.scope.get());if(this.scope.value(c,{ref:b}),b.errors=null,b.schema=t.schema,b.schemaEnv=t,t.$async&&(b.$async=!0),this.opts.code.source===!0&&(b.source={validateName:c,validateCode:m,scopeValues:o._values}),this.opts.unevaluated){let{props:q,items:C}=d;b.evaluated={props:q instanceof ci.Name?void 0:q,items:C instanceof ci.Name?void 0:C,dynamicProps:q instanceof ci.Name,dynamicItems:C instanceof ci.Name},b.source&&(b.source.evaluated=(0,ci.stringify)(b.evaluated))}return t.validate=b,t}catch(m){throw delete t.validate,delete t.validateName,p&&this.logger.error("Error compiling schema, function code:",p),m}finally{this._compilations.delete(t)}}Bn.compileSchema=ew;function xH(t,e,r){var n;r=(0,fi.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let s=OH.call(this,t,r);if(s===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:l}=this.opts;o&&(s=new cu({schema:o,schemaId:l,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=EH.call(this,s)}Bn.resolveRef=xH;function EH(t){return(0,fi.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:ew.call(this,t)}function _O(t){for(let e of this._compilations)if(qH(e,t))return e}Bn.getCompilingSchema=_O;function qH(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function OH(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Zh.call(this,t,e)}function Zh(t,e){let r=this.opts.uriResolver.parse(e),n=(0,fi._getFullPath)(this.opts.uriResolver,r),i=(0,fi.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return XS.call(this,r,t);let s=(0,fi.normalizeId)(n),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){let l=Zh.call(this,t,o);return typeof l?.schema!="object"?void 0:XS.call(this,r,l)}if(typeof o?.schema=="object"){if(o.validate||ew.call(this,o),s===(0,fi.normalizeId)(e)){let{schema:l}=o,{schemaId:c}=this.opts,d=l[c];return d&&(i=(0,fi.resolveUrl)(this.opts.uriResolver,i,d)),new cu({schema:l,schemaId:c,root:t,baseId:i})}return XS.call(this,r,o)}}Bn.resolveSchema=Zh;var IH=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function XS(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let l of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,wO.unescapeFragment)(l)];if(c===void 0)return;r=c;let d=typeof r=="object"&&r[this.opts.schemaId];!IH.has(l)&&d&&(e=(0,fi.resolveUrl)(this.opts.uriResolver,e,d))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,wO.schemaHasRulesButRef)(r,this.RULES)){let l=(0,fi.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=Zh.call(this,n,l)}let{schemaId:o}=this.opts;if(s=s||new cu({schema:r,schemaId:o,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var RO=V((FQ,PH)=>{PH.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var nw=V((DQ,IO)=>{"use strict";var kH=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),xO=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),tw=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),EO=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),AH=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function rw(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var TH=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function CO(t){return t.length=0,!0}function $H(t,e,r){if(t.length){let n=rw(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function NH(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],s=!1,o=!1,l=$H;for(let c=0;c<t.length;c++){let d=t[c];if(!(d==="["||d==="]"))if(d===":"){if(s===!0&&(o=!0),!l(i,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),n.push(":");continue}else if(d==="%"){if(!l(i,n,r))break;l=CO}else{i.push(d);continue}}return i.length&&(l===CO?r.zone=i.join(""):o?n.push(i.join("")):n.push(rw(i))),r.address=n.join(""),r}function qO(t){if(MH(t,":")<2)return{host:t,isIPV6:!1};let e=NH(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function MH(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function FH(t){let e=t,r=[],n=-1,i=0;for(;i=e.length;){if(i===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(i===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(i===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}var DH={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},jH=/[@/?#:]/g,LH=/[@/?#]/g;function OO(t,e){let r=e?LH:jH;return r.lastIndex=0,t.replace(r,n=>DH[n])}function UH(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let i=t.slice(n+1,n+3);if(tw(i)){let s=i.toUpperCase(),o=String.fromCharCode(parseInt(s,16));e&&EO(o)?r+=o:r+="%"+s,n+=2;continue}}r+=t[n]}return r}function HH(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(tw(n)){let i=n.toUpperCase(),s=String.fromCharCode(parseInt(i,16));s!=="."&&EO(s)?e+=s:e+="%"+i,r+=2;continue}}AH(t[r])?e+=t[r]:e+=escape(t[r])}return e}function BH(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(tw(n)){e+="%"+n.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function VH(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!xO(r)){let n=qO(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=OO(r,!1)}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}IO.exports={nonSimpleDomain:TH,recomposeAuthority:VH,reescapeHostDelimiters:OO,normalizePercentEncoding:UH,normalizePathEncoding:HH,escapePreservingEscapes:BH,removeDotSegments:FH,isIPv4:xO,isUUID:kH,normalizeIPv6:qO,stringArrayToHexStripped:rw}});var $O=V((jQ,TO)=>{"use strict";var{isUUID:WH}=nw(),zH=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,JH=["http","https","ws","wss","urn","urn:uuid"];function GH(t){return JH.indexOf(t)!==-1}function iw(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function PO(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function kO(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function YH(t){return t.secure=iw(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function KH(t){if((t.port===(iw(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function QH(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(zH);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,s=sw(i);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function ZH(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,s=sw(i);s&&(t=s.serialize(t,e));let o=t,l=t.nss;return o.path=`${n||e.nid}:${l}`,e.skipEscape=!0,o}function XH(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!WH(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function eB(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var AO={scheme:"http",domainHost:!0,parse:PO,serialize:kO},tB={scheme:"https",domainHost:AO.domainHost,parse:PO,serialize:kO},em={scheme:"ws",domainHost:!0,parse:YH,serialize:KH},rB={scheme:"wss",domainHost:em.domainHost,parse:em.parse,serialize:em.serialize},nB={scheme:"urn",parse:QH,serialize:ZH,skipNormalize:!0},iB={scheme:"urn:uuid",parse:XH,serialize:eB,skipNormalize:!0},tm={http:AO,https:tB,ws:em,wss:rB,urn:nB,"urn:uuid":iB};Object.setPrototypeOf(tm,null);function sw(t){return t&&(tm[t]||tm[t.toLowerCase()])||void 0}TO.exports={wsIsSecure:iw,SCHEMES:tm,isValidSchemeName:GH,getSchemeHandler:sw}});var LO=V((LQ,rm)=>{"use strict";var{normalizeIPv6:sB,removeDotSegments:Of,recomposeAuthority:oB,normalizePercentEncoding:aB,normalizePathEncoding:lB,escapePreservingEscapes:uB,reescapeHostDelimiters:cB,isIPv4:fB,nonSimpleDomain:dB}=nw(),{SCHEMES:pB,getSchemeHandler:MO}=$O();function hB(t,e){return typeof t=="string"?t=bB(t,e):typeof t=="object"&&(t=fu(Ia(t,e),e)),t}function mB(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=FO(fu(t,n),fu(e,n),n,!0);return n.skipEscape=!0,Ia(i,n)}function FO(t,e,r,n){let i={};return n||(t=fu(Ia(t,r),r),e=fu(Ia(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Of(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Of(e.path||""),i.query=e.query):(e.path?(e.path[0]==="/"?i.path=Of(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=Of(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function gB(t,e,r){let n=NO(t,r),i=NO(e,r);return n!==void 0&&i!==void 0&&n.toLowerCase()===i.toLowerCase()}function Ia(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[],s=MO(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=aB(r.path):(r.path=uB(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let o=oB(r);if(o!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(o),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let l=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(l=Of(l)),o===void 0&&l[0]==="/"&&l[1]==="/"&&(l="/%2F"+l.slice(2)),i.push(l)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var yB=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function vB(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function DO(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1,s=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let o=t.match(yB);if(o){n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]);let l=vB(n,o);if(l!==void 0&&(n.error=n.error||l,i=!0),n.host)if(fB(n.host)===!1){let p=sB(n.host);n.host=p.host.toLowerCase(),s=p.isIPV6}else s=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let c=MO(r.scheme||n.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&n.host&&(r.domainHost||c&&c.domainHost)&&s===!1&&dB(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(d){n.error=n.error||"Host's domain name can not be converted to ASCII: "+d}if((!c||c&&!c.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=cB(unescape(n.host),s))),n.path&&(n.path=lB(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}c&&c.parse&&c.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:i}}function fu(t,e){return DO(t,e).parsed}function bB(t,e){return jO(t,e).normalized}function jO(t,e){let{parsed:r,malformedAuthorityOrPort:n}=DO(t,e);return{normalized:n?t:Ia(r,e),malformedAuthorityOrPort:n}}function NO(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:n}=jO(t,e);return n?void 0:r}if(typeof t=="object")return Ia(t,e)}var ow={SCHEMES:pB,normalize:hB,resolve:mB,resolveComponent:FO,equal:gB,serialize:Ia,parse:fu};rm.exports=ow;rm.exports.default=ow;rm.exports.fastUri=ow});var HO=V(aw=>{"use strict";Object.defineProperty(aw,"__esModule",{value:!0});var UO=LO();UO.code='require("ajv/dist/runtime/uri").default';aw.default=UO});var KO=V(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.CodeGen=hr.Name=hr.nil=hr.stringify=hr.str=hr._=hr.KeywordCxt=void 0;var SB=Ef();Object.defineProperty(hr,"KeywordCxt",{enumerable:!0,get:function(){return SB.KeywordCxt}});var du=Je();Object.defineProperty(hr,"_",{enumerable:!0,get:function(){return du._}});Object.defineProperty(hr,"str",{enumerable:!0,get:function(){return du.str}});Object.defineProperty(hr,"stringify",{enumerable:!0,get:function(){return du.stringify}});Object.defineProperty(hr,"nil",{enumerable:!0,get:function(){return du.nil}});Object.defineProperty(hr,"Name",{enumerable:!0,get:function(){return du.Name}});Object.defineProperty(hr,"CodeGen",{enumerable:!0,get:function(){return du.CodeGen}});var wB=Qh(),JO=qf(),_B=NS(),If=Xh(),RB=Je(),Pf=Rf(),nm=_f(),uw=nt(),BO=RO(),CB=HO(),GO=(t,e)=>new RegExp(t,e);GO.code="new RegExp";var xB=["removeAdditional","useDefaults","coerceTypes"],EB=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),qB={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},OB={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},VO=200;function IB(t){var e,r,n,i,s,o,l,c,d,p,m,y,b,q,C,v,_,E,k,O,M,j,I,R,A;let F=t.strict,U=(e=t.code)===null||e===void 0?void 0:e.optimize,D=U===!0||U===void 0?1:U||0,J=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:GO,Q=(i=t.uriResolver)!==null&&i!==void 0?i:CB.default;return{strictSchema:(o=(s=t.strictSchema)!==null&&s!==void 0?s:F)!==null&&o!==void 0?o:!0,strictNumbers:(c=(l=t.strictNumbers)!==null&&l!==void 0?l:F)!==null&&c!==void 0?c:!0,strictTypes:(p=(d=t.strictTypes)!==null&&d!==void 0?d:F)!==null&&p!==void 0?p:"log",strictTuples:(y=(m=t.strictTuples)!==null&&m!==void 0?m:F)!==null&&y!==void 0?y:"log",strictRequired:(q=(b=t.strictRequired)!==null&&b!==void 0?b:F)!==null&&q!==void 0?q:!1,code:t.code?{...t.code,optimize:D,regExp:J}:{optimize:D,regExp:J},loopRequired:(C=t.loopRequired)!==null&&C!==void 0?C:VO,loopEnum:(v=t.loopEnum)!==null&&v!==void 0?v:VO,meta:(_=t.meta)!==null&&_!==void 0?_:!0,messages:(E=t.messages)!==null&&E!==void 0?E:!0,inlineRefs:(k=t.inlineRefs)!==null&&k!==void 0?k:!0,schemaId:(O=t.schemaId)!==null&&O!==void 0?O:"$id",addUsedSchema:(M=t.addUsedSchema)!==null&&M!==void 0?M:!0,validateSchema:(j=t.validateSchema)!==null&&j!==void 0?j:!0,validateFormats:(I=t.validateFormats)!==null&&I!==void 0?I:!0,unicodeRegExp:(R=t.unicodeRegExp)!==null&&R!==void 0?R:!0,int32range:(A=t.int32range)!==null&&A!==void 0?A:!0,uriResolver:Q}}var kf=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...IB(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new RB.ValueScope({scope:{},prefixes:EB,es5:r,lines:n}),this.logger=NB(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,_B.getRules)(),WO.call(this,qB,e,"NOT SUPPORTED"),WO.call(this,OB,e,"DEPRECATED","warn"),this._metaOpts=TB.call(this),e.formats&&kB.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&AB.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),PB.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=BO;n==="id"&&(i={...BO},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(p,m){await s.call(this,p.$schema);let y=this._addSchema(p,m);return y.validate||o.call(this,y)}async function s(p){p&&!this.getSchema(p)&&await i.call(this,{$ref:p},!0)}async function o(p){try{return this._compileSchemaEnv(p)}catch(m){if(!(m instanceof JO.default))throw m;return l.call(this,m),await c.call(this,m.missingSchema),o.call(this,p)}}function l({missingSchema:p,missingRef:m}){if(this.refs[p])throw new Error(`AnySchema ${p} is loaded but ${m} cannot be resolved`)}async function c(p){let m=await d.call(this,p);this.refs[p]||await s.call(this,m.$schema),this.refs[p]||this.addSchema(m,p,r)}async function d(p){let m=this._loading[p];if(m)return m;try{return await(this._loading[p]=n(p))}finally{delete this._loading[p]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let s;if(typeof e=="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw new Error(`schema ${o} must be string`)}return r=(0,Pf.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return i}getSchema(e){let r;for(;typeof(r=zO.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new If.SchemaEnv({schema:{},schemaId:n});if(r=If.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=zO.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Pf.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(FB.call(this,n,r),!r)return(0,uw.eachItem)(n,s=>lw.call(this,s)),this;jB.call(this,r);let i={...r,type:(0,nm.getJSONTypes)(r.type),schemaType:(0,nm.getJSONTypes)(r.schemaType)};return(0,uw.eachItem)(n,i.type.length===0?s=>lw.call(this,s,i):s=>i.type.forEach(o=>lw.call(this,s,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(s=>s.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,s)=>i+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let s=i.split("/").slice(1),o=e;for(let l of s)o=o[l];for(let l in n){let c=n[l];if(typeof c!="object")continue;let{$data:d}=c.definition,p=o[l];d&&p&&(o[l]=YO(p))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:l}=this.opts;if(typeof e=="object")o=e[l];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Pf.normalizeId)(o||n);let d=Pf.getSchemaRefs.call(this,e,n);return c=new If.SchemaEnv({schema:e,schemaId:l,meta:r,baseId:n,localRefs:d}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):If.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{If.compileSchema.call(this,e)}finally{this.opts=r}}};kf.ValidationError=wB.default;kf.MissingRefError=JO.default;hr.default=kf;function WO(t,e,r,n="error"){for(let i in t){let s=i;s in e&&this.logger[n](`${r}: option ${i}. ${t[s]}`)}}function zO(t){return t=(0,Pf.normalizeId)(t),this.schemas[t]||this.refs[t]}function PB(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function kB(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function AB(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function TB(){let t={...this.opts};for(let e of xB)delete t[e];return t}var $B={log(){},warn(){},error(){}};function NB(t){if(t===!1)return $B;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var MB=/^[a-z_$][a-z0-9_$:-]*$/i;function FB(t,e){let{RULES:r}=this;if((0,uw.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!MB.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function lw(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,o=i?s.post:s.rules.find(({type:c})=>c===r);if(o||(o={type:r,rules:[]},s.rules.push(o)),s.keywords[t]=!0,!e)return;let l={keyword:t,definition:{...e,type:(0,nm.getJSONTypes)(e.type),schemaType:(0,nm.getJSONTypes)(e.schemaType)}};e.before?DB.call(this,o,l,e.before):o.rules.push(l),s.all[t]=l,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function DB(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function jB(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=YO(e)),t.validateSchema=this.compile(e,!0))}var LB={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function YO(t){return{anyOf:[t,LB]}}});var QO=V(cw=>{"use strict";Object.defineProperty(cw,"__esModule",{value:!0});var UB={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};cw.default=UB});var tI=V(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.callRef=Pa.getValidate=void 0;var HB=qf(),ZO=Hn(),rn=Je(),pu=_s(),XO=Xh(),im=nt(),BB={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:s,validateName:o,opts:l,self:c}=n,{root:d}=s;if((r==="#"||r==="#/")&&i===d.baseId)return m();let p=XO.resolveRef.call(c,d,i,r);if(p===void 0)throw new HB.default(n.opts.uriResolver,i,r);if(p instanceof XO.SchemaEnv)return y(p);return b(p);function m(){if(s===d)return sm(t,o,s,s.$async);let q=e.scopeValue("root",{ref:d});return sm(t,(0,rn._)`${q}.validate`,d,d.$async)}function y(q){let C=eI(t,q);sm(t,C,q,q.$async)}function b(q){let C=e.scopeValue("schema",l.code.source===!0?{ref:q,code:(0,rn.stringify)(q)}:{ref:q}),v=e.name("valid"),_=t.subschema({schema:q,dataTypes:[],schemaPath:rn.nil,topSchemaRef:C,errSchemaPath:r},v);t.mergeEvaluated(_),t.ok(v)}}};function eI(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,rn._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Pa.getValidate=eI;function sm(t,e,r,n){let{gen:i,it:s}=t,{allErrors:o,schemaEnv:l,opts:c}=s,d=c.passContext?pu.default.this:rn.nil;n?p():m();function p(){if(!l.$async)throw new Error("async schema referenced by sync schema");let q=i.let("valid");i.try(()=>{i.code((0,rn._)`await ${(0,ZO.callValidateCode)(t,e,d)}`),b(e),o||i.assign(q,!0)},C=>{i.if((0,rn._)`!(${C} instanceof ${s.ValidationError})`,()=>i.throw(C)),y(C),o||i.assign(q,!1)}),t.ok(q)}function m(){t.result((0,ZO.callValidateCode)(t,e,d),()=>b(e),()=>y(e))}function y(q){let C=(0,rn._)`${q}.errors`;i.assign(pu.default.vErrors,(0,rn._)`${pu.default.vErrors} === null ? ${C} : ${pu.default.vErrors}.concat(${C})`),i.assign(pu.default.errors,(0,rn._)`${pu.default.vErrors}.length`)}function b(q){var C;if(!s.opts.unevaluated)return;let v=(C=r?.validate)===null||C===void 0?void 0:C.evaluated;if(s.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(s.props=im.mergeEvaluated.props(i,v.props,s.props));else{let _=i.var("props",(0,rn._)`${q}.evaluated.props`);s.props=im.mergeEvaluated.props(i,_,s.props,rn.Name)}if(s.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(s.items=im.mergeEvaluated.items(i,v.items,s.items));else{let _=i.var("items",(0,rn._)`${q}.evaluated.items`);s.items=im.mergeEvaluated.items(i,_,s.items,rn.Name)}}}Pa.callRef=sm;Pa.default=BB});var rI=V(fw=>{"use strict";Object.defineProperty(fw,"__esModule",{value:!0});var VB=QO(),WB=tI(),zB=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",VB.default,WB.default];fw.default=zB});var nI=V(dw=>{"use strict";Object.defineProperty(dw,"__esModule",{value:!0});var om=Je(),mo=om.operators,am={maximum:{okStr:"<=",ok:mo.LTE,fail:mo.GT},minimum:{okStr:">=",ok:mo.GTE,fail:mo.LT},exclusiveMaximum:{okStr:"<",ok:mo.LT,fail:mo.GTE},exclusiveMinimum:{okStr:">",ok:mo.GT,fail:mo.LTE}},JB={message:({keyword:t,schemaCode:e})=>(0,om.str)`must be ${am[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,om._)`{comparison: ${am[t].okStr}, limit: ${e}}`},GB={keyword:Object.keys(am),type:"number",schemaType:"number",$data:!0,error:JB,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,om._)`${r} ${am[e].fail} ${n} || isNaN(${r})`)}};dw.default=GB});var iI=V(pw=>{"use strict";Object.defineProperty(pw,"__esModule",{value:!0});var Af=Je(),YB={message:({schemaCode:t})=>(0,Af.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Af._)`{multipleOf: ${t}}`},KB={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:YB,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),l=s?(0,Af._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,Af._)`${o} !== parseInt(${o})`;t.fail$data((0,Af._)`(${n} === 0 || (${o} = ${r}/${n}, ${l}))`)}};pw.default=KB});var oI=V(hw=>{"use strict";Object.defineProperty(hw,"__esModule",{value:!0});function sI(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}hw.default=sI;sI.code='require("ajv/dist/runtime/ucs2length").default'});var aI=V(mw=>{"use strict";Object.defineProperty(mw,"__esModule",{value:!0});var ka=Je(),QB=nt(),ZB=oI(),XB={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,ka.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,ka._)`{limit: ${t}}`},eV={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:XB,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,s=e==="maxLength"?ka.operators.GT:ka.operators.LT,o=i.opts.unicode===!1?(0,ka._)`${r}.length`:(0,ka._)`${(0,QB.useFunc)(t.gen,ZB.default)}(${r})`;t.fail$data((0,ka._)`${o} ${s} ${n}`)}};mw.default=eV});var lI=V(gw=>{"use strict";Object.defineProperty(gw,"__esModule",{value:!0});var tV=Hn(),rV=nt(),hu=Je(),nV={message:({schemaCode:t})=>(0,hu.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,hu._)`{pattern: ${t}}`},iV={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:nV,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t,l=o.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=o.opts.code,d=c.code==="new RegExp"?(0,hu._)`new RegExp`:(0,rV.useFunc)(e,c),p=e.let("valid");e.try(()=>e.assign(p,(0,hu._)`${d}(${s}, ${l}).test(${r})`),()=>e.assign(p,!1)),t.fail$data((0,hu._)`!${p}`)}else{let c=(0,tV.usePattern)(t,i);t.fail$data((0,hu._)`!${c}.test(${r})`)}}};gw.default=iV});var uI=V(yw=>{"use strict";Object.defineProperty(yw,"__esModule",{value:!0});var Tf=Je(),sV={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Tf.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Tf._)`{limit: ${t}}`},oV={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:sV,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?Tf.operators.GT:Tf.operators.LT;t.fail$data((0,Tf._)`Object.keys(${r}).length ${i} ${n}`)}};yw.default=oV});var cI=V(vw=>{"use strict";Object.defineProperty(vw,"__esModule",{value:!0});var $f=Hn(),Nf=Je(),aV=nt(),lV={message:({params:{missingProperty:t}})=>(0,Nf.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Nf._)`{missingProperty: ${t}}`},uV={keyword:"required",type:"object",schemaType:"array",$data:!0,error:lV,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:s,it:o}=t,{opts:l}=o;if(!s&&r.length===0)return;let c=r.length>=l.loopRequired;if(o.allErrors?d():p(),l.strictRequired){let b=t.parentSchema.properties,{definedProperties:q}=t.it;for(let C of r)if(b?.[C]===void 0&&!q.has(C)){let v=o.schemaEnv.baseId+o.errSchemaPath,_=`required property "${C}" is not defined at "${v}" (strictRequired)`;(0,aV.checkStrictMode)(o,_,o.opts.strictRequired)}}function d(){if(c||s)t.block$data(Nf.nil,m);else for(let b of r)(0,$f.checkReportMissingProp)(t,b)}function p(){let b=e.let("missing");if(c||s){let q=e.let("valid",!0);t.block$data(q,()=>y(b,q)),t.ok(q)}else e.if((0,$f.checkMissingProp)(t,r,b)),(0,$f.reportMissingProp)(t,b),e.else()}function m(){e.forOf("prop",n,b=>{t.setParams({missingProperty:b}),e.if((0,$f.noPropertyInData)(e,i,b,l.ownProperties),()=>t.error())})}function y(b,q){t.setParams({missingProperty:b}),e.forOf(b,n,()=>{e.assign(q,(0,$f.propertyInData)(e,i,b,l.ownProperties)),e.if((0,Nf.not)(q),()=>{t.error(),e.break()})},Nf.nil)}}};vw.default=uV});var fI=V(bw=>{"use strict";Object.defineProperty(bw,"__esModule",{value:!0});var Mf=Je(),cV={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Mf.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Mf._)`{limit: ${t}}`},fV={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:cV,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?Mf.operators.GT:Mf.operators.LT;t.fail$data((0,Mf._)`${r}.length ${i} ${n}`)}};bw.default=fV});var lm=V(Sw=>{"use strict";Object.defineProperty(Sw,"__esModule",{value:!0});var dI=BS();dI.code='require("ajv/dist/runtime/equal").default';Sw.default=dI});var pI=V(_w=>{"use strict";Object.defineProperty(_w,"__esModule",{value:!0});var ww=_f(),mr=Je(),dV=nt(),pV=lm(),hV={message:({params:{i:t,j:e}})=>(0,mr.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,mr._)`{i: ${t}, j: ${e}}`},mV={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:hV,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:s,schemaCode:o,it:l}=t;if(!n&&!i)return;let c=e.let("valid"),d=s.items?(0,ww.getSchemaTypes)(s.items):[];t.block$data(c,p,(0,mr._)`${o} === false`),t.ok(c);function p(){let q=e.let("i",(0,mr._)`${r}.length`),C=e.let("j");t.setParams({i:q,j:C}),e.assign(c,!0),e.if((0,mr._)`${q} > 1`,()=>(m()?y:b)(q,C))}function m(){return d.length>0&&!d.some(q=>q==="object"||q==="array")}function y(q,C){let v=e.name("item"),_=(0,ww.checkDataTypes)(d,v,l.opts.strictNumbers,ww.DataType.Wrong),E=e.const("indices",(0,mr._)`{}`);e.for((0,mr._)`;${q}--;`,()=>{e.let(v,(0,mr._)`${r}[${q}]`),e.if(_,(0,mr._)`continue`),d.length>1&&e.if((0,mr._)`typeof ${v} == "string"`,(0,mr._)`${v} += "_"`),e.if((0,mr._)`typeof ${E}[${v}] == "number"`,()=>{e.assign(C,(0,mr._)`${E}[${v}]`),t.error(),e.assign(c,!1).break()}).code((0,mr._)`${E}[${v}] = ${q}`)})}function b(q,C){let v=(0,dV.useFunc)(e,pV.default),_=e.name("outer");e.label(_).for((0,mr._)`;${q}--;`,()=>e.for((0,mr._)`${C} = ${q}; ${C}--;`,()=>e.if((0,mr._)`${v}(${r}[${q}], ${r}[${C}])`,()=>{t.error(),e.assign(c,!1).break(_)})))}}};_w.default=mV});var hI=V(Cw=>{"use strict";Object.defineProperty(Cw,"__esModule",{value:!0});var Rw=Je(),gV=nt(),yV=lm(),vV={message:"must be equal to constant",params:({schemaCode:t})=>(0,Rw._)`{allowedValue: ${t}}`},bV={keyword:"const",$data:!0,error:vV,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,Rw._)`!${(0,gV.useFunc)(e,yV.default)}(${r}, ${i})`):t.fail((0,Rw._)`${s} !== ${r}`)}};Cw.default=bV});var mI=V(xw=>{"use strict";Object.defineProperty(xw,"__esModule",{value:!0});var Ff=Je(),SV=nt(),wV=lm(),_V={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Ff._)`{allowedValues: ${t}}`},RV={keyword:"enum",schemaType:"array",$data:!0,error:_V,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let l=i.length>=o.opts.loopEnum,c,d=()=>c??(c=(0,SV.useFunc)(e,wV.default)),p;if(l||n)p=e.let("valid"),t.block$data(p,m);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let b=e.const("vSchema",s);p=(0,Ff.or)(...i.map((q,C)=>y(b,C)))}t.pass(p);function m(){e.assign(p,!1),e.forOf("v",s,b=>e.if((0,Ff._)`${d()}(${r}, ${b})`,()=>e.assign(p,!0).break()))}function y(b,q){let C=i[q];return typeof C=="object"&&C!==null?(0,Ff._)`${d()}(${r}, ${b}[${q}])`:(0,Ff._)`${r} === ${C}`}}};xw.default=RV});var gI=V(Ew=>{"use strict";Object.defineProperty(Ew,"__esModule",{value:!0});var CV=nI(),xV=iI(),EV=aI(),qV=lI(),OV=uI(),IV=cI(),PV=fI(),kV=pI(),AV=hI(),TV=mI(),$V=[CV.default,xV.default,EV.default,qV.default,OV.default,IV.default,PV.default,kV.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},AV.default,TV.default];Ew.default=$V});var Ow=V(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});Df.validateAdditionalItems=void 0;var Aa=Je(),qw=nt(),NV={message:({params:{len:t}})=>(0,Aa.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Aa._)`{limit: ${t}}`},MV={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:NV,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,qw.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}yI(t,n)}};function yI(t,e){let{gen:r,schema:n,data:i,keyword:s,it:o}=t;o.items=!0;let l=r.const("len",(0,Aa._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Aa._)`${l} <= ${e.length}`);else if(typeof n=="object"&&!(0,qw.alwaysValidSchema)(o,n)){let d=r.var("valid",(0,Aa._)`${l} <= ${e.length}`);r.if((0,Aa.not)(d),()=>c(d)),t.ok(d)}function c(d){r.forRange("i",e.length,l,p=>{t.subschema({keyword:s,dataProp:p,dataPropType:qw.Type.Num},d),o.allErrors||r.if((0,Aa.not)(d),()=>r.break())})}}Df.validateAdditionalItems=yI;Df.default=MV});var Iw=V(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});jf.validateTuple=void 0;var vI=Je(),um=nt(),FV=Hn(),DV={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return bI(t,"additionalItems",e);r.items=!0,!(0,um.alwaysValidSchema)(r,e)&&t.ok((0,FV.validateArray)(t))}};function bI(t,e,r=t.schema){let{gen:n,parentSchema:i,data:s,keyword:o,it:l}=t;p(i),l.opts.unevaluated&&r.length&&l.items!==!0&&(l.items=um.mergeEvaluated.items(n,r.length,l.items));let c=n.name("valid"),d=n.const("len",(0,vI._)`${s}.length`);r.forEach((m,y)=>{(0,um.alwaysValidSchema)(l,m)||(n.if((0,vI._)`${d} > ${y}`,()=>t.subschema({keyword:o,schemaProp:y,dataProp:y},c)),t.ok(c))});function p(m){let{opts:y,errSchemaPath:b}=l,q=r.length,C=q===m.minItems&&(q===m.maxItems||m[e]===!1);if(y.strictTuples&&!C){let v=`"${o}" is ${q}-tuple, but minItems or maxItems/${e} are not specified or different at path "${b}"`;(0,um.checkStrictMode)(l,v,y.strictTuples)}}}jf.validateTuple=bI;jf.default=DV});var SI=V(Pw=>{"use strict";Object.defineProperty(Pw,"__esModule",{value:!0});var jV=Iw(),LV={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,jV.validateTuple)(t,"items")};Pw.default=LV});var _I=V(kw=>{"use strict";Object.defineProperty(kw,"__esModule",{value:!0});var wI=Je(),UV=nt(),HV=Hn(),BV=Ow(),VV={message:({params:{len:t}})=>(0,wI.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,wI._)`{limit: ${t}}`},WV={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:VV,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,UV.alwaysValidSchema)(n,e)&&(i?(0,BV.validateAdditionalItems)(t,i):t.ok((0,HV.validateArray)(t)))}};kw.default=WV});var RI=V(Aw=>{"use strict";Object.defineProperty(Aw,"__esModule",{value:!0});var Vn=Je(),cm=nt(),zV={message:({params:{min:t,max:e}})=>e===void 0?(0,Vn.str)`must contain at least ${t} valid item(s)`:(0,Vn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Vn._)`{minContains: ${t}}`:(0,Vn._)`{minContains: ${t}, maxContains: ${e}}`},JV={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:zV,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t,o,l,{minContains:c,maxContains:d}=n;s.opts.next?(o=c===void 0?1:c,l=d):o=1;let p=e.const("len",(0,Vn._)`${i}.length`);if(t.setParams({min:o,max:l}),l===void 0&&o===0){(0,cm.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(l!==void 0&&o>l){(0,cm.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,cm.alwaysValidSchema)(s,r)){let C=(0,Vn._)`${p} >= ${o}`;l!==void 0&&(C=(0,Vn._)`${C} && ${p} <= ${l}`),t.pass(C);return}s.items=!0;let m=e.name("valid");l===void 0&&o===1?b(m,()=>e.if(m,()=>e.break())):o===0?(e.let(m,!0),l!==void 0&&e.if((0,Vn._)`${i}.length > 0`,y)):(e.let(m,!1),y()),t.result(m,()=>t.reset());function y(){let C=e.name("_valid"),v=e.let("count",0);b(C,()=>e.if(C,()=>q(v)))}function b(C,v){e.forRange("i",0,p,_=>{t.subschema({keyword:"contains",dataProp:_,dataPropType:cm.Type.Num,compositeRule:!0},C),v()})}function q(C){e.code((0,Vn._)`${C}++`),l===void 0?e.if((0,Vn._)`${C} >= ${o}`,()=>e.assign(m,!0).break()):(e.if((0,Vn._)`${C} > ${l}`,()=>e.assign(m,!1).break()),o===1?e.assign(m,!0):e.if((0,Vn._)`${C} >= ${o}`,()=>e.assign(m,!0)))}}};Aw.default=JV});var EI=V(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.validateSchemaDeps=Vi.validatePropertyDeps=Vi.error=void 0;var Tw=Je(),GV=nt(),Lf=Hn();Vi.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,Tw.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,Tw._)`{property: ${t},
|
|
28
28
|
missingProperty: ${n},
|
|
29
29
|
depsCount: ${e},
|
|
30
|
-
deps: ${r}}`};var YV={keyword:"dependencies",type:"object",schemaType:"object",error:Vi.error,code(t){let[e,r]=KV(t);CI(t,e),xI(t,r)}};function KV({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function CI(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let o in e){let l=e[o];if(l.length===0)continue;let c=(0,Lf.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:l.length,deps:l.join(", ")}),i.allErrors?r.if(c,()=>{for(let d of l)(0,Lf.checkReportMissingProp)(t,d)}):(r.if((0,Tw._)`${c} && (${(0,Lf.checkMissingProp)(t,l,s)})`),(0,Lf.reportMissingProp)(t,s),r.else())}}Vi.validatePropertyDeps=CI;function xI(t,e=t.schema){let{gen:r,data:n,keyword:i,it:s}=t,o=r.name("valid");for(let l in e)(0,GV.alwaysValidSchema)(s,e[l])||(r.if((0,Lf.propertyInData)(r,n,l,s.opts.ownProperties),()=>{let c=t.subschema({keyword:i,schemaProp:l},o);t.mergeValidEvaluated(c,o)},()=>r.var(o,!0)),t.ok(o))}Vi.validateSchemaDeps=xI;Vi.default=YV});var OI=V($w=>{"use strict";Object.defineProperty($w,"__esModule",{value:!0});var qI=Je(),QV=nt(),ZV={message:"property name must be valid",params:({params:t})=>(0,qI._)`{propertyName: ${t.propertyName}}`},XV={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:ZV,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,QV.alwaysValidSchema)(i,r))return;let s=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},s),e.if((0,qI.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};$w.default=XV});var Mw=V(Nw=>{"use strict";Object.defineProperty(Nw,"__esModule",{value:!0});var fm=Hn(),di=Je(),eW=_s(),dm=nt(),tW={message:"must NOT have additional properties",params:({params:t})=>(0,di._)`{additionalProperty: ${t.additionalProperty}}`},rW={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:tW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:s,it:o}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:l,opts:c}=o;if(o.props=!0,c.removeAdditional!=="all"&&(0,dm.alwaysValidSchema)(o,r))return;let d=(0,fm.allSchemaProperties)(n.properties),p=(0,fm.allSchemaProperties)(n.patternProperties);m(),t.ok((0,di._)`${s} === ${eW.default.errors}`);function m(){e.forIn("key",i,v=>{!d.length&&!p.length?E(v):e.if(y(v),()=>E(v))})}function y(v){let _;if(d.length>8){let q=(0,dm.schemaRefOrVal)(o,n.properties,"properties");_=(0,fm.isOwnProperty)(e,q,v)}else d.length?_=(0,di.or)(...d.map(q=>(0,di._)`${v} === ${q}`)):_=di.nil;return p.length&&(_=(0,di.or)(_,...p.map(q=>(0,di._)`${(0,fm.usePattern)(t,q)}.test(${v})`))),(0,di.not)(_)}function b(v){e.code((0,di._)`delete ${i}[${v}]`)}function E(v){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){b(v);return}if(r===!1){t.setParams({additionalProperty:v}),t.error(),l||e.break();return}if(typeof r=="object"&&!(0,dm.alwaysValidSchema)(o,r)){let _=e.name("valid");c.removeAdditional==="failing"?(C(v,_,!1),e.if((0,di.not)(_),()=>{t.reset(),b(v)})):(C(v,_),l||e.if((0,di.not)(_),()=>e.break()))}}function C(v,_,q){let k={keyword:"additionalProperties",dataProp:v,dataPropType:dm.Type.Str};q===!1&&Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(k,_)}}};Nw.default=rW});var kI=V(Dw=>{"use strict";Object.defineProperty(Dw,"__esModule",{value:!0});var nW=Ef(),II=Hn(),Fw=nt(),PI=Mw(),iW={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&PI.default.code(new nW.KeywordCxt(s,PI.default,"additionalProperties"));let o=(0,II.allSchemaProperties)(r);for(let m of o)s.definedProperties.add(m);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=Fw.mergeEvaluated.props(e,(0,Fw.toHash)(o),s.props));let l=o.filter(m=>!(0,Fw.alwaysValidSchema)(s,r[m]));if(l.length===0)return;let c=e.name("valid");for(let m of l)d(m)?p(m):(e.if((0,II.propertyInData)(e,i,m,s.opts.ownProperties)),p(m),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(m),t.ok(c);function d(m){return s.opts.useDefaults&&!s.compositeRule&&r[m].default!==void 0}function p(m){t.subschema({keyword:"properties",schemaProp:m,dataProp:m},c)}}};Dw.default=iW});var NI=V(jw=>{"use strict";Object.defineProperty(jw,"__esModule",{value:!0});var AI=Hn(),pm=Je(),TI=nt(),$I=nt(),sW={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:s}=t,{opts:o}=s,l=(0,AI.allSchemaProperties)(r),c=l.filter(C=>(0,TI.alwaysValidSchema)(s,r[C]));if(l.length===0||c.length===l.length&&(!s.opts.unevaluated||s.props===!0))return;let d=o.strictSchema&&!o.allowMatchingProperties&&i.properties,p=e.name("valid");s.props!==!0&&!(s.props instanceof pm.Name)&&(s.props=(0,$I.evaluatedPropsToName)(e,s.props));let{props:m}=s;y();function y(){for(let C of l)d&&b(C),s.allErrors?E(C):(e.var(p,!0),E(C),e.if(p))}function b(C){for(let v in d)new RegExp(C).test(v)&&(0,TI.checkStrictMode)(s,`property ${v} matches pattern ${C} (use allowMatchingProperties)`)}function E(C){e.forIn("key",n,v=>{e.if((0,pm._)`${(0,AI.usePattern)(t,C)}.test(${v})`,()=>{let _=c.includes(C);_||t.subschema({keyword:"patternProperties",schemaProp:C,dataProp:v,dataPropType:$I.Type.Str},p),s.opts.unevaluated&&m!==!0?e.assign((0,pm._)`${m}[${v}]`,!0):!_&&!s.allErrors&&e.if((0,pm.not)(p),()=>e.break())})})}}};jw.default=sW});var MI=V(Lw=>{"use strict";Object.defineProperty(Lw,"__esModule",{value:!0});var oW=nt(),aW={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,oW.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Lw.default=aW});var FI=V(Uw=>{"use strict";Object.defineProperty(Uw,"__esModule",{value:!0});var lW=Hn(),uW={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:lW.validateUnion,error:{message:"must match a schema in anyOf"}};Uw.default=uW});var DI=V(Hw=>{"use strict";Object.defineProperty(Hw,"__esModule",{value:!0});var hm=Je(),cW=nt(),fW={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,hm._)`{passingSchemas: ${t.passing}}`},dW={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:fW,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let s=r,o=e.let("valid",!1),l=e.let("passing",null),c=e.name("_valid");t.setParams({passing:l}),e.block(d),t.result(o,()=>t.reset(),()=>t.error(!0));function d(){s.forEach((p,m)=>{let y;(0,cW.alwaysValidSchema)(i,p)?e.var(c,!0):y=t.subschema({keyword:"oneOf",schemaProp:m,compositeRule:!0},c),m>0&&e.if((0,hm._)`${c} && ${o}`).assign(o,!1).assign(l,(0,hm._)`[${l}, ${m}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(l,m),y&&t.mergeEvaluated(y,hm.Name)})})}}};Hw.default=dW});var jI=V(Bw=>{"use strict";Object.defineProperty(Bw,"__esModule",{value:!0});var pW=nt(),hW={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((s,o)=>{if((0,pW.alwaysValidSchema)(n,s))return;let l=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(l)})}};Bw.default=hW});var HI=V(Vw=>{"use strict";Object.defineProperty(Vw,"__esModule",{value:!0});var mm=Je(),UI=nt(),mW={message:({params:t})=>(0,mm.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,mm._)`{failingKeyword: ${t.ifClause}}`},gW={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:mW,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,UI.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=LI(n,"then"),s=LI(n,"else");if(!i&&!s)return;let o=e.let("valid",!0),l=e.name("_valid");if(c(),t.reset(),i&&s){let p=e.let("ifClause");t.setParams({ifClause:p}),e.if(l,d("then",p),d("else",p))}else i?e.if(l,d("then")):e.if((0,mm.not)(l),d("else"));t.pass(o,()=>t.error(!0));function c(){let p=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);t.mergeEvaluated(p)}function d(p,m){return()=>{let y=t.subschema({keyword:p},l);e.assign(o,l),t.mergeValidEvaluated(y,o),m?e.assign(m,(0,mm._)`${p}`):t.setParams({ifClause:p})}}}};function LI(t,e){let r=t.schema[e];return r!==void 0&&!(0,UI.alwaysValidSchema)(t,r)}Vw.default=gW});var BI=V(Ww=>{"use strict";Object.defineProperty(Ww,"__esModule",{value:!0});var yW=nt(),vW={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,yW.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Ww.default=vW});var VI=V(zw=>{"use strict";Object.defineProperty(zw,"__esModule",{value:!0});var bW=Ow(),SW=SI(),wW=Iw(),_W=_I(),RW=RI(),CW=EI(),xW=OI(),EW=Mw(),qW=kI(),OW=NI(),IW=MI(),PW=FI(),kW=DI(),AW=jI(),TW=HI(),$W=BI();function NW(t=!1){let e=[IW.default,PW.default,kW.default,AW.default,TW.default,$W.default,xW.default,EW.default,CW.default,qW.default,OW.default];return t?e.push(SW.default,_W.default):e.push(bW.default,wW.default),e.push(RW.default),e}zw.default=NW});var WI=V(Jw=>{"use strict";Object.defineProperty(Jw,"__esModule",{value:!0});var Zt=Je(),MW={message:({schemaCode:t})=>(0,Zt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Zt._)`{format: ${t}}`},FW={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:MW,code(t,e){let{gen:r,data:n,$data:i,schema:s,schemaCode:o,it:l}=t,{opts:c,errSchemaPath:d,schemaEnv:p,self:m}=l;if(!c.validateFormats)return;i?y():b();function y(){let E=r.scopeValue("formats",{ref:m.formats,code:c.code.formats}),C=r.const("fDef",(0,Zt._)`${E}[${o}]`),v=r.let("fType"),_=r.let("format");r.if((0,Zt._)`typeof ${C} == "object" && !(${C} instanceof RegExp)`,()=>r.assign(v,(0,Zt._)`${C}.type || "string"`).assign(_,(0,Zt._)`${C}.validate`),()=>r.assign(v,(0,Zt._)`"string"`).assign(_,C)),t.fail$data((0,Zt.or)(q(),k()));function q(){return c.strictSchema===!1?Zt.nil:(0,Zt._)`${o} && !${_}`}function k(){let O=p.$async?(0,Zt._)`(${C}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,Zt._)`${_}(${n})`,M=(0,Zt._)`(typeof ${_} == "function" ? ${O} : ${_}.test(${n}))`;return(0,Zt._)`${_} && ${_} !== true && ${v} === ${e} && !${M}`}}function b(){let E=m.formats[s];if(!E){q();return}if(E===!0)return;let[C,v,_]=k(E);C===e&&t.pass(O());function q(){if(c.strictSchema===!1){m.logger.warn(M());return}throw new Error(M());function M(){return`unknown format "${s}" ignored in schema at path "${d}"`}}function k(M){let j=M instanceof RegExp?(0,Zt.regexpCode)(M):c.code.formats?(0,Zt._)`${c.code.formats}${(0,Zt.getProperty)(s)}`:void 0,I=r.scopeValue("formats",{key:s,ref:M,code:j});return typeof M=="object"&&!(M instanceof RegExp)?[M.type||"string",M.validate,(0,Zt._)`${I}.validate`]:["string",M,I]}function O(){if(typeof E=="object"&&!(E instanceof RegExp)&&E.async){if(!p.$async)throw new Error("async format in sync schema");return(0,Zt._)`await ${_}(${n})`}return typeof v=="function"?(0,Zt._)`${_}(${n})`:(0,Zt._)`${_}.test(${n})`}}}};Jw.default=FW});var zI=V(Gw=>{"use strict";Object.defineProperty(Gw,"__esModule",{value:!0});var DW=WI(),jW=[DW.default];Gw.default=jW});var JI=V(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.contentVocabulary=mu.metadataVocabulary=void 0;mu.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];mu.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var YI=V(Yw=>{"use strict";Object.defineProperty(Yw,"__esModule",{value:!0});var LW=rI(),UW=gI(),HW=VI(),BW=zI(),GI=JI(),VW=[LW.default,UW.default,(0,HW.default)(),BW.default,GI.metadataVocabulary,GI.contentVocabulary];Yw.default=VW});var QI=V(gm=>{"use strict";Object.defineProperty(gm,"__esModule",{value:!0});gm.DiscrError=void 0;var KI;(function(t){t.Tag="tag",t.Mapping="mapping"})(KI||(gm.DiscrError=KI={}))});var XI=V(Qw=>{"use strict";Object.defineProperty(Qw,"__esModule",{value:!0});var gu=Je(),Kw=QI(),ZI=Xh(),WW=qf(),zW=nt(),JW={message:({params:{discrError:t,tagName:e}})=>t===Kw.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,gu._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},GW={keyword:"discriminator",type:"object",schemaType:"object",error:JW,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:s}=t,{oneOf:o}=i;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let l=n.propertyName;if(typeof l!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),d=e.const("tag",(0,gu._)`${r}${(0,gu.getProperty)(l)}`);e.if((0,gu._)`typeof ${d} == "string"`,()=>p(),()=>t.error(!1,{discrError:Kw.DiscrError.Tag,tag:d,tagName:l})),t.ok(c);function p(){let b=y();e.if(!1);for(let E in b)e.elseIf((0,gu._)`${d} === ${E}`),e.assign(c,m(b[E]));e.else(),t.error(!1,{discrError:Kw.DiscrError.Mapping,tag:d,tagName:l}),e.endIf()}function m(b){let E=e.name("valid"),C=t.subschema({keyword:"oneOf",schemaProp:b},E);return t.mergeEvaluated(C,gu.Name),E}function y(){var b;let E={},C=_(i),v=!0;for(let O=0;O<o.length;O++){let M=o[O];if(M?.$ref&&!(0,zW.schemaHasRulesButRef)(M,s.self.RULES)){let I=M.$ref;if(M=ZI.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,I),M instanceof ZI.SchemaEnv&&(M=M.schema),M===void 0)throw new WW.default(s.opts.uriResolver,s.baseId,I)}let j=(b=M?.properties)===null||b===void 0?void 0:b[l];if(typeof j!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);v=v&&(C||_(M)),q(j,O)}if(!v)throw new Error(`discriminator: "${l}" must be required`);return E;function _({required:O}){return Array.isArray(O)&&O.includes(l)}function q(O,M){if(O.const)k(O.const,M);else if(O.enum)for(let j of O.enum)k(j,M);else throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`)}function k(O,M){if(typeof O!="string"||O in E)throw new Error(`discriminator: "${l}" values must be unique strings`);E[O]=M}}}};Qw.default=GW});var eP=V((OZ,YW)=>{YW.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var rP=V((Ft,Zw)=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.MissingRefError=Ft.ValidationError=Ft.CodeGen=Ft.Name=Ft.nil=Ft.stringify=Ft.str=Ft._=Ft.KeywordCxt=Ft.Ajv=void 0;var KW=KO(),QW=YI(),ZW=XI(),tP=eP(),XW=["/properties"],ym="http://json-schema.org/draft-07/schema",yu=class extends KW.default{_addVocabularies(){super._addVocabularies(),QW.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(ZW.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(tP,XW):tP;this.addMetaSchema(e,ym,!1),this.refs["http://json-schema.org/schema"]=ym}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ym)?ym:void 0)}};Ft.Ajv=yu;Zw.exports=Ft=yu;Zw.exports.Ajv=yu;Object.defineProperty(Ft,"__esModule",{value:!0});Ft.default=yu;var ez=Ef();Object.defineProperty(Ft,"KeywordCxt",{enumerable:!0,get:function(){return ez.KeywordCxt}});var vu=Je();Object.defineProperty(Ft,"_",{enumerable:!0,get:function(){return vu._}});Object.defineProperty(Ft,"str",{enumerable:!0,get:function(){return vu.str}});Object.defineProperty(Ft,"stringify",{enumerable:!0,get:function(){return vu.stringify}});Object.defineProperty(Ft,"nil",{enumerable:!0,get:function(){return vu.nil}});Object.defineProperty(Ft,"Name",{enumerable:!0,get:function(){return vu.Name}});Object.defineProperty(Ft,"CodeGen",{enumerable:!0,get:function(){return vu.CodeGen}});var tz=Qh();Object.defineProperty(Ft,"ValidationError",{enumerable:!0,get:function(){return tz.default}});var rz=qf();Object.defineProperty(Ft,"MissingRefError",{enumerable:!0,get:function(){return rz.default}})});import*as nz from"crypto";import*as Ta from"fs";import{createRequire as iz}from"module";import*as pi from"path";function bm(){return{format:(t,e)=>{let r=t?new Date(t):new Date;return e==="YYYY-MM-DD"?r.toISOString().split("T")[0]:r.toISOString()},unix:()=>Math.floor(Date.now()/1e3),utc:()=>{let t=new Date;return{format:()=>t.toISOString(),toISOString:()=>t.toISOString()}},__isShim:!0,__warning:"This is a lightweight shim. For full features, install moment.js via modules/package.json"}}function nP(){return{get:(t,e,r)=>{let n=e.split("."),i=t;for(let s of n)if(i=i?.[s],i===void 0)return r;return i},set:(t,e,r)=>{let n=e.split("."),i=t;for(let s=0;s<n.length-1;s++)i[n[s]]||(i[n[s]]={}),i=i[n[s]];return i[n[n.length-1]]=r,t},cloneDeep:t=>JSON.parse(JSON.stringify(t)),keys:t=>Object.keys(t??{}),values:t=>Object.values(t??{}),entries:t=>Object.entries(t??{}),each(t,e){Array.isArray(t)?t.forEach((r,n)=>e(r,n,t)):t&&typeof t=="object"&&Object.entries(t).forEach(([r,n])=>e(n,r,t))},forEach(t,e){Array.isArray(t)?t.forEach((r,n)=>e(r,n,t)):t&&typeof t=="object"&&Object.entries(t).forEach(([r,n])=>e(n,r,t))},map:(t,e)=>(Array.isArray(t)?t:Object.values(t??{})).map(r=>e(r)),filter:(t,e)=>(Array.isArray(t)?t:Object.values(t??{})).filter(r=>e(r)),find:(t,e)=>(Array.isArray(t)?t:Object.values(t??{})).find(r=>e(r)),reduce:(t,e,r)=>(Array.isArray(t)?t:Object.values(t??{})).reduce((n,i)=>e(n,i),r),includes:(t,e)=>Array.isArray(t)?t.includes(e):Object.values(t??{}).includes(e),isObject:t=>t!==null&&typeof t=="object"&&!Array.isArray(t),isArray:t=>Array.isArray(t),isString:t=>typeof t=="string",isNumber:t=>typeof t=="number",isFunction:t=>typeof t=="function",isNil:t=>t==null,isEmpty:t=>t==null?!0:Array.isArray(t)||typeof t=="string"?t.length===0:typeof t=="object"?Object.keys(t).length===0:!1,assign:(t,...e)=>Object.assign(t,...e),merge:(t,...e)=>{let r={...t};for(let n of e)for(let[i,s]of Object.entries(n??{}))r[i]=s&&typeof s=="object"&&!Array.isArray(s)?{...r[i]??{},...s}:s;return r},omit:(t,e)=>{let r={...t};for(let n of e)delete r[n];return r},pick:(t,e)=>{let r={};for(let n of e)n in(t??{})&&(r[n]=t[n]);return r}}}function Xw(t,e){return new vm(t,e)}var vm,e0=ae(()=>{"use strict";uS();vm=class{availableModules=new Set;customModulesRequire;globalSetupExports;options;modulesPath=null;moduleCache=new Map;resolveStack=new Set;builtinModules={uuid:()=>({v4:eu}),crypto:()=>nz,path:()=>pi,querystring:()=>_t("querystring"),lodash:()=>this.loadOptionalModule("lodash",()=>wq(),nP),moment:()=>this.loadOptionalModule("moment",()=>_q(),bm),tv4:()=>this.loadOptionalModule("tv4",()=>Cq()),ajv:()=>this.loadOptionalModule("ajv",()=>rP()),"crypto-js":()=>this.loadOptionalModule("crypto-js",()=>_t("crypto-js"),()=>{throw new Error('crypto-js npm module is not installed. The built-in CryptoJS global is already available in scripts with AES/DES/TripleDES/hash/HMAC/PBKDF2 support. If you need the exact npm package, add "crypto-js" to your modules/package.json and run npm install.')})};constructor(e=[],r={}){this.options={allowCustomModules:!0,maxResolveDepth:10,...r,outputChannel:r.outputChannel||{appendLine:n=>{console.log(`[ModuleLoader] ${n}`)}}};for(let n of e){let i=pi.resolve(n);if(this.initializeModules(i)){this.modulesPath=i;break}}}loadOptionalModule(e,r,n){try{return r()}catch{if(this.customModulesRequire)try{return console.debug(`[ModuleLoader] ${e} not in core, trying user modules`),this.customModulesRequire(e)}catch{this.logModuleWarning(e,"user")}else this.logModuleWarning(e,"core");if(n)return console.warn(`[ModuleLoader] Using shim for ${e}. Some features may be limited.`),n();throw new Error(this.getModuleInstallInstructions(e))}}logModuleWarning(e,r){let i={moment:"Date/time manipulation",lodash:"Utility functions",tv4:"JSON Schema validation (v4)",ajv:"JSON Schema validation"}[e]||e;console.warn(`[ModuleLoader] ${i} functionality (${e}) is not available.
|
|
30
|
+
deps: ${r}}`};var YV={keyword:"dependencies",type:"object",schemaType:"object",error:Vi.error,code(t){let[e,r]=KV(t);CI(t,e),xI(t,r)}};function KV({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function CI(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let o in e){let l=e[o];if(l.length===0)continue;let c=(0,Lf.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:l.length,deps:l.join(", ")}),i.allErrors?r.if(c,()=>{for(let d of l)(0,Lf.checkReportMissingProp)(t,d)}):(r.if((0,Tw._)`${c} && (${(0,Lf.checkMissingProp)(t,l,s)})`),(0,Lf.reportMissingProp)(t,s),r.else())}}Vi.validatePropertyDeps=CI;function xI(t,e=t.schema){let{gen:r,data:n,keyword:i,it:s}=t,o=r.name("valid");for(let l in e)(0,GV.alwaysValidSchema)(s,e[l])||(r.if((0,Lf.propertyInData)(r,n,l,s.opts.ownProperties),()=>{let c=t.subschema({keyword:i,schemaProp:l},o);t.mergeValidEvaluated(c,o)},()=>r.var(o,!0)),t.ok(o))}Vi.validateSchemaDeps=xI;Vi.default=YV});var OI=V($w=>{"use strict";Object.defineProperty($w,"__esModule",{value:!0});var qI=Je(),QV=nt(),ZV={message:"property name must be valid",params:({params:t})=>(0,qI._)`{propertyName: ${t.propertyName}}`},XV={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:ZV,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,QV.alwaysValidSchema)(i,r))return;let s=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},s),e.if((0,qI.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};$w.default=XV});var Mw=V(Nw=>{"use strict";Object.defineProperty(Nw,"__esModule",{value:!0});var fm=Hn(),di=Je(),eW=_s(),dm=nt(),tW={message:"must NOT have additional properties",params:({params:t})=>(0,di._)`{additionalProperty: ${t.additionalProperty}}`},rW={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:tW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:s,it:o}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:l,opts:c}=o;if(o.props=!0,c.removeAdditional!=="all"&&(0,dm.alwaysValidSchema)(o,r))return;let d=(0,fm.allSchemaProperties)(n.properties),p=(0,fm.allSchemaProperties)(n.patternProperties);m(),t.ok((0,di._)`${s} === ${eW.default.errors}`);function m(){e.forIn("key",i,v=>{!d.length&&!p.length?q(v):e.if(y(v),()=>q(v))})}function y(v){let _;if(d.length>8){let E=(0,dm.schemaRefOrVal)(o,n.properties,"properties");_=(0,fm.isOwnProperty)(e,E,v)}else d.length?_=(0,di.or)(...d.map(E=>(0,di._)`${v} === ${E}`)):_=di.nil;return p.length&&(_=(0,di.or)(_,...p.map(E=>(0,di._)`${(0,fm.usePattern)(t,E)}.test(${v})`))),(0,di.not)(_)}function b(v){e.code((0,di._)`delete ${i}[${v}]`)}function q(v){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){b(v);return}if(r===!1){t.setParams({additionalProperty:v}),t.error(),l||e.break();return}if(typeof r=="object"&&!(0,dm.alwaysValidSchema)(o,r)){let _=e.name("valid");c.removeAdditional==="failing"?(C(v,_,!1),e.if((0,di.not)(_),()=>{t.reset(),b(v)})):(C(v,_),l||e.if((0,di.not)(_),()=>e.break()))}}function C(v,_,E){let k={keyword:"additionalProperties",dataProp:v,dataPropType:dm.Type.Str};E===!1&&Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(k,_)}}};Nw.default=rW});var kI=V(Dw=>{"use strict";Object.defineProperty(Dw,"__esModule",{value:!0});var nW=Ef(),II=Hn(),Fw=nt(),PI=Mw(),iW={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&PI.default.code(new nW.KeywordCxt(s,PI.default,"additionalProperties"));let o=(0,II.allSchemaProperties)(r);for(let m of o)s.definedProperties.add(m);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=Fw.mergeEvaluated.props(e,(0,Fw.toHash)(o),s.props));let l=o.filter(m=>!(0,Fw.alwaysValidSchema)(s,r[m]));if(l.length===0)return;let c=e.name("valid");for(let m of l)d(m)?p(m):(e.if((0,II.propertyInData)(e,i,m,s.opts.ownProperties)),p(m),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(m),t.ok(c);function d(m){return s.opts.useDefaults&&!s.compositeRule&&r[m].default!==void 0}function p(m){t.subschema({keyword:"properties",schemaProp:m,dataProp:m},c)}}};Dw.default=iW});var NI=V(jw=>{"use strict";Object.defineProperty(jw,"__esModule",{value:!0});var AI=Hn(),pm=Je(),TI=nt(),$I=nt(),sW={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:s}=t,{opts:o}=s,l=(0,AI.allSchemaProperties)(r),c=l.filter(C=>(0,TI.alwaysValidSchema)(s,r[C]));if(l.length===0||c.length===l.length&&(!s.opts.unevaluated||s.props===!0))return;let d=o.strictSchema&&!o.allowMatchingProperties&&i.properties,p=e.name("valid");s.props!==!0&&!(s.props instanceof pm.Name)&&(s.props=(0,$I.evaluatedPropsToName)(e,s.props));let{props:m}=s;y();function y(){for(let C of l)d&&b(C),s.allErrors?q(C):(e.var(p,!0),q(C),e.if(p))}function b(C){for(let v in d)new RegExp(C).test(v)&&(0,TI.checkStrictMode)(s,`property ${v} matches pattern ${C} (use allowMatchingProperties)`)}function q(C){e.forIn("key",n,v=>{e.if((0,pm._)`${(0,AI.usePattern)(t,C)}.test(${v})`,()=>{let _=c.includes(C);_||t.subschema({keyword:"patternProperties",schemaProp:C,dataProp:v,dataPropType:$I.Type.Str},p),s.opts.unevaluated&&m!==!0?e.assign((0,pm._)`${m}[${v}]`,!0):!_&&!s.allErrors&&e.if((0,pm.not)(p),()=>e.break())})})}}};jw.default=sW});var MI=V(Lw=>{"use strict";Object.defineProperty(Lw,"__esModule",{value:!0});var oW=nt(),aW={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,oW.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Lw.default=aW});var FI=V(Uw=>{"use strict";Object.defineProperty(Uw,"__esModule",{value:!0});var lW=Hn(),uW={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:lW.validateUnion,error:{message:"must match a schema in anyOf"}};Uw.default=uW});var DI=V(Hw=>{"use strict";Object.defineProperty(Hw,"__esModule",{value:!0});var hm=Je(),cW=nt(),fW={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,hm._)`{passingSchemas: ${t.passing}}`},dW={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:fW,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let s=r,o=e.let("valid",!1),l=e.let("passing",null),c=e.name("_valid");t.setParams({passing:l}),e.block(d),t.result(o,()=>t.reset(),()=>t.error(!0));function d(){s.forEach((p,m)=>{let y;(0,cW.alwaysValidSchema)(i,p)?e.var(c,!0):y=t.subschema({keyword:"oneOf",schemaProp:m,compositeRule:!0},c),m>0&&e.if((0,hm._)`${c} && ${o}`).assign(o,!1).assign(l,(0,hm._)`[${l}, ${m}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(l,m),y&&t.mergeEvaluated(y,hm.Name)})})}}};Hw.default=dW});var jI=V(Bw=>{"use strict";Object.defineProperty(Bw,"__esModule",{value:!0});var pW=nt(),hW={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((s,o)=>{if((0,pW.alwaysValidSchema)(n,s))return;let l=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(l)})}};Bw.default=hW});var HI=V(Vw=>{"use strict";Object.defineProperty(Vw,"__esModule",{value:!0});var mm=Je(),UI=nt(),mW={message:({params:t})=>(0,mm.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,mm._)`{failingKeyword: ${t.ifClause}}`},gW={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:mW,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,UI.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=LI(n,"then"),s=LI(n,"else");if(!i&&!s)return;let o=e.let("valid",!0),l=e.name("_valid");if(c(),t.reset(),i&&s){let p=e.let("ifClause");t.setParams({ifClause:p}),e.if(l,d("then",p),d("else",p))}else i?e.if(l,d("then")):e.if((0,mm.not)(l),d("else"));t.pass(o,()=>t.error(!0));function c(){let p=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);t.mergeEvaluated(p)}function d(p,m){return()=>{let y=t.subschema({keyword:p},l);e.assign(o,l),t.mergeValidEvaluated(y,o),m?e.assign(m,(0,mm._)`${p}`):t.setParams({ifClause:p})}}}};function LI(t,e){let r=t.schema[e];return r!==void 0&&!(0,UI.alwaysValidSchema)(t,r)}Vw.default=gW});var BI=V(Ww=>{"use strict";Object.defineProperty(Ww,"__esModule",{value:!0});var yW=nt(),vW={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,yW.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Ww.default=vW});var VI=V(zw=>{"use strict";Object.defineProperty(zw,"__esModule",{value:!0});var bW=Ow(),SW=SI(),wW=Iw(),_W=_I(),RW=RI(),CW=EI(),xW=OI(),EW=Mw(),qW=kI(),OW=NI(),IW=MI(),PW=FI(),kW=DI(),AW=jI(),TW=HI(),$W=BI();function NW(t=!1){let e=[IW.default,PW.default,kW.default,AW.default,TW.default,$W.default,xW.default,EW.default,CW.default,qW.default,OW.default];return t?e.push(SW.default,_W.default):e.push(bW.default,wW.default),e.push(RW.default),e}zw.default=NW});var WI=V(Jw=>{"use strict";Object.defineProperty(Jw,"__esModule",{value:!0});var Zt=Je(),MW={message:({schemaCode:t})=>(0,Zt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Zt._)`{format: ${t}}`},FW={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:MW,code(t,e){let{gen:r,data:n,$data:i,schema:s,schemaCode:o,it:l}=t,{opts:c,errSchemaPath:d,schemaEnv:p,self:m}=l;if(!c.validateFormats)return;i?y():b();function y(){let q=r.scopeValue("formats",{ref:m.formats,code:c.code.formats}),C=r.const("fDef",(0,Zt._)`${q}[${o}]`),v=r.let("fType"),_=r.let("format");r.if((0,Zt._)`typeof ${C} == "object" && !(${C} instanceof RegExp)`,()=>r.assign(v,(0,Zt._)`${C}.type || "string"`).assign(_,(0,Zt._)`${C}.validate`),()=>r.assign(v,(0,Zt._)`"string"`).assign(_,C)),t.fail$data((0,Zt.or)(E(),k()));function E(){return c.strictSchema===!1?Zt.nil:(0,Zt._)`${o} && !${_}`}function k(){let O=p.$async?(0,Zt._)`(${C}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,Zt._)`${_}(${n})`,M=(0,Zt._)`(typeof ${_} == "function" ? ${O} : ${_}.test(${n}))`;return(0,Zt._)`${_} && ${_} !== true && ${v} === ${e} && !${M}`}}function b(){let q=m.formats[s];if(!q){E();return}if(q===!0)return;let[C,v,_]=k(q);C===e&&t.pass(O());function E(){if(c.strictSchema===!1){m.logger.warn(M());return}throw new Error(M());function M(){return`unknown format "${s}" ignored in schema at path "${d}"`}}function k(M){let j=M instanceof RegExp?(0,Zt.regexpCode)(M):c.code.formats?(0,Zt._)`${c.code.formats}${(0,Zt.getProperty)(s)}`:void 0,I=r.scopeValue("formats",{key:s,ref:M,code:j});return typeof M=="object"&&!(M instanceof RegExp)?[M.type||"string",M.validate,(0,Zt._)`${I}.validate`]:["string",M,I]}function O(){if(typeof q=="object"&&!(q instanceof RegExp)&&q.async){if(!p.$async)throw new Error("async format in sync schema");return(0,Zt._)`await ${_}(${n})`}return typeof v=="function"?(0,Zt._)`${_}(${n})`:(0,Zt._)`${_}.test(${n})`}}}};Jw.default=FW});var zI=V(Gw=>{"use strict";Object.defineProperty(Gw,"__esModule",{value:!0});var DW=WI(),jW=[DW.default];Gw.default=jW});var JI=V(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.contentVocabulary=mu.metadataVocabulary=void 0;mu.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];mu.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var YI=V(Yw=>{"use strict";Object.defineProperty(Yw,"__esModule",{value:!0});var LW=rI(),UW=gI(),HW=VI(),BW=zI(),GI=JI(),VW=[LW.default,UW.default,(0,HW.default)(),BW.default,GI.metadataVocabulary,GI.contentVocabulary];Yw.default=VW});var QI=V(gm=>{"use strict";Object.defineProperty(gm,"__esModule",{value:!0});gm.DiscrError=void 0;var KI;(function(t){t.Tag="tag",t.Mapping="mapping"})(KI||(gm.DiscrError=KI={}))});var XI=V(Qw=>{"use strict";Object.defineProperty(Qw,"__esModule",{value:!0});var gu=Je(),Kw=QI(),ZI=Xh(),WW=qf(),zW=nt(),JW={message:({params:{discrError:t,tagName:e}})=>t===Kw.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,gu._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},GW={keyword:"discriminator",type:"object",schemaType:"object",error:JW,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:s}=t,{oneOf:o}=i;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let l=n.propertyName;if(typeof l!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),d=e.const("tag",(0,gu._)`${r}${(0,gu.getProperty)(l)}`);e.if((0,gu._)`typeof ${d} == "string"`,()=>p(),()=>t.error(!1,{discrError:Kw.DiscrError.Tag,tag:d,tagName:l})),t.ok(c);function p(){let b=y();e.if(!1);for(let q in b)e.elseIf((0,gu._)`${d} === ${q}`),e.assign(c,m(b[q]));e.else(),t.error(!1,{discrError:Kw.DiscrError.Mapping,tag:d,tagName:l}),e.endIf()}function m(b){let q=e.name("valid"),C=t.subschema({keyword:"oneOf",schemaProp:b},q);return t.mergeEvaluated(C,gu.Name),q}function y(){var b;let q={},C=_(i),v=!0;for(let O=0;O<o.length;O++){let M=o[O];if(M?.$ref&&!(0,zW.schemaHasRulesButRef)(M,s.self.RULES)){let I=M.$ref;if(M=ZI.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,I),M instanceof ZI.SchemaEnv&&(M=M.schema),M===void 0)throw new WW.default(s.opts.uriResolver,s.baseId,I)}let j=(b=M?.properties)===null||b===void 0?void 0:b[l];if(typeof j!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);v=v&&(C||_(M)),E(j,O)}if(!v)throw new Error(`discriminator: "${l}" must be required`);return q;function _({required:O}){return Array.isArray(O)&&O.includes(l)}function E(O,M){if(O.const)k(O.const,M);else if(O.enum)for(let j of O.enum)k(j,M);else throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`)}function k(O,M){if(typeof O!="string"||O in q)throw new Error(`discriminator: "${l}" values must be unique strings`);q[O]=M}}}};Qw.default=GW});var eP=V((OZ,YW)=>{YW.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var rP=V((Ft,Zw)=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.MissingRefError=Ft.ValidationError=Ft.CodeGen=Ft.Name=Ft.nil=Ft.stringify=Ft.str=Ft._=Ft.KeywordCxt=Ft.Ajv=void 0;var KW=KO(),QW=YI(),ZW=XI(),tP=eP(),XW=["/properties"],ym="http://json-schema.org/draft-07/schema",yu=class extends KW.default{_addVocabularies(){super._addVocabularies(),QW.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(ZW.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(tP,XW):tP;this.addMetaSchema(e,ym,!1),this.refs["http://json-schema.org/schema"]=ym}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ym)?ym:void 0)}};Ft.Ajv=yu;Zw.exports=Ft=yu;Zw.exports.Ajv=yu;Object.defineProperty(Ft,"__esModule",{value:!0});Ft.default=yu;var ez=Ef();Object.defineProperty(Ft,"KeywordCxt",{enumerable:!0,get:function(){return ez.KeywordCxt}});var vu=Je();Object.defineProperty(Ft,"_",{enumerable:!0,get:function(){return vu._}});Object.defineProperty(Ft,"str",{enumerable:!0,get:function(){return vu.str}});Object.defineProperty(Ft,"stringify",{enumerable:!0,get:function(){return vu.stringify}});Object.defineProperty(Ft,"nil",{enumerable:!0,get:function(){return vu.nil}});Object.defineProperty(Ft,"Name",{enumerable:!0,get:function(){return vu.Name}});Object.defineProperty(Ft,"CodeGen",{enumerable:!0,get:function(){return vu.CodeGen}});var tz=Qh();Object.defineProperty(Ft,"ValidationError",{enumerable:!0,get:function(){return tz.default}});var rz=qf();Object.defineProperty(Ft,"MissingRefError",{enumerable:!0,get:function(){return rz.default}})});import*as nz from"crypto";import*as Ta from"fs";import{createRequire as iz}from"module";import*as pi from"path";function bm(){return{format:(t,e)=>{let r=t?new Date(t):new Date;return e==="YYYY-MM-DD"?r.toISOString().split("T")[0]:r.toISOString()},unix:()=>Math.floor(Date.now()/1e3),utc:()=>{let t=new Date;return{format:()=>t.toISOString(),toISOString:()=>t.toISOString()}},__isShim:!0,__warning:"This is a lightweight shim. For full features, install moment.js via modules/package.json"}}function nP(){return{get:(t,e,r)=>{let n=e.split("."),i=t;for(let s of n)if(i=i?.[s],i===void 0)return r;return i},set:(t,e,r)=>{let n=e.split("."),i=t;for(let s=0;s<n.length-1;s++)i[n[s]]||(i[n[s]]={}),i=i[n[s]];return i[n[n.length-1]]=r,t},cloneDeep:t=>JSON.parse(JSON.stringify(t)),keys:t=>Object.keys(t??{}),values:t=>Object.values(t??{}),entries:t=>Object.entries(t??{}),each(t,e){Array.isArray(t)?t.forEach((r,n)=>e(r,n,t)):t&&typeof t=="object"&&Object.entries(t).forEach(([r,n])=>e(n,r,t))},forEach(t,e){Array.isArray(t)?t.forEach((r,n)=>e(r,n,t)):t&&typeof t=="object"&&Object.entries(t).forEach(([r,n])=>e(n,r,t))},map:(t,e)=>(Array.isArray(t)?t:Object.values(t??{})).map(r=>e(r)),filter:(t,e)=>(Array.isArray(t)?t:Object.values(t??{})).filter(r=>e(r)),find:(t,e)=>(Array.isArray(t)?t:Object.values(t??{})).find(r=>e(r)),reduce:(t,e,r)=>(Array.isArray(t)?t:Object.values(t??{})).reduce((n,i)=>e(n,i),r),includes:(t,e)=>Array.isArray(t)?t.includes(e):Object.values(t??{}).includes(e),isObject:t=>t!==null&&typeof t=="object"&&!Array.isArray(t),isArray:t=>Array.isArray(t),isString:t=>typeof t=="string",isNumber:t=>typeof t=="number",isFunction:t=>typeof t=="function",isNil:t=>t==null,isEmpty:t=>t==null?!0:Array.isArray(t)||typeof t=="string"?t.length===0:typeof t=="object"?Object.keys(t).length===0:!1,assign:(t,...e)=>Object.assign(t,...e),merge:(t,...e)=>{let r={...t};for(let n of e)for(let[i,s]of Object.entries(n??{}))r[i]=s&&typeof s=="object"&&!Array.isArray(s)?{...r[i]??{},...s}:s;return r},omit:(t,e)=>{let r={...t};for(let n of e)delete r[n];return r},pick:(t,e)=>{let r={};for(let n of e)n in(t??{})&&(r[n]=t[n]);return r}}}function Xw(t,e){return new vm(t,e)}var vm,e0=ae(()=>{"use strict";uS();vm=class{availableModules=new Set;customModulesRequire;globalSetupExports;options;modulesPath=null;moduleCache=new Map;resolveStack=new Set;builtinModules={uuid:()=>({v4:eu}),crypto:()=>nz,path:()=>pi,querystring:()=>_t("querystring"),lodash:()=>this.loadOptionalModule("lodash",()=>wq(),nP),moment:()=>this.loadOptionalModule("moment",()=>_q(),bm),tv4:()=>this.loadOptionalModule("tv4",()=>Cq()),ajv:()=>this.loadOptionalModule("ajv",()=>rP()),"crypto-js":()=>this.loadOptionalModule("crypto-js",()=>_t("crypto-js"),()=>{throw new Error('crypto-js npm module is not installed. The built-in CryptoJS global is already available in scripts with AES/DES/TripleDES/hash/HMAC/PBKDF2 support. If you need the exact npm package, add "crypto-js" to your modules/package.json and run npm install.')})};constructor(e=[],r={}){this.options={allowCustomModules:!0,maxResolveDepth:10,...r,outputChannel:r.outputChannel||{appendLine:n=>{console.log(`[ModuleLoader] ${n}`)}}};for(let n of e){let i=pi.resolve(n);if(this.initializeModules(i)){this.modulesPath=i;break}}}loadOptionalModule(e,r,n){try{return r()}catch{if(this.customModulesRequire)try{return console.debug(`[ModuleLoader] ${e} not in core, trying user modules`),this.customModulesRequire(e)}catch{this.logModuleWarning(e,"user")}else this.logModuleWarning(e,"core");if(n)return console.warn(`[ModuleLoader] Using shim for ${e}. Some features may be limited.`),n();throw new Error(this.getModuleInstallInstructions(e))}}logModuleWarning(e,r){let i={moment:"Date/time manipulation",lodash:"Utility functions",tv4:"JSON Schema validation (v4)",ajv:"JSON Schema validation"}[e]||e;console.warn(`[ModuleLoader] ${i} functionality (${e}) is not available.
|
|
31
31
|
${this.getModuleInstallInstructions(e)}`)}getModuleInstallInstructions(e){let n={moment:"^2.30.1",lodash:"^4.17.21",tv4:"^1.3.0",ajv:"^8.17.1"}[e]||"latest";return`To use ${e}, add it to http-forge/modules/package.json:
|
|
32
32
|
{
|
|
33
33
|
"dependencies": {
|
|
@@ -49,10 +49,10 @@ ${i}
|
|
|
49
49
|
|
|
50
50
|
// --- Next Script ---
|
|
51
51
|
|
|
52
|
-
`)}function Uf(t,e){return JSON.stringify(t)!==JSON.stringify(e)}function Su(t){return t.map(e=>{let r=e.args.map(n=>{if(typeof n=="object")try{return JSON.stringify(n,null,2)}catch{return String(n)}return String(n)}).join(" ");return`[${e.level}] ${r}`})}function uz(t){return{log:(...e)=>t.push({level:"log",args:e}),info:(...e)=>t.push({level:"info",args:e}),warn:(...e)=>t.push({level:"warn",args:e}),error:(...e)=>t.push({level:"error",args:e})}}function t0(t){let e=[],r=(n,i)=>{try{let s=i();if(s&&typeof s.then=="function"){let o=s.then(()=>{t.push({name:n,passed:!0})},l=>{t.push({name:n,passed:!1,message:l.message||String(l)})});e.push(o)}else t.push({name:n,passed:!0})}catch(s){t.push({name:n,passed:!1,message:s.message})}};return r.skip=(n,i)=>{t.push({name:n,passed:!0,skipped:!0})},r.fail=n=>{t.push({name:n||"Failed test",passed:!1,message:n||"pm.test.fail()"})},r.index=()=>t.length,r._pendingTests=e,r}function r0(t){let e={};for(let[r,n]of Object.entries(t))e[r]=Array.isArray(n)?n.join(", "):n;return e}function Cm(t,e,r){let n;if(r)try{n=new URL(r).hostname}catch{n=void 0}let i=xt.parseCookieHeaders(t||{},n);return i.length>0?i:Array.isArray(e)&&e.length>0?e.filter(s=>s&&s.name).map(s=>({name:s.name,value:s.value,domain:s.domain??n,path:s.path,expires:s.expires,maxAge:s.maxAge,httpOnly:s.httpOnly,secure:s.secure,sameSite:s.sameSite})):[]}var Hf=ae(()=>{"use strict";ga()});import*as n0 from"vm";function cz(t){let e=null;try{e=new URL(t)}catch{}return{toString(){return t},valueOf(){return t},[Symbol.toPrimitive](n){return n==="number"?NaN:t},getHost(){return e?e.hostname:""},getPath(){return e?e.pathname:t},getPathWithQuery(){return e?e.pathname+e.search:t},getQueryString(){return e?e.search.startsWith("?")?e.search.slice(1):e.search:""},getRemote(){if(!e)return"";let n=e.port||(e.protocol==="https:"?"443":"80");return`${e.hostname}:${n}`},getOAuth1BaseUrl(){return e?`${e.protocol}//${e.host}${e.pathname}`:t},get protocol(){return e?.protocol?.replace(":","")||""},get host(){return e?e.hostname.split("."):[]},get port(){return e?.port||""},get path(){return e?e.pathname.split("/").filter(Boolean):[]},get hash(){return e?.hash?.replace("#","")||""},query:{toObject(){if(!e)return{};let n={};return e.searchParams.forEach((i,s)=>{n[s]=i}),n},has(n){return e?e.searchParams.has(n):!1},get(n){return e?e.searchParams.get(n):void 0},each(n){e&&e.searchParams.forEach((i,s)=>n({key:s,value:i}))}}}}var Bf,i0=ae(()=>{"use strict";sP();_m();Hf();Bf=class{constructor(e,r){this.deps=e;this.initialContext=r;this.timerRegistry=iP(n=>{let i=n instanceof Error?n.message:String(n);this.consoleMessages.push({level:"error",args:[`Uncaught error in async callback: ${i}`]})}),this.initializeSession()}deps;initialContext;vmContext=null;ctx=null;modifiedRequest=null;assertions=[];consoleMessages=[];_variables={};_collectionVariables={};_globals={};_environmentVariables={};_liveEnvironmentScope=null;_liveGlobalsScope=null;_liveCollectionScope=null;_nextRequest=void 0;_skipRequest=!1;_visualizerData=void 0;timerRegistry;initializeSession(){this.modifiedRequest={url:this.initialContext.request.url,method:this.initialContext.request.method,headers:{...this.initialContext.request.headers},body:this.initialContext.request.body?{...this.initialContext.request.body}:null,params:this.initialContext.request.params?{...this.initialContext.request.params}:{},query:this.initialContext.request.query?{...this.initialContext.request.query}:{}},this.assertions=[],this.ctx=this.createSharedContext(),this.consoleMessages=[];let e=this,r={log:(...n)=>{e.consoleMessages.push({level:"log",args:n})},info:(...n)=>{e.consoleMessages.push({level:"info",args:n})},warn:(...n)=>{e.consoleMessages.push({level:"warn",args:n})},error:(...n)=>{e.consoleMessages.push({level:"error",args:n})}};this.vmContext=this.deps.createVM(this.ctx,r,this.timerRegistry.timers)}createSharedContext(){let e=this.initialContext,r=this.modifiedRequest,n=this.deps.createCommonContext(e,"prerequest");this._variables={...e.variables},this._collectionVariables={...e.collectionVariables||{}},this._globals={...e.globals||{}},this._environmentVariables={...e.environmentVariables||{}},this._liveEnvironmentScope=n.environment,this._liveGlobalsScope=n.globals,this._liveCollectionScope=n.collectionVariables;let i;try{i=new URL(e.request.url).hostname}catch{}let s={get:l=>e.cookieJar?e.cookieJar.get(l,i)?.value:void 0,set:(l,c)=>{e.cookieJar&&e.cookieJar.set({name:l,value:c,domain:i})},has:l=>e.cookieJar?e.cookieJar.has(l,i):!1,list:()=>e.cookieJar?e.cookieJar.getAll(i).map(l=>({name:l.name,value:l.value})):[],toObject:()=>{if(!e.cookieJar)return{};let l=e.cookieJar.getAll(i),c={};for(let d of l)c[d.name]=d.value;return c},jar:()=>{let l=e.cookieJar,c=d=>{if(d==null)return;let p=typeof d=="string"?d:typeof d=="object"||typeof d=="number"||typeof d=="boolean"?String(d):void 0;if(!p)return;let m=p.trim();if(m)try{return new URL(m).hostname}catch{return m}};return{getAll(d,p){try{if(!l){p(null,[]);return}let m=c(d),y=l.getAll(m).map(b=>({name:b.name,value:b.value,domain:b.domain,path:b.path,httpOnly:b.httpOnly,secure:b.secure}));p(null,y)}catch(m){p(m,[])}},get(d,p,m){try{if(!l){m(null,void 0);return}let y=c(d),b=l.get(p,y);m(null,b?{name:b.name,value:b.value,domain:b.domain}:void 0)}catch(y){m(y,void 0)}},set(d,p,m,y){try{if(!l){(y||m)?.(null);return}let b=c(d);typeof p=="string"&&typeof m=="string"?(l.set({name:p,value:m,domain:b}),y?.(null)):typeof p=="object"&&(l.set({...p,domain:b}),m?.(null))}catch(b){(y||m)?.(b)}},unset(d,p,m){try{if(!l){m?.(null);return}let y=c(d);l.delete(p,y),m?.(null)}catch(y){m?.(y)}},clear(d,p){try{let m=typeof d=="function"?d:p;if(!l){m?.(null);return}let y=typeof d=="function"?void 0:c(d);y&&typeof l.clearDomain=="function"?l.clearDomain(y):l.clear(),m?.(null)}catch(m){(typeof d=="function"?d:p)?.(m)}}}},remove:l=>{e.cookieJar&&e.cookieJar.delete(l,i)},unset:l=>{e.cookieJar&&e.cookieJar.delete(l,i)},clear:()=>{e.cookieJar&&e.cookieJar.clear()}},o=this;return{request:this.createRequestObject(r,e),response:null,test:t0(this.assertions),expect:bu,cookies:s,execution:{setNextRequest(l){o._nextRequest=l},skipRequest(){o._skipRequest=!0},runRequest(l,c){let p=(async()=>{if(typeof n.sendRequest!="function")throw new Error("pm.execution.runRequest is not available \u2014 HTTP service not configured.");let m=typeof l=="string"?{url:l,method:"GET"}:l,y=await n.sendRequest(m),b=Array.isArray(y?.cookies)?y.cookies.filter(v=>v?.name):[],E=y?.body,C=0;if(typeof E=="string")C=Buffer.byteLength(E,"utf8");else if(Buffer.isBuffer(E))C=E.length;else if(E!=null)try{C=Buffer.byteLength(JSON.stringify(E),"utf8")}catch{}return wm({executedRequest:null,status:y?.status??0,statusText:y?.statusText??"",headers:y?.headers??{},body:E,cookies:b,responseTime:y?.time,responseSize:C})})();if(typeof c=="function"){p.then(m=>c(null,m),m=>c(m));return}return p},location:{current:n.info?.requestName||"",currentRequestName:n.info?.requestName||"",eventName:"prerequest",toString(){return n.info?.requestName||""}}},setNextRequest(l){o._nextRequest=l},visualizer:{set(l,c){o._visualizerData={template:l,data:c}},clear(){o._visualizerData=void 0}},...n,info:{...n.info||{},eventName:"prerequest",requestName:n.info?.requestName||void 0,requestId:n.info?.requestId||void 0,iteration:e.iteration||0,iterationCount:e.iterationCount||1}}}createRequestObject(e,r){let n=l=>{if(!l)return"none";switch(l){case"raw":return"raw";case"form-data":return"formdata";case"x-www-form-urlencoded":return"urlencoded";case"binary":return"file";case"graphql":return"graphql";case"none":return"none";default:return"raw"}},i=l=>{if(!l)return"none";switch(l){case"raw":return"raw";case"formdata":return"form-data";case"urlencoded":return"x-www-form-urlencoded";case"file":return"binary";case"graphql":return"graphql";case"none":return"none";default:return"raw"}},s={...e.headers,add:l=>{l&&l.key&&(e.headers[l.key]=l.value||"")},get:l=>{for(let[c,d]of Object.entries(e.headers))if(c.toLowerCase()===l.toLowerCase())return d},has:l=>{for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.toLowerCase())return!0;return!1},remove:l=>{for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.toLowerCase()){delete e.headers[c];break}},update:l=>{if(l&&l.key){for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.key.toLowerCase()){e.headers[c]=l.value||"";return}}},upsert:l=>{if(l&&l.key){for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.key.toLowerCase()){e.headers[c]=l.value||"";return}e.headers[l.key]=l.value||""}},toObject:()=>{let l={};for(let[c,d]of Object.entries(e.headers))typeof d=="string"&&(l[c]=d);return l},each:l=>{for(let[c,d]of Object.entries(e.headers))typeof d=="string"&&l({key:c,value:d})}},o={get mode(){return n(e.body?.type)},set mode(l){let c=i(l);e.body?e.body.type=c:e.body={type:c,content:null}},get raw(){let l=e.body?.content;return typeof l=="string"?l:l&&typeof l=="object"?JSON.stringify(l):""},set raw(l){e.body?(e.body.type="raw",e.body.content=l):e.body={type:"raw",content:l}},get formdata(){return e.body?.type==="form-data"&&Array.isArray(e.body.content)?e.body.content:[]},get urlencoded(){return e.body?.type==="x-www-form-urlencoded"&&Array.isArray(e.body.content)?e.body.content:[]},get graphql(){return e.body?.type==="graphql"?e.body.content:null},get file(){return e.body?.type==="binary"?e.body.content:null}};return{get url(){return cz(e.url)},set url(l){e.url=typeof l=="string"?l:String(l)},get method(){return e.method},set method(l){e.method=l},headers:s,get body(){return o},set body(l){if(l==null)e.body=null;else if(typeof l=="string")e.body={type:"raw",content:l};else if(typeof l=="object")if(l.type||l.mode||l.content!==void 0){let c=l.mode?i(l.mode):l.type||"raw";e.body={type:c,format:l.format,content:l.content}}else e.body={type:"raw",content:l}},get params(){return e.params||{}},set params(l){e.params=l||{}},get query(){return e.query||{}},set query(l){e.query=l||{}},get auth(){return r.request?.auth||null},set auth(l){r.request&&(r.request.auth=l)},get certificate(){return r.request?.certificate||null},set certificate(l){r.request&&(r.request.certificate=l)},get description(){return r.request?.description||null},set description(l){r.request&&(r.request.description=l)},get name(){return r.request?.name||null},set name(l){r.request&&(r.request.name=l)},get id(){return r.request?.id||null},get disabled(){return r.request?.disabled||!1},set disabled(l){r.request&&(r.request.disabled=l)},get messages(){return r.request?.messages||[]},get methodPath(){return r.request?.methodPath||null},get metadata(){return r.request?.metadata||[]},getHeaders(l){let c={};for(let[d,p]of Object.entries(e.headers))typeof p=="string"&&(c[d]=p);return c},addQueryParams(l){if(typeof l=="string"){let c=new URLSearchParams(l);for(let[d,p]of c)e.query||(e.query={}),e.query[d]=p}else Array.isArray(l)&&(e.query||(e.query={}),l.forEach(c=>{c.key&&(e.query[c.key]=c.value||"")}))},removeQueryParams(l){e.query&&(typeof l=="string"?delete e.query[l]:Array.isArray(l)&&l.forEach(c=>{let d=typeof c=="string"?c:c.key;d&&delete e.query[d]}))},authorizeUsing(l,c){r.request&&(typeof l=="string"?(r.request.auth||(r.request.auth={}),r.request.auth.type=l,c&&(r.request.auth.parameters=c)):typeof l=="object"&&(r.request.auth=l))},clone(){return{url:e.url,method:e.method,headers:{...e.headers},body:e.body?{...e.body}:null,params:e.params?{...e.params}:{},query:e.query?{...e.query}:{},auth:r.request?.auth,certificate:r.request?.certificate,description:r.request?.description,name:r.request?.name,id:r.request?.id,disabled:r.request?.disabled,metadata:r.request?.metadata,messages:r.request?.messages,methodPath:r.request?.methodPath}},describe(l,c){r.request&&(r.request.description={content:l,type:c||"text/plain"})},setHeader(l,c){e.headers[l]=c},addHeader(l,c){typeof l=="object"&&l!==null?e.headers[l.key]=l.value:e.headers[l]=c},removeHeader(l){delete e.headers[l]},setBody(l,c,d){e.body={type:c||e.body?.type||"raw",format:d||e.body?.format,content:l}}}}injectLegacyGlobals(e,r){let n=this.vmContext;if(!n)return;let i=this.initialContext,s=e==="test"&&r?.executedRequest?r.executedRequest:this.modifiedRequest,o={};for(let[b,E]of Object.entries(s?.headers||{}))typeof E=="string"&&(o[b]=E);let l=s?.body,c=l==null?null:typeof l=="object"&&"content"in l?l.content:l,d=i.request;if(n.request={id:d?.id??"",name:d?.name??"",description:d?.description??"",url:typeof s?.url=="string"?s.url:String(s?.url??""),method:s?.method??"GET",headers:o,data:c},n.environment=this._liveEnvironmentScope?.toObject?.()??{...this._environmentVariables},n.globals=this._liveGlobalsScope?.toObject?.()??{...this._globals},n.data={...i.iterationData||{}},typeof n.iteration!="number"&&(n.iteration=0),e!=="test"||!r)return;let p=r.body;n.responseBody=p==null?"":typeof p=="string"?p:JSON.stringify(p);let m=r.statusText||"";n.responseCode={code:r.status,name:m,detail:m},n.responseHeaders={...r.headers||{}},n.responseTime=r.responseTime??0,n.responseCookies=(r.cookies||[]).map(b=>({...b}));let y=this;n.tests=new Proxy({},{set(b,E,C){return y.assertions.push({name:String(E),passed:!!C,message:C?void 0:`"${String(E)}" was false`}),!0}})}async executePreRequest(e){let r=Rm(e,this.deps.isolateScripts);if(!r||!r.trim())return{success:!0};try{this.consoleMessages.length=0,this.injectLegacyGlobals("prerequest");let n=this.ctx.variables.replaceIn(r),i=this.deps.scriptTimeoutMs??5e3,s=n0.runInContext(n,this.vmContext,{timeout:i});this.deps.isolateScripts&&s&&typeof s.then=="function"&&await s,(await this.timerRegistry.drain(i)).timedOut&&this.consoleMessages.push({level:"warn",args:[`Script timed out after ${i}ms; pending async work was cancelled.`]});let l=Su(this.consoleMessages),c=this.initialContext.request.body,d=!this.bodiesEqual(this.modifiedRequest.body,c);return{success:!0,modifiedRequest:{url:this.modifiedRequest.url!==this.initialContext.request.url?this.modifiedRequest.url:void 0,headers:Uf(this.modifiedRequest.headers,this.initialContext.request.headers)?this.modifiedRequest.headers:void 0,body:d?this.modifiedRequest.body:void 0,params:Uf(this.modifiedRequest.params,this.initialContext.request.params||{})?this.modifiedRequest.params:void 0,query:Uf(this.modifiedRequest.query,this.initialContext.request.query||{})?this.modifiedRequest.query:void 0},modifiedVariables:this.ctx.variables.toObject(),localVariables:this.ctx.variables.toLocalObject?.()??{},modifiedCollectionVariables:this._liveCollectionScope?.toObject()||this._collectionVariables,modifiedGlobals:this._liveGlobalsScope?.toObject()||this._globals,modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,consoleOutput:l.length>0?l:void 0,nextRequest:this._nextRequest,skipRequest:this._skipRequest||void 0}}catch(n){let i=[...Su(this.consoleMessages),`[error] Script execution failed: ${n.message}`];return{success:!1,error:n.message||"Pre-request script execution failed",consoleOutput:i,modifiedVariables:this.ctx?.variables?.toObject(),localVariables:this.ctx?.variables?.toLocalObject?.()??{},modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,nextRequest:this._nextRequest,skipRequest:this._skipRequest||void 0}}}async executePostResponse(e,r){let n=Rm(e,this.deps.isolateScripts);if(!n||!n.trim())return{testResults:[],consoleOutput:[]};try{this.consoleMessages.length=0,this.assertions.length=0,this.ctx.info.eventName="test",this.ctx.response=wm(r),this.ctx.request=this.createRequestObject(r.executedRequest,this.initialContext),this.injectLegacyGlobals("test",r);let i=this.ctx.variables.replaceIn(n),s=this.deps.scriptTimeoutMs??5e3,o=n0.runInContext(i,this.vmContext,{timeout:s});this.deps.isolateScripts&&o&&typeof o.then=="function"&&await o,this.ctx.test._pendingTests?.length>0&&(await Promise.all(this.ctx.test._pendingTests),this.ctx.test._pendingTests.length=0),(await this.timerRegistry.drain(s)).timedOut&&this.consoleMessages.push({level:"warn",args:[`Script timed out after ${s}ms; pending async work was cancelled.`]});let c=Su(this.consoleMessages);return{testResults:[...this.assertions],consoleOutput:c.length>0?c:void 0,modifiedVariables:this.ctx?.variables?.toObject?.(),localVariables:this.ctx?.variables?.toLocalObject?.()??{},modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,modifiedGlobals:this._liveGlobalsScope?.toObject()||this._globals,modifiedCollectionVariables:this._liveCollectionScope?.toObject()||this._collectionVariables,nextRequest:this._nextRequest,visualizerData:this._visualizerData}}catch(i){this.assertions.push({name:"Script Execution",passed:!1,message:i.message||"Script execution failed"});let s=[...Su(this.consoleMessages),`[error] Script execution failed: ${i.message}`];return{testResults:[...this.assertions],consoleOutput:s,modifiedVariables:this.ctx?.variables?.toObject?.(),localVariables:this.ctx?.variables?.toLocalObject?.()??{},modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,modifiedGlobals:this._liveGlobalsScope?.toObject()||this._globals,modifiedCollectionVariables:this._liveCollectionScope?.toObject()||this._collectionVariables,nextRequest:this._nextRequest,visualizerData:this._visualizerData}}}bodiesEqual(e,r){return e===r||!e&&!r?!0:!e||!r?!1:e.type===r.type&&e.format===r.format&&JSON.stringify(e.content)===JSON.stringify(r.content)}dispose(){this.timerRegistry.clearAll(),this.vmContext=null,this.ctx=null,this.assertions=[]}}});import*as gr from"crypto";import*as fz from"querystring";import*as lP from"vm";function uP(t,e){if(t)return t.split(",").map(r=>{let n=r.trim();if(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))return n.slice(1,-1);let i=Number(n);if(!isNaN(i)&&n!=="")return i;if(e&&n in e){let s=e[n],o=Number(s);return!isNaN(o)&&s!==""?o:s}return n})}function cP(t){if(typeof t=="string"&&t.charCodeAt(0)===30)try{return JSON.parse(t.slice(1))}catch{return t}return t}function dz(t,e){if(t==="@")return"";if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);let r=t.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(r){let n=uP(r[2],e),i=ys(r[1],n);return i!==null?i:void 0}if(e[t]!==void 0)return cP(e[t]);if(ba(t)){let n=va(t,e),i=Ui(t,n);if(i!==void 0)return i}}function aP(t,e,r,n){let i=Buffer.concat([Buffer.from(t,"utf8"),n||Buffer.alloc(0)]),s=[],o=Buffer.alloc(0);for(;Buffer.concat(s).length<e+r;)o=gr.createHash("md5").update(Buffer.concat([o,i])).digest(),s.push(o);let l=Buffer.concat(s);return{key:l.subarray(0,e),iv:l.subarray(e,e+r)}}function s0(t,e,r){let n=i=>t==="aes"?`aes-${i*8}-cbc`:t==="des"?"des-cbc":t==="des-ede3"?"des-ede3-cbc":t;return{encrypt(i,s,o){let l=i instanceof Ze?i.toBuffer():Buffer.from(String(i),"utf8");if(typeof s=="string"){let c=gr.randomBytes(8),{key:d,iv:p}=aP(s,e,r,c),m=gr.createCipheriv(n(e),d,p),y=Buffer.concat([m.update(l),m.final()]),b=Buffer.concat([Buffer.from("Salted__"),c,y]);return{ciphertext:new Ze(y),salt:new Ze(c),toString:E=>E?E.stringify(new Ze(b)):b.toString("base64")}}else{let c=s.toBuffer(),d=o?.iv&&o.iv instanceof Ze?o.iv.toBuffer():Buffer.alloc(r),p=gr.createCipheriv(n(c.length),c,d);o?.padding===!1&&p.setAutoPadding(!1);let m=Buffer.concat([p.update(l),p.final()]);return{ciphertext:new Ze(m),toString:y=>y?y.stringify(new Ze(m)):m.toString("base64")}}},decrypt(i,s,o){if(typeof s=="string"){let l=typeof i=="string"?Buffer.from(i,"base64"):i.ciphertext.toBuffer(),c,d;l.subarray(0,8).toString()==="Salted__"?(d=l.subarray(8,16),c=l.subarray(16)):(d=Buffer.alloc(0),c=l);let{key:p,iv:m}=aP(s,e,r,d),y=gr.createDecipheriv(n(e),p,m);return new Ze(Buffer.concat([y.update(c),y.final()]))}else{let l=s.toBuffer(),c=o?.iv&&o.iv instanceof Ze?o.iv.toBuffer():Buffer.alloc(r),d=typeof i=="string"?Buffer.from(i,"base64"):i.ciphertext?i.ciphertext.toBuffer():Buffer.from(i),p=gr.createDecipheriv(n(l.length),l,c);return o?.padding===!1&&p.setAutoPadding(!1),new Ze(Buffer.concat([p.update(d),p.final()]))}}}}function pz(){let t=r=>n=>{let i=n instanceof Ze?n.toBuffer():Buffer.from(String(n),"utf8");return new Ze(gr.createHash(r).update(i).digest())},e=r=>(n,i)=>{let s=n instanceof Ze?n.toBuffer():Buffer.from(String(n),"utf8"),o=i instanceof Ze?i.toBuffer():Buffer.from(String(i),"utf8");return new Ze(gr.createHmac(r,o).update(s).digest())};return{MD5:t("md5"),SHA1:t("sha1"),SHA224:t("sha224"),SHA256:t("sha256"),SHA384:t("sha384"),SHA512:t("sha512"),SHA3:t("sha3-256"),RIPEMD160:t("ripemd160"),HmacMD5:e("md5"),HmacSHA1:e("sha1"),HmacSHA256:e("sha256"),HmacSHA512:e("sha512"),AES:s0("aes",32,16),DES:s0("des",8,8),TripleDES:s0("des-ede3",24,8),PBKDF2(r,n,i){let s=r instanceof Ze?r.toBuffer():Buffer.from(String(r),"utf8"),o=n instanceof Ze?n.toBuffer():Buffer.from(String(n),"utf8"),l=(i?.keySize||4)*4,c=i?.iterations||1;return new Ze(gr.pbkdf2Sync(s,o,c,l,"sha1"))},enc:{Base64:{stringify:r=>(r instanceof Ze?r.toBuffer():Buffer.from(String(r))).toString("base64"),parse:r=>Ze.fromBase64(r)},Utf8:{stringify:r=>(r instanceof Ze?r.toBuffer():Buffer.from(String(r))).toString("utf8"),parse:r=>Ze.fromUtf8(r)},Hex:{stringify:r=>(r instanceof Ze?r.toBuffer():Buffer.from(String(r))).toString("hex"),parse:r=>Ze.fromHex(r)},Latin1:{stringify:r=>(r instanceof Ze?r.toBuffer():Buffer.from(String(r))).toString("latin1"),parse:r=>new Ze(Buffer.from(r,"latin1"))},Utf16:{stringify:r=>(r instanceof Ze?r.toBuffer():Buffer.from(String(r))).toString("utf16le"),parse:r=>new Ze(Buffer.from(r,"utf16le"))},Utf16BE:{stringify:r=>(r instanceof Ze?r.toBuffer():Buffer.from(String(r))).swap16().toString("utf16le"),parse:r=>new Ze(Buffer.from(r,"utf16le").swap16())}},lib:{WordArray:{create:r=>r?typeof r=="string"?new Ze(Buffer.from(r,"utf8")):Buffer.isBuffer(r)?new Ze(r):new Ze(Buffer.from(String(r))):new Ze(Buffer.alloc(0)),random:r=>new Ze(gr.randomBytes(r))}},pad:{Pkcs7:{_name:"pkcs7"},NoPadding:{_name:"nopadding"},ZeroPadding:{_name:"zeropadding"}},mode:{CBC:{_name:"cbc"},ECB:{_name:"ecb"}}}}var Ze,Cs,Vf=ae(()=>{"use strict";$h();sf();Fh();e0();i0();_m();Ze=class t{_buffer;constructor(e){this._buffer=typeof e=="string"?Buffer.from(e,"utf8"):e}toString(e){return e?e.stringify(this):this._buffer.toString("hex")}toBuffer(){return this._buffer}static fromHex(e){return new t(Buffer.from(e,"hex"))}static fromBase64(e){return new t(Buffer.from(e,"base64"))}static fromUtf8(e){return new t(Buffer.from(e,"utf8"))}};Cs=class t{constructor(e,r=[],n,i="shared",s=5e3){this.httpService=e;this.secretRegistry=n;this.scopeMode=i;this.scriptTimeoutMs=s;this.moduleLoader=Xw(r)}httpService;secretRegistry;scopeMode;scriptTimeoutMs;moduleLoader;createRequestSession(e){return new Bf({createVM:this.createVM.bind(this),createCommonContext:this.createCommonContext.bind(this),isolateScripts:this.scopeMode==="isolated",scriptTimeoutMs:this.scriptTimeoutMs},e)}createVM(e,r,n){let i=this.moduleLoader.getGlobalSetupExports(),s=this.moduleLoader.createRequireFunction();e.require=s,e.vault=this.createVault();let o={ctx:e,hf:e,pm:e,console:r,...i||{},global:i,setTimeout:n?.setTimeout??setTimeout,setInterval:n?.setInterval??setInterval,clearTimeout:n?.clearTimeout??clearTimeout,clearInterval:n?.clearInterval??clearInterval,URL,URLSearchParams,Buffer,atob:l=>Buffer.from(l,"base64").toString("binary"),btoa:l=>Buffer.from(l,"binary").toString("base64"),TextEncoder,TextDecoder,crypto:gr,_:s("lodash"),require:s,moment:bm(),querystring:fz,CryptoJS:pz(),tv4:(()=>{try{return s("tv4")}catch{return}})(),postman:{setNextRequest:l=>e.setNextRequest?.(l),setGlobalVariable:(l,c)=>e.globals?.set(l,c),getGlobalVariable:l=>e.globals?.get(l),clearGlobalVariable:l=>e.globals?.unset(l),setEnvironmentVariable:(l,c)=>e.environment?.set(l,c),getEnvironmentVariable:l=>e.environment?.get(l),clearEnvironmentVariable:l=>e.environment?.unset(l),getResponseHeader:l=>{let c=e.response?.headers?.get?.(l);return c===void 0?null:c},getResponseCookie:l=>{let c=e.response?.cookies;if(c&&typeof c[Symbol.iterator]=="function"){for(let d of c)if(d?.name&&d.name.toLowerCase()===l.toLowerCase())return{...d}}return null}},jsonStringify:(l,c,d)=>JSON.stringify(l,c,d),jsonParse:l=>JSON.parse(l),xml2Json:l=>{try{let c=this.moduleLoader.createRequireFunction()("xml2js"),d;return c.parseString(l,{explicitArray:!1},(p,m)=>{if(p)throw p;d=m}),d}catch{throw new Error("xml2Json() requires the xml2js module. Add it to your modules/package.json and run npm install.")}}};return lP.createContext(o)}createCommonContext(e,r){let n={...e.variables},i={...e.collectionVariables||{}},s={...e.globals||{}},o={...e.environmentVariables||{}},l=e.iterationData||{},c=this.createMergedVariableScope(n,o,i,s,l),d=this.createGlobalsScope(s,e.onGlobalsChange),p=this.createVariableScope(i),m=this.createEnvironmentScope(o,e.environmentName,e.onEnvironmentChange,!0),y={...m,set:(C,v)=>{let _=this.serializeValue(v);m.set(C,_),n[C]=_},unset(C){m.unset(C),delete n[C]},clear(){let C=Object.keys(o);m.clear();for(let v of C)delete n[v]}},b={...d,set:(C,v)=>{let _=this.serializeValue(v);d.set(C,_),n[C]=_},unset(C){d.unset(C),delete n[C]},clear(){let C=Object.keys(s);d.clear();for(let v of C)delete n[v]}};return b.replaceIn=c.replaceIn,p.replaceIn=c.replaceIn,y.replaceIn=c.replaceIn,{globals:b,collectionVariables:p,variables:c,environment:y,iterationData:{get:C=>l[C],has:C=>C in l,toObject:()=>({...l}),toJSON:()=>JSON.stringify(l)},sendRequest:this.createSendRequest(),expect:bu,info:e.info||{eventName:r,requestName:void 0,requestId:void 0}}}static JSON_TYPE_MARKER="";serializeValue(e){return typeof e=="string"?e:t.JSON_TYPE_MARKER+JSON.stringify(e)}deserializeValue(e){if(e!==void 0){if(typeof e=="string"&&e.charCodeAt(0)===30)try{return JSON.parse(e.slice(1))}catch{}return e}}createVariableScope(e){return{get:r=>this.deserializeValue(e[r]),set:(r,n)=>{e[r]=this.serializeValue(n)},has(r){return r in e},unset(r){delete e[r]},clear(){Object.keys(e).forEach(r=>delete e[r])},toObject(){return{...e}}}}createGlobalsScope(e,r){let n=(i,s,o)=>{r&&r(i,s,o)};return{get:i=>this.deserializeValue(e[i]),set:(i,s)=>{let o=this.serializeValue(s);e[i]=o,n("set",i,o)},has(i){return i in e},unset(i){delete e[i],n("unset",i)},clear(){Object.keys(e).forEach(i=>delete e[i]),n("clear")},toObject(){return{...e}}}}createMergedVariableScope(e,r,n,i,s={}){let o={get:l=>l in e?this.deserializeValue(e[l]):l in s?s[l]:l in r?this.deserializeValue(r[l]):l in n?this.deserializeValue(n[l]):this.deserializeValue(i[l]),set:(l,c)=>{e[l]=this.serializeValue(c)},has(l){return l in e||l in s||l in r||l in r||l in n||l in i},unset(l){delete e[l]},clear(){Object.keys(e).forEach(l=>delete e[l])},toObject(){return{...i,...n,...r,...s,...e}},toLocalObject(){return{...n,...r,...s,...e}},replaceIn(l){if(!l||typeof l!="string")return l;let c=o.toObject(),d=20,p=y=>y.replace(/\{\{([^}]+)\}\}/g,(b,E)=>{let C=E.trim(),v=C.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(v)try{let k=uP(v[2],c),O=ys(v[1],k);return O!==null?String(O):b}catch{return b}let _=af(C);if(_){let k=dz(_.input,c);if(k!==void 0){let O=lf(k,_.filters,c);return O!==void 0?String(O):b}return b}let q=o.get(C);if(q!==void 0)return String(q);if(ba(C)){let k={};for(let[j,I]of Object.entries(c))k[j]=cP(I);let O=va(C,k),M=Ui(C,O);if(M!==void 0)return String(M)}return b}),m=l;for(let y=0;y<d;y++){let b=p(m);if(b===m)break;m=b}return m}};return o}createEnvironmentScope(e,r,n,i){let s=(o,l,c)=>{n&&(i?n(o,l,c):n(l||"",o==="set"?c:void 0))};return{name:r||"",get:o=>this.deserializeValue(e[o]),set:(o,l)=>{let c=this.serializeValue(l);e[o]=c,s("set",o,c)},has(o){return o in e},unset(o){delete e[o],s("unset",o)},clear(){Object.keys(e).forEach(o=>delete e[o]),s("clear")},toObject(){return{...e}}}}createVault(){let e=this.secretRegistry,r=()=>{throw new Error("pm.vault is read-only in HTTP Forge. Use environment variables or {{secret:provider/path}} tokens to manage secrets.")};return{async get(n){if(!e)throw new Error('pm.vault is not available \u2014 no secret providers are configured. Configure a provider under "secrets.providers" to use pm.vault.get().');let i=`secret:${n}`;return(await e.resolveSecretTokens(`{{${i}}}`))[i]},set:r,unset:r}}createSendRequest(){return this.httpService?(e,r)=>{let n=typeof e=="string"?{url:e,method:"GET"}:e,i=this.httpService.execute({url:n.url,method:n.method||"GET",headers:n.headers||{},body:n.body,...n});if(r){i.then(s=>r(null,s)).catch(s=>r(s,null));return}return i}:(e,r)=>{let n=new Error("sendRequest not available - HTTP service not configured");if(r){r(n,null);return}return Promise.reject(n)}}}});import*as dP from"fs";import*as mz from"http";import*as o0 from"https";import*as xm from"path";import{URL as fP}from"url";import*as Em from"zlib";var wn,Na,Jf=ae(()=>{"use strict";wn={timeout:3e4,followRedirects:!0,followOriginalMethod:!1,followAuthHeader:!1,maxRedirects:10,strictSSL:!0,decompress:!0,includeCookies:!1,tls:{},certificates:[]},Na=class{settings;version;basePath;constructor(e,r=process.cwd()){this.settings={...wn,...e},this.basePath=r;try{this.version=_t("../../package.json").version||"0.0.0"}catch{this.version="0.0.0"}this.settings.strictSSL===!1&&console.log("[NodeHttpClient] SSL verification disabled (strictSSL: false)")}async send(e){let r=this.mergeSettings(e.settings);return await this.executeInternal(e,r,0)}mergeSettings(e){return{timeout:e?.timeout??this.settings.timeout,followRedirects:e?.followRedirects??this.settings.followRedirects,followOriginalMethod:e?.followOriginalMethod??this.settings.followOriginalMethod,followAuthHeader:e?.followAuthHeader??this.settings.followAuthHeader,maxRedirects:e?.maxRedirects??this.settings.maxRedirects,strictSSL:e?.strictSSL??this.settings.strictSSL,decompress:e?.decompress??this.settings.decompress,includeCookies:e?.includeCookies??this.settings.includeCookies,tls:e?.tls??this.settings.tls??{},certificates:e?.certificates??this.settings.certificates??[]}}async executeInternal(e,r,n,i){let s=Date.now(),o=new fP(e.url),l=o.protocol==="https:",c=this.sanitizeHeaders(e.headers||{});Object.keys(c).some(m=>m.toLowerCase()==="user-agent")||(c["User-Agent"]=`HttpForge/${this.version}`);let p={hostname:o.hostname,port:o.port||(l?443:80),path:o.pathname+o.search,method:e.method,headers:{...c},timeout:r.timeout||void 0};if(r.decompress&&!c["accept-encoding"]&&!c["Accept-Encoding"]&&(p.headers["Accept-Encoding"]="gzip, deflate"),l){let m=this.resolveTlsSettings(o,r),y=p;y.rejectUnauthorized=r.strictSSL;let b={rejectUnauthorized:r.strictSSL},E=this.readOptionalFile(m.caPath,"CA certificate");E&&(b.ca=E);let C=this.readOptionalFile(m.certPath,"client certificate");C&&(b.cert=C);let v=this.readOptionalFile(m.keyPath,"client private key");v&&(b.key=v);let _=this.readOptionalFile(m.pfxPath,"client pfx");_&&(b.pfx=_),m.passphrase&&(b.passphrase=m.passphrase),m.servername&&(y.servername=m.servername),y.agent=new o0.Agent(b)}return new Promise((m,y)=>{if(i?.aborted){let C=new Error("Request cancelled");C.name="AbortError",y(C);return}let E=(l?o0:mz).request(p,async C=>{let v=C.statusCode||0;if(r.followRedirects&&[301,302,303,307,308].includes(v)){if(n>=r.maxRedirects){y(new Error(`Maximum redirects (${r.maxRedirects}) exceeded`));return}let q=C.headers.location;if(!q){y(new Error("Redirect response missing Location header"));return}let k=new fP(q,e.url).toString(),O=e.method;!r.followOriginalMethod&&[301,302,303].includes(v)&&(O="GET");let M={...e.headers};r.followAuthHeader||(delete M.authorization,delete M.Authorization);try{let j=await this.executeInternal({...e,url:k,method:O,headers:M,body:O==="GET"?void 0:e.body},r,n+1,i),I=Date.now();j.time=I-s,m(j)}catch(j){y(j)}return}let _=[];C.on("data",q=>_.push(q)),C.on("end",()=>{let q=Date.now(),k=Buffer.concat(_),O=C.headers["content-encoding"];if(r.decompress&&O)try{O==="gzip"?k=Em.gunzipSync(k):O==="deflate"&&(k=Em.inflateSync(k))}catch(R){console.warn("[NodeHttpClient] Decompression failed:",R)}let M=k.toString("utf-8"),j={};for(let[R,A]of Object.entries(C.headers))(typeof A=="string"||Array.isArray(A))&&(j[R]=A);let I=this.parseCookies(C.headers["set-cookie"],o.hostname);m({status:C.statusCode||0,statusText:C.statusMessage||"",headers:j,cookies:I,body:M,time:q-s,size:k.length})})});if(i&&i.addEventListener("abort",()=>{E.destroy();let C=new Error("Request cancelled");C.name="AbortError",y(C)}),E.on("error",C=>{y(C)}),E.on("timeout",()=>{E.destroy(),y(new Error("Request timeout"))}),e.body!==void 0&&e.body!==null){let C=typeof e.body=="string"?e.body:JSON.stringify(e.body);E.write(C)}E.end()})}resolveTlsSettings(e,r){let n=r.tls||{};if(!!(n.caPath||n.certPath||n.keyPath||n.pfxPath||n.servername||n.passphrase))return n;let s=this.findCertificateMapping(e,r.certificates||[]);return s?{caPath:s.caPath,certPath:s.certPath,keyPath:s.keyPath,pfxPath:s.pfxPath,passphrase:s.passphrase,servername:s.servername}:n}findCertificateMapping(e,r){if(!Array.isArray(r)||r.length===0)return;let n=e.hostname,i=e.port?Number(e.port):443,s=r.find(o=>this.mappingMatchesHost(o,n,i,!0));return s||r.find(o=>this.mappingMatchesHost(o,n,i,!1))}mappingMatchesHost(e,r,n,i){if(!e||e.enabled===!1)return!1;let s=String(e.host||"").trim().toLowerCase();if(!s||e.port!=null&&Number(e.port)!==n)return!1;let o=r.toLowerCase();if(i)return s!=="*"&&!s.startsWith("*.")&&o===s;if(s==="*")return!0;if(s.startsWith("*.")){let l=s.slice(2);return o===l||o.endsWith(`.${l}`)}return o===s}readOptionalFile(e,r){if(!e)return;let n=xm.isAbsolute(e)?e:xm.resolve(this.basePath,e);try{return dP.readFileSync(n)}catch(i){throw new Error(`[NodeHttpClient] Failed to read ${r} file at ${n}: ${i?.message||"Unknown error"}`)}}sanitizeHeaderValue(e){return e?String(e).replace(/[\u201C\u201D\u201E\u201F\u2033\u2036]/g,'"').replace(/[\u2018\u2019\u201A\u201B\u2032\u2035]/g,"'").replace(/[\x00-\x08\x0A-\x1F\x7F]/g,""):""}sanitizeHeaders(e){let r={};for(let[n,i]of Object.entries(e))r[n]=this.sanitizeHeaderValue(String(i));return r}parseCookies(e,r){return e?e.map(n=>{let i=n.split(";").map(p=>p.trim()),[s,...o]=i,[l,c]=s.split("="),d={name:l.trim(),value:c?.trim()||"",domain:r};for(let p of o){let[m,y]=p.split("=");switch(m.toLowerCase().trim()){case"domain":d.domain=y?.trim();break;case"path":d.path=y?.trim();break;case"expires":d.expires=y?.trim();break;case"httponly":d.httpOnly=!0;break;case"secure":d.secure=!0;break}}return d}):[]}}});var a0,Ma,qm=ae(()=>{"use strict";a0={json:"application/json",xml:"application/xml",html:"text/html",text:"text/plain",javascript:"application/javascript",css:"text/css","x-www-form-urlencoded":"application/x-www-form-urlencoded","form-data":"multipart/form-data",graphql:"application/json"},Ma=class{sanitizeHeaderValue(e){return e?String(e).replace(/[\u201C\u201D\u201E\u201F\u2033\u2036]/g,'"').replace(/[\u2018\u2019\u201A\u201B\u2032\u2035]/g,"'").replace(/[\x00-\x08\x0A-\x1F\x7F]/g,""):""}sanitizeHeaders(e){let r={};for(let[n,i]of Object.entries(e))r[n]=this.sanitizeHeaderValue(String(i));return r}encodeBody(e){if(!e||e.type==="none")return null;let{type:r,content:n}=e;switch(r){case"x-www-form-urlencoded":return this.encodeUrlEncodedBody(n);case"form-data":return n;case"graphql":return this.encodeGraphQLBody(n);case"raw":return n;default:return n}}encodeUrlEncodedBody(e){if(Array.isArray(e)){let r=new URLSearchParams;for(let n of e)n.enabled!==!1&&n.key&&r.append(n.key,n.value||"");return r.toString()}return typeof e=="string"?e:String(e)}encodeGraphQLBody(e){if(typeof e=="string")try{e=JSON.parse(e)}catch{return e}if(typeof e=="object"&&e!==null&&e.query){let r=e.variables;if(typeof r=="string")try{r=r.trim()?JSON.parse(r):void 0}catch{r=void 0}return JSON.stringify({query:e.query,...r!=null?{variables:r}:{},...e.operationName?{operationName:e.operationName}:{}})}return JSON.stringify(e)}setContentTypeHeader(e,r,n){if(Object.keys(e).some(o=>o.toLowerCase()==="content-type"))return;if(n){e["Content-Type"]=n;return}if(!r||r.type==="none")return;let s;switch(r.type){case"x-www-form-urlencoded":s=a0["x-www-form-urlencoded"];break;case"raw":s=r.format?a0[r.format]:"text/plain",s||(s="text/plain");break;case"graphql":s=a0.graphql;break;case"binary":s="application/octet-stream";break}s&&(e["Content-Type"]=s)}}});var Da,Om=ae(()=>{"use strict";Da=class{parse(e,r){return r.toLowerCase().endsWith(".json")?this.parseJson(e):this.parseCsv(e)}parseJson(e){try{let r=JSON.parse(e);return Array.isArray(r)?r:[r]}catch{throw new Error("Failed to parse JSON data file: Invalid JSON format")}}parseCsv(e){let r=e.split(/\r?\n/).filter(s=>s.trim());if(r.length<2)return[{}];let n=this.parseCsvLine(r[0]),i=[];for(let s=1;s<r.length;s++){let o=this.parseCsvLine(r[s]),l={};n.forEach((c,d)=>{l[c]=o[d]||""}),i.push(l)}return i}parseCsvLine(e){let r=[],n="",i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=e[s+1];o==='"'?i&&l==='"'?(n+='"',s++):i=!i:o===","&&!i?(r.push(n.trim()),n=""):n+=o}return r.push(n.trim()),r}}});import*as Ru from"crypto";var gz,Yf,u0=ae(()=>{"use strict";gz=3e4,Yf=class{constructor(e,r,n,i,s="henry-huang.http-forge/oauth2/callback"){this.secretStore=e;this.browserService=r;this.envConfigService=n;this.httpService=i;this.callbackPath=s}secretStore;browserService;envConfigService;httpService;callbackPath;tokenCache=new Map;pendingAuthCallback=null;pendingImplicitCallback=null;async getToken(e,r){if(e.accessToken)return{accessToken:this.resolve(e.accessToken,r),tokenType:e.tokenPrefix||"Bearer",raw:{}};let n=this.buildCacheKeyString(e),i=this.tokenCache.get(n);if(i&&!this.isExpired(i))return i;if(i?.refreshToken)try{return await this.refreshToken(e,i.refreshToken,r)}catch{this.tokenCache.delete(n)}if(!i){let o=await this.secretStore.get(`oauth2_refresh_${n}`);if(o)try{return await this.refreshToken(e,o,r)}catch{await this.secretStore.delete(`oauth2_refresh_${n}`)}}let s;switch(e.grantType){case"client_credentials":s=await this.fetchToken(e,r,"client_credentials");break;case"password":s=await this.fetchToken(e,r,"password");break;case"authorization_code":s=await this.authorizationCodeFlow(e,r);break;case"implicit":s=await this.implicitFlow(e,r);break;default:throw new Error(`Unknown OAuth2 grant type: ${e.grantType}`)}return this.tokenCache.set(n,s),s.refreshToken&&await this.storeRefreshToken(n,s.refreshToken),s}async refreshToken(e,r,n){let i=this.resolve(e.tokenUrl||"",n);if(!i)throw new Error("OAuth2 tokenUrl is required for token refresh");let s=this.resolve(e.clientId||"",n),o=this.resolve(e.clientSecret||"",n),l=new URLSearchParams;l.append("grant_type","refresh_token"),l.append("refresh_token",r);let c={"Content-Type":"application/x-www-form-urlencoded"};this.applyClientAuth(e,c,l,s,o,n);let d=await this.httpService.execute({method:"POST",url:i,headers:c,body:l.toString()}),p=this.parseTokenResponse(d.body,e);p.refreshToken||(p.refreshToken=r);let m=this.buildCacheKeyString(e);return this.tokenCache.set(m,p),p.refreshToken&&await this.storeRefreshToken(m,p.refreshToken),p}async authorizationCodeFlow(e,r){let n=this.resolve(e.authUrl||"",r),i=this.resolve(e.tokenUrl||"",r),s=this.resolve(e.clientId||"",r),o=this.resolve(e.clientSecret||"",r),l=e.scope?this.resolve(e.scope,r):void 0;if(!n)throw new Error("OAuth2 authUrl is required for authorization code flow");if(!i)throw new Error("OAuth2 tokenUrl is required for authorization code flow");if(!s)throw new Error("OAuth2 clientId is required for authorization code flow");let c=e.usePkce!==!1,d,p,m;if(c){d=this.generateCodeVerifier();let j=e.pkceMethod||"S256";p=j==="S256"?this.generateCodeChallengeS256(d):d,m=j}let y=e.state||Ru.randomBytes(16).toString("hex"),b=await this.getCallbackUri(),E=new URL(n);if(E.searchParams.set("response_type","code"),E.searchParams.set("client_id",s),E.searchParams.set("redirect_uri",b),l&&E.searchParams.set("scope",l),E.searchParams.set("state",y),p&&(E.searchParams.set("code_challenge",p),E.searchParams.set("code_challenge_method",m)),e.audience&&E.searchParams.set("audience",this.resolve(e.audience,r)),e.resource&&E.searchParams.set("resource",this.resolve(e.resource,r)),e.extraParams)for(let[j,I]of Object.entries(e.extraParams))E.searchParams.set(j,this.resolve(I,r));this.pendingAuthCallback&&(this.pendingAuthCallback.reject(new Error("OAuth2 authorization superseded by a new request")),this.pendingAuthCallback=null);let C=new Promise((j,I)=>{this.pendingAuthCallback={resolve:j,reject:I,state:y}});await this.browserService.openExternal(E.toString());let v;try{v=await Promise.race([C,new Promise((j,I)=>setTimeout(()=>{this.pendingAuthCallback=null,I(new Error("OAuth2 authorization timed out after 2 minutes"))},12e4))])}finally{this.pendingAuthCallback=null}if(v.state&&v.state!==y)throw new Error("OAuth2 state mismatch \u2014 potential CSRF attack");let _=new URLSearchParams;_.append("grant_type","authorization_code"),_.append("code",v.code),_.append("redirect_uri",b),d&&_.append("code_verifier",d);let q={"Content-Type":"application/x-www-form-urlencoded"};this.applyClientAuth(e,q,_,s,o,r);let k=await this.httpService.execute({method:"POST",url:i,headers:q,body:_.toString()}),O=this.parseTokenResponse(k.body,e),M=this.buildCacheKeyString(e);return this.tokenCache.set(M,O),O.refreshToken&&await this.storeRefreshToken(M,O.refreshToken),O}async implicitFlow(e,r){let n=this.resolve(e.authUrl||"",r),i=this.resolve(e.clientId||"",r),s=e.scope?this.resolve(e.scope,r):void 0;if(!n)throw new Error("OAuth2 authUrl is required for implicit flow");if(!i)throw new Error("OAuth2 clientId is required for implicit flow");let o=e.state||Ru.randomBytes(16).toString("hex"),l=await this.getCallbackUri(),c=new URL(n);if(c.searchParams.set("response_type","token"),c.searchParams.set("client_id",i),c.searchParams.set("redirect_uri",l),s&&c.searchParams.set("scope",s),c.searchParams.set("state",o),e.audience&&c.searchParams.set("audience",this.resolve(e.audience,r)),e.resource&&c.searchParams.set("resource",this.resolve(e.resource,r)),e.extraParams)for(let[b,E]of Object.entries(e.extraParams))c.searchParams.set(b,this.resolve(E,r));this.pendingImplicitCallback&&(this.pendingImplicitCallback.reject(new Error("OAuth2 implicit flow superseded by a new request")),this.pendingImplicitCallback=null);let d=new Promise((b,E)=>{this.pendingImplicitCallback={resolve:b,reject:E,state:o}});await this.browserService.openExternal(c.toString());let p;try{p=await Promise.race([d,new Promise((b,E)=>setTimeout(()=>{this.pendingImplicitCallback=null,E(new Error("OAuth2 implicit flow timed out after 2 minutes"))},12e4))])}finally{this.pendingImplicitCallback=null}if(p.state&&p.state!==o)throw new Error("OAuth2 state mismatch \u2014 potential CSRF attack");let m={accessToken:p.accessToken,tokenType:p.tokenType||e.tokenPrefix||"Bearer",expiresAt:p.expiresIn?Date.now()+p.expiresIn*1e3:void 0,raw:{access_token:p.accessToken,token_type:p.tokenType,expires_in:p.expiresIn}},y=this.buildCacheKeyString(e);return this.tokenCache.set(y,m),m}handleAuthorizationCallback(e,r,n){if(n){let i=new Error(`OAuth2 authorization error: ${n}`);this.pendingAuthCallback?.reject(i),this.pendingImplicitCallback?.reject(i),this.pendingAuthCallback=null,this.pendingImplicitCallback=null;return}if(e&&this.pendingAuthCallback){this.pendingAuthCallback.resolve({code:e,state:r}),this.pendingAuthCallback=null;return}!e&&!this.pendingAuthCallback&&this.pendingImplicitCallback&&(this.pendingImplicitCallback.reject(new Error("OAuth2 implicit flow did not receive access_token")),this.pendingImplicitCallback=null)}handleImplicitCallback(e,r,n,i){this.pendingImplicitCallback&&(this.pendingImplicitCallback.resolve({accessToken:e,tokenType:r,expiresIn:n,state:i}),this.pendingImplicitCallback=null)}clearToken(e){let r=`${e.tokenUrl}|${e.clientId}|${e.scope||""}|${e.grantType}`;this.tokenCache.delete(r),this.secretStore.delete(`oauth2_refresh_${r}`)}clearAllTokens(){for(let e of this.tokenCache.keys())this.secretStore.delete(`oauth2_refresh_${e}`);this.tokenCache.clear()}async fetchToken(e,r,n){let i=this.resolve(e.tokenUrl||"",r);if(!i)throw new Error("OAuth2 tokenUrl is required");let s=this.resolve(e.clientId||"",r),o=this.resolve(e.clientSecret||"",r),l=e.scope?this.resolve(e.scope,r):void 0,c=new URLSearchParams;if(c.append("grant_type",n),l&&c.append("scope",l),n==="password"){let m=this.resolve(e.username||"",r),y=this.resolve(e.password||"",r);if(!m)throw new Error("OAuth2 password grant requires username");c.append("username",m),c.append("password",y)}if(e.audience&&c.append("audience",this.resolve(e.audience,r)),e.resource&&c.append("resource",this.resolve(e.resource,r)),e.extraParams)for(let[m,y]of Object.entries(e.extraParams))c.append(m,this.resolve(y,r));let d={"Content-Type":"application/x-www-form-urlencoded"};this.applyClientAuth(e,d,c,s,o,r);let p=await this.httpService.execute({method:"POST",url:i,headers:d,body:c.toString()});return this.parseTokenResponse(p.body,e)}applyClientAuth(e,r,n,i,s,o){if(e.clientAuthentication==="header"){let l=Buffer.from(`${i}:${s}`).toString("base64");r.Authorization=`Basic ${l}`}else i&&n.set("client_id",i),s&&n.set("client_secret",s)}parseTokenResponse(e,r){let n=e;if(typeof n=="string")try{n=JSON.parse(n)}catch{throw new Error("OAuth2 token response is not valid JSON")}if(!n||typeof n!="object")throw new Error("OAuth2 token response is not a valid JSON object");let i=n,s=r.tokenField||"access_token",o=i[s];if(!o)throw new Error(`OAuth2 token fetch failed: '${s}' not present in response`);let l=typeof i.expires_in=="number"?i.expires_in:void 0;return{accessToken:o,tokenType:i.token_type||r.tokenPrefix||"Bearer",expiresAt:l?Date.now()+l*1e3:void 0,refreshToken:i.refresh_token,scope:i.scope,raw:i}}isExpired(e){return e.expiresAt?Date.now()>=e.expiresAt-gz:!1}buildCacheKeyString(e){return`${e.tokenUrl||""}|${e.clientId||""}|${e.scope||""}|${e.grantType}`}async getCallbackUri(){let e=`${this.browserService.uriScheme}://${this.callbackPath}`;return this.browserService.asExternalUri(e)}resolve(e,r){return this.envConfigService.resolveVariables(e,r)}generateCodeVerifier(){return Ru.randomBytes(32).toString("base64url")}generateCodeChallengeS256(e){return Ru.createHash("sha256").update(e).digest("base64url")}async storeRefreshToken(e,r){try{await this.secretStore.store(`oauth2_refresh_${e}`,r)}catch{}}}});import*as ja from"fs";import*as go from"path";function Cu(t,e={}){let r=[];Object.entries(e).forEach(([n,i])=>{r.push(`${n}=${i}`)}),r.length&&ja.writeFileSync(t,r.join(`
|
|
52
|
+
`)}function Uf(t,e){return JSON.stringify(t)!==JSON.stringify(e)}function Su(t){return t.map(e=>{let r=e.args.map(n=>{if(typeof n=="object")try{return JSON.stringify(n,null,2)}catch{return String(n)}return String(n)}).join(" ");return`[${e.level}] ${r}`})}function uz(t){return{log:(...e)=>t.push({level:"log",args:e}),info:(...e)=>t.push({level:"info",args:e}),warn:(...e)=>t.push({level:"warn",args:e}),error:(...e)=>t.push({level:"error",args:e})}}function t0(t){let e=[],r=(n,i)=>{try{let s=i();if(s&&typeof s.then=="function"){let o=s.then(()=>{t.push({name:n,passed:!0})},l=>{t.push({name:n,passed:!1,message:l.message||String(l)})});e.push(o)}else t.push({name:n,passed:!0})}catch(s){t.push({name:n,passed:!1,message:s.message})}};return r.skip=(n,i)=>{t.push({name:n,passed:!0,skipped:!0})},r.fail=n=>{t.push({name:n||"Failed test",passed:!1,message:n||"pm.test.fail()"})},r.index=()=>t.length,r._pendingTests=e,r}function r0(t){let e={};for(let[r,n]of Object.entries(t))e[r]=Array.isArray(n)?n.join(", "):n;return e}function Cm(t,e,r){let n;if(r)try{n=new URL(r).hostname}catch{n=void 0}let i=xt.parseCookieHeaders(t||{},n);return i.length>0?i:Array.isArray(e)&&e.length>0?e.filter(s=>s&&s.name).map(s=>({name:s.name,value:s.value,domain:s.domain??n,path:s.path,expires:s.expires,maxAge:s.maxAge,httpOnly:s.httpOnly,secure:s.secure,sameSite:s.sameSite})):[]}var Hf=ae(()=>{"use strict";ga()});import*as n0 from"vm";function cz(t){let e=null;try{e=new URL(t)}catch{}return{toString(){return t},valueOf(){return t},[Symbol.toPrimitive](n){return n==="number"?NaN:t},getHost(){return e?e.hostname:""},getPath(){return e?e.pathname:t},getPathWithQuery(){return e?e.pathname+e.search:t},getQueryString(){return e?e.search.startsWith("?")?e.search.slice(1):e.search:""},getRemote(){if(!e)return"";let n=e.port||(e.protocol==="https:"?"443":"80");return`${e.hostname}:${n}`},getOAuth1BaseUrl(){return e?`${e.protocol}//${e.host}${e.pathname}`:t},get protocol(){return e?.protocol?.replace(":","")||""},get host(){return e?e.hostname.split("."):[]},get port(){return e?.port||""},get path(){return e?e.pathname.split("/").filter(Boolean):[]},get hash(){return e?.hash?.replace("#","")||""},query:{toObject(){if(!e)return{};let n={};return e.searchParams.forEach((i,s)=>{n[s]=i}),n},has(n){return e?e.searchParams.has(n):!1},get(n){return e?e.searchParams.get(n):void 0},each(n){e&&e.searchParams.forEach((i,s)=>n({key:s,value:i}))}}}}var Bf,i0=ae(()=>{"use strict";sP();_m();Hf();Bf=class{constructor(e,r){this.deps=e;this.initialContext=r;this.timerRegistry=iP(n=>{let i=n instanceof Error?n.message:String(n);this.consoleMessages.push({level:"error",args:[`Uncaught error in async callback: ${i}`]})}),this.initializeSession()}deps;initialContext;vmContext=null;ctx=null;modifiedRequest=null;assertions=[];consoleMessages=[];_variables={};_collectionVariables={};_globals={};_environmentVariables={};_liveEnvironmentScope=null;_liveGlobalsScope=null;_liveCollectionScope=null;_nextRequest=void 0;_skipRequest=!1;_visualizerData=void 0;timerRegistry;initializeSession(){this.modifiedRequest={url:this.initialContext.request.url,method:this.initialContext.request.method,headers:{...this.initialContext.request.headers},body:this.initialContext.request.body?{...this.initialContext.request.body}:null,params:this.initialContext.request.params?{...this.initialContext.request.params}:{},query:this.initialContext.request.query?{...this.initialContext.request.query}:{}},this.assertions=[],this.ctx=this.createSharedContext(),this.consoleMessages=[];let e=this,r={log:(...n)=>{e.consoleMessages.push({level:"log",args:n})},info:(...n)=>{e.consoleMessages.push({level:"info",args:n})},warn:(...n)=>{e.consoleMessages.push({level:"warn",args:n})},error:(...n)=>{e.consoleMessages.push({level:"error",args:n})}};this.vmContext=this.deps.createVM(this.ctx,r,this.timerRegistry.timers)}createSharedContext(){let e=this.initialContext,r=this.modifiedRequest,n=this.deps.createCommonContext(e,"prerequest");this._variables={...e.variables},this._collectionVariables={...e.collectionVariables||{}},this._globals={...e.globals||{}},this._environmentVariables={...e.environmentVariables||{}},this._liveEnvironmentScope=n.environment,this._liveGlobalsScope=n.globals,this._liveCollectionScope=n.collectionVariables;let i;try{i=new URL(e.request.url).hostname}catch{}let s={get:l=>e.cookieJar?e.cookieJar.get(l,i)?.value:void 0,set:(l,c)=>{e.cookieJar&&e.cookieJar.set({name:l,value:c,domain:i})},has:l=>e.cookieJar?e.cookieJar.has(l,i):!1,list:()=>e.cookieJar?e.cookieJar.getAll(i).map(l=>({name:l.name,value:l.value})):[],toObject:()=>{if(!e.cookieJar)return{};let l=e.cookieJar.getAll(i),c={};for(let d of l)c[d.name]=d.value;return c},jar:()=>{let l=e.cookieJar,c=d=>{if(d==null)return;let p=typeof d=="string"?d:typeof d=="object"||typeof d=="number"||typeof d=="boolean"?String(d):void 0;if(!p)return;let m=p.trim();if(m)try{return new URL(m).hostname}catch{return m}};return{getAll(d,p){try{if(!l){p(null,[]);return}let m=c(d),y=l.getAll(m).map(b=>({name:b.name,value:b.value,domain:b.domain,path:b.path,httpOnly:b.httpOnly,secure:b.secure}));p(null,y)}catch(m){p(m,[])}},get(d,p,m){try{if(!l){m(null,void 0);return}let y=c(d),b=l.get(p,y);m(null,b?{name:b.name,value:b.value,domain:b.domain}:void 0)}catch(y){m(y,void 0)}},set(d,p,m,y){try{if(!l){(y||m)?.(null);return}let b=c(d);typeof p=="string"&&typeof m=="string"?(l.set({name:p,value:m,domain:b}),y?.(null)):typeof p=="object"&&(l.set({...p,domain:b}),m?.(null))}catch(b){(y||m)?.(b)}},unset(d,p,m){try{if(!l){m?.(null);return}let y=c(d);l.delete(p,y),m?.(null)}catch(y){m?.(y)}},clear(d,p){try{let m=typeof d=="function"?d:p;if(!l){m?.(null);return}let y=typeof d=="function"?void 0:c(d);y&&typeof l.clearDomain=="function"?l.clearDomain(y):l.clear(),m?.(null)}catch(m){(typeof d=="function"?d:p)?.(m)}}}},remove:l=>{e.cookieJar&&e.cookieJar.delete(l,i)},unset:l=>{e.cookieJar&&e.cookieJar.delete(l,i)},clear:()=>{e.cookieJar&&e.cookieJar.clear()}},o=this;return{request:this.createRequestObject(r,e),response:null,test:t0(this.assertions),expect:bu,cookies:s,execution:{setNextRequest(l){o._nextRequest=l},skipRequest(){o._skipRequest=!0},runRequest(l,c){let p=(async()=>{if(typeof n.sendRequest!="function")throw new Error("pm.execution.runRequest is not available \u2014 HTTP service not configured.");let m=typeof l=="string"?{url:l,method:"GET"}:l,y=await n.sendRequest(m),b=Array.isArray(y?.cookies)?y.cookies.filter(v=>v?.name):[],q=y?.body,C=0;if(typeof q=="string")C=Buffer.byteLength(q,"utf8");else if(Buffer.isBuffer(q))C=q.length;else if(q!=null)try{C=Buffer.byteLength(JSON.stringify(q),"utf8")}catch{}return wm({executedRequest:null,status:y?.status??0,statusText:y?.statusText??"",headers:y?.headers??{},body:q,cookies:b,responseTime:y?.time,responseSize:C})})();if(typeof c=="function"){p.then(m=>c(null,m),m=>c(m));return}return p},location:{current:n.info?.requestName||"",currentRequestName:n.info?.requestName||"",eventName:"prerequest",toString(){return n.info?.requestName||""}}},setNextRequest(l){o._nextRequest=l},visualizer:{set(l,c){o._visualizerData={template:l,data:c}},clear(){o._visualizerData=void 0}},...n,info:{...n.info||{},eventName:"prerequest",requestName:n.info?.requestName||void 0,requestId:n.info?.requestId||void 0,iteration:e.iteration||0,iterationCount:e.iterationCount||1}}}createRequestObject(e,r){let n=l=>{if(!l)return"none";switch(l){case"raw":return"raw";case"form-data":return"formdata";case"x-www-form-urlencoded":return"urlencoded";case"binary":return"file";case"graphql":return"graphql";case"none":return"none";default:return"raw"}},i=l=>{if(!l)return"none";switch(l){case"raw":return"raw";case"formdata":return"form-data";case"urlencoded":return"x-www-form-urlencoded";case"file":return"binary";case"graphql":return"graphql";case"none":return"none";default:return"raw"}},s={...e.headers,add:l=>{l&&l.key&&(e.headers[l.key]=l.value||"")},get:l=>{for(let[c,d]of Object.entries(e.headers))if(c.toLowerCase()===l.toLowerCase())return d},has:l=>{for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.toLowerCase())return!0;return!1},remove:l=>{for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.toLowerCase()){delete e.headers[c];break}},update:l=>{if(l&&l.key){for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.key.toLowerCase()){e.headers[c]=l.value||"";return}}},upsert:l=>{if(l&&l.key){for(let c of Object.keys(e.headers))if(c.toLowerCase()===l.key.toLowerCase()){e.headers[c]=l.value||"";return}e.headers[l.key]=l.value||""}},toObject:()=>{let l={};for(let[c,d]of Object.entries(e.headers))typeof d=="string"&&(l[c]=d);return l},each:l=>{for(let[c,d]of Object.entries(e.headers))typeof d=="string"&&l({key:c,value:d})}},o={get mode(){return n(e.body?.type)},set mode(l){let c=i(l);e.body?e.body.type=c:e.body={type:c,content:null}},get raw(){let l=e.body?.content;return typeof l=="string"?l:l&&typeof l=="object"?JSON.stringify(l):""},set raw(l){e.body?(e.body.type="raw",e.body.content=l):e.body={type:"raw",content:l}},get formdata(){return e.body?.type==="form-data"&&Array.isArray(e.body.content)?e.body.content:[]},get urlencoded(){return e.body?.type==="x-www-form-urlencoded"&&Array.isArray(e.body.content)?e.body.content:[]},get graphql(){return e.body?.type==="graphql"?e.body.content:null},get file(){return e.body?.type==="binary"?e.body.content:null}};return{get url(){return cz(e.url)},set url(l){e.url=typeof l=="string"?l:String(l)},get method(){return e.method},set method(l){e.method=l},headers:s,get body(){return o},set body(l){if(l==null)e.body=null;else if(typeof l=="string")e.body={type:"raw",content:l};else if(typeof l=="object")if(l.type||l.mode||l.content!==void 0){let c=l.mode?i(l.mode):l.type||"raw";e.body={type:c,format:l.format,content:l.content}}else e.body={type:"raw",content:l}},get params(){return e.params||{}},set params(l){e.params=l||{}},get query(){return e.query||{}},set query(l){e.query=l||{}},get auth(){return r.request?.auth||null},set auth(l){r.request&&(r.request.auth=l)},get certificate(){return r.request?.certificate||null},set certificate(l){r.request&&(r.request.certificate=l)},get description(){return r.request?.description||null},set description(l){r.request&&(r.request.description=l)},get name(){return r.request?.name||null},set name(l){r.request&&(r.request.name=l)},get id(){return r.request?.id||null},get disabled(){return r.request?.disabled||!1},set disabled(l){r.request&&(r.request.disabled=l)},get messages(){return r.request?.messages||[]},get methodPath(){return r.request?.methodPath||null},get metadata(){return r.request?.metadata||[]},getHeaders(l){let c={};for(let[d,p]of Object.entries(e.headers))typeof p=="string"&&(c[d]=p);return c},addQueryParams(l){if(typeof l=="string"){let c=new URLSearchParams(l);for(let[d,p]of c)e.query||(e.query={}),e.query[d]=p}else Array.isArray(l)&&(e.query||(e.query={}),l.forEach(c=>{c.key&&(e.query[c.key]=c.value||"")}))},removeQueryParams(l){e.query&&(typeof l=="string"?delete e.query[l]:Array.isArray(l)&&l.forEach(c=>{let d=typeof c=="string"?c:c.key;d&&delete e.query[d]}))},authorizeUsing(l,c){r.request&&(typeof l=="string"?(r.request.auth||(r.request.auth={}),r.request.auth.type=l,c&&(r.request.auth.parameters=c)):typeof l=="object"&&(r.request.auth=l))},clone(){return{url:e.url,method:e.method,headers:{...e.headers},body:e.body?{...e.body}:null,params:e.params?{...e.params}:{},query:e.query?{...e.query}:{},auth:r.request?.auth,certificate:r.request?.certificate,description:r.request?.description,name:r.request?.name,id:r.request?.id,disabled:r.request?.disabled,metadata:r.request?.metadata,messages:r.request?.messages,methodPath:r.request?.methodPath}},describe(l,c){r.request&&(r.request.description={content:l,type:c||"text/plain"})},setHeader(l,c){e.headers[l]=c},addHeader(l,c){typeof l=="object"&&l!==null?e.headers[l.key]=l.value:e.headers[l]=c},removeHeader(l){delete e.headers[l]},setBody(l,c,d){e.body={type:c||e.body?.type||"raw",format:d||e.body?.format,content:l}}}}injectLegacyGlobals(e,r){let n=this.vmContext;if(!n)return;let i=this.initialContext,s=e==="test"&&r?.executedRequest?r.executedRequest:this.modifiedRequest,o={};for(let[b,q]of Object.entries(s?.headers||{}))typeof q=="string"&&(o[b]=q);let l=s?.body,c=l==null?null:typeof l=="object"&&"content"in l?l.content:l,d=i.request;if(n.request={id:d?.id??"",name:d?.name??"",description:d?.description??"",url:typeof s?.url=="string"?s.url:String(s?.url??""),method:s?.method??"GET",headers:o,data:c},n.environment=this._liveEnvironmentScope?.toObject?.()??{...this._environmentVariables},n.globals=this._liveGlobalsScope?.toObject?.()??{...this._globals},n.data={...i.iterationData||{}},typeof n.iteration!="number"&&(n.iteration=0),e!=="test"||!r)return;let p=r.body;n.responseBody=p==null?"":typeof p=="string"?p:JSON.stringify(p);let m=r.statusText||"";n.responseCode={code:r.status,name:m,detail:m},n.responseHeaders={...r.headers||{}},n.responseTime=r.responseTime??0,n.responseCookies=(r.cookies||[]).map(b=>({...b}));let y=this;n.tests=new Proxy({},{set(b,q,C){return y.assertions.push({name:String(q),passed:!!C,message:C?void 0:`"${String(q)}" was false`}),!0}})}async executePreRequest(e){let r=Rm(e,this.deps.isolateScripts);if(!r||!r.trim())return{success:!0};try{this.consoleMessages.length=0,this.injectLegacyGlobals("prerequest");let n=this.ctx.variables.replaceIn(r),i=this.deps.scriptTimeoutMs??5e3,s=n0.runInContext(n,this.vmContext,{timeout:i});this.deps.isolateScripts&&s&&typeof s.then=="function"&&await s,(await this.timerRegistry.drain(i)).timedOut&&this.consoleMessages.push({level:"warn",args:[`Script timed out after ${i}ms; pending async work was cancelled.`]});let l=Su(this.consoleMessages),c=this.initialContext.request.body,d=!this.bodiesEqual(this.modifiedRequest.body,c);return{success:!0,modifiedRequest:{url:this.modifiedRequest.url!==this.initialContext.request.url?this.modifiedRequest.url:void 0,headers:Uf(this.modifiedRequest.headers,this.initialContext.request.headers)?this.modifiedRequest.headers:void 0,body:d?this.modifiedRequest.body:void 0,params:Uf(this.modifiedRequest.params,this.initialContext.request.params||{})?this.modifiedRequest.params:void 0,query:Uf(this.modifiedRequest.query,this.initialContext.request.query||{})?this.modifiedRequest.query:void 0},modifiedVariables:this.ctx.variables.toObject(),localVariables:this.ctx.variables.toLocalObject?.()??{},modifiedCollectionVariables:this._liveCollectionScope?.toObject()||this._collectionVariables,modifiedGlobals:this._liveGlobalsScope?.toObject()||this._globals,modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,consoleOutput:l.length>0?l:void 0,nextRequest:this._nextRequest,skipRequest:this._skipRequest||void 0}}catch(n){let i=[...Su(this.consoleMessages),`[error] Script execution failed: ${n.message}`];return{success:!1,error:n.message||"Pre-request script execution failed",consoleOutput:i,modifiedVariables:this.ctx?.variables?.toObject(),localVariables:this.ctx?.variables?.toLocalObject?.()??{},modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,nextRequest:this._nextRequest,skipRequest:this._skipRequest||void 0}}}async executePostResponse(e,r){let n=Rm(e,this.deps.isolateScripts);if(!n||!n.trim())return{testResults:[],consoleOutput:[]};try{this.consoleMessages.length=0,this.assertions.length=0,this.ctx.info.eventName="test",this.ctx.response=wm(r),this.ctx.request=this.createRequestObject(r.executedRequest,this.initialContext),this.injectLegacyGlobals("test",r);let i=this.ctx.variables.replaceIn(n),s=this.deps.scriptTimeoutMs??5e3,o=n0.runInContext(i,this.vmContext,{timeout:s});this.deps.isolateScripts&&o&&typeof o.then=="function"&&await o,this.ctx.test._pendingTests?.length>0&&(await Promise.all(this.ctx.test._pendingTests),this.ctx.test._pendingTests.length=0),(await this.timerRegistry.drain(s)).timedOut&&this.consoleMessages.push({level:"warn",args:[`Script timed out after ${s}ms; pending async work was cancelled.`]});let c=Su(this.consoleMessages);return{testResults:[...this.assertions],consoleOutput:c.length>0?c:void 0,modifiedVariables:this.ctx?.variables?.toObject?.(),localVariables:this.ctx?.variables?.toLocalObject?.()??{},modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,modifiedGlobals:this._liveGlobalsScope?.toObject()||this._globals,modifiedCollectionVariables:this._liveCollectionScope?.toObject()||this._collectionVariables,nextRequest:this._nextRequest,visualizerData:this._visualizerData}}catch(i){this.assertions.push({name:"Script Execution",passed:!1,message:i.message||"Script execution failed"});let s=[...Su(this.consoleMessages),`[error] Script execution failed: ${i.message}`];return{testResults:[...this.assertions],consoleOutput:s,modifiedVariables:this.ctx?.variables?.toObject?.(),localVariables:this.ctx?.variables?.toLocalObject?.()??{},modifiedEnvironmentVariables:this._liveEnvironmentScope?.toObject()||this._environmentVariables,modifiedGlobals:this._liveGlobalsScope?.toObject()||this._globals,modifiedCollectionVariables:this._liveCollectionScope?.toObject()||this._collectionVariables,nextRequest:this._nextRequest,visualizerData:this._visualizerData}}}bodiesEqual(e,r){return e===r||!e&&!r?!0:!e||!r?!1:e.type===r.type&&e.format===r.format&&JSON.stringify(e.content)===JSON.stringify(r.content)}dispose(){this.timerRegistry.clearAll(),this.vmContext=null,this.ctx=null,this.assertions=[]}}});import*as gr from"crypto";import*as fz from"querystring";import*as lP from"vm";function uP(t,e){if(t)return t.split(",").map(r=>{let n=r.trim();if(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))return n.slice(1,-1);let i=Number(n);if(!isNaN(i)&&n!=="")return i;if(e&&n in e){let s=e[n],o=Number(s);return!isNaN(o)&&s!==""?o:s}return n})}function cP(t){if(typeof t=="string"&&t.charCodeAt(0)===30)try{return JSON.parse(t.slice(1))}catch{return t}return t}function dz(t,e){if(t==="@")return"";if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);let r=t.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(r){let n=uP(r[2],e),i=ys(r[1],n);return i!==null?i:void 0}if(e[t]!==void 0)return cP(e[t]);if(ba(t)){let n=va(t,e),i=Ui(t,n);if(i!==void 0)return i}}function aP(t,e,r,n){let i=Buffer.concat([Buffer.from(t,"utf8"),n||Buffer.alloc(0)]),s=[],o=Buffer.alloc(0);for(;Buffer.concat(s).length<e+r;)o=gr.createHash("md5").update(Buffer.concat([o,i])).digest(),s.push(o);let l=Buffer.concat(s);return{key:l.subarray(0,e),iv:l.subarray(e,e+r)}}function s0(t,e,r){let n=i=>t==="aes"?`aes-${i*8}-cbc`:t==="des"?"des-cbc":t==="des-ede3"?"des-ede3-cbc":t;return{encrypt(i,s,o){let l=i instanceof Ze?i.toBuffer():Buffer.from(String(i),"utf8");if(typeof s=="string"){let c=gr.randomBytes(8),{key:d,iv:p}=aP(s,e,r,c),m=gr.createCipheriv(n(e),d,p),y=Buffer.concat([m.update(l),m.final()]),b=Buffer.concat([Buffer.from("Salted__"),c,y]);return{ciphertext:new Ze(y),salt:new Ze(c),toString:q=>q?q.stringify(new Ze(b)):b.toString("base64")}}else{let c=s.toBuffer(),d=o?.iv&&o.iv instanceof Ze?o.iv.toBuffer():Buffer.alloc(r),p=gr.createCipheriv(n(c.length),c,d);o?.padding===!1&&p.setAutoPadding(!1);let m=Buffer.concat([p.update(l),p.final()]);return{ciphertext:new Ze(m),toString:y=>y?y.stringify(new Ze(m)):m.toString("base64")}}},decrypt(i,s,o){if(typeof s=="string"){let l=typeof i=="string"?Buffer.from(i,"base64"):i.ciphertext.toBuffer(),c,d;l.subarray(0,8).toString()==="Salted__"?(d=l.subarray(8,16),c=l.subarray(16)):(d=Buffer.alloc(0),c=l);let{key:p,iv:m}=aP(s,e,r,d),y=gr.createDecipheriv(n(e),p,m);return new Ze(Buffer.concat([y.update(c),y.final()]))}else{let l=s.toBuffer(),c=o?.iv&&o.iv instanceof Ze?o.iv.toBuffer():Buffer.alloc(r),d=typeof i=="string"?Buffer.from(i,"base64"):i.ciphertext?i.ciphertext.toBuffer():Buffer.from(i),p=gr.createDecipheriv(n(l.length),l,c);return o?.padding===!1&&p.setAutoPadding(!1),new Ze(Buffer.concat([p.update(d),p.final()]))}}}}function pz(){let t=r=>n=>{let i=n instanceof Ze?n.toBuffer():Buffer.from(String(n),"utf8");return new Ze(gr.createHash(r).update(i).digest())},e=r=>(n,i)=>{let s=n instanceof Ze?n.toBuffer():Buffer.from(String(n),"utf8"),o=i instanceof Ze?i.toBuffer():Buffer.from(String(i),"utf8");return new Ze(gr.createHmac(r,o).update(s).digest())};return{MD5:t("md5"),SHA1:t("sha1"),SHA224:t("sha224"),SHA256:t("sha256"),SHA384:t("sha384"),SHA512:t("sha512"),SHA3:t("sha3-256"),RIPEMD160:t("ripemd160"),HmacMD5:e("md5"),HmacSHA1:e("sha1"),HmacSHA256:e("sha256"),HmacSHA512:e("sha512"),AES:s0("aes",32,16),DES:s0("des",8,8),TripleDES:s0("des-ede3",24,8),PBKDF2(r,n,i){let s=r instanceof Ze?r.toBuffer():Buffer.from(String(r),"utf8"),o=n instanceof Ze?n.toBuffer():Buffer.from(String(n),"utf8"),l=(i?.keySize||4)*4,c=i?.iterations||1;return new Ze(gr.pbkdf2Sync(s,o,c,l,"sha1"))},enc:{Base64:{stringify:r=>(r instanceof Ze?r.toBuffer():Buffer.from(String(r))).toString("base64"),parse:r=>Ze.fromBase64(r)},Utf8:{stringify:r=>(r instanceof Ze?r.toBuffer():Buffer.from(String(r))).toString("utf8"),parse:r=>Ze.fromUtf8(r)},Hex:{stringify:r=>(r instanceof Ze?r.toBuffer():Buffer.from(String(r))).toString("hex"),parse:r=>Ze.fromHex(r)},Latin1:{stringify:r=>(r instanceof Ze?r.toBuffer():Buffer.from(String(r))).toString("latin1"),parse:r=>new Ze(Buffer.from(r,"latin1"))},Utf16:{stringify:r=>(r instanceof Ze?r.toBuffer():Buffer.from(String(r))).toString("utf16le"),parse:r=>new Ze(Buffer.from(r,"utf16le"))},Utf16BE:{stringify:r=>(r instanceof Ze?r.toBuffer():Buffer.from(String(r))).swap16().toString("utf16le"),parse:r=>new Ze(Buffer.from(r,"utf16le").swap16())}},lib:{WordArray:{create:r=>r?typeof r=="string"?new Ze(Buffer.from(r,"utf8")):Buffer.isBuffer(r)?new Ze(r):new Ze(Buffer.from(String(r))):new Ze(Buffer.alloc(0)),random:r=>new Ze(gr.randomBytes(r))}},pad:{Pkcs7:{_name:"pkcs7"},NoPadding:{_name:"nopadding"},ZeroPadding:{_name:"zeropadding"}},mode:{CBC:{_name:"cbc"},ECB:{_name:"ecb"}}}}var Ze,Cs,Vf=ae(()=>{"use strict";$h();sf();Fh();e0();i0();_m();Ze=class t{_buffer;constructor(e){this._buffer=typeof e=="string"?Buffer.from(e,"utf8"):e}toString(e){return e?e.stringify(this):this._buffer.toString("hex")}toBuffer(){return this._buffer}static fromHex(e){return new t(Buffer.from(e,"hex"))}static fromBase64(e){return new t(Buffer.from(e,"base64"))}static fromUtf8(e){return new t(Buffer.from(e,"utf8"))}};Cs=class t{constructor(e,r=[],n,i="shared",s=5e3){this.httpService=e;this.secretRegistry=n;this.scopeMode=i;this.scriptTimeoutMs=s;this.moduleLoader=Xw(r)}httpService;secretRegistry;scopeMode;scriptTimeoutMs;moduleLoader;createRequestSession(e){return new Bf({createVM:this.createVM.bind(this),createCommonContext:this.createCommonContext.bind(this),isolateScripts:this.scopeMode==="isolated",scriptTimeoutMs:this.scriptTimeoutMs},e)}createVM(e,r,n){let i=this.moduleLoader.getGlobalSetupExports(),s=this.moduleLoader.createRequireFunction();e.require=s,e.vault=this.createVault();let o={ctx:e,hf:e,pm:e,console:r,...i||{},global:i,setTimeout:n?.setTimeout??setTimeout,setInterval:n?.setInterval??setInterval,clearTimeout:n?.clearTimeout??clearTimeout,clearInterval:n?.clearInterval??clearInterval,URL,URLSearchParams,Buffer,atob:l=>Buffer.from(l,"base64").toString("binary"),btoa:l=>Buffer.from(l,"binary").toString("base64"),TextEncoder,TextDecoder,crypto:gr,_:s("lodash"),require:s,moment:bm(),querystring:fz,CryptoJS:pz(),tv4:(()=>{try{return s("tv4")}catch{return}})(),postman:{setNextRequest:l=>e.setNextRequest?.(l),setGlobalVariable:(l,c)=>e.globals?.set(l,c),getGlobalVariable:l=>e.globals?.get(l),clearGlobalVariable:l=>e.globals?.unset(l),setEnvironmentVariable:(l,c)=>e.environment?.set(l,c),getEnvironmentVariable:l=>e.environment?.get(l),clearEnvironmentVariable:l=>e.environment?.unset(l),getResponseHeader:l=>{let c=e.response?.headers?.get?.(l);return c===void 0?null:c},getResponseCookie:l=>{let c=e.response?.cookies;if(c&&typeof c[Symbol.iterator]=="function"){for(let d of c)if(d?.name&&d.name.toLowerCase()===l.toLowerCase())return{...d}}return null}},jsonStringify:(l,c,d)=>JSON.stringify(l,c,d),jsonParse:l=>JSON.parse(l),xml2Json:l=>{try{let c=this.moduleLoader.createRequireFunction()("xml2js"),d;return c.parseString(l,{explicitArray:!1},(p,m)=>{if(p)throw p;d=m}),d}catch{throw new Error("xml2Json() requires the xml2js module. Add it to your modules/package.json and run npm install.")}}};return lP.createContext(o)}createCommonContext(e,r){let n={...e.variables},i={...e.collectionVariables||{}},s={...e.globals||{}},o={...e.environmentVariables||{}},l=e.iterationData||{},c=this.createMergedVariableScope(n,o,i,s,l),d=this.createGlobalsScope(s,e.onGlobalsChange),p=this.createVariableScope(i),m=this.createEnvironmentScope(o,e.environmentName,e.onEnvironmentChange,!0),y={...m,set:(C,v)=>{let _=this.serializeValue(v);m.set(C,_),n[C]=_},unset(C){m.unset(C),delete n[C]},clear(){let C=Object.keys(o);m.clear();for(let v of C)delete n[v]}},b={...d,set:(C,v)=>{let _=this.serializeValue(v);d.set(C,_),n[C]=_},unset(C){d.unset(C),delete n[C]},clear(){let C=Object.keys(s);d.clear();for(let v of C)delete n[v]}};return b.replaceIn=c.replaceIn,p.replaceIn=c.replaceIn,y.replaceIn=c.replaceIn,{globals:b,collectionVariables:p,variables:c,environment:y,iterationData:{get:C=>l[C],has:C=>C in l,toObject:()=>({...l}),toJSON:()=>JSON.stringify(l)},sendRequest:this.createSendRequest(),expect:bu,info:e.info||{eventName:r,requestName:void 0,requestId:void 0}}}static JSON_TYPE_MARKER="";serializeValue(e){return typeof e=="string"?e:e===void 0?t.JSON_TYPE_MARKER+"undefined":t.JSON_TYPE_MARKER+JSON.stringify(e)}deserializeValue(e){if(e!==void 0){if(typeof e=="string"&&e.charCodeAt(0)===30){let r=e.slice(1);if(r==="undefined")return;try{return JSON.parse(r)}catch{}}return e}}createVariableScope(e){return{get:r=>this.deserializeValue(e[r]),set:(r,n)=>{e[r]=this.serializeValue(n)},has(r){return r in e},unset(r){delete e[r]},clear(){Object.keys(e).forEach(r=>delete e[r])},toObject(){return{...e}}}}createGlobalsScope(e,r){let n=(i,s,o)=>{r&&r(i,s,o)};return{get:i=>this.deserializeValue(e[i]),set:(i,s)=>{let o=this.serializeValue(s);e[i]=o,n("set",i,o)},has(i){return i in e},unset(i){delete e[i],n("unset",i)},clear(){Object.keys(e).forEach(i=>delete e[i]),n("clear")},toObject(){return{...e}}}}createMergedVariableScope(e,r,n,i,s={}){let o={get:l=>l in e?this.deserializeValue(e[l]):l in s?s[l]:l in r?this.deserializeValue(r[l]):l in n?this.deserializeValue(n[l]):this.deserializeValue(i[l]),set:(l,c)=>{e[l]=this.serializeValue(c)},has(l){return l in e||l in s||l in r||l in r||l in n||l in i},unset(l){delete e[l]},clear(){Object.keys(e).forEach(l=>delete e[l])},toObject(){return{...i,...n,...r,...s,...e}},toLocalObject(){return{...n,...r,...s,...e}},replaceIn(l){if(!l||typeof l!="string")return l;let c=o.toObject(),d=20,p=y=>y.replace(/\{\{([^}]+)\}\}/g,(b,q)=>{let C=q.trim(),v=C.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)(?:\(([^)]*)\))?$/);if(v)try{let E=uP(v[2],c),k=ys(v[1],E);return k!==null?String(k):b}catch{return b}let _=af(C);if(_){let E=dz(_.input,c);if(E!==void 0){let k=lf(E,_.filters,c);return k!==void 0?String(k):b}return b}if(o.has(C)){let E=o.get(C);return E===void 0?"":String(E)}if(ba(C)){let E={};for(let[M,j]of Object.entries(c))E[M]=cP(j);let k=va(C,E),O=Ui(C,k);if(O!==void 0)return String(O)}return b}),m=l;for(let y=0;y<d;y++){let b=p(m);if(b===m)break;m=b}return m}};return o}createEnvironmentScope(e,r,n,i){let s=(o,l,c)=>{n&&(i?n(o,l,c):n(l||"",o==="set"?c:void 0))};return{name:r||"",get:o=>this.deserializeValue(e[o]),set:(o,l)=>{let c=this.serializeValue(l);e[o]=c,s("set",o,c)},has(o){return o in e},unset(o){delete e[o],s("unset",o)},clear(){Object.keys(e).forEach(o=>delete e[o]),s("clear")},toObject(){return{...e}}}}createVault(){let e=this.secretRegistry,r=()=>{throw new Error("pm.vault is read-only in HTTP Forge. Use environment variables or {{secret:provider/path}} tokens to manage secrets.")};return{async get(n){if(!e)throw new Error('pm.vault is not available \u2014 no secret providers are configured. Configure a provider under "secrets.providers" to use pm.vault.get().');let i=`secret:${n}`;return(await e.resolveSecretTokens(`{{${i}}}`))[i]},set:r,unset:r}}createSendRequest(){return this.httpService?(e,r)=>{let n=typeof e=="string"?{url:e,method:"GET"}:e,i=this.httpService.execute({url:n.url,method:n.method||"GET",headers:n.headers||{},body:n.body,...n});if(r){i.then(s=>r(null,s)).catch(s=>r(s,null));return}return i}:(e,r)=>{let n=new Error("sendRequest not available - HTTP service not configured");if(r){r(n,null);return}return Promise.reject(n)}}}});import*as dP from"fs";import*as mz from"http";import*as o0 from"https";import*as xm from"path";import{URL as fP}from"url";import*as Em from"zlib";var wn,Na,Jf=ae(()=>{"use strict";wn={timeout:3e4,followRedirects:!0,followOriginalMethod:!1,followAuthHeader:!1,maxRedirects:10,strictSSL:!0,decompress:!0,includeCookies:!1,tls:{},certificates:[]},Na=class{settings;version;basePath;constructor(e,r=process.cwd()){this.settings={...wn,...e},this.basePath=r;try{this.version=_t("../../package.json").version||"0.0.0"}catch{this.version="0.0.0"}this.settings.strictSSL===!1&&console.log("[NodeHttpClient] SSL verification disabled (strictSSL: false)")}async send(e){let r=this.mergeSettings(e.settings);return await this.executeInternal(e,r,0)}mergeSettings(e){return{timeout:e?.timeout??this.settings.timeout,followRedirects:e?.followRedirects??this.settings.followRedirects,followOriginalMethod:e?.followOriginalMethod??this.settings.followOriginalMethod,followAuthHeader:e?.followAuthHeader??this.settings.followAuthHeader,maxRedirects:e?.maxRedirects??this.settings.maxRedirects,strictSSL:e?.strictSSL??this.settings.strictSSL,decompress:e?.decompress??this.settings.decompress,includeCookies:e?.includeCookies??this.settings.includeCookies,tls:e?.tls??this.settings.tls??{},certificates:e?.certificates??this.settings.certificates??[]}}async executeInternal(e,r,n,i){let s=Date.now(),o=new fP(e.url),l=o.protocol==="https:",c=this.sanitizeHeaders(e.headers||{});Object.keys(c).some(m=>m.toLowerCase()==="user-agent")||(c["User-Agent"]=`HttpForge/${this.version}`);let p={hostname:o.hostname,port:o.port||(l?443:80),path:o.pathname+o.search,method:e.method,headers:{...c},timeout:r.timeout||void 0};if(r.decompress&&!c["accept-encoding"]&&!c["Accept-Encoding"]&&(p.headers["Accept-Encoding"]="gzip, deflate"),l){let m=this.resolveTlsSettings(o,r),y=p;y.rejectUnauthorized=r.strictSSL;let b={rejectUnauthorized:r.strictSSL},q=this.readOptionalFile(m.caPath,"CA certificate");q&&(b.ca=q);let C=this.readOptionalFile(m.certPath,"client certificate");C&&(b.cert=C);let v=this.readOptionalFile(m.keyPath,"client private key");v&&(b.key=v);let _=this.readOptionalFile(m.pfxPath,"client pfx");_&&(b.pfx=_),m.passphrase&&(b.passphrase=m.passphrase),m.servername&&(y.servername=m.servername),y.agent=new o0.Agent(b)}return new Promise((m,y)=>{if(i?.aborted){let C=new Error("Request cancelled");C.name="AbortError",y(C);return}let q=(l?o0:mz).request(p,async C=>{let v=C.statusCode||0;if(r.followRedirects&&[301,302,303,307,308].includes(v)){if(n>=r.maxRedirects){y(new Error(`Maximum redirects (${r.maxRedirects}) exceeded`));return}let E=C.headers.location;if(!E){y(new Error("Redirect response missing Location header"));return}let k=new fP(E,e.url).toString(),O=e.method;!r.followOriginalMethod&&[301,302,303].includes(v)&&(O="GET");let M={...e.headers};r.followAuthHeader||(delete M.authorization,delete M.Authorization);try{let j=await this.executeInternal({...e,url:k,method:O,headers:M,body:O==="GET"?void 0:e.body},r,n+1,i),I=Date.now();j.time=I-s,m(j)}catch(j){y(j)}return}let _=[];C.on("data",E=>_.push(E)),C.on("end",()=>{let E=Date.now(),k=Buffer.concat(_),O=C.headers["content-encoding"];if(r.decompress&&O)try{O==="gzip"?k=Em.gunzipSync(k):O==="deflate"&&(k=Em.inflateSync(k))}catch(R){console.warn("[NodeHttpClient] Decompression failed:",R)}let M=k.toString("utf-8"),j={};for(let[R,A]of Object.entries(C.headers))(typeof A=="string"||Array.isArray(A))&&(j[R]=A);let I=this.parseCookies(C.headers["set-cookie"],o.hostname);m({status:C.statusCode||0,statusText:C.statusMessage||"",headers:j,cookies:I,body:M,time:E-s,size:k.length})})});if(i&&i.addEventListener("abort",()=>{q.destroy();let C=new Error("Request cancelled");C.name="AbortError",y(C)}),q.on("error",C=>{y(C)}),q.on("timeout",()=>{q.destroy(),y(new Error("Request timeout"))}),e.body!==void 0&&e.body!==null){let C=typeof e.body=="string"?e.body:JSON.stringify(e.body);q.write(C)}q.end()})}resolveTlsSettings(e,r){let n=r.tls||{};if(!!(n.caPath||n.certPath||n.keyPath||n.pfxPath||n.servername||n.passphrase))return n;let s=this.findCertificateMapping(e,r.certificates||[]);return s?{caPath:s.caPath,certPath:s.certPath,keyPath:s.keyPath,pfxPath:s.pfxPath,passphrase:s.passphrase,servername:s.servername}:n}findCertificateMapping(e,r){if(!Array.isArray(r)||r.length===0)return;let n=e.hostname,i=e.port?Number(e.port):443,s=r.find(o=>this.mappingMatchesHost(o,n,i,!0));return s||r.find(o=>this.mappingMatchesHost(o,n,i,!1))}mappingMatchesHost(e,r,n,i){if(!e||e.enabled===!1)return!1;let s=String(e.host||"").trim().toLowerCase();if(!s||e.port!=null&&Number(e.port)!==n)return!1;let o=r.toLowerCase();if(i)return s!=="*"&&!s.startsWith("*.")&&o===s;if(s==="*")return!0;if(s.startsWith("*.")){let l=s.slice(2);return o===l||o.endsWith(`.${l}`)}return o===s}readOptionalFile(e,r){if(!e)return;let n=xm.isAbsolute(e)?e:xm.resolve(this.basePath,e);try{return dP.readFileSync(n)}catch(i){throw new Error(`[NodeHttpClient] Failed to read ${r} file at ${n}: ${i?.message||"Unknown error"}`)}}sanitizeHeaderValue(e){return e?String(e).replace(/[\u201C\u201D\u201E\u201F\u2033\u2036]/g,'"').replace(/[\u2018\u2019\u201A\u201B\u2032\u2035]/g,"'").replace(/[\x00-\x08\x0A-\x1F\x7F]/g,""):""}sanitizeHeaders(e){let r={};for(let[n,i]of Object.entries(e))r[n]=this.sanitizeHeaderValue(String(i));return r}parseCookies(e,r){return e?e.map(n=>{let i=n.split(";").map(p=>p.trim()),[s,...o]=i,[l,c]=s.split("="),d={name:l.trim(),value:c?.trim()||"",domain:r};for(let p of o){let[m,y]=p.split("=");switch(m.toLowerCase().trim()){case"domain":d.domain=y?.trim();break;case"path":d.path=y?.trim();break;case"expires":d.expires=y?.trim();break;case"httponly":d.httpOnly=!0;break;case"secure":d.secure=!0;break}}return d}):[]}}});var a0,Ma,qm=ae(()=>{"use strict";a0={json:"application/json",xml:"application/xml",html:"text/html",text:"text/plain",javascript:"application/javascript",css:"text/css","x-www-form-urlencoded":"application/x-www-form-urlencoded","form-data":"multipart/form-data",graphql:"application/json"},Ma=class{sanitizeHeaderValue(e){return e?String(e).replace(/[\u201C\u201D\u201E\u201F\u2033\u2036]/g,'"').replace(/[\u2018\u2019\u201A\u201B\u2032\u2035]/g,"'").replace(/[\x00-\x08\x0A-\x1F\x7F]/g,""):""}sanitizeHeaders(e){let r={};for(let[n,i]of Object.entries(e))r[n]=this.sanitizeHeaderValue(String(i));return r}encodeBody(e){if(!e||e.type==="none")return null;let{type:r,content:n}=e;switch(r){case"x-www-form-urlencoded":return this.encodeUrlEncodedBody(n);case"form-data":return n;case"graphql":return this.encodeGraphQLBody(n);case"raw":return n;default:return n}}encodeUrlEncodedBody(e){if(Array.isArray(e)){let r=new URLSearchParams;for(let n of e)n.enabled!==!1&&n.key&&r.append(n.key,n.value||"");return r.toString()}return typeof e=="string"?e:String(e)}encodeGraphQLBody(e){if(typeof e=="string")try{e=JSON.parse(e)}catch{return e}if(typeof e=="object"&&e!==null&&e.query){let r=e.variables;if(typeof r=="string")try{r=r.trim()?JSON.parse(r):void 0}catch{r=void 0}return JSON.stringify({query:e.query,...r!=null?{variables:r}:{},...e.operationName?{operationName:e.operationName}:{}})}return JSON.stringify(e)}setContentTypeHeader(e,r,n){if(Object.keys(e).some(o=>o.toLowerCase()==="content-type"))return;if(n){e["Content-Type"]=n;return}if(!r||r.type==="none")return;let s;switch(r.type){case"x-www-form-urlencoded":s=a0["x-www-form-urlencoded"];break;case"raw":s=r.format?a0[r.format]:"text/plain",s||(s="text/plain");break;case"graphql":s=a0.graphql;break;case"binary":s="application/octet-stream";break}s&&(e["Content-Type"]=s)}}});var Da,Om=ae(()=>{"use strict";Da=class{parse(e,r){return r.toLowerCase().endsWith(".json")?this.parseJson(e):this.parseCsv(e)}parseJson(e){try{let r=JSON.parse(e);return Array.isArray(r)?r:[r]}catch{throw new Error("Failed to parse JSON data file: Invalid JSON format")}}parseCsv(e){let r=e.split(/\r?\n/).filter(s=>s.trim());if(r.length<2)return[{}];let n=this.parseCsvLine(r[0]),i=[];for(let s=1;s<r.length;s++){let o=this.parseCsvLine(r[s]),l={};n.forEach((c,d)=>{l[c]=o[d]||""}),i.push(l)}return i}parseCsvLine(e){let r=[],n="",i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=e[s+1];o==='"'?i&&l==='"'?(n+='"',s++):i=!i:o===","&&!i?(r.push(n.trim()),n=""):n+=o}return r.push(n.trim()),r}}});import*as Ru from"crypto";var gz,Yf,u0=ae(()=>{"use strict";gz=3e4,Yf=class{constructor(e,r,n,i,s="henry-huang.http-forge/oauth2/callback"){this.secretStore=e;this.browserService=r;this.envConfigService=n;this.httpService=i;this.callbackPath=s}secretStore;browserService;envConfigService;httpService;callbackPath;tokenCache=new Map;pendingAuthCallback=null;pendingImplicitCallback=null;async getToken(e,r){if(e.accessToken)return{accessToken:this.resolve(e.accessToken,r),tokenType:e.tokenPrefix||"Bearer",raw:{}};let n=this.buildCacheKeyString(e),i=this.tokenCache.get(n);if(i&&!this.isExpired(i))return i;if(i?.refreshToken)try{return await this.refreshToken(e,i.refreshToken,r)}catch{this.tokenCache.delete(n)}if(!i){let o=await this.secretStore.get(`oauth2_refresh_${n}`);if(o)try{return await this.refreshToken(e,o,r)}catch{await this.secretStore.delete(`oauth2_refresh_${n}`)}}let s;switch(e.grantType){case"client_credentials":s=await this.fetchToken(e,r,"client_credentials");break;case"password":s=await this.fetchToken(e,r,"password");break;case"authorization_code":s=await this.authorizationCodeFlow(e,r);break;case"implicit":s=await this.implicitFlow(e,r);break;default:throw new Error(`Unknown OAuth2 grant type: ${e.grantType}`)}return this.tokenCache.set(n,s),s.refreshToken&&await this.storeRefreshToken(n,s.refreshToken),s}async refreshToken(e,r,n){let i=this.resolve(e.tokenUrl||"",n);if(!i)throw new Error("OAuth2 tokenUrl is required for token refresh");let s=this.resolve(e.clientId||"",n),o=this.resolve(e.clientSecret||"",n),l=new URLSearchParams;l.append("grant_type","refresh_token"),l.append("refresh_token",r);let c={"Content-Type":"application/x-www-form-urlencoded"};this.applyClientAuth(e,c,l,s,o,n);let d=await this.httpService.execute({method:"POST",url:i,headers:c,body:l.toString()}),p=this.parseTokenResponse(d.body,e);p.refreshToken||(p.refreshToken=r);let m=this.buildCacheKeyString(e);return this.tokenCache.set(m,p),p.refreshToken&&await this.storeRefreshToken(m,p.refreshToken),p}async authorizationCodeFlow(e,r){let n=this.resolve(e.authUrl||"",r),i=this.resolve(e.tokenUrl||"",r),s=this.resolve(e.clientId||"",r),o=this.resolve(e.clientSecret||"",r),l=e.scope?this.resolve(e.scope,r):void 0;if(!n)throw new Error("OAuth2 authUrl is required for authorization code flow");if(!i)throw new Error("OAuth2 tokenUrl is required for authorization code flow");if(!s)throw new Error("OAuth2 clientId is required for authorization code flow");let c=e.usePkce!==!1,d,p,m;if(c){d=this.generateCodeVerifier();let j=e.pkceMethod||"S256";p=j==="S256"?this.generateCodeChallengeS256(d):d,m=j}let y=e.state||Ru.randomBytes(16).toString("hex"),b=await this.getCallbackUri(),q=new URL(n);if(q.searchParams.set("response_type","code"),q.searchParams.set("client_id",s),q.searchParams.set("redirect_uri",b),l&&q.searchParams.set("scope",l),q.searchParams.set("state",y),p&&(q.searchParams.set("code_challenge",p),q.searchParams.set("code_challenge_method",m)),e.audience&&q.searchParams.set("audience",this.resolve(e.audience,r)),e.resource&&q.searchParams.set("resource",this.resolve(e.resource,r)),e.extraParams)for(let[j,I]of Object.entries(e.extraParams))q.searchParams.set(j,this.resolve(I,r));this.pendingAuthCallback&&(this.pendingAuthCallback.reject(new Error("OAuth2 authorization superseded by a new request")),this.pendingAuthCallback=null);let C=new Promise((j,I)=>{this.pendingAuthCallback={resolve:j,reject:I,state:y}});await this.browserService.openExternal(q.toString());let v;try{v=await Promise.race([C,new Promise((j,I)=>setTimeout(()=>{this.pendingAuthCallback=null,I(new Error("OAuth2 authorization timed out after 2 minutes"))},12e4))])}finally{this.pendingAuthCallback=null}if(v.state&&v.state!==y)throw new Error("OAuth2 state mismatch \u2014 potential CSRF attack");let _=new URLSearchParams;_.append("grant_type","authorization_code"),_.append("code",v.code),_.append("redirect_uri",b),d&&_.append("code_verifier",d);let E={"Content-Type":"application/x-www-form-urlencoded"};this.applyClientAuth(e,E,_,s,o,r);let k=await this.httpService.execute({method:"POST",url:i,headers:E,body:_.toString()}),O=this.parseTokenResponse(k.body,e),M=this.buildCacheKeyString(e);return this.tokenCache.set(M,O),O.refreshToken&&await this.storeRefreshToken(M,O.refreshToken),O}async implicitFlow(e,r){let n=this.resolve(e.authUrl||"",r),i=this.resolve(e.clientId||"",r),s=e.scope?this.resolve(e.scope,r):void 0;if(!n)throw new Error("OAuth2 authUrl is required for implicit flow");if(!i)throw new Error("OAuth2 clientId is required for implicit flow");let o=e.state||Ru.randomBytes(16).toString("hex"),l=await this.getCallbackUri(),c=new URL(n);if(c.searchParams.set("response_type","token"),c.searchParams.set("client_id",i),c.searchParams.set("redirect_uri",l),s&&c.searchParams.set("scope",s),c.searchParams.set("state",o),e.audience&&c.searchParams.set("audience",this.resolve(e.audience,r)),e.resource&&c.searchParams.set("resource",this.resolve(e.resource,r)),e.extraParams)for(let[b,q]of Object.entries(e.extraParams))c.searchParams.set(b,this.resolve(q,r));this.pendingImplicitCallback&&(this.pendingImplicitCallback.reject(new Error("OAuth2 implicit flow superseded by a new request")),this.pendingImplicitCallback=null);let d=new Promise((b,q)=>{this.pendingImplicitCallback={resolve:b,reject:q,state:o}});await this.browserService.openExternal(c.toString());let p;try{p=await Promise.race([d,new Promise((b,q)=>setTimeout(()=>{this.pendingImplicitCallback=null,q(new Error("OAuth2 implicit flow timed out after 2 minutes"))},12e4))])}finally{this.pendingImplicitCallback=null}if(p.state&&p.state!==o)throw new Error("OAuth2 state mismatch \u2014 potential CSRF attack");let m={accessToken:p.accessToken,tokenType:p.tokenType||e.tokenPrefix||"Bearer",expiresAt:p.expiresIn?Date.now()+p.expiresIn*1e3:void 0,raw:{access_token:p.accessToken,token_type:p.tokenType,expires_in:p.expiresIn}},y=this.buildCacheKeyString(e);return this.tokenCache.set(y,m),m}handleAuthorizationCallback(e,r,n){if(n){let i=new Error(`OAuth2 authorization error: ${n}`);this.pendingAuthCallback?.reject(i),this.pendingImplicitCallback?.reject(i),this.pendingAuthCallback=null,this.pendingImplicitCallback=null;return}if(e&&this.pendingAuthCallback){this.pendingAuthCallback.resolve({code:e,state:r}),this.pendingAuthCallback=null;return}!e&&!this.pendingAuthCallback&&this.pendingImplicitCallback&&(this.pendingImplicitCallback.reject(new Error("OAuth2 implicit flow did not receive access_token")),this.pendingImplicitCallback=null)}handleImplicitCallback(e,r,n,i){this.pendingImplicitCallback&&(this.pendingImplicitCallback.resolve({accessToken:e,tokenType:r,expiresIn:n,state:i}),this.pendingImplicitCallback=null)}clearToken(e){let r=`${e.tokenUrl}|${e.clientId}|${e.scope||""}|${e.grantType}`;this.tokenCache.delete(r),this.secretStore.delete(`oauth2_refresh_${r}`)}clearAllTokens(){for(let e of this.tokenCache.keys())this.secretStore.delete(`oauth2_refresh_${e}`);this.tokenCache.clear()}async fetchToken(e,r,n){let i=this.resolve(e.tokenUrl||"",r);if(!i)throw new Error("OAuth2 tokenUrl is required");let s=this.resolve(e.clientId||"",r),o=this.resolve(e.clientSecret||"",r),l=e.scope?this.resolve(e.scope,r):void 0,c=new URLSearchParams;if(c.append("grant_type",n),l&&c.append("scope",l),n==="password"){let m=this.resolve(e.username||"",r),y=this.resolve(e.password||"",r);if(!m)throw new Error("OAuth2 password grant requires username");c.append("username",m),c.append("password",y)}if(e.audience&&c.append("audience",this.resolve(e.audience,r)),e.resource&&c.append("resource",this.resolve(e.resource,r)),e.extraParams)for(let[m,y]of Object.entries(e.extraParams))c.append(m,this.resolve(y,r));let d={"Content-Type":"application/x-www-form-urlencoded"};this.applyClientAuth(e,d,c,s,o,r);let p=await this.httpService.execute({method:"POST",url:i,headers:d,body:c.toString()});return this.parseTokenResponse(p.body,e)}applyClientAuth(e,r,n,i,s,o){if(e.clientAuthentication==="header"){let l=Buffer.from(`${i}:${s}`).toString("base64");r.Authorization=`Basic ${l}`}else i&&n.set("client_id",i),s&&n.set("client_secret",s)}parseTokenResponse(e,r){let n=e;if(typeof n=="string")try{n=JSON.parse(n)}catch{throw new Error("OAuth2 token response is not valid JSON")}if(!n||typeof n!="object")throw new Error("OAuth2 token response is not a valid JSON object");let i=n,s=r.tokenField||"access_token",o=i[s];if(!o)throw new Error(`OAuth2 token fetch failed: '${s}' not present in response`);let l=typeof i.expires_in=="number"?i.expires_in:void 0;return{accessToken:o,tokenType:i.token_type||r.tokenPrefix||"Bearer",expiresAt:l?Date.now()+l*1e3:void 0,refreshToken:i.refresh_token,scope:i.scope,raw:i}}isExpired(e){return e.expiresAt?Date.now()>=e.expiresAt-gz:!1}buildCacheKeyString(e){return`${e.tokenUrl||""}|${e.clientId||""}|${e.scope||""}|${e.grantType}`}async getCallbackUri(){let e=`${this.browserService.uriScheme}://${this.callbackPath}`;return this.browserService.asExternalUri(e)}resolve(e,r){return this.envConfigService.resolveVariables(e,r)}generateCodeVerifier(){return Ru.randomBytes(32).toString("base64url")}generateCodeChallengeS256(e){return Ru.createHash("sha256").update(e).digest("base64url")}async storeRefreshToken(e,r){try{await this.secretStore.store(`oauth2_refresh_${e}`,r)}catch{}}}});import*as ja from"fs";import*as go from"path";function Cu(t,e={}){let r=[];Object.entries(e).forEach(([n,i])=>{r.push(`${n}=${i}`)}),r.length&&ja.writeFileSync(t,r.join(`
|
|
53
53
|
`),"utf-8")}function Kf(t,e,r){r&&(r.preRequest&&r.preRequest.trim()&&ja.writeFileSync(go.join(t,`${e}.pre.js`),r.preRequest,"utf-8"),r.postResponse&&r.postResponse.trim()&&ja.writeFileSync(go.join(t,`${e}.post.js`),r.postResponse,"utf-8"))}function yz(t,e){let n=e&&e.trim()?e.trim():"collections-rest-client";return go.isAbsolute(n)?n:go.join(t,n)}async function vz(t,e,r,n,i){await t.exportCollectionAsRestClientFolder(r,n),e.exportEnvironmentsToFolder(n,i)}function Im(t,e,r){t.forEach(n=>{if(n.type==="folder"){let i=go.join(e,Vt(n.name));ja.mkdirSync(i,{recursive:!0}),Kf(i,Vt(n.name),n.scripts),Im(n.items||[],i,r)}else if(n.type==="request"){let i=n,s=Vt(i.name)+".http",o=go.join(e,s),l=bz(i,r);ja.writeFileSync(o,l,"utf-8"),Kf(e,Vt(i.name),i.scripts)}})}function bz(t,e){let r=[];r.push(`### ${e.name} / ${t.name}`),r.push(`# collection env: ${Vt(e.name)}.env`),r.push(`# request scripts: ${Vt(t.name)}.pre.js and .post.js`);let n=Sz(t);return r.push(`${t.method} ${n}`),(t.headers||[]).filter(i=>i.enabled!==!1).forEach(i=>{r.push(`${i.key}: ${i.value}`)}),t.body&&t.body.content&&r.push("",t.body.content),r.join(`
|
|
54
|
-
`)}function Sz(t){let e=t.url;if(t.query&&t.query.length){let r=t.query.filter(n=>n.enabled!==!1).map(n=>`${encodeURIComponent(n.key)}=${encodeURIComponent(n.value)}`).join("&");r&&(e+=(e.includes("?")?"&":"?")+r)}return e}var Pm=ae(()=>{"use strict";jn()});import*as xr from"fs";import*as c0 from"path";var xu,f0=ae(()=>{"use strict";jn();xu=class{collectionsDir;cache=new Map;constructor(e){this.collectionsDir=e,this.ensureDirectory()}ensureDirectory(){xr.existsSync(this.collectionsDir)||xr.mkdirSync(this.collectionsDir,{recursive:!0})}loadAll(){if(this.cache.clear(),!xr.existsSync(this.collectionsDir))return[];let e=xr.readdirSync(this.collectionsDir),r=[];for(let n of e)if(n.endsWith(".json"))try{let i=c0.join(this.collectionsDir,n),s=xr.readFileSync(i,"utf-8"),o=JSON.parse(s);o.id&&o.name&&(this.cache.set(o.id,o),r.push(o))}catch(i){console.error(`[JsonCollectionLoader] Failed to load ${n}:`,i)}return r}load(e){if(this.cache.has(e))return this.cache.get(e);let r=this.getCollectionPath(e);if(xr.existsSync(r))try{let n=xr.readFileSync(r,"utf-8"),i=JSON.parse(n);return this.cache.set(e,i),i}catch(n){console.error(`[JsonCollectionLoader] Failed to load collection ${e}:`,n);return}}async save(e){if(this.ensureDirectory(),!e.name)throw new Error("Collection name is required");e.id||(e.id=Pt(e.name));let r=this.getCollectionPath(e.id),n=JSON.stringify(e,null,2);await xr.promises.writeFile(r,n,"utf-8"),this.cache.set(e.id,e)}async delete(e){let r=this.getCollectionPath(e);if(!xr.existsSync(r))return!1;try{return await xr.promises.unlink(r),this.cache.delete(e),!0}catch(n){return console.error(`[JsonCollectionLoader] Failed to delete collection ${e}:`,n),!1}}exists(e){return xr.existsSync(this.getCollectionPath(e))}getCollectionPath(e){return c0.join(this.collectionsDir,`${e}.json`)}getItemPath(e,r){}async create(e,r){let n={id:r||Pt(e),name:e,items:[]};return await this.save(n),n}async saveScripts(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.findItemById(i.items,r);s&&(s.scripts=n,await this.save(i))}loadScripts(e,r){let n=this.load(e);return n?this.findItemById(n.items,r)?.scripts:void 0}async updateCollectionMetadata(e,r){let n=this.load(e);if(!n)throw new Error(`Collection ${e} not found`);r.name!==void 0&&(n.name=r.name),r.description!==void 0&&(n.description=r.description),r.version!==void 0&&(n.version=r.version),r.variables!==void 0&&(n.variables=r.variables),r.auth!==void 0&&(n.auth=r.auth),await this.save(n)}async saveItem(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.findItemById(i.items,r.id);if(s)Object.assign(s,r);else if(n){let o=this.findItemById(i.items,n);if(o&&o.type==="folder")o.items=o.items||[],o.items.push(r);else throw new Error(`Parent folder ${n} not found`)}else i.items.push(r);await this.save(i)}async deleteItem(e,r){let n=this.load(e);if(!n)return!1;let i=this.deleteItemById(n.items,r);return i&&await this.save(n),i}async updateItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.findItemById(i.items,r);if(!s)return!1;let{id:o,type:l,...c}=n;return Object.assign(s,c),await this.save(i),!0}async moveItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.findItemById(i.items,r);if(!s)return!1;let o={...s};if(!this.deleteItemById(i.items,r))return!1;if(n){let l=this.findItemById(i.items,n);if(l&&l.type==="folder")l.items=l.items||[],l.items.push(o);else return i.items.push(o),!1}else i.items.push(o);return await this.save(i),!0}async reorderItems(e,r,n){let i=this.load(e);if(!i)return!1;try{let s;if(r){let c=this.findItemById(i.items,r);if(!c||!c.items)return!1;s=c.items}else s=i.items;let o=new Map(s.map(c=>[c.id,c])),l=[];for(let c of n){let d=o.get(c);d&&(l.push(d),o.delete(c))}for(let c of o.values())l.push(c);if(r){let c=this.findItemById(i.items,r);c&&(c.items=l)}else i.items=l;return await this.save(i),!0}catch(s){return console.error("[JsonCollectionLoader] Failed to reorder items:",s),!1}}findItemById(e,r){for(let n of e){if(n.id===r)return n;if(n.type==="folder"&&n.items){let i=this.findItemById(n.items,r);if(i)return i}}}deleteItemById(e,r){for(let n=0;n<e.length;n++){if(e[n].id===r)return e.splice(n,1),!0;let i=e[n];if(i.type==="folder"&&i.items&&this.deleteItemById(i.items,r))return!0}return!1}}});var Qf,d0=ae(()=>{"use strict";Ph();f0();Qf=class{static create(e){let r=e.getStorageConfig(),n=e.getCollectionsPath();return r.format==="folder"?new so(n):new xu(n)}static createForFormat(e,r){return e==="folder"?new so(r):new xu(r)}}});import*as Dt from"fs";import*as hi from"path";function pP(t){if(typeof t!="string")return"text";let e=t.trim();try{let r=JSON.parse(e);if(typeof r=="object"&&r!==null)return"json"}catch{}return/^<\?xml/.test(e)||/^<([a-zA-Z_][\w\-\.]*)[\s>]/.test(e)?/^<\!DOCTYPE html>/i.test(e)||/^<html[\s>]/i.test(e)?"html":"xml":/^<\!DOCTYPE html>/i.test(e)||/^<html[\s>]/i.test(e)?"html":/^(function\s*\(|\(\)\s*=>|const |let |var |export |import )/.test(e)?"javascript":"text"}function wz(t){return{info:{name:t.name,_postman_id:t.id,schema:"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},item:t.items.map(e=>hP(e)),event:p0(t.scripts),variable:t.variables?Object.entries(t.variables).map(([e,r])=>({key:e,value:r})):[]}}function hP(t){if(t.type==="folder")return{name:t.name,item:t.items?t.items.map(hP):[],event:p0(t.scripts)};if(t.type==="request"){let e=t;return{name:e.name,request:{method:e.method,header:(e.headers||[]).map(_z),url:Rz(e),body:Cz(e),auth:xz(e.auth),description:e.description},event:p0(e.scripts),protocolProfileBehavior:Ez(e.settings)}}}function _z(t){return{key:t.key,value:t.value,disabled:t.enabled===!1,...t.description!==void 0?{description:t.description}:{},...t.type!==void 0?{type:t.type}:{},...t.required!==void 0?{required:t.required}:{},...t.format!==void 0?{format:t.format}:{},...t.enum!==void 0?{enum:t.enum}:{},...t.deprecated!==void 0?{deprecated:t.deprecated}:{},...t.pattern!==void 0?{pattern:t.pattern}:{},...t.minLength!==void 0?{minLength:t.minLength}:{},...t.maxLength!==void 0?{maxLength:t.maxLength}:{},...t.minimum!==void 0?{minimum:t.minimum}:{},...t.maximum!==void 0?{maximum:t.maximum}:{},...t.exclusiveMinimum!==void 0?{exclusiveMinimum:t.exclusiveMinimum}:{},...t.exclusiveMaximum!==void 0?{exclusiveMaximum:t.exclusiveMaximum}:{},...t.multipleOf!==void 0?{multipleOf:t.multipleOf}:{},...t.minItems!==void 0?{minItems:t.minItems}:{},...t.maxItems!==void 0?{maxItems:t.maxItems}:{},...t.uniqueItems!==void 0?{uniqueItems:t.uniqueItems}:{},...t.nullable!==void 0?{nullable:t.nullable}:{},...t.oneOf!==void 0?{oneOf:t.oneOf}:{}}}function Rz(t){let e=t.url,r=t.url.replace(/^[a-zA-Z]+:\/\//,""),n=[],i=r.match(/^([^\/\?]+)/);if(i){let d=i[1];/^{{.*}}$/.test(d)?n=[d]:n=d.split(".")}let s=[],o=r.match(/^[^\/\?]+(\/[^\?]*)?/);if(o&&o[1]!==void 0){let d=o[1].replace(/^\//,"");d.endsWith("/")?(s=d.slice(0,-1).split("/"),s.push("")):s=d.length>0?d.split("/"):[]}let l;if(Array.isArray(t.query)&&t.query.length>0)l=t.query.map(d=>{let p={key:d.key,value:d.value};return d.enabled===!1&&(p.disabled=!0),d.description!==void 0&&(p.description=d.description),d.type!==void 0&&(p.type=d.type),d.required!==void 0&&(p.required=d.required),d.format!==void 0&&(p.format=d.format),d.enum!==void 0&&(p.enum=d.enum),d.deprecated!==void 0&&(p.deprecated=d.deprecated),d.pattern!==void 0&&(p.pattern=d.pattern),d.minLength!==void 0&&(p.minLength=d.minLength),d.maxLength!==void 0&&(p.maxLength=d.maxLength),d.minimum!==void 0&&(p.minimum=d.minimum),d.maximum!==void 0&&(p.maximum=d.maximum),d.exclusiveMinimum!==void 0&&(p.exclusiveMinimum=d.exclusiveMinimum),d.exclusiveMaximum!==void 0&&(p.exclusiveMaximum=d.exclusiveMaximum),d.multipleOf!==void 0&&(p.multipleOf=d.multipleOf),d.minItems!==void 0&&(p.minItems=d.minItems),d.maxItems!==void 0&&(p.maxItems=d.maxItems),d.uniqueItems!==void 0&&(p.uniqueItems=d.uniqueItems),d.nullable!==void 0&&(p.nullable=d.nullable),d.oneOf!==void 0&&(p.oneOf=d.oneOf),p});else{let d=r.indexOf("?");d!==-1&&(l=r.substring(d+1).split("&").map(m=>{let[y,...b]=m.split("=");return{key:y,value:b.join("=")}}))}let c;return t.params&&typeof t.params=="object"&&(c=Object.entries(t.params).map(([d,p])=>({key:d,value:String(p)}))),{raw:e,host:n.length>0?n:void 0,path:s.length>0?s:void 0,query:l&&l.length>0?l:void 0,variable:c&&c.length>0?c:void 0}}function Cz(t){if(!t.body)return;let e=t.body;if(typeof e=="string"){let s=pP(e);return{mode:"raw",raw:e,options:{raw:{language:s}}}}if(e.type==="raw"){let s=e.format||pP(e.content);return{mode:"raw",raw:e.content,options:{raw:{language:s}}}}let r=e.type==="form-data"&&Array.isArray(e.content)?e.content:e.type==="formdata"&&Array.isArray(e.fields)?e.fields:null;if(r)return{mode:"formdata",formdata:r.map(s=>({key:s.key,value:s.value,type:s.type||"text",disabled:s.enabled===!1}))};let n=e.type==="x-www-form-urlencoded"&&Array.isArray(e.content)?e.content:e.type==="urlencoded"&&Array.isArray(e.fields)?e.fields:null;if(n)return{mode:"urlencoded",urlencoded:n.map(s=>({key:s.key,value:s.value,disabled:s.enabled===!1}))};if(e.type==="file"&&e.fileName)return{mode:"file",file:{src:e.fileName}};if(e.type==="binary")return{mode:"binary",file:{}};let i=e.type==="graphql"?e.content??(e.query?e:null):null;if(i){let s=i.query??"",o=i.variables;return{mode:"graphql",graphql:{query:s,variables:o?typeof o=="string"?o:JSON.stringify(o):void 0}}}if(e.content)return{mode:"raw",raw:e.content}}function xz(t){if(!(!t||!t.type||t.type==="none")){if(t.type==="bearer")return{type:"bearer",bearer:[{key:"token",value:t.bearerToken,type:"string"}]};if(t.type==="basic"&&t.basicAuth)return{type:"basic",basic:[{key:"username",value:t.basicAuth.username,type:"string"},{key:"password",value:t.basicAuth.password,type:"string"}]}}}function Ez(t){if(!t)return;let e={};return t.followRedirects===!1&&(e.followRedirects=!1),t.followOriginalMethod===!0&&(e.followOriginalHttpMethod=!0),t.followAuthHeader===!1&&(e.followAuthorizationHeader=!1),t.maxRedirects!==void 0&&(e.maxRedirects=t.maxRedirects),t.strictSSL===!1&&(e.disableUrlEncoding=!1),t.timeout!==void 0&&(e.requestTimeout=t.timeout),Object.keys(e).length>0?e:void 0}function p0(t){if(!t)return[];let e=[];return t.preRequest&&e.push({listen:"prerequest",script:{type:"text/javascript",exec:[t.preRequest]}}),t.postResponse&&e.push({listen:"test",script:{type:"text/javascript",exec:[t.postResponse]}}),e}var Zf,h0=ae(()=>{"use strict";jn();Pm();d0();Zf=class{constructor(e,r,n){this.workspaceRoot=e;this.configService=r;this.fileWatcherFactory=n;this.collectionsDir=r.getCollectionsPath(),this.loader=Qf.create(r),this.ensureCollectionsDir(),this.loadCollections(),this.setupFileWatcher()}workspaceRoot;configService;fileWatcherFactory;collectionsDir;collections=new Map;fileWatcher;loader;debounceTimer=null;selfWritePending=!1;localCollectionValues=new Map;onCollectionsChanged;ensureCollectionsDir(){Dt.existsSync(this.collectionsDir)||Dt.mkdirSync(this.collectionsDir,{recursive:!0})}loadCollections(){this.collections.clear();let e=this.loader.loadAll();for(let r of e)this.collections.set(r.id,r)}setupFileWatcher(){if(!this.fileWatcherFactory)return;this.fileWatcher=this.fileWatcherFactory.createFileWatcher(this.collectionsDir,"**/*");let e=()=>{this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null;let r=this.selfWritePending;this.selfWritePending=!1,r||this.loadCollections(),this.onCollectionsChanged?.()},300)};this.fileWatcher.onDidChange(e),this.fileWatcher.onDidCreate(e),this.fileWatcher.onDidDelete(e)}getAllCollections(){return Array.from(this.collections.values())}getCollection(e){return this.collections.get(e)}getCollectionById(e){for(let r of this.collections.values())if(r.id===e)return r}getCollectionByName(e){let r=e.toLowerCase();for(let n of this.collections.values())if(n.name.toLowerCase()===r)return n}async saveCollection(e){if(this.ensureCollectionsDir(),!e.name)throw new Error("Collection name is required");e.id||(e.id=Pt(e.name)),this.selfWritePending=!0,await this.loader.save(e),this.collections.set(e.id,e)}getCollectionVariables(e){let r=this.collections.get(e);return r?.variables?{...r.variables}:{}}getCollectionVariableLocals(e){return{...this.localCollectionValues.get(e)||{}}}setCollectionVariable(e,r,n){this.localCollectionValues.has(e)||this.localCollectionValues.set(e,{}),this.localCollectionValues.get(e)[r]=String(n)}deleteCollectionVariable(e,r){let n=this.localCollectionValues.get(e);n&&delete n[r]}clearCollectionVariables(e){this.localCollectionValues.set(e,{})}async deleteCollection(e){if(!this.collections.get(e))return!1;this.selfWritePending=!0;let n=await this.loader.delete(e);return n&&this.collections.delete(e),n}findRequest(e,r){let n=this.collections.get(e);if(n)return this.findItemRecursive(n.items,r)}findRequestByPath(e,r){let n=this.collections.get(e);if(!n)return;let i=r.split("/").filter(s=>s.trim());return this.findItemByPath(n.items,i)}async updateRequest(e,r,n){let i=this.collections.get(e);if(!i)return!1;this.selfWritePending=!0;let s=await this.loader.updateItem(e,r,n);if(s){let o=this.findItemRecursive(i.items,r);if(o){let{id:l,type:c,...d}=n;Object.assign(o,d)}}return s}async addRequest(e,r,n){if(!this.collections.get(e))return!1;r.id||(r.id=Pt(r.name)),this.selfWritePending=!0;try{return await this.loader.saveItem(e,r,n),!0}catch(s){return console.error("[CollectionService] Failed to add request:",s),!1}}async deleteRequest(e,r){let n=this.collections.get(e);if(!n)return!1;this.selfWritePending=!0;let i=await this.loader.deleteItem(e,r);return i&&this.deleteItemRecursive(n.items,r),i}getAllRequests(e){let r=this.collections.get(e);if(!r)return[];let n=[];return this.collectRequestsRecursive(r.items,n),n}findItemRecursive(e,r){for(let n of e){if(n.id===r)return n;if(n.type==="folder"&&n.items){let i=this.findItemRecursive(n.items,r);if(i)return i}}}findItemByPath(e,r){if(r.length===0)return;let[n,...i]=r,s=e.find(o=>o.name===n);if(s){if(i.length===0)return s;if(s.type==="folder"&&s.items)return this.findItemByPath(s.items,i)}}updateItemRecursive(e,r,n){for(let i=0;i<e.length;i++){let s=e[i];if(s.id===r)return e[i]={...s,...n},!0;if(s.type==="folder"&&s.items&&this.updateItemRecursive(s.items,r,n))return!0}return!1}deleteItemRecursive(e,r){for(let n=0;n<e.length;n++){let i=e[n];if(i.id===r)return e.splice(n,1),!0;if(i.type==="folder"&&i.items&&this.deleteItemRecursive(i.items,r))return!0}return!1}collectRequestsRecursive(e,r){for(let n of e)n.type==="request"?r.push(n):n.type==="folder"&&n.items&&this.collectRequestsRecursive(n.items,r)}async createCollection(e){let r={id:Pt(e),name:e,items:[]};return await this.saveCollection(r),r}async renameCollection(e,r){let n=this.collections.get(e);return n?(n.name=r,await this.saveCollection(n),!0):!1}async duplicateCollection(e,r){if(!this.collections.get(e))throw new Error(`Collection not found: ${e}`);this.selfWritePending=!0;let i=Pt(r),s=this.loader.getCollectionPath(e),o=hi.join(this.collectionsDir,i);if(!Dt.existsSync(s))throw new Error(`Collection directory not found: ${s}`);this.copyDirRecursive(s,o);let l=hi.join(o,"collection.json");if(Dt.existsSync(l)){let d=JSON.parse(Dt.readFileSync(l,"utf-8"));d.id=i,d.name=r,Dt.writeFileSync(l,JSON.stringify(d,null,2))}else Dt.writeFileSync(l,JSON.stringify({id:i,name:r},null,2));this.loadCollections();let c=this.collections.get(i);if(!c)throw new Error("Failed to load duplicated collection");return c}async createFolder(e){if(!this.collections.get(e.collectionId))throw new Error("Collection not found");this.selfWritePending=!0;let n={id:Pt(e.name),type:"folder",name:e.name,items:[]};await this.loader.saveItem(e.collectionId,n,e.parentId);let i=this.loader.load(e.collectionId);return i&&this.collections.set(e.collectionId,i),n}async deleteFolder(e,r){let n=this.collections.get(e);if(!n)return!1;this.selfWritePending=!0;let i=await this.loader.deleteItem(e,r);return i&&this.deleteItemById(n.items,r),i}async renameFolder(e,r,n){let i=this.collections.get(e);if(!i)return!1;this.selfWritePending=!0;let s=await this.loader.updateItem(e,r,{name:n});if(s){let o=this.findItemById(i.items,r);o&&(o.name=n)}return s}async duplicateFolder(e,r,n){if(!this.collections.get(e))throw new Error("Collection not found");let s=this.loader.getItemPath(e,r);if(!s||!Dt.existsSync(s))throw new Error(`Folder not found on disk: ${r}`);let o=hi.dirname(s),l=Pt(n),c=hi.join(o,l);this.selfWritePending=!0,this.copyDirRecursive(s,c);let d=hi.join(c,"folder.json");if(Dt.existsSync(d)){let y=JSON.parse(Dt.readFileSync(d,"utf-8"));y.id=l,y.name=n,Dt.writeFileSync(d,JSON.stringify(y,null,2))}else Dt.writeFileSync(d,JSON.stringify({id:l,name:n,type:"folder"},null,2));this.loadCollections();let p=this.collections.get(e),m=p?this.findItemById(p.items,l):void 0;return m||{id:l,type:"folder",name:n,items:[]}}async createRequest(e){if(!this.collections.get(e.collectionId))throw new Error("Collection not found");this.selfWritePending=!0;let n={id:e.id||Pt(e.name),type:"request",name:e.name,method:e.method||"GET",url:e.url,params:e.params,query:e.query,headers:e.headers,body:e.body,auth:e.auth,settings:e.settings,scripts:e.scripts,deprecated:e.deprecated,description:e.description,doc:e.doc,responseSchema:e.responseSchema,bodySchema:e.bodySchema,operationId:e.operationId,summary:e.summary,tags:e.tags,examples:e.examples,responses:e.responses,security:e.security};await this.loader.saveItem(e.collectionId,n,e.parentId);let i=this.loader.load(e.collectionId);return i&&this.collections.set(e.collectionId,i),n}async renameRequest(e,r,n){let i=this.collections.get(e);if(!i)return!1;this.selfWritePending=!0;let s=await this.loader.updateItem(e,r,{name:n});if(s){let o=this.findItemById(i.items,r);o&&(o.name=n)}return s}async moveItem(e,r,n){if(!this.collections.get(e))return!1;this.selfWritePending=!0;let s=await this.loader.moveItem(e,r,n);return s&&this.loadCollections(),s}async reorderItems(e,r,n){if(!this.collections.get(e))return!1;this.selfWritePending=!0;let s=await this.loader.reorderItems(e,r,n);return s&&this.loadCollections(),s}getRequestScript(e,r,n){let i=this.collections.get(e);if(!i)return;let s=this.findItemById(i.items,r);if(!s||s.type!=="request")return;let o=s;return n==="pre-request"?o.scripts?.preRequest:o.scripts?.postResponse}async setRequestScript(e,r,n,i){let s=this.collections.get(e);if(!s)return!1;let o=this.findItemById(s.items,r);if(!o||o.type!=="request")return!1;let l=o,d={...l.scripts??{},...n==="pre-request"?{preRequest:i}:{postResponse:i}};l.scripts=d,this.selfWritePending=!0;try{return await this.loader.saveScripts(e,r,d),!0}catch{return!1}}findItemById(e,r){for(let n of e){if(n.id===r)return n;if(n.type==="folder"&&n.items){let i=this.findItemById(n.items,r);if(i)return i}}}copyDirRecursive(e,r){Dt.existsSync(r)||Dt.mkdirSync(r,{recursive:!0});for(let n of Dt.readdirSync(e,{withFileTypes:!0})){let i=hi.join(e,n.name),s=hi.join(r,n.name);n.isDirectory()?this.copyDirRecursive(i,s):Dt.copyFileSync(i,s)}}deleteItemById(e,r){for(let n=0;n<e.length;n++){let i=e[n];if(i.id===r)return e.splice(n,1),!0;if(i.type==="folder"&&i.items&&this.deleteItemById(i.items,r))return!0}return!1}async importCollection(e){let r=Dt.readFileSync(e,"utf-8"),n;try{n=JSON.parse(r)}catch{throw new Error("Invalid JSON file")}if(n.info&&n.info._postman_id)return this.importPostmanCollection(n);let i={id:n.id||Pt(n.name||"Imported Collection"),name:n.name||"Imported Collection",description:n.description,items:n.items||[]};return await this.saveCollection(i),i}async importPostmanCollection(e){let r=p=>{if(!p)return;switch(p.type?.toLowerCase()){case"bearer":return{type:"bearer",bearerToken:p.bearer?.find(q=>q.key==="token")?.value||""};case"basic":let b=p.basic?.find(q=>q.key==="username"),E=p.basic?.find(q=>q.key==="password");return{type:"basic",basicAuth:{username:b?.value||"",password:E?.value||""}};case"apikey":let C=p.apikey?.find(q=>q.key==="key"),v=p.apikey?.find(q=>q.key==="value"),_=p.apikey?.find(q=>q.key==="in");return{type:"apikey",apikey:{key:C?.value||"",value:v?.value||"",in:_?.value||"header"}};case"noauth":return{type:"none"};default:return}},n=p=>{if(!Array.isArray(p)||p.length===0)return;let m={};for(let y of p){let b=y.script?.exec;if(!b)continue;let E=Array.isArray(b)?b.join(`
|
|
55
|
-
`):b;y.listen==="prerequest"?m.preRequest=E:y.listen==="test"&&(m.postResponse=E)}return m.preRequest||m.postResponse?m:void 0},i=p=>{if(!p||typeof p!="object")return;let m={};return p.followRedirects===!1&&(m.followRedirects=!1),p.followOriginalHttpMethod===!0&&(m.followOriginalMethod=!0),p.followAuthorizationHeader===!1&&(m.followAuthHeader=!1),p.maxRedirects!==void 0&&(m.maxRedirects=p.maxRedirects),p.requestTimeout!==void 0&&(m.timeout=p.requestTimeout),Object.keys(m).length>0?m:void 0},s=p=>{if(!p||typeof p=="string")return;let m=p.query;if(!(!Array.isArray(m)||m.length===0))return m.map(y=>({key:y.key||"",value:y.value||"",enabled:y.disabled!==!0,...y.description!==void 0?{description:y.description}:{},...y.type!==void 0?{type:y.type}:{},...y.required!==void 0?{required:y.required}:{},...y.format!==void 0?{format:y.format}:{},...y.enum!==void 0?{enum:y.enum}:{},...y.deprecated!==void 0?{deprecated:y.deprecated}:{},...y.pattern!==void 0?{pattern:y.pattern}:{},...y.minLength!==void 0?{minLength:y.minLength}:{},...y.maxLength!==void 0?{maxLength:y.maxLength}:{},...y.minimum!==void 0?{minimum:y.minimum}:{},...y.maximum!==void 0?{maximum:y.maximum}:{},...y.exclusiveMinimum!==void 0?{exclusiveMinimum:y.exclusiveMinimum}:{},...y.exclusiveMaximum!==void 0?{exclusiveMaximum:y.exclusiveMaximum}:{},...y.multipleOf!==void 0?{multipleOf:y.multipleOf}:{},...y.minItems!==void 0?{minItems:y.minItems}:{},...y.maxItems!==void 0?{maxItems:y.maxItems}:{},...y.uniqueItems!==void 0?{uniqueItems:y.uniqueItems}:{},...y.nullable!==void 0?{nullable:y.nullable}:{},...y.oneOf!==void 0?{oneOf:y.oneOf}:{}}))},o=p=>{if(typeof p=="string")return p;if(!p)return"";let m=new Set;if(Array.isArray(p.variable))for(let b of p.variable)b.key&&m.add(b.key);if(m.size===0&&p.raw)return p.raw;let y="";if(p.protocol&&(y+=p.protocol+"://"),p.host&&(y+=Array.isArray(p.host)?p.host.join("."):p.host),p.port&&(y+=":"+p.port),p.path){let E=(Array.isArray(p.path)?p.path:[p.path]).map(C=>{let v=C.startsWith(":")?C.substring(1):C;return m.has(v)?":"+v:(C.startsWith(":"),C)});y+="/"+E.join("/")}return!y&&p.raw?p.raw:y},l=p=>{if(!Array.isArray(p)||p.length===0)return;let m={responses:{}};for(let y of p){let b=String(y.code||200),E,C={};if(Array.isArray(y.header))for(let O of y.header)!O.key||O.disabled||(O.key.toLowerCase()==="content-type"?E=O.value?.split(";")[0]?.trim():C[O.key]={description:String(O.value??""),schema:{type:"string"}});let v=y.body;if(typeof y.body=="string"&&y.body)try{v=JSON.parse(y.body)}catch{}let _=y.originalRequest,q;if(_){let O=typeof _.url=="string"?_.url:_.url?.raw??"";q=`${_.method||""} ${O}`.trim()||void 0}let k=y.name?y.name.replace(/[^a-zA-Z0-9_-]/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,"").toLowerCase()||`example_${b}`:`example_${b}`;if(m.responses[b]){let O=m.responses[b];O.examples=O.examples??{},O.examples[k]={summary:q,value:v}}else m.responses[b]={description:y.name,contentType:E,examples:{[k]:{summary:q,value:v}},...Object.keys(C).length>0?{headers:C}:{}}}return Object.keys(m.responses).length>0?m:void 0},c=p=>p.map(m=>{if(m.item)return{id:Pt(m.name),type:"folder",name:m.name,description:m.description,auth:r(m.auth),scripts:n(m.event),items:c(m.item)};{let y=m.request||{};return{id:Pt(m.name),type:"request",name:m.name,description:m.description||y.description,method:typeof y.method=="string"?y.method:"GET",url:o(y.url),query:s(y.url),headers:Array.isArray(y.header)?y.header.map(b=>({key:b.key||b.name||"",value:b.value||b.value||"",enabled:b.disabled!==!0,...b.description!==void 0?{description:b.description}:{},...b.type!==void 0?{type:b.type}:{},...b.required!==void 0?{required:b.required}:{},...b.format!==void 0?{format:b.format}:{},...b.enum!==void 0?{enum:b.enum}:{},...b.deprecated!==void 0?{deprecated:b.deprecated}:{},...b.pattern!==void 0?{pattern:b.pattern}:{},...b.minLength!==void 0?{minLength:b.minLength}:{},...b.maxLength!==void 0?{maxLength:b.maxLength}:{},...b.minimum!==void 0?{minimum:b.minimum}:{},...b.maximum!==void 0?{maximum:b.maximum}:{},...b.exclusiveMinimum!==void 0?{exclusiveMinimum:b.exclusiveMinimum}:{},...b.exclusiveMaximum!==void 0?{exclusiveMaximum:b.exclusiveMaximum}:{},...b.multipleOf!==void 0?{multipleOf:b.multipleOf}:{},...b.minItems!==void 0?{minItems:b.minItems}:{},...b.maxItems!==void 0?{maxItems:b.maxItems}:{},...b.uniqueItems!==void 0?{uniqueItems:b.uniqueItems}:{},...b.nullable!==void 0?{nullable:b.nullable}:{},...b.oneOf!==void 0?{oneOf:b.oneOf}:{}})):[],body:(()=>{let b=y.body;if(b){if(b.mode==="raw"&&b.raw){let E=b.options?.raw?.language;return{type:"raw",format:E==="xml"?"xml":E==="html"?"html":E==="javascript"?"javascript":E==="text"?"text":"json",content:b.raw}}if(b.mode==="urlencoded"&&Array.isArray(b.urlencoded))return{type:"x-www-form-urlencoded",content:b.urlencoded.map(E=>({key:E.key||"",value:E.value||"",enabled:E.disabled!==!0}))};if(b.mode==="formdata"&&Array.isArray(b.formdata))return{type:"form-data",content:b.formdata.map(E=>({key:E.key||"",value:E.value||"",type:E.type||"text",enabled:E.disabled!==!0}))};if(b.mode==="graphql"&&b.graphql){let E;if(b.graphql.variables)try{E=JSON.parse(b.graphql.variables)}catch{E=void 0}return{type:"graphql",content:{query:b.graphql.query||"",variables:E}}}if(b.mode==="binary")return{type:"binary",content:""}}})(),auth:r(y.auth),scripts:n(m.event),settings:i(m.protocolProfileBehavior),responseSchema:l(m.response)}}}),d={id:Pt(e.info?.name||"Imported Postman Collection"),name:e.info?.name||"Imported Postman Collection",description:e.info?.description,auth:r(e.auth),scripts:n(e.event),variables:Array.isArray(e.variable)?Object.fromEntries(e.variable.filter(p=>p&&p.key).map(p=>[p.key,String(p.value??"")])):typeof e.variable=="object"&&e.variable!==null?Object.fromEntries(Object.entries(e.variable).map(([p,m])=>[p,String(m??"")])):void 0,items:c(e.item||[])};return await this.saveCollection(d),d}async exportCollection(e,r){let n=this.collections.get(e);if(!n)throw new Error("Collection not found");let i=wz(n),s=JSON.stringify(i,null,2);Dt.writeFileSync(r,s,"utf-8")}async exportCollectionAsRestClientFolder(e,r){let n=this.collections.get(e);if(!n)throw new Error("Collection not found");let i=hi.join(r,Vt(n.name));Dt.mkdirSync(i,{recursive:!0});let s=n.variables||{};Cu(hi.join(i,`${Vt(n.name)}.env`),s),Kf(i,Vt(n.name),n.scripts),Im(n.items,i,n)}dispose(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.fileWatcher?.dispose()}}});var or,La,yo,m0=ae(()=>{"use strict";or={version:"1.0",storage:{format:"folder",root:"./.http-forge/assets",history:"./.http-forge/.cache/histories",results:"./.http-forge/.cache/results"},request:{timeout:3e4,followRedirects:!0,maxRedirects:10,strictSSL:!0,tls:{},certificates:[]},scripts:{modulePaths:["./.http-forge/assets/src","./.http-forge/assets/lib"],scope:"shared",timeout:5e3},runner:{resultsRetentionDays:7,indexPageSize:1e3,recentErrorsLimit:20},environments:{default:"dev"},restClientExport:{path:"collections-rest-client",mergeGlobals:!0},mcp:{port:3100,excludedCollections:[],excludedSuites:[],toolPrefix:"",maxRequestsPerCall:500,toolMode:"auto",drilldownThreshold:100,toolPageSize:200,cors:{allowedOrigins:["http://localhost","http://127.0.0.1"]}},proxy:null,secrets:{providers:{aws:{provider:"aws"},azure:{provider:"azure",vaultUrl:""},gcp:{provider:"gcp"},vault:{provider:"vault"},op:{provider:"1password"},doppler:{provider:"doppler"}}}},La={preferred:".http-forge/http-forge.config.json",legacy:"http-forge.config.json"},yo={collections:"collections",environments:"environments",flows:"flows",suites:"suites"}});import*as Ht from"fs";import*as zt from"path";var vo,km=ae(()=>{"use strict";m0();vo=class{constructor(e,r,n){this.workspacePath=e;this.fileWatcherFactory=r;this.notifications=n;this.configPath=this.resolveConfigPath(),this.config=this.loadConfig(),this.setupFileWatcher()}workspacePath;fileWatcherFactory;notifications;config;configPath;fileWatchers=[];resolveConfigPath(){let e=zt.join(this.workspacePath,La.preferred);if(Ht.existsSync(e))return e;let r=zt.join(this.workspacePath,La.legacy);return Ht.existsSync(r)?r:e}loadConfig(){if(this.configPath=this.resolveConfigPath(),!Ht.existsSync(this.configPath))return{...or};try{let e=Ht.readFileSync(this.configPath,"utf-8"),r=JSON.parse(e);return this.mergeWithDefaults(r)}catch(e){return console.error("[ConfigService] Failed to load config:",e),this.notifications?.showWarning(`Failed to parse ${zt.relative(this.workspacePath,this.configPath)}. Using default configuration.`),{...or}}}mergeWithDefaults(e){return{version:e.version??or.version,storage:{...or.storage,...e.storage},request:{...or.request,...e.request},scripts:{...or.scripts,...e.scripts},runner:{...or.runner,...e.runner},environments:{...or.environments,...e.environments},restClientExport:{...or.restClientExport,...e.restClientExport},proxy:e.proxy!==void 0?e.proxy:or.proxy,mcp:{...or.mcp,...e.mcp,cors:{...or.mcp.cors,...e.mcp?.cors}},secrets:{...or.secrets,...e.secrets,providers:{...or.secrets?.providers,...e.secrets?.providers}}}}setupFileWatcher(){if(!this.fileWatcherFactory)return;let e=()=>{this.reload()};for(let r of[La.preferred,La.legacy]){let n=this.fileWatcherFactory.createFileWatcher(this.workspacePath,r);n.onDidChange(e),n.onDidCreate(e),n.onDidDelete(e),this.fileWatchers.push(n)}}getConfig(){return this.config}getStorageConfig(){return this.config.storage}getRequestConfig(){return this.config.request}getScriptsConfig(){return this.config.scripts}getRunnerConfig(){return this.config.runner}getEnvironmentsConfig(){return this.config.environments}getRestClientExportPath(){let e=this.config.restClientExport?.path||"collections-rest-client";return zt.isAbsolute(e)?e:this.resolvePath(e)}getRestClientMergeGlobals(){return this.config.restClientExport?.mergeGlobals??!0}getProxyConfig(){return this.config.proxy??null}getMcpConfig(){let e=this.config.mcp??or.mcp,r=["flat","drilldown","auto"];return{...e,port:Math.min(65535,Math.max(1,Math.floor(e.port??3100))),toolMode:r.includes(e.toolMode)?e.toolMode:"auto",drilldownThreshold:Math.min(500,Math.max(10,e.drilldownThreshold??100)),toolPageSize:e.toolPageSize===0?0:Math.min(1e3,Math.max(10,e.toolPageSize??200)),maxRequestsPerCall:Math.min(1e4,Math.max(1,e.maxRequestsPerCall??500))}}resolvePath(e){let r=e.startsWith("./")?e.slice(2):e;return zt.join(this.workspacePath,...r.split("/"))}hasFolderCollectionsAtRoot(e){let r=zt.join(e,yo.collections);if(!Ht.existsSync(r))return!1;let n;try{n=Ht.readdirSync(r,{withFileTypes:!0})}catch{return!1}return n.some(i=>{if(!i.isDirectory())return!1;let s=zt.join(r,i.name,"collection.json");return Ht.existsSync(s)})}hasAnyEntries(e){if(!Ht.existsSync(e))return!1;try{return Ht.readdirSync(e).length>0}catch{return!1}}resolveStorageRootPath(){let e=this.resolvePath(this.config.storage.root);return this.configExists()||this.hasFolderCollectionsAtRoot(e)?e:[zt.join(this.workspacePath,"http-forge-assets")].find(i=>this.hasFolderCollectionsAtRoot(i))||e}getRootPath(){return this.resolveStorageRootPath()}getCollectionsPath(){return zt.join(this.getRootPath(),yo.collections)}getEnvironmentsPath(){return zt.join(this.getRootPath(),yo.environments)}getFlowsPath(){return zt.join(this.getRootPath(),yo.flows)}getHistoryPath(){let e=this.resolvePath(this.config.storage.history);if(this.configExists()||this.hasAnyEntries(e))return e;let r=zt.join(this.workspacePath,".http-forge-cache","histories");return this.hasAnyEntries(r)?r:e}getResultsPath(){let e=this.resolvePath(this.config.storage.results);if(this.configExists()||this.hasAnyEntries(e))return e;let r=zt.join(this.workspacePath,".http-forge-cache","results");return this.hasAnyEntries(r)?r:e}getSuitesPath(){return zt.join(this.getRootPath(),yo.suites)}getModulePaths(){return this.config.scripts.modulePaths.map(e=>this.resolvePath(e))}getScriptScope(){return this.config.scripts.scope??"shared"}getScriptTimeout(){return this.config.scripts.timeout??5e3}getWorkspacePath(){return this.workspacePath}reload(){this.configPath=this.resolveConfigPath(),this.config=this.loadConfig()}configExists(){return Ht.existsSync(this.resolveConfigPath())}async createDefaultConfig(){await Ht.promises.mkdir(zt.dirname(this.configPath),{recursive:!0});let e=JSON.stringify(or,null,2);await Ht.promises.writeFile(this.configPath,e,"utf-8");let r=[this.getCollectionsPath(),this.getEnvironmentsPath(),this.getFlowsPath(),this.getSuitesPath()];for(let i of r)Ht.existsSync(i)||await Ht.promises.mkdir(i,{recursive:!0});let n=[this.getHistoryPath(),this.getResultsPath()];for(let i of n)Ht.existsSync(i)||await Ht.promises.mkdir(i,{recursive:!0});await this.createSampleEnvironments()}async createSampleEnvironments(){let e=this.getEnvironmentsPath(),r={id:"globals",name:"Global Variables",variables:{appName:"HTTP Forge"}};await Ht.promises.writeFile(zt.join(e,"globals.json"),JSON.stringify(r,null,2),"utf-8");let n={id:"env_dev",name:"Development",variables:{baseUrl:"http://localhost:3000",apiVersion:"v1"}};await Ht.promises.writeFile(zt.join(e,"dev.json"),JSON.stringify(n,null,2),"utf-8");let i={id:"default_headers",name:"Default Headers",headers:{"Content-Type":"application/json",Accept:"application/json"}};await Ht.promises.writeFile(zt.join(e,"default-headers.json"),JSON.stringify(i,null,2),"utf-8")}dispose(){for(let e of this.fileWatchers)e.dispose();this.fileWatchers=[]}}});var qz,Xf,g0=ae(()=>{"use strict";ga();qz="httpForge.cookies",Xf=class{constructor(e,r=qz){this.store=e;this.storeKey=r;this.loadCookies()}store;storeKey;cookies=new Map;loadCookies(){try{let e=this.store.get(this.storeKey);e&&(this.cookies=new Map(Object.entries(e)),this.cleanExpiredCookies())}catch(e){console.error("[CookieService] Failed to load cookies:",e)}}async saveCookies(){try{let e={};this.cookies.forEach((r,n)=>{e[n]=r}),await this.store.update(this.storeKey,e)}catch(e){console.error("[CookieService] Failed to save cookies:",e)}}getCookieKey(e,r,n){return`${r||"*"}|${n||"/"}|${e}`}get(e,r){if(r){let s=this.getCookieKey(e,r),o=this.cookies.get(s);if(o&&!this.isExpired(o))return o}let n=this.getCookieKey(e,"*"),i=this.cookies.get(n);if(i&&!this.isExpired(i))return i;for(let s of this.cookies.values())if(s.name===e&&!this.isExpired(s))if(r&&s.domain){if(this.domainMatches(r,s.domain))return s}else return s}async set(e){let r=this.getCookieKey(e.name,e.domain,e.path);this.cookies.set(r,e),await this.saveCookies()}async setFromResponse(e){for(let r of e){let n=this.getCookieKey(r.name,r.domain,r.path);this.cookies.set(n,r)}await this.saveCookies()}has(e,r){return this.get(e,r)!==void 0}async delete(e,r,n){let i=this.getCookieKey(e,r,n),s=this.cookies.delete(i);return s&&await this.saveCookies(),s}getAll(e){let r=[];for(let n of this.cookies.values())this.isExpired(n)||(e?(!n.domain||this.domainMatches(e,n.domain))&&r.push(n):r.push(n));return r}getCookieHeader(e){let r=this.getAll(e);return xt.formatCookieHeader(r)}async clear(){this.cookies.clear(),await this.saveCookies()}async clearDomain(e){let r=[];for(let[n,i]of this.cookies.entries())i.domain&&this.domainMatches(e,i.domain)&&r.push(n);for(let n of r)this.cookies.delete(n);await this.saveCookies()}parseCookieHeaders(e,r){return xt.parseCookieHeaders(e,r)}isExpired(e){return xt.isExpired(e)}cleanExpiredCookies(){let e=[];for(let[r,n]of this.cookies.entries())this.isExpired(n)&&e.push(r);for(let r of e)this.cookies.delete(r);e.length>0&&this.saveCookies()}domainMatches(e,r){return xt.domainMatches(e,r)}get count(){return this.cookies.size}}});var ed,y0=ae(()=>{"use strict";ga();ed=class{constructor(e){this.cookieService=e;this.localCache=[...e.getAll()]}cookieService;localCache=[];pendingOperations=[];get(e,r){return r?this.localCache.find(n=>n.name===e&&(!n.domain||n.domain===r||r.endsWith(n.domain))):this.localCache.find(n=>n.name===e)}has(e,r){return this.get(e,r)!==void 0}set(e){let r=this.localCache.findIndex(n=>n.name===e.name&&(!e.domain||n.domain===e.domain));r>=0?this.localCache[r]=e:this.localCache.push(e),this.pendingOperations.push({type:"set",cookie:e})}delete(e,r,n){let i=this.localCache.findIndex(s=>s.name===e&&(!r||s.domain===r||s.domain&&r.endsWith(s.domain)));return i>=0&&this.localCache.splice(i,1),this.pendingOperations.push({type:"delete",name:e,domain:r,path:n}),!0}getAll(e){return e?this.localCache.filter(r=>{let n=r.domain||"";return n===e||e.endsWith(n)}):[...this.localCache]}getCookiesForDomain(e){return this.localCache.filter(r=>{let n=r.domain||"";return n===e||e.endsWith(n)})}async setCookiesFromResponse(e,r){let n=new URL(e).hostname,i=this.cookieService.parseCookieHeaders(r,n);i.length>0&&(i.forEach(s=>{let o=this.localCache.findIndex(l=>l.name===s.name&&l.domain===(s.domain||n));o>=0?this.localCache[o]=s:this.localCache.push(s)}),await this.cookieService.setFromResponse(i))}getCookieHeader(e){let r=new URL(e).hostname,n=new URL(e).pathname,i=this.localCache.filter(s=>!(xt.isExpired(s)||s.domain&&!xt.domainMatches(r,s.domain)||!s.domain||s.path&&!n.startsWith(s.path)));if(i.length!==0)return xt.formatCookieHeader(i)}clear(){this.localCache=[],this.pendingOperations.push({type:"clear"})}async flush(){for(let e of this.pendingOperations)switch(e.type){case"set":e.cookie&&await this.cookieService.set(e.cookie);break;case"delete":e.name&&await this.cookieService.delete(e.name,e.domain,e.path);break;case"clear":await this.cookieService.clear();break}this.pendingOperations=[]}}});function Am(t){try{let e=JSON.parse(typeof t=="string"?t:t.toString("utf-8"));if(!e)return null;let r=e.environment||e,n=r.name||e.name||"imported-environment",i=r.values||r.variables||e.values||e.variables||[],s={};if(Array.isArray(i))for(let l of i){if(!l)continue;let c=l.key??l.name,d=typeof l.enabled=="boolean"?l.enabled:!0;c&&d!==!1&&(s[c]=l.value??l.initial??"")}else if(typeof i=="object"&&i!==null)for(let[l,c]of Object.entries(i))s[l]=String(c??"");let o=r._postman_exported_at?"Imported from Postman export":r.description||"";return{name:n,variables:s,description:o}}catch{return null}}async function Oz(t,e){try{let r=await e.readFile(t);return Am(r)}catch{return null}}var v0=ae(()=>{"use strict"});import*as ar from"fs";import*as Rn from"path";var td,rd,b0=ae(()=>{"use strict";jn();v0();Pm();Th();uf();td={SELECTED_ENVIRONMENT:"httpForge.selectedEnvironment",ENV_OVERRIDES_PREFIX:"httpForge.envOverrides."},rd=class{constructor(e,r,n,i,s,o=!0){this.workspaceFolder=e;this.workspaceStore=r;this.configService=n;this.fileWatcherFactory=i;this.secretStore=s;this.persistOverrides=o;let l=n.getEnvironmentsPath();this.environmentsPath=l,this.sharedConfigPath=Rn.join(l,"_global.json"),this.localConfigPath=Rn.join(l,"_global.local.json"),this.historiesPath=n.getHistoryPath(),this.selectedEnvironment=r?.get(td.SELECTED_ENVIRONMENT,"dev")??"dev",this.localGlobalValues={},this.localEnvironmentValues=new Map,this.persistOverrides&&this.loadPersistedEnvironmentOverrides(),this.loadSecretVariables(this.selectedEnvironment).catch(()=>{}),this.setupFileWatcher()}workspaceFolder;workspaceStore;configService;fileWatcherFactory;secretStore;persistOverrides;environmentsPath;sharedConfigPath;localConfigPath;historiesPath;sharedConfig=null;localConfig=null;selectedEnvironment="dev";fileWatcher;localGlobalValues={};localEnvironmentValues=new Map;secretValuesCache=new Map;onEnvironmentsChanged;setupFileWatcher(){if(!this.fileWatcherFactory||!ar.existsSync(this.environmentsPath))return;this.fileWatcher=this.fileWatcherFactory.createFileWatcher(this.environmentsPath,"**/*.json");let e=()=>{this.reload(),this.onEnvironmentsChanged?.()};this.fileWatcher.onDidChange(e),this.fileWatcher.onDidCreate(e),this.fileWatcher.onDidDelete(e)}dispose(){this.fileWatcher?.dispose()}getWorkspaceFolder(){return this.workspaceFolder}getRootPath(){return this.configService.getRootPath()}loadConfigs(){if(!ar.existsSync(this.environmentsPath)){this.sharedConfig={environments:{},globalVariables:{},defaultHeaders:{}},this.localConfig={credentials:{},variables:{}};return}this.loadFolderConfigs()}getSharedConfig(){return this.sharedConfig||this.loadConfigs(),this.sharedConfig}getLocalConfig(){return this.localConfig||this.loadConfigs(),this.localConfig}getEnvironmentNames(){let e=this.getSharedConfig();return e?.environments?Object.keys(e.environments):[]}getSelectedEnvironment(){return this.selectedEnvironment}async setSelectedEnvironment(e){if(this.selectedEnvironment=e,await this.workspaceStore?.update(td.SELECTED_ENVIRONMENT,e),!this.localEnvironmentValues.has(e)){let r=this.getEnvOverridesStateKey(e),n=this.workspaceStore?.get(r,{});n&&Object.keys(n).length>0&&this.localEnvironmentValues.set(e,{...n})}await this.loadSecretVariables(e)}getEnvOverridesStateKey(e){return`${td.ENV_OVERRIDES_PREFIX}${e||this.selectedEnvironment}`}loadPersistedEnvironmentOverrides(){let e=this.getEnvOverridesStateKey(),r=this.workspaceStore?.get(e,{});r&&Object.keys(r).length>0&&this.localEnvironmentValues.set(this.selectedEnvironment,{...r})}persistEnvironmentOverrides(e){if(!this.persistOverrides)return;let r=this.getEnvOverridesStateKey(e),n=this.localEnvironmentValues.get(e)||{};this.workspaceStore?.update(r,n)}setEnvironmentVariable(e,r,n){let i=n??this.selectedEnvironment;this.localEnvironmentValues.has(i)||this.localEnvironmentValues.set(i,{}),this.localEnvironmentValues.get(i)[e]=String(r),this.persistEnvironmentOverrides(i)}deleteEnvironmentVariable(e,r){let n=r??this.selectedEnvironment,i=this.localEnvironmentValues.get(n);i&&(delete i[e],this.persistEnvironmentOverrides(n))}clearEnvironmentVariables(e){let r=e??this.selectedEnvironment;this.localEnvironmentValues.set(r,{}),this.persistEnvironmentOverrides(r)}async resetEnvironmentOverrides(e){let r=e||this.selectedEnvironment;this.localEnvironmentValues.delete(r),await this.workspaceStore?.update(this.getEnvOverridesStateKey(r),void 0)}getEnvironmentVariableLocal(e){return this.localEnvironmentValues.get(this.selectedEnvironment)?.[e]}getEnvironmentVariableLocals(){return{...this.localEnvironmentValues.get(this.selectedEnvironment)||{}}}setGlobalVariable(e,r){this.localGlobalValues[e]=String(r)}getGlobalVariable(e){return this.getSharedConfig()?.globalVariables?.[e]}getGlobalVariableLocal(e){return this.localGlobalValues[e]}getGlobalVariables(){return{...this.getSharedConfig()?.globalVariables||{},...this.getLocalConfig()?.variables||{},...this.localGlobalValues}}getGlobalVariableLocals(){return{...this.localGlobalValues}}deleteGlobalVariable(e){delete this.localGlobalValues[e]}clearGlobalVariables(){this.localGlobalValues={}}getResolvedEnvironment(e){let r=e||this.selectedEnvironment,n=this.getSharedConfig(),i=this.getLocalConfig();if(!n?.environments?.[r])return null;let s=n.environments[r],o=i?.credentials?.[r],l=i?.variables||{},c=o?.variables||{},d=o&&o.headers||{},p=Zc(n.defaultHeaders||{},d),m=this.localEnvironmentValues.get(r)||{},y=this.secretValuesCache.get(r)||{},b={...s.variables||{},...c,...m,...y};return{name:r,description:s.description,requiresConfirmation:s.requiresConfirmation,headers:p,variables:b}}async getSecretVariable(e,r){return this.secretStore?.get(`${e}:${r}`)}async setSecretVariable(e,r,n){await this.secretStore?.store(`${e}:${r}`,n),this.secretValuesCache.has(e)||this.secretValuesCache.set(e,{}),this.secretValuesCache.get(e)[r]=n}async deleteSecretVariable(e,r){await this.secretStore?.delete(`${e}:${r}`),this.secretValuesCache.get(e)&&delete this.secretValuesCache.get(e)[r]}async loadSecretVariables(e){if(!this.secretStore)return;let r=e||this.selectedEnvironment,n=this.getSharedConfig()?.environments?.[r]?.secretVariables??[];if(n.length===0)return;let i={};await Promise.all(n.map(async s=>{let o=await this.secretStore.get(`${r}:${s}`);o!==void 0&&(i[s]=o)})),this.secretValuesCache.set(r,i)}resolveVariables(e,r){return this.createResolver(r).resolveString(e,!0)}exportEnvironmentsToFolder(e,r=!0){let n=this.getEnvironmentNames(),i=this.getSharedConfig(),s=i?.globalVariables?{...i.globalVariables}:{};if(!r&&Object.keys(s).length){let o=Rn.join(e,"globals.env");Cu(o,s)}n.forEach(o=>{let l=i?.environments?.[o];if(!l)return;let c={...l.variables||{}};r&&(c={...s,...c});let d=Rn.join(e,`${Vt(o)}.env`);Cu(d,c)})}resolveVariablesWithExtra(e,r,n){return this.createResolver(n,r).resolveString(e,!0)}resolveVariablesInObject(e,r){return this.createResolver(r).resolveObject(e,!0)}resolveVariablesInObjectWithExtra(e,r,n){return this.createResolver(n,r).resolveObject(e,!0)}getHistoriesPath(){return this.historiesPath}getSharedConfigPath(){return this.sharedConfigPath}getLocalConfigPath(){return this.localConfigPath}getEnvironmentConfigPath(e){return Rn.join(this.environmentsPath,`${e}.json`)}localConfigExists(){return ar.existsSync(this.localConfigPath)}saveSharedConfig(e){this.saveFolderSharedConfig(e),this.sharedConfig=e}saveLocalConfig(e){let r={variables:e.variables||{}};this.saveJsonFile(this.localConfigPath,r);for(let[n,i]of Object.entries(e.credentials||{})){let s=this.getEnvLocalConfigPath(n),o={variables:i.variables||{}};this.saveJsonFile(s,o)}this.localConfig=e}importPostmanEnvironmentFile(e){try{let r=ar.readFileSync(e,"utf-8"),n=Am(r);if(!n)throw new Error("Failed to parse Postman environment file");this.sharedConfig||this.loadConfigs(),this.sharedConfig||(this.sharedConfig={environments:{},globalVariables:{},defaultHeaders:{}});let i=n.name||`imported-${Date.now()}`;return this.sharedConfig.environments=this.sharedConfig.environments||{},this.sharedConfig.environments[i]=this.sharedConfig.environments[i]||{},this.sharedConfig.environments[i].variables=n.variables,n.description&&(this.sharedConfig.environments[i].description=n.description),this.saveSharedConfig(this.sharedConfig),n}catch(r){throw console.error("[EnvironmentConfigService] importPostmanEnvironmentFile failed:",r),r}}saveEnvLocalConfig(e,r){let n=this.getEnvLocalConfigPath(e),i={variables:r};this.saveJsonFile(n,i),this.localConfig||(this.localConfig={credentials:{},variables:{}}),this.localConfig.credentials||(this.localConfig.credentials={}),this.localConfig.credentials[e]={variables:r}}getEnvLocalPath(e){return this.getEnvLocalConfigPath(e)}getEnvLocalConfigPath(e){return Rn.join(this.environmentsPath,`${e}.local.json`)}loadFolderConfigs(){let e=nf(this.environmentsPath);this.sharedConfig={environments:e.environments,globalVariables:e.globalVariables,defaultHeaders:e.defaultHeaders},this.localConfig={credentials:e.localCredentials,variables:e.localVariables}}createResolver(e,r){let i=this.getResolvedEnvironment(e)?.variables||{},s=this.getGlobalVariables(),o=this.getGlobalVariableLocals();return new Sa({globals:s,collectionVariables:{},environmentVariables:i,variables:{...o,...r||{}}})}saveFolderSharedConfig(e){ar.existsSync(this.environmentsPath)||ar.mkdirSync(this.environmentsPath,{recursive:!0});let r={variables:e.globalVariables||{},defaultHeaders:e.defaultHeaders||{}};this.saveJsonFile(this.sharedConfigPath,r);let n=ar.readdirSync(this.environmentsPath).filter(s=>s.endsWith(".json")).filter(s=>!Ah(s)),i=new Set(Object.keys(e.environments||{}));for(let s of n){let o=Rn.basename(s,".json");if(!i.has(o))try{ar.unlinkSync(Rn.join(this.environmentsPath,s))}catch{}}for(let[s,o]of Object.entries(e.environments||{})){let l={name:s,description:o.description,requiresConfirmation:o.requiresConfirmation,variables:o.variables||{}};this.saveJsonFile(Rn.join(this.environmentsPath,`${s}.json`),l)}}reload(){this.sharedConfig=null,this.localConfig=null,this.loadConfigs()}getAllEnvironments(){return this.loadConfigs(),this.sharedConfig?Object.entries(this.sharedConfig.environments).map(([e,r])=>({id:e,name:e,active:e===this.selectedEnvironment,variables:r.variables||{}})):[]}async setActiveEnvironment(e){await this.setSelectedEnvironment(e)}async createEnvironment(e){if(this.loadConfigs(),this.sharedConfig||(this.sharedConfig={environments:{},globalVariables:{}}),this.sharedConfig.environments[e])throw new Error(`Environment "${e}" already exists`);this.sharedConfig.environments[e]={description:`Created ${new Date().toISOString()}`,variables:{}},this.saveSharedConfig(this.sharedConfig)}async deleteEnvironment(e){if(this.loadConfigs(),this.validateConfigLoaded(),this.validateEnvironmentExists(e),delete this.sharedConfig.environments[e],this.selectedEnvironment===e){let r=Object.keys(this.sharedConfig.environments);this.selectedEnvironment=r.length>0?r[0]:"dev",await this.workspaceStore?.update(td.SELECTED_ENVIRONMENT,this.selectedEnvironment)}this.saveSharedConfig(this.sharedConfig)}async duplicateEnvironment(e,r){this.loadConfigs(),this.validateConfigLoaded(),this.validateEnvironmentName(r),this.validateEnvironmentExists(e),this.validateEnvironmentNameNotTaken(r);let n=this.sharedConfig.environments[e];this.sharedConfig.environments[r]=JSON.parse(JSON.stringify(n)),this.sharedConfig.environments[r].description=`Copied from ${e}`,this.saveSharedConfig(this.sharedConfig)}async renameEnvironment(e,r){this.loadConfigs(),this.validateConfigLoaded(),this.validateEnvironmentName(r),this.validateEnvironmentExists(e),r!==e&&(this.validateEnvironmentNameNotTaken(r),this.sharedConfig.environments[r]=this.sharedConfig.environments[e],delete this.sharedConfig.environments[e],this.selectedEnvironment===e&&(this.selectedEnvironment=r,await this.workspaceStore?.update(td.SELECTED_ENVIRONMENT,r)),this.saveSharedConfig(this.sharedConfig))}validateEnvironmentName(e){if(!e||e.trim().length===0)throw new Error("Environment name cannot be empty");if(e.length>128)throw new Error("Environment name cannot exceed 128 characters");if(!/^[a-zA-Z0-9_\-\.]+$/.test(e))throw new Error("Environment name can only contain letters, numbers, hyphens, underscores, and dots")}validateEnvironmentExists(e){if(!this.sharedConfig?.environments?.[e])throw new Error(`Environment "${e}" not found`)}validateEnvironmentNameNotTaken(e){if(this.sharedConfig?.environments?.[e])throw new Error(`Environment "${e}" already exists`)}validateConfigLoaded(){if(!this.sharedConfig)throw new Error("No environment configuration loaded")}async updateEnvironmentVariables(e,r){if(this.loadConfigs(),!this.sharedConfig)throw new Error("No configuration loaded");let n=this.sharedConfig.environments[e];if(!n)throw new Error(`Environment "${e}" not found`);n.variables=r,this.saveSharedConfig(this.sharedConfig)}loadJsonFile(e){try{if(!ar.existsSync(e))return null;let r=ar.readFileSync(e,"utf-8");return JSON.parse(r)}catch(r){return console.error(`Failed to load JSON from ${e}:`,r),null}}saveJsonFile(e,r){try{let n=Rn.dirname(e);ar.existsSync(n)||ar.mkdirSync(n,{recursive:!0}),ar.writeFileSync(e,JSON.stringify(r,null,2),"utf-8")}catch(n){throw console.error(`Failed to save JSON to ${e}:`,n),n}}}});var bo,Tm=ae(()=>{"use strict";Hf();bo=class t{constructor(e,r,n,i,s,o,l,c,d,p,m,y,b){this.httpService=e;this.scriptExecutor=r;this.envConfigService=n;this.requestPreparer=i;this.environment=s;this.cookieJar=o;this.collectionScripts=l;this.folderScriptsChain=c;this.onConsoleOutput=d;this.collectionName=p;this.collectionAuth=m;this.iteration=y;this.iterationCount=b}httpService;scriptExecutor;envConfigService;requestPreparer;environment;cookieJar;collectionScripts;folderScriptsChain;onConsoleOutput;collectionName;collectionAuth;iteration;iterationCount;async execute(e,r,n){let i=Date.now();return this.executeWithSession(e,r,n,i)}async executeWithSession(e,r,n,i){let s=this.collectPreRequestScripts(e),o=this.collectPostResponseScripts(e),l=this.envConfigService.getResolvedEnvironment(this.environment);if(!l)throw new Error(`Environment "${this.environment}" not found or not configured`);let c=this.envConfigService.getGlobalVariables(),d={request:e,variables:{...r},environmentVariables:l.variables||{},globals:{...c},environmentName:this.environment,cookieJar:this.cookieJar,info:{eventName:"prerequest",requestName:e.name,requestId:e.id,collectionName:this.collectionName,iteration:this.iteration,iterationCount:this.iterationCount},onEnvironmentChange:async(y,b,E)=>{y==="set"&&b&&E!==void 0?this.envConfigService.setEnvironmentVariable(b,E,this.environment):y==="unset"&&b?this.envConfigService.deleteEnvironmentVariable(b,this.environment):y==="clear"&&this.envConfigService.clearEnvironmentVariables(this.environment)},onGlobalsChange:(y,b,E)=>{y==="set"&&b&&E!==void 0?this.envConfigService.setGlobalVariable(b,E):y==="unset"&&b?this.envConfigService.deleteGlobalVariable(b):y==="clear"&&this.envConfigService.clearGlobalVariables()}},p=this.scriptExecutor.createRequestSession(d),m=null;try{let y={...r},b={...e},E;if((!b.auth||b.auth.type==="inherit")&&(b.auth=this.collectionAuth&&this.collectionAuth.type!=="inherit"?this.collectionAuth:void 0),s.length>0){let D=await p.executePreRequest(s);if(D.consoleOutput&&D.consoleOutput.length>0&&this.onConsoleOutput?.(D.consoleOutput,{requestName:e.name||"",phase:"pre-request"}),D.nextRequest!==void 0&&(E=D.nextRequest),D.skipRequest){let J={type:"none",content:null};return{requestId:e.id,name:e.name,executedRequest:{url:e.url||"",method:e.method||"GET",headers:{},body:J,params:{},query:{}},response:{status:0,statusText:"Skipped",headers:{},body:null,time:0,cookies:[]},duration:Date.now()-i,timestamp:Date.now(),passed:!0,assertions:[],modifiedVariables:y,nextRequest:E}}D.success&&(D.modifiedRequest&&(D.modifiedRequest.url&&(b.url=D.modifiedRequest.url),D.modifiedRequest.headers&&(b.headers=D.modifiedRequest.headers),D.modifiedRequest.params&&(b.params=D.modifiedRequest.params),D.modifiedRequest.query&&(b.query=D.modifiedRequest.query),D.modifiedRequest.body!==void 0&&(b.body=D.modifiedRequest.body)),(D.localVariables??D.modifiedVariables)&&(y=D.localVariables??D.modifiedVariables))}m=await this.requestPreparer.prepareRequest(b,this.environment,l,y);let{url:C,headers:v,body:_,method:q}=m,k={};for(let D in v)Object.prototype.hasOwnProperty.call(v,D)&&(k[D.toUpperCase()]=v[D]);if(!k.COOKIE&&b.settings?.includeCookies!==!1&&this.cookieJar){let J=this.cookieJar.getCookieHeader(C);J&&(k.COOKIE=J)}let O={method:q,url:C,headers:k,body:_.content,signal:n,settings:b.settings?{...b.settings}:void 0},M=await this.httpService.execute(O);this.cookieJar&&M.headers&&await this.cookieJar.setCookiesFromResponse(C,M.headers);let j=Date.now()-i,I=[],R={},A;if(o.length>0){let D=0;if(M.body)if(typeof M.body=="string")D=Buffer.byteLength(M.body,"utf8");else if(Buffer.isBuffer(M.body))D=M.body.length;else try{D=Buffer.byteLength(JSON.stringify(M.body),"utf8")}catch{D=0}let J=Cm(M.headers,M.cookies,m.url),Q={executedRequest:m,status:M.status,statusText:M.statusText,headers:r0(M.headers||{}),body:M.body,cookies:J,responseTime:M.time,responseSize:D},se=await p.executePostResponse(o,Q);I=se.testResults,R=se.modifiedEnvironmentVariables||{},A=se.visualizerData,(se.localVariables??se.modifiedVariables)&&(y=se.localVariables??se.modifiedVariables),se.nextRequest!==void 0&&(E=se.nextRequest),se.consoleOutput&&se.consoleOutput.length>0&&this.onConsoleOutput?.(se.consoleOutput,{requestName:e.name||"",phase:"post-response"})}let F=I.length===0||I.every(D=>D.passed),U=I.length>0?F:M.status>=200&&M.status<=302;return{requestId:e.id,name:e.name,executedRequest:{...m,headers:k},response:{status:M.status,statusText:M.statusText,headers:M.headers||{},body:M.body,time:M.time||j,cookies:M.cookies||[]},duration:j,timestamp:Date.now(),passed:U,assertions:I,modifiedVariables:y,modifiedEnvironmentVariables:R,nextRequest:E,visualizerData:A}}catch(y){return this.handleError(e,m,y,i)}finally{p.dispose?.()}}collectPreRequestScripts(e){let r=[];if(this.collectionScripts?.preRequest&&r.push(this.collectionScripts.preRequest),this.folderScriptsChain)if(Array.isArray(this.folderScriptsChain))for(let n of this.folderScriptsChain)n?.preRequest&&r.push(n.preRequest);else this.folderScriptsChain.preRequest&&r.push(this.folderScriptsChain.preRequest);return e.scripts?.preRequest&&r.push(e.scripts.preRequest),r}collectPostResponseScripts(e){let r=[];if(e.scripts?.postResponse&&r.push(e.scripts.postResponse),this.folderScriptsChain)if(Array.isArray(this.folderScriptsChain)){let n=[...this.folderScriptsChain].reverse();for(let i of n)i?.postResponse&&r.push(i.postResponse)}else this.folderScriptsChain.postResponse&&r.push(this.folderScriptsChain.postResponse);return this.collectionScripts?.postResponse&&r.push(this.collectionScripts.postResponse),r}handleError(e,r,n,i){let s=Date.now()-i,o=r?.method||e.method,l=r?.url||e.url;this.onConsoleOutput?.([`${n.message||n}`],{requestName:e.name||"",phase:"error"});let c=String(n.name==="AbortError"?"Request was aborted":n.message||n),d=n?.stack?String(n.stack):"",p=this.errorBodyFormat,m,y;p==="html"||p==="both"?(m=t.formatErrorAsHtml(c,d),y={"content-type":"text/html; charset=utf-8"}):(m=c,y={});let b={type:"none",content:null};return{requestId:e.id,name:e.name,executedRequest:{url:l||"",method:o||"GET",headers:r?.headers||{},body:r?.body||b,params:r?.params||{},query:r?.query||{}},response:{status:0,statusText:n.name==="AbortError"?"Aborted":n.code||n.message||"Request Error",headers:y,cookies:[],body:m,time:0},duration:s,timestamp:Date.now(),passed:!1,assertions:[],error:c}}get errorBodyFormat(){return"text"}static formatErrorAsHtml(e,r){let n=i=>i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");return`<!doctype html>
|
|
54
|
+
`)}function Sz(t){let e=t.url;if(t.query&&t.query.length){let r=t.query.filter(n=>n.enabled!==!1).map(n=>`${encodeURIComponent(n.key)}=${encodeURIComponent(n.value)}`).join("&");r&&(e+=(e.includes("?")?"&":"?")+r)}return e}var Pm=ae(()=>{"use strict";jn()});import*as xr from"fs";import*as c0 from"path";var xu,f0=ae(()=>{"use strict";jn();xu=class{collectionsDir;cache=new Map;constructor(e){this.collectionsDir=e,this.ensureDirectory()}ensureDirectory(){xr.existsSync(this.collectionsDir)||xr.mkdirSync(this.collectionsDir,{recursive:!0})}loadAll(){if(this.cache.clear(),!xr.existsSync(this.collectionsDir))return[];let e=xr.readdirSync(this.collectionsDir),r=[];for(let n of e)if(n.endsWith(".json"))try{let i=c0.join(this.collectionsDir,n),s=xr.readFileSync(i,"utf-8"),o=JSON.parse(s);o.id&&o.name&&(this.cache.set(o.id,o),r.push(o))}catch(i){console.error(`[JsonCollectionLoader] Failed to load ${n}:`,i)}return r}load(e){if(this.cache.has(e))return this.cache.get(e);let r=this.getCollectionPath(e);if(xr.existsSync(r))try{let n=xr.readFileSync(r,"utf-8"),i=JSON.parse(n);return this.cache.set(e,i),i}catch(n){console.error(`[JsonCollectionLoader] Failed to load collection ${e}:`,n);return}}async save(e){if(this.ensureDirectory(),!e.name)throw new Error("Collection name is required");e.id||(e.id=Pt(e.name));let r=this.getCollectionPath(e.id),n=JSON.stringify(e,null,2);await xr.promises.writeFile(r,n,"utf-8"),this.cache.set(e.id,e)}async delete(e){let r=this.getCollectionPath(e);if(!xr.existsSync(r))return!1;try{return await xr.promises.unlink(r),this.cache.delete(e),!0}catch(n){return console.error(`[JsonCollectionLoader] Failed to delete collection ${e}:`,n),!1}}exists(e){return xr.existsSync(this.getCollectionPath(e))}getCollectionPath(e){return c0.join(this.collectionsDir,`${e}.json`)}getItemPath(e,r){}async create(e,r){let n={id:r||Pt(e),name:e,items:[]};return await this.save(n),n}async saveScripts(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.findItemById(i.items,r);s&&(s.scripts=n,await this.save(i))}loadScripts(e,r){let n=this.load(e);return n?this.findItemById(n.items,r)?.scripts:void 0}async updateCollectionMetadata(e,r){let n=this.load(e);if(!n)throw new Error(`Collection ${e} not found`);r.name!==void 0&&(n.name=r.name),r.description!==void 0&&(n.description=r.description),r.version!==void 0&&(n.version=r.version),r.variables!==void 0&&(n.variables=r.variables),r.auth!==void 0&&(n.auth=r.auth),await this.save(n)}async saveItem(e,r,n){let i=this.load(e);if(!i)throw new Error(`Collection ${e} not found`);let s=this.findItemById(i.items,r.id);if(s)Object.assign(s,r);else if(n){let o=this.findItemById(i.items,n);if(o&&o.type==="folder")o.items=o.items||[],o.items.push(r);else throw new Error(`Parent folder ${n} not found`)}else i.items.push(r);await this.save(i)}async deleteItem(e,r){let n=this.load(e);if(!n)return!1;let i=this.deleteItemById(n.items,r);return i&&await this.save(n),i}async updateItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.findItemById(i.items,r);if(!s)return!1;let{id:o,type:l,...c}=n;return Object.assign(s,c),await this.save(i),!0}async moveItem(e,r,n){let i=this.load(e);if(!i)return!1;let s=this.findItemById(i.items,r);if(!s)return!1;let o={...s};if(!this.deleteItemById(i.items,r))return!1;if(n){let l=this.findItemById(i.items,n);if(l&&l.type==="folder")l.items=l.items||[],l.items.push(o);else return i.items.push(o),!1}else i.items.push(o);return await this.save(i),!0}async reorderItems(e,r,n){let i=this.load(e);if(!i)return!1;try{let s;if(r){let c=this.findItemById(i.items,r);if(!c||!c.items)return!1;s=c.items}else s=i.items;let o=new Map(s.map(c=>[c.id,c])),l=[];for(let c of n){let d=o.get(c);d&&(l.push(d),o.delete(c))}for(let c of o.values())l.push(c);if(r){let c=this.findItemById(i.items,r);c&&(c.items=l)}else i.items=l;return await this.save(i),!0}catch(s){return console.error("[JsonCollectionLoader] Failed to reorder items:",s),!1}}findItemById(e,r){for(let n of e){if(n.id===r)return n;if(n.type==="folder"&&n.items){let i=this.findItemById(n.items,r);if(i)return i}}}deleteItemById(e,r){for(let n=0;n<e.length;n++){if(e[n].id===r)return e.splice(n,1),!0;let i=e[n];if(i.type==="folder"&&i.items&&this.deleteItemById(i.items,r))return!0}return!1}}});var Qf,d0=ae(()=>{"use strict";Ph();f0();Qf=class{static create(e){let r=e.getStorageConfig(),n=e.getCollectionsPath();return r.format==="folder"?new so(n):new xu(n)}static createForFormat(e,r){return e==="folder"?new so(r):new xu(r)}}});import*as Dt from"fs";import*as hi from"path";function pP(t){if(typeof t!="string")return"text";let e=t.trim();try{let r=JSON.parse(e);if(typeof r=="object"&&r!==null)return"json"}catch{}return/^<\?xml/.test(e)||/^<([a-zA-Z_][\w\-\.]*)[\s>]/.test(e)?/^<\!DOCTYPE html>/i.test(e)||/^<html[\s>]/i.test(e)?"html":"xml":/^<\!DOCTYPE html>/i.test(e)||/^<html[\s>]/i.test(e)?"html":/^(function\s*\(|\(\)\s*=>|const |let |var |export |import )/.test(e)?"javascript":"text"}function wz(t){return{info:{name:t.name,_postman_id:t.id,schema:"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},item:t.items.map(e=>hP(e)),event:p0(t.scripts),variable:t.variables?Object.entries(t.variables).map(([e,r])=>({key:e,value:r})):[]}}function hP(t){if(t.type==="folder")return{name:t.name,item:t.items?t.items.map(hP):[],event:p0(t.scripts)};if(t.type==="request"){let e=t;return{name:e.name,request:{method:e.method,header:(e.headers||[]).map(_z),url:Rz(e),body:Cz(e),auth:xz(e.auth),description:e.description},event:p0(e.scripts),protocolProfileBehavior:Ez(e.settings)}}}function _z(t){return{key:t.key,value:t.value,disabled:t.enabled===!1,...t.description!==void 0?{description:t.description}:{},...t.type!==void 0?{type:t.type}:{},...t.required!==void 0?{required:t.required}:{},...t.format!==void 0?{format:t.format}:{},...t.enum!==void 0?{enum:t.enum}:{},...t.deprecated!==void 0?{deprecated:t.deprecated}:{},...t.pattern!==void 0?{pattern:t.pattern}:{},...t.minLength!==void 0?{minLength:t.minLength}:{},...t.maxLength!==void 0?{maxLength:t.maxLength}:{},...t.minimum!==void 0?{minimum:t.minimum}:{},...t.maximum!==void 0?{maximum:t.maximum}:{},...t.exclusiveMinimum!==void 0?{exclusiveMinimum:t.exclusiveMinimum}:{},...t.exclusiveMaximum!==void 0?{exclusiveMaximum:t.exclusiveMaximum}:{},...t.multipleOf!==void 0?{multipleOf:t.multipleOf}:{},...t.minItems!==void 0?{minItems:t.minItems}:{},...t.maxItems!==void 0?{maxItems:t.maxItems}:{},...t.uniqueItems!==void 0?{uniqueItems:t.uniqueItems}:{},...t.nullable!==void 0?{nullable:t.nullable}:{},...t.oneOf!==void 0?{oneOf:t.oneOf}:{}}}function Rz(t){let e=t.url,r=t.url.replace(/^[a-zA-Z]+:\/\//,""),n=[],i=r.match(/^([^\/\?]+)/);if(i){let d=i[1];/^{{.*}}$/.test(d)?n=[d]:n=d.split(".")}let s=[],o=r.match(/^[^\/\?]+(\/[^\?]*)?/);if(o&&o[1]!==void 0){let d=o[1].replace(/^\//,"");d.endsWith("/")?(s=d.slice(0,-1).split("/"),s.push("")):s=d.length>0?d.split("/"):[]}let l;if(Array.isArray(t.query)&&t.query.length>0)l=t.query.map(d=>{let p={key:d.key,value:d.value};return d.enabled===!1&&(p.disabled=!0),d.description!==void 0&&(p.description=d.description),d.type!==void 0&&(p.type=d.type),d.required!==void 0&&(p.required=d.required),d.format!==void 0&&(p.format=d.format),d.enum!==void 0&&(p.enum=d.enum),d.deprecated!==void 0&&(p.deprecated=d.deprecated),d.pattern!==void 0&&(p.pattern=d.pattern),d.minLength!==void 0&&(p.minLength=d.minLength),d.maxLength!==void 0&&(p.maxLength=d.maxLength),d.minimum!==void 0&&(p.minimum=d.minimum),d.maximum!==void 0&&(p.maximum=d.maximum),d.exclusiveMinimum!==void 0&&(p.exclusiveMinimum=d.exclusiveMinimum),d.exclusiveMaximum!==void 0&&(p.exclusiveMaximum=d.exclusiveMaximum),d.multipleOf!==void 0&&(p.multipleOf=d.multipleOf),d.minItems!==void 0&&(p.minItems=d.minItems),d.maxItems!==void 0&&(p.maxItems=d.maxItems),d.uniqueItems!==void 0&&(p.uniqueItems=d.uniqueItems),d.nullable!==void 0&&(p.nullable=d.nullable),d.oneOf!==void 0&&(p.oneOf=d.oneOf),p});else{let d=r.indexOf("?");d!==-1&&(l=r.substring(d+1).split("&").map(m=>{let[y,...b]=m.split("=");return{key:y,value:b.join("=")}}))}let c;return t.params&&typeof t.params=="object"&&(c=Object.entries(t.params).map(([d,p])=>({key:d,value:String(p)}))),{raw:e,host:n.length>0?n:void 0,path:s.length>0?s:void 0,query:l&&l.length>0?l:void 0,variable:c&&c.length>0?c:void 0}}function Cz(t){if(!t.body)return;let e=t.body;if(typeof e=="string"){let s=pP(e);return{mode:"raw",raw:e,options:{raw:{language:s}}}}if(e.type==="raw"){let s=e.format||pP(e.content);return{mode:"raw",raw:e.content,options:{raw:{language:s}}}}let r=e.type==="form-data"&&Array.isArray(e.content)?e.content:e.type==="formdata"&&Array.isArray(e.fields)?e.fields:null;if(r)return{mode:"formdata",formdata:r.map(s=>({key:s.key,value:s.value,type:s.type||"text",disabled:s.enabled===!1}))};let n=e.type==="x-www-form-urlencoded"&&Array.isArray(e.content)?e.content:e.type==="urlencoded"&&Array.isArray(e.fields)?e.fields:null;if(n)return{mode:"urlencoded",urlencoded:n.map(s=>({key:s.key,value:s.value,disabled:s.enabled===!1}))};if(e.type==="file"&&e.fileName)return{mode:"file",file:{src:e.fileName}};if(e.type==="binary")return{mode:"binary",file:{}};let i=e.type==="graphql"?e.content??(e.query?e:null):null;if(i){let s=i.query??"",o=i.variables;return{mode:"graphql",graphql:{query:s,variables:o?typeof o=="string"?o:JSON.stringify(o):void 0}}}if(e.content)return{mode:"raw",raw:e.content}}function xz(t){if(!(!t||!t.type||t.type==="none")){if(t.type==="bearer")return{type:"bearer",bearer:[{key:"token",value:t.bearerToken,type:"string"}]};if(t.type==="basic"&&t.basicAuth)return{type:"basic",basic:[{key:"username",value:t.basicAuth.username,type:"string"},{key:"password",value:t.basicAuth.password,type:"string"}]}}}function Ez(t){if(!t)return;let e={};return t.followRedirects===!1&&(e.followRedirects=!1),t.followOriginalMethod===!0&&(e.followOriginalHttpMethod=!0),t.followAuthHeader===!1&&(e.followAuthorizationHeader=!1),t.maxRedirects!==void 0&&(e.maxRedirects=t.maxRedirects),t.strictSSL===!1&&(e.disableUrlEncoding=!1),t.timeout!==void 0&&(e.requestTimeout=t.timeout),Object.keys(e).length>0?e:void 0}function p0(t){if(!t)return[];let e=[];return t.preRequest&&e.push({listen:"prerequest",script:{type:"text/javascript",exec:[t.preRequest]}}),t.postResponse&&e.push({listen:"test",script:{type:"text/javascript",exec:[t.postResponse]}}),e}var Zf,h0=ae(()=>{"use strict";jn();Pm();d0();Zf=class{constructor(e,r,n){this.workspaceRoot=e;this.configService=r;this.fileWatcherFactory=n;this.collectionsDir=r.getCollectionsPath(),this.loader=Qf.create(r),this.ensureCollectionsDir(),this.loadCollections(),this.setupFileWatcher()}workspaceRoot;configService;fileWatcherFactory;collectionsDir;collections=new Map;fileWatcher;loader;debounceTimer=null;selfWritePending=!1;localCollectionValues=new Map;onCollectionsChanged;ensureCollectionsDir(){Dt.existsSync(this.collectionsDir)||Dt.mkdirSync(this.collectionsDir,{recursive:!0})}loadCollections(){this.collections.clear();let e=this.loader.loadAll();for(let r of e)this.collections.set(r.id,r)}setupFileWatcher(){if(!this.fileWatcherFactory)return;this.fileWatcher=this.fileWatcherFactory.createFileWatcher(this.collectionsDir,"**/*");let e=()=>{this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null;let r=this.selfWritePending;this.selfWritePending=!1,r||this.loadCollections(),this.onCollectionsChanged?.()},300)};this.fileWatcher.onDidChange(e),this.fileWatcher.onDidCreate(e),this.fileWatcher.onDidDelete(e)}getAllCollections(){return Array.from(this.collections.values())}getCollection(e){return this.collections.get(e)}getCollectionById(e){for(let r of this.collections.values())if(r.id===e)return r}getCollectionByName(e){let r=e.toLowerCase();for(let n of this.collections.values())if(n.name.toLowerCase()===r)return n}async saveCollection(e){if(this.ensureCollectionsDir(),!e.name)throw new Error("Collection name is required");e.id||(e.id=Pt(e.name)),this.selfWritePending=!0,await this.loader.save(e),this.collections.set(e.id,e)}getCollectionVariables(e){let r=this.collections.get(e);return r?.variables?{...r.variables}:{}}getCollectionVariableLocals(e){return{...this.localCollectionValues.get(e)||{}}}setCollectionVariable(e,r,n){this.localCollectionValues.has(e)||this.localCollectionValues.set(e,{}),this.localCollectionValues.get(e)[r]=String(n)}deleteCollectionVariable(e,r){let n=this.localCollectionValues.get(e);n&&delete n[r]}clearCollectionVariables(e){this.localCollectionValues.set(e,{})}async deleteCollection(e){if(!this.collections.get(e))return!1;this.selfWritePending=!0;let n=await this.loader.delete(e);return n&&this.collections.delete(e),n}findRequest(e,r){let n=this.collections.get(e);if(n)return this.findItemRecursive(n.items,r)}findRequestByPath(e,r){let n=this.collections.get(e);if(!n)return;let i=r.split("/").filter(s=>s.trim());return this.findItemByPath(n.items,i)}async updateRequest(e,r,n){let i=this.collections.get(e);if(!i)return!1;this.selfWritePending=!0;let s=await this.loader.updateItem(e,r,n);if(s){let o=this.findItemRecursive(i.items,r);if(o){let{id:l,type:c,...d}=n;Object.assign(o,d)}}return s}async addRequest(e,r,n){if(!this.collections.get(e))return!1;r.id||(r.id=Pt(r.name)),this.selfWritePending=!0;try{return await this.loader.saveItem(e,r,n),!0}catch(s){return console.error("[CollectionService] Failed to add request:",s),!1}}async deleteRequest(e,r){let n=this.collections.get(e);if(!n)return!1;this.selfWritePending=!0;let i=await this.loader.deleteItem(e,r);return i&&this.deleteItemRecursive(n.items,r),i}getAllRequests(e){let r=this.collections.get(e);if(!r)return[];let n=[];return this.collectRequestsRecursive(r.items,n),n}findItemRecursive(e,r){for(let n of e){if(n.id===r)return n;if(n.type==="folder"&&n.items){let i=this.findItemRecursive(n.items,r);if(i)return i}}}findItemByPath(e,r){if(r.length===0)return;let[n,...i]=r,s=e.find(o=>o.name===n);if(s){if(i.length===0)return s;if(s.type==="folder"&&s.items)return this.findItemByPath(s.items,i)}}updateItemRecursive(e,r,n){for(let i=0;i<e.length;i++){let s=e[i];if(s.id===r)return e[i]={...s,...n},!0;if(s.type==="folder"&&s.items&&this.updateItemRecursive(s.items,r,n))return!0}return!1}deleteItemRecursive(e,r){for(let n=0;n<e.length;n++){let i=e[n];if(i.id===r)return e.splice(n,1),!0;if(i.type==="folder"&&i.items&&this.deleteItemRecursive(i.items,r))return!0}return!1}collectRequestsRecursive(e,r){for(let n of e)n.type==="request"?r.push(n):n.type==="folder"&&n.items&&this.collectRequestsRecursive(n.items,r)}async createCollection(e){let r={id:Pt(e),name:e,items:[]};return await this.saveCollection(r),r}async renameCollection(e,r){let n=this.collections.get(e);return n?(n.name=r,await this.saveCollection(n),!0):!1}async duplicateCollection(e,r){if(!this.collections.get(e))throw new Error(`Collection not found: ${e}`);this.selfWritePending=!0;let i=Pt(r),s=this.loader.getCollectionPath(e),o=hi.join(this.collectionsDir,i);if(!Dt.existsSync(s))throw new Error(`Collection directory not found: ${s}`);this.copyDirRecursive(s,o);let l=hi.join(o,"collection.json");if(Dt.existsSync(l)){let d=JSON.parse(Dt.readFileSync(l,"utf-8"));d.id=i,d.name=r,Dt.writeFileSync(l,JSON.stringify(d,null,2))}else Dt.writeFileSync(l,JSON.stringify({id:i,name:r},null,2));this.loadCollections();let c=this.collections.get(i);if(!c)throw new Error("Failed to load duplicated collection");return c}async createFolder(e){if(!this.collections.get(e.collectionId))throw new Error("Collection not found");this.selfWritePending=!0;let n={id:Pt(e.name),type:"folder",name:e.name,items:[]};await this.loader.saveItem(e.collectionId,n,e.parentId);let i=this.loader.load(e.collectionId);return i&&this.collections.set(e.collectionId,i),n}async deleteFolder(e,r){let n=this.collections.get(e);if(!n)return!1;this.selfWritePending=!0;let i=await this.loader.deleteItem(e,r);return i&&this.deleteItemById(n.items,r),i}async renameFolder(e,r,n){let i=this.collections.get(e);if(!i)return!1;this.selfWritePending=!0;let s=await this.loader.updateItem(e,r,{name:n});if(s){let o=this.findItemById(i.items,r);o&&(o.name=n)}return s}async duplicateFolder(e,r,n){if(!this.collections.get(e))throw new Error("Collection not found");let s=this.loader.getItemPath(e,r);if(!s||!Dt.existsSync(s))throw new Error(`Folder not found on disk: ${r}`);let o=hi.dirname(s),l=Pt(n),c=hi.join(o,l);this.selfWritePending=!0,this.copyDirRecursive(s,c);let d=hi.join(c,"folder.json");if(Dt.existsSync(d)){let y=JSON.parse(Dt.readFileSync(d,"utf-8"));y.id=l,y.name=n,Dt.writeFileSync(d,JSON.stringify(y,null,2))}else Dt.writeFileSync(d,JSON.stringify({id:l,name:n,type:"folder"},null,2));this.loadCollections();let p=this.collections.get(e),m=p?this.findItemById(p.items,l):void 0;return m||{id:l,type:"folder",name:n,items:[]}}async createRequest(e){if(!this.collections.get(e.collectionId))throw new Error("Collection not found");this.selfWritePending=!0;let n={id:e.id||Pt(e.name),type:"request",name:e.name,method:e.method||"GET",url:e.url,params:e.params,query:e.query,headers:e.headers,body:e.body,auth:e.auth,settings:e.settings,scripts:e.scripts,deprecated:e.deprecated,description:e.description,doc:e.doc,responseSchema:e.responseSchema,bodySchema:e.bodySchema,operationId:e.operationId,summary:e.summary,tags:e.tags,examples:e.examples,responses:e.responses,security:e.security};await this.loader.saveItem(e.collectionId,n,e.parentId);let i=this.loader.load(e.collectionId);return i&&this.collections.set(e.collectionId,i),n}async renameRequest(e,r,n){let i=this.collections.get(e);if(!i)return!1;this.selfWritePending=!0;let s=await this.loader.updateItem(e,r,{name:n});if(s){let o=this.findItemById(i.items,r);o&&(o.name=n)}return s}async moveItem(e,r,n){if(!this.collections.get(e))return!1;this.selfWritePending=!0;let s=await this.loader.moveItem(e,r,n);return s&&this.loadCollections(),s}async reorderItems(e,r,n){if(!this.collections.get(e))return!1;this.selfWritePending=!0;let s=await this.loader.reorderItems(e,r,n);return s&&this.loadCollections(),s}getRequestScript(e,r,n){let i=this.collections.get(e);if(!i)return;let s=this.findItemById(i.items,r);if(!s||s.type!=="request")return;let o=s;return n==="pre-request"?o.scripts?.preRequest:o.scripts?.postResponse}async setRequestScript(e,r,n,i){let s=this.collections.get(e);if(!s)return!1;let o=this.findItemById(s.items,r);if(!o||o.type!=="request")return!1;let l=o,d={...l.scripts??{},...n==="pre-request"?{preRequest:i}:{postResponse:i}};l.scripts=d,this.selfWritePending=!0;try{return await this.loader.saveScripts(e,r,d),!0}catch{return!1}}findItemById(e,r){for(let n of e){if(n.id===r)return n;if(n.type==="folder"&&n.items){let i=this.findItemById(n.items,r);if(i)return i}}}copyDirRecursive(e,r){Dt.existsSync(r)||Dt.mkdirSync(r,{recursive:!0});for(let n of Dt.readdirSync(e,{withFileTypes:!0})){let i=hi.join(e,n.name),s=hi.join(r,n.name);n.isDirectory()?this.copyDirRecursive(i,s):Dt.copyFileSync(i,s)}}deleteItemById(e,r){for(let n=0;n<e.length;n++){let i=e[n];if(i.id===r)return e.splice(n,1),!0;if(i.type==="folder"&&i.items&&this.deleteItemById(i.items,r))return!0}return!1}async importCollection(e){let r=Dt.readFileSync(e,"utf-8"),n;try{n=JSON.parse(r)}catch{throw new Error("Invalid JSON file")}if(n.info&&n.info._postman_id)return this.importPostmanCollection(n);let i={id:n.id||Pt(n.name||"Imported Collection"),name:n.name||"Imported Collection",description:n.description,items:n.items||[]};return await this.saveCollection(i),i}async importPostmanCollection(e){let r=p=>{if(!p)return;switch(p.type?.toLowerCase()){case"bearer":return{type:"bearer",bearerToken:p.bearer?.find(E=>E.key==="token")?.value||""};case"basic":let b=p.basic?.find(E=>E.key==="username"),q=p.basic?.find(E=>E.key==="password");return{type:"basic",basicAuth:{username:b?.value||"",password:q?.value||""}};case"apikey":let C=p.apikey?.find(E=>E.key==="key"),v=p.apikey?.find(E=>E.key==="value"),_=p.apikey?.find(E=>E.key==="in");return{type:"apikey",apikey:{key:C?.value||"",value:v?.value||"",in:_?.value||"header"}};case"noauth":return{type:"none"};default:return}},n=p=>{if(!Array.isArray(p)||p.length===0)return;let m={};for(let y of p){let b=y.script?.exec;if(!b)continue;let q=Array.isArray(b)?b.join(`
|
|
55
|
+
`):b;y.listen==="prerequest"?m.preRequest=q:y.listen==="test"&&(m.postResponse=q)}return m.preRequest||m.postResponse?m:void 0},i=p=>{if(!p||typeof p!="object")return;let m={};return p.followRedirects===!1&&(m.followRedirects=!1),p.followOriginalHttpMethod===!0&&(m.followOriginalMethod=!0),p.followAuthorizationHeader===!1&&(m.followAuthHeader=!1),p.maxRedirects!==void 0&&(m.maxRedirects=p.maxRedirects),p.requestTimeout!==void 0&&(m.timeout=p.requestTimeout),Object.keys(m).length>0?m:void 0},s=p=>{if(!p||typeof p=="string")return;let m=p.query;if(!(!Array.isArray(m)||m.length===0))return m.map(y=>({key:y.key||"",value:y.value||"",enabled:y.disabled!==!0,...y.description!==void 0?{description:y.description}:{},...y.type!==void 0?{type:y.type}:{},...y.required!==void 0?{required:y.required}:{},...y.format!==void 0?{format:y.format}:{},...y.enum!==void 0?{enum:y.enum}:{},...y.deprecated!==void 0?{deprecated:y.deprecated}:{},...y.pattern!==void 0?{pattern:y.pattern}:{},...y.minLength!==void 0?{minLength:y.minLength}:{},...y.maxLength!==void 0?{maxLength:y.maxLength}:{},...y.minimum!==void 0?{minimum:y.minimum}:{},...y.maximum!==void 0?{maximum:y.maximum}:{},...y.exclusiveMinimum!==void 0?{exclusiveMinimum:y.exclusiveMinimum}:{},...y.exclusiveMaximum!==void 0?{exclusiveMaximum:y.exclusiveMaximum}:{},...y.multipleOf!==void 0?{multipleOf:y.multipleOf}:{},...y.minItems!==void 0?{minItems:y.minItems}:{},...y.maxItems!==void 0?{maxItems:y.maxItems}:{},...y.uniqueItems!==void 0?{uniqueItems:y.uniqueItems}:{},...y.nullable!==void 0?{nullable:y.nullable}:{},...y.oneOf!==void 0?{oneOf:y.oneOf}:{}}))},o=p=>{if(typeof p=="string")return p;if(!p)return"";let m=new Set;if(Array.isArray(p.variable))for(let b of p.variable)b.key&&m.add(b.key);if(m.size===0&&p.raw)return p.raw;let y="";if(p.protocol&&(y+=p.protocol+"://"),p.host&&(y+=Array.isArray(p.host)?p.host.join("."):p.host),p.port&&(y+=":"+p.port),p.path){let q=(Array.isArray(p.path)?p.path:[p.path]).map(C=>{let v=C.startsWith(":")?C.substring(1):C;return m.has(v)?":"+v:(C.startsWith(":"),C)});y+="/"+q.join("/")}return!y&&p.raw?p.raw:y},l=p=>{if(!Array.isArray(p)||p.length===0)return;let m={responses:{}};for(let y of p){let b=String(y.code||200),q,C={};if(Array.isArray(y.header))for(let O of y.header)!O.key||O.disabled||(O.key.toLowerCase()==="content-type"?q=O.value?.split(";")[0]?.trim():C[O.key]={description:String(O.value??""),schema:{type:"string"}});let v=y.body;if(typeof y.body=="string"&&y.body)try{v=JSON.parse(y.body)}catch{}let _=y.originalRequest,E;if(_){let O=typeof _.url=="string"?_.url:_.url?.raw??"";E=`${_.method||""} ${O}`.trim()||void 0}let k=y.name?y.name.replace(/[^a-zA-Z0-9_-]/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,"").toLowerCase()||`example_${b}`:`example_${b}`;if(m.responses[b]){let O=m.responses[b];O.examples=O.examples??{},O.examples[k]={summary:E,value:v}}else m.responses[b]={description:y.name,contentType:q,examples:{[k]:{summary:E,value:v}},...Object.keys(C).length>0?{headers:C}:{}}}return Object.keys(m.responses).length>0?m:void 0},c=p=>p.map(m=>{if(m.item)return{id:Pt(m.name),type:"folder",name:m.name,description:m.description,auth:r(m.auth),scripts:n(m.event),items:c(m.item)};{let y=m.request||{};return{id:Pt(m.name),type:"request",name:m.name,description:m.description||y.description,method:typeof y.method=="string"?y.method:"GET",url:o(y.url),query:s(y.url),headers:Array.isArray(y.header)?y.header.map(b=>({key:b.key||b.name||"",value:b.value||b.value||"",enabled:b.disabled!==!0,...b.description!==void 0?{description:b.description}:{},...b.type!==void 0?{type:b.type}:{},...b.required!==void 0?{required:b.required}:{},...b.format!==void 0?{format:b.format}:{},...b.enum!==void 0?{enum:b.enum}:{},...b.deprecated!==void 0?{deprecated:b.deprecated}:{},...b.pattern!==void 0?{pattern:b.pattern}:{},...b.minLength!==void 0?{minLength:b.minLength}:{},...b.maxLength!==void 0?{maxLength:b.maxLength}:{},...b.minimum!==void 0?{minimum:b.minimum}:{},...b.maximum!==void 0?{maximum:b.maximum}:{},...b.exclusiveMinimum!==void 0?{exclusiveMinimum:b.exclusiveMinimum}:{},...b.exclusiveMaximum!==void 0?{exclusiveMaximum:b.exclusiveMaximum}:{},...b.multipleOf!==void 0?{multipleOf:b.multipleOf}:{},...b.minItems!==void 0?{minItems:b.minItems}:{},...b.maxItems!==void 0?{maxItems:b.maxItems}:{},...b.uniqueItems!==void 0?{uniqueItems:b.uniqueItems}:{},...b.nullable!==void 0?{nullable:b.nullable}:{},...b.oneOf!==void 0?{oneOf:b.oneOf}:{}})):[],body:(()=>{let b=y.body;if(b){if(b.mode==="raw"&&b.raw){let q=b.options?.raw?.language;return{type:"raw",format:q==="xml"?"xml":q==="html"?"html":q==="javascript"?"javascript":q==="text"?"text":"json",content:b.raw}}if(b.mode==="urlencoded"&&Array.isArray(b.urlencoded))return{type:"x-www-form-urlencoded",content:b.urlencoded.map(q=>({key:q.key||"",value:q.value||"",enabled:q.disabled!==!0}))};if(b.mode==="formdata"&&Array.isArray(b.formdata))return{type:"form-data",content:b.formdata.map(q=>({key:q.key||"",value:q.value||"",type:q.type||"text",enabled:q.disabled!==!0}))};if(b.mode==="graphql"&&b.graphql){let q;if(b.graphql.variables)try{q=JSON.parse(b.graphql.variables)}catch{q=void 0}return{type:"graphql",content:{query:b.graphql.query||"",variables:q}}}if(b.mode==="binary")return{type:"binary",content:""}}})(),auth:r(y.auth),scripts:n(m.event),settings:i(m.protocolProfileBehavior),responseSchema:l(m.response)}}}),d={id:Pt(e.info?.name||"Imported Postman Collection"),name:e.info?.name||"Imported Postman Collection",description:e.info?.description,auth:r(e.auth),scripts:n(e.event),variables:Array.isArray(e.variable)?Object.fromEntries(e.variable.filter(p=>p&&p.key).map(p=>[p.key,String(p.value??"")])):typeof e.variable=="object"&&e.variable!==null?Object.fromEntries(Object.entries(e.variable).map(([p,m])=>[p,String(m??"")])):void 0,items:c(e.item||[])};return await this.saveCollection(d),d}async exportCollection(e,r){let n=this.collections.get(e);if(!n)throw new Error("Collection not found");let i=wz(n),s=JSON.stringify(i,null,2);Dt.writeFileSync(r,s,"utf-8")}async exportCollectionAsRestClientFolder(e,r){let n=this.collections.get(e);if(!n)throw new Error("Collection not found");let i=hi.join(r,Vt(n.name));Dt.mkdirSync(i,{recursive:!0});let s=n.variables||{};Cu(hi.join(i,`${Vt(n.name)}.env`),s),Kf(i,Vt(n.name),n.scripts),Im(n.items,i,n)}dispose(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.fileWatcher?.dispose()}}});var or,La,yo,m0=ae(()=>{"use strict";or={version:"1.0",storage:{format:"folder",root:"./.http-forge/assets",history:"./.http-forge/.cache/histories",results:"./.http-forge/.cache/results"},request:{timeout:3e4,followRedirects:!0,maxRedirects:10,strictSSL:!0,tls:{},certificates:[]},scripts:{modulePaths:["./.http-forge/assets/src","./.http-forge/assets/lib"],scope:"shared",timeout:5e3},runner:{resultsRetentionDays:7,indexPageSize:1e3,recentErrorsLimit:20},environments:{default:"dev"},restClientExport:{path:"collections-rest-client",mergeGlobals:!0},mcp:{port:3100,excludedCollections:[],excludedSuites:[],toolPrefix:"",maxRequestsPerCall:500,toolMode:"auto",drilldownThreshold:100,toolPageSize:200,cors:{allowedOrigins:["http://localhost","http://127.0.0.1"]}},proxy:null,secrets:{providers:{aws:{provider:"aws"},azure:{provider:"azure",vaultUrl:""},gcp:{provider:"gcp"},vault:{provider:"vault"},op:{provider:"1password"},doppler:{provider:"doppler"}}}},La={preferred:".http-forge/http-forge.config.json",legacy:"http-forge.config.json"},yo={collections:"collections",environments:"environments",flows:"flows",suites:"suites"}});import*as Ht from"fs";import*as zt from"path";var vo,km=ae(()=>{"use strict";m0();vo=class{constructor(e,r,n){this.workspacePath=e;this.fileWatcherFactory=r;this.notifications=n;this.configPath=this.resolveConfigPath(),this.config=this.loadConfig(),this.setupFileWatcher()}workspacePath;fileWatcherFactory;notifications;config;configPath;fileWatchers=[];resolveConfigPath(){let e=zt.join(this.workspacePath,La.preferred);if(Ht.existsSync(e))return e;let r=zt.join(this.workspacePath,La.legacy);return Ht.existsSync(r)?r:e}loadConfig(){if(this.configPath=this.resolveConfigPath(),!Ht.existsSync(this.configPath))return{...or};try{let e=Ht.readFileSync(this.configPath,"utf-8"),r=JSON.parse(e);return this.mergeWithDefaults(r)}catch(e){return console.error("[ConfigService] Failed to load config:",e),this.notifications?.showWarning(`Failed to parse ${zt.relative(this.workspacePath,this.configPath)}. Using default configuration.`),{...or}}}mergeWithDefaults(e){return{version:e.version??or.version,storage:{...or.storage,...e.storage},request:{...or.request,...e.request},scripts:{...or.scripts,...e.scripts},runner:{...or.runner,...e.runner},environments:{...or.environments,...e.environments},restClientExport:{...or.restClientExport,...e.restClientExport},proxy:e.proxy!==void 0?e.proxy:or.proxy,mcp:{...or.mcp,...e.mcp,cors:{...or.mcp.cors,...e.mcp?.cors}},secrets:{...or.secrets,...e.secrets,providers:{...or.secrets?.providers,...e.secrets?.providers}}}}setupFileWatcher(){if(!this.fileWatcherFactory)return;let e=()=>{this.reload()};for(let r of[La.preferred,La.legacy]){let n=this.fileWatcherFactory.createFileWatcher(this.workspacePath,r);n.onDidChange(e),n.onDidCreate(e),n.onDidDelete(e),this.fileWatchers.push(n)}}getConfig(){return this.config}getStorageConfig(){return this.config.storage}getRequestConfig(){return this.config.request}getScriptsConfig(){return this.config.scripts}getRunnerConfig(){return this.config.runner}getEnvironmentsConfig(){return this.config.environments}getRestClientExportPath(){let e=this.config.restClientExport?.path||"collections-rest-client";return zt.isAbsolute(e)?e:this.resolvePath(e)}getRestClientMergeGlobals(){return this.config.restClientExport?.mergeGlobals??!0}getProxyConfig(){return this.config.proxy??null}getMcpConfig(){let e=this.config.mcp??or.mcp,r=["flat","drilldown","auto"];return{...e,port:Math.min(65535,Math.max(1,Math.floor(e.port??3100))),toolMode:r.includes(e.toolMode)?e.toolMode:"auto",drilldownThreshold:Math.min(500,Math.max(10,e.drilldownThreshold??100)),toolPageSize:e.toolPageSize===0?0:Math.min(1e3,Math.max(10,e.toolPageSize??200)),maxRequestsPerCall:Math.min(1e4,Math.max(1,e.maxRequestsPerCall??500))}}resolvePath(e){let r=e.startsWith("./")?e.slice(2):e;return zt.join(this.workspacePath,...r.split("/"))}hasFolderCollectionsAtRoot(e){let r=zt.join(e,yo.collections);if(!Ht.existsSync(r))return!1;let n;try{n=Ht.readdirSync(r,{withFileTypes:!0})}catch{return!1}return n.some(i=>{if(!i.isDirectory())return!1;let s=zt.join(r,i.name,"collection.json");return Ht.existsSync(s)})}hasAnyEntries(e){if(!Ht.existsSync(e))return!1;try{return Ht.readdirSync(e).length>0}catch{return!1}}resolveStorageRootPath(){let e=this.resolvePath(this.config.storage.root);return this.configExists()||this.hasFolderCollectionsAtRoot(e)?e:[zt.join(this.workspacePath,"http-forge-assets")].find(i=>this.hasFolderCollectionsAtRoot(i))||e}getRootPath(){return this.resolveStorageRootPath()}getCollectionsPath(){return zt.join(this.getRootPath(),yo.collections)}getEnvironmentsPath(){return zt.join(this.getRootPath(),yo.environments)}getFlowsPath(){return zt.join(this.getRootPath(),yo.flows)}getHistoryPath(){let e=this.resolvePath(this.config.storage.history);if(this.configExists()||this.hasAnyEntries(e))return e;let r=zt.join(this.workspacePath,".http-forge-cache","histories");return this.hasAnyEntries(r)?r:e}getResultsPath(){let e=this.resolvePath(this.config.storage.results);if(this.configExists()||this.hasAnyEntries(e))return e;let r=zt.join(this.workspacePath,".http-forge-cache","results");return this.hasAnyEntries(r)?r:e}getSuitesPath(){return zt.join(this.getRootPath(),yo.suites)}getModulePaths(){return this.config.scripts.modulePaths.map(e=>this.resolvePath(e))}getScriptScope(){return this.config.scripts.scope??"shared"}getScriptTimeout(){return this.config.scripts.timeout??5e3}getWorkspacePath(){return this.workspacePath}reload(){this.configPath=this.resolveConfigPath(),this.config=this.loadConfig()}configExists(){return Ht.existsSync(this.resolveConfigPath())}async createDefaultConfig(){await Ht.promises.mkdir(zt.dirname(this.configPath),{recursive:!0});let e=JSON.stringify(or,null,2);await Ht.promises.writeFile(this.configPath,e,"utf-8");let r=[this.getCollectionsPath(),this.getEnvironmentsPath(),this.getFlowsPath(),this.getSuitesPath()];for(let i of r)Ht.existsSync(i)||await Ht.promises.mkdir(i,{recursive:!0});let n=[this.getHistoryPath(),this.getResultsPath()];for(let i of n)Ht.existsSync(i)||await Ht.promises.mkdir(i,{recursive:!0});await this.createSampleEnvironments()}async createSampleEnvironments(){let e=this.getEnvironmentsPath(),r={id:"globals",name:"Global Variables",variables:{appName:"HTTP Forge"}};await Ht.promises.writeFile(zt.join(e,"globals.json"),JSON.stringify(r,null,2),"utf-8");let n={id:"env_dev",name:"Development",variables:{baseUrl:"http://localhost:3000",apiVersion:"v1"}};await Ht.promises.writeFile(zt.join(e,"dev.json"),JSON.stringify(n,null,2),"utf-8");let i={id:"default_headers",name:"Default Headers",headers:{"Content-Type":"application/json",Accept:"application/json"}};await Ht.promises.writeFile(zt.join(e,"default-headers.json"),JSON.stringify(i,null,2),"utf-8")}dispose(){for(let e of this.fileWatchers)e.dispose();this.fileWatchers=[]}}});var qz,Xf,g0=ae(()=>{"use strict";ga();qz="httpForge.cookies",Xf=class{constructor(e,r=qz){this.store=e;this.storeKey=r;this.loadCookies()}store;storeKey;cookies=new Map;loadCookies(){try{let e=this.store.get(this.storeKey);e&&(this.cookies=new Map(Object.entries(e)),this.cleanExpiredCookies())}catch(e){console.error("[CookieService] Failed to load cookies:",e)}}async saveCookies(){try{let e={};this.cookies.forEach((r,n)=>{e[n]=r}),await this.store.update(this.storeKey,e)}catch(e){console.error("[CookieService] Failed to save cookies:",e)}}getCookieKey(e,r,n){return`${r||"*"}|${n||"/"}|${e}`}get(e,r){if(r){let s=this.getCookieKey(e,r),o=this.cookies.get(s);if(o&&!this.isExpired(o))return o}let n=this.getCookieKey(e,"*"),i=this.cookies.get(n);if(i&&!this.isExpired(i))return i;for(let s of this.cookies.values())if(s.name===e&&!this.isExpired(s))if(r&&s.domain){if(this.domainMatches(r,s.domain))return s}else return s}async set(e){let r=this.getCookieKey(e.name,e.domain,e.path);this.cookies.set(r,e),await this.saveCookies()}async setFromResponse(e){for(let r of e){let n=this.getCookieKey(r.name,r.domain,r.path);this.cookies.set(n,r)}await this.saveCookies()}has(e,r){return this.get(e,r)!==void 0}async delete(e,r,n){let i=this.getCookieKey(e,r,n),s=this.cookies.delete(i);return s&&await this.saveCookies(),s}getAll(e){let r=[];for(let n of this.cookies.values())this.isExpired(n)||(e?(!n.domain||this.domainMatches(e,n.domain))&&r.push(n):r.push(n));return r}getCookieHeader(e){let r=this.getAll(e);return xt.formatCookieHeader(r)}async clear(){this.cookies.clear(),await this.saveCookies()}async clearDomain(e){let r=[];for(let[n,i]of this.cookies.entries())i.domain&&this.domainMatches(e,i.domain)&&r.push(n);for(let n of r)this.cookies.delete(n);await this.saveCookies()}parseCookieHeaders(e,r){return xt.parseCookieHeaders(e,r)}isExpired(e){return xt.isExpired(e)}cleanExpiredCookies(){let e=[];for(let[r,n]of this.cookies.entries())this.isExpired(n)&&e.push(r);for(let r of e)this.cookies.delete(r);e.length>0&&this.saveCookies()}domainMatches(e,r){return xt.domainMatches(e,r)}get count(){return this.cookies.size}}});var ed,y0=ae(()=>{"use strict";ga();ed=class{constructor(e){this.cookieService=e;this.localCache=[...e.getAll()]}cookieService;localCache=[];pendingOperations=[];get(e,r){return r?this.localCache.find(n=>n.name===e&&(!n.domain||n.domain===r||r.endsWith(n.domain))):this.localCache.find(n=>n.name===e)}has(e,r){return this.get(e,r)!==void 0}set(e){let r=this.localCache.findIndex(n=>n.name===e.name&&(!e.domain||n.domain===e.domain));r>=0?this.localCache[r]=e:this.localCache.push(e),this.pendingOperations.push({type:"set",cookie:e})}delete(e,r,n){let i=this.localCache.findIndex(s=>s.name===e&&(!r||s.domain===r||s.domain&&r.endsWith(s.domain)));return i>=0&&this.localCache.splice(i,1),this.pendingOperations.push({type:"delete",name:e,domain:r,path:n}),!0}getAll(e){return e?this.localCache.filter(r=>{let n=r.domain||"";return n===e||e.endsWith(n)}):[...this.localCache]}getCookiesForDomain(e){return this.localCache.filter(r=>{let n=r.domain||"";return n===e||e.endsWith(n)})}async setCookiesFromResponse(e,r){let n=new URL(e).hostname,i=this.cookieService.parseCookieHeaders(r,n);i.length>0&&(i.forEach(s=>{let o=this.localCache.findIndex(l=>l.name===s.name&&l.domain===(s.domain||n));o>=0?this.localCache[o]=s:this.localCache.push(s)}),await this.cookieService.setFromResponse(i))}getCookieHeader(e){let r=new URL(e).hostname,n=new URL(e).pathname,i=this.localCache.filter(s=>!(xt.isExpired(s)||s.domain&&!xt.domainMatches(r,s.domain)||!s.domain||s.path&&!n.startsWith(s.path)));if(i.length!==0)return xt.formatCookieHeader(i)}clear(){this.localCache=[],this.pendingOperations.push({type:"clear"})}async flush(){for(let e of this.pendingOperations)switch(e.type){case"set":e.cookie&&await this.cookieService.set(e.cookie);break;case"delete":e.name&&await this.cookieService.delete(e.name,e.domain,e.path);break;case"clear":await this.cookieService.clear();break}this.pendingOperations=[]}}});function Am(t){try{let e=JSON.parse(typeof t=="string"?t:t.toString("utf-8"));if(!e)return null;let r=e.environment||e,n=r.name||e.name||"imported-environment",i=r.values||r.variables||e.values||e.variables||[],s={};if(Array.isArray(i))for(let l of i){if(!l)continue;let c=l.key??l.name,d=typeof l.enabled=="boolean"?l.enabled:!0;c&&d!==!1&&(s[c]=l.value??l.initial??"")}else if(typeof i=="object"&&i!==null)for(let[l,c]of Object.entries(i))s[l]=String(c??"");let o=r._postman_exported_at?"Imported from Postman export":r.description||"";return{name:n,variables:s,description:o}}catch{return null}}async function Oz(t,e){try{let r=await e.readFile(t);return Am(r)}catch{return null}}var v0=ae(()=>{"use strict"});import*as ar from"fs";import*as Rn from"path";var td,rd,b0=ae(()=>{"use strict";jn();v0();Pm();Th();uf();td={SELECTED_ENVIRONMENT:"httpForge.selectedEnvironment",ENV_OVERRIDES_PREFIX:"httpForge.envOverrides."},rd=class{constructor(e,r,n,i,s,o=!0){this.workspaceFolder=e;this.workspaceStore=r;this.configService=n;this.fileWatcherFactory=i;this.secretStore=s;this.persistOverrides=o;let l=n.getEnvironmentsPath();this.environmentsPath=l,this.sharedConfigPath=Rn.join(l,"_global.json"),this.localConfigPath=Rn.join(l,"_global.local.json"),this.historiesPath=n.getHistoryPath(),this.selectedEnvironment=r?.get(td.SELECTED_ENVIRONMENT,"dev")??"dev",this.localGlobalValues={},this.localEnvironmentValues=new Map,this.persistOverrides&&this.loadPersistedEnvironmentOverrides(),this.loadSecretVariables(this.selectedEnvironment).catch(()=>{}),this.setupFileWatcher()}workspaceFolder;workspaceStore;configService;fileWatcherFactory;secretStore;persistOverrides;environmentsPath;sharedConfigPath;localConfigPath;historiesPath;sharedConfig=null;localConfig=null;selectedEnvironment="dev";fileWatcher;localGlobalValues={};localEnvironmentValues=new Map;secretValuesCache=new Map;onEnvironmentsChanged;setupFileWatcher(){if(!this.fileWatcherFactory||!ar.existsSync(this.environmentsPath))return;this.fileWatcher=this.fileWatcherFactory.createFileWatcher(this.environmentsPath,"**/*.json");let e=()=>{this.reload(),this.onEnvironmentsChanged?.()};this.fileWatcher.onDidChange(e),this.fileWatcher.onDidCreate(e),this.fileWatcher.onDidDelete(e)}dispose(){this.fileWatcher?.dispose()}getWorkspaceFolder(){return this.workspaceFolder}getRootPath(){return this.configService.getRootPath()}loadConfigs(){if(!ar.existsSync(this.environmentsPath)){this.sharedConfig={environments:{},globalVariables:{},defaultHeaders:{}},this.localConfig={credentials:{},variables:{}};return}this.loadFolderConfigs()}getSharedConfig(){return this.sharedConfig||this.loadConfigs(),this.sharedConfig}getLocalConfig(){return this.localConfig||this.loadConfigs(),this.localConfig}getEnvironmentNames(){let e=this.getSharedConfig();return e?.environments?Object.keys(e.environments):[]}getSelectedEnvironment(){return this.selectedEnvironment}async setSelectedEnvironment(e){if(this.selectedEnvironment=e,await this.workspaceStore?.update(td.SELECTED_ENVIRONMENT,e),!this.localEnvironmentValues.has(e)){let r=this.getEnvOverridesStateKey(e),n=this.workspaceStore?.get(r,{});n&&Object.keys(n).length>0&&this.localEnvironmentValues.set(e,{...n})}await this.loadSecretVariables(e)}getEnvOverridesStateKey(e){return`${td.ENV_OVERRIDES_PREFIX}${e||this.selectedEnvironment}`}loadPersistedEnvironmentOverrides(){let e=this.getEnvOverridesStateKey(),r=this.workspaceStore?.get(e,{});r&&Object.keys(r).length>0&&this.localEnvironmentValues.set(this.selectedEnvironment,{...r})}persistEnvironmentOverrides(e){if(!this.persistOverrides)return;let r=this.getEnvOverridesStateKey(e),n=this.localEnvironmentValues.get(e)||{};this.workspaceStore?.update(r,n)}setEnvironmentVariable(e,r,n){let i=n??this.selectedEnvironment;this.localEnvironmentValues.has(i)||this.localEnvironmentValues.set(i,{}),this.localEnvironmentValues.get(i)[e]=String(r),this.persistEnvironmentOverrides(i)}deleteEnvironmentVariable(e,r){let n=r??this.selectedEnvironment,i=this.localEnvironmentValues.get(n);i&&(delete i[e],this.persistEnvironmentOverrides(n))}clearEnvironmentVariables(e){let r=e??this.selectedEnvironment;this.localEnvironmentValues.set(r,{}),this.persistEnvironmentOverrides(r)}async resetEnvironmentOverrides(e){let r=e||this.selectedEnvironment;this.localEnvironmentValues.delete(r),await this.workspaceStore?.update(this.getEnvOverridesStateKey(r),void 0)}getEnvironmentVariableLocal(e){return this.localEnvironmentValues.get(this.selectedEnvironment)?.[e]}getEnvironmentVariableLocals(){return{...this.localEnvironmentValues.get(this.selectedEnvironment)||{}}}setGlobalVariable(e,r){this.localGlobalValues[e]=String(r)}getGlobalVariable(e){return this.getSharedConfig()?.globalVariables?.[e]}getGlobalVariableLocal(e){return this.localGlobalValues[e]}getGlobalVariables(){return{...this.getSharedConfig()?.globalVariables||{},...this.getLocalConfig()?.variables||{},...this.localGlobalValues}}getGlobalVariableLocals(){return{...this.localGlobalValues}}deleteGlobalVariable(e){delete this.localGlobalValues[e]}clearGlobalVariables(){this.localGlobalValues={}}getResolvedEnvironment(e){let r=e||this.selectedEnvironment,n=this.getSharedConfig(),i=this.getLocalConfig();if(!n?.environments?.[r])return null;let s=n.environments[r],o=i?.credentials?.[r],l=i?.variables||{},c=o?.variables||{},d=o&&o.headers||{},p=Zc(n.defaultHeaders||{},d),m=this.localEnvironmentValues.get(r)||{},y=this.secretValuesCache.get(r)||{},b={...s.variables||{},...c,...m,...y};return{name:r,description:s.description,requiresConfirmation:s.requiresConfirmation,headers:p,variables:b}}async getSecretVariable(e,r){return this.secretStore?.get(`${e}:${r}`)}async setSecretVariable(e,r,n){await this.secretStore?.store(`${e}:${r}`,n),this.secretValuesCache.has(e)||this.secretValuesCache.set(e,{}),this.secretValuesCache.get(e)[r]=n}async deleteSecretVariable(e,r){await this.secretStore?.delete(`${e}:${r}`),this.secretValuesCache.get(e)&&delete this.secretValuesCache.get(e)[r]}async loadSecretVariables(e){if(!this.secretStore)return;let r=e||this.selectedEnvironment,n=this.getSharedConfig()?.environments?.[r]?.secretVariables??[];if(n.length===0)return;let i={};await Promise.all(n.map(async s=>{let o=await this.secretStore.get(`${r}:${s}`);o!==void 0&&(i[s]=o)})),this.secretValuesCache.set(r,i)}resolveVariables(e,r){return this.createResolver(r).resolveString(e,!0)}exportEnvironmentsToFolder(e,r=!0){let n=this.getEnvironmentNames(),i=this.getSharedConfig(),s=i?.globalVariables?{...i.globalVariables}:{};if(!r&&Object.keys(s).length){let o=Rn.join(e,"globals.env");Cu(o,s)}n.forEach(o=>{let l=i?.environments?.[o];if(!l)return;let c={...l.variables||{}};r&&(c={...s,...c});let d=Rn.join(e,`${Vt(o)}.env`);Cu(d,c)})}resolveVariablesWithExtra(e,r,n){return this.createResolver(n,r).resolveString(e,!0)}resolveVariablesInObject(e,r){return this.createResolver(r).resolveObject(e,!0)}resolveVariablesInObjectWithExtra(e,r,n){return this.createResolver(n,r).resolveObject(e,!0)}getHistoriesPath(){return this.historiesPath}getSharedConfigPath(){return this.sharedConfigPath}getLocalConfigPath(){return this.localConfigPath}getEnvironmentConfigPath(e){return Rn.join(this.environmentsPath,`${e}.json`)}localConfigExists(){return ar.existsSync(this.localConfigPath)}saveSharedConfig(e){this.saveFolderSharedConfig(e),this.sharedConfig=e}saveLocalConfig(e){let r={variables:e.variables||{}};this.saveJsonFile(this.localConfigPath,r);for(let[n,i]of Object.entries(e.credentials||{})){let s=this.getEnvLocalConfigPath(n),o={variables:i.variables||{}};this.saveJsonFile(s,o)}this.localConfig=e}importPostmanEnvironmentFile(e){try{let r=ar.readFileSync(e,"utf-8"),n=Am(r);if(!n)throw new Error("Failed to parse Postman environment file");this.sharedConfig||this.loadConfigs(),this.sharedConfig||(this.sharedConfig={environments:{},globalVariables:{},defaultHeaders:{}});let i=n.name||`imported-${Date.now()}`;return this.sharedConfig.environments=this.sharedConfig.environments||{},this.sharedConfig.environments[i]=this.sharedConfig.environments[i]||{},this.sharedConfig.environments[i].variables=n.variables,n.description&&(this.sharedConfig.environments[i].description=n.description),this.saveSharedConfig(this.sharedConfig),n}catch(r){throw console.error("[EnvironmentConfigService] importPostmanEnvironmentFile failed:",r),r}}saveEnvLocalConfig(e,r){let n=this.getEnvLocalConfigPath(e),i={variables:r};this.saveJsonFile(n,i),this.localConfig||(this.localConfig={credentials:{},variables:{}}),this.localConfig.credentials||(this.localConfig.credentials={}),this.localConfig.credentials[e]={variables:r}}getEnvLocalPath(e){return this.getEnvLocalConfigPath(e)}getEnvLocalConfigPath(e){return Rn.join(this.environmentsPath,`${e}.local.json`)}loadFolderConfigs(){let e=nf(this.environmentsPath);this.sharedConfig={environments:e.environments,globalVariables:e.globalVariables,defaultHeaders:e.defaultHeaders},this.localConfig={credentials:e.localCredentials,variables:e.localVariables}}createResolver(e,r){let i=this.getResolvedEnvironment(e)?.variables||{},s=this.getGlobalVariables(),o=this.getGlobalVariableLocals();return new Sa({globals:s,collectionVariables:{},environmentVariables:i,variables:{...o,...r||{}}})}saveFolderSharedConfig(e){ar.existsSync(this.environmentsPath)||ar.mkdirSync(this.environmentsPath,{recursive:!0});let r={variables:e.globalVariables||{},defaultHeaders:e.defaultHeaders||{}};this.saveJsonFile(this.sharedConfigPath,r);let n=ar.readdirSync(this.environmentsPath).filter(s=>s.endsWith(".json")).filter(s=>!Ah(s)),i=new Set(Object.keys(e.environments||{}));for(let s of n){let o=Rn.basename(s,".json");if(!i.has(o))try{ar.unlinkSync(Rn.join(this.environmentsPath,s))}catch{}}for(let[s,o]of Object.entries(e.environments||{})){let l={name:s,description:o.description,requiresConfirmation:o.requiresConfirmation,variables:o.variables||{}};this.saveJsonFile(Rn.join(this.environmentsPath,`${s}.json`),l)}}reload(){this.sharedConfig=null,this.localConfig=null,this.loadConfigs()}getAllEnvironments(){return this.loadConfigs(),this.sharedConfig?Object.entries(this.sharedConfig.environments).map(([e,r])=>({id:e,name:e,active:e===this.selectedEnvironment,variables:r.variables||{}})):[]}async setActiveEnvironment(e){await this.setSelectedEnvironment(e)}async createEnvironment(e){if(this.loadConfigs(),this.sharedConfig||(this.sharedConfig={environments:{},globalVariables:{}}),this.sharedConfig.environments[e])throw new Error(`Environment "${e}" already exists`);this.sharedConfig.environments[e]={description:`Created ${new Date().toISOString()}`,variables:{}},this.saveSharedConfig(this.sharedConfig)}async deleteEnvironment(e){if(this.loadConfigs(),this.validateConfigLoaded(),this.validateEnvironmentExists(e),delete this.sharedConfig.environments[e],this.selectedEnvironment===e){let r=Object.keys(this.sharedConfig.environments);this.selectedEnvironment=r.length>0?r[0]:"dev",await this.workspaceStore?.update(td.SELECTED_ENVIRONMENT,this.selectedEnvironment)}this.saveSharedConfig(this.sharedConfig)}async duplicateEnvironment(e,r){this.loadConfigs(),this.validateConfigLoaded(),this.validateEnvironmentName(r),this.validateEnvironmentExists(e),this.validateEnvironmentNameNotTaken(r);let n=this.sharedConfig.environments[e];this.sharedConfig.environments[r]=JSON.parse(JSON.stringify(n)),this.sharedConfig.environments[r].description=`Copied from ${e}`,this.saveSharedConfig(this.sharedConfig)}async renameEnvironment(e,r){this.loadConfigs(),this.validateConfigLoaded(),this.validateEnvironmentName(r),this.validateEnvironmentExists(e),r!==e&&(this.validateEnvironmentNameNotTaken(r),this.sharedConfig.environments[r]=this.sharedConfig.environments[e],delete this.sharedConfig.environments[e],this.selectedEnvironment===e&&(this.selectedEnvironment=r,await this.workspaceStore?.update(td.SELECTED_ENVIRONMENT,r)),this.saveSharedConfig(this.sharedConfig))}validateEnvironmentName(e){if(!e||e.trim().length===0)throw new Error("Environment name cannot be empty");if(e.length>128)throw new Error("Environment name cannot exceed 128 characters");if(!/^[a-zA-Z0-9_\-\.]+$/.test(e))throw new Error("Environment name can only contain letters, numbers, hyphens, underscores, and dots")}validateEnvironmentExists(e){if(!this.sharedConfig?.environments?.[e])throw new Error(`Environment "${e}" not found`)}validateEnvironmentNameNotTaken(e){if(this.sharedConfig?.environments?.[e])throw new Error(`Environment "${e}" already exists`)}validateConfigLoaded(){if(!this.sharedConfig)throw new Error("No environment configuration loaded")}async updateEnvironmentVariables(e,r){if(this.loadConfigs(),!this.sharedConfig)throw new Error("No configuration loaded");let n=this.sharedConfig.environments[e];if(!n)throw new Error(`Environment "${e}" not found`);n.variables=r,this.saveSharedConfig(this.sharedConfig)}loadJsonFile(e){try{if(!ar.existsSync(e))return null;let r=ar.readFileSync(e,"utf-8");return JSON.parse(r)}catch(r){return console.error(`Failed to load JSON from ${e}:`,r),null}}saveJsonFile(e,r){try{let n=Rn.dirname(e);ar.existsSync(n)||ar.mkdirSync(n,{recursive:!0}),ar.writeFileSync(e,JSON.stringify(r,null,2),"utf-8")}catch(n){throw console.error(`Failed to save JSON to ${e}:`,n),n}}}});var bo,Tm=ae(()=>{"use strict";Hf();bo=class t{constructor(e,r,n,i,s,o,l,c,d,p,m,y,b){this.httpService=e;this.scriptExecutor=r;this.envConfigService=n;this.requestPreparer=i;this.environment=s;this.cookieJar=o;this.collectionScripts=l;this.folderScriptsChain=c;this.onConsoleOutput=d;this.collectionName=p;this.collectionAuth=m;this.iteration=y;this.iterationCount=b}httpService;scriptExecutor;envConfigService;requestPreparer;environment;cookieJar;collectionScripts;folderScriptsChain;onConsoleOutput;collectionName;collectionAuth;iteration;iterationCount;async execute(e,r,n){let i=Date.now();return this.executeWithSession(e,r,n,i)}async executeWithSession(e,r,n,i){let s=this.collectPreRequestScripts(e),o=this.collectPostResponseScripts(e),l=this.envConfigService.getResolvedEnvironment(this.environment);if(!l)throw new Error(`Environment "${this.environment}" not found or not configured`);let c=this.envConfigService.getGlobalVariables(),d={request:e,variables:{...r},environmentVariables:l.variables||{},globals:{...c},environmentName:this.environment,cookieJar:this.cookieJar,info:{eventName:"prerequest",requestName:e.name,requestId:e.id,collectionName:this.collectionName,iteration:this.iteration,iterationCount:this.iterationCount},onEnvironmentChange:async(y,b,q)=>{y==="set"&&b&&q!==void 0?this.envConfigService.setEnvironmentVariable(b,q,this.environment):y==="unset"&&b?this.envConfigService.deleteEnvironmentVariable(b,this.environment):y==="clear"&&this.envConfigService.clearEnvironmentVariables(this.environment)},onGlobalsChange:(y,b,q)=>{y==="set"&&b&&q!==void 0?this.envConfigService.setGlobalVariable(b,q):y==="unset"&&b?this.envConfigService.deleteGlobalVariable(b):y==="clear"&&this.envConfigService.clearGlobalVariables()}},p=this.scriptExecutor.createRequestSession(d),m=null;try{let y={...r},b={...e},q;if((!b.auth||b.auth.type==="inherit")&&(b.auth=this.collectionAuth&&this.collectionAuth.type!=="inherit"?this.collectionAuth:void 0),s.length>0){let D=await p.executePreRequest(s);if(D.consoleOutput&&D.consoleOutput.length>0&&this.onConsoleOutput?.(D.consoleOutput,{requestName:e.name||"",phase:"pre-request"}),D.nextRequest!==void 0&&(q=D.nextRequest),D.skipRequest){let J={type:"none",content:null};return{requestId:e.id,name:e.name,executedRequest:{url:e.url||"",method:e.method||"GET",headers:{},body:J,params:{},query:{}},response:{status:0,statusText:"Skipped",headers:{},body:null,time:0,cookies:[]},duration:Date.now()-i,timestamp:Date.now(),passed:!0,assertions:[],modifiedVariables:y,nextRequest:q}}D.success&&(D.modifiedRequest&&(D.modifiedRequest.url&&(b.url=D.modifiedRequest.url),D.modifiedRequest.headers&&(b.headers=D.modifiedRequest.headers),D.modifiedRequest.params&&(b.params=D.modifiedRequest.params),D.modifiedRequest.query&&(b.query=D.modifiedRequest.query),D.modifiedRequest.body!==void 0&&(b.body=D.modifiedRequest.body)),(D.localVariables??D.modifiedVariables)&&(y=D.localVariables??D.modifiedVariables))}m=await this.requestPreparer.prepareRequest(b,this.environment,l,y);let{url:C,headers:v,body:_,method:E}=m,k={};for(let D in v)Object.prototype.hasOwnProperty.call(v,D)&&(k[D.toUpperCase()]=v[D]);if(!k.COOKIE&&b.settings?.includeCookies!==!1&&this.cookieJar){let J=this.cookieJar.getCookieHeader(C);J&&(k.COOKIE=J)}let O={method:E,url:C,headers:k,body:_.content,signal:n,settings:b.settings?{...b.settings}:void 0},M=await this.httpService.execute(O);this.cookieJar&&M.headers&&await this.cookieJar.setCookiesFromResponse(C,M.headers);let j=Date.now()-i,I=[],R={},A;if(o.length>0){let D=0;if(M.body)if(typeof M.body=="string")D=Buffer.byteLength(M.body,"utf8");else if(Buffer.isBuffer(M.body))D=M.body.length;else try{D=Buffer.byteLength(JSON.stringify(M.body),"utf8")}catch{D=0}let J=Cm(M.headers,M.cookies,m.url),Q={executedRequest:m,status:M.status,statusText:M.statusText,headers:r0(M.headers||{}),body:M.body,cookies:J,responseTime:M.time,responseSize:D},se=await p.executePostResponse(o,Q);I=se.testResults,R=se.modifiedEnvironmentVariables||{},A=se.visualizerData,(se.localVariables??se.modifiedVariables)&&(y=se.localVariables??se.modifiedVariables),se.nextRequest!==void 0&&(q=se.nextRequest),se.consoleOutput&&se.consoleOutput.length>0&&this.onConsoleOutput?.(se.consoleOutput,{requestName:e.name||"",phase:"post-response"})}let F=I.length===0||I.every(D=>D.passed),U=I.length>0?F:M.status>=200&&M.status<=302;return{requestId:e.id,name:e.name,executedRequest:{...m,headers:k},response:{status:M.status,statusText:M.statusText,headers:M.headers||{},body:M.body,time:M.time||j,cookies:M.cookies||[]},duration:j,timestamp:Date.now(),passed:U,assertions:I,modifiedVariables:y,modifiedEnvironmentVariables:R,nextRequest:q,visualizerData:A}}catch(y){return this.handleError(e,m,y,i)}finally{p.dispose?.()}}collectPreRequestScripts(e){let r=[];if(this.collectionScripts?.preRequest&&r.push(this.collectionScripts.preRequest),this.folderScriptsChain)if(Array.isArray(this.folderScriptsChain))for(let n of this.folderScriptsChain)n?.preRequest&&r.push(n.preRequest);else this.folderScriptsChain.preRequest&&r.push(this.folderScriptsChain.preRequest);return e.scripts?.preRequest&&r.push(e.scripts.preRequest),r}collectPostResponseScripts(e){let r=[];if(e.scripts?.postResponse&&r.push(e.scripts.postResponse),this.folderScriptsChain)if(Array.isArray(this.folderScriptsChain)){let n=[...this.folderScriptsChain].reverse();for(let i of n)i?.postResponse&&r.push(i.postResponse)}else this.folderScriptsChain.postResponse&&r.push(this.folderScriptsChain.postResponse);return this.collectionScripts?.postResponse&&r.push(this.collectionScripts.postResponse),r}handleError(e,r,n,i){let s=Date.now()-i,o=r?.method||e.method,l=r?.url||e.url;this.onConsoleOutput?.([`${n.message||n}`],{requestName:e.name||"",phase:"error"});let c=String(n.name==="AbortError"?"Request was aborted":n.message||n),d=n?.stack?String(n.stack):"",p=this.errorBodyFormat,m,y;p==="html"||p==="both"?(m=t.formatErrorAsHtml(c,d),y={"content-type":"text/html; charset=utf-8"}):(m=c,y={});let b={type:"none",content:null};return{requestId:e.id,name:e.name,executedRequest:{url:l||"",method:o||"GET",headers:r?.headers||{},body:r?.body||b,params:r?.params||{},query:r?.query||{}},response:{status:0,statusText:n.name==="AbortError"?"Aborted":n.code||n.message||"Request Error",headers:y,cookies:[],body:m,time:0},duration:s,timestamp:Date.now(),passed:!1,assertions:[],error:c}}get errorBodyFormat(){return"text"}static formatErrorAsHtml(e,r){let n=i=>i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");return`<!doctype html>
|
|
56
56
|
<html>
|
|
57
57
|
<body style="font-family:system-ui,Segoe UI,Roboto,-apple-system,Helvetica,Arial,sans-serif;padding:12px;color:#c7254e;">
|
|
58
58
|
<h2 style="margin-top:0;color:#a94442">Request Error</h2>
|
|
@@ -61,7 +61,7 @@ ${i}
|
|
|
61
61
|
${n(r)}
|
|
62
62
|
</pre>`:""}
|
|
63
63
|
</body>
|
|
64
|
-
</html>`}}});var nd,S0=ae(()=>{"use strict";jn();nd=class{constructor(e,r,n,i,s,o){this.envConfigService=e;this.httpService=r;this.preprocessor=n;this.tokenManager=i;this.appInfo=s;this.secretRegistry=o}envConfigService;httpService;preprocessor;tokenManager;appInfo;secretRegistry;async prepareRequest(e,r,n,i){if(this.secretRegistry?.hasProviders){let _=await this.secretRegistry.resolveSecretTokens(e);Object.keys(_).length>0&&(i={..._,...i??{}})}let s=i&&Object.keys(i).length>0,o=s?this.envConfigService.resolveVariablesInObjectWithExtra(e.params||{},i,r):this.envConfigService.resolveVariablesInObject(e.params||{},r),l=s?this.envConfigService.resolveVariablesInObjectWithExtra(e.query||{},i,r):this.envConfigService.resolveVariablesInObject(e.query||{},r),c=Zc(n?.headers||{},e.headers||{}),d=s?this.envConfigService.resolveVariablesInObjectWithExtra(c,i,r):this.envConfigService.resolveVariablesInObject(c,r);if(d=this.preprocessor.sanitizeHeaders(d),!Object.keys(d).some(_=>_.toLowerCase()==="user-agent")){let _=this.appInfo?.version||"0.0.0",
|
|
64
|
+
</html>`}}});var nd,S0=ae(()=>{"use strict";jn();nd=class{constructor(e,r,n,i,s,o){this.envConfigService=e;this.httpService=r;this.preprocessor=n;this.tokenManager=i;this.appInfo=s;this.secretRegistry=o}envConfigService;httpService;preprocessor;tokenManager;appInfo;secretRegistry;async prepareRequest(e,r,n,i){if(this.secretRegistry?.hasProviders){let _=await this.secretRegistry.resolveSecretTokens(e);Object.keys(_).length>0&&(i={..._,...i??{}})}let s=i&&Object.keys(i).length>0,o=s?this.envConfigService.resolveVariablesInObjectWithExtra(e.params||{},i,r):this.envConfigService.resolveVariablesInObject(e.params||{},r),l=s?this.envConfigService.resolveVariablesInObjectWithExtra(e.query||{},i,r):this.envConfigService.resolveVariablesInObject(e.query||{},r),c=Zc(n?.headers||{},e.headers||{}),d=s?this.envConfigService.resolveVariablesInObjectWithExtra(c,i,r):this.envConfigService.resolveVariablesInObject(c,r);if(d=this.preprocessor.sanitizeHeaders(d),!Object.keys(d).some(_=>_.toLowerCase()==="user-agent")){let _=this.appInfo?.version||"0.0.0",E=this.appInfo?.name||"HttpForge";d["User-Agent"]=`${E}/${_}`}if(e.auth?.type==="bearer"&&e.auth.bearerToken){let _=s?this.envConfigService.resolveVariablesWithExtra(e.auth.bearerToken,i,r):this.envConfigService.resolveVariables(e.auth.bearerToken,r);d.Authorization=`Bearer ${_}`}if(e.auth?.type==="basic"&&e.auth.basicAuth){let _=s?this.envConfigService.resolveVariablesWithExtra(e.auth.basicAuth.username||"",i,r):this.envConfigService.resolveVariables(e.auth.basicAuth.username||"",r),E=s?this.envConfigService.resolveVariablesWithExtra(e.auth.basicAuth.password||"",i,r):this.envConfigService.resolveVariables(e.auth.basicAuth.password||"",r),k=Buffer.from(`${_}:${E}`).toString("base64");d.Authorization=`Basic ${k}`}e.auth?.type==="apikey"&&e.auth.apikey&&this.applyApiKey(e.auth.apikey,d,l,r,i),e.auth?.type==="oauth2"&&e.auth.oauth2&&await this.applyOAuth2(e.auth.oauth2,d,r);let m=null;if(e.body&&e.body.type!=="none"){let _=i&&Object.keys(i).length>0?this.envConfigService.resolveVariablesInObjectWithExtra(e.body.content,i,r):this.envConfigService.resolveVariablesInObject(e.body.content,r);if((e.body.format==="json"||e.body.type==="graphql")&&typeof _=="string")try{_=JSON.parse(_)}catch{e.body.format==="json"&&console.warn("[RequestPreparer] Failed to parse JSON body after variable resolution, keeping as string")}let E={type:e.body.type,format:e.body.format,content:_};e.body.type==="form-data"?m=this.buildMultipartFormData(E.content):m=this.preprocessor.encodeBody(E)}e.body?.type!=="form-data"&&this.preprocessor.setContentTypeHeader(d,e.body,e.bodyContentType);let y=e.method||"GET",b=e.url||"",q=i&&Object.keys(i).length>0?this.envConfigService.resolveVariablesWithExtra(b,i,r):this.envConfigService.resolveVariables(b,r),C=this.httpService.buildUrl(q,o,l),v={type:e.body?.type||"none",format:e.body?.format,content:m};return{url:C,method:y,headers:d,body:v,params:o,query:l}}async applyOAuth2(e,r,n){if(e.accessToken){let s=this.envConfigService.resolveVariables(e.accessToken,n),o=e.tokenPrefix||"Bearer";r.Authorization=`${o} ${s}`;return}if(!this.tokenManager)throw new Error("OAuth2 authentication requires IOAuth2TokenManager. Ensure the service is properly registered.");let i=await this.tokenManager.getToken(e,n);r.Authorization=`${i.tokenType} ${i.accessToken}`}applyApiKey(e,r,n,i,s){if(!e||!e.key)return;let o=s&&Object.keys(s).length>0,l=o?this.envConfigService.resolveVariablesWithExtra(e.key||"",s,i):this.envConfigService.resolveVariables(e.key||"",i),c=o?this.envConfigService.resolveVariablesWithExtra(e.value||"",s,i):this.envConfigService.resolveVariables(e.value||"",i);(e.in||"header").toLowerCase()==="query"?n[l]=c:r[l]=c}buildMultipartFormData(e){if(!Array.isArray(e))return;let r=new FormData;for(let n of e)!n?.key||n.enabled===!1||r.append(n.key,n.value==null?"":String(n.value));return r}}});var Iz,id,w0=ae(()=>{"use strict";Iz=`
|
|
65
65
|
query IntrospectionQuery {
|
|
66
66
|
__schema {
|
|
67
67
|
queryType { name }
|
|
@@ -94,16 +94,16 @@ fragment TypeRef on __Type {
|
|
|
94
94
|
`))return Pz(e)}return t}function x0(t){return{...t,sentRequest:{...t.sentRequest,url:Mm(t.sentRequest.url),headers:Wi(t.sentRequest.headers),body:t.sentRequest.body!=null?C0(t.sentRequest.body):t.sentRequest.body}}}function E0(t){return{...t,headers:Wi(t.headers),cookies:t.cookies.map(e=>e&&typeof e=="object"&&e.name&&Cn.test(e.name)?{...e,value:So}:e)}}function q0(t){return{...t,url:Mm(t.url),request:{...t.request,url:Mm(t.request.url),headers:Wi(t.request.headers),query:Wi(t.request.query),params:Wi(t.request.params),body:t.request.body!=null?C0(t.request.body):t.request.body},response:{headers:Wi(t.response.headers),body:t.response.body,time:t.response.time,size:t.response.size,cookies:t.response.cookies?R0(t.response.cookies):t.response.cookies}}}function Er(t){return typeof t=="string"&&kz.test(t)}function Az(t){let e=[];if(t.url)try{let r=new URL(t.url.includes("://")?t.url:`http://placeholder${t.url.startsWith("/")?"":"/"}${t.url}`);for(let[n,i]of r.searchParams)Cn.test(n)&&i&&!Er(i)&&e.push({location:"url",field:n,message:`URL query parameter "${n}" contains a hardcoded value. Use a {{variable}} instead.`})}catch{}if(t.headers){let r=Array.isArray(t.headers)?t.headers.filter(n=>n.enabled!==!1).map(n=>[n.key,n.value]):Object.entries(t.headers);for(let[n,i]of r)_0.test(n)&&i&&!Er(i)&&e.push({location:"header",field:n,message:`Header "${n}" contains a hardcoded value. Use a {{variable}} instead (e.g. {{${n.toLowerCase().replace(/[^a-z0-9]/g,"_")}}})`})}if(t.query){let r=Array.isArray(t.query)?t.query.filter(n=>n.enabled!==!1).map(n=>[n.key,n.value]):Object.entries(t.query);for(let[n,i]of r)Cn.test(n)&&i&&!Er(i)&&e.push({location:"query",field:n,message:`Query parameter "${n}" contains a hardcoded value. Use a {{variable}} instead.`})}if(t.auth){let r=t.auth;if(r.bearerToken&&!Er(r.bearerToken)&&e.push({location:"auth",field:"bearerToken",message:"Bearer token contains a hardcoded value. Store it in a {{variable}} in your .local.json environment file."}),r.basicAuth&&r.basicAuth.password&&!Er(r.basicAuth.password)&&e.push({location:"auth",field:"basicAuth.password",message:"Basic auth password contains a hardcoded value. Use a {{variable}} instead."}),r.apikey||r.apiKey){let n=r.apikey||r.apiKey;n.value&&!Er(n.value)&&e.push({location:"auth",field:"apiKey.value",message:"API key contains a hardcoded value. Use a {{variable}} instead."})}}if(t.body){let r=typeof t.body=="object"&&"content"in t.body?t.body.content:t.body;r&&$m(r,e)}return e}function $m(t,e){if(t!=null){if(typeof t=="string"){let r=t.trim();if(r.startsWith("{")||r.startsWith("[")){try{$m(JSON.parse(r),e)}catch{}return}if(r.includes("=")&&!r.includes(`
|
|
95
95
|
`)){try{let n=new URLSearchParams(r);for(let[i,s]of n)Cn.test(i)&&s&&!Er(s)&&e.push({location:"body",field:i,message:`Form field "${i}" contains a hardcoded value. Use a {{variable}} instead.`})}catch{}return}return}if(Array.isArray(t)){t.forEach(r=>$m(r,e));return}if(typeof t=="object")for(let[r,n]of Object.entries(t))Cn.test(r)&&n&&typeof n=="string"&&!Er(n)?e.push({location:"body",field:r,message:`Body field "${r}" contains a hardcoded value. Use a {{variable}} instead.`}):typeof n=="object"&&n!==null&&$m(n,e)}}function Ua(t){return t.replace(/\./g,"_").replace(/[^a-zA-Z0-9_]/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,"").toLowerCase()}function Tz(t){let e=[],r=new Set;function n(i){let s=i,o=2;for(;r.has(s);)s=`${i}_${o++}`;return r.add(s),s}if(t.url)try{let i=new URL(t.url.includes("://")?t.url:`http://placeholder${t.url.startsWith("/")?"":"/"}${t.url}`);for(let[s,o]of i.searchParams)Cn.test(s)&&o&&!Er(o)&&e.push({location:"url",field:s,value:o,variableName:n(Ua(s))})}catch{}if(t.headers){let i=Array.isArray(t.headers)?t.headers.filter(s=>s.enabled!==!1).map(s=>[s.key,s.value]):Object.entries(t.headers);for(let[s,o]of i)_0.test(s)&&o&&!Er(o)&&e.push({location:"header",field:s,value:o,variableName:n(Ua(s))})}if(t.query){let i=Array.isArray(t.query)?t.query.filter(s=>s.enabled!==!1).map(s=>[s.key,s.value]):Object.entries(t.query);for(let[s,o]of i)Cn.test(s)&&o&&!Er(o)&&e.push({location:"query",field:s,value:o,variableName:n(Ua(s))})}if(t.auth){let i=t.auth;if(i.bearerToken&&!Er(i.bearerToken)&&e.push({location:"auth",field:"bearerToken",value:i.bearerToken,variableName:n("bearer_token")}),i.basicAuth&&i.basicAuth.password&&!Er(i.basicAuth.password)&&e.push({location:"auth",field:"basicAuth.password",value:i.basicAuth.password,variableName:n("basic_auth_password")}),i.apikey||i.apiKey){let s=i.apikey||i.apiKey;s.value&&!Er(s.value)&&e.push({location:"auth",field:"apiKey.value",value:s.value,variableName:n("api_key")})}}if(t.body){let i=typeof t.body=="object"&&"content"in t.body?t.body.content:t.body;i&&Nm(i,e,r,"")}return e}function Nm(t,e,r,n){if(t!=null){if(typeof t=="string"){let i=t.trim();if(i.startsWith("{")||i.startsWith("[")){try{Nm(JSON.parse(i),e,r,n)}catch{}return}if(i.includes("=")&&!i.includes(`
|
|
96
96
|
`)){try{let s=new URLSearchParams(i);for(let[o,l]of s)if(Cn.test(o)&&l&&!Er(l)){let c=Ua(o),d=2;for(;r.has(c);)c=`${Ua(o)}_${d++}`;r.add(c),e.push({location:"body",field:o,path:n?`${n}.${o}`:o,value:l,variableName:c})}}catch{}return}return}if(Array.isArray(t)){t.forEach((i,s)=>Nm(i,e,r,`${n}[${s}]`));return}if(typeof t=="object")for(let[i,s]of Object.entries(t)){let o=n?`${n}.${i}`:i;if(Cn.test(i)&&s&&typeof s=="string"&&!Er(s)){let l=Ua(i),c=2;for(;r.has(l);)l=`${Ua(i)}_${c++}`;r.add(l),e.push({location:"body",field:i,path:o,value:s,variableName:l})}else typeof s=="object"&&s!==null&&Nm(s,e,r,o)}}}function $z(t,e){let r=JSON.parse(JSON.stringify(t));for(let n of e){let i=`{{${n.variableName}}}`;switch(n.location){case"url":r.url&&(r.url=r.url.replace(new RegExp(`([?&])${Mz(n.field)}=[^&]*`),`$1${n.field}=${i}`));break;case"header":if(Array.isArray(r.headers)){let s=r.headers.find(o=>o.key===n.field&&o.value===n.value);s&&(s.value=i)}else r.headers&&r.headers[n.field]===n.value&&(r.headers[n.field]=i);break;case"query":if(Array.isArray(r.query)){let s=r.query.find(o=>o.key===n.field&&o.value===n.value);s&&(s.value=i)}else r.query&&r.query[n.field]===n.value&&(r.query[n.field]=i);break;case"auth":if(r.auth){if(n.field==="bearerToken")r.auth.bearerToken=i;else if(n.field==="basicAuth.password"&&r.auth.basicAuth)r.auth.basicAuth.password=i;else if(n.field==="apiKey.value"){let s=r.auth.apikey||r.auth.apiKey;s&&(s.value=i)}}break;case"body":Nz(r,n.field,n.path,n.value,i);break}}return r}function Nz(t,e,r,n,i){let s=typeof t.body=="object"&&t.body!==null&&"content"in t.body?t.body:null,o=s?s.content:t.body;if(o){if(typeof o=="string"){let l=o.trim();if(l.startsWith("{")||l.startsWith("[")){try{let c=JSON.parse(l);mP(c,e,r||e,n,i);let d=JSON.stringify(c,null,2);s?s.content=d:t.body=d}catch{}return}if(l.includes("=")&&!l.includes(`
|
|
97
|
-
`)){let c=new URLSearchParams(l);if(c.get(e)===n){c.set(e,i);let d=c.toString();s?s.content=d:t.body=d}return}return}typeof o=="object"&&o!==null&&mP(o,e,r||e,n,i)}}function mP(t,e,r,n,i){let s=r.split("."),o=t;for(let c=0;c<s.length-1;c++){let d=s[c],p=d.match(/^(.+)\[(\d+)\]$/);if(p?o=o?.[p[1]]?.[parseInt(p[2])]:o=o?.[d],o==null)return}let l=s[s.length-1];o&&o[l]===n&&(o[l]=i)}function Mz(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var So,_0,Cn,kz,od=ae(()=>{"use strict";So="***",_0=/^(authorization|proxy-authorization|www-authenticate)$|(token|cookie|secret|credential|api[_\-]?key|bearer|session[_\-]?id)/i,Cn=/(password|passwd|pwd|token|cookie|secret|credential|api[_\-]?key|apikey|access[_\-]?token|refresh[_\-]?token|client[_\-]?secret|private[_\-]?key|auth[_\-]?code|bearer|session[_\-]?id|jwt)/i;kz=/\{\{[^}]+\}\}/});import*as Le from"fs";import*as nn from"path";var ad,O0=ae(()=>{"use strict";jn();od();ad=class{historyPath;sharedHistoryPath;constructor(e,r){this.historyPath=e,this.sharedHistoryPath=r}getEnvironmentHistoryPath(e){return nn.join(this.historyPath,Vt(e))}getCollectionHistoryPath(e,r){return nn.join(this.getEnvironmentHistoryPath(e),r)}getRequestPath(e,r,n){return nn.join(this.getCollectionHistoryPath(e,r),Vt(n))}getSharedEnvironmentHistoryPath(e){return nn.join(this.sharedHistoryPath,Vt(e))}getSharedCollectionHistoryPath(e,r){return nn.join(this.getSharedEnvironmentHistoryPath(e),r)}getSharedRequestPath(e,r,n){return nn.join(this.getSharedCollectionHistoryPath(e,r),Vt(n))}getHistoryFilePath(e,r,n){return nn.join(this.getRequestPath(e,r,n),"transactions.json")}getSharedHistoryFilePath(e,r,n){return nn.join(this.getSharedRequestPath(e,r,n),"transactions.json")}getResponseFilePath(e,r,n,i){return nn.join(this.getRequestPath(e,r,n),`${i}.json`)}getSharedResponseFilePath(e,r,n,i){return nn.join(this.getSharedRequestPath(e,r,n),`${i}.json`)}loadHistory(e,r,n){let i=this.getHistoryFilePath(e,r,n);try{if(!Le.existsSync(i))return null;let s=Le.readFileSync(i,"utf-8"),o=JSON.parse(s);return{environment:e||o.environment,requestPath:r||o.requestPath,requestId:n||o.requestId,method:o.method,requests:o.requests}}catch(s){return console.error(`Failed to load history for ${n}:`,s),null}}loadSharedHistory(e,r,n){let i=this.getSharedHistoryFilePath(e,r,n);try{if(!Le.existsSync(i))return null;let s=Le.readFileSync(i,"utf-8"),o=JSON.parse(s);return{environment:e||o.environment,requestPath:r||o.requestPath,requestId:n||o.requestId,method:o.method,requests:o.requests}}catch(s){return console.error(`Failed to load shared history for ${n}:`,s),null}}getEntriesForEnvironment(e,r,n){let i=this.loadHistory(e,r,n);return i?i.requests:[]}getEntriesGroupedByTicket(e,r,n){let i=this.getEntriesForEnvironment(e,r,n),s=new Map;for(let o of i){let l=o.ticket||o.branch||"";s.has(l)||s.set(l,[]),s.get(l).push(o)}return s}getSharedEntriesGroupedByTicket(e,r,n){let i=this.loadSharedHistory(e,r,n)?.requests??[],s=new Map;for(let o of i){let l=o.ticket||o.branch||"";s.has(l)||s.set(l,[]),s.get(l).push(o)}return s}saveHistory(e){let r=this.getRequestPath(e.environment,e.requestPath,e.requestId),n=this.getHistoryFilePath(e.environment,e.requestPath,e.requestId);try{Le.existsSync(r)||Le.mkdirSync(r,{recursive:!0}),Le.writeFileSync(n,JSON.stringify(e,null,2),"utf-8")}catch(i){throw console.error(`Failed to save history for ${e.requestId}:`,i),i}}saveSharedHistory(e){let r=this.getSharedRequestPath(e.environment,e.requestPath,e.requestId),n=this.getSharedHistoryFilePath(e.environment,e.requestPath,e.requestId);try{Le.existsSync(r)||Le.mkdirSync(r,{recursive:!0}),Le.writeFileSync(n,JSON.stringify(e,null,2),"utf-8")}catch(i){throw console.error(`Failed to save shared history for ${e.requestId}:`,i),i}}addEntry(e,r,n,i,s){let o=this.loadHistory(e,r,n);o||(o={environment:e,requestPath:r,requestId:n,method:i,requests:[]});let l=x0({...s,method:i,id:tS(),timestamp:Date.now()});return o.requests.unshift(l),o.requests.length>100&&(o.requests=o.requests.slice(0,100)),this.saveHistory(o),l}deleteEntry(e,r,n,i){let s=this.loadHistory(e,r,n);if(!s)return!1;let o=s.requests.length;if(s.requests=s.requests.filter(l=>l.id!==i),s.requests.length!==o){this.saveHistory(s);let l=this.getResponseFilePath(e,r,n,i);return Le.existsSync(l)&&Le.unlinkSync(l),!0}return!1}deleteSharedEntry(e,r,n,i){let s=this.loadSharedHistory(e,r,n);if(!s)return!1;let o=s.requests.length;if(s.requests=s.requests.filter(l=>l.id!==i),s.requests.length!==o){this.saveSharedHistory(s);let l=this.getSharedResponseFilePath(e,r,n,i);return Le.existsSync(l)&&Le.unlinkSync(l),!0}return!1}shareEntry(e,r,n,i,s){let o=(s||"").trim();if(!o)return!1;let l=this.loadHistory(e,r,n);if(!l)return!1;let c=l.requests.findIndex(b=>b.id===i);if(c===-1)return!1;let[d]=l.requests.splice(c,1);this.saveHistory(l);let p=this.loadSharedHistory(e,r,n)||{environment:e,requestPath:r,requestId:n,method:l.method,requests:[]};if(!p.requests.some(b=>b.id===i)){let b={...d,ticket:null,branch:o};p.requests.unshift(b),p.requests.length>100&&(p.requests=p.requests.slice(0,100)),this.saveSharedHistory(p)}let m=this.getResponseFilePath(e,r,n,i),y=this.getSharedResponseFilePath(e,r,n,i);if(Le.existsSync(m)){let b=nn.dirname(y);Le.existsSync(b)||Le.mkdirSync(b,{recursive:!0});try{Le.renameSync(m,y)}catch{try{Le.copyFileSync(m,y)}catch(C){return console.error(`Failed to copy full response from ${m} to ${y}:`,C),!0}try{Le.unlinkSync(m)}catch(C){console.warn(`Failed to remove original full response after copy: ${m}`,C)}}}return!0}moveSharedEntry(e,r,n,i,s){let o=(s||"").trim();if(!o)return!1;let l=this.loadSharedHistory(e,r,n);if(!l)return!1;let c=!1;return l.requests=l.requests.map(d=>d.id===i?(c=!0,{...d,ticket:null,branch:o}):d),c?(this.saveSharedHistory(l),!0):!1}renameSharedGroup(e,r,n,i,s){let o=(i||"").trim(),l=(s||"").trim();if(!o||!l||o===l)return!1;let c=this.loadSharedHistory(e,r,n);if(!c)return!1;let d=!1;return c.requests=c.requests.map(p=>!p.ticket&&p.branch===o?(d=!0,{...p,branch:l}):p),d?(this.saveSharedHistory(c),!0):!1}clearHistory(e,r,n){let i=this.getRequestPath(e,r,n);if(Le.existsSync(i)){let s=Le.readdirSync(i);for(let o of s)Le.unlinkSync(nn.join(i,o));Le.rmdirSync(i)}}saveFullResponse(e,r,n,i,s){let o=this.getRequestPath(e,r,n),l=this.getResponseFilePath(e,r,n,i);try{Le.existsSync(o)||Le.mkdirSync(o,{recursive:!0});let c=E0(s);Le.writeFileSync(l,JSON.stringify(c,null,2),"utf-8")}catch(c){throw console.error(`Failed to save full response for ${i}:`,c),c}}loadFullResponse(e,r,n,i){let s=this.getResponseFilePath(e,r,n,i);try{if(!Le.existsSync(s))return null;let o=Le.readFileSync(s,"utf-8");return JSON.parse(o)}catch(o){return console.error(`Failed to load full response for ${i}:`,o),null}}loadSharedFullResponse(e,r,n,i){let s=this.getSharedResponseFilePath(e,r,n,i);try{if(!Le.existsSync(s))return null;let o=Le.readFileSync(s,"utf-8");return JSON.parse(o)}catch(o){return console.error(`Failed to load shared full response for ${i}:`,o),null}}}});var Eu,I0=ae(()=>{"use strict";Eu=class{constructor(e,r){this.historyService=e;this.inferrer=r}historyService;inferrer;async analyze(e,r,n){let i=n?.environment||"default",s=n?.maxSamples||50,o=this.historyService.loadHistory(i,e,r),l=this.historyService.loadSharedHistory(i,e,r),c=[...o?.requests||[],...l?.requests||[]];if(c.length===0)return{responses:{}};let d=c.slice(0,s),p=new Map;for(let y of d){let b=this.historyService.loadFullResponse(i,e,r,y.id);if(b||(b=this.historyService.loadSharedFullResponse(i,e,r,y.id)),b){let E=b.status;p.has(E)||p.set(E,[]),p.get(E).push(b)}}let m={};for(let[y,b]of p){let E=this.buildResponseDefinition(b);m[String(y)]=E}return{responses:m}}buildResponseDefinition(e){let r={};if(e.length===0)return r;let n=e[0];r.description=n.statusText||`Status ${n.status}`;let i=this.extractContentType(n.headers);if(i&&(r.contentType=i),i&&this.isJsonContentType(i)){let o=this.inferBodySchema(n);for(let l=1;l<e.length;l++){let c=this.inferBodySchema(e[l]);c&&o?o=this.inferrer.mergeSchemas(o,c):c&&(o=c)}if(o&&(r.schema=o),n.body!==void 0&&n.body!==null){let l=typeof n.body=="string"?this.tryParseJson(n.body):n.body;l!==void 0&&(r.examples={default:{summary:"Captured from history",value:l}})}}let s=this.findConsistentHeaders(e);return Object.keys(s).length>0&&(r.headers=s),r}inferBodySchema(e){if(e.body===void 0||e.body===null)return;let r=e.body;if(!(typeof r=="string"&&(r=this.tryParseJson(r),r===void 0)))return this.inferrer.inferFromValue(r)}extractContentType(e){for(let[r,n]of Object.entries(e))if(r.toLowerCase()==="content-type")return(Array.isArray(n)?n[0]:n).split(";")[0].trim()}isJsonContentType(e){return e.includes("json")||e.includes("+json")||e==="application/json"}findConsistentHeaders(e){if(e.length===0)return{};let r=new Set(["content-type","content-length","content-encoding","transfer-encoding","connection","date","server","set-cookie","vary","cache-control","expires","pragma","etag","last-modified","age"]),n=new Map,i=new Map;for(let l of e)for(let[c,d]of Object.entries(l.headers)){let p=c.toLowerCase();r.has(p)||(n.set(p,(n.get(p)||0)+1),i.has(p)||i.set(p,Array.isArray(d)?d.join(", "):d))}let s=Math.ceil(e.length/2),o={};for(let[l,c]of n)if(c>=s){let d=i.get(l);o[l]={schema:this.inferHeaderSchema(d)}}return o}inferHeaderSchema(e){return e?/^\d+$/.test(e)?{type:"integer"}:{type:"string"}:{type:"string"}}tryParseJson(e){try{return JSON.parse(e)}catch{return}}}});var st=V(yr=>{"use strict";var P0=Symbol.for("yaml.alias"),gP=Symbol.for("yaml.document"),Fm=Symbol.for("yaml.map"),yP=Symbol.for("yaml.pair"),k0=Symbol.for("yaml.scalar"),Dm=Symbol.for("yaml.seq"),xs=Symbol.for("yaml.node.type"),Fz=t=>!!t&&typeof t=="object"&&t[xs]===P0,Dz=t=>!!t&&typeof t=="object"&&t[xs]===gP,jz=t=>!!t&&typeof t=="object"&&t[xs]===Fm,Lz=t=>!!t&&typeof t=="object"&&t[xs]===yP,vP=t=>!!t&&typeof t=="object"&&t[xs]===k0,Uz=t=>!!t&&typeof t=="object"&&t[xs]===Dm;function bP(t){if(t&&typeof t=="object")switch(t[xs]){case Fm:case Dm:return!0}return!1}function Hz(t){if(t&&typeof t=="object")switch(t[xs]){case P0:case Fm:case k0:case Dm:return!0}return!1}var Bz=t=>(vP(t)||bP(t))&&!!t.anchor;yr.ALIAS=P0;yr.DOC=gP;yr.MAP=Fm;yr.NODE_TYPE=xs;yr.PAIR=yP;yr.SCALAR=k0;yr.SEQ=Dm;yr.hasAnchor=Bz;yr.isAlias=Fz;yr.isCollection=bP;yr.isDocument=Dz;yr.isMap=jz;yr.isNode=Hz;yr.isPair=Lz;yr.isScalar=vP;yr.isSeq=Uz});var ld=V(A0=>{"use strict";var lr=st(),sn=Symbol("break visit"),SP=Symbol("skip children"),zi=Symbol("remove node");function jm(t,e){let r=wP(e);lr.isDocument(t)?qu(null,t.contents,r,Object.freeze([t]))===zi&&(t.contents=null):qu(null,t,r,Object.freeze([]))}jm.BREAK=sn;jm.SKIP=SP;jm.REMOVE=zi;function qu(t,e,r,n){let i=_P(t,e,r,n);if(lr.isNode(i)||lr.isPair(i))return RP(t,n,i),qu(t,i,r,n);if(typeof i!="symbol"){if(lr.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=qu(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===sn)return sn;o===zi&&(e.items.splice(s,1),s-=1)}}}else if(lr.isPair(e)){n=Object.freeze(n.concat(e));let s=qu("key",e.key,r,n);if(s===sn)return sn;s===zi&&(e.key=null);let o=qu("value",e.value,r,n);if(o===sn)return sn;o===zi&&(e.value=null)}}return i}async function Lm(t,e){let r=wP(e);lr.isDocument(t)?await Ou(null,t.contents,r,Object.freeze([t]))===zi&&(t.contents=null):await Ou(null,t,r,Object.freeze([]))}Lm.BREAK=sn;Lm.SKIP=SP;Lm.REMOVE=zi;async function Ou(t,e,r,n){let i=await _P(t,e,r,n);if(lr.isNode(i)||lr.isPair(i))return RP(t,n,i),Ou(t,i,r,n);if(typeof i!="symbol"){if(lr.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=await Ou(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===sn)return sn;o===zi&&(e.items.splice(s,1),s-=1)}}}else if(lr.isPair(e)){n=Object.freeze(n.concat(e));let s=await Ou("key",e.key,r,n);if(s===sn)return sn;s===zi&&(e.key=null);let o=await Ou("value",e.value,r,n);if(o===sn)return sn;o===zi&&(e.value=null)}}return i}function wP(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function _P(t,e,r,n){if(typeof r=="function")return r(t,e,n);if(lr.isMap(e))return r.Map?.(t,e,n);if(lr.isSeq(e))return r.Seq?.(t,e,n);if(lr.isPair(e))return r.Pair?.(t,e,n);if(lr.isScalar(e))return r.Scalar?.(t,e,n);if(lr.isAlias(e))return r.Alias?.(t,e,n)}function RP(t,e,r){let n=e[e.length-1];if(lr.isCollection(n))n.items[t]=r;else if(lr.isPair(n))t==="key"?n.key=r:n.value=r;else if(lr.isDocument(n))n.contents=r;else{let i=lr.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}A0.visit=jm;A0.visitAsync=Lm});var T0=V(xP=>{"use strict";var CP=st(),Vz=ld(),Wz={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},zz=t=>t.replace(/[!,[\]{}]/g,e=>Wz[e]),ud=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[s,o]=n;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[s]=n;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return r(6,`Unsupported YAML version ${s}`,o),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let s=this.tags[n];if(s)try{return s+decodeURIComponent(i)}catch(o){return r(String(o)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+zz(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&CP.isNode(e.contents)){let s={};Vz.visit(e.contents,(o,l)=>{CP.isNode(l)&&l.tag&&(s[l.tag]=!0)}),i=Object.keys(s)}else i=[];for(let[s,o]of n)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(l=>l.startsWith(o)))&&r.push(`%TAG ${s} ${o}`);return r.join(`
|
|
97
|
+
`)){let c=new URLSearchParams(l);if(c.get(e)===n){c.set(e,i);let d=c.toString();s?s.content=d:t.body=d}return}return}typeof o=="object"&&o!==null&&mP(o,e,r||e,n,i)}}function mP(t,e,r,n,i){let s=r.split("."),o=t;for(let c=0;c<s.length-1;c++){let d=s[c],p=d.match(/^(.+)\[(\d+)\]$/);if(p?o=o?.[p[1]]?.[parseInt(p[2])]:o=o?.[d],o==null)return}let l=s[s.length-1];o&&o[l]===n&&(o[l]=i)}function Mz(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var So,_0,Cn,kz,od=ae(()=>{"use strict";So="***",_0=/^(authorization|proxy-authorization|www-authenticate)$|(token|cookie|secret|credential|api[_\-]?key|bearer|session[_\-]?id)/i,Cn=/(password|passwd|pwd|token|cookie|secret|credential|api[_\-]?key|apikey|access[_\-]?token|refresh[_\-]?token|client[_\-]?secret|private[_\-]?key|auth[_\-]?code|bearer|session[_\-]?id|jwt)/i;kz=/\{\{[^}]+\}\}/});import*as Le from"fs";import*as nn from"path";var ad,O0=ae(()=>{"use strict";jn();od();ad=class{historyPath;sharedHistoryPath;constructor(e,r){this.historyPath=e,this.sharedHistoryPath=r}getEnvironmentHistoryPath(e){return nn.join(this.historyPath,Vt(e))}getCollectionHistoryPath(e,r){return nn.join(this.getEnvironmentHistoryPath(e),r)}getRequestPath(e,r,n){return nn.join(this.getCollectionHistoryPath(e,r),Vt(n))}getSharedEnvironmentHistoryPath(e){return nn.join(this.sharedHistoryPath,Vt(e))}getSharedCollectionHistoryPath(e,r){return nn.join(this.getSharedEnvironmentHistoryPath(e),r)}getSharedRequestPath(e,r,n){return nn.join(this.getSharedCollectionHistoryPath(e,r),Vt(n))}getHistoryFilePath(e,r,n){return nn.join(this.getRequestPath(e,r,n),"transactions.json")}getSharedHistoryFilePath(e,r,n){return nn.join(this.getSharedRequestPath(e,r,n),"transactions.json")}getResponseFilePath(e,r,n,i){return nn.join(this.getRequestPath(e,r,n),`${i}.json`)}getSharedResponseFilePath(e,r,n,i){return nn.join(this.getSharedRequestPath(e,r,n),`${i}.json`)}loadHistory(e,r,n){let i=this.getHistoryFilePath(e,r,n);try{if(!Le.existsSync(i))return null;let s=Le.readFileSync(i,"utf-8"),o=JSON.parse(s);return{environment:e||o.environment,requestPath:r||o.requestPath,requestId:n||o.requestId,method:o.method,requests:o.requests}}catch(s){return console.error(`Failed to load history for ${n}:`,s),null}}loadSharedHistory(e,r,n){let i=this.getSharedHistoryFilePath(e,r,n);try{if(!Le.existsSync(i))return null;let s=Le.readFileSync(i,"utf-8"),o=JSON.parse(s);return{environment:e||o.environment,requestPath:r||o.requestPath,requestId:n||o.requestId,method:o.method,requests:o.requests}}catch(s){return console.error(`Failed to load shared history for ${n}:`,s),null}}getEntriesForEnvironment(e,r,n){let i=this.loadHistory(e,r,n);return i?i.requests:[]}getEntriesGroupedByTicket(e,r,n){let i=this.getEntriesForEnvironment(e,r,n),s=new Map;for(let o of i){let l=o.ticket||o.branch||"";s.has(l)||s.set(l,[]),s.get(l).push(o)}return s}getSharedEntriesGroupedByTicket(e,r,n){let i=this.loadSharedHistory(e,r,n)?.requests??[],s=new Map;for(let o of i){let l=o.ticket||o.branch||"";s.has(l)||s.set(l,[]),s.get(l).push(o)}return s}saveHistory(e){let r=this.getRequestPath(e.environment,e.requestPath,e.requestId),n=this.getHistoryFilePath(e.environment,e.requestPath,e.requestId);try{Le.existsSync(r)||Le.mkdirSync(r,{recursive:!0}),Le.writeFileSync(n,JSON.stringify(e,null,2),"utf-8")}catch(i){throw console.error(`Failed to save history for ${e.requestId}:`,i),i}}saveSharedHistory(e){let r=this.getSharedRequestPath(e.environment,e.requestPath,e.requestId),n=this.getSharedHistoryFilePath(e.environment,e.requestPath,e.requestId);try{Le.existsSync(r)||Le.mkdirSync(r,{recursive:!0}),Le.writeFileSync(n,JSON.stringify(e,null,2),"utf-8")}catch(i){throw console.error(`Failed to save shared history for ${e.requestId}:`,i),i}}addEntry(e,r,n,i,s){let o=this.loadHistory(e,r,n);o||(o={environment:e,requestPath:r,requestId:n,method:i,requests:[]});let l=x0({...s,method:i,id:tS(),timestamp:Date.now()});return o.requests.unshift(l),o.requests.length>100&&(o.requests=o.requests.slice(0,100)),this.saveHistory(o),l}deleteEntry(e,r,n,i){let s=this.loadHistory(e,r,n);if(!s)return!1;let o=s.requests.length;if(s.requests=s.requests.filter(l=>l.id!==i),s.requests.length!==o){this.saveHistory(s);let l=this.getResponseFilePath(e,r,n,i);return Le.existsSync(l)&&Le.unlinkSync(l),!0}return!1}deleteSharedEntry(e,r,n,i){let s=this.loadSharedHistory(e,r,n);if(!s)return!1;let o=s.requests.length;if(s.requests=s.requests.filter(l=>l.id!==i),s.requests.length!==o){this.saveSharedHistory(s);let l=this.getSharedResponseFilePath(e,r,n,i);return Le.existsSync(l)&&Le.unlinkSync(l),!0}return!1}shareEntry(e,r,n,i,s){let o=(s||"").trim();if(!o)return!1;let l=this.loadHistory(e,r,n);if(!l)return!1;let c=l.requests.findIndex(b=>b.id===i);if(c===-1)return!1;let[d]=l.requests.splice(c,1);this.saveHistory(l);let p=this.loadSharedHistory(e,r,n)||{environment:e,requestPath:r,requestId:n,method:l.method,requests:[]};if(!p.requests.some(b=>b.id===i)){let b={...d,ticket:null,branch:o};p.requests.unshift(b),p.requests.length>100&&(p.requests=p.requests.slice(0,100)),this.saveSharedHistory(p)}let m=this.getResponseFilePath(e,r,n,i),y=this.getSharedResponseFilePath(e,r,n,i);if(Le.existsSync(m)){let b=nn.dirname(y);Le.existsSync(b)||Le.mkdirSync(b,{recursive:!0});try{Le.renameSync(m,y)}catch{try{Le.copyFileSync(m,y)}catch(C){return console.error(`Failed to copy full response from ${m} to ${y}:`,C),!0}try{Le.unlinkSync(m)}catch(C){console.warn(`Failed to remove original full response after copy: ${m}`,C)}}}return!0}moveSharedEntry(e,r,n,i,s){let o=(s||"").trim();if(!o)return!1;let l=this.loadSharedHistory(e,r,n);if(!l)return!1;let c=!1;return l.requests=l.requests.map(d=>d.id===i?(c=!0,{...d,ticket:null,branch:o}):d),c?(this.saveSharedHistory(l),!0):!1}renameSharedGroup(e,r,n,i,s){let o=(i||"").trim(),l=(s||"").trim();if(!o||!l||o===l)return!1;let c=this.loadSharedHistory(e,r,n);if(!c)return!1;let d=!1;return c.requests=c.requests.map(p=>!p.ticket&&p.branch===o?(d=!0,{...p,branch:l}):p),d?(this.saveSharedHistory(c),!0):!1}clearHistory(e,r,n){let i=this.getRequestPath(e,r,n);if(Le.existsSync(i)){let s=Le.readdirSync(i);for(let o of s)Le.unlinkSync(nn.join(i,o));Le.rmdirSync(i)}}saveFullResponse(e,r,n,i,s){let o=this.getRequestPath(e,r,n),l=this.getResponseFilePath(e,r,n,i);try{Le.existsSync(o)||Le.mkdirSync(o,{recursive:!0});let c=E0(s);Le.writeFileSync(l,JSON.stringify(c,null,2),"utf-8")}catch(c){throw console.error(`Failed to save full response for ${i}:`,c),c}}loadFullResponse(e,r,n,i){let s=this.getResponseFilePath(e,r,n,i);try{if(!Le.existsSync(s))return null;let o=Le.readFileSync(s,"utf-8");return JSON.parse(o)}catch(o){return console.error(`Failed to load full response for ${i}:`,o),null}}loadSharedFullResponse(e,r,n,i){let s=this.getSharedResponseFilePath(e,r,n,i);try{if(!Le.existsSync(s))return null;let o=Le.readFileSync(s,"utf-8");return JSON.parse(o)}catch(o){return console.error(`Failed to load shared full response for ${i}:`,o),null}}}});var Eu,I0=ae(()=>{"use strict";Eu=class{constructor(e,r){this.historyService=e;this.inferrer=r}historyService;inferrer;async analyze(e,r,n){let i=n?.environment||"default",s=n?.maxSamples||50,o=this.historyService.loadHistory(i,e,r),l=this.historyService.loadSharedHistory(i,e,r),c=[...o?.requests||[],...l?.requests||[]];if(c.length===0)return{responses:{}};let d=c.slice(0,s),p=new Map;for(let y of d){let b=this.historyService.loadFullResponse(i,e,r,y.id);if(b||(b=this.historyService.loadSharedFullResponse(i,e,r,y.id)),b){let q=b.status;p.has(q)||p.set(q,[]),p.get(q).push(b)}}let m={};for(let[y,b]of p){let q=this.buildResponseDefinition(b);m[String(y)]=q}return{responses:m}}buildResponseDefinition(e){let r={};if(e.length===0)return r;let n=e[0];r.description=n.statusText||`Status ${n.status}`;let i=this.extractContentType(n.headers);if(i&&(r.contentType=i),i&&this.isJsonContentType(i)){let o=this.inferBodySchema(n);for(let l=1;l<e.length;l++){let c=this.inferBodySchema(e[l]);c&&o?o=this.inferrer.mergeSchemas(o,c):c&&(o=c)}if(o&&(r.schema=o),n.body!==void 0&&n.body!==null){let l=typeof n.body=="string"?this.tryParseJson(n.body):n.body;l!==void 0&&(r.examples={default:{summary:"Captured from history",value:l}})}}let s=this.findConsistentHeaders(e);return Object.keys(s).length>0&&(r.headers=s),r}inferBodySchema(e){if(e.body===void 0||e.body===null)return;let r=e.body;if(!(typeof r=="string"&&(r=this.tryParseJson(r),r===void 0)))return this.inferrer.inferFromValue(r)}extractContentType(e){for(let[r,n]of Object.entries(e))if(r.toLowerCase()==="content-type")return(Array.isArray(n)?n[0]:n).split(";")[0].trim()}isJsonContentType(e){return e.includes("json")||e.includes("+json")||e==="application/json"}findConsistentHeaders(e){if(e.length===0)return{};let r=new Set(["content-type","content-length","content-encoding","transfer-encoding","connection","date","server","set-cookie","vary","cache-control","expires","pragma","etag","last-modified","age"]),n=new Map,i=new Map;for(let l of e)for(let[c,d]of Object.entries(l.headers)){let p=c.toLowerCase();r.has(p)||(n.set(p,(n.get(p)||0)+1),i.has(p)||i.set(p,Array.isArray(d)?d.join(", "):d))}let s=Math.ceil(e.length/2),o={};for(let[l,c]of n)if(c>=s){let d=i.get(l);o[l]={schema:this.inferHeaderSchema(d)}}return o}inferHeaderSchema(e){return e?/^\d+$/.test(e)?{type:"integer"}:{type:"string"}:{type:"string"}}tryParseJson(e){try{return JSON.parse(e)}catch{return}}}});var st=V(yr=>{"use strict";var P0=Symbol.for("yaml.alias"),gP=Symbol.for("yaml.document"),Fm=Symbol.for("yaml.map"),yP=Symbol.for("yaml.pair"),k0=Symbol.for("yaml.scalar"),Dm=Symbol.for("yaml.seq"),xs=Symbol.for("yaml.node.type"),Fz=t=>!!t&&typeof t=="object"&&t[xs]===P0,Dz=t=>!!t&&typeof t=="object"&&t[xs]===gP,jz=t=>!!t&&typeof t=="object"&&t[xs]===Fm,Lz=t=>!!t&&typeof t=="object"&&t[xs]===yP,vP=t=>!!t&&typeof t=="object"&&t[xs]===k0,Uz=t=>!!t&&typeof t=="object"&&t[xs]===Dm;function bP(t){if(t&&typeof t=="object")switch(t[xs]){case Fm:case Dm:return!0}return!1}function Hz(t){if(t&&typeof t=="object")switch(t[xs]){case P0:case Fm:case k0:case Dm:return!0}return!1}var Bz=t=>(vP(t)||bP(t))&&!!t.anchor;yr.ALIAS=P0;yr.DOC=gP;yr.MAP=Fm;yr.NODE_TYPE=xs;yr.PAIR=yP;yr.SCALAR=k0;yr.SEQ=Dm;yr.hasAnchor=Bz;yr.isAlias=Fz;yr.isCollection=bP;yr.isDocument=Dz;yr.isMap=jz;yr.isNode=Hz;yr.isPair=Lz;yr.isScalar=vP;yr.isSeq=Uz});var ld=V(A0=>{"use strict";var lr=st(),sn=Symbol("break visit"),SP=Symbol("skip children"),zi=Symbol("remove node");function jm(t,e){let r=wP(e);lr.isDocument(t)?qu(null,t.contents,r,Object.freeze([t]))===zi&&(t.contents=null):qu(null,t,r,Object.freeze([]))}jm.BREAK=sn;jm.SKIP=SP;jm.REMOVE=zi;function qu(t,e,r,n){let i=_P(t,e,r,n);if(lr.isNode(i)||lr.isPair(i))return RP(t,n,i),qu(t,i,r,n);if(typeof i!="symbol"){if(lr.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=qu(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===sn)return sn;o===zi&&(e.items.splice(s,1),s-=1)}}}else if(lr.isPair(e)){n=Object.freeze(n.concat(e));let s=qu("key",e.key,r,n);if(s===sn)return sn;s===zi&&(e.key=null);let o=qu("value",e.value,r,n);if(o===sn)return sn;o===zi&&(e.value=null)}}return i}async function Lm(t,e){let r=wP(e);lr.isDocument(t)?await Ou(null,t.contents,r,Object.freeze([t]))===zi&&(t.contents=null):await Ou(null,t,r,Object.freeze([]))}Lm.BREAK=sn;Lm.SKIP=SP;Lm.REMOVE=zi;async function Ou(t,e,r,n){let i=await _P(t,e,r,n);if(lr.isNode(i)||lr.isPair(i))return RP(t,n,i),Ou(t,i,r,n);if(typeof i!="symbol"){if(lr.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=await Ou(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===sn)return sn;o===zi&&(e.items.splice(s,1),s-=1)}}}else if(lr.isPair(e)){n=Object.freeze(n.concat(e));let s=await Ou("key",e.key,r,n);if(s===sn)return sn;s===zi&&(e.key=null);let o=await Ou("value",e.value,r,n);if(o===sn)return sn;o===zi&&(e.value=null)}}return i}function wP(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function _P(t,e,r,n){if(typeof r=="function")return r(t,e,n);if(lr.isMap(e))return r.Map?.(t,e,n);if(lr.isSeq(e))return r.Seq?.(t,e,n);if(lr.isPair(e))return r.Pair?.(t,e,n);if(lr.isScalar(e))return r.Scalar?.(t,e,n);if(lr.isAlias(e))return r.Alias?.(t,e,n)}function RP(t,e,r){let n=e[e.length-1];if(lr.isCollection(n))n.items[t]=r;else if(lr.isPair(n))t==="key"?n.key=r:n.value=r;else if(lr.isDocument(n))n.contents=r;else{let i=lr.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}A0.visit=jm;A0.visitAsync=Lm});var T0=V(xP=>{"use strict";var CP=st(),Vz=ld(),Wz={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},zz=t=>t.replace(/[!,[\]{}]/g,e=>Wz[e]),ud=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[s,o]=n;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[s]=n;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return r(6,`Unsupported YAML version ${s}`,o),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let s=this.tags[n];if(s)try{return s+decodeURIComponent(i)}catch(o){return r(String(o)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+zz(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&CP.isNode(e.contents)){let s={};Vz.visit(e.contents,(o,l)=>{CP.isNode(l)&&l.tag&&(s[l.tag]=!0)}),i=Object.keys(s)}else i=[];for(let[s,o]of n)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(l=>l.startsWith(o)))&&r.push(`%TAG ${s} ${o}`);return r.join(`
|
|
98
98
|
`)}};ud.defaultYaml={explicit:!1,version:"1.2"};ud.defaultTags={"!!":"tag:yaml.org,2002:"};xP.Directives=ud});var Um=V(cd=>{"use strict";var EP=st(),Jz=ld();function Gz(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function qP(t){let e=new Set;return Jz.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function OP(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Yz(t,e){let r=[],n=new Map,i=null;return{onAnchor:s=>{r.push(s),i??(i=qP(t));let o=OP(e,i);return i.add(o),o},setAnchors:()=>{for(let s of r){let o=n.get(s);if(typeof o=="object"&&o.anchor&&(EP.isScalar(o.node)||EP.isCollection(o.node)))o.node.anchor=o.anchor;else{let l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=s,l}}},sourceObjects:n}}cd.anchorIsValid=Gz;cd.anchorNames=qP;cd.createNodeAnchors=Yz;cd.findNewAnchor=OP});var $0=V(IP=>{"use strict";function fd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,s=n.length;i<s;++i){let o=n[i],l=fd(t,n,String(i),o);l===void 0?delete n[i]:l!==o&&(n[i]=l)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let s=n.get(i),o=fd(t,n,i,s);o===void 0?n.delete(i):o!==s&&n.set(i,o)}else if(n instanceof Set)for(let i of Array.from(n)){let s=fd(t,n,i,i);s===void 0?n.delete(i):s!==i&&(n.delete(i),n.add(s))}else for(let[i,s]of Object.entries(n)){let o=fd(t,n,i,s);o===void 0?delete n[i]:o!==s&&(n[i]=o)}return t.call(e,r,n)}IP.applyReviver=fd});var wo=V(kP=>{"use strict";var Kz=st();function PP(t,e,r){if(Array.isArray(t))return t.map((n,i)=>PP(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Kz.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=s=>{n.res=s,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}kP.toJS=PP});var Hm=V(TP=>{"use strict";var Qz=$0(),AP=st(),Zz=wo(),N0=class{constructor(e){Object.defineProperty(this,AP.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:s}={}){if(!AP.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},l=Zz.toJS(this,"",o);if(typeof i=="function")for(let{count:c,res:d}of o.anchors.values())i(d,c);return typeof s=="function"?Qz.applyReviver(s,{"":l},"",l):l}};TP.NodeBase=N0});var dd=V($P=>{"use strict";var Xz=Um(),eJ=ld(),Iu=st(),tJ=Hm(),rJ=wo(),M0=class extends tJ.NodeBase{constructor(e){super(Iu.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],eJ.visit(e,{Node:(s,o)=>{(Iu.isAlias(o)||Iu.hasAnchor(o))&&n.push(o)}}),r&&(r.aliasResolveCache=n));let i;for(let s of n){if(s===this)break;s.anchor===this.source&&(i=s)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:s}=r,o=this.resolve(i,r);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let l=n.get(o);if(l||(rJ.toJS(o,null,r),l=n.get(o)),l?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=Bm(i,o,n)),l.count*l.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return l.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Xz.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${i} `}return i}};function Bm(t,e,r){if(Iu.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Iu.isCollection(e)){let n=0;for(let i of e.items){let s=Bm(t,i,r);s>n&&(n=s)}return n}else if(Iu.isPair(e)){let n=Bm(t,e.key,r),i=Bm(t,e.value,r);return Math.max(n,i)}return 1}$P.Alias=M0});var tr=V(F0=>{"use strict";var nJ=st(),iJ=Hm(),sJ=wo(),oJ=t=>!t||typeof t!="function"&&typeof t!="object",_o=class extends iJ.NodeBase{constructor(e){super(nJ.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:sJ.toJS(this.value,e,r)}toString(){return String(this.value)}};_o.BLOCK_FOLDED="BLOCK_FOLDED";_o.BLOCK_LITERAL="BLOCK_LITERAL";_o.PLAIN="PLAIN";_o.QUOTE_DOUBLE="QUOTE_DOUBLE";_o.QUOTE_SINGLE="QUOTE_SINGLE";F0.Scalar=_o;F0.isScalarValue=oJ});var pd=V(MP=>{"use strict";var aJ=dd(),Ha=st(),NP=tr(),lJ="tag:yaml.org,2002:";function uJ(t,e,r){if(e){let n=r.filter(s=>s.tag===e),i=n.find(s=>!s.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function cJ(t,e,r){if(Ha.isDocument(t)&&(t=t.contents),Ha.isNode(t))return t;if(Ha.isPair(t)){let m=r.schema[Ha.MAP].createNode?.(r.schema,null,r);return m.items.push(t),m}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:s,schema:o,sourceObjects:l}=r,c;if(n&&t&&typeof t=="object"){if(c=l.get(t),c)return c.anchor??(c.anchor=i(t)),new aJ.Alias(c.anchor);c={anchor:null,node:null},l.set(t,c)}e?.startsWith("!!")&&(e=lJ+e.slice(2));let d=uJ(t,e,o.tags);if(!d){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let m=new NP.Scalar(t);return c&&(c.node=m),m}d=t instanceof Map?o[Ha.MAP]:Symbol.iterator in Object(t)?o[Ha.SEQ]:o[Ha.MAP]}s&&(s(d),delete r.onTagObj);let p=d?.createNode?d.createNode(r.schema,t,r):typeof d?.nodeClass?.from=="function"?d.nodeClass.from(r.schema,t,r):new NP.Scalar(t);return e?p.tag=e:d.default||(p.tag=d.tag),c&&(c.node=p),p}MP.createNode=cJ});var Wm=V(Vm=>{"use strict";var fJ=pd(),Ji=st(),dJ=Hm();function D0(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let s=e[i];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let o=[];o[s]=n,n=o}else n=new Map([[s,n]])}return fJ.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var FP=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,j0=class extends dJ.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Ji.isNode(n)||Ji.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(FP(e))this.add(r);else{let[n,...i]=e,s=this.get(n,!0);if(Ji.isCollection(s))s.addIn(i,r);else if(s===void 0&&this.schema)this.set(n,D0(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Ji.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,s=this.get(n,!0);return i.length===0?!r&&Ji.isScalar(s)?s.value:s:Ji.isCollection(s)?s.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Ji.isPair(r))return!1;let n=r.value;return n==null||e&&Ji.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Ji.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let s=this.get(n,!0);if(Ji.isCollection(s))s.setIn(i,r);else if(s===void 0&&this.schema)this.set(n,D0(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Vm.Collection=j0;Vm.collectionFromPath=D0;Vm.isEmptyPath=FP});var hd=V(zm=>{"use strict";var pJ=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function L0(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var hJ=(t,e,r)=>t.endsWith(`
|
|
99
99
|
`)?L0(r,e):r.includes(`
|
|
100
100
|
`)?`
|
|
101
|
-
`+L0(r,e):(t.endsWith(" ")?"":" ")+r;zm.indentComment=L0;zm.lineComment=hJ;zm.stringifyComment=pJ});var jP=V(md=>{"use strict";var mJ="flow",U0="block",Jm="quoted";function gJ(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:s=20,onFold:o,onOverflow:l}={}){if(!i||i<0)return t;i<s&&(s=0);let c=Math.max(1+s,1+i-e.length);if(t.length<=c)return t;let d=[],p={},m=i-e.length;typeof n=="number"&&(n>i-Math.max(2,s)?d.push(0):m=i-n);let y,b,
|
|
101
|
+
`+L0(r,e):(t.endsWith(" ")?"":" ")+r;zm.indentComment=L0;zm.lineComment=hJ;zm.stringifyComment=pJ});var jP=V(md=>{"use strict";var mJ="flow",U0="block",Jm="quoted";function gJ(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:s=20,onFold:o,onOverflow:l}={}){if(!i||i<0)return t;i<s&&(s=0);let c=Math.max(1+s,1+i-e.length);if(t.length<=c)return t;let d=[],p={},m=i-e.length;typeof n=="number"&&(n>i-Math.max(2,s)?d.push(0):m=i-n);let y,b,q=!1,C=-1,v=-1,_=-1;r===U0&&(C=DP(t,C,e.length),C!==-1&&(m=C+c));for(let k;k=t[C+=1];){if(r===Jm&&k==="\\"){switch(v=C,t[C+1]){case"x":C+=3;break;case"u":C+=5;break;case"U":C+=9;break;default:C+=1}_=C}if(k===`
|
|
102
102
|
`)r===U0&&(C=DP(t,C,e.length)),m=C+e.length+c,y=void 0;else{if(k===" "&&b&&b!==" "&&b!==`
|
|
103
103
|
`&&b!==" "){let O=t[C+1];O&&O!==" "&&O!==`
|
|
104
|
-
`&&O!==" "&&(y=C)}if(C>=m)if(y)d.push(y),m=y+c,y=void 0;else if(r===Jm){for(;b===" "||b===" ";)b=k,k=t[C+=1],
|
|
105
|
-
${e}${t.slice(0,M)}`:(r===Jm&&p[O]&&(
|
|
106
|
-
${e}${t.slice(O+1,M)}`)}return
|
|
104
|
+
`&&O!==" "&&(y=C)}if(C>=m)if(y)d.push(y),m=y+c,y=void 0;else if(r===Jm){for(;b===" "||b===" ";)b=k,k=t[C+=1],q=!0;let O=C>_+1?C-2:v-1;if(p[O])return t;d.push(O),p[O]=!0,m=O+c,y=void 0}else q=!0}b=k}if(q&&l&&l(),d.length===0)return t;o&&o();let E=t.slice(0,d[0]);for(let k=0;k<d.length;++k){let O=d[k],M=d[k+1]||t.length;O===0?E=`
|
|
105
|
+
${e}${t.slice(0,M)}`:(r===Jm&&p[O]&&(E+=`${t[O]}\\`),E+=`
|
|
106
|
+
${e}${t.slice(O+1,M)}`)}return E}function DP(t,e,r){let n=e,i=e+1,s=t[i];for(;s===" "||s===" ";)if(e<i+r)s=t[++e];else{do s=t[++e];while(s&&s!==`
|
|
107
107
|
`);n=e,i=e+1,s=t[i]}return n}md.FOLD_BLOCK=U0;md.FOLD_FLOW=mJ;md.FOLD_QUOTED=Jm;md.foldFlowLines=gJ});var yd=V(LP=>{"use strict";var mi=tr(),Ro=jP(),Ym=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Km=t=>/^(%|---|\.\.\.)/m.test(t);function yJ(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let s=0,o=0;s<i;++s)if(t[s]===`
|
|
108
108
|
`){if(s-o>n)return!0;if(o=s+1,i-o<=n)return!1}return!0}function gd(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(Km(t)?" ":""),o="",l=0;for(let c=0,d=r[c];d;d=r[++c])if(d===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(o+=r.slice(l,c)+"\\ ",c+=1,l=c,d="\\"),d==="\\")switch(r[c+1]){case"u":{o+=r.slice(l,c);let p=r.substr(c+2,4);switch(p){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:p.substr(0,2)==="00"?o+="\\x"+p.substr(2):o+=r.substr(c,6)}c+=5,l=c+1}break;case"n":if(n||r[c+2]==='"'||r.length<i)c+=1;else{for(o+=r.slice(l,c)+`
|
|
109
109
|
|
|
@@ -116,20 +116,20 @@ ${r}`)+"'";return e.implicitKey?n:Ro.foldFlowLines(n,r,Ro.FOLD_FLOW,Ym(e,!1))}fu
|
|
|
116
116
|
|$)`,"g")}catch{B0=/\n+(?!\n|$)/g}function Gm({comment:t,type:e,value:r},n,i,s){let{blockQuote:o,commentString:l,lineWidth:c}=n.options;if(!o||/\n[\t ]+$/.test(r))return Pu(r,n);let d=n.indent||(n.forceBlockIndent||Km(r)?" ":""),p=o==="literal"?!0:o==="folded"||e===mi.Scalar.BLOCK_FOLDED?!1:e===mi.Scalar.BLOCK_LITERAL?!0:!yJ(r,c,d.length);if(!r)return p?`|
|
|
117
117
|
`:`>
|
|
118
118
|
`;let m,y;for(y=r.length;y>0;--y){let M=r[y-1];if(M!==`
|
|
119
|
-
`&&M!==" "&&M!==" ")break}let b=r.substring(y),
|
|
120
|
-
`);
|
|
119
|
+
`&&M!==" "&&M!==" ")break}let b=r.substring(y),q=b.indexOf(`
|
|
120
|
+
`);q===-1?m="-":r===b||q!==b.length-1?(m="+",s&&s()):m="",b&&(r=r.slice(0,-b.length),b[b.length-1]===`
|
|
121
121
|
`&&(b=b.slice(0,-1)),b=b.replace(B0,`$&${d}`));let C=!1,v,_=-1;for(v=0;v<r.length;++v){let M=r[v];if(M===" ")C=!0;else if(M===`
|
|
122
|
-
`)_=v;else break}let
|
|
123
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${d}`),j=!1,I=Ym(n,!0);o!=="folded"&&e!==mi.Scalar.BLOCK_FOLDED&&(I.onOverflow=()=>{j=!0});let R=Ro.foldFlowLines(`${
|
|
122
|
+
`)_=v;else break}let E=r.substring(0,_<v?_+1:v);E&&(r=r.substring(E.length),E=E.replace(/\n+/g,`$&${d}`));let O=(C?d?"2":"1":"")+m;if(t&&(O+=" "+l(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!p){let M=r.replace(/\n+/g,`
|
|
123
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${d}`),j=!1,I=Ym(n,!0);o!=="folded"&&e!==mi.Scalar.BLOCK_FOLDED&&(I.onOverflow=()=>{j=!0});let R=Ro.foldFlowLines(`${E}${M}${b}`,d,Ro.FOLD_BLOCK,I);if(!j)return`>${O}
|
|
124
124
|
${d}${R}`}return r=r.replace(/\n+/g,`$&${d}`),`|${O}
|
|
125
|
-
${d}${
|
|
125
|
+
${d}${E}${r}${b}`}function vJ(t,e,r,n){let{type:i,value:s}=t,{actualString:o,implicitKey:l,indent:c,indentStep:d,inFlow:p}=e;if(l&&s.includes(`
|
|
126
126
|
`)||p&&/[[\]{},]/.test(s))return Pu(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return l||p||!s.includes(`
|
|
127
127
|
`)?Pu(s,e):Gm(t,e,r,n);if(!l&&!p&&i!==mi.Scalar.PLAIN&&s.includes(`
|
|
128
128
|
`))return Gm(t,e,r,n);if(Km(s)){if(c==="")return e.forceBlockIndent=!0,Gm(t,e,r,n);if(l&&c===d)return Pu(s,e)}let m=s.replace(/\n+/g,`$&
|
|
129
|
-
${c}`);if(o){let y=C=>C.default&&C.tag!=="tag:yaml.org,2002:str"&&C.test?.test(m),{compat:b,tags:
|
|
130
|
-
${e.indent}${l}`:l}V0.createStringifyContext=RJ;V0.stringify=EJ});var VP=V(BP=>{"use strict";var Es=st(),UP=tr(),HP=vd(),bd=hd();function qJ({key:t,value:e},r,n,i){let{allNullValues:s,doc:o,indent:l,indentStep:c,options:{commentString:d,indentSeq:p,simpleKeys:m}}=r,y=Es.isNode(t)&&t.comment||null;if(m){if(y)throw new Error("With simple keys, key nodes cannot have comments");if(Es.isCollection(t)||!Es.isNode(t)&&typeof t=="object"){let I="With simple keys, collection cannot be used as a key value";throw new Error(I)}}let b=!m&&(!t||y&&e==null&&!r.inFlow||Es.isCollection(t)||(Es.isScalar(t)?t.type===UP.Scalar.BLOCK_FOLDED||t.type===UP.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!b&&(m||!s),indent:l+c});let
|
|
131
|
-
${l}:`):(v=`${v}:`,y&&(v+=bd.lineComment(v,r.indent,d(y))));let _,
|
|
132
|
-
`:"",
|
|
129
|
+
${c}`);if(o){let y=C=>C.default&&C.tag!=="tag:yaml.org,2002:str"&&C.test?.test(m),{compat:b,tags:q}=e.doc.schema;if(q.some(y)||b?.some(y))return Pu(s,e)}return l?m:Ro.foldFlowLines(m,c,Ro.FOLD_FLOW,Ym(e,!1))}function bJ(t,e,r,n){let{implicitKey:i,inFlow:s}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:l}=t;l!==mi.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(l=mi.Scalar.QUOTE_DOUBLE);let c=p=>{switch(p){case mi.Scalar.BLOCK_FOLDED:case mi.Scalar.BLOCK_LITERAL:return i||s?Pu(o.value,e):Gm(o,e,r,n);case mi.Scalar.QUOTE_DOUBLE:return gd(o.value,e);case mi.Scalar.QUOTE_SINGLE:return H0(o.value,e);case mi.Scalar.PLAIN:return vJ(o,e,r,n);default:return null}},d=c(l);if(d===null){let{defaultKeyType:p,defaultStringType:m}=e.options,y=i&&p||m;if(d=c(y),d===null)throw new Error(`Unsupported default string type ${y}`)}return d}LP.stringifyString=bJ});var vd=V(V0=>{"use strict";var SJ=Um(),Co=st(),wJ=hd(),_J=yd();function RJ(t,e){let r=Object.assign({blockQuote:!0,commentString:wJ.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function CJ(t,e){if(e.tag){let i=t.filter(s=>s.tag===e.tag);if(i.length>0)return i.find(s=>s.format===e.format)??i[0]}let r,n;if(Co.isScalar(e)){n=e.value;let i=t.filter(s=>s.identify?.(n));if(i.length>1){let s=i.filter(o=>o.test);s.length>0&&(i=s)}r=i.find(s=>s.format===e.format)??i.find(s=>!s.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function xJ(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],s=(Co.isScalar(t)||Co.isCollection(t))&&t.anchor;s&&SJ.anchorIsValid(s)&&(r.add(s),i.push(`&${s}`));let o=t.tag??(e.default?null:e.tag);return o&&i.push(n.directives.tagString(o)),i.join(" ")}function EJ(t,e,r,n){if(Co.isPair(t))return t.toString(e,r,n);if(Co.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,s=Co.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=CJ(e.doc.schema.tags,s));let o=xJ(s,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let l=typeof i.stringify=="function"?i.stringify(s,e,r,n):Co.isScalar(s)?_J.stringifyString(s,e,r,n):s.toString(e,r,n);return o?Co.isScalar(s)||l[0]==="{"||l[0]==="["?`${o} ${l}`:`${o}
|
|
130
|
+
${e.indent}${l}`:l}V0.createStringifyContext=RJ;V0.stringify=EJ});var VP=V(BP=>{"use strict";var Es=st(),UP=tr(),HP=vd(),bd=hd();function qJ({key:t,value:e},r,n,i){let{allNullValues:s,doc:o,indent:l,indentStep:c,options:{commentString:d,indentSeq:p,simpleKeys:m}}=r,y=Es.isNode(t)&&t.comment||null;if(m){if(y)throw new Error("With simple keys, key nodes cannot have comments");if(Es.isCollection(t)||!Es.isNode(t)&&typeof t=="object"){let I="With simple keys, collection cannot be used as a key value";throw new Error(I)}}let b=!m&&(!t||y&&e==null&&!r.inFlow||Es.isCollection(t)||(Es.isScalar(t)?t.type===UP.Scalar.BLOCK_FOLDED||t.type===UP.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!b&&(m||!s),indent:l+c});let q=!1,C=!1,v=HP.stringify(t,r,()=>q=!0,()=>C=!0);if(!b&&!r.inFlow&&v.length>1024){if(m)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");b=!0}if(r.inFlow){if(s||e==null)return q&&n&&n(),v===""?"?":b?`? ${v}`:v}else if(s&&!m||e==null&&b)return v=`? ${v}`,y&&!q?v+=bd.lineComment(v,r.indent,d(y)):C&&i&&i(),v;q&&(y=null),b?(y&&(v+=bd.lineComment(v,r.indent,d(y))),v=`? ${v}
|
|
131
|
+
${l}:`):(v=`${v}:`,y&&(v+=bd.lineComment(v,r.indent,d(y))));let _,E,k;Es.isNode(e)?(_=!!e.spaceBefore,E=e.commentBefore,k=e.comment):(_=!1,E=null,k=null,e&&typeof e=="object"&&(e=o.createNode(e))),r.implicitKey=!1,!b&&!y&&Es.isScalar(e)&&(r.indentAtStart=v.length+1),C=!1,!p&&c.length>=2&&!r.inFlow&&!b&&Es.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let O=!1,M=HP.stringify(e,r,()=>O=!0,()=>C=!0),j=" ";if(y||_||E){if(j=_?`
|
|
132
|
+
`:"",E){let I=d(E);j+=`
|
|
133
133
|
${bd.indentComment(I,r.indent)}`}M===""&&!r.inFlow?j===`
|
|
134
134
|
`&&k&&(j=`
|
|
135
135
|
|
|
@@ -137,34 +137,34 @@ ${bd.indentComment(I,r.indent)}`}M===""&&!r.inFlow?j===`
|
|
|
137
137
|
${r.indent}`}else if(!b&&Es.isCollection(e)){let I=M[0],R=M.indexOf(`
|
|
138
138
|
`),A=R!==-1,F=r.inFlow??e.flow??e.items.length===0;if(A||!F){let U=!1;if(A&&(I==="&"||I==="!")){let D=M.indexOf(" ");I==="&"&&D!==-1&&D<R&&M[D+1]==="!"&&(D=M.indexOf(" ",D+1)),(D===-1||R<D)&&(U=!0)}U||(j=`
|
|
139
139
|
${r.indent}`)}}else(M===""||M[0]===`
|
|
140
|
-
`)&&(j="");return v+=j+M,r.inFlow?O&&n&&n():k&&!O?v+=bd.lineComment(v,r.indent,d(k)):C&&i&&i(),v}BP.stringifyPair=qJ});var z0=V(W0=>{"use strict";var WP=_t("process");function OJ(t,...e){t==="debug"&&console.log(...e)}function IJ(t,e){(t==="debug"||t==="warn")&&(typeof WP.emitWarning=="function"?WP.emitWarning(e):console.warn(e))}W0.debug=OJ;W0.warn=IJ});var tg=V(eg=>{"use strict";var Xm=st(),zP=tr(),Qm="<<",Zm={identify:t=>t===Qm||typeof t=="symbol"&&t.description===Qm,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new zP.Scalar(Symbol(Qm)),{addToJSMap:JP}),stringify:()=>Qm},PJ=(t,e)=>(Zm.identify(e)||Xm.isScalar(e)&&(!e.type||e.type===zP.Scalar.PLAIN)&&Zm.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Zm.tag&&r.default);function JP(t,e,r){let n=GP(t,r);if(Xm.isSeq(n))for(let i of n.items)J0(t,e,i);else if(Array.isArray(n))for(let i of n)J0(t,e,i);else J0(t,e,n)}function J0(t,e,r){let n=GP(t,r);if(!Xm.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[s,o]of i)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function GP(t,e){return t&&Xm.isAlias(e)?e.resolve(t.doc,t):e}eg.addMergeToJSMap=JP;eg.isMergeKey=PJ;eg.merge=Zm});var Y0=V(QP=>{"use strict";var kJ=z0(),YP=tg(),AJ=vd(),KP=st(),G0=wo();function TJ(t,e,{key:r,value:n}){if(KP.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(YP.isMergeKey(t,r))YP.addMergeToJSMap(t,e,n);else{let i=G0.toJS(r,"",t);if(e instanceof Map)e.set(i,G0.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let s=$J(r,i,t),o=G0.toJS(n,s,t);s in e?Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[s]=o}}return e}function $J(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(KP.isNode(t)&&r?.doc){let n=AJ.createStringifyContext(r.doc,{});n.anchors=new Set;for(let s of r.anchors.keys())n.anchors.add(s.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),kJ.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}QP.addPairToJSMap=TJ});var xo=V(K0=>{"use strict";var ZP=pd(),NJ=VP(),MJ=Y0(),rg=st();function FJ(t,e,r){let n=ZP.createNode(t,void 0,r),i=ZP.createNode(e,void 0,r);return new ng(n,i)}var ng=class t{constructor(e,r=null){Object.defineProperty(this,rg.NODE_TYPE,{value:rg.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return rg.isNode(r)&&(r=r.clone(e)),rg.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return MJ.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?NJ.stringifyPair(this,e,r,n):JSON.stringify(this)}};K0.Pair=ng;K0.createPair=FJ});var Q0=V(ek=>{"use strict";var Ba=st(),XP=vd(),ig=hd();function DJ(t,e,r){return(e.inFlow??t.flow?LJ:jJ)(t,e,r)}function jJ({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:s,onChompKeep:o,onComment:l}){let{indent:c,options:{commentString:d}}=r,p=Object.assign({},r,{indent:s,type:null}),m=!1,y=[];for(let
|
|
140
|
+
`)&&(j="");return v+=j+M,r.inFlow?O&&n&&n():k&&!O?v+=bd.lineComment(v,r.indent,d(k)):C&&i&&i(),v}BP.stringifyPair=qJ});var z0=V(W0=>{"use strict";var WP=_t("process");function OJ(t,...e){t==="debug"&&console.log(...e)}function IJ(t,e){(t==="debug"||t==="warn")&&(typeof WP.emitWarning=="function"?WP.emitWarning(e):console.warn(e))}W0.debug=OJ;W0.warn=IJ});var tg=V(eg=>{"use strict";var Xm=st(),zP=tr(),Qm="<<",Zm={identify:t=>t===Qm||typeof t=="symbol"&&t.description===Qm,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new zP.Scalar(Symbol(Qm)),{addToJSMap:JP}),stringify:()=>Qm},PJ=(t,e)=>(Zm.identify(e)||Xm.isScalar(e)&&(!e.type||e.type===zP.Scalar.PLAIN)&&Zm.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Zm.tag&&r.default);function JP(t,e,r){let n=GP(t,r);if(Xm.isSeq(n))for(let i of n.items)J0(t,e,i);else if(Array.isArray(n))for(let i of n)J0(t,e,i);else J0(t,e,n)}function J0(t,e,r){let n=GP(t,r);if(!Xm.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[s,o]of i)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function GP(t,e){return t&&Xm.isAlias(e)?e.resolve(t.doc,t):e}eg.addMergeToJSMap=JP;eg.isMergeKey=PJ;eg.merge=Zm});var Y0=V(QP=>{"use strict";var kJ=z0(),YP=tg(),AJ=vd(),KP=st(),G0=wo();function TJ(t,e,{key:r,value:n}){if(KP.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(YP.isMergeKey(t,r))YP.addMergeToJSMap(t,e,n);else{let i=G0.toJS(r,"",t);if(e instanceof Map)e.set(i,G0.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let s=$J(r,i,t),o=G0.toJS(n,s,t);s in e?Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[s]=o}}return e}function $J(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(KP.isNode(t)&&r?.doc){let n=AJ.createStringifyContext(r.doc,{});n.anchors=new Set;for(let s of r.anchors.keys())n.anchors.add(s.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),kJ.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}QP.addPairToJSMap=TJ});var xo=V(K0=>{"use strict";var ZP=pd(),NJ=VP(),MJ=Y0(),rg=st();function FJ(t,e,r){let n=ZP.createNode(t,void 0,r),i=ZP.createNode(e,void 0,r);return new ng(n,i)}var ng=class t{constructor(e,r=null){Object.defineProperty(this,rg.NODE_TYPE,{value:rg.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return rg.isNode(r)&&(r=r.clone(e)),rg.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return MJ.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?NJ.stringifyPair(this,e,r,n):JSON.stringify(this)}};K0.Pair=ng;K0.createPair=FJ});var Q0=V(ek=>{"use strict";var Ba=st(),XP=vd(),ig=hd();function DJ(t,e,r){return(e.inFlow??t.flow?LJ:jJ)(t,e,r)}function jJ({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:s,onChompKeep:o,onComment:l}){let{indent:c,options:{commentString:d}}=r,p=Object.assign({},r,{indent:s,type:null}),m=!1,y=[];for(let q=0;q<e.length;++q){let C=e[q],v=null;if(Ba.isNode(C))!m&&C.spaceBefore&&y.push(""),sg(r,y,C.commentBefore,m),C.comment&&(v=C.comment);else if(Ba.isPair(C)){let E=Ba.isNode(C.key)?C.key:null;E&&(!m&&E.spaceBefore&&y.push(""),sg(r,y,E.commentBefore,m))}m=!1;let _=XP.stringify(C,p,()=>v=null,()=>m=!0);v&&(_+=ig.lineComment(_,s,d(v))),m&&v&&(m=!1),y.push(n+_)}let b;if(y.length===0)b=i.start+i.end;else{b=y[0];for(let q=1;q<y.length;++q){let C=y[q];b+=C?`
|
|
141
141
|
${c}${C}`:`
|
|
142
142
|
`}}return t?(b+=`
|
|
143
|
-
`+ig.indentComment(d(t),c),l&&l()):m&&o&&o(),b}function LJ({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:s,flowCollectionPadding:o,options:{commentString:l}}=e;n+=s;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),d=!1,p=0,m=[];for(let
|
|
144
|
-
`)),
|
|
143
|
+
`+ig.indentComment(d(t),c),l&&l()):m&&o&&o(),b}function LJ({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:s,flowCollectionPadding:o,options:{commentString:l}}=e;n+=s;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),d=!1,p=0,m=[];for(let q=0;q<t.length;++q){let C=t[q],v=null;if(Ba.isNode(C))C.spaceBefore&&m.push(""),sg(e,m,C.commentBefore,!1),C.comment&&(v=C.comment);else if(Ba.isPair(C)){let E=Ba.isNode(C.key)?C.key:null;E&&(E.spaceBefore&&m.push(""),sg(e,m,E.commentBefore,!1),E.comment&&(d=!0));let k=Ba.isNode(C.value)?C.value:null;k?(k.comment&&(v=k.comment),k.commentBefore&&(d=!0)):C.value==null&&E?.comment&&(v=E.comment)}v&&(d=!0);let _=XP.stringify(C,c,()=>v=null);d||(d=m.length>p||_.includes(`
|
|
144
|
+
`)),q<t.length-1?_+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(d||(d=m.reduce((E,k)=>E+k.length+2,2)+(_.length+2)>e.options.lineWidth)),d&&(_+=",")),v&&(_+=ig.lineComment(_,n,l(v))),m.push(_),p=m.length}let{start:y,end:b}=r;if(m.length===0)return y+b;if(!d){let q=m.reduce((C,v)=>C+v.length+2,2);d=e.options.lineWidth>0&&q>e.options.lineWidth}if(d){let q=y;for(let C of m)q+=C?`
|
|
145
145
|
${s}${i}${C}`:`
|
|
146
|
-
`;return`${
|
|
146
|
+
`;return`${q}
|
|
147
147
|
${i}${b}`}else return`${y}${o}${m.join(" ")}${o}${b}`}function sg({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let s=ig.indentComment(e(n),t);r.push(s.trimStart())}}ek.stringifyCollection=DJ});var qo=V(X0=>{"use strict";var UJ=Q0(),HJ=Y0(),BJ=Wm(),Eo=st(),og=xo(),VJ=tr();function Sd(t,e){let r=Eo.isScalar(e)?e.value:e;for(let n of t)if(Eo.isPair(n)&&(n.key===e||n.key===r||Eo.isScalar(n.key)&&n.key.value===r))return n}var Z0=class extends BJ.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Eo.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:s}=n,o=new this(e),l=(c,d)=>{if(typeof s=="function")d=s.call(r,c,d);else if(Array.isArray(s)&&!s.includes(c))return;(d!==void 0||i)&&o.items.push(og.createPair(c,d,n))};if(r instanceof Map)for(let[c,d]of r)l(c,d);else if(r&&typeof r=="object")for(let c of Object.keys(r))l(c,r[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,r){let n;Eo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new og.Pair(e,e?.value):n=new og.Pair(e.key,e.value);let i=Sd(this.items,n.key),s=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Eo.isScalar(i.value)&&VJ.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(s){let o=this.items.findIndex(l=>s(n,l)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let r=Sd(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Sd(this.items,e)?.value;return(!r&&Eo.isScalar(i)?i.value:i)??void 0}has(e){return!!Sd(this.items,e)}set(e,r){this.add(new og.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let s of this.items)HJ.addPairToJSMap(r,i,s);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Eo.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),UJ.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};X0.YAMLMap=Z0;X0.findPair=Sd});var ku=V(rk=>{"use strict";var WJ=st(),tk=qo(),zJ={collection:"map",default:!0,nodeClass:tk.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return WJ.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>tk.YAMLMap.from(t,e,r)};rk.map=zJ});var Oo=V(nk=>{"use strict";var JJ=pd(),GJ=Q0(),YJ=Wm(),lg=st(),KJ=tr(),QJ=wo(),e_=class extends YJ.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(lg.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=ag(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=ag(e);if(typeof n!="number")return;let i=this.items[n];return!r&&lg.isScalar(i)?i.value:i}has(e){let r=ag(e);return typeof r=="number"&&r<this.items.length}set(e,r){let n=ag(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[n];lg.isScalar(i)&&KJ.isScalarValue(r)?i.value=r:this.items[n]=r}toJSON(e,r){let n=[];r?.onCreate&&r.onCreate(n);let i=0;for(let s of this.items)n.push(QJ.toJS(s,String(i++),r));return n}toString(e,r,n){return e?GJ.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:r}):JSON.stringify(this)}static from(e,r,n){let{replacer:i}=n,s=new this(e);if(r&&Symbol.iterator in Object(r)){let o=0;for(let l of r){if(typeof i=="function"){let c=r instanceof Set?l:String(o++);l=i.call(r,c,l)}s.items.push(JJ.createNode(l,void 0,n))}}return s}};function ag(t){let e=lg.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}nk.YAMLSeq=e_});var Au=V(sk=>{"use strict";var ZJ=st(),ik=Oo(),XJ={collection:"seq",default:!0,nodeClass:ik.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return ZJ.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>ik.YAMLSeq.from(t,e,r)};sk.seq=XJ});var wd=V(ok=>{"use strict";var eG=yd(),tG={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),eG.stringifyString(t,e,r,n)}};ok.string=tG});var ug=V(uk=>{"use strict";var ak=tr(),lk={identify:t=>t==null,createNode:()=>new ak.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ak.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&lk.test.test(t)?t:e.options.nullStr};uk.nullTag=lk});var t_=V(fk=>{"use strict";var rG=tr(),ck={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new rG.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&ck.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};fk.boolTag=ck});var Tu=V(dk=>{"use strict";function nG({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let s=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let l=e-(s.length-o-1);for(;l-- >0;)s+="0"}return s}dk.stringifyNumber=nG});var n_=V(cg=>{"use strict";var iG=tr(),r_=Tu(),sG={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:r_.stringifyNumber},oG={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():r_.stringifyNumber(t)}},aG={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new iG.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:r_.stringifyNumber};cg.float=aG;cg.floatExp=oG;cg.floatNaN=sG});var s_=V(dg=>{"use strict";var pk=Tu(),fg=t=>typeof t=="bigint"||Number.isInteger(t),i_=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function hk(t,e,r){let{value:n}=t;return fg(n)&&n>=0?r+n.toString(e):pk.stringifyNumber(t)}var lG={identify:t=>fg(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>i_(t,2,8,r),stringify:t=>hk(t,8,"0o")},uG={identify:fg,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>i_(t,0,10,r),stringify:pk.stringifyNumber},cG={identify:t=>fg(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>i_(t,2,16,r),stringify:t=>hk(t,16,"0x")};dg.int=uG;dg.intHex=cG;dg.intOct=lG});var gk=V(mk=>{"use strict";var fG=ku(),dG=ug(),pG=Au(),hG=wd(),mG=t_(),o_=n_(),a_=s_(),gG=[fG.map,pG.seq,hG.string,dG.nullTag,mG.boolTag,a_.intOct,a_.int,a_.intHex,o_.floatNaN,o_.floatExp,o_.float];mk.schema=gG});var bk=V(vk=>{"use strict";var yG=tr(),vG=ku(),bG=Au();function yk(t){return typeof t=="bigint"||Number.isInteger(t)}var pg=({value:t})=>JSON.stringify(t),SG=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:pg},{identify:t=>t==null,createNode:()=>new yG.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:pg},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:pg},{identify:yk,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>yk(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:pg}],wG={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},_G=[vG.map,bG.seq].concat(SG,wG);vk.schema=_G});var u_=V(Sk=>{"use strict";var _d=_t("buffer"),l_=tr(),RG=yd(),CG={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof _d.Buffer=="function")return _d.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i<r.length;++i)n[i]=r.charCodeAt(i);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:r},n,i,s){if(!r)return"";let o=r,l;if(typeof _d.Buffer=="function")l=o instanceof _d.Buffer?o.toString("base64"):_d.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let d=0;d<o.length;++d)c+=String.fromCharCode(o[d]);l=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=l_.Scalar.BLOCK_LITERAL),e!==l_.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),d=Math.ceil(l.length/c),p=new Array(d);for(let m=0,y=0;m<d;++m,y+=c)p[m]=l.substr(y,c);l=p.join(e===l_.Scalar.BLOCK_LITERAL?`
|
|
148
148
|
`:" ")}return RG.stringifyString({comment:t,type:e,value:l},n,i,s)}};Sk.binary=CG});var gg=V(mg=>{"use strict";var hg=st(),c_=xo(),xG=tr(),EG=Oo();function wk(t,e){if(hg.isSeq(t))for(let r=0;r<t.items.length;++r){let n=t.items[r];if(!hg.isPair(n)){if(hg.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new c_.Pair(new xG.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
|
|
149
149
|
${i.key.commentBefore}`:n.commentBefore),n.comment){let s=i.value??i.key;s.comment=s.comment?`${n.comment}
|
|
150
150
|
${s.comment}`:n.comment}n=i}t.items[r]=hg.isPair(n)?n:new c_.Pair(n)}}else e("Expected a sequence for this tag");return t}function _k(t,e,r){let{replacer:n}=r,i=new EG.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(s++),o));let l,c;if(Array.isArray(o))if(o.length===2)l=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let d=Object.keys(o);if(d.length===1)l=d[0],c=o[l];else throw new TypeError(`Expected tuple with one key, not ${d.length} keys`)}else l=o;i.items.push(c_.createPair(l,c,r))}return i}var qG={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:wk,createNode:_k};mg.createPairs=_k;mg.pairs=qG;mg.resolvePairs=wk});var p_=V(d_=>{"use strict";var Rk=st(),f_=wo(),Rd=qo(),OG=Oo(),Ck=gg(),Va=class t extends OG.YAMLSeq{constructor(){super(),this.add=Rd.YAMLMap.prototype.add.bind(this),this.delete=Rd.YAMLMap.prototype.delete.bind(this),this.get=Rd.YAMLMap.prototype.get.bind(this),this.has=Rd.YAMLMap.prototype.has.bind(this),this.set=Rd.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let s,o;if(Rk.isPair(i)?(s=f_.toJS(i.key,"",r),o=f_.toJS(i.value,s,r)):s=f_.toJS(i,"",r),n.has(s))throw new Error("Ordered maps must not include duplicate keys");n.set(s,o)}return n}static from(e,r,n){let i=Ck.createPairs(e,r,n),s=new this;return s.items=i.items,s}};Va.tag="tag:yaml.org,2002:omap";var IG={collection:"seq",identify:t=>t instanceof Map,nodeClass:Va,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=Ck.resolvePairs(t,e),n=[];for(let{key:i}of r.items)Rk.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Va,r)},createNode:(t,e,r)=>Va.from(t,e,r)};d_.YAMLOMap=Va;d_.omap=IG});var Ik=V(h_=>{"use strict";var xk=tr();function Ek({value:t,source:e},r){return e&&(t?qk:Ok).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var qk={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new xk.Scalar(!0),stringify:Ek},Ok={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new xk.Scalar(!1),stringify:Ek};h_.falseTag=Ok;h_.trueTag=qk});var Pk=V(yg=>{"use strict";var PG=tr(),m_=Tu(),kG={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:m_.stringifyNumber},AG={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():m_.stringifyNumber(t)}},TG={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new PG.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:m_.stringifyNumber};yg.float=TG;yg.floatExp=AG;yg.floatNaN=kG});var Ak=V(xd=>{"use strict";var kk=Tu(),Cd=t=>typeof t=="bigint"||Number.isInteger(t);function vg(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return i==="-"?BigInt(-1)*o:o}let s=parseInt(t,r);return i==="-"?-1*s:s}function g_(t,e,r){let{value:n}=t;if(Cd(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return kk.stringifyNumber(t)}var $G={identify:Cd,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>vg(t,2,2,r),stringify:t=>g_(t,2,"0b")},NG={identify:Cd,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>vg(t,1,8,r),stringify:t=>g_(t,8,"0")},MG={identify:Cd,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>vg(t,0,10,r),stringify:kk.stringifyNumber},FG={identify:Cd,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>vg(t,2,16,r),stringify:t=>g_(t,16,"0x")};xd.int=MG;xd.intBin=$G;xd.intHex=FG;xd.intOct=NG});var v_=V(y_=>{"use strict";var wg=st(),bg=xo(),Sg=qo(),Wa=class t extends Sg.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;wg.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new bg.Pair(e.key,null):r=new bg.Pair(e,null),Sg.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Sg.findPair(this.items,e);return!r&&wg.isPair(n)?wg.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=Sg.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new bg.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,s=new this(e);if(r&&Symbol.iterator in Object(r))for(let o of r)typeof i=="function"&&(o=i.call(r,o,o)),s.items.push(bg.createPair(o,null,n));return s}};Wa.tag="tag:yaml.org,2002:set";var DG={collection:"map",identify:t=>t instanceof Set,nodeClass:Wa,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>Wa.from(t,e,r),resolve(t,e){if(wg.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Wa,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};y_.YAMLSet=Wa;y_.set=DG});var S_=V(_g=>{"use strict";var jG=Tu();function b_(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=o=>e?BigInt(o):Number(o),s=n.replace(/_/g,"").split(":").reduce((o,l)=>o*i(60)+i(l),i(0));return r==="-"?i(-1)*s:s}function Tk(t){let{value:e}=t,r=o=>o;if(typeof e=="bigint")r=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return jG.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),s=[e%i];return e<60?s.unshift(0):(e=(e-s[0])/i,s.unshift(e%i),e>=60&&(e=(e-s[0])/i,s.unshift(e))),n+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var LG={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>b_(t,r),stringify:Tk},UG={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>b_(t,!1),stringify:Tk},$k={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match($k.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,s,o,l]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,d=Date.UTC(r,n-1,i,s||0,o||0,l||0,c),p=e[8];if(p&&p!=="Z"){let m=b_(p,!1);Math.abs(m)<30&&(m*=60),d-=6e4*m}return new Date(d)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};_g.floatTime=UG;_g.intTime=LG;_g.timestamp=$k});var Fk=V(Mk=>{"use strict";var HG=ku(),BG=ug(),VG=Au(),WG=wd(),zG=u_(),Nk=Ik(),w_=Pk(),Rg=Ak(),JG=tg(),GG=p_(),YG=gg(),KG=v_(),__=S_(),QG=[HG.map,VG.seq,WG.string,BG.nullTag,Nk.trueTag,Nk.falseTag,Rg.intBin,Rg.intOct,Rg.int,Rg.intHex,w_.floatNaN,w_.floatExp,w_.float,zG.binary,JG.merge,GG.omap,YG.pairs,KG.set,__.intTime,__.floatTime,__.timestamp];Mk.schema=QG});var Jk=V(x_=>{"use strict";var Uk=ku(),ZG=ug(),Hk=Au(),XG=wd(),eY=t_(),R_=n_(),C_=s_(),tY=gk(),rY=bk(),Bk=u_(),Ed=tg(),Vk=p_(),Wk=gg(),Dk=Fk(),zk=v_(),Cg=S_(),jk=new Map([["core",tY.schema],["failsafe",[Uk.map,Hk.seq,XG.string]],["json",rY.schema],["yaml11",Dk.schema],["yaml-1.1",Dk.schema]]),Lk={binary:Bk.binary,bool:eY.boolTag,float:R_.float,floatExp:R_.floatExp,floatNaN:R_.floatNaN,floatTime:Cg.floatTime,int:C_.int,intHex:C_.intHex,intOct:C_.intOct,intTime:Cg.intTime,map:Uk.map,merge:Ed.merge,null:ZG.nullTag,omap:Vk.omap,pairs:Wk.pairs,seq:Hk.seq,set:zk.set,timestamp:Cg.timestamp},nY={"tag:yaml.org,2002:binary":Bk.binary,"tag:yaml.org,2002:merge":Ed.merge,"tag:yaml.org,2002:omap":Vk.omap,"tag:yaml.org,2002:pairs":Wk.pairs,"tag:yaml.org,2002:set":zk.set,"tag:yaml.org,2002:timestamp":Cg.timestamp};function iY(t,e,r){let n=jk.get(e);if(n&&!t)return r&&!n.includes(Ed.merge)?n.concat(Ed.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let s=Array.from(jk.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)i=i.concat(s);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Ed.merge)),i.reduce((s,o)=>{let l=typeof o=="string"?Lk[o]:o;if(!l){let c=JSON.stringify(o),d=Object.keys(Lk).map(p=>JSON.stringify(p)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${d}`)}return s.includes(l)||s.push(l),s},[])}x_.coreKnownTags=nY;x_.getTags=iY});var O_=V(Gk=>{"use strict";var E_=st(),sY=ku(),oY=Au(),aY=wd(),xg=Jk(),lY=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,q_=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:s,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(e)?xg.getTags(e,"compat"):e?xg.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?xg.coreKnownTags:{},this.tags=xg.getTags(r,this.name,n),this.toStringOptions=l??null,Object.defineProperty(this,E_.MAP,{value:sY.map}),Object.defineProperty(this,E_.SCALAR,{value:aY.string}),Object.defineProperty(this,E_.SEQ,{value:oY.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?lY:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Gk.Schema=q_});var Kk=V(Yk=>{"use strict";var uY=st(),I_=vd(),qd=hd();function cY(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=I_.createStringifyContext(t,e),{commentString:s}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=s(t.commentBefore);r.unshift(qd.indentComment(c,""))}let o=!1,l=null;if(t.contents){if(uY.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let p=s(t.contents.commentBefore);r.push(qd.indentComment(p,""))}i.forceBlockIndent=!!t.comment,l=t.contents.comment}let c=l?void 0:()=>o=!0,d=I_.stringify(t.contents,i,()=>l=null,c);l&&(d+=qd.lineComment(d,"",s(l))),(d[0]==="|"||d[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${d}`:r.push(d)}else r.push(I_.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
|
|
151
151
|
`)?(r.push("..."),r.push(qd.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||l)&&r[r.length-1]!==""&&r.push(""),r.push(qd.indentComment(s(c),"")))}return r.join(`
|
|
152
152
|
`)+`
|
|
153
|
-
`}Yk.stringifyDocument=cY});var Od=V(Qk=>{"use strict";var fY=dd(),$u=Wm(),Wn=st(),dY=xo(),pY=wo(),hY=O_(),mY=Kk(),P_=Um(),gY=$0(),yY=pd(),k_=T0(),A_=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Wn.NODE_TYPE,{value:Wn.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=s;let{version:o}=s;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new k_.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[Wn.NODE_TYPE]:{value:Wn.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Wn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Nu(this.contents)&&this.contents.add(e)}addIn(e,r){Nu(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=P_.anchorNames(this);e.anchor=!r||n.has(r)?P_.findNewAnchor(r||"a",n):r}return new fY.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let v=
|
|
153
|
+
`}Yk.stringifyDocument=cY});var Od=V(Qk=>{"use strict";var fY=dd(),$u=Wm(),Wn=st(),dY=xo(),pY=wo(),hY=O_(),mY=Kk(),P_=Um(),gY=$0(),yY=pd(),k_=T0(),A_=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Wn.NODE_TYPE,{value:Wn.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=s;let{version:o}=s;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new k_.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[Wn.NODE_TYPE]:{value:Wn.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Wn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Nu(this.contents)&&this.contents.add(e)}addIn(e,r){Nu(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=P_.anchorNames(this);e.anchor=!r||n.has(r)?P_.findNewAnchor(r||"a",n):r}return new fY.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let v=E=>typeof E=="number"||E instanceof String||E instanceof Number,_=r.filter(v).map(String);_.length>0&&(r=r.concat(_)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:l,keepUndefined:c,onTagObj:d,tag:p}=n??{},{onAnchor:m,setAnchors:y,sourceObjects:b}=P_.createNodeAnchors(this,o||"a"),q={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:m,onTagObj:d,replacer:i,schema:this.schema,sourceObjects:b},C=yY.createNode(e,p,q);return l&&Wn.isCollection(C)&&(C.flow=!0),y(),C}createPair(e,r,n={}){let i=this.createNode(e,null,n),s=this.createNode(r,null,n);return new dY.Pair(i,s)}delete(e){return Nu(this.contents)?this.contents.delete(e):!1}deleteIn(e){return $u.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Nu(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return Wn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return $u.isEmptyPath(e)?!r&&Wn.isScalar(this.contents)?this.contents.value:this.contents:Wn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Wn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return $u.isEmptyPath(e)?this.contents!==void 0:Wn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=$u.collectionFromPath(this.schema,[e],r):Nu(this.contents)&&this.contents.set(e,r)}setIn(e,r){$u.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=$u.collectionFromPath(this.schema,Array.from(e),r):Nu(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new k_.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new k_.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new hY.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:s,reviver:o}={}){let l={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=pY.toJS(this.contents,r??"",l);if(typeof s=="function")for(let{count:d,res:p}of l.anchors.values())s(p,d);return typeof o=="function"?gY.applyReviver(o,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return mY.stringifyDocument(this,e)}};function Nu(t){if(Wn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Qk.Document=A_});var kd=V(Pd=>{"use strict";var Id=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},T_=class extends Id{constructor(e,r,n){super("YAMLParseError",e,r,n)}},$_=class extends Id{constructor(e,r,n){super("YAMLWarning",e,r,n)}},vY=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(l=>e.linePos(l));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let s=i-1,o=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(s>=60&&o.length>80){let l=Math.min(s-39,o.length-79);o="\u2026"+o.substring(l),s-=l-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(o.substring(0,s))){let l=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);l.length>80&&(l=l.substring(0,79)+`\u2026
|
|
154
154
|
`),o=l+o}if(/[^ ]/.test(o)){let l=1,c=r.linePos[1];c?.line===n&&c.col>i&&(l=Math.max(1,Math.min(c.col-i,80-s)));let d=" ".repeat(s)+"^".repeat(l);r.message+=`:
|
|
155
155
|
|
|
156
156
|
${o}
|
|
157
157
|
${d}
|
|
158
|
-
`}};Pd.YAMLError=Id;Pd.YAMLParseError=T_;Pd.YAMLWarning=$_;Pd.prettifyError=vY});var Ad=V(Zk=>{"use strict";function bY(t,{flow:e,indicator:r,next:n,offset:i,onError:s,parentIndent:o,startOnNewline:l}){let c=!1,d=l,p=l,m="",y="",b=!1,
|
|
159
|
-
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(N_(e.key)||N_(e.value))return!0}return!1;default:return!0}}Xk.containsNewline=N_});var M_=V(eA=>{"use strict";var SY=Eg();function wY(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&SY.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}eA.flowIndentCheck=wY});var F_=V(rA=>{"use strict";var tA=st();function _Y(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(s,o)=>s===o||tA.isScalar(s)&&tA.isScalar(o)&&s.value===o.value;return e.some(s=>i(s.key,r))}rA.mapIncludes=_Y});var lA=V(aA=>{"use strict";var nA=xo(),RY=qo(),iA=Ad(),CY=Eg(),sA=M_(),xY=F_(),oA="All mapping items must start at the same column";function EY({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=s?.nodeClass??RY.YAMLMap,l=new o(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,d=null;for(let p of n.items){let{start:m,key:y,sep:b,value:
|
|
160
|
-
`+C.comment:l.comment=C.comment);continue}(C.newlineAfterProp||CY.containsNewline(y))&&i(y??m[m.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else C.found?.indent!==n.indent&&i(c,"BAD_INDENT",oA);r.atKey=!0;let _=C.end,
|
|
161
|
-
`+k.comment:
|
|
162
|
-
`+j.comment:d.comment=j.comment),m=j.end;continue}!o&&r.options.strict&&MY.containsNewline(k)&&i(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(v===0)j.comma&&i(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`);else if(j.comma||i(j.start,"MISSING_CHAR",`Missing , between ${l} items`),j.comment){let I="";e:for(let R of
|
|
163
|
-
`+I:R.comment=I,j.comment=j.comment.substring(I.length+1)}}if(!o&&!O&&!j.found){let I=M?t(r,M,j,i):e(r,j.end,O,null,j,i);d.items.push(I),m=I.range[2],j_(M)&&i(I.range,"BLOCK_IN_FLOW",D_)}else{r.atKey=!0;let I=j.end,R=k?t(r,k,j,i):e(r,I,
|
|
164
|
-
`+A.comment:R.comment=A.comment);let U=new TY.Pair(R,F);if(r.options.keepSourceTokens&&(U.srcToken=_),o){let D=d;FY.mapIncludes(r,D.items,R)&&i(I,"DUPLICATE_KEY","Map keys must be unique"),D.items.push(U)}else{let D=new dA.YAMLMap(r.schema);D.flow=!0,D.items.push(U);let J=(F??R).range;D.range=[R.range[0],J[1],J[2]],d.items.push(D)}m=F?F.range[2]:A.end}}let y=o?"}":"]",[b,...
|
|
165
|
-
`+v.comment:d.comment=v.comment),d.range=[n.offset,C,v.offset]}else d.range=[n.offset,C,C];return d}hA.resolveFlowCollection=DY});var yA=V(gA=>{"use strict";var jY=st(),LY=tr(),UY=qo(),HY=Oo(),BY=lA(),VY=cA(),WY=mA();function L_(t,e,r,n,i,s){let o=r.type==="block-map"?BY.resolveBlockMap(t,e,r,n,s):r.type==="block-seq"?VY.resolveBlockSeq(t,e,r,n,s):WY.resolveFlowCollection(t,e,r,n,s),l=o.constructor;return i==="!"||i===l.tagName?(o.tag=l.tagName,o):(i&&(o.tag=i),o)}function zY(t,e,r,n,i){let s=n.tag,o=s?e.directives.tagName(s.source,y=>i(s,"TAG_RESOLVE_FAILED",y)):null;if(r.type==="block-seq"){let{anchor:y,newlineAfterProp:b}=n,
|
|
158
|
+
`}};Pd.YAMLError=Id;Pd.YAMLParseError=T_;Pd.YAMLWarning=$_;Pd.prettifyError=vY});var Ad=V(Zk=>{"use strict";function bY(t,{flow:e,indicator:r,next:n,offset:i,onError:s,parentIndent:o,startOnNewline:l}){let c=!1,d=l,p=l,m="",y="",b=!1,q=!1,C=null,v=null,_=null,E=null,k=null,O=null,M=null;for(let R of t)switch(q&&(R.type!=="space"&&R.type!=="newline"&&R.type!=="comma"&&s(R.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),q=!1),C&&(d&&R.type!=="comment"&&R.type!=="newline"&&s(C,"TAB_AS_INDENT","Tabs are not allowed as indentation"),C=null),R.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&R.source.includes(" ")&&(C=R),p=!0;break;case"comment":{p||s(R,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let A=R.source.substring(1)||" ";m?m+=y+A:m=A,y="",d=!1;break}case"newline":d?m?m+=R.source:(!O||r!=="seq-item-ind")&&(c=!0):y+=R.source,d=!0,b=!0,(v||_)&&(E=R),p=!0;break;case"anchor":v&&s(R,"MULTIPLE_ANCHORS","A node can have at most one anchor"),R.source.endsWith(":")&&s(R.offset+R.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),v=R,M??(M=R.offset),d=!1,p=!1,q=!0;break;case"tag":{_&&s(R,"MULTIPLE_TAGS","A node can have at most one tag"),_=R,M??(M=R.offset),d=!1,p=!1,q=!0;break}case r:(v||_)&&s(R,"BAD_PROP_ORDER",`Anchors and tags must be after the ${R.source} indicator`),O&&s(R,"UNEXPECTED_TOKEN",`Unexpected ${R.source} in ${e??"collection"}`),O=R,d=r==="seq-item-ind"||r==="explicit-key-ind",p=!1;break;case"comma":if(e){k&&s(R,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=R,d=!1,p=!1;break}default:s(R,"UNEXPECTED_TOKEN",`Unexpected ${R.type} token`),d=!1,p=!1}let j=t[t.length-1],I=j?j.offset+j.source.length:i;return q&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&s(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),C&&(d&&C.indent<=o||n?.type==="block-map"||n?.type==="block-seq")&&s(C,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:O,spaceBefore:c,comment:m,hasNewline:b,anchor:v,tag:_,newlineAfterProp:E,end:I,start:M??I}}Zk.resolveProps=bY});var Eg=V(Xk=>{"use strict";function N_(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
159
|
+
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(N_(e.key)||N_(e.value))return!0}return!1;default:return!0}}Xk.containsNewline=N_});var M_=V(eA=>{"use strict";var SY=Eg();function wY(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&SY.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}eA.flowIndentCheck=wY});var F_=V(rA=>{"use strict";var tA=st();function _Y(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(s,o)=>s===o||tA.isScalar(s)&&tA.isScalar(o)&&s.value===o.value;return e.some(s=>i(s.key,r))}rA.mapIncludes=_Y});var lA=V(aA=>{"use strict";var nA=xo(),RY=qo(),iA=Ad(),CY=Eg(),sA=M_(),xY=F_(),oA="All mapping items must start at the same column";function EY({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=s?.nodeClass??RY.YAMLMap,l=new o(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,d=null;for(let p of n.items){let{start:m,key:y,sep:b,value:q}=p,C=iA.resolveProps(m,{indicator:"explicit-key-ind",next:y??b?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),v=!C.found;if(v){if(y&&(y.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in y&&y.indent!==n.indent&&i(c,"BAD_INDENT",oA)),!C.anchor&&!C.tag&&!b){d=C.end,C.comment&&(l.comment?l.comment+=`
|
|
160
|
+
`+C.comment:l.comment=C.comment);continue}(C.newlineAfterProp||CY.containsNewline(y))&&i(y??m[m.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else C.found?.indent!==n.indent&&i(c,"BAD_INDENT",oA);r.atKey=!0;let _=C.end,E=y?t(r,y,C,i):e(r,_,m,null,C,i);r.schema.compat&&sA.flowIndentCheck(n.indent,y,i),r.atKey=!1,xY.mapIncludes(r,l.items,E)&&i(_,"DUPLICATE_KEY","Map keys must be unique");let k=iA.resolveProps(b??[],{indicator:"map-value-ind",next:q,offset:E.range[2],onError:i,parentIndent:n.indent,startOnNewline:!y||y.type==="block-scalar"});if(c=k.end,k.found){v&&(q?.type==="block-map"&&!k.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&C.start<k.found.offset-1024&&i(E.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let O=q?t(r,q,k,i):e(r,c,b,null,k,i);r.schema.compat&&sA.flowIndentCheck(n.indent,q,i),c=O.range[2];let M=new nA.Pair(E,O);r.options.keepSourceTokens&&(M.srcToken=p),l.items.push(M)}else{v&&i(E.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(E.comment?E.comment+=`
|
|
161
|
+
`+k.comment:E.comment=k.comment);let O=new nA.Pair(E);r.options.keepSourceTokens&&(O.srcToken=p),l.items.push(O)}}return d&&d<c&&i(d,"IMPOSSIBLE","Map comment with trailing content"),l.range=[n.offset,c,d??c],l}aA.resolveBlockMap=EY});var cA=V(uA=>{"use strict";var qY=Oo(),OY=Ad(),IY=M_();function PY({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=s?.nodeClass??qY.YAMLSeq,l=new o(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,d=null;for(let{start:p,value:m}of n.items){let y=OY.resolveProps(p,{indicator:"seq-item-ind",next:m,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!y.found)if(y.anchor||y.tag||m)m?.type==="block-seq"?i(y.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{d=y.end,y.comment&&(l.comment=y.comment);continue}let b=m?t(r,m,y,i):e(r,y.end,p,null,y,i);r.schema.compat&&IY.flowIndentCheck(n.indent,m,i),c=b.range[2],l.items.push(b)}return l.range=[n.offset,c,d??c],l}uA.resolveBlockSeq=PY});var Mu=V(fA=>{"use strict";function kY(t,e,r,n){let i="";if(t){let s=!1,o="";for(let l of t){let{source:c,type:d}=l;switch(d){case"space":s=!0;break;case"comment":{r&&!s&&n(l,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let p=c.substring(1)||" ";i?i+=o+p:i=p,o="";break}case"newline":i&&(o+=c),s=!0;break;default:n(l,"UNEXPECTED_TOKEN",`Unexpected ${d} at node end`)}e+=c.length}}return{comment:i,offset:e}}fA.resolveEnd=kY});var mA=V(hA=>{"use strict";var AY=st(),TY=xo(),dA=qo(),$Y=Oo(),NY=Mu(),pA=Ad(),MY=Eg(),FY=F_(),D_="Block collections are not allowed within flow collections",j_=t=>t&&(t.type==="block-map"||t.type==="block-seq");function DY({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=n.start.source==="{",l=o?"flow map":"flow sequence",c=s?.nodeClass??(o?dA.YAMLMap:$Y.YAMLSeq),d=new c(r.schema);d.flow=!0;let p=r.atRoot;p&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let m=n.offset+n.start.source.length;for(let v=0;v<n.items.length;++v){let _=n.items[v],{start:E,key:k,sep:O,value:M}=_,j=pA.resolveProps(E,{flow:l,indicator:"explicit-key-ind",next:k??O?.[0],offset:m,onError:i,parentIndent:n.indent,startOnNewline:!1});if(!j.found){if(!j.anchor&&!j.tag&&!O&&!M){v===0&&j.comma?i(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`):v<n.items.length-1&&i(j.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${l}`),j.comment&&(d.comment?d.comment+=`
|
|
162
|
+
`+j.comment:d.comment=j.comment),m=j.end;continue}!o&&r.options.strict&&MY.containsNewline(k)&&i(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(v===0)j.comma&&i(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`);else if(j.comma||i(j.start,"MISSING_CHAR",`Missing , between ${l} items`),j.comment){let I="";e:for(let R of E)switch(R.type){case"comma":case"space":break;case"comment":I=R.source.substring(1);break e;default:break e}if(I){let R=d.items[d.items.length-1];AY.isPair(R)&&(R=R.value??R.key),R.comment?R.comment+=`
|
|
163
|
+
`+I:R.comment=I,j.comment=j.comment.substring(I.length+1)}}if(!o&&!O&&!j.found){let I=M?t(r,M,j,i):e(r,j.end,O,null,j,i);d.items.push(I),m=I.range[2],j_(M)&&i(I.range,"BLOCK_IN_FLOW",D_)}else{r.atKey=!0;let I=j.end,R=k?t(r,k,j,i):e(r,I,E,null,j,i);j_(k)&&i(R.range,"BLOCK_IN_FLOW",D_),r.atKey=!1;let A=pA.resolveProps(O??[],{flow:l,indicator:"map-value-ind",next:M,offset:R.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(A.found){if(!o&&!j.found&&r.options.strict){if(O)for(let D of O){if(D===A.found)break;if(D.type==="newline"){i(D,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}j.start<A.found.offset-1024&&i(A.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else M&&("source"in M&&M.source?.[0]===":"?i(M,"MISSING_CHAR",`Missing space after : in ${l}`):i(A.start,"MISSING_CHAR",`Missing , or : between ${l} items`));let F=M?t(r,M,A,i):A.found?e(r,A.end,O,null,A,i):null;F?j_(M)&&i(F.range,"BLOCK_IN_FLOW",D_):A.comment&&(R.comment?R.comment+=`
|
|
164
|
+
`+A.comment:R.comment=A.comment);let U=new TY.Pair(R,F);if(r.options.keepSourceTokens&&(U.srcToken=_),o){let D=d;FY.mapIncludes(r,D.items,R)&&i(I,"DUPLICATE_KEY","Map keys must be unique"),D.items.push(U)}else{let D=new dA.YAMLMap(r.schema);D.flow=!0,D.items.push(U);let J=(F??R).range;D.range=[R.range[0],J[1],J[2]],d.items.push(D)}m=F?F.range[2]:A.end}}let y=o?"}":"]",[b,...q]=n.end,C=m;if(b?.source===y)C=b.offset+b.source.length;else{let v=l[0].toUpperCase()+l.substring(1),_=p?`${v} must end with a ${y}`:`${v} in block collection must be sufficiently indented and end with a ${y}`;i(m,p?"MISSING_CHAR":"BAD_INDENT",_),b&&b.source.length!==1&&q.unshift(b)}if(q.length>0){let v=NY.resolveEnd(q,C,r.options.strict,i);v.comment&&(d.comment?d.comment+=`
|
|
165
|
+
`+v.comment:d.comment=v.comment),d.range=[n.offset,C,v.offset]}else d.range=[n.offset,C,C];return d}hA.resolveFlowCollection=DY});var yA=V(gA=>{"use strict";var jY=st(),LY=tr(),UY=qo(),HY=Oo(),BY=lA(),VY=cA(),WY=mA();function L_(t,e,r,n,i,s){let o=r.type==="block-map"?BY.resolveBlockMap(t,e,r,n,s):r.type==="block-seq"?VY.resolveBlockSeq(t,e,r,n,s):WY.resolveFlowCollection(t,e,r,n,s),l=o.constructor;return i==="!"||i===l.tagName?(o.tag=l.tagName,o):(i&&(o.tag=i),o)}function zY(t,e,r,n,i){let s=n.tag,o=s?e.directives.tagName(s.source,y=>i(s,"TAG_RESOLVE_FAILED",y)):null;if(r.type==="block-seq"){let{anchor:y,newlineAfterProp:b}=n,q=y&&s?y.offset>s.offset?y:s:y??s;q&&(!b||b.offset<q.offset)&&i(q,"MISSING_CHAR","Missing newline after block sequence props")}let l=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!s||!o||o==="!"||o===UY.YAMLMap.tagName&&l==="map"||o===HY.YAMLSeq.tagName&&l==="seq")return L_(t,e,r,i,o);let c=e.schema.tags.find(y=>y.tag===o&&y.collection===l);if(!c){let y=e.schema.knownTags[o];if(y?.collection===l)e.schema.tags.push(Object.assign({},y,{default:!1})),c=y;else return y?i(s,"BAD_COLLECTION_TYPE",`${y.tag} used for ${l} collection, but expects ${y.collection??"scalar"}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),L_(t,e,r,i,o)}let d=L_(t,e,r,i,o,c),p=c.resolve?.(d,y=>i(s,"TAG_RESOLVE_FAILED",y),e.options)??d,m=jY.isNode(p)?p:new LY.Scalar(p);return m.range=d.range,m.tag=o,c?.format&&(m.format=c.format),m}gA.composeCollection=zY});var H_=V(vA=>{"use strict";var U_=tr();function JY(t,e,r){let n=e.offset,i=GY(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let s=i.mode===">"?U_.Scalar.BLOCK_FOLDED:U_.Scalar.BLOCK_LITERAL,o=e.source?YY(e.source):[],l=o.length;for(let C=o.length-1;C>=0;--C){let v=o[C][1];if(v===""||v==="\r")l=C;else break}if(l===0){let C=i.chomp==="+"&&o.length>0?`
|
|
166
166
|
`.repeat(Math.max(1,o.length-1)):"",v=n+i.length;return e.source&&(v+=e.source.length),{value:C,type:s,comment:i.comment,range:[n,v,v]}}let c=e.indent+i.indent,d=e.offset+i.length,p=0;for(let C=0;C<l;++C){let[v,_]=o[C];if(_===""||_==="\r")i.indent===0&&v.length>c&&(c=v.length);else{v.length<c&&r(d+v.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(c=v.length),p=C,c===0&&!t.atRoot&&r(d,"BAD_INDENT","Block scalar values in collections must be indented");break}d+=v.length+_.length+1}for(let C=o.length-1;C>=l;--C)o[C][0].length>c&&(l=C+1);let m="",y="",b=!1;for(let C=0;C<p;++C)m+=o[C][0].slice(c)+`
|
|
167
|
-
`;for(let C=p;C<l;++C){let[v,_]=o[C];d+=v.length+_.length+1;let
|
|
167
|
+
`;for(let C=p;C<l;++C){let[v,_]=o[C];d+=v.length+_.length+1;let E=_[_.length-1]==="\r";if(E&&(_=_.slice(0,-1)),_&&v.length<c){let O=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;r(d-_.length-(E?2:1),"BAD_INDENT",O),v=""}s===U_.Scalar.BLOCK_LITERAL?(m+=y+v.slice(c)+_,y=`
|
|
168
168
|
`):v.length>c||_[0]===" "?(y===" "?y=`
|
|
169
169
|
`:!b&&y===`
|
|
170
170
|
`&&(y=`
|
|
@@ -177,7 +177,7 @@ ${d}
|
|
|
177
177
|
`+o[C][0].slice(c);m[m.length-1]!==`
|
|
178
178
|
`&&(m+=`
|
|
179
179
|
`);break;default:m+=`
|
|
180
|
-
`}let
|
|
180
|
+
`}let q=n+i.length+e.source.length;return{value:m,type:s,comment:i.comment,range:[n,q,q]}}function GY({offset:t,props:e},r,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],s=i[0],o=0,l="",c=-1;for(let y=1;y<i.length;++y){let b=i[y];if(!l&&(b==="-"||b==="+"))l=b;else{let q=Number(b);!o&&q?o=q:c===-1&&(c=t+y)}}c!==-1&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let d=!1,p="",m=i.length;for(let y=1;y<e.length;++y){let b=e[y];switch(b.type){case"space":d=!0;case"newline":m+=b.source.length;break;case"comment":r&&!d&&n(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),m+=b.source.length,p=b.source.substring(1);break;case"error":n(b,"UNEXPECTED_TOKEN",b.message),m+=b.source.length;break;default:{let q=`Unexpected token in block scalar header: ${b.type}`;n(b,"UNEXPECTED_TOKEN",q);let C=b.source;C&&typeof C=="string"&&(m+=C.length)}}}return{mode:s,indent:o,chomp:l,comment:p,length:m}}function YY(t){let e=t.split(/\n( *)/),r=e[0],n=r.match(/^( *)/),s=[n?.[1]?[n[1],r.slice(n[1].length)]:["",r]];for(let o=1;o<e.length;o+=2)s.push([e[o],e[o+1]]);return s}vA.resolveBlockScalar=JY});var V_=V(SA=>{"use strict";var B_=tr(),KY=Mu();function QY(t,e,r){let{offset:n,type:i,source:s,end:o}=t,l,c,d=(y,b,q)=>r(n+y,b,q);switch(i){case"scalar":l=B_.Scalar.PLAIN,c=ZY(s,d);break;case"single-quoted-scalar":l=B_.Scalar.QUOTE_SINGLE,c=XY(s,d);break;case"double-quoted-scalar":l=B_.Scalar.QUOTE_DOUBLE,c=eK(s,d);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+s.length,n+s.length]}}let p=n+s.length,m=KY.resolveEnd(o,p,e,r);return{value:c,type:l,comment:m.comment,range:[n,p,m.offset]}}function ZY(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),bA(t)}function XY(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),bA(t.slice(1,-1)).replace(/''/g,"'")}function bA(t){let e,r;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
181
181
|
`,"sy"),r=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
182
182
|
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,r=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(t);if(!n)return t;let i=n[1],s=" ",o=e.lastIndex;for(r.lastIndex=o;n=r.exec(t);)n[1]===""?s===`
|
|
183
183
|
`?i+=s:s=`
|
|
@@ -232,16 +232,16 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
|
|
|
232
232
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
233
233
|
`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Tg(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",s=[];if(i&&r.sep&&!r.value){let o=[];for(let l=0;l<r.sep.length;++l){let c=r.sep[l];switch(c.type){case"newline":o.push(l);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=r.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Io(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(KA(r.key)&&!Io(r.sep,"newline")){let o=Fu(r.start),l=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:l,sep:c}]})}else s.length>0?r.sep=r.sep.concat(s,this.sourceToken):r.sep.push(this.sourceToken);else if(Io(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let o=Fu(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:s,key:null,sep:[this.sourceToken]}):Io(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);i||r.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(o):(Object.assign(r,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Io(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:s});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Tg(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||Io(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=Ag(n),s=Fu(i);YA(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let l={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(`
|
|
234
234
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
235
|
-
`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Ag(e),n=Fu(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Ag(e),n=Fu(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};QA.Parser=aR});var rT=V(Fd=>{"use strict";var ZA=G_(),WK=Od(),Md=kd(),zK=z0(),JK=st(),GK=oR(),XA=lR();function eT(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new GK.LineCounter||null,prettyErrors:e}}function YK(t,e={}){let{lineCounter:r,prettyErrors:n}=eT(e),i=new XA.Parser(r?.addNewLine),s=new ZA.Composer(e),o=Array.from(s.compose(i.parse(t)));if(n&&r)for(let l of o)l.errors.forEach(Md.prettifyError(t,r)),l.warnings.forEach(Md.prettifyError(t,r));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function tT(t,e={}){let{lineCounter:r,prettyErrors:n}=eT(e),i=new XA.Parser(r?.addNewLine),s=new ZA.Composer(e),o=null;for(let l of s.compose(i.parse(t),!0,t.length))if(!o)o=l;else if(o.options.logLevel!=="silent"){o.errors.push(new Md.YAMLParseError(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(o.errors.forEach(Md.prettifyError(t,r)),o.warnings.forEach(Md.prettifyError(t,r))),o}function KK(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=tT(t,r);if(!i)return null;if(i.warnings.forEach(s=>zK.warn(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function QK(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return JK.isDocument(t)&&!n?t.toString(r):new WK.Document(t,n,r).toString(r)}Fd.parse=KK;Fd.parseAllDocuments=YK;Fd.parseDocument=tT;Fd.stringify=QK});var Dd=V(Rt=>{"use strict";var ZK=G_(),XK=Od(),e4=O_(),uR=kd(),t4=dd(),Po=st(),r4=xo(),n4=tr(),i4=qo(),s4=Oo(),o4=Pg(),a4=iR(),l4=oR(),u4=lR(),$g=rT(),nT=ld();Rt.Composer=ZK.Composer;Rt.Document=XK.Document;Rt.Schema=e4.Schema;Rt.YAMLError=uR.YAMLError;Rt.YAMLParseError=uR.YAMLParseError;Rt.YAMLWarning=uR.YAMLWarning;Rt.Alias=t4.Alias;Rt.isAlias=Po.isAlias;Rt.isCollection=Po.isCollection;Rt.isDocument=Po.isDocument;Rt.isMap=Po.isMap;Rt.isNode=Po.isNode;Rt.isPair=Po.isPair;Rt.isScalar=Po.isScalar;Rt.isSeq=Po.isSeq;Rt.Pair=r4.Pair;Rt.Scalar=n4.Scalar;Rt.YAMLMap=i4.YAMLMap;Rt.YAMLSeq=s4.YAMLSeq;Rt.CST=o4;Rt.Lexer=a4.Lexer;Rt.LineCounter=l4.LineCounter;Rt.Parser=u4.Parser;Rt.parse=$g.parse;Rt.parseAllDocuments=$g.parseAllDocuments;Rt.parseDocument=$g.parseDocument;Rt.stringify=$g.stringify;Rt.visit=nT.visit;Rt.visitAsync=nT.visitAsync});var c4,f4,d4,p4,h4,m4,g4,ko,Ng=ae(()=>{"use strict";c4=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/,f4=/^\d{4}-\d{2}-\d{2}$/,d4=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,p4=/^https?:\/\/[^\s]+$/,h4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,m4=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,g4=/^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/,ko=class{inferFromValue(e){if(e==null)return{nullable:!0};if(Array.isArray(e))return this.inferArraySchema(e);switch(typeof e){case"string":return this.inferStringSchema(e);case"number":return Number.isInteger(e)?{type:"integer"}:{type:"number"};case"boolean":return{type:"boolean"};case"object":return this.inferObjectSchema(e);default:return{}}}mergeSchemas(e,r){if(!e||Object.keys(e).length===0)return{...r};if(!r||Object.keys(r).length===0)return{...e};let n=e.nullable||r.nullable;if(!e.type&&e.nullable)return{...r,nullable:!0};if(!r.type&&r.nullable)return{...e,nullable:!0};if(e.type!==r.type)return e.type==="integer"&&r.type==="number"||e.type==="number"&&r.type==="integer"?{type:"number",...n&&{nullable:!0}}:{...n&&{nullable:!0}};let i={type:e.type};return n&&(i.nullable=!0),e.type==="object"&&r.type==="object"?this.mergeObjectSchemas(e,r,n):e.type==="array"&&r.type==="array"?this.mergeArraySchemas(e,r,n):(e.format&&e.format===r.format&&(i.format=e.format),i)}inferStringFormat(e){if(c4.test(e))return"date-time";if(f4.test(e))return"date";if(d4.test(e))return"email";if(h4.test(e))return"uuid";if(p4.test(e))return"uri";if(m4.test(e))return"ipv4";if(g4.test(e))return"ipv6"}inferStringSchema(e){let r={type:"string"},n=this.inferStringFormat(e);return n&&(r.format=n),r}inferArraySchema(e){let r={type:"array"};if(e.length===0)return r;let n=this.inferFromValue(e[0]);for(let i=1;i<e.length;i++)n=this.mergeSchemas(n,this.inferFromValue(e[i]));return r.items=n,r}inferObjectSchema(e){let r={type:"object",properties:{}},n=Object.keys(e);for(let i of n)r.properties[i]=this.inferFromValue(e[i]);return r}mergeObjectSchemas(e,r,n){let i={type:"object",properties:{},...n&&{nullable:!0}},s=e.properties||{},o=r.properties||{},l=new Set([...Object.keys(s),...Object.keys(o)]);for(let m of l)s[m]&&o[m]?i.properties[m]=this.mergeSchemas(s[m],o[m]):s[m]?i.properties[m]={...s[m]}:i.properties[m]={...o[m]};let c=new Set(e.required||Object.keys(s)),d=new Set(r.required||Object.keys(o)),p=[...l].filter(m=>c.has(m)&&d.has(m));return p.length>0&&(i.required=p),i}mergeArraySchemas(e,r,n){let i={type:"array",...n&&{nullable:!0}};return e.items&&r.items?i.items=this.mergeSchemas(e.items,r.items):e.items?i.items={...e.items}:r.items&&(i.items={...r.items}),i}}});var iT,y4,Du,cR=ae(()=>{"use strict";iT=Qc(Dd());Ng();y4=new Set(["content-type","authorization","accept","cookie","host","content-length"]),Du=class{constructor(e,r,n){this.collectionService=e;this.envConfigService=r;this.inferenceService=n;this.inferrer=new ko}collectionService;envConfigService;inferenceService;inferrer;async export(e,r){let n=this.collectionService.getCollection(e);if(!n)throw new Error(`Collection ${e} not found`);let i={openapi:"3.0.3",info:this.buildInfo(n,r),servers:this.buildServers(r),paths:{},components:{schemas:{},securitySchemes:{}},tags:[]},s=new Map;if(n.auth&&n.auth.type!=="none"&&n.auth.type!=="inherit"){let c=this.mapAuthToSecurityScheme(n.auth);if(c){let{schemeName:d,scheme:p,requirement:m}=c;s.set(d,p),i.security=[m]}}let o=new Set,l=new Set;if(await this.processItems(n.items,i,s,o,l,void 0,n,r),this.augmentServersFromHostVars(l,i.servers,r),s.size>0)for(let[c,d]of s)i.components.securitySchemes[c]=d;else delete i.components.securitySchemes;return i.tags=[...o].map(c=>({name:c})),i.tags.length===0&&delete i.tags,this.deduplicateComponents(i),Object.keys(i.components.schemas).length===0&&delete i.components.schemas,Object.keys(i.components).length===0&&delete i.components,r.format==="yaml"?iT.stringify(i,{indent:2}):JSON.stringify(i,null,2)}buildInfo(e,r){return{title:r.info?.title||e.name,description:r.info?.description||e.description||"",version:r.info?.version||e.version||"1.0.0"}}buildServers(e){let r=[],n=e.environments||[];if(n.length===0){let i=this.envConfigService.getSelectedEnvironment();if(i){let s=this.envConfigService.resolveVariables("{{baseUrl}}",i);s&&s!=="{{baseUrl}}"&&r.push({url:s,description:i})}}else{let i=new Set;for(let s of n){let o=this.envConfigService.resolveVariables("{{baseUrl}}",s);o&&o!=="{{baseUrl}}"&&!i.has(o)&&(i.add(o),r.push({url:o,description:s}))}}return r.length===0&&r.push({url:"http://localhost",description:"Default server"}),r}async processItems(e,r,n,i,s,o,l,c){for(let d of e)if(d.type==="folder"){let p=d,m=o||p.name;i.add(m),p.items&&await this.processItems(p.items,r,n,i,s,m,l,c)}else{let p=d;await this.processRequest(p,r,n,i,s,o,l,c)}}async processRequest(e,r,n,i,s,o,l,c){let{path:d,hostVar:p}=this.normalizeUrl(e.url);p&&s.add(p);let m=(e.method||"GET").toLowerCase();r.paths[d]||(r.paths[d]={});let y={};y.operationId=e.operationId||this.generateOperationId(e,m,d,r),y.summary=e.summary||this.cleanSummary(e.name),e.description&&(y.description=e.description),(e.deprecated||this.hasDeprecatedPrefix(e.name))&&(y.deprecated=!0,this.hasDeprecatedPrefix(e.name)&&(y.summary=e.name.replace(/^\[DEPRECATED\]\s*/i,"")));let b=e.tags;if(b&&b.length>0){y.tags=b;for(let k of b)i.add(k)}else o&&(y.tags=[o]);let E=this.buildParameters(e);E.length>0&&(y.parameters=E);let C=await this.buildRequestBody(e,c);C&&(y.requestBody=C);let v=e.responses;v&&Object.keys(v).length>0?y.responses=this.mapResponseDefinitions(v):y.responses=await this.buildResponses(e,l.id,c);let _=e.security;if(_&&_.length>0)y.security=_;else{let k=this.buildOperationSecurity(e,l,n);k!==void 0&&(y.security=k)}let q=r.paths[d][m];q?this.mergeOperation(q,y,e.name):r.paths[d][m]=y}mergeOperation(e,r,n){if(r.summary&&r.summary!==e.summary&&(e.description=(e.description||e.summary||"")+`
|
|
235
|
+
`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Ag(e),n=Fu(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Ag(e),n=Fu(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};QA.Parser=aR});var rT=V(Fd=>{"use strict";var ZA=G_(),WK=Od(),Md=kd(),zK=z0(),JK=st(),GK=oR(),XA=lR();function eT(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new GK.LineCounter||null,prettyErrors:e}}function YK(t,e={}){let{lineCounter:r,prettyErrors:n}=eT(e),i=new XA.Parser(r?.addNewLine),s=new ZA.Composer(e),o=Array.from(s.compose(i.parse(t)));if(n&&r)for(let l of o)l.errors.forEach(Md.prettifyError(t,r)),l.warnings.forEach(Md.prettifyError(t,r));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function tT(t,e={}){let{lineCounter:r,prettyErrors:n}=eT(e),i=new XA.Parser(r?.addNewLine),s=new ZA.Composer(e),o=null;for(let l of s.compose(i.parse(t),!0,t.length))if(!o)o=l;else if(o.options.logLevel!=="silent"){o.errors.push(new Md.YAMLParseError(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(o.errors.forEach(Md.prettifyError(t,r)),o.warnings.forEach(Md.prettifyError(t,r))),o}function KK(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=tT(t,r);if(!i)return null;if(i.warnings.forEach(s=>zK.warn(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function QK(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return JK.isDocument(t)&&!n?t.toString(r):new WK.Document(t,n,r).toString(r)}Fd.parse=KK;Fd.parseAllDocuments=YK;Fd.parseDocument=tT;Fd.stringify=QK});var Dd=V(Rt=>{"use strict";var ZK=G_(),XK=Od(),e4=O_(),uR=kd(),t4=dd(),Po=st(),r4=xo(),n4=tr(),i4=qo(),s4=Oo(),o4=Pg(),a4=iR(),l4=oR(),u4=lR(),$g=rT(),nT=ld();Rt.Composer=ZK.Composer;Rt.Document=XK.Document;Rt.Schema=e4.Schema;Rt.YAMLError=uR.YAMLError;Rt.YAMLParseError=uR.YAMLParseError;Rt.YAMLWarning=uR.YAMLWarning;Rt.Alias=t4.Alias;Rt.isAlias=Po.isAlias;Rt.isCollection=Po.isCollection;Rt.isDocument=Po.isDocument;Rt.isMap=Po.isMap;Rt.isNode=Po.isNode;Rt.isPair=Po.isPair;Rt.isScalar=Po.isScalar;Rt.isSeq=Po.isSeq;Rt.Pair=r4.Pair;Rt.Scalar=n4.Scalar;Rt.YAMLMap=i4.YAMLMap;Rt.YAMLSeq=s4.YAMLSeq;Rt.CST=o4;Rt.Lexer=a4.Lexer;Rt.LineCounter=l4.LineCounter;Rt.Parser=u4.Parser;Rt.parse=$g.parse;Rt.parseAllDocuments=$g.parseAllDocuments;Rt.parseDocument=$g.parseDocument;Rt.stringify=$g.stringify;Rt.visit=nT.visit;Rt.visitAsync=nT.visitAsync});var c4,f4,d4,p4,h4,m4,g4,ko,Ng=ae(()=>{"use strict";c4=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/,f4=/^\d{4}-\d{2}-\d{2}$/,d4=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,p4=/^https?:\/\/[^\s]+$/,h4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,m4=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,g4=/^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/,ko=class{inferFromValue(e){if(e==null)return{nullable:!0};if(Array.isArray(e))return this.inferArraySchema(e);switch(typeof e){case"string":return this.inferStringSchema(e);case"number":return Number.isInteger(e)?{type:"integer"}:{type:"number"};case"boolean":return{type:"boolean"};case"object":return this.inferObjectSchema(e);default:return{}}}mergeSchemas(e,r){if(!e||Object.keys(e).length===0)return{...r};if(!r||Object.keys(r).length===0)return{...e};let n=e.nullable||r.nullable;if(!e.type&&e.nullable)return{...r,nullable:!0};if(!r.type&&r.nullable)return{...e,nullable:!0};if(e.type!==r.type)return e.type==="integer"&&r.type==="number"||e.type==="number"&&r.type==="integer"?{type:"number",...n&&{nullable:!0}}:{...n&&{nullable:!0}};let i={type:e.type};return n&&(i.nullable=!0),e.type==="object"&&r.type==="object"?this.mergeObjectSchemas(e,r,n):e.type==="array"&&r.type==="array"?this.mergeArraySchemas(e,r,n):(e.format&&e.format===r.format&&(i.format=e.format),i)}inferStringFormat(e){if(c4.test(e))return"date-time";if(f4.test(e))return"date";if(d4.test(e))return"email";if(h4.test(e))return"uuid";if(p4.test(e))return"uri";if(m4.test(e))return"ipv4";if(g4.test(e))return"ipv6"}inferStringSchema(e){let r={type:"string"},n=this.inferStringFormat(e);return n&&(r.format=n),r}inferArraySchema(e){let r={type:"array"};if(e.length===0)return r;let n=this.inferFromValue(e[0]);for(let i=1;i<e.length;i++)n=this.mergeSchemas(n,this.inferFromValue(e[i]));return r.items=n,r}inferObjectSchema(e){let r={type:"object",properties:{}},n=Object.keys(e);for(let i of n)r.properties[i]=this.inferFromValue(e[i]);return r}mergeObjectSchemas(e,r,n){let i={type:"object",properties:{},...n&&{nullable:!0}},s=e.properties||{},o=r.properties||{},l=new Set([...Object.keys(s),...Object.keys(o)]);for(let m of l)s[m]&&o[m]?i.properties[m]=this.mergeSchemas(s[m],o[m]):s[m]?i.properties[m]={...s[m]}:i.properties[m]={...o[m]};let c=new Set(e.required||Object.keys(s)),d=new Set(r.required||Object.keys(o)),p=[...l].filter(m=>c.has(m)&&d.has(m));return p.length>0&&(i.required=p),i}mergeArraySchemas(e,r,n){let i={type:"array",...n&&{nullable:!0}};return e.items&&r.items?i.items=this.mergeSchemas(e.items,r.items):e.items?i.items={...e.items}:r.items&&(i.items={...r.items}),i}}});var iT,y4,Du,cR=ae(()=>{"use strict";iT=Qc(Dd());Ng();y4=new Set(["content-type","authorization","accept","cookie","host","content-length"]),Du=class{constructor(e,r,n){this.collectionService=e;this.envConfigService=r;this.inferenceService=n;this.inferrer=new ko}collectionService;envConfigService;inferenceService;inferrer;async export(e,r){let n=this.collectionService.getCollection(e);if(!n)throw new Error(`Collection ${e} not found`);let i={openapi:"3.0.3",info:this.buildInfo(n,r),servers:this.buildServers(r),paths:{},components:{schemas:{},securitySchemes:{}},tags:[]},s=new Map;if(n.auth&&n.auth.type!=="none"&&n.auth.type!=="inherit"){let c=this.mapAuthToSecurityScheme(n.auth);if(c){let{schemeName:d,scheme:p,requirement:m}=c;s.set(d,p),i.security=[m]}}let o=new Set,l=new Set;if(await this.processItems(n.items,i,s,o,l,void 0,n,r),this.augmentServersFromHostVars(l,i.servers,r),s.size>0)for(let[c,d]of s)i.components.securitySchemes[c]=d;else delete i.components.securitySchemes;return i.tags=[...o].map(c=>({name:c})),i.tags.length===0&&delete i.tags,this.deduplicateComponents(i),Object.keys(i.components.schemas).length===0&&delete i.components.schemas,Object.keys(i.components).length===0&&delete i.components,r.format==="yaml"?iT.stringify(i,{indent:2}):JSON.stringify(i,null,2)}buildInfo(e,r){return{title:r.info?.title||e.name,description:r.info?.description||e.description||"",version:r.info?.version||e.version||"1.0.0"}}buildServers(e){let r=[],n=e.environments||[];if(n.length===0){let i=this.envConfigService.getSelectedEnvironment();if(i){let s=this.envConfigService.resolveVariables("{{baseUrl}}",i);s&&s!=="{{baseUrl}}"&&r.push({url:s,description:i})}}else{let i=new Set;for(let s of n){let o=this.envConfigService.resolveVariables("{{baseUrl}}",s);o&&o!=="{{baseUrl}}"&&!i.has(o)&&(i.add(o),r.push({url:o,description:s}))}}return r.length===0&&r.push({url:"http://localhost",description:"Default server"}),r}async processItems(e,r,n,i,s,o,l,c){for(let d of e)if(d.type==="folder"){let p=d,m=o||p.name;i.add(m),p.items&&await this.processItems(p.items,r,n,i,s,m,l,c)}else{let p=d;await this.processRequest(p,r,n,i,s,o,l,c)}}async processRequest(e,r,n,i,s,o,l,c){let{path:d,hostVar:p}=this.normalizeUrl(e.url);p&&s.add(p);let m=(e.method||"GET").toLowerCase();r.paths[d]||(r.paths[d]={});let y={};y.operationId=e.operationId||this.generateOperationId(e,m,d,r),y.summary=e.summary||this.cleanSummary(e.name),e.description&&(y.description=e.description),(e.deprecated||this.hasDeprecatedPrefix(e.name))&&(y.deprecated=!0,this.hasDeprecatedPrefix(e.name)&&(y.summary=e.name.replace(/^\[DEPRECATED\]\s*/i,"")));let b=e.tags;if(b&&b.length>0){y.tags=b;for(let k of b)i.add(k)}else o&&(y.tags=[o]);let q=this.buildParameters(e);q.length>0&&(y.parameters=q);let C=await this.buildRequestBody(e,c);C&&(y.requestBody=C);let v=e.responses;v&&Object.keys(v).length>0?y.responses=this.mapResponseDefinitions(v):y.responses=await this.buildResponses(e,l.id,c);let _=e.security;if(_&&_.length>0)y.security=_;else{let k=this.buildOperationSecurity(e,l,n);k!==void 0&&(y.security=k)}let E=r.paths[d][m];E?this.mergeOperation(E,y,e.name):r.paths[d][m]=y}mergeOperation(e,r,n){if(r.summary&&r.summary!==e.summary&&(e.description=(e.description||e.summary||"")+`
|
|
236
236
|
|
|
237
237
|
Variant: **${n}**`+(r.description?` \u2014 ${r.description}`:"")),r.tags){let i=new Set(e.tags||[]);for(let s of r.tags)i.add(s);e.tags=[...i]}if(r.parameters){e.parameters||(e.parameters=[]);for(let i of r.parameters){let s=e.parameters.find(o=>o.name===i.name&&o.in===i.in);s?this.mergeParameterSchema(s,i,n):e.parameters.push(i)}}if(r.responses){e.responses||(e.responses={});for(let[i,s]of Object.entries(r.responses))e.responses[i]||(e.responses[i]=s)}if(r.requestBody?.content&&e.requestBody?.content)for(let[i,s]of Object.entries(r.requestBody.content))e.requestBody.content[i]||(e.requestBody.content[i]=s);else r.requestBody&&!e.requestBody&&(e.requestBody=r.requestBody)}mergeParameterSchema(e,r,n){e.schema||(e.schema={});let i=e.schema,s=r.schema||{},o=this.getConstraintKind(i),l=this.getConstraintKind(s);if(o==="none"&&l==="none")this.widenType(i,s);else if(o==="none")Object.assign(i,this.extractConstraints(s)),this.widenType(i,s);else if(l==="none")this.widenType(i,s);else if(o===l)this.mergeSameKindConstraints(i,s,o),this.widenType(i,s);else{if(i.oneOf){let c=this.buildVariantSchema(s);i.oneOf.some(d=>JSON.stringify(d)===JSON.stringify(c))||i.oneOf.push(c)}else if(s.oneOf){let c=this.buildVariantSchema(i);i.oneOf=[c,...s.oneOf]}else{let c=this.buildVariantSchema(i),d=this.buildVariantSchema(s);i.oneOf=[c,d]}this.stripConstraints(i)}if(r.description&&r.description!==e.description&&(e.description=(e.description||"")+(e.description?"; ":"")+r.description),r.example!==void 0&&r.example!==e.example){e.examples||(e.examples={},e.example!==void 0&&(e.examples.variant1={value:e.example}));let c=`variant_${n.replace(/[^a-zA-Z0-9_]/g,"_")}`;e.examples[c]={value:r.example},delete e.example}}getConstraintKind(e){return e.oneOf?"oneOf":e.enum&&e.enum.length>0?"enum":e.pattern?"pattern":e.minimum!==void 0||e.maximum!==void 0||e.exclusiveMinimum!==void 0||e.exclusiveMaximum!==void 0||e.multipleOf!==void 0?"range":e.minLength!==void 0||e.maxLength!==void 0?"length":e.minItems!==void 0||e.maxItems!==void 0||e.uniqueItems?"array":e.format?"format":"none"}mergeSameKindConstraints(e,r,n){switch(n){case"enum":{let i=new Set(e.enum||[]);for(let s of r.enum||[])i.add(s);e.enum=[...i];break}case"pattern":{r.pattern&&r.pattern!==e.pattern&&(e.pattern=`(?:${e.pattern})|(?:${r.pattern})`);break}case"range":{r.minimum!==void 0&&(e.minimum=e.minimum!==void 0?Math.min(e.minimum,r.minimum):r.minimum),r.maximum!==void 0&&(e.maximum=e.maximum!==void 0?Math.max(e.maximum,r.maximum):r.maximum),r.exclusiveMinimum&&(e.exclusiveMinimum=!0),r.exclusiveMaximum&&(e.exclusiveMaximum=!0),r.multipleOf!==void 0&&(e.multipleOf=e.multipleOf!==void 0?Math.min(e.multipleOf,r.multipleOf):r.multipleOf);break}case"length":{r.minLength!==void 0&&(e.minLength=e.minLength!==void 0?Math.min(e.minLength,r.minLength):r.minLength),r.maxLength!==void 0&&(e.maxLength=e.maxLength!==void 0?Math.max(e.maxLength,r.maxLength):r.maxLength);break}case"array":{r.minItems!==void 0&&(e.minItems=e.minItems!==void 0?Math.min(e.minItems,r.minItems):r.minItems),r.maxItems!==void 0&&(e.maxItems=e.maxItems!==void 0?Math.max(e.maxItems,r.maxItems):r.maxItems),r.uniqueItems&&(e.uniqueItems=!0);break}case"format":{if(r.format&&r.format!==e.format){let i={type:e.type||"string",format:e.format},s={type:r.type||"string",format:r.format};delete e.format,e.oneOf=[i,s]}break}case"oneOf":{if(r.oneOf)for(let i of r.oneOf)e.oneOf.some(s=>JSON.stringify(s)===JSON.stringify(i))||e.oneOf.push(i);break}}}buildVariantSchema(e){let r={};return e.type&&(r.type=e.type),e.enum&&(r.enum=[...e.enum]),e.pattern&&(r.pattern=e.pattern),e.format&&(r.format=e.format),e.minimum!==void 0&&(r.minimum=e.minimum),e.maximum!==void 0&&(r.maximum=e.maximum),e.exclusiveMinimum!==void 0&&(r.exclusiveMinimum=e.exclusiveMinimum),e.exclusiveMaximum!==void 0&&(r.exclusiveMaximum=e.exclusiveMaximum),e.multipleOf!==void 0&&(r.multipleOf=e.multipleOf),e.minLength!==void 0&&(r.minLength=e.minLength),e.maxLength!==void 0&&(r.maxLength=e.maxLength),e.minItems!==void 0&&(r.minItems=e.minItems),e.maxItems!==void 0&&(r.maxItems=e.maxItems),e.uniqueItems&&(r.uniqueItems=!0),e.nullable&&(r.nullable=!0),r}stripConstraints(e){delete e.enum,delete e.pattern,delete e.format,delete e.minimum,delete e.maximum,delete e.exclusiveMinimum,delete e.exclusiveMaximum,delete e.multipleOf,delete e.minLength,delete e.maxLength,delete e.minItems,delete e.maxItems,delete e.uniqueItems,delete e.nullable}extractConstraints(e){let r={};return e.enum&&(r.enum=[...e.enum]),e.pattern&&(r.pattern=e.pattern),e.format&&(r.format=e.format),e.minimum!==void 0&&(r.minimum=e.minimum),e.maximum!==void 0&&(r.maximum=e.maximum),e.exclusiveMinimum!==void 0&&(r.exclusiveMinimum=e.exclusiveMinimum),e.exclusiveMaximum!==void 0&&(r.exclusiveMaximum=e.exclusiveMaximum),e.multipleOf!==void 0&&(r.multipleOf=e.multipleOf),e.minLength!==void 0&&(r.minLength=e.minLength),e.maxLength!==void 0&&(r.maxLength=e.maxLength),e.minItems!==void 0&&(r.minItems=e.minItems),e.maxItems!==void 0&&(r.maxItems=e.maxItems),e.uniqueItems&&(r.uniqueItems=!0),e.nullable&&(r.nullable=!0),r}widenType(e,r){!r.type||r.type===e.type||(e.type?(e.type==="integer"&&r.type==="number"||e.type==="number"&&r.type==="integer")&&(e.type="number"):e.type=r.type)}normalizeUrl(e){let r=e,n=null,i=r.match(/^\{\{(\w+)\}\}/);return i&&(n=i[1],r=r.slice(i[0].length)),r=r.replace(/:([a-zA-Z_]\w*)/g,"{$1}"),r=r.replace(/\{\{(\w+)\}\}/g,"{$1}"),r.startsWith("/")||(r="/"+r),r.length>1&&r.endsWith("/")&&(r=r.slice(0,-1)),r=r.replace(/\/\//g,"/"),{path:r,hostVar:n}}generateOperationId(e,r,n,i){let s=this.toCamelCase(e.name),o=this.collectOperationIds(i);if(o.has(s)&&(s=`${s}${r.charAt(0).toUpperCase()}${r.slice(1)}`),!s||o.has(s)){let l=n.split("/").filter(c=>c&&!c.startsWith("{"));s=r+l.map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join("")}return s}collectOperationIds(e){let r=new Set;if(e.paths)for(let n of Object.values(e.paths))for(let i of Object.values(n))i.operationId&&r.add(i.operationId);return r}toCamelCase(e){return e.replace(/[^a-zA-Z0-9]+(.)/g,(r,n)=>n.toUpperCase()).replace(/^[A-Z]/,r=>r.toLowerCase()).replace(/[^a-zA-Z0-9]/g,"")}buildParameters(e){let r=[];if(e.params)for(let[n,i]of Object.entries(e.params)){let s={name:n,in:"path",required:!0};if(typeof i=="string")s.schema={type:this.inferTypeFromValue(i)},s.example=this.coerceExample(i,s.schema.type);else{let o=i;o.oneOf?(s.schema={oneOf:o.oneOf},o.type&&(s.schema.type=o.type)):(s.schema={type:o.type||this.inferTypeFromValue(o.value)},o.format&&(s.schema.format=o.format),o.enum&&(s.schema.enum=o.enum),o.pattern&&(s.schema.pattern=o.pattern),o.minimum!==void 0&&(s.schema.minimum=o.minimum),o.maximum!==void 0&&(s.schema.maximum=o.maximum),o.exclusiveMinimum!==void 0&&(s.schema.exclusiveMinimum=o.exclusiveMinimum),o.exclusiveMaximum!==void 0&&(s.schema.exclusiveMaximum=o.exclusiveMaximum),o.multipleOf!==void 0&&(s.schema.multipleOf=o.multipleOf),o.minLength!==void 0&&(s.schema.minLength=o.minLength),o.maxLength!==void 0&&(s.schema.maxLength=o.maxLength),o.minItems!==void 0&&(s.schema.minItems=o.minItems),o.maxItems!==void 0&&(s.schema.maxItems=o.maxItems),o.uniqueItems&&(s.schema.uniqueItems=!0),o.nullable&&(s.schema.nullable=!0)),o.description&&(s.description=o.description),o.deprecated&&(s.deprecated=!0),s.example=this.coerceExample(o.value,s.schema.type||"string")}r.push(s)}if(e.query)for(let n of e.query){if(!n.key)continue;let i=this.buildKeyValueParam(n,"query");r.push(i)}if(e.headers){let n=e.headers.find(i=>i.key.toLowerCase()==="cookie");if(n){let i=this.parseCookieHeader(n.value);r.push(...i)}for(let i of e.headers){if(!i.key||y4.has(i.key.toLowerCase()))continue;let s=this.buildKeyValueParam(i,"header");r.push(s)}}return r}buildKeyValueParam(e,r){let n={name:e.key,in:r,schema:{}};return e.oneOf?(n.schema.oneOf=e.oneOf,e.type&&(n.schema.type=e.type)):(n.schema.type=e.type||"string",e.format&&(n.schema.format=e.format),e.enum&&(n.schema.enum=e.enum),e.pattern&&(n.schema.pattern=e.pattern),e.minimum!==void 0&&(n.schema.minimum=e.minimum),e.maximum!==void 0&&(n.schema.maximum=e.maximum),e.exclusiveMinimum!==void 0&&(n.schema.exclusiveMinimum=e.exclusiveMinimum),e.exclusiveMaximum!==void 0&&(n.schema.exclusiveMaximum=e.exclusiveMaximum),e.multipleOf!==void 0&&(n.schema.multipleOf=e.multipleOf),e.minLength!==void 0&&(n.schema.minLength=e.minLength),e.maxLength!==void 0&&(n.schema.maxLength=e.maxLength),e.minItems!==void 0&&(n.schema.minItems=e.minItems),e.maxItems!==void 0&&(n.schema.maxItems=e.maxItems),e.uniqueItems&&(n.schema.uniqueItems=!0),e.nullable&&(n.schema.nullable=!0)),e.required&&(n.required=!0),e.description&&(n.description=e.description),e.deprecated&&(n.deprecated=!0),e.value&&(n.example=this.coerceExample(e.value,n.schema.type||"string")),n}parseCookieHeader(e){let r=[],n=e.split(";").map(i=>i.trim()).filter(Boolean);for(let i of n){let s=i.indexOf("=");if(s>0){let o=i.substring(0,s).trim(),l=i.substring(s+1).trim();r.push({name:o,in:"cookie",schema:{type:"string"},example:l})}}return r}inferTypeFromValue(e){return/^-?\d+$/.test(e)?"integer":/^-?\d+\.\d+$/.test(e)?"number":e==="true"||e==="false"?"boolean":"string"}coerceExample(e,r){let n=this.sanitizeEnvVar(e);switch(r){case"integer":return parseInt(n,10)||n;case"number":return parseFloat(n)||n;case"boolean":return n==="true";default:return n}}sanitizeEnvVar(e){return e.replace(/\{\{(\w+)\}\}/g,"<$1>")}sanitizeObjectExamples(e){if(typeof e=="string")return this.sanitizeEnvVar(e);if(Array.isArray(e))return e.map(r=>this.sanitizeObjectExamples(r));if(e!==null&&typeof e=="object"){let r={};for(let[n,i]of Object.entries(e))r[n]=this.sanitizeObjectExamples(i);return r}return e}async buildRequestBody(e,r){if(!e.body||e.body.type==="none")return null;let n=e.body,i={required:!0,content:{}},s,o,l,c;if(e.bodySchema){if(e.bodySchema.content){for(let[m,y]of Object.entries(e.bodySchema.content)){let b={};y.schema&&(b.schema=y.schema),y.examples&&(b.examples=y.examples),y.encoding&&(b.encoding=y.encoding),i.content[m]=b}let p=e.bodySchema.contentType||Object.keys(e.bodySchema.content)[0];if(p&&n.content){let m=this.tryParseBodyContent(n);m!==void 0&&i.content[p]&&(i.content[p].example=m)}return i}s=e.bodySchema.contentType||this.getContentType(n),o=e.bodySchema.schema,e.bodySchema.components,l=this.tryParseBodyContent(n),e.bodySchema.encoding&&(c=e.bodySchema.encoding)}else switch(s=this.getContentType(n),n.type){case"raw":{if(n.format==="json"&&n.content){let p=this.tryParseBodyContent(n);p!==void 0?(o=this.inferrer.inferFromValue(p),l=p):o={type:"string"}}else o={type:"string"},l=typeof n.content=="string"?n.content:void 0;break}case"form-data":{o=this.buildFormDataSchemaFromBody(n);break}case"x-www-form-urlencoded":{o=this.buildFormDataSchemaFromBody(n);break}case"binary":{o={type:"string",format:"binary"};break}case"graphql":{o={type:"object",properties:{query:{type:"string"},variables:{type:"object"}}},l=this.tryParseBodyContent(n);break}default:return null}let d={};return o&&(d.schema=o),l!==void 0&&(d.example=l),c&&(d.encoding=c),i.content[s]=d,i}getContentType(e){if(!e)return"application/json";switch(e.type){case"raw":switch(e.format){case"json":return"application/json";case"xml":return"application/xml";case"html":return"text/html";case"text":return"text/plain";default:return"text/plain"}case"form-data":return"multipart/form-data";case"x-www-form-urlencoded":return"application/x-www-form-urlencoded";case"binary":return"application/octet-stream";case"graphql":return"application/json";default:return"application/json"}}tryParseBodyContent(e){if(!e||!e.content)return;let r;if(typeof e.content=="string")try{r=JSON.parse(e.content)}catch{r=e.content}else r=e.content;return this.sanitizeObjectExamples(r)}buildFormDataSchemaFromBody(e){let r={type:"object",properties:{}},n=e.formData||e.urlencoded||[];for(let i of n)i.enabled!==!1&&(i.type==="file"?r.properties[i.key]={type:"string",format:"binary"}:r.properties[i.key]={type:"string"});return r}async buildResponses(e,r,n){let i={};if(e.responseSchema)for(let[s,o]of Object.entries(e.responseSchema.responses)){let l={description:o.description||`Status ${s}`};if(o.content){l.content={};for(let[c,d]of Object.entries(o.content)){let p={};d.schema&&(p.schema=d.schema),d.examples&&(p.examples=d.examples),l.content[c]=p}}else if(o.schema){let c=o.contentType||"application/json",d={schema:o.schema};o.examples&&(d.examples=o.examples),l.content={[c]:d}}if(o.headers){l.headers={};for(let[c,d]of Object.entries(o.headers))l.headers[c]={...d.description&&{description:d.description},schema:d.schema}}i[s]=l}return Object.keys(i).length===0&&(i[200]={description:"Successful response"}),i}mapResponseDefinitions(e){let r={};for(let[n,i]of Object.entries(e)){let s={description:i.description||`Status ${n}`};if(i.schema||i.examples){let o=i.contentType||"application/json",l={};i.schema&&(l.schema=i.schema),i.examples&&Object.keys(i.examples).length>0&&(l.examples=i.examples),s.content={[o]:l}}if(i.headers&&Object.keys(i.headers).length>0){s.headers={};for(let[o,l]of Object.entries(i.headers)){let c=l;s.headers[o]={...c.description&&{description:c.description},...c.schema&&{schema:c.schema}}}}r[n]=s}return Object.keys(r).length===0&&(r[200]={description:"Successful response"}),r}buildOperationSecurity(e,r,n){if(!e.auth||e.auth.type==="inherit")return;if(e.auth.type==="none")return[];let i=this.mapAuthToSecurityScheme(e.auth);if(!i)return;let{schemeName:s,scheme:o,requirement:l}=i;return n.set(s,o),[l]}mapAuthToSecurityScheme(e){switch(e.type){case"bearer":return{schemeName:"BearerAuth",scheme:{type:"http",scheme:"bearer"},requirement:{BearerAuth:[]}};case"basic":return{schemeName:"BasicAuth",scheme:{type:"http",scheme:"basic"},requirement:{BasicAuth:[]}};case"apikey":{let r=e.apikey||{key:"X-Api-Key",value:"",in:"header"},n=`ApiKey_${r.key||"key"}`;return{schemeName:n,scheme:{type:"apiKey",in:r.in||"header",name:r.key||"X-Api-Key"},requirement:{[n]:[]}}}case"oauth2":{let r=e.oauth2;if(!r)return;let n={};switch(r.grantType){case"client_credentials":n.clientCredentials={tokenUrl:r.tokenUrl||"",scopes:r.scope?this.parseScopes(r.scope):{}};break;case"authorization_code":n.authorizationCode={authorizationUrl:r.authUrl||"",tokenUrl:r.tokenUrl||"",scopes:r.scope?this.parseScopes(r.scope):{}};break;case"password":n.password={tokenUrl:r.tokenUrl||"",scopes:r.scope?this.parseScopes(r.scope):{}};break;case"implicit":n.implicit={authorizationUrl:r.authUrl||"",scopes:r.scope?this.parseScopes(r.scope):{}};break;default:n.clientCredentials={tokenUrl:r.tokenUrl||"",scopes:{}}}return{schemeName:"OAuth2",scheme:{type:"oauth2",flows:n},requirement:{OAuth2:[]}}}default:return{schemeName:"BearerAuth",scheme:{type:"http",scheme:"bearer"},requirement:{BearerAuth:[]}}}}parseScopes(e){let r={};for(let n of e.split(/\s+/))n&&(r[n]="");return r}deduplicateComponents(e){let r=new Map,n=new Map;if(e.paths)for(let[i,s]of Object.entries(e.paths))for(let[o,l]of Object.entries(s)){let c=l;if(c.responses){for(let[d,p]of Object.entries(c.responses))if(p.content)for(let m of Object.values(p.content))m.schema&&this.trackSchema(m.schema,`${o}${i}Response${d}`,r,n)}if(c.requestBody?.content)for(let d of Object.values(c.requestBody.content))d.schema&&this.trackSchema(d.schema,`${o}${i}Request`,r,n)}for(let[i,s]of r)if((n.get(i)||0)>=2){let l=this.sanitizeComponentName(s.name);e.components.schemas[l]=s.schema,this.replaceInlineSchema(e,s.schema,`#/components/schemas/${l}`)}}trackSchema(e,r,n,i){if(!e||e.type!=="object"||!e.properties)return;let s=JSON.stringify(e);n.has(s)||n.set(s,{name:r,schema:e}),i.set(s,(i.get(s)||0)+1)}replaceInlineSchema(e,r,n){let i=JSON.stringify(r);if(e.paths)for(let s of Object.values(e.paths))for(let o of Object.values(s)){if(o.responses){for(let l of Object.values(o.responses))if(l.content)for(let c of Object.values(l.content))c.schema&&JSON.stringify(c.schema)===i&&(c.schema={$ref:n})}if(o.requestBody?.content)for(let l of Object.values(o.requestBody.content))l.schema&&JSON.stringify(l.schema)===i&&(l.schema={$ref:n})}}sanitizeComponentName(e){return e.replace(/[^a-zA-Z0-9._-]/g,"").replace(/^[^a-zA-Z]/,"Schema")}cleanSummary(e){return e.replace(/^\[DEPRECATED\]\s*/i,"")}hasDeprecatedPrefix(e){return/^\[DEPRECATED\]/i.test(e)}augmentServersFromHostVars(e,r,n){if(e.size===0)return;let i=new Set(r.map(o=>o.url)),s=n.environments?.length?n.environments:[this.envConfigService.getSelectedEnvironment()].filter(o=>!!o);for(let o of e){let l=`{{${o}}}`,c=!1;for(let d of s){let p=this.envConfigService.resolveVariables(l,d);p&&p!==l&&!i.has(p)&&(r.push({url:p,description:d}),i.add(p),c=!0)}if(!c){let d=`{${o}}`;i.has(d)||(r.push({url:d,variables:{[o]:{default:""}}}),i.add(d))}}}}});var ju,fR=ae(()=>{"use strict";ju=class{generate(e,r){if(!e)return;let n=r||{};if(e.$ref){let i=this.resolveLocalRef(e.$ref,n.components);return i?this.generate(i,n):{}}if(e.nullable&&!e.type)return null;if(e.enum&&e.enum.length>0)return e.enum[0];if(e.default!==void 0)return e.default;if(e.example!==void 0)return e.example;if(e.allOf)return this.generateFromAllOf(e.allOf,e.discriminator,n);if(e.oneOf)return this.generateFromOneOfAnyOf(e.oneOf,e.discriminator,n);if(e.anyOf)return this.generateFromOneOfAnyOf(e.anyOf,e.discriminator,n);switch(e.type){case"string":return this.generateString(e);case"integer":return this.generateInteger(e);case"number":return this.generateNumber(e);case"boolean":return!1;case"array":return this.generateArray(e,n);case"object":return this.generateObject(e,n);default:return e.properties?this.generateObject(e,n):{}}}generateString(e){switch(e.format){case"email":return"user@example.com";case"date-time":return"2026-01-01T00:00:00Z";case"date":return"2026-01-01";case"time":return"00:00:00";case"uri":case"url":return"https://example.com";case"uuid":return"00000000-0000-0000-0000-000000000000";case"ipv4":return"127.0.0.1";case"ipv6":return"::1";case"hostname":return"example.com";case"binary":return"";case"byte":return"c3RyaW5n";case"password":return"********";default:return"string"}}generateInteger(e){return e.minimum!==void 0?e.minimum:e.exclusiveMinimum!==void 0?e.exclusiveMinimum+1:0}generateNumber(e){return e.minimum!==void 0?e.minimum:e.exclusiveMinimum!==void 0?e.exclusiveMinimum+.1:0}generateArray(e,r){return e.items?[this.generate(e.items,r)]:[]}generateObject(e,r){let n={},i=e.properties||{};for(let[s,o]of Object.entries(i))r.omitReadOnly&&o.readOnly||(n[s]=this.generate(o,r));return n}generateFromAllOf(e,r,n){let i={type:"object",properties:{},required:[]};for(let o of e){let l=o.$ref?this.resolveLocalRef(o.$ref,n.components)||{}:o;l.properties&&Object.assign(i.properties,l.properties),l.required&&(i.required=[...i.required||[],...l.required])}let s=this.generateObject(i,n);return r?.propertyName&&(s[r.propertyName]=this.guessDiscriminatorValue(e,n)),s}generateFromOneOfAnyOf(e,r,n){if(e.length===0)return{};let i=e[0].$ref&&this.resolveLocalRef(e[0].$ref,n.components)||e[0],s=this.generate(i,n);return r?.propertyName&&typeof s=="object"&&s!==null&&(s[r.propertyName]=this.guessDiscriminatorValue(e,n)),s}guessDiscriminatorValue(e,r){if(e.length===0)return"unknown";let n=e[0];if(n.$ref){let i=n.$ref.split("/");return i[i.length-1]}return"variant1"}resolveLocalRef(e,r){if(!e||!r)return;let n=e.match(/^#\/components\/(?:schemas\/)?(.+)$/);if(n)return r[n[1]];let i=e.match(/^#\/components\/(.+)$/);if(i)return r[i[1]]}}});var Mg=V(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.getDeepKeys=Lu.toJSON=void 0;var v4=["function","symbol","undefined"],b4=["constructor","prototype","__proto__"],S4=Object.getPrototypeOf({});function w4(){let t={},e=this;for(let r of sT(e))if(typeof r=="string"){let n=e[r],i=typeof n;v4.includes(i)||(t[r]=n)}return t}Lu.toJSON=w4;function sT(t,e=[]){let r=[];for(;t&&t!==S4;)r=r.concat(Object.getOwnPropertyNames(t),Object.getOwnPropertySymbols(t)),t=Object.getPrototypeOf(t);let n=new Set(r);for(let i of e.concat(b4))n.delete(i);return n}Lu.getDeepKeys=sT});var dR=V(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.addInspectMethod=Uu.format=void 0;var oT=_t("util"),_4=Mg(),aT=oT.inspect.custom||Symbol.for("nodejs.util.inspect.custom");Uu.format=oT.format;function R4(t){t[aT]=C4}Uu.addInspectMethod=R4;function C4(){let t={},e=this;for(let r of _4.getDeepKeys(e)){let n=e[r];t[r]=n}return delete t[aT],t}});var cT=V(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.lazyJoinStacks=Gi.joinStacks=Gi.isWritableStack=Gi.isLazyStack=void 0;var x4=/\r?\n/,E4=/\bono[ @]/;function q4(t){return!!(t&&t.configurable&&typeof t.get=="function")}Gi.isLazyStack=q4;function O4(t){return!!(!t||t.writable||typeof t.set=="function")}Gi.isWritableStack=O4;function lT(t,e){let r=uT(t.stack),n=e?e.stack:void 0;return r&&n?r+`
|
|
238
238
|
|
|
239
239
|
`+n:r||n}Gi.joinStacks=lT;function I4(t,e,r){r?Object.defineProperty(e,"stack",{get:()=>{let n=t.get.apply(e);return lT({stack:n},r)},enumerable:!1,configurable:!0}):P4(e,t)}Gi.lazyJoinStacks=I4;function uT(t){if(t){let e=t.split(x4),r;for(let n=0;n<e.length;n++){let i=e[n];if(E4.test(i))r===void 0&&(r=n);else if(r!==void 0){e.splice(r,n-r);break}}if(e.length>0)return e.join(`
|
|
240
240
|
`)}return t}function P4(t,e){Object.defineProperty(t,"stack",{get:()=>uT(e.get.apply(t)),enumerable:!1,configurable:!0})}});var pT=V(Dg=>{"use strict";Object.defineProperty(Dg,"__esModule",{value:!0});Dg.extendError=void 0;var fT=dR(),Fg=cT(),dT=Mg(),k4=["name","message","stack"];function A4(t,e,r){let n=t;return T4(n,e),e&&typeof e=="object"&&$4(n,e),n.toJSON=dT.toJSON,fT.addInspectMethod&&fT.addInspectMethod(n),r&&typeof r=="object"&&Object.assign(n,r),n}Dg.extendError=A4;function T4(t,e){let r=Object.getOwnPropertyDescriptor(t,"stack");Fg.isLazyStack(r)?Fg.lazyJoinStacks(r,t,e):Fg.isWritableStack(r)&&(t.stack=Fg.joinStacks(t,e))}function $4(t,e){let r=dT.getDeepKeys(e,k4),n=t,i=e;for(let s of r)if(n[s]===void 0)try{n[s]=i[s]}catch{}}});var hT=V(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.normalizeArgs=Hu.normalizeOptions=void 0;var N4=dR();function M4(t){return t=t||{},{concatMessages:t.concatMessages===void 0?!0:!!t.concatMessages,format:t.format===void 0?N4.format:typeof t.format=="function"?t.format:!1}}Hu.normalizeOptions=M4;function F4(t,e){let r,n,i,s="";return typeof t[0]=="string"?i=t:typeof t[1]=="string"?(t[0]instanceof Error?r=t[0]:n=t[0],i=t.slice(1)):(r=t[0],n=t[1],i=t.slice(2)),i.length>0&&(e.format?s=e.format.apply(void 0,i):s=i.join(" ")),e.concatMessages&&r&&r.message&&(s+=(s?`
|
|
241
|
-
`:"")+r.message),{originalError:r,props:n,message:s}}Hu.normalizeArgs=F4});var hR=V(Lg=>{"use strict";Object.defineProperty(Lg,"__esModule",{value:!0});Lg.Ono=void 0;var jg=pT(),mT=hT(),D4=Mg(),j4=pR;Lg.Ono=j4;function pR(t,e){e=mT.normalizeOptions(e);function r(...n){let{originalError:i,props:s,message:o}=mT.normalizeArgs(n,e),l=new t(o);return jg.extendError(l,i,s)}return r[Symbol.species]=t,r}pR.toJSON=function(e){return D4.toJSON.call(e)};pR.extend=function(e,r,n){return n||r instanceof Error?jg.extendError(e,r,n):r?jg.extendError(e,void 0,r):jg.extendError(e)}});var gT=V(Ug=>{"use strict";Object.defineProperty(Ug,"__esModule",{value:!0});Ug.ono=void 0;var Ga=hR(),L4=Yi;Ug.ono=L4;Yi.error=new Ga.Ono(Error);Yi.eval=new Ga.Ono(EvalError);Yi.range=new Ga.Ono(RangeError);Yi.reference=new Ga.Ono(ReferenceError);Yi.syntax=new Ga.Ono(SyntaxError);Yi.type=new Ga.Ono(TypeError);Yi.uri=new Ga.Ono(URIError);var U4=Yi;function Yi(...t){let e=t[0];if(typeof e=="object"&&typeof e.name=="string"){for(let r of Object.values(U4))if(typeof r=="function"&&r.name==="ono"){let n=r[Symbol.species];if(n&&n!==Error&&(e instanceof n||e.name===n.name))return r.apply(void 0,t)}}return Yi.error.apply(void 0,t)}});var vT=V(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});var sre=_t("util")});var Ao=V((yi,Bu)=>{"use strict";var H4=yi&&yi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),B4=yi&&yi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&H4(e,t,r)};Object.defineProperty(yi,"__esModule",{value:!0});yi.ono=void 0;var bT=gT();Object.defineProperty(yi,"ono",{enumerable:!0,get:function(){return bT.ono}});var V4=hR();Object.defineProperty(yi,"Ono",{enumerable:!0,get:function(){return V4.Ono}});B4(vT(),yi);yi.default=bT.ono;typeof Bu=="object"&&typeof Bu.exports=="object"&&(Bu.exports=Object.assign(Bu.exports.default,Bu.exports))});var mR=V(jd=>{"use strict";var W4=jd&&jd.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(jd,"__esModule",{value:!0});jd.default=z4;var ST=W4(_t("path"));function z4(t){return t.startsWith("\\\\?\\")?t:t.split(ST.default?.win32?.sep).join(ST.default?.posix?.sep??"/")}});var wT=V(Hg=>{"use strict";Object.defineProperty(Hg,"__esModule",{value:!0});Hg.isWindows=void 0;var J4=/^win/.test(globalThis.process?globalThis.process.platform:""),G4=()=>J4;Hg.isWindows=G4});var zn=V(jt=>{"use strict";var Y4=jt&&jt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),K4=jt&&jt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Q4=jt&&jt.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&Y4(r,e,n[i]);return K4(r,e),r}})(),Z4=jt&&jt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(jt,"__esModule",{value:!0});jt.parse=void 0;jt.resolve=_T;jt.cwd=RT;jt.getProtocol=SR;jt.getExtension=o3;jt.stripQuery=CT;jt.getHash=xT;jt.stripHash=vR;jt.isHttp=a3;jt.isFileSystemPath=bR;jt.fromFileSystemPath=l3;jt.toFileSystemPath=u3;jt.safePointerToPath=c3;jt.relative=f3;var Vg=Z4(mR()),yR=Q4(_t("path")),X4=/\//g,e3=/^(\w{2,}):\/\//i,t3=/~1/g,r3=/~0/g,n3=_t("path"),Bg=wT(),i3=[[/\?/g,"%3F"],[/#/g,"%23"]],gR=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"],s3=t=>new URL(t);jt.parse=s3;function _T(t,e){let r=new URL((0,Vg.default)(t),"https://aaa.nonexistanturl.com"),n=new URL((0,Vg.default)(e),r),i=e.match(/(\s*)$/)?.[1]||"";if(n.hostname==="aaa.nonexistanturl.com"){let{pathname:s,search:o,hash:l}=n;return s+o+l+i}return n.toString()+i}function RT(){if(typeof window<"u")return location.href;let t=process.cwd(),e=t.slice(-1);return e==="/"||e==="\\"?t:t+"/"}function SR(t){let e=e3.exec(t||"");if(e)return e[1].toLowerCase()}function o3(t){let e=t.lastIndexOf(".");return e>=0?CT(t.substr(e).toLowerCase()):""}function CT(t){let e=t.indexOf("?");return e>=0&&(t=t.substr(0,e)),t}function xT(t){if(!t)return"#";let e=t.indexOf("#");return e>=0?t.substring(e):"#"}function vR(t){if(!t)return"";let e=t.indexOf("#");return e>=0&&(t=t.substring(0,e)),t}function a3(t){let e=SR(t);return e==="http"||e==="https"?!0:e===void 0?typeof window<"u":!1}function bR(t){if(typeof window<"u"||typeof process<"u"&&process.browser)return!1;let e=SR(t);return e===void 0||e==="file"}function l3(t){if((0,Bg.isWindows)()){let e=RT(),r=t.toUpperCase(),i=(0,Vg.default)(e).toUpperCase(),s=r.includes(i),o=r.includes(i),l=yR.win32?.isAbsolute(t)||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("file://");!(s||o||l)&&!e.startsWith("http")&&(t=(0,n3.join)(e,t)),t=(0,Vg.default)(t)}t=encodeURI(t);for(let e of i3)t=t.replace(e[0],e[1]);return t}function u3(t,e){t=decodeURI(t);for(let n=0;n<gR.length;n+=2)t=t.replace(gR[n],gR[n+1]);let r=t.substr(0,7).toLowerCase()==="file://";return r&&(t=t[7]==="/"?t.substr(8):t.substr(7),(0,Bg.isWindows)()&&t[1]==="/"&&(t=t[0]+":"+t.substr(1)),e?t="file:///"+t:(r=!1,t=(0,Bg.isWindows)()?t:"/"+t)),(0,Bg.isWindows)()&&!r&&(t=t.replace(X4,"\\"),t.substr(1,2)===":\\"&&(t=t[0].toUpperCase()+t.substr(1))),t}function c3(t){return t.length<=1||t[0]!=="#"||t[1]!=="/"?[]:t.slice(2).split("/").map(e=>decodeURIComponent(e).replace(t3,"/").replace(r3,"~"))}function f3(t,e){if(!bR(t)||!bR(e))return _T(t,e);let r=yR.default.dirname(vR(t)),n=vR(e);return yR.default.relative(r,n)+xT(e)}});var Jn=V(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.InvalidPointerError=Jt.TimeoutError=Jt.MissingPointerError=Jt.UnmatchedResolverError=Jt.ResolverError=Jt.UnmatchedParserError=Jt.ParserError=Jt.JSONParserErrorGroup=Jt.JSONParserError=void 0;Jt.isHandledError=d3;Jt.normalizeError=p3;var ET=Ao(),Wg=zn(),vi=class extends Error{constructor(e,r){super(),this.code="EUNKNOWN",this.name="JSONParserError",this.message=e,this.source=r,this.path=null,ET.Ono.extend(this)}get footprint(){return`${this.path}+${this.source}+${this.code}+${this.message}`}};Jt.JSONParserError=vi;var zg=class t extends Error{constructor(e){super(),this.files=e,this.name="JSONParserErrorGroup",this.message=`${this.errors.length} error${this.errors.length>1?"s":""} occurred while reading '${(0,Wg.toFileSystemPath)(e.$refs._root$Ref.path)}'`,ET.Ono.extend(this)}static getParserErrors(e){let r=[];for(let n of Object.values(e.$refs._$refs))n.errors&&r.push(...n.errors);return r}get errors(){return t.getParserErrors(this.files)}};Jt.JSONParserErrorGroup=zg;var wR=class extends vi{constructor(e,r){super(`Error parsing ${r}: ${e}`,r),this.code="EPARSER",this.name="ParserError"}};Jt.ParserError=wR;var _R=class extends vi{constructor(e){super(`Could not find parser for "${e}"`,e),this.code="EUNMATCHEDPARSER",this.name="UnmatchedParserError"}};Jt.UnmatchedParserError=_R;var RR=class extends vi{constructor(e,r){super(e.message||`Error reading file "${r}"`,r),this.code="ERESOLVER",this.name="ResolverError","code"in e&&(this.ioErrorCode=String(e.code))}};Jt.ResolverError=RR;var CR=class extends vi{constructor(e){super(`Could not find resolver for "${e}"`,e),this.code="EUNMATCHEDRESOLVER",this.name="UnmatchedResolverError"}};Jt.UnmatchedResolverError=CR;var xR=class extends vi{constructor(e,r,n,i,s){super(`Missing $ref pointer "${(0,Wg.getHash)(r)}". Token "${e}" does not exist.`,(0,Wg.stripHash)(r)),this.code="EMISSINGPOINTER",this.name="MissingPointerError",this.targetToken=e,this.targetRef=n,this.targetFound=i,this.parentPath=s}};Jt.MissingPointerError=xR;var ER=class extends vi{constructor(e){super(`Dereferencing timeout reached: ${e}ms`),this.code="ETIMEOUT",this.name="TimeoutError"}};Jt.TimeoutError=ER;var qR=class extends vi{constructor(e,r){super(`Invalid $ref pointer "${e}". Pointers must begin with "#/"`,(0,Wg.stripHash)(r)),this.code="EUNMATCHEDRESOLVER",this.name="InvalidPointerError"}};Jt.InvalidPointerError=qR;function d3(t){return t instanceof vi||t instanceof zg}function p3(t){return t.path===null&&(t.path=[]),t}});var Ld=V(an=>{"use strict";var h3=an&&an.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),m3=an&&an.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),g3=an&&an.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&h3(r,e,n[i]);return m3(r,e),r}})(),y3=an&&an.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(an,"__esModule",{value:!0});an.nullSymbol=void 0;var OR=y3(Vu()),IR=g3(zn()),Gg=Jn();an.nullSymbol=Symbol("null");var v3=/\//g,b3=/~/g,S3=/~1/g,w3=/~0/g,_3=t=>{try{return decodeURIComponent(t)}catch{return t}},Yg=class t{constructor(e,r,n){this.$ref=e,this.path=r,this.originalPath=n||r,this.value=void 0,this.circular=!1,this.indirections=0}resolve(e,r,n){let i=t.parse(this.path,this.originalPath),s=[];this.value=OT(e);for(let o=0;o<i.length;o++){if(Jg(this,r,n)&&(this.path=t.join(this.path,i.slice(o))),typeof this.value=="object"&&this.value!==null&&!IT(n)&&"$ref"in this.value)return this;let l=i[o];if(this.value[l]===void 0||this.value[l]===null&&o===i.length-1){let c=!1;for(let b=i.length-1;b>o;b--){let E=i.slice(o,b+1).join("/");if(this.value[E]!==void 0){this.value=this.value[E],o=b,c=!0;break}}if(c)continue;if(l in this.value&&this.value[l]===null){this.value=an.nullSymbol;continue}this.value=null;let d=this.$ref.path||"",p=this.path.replace(d,""),m=t.join("",s),y=n?.replace(d,"");throw new Gg.MissingPointerError(l,decodeURI(this.originalPath),p,m,y)}else this.value=this.value[l];s.push(l)}return(!this.value||this.value.$ref&&IR.resolve(this.path,this.value.$ref)!==n)&&Jg(this,r,n),this}set(e,r,n){let i=t.parse(this.path),s;if(i.length===0)return this.value=r,r;this.value=OT(e);for(let o=0;o<i.length-1;o++)Jg(this,n),s=i[o],this.value&&this.value[s]!==void 0?this.value=this.value[s]:this.value=qT(this,s,{});return Jg(this,n),s=i[i.length-1],qT(this,s,r),e}static parse(e,r){let n=IR.getHash(e).substring(1);if(!n)return[];let i=n.split("/");for(let s=0;s<i.length;s++)i[s]=_3(i[s].replace(S3,"/").replace(w3,"~"));if(i[0]!=="")throw new Gg.InvalidPointerError(n,r===void 0?e:r);return i.slice(1)}static join(e,r){e.indexOf("#")===-1&&(e+="#"),r=Array.isArray(r)?r:[r];for(let n=0;n<r.length;n++){let i=r[n];e+="/"+encodeURIComponent(i.replace(b3,"~0").replace(v3,"~1"))}return e}};function Jg(t,e,r){if(OR.default.isAllowed$Ref(t.value,e)){let n=IR.resolve(t.path,t.value.$ref);if(n===t.path&&!IT(r))t.circular=!0;else{let i=t.$ref.$refs._resolve(n,t.path,e);return i===null?!1:(t.indirections+=i.indirections+1,OR.default.isExtended$Ref(t.value)?(t.value=OR.default.dereference(t.value,i.value),!1):(t.$ref=i.$ref,t.path=i.path,t.value=i.value,!0))}}}an.default=Yg;function qT(t,e,r){if(t.value&&typeof t.value=="object")e==="-"&&Array.isArray(t.value)?t.value.push(r):t.value[e]=r;else throw new Gg.JSONParserError(`Error assigning $ref pointer "${t.path}".
|
|
241
|
+
`:"")+r.message),{originalError:r,props:n,message:s}}Hu.normalizeArgs=F4});var hR=V(Lg=>{"use strict";Object.defineProperty(Lg,"__esModule",{value:!0});Lg.Ono=void 0;var jg=pT(),mT=hT(),D4=Mg(),j4=pR;Lg.Ono=j4;function pR(t,e){e=mT.normalizeOptions(e);function r(...n){let{originalError:i,props:s,message:o}=mT.normalizeArgs(n,e),l=new t(o);return jg.extendError(l,i,s)}return r[Symbol.species]=t,r}pR.toJSON=function(e){return D4.toJSON.call(e)};pR.extend=function(e,r,n){return n||r instanceof Error?jg.extendError(e,r,n):r?jg.extendError(e,void 0,r):jg.extendError(e)}});var gT=V(Ug=>{"use strict";Object.defineProperty(Ug,"__esModule",{value:!0});Ug.ono=void 0;var Ga=hR(),L4=Yi;Ug.ono=L4;Yi.error=new Ga.Ono(Error);Yi.eval=new Ga.Ono(EvalError);Yi.range=new Ga.Ono(RangeError);Yi.reference=new Ga.Ono(ReferenceError);Yi.syntax=new Ga.Ono(SyntaxError);Yi.type=new Ga.Ono(TypeError);Yi.uri=new Ga.Ono(URIError);var U4=Yi;function Yi(...t){let e=t[0];if(typeof e=="object"&&typeof e.name=="string"){for(let r of Object.values(U4))if(typeof r=="function"&&r.name==="ono"){let n=r[Symbol.species];if(n&&n!==Error&&(e instanceof n||e.name===n.name))return r.apply(void 0,t)}}return Yi.error.apply(void 0,t)}});var vT=V(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});var sre=_t("util")});var Ao=V((yi,Bu)=>{"use strict";var H4=yi&&yi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),B4=yi&&yi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&H4(e,t,r)};Object.defineProperty(yi,"__esModule",{value:!0});yi.ono=void 0;var bT=gT();Object.defineProperty(yi,"ono",{enumerable:!0,get:function(){return bT.ono}});var V4=hR();Object.defineProperty(yi,"Ono",{enumerable:!0,get:function(){return V4.Ono}});B4(vT(),yi);yi.default=bT.ono;typeof Bu=="object"&&typeof Bu.exports=="object"&&(Bu.exports=Object.assign(Bu.exports.default,Bu.exports))});var mR=V(jd=>{"use strict";var W4=jd&&jd.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(jd,"__esModule",{value:!0});jd.default=z4;var ST=W4(_t("path"));function z4(t){return t.startsWith("\\\\?\\")?t:t.split(ST.default?.win32?.sep).join(ST.default?.posix?.sep??"/")}});var wT=V(Hg=>{"use strict";Object.defineProperty(Hg,"__esModule",{value:!0});Hg.isWindows=void 0;var J4=/^win/.test(globalThis.process?globalThis.process.platform:""),G4=()=>J4;Hg.isWindows=G4});var zn=V(jt=>{"use strict";var Y4=jt&&jt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),K4=jt&&jt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Q4=jt&&jt.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&Y4(r,e,n[i]);return K4(r,e),r}})(),Z4=jt&&jt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(jt,"__esModule",{value:!0});jt.parse=void 0;jt.resolve=_T;jt.cwd=RT;jt.getProtocol=SR;jt.getExtension=o3;jt.stripQuery=CT;jt.getHash=xT;jt.stripHash=vR;jt.isHttp=a3;jt.isFileSystemPath=bR;jt.fromFileSystemPath=l3;jt.toFileSystemPath=u3;jt.safePointerToPath=c3;jt.relative=f3;var Vg=Z4(mR()),yR=Q4(_t("path")),X4=/\//g,e3=/^(\w{2,}):\/\//i,t3=/~1/g,r3=/~0/g,n3=_t("path"),Bg=wT(),i3=[[/\?/g,"%3F"],[/#/g,"%23"]],gR=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"],s3=t=>new URL(t);jt.parse=s3;function _T(t,e){let r=new URL((0,Vg.default)(t),"https://aaa.nonexistanturl.com"),n=new URL((0,Vg.default)(e),r),i=e.match(/(\s*)$/)?.[1]||"";if(n.hostname==="aaa.nonexistanturl.com"){let{pathname:s,search:o,hash:l}=n;return s+o+l+i}return n.toString()+i}function RT(){if(typeof window<"u")return location.href;let t=process.cwd(),e=t.slice(-1);return e==="/"||e==="\\"?t:t+"/"}function SR(t){let e=e3.exec(t||"");if(e)return e[1].toLowerCase()}function o3(t){let e=t.lastIndexOf(".");return e>=0?CT(t.substr(e).toLowerCase()):""}function CT(t){let e=t.indexOf("?");return e>=0&&(t=t.substr(0,e)),t}function xT(t){if(!t)return"#";let e=t.indexOf("#");return e>=0?t.substring(e):"#"}function vR(t){if(!t)return"";let e=t.indexOf("#");return e>=0&&(t=t.substring(0,e)),t}function a3(t){let e=SR(t);return e==="http"||e==="https"?!0:e===void 0?typeof window<"u":!1}function bR(t){if(typeof window<"u"||typeof process<"u"&&process.browser)return!1;let e=SR(t);return e===void 0||e==="file"}function l3(t){if((0,Bg.isWindows)()){let e=RT(),r=t.toUpperCase(),i=(0,Vg.default)(e).toUpperCase(),s=r.includes(i),o=r.includes(i),l=yR.win32?.isAbsolute(t)||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("file://");!(s||o||l)&&!e.startsWith("http")&&(t=(0,n3.join)(e,t)),t=(0,Vg.default)(t)}t=encodeURI(t);for(let e of i3)t=t.replace(e[0],e[1]);return t}function u3(t,e){t=decodeURI(t);for(let n=0;n<gR.length;n+=2)t=t.replace(gR[n],gR[n+1]);let r=t.substr(0,7).toLowerCase()==="file://";return r&&(t=t[7]==="/"?t.substr(8):t.substr(7),(0,Bg.isWindows)()&&t[1]==="/"&&(t=t[0]+":"+t.substr(1)),e?t="file:///"+t:(r=!1,t=(0,Bg.isWindows)()?t:"/"+t)),(0,Bg.isWindows)()&&!r&&(t=t.replace(X4,"\\"),t.substr(1,2)===":\\"&&(t=t[0].toUpperCase()+t.substr(1))),t}function c3(t){return t.length<=1||t[0]!=="#"||t[1]!=="/"?[]:t.slice(2).split("/").map(e=>decodeURIComponent(e).replace(t3,"/").replace(r3,"~"))}function f3(t,e){if(!bR(t)||!bR(e))return _T(t,e);let r=yR.default.dirname(vR(t)),n=vR(e);return yR.default.relative(r,n)+xT(e)}});var Jn=V(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.InvalidPointerError=Jt.TimeoutError=Jt.MissingPointerError=Jt.UnmatchedResolverError=Jt.ResolverError=Jt.UnmatchedParserError=Jt.ParserError=Jt.JSONParserErrorGroup=Jt.JSONParserError=void 0;Jt.isHandledError=d3;Jt.normalizeError=p3;var ET=Ao(),Wg=zn(),vi=class extends Error{constructor(e,r){super(),this.code="EUNKNOWN",this.name="JSONParserError",this.message=e,this.source=r,this.path=null,ET.Ono.extend(this)}get footprint(){return`${this.path}+${this.source}+${this.code}+${this.message}`}};Jt.JSONParserError=vi;var zg=class t extends Error{constructor(e){super(),this.files=e,this.name="JSONParserErrorGroup",this.message=`${this.errors.length} error${this.errors.length>1?"s":""} occurred while reading '${(0,Wg.toFileSystemPath)(e.$refs._root$Ref.path)}'`,ET.Ono.extend(this)}static getParserErrors(e){let r=[];for(let n of Object.values(e.$refs._$refs))n.errors&&r.push(...n.errors);return r}get errors(){return t.getParserErrors(this.files)}};Jt.JSONParserErrorGroup=zg;var wR=class extends vi{constructor(e,r){super(`Error parsing ${r}: ${e}`,r),this.code="EPARSER",this.name="ParserError"}};Jt.ParserError=wR;var _R=class extends vi{constructor(e){super(`Could not find parser for "${e}"`,e),this.code="EUNMATCHEDPARSER",this.name="UnmatchedParserError"}};Jt.UnmatchedParserError=_R;var RR=class extends vi{constructor(e,r){super(e.message||`Error reading file "${r}"`,r),this.code="ERESOLVER",this.name="ResolverError","code"in e&&(this.ioErrorCode=String(e.code))}};Jt.ResolverError=RR;var CR=class extends vi{constructor(e){super(`Could not find resolver for "${e}"`,e),this.code="EUNMATCHEDRESOLVER",this.name="UnmatchedResolverError"}};Jt.UnmatchedResolverError=CR;var xR=class extends vi{constructor(e,r,n,i,s){super(`Missing $ref pointer "${(0,Wg.getHash)(r)}". Token "${e}" does not exist.`,(0,Wg.stripHash)(r)),this.code="EMISSINGPOINTER",this.name="MissingPointerError",this.targetToken=e,this.targetRef=n,this.targetFound=i,this.parentPath=s}};Jt.MissingPointerError=xR;var ER=class extends vi{constructor(e){super(`Dereferencing timeout reached: ${e}ms`),this.code="ETIMEOUT",this.name="TimeoutError"}};Jt.TimeoutError=ER;var qR=class extends vi{constructor(e,r){super(`Invalid $ref pointer "${e}". Pointers must begin with "#/"`,(0,Wg.stripHash)(r)),this.code="EUNMATCHEDRESOLVER",this.name="InvalidPointerError"}};Jt.InvalidPointerError=qR;function d3(t){return t instanceof vi||t instanceof zg}function p3(t){return t.path===null&&(t.path=[]),t}});var Ld=V(an=>{"use strict";var h3=an&&an.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),m3=an&&an.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),g3=an&&an.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&h3(r,e,n[i]);return m3(r,e),r}})(),y3=an&&an.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(an,"__esModule",{value:!0});an.nullSymbol=void 0;var OR=y3(Vu()),IR=g3(zn()),Gg=Jn();an.nullSymbol=Symbol("null");var v3=/\//g,b3=/~/g,S3=/~1/g,w3=/~0/g,_3=t=>{try{return decodeURIComponent(t)}catch{return t}},Yg=class t{constructor(e,r,n){this.$ref=e,this.path=r,this.originalPath=n||r,this.value=void 0,this.circular=!1,this.indirections=0}resolve(e,r,n){let i=t.parse(this.path,this.originalPath),s=[];this.value=OT(e);for(let o=0;o<i.length;o++){if(Jg(this,r,n)&&(this.path=t.join(this.path,i.slice(o))),typeof this.value=="object"&&this.value!==null&&!IT(n)&&"$ref"in this.value)return this;let l=i[o];if(this.value[l]===void 0||this.value[l]===null&&o===i.length-1){let c=!1;for(let b=i.length-1;b>o;b--){let q=i.slice(o,b+1).join("/");if(this.value[q]!==void 0){this.value=this.value[q],o=b,c=!0;break}}if(c)continue;if(l in this.value&&this.value[l]===null){this.value=an.nullSymbol;continue}this.value=null;let d=this.$ref.path||"",p=this.path.replace(d,""),m=t.join("",s),y=n?.replace(d,"");throw new Gg.MissingPointerError(l,decodeURI(this.originalPath),p,m,y)}else this.value=this.value[l];s.push(l)}return(!this.value||this.value.$ref&&IR.resolve(this.path,this.value.$ref)!==n)&&Jg(this,r,n),this}set(e,r,n){let i=t.parse(this.path),s;if(i.length===0)return this.value=r,r;this.value=OT(e);for(let o=0;o<i.length-1;o++)Jg(this,n),s=i[o],this.value&&this.value[s]!==void 0?this.value=this.value[s]:this.value=qT(this,s,{});return Jg(this,n),s=i[i.length-1],qT(this,s,r),e}static parse(e,r){let n=IR.getHash(e).substring(1);if(!n)return[];let i=n.split("/");for(let s=0;s<i.length;s++)i[s]=_3(i[s].replace(S3,"/").replace(w3,"~"));if(i[0]!=="")throw new Gg.InvalidPointerError(n,r===void 0?e:r);return i.slice(1)}static join(e,r){e.indexOf("#")===-1&&(e+="#"),r=Array.isArray(r)?r:[r];for(let n=0;n<r.length;n++){let i=r[n];e+="/"+encodeURIComponent(i.replace(b3,"~0").replace(v3,"~1"))}return e}};function Jg(t,e,r){if(OR.default.isAllowed$Ref(t.value,e)){let n=IR.resolve(t.path,t.value.$ref);if(n===t.path&&!IT(r))t.circular=!0;else{let i=t.$ref.$refs._resolve(n,t.path,e);return i===null?!1:(t.indirections+=i.indirections+1,OR.default.isExtended$Ref(t.value)?(t.value=OR.default.dereference(t.value,i.value),!1):(t.$ref=i.$ref,t.path=i.path,t.value=i.value,!0))}}}an.default=Yg;function qT(t,e,r){if(t.value&&typeof t.value=="object")e==="-"&&Array.isArray(t.value)?t.value.push(r):t.value[e]=r;else throw new Gg.JSONParserError(`Error assigning $ref pointer "${t.path}".
|
|
242
242
|
Cannot set "${e}" of a non-object.`);return r}function OT(t){if((0,Gg.isHandledError)(t))throw t;return t}function IT(t){return typeof t=="string"&&Yg.parse(t).length==0}});var Vu=V(qs=>{"use strict";var R3=qs&&qs.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),C3=qs&&qs.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),x3=qs&&qs.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&R3(r,e,n[i]);return C3(r,e),r}})();Object.defineProperty(qs,"__esModule",{value:!0});var Kg=x3(Ld()),Qg=Jn(),PR=zn(),kR=class t{constructor(e){this.errors=[],this.$refs=e}addError(e){this.errors===void 0&&(this.errors=[]);let r=this.errors.map(({footprint:n})=>n);"errors"in e&&Array.isArray(e.errors)?this.errors.push(...e.errors.map(Qg.normalizeError).filter(({footprint:n})=>!r.includes(n))):(!("footprint"in e)||!r.includes(e.footprint))&&this.errors.push((0,Qg.normalizeError)(e))}exists(e,r){try{return this.resolve(e,r),!0}catch{return!1}}get(e,r){return this.resolve(e,r)?.value}resolve(e,r,n,i){let s=new Kg.default(this,e,n);try{let o=s.resolve(this.value,r,i);return o.value===Kg.nullSymbol&&(o.value=null),o}catch(o){if(!r||!r.continueOnError||!(0,Qg.isHandledError)(o))throw o;return o.path===null&&(o.path=(0,PR.safePointerToPath)((0,PR.getHash)(i))),o instanceof Qg.InvalidPointerError&&(o.source=decodeURI((0,PR.stripHash)(i))),this.addError(o),null}}set(e,r){let n=new Kg.default(this,e);this.value=n.set(this.value,r),this.value===Kg.nullSymbol&&(this.value=null)}static is$Ref(e){return!!e&&typeof e=="object"&&e!==null&&"$ref"in e&&typeof e.$ref=="string"&&e.$ref.length>0}static isExternal$Ref(e){return t.is$Ref(e)&&e.$ref[0]!=="#"}static isAllowed$Ref(e,r){if(this.is$Ref(e)){if(e.$ref.substring(0,2)==="#/"||e.$ref==="#")return!0;if(e.$ref[0]!=="#"&&(!r||r.resolve?.external))return!0}}static isExtended$Ref(e){return t.is$Ref(e)&&Object.keys(e).length>1}static dereference(e,r){if(r&&typeof r=="object"&&t.isExtended$Ref(e)){let n={};for(let i of Object.keys(e))i!=="$ref"&&(n[i]=e[i]);for(let i of Object.keys(r))i in n||(n[i]=r[i]);return n}else return r}};qs.default=kR});var $T=V(bi=>{"use strict";var E3=bi&&bi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),q3=bi&&bi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),O3=bi&&bi.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&E3(r,e,n[i]);return q3(r,e),r}})(),TT=bi&&bi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(bi,"__esModule",{value:!0});var PT=Ao(),I3=TT(Vu()),To=O3(zn()),kT=TT(mR()),AR=class{paths(...e){return AT(this._$refs,e.flat()).map(n=>(0,kT.default)(n.decoded))}values(...e){let r=this._$refs;return AT(r,e.flat()).reduce((i,s)=>(i[(0,kT.default)(s.decoded)]=r[s.encoded].value,i),{})}exists(e,r){try{return this._resolve(e,"",r),!0}catch{return!1}}get(e,r){return this._resolve(e,"",r).value}set(e,r){let n=To.resolve(this._root$Ref.path,e),i=To.stripHash(n),s=this._$refs[i];if(!s)throw(0,PT.ono)(`Error resolving $ref pointer "${e}".
|
|
243
243
|
"${i}" not found.`);s.set(n,r)}_get$Ref(e){e=To.resolve(this._root$Ref.path,e);let r=To.stripHash(e);return this._$refs[r]}_add(e){let r=To.stripHash(e),n=new I3.default(this);return n.path=r,this._$refs[r]=n,this._root$Ref=this._root$Ref||n,n}_resolve(e,r,n){let i=To.resolve(this._root$Ref.path,e),s=To.stripHash(i),o=this._$refs[s];if(!o)throw(0,PT.ono)(`Error resolving $ref pointer "${e}".
|
|
244
|
-
"${s}" not found.`);return o.resolve(i,n,e,r)}constructor(){this._$refs={},this.toJSON=this.values,this.circular=!1,this._$refs={},this._root$Ref=null}};bi.default=AR;function AT(t,e){let r=Object.keys(t);return e=Array.isArray(e[0])?e[0]:Array.prototype.slice.call(e),e.length>0&&e[0]&&(r=r.filter(n=>e.includes(t[n].pathType))),r.map(n=>({encoded:n,decoded:t[n].pathType==="file"?To.toFileSystemPath(n,!0):n}))}});var MT=V(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.all=P3;Wu.filter=k3;Wu.sort=A3;Wu.run=T3;function P3(t){return Object.keys(t||{}).filter(e=>typeof t[e]=="object").map(e=>(t[e].name=e,t[e]))}function k3(t,e,r){return t.filter(n=>!!NT(n,e,r))}function A3(t){for(let e of t)e.order=e.order||Number.MAX_SAFE_INTEGER;return t.sort((e,r)=>e.order-r.order)}async function T3(t,e,r,n){let i,s,o=0;return new Promise((l,c)=>{d();function d(){if(i=t[o++],!i)return c(s);try{let b=NT(i,e,r,p,n);if(b&&typeof b.then=="function")b.then(m,y);else if(b!==void 0)m(b);else if(o===t.length)throw new Error("No promise has been returned or callback has been called.")}catch(b){y(b)}}function p(b,
|
|
244
|
+
"${s}" not found.`);return o.resolve(i,n,e,r)}constructor(){this._$refs={},this.toJSON=this.values,this.circular=!1,this._$refs={},this._root$Ref=null}};bi.default=AR;function AT(t,e){let r=Object.keys(t);return e=Array.isArray(e[0])?e[0]:Array.prototype.slice.call(e),e.length>0&&e[0]&&(r=r.filter(n=>e.includes(t[n].pathType))),r.map(n=>({encoded:n,decoded:t[n].pathType==="file"?To.toFileSystemPath(n,!0):n}))}});var MT=V(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.all=P3;Wu.filter=k3;Wu.sort=A3;Wu.run=T3;function P3(t){return Object.keys(t||{}).filter(e=>typeof t[e]=="object").map(e=>(t[e].name=e,t[e]))}function k3(t,e,r){return t.filter(n=>!!NT(n,e,r))}function A3(t){for(let e of t)e.order=e.order||Number.MAX_SAFE_INTEGER;return t.sort((e,r)=>e.order-r.order)}async function T3(t,e,r,n){let i,s,o=0;return new Promise((l,c)=>{d();function d(){if(i=t[o++],!i)return c(s);try{let b=NT(i,e,r,p,n);if(b&&typeof b.then=="function")b.then(m,y);else if(b!==void 0)m(b);else if(o===t.length)throw new Error("No promise has been returned or callback has been called.")}catch(b){y(b)}}function p(b,q){b?y(b):m(q)}function m(b){l({plugin:i,result:b})}function y(b){s={plugin:i,error:b},d()}})}function NT(t,e,r,n,i){let s=t[e];if(typeof s=="function")return s.apply(t,[r,n,i]);if(!n){if(s instanceof RegExp)return s.test(r.url);if(typeof s=="string")return s===r.extension;if(Array.isArray(s))return s.indexOf(r.extension)!==-1}return s}});var $R=V(Os=>{"use strict";var $3=Os&&Os.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),N3=Os&&Os.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),FT=Os&&Os.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&$3(r,e,n[i]);return N3(r,e),r}})();Object.defineProperty(Os,"__esModule",{value:!0});var TR=Ao(),M3=FT(zn()),$o=FT(MT()),Ya=Jn();async function F3(t,e,r){let n=t.indexOf("#"),i="";n>=0&&(i=t.substring(n),t=t.substring(0,n));let s=e._add(t),o={url:t,hash:i,extension:M3.getExtension(t)};try{let l=await D3(o,r,e);s.pathType=l.plugin.name,o.data=l.result;let c=await j3(o,r,e);return s.value=c.result,c.result}catch(l){throw(0,Ya.isHandledError)(l)&&(s.value=l),l}}async function D3(t,e,r){let n=$o.all(e.resolve);n=$o.filter(n,"canRead",t),$o.sort(n);try{return await $o.run(n,"read",t,r)}catch(i){throw!i&&e.continueOnError?new Ya.UnmatchedResolverError(t.url):!i||!("error"in i)?TR.ono.syntax(`Unable to resolve $ref pointer "${t.url}"`):i.error instanceof Ya.ResolverError?i.error:new Ya.ResolverError(i,t.url)}}async function j3(t,e,r){let n=$o.all(e.parse),i=$o.filter(n,"canParse",t),s=i.length>0?i:n;$o.sort(s);try{let o=await $o.run(s,"parse",t,r);if(!o.plugin.allowEmpty&&L3(o.result))throw TR.ono.syntax(`Error parsing "${t.url}" as ${o.plugin.name}.
|
|
245
245
|
Parsed value is empty`);return o}catch(o){throw!o&&e.continueOnError?new Ya.UnmatchedParserError(t.url):o&&o.message&&o.message.startsWith("Error parsing")?o:!o||!("error"in o)?TR.ono.syntax(`Unable to parse ${t.url}`):o.error instanceof Ya.ParserError?o.error:new Ya.ParserError(o.error.message,t.url)}}function L3(t){return t===void 0||typeof t=="object"&&Object.keys(t).length===0||typeof t=="string"&&t.trim().length===0||Buffer.isBuffer(t)&&t.length===0}Os.default=F3});var jT=V(NR=>{"use strict";Object.defineProperty(NR,"__esModule",{value:!0});var DT=Jn();NR.default={order:100,allowEmpty:!0,canParse:".json",allowBOM:!0,async parse(t){let e=t.data;if(Buffer.isBuffer(e)&&(e=e.toString()),typeof e=="string"){if(e.trim().length===0)return;try{return JSON.parse(e)}catch(r){if(this.allowBOM)try{let n=e.indexOf("{");return e=e.slice(n),JSON.parse(e)}catch(n){throw new DT.ParserError(n.message,t.url)}throw new DT.ParserError(r.message,t.url)}}else return e}}});var zu=V((yre,Ka)=>{"use strict";function LT(t){return typeof t>"u"||t===null}function U3(t){return typeof t=="object"&&t!==null}function H3(t){return Array.isArray(t)?t:LT(t)?[]:[t]}function B3(t,e){if(e){let r=Object.keys(e);for(let n=0,i=r.length;n<i;n+=1){let s=r[n];t[s]=e[s]}}return t}function V3(t,e){let r="";for(let n=0;n<e;n+=1)r+=t;return r}function W3(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}Ka.exports.isNothing=LT;Ka.exports.isObject=U3;Ka.exports.toArray=H3;Ka.exports.repeat=V3;Ka.exports.isNegativeZero=W3;Ka.exports.extend=B3});var Ju=V((vre,HT)=>{"use strict";function UT(t,e){let r="",n=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(r+='in "'+t.mark.name+'" '),r+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!e&&t.mark.snippet&&(r+=`
|
|
246
246
|
|
|
247
247
|
`+t.mark.snippet),n+" "+r):n}function Ud(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=UT(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Ud.prototype=Object.create(Error.prototype);Ud.prototype.constructor=Ud;Ud.prototype.toString=function(e){return this.name+": "+UT(this,e)};HT.exports=Ud});var VT=V((bre,BT)=>{"use strict";var Hd=zu();function MR(t,e,r,n,i){let s="",o="",l=Math.floor(i/2)-1;return n-e>l&&(s=" ... ",e=n-l+s.length),r-n>l&&(o=" ...",r=n+l-o.length),{str:s+t.slice(e,r).replace(/\t/g,"\u2192")+o,pos:n-e+s.length}}function FR(t,e){return Hd.repeat(" ",e-t.length)+t}function z3(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),typeof e.indent!="number"&&(e.indent=1),typeof e.linesBefore!="number"&&(e.linesBefore=3),typeof e.linesAfter!="number"&&(e.linesAfter=2);let r=/\r?\n|\r|\0/g,n=[0],i=[],s,o=-1;for(;s=r.exec(t.buffer);)i.push(s.index),n.push(s.index+s[0].length),t.position<=s.index&&o<0&&(o=n.length-2);o<0&&(o=n.length-1);let l="",c=Math.min(t.line+e.linesAfter,i.length).toString().length,d=e.maxLength-(e.indent+c+3);for(let m=1;m<=e.linesBefore&&!(o-m<0);m++){let y=MR(t.buffer,n[o-m],i[o-m],t.position-(n[o]-n[o-m]),d);l=Hd.repeat(" ",e.indent)+FR((t.line-m+1).toString(),c)+" | "+y.str+`
|
|
@@ -251,17 +251,17 @@ Parsed value is empty`);return o}catch(o){throw!o&&e.continueOnError?new Ya.Unma
|
|
|
251
251
|
`}return l.replace(/\n$/,"")}BT.exports=z3});var qr=V((Sre,zT)=>{"use strict";var WT=Ju(),J3=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],G3=["scalar","sequence","mapping"];function Y3(t){let e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(n){e[String(n)]=r})}),e}function K3(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(J3.indexOf(r)===-1)throw new WT('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')}),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(r){return r},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=Y3(e.styleAliases||null),G3.indexOf(this.kind)===-1)throw new WT('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}zT.exports=K3});var LR=V((wre,GT)=>{"use strict";var Bd=Ju(),DR=qr();function JT(t,e){let r=[];return t[e].forEach(function(n){let i=r.length;r.forEach(function(s,o){s.tag===n.tag&&s.kind===n.kind&&s.multi===n.multi&&(i=o)}),r[i]=n}),r}function Q3(){let t={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function e(r){r.multi?(t.multi[r.kind].push(r),t.multi.fallback.push(r)):t[r.kind][r.tag]=t.fallback[r.tag]=r}for(let r=0,n=arguments.length;r<n;r+=1)arguments[r].forEach(e);return t}function jR(t){return this.extend(t)}jR.prototype.extend=function(e){let r=[],n=[];if(e instanceof DR)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(r=r.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new Bd("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(s){if(!(s instanceof DR))throw new Bd("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new Bd("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new Bd("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(s){if(!(s instanceof DR))throw new Bd("Specified list of YAML types (or a single Type object) contains a non-Type object.")});let i=Object.create(jR.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=JT(i,"implicit"),i.compiledExplicit=JT(i,"explicit"),i.compiledTypeMap=Q3(i.compiledImplicit,i.compiledExplicit),i};GT.exports=jR});var UR=V((_re,YT)=>{"use strict";var Z3=qr();YT.exports=new Z3("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return t!==null?t:""}})});var HR=V((Rre,KT)=>{"use strict";var X3=qr();KT.exports=new X3("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return t!==null?t:[]}})});var BR=V((Cre,QT)=>{"use strict";var e6=qr();QT.exports=new e6("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return t!==null?t:{}}})});var VR=V((xre,ZT)=>{"use strict";var t6=LR();ZT.exports=new t6({explicit:[UR(),HR(),BR()]})});var WR=V((Ere,XT)=>{"use strict";var r6=qr();function n6(t){if(t===null)return!0;let e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}function i6(){return null}function s6(t){return t===null}XT.exports=new r6("tag:yaml.org,2002:null",{kind:"scalar",resolve:n6,construct:i6,predicate:s6,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"})});var zR=V((qre,e$)=>{"use strict";var o6=qr();function a6(t){if(t===null)return!1;let e=t.length;return e===4&&(t==="true"||t==="True"||t==="TRUE")||e===5&&(t==="false"||t==="False"||t==="FALSE")}function l6(t){return t==="true"||t==="True"||t==="TRUE"}function u6(t){return Object.prototype.toString.call(t)==="[object Boolean]"}e$.exports=new o6("tag:yaml.org,2002:bool",{kind:"scalar",resolve:a6,construct:l6,predicate:u6,represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"})});var JR=V((Ore,t$)=>{"use strict";var c6=zu(),f6=qr();function d6(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function p6(t){return t>=48&&t<=55}function h6(t){return t>=48&&t<=57}function m6(t){if(t===null)return!1;let e=t.length,r=0,n=!1;if(!e)return!1;let i=t[r];if((i==="-"||i==="+")&&(i=t[++r]),i==="0"){if(r+1===e)return!0;if(i=t[++r],i==="b"){for(r++;r<e;r++){if(i=t[r],i!=="0"&&i!=="1")return!1;n=!0}return n&&Number.isFinite(Vd(t))}if(i==="x"){for(r++;r<e;r++){if(!d6(t.charCodeAt(r)))return!1;n=!0}return n&&Number.isFinite(Vd(t))}if(i==="o"){for(r++;r<e;r++){if(!p6(t.charCodeAt(r)))return!1;n=!0}return n&&Number.isFinite(Vd(t))}}for(;r<e;r++){if(!h6(t.charCodeAt(r)))return!1;n=!0}return n?Number.isFinite(Vd(t)):!1}function Vd(t){let e=t,r=1,n=e[0];if((n==="-"||n==="+")&&(n==="-"&&(r=-1),e=e.slice(1),n=e[0]),e==="0")return 0;if(n==="0"){if(e[1]==="b")return r*parseInt(e.slice(2),2);if(e[1]==="x")return r*parseInt(e.slice(2),16);if(e[1]==="o")return r*parseInt(e.slice(2),8)}return r*parseInt(e,10)}function g6(t){return Vd(t)}function y6(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!c6.isNegativeZero(t)}t$.exports=new f6("tag:yaml.org,2002:int",{kind:"scalar",resolve:m6,construct:g6,predicate:y6,represent:{binary:function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var GR=V((Ire,n$)=>{"use strict";var r$=zu(),v6=qr(),b6=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),S6=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function w6(t){return t===null||!b6.test(t)?!1:Number.isFinite(parseFloat(t,10))?!0:S6.test(t)}function _6(t){let e=t.toLowerCase(),r=e[0]==="-"?-1:1;return"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:r*parseFloat(e,10)}var R6=/^[-+]?[0-9]+e/;function C6(t,e){if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r$.isNegativeZero(t))return"-0.0";let r=t.toString(10);return R6.test(r)?r.replace("e",".e"):r}function x6(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||r$.isNegativeZero(t))}n$.exports=new v6("tag:yaml.org,2002:float",{kind:"scalar",resolve:w6,construct:_6,predicate:x6,represent:C6,defaultStyle:"lowercase"})});var YR=V((Pre,i$)=>{"use strict";i$.exports=VR().extend({implicit:[WR(),zR(),JR(),GR()]})});var KR=V((kre,s$)=>{"use strict";s$.exports=YR()});var QR=V((Are,l$)=>{"use strict";var E6=qr(),o$=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),a$=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function q6(t){return t===null?!1:o$.exec(t)!==null||a$.exec(t)!==null}function O6(t){let e=0,r=null,n=o$.exec(t);if(n===null&&(n=a$.exec(t)),n===null)throw new Error("Date resolve error");let i=+n[1],s=+n[2]-1,o=+n[3];if(!n[4])return new Date(Date.UTC(i,s,o));let l=+n[4],c=+n[5],d=+n[6];if(n[7]){for(e=n[7].slice(0,3);e.length<3;)e+="0";e=+e}if(n[9]){let m=+n[10],y=+(n[11]||0);r=(m*60+y)*6e4,n[9]==="-"&&(r=-r)}let p=new Date(Date.UTC(i,s,o,l,c,d,e));return r&&p.setTime(p.getTime()-r),p}function I6(t){return t.toISOString()}l$.exports=new E6("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:q6,construct:O6,instanceOf:Date,represent:I6})});var ZR=V((Tre,u$)=>{"use strict";var P6=qr();function k6(t){return t==="<<"||t===null}u$.exports=new P6("tag:yaml.org,2002:merge",{kind:"scalar",resolve:k6})});var eC=V(($re,c$)=>{"use strict";var A6=qr(),XR=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
252
252
|
\r`;function T6(t){if(t===null)return!1;let e=0,r=t.length,n=XR;for(let i=0;i<r;i++){let s=n.indexOf(t.charAt(i));if(!(s>64)){if(s<0)return!1;e+=6}}return e%8===0}function $6(t){let e=t.replace(/[\r\n=]/g,""),r=e.length,n=XR,i=0,s=[];for(let l=0;l<r;l++)l%4===0&&l&&(s.push(i>>16&255),s.push(i>>8&255),s.push(i&255)),i=i<<6|n.indexOf(e.charAt(l));let o=r%4*6;return o===0?(s.push(i>>16&255),s.push(i>>8&255),s.push(i&255)):o===18?(s.push(i>>10&255),s.push(i>>2&255)):o===12&&s.push(i>>4&255),new Uint8Array(s)}function N6(t){let e="",r=0,n=t.length,i=XR;for(let o=0;o<n;o++)o%3===0&&o&&(e+=i[r>>18&63],e+=i[r>>12&63],e+=i[r>>6&63],e+=i[r&63]),r=(r<<8)+t[o];let s=n%3;return s===0?(e+=i[r>>18&63],e+=i[r>>12&63],e+=i[r>>6&63],e+=i[r&63]):s===2?(e+=i[r>>10&63],e+=i[r>>4&63],e+=i[r<<2&63],e+=i[64]):s===1&&(e+=i[r>>2&63],e+=i[r<<4&63],e+=i[64],e+=i[64]),e}function M6(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}c$.exports=new A6("tag:yaml.org,2002:binary",{kind:"scalar",resolve:T6,construct:$6,predicate:M6,represent:N6})});var tC=V((Nre,f$)=>{"use strict";var F6=qr(),D6=Object.prototype.hasOwnProperty,j6=Object.prototype.toString;function L6(t){if(t===null)return!0;let e=[],r=t;for(let n=0,i=r.length;n<i;n+=1){let s=r[n],o=!1;if(j6.call(s)!=="[object Object]")return!1;let l;for(l in s)if(D6.call(s,l))if(!o)o=!0;else return!1;if(!o)return!1;if(e.indexOf(l)===-1)e.push(l);else return!1}return!0}function U6(t){return t!==null?t:[]}f$.exports=new F6("tag:yaml.org,2002:omap",{kind:"sequence",resolve:L6,construct:U6})});var rC=V((Mre,d$)=>{"use strict";var H6=qr(),B6=Object.prototype.toString;function V6(t){if(t===null)return!0;let e=t,r=new Array(e.length);for(let n=0,i=e.length;n<i;n+=1){let s=e[n];if(B6.call(s)!=="[object Object]")return!1;let o=Object.keys(s);if(o.length!==1)return!1;r[n]=[o[0],s[o[0]]]}return!0}function W6(t){if(t===null)return[];let e=t,r=new Array(e.length);for(let n=0,i=e.length;n<i;n+=1){let s=e[n],o=Object.keys(s);r[n]=[o[0],s[o[0]]]}return r}d$.exports=new H6("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:V6,construct:W6})});var nC=V((Fre,p$)=>{"use strict";var z6=qr(),J6=Object.prototype.hasOwnProperty;function G6(t){if(t===null)return!0;let e=t;for(let r in e)if(J6.call(e,r)&&e[r]!==null)return!1;return!0}function Y6(t){return t!==null?t:{}}p$.exports=new z6("tag:yaml.org,2002:set",{kind:"mapping",resolve:G6,construct:Y6})});var Zg=V((Dre,h$)=>{"use strict";h$.exports=KR().extend({implicit:[QR(),ZR()],explicit:[eC(),tC(),rC(),nC()]})});var $$=V((jre,aC)=>{"use strict";var Qa=zu(),_$=Ju(),K6=VT(),Q6=Zg(),Si=Object.prototype.hasOwnProperty,Xg=1,R$=2,C$=3,ey=4,iC=1,Z6=2,m$=3,X6=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,e9=/[\x85\u2028\u2029]/,t9=/[,\[\]{}]/,x$=/^(?:!|!!|![0-9A-Za-z-]+!)$/,E$=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function g$(t){return Object.prototype.toString.call(t)}function Ki(t){return t===10||t===13}function Is(t){return t===9||t===32}function ln(t){return t===9||t===32||t===10||t===13}function Gu(t){return t===44||t===91||t===93||t===123||t===125}function r9(t){if(t>=48&&t<=57)return t-48;let e=t|32;return e>=97&&e<=102?e-97+10:-1}function n9(t){return t===120?2:t===117?4:t===85?8:0}function i9(t){return t>=48&&t<=57?t-48:-1}function y$(t){switch(t){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
|
|
253
253
|
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function s9(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}function q$(t,e,r){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[e]=r}var O$=new Array(256),I$=new Array(256);for(let t=0;t<256;t++)O$[t]=y$(t)?1:0,I$[t]=y$(t);function o9(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||Q6,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:100,this.maxMergeSeqLength=typeof e.maxMergeSeqLength=="number"?e.maxMergeSeqLength:20,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function P$(t,e){let r={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return r.snippet=K6(r),new _$(e,r)}function Se(t,e){throw P$(t,e)}function ty(t,e){t.onWarning&&t.onWarning.call(null,P$(t,e))}function Za(t,e,r){let n=t.anchorMapTransactions;if(n.length!==0){let i=n[n.length-1];Si.call(i,e)||(i[e]={existed:Si.call(t.anchorMap,e),value:t.anchorMap[e]})}t.anchorMap[e]=r}function a9(t){t.anchorMapTransactions.push(Object.create(null))}function l9(t){let e=t.anchorMapTransactions.pop(),r=t.anchorMapTransactions;if(r.length===0)return;let n=r[r.length-1],i=Object.keys(e);for(let s=0,o=i.length;s<o;s+=1){let l=i[s];Si.call(n,l)||(n[l]=e[l])}}function u9(t){let e=t.anchorMapTransactions.pop(),r=Object.keys(e);for(let n=r.length-1;n>=0;n-=1){let i=e[r[n]];i.existed?t.anchorMap[r[n]]=i.value:delete t.anchorMap[r[n]]}}function k$(t){return{position:t.position,line:t.line,lineStart:t.lineStart,lineIndent:t.lineIndent,firstTabInLine:t.firstTabInLine,tag:t.tag,anchor:t.anchor,kind:t.kind,result:t.result}}function v$(t,e){t.position=e.position,t.line=e.line,t.lineStart=e.lineStart,t.lineIndent=e.lineIndent,t.firstTabInLine=e.firstTabInLine,t.tag=e.tag,t.anchor=e.anchor,t.kind=e.kind,t.result=e.result}var b$={YAML:function(e,r,n){e.version!==null&&Se(e,"duplication of %YAML directive"),n.length!==1&&Se(e,"YAML directive accepts exactly one argument");let i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]);i===null&&Se(e,"ill-formed argument of the YAML directive");let s=parseInt(i[1],10),o=parseInt(i[2],10);s!==1&&Se(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&ty(e,"unsupported YAML version of the document")},TAG:function(e,r,n){let i;n.length!==2&&Se(e,"TAG directive accepts exactly two arguments");let s=n[0];i=n[1],x$.test(s)||Se(e,"ill-formed tag handle (first argument) of the TAG directive"),Si.call(e.tagMap,s)&&Se(e,'there is a previously declared suffix for "'+s+'" tag handle'),E$.test(i)||Se(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch{Se(e,"tag prefix is malformed: "+i)}e.tagMap[s]=i}};function No(t,e,r,n){if(e<r){let i=t.input.slice(e,r);if(n)for(let s=0,o=i.length;s<o;s+=1){let l=i.charCodeAt(s);l===9||l>=32&&l<=1114111||Se(t,"expected valid JSON character")}else X6.test(i)&&Se(t,"the stream contains non-printable characters");t.result+=i}}function S$(t,e,r,n){Qa.isObject(r)||Se(t,"cannot merge mappings; the provided source object is unacceptable");let i=Object.keys(r);for(let s=0,o=i.length;s<o;s+=1){let l=i[s];Si.call(e,l)||(q$(e,l,r[l]),n[l]=!0)}}function Yu(t,e,r,n,i,s,o,l,c){if(Array.isArray(i)){i=Array.prototype.slice.call(i);for(let d=0,p=i.length;d<p;d+=1)Array.isArray(i[d])&&Se(t,"nested arrays are not supported inside keys"),typeof i=="object"&&g$(i[d])==="[object Object]"&&(i[d]="[object Object]")}if(typeof i=="object"&&g$(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(s)){s.length>t.maxMergeSeqLength&&Se(t,"merge sequence length exceeded maxMergeSeqLength ("+t.maxMergeSeqLength+")");let d=new Set;for(let p=0,m=s.length;p<m;p+=1){let y=s[p];d.has(y)||(d.add(y),S$(t,e,y,r))}}else S$(t,e,s,r);else!t.json&&!Si.call(r,i)&&Si.call(e,i)&&(t.line=o||t.line,t.lineStart=l||t.lineStart,t.position=c||t.position,Se(t,"duplicated mapping key")),q$(e,i,s),delete r[i];return e}function sC(t){let e=t.input.charCodeAt(t.position);e===10?t.position++:e===13?(t.position++,t.input.charCodeAt(t.position)===10&&t.position++):Se(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}function rr(t,e,r){let n=0,i=t.input.charCodeAt(t.position);for(;i!==0;){for(;Is(i);)i===9&&t.firstTabInLine===-1&&(t.firstTabInLine=t.position),i=t.input.charCodeAt(++t.position);if(e&&i===35)do i=t.input.charCodeAt(++t.position);while(i!==10&&i!==13&&i!==0);if(Ki(i))for(sC(t),i=t.input.charCodeAt(t.position),n++,t.lineIndent=0;i===32;)t.lineIndent++,i=t.input.charCodeAt(++t.position);else break}return r!==-1&&n!==0&&t.lineIndent<r&&ty(t,"deficient indentation"),n}function ry(t){let e=t.position,r=t.input.charCodeAt(e);return!!((r===45||r===46)&&r===t.input.charCodeAt(e+1)&&r===t.input.charCodeAt(e+2)&&(e+=3,r=t.input.charCodeAt(e),r===0||ln(r)))}function oC(t,e){e===1?t.result+=" ":e>1&&(t.result+=Qa.repeat(`
|
|
254
|
-
`,e-1))}function c9(t,e,r){let n,i,s,o,l,c,d=t.kind,p=t.result,m=t.input.charCodeAt(t.position);if(ln(m)||Gu(m)||m===35||m===38||m===42||m===33||m===124||m===62||m===39||m===34||m===37||m===64||m===96)return!1;if(m===63||m===45){let y=t.input.charCodeAt(t.position+1);if(ln(y)||r&&Gu(y))return!1}for(t.kind="scalar",t.result="",n=i=t.position,s=!1;m!==0;){if(m===58){let y=t.input.charCodeAt(t.position+1);if(ln(y)||r&&Gu(y))break}else if(m===35){let y=t.input.charCodeAt(t.position-1);if(ln(y))break}else{if(t.position===t.lineStart&&ry(t)||r&&Gu(m))break;if(Ki(m))if(o=t.line,l=t.lineStart,c=t.lineIndent,rr(t,!1,-1),t.lineIndent>=e){s=!0,m=t.input.charCodeAt(t.position);continue}else{t.position=i,t.line=o,t.lineStart=l,t.lineIndent=c;break}}s&&(No(t,n,i,!1),oC(t,t.line-o),n=i=t.position,s=!1),Is(m)||(i=t.position+1),m=t.input.charCodeAt(++t.position)}return No(t,n,i,!1),t.result?!0:(t.kind=d,t.result=p,!1)}function f9(t,e){let r,n,i=t.input.charCodeAt(t.position);if(i!==39)return!1;for(t.kind="scalar",t.result="",t.position++,r=n=t.position;(i=t.input.charCodeAt(t.position))!==0;)if(i===39)if(No(t,r,t.position,!0),i=t.input.charCodeAt(++t.position),i===39)r=t.position,t.position++,n=t.position;else return!0;else Ki(i)?(No(t,r,n,!0),oC(t,rr(t,!1,e)),r=n=t.position):t.position===t.lineStart&&ry(t)?Se(t,"unexpected end of the document within a single quoted scalar"):(t.position++,Is(i)||(n=t.position));Se(t,"unexpected end of the stream within a single quoted scalar")}function d9(t,e){let r,n,i,s=t.input.charCodeAt(t.position);if(s!==34)return!1;for(t.kind="scalar",t.result="",t.position++,r=n=t.position;(s=t.input.charCodeAt(t.position))!==0;){if(s===34)return No(t,r,t.position,!0),t.position++,!0;if(s===92){if(No(t,r,t.position,!0),s=t.input.charCodeAt(++t.position),Ki(s))rr(t,!1,e);else if(s<256&&O$[s])t.result+=I$[s],t.position++;else if((i=n9(s))>0){let o=i,l=0;for(;o>0;o--)s=t.input.charCodeAt(++t.position),(i=r9(s))>=0?l=(l<<4)+i:Se(t,"expected hexadecimal character");t.result+=s9(l),t.position++}else Se(t,"unknown escape sequence");r=n=t.position}else Ki(s)?(No(t,r,n,!0),oC(t,rr(t,!1,e)),r=n=t.position):t.position===t.lineStart&&ry(t)?Se(t,"unexpected end of the document within a double quoted scalar"):(t.position++,Is(s)||(n=t.position))}Se(t,"unexpected end of the stream within a double quoted scalar")}function p9(t,e){let r=!0,n,i,s,o=t.tag,l,c=t.anchor,d,p,m,y,b=Object.create(null),
|
|
254
|
+
`,e-1))}function c9(t,e,r){let n,i,s,o,l,c,d=t.kind,p=t.result,m=t.input.charCodeAt(t.position);if(ln(m)||Gu(m)||m===35||m===38||m===42||m===33||m===124||m===62||m===39||m===34||m===37||m===64||m===96)return!1;if(m===63||m===45){let y=t.input.charCodeAt(t.position+1);if(ln(y)||r&&Gu(y))return!1}for(t.kind="scalar",t.result="",n=i=t.position,s=!1;m!==0;){if(m===58){let y=t.input.charCodeAt(t.position+1);if(ln(y)||r&&Gu(y))break}else if(m===35){let y=t.input.charCodeAt(t.position-1);if(ln(y))break}else{if(t.position===t.lineStart&&ry(t)||r&&Gu(m))break;if(Ki(m))if(o=t.line,l=t.lineStart,c=t.lineIndent,rr(t,!1,-1),t.lineIndent>=e){s=!0,m=t.input.charCodeAt(t.position);continue}else{t.position=i,t.line=o,t.lineStart=l,t.lineIndent=c;break}}s&&(No(t,n,i,!1),oC(t,t.line-o),n=i=t.position,s=!1),Is(m)||(i=t.position+1),m=t.input.charCodeAt(++t.position)}return No(t,n,i,!1),t.result?!0:(t.kind=d,t.result=p,!1)}function f9(t,e){let r,n,i=t.input.charCodeAt(t.position);if(i!==39)return!1;for(t.kind="scalar",t.result="",t.position++,r=n=t.position;(i=t.input.charCodeAt(t.position))!==0;)if(i===39)if(No(t,r,t.position,!0),i=t.input.charCodeAt(++t.position),i===39)r=t.position,t.position++,n=t.position;else return!0;else Ki(i)?(No(t,r,n,!0),oC(t,rr(t,!1,e)),r=n=t.position):t.position===t.lineStart&&ry(t)?Se(t,"unexpected end of the document within a single quoted scalar"):(t.position++,Is(i)||(n=t.position));Se(t,"unexpected end of the stream within a single quoted scalar")}function d9(t,e){let r,n,i,s=t.input.charCodeAt(t.position);if(s!==34)return!1;for(t.kind="scalar",t.result="",t.position++,r=n=t.position;(s=t.input.charCodeAt(t.position))!==0;){if(s===34)return No(t,r,t.position,!0),t.position++,!0;if(s===92){if(No(t,r,t.position,!0),s=t.input.charCodeAt(++t.position),Ki(s))rr(t,!1,e);else if(s<256&&O$[s])t.result+=I$[s],t.position++;else if((i=n9(s))>0){let o=i,l=0;for(;o>0;o--)s=t.input.charCodeAt(++t.position),(i=r9(s))>=0?l=(l<<4)+i:Se(t,"expected hexadecimal character");t.result+=s9(l),t.position++}else Se(t,"unknown escape sequence");r=n=t.position}else Ki(s)?(No(t,r,n,!0),oC(t,rr(t,!1,e)),r=n=t.position):t.position===t.lineStart&&ry(t)?Se(t,"unexpected end of the document within a double quoted scalar"):(t.position++,Is(s)||(n=t.position))}Se(t,"unexpected end of the stream within a double quoted scalar")}function p9(t,e){let r=!0,n,i,s,o=t.tag,l,c=t.anchor,d,p,m,y,b=Object.create(null),q,C,v,_=t.input.charCodeAt(t.position);if(_===91)d=93,y=!1,l=[];else if(_===123)d=125,y=!0,l={};else return!1;for(t.anchor!==null&&Za(t,t.anchor,l),_=t.input.charCodeAt(++t.position);_!==0;){if(rr(t,!0,e),_=t.input.charCodeAt(t.position),_===d)return t.position++,t.tag=o,t.anchor=c,t.kind=y?"mapping":"sequence",t.result=l,!0;if(r?_===44&&Se(t,"expected the node content, but found ','"):Se(t,"missed comma between flow collection entries"),C=q=v=null,p=m=!1,_===63){let E=t.input.charCodeAt(t.position+1);ln(E)&&(p=m=!0,t.position++,rr(t,!0,e))}n=t.line,i=t.lineStart,s=t.position,Ku(t,e,Xg,!1,!0),C=t.tag,q=t.result,rr(t,!0,e),_=t.input.charCodeAt(t.position),(m||t.line===n)&&_===58&&(p=!0,_=t.input.charCodeAt(++t.position),rr(t,!0,e),Ku(t,e,Xg,!1,!0),v=t.result),y?Yu(t,l,b,C,q,v,n,i,s):p?l.push(Yu(t,null,b,C,q,v,n,i,s)):l.push(q),rr(t,!0,e),_=t.input.charCodeAt(t.position),_===44?(r=!0,_=t.input.charCodeAt(++t.position)):r=!1}Se(t,"unexpected end of the stream within a flow collection")}function h9(t,e){let r,n=iC,i=!1,s=!1,o=e,l=0,c=!1,d,p=t.input.charCodeAt(t.position);if(p===124)r=!1;else if(p===62)r=!0;else return!1;for(t.kind="scalar",t.result="";p!==0;)if(p=t.input.charCodeAt(++t.position),p===43||p===45)iC===n?n=p===43?m$:Z6:Se(t,"repeat of a chomping mode identifier");else if((d=i9(p))>=0)d===0?Se(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?Se(t,"repeat of an indentation width identifier"):(o=e+d-1,s=!0);else break;if(Is(p)){do p=t.input.charCodeAt(++t.position);while(Is(p));if(p===35)do p=t.input.charCodeAt(++t.position);while(!Ki(p)&&p!==0)}for(;p!==0;){for(sC(t),t.lineIndent=0,p=t.input.charCodeAt(t.position);(!s||t.lineIndent<o)&&p===32;)t.lineIndent++,p=t.input.charCodeAt(++t.position);if(!s&&t.lineIndent>o&&(o=t.lineIndent),Ki(p)){l++;continue}if(!s&&o===0&&Se(t,"missing indentation for block scalar"),t.lineIndent<o){n===m$?t.result+=Qa.repeat(`
|
|
255
255
|
`,i?1+l:l):n===iC&&i&&(t.result+=`
|
|
256
256
|
`);break}r?Is(p)?(c=!0,t.result+=Qa.repeat(`
|
|
257
257
|
`,i?1+l:l)):c?(c=!1,t.result+=Qa.repeat(`
|
|
258
258
|
`,l+1)):l===0?i&&(t.result+=" "):t.result+=Qa.repeat(`
|
|
259
259
|
`,l):t.result+=Qa.repeat(`
|
|
260
|
-
`,i?1+l:l),i=!0,s=!0,l=0;let m=t.position;for(;!Ki(p)&&p!==0;)p=t.input.charCodeAt(++t.position);No(t,m,t.position,!1)}return!0}function w$(t,e){let r=t.tag,n=t.anchor,i=[],s=!1;if(t.firstTabInLine!==-1)return!1;t.anchor!==null&&Za(t,t.anchor,i);let o=t.input.charCodeAt(t.position);for(;o!==0&&(t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,Se(t,"tab characters must not be used in indentation")),o===45);){let l=t.input.charCodeAt(t.position+1);if(!ln(l))break;if(s=!0,t.position++,rr(t,!0,-1)&&t.lineIndent<=e){i.push(null),o=t.input.charCodeAt(t.position);continue}let c=t.line;if(Ku(t,e,C$,!1,!0),i.push(t.result),rr(t,!0,-1),o=t.input.charCodeAt(t.position),(t.line===c||t.lineIndent>e)&&o!==0)Se(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return s?(t.tag=r,t.anchor=n,t.kind="sequence",t.result=i,!0):!1}function A$(t,e,r){let n,i,s,o,l=t.tag,c=t.anchor,d={},p=Object.create(null),m=null,y=null,b=null,
|
|
260
|
+
`,i?1+l:l),i=!0,s=!0,l=0;let m=t.position;for(;!Ki(p)&&p!==0;)p=t.input.charCodeAt(++t.position);No(t,m,t.position,!1)}return!0}function w$(t,e){let r=t.tag,n=t.anchor,i=[],s=!1;if(t.firstTabInLine!==-1)return!1;t.anchor!==null&&Za(t,t.anchor,i);let o=t.input.charCodeAt(t.position);for(;o!==0&&(t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,Se(t,"tab characters must not be used in indentation")),o===45);){let l=t.input.charCodeAt(t.position+1);if(!ln(l))break;if(s=!0,t.position++,rr(t,!0,-1)&&t.lineIndent<=e){i.push(null),o=t.input.charCodeAt(t.position);continue}let c=t.line;if(Ku(t,e,C$,!1,!0),i.push(t.result),rr(t,!0,-1),o=t.input.charCodeAt(t.position),(t.line===c||t.lineIndent>e)&&o!==0)Se(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return s?(t.tag=r,t.anchor=n,t.kind="sequence",t.result=i,!0):!1}function A$(t,e,r){let n,i,s,o,l=t.tag,c=t.anchor,d={},p=Object.create(null),m=null,y=null,b=null,q=!1,C=!1;if(t.firstTabInLine!==-1)return!1;t.anchor!==null&&Za(t,t.anchor,d);let v=t.input.charCodeAt(t.position);for(;v!==0;){!q&&t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,Se(t,"tab characters must not be used in indentation"));let _=t.input.charCodeAt(t.position+1),E=t.line;if((v===63||v===58)&&ln(_))v===63?(q&&(Yu(t,d,p,m,y,null,i,s,o),m=y=b=null),C=!0,q=!0,n=!0):q?(q=!1,n=!0):Se(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,v=_;else{if(i=t.line,s=t.lineStart,o=t.position,!Ku(t,r,R$,!1,!0))break;if(t.line===E){for(v=t.input.charCodeAt(t.position);Is(v);)v=t.input.charCodeAt(++t.position);if(v===58)v=t.input.charCodeAt(++t.position),ln(v)||Se(t,"a whitespace character is expected after the key-value separator within a block mapping"),q&&(Yu(t,d,p,m,y,null,i,s,o),m=y=b=null),C=!0,q=!1,n=!1,m=t.tag,y=t.result;else if(C)Se(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=l,t.anchor=c,!0}else if(C)Se(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=l,t.anchor=c,!0}if((t.line===E||t.lineIndent>e)&&(q&&(i=t.line,s=t.lineStart,o=t.position),Ku(t,e,ey,!0,n)&&(q?y=t.result:b=t.result),q||(Yu(t,d,p,m,y,b,i,s,o),m=y=b=null),rr(t,!0,-1),v=t.input.charCodeAt(t.position)),(t.line===E||t.lineIndent>e)&&v!==0)Se(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return q&&Yu(t,d,p,m,y,null,i,s,o),C&&(t.tag=l,t.anchor=c,t.kind="mapping",t.result=d),C}function m9(t){let e=!1,r=!1,n,i,s=t.input.charCodeAt(t.position);if(s!==33)return!1;t.tag!==null&&Se(t,"duplication of a tag property"),s=t.input.charCodeAt(++t.position),s===60?(e=!0,s=t.input.charCodeAt(++t.position)):s===33?(r=!0,n="!!",s=t.input.charCodeAt(++t.position)):n="!";let o=t.position;if(e){do s=t.input.charCodeAt(++t.position);while(s!==0&&s!==62);t.position<t.length?(i=t.input.slice(o,t.position),s=t.input.charCodeAt(++t.position)):Se(t,"unexpected end of the stream within a verbatim tag")}else{for(;s!==0&&!ln(s);)s===33&&(r?Se(t,"tag suffix cannot contain exclamation marks"):(n=t.input.slice(o-1,t.position+1),x$.test(n)||Se(t,"named tag handle cannot contain such characters"),r=!0,o=t.position+1)),s=t.input.charCodeAt(++t.position);i=t.input.slice(o,t.position),t9.test(i)&&Se(t,"tag suffix cannot contain flow indicator characters")}i&&!E$.test(i)&&Se(t,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch{Se(t,"tag name is malformed: "+i)}return e?t.tag=i:Si.call(t.tagMap,n)?t.tag=t.tagMap[n]+i:n==="!"?t.tag="!"+i:n==="!!"?t.tag="tag:yaml.org,2002:"+i:Se(t,'undeclared tag handle "'+n+'"'),!0}function g9(t){let e=t.input.charCodeAt(t.position);if(e!==38)return!1;t.anchor!==null&&Se(t,"duplication of an anchor property"),e=t.input.charCodeAt(++t.position);let r=t.position;for(;e!==0&&!ln(e)&&!Gu(e);)e=t.input.charCodeAt(++t.position);return t.position===r&&Se(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(r,t.position),!0}function y9(t){let e=t.input.charCodeAt(t.position);if(e!==42)return!1;e=t.input.charCodeAt(++t.position);let r=t.position;for(;e!==0&&!ln(e)&&!Gu(e);)e=t.input.charCodeAt(++t.position);t.position===r&&Se(t,"name of an alias node must contain at least one character");let n=t.input.slice(r,t.position);return Si.call(t.anchorMap,n)||Se(t,'unidentified alias "'+n+'"'),t.result=t.anchorMap[n],rr(t,!0,-1),!0}function v9(t,e,r,n){let i=k$(t);return a9(t),v$(t,e),t.tag=null,t.anchor=null,t.kind=null,t.result=null,A$(t,r,n)&&t.kind==="mapping"?(l9(t),!0):(u9(t),v$(t,i),!1)}function Ku(t,e,r,n,i){let s,o,l=1,c=!1,d=!1,p=null,m,y,b;t.depth>=t.maxDepth&&Se(t,"nesting exceeded maxDepth ("+t.maxDepth+")"),t.depth+=1,t.listener!==null&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null;let q=s=o=ey===r||C$===r;if(n&&rr(t,!0,-1)&&(c=!0,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)),l===1)for(;;){let C=t.input.charCodeAt(t.position),v=k$(t);if(c&&(C===33&&t.tag!==null||C===38&&t.anchor!==null)||!m9(t)&&!g9(t))break;p===null&&(p=v),rr(t,!0,-1)?(c=!0,o=q,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)):o=!1}if(o&&(o=c||i),l===1||ey===r)if(Xg===r||R$===r?y=e:y=e+1,b=t.position-t.lineStart,l===1)if(o&&(w$(t,b)||A$(t,b,y))||p9(t,y))d=!0;else{let C=t.input.charCodeAt(t.position);p!==null&&q&&!o&&C!==124&&C!==62&&v9(t,p,p.position-p.lineStart,y)||s&&h9(t,y)||f9(t,y)||d9(t,y)?d=!0:y9(t)?(d=!0,(t.tag!==null||t.anchor!==null)&&Se(t,"alias node should not have any properties")):c9(t,y,Xg===r)&&(d=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&Za(t,t.anchor,t.result)}else l===0&&(d=o&&w$(t,b));if(t.tag===null)t.anchor!==null&&Za(t,t.anchor,t.result);else if(t.tag==="?"){t.result!==null&&t.kind!=="scalar"&&Se(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"');for(let C=0,v=t.implicitTypes.length;C<v;C+=1)if(m=t.implicitTypes[C],m.resolve(t.result)){t.result=m.construct(t.result),t.tag=m.tag,t.anchor!==null&&Za(t,t.anchor,t.result);break}}else if(t.tag!=="!"){if(Si.call(t.typeMap[t.kind||"fallback"],t.tag))m=t.typeMap[t.kind||"fallback"][t.tag];else{m=null;let C=t.typeMap.multi[t.kind||"fallback"];for(let v=0,_=C.length;v<_;v+=1)if(t.tag.slice(0,C[v].tag.length)===C[v].tag){m=C[v];break}}m||Se(t,"unknown tag !<"+t.tag+">"),t.result!==null&&m.kind!==t.kind&&Se(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+m.kind+'", not "'+t.kind+'"'),m.resolve(t.result,t.tag)?(t.result=m.construct(t.result,t.tag),t.anchor!==null&&Za(t,t.anchor,t.result)):Se(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return t.listener!==null&&t.listener("close",t),t.depth-=1,t.tag!==null||t.anchor!==null||d}function b9(t){let e=t.position,r=!1,n;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);(n=t.input.charCodeAt(t.position))!==0&&(rr(t,!0,-1),n=t.input.charCodeAt(t.position),!(t.lineIndent>0||n!==37));){r=!0,n=t.input.charCodeAt(++t.position);let i=t.position;for(;n!==0&&!ln(n);)n=t.input.charCodeAt(++t.position);let s=t.input.slice(i,t.position),o=[];for(s.length<1&&Se(t,"directive name must not be less than one character in length");n!==0;){for(;Is(n);)n=t.input.charCodeAt(++t.position);if(n===35){do n=t.input.charCodeAt(++t.position);while(n!==0&&!Ki(n));break}if(Ki(n))break;for(i=t.position;n!==0&&!ln(n);)n=t.input.charCodeAt(++t.position);o.push(t.input.slice(i,t.position))}n!==0&&sC(t),Si.call(b$,s)?b$[s](t,s,o):ty(t,'unknown document directive "'+s+'"')}if(rr(t,!0,-1),t.lineIndent===0&&t.input.charCodeAt(t.position)===45&&t.input.charCodeAt(t.position+1)===45&&t.input.charCodeAt(t.position+2)===45?(t.position+=3,rr(t,!0,-1)):r&&Se(t,"directives end mark is expected"),Ku(t,t.lineIndent-1,ey,!1,!0),rr(t,!0,-1),t.checkLineBreaks&&e9.test(t.input.slice(e,t.position))&&ty(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&ry(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,rr(t,!0,-1));return}t.position<t.length-1&&Se(t,"end of the stream or a document separator is expected")}function T$(t,e){t=String(t),e=e||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
|
|
261
261
|
`),t.charCodeAt(0)===65279&&(t=t.slice(1)));let r=new o9(t,e),n=t.indexOf("\0");for(n!==-1&&(r.position=n,Se(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)b9(r);return r.documents}function S9(t,e,r){e!==null&&typeof e=="object"&&typeof r>"u"&&(r=e,e=null);let n=T$(t,r);if(typeof e!="function")return n;for(let i=0,s=n.length;i<s;i+=1)e(n[i])}function w9(t,e){let r=T$(t,e);if(r.length!==0){if(r.length===1)return r[0];throw new _$("expected a single document in the stream, but found more")}}aC.exports.loadAll=S9;aC.exports.load=w9});var t1=V((Lre,e1)=>{"use strict";var sy=zu(),Yd=Ju(),_9=Zg(),B$=Object.prototype.toString,V$=Object.prototype.hasOwnProperty,dC=65279,R9=9,zd=10,C9=13,x9=32,E9=33,q9=34,lC=35,O9=37,I9=38,P9=39,k9=42,W$=44,A9=45,ny=58,T9=61,$9=62,N9=63,M9=64,z$=91,J$=93,F9=96,G$=123,D9=124,Y$=125,Or={};Or[0]="\\0";Or[7]="\\a";Or[8]="\\b";Or[9]="\\t";Or[10]="\\n";Or[11]="\\v";Or[12]="\\f";Or[13]="\\r";Or[27]="\\e";Or[34]='\\"';Or[92]="\\\\";Or[133]="\\N";Or[160]="\\_";Or[8232]="\\L";Or[8233]="\\P";var j9=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],L9=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function U9(t,e){if(e===null)return{};let r={},n=Object.keys(e);for(let i=0,s=n.length;i<s;i+=1){let o=n[i],l=String(e[o]);o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2));let c=t.compiledTypeMap.fallback[o];c&&V$.call(c.styleAliases,l)&&(l=c.styleAliases[l]),r[o]=l}return r}function H9(t){let e,r,n=t.toString(16).toUpperCase();if(t<=255)e="x",r=2;else if(t<=65535)e="u",r=4;else if(t<=4294967295)e="U",r=8;else throw new Yd("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+e+sy.repeat("0",r-n.length)+n}var B9=1,Jd=2;function V9(t){this.schema=t.schema||_9,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=sy.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=U9(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.quotingType=t.quotingType==='"'?Jd:B9,this.forceQuotes=t.forceQuotes||!1,this.replacer=typeof t.replacer=="function"?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function N$(t,e){let r=sy.repeat(" ",e),n=0,i="",s=t.length;for(;n<s;){let o,l=t.indexOf(`
|
|
262
262
|
`,n);l===-1?(o=t.slice(n),n=s):(o=t.slice(n,l+1),n=l+1),o.length&&o!==`
|
|
263
263
|
`&&(i+=r),i+=o}return i}function uC(t,e){return`
|
|
264
|
-
`+sy.repeat(" ",t.indent*e)}function W9(t,e){for(let r=0,n=t.implicitTypes.length;r<n;r+=1)if(t.implicitTypes[r].resolve(e))return!0;return!1}function iy(t){return t===x9||t===R9}function Gd(t){return t>=32&&t<=126||t>=161&&t<=55295&&t!==8232&&t!==8233||t>=57344&&t<=65533&&t!==dC||t>=65536&&t<=1114111}function M$(t){return Gd(t)&&t!==dC&&t!==C9&&t!==zd}function F$(t,e,r){let n=M$(t),i=n&&!iy(t);return(r?n:n&&t!==W$&&t!==z$&&t!==J$&&t!==G$&&t!==Y$)&&t!==lC&&!(e===ny&&!i)||M$(e)&&!iy(e)&&t===lC||e===ny&&i}function z9(t){return Gd(t)&&t!==dC&&!iy(t)&&t!==A9&&t!==N9&&t!==ny&&t!==W$&&t!==z$&&t!==J$&&t!==G$&&t!==Y$&&t!==lC&&t!==I9&&t!==k9&&t!==E9&&t!==D9&&t!==T9&&t!==$9&&t!==P9&&t!==q9&&t!==O9&&t!==M9&&t!==F9}function J9(t){return!iy(t)&&t!==ny}function Wd(t,e){let r=t.charCodeAt(e),n;return r>=55296&&r<=56319&&e+1<t.length&&(n=t.charCodeAt(e+1),n>=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}function K$(t){return/^\n* /.test(t)}var Q$=1,cC=2,Z$=3,X$=4,Qu=5;function G9(t,e,r,n,i,s,o,l){let c,d=0,p=null,m=!1,y=!1,b=n!==-1,
|
|
264
|
+
`+sy.repeat(" ",t.indent*e)}function W9(t,e){for(let r=0,n=t.implicitTypes.length;r<n;r+=1)if(t.implicitTypes[r].resolve(e))return!0;return!1}function iy(t){return t===x9||t===R9}function Gd(t){return t>=32&&t<=126||t>=161&&t<=55295&&t!==8232&&t!==8233||t>=57344&&t<=65533&&t!==dC||t>=65536&&t<=1114111}function M$(t){return Gd(t)&&t!==dC&&t!==C9&&t!==zd}function F$(t,e,r){let n=M$(t),i=n&&!iy(t);return(r?n:n&&t!==W$&&t!==z$&&t!==J$&&t!==G$&&t!==Y$)&&t!==lC&&!(e===ny&&!i)||M$(e)&&!iy(e)&&t===lC||e===ny&&i}function z9(t){return Gd(t)&&t!==dC&&!iy(t)&&t!==A9&&t!==N9&&t!==ny&&t!==W$&&t!==z$&&t!==J$&&t!==G$&&t!==Y$&&t!==lC&&t!==I9&&t!==k9&&t!==E9&&t!==D9&&t!==T9&&t!==$9&&t!==P9&&t!==q9&&t!==O9&&t!==M9&&t!==F9}function J9(t){return!iy(t)&&t!==ny}function Wd(t,e){let r=t.charCodeAt(e),n;return r>=55296&&r<=56319&&e+1<t.length&&(n=t.charCodeAt(e+1),n>=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}function K$(t){return/^\n* /.test(t)}var Q$=1,cC=2,Z$=3,X$=4,Qu=5;function G9(t,e,r,n,i,s,o,l){let c,d=0,p=null,m=!1,y=!1,b=n!==-1,q=-1,C=z9(Wd(t,0))&&J9(Wd(t,t.length-1));if(e||o)for(c=0;c<t.length;d>=65536?c+=2:c++){if(d=Wd(t,c),!Gd(d))return Qu;C=C&&F$(d,p,l),p=d}else{for(c=0;c<t.length;d>=65536?c+=2:c++){if(d=Wd(t,c),d===zd)m=!0,b&&(y=y||c-q-1>n&&t[q+1]!==" ",q=c);else if(!Gd(d))return Qu;C=C&&F$(d,p,l),p=d}y=y||b&&c-q-1>n&&t[q+1]!==" "}return!m&&!y?C&&!o&&!i(t)?Q$:s===Jd?Qu:cC:r>9&&K$(t)?Qu:o?s===Jd?Qu:cC:y?X$:Z$}function Y9(t,e,r,n,i){t.dump=(function(){if(e.length===0)return t.quotingType===Jd?'""':"''";if(!t.noCompatMode&&(j9.indexOf(e)!==-1||L9.test(e)))return t.quotingType===Jd?'"'+e+'"':"'"+e+"'";let s=t.indent*Math.max(1,r),o=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-s),l=n||t.flowLevel>-1&&r>=t.flowLevel;function c(d){return W9(t,d)}switch(G9(e,l,t.indent,o,c,t.quotingType,t.forceQuotes&&!n,i)){case Q$:return e;case cC:return"'"+e.replace(/'/g,"''")+"'";case Z$:return"|"+D$(e,t.indent)+j$(N$(e,s));case X$:return">"+D$(e,t.indent)+j$(N$(K9(e,o),s));case Qu:return'"'+Q9(e,o)+'"';default:throw new Yd("impossible error: invalid scalar style")}})()}function D$(t,e){let r=K$(t)?String(e):"",n=t[t.length-1]===`
|
|
265
265
|
`,s=n&&(t[t.length-2]===`
|
|
266
266
|
`||t===`
|
|
267
267
|
`)?"+":n?"":"-";return r+s+`
|
|
@@ -276,7 +276,7 @@ Parsed value is empty`);return o}catch(o){throw!o&&e.continueOnError?new Ya.Unma
|
|
|
276
276
|
`:""}e1.exports.dump=r8});var hC=V((Ure,Br)=>{"use strict";var r1=$$(),n8=t1();function pC(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}Br.exports.Type=qr();Br.exports.Schema=LR();Br.exports.FAILSAFE_SCHEMA=VR();Br.exports.JSON_SCHEMA=YR();Br.exports.CORE_SCHEMA=KR();Br.exports.DEFAULT_SCHEMA=Zg();Br.exports.load=r1.load;Br.exports.loadAll=r1.loadAll;Br.exports.dump=n8.dump;Br.exports.YAMLException=Ju();Br.exports.types={binary:eC(),float:GR(),map:BR(),null:WR(),pairs:rC(),set:nC(),timestamp:QR(),bool:zR(),int:JR(),merge:ZR(),omap:tC(),seq:HR(),str:UR()};Br.exports.safeLoad=pC("safeLoad","load");Br.exports.safeLoadAll=pC("safeLoadAll","loadAll");Br.exports.safeDump=pC("safeDump","dump")});var n1=V(Kd=>{"use strict";var i8=Kd&&Kd.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Kd,"__esModule",{value:!0});var s8=Jn(),o8=i8(hC()),a8=hC();Kd.default={order:200,allowEmpty:!0,canParse:[".yaml",".yml",".json"],async parse(t){let e=t.data;if(Buffer.isBuffer(e)&&(e=e.toString()),typeof e=="string")try{return o8.default.load(e,{schema:a8.JSON_SCHEMA})}catch(r){throw new s8.ParserError(r?.message||"Parser Error",t.url)}else return e}}});var i1=V(mC=>{"use strict";Object.defineProperty(mC,"__esModule",{value:!0});var l8=Jn(),u8=/\.(txt|htm|html|md|xml|js|min|map|css|scss|less|svg)$/i;mC.default={order:300,allowEmpty:!0,encoding:"utf8",canParse(t){return(typeof t.data=="string"||Buffer.isBuffer(t.data))&&u8.test(t.url)},parse(t){if(typeof t.data=="string")return t.data;if(Buffer.isBuffer(t.data))return t.data.toString(this.encoding);throw new l8.ParserError("data is not text",t.url)}}});var s1=V(gC=>{"use strict";Object.defineProperty(gC,"__esModule",{value:!0});var c8=/\.(jpeg|jpg|gif|png|bmp|ico)$/i;gC.default={order:400,allowEmpty:!0,canParse(t){return Buffer.isBuffer(t.data)&&c8.test(t.url)},parse(t){return Buffer.isBuffer(t.data)?t.data:Buffer.from(t.data)}}});var u1=V(wi=>{"use strict";var f8=wi&&wi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),d8=wi&&wi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),p8=wi&&wi.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&f8(r,e,n[i]);return d8(r,e),r}})(),h8=wi&&wi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wi,"__esModule",{value:!0});var m8=h8(_t("fs")),o1=Ao(),a1=p8(zn()),l1=Jn();wi.default={order:100,canRead(t){return a1.isFileSystemPath(t.url)},async read(t){let e;try{e=a1.toFileSystemPath(t.url)}catch(r){throw new l1.ResolverError(o1.ono.uri(r,`Malformed URI: ${t.url}`),t.url)}try{return await m8.default.promises.readFile(e)}catch(r){throw new l1.ResolverError((0,o1.ono)(r,`Error opening file "${e}"`),e)}}}});var d1=V(ks=>{"use strict";var g8=ks&&ks.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),y8=ks&&ks.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),v8=ks&&ks.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&g8(r,e,n[i]);return y8(r,e),r}})();Object.defineProperty(ks,"__esModule",{value:!0});var oy=Ao(),Qd=v8(zn()),c1=Jn();ks.default={order:200,headers:null,timeout:6e4,redirects:5,withCredentials:!1,canRead(t){return Qd.isHttp(t.url)},read(t){let e=Qd.parse(t.url);return typeof window<"u"&&!e.protocol&&(e.protocol=Qd.parse(location.href).protocol),f1(e,this)}};async function f1(t,e,r){t=Qd.parse(t);let n=r||[];n.push(t.href);try{let i=await b8(t,e);if(i.status>=400)throw(0,oy.ono)({status:i.status},`HTTP ERROR ${i.status}`);if(i.status>=300){if(!Number.isNaN(e.redirects)&&n.length>e.redirects)throw new c1.ResolverError((0,oy.ono)({status:i.status},`Error downloading ${n[0]}.
|
|
277
277
|
Too many redirects:
|
|
278
278
|
${n.join(`
|
|
279
|
-
`)}`));if(!("location"in i.headers)||!i.headers.location)throw(0,oy.ono)({status:i.status},`HTTP ${i.status} redirect with no location header`);{let s=Qd.resolve(t.href,i.headers.location);return f1(s,e,n)}}else{if(i.body){let s=await i.arrayBuffer();return Buffer.from(s)}return Buffer.alloc(0)}}catch(i){throw new c1.ResolverError((0,oy.ono)(i,`Error downloading ${t.href}`),t.href)}}async function b8(t,e){let r,n;e.timeout&&(r=new AbortController,n=setTimeout(()=>r.abort(),e.timeout));let i=await fetch(t,{method:"GET",headers:e.headers||{},credentials:e.withCredentials?"include":"same-origin",signal:r?r.signal:null});return n&&clearTimeout(n),i}});var yC=V(As=>{"use strict";var Zu=As&&As.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(As,"__esModule",{value:!0});As.getNewOptions=As.getJsonSchemaRefParserDefaultOptions=void 0;var S8=Zu(jT()),w8=Zu(n1()),_8=Zu(i1()),R8=Zu(s1()),C8=Zu(u1()),x8=Zu(d1()),E8=()=>({parse:{json:{...S8.default},yaml:{...w8.default},text:{..._8.default},binary:{...R8.default}},resolve:{file:{...C8.default},http:{...x8.default},external:!0},continueOnError:!1,dereference:{circular:!0,excludedPathMatcher:()=>!1,referenceResolution:"relative"},mutateInputSchema:!0});As.getJsonSchemaRefParserDefaultOptions=E8;var q8=t=>{let e=(0,As.getJsonSchemaRefParserDefaultOptions)();return t&&h1(e,t),e};As.getNewOptions=q8;function h1(t,e){if(p1(e)){let r=Object.keys(e).filter(n=>!["__proto__","constructor","prototype"].includes(n));for(let n=0;n<r.length;n++){let i=r[n],s=e[i],o=t[i];p1(s)?t[i]=h1(o||{},s):s!==void 0&&(t[i]=s)}}return t}function p1(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}});var g1=V(ay=>{"use strict";Object.defineProperty(ay,"__esModule",{value:!0});ay.normalizeArgs=m1;var O8=yC();function m1(t){let e,r,n,i,s=Array.prototype.slice.call(t);typeof s[s.length-1]=="function"&&(i=s.pop()),typeof s[0]=="string"?(e=s[0],typeof s[2]=="object"?(r=s[1],n=s[2]):(r=void 0,n=s[1])):(e="",r=s[0],n=s[1]);try{n=(0,O8.getNewOptions)(n)}catch(o){console.error(`JSON Schema Ref Parser: Error normalizing options: ${o}`)}return!n.mutateInputSchema&&typeof r=="object"&&(r=JSON.parse(JSON.stringify(r))),{path:e,schema:r,options:n,callback:i}}ay.default=m1});var y1=V(_i=>{"use strict";var I8=_i&&_i.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),P8=_i&&_i.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),k8=_i&&_i.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&I8(r,e,n[i]);return P8(r,e),r}})(),vC=_i&&_i.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_i,"__esModule",{value:!0});var A8=vC(Vu()),T8=vC(Ld()),$8=vC($R()),Xu=k8(zn()),N8=Jn();function M8(t,e){if(!e.resolve?.external)return Promise.resolve();try{let r=bC(t.schema,t.$refs._root$Ref.path+"#",t.$refs,e);return Promise.all(r)}catch(r){return Promise.reject(r)}}function bC(t,e,r,n,i,s){i||(i=new Set);let o=[];if(t&&typeof t=="object"&&!ArrayBuffer.isView(t)&&!i.has(t)){i.add(t),A8.default.isExternal$Ref(t)&&o.push(F8(t,e,r,n));let l=Object.keys(t);for(let c of l){let d=T8.default.join(e,c),p=t[c];o=o.concat(bC(p,d,r,n,i,s))}}return o}async function F8(t,e,r,n){let i=n.dereference?.externalReferenceResolution==="root",s=Xu.resolve(i?Xu.cwd():e,t.$ref),o=Xu.stripHash(s),l=r._$refs[o];if(l)return Promise.resolve(l.value);try{let c=await(0,$8.default)(s,r,n),d=bC(c,o+"#",r,n,new Set,!0);return Promise.all(d)}catch(c){if(!n?.continueOnError||!(0,N8.isHandledError)(c))throw c;return r._$refs[o]&&(c.source=decodeURI(Xu.stripHash(e)),c.path=Xu.safePointerToPath(Xu.getHash(e))),[]}}_i.default=M8});var S1=V(Ri=>{"use strict";var D8=Ri&&Ri.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),j8=Ri&&Ri.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),L8=Ri&&Ri.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&D8(r,e,n[i]);return j8(r,e),r}})(),b1=Ri&&Ri.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ri,"__esModule",{value:!0});var ly=b1(Vu()),Zd=b1(Ld()),SC=L8(zn());function U8(t,e){let r=[];wC(t,"schema",t.$refs._root$Ref.path+"#","#",0,r,t.$refs,e),H8(r)}function wC(t,e,r,n,i,s,o,l){let c=e===null?t:t[e];if(c&&typeof c=="object"&&!ArrayBuffer.isView(c))if(ly.default.isAllowed$Ref(c))v1(t,e,r,n,i,s,o,l);else{let d=Object.keys(c).sort((p,m)=>p==="definitions"?-1:m==="definitions"?1:p.length-m.length);for(let p of d){let m=Zd.default.join(r,p),y=Zd.default.join(n,p),b=c[p];ly.default.isAllowed$Ref(b)?v1(c,p,r,y,i,s,o,l):wC(c,p,m,y,i,s,o,l)}}}function v1(t,e,r,n,i,s,o,l){let c=e===null?t:t[e],d=SC.resolve(r,c.$ref),p=o._resolve(d,n,l);if(p===null)return;let y=Zd.default.parse(n).length,b=SC.stripHash(p.path),E=SC.getHash(p.path),C=b!==o._root$Ref.path,v=ly.default.isExtended$Ref(c);i+=p.indirections;let _=B8(s,t,e);if(_)if(y<_.depth||i<_.indirections)V8(s,_);else return;s.push({$ref:c,parent:t,key:e,pathFromRoot:n,depth:y,file:b,hash:E,value:p.value,circular:p.circular,extended:v,external:C,indirections:i}),(!_||C)&&wC(p.value,null,p.path,n,i+1,s,o,l)}function H8(t){t.sort((i,s)=>{if(i.file!==s.file)return i.file<s.file?-1:1;if(i.hash!==s.hash)return i.hash<s.hash?-1:1;if(i.circular!==s.circular)return i.circular?-1:1;if(i.extended!==s.extended)return i.extended?1:-1;if(i.indirections!==s.indirections)return i.indirections-s.indirections;if(i.depth!==s.depth)return i.depth-s.depth;{let o=i.pathFromRoot.lastIndexOf("/definitions"),l=s.pathFromRoot.lastIndexOf("/definitions");return o!==l?l-o:i.pathFromRoot.length-s.pathFromRoot.length}});let e,r,n;for(let i of t)i.external?i.file===e&&i.hash===r?i.$ref.$ref=n:i.file===e&&i.hash.indexOf(r+"/")===0?i.$ref.$ref=Zd.default.join(n,Zd.default.parse(i.hash.replace(r,"#"))):(e=i.file,r=i.hash,n=i.pathFromRoot,i.$ref=i.parent[i.key]=ly.default.dereference(i.$ref,i.value),i.circular&&(i.$ref.$ref=i.pathFromRoot)):i.$ref.$ref=i.hash}function B8(t,e,r){for(let n of t)if(n&&n.parent===e&&n.key===r)return n}function V8(t,e){let r=t.indexOf(e);t.splice(r,1)}Ri.default=U8});var E1=V(Ci=>{"use strict";var W8=Ci&&Ci.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),z8=Ci&&Ci.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),J8=Ci&&Ci.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&W8(r,e,n[i]);return z8(r,e),r}})(),C1=Ci&&Ci.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ci,"__esModule",{value:!0});var uy=C1(Vu()),w1=C1(Ld()),G8=Ao(),_1=J8(zn()),Y8=Jn();Ci.default=K8;function K8(t,e){let r=Date.now(),n=_C(t.schema,t.$refs._root$Ref.path,"#",new Set,new Set,new Map,t.$refs,e,r);t.$refs.circular=n.circular,t.schema=n.value}function _C(t,e,r,n,i,s,o,l,c){let d,p={value:t,circular:!1};if(l&&l.timeoutMs&&Date.now()-c>l.timeoutMs)throw new Y8.TimeoutError(l.timeoutMs);let m=l.dereference||{},y=m.excludedPathMatcher||(()=>!1);if((m?.circular==="ignore"||!i.has(t))&&t&&typeof t=="object"&&!ArrayBuffer.isView(t)&&!y(r)){if(n.add(t),i.add(t),uy.default.isAllowed$Ref(t,l))d=R1(t,e,r,n,i,s,o,l,c),p.circular=d.circular,p.value=d.value;else for(let b of Object.keys(t)){let E=w1.default.join(e,b),C=w1.default.join(r,b);if(y(C))continue;let v=t[b],_=!1;if(uy.default.isAllowed$Ref(v,l)){if(d=R1(v,E,C,n,i,s,o,l,c),_=d.circular,t[b]!==d.value){let q=new Map;m?.preservedProperties&&typeof t[b]=="object"&&!Array.isArray(t[b])&&m?.preservedProperties.forEach(k=>{k in t[b]&&q.set(k,t[b][k])}),t[b]=d.value,m?.preservedProperties&&q.size&&typeof t[b]=="object"&&!Array.isArray(t[b])&&q.forEach((k,O)=>{t[b][O]=k}),m?.onDereference?.(v.$ref,t[b],t,b)}}else n.has(v)?_=x1(E,o,l):(d=_C(v,E,C,n,i,s,o,l,c),_=d.circular,t[b]!==d.value&&(t[b]=d.value));p.circular=p.circular||_}n.delete(t)}return p}function R1(t,e,r,n,i,s,o,l,c){let p=uy.default.isExternal$Ref(t)&&l?.dereference?.externalReferenceResolution==="root",m=_1.resolve(p?_1.cwd():e,t.$ref),y=s.get(m);if(y&&!y.circular){let q=Object.keys(t);if(q.length>1){let k={};for(let O of q)O!=="$ref"&&!(O in y.value)&&(k[O]=t[O]);return{circular:y.circular,value:Object.assign({},y.value,k)}}return y}let b=o._resolve(m,e,l);if(b===null)return{circular:!1,value:null};let E=b.circular,C=E||n.has(b.value);C&&x1(e,o,l);let v=uy.default.dereference(t,b.value);if(!C){let q=_C(v,b.path,r,n,i,s,o,l,c);C=q.circular,v=q.value}C&&!E&&l.dereference?.circular==="ignore"&&(v=t),E&&(v.$ref=r);let _={circular:C,value:v};return Object.keys(t).length===1&&s.set(m,_),_}function x1(t,e,r){if(e.circular=!0,r?.dereference?.onCircular?.(t),!r.dereference.circular)throw G8.ono.reference(`Circular $ref pointer found at ${t}`);return!0}});var q1=V(RC=>{"use strict";Object.defineProperty(RC,"__esModule",{value:!0});function Q8(){return typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:typeof setImmediate=="function"?setImmediate:function(e){setTimeout(e,0)}}RC.default=Q8()});var I1=V(Xd=>{"use strict";var Z8=Xd&&Xd.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Xd,"__esModule",{value:!0});Xd.default=X8;var O1=Z8(q1());function X8(t,e){if(t){e.then(function(r){(0,O1.default)(function(){t(null,r)})},function(r){(0,O1.default)(function(){t(r)})});return}else return e}});var T1=V(Te=>{"use strict";var e5=Te&&Te.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),t5=Te&&Te.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),r5=Te&&Te.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&e5(r,e,n[i]);return t5(r,e),r}})(),el=Te&&Te.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Te,"__esModule",{value:!0});Te.getJsonSchemaRefParserDefaultOptions=Te.jsonSchemaParserNormalizeArgs=Te.dereferenceInternal=Te.JSONParserErrorGroup=Te.isHandledError=Te.UnmatchedParserError=Te.ParserError=Te.ResolverError=Te.MissingPointerError=Te.InvalidPointerError=Te.JSONParserError=Te.UnmatchedResolverError=Te.dereference=Te.bundle=Te.resolve=Te.parse=Te.$RefParser=void 0;var P1=el($T()),n5=el($R()),ep=el(g1());Te.jsonSchemaParserNormalizeArgs=ep.default;var i5=el(y1()),s5=el(S1()),A1=el(E1());Te.dereferenceInternal=A1.default;var Xa=r5(zn()),Gn=Jn();Object.defineProperty(Te,"JSONParserError",{enumerable:!0,get:function(){return Gn.JSONParserError}});Object.defineProperty(Te,"InvalidPointerError",{enumerable:!0,get:function(){return Gn.InvalidPointerError}});Object.defineProperty(Te,"MissingPointerError",{enumerable:!0,get:function(){return Gn.MissingPointerError}});Object.defineProperty(Te,"ResolverError",{enumerable:!0,get:function(){return Gn.ResolverError}});Object.defineProperty(Te,"ParserError",{enumerable:!0,get:function(){return Gn.ParserError}});Object.defineProperty(Te,"UnmatchedParserError",{enumerable:!0,get:function(){return Gn.UnmatchedParserError}});Object.defineProperty(Te,"UnmatchedResolverError",{enumerable:!0,get:function(){return Gn.UnmatchedResolverError}});Object.defineProperty(Te,"isHandledError",{enumerable:!0,get:function(){return Gn.isHandledError}});Object.defineProperty(Te,"JSONParserErrorGroup",{enumerable:!0,get:function(){return Gn.JSONParserErrorGroup}});var k1=Ao(),xi=el(I1()),o5=yC();Object.defineProperty(Te,"getJsonSchemaRefParserDefaultOptions",{enumerable:!0,get:function(){return o5.getJsonSchemaRefParserDefaultOptions}});var Mo=class t{constructor(){this.schema=null,this.$refs=new P1.default}async parse(){let e=(0,ep.default)(arguments),r;if(!e.path&&!e.schema){let i=(0,k1.ono)(`Expected a file path, URL, or object. Got ${e.path||e.schema}`);return(0,xi.default)(e.callback,Promise.reject(i))}this.schema=null,this.$refs=new P1.default;let n="http";if(Xa.isFileSystemPath(e.path))e.path=Xa.fromFileSystemPath(e.path),n="file";else if(!e.path&&e.schema&&"$id"in e.schema&&e.schema.$id){let i=Xa.parse(e.schema.$id),s=i.protocol==="https:"?443:80;e.path=`${i.protocol}//${i.hostname}:${s}`}if(e.path=Xa.resolve(Xa.cwd(),e.path),e.schema&&typeof e.schema=="object"){let i=this.$refs._add(e.path);i.value=e.schema,i.pathType=n,r=Promise.resolve(e.schema)}else r=(0,n5.default)(e.path,this.$refs,e.options);try{let i=await r;if(i!==null&&typeof i=="object"&&!Buffer.isBuffer(i))return this.schema=i,(0,xi.default)(e.callback,Promise.resolve(this.schema));if(e.options.continueOnError)return this.schema=null,(0,xi.default)(e.callback,Promise.resolve(this.schema));throw k1.ono.syntax(`"${this.$refs._root$Ref.path||i}" is not a valid JSON Schema`)}catch(i){return!e.options.continueOnError||!(0,Gn.isHandledError)(i)?(0,xi.default)(e.callback,Promise.reject(i)):(this.$refs._$refs[Xa.stripHash(e.path)]&&this.$refs._$refs[Xa.stripHash(e.path)].addError(i),(0,xi.default)(e.callback,Promise.resolve(null)))}}static parse(){let e=new t;return e.parse.apply(e,arguments)}async resolve(){let e=(0,ep.default)(arguments);try{return await this.parse(e.path,e.schema,e.options),await(0,i5.default)(this,e.options),CC(this),(0,xi.default)(e.callback,Promise.resolve(this.$refs))}catch(r){return(0,xi.default)(e.callback,Promise.reject(r))}}static resolve(){let e=new t;return e.resolve.apply(e,arguments)}static bundle(){let e=new t;return e.bundle.apply(e,arguments)}async bundle(){let e=(0,ep.default)(arguments);try{return await this.resolve(e.path,e.schema,e.options),(0,s5.default)(this,e.options),CC(this),(0,xi.default)(e.callback,Promise.resolve(this.schema))}catch(r){return(0,xi.default)(e.callback,Promise.reject(r))}}static dereference(){let e=new t;return e.dereference.apply(e,arguments)}async dereference(){let e=(0,ep.default)(arguments);try{return await this.resolve(e.path,e.schema,e.options),(0,A1.default)(this,e.options),CC(this),(0,xi.default)(e.callback,Promise.resolve(this.schema))}catch(r){return(0,xi.default)(e.callback,Promise.reject(r))}}};Te.$RefParser=Mo;Te.default=Mo;function CC(t){if(Gn.JSONParserErrorGroup.getParserErrors(t).length>0)throw new Gn.JSONParserErrorGroup(t)}Te.parse=Mo.parse;Te.resolve=Mo.resolve;Te.bundle=Mo.bundle;Te.dereference=Mo.dereference});var cy,ec,xC=ae(()=>{"use strict";cy=Qc(T1()),ec=class{async resolve(e){try{return await cy.default.dereference(e,{dereference:{circular:"ignore"}})}catch(r){return console.error("[RefResolver] Failed to fully resolve $ref pointers:",r),e}}async bundle(e){try{return await cy.default.bundle(e)}catch(r){return console.error("[RefResolver] Failed to bundle $ref pointers:",r),e}}async resolveFile(e){try{return await cy.default.dereference(e,{dereference:{circular:"ignore"}})}catch(r){throw console.error(`[RefResolver] Failed to resolve file ${e}:`,r),r}}}});import*as $1 from"fs";var N1,a5,Fo,fy=ae(()=>{"use strict";N1=Qc(Dd());jn();fR();xC();a5=["application/json","text/plain","text/html","multipart/form-data","application/x-www-form-urlencoded"],Fo=class{constructor(e,r){this.collectionService=e;this.envConfigService=r;this.exampleGenerator=new ju,this.refResolver=new ec}collectionService;envConfigService;exampleGenerator;refResolver;async import(e,r){let n=await $1.promises.readFile(e,"utf-8"),i;e.endsWith(".yaml")||e.endsWith(".yml")?i=N1.parse(n):i=JSON.parse(n),i=await this.refResolver.resolve(i);let s=i.components?.schemas||{},o=r?.collectionName||i.info?.title||"Imported API",c={id:Pt(o),name:o,description:i.info?.description||"",version:i.info?.version||"1.0.0",variables:{},items:[]};if(i.servers&&i.servers.length>0&&(c.variables.baseUrl=i.servers[0].url),i.security&&i.security.length>0&&i.components?.securitySchemes){let m=this.mapSecurityToAuth(i.security[0],i.components.securitySchemes);m&&(c.auth=m)}let d=new Map;if(i.tags)for(let m of i.tags){let y={type:"folder",id:Pt(m.name),name:m.name,description:m.description,items:[]};d.set(m.name,y),c.items.push(y)}if(i.paths)for(let[m,y]of Object.entries(i.paths))for(let b of["get","post","put","patch","delete","head","options","trace"]){let E=y[b];if(!E)continue;let C=this.processOperation(b,m,E,y,i,s),v=E.tags?.[0];if(v&&d.has(v))d.get(v).items.push(C);else if(v){let _={type:"folder",id:Pt(v),name:v,items:[C]};d.set(v,_),c.items.push(_)}else c.items.push(C)}await this.collectionService.saveCollection(c);let p;return r?.environmentName&&i.servers&&(p=await this.createEnvironmentFromServers(i.servers,r.environmentName)),{collection:c,environmentCreated:p}}processOperation(e,r,n,i,s,o){let l=Pt(n.operationId||`${e}-${r}`),c=`{{baseUrl}}${this.convertPathParams(r)}`,d=n.summary||n.operationId||`${e.toUpperCase()} ${r}`,p=n.deprecated===!0;p&&(d=`[DEPRECATED] ${d}`);let m={type:"request",id:l,name:d,method:e.toUpperCase(),url:c,description:n.description||"",deprecated:p},y=[...i.parameters||[],...n.parameters||[]];if(this.processParameters(m,y,o),n.requestBody&&this.processRequestBody(m,n.requestBody,o),n.responses&&(m.responseSchema=this.processResponses(n.responses,o)),n.security!==void 0&&s.components?.securitySchemes){if(Array.isArray(n.security)&&n.security.length===0)m.auth={type:"none"};else if(n.security&&n.security.length>0){let b=this.mapSecurityToAuth(n.security[0],s.components.securitySchemes);b&&(m.auth=b)}}return m}convertPathParams(e){return e.replace(/\{(\w+)\}/g,":$1")}processParameters(e,r,n){let i=[],s=[],o={},l=[];for(let c of r){let d=c.name,p=c.in,m=c.schema||{},y=c.example!==void 0?String(c.example):this.generateExampleForParam(m,n),b=c.deprecated===!0;switch(p){case"path":{if(c.description||m.type||m.format||m.enum||b||m.pattern||m.minimum!==void 0||m.maximum!==void 0||m.minLength!==void 0||m.maxLength!==void 0||m.multipleOf!==void 0||m.minItems!==void 0||m.maxItems!==void 0||m.uniqueItems||m.nullable||m.oneOf){let C={value:y};m.oneOf?(C.oneOf=m.oneOf,this.applyOneOfHints(C,m.oneOf)):(m.type&&(C.type=m.type),m.format&&(C.format=m.format),m.enum&&(C.enum=m.enum.map(String)),m.pattern&&(C.pattern=m.pattern),m.minimum!==void 0&&(C.minimum=m.minimum),m.maximum!==void 0&&(C.maximum=m.maximum),m.exclusiveMinimum!==void 0&&(C.exclusiveMinimum=m.exclusiveMinimum),m.exclusiveMaximum!==void 0&&(C.exclusiveMaximum=m.exclusiveMaximum),m.multipleOf!==void 0&&(C.multipleOf=m.multipleOf),m.minLength!==void 0&&(C.minLength=m.minLength),m.maxLength!==void 0&&(C.maxLength=m.maxLength),m.minItems!==void 0&&(C.minItems=m.minItems),m.maxItems!==void 0&&(C.maxItems=m.maxItems),m.uniqueItems&&(C.uniqueItems=!0),m.nullable&&(C.nullable=!0)),c.description&&(C.description=c.description),b&&(C.deprecated=!0),o[d]=C}else o[d]=y;break}case"query":{let E={key:d,value:y};this.applySchemaConstraints(E,m,c,b),s.push(E);break}case"header":{let E={key:d,value:y};this.applySchemaConstraints(E,m,c,b),i.push(E);break}case"cookie":{l.push(`${d}={{${d}}}`);break}}}l.length>0&&i.push({key:"Cookie",value:l.join("; ")}),Object.keys(o).length>0&&(e.params=o),s.length>0&&(e.query=s),i.length>0&&(e.headers=i)}applySchemaConstraints(e,r,n,i){r.oneOf?(e.oneOf=r.oneOf,this.applyOneOfHints(e,r.oneOf)):(r.type&&(e.type=r.type),r.format&&(e.format=r.format),r.enum&&(e.enum=r.enum.map(String)),r.pattern&&(e.pattern=r.pattern),r.minimum!==void 0&&(e.minimum=r.minimum),r.maximum!==void 0&&(e.maximum=r.maximum),r.exclusiveMinimum!==void 0&&(e.exclusiveMinimum=r.exclusiveMinimum),r.exclusiveMaximum!==void 0&&(e.exclusiveMaximum=r.exclusiveMaximum),r.multipleOf!==void 0&&(e.multipleOf=r.multipleOf),r.minLength!==void 0&&(e.minLength=r.minLength),r.maxLength!==void 0&&(e.maxLength=r.maxLength),r.minItems!==void 0&&(e.minItems=r.minItems),r.maxItems!==void 0&&(e.maxItems=r.maxItems),r.uniqueItems&&(e.uniqueItems=!0),r.nullable&&(e.nullable=!0)),n.required&&(e.required=!0),n.description&&(e.description=n.description),i&&(e.deprecated=!0)}applyOneOfHints(e,r){let n=[],i=new Set;for(let s of r)s.type&&i.add(s.type),s.enum&&n.push(...s.enum.map(String));i.size===1&&(e.type=[...i][0]),n.length>0&&(e.enum=[...new Set(n)])}generateExampleForParam(e,r){if(!e)return"";let n=this.exampleGenerator.generate(e,{components:r});return n==null?"":String(n)}processRequestBody(e,r,n){if(!r.content)return;let i=Object.keys(r.content);if(i.length===0)return;let s=this.selectPrimaryContentType(i),o=r.content[s],{bodyType:l,bodyFormat:c}=this.mapContentTypeToBodyType(s);if(e.body={type:l,...c&&{format:c},content:""},o){let p=this.generateBodyContent(o,s,n);p!==void 0&&(e.body.content=typeof p=="string"?p:JSON.stringify(p,null,2)),l==="form-data"&&o.schema?.properties&&(e.body.content=this.buildFormDataEntries(o.schema,n)),l==="x-www-form-urlencoded"&&o.schema?.properties&&(e.body.content=this.buildFormDataEntries(o.schema,n))}let d=this.buildBodySchema(r,s,n);d&&(e.bodySchema=d)}selectPrimaryContentType(e){for(let i of a5)if(e.includes(i))return i;let r=e.find(i=>i.includes("json"));if(r)return r;let n=e.find(i=>i.startsWith("text/"));return n||e[0]}mapContentTypeToBodyType(e){return e.includes("json")?{bodyType:"raw",bodyFormat:"json"}:e==="application/xml"||e==="text/xml"?{bodyType:"raw",bodyFormat:"xml"}:e==="text/html"?{bodyType:"raw",bodyFormat:"html"}:e.startsWith("text/")?{bodyType:"raw",bodyFormat:"text"}:e==="multipart/form-data"?{bodyType:"form-data"}:e==="application/x-www-form-urlencoded"?{bodyType:"x-www-form-urlencoded"}:e==="application/octet-stream"?{bodyType:"binary"}:{bodyType:"raw",bodyFormat:"text"}}generateBodyContent(e,r,n){if(e.example!==void 0)return e.example;if(e.examples){let i=Object.values(e.examples)[0];if(i?.value!==void 0)return i.value}if(e.schema)return this.exampleGenerator.generate(e.schema,{omitReadOnly:!0,components:n})}buildFormDataEntries(e,r){let n=[],i=e.properties||{},s=new Set(e.required||[]);for(let[o,l]of Object.entries(i)){let c=l,d=c.type==="string"&&c.format==="binary",p={key:o,value:d?"":String(this.exampleGenerator.generate(c,{components:r})||""),type:d?"file":"text",enabled:!0};n.push(p)}return n}buildBodySchema(e,r,n){let i=Object.keys(e.content),s=e.content[r];if(!s?.schema)return;let o={contentType:r,schema:s.schema};if(i.length>1){o.content={};for(let c of i){let d=e.content[c],p={};d.schema&&(p.schema=d.schema),d.examples&&(p.examples=d.examples),d.encoding&&(p.encoding=d.encoding),o.content[c]=p}}s.encoding&&(o.encoding=s.encoding);let l=this.extractUsedComponents(s.schema,n);return Object.keys(l).length>0&&(o.components=l),o}processResponses(e,r){let n={responses:{}},i={};for(let[s,o]of Object.entries(e)){let l=o,c={description:l.description||`Status ${s}`};if(l.content){let d=Object.keys(l.content);if(d.length===1){let p=d[0],m=l.content[p];c.contentType=p,m.schema&&(c.schema=m.schema),m.examples&&(c.examples=m.examples),m.schema&&Object.assign(i,this.extractUsedComponents(m.schema,r))}else{c.content={};for(let p of d){let m=l.content[p],y={};m.schema&&(y.schema=m.schema),m.examples&&(y.examples=m.examples),c.content[p]=y,m.schema&&Object.assign(i,this.extractUsedComponents(m.schema,r))}}}if(l.headers){c.headers={};for(let[d,p]of Object.entries(l.headers)){let m=p;c.headers[d]={...m.description&&{description:m.description},schema:m.schema||{type:"string"}}}}n.responses[s]=c}return Object.keys(i).length>0&&(n.components=i),n}mapSecurityToAuth(e,r){let n=Object.keys(e)[0];if(!n)return;let i=r[n];if(i)switch(i.type){case"http":if(i.scheme==="bearer")return{type:"bearer",bearerToken:""};if(i.scheme==="basic")return{type:"basic",basicAuth:{username:"",password:""}};break;case"apiKey":return{type:"apikey",apikey:{key:i.name||"X-Api-Key",value:"",in:i.in||"header"}};case"oauth2":{let s=i.flows||{},o=s.authorizationCode||s.clientCredentials||s.password||s.implicit||{},l="client_credentials";return s.authorizationCode?l="authorization_code":s.password?l="password":s.implicit&&(l="implicit"),{type:"oauth2",oauth2:{grantType:l,tokenUrl:o.tokenUrl||"",authUrl:o.authorizationUrl||"",clientId:"",clientSecret:"",scope:Object.keys(o.scopes||{}).join(" ")}}}}}async createEnvironmentFromServers(e,r){if(e.length>0){let n=e[0].url;this.envConfigService.setEnvironmentVariable("baseUrl",n)}return r}extractUsedComponents(e,r,n){let i=n||{};if(!e)return i;if(e.$ref){let s=this.extractRefName(e.$ref);s&&r[s]&&!i[s]&&(i[s]=r[s],this.extractUsedComponents(r[s],r,i))}if(e.properties)for(let s of Object.values(e.properties))this.extractUsedComponents(s,r,i);e.items&&this.extractUsedComponents(e.items,r,i);for(let s of["allOf","oneOf","anyOf"])if(e[s])for(let o of e[s])this.extractUsedComponents(o,r,i);return e.additionalProperties&&typeof e.additionalProperties=="object"&&this.extractUsedComponents(e.additionalProperties,r,i),i}extractRefName(e){return e.match(/^#\/components\/schemas\/(.+)$/)?.[1]}}});var tc,EC=ae(()=>{"use strict";tc=class{constructor(e,r,n){this.historyAnalyzer=e;this.scriptAnalyzer=r;this.inferrer=n}historyAnalyzer;scriptAnalyzer;inferrer;async infer(e,r,n,i){let s=await this.historyAnalyzer.analyze(e,r,{environment:i?.environment}),o;return i?.postResponseScript&&(o=this.scriptAnalyzer.analyze(i.postResponseScript)),this.mergeResponseSchemas(n,s,o)}async inferBodySchema(e,r,n,i,s){let o,l;if(r==="raw"&&n==="json"&&e){let c=e;if(typeof e=="string")try{c=JSON.parse(e)}catch{return}o=this.inferrer.inferFromValue(c),l="application/json"}else r==="form-data"&&i?(o=this.buildFormDataSchema(i),l="multipart/form-data"):r==="x-www-form-urlencoded"&&i?(o=this.buildFormDataSchema(i),l="application/x-www-form-urlencoded"):r==="raw"&&n==="xml"?(o={type:"string"},l="application/xml"):r==="raw"&&(n==="text"||n==="html")?(o={type:"string"},l=n==="html"?"text/html":"text/plain"):r==="binary"?(o={type:"string",format:"binary"},l="application/octet-stream"):r==="graphql"&&(o={type:"object",properties:{query:{type:"string"},variables:{type:"object"}}},l="application/json");if(o)return s?this.mergeBodySchemaWithExisting(o,s):{contentType:l,schema:o}}buildFormDataSchema(e){let r={type:"object",properties:{}},n=[];for(let i of e){if(!i.enabled&&i.enabled!==void 0)continue;let s={};i.type?s.type=i.type:s.type="string",i.description&&(s.description=i.description),i.format&&(s.format=i.format),i.enum&&(s.enum=i.enum),i.type==="file"&&(s.type="string",s.format="binary"),r.properties[i.key]=s,i.required&&n.push(i.key)}return n.length>0&&(r.required=n),r}mergeResponseSchemas(e,r,n){let i={responses:{}};for(let[s,o]of Object.entries(r.responses))i.responses[s]={...o};if(n&&this.applyScriptHints(i,n),e){for(let[s,o]of Object.entries(e.responses))i.responses[s]?i.responses[s]=this.mergeResponseDefinitions(i.responses[s],o):i.responses[s]={...o};e.components&&(i.components={...e.components})}return i}applyScriptHints(e,r){for(let n of r.expectedStatuses){let i=String(n);e.responses[i]||(e.responses[i]={description:`Status ${n}`})}for(let[,n]of Object.entries(e.responses))n.schema&&this.augmentSchemaWithHints(n.schema,r)}augmentSchemaWithHints(e,r){if(!(e.type!=="object"||!e.properties))for(let n of r.fieldPaths){let i=n.split(".");this.ensureFieldPath(e,i,r)}}ensureFieldPath(e,r,n,i=""){if(r.length===0||e.type!=="object")return;e.properties||(e.properties={});let s=r[0],o=s.endsWith("[]"),l=o?s.slice(0,-2):s,c=i?`${i}.${s}`:s,d=r.slice(1);if(!e.properties[l])if(o)e.properties[l]={type:"array",items:{type:"object"}};else if(d.length>0)e.properties[l]={type:"object",properties:{}};else{let p=n.typeHints[c];e.properties[l]={type:p||"string"};return}if(d.length>0){let p=o?e.properties[l].items:e.properties[l];p&&this.ensureFieldPath(p,d,n,c)}}mergeResponseDefinitions(e,r){let n={...e};return r.description&&(n.description=r.description),r.contentType&&(n.contentType=r.contentType),r.schema&&e.schema?n.schema=this.inferrer.mergeSchemas(e.schema,r.schema):r.schema&&(n.schema=r.schema),r.examples&&(n.examples={...e.examples||{},...r.examples}),r.content&&(n.content={...e.content||{},...r.content}),r.headers&&(n.headers={...e.headers||{},...r.headers}),n}mergeBodySchemaWithExisting(e,r){let n={...r};return r.schema?n.schema=this.inferrer.mergeSchemas(e,r.schema):n.schema=e,n}}});var M1,dy,F1,D1,j1,L1,U1,rc,qC=ae(()=>{"use strict";M1=/(?:jsonData|responseJson|data|json|body|response\.json\(\))\.([a-zA-Z_][\w.\[\]]*)/g,dy="(?:pm|hf|ctx)",F1=new RegExp(`${dy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.be\\.(?:a|an)\\(['"](\\w+)['"]\\)`,"g"),D1=new RegExp(`${dy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.(?:equal|eql)\\((.+?)\\)`,"g"),j1=/(?:to\.have\.status|response\.code.*?equal)\((\d+)\)/g,L1=new RegExp(`${dy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.be\\.(true|false)`,"g"),U1=new RegExp(`${dy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.have\\.(?:lengthOf|length\\.above|length\\.below)`,"g"),rc=class{analyze(e){let r={fieldPaths:[],typeHints:{},valueHints:{},expectedStatuses:[]};if(!e||e.trim().length===0)return r;let n=this.stripComments(e);return this.extractFieldPaths(n,r),this.extractTypeAssertions(n,r),this.extractEqualityAssertions(n,r),this.extractBooleanAssertions(n,r),this.extractLengthAssertions(n,r),this.extractStatusAssertions(n,r),r.fieldPaths=[...new Set(r.fieldPaths)],r.expectedStatuses=[...new Set(r.expectedStatuses)],r}stripComments(e){let r=e.replace(/\/\*[\s\S]*?\*\//g,"");return r=r.replace(/\/\/.*$/gm,""),r}extractFieldPaths(e,r){let n,i=new RegExp(M1.source,M1.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]);s&&!this.isCommonMethodCall(s)&&r.fieldPaths.push(s)}}extractTypeAssertions(e,r){let n,i=new RegExp(F1.source,F1.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]),o=n[2].toLowerCase();s&&(r.typeHints[s]=this.mapAssertionType(o),r.fieldPaths.includes(s)||r.fieldPaths.push(s))}}extractEqualityAssertions(e,r){let n,i=new RegExp(D1.source,D1.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]),o=n[2].trim();if(s){let l=this.parseAssertionValue(o);l!==void 0&&(r.valueHints[s]=l,typeof l=="string"?r.typeHints[s]=r.typeHints[s]||"string":typeof l=="number"?r.typeHints[s]=r.typeHints[s]||(Number.isInteger(l)?"integer":"number"):typeof l=="boolean"&&(r.typeHints[s]=r.typeHints[s]||"boolean")),r.fieldPaths.includes(s)||r.fieldPaths.push(s)}}}extractBooleanAssertions(e,r){let n,i=new RegExp(L1.source,L1.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]);s&&(r.typeHints[s]="boolean",r.valueHints[s]=n[2]==="true",r.fieldPaths.includes(s)||r.fieldPaths.push(s))}}extractLengthAssertions(e,r){let n,i=new RegExp(U1.source,U1.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]);s&&(r.typeHints[s]=r.typeHints[s]||"array",r.fieldPaths.includes(s)||r.fieldPaths.push(s))}}extractStatusAssertions(e,r){let n,i=new RegExp(j1.source,j1.flags);for(;(n=i.exec(e))!==null;){let s=parseInt(n[1],10);!isNaN(s)&&s>=100&&s<600&&r.expectedStatuses.push(s)}}normalizeFieldPath(e){let r=e.replace(/^\./,"");return r=r.replace(/\[\d+\]/g,"[]"),r}isCommonMethodCall(e){return new Set(["to","be","have","not","deep","any","all","that","is","has","include","includes","equal","eql","above","below","least","most","within","length","lengthOf","match","string","keys","key","property","ownProperty","status","header","json","text"]).has(e.split(".")[0])}mapAssertionType(e){return{string:"string",number:"number",object:"object",array:"array",boolean:"boolean",null:"null",undefined:"null",int:"integer",integer:"integer",float:"number",double:"number"}[e]||"string"}parseAssertionValue(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let r=Number(e);return!isNaN(r)&&e.trim().length>0?r:e==="true"?!0:e==="false"?!1:e==="null"?null:e}}});var H1={};io(H1,{AwsSecretResolver:()=>py});var py,OC=ae(()=>{"use strict";py=class{providerName="aws";region;moduleRequire;constructor(e,r){this.region=e.region??process.env.AWS_DEFAULT_REGION??process.env.AWS_REGION,this.moduleRequire=r??(n=>_t(n))}async resolve(e){let r=e.lastIndexOf("#"),n=r>=0?e.slice(0,r):e,i=r>=0?e.slice(r+1):void 0;try{let{SecretsManagerClient:s,GetSecretValueCommand:o}=this.moduleRequire("@aws-sdk/client-secrets-manager"),c=await new s(this.region?{region:this.region}:{}).send(new o({SecretId:n})),d=c.SecretString??(c.SecretBinary?Buffer.from(c.SecretBinary).toString("utf-8"):void 0);if(d===void 0)return;if(i)try{let p=JSON.parse(d);return p[i]!==void 0?String(p[i]):void 0}catch{return}return d}catch(s){throw s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND"?new Error("[HTTP Forge] AWS secret resolver requires @aws-sdk/client-secrets-manager. Install it in your project: npm install @aws-sdk/client-secrets-manager"):s}}}});var B1={};io(B1,{AzureKeyVaultResolver:()=>hy});var hy,IC=ae(()=>{"use strict";hy=class{providerName="azure";vaultUrl;moduleRequire;constructor(e,r){let n=(e.vaultUrl||process.env.AZURE_KEYVAULT_URL)??"";this.vaultUrl=n.replace(/\/$/,""),this.moduleRequire=r??(i=>_t(i))}async resolve(e){if(!this.vaultUrl)throw new Error("[HTTP Forge] Azure Key Vault resolver: no vault URL configured. Set secrets.providers.<alias>.vaultUrl or the AZURE_KEYVAULT_URL env var.");let r=e.split("/"),n=r[0],i=r[1];try{let{SecretClient:s}=this.moduleRequire("@azure/keyvault-secrets"),{DefaultAzureCredential:o}=this.moduleRequire("@azure/identity"),l=new o;return(await new s(this.vaultUrl,l).getSecret(n,i?{version:i}:{})).value}catch(s){throw s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND"?new Error("[HTTP Forge] Azure Key Vault resolver requires @azure/keyvault-secrets and @azure/identity. Install them: npm install @azure/keyvault-secrets @azure/identity"):s}}}});var V1={};io(V1,{HashiCorpVaultResolver:()=>my});var my,PC=ae(()=>{"use strict";my=class{providerName="vault";address;mountPath;namespace;constructor(e){this.address=(e.address??process.env.VAULT_ADDR??"http://127.0.0.1:8200").replace(/\/$/,""),this.mountPath=e.mountPath??"secret",this.namespace=e.namespace??process.env.VAULT_NAMESPACE}async resolve(e){let r=e.lastIndexOf("#"),n=r>=0?e.slice(0,r):e,i=r>=0?e.slice(r+1):void 0,s=process.env.VAULT_TOKEN;if(!s)throw new Error("[HTTP Forge] HashiCorp Vault resolver requires VAULT_TOKEN environment variable to be set.");let o=`${this.address}/v1/${this.mountPath}/data/${n}`,l={"X-Vault-Token":s};this.namespace&&(l["X-Vault-Namespace"]=this.namespace);let c;try{c=await fetch(o,{headers:l})}catch(y){throw new Error(`[HTTP Forge] Vault request failed: ${y?.message??y}`)}if(c.status===404)return;if(!c.ok)throw new Error(`[HTTP Forge] Vault returned HTTP ${c.status} for path: ${n}`);let p=(await c.json())?.data?.data;if(!p)return;if(i)return p[i]!==void 0?String(p[i]):void 0;if("value"in p)return String(p.value);let m=Object.keys(p);return m.length===1?String(p[m[0]]):void 0}}});var W1={};io(W1,{OnePasswordResolver:()=>gy});import{execFile as l5}from"child_process";import{promisify as u5}from"util";var c5,gy,kC=ae(()=>{"use strict";c5=u5(l5),gy=class{providerName="1password";defaultVault;constructor(e){this.defaultVault=e.vault}async resolve(e){let r=e.split("/"),n,i,s;if(this.defaultVault){if(r.length<2)throw new Error(`[HTTP Forge] 1Password path "${e}" must be "<item>/<field>" when vault is set in config.`);n=this.defaultVault,i=r.slice(0,r.length-1).join("/"),s=r[r.length-1]}else{if(r.length<3)throw new Error(`[HTTP Forge] 1Password path "${e}" must be "<vault>/<item>/<field>".`);n=r[0],i=r.slice(1,r.length-1).join("/"),s=r[r.length-1]}let o=await this.tryResolveSdk(n,i,s);return o!==null?o:this.resolveViaCli(n,i,s)}async tryResolveSdk(e,r,n){let i=process.env.OP_SERVICE_ACCOUNT_TOKEN;if(!i)return null;try{let{createClient:s}=_t("@1password/sdk"),o=await s({auth:i,integrationName:"HTTP Forge",integrationVersion:"1.0.0"}),l=`op://${e}/${r}/${n}`;return await o.secrets.resolve(l)}catch(s){if(s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND")return null;throw new Error(`[HTTP Forge] 1Password SDK error for "${e}/${r}/${n}": ${s?.message??s}`)}}async resolveViaCli(e,r,n){try{let{stdout:i}=await c5("op",["item","get",r,"--vault",e,"--field",n,"--format","json"],{env:{...process.env},timeout:1e4}),s=JSON.parse(i.trim());return typeof s=="string"?s:s&&typeof s.value=="string"?s.value:void 0}catch(i){if(i?.code==="ENOENT")throw new Error("[HTTP Forge] 1Password resolver requires either the @1password/sdk npm package or the `op` CLI to be installed.\n Service Account: set OP_SERVICE_ACCOUNT_TOKEN and install @1password/sdk\n CLI: install 1Password CLI and run `op signin`");if(i?.stderr?.includes("not found")||i?.code===1)return;throw new Error(`[HTTP Forge] 1Password CLI error: ${i?.message??i}`)}}}});var z1={};io(z1,{GcpSecretResolver:()=>yy});var yy,AC=ae(()=>{"use strict";yy=class{providerName="gcp";projectId;moduleRequire;constructor(e,r){this.projectId=e.projectId??process.env.GOOGLE_CLOUD_PROJECT??process.env.GCLOUD_PROJECT??process.env.GCP_PROJECT,this.moduleRequire=r??(n=>_t(n))}async resolve(e){let r=e.split("/"),n=r[0],i=r[1]==="versions"&&r[2]?r[2]:"latest";if(!this.projectId)throw new Error("[HTTP Forge] GCP secret resolver: no projectId configured and GOOGLE_CLOUD_PROJECT env var is not set.");try{let{SecretManagerServiceClient:s}=this.moduleRequire("@google-cloud/secret-manager"),o=new s,l=`projects/${this.projectId}/secrets/${n}/versions/${i}`,[c]=await o.accessSecretVersion({name:l}),d=c.payload?.data;return d?Buffer.isBuffer(d)?d.toString("utf-8"):Buffer.from(d).toString("utf-8"):void 0}catch(s){throw s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND"?new Error("[HTTP Forge] GCP secret resolver requires @google-cloud/secret-manager. Install it: npm install @google-cloud/secret-manager"):s}}}});var G1={};io(G1,{DopplerResolver:()=>vy});import*as J1 from"https";var vy,TC=ae(()=>{"use strict";vy=class{providerName="doppler";token;constructor(e){this.token=e.serviceToken??process.env.DOPPLER_TOKEN}async resolve(e){let r=e.trim().toUpperCase(),n=this.token;if(!n)throw new Error("[HTTP Forge] Doppler secret resolver: no service token found. Set DOPPLER_TOKEN env var or add serviceToken to config.");let i=`https://api.doppler.com/v3/configs/config/secret?name=${encodeURIComponent(r)}`;return new Promise((s,o)=>{let l=J1.request(i,{method:"GET",headers:{Authorization:`Bearer ${n}`,Accept:"application/json"}},c=>{let d=[];c.on("data",p=>d.push(p)),c.on("end",()=>{let p=Buffer.concat(d).toString("utf-8");if(c.statusCode===404){s(void 0);return}if(c.statusCode!==200){o(new Error(`[HTTP Forge] Doppler API returned ${c.statusCode} for secret "${r}": ${p}`));return}try{let y=JSON.parse(p)?.value?.computed;s(y!=null?String(y):void 0)}catch{o(new Error(`[HTTP Forge] Doppler API returned non-JSON response for secret "${r}"`))}})});l.on("error",o),l.end()})}}});import*as by from"fs";import{createRequire as f5}from"module";import*as Y1 from"path";var tp,$C=ae(()=>{"use strict";tp=class{resolvers=new Map;moduleRequire;constructor(e){if(this.moduleRequire=this.buildModuleRequire(e),!e)return;let r;try{r=e.getConfig().secrets}catch{return}if(!(!r?.providers||typeof r.providers!="object"))for(let[n,i]of Object.entries(r.providers))try{let s=this.createResolver(i);s&&this.resolvers.set(n,s)}catch{}}async resolveSecretTokens(e,r){let n=r??new Map,i=new Set;if(this.collectTokens(e,i),i.size===0)return{};await Promise.all(Array.from(i).map(async o=>{if(n.has(o))return;let l=o.slice(7),c=l.indexOf("/");if(c<0)return;let d=l.slice(0,c),p=l.slice(c+1),m=this.resolvers.get(d);if(m)try{let y=await m.resolve(p);y!==void 0&&n.set(o,y)}catch(y){let b=y?.message??String(y);console.warn(`[HTTP Forge] {{${o}}} could not be resolved: ${b}`)}}));let s={};for(let[o,l]of n.entries())s[o]=l;return s}get hasProviders(){return this.resolvers.size>0}collectTokens(e,r){if(typeof e=="string"){let n=/\{\{(secret:[^}]+)\}\}/g,i;for(;(i=n.exec(e))!==null;)r.add(i[1])}else Array.isArray(e)?e.forEach(n=>this.collectTokens(n,r)):e!==null&&typeof e=="object"&&Object.values(e).forEach(n=>this.collectTokens(n,r))}createResolver(e){switch(e.provider){case"aws":{let{AwsSecretResolver:r}=(OC(),Ql(H1));return new r(e,this.moduleRequire)}case"azure":{let{AzureKeyVaultResolver:r}=(IC(),Ql(B1));return new r(e,this.moduleRequire)}case"vault":{let{HashiCorpVaultResolver:r}=(PC(),Ql(V1));return new r(e)}case"1password":{let{OnePasswordResolver:r}=(kC(),Ql(W1));return new r(e)}case"gcp":{let{GcpSecretResolver:r}=(AC(),Ql(z1));return new r(e,this.moduleRequire)}case"doppler":{let{DopplerResolver:r}=(TC(),Ql(G1));return new r(e)}default:return}}buildModuleRequire(e){let r=i=>_t(i);if(!e)return r;let n=[];try{n=e.getModulePaths()??[]}catch{return r}for(let i of n)try{let s=Y1.resolve(i,"package.json");if(by.existsSync(s)){let o=by.realpathSync(s),l=f5(o);return c=>{try{return l(c)}catch{return r(c)}}}}catch{}return r}}});function Ir(t){return t.replace(/\//g,"%2F")}function K1(t){return t.replace(/%2F/gi,"/")}function Ts(t){return t?t.split("/").map(K1).join(" / "):""}function Sy(t){return t.includes(" / ")?t.split(" / ").map(e=>Ir(e.trim())).join("/"):Ir(t)}function ot(t,e=t.items,r=""){let n=[];for(let i of e)if(i.type==="request")n.push({request:i,folderPath:r});else{let s=i,o=Ir(s.name),l=r?`${r}/${o}`:o;n.push(...ot(t,s.items??[],l))}return n}function un(t,e=t.items,r=""){let n=[];for(let i of e)if(i.type==="folder"){let s=i,o=Ir(s.name),l=r?`${r}/${o}`:o;n.push({folderId:s.id,folderPath:l,requestCount:NC(s.items??[])}),n.push(...un(t,s.items??[],l))}return n}function NC(t){let e=0;for(let r of t)r.type==="request"?e++:e+=NC(r.items??[]);return e}var Ei=ae(()=>{"use strict"});var tl,MC=ae(()=>{"use strict";tl={iterations:1,delayBetweenRequests:0,stopOnError:!1,readFromSharedSession:!1,writeToSharedSession:!1}});import*as bt from"fs";import*as qi from"path";var rp,FC=ae(()=>{"use strict";Ei();jn();MC();rp=class{constructor(e,r,n){this.collectionService=e;this.configService=r;this.suitesDir=r.getSuitesPath(),this.onSuitesChanged=n?.onSuitesChanged,this.ensureSuitesDir(),this.loadSuites(),n?.watch!==!1&&this.setupFileWatcher()}collectionService;configService;suitesDir;suites=new Map;fileWatcher=null;debounceTimer=null;onSuitesChanged;ensureSuitesDir(){bt.existsSync(this.suitesDir)||bt.mkdirSync(this.suitesDir,{recursive:!0})}setupFileWatcher(){try{this.fileWatcher=bt.watch(this.suitesDir,(e,r)=>{r&&!r.endsWith(".suite.json")||(this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.loadSuites(),this.onSuitesChanged?.()},200))}),this.fileWatcher.on("error",()=>{})}catch{}}dispose(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.fileWatcher?.close(),this.fileWatcher=null}loadSuites(){if(this.suites.clear(),!bt.existsSync(this.suitesDir))return;let e=bt.readdirSync(this.suitesDir);for(let r of e)if(r.endsWith(".suite.json"))try{let n=qi.join(this.suitesDir,r),i=bt.readFileSync(n,"utf-8"),s=JSON.parse(i),o=Array.isArray(s.nodes)&&s.nodes.length>0?s.nodes:(Array.isArray(s.requests)?s.requests:[]).map(c=>({type:"request",name:c.description||c.name,request:c,enabled:c.enabled!==!1})),l={id:s.id,name:s.name,description:s.description,scripts:s.scripts,nodes:o,config:s.config??{...tl},isTemporary:s.isTemporary,createdAt:s.createdAt??Date.now(),updatedAt:s.updatedAt??Date.now()};l.id&&l.name&&this.suites.set(l.id,l)}catch(n){console.error(`[TestSuiteService] Failed to load ${r}:`,n)}}async getAllSuites(){return Array.from(this.suites.values())}async getSuite(e){return this.suites.get(e)}async createSuite(e){let r=Date.now(),n={id:Pt(e),name:e,nodes:[],config:{...tl},createdAt:r,updatedAt:r};return await this.saveSuiteToDisk(n),this.suites.set(n.id,n),n}async updateSuite(e){e.updatedAt=Date.now(),await this.saveSuiteToDisk(e),this.suites.set(e.id,e)}async duplicateSuite(e,r){let n=this.suites.get(e);if(!n)throw new Error(`Suite not found: ${e}`);let i=n.nodes||[],s=await this.createSuite(r);s.nodes=i.map(c=>({...c})),s.config={...n.config},s.description=n.description;let o=qi.join(this.suitesDir,e),l=qi.join(this.suitesDir,s.id);return bt.existsSync(o)&&this.copyDirRecursive(o,l),await this.saveSuiteToDisk(s),this.suites.set(s.id,s),s}copyDirRecursive(e,r){bt.existsSync(r)||bt.mkdirSync(r,{recursive:!0});for(let n of bt.readdirSync(e,{withFileTypes:!0})){let i=qi.join(e,n.name),s=qi.join(r,n.name);n.isDirectory()?this.copyDirRecursive(i,s):bt.copyFileSync(i,s)}}async deleteSuite(e){let r=this.suites.get(e);if(!r)return!1;let n=`${r.id}.suite.json`,i=qi.join(this.suitesDir,n),s=qi.join(this.suitesDir,r.id);try{return bt.existsSync(i)&&bt.unlinkSync(i),bt.existsSync(s)&&bt.rmSync(s,{recursive:!0,force:!0}),this.suites.delete(e),!0}catch(o){return console.error("[TestSuiteService] Failed to delete suite:",o),!1}}async createTempSuiteFromCollection(e){let r=this.collectionService.getCollection(e);if(!r){console.error(`[TestSuiteService] Collection not found: ${e}`);return}let n=[];this.extractRequestsFromCollection(r,e,r.name,"",n);let i=n.map(l=>({type:"request",name:l.description||l.name,request:l,enabled:l.enabled!==!1})),s=Date.now();return{id:`temp-${e}`,name:r.name,nodes:i,config:{...tl},isTemporary:!0,createdAt:s,updatedAt:s}}async createTempSuiteFromFolder(e,r,n=!0){let i=this.collectionService.getCollection(e);if(!i){console.error(`[TestSuiteService] Collection not found: ${e}`);return}let s=[];this.extractRequestsFromCollection(i,e,i.name,"",s);let o=r.replace(/\/+$/,""),l=s.filter(m=>n?m.folderPath===o||m.folderPath.startsWith(`${o}/`):m.folderPath===o);if(l.length===0){console.error(`[TestSuiteService] No requests under folder "${r}" in collection: ${e}`);return}let c=l.map(m=>({type:"request",name:m.description||m.name,request:m,enabled:m.enabled!==!1})),d=Date.now();return{id:`temp-${e}-${this.slugifyFolderPath(o)}`,name:`${i.name} / ${Ts(o)}`,nodes:c,config:{...tl},isTemporary:!0,createdAt:d,updatedAt:d}}slugifyFolderPath(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}async saveTempSuite(e,r){let n=Date.now(),i=qi.join(this.suitesDir,e.id),s={...e,id:Pt(r),name:r,isTemporary:!1,createdAt:n,updatedAt:n},o=qi.join(this.suitesDir,s.id);return bt.existsSync(i)&&(bt.existsSync(o)&&bt.rmSync(o,{recursive:!0,force:!0}),bt.renameSync(i,o)),await this.saveSuiteToDisk(s),this.suites.set(s.id,s),s}getAllAvailableRequests(){let e=[],r=this.collectionService.getAllCollections();for(let n of r)this.extractRequestsFromCollection(n,n.id,n.name,"",e);return e}extractRequestsFromCollection(e,r,n,i,s){if(e.requests)for(let o of e.requests)s.push({collectionId:r,collectionName:n,requestId:o.id,name:o.name||"Unnamed Request",method:o.method||"GET",folderPath:i});if(e.items)for(let o of e.items)if(o.items||o.folders||o.requests){let l=i?`${i}/${Ir(o.name)}`:Ir(o.name);this.extractRequestsFromCollection(o,r,n,l,s)}else s.push({collectionId:r,collectionName:n,requestId:o.id,name:o.name||"Unnamed Request",method:o.method||"GET",folderPath:i});if(e.folders)for(let o of e.folders){let l=i?`${i}/${Ir(o.name)}`:Ir(o.name);this.extractRequestsFromCollection(o,r,n,l,s)}}async saveSuiteToDisk(e){this.ensureSuitesDir();let r=`${e.id}.suite.json`,n=qi.join(this.suitesDir,r),i=`${n}.tmp-${process.pid}-${Date.now()}`,s={id:e.id,name:e.name,description:e.description,scripts:e.scripts,nodes:Array.isArray(e.nodes)?e.nodes:[],config:e.config??{...tl},isTemporary:e.isTemporary,createdAt:e.createdAt??Date.now(),updatedAt:e.updatedAt??Date.now()},o=JSON.stringify(s,null,2);bt.writeFileSync(i,o,"utf-8"),bt.renameSync(i,n)}}});var oe,wy=ae(()=>{"use strict";oe={Config:Symbol.for("IConfigService"),Console:Symbol.for("IConsoleService"),EnvironmentConfig:Symbol.for("IEnvironmentConfigService"),Collection:Symbol.for("ICollectionService"),HttpRequest:Symbol.for("IHttpRequestService"),HttpClient:Symbol.for("IHttpClient"),Cookie:Symbol.for("ICookieService"),RequestHistory:Symbol.for("IRequestHistoryService"),TestSuite:Symbol.for("ITestSuiteService"),UrlBuilder:Symbol.for("IUrlBuilder"),RequestPreprocessor:Symbol.for("IRequestPreprocessor"),RequestPreparer:Symbol.for("IRequestPreparer"),InterceptorChain:Symbol.for("IInterceptorChain"),ScriptExecutor:Symbol.for("IScriptExecutor"),DataFileParser:Symbol.for("IDataFileParser"),CollectionRequestExecutor:Symbol.for("ICollectionRequestExecutor"),WorkspaceFolder:Symbol.for("WorkspaceFolder"),PersistentCookieJar:Symbol.for("PersistentCookieJar"),OAuth2TokenManager:Symbol.for("IOAuth2TokenManager"),GraphQLSchemaService:Symbol.for("IGraphQLSchemaService"),SchemaInferrer:Symbol.for("SchemaInferrer"),HistoryAnalyzer:Symbol.for("HistoryAnalyzer"),ScriptAnalyzer:Symbol.for("ScriptAnalyzer"),SchemaInferenceService:Symbol.for("SchemaInferenceService"),OpenApiExporter:Symbol.for("OpenApiExporter"),OpenApiImporter:Symbol.for("OpenApiImporter"),SecretResolverRegistry:Symbol.for("SecretResolverRegistry")}});import*as Q1 from"path";function _y(t,e){let{workspaceFolder:r,fileWatcherFactory:n,notificationService:i,workspaceStore:s,globalStore:o,secretStore:l,browserService:c,applicationInfo:d,consoleService:p}=e;t.registerValue(oe.WorkspaceFolder,r),t.registerSingleton(oe.Config,()=>new vo(r,n,i)),t.registerSingleton(oe.Console,()=>p??d5),t.registerSingleton(oe.EnvironmentConfig,y=>new rd(r,s,y.resolve(oe.Config),n,l,e.persistOverrides??!0)),t.registerSingleton(oe.Cookie,()=>new Xf(o)),t.registerSingleton(oe.Collection,y=>new Zf(r,y.resolve(oe.Config),n)),t.registerSingleton(oe.TestSuite,y=>new rp(y.resolve(oe.Collection),y.resolve(oe.Config))),t.registerSingleton(oe.HttpClient,y=>{let b=y.resolve(oe.Config);return new Na(b.getRequestConfig(),r)}),t.registerSingleton(oe.UrlBuilder,()=>new li),t.registerSingleton(oe.InterceptorChain,()=>new bs),t.registerSingleton(oe.HttpRequest,y=>new vs(y.resolve(oe.UrlBuilder),y.resolve(oe.InterceptorChain),y.resolve(oe.HttpClient))),t.registerSingleton(oe.RequestPreprocessor,()=>new Ma),t.registerSingleton(oe.RequestHistory,y=>{let b=y.resolve(oe.EnvironmentConfig);return new ad(b.getHistoriesPath(),Q1.join(b.getRootPath(),"shared-histories"))}),l&&c&&t.registerSingleton(oe.OAuth2TokenManager,y=>new Yf(l,c,y.resolve(oe.EnvironmentConfig),y.resolve(oe.HttpRequest))),t.registerSingleton(oe.GraphQLSchemaService,y=>new id(y.resolve(oe.HttpClient))),t.registerSingleton(oe.SecretResolverRegistry,y=>new tp(y.resolve(oe.Config)));let m=d??{name:"HttpForge",version:"0.0.0"};t.registerSingleton(oe.RequestPreparer,y=>new nd(y.resolve(oe.EnvironmentConfig),y.resolve(oe.HttpRequest),y.resolve(oe.RequestPreprocessor),y.has(oe.OAuth2TokenManager)?y.resolve(oe.OAuth2TokenManager):void 0,m,y.resolve(oe.SecretResolverRegistry))),t.registerSingleton(oe.ScriptExecutor,y=>{let b=y.resolve(oe.Config);return new Cs(y.resolve(oe.HttpRequest),b.getModulePaths(),y.resolve(oe.SecretResolverRegistry),b.getScriptScope(),b.getScriptTimeout())}),t.registerSingleton(oe.DataFileParser,()=>new Da),t.registerSingleton(oe.CollectionRequestExecutor,y=>new bo(y.resolve(oe.HttpRequest),y.resolve(oe.ScriptExecutor),y.resolve(oe.EnvironmentConfig),y.resolve(oe.RequestPreparer),"")),t.registerSingleton(oe.PersistentCookieJar,y=>new ed(y.resolve(oe.Cookie))),t.registerSingleton(oe.SchemaInferrer,()=>new ko),t.registerSingleton(oe.HistoryAnalyzer,y=>new Eu(y.resolve(oe.RequestHistory),y.resolve(oe.SchemaInferrer))),t.registerSingleton(oe.ScriptAnalyzer,()=>new rc),t.registerSingleton(oe.SchemaInferenceService,y=>new tc(y.resolve(oe.HistoryAnalyzer),y.resolve(oe.ScriptAnalyzer),y.resolve(oe.SchemaInferrer))),t.registerSingleton(oe.OpenApiExporter,y=>new Du(y.resolve(oe.Collection),y.resolve(oe.EnvironmentConfig),y.resolve(oe.SchemaInferenceService))),t.registerSingleton(oe.OpenApiImporter,y=>new Fo(y.resolve(oe.Collection),y.resolve(oe.EnvironmentConfig)))}var d5,DC=ae(()=>{"use strict";u0();h0();km();g0();y0();b0();Tm();S0();w0();O0();cf();ff();Jf();qm();Xl();I0();cR();fy();EC();Ng();qC();Om();Vf();$C();FC();wy();d5={log:()=>{},trace:()=>{},debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},logBatch:()=>{},logRawLines:()=>{},show:()=>{},clear:()=>{},dispose:()=>{}}});function Z1(){return rl.instance}var rl,jC=ae(()=>{"use strict";wy();rl=class t{static _instance;services=new Map;primitives=new Map;constructor(){}static get instance(){return t._instance||(t._instance=new t),t._instance}static createFresh(){return new t}static reset(){t._instance&&t._instance.clear(),t._instance=void 0}registerValue(e,r){return this.primitives.set(e,r),this}registerSingleton(e,r){return this.services.set(e,{factory:r,singleton:!0}),this}registerTransient(e,r){return this.services.set(e,{factory:r,singleton:!1}),this}registerInstance(e,r){return this.services.set(e,{factory:()=>r,singleton:!0,instance:r}),this}resolve(e){if(this.primitives.has(e))return this.primitives.get(e);let r=this.services.get(e);if(!r)throw new Error(`Service not registered: ${e.toString()}`);return r.singleton?(r.instance||(r.instance=r.factory(this)),r.instance):r.factory(this)}has(e){return this.services.has(e)||this.primitives.has(e)}clear(){this.services.clear(),this.primitives.clear()}get config(){return this.resolve(oe.Config)}get console(){return this.resolve(oe.Console)}get environmentConfig(){return this.resolve(oe.EnvironmentConfig)}get collection(){return this.resolve(oe.Collection)}get httpRequest(){return this.resolve(oe.HttpRequest)}get httpClient(){return this.resolve(oe.HttpClient)}get cookie(){return this.resolve(oe.Cookie)}get requestHistory(){return this.resolve(oe.RequestHistory)}get dataFileParser(){return this.resolve(oe.DataFileParser)}get scriptExecutor(){return this.resolve(oe.ScriptExecutor)}get requestPreparer(){return this.resolve(oe.RequestPreparer)}get persistentCookieJar(){return this.resolve(oe.PersistentCookieJar)}get oauth2TokenManager(){return this.has(oe.OAuth2TokenManager)?this.resolve(oe.OAuth2TokenManager):void 0}get graphqlSchemaService(){return this.resolve(oe.GraphQLSchemaService)}get testSuite(){return this.resolve(oe.TestSuite)}}});function X1(t){return/\{\{[^}]+\}\}/.test(t)}function np(t,e=16){return!!t&&t.length>=e&&!X1(t)}function LC(t){return t.toUpperCase().replace(/[^A-Z0-9]/g,"_")}function ip(t,e,r,n,i,s=10){let o=t.get(e);o||(o={varName:r,reason:n,occurrences:[],priority:s},t.set(e,o));let l=`${i.requestId}::${i.field}`;o.occurrences.some(c=>`${c.requestId}::${c.field}`===l)||o.occurrences.push(i)}function Ry(t,e=1){let r=ot(t),n=new Map;for(let{request:s}of r){let o=l=>({requestId:s.id,requestName:s.name,field:l});for(let l of s.headers??[]){if(l.enabled===!1)continue;let c=l.key.toLowerCase(),d=l.value;if(c==="authorization"){let p=d.match(/^(bearer|basic|token|digest)\s+(.+)$/i);p&&np(p[2])?ip(n,p[2],`${p[1].toUpperCase()}_TOKEN`,`Authorization ${p[1]} token`,o(`header:${l.key}`),1):np(d)&&ip(n,d,"AUTH_TOKEN","Authorization header value",o(`header:${l.key}`),1)}else p5.has(c)&&np(d)?ip(n,d,LC(l.key),`Sensitive header: ${l.key}`,o(`header:${l.key}`),2):np(d,20)&&!d.includes(" ")&&/^[A-Za-z0-9+/=_.-]+$/.test(d)&&ip(n,d,LC(l.key)||"HEADER_VALUE",`Long opaque value in header: ${l.key}`,o(`header:${l.key}`),5)}for(let l of s.query??[])l.enabled!==!1&&h5.has(l.key.toLowerCase())&&np(l.value)&&ip(n,l.value,LC(l.key),`Sensitive query param: ${l.key}`,o(`query:${l.key}`),2)}let i=new Map;for(let{request:s}of r)if(!(!s.url||X1(s.url)))try{let o=new URL(s.url);if(!["localhost","127.0.0.1","0.0.0.0","::1"].includes(o.hostname)){let c=`${o.protocol}//${o.host}`,d=i.get(c)??[];d.push({requestId:s.id,requestName:s.name,field:"url"}),i.set(c,d)}}catch{}for(let[s,o]of i)o.length>=Math.max(e,2)&&!n.has(s)&&n.set(s,{varName:"BASE_URL",reason:`Shared base URL across ${o.length} requests`,occurrences:o,priority:3});return[...n.entries()].filter(([,s])=>s.occurrences.length>=e).sort((s,o)=>s[1].priority-o[1].priority||s[0].localeCompare(o[0])).map(([s,o])=>({varName:o.varName,value:s,reason:o.reason,occurrences:o.occurrences}))}function UC(t,e){let r={};return eN(t,e,r),r}function eN(t,e,r){for(let n of t){if(n.type==="folder"){n.items&&eN(n.items,e,r);continue}let i=n;for(let s of e){let o=`{{${s.varName}}}`;i.url?.includes(s.value)&&(i.url=i.url.split(s.value).join(o),r[s.varName]=(r[s.varName]??0)+1);for(let l of i.headers??[]){let c=l.value.match(/^(bearer|basic|token|digest)\s+(.+)$/i);c&&c[2]===s.value?(l.value=`${c[1]} ${o}`,r[s.varName]=(r[s.varName]??0)+1):l.value===s.value&&(l.value=o,r[s.varName]=(r[s.varName]??0)+1)}for(let l of i.query??[])l.value===s.value&&(l.value=o,r[s.varName]=(r[s.varName]??0)+1)}}}var p5,h5,HC=ae(()=>{"use strict";Ei();p5=new Set(["x-api-key","x-auth-token","x-access-token","x-token","x-secret","api-key","apikey","x-client-secret","x-rapidapi-key"]),h5=new Set(["api_key","apikey","api-key","access_token","token","auth_token","client_id","client_secret","key","secret"])});function Vr(t,e){let r={type:"string",description:t};return e.length>0&&(r.enum=[...e]),r}function BC(t,e,r){let n=i=>Vr("Name of the collection to act on."+(i?"":" Optional."),e);return[{name:`${t}${G.listCollections}`,description:"List all available HTTP Forge collections (name, description, and request count). Call this first to discover what collections exist, then use list_folders, list_requests or run_* tools.",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.listFolders}`,description:"List all folders in a collection with their full paths and request counts. Use this before run_folder to discover the exact folder path string to pass.",inputSchema:{type:"object",properties:{collection:n(!0)},required:["collection"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.listRequests}`,description:"List the saved requests in a collection (name, HTTP method, folder, and description). Use this to find the exact request name before calling run_request. For large collections use the folder filter and offset/limit to page through results.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:'Optional folder path to filter by (e.g. "Auth").'},offset:{type:"number",description:"Zero-based index to start from (default: 0)."},limit:{type:"number",description:"Maximum number of results to return (default: 50, max: 200)."}},required:["collection"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.searchRequests}`,description:"Search for requests across a collection by name, URL, method, or folder path. Returns matching requests with their folder location. Useful for large collections.",inputSchema:{type:"object",properties:{collection:n(!0),query:{type:"string",description:"Text to search for in request names, URLs, methods, and folder paths (case-insensitive)."}},required:["collection","query"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getRequest}`,description:"Get the full details of a single saved request: URL, method, headers, body, auth, and scripts. Use this to inspect a request before editing it, or to read a script before rewriting it.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id. Use list_requests to find names."}},required:["collection","request"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getEnvironment}`,description:"Show the current environment variable values (merged initial + runtime pm.environment.set overrides). Use this to inspect variable state before running a folder, or to debug {{variable}} resolution failures.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name to inspect (defaults to the currently selected environment)."}}},annotations:{readOnlyHint:!0}},{name:`${t}${G.setVariable}`,description:'Override an environment variable for the current session. In the VS Code extension the change is saved to VS Code workspace storage (survives restarts, but is not in the env JSON file and not source-controlled). In the standalone CLI/core runtime the change is in-memory only and lost when the server restarts. Use set_environment_variable with scope:"permanent" to write to the env JSON file (source-controlled, works in both runtimes).',inputSchema:{type:"object",properties:{key:{type:"string",description:"Variable name (the part inside {{...}})."},value:{type:"string",description:"New value to set."},environment:{type:"string",description:"Environment to update (defaults to the currently selected environment)."}},required:["key","value"]},annotations:{idempotentHint:!0}},{name:`${t}${G.getRunStatus}`,description:"Check whether an async run is still running, completed, or failed. Poll this after calling run_folder/run_collection/run_suite with async:true.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."}},required:["runId"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getRunSummary}`,description:'Get the pass/fail summary of a completed async run (total, passed, failed counts). Use after get_run_status shows "completed". When failures are present the response includes a failedRequests array with full details (method, url, requestBody, status, responseBody, failedTests) and a _nextStep directive. You MUST follow the _nextStep directive immediately \u2014 analyze the failures and provide diagnosis without waiting for the user to ask.',inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."}},required:["runId"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getFailedRequests}`,description:"Get the list of failed requests from a completed async run \u2014 the failures-first view. Never returns passing requests. Use this instead of get_run_summary when you need to see what broke.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."},offset:{type:"number",description:"Zero-based index to start from (default: 0)."},limit:{type:"number",description:"Maximum failures to return (default: 20, max: 100)."}},required:["runId"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getRequestResult}`,description:"Get the full result (status, body, assertions, console output) for one specific request from an async run. Use after get_failed_requests to drill into a single failure.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."},request:{type:"string",description:"Name of the request to look up."},iteration:{type:"number",description:"Iteration number (default: 1)."}},required:["runId","request"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.cancelRun}`,description:'Request cancellation of an in-progress async run. Cancellation is best-effort: the currently-executing HTTP request completes normally, but no further requests in the run are started. The run status changes to "cancelled". Has no effect on runs that are already completed, failed, or cancelled.',inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by run_collection, run_folder, or run_suite with async:true."}},required:["runId"]},annotations:{idempotentHint:!0}},{name:`${t}${G.runRequest}`,description:"Run a single saved request. Pick the collection, then the request name within it.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Name of the request to run. Use list_requests or search_requests to find names."},requestId:{type:"string",description:'ID of the request (from list_requests/search_requests). Preferred over "request" name when available \u2014 avoids ambiguity with duplicate names.'},...Cy.properties},required:["collection","request"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.runFolder}`,description:"Run every request inside a folder of a collection.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:'Folder path within the collection (e.g. "Auth/Login").'},...Ey.properties},required:["collection","folder"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.runCollection}`,description:"Run every request in a collection.",inputSchema:{type:"object",properties:{collection:n(!0),...xy.properties},required:["collection"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.runSuite}`,description:"Run a saved test suite.",inputSchema:{type:"object",properties:{suite:Vr("Name of the test suite to run.",r),...qy.properties},required:["suite"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.createCollection}`,description:"Create a new empty collection.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Display name for the new collection."}},required:["name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.renameCollection}`,description:"Rename an existing collection.",inputSchema:{type:"object",properties:{collection:n(!0),newName:{type:"string",description:"New display name for the collection."}},required:["collection","newName"]},annotations:{idempotentHint:!0}},{name:`${t}${G.deleteCollection}`,description:"Permanently delete a collection and all its contents. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{collection:n(!0),confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["collection","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.duplicateCollection}`,description:"Clone a collection under a new name (all folders, requests, and scripts are copied).",inputSchema:{type:"object",properties:{collection:n(!0),newName:{type:"string",description:"Name for the duplicated collection."}},required:["collection","newName"]},annotations:{idempotentHint:!1}},{name:`${t}${G.createFolder}`,description:"Create a folder inside a collection (optionally nested inside another folder).",inputSchema:{type:"object",properties:{collection:n(!0),name:{type:"string",description:"Display name for the new folder."},parentFolder:{type:"string",description:"Slash-separated folder path or folder id of the parent. Omit to create at collection root."}},required:["collection","name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.deleteFolder}`,description:"Delete a folder and all its requests. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:"Slash-separated folder path or folder id to delete."},confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["collection","folder","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.createRequest}`,description:"Create a new HTTP request inside a collection (optionally inside a folder).",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:"Folder path or id. Omit to add at collection root."},name:{type:"string",description:"Display name for the request."},method:{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],description:"HTTP method."},url:{type:"string",description:"Request URL, may include {{variable}} placeholders."},headers:{type:"object",description:"Key/value header map.",additionalProperties:{type:"string"}},body:{type:"string",description:"Raw request body (JSON, text, etc.)."},description:{type:"string",description:"Human-readable description."}},required:["collection","name","method","url"]},annotations:{idempotentHint:!1}},{name:`${t}${G.updateRequest}`,description:"Update fields on an existing request (partial update \u2014 omit fields to keep current values).",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id."},name:{type:"string",description:"New display name."},method:{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]},url:{type:"string"},headers:{type:"object",additionalProperties:{type:"string"}},body:{type:"string"},description:{type:"string"}},required:["collection","request"]},annotations:{idempotentHint:!0}},{name:`${t}${G.deleteRequest}`,description:"Remove a request from a collection. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id to delete."},confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["collection","request","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.getRequestScript}`,description:"Read the pre-request or post-response script of a request.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id."},phase:{type:"string",enum:["pre-request","post-response"],description:"Which script phase to read."}},required:["collection","request","phase"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.setRequestScript}`,description:"Write or replace the pre-request or post-response script of a request.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id."},phase:{type:"string",enum:["pre-request","post-response"],description:"Which script phase to write."},script:{type:"string",description:"Full JavaScript source to write."}},required:["collection","request","phase","script"]},annotations:{idempotentHint:!0}},{name:`${t}${G.reorderCollectionItems}`,description:"Set the execution/display order of direct children of a collection root or folder. Items not listed are appended at the end.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:"Folder path or id. Omit to reorder collection root."},order:{type:"array",items:{type:"string"},description:"Ordered list of item names or ids."}},required:["collection","order"]},annotations:{idempotentHint:!0}},{name:`${t}${G.listSuites}`,description:"List all test suites with name, id, request count, and configuration summary.",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.getSuite}`,description:"Get full details of a test suite including flow nodes (suite.nodes) and a flattened request list.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the test suite.",r)},required:["suite"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.createSuite}`,description:"Create a new test suite (empty, pre-populated from a collection/folder, or initialized with an explicit flow nodes graph).",inputSchema:{type:"object",properties:{name:{type:"string",description:"Display name for the new suite."},description:{type:"string",description:"Optional description."},fromCollection:{type:"string",description:"Collection name or id to seed the suite from (all requests in execution order)."},fromFolder:{type:"string",description:"Folder path within fromCollection to seed from."},nodes:{type:"array",items:{type:"object"},description:"Optional full suite.nodes graph. If provided, this becomes the suite flow definition."},iterations:{type:"number",description:"Number of iterations (default: 1)."},stopOnError:{type:"boolean",description:"Stop on first failure (default: false)."},delayBetweenRequests:{type:"number",description:"Milliseconds delay between requests (default: 0)."}},required:["name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.updateSuiteConfig}`,description:"Change a suite's name/description/run configuration and optionally replace the full suite.nodes flow graph.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite to update.",r),name:{type:"string",description:"New display name."},description:{type:"string",description:"New description."},nodes:{type:"array",items:{type:"object"},description:"Optional full suite.nodes graph replacement."},iterations:{type:"number"},stopOnError:{type:"boolean"},delayBetweenRequests:{type:"number"}},required:["suite"]},annotations:{idempotentHint:!0}},{name:`${t}${G.getSuiteNode}`,description:'Get a single suite flow node by path (for example: "2.then.0" or "1.cases.0.nodes.1").',inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),path:{type:"string",description:"Node path to read (dot notation)."}},required:["suite","path"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.listSuiteNodePaths}`,description:"List all node paths and editable branch-array paths for a suite flow graph. Use before add/update/remove/move_suite_node.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),includeBranches:{type:"boolean",description:"Include branch-array paths (default: true)."}},required:["suite"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.addSuiteNode}`,description:"Add a flow node to a suite. Insert at root or into a branch array of a parent node.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),node:{type:"object",description:"Node object to insert (request/script/if/switch/for/while/block)."},parentPath:{type:"string",description:'Optional parent node path (for example: "2" or "1.cases.0"). Omit to insert at root.'},branch:{type:"string",description:'Branch array on parent node (for example: "nodes", "then", "else", "default", "cases.0.nodes"). Required when parentPath is provided.'},index:{type:"number",description:"Optional insertion index inside target array. Omit to append."}},required:["suite","node"]},annotations:{idempotentHint:!1}},{name:`${t}${G.updateSuiteNode}`,description:"Replace a flow node at a specific path in suite.nodes.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),path:{type:"string",description:'Node path to replace (for example: "0" or "2.then.1").'},node:{type:"object",description:"Full replacement node object."}},required:["suite","path","node"]},annotations:{idempotentHint:!0}},{name:`${t}${G.removeSuiteNode}`,description:"Remove a flow node at a specific path from suite.nodes.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),path:{type:"string",description:'Node path to remove (for example: "0" or "2.else.0").'}},required:["suite","path"]},annotations:{destructiveHint:!0}},{name:`${t}${G.moveSuiteNode}`,description:"Move a flow node from one path to another parent/branch/index within suite.nodes.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),fromPath:{type:"string",description:'Source node path (for example: "1.then.0").'},toParentPath:{type:"string",description:"Optional destination parent node path. Omit to move to root."},toBranch:{type:"string",description:"Destination branch array on parent node. Required when toParentPath is provided."},toIndex:{type:"number",description:"Optional destination index in target array. Omit to append."}},required:["suite","fromPath"]},annotations:{idempotentHint:!1}},{name:`${t}${G.addSuiteRequests}`,description:'Legacy compatibility helper. Add one or more request nodes at the suite root, using the same insertion semantics as add_suite_node with type:"request".',inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),requests:{type:"array",items:{type:"object",properties:{collection:{type:"string",description:"Collection name or id."},request:{type:"string",description:"Request name or id."}},required:["collection","request"]},description:"Requests to add."},insertAt:{type:"number",description:"Zero-based root nodes-array index to insert at. Omit to append at end."}},required:["suite","requests"]},annotations:{idempotentHint:!1}},{name:`${t}${G.removeSuiteRequest}`,description:"Remove a request from a request-only root suite by position (0-based) or by name. For flow suites, edit nodes via get_suite/update_suite_config.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),index:{type:"number",description:"Zero-based position in the suite requests list."},request:{type:"string",description:"Request name to remove (used if index is not provided)."}},required:["suite"]},annotations:{destructiveHint:!0}},{name:`${t}${G.reorderSuiteRequests}`,description:"Reorder requests in a request-only root suite. Requests not listed are moved to the end. For flow suites, edit nodes via get_suite/update_suite_config.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),order:{type:"array",items:{type:"string"},description:"Ordered list of request names."}},required:["suite","order"]},annotations:{idempotentHint:!0}},{name:`${t}${G.duplicateSuite}`,description:"Clone an existing suite under a new name.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite to clone.",r),newName:{type:"string",description:"Name for the duplicated suite."}},required:["suite","newName"]},annotations:{idempotentHint:!1}},{name:`${t}${G.deleteSuite}`,description:"Delete a test suite permanently. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite to delete.",r),confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["suite","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.listEnvironments}`,description:"List all environments with their variable keys (values hidden). Use get_environment_variables to see values.",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.getEnvironmentVariables}`,description:"Get the resolved (merged file + session overrides) variables for an environment.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name (defaults to active environment)."}}},annotations:{readOnlyHint:!0}},{name:`${t}${G.selectEnvironment}`,description:"Set the active environment for all subsequent run_* calls in this session.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Name of the environment to activate."}},required:["environment"]},annotations:{idempotentHint:!0}},{name:`${t}${G.createEnvironment}`,description:"Create a new environment file, optionally pre-populated with variables.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Environment name (becomes the filename)."},variables:{type:"object",description:"Initial key/value variable map.",additionalProperties:{type:"string"}}},required:["name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.deleteEnvironment}`,description:"Delete an environment file permanently. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name to delete."},confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["environment","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.setEnvironmentVariable}`,description:'Set a variable in an environment. Scope "session" (default) is in-memory only and always temporary (both runtimes). Scope "permanent" writes to the env JSON config file \u2014 source-controlled and shared with the CLI runtime.',inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name (defaults to active environment)."},key:{type:"string",description:"Variable name."},value:{type:"string",description:"New value."},scope:{type:"string",enum:["session","permanent"],description:'Storage scope. "permanent" writes to disk.'}},required:["key","value"]},annotations:{idempotentHint:!0}},{name:`${t}${G.unsetEnvironmentVariable}`,description:"Remove a session-scoped variable override, restoring the file value.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name (defaults to active environment)."},key:{type:"string",description:"Variable name to unset."}},required:["key"]},annotations:{idempotentHint:!0}},{name:`${t}${G.setGlobalVariable}`,description:'Set a global variable visible across all environments. Scope "session" (default) is in-memory only and lost on restart (both runtimes). Scope "permanent" writes to _global.json \u2014 source-controlled and shared with the CLI runtime.',inputSchema:{type:"object",properties:{key:{type:"string",description:"Global variable name."},value:{type:"string",description:"Value to set."},scope:{type:"string",enum:["session","permanent"],description:'Storage scope. "permanent" writes to _global.json.'}},required:["key","value"]},annotations:{idempotentHint:!0}},{name:`${t}${G.getGlobals}`,description:"Return all global variables (merged _global.json + runtime pm.globals.set() values).",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.scaffoldCollectionFromOpenApi}`,description:"Import an OpenAPI 3.0 spec (JSON or YAML) and scaffold a complete HTTP Forge collection from it. All operations become requests grouped by tag/path. An optional environment is created from the server URL. Returns the new collection id and name. Use this to quickly bootstrap API testing from a spec file.",inputSchema:{type:"object",properties:{specPath:{type:"string",description:"Absolute or workspace-relative path to the OpenAPI 3.0 JSON or YAML file."},collectionName:{type:"string",description:"Override the collection name (defaults to the spec title)."},environmentName:{type:"string",description:"Name for the generated environment that contains the server base URL. Omit to skip environment creation."}},required:["specPath"]},annotations:{idempotentHint:!1}},{name:`${t}${G.suggestAssertions}`,description:"Analyse the last execution history for a request and suggest pm.test() assertions to add to its post-response script. Covers status code, response time, required JSON fields, Content-Type header, and schema conformance. Returns an array of ready-to-paste JavaScript test snippets and a rationale for each.",inputSchema:{type:"object",properties:{collection:{type:"string",description:"Collection name or id that owns the request."},request:{type:"string",description:"Request name or id to analyse."},environment:{type:"string",description:"Environment used when the run was recorded (defaults to active environment)."},maxSuggestions:{type:"number",description:"Cap the number of suggestions returned (default: 10)."}},required:["collection","request"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.explainFailure}`,description:"Explain why a specific request failed in a recent run. Returns the full request (URL, method, headers, body), the response received (status, headers, body), all assertion results, any script errors, and a plain-English diagnosis with suggested fixes. Provide either runId (from a prior run_suite/run_collection call) + request name, or the collection and request names to pull the most recent history entry.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"MCP run id (from run_suite or run_collection). Mutually exclusive with collection+request history lookup."},collection:{type:"string",description:"Collection name or id. Required when runId is omitted."},request:{type:"string",description:"Request name or id."},iteration:{type:"number",description:"Iteration number within the run (default: 1)."}}},annotations:{readOnlyHint:!0}},{name:`${t}${G.suggestEnvVars}`,description:`Scan a collection for hardcoded values (API keys, base URLs, tokens, tenant IDs) that should become environment variables.
|
|
279
|
+
`)}`));if(!("location"in i.headers)||!i.headers.location)throw(0,oy.ono)({status:i.status},`HTTP ${i.status} redirect with no location header`);{let s=Qd.resolve(t.href,i.headers.location);return f1(s,e,n)}}else{if(i.body){let s=await i.arrayBuffer();return Buffer.from(s)}return Buffer.alloc(0)}}catch(i){throw new c1.ResolverError((0,oy.ono)(i,`Error downloading ${t.href}`),t.href)}}async function b8(t,e){let r,n;e.timeout&&(r=new AbortController,n=setTimeout(()=>r.abort(),e.timeout));let i=await fetch(t,{method:"GET",headers:e.headers||{},credentials:e.withCredentials?"include":"same-origin",signal:r?r.signal:null});return n&&clearTimeout(n),i}});var yC=V(As=>{"use strict";var Zu=As&&As.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(As,"__esModule",{value:!0});As.getNewOptions=As.getJsonSchemaRefParserDefaultOptions=void 0;var S8=Zu(jT()),w8=Zu(n1()),_8=Zu(i1()),R8=Zu(s1()),C8=Zu(u1()),x8=Zu(d1()),E8=()=>({parse:{json:{...S8.default},yaml:{...w8.default},text:{..._8.default},binary:{...R8.default}},resolve:{file:{...C8.default},http:{...x8.default},external:!0},continueOnError:!1,dereference:{circular:!0,excludedPathMatcher:()=>!1,referenceResolution:"relative"},mutateInputSchema:!0});As.getJsonSchemaRefParserDefaultOptions=E8;var q8=t=>{let e=(0,As.getJsonSchemaRefParserDefaultOptions)();return t&&h1(e,t),e};As.getNewOptions=q8;function h1(t,e){if(p1(e)){let r=Object.keys(e).filter(n=>!["__proto__","constructor","prototype"].includes(n));for(let n=0;n<r.length;n++){let i=r[n],s=e[i],o=t[i];p1(s)?t[i]=h1(o||{},s):s!==void 0&&(t[i]=s)}}return t}function p1(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}});var g1=V(ay=>{"use strict";Object.defineProperty(ay,"__esModule",{value:!0});ay.normalizeArgs=m1;var O8=yC();function m1(t){let e,r,n,i,s=Array.prototype.slice.call(t);typeof s[s.length-1]=="function"&&(i=s.pop()),typeof s[0]=="string"?(e=s[0],typeof s[2]=="object"?(r=s[1],n=s[2]):(r=void 0,n=s[1])):(e="",r=s[0],n=s[1]);try{n=(0,O8.getNewOptions)(n)}catch(o){console.error(`JSON Schema Ref Parser: Error normalizing options: ${o}`)}return!n.mutateInputSchema&&typeof r=="object"&&(r=JSON.parse(JSON.stringify(r))),{path:e,schema:r,options:n,callback:i}}ay.default=m1});var y1=V(_i=>{"use strict";var I8=_i&&_i.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),P8=_i&&_i.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),k8=_i&&_i.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&I8(r,e,n[i]);return P8(r,e),r}})(),vC=_i&&_i.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_i,"__esModule",{value:!0});var A8=vC(Vu()),T8=vC(Ld()),$8=vC($R()),Xu=k8(zn()),N8=Jn();function M8(t,e){if(!e.resolve?.external)return Promise.resolve();try{let r=bC(t.schema,t.$refs._root$Ref.path+"#",t.$refs,e);return Promise.all(r)}catch(r){return Promise.reject(r)}}function bC(t,e,r,n,i,s){i||(i=new Set);let o=[];if(t&&typeof t=="object"&&!ArrayBuffer.isView(t)&&!i.has(t)){i.add(t),A8.default.isExternal$Ref(t)&&o.push(F8(t,e,r,n));let l=Object.keys(t);for(let c of l){let d=T8.default.join(e,c),p=t[c];o=o.concat(bC(p,d,r,n,i,s))}}return o}async function F8(t,e,r,n){let i=n.dereference?.externalReferenceResolution==="root",s=Xu.resolve(i?Xu.cwd():e,t.$ref),o=Xu.stripHash(s),l=r._$refs[o];if(l)return Promise.resolve(l.value);try{let c=await(0,$8.default)(s,r,n),d=bC(c,o+"#",r,n,new Set,!0);return Promise.all(d)}catch(c){if(!n?.continueOnError||!(0,N8.isHandledError)(c))throw c;return r._$refs[o]&&(c.source=decodeURI(Xu.stripHash(e)),c.path=Xu.safePointerToPath(Xu.getHash(e))),[]}}_i.default=M8});var S1=V(Ri=>{"use strict";var D8=Ri&&Ri.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),j8=Ri&&Ri.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),L8=Ri&&Ri.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&D8(r,e,n[i]);return j8(r,e),r}})(),b1=Ri&&Ri.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ri,"__esModule",{value:!0});var ly=b1(Vu()),Zd=b1(Ld()),SC=L8(zn());function U8(t,e){let r=[];wC(t,"schema",t.$refs._root$Ref.path+"#","#",0,r,t.$refs,e),H8(r)}function wC(t,e,r,n,i,s,o,l){let c=e===null?t:t[e];if(c&&typeof c=="object"&&!ArrayBuffer.isView(c))if(ly.default.isAllowed$Ref(c))v1(t,e,r,n,i,s,o,l);else{let d=Object.keys(c).sort((p,m)=>p==="definitions"?-1:m==="definitions"?1:p.length-m.length);for(let p of d){let m=Zd.default.join(r,p),y=Zd.default.join(n,p),b=c[p];ly.default.isAllowed$Ref(b)?v1(c,p,r,y,i,s,o,l):wC(c,p,m,y,i,s,o,l)}}}function v1(t,e,r,n,i,s,o,l){let c=e===null?t:t[e],d=SC.resolve(r,c.$ref),p=o._resolve(d,n,l);if(p===null)return;let y=Zd.default.parse(n).length,b=SC.stripHash(p.path),q=SC.getHash(p.path),C=b!==o._root$Ref.path,v=ly.default.isExtended$Ref(c);i+=p.indirections;let _=B8(s,t,e);if(_)if(y<_.depth||i<_.indirections)V8(s,_);else return;s.push({$ref:c,parent:t,key:e,pathFromRoot:n,depth:y,file:b,hash:q,value:p.value,circular:p.circular,extended:v,external:C,indirections:i}),(!_||C)&&wC(p.value,null,p.path,n,i+1,s,o,l)}function H8(t){t.sort((i,s)=>{if(i.file!==s.file)return i.file<s.file?-1:1;if(i.hash!==s.hash)return i.hash<s.hash?-1:1;if(i.circular!==s.circular)return i.circular?-1:1;if(i.extended!==s.extended)return i.extended?1:-1;if(i.indirections!==s.indirections)return i.indirections-s.indirections;if(i.depth!==s.depth)return i.depth-s.depth;{let o=i.pathFromRoot.lastIndexOf("/definitions"),l=s.pathFromRoot.lastIndexOf("/definitions");return o!==l?l-o:i.pathFromRoot.length-s.pathFromRoot.length}});let e,r,n;for(let i of t)i.external?i.file===e&&i.hash===r?i.$ref.$ref=n:i.file===e&&i.hash.indexOf(r+"/")===0?i.$ref.$ref=Zd.default.join(n,Zd.default.parse(i.hash.replace(r,"#"))):(e=i.file,r=i.hash,n=i.pathFromRoot,i.$ref=i.parent[i.key]=ly.default.dereference(i.$ref,i.value),i.circular&&(i.$ref.$ref=i.pathFromRoot)):i.$ref.$ref=i.hash}function B8(t,e,r){for(let n of t)if(n&&n.parent===e&&n.key===r)return n}function V8(t,e){let r=t.indexOf(e);t.splice(r,1)}Ri.default=U8});var E1=V(Ci=>{"use strict";var W8=Ci&&Ci.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),z8=Ci&&Ci.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),J8=Ci&&Ci.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&W8(r,e,n[i]);return z8(r,e),r}})(),C1=Ci&&Ci.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ci,"__esModule",{value:!0});var uy=C1(Vu()),w1=C1(Ld()),G8=Ao(),_1=J8(zn()),Y8=Jn();Ci.default=K8;function K8(t,e){let r=Date.now(),n=_C(t.schema,t.$refs._root$Ref.path,"#",new Set,new Set,new Map,t.$refs,e,r);t.$refs.circular=n.circular,t.schema=n.value}function _C(t,e,r,n,i,s,o,l,c){let d,p={value:t,circular:!1};if(l&&l.timeoutMs&&Date.now()-c>l.timeoutMs)throw new Y8.TimeoutError(l.timeoutMs);let m=l.dereference||{},y=m.excludedPathMatcher||(()=>!1);if((m?.circular==="ignore"||!i.has(t))&&t&&typeof t=="object"&&!ArrayBuffer.isView(t)&&!y(r)){if(n.add(t),i.add(t),uy.default.isAllowed$Ref(t,l))d=R1(t,e,r,n,i,s,o,l,c),p.circular=d.circular,p.value=d.value;else for(let b of Object.keys(t)){let q=w1.default.join(e,b),C=w1.default.join(r,b);if(y(C))continue;let v=t[b],_=!1;if(uy.default.isAllowed$Ref(v,l)){if(d=R1(v,q,C,n,i,s,o,l,c),_=d.circular,t[b]!==d.value){let E=new Map;m?.preservedProperties&&typeof t[b]=="object"&&!Array.isArray(t[b])&&m?.preservedProperties.forEach(k=>{k in t[b]&&E.set(k,t[b][k])}),t[b]=d.value,m?.preservedProperties&&E.size&&typeof t[b]=="object"&&!Array.isArray(t[b])&&E.forEach((k,O)=>{t[b][O]=k}),m?.onDereference?.(v.$ref,t[b],t,b)}}else n.has(v)?_=x1(q,o,l):(d=_C(v,q,C,n,i,s,o,l,c),_=d.circular,t[b]!==d.value&&(t[b]=d.value));p.circular=p.circular||_}n.delete(t)}return p}function R1(t,e,r,n,i,s,o,l,c){let p=uy.default.isExternal$Ref(t)&&l?.dereference?.externalReferenceResolution==="root",m=_1.resolve(p?_1.cwd():e,t.$ref),y=s.get(m);if(y&&!y.circular){let E=Object.keys(t);if(E.length>1){let k={};for(let O of E)O!=="$ref"&&!(O in y.value)&&(k[O]=t[O]);return{circular:y.circular,value:Object.assign({},y.value,k)}}return y}let b=o._resolve(m,e,l);if(b===null)return{circular:!1,value:null};let q=b.circular,C=q||n.has(b.value);C&&x1(e,o,l);let v=uy.default.dereference(t,b.value);if(!C){let E=_C(v,b.path,r,n,i,s,o,l,c);C=E.circular,v=E.value}C&&!q&&l.dereference?.circular==="ignore"&&(v=t),q&&(v.$ref=r);let _={circular:C,value:v};return Object.keys(t).length===1&&s.set(m,_),_}function x1(t,e,r){if(e.circular=!0,r?.dereference?.onCircular?.(t),!r.dereference.circular)throw G8.ono.reference(`Circular $ref pointer found at ${t}`);return!0}});var q1=V(RC=>{"use strict";Object.defineProperty(RC,"__esModule",{value:!0});function Q8(){return typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:typeof setImmediate=="function"?setImmediate:function(e){setTimeout(e,0)}}RC.default=Q8()});var I1=V(Xd=>{"use strict";var Z8=Xd&&Xd.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Xd,"__esModule",{value:!0});Xd.default=X8;var O1=Z8(q1());function X8(t,e){if(t){e.then(function(r){(0,O1.default)(function(){t(null,r)})},function(r){(0,O1.default)(function(){t(r)})});return}else return e}});var T1=V(Te=>{"use strict";var e5=Te&&Te.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),t5=Te&&Te.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),r5=Te&&Te.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&e5(r,e,n[i]);return t5(r,e),r}})(),el=Te&&Te.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Te,"__esModule",{value:!0});Te.getJsonSchemaRefParserDefaultOptions=Te.jsonSchemaParserNormalizeArgs=Te.dereferenceInternal=Te.JSONParserErrorGroup=Te.isHandledError=Te.UnmatchedParserError=Te.ParserError=Te.ResolverError=Te.MissingPointerError=Te.InvalidPointerError=Te.JSONParserError=Te.UnmatchedResolverError=Te.dereference=Te.bundle=Te.resolve=Te.parse=Te.$RefParser=void 0;var P1=el($T()),n5=el($R()),ep=el(g1());Te.jsonSchemaParserNormalizeArgs=ep.default;var i5=el(y1()),s5=el(S1()),A1=el(E1());Te.dereferenceInternal=A1.default;var Xa=r5(zn()),Gn=Jn();Object.defineProperty(Te,"JSONParserError",{enumerable:!0,get:function(){return Gn.JSONParserError}});Object.defineProperty(Te,"InvalidPointerError",{enumerable:!0,get:function(){return Gn.InvalidPointerError}});Object.defineProperty(Te,"MissingPointerError",{enumerable:!0,get:function(){return Gn.MissingPointerError}});Object.defineProperty(Te,"ResolverError",{enumerable:!0,get:function(){return Gn.ResolverError}});Object.defineProperty(Te,"ParserError",{enumerable:!0,get:function(){return Gn.ParserError}});Object.defineProperty(Te,"UnmatchedParserError",{enumerable:!0,get:function(){return Gn.UnmatchedParserError}});Object.defineProperty(Te,"UnmatchedResolverError",{enumerable:!0,get:function(){return Gn.UnmatchedResolverError}});Object.defineProperty(Te,"isHandledError",{enumerable:!0,get:function(){return Gn.isHandledError}});Object.defineProperty(Te,"JSONParserErrorGroup",{enumerable:!0,get:function(){return Gn.JSONParserErrorGroup}});var k1=Ao(),xi=el(I1()),o5=yC();Object.defineProperty(Te,"getJsonSchemaRefParserDefaultOptions",{enumerable:!0,get:function(){return o5.getJsonSchemaRefParserDefaultOptions}});var Mo=class t{constructor(){this.schema=null,this.$refs=new P1.default}async parse(){let e=(0,ep.default)(arguments),r;if(!e.path&&!e.schema){let i=(0,k1.ono)(`Expected a file path, URL, or object. Got ${e.path||e.schema}`);return(0,xi.default)(e.callback,Promise.reject(i))}this.schema=null,this.$refs=new P1.default;let n="http";if(Xa.isFileSystemPath(e.path))e.path=Xa.fromFileSystemPath(e.path),n="file";else if(!e.path&&e.schema&&"$id"in e.schema&&e.schema.$id){let i=Xa.parse(e.schema.$id),s=i.protocol==="https:"?443:80;e.path=`${i.protocol}//${i.hostname}:${s}`}if(e.path=Xa.resolve(Xa.cwd(),e.path),e.schema&&typeof e.schema=="object"){let i=this.$refs._add(e.path);i.value=e.schema,i.pathType=n,r=Promise.resolve(e.schema)}else r=(0,n5.default)(e.path,this.$refs,e.options);try{let i=await r;if(i!==null&&typeof i=="object"&&!Buffer.isBuffer(i))return this.schema=i,(0,xi.default)(e.callback,Promise.resolve(this.schema));if(e.options.continueOnError)return this.schema=null,(0,xi.default)(e.callback,Promise.resolve(this.schema));throw k1.ono.syntax(`"${this.$refs._root$Ref.path||i}" is not a valid JSON Schema`)}catch(i){return!e.options.continueOnError||!(0,Gn.isHandledError)(i)?(0,xi.default)(e.callback,Promise.reject(i)):(this.$refs._$refs[Xa.stripHash(e.path)]&&this.$refs._$refs[Xa.stripHash(e.path)].addError(i),(0,xi.default)(e.callback,Promise.resolve(null)))}}static parse(){let e=new t;return e.parse.apply(e,arguments)}async resolve(){let e=(0,ep.default)(arguments);try{return await this.parse(e.path,e.schema,e.options),await(0,i5.default)(this,e.options),CC(this),(0,xi.default)(e.callback,Promise.resolve(this.$refs))}catch(r){return(0,xi.default)(e.callback,Promise.reject(r))}}static resolve(){let e=new t;return e.resolve.apply(e,arguments)}static bundle(){let e=new t;return e.bundle.apply(e,arguments)}async bundle(){let e=(0,ep.default)(arguments);try{return await this.resolve(e.path,e.schema,e.options),(0,s5.default)(this,e.options),CC(this),(0,xi.default)(e.callback,Promise.resolve(this.schema))}catch(r){return(0,xi.default)(e.callback,Promise.reject(r))}}static dereference(){let e=new t;return e.dereference.apply(e,arguments)}async dereference(){let e=(0,ep.default)(arguments);try{return await this.resolve(e.path,e.schema,e.options),(0,A1.default)(this,e.options),CC(this),(0,xi.default)(e.callback,Promise.resolve(this.schema))}catch(r){return(0,xi.default)(e.callback,Promise.reject(r))}}};Te.$RefParser=Mo;Te.default=Mo;function CC(t){if(Gn.JSONParserErrorGroup.getParserErrors(t).length>0)throw new Gn.JSONParserErrorGroup(t)}Te.parse=Mo.parse;Te.resolve=Mo.resolve;Te.bundle=Mo.bundle;Te.dereference=Mo.dereference});var cy,ec,xC=ae(()=>{"use strict";cy=Qc(T1()),ec=class{async resolve(e){try{return await cy.default.dereference(e,{dereference:{circular:"ignore"}})}catch(r){return console.error("[RefResolver] Failed to fully resolve $ref pointers:",r),e}}async bundle(e){try{return await cy.default.bundle(e)}catch(r){return console.error("[RefResolver] Failed to bundle $ref pointers:",r),e}}async resolveFile(e){try{return await cy.default.dereference(e,{dereference:{circular:"ignore"}})}catch(r){throw console.error(`[RefResolver] Failed to resolve file ${e}:`,r),r}}}});import*as $1 from"fs";var N1,a5,Fo,fy=ae(()=>{"use strict";N1=Qc(Dd());jn();fR();xC();a5=["application/json","text/plain","text/html","multipart/form-data","application/x-www-form-urlencoded"],Fo=class{constructor(e,r){this.collectionService=e;this.envConfigService=r;this.exampleGenerator=new ju,this.refResolver=new ec}collectionService;envConfigService;exampleGenerator;refResolver;async import(e,r){let n=await $1.promises.readFile(e,"utf-8"),i;e.endsWith(".yaml")||e.endsWith(".yml")?i=N1.parse(n):i=JSON.parse(n),i=await this.refResolver.resolve(i);let s=i.components?.schemas||{},o=r?.collectionName||i.info?.title||"Imported API",c={id:Pt(o),name:o,description:i.info?.description||"",version:i.info?.version||"1.0.0",variables:{},items:[]};if(i.servers&&i.servers.length>0&&(c.variables.baseUrl=i.servers[0].url),i.security&&i.security.length>0&&i.components?.securitySchemes){let m=this.mapSecurityToAuth(i.security[0],i.components.securitySchemes);m&&(c.auth=m)}let d=new Map;if(i.tags)for(let m of i.tags){let y={type:"folder",id:Pt(m.name),name:m.name,description:m.description,items:[]};d.set(m.name,y),c.items.push(y)}if(i.paths)for(let[m,y]of Object.entries(i.paths))for(let b of["get","post","put","patch","delete","head","options","trace"]){let q=y[b];if(!q)continue;let C=this.processOperation(b,m,q,y,i,s),v=q.tags?.[0];if(v&&d.has(v))d.get(v).items.push(C);else if(v){let _={type:"folder",id:Pt(v),name:v,items:[C]};d.set(v,_),c.items.push(_)}else c.items.push(C)}await this.collectionService.saveCollection(c);let p;return r?.environmentName&&i.servers&&(p=await this.createEnvironmentFromServers(i.servers,r.environmentName)),{collection:c,environmentCreated:p}}processOperation(e,r,n,i,s,o){let l=Pt(n.operationId||`${e}-${r}`),c=`{{baseUrl}}${this.convertPathParams(r)}`,d=n.summary||n.operationId||`${e.toUpperCase()} ${r}`,p=n.deprecated===!0;p&&(d=`[DEPRECATED] ${d}`);let m={type:"request",id:l,name:d,method:e.toUpperCase(),url:c,description:n.description||"",deprecated:p},y=[...i.parameters||[],...n.parameters||[]];if(this.processParameters(m,y,o),n.requestBody&&this.processRequestBody(m,n.requestBody,o),n.responses&&(m.responseSchema=this.processResponses(n.responses,o)),n.security!==void 0&&s.components?.securitySchemes){if(Array.isArray(n.security)&&n.security.length===0)m.auth={type:"none"};else if(n.security&&n.security.length>0){let b=this.mapSecurityToAuth(n.security[0],s.components.securitySchemes);b&&(m.auth=b)}}return m}convertPathParams(e){return e.replace(/\{(\w+)\}/g,":$1")}processParameters(e,r,n){let i=[],s=[],o={},l=[];for(let c of r){let d=c.name,p=c.in,m=c.schema||{},y=c.example!==void 0?String(c.example):this.generateExampleForParam(m,n),b=c.deprecated===!0;switch(p){case"path":{if(c.description||m.type||m.format||m.enum||b||m.pattern||m.minimum!==void 0||m.maximum!==void 0||m.minLength!==void 0||m.maxLength!==void 0||m.multipleOf!==void 0||m.minItems!==void 0||m.maxItems!==void 0||m.uniqueItems||m.nullable||m.oneOf){let C={value:y};m.oneOf?(C.oneOf=m.oneOf,this.applyOneOfHints(C,m.oneOf)):(m.type&&(C.type=m.type),m.format&&(C.format=m.format),m.enum&&(C.enum=m.enum.map(String)),m.pattern&&(C.pattern=m.pattern),m.minimum!==void 0&&(C.minimum=m.minimum),m.maximum!==void 0&&(C.maximum=m.maximum),m.exclusiveMinimum!==void 0&&(C.exclusiveMinimum=m.exclusiveMinimum),m.exclusiveMaximum!==void 0&&(C.exclusiveMaximum=m.exclusiveMaximum),m.multipleOf!==void 0&&(C.multipleOf=m.multipleOf),m.minLength!==void 0&&(C.minLength=m.minLength),m.maxLength!==void 0&&(C.maxLength=m.maxLength),m.minItems!==void 0&&(C.minItems=m.minItems),m.maxItems!==void 0&&(C.maxItems=m.maxItems),m.uniqueItems&&(C.uniqueItems=!0),m.nullable&&(C.nullable=!0)),c.description&&(C.description=c.description),b&&(C.deprecated=!0),o[d]=C}else o[d]=y;break}case"query":{let q={key:d,value:y};this.applySchemaConstraints(q,m,c,b),s.push(q);break}case"header":{let q={key:d,value:y};this.applySchemaConstraints(q,m,c,b),i.push(q);break}case"cookie":{l.push(`${d}={{${d}}}`);break}}}l.length>0&&i.push({key:"Cookie",value:l.join("; ")}),Object.keys(o).length>0&&(e.params=o),s.length>0&&(e.query=s),i.length>0&&(e.headers=i)}applySchemaConstraints(e,r,n,i){r.oneOf?(e.oneOf=r.oneOf,this.applyOneOfHints(e,r.oneOf)):(r.type&&(e.type=r.type),r.format&&(e.format=r.format),r.enum&&(e.enum=r.enum.map(String)),r.pattern&&(e.pattern=r.pattern),r.minimum!==void 0&&(e.minimum=r.minimum),r.maximum!==void 0&&(e.maximum=r.maximum),r.exclusiveMinimum!==void 0&&(e.exclusiveMinimum=r.exclusiveMinimum),r.exclusiveMaximum!==void 0&&(e.exclusiveMaximum=r.exclusiveMaximum),r.multipleOf!==void 0&&(e.multipleOf=r.multipleOf),r.minLength!==void 0&&(e.minLength=r.minLength),r.maxLength!==void 0&&(e.maxLength=r.maxLength),r.minItems!==void 0&&(e.minItems=r.minItems),r.maxItems!==void 0&&(e.maxItems=r.maxItems),r.uniqueItems&&(e.uniqueItems=!0),r.nullable&&(e.nullable=!0)),n.required&&(e.required=!0),n.description&&(e.description=n.description),i&&(e.deprecated=!0)}applyOneOfHints(e,r){let n=[],i=new Set;for(let s of r)s.type&&i.add(s.type),s.enum&&n.push(...s.enum.map(String));i.size===1&&(e.type=[...i][0]),n.length>0&&(e.enum=[...new Set(n)])}generateExampleForParam(e,r){if(!e)return"";let n=this.exampleGenerator.generate(e,{components:r});return n==null?"":String(n)}processRequestBody(e,r,n){if(!r.content)return;let i=Object.keys(r.content);if(i.length===0)return;let s=this.selectPrimaryContentType(i),o=r.content[s],{bodyType:l,bodyFormat:c}=this.mapContentTypeToBodyType(s);if(e.body={type:l,...c&&{format:c},content:""},o){let p=this.generateBodyContent(o,s,n);p!==void 0&&(e.body.content=typeof p=="string"?p:JSON.stringify(p,null,2)),l==="form-data"&&o.schema?.properties&&(e.body.content=this.buildFormDataEntries(o.schema,n)),l==="x-www-form-urlencoded"&&o.schema?.properties&&(e.body.content=this.buildFormDataEntries(o.schema,n))}let d=this.buildBodySchema(r,s,n);d&&(e.bodySchema=d)}selectPrimaryContentType(e){for(let i of a5)if(e.includes(i))return i;let r=e.find(i=>i.includes("json"));if(r)return r;let n=e.find(i=>i.startsWith("text/"));return n||e[0]}mapContentTypeToBodyType(e){return e.includes("json")?{bodyType:"raw",bodyFormat:"json"}:e==="application/xml"||e==="text/xml"?{bodyType:"raw",bodyFormat:"xml"}:e==="text/html"?{bodyType:"raw",bodyFormat:"html"}:e.startsWith("text/")?{bodyType:"raw",bodyFormat:"text"}:e==="multipart/form-data"?{bodyType:"form-data"}:e==="application/x-www-form-urlencoded"?{bodyType:"x-www-form-urlencoded"}:e==="application/octet-stream"?{bodyType:"binary"}:{bodyType:"raw",bodyFormat:"text"}}generateBodyContent(e,r,n){if(e.example!==void 0)return e.example;if(e.examples){let i=Object.values(e.examples)[0];if(i?.value!==void 0)return i.value}if(e.schema)return this.exampleGenerator.generate(e.schema,{omitReadOnly:!0,components:n})}buildFormDataEntries(e,r){let n=[],i=e.properties||{},s=new Set(e.required||[]);for(let[o,l]of Object.entries(i)){let c=l,d=c.type==="string"&&c.format==="binary",p={key:o,value:d?"":String(this.exampleGenerator.generate(c,{components:r})||""),type:d?"file":"text",enabled:!0};n.push(p)}return n}buildBodySchema(e,r,n){let i=Object.keys(e.content),s=e.content[r];if(!s?.schema)return;let o={contentType:r,schema:s.schema};if(i.length>1){o.content={};for(let c of i){let d=e.content[c],p={};d.schema&&(p.schema=d.schema),d.examples&&(p.examples=d.examples),d.encoding&&(p.encoding=d.encoding),o.content[c]=p}}s.encoding&&(o.encoding=s.encoding);let l=this.extractUsedComponents(s.schema,n);return Object.keys(l).length>0&&(o.components=l),o}processResponses(e,r){let n={responses:{}},i={};for(let[s,o]of Object.entries(e)){let l=o,c={description:l.description||`Status ${s}`};if(l.content){let d=Object.keys(l.content);if(d.length===1){let p=d[0],m=l.content[p];c.contentType=p,m.schema&&(c.schema=m.schema),m.examples&&(c.examples=m.examples),m.schema&&Object.assign(i,this.extractUsedComponents(m.schema,r))}else{c.content={};for(let p of d){let m=l.content[p],y={};m.schema&&(y.schema=m.schema),m.examples&&(y.examples=m.examples),c.content[p]=y,m.schema&&Object.assign(i,this.extractUsedComponents(m.schema,r))}}}if(l.headers){c.headers={};for(let[d,p]of Object.entries(l.headers)){let m=p;c.headers[d]={...m.description&&{description:m.description},schema:m.schema||{type:"string"}}}}n.responses[s]=c}return Object.keys(i).length>0&&(n.components=i),n}mapSecurityToAuth(e,r){let n=Object.keys(e)[0];if(!n)return;let i=r[n];if(i)switch(i.type){case"http":if(i.scheme==="bearer")return{type:"bearer",bearerToken:""};if(i.scheme==="basic")return{type:"basic",basicAuth:{username:"",password:""}};break;case"apiKey":return{type:"apikey",apikey:{key:i.name||"X-Api-Key",value:"",in:i.in||"header"}};case"oauth2":{let s=i.flows||{},o=s.authorizationCode||s.clientCredentials||s.password||s.implicit||{},l="client_credentials";return s.authorizationCode?l="authorization_code":s.password?l="password":s.implicit&&(l="implicit"),{type:"oauth2",oauth2:{grantType:l,tokenUrl:o.tokenUrl||"",authUrl:o.authorizationUrl||"",clientId:"",clientSecret:"",scope:Object.keys(o.scopes||{}).join(" ")}}}}}async createEnvironmentFromServers(e,r){if(e.length>0){let n=e[0].url;this.envConfigService.setEnvironmentVariable("baseUrl",n)}return r}extractUsedComponents(e,r,n){let i=n||{};if(!e)return i;if(e.$ref){let s=this.extractRefName(e.$ref);s&&r[s]&&!i[s]&&(i[s]=r[s],this.extractUsedComponents(r[s],r,i))}if(e.properties)for(let s of Object.values(e.properties))this.extractUsedComponents(s,r,i);e.items&&this.extractUsedComponents(e.items,r,i);for(let s of["allOf","oneOf","anyOf"])if(e[s])for(let o of e[s])this.extractUsedComponents(o,r,i);return e.additionalProperties&&typeof e.additionalProperties=="object"&&this.extractUsedComponents(e.additionalProperties,r,i),i}extractRefName(e){return e.match(/^#\/components\/schemas\/(.+)$/)?.[1]}}});var tc,EC=ae(()=>{"use strict";tc=class{constructor(e,r,n){this.historyAnalyzer=e;this.scriptAnalyzer=r;this.inferrer=n}historyAnalyzer;scriptAnalyzer;inferrer;async infer(e,r,n,i){let s=await this.historyAnalyzer.analyze(e,r,{environment:i?.environment}),o;return i?.postResponseScript&&(o=this.scriptAnalyzer.analyze(i.postResponseScript)),this.mergeResponseSchemas(n,s,o)}async inferBodySchema(e,r,n,i,s){let o,l;if(r==="raw"&&n==="json"&&e){let c=e;if(typeof e=="string")try{c=JSON.parse(e)}catch{return}o=this.inferrer.inferFromValue(c),l="application/json"}else r==="form-data"&&i?(o=this.buildFormDataSchema(i),l="multipart/form-data"):r==="x-www-form-urlencoded"&&i?(o=this.buildFormDataSchema(i),l="application/x-www-form-urlencoded"):r==="raw"&&n==="xml"?(o={type:"string"},l="application/xml"):r==="raw"&&(n==="text"||n==="html")?(o={type:"string"},l=n==="html"?"text/html":"text/plain"):r==="binary"?(o={type:"string",format:"binary"},l="application/octet-stream"):r==="graphql"&&(o={type:"object",properties:{query:{type:"string"},variables:{type:"object"}}},l="application/json");if(o)return s?this.mergeBodySchemaWithExisting(o,s):{contentType:l,schema:o}}buildFormDataSchema(e){let r={type:"object",properties:{}},n=[];for(let i of e){if(!i.enabled&&i.enabled!==void 0)continue;let s={};i.type?s.type=i.type:s.type="string",i.description&&(s.description=i.description),i.format&&(s.format=i.format),i.enum&&(s.enum=i.enum),i.type==="file"&&(s.type="string",s.format="binary"),r.properties[i.key]=s,i.required&&n.push(i.key)}return n.length>0&&(r.required=n),r}mergeResponseSchemas(e,r,n){let i={responses:{}};for(let[s,o]of Object.entries(r.responses))i.responses[s]={...o};if(n&&this.applyScriptHints(i,n),e){for(let[s,o]of Object.entries(e.responses))i.responses[s]?i.responses[s]=this.mergeResponseDefinitions(i.responses[s],o):i.responses[s]={...o};e.components&&(i.components={...e.components})}return i}applyScriptHints(e,r){for(let n of r.expectedStatuses){let i=String(n);e.responses[i]||(e.responses[i]={description:`Status ${n}`})}for(let[,n]of Object.entries(e.responses))n.schema&&this.augmentSchemaWithHints(n.schema,r)}augmentSchemaWithHints(e,r){if(!(e.type!=="object"||!e.properties))for(let n of r.fieldPaths){let i=n.split(".");this.ensureFieldPath(e,i,r)}}ensureFieldPath(e,r,n,i=""){if(r.length===0||e.type!=="object")return;e.properties||(e.properties={});let s=r[0],o=s.endsWith("[]"),l=o?s.slice(0,-2):s,c=i?`${i}.${s}`:s,d=r.slice(1);if(!e.properties[l])if(o)e.properties[l]={type:"array",items:{type:"object"}};else if(d.length>0)e.properties[l]={type:"object",properties:{}};else{let p=n.typeHints[c];e.properties[l]={type:p||"string"};return}if(d.length>0){let p=o?e.properties[l].items:e.properties[l];p&&this.ensureFieldPath(p,d,n,c)}}mergeResponseDefinitions(e,r){let n={...e};return r.description&&(n.description=r.description),r.contentType&&(n.contentType=r.contentType),r.schema&&e.schema?n.schema=this.inferrer.mergeSchemas(e.schema,r.schema):r.schema&&(n.schema=r.schema),r.examples&&(n.examples={...e.examples||{},...r.examples}),r.content&&(n.content={...e.content||{},...r.content}),r.headers&&(n.headers={...e.headers||{},...r.headers}),n}mergeBodySchemaWithExisting(e,r){let n={...r};return r.schema?n.schema=this.inferrer.mergeSchemas(e,r.schema):n.schema=e,n}}});var M1,dy,F1,D1,j1,L1,U1,rc,qC=ae(()=>{"use strict";M1=/(?:jsonData|responseJson|data|json|body|response\.json\(\))\.([a-zA-Z_][\w.\[\]]*)/g,dy="(?:pm|hf|ctx)",F1=new RegExp(`${dy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.be\\.(?:a|an)\\(['"](\\w+)['"]\\)`,"g"),D1=new RegExp(`${dy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.(?:equal|eql)\\((.+?)\\)`,"g"),j1=/(?:to\.have\.status|response\.code.*?equal)\((\d+)\)/g,L1=new RegExp(`${dy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.be\\.(true|false)`,"g"),U1=new RegExp(`${dy}\\.expect\\(.*?\\.([a-zA-Z_][\\w.]*)\\)\\.to\\.have\\.(?:lengthOf|length\\.above|length\\.below)`,"g"),rc=class{analyze(e){let r={fieldPaths:[],typeHints:{},valueHints:{},expectedStatuses:[]};if(!e||e.trim().length===0)return r;let n=this.stripComments(e);return this.extractFieldPaths(n,r),this.extractTypeAssertions(n,r),this.extractEqualityAssertions(n,r),this.extractBooleanAssertions(n,r),this.extractLengthAssertions(n,r),this.extractStatusAssertions(n,r),r.fieldPaths=[...new Set(r.fieldPaths)],r.expectedStatuses=[...new Set(r.expectedStatuses)],r}stripComments(e){let r=e.replace(/\/\*[\s\S]*?\*\//g,"");return r=r.replace(/\/\/.*$/gm,""),r}extractFieldPaths(e,r){let n,i=new RegExp(M1.source,M1.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]);s&&!this.isCommonMethodCall(s)&&r.fieldPaths.push(s)}}extractTypeAssertions(e,r){let n,i=new RegExp(F1.source,F1.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]),o=n[2].toLowerCase();s&&(r.typeHints[s]=this.mapAssertionType(o),r.fieldPaths.includes(s)||r.fieldPaths.push(s))}}extractEqualityAssertions(e,r){let n,i=new RegExp(D1.source,D1.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]),o=n[2].trim();if(s){let l=this.parseAssertionValue(o);l!==void 0&&(r.valueHints[s]=l,typeof l=="string"?r.typeHints[s]=r.typeHints[s]||"string":typeof l=="number"?r.typeHints[s]=r.typeHints[s]||(Number.isInteger(l)?"integer":"number"):typeof l=="boolean"&&(r.typeHints[s]=r.typeHints[s]||"boolean")),r.fieldPaths.includes(s)||r.fieldPaths.push(s)}}}extractBooleanAssertions(e,r){let n,i=new RegExp(L1.source,L1.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]);s&&(r.typeHints[s]="boolean",r.valueHints[s]=n[2]==="true",r.fieldPaths.includes(s)||r.fieldPaths.push(s))}}extractLengthAssertions(e,r){let n,i=new RegExp(U1.source,U1.flags);for(;(n=i.exec(e))!==null;){let s=this.normalizeFieldPath(n[1]);s&&(r.typeHints[s]=r.typeHints[s]||"array",r.fieldPaths.includes(s)||r.fieldPaths.push(s))}}extractStatusAssertions(e,r){let n,i=new RegExp(j1.source,j1.flags);for(;(n=i.exec(e))!==null;){let s=parseInt(n[1],10);!isNaN(s)&&s>=100&&s<600&&r.expectedStatuses.push(s)}}normalizeFieldPath(e){let r=e.replace(/^\./,"");return r=r.replace(/\[\d+\]/g,"[]"),r}isCommonMethodCall(e){return new Set(["to","be","have","not","deep","any","all","that","is","has","include","includes","equal","eql","above","below","least","most","within","length","lengthOf","match","string","keys","key","property","ownProperty","status","header","json","text"]).has(e.split(".")[0])}mapAssertionType(e){return{string:"string",number:"number",object:"object",array:"array",boolean:"boolean",null:"null",undefined:"null",int:"integer",integer:"integer",float:"number",double:"number"}[e]||"string"}parseAssertionValue(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let r=Number(e);return!isNaN(r)&&e.trim().length>0?r:e==="true"?!0:e==="false"?!1:e==="null"?null:e}}});var H1={};io(H1,{AwsSecretResolver:()=>py});var py,OC=ae(()=>{"use strict";py=class{providerName="aws";region;moduleRequire;constructor(e,r){this.region=e.region??process.env.AWS_DEFAULT_REGION??process.env.AWS_REGION,this.moduleRequire=r??(n=>_t(n))}async resolve(e){let r=e.lastIndexOf("#"),n=r>=0?e.slice(0,r):e,i=r>=0?e.slice(r+1):void 0;try{let{SecretsManagerClient:s,GetSecretValueCommand:o}=this.moduleRequire("@aws-sdk/client-secrets-manager"),c=await new s(this.region?{region:this.region}:{}).send(new o({SecretId:n})),d=c.SecretString??(c.SecretBinary?Buffer.from(c.SecretBinary).toString("utf-8"):void 0);if(d===void 0)return;if(i)try{let p=JSON.parse(d);return p[i]!==void 0?String(p[i]):void 0}catch{return}return d}catch(s){throw s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND"?new Error("[HTTP Forge] AWS secret resolver requires @aws-sdk/client-secrets-manager. Install it in your project: npm install @aws-sdk/client-secrets-manager"):s}}}});var B1={};io(B1,{AzureKeyVaultResolver:()=>hy});var hy,IC=ae(()=>{"use strict";hy=class{providerName="azure";vaultUrl;moduleRequire;constructor(e,r){let n=(e.vaultUrl||process.env.AZURE_KEYVAULT_URL)??"";this.vaultUrl=n.replace(/\/$/,""),this.moduleRequire=r??(i=>_t(i))}async resolve(e){if(!this.vaultUrl)throw new Error("[HTTP Forge] Azure Key Vault resolver: no vault URL configured. Set secrets.providers.<alias>.vaultUrl or the AZURE_KEYVAULT_URL env var.");let r=e.split("/"),n=r[0],i=r[1];try{let{SecretClient:s}=this.moduleRequire("@azure/keyvault-secrets"),{DefaultAzureCredential:o}=this.moduleRequire("@azure/identity"),l=new o;return(await new s(this.vaultUrl,l).getSecret(n,i?{version:i}:{})).value}catch(s){throw s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND"?new Error("[HTTP Forge] Azure Key Vault resolver requires @azure/keyvault-secrets and @azure/identity. Install them: npm install @azure/keyvault-secrets @azure/identity"):s}}}});var V1={};io(V1,{HashiCorpVaultResolver:()=>my});var my,PC=ae(()=>{"use strict";my=class{providerName="vault";address;mountPath;namespace;constructor(e){this.address=(e.address??process.env.VAULT_ADDR??"http://127.0.0.1:8200").replace(/\/$/,""),this.mountPath=e.mountPath??"secret",this.namespace=e.namespace??process.env.VAULT_NAMESPACE}async resolve(e){let r=e.lastIndexOf("#"),n=r>=0?e.slice(0,r):e,i=r>=0?e.slice(r+1):void 0,s=process.env.VAULT_TOKEN;if(!s)throw new Error("[HTTP Forge] HashiCorp Vault resolver requires VAULT_TOKEN environment variable to be set.");let o=`${this.address}/v1/${this.mountPath}/data/${n}`,l={"X-Vault-Token":s};this.namespace&&(l["X-Vault-Namespace"]=this.namespace);let c;try{c=await fetch(o,{headers:l})}catch(y){throw new Error(`[HTTP Forge] Vault request failed: ${y?.message??y}`)}if(c.status===404)return;if(!c.ok)throw new Error(`[HTTP Forge] Vault returned HTTP ${c.status} for path: ${n}`);let p=(await c.json())?.data?.data;if(!p)return;if(i)return p[i]!==void 0?String(p[i]):void 0;if("value"in p)return String(p.value);let m=Object.keys(p);return m.length===1?String(p[m[0]]):void 0}}});var W1={};io(W1,{OnePasswordResolver:()=>gy});import{execFile as l5}from"child_process";import{promisify as u5}from"util";var c5,gy,kC=ae(()=>{"use strict";c5=u5(l5),gy=class{providerName="1password";defaultVault;constructor(e){this.defaultVault=e.vault}async resolve(e){let r=e.split("/"),n,i,s;if(this.defaultVault){if(r.length<2)throw new Error(`[HTTP Forge] 1Password path "${e}" must be "<item>/<field>" when vault is set in config.`);n=this.defaultVault,i=r.slice(0,r.length-1).join("/"),s=r[r.length-1]}else{if(r.length<3)throw new Error(`[HTTP Forge] 1Password path "${e}" must be "<vault>/<item>/<field>".`);n=r[0],i=r.slice(1,r.length-1).join("/"),s=r[r.length-1]}let o=await this.tryResolveSdk(n,i,s);return o!==null?o:this.resolveViaCli(n,i,s)}async tryResolveSdk(e,r,n){let i=process.env.OP_SERVICE_ACCOUNT_TOKEN;if(!i)return null;try{let{createClient:s}=_t("@1password/sdk"),o=await s({auth:i,integrationName:"HTTP Forge",integrationVersion:"1.0.0"}),l=`op://${e}/${r}/${n}`;return await o.secrets.resolve(l)}catch(s){if(s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND")return null;throw new Error(`[HTTP Forge] 1Password SDK error for "${e}/${r}/${n}": ${s?.message??s}`)}}async resolveViaCli(e,r,n){try{let{stdout:i}=await c5("op",["item","get",r,"--vault",e,"--field",n,"--format","json"],{env:{...process.env},timeout:1e4}),s=JSON.parse(i.trim());return typeof s=="string"?s:s&&typeof s.value=="string"?s.value:void 0}catch(i){if(i?.code==="ENOENT")throw new Error("[HTTP Forge] 1Password resolver requires either the @1password/sdk npm package or the `op` CLI to be installed.\n Service Account: set OP_SERVICE_ACCOUNT_TOKEN and install @1password/sdk\n CLI: install 1Password CLI and run `op signin`");if(i?.stderr?.includes("not found")||i?.code===1)return;throw new Error(`[HTTP Forge] 1Password CLI error: ${i?.message??i}`)}}}});var z1={};io(z1,{GcpSecretResolver:()=>yy});var yy,AC=ae(()=>{"use strict";yy=class{providerName="gcp";projectId;moduleRequire;constructor(e,r){this.projectId=e.projectId??process.env.GOOGLE_CLOUD_PROJECT??process.env.GCLOUD_PROJECT??process.env.GCP_PROJECT,this.moduleRequire=r??(n=>_t(n))}async resolve(e){let r=e.split("/"),n=r[0],i=r[1]==="versions"&&r[2]?r[2]:"latest";if(!this.projectId)throw new Error("[HTTP Forge] GCP secret resolver: no projectId configured and GOOGLE_CLOUD_PROJECT env var is not set.");try{let{SecretManagerServiceClient:s}=this.moduleRequire("@google-cloud/secret-manager"),o=new s,l=`projects/${this.projectId}/secrets/${n}/versions/${i}`,[c]=await o.accessSecretVersion({name:l}),d=c.payload?.data;return d?Buffer.isBuffer(d)?d.toString("utf-8"):Buffer.from(d).toString("utf-8"):void 0}catch(s){throw s?.name==="MODULE_NOT_FOUND"||s?.code==="MODULE_NOT_FOUND"?new Error("[HTTP Forge] GCP secret resolver requires @google-cloud/secret-manager. Install it: npm install @google-cloud/secret-manager"):s}}}});var G1={};io(G1,{DopplerResolver:()=>vy});import*as J1 from"https";var vy,TC=ae(()=>{"use strict";vy=class{providerName="doppler";token;constructor(e){this.token=e.serviceToken??process.env.DOPPLER_TOKEN}async resolve(e){let r=e.trim().toUpperCase(),n=this.token;if(!n)throw new Error("[HTTP Forge] Doppler secret resolver: no service token found. Set DOPPLER_TOKEN env var or add serviceToken to config.");let i=`https://api.doppler.com/v3/configs/config/secret?name=${encodeURIComponent(r)}`;return new Promise((s,o)=>{let l=J1.request(i,{method:"GET",headers:{Authorization:`Bearer ${n}`,Accept:"application/json"}},c=>{let d=[];c.on("data",p=>d.push(p)),c.on("end",()=>{let p=Buffer.concat(d).toString("utf-8");if(c.statusCode===404){s(void 0);return}if(c.statusCode!==200){o(new Error(`[HTTP Forge] Doppler API returned ${c.statusCode} for secret "${r}": ${p}`));return}try{let y=JSON.parse(p)?.value?.computed;s(y!=null?String(y):void 0)}catch{o(new Error(`[HTTP Forge] Doppler API returned non-JSON response for secret "${r}"`))}})});l.on("error",o),l.end()})}}});import*as by from"fs";import{createRequire as f5}from"module";import*as Y1 from"path";var tp,$C=ae(()=>{"use strict";tp=class{resolvers=new Map;moduleRequire;constructor(e){if(this.moduleRequire=this.buildModuleRequire(e),!e)return;let r;try{r=e.getConfig().secrets}catch{return}if(!(!r?.providers||typeof r.providers!="object"))for(let[n,i]of Object.entries(r.providers))try{let s=this.createResolver(i);s&&this.resolvers.set(n,s)}catch{}}async resolveSecretTokens(e,r){let n=r??new Map,i=new Set;if(this.collectTokens(e,i),i.size===0)return{};await Promise.all(Array.from(i).map(async o=>{if(n.has(o))return;let l=o.slice(7),c=l.indexOf("/");if(c<0)return;let d=l.slice(0,c),p=l.slice(c+1),m=this.resolvers.get(d);if(m)try{let y=await m.resolve(p);y!==void 0&&n.set(o,y)}catch(y){let b=y?.message??String(y);console.warn(`[HTTP Forge] {{${o}}} could not be resolved: ${b}`)}}));let s={};for(let[o,l]of n.entries())s[o]=l;return s}get hasProviders(){return this.resolvers.size>0}collectTokens(e,r){if(typeof e=="string"){let n=/\{\{(secret:[^}]+)\}\}/g,i;for(;(i=n.exec(e))!==null;)r.add(i[1])}else Array.isArray(e)?e.forEach(n=>this.collectTokens(n,r)):e!==null&&typeof e=="object"&&Object.values(e).forEach(n=>this.collectTokens(n,r))}createResolver(e){switch(e.provider){case"aws":{let{AwsSecretResolver:r}=(OC(),Ql(H1));return new r(e,this.moduleRequire)}case"azure":{let{AzureKeyVaultResolver:r}=(IC(),Ql(B1));return new r(e,this.moduleRequire)}case"vault":{let{HashiCorpVaultResolver:r}=(PC(),Ql(V1));return new r(e)}case"1password":{let{OnePasswordResolver:r}=(kC(),Ql(W1));return new r(e)}case"gcp":{let{GcpSecretResolver:r}=(AC(),Ql(z1));return new r(e,this.moduleRequire)}case"doppler":{let{DopplerResolver:r}=(TC(),Ql(G1));return new r(e)}default:return}}buildModuleRequire(e){let r=i=>_t(i);if(!e)return r;let n=[];try{n=e.getModulePaths()??[]}catch{return r}for(let i of n)try{let s=Y1.resolve(i,"package.json");if(by.existsSync(s)){let o=by.realpathSync(s),l=f5(o);return c=>{try{return l(c)}catch{return r(c)}}}}catch{}return r}}});function Ir(t){return t.replace(/\//g,"%2F")}function K1(t){return t.replace(/%2F/gi,"/")}function Ts(t){return t?t.split("/").map(K1).join(" / "):""}function Sy(t){return t.includes(" / ")?t.split(" / ").map(e=>Ir(e.trim())).join("/"):Ir(t)}function ot(t,e=t.items,r=""){let n=[];for(let i of e)if(i.type==="request")n.push({request:i,folderPath:r});else{let s=i,o=Ir(s.name),l=r?`${r}/${o}`:o;n.push(...ot(t,s.items??[],l))}return n}function un(t,e=t.items,r=""){let n=[];for(let i of e)if(i.type==="folder"){let s=i,o=Ir(s.name),l=r?`${r}/${o}`:o;n.push({folderId:s.id,folderPath:l,requestCount:NC(s.items??[])}),n.push(...un(t,s.items??[],l))}return n}function NC(t){let e=0;for(let r of t)r.type==="request"?e++:e+=NC(r.items??[]);return e}var Ei=ae(()=>{"use strict"});var tl,MC=ae(()=>{"use strict";tl={iterations:1,delayBetweenRequests:0,stopOnError:!1,readFromSharedSession:!1,writeToSharedSession:!1}});import*as bt from"fs";import*as qi from"path";var rp,FC=ae(()=>{"use strict";Ei();jn();MC();rp=class{constructor(e,r,n){this.collectionService=e;this.configService=r;this.suitesDir=r.getSuitesPath(),this.onSuitesChanged=n?.onSuitesChanged,this.ensureSuitesDir(),this.loadSuites(),n?.watch!==!1&&this.setupFileWatcher()}collectionService;configService;suitesDir;suites=new Map;fileWatcher=null;debounceTimer=null;onSuitesChanged;ensureSuitesDir(){bt.existsSync(this.suitesDir)||bt.mkdirSync(this.suitesDir,{recursive:!0})}setupFileWatcher(){try{this.fileWatcher=bt.watch(this.suitesDir,(e,r)=>{r&&!r.endsWith(".suite.json")||(this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.loadSuites(),this.onSuitesChanged?.()},200))}),this.fileWatcher.on("error",()=>{})}catch{}}dispose(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.fileWatcher?.close(),this.fileWatcher=null}loadSuites(){if(this.suites.clear(),!bt.existsSync(this.suitesDir))return;let e=bt.readdirSync(this.suitesDir);for(let r of e)if(r.endsWith(".suite.json"))try{let n=qi.join(this.suitesDir,r),i=bt.readFileSync(n,"utf-8"),s=JSON.parse(i),o=Array.isArray(s.nodes)&&s.nodes.length>0?s.nodes:(Array.isArray(s.requests)?s.requests:[]).map(c=>({type:"request",name:c.description||c.name,request:c,enabled:c.enabled!==!1})),l={id:s.id,name:s.name,description:s.description,scripts:s.scripts,nodes:o,config:s.config??{...tl},isTemporary:s.isTemporary,createdAt:s.createdAt??Date.now(),updatedAt:s.updatedAt??Date.now()};l.id&&l.name&&this.suites.set(l.id,l)}catch(n){console.error(`[TestSuiteService] Failed to load ${r}:`,n)}}async getAllSuites(){return Array.from(this.suites.values())}async getSuite(e){return this.suites.get(e)}async createSuite(e){let r=Date.now(),n={id:Pt(e),name:e,nodes:[],config:{...tl},createdAt:r,updatedAt:r};return await this.saveSuiteToDisk(n),this.suites.set(n.id,n),n}async updateSuite(e){e.updatedAt=Date.now(),await this.saveSuiteToDisk(e),this.suites.set(e.id,e)}async duplicateSuite(e,r){let n=this.suites.get(e);if(!n)throw new Error(`Suite not found: ${e}`);let i=n.nodes||[],s=await this.createSuite(r);s.nodes=i.map(c=>({...c})),s.config={...n.config},s.description=n.description;let o=qi.join(this.suitesDir,e),l=qi.join(this.suitesDir,s.id);return bt.existsSync(o)&&this.copyDirRecursive(o,l),await this.saveSuiteToDisk(s),this.suites.set(s.id,s),s}copyDirRecursive(e,r){bt.existsSync(r)||bt.mkdirSync(r,{recursive:!0});for(let n of bt.readdirSync(e,{withFileTypes:!0})){let i=qi.join(e,n.name),s=qi.join(r,n.name);n.isDirectory()?this.copyDirRecursive(i,s):bt.copyFileSync(i,s)}}async deleteSuite(e){let r=this.suites.get(e);if(!r)return!1;let n=`${r.id}.suite.json`,i=qi.join(this.suitesDir,n),s=qi.join(this.suitesDir,r.id);try{return bt.existsSync(i)&&bt.unlinkSync(i),bt.existsSync(s)&&bt.rmSync(s,{recursive:!0,force:!0}),this.suites.delete(e),!0}catch(o){return console.error("[TestSuiteService] Failed to delete suite:",o),!1}}async createTempSuiteFromCollection(e){let r=this.collectionService.getCollection(e);if(!r){console.error(`[TestSuiteService] Collection not found: ${e}`);return}let n=[];this.extractRequestsFromCollection(r,e,r.name,"",n);let i=n.map(l=>({type:"request",name:l.description||l.name,request:l,enabled:l.enabled!==!1})),s=Date.now();return{id:`temp-${e}`,name:r.name,nodes:i,config:{...tl},isTemporary:!0,createdAt:s,updatedAt:s}}async createTempSuiteFromFolder(e,r,n=!0){let i=this.collectionService.getCollection(e);if(!i){console.error(`[TestSuiteService] Collection not found: ${e}`);return}let s=[];this.extractRequestsFromCollection(i,e,i.name,"",s);let o=r.replace(/\/+$/,""),l=s.filter(m=>n?m.folderPath===o||m.folderPath.startsWith(`${o}/`):m.folderPath===o);if(l.length===0){console.error(`[TestSuiteService] No requests under folder "${r}" in collection: ${e}`);return}let c=l.map(m=>({type:"request",name:m.description||m.name,request:m,enabled:m.enabled!==!1})),d=Date.now();return{id:`temp-${e}-${this.slugifyFolderPath(o)}`,name:`${i.name} / ${Ts(o)}`,nodes:c,config:{...tl},isTemporary:!0,createdAt:d,updatedAt:d}}slugifyFolderPath(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}async saveTempSuite(e,r){let n=Date.now(),i=qi.join(this.suitesDir,e.id),s={...e,id:Pt(r),name:r,isTemporary:!1,createdAt:n,updatedAt:n},o=qi.join(this.suitesDir,s.id);return bt.existsSync(i)&&(bt.existsSync(o)&&bt.rmSync(o,{recursive:!0,force:!0}),bt.renameSync(i,o)),await this.saveSuiteToDisk(s),this.suites.set(s.id,s),s}getAllAvailableRequests(){let e=[],r=this.collectionService.getAllCollections();for(let n of r)this.extractRequestsFromCollection(n,n.id,n.name,"",e);return e}extractRequestsFromCollection(e,r,n,i,s){if(e.requests)for(let o of e.requests)s.push({collectionId:r,collectionName:n,requestId:o.id,name:o.name||"Unnamed Request",method:o.method||"GET",folderPath:i});if(e.items)for(let o of e.items)if(o.items||o.folders||o.requests){let l=i?`${i}/${Ir(o.name)}`:Ir(o.name);this.extractRequestsFromCollection(o,r,n,l,s)}else s.push({collectionId:r,collectionName:n,requestId:o.id,name:o.name||"Unnamed Request",method:o.method||"GET",folderPath:i});if(e.folders)for(let o of e.folders){let l=i?`${i}/${Ir(o.name)}`:Ir(o.name);this.extractRequestsFromCollection(o,r,n,l,s)}}async saveSuiteToDisk(e){this.ensureSuitesDir();let r=`${e.id}.suite.json`,n=qi.join(this.suitesDir,r),i=`${n}.tmp-${process.pid}-${Date.now()}`,s={id:e.id,name:e.name,description:e.description,scripts:e.scripts,nodes:Array.isArray(e.nodes)?e.nodes:[],config:e.config??{...tl},isTemporary:e.isTemporary,createdAt:e.createdAt??Date.now(),updatedAt:e.updatedAt??Date.now()},o=JSON.stringify(s,null,2);bt.writeFileSync(i,o,"utf-8"),bt.renameSync(i,n)}}});var oe,wy=ae(()=>{"use strict";oe={Config:Symbol.for("IConfigService"),Console:Symbol.for("IConsoleService"),EnvironmentConfig:Symbol.for("IEnvironmentConfigService"),Collection:Symbol.for("ICollectionService"),HttpRequest:Symbol.for("IHttpRequestService"),HttpClient:Symbol.for("IHttpClient"),Cookie:Symbol.for("ICookieService"),RequestHistory:Symbol.for("IRequestHistoryService"),TestSuite:Symbol.for("ITestSuiteService"),UrlBuilder:Symbol.for("IUrlBuilder"),RequestPreprocessor:Symbol.for("IRequestPreprocessor"),RequestPreparer:Symbol.for("IRequestPreparer"),InterceptorChain:Symbol.for("IInterceptorChain"),ScriptExecutor:Symbol.for("IScriptExecutor"),DataFileParser:Symbol.for("IDataFileParser"),CollectionRequestExecutor:Symbol.for("ICollectionRequestExecutor"),WorkspaceFolder:Symbol.for("WorkspaceFolder"),PersistentCookieJar:Symbol.for("PersistentCookieJar"),OAuth2TokenManager:Symbol.for("IOAuth2TokenManager"),GraphQLSchemaService:Symbol.for("IGraphQLSchemaService"),SchemaInferrer:Symbol.for("SchemaInferrer"),HistoryAnalyzer:Symbol.for("HistoryAnalyzer"),ScriptAnalyzer:Symbol.for("ScriptAnalyzer"),SchemaInferenceService:Symbol.for("SchemaInferenceService"),OpenApiExporter:Symbol.for("OpenApiExporter"),OpenApiImporter:Symbol.for("OpenApiImporter"),SecretResolverRegistry:Symbol.for("SecretResolverRegistry")}});import*as Q1 from"path";function _y(t,e){let{workspaceFolder:r,fileWatcherFactory:n,notificationService:i,workspaceStore:s,globalStore:o,secretStore:l,browserService:c,applicationInfo:d,consoleService:p}=e;t.registerValue(oe.WorkspaceFolder,r),t.registerSingleton(oe.Config,()=>new vo(r,n,i)),t.registerSingleton(oe.Console,()=>p??d5),t.registerSingleton(oe.EnvironmentConfig,y=>new rd(r,s,y.resolve(oe.Config),n,l,e.persistOverrides??!0)),t.registerSingleton(oe.Cookie,()=>new Xf(o)),t.registerSingleton(oe.Collection,y=>new Zf(r,y.resolve(oe.Config),n)),t.registerSingleton(oe.TestSuite,y=>new rp(y.resolve(oe.Collection),y.resolve(oe.Config))),t.registerSingleton(oe.HttpClient,y=>{let b=y.resolve(oe.Config);return new Na(b.getRequestConfig(),r)}),t.registerSingleton(oe.UrlBuilder,()=>new li),t.registerSingleton(oe.InterceptorChain,()=>new bs),t.registerSingleton(oe.HttpRequest,y=>new vs(y.resolve(oe.UrlBuilder),y.resolve(oe.InterceptorChain),y.resolve(oe.HttpClient))),t.registerSingleton(oe.RequestPreprocessor,()=>new Ma),t.registerSingleton(oe.RequestHistory,y=>{let b=y.resolve(oe.EnvironmentConfig);return new ad(b.getHistoriesPath(),Q1.join(b.getRootPath(),"shared-histories"))}),l&&c&&t.registerSingleton(oe.OAuth2TokenManager,y=>new Yf(l,c,y.resolve(oe.EnvironmentConfig),y.resolve(oe.HttpRequest))),t.registerSingleton(oe.GraphQLSchemaService,y=>new id(y.resolve(oe.HttpClient))),t.registerSingleton(oe.SecretResolverRegistry,y=>new tp(y.resolve(oe.Config)));let m=d??{name:"HttpForge",version:"0.0.0"};t.registerSingleton(oe.RequestPreparer,y=>new nd(y.resolve(oe.EnvironmentConfig),y.resolve(oe.HttpRequest),y.resolve(oe.RequestPreprocessor),y.has(oe.OAuth2TokenManager)?y.resolve(oe.OAuth2TokenManager):void 0,m,y.resolve(oe.SecretResolverRegistry))),t.registerSingleton(oe.ScriptExecutor,y=>{let b=y.resolve(oe.Config);return new Cs(y.resolve(oe.HttpRequest),b.getModulePaths(),y.resolve(oe.SecretResolverRegistry),b.getScriptScope(),b.getScriptTimeout())}),t.registerSingleton(oe.DataFileParser,()=>new Da),t.registerSingleton(oe.CollectionRequestExecutor,y=>new bo(y.resolve(oe.HttpRequest),y.resolve(oe.ScriptExecutor),y.resolve(oe.EnvironmentConfig),y.resolve(oe.RequestPreparer),"")),t.registerSingleton(oe.PersistentCookieJar,y=>new ed(y.resolve(oe.Cookie))),t.registerSingleton(oe.SchemaInferrer,()=>new ko),t.registerSingleton(oe.HistoryAnalyzer,y=>new Eu(y.resolve(oe.RequestHistory),y.resolve(oe.SchemaInferrer))),t.registerSingleton(oe.ScriptAnalyzer,()=>new rc),t.registerSingleton(oe.SchemaInferenceService,y=>new tc(y.resolve(oe.HistoryAnalyzer),y.resolve(oe.ScriptAnalyzer),y.resolve(oe.SchemaInferrer))),t.registerSingleton(oe.OpenApiExporter,y=>new Du(y.resolve(oe.Collection),y.resolve(oe.EnvironmentConfig),y.resolve(oe.SchemaInferenceService))),t.registerSingleton(oe.OpenApiImporter,y=>new Fo(y.resolve(oe.Collection),y.resolve(oe.EnvironmentConfig)))}var d5,DC=ae(()=>{"use strict";u0();h0();km();g0();y0();b0();Tm();S0();w0();O0();cf();ff();Jf();qm();Xl();I0();cR();fy();EC();Ng();qC();Om();Vf();$C();FC();wy();d5={log:()=>{},trace:()=>{},debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},logBatch:()=>{},logRawLines:()=>{},show:()=>{},clear:()=>{},dispose:()=>{}}});function Z1(){return rl.instance}var rl,jC=ae(()=>{"use strict";wy();rl=class t{static _instance;services=new Map;primitives=new Map;constructor(){}static get instance(){return t._instance||(t._instance=new t),t._instance}static createFresh(){return new t}static reset(){t._instance&&t._instance.clear(),t._instance=void 0}registerValue(e,r){return this.primitives.set(e,r),this}registerSingleton(e,r){return this.services.set(e,{factory:r,singleton:!0}),this}registerTransient(e,r){return this.services.set(e,{factory:r,singleton:!1}),this}registerInstance(e,r){return this.services.set(e,{factory:()=>r,singleton:!0,instance:r}),this}resolve(e){if(this.primitives.has(e))return this.primitives.get(e);let r=this.services.get(e);if(!r)throw new Error(`Service not registered: ${e.toString()}`);return r.singleton?(r.instance||(r.instance=r.factory(this)),r.instance):r.factory(this)}has(e){return this.services.has(e)||this.primitives.has(e)}clear(){this.services.clear(),this.primitives.clear()}get config(){return this.resolve(oe.Config)}get console(){return this.resolve(oe.Console)}get environmentConfig(){return this.resolve(oe.EnvironmentConfig)}get collection(){return this.resolve(oe.Collection)}get httpRequest(){return this.resolve(oe.HttpRequest)}get httpClient(){return this.resolve(oe.HttpClient)}get cookie(){return this.resolve(oe.Cookie)}get requestHistory(){return this.resolve(oe.RequestHistory)}get dataFileParser(){return this.resolve(oe.DataFileParser)}get scriptExecutor(){return this.resolve(oe.ScriptExecutor)}get requestPreparer(){return this.resolve(oe.RequestPreparer)}get persistentCookieJar(){return this.resolve(oe.PersistentCookieJar)}get oauth2TokenManager(){return this.has(oe.OAuth2TokenManager)?this.resolve(oe.OAuth2TokenManager):void 0}get graphqlSchemaService(){return this.resolve(oe.GraphQLSchemaService)}get testSuite(){return this.resolve(oe.TestSuite)}}});function X1(t){return/\{\{[^}]+\}\}/.test(t)}function np(t,e=16){return!!t&&t.length>=e&&!X1(t)}function LC(t){return t.toUpperCase().replace(/[^A-Z0-9]/g,"_")}function ip(t,e,r,n,i,s=10){let o=t.get(e);o||(o={varName:r,reason:n,occurrences:[],priority:s},t.set(e,o));let l=`${i.requestId}::${i.field}`;o.occurrences.some(c=>`${c.requestId}::${c.field}`===l)||o.occurrences.push(i)}function Ry(t,e=1){let r=ot(t),n=new Map;for(let{request:s}of r){let o=l=>({requestId:s.id,requestName:s.name,field:l});for(let l of s.headers??[]){if(l.enabled===!1)continue;let c=l.key.toLowerCase(),d=l.value;if(c==="authorization"){let p=d.match(/^(bearer|basic|token|digest)\s+(.+)$/i);p&&np(p[2])?ip(n,p[2],`${p[1].toUpperCase()}_TOKEN`,`Authorization ${p[1]} token`,o(`header:${l.key}`),1):np(d)&&ip(n,d,"AUTH_TOKEN","Authorization header value",o(`header:${l.key}`),1)}else p5.has(c)&&np(d)?ip(n,d,LC(l.key),`Sensitive header: ${l.key}`,o(`header:${l.key}`),2):np(d,20)&&!d.includes(" ")&&/^[A-Za-z0-9+/=_.-]+$/.test(d)&&ip(n,d,LC(l.key)||"HEADER_VALUE",`Long opaque value in header: ${l.key}`,o(`header:${l.key}`),5)}for(let l of s.query??[])l.enabled!==!1&&h5.has(l.key.toLowerCase())&&np(l.value)&&ip(n,l.value,LC(l.key),`Sensitive query param: ${l.key}`,o(`query:${l.key}`),2)}let i=new Map;for(let{request:s}of r)if(!(!s.url||X1(s.url)))try{let o=new URL(s.url);if(!["localhost","127.0.0.1","0.0.0.0","::1"].includes(o.hostname)){let c=`${o.protocol}//${o.host}`,d=i.get(c)??[];d.push({requestId:s.id,requestName:s.name,field:"url"}),i.set(c,d)}}catch{}for(let[s,o]of i)o.length>=Math.max(e,2)&&!n.has(s)&&n.set(s,{varName:"BASE_URL",reason:`Shared base URL across ${o.length} requests`,occurrences:o,priority:3});return[...n.entries()].filter(([,s])=>s.occurrences.length>=e).sort((s,o)=>s[1].priority-o[1].priority||s[0].localeCompare(o[0])).map(([s,o])=>({varName:o.varName,value:s,reason:o.reason,occurrences:o.occurrences}))}function UC(t,e){let r={};return eN(t,e,r),r}function eN(t,e,r){for(let n of t){if(n.type==="folder"){n.items&&eN(n.items,e,r);continue}let i=n;for(let s of e){let o=`{{${s.varName}}}`;i.url?.includes(s.value)&&(i.url=i.url.split(s.value).join(o),r[s.varName]=(r[s.varName]??0)+1);for(let l of i.headers??[]){let c=l.value.match(/^(bearer|basic|token|digest)\s+(.+)$/i);c&&c[2]===s.value?(l.value=`${c[1]} ${o}`,r[s.varName]=(r[s.varName]??0)+1):l.value===s.value&&(l.value=o,r[s.varName]=(r[s.varName]??0)+1)}for(let l of i.query??[])l.value===s.value&&(l.value=o,r[s.varName]=(r[s.varName]??0)+1)}}}var p5,h5,HC=ae(()=>{"use strict";Ei();p5=new Set(["x-api-key","x-auth-token","x-access-token","x-token","x-secret","api-key","apikey","x-client-secret","x-rapidapi-key"]),h5=new Set(["api_key","apikey","api-key","access_token","token","auth_token","client_id","client_secret","key","secret"])});function Vr(t,e){let r={type:"string",description:t};return e.length>0&&(r.enum=[...e]),r}function BC(t,e,r){let n=i=>Vr("Name of the collection to act on."+(i?"":" Optional."),e);return[{name:`${t}${G.listCollections}`,description:"List all available HTTP Forge collections (name, description, and request count). Call this first to discover what collections exist, then use list_folders, list_requests or run_* tools.",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.listFolders}`,description:"List all folders in a collection with their full paths and request counts. Use this before run_folder to discover the exact folder path string to pass.",inputSchema:{type:"object",properties:{collection:n(!0)},required:["collection"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.listRequests}`,description:"List the saved requests in a collection (name, HTTP method, folder, and description). Use this to find the exact request name before calling run_request. For large collections use the folder filter and offset/limit to page through results.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:'Optional folder path to filter by (e.g. "Auth").'},offset:{type:"number",description:"Zero-based index to start from (default: 0)."},limit:{type:"number",description:"Maximum number of results to return (default: 50, max: 200)."}},required:["collection"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.searchRequests}`,description:"Search for requests across a collection by name, URL, method, or folder path. Returns matching requests with their folder location. Useful for large collections.",inputSchema:{type:"object",properties:{collection:n(!0),query:{type:"string",description:"Text to search for in request names, URLs, methods, and folder paths (case-insensitive)."}},required:["collection","query"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getRequest}`,description:"Get the full details of a single saved request: URL, method, headers, body, auth, and scripts. Use this to inspect a request before editing it, or to read a script before rewriting it.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id. Use list_requests to find names."}},required:["collection","request"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getEnvironment}`,description:"Show the current environment variable values (merged initial + runtime pm.environment.set overrides). Use this to inspect variable state before running a folder, or to debug {{variable}} resolution failures.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name to inspect (defaults to the currently selected environment)."}}},annotations:{readOnlyHint:!0}},{name:`${t}${G.setVariable}`,description:'Override an environment variable for the current session. In the VS Code extension the change is saved to VS Code workspace storage (survives restarts, but is not in the env JSON file and not source-controlled). In the standalone CLI/core runtime the change is in-memory only and lost when the server restarts. Use set_environment_variable with scope:"permanent" to write to the env JSON file (source-controlled, works in both runtimes).',inputSchema:{type:"object",properties:{key:{type:"string",description:"Variable name (the part inside {{...}})."},value:{type:"string",description:"New value to set."},environment:{type:"string",description:"Environment to update (defaults to the currently selected environment)."}},required:["key","value"]},annotations:{idempotentHint:!0}},{name:`${t}${G.getRunStatus}`,description:"Check whether an async run is still running, completed, or failed. Poll this after calling run_folder/run_collection/run_suite with async:true.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."}},required:["runId"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getRunSummary}`,description:'Get the pass/fail summary of a completed async run (total, passed, failed counts). Use after get_run_status shows "completed". When failures are present the response includes a failedRequests array with full details (method, url, requestBody, status, responseBody, failedTests) and a _nextStep directive. You MUST follow the _nextStep directive immediately \u2014 analyze the failures and provide diagnosis without waiting for the user to ask.',inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."}},required:["runId"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getFailedRequests}`,description:"Get the list of failed requests from a completed async run \u2014 the failures-first view. Never returns passing requests. Use this instead of get_run_summary when you need to see what broke.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."},offset:{type:"number",description:"Zero-based index to start from (default: 0)."},limit:{type:"number",description:"Maximum failures to return (default: 20, max: 100)."}},required:["runId"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.getRequestResult}`,description:"Get the full result (status, body, assertions, console output) for one specific request from an async run. Use after get_failed_requests to drill into a single failure.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by an async run_* call."},request:{type:"string",description:"Name of the request to look up."},iteration:{type:"number",description:"Iteration number (default: 1)."}},required:["runId","request"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.cancelRun}`,description:'Request cancellation of an in-progress async run. Cancellation is best-effort: the currently-executing HTTP request completes normally, but no further requests in the run are started. The run status changes to "cancelled". Has no effect on runs that are already completed, failed, or cancelled.',inputSchema:{type:"object",properties:{runId:{type:"string",description:"Run ID returned by run_collection, run_folder, or run_suite with async:true."}},required:["runId"]},annotations:{idempotentHint:!0}},{name:`${t}${G.runRequest}`,description:"Run a single saved request. Pick the collection, then the request name within it.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Name of the request to run. Use list_requests or search_requests to find names."},requestId:{type:"string",description:'ID of the request (from list_requests/search_requests). Preferred over "request" name when available \u2014 avoids ambiguity with duplicate names.'},...Cy.properties},required:["collection","request"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.runFolder}`,description:"Run every request inside a folder of a collection.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:'Folder path within the collection (e.g. "Auth/Login").'},...Ey.properties},required:["collection","folder"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.runCollection}`,description:"Run every request in a collection.",inputSchema:{type:"object",properties:{collection:n(!0),...xy.properties},required:["collection"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.runSuite}`,description:"Run a saved test suite.",inputSchema:{type:"object",properties:{suite:Vr("Name of the test suite to run.",r),...qy.properties},required:["suite"]},annotations:{readOnlyHint:!1,openWorldHint:!0}},{name:`${t}${G.createCollection}`,description:"Create a new empty collection.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Display name for the new collection."}},required:["name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.renameCollection}`,description:"Rename an existing collection.",inputSchema:{type:"object",properties:{collection:n(!0),newName:{type:"string",description:"New display name for the collection."}},required:["collection","newName"]},annotations:{idempotentHint:!0}},{name:`${t}${G.deleteCollection}`,description:"Permanently delete a collection and all its contents. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{collection:n(!0),confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["collection","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.duplicateCollection}`,description:"Clone a collection under a new name (all folders, requests, and scripts are copied).",inputSchema:{type:"object",properties:{collection:n(!0),newName:{type:"string",description:"Name for the duplicated collection."}},required:["collection","newName"]},annotations:{idempotentHint:!1}},{name:`${t}${G.createFolder}`,description:"Create a folder inside a collection (optionally nested inside another folder).",inputSchema:{type:"object",properties:{collection:n(!0),name:{type:"string",description:"Display name for the new folder."},parentFolder:{type:"string",description:"Slash-separated folder path or folder id of the parent. Omit to create at collection root."}},required:["collection","name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.deleteFolder}`,description:"Delete a folder and all its requests. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:"Slash-separated folder path or folder id to delete."},confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["collection","folder","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.createRequest}`,description:"Create a new HTTP request inside a collection (optionally inside a folder).",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:"Folder path or id. Omit to add at collection root."},name:{type:"string",description:"Display name for the request."},method:{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],description:"HTTP method."},url:{type:"string",description:"Request URL, may include {{variable}} placeholders."},headers:{type:"object",description:"Key/value header map.",additionalProperties:{type:"string"}},body:{type:"string",description:"Raw request body (JSON, text, etc.)."},description:{type:"string",description:"Human-readable description."}},required:["collection","name","method","url"]},annotations:{idempotentHint:!1}},{name:`${t}${G.updateRequest}`,description:"Update fields on an existing request (partial update \u2014 omit fields to keep current values).",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id."},name:{type:"string",description:"New display name."},method:{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]},url:{type:"string"},headers:{type:"object",additionalProperties:{type:"string"}},body:{type:"string"},description:{type:"string"}},required:["collection","request"]},annotations:{idempotentHint:!0}},{name:`${t}${G.deleteRequest}`,description:"Remove a request from a collection. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id to delete."},confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["collection","request","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.getRequestScript}`,description:"Read the pre-request or post-response script of a request.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id."},phase:{type:"string",enum:["pre-request","post-response"],description:"Which script phase to read."}},required:["collection","request","phase"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.setRequestScript}`,description:"Write or replace the pre-request or post-response script of a request.",inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name or id."},phase:{type:"string",enum:["pre-request","post-response"],description:"Which script phase to write."},script:{type:"string",description:"Full JavaScript source to write."}},required:["collection","request","phase","script"]},annotations:{idempotentHint:!0}},{name:`${t}${G.reorderCollectionItems}`,description:"Set the execution/display order of direct children of a collection root or folder. Items not listed are appended at the end.",inputSchema:{type:"object",properties:{collection:n(!0),folder:{type:"string",description:"Folder path or id. Omit to reorder collection root."},order:{type:"array",items:{type:"string"},description:"Ordered list of item names or ids."}},required:["collection","order"]},annotations:{idempotentHint:!0}},{name:`${t}${G.listSuites}`,description:"List all test suites with name, id, request count, and configuration summary.",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.getSuite}`,description:"Get full details of a test suite including flow nodes (suite.nodes) and a flattened request list.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the test suite.",r)},required:["suite"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.createSuite}`,description:"Create a new test suite (empty, pre-populated from a collection/folder, or initialized with an explicit flow nodes graph).",inputSchema:{type:"object",properties:{name:{type:"string",description:"Display name for the new suite."},description:{type:"string",description:"Optional description."},fromCollection:{type:"string",description:"Collection name or id to seed the suite from (all requests in execution order)."},fromFolder:{type:"string",description:"Folder path within fromCollection to seed from."},nodes:{type:"array",items:{type:"object"},description:"Optional full suite.nodes graph. If provided, this becomes the suite flow definition."},iterations:{type:"number",description:"Number of iterations (default: 1)."},stopOnError:{type:"boolean",description:"Stop on first failure (default: false)."},delayBetweenRequests:{type:"number",description:"Milliseconds delay between requests (default: 0)."}},required:["name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.updateSuiteConfig}`,description:"Change a suite's name/description/run configuration and optionally replace the full suite.nodes flow graph.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite to update.",r),name:{type:"string",description:"New display name."},description:{type:"string",description:"New description."},nodes:{type:"array",items:{type:"object"},description:"Optional full suite.nodes graph replacement."},iterations:{type:"number"},stopOnError:{type:"boolean"},delayBetweenRequests:{type:"number"}},required:["suite"]},annotations:{idempotentHint:!0}},{name:`${t}${G.getSuiteNode}`,description:'Get a single suite flow node by path (for example: "2.then.0" or "1.cases.0.nodes.1").',inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),path:{type:"string",description:"Node path to read (dot notation)."}},required:["suite","path"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.listSuiteNodePaths}`,description:"List all node paths and editable branch-array paths for a suite flow graph. Use before add/update/remove/move_suite_node.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),includeBranches:{type:"boolean",description:"Include branch-array paths (default: true)."}},required:["suite"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.addSuiteNode}`,description:"Add a flow node to a suite. Insert at root or into a branch array of a parent node.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),node:{type:"object",description:"Node object to insert (request/script/if/switch/for/while/block)."},parentPath:{type:"string",description:'Optional parent node path (for example: "2" or "1.cases.0"). Omit to insert at root.'},branch:{type:"string",description:'Branch array on parent node (for example: "nodes", "then", "else", "default", "cases.0.nodes"). Required when parentPath is provided.'},index:{type:"number",description:"Optional insertion index inside target array. Omit to append."}},required:["suite","node"]},annotations:{idempotentHint:!1}},{name:`${t}${G.updateSuiteNode}`,description:"Replace a flow node at a specific path in suite.nodes.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),path:{type:"string",description:'Node path to replace (for example: "0" or "2.then.1").'},node:{type:"object",description:"Full replacement node object."}},required:["suite","path","node"]},annotations:{idempotentHint:!0}},{name:`${t}${G.removeSuiteNode}`,description:"Remove a flow node at a specific path from suite.nodes.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),path:{type:"string",description:'Node path to remove (for example: "0" or "2.else.0").'}},required:["suite","path"]},annotations:{destructiveHint:!0}},{name:`${t}${G.moveSuiteNode}`,description:"Move a flow node from one path to another parent/branch/index within suite.nodes.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),fromPath:{type:"string",description:'Source node path (for example: "1.then.0").'},toParentPath:{type:"string",description:"Optional destination parent node path. Omit to move to root."},toBranch:{type:"string",description:"Destination branch array on parent node. Required when toParentPath is provided."},toIndex:{type:"number",description:"Optional destination index in target array. Omit to append."}},required:["suite","fromPath"]},annotations:{idempotentHint:!1}},{name:`${t}${G.addSuiteRequests}`,description:'Legacy compatibility helper. Add one or more request nodes at the suite root, using the same insertion semantics as add_suite_node with type:"request".',inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),requests:{type:"array",items:{type:"object",properties:{collection:{type:"string",description:"Collection name or id."},request:{type:"string",description:"Request name or id."}},required:["collection","request"]},description:"Requests to add."},insertAt:{type:"number",description:"Zero-based root nodes-array index to insert at. Omit to append at end."}},required:["suite","requests"]},annotations:{idempotentHint:!1}},{name:`${t}${G.removeSuiteRequest}`,description:"Remove a request from a request-only root suite by position (0-based) or by name. For flow suites, edit nodes via get_suite/update_suite_config.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),index:{type:"number",description:"Zero-based position in the suite requests list."},request:{type:"string",description:"Request name to remove (used if index is not provided)."}},required:["suite"]},annotations:{destructiveHint:!0}},{name:`${t}${G.reorderSuiteRequests}`,description:"Reorder requests in a request-only root suite. Requests not listed are moved to the end. For flow suites, edit nodes via get_suite/update_suite_config.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite.",r),order:{type:"array",items:{type:"string"},description:"Ordered list of request names."}},required:["suite","order"]},annotations:{idempotentHint:!0}},{name:`${t}${G.duplicateSuite}`,description:"Clone an existing suite under a new name.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite to clone.",r),newName:{type:"string",description:"Name for the duplicated suite."}},required:["suite","newName"]},annotations:{idempotentHint:!1}},{name:`${t}${G.deleteSuite}`,description:"Delete a test suite permanently. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{suite:Vr("Name or id of the suite to delete.",r),confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["suite","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.listEnvironments}`,description:"List all environments with their variable keys (values hidden). Use get_environment_variables to see values.",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.getEnvironmentVariables}`,description:"Get the resolved (merged file + session overrides) variables for an environment.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name (defaults to active environment)."}}},annotations:{readOnlyHint:!0}},{name:`${t}${G.selectEnvironment}`,description:"Set the active environment for all subsequent run_* calls in this session.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Name of the environment to activate."}},required:["environment"]},annotations:{idempotentHint:!0}},{name:`${t}${G.createEnvironment}`,description:"Create a new environment file, optionally pre-populated with variables.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Environment name (becomes the filename)."},variables:{type:"object",description:"Initial key/value variable map.",additionalProperties:{type:"string"}}},required:["name"]},annotations:{idempotentHint:!1}},{name:`${t}${G.deleteEnvironment}`,description:"Delete an environment file permanently. Set confirm:true to proceed.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name to delete."},confirm:{type:"boolean",description:"Must be true to confirm deletion."}},required:["environment","confirm"]},annotations:{destructiveHint:!0}},{name:`${t}${G.setEnvironmentVariable}`,description:'Set a variable in an environment. Scope "session" (default) is in-memory only and always temporary (both runtimes). Scope "permanent" writes to the env JSON config file \u2014 source-controlled and shared with the CLI runtime.',inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name (defaults to active environment)."},key:{type:"string",description:"Variable name."},value:{type:"string",description:"New value."},scope:{type:"string",enum:["session","permanent"],description:'Storage scope. "permanent" writes to disk.'}},required:["key","value"]},annotations:{idempotentHint:!0}},{name:`${t}${G.unsetEnvironmentVariable}`,description:"Remove a session-scoped variable override, restoring the file value.",inputSchema:{type:"object",properties:{environment:{type:"string",description:"Environment name (defaults to active environment)."},key:{type:"string",description:"Variable name to unset."}},required:["key"]},annotations:{idempotentHint:!0}},{name:`${t}${G.setGlobalVariable}`,description:'Set a global variable visible across all environments. Scope "session" (default) is in-memory only and lost on restart (both runtimes). Scope "permanent" writes to _global.json \u2014 source-controlled and shared with the CLI runtime.',inputSchema:{type:"object",properties:{key:{type:"string",description:"Global variable name."},value:{type:"string",description:"Value to set."},scope:{type:"string",enum:["session","permanent"],description:'Storage scope. "permanent" writes to _global.json.'}},required:["key","value"]},annotations:{idempotentHint:!0}},{name:`${t}${G.getGlobals}`,description:"Return all global variables (merged _global.json + runtime pm.globals.set() values).",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:!0}},{name:`${t}${G.scaffoldCollectionFromOpenApi}`,description:"Import an OpenAPI 3.0 spec (JSON or YAML) and scaffold a complete HTTP Forge collection from it. All operations become requests grouped by tag/path. An optional environment is created from the server URL. Returns the new collection id and name. Use this to quickly bootstrap API testing from a spec file.",inputSchema:{type:"object",properties:{specPath:{type:"string",description:"Absolute or workspace-relative path to the OpenAPI 3.0 JSON or YAML file."},collectionName:{type:"string",description:"Override the collection name (defaults to the spec title)."},environmentName:{type:"string",description:"Name for the generated environment that contains the server base URL. Omit to skip environment creation."}},required:["specPath"]},annotations:{idempotentHint:!1}},{name:`${t}${G.suggestAssertions}`,description:"Analyse the last execution history for a request and suggest pm.test() assertions to add to its post-response script. Covers status code, response time, required JSON fields, Content-Type header, and schema conformance. Returns an array of ready-to-paste JavaScript test snippets and a rationale for each.",inputSchema:{type:"object",properties:{collection:{type:"string",description:"Collection name or id that owns the request."},request:{type:"string",description:"Request name or id to analyse."},environment:{type:"string",description:"Environment used when the run was recorded (defaults to active environment)."},maxSuggestions:{type:"number",description:"Cap the number of suggestions returned (default: 10)."}},required:["collection","request"]},annotations:{readOnlyHint:!0}},{name:`${t}${G.explainFailure}`,description:"Explain why a specific request failed in a recent run. Returns the full request (URL, method, headers, body), the response received (status, headers, body), all assertion results, any script errors, and a plain-English diagnosis with suggested fixes. Provide either runId (from a prior run_suite/run_collection call) + request name, or the collection and request names to pull the most recent history entry.",inputSchema:{type:"object",properties:{runId:{type:"string",description:"MCP run id (from run_suite or run_collection). Mutually exclusive with collection+request history lookup."},collection:{type:"string",description:"Collection name or id. Required when runId is omitted."},request:{type:"string",description:"Request name or id."},iteration:{type:"number",description:"Iteration number within the run (default: 1)."}}},annotations:{readOnlyHint:!0}},{name:`${t}${G.suggestEnvVars}`,description:`Scan a collection for hardcoded values (API keys, base URLs, tokens, tenant IDs) that should become environment variables.
|
|
280
280
|
|
|
281
281
|
Returns:
|
|
282
282
|
\u2022 heuristicSuggestions \u2014 values identified by pattern-matching rules (ready to apply)
|
|
@@ -349,7 +349,7 @@ This tool returns request details AND a structured task. You MUST:
|
|
|
349
349
|
3. Return the rows as a JSON array under the key "iterationData" \u2014 each row is an object whose keys match the {{variable}} placeholders in the request.
|
|
350
350
|
4. Respond with the JSON array directly so the user can pass it to run_collection or the CLI --variables flag.
|
|
351
351
|
|
|
352
|
-
Example: for POST /users with body {"name":"{{name}}","email":"{{email}}"} and iterations=4, generate 4 rows: valid user, duplicate email, missing name, email with invalid format.`,inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name, slug, or id."},iterations:{type:"number",description:"Number of test data rows to generate (default: 5, max: 50)."}},required:["collection","request"]},annotations:{readOnlyHint:!0}}]}var Cy,xy,Ey,qy,G,sp=ae(()=>{"use strict";Cy={type:"object",properties:{environment:{type:"string",description:"Environment name to use (defaults to the currently selected environment)"},variables:{type:"object",description:"Extra variables to inject \u2014 merged with environment variables, {{name}} syntax",additionalProperties:{type:"string"}},headers:{type:"object",description:"Override or add request headers",additionalProperties:{type:"string"}},query:{type:"object",description:"Override query parameters",additionalProperties:{type:"string"}},body:{type:"string",description:"Replace the request body (JSON string). Omit to use the saved body."},include:{type:"array",items:{type:"string",enum:["headers","cookies","tests","consoleOutput","report"]},description:"Extra fields to include in the response (default: status, ok, body, allPassed)"}}},xy={type:"object",properties:{environment:{type:"string",description:"Environment name to use"},variables:{type:"object",description:"Extra variables injected into every request",additionalProperties:{type:"string"}},iterations:{type:"number",description:"Number of iterations (default: 1)"},concurrency:{type:"number",description:"Number of parallel virtual users (1\u201350, default: 1). Each VU runs the full request sequence independently, preserving inter-request dependencies."},stopOnError:{type:"boolean",description:"Stop on first failure"},delay:{type:"number",description:"Delay between requests in ms"},include:{type:"array",items:{type:"string",enum:["perRequest","failedOnly","consoleOutput","report"]},description:"Result detail level"},async:{type:"boolean",description:"When true, start the run in the background and return a runId immediately. Use get_run_status / get_failed_requests to poll results. Recommended for folders with many requests."}}},Ey={type:"object",properties:{environment:{type:"string",description:"Environment name to use"},variables:{type:"object",description:"Extra variables injected into every request",additionalProperties:{type:"string"}},iterations:{type:"number",description:"Number of iterations (default: 1)"},concurrency:{type:"number",description:"Number of parallel virtual users (1\u201350, default: 1). Each VU runs the full request sequence independently."},stopOnError:{type:"boolean",description:"Stop on first failure"},delay:{type:"number",description:"Delay between requests in ms"},recursive:{type:"boolean",description:"Include requests in nested subfolders (default: true)"},include:{type:"array",items:{type:"string",enum:["perRequest","failedOnly","consoleOutput","report"]},description:"Result detail level"},async:{type:"boolean",description:"When true, start the run in the background and return a runId immediately. Use get_run_status / get_failed_requests to poll results. Recommended for folders with many requests."}}},qy={type:"object",properties:{environment:{type:"string",description:"Environment name to use"},iterations:{type:"number",description:"Number of iterations (overrides suite default)"},concurrency:{type:"number",description:"Number of parallel virtual users (1\u201350, default: 1). Each VU runs the full request sequence independently."},stopOnError:{type:"boolean",description:"Stop on first failure"},delay:{type:"number",description:"Delay between requests in ms"},variables:{type:"object",description:"Extra variables injected into every request",additionalProperties:{type:"string"}},async:{type:"boolean",description:"When true, start the run in the background and return a runId immediately. Use get_run_status / get_failed_requests to poll results."},requestFilter:{type:"array",items:{type:"string"},description:"Run only requests whose names match one of these strings (case-insensitive)"},include:{type:"array",items:{type:"string",enum:["perRequest","failedOnly","consoleOutput","report"]},description:"Result detail level (default: summary + failedRequests)"}}},G={listCollections:"list_collections",listFolders:"list_folders",listRequests:"list_requests",searchRequests:"search_requests",getEnvironment:"get_environment",runRequest:"run_request",runFolder:"run_folder",runCollection:"run_collection",runSuite:"run_suite",getRunStatus:"get_run_status",getRunSummary:"get_run_summary",getFailedRequests:"get_failed_requests",getRequestResult:"get_request_result",cancelRun:"cancel_run",setVariable:"set_variable",createCollection:"create_collection",renameCollection:"rename_collection",deleteCollection:"delete_collection",duplicateCollection:"duplicate_collection",createFolder:"create_folder",deleteFolder:"delete_folder",getRequest:"get_request",createRequest:"create_request",updateRequest:"update_request",deleteRequest:"delete_request",getRequestScript:"get_request_script",setRequestScript:"set_request_script",reorderCollectionItems:"reorder_collection_items",listSuites:"list_suites",getSuite:"get_suite",createSuite:"create_suite",updateSuiteConfig:"update_suite_config",getSuiteNode:"get_suite_node",listSuiteNodePaths:"list_suite_node_paths",addSuiteNode:"add_suite_node",updateSuiteNode:"update_suite_node",removeSuiteNode:"remove_suite_node",moveSuiteNode:"move_suite_node",addSuiteRequests:"add_suite_requests",removeSuiteRequest:"remove_suite_request",reorderSuiteRequests:"reorder_suite_requests",duplicateSuite:"duplicate_suite",deleteSuite:"delete_suite",listEnvironments:"list_environments",getEnvironmentVariables:"get_environment_variables",selectEnvironment:"select_environment",createEnvironment:"create_environment",deleteEnvironment:"delete_environment",setEnvironmentVariable:"set_environment_variable",unsetEnvironmentVariable:"unset_environment_variable",setGlobalVariable:"set_global_variable",getGlobals:"get_globals",scaffoldCollectionFromOpenApi:"scaffold_collection_from_openapi",suggestAssertions:"suggest_assertions",explainFailure:"explain_failure",suggestEnvVars:"suggest_env_vars",applyEnvVars:"apply_env_vars",getRequestsForEnhancement:"get_requests_for_enhancement",applyRequestEnhancements:"apply_request_enhancements",aiSuggestEnvVars:"ai_suggest_env_vars",aiEnhanceCollection:"ai_enhance_collection",analyzeCoverage:"analyze_coverage",aiAnalyzeCoverage:"ai_analyze_coverage",generateRequestFromIntent:"generate_request_from_intent",validateAgainstSpec:"validate_against_spec",generateScenarios:"generate_scenarios",healAssertions:"heal_assertions",generateIterationData:"generate_iteration_data"}});import*as op from"fs";import*as Zi from"path";function le(t){return new Error(`Bad request: ${t}`)}function at(t,e){if(typeof t!="string"||!t.trim())throw le('the "collection" argument is required');let r=t.toLowerCase(),n=e.find(i=>i.id===t||i.name===t)??e.find(i=>i.name.toLowerCase()===r)??e.find(i=>i.name.toLowerCase().includes(r))??e.find(i=>i.id.toLowerCase().includes(r));if(!n){let i=e.map(s=>`"${s.name}"`).join(", ");throw le(`collection not found: "${t}". Available collections: ${i||"(none)"}. Call list_collections to see all.`)}return n}function Qi(t,e){if(typeof t!="string"||!t.trim())throw le('the "request" argument is required');let r=ot(e),n=t.toLowerCase(),i=r.find(s=>s.request.id===t||s.request.name===t)??r.find(s=>s.request.name.toLowerCase()===n)??r.find(s=>s.request.name.toLowerCase().includes(n));if(!i){let s=r.slice(0,10).map(o=>`"${o.request.name}"`).join(", ");throw le(`request "${t}" not found in collection "${e.name}". First ${Math.min(r.length,10)} requests: ${s||"(none)"}. Call list_requests or search_requests to find the exact name.`)}return i.request}function tN(t,e){for(let r of t){if(r.type!=="folder")continue;let n=r;if(n.id===e)return n;let i=tN(n.items??[],e);if(i)return i}}async function xn(t,e){if(typeof t!="string"||!t.trim())throw le('the "suite" argument is required');let r=await e.testSuite.getAllSuites(),n=t.toLowerCase(),i=r.find(s=>s.id===t||s.name===t)??r.find(s=>s.name.toLowerCase()===n);if(!i){let s=r.map(o=>`"${o.name}"`).join(", ");throw le(`suite "${t}" not found. Available suites: ${s||"(none)"}. Call list_suites to see all.`)}return i}async function WC(t,e,r,n,i){let s=r.collection.getAllCollections();if(t===G.listCollections)return{collections:s.map(v=>({name:v.name,id:v.id,description:v.description??"",requestCount:ot(v).length}))};if(t===G.listFolders){let v=at(e.collection,s);return{collection:v.name,folders:un(v).map(({folderPath:_,requestCount:q})=>({path:Ts(_),requestCount:q}))}}if(t===G.listRequests){let v=at(e.collection,s),_=typeof e.folder=="string"?e.folder.toLowerCase():void 0,q=typeof e.offset=="number"?Math.max(0,e.offset):0,k=typeof e.limit=="number"?Math.min(200,Math.max(1,e.limit)):50,O=ot(v).filter(({folderPath:M})=>!_||M.toLowerCase().includes(_)).map(({request:M,folderPath:j})=>({id:M.id,name:M.name,method:M.method,folder:Ts(j),description:M.description??""}));return{collection:v.name,total:O.length,offset:q,limit:k,requests:O.slice(q,q+k)}}if(t===G.searchRequests){let v=at(e.collection,s),_=typeof e.query=="string"?e.query.toLowerCase().trim():"";if(!_)throw le('the "query" argument is required');let q=ot(v).filter(({request:k,folderPath:O})=>k.name.toLowerCase().includes(_)||(k.url??"").toLowerCase().includes(_)||k.method.toLowerCase().includes(_)||O.toLowerCase().includes(_)||(k.description??"").toLowerCase().includes(_)).map(({request:k,folderPath:O})=>({id:k.id,name:k.name,method:k.method,url:k.url??"",folder:Ts(O),description:k.description??""}));return{collection:v.name,query:e.query,total:q.length,requests:q}}if(t===G.getRequest){let v=at(e.collection,s),_=Qi(e.request,v),q=r.collection.getRequestScript(v.id,_.id,"pre-request")??"",k=r.collection.getRequestScript(v.id,_.id,"post-response")??"";return{id:_.id,name:_.name,method:_.method,url:_.url??"",description:_.description??"",headers:_.headers??[],body:_.body??null,auth:_.auth??null,scripts:{preRequest:q,postResponse:k},hint:"Use update_request to modify fields, set_request_script to modify scripts, or run_request to execute it."}}if(t===G.getEnvironment){let v=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment(),_=r.environmentConfig.getResolvedEnvironment(v);if(!_)throw le(`environment "${v}" not found`);return{name:_.name,variables:_.variables}}if(t===G.setVariable){let v=typeof e.key=="string"?e.key.trim():"",_=typeof e.value=="string"?e.value:String(e.value??"");if(!v)throw le('"key" is required');let q=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment();return r.environmentConfig.setEnvironmentVariable(v,_,q),{set:!0,key:v,environment:q}}if(t===G.getRunStatus){let v=n.require(e.runId);return{runId:v.id,status:v.status,suiteName:v.suiteName,progress:v.progress,...v.error?{error:v.error}:{}}}if(t===G.getRunSummary){let v=n.require(e.runId);if(v.status==="running")return{runId:v.id,status:"running",progress:v.progress};let _=(v.summary.failed??0)>0||v.summary.allPassed===!1,q=v.noAssertionExamples??[],k=q.length,O=v.summary.total,M=k>0?k/(O||1)>.5?`${k}/${O} requests have no pm.test() assertions. Invoke the "review-collection" prompt (collection="${v.suiteName}") for a full coverage analysis.`:`${k} request(s) have no pm.test() assertions (e.g. ${q.slice(0,3).map(j=>`"${j}"`).join(", ")}). Invoke the "suggest-assertions" prompt (collection="${v.suiteName}") to add test coverage.`:null;return{runId:v.id,status:v.status,suiteName:v.suiteName,summary:v.summary,...v.reportPath?{report:{uri:`file://${v.reportPath}`}}:{},..._?{failedRequests:v.failedRequests}:{},..._?{_nextStep:`REQUIRED ACTION: ${v.summary.failed} request(s) failed. The failedRequests array above contains the full details (method, url, requestBody, requestHeaders, status, responseBody, failedTests). Immediately analyze each failed request and provide: (1) root cause, (2) specific fix, (3) corrected pm.test() assertions if relevant. Do NOT wait for the user to ask \u2014 diagnose now.`}:{},...M?{_suggestions:[M]}:{}}}if(t===G.getFailedRequests){let v=n.require(e.runId);if(v.status==="running")return{runId:v.id,status:"running",progress:v.progress,failedSoFar:v.failedRequests.length};let _=typeof e.offset=="number"?Math.max(0,e.offset):0,q=typeof e.limit=="number"?Math.min(100,Math.max(1,e.limit)):20;return{runId:v.id,status:v.status,totalFailed:v.failedRequests.length,offset:_,limit:q,failedRequests:v.failedRequests.slice(_,_+q)}}if(t===G.getRequestResult){let v=n.require(e.runId),_=e.request;if(typeof _!="string"||!_)throw le('"request" is required');let q=typeof e.iteration=="number"?e.iteration:1,k=v.allResults.find(O=>O.iteration===q&&(O.name===_||O.name.toLowerCase()===_.toLowerCase()));if(!k){if(v.status==="running")return{runId:v.id,status:"running",message:`Request "${_}" has not completed yet.`};throw new Error(`Request "${_}" (iteration ${q}) not found in run "${v.id}".`)}return{runId:v.id,...k}}if(t===G.cancelRun){let v=n.require(e.runId);if(v.status!=="running")return{runId:v.id,status:v.status,cancelled:!1,message:`Run is already "${v.status}" \u2014 nothing to cancel.`};let _=n.cancel(String(e.runId));return{runId:v.id,status:"cancelled",cancelled:_,progress:v.progress,message:"Cancellation requested. The currently-executing request will finish; remaining requests will be skipped."}}if(t===G.runRequest){let v=at(e.collection,s),_=ot(v),q=typeof e.requestId=="string"?e.requestId.trim():void 0,k=e.request,O;if(q){if(O=_.find(M=>M.request.id===q),!O)throw le(`request with id "${q}" not found in collection "${v.name}"`)}else{if(typeof k!="string"||!k.trim())throw le('the "request" or "requestId" argument is required');if(O=_.find(M=>M.request.name===k)??_.find(M=>M.request.name.toLowerCase()===k.toLowerCase()),!O)throw le(`request "${k}" not found in collection "${v.name}"`)}return i.runRequest(v,O.request.id,e)}if(t===G.runFolder){let v=at(e.collection,s);if(typeof e.folder!="string"||!e.folder.trim())throw le('the "folder" argument is required');let _=e.folder.toLowerCase(),q=Sy(e.folder),k=q.toLowerCase(),O=un(v).map(j=>j.folderPath),M=O.find(j=>j===q)??O.find(j=>j.toLowerCase()===k)??O.find(j=>j.toLowerCase().includes(k))??O.find(j=>j.split("/").some(I=>I.toLowerCase().includes(k)));if(!M){let j=O.map(I=>`"${I}"`).join(", ");throw le(`folder "${e.folder}" not found in collection "${v.name}". Available folders: ${j||"(none)"}. Call list_folders to see all.`)}return i.runFolder(v,M,e)}if(t===G.runCollection){let v=at(e.collection,s);return i.runCollection(v,e)}if(t===G.createCollection){let v=typeof e.name=="string"?e.name.trim():"";if(!v)throw le('"name" is required');let _=await r.collection.createCollection(v);return{id:_.id,name:_.name,created:!0,hint:"Collection is empty. Call create_folder to add folders, or create_request to add requests directly."}}if(t===G.renameCollection){let v=at(e.collection,s),_=typeof e.newName=="string"?e.newName.trim():"";if(!_)throw le('"newName" is required');return await r.collection.renameCollection(v.id,_),{id:v.id,oldName:v.name,newName:_,renamed:!0}}if(t===G.deleteCollection){if(e.confirm!==!0)throw le('"confirm" must be true to delete a collection');let v=at(e.collection,s);return await r.collection.deleteCollection(v.id),{deleted:!0,collection:v.name}}if(t===G.duplicateCollection){let v=at(e.collection,s),_=typeof e.newName=="string"?e.newName.trim():"";if(!_)throw le('"newName" is required');let q=await r.collection.duplicateCollection(v.id,_);return{id:q.id,name:q.name,duplicatedFrom:v.name}}if(t===G.createFolder){let v=at(e.collection,s),_=typeof e.name=="string"?e.name.trim():"";if(!_)throw le('"name" is required');let q;if(typeof e.parentFolder=="string"&&e.parentFolder.trim()){let O=e.parentFolder.toLowerCase(),M=un(v);if(ot(v).map(I=>I.folderPath)&&M.find(I=>I.folderPath===e.parentFolder||I.folderPath.toLowerCase()===O)){let R=un(v).find(A=>A.folderPath===e.parentFolder||A.folderPath.toLowerCase()===O);if(R){let A=v.items,F=(D,J)=>{for(let Q of D)if(Q.type==="folder"){let se=Q;if(se.name===J||J.endsWith("/"+se.name))return se;let ce=F(se.items??[],J);if(ce)return ce}};q=F(A,R.folderPath)?.id}}}let k=await r.collection.createFolder({collectionId:v.id,name:_,parentId:q});return{id:k.id,name:k.name,created:!0,collection:v.name}}if(t===G.deleteFolder){if(e.confirm!==!0)throw le('"confirm" must be true to delete a folder');let v=at(e.collection,s);if(typeof e.folder!="string"||!e.folder.trim())throw le('"folder" is required');let _=e.folder.toLowerCase(),q=un(v).find(M=>M.folderPath===e.folder||M.folderPath.toLowerCase()===_);if(!q)throw le(`folder "${e.folder}" not found in collection "${v.name}"`);let k=tN(v.items,q.folderId);if(!k)throw le(`folder "${e.folder}" could not be resolved`);let O=q.requestCount;return await r.collection.deleteFolder(v.id,k.id),{deleted:!0,folder:q.folderPath,requestsRemoved:O}}if(t===G.createRequest){let v=at(e.collection,s),_=typeof e.name=="string"?e.name.trim():"";if(!_)throw le('"name" is required');let q=typeof e.method=="string"?e.method.toUpperCase():"GET",k=typeof e.url=="string"?e.url:"";if(!k)throw le('"url" is required');let O;if(typeof e.folder=="string"&&e.folder.trim()){let I=e.folder.toLowerCase(),R=un(v).find(A=>A.folderPath===e.folder||A.folderPath.toLowerCase()===I);R&&(O=R.folderId)}let M={collectionId:v.id,parentId:O,name:_,method:q,url:k,headers:void 0,body:e.body?{type:"raw",raw:String(e.body),contentType:"application/json"}:void 0,description:typeof e.description=="string"?e.description:void 0},j=await r.collection.createRequest(M);return{id:j.id,name:j.name,created:!0,collection:v.name,hint:"Request created. Call run_request to execute it, or set_request_script to add pre-request/post-response scripts."}}if(t===G.updateRequest){let v=at(e.collection,s),_=Qi(e.request,v),q={};return typeof e.name=="string"&&(q.name=e.name),typeof e.method=="string"&&(q.method=e.method.toUpperCase()),typeof e.url=="string"&&(q.url=e.url),e.headers&&typeof e.headers=="object"&&!Array.isArray(e.headers)&&(q.headers=Object.entries(e.headers).map(([k,O])=>({name:k,value:String(O),enabled:!0}))),typeof e.body=="string"&&(q.body={type:"raw",raw:e.body,contentType:"application/json"}),typeof e.description=="string"&&(q.description=e.description),await r.collection.updateRequest(v.id,_.id,q),{updated:!0,request:_.name}}if(t===G.deleteRequest){if(e.confirm!==!0)throw le('"confirm" must be true to delete a request');let v=at(e.collection,s),_=Qi(e.request,v);return await r.collection.deleteRequest(v.id,_.id),{deleted:!0,request:_.name}}if(t===G.getRequestScript){let v=at(e.collection,s),_=Qi(e.request,v),q=e.phase;if(q!=="pre-request"&&q!=="post-response")throw le('"phase" must be "pre-request" or "post-response"');let k=r.collection.getRequestScript(v.id,_.id,q);return{collection:v.name,request:_.name,phase:q,script:k??""}}if(t===G.setRequestScript){let v=at(e.collection,s),_=Qi(e.request,v),q=e.phase;if(q!=="pre-request"&&q!=="post-response")throw le('"phase" must be "pre-request" or "post-response"');if(typeof e.script!="string")throw le('"script" is required');return await r.collection.setRequestScript(v.id,_.id,q,e.script),{updated:!0,collection:v.name,request:_.name,phase:q}}if(t===G.reorderCollectionItems){let v=at(e.collection,s);if(!Array.isArray(e.order))throw le('"order" must be an array');let _;if(typeof e.folder=="string"&&e.folder.trim()){let O=e.folder.toLowerCase(),M=un(v).find(j=>j.folderPath===e.folder||j.folderPath.toLowerCase()===O);if(!M)throw le(`folder "${e.folder}" not found in collection "${v.name}"`);_=M.folderId}let q=_?v.items.find(O=>O.id===_)?.items??[]:v.items,k=e.order.map(O=>q.find(j=>j.id===O||j.name===O)?.id??O);return await r.collection.reorderItems(v.id,_,k),{reordered:!0,collection:v.name,order:e.order}}let o=v=>(Array.isArray(v.nodes)?v.nodes:[]).every(q=>q?.type==="request"),l=(v,_="")=>{let q=[];if(!Array.isArray(v))return q;for(let k=0;k<v.length;k+=1){let O=v[k],M=_?`${_}.${k}`:`${k}`;!O||typeof O!="object"||(O.type==="request"&&q.push({node:O,path:M}),Array.isArray(O.nodes)&&q.push(...l(O.nodes,`${M}.nodes`)),Array.isArray(O.then)&&q.push(...l(O.then,`${M}.then`)),Array.isArray(O.else)&&q.push(...l(O.else,`${M}.else`)),Array.isArray(O.default)&&q.push(...l(O.default,`${M}.default`)),Array.isArray(O.elseif)&&O.elseif.forEach((j,I)=>{Array.isArray(j?.nodes)&&q.push(...l(j.nodes,`${M}.elseif.${I}.nodes`)),Array.isArray(j?.then)&&q.push(...l(j.then,`${M}.elseif.${I}.then`))}),Array.isArray(O.cases)&&O.cases.forEach((j,I)=>{Array.isArray(j?.nodes)&&q.push(...l(j.nodes,`${M}.cases.${I}.nodes`)),Array.isArray(j?.then)&&q.push(...l(j.then,`${M}.cases.${I}.then`))}))}return q},c=(v,_)=>{if(typeof v!="string"||!v.trim())throw le(`"${_}" is required`);let q=v.trim(),k=q.split(".");if(k.some(O=>O===""))throw le(`"${_}" is invalid: "${q}"`);return k.map(O=>/^\d+$/.test(O)?Number(O):O)},d=(v,_)=>{let q=c(_,"path"),k=v;for(let O of q)if(typeof O=="number"){if(!Array.isArray(k)||O<0||O>=k.length)throw le(`node path not found: "${String(_)}"`);k=k[O]}else{if(!k||typeof k!="object"||!(O in k))throw le(`node path not found: "${String(_)}"`);k=k[O]}return k},p=(v,_)=>{let q=c(_,"path"),k=q[q.length-1];if(typeof k!="number")throw le(`"path" must end with a numeric index: "${String(_)}"`);let O=v;for(let M=0;M<q.length-1;M+=1){let j=q[M];if(typeof j=="number"){if(!Array.isArray(O)||j<0||j>=O.length)throw le(`node path not found: "${String(_)}"`);O=O[j]}else{if(!O||typeof O!="object"||!(j in O))throw le(`node path not found: "${String(_)}"`);O=O[j]}}if(!Array.isArray(O)||k<0||k>=O.length)throw le(`node path not found: "${String(_)}"`);return{array:O,index:k}},m=(v,_,q,k)=>{if(_==null||_===""){if(q!=null&&q!=="")throw le(`"${k}" is only valid when a parent path is provided`);return{array:v,pathPrefix:""}}if(typeof q!="string"||!q.trim())throw le(`"${k}" is required when parent path is provided`);let O=String(_).trim(),M=q.trim(),j=d(v,O),I=c(M,k),R=j;for(let A=0;A<I.length;A+=1){let F=I[A],U=A===I.length-1;if(typeof F=="number"){if(!Array.isArray(R)||F<0||F>=R.length)throw le(`branch path not found: "${M}"`);R=R[F]}else{if(!R||typeof R!="object")throw le(`branch path not found: "${M}"`);if(!(F in R))if(U)R[F]=[];else throw le(`branch path not found: "${M}"`);R=R[F]}}if(!Array.isArray(R))throw le(`target branch must be an array: "${M}"`);return{array:R,pathPrefix:`${O}.${M}`}},y=(v,_="")=>{let q=[],k=[],O=(M,j)=>{if(Array.isArray(M)){j&&k.push(j);for(let I=0;I<M.length;I+=1){let R=M[I],A=j?`${j}.${I}`:`${I}`;q.push({path:A,type:R?.type,name:R?.name}),!(!R||typeof R!="object")&&(Array.isArray(R.nodes)&&O(R.nodes,`${A}.nodes`),Array.isArray(R.then)&&O(R.then,`${A}.then`),Array.isArray(R.else)&&O(R.else,`${A}.else`),Array.isArray(R.default)&&O(R.default,`${A}.default`),Array.isArray(R.cases)&&R.cases.forEach((F,U)=>{Array.isArray(F?.nodes)&&O(F.nodes,`${A}.cases.${U}.nodes`),Array.isArray(F?.then)&&O(F.then,`${A}.cases.${U}.then`)}),Array.isArray(R.elseif)&&R.elseif.forEach((F,U)=>{Array.isArray(F?.nodes)&&O(F.nodes,`${A}.elseif.${U}.nodes`),Array.isArray(F?.then)&&O(F.then,`${A}.elseif.${U}.then`)}))}}};return O(v,_),{nodePaths:q,branchPaths:k}};if(t===G.listSuites)return{suites:(await r.testSuite.getAllSuites()).map(_=>({id:_.id,name:_.name,description:_.description??"",requestCount:l(_.nodes||[]).length,flowNodeCount:_.nodes?.length??0,iterations:_.config?.iterations??1}))};if(t===G.getSuite){let v=await xn(e.suite,r),_=l(v.nodes||[]);return{id:v.id,name:v.name,description:v.description??"",config:{iterations:v.config?.iterations??1,delayBetweenRequests:v.config?.delayBetweenRequests??0,stopOnError:v.config?.stopOnError??!1},nodes:v.nodes||[],requests:_.map(({node:q,path:k})=>{let O=q.request;return{nodePath:k,slug:O.slug??O.requestId,collectionId:O.collectionId,requestId:O.requestId,name:O.name,method:O.method,folderPath:O.folderPath??"",enabled:q.enabled!==!1}})}}if(t===G.createSuite){let v=typeof e.name=="string"?e.name.trim():"";if(!v)throw le('"name" is required');let _;if(typeof e.fromCollection=="string"&&e.fromCollection.trim()){let q=at(e.fromCollection,s),k=await r.testSuite.createTempSuiteFromCollection(q.id);if(!k)throw new Error(`Could not build suite from collection "${q.name}"`);if(typeof e.fromFolder=="string"&&e.fromFolder.trim()){let O=Sy(e.fromFolder),M=k.nodes||[];k.nodes=M.filter(j=>{if(j.type!=="request")return!0;let I=j.request?.folderPath||"";return I===O||I.startsWith(`${O}/`)})}_=await r.testSuite.saveTempSuite(k,v)}else _=await r.testSuite.createSuite(v);if(e.iterations!==void 0||e.stopOnError!==void 0||e.delayBetweenRequests!==void 0||e.description!==void 0||e.nodes!==void 0){if(e.description!==void 0&&(_.description=String(e.description)),e.nodes!==void 0){if(!Array.isArray(e.nodes))throw le('"nodes" must be an array when provided');_.nodes=e.nodes}_.config={..._.config,...typeof e.iterations=="number"?{iterations:e.iterations}:{},...typeof e.stopOnError=="boolean"?{stopOnError:e.stopOnError}:{},...typeof e.delayBetweenRequests=="number"?{delayBetweenRequests:e.delayBetweenRequests}:{}},await r.testSuite.updateSuite(_)}return{id:_.id,name:_.name,requestCount:_.nodes?.filter(q=>q.type==="request").length??0,created:!0,hint:(_.nodes?.filter(q=>q.type==="request").length??0)===0?"Suite is empty. Call add_suite_requests to populate it with requests from a collection.":"Suite created. Call run_suite to execute it."}}if(t===G.updateSuiteConfig){let v=await xn(e.suite,r);if(typeof e.name=="string"&&e.name.trim()&&(v.name=e.name.trim()),typeof e.description=="string"&&(v.description=e.description),e.nodes!==void 0){if(!Array.isArray(e.nodes))throw le('"nodes" must be an array when provided');v.nodes=e.nodes}return v.config={...v.config,...typeof e.iterations=="number"?{iterations:e.iterations}:{},...typeof e.stopOnError=="boolean"?{stopOnError:e.stopOnError}:{},...typeof e.delayBetweenRequests=="number"?{delayBetweenRequests:e.delayBetweenRequests}:{}},await r.testSuite.updateSuite(v),{updated:!0,suite:v.name}}if(t===G.getSuiteNode){let v=await xn(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=d(v.nodes,e.path);return{suite:v.name,path:String(e.path),node:_}}if(t===G.listSuiteNodePaths){let v=await xn(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=e.includeBranches!==!1,q=y(v.nodes);return{suite:v.name,nodeCount:q.nodePaths.length,nodePaths:q.nodePaths,branchPaths:_?q.branchPaths:void 0,rootBranchPath:""}}if(t===G.addSuiteNode){let v=await xn(e.suite,r);if(Array.isArray(v.nodes)||(v.nodes=[]),!e.node||typeof e.node!="object"||Array.isArray(e.node))throw le('"node" must be an object');let{array:_,pathPrefix:q}=m(v.nodes,e.parentPath,e.branch,"branch"),k=typeof e.index=="number"?Math.max(0,Math.min(e.index,_.length)):_.length;_.splice(k,0,e.node),await r.testSuite.updateSuite(v);let O=q?`${q}.${k}`:`${k}`;return{added:!0,suite:v.name,path:O}}if(t===G.updateSuiteNode){let v=await xn(e.suite,r);if(Array.isArray(v.nodes)||(v.nodes=[]),!e.node||typeof e.node!="object"||Array.isArray(e.node))throw le('"node" must be an object');let _=p(v.nodes,e.path);return _.array[_.index]=e.node,await r.testSuite.updateSuite(v),{updated:!0,suite:v.name,path:String(e.path)}}if(t===G.removeSuiteNode){let v=await xn(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=p(v.nodes,e.path),[q]=_.array.splice(_.index,1);return await r.testSuite.updateSuite(v),{removed:!0,suite:v.name,path:String(e.path),removedType:q?.type}}if(t===G.moveSuiteNode){let v=await xn(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=p(v.nodes,e.fromPath),q=_.array[_.index];_.array.splice(_.index,1);let{array:k,pathPrefix:O}=m(v.nodes,e.toParentPath,e.toBranch,"toBranch"),M=typeof e.toIndex=="number"?Math.max(0,Math.min(e.toIndex,k.length)):k.length;_.array===k&&_.index<M&&(M-=1),k.splice(M,0,q),await r.testSuite.updateSuite(v);let j=O?`${O}.${M}`:`${M}`;return{moved:!0,suite:v.name,fromPath:String(e.fromPath),toPath:j}}if(t===G.addSuiteRequests){let v=await xn(e.suite,r),_=Array.isArray(e.requests)?e.requests:[];if(_.length===0)throw le('"requests" array is required and must not be empty');let q=[];for(let M of _){let j=at(M.collection,s),I=Qi(M.request,j),R=ot(j).find(A=>A.request.id===I.id)?.folderPath??"";q.push({slug:I.id,collectionId:j.id,requestId:I.id,name:I.name,method:I.method,collectionName:j.name,folderPath:R,enabled:!0})}v.nodes||(v.nodes=[]);let k=q.map(M=>({type:"request",name:M.name,request:M,enabled:!0})),O=typeof e.insertAt=="number"?Math.max(0,Math.min(e.insertAt,v.nodes.length)):v.nodes.length;return v.nodes.splice(O,0,...k),await r.testSuite.updateSuite(v),{added:q.length,suite:v.name,insertAt:O,addedPaths:k.map((M,j)=>`${O+j}`),newRequestCount:l(v.nodes||[]).length}}if(t===G.removeSuiteRequest){let v=await xn(e.suite,r);if(!o(v))throw le('remove_suite_request currently supports request-only root suites. For flow suites, use get_suite/update_suite_config with the full "nodes" graph.');v.nodes||(v.nodes=[]);let _=v.nodes.filter(k=>k.type==="request"),q;if(typeof e.index=="number"){if(e.index<0||e.index>=_.length)throw le(`index ${e.index} is out of range`);let k=_[e.index];q=k.name||k.request?.name,v.nodes=v.nodes.filter(O=>O!==k)}else if(typeof e.request=="string"){let k=e.request.toLowerCase(),O=_.find(M=>{let j=M.request?.name||M.name||"";return j===e.request||j.toLowerCase()===k});if(!O)throw le(`request "${e.request}" not found in suite "${v.name}"`);q=O.name||O.request?.name,v.nodes=v.nodes.filter(M=>M!==O)}else throw le('either "index" or "request" is required');return await r.testSuite.updateSuite(v),{removed:!0,request:q,newRequestCount:v.nodes.filter(k=>k.type==="request").length}}if(t===G.reorderSuiteRequests){let v=await xn(e.suite,r);if(!o(v))throw le('reorder_suite_requests currently supports request-only root suites. For flow suites, use get_suite/update_suite_config with the full "nodes" graph.');if(!Array.isArray(e.order))throw le('"order" must be an array of request names');let _=e.order,q=(v.nodes||[]).filter(M=>M.type==="request"),k=(v.nodes||[]).filter(M=>M.type!=="request"),O=[...q].sort((M,j)=>{let I=M.request?.name||M.name||"",R=j.request?.name||j.name||"",A=_.findIndex(J=>J===I||J.toLowerCase()===I.toLowerCase()),F=_.findIndex(J=>J===R||J.toLowerCase()===R.toLowerCase());return(A===-1?1/0:A)-(F===-1?1/0:F)});return v.nodes=[...O,...k],await r.testSuite.updateSuite(v),{reordered:!0,suite:v.name,newOrder:O.map(M=>M.request?.name||M.name)}}if(t===G.duplicateSuite){let v=await xn(e.suite,r),_=typeof e.newName=="string"?e.newName.trim():"";if(!_)throw le('"newName" is required');let q=await r.testSuite.duplicateSuite(v.id,_);return{id:q.id,name:q.name,duplicatedFrom:v.name,requestCount:q.nodes?.filter(k=>k.type==="request").length??0}}if(t===G.deleteSuite){if(e.confirm!==!0)throw le('"confirm" must be true to delete a suite');let v=await xn(e.suite,r);return await r.testSuite.deleteSuite(v.id),{deleted:!0,suite:v.name}}if(t===G.listEnvironments){let v=r.environmentConfig.getAllEnvironments(),_=r.environmentConfig.getSelectedEnvironment();return{environments:v.map(q=>({name:q.name,active:q.active,variableKeys:Object.keys(q.variables)})),active:_}}if(t===G.getEnvironmentVariables){let v=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment(),_=r.environmentConfig.getResolvedEnvironment(v);if(!_)throw le(`environment "${v}" not found`);let k=r.environmentConfig.getSharedConfig()?.environments?.[v]?.variables??{},O=r.environmentConfig.getEnvironmentVariableLocals();return{environment:v,active:r.environmentConfig.getSelectedEnvironment()===v,fileVariables:k,sessionOverrides:O,resolved:_.variables}}if(t===G.selectEnvironment){let v=typeof e.environment=="string"?e.environment.trim():"";if(!v)throw le('"environment" is required');return await r.environmentConfig.setSelectedEnvironment(v),{selected:!0,environment:v}}if(t===G.createEnvironment){let v=typeof e.name=="string"?e.name.trim():"";if(!v)throw le('"name" is required');if(await r.environmentConfig.createEnvironment(v),e.variables&&typeof e.variables=="object"){let _=e.variables,q=r.environmentConfig.getSharedConfig();q&&(q.environments=q.environments??{},q.environments[v]={...q.environments[v]??{},variables:{...q.environments[v]?.variables??{},..._}},r.environmentConfig.saveSharedConfig(q))}return{created:!0,environment:v}}if(t===G.deleteEnvironment){if(e.confirm!==!0)throw le('"confirm" must be true to delete an environment');let v=typeof e.environment=="string"?e.environment.trim():"";if(!v)throw le('"environment" is required');let _=r.environmentConfig.getSelectedEnvironment();return await r.environmentConfig.deleteEnvironment(v),{deleted:!0,environment:v,newActive:_===v?void 0:_}}if(t===G.setEnvironmentVariable){let v=typeof e.key=="string"?e.key.trim():"",_=typeof e.value=="string"?e.value:String(e.value??"");if(!v)throw le('"key" is required');let q=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment(),k=e.scope==="permanent"?"permanent":"session";if(k==="permanent"){let O=r.environmentConfig.getSharedConfig();O&&(O.environments=O.environments??{},O.environments[q]=O.environments[q]??{variables:{}},O.environments[q].variables=O.environments[q].variables??{},O.environments[q].variables[v]=_,r.environmentConfig.saveSharedConfig(O))}else r.environmentConfig.setEnvironmentVariable(v,_,q);return{set:!0,key:v,environment:q,scope:k}}if(t===G.unsetEnvironmentVariable){let v=typeof e.key=="string"?e.key.trim():"";if(!v)throw le('"key" is required');let _=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment();return r.environmentConfig.deleteEnvironmentVariable(v,_),{unset:!0,key:v,environment:_}}if(t===G.setGlobalVariable){let v=typeof e.key=="string"?e.key.trim():"",_=typeof e.value=="string"?e.value:String(e.value??"");if(!v)throw le('"key" is required');let q=e.scope==="permanent"?"permanent":"session";if(q==="permanent"){let k=r.environmentConfig.getSharedConfig();k&&(k.globalVariables=k.globalVariables??{},k.globalVariables[v]=_,r.environmentConfig.saveSharedConfig(k))}else r.environmentConfig.setGlobalVariable(v,_);return{set:!0,key:v,scope:q}}if(t===G.getGlobals)return{globals:r.environmentConfig.getGlobalVariables()};if(t===G.scaffoldCollectionFromOpenApi){let v=typeof e.specPath=="string"?e.specPath.trim():"";if(!v)throw le('"specPath" is required');let _=r.workspaceFolder&&!Zi.isAbsolute(v)?Zi.join(r.workspaceFolder,v):v;if(!op.existsSync(_))throw le(`OpenAPI spec file not found: "${_}"`);let k=await new Fo(r.collection,r.environmentConfig).import(_,{collectionName:typeof e.collectionName=="string"?e.collectionName:void 0,environmentName:typeof e.environmentName=="string"?e.environmentName:void 0});return{collectionId:k.collection.id,collectionName:k.collection.name,requestCount:k.collection.items.filter(O=>O.type==="request").length,environmentCreated:k.environmentCreated??null,hint:"Use list_requests to browse the scaffolded collection, then run_request to test individual endpoints."}}if(t===G.suggestAssertions){let v=e.collection;if(!(typeof e.request=="string"?e.request.trim():""))throw le('"request" is required');let q=at(v,s),k=Qi(e.request,q),O=typeof e.maxSuggestions=="number"?Math.min(20,Math.max(1,e.maxSuggestions)):10,M=[],I=Array.from(n.values()).filter(U=>U.status!=="running").flatMap(U=>U.allResults??[]).filter(U=>U.name===k.name||typeof U.name=="string"&&U.name.toLowerCase()===k.name.toLowerCase()),R=I[I.length-1],A=R?.status;A?M.push({snippet:`pm.test("Status code is ${A}", function () {
|
|
352
|
+
Example: for POST /users with body {"name":"{{name}}","email":"{{email}}"} and iterations=4, generate 4 rows: valid user, duplicate email, missing name, email with invalid format.`,inputSchema:{type:"object",properties:{collection:n(!0),request:{type:"string",description:"Request name, slug, or id."},iterations:{type:"number",description:"Number of test data rows to generate (default: 5, max: 50)."}},required:["collection","request"]},annotations:{readOnlyHint:!0}}]}var Cy,xy,Ey,qy,G,sp=ae(()=>{"use strict";Cy={type:"object",properties:{environment:{type:"string",description:"Environment name to use (defaults to the currently selected environment)"},variables:{type:"object",description:"Extra variables to inject \u2014 merged with environment variables, {{name}} syntax",additionalProperties:{type:"string"}},headers:{type:"object",description:"Override or add request headers",additionalProperties:{type:"string"}},query:{type:"object",description:"Override query parameters",additionalProperties:{type:"string"}},body:{type:"string",description:"Replace the request body (JSON string). Omit to use the saved body."},include:{type:"array",items:{type:"string",enum:["headers","cookies","tests","consoleOutput","report"]},description:"Extra fields to include in the response (default: status, ok, body, allPassed)"}}},xy={type:"object",properties:{environment:{type:"string",description:"Environment name to use"},variables:{type:"object",description:"Extra variables injected into every request",additionalProperties:{type:"string"}},iterations:{type:"number",description:"Number of iterations (default: 1)"},concurrency:{type:"number",description:"Number of parallel virtual users (1\u201350, default: 1). Each VU runs the full request sequence independently, preserving inter-request dependencies."},stopOnError:{type:"boolean",description:"Stop on first failure"},delay:{type:"number",description:"Delay between requests in ms"},include:{type:"array",items:{type:"string",enum:["perRequest","failedOnly","consoleOutput","report"]},description:"Result detail level"},async:{type:"boolean",description:"When true, start the run in the background and return a runId immediately. Use get_run_status / get_failed_requests to poll results. Recommended for folders with many requests."}}},Ey={type:"object",properties:{environment:{type:"string",description:"Environment name to use"},variables:{type:"object",description:"Extra variables injected into every request",additionalProperties:{type:"string"}},iterations:{type:"number",description:"Number of iterations (default: 1)"},concurrency:{type:"number",description:"Number of parallel virtual users (1\u201350, default: 1). Each VU runs the full request sequence independently."},stopOnError:{type:"boolean",description:"Stop on first failure"},delay:{type:"number",description:"Delay between requests in ms"},recursive:{type:"boolean",description:"Include requests in nested subfolders (default: true)"},include:{type:"array",items:{type:"string",enum:["perRequest","failedOnly","consoleOutput","report"]},description:"Result detail level"},async:{type:"boolean",description:"When true, start the run in the background and return a runId immediately. Use get_run_status / get_failed_requests to poll results. Recommended for folders with many requests."}}},qy={type:"object",properties:{environment:{type:"string",description:"Environment name to use"},iterations:{type:"number",description:"Number of iterations (overrides suite default)"},concurrency:{type:"number",description:"Number of parallel virtual users (1\u201350, default: 1). Each VU runs the full request sequence independently."},stopOnError:{type:"boolean",description:"Stop on first failure"},delay:{type:"number",description:"Delay between requests in ms"},variables:{type:"object",description:"Extra variables injected into every request",additionalProperties:{type:"string"}},async:{type:"boolean",description:"When true, start the run in the background and return a runId immediately. Use get_run_status / get_failed_requests to poll results."},requestFilter:{type:"array",items:{type:"string"},description:"Run only requests whose names match one of these strings (case-insensitive)"},include:{type:"array",items:{type:"string",enum:["perRequest","failedOnly","consoleOutput","report"]},description:"Result detail level (default: summary + failedRequests)"}}},G={listCollections:"list_collections",listFolders:"list_folders",listRequests:"list_requests",searchRequests:"search_requests",getEnvironment:"get_environment",runRequest:"run_request",runFolder:"run_folder",runCollection:"run_collection",runSuite:"run_suite",getRunStatus:"get_run_status",getRunSummary:"get_run_summary",getFailedRequests:"get_failed_requests",getRequestResult:"get_request_result",cancelRun:"cancel_run",setVariable:"set_variable",createCollection:"create_collection",renameCollection:"rename_collection",deleteCollection:"delete_collection",duplicateCollection:"duplicate_collection",createFolder:"create_folder",deleteFolder:"delete_folder",getRequest:"get_request",createRequest:"create_request",updateRequest:"update_request",deleteRequest:"delete_request",getRequestScript:"get_request_script",setRequestScript:"set_request_script",reorderCollectionItems:"reorder_collection_items",listSuites:"list_suites",getSuite:"get_suite",createSuite:"create_suite",updateSuiteConfig:"update_suite_config",getSuiteNode:"get_suite_node",listSuiteNodePaths:"list_suite_node_paths",addSuiteNode:"add_suite_node",updateSuiteNode:"update_suite_node",removeSuiteNode:"remove_suite_node",moveSuiteNode:"move_suite_node",addSuiteRequests:"add_suite_requests",removeSuiteRequest:"remove_suite_request",reorderSuiteRequests:"reorder_suite_requests",duplicateSuite:"duplicate_suite",deleteSuite:"delete_suite",listEnvironments:"list_environments",getEnvironmentVariables:"get_environment_variables",selectEnvironment:"select_environment",createEnvironment:"create_environment",deleteEnvironment:"delete_environment",setEnvironmentVariable:"set_environment_variable",unsetEnvironmentVariable:"unset_environment_variable",setGlobalVariable:"set_global_variable",getGlobals:"get_globals",scaffoldCollectionFromOpenApi:"scaffold_collection_from_openapi",suggestAssertions:"suggest_assertions",explainFailure:"explain_failure",suggestEnvVars:"suggest_env_vars",applyEnvVars:"apply_env_vars",getRequestsForEnhancement:"get_requests_for_enhancement",applyRequestEnhancements:"apply_request_enhancements",aiSuggestEnvVars:"ai_suggest_env_vars",aiEnhanceCollection:"ai_enhance_collection",analyzeCoverage:"analyze_coverage",aiAnalyzeCoverage:"ai_analyze_coverage",generateRequestFromIntent:"generate_request_from_intent",validateAgainstSpec:"validate_against_spec",generateScenarios:"generate_scenarios",healAssertions:"heal_assertions",generateIterationData:"generate_iteration_data"}});import*as op from"fs";import*as Zi from"path";function le(t){return new Error(`Bad request: ${t}`)}function at(t,e){if(typeof t!="string"||!t.trim())throw le('the "collection" argument is required');let r=t.toLowerCase(),n=e.find(i=>i.id===t||i.name===t)??e.find(i=>i.name.toLowerCase()===r)??e.find(i=>i.name.toLowerCase().includes(r))??e.find(i=>i.id.toLowerCase().includes(r));if(!n){let i=e.map(s=>`"${s.name}"`).join(", ");throw le(`collection not found: "${t}". Available collections: ${i||"(none)"}. Call list_collections to see all.`)}return n}function Qi(t,e){if(typeof t!="string"||!t.trim())throw le('the "request" argument is required');let r=ot(e),n=t.toLowerCase(),i=r.find(s=>s.request.id===t||s.request.name===t)??r.find(s=>s.request.name.toLowerCase()===n)??r.find(s=>s.request.name.toLowerCase().includes(n));if(!i){let s=r.slice(0,10).map(o=>`"${o.request.name}"`).join(", ");throw le(`request "${t}" not found in collection "${e.name}". First ${Math.min(r.length,10)} requests: ${s||"(none)"}. Call list_requests or search_requests to find the exact name.`)}return i.request}function tN(t,e){for(let r of t){if(r.type!=="folder")continue;let n=r;if(n.id===e)return n;let i=tN(n.items??[],e);if(i)return i}}async function xn(t,e){if(typeof t!="string"||!t.trim())throw le('the "suite" argument is required');let r=await e.testSuite.getAllSuites(),n=t.toLowerCase(),i=r.find(s=>s.id===t||s.name===t)??r.find(s=>s.name.toLowerCase()===n);if(!i){let s=r.map(o=>`"${o.name}"`).join(", ");throw le(`suite "${t}" not found. Available suites: ${s||"(none)"}. Call list_suites to see all.`)}return i}async function WC(t,e,r,n,i){let s=r.collection.getAllCollections();if(t===G.listCollections)return{collections:s.map(v=>({name:v.name,id:v.id,description:v.description??"",requestCount:ot(v).length}))};if(t===G.listFolders){let v=at(e.collection,s);return{collection:v.name,folders:un(v).map(({folderPath:_,requestCount:E})=>({path:Ts(_),requestCount:E}))}}if(t===G.listRequests){let v=at(e.collection,s),_=typeof e.folder=="string"?e.folder.toLowerCase():void 0,E=typeof e.offset=="number"?Math.max(0,e.offset):0,k=typeof e.limit=="number"?Math.min(200,Math.max(1,e.limit)):50,O=ot(v).filter(({folderPath:M})=>!_||M.toLowerCase().includes(_)).map(({request:M,folderPath:j})=>({id:M.id,name:M.name,method:M.method,folder:Ts(j),description:M.description??""}));return{collection:v.name,total:O.length,offset:E,limit:k,requests:O.slice(E,E+k)}}if(t===G.searchRequests){let v=at(e.collection,s),_=typeof e.query=="string"?e.query.toLowerCase().trim():"";if(!_)throw le('the "query" argument is required');let E=ot(v).filter(({request:k,folderPath:O})=>k.name.toLowerCase().includes(_)||(k.url??"").toLowerCase().includes(_)||k.method.toLowerCase().includes(_)||O.toLowerCase().includes(_)||(k.description??"").toLowerCase().includes(_)).map(({request:k,folderPath:O})=>({id:k.id,name:k.name,method:k.method,url:k.url??"",folder:Ts(O),description:k.description??""}));return{collection:v.name,query:e.query,total:E.length,requests:E}}if(t===G.getRequest){let v=at(e.collection,s),_=Qi(e.request,v),E=r.collection.getRequestScript(v.id,_.id,"pre-request")??"",k=r.collection.getRequestScript(v.id,_.id,"post-response")??"";return{id:_.id,name:_.name,method:_.method,url:_.url??"",description:_.description??"",headers:_.headers??[],body:_.body??null,auth:_.auth??null,scripts:{preRequest:E,postResponse:k},hint:"Use update_request to modify fields, set_request_script to modify scripts, or run_request to execute it."}}if(t===G.getEnvironment){let v=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment(),_=r.environmentConfig.getResolvedEnvironment(v);if(!_)throw le(`environment "${v}" not found`);return{name:_.name,variables:_.variables}}if(t===G.setVariable){let v=typeof e.key=="string"?e.key.trim():"",_=typeof e.value=="string"?e.value:String(e.value??"");if(!v)throw le('"key" is required');let E=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment();return r.environmentConfig.setEnvironmentVariable(v,_,E),{set:!0,key:v,environment:E}}if(t===G.getRunStatus){let v=n.require(e.runId);return{runId:v.id,status:v.status,suiteName:v.suiteName,progress:v.progress,...v.error?{error:v.error}:{}}}if(t===G.getRunSummary){let v=n.require(e.runId);if(v.status==="running")return{runId:v.id,status:"running",progress:v.progress};let _=(v.summary.failed??0)>0||v.summary.allPassed===!1,E=v.noAssertionExamples??[],k=E.length,O=v.summary.total,M=k>0?k/(O||1)>.5?`${k}/${O} requests have no pm.test() assertions. Invoke the "review-collection" prompt (collection="${v.suiteName}") for a full coverage analysis.`:`${k} request(s) have no pm.test() assertions (e.g. ${E.slice(0,3).map(j=>`"${j}"`).join(", ")}). Invoke the "suggest-assertions" prompt (collection="${v.suiteName}") to add test coverage.`:null;return{runId:v.id,status:v.status,suiteName:v.suiteName,summary:v.summary,...v.reportPath?{report:{uri:`file://${v.reportPath}`}}:{},..._?{failedRequests:v.failedRequests}:{},..._?{_nextStep:`REQUIRED ACTION: ${v.summary.failed} request(s) failed. The failedRequests array above contains the full details (method, url, requestBody, requestHeaders, status, responseBody, failedTests). Immediately analyze each failed request and provide: (1) root cause, (2) specific fix, (3) corrected pm.test() assertions if relevant. Do NOT wait for the user to ask \u2014 diagnose now.`}:{},...M?{_suggestions:[M]}:{}}}if(t===G.getFailedRequests){let v=n.require(e.runId);if(v.status==="running")return{runId:v.id,status:"running",progress:v.progress,failedSoFar:v.failedRequests.length};let _=typeof e.offset=="number"?Math.max(0,e.offset):0,E=typeof e.limit=="number"?Math.min(100,Math.max(1,e.limit)):20;return{runId:v.id,status:v.status,totalFailed:v.failedRequests.length,offset:_,limit:E,failedRequests:v.failedRequests.slice(_,_+E)}}if(t===G.getRequestResult){let v=n.require(e.runId),_=e.request;if(typeof _!="string"||!_)throw le('"request" is required');let E=typeof e.iteration=="number"?e.iteration:1,k=v.allResults.find(O=>O.iteration===E&&(O.name===_||O.name.toLowerCase()===_.toLowerCase()));if(!k){if(v.status==="running")return{runId:v.id,status:"running",message:`Request "${_}" has not completed yet.`};throw new Error(`Request "${_}" (iteration ${E}) not found in run "${v.id}".`)}return{runId:v.id,...k}}if(t===G.cancelRun){let v=n.require(e.runId);if(v.status!=="running")return{runId:v.id,status:v.status,cancelled:!1,message:`Run is already "${v.status}" \u2014 nothing to cancel.`};let _=n.cancel(String(e.runId));return{runId:v.id,status:"cancelled",cancelled:_,progress:v.progress,message:"Cancellation requested. The currently-executing request will finish; remaining requests will be skipped."}}if(t===G.runRequest){let v=at(e.collection,s),_=ot(v),E=typeof e.requestId=="string"?e.requestId.trim():void 0,k=e.request,O;if(E){if(O=_.find(M=>M.request.id===E),!O)throw le(`request with id "${E}" not found in collection "${v.name}"`)}else{if(typeof k!="string"||!k.trim())throw le('the "request" or "requestId" argument is required');if(O=_.find(M=>M.request.name===k)??_.find(M=>M.request.name.toLowerCase()===k.toLowerCase()),!O)throw le(`request "${k}" not found in collection "${v.name}"`)}return i.runRequest(v,O.request.id,e)}if(t===G.runFolder){let v=at(e.collection,s);if(typeof e.folder!="string"||!e.folder.trim())throw le('the "folder" argument is required');let _=e.folder.toLowerCase(),E=Sy(e.folder),k=E.toLowerCase(),O=un(v).map(j=>j.folderPath),M=O.find(j=>j===E)??O.find(j=>j.toLowerCase()===k)??O.find(j=>j.toLowerCase().includes(k))??O.find(j=>j.split("/").some(I=>I.toLowerCase().includes(k)));if(!M){let j=O.map(I=>`"${I}"`).join(", ");throw le(`folder "${e.folder}" not found in collection "${v.name}". Available folders: ${j||"(none)"}. Call list_folders to see all.`)}return i.runFolder(v,M,e)}if(t===G.runCollection){let v=at(e.collection,s);return i.runCollection(v,e)}if(t===G.createCollection){let v=typeof e.name=="string"?e.name.trim():"";if(!v)throw le('"name" is required');let _=await r.collection.createCollection(v);return{id:_.id,name:_.name,created:!0,hint:"Collection is empty. Call create_folder to add folders, or create_request to add requests directly."}}if(t===G.renameCollection){let v=at(e.collection,s),_=typeof e.newName=="string"?e.newName.trim():"";if(!_)throw le('"newName" is required');return await r.collection.renameCollection(v.id,_),{id:v.id,oldName:v.name,newName:_,renamed:!0}}if(t===G.deleteCollection){if(e.confirm!==!0)throw le('"confirm" must be true to delete a collection');let v=at(e.collection,s);return await r.collection.deleteCollection(v.id),{deleted:!0,collection:v.name}}if(t===G.duplicateCollection){let v=at(e.collection,s),_=typeof e.newName=="string"?e.newName.trim():"";if(!_)throw le('"newName" is required');let E=await r.collection.duplicateCollection(v.id,_);return{id:E.id,name:E.name,duplicatedFrom:v.name}}if(t===G.createFolder){let v=at(e.collection,s),_=typeof e.name=="string"?e.name.trim():"";if(!_)throw le('"name" is required');let E;if(typeof e.parentFolder=="string"&&e.parentFolder.trim()){let O=e.parentFolder.toLowerCase(),M=un(v);if(ot(v).map(I=>I.folderPath)&&M.find(I=>I.folderPath===e.parentFolder||I.folderPath.toLowerCase()===O)){let R=un(v).find(A=>A.folderPath===e.parentFolder||A.folderPath.toLowerCase()===O);if(R){let A=v.items,F=(D,J)=>{for(let Q of D)if(Q.type==="folder"){let se=Q;if(se.name===J||J.endsWith("/"+se.name))return se;let ce=F(se.items??[],J);if(ce)return ce}};E=F(A,R.folderPath)?.id}}}let k=await r.collection.createFolder({collectionId:v.id,name:_,parentId:E});return{id:k.id,name:k.name,created:!0,collection:v.name}}if(t===G.deleteFolder){if(e.confirm!==!0)throw le('"confirm" must be true to delete a folder');let v=at(e.collection,s);if(typeof e.folder!="string"||!e.folder.trim())throw le('"folder" is required');let _=e.folder.toLowerCase(),E=un(v).find(M=>M.folderPath===e.folder||M.folderPath.toLowerCase()===_);if(!E)throw le(`folder "${e.folder}" not found in collection "${v.name}"`);let k=tN(v.items,E.folderId);if(!k)throw le(`folder "${e.folder}" could not be resolved`);let O=E.requestCount;return await r.collection.deleteFolder(v.id,k.id),{deleted:!0,folder:E.folderPath,requestsRemoved:O}}if(t===G.createRequest){let v=at(e.collection,s),_=typeof e.name=="string"?e.name.trim():"";if(!_)throw le('"name" is required');let E=typeof e.method=="string"?e.method.toUpperCase():"GET",k=typeof e.url=="string"?e.url:"";if(!k)throw le('"url" is required');let O;if(typeof e.folder=="string"&&e.folder.trim()){let I=e.folder.toLowerCase(),R=un(v).find(A=>A.folderPath===e.folder||A.folderPath.toLowerCase()===I);R&&(O=R.folderId)}let M={collectionId:v.id,parentId:O,name:_,method:E,url:k,headers:void 0,body:e.body?{type:"raw",raw:String(e.body),contentType:"application/json"}:void 0,description:typeof e.description=="string"?e.description:void 0},j=await r.collection.createRequest(M);return{id:j.id,name:j.name,created:!0,collection:v.name,hint:"Request created. Call run_request to execute it, or set_request_script to add pre-request/post-response scripts."}}if(t===G.updateRequest){let v=at(e.collection,s),_=Qi(e.request,v),E={};return typeof e.name=="string"&&(E.name=e.name),typeof e.method=="string"&&(E.method=e.method.toUpperCase()),typeof e.url=="string"&&(E.url=e.url),e.headers&&typeof e.headers=="object"&&!Array.isArray(e.headers)&&(E.headers=Object.entries(e.headers).map(([k,O])=>({name:k,value:String(O),enabled:!0}))),typeof e.body=="string"&&(E.body={type:"raw",raw:e.body,contentType:"application/json"}),typeof e.description=="string"&&(E.description=e.description),await r.collection.updateRequest(v.id,_.id,E),{updated:!0,request:_.name}}if(t===G.deleteRequest){if(e.confirm!==!0)throw le('"confirm" must be true to delete a request');let v=at(e.collection,s),_=Qi(e.request,v);return await r.collection.deleteRequest(v.id,_.id),{deleted:!0,request:_.name}}if(t===G.getRequestScript){let v=at(e.collection,s),_=Qi(e.request,v),E=e.phase;if(E!=="pre-request"&&E!=="post-response")throw le('"phase" must be "pre-request" or "post-response"');let k=r.collection.getRequestScript(v.id,_.id,E);return{collection:v.name,request:_.name,phase:E,script:k??""}}if(t===G.setRequestScript){let v=at(e.collection,s),_=Qi(e.request,v),E=e.phase;if(E!=="pre-request"&&E!=="post-response")throw le('"phase" must be "pre-request" or "post-response"');if(typeof e.script!="string")throw le('"script" is required');return await r.collection.setRequestScript(v.id,_.id,E,e.script),{updated:!0,collection:v.name,request:_.name,phase:E}}if(t===G.reorderCollectionItems){let v=at(e.collection,s);if(!Array.isArray(e.order))throw le('"order" must be an array');let _;if(typeof e.folder=="string"&&e.folder.trim()){let O=e.folder.toLowerCase(),M=un(v).find(j=>j.folderPath===e.folder||j.folderPath.toLowerCase()===O);if(!M)throw le(`folder "${e.folder}" not found in collection "${v.name}"`);_=M.folderId}let E=_?v.items.find(O=>O.id===_)?.items??[]:v.items,k=e.order.map(O=>E.find(j=>j.id===O||j.name===O)?.id??O);return await r.collection.reorderItems(v.id,_,k),{reordered:!0,collection:v.name,order:e.order}}let o=v=>(Array.isArray(v.nodes)?v.nodes:[]).every(E=>E?.type==="request"),l=(v,_="")=>{let E=[];if(!Array.isArray(v))return E;for(let k=0;k<v.length;k+=1){let O=v[k],M=_?`${_}.${k}`:`${k}`;!O||typeof O!="object"||(O.type==="request"&&E.push({node:O,path:M}),Array.isArray(O.nodes)&&E.push(...l(O.nodes,`${M}.nodes`)),Array.isArray(O.then)&&E.push(...l(O.then,`${M}.then`)),Array.isArray(O.else)&&E.push(...l(O.else,`${M}.else`)),Array.isArray(O.default)&&E.push(...l(O.default,`${M}.default`)),Array.isArray(O.elseif)&&O.elseif.forEach((j,I)=>{Array.isArray(j?.nodes)&&E.push(...l(j.nodes,`${M}.elseif.${I}.nodes`)),Array.isArray(j?.then)&&E.push(...l(j.then,`${M}.elseif.${I}.then`))}),Array.isArray(O.cases)&&O.cases.forEach((j,I)=>{Array.isArray(j?.nodes)&&E.push(...l(j.nodes,`${M}.cases.${I}.nodes`)),Array.isArray(j?.then)&&E.push(...l(j.then,`${M}.cases.${I}.then`))}))}return E},c=(v,_)=>{if(typeof v!="string"||!v.trim())throw le(`"${_}" is required`);let E=v.trim(),k=E.split(".");if(k.some(O=>O===""))throw le(`"${_}" is invalid: "${E}"`);return k.map(O=>/^\d+$/.test(O)?Number(O):O)},d=(v,_)=>{let E=c(_,"path"),k=v;for(let O of E)if(typeof O=="number"){if(!Array.isArray(k)||O<0||O>=k.length)throw le(`node path not found: "${String(_)}"`);k=k[O]}else{if(!k||typeof k!="object"||!(O in k))throw le(`node path not found: "${String(_)}"`);k=k[O]}return k},p=(v,_)=>{let E=c(_,"path"),k=E[E.length-1];if(typeof k!="number")throw le(`"path" must end with a numeric index: "${String(_)}"`);let O=v;for(let M=0;M<E.length-1;M+=1){let j=E[M];if(typeof j=="number"){if(!Array.isArray(O)||j<0||j>=O.length)throw le(`node path not found: "${String(_)}"`);O=O[j]}else{if(!O||typeof O!="object"||!(j in O))throw le(`node path not found: "${String(_)}"`);O=O[j]}}if(!Array.isArray(O)||k<0||k>=O.length)throw le(`node path not found: "${String(_)}"`);return{array:O,index:k}},m=(v,_,E,k)=>{if(_==null||_===""){if(E!=null&&E!=="")throw le(`"${k}" is only valid when a parent path is provided`);return{array:v,pathPrefix:""}}if(typeof E!="string"||!E.trim())throw le(`"${k}" is required when parent path is provided`);let O=String(_).trim(),M=E.trim(),j=d(v,O),I=c(M,k),R=j;for(let A=0;A<I.length;A+=1){let F=I[A],U=A===I.length-1;if(typeof F=="number"){if(!Array.isArray(R)||F<0||F>=R.length)throw le(`branch path not found: "${M}"`);R=R[F]}else{if(!R||typeof R!="object")throw le(`branch path not found: "${M}"`);if(!(F in R))if(U)R[F]=[];else throw le(`branch path not found: "${M}"`);R=R[F]}}if(!Array.isArray(R))throw le(`target branch must be an array: "${M}"`);return{array:R,pathPrefix:`${O}.${M}`}},y=(v,_="")=>{let E=[],k=[],O=(M,j)=>{if(Array.isArray(M)){j&&k.push(j);for(let I=0;I<M.length;I+=1){let R=M[I],A=j?`${j}.${I}`:`${I}`;E.push({path:A,type:R?.type,name:R?.name}),!(!R||typeof R!="object")&&(Array.isArray(R.nodes)&&O(R.nodes,`${A}.nodes`),Array.isArray(R.then)&&O(R.then,`${A}.then`),Array.isArray(R.else)&&O(R.else,`${A}.else`),Array.isArray(R.default)&&O(R.default,`${A}.default`),Array.isArray(R.cases)&&R.cases.forEach((F,U)=>{Array.isArray(F?.nodes)&&O(F.nodes,`${A}.cases.${U}.nodes`),Array.isArray(F?.then)&&O(F.then,`${A}.cases.${U}.then`)}),Array.isArray(R.elseif)&&R.elseif.forEach((F,U)=>{Array.isArray(F?.nodes)&&O(F.nodes,`${A}.elseif.${U}.nodes`),Array.isArray(F?.then)&&O(F.then,`${A}.elseif.${U}.then`)}))}}};return O(v,_),{nodePaths:E,branchPaths:k}};if(t===G.listSuites)return{suites:(await r.testSuite.getAllSuites()).map(_=>({id:_.id,name:_.name,description:_.description??"",requestCount:l(_.nodes||[]).length,flowNodeCount:_.nodes?.length??0,iterations:_.config?.iterations??1}))};if(t===G.getSuite){let v=await xn(e.suite,r),_=l(v.nodes||[]);return{id:v.id,name:v.name,description:v.description??"",config:{iterations:v.config?.iterations??1,delayBetweenRequests:v.config?.delayBetweenRequests??0,stopOnError:v.config?.stopOnError??!1},nodes:v.nodes||[],requests:_.map(({node:E,path:k})=>{let O=E.request;return{nodePath:k,slug:O.slug??O.requestId,collectionId:O.collectionId,requestId:O.requestId,name:O.name,method:O.method,folderPath:O.folderPath??"",enabled:E.enabled!==!1}})}}if(t===G.createSuite){let v=typeof e.name=="string"?e.name.trim():"";if(!v)throw le('"name" is required');let _;if(typeof e.fromCollection=="string"&&e.fromCollection.trim()){let E=at(e.fromCollection,s),k=await r.testSuite.createTempSuiteFromCollection(E.id);if(!k)throw new Error(`Could not build suite from collection "${E.name}"`);if(typeof e.fromFolder=="string"&&e.fromFolder.trim()){let O=Sy(e.fromFolder),M=k.nodes||[];k.nodes=M.filter(j=>{if(j.type!=="request")return!0;let I=j.request?.folderPath||"";return I===O||I.startsWith(`${O}/`)})}_=await r.testSuite.saveTempSuite(k,v)}else _=await r.testSuite.createSuite(v);if(e.iterations!==void 0||e.stopOnError!==void 0||e.delayBetweenRequests!==void 0||e.description!==void 0||e.nodes!==void 0){if(e.description!==void 0&&(_.description=String(e.description)),e.nodes!==void 0){if(!Array.isArray(e.nodes))throw le('"nodes" must be an array when provided');_.nodes=e.nodes}_.config={..._.config,...typeof e.iterations=="number"?{iterations:e.iterations}:{},...typeof e.stopOnError=="boolean"?{stopOnError:e.stopOnError}:{},...typeof e.delayBetweenRequests=="number"?{delayBetweenRequests:e.delayBetweenRequests}:{}},await r.testSuite.updateSuite(_)}return{id:_.id,name:_.name,requestCount:_.nodes?.filter(E=>E.type==="request").length??0,created:!0,hint:(_.nodes?.filter(E=>E.type==="request").length??0)===0?"Suite is empty. Call add_suite_requests to populate it with requests from a collection.":"Suite created. Call run_suite to execute it."}}if(t===G.updateSuiteConfig){let v=await xn(e.suite,r);if(typeof e.name=="string"&&e.name.trim()&&(v.name=e.name.trim()),typeof e.description=="string"&&(v.description=e.description),e.nodes!==void 0){if(!Array.isArray(e.nodes))throw le('"nodes" must be an array when provided');v.nodes=e.nodes}return v.config={...v.config,...typeof e.iterations=="number"?{iterations:e.iterations}:{},...typeof e.stopOnError=="boolean"?{stopOnError:e.stopOnError}:{},...typeof e.delayBetweenRequests=="number"?{delayBetweenRequests:e.delayBetweenRequests}:{}},await r.testSuite.updateSuite(v),{updated:!0,suite:v.name}}if(t===G.getSuiteNode){let v=await xn(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=d(v.nodes,e.path);return{suite:v.name,path:String(e.path),node:_}}if(t===G.listSuiteNodePaths){let v=await xn(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=e.includeBranches!==!1,E=y(v.nodes);return{suite:v.name,nodeCount:E.nodePaths.length,nodePaths:E.nodePaths,branchPaths:_?E.branchPaths:void 0,rootBranchPath:""}}if(t===G.addSuiteNode){let v=await xn(e.suite,r);if(Array.isArray(v.nodes)||(v.nodes=[]),!e.node||typeof e.node!="object"||Array.isArray(e.node))throw le('"node" must be an object');let{array:_,pathPrefix:E}=m(v.nodes,e.parentPath,e.branch,"branch"),k=typeof e.index=="number"?Math.max(0,Math.min(e.index,_.length)):_.length;_.splice(k,0,e.node),await r.testSuite.updateSuite(v);let O=E?`${E}.${k}`:`${k}`;return{added:!0,suite:v.name,path:O}}if(t===G.updateSuiteNode){let v=await xn(e.suite,r);if(Array.isArray(v.nodes)||(v.nodes=[]),!e.node||typeof e.node!="object"||Array.isArray(e.node))throw le('"node" must be an object');let _=p(v.nodes,e.path);return _.array[_.index]=e.node,await r.testSuite.updateSuite(v),{updated:!0,suite:v.name,path:String(e.path)}}if(t===G.removeSuiteNode){let v=await xn(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=p(v.nodes,e.path),[E]=_.array.splice(_.index,1);return await r.testSuite.updateSuite(v),{removed:!0,suite:v.name,path:String(e.path),removedType:E?.type}}if(t===G.moveSuiteNode){let v=await xn(e.suite,r);Array.isArray(v.nodes)||(v.nodes=[]);let _=p(v.nodes,e.fromPath),E=_.array[_.index];_.array.splice(_.index,1);let{array:k,pathPrefix:O}=m(v.nodes,e.toParentPath,e.toBranch,"toBranch"),M=typeof e.toIndex=="number"?Math.max(0,Math.min(e.toIndex,k.length)):k.length;_.array===k&&_.index<M&&(M-=1),k.splice(M,0,E),await r.testSuite.updateSuite(v);let j=O?`${O}.${M}`:`${M}`;return{moved:!0,suite:v.name,fromPath:String(e.fromPath),toPath:j}}if(t===G.addSuiteRequests){let v=await xn(e.suite,r),_=Array.isArray(e.requests)?e.requests:[];if(_.length===0)throw le('"requests" array is required and must not be empty');let E=[];for(let M of _){let j=at(M.collection,s),I=Qi(M.request,j),R=ot(j).find(A=>A.request.id===I.id)?.folderPath??"";E.push({slug:I.id,collectionId:j.id,requestId:I.id,name:I.name,method:I.method,collectionName:j.name,folderPath:R,enabled:!0})}v.nodes||(v.nodes=[]);let k=E.map(M=>({type:"request",name:M.name,request:M,enabled:!0})),O=typeof e.insertAt=="number"?Math.max(0,Math.min(e.insertAt,v.nodes.length)):v.nodes.length;return v.nodes.splice(O,0,...k),await r.testSuite.updateSuite(v),{added:E.length,suite:v.name,insertAt:O,addedPaths:k.map((M,j)=>`${O+j}`),newRequestCount:l(v.nodes||[]).length}}if(t===G.removeSuiteRequest){let v=await xn(e.suite,r);if(!o(v))throw le('remove_suite_request currently supports request-only root suites. For flow suites, use get_suite/update_suite_config with the full "nodes" graph.');v.nodes||(v.nodes=[]);let _=v.nodes.filter(k=>k.type==="request"),E;if(typeof e.index=="number"){if(e.index<0||e.index>=_.length)throw le(`index ${e.index} is out of range`);let k=_[e.index];E=k.name||k.request?.name,v.nodes=v.nodes.filter(O=>O!==k)}else if(typeof e.request=="string"){let k=e.request.toLowerCase(),O=_.find(M=>{let j=M.request?.name||M.name||"";return j===e.request||j.toLowerCase()===k});if(!O)throw le(`request "${e.request}" not found in suite "${v.name}"`);E=O.name||O.request?.name,v.nodes=v.nodes.filter(M=>M!==O)}else throw le('either "index" or "request" is required');return await r.testSuite.updateSuite(v),{removed:!0,request:E,newRequestCount:v.nodes.filter(k=>k.type==="request").length}}if(t===G.reorderSuiteRequests){let v=await xn(e.suite,r);if(!o(v))throw le('reorder_suite_requests currently supports request-only root suites. For flow suites, use get_suite/update_suite_config with the full "nodes" graph.');if(!Array.isArray(e.order))throw le('"order" must be an array of request names');let _=e.order,E=(v.nodes||[]).filter(M=>M.type==="request"),k=(v.nodes||[]).filter(M=>M.type!=="request"),O=[...E].sort((M,j)=>{let I=M.request?.name||M.name||"",R=j.request?.name||j.name||"",A=_.findIndex(J=>J===I||J.toLowerCase()===I.toLowerCase()),F=_.findIndex(J=>J===R||J.toLowerCase()===R.toLowerCase());return(A===-1?1/0:A)-(F===-1?1/0:F)});return v.nodes=[...O,...k],await r.testSuite.updateSuite(v),{reordered:!0,suite:v.name,newOrder:O.map(M=>M.request?.name||M.name)}}if(t===G.duplicateSuite){let v=await xn(e.suite,r),_=typeof e.newName=="string"?e.newName.trim():"";if(!_)throw le('"newName" is required');let E=await r.testSuite.duplicateSuite(v.id,_);return{id:E.id,name:E.name,duplicatedFrom:v.name,requestCount:E.nodes?.filter(k=>k.type==="request").length??0}}if(t===G.deleteSuite){if(e.confirm!==!0)throw le('"confirm" must be true to delete a suite');let v=await xn(e.suite,r);return await r.testSuite.deleteSuite(v.id),{deleted:!0,suite:v.name}}if(t===G.listEnvironments){let v=r.environmentConfig.getAllEnvironments(),_=r.environmentConfig.getSelectedEnvironment();return{environments:v.map(E=>({name:E.name,active:E.active,variableKeys:Object.keys(E.variables)})),active:_}}if(t===G.getEnvironmentVariables){let v=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment(),_=r.environmentConfig.getResolvedEnvironment(v);if(!_)throw le(`environment "${v}" not found`);let k=r.environmentConfig.getSharedConfig()?.environments?.[v]?.variables??{},O=r.environmentConfig.getEnvironmentVariableLocals();return{environment:v,active:r.environmentConfig.getSelectedEnvironment()===v,fileVariables:k,sessionOverrides:O,resolved:_.variables}}if(t===G.selectEnvironment){let v=typeof e.environment=="string"?e.environment.trim():"";if(!v)throw le('"environment" is required');return await r.environmentConfig.setSelectedEnvironment(v),{selected:!0,environment:v}}if(t===G.createEnvironment){let v=typeof e.name=="string"?e.name.trim():"";if(!v)throw le('"name" is required');if(await r.environmentConfig.createEnvironment(v),e.variables&&typeof e.variables=="object"){let _=e.variables,E=r.environmentConfig.getSharedConfig();E&&(E.environments=E.environments??{},E.environments[v]={...E.environments[v]??{},variables:{...E.environments[v]?.variables??{},..._}},r.environmentConfig.saveSharedConfig(E))}return{created:!0,environment:v}}if(t===G.deleteEnvironment){if(e.confirm!==!0)throw le('"confirm" must be true to delete an environment');let v=typeof e.environment=="string"?e.environment.trim():"";if(!v)throw le('"environment" is required');let _=r.environmentConfig.getSelectedEnvironment();return await r.environmentConfig.deleteEnvironment(v),{deleted:!0,environment:v,newActive:_===v?void 0:_}}if(t===G.setEnvironmentVariable){let v=typeof e.key=="string"?e.key.trim():"",_=typeof e.value=="string"?e.value:String(e.value??"");if(!v)throw le('"key" is required');let E=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment(),k=e.scope==="permanent"?"permanent":"session";if(k==="permanent"){let O=r.environmentConfig.getSharedConfig();O&&(O.environments=O.environments??{},O.environments[E]=O.environments[E]??{variables:{}},O.environments[E].variables=O.environments[E].variables??{},O.environments[E].variables[v]=_,r.environmentConfig.saveSharedConfig(O))}else r.environmentConfig.setEnvironmentVariable(v,_,E);return{set:!0,key:v,environment:E,scope:k}}if(t===G.unsetEnvironmentVariable){let v=typeof e.key=="string"?e.key.trim():"";if(!v)throw le('"key" is required');let _=typeof e.environment=="string"&&e.environment.trim()?e.environment.trim():r.environmentConfig.getSelectedEnvironment();return r.environmentConfig.deleteEnvironmentVariable(v,_),{unset:!0,key:v,environment:_}}if(t===G.setGlobalVariable){let v=typeof e.key=="string"?e.key.trim():"",_=typeof e.value=="string"?e.value:String(e.value??"");if(!v)throw le('"key" is required');let E=e.scope==="permanent"?"permanent":"session";if(E==="permanent"){let k=r.environmentConfig.getSharedConfig();k&&(k.globalVariables=k.globalVariables??{},k.globalVariables[v]=_,r.environmentConfig.saveSharedConfig(k))}else r.environmentConfig.setGlobalVariable(v,_);return{set:!0,key:v,scope:E}}if(t===G.getGlobals)return{globals:r.environmentConfig.getGlobalVariables()};if(t===G.scaffoldCollectionFromOpenApi){let v=typeof e.specPath=="string"?e.specPath.trim():"";if(!v)throw le('"specPath" is required');let _=r.workspaceFolder&&!Zi.isAbsolute(v)?Zi.join(r.workspaceFolder,v):v;if(!op.existsSync(_))throw le(`OpenAPI spec file not found: "${_}"`);let k=await new Fo(r.collection,r.environmentConfig).import(_,{collectionName:typeof e.collectionName=="string"?e.collectionName:void 0,environmentName:typeof e.environmentName=="string"?e.environmentName:void 0});return{collectionId:k.collection.id,collectionName:k.collection.name,requestCount:k.collection.items.filter(O=>O.type==="request").length,environmentCreated:k.environmentCreated??null,hint:"Use list_requests to browse the scaffolded collection, then run_request to test individual endpoints."}}if(t===G.suggestAssertions){let v=e.collection;if(!(typeof e.request=="string"?e.request.trim():""))throw le('"request" is required');let E=at(v,s),k=Qi(e.request,E),O=typeof e.maxSuggestions=="number"?Math.min(20,Math.max(1,e.maxSuggestions)):10,M=[],I=Array.from(n.values()).filter(U=>U.status!=="running").flatMap(U=>U.allResults??[]).filter(U=>U.name===k.name||typeof U.name=="string"&&U.name.toLowerCase()===k.name.toLowerCase()),R=I[I.length-1],A=R?.status;A?M.push({snippet:`pm.test("Status code is ${A}", function () {
|
|
353
353
|
pm.response.to.have.status(${A});
|
|
354
354
|
});`,rationale:`Observed status ${A} in the most recent run.`}):M.push({snippet:`pm.test("Status code is 2xx", function () {
|
|
355
355
|
pm.expect(pm.response.code).to.be.within(200, 299);
|
|
@@ -362,7 +362,7 @@ Example: for POST /users with body {"name":"{{name}}","email":"{{email}}"} and i
|
|
|
362
362
|
pm.expect(${Q}).to.have.property("${J}");
|
|
363
363
|
});`,rationale:`Field "${J}" was present in the observed response body.`})}}}catch{M.push({snippet:`pm.test("Response body is not empty", function () {
|
|
364
364
|
pm.expect(pm.response.text()).to.not.be.empty;
|
|
365
|
-
});`,rationale:"Response body was non-JSON text."})}return{collection:q.name,request:k.name,suggestions:M.slice(0,O),hint:"Paste the snippets into the request's post-response script using set_request_script."}}if(t===G.explainFailure){let v=typeof e.runId=="string"?e.runId.trim():void 0,_=typeof e.request=="string"?e.request.trim():"",q=typeof e.iteration=="number"?e.iteration:1;if(v){let j=n.require(v);if(j.status==="running")return{runId:v,status:"running",message:"The run has not completed yet. Try again in a moment."};if(!_)throw le('"request" is required when "runId" is provided');let I=j.allResults.find(D=>D.iteration===q&&(D.name===_||typeof D.name=="string"&&D.name.toLowerCase()===_.toLowerCase()));if(!I)throw new Error(`Request "${_}" (iteration ${q}) not found in run "${v}".`);let R=I.assertions?.every(D=>D.passed)??!0,A=I.error,F=I.assertions?.filter(D=>!D.passed)??[],U="";return A?U=`The request itself failed to execute: ${A}. Check the URL, network access, authentication, and that the environment variables are set correctly.`:F.length>0?U=`${F.length} assertion(s) failed. Review the expected vs actual values below and verify the API contract.`:R?U="No failures detected. The request appears to have passed.":U="The request was marked as failed but no specific errors were captured.",{runId:v,request:I.name,iteration:q,status:I.status??"unknown",passed:I.passed??!0,error:A??null,failedAssertions:F,allAssertions:I.assertions??[],requestDetails:{method:I.method,url:I.url,requestBody:I.requestBody},responseDetails:{status:I.responseStatus,headers:I.responseHeaders,body:I.responseBody},diagnosis:U,suggestedFixes:A?["Verify the URL is correct and reachable","Check all required environment variables are set","Inspect authentication headers"]:F.map(D=>`Fix assertion "${D.name}": ${D.message??"expected value mismatch"}`)}}let k=e.collection;if(!_)throw le('"request" is required');let O=at(k,s);return{request:Qi(e.request,O).name,collection:O.name,message:"No live run id provided. Run the request first using run_request, then call explain_failure with the runId from the result.",hint:'Use run_request or run_collection with include:["consoleOutput"] to capture a fresh run, then pass the runId here.'}}if(t===G.aiSuggestEnvVars){let v=at(e.collection,s),_=typeof e.minOccurrences=="number"?Math.max(1,e.minOccurrences):1,k=(typeof e.environment=="string"?e.environment:void 0)??r.environmentConfig.getSelectedEnvironment()??void 0,O=Ry(v,_),M=ot(v).map(({request:j,folderPath:I})=>({id:j.id,name:j.name,folder:I,method:j.method,url:j.url,headers:(j.headers??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),query:(j.query??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),bodyExcerpt:j.body?.type==="raw"&&typeof j.body.content=="string"?j.body.content.slice(0,300):void 0}));return{task:{action:"analyze_and_apply_env_vars",instructions:["Review requestSummary. Find ALL hardcoded values: base URLs, API keys/tokens, tenant IDs, user IDs, secrets, repeated hostnames.","Skip placeholders ({{...}}), HTTP methods, standard header names, empty strings, booleans, short numbers.","Combine heuristicSuggestions with your own findings into one list.",`Call apply_env_vars immediately with: { collection: "${v.name}", suggestions: [...], ${k?`environment: "${k}"`:""} }`,"Do NOT ask for confirmation. Apply everything at once."],collection:v.name,heuristicSuggestions:O.map(j=>({varName:j.varName,value:j.value,reason:j.reason})),requestSummary:M,expectedCallAfterThis:"apply_env_vars"}}}if(t===G.aiEnhanceCollection){let v=at(e.collection,s),_=typeof e.offset=="number"?Math.max(0,e.offset):0,q=typeof e.limit=="number"?Math.min(20,Math.max(1,e.limit)):10,k=typeof e.folder=="string"?e.folder.toLowerCase():void 0,O=ot(v).filter(({folderPath:I})=>!k||I.toLowerCase().includes(k)),M=O.slice(_,_+q).map(({request:I,folderPath:R})=>({id:I.id,name:I.name,folder:R,method:I.method,url:I.url,headers:(I.headers??[]).filter(A=>A.enabled!==!1).map(A=>({key:A.key,value:A.value})),query:(I.query??[]).filter(A=>A.enabled!==!1).map(A=>({key:A.key,value:A.value})),currentBody:I.body?.type==="raw"&&typeof I.body.content=="string"?I.body.content:void 0,currentTestScript:r.collection.getRequestScript(v.id,I.id,"post-response")??void 0})),j=_+q<O.length;return{task:{action:"enhance_requests",instructions:["For each request in requests, produce body and/or testScript as appropriate:"," body: realistic JSON (or form) example matching the endpoint purpose. Only for POST/PUT/PATCH."," testScript: pm.test() assertions \u2014 check status code, response schema, key fields. Always provide this.",`Call apply_request_enhancements immediately with: { collection: "${v.name}", enhancements: [{ requestId, body?, testScript }] }`,j?`After applying, call ai_enhance_collection again with: { collection: "${v.name}", offset: ${_+q}, limit: ${q} } to continue.`:"This is the last batch \u2014 no further calls needed after applying.","Do NOT ask for confirmation. Apply everything at once."],collection:v.name,total:O.length,offset:_,hasMore:j,nextOffset:j?_+q:void 0,requests:M,expectedCallAfterThis:"apply_request_enhancements"}}}if(t===G.suggestEnvVars){let v=at(e.collection,s),_=typeof e.minOccurrences=="number"?Math.max(1,e.minOccurrences):1,q=Ry(v,_),k=ot(v).map(({request:O,folderPath:M})=>({id:O.id,name:O.name,folder:M,method:O.method,url:O.url,headers:(O.headers??[]).filter(j=>j.enabled!==!1).map(j=>({key:j.key,value:j.value})),query:(O.query??[]).filter(j=>j.enabled!==!1).map(j=>({key:j.key,value:j.value})),bodyExcerpt:O.body?.type==="raw"&&typeof O.body.content=="string"?O.body.content.slice(0,300):void 0}));return{collection:v.name,heuristicSuggestions:q.map(O=>({varName:O.varName,value:O.value,reason:O.reason,occurrences:O.occurrences.length})),requestSummary:k,hint:"Review requestSummary for additional hardcoded values, then call apply_env_vars with your combined {value, varName} list."}}if(t===G.applyEnvVars){let v=at(e.collection,s),_=e.suggestions;if(!Array.isArray(_)||_.length===0)throw le('"suggestions" must be a non-empty array of {value, varName} objects');let q=_,k=UC(v.items,q);await r.collection.saveCollection(v);let M=(typeof e.environment=="string"?e.environment:void 0)??r.environmentConfig.getSelectedEnvironment();if(M)for(let I of q)r.environmentConfig.setEnvironmentVariable(I.varName,I.value,M);let j=Object.values(k).reduce((I,R)=>I+R,0);return{collection:v.name,applied:q.map(I=>({varName:I.varName,replacements:k[I.varName]??0})),totalReplacements:j,...M?{writtenToEnvironment:M}:{}}}if(t===G.getRequestsForEnhancement){let v=at(e.collection,s),_=typeof e.offset=="number"?Math.max(0,e.offset):0,q=typeof e.limit=="number"?Math.min(30,Math.max(1,e.limit)):10,k=typeof e.folder=="string"?e.folder.toLowerCase():void 0,O=ot(v).filter(({folderPath:j})=>!k||j.toLowerCase().includes(k)),M=O.slice(_,_+q).map(({request:j,folderPath:I})=>({id:j.id,name:j.name,folder:I,method:j.method,url:j.url,headers:(j.headers??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),query:(j.query??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),currentBody:j.body?.type==="raw"&&typeof j.body.content=="string"?j.body.content:void 0,currentTestScript:r.collection.getRequestScript(v.id,j.id,"post-response")??void 0}));return{collection:v.name,total:O.length,offset:_,limit:q,requests:M,hasMore:_+q<O.length,hint:"For each request write a realistic body and pm.test() assertions, then call apply_request_enhancements."}}if(t===G.applyRequestEnhancements){let v=at(e.collection,s),_=e.enhancements;if(!Array.isArray(_)||_.length===0)throw le('"enhancements" must be a non-empty array');let q=[];for(let k of _){let{requestId:O,body:M,testScript:j}=k;if(!ot(v).find(({request:A})=>A.id===O)){q.push({requestId:O,applied:["skipped: request not found"]});continue}let R=[];typeof M=="string"&&(await r.collection.updateRequest(v.id,O,{body:{type:"raw",content:M,format:"json"}}),R.push("body")),typeof j=="string"&&(await r.collection.setRequestScript(v.id,O,"post-response",j),R.push("testScript")),q.push({requestId:O,applied:R})}return{collection:v.name,results:q,totalUpdated:q.filter(k=>k.applied.length>0&&!k.applied[0].startsWith("skipped")).length}}if(t===G.analyzeCoverage||t===G.aiAnalyzeCoverage){let v=at(e.collection,s),_=typeof e.folder=="string"?e.folder.toLowerCase():void 0,q=ot(v).filter(({folderPath:F})=>!_||F.toLowerCase().includes(_)),k=q.map(({request:F,folderPath:U})=>{let J=((r.collection.getRequestScript(v.id,F.id,"post-response")??"").match(/pm\.test\s*\(/g)??[]).length;return{id:F.id,name:F.name,method:F.method,folder:U,hasAssertions:J>0,assertionCount:J}}),O=k.filter(F=>F.hasAssertions).length,M=k.length,j=M===0?100:Math.round(O/M*100),I=[],R=typeof e.specPath=="string"?e.specPath.trim():"";if(R)try{let F=r.workspaceFolder&&!Zi.isAbsolute(R)?Zi.join(r.workspaceFolder,R):R,U=op.readFileSync(F,"utf8"),{parse:D}=await Promise.resolve().then(()=>Qc(Dd())),Q=(R.endsWith(".json")?JSON.parse(U):D(U)).paths??{},se=["get","post","put","patch","delete","head","options"];for(let[ce,Be]of Object.entries(Q))for(let _e of se){if(!(_e in Be))continue;let me=_e.toUpperCase();q.some(({request:mt})=>mt.method.toUpperCase()===me&&(mt.url??"").replace(/\{\{[^}]+\}\}/g,"{param}").includes(ce.replace(/\{[^}]+\}/g,"{param}").replace(/^\//,"")))||I.push({method:me,path:ce})}}catch{}let A=k.filter(F=>!F.hasAssertions);if(t===G.aiAnalyzeCoverage){let F=[];return A.length>0&&F.push(`${A.length} request(s) have no pm.test() assertions. Call ai_enhance_collection (collection="${v.name}") to add assertions to all of them.`),I.length>0&&F.push(`${I.length} spec operation(s) have no matching collection request. Call generate_scenarios (collection="${v.name}") to generate negative and edge-case requests for them.`),F.length===0&&F.push(`Coverage is ${j}% \u2014 all requests have assertions and all spec operations are covered.`),{task:{action:"ai_analyze_coverage",instructions:["Review the coverage data below.",...F,"Address the highest-impact gap first. Do NOT ask for confirmation \u2014 proceed immediately."],collection:v.name,coveragePct:j,covered:O,total:M,untestedRequests:A,untestedOperations:I,expectedCallAfterThis:A.length>0?"ai_enhance_collection":I.length>0?"generate_scenarios":null}}}return{collection:v.name,coveragePct:j,covered:O,total:M,requests:k,...I.length>0?{untestedOperations:I}:{}}}if(t===G.generateRequestFromIntent){let v=at(e.collection,s),_=typeof e.intent=="string"?e.intent.trim():"";if(!_)throw le('"intent" is required \u2014 describe what to test in plain English');let k=ot(v).slice(0,20).map(({request:M,folderPath:j})=>({name:M.name,method:M.method,url:M.url??"",folder:j})),O=Object.keys(r.environmentConfig.getResolvedEnvironment(r.environmentConfig.getSelectedEnvironment())?.variables??{});return{task:{action:"generate_request_from_intent",instructions:[`Intent: "${_}"`,"Using the collection context below, determine: method, full URL (reuse existing {{vars}} where possible), headers, request body (if applicable), and expected HTTP status.","Then immediately:"," 1. Call create_request with name, method, url, and body.",' 2. Call set_request_script (phase: "post-response") with pm.test() assertions that verify the intent.',"Do NOT ask for confirmation \u2014 implement the full request + assertions in one shot."],collection:v.name,intent:_,existingRequests:k,availableEnvVars:O,targetFolder:typeof e.folder=="string"?e.folder:void 0,expectedCallAfterThis:"create_request"}}}if(t===G.validateAgainstSpec){let v=at(e.collection,s),_=typeof e.specPath=="string"?e.specPath.trim():"";if(!_)throw le('"specPath" is required');let q=r.workspaceFolder&&!Zi.isAbsolute(_)?Zi.join(r.workspaceFolder,_):_,k;try{let D=op.readFileSync(q,"utf8"),{parse:J}=await Promise.resolve().then(()=>Qc(Dd()));k=_.endsWith(".json")?JSON.parse(D):J(D)}catch(D){throw new Error(`Could not load spec at "${q}": ${D instanceof Error?D.message:String(D)}`)}let O=k.paths??{},M=["get","post","put","patch","delete","head","options"],j=ot(v),I=[],R=[],A=[],F=D=>D.replace(/\{\{[^}]+\}\}/g,"{p}").replace(/\{[^}]+\}/g,"{p}").replace(/\/+$/,"");for(let[D,J]of Object.entries(O))for(let Q of M){if(!(Q in J))continue;let se=J[Q],ce=Q.toUpperCase(),Be=F(D),_e=j.find(({request:me})=>me.method.toUpperCase()===ce&&F(me.url??"").includes(Be));if(!_e)I.push({method:ce,path:D,operationId:se.operationId});else{let me=r.collection.getRequestScript(v.id,_e.request.id,"post-response")??"";/pm\.test\s*\(/.test(me)||R.push({method:ce,path:D,requestName:_e.request.name})}}let U=new Set(Object.entries(O).flatMap(([D,J])=>M.filter(Q=>Q in J).map(Q=>`${Q.toUpperCase()}:${F(D)}`)));for(let{request:D}of j){let J=F(D.url??""),Q=`${D.method.toUpperCase()}:`;[...U].some(ce=>ce.startsWith(Q)&&J.includes(ce.split(":")[1]))||A.push({method:D.method,url:D.url??"",requestName:D.name})}return{collection:v.name,spec:Zi.basename(_),summary:{untestedOperations:I.length,matchedWithoutAssertions:R.length,extraRequests:A.length},untestedOperations:I,matchedWithoutAssertions:R,extraRequests:A,hint:I.length>0?`Call generate_scenarios (collection="${v.name}") to create negative/edge-case requests for untested operations.`:"All spec operations have matching collection requests."}}if(t===G.generateScenarios){let v=at(e.collection,s),_=typeof e.request=="string"?e.request.trim().toLowerCase():void 0,q=typeof e.folder=="string"?e.folder.toLowerCase():void 0,k=typeof e.offset=="number"?Math.max(0,e.offset):0,O=typeof e.limit=="number"?Math.min(10,Math.max(1,e.limit)):5,M=ot(v).filter(({request:I,folderPath:R})=>!(_&&I.name.toLowerCase()!==_&&!I.name.toLowerCase().includes(_)||q&&!R.toLowerCase().includes(q))),j=M.slice(k,k+O).map(({request:I,folderPath:R})=>({id:I.id,name:I.name,method:I.method,url:I.url??"",folder:R,headers:(I.headers??[]).filter(A=>A.enabled!==!1).map(A=>({key:A.key,value:A.value})),body:I.body?.type==="raw"&&typeof I.body.content=="string"?I.body.content:void 0,currentTestScript:r.collection.getRequestScript(v.id,I.id,"post-response")??void 0}));return{task:{action:"generate_scenarios",instructions:["For each request below, generate negative and edge-case test scenario variants.","Scenarios to generate per request (as applicable):"," - Missing required fields \u2192 expect 400 or 422"," - Invalid field type or format (e.g. string where number expected) \u2192 expect 400"," - No Authorization header (remove it) \u2192 expect 401"," - Valid auth but insufficient scope/role \u2192 expect 403"," - Non-existent resource ID in URL \u2192 expect 404"," - Boundary values: empty string, max-length string, 0, -1, very large number","For each scenario:",' 1. Call create_request with a descriptive name (e.g. "Create User - Missing Email \u2192 422"), method, url, and body.',' 2. Immediately call set_request_script (phase: "post-response") with the status assertion.'," 3. Place the new request in the same folder as the original (use folder argument in create_request).","If task.hasMore is true, call generate_scenarios again with task.nextOffset after finishing this batch.","Do NOT ask for confirmation \u2014 generate all scenarios autonomously."],collection:v.name,requests:j,total:M.length,offset:k,hasMore:k+O<M.length,nextOffset:k+O,expectedCallAfterThis:"create_request"}}}if(t===G.healAssertions){let v=at(e.collection,s),_=Qi(e.request,v),q=r.collection.getRequestScript(v.id,_.id,"post-response")??"",k,O=typeof e.runId=="string"?e.runId.trim():void 0;if(O)try{let j=n.require(O).allResults.find(I=>typeof I.name=="string"&&I.name.toLowerCase()===_.name.toLowerCase());j&&(k={status:j.status,responseBody:j.responseBody,responseHeaders:j.responseHeaders,failedTests:j.failedTests})}catch{}return{task:{action:"heal_assertions",instructions:[`Request: ${_.method} ${_.url??""}`,"The current test script may have stale or incorrect assertions (e.g. wrong status code, missing/renamed fields).","Compare task.currentScript against task.lastResponse (if available).","Rewrite the complete post-response script so all assertions match the observed response while keeping valid checks.",'Call set_request_script (phase: "post-response") with the updated script immediately.',"Do NOT ask for confirmation."],collection:v.name,request:_.name,method:_.method,url:_.url??"",currentScript:q,lastResponse:k??null,note:k?"Last response data available \u2014 use it to align assertions with actual behavior.":"No run data available \u2014 run the request first with run_request, then call heal_assertions again with the runId.",expectedCallAfterThis:"set_request_script"}}}if(t===G.generateIterationData){let v=at(e.collection,s),_=Qi(e.request,v),q=typeof e.iterations=="number"?Math.min(50,Math.max(1,e.iterations)):5,k=_.body?.type==="raw"&&typeof _.body.content=="string"?_.body.content:void 0,O=(_.headers??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),M=(_.query??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),j=/\{\{([^}]+)\}\}/g,I=new Set;for(let R of[_.url??"",k??"",...O.map(A=>A.value),...M.map(A=>A.value)]){let A;for(j.lastIndex=0;(A=j.exec(R))!==null;)I.add(A[1])}return{task:{action:"generate_iteration_data",instructions:[`Generate ${q} test data rows for: ${_.method} ${_.url??""}`,`The request uses these {{variable}} placeholders: ${[...I].join(", ")||"(none detected)"}`,"Each row must be a JSON object whose keys match the placeholder names.","Cover a mix of: (1) valid happy-path data, (2) boundary values, (3) invalid inputs that should fail, (4) edge cases.",'Return the rows as a JSON array in a code block labeled "iterationData".',"This data can be used with: http-forge run-request --collection ... --variables '[...]' or passed to run_request via the variables argument."],collection:v.name,request:_.name,method:_.method,url:_.url??"",body:k??null,headers:O,queryParams:M,placeholders:[...I],iterations:q}}}let b=e.suite;if(typeof b!="string"||!b.trim())throw le('the "suite" argument is required');let E=await r.testSuite.getAllSuites(),C=E.find(v=>v.id===b||v.name===b)??E.find(v=>v.name.toLowerCase()===b.toLowerCase());if(!C)throw le(`test suite not found: "${b}"`);return i.runSuite(C.id,C.name,e)}var VC,zC=ae(()=>{"use strict";HC();fy();Ei();sp();VC=new Set([G.createCollection,G.renameCollection,G.deleteCollection,G.duplicateCollection,G.createFolder,G.deleteFolder,G.createRequest,G.updateRequest,G.deleteRequest,G.reorderCollectionItems,G.createSuite,G.updateSuiteConfig,G.addSuiteNode,G.updateSuiteNode,G.removeSuiteNode,G.moveSuiteNode,G.duplicateSuite,G.deleteSuite])});function Do(t,e=2e3){return!t||t.length<=e?t:t.slice(0,e)+`
|
|
365
|
+
});`,rationale:"Response body was non-JSON text."})}return{collection:E.name,request:k.name,suggestions:M.slice(0,O),hint:"Paste the snippets into the request's post-response script using set_request_script."}}if(t===G.explainFailure){let v=typeof e.runId=="string"?e.runId.trim():void 0,_=typeof e.request=="string"?e.request.trim():"",E=typeof e.iteration=="number"?e.iteration:1;if(v){let j=n.require(v);if(j.status==="running")return{runId:v,status:"running",message:"The run has not completed yet. Try again in a moment."};if(!_)throw le('"request" is required when "runId" is provided');let I=j.allResults.find(D=>D.iteration===E&&(D.name===_||typeof D.name=="string"&&D.name.toLowerCase()===_.toLowerCase()));if(!I)throw new Error(`Request "${_}" (iteration ${E}) not found in run "${v}".`);let R=I.assertions?.every(D=>D.passed)??!0,A=I.error,F=I.assertions?.filter(D=>!D.passed)??[],U="";return A?U=`The request itself failed to execute: ${A}. Check the URL, network access, authentication, and that the environment variables are set correctly.`:F.length>0?U=`${F.length} assertion(s) failed. Review the expected vs actual values below and verify the API contract.`:R?U="No failures detected. The request appears to have passed.":U="The request was marked as failed but no specific errors were captured.",{runId:v,request:I.name,iteration:E,status:I.status??"unknown",passed:I.passed??!0,error:A??null,failedAssertions:F,allAssertions:I.assertions??[],requestDetails:{method:I.method,url:I.url,requestBody:I.requestBody},responseDetails:{status:I.responseStatus,headers:I.responseHeaders,body:I.responseBody},diagnosis:U,suggestedFixes:A?["Verify the URL is correct and reachable","Check all required environment variables are set","Inspect authentication headers"]:F.map(D=>`Fix assertion "${D.name}": ${D.message??"expected value mismatch"}`)}}let k=e.collection;if(!_)throw le('"request" is required');let O=at(k,s);return{request:Qi(e.request,O).name,collection:O.name,message:"No live run id provided. Run the request first using run_request, then call explain_failure with the runId from the result.",hint:'Use run_request or run_collection with include:["consoleOutput"] to capture a fresh run, then pass the runId here.'}}if(t===G.aiSuggestEnvVars){let v=at(e.collection,s),_=typeof e.minOccurrences=="number"?Math.max(1,e.minOccurrences):1,k=(typeof e.environment=="string"?e.environment:void 0)??r.environmentConfig.getSelectedEnvironment()??void 0,O=Ry(v,_),M=ot(v).map(({request:j,folderPath:I})=>({id:j.id,name:j.name,folder:I,method:j.method,url:j.url,headers:(j.headers??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),query:(j.query??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),bodyExcerpt:j.body?.type==="raw"&&typeof j.body.content=="string"?j.body.content.slice(0,300):void 0}));return{task:{action:"analyze_and_apply_env_vars",instructions:["Review requestSummary. Find ALL hardcoded values: base URLs, API keys/tokens, tenant IDs, user IDs, secrets, repeated hostnames.","Skip placeholders ({{...}}), HTTP methods, standard header names, empty strings, booleans, short numbers.","Combine heuristicSuggestions with your own findings into one list.",`Call apply_env_vars immediately with: { collection: "${v.name}", suggestions: [...], ${k?`environment: "${k}"`:""} }`,"Do NOT ask for confirmation. Apply everything at once."],collection:v.name,heuristicSuggestions:O.map(j=>({varName:j.varName,value:j.value,reason:j.reason})),requestSummary:M,expectedCallAfterThis:"apply_env_vars"}}}if(t===G.aiEnhanceCollection){let v=at(e.collection,s),_=typeof e.offset=="number"?Math.max(0,e.offset):0,E=typeof e.limit=="number"?Math.min(20,Math.max(1,e.limit)):10,k=typeof e.folder=="string"?e.folder.toLowerCase():void 0,O=ot(v).filter(({folderPath:I})=>!k||I.toLowerCase().includes(k)),M=O.slice(_,_+E).map(({request:I,folderPath:R})=>({id:I.id,name:I.name,folder:R,method:I.method,url:I.url,headers:(I.headers??[]).filter(A=>A.enabled!==!1).map(A=>({key:A.key,value:A.value})),query:(I.query??[]).filter(A=>A.enabled!==!1).map(A=>({key:A.key,value:A.value})),currentBody:I.body?.type==="raw"&&typeof I.body.content=="string"?I.body.content:void 0,currentTestScript:r.collection.getRequestScript(v.id,I.id,"post-response")??void 0})),j=_+E<O.length;return{task:{action:"enhance_requests",instructions:["For each request in requests, produce body and/or testScript as appropriate:"," body: realistic JSON (or form) example matching the endpoint purpose. Only for POST/PUT/PATCH."," testScript: pm.test() assertions \u2014 check status code, response schema, key fields. Always provide this.",`Call apply_request_enhancements immediately with: { collection: "${v.name}", enhancements: [{ requestId, body?, testScript }] }`,j?`After applying, call ai_enhance_collection again with: { collection: "${v.name}", offset: ${_+E}, limit: ${E} } to continue.`:"This is the last batch \u2014 no further calls needed after applying.","Do NOT ask for confirmation. Apply everything at once."],collection:v.name,total:O.length,offset:_,hasMore:j,nextOffset:j?_+E:void 0,requests:M,expectedCallAfterThis:"apply_request_enhancements"}}}if(t===G.suggestEnvVars){let v=at(e.collection,s),_=typeof e.minOccurrences=="number"?Math.max(1,e.minOccurrences):1,E=Ry(v,_),k=ot(v).map(({request:O,folderPath:M})=>({id:O.id,name:O.name,folder:M,method:O.method,url:O.url,headers:(O.headers??[]).filter(j=>j.enabled!==!1).map(j=>({key:j.key,value:j.value})),query:(O.query??[]).filter(j=>j.enabled!==!1).map(j=>({key:j.key,value:j.value})),bodyExcerpt:O.body?.type==="raw"&&typeof O.body.content=="string"?O.body.content.slice(0,300):void 0}));return{collection:v.name,heuristicSuggestions:E.map(O=>({varName:O.varName,value:O.value,reason:O.reason,occurrences:O.occurrences.length})),requestSummary:k,hint:"Review requestSummary for additional hardcoded values, then call apply_env_vars with your combined {value, varName} list."}}if(t===G.applyEnvVars){let v=at(e.collection,s),_=e.suggestions;if(!Array.isArray(_)||_.length===0)throw le('"suggestions" must be a non-empty array of {value, varName} objects');let E=_,k=UC(v.items,E);await r.collection.saveCollection(v);let M=(typeof e.environment=="string"?e.environment:void 0)??r.environmentConfig.getSelectedEnvironment();if(M)for(let I of E)r.environmentConfig.setEnvironmentVariable(I.varName,I.value,M);let j=Object.values(k).reduce((I,R)=>I+R,0);return{collection:v.name,applied:E.map(I=>({varName:I.varName,replacements:k[I.varName]??0})),totalReplacements:j,...M?{writtenToEnvironment:M}:{}}}if(t===G.getRequestsForEnhancement){let v=at(e.collection,s),_=typeof e.offset=="number"?Math.max(0,e.offset):0,E=typeof e.limit=="number"?Math.min(30,Math.max(1,e.limit)):10,k=typeof e.folder=="string"?e.folder.toLowerCase():void 0,O=ot(v).filter(({folderPath:j})=>!k||j.toLowerCase().includes(k)),M=O.slice(_,_+E).map(({request:j,folderPath:I})=>({id:j.id,name:j.name,folder:I,method:j.method,url:j.url,headers:(j.headers??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),query:(j.query??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),currentBody:j.body?.type==="raw"&&typeof j.body.content=="string"?j.body.content:void 0,currentTestScript:r.collection.getRequestScript(v.id,j.id,"post-response")??void 0}));return{collection:v.name,total:O.length,offset:_,limit:E,requests:M,hasMore:_+E<O.length,hint:"For each request write a realistic body and pm.test() assertions, then call apply_request_enhancements."}}if(t===G.applyRequestEnhancements){let v=at(e.collection,s),_=e.enhancements;if(!Array.isArray(_)||_.length===0)throw le('"enhancements" must be a non-empty array');let E=[];for(let k of _){let{requestId:O,body:M,testScript:j}=k;if(!ot(v).find(({request:A})=>A.id===O)){E.push({requestId:O,applied:["skipped: request not found"]});continue}let R=[];typeof M=="string"&&(await r.collection.updateRequest(v.id,O,{body:{type:"raw",content:M,format:"json"}}),R.push("body")),typeof j=="string"&&(await r.collection.setRequestScript(v.id,O,"post-response",j),R.push("testScript")),E.push({requestId:O,applied:R})}return{collection:v.name,results:E,totalUpdated:E.filter(k=>k.applied.length>0&&!k.applied[0].startsWith("skipped")).length}}if(t===G.analyzeCoverage||t===G.aiAnalyzeCoverage){let v=at(e.collection,s),_=typeof e.folder=="string"?e.folder.toLowerCase():void 0,E=ot(v).filter(({folderPath:F})=>!_||F.toLowerCase().includes(_)),k=E.map(({request:F,folderPath:U})=>{let J=((r.collection.getRequestScript(v.id,F.id,"post-response")??"").match(/pm\.test\s*\(/g)??[]).length;return{id:F.id,name:F.name,method:F.method,folder:U,hasAssertions:J>0,assertionCount:J}}),O=k.filter(F=>F.hasAssertions).length,M=k.length,j=M===0?100:Math.round(O/M*100),I=[],R=typeof e.specPath=="string"?e.specPath.trim():"";if(R)try{let F=r.workspaceFolder&&!Zi.isAbsolute(R)?Zi.join(r.workspaceFolder,R):R,U=op.readFileSync(F,"utf8"),{parse:D}=await Promise.resolve().then(()=>Qc(Dd())),Q=(R.endsWith(".json")?JSON.parse(U):D(U)).paths??{},se=["get","post","put","patch","delete","head","options"];for(let[ce,Be]of Object.entries(Q))for(let _e of se){if(!(_e in Be))continue;let me=_e.toUpperCase();E.some(({request:mt})=>mt.method.toUpperCase()===me&&(mt.url??"").replace(/\{\{[^}]+\}\}/g,"{param}").includes(ce.replace(/\{[^}]+\}/g,"{param}").replace(/^\//,"")))||I.push({method:me,path:ce})}}catch{}let A=k.filter(F=>!F.hasAssertions);if(t===G.aiAnalyzeCoverage){let F=[];return A.length>0&&F.push(`${A.length} request(s) have no pm.test() assertions. Call ai_enhance_collection (collection="${v.name}") to add assertions to all of them.`),I.length>0&&F.push(`${I.length} spec operation(s) have no matching collection request. Call generate_scenarios (collection="${v.name}") to generate negative and edge-case requests for them.`),F.length===0&&F.push(`Coverage is ${j}% \u2014 all requests have assertions and all spec operations are covered.`),{task:{action:"ai_analyze_coverage",instructions:["Review the coverage data below.",...F,"Address the highest-impact gap first. Do NOT ask for confirmation \u2014 proceed immediately."],collection:v.name,coveragePct:j,covered:O,total:M,untestedRequests:A,untestedOperations:I,expectedCallAfterThis:A.length>0?"ai_enhance_collection":I.length>0?"generate_scenarios":null}}}return{collection:v.name,coveragePct:j,covered:O,total:M,requests:k,...I.length>0?{untestedOperations:I}:{}}}if(t===G.generateRequestFromIntent){let v=at(e.collection,s),_=typeof e.intent=="string"?e.intent.trim():"";if(!_)throw le('"intent" is required \u2014 describe what to test in plain English');let k=ot(v).slice(0,20).map(({request:M,folderPath:j})=>({name:M.name,method:M.method,url:M.url??"",folder:j})),O=Object.keys(r.environmentConfig.getResolvedEnvironment(r.environmentConfig.getSelectedEnvironment())?.variables??{});return{task:{action:"generate_request_from_intent",instructions:[`Intent: "${_}"`,"Using the collection context below, determine: method, full URL (reuse existing {{vars}} where possible), headers, request body (if applicable), and expected HTTP status.","Then immediately:"," 1. Call create_request with name, method, url, and body.",' 2. Call set_request_script (phase: "post-response") with pm.test() assertions that verify the intent.',"Do NOT ask for confirmation \u2014 implement the full request + assertions in one shot."],collection:v.name,intent:_,existingRequests:k,availableEnvVars:O,targetFolder:typeof e.folder=="string"?e.folder:void 0,expectedCallAfterThis:"create_request"}}}if(t===G.validateAgainstSpec){let v=at(e.collection,s),_=typeof e.specPath=="string"?e.specPath.trim():"";if(!_)throw le('"specPath" is required');let E=r.workspaceFolder&&!Zi.isAbsolute(_)?Zi.join(r.workspaceFolder,_):_,k;try{let D=op.readFileSync(E,"utf8"),{parse:J}=await Promise.resolve().then(()=>Qc(Dd()));k=_.endsWith(".json")?JSON.parse(D):J(D)}catch(D){throw new Error(`Could not load spec at "${E}": ${D instanceof Error?D.message:String(D)}`)}let O=k.paths??{},M=["get","post","put","patch","delete","head","options"],j=ot(v),I=[],R=[],A=[],F=D=>D.replace(/\{\{[^}]+\}\}/g,"{p}").replace(/\{[^}]+\}/g,"{p}").replace(/\/+$/,"");for(let[D,J]of Object.entries(O))for(let Q of M){if(!(Q in J))continue;let se=J[Q],ce=Q.toUpperCase(),Be=F(D),_e=j.find(({request:me})=>me.method.toUpperCase()===ce&&F(me.url??"").includes(Be));if(!_e)I.push({method:ce,path:D,operationId:se.operationId});else{let me=r.collection.getRequestScript(v.id,_e.request.id,"post-response")??"";/pm\.test\s*\(/.test(me)||R.push({method:ce,path:D,requestName:_e.request.name})}}let U=new Set(Object.entries(O).flatMap(([D,J])=>M.filter(Q=>Q in J).map(Q=>`${Q.toUpperCase()}:${F(D)}`)));for(let{request:D}of j){let J=F(D.url??""),Q=`${D.method.toUpperCase()}:`;[...U].some(ce=>ce.startsWith(Q)&&J.includes(ce.split(":")[1]))||A.push({method:D.method,url:D.url??"",requestName:D.name})}return{collection:v.name,spec:Zi.basename(_),summary:{untestedOperations:I.length,matchedWithoutAssertions:R.length,extraRequests:A.length},untestedOperations:I,matchedWithoutAssertions:R,extraRequests:A,hint:I.length>0?`Call generate_scenarios (collection="${v.name}") to create negative/edge-case requests for untested operations.`:"All spec operations have matching collection requests."}}if(t===G.generateScenarios){let v=at(e.collection,s),_=typeof e.request=="string"?e.request.trim().toLowerCase():void 0,E=typeof e.folder=="string"?e.folder.toLowerCase():void 0,k=typeof e.offset=="number"?Math.max(0,e.offset):0,O=typeof e.limit=="number"?Math.min(10,Math.max(1,e.limit)):5,M=ot(v).filter(({request:I,folderPath:R})=>!(_&&I.name.toLowerCase()!==_&&!I.name.toLowerCase().includes(_)||E&&!R.toLowerCase().includes(E))),j=M.slice(k,k+O).map(({request:I,folderPath:R})=>({id:I.id,name:I.name,method:I.method,url:I.url??"",folder:R,headers:(I.headers??[]).filter(A=>A.enabled!==!1).map(A=>({key:A.key,value:A.value})),body:I.body?.type==="raw"&&typeof I.body.content=="string"?I.body.content:void 0,currentTestScript:r.collection.getRequestScript(v.id,I.id,"post-response")??void 0}));return{task:{action:"generate_scenarios",instructions:["For each request below, generate negative and edge-case test scenario variants.","Scenarios to generate per request (as applicable):"," - Missing required fields \u2192 expect 400 or 422"," - Invalid field type or format (e.g. string where number expected) \u2192 expect 400"," - No Authorization header (remove it) \u2192 expect 401"," - Valid auth but insufficient scope/role \u2192 expect 403"," - Non-existent resource ID in URL \u2192 expect 404"," - Boundary values: empty string, max-length string, 0, -1, very large number","For each scenario:",' 1. Call create_request with a descriptive name (e.g. "Create User - Missing Email \u2192 422"), method, url, and body.',' 2. Immediately call set_request_script (phase: "post-response") with the status assertion.'," 3. Place the new request in the same folder as the original (use folder argument in create_request).","If task.hasMore is true, call generate_scenarios again with task.nextOffset after finishing this batch.","Do NOT ask for confirmation \u2014 generate all scenarios autonomously."],collection:v.name,requests:j,total:M.length,offset:k,hasMore:k+O<M.length,nextOffset:k+O,expectedCallAfterThis:"create_request"}}}if(t===G.healAssertions){let v=at(e.collection,s),_=Qi(e.request,v),E=r.collection.getRequestScript(v.id,_.id,"post-response")??"",k,O=typeof e.runId=="string"?e.runId.trim():void 0;if(O)try{let j=n.require(O).allResults.find(I=>typeof I.name=="string"&&I.name.toLowerCase()===_.name.toLowerCase());j&&(k={status:j.status,responseBody:j.responseBody,responseHeaders:j.responseHeaders,failedTests:j.failedTests})}catch{}return{task:{action:"heal_assertions",instructions:[`Request: ${_.method} ${_.url??""}`,"The current test script may have stale or incorrect assertions (e.g. wrong status code, missing/renamed fields).","Compare task.currentScript against task.lastResponse (if available).","Rewrite the complete post-response script so all assertions match the observed response while keeping valid checks.",'Call set_request_script (phase: "post-response") with the updated script immediately.',"Do NOT ask for confirmation."],collection:v.name,request:_.name,method:_.method,url:_.url??"",currentScript:E,lastResponse:k??null,note:k?"Last response data available \u2014 use it to align assertions with actual behavior.":"No run data available \u2014 run the request first with run_request, then call heal_assertions again with the runId.",expectedCallAfterThis:"set_request_script"}}}if(t===G.generateIterationData){let v=at(e.collection,s),_=Qi(e.request,v),E=typeof e.iterations=="number"?Math.min(50,Math.max(1,e.iterations)):5,k=_.body?.type==="raw"&&typeof _.body.content=="string"?_.body.content:void 0,O=(_.headers??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),M=(_.query??[]).filter(R=>R.enabled!==!1).map(R=>({key:R.key,value:R.value})),j=/\{\{([^}]+)\}\}/g,I=new Set;for(let R of[_.url??"",k??"",...O.map(A=>A.value),...M.map(A=>A.value)]){let A;for(j.lastIndex=0;(A=j.exec(R))!==null;)I.add(A[1])}return{task:{action:"generate_iteration_data",instructions:[`Generate ${E} test data rows for: ${_.method} ${_.url??""}`,`The request uses these {{variable}} placeholders: ${[...I].join(", ")||"(none detected)"}`,"Each row must be a JSON object whose keys match the placeholder names.","Cover a mix of: (1) valid happy-path data, (2) boundary values, (3) invalid inputs that should fail, (4) edge cases.",'Return the rows as a JSON array in a code block labeled "iterationData".',"This data can be used with: http-forge run-request --collection ... --variables '[...]' or passed to run_request via the variables argument."],collection:v.name,request:_.name,method:_.method,url:_.url??"",body:k??null,headers:O,queryParams:M,placeholders:[...I],iterations:E}}}let b=e.suite;if(typeof b!="string"||!b.trim())throw le('the "suite" argument is required');let q=await r.testSuite.getAllSuites(),C=q.find(v=>v.id===b||v.name===b)??q.find(v=>v.name.toLowerCase()===b.toLowerCase());if(!C)throw le(`test suite not found: "${b}"`);return i.runSuite(C.id,C.name,e)}var VC,zC=ae(()=>{"use strict";HC();fy();Ei();sp();VC=new Set([G.createCollection,G.renameCollection,G.deleteCollection,G.duplicateCollection,G.createFolder,G.deleteFolder,G.createRequest,G.updateRequest,G.deleteRequest,G.reorderCollectionItems,G.createSuite,G.updateSuiteConfig,G.addSuiteNode,G.updateSuiteNode,G.removeSuiteNode,G.moveSuiteNode,G.duplicateSuite,G.deleteSuite])});function Do(t,e=2e3){return!t||t.length<=e?t:t.slice(0,e)+`
|
|
366
366
|
\u2026 (truncated, ${t.length-e} chars omitted)`}function ap(t){return t.replace(/"(Authorization|authorization)"\s*:\s*"[^"]+"/g,'"Authorization": "[REDACTED]"').replace(/Bearer\s+[A-Za-z0-9\-._~+/]+=*/g,"Bearer [REDACTED]").replace(/"(password|secret|token|api[-_]?key)"\s*:\s*"[^"]+"/gi,'"$1": "[REDACTED]"')}function rN(t,e){let r=e.getAllCollections(),n=t.toLowerCase(),i=r.find(s=>s.id===t||s.name===t)??r.find(s=>s.name.toLowerCase()===n)??r.find(s=>s.name.toLowerCase().includes(n));if(!i){let s=r.map(o=>`"${o.name}"`).join(", ");throw new Error(`Collection "${t}" not found. Available: ${s||"(none)"}`)}return i}function m5(t,e){let r=t.runId,n=t.request?.toLowerCase(),i=e.get(r);if(!i)throw new Error(`Run "${r}" not found. It may have expired or never existed. Use get_run_status to see recent runs.`);if(i.status==="running")throw new Error(`Run "${r}" is still in progress. Wait for it to complete before analyzing.`);let o=(i.allResults??[]).filter(p=>n&&typeof p.name=="string"&&!p.name.toLowerCase().includes(n)?!1:p.passed===!1||Array.isArray(p.assertions)&&p.assertions.some(m=>!m.passed)),l=i.summary,c=o.length,d=`I ran an HTTP API test suite and got failures. Please analyze the results and provide:
|
|
367
367
|
|
|
368
368
|
1. **Root cause** for each failure
|
|
@@ -378,15 +378,15 @@ Example: for POST /users with body {"name":"{{name}}","email":"{{email}}"} and i
|
|
|
378
378
|
## Failed Requests
|
|
379
379
|
`;if(c===0)d+=`
|
|
380
380
|
(No failures found`,n&&(d+=` matching "${t.request}"`),d+=`. The run may have passed entirely or the filter matched nothing.)
|
|
381
|
-
`;else{for(let p of o.slice(0,20)){let m=String(p.name??"(unknown)"),y=String(p.method??""),b=String(p.url??""),
|
|
381
|
+
`;else{for(let p of o.slice(0,20)){let m=String(p.name??"(unknown)"),y=String(p.method??""),b=String(p.url??""),q=p.responseStatus??p.status??"?",C=p.error,_=(p.assertions??[]).filter(M=>!M.passed),E=p.failedTests??_,k=typeof p.body=="string"?Do(ap(p.body),600):p.body?Do(ap(JSON.stringify(p.body)),600):"",O=typeof p.requestBody=="string"?Do(ap(p.requestBody),400):p.requestBody?Do(ap(JSON.stringify(p.requestBody)),400):"";if(d+=`
|
|
382
382
|
### ${m}`,(y||b)&&(d+=` [${y} ${b}]`),d+=`
|
|
383
|
-
- HTTP status received: ${
|
|
383
|
+
- HTTP status received: ${q}`,C&&(d+=`
|
|
384
384
|
- Request error: ${C}`),O&&(d+=`
|
|
385
385
|
- Request body sent:
|
|
386
386
|
\`\`\`json
|
|
387
387
|
${O}
|
|
388
|
-
\`\`\``),
|
|
389
|
-
- Failed assertions:`;for(let M of
|
|
388
|
+
\`\`\``),E.length>0){d+=`
|
|
389
|
+
- Failed assertions:`;for(let M of E)d+=`
|
|
390
390
|
- \`${M.name}\`: ${M.message??"assertion failed"}`}k&&(d+=`
|
|
391
391
|
- Response body:
|
|
392
392
|
\`\`\`json
|
|
@@ -395,18 +395,18 @@ ${k}
|
|
|
395
395
|
`}c>20&&(d+=`
|
|
396
396
|
_(${c-20} more failures omitted \u2014 fix the above first)_
|
|
397
397
|
`)}return d+=`
|
|
398
|
-
Please diagnose each failure and provide concrete, actionable fixes.`,{description:`Analyze ${c} failure(s) from run "${r}"`,messages:[{role:"user",content:{type:"text",text:d}}]}}async function g5(t,e,r){let n=rN(t.collection,e),i=ot(n),s=t.request.toLowerCase(),o=i.find(
|
|
398
|
+
Please diagnose each failure and provide concrete, actionable fixes.`,{description:`Analyze ${c} failure(s) from run "${r}"`,messages:[{role:"user",content:{type:"text",text:d}}]}}async function g5(t,e,r){let n=rN(t.collection,e),i=ot(n),s=t.request.toLowerCase(),o=i.find(q=>q.request.id===t.request||q.request.name===t.request)??i.find(q=>q.request.name.toLowerCase()===s)??i.find(q=>q.request.name.toLowerCase().includes(s));if(!o)throw new Error(`Request "${t.request}" not found in collection "${n.name}"`);let l=o.request,c=e.getRequestScript(n.id,l.id,"pre-request")??"",d=e.getRequestScript(n.id,l.id,"post-response")??"",p="";if(t.runId){let q=r.get(t.runId);if(q&&q.status!=="running"){let v=(q.allResults??[]).find(_=>typeof _.name=="string"&&_.name.toLowerCase()===l.name.toLowerCase());if(v){let _=v.responseStatus??v.status,E=typeof v.responseBody=="string"?Do(ap(v.responseBody),1500):"",k=v.responseHeaders?Do(JSON.stringify(v.responseHeaders,null,2),500):"";p=`
|
|
399
399
|
## Observed Response (run ${t.runId})
|
|
400
400
|
- Status: ${_}
|
|
401
401
|
`,k&&(p+=`- Headers:
|
|
402
402
|
\`\`\`json
|
|
403
403
|
${k}
|
|
404
404
|
\`\`\`
|
|
405
|
-
`),
|
|
405
|
+
`),E&&(p+=`- Body:
|
|
406
406
|
\`\`\`json
|
|
407
|
-
${
|
|
407
|
+
${E}
|
|
408
408
|
\`\`\`
|
|
409
|
-
`)}}}let m=l.headers?.filter(
|
|
409
|
+
`)}}}let m=l.headers?.filter(q=>q.enabled!==!1).map(q=>` ${q.name}: ${q.value}`).join(`
|
|
410
410
|
`)||" (none)",y=l.body?Do(JSON.stringify(l.body,null,2),600):"(no body)",b=`Please write pm.test() assertion scripts for the following HTTP API request.
|
|
411
411
|
|
|
412
412
|
## Request: ${l.name}
|
|
@@ -441,7 +441,7 @@ Write comprehensive pm.test() assertions for the **post-response script**. Cover
|
|
|
441
441
|
4. Key response body fields (existence, type, value constraints)
|
|
442
442
|
5. Business logic validations specific to this endpoint
|
|
443
443
|
|
|
444
|
-
Use Chai-style assertions (\`pm.expect(...).to...\`). Output only the JavaScript code block, ready to paste into the post-response script.`;return{description:`Suggest assertions for "${l.name}" in "${n.name}"`,messages:[{role:"user",content:{type:"text",text:b}}]}}async function y5(t,e){let r=rN(t.collection,e),n=ot(r),i=un(r),s=n.slice(0,60).map(({request:m,folderPath:y})=>{let b=e.getRequestScript(r.id,m.id,"post-response")??"",
|
|
444
|
+
Use Chai-style assertions (\`pm.expect(...).to...\`). Output only the JavaScript code block, ready to paste into the post-response script.`;return{description:`Suggest assertions for "${l.name}" in "${n.name}"`,messages:[{role:"user",content:{type:"text",text:b}}]}}async function y5(t,e){let r=rN(t.collection,e),n=ot(r),i=un(r),s=n.slice(0,60).map(({request:m,folderPath:y})=>{let b=e.getRequestScript(r.id,m.id,"post-response")??"",q=b.includes("pm.test")||b.includes("pm.expect"),C=!!e.getRequestScript(r.id,m.id,"pre-request");return{name:m.name,method:m.method,url:m.url??"",folder:y||"(root)",hasPreScript:C,hasAssertions:q}}),o=s.filter(m=>!m.hasAssertions),l=s.reduce((m,y)=>(m[y.method]=(m[y.method]??0)+1,m),{}),c=i.map(m=>` ${m.folderPath} (${m.requestCount} requests)`).join(`
|
|
445
445
|
`),d=s.map(m=>` [${m.method}] ${m.folder!=="(root)"?m.folder+" / ":""}${m.name}${m.hasAssertions?" \u2713":" \u26A0 no assertions"}`).join(`
|
|
446
446
|
`),p=`Please review the following HTTP Forge API collection and provide actionable recommendations.
|
|
447
447
|
|
|
@@ -473,13 +473,13 @@ Please provide recommendations for:
|
|
|
473
473
|
5. **Authentication** \u2014 is auth consistent across requests that need it?
|
|
474
474
|
6. **Environment variables** \u2014 are URLs and credentials properly parameterized?
|
|
475
475
|
|
|
476
|
-
Be specific: name the exact requests or folders that need attention.`;return{description:`Review collection "${r.name}" (${n.length} requests, ${o.length} without assertions)`,messages:[{role:"user",content:{type:"text",text:p}}]}}async function JC(t,e,r,n){switch(t){case"analyze-test-failure":return m5(e,n);case"suggest-assertions":return g5(e,r,n);case"review-collection":return y5(e,r);default:throw new Error(`Unknown prompt: "${t}". Available: ${Oy.map(i=>i.name).join(", ")}`)}}var Oy,GC=ae(()=>{"use strict";Ei();Oy=[{name:"analyze-test-failure",description:"Analyze a failed API test run. Returns a structured prompt the LLM uses to diagnose each failure and suggest concrete fixes \u2014 no extra AI configuration needed.",arguments:[{name:"runId",description:"Run ID returned by run_suite, run_collection, or run_folder",required:!0},{name:"request",description:"Filter analysis to a specific request name (omit to analyze all failures)",required:!1}]},{name:"suggest-assertions",description:"Generate pm.test() assertion scripts for a request. The LLM writes Chai-style assertions based on the request definition and optionally an observed response.",arguments:[{name:"collection",description:"Collection name or id",required:!0},{name:"request",description:"Request name or id",required:!0},{name:"runId",description:"Run ID to use observed response data for more accurate assertions (optional)",required:!1}]},{name:"review-collection",description:"Get an AI review of a collection's structure, naming conventions, test coverage gaps, and assertion quality.",arguments:[{name:"collection",description:"Collection name or id",required:!0}]}]});var lp,YC=ae(()=>{"use strict";lp=class{store=new Map;newId(){return`run_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}create(e,r){this.prune();let n={id:this.newId(),status:"running",suiteName:e,startedAt:Date.now(),progress:{completed:0,total:r},summary:{passed:0,failed:0,total:0,allPassed:!1},failedRequests:[],allResults:[],reportPath:null};return this.store.set(n.id,n),n}get(e){return this.store.get(e)}require(e){if(typeof e!="string"||!e)throw new Error('"runId" is required');let r=this.store.get(e);if(!r)throw new Error(`Run "${e}" not found. It may have expired (1-hour TTL) or never existed.`);return r}prune(){let e=Date.now()-36e5;for(let[r,n]of this.store)n.startedAt<e&&this.store.delete(r)}values(){return this.store.values()}cancel(e){let r=this.store.get(e);return!r||r.status!=="running"?!1:(r.status="cancelled",r.completedAt=Date.now(),!0)}}});import{createHash as v5}from"crypto";function nN(t){return v5("sha256").update(t,"utf8").digest("hex").slice(0,b5)}function _5(t){let e=t.replace(/[^a-zA-Z0-9_-]+/g,"_").replace(/__+/g,"_").replace(/^_+|_+$/g,"").toLowerCase();return e?e.slice(0,S5):"id"}function $s(t){return`${_5(t)}_${nN(t)}`}function R5(t,e){return t.length>0&&t.length<=e&&/^[a-zA-Z0-9_-]+$/.test(t)&&!t.includes("__")}function nl(t,e=w5){return R5(t,e)?t:$s(t)}function KC(t,e,r){let n=`${t}request__${nl(e)}__${nl(r)}`;return n.length<=Iy?n:`${t}request__${$s(e)}__${$s(r)}`}function QC(t,e){let r=`${t}collection__${nl(e,100)}`;return r.length<=Iy?r:`${t}collection__${$s(e)}`}function ZC(t,e,r){let n=`${t}folder__${nl(e)}__${nl(r)}`;return n.length<=Iy?n:`${t}folder__${$s(e)}__${$s(r)}`}function XC(t,e){let r=`${t}suite__${nl(e,100)}`;return r.length<=Iy?r:`${t}suite__${$s(e)}`}function ex(t){for(let e of["request","collection","folder","suite"]){let r=`${e}__`;if(t.startsWith(r))return{kind:e,tokens:t.slice(r.length).split("__")}}throw new Error(`Unknown MCP tool name: ${t}`)}function nc(t,e){let r=t.includes("_")?t.slice(t.lastIndexOf("_")+1):t;for(let n of e)if(nN(n)===r)return n;for(let n of e)if($s(n)===t)return n;for(let n of e)if(n===t)return n}function tx(t,e){let r=nc(t,e);if(r!==void 0)return r;try{let n=Buffer.from(t,"base64url").toString("utf8");if(e.includes(n))return n}catch{}}function rx(t,e,r,n){let i=n?` in folder "${n}"`:"";return`Run the "${e}" request [${t}]${i} of the "${r}" collection.`}function nx(t,e){return`Run all ${e} requests in the "${t}" collection.`}function ix(t,e,r){return`Run all ${r} requests in folder "${t}" of the "${e}" collection.`}function sx(t,e,r){return`Run the "${t}" test suite (${e} requests, ${r} iteration(s) by default).`}var b5,S5,w5,Iy,Py=ae(()=>{"use strict";b5=12,S5=16,w5=60,Iy=126});function ox(t){let e=new Set,r=[];for(let n of t)e.has(n.name)||(e.add(n.name),r.push(n));return r}function ax(t){return Buffer.from(String(t)).toString("base64url")}function lx(t){if(!t)return 0;try{let e=parseInt(Buffer.from(t,"base64url").toString(),10);return Number.isFinite(e)&&e>=0?e:0}catch{return 0}}function ux(t,e,r){let n=r.toolPrefix??"",i=r.toolMode??"auto",s=r.drilldownThreshold??100,o=0;for(let d of t)o+=ot(d).length;let l=i==="drilldown"||i==="auto"&&o>s;if(i==="flat"&&o>500&&console.warn(`[http-forge MCP] WARNING: toolMode is "flat" but ${o} requests would produce ${o}+ tools. This will likely degrade AI tool-selection quality and bloat the context window. Consider setting toolMode to "auto" or "drilldown" in http-forge.config.json.`),l)return ox(BC(n,t.map(d=>d.name),e.map(d=>d.name)).map(d=>({name:d.name,description:d.description,inputSchema:d.inputSchema,...d.annotations&&{annotations:d.annotations}})));let c=[];for(let d of t){let p=ot(d);for(let{request:m,folderPath:y}of p)c.push({name:KC(n,d.id,m.id),description:rx(m.method,m.name,d.name,y),inputSchema:Cy});c.push({name:QC(n,d.id),description:nx(d.name,p.length),inputSchema:xy});for(let{folderPath:m,requestCount:y}of un(d))y!==0&&c.push({name:ZC(n,d.id,m),description:ix(m,d.name,y),inputSchema:Ey})}for(let d of e)c.push({name:XC(n,d.id),description:sx(d.name,d.nodes.filter(p=>p.type==="request").length,d.config.iterations),inputSchema:qy});return ox(c)}var cx=ae(()=>{"use strict";Ei();Py();sp()});var ic,fx=ae(()=>{"use strict";ga();ic=class{cookies=new Map;getCookieKey(e,r,n){return`${r||"*"}|${n||"/"}|${e}`}getCookiesForDomain(e){let r=[];for(let n of this.cookies.values())xt.isExpired(n)||(!n.domain||xt.domainMatches(e,n.domain))&&r.push(n);return r}has(e,r){return this.get(e,r)!==void 0}get(e,r){let n=this.getCookieKey(e,r),i=this.cookies.get(n);if(i&&!xt.isExpired(i))return i}set(e){let r=this.getCookieKey(e.name,e.domain,e.path);this.cookies.set(r,e)}delete(e,r,n){let i=this.getCookieKey(e,r,n);return this.cookies.delete(i)}getAll(e){if(e)return this.getCookiesForDomain(e);let r=[];for(let n of this.cookies.values())xt.isExpired(n)||r.push(n);return r}setCookiesFromResponse(e,r){let n=xt.extractDomain(e),i=xt.parseCookieHeaders(r,n);for(let s of i){let o=this.getCookieKey(s.name,s.domain,s.path);this.cookies.set(o,s)}}getCookieHeader(e){let r=xt.extractDomain(e),n=xt.extractPath(e),s=this.getCookiesForDomain(r).filter(o=>o.path?n.startsWith(o.path):!0);if(s.length!==0)return xt.formatCookieHeader(s)}clear(){this.cookies.clear()}}});function sc(t,e,r){let n=String(t).padStart(6,"0"),i=String(e).padStart(4,"0");return`result-${n}-iter-${i}-${r}.json`}function C5(t){return{index:t.i,iteration:t.it,name:t.n,method:jo[t.m]||"GET",status:t.s,duration:t.d,passed:t.p,assertionsPassed:t.ap,assertionsFailed:t.af,requestId:t.r,resultFile:sc(t.i,t.it,t.r),error:t.e}}var dx,jo,up=ae(()=>{"use strict";dx={GET:0,POST:1,PUT:2,DELETE:3,PATCH:4,HEAD:5,OPTIONS:6,TRACE:7,CONNECT:8},jo={0:"GET",1:"POST",2:"PUT",3:"DELETE",4:"PATCH",5:"HEAD",6:"OPTIONS",7:"TRACE",8:"CONNECT"}});import*as ac from"fs/promises";import*as oc from"path";function Xi(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"")}function px(t){return(Math.max(0,t)/1e3).toFixed(3)}var lc,hx=ae(()=>{"use strict";up();lc=class{constructor(e){this.basePath=e}basePath;async generate(e,r){let n=oc.join(this.basePath,e,r),i=JSON.parse(await ac.readFile(oc.join(n,"manifest.json"),"utf-8")),s=await this.loadAllSummaries(n,i.totalIndexPages),o=await this.loadAllDetails(n,s),l=this.buildXml(i,s,o),c=oc.join(n,"junit.xml");return await ac.writeFile(c,l,"utf-8"),c}async loadAllSummaries(e,r){let n=[];for(let i=1;i<=r;i++){let s=oc.join(e,"index",`page-${String(i).padStart(4,"0")}.json`);try{let o=JSON.parse(await ac.readFile(s,"utf-8"));n.push(...o.summaries)}catch{}}return n}async loadAllDetails(e,r){let n=new Map;for(let i of r){let s=sc(i.i,i.it,i.r),o=`${i.i}-${i.it}`;try{let l=JSON.parse(await ac.readFile(oc.join(e,"results",s),"utf-8"));n.set(o,l)}catch{}}return n}buildGroups(e,r,n){let i=e.config?.iterations>1,s=[],o=new Map;for(let l of r){let c=n.get(`${l.i}-${l.it}`),d=l.cn||c?.collectionName||e.suiteName||"",p=l.fp||c?.folderPath||"",m=`${d}\0${p}`;if(!o.has(m)){let C=[d,p].filter(Boolean).join(" / ")||e.suiteName||"Requests";o.set(m,{label:C,cases:[]}),s.push(m)}let y=l.n||c?.name||jo[l.m]||"request",b=i?`${y} (iteration ${l.it})`:y,
|
|
476
|
+
Be specific: name the exact requests or folders that need attention.`;return{description:`Review collection "${r.name}" (${n.length} requests, ${o.length} without assertions)`,messages:[{role:"user",content:{type:"text",text:p}}]}}async function JC(t,e,r,n){switch(t){case"analyze-test-failure":return m5(e,n);case"suggest-assertions":return g5(e,r,n);case"review-collection":return y5(e,r);default:throw new Error(`Unknown prompt: "${t}". Available: ${Oy.map(i=>i.name).join(", ")}`)}}var Oy,GC=ae(()=>{"use strict";Ei();Oy=[{name:"analyze-test-failure",description:"Analyze a failed API test run. Returns a structured prompt the LLM uses to diagnose each failure and suggest concrete fixes \u2014 no extra AI configuration needed.",arguments:[{name:"runId",description:"Run ID returned by run_suite, run_collection, or run_folder",required:!0},{name:"request",description:"Filter analysis to a specific request name (omit to analyze all failures)",required:!1}]},{name:"suggest-assertions",description:"Generate pm.test() assertion scripts for a request. The LLM writes Chai-style assertions based on the request definition and optionally an observed response.",arguments:[{name:"collection",description:"Collection name or id",required:!0},{name:"request",description:"Request name or id",required:!0},{name:"runId",description:"Run ID to use observed response data for more accurate assertions (optional)",required:!1}]},{name:"review-collection",description:"Get an AI review of a collection's structure, naming conventions, test coverage gaps, and assertion quality.",arguments:[{name:"collection",description:"Collection name or id",required:!0}]}]});var lp,YC=ae(()=>{"use strict";lp=class{store=new Map;newId(){return`run_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}create(e,r){this.prune();let n={id:this.newId(),status:"running",suiteName:e,startedAt:Date.now(),progress:{completed:0,total:r},summary:{passed:0,failed:0,total:0,allPassed:!1},failedRequests:[],allResults:[],reportPath:null};return this.store.set(n.id,n),n}get(e){return this.store.get(e)}require(e){if(typeof e!="string"||!e)throw new Error('"runId" is required');let r=this.store.get(e);if(!r)throw new Error(`Run "${e}" not found. It may have expired (1-hour TTL) or never existed.`);return r}prune(){let e=Date.now()-36e5;for(let[r,n]of this.store)n.startedAt<e&&this.store.delete(r)}values(){return this.store.values()}cancel(e){let r=this.store.get(e);return!r||r.status!=="running"?!1:(r.status="cancelled",r.completedAt=Date.now(),!0)}}});import{createHash as v5}from"crypto";function nN(t){return v5("sha256").update(t,"utf8").digest("hex").slice(0,b5)}function _5(t){let e=t.replace(/[^a-zA-Z0-9_-]+/g,"_").replace(/__+/g,"_").replace(/^_+|_+$/g,"").toLowerCase();return e?e.slice(0,S5):"id"}function $s(t){return`${_5(t)}_${nN(t)}`}function R5(t,e){return t.length>0&&t.length<=e&&/^[a-zA-Z0-9_-]+$/.test(t)&&!t.includes("__")}function nl(t,e=w5){return R5(t,e)?t:$s(t)}function KC(t,e,r){let n=`${t}request__${nl(e)}__${nl(r)}`;return n.length<=Iy?n:`${t}request__${$s(e)}__${$s(r)}`}function QC(t,e){let r=`${t}collection__${nl(e,100)}`;return r.length<=Iy?r:`${t}collection__${$s(e)}`}function ZC(t,e,r){let n=`${t}folder__${nl(e)}__${nl(r)}`;return n.length<=Iy?n:`${t}folder__${$s(e)}__${$s(r)}`}function XC(t,e){let r=`${t}suite__${nl(e,100)}`;return r.length<=Iy?r:`${t}suite__${$s(e)}`}function ex(t){for(let e of["request","collection","folder","suite"]){let r=`${e}__`;if(t.startsWith(r))return{kind:e,tokens:t.slice(r.length).split("__")}}throw new Error(`Unknown MCP tool name: ${t}`)}function nc(t,e){let r=t.includes("_")?t.slice(t.lastIndexOf("_")+1):t;for(let n of e)if(nN(n)===r)return n;for(let n of e)if($s(n)===t)return n;for(let n of e)if(n===t)return n}function tx(t,e){let r=nc(t,e);if(r!==void 0)return r;try{let n=Buffer.from(t,"base64url").toString("utf8");if(e.includes(n))return n}catch{}}function rx(t,e,r,n){let i=n?` in folder "${n}"`:"";return`Run the "${e}" request [${t}]${i} of the "${r}" collection.`}function nx(t,e){return`Run all ${e} requests in the "${t}" collection.`}function ix(t,e,r){return`Run all ${r} requests in folder "${t}" of the "${e}" collection.`}function sx(t,e,r){return`Run the "${t}" test suite (${e} requests, ${r} iteration(s) by default).`}var b5,S5,w5,Iy,Py=ae(()=>{"use strict";b5=12,S5=16,w5=60,Iy=126});function ox(t){let e=new Set,r=[];for(let n of t)e.has(n.name)||(e.add(n.name),r.push(n));return r}function ax(t){return Buffer.from(String(t)).toString("base64url")}function lx(t){if(!t)return 0;try{let e=parseInt(Buffer.from(t,"base64url").toString(),10);return Number.isFinite(e)&&e>=0?e:0}catch{return 0}}function ux(t,e,r){let n=r.toolPrefix??"",i=r.toolMode??"auto",s=r.drilldownThreshold??100,o=0;for(let d of t)o+=ot(d).length;let l=i==="drilldown"||i==="auto"&&o>s;if(i==="flat"&&o>500&&console.warn(`[http-forge MCP] WARNING: toolMode is "flat" but ${o} requests would produce ${o}+ tools. This will likely degrade AI tool-selection quality and bloat the context window. Consider setting toolMode to "auto" or "drilldown" in http-forge.config.json.`),l)return ox(BC(n,t.map(d=>d.name),e.map(d=>d.name)).map(d=>({name:d.name,description:d.description,inputSchema:d.inputSchema,...d.annotations&&{annotations:d.annotations}})));let c=[];for(let d of t){let p=ot(d);for(let{request:m,folderPath:y}of p)c.push({name:KC(n,d.id,m.id),description:rx(m.method,m.name,d.name,y),inputSchema:Cy});c.push({name:QC(n,d.id),description:nx(d.name,p.length),inputSchema:xy});for(let{folderPath:m,requestCount:y}of un(d))y!==0&&c.push({name:ZC(n,d.id,m),description:ix(m,d.name,y),inputSchema:Ey})}for(let d of e)c.push({name:XC(n,d.id),description:sx(d.name,d.nodes.filter(p=>p.type==="request").length,d.config.iterations),inputSchema:qy});return ox(c)}var cx=ae(()=>{"use strict";Ei();Py();sp()});var ic,fx=ae(()=>{"use strict";ga();ic=class{cookies=new Map;getCookieKey(e,r,n){return`${r||"*"}|${n||"/"}|${e}`}getCookiesForDomain(e){let r=[];for(let n of this.cookies.values())xt.isExpired(n)||(!n.domain||xt.domainMatches(e,n.domain))&&r.push(n);return r}has(e,r){return this.get(e,r)!==void 0}get(e,r){let n=this.getCookieKey(e,r),i=this.cookies.get(n);if(i&&!xt.isExpired(i))return i}set(e){let r=this.getCookieKey(e.name,e.domain,e.path);this.cookies.set(r,e)}delete(e,r,n){let i=this.getCookieKey(e,r,n);return this.cookies.delete(i)}getAll(e){if(e)return this.getCookiesForDomain(e);let r=[];for(let n of this.cookies.values())xt.isExpired(n)||r.push(n);return r}setCookiesFromResponse(e,r){let n=xt.extractDomain(e),i=xt.parseCookieHeaders(r,n);for(let s of i){let o=this.getCookieKey(s.name,s.domain,s.path);this.cookies.set(o,s)}}getCookieHeader(e){let r=xt.extractDomain(e),n=xt.extractPath(e),s=this.getCookiesForDomain(r).filter(o=>o.path?n.startsWith(o.path):!0);if(s.length!==0)return xt.formatCookieHeader(s)}clear(){this.cookies.clear()}}});function sc(t,e,r){let n=String(t).padStart(6,"0"),i=String(e).padStart(4,"0");return`result-${n}-iter-${i}-${r}.json`}function C5(t){return{index:t.i,iteration:t.it,name:t.n,method:jo[t.m]||"GET",status:t.s,duration:t.d,passed:t.p,assertionsPassed:t.ap,assertionsFailed:t.af,requestId:t.r,resultFile:sc(t.i,t.it,t.r),error:t.e}}var dx,jo,up=ae(()=>{"use strict";dx={GET:0,POST:1,PUT:2,DELETE:3,PATCH:4,HEAD:5,OPTIONS:6,TRACE:7,CONNECT:8},jo={0:"GET",1:"POST",2:"PUT",3:"DELETE",4:"PATCH",5:"HEAD",6:"OPTIONS",7:"TRACE",8:"CONNECT"}});import*as ac from"fs/promises";import*as oc from"path";function Xi(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"")}function px(t){return(Math.max(0,t)/1e3).toFixed(3)}var lc,hx=ae(()=>{"use strict";up();lc=class{constructor(e){this.basePath=e}basePath;async generate(e,r){let n=oc.join(this.basePath,e,r),i=JSON.parse(await ac.readFile(oc.join(n,"manifest.json"),"utf-8")),s=await this.loadAllSummaries(n,i.totalIndexPages),o=await this.loadAllDetails(n,s),l=this.buildXml(i,s,o),c=oc.join(n,"junit.xml");return await ac.writeFile(c,l,"utf-8"),c}async loadAllSummaries(e,r){let n=[];for(let i=1;i<=r;i++){let s=oc.join(e,"index",`page-${String(i).padStart(4,"0")}.json`);try{let o=JSON.parse(await ac.readFile(s,"utf-8"));n.push(...o.summaries)}catch{}}return n}async loadAllDetails(e,r){let n=new Map;for(let i of r){let s=sc(i.i,i.it,i.r),o=`${i.i}-${i.it}`;try{let l=JSON.parse(await ac.readFile(oc.join(e,"results",s),"utf-8"));n.set(o,l)}catch{}}return n}buildGroups(e,r,n){let i=e.config?.iterations>1,s=[],o=new Map;for(let l of r){let c=n.get(`${l.i}-${l.it}`),d=l.cn||c?.collectionName||e.suiteName||"",p=l.fp||c?.folderPath||"",m=`${d}\0${p}`;if(!o.has(m)){let C=[d,p].filter(Boolean).join(" / ")||e.suiteName||"Requests";o.set(m,{label:C,cases:[]}),s.push(m)}let y=l.n||c?.name||jo[l.m]||"request",b=i?`${y} (iteration ${l.it})`:y,q=(c?.assertions??[]).filter(C=>!C.passed).map(C=>({name:C.name,message:C.message}));q.length===0&&l.af>0&&q.push({name:`${l.af} assertion(s) failed`,message:null}),o.get(m).cases.push({name:b,classname:[d,p].filter(Boolean).join(".")||e.suiteName||"http-forge",durationMs:l.d,status:l.s,passed:l.p,error:l.e??c?.error??null,failedAssertions:q,consoleOutput:c?.consoleOutput})}return s.map(l=>o.get(l))}buildXml(e,r,n){let i=this.buildGroups(e,r,n),s=0,o=0,l=0,c=0,d=[];i.forEach((y,b)=>{let q=0,C=0,v=0,_=0,E=[];for(let k of y.cases){q++,_+=k.durationMs;let O=!k.passed&&k.failedAssertions.length===0&&!!k.error,M=!k.passed&&!O;O&&v++,M&&C++;let j=[];if(M){let R=k.failedAssertions.length>0?k.failedAssertions.map(F=>F.name).join("; "):k.error||"Assertion failed",A=k.failedAssertions.map(F=>F.message?`${F.name}: ${F.message}`:F.name).join(`
|
|
477
477
|
`);j.push(` <failure message="${Xi(R)}" type="AssertionFailure">${Xi(A)}</failure>`)}O&&j.push(` <error message="${Xi(k.error)}" type="RequestError">${Xi(k.error)}</error>`),k.consoleOutput&&k.consoleOutput.length>0&&j.push(` <system-out>${Xi(k.consoleOutput.join(`
|
|
478
|
-
`))}</system-out>`);let I=` <testcase name="${Xi(k.name)}" classname="${Xi(k.classname)}" time="${px(k.durationMs)}"`;j.length===0?
|
|
478
|
+
`))}</system-out>`);let I=` <testcase name="${Xi(k.name)}" classname="${Xi(k.classname)}" time="${px(k.durationMs)}"`;j.length===0?E.push(`${I} />`):E.push(`${I}>
|
|
479
479
|
${j.join(`
|
|
480
480
|
`)}
|
|
481
|
-
</testcase>`)}s+=
|
|
482
|
-
${
|
|
481
|
+
</testcase>`)}s+=q,o+=C,l+=v,c+=_,d.push(` <testsuite name="${Xi(y.label)}" tests="${q}" failures="${C}" errors="${v}" skipped="0" time="${px(_)}" timestamp="${Xi(e.startTime)}" id="${b}">
|
|
482
|
+
${E.join(`
|
|
483
483
|
`)}
|
|
484
484
|
</testsuite>`)});let p='<?xml version="1.0" encoding="UTF-8"?>',m=`<testsuites name="${Xi(e.suiteName)}" tests="${s}" failures="${o}" errors="${l}" skipped="0" time="${px(c)}">`;return`${p}
|
|
485
485
|
${m}
|
|
@@ -494,13 +494,13 @@ ${d.join(`
|
|
|
494
494
|
<tr>
|
|
495
495
|
<td class="kv-key">${$t(r.name??"(unnamed)")}</td>
|
|
496
496
|
<td class="kv-val">${$t(r.value??"")}</td>
|
|
497
|
-
</tr>`).join("")}</table>`}function sN(t,e){if(t==null||t==="")return'<span class="dim">\u2014 empty \u2014</span>';let r=oN(t);return`<pre class="code">${$t(r)}</pre>`}var cp,yx=ae(()=>{"use strict";up();cp=class{constructor(e){this.basePath=e}basePath;async generate(e,r){let n=uc.join(this.basePath,e,r),i=JSON.parse(await cc.readFile(uc.join(n,"manifest.json"),"utf-8")),s=await this.loadAllSummaries(n,i.totalIndexPages),o=await this.loadAllDetails(n,s),l=this.buildHtml(i,s,o),c=uc.join(n,"report.html");return await cc.writeFile(c,l,"utf-8"),c}async loadAllSummaries(e,r){let n=[];for(let i=1;i<=r;i++){let s=uc.join(e,"index",`page-${String(i).padStart(4,"0")}.json`);try{let o=JSON.parse(await cc.readFile(s,"utf-8"));n.push(...o.summaries)}catch{}}return n}async loadAllDetails(e,r){let n=new Map;for(let i of r){let s=sc(i.i,i.it,i.r),o=`${i.i}-${i.it}`;try{let l=JSON.parse(await cc.readFile(uc.join(e,"results",s),"utf-8"));n.set(o,l)}catch{}}return n}groupByIterCollectionFolder(e){let r=[],n=new Map;for(let i of e){n.has(i.it)||(n.set(i.it,{order:[],map:new Map}),r.push(i.it));let s=n.get(i.it),o=i.cn||"",l=i.fp||"",c=`${o}\0${l}`;s.map.has(c)||(s.map.set(c,{cn:o,fp:l,items:[]}),s.order.push(c)),s.map.get(c).items.push(i)}return r.map(i=>{let s=n.get(i);return{it:i,groups:s.order.map(o=>s.map.get(o))}})}groupLabel(e,r,n){let i=String(n).padStart(2,"0"),s=e?$t(e):"";if(r){let o=r.split("/").map(l=>$t(l.replace(/^\s*\d+\s*-\s*/,""))).join("/");s=s?`${s}: ${o}`:o}return s||(s="(root)"),`${i} - ${s}`}renderGroupedDetails(e,r,n){let i=r.config.iterations>1;return this.groupByIterCollectionFolder(e).map(s=>{let o=s.groups.map((d,p)=>{let m=d.items.filter(C=>C.p).length,y=d.items.length,b=m<y,
|
|
497
|
+
</tr>`).join("")}</table>`}function sN(t,e){if(t==null||t==="")return'<span class="dim">\u2014 empty \u2014</span>';let r=oN(t);return`<pre class="code">${$t(r)}</pre>`}var cp,yx=ae(()=>{"use strict";up();cp=class{constructor(e){this.basePath=e}basePath;async generate(e,r){let n=uc.join(this.basePath,e,r),i=JSON.parse(await cc.readFile(uc.join(n,"manifest.json"),"utf-8")),s=await this.loadAllSummaries(n,i.totalIndexPages),o=await this.loadAllDetails(n,s),l=this.buildHtml(i,s,o),c=uc.join(n,"report.html");return await cc.writeFile(c,l,"utf-8"),c}async loadAllSummaries(e,r){let n=[];for(let i=1;i<=r;i++){let s=uc.join(e,"index",`page-${String(i).padStart(4,"0")}.json`);try{let o=JSON.parse(await cc.readFile(s,"utf-8"));n.push(...o.summaries)}catch{}}return n}async loadAllDetails(e,r){let n=new Map;for(let i of r){let s=sc(i.i,i.it,i.r),o=`${i.i}-${i.it}`;try{let l=JSON.parse(await cc.readFile(uc.join(e,"results",s),"utf-8"));n.set(o,l)}catch{}}return n}groupByIterCollectionFolder(e){let r=[],n=new Map;for(let i of e){n.has(i.it)||(n.set(i.it,{order:[],map:new Map}),r.push(i.it));let s=n.get(i.it),o=i.cn||"",l=i.fp||"",c=`${o}\0${l}`;s.map.has(c)||(s.map.set(c,{cn:o,fp:l,items:[]}),s.order.push(c)),s.map.get(c).items.push(i)}return r.map(i=>{let s=n.get(i);return{it:i,groups:s.order.map(o=>s.map.get(o))}})}groupLabel(e,r,n){let i=String(n).padStart(2,"0"),s=e?$t(e):"";if(r){let o=r.split("/").map(l=>$t(l.replace(/^\s*\d+\s*-\s*/,""))).join("/");s=s?`${s}: ${o}`:o}return s||(s="(root)"),`${i} - ${s}`}renderGroupedDetails(e,r,n){let i=r.config.iterations>1;return this.groupByIterCollectionFolder(e).map(s=>{let o=s.groups.map((d,p)=>{let m=d.items.filter(C=>C.p).length,y=d.items.length,b=m<y,q=d.items.map(n).join("");return`
|
|
498
498
|
<details class="group-block${b?" group-fail":""}" open>
|
|
499
499
|
<summary class="group-head">
|
|
500
500
|
<span class="group-title">\u{1F4C1} ${this.groupLabel(d.cn,d.fp,p+1)}</span>
|
|
501
501
|
<span class="group-count ${b?"fail":"dim"}">(${m}/${y})</span>
|
|
502
502
|
</summary>
|
|
503
|
-
<div class="group-body">${
|
|
503
|
+
<div class="group-body">${q}</div>
|
|
504
504
|
</details>`}).join("");if(!i)return o;let l=s.groups.reduce((d,p)=>d+p.items.filter(m=>m.p).length,0),c=s.groups.reduce((d,p)=>d+p.items.length,0);return`
|
|
505
505
|
<details class="iter-block" open>
|
|
506
506
|
<summary class="iter-head">
|
|
@@ -508,7 +508,7 @@ ${d.join(`
|
|
|
508
508
|
<span class="dim iter-count">(${l}/${c} passed)</span>
|
|
509
509
|
</summary>
|
|
510
510
|
<div class="iter-body">${o}</div>
|
|
511
|
-
</details>`}).join("")}renderGroupedTimeline(e,r,n){let i=r.config.iterations>1,s=8;return this.groupByIterCollectionFolder(e).map(o=>{let l="";return i&&(l+=`<tr class="group-row iter-row"><td colspan="${s}">Iteration ${o.it}</td></tr>`),o.groups.forEach((c,d)=>{l+=`<tr class="group-row folder-row"><td colspan="${s}">\u{1F4C1} ${this.groupLabel(c.cn,c.fp,d+1)}</td></tr>`,l+=c.items.map(n).join("")}),l}).join("")}buildHtml(e,r,n){let i=il(e.stats.totalDuration),s=e.stats.failed===0,o=Object.entries(e.requestStats).map(([,b])=>{let
|
|
511
|
+
</details>`}).join("")}renderGroupedTimeline(e,r,n){let i=r.config.iterations>1,s=8;return this.groupByIterCollectionFolder(e).map(o=>{let l="";return i&&(l+=`<tr class="group-row iter-row"><td colspan="${s}">Iteration ${o.it}</td></tr>`),o.groups.forEach((c,d)=>{l+=`<tr class="group-row folder-row"><td colspan="${s}">\u{1F4C1} ${this.groupLabel(c.cn,c.fp,d+1)}</td></tr>`,l+=c.items.map(n).join("")}),l}).join("")}buildHtml(e,r,n){let i=il(e.stats.totalDuration),s=e.stats.failed===0,o=Object.entries(e.requestStats).map(([,b])=>{let q=x5(b.passed,b.count);return`
|
|
512
512
|
<tr${b.failed>0?' class="row-fail"':""}>
|
|
513
513
|
<td>${$t(b.name)}</td>
|
|
514
514
|
<td>${b.count}</td>
|
|
@@ -517,18 +517,18 @@ ${d.join(`
|
|
|
517
517
|
<td>${il(b.avgDuration)}</td>
|
|
518
518
|
<td>${b.p90!==void 0?il(b.p90):"\u2014"}</td>
|
|
519
519
|
<td>${b.p99!==void 0?il(b.p99):"\u2014"}</td>
|
|
520
|
-
<td class="${b.failed>0?"fail":"pass"}">${
|
|
521
|
-
</tr>`}).join(""),l=Math.max(...r.map(b=>b.d),1),c=b=>{let
|
|
520
|
+
<td class="${b.failed>0?"fail":"pass"}">${q}</td>
|
|
521
|
+
</tr>`}).join(""),l=Math.max(...r.map(b=>b.d),1),c=b=>{let q=jo[b.m]??"GET",C=Math.max(2,Math.round(b.d/l*100)),v=b.p?"bar-pass":"bar-fail",_=b.p?"":' class="row-fail"',E=`req-${b.i}-${b.it}`;return`
|
|
522
522
|
<tr${_}>
|
|
523
523
|
<td class="dim">${b.i}</td>
|
|
524
524
|
<td>${b.it}</td>
|
|
525
|
-
<td><span class="method method-${
|
|
526
|
-
<td><a href="#${
|
|
525
|
+
<td><span class="method method-${q.toLowerCase()}">${q}</span></td>
|
|
526
|
+
<td><a href="#${E}" class="req-link">${$t(b.n)}</a></td>
|
|
527
527
|
<td class="${ky(b.s)}">${b.s}</td>
|
|
528
528
|
<td>${il(b.d)}</td>
|
|
529
529
|
<td><div class="bar-wrap"><div class="${v}" style="width:${C}%"></div></div></td>
|
|
530
530
|
<td class="${b.p?"pass":"fail"}">${b.p?"\u2713":"\u2717"}</td>
|
|
531
|
-
</tr>`},d=this.renderGroupedTimeline(r,e,c),p=b=>{let
|
|
531
|
+
</tr>`},d=this.renderGroupedTimeline(r,e,c),p=b=>{let q=`${b.i}-${b.it}`,C=n.get(q),v=jo[b.m]??"GET",_=`req-${b.i}-${b.it}`,E=b.p,k=E?"#1f6feb40":"#f8514940",O=C?.assertions?.length?`<ul class="assert-list">${C.assertions.map(Ct=>`
|
|
532
532
|
<li class="${Ct.passed?"pass":"fail"}">
|
|
533
533
|
<span class="assert-icon">${Ct.passed?"\u2713":"\u2717"}</span>
|
|
534
534
|
${$t(Ct.name)}
|
|
@@ -584,7 +584,7 @@ ${d.join(`
|
|
|
584
584
|
${Q}
|
|
585
585
|
</div>`,mt=me.length<=ke.length,Nt=mt?_e:"",pe=mt?"":_e,Gt=C?.consoleOutput?.length?`<div class="console-block"><pre class="code console-code">${C.consoleOutput.map(Ct=>$t(typeof Ct=="string"?Ct:JSON.stringify(Ct))).join(`
|
|
586
586
|
`)}</pre></div>`:"",Pr=C?.error?`<div class="error-box">\u26A0 ${$t(C.error)}</div>`:"",lt=C?`<span class="${ky(C.status)} status-badge">${C.status} ${$t(C.statusText??"")}</span>`:"",kr=`<span class="dur-badge">${il(b.d)}</span>`,vr=e.config.iterations>1?`<span class="iter-badge">iter ${b.it}</span>`:"";return`
|
|
587
|
-
<details class="req-detail ${
|
|
587
|
+
<details class="req-detail ${E?"req-pass":"req-fail"}" id="${_}" style="--border:${k}">
|
|
588
588
|
<summary class="req-summary">
|
|
589
589
|
<span class="toggle-icon">\u25B6</span>
|
|
590
590
|
<span class="req-index dim">#${b.i}</span>
|
|
@@ -593,7 +593,7 @@ ${d.join(`
|
|
|
593
593
|
${lt}
|
|
594
594
|
${kr}
|
|
595
595
|
${vr}
|
|
596
|
-
<span class="req-outcome ${
|
|
596
|
+
<span class="req-outcome ${E?"pass":"fail"}">${E?"\u2713":"\u2717"}</span>
|
|
597
597
|
</summary>
|
|
598
598
|
<div class="req-body">
|
|
599
599
|
${Pr}
|
|
@@ -913,11 +913,11 @@ ${d.join(`
|
|
|
913
913
|
<div id="tab-failures" class="tab-content">
|
|
914
914
|
<p class="dim" style="margin-bottom:12px">Jump to failing request details:</p>
|
|
915
915
|
<ul style="list-style:none;display:flex;flex-direction:column;gap:6px">
|
|
916
|
-
${r.filter(b=>!b.p).map(b=>{let
|
|
916
|
+
${r.filter(b=>!b.p).map(b=>{let q=jo[b.m]??"GET";return`<li>
|
|
917
917
|
<a href="#req-${b.i}-${b.it}" onclick="jumpToRequest('req-${b.i}-${b.it}')"
|
|
918
918
|
style="display:flex;align-items:center;gap:8px;background:#1c0f12;
|
|
919
919
|
border:1px solid #f8514940;border-radius:6px;padding:8px 12px">
|
|
920
|
-
<span class="method method-${
|
|
920
|
+
<span class="method method-${q.toLowerCase()}">${q}</span>
|
|
921
921
|
<strong>${$t(b.n)}</strong>
|
|
922
922
|
<span class="status-badge ${ky(b.s)}">${b.s}</span>
|
|
923
923
|
<span class="dur-badge">${il(b.d)}</span>
|
|
@@ -1015,10 +1015,10 @@ ${d.join(`
|
|
|
1015
1015
|
</html>`}}});import*as nr from"fs/promises";import*as cn from"path";function sl(t,e){if(t.length===0)return 0;let r=Math.ceil(e/100*t.length)-1;return t[Math.max(0,Math.min(r,t.length-1))]}var fc,vx=ae(()=>{"use strict";jn();od();yx();up();fc=class{constructor(e){this.configService=e;let r=e.getRunnerConfig();this.basePath=e.getResultsPath(),this.indexPageSize=r.indexPageSize,this.recentErrorsLimit=r.recentErrorsLimit}configService;basePath;currentRunPath=null;currentRunId=null;currentSuiteId=null;currentManifest=null;currentIndexPage=[];currentPageNumber=1;indexPageSize;recentErrors=[];recentErrorsLimit;resultIndex=0;requestDurations={};getBasePath(){return this.basePath}async initializeRun(e,r,n,i){let s=this.generateRunId();return this.currentRunId=s,this.currentSuiteId=e,this.currentRunPath=cn.join(this.basePath,e,s),await nr.mkdir(cn.join(this.currentRunPath,"results"),{recursive:!0}),await nr.mkdir(cn.join(this.currentRunPath,"index"),{recursive:!0}),this.currentManifest={version:"1.0",runId:s,suiteId:e,suiteName:r,environment:n,startTime:new Date().toISOString(),status:"running",config:i,stats:{totalRequests:0,passed:0,failed:0,skipped:0,totalDuration:0,avgDuration:0,minDuration:Number.MAX_SAFE_INTEGER,maxDuration:0},requestStats:{},totalIndexPages:0,indexPageSize:this.indexPageSize},this.currentIndexPage=[],this.currentPageNumber=1,this.recentErrors=[],this.resultIndex=0,this.requestDurations={},await this.saveManifest(),s}async saveResult(e,r){if(!this.currentRunPath||!this.currentManifest)throw new Error("No active run. Call initializeRun first.");this.resultIndex++;let n=Date.now(),i=String(e).padStart(4,"0"),s=String(this.resultIndex).padStart(6,"0"),o=Vt(r.requestId),l=`result-${s}-iter-${i}-${o}.json`,c=cn.join(this.currentRunPath,"results",l),d={index:this.resultIndex,iteration:e,requestId:r.requestId,name:r.name,method:r.executedRequest.method,url:r.executedRequest.url,folderPath:r.folderPath||"",collectionName:r.collectionName||"",status:r.response.status,statusText:r.response.statusText||"",duration:r.duration,passed:r.passed,timestamp:n,request:{method:r.executedRequest.method,url:r.executedRequest.url,headers:r.executedRequest.headers,query:r.executedRequest.query,params:r.executedRequest.params,body:r.executedRequest.body},response:{headers:r.response.headers,body:r.response.body,time:r.response.time,size:r.response.size,cookies:r.response.cookies},assertions:r.assertions.map(b=>({name:b.name,passed:b.passed,message:b.message||null})),error:r.error||null,consoleOutput:r.consoleOutput,modifiedVariables:r.modifiedVariables,modifiedEnvironmentVariables:r.modifiedEnvironmentVariables,modifiedCollectionVariables:r.modifiedCollectionVariables,nextRequest:r.nextRequest??null,visualizerData:r.visualizerData};await nr.writeFile(c,JSON.stringify(q0(d),null,2),"utf-8");let p=r.assertions.filter(b=>b.passed).length,m=r.assertions.filter(b=>!b.passed).length,y={i:this.resultIndex,it:e,n:r.name,m:dx[r.executedRequest.method.toUpperCase()]??0,s:r.response.status,d:r.duration,p:r.passed,ap:p,af:m,r:r.requestId,e:r.passed?null:r.error||null,fp:r.folderPath||"",cn:r.collectionName||""};return this.currentIndexPage.push(y),this.currentIndexPage.length>=this.indexPageSize&&await this.writeCurrentIndexPage(),this.updateStats(r),this.requestDurations[r.requestId]||(this.requestDurations[r.requestId]=[]),this.requestDurations[r.requestId].push(r.duration),r.passed||(this.recentErrors.unshift({timestamp:n,iteration:e,requestName:r.name,status:r.response.status,error:r.error||`Status ${r.response.status}`,resultFile:l}),this.recentErrors.length>this.recentErrorsLimit&&this.recentErrors.pop()),y}async finalizeRun(e="completed",r=!0){if(!this.currentManifest)return null;this.currentIndexPage.length>0&&await this.writeCurrentIndexPage(),this.currentManifest.endTime=new Date().toISOString(),this.currentManifest.status=e,this.currentManifest.totalIndexPages=this.currentPageNumber-1,this.currentManifest.stats.totalRequests>0&&(this.currentManifest.stats.avgDuration=Math.round(this.currentManifest.stats.totalDuration/this.currentManifest.stats.totalRequests)),this.currentManifest.stats.minDuration===Number.MAX_SAFE_INTEGER&&(this.currentManifest.stats.minDuration=0);for(let c in this.currentManifest.requestStats){let d=this.currentManifest.requestStats[c],p=this.requestDurations[c]||[];d.count>0&&(d.avgDuration=Math.round(d.totalDuration/d.count)),d.minDuration===Number.MAX_SAFE_INTEGER&&(d.minDuration=0),p.length>0&&(p.sort((m,y)=>m-y),d.p50=sl(p,50),d.p90=sl(p,90),d.p95=sl(p,95),d.p99=sl(p,99))}let n=Object.values(this.requestDurations).flat();n.length>0&&(n.sort((c,d)=>c-d),this.currentManifest.stats.p50=sl(n,50),this.currentManifest.stats.p95=sl(n,95),this.currentManifest.stats.p99=sl(n,99)),this.requestDurations={},await this.saveManifest();let i=null,s=this.currentRunPath,o=this.currentSuiteId,l=this.currentRunId;if(this.currentRunPath=null,this.currentRunId=null,this.currentSuiteId=null,this.currentManifest=null,this.currentIndexPage=[],this.recentErrors=[],this.resultIndex=0,r&&o&&l&&s)try{i=await new cp(this.basePath).generate(o,l)}catch(c){console.warn("[ResultStorage] HTML report generation failed:",c)}return i}getCurrentStats(){return this.currentManifest?{stats:{...this.currentManifest.stats},requestStats:{...this.currentManifest.requestStats},recentErrors:[...this.recentErrors]}:null}getCurrentRunId(){return this.currentRunId}getCurrentSuiteId(){return this.currentSuiteId}async getResultDetails(e,r,n){let i=cn.join(this.basePath,e,r,"results",n),s=await nr.readFile(i,"utf-8");return JSON.parse(s)}async getIndexPage(e,r,n){let i=cn.join(this.basePath,e,r,"index",`page-${String(n).padStart(4,"0")}.json`),s=await nr.readFile(i,"utf-8");return JSON.parse(s)}async getManifest(e,r){let n=cn.join(this.basePath,e,r,"manifest.json"),i=await nr.readFile(n,"utf-8");return JSON.parse(i)}async listRuns(e){let r=cn.join(this.basePath,e);try{let n=await nr.readdir(r),i=[];for(let s of n.sort().reverse())try{let o=await this.getManifest(e,s);i.push(o)}catch{}return i}catch{return[]}}async listSuites(){try{return(await nr.readdir(this.basePath,{withFileTypes:!0})).filter(r=>r.isDirectory()).map(r=>r.name)}catch{return[]}}async deleteRun(e,r){let n=cn.join(this.basePath,e,r);await nr.rm(n,{recursive:!0,force:!0})}async cleanupOldRuns(){let r=this.configService.getRunnerConfig().resultsRetentionDays;if(r===0)return{deleted:0,freed:0};let n=new Date;n.setDate(n.getDate()-r);let i=0,s=0,o=await this.listSuites();for(let l of o){let c=await this.listRuns(l);for(let d of c)if(new Date(d.startTime)<n){let p=cn.join(this.basePath,l,d.runId),m=await this.getDirectorySize(p);await nr.rm(p,{recursive:!0,force:!0}),i++,s+=m}}return{deleted:i,freed:s}}generateRunId(){let e=new Date,r=e.toISOString().slice(0,10).replace(/-/g,""),n=e.toTimeString().slice(0,8).replace(/:/g,""),i=String(e.getMilliseconds()).padStart(3,"0");return`run-${r}-${n}-${i}`}async saveManifest(){if(!this.currentRunPath||!this.currentManifest)return;let e=cn.join(this.currentRunPath,"manifest.json");await nr.writeFile(e,JSON.stringify(this.currentManifest,null,2),"utf-8")}async writeCurrentIndexPage(){if(!this.currentRunPath||this.currentIndexPage.length===0)return;let e=`page-${String(this.currentPageNumber).padStart(4,"0")}.json`,r=cn.join(this.currentRunPath,"index",e),n={page:this.currentPageNumber,startIndex:(this.currentPageNumber-1)*this.indexPageSize+1,count:this.currentIndexPage.length,summaries:this.currentIndexPage};await nr.writeFile(r,JSON.stringify(n),"utf-8"),this.currentPageNumber++,this.currentIndexPage=[]}updateStats(e){if(!this.currentManifest)return;let r=this.currentManifest.stats,n=this.currentManifest.requestStats;r.totalRequests++,r.totalDuration+=e.duration,r.minDuration=Math.min(r.minDuration,e.duration),r.maxDuration=Math.max(r.maxDuration,e.duration),e.passed?r.passed++:r.failed++,n[e.requestId]||(n[e.requestId]={name:e.name,count:0,passed:0,failed:0,totalDuration:0,avgDuration:0,minDuration:Number.MAX_SAFE_INTEGER,maxDuration:0});let i=n[e.requestId];i.count++,i.totalDuration+=e.duration,i.minDuration=Math.min(i.minDuration,e.duration),i.maxDuration=Math.max(i.maxDuration,e.duration),e.passed?i.passed++:i.failed++}async getDirectorySize(e){let r=0;try{let n=await nr.readdir(e,{withFileTypes:!0});for(let i of n){let s=cn.join(e,i.name);if(i.isDirectory())r+=await this.getDirectorySize(s);else{let o=await nr.stat(s);r+=o.size}}}catch{}return r}}});function fp(t){return typeof t=="string"?t:""+JSON.stringify(t)}function dc(t){if(typeof t=="string"&&t.charCodeAt(0)===30)try{return JSON.parse(t.slice(1))}catch{return t}return t}function bx(t){if(!t)return{};let e={};for(let[r,n]of Object.entries(t))e[r]=dc(n);return e}var Sx=ae(()=>{"use strict"});import*as es from"fs";import*as dp from"path";var wx,Ay,Ty,$y,aN=ae(()=>{"use strict";wx=class{watchers=[];constructor(e,r){let n=this.globToPath(e,r);try{let i=es.watch(n,{recursive:!0},(s,o)=>{if(o){let l=dp.join(n,o);this.notifyChange(l)}});this.watchers.push(i)}catch{}}globToPath(e,r){return r.includes("**")?e:dp.join(e,r.replace(/\*/g,""))}notifyChange(e){}onDidChange(e){return{dispose:()=>{}}}onDidCreate(e){return{dispose:()=>{}}}onDidDelete(e){return{dispose:()=>{}}}dispose(){for(let e of this.watchers)e.close();this.watchers=[]}},Ay=class{createFileWatcher(e,r){return new wx(e,r)}},Ty=class{data={};storeFile;constructor(e){this.storeFile=e,this.load()}load(){try{if(es.existsSync(this.storeFile)){let e=es.readFileSync(this.storeFile,"utf-8");this.data=JSON.parse(e)}}catch{}}save(){try{let e=dp.dirname(this.storeFile);es.mkdirSync(e,{recursive:!0}),es.writeFileSync(this.storeFile,JSON.stringify(this.data,null,2),"utf-8")}catch{}}get(e,r){let n=this.data[e];return n!==void 0?n:r}async update(e,r){r===void 0?delete this.data[e]:this.data[e]=r,this.save()}},$y=class{async showInformation(e){console.log(`[INFO] ${e}`)}async showWarning(e){console.warn(`[WARN] ${e}`)}async showError(e){console.error(`[ERROR] ${e}`)}}});import*as ol from"path";function lN(t){let e=ol.resolve(t.workspaceFolder),{appInfo:r}=t,n=rl.createFresh(),i=ol.join(e,".http-forge",".cache","stores","global-state.json"),s=t.globalStorePath?ol.isAbsolute(t.globalStorePath)?t.globalStorePath:ol.resolve(e,t.globalStorePath):i,o={workspaceFolder:e,fileWatcherFactory:new Ay,notificationService:new $y,globalStore:new Ty(s),applicationInfo:r||{name:"http-forge-cli",version:"0.1.0"},persistOverrides:!1};return _y(n,o),n}function Yn(t){return lN({workspaceFolder:t})}var Ny=ae(()=>{"use strict";DC();jC();aN()});function O5(t){let e=[];return t.map(r=>{let n=Ln(r,e);return e.push(n),n})}function uN(t,e,r,n){let i=t.find(d=>d.id===e);if(i)return{item:i,tier:"id"};let s=O5(t.map(d=>d.name)),o=t.filter((d,p)=>s[p]===e);if(o.length===1)return{item:o[0],tier:"slug"};if(o.length>1)throw new al(r,e,o.map(d=>({id:d.id,name:d.name,path:n(d)})));let l=e.toLowerCase(),c=t.filter(d=>d.name.toLowerCase()===l);if(c.length===1)return{item:c[0],tier:"name"};throw c.length>1?new al(r,e,c.map(d=>({id:d.id,name:d.name,path:n(d)}))):new Error(`${r.charAt(0).toUpperCase()}${r.slice(1)} "${e}" not found`)}function _x(t,e){let{item:r,tier:n}=uN(t,e,"collection",()=>"");return{collection:r,tier:n}}function Rx(t,e){let r=e.split("/").map(o=>o.trim()).filter(o=>o.length>0),n=t.items,i=[],s=[];for(let o of r){let l=n.filter(m=>m.type==="folder"),c=i.join("/"),{item:d,tier:p}=uN(l,o,"folder",m=>c?`${c}/${m.name}`:m.name);i.push(d.name),s.push(p),n=d.items??[]}return{folderPath:i.map(Ir).join("/"),tiers:s}}function cN(t,e,r){let n=[];for(let i of t)if(i.type==="request"){let s=Ln(i.name,n);n.push(s),r.push({item:i,folderPath:e,slug:s})}for(let i of t)if(i.type==="folder"){let s=i,o=e?`${e}/${Ir(s.name)}`:Ir(s.name);cN(s.items??[],o,r)}}function Cx(t,e,r){let n=[];cN(t.items,"",n);let i=r?r.replace(/\/+$/,""):void 0,s=i?n.filter(y=>y.folderPath===i||y.folderPath.startsWith(`${i}/`)):n,o=y=>y.folderPath?`${y.folderPath}/${y.item.name}`:y.item.name,l=s.find(y=>y.item.id===e);if(l)return{request:l.item,tier:"id",folderPath:l.folderPath};let c=s.filter(y=>y.slug===e);if(c.length===1)return{request:c[0].item,tier:"slug",folderPath:c[0].folderPath};if(c.length>1)throw new al("request",e,c.map(y=>({id:y.item.id,name:y.item.name,path:o(y)})));let d=e.toLowerCase(),p=s.filter(y=>y.item.name.toLowerCase()===d);if(p.length===1)return{request:p[0].item,tier:"name",folderPath:p[0].folderPath};if(p.length>1)throw new al("request",e,p.map(y=>({id:y.item.id,name:y.item.name,path:o(y)})));let m=i?` under folder "${i}"`:"";throw new Error(`Request "${e}" not found in collection "${t.name}"${m}`)}var al,xx=ae(()=>{"use strict";ma();Ei();al=class extends Error{constructor(r,n,i){super(`Ambiguous ${r} reference "${n}" matches ${i.length} items:
|
|
1016
1016
|
`+i.map(s=>` - ${s.name} (id: ${s.id}, path: ${s.path||"/"})`).join(`
|
|
1017
1017
|
`)+`
|
|
1018
|
-
Disambiguate by passing the id or slug.`);this.kind=r;this.value=n;this.candidates=i;this.name="AmbiguousRefError"}kind;value;candidates}});var hp={};io(hp,{runCollection:()=>Ns,runFolder:()=>$5,runRequest:()=>Fy,runSuite:()=>pp});function qx(t){let e=[t.testSuite,t.collection,t.environmentConfig,t.config,t.console];for(let r of e)try{r?.dispose?.()}catch{}}function dN(t){return t==="1"||t==="true"||t==="yes"||t==="on"}function I5(){return dN(process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS)}function P5(){let t=process.env.HTTP_FORGE_MAX_REQUESTS;if(!t||t.trim()==="")return 50;let e=Number(t);if(!Number.isFinite(e)||e<=0)throw new Error("HTTP_FORGE_MAX_REQUESTS must be a positive number when provided");return Math.floor(e)}function pN(t,e=[]){return dN(process.env.HTTP_FORGE_GENERATE_REPORTS)||e.includes("html")?!0:t.includes("report")}function Ex(t){if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}}function k5(t){return t?Object.fromEntries(Object.entries(t).filter(([e])=>e.toLowerCase()!=="set-cookie")):{}}function hN(t){return Wi(k5(t))}function mN(t){return R0((t??[]).map(e=>({name:e.name,value:e.value})))}function fN(t){return t.replace(/[^a-zA-Z0-9_-]/g,"_")}function gN(t){let e=["none","inherit","basic","bearer","apikey","oauth2"],r=t.auth?.type&&e.includes(t.auth.type)?t.auth.type:void 0;return{id:t.id,name:t.name,method:t.method,url:t.url,headers:Array.isArray(t.headers)?t.headers.reduce((n,i)=>(i.enabled&&i.key&&(n[i.key]=i.value??""),n),{}):t.headers,query:Array.isArray(t.query)?t.query.reduce((n,i)=>(i.enabled&&i.key&&(n[i.key]=i.value??""),n),{}):t.query,params:t.params?Object.entries(t.params).reduce((n,[i,s])=>(n[i]=typeof s=="string"?s:s.value??"",n),{}):void 0,body:t.body??null,scripts:t.scripts,settings:t.settings,auth:{type:r==="inherit"?"none":r,bearerToken:t.auth?.bearerToken,basicAuth:t.auth?.basicAuth,apikey:t.auth?.apikey,oauth2:t.auth?.oauth2}}}function yN(t,e){let r={...t};return e.headers&&(r.headers={...t.headers??{},...e.headers}),e.query&&(r.query=e.query),e.body!==void 0&&(r.body={type:"raw",raw:e.body,contentType:"application/json"}),r}function My(t){return t?Object.fromEntries(Object.entries(t).map(([e,r])=>[e,String(r)])):{}}function vN(t,e,r){if(t&&t.type&&t.type!=="inherit")return t.type==="none"?void 0:t;for(let n=e.length-1;n>=0;n--){let i=e[n];if(i?.type&&i.type!=="inherit")return i.type==="none"?void 0:i}if(r&&r.type&&r.type!=="inherit")return r.type==="none"?void 0:r}function Ox(t,e,r=t.items,n=[],i=[]){for(let s of r){if(s.type==="request"&&s.id===e)return{request:s,folderScriptsChain:[...n],folderAuthChain:[...i]};if(s.type==="folder"){let o=s,l=o.scripts?[...n,o.scripts]:[...n],c=o.auth?[...i,o.auth]:[...i],d=Ox(t,e,o.items??[],l,c);if(d)return d}}}function bN(t,e=t.items,r=[],n=[]){let i=[];for(let s of e)if(s.type==="request")i.push({request:s,folderScriptsChain:[...r],folderPath:n.map(Ir).join("/")});else{let o=s,l=o.scripts?[...r,o.scripts]:[...r],c=[...n,o.name];i.push(...bN(t,o.items??[],l,c))}return i}function A5(t,e,r=!0){if(!e)return t;let n=e.replace(/\/+$/,"");return t.filter(({folderPath:i})=>r?i===n||i.startsWith(`${n}/`):i===n)}function T5(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function SN(t,e){if(e.collectionId){let r=t.getCollection(e.collectionId);if(!r)throw new Error(`Collection "${e.collectionId}" not found`);return r}if(e.collectionRef){let{collection:r,tier:n}=_x(t.getAllCollections(),e.collectionRef);return e.onResolve?.({kind:"collection",value:e.collectionRef,tier:n,id:r.id}),r}throw new Error("A collection reference is required (collectionId or collectionRef)")}function wN(t,e){if(e.folderPath)return e.folderPath;if(e.folderRef){let{folderPath:r}=Rx(t,e.folderRef);return e.onResolve?.({kind:"folder",value:e.folderRef,tier:"name",id:r,path:r}),r}}async function _N(t,e,r,n){let i=r.environment??t.environmentConfig.getSelectedEnvironment(),s=r.iterations??e.config?.iterations??1,o=r.stopOnError??e.config?.stopOnError??!1,l=r.delay??e.config?.delayBetweenRequests??0,c=Math.max(1,Math.min(50,r.concurrency??1)),d=r.requestFilter,p=r.include??[],m=r.reporters??[],y=m.includes("junit"),b=My(r.variables),
|
|
1019
|
-
`)}function k(te){if(!(!te||typeof te!="object")){if(te.script!==void 0)return te.script;if(typeof te.scriptRef=="string"&&te.scriptRef.trim()){let ne=e?.scripts;if(ne&&typeof ne=="object")return ne[te.scriptRef]}}}function O(te){return te?.name||te?.label||te?.id||"flow-node"}function M(te,ne){let Ie=t.environmentConfig.getResolvedEnvironment(i),ye=bx(_.vars),Ae={variables:{get:ge=>dc(_.vars[ge]),set:(ge,qn)=>{typeof ge=="string"&&ge.trim()&&(_.vars[ge]=fp(qn))},unset:ge=>{typeof ge=="string"&&ge.trim()&&delete _.vars[ge]},has:ge=>Object.prototype.hasOwnProperty.call(_.vars,ge),toObject:()=>({...ye})},environment:{get:ge=>dc(Ie?.variables?.[ge]),set:(ge,qn)=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.setEnvironmentVariable(ge,fp(qn),i)},unset:ge=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.deleteEnvironmentVariable(ge,i)},clear:()=>{t.environmentConfig.clearEnvironmentVariables(i)}},globals:{get:ge=>dc(t.environmentConfig.getGlobalVariables()?.[ge]),set:(ge,qn)=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.setGlobalVariable(ge,fp(qn))},unset:ge=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.deleteGlobalVariable(ge)},clear:()=>{t.environmentConfig.clearGlobalVariables()}}};return{vars:ye,lastResult:_.lastResult,iteration:ne,node:te,pm:Ae,ctx:Ae,hf:Ae}}function j(te,ne,Ie){return typeof te!="string"||!te.trim()?!0:!!Ui(te,M(ne,Ie))}function I(te){if(!te)return{};let ne={};for(let[Ie,ye]of Object.entries(te))ne[Ie]=Array.isArray(ye)?ye.join("; "):String(ye);return ne}function R(te){return{executedRequest:te.executedRequest,status:te.response?.status??0,statusText:te.response?.statusText??"",headers:I(te.response?.headers),body:te.response?.body,cookies:te.response?.cookies,responseTime:te.duration,responseSize:typeof te.response?.body=="string"?Buffer.byteLength(te.response.body,"utf8"):0}}async function A(te,ne,Ie,ye,ve){let Ye=q(te);if(!Ye||!Ye.trim())return;let ur=t.environmentConfig.getResolvedEnvironment(i),Ae=t.environmentConfig.getGlobalVariables(),qn={request:{url:ve?.request?.url??_.lastResult?.executedRequest?.url??"http://flow.local/node",method:ve?.request?.method??_.lastResult?.executedRequest?.method??"GET",headers:I(ve?.request?.headers),body:ve?.request?.body??null,params:ve?.request?.params??{},query:ve?.request?.query??{}},variables:My(_.vars),environmentVariables:ur?.variables||{},globals:{...Ae},environmentName:i,info:{eventName:ye==="post"?"test":"prerequest",requestName:O(ne),requestId:String(ne?.id??O(ne)),collectionName:e.name,iteration:Ie,iterationCount:s},onEnvironmentChange:(gt,Ee,On)=>{gt==="set"&&Ee&&On!==void 0?t.environmentConfig.setEnvironmentVariable(Ee,On,i):gt==="unset"&&Ee?t.environmentConfig.deleteEnvironmentVariable(Ee,i):gt==="clear"&&t.environmentConfig.clearEnvironmentVariables(i)},onGlobalsChange:(gt,Ee,On)=>{gt==="set"&&Ee&&On!==void 0?t.environmentConfig.setGlobalVariable(Ee,On):gt==="unset"&&Ee?t.environmentConfig.deleteGlobalVariable(Ee):gt==="clear"&&t.environmentConfig.clearGlobalVariables()}},fn=t.scriptExecutor.createRequestSession(qn);try{if(ye==="post"&&ve?.response){let gt=await fn.executePostResponse(Ye,ve.response),Ee=gt.localVariables??gt.modifiedVariables;Ee&&typeof Ee=="object"&&Object.assign(_.vars,Ee)}else{let gt=await fn.executePreRequest(Ye);if(!gt.success)throw new Error(gt.error||"Script execution failed");let Ee=gt.localVariables??gt.modifiedVariables;Ee&&typeof Ee=="object"&&Object.assign(_.vars,Ee)}}catch(gt){let Ee=gt instanceof Error?gt.message:String(gt);throw new Error(`Suite ${ye}-script failed on node "${O(ne)}": ${Ee}`)}finally{fn.dispose?.()}}function F(te){let ne=te?.type==="request"&&te?.request?te.request:te;if(!(!ne||typeof ne!="object")&&!(!ne.collectionId||!ne.requestId||!ne.name))return{collectionId:ne.collectionId,requestId:ne.requestId,name:ne.name,folderPath:ne.folderPath,enabled:ne.enabled}}function U(te){return!te||typeof te!="object"?!1:te.type==="request"?!!F(te):!!(te.collectionId&&te.requestId&&te.name)}function D(te,ne){for(let Ie of ne){let ye=te?.[Ie];if(Array.isArray(ye))return ye}return[]}async function J(te,ne){if(lt.signal.aborted||ne.enabled===!1||d&&!d.some(ge=>ne.name.toLowerCase().includes(ge.toLowerCase())))return;let Ie=t.collection.getCollection(ne.collectionId);if(!Ie)return;let ye=Ox(Ie,ne.requestId);if(!ye)return;let ve=vN(ye.request.auth,ye.folderAuthChain,Ie.auth),Ye=new bo(t.httpRequest,t.scriptExecutor,t.environmentConfig,t.requestPreparer,i,kr,Ie.scripts,ye.folderScriptsChain,void 0,Ie.name,Ie.auth,te,s),ur=yN(gN({...ye.request,auth:ve}),{headers:r.headers,query:r.query,body:r.body,variables:{..._.vars,...r.variables}}),Ae=await Ye.execute(ur,My(_.vars),lt.signal);_.lastResult=Ae,Ae.modifiedVariables&&typeof Ae.modifiedVariables=="object"&&Object.assign(_.vars,Ae.modifiedVariables),Ae.folderPath=ne.folderPath??"",Ae.collectionName=Ie.name,await me.saveResult(te,Ae),Ae.assertions?.length||Pr.add(ne.name),Ae.passed?pe++:Gt++,p.includes("perRequest")&&mt.push({name:ne.name,iteration:te,status:Ae.response?.status,ok:(Ae.response?.status??0)>=200&&(Ae.response?.status??0)<300,duration:`${Ae.duration}ms`,allPassed:Ae.passed,...p.includes("consoleOutput")&&Ae.consoleOutput?.length?{consoleOutput:Ae.consoleOutput}:{}}),Ae.passed||(Nt.push({name:ne.name,iteration:te,method:Ae.executedRequest?.method,url:Ae.executedRequest?.url,requestBody:Ex(Ae.executedRequest?.body?.content)??Ae.executedRequest?.body?.content??null,requestHeaders:Wi(Ae.executedRequest?.headers??{}),status:Ae.response?.status,duration:`${Ae.duration}ms`,body:Ex(Ae.response?.body),headers:hN(Ae.response?.headers),cookies:mN(Ae.response?.cookies),failedTests:Ae.assertions?.filter(ge=>!ge.passed).map(ge=>({name:ge.name,...ge.message?{message:ge.message}:{}})),...Ae.error?{error:Ae.error}:{},...p.includes("consoleOutput")&&Ae.consoleOutput?.length?{consoleOutput:Ae.consoleOutput}:{}}),o&<.abort()),l>0&&!lt.signal.aborted&&await new Promise(ge=>setTimeout(ge,l))}async function Q(te,ne){for(let Ie of ne){if(lt.signal.aborted)break;await se(te,Ie)}}async function se(te,ne){if(!ne||typeof ne!="object"||ne.enabled===!1||!j(ne.condition,ne,te))return;if(U(ne)){let ve=F(ne);ve&&await J(te,ve);return}let Ie=typeof ne.type=="string"?ne.type.toLowerCase():"",ye=D(ne,["then","nodes","body"]);if(Ie==="block"){await Q(te,ye);return}if(Ie==="script"){let ve=k(ne),Ye=ne.phase==="post"?"post":"pre";await A(ve,ne,te,Ye);return}if(Ie==="if"){let ve=typeof ne.if=="string"?ne.if:ne.condition;if(j(ve,ne,te)){await Q(te,ye);return}if(Array.isArray(ne.elseif)){for(let Ye of ne.elseif)if(j(Ye?.condition,Ye,te)){await Q(te,D(Ye,["then","nodes","body"]));return}}await Q(te,D(ne,["else","elseNodes"]));return}if(Ie==="switch"){let ve=Ui(String(ne.expression??""),M(ne,te));if(Array.isArray(ne.cases)){for(let Ye of ne.cases)if(Object.prototype.hasOwnProperty.call(Ye??{},"equals")?Ye.equals===ve:j(Ye?.condition,Ye,te)){await Q(te,D(Ye,["then","nodes","body"]));return}}await Q(te,D(ne,["default","defaultNodes"]));return}if(Ie==="while"){let ve=typeof ne.while=="string"?ne.while:ne.condition,Ye=Math.max(1,Math.min(1e4,Number(ne.maxIterations??v))),ur=0;for(;j(ve,ne,te);){if(ur+=1,ur>Ye)throw new Error(`Suite while loop exceeded maxIterations (${Ye}) on node "${O(ne)}"`);if(await Q(te,ye),lt.signal.aborted)break}return}if(Ie==="for"){let ve=Math.max(1,Math.min(1e4,Number(ne.maxIterations??v))),Ye=q(ne.init),ur=q(ne.update),Ae=typeof ne.loopCondition=="string"&&ne.loopCondition.trim()?ne.loopCondition:typeof ne.condition=="string"&&ne.condition.trim()?ne.condition:"true";Ye&&await A(Ye,ne,te,"pre");let ge=0;for(;j(Ae,ne,te);){if(ge+=1,ge>ve)throw new Error(`Suite for loop exceeded maxIterations (${ve}) on node "${O(ne)}"`);if(await Q(te,ye),lt.signal.aborted)break;ur&&await A(ur,ne,te,"post")}return}ye.length>0&&await Q(te,ye)}function ce(te){let ne=0,Ie=[...te];for(;Ie.length>0;){let ye=Ie.pop();if(!(!ye||typeof ye!="object"||ye.enabled===!1)){if(U(ye)){let ve=F(ye);ve&&(!d||d.some(Ye=>ve.name.toLowerCase().includes(Ye.toLowerCase())))&&(ne+=1);continue}for(let ve of["nodes","then","body","else","elseNodes","default","defaultNodes"])Array.isArray(ye[ve])&&Ie.push(...ye[ve]);if(Array.isArray(ye.elseif))for(let ve of ye.elseif)Array.isArray(ve?.nodes)&&Ie.push(...ve.nodes),Array.isArray(ve?.then)&&Ie.push(...ve.then);if(Array.isArray(ye.cases))for(let ve of ye.cases)Array.isArray(ve?.nodes)&&Ie.push(...ve.nodes),Array.isArray(ve?.then)&&Ie.push(...ve.then)}}return ne}let Be=Array.isArray(e.nodes)?e.nodes:Array.isArray(e.requests)?e.requests.map(te=>({type:"request",request:te})):[],_e=ce(Be);if(E){let te=P5(),ne=_e*s;if(ne>te)throw new Error(`Suite "${e.name}" would execute ${ne} request calls (${_e} requests \xD7 ${s} iterations), which exceeds HTTP_FORGE_MAX_REQUESTS (${te}). Reduce iterations, use requestFilter, or increase HTTP_FORGE_MAX_REQUESTS.`)}let me=new fc(t.config),ke=await me.initializeRun(e.id,e.name,i,{iterations:s,delayBetweenRequests:l,stopOnError:o}),mt=[],Nt=[],pe=0,Gt=0,Pr=new Set,lt=new AbortController,kr=new ic;async function vr(te){await Q(te,Be)}for(let te=1;te<=s&&!lt.signal.aborted;te+=c){let ne=Math.min(te+c-1,s),Ie=Array.from({length:ne-te+1},(ye,ve)=>te+ve);await Promise.all(Ie.map(vr))}let Ct=await me.finalizeRun("completed",C),St=null;if(y)try{St=await new lc(me.getBasePath()).generate(e.id,ke)}catch(te){console.warn("[direct-execution] JUnit report generation failed:",te)}let Wr=n==="collection"?"collection":"suite",At=me.getCurrentStats()?.stats,Pi=At?{min:At.minDuration,max:At.maxDuration,avg:At.avgDuration,p50:At.p50??null,p95:At.p95??null,p99:At.p99??null}:null,En={[Wr]:e.name,environment:i,summary:{total:pe+Gt,passed:pe,failed:Gt,...s>1?{iterations:s}:{},...c>1?{concurrency:c}:{},allPassed:Gt===0,...Pi?{durationMs:Pi}:{}}};if((Gt>0||p.includes("failedOnly"))&&(En.failedRequests=Nt),p.includes("perRequest")&&(En.results=mt),Ct!==null&&(En.report={uri:`file://${Ct}`,hint:"Click the URI to open the HTML report in your browser"}),St!==null&&(En.junitReport={path:St}),Pr.size>0){let te=Math.max(_e,1),ne=Pr.size,Ie=Array.from(Pr).slice(0,5);En.noAssertionExamples=Ie;let ye=e.name;if(ne/te>.5)En._suggestions=[`${ne}/${te} requests have no pm.test() assertions. Invoke the "review-collection" prompt (collection="${ye}") for a full coverage analysis and to identify assertion gaps.`];else{let ve=Ie.map(Ye=>`"${Ye}"`).join(", ");En._suggestions=[`${ne} request(s) have no pm.test() assertions: ${ve}. Invoke the "suggest-assertions" prompt (collection="${ye}") to generate test coverage for them.`]}}return En}async function Fy(t){let e=Yn(t.workspaceFolder),r=t.include??[],n=t.reporters??[],i=n.includes("junit"),s=pN(r,n);try{let o=e.collection,l=SN(o,t),c=wN(l,t),d=t.requestId;if(!d){if(!t.requestRef)throw new Error("A request reference is required (requestId or requestRef)");let O=Cx(l,t.requestRef,c);d=O.request.id,t.onResolve?.({kind:"request",value:t.requestRef,tier:O.tier,id:d,path:O.folderPath?`${O.folderPath}/${O.request.name}`:O.request.name})}let p=Ox(l,d);if(!p)throw new Error(`Request "${d}" not found in collection "${l.name}"`);let m=vN(p.request.auth,p.folderAuthChain,l.auth),y=t.environment||e.environmentConfig.getSelectedEnvironment(),b=yN(gN({...p.request,auth:m}),{headers:t.headers,query:t.query,body:t.body,variables:t.variables}),C=await new bo(e.httpRequest,e.scriptExecutor,e.environmentConfig,e.requestPreparer,y,new ic,l.scripts,p.folderScriptsChain,void 0,l.name,l.auth).execute(b,My(t.variables)),v=null,_=null;if(s||i){let O=new fc(e.config),M=`request-${fN(l.id)}-${fN(d)}`,j=`Request: ${p.request.name}`,I=await O.initializeRun(M,j,y,{iterations:1,delayBetweenRequests:0,stopOnError:!0});if(await O.saveResult(1,C),v=await O.finalizeRun("completed",s),i)try{_=await new lc(O.getBasePath()).generate(M,I)}catch(R){console.warn("[direct-execution] JUnit report generation failed:",R)}}let q=hN(C.response?.headers),k=mN(C.response?.cookies);return{request:p.request.name,status:C.response?.status||0,ok:(C.response?.status??0)>=200&&(C.response?.status??0)<300,duration:`${C.duration}ms`,body:Ex(C.response?.body),allPassed:C.passed,assertions:C.assertions?.map(O=>({name:O.name,passed:O.passed,message:O.message})),...r.includes("headers")?{headers:q}:{},...r.includes("cookies")?{cookies:k}:{},...r.includes("tests")?{tests:C.assertions?.map(O=>({name:O.name,passed:O.passed,...O.message?{message:O.message}:{}}))}:{},...Object.keys(C.modifiedVariables??{}).length?{modifiedVariables:C.modifiedVariables}:{},...r.includes("consoleOutput")&&C.consoleOutput?.length?{consoleOutput:C.consoleOutput}:{},...v!==null?{report:{uri:`file://${v}`,hint:"Click the URI to open the HTML report in your browser"}}:{},..._!==null?{junitReport:{path:_}}:{},...C.error?{error:C.error}:{}}}catch(o){throw o}finally{qx(e)}}async function Ns(t){let e=Yn(t.workspaceFolder);try{let r=e.collection,n=SN(r,t),i=wN(n,t),s=bN(n),o=A5(s,i,t.recursive);if(o.length===0&&i)throw new Error(`No requests found under folder "${i}" in collection "${n.name}"`);let l=o.map(({request:d,folderPath:p})=>({id:d.id,slug:d.id.toLowerCase().replace(/\s+/g,"-"),collectionId:n.id,requestId:d.id,name:d.name,method:d.method,collectionName:n.name,folderPath:p,enabled:!0})),c={id:i?`temp-${n.id}-${T5(i)}`:`temp-${n.id}`,name:i?`${n.name} / ${i}`:n.name,requests:l,config:{iterations:1,delay:0,stopOnError:t.stopOnError??!1,readFromSharedSession:!1,writeToSharedSession:!1},isTemporary:!0,createdAt:Date.now(),updatedAt:Date.now()};return _N(e,c,{environment:t.environment,iterations:t.iterations,stopOnError:t.stopOnError,delay:t.delay,requestFilter:void 0,include:t.include,reporters:t.reporters,concurrency:t.concurrency,variables:t.variables},"collection")}catch(r){throw r}finally{qx(e)}}async function $5(t){return Ns({recursive:!0,...t})}async function pp(t){let e=Yn(t.workspaceFolder);try{let n=await e.testSuite.getSuite(t.suiteId);if(!n)throw new Error(`Test suite "${t.suiteId}" not found`);return _N(e,n,{environment:t.environment,iterations:t.iterations,stopOnError:t.stopOnError,delay:t.delay,requestFilter:t.requestFilter,include:t.include,reporters:t.reporters,concurrency:t.concurrency,variables:t.variables},"suite")}catch(r){throw r}finally{qx(e)}}var pc=ae(()=>{"use strict";fx();Tm();od();hx();vx();sf();Sx();Ei();Ny();xx()});var EN={};io(EN,{createMcpRuntime:()=>Y5});import*as xN from"fs";import{createServer as N5}from"http";import*as Lo from"path";async function Oi(t){let e=process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS,r=process.env.HTTP_FORGE_GENERATE_REPORTS;process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS="true",process.env.HTTP_FORGE_GENERATE_REPORTS="true";try{return await t()}finally{e===void 0?delete process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS:process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS=e,r===void 0?delete process.env.HTTP_FORGE_GENERATE_REPORTS:process.env.HTTP_FORGE_GENERATE_REPORTS=r}}function hc(t){let e=[t.testSuite,t.collection,t.environmentConfig,t.config,t.console];for(let r of e)try{r?.dispose?.()}catch{}}async function D5(t,e){let r=kx.get(t);if(r&&r.expiresAt>Date.now())return r.tools;let n=Ix.get(t);if(n)return n;let i=(async()=>{let s=e.config.getMcpConfig(),o=(d,p)=>!!d?.length&&(d.includes(p.id)||d.includes(p.name)),l=e.collection.getAllCollections().filter(d=>!o(s.excludedCollections,d)),c=(await e.testSuite.getAllSuites()).filter(d=>!o(s.excludedSuites,d));return ux(l,c,s)})().then(s=>(kx.set(t,{tools:s,expiresAt:Date.now()+F5}),s)).finally(()=>Ix.delete(t));return Ix.set(t,i),i}function j5(t,e){let r=t.config.getMcpConfig().toolPrefix??"";return r&&e.startsWith(r)?e.slice(r.length):e}function L5(t,e,r){return t.replace(/"uri"\s*:\s*"file:\/\/([^"]+)"/g,(n,i)=>`"uri":"http://${e}:${r}/report?path=${encodeURIComponent(i)}"`)}function RN(t,e,r,n){ll(t,200,{jsonrpc:"2.0",id:e,error:{code:r,message:n}})}function U5(t){return t.config.getMcpConfig().toolPageSize??200}async function H5(t,e){switch(e.method){case"initialize":return{protocolVersion:"2024-11-05",capabilities:{tools:{},prompts:{}},serverInfo:{name:"http-forge",version:"1.0.0"},instructions:"You are assisting with HTTP API testing via HTTP Forge. When a run_suite, run_collection, or run_folder call completes with failures (summary.failed > 0 or allPassed === false), automatically analyze the 'failedRequests' in the response and provide: (1) root cause for each failure, (2) specific fix recommendations, (3) updated pm.test() assertion scripts where relevant. Do not wait for the user to ask \u2014 proactively diagnose and suggest fixes. For async runs (status: 'running'), poll with get_run_status until complete, then call get_run_summary. When get_run_summary returns a _nextStep field you MUST execute it immediately \u2014 the failedRequests array is already included inline so no extra tool call is needed. Analyze the failures and provide diagnosis without waiting for the user."};case"tools/list":{let r=await D5(t.workspaceFolder,t.container),n=e.params??{},i=typeof n.cursor=="string"?n.cursor:void 0,s=U5(t.container);if(s<=0||r.length<=s)return{tools:r};let o=lx(i),l=r.slice(o,o+s),c=o+s,d={tools:l};return c<r.length&&(d.nextCursor=ax(c)),d}case"tools/call":{let r=e.params??{},n=r.name,i=r.arguments;if(!n)throw new Error("Missing tool name");let s=await Ax(t,n,i??{}),o=s,l=o?.summary;l&&((l.failed??0)>0||l.allPassed===!1)&&(o._nextStep=`${l.failed??"Some"} request(s) failed. Please analyze the 'failedRequests' above: identify the root cause of each failure, suggest specific fixes (URL, auth, body, environment variables), and provide updated pm.test() assertion scripts where the assertions are incorrect.`);let c=JSON.stringify(s,null,2),d=L5(c,t.host,t.port),p=d.match(/"uri"\s*:\s*"(http:\/\/[^"]+\/report\?[^"]+)"/),m=p?`
|
|
1018
|
+
Disambiguate by passing the id or slug.`);this.kind=r;this.value=n;this.candidates=i;this.name="AmbiguousRefError"}kind;value;candidates}});var hp={};io(hp,{runCollection:()=>Ns,runFolder:()=>$5,runRequest:()=>Fy,runSuite:()=>pp});function qx(t){let e=[t.testSuite,t.collection,t.environmentConfig,t.config,t.console];for(let r of e)try{r?.dispose?.()}catch{}}function dN(t){return t==="1"||t==="true"||t==="yes"||t==="on"}function I5(){return dN(process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS)}function P5(){let t=process.env.HTTP_FORGE_MAX_REQUESTS;if(!t||t.trim()==="")return 50;let e=Number(t);if(!Number.isFinite(e)||e<=0)throw new Error("HTTP_FORGE_MAX_REQUESTS must be a positive number when provided");return Math.floor(e)}function pN(t,e=[]){return dN(process.env.HTTP_FORGE_GENERATE_REPORTS)||e.includes("html")?!0:t.includes("report")}function Ex(t){if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}}function k5(t){return t?Object.fromEntries(Object.entries(t).filter(([e])=>e.toLowerCase()!=="set-cookie")):{}}function hN(t){return Wi(k5(t))}function mN(t){return R0((t??[]).map(e=>({name:e.name,value:e.value})))}function fN(t){return t.replace(/[^a-zA-Z0-9_-]/g,"_")}function gN(t){let e=["none","inherit","basic","bearer","apikey","oauth2"],r=t.auth?.type&&e.includes(t.auth.type)?t.auth.type:void 0;return{id:t.id,name:t.name,method:t.method,url:t.url,headers:Array.isArray(t.headers)?t.headers.reduce((n,i)=>(i.enabled&&i.key&&(n[i.key]=i.value??""),n),{}):t.headers,query:Array.isArray(t.query)?t.query.reduce((n,i)=>(i.enabled&&i.key&&(n[i.key]=i.value??""),n),{}):t.query,params:t.params?Object.entries(t.params).reduce((n,[i,s])=>(n[i]=typeof s=="string"?s:s.value??"",n),{}):void 0,body:t.body??null,scripts:t.scripts,settings:t.settings,auth:{type:r==="inherit"?"none":r,bearerToken:t.auth?.bearerToken,basicAuth:t.auth?.basicAuth,apikey:t.auth?.apikey,oauth2:t.auth?.oauth2}}}function yN(t,e){let r={...t};return e.headers&&(r.headers={...t.headers??{},...e.headers}),e.query&&(r.query=e.query),e.body!==void 0&&(r.body={type:"raw",raw:e.body,contentType:"application/json"}),r}function My(t){return t?Object.fromEntries(Object.entries(t).map(([e,r])=>[e,String(r)])):{}}function vN(t,e,r){if(t&&t.type&&t.type!=="inherit")return t.type==="none"?void 0:t;for(let n=e.length-1;n>=0;n--){let i=e[n];if(i?.type&&i.type!=="inherit")return i.type==="none"?void 0:i}if(r&&r.type&&r.type!=="inherit")return r.type==="none"?void 0:r}function Ox(t,e,r=t.items,n=[],i=[]){for(let s of r){if(s.type==="request"&&s.id===e)return{request:s,folderScriptsChain:[...n],folderAuthChain:[...i]};if(s.type==="folder"){let o=s,l=o.scripts?[...n,o.scripts]:[...n],c=o.auth?[...i,o.auth]:[...i],d=Ox(t,e,o.items??[],l,c);if(d)return d}}}function bN(t,e=t.items,r=[],n=[]){let i=[];for(let s of e)if(s.type==="request")i.push({request:s,folderScriptsChain:[...r],folderPath:n.map(Ir).join("/")});else{let o=s,l=o.scripts?[...r,o.scripts]:[...r],c=[...n,o.name];i.push(...bN(t,o.items??[],l,c))}return i}function A5(t,e,r=!0){if(!e)return t;let n=e.replace(/\/+$/,"");return t.filter(({folderPath:i})=>r?i===n||i.startsWith(`${n}/`):i===n)}function T5(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function SN(t,e){if(e.collectionId){let r=t.getCollection(e.collectionId);if(!r)throw new Error(`Collection "${e.collectionId}" not found`);return r}if(e.collectionRef){let{collection:r,tier:n}=_x(t.getAllCollections(),e.collectionRef);return e.onResolve?.({kind:"collection",value:e.collectionRef,tier:n,id:r.id}),r}throw new Error("A collection reference is required (collectionId or collectionRef)")}function wN(t,e){if(e.folderPath)return e.folderPath;if(e.folderRef){let{folderPath:r}=Rx(t,e.folderRef);return e.onResolve?.({kind:"folder",value:e.folderRef,tier:"name",id:r,path:r}),r}}async function _N(t,e,r,n){let i=r.environment??t.environmentConfig.getSelectedEnvironment(),s=r.iterations??e.config?.iterations??1,o=r.stopOnError??e.config?.stopOnError??!1,l=r.delay??e.config?.delayBetweenRequests??0,c=Math.max(1,Math.min(50,r.concurrency??1)),d=r.requestFilter,p=r.include??[],m=r.reporters??[],y=m.includes("junit"),b=My(r.variables),q=I5(),C=pN(p,m),v=Math.max(1,Math.min(1e4,Number(r.maxNodeLoopIterations??100))),_={vars:{...b}};function E(te){if(typeof te=="string")return te;if(Array.isArray(te))return te.filter(Ie=>typeof Ie=="string").join(`
|
|
1019
|
+
`)}function k(te){if(!(!te||typeof te!="object")){if(te.script!==void 0)return te.script;if(typeof te.scriptRef=="string"&&te.scriptRef.trim()){let ne=e?.scripts;if(ne&&typeof ne=="object")return ne[te.scriptRef]}}}function O(te){return te?.name||te?.label||te?.id||"flow-node"}function M(te,ne){let Ie=t.environmentConfig.getResolvedEnvironment(i),ye=bx(_.vars),Ae={variables:{get:ge=>dc(_.vars[ge]),set:(ge,qn)=>{typeof ge=="string"&&ge.trim()&&(_.vars[ge]=fp(qn))},unset:ge=>{typeof ge=="string"&&ge.trim()&&delete _.vars[ge]},has:ge=>Object.prototype.hasOwnProperty.call(_.vars,ge),toObject:()=>({...ye})},environment:{get:ge=>dc(Ie?.variables?.[ge]),set:(ge,qn)=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.setEnvironmentVariable(ge,fp(qn),i)},unset:ge=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.deleteEnvironmentVariable(ge,i)},clear:()=>{t.environmentConfig.clearEnvironmentVariables(i)}},globals:{get:ge=>dc(t.environmentConfig.getGlobalVariables()?.[ge]),set:(ge,qn)=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.setGlobalVariable(ge,fp(qn))},unset:ge=>{typeof ge=="string"&&ge.trim()&&t.environmentConfig.deleteGlobalVariable(ge)},clear:()=>{t.environmentConfig.clearGlobalVariables()}}};return{vars:ye,lastResult:_.lastResult,iteration:ne,node:te,pm:Ae,ctx:Ae,hf:Ae}}function j(te,ne,Ie){return typeof te!="string"||!te.trim()?!0:!!Ui(te,M(ne,Ie))}function I(te){if(!te)return{};let ne={};for(let[Ie,ye]of Object.entries(te))ne[Ie]=Array.isArray(ye)?ye.join("; "):String(ye);return ne}function R(te){return{executedRequest:te.executedRequest,status:te.response?.status??0,statusText:te.response?.statusText??"",headers:I(te.response?.headers),body:te.response?.body,cookies:te.response?.cookies,responseTime:te.duration,responseSize:typeof te.response?.body=="string"?Buffer.byteLength(te.response.body,"utf8"):0}}async function A(te,ne,Ie,ye,ve){let Ye=E(te);if(!Ye||!Ye.trim())return;let ur=t.environmentConfig.getResolvedEnvironment(i),Ae=t.environmentConfig.getGlobalVariables(),qn={request:{url:ve?.request?.url??_.lastResult?.executedRequest?.url??"http://flow.local/node",method:ve?.request?.method??_.lastResult?.executedRequest?.method??"GET",headers:I(ve?.request?.headers),body:ve?.request?.body??null,params:ve?.request?.params??{},query:ve?.request?.query??{}},variables:My(_.vars),environmentVariables:ur?.variables||{},globals:{...Ae},environmentName:i,info:{eventName:ye==="post"?"test":"prerequest",requestName:O(ne),requestId:String(ne?.id??O(ne)),collectionName:e.name,iteration:Ie,iterationCount:s},onEnvironmentChange:(gt,Ee,On)=>{gt==="set"&&Ee&&On!==void 0?t.environmentConfig.setEnvironmentVariable(Ee,On,i):gt==="unset"&&Ee?t.environmentConfig.deleteEnvironmentVariable(Ee,i):gt==="clear"&&t.environmentConfig.clearEnvironmentVariables(i)},onGlobalsChange:(gt,Ee,On)=>{gt==="set"&&Ee&&On!==void 0?t.environmentConfig.setGlobalVariable(Ee,On):gt==="unset"&&Ee?t.environmentConfig.deleteGlobalVariable(Ee):gt==="clear"&&t.environmentConfig.clearGlobalVariables()}},fn=t.scriptExecutor.createRequestSession(qn);try{if(ye==="post"&&ve?.response){let gt=await fn.executePostResponse(Ye,ve.response),Ee=gt.localVariables??gt.modifiedVariables;Ee&&typeof Ee=="object"&&(_.vars={...Ee})}else{let gt=await fn.executePreRequest(Ye);if(!gt.success)throw new Error(gt.error||"Script execution failed");let Ee=gt.localVariables??gt.modifiedVariables;Ee&&typeof Ee=="object"&&(_.vars={...Ee})}}catch(gt){let Ee=gt instanceof Error?gt.message:String(gt);throw new Error(`Suite ${ye}-script failed on node "${O(ne)}": ${Ee}`)}finally{fn.dispose?.()}}function F(te){let ne=te?.type==="request"&&te?.request?te.request:te;if(!(!ne||typeof ne!="object")&&!(!ne.collectionId||!ne.requestId||!ne.name))return{collectionId:ne.collectionId,requestId:ne.requestId,name:ne.name,folderPath:ne.folderPath,enabled:ne.enabled}}function U(te){return!te||typeof te!="object"?!1:te.type==="request"?!!F(te):!!(te.collectionId&&te.requestId&&te.name)}function D(te,ne){for(let Ie of ne){let ye=te?.[Ie];if(Array.isArray(ye))return ye}return[]}async function J(te,ne){if(lt.signal.aborted||ne.enabled===!1||d&&!d.some(ge=>ne.name.toLowerCase().includes(ge.toLowerCase())))return;let Ie=t.collection.getCollection(ne.collectionId);if(!Ie)return;let ye=Ox(Ie,ne.requestId);if(!ye)return;let ve=vN(ye.request.auth,ye.folderAuthChain,Ie.auth),Ye=new bo(t.httpRequest,t.scriptExecutor,t.environmentConfig,t.requestPreparer,i,kr,Ie.scripts,ye.folderScriptsChain,void 0,Ie.name,Ie.auth,te,s),ur=yN(gN({...ye.request,auth:ve}),{headers:r.headers,query:r.query,body:r.body,variables:{..._.vars,...r.variables}}),Ae=await Ye.execute(ur,My(_.vars),lt.signal);_.lastResult=Ae,Ae.modifiedVariables&&typeof Ae.modifiedVariables=="object"&&(_.vars={...Ae.modifiedVariables}),Ae.folderPath=ne.folderPath??"",Ae.collectionName=Ie.name,await me.saveResult(te,Ae),Ae.assertions?.length||Pr.add(ne.name),Ae.passed?pe++:Gt++,p.includes("perRequest")&&mt.push({name:ne.name,iteration:te,status:Ae.response?.status,ok:(Ae.response?.status??0)>=200&&(Ae.response?.status??0)<300,duration:`${Ae.duration}ms`,allPassed:Ae.passed,...p.includes("consoleOutput")&&Ae.consoleOutput?.length?{consoleOutput:Ae.consoleOutput}:{}}),Ae.passed||(Nt.push({name:ne.name,iteration:te,method:Ae.executedRequest?.method,url:Ae.executedRequest?.url,requestBody:Ex(Ae.executedRequest?.body?.content)??Ae.executedRequest?.body?.content??null,requestHeaders:Wi(Ae.executedRequest?.headers??{}),status:Ae.response?.status,duration:`${Ae.duration}ms`,body:Ex(Ae.response?.body),headers:hN(Ae.response?.headers),cookies:mN(Ae.response?.cookies),failedTests:Ae.assertions?.filter(ge=>!ge.passed).map(ge=>({name:ge.name,...ge.message?{message:ge.message}:{}})),...Ae.error?{error:Ae.error}:{},...p.includes("consoleOutput")&&Ae.consoleOutput?.length?{consoleOutput:Ae.consoleOutput}:{}}),o&<.abort()),l>0&&!lt.signal.aborted&&await new Promise(ge=>setTimeout(ge,l))}async function Q(te,ne){for(let Ie of ne){if(lt.signal.aborted)break;await se(te,Ie)}}async function se(te,ne){if(!ne||typeof ne!="object"||ne.enabled===!1||!j(ne.condition,ne,te))return;if(U(ne)){let ve=F(ne);ve&&await J(te,ve);return}let Ie=typeof ne.type=="string"?ne.type.toLowerCase():"",ye=D(ne,["then","nodes","body"]);if(Ie==="block"){await Q(te,ye);return}if(Ie==="script"){let ve=k(ne),Ye=ne.phase==="post"?"post":"pre";await A(ve,ne,te,Ye);return}if(Ie==="if"){let ve=typeof ne.if=="string"?ne.if:ne.condition;if(j(ve,ne,te)){await Q(te,ye);return}if(Array.isArray(ne.elseif)){for(let Ye of ne.elseif)if(j(Ye?.condition,Ye,te)){await Q(te,D(Ye,["then","nodes","body"]));return}}await Q(te,D(ne,["else","elseNodes"]));return}if(Ie==="switch"){let ve=Ui(String(ne.expression??""),M(ne,te));if(Array.isArray(ne.cases)){for(let Ye of ne.cases)if(Object.prototype.hasOwnProperty.call(Ye??{},"equals")?Ye.equals===ve:j(Ye?.condition,Ye,te)){await Q(te,D(Ye,["then","nodes","body"]));return}}await Q(te,D(ne,["default","defaultNodes"]));return}if(Ie==="while"){let ve=typeof ne.while=="string"?ne.while:ne.condition,Ye=Math.max(1,Math.min(1e4,Number(ne.maxIterations??v))),ur=0;for(;j(ve,ne,te);){if(ur+=1,ur>Ye)throw new Error(`Suite while loop exceeded maxIterations (${Ye}) on node "${O(ne)}"`);if(await Q(te,ye),lt.signal.aborted)break}return}if(Ie==="for"){let ve=Math.max(1,Math.min(1e4,Number(ne.maxIterations??v))),Ye=E(ne.init),ur=E(ne.update),Ae=typeof ne.loopCondition=="string"&&ne.loopCondition.trim()?ne.loopCondition:typeof ne.condition=="string"&&ne.condition.trim()?ne.condition:"true";Ye&&await A(Ye,ne,te,"pre");let ge=0;for(;j(Ae,ne,te);){if(ge+=1,ge>ve)throw new Error(`Suite for loop exceeded maxIterations (${ve}) on node "${O(ne)}"`);if(await Q(te,ye),lt.signal.aborted)break;ur&&await A(ur,ne,te,"post")}return}ye.length>0&&await Q(te,ye)}function ce(te){let ne=0,Ie=[...te];for(;Ie.length>0;){let ye=Ie.pop();if(!(!ye||typeof ye!="object"||ye.enabled===!1)){if(U(ye)){let ve=F(ye);ve&&(!d||d.some(Ye=>ve.name.toLowerCase().includes(Ye.toLowerCase())))&&(ne+=1);continue}for(let ve of["nodes","then","body","else","elseNodes","default","defaultNodes"])Array.isArray(ye[ve])&&Ie.push(...ye[ve]);if(Array.isArray(ye.elseif))for(let ve of ye.elseif)Array.isArray(ve?.nodes)&&Ie.push(...ve.nodes),Array.isArray(ve?.then)&&Ie.push(...ve.then);if(Array.isArray(ye.cases))for(let ve of ye.cases)Array.isArray(ve?.nodes)&&Ie.push(...ve.nodes),Array.isArray(ve?.then)&&Ie.push(...ve.then)}}return ne}let Be=Array.isArray(e.nodes)?e.nodes:Array.isArray(e.requests)?e.requests.map(te=>({type:"request",request:te})):[],_e=ce(Be);if(q){let te=P5(),ne=_e*s;if(ne>te)throw new Error(`Suite "${e.name}" would execute ${ne} request calls (${_e} requests \xD7 ${s} iterations), which exceeds HTTP_FORGE_MAX_REQUESTS (${te}). Reduce iterations, use requestFilter, or increase HTTP_FORGE_MAX_REQUESTS.`)}let me=new fc(t.config),ke=await me.initializeRun(e.id,e.name,i,{iterations:s,delayBetweenRequests:l,stopOnError:o}),mt=[],Nt=[],pe=0,Gt=0,Pr=new Set,lt=new AbortController,kr=new ic;async function vr(te){await Q(te,Be)}for(let te=1;te<=s&&!lt.signal.aborted;te+=c){let ne=Math.min(te+c-1,s),Ie=Array.from({length:ne-te+1},(ye,ve)=>te+ve);await Promise.all(Ie.map(vr))}let Ct=await me.finalizeRun("completed",C),St=null;if(y)try{St=await new lc(me.getBasePath()).generate(e.id,ke)}catch(te){console.warn("[direct-execution] JUnit report generation failed:",te)}let Wr=n==="collection"?"collection":"suite",At=me.getCurrentStats()?.stats,Pi=At?{min:At.minDuration,max:At.maxDuration,avg:At.avgDuration,p50:At.p50??null,p95:At.p95??null,p99:At.p99??null}:null,En={[Wr]:e.name,environment:i,summary:{total:pe+Gt,passed:pe,failed:Gt,...s>1?{iterations:s}:{},...c>1?{concurrency:c}:{},allPassed:Gt===0,...Pi?{durationMs:Pi}:{}}};if((Gt>0||p.includes("failedOnly"))&&(En.failedRequests=Nt),p.includes("perRequest")&&(En.results=mt),Ct!==null&&(En.report={uri:`file://${Ct}`,hint:"Click the URI to open the HTML report in your browser"}),St!==null&&(En.junitReport={path:St}),Pr.size>0){let te=Math.max(_e,1),ne=Pr.size,Ie=Array.from(Pr).slice(0,5);En.noAssertionExamples=Ie;let ye=e.name;if(ne/te>.5)En._suggestions=[`${ne}/${te} requests have no pm.test() assertions. Invoke the "review-collection" prompt (collection="${ye}") for a full coverage analysis and to identify assertion gaps.`];else{let ve=Ie.map(Ye=>`"${Ye}"`).join(", ");En._suggestions=[`${ne} request(s) have no pm.test() assertions: ${ve}. Invoke the "suggest-assertions" prompt (collection="${ye}") to generate test coverage for them.`]}}return En}async function Fy(t){let e=Yn(t.workspaceFolder),r=t.include??[],n=t.reporters??[],i=n.includes("junit"),s=pN(r,n);try{let o=e.collection,l=SN(o,t),c=wN(l,t),d=t.requestId;if(!d){if(!t.requestRef)throw new Error("A request reference is required (requestId or requestRef)");let O=Cx(l,t.requestRef,c);d=O.request.id,t.onResolve?.({kind:"request",value:t.requestRef,tier:O.tier,id:d,path:O.folderPath?`${O.folderPath}/${O.request.name}`:O.request.name})}let p=Ox(l,d);if(!p)throw new Error(`Request "${d}" not found in collection "${l.name}"`);let m=vN(p.request.auth,p.folderAuthChain,l.auth),y=t.environment||e.environmentConfig.getSelectedEnvironment(),b=yN(gN({...p.request,auth:m}),{headers:t.headers,query:t.query,body:t.body,variables:t.variables}),C=await new bo(e.httpRequest,e.scriptExecutor,e.environmentConfig,e.requestPreparer,y,new ic,l.scripts,p.folderScriptsChain,void 0,l.name,l.auth).execute(b,My(t.variables)),v=null,_=null;if(s||i){let O=new fc(e.config),M=`request-${fN(l.id)}-${fN(d)}`,j=`Request: ${p.request.name}`,I=await O.initializeRun(M,j,y,{iterations:1,delayBetweenRequests:0,stopOnError:!0});if(await O.saveResult(1,C),v=await O.finalizeRun("completed",s),i)try{_=await new lc(O.getBasePath()).generate(M,I)}catch(R){console.warn("[direct-execution] JUnit report generation failed:",R)}}let E=hN(C.response?.headers),k=mN(C.response?.cookies);return{request:p.request.name,status:C.response?.status||0,ok:(C.response?.status??0)>=200&&(C.response?.status??0)<300,duration:`${C.duration}ms`,body:Ex(C.response?.body),allPassed:C.passed,assertions:C.assertions?.map(O=>({name:O.name,passed:O.passed,message:O.message})),...r.includes("headers")?{headers:E}:{},...r.includes("cookies")?{cookies:k}:{},...r.includes("tests")?{tests:C.assertions?.map(O=>({name:O.name,passed:O.passed,...O.message?{message:O.message}:{}}))}:{},...Object.keys(C.modifiedVariables??{}).length?{modifiedVariables:C.modifiedVariables}:{},...r.includes("consoleOutput")&&C.consoleOutput?.length?{consoleOutput:C.consoleOutput}:{},...v!==null?{report:{uri:`file://${v}`,hint:"Click the URI to open the HTML report in your browser"}}:{},..._!==null?{junitReport:{path:_}}:{},...C.error?{error:C.error}:{}}}catch(o){throw o}finally{qx(e)}}async function Ns(t){let e=Yn(t.workspaceFolder);try{let r=e.collection,n=SN(r,t),i=wN(n,t),s=bN(n),o=A5(s,i,t.recursive);if(o.length===0&&i)throw new Error(`No requests found under folder "${i}" in collection "${n.name}"`);let l=o.map(({request:d,folderPath:p})=>({id:d.id,slug:d.id.toLowerCase().replace(/\s+/g,"-"),collectionId:n.id,requestId:d.id,name:d.name,method:d.method,collectionName:n.name,folderPath:p,enabled:!0})),c={id:i?`temp-${n.id}-${T5(i)}`:`temp-${n.id}`,name:i?`${n.name} / ${i}`:n.name,requests:l,config:{iterations:1,delay:0,stopOnError:t.stopOnError??!1,readFromSharedSession:!1,writeToSharedSession:!1},isTemporary:!0,createdAt:Date.now(),updatedAt:Date.now()};return _N(e,c,{environment:t.environment,iterations:t.iterations,stopOnError:t.stopOnError,delay:t.delay,requestFilter:void 0,include:t.include,reporters:t.reporters,concurrency:t.concurrency,variables:t.variables},"collection")}catch(r){throw r}finally{qx(e)}}async function $5(t){return Ns({recursive:!0,...t})}async function pp(t){let e=Yn(t.workspaceFolder);try{let n=await e.testSuite.getSuite(t.suiteId);if(!n)throw new Error(`Test suite "${t.suiteId}" not found`);return _N(e,n,{environment:t.environment,iterations:t.iterations,stopOnError:t.stopOnError,delay:t.delay,requestFilter:t.requestFilter,include:t.include,reporters:t.reporters,concurrency:t.concurrency,variables:t.variables},"suite")}catch(r){throw r}finally{qx(e)}}var pc=ae(()=>{"use strict";fx();Tm();od();hx();vx();sf();Sx();Ei();Ny();xx()});var EN={};io(EN,{createMcpRuntime:()=>Y5});import*as xN from"fs";import{createServer as N5}from"http";import*as Lo from"path";async function Oi(t){let e=process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS,r=process.env.HTTP_FORGE_GENERATE_REPORTS;process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS="true",process.env.HTTP_FORGE_GENERATE_REPORTS="true";try{return await t()}finally{e===void 0?delete process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS:process.env.HTTP_FORGE_ENFORCE_MAX_REQUESTS=e,r===void 0?delete process.env.HTTP_FORGE_GENERATE_REPORTS:process.env.HTTP_FORGE_GENERATE_REPORTS=r}}function hc(t){let e=[t.testSuite,t.collection,t.environmentConfig,t.config,t.console];for(let r of e)try{r?.dispose?.()}catch{}}async function D5(t,e){let r=kx.get(t);if(r&&r.expiresAt>Date.now())return r.tools;let n=Ix.get(t);if(n)return n;let i=(async()=>{let s=e.config.getMcpConfig(),o=(d,p)=>!!d?.length&&(d.includes(p.id)||d.includes(p.name)),l=e.collection.getAllCollections().filter(d=>!o(s.excludedCollections,d)),c=(await e.testSuite.getAllSuites()).filter(d=>!o(s.excludedSuites,d));return ux(l,c,s)})().then(s=>(kx.set(t,{tools:s,expiresAt:Date.now()+F5}),s)).finally(()=>Ix.delete(t));return Ix.set(t,i),i}function j5(t,e){let r=t.config.getMcpConfig().toolPrefix??"";return r&&e.startsWith(r)?e.slice(r.length):e}function L5(t,e,r){return t.replace(/"uri"\s*:\s*"file:\/\/([^"]+)"/g,(n,i)=>`"uri":"http://${e}:${r}/report?path=${encodeURIComponent(i)}"`)}function RN(t,e,r,n){ll(t,200,{jsonrpc:"2.0",id:e,error:{code:r,message:n}})}function U5(t){return t.config.getMcpConfig().toolPageSize??200}async function H5(t,e){switch(e.method){case"initialize":return{protocolVersion:"2024-11-05",capabilities:{tools:{},prompts:{}},serverInfo:{name:"http-forge",version:"1.0.0"},instructions:"You are assisting with HTTP API testing via HTTP Forge. When a run_suite, run_collection, or run_folder call completes with failures (summary.failed > 0 or allPassed === false), automatically analyze the 'failedRequests' in the response and provide: (1) root cause for each failure, (2) specific fix recommendations, (3) updated pm.test() assertion scripts where relevant. Do not wait for the user to ask \u2014 proactively diagnose and suggest fixes. For async runs (status: 'running'), poll with get_run_status until complete, then call get_run_summary. When get_run_summary returns a _nextStep field you MUST execute it immediately \u2014 the failedRequests array is already included inline so no extra tool call is needed. Analyze the failures and provide diagnosis without waiting for the user."};case"tools/list":{let r=await D5(t.workspaceFolder,t.container),n=e.params??{},i=typeof n.cursor=="string"?n.cursor:void 0,s=U5(t.container);if(s<=0||r.length<=s)return{tools:r};let o=lx(i),l=r.slice(o,o+s),c=o+s,d={tools:l};return c<r.length&&(d.nextCursor=ax(c)),d}case"tools/call":{let r=e.params??{},n=r.name,i=r.arguments;if(!n)throw new Error("Missing tool name");let s=await Ax(t,n,i??{}),o=s,l=o?.summary;l&&((l.failed??0)>0||l.allPassed===!1)&&(o._nextStep=`${l.failed??"Some"} request(s) failed. Please analyze the 'failedRequests' above: identify the root cause of each failure, suggest specific fixes (URL, auth, body, environment variables), and provide updated pm.test() assertion scripts where the assertions are incorrect.`);let c=JSON.stringify(s,null,2),d=L5(c,t.host,t.port),p=d.match(/"uri"\s*:\s*"(http:\/\/[^"]+\/report\?[^"]+)"/),m=p?`
|
|
1020
1020
|
|
|
1021
|
-
[View HTML Report](${p[1]})`:"";return{content:[{type:"text",text:d+m}]}}case"prompts/list":return{prompts:Oy};case"prompts/get":{let r=e.params??{},n=r.name,i=r.arguments??{};if(!n)throw new Error("Missing prompt name");let s=Yn(t.workspaceFolder);try{return await JC(n,i,s.collection,t.runStore)}finally{hc(s)}}default:throw new Error(`Method not found: ${e.method}`)}}function B5(t,e,r){let n=!t.container,i=t.container??Yn(t.workspaceFolder),s;try{s=i.config.getMcpConfig().cors.allowedOrigins??["http://localhost","http://127.0.0.1"]}finally{n&&hc(i)}let o=e.headers.origin??"",l=s.includes(o)?o:s[0]??"http://localhost";r.setHeader("Access-Control-Allow-Origin",l),r.setHeader("Access-Control-Allow-Methods","POST, GET, OPTIONS"),r.setHeader("Access-Control-Allow-Headers","Content-Type, Mcp-Session-Id")}function V5(t,e,r){let i=new URL(e.url,`http://${t.host}:${t.port}`).searchParams.get("path");if(!i){r.statusCode=400,r.end("Missing path parameter");return}let s=Lo.resolve(i),o=t.container?.config.getResultsPath(),l=o?Lo.dirname(o):Lo.resolve(t.workspaceFolder,".http-forge",".cache");if(!s.startsWith(l+Lo.sep)||!s.endsWith(".html")){r.statusCode=403,r.end("Forbidden");return}xN.readFile(s,"utf-8",(c,d)=>{if(c){r.statusCode=404,r.end("Report not found");return}r.statusCode=200,r.setHeader("content-type","text/html; charset=utf-8"),r.end(d)})}function Px(t,e,r,n){let i=t.create(e,r);return n().then(s=>{i.status!=="cancelled"&&(i.status="completed",i.completedAt=Date.now(),i.summary=s?.summary??i.summary,s?.failedRequests&&(i.failedRequests=s.failedRequests),s?.noAssertionExamples&&(i.noAssertionExamples=s.noAssertionExamples),i.reportPath=s?.report?.uri?.replace("file://","")??null,i.progress.completed=i.progress.total)}).catch(s=>{i.status!=="cancelled"&&(i.status="failed",i.completedAt=Date.now(),i.error=s.message)}),{runId:i.id,status:"running",total:r,message:"Run started. Use get_run_status to poll."}}function W5(t){let e=t.workspaceFolder;return{async runRequest(r,n,i){return Oi(()=>Fy({workspaceFolder:e,collectionId:r.id,requestId:n,environment:i.environment,variables:i.variables,headers:i.headers,query:i.query,body:i.body,include:i.include}))},async runFolder(r,n,i){let s=ot(r).filter(({folderPath:o})=>o===n||o.startsWith(`${n}/`)).length;return i.async===!0?Px(t.runStore,`${r.name} / ${Ts(n)}`,s,()=>Oi(()=>Ns({workspaceFolder:e,collectionId:r.id,folderPath:n,recursive:i.recursive,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,include:i.include}))):Oi(()=>Ns({workspaceFolder:e,collectionId:r.id,folderPath:n,recursive:i.recursive,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,include:i.include}))},async runCollection(r,n){let i=ot(r).length;return n.async===!0?Px(t.runStore,r.name,i,()=>Oi(()=>Ns({workspaceFolder:e,collectionId:r.id,environment:n.environment,variables:n.variables,iterations:n.iterations,stopOnError:n.stopOnError,delay:n.delay,include:n.include}))):Oi(()=>Ns({workspaceFolder:e,collectionId:r.id,environment:n.environment,variables:n.variables,iterations:n.iterations,stopOnError:n.stopOnError,delay:n.delay,include:n.include}))},async runSuite(r,n,i){let s=Yn(e),o=0;try{let l=await s.testSuite.getSuite(r);o=(l?.nodes.filter(d=>d.type==="request").length??0)*(i.iterations??l?.config?.iterations??1)}finally{hc(s)}return i.async===!0?Px(t.runStore,n,o,()=>Oi(()=>pp({workspaceFolder:e,suiteId:r,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,requestFilter:i.requestFilter,include:i.include}))):Oi(()=>pp({workspaceFolder:e,suiteId:r,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,requestFilter:i.requestFilter,include:i.include}))}}}async function Ax(t,e,r={}){let n=t.workspaceFolder,i=j5(t.container,e);if(Object.values(G).includes(i)){let l=Yn(n);try{let c=await WC(i,r,{collection:l.collection,testSuite:l.testSuite,environmentConfig:l.environmentConfig,workspaceFolder:n},t.runStore,W5(t));return z5.has(i)&&kx.delete(n),c}finally{hc(l)}}let s=ex(i),o=Yn(n);try{let l=o.collection.getAllCollections(),c=l.map(b=>b.id),d=b=>{let E=nc(b,c),C=E?l.find(v=>v.id===E):void 0;if(!C)throw new Error(`Collection not found for tool: ${e}`);return C};if(s.kind==="request"){let[b,E]=s.tokens;if(!b||!E)throw new Error(`Malformed request tool: ${e}`);let C=d(b),v=ot(C).map(q=>q.request.id),_=nc(E,v);if(!_)throw new Error(`Request not found in collection "${C.name}" for tool: ${e}`);return Oi(()=>Fy({workspaceFolder:n,collectionId:C.id,requestId:_,environment:r.environment,variables:r.variables,headers:r.headers,query:r.query,body:r.body,include:r.include}))}if(s.kind==="collection"){let[b]=s.tokens;if(!b)throw new Error(`Malformed collection tool: ${e}`);let E=d(b);return Oi(()=>Ns({workspaceFolder:n,collectionId:E.id,environment:r.environment,variables:r.variables,iterations:r.iterations,stopOnError:r.stopOnError,delay:r.delay,include:r.include}))}if(s.kind==="folder"){let[b,E]=s.tokens;if(!b||!E)throw new Error(`Malformed folder tool: ${e}`);let C=d(b),v=(o.collection.getAllCollections().find(k=>k.id===C.id),void 0),_=ot(C).map(k=>k.folderPath).filter((k,O,M)=>k&&M.indexOf(k)===O),q=tx(E,_);if(!q)throw new Error(`Folder not found in collection "${C.name}" for tool: ${e}`);return Oi(()=>Ns({workspaceFolder:n,collectionId:C.id,folderPath:q,recursive:r.recursive,environment:r.environment,variables:r.variables,iterations:r.iterations,stopOnError:r.stopOnError,delay:r.delay,include:r.include}))}let[p]=s.tokens;if(!p)throw new Error(`Malformed suite tool: ${e}`);let m=await o.testSuite.getAllSuites(),y=nc(p,m.map(b=>b.id));if(!y)throw new Error(`Test suite not found for tool: ${e}`);return Oi(()=>pp({workspaceFolder:n,suiteId:y,environment:r.environment,variables:r.variables,iterations:r.iterations,stopOnError:r.stopOnError,delay:r.delay,requestFilter:r.requestFilter,include:r.include}))}finally{hc(o)}}function ll(t,e,r){t.statusCode=e,t.setHeader("content-type","application/json; charset=utf-8"),t.end(JSON.stringify(r))}function CN(t){return new Promise((e,r)=>{let n="";t.on("data",i=>{n+=i,n.length>1024*1024&&r(new Error("Request body too large (max 1MB)"))}),t.on("end",()=>{if(!n){e({});return}try{e(JSON.parse(n))}catch{r(new Error("Invalid JSON body"))}}),t.on("error",r)})}function J5(t){return N5(async(e,r)=>{try{if(B5(t,e,r),e.method==="OPTIONS"){r.statusCode=204,r.end();return}if(e.method==="GET"&&e.url==="/health"){ll(r,200,{status:"ok",port:t.port});return}if(e.method==="GET"&&e.url?.startsWith("/report?")){V5(t,e,r);return}if(e.method==="POST"&&(e.url==="/"||e.url==="/mcp")){let n;try{n=await CN(e)}catch{RN(r,null,-32700,"Parse error");return}try{let i=await H5(t,n);ll(r,200,{jsonrpc:"2.0",id:n.id??null,result:i})}catch(i){RN(r,n.id??null,-32603,i.message||"Internal error")}return}if(e.method==="POST"&&e.url==="/tools/execute"){let n=await CN(e);if(!n||typeof n.name!="string"||n.name.trim()===""){ll(r,400,{error:'Field "name" is required'});return}let i=await Ax(t,n.name,n.args??{});ll(r,200,{result:i});return}ll(r,405,{error:"Method not allowed"})}catch(n){ll(r,500,{error:n.message})}})}function G5(t){if(typeof t.port=="number"&&Number.isFinite(t.port))return Math.min(65535,Math.max(1,Math.floor(t.port)));let r=new vo(Lo.resolve(t.workspaceFolder)).getMcpConfig().port;return Math.min(65535,Math.max(1,Math.floor(r||3100)))}async function Y5(t){let e=G5(t),r=t.host||"127.0.0.1",n=`${r}:${e}`,i={workspaceFolder:t.workspaceFolder,port:e,host:r,isRunning:!1,runStore:new lp};return M5.set(n,i),{async start(){if(i.isRunning)return;i.container||(i.container=Yn(i.workspaceFolder));let s=J5(i);await new Promise((o,l)=>{s.once("error",l),s.listen(i.port,i.host,()=>{s.off("error",l),o()})}),i.server=s,i.isRunning=!0},async stop(){if(i.container&&(hc(i.container),i.container=void 0),!i.server){i.isRunning=!1;return}await new Promise((s,o)=>{i.server.close(l=>{if(l){o(l);return}s()})}),i.server=void 0,i.isRunning=!1},isRunning(){return i.isRunning},getPort(){return i.port},async executeTool(s,o){return Ax(i,s,o??{})}}}var M5,F5,kx,Ix,z5,qN=ae(()=>{"use strict";km();pc();Ei();zC();GC();YC();cx();Py();sp();Ny();M5=new Map;F5=3e3,kx=new Map,Ix=new Map;z5=VC});var Zl=class{constructor(e,r){this.fileSystem=e;this.parserRegistry=r}fileSystem;parserRegistry;directory;setDirectory(e){this.directory=e}async loadAll(){return this.directory?this.loadDirectory(this.directory):[]}async load(e,r={}){let n=await this.fileSystem.readFile(e);if(r.format){let s=this.parserRegistry.get(r.format);if(!s)throw new Error(`No parser registered for format: ${r.format}`);return s.parse(n,e)}let i=this.parserRegistry.detect(n);if(!i)throw new Error(`Could not detect collection format for: ${e}. Supported formats: ${this.parserRegistry.getFormats().join(", ")}`);return i.parser.parse(n,e)}async loadDirectory(e,r=["*.json","*.forge.json"]){let n=[],i=await this.fileSystem.glob(r,e);for(let s of i)try{let o=await this.load(s);n.push(o)}catch{}return n}async canLoad(e){try{if(!await this.fileSystem.exists(e))return!1;let r=await this.fileSystem.readFile(e);return this.parserRegistry.detect(r)!==null}catch{return!1}}getSupportedFormats(){return this.parserRegistry.getFormats()}};Ph();ma();function oS(t,e){return{id:t.id,name:t.name,description:t.description,variables:t.variables||{},auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(dq),source:{format:"folder",filePath:e,version:t.version}}}function dq(t){if(t.type==="folder")return{type:"folder",id:t.id,name:t.name,description:t.description,auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(dq)};let e=t;return{type:"request",id:e.id,name:e.name,description:e.description,method:e.method||"GET",url:e.url||"",headers:e.headers||[],query:e.query||[],params:e.params,body:e.body??void 0,auth:e.auth,settings:e.settings,scripts:e.scripts,...e.deprecated&&{deprecated:e.deprecated},...e.doc&&{doc:e.doc},...e.responseSchema&&{responseSchema:e.responseSchema},...e.bodySchema&&{bodySchema:e.bodySchema},...e.operationId&&{operationId:e.operationId},...e.summary&&{summary:e.summary},...e.tags&&e.tags.length>0&&{tags:e.tags},...e.examples&&e.examples.length>0&&{examples:e.examples},...e.responses&&Object.keys(e.responses).length>0&&{responses:e.responses},...e.security&&e.security.length>0&&{security:e.security}}}function HL(t){return{id:t.id,name:t.name,description:t.description,version:t.source?.version,variables:t.variables,auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(aS)}}function aS(t){return t.type==="folder"?{type:"folder",id:t.id,name:t.name,description:t.description,auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(aS)}:{type:"request",id:t.id,name:t.name,description:t.description,method:t.method,url:t.url,headers:t.headers,query:t.query,params:t.params,body:t.body,auth:t.auth,settings:t.settings,scripts:t.scripts,...t.deprecated&&{deprecated:t.deprecated},...t.doc&&{doc:t.doc},...t.responseSchema&&{responseSchema:t.responseSchema},...t.bodySchema&&{bodySchema:t.bodySchema},...t.operationId&&{operationId:t.operationId},...t.summary&&{summary:t.summary},...t.tags&&{tags:t.tags},...t.examples&&{examples:t.examples},...t.responses&&{responses:t.responses},...t.security&&{security:t.security}}}var ef=class{store;constructor(e){this.store=new so(e)}loadAll(){return this.store.loadAll().map(r=>oS(r,this.store.getCollectionPath(r.id)))}getSlugById(e){return this.store.getSlugById(e)}getIdBySlug(e){return this.store.getIdBySlug(e)}load(e){let r=this.store.load(e);if(r)return oS(r,this.store.getCollectionPath(r.id))}async create(e,r){let n=await this.store.create(e,r);return oS(n,this.store.getCollectionPath(n.id))}async save(e){return this.store.save(HL(e))}async delete(e){return this.store.delete(e)}exists(e){return this.store.exists(e)}getCollectionPath(e){return this.store.getCollectionPath(e)}async updateCollectionMetadata(e,r){return this.store.updateCollectionMetadata(e,r)}async saveItem(e,r,n){return this.store.saveItem(e,aS(r),n)}async updateItem(e,r,n){let i={...n};return this.store.updateItem(e,r,i)}async deleteItem(e,r){return this.store.deleteItem(e,r)}async moveItem(e,r,n){return this.store.moveItem(e,r,n)}async reorderItems(e,r,n){return this.store.reorderItems(e,r,n)}async saveScripts(e,r,n){return this.store.saveScripts(e,r,n)}loadScripts(e,r){return this.store.loadScripts(e,r)}};var tf=class{parsers=new Map;register(e,r){this.parsers.set(e.toLowerCase(),r)}get(e){return this.parsers.get(e.toLowerCase())}has(e){return this.parsers.has(e.toLowerCase())}getFormats(){return Array.from(this.parsers.keys())}detect(e){for(let[r,n]of this.parsers)if(n.canParse(e))return{parser:n,format:r};return null}clear(){this.parsers.clear()}};ga();var rf=class{cookies=new Map;getCookieKey(e,r,n){return`${r||"*"}|${n||"/"}|${e}`}get(e,r){if(r){let s=this.getCookieKey(e,r),o=this.cookies.get(s);if(o&&!this.isExpired(o))return o}let n=this.getCookieKey(e,"*"),i=this.cookies.get(n);if(i&&!this.isExpired(i))return i;for(let s of this.cookies.values())if(s.name===e&&!this.isExpired(s))if(r&&s.domain){if(this.domainMatches(r,s.domain))return s}else return s}set(e){let r=this.getCookieKey(e.name,e.domain,e.path);this.cookies.set(r,e)}setFromResponse(e){for(let r of e){let n=this.getCookieKey(r.name,r.domain,r.path);this.cookies.set(n,r)}}has(e,r){return this.get(e,r)!==void 0}delete(e,r,n){let i=this.getCookieKey(e,r,n);return this.cookies.delete(i)}getAll(e){let r=[];for(let n of this.cookies.values())this.isExpired(n)||(e?(!n.domain||this.domainMatches(e,n.domain))&&r.push(n):r.push(n));return r}getCookieHeader(e){let r=this.getAll(e);return xt.formatCookieHeader(r)}clear(){this.cookies.clear()}clearDomain(e){let r=[];for(let[n,i]of this.cookies.entries())i.domain&&this.domainMatches(e,i.domain)&&r.push(n);for(let n of r)this.cookies.delete(n)}parseCookieHeaders(e,r){return xt.parseCookieHeaders(e,r)}isExpired(e){return xt.isExpired(e)}domainMatches(e,r){return xt.domainMatches(e,r)}get count(){return this.cookies.size}cleanExpiredCookies(){let e=[];for(let[r,n]of this.cookies.entries())this.isExpired(n)&&e.push(r);for(let r of e)this.cookies.delete(r)}};Th();var gs=class t{config;selectedEnvironment;sessionGlobals={};sessionEnvironmentValues=new Map;constructor(e){this.config=e,this.selectedEnvironment=e.selectedEnvironment||Object.keys(e.environments)[0]||"default"}get(e){return this.getVariables()[e]}set(e,r){let n=this.sessionEnvironmentValues.get(this.selectedEnvironment);n||(n={},this.sessionEnvironmentValues.set(this.selectedEnvironment,n)),n[e]=r}getAll(){return this.getVariables()}getEnvironments(){return Object.keys(this.config.environments)}getActive(){return this.selectedEnvironment}setActive(e){if(!this.config.environments[e])throw new Error(`Environment not found: ${e}`);this.selectedEnvironment=e}getVariables(e){let r=e||this.selectedEnvironment,n=this.config.environments[r],i={...this.config.globalVariables||{},...this.sessionGlobals};if(n){if(n.inherits&&this.config.environments[n.inherits]){let o=this.getEnvironmentVariables(n.inherits);i={...i,...o}}i={...i,...n.variables};let s=this.sessionEnvironmentValues.get(r);s&&(i={...i,...s})}return i}getEnvironmentVariables(e){let r=this.config.environments[e];if(!r)return{};let n={};return r.inherits&&this.config.environments[r.inherits]&&(n={...this.getEnvironmentVariables(r.inherits)}),{...n,...r.variables}}getGlobals(){return{...this.config.globalVariables||{},...this.sessionGlobals}}setGlobal(e,r){this.sessionGlobals[e]=r}unsetGlobal(e){delete this.sessionGlobals[e]}clearGlobals(){this.sessionGlobals={}}resolve(e){let r=e||this.selectedEnvironment;return{name:r,merged:this.getVariables(r),globals:this.getGlobals()}}static fromVariables(e,r="default"){return new t({environments:{[r]:{name:r,variables:e}},selectedEnvironment:r})}};Xl();uf();var ao=class t{envStore;interpolator;urlBuilder;constructor(e,r){this.envStore=e,this.interpolator=r||new wa,this.urlBuilder=new li}get(e){return this.envStore.get(e)}set(e,r){this.envStore.set(e,r)}has(e){return this.envStore.get(e)!==void 0}delete(e){this.envStore.set(e,"")}getAll(){return this.envStore.getAll()}getActiveEnvironment(){return this.envStore.getActive()}setActiveEnvironment(e){this.envStore.setActive(e)}getEnvironments(){let e=this.envStore;return typeof e.getEnvironments=="function"?e.getEnvironments():[]}getGlobals(){let e=this.envStore;return typeof e.getGlobals=="function"?e.getGlobals():{}}setGlobal(e,r){let n=this.envStore;typeof n.setGlobal=="function"&&n.setGlobal(e,r)}unsetGlobal(e){let r=this.envStore;typeof r.unsetGlobal=="function"&&r.unsetGlobal(e)}clearGlobals(){let e=this.envStore;typeof e.clearGlobals=="function"&&e.clearGlobals()}resolve(e){return this.interpolator.interpolate(e,this.getAll())}resolvePath(e,r={}){let n=this.interpolator.interpolate(e,this.getAll());return this.urlBuilder.buildUrl(n,r)}buildUrl(e,r={}){let n=this.interpolator.interpolate(e,this.getAll());return this.urlBuilder.buildUrl(n,r.params||{},r.query||{})}resolveObject(e){return this.interpolator.interpolateObject(e,this.getAll())}extractVariables(e){return this.interpolator.extractVariables(e)}extractPathParams(e){return this.urlBuilder.extractPathParams(e)}static create(e={}){let r=gs.fromVariables(e);return new t(r)}static fromResolver(e){return new t(e)}};uf();cf();ff();Xl();Vf();Hf();var wu=class{constructor(e,r,n,i,s){this.httpClient=e;this.forgeEnv=r;this.cookieJar=n;this.preprocessor=i;if(s?.scriptExecutor)this.scriptExecutor=s.scriptExecutor;else{let o=s?.forgeRoot?[_t("path").join(s.forgeRoot,"modules")]:[],l=new vs(new li,new bs,e);this.scriptExecutor=new Cs(l,o,void 0,s?.scriptScope??"shared",s?.scriptTimeout??5e3)}}httpClient;forgeEnv;cookieJar;preprocessor;scriptExecutor;async execute(e,r,n={}){let i=Date.now(),s={...this.forgeEnv.getAll()},o={...this.forgeEnv.getGlobals()},l={...n.additionalVariables||{}},c={...s},d=this.buildHttpRequest(e,n.overrides),p=n.overrides?.body||e.body,m=this.findFolderPath(r,e.id),y=this.buildScriptChain(e,r,m),b={request:{url:d.url,method:d.method,headers:{...d.headers},body:p?typeof p=="string"?{type:"raw",content:p}:p:void 0},variables:l,collectionVariables:r.variables||{},globals:{...o},environmentVariables:c,environmentName:this.forgeEnv.getActiveEnvironment?.()||void 0,cookieJar:this.cookieJar,info:{eventName:"prerequest",requestName:e.name,requestId:e.id,collectionName:r?.name},onEnvironmentChange:n.onEnvironmentChange,onGlobalsChange:(_,q,k)=>{_==="set"&&q&&k!==void 0?this.forgeEnv.setGlobal(q,k):_==="unset"&&q?this.forgeEnv.unsetGlobal(q):_==="clear"&&this.forgeEnv.clearGlobals()}},E=this.scriptExecutor.createRequestSession(b),C,v;try{if(!n.skipPreRequest&&y.preRequest.length>0){let O=await E.executePreRequest(y.preRequest);if(C={success:O.success,error:O.error,modifiedVariables:O.modifiedVariables,modifiedEnvironment:O.modifiedEnvironmentVariables,modifiedGlobals:O.modifiedGlobals,modifiedCollectionVariables:O.modifiedCollectionVariables,consoleOutput:O.consoleOutput,modifiedRequest:O.modifiedRequest?{url:O.modifiedRequest.url,method:O.modifiedRequest.method,headers:O.modifiedRequest.headers,body:O.modifiedRequest.body?.content}:void 0},O.modifiedVariables&&(l={...l,...O.localVariables??O.modifiedVariables}),O.modifiedEnvironmentVariables&&(c={...c,...O.modifiedEnvironmentVariables}),O.modifiedRequest){let M=O.modifiedRequest;M.url&&(d.url=M.url),M.method&&(d.method=M.method),M.headers&&(d.headers={...d.headers,...M.headers}),M.body!==void 0&&(d.body=M.body?.content||M.body)}if(!O.success)throw new Error(`Pre-request script failed: ${O.error}`)}let _={...c,...l};d=this.interpolateRequest(d,_);let q=n.overrides?.body||e.body;if(this.preprocessor&&q&&typeof q!="string"&&q.type==="graphql"&&d.body!==void 0){let O=this.preprocessor.encodeBody({type:"graphql",content:d.body});O!=null&&(d.body=typeof O=="string"?O:JSON.stringify(O))}if(p&&typeof p=="object"&&p.type==="form-data"&&Array.isArray(d.body)){let O=this.buildMultipartFormData({type:"form-data",content:d.body});O&&(d.body=O)}let k=await this.httpClient.send(d);if(!n.skipPostResponse&&y.postResponse.length>0){let O=await E.executePostResponse(y.postResponse,{status:k.status,statusText:k.statusText,headers:k.headers,body:k.body,cookies:Cm(k.headers,k.cookies,d.url),responseTime:k.time,responseSize:k.size,executedRequest:{url:d.url,method:d.method,headers:d.headers||{},body:d.body?typeof d.body=="string"?{type:"raw",content:d.body}:d.body:{type:"none",content:""},params:{},query:{}}});v={success:!0,assertions:O.testResults,consoleOutput:O.consoleOutput,modifiedEnvironment:O.modifiedEnvironmentVariables},O.modifiedEnvironmentVariables&&(c={...c,...O.modifiedEnvironmentVariables})}return{response:k,preRequestResult:C,postResponseResult:v,totalTime:Date.now()-i,finalRequest:d,variables:{environment:c,local:l}}}finally{E.dispose?.()}}async executeSimple(e,r={}){let n=e,i={...this.forgeEnv.getAll(),...r.variables||{}};return n=this.interpolateRequest(e,i),r.timeout&&(n={...n,timeout:r.timeout}),this.httpClient.send(n)}buildHttpRequest(e,r){let n=e.url;if(e.query&&e.query.length>0){let p=new URLSearchParams;for(let m of e.query)m.enabled!==!1&&p.append(m.key,m.value);n+=(n.includes("?")?"&":"?")+p.toString()}let i=r?.url||n,s=r?.method||e.method,o={};if(e.headers&&Array.isArray(e.headers))for(let p of e.headers)p.enabled!==!1&&(o[p.key]=p.value);let l={...o,...r?.headers||{}},c,d=r?.body||e.body;if(d)if(typeof d=="string")c=d;else if(this.preprocessor&&d.type)if(d.type==="graphql")c=typeof d.content=="string"?d.content:JSON.stringify(d.content);else if(d.type==="form-data")c=this.buildMultipartFormData(d);else{let p=this.preprocessor.encodeBody(d);c=p!=null?String(p):void 0}else d.content&&(c=typeof d.content=="string"?d.content:JSON.stringify(d.content));return this.preprocessor&&d&&d.type!=="form-data"&&this.preprocessor.setContentTypeHeader(l,d),{url:i,method:s,headers:l,body:c,timeout:r?.timeout||e.settings?.timeout,settings:{...e.settings,...r?.settings}}}interpolateRequest(e,r){let n=ao.create(r),i=e.body,s=i;return typeof i=="string"?s=n.resolve(i):i instanceof FormData||i instanceof URLSearchParams?s=i:i&&typeof i=="object"&&(s=n.resolve(i)),{...e,url:n.resolvePath(e.url),headers:n.resolveObject(e.headers),body:s}}buildMultipartFormData(e){if(!e||e.type!=="form-data"||!Array.isArray(e.content))return;let r=new FormData;for(let n of e.content)!n?.key||n.enabled===!1||r.append(n.key,n.value==null?"":String(n.value));return r}buildScriptChain(e,r,n=[]){let i=[],s=[];r.scripts?.preRequest&&i.push(r.scripts.preRequest),r.scripts?.postResponse&&s.push(r.scripts.postResponse);for(let o of n)o.scripts?.preRequest&&i.push(o.scripts.preRequest),o.scripts?.postResponse&&s.push(o.scripts.postResponse);return e.scripts?.preRequest&&i.push(e.scripts.preRequest),e.scripts?.postResponse&&s.push(e.scripts.postResponse),{preRequest:i,postResponse:s}}findFolderPath(e,r){let n=[],i=(s,o)=>{for(let l of s){if(l.type==="request"&&l.id===r)return n.push(...o),!0;if(l.type==="folder"){let c=[...o,l];if(i(l.items,c))return!0}}return!1};return i(e.items,[]),n}};function hz(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}var Wf=class{entries=new Map;requestIndex=new Map;fullResponses=new Map;maxEntriesPerRequest;storeFullResponses;constructor(e={}){this.maxEntriesPerRequest=e.maxEntriesPerRequest??100,this.storeFullResponses=e.storeFullResponses??!0}getEntries(e,r){let n=this.requestIndex.get(e)||[],i=[];for(let s of n){let o=this.entries.get(s);o&&(!r||o.environment===r)&&i.push(o)}return i}getEntry(e){return this.entries.get(e)}getFullResponse(e){return this.fullResponses.get(e)}get count(){return this.entries.size}addEntry(e,r,n,i,s){let o=hz(),l=Date.now(),c={id:o,timestamp:l,environment:i,method:r.method,ticket:s?.ticket,branch:s?.branch,note:s?.note,sentRequest:{url:r.url,method:r.method,headers:{...r.headers},body:r.body},response:{status:n.status,statusText:n.statusText,time:n.time}};this.entries.set(o,c);let d=this.requestIndex.get(e)||[];for(d.unshift(o);d.length>this.maxEntriesPerRequest;){let p=d.pop();p&&(this.entries.delete(p),this.fullResponses.delete(p))}if(this.requestIndex.set(e,d),this.storeFullResponses){let p={timestamp:l,status:n.status,statusText:n.statusText,headers:{...n.headers},cookies:n.cookies||[],body:n.body,time:n.time};this.fullResponses.set(o,p)}return c}deleteEntry(e){if(!this.entries.get(e))return!1;this.entries.delete(e),this.fullResponses.delete(e);for(let[n,i]of this.requestIndex.entries()){let s=i.indexOf(e);if(s!==-1){i.splice(s,1),i.length===0&&this.requestIndex.delete(n);break}}return!0}clearHistory(e){let r=this.requestIndex.get(e);if(r){for(let n of r)this.entries.delete(n),this.fullResponses.delete(n);this.requestIndex.delete(e)}}clearAll(){this.entries.clear(),this.requestIndex.clear(),this.fullResponses.clear()}};var zf=class{async send(e){let r=Date.now(),n=new AbortController,i=e.timeout??3e4,s=setTimeout(()=>n.abort(),i);try{let o={method:e.method,headers:e.headers,signal:n.signal};e.body!==void 0&&!["GET","HEAD"].includes(e.method.toUpperCase())&&(typeof e.body=="string"||e.body instanceof FormData||e.body instanceof URLSearchParams?o.body=e.body:typeof e.body=="object"&&(o.body=JSON.stringify(e.body),!e.headers?.["Content-Type"]&&!e.headers?.["content-type"]&&(o.headers["Content-Type"]="application/json"))),e.settings?.followRedirects===!1&&(o.redirect="manual");let l=await fetch(e.url,o),c=Date.now(),d;try{d=await l.text()}catch{d=null}let p={};return l.headers.forEach((m,y)=>{let b=p[y];b!==void 0?p[y]=Array.isArray(b)?[...b,m]:[b,m]:p[y]=m}),{status:l.status,statusText:l.statusText,headers:p,cookies:[],body:d,time:c-r}}catch(o){throw o.name==="AbortError"?new Error(`Request timeout after ${i}ms`):o}finally{clearTimeout(s)}}};cf();ff();Jf();qm();Xl();var Fa=class{format="http-forge";canParse(e){try{let r=JSON.parse(e);return typeof r=="object"&&r!==null&&"id"in r&&"name"in r&&"items"in r&&Array.isArray(r.items)&&!r.info?.schema?.includes("postman")&&!r._type}catch{return!1}}parse(e,r){let n=JSON.parse(e);return{id:n.id,name:n.name,description:n.description,variables:n.variables||{},auth:n.auth,scripts:n.scripts?{preRequest:n.scripts.preRequest,postResponse:n.scripts.postResponse}:void 0,items:this.convertItems(n.items),source:{format:"http-forge",filePath:r,version:n.version}}}convertItems(e){return e.map(r=>r.type==="folder"?this.convertFolder(r):this.convertRequest(r))}convertFolder(e){return{type:"folder",id:e.id,name:e.name,description:e.description,auth:e.auth,scripts:e.scripts?{preRequest:e.scripts.preRequest,postResponse:e.scripts.postResponse}:void 0,items:e.items?this.convertItems(e.items):[]}}convertRequest(e){let r={};if(e.headers)for(let i of e.headers)i.enabled!==!1&&(r[i.key]=i.value);let n={};if(e.query)for(let i of e.query)i.enabled!==!1&&(n[i.key]=i.value);return{type:"request",id:e.id,name:e.name,description:e.description,method:e.method||"GET",url:e.url||"",headers:Object.entries(r).map(([i,s])=>({key:i,value:s,enabled:!0})),query:Object.entries(n).map(([i,s])=>({key:i,value:s,enabled:!0})),params:e.params,body:e.body,auth:e.auth,settings:e.settings,scripts:e.scripts?{preRequest:e.scripts.preRequest,postResponse:e.scripts.postResponse}:void 0}}};Om();import*as _n from"fs/promises";import*as _u from"path";var Gf=class{async readFile(e){return _n.readFile(e,"utf-8")}async writeFile(e,r){let n=_u.dirname(e);await this.mkdir(n),await _n.writeFile(e,r,"utf-8")}async exists(e){try{return await _n.access(e),!0}catch{return!1}}async mkdir(e){await _n.mkdir(e,{recursive:!0})}async glob(e,r){let n=r||process.cwd(),i=[];try{await this.walkDirectory(n,s=>{let o=_u.basename(s);for(let l of e)if(this.matchPattern(o,l)){i.push(s);break}})}catch{}return i}async readDir(e){return _n.readdir(e)}async isDirectory(e){try{return(await _n.stat(e)).isDirectory()}catch{return!1}}async walkDirectory(e,r){let n=await _n.readdir(e,{withFileTypes:!0});for(let i of n){let s=_u.join(e,i.name);i.isDirectory()?await this.walkDirectory(s,r):i.isFile()&&r(s)}}matchPattern(e,r){let n=r.replace(/\./g,"\\.").replace(/\*/g,".*");return new RegExp(`^${n}$`,"i").test(e)}};Vf();var l0=class t{httpClient;fileSystem;scriptExecutor;interpolator;cookieJar;interceptorChain;preprocessor;dataFileParser;requestHistory;parserRegistry;collectionLoader;environmentStore;forgeEnv;requestExecutor;options;constructor(e={}){if(this.options=e,this.interpolator=e.interpolator||new wa,this.fileSystem=e.fileSystem||new Gf,this.preprocessor=e.preprocessor||new Ma,this.dataFileParser=e.dataFileParser||new Da,this.cookieJar=e.cookieJar||new rf,e.enableHistory?this.requestHistory=e.requestHistory||new Wf({maxEntriesPerRequest:e.maxHistoryEntries??100}):this.requestHistory=null,this.interceptorChain=e.interceptorChain||this.createInterceptorChain(e),e.httpClient)this.httpClient=e.httpClient;else if(e.useNativeHttp!==!1){let s={...e.httpSettings,timeout:e.requestTimeout??e.httpSettings?.timeout};this.httpClient=new Na(s)}else this.httpClient=new zf;let r=e.forgeRoot?[_t("path").join(e.forgeRoot,"modules")]:[],n=new vs(new li,this.interceptorChain,this.httpClient);if(this.scriptExecutor=e.scriptExecutor||new Cs(n,r,void 0,e.scriptScope??"shared",e.scriptTimeout??5e3),this.parserRegistry=new tf,this.parserRegistry.register("http-forge",new Fa),(e.storageFormat??"folder")==="folder"&&e.forgeRoot){let s=_t("path").join(e.forgeRoot,"collections");this.collectionLoader=new ef(s)}else this.collectionLoader=new Zl(this.fileSystem,this.parserRegistry);this.environmentStore=e.environmentConfig?new gs(e.environmentConfig):gs.fromVariables({}),this.forgeEnv=ao.fromResolver(this.environmentStore),this.requestExecutor=new wu(this.httpClient,this.forgeEnv,this.cookieJar,this.preprocessor,{forgeRoot:e.forgeRoot,scriptExecutor:this.scriptExecutor})}createInterceptorChain(e){let r=new bs;if(e.requestInterceptors)for(let n of e.requestInterceptors)r.addRequestInterceptor(n);if(e.responseInterceptors)for(let n of e.responseInterceptors)r.addResponseInterceptor(n);if(e.errorInterceptors)for(let n of e.errorInterceptors)r.addErrorInterceptor(n);return r}async loadCollection(e){if(this.collectionLoader instanceof Zl)return this.collectionLoader.load(e);throw new Error("loadCollection(filePath) is not supported with folder storage format. Use loadAllCollections() instead.")}async loadAllCollections(){return this.collectionLoader.loadAll()}async execute(e,r,n){return this.requestExecutor.execute(e,r,n)}async executeSimple(e,r){return this.requestExecutor.executeSimple(e,r)}registerParser(e,r){this.parserRegistry.register(e,r)}setEnvironmentConfig(e){this.environmentStore=new gs(e),this.forgeEnv=ao.fromResolver(this.environmentStore),this.requestExecutor=new wu(this.httpClient,this.forgeEnv,this.cookieJar,this.preprocessor,{forgeRoot:this.options.forgeRoot,scriptExecutor:this.scriptExecutor})}static create(e){return new t(e)}static fromForgeRoot(e="./http-forge",r={}){let n=_t("path"),i=n.join(e,"environments"),s,o=nf(i);if(Object.keys(o.environments).length>0||Object.keys(o.globalVariables).length>0){s={globalVariables:{...o.globalVariables,...o.localVariables},environments:{},selectedEnvironment:void 0};for(let[c,d]of Object.entries(o.environments)){let p=o.localCredentials[c]?.variables||{};s.environments[c]={name:c,variables:{...d.variables,...p}}}}else{let c=_t("fs"),d=n.join(i,"environments.json");if(c.existsSync(d))try{let p=c.readFileSync(d,"utf-8"),m=JSON.parse(p);if(s={globalVariables:m.globalVariables||{},environments:{},selectedEnvironment:m.selectedEnvironment},m.environments)for(let[y,b]of Object.entries(m.environments)){let E=b;s.environments[y]={name:E.name||y,variables:E.variables||{}}}}catch(p){console.warn(`[ForgeContainer] Failed to load environments from ${d}:`,p)}}return new t({...r,forgeRoot:e,storageFormat:r.storageFormat??"folder",environmentConfig:s})}};DC();jC();wy();Ei();zC();GC();YC();cx();Py();sp();async function K5(t){let{createMcpRuntime:e}=await Promise.resolve().then(()=>(qN(),EN));return e(t)}async function Q5(t){let{runRequest:e}=await Promise.resolve().then(()=>(pc(),hp));return e(t)}async function Z5(t){let{runCollection:e}=await Promise.resolve().then(()=>(pc(),hp));return e(t)}async function X5(t){let{runFolder:e}=await Promise.resolve().then(()=>(pc(),hp));return e(t)}async function e7(t){let{runSuite:e}=await Promise.resolve().then(()=>(pc(),hp));return e(t)}Ny();g0();ga();fx();y0();cf();ff();Jf();function t7(t){return{timeout:t?.timeout??wn.timeout,followRedirects:t?.followRedirects??wn.followRedirects,followOriginalMethod:t?.followOriginalMethod??wn.followOriginalMethod,followAuthHeader:t?.followAuthHeader??wn.followAuthHeader,maxRedirects:t?.maxRedirects??wn.maxRedirects,strictSSL:t?.strictSSL??wn.strictSSL,decompress:t?.decompress??wn.decompress,includeCookies:t?.includeCookies??wn.includeCookies,tls:t?.tls??wn.tls,certificates:t?.certificates??wn.certificates}}Jf();qm();Xl();e0();i0();Vf();_m();Hf();od();d0();h0();Ph();ma();ma();f0();function r7(t){let e=t.replace(/\\\n/g," "),r=[],n="",i=0;for(;i<e.length;){let s=e[i];if(s==="\\"&&i+1<e.length)n+=e[++i],i++;else if(s==="'"){for(i++;i<e.length&&e[i]!=="'";)n+=e[i++];i++}else if(s==='"'){for(i++;i<e.length&&e[i]!=='"';)if(e[i]==="\\"&&i+1<e.length){let o=e[i+1];o==='"'||o==="\\"||o==="$"||o==="`"?(n+=o,i+=2):n+=e[i++]}else n+=e[i++];i++}else/\s/.test(s)?(n.length>0&&(r.push(n),n=""),i++):(n+=s,i++)}return n.length>0&&r.push(n),r}function n7(t){try{let e="__FV__",r=[],n=t.replace(/\{\{[^}]+\}\}/g,p=>(r.push(p),`${e}${r.length-1}`)),i=n.indexOf("?");if(i===-1)return{cleanUrl:t,params:[]};let s=n.slice(0,i),o=n.slice(i+1),l=p=>p.replace(new RegExp(`${e}(\\d+)`,"g"),(m,y)=>r[parseInt(y,10)]),c=l(s),d=o.split("&").filter(Boolean).map(p=>{let m=l(p),y=m.indexOf("=");return y===-1?{key:m,value:"",enabled:!0}:{key:decodeURIComponent(m.slice(0,y)),value:decodeURIComponent(m.slice(y+1)),enabled:!0}});return{cleanUrl:c,params:d}}catch{return{cleanUrl:t,params:[]}}}function i7(t){try{let e=new URL(t.replace(/\{\{[^}]+\}\}/g,"placeholder")),r=e.pathname.split("/").filter(Boolean),n=r[r.length-1];return n&&!/^\d+$/.test(n)&&!n.startsWith("{")?n.replace(/[-_]/g," ").replace(/\b\w/g,i=>i.toUpperCase()):r.length>1?r[r.length-2].replace(/[-_]/g," ").replace(/\b\w/g,i=>i.toUpperCase()):e.hostname.replace(/^www\./,"").split(".")[0]??"Request"}catch{return"Request"}}var s7=new Set(["x-api-key","x-auth-token","x-access-token","x-token","x-secret","api-key","apikey","x-client-secret","x-rapidapi-key"]),o7=new Set(["api_key","apikey","api-key","access_token","token","auth_token","client_id","client_secret","key","secret"]);function ON(t){return t.toUpperCase().replace(/[^A-Z0-9]/g,"_")}function IN(t){return/\{\{[^}]+\}\}/.test(t)}function Dy(t,e=16){return t.length>=e&&!IN(t)}function a7(t,e,r){let n=[],i=new Set,s=(o,l)=>{i.has(l)||(i.add(l),n.push({key:o,value:l}))};for(let o of t){let l=o.key.toLowerCase();if(l==="authorization"){let c=o.value.match(/^(bearer|basic|token|digest)\s+(.+)$/i);c&&Dy(c[2])?s(`${c[1].toUpperCase()}_TOKEN`,c[2]):Dy(o.value)&&s("AUTH_TOKEN",o.value)}else s7.has(l)&&Dy(o.value)&&s(ON(o.key),o.value)}for(let o of e)o7.has(o.key.toLowerCase())&&Dy(o.value)&&s(ON(o.key),o.value);try{let o=new URL(r.replace(/\{\{[^}]+\}\}/g,"placeholder"));if(!["localhost","127.0.0.1","0.0.0.0","::1"].includes(o.hostname)&&!IN(r)){let c=`${o.protocol}//${o.host}`;s("BASE_URL",c)}}catch{}return n}function l7(t){let e=r7(t.trim()),r=0;for(;r<e.length&&e[r].toLowerCase()==="curl";)r++;let n=e.slice(r),i="",s="",o=[],l=null,c=!1,d=!1,p=[],m=[],y=0;for(;y<n.length;){let q=n[y];if(q==="-X"||q==="--request")i=n[++y]??"";else if(q==="-H"||q==="--header"){let k=n[++y]??"",O=k.indexOf(":");O>0&&o.push({key:k.slice(0,O).trim(),value:k.slice(O+1).trim()})}else if(q==="-d"||q==="--data"||q==="--data-raw"||q==="--data-binary"||q==="--data-ascii")l=n[++y]??"";else if(q==="--json")l=n[++y]??"",c=!0;else if(q==="-u"||q==="--user"){let k=n[++y]??"",O=btoa(k);o.push({key:"Authorization",value:`Basic ${O}`})}else if(q==="-b"||q==="--cookie")o.push({key:"Cookie",value:n[++y]??""});else if(q==="--url")s=n[++y]??"";else if(q==="-G"||q==="--get")d=!0;else if(q==="-F"||q==="--form"){let k=n[++y]??"",O=k.indexOf("=");O>0&&p.push({key:k.slice(0,O),value:k.slice(O+1)})}else q==="--data-urlencode"?m.push(n[++y]??""):q==="-A"||q==="--user-agent"?o.push({key:"User-Agent",value:n[++y]??""}):q==="-e"||q==="--referer"||q==="--referrer"?o.push({key:"Referer",value:n[++y]??""}):q==="--compressed"||q==="-L"||q==="--location"||q==="-v"||q==="--verbose"||q==="-s"||q==="--silent"||q==="-i"||q==="--include"||q==="-k"||q==="--insecure"||q==="--http1.1"||q==="--http2"||q==="--http3"||(q==="-o"||q==="--output"||q==="--max-time"||q==="--connect-timeout"||q==="-m"||q==="--limit-rate"||q==="--proxy"||q==="-x"?y++:!q.startsWith("-")&&!s&&(s=q));y++}d?i="GET":i||(i=l!==null||p.length>0||m.length>0?"POST":"GET");let{cleanUrl:b,params:E}=n7(s),C=null;if(p.length>0)C={type:"raw",format:"text",content:p.map(k=>`${encodeURIComponent(k.key)}=${encodeURIComponent(k.value)}`).join("&")},o.some(k=>k.key.toLowerCase()==="content-type")||o.push({key:"Content-Type",value:"multipart/form-data"});else if(m.length>0)C={type:"raw",format:"text",content:m.join("&")},o.some(q=>q.key.toLowerCase()==="content-type")||o.push({key:"Content-Type",value:"application/x-www-form-urlencoded"});else if(l!==null){let q=l.trim(),k=c||q.startsWith("{")||q.startsWith("[");C={type:"raw",format:k?"json":"text",content:l},k&&!o.some(O=>O.key.toLowerCase()==="content-type")&&o.push({key:"Content-Type",value:"application/json"})}let v=o.map(q=>({...q,enabled:!0})),_=a7(o,E,b||s);return{name:i7(b||s),method:i.toUpperCase(),url:b||s,headers:v,queryParams:E,body:C,suggestedVars:_}}async function u7(t,e,r,n){let i=PN(t.items);if(i.length===0)return;let s=Math.ceil(i.length/10);for(let o=0;o<i.length;o+=10){let l=i.slice(o,o+10),c=Math.floor(o/10)+1;n?.(`Enhancing requests (batch ${c}/${s})\u2026`,1/s*100);let d=l.map(p=>({id:p.id,name:p.name,method:p.method??"GET",url:p.url??"",bodyContent:p7(p),responseSchema:p.responseSchema?JSON.stringify(p.responseSchema).slice(0,500):void 0,description:p.description?.slice(0,200)}));try{let p=await r.complete(c7(d)),m=f7(p);d7(l,m)}catch{}}await e.saveCollection(t)}function c7(t){return`You are an API testing expert. For each HTTP request below, return two improvements:
|
|
1021
|
+
[View HTML Report](${p[1]})`:"";return{content:[{type:"text",text:d+m}]}}case"prompts/list":return{prompts:Oy};case"prompts/get":{let r=e.params??{},n=r.name,i=r.arguments??{};if(!n)throw new Error("Missing prompt name");let s=Yn(t.workspaceFolder);try{return await JC(n,i,s.collection,t.runStore)}finally{hc(s)}}default:throw new Error(`Method not found: ${e.method}`)}}function B5(t,e,r){let n=!t.container,i=t.container??Yn(t.workspaceFolder),s;try{s=i.config.getMcpConfig().cors.allowedOrigins??["http://localhost","http://127.0.0.1"]}finally{n&&hc(i)}let o=e.headers.origin??"",l=s.includes(o)?o:s[0]??"http://localhost";r.setHeader("Access-Control-Allow-Origin",l),r.setHeader("Access-Control-Allow-Methods","POST, GET, OPTIONS"),r.setHeader("Access-Control-Allow-Headers","Content-Type, Mcp-Session-Id")}function V5(t,e,r){let i=new URL(e.url,`http://${t.host}:${t.port}`).searchParams.get("path");if(!i){r.statusCode=400,r.end("Missing path parameter");return}let s=Lo.resolve(i),o=t.container?.config.getResultsPath(),l=o?Lo.dirname(o):Lo.resolve(t.workspaceFolder,".http-forge",".cache");if(!s.startsWith(l+Lo.sep)||!s.endsWith(".html")){r.statusCode=403,r.end("Forbidden");return}xN.readFile(s,"utf-8",(c,d)=>{if(c){r.statusCode=404,r.end("Report not found");return}r.statusCode=200,r.setHeader("content-type","text/html; charset=utf-8"),r.end(d)})}function Px(t,e,r,n){let i=t.create(e,r);return n().then(s=>{i.status!=="cancelled"&&(i.status="completed",i.completedAt=Date.now(),i.summary=s?.summary??i.summary,s?.failedRequests&&(i.failedRequests=s.failedRequests),s?.noAssertionExamples&&(i.noAssertionExamples=s.noAssertionExamples),i.reportPath=s?.report?.uri?.replace("file://","")??null,i.progress.completed=i.progress.total)}).catch(s=>{i.status!=="cancelled"&&(i.status="failed",i.completedAt=Date.now(),i.error=s.message)}),{runId:i.id,status:"running",total:r,message:"Run started. Use get_run_status to poll."}}function W5(t){let e=t.workspaceFolder;return{async runRequest(r,n,i){return Oi(()=>Fy({workspaceFolder:e,collectionId:r.id,requestId:n,environment:i.environment,variables:i.variables,headers:i.headers,query:i.query,body:i.body,include:i.include}))},async runFolder(r,n,i){let s=ot(r).filter(({folderPath:o})=>o===n||o.startsWith(`${n}/`)).length;return i.async===!0?Px(t.runStore,`${r.name} / ${Ts(n)}`,s,()=>Oi(()=>Ns({workspaceFolder:e,collectionId:r.id,folderPath:n,recursive:i.recursive,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,include:i.include}))):Oi(()=>Ns({workspaceFolder:e,collectionId:r.id,folderPath:n,recursive:i.recursive,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,include:i.include}))},async runCollection(r,n){let i=ot(r).length;return n.async===!0?Px(t.runStore,r.name,i,()=>Oi(()=>Ns({workspaceFolder:e,collectionId:r.id,environment:n.environment,variables:n.variables,iterations:n.iterations,stopOnError:n.stopOnError,delay:n.delay,include:n.include}))):Oi(()=>Ns({workspaceFolder:e,collectionId:r.id,environment:n.environment,variables:n.variables,iterations:n.iterations,stopOnError:n.stopOnError,delay:n.delay,include:n.include}))},async runSuite(r,n,i){let s=Yn(e),o=0;try{let l=await s.testSuite.getSuite(r);o=(l?.nodes.filter(d=>d.type==="request").length??0)*(i.iterations??l?.config?.iterations??1)}finally{hc(s)}return i.async===!0?Px(t.runStore,n,o,()=>Oi(()=>pp({workspaceFolder:e,suiteId:r,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,requestFilter:i.requestFilter,include:i.include}))):Oi(()=>pp({workspaceFolder:e,suiteId:r,environment:i.environment,variables:i.variables,iterations:i.iterations,stopOnError:i.stopOnError,delay:i.delay,requestFilter:i.requestFilter,include:i.include}))}}}async function Ax(t,e,r={}){let n=t.workspaceFolder,i=j5(t.container,e);if(Object.values(G).includes(i)){let l=Yn(n);try{let c=await WC(i,r,{collection:l.collection,testSuite:l.testSuite,environmentConfig:l.environmentConfig,workspaceFolder:n},t.runStore,W5(t));return z5.has(i)&&kx.delete(n),c}finally{hc(l)}}let s=ex(i),o=Yn(n);try{let l=o.collection.getAllCollections(),c=l.map(b=>b.id),d=b=>{let q=nc(b,c),C=q?l.find(v=>v.id===q):void 0;if(!C)throw new Error(`Collection not found for tool: ${e}`);return C};if(s.kind==="request"){let[b,q]=s.tokens;if(!b||!q)throw new Error(`Malformed request tool: ${e}`);let C=d(b),v=ot(C).map(E=>E.request.id),_=nc(q,v);if(!_)throw new Error(`Request not found in collection "${C.name}" for tool: ${e}`);return Oi(()=>Fy({workspaceFolder:n,collectionId:C.id,requestId:_,environment:r.environment,variables:r.variables,headers:r.headers,query:r.query,body:r.body,include:r.include}))}if(s.kind==="collection"){let[b]=s.tokens;if(!b)throw new Error(`Malformed collection tool: ${e}`);let q=d(b);return Oi(()=>Ns({workspaceFolder:n,collectionId:q.id,environment:r.environment,variables:r.variables,iterations:r.iterations,stopOnError:r.stopOnError,delay:r.delay,include:r.include}))}if(s.kind==="folder"){let[b,q]=s.tokens;if(!b||!q)throw new Error(`Malformed folder tool: ${e}`);let C=d(b),v=(o.collection.getAllCollections().find(k=>k.id===C.id),void 0),_=ot(C).map(k=>k.folderPath).filter((k,O,M)=>k&&M.indexOf(k)===O),E=tx(q,_);if(!E)throw new Error(`Folder not found in collection "${C.name}" for tool: ${e}`);return Oi(()=>Ns({workspaceFolder:n,collectionId:C.id,folderPath:E,recursive:r.recursive,environment:r.environment,variables:r.variables,iterations:r.iterations,stopOnError:r.stopOnError,delay:r.delay,include:r.include}))}let[p]=s.tokens;if(!p)throw new Error(`Malformed suite tool: ${e}`);let m=await o.testSuite.getAllSuites(),y=nc(p,m.map(b=>b.id));if(!y)throw new Error(`Test suite not found for tool: ${e}`);return Oi(()=>pp({workspaceFolder:n,suiteId:y,environment:r.environment,variables:r.variables,iterations:r.iterations,stopOnError:r.stopOnError,delay:r.delay,requestFilter:r.requestFilter,include:r.include}))}finally{hc(o)}}function ll(t,e,r){t.statusCode=e,t.setHeader("content-type","application/json; charset=utf-8"),t.end(JSON.stringify(r))}function CN(t){return new Promise((e,r)=>{let n="";t.on("data",i=>{n+=i,n.length>1024*1024&&r(new Error("Request body too large (max 1MB)"))}),t.on("end",()=>{if(!n){e({});return}try{e(JSON.parse(n))}catch{r(new Error("Invalid JSON body"))}}),t.on("error",r)})}function J5(t){return N5(async(e,r)=>{try{if(B5(t,e,r),e.method==="OPTIONS"){r.statusCode=204,r.end();return}if(e.method==="GET"&&e.url==="/health"){ll(r,200,{status:"ok",port:t.port});return}if(e.method==="GET"&&e.url?.startsWith("/report?")){V5(t,e,r);return}if(e.method==="POST"&&(e.url==="/"||e.url==="/mcp")){let n;try{n=await CN(e)}catch{RN(r,null,-32700,"Parse error");return}try{let i=await H5(t,n);ll(r,200,{jsonrpc:"2.0",id:n.id??null,result:i})}catch(i){RN(r,n.id??null,-32603,i.message||"Internal error")}return}if(e.method==="POST"&&e.url==="/tools/execute"){let n=await CN(e);if(!n||typeof n.name!="string"||n.name.trim()===""){ll(r,400,{error:'Field "name" is required'});return}let i=await Ax(t,n.name,n.args??{});ll(r,200,{result:i});return}ll(r,405,{error:"Method not allowed"})}catch(n){ll(r,500,{error:n.message})}})}function G5(t){if(typeof t.port=="number"&&Number.isFinite(t.port))return Math.min(65535,Math.max(1,Math.floor(t.port)));let r=new vo(Lo.resolve(t.workspaceFolder)).getMcpConfig().port;return Math.min(65535,Math.max(1,Math.floor(r||3100)))}async function Y5(t){let e=G5(t),r=t.host||"127.0.0.1",n=`${r}:${e}`,i={workspaceFolder:t.workspaceFolder,port:e,host:r,isRunning:!1,runStore:new lp};return M5.set(n,i),{async start(){if(i.isRunning)return;i.container||(i.container=Yn(i.workspaceFolder));let s=J5(i);await new Promise((o,l)=>{s.once("error",l),s.listen(i.port,i.host,()=>{s.off("error",l),o()})}),i.server=s,i.isRunning=!0},async stop(){if(i.container&&(hc(i.container),i.container=void 0),!i.server){i.isRunning=!1;return}await new Promise((s,o)=>{i.server.close(l=>{if(l){o(l);return}s()})}),i.server=void 0,i.isRunning=!1},isRunning(){return i.isRunning},getPort(){return i.port},async executeTool(s,o){return Ax(i,s,o??{})}}}var M5,F5,kx,Ix,z5,qN=ae(()=>{"use strict";km();pc();Ei();zC();GC();YC();cx();Py();sp();Ny();M5=new Map;F5=3e3,kx=new Map,Ix=new Map;z5=VC});var Zl=class{constructor(e,r){this.fileSystem=e;this.parserRegistry=r}fileSystem;parserRegistry;directory;setDirectory(e){this.directory=e}async loadAll(){return this.directory?this.loadDirectory(this.directory):[]}async load(e,r={}){let n=await this.fileSystem.readFile(e);if(r.format){let s=this.parserRegistry.get(r.format);if(!s)throw new Error(`No parser registered for format: ${r.format}`);return s.parse(n,e)}let i=this.parserRegistry.detect(n);if(!i)throw new Error(`Could not detect collection format for: ${e}. Supported formats: ${this.parserRegistry.getFormats().join(", ")}`);return i.parser.parse(n,e)}async loadDirectory(e,r=["*.json","*.forge.json"]){let n=[],i=await this.fileSystem.glob(r,e);for(let s of i)try{let o=await this.load(s);n.push(o)}catch{}return n}async canLoad(e){try{if(!await this.fileSystem.exists(e))return!1;let r=await this.fileSystem.readFile(e);return this.parserRegistry.detect(r)!==null}catch{return!1}}getSupportedFormats(){return this.parserRegistry.getFormats()}};Ph();ma();function oS(t,e){return{id:t.id,name:t.name,description:t.description,variables:t.variables||{},auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(dq),source:{format:"folder",filePath:e,version:t.version}}}function dq(t){if(t.type==="folder")return{type:"folder",id:t.id,name:t.name,description:t.description,auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(dq)};let e=t;return{type:"request",id:e.id,name:e.name,description:e.description,method:e.method||"GET",url:e.url||"",headers:e.headers||[],query:e.query||[],params:e.params,body:e.body??void 0,auth:e.auth,settings:e.settings,scripts:e.scripts,...e.deprecated&&{deprecated:e.deprecated},...e.doc&&{doc:e.doc},...e.responseSchema&&{responseSchema:e.responseSchema},...e.bodySchema&&{bodySchema:e.bodySchema},...e.operationId&&{operationId:e.operationId},...e.summary&&{summary:e.summary},...e.tags&&e.tags.length>0&&{tags:e.tags},...e.examples&&e.examples.length>0&&{examples:e.examples},...e.responses&&Object.keys(e.responses).length>0&&{responses:e.responses},...e.security&&e.security.length>0&&{security:e.security}}}function HL(t){return{id:t.id,name:t.name,description:t.description,version:t.source?.version,variables:t.variables,auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(aS)}}function aS(t){return t.type==="folder"?{type:"folder",id:t.id,name:t.name,description:t.description,auth:t.auth,scripts:t.scripts,items:(t.items||[]).map(aS)}:{type:"request",id:t.id,name:t.name,description:t.description,method:t.method,url:t.url,headers:t.headers,query:t.query,params:t.params,body:t.body,auth:t.auth,settings:t.settings,scripts:t.scripts,...t.deprecated&&{deprecated:t.deprecated},...t.doc&&{doc:t.doc},...t.responseSchema&&{responseSchema:t.responseSchema},...t.bodySchema&&{bodySchema:t.bodySchema},...t.operationId&&{operationId:t.operationId},...t.summary&&{summary:t.summary},...t.tags&&{tags:t.tags},...t.examples&&{examples:t.examples},...t.responses&&{responses:t.responses},...t.security&&{security:t.security}}}var ef=class{store;constructor(e){this.store=new so(e)}loadAll(){return this.store.loadAll().map(r=>oS(r,this.store.getCollectionPath(r.id)))}getSlugById(e){return this.store.getSlugById(e)}getIdBySlug(e){return this.store.getIdBySlug(e)}load(e){let r=this.store.load(e);if(r)return oS(r,this.store.getCollectionPath(r.id))}async create(e,r){let n=await this.store.create(e,r);return oS(n,this.store.getCollectionPath(n.id))}async save(e){return this.store.save(HL(e))}async delete(e){return this.store.delete(e)}exists(e){return this.store.exists(e)}getCollectionPath(e){return this.store.getCollectionPath(e)}async updateCollectionMetadata(e,r){return this.store.updateCollectionMetadata(e,r)}async saveItem(e,r,n){return this.store.saveItem(e,aS(r),n)}async updateItem(e,r,n){let i={...n};return this.store.updateItem(e,r,i)}async deleteItem(e,r){return this.store.deleteItem(e,r)}async moveItem(e,r,n){return this.store.moveItem(e,r,n)}async reorderItems(e,r,n){return this.store.reorderItems(e,r,n)}async saveScripts(e,r,n){return this.store.saveScripts(e,r,n)}loadScripts(e,r){return this.store.loadScripts(e,r)}};var tf=class{parsers=new Map;register(e,r){this.parsers.set(e.toLowerCase(),r)}get(e){return this.parsers.get(e.toLowerCase())}has(e){return this.parsers.has(e.toLowerCase())}getFormats(){return Array.from(this.parsers.keys())}detect(e){for(let[r,n]of this.parsers)if(n.canParse(e))return{parser:n,format:r};return null}clear(){this.parsers.clear()}};ga();var rf=class{cookies=new Map;getCookieKey(e,r,n){return`${r||"*"}|${n||"/"}|${e}`}get(e,r){if(r){let s=this.getCookieKey(e,r),o=this.cookies.get(s);if(o&&!this.isExpired(o))return o}let n=this.getCookieKey(e,"*"),i=this.cookies.get(n);if(i&&!this.isExpired(i))return i;for(let s of this.cookies.values())if(s.name===e&&!this.isExpired(s))if(r&&s.domain){if(this.domainMatches(r,s.domain))return s}else return s}set(e){let r=this.getCookieKey(e.name,e.domain,e.path);this.cookies.set(r,e)}setFromResponse(e){for(let r of e){let n=this.getCookieKey(r.name,r.domain,r.path);this.cookies.set(n,r)}}has(e,r){return this.get(e,r)!==void 0}delete(e,r,n){let i=this.getCookieKey(e,r,n);return this.cookies.delete(i)}getAll(e){let r=[];for(let n of this.cookies.values())this.isExpired(n)||(e?(!n.domain||this.domainMatches(e,n.domain))&&r.push(n):r.push(n));return r}getCookieHeader(e){let r=this.getAll(e);return xt.formatCookieHeader(r)}clear(){this.cookies.clear()}clearDomain(e){let r=[];for(let[n,i]of this.cookies.entries())i.domain&&this.domainMatches(e,i.domain)&&r.push(n);for(let n of r)this.cookies.delete(n)}parseCookieHeaders(e,r){return xt.parseCookieHeaders(e,r)}isExpired(e){return xt.isExpired(e)}domainMatches(e,r){return xt.domainMatches(e,r)}get count(){return this.cookies.size}cleanExpiredCookies(){let e=[];for(let[r,n]of this.cookies.entries())this.isExpired(n)&&e.push(r);for(let r of e)this.cookies.delete(r)}};Th();var gs=class t{config;selectedEnvironment;sessionGlobals={};sessionEnvironmentValues=new Map;constructor(e){this.config=e,this.selectedEnvironment=e.selectedEnvironment||Object.keys(e.environments)[0]||"default"}get(e){return this.getVariables()[e]}set(e,r){let n=this.sessionEnvironmentValues.get(this.selectedEnvironment);n||(n={},this.sessionEnvironmentValues.set(this.selectedEnvironment,n)),n[e]=r}getAll(){return this.getVariables()}getEnvironments(){return Object.keys(this.config.environments)}getActive(){return this.selectedEnvironment}setActive(e){if(!this.config.environments[e])throw new Error(`Environment not found: ${e}`);this.selectedEnvironment=e}getVariables(e){let r=e||this.selectedEnvironment,n=this.config.environments[r],i={...this.config.globalVariables||{},...this.sessionGlobals};if(n){if(n.inherits&&this.config.environments[n.inherits]){let o=this.getEnvironmentVariables(n.inherits);i={...i,...o}}i={...i,...n.variables};let s=this.sessionEnvironmentValues.get(r);s&&(i={...i,...s})}return i}getEnvironmentVariables(e){let r=this.config.environments[e];if(!r)return{};let n={};return r.inherits&&this.config.environments[r.inherits]&&(n={...this.getEnvironmentVariables(r.inherits)}),{...n,...r.variables}}getGlobals(){return{...this.config.globalVariables||{},...this.sessionGlobals}}setGlobal(e,r){this.sessionGlobals[e]=r}unsetGlobal(e){delete this.sessionGlobals[e]}clearGlobals(){this.sessionGlobals={}}resolve(e){let r=e||this.selectedEnvironment;return{name:r,merged:this.getVariables(r),globals:this.getGlobals()}}static fromVariables(e,r="default"){return new t({environments:{[r]:{name:r,variables:e}},selectedEnvironment:r})}};Xl();uf();var ao=class t{envStore;interpolator;urlBuilder;constructor(e,r){this.envStore=e,this.interpolator=r||new wa,this.urlBuilder=new li}get(e){return this.envStore.get(e)}set(e,r){this.envStore.set(e,r)}has(e){return this.envStore.get(e)!==void 0}delete(e){this.envStore.set(e,"")}getAll(){return this.envStore.getAll()}getActiveEnvironment(){return this.envStore.getActive()}setActiveEnvironment(e){this.envStore.setActive(e)}getEnvironments(){let e=this.envStore;return typeof e.getEnvironments=="function"?e.getEnvironments():[]}getGlobals(){let e=this.envStore;return typeof e.getGlobals=="function"?e.getGlobals():{}}setGlobal(e,r){let n=this.envStore;typeof n.setGlobal=="function"&&n.setGlobal(e,r)}unsetGlobal(e){let r=this.envStore;typeof r.unsetGlobal=="function"&&r.unsetGlobal(e)}clearGlobals(){let e=this.envStore;typeof e.clearGlobals=="function"&&e.clearGlobals()}resolve(e){return this.interpolator.interpolate(e,this.getAll())}resolvePath(e,r={}){let n=this.interpolator.interpolate(e,this.getAll());return this.urlBuilder.buildUrl(n,r)}buildUrl(e,r={}){let n=this.interpolator.interpolate(e,this.getAll());return this.urlBuilder.buildUrl(n,r.params||{},r.query||{})}resolveObject(e){return this.interpolator.interpolateObject(e,this.getAll())}extractVariables(e){return this.interpolator.extractVariables(e)}extractPathParams(e){return this.urlBuilder.extractPathParams(e)}static create(e={}){let r=gs.fromVariables(e);return new t(r)}static fromResolver(e){return new t(e)}};uf();cf();ff();Xl();Vf();Hf();var wu=class{constructor(e,r,n,i,s){this.httpClient=e;this.forgeEnv=r;this.cookieJar=n;this.preprocessor=i;if(s?.scriptExecutor)this.scriptExecutor=s.scriptExecutor;else{let o=s?.forgeRoot?[_t("path").join(s.forgeRoot,"modules")]:[],l=new vs(new li,new bs,e);this.scriptExecutor=new Cs(l,o,void 0,s?.scriptScope??"shared",s?.scriptTimeout??5e3)}}httpClient;forgeEnv;cookieJar;preprocessor;scriptExecutor;async execute(e,r,n={}){let i=Date.now(),s={...this.forgeEnv.getAll()},o={...this.forgeEnv.getGlobals()},l={...n.additionalVariables||{}},c={...s},d=this.buildHttpRequest(e,n.overrides),p=n.overrides?.body||e.body,m=this.findFolderPath(r,e.id),y=this.buildScriptChain(e,r,m),b={request:{url:d.url,method:d.method,headers:{...d.headers},body:p?typeof p=="string"?{type:"raw",content:p}:p:void 0},variables:l,collectionVariables:r.variables||{},globals:{...o},environmentVariables:c,environmentName:this.forgeEnv.getActiveEnvironment?.()||void 0,cookieJar:this.cookieJar,info:{eventName:"prerequest",requestName:e.name,requestId:e.id,collectionName:r?.name},onEnvironmentChange:n.onEnvironmentChange,onGlobalsChange:(_,E,k)=>{_==="set"&&E&&k!==void 0?this.forgeEnv.setGlobal(E,k):_==="unset"&&E?this.forgeEnv.unsetGlobal(E):_==="clear"&&this.forgeEnv.clearGlobals()}},q=this.scriptExecutor.createRequestSession(b),C,v;try{if(!n.skipPreRequest&&y.preRequest.length>0){let O=await q.executePreRequest(y.preRequest);if(C={success:O.success,error:O.error,modifiedVariables:O.modifiedVariables,modifiedEnvironment:O.modifiedEnvironmentVariables,modifiedGlobals:O.modifiedGlobals,modifiedCollectionVariables:O.modifiedCollectionVariables,consoleOutput:O.consoleOutput,modifiedRequest:O.modifiedRequest?{url:O.modifiedRequest.url,method:O.modifiedRequest.method,headers:O.modifiedRequest.headers,body:O.modifiedRequest.body?.content}:void 0},O.modifiedVariables&&(l={...l,...O.localVariables??O.modifiedVariables}),O.modifiedEnvironmentVariables&&(c={...c,...O.modifiedEnvironmentVariables}),O.modifiedRequest){let M=O.modifiedRequest;M.url&&(d.url=M.url),M.method&&(d.method=M.method),M.headers&&(d.headers={...d.headers,...M.headers}),M.body!==void 0&&(d.body=M.body?.content||M.body)}if(!O.success)throw new Error(`Pre-request script failed: ${O.error}`)}let _={...c,...l};d=this.interpolateRequest(d,_);let E=n.overrides?.body||e.body;if(this.preprocessor&&E&&typeof E!="string"&&E.type==="graphql"&&d.body!==void 0){let O=this.preprocessor.encodeBody({type:"graphql",content:d.body});O!=null&&(d.body=typeof O=="string"?O:JSON.stringify(O))}if(p&&typeof p=="object"&&p.type==="form-data"&&Array.isArray(d.body)){let O=this.buildMultipartFormData({type:"form-data",content:d.body});O&&(d.body=O)}let k=await this.httpClient.send(d);if(!n.skipPostResponse&&y.postResponse.length>0){let O=await q.executePostResponse(y.postResponse,{status:k.status,statusText:k.statusText,headers:k.headers,body:k.body,cookies:Cm(k.headers,k.cookies,d.url),responseTime:k.time,responseSize:k.size,executedRequest:{url:d.url,method:d.method,headers:d.headers||{},body:d.body?typeof d.body=="string"?{type:"raw",content:d.body}:d.body:{type:"none",content:""},params:{},query:{}}});v={success:!0,assertions:O.testResults,consoleOutput:O.consoleOutput,modifiedEnvironment:O.modifiedEnvironmentVariables},O.modifiedEnvironmentVariables&&(c={...c,...O.modifiedEnvironmentVariables})}return{response:k,preRequestResult:C,postResponseResult:v,totalTime:Date.now()-i,finalRequest:d,variables:{environment:c,local:l}}}finally{q.dispose?.()}}async executeSimple(e,r={}){let n=e,i={...this.forgeEnv.getAll(),...r.variables||{}};return n=this.interpolateRequest(e,i),r.timeout&&(n={...n,timeout:r.timeout}),this.httpClient.send(n)}buildHttpRequest(e,r){let n=e.url;if(e.query&&e.query.length>0){let p=new URLSearchParams;for(let m of e.query)m.enabled!==!1&&p.append(m.key,m.value);n+=(n.includes("?")?"&":"?")+p.toString()}let i=r?.url||n,s=r?.method||e.method,o={};if(e.headers&&Array.isArray(e.headers))for(let p of e.headers)p.enabled!==!1&&(o[p.key]=p.value);let l={...o,...r?.headers||{}},c,d=r?.body||e.body;if(d)if(typeof d=="string")c=d;else if(this.preprocessor&&d.type)if(d.type==="graphql")c=typeof d.content=="string"?d.content:JSON.stringify(d.content);else if(d.type==="form-data")c=this.buildMultipartFormData(d);else{let p=this.preprocessor.encodeBody(d);c=p!=null?String(p):void 0}else d.content&&(c=typeof d.content=="string"?d.content:JSON.stringify(d.content));return this.preprocessor&&d&&d.type!=="form-data"&&this.preprocessor.setContentTypeHeader(l,d),{url:i,method:s,headers:l,body:c,timeout:r?.timeout||e.settings?.timeout,settings:{...e.settings,...r?.settings}}}interpolateRequest(e,r){let n=ao.create(r),i=e.body,s=i;return typeof i=="string"?s=n.resolve(i):i instanceof FormData||i instanceof URLSearchParams?s=i:i&&typeof i=="object"&&(s=n.resolve(i)),{...e,url:n.resolvePath(e.url),headers:n.resolveObject(e.headers),body:s}}buildMultipartFormData(e){if(!e||e.type!=="form-data"||!Array.isArray(e.content))return;let r=new FormData;for(let n of e.content)!n?.key||n.enabled===!1||r.append(n.key,n.value==null?"":String(n.value));return r}buildScriptChain(e,r,n=[]){let i=[],s=[];r.scripts?.preRequest&&i.push(r.scripts.preRequest),r.scripts?.postResponse&&s.push(r.scripts.postResponse);for(let o of n)o.scripts?.preRequest&&i.push(o.scripts.preRequest),o.scripts?.postResponse&&s.push(o.scripts.postResponse);return e.scripts?.preRequest&&i.push(e.scripts.preRequest),e.scripts?.postResponse&&s.push(e.scripts.postResponse),{preRequest:i,postResponse:s}}findFolderPath(e,r){let n=[],i=(s,o)=>{for(let l of s){if(l.type==="request"&&l.id===r)return n.push(...o),!0;if(l.type==="folder"){let c=[...o,l];if(i(l.items,c))return!0}}return!1};return i(e.items,[]),n}};function hz(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}var Wf=class{entries=new Map;requestIndex=new Map;fullResponses=new Map;maxEntriesPerRequest;storeFullResponses;constructor(e={}){this.maxEntriesPerRequest=e.maxEntriesPerRequest??100,this.storeFullResponses=e.storeFullResponses??!0}getEntries(e,r){let n=this.requestIndex.get(e)||[],i=[];for(let s of n){let o=this.entries.get(s);o&&(!r||o.environment===r)&&i.push(o)}return i}getEntry(e){return this.entries.get(e)}getFullResponse(e){return this.fullResponses.get(e)}get count(){return this.entries.size}addEntry(e,r,n,i,s){let o=hz(),l=Date.now(),c={id:o,timestamp:l,environment:i,method:r.method,ticket:s?.ticket,branch:s?.branch,note:s?.note,sentRequest:{url:r.url,method:r.method,headers:{...r.headers},body:r.body},response:{status:n.status,statusText:n.statusText,time:n.time}};this.entries.set(o,c);let d=this.requestIndex.get(e)||[];for(d.unshift(o);d.length>this.maxEntriesPerRequest;){let p=d.pop();p&&(this.entries.delete(p),this.fullResponses.delete(p))}if(this.requestIndex.set(e,d),this.storeFullResponses){let p={timestamp:l,status:n.status,statusText:n.statusText,headers:{...n.headers},cookies:n.cookies||[],body:n.body,time:n.time};this.fullResponses.set(o,p)}return c}deleteEntry(e){if(!this.entries.get(e))return!1;this.entries.delete(e),this.fullResponses.delete(e);for(let[n,i]of this.requestIndex.entries()){let s=i.indexOf(e);if(s!==-1){i.splice(s,1),i.length===0&&this.requestIndex.delete(n);break}}return!0}clearHistory(e){let r=this.requestIndex.get(e);if(r){for(let n of r)this.entries.delete(n),this.fullResponses.delete(n);this.requestIndex.delete(e)}}clearAll(){this.entries.clear(),this.requestIndex.clear(),this.fullResponses.clear()}};var zf=class{async send(e){let r=Date.now(),n=new AbortController,i=e.timeout??3e4,s=setTimeout(()=>n.abort(),i);try{let o={method:e.method,headers:e.headers,signal:n.signal};e.body!==void 0&&!["GET","HEAD"].includes(e.method.toUpperCase())&&(typeof e.body=="string"||e.body instanceof FormData||e.body instanceof URLSearchParams?o.body=e.body:typeof e.body=="object"&&(o.body=JSON.stringify(e.body),!e.headers?.["Content-Type"]&&!e.headers?.["content-type"]&&(o.headers["Content-Type"]="application/json"))),e.settings?.followRedirects===!1&&(o.redirect="manual");let l=await fetch(e.url,o),c=Date.now(),d;try{d=await l.text()}catch{d=null}let p={};return l.headers.forEach((m,y)=>{let b=p[y];b!==void 0?p[y]=Array.isArray(b)?[...b,m]:[b,m]:p[y]=m}),{status:l.status,statusText:l.statusText,headers:p,cookies:[],body:d,time:c-r}}catch(o){throw o.name==="AbortError"?new Error(`Request timeout after ${i}ms`):o}finally{clearTimeout(s)}}};cf();ff();Jf();qm();Xl();var Fa=class{format="http-forge";canParse(e){try{let r=JSON.parse(e);return typeof r=="object"&&r!==null&&"id"in r&&"name"in r&&"items"in r&&Array.isArray(r.items)&&!r.info?.schema?.includes("postman")&&!r._type}catch{return!1}}parse(e,r){let n=JSON.parse(e);return{id:n.id,name:n.name,description:n.description,variables:n.variables||{},auth:n.auth,scripts:n.scripts?{preRequest:n.scripts.preRequest,postResponse:n.scripts.postResponse}:void 0,items:this.convertItems(n.items),source:{format:"http-forge",filePath:r,version:n.version}}}convertItems(e){return e.map(r=>r.type==="folder"?this.convertFolder(r):this.convertRequest(r))}convertFolder(e){return{type:"folder",id:e.id,name:e.name,description:e.description,auth:e.auth,scripts:e.scripts?{preRequest:e.scripts.preRequest,postResponse:e.scripts.postResponse}:void 0,items:e.items?this.convertItems(e.items):[]}}convertRequest(e){let r={};if(e.headers)for(let i of e.headers)i.enabled!==!1&&(r[i.key]=i.value);let n={};if(e.query)for(let i of e.query)i.enabled!==!1&&(n[i.key]=i.value);return{type:"request",id:e.id,name:e.name,description:e.description,method:e.method||"GET",url:e.url||"",headers:Object.entries(r).map(([i,s])=>({key:i,value:s,enabled:!0})),query:Object.entries(n).map(([i,s])=>({key:i,value:s,enabled:!0})),params:e.params,body:e.body,auth:e.auth,settings:e.settings,scripts:e.scripts?{preRequest:e.scripts.preRequest,postResponse:e.scripts.postResponse}:void 0}}};Om();import*as _n from"fs/promises";import*as _u from"path";var Gf=class{async readFile(e){return _n.readFile(e,"utf-8")}async writeFile(e,r){let n=_u.dirname(e);await this.mkdir(n),await _n.writeFile(e,r,"utf-8")}async exists(e){try{return await _n.access(e),!0}catch{return!1}}async mkdir(e){await _n.mkdir(e,{recursive:!0})}async glob(e,r){let n=r||process.cwd(),i=[];try{await this.walkDirectory(n,s=>{let o=_u.basename(s);for(let l of e)if(this.matchPattern(o,l)){i.push(s);break}})}catch{}return i}async readDir(e){return _n.readdir(e)}async isDirectory(e){try{return(await _n.stat(e)).isDirectory()}catch{return!1}}async walkDirectory(e,r){let n=await _n.readdir(e,{withFileTypes:!0});for(let i of n){let s=_u.join(e,i.name);i.isDirectory()?await this.walkDirectory(s,r):i.isFile()&&r(s)}}matchPattern(e,r){let n=r.replace(/\./g,"\\.").replace(/\*/g,".*");return new RegExp(`^${n}$`,"i").test(e)}};Vf();var l0=class t{httpClient;fileSystem;scriptExecutor;interpolator;cookieJar;interceptorChain;preprocessor;dataFileParser;requestHistory;parserRegistry;collectionLoader;environmentStore;forgeEnv;requestExecutor;options;constructor(e={}){if(this.options=e,this.interpolator=e.interpolator||new wa,this.fileSystem=e.fileSystem||new Gf,this.preprocessor=e.preprocessor||new Ma,this.dataFileParser=e.dataFileParser||new Da,this.cookieJar=e.cookieJar||new rf,e.enableHistory?this.requestHistory=e.requestHistory||new Wf({maxEntriesPerRequest:e.maxHistoryEntries??100}):this.requestHistory=null,this.interceptorChain=e.interceptorChain||this.createInterceptorChain(e),e.httpClient)this.httpClient=e.httpClient;else if(e.useNativeHttp!==!1){let s={...e.httpSettings,timeout:e.requestTimeout??e.httpSettings?.timeout};this.httpClient=new Na(s)}else this.httpClient=new zf;let r=e.forgeRoot?[_t("path").join(e.forgeRoot,"modules")]:[],n=new vs(new li,this.interceptorChain,this.httpClient);if(this.scriptExecutor=e.scriptExecutor||new Cs(n,r,void 0,e.scriptScope??"shared",e.scriptTimeout??5e3),this.parserRegistry=new tf,this.parserRegistry.register("http-forge",new Fa),(e.storageFormat??"folder")==="folder"&&e.forgeRoot){let s=_t("path").join(e.forgeRoot,"collections");this.collectionLoader=new ef(s)}else this.collectionLoader=new Zl(this.fileSystem,this.parserRegistry);this.environmentStore=e.environmentConfig?new gs(e.environmentConfig):gs.fromVariables({}),this.forgeEnv=ao.fromResolver(this.environmentStore),this.requestExecutor=new wu(this.httpClient,this.forgeEnv,this.cookieJar,this.preprocessor,{forgeRoot:e.forgeRoot,scriptExecutor:this.scriptExecutor})}createInterceptorChain(e){let r=new bs;if(e.requestInterceptors)for(let n of e.requestInterceptors)r.addRequestInterceptor(n);if(e.responseInterceptors)for(let n of e.responseInterceptors)r.addResponseInterceptor(n);if(e.errorInterceptors)for(let n of e.errorInterceptors)r.addErrorInterceptor(n);return r}async loadCollection(e){if(this.collectionLoader instanceof Zl)return this.collectionLoader.load(e);throw new Error("loadCollection(filePath) is not supported with folder storage format. Use loadAllCollections() instead.")}async loadAllCollections(){return this.collectionLoader.loadAll()}async execute(e,r,n){return this.requestExecutor.execute(e,r,n)}async executeSimple(e,r){return this.requestExecutor.executeSimple(e,r)}registerParser(e,r){this.parserRegistry.register(e,r)}setEnvironmentConfig(e){this.environmentStore=new gs(e),this.forgeEnv=ao.fromResolver(this.environmentStore),this.requestExecutor=new wu(this.httpClient,this.forgeEnv,this.cookieJar,this.preprocessor,{forgeRoot:this.options.forgeRoot,scriptExecutor:this.scriptExecutor})}static create(e){return new t(e)}static fromForgeRoot(e="./http-forge",r={}){let n=_t("path"),i=n.join(e,"environments"),s,o=nf(i);if(Object.keys(o.environments).length>0||Object.keys(o.globalVariables).length>0){s={globalVariables:{...o.globalVariables,...o.localVariables},environments:{},selectedEnvironment:void 0};for(let[c,d]of Object.entries(o.environments)){let p=o.localCredentials[c]?.variables||{};s.environments[c]={name:c,variables:{...d.variables,...p}}}}else{let c=_t("fs"),d=n.join(i,"environments.json");if(c.existsSync(d))try{let p=c.readFileSync(d,"utf-8"),m=JSON.parse(p);if(s={globalVariables:m.globalVariables||{},environments:{},selectedEnvironment:m.selectedEnvironment},m.environments)for(let[y,b]of Object.entries(m.environments)){let q=b;s.environments[y]={name:q.name||y,variables:q.variables||{}}}}catch(p){console.warn(`[ForgeContainer] Failed to load environments from ${d}:`,p)}}return new t({...r,forgeRoot:e,storageFormat:r.storageFormat??"folder",environmentConfig:s})}};DC();jC();wy();Ei();zC();GC();YC();cx();Py();sp();async function K5(t){let{createMcpRuntime:e}=await Promise.resolve().then(()=>(qN(),EN));return e(t)}async function Q5(t){let{runRequest:e}=await Promise.resolve().then(()=>(pc(),hp));return e(t)}async function Z5(t){let{runCollection:e}=await Promise.resolve().then(()=>(pc(),hp));return e(t)}async function X5(t){let{runFolder:e}=await Promise.resolve().then(()=>(pc(),hp));return e(t)}async function e7(t){let{runSuite:e}=await Promise.resolve().then(()=>(pc(),hp));return e(t)}Ny();g0();ga();fx();y0();cf();ff();Jf();function t7(t){return{timeout:t?.timeout??wn.timeout,followRedirects:t?.followRedirects??wn.followRedirects,followOriginalMethod:t?.followOriginalMethod??wn.followOriginalMethod,followAuthHeader:t?.followAuthHeader??wn.followAuthHeader,maxRedirects:t?.maxRedirects??wn.maxRedirects,strictSSL:t?.strictSSL??wn.strictSSL,decompress:t?.decompress??wn.decompress,includeCookies:t?.includeCookies??wn.includeCookies,tls:t?.tls??wn.tls,certificates:t?.certificates??wn.certificates}}Jf();qm();Xl();e0();i0();Vf();_m();Hf();od();d0();h0();Ph();ma();ma();f0();function r7(t){let e=t.replace(/\\\n/g," "),r=[],n="",i=0;for(;i<e.length;){let s=e[i];if(s==="\\"&&i+1<e.length)n+=e[++i],i++;else if(s==="'"){for(i++;i<e.length&&e[i]!=="'";)n+=e[i++];i++}else if(s==='"'){for(i++;i<e.length&&e[i]!=='"';)if(e[i]==="\\"&&i+1<e.length){let o=e[i+1];o==='"'||o==="\\"||o==="$"||o==="`"?(n+=o,i+=2):n+=e[i++]}else n+=e[i++];i++}else/\s/.test(s)?(n.length>0&&(r.push(n),n=""),i++):(n+=s,i++)}return n.length>0&&r.push(n),r}function n7(t){try{let e="__FV__",r=[],n=t.replace(/\{\{[^}]+\}\}/g,p=>(r.push(p),`${e}${r.length-1}`)),i=n.indexOf("?");if(i===-1)return{cleanUrl:t,params:[]};let s=n.slice(0,i),o=n.slice(i+1),l=p=>p.replace(new RegExp(`${e}(\\d+)`,"g"),(m,y)=>r[parseInt(y,10)]),c=l(s),d=o.split("&").filter(Boolean).map(p=>{let m=l(p),y=m.indexOf("=");return y===-1?{key:m,value:"",enabled:!0}:{key:decodeURIComponent(m.slice(0,y)),value:decodeURIComponent(m.slice(y+1)),enabled:!0}});return{cleanUrl:c,params:d}}catch{return{cleanUrl:t,params:[]}}}function i7(t){try{let e=new URL(t.replace(/\{\{[^}]+\}\}/g,"placeholder")),r=e.pathname.split("/").filter(Boolean),n=r[r.length-1];return n&&!/^\d+$/.test(n)&&!n.startsWith("{")?n.replace(/[-_]/g," ").replace(/\b\w/g,i=>i.toUpperCase()):r.length>1?r[r.length-2].replace(/[-_]/g," ").replace(/\b\w/g,i=>i.toUpperCase()):e.hostname.replace(/^www\./,"").split(".")[0]??"Request"}catch{return"Request"}}var s7=new Set(["x-api-key","x-auth-token","x-access-token","x-token","x-secret","api-key","apikey","x-client-secret","x-rapidapi-key"]),o7=new Set(["api_key","apikey","api-key","access_token","token","auth_token","client_id","client_secret","key","secret"]);function ON(t){return t.toUpperCase().replace(/[^A-Z0-9]/g,"_")}function IN(t){return/\{\{[^}]+\}\}/.test(t)}function Dy(t,e=16){return t.length>=e&&!IN(t)}function a7(t,e,r){let n=[],i=new Set,s=(o,l)=>{i.has(l)||(i.add(l),n.push({key:o,value:l}))};for(let o of t){let l=o.key.toLowerCase();if(l==="authorization"){let c=o.value.match(/^(bearer|basic|token|digest)\s+(.+)$/i);c&&Dy(c[2])?s(`${c[1].toUpperCase()}_TOKEN`,c[2]):Dy(o.value)&&s("AUTH_TOKEN",o.value)}else s7.has(l)&&Dy(o.value)&&s(ON(o.key),o.value)}for(let o of e)o7.has(o.key.toLowerCase())&&Dy(o.value)&&s(ON(o.key),o.value);try{let o=new URL(r.replace(/\{\{[^}]+\}\}/g,"placeholder"));if(!["localhost","127.0.0.1","0.0.0.0","::1"].includes(o.hostname)&&!IN(r)){let c=`${o.protocol}//${o.host}`;s("BASE_URL",c)}}catch{}return n}function l7(t){let e=r7(t.trim()),r=0;for(;r<e.length&&e[r].toLowerCase()==="curl";)r++;let n=e.slice(r),i="",s="",o=[],l=null,c=!1,d=!1,p=[],m=[],y=0;for(;y<n.length;){let E=n[y];if(E==="-X"||E==="--request")i=n[++y]??"";else if(E==="-H"||E==="--header"){let k=n[++y]??"",O=k.indexOf(":");O>0&&o.push({key:k.slice(0,O).trim(),value:k.slice(O+1).trim()})}else if(E==="-d"||E==="--data"||E==="--data-raw"||E==="--data-binary"||E==="--data-ascii")l=n[++y]??"";else if(E==="--json")l=n[++y]??"",c=!0;else if(E==="-u"||E==="--user"){let k=n[++y]??"",O=btoa(k);o.push({key:"Authorization",value:`Basic ${O}`})}else if(E==="-b"||E==="--cookie")o.push({key:"Cookie",value:n[++y]??""});else if(E==="--url")s=n[++y]??"";else if(E==="-G"||E==="--get")d=!0;else if(E==="-F"||E==="--form"){let k=n[++y]??"",O=k.indexOf("=");O>0&&p.push({key:k.slice(0,O),value:k.slice(O+1)})}else E==="--data-urlencode"?m.push(n[++y]??""):E==="-A"||E==="--user-agent"?o.push({key:"User-Agent",value:n[++y]??""}):E==="-e"||E==="--referer"||E==="--referrer"?o.push({key:"Referer",value:n[++y]??""}):E==="--compressed"||E==="-L"||E==="--location"||E==="-v"||E==="--verbose"||E==="-s"||E==="--silent"||E==="-i"||E==="--include"||E==="-k"||E==="--insecure"||E==="--http1.1"||E==="--http2"||E==="--http3"||(E==="-o"||E==="--output"||E==="--max-time"||E==="--connect-timeout"||E==="-m"||E==="--limit-rate"||E==="--proxy"||E==="-x"?y++:!E.startsWith("-")&&!s&&(s=E));y++}d?i="GET":i||(i=l!==null||p.length>0||m.length>0?"POST":"GET");let{cleanUrl:b,params:q}=n7(s),C=null;if(p.length>0)C={type:"raw",format:"text",content:p.map(k=>`${encodeURIComponent(k.key)}=${encodeURIComponent(k.value)}`).join("&")},o.some(k=>k.key.toLowerCase()==="content-type")||o.push({key:"Content-Type",value:"multipart/form-data"});else if(m.length>0)C={type:"raw",format:"text",content:m.join("&")},o.some(E=>E.key.toLowerCase()==="content-type")||o.push({key:"Content-Type",value:"application/x-www-form-urlencoded"});else if(l!==null){let E=l.trim(),k=c||E.startsWith("{")||E.startsWith("[");C={type:"raw",format:k?"json":"text",content:l},k&&!o.some(O=>O.key.toLowerCase()==="content-type")&&o.push({key:"Content-Type",value:"application/json"})}let v=o.map(E=>({...E,enabled:!0})),_=a7(o,q,b||s);return{name:i7(b||s),method:i.toUpperCase(),url:b||s,headers:v,queryParams:q,body:C,suggestedVars:_}}async function u7(t,e,r,n){let i=PN(t.items);if(i.length===0)return;let s=Math.ceil(i.length/10);for(let o=0;o<i.length;o+=10){let l=i.slice(o,o+10),c=Math.floor(o/10)+1;n?.(`Enhancing requests (batch ${c}/${s})\u2026`,1/s*100);let d=l.map(p=>({id:p.id,name:p.name,method:p.method??"GET",url:p.url??"",bodyContent:p7(p),responseSchema:p.responseSchema?JSON.stringify(p.responseSchema).slice(0,500):void 0,description:p.description?.slice(0,200)}));try{let p=await r.complete(c7(d)),m=f7(p);d7(l,m)}catch{}}await e.saveCollection(t)}function c7(t){return`You are an API testing expert. For each HTTP request below, return two improvements:
|
|
1022
1022
|
1. "body" \u2014 a realistic, human-readable JSON request body string (not schema placeholders like "string" or 0). If the request has no body or is a GET/HEAD/DELETE, return null.
|
|
1023
1023
|
2. "testScript" \u2014 a JavaScript postResponse test using pm.test() syntax. Always include a status code check. Add response body assertions if a responseSchema is provided.
|
|
1024
1024
|
|