@redocly/replay 0.29.0-next.1 → 0.29.0-next.2

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.
Files changed (54) hide show
  1. package/dist/{replay-AiChatProvider-B1_-wlJK.js → replay-AiChatProvider-6XfGmlMO.js} +1 -1
  2. package/dist/{replay-AiChatProvider-Z_799APd.js → replay-AiChatProvider-CRI2UTsZ.js} +6 -6
  3. package/dist/{replay-AiChatSqliteDBStorage-B9waB0dA.js → replay-AiChatSqliteDBStorage-BlEocJgY.js} +1 -1
  4. package/dist/{replay-AiChatSqliteDBStorage-C_-_P0T7.js → replay-AiChatSqliteDBStorage-DA-eJh6c.js} +1 -1
  5. package/dist/{replay-AiPanel-IRetnmbM.js → replay-AiPanel-DYVgRVdG.js} +1 -1
  6. package/dist/{replay-AiPanel-DvSoNrnz.js → replay-AiPanel-ZrR1tDqo.js} +4 -4
  7. package/dist/{replay-FileWatcher-CUqV5dPp.js → replay-FileWatcher-BNFHO596.js} +1 -1
  8. package/dist/{replay-FileWatcher-CZZXT8GC.js → replay-FileWatcher-CELEsith.js} +2 -2
  9. package/dist/{replay-SemanticSearchService-B8R-ATMA.js → replay-SemanticSearchService-BEk_dTbd.js} +1 -1
  10. package/dist/{replay-SemanticSearchService-BzE8FK8a.js → replay-SemanticSearchService-Dooeje9n.js} +1 -1
  11. package/dist/{replay-SqliteDBStorage-DVQZek3n.js → replay-SqliteDBStorage-3K7IPlJU.js} +1 -1
  12. package/dist/{replay-SqliteDBStorage-CPOEQnSp.js → replay-SqliteDBStorage-CLSBc7bS.js} +1 -1
  13. package/dist/{replay-TauriFileSystemAdapter-Zb6LTS_-.js → replay-TauriFileSystemAdapter-BvJ1azsj.js} +1 -1
  14. package/dist/{replay-TauriFileSystemAdapter-BfE1TXkK.js → replay-TauriFileSystemAdapter-D-IrcgXM.js} +1 -1
  15. package/dist/{replay-TauriRootStorage-BY7MGWGe.js → replay-TauriRootStorage-DylcqkvS.js} +1 -1
  16. package/dist/{replay-TauriRootStorage-CUGppZsY.js → replay-TauriRootStorage-b3tjVs4a.js} +2 -2
  17. package/dist/{replay-agent-loop-BxPUGZq1.js → replay-agent-loop-Dev3mG-o.js} +3 -3
  18. package/dist/{replay-agent-loop-BB-UIrKo.js → replay-agent-loop-DgP7lcS9.js} +1 -1
  19. package/dist/{replay-ai-chat-mappers-C4L8p2zl.js → replay-ai-chat-mappers-B6nh9aAX.js} +1 -1
  20. package/dist/{replay-ai-chat-mappers-DAyPOhQn.js → replay-ai-chat-mappers-f3kvLmAu.js} +1 -1
  21. package/dist/{replay-create-model-BnoDQ7OX.js → replay-create-model-CKCKpcry.js} +3 -3
  22. package/dist/{replay-create-model-ebcSRl3r.js → replay-create-model-DWPoobaj.js} +3 -3
  23. package/dist/{replay-db-xD_5VGuR.js → replay-db-B6aY7_xq.js} +1 -1
  24. package/dist/{replay-db-og5UtVrp.js → replay-db-C5zt3C9P.js} +1 -1
  25. package/dist/{replay-external-resolver-1bxcPBye.js → replay-external-resolver-CnBhw18p.js} +1 -1
  26. package/dist/{replay-external-resolver-DtqY6Ddl.js → replay-external-resolver-vQRj5DBT.js} +2 -2
  27. package/dist/{replay-index-PEthMsJx.js → replay-index-CG98QK-s.js} +5 -5
  28. package/dist/{replay-index-LcDbGH39.js → replay-index-CucrJtfX.js} +12 -12
  29. package/dist/{replay-index-C7MCjO6i.js → replay-index-D5Z0mNdH.js} +1 -1
  30. package/dist/{replay-index-C33Z16Rm.js → replay-index-DK7gbiWU.js} +22 -22
  31. package/dist/replay-index-Ea2twOHC.js +4 -0
  32. package/dist/{replay-index-rbCwID24.js → replay-index-_gr2NUI6.js} +1 -1
  33. package/dist/{replay-index-Clfun2IN.js → replay-index-kTnSyklR.js} +1 -1
  34. package/dist/{replay-index-wPsTqXSf.js → replay-index-qjs9VMHC.js} +1 -1
  35. package/dist/{replay-lint-CVXT7IME.js → replay-lint-B27guSWl.js} +3 -3
  36. package/dist/{replay-lint-fhGv2lgR.js → replay-lint-BMx3SufP.js} +3 -3
  37. package/dist/{replay-lint-graphql-BhMbXKkF.js → replay-lint-graphql-Ddb-P1_x.js} +1 -1
  38. package/dist/{replay-lint-graphql-DtQhF_PM.js → replay-lint-graphql-DttNVvr_.js} +1 -1
  39. package/dist/{replay-periodic-revalidation-KHXYhF4T.js → replay-periodic-revalidation--AI8Odct.js} +1 -1
  40. package/dist/{replay-periodic-revalidation-Cuzq23M8.js → replay-periodic-revalidation-B3_dehdk.js} +1 -1
  41. package/dist/{replay-resolve-C2l91lf8.js → replay-resolve-CF2p-q2m.js} +1 -1
  42. package/dist/{replay-resolve-C0VBozxM.js → replay-resolve-CVaipzl1.js} +1 -1
  43. package/dist/{replay-respect-run-BN4jlLVY.js → replay-respect-run-CMwBljW2.js} +1 -1
  44. package/dist/{replay-respect-run-B25T_yI0.js → replay-respect-run-D8MFUbGR.js} +3 -3
  45. package/dist/{replay-tauri-path-DpnuyiYr.js → replay-tauri-path-00tVitOG.js} +2 -2
  46. package/dist/{replay-tauri-path-9tVlry3g.js → replay-tauri-path-CNqnykPe.js} +1 -1
  47. package/dist/{replay-useAiChatQueries-Bi_6G8WU.js → replay-useAiChatQueries-1FXgtUM0.js} +1 -1
  48. package/dist/{replay-useAiChatQueries-DLSFwWvn.js → replay-useAiChatQueries-B1lLdezQ.js} +4 -4
  49. package/dist/{replay-validate-key-BQB45O00.js → replay-validate-key-BY6-63zj.js} +1 -1
  50. package/dist/{replay-validate-key-DnQefCz3.js → replay-validate-key-CQrY8WaE.js} +2 -2
  51. package/dist/replay.cjs +1 -1
  52. package/dist/replay.js +1 -1
  53. package/package.json +2 -2
  54. package/dist/replay-index-_srgnXqd.js +0 -4
@@ -370,7 +370,7 @@ ${X}`,xe=Math.min(I.length,E);let de=0;for(;de<xe-1;de++){const pe=R(String(de),
370
370
  ${z}`,q.pop(),`[${te}]`}let W=Object.keys(I);const B=W.length;if(B===0)return"{}";if($<q.length+1)return'"[Object]"';X+=j;const F=`,
371
371
  ${X}`;let G="",ee="",ie=Math.min(B,E);l(I)&&(G+=c(I,F,E),W=W.slice(I.length),ie-=I.length,ee=F),k&&(W=o(W,T)),q.push(I);for(let te=0;te<ie;te++){const le=W[te],xe=R(le,I[le],q,j,X);xe!==void 0&&(G+=`${ee}${s(le)}: ${xe}`,ee=F)}if(B>E){const te=B-E;G+=`${ee}"...": "${m(te)} not stringified"`,ee=F}return ee!==""&&(G=`
372
372
  ${X}${G}
373
- ${z}`),q.pop(),`{${G}}`}case"number":return isFinite(I)?String(I):y?y(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return y?y(I):void 0}}function M(V,I,q){switch(typeof I){case"string":return s(I);case"object":{if(I===null)return"null";if(typeof I.toJSON=="function"){if(I=I.toJSON(V),typeof I!="object")return M(V,I,q);if(I===null)return"null"}if(q.indexOf(I)!==-1)return w;let j="";const X=I.length!==void 0;if(X&&Array.isArray(I)){if(I.length===0)return"[]";if($<q.length+1)return'"[Array]"';q.push(I);const G=Math.min(I.length,E);let ee=0;for(;ee<G-1;ee++){const te=M(String(ee),I[ee],q);j+=te!==void 0?te:"null",j+=","}const ie=M(String(ee),I[ee],q);if(j+=ie!==void 0?ie:"null",I.length-1>E){const te=I.length-E-1;j+=`,"... ${m(te)} not stringified"`}return q.pop(),`[${j}]`}let z=Object.keys(I);const W=z.length;if(W===0)return"{}";if($<q.length+1)return'"[Object]"';let B="",F=Math.min(W,E);X&&l(I)&&(j+=c(I,",",E),z=z.slice(I.length),F-=I.length,B=","),k&&(z=o(z,T)),q.push(I);for(let G=0;G<F;G++){const ee=z[G],ie=M(ee,I[ee],q);ie!==void 0&&(j+=`${B}${s(ee)}:${ie}`,B=",")}if(W>E){const G=W-E;j+=`${B}"...":"${m(G)} not stringified"`}return q.pop(),`{${j}}`}case"number":return isFinite(I)?String(I):y?y(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return y?y(I):void 0}}function L(V,I,q){if(arguments.length>1){let j="";if(typeof q=="number"?j=" ".repeat(Math.min(q,10)):typeof q=="string"&&(j=q.slice(0,10)),I!=null){if(typeof I=="function")return _("",{"":V},[],I,j,"");if(Array.isArray(I))return D("",V,[],g(I),j,"")}if(j.length!==0)return R("",V,[],j,"")}return M("",V,[])}return L}})(_m,_m.exports)),_m.exports}var Qbe=Abe();const Rbe=Ia(Qbe),jbe=Rbe.configure;class $p extends mbe{static maxErrorTextChars=4096;static stringify=jbe({maximumDepth:2,maximumBreadth:10});sendErrorEvent;constructor(e,n){super("errors","1.0",e||{}),this.sendErrorEvent=n}static toErrorEvent(e,n){return{type:"error",payload:[{handler:n,errorType:this.getErrorType(e),message:this.getErrorMessage(e),stack:this.getErrorStack(e)}]}}enable(){window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this._wrap(console,"error",this.patchConsoleError())}disable(){window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),this._unwrap(console,"error")}init(){}static getErrorMessage(e){return e?(typeof e=="object"&&"message"in e?String(e.message):String(e)).trim():void 0}static getErrorStack(e){if(!e||typeof e!="object"||!("stack"in e)||!e.stack)return;const n=String(e.stack);return n.length>this.maxErrorTextChars?n.substring(0,this.maxErrorTextChars):n}static getErrorType(e){return!e||typeof e!="object"?typeof e:"name"in e?String(e.name):"constructor"in e&&"name"in e.constructor?String(e.constructor.name):"Error"}static combineConsoleErrorArgs(e){const n=e.findIndex(i=>i instanceof Error),r=e.filter((i,s)=>s!==n).map(i=>typeof i=="string"?i:i instanceof Error?String(i):this.stringify(i)??String(i)).join(" ").substring(0,this.maxErrorTextChars);if(n===-1)return r;{const i=e[n];return r&&(i.message=`${i.message} ${r}`),i}}onError=e=>{this.sendError(e.error,"window.onerror")};onUnhandledRejection=e=>{this.sendError(e.reason,"window.onunhandledrejection")};patchConsoleError(){return e=>{const n=this;return function(...i){try{const s=$p.combineConsoleErrorArgs(i);n.sendError(s,"console.error")}catch(s){process.env.NODE_ENV!=="production"&&e?.call(this,"Error reporting failed:",s)}e?.apply(this,i)}}}sendError(e,n){this.sendErrorEvent($p.toErrorEvent(e,n))}}class _be{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new Ebe,this.tracer={traceStep:(e,n)=>{const r=this.constructCloudEvent(e,n,{signal:"trace"});return this.otelClient.traceStep(r)}}}updateCloudEventData=e=>{this.config?.disabled||(this.useCloudEventData=e)};send(e,n,r){try{if(!this.config?.otel.isProd)return;const s=e&&typeof e=="object"&&"type"in e&&"data"in e?e:this.constructCloudEvent(e,n,{...r,signal:"log"});this.sendToOtelService(s)}catch(i){this.config?.otel.isProd||console.error("Event reporting failed:",i)}}init(e){e.disabled||this.initialized||(this.config=e,this.initialized=!0,this.otelClient.init({serviceVersion:e.otel.serviceVersion,version:e.otel.version,isProd:e.otel.isProd,collectorUrl:e.otel.collectorUrl,collectorTraceUrl:e.otel.collectorTraceUrl,serviceName:e.otel.serviceName,tracerName:e.otel.tracerName,spanProcessors:e.otel.spanProcessors,registerGlobalTracerProvider:e.otel.registerGlobalTracerProvider,instrumentations:[...e.otel.enableErrorInstrumentation===!0?[new $p(void 0,n=>{this.sendToOtelService({type:n.type,data:n.payload})})]:[],...e.otel.instrumentations||[]]}))}startSpan(e,n,r){if(this.config?.disabled)return;const i=this.constructCloudEvent(e,n,{signal:"trace"});return this.otelClient.startSpan(i,r)}constructCloudEvent(e,n,r){const i={...this.useCloudEventData(),...r};return Lme({type:e,data:n,...i,...this.otelClient.sessionId&&{sessionId:this.otelClient.sessionId}})}sendToOtelService(e){this.config?.otel.isProd||console.log("CloudEvent to be sent to OTEL service:",e),this.otelClient.send({...e,signal:"log"})}forceFlush(){return this.config?.disabled?Promise.resolve():this.otelClient.forceFlush()}shutdown(){return this.config?.disabled?Promise.resolve():this.otelClient.shutdown()}sendError(e,n){if(this.config?.disabled)return;const r=$p.toErrorEvent(e,n);this.sendToOtelService({type:r.type,data:r.payload})}sendTabChangeMessage(e,n){this.send("com.redocly.tab.change",e,n)}sendButtonClickMessage(e,n){this.send("com.redocly.button.click",e,n)}sendTabOpenFailedMessage(e,n){this.send("com.redocly.tab.openFailed",e,n)}sendChangeMessage(e,n){this.send("com.redocly.change.occurred",e,n)}sendContentCopyMessage(e,n){this.send("com.redocly.content.copy",e,n)}sendRequestSendMessage(e,n){this.send("com.redocly.request.send",e,n)}sendResponseReceivedMessage(e,n){this.send("com.redocly.response.received",e,n)}sendTokenGenerateMessage(e,n){this.send("com.redocly.token.generate",e,n)}sendAppLifecycleMessage(e,n){this.send("com.redocly.app.lifecycle",e,n)}sendEnvironmentManagementMessage(e,n){this.send("com.redocly.environment.management",e,n)}sendServerManagementMessage(e,n){this.send("com.redocly.server.management",e,n)}sendSourceManagementMessage(e,n){this.send("com.redocly.source.management",e,n)}sendInputManagementMessage(e,n){this.send("com.redocly.input.management",e,n)}sendNodeManagementMessage(e,n){this.send("com.redocly.node.management",e,n)}sendHistoryManagementMessage(e,n){this.send("com.redocly.history.management",e,n)}sendHistoryMigrationMessage(e,n){this.send("com.redocly.history.migration",e,n)}sendCredentialManagementMessage(e,n){this.send("com.redocly.credential.management",e,n)}sendPanelToggleMessage(e,n){this.send("com.redocly.panel.toggle",e,n)}sendWorkflowRunClickMessage(e,n){this.send("com.redocly.workflowRun.click",e,n)}sendWorkflowRunResultMessage(e,n){this.send("com.redocly.workflowRun.result",e,n)}sendStorageReadMessage(e,n){this.send("com.redocly.storage.read",e,n)}sendStorageLoadUserStateMessage(e,n){this.send("com.redocly.storage.loadUserState",e,n)}sendStorageDetectFilesMessage(e,n){this.send("com.redocly.storage.detectFiles",e,n)}sendStorageLoadApisMessage(e,n){this.send("com.redocly.storage.loadApis",e,n)}sendStorageParseApisMessage(e,n){this.send("com.redocly.storage.parseApis",e,n)}sendStorageParseCollectionsMessage(e,n){this.send("com.redocly.storage.parseCollections",e,n)}sendUpdaterCheckMessage(e,n){this.send("com.redocly.updater.check",e,n)}sendUpdaterDownloadMessage(e,n){this.send("com.redocly.updater.download",e,n)}sendUpdaterInstallMessage(e,n){this.send("com.redocly.updater.install",e,n)}sendUpdaterProcessMessage(e,n){this.send("com.redocly.updater.process",e,n)}sendErrorMessage(e,n){this.send("com.redocly.error.occurred",e,n)}sendBackendEventMessage(e,n){this.send("com.redocly.backend.event",e,n)}sendCodeEditorSearchMessage(e,n){this.send("com.redocly.codeEditor.search",e,n)}sendAiChatToolCallStartedMessage(e,n){this.send("com.redocly.aiChat.toolCallStarted",e,n)}sendAiChatToolCallFinishedMessage(e,n){this.send("com.redocly.aiChat.toolCallFinished",e,n)}sendAiChatConversationStartedMessage(e,n){this.send("com.redocly.aiChat.conversationStarted",e,n)}sendAiChatConversationFinishedMessage(e,n){this.send("com.redocly.aiChat.conversationFinished",e,n)}sendDeepLinkOpenedMessage(e,n){this.send("com.redocly.deepLink.opened",e,n)}}const oP=process.env.NODE_ENV==="development",Q_=process.env.NODE_ENV==="production",Dbe="0.29.0-next.1",Nbe={version:Dbe},Mbe={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"};class l7{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new _be}get isInitialized(){return this._isInitialized}get client(){return this._client}awaitInit(){return this._initPromise}updateCloudEventData(e){this._client.updateCloudEventData(e)}setCloudEventData(e){this._client.updateCloudEventData(()=>({...Mbe,...e,env:Q_?"production":"development"}))}enrichGlobalAttributes(e){this._globalAttributes={...this._globalAttributes,...e}}getGlobalAttributes(){return{...this._globalAttributes}}clearGlobalAttributes(){this._globalAttributes={platform:"",deviceId:""}}init(e){if(this.isInitialized)return;const{cloudEventData:n,...r}=e??{},i=r.tracerName||"desktop",s=r.enableErrorInstrumentation??i==="desktop",o={serviceName:"replay",serviceVersion:Nbe.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:Q_,enableErrorInstrumentation:s};this._client.init({otel:{...o,...r}}),this.setCloudEventData(n),this._initResolve?.(this),this._isInitialized=!0}sendEvent(e,n){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const r=n.map(i=>({...this._globalAttributes,...i}));oP&&console.log(`[Telemetry] ${e}:`,JSON.stringify(r,null,2));try{this.client.send(e,r)}catch(i){console.error("Failed to send telemetry event:",i)}}startSpan(e,n,r){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{const i=(n??[{}]).map(s=>({...this._globalAttributes,...s}));return oP&&console.log(`[Telemetry] span ${e}:`,JSON.stringify(i,null,2)),this._client.startSpan(e,i,r)}catch(i){console.error("Failed to start telemetry span:",i);return}}}const Gl=new l7;function Be(){const{telemetry:t}=Un();Gl.isInitialized||Gl.init(t);const e=t?.cloudEventData;b.useEffect(()=>{e&&Gl.setCloudEventData(e)},[e]);const n=b.useCallback((i,s)=>{Gl.sendEvent(i,s)},[]),r=b.useCallback((i,s,o)=>Gl.startSpan(i,s,o),[]);return{sendEvent:n,startSpan:r}}const zbe=({awaitInit:t=!0}={})=>{const[e,n]=b.useState(void 0);return b.useEffect(()=>{(async()=>{const i=t?await Gl.awaitInit():Gl;n(i)})()},[t]),e};function c7(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function aP(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function u7(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function On(){return!!window?.__TAURI__}function Oe(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!On()&&(r=u7(window.location.href)),{object:t,id:e,uri:r}}const Ar=800,Qi=C.default(me.Button).attrs({variant:"text",size:"small",tone:"danger"})`
373
+ ${z}`),q.pop(),`{${G}}`}case"number":return isFinite(I)?String(I):y?y(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return y?y(I):void 0}}function M(V,I,q){switch(typeof I){case"string":return s(I);case"object":{if(I===null)return"null";if(typeof I.toJSON=="function"){if(I=I.toJSON(V),typeof I!="object")return M(V,I,q);if(I===null)return"null"}if(q.indexOf(I)!==-1)return w;let j="";const X=I.length!==void 0;if(X&&Array.isArray(I)){if(I.length===0)return"[]";if($<q.length+1)return'"[Array]"';q.push(I);const G=Math.min(I.length,E);let ee=0;for(;ee<G-1;ee++){const te=M(String(ee),I[ee],q);j+=te!==void 0?te:"null",j+=","}const ie=M(String(ee),I[ee],q);if(j+=ie!==void 0?ie:"null",I.length-1>E){const te=I.length-E-1;j+=`,"... ${m(te)} not stringified"`}return q.pop(),`[${j}]`}let z=Object.keys(I);const W=z.length;if(W===0)return"{}";if($<q.length+1)return'"[Object]"';let B="",F=Math.min(W,E);X&&l(I)&&(j+=c(I,",",E),z=z.slice(I.length),F-=I.length,B=","),k&&(z=o(z,T)),q.push(I);for(let G=0;G<F;G++){const ee=z[G],ie=M(ee,I[ee],q);ie!==void 0&&(j+=`${B}${s(ee)}:${ie}`,B=",")}if(W>E){const G=W-E;j+=`${B}"...":"${m(G)} not stringified"`}return q.pop(),`{${j}}`}case"number":return isFinite(I)?String(I):y?y(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return y?y(I):void 0}}function L(V,I,q){if(arguments.length>1){let j="";if(typeof q=="number"?j=" ".repeat(Math.min(q,10)):typeof q=="string"&&(j=q.slice(0,10)),I!=null){if(typeof I=="function")return _("",{"":V},[],I,j,"");if(Array.isArray(I))return D("",V,[],g(I),j,"")}if(j.length!==0)return R("",V,[],j,"")}return M("",V,[])}return L}})(_m,_m.exports)),_m.exports}var Qbe=Abe();const Rbe=Ia(Qbe),jbe=Rbe.configure;class $p extends mbe{static maxErrorTextChars=4096;static stringify=jbe({maximumDepth:2,maximumBreadth:10});sendErrorEvent;constructor(e,n){super("errors","1.0",e||{}),this.sendErrorEvent=n}static toErrorEvent(e,n){return{type:"error",payload:[{handler:n,errorType:this.getErrorType(e),message:this.getErrorMessage(e),stack:this.getErrorStack(e)}]}}enable(){window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this._wrap(console,"error",this.patchConsoleError())}disable(){window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),this._unwrap(console,"error")}init(){}static getErrorMessage(e){return e?(typeof e=="object"&&"message"in e?String(e.message):String(e)).trim():void 0}static getErrorStack(e){if(!e||typeof e!="object"||!("stack"in e)||!e.stack)return;const n=String(e.stack);return n.length>this.maxErrorTextChars?n.substring(0,this.maxErrorTextChars):n}static getErrorType(e){return!e||typeof e!="object"?typeof e:"name"in e?String(e.name):"constructor"in e&&"name"in e.constructor?String(e.constructor.name):"Error"}static combineConsoleErrorArgs(e){const n=e.findIndex(i=>i instanceof Error),r=e.filter((i,s)=>s!==n).map(i=>typeof i=="string"?i:i instanceof Error?String(i):this.stringify(i)??String(i)).join(" ").substring(0,this.maxErrorTextChars);if(n===-1)return r;{const i=e[n];return r&&(i.message=`${i.message} ${r}`),i}}onError=e=>{this.sendError(e.error,"window.onerror")};onUnhandledRejection=e=>{this.sendError(e.reason,"window.onunhandledrejection")};patchConsoleError(){return e=>{const n=this;return function(...i){try{const s=$p.combineConsoleErrorArgs(i);n.sendError(s,"console.error")}catch(s){process.env.NODE_ENV!=="production"&&e?.call(this,"Error reporting failed:",s)}e?.apply(this,i)}}}sendError(e,n){this.sendErrorEvent($p.toErrorEvent(e,n))}}class _be{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new Ebe,this.tracer={traceStep:(e,n)=>{const r=this.constructCloudEvent(e,n,{signal:"trace"});return this.otelClient.traceStep(r)}}}updateCloudEventData=e=>{this.config?.disabled||(this.useCloudEventData=e)};send(e,n,r){try{if(!this.config?.otel.isProd)return;const s=e&&typeof e=="object"&&"type"in e&&"data"in e?e:this.constructCloudEvent(e,n,{...r,signal:"log"});this.sendToOtelService(s)}catch(i){this.config?.otel.isProd||console.error("Event reporting failed:",i)}}init(e){e.disabled||this.initialized||(this.config=e,this.initialized=!0,this.otelClient.init({serviceVersion:e.otel.serviceVersion,version:e.otel.version,isProd:e.otel.isProd,collectorUrl:e.otel.collectorUrl,collectorTraceUrl:e.otel.collectorTraceUrl,serviceName:e.otel.serviceName,tracerName:e.otel.tracerName,spanProcessors:e.otel.spanProcessors,registerGlobalTracerProvider:e.otel.registerGlobalTracerProvider,instrumentations:[...e.otel.enableErrorInstrumentation===!0?[new $p(void 0,n=>{this.sendToOtelService({type:n.type,data:n.payload})})]:[],...e.otel.instrumentations||[]]}))}startSpan(e,n,r){if(this.config?.disabled)return;const i=this.constructCloudEvent(e,n,{signal:"trace"});return this.otelClient.startSpan(i,r)}constructCloudEvent(e,n,r){const i={...this.useCloudEventData(),...r};return Lme({type:e,data:n,...i,...this.otelClient.sessionId&&{sessionId:this.otelClient.sessionId}})}sendToOtelService(e){this.config?.otel.isProd||console.log("CloudEvent to be sent to OTEL service:",e),this.otelClient.send({...e,signal:"log"})}forceFlush(){return this.config?.disabled?Promise.resolve():this.otelClient.forceFlush()}shutdown(){return this.config?.disabled?Promise.resolve():this.otelClient.shutdown()}sendError(e,n){if(this.config?.disabled)return;const r=$p.toErrorEvent(e,n);this.sendToOtelService({type:r.type,data:r.payload})}sendTabChangeMessage(e,n){this.send("com.redocly.tab.change",e,n)}sendButtonClickMessage(e,n){this.send("com.redocly.button.click",e,n)}sendTabOpenFailedMessage(e,n){this.send("com.redocly.tab.openFailed",e,n)}sendChangeMessage(e,n){this.send("com.redocly.change.occurred",e,n)}sendContentCopyMessage(e,n){this.send("com.redocly.content.copy",e,n)}sendRequestSendMessage(e,n){this.send("com.redocly.request.send",e,n)}sendResponseReceivedMessage(e,n){this.send("com.redocly.response.received",e,n)}sendTokenGenerateMessage(e,n){this.send("com.redocly.token.generate",e,n)}sendAppLifecycleMessage(e,n){this.send("com.redocly.app.lifecycle",e,n)}sendEnvironmentManagementMessage(e,n){this.send("com.redocly.environment.management",e,n)}sendServerManagementMessage(e,n){this.send("com.redocly.server.management",e,n)}sendSourceManagementMessage(e,n){this.send("com.redocly.source.management",e,n)}sendInputManagementMessage(e,n){this.send("com.redocly.input.management",e,n)}sendNodeManagementMessage(e,n){this.send("com.redocly.node.management",e,n)}sendHistoryManagementMessage(e,n){this.send("com.redocly.history.management",e,n)}sendHistoryMigrationMessage(e,n){this.send("com.redocly.history.migration",e,n)}sendCredentialManagementMessage(e,n){this.send("com.redocly.credential.management",e,n)}sendPanelToggleMessage(e,n){this.send("com.redocly.panel.toggle",e,n)}sendWorkflowRunClickMessage(e,n){this.send("com.redocly.workflowRun.click",e,n)}sendWorkflowRunResultMessage(e,n){this.send("com.redocly.workflowRun.result",e,n)}sendStorageReadMessage(e,n){this.send("com.redocly.storage.read",e,n)}sendStorageLoadUserStateMessage(e,n){this.send("com.redocly.storage.loadUserState",e,n)}sendStorageDetectFilesMessage(e,n){this.send("com.redocly.storage.detectFiles",e,n)}sendStorageLoadApisMessage(e,n){this.send("com.redocly.storage.loadApis",e,n)}sendStorageParseApisMessage(e,n){this.send("com.redocly.storage.parseApis",e,n)}sendStorageParseCollectionsMessage(e,n){this.send("com.redocly.storage.parseCollections",e,n)}sendUpdaterCheckMessage(e,n){this.send("com.redocly.updater.check",e,n)}sendUpdaterDownloadMessage(e,n){this.send("com.redocly.updater.download",e,n)}sendUpdaterInstallMessage(e,n){this.send("com.redocly.updater.install",e,n)}sendUpdaterProcessMessage(e,n){this.send("com.redocly.updater.process",e,n)}sendErrorMessage(e,n){this.send("com.redocly.error.occurred",e,n)}sendBackendEventMessage(e,n){this.send("com.redocly.backend.event",e,n)}sendCodeEditorSearchMessage(e,n){this.send("com.redocly.codeEditor.search",e,n)}sendAiChatToolCallStartedMessage(e,n){this.send("com.redocly.aiChat.toolCallStarted",e,n)}sendAiChatToolCallFinishedMessage(e,n){this.send("com.redocly.aiChat.toolCallFinished",e,n)}sendAiChatConversationStartedMessage(e,n){this.send("com.redocly.aiChat.conversationStarted",e,n)}sendAiChatConversationFinishedMessage(e,n){this.send("com.redocly.aiChat.conversationFinished",e,n)}sendDeepLinkOpenedMessage(e,n){this.send("com.redocly.deepLink.opened",e,n)}}const oP=process.env.NODE_ENV==="development",Q_=process.env.NODE_ENV==="production",Dbe="0.29.0-next.2",Nbe={version:Dbe},Mbe={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"};class l7{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new _be}get isInitialized(){return this._isInitialized}get client(){return this._client}awaitInit(){return this._initPromise}updateCloudEventData(e){this._client.updateCloudEventData(e)}setCloudEventData(e){this._client.updateCloudEventData(()=>({...Mbe,...e,env:Q_?"production":"development"}))}enrichGlobalAttributes(e){this._globalAttributes={...this._globalAttributes,...e}}getGlobalAttributes(){return{...this._globalAttributes}}clearGlobalAttributes(){this._globalAttributes={platform:"",deviceId:""}}init(e){if(this.isInitialized)return;const{cloudEventData:n,...r}=e??{},i=r.tracerName||"desktop",s=r.enableErrorInstrumentation??i==="desktop",o={serviceName:"replay",serviceVersion:Nbe.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:Q_,enableErrorInstrumentation:s};this._client.init({otel:{...o,...r}}),this.setCloudEventData(n),this._initResolve?.(this),this._isInitialized=!0}sendEvent(e,n){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const r=n.map(i=>({...this._globalAttributes,...i}));oP&&console.log(`[Telemetry] ${e}:`,JSON.stringify(r,null,2));try{this.client.send(e,r)}catch(i){console.error("Failed to send telemetry event:",i)}}startSpan(e,n,r){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{const i=(n??[{}]).map(s=>({...this._globalAttributes,...s}));return oP&&console.log(`[Telemetry] span ${e}:`,JSON.stringify(i,null,2)),this._client.startSpan(e,i,r)}catch(i){console.error("Failed to start telemetry span:",i);return}}}const Gl=new l7;function Be(){const{telemetry:t}=Un();Gl.isInitialized||Gl.init(t);const e=t?.cloudEventData;b.useEffect(()=>{e&&Gl.setCloudEventData(e)},[e]);const n=b.useCallback((i,s)=>{Gl.sendEvent(i,s)},[]),r=b.useCallback((i,s,o)=>Gl.startSpan(i,s,o),[]);return{sendEvent:n,startSpan:r}}const zbe=({awaitInit:t=!0}={})=>{const[e,n]=b.useState(void 0);return b.useEffect(()=>{(async()=>{const i=t?await Gl.awaitInit():Gl;n(i)})()},[t]),e};function c7(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function aP(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function u7(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function On(){return!!window?.__TAURI__}function Oe(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!On()&&(r=u7(window.location.href)),{object:t,id:e,uri:r}}const Ar=800,Qi=C.default(me.Button).attrs({variant:"text",size:"small",tone:"danger"})`
374
374
  border: none;
375
375
  margin: 0;
376
376
 
@@ -627,10 +627,10 @@ ${z}`),q.pop(),`{${G}}`}case"number":return isFinite(I)?String(I):y?y(I):"null";
627
627
  border-radius: var(--border-radius);
628
628
  border: 1px solid var(--border-color-primary);
629
629
  padding: 0 calc(var(--spacing-xxs) / 2);
630
- `,pn=(t,e,n=new Set)=>{const r=A$(t);if(!r.length)return t;let i=0;const s=r.flatMap(({start:o,end:a,name:l})=>{if(n.has(l))return null;const c=e.find(f=>f.name===l),u=t.slice(i,c?o:a);if(i=a,c){n.add(l);const f=pn(c.value,e,n);return n.delete(l),[u.length?u:null,f||t.slice(o,a)]}return[u.length?u:null]});return t.slice(i).length&&s.push(t.slice(i)),s.join("")};function d0e(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function f0e(t,e){const n=v7(t);if(!n.length)return d.jsx(__,{children:t});let r=0;const i=n.flatMap(({start:s,end:o})=>{const a=t.slice(r,s),l=d0e(t.slice(s,o),e);return r=o,[a.length?a:null,l]});return t.slice(r).length&&i.push(t.slice(r)),d.jsx(__,{children:i.join("")})}const Ts=Il(gr([]));Ts.debugLabel="collections";function Yr(){return ir(Ts)}function _b(){const t=Pa();return b.useCallback(()=>t.get(Ts),[t])}function xg(t){const e=Yr();return Td(e,t)}function Ql(t){const e=Yr();return Sg(e,t)}function Xo(){const t=dl(Ts);return b.useCallback(e=>t(n=>e(n)),[t])}function h0e(t){const e=Xo();return b.useCallback(n=>e(r=>ii(r,t,n)),[e,t])}function y7(t){const e=Xo(),{collectionId:n,workflowId:r}=t;return b.useCallback(i=>e(s=>Fi(s,{collectionId:n,workflowId:r},i)),[e,n,r])}function p0e(t){const e=Xo(),{collectionId:n,workflowId:r,stepId:i}=t;return b.useCallback(s=>e(o=>Db(o,{collectionId:n,workflowId:r,stepId:i},s)),[e,n,r,i])}function Td(t,e){return t.find(n=>n.id===e)??null}function Sg(t,{collectionId:e,workflowId:n}){return Td(t,e)?.workflows.find(i=>i.workflowId===n)??null}function wg(t,{collectionId:e,workflowId:n,stepId:r}){return Sg(t,{collectionId:e,workflowId:n})?.steps.find(s=>s.stepId===r)??null}function ii(t,e,n){const r=t.findIndex(o=>o.id===e);if(r===-1)return t;const i=n(t[r]);if(i===t[r])return t;const s=[...t];return s[r]=i,s}function Fi(t,{collectionId:e,workflowId:n},r){return ii(t,e,i=>{const s=i.workflows.findIndex(a=>a.workflowId===n);if(s===-1)return i;const o=[...i.workflows];return o[s]=r(i.workflows[s]),{...i,workflows:o}})}function Db(t,{collectionId:e,workflowId:n,stepId:r},i){return Fi(t,{collectionId:e,workflowId:n},s=>{const o=s.steps.findIndex(l=>l.stepId===r);if(o===-1)return s;const a=[...s.steps];return a[o]=i(s.steps[o]),{...s,steps:a}})}function b7(t,e){const n=t.findIndex(r=>r.id===e);return n===-1?t:t.filter((r,i)=>i!==n)}function uP(t,{collectionId:e,workflowId:n}){return ii(t,e,r=>{const i=r.workflows.findIndex(s=>s.workflowId===n);return i===-1?r:{...r,workflows:r.workflows.filter((s,o)=>o!==i)}})}function dP(t,{collectionId:e,workflowId:n,stepId:r}){return Fi(t,{collectionId:e,workflowId:n},i=>{const s=i.steps.findIndex(o=>o.stepId===r);return s===-1?i:{...i,steps:i.steps.filter((o,a)=>a!==s)}})}class g0e{constructor(e){this.storage=e}storage;async initialize(){await this.storage.initialize()}upsert(e){return this.storage.upsert(e)}getByWorkflow(e,n){return this.storage.getByWorkflow(e,n)}getByKey(e,n,r){return this.storage.getByKey(e,n,r)}pruneOlderThan(e){return this.storage.pruneOlderThan(e)}clear(){return this.storage.clear()}}class Ip{static instance=null;static currentDbPath=null;static async initialize(e){if(this.instance&&this.currentDbPath===e)return this.instance;this.instance&&this.currentDbPath!==e&&await this.close();const{SqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-SqliteDBStorage-DVQZek3n.js"));return this.instance=n.getInstance(e),this.currentDbPath=e,await this.instance.initialize(),this.instance}static getInstance(){if(!this.instance)throw new Error("SqliteDBConnection not initialized");return this.instance}static isInitialized(){return this.instance!==null}static async close(){this.instance&&(await this.instance.close(),this.instance=null,this.currentDbPath=null)}}const Nb={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function sc(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function m0e(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function O0e(t){if(!t)return null;const e=Object.fromEntries(t.headers??[]),n=Object.entries(e).find(([r])=>r.toLowerCase()==="content-type")?.[1];return{statusCode:t.status,body:m0e(t.body,n),header:e,contentType:n,time:t.duration}}async function Q$(t,e){const n={};if(!t.some(({key:i,value:s,active:o})=>i&&s&&o))return n;const{evaluateRuntimeExpression:r}=await Promise.resolve().then(()=>aue);for(const{key:i,value:s,active:o}of t)if(!(!i||!s||!o))try{n[i]=r(s,e,Nb)}catch{}return n}function v0e(t,e){const n=t?.$workflows?.[e]?.steps??{};return Object.entries(n).filter(([,r])=>r?.request!=null||r?.response!=null||r?.outputs&&Object.keys(r.outputs).length>0).map(([r,i])=>({stepId:r,request:sc(i?.request)??null,response:sc(i?.response)??null,outputs:sc(i?.outputs)??{}}))}let x7=0;const fP=new Set;function y0e(){x7+=1;for(const t of fP)t()}function b0e(){return x7}function x0e(t){return fP.add(t),()=>{fP.delete(t)}}const S0e=10080*60*1e3;async function R$(t){const e=Es.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:Pp(),date:Date.now(),...t}),y0e()}catch(n){console.error("Failed to persist step context:",n)}}async function w0e(t,e,n){if(Es.getInstance())for(const i of v0e(n,e))await R$({collectionId:t,workflowId:e,...i})}class Es{static instance=null;static async initialize(e){if(this.close(),!e)return;const{StepContextSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-StepContextSqliteDBStorage-BSepLyBI.js")),r=Ip.getInstance(),i=new n(r);this.instance=new g0e(i)}static getInstance(){return this.instance}static close(){this.instance=null}}const C0e={__replayClearedOutput:!0};function S7(t){return typeof t=="object"&&t!==null&&t.__replayClearedOutput===!0}async function w7(t,e){const n={};for(const r of t){if(n[r.stepId])continue;const i={...r.outputs??{}},s=e?.[r.stepId];if(s&&r.response){const o=s.filter(a=>a.key&&a.active&&!(a.key in i));if(o.length){const a=await Q$(o,{$response:r.response,$request:r.request??void 0});for(const[l,c]of Object.entries(a))l in i||(i[l]=c)}}for(const o of Object.keys(i))S7(i[o])&&delete i[o];n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function C7(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const P0e=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function j$(t){const e=new RegExp(P0e),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const k0e=/^\{?\$steps\.([^.{}\s]+)\.(outputs|request|response)\.([^{}\s#]+)(?:#\/([^{}\s]*))?\}?$/;function P7(t){const e=k0e.exec(t.trim());if(!e)return null;const[,n,r,i,s]=e;return{stepId:n,kind:r,outputName:r==="outputs"&&!i.includes(".")?i:void 0,hasPointer:s!==void 0}}const T0e=/^(\{?)(\$steps\.[^.{}\s]+\.(?:request|response)\.[^{}\s#]+)#\/([^{}\s]*)(\}?)$/;function $0e(t,e){const n=T0e.exec(t);if(!n)return;const[,r,i,s,o]=n;if(!!r!=!!o)return;let a;try{a=yl(`${r}${i}${o}`,{$steps:e},Nb)}catch{return}let l=a;try{for(const c of s.split("/").filter(Boolean)){if(l==null)return;typeof l=="string"&&(l=JSON.parse(l)),l=l[decodeURIComponent(c)]}}catch{return}return C7(l)}function k7(t,e){if(!t||!t.includes("$steps"))return t;const n=j$(t).map(({start:s,end:o})=>({match:t.slice(s,o),start:s,end:o}));if(!n.length)return t;let r=0;const i=[];for(const{match:s,start:o,end:a}of n){i.push(t.slice(r,o));let l=s;const c=$0e(s,e);if(c!==void 0)l=c;else try{const u=C7(yl(s,{$steps:e},Nb));u!==void 0&&(l=u)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function T7(t,e,n){const r=Sg(t,{collectionId:e,workflowId:n})?.steps;if(!r)return{};const i={};for(const s of r)i[s.stepId]=s.outputs??[];return i}async function $7(t,e){if(!t.response)return{hasValue:!1};const n=await Q$([e],{$response:t.response,$request:t.request??void 0});return e.key in n?{hasValue:!0,value:n[e.key]}:{hasValue:!1}}async function I0e(t,e){if(!e)return!1;const n=t.outputs?.[e.key];if(n===void 0||S7(n))return!1;const r=await $7(t,e);return r.hasValue?JSON.stringify(r.value)!==JSON.stringify(n):!1}async function E0e(t,e){return e?(await $7(t,e)).hasValue:!1}const A0e=/\$steps\.([^.\s"'}]+)\./g;function Q0e(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(A0e))e.add(n[1]);return[...e]}function _$(t,e,n,r){const i=[],s=o=>{if(o!=null)try{i.push(JSON.stringify(o))}catch(a){console.error("findReferencedStepIds: failed to scan a source for $steps references",a)}};s(t),s(e),s(n?.components.parameters);for(const o of r?.inputs??[])o.value&&i.push(o.value);return Q0e(i.join("\0"))}async function Mb(t,e,n,r){const i=Es.getInstance(),s=[...new Set(r)];if(!i||!e||!n||!s.length)return{};const o=(await Promise.all(s.map(a=>i.getByKey(e,n,a)))).filter(a=>a!=null);return o.length?await w7(o,T7(t,e,n)):{}}function ed(t,e,n){return k7(pn(t,e),n)}const R0e=/[\n\r\t]/g;function I7(t){return t.replace(R0e,"").trim()}function vo(t,e){return t.map(n=>{const r=e.boundNames==="all"||!!e.boundNames?.has(n.name),i=r?`$inputs.${n.name}`:n.example==null?"":I7(String(n.example));return{id:crypto.randomUUID(),key:n.name,value:i,active:r||i!=="",in:n.in,...n.allowReserved&&{allowReserved:n.allowReserved}}})}function Cg(t,e){const[n]=t.split("?"),r=e.filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${n}${r?`?${r}`:""}`}function Pg(t){const e=t.indexOf("?");if(e===-1)return[];const n=new URLSearchParams(t.slice(e+1)),r=[];for(const[i,s]of n.entries())r.push({id:crypto.randomUUID(),active:!0,key:i,value:s,in:"query"});return r}function E7(){return{id:crypto.randomUUID(),...pg}}function j0e(){return{id:crypto.randomUUID(),...pg,description:""}}function dy(t){return{...pg,id:crypto.randomUUID(),in:t}}function _0e(){return{id:crypto.randomUUID(),...pg,type:"text",files:null}}function D0e(){return{id:crypto.randomUUID(),...pg,sendIn:Er.URL}}function c1(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function zb(t,e){return t.filter(n=>n.active&&n.value).map(({value:n})=>(e?pn(n,e):n).trim())}function ll(t,e){const r=e.filter(i=>!!i).flatMap(i=>i).filter(i=>i.key&&i.active);return["path","header"].includes(t)?Array.from(new Map(r.map(i=>[i.key,i])).values()):r}function N0e(t,e,n){return t.map(({value:r,...i})=>({...i,value:ed(r,e,n??{})}))}function M0e(t,e){if(!t.startsWith("$components.parameters."))return null;const n=t.replace("$components.parameters.","");return n&&e[n]||null}function vn(t=[],e={}){const n=[];for(const r of t)if(dc(r)){const i=M0e(r.reference,e);i&&n.push({...i,active:r.active,value:r.value||i.value})}else n.push(r);return n}function Ja(t){return Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:n}))}class fy{constructor(e,n={},r){this.pattern=e,this.separator=n.separator||".",this.segments=this._parse(e),this.data=r,this._hasDeepWildcard=this.segments.some(i=>i.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(i=>i.attrName!==void 0),this._hasPositionSelector=this.segments.some(i=>i.position!==void 0)}_parse(e){const n=[];let r=0,i="";for(;r<e.length;)e[r]===this.separator?r+1<e.length&&e[r+1]===this.separator?(i.trim()&&(n.push(this._parseSegment(i.trim())),i=""),n.push({type:"deep-wildcard"}),r+=2):(i.trim()&&n.push(this._parseSegment(i.trim())),i="",r++):(i+=e[r],r++);return i.trim()&&n.push(this._parseSegment(i.trim())),n}_parseSegment(e){const n={type:"tag"};let r=null,i=e;const s=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(s&&(i=s[1]+s[3],s[2])){const u=s[2].slice(1,-1);u&&(r=u)}let o,a=i;if(i.includes("::")){const u=i.indexOf("::");if(o=i.substring(0,u).trim(),a=i.substring(u+2).trim(),!o)throw new Error(`Invalid namespace in pattern: ${e}`)}let l,c=null;if(a.includes(":")){const u=a.lastIndexOf(":"),f=a.substring(0,u).trim(),h=a.substring(u+1).trim();["first","last","odd","even"].includes(h)||/^nth\(\d+\)$/.test(h)?(l=f,c=h):l=a}else l=a;if(!l)throw new Error(`Invalid segment pattern: ${e}`);if(n.tag=l,o&&(n.namespace=o),r)if(r.includes("=")){const u=r.indexOf("=");n.attrName=r.substring(0,u).trim(),n.attrValue=r.substring(u+1).trim()}else n.attrName=r.trim();if(c){const u=c.match(/^nth\((\d+)\)$/);u?(n.position="nth",n.positionValue=parseInt(u[1],10)):n.position=c}return n}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class z0e{constructor(e){this._matcher=e}get separator(){return this._matcher.separator}getCurrentTag(){const e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){const e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){const n=this._matcher.path;if(n.length!==0)return n[n.length-1].values?.[e]}hasAttr(e){const n=this._matcher.path;if(n.length===0)return!1;const r=n[n.length-1];return r.values!==void 0&&e in r.values}getAnyParentAttr(e){return this._matcher.getAnyParentAttr(e)}hasAnyParentAttr(e){return this._matcher.hasAnyParentAttr(e)}getPosition(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,n=!0){return this._matcher.toString(e,n)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}}class A7{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new z0e(this),this._keptAttrs=[]}push(e,n=null,r=null,i=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const s=this.path.length;let o=this.siblingStacks[s];o||(o={counts:new Map,total:0},this.siblingStacks[s]=o);const a=r?`${r}:${e}`:e,l=o.counts.get(a)||0,c=o.total;o.counts.set(a,l+1),o.total++;const u={tag:e,position:c,counter:l};r!=null&&(u.namespace=r),n!=null&&(u.values=n),this.path.push(u);const f=this.path.length,h=i!==null?i.keep:null;if(h!=null&&h.length>0&&n)for(let p=0;p<h.length;p++){const m=h[p];n[m]!==void 0&&this._keptAttrs.push({depth:f,name:m,value:n[m]})}}pop(){if(this.path.length===0)return;this._pathStringCache=null;const e=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);const n=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=n;)this._keptAttrs.pop();return e}updateCurrent(e){if(this.path.length>0){const n=this.path[this.path.length-1];e!=null&&(n.values=e)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return!1;const n=this.path[this.path.length-1];return n.values!==void 0&&e in n.values}getAnyParentAttr(e){const n=this._keptAttrs;for(let r=n.length-1;r>=0;r--)if(n[r].name===e)return n[r].value}hasAnyParentAttr(e){const n=this._keptAttrs;for(let r=n.length-1;r>=0;r--)if(n[r].name===e)return!0;return!1}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,n=!0){const r=e||this.separator;if(r===this.separator&&n===!0){if(this._pathStringCache!==null)return this._pathStringCache;const s=this.path.map(o=>o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(r);return this._pathStringCache=s,s}return this.path.map(s=>n&&s.namespace?`${s.namespace}:${s.tag}`:s.tag).join(r)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(e){const n=e.segments;return n.length===0?!1:e.hasDeepWildcard()?this._matchWithDeepWildcard(n):this._matchSimple(n)}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let n=0;n<e.length;n++)if(!this._matchSegment(e[n],this.path[n],n===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(e){let n=this.path.length-1,r=e.length-1;for(;r>=0&&n>=0;){const i=e[r];if(i.type==="deep-wildcard"){if(r--,r<0)return!0;const s=e[r];let o=!1;for(let a=n;a>=0;a--)if(this._matchSegment(s,this.path[a],a===this.path.length-1)){n=a-1,r--,o=!0;break}if(!o)return!1}else{if(!this._matchSegment(i,this.path[n],n===this.path.length-1))return!1;n--,r--}}return r<0}_matchSegment(e,n,r){if(e.tag!=="*"&&e.tag!==n.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==n.namespace||e.attrName!==void 0&&(!r||!n.values||!(e.attrName in n.values)||e.attrValue!==void 0&&String(n.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!r)return!1;const i=n.counter??0;if(e.position==="first"&&i!==0)return!1;if(e.position==="odd"&&i%2!==1)return!1;if(e.position==="even"&&i%2!==0)return!1;if(e.position==="nth"&&i!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>e&&{counts:new Map(e.counts),total:e.total}),keptAttrs:this._keptAttrs.map(e=>({...e}))}}restore(e){this._pathStringCache=null,this.path=e.path.map(n=>({...n})),this.siblingStacks=e.siblingStacks.map(n=>n&&{counts:new Map(n.counts),total:n.total}),this._keptAttrs=(e.keptAttrs||[]).map(n=>({...n}))}readOnly(){return this._view}}function Q7(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function R7(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function $d(t){return String(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const j7=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",L0e=j7+"\\-\\.\\d·̀-ͯ‿-⁀",_7=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",V0e=_7+"\\-\\.\\d·̀-ͯ҇‿-⁀",D7=(t,e,n="")=>{const r=t.replace(":",""),i=e.replace(":",""),s=`[${r}][${i}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,n),ncName:new RegExp(`^${s}$`,n),qName:new RegExp(`^${s}(?::${s})?$`,n),nmToken:new RegExp(`^[${e}]+$`,n),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,n)}},W0e=D7(j7,L0e),X0e=D7(_7,V0e,"u"),q0e=(t="1.0")=>t==="1.1"?X0e:W0e,N7=(t,{xmlVersion:e="1.0"}={})=>q0e(e).qName.test(t),Z0e=`
630
+ `,pn=(t,e,n=new Set)=>{const r=A$(t);if(!r.length)return t;let i=0;const s=r.flatMap(({start:o,end:a,name:l})=>{if(n.has(l))return null;const c=e.find(f=>f.name===l),u=t.slice(i,c?o:a);if(i=a,c){n.add(l);const f=pn(c.value,e,n);return n.delete(l),[u.length?u:null,f||t.slice(o,a)]}return[u.length?u:null]});return t.slice(i).length&&s.push(t.slice(i)),s.join("")};function d0e(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function f0e(t,e){const n=v7(t);if(!n.length)return d.jsx(__,{children:t});let r=0;const i=n.flatMap(({start:s,end:o})=>{const a=t.slice(r,s),l=d0e(t.slice(s,o),e);return r=o,[a.length?a:null,l]});return t.slice(r).length&&i.push(t.slice(r)),d.jsx(__,{children:i.join("")})}const Ts=Il(gr([]));Ts.debugLabel="collections";function Yr(){return ir(Ts)}function _b(){const t=Pa();return b.useCallback(()=>t.get(Ts),[t])}function xg(t){const e=Yr();return Td(e,t)}function Ql(t){const e=Yr();return Sg(e,t)}function Xo(){const t=dl(Ts);return b.useCallback(e=>t(n=>e(n)),[t])}function h0e(t){const e=Xo();return b.useCallback(n=>e(r=>ii(r,t,n)),[e,t])}function y7(t){const e=Xo(),{collectionId:n,workflowId:r}=t;return b.useCallback(i=>e(s=>Fi(s,{collectionId:n,workflowId:r},i)),[e,n,r])}function p0e(t){const e=Xo(),{collectionId:n,workflowId:r,stepId:i}=t;return b.useCallback(s=>e(o=>Db(o,{collectionId:n,workflowId:r,stepId:i},s)),[e,n,r,i])}function Td(t,e){return t.find(n=>n.id===e)??null}function Sg(t,{collectionId:e,workflowId:n}){return Td(t,e)?.workflows.find(i=>i.workflowId===n)??null}function wg(t,{collectionId:e,workflowId:n,stepId:r}){return Sg(t,{collectionId:e,workflowId:n})?.steps.find(s=>s.stepId===r)??null}function ii(t,e,n){const r=t.findIndex(o=>o.id===e);if(r===-1)return t;const i=n(t[r]);if(i===t[r])return t;const s=[...t];return s[r]=i,s}function Fi(t,{collectionId:e,workflowId:n},r){return ii(t,e,i=>{const s=i.workflows.findIndex(a=>a.workflowId===n);if(s===-1)return i;const o=[...i.workflows];return o[s]=r(i.workflows[s]),{...i,workflows:o}})}function Db(t,{collectionId:e,workflowId:n,stepId:r},i){return Fi(t,{collectionId:e,workflowId:n},s=>{const o=s.steps.findIndex(l=>l.stepId===r);if(o===-1)return s;const a=[...s.steps];return a[o]=i(s.steps[o]),{...s,steps:a}})}function b7(t,e){const n=t.findIndex(r=>r.id===e);return n===-1?t:t.filter((r,i)=>i!==n)}function uP(t,{collectionId:e,workflowId:n}){return ii(t,e,r=>{const i=r.workflows.findIndex(s=>s.workflowId===n);return i===-1?r:{...r,workflows:r.workflows.filter((s,o)=>o!==i)}})}function dP(t,{collectionId:e,workflowId:n,stepId:r}){return Fi(t,{collectionId:e,workflowId:n},i=>{const s=i.steps.findIndex(o=>o.stepId===r);return s===-1?i:{...i,steps:i.steps.filter((o,a)=>a!==s)}})}class g0e{constructor(e){this.storage=e}storage;async initialize(){await this.storage.initialize()}upsert(e){return this.storage.upsert(e)}getByWorkflow(e,n){return this.storage.getByWorkflow(e,n)}getByKey(e,n,r){return this.storage.getByKey(e,n,r)}pruneOlderThan(e){return this.storage.pruneOlderThan(e)}clear(){return this.storage.clear()}}class Ip{static instance=null;static currentDbPath=null;static async initialize(e){if(this.instance&&this.currentDbPath===e)return this.instance;this.instance&&this.currentDbPath!==e&&await this.close();const{SqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-SqliteDBStorage-3K7IPlJU.js"));return this.instance=n.getInstance(e),this.currentDbPath=e,await this.instance.initialize(),this.instance}static getInstance(){if(!this.instance)throw new Error("SqliteDBConnection not initialized");return this.instance}static isInitialized(){return this.instance!==null}static async close(){this.instance&&(await this.instance.close(),this.instance=null,this.currentDbPath=null)}}const Nb={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function sc(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function m0e(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function O0e(t){if(!t)return null;const e=Object.fromEntries(t.headers??[]),n=Object.entries(e).find(([r])=>r.toLowerCase()==="content-type")?.[1];return{statusCode:t.status,body:m0e(t.body,n),header:e,contentType:n,time:t.duration}}async function Q$(t,e){const n={};if(!t.some(({key:i,value:s,active:o})=>i&&s&&o))return n;const{evaluateRuntimeExpression:r}=await Promise.resolve().then(()=>aue);for(const{key:i,value:s,active:o}of t)if(!(!i||!s||!o))try{n[i]=r(s,e,Nb)}catch{}return n}function v0e(t,e){const n=t?.$workflows?.[e]?.steps??{};return Object.entries(n).filter(([,r])=>r?.request!=null||r?.response!=null||r?.outputs&&Object.keys(r.outputs).length>0).map(([r,i])=>({stepId:r,request:sc(i?.request)??null,response:sc(i?.response)??null,outputs:sc(i?.outputs)??{}}))}let x7=0;const fP=new Set;function y0e(){x7+=1;for(const t of fP)t()}function b0e(){return x7}function x0e(t){return fP.add(t),()=>{fP.delete(t)}}const S0e=10080*60*1e3;async function R$(t){const e=Es.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:Pp(),date:Date.now(),...t}),y0e()}catch(n){console.error("Failed to persist step context:",n)}}async function w0e(t,e,n){if(Es.getInstance())for(const i of v0e(n,e))await R$({collectionId:t,workflowId:e,...i})}class Es{static instance=null;static async initialize(e){if(this.close(),!e)return;const{StepContextSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-StepContextSqliteDBStorage-BSepLyBI.js")),r=Ip.getInstance(),i=new n(r);this.instance=new g0e(i)}static getInstance(){return this.instance}static close(){this.instance=null}}const C0e={__replayClearedOutput:!0};function S7(t){return typeof t=="object"&&t!==null&&t.__replayClearedOutput===!0}async function w7(t,e){const n={};for(const r of t){if(n[r.stepId])continue;const i={...r.outputs??{}},s=e?.[r.stepId];if(s&&r.response){const o=s.filter(a=>a.key&&a.active&&!(a.key in i));if(o.length){const a=await Q$(o,{$response:r.response,$request:r.request??void 0});for(const[l,c]of Object.entries(a))l in i||(i[l]=c)}}for(const o of Object.keys(i))S7(i[o])&&delete i[o];n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function C7(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const P0e=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function j$(t){const e=new RegExp(P0e),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const k0e=/^\{?\$steps\.([^.{}\s]+)\.(outputs|request|response)\.([^{}\s#]+)(?:#\/([^{}\s]*))?\}?$/;function P7(t){const e=k0e.exec(t.trim());if(!e)return null;const[,n,r,i,s]=e;return{stepId:n,kind:r,outputName:r==="outputs"&&!i.includes(".")?i:void 0,hasPointer:s!==void 0}}const T0e=/^(\{?)(\$steps\.[^.{}\s]+\.(?:request|response)\.[^{}\s#]+)#\/([^{}\s]*)(\}?)$/;function $0e(t,e){const n=T0e.exec(t);if(!n)return;const[,r,i,s,o]=n;if(!!r!=!!o)return;let a;try{a=yl(`${r}${i}${o}`,{$steps:e},Nb)}catch{return}let l=a;try{for(const c of s.split("/").filter(Boolean)){if(l==null)return;typeof l=="string"&&(l=JSON.parse(l)),l=l[decodeURIComponent(c)]}}catch{return}return C7(l)}function k7(t,e){if(!t||!t.includes("$steps"))return t;const n=j$(t).map(({start:s,end:o})=>({match:t.slice(s,o),start:s,end:o}));if(!n.length)return t;let r=0;const i=[];for(const{match:s,start:o,end:a}of n){i.push(t.slice(r,o));let l=s;const c=$0e(s,e);if(c!==void 0)l=c;else try{const u=C7(yl(s,{$steps:e},Nb));u!==void 0&&(l=u)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function T7(t,e,n){const r=Sg(t,{collectionId:e,workflowId:n})?.steps;if(!r)return{};const i={};for(const s of r)i[s.stepId]=s.outputs??[];return i}async function $7(t,e){if(!t.response)return{hasValue:!1};const n=await Q$([e],{$response:t.response,$request:t.request??void 0});return e.key in n?{hasValue:!0,value:n[e.key]}:{hasValue:!1}}async function I0e(t,e){if(!e)return!1;const n=t.outputs?.[e.key];if(n===void 0||S7(n))return!1;const r=await $7(t,e);return r.hasValue?JSON.stringify(r.value)!==JSON.stringify(n):!1}async function E0e(t,e){return e?(await $7(t,e)).hasValue:!1}const A0e=/\$steps\.([^.\s"'}]+)\./g;function Q0e(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(A0e))e.add(n[1]);return[...e]}function _$(t,e,n,r){const i=[],s=o=>{if(o!=null)try{i.push(JSON.stringify(o))}catch(a){console.error("findReferencedStepIds: failed to scan a source for $steps references",a)}};s(t),s(e),s(n?.components.parameters);for(const o of r?.inputs??[])o.value&&i.push(o.value);return Q0e(i.join("\0"))}async function Mb(t,e,n,r){const i=Es.getInstance(),s=[...new Set(r)];if(!i||!e||!n||!s.length)return{};const o=(await Promise.all(s.map(a=>i.getByKey(e,n,a)))).filter(a=>a!=null);return o.length?await w7(o,T7(t,e,n)):{}}function ed(t,e,n){return k7(pn(t,e),n)}const R0e=/[\n\r\t]/g;function I7(t){return t.replace(R0e,"").trim()}function vo(t,e){return t.map(n=>{const r=e.boundNames==="all"||!!e.boundNames?.has(n.name),i=r?`$inputs.${n.name}`:n.example==null?"":I7(String(n.example));return{id:crypto.randomUUID(),key:n.name,value:i,active:r||i!=="",in:n.in,...n.allowReserved&&{allowReserved:n.allowReserved}}})}function Cg(t,e){const[n]=t.split("?"),r=e.filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${n}${r?`?${r}`:""}`}function Pg(t){const e=t.indexOf("?");if(e===-1)return[];const n=new URLSearchParams(t.slice(e+1)),r=[];for(const[i,s]of n.entries())r.push({id:crypto.randomUUID(),active:!0,key:i,value:s,in:"query"});return r}function E7(){return{id:crypto.randomUUID(),...pg}}function j0e(){return{id:crypto.randomUUID(),...pg,description:""}}function dy(t){return{...pg,id:crypto.randomUUID(),in:t}}function _0e(){return{id:crypto.randomUUID(),...pg,type:"text",files:null}}function D0e(){return{id:crypto.randomUUID(),...pg,sendIn:Er.URL}}function c1(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function zb(t,e){return t.filter(n=>n.active&&n.value).map(({value:n})=>(e?pn(n,e):n).trim())}function ll(t,e){const r=e.filter(i=>!!i).flatMap(i=>i).filter(i=>i.key&&i.active);return["path","header"].includes(t)?Array.from(new Map(r.map(i=>[i.key,i])).values()):r}function N0e(t,e,n){return t.map(({value:r,...i})=>({...i,value:ed(r,e,n??{})}))}function M0e(t,e){if(!t.startsWith("$components.parameters."))return null;const n=t.replace("$components.parameters.","");return n&&e[n]||null}function vn(t=[],e={}){const n=[];for(const r of t)if(dc(r)){const i=M0e(r.reference,e);i&&n.push({...i,active:r.active,value:r.value||i.value})}else n.push(r);return n}function Ja(t){return Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:n}))}class fy{constructor(e,n={},r){this.pattern=e,this.separator=n.separator||".",this.segments=this._parse(e),this.data=r,this._hasDeepWildcard=this.segments.some(i=>i.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(i=>i.attrName!==void 0),this._hasPositionSelector=this.segments.some(i=>i.position!==void 0)}_parse(e){const n=[];let r=0,i="";for(;r<e.length;)e[r]===this.separator?r+1<e.length&&e[r+1]===this.separator?(i.trim()&&(n.push(this._parseSegment(i.trim())),i=""),n.push({type:"deep-wildcard"}),r+=2):(i.trim()&&n.push(this._parseSegment(i.trim())),i="",r++):(i+=e[r],r++);return i.trim()&&n.push(this._parseSegment(i.trim())),n}_parseSegment(e){const n={type:"tag"};let r=null,i=e;const s=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(s&&(i=s[1]+s[3],s[2])){const u=s[2].slice(1,-1);u&&(r=u)}let o,a=i;if(i.includes("::")){const u=i.indexOf("::");if(o=i.substring(0,u).trim(),a=i.substring(u+2).trim(),!o)throw new Error(`Invalid namespace in pattern: ${e}`)}let l,c=null;if(a.includes(":")){const u=a.lastIndexOf(":"),f=a.substring(0,u).trim(),h=a.substring(u+1).trim();["first","last","odd","even"].includes(h)||/^nth\(\d+\)$/.test(h)?(l=f,c=h):l=a}else l=a;if(!l)throw new Error(`Invalid segment pattern: ${e}`);if(n.tag=l,o&&(n.namespace=o),r)if(r.includes("=")){const u=r.indexOf("=");n.attrName=r.substring(0,u).trim(),n.attrValue=r.substring(u+1).trim()}else n.attrName=r.trim();if(c){const u=c.match(/^nth\((\d+)\)$/);u?(n.position="nth",n.positionValue=parseInt(u[1],10)):n.position=c}return n}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class z0e{constructor(e){this._matcher=e}get separator(){return this._matcher.separator}getCurrentTag(){const e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){const e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){const n=this._matcher.path;if(n.length!==0)return n[n.length-1].values?.[e]}hasAttr(e){const n=this._matcher.path;if(n.length===0)return!1;const r=n[n.length-1];return r.values!==void 0&&e in r.values}getAnyParentAttr(e){return this._matcher.getAnyParentAttr(e)}hasAnyParentAttr(e){return this._matcher.hasAnyParentAttr(e)}getPosition(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,n=!0){return this._matcher.toString(e,n)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}}class A7{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new z0e(this),this._keptAttrs=[]}push(e,n=null,r=null,i=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const s=this.path.length;let o=this.siblingStacks[s];o||(o={counts:new Map,total:0},this.siblingStacks[s]=o);const a=r?`${r}:${e}`:e,l=o.counts.get(a)||0,c=o.total;o.counts.set(a,l+1),o.total++;const u={tag:e,position:c,counter:l};r!=null&&(u.namespace=r),n!=null&&(u.values=n),this.path.push(u);const f=this.path.length,h=i!==null?i.keep:null;if(h!=null&&h.length>0&&n)for(let p=0;p<h.length;p++){const m=h[p];n[m]!==void 0&&this._keptAttrs.push({depth:f,name:m,value:n[m]})}}pop(){if(this.path.length===0)return;this._pathStringCache=null;const e=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);const n=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=n;)this._keptAttrs.pop();return e}updateCurrent(e){if(this.path.length>0){const n=this.path[this.path.length-1];e!=null&&(n.values=e)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return!1;const n=this.path[this.path.length-1];return n.values!==void 0&&e in n.values}getAnyParentAttr(e){const n=this._keptAttrs;for(let r=n.length-1;r>=0;r--)if(n[r].name===e)return n[r].value}hasAnyParentAttr(e){const n=this._keptAttrs;for(let r=n.length-1;r>=0;r--)if(n[r].name===e)return!0;return!1}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,n=!0){const r=e||this.separator;if(r===this.separator&&n===!0){if(this._pathStringCache!==null)return this._pathStringCache;const s=this.path.map(o=>o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(r);return this._pathStringCache=s,s}return this.path.map(s=>n&&s.namespace?`${s.namespace}:${s.tag}`:s.tag).join(r)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(e){const n=e.segments;return n.length===0?!1:e.hasDeepWildcard()?this._matchWithDeepWildcard(n):this._matchSimple(n)}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let n=0;n<e.length;n++)if(!this._matchSegment(e[n],this.path[n],n===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(e){let n=this.path.length-1,r=e.length-1;for(;r>=0&&n>=0;){const i=e[r];if(i.type==="deep-wildcard"){if(r--,r<0)return!0;const s=e[r];let o=!1;for(let a=n;a>=0;a--)if(this._matchSegment(s,this.path[a],a===this.path.length-1)){n=a-1,r--,o=!0;break}if(!o)return!1}else{if(!this._matchSegment(i,this.path[n],n===this.path.length-1))return!1;n--,r--}}return r<0}_matchSegment(e,n,r){if(e.tag!=="*"&&e.tag!==n.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==n.namespace||e.attrName!==void 0&&(!r||!n.values||!(e.attrName in n.values)||e.attrValue!==void 0&&String(n.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!r)return!1;const i=n.counter??0;if(e.position==="first"&&i!==0)return!1;if(e.position==="odd"&&i%2!==1)return!1;if(e.position==="even"&&i%2!==0)return!1;if(e.position==="nth"&&i!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>e&&{counts:new Map(e.counts),total:e.total}),keptAttrs:this._keptAttrs.map(e=>({...e}))}}restore(e){this._pathStringCache=null,this.path=e.path.map(n=>({...n})),this.siblingStacks=e.siblingStacks.map(n=>n&&{counts:new Map(n.counts),total:n.total}),this._keptAttrs=(e.keptAttrs||[]).map(n=>({...n}))}readOnly(){return this._view}}function Q7(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function R7(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function $d(t){return String(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const j7=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",L0e=j7+"\\-\\.\\d·̀-ͯ‿-⁀",_7=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",V0e=_7+"\\-\\.\\d·̀-ͯ҇‿-⁀",D7=(t,e,n="")=>{const r=t.replace(":",""),i=e.replace(":",""),s=`[${r}][${i}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,n),ncName:new RegExp(`^${s}$`,n),qName:new RegExp(`^${s}(?::${s})?$`,n),nmToken:new RegExp(`^[${e}]+$`,n),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,n)}},W0e=D7(j7,L0e),X0e=D7(_7,V0e,"u"),q0e=(t="1.0")=>t==="1.1"?X0e:W0e,N7=(t,{xmlVersion:e="1.0"}={})=>q0e(e).qName.test(t),Z0e=`
631
631
  `;function U0e(t,e){if(!Array.isArray(t)||t.length===0)return"1.0";const n=t[0];if(D$(n)==="?xml"){const i=n[":@"];if(i){const s=e.attributeNamePrefix+"version";if(i[s])return i[s]}}return"1.0"}function M7(t,e,n,r,i){return!n.sanitizeName||N7(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}function B0e(t,e){let n="";e.format&&(n=Z0e);const r=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let o=0;o<e.stopNodes.length;o++){const a=e.stopNodes[o];typeof a=="string"?r.push(new fy(a)):a instanceof fy&&r.push(a)}const i=U0e(t,e),s=new A7;return z7(t,e,n,s,r,i)}function z7(t,e,n,r,i,s){let o="",a=!1;if(e.maxNestedTags&&r.getDepth()>e.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(t!=null){let l=t.toString();return l=hP(l,e),l}return""}for(let l=0;l<t.length;l++){const c=t[l],u=D$(c);if(u===void 0)continue;const h=u===e.textNodeName||u===e.cdataPropName||u===e.commentPropName||u[0]==="?"?u:M7(u,!1,e,r,s),p=F0e(c[":@"],e);r.push(h,p);const m=G0e(r,i);if(h===e.textNodeName){let y=c[u];m||(y=e.tagValueProcessor(h,y),y=hP(y,e)),a&&(o+=n),o+=y,a=!1,r.pop();continue}else if(h===e.cdataPropName){a&&(o+=n);const y=c[u][0][e.textNodeName],w=R7(y);o+=`<![CDATA[${w}]]>`,a=!1,r.pop();continue}else if(h===e.commentPropName){const y=c[u][0][e.textNodeName],w=Q7(y);o+=n+`<!--${w}-->`,a=!0,r.pop();continue}else if(h[0]==="?"){const y=D_(c[":@"],e,m,r,s);o+=(h==="?xml"?"":n)+`<${h}${y}?>`,a=!0,r.pop();continue}let g=n;g!==""&&(g+=e.indentBy);const O=D_(c[":@"],e,m,r,s),v=n+`<${h}${O}`;let x;m?x=L7(c[u],e):x=z7(c[u],e,g,r,i,s),e.unpairedTags.indexOf(h)!==-1?e.suppressUnpairedNode?o+=v+">":o+=v+"/>":(!x||x.length===0)&&e.suppressEmptyNode?o+=v+"/>":x&&x.endsWith(">")?o+=v+`>${x}${n}</${h}>`:(o+=v+">",x&&n!==""&&(x.includes("/>")||x.includes("</"))?o+=n+e.indentBy+x+n:o+=x,o+=`</${h}>`),a=!0,r.pop()}return o}function F0e(t,e){if(!t||e.ignoreAttributes)return null;const n={};let r=!1;for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;const s=i.startsWith(e.attributeNamePrefix)?i.substr(e.attributeNamePrefix.length):i;n[s]=$d(t[i]),r=!0}return r?n:null}function L7(t,e){if(!Array.isArray(t))return t!=null?t.toString():"";let n="";for(let r=0;r<t.length;r++){const i=t[r],s=D$(i);if(s===e.textNodeName)n+=i[s];else if(s===e.cdataPropName)n+=i[s][0][e.textNodeName];else if(s===e.commentPropName)n+=i[s][0][e.textNodeName];else{if(s&&s[0]==="?")continue;if(s){const o=Y0e(i[":@"],e),a=L7(i[s],e);!a||a.length===0?n+=`<${s}${o}/>`:n+=`<${s}${o}>${a}</${s}>`}}}return n}function Y0e(t,e){let n="";if(t&&!e.ignoreAttributes)for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;let i=t[r];i===!0&&e.suppressBooleanAttributes?n+=` ${r.substr(e.attributeNamePrefix.length)}`:n+=` ${r.substr(e.attributeNamePrefix.length)}="${$d(i)}"`}return n}function D$(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(Object.prototype.hasOwnProperty.call(t,r)&&r!==":@")return r}}function D_(t,e,n,r,i){let s="";if(t&&!e.ignoreAttributes)for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;const a=o.substr(e.attributeNamePrefix.length),l=n?a:M7(a,!0,e,r,i);let c;n?c=t[o]:(c=e.attributeValueProcessor(o,t[o]),c=hP(c,e)),c===!0&&e.suppressBooleanAttributes?s+=` ${l}`:s+=` ${l}="${$d(c)}"`}return s}function G0e(t,e){if(!e||e.length===0)return!1;for(let n=0;n<e.length;n++)if(t.matches(e[n]))return!0;return!1}function hP(t,e){if(t&&t.length>0&&e.processEntities)for(let n=0;n<e.entities.length;n++){const r=e.entities[n];t=t.replace(r.regex,r.val)}return t}function H0e(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(const n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return!0}:()=>!1}const J0e={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0,sanitizeName:!1};function Di(t){if(this.options=Object.assign({},J0e,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(e=>typeof e=="string"&&e.startsWith("*.")?".."+e.substring(2):e)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let e=0;e<this.options.stopNodes.length;e++){const n=this.options.stopNodes[e];typeof n=="string"?this.stopNodeExpressions.push(new fy(n)):n instanceof fy&&this.stopNodeExpressions.push(n)}this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=H0e(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=nxe),this.processTextOrObjNode=exe,this.options.format?(this.indentate=txe,this.tagEndChar=`>
632
632
  `,this.newLine=`
633
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function K0e(t,e){const n=t["?xml"];if(n&&typeof n=="object"){if(e.attributesGroupName&&n[e.attributesGroupName]){const i=n[e.attributesGroupName][e.attributeNamePrefix+"version"];if(i)return i}const r=n[e.attributeNamePrefix+"version"];if(r)return r}return"1.0"}function u1(t,e,n,r,i){return!n.sanitizeName||N7(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}Di.prototype.build=function(t){if(this.options.preserveOrder)return B0e(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new A7,n=K0e(t,this.options);return this.j2x(t,0,e,n).val}};Di.prototype.j2x=function(t,e,n,r){let i="",s="";if(this.options.maxNestedTags&&n.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const o=this.options.jPath?n.toString():n,a=this.checkStopNode(n);for(let l in t){if(!Object.prototype.hasOwnProperty.call(t,l))continue;const u=l===this.options.textNodeName||l===this.options.cdataPropName||l===this.options.commentPropName||this.options.attributesGroupName&&l===this.options.attributesGroupName||this.isAttribute(l)||l[0]==="?"?l:u1(l,!1,this.options,n,r);if(typeof t[l]>"u")this.isAttribute(l)&&(s+="");else if(t[l]===null)this.isAttribute(l)||u===this.options.cdataPropName||u===this.options.commentPropName?s+="":u[0]==="?"?s+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if(t[l]instanceof Date)s+=this.buildTextValNode(t[l],u,"",e,n);else if(typeof t[l]!="object"){const f=this.isAttribute(l);if(f&&!this.ignoreAttributesFn(f,o)){const h=u1(f,!0,this.options,n,r);i+=this.buildAttrPairStr(h,""+t[l],a)}else if(!f)if(l===this.options.textNodeName){let h=this.options.tagValueProcessor(l,""+t[l]);s+=this.replaceEntitiesValue(h)}else{n.push(u);const h=this.checkStopNode(n);if(n.pop(),h){const p=""+t[l];p===""?s+=this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:s+=this.indentate(e)+"<"+u+">"+p+"</"+u+this.tagEndChar}else s+=this.buildTextValNode(t[l],u,"",e,n)}}else if(Array.isArray(t[l])){const f=t[l].length;let h="",p="";for(let m=0;m<f;m++){const g=t[l][m];if(!(typeof g>"u"))if(g===null)u[0]==="?"?s+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if(typeof g=="object")if(this.options.oneListGroup){n.push(u);const O=this.j2x(g,e+1,n,r);n.pop(),h+=O.val,this.options.attributesGroupName&&g.hasOwnProperty(this.options.attributesGroupName)&&(p+=O.attrStr)}else h+=this.processTextOrObjNode(g,u,e,n,r);else if(this.options.oneListGroup){let O=this.options.tagValueProcessor(u,g);O=this.replaceEntitiesValue(O),h+=O}else{n.push(u);const O=this.checkStopNode(n);if(n.pop(),O){const v=""+g;v===""?h+=this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:h+=this.indentate(e)+"<"+u+">"+v+"</"+u+this.tagEndChar}else h+=this.buildTextValNode(g,u,"",e,n)}}this.options.oneListGroup&&(h=this.buildObjectNode(h,u,p,e)),s+=h}else if(this.options.attributesGroupName&&l===this.options.attributesGroupName){const f=Object.keys(t[l]),h=f.length;for(let p=0;p<h;p++){const m=u1(f[p],!0,this.options,n,r);i+=this.buildAttrPairStr(m,""+t[l][f[p]],a)}}else s+=this.processTextOrObjNode(t[l],u,e,n,r)}return{attrStr:i,val:s}};Di.prototype.buildAttrPairStr=function(t,e,n){return n||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+$d(e)+'"'};function exe(t,e,n,r,i){const s=this.extractAttributes(t);if(r.push(e,s),this.checkStopNode(r)){const l=this.buildRawContent(t),c=this.buildAttributesForStopNode(t);return r.pop(),this.buildObjectNode(l,e,c,n)}const a=this.j2x(t,n+1,r,i);return r.pop(),e[0]==="?"?this.buildTextValNode("",e,a.attrStr,n,r):t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,a.attrStr,n,r):this.buildObjectNode(a.val,e,a.attrStr,n)}Di.prototype.extractAttributes=function(t){if(!t||typeof t!="object")return null;const e={};let n=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const r=t[this.options.attributesGroupName];for(let i in r){if(!Object.prototype.hasOwnProperty.call(r,i))continue;const s=i.startsWith(this.options.attributeNamePrefix)?i.substring(this.options.attributeNamePrefix.length):i;e[s]=$d(r[i]),n=!0}}else for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const i=this.isAttribute(r);i&&(e[i]=$d(t[r]),n=!0)}return n?e:null};Di.prototype.buildRawContent=function(t){if(typeof t=="string")return t;if(typeof t!="object"||t===null)return String(t);if(t[this.options.textNodeName]!==void 0)return t[this.options.textNodeName];let e="";for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||this.isAttribute(n)||this.options.attributesGroupName&&n===this.options.attributesGroupName)continue;const r=t[n];if(n===this.options.textNodeName)e+=r;else if(Array.isArray(r)){for(let i of r)if(typeof i=="string"||typeof i=="number")e+=`<${n}>${i}</${n}>`;else if(typeof i=="object"&&i!==null){const s=this.buildRawContent(i),o=this.buildAttributesForStopNode(i);s===""?e+=`<${n}${o}/>`:e+=`<${n}${o}>${s}</${n}>`}}else if(typeof r=="object"&&r!==null){const i=this.buildRawContent(r),s=this.buildAttributesForStopNode(r);i===""?e+=`<${n}${s}/>`:e+=`<${n}${s}>${i}</${n}>`}else e+=`<${n}>${r}</${n}>`}return e};Di.prototype.buildAttributesForStopNode=function(t){if(!t||typeof t!="object")return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const n=t[this.options.attributesGroupName];for(let r in n){if(!Object.prototype.hasOwnProperty.call(n,r))continue;const i=r.startsWith(this.options.attributeNamePrefix)?r.substring(this.options.attributeNamePrefix.length):r,s=n[r];s===!0&&this.options.suppressBooleanAttributes?e+=" "+i:e+=" "+i+'="'+s+'"'}}else for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const r=this.isAttribute(n);if(r){const i=t[n];i===!0&&this.options.suppressBooleanAttributes?e+=" "+r:e+=" "+r+'="'+i+'"'}}return e};Di.prototype.buildObjectNode=function(t,e,n,r){if(t==="")return e[0]==="?"?this.indentate(r)+"<"+e+n+"?"+this.tagEndChar:this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar;if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let i="</"+e+this.tagEndChar,s="";return e[0]==="?"&&(s="?",i=""),(n||n==="")&&t.indexOf("<")===-1?this.indentate(r)+"<"+e+n+s+">"+t+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&s.length===0?this.indentate(r)+`<!--${t}-->`+this.newLine:this.indentate(r)+"<"+e+n+s+this.tagEndChar+t+this.indentate(r)+i}};Di.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};Di.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||this.stopNodeExpressions.length===0)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1};Di.prototype.buildTextValNode=function(t,e,n,r,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName){const s=R7(t);return this.indentate(r)+`<![CDATA[${s}]]>`+this.newLine}else if(this.options.commentPropName!==!1&&e===this.options.commentPropName){const s=Q7(t);return this.indentate(r)+`<!--${s}-->`+this.newLine}else{if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,t);return s=this.replaceEntitiesValue(s),s===""?this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+n+">"+s+"</"+e+this.tagEndChar}}};Di.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const n=this.options.entities[e];t=t.replace(n.regex,n.val)}return t};function txe(t){return this.options.indentBy.repeat(t)}function nxe(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}function V7(t){return t.schema}function W7(t){return V7(t)?.fields??[]}function X7(t,e){return t.flatMap(n=>{const r=V7(n),i=r?.fields||[];return i.length>0?i.flatMap(s=>N_(s.name,s.example,n.allowReserved)):N_(n.name,r?.example??n.example,n.allowReserved)})}function N_(t,e,n){if(e===void 0)return[d1(t,"",!1,n)];const r=pP(e,t);return r.length===0?[d1(t,"",!1,n)]:r.map(i=>d1(i.key,i.value,!0,n))}function pP(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((n,r)=>n!==null&&typeof n=="object"?pP(n,`${e}[${r}]`):[{key:e,value:String(n)}]):rxe(t)?Object.entries(t).flatMap(([n,r])=>pP(r,`${e}[${n}]`)):[{key:e,value:String(t)}]}function rxe(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function d1(t,e,n,r){return{id:crypto.randomUUID(),key:t,value:I7(e),active:n,in:"query",...r&&{allowReserved:r}}}const q7={path:"path",query:"query",header:"headers",cookie:"cookie"};function N$(t){return t!==void 0}function ixe(t,e){if(t)return Dy.isDirectConfigureRequestValues(t)?t:t[e]}function M_(t,e,n){const r=n[q7[e]],i=n.envVariables,s=new Set;for(const o of t??[])(r?.[o.name]||i?.[o.name])&&s.add(o.name);return s}function td(t,e,n){if(Dy.isDirectConfigureRequestValues(n))return M_(t,e,n);const r=new Set;for(const i of Object.values(n))if(i)for(const s of M_(t,e,i))r.add(s);return r}function z_(t,e,n){const r=n.query,i=n.envVariables;for(const s of e??[]){const o=W7(s);for(const a of o)(r?.[a.name]||i?.[a.name])&&t.add(a.name);for(const a of[...Object.keys(r??{}),...Object.keys(i??{})])!r?.[a]&&!i?.[a]||o.some(l=>a===l.name||a.startsWith(`${l.name}[`))&&t.add(a)}}function Z7(t,e,n){const r=[...t??[],...e??[]],i=new Set(td(r,"query",n));if(Dy.isDirectConfigureRequestValues(n))return z_(i,e,n),i;for(const s of Object.values(n))s&&z_(i,e,s);return i}function M$(t=[],e){const n={};return t.forEach(r=>{const i=String(r[e]);n[i]||(n[i]=[]),n[i].push(r)}),n}function sxe(t){return t.replace(/{/g,"{{").replace(/}/g,"}}")}var $i=(t=>(t.Query="Query",t.Header="Header",t.Cookie="Cookie",t))($i||{});const gP={documentedOAuth2Types:[],grantType:re.ClientCredentials,authRequestExtraParams:[],tokenRequestExtraParams:[],[re.ClientCredentials]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[re.ClientCredentialsWithJwtAssertion]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[re.AuthorizationCode]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[re.AuthorizationCodeWithPkce]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[re.Implicit]:{clientId:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],accessToken:""},[re.Password]:{username:"",password:"",clientId:"",clientSecret:"",tokenUrl:"",accessToken:"",scopes:[]}},oxe={securityType:J.NoAuth,securitySchemeId:null,[J.BasicAuth]:{username:"",password:""},[J.JWT]:{token:""},[J.DigestAuth]:{username:"",password:"",nc:"00000001",realm:"",nonce:"",opaque:"",qop:"",algorithm:"",cnonce:""},[J.APIKey]:{location:$i.Header,name:"",key:""},[J.OAuth2]:gP,[J.OpenIDConnect]:{...gP,openIdConnectUrl:"",userInfoUrl:""}},axe={clientCredentials:re.ClientCredentials,clientCredentialsWithJwtAssertion:re.ClientCredentialsWithJwtAssertion,authorizationCode:re.AuthorizationCode,authorizationCodeWithPkce:re.AuthorizationCodeWithPkce,implicit:re.Implicit,password:re.Password},hy="urn:ietf:params:oauth:client-assertion-type:jwt-bearer";var lr=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(lr||{});const lxe={[lr.SIMPLE]:{condition:"",type:lr.SIMPLE},[lr.REGEX]:{condition:"",type:lr.REGEX,context:""},[lr.JSONPATH]:{condition:"",type:lr.JSONPATH,context:""},[lr.XPATH]:{condition:"",type:lr.XPATH,context:""}};function Id(){return structuredClone({type:$n.Text,content:"",activeExampleName:"",formData:{"multipart/form-data":[],"application/x-www-form-urlencoded":[]},binary:null,graphql:{variables:""}})}const cxe={method:"GET",url:"",security:[fs()],body:Id(),queryParameters:[],headers:[],cookies:[],pathParameters:[]};function U7(){return structuredClone(cxe)}function fs(){return Ro(oxe)}function B7(t){return Ro({id:crypto.randomUUID(),...lxe[t]})}function F7(t){return!t||typeof t!="object"?[]:Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:e,value:typeof n=="string"?n:JSON.stringify(n),active:!0,type:"text",files:null}))}function uxe(t){return typeof t!="string"?JSON.stringify(t,null,2):t}function Y7(t,e,n){for(const r of n){const i=L_(t,r),s=L_(e,r);if(typeof i=="object"&&typeof s=="object"){if(!Y7(i,s,n))return!1}else if(i!==s)return!1}return!0}function L_(t,e){const n=e.split("/");let r=t;for(const i of n)if(r&&typeof r=="object"&&i in r)r=r[i];else return;return r}function dxe(t,e){return t.length===e.length&&t.sort().join()===e.sort().join()}function fxe(t,e){return t.every(n=>e.includes(n))}function hxe(t){switch(t){case"query":return $i.Query;case"cookie":return $i.Cookie;case"header":return $i.Header;default:return}}function pxe(t,e,n){const{security:r}=e,i=t?.inputs??[];if(!n)return!1;const s=Lb(n),o=s.map(c=>c.securityType),a=r.map(c=>c.securityType);return dxe(o,a)?!r.every(c=>{const u=c.securityType,f=c[J.OAuth2]?.grantType,h=o.includes(u),p=s.find(v=>v.securityType===u),m=!p||Y7(c,p,mxe(u,f)),g=gxe(c,u,c[J.OAuth2]?.grantType,i),O=!!(h&&p&&m&&g);return!n.security?.length||O}):!0}function gxe(t,e,n,r){if(e===J.OAuth2&&(n===re.AuthorizationCode||n===re.AuthorizationCodeWithPkce||n===re.Implicit)){const i=t[J.OAuth2][n]?.availableScopes,s=zb(t[J.OAuth2][n]?.scopes,r);return fxe(s,i)}return!0}function mxe(t,e){return t===J.APIKey?[`${J.APIKey}/name`,`${J.APIKey}/location`]:t===J.OAuth2?[`${J.OAuth2}/grantType`,...Oxe(e)]:t===J.OpenIDConnect?[`${J.OpenIDConnect}/openIdConnectUrl`]:[]}function Oxe(t){return t===re.ClientCredentials?[`${J.OAuth2}/${re.ClientCredentials}/tokenUrl`]:t===re.Password?[`${J.OAuth2}/${re.Password}/tokenUrl`]:t===re.Implicit?[`${J.OAuth2}/${re.Implicit}/authorizationUrl`]:t===re.AuthorizationCode?[`${J.OAuth2}/${re.AuthorizationCode}/tokenUrl`,`${J.OAuth2}/${re.AuthorizationCode}/authorizationUrl`]:t===re.AuthorizationCodeWithPkce?[`${J.OAuth2}/${re.AuthorizationCodeWithPkce}/tokenUrl`,`${J.OAuth2}/${re.AuthorizationCodeWithPkce}/authorizationUrl`]:[]}function vxe(t){return t.map(e=>{const n=e.map(r=>r.id).join("_");return e.map(r=>({...r,schemeId:n}))})}function yxe(t){const e=t.security||[],n=e.map(r=>{let i="";const s=[];return r.forEach((o,a)=>{i=a===0?`${o.id}`:`${i}_${o.id}`,s.push(L$(o))}),{id:i,security:s}});return e.length?n:[]}function bxe(t,e){const n=t.security||[];return n?.length?nq(n).map((r,i)=>L$(r)):[]}function G7(t){if(!(t.securityType!==J.NoAuth||!t.securitySchemeId))return t.unsupportedScheme}function Lb(t){const n=(t.security||[])[0];return n?n.map(r=>L$(r)):[fs()]}const xxe={[J.OAuth2]:"oauth2",[J.OpenIDConnect]:"openIdConnect",[J.APIKey]:"apiKey",[J.JWT]:"http-bearer"};function Sxe(t){return xxe[t]}function wxe(t){const e=z$(t);return(e?[...Xi(e)][0]:void 0)??Cxe(t)}function Cxe(t){const e=t.securitySchemeId;if(e){if(t.securityType===J.JWT)return e+Ge.SecurityVariablesEnvSuffix.JWTToken;if(t.securityType===J.APIKey)return e+Ge.SecurityVariablesEnvSuffix.APIKey;if(t.securityType===J.OAuth2||t.securityType===J.OpenIDConnect)return e+Ge.SecurityVariablesEnvSuffix.Token}}function Pxe(t,e){const n=z$(t);if(!n)return"";const r=[...Xi(n)][0];return r?e.find(i=>i.name===r)?.value??"":n}function V_(t,e){if(t.securityType===J.JWT)return{...t,[J.JWT]:{...t[J.JWT],token:e}};if(t.securityType===J.APIKey)return{...t,[J.APIKey]:{...t[J.APIKey],key:e}};if(t.securityType===J.OAuth2||t.securityType===J.OpenIDConnect){const n=t.securityType,r=t[n],i=r.grantType;return{...t,[n]:{...r,[i]:{...r[i],accessToken:e}}}}return t}function z$(t){if(t.securityType===J.JWT)return t[J.JWT].token;if(t.securityType===J.APIKey)return t[J.APIKey].key;if(t.securityType===J.OAuth2){const e=t[J.OAuth2];return e[e.grantType]?.accessToken}if(t.securityType===J.OpenIDConnect){const e=t[J.OpenIDConnect];return e[e.grantType]?.accessToken}}function L$(t,e){const n={...fs(),securitySchemeId:t.id},r=Vb(t);n.securityType=r,n.unsupportedScheme=r===J.NoAuth?t.scheme||t.type:void 0;const i=t.id;if(t.id&&r!==J.NoAuth&&(n[r].schemeName=t.id),r===J.BasicAuth&&(n[J.BasicAuth].username||(n[J.BasicAuth].username=gn(i+Ge.SecurityVariablesEnvSuffix.Username)),n[J.BasicAuth].password||(n[J.BasicAuth].password=gn(i+Ge.SecurityVariablesEnvSuffix.Password))),r===J.DigestAuth&&(n[J.DigestAuth].username||(n[J.DigestAuth].username=gn(i+Ge.SecurityVariablesEnvSuffix.Username)),n[J.DigestAuth].password||(n[J.DigestAuth].password=gn(i+Ge.SecurityVariablesEnvSuffix.Password))),r===J.JWT&&!n[J.JWT].token&&(n[J.JWT].token=gn(i+Ge.SecurityVariablesEnvSuffix.JWTToken)),r===J.APIKey&&!n[J.APIKey].key){n[J.APIKey].name=t.name||"",n[J.APIKey].key=gn(i+Ge.SecurityVariablesEnvSuffix.APIKey);const s=hxe(t.in);s&&(n[J.APIKey].location=s)}if(r===J.OAuth2){const s=W$(t),o=gn(i+Ge.SecurityVariablesEnvSuffix.Token),a=n[J.OAuth2];a.grantType=s[0],s.forEach(l=>{l===re.AuthorizationCode&&!a[re.AuthorizationCode].accessToken&&(a[re.AuthorizationCode].accessToken=o,a[re.AuthorizationCode].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),a[re.AuthorizationCode].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[re.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[re.AuthorizationCode].clientSecret=gn(i+Ge.SecurityVariablesEnvSuffix.ClientSecret),a[re.AuthorizationCode].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[re.AuthorizationCode].scopes=[...Ja(t.flows?.authorizationCode?.scopes||{})||[]]),l===re.AuthorizationCodeWithPkce&&!a[re.AuthorizationCodeWithPkce].accessToken&&(a[re.AuthorizationCodeWithPkce].accessToken=o,a[re.AuthorizationCodeWithPkce].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),a[re.AuthorizationCodeWithPkce].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[re.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[re.AuthorizationCodeWithPkce].clientSecret=gn(i+Ge.SecurityVariablesEnvSuffix.ClientSecret),a[re.AuthorizationCodeWithPkce].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[re.AuthorizationCodeWithPkce].scopes=[...Ja(t.flows?.authorizationCode?.scopes||{})]),l===re.ClientCredentials&&!a[re.ClientCredentials].accessToken&&(a[re.ClientCredentials].accessToken=o,a[re.ClientCredentials].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),a[re.ClientCredentials].clientSecret=gn(i+Ge.SecurityVariablesEnvSuffix.ClientSecret),a[re.ClientCredentials].tokenUrl=t.flows?.clientCredentials?.tokenUrl||"",a[re.ClientCredentials].scopes=[...Ja(t.flows?.clientCredentials?.scopes||{})]),l===re.ClientCredentialsWithJwtAssertion&&!a[re.ClientCredentialsWithJwtAssertion].accessToken&&(a[re.ClientCredentialsWithJwtAssertion].accessToken=o,a[re.ClientCredentialsWithJwtAssertion].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),a[re.ClientCredentialsWithJwtAssertion].clientAssertion=gn(i+Ge.SecurityVariablesEnvSuffix.ClientAssertion),a[re.ClientCredentialsWithJwtAssertion].scopes=[...Ja(t.flows?.clientCredentials?.scopes||{})]),l===re.Implicit&&!a[re.Implicit].accessToken&&(a[re.Implicit].accessToken=o,a[re.Implicit].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),a[re.Implicit].authorizationUrl=t.flows?.implicit?.authorizationUrl||"",a[re.Implicit].availableScopes=Object.keys(t.flows?.implicit?.scopes||{})||[],a[re.Implicit].scopes=[...Ja(t.flows?.implicit?.scopes||{})]),l===re.Password&&!a[re.Password].accessToken&&(a[re.Password].accessToken=o,a[re.Password].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),a[re.Password].clientSecret=gn(i+Ge.SecurityVariablesEnvSuffix.ClientSecret),a[re.Password].tokenUrl=t.flows?.password?.tokenUrl||"",a[re.Password].scopes=[...Ja(t.flows?.password?.scopes||{})])})}if(r===J.OpenIDConnect){const s=gn(i+Ge.SecurityVariablesEnvSuffix.Token),o=n[J.OpenIDConnect];o[re.AuthorizationCode].accessToken||(o[re.AuthorizationCode].accessToken=s,o[re.AuthorizationCode].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),o[re.AuthorizationCode].clientSecret=gn(i+Ge.SecurityVariablesEnvSuffix.ClientSecret),o[re.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[re.AuthorizationCodeWithPkce].accessToken||(o[re.AuthorizationCodeWithPkce].accessToken=s,o[re.AuthorizationCodeWithPkce].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),o[re.AuthorizationCodeWithPkce].clientSecret=gn(i+Ge.SecurityVariablesEnvSuffix.ClientSecret),o[re.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[re.Implicit].accessToken||(o[re.Implicit].accessToken=s,o[re.Implicit].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId))}return n}function H7(t){try{const e=JSON.parse(t);return JSON.stringify(e,null,2)}catch(e){return console.error({error:e}),t}}function kxe(t,e){return t==="application/json"&&!!e}function J7(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function Txe(t){try{const e=JSON.stringify(t);return e===void 0?"undefined":e}catch{return String(t)}}function K7(t,e){return e&&e.length>0?X7(e):vo(t||[],{})}function $xe(t,e,n){if(e&&e.length>0){const r=X7(e);return Ixe(r,n)}return vo(t||[],{boundNames:n})}function Ixe(t,e){return t.map(n=>!n.key||!e.has(n.key)?n:{...n,value:`$inputs.${n.key}`,active:!0})}function Exe(t,e=!1,n="",r){const i=M$(t.parameters,"in"),s=eq(t),o=Lb(t),a=K7(i.query,i.querystring);return{id:crypto.randomUUID(),name:t.name,operationId:t.operationId,collectionPath:r,apiPath:{path:t.path,method:t.method},apiId:n,isAdditionalOperation:e,request:{pathParameters:vo(i.path||[],{}),method:t.method.toLowerCase()==="x-query"?"QUERY":t.method.toLocaleUpperCase(),url:Cg(sxe(t.path),a),headers:vo(i.header||[],{}),queryParameters:a,cookies:vo(i.cookie||[],{}),body:s,security:o},response:null}}function V$(t,e){const n=M$(t.parameters,"in"),r=eq(t),i=Lb(t),s=vo(n.path||[],{boundNames:"all"});return e?{parameters:{pathParameters:s,queryParameters:$xe(n.query,n.querystring,Z7(n.query,n.querystring,e)),headers:vo(n.header||[],{boundNames:td(n.header,"header",e)}),cookies:vo(n.cookie||[],{boundNames:td(n.cookie,"cookie",e)})},requestBody:r,security:i}:{parameters:{pathParameters:s,queryParameters:K7(n.query,n.querystring),headers:vo(n.header||[],{}),cookies:vo(n.cookie||[],{})},requestBody:r,security:i}}function Axe(t,e){const n=new Di({format:!0});if(typeof t=="string")return e?.includes("json")?H7(t):t;if(typeof t=="object"&&t!==null&&e?.includes("xml")){const i=Array.isArray(t)?t:{root:t};return n.build(i)}return JSON.stringify(t,null,2)}function Qxe(t){return zT.includes(t)}function eq(t){const e=t.body?.mediaTypes;if(!e||!Object.keys(e).length)return Id();const n=jxe(e,t),r=n?.name||"",i=Qxe(r),s=!i&&!GV.includes(r),o=mP(n),l=o.find(({key:f})=>f===t.body?.activeExampleName)?.value??o[0]?.value,c=s&&l?Axe(l,r):"",u={"multipart/form-data":W_(e["multipart/form-data"]),"application/x-www-form-urlencoded":W_(e["application/x-www-form-urlencoded"])};if(i&&l){const f=F7(l);f.length&&(u[r]=f)}return{...Id(),activeExampleName:t.body?.activeExampleName||o[0]?.key||"",...n&&{type:n.name},content:c,formData:u}}function tq(t){return t?{...(Object.keys(t?.body?.mediaTypes||{})||[]).reduce((n,r)=>(n[r]={name:r,extensions:void 0},n),{}),...Cc}:Cc}function W_(t){return t?t.parameters?t.parameters.map(e=>({id:crypto.randomUUID(),key:e.name,value:String(e.example)||"",active:!0,type:e.inputType,files:null})):[]:[]}const Rxe="Untitled example";function mP(t){const e=t?.examples;return Object.keys(e||{}).map(n=>{const r=e?.[n];return{name:(zd.isString(r?.summary)?r?.summary:r?.summary?.raw)?.trim()||n||Rxe,key:n,value:e?.[n].value}})}function jxe(t,e){const n=tq(e),r=Object.keys(t).find(i=>!!n[i]);return r?t[r]:null}function _xe(t){return!t?.security?.length||!t?[]:bxe(t)}function nq(t){const e=new Set;return t.flat().filter(n=>e.has(n.id)?!1:(e.add(n.id),!0))}function Vb(t){if(t.type==="http"){const e=t.scheme?.toLowerCase();if(e==="bearer")return J.JWT;if(e==="basic")return J.BasicAuth;if(e==="digest")return J.DigestAuth}else{if(t.type==="apiKey")return J.APIKey;if(t.type==="oauth2")return J.OAuth2;if(t.type==="openIdConnect")return J.OpenIDConnect}return J.NoAuth}function Dxe(t,e){if(t==="clientCredentials"&&e&&"x-assertionType"in e&&e["x-assertionType"]===hy)return re.ClientCredentialsWithJwtAssertion;if(t==="authorizationCode"&&e&&"x-usePkce"in e&&e["x-usePkce"])return re.AuthorizationCodeWithPkce;switch(t){case"implicit":return re.Implicit;case"password":return re.Password;case"clientCredentials":return re.ClientCredentials;case"authorizationCode":return re.AuthorizationCode;default:return re.AuthorizationCode}}function Nxe(t,e){const n=t?.security;if(!n?.length)return[];const s=vxe(n).flat().filter(o=>o.schemeId===e).find(o=>Vb(o)===J.OAuth2);return W$(s)}function W$(t){return Object.entries(t?.flows||{}).map(([e,n])=>Dxe(e,n)).filter(Boolean)}function Ki(t){try{return new URL(t),!0}catch{return!1}}function Mxe(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(c7(e))n=e;else if(!e.startsWith("/"))n=aP(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return aP(n)}function X_(t,e){let n=t;return e.forEach(({key:r,value:i,active:s})=>{i&&s&&(n=n.replaceAll(`{${r}}`,i))}),n}function rq(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function zxe(t){return t.startsWith("http://")||t.startsWith("https://")}function Dm({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(zxe(t)||!e)r=t;else{const i=new URL(e);i.pathname=t,i.search="",i.hash="",r=i.toString()}return n?`${n}${r}`:r}const iq="New Step";function OP({name:t=iq,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=Lxe(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function Lxe(t){return t.steps.filter(e=>e.state!==$t.Draft).map(e=>e.stepId)}function jo({name:t=iq,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:s,dynamicReplayValues:o,xOperation:a}={}){if(!n){const c=s?V$(s,o):null,u=[fs()];return{stepId:OP({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?$t.Draft:$t.Normal,parameters:{pathParameters:[],queryParameters:a?Pg(a.url):[],headers:[],cookies:[]},requestBody:Id(),xOperation:a??(i?null:{method:"GET",url:""}),security:u,operation:i??null,...c}}const l=n;return{stepId:OP({name:t,workflow:r}),description:l.description,outputs:l.outputs,successCriteria:l.successCriteria,state:e?$t.Draft:$t.Normal,parameters:l.parameters,requestBody:l.requestBody,xOperation:l.xOperation,security:l.security,operation:l.operation}}function xl(t){return t.xOperation?.method??t.operation?.method??""}function Ep(t){return t.xOperation?.url??t.operation?.path??""}function Wb(t,e,n,r,i){const{inputs:s,servers:o}=r,a=N0e(ll("path",[vn(e?.parameters.pathParameters,n?.components.parameters),vn(t.parameters.pathParameters,n?.components.parameters)]),r.inputs,i),l=t.xOperation??null,c=t.operation??null;let u="",f="";if(l)f=l.method,u=X_(l.url,a);else if(c){const m=o.find(O=>O.apiId===c.apiId);f=c.method==="x-query"?"query":c.method,u=(m?.value?rq(m.value,m.variables):"")+X_(c.path,a)}const h=u.split("?")[0];return{url:ed(h,s,i??{}),method:f.toUpperCase()}}function Vxe(){return structuredClone({id:crypto.randomUUID(),state:hn.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:De.Step,draftStep:jo(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1}})}function Wxe(t){return t?.data?.type===De.Step}function Xxe(t,e){const{collectionId:n,workflowId:r,stepId:i}=e,s=e.draftStep??null;return n&&r&&i?wg(t,{collectionId:n,workflowId:r,stepId:i})??s:s}function qxe(t,e,n,r,i,s){const o=a=>a??"";return o(t)===r&&o(e)===i&&o(n)===s}const vP="New workflow";function sq({name:t=vP,collection:e}){let r=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||vP).replaceAll(" ","-").toLowerCase();if(!e)return r;const i=Zxe(e);if(i.includes(r)){let s=1;for(;i.includes(`${r}-${s}`);)s++;r=`${r}-${s}`}return r}function Zxe(t){return t.workflows.filter(e=>e.state!==$t.Draft).map(e=>e.workflowId)}function X$({name:t=vP,isDraft:e=!1,collection:n}={}){return{workflowId:sq({name:t,collection:n}),summary:t,steps:[],state:e?$t.Draft:$t.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[fs()]}}function Uxe(t,e){const n=new Set,r=e?.components.parameters,{pathParameters:i,queryParameters:s,headers:o,cookies:a}=t.parameters,l=t.outputs;for(const{value:c}of[...vn([...i,...s,...o,...a],r),...l])for(const u of Xi(c))n.add(u);return t.steps.forEach(c=>{const u=c.security;for(const v of u)switch(v.securityType){case J.BasicAuth:case J.DigestAuth:for(const x of[v[v.securityType].username,v[v.securityType].password])for(const y of Xi(x))n.add(y);break;case J.JWT:for(const x of Xi(v[v.securityType].token))n.add(x);break;case J.APIKey:for(const x of Xi(v[v.securityType].key))n.add(x);break;case J.OAuth2:case J.OpenIDConnect:{const x=v[v.securityType];for(const y of Xi(x[x.grantType].accessToken))n.add(y);break}}const{pathParameters:f,queryParameters:h,headers:p,cookies:m}=c.parameters,g=c.outputs;for(const{value:v}of[...vn([...f,...h,...p,...m],r),...g])for(const x of Xi(v))n.add(x);const O=c.requestBody;switch(O.type){case gt.FormData:case gt.UrlEncoded:{for(const{value:v}of O.formData[O.type])for(const x of Xi(v))n.add(x);break}case gt.Binary:break;default:for(const v of Xi(O.content))n.add(v)}}),n}function oq(t,e,n,r){const i=Uxe(t,n);if(i.size===0){r(({inputs:s,...o})=>o);return}r(s=>{const o=s.inputs,a=typeof o=="object"&&o?.properties||{};return{...s,inputs:{type:"object",properties:Object.fromEntries(Array.from(i).map(l=>{const c=e.inputs.find(u=>u.name===l)?.isSecret;return[l,c?{type:"string",format:"password"}:a[l]||{type:"string"}]}))}}})}function of(t){return t.summary||t.workflowId||"Untitled Workflow"}function aq(t){return t.flatMap(e=>{const n=e.id,r=e.paths??{};return Object.keys(r).flatMap(i=>{const s=r[i]??{},o=Object.keys(s).filter(c=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(c.toLowerCase())).map(c=>{const u=s[c];return{apiId:n,path:i,method:c,operationId:u?.operationId||"",summary:u?.summary,isAdditionalOperation:!1}}),a=s.additionalOperations,l=a?Object.entries(a).map(([c,u])=>({apiId:n,path:i,method:c,operationId:u.operationId||"",summary:u.summary,isAdditionalOperation:!0})):[];return[...o,...l]})})}const Xb=(t,e,n)=>{if(!e)return null;const{apiId:r,method:i,path:s}=e,o=t.find(l=>l.id===r);if(!o)return null;if(n)try{return n(s,i,o)??null}catch(l){console.error("Failed to convert operation to replay value",l)}const a=o.paths?.[s]?.[i];return a?{id:a.operationId??"",name:a.summary??"",method:i,path:s,href:"",operationId:a.operationId,parameters:[],servers:[],security:[]}:null};function qb(t){const e=Vs(),{convertOperationToReplayValue:n}=Un();return b.useMemo(()=>Xb(e,t,n),[e,t,n])}function q$(){const t=YT(),{convertOperationToReplayValue:e}=Un();return{getApiOperation:b.useCallback(r=>Xb(t(),r,e),[t,e])}}function lq(t){const e=(t.match(/{([^}]+)}/g)||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function Bxe(t){const e=t.servers?.[0];if(!e)return{url:"",variables:[]};const n=e.url,i=lq(n).map(s=>({name:s,value:e.variables?.[s]?.default||""}));return{url:n,variables:i}}function cq(){const t=YT(),e=ds();function n(r){const i=t().find(a=>a.id===r);if(!i){console.error(`API ${r} not found`);return}const{url:s,variables:o}=Bxe(i);e(a=>{let l=!1;const c=a.map(u=>u.servers.some(f=>f.apiId===r)?u:(l=!0,{...u,servers:[...u.servers,{apiId:r,value:s,variables:o}]}));return l?c:a})}return{attachApiServerToEnvironments:n}}class qt{static utils=null;static async getUtils(){return qt.utils||(qt.utils=On()?await Promise.resolve().then(()=>require("./replay-tauri-path-9tVlry3g.js")):{join:Ha.join,resolve:Ha.resolve,isAbsolute:Ha.isAbsolute,relative:Ha.relative,extname:Ha.extname,dirname:Ha.dirname}),qt.utils}static async dirname(e){return(await qt.getUtils()).dirname(e)}static async join(...e){return(await qt.getUtils()).join(...e)}static async resolve(e){return(await qt.getUtils()).resolve(e)}static async isAbsolute(e){return(await qt.getUtils()).isAbsolute(e)}static async relative(e,n){return(await qt.getUtils()).relative(e,n)}static async extname(e){return(await qt.getUtils()).extname(e)}}function Fxe({apiName:t="new-api-source",sourceDescriptions:e}){let n=t.replaceAll(/[\s.]/g,"-").toLowerCase();if(!e.length)return n;const r=e.map(i=>i.name);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function q_(t,e){return`${t}\0${e}`}function Vc(){const t=_b(),e=Xo(),n=YT(),{attachApiServerToEnvironments:r}=cq();async function i({collectionId:l,apiId:c}){const u=Td(t(),l);if(!u)return;if(!u.sourceDescriptions.some(h=>h.apiId===c)){const p=n().find(g=>g.id===c)?.info.title,m=Ki(c)?c:await qt.relative(`/${l}/..`,`/${c}`);e(g=>ii(g,l,O=>O.sourceDescriptions.some(v=>v.apiId===c)?O:{...O,sourceDescriptions:[...O.sourceDescriptions,{name:Fxe({apiName:p,sourceDescriptions:O.sourceDescriptions}),url:m,apiId:c}]}))}r(c)}function s(l){return Td(t(),l)}function o(l,c){e(u=>ii(u,l,f=>({...f,sourceDescriptions:f.sourceDescriptions.filter(h=>c.name!==h.name)})))}function a(l,c){const u=new Set(c.map(f=>q_(f.workflowId??"",f.stepId)));e(f=>ii(f,l,h=>{const p=h.workflows.map(m=>{const g=m.steps.map(O=>!u.has(q_(m.workflowId,O.stepId))||!O.operation?O:{...O,xOperation:{method:O.operation.method,url:O.operation.path},operation:null});return g.every((O,v)=>O===m.steps[v])?m:{...m,steps:g}});return p.every((m,g)=>m===h.workflows[g])?h:{...h,workflows:p}}))}return{attachApiToCollection:i,getCollection:s,removeSourceDescription:o,disconnectStepsFromSource:a}}class Z_{storage;constructor(e){this.storage=e}async initialize(){await this.storage.initialize()}getAll(e){return this.storage.read(e)}getRecent(e=50,n){return this.storage.getRecent(e,n)}getById(e){return this.storage.getById(e)}addItem(e){return this.storage.addItem(e)}updateItem(e,n){return this.storage.updateItem(e,n)}deleteItem(e){return this.storage.deleteItem(e)}clear(){return this.storage.clear()}count(e){return this.storage.count(e)}}const yP=(t,e)=>e.some(n=>t instanceof n);let U_,B_;function Yxe(){return U_||(U_=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Gxe(){return B_||(B_=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const bP=new WeakMap,f1=new WeakMap,Zb=new WeakMap;function Hxe(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(hc(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return Zb.set(e,t),e}function Jxe(t){if(bP.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});bP.set(t,e)}let xP={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return bP.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return hc(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function uq(t){xP=t(xP)}function Kxe(t){return Gxe().includes(t)?function(...e){return t.apply(SP(this),e),hc(this.request)}:function(...e){return hc(t.apply(SP(this),e))}}function e1e(t){return typeof t=="function"?Kxe(t):(t instanceof IDBTransaction&&Jxe(t),yP(t,Yxe())?new Proxy(t,xP):t)}function hc(t){if(t instanceof IDBRequest)return Hxe(t);if(f1.has(t))return f1.get(t);const e=e1e(t);return e!==t&&(f1.set(t,e),Zb.set(e,t)),e}const SP=t=>Zb.get(t);function t1e(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=hc(o);return r&&o.addEventListener("upgradeneeded",l=>{r(hc(o.result),l.oldVersion,l.newVersion,hc(o.transaction),l)}),n&&o.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{s&&l.addEventListener("close",()=>s()),i&&l.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const n1e=["get","getKey","getAll","getAllKeys","count"],r1e=["put","add","delete","clear"],h1=new Map;function F_(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(h1.get(e))return h1.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=r1e.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||n1e.includes(n)))return;const s=async function(o,...a){const l=this.transaction(o,i?"readwrite":"readonly");let c=l.store;return r&&(c=c.index(a.shift())),(await Promise.all([c[n](...a),i&&l.done]))[0]};return h1.set(e,s),s}uq(t=>({...t,get:(e,n,r)=>F_(e,n)||t.get(e,n,r),has:(e,n)=>!!F_(e,n)||t.has(e,n)}));const i1e=["continue","continuePrimaryKey","advance"],Y_={},wP=new WeakMap,dq=new WeakMap,s1e={get(t,e){if(!i1e.includes(e))return t[e];let n=Y_[e];return n||(n=Y_[e]=function(...r){wP.set(this,dq.get(this)[e](...r))}),n}};async function*o1e(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,s1e);for(dq.set(n,e),Zb.set(n,SP(e));e;)yield n,e=await(wP.get(n)||e.continue()),wP.delete(n)}function G_(t,e){return e===Symbol.asyncIterator&&yP(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&yP(t,[IDBIndex,IDBObjectStore])}uq(t=>({...t,get(e,n,r){return G_(e,n)?o1e:t.get(e,n,r)},has(e,n){return G_(e,n)||t.has(e,n)}}));class Z${constructor(e,n,r){this.dbName=e,this.version=n,this.setupCallback=r}dbName;version;setupCallback;db=null;static createInstance(e,n,r){return new Z$(e,n,r)}async initialize(){this.db||(this.db=await t1e(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const a1e=1;class U${constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=Z$.createInstance(n,a1e,this.setupDatabase);return new U$(r)}static setupDatabase(e){if(!e.objectStoreNames.contains("history")){const n=e.createObjectStore("history",{keyPath:"id"});n.createIndex("by-date","date"),n.createIndex("by-type","type"),n.createIndex("by-workflow","workflowId")}}get storeName(){return"history"}async getDb(){return await this.indexedDB.initialize(),this.indexedDB.db}async initialize(){await this.indexedDB.initialize()}async read(e){const r=(await this.getDb()).transaction(this.storeName,"readonly"),i=e?.type?await r.store.index("by-type").getAll(e.type):await r.store.index("by-date").getAll();return await r.done,i.sort((s,o)=>o.date-s.date)}async addItem(e){await(await this.getDb()).put(this.storeName,e)}async updateItem(e,n){const r=await this.getDb(),i=await r.get(this.storeName,e);if(i){const{id:s,type:o,...a}=n;await r.put(this.storeName,{...i,...a})}}async deleteItem(e){await(await this.getDb()).delete(this.storeName,e)}async clear(){await(await this.getDb()).clear(this.storeName)}async getById(e){return await(await this.getDb()).get(this.storeName,e)||null}async getRecent(e,n){const i=(await this.getDb()).transaction(this.storeName,"readonly"),s=n?.type?await i.store.index("by-type").getAll(n.type):await i.store.index("by-date").getAll();return await i.done,s.sort((o,a)=>a.date-o.date).slice(0,e)}async count(e){const n=await this.getDb();if(e?.type){const r=n.transaction(this.storeName,"readonly"),i=await r.store.index("by-type").count(e.type);return await r.done,i}return await n.count(this.storeName)}}class cl{static instance=null;static async initialize(e,n){this.close(),this.instance=await l1e(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function l1e(t,e){if(e){const{HistorySqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-HistorySqliteDBStorage-BrILW8Fu.js")),r=Ip.getInstance(),i=new n(r);return new Z_(i)}else{const n=U$.create(t.id);return new Z_(n)}}const $r={all:["history"],lists:()=>[...$r.all,"list"],list:t=>[...$r.lists(),t],recent:(t,e)=>[...$r.all,"recent",t,e],detail:t=>[...$r.all,"detail",t],count:t=>[...$r.all,"count",t]};function c1e(t){return qr.useQuery({queryKey:$r.list(t),queryFn:async()=>cl.getInstance().getAll(t)})}function fq(){const t=qr.useQueryClient();return qr.useMutation({mutationFn:async e=>{await cl.getInstance().addItem(e)},onMutate:e=>{t.setQueryData($r.detail(e.id),e)},onSuccess:()=>{t.invalidateQueries({queryKey:$r.lists()}),t.invalidateQueries({queryKey:$r.count()})},onError:(e,n)=>{t.removeQueries({queryKey:$r.detail(n.id)}),console.error("Failed to add history item:",e)}})}function u1e(){const t=qr.useQueryClient();return qr.useMutation({mutationFn:async e=>{await cl.getInstance().deleteItem(e)},onSuccess:(e,n)=>{t.removeQueries({queryKey:$r.detail(n)}),t.invalidateQueries({queryKey:$r.lists()}),t.invalidateQueries({queryKey:$r.count()})},onError:(e,n)=>{console.error(`Failed to delete history item ${n}:`,e)}})}function d1e(){const t=qr.useQueryClient();return qr.useMutation({mutationFn:async()=>{await cl.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:$r.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function f1e(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function h1e(){const t=fq();return b.useCallback(({step:e,response:n})=>{const r=f1e(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function p1e(){const t=fq();return b.useCallback(async({workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:s,durationMs:o})=>{const a=crypto.randomUUID(),l={id:a,date:Date.now(),type:"workflow",workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:s,durationMs:o};try{return await t.mutateAsync(l),a}catch{return null}},[t])}function g1e(){const t=qr.useQueryClient();async function e(n){return t.ensureQueryData({queryKey:$r.detail(n),queryFn:()=>cl.getInstance().getById(n)})}return{getHistoryItem:e}}function hq(){const t=_b();return{getStep:n=>wg(t(),n)}}function m1e(t){const e=Yr();return wg(e,{collectionId:t?.collectionId??null,workflowId:t?.workflowId??null,stepId:t?.stepId??null})??t?.draftStep??null}function pq(t,e){const n=t?.collectionId??null,r=t?.workflowId??null,i=t?.stepId??null,s=Yr(),o=Xo(),a=wg(s,{collectionId:n,workflowId:r,stepId:i});if(a)return{step:a,updateStep:c=>o(u=>Db(u,{collectionId:n,workflowId:r,stepId:i},c))};const l=t?.draftStep??null;return l?{step:l,updateStep:c=>e(u=>({...u,draftStep:u.draftStep?c(u.draftStep):u.draftStep}))}:null}function B$(){const t=_b();return{getWorkflow:({collectionId:n,workflowId:r})=>Sg(t(),{collectionId:n,workflowId:r})}}function ei(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)}function TO(t,e,n,r,i){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var lu,no,cu,$O;const H_="__TAURI_TO_IPC_KEY__";function gq(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}class mq{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,lu.set(this,()=>{}),no.set(this,0),cu.set(this,[]),this.id=gq(({message:e,id:n})=>{if(n==ei(this,no,"f"))for(ei(this,lu,"f").call(this,e),TO(this,no,ei(this,no,"f")+1);ei(this,no,"f")in ei(this,cu,"f");){const r=ei(this,cu,"f")[ei(this,no,"f")];ei(this,lu,"f").call(this,r),delete ei(this,cu,"f")[ei(this,no,"f")],TO(this,no,ei(this,no,"f")+1)}else ei(this,cu,"f")[n]=e})}set onmessage(e){TO(this,lu,e)}get onmessage(){return ei(this,lu,"f")}[(lu=new WeakMap,no=new WeakMap,cu=new WeakMap,H_)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[H_]()}}async function Ze(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}class O1e{get rid(){return ei(this,$O,"f")}constructor(e){$O.set(this,void 0),TO(this,$O,e)}async close(){return Ze("plugin:resources|close",{rid:this.rid})}}$O=new WeakMap;var nn;(function(t){t[t.Audio=1]="Audio",t[t.Cache=2]="Cache",t[t.Config=3]="Config",t[t.Data=4]="Data",t[t.LocalData=5]="LocalData",t[t.Document=6]="Document",t[t.Download=7]="Download",t[t.Picture=8]="Picture",t[t.Public=9]="Public",t[t.Video=10]="Video",t[t.Resource=11]="Resource",t[t.Temp=12]="Temp",t[t.AppConfig=13]="AppConfig",t[t.AppData=14]="AppData",t[t.AppLocalData=15]="AppLocalData",t[t.AppCache=16]="AppCache",t[t.AppLog=17]="AppLog",t[t.Desktop=18]="Desktop",t[t.Executable=19]="Executable",t[t.Font=20]="Font",t[t.Home=21]="Home",t[t.Runtime=22]="Runtime",t[t.Template=23]="Template"})(nn||(nn={}));async function v1e(){return Ze("plugin:path|resolve_directory",{directory:nn.AppConfig})}async function CP(){return Ze("plugin:path|resolve_directory",{directory:nn.AppData})}async function y1e(){return Ze("plugin:path|resolve_directory",{directory:nn.AppLocalData})}async function b1e(){return Ze("plugin:path|resolve_directory",{directory:nn.AppCache})}async function x1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Audio})}async function S1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Cache})}async function w1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Config})}async function C1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Data})}async function Oq(){return Ze("plugin:path|resolve_directory",{directory:nn.Desktop})}async function P1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Document})}async function k1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Download})}async function T1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Executable})}async function $1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Font})}async function I1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Home})}async function E1e(){return Ze("plugin:path|resolve_directory",{directory:nn.LocalData})}async function A1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Picture})}async function Q1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Public})}async function R1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Resource})}async function j1e(t){return Ze("plugin:path|resolve_directory",{directory:nn.Resource,path:t})}async function _1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Runtime})}async function D1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Template})}async function N1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Video})}async function M1e(){return Ze("plugin:path|resolve_directory",{directory:nn.AppLog})}async function z1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Temp})}function vq(){return window.__TAURI_INTERNALS__.plugins.path.sep}function L1e(){return window.__TAURI_INTERNALS__.plugins.path.delimiter}async function yq(...t){return Ze("plugin:path|resolve",{paths:t})}async function V1e(t){return Ze("plugin:path|normalize",{path:t})}async function F$(...t){return Ze("plugin:path|join",{paths:t})}async function bq(t){return Ze("plugin:path|dirname",{path:t})}async function xq(t){return Ze("plugin:path|extname",{path:t})}async function Y$(t,e){return Ze("plugin:path|basename",{path:t,ext:e})}async function Sq(t){return Ze("plugin:path|is_absolute",{path:t})}const wq=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return nn},appCacheDir:b1e,appConfigDir:v1e,appDataDir:CP,appLocalDataDir:y1e,appLogDir:M1e,audioDir:x1e,basename:Y$,cacheDir:S1e,configDir:w1e,dataDir:C1e,delimiter:L1e,desktopDir:Oq,dirname:bq,documentDir:P1e,downloadDir:k1e,executableDir:T1e,extname:xq,fontDir:$1e,homeDir:I1e,isAbsolute:Sq,join:F$,localDataDir:E1e,normalize:V1e,pictureDir:A1e,publicDir:Q1e,resolve:yq,resolveResource:j1e,resourceDir:R1e,runtimeDir:_1e,sep:vq,tempDir:z1e,templateDir:D1e,videoDir:N1e},Symbol.toStringTag,{value:"Module"}));var PP;(function(t){t[t.Start=0]="Start",t[t.Current=1]="Current",t[t.End=2]="End"})(PP||(PP={}));function G$(t){return{isFile:t.isFile,isDirectory:t.isDirectory,isSymlink:t.isSymlink,size:t.size,mtime:t.mtime!==null?new Date(t.mtime):null,atime:t.atime!==null?new Date(t.atime):null,birthtime:t.birthtime!==null?new Date(t.birthtime):null,readonly:t.readonly,fileAttributes:t.fileAttributes,dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,blksize:t.blksize,blocks:t.blocks}}class H$ extends O1e{async read(e){if(e.byteLength===0)return 0;const[n,r]=await Ze("plugin:fs|read",{rid:this.rid,len:e.byteLength});return e.set(n),r===0?null:r}async seek(e,n){return await Ze("plugin:fs|seek",{rid:this.rid,offset:e,whence:n})}async stat(){const e=await Ze("plugin:fs|fstat",{rid:this.rid});return G$(e)}async truncate(e){await Ze("plugin:fs|ftruncate",{rid:this.rid,len:e})}async write(e){return await Ze("plugin:fs|write",{rid:this.rid,data:e})}}async function W1e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await Ze("plugin:fs|create",{path:t instanceof URL?t.toString():t,options:e});return new H$(n)}async function X1e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await Ze("plugin:fs|open",{path:t instanceof URL?t.toString():t,options:e});return new H$(n)}async function q1e(t,e,n){if(t instanceof URL&&t.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await Ze("plugin:fs|copy_file",{fromPath:t instanceof URL?t.toString():t,toPath:e instanceof URL?e.toString():e,options:n})}async function Cq(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Ze("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})}async function Pq(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await Ze("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})}async function kq(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await Ze("plugin:fs|read_file",{path:t instanceof URL?t.toString():t,options:e});return n instanceof ArrayBuffer?new Uint8Array(n):Uint8Array.from(n)}async function J$(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await Ze("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e})}async function Z1e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=t instanceof URL?t.toString():t;return await Promise.resolve({path:n,rid:null,async next(){this.rid===null&&(this.rid=await Ze("plugin:fs|read_text_file_lines",{path:n,options:e}));const[r,i]=await Ze("plugin:fs|read_text_file_lines_next",{rid:this.rid});return i&&(this.rid=null),{value:i?"":r,done:i}},[Symbol.asyncIterator](){return this}})}async function Tq(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Ze("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})}async function $q(t,e,n){if(t instanceof URL&&t.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await Ze("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:n})}async function U1e(t,e){const n=await Ze("plugin:fs|stat",{path:t instanceof URL?t.toString():t,options:e});return G$(n)}async function B1e(t,e){const n=await Ze("plugin:fs|lstat",{path:t instanceof URL?t.toString():t,options:e});return G$(n)}async function F1e(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Ze("plugin:fs|truncate",{path:t instanceof URL?t.toString():t,len:e,options:n})}async function Y1e(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Ze("plugin:fs|write_file",e,{headers:{path:t instanceof URL?t.toString():t,options:JSON.stringify(n)}})}async function Iq(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Ze("plugin:fs|write_text_file",{path:t instanceof URL?t.toString():t,data:e,options:n})}async function K$(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await Ze("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})}async function Eq(t){await Ze("plugin:fs|unwatch",{rid:t})}async function G1e(t,e,n){const r={recursive:!1,delayMs:2e3,...n},i=Array.isArray(t)?t:[t];for(const a of i)if(a instanceof URL&&a.protocol!=="file:")throw new TypeError("Must be a file URL.");const s=new mq;s.onmessage=e;const o=await Ze("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{Eq(o)}}async function H1e(t,e,n){const r={recursive:!1,...n,delayMs:null},i=Array.isArray(t)?t:[t];for(const a of i)if(a instanceof URL&&a.protocol!=="file:")throw new TypeError("Must be a file URL.");const s=new mq;s.onmessage=e;const o=await Ze("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{Eq(o)}}const Ub=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return nn},FileHandle:H$,get SeekMode(){return PP},copyFile:q1e,create:W1e,exists:K$,lstat:B1e,mkdir:Cq,open:X1e,readDir:Pq,readFile:kq,readTextFile:J$,readTextFileLines:Z1e,remove:Tq,rename:$q,stat:U1e,truncate:F1e,watch:G1e,watchImmediate:H1e,writeFile:Y1e,writeTextFile:Iq},Symbol.toStringTag,{value:"Module"})),Ao=window.__TAURI__?.http.fetch??globalThis.fetch;function J_(t){try{const e=new URL(t);return(e.protocol==="http:"&&e.port==="80"||e.protocol==="https:"&&e.port==="443")&&(e.port=""),e.hostname=e.hostname.toLowerCase(),e.protocol+"//"+e.hostname+(e.port?":"+e.port:"")}catch(e){return console.error("Invalid URL",e),null}}function Aq(t,e){let n=J_(t);const r=e.find(({host:i,port:s})=>J_(`https://${i}:${s}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}const J1e={id:"default",userFilesDir:"default",systemFilesDir:"default"},py=Il(gr(J1e));py.debugLabel="project";function Wc(){return ir(py)}function kP(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const K1e=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function eSe(){const{userFilesDir:t}=Wc(),{certificates:e}=di(),n=Dt(),{getCollection:r}=Vc();return{execute:async(s,o,a)=>{const l=r(s),{inputs:c,servers:u}=n,f=l?.sourceDescriptions??[],h=`${t}/${s}`,[{createConfig:p},{ExternalResolver:m}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-C7MCjO6i.js")),Promise.resolve().then(()=>require("./replay-external-resolver-1bxcPBye.js"))]),g=new m,O=c.map(w=>JSON.stringify({[w.name]:w.value})),v=tSe(u,f),{run:x}=await Promise.resolve().then(()=>require("./replay-respect-run-BN4jlLVY.js")),y=await x({files:[h],workflow:o?[o]:[],fetch:(w,S)=>{const k=K1e(w),{clientCert:T,clientKey:$}=Aq(k,e);return Ao(k,{...S,clientCert:T,clientKey:$})},logger:Nb,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async w=>{if(!await K$(w))throw new Error(`File ${w} doesn't exist or isn't readable.`);try{const k=await J$(w),T=new TextEncoder().encode(k);return new File([T],await Y$(w))}catch(k){throw new Error(`Failed to read file ${w}: ${k}`)}}},envVariables:{},config:await p({}),externalRefResolver:g,input:O,server:v,severity:JSON.stringify(a),skipLint:!0,noSecretsMasking:!0});try{await w0e(s,o,y?.[0]?.ctx)}catch(w){console.error("Failed to persist workflow step context:",w)}return y}}}function tSe(t,e){return e.map(n=>{const r=t.find(s=>s.apiId===n.apiId);if(!r)return null;let i=r.value;if(r.variables)for(const s of r.variables){const o=new RegExp(`\\{${s.name}\\}`,"g");i=i.replace(o,s.value)}return`${n.name}=${i}`}).filter(n=>n!==null)}const nSe="com.redocly.tab.openFailed";function Mu(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:De.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,...t}}function TP(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function rSe(t,e,n){const r=t.draftStep,i=r?.xOperation;if(!r||!i)return;const s=n.url&&i.url!==n.url?n.url:null,o=i.method!==n.method?n.method:null;s===null&&o===null||e(a=>{const l=a.draftStep;return l?.xOperation?{...a,draftStep:{...l,xOperation:{...l.xOperation,...s!==null&&{url:s},...o!==null&&{method:o}},parameters:s===null?l.parameters:{...l.parameters,queryParameters:LT(Pg(s),l.parameters.queryParameters)}}}:a})}function Ln(){const{getTabs:t,getActiveTabIdx:e,setTabs:n,setActiveTabIdx:r,updateTabAt:i,updateTabDataAt:s}=Dc(),{dynamicReplayValues:o}=Un(),{getStep:a}=hq(),{getHistoryItem:l}=g1e(),{getWorkflow:c}=B$(),{getCollection:u}=Vc(),{getApiOperation:f}=q$(),{sendEvent:h}=Be(),p=Ybe(),m=b.useCallback((j,X,z,W)=>{console.warn(`[useTabHandlers] ${j}`,W),h(nSe,[{...Oe("tab",X),reason:z,...W}])},[h]),g=b.useCallback((j,X)=>{const z=t()[j];z&&z.state!==X&&i(j,W=>({...W,state:X}))},[t,i]),O=b.useCallback(j=>{r(j)},[r]),v=b.useCallback(()=>{const j=t().length;n(X=>[...X,Vxe()]),r(j)},[t,n,r]),x=b.useCallback(j=>{const X=[...t().filter(W=>W.state!==hn.Preview)];X.push(j),n(()=>X);const z=X.length-1;return r(z),z},[t,n,r]),y=b.useCallback(j=>{const X=f(j),z=eI(j,X,o);x(z)},[x,o,f]),w=b.useCallback(j=>{const X=t().findIndex(({data:z})=>an(z,De.Step)&&z.draftStep?.operation?.apiId===j.apiId&&z.draftStep?.operation?.path===j.path&&z.draftStep?.operation?.method===j.method);return X===-1?!1:(O(X),!0)},[t,O]),S=b.useCallback((j,X)=>{const z=t(),W=F=>z.findIndex(({data:G})=>an(G,De.Step)&&F(G));if(X){const F=W(ee=>ee.sourceFile===X);if(F!==-1){rSe(z[F].data,ee=>s(F,ee),j),O(F);return}const G=W(ee=>!ee.sourceFile&&TP(ee,j));if(G!==-1){s(G,ee=>({...ee,sourceFile:X})),O(G);return}}else{const F=W(G=>TP(G,j));if(F!==-1){O(F);return}}const B=jo({xOperation:j,name:X??void 0});x({id:crypto.randomUUID(),state:hn.Normal,data:Mu({draftStep:B,activeTabName:rc(B),sourceFile:X??null})})},[t,s,O,x]),k=b.useCallback(j=>{const X=t(),z=e(),W=X[z]?.id,B=X.filter((G,ee)=>ee!==j);n(()=>B);const F=j===z||!W?-1:B.findIndex(G=>G.id===W);r(F===-1?Math.max(0,j-1):F)},[t,e,r,n]),T=b.useCallback(()=>{n(()=>[]),r(0)},[r,n]);function $({collectionId:j,workflowId:X,stepId:z}){const W=t(),B=new Set;for(let F=0;F<W.length;F++){const G=W[F].data;switch(G.type){case De.Step:G.collectionId===j&&G.workflowId===X&&G.stepId===z&&B.add(F);break;case De.Workflow:case De.WorkflowRun:G.collectionId===j&&G.workflowId===X&&!z&&B.add(F);break;case De.Collection:G.collectionId===j&&!X&&!z&&B.add(F);break}}B.size&&(n(F=>F.filter((G,ee)=>!B.has(ee))),r(0))}const E=b.useCallback(async j=>{const X=t().findIndex(({data:z})=>an(z,De.Step)&&z.historyId===j);if(X!==-1)r(X);else{const z=await l(j);if(!z||!QC(z)){m("Step history not found","stepHistoryTab","step_history_not_found",{historyId:j});return}const W=z.step;x({id:crypto.randomUUID(),state:hn.Preview,data:Mu({historyId:j,draftStep:structuredClone(W),response:structuredClone(z.response),activeTabName:rc(W)})})}},[r,t,x,l,m]),_=b.useCallback(({collectionId:j,activeTabName:X})=>{const z=t().findIndex(W=>{const B=W.data;return an(B,De.Collection)&&B.collectionId===j});if(z!==-1)r(z);else{if(!u(j)){m("Collection not found","collectionTab","collection_not_found",{collectionId:j});return}x({id:crypto.randomUUID(),state:hn.Preview,data:{collectionId:j,type:De.Collection,activeTabName:X??He.COLLECTION_SETTINGS}})}},[r,t,x,u,m]),D=b.useCallback(({collectionId:j,workflowId:X})=>{if(!c({collectionId:j,workflowId:X})){m("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:j,workflowId:X});return}x({id:crypto.randomUUID(),state:hn.Normal,data:{collectionId:j,workflowId:X,historyId:null,runDate:null,type:De.WorkflowRun,result:null,severitySettings:kP()}})},[x,c,m]),R=b.useCallback(async(j,{state:X=hn.Preview}={})=>{const z=t().findIndex(({data:W})=>an(W,De.WorkflowRun)&&W.historyId===j);if(z!==-1)X===hn.Normal&&t()[z].state===hn.Preview&&g(z,hn.Normal),r(z);else{const W=await l(j);if(!W||!RC(W)){m("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:j});return}x({id:crypto.randomUUID(),state:X,data:{collectionId:W.collectionId,workflowId:W.workflowId,historyId:j,runDate:W.date,type:De.WorkflowRun,result:structuredClone(W.workflowResult),severitySettings:kP(),label:of(W.workflow),secretValues:p().inputs.filter(B=>B.isSecret&&B.value).map(B=>String(B.value))}})}},[r,t,x,g,l,m,p]),M=b.useCallback(({collectionId:j,workflowId:X})=>{const z=t().findIndex(({data:W})=>an(W,De.WorkflowRun)&&W.collectionId===j&&W.workflowId===X);return z===-1?!1:(t()[z].state===hn.Preview&&g(z,hn.Normal),O(z),!0)},[t,g,O]),L=b.useCallback(({collectionId:j,workflowId:X,activeTabName:z})=>{const W=t().findIndex(B=>{const F=B.data;return an(F,De.Workflow)&&F.workflowId===X&&F.collectionId===j});if(W!==-1)z&&s(W,B=>({...B,activeTabName:z})),r(W);else{if(!c({collectionId:j,workflowId:X})){m("Workflow not found","workflowTab","workflow_not_found",{collectionId:j,workflowId:X});return}x({id:crypto.randomUUID(),state:hn.Preview,data:{collectionId:j,workflowId:X,type:De.Workflow,activeTabName:z??He.WORKFLOW_SETTINGS}})}},[r,t,s,x,c,m]),V=b.useCallback(({collectionId:j,workflowId:X,stepId:z,state:W})=>{const B=t().findIndex(({data:F})=>an(F,De.Step)&&F.collectionId===j&&F.workflowId===X&&F.stepId===z&&F.historyId===null);if(B!==-1)r(B);else{const F=a({collectionId:j,workflowId:X,stepId:z});if(!F){m("Step not found","stepTab","step_not_found",{collectionId:j,workflowId:X,stepId:z});return}x({id:crypto.randomUUID(),state:W??hn.Preview,data:Mu({stepId:z,collectionId:j,workflowId:X,activeTabName:rc(F)})})}},[r,t,a,x,m]),I=b.useCallback(({step:j})=>{x({id:crypto.randomUUID(),state:hn.Normal,data:Mu({stepId:j.stepId??null,workflowId:j.workflowId??null,draftStep:structuredClone(j),activeTabName:rc(j)})})},[x]),q=b.useCallback((j,X)=>{if(j===X)return;const z=e(),W=[...t()],B=W[z]?.id,[F]=W.splice(j,1);if(W.splice(X,0,F),n(()=>W),B){const G=W.findIndex(ee=>ee.id===B);r(G)}},[e,t,n,r]);return{handleNewTabOpen:v,addNewTab:x,openStepTabFromOperation:y,focusOperationTab:w,openStepTabFromXOperation:S,handleTabChange:O,handleTabClose:k,handleCloseAllTabs:T,handleCloseByDataId:$,openCollectionTab:_,openWorkflowTab:L,openWorkflowRunTab:D,openWorkflowRunTabFromHistory:R,focusWorkflowRunTab:M,openStepTabFromHistory:E,openStepTabFromCollection:V,openStepTab:I,handleTabReorder:q,changeTabState:g}}function eI(t,e,n){const r=jo({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:hn.Preview,data:Mu({draftStep:r,activeTabName:rc(r)})}}function iSe(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const sSe=({transform:t})=>({...t,y:0}),oSe=({transform:t,draggingNodeRect:e,containerNodeRect:n})=>!e||!n?t:{...t,x:Math.max(n.left-e.left,Math.min(t.x,n.right-e.right))},Xc=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,aSe=t=>d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",...t,children:[d.jsx("path",{d:"M10.8623 6.60461C11.0548 6.64292 11.2314 6.73734 11.3701 6.8761C11.5089 7.01487 11.6033 7.19144 11.6416 7.38391C11.6799 7.57633 11.661 7.77588 11.5859 7.95715C11.5108 8.13849 11.3829 8.29342 11.2197 8.40247C11.0566 8.51141 10.8651 8.5694 10.6689 8.56946C10.4939 8.5686 10.3221 8.52031 10.1729 8.42883L9.40625 9.19739C9.58461 9.44901 9.67969 9.75029 9.67969 10.0587C9.67965 10.3669 9.5844 10.6676 9.40625 10.9191L10.1729 11.6886C10.3221 11.5971 10.4938 11.5479 10.6689 11.547C10.865 11.5471 11.0567 11.6052 11.2197 11.714C11.3829 11.823 11.5108 11.9781 11.5859 12.1593C11.6611 12.3406 11.6799 12.541 11.6416 12.7335C11.6033 12.9259 11.5088 13.1026 11.3701 13.2413C11.2314 13.38 11.0547 13.4745 10.8623 13.5128C10.6698 13.5511 10.4704 13.5313 10.2891 13.4562C10.1078 13.3811 9.95279 13.2541 9.84375 13.0909C9.7347 12.9277 9.67578 12.7355 9.67578 12.5392C9.6767 12.3641 9.7258 12.1923 9.81738 12.0431L9.04883 11.2765C8.79719 11.4549 8.49595 11.5509 8.1875 11.5509C7.87917 11.5509 7.57871 11.4548 7.32715 11.2765L6.55762 12.0431C6.6492 12.1923 6.6983 12.3641 6.69922 12.5392C6.69922 12.7354 6.6412 12.9278 6.53223 13.0909C6.42318 13.2541 6.26728 13.3811 6.08594 13.4562C5.90468 13.5312 5.7051 13.5511 5.5127 13.5128C5.32032 13.4745 5.14359 13.38 5.00488 13.2413C4.86618 13.1026 4.77174 12.9259 4.7334 12.7335C4.69511 12.541 4.71493 12.3406 4.79004 12.1593C4.86518 11.9782 4.99222 11.8229 5.15527 11.714C5.31843 11.605 5.51083 11.547 5.70703 11.547C5.88211 11.5479 6.05389 11.597 6.20312 11.6886L6.96973 10.9191C6.79143 10.6675 6.69535 10.367 6.69531 10.0587C6.69531 9.75027 6.79134 9.44902 6.96973 9.19739L6.20312 8.42883C6.0539 8.52041 5.88211 8.56853 5.70703 8.56946C5.51075 8.56946 5.31847 8.51151 5.15527 8.40247C4.99211 8.29342 4.86514 8.13846 4.79004 7.95715C4.71493 7.77581 4.69511 7.57642 4.7334 7.38391C4.77168 7.19148 4.86618 7.01486 5.00488 6.8761C5.14358 6.7374 5.32034 6.64296 5.5127 6.60461C5.70502 6.56636 5.90473 6.58534 6.08594 6.66028C6.26728 6.73539 6.42318 6.86329 6.53223 7.02649C6.64104 7.18953 6.69917 7.38125 6.69922 7.57727C6.69836 7.7524 6.64917 7.92407 6.55762 8.07336L7.32715 8.83997C7.57865 8.66181 7.87929 8.56656 8.1875 8.56653C8.49595 8.56653 8.79719 8.66158 9.04883 8.83997L9.81738 8.07336C9.72588 7.9241 9.67664 7.75235 9.67578 7.57727C9.67583 7.38112 9.7348 7.1896 9.84375 7.02649C9.9528 6.86329 10.1077 6.73539 10.2891 6.66028C10.4703 6.58526 10.6699 6.56634 10.8623 6.60461ZM5.60938 12.0529C5.51328 12.0721 5.42476 12.1193 5.35547 12.1886C5.28617 12.2579 5.23889 12.3464 5.21973 12.4425C5.20058 12.5388 5.21049 12.6389 5.24805 12.7296C5.28559 12.8202 5.34915 12.8978 5.43066 12.9523C5.51226 13.0068 5.60889 13.0353 5.70703 13.0353C5.83843 13.0352 5.96467 12.9836 6.05762 12.8907C6.15067 12.7977 6.20312 12.6708 6.20312 12.5392C6.20305 12.4412 6.1736 12.3453 6.11914 12.2638C6.06462 12.1822 5.98712 12.1187 5.89648 12.0812C5.80581 12.0436 5.70563 12.0337 5.60938 12.0529ZM10.5723 12.0529C10.476 12.072 10.3868 12.1192 10.3174 12.1886C10.2481 12.2579 10.2008 12.3464 10.1816 12.4425C10.1625 12.5388 10.1724 12.6389 10.21 12.7296C10.2475 12.8202 10.3111 12.8978 10.3926 12.9523C10.4742 13.0068 10.5708 13.0353 10.6689 13.0353C10.8004 13.0352 10.9266 12.9836 11.0195 12.8907C11.1126 12.7977 11.165 12.6708 11.165 12.5392C11.165 12.4412 11.1355 12.3453 11.0811 12.2638C11.0265 12.1823 10.949 12.1187 10.8584 12.0812C10.7679 12.0437 10.6684 12.0338 10.5723 12.0529ZM5.80371 7.09094C5.70746 7.0718 5.60727 7.08171 5.5166 7.11926C5.42601 7.15683 5.34843 7.22033 5.29395 7.30188C5.2395 7.3834 5.21 7.47924 5.20996 7.57727C5.20996 7.70887 5.26241 7.83578 5.35547 7.92883C5.44852 8.02183 5.57548 8.07336 5.70703 8.07336C5.80501 8.07328 5.90095 8.04479 5.98242 7.99036C6.06394 7.93589 6.12747 7.85825 6.16504 7.7677C6.2026 7.67703 6.21251 7.57684 6.19336 7.48059C6.17421 7.38441 6.12694 7.29605 6.05762 7.22668C5.9883 7.15736 5.89985 7.11013 5.80371 7.09094ZM10.6689 7.08118C10.5373 7.08118 10.4104 7.13363 10.3174 7.22668C10.2245 7.31967 10.1729 7.44586 10.1729 7.57727C10.1729 7.67541 10.2013 7.77204 10.2559 7.85364C10.3104 7.9351 10.388 7.99873 10.4785 8.03625C10.5692 8.07381 10.6694 8.08372 10.7656 8.06457C10.8617 8.04544 10.9502 7.99808 11.0195 7.92883C11.0889 7.85944 11.1361 7.7702 11.1553 7.67395C11.1743 7.57784 11.1644 7.47835 11.127 7.38782C11.0894 7.29719 11.0259 7.21968 10.9443 7.16516C10.8628 7.11069 10.767 7.08123 10.6689 7.08118Z"}),d.jsx("path",{d:"M10.5 0.880005C10.9812 0.880005 11.375 1.27375 11.375 1.755V5.88489C11.375 5.95116 11.3212 6.005 11.2549 6.005H10.6201C10.5538 6.005 10.5 5.95116 10.5 5.88489V1.755H7V4.38C7 4.86125 6.60625 5.255 6.125 5.255H3.5V13.0099C3.5 13.0762 3.44616 13.13 3.37988 13.13H2.74512C2.67884 13.13 2.625 13.0762 2.625 13.0099V4.38C2.625 4.24875 2.66836 4.16086 2.75586 4.07336L5.81836 1.01086C5.90586 0.923364 5.99375 0.880005 6.125 0.880005H10.5ZM3.6748 4.38H6.125V1.92981L3.6748 4.38Z"})]}),Bb=C.default(aSe)`
633
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function K0e(t,e){const n=t["?xml"];if(n&&typeof n=="object"){if(e.attributesGroupName&&n[e.attributesGroupName]){const i=n[e.attributesGroupName][e.attributeNamePrefix+"version"];if(i)return i}const r=n[e.attributeNamePrefix+"version"];if(r)return r}return"1.0"}function u1(t,e,n,r,i){return!n.sanitizeName||N7(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}Di.prototype.build=function(t){if(this.options.preserveOrder)return B0e(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new A7,n=K0e(t,this.options);return this.j2x(t,0,e,n).val}};Di.prototype.j2x=function(t,e,n,r){let i="",s="";if(this.options.maxNestedTags&&n.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const o=this.options.jPath?n.toString():n,a=this.checkStopNode(n);for(let l in t){if(!Object.prototype.hasOwnProperty.call(t,l))continue;const u=l===this.options.textNodeName||l===this.options.cdataPropName||l===this.options.commentPropName||this.options.attributesGroupName&&l===this.options.attributesGroupName||this.isAttribute(l)||l[0]==="?"?l:u1(l,!1,this.options,n,r);if(typeof t[l]>"u")this.isAttribute(l)&&(s+="");else if(t[l]===null)this.isAttribute(l)||u===this.options.cdataPropName||u===this.options.commentPropName?s+="":u[0]==="?"?s+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if(t[l]instanceof Date)s+=this.buildTextValNode(t[l],u,"",e,n);else if(typeof t[l]!="object"){const f=this.isAttribute(l);if(f&&!this.ignoreAttributesFn(f,o)){const h=u1(f,!0,this.options,n,r);i+=this.buildAttrPairStr(h,""+t[l],a)}else if(!f)if(l===this.options.textNodeName){let h=this.options.tagValueProcessor(l,""+t[l]);s+=this.replaceEntitiesValue(h)}else{n.push(u);const h=this.checkStopNode(n);if(n.pop(),h){const p=""+t[l];p===""?s+=this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:s+=this.indentate(e)+"<"+u+">"+p+"</"+u+this.tagEndChar}else s+=this.buildTextValNode(t[l],u,"",e,n)}}else if(Array.isArray(t[l])){const f=t[l].length;let h="",p="";for(let m=0;m<f;m++){const g=t[l][m];if(!(typeof g>"u"))if(g===null)u[0]==="?"?s+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if(typeof g=="object")if(this.options.oneListGroup){n.push(u);const O=this.j2x(g,e+1,n,r);n.pop(),h+=O.val,this.options.attributesGroupName&&g.hasOwnProperty(this.options.attributesGroupName)&&(p+=O.attrStr)}else h+=this.processTextOrObjNode(g,u,e,n,r);else if(this.options.oneListGroup){let O=this.options.tagValueProcessor(u,g);O=this.replaceEntitiesValue(O),h+=O}else{n.push(u);const O=this.checkStopNode(n);if(n.pop(),O){const v=""+g;v===""?h+=this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:h+=this.indentate(e)+"<"+u+">"+v+"</"+u+this.tagEndChar}else h+=this.buildTextValNode(g,u,"",e,n)}}this.options.oneListGroup&&(h=this.buildObjectNode(h,u,p,e)),s+=h}else if(this.options.attributesGroupName&&l===this.options.attributesGroupName){const f=Object.keys(t[l]),h=f.length;for(let p=0;p<h;p++){const m=u1(f[p],!0,this.options,n,r);i+=this.buildAttrPairStr(m,""+t[l][f[p]],a)}}else s+=this.processTextOrObjNode(t[l],u,e,n,r)}return{attrStr:i,val:s}};Di.prototype.buildAttrPairStr=function(t,e,n){return n||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+$d(e)+'"'};function exe(t,e,n,r,i){const s=this.extractAttributes(t);if(r.push(e,s),this.checkStopNode(r)){const l=this.buildRawContent(t),c=this.buildAttributesForStopNode(t);return r.pop(),this.buildObjectNode(l,e,c,n)}const a=this.j2x(t,n+1,r,i);return r.pop(),e[0]==="?"?this.buildTextValNode("",e,a.attrStr,n,r):t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,a.attrStr,n,r):this.buildObjectNode(a.val,e,a.attrStr,n)}Di.prototype.extractAttributes=function(t){if(!t||typeof t!="object")return null;const e={};let n=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const r=t[this.options.attributesGroupName];for(let i in r){if(!Object.prototype.hasOwnProperty.call(r,i))continue;const s=i.startsWith(this.options.attributeNamePrefix)?i.substring(this.options.attributeNamePrefix.length):i;e[s]=$d(r[i]),n=!0}}else for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const i=this.isAttribute(r);i&&(e[i]=$d(t[r]),n=!0)}return n?e:null};Di.prototype.buildRawContent=function(t){if(typeof t=="string")return t;if(typeof t!="object"||t===null)return String(t);if(t[this.options.textNodeName]!==void 0)return t[this.options.textNodeName];let e="";for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||this.isAttribute(n)||this.options.attributesGroupName&&n===this.options.attributesGroupName)continue;const r=t[n];if(n===this.options.textNodeName)e+=r;else if(Array.isArray(r)){for(let i of r)if(typeof i=="string"||typeof i=="number")e+=`<${n}>${i}</${n}>`;else if(typeof i=="object"&&i!==null){const s=this.buildRawContent(i),o=this.buildAttributesForStopNode(i);s===""?e+=`<${n}${o}/>`:e+=`<${n}${o}>${s}</${n}>`}}else if(typeof r=="object"&&r!==null){const i=this.buildRawContent(r),s=this.buildAttributesForStopNode(r);i===""?e+=`<${n}${s}/>`:e+=`<${n}${s}>${i}</${n}>`}else e+=`<${n}>${r}</${n}>`}return e};Di.prototype.buildAttributesForStopNode=function(t){if(!t||typeof t!="object")return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const n=t[this.options.attributesGroupName];for(let r in n){if(!Object.prototype.hasOwnProperty.call(n,r))continue;const i=r.startsWith(this.options.attributeNamePrefix)?r.substring(this.options.attributeNamePrefix.length):r,s=n[r];s===!0&&this.options.suppressBooleanAttributes?e+=" "+i:e+=" "+i+'="'+s+'"'}}else for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const r=this.isAttribute(n);if(r){const i=t[n];i===!0&&this.options.suppressBooleanAttributes?e+=" "+r:e+=" "+r+'="'+i+'"'}}return e};Di.prototype.buildObjectNode=function(t,e,n,r){if(t==="")return e[0]==="?"?this.indentate(r)+"<"+e+n+"?"+this.tagEndChar:this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar;if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let i="</"+e+this.tagEndChar,s="";return e[0]==="?"&&(s="?",i=""),(n||n==="")&&t.indexOf("<")===-1?this.indentate(r)+"<"+e+n+s+">"+t+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&s.length===0?this.indentate(r)+`<!--${t}-->`+this.newLine:this.indentate(r)+"<"+e+n+s+this.tagEndChar+t+this.indentate(r)+i}};Di.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};Di.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||this.stopNodeExpressions.length===0)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1};Di.prototype.buildTextValNode=function(t,e,n,r,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName){const s=R7(t);return this.indentate(r)+`<![CDATA[${s}]]>`+this.newLine}else if(this.options.commentPropName!==!1&&e===this.options.commentPropName){const s=Q7(t);return this.indentate(r)+`<!--${s}-->`+this.newLine}else{if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,t);return s=this.replaceEntitiesValue(s),s===""?this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+n+">"+s+"</"+e+this.tagEndChar}}};Di.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const n=this.options.entities[e];t=t.replace(n.regex,n.val)}return t};function txe(t){return this.options.indentBy.repeat(t)}function nxe(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}function V7(t){return t.schema}function W7(t){return V7(t)?.fields??[]}function X7(t,e){return t.flatMap(n=>{const r=V7(n),i=r?.fields||[];return i.length>0?i.flatMap(s=>N_(s.name,s.example,n.allowReserved)):N_(n.name,r?.example??n.example,n.allowReserved)})}function N_(t,e,n){if(e===void 0)return[d1(t,"",!1,n)];const r=pP(e,t);return r.length===0?[d1(t,"",!1,n)]:r.map(i=>d1(i.key,i.value,!0,n))}function pP(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((n,r)=>n!==null&&typeof n=="object"?pP(n,`${e}[${r}]`):[{key:e,value:String(n)}]):rxe(t)?Object.entries(t).flatMap(([n,r])=>pP(r,`${e}[${n}]`)):[{key:e,value:String(t)}]}function rxe(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function d1(t,e,n,r){return{id:crypto.randomUUID(),key:t,value:I7(e),active:n,in:"query",...r&&{allowReserved:r}}}const q7={path:"path",query:"query",header:"headers",cookie:"cookie"};function N$(t){return t!==void 0}function ixe(t,e){if(t)return Dy.isDirectConfigureRequestValues(t)?t:t[e]}function M_(t,e,n){const r=n[q7[e]],i=n.envVariables,s=new Set;for(const o of t??[])(r?.[o.name]||i?.[o.name])&&s.add(o.name);return s}function td(t,e,n){if(Dy.isDirectConfigureRequestValues(n))return M_(t,e,n);const r=new Set;for(const i of Object.values(n))if(i)for(const s of M_(t,e,i))r.add(s);return r}function z_(t,e,n){const r=n.query,i=n.envVariables;for(const s of e??[]){const o=W7(s);for(const a of o)(r?.[a.name]||i?.[a.name])&&t.add(a.name);for(const a of[...Object.keys(r??{}),...Object.keys(i??{})])!r?.[a]&&!i?.[a]||o.some(l=>a===l.name||a.startsWith(`${l.name}[`))&&t.add(a)}}function Z7(t,e,n){const r=[...t??[],...e??[]],i=new Set(td(r,"query",n));if(Dy.isDirectConfigureRequestValues(n))return z_(i,e,n),i;for(const s of Object.values(n))s&&z_(i,e,s);return i}function M$(t=[],e){const n={};return t.forEach(r=>{const i=String(r[e]);n[i]||(n[i]=[]),n[i].push(r)}),n}function sxe(t){return t.replace(/{/g,"{{").replace(/}/g,"}}")}var $i=(t=>(t.Query="Query",t.Header="Header",t.Cookie="Cookie",t))($i||{});const gP={documentedOAuth2Types:[],grantType:re.ClientCredentials,authRequestExtraParams:[],tokenRequestExtraParams:[],[re.ClientCredentials]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[re.ClientCredentialsWithJwtAssertion]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[re.AuthorizationCode]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[re.AuthorizationCodeWithPkce]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[re.Implicit]:{clientId:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],accessToken:""},[re.Password]:{username:"",password:"",clientId:"",clientSecret:"",tokenUrl:"",accessToken:"",scopes:[]}},oxe={securityType:J.NoAuth,securitySchemeId:null,[J.BasicAuth]:{username:"",password:""},[J.JWT]:{token:""},[J.DigestAuth]:{username:"",password:"",nc:"00000001",realm:"",nonce:"",opaque:"",qop:"",algorithm:"",cnonce:""},[J.APIKey]:{location:$i.Header,name:"",key:""},[J.OAuth2]:gP,[J.OpenIDConnect]:{...gP,openIdConnectUrl:"",userInfoUrl:""}},axe={clientCredentials:re.ClientCredentials,clientCredentialsWithJwtAssertion:re.ClientCredentialsWithJwtAssertion,authorizationCode:re.AuthorizationCode,authorizationCodeWithPkce:re.AuthorizationCodeWithPkce,implicit:re.Implicit,password:re.Password},hy="urn:ietf:params:oauth:client-assertion-type:jwt-bearer";var lr=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(lr||{});const lxe={[lr.SIMPLE]:{condition:"",type:lr.SIMPLE},[lr.REGEX]:{condition:"",type:lr.REGEX,context:""},[lr.JSONPATH]:{condition:"",type:lr.JSONPATH,context:""},[lr.XPATH]:{condition:"",type:lr.XPATH,context:""}};function Id(){return structuredClone({type:$n.Text,content:"",activeExampleName:"",formData:{"multipart/form-data":[],"application/x-www-form-urlencoded":[]},binary:null,graphql:{variables:""}})}const cxe={method:"GET",url:"",security:[fs()],body:Id(),queryParameters:[],headers:[],cookies:[],pathParameters:[]};function U7(){return structuredClone(cxe)}function fs(){return Ro(oxe)}function B7(t){return Ro({id:crypto.randomUUID(),...lxe[t]})}function F7(t){return!t||typeof t!="object"?[]:Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:e,value:typeof n=="string"?n:JSON.stringify(n),active:!0,type:"text",files:null}))}function uxe(t){return typeof t!="string"?JSON.stringify(t,null,2):t}function Y7(t,e,n){for(const r of n){const i=L_(t,r),s=L_(e,r);if(typeof i=="object"&&typeof s=="object"){if(!Y7(i,s,n))return!1}else if(i!==s)return!1}return!0}function L_(t,e){const n=e.split("/");let r=t;for(const i of n)if(r&&typeof r=="object"&&i in r)r=r[i];else return;return r}function dxe(t,e){return t.length===e.length&&t.sort().join()===e.sort().join()}function fxe(t,e){return t.every(n=>e.includes(n))}function hxe(t){switch(t){case"query":return $i.Query;case"cookie":return $i.Cookie;case"header":return $i.Header;default:return}}function pxe(t,e,n){const{security:r}=e,i=t?.inputs??[];if(!n)return!1;const s=Lb(n),o=s.map(c=>c.securityType),a=r.map(c=>c.securityType);return dxe(o,a)?!r.every(c=>{const u=c.securityType,f=c[J.OAuth2]?.grantType,h=o.includes(u),p=s.find(v=>v.securityType===u),m=!p||Y7(c,p,mxe(u,f)),g=gxe(c,u,c[J.OAuth2]?.grantType,i),O=!!(h&&p&&m&&g);return!n.security?.length||O}):!0}function gxe(t,e,n,r){if(e===J.OAuth2&&(n===re.AuthorizationCode||n===re.AuthorizationCodeWithPkce||n===re.Implicit)){const i=t[J.OAuth2][n]?.availableScopes,s=zb(t[J.OAuth2][n]?.scopes,r);return fxe(s,i)}return!0}function mxe(t,e){return t===J.APIKey?[`${J.APIKey}/name`,`${J.APIKey}/location`]:t===J.OAuth2?[`${J.OAuth2}/grantType`,...Oxe(e)]:t===J.OpenIDConnect?[`${J.OpenIDConnect}/openIdConnectUrl`]:[]}function Oxe(t){return t===re.ClientCredentials?[`${J.OAuth2}/${re.ClientCredentials}/tokenUrl`]:t===re.Password?[`${J.OAuth2}/${re.Password}/tokenUrl`]:t===re.Implicit?[`${J.OAuth2}/${re.Implicit}/authorizationUrl`]:t===re.AuthorizationCode?[`${J.OAuth2}/${re.AuthorizationCode}/tokenUrl`,`${J.OAuth2}/${re.AuthorizationCode}/authorizationUrl`]:t===re.AuthorizationCodeWithPkce?[`${J.OAuth2}/${re.AuthorizationCodeWithPkce}/tokenUrl`,`${J.OAuth2}/${re.AuthorizationCodeWithPkce}/authorizationUrl`]:[]}function vxe(t){return t.map(e=>{const n=e.map(r=>r.id).join("_");return e.map(r=>({...r,schemeId:n}))})}function yxe(t){const e=t.security||[],n=e.map(r=>{let i="";const s=[];return r.forEach((o,a)=>{i=a===0?`${o.id}`:`${i}_${o.id}`,s.push(L$(o))}),{id:i,security:s}});return e.length?n:[]}function bxe(t,e){const n=t.security||[];return n?.length?nq(n).map((r,i)=>L$(r)):[]}function G7(t){if(!(t.securityType!==J.NoAuth||!t.securitySchemeId))return t.unsupportedScheme}function Lb(t){const n=(t.security||[])[0];return n?n.map(r=>L$(r)):[fs()]}const xxe={[J.OAuth2]:"oauth2",[J.OpenIDConnect]:"openIdConnect",[J.APIKey]:"apiKey",[J.JWT]:"http-bearer"};function Sxe(t){return xxe[t]}function wxe(t){const e=z$(t);return(e?[...Xi(e)][0]:void 0)??Cxe(t)}function Cxe(t){const e=t.securitySchemeId;if(e){if(t.securityType===J.JWT)return e+Ge.SecurityVariablesEnvSuffix.JWTToken;if(t.securityType===J.APIKey)return e+Ge.SecurityVariablesEnvSuffix.APIKey;if(t.securityType===J.OAuth2||t.securityType===J.OpenIDConnect)return e+Ge.SecurityVariablesEnvSuffix.Token}}function Pxe(t,e){const n=z$(t);if(!n)return"";const r=[...Xi(n)][0];return r?e.find(i=>i.name===r)?.value??"":n}function V_(t,e){if(t.securityType===J.JWT)return{...t,[J.JWT]:{...t[J.JWT],token:e}};if(t.securityType===J.APIKey)return{...t,[J.APIKey]:{...t[J.APIKey],key:e}};if(t.securityType===J.OAuth2||t.securityType===J.OpenIDConnect){const n=t.securityType,r=t[n],i=r.grantType;return{...t,[n]:{...r,[i]:{...r[i],accessToken:e}}}}return t}function z$(t){if(t.securityType===J.JWT)return t[J.JWT].token;if(t.securityType===J.APIKey)return t[J.APIKey].key;if(t.securityType===J.OAuth2){const e=t[J.OAuth2];return e[e.grantType]?.accessToken}if(t.securityType===J.OpenIDConnect){const e=t[J.OpenIDConnect];return e[e.grantType]?.accessToken}}function L$(t,e){const n={...fs(),securitySchemeId:t.id},r=Vb(t);n.securityType=r,n.unsupportedScheme=r===J.NoAuth?t.scheme||t.type:void 0;const i=t.id;if(t.id&&r!==J.NoAuth&&(n[r].schemeName=t.id),r===J.BasicAuth&&(n[J.BasicAuth].username||(n[J.BasicAuth].username=gn(i+Ge.SecurityVariablesEnvSuffix.Username)),n[J.BasicAuth].password||(n[J.BasicAuth].password=gn(i+Ge.SecurityVariablesEnvSuffix.Password))),r===J.DigestAuth&&(n[J.DigestAuth].username||(n[J.DigestAuth].username=gn(i+Ge.SecurityVariablesEnvSuffix.Username)),n[J.DigestAuth].password||(n[J.DigestAuth].password=gn(i+Ge.SecurityVariablesEnvSuffix.Password))),r===J.JWT&&!n[J.JWT].token&&(n[J.JWT].token=gn(i+Ge.SecurityVariablesEnvSuffix.JWTToken)),r===J.APIKey&&!n[J.APIKey].key){n[J.APIKey].name=t.name||"",n[J.APIKey].key=gn(i+Ge.SecurityVariablesEnvSuffix.APIKey);const s=hxe(t.in);s&&(n[J.APIKey].location=s)}if(r===J.OAuth2){const s=W$(t),o=gn(i+Ge.SecurityVariablesEnvSuffix.Token),a=n[J.OAuth2];a.grantType=s[0],s.forEach(l=>{l===re.AuthorizationCode&&!a[re.AuthorizationCode].accessToken&&(a[re.AuthorizationCode].accessToken=o,a[re.AuthorizationCode].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),a[re.AuthorizationCode].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[re.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[re.AuthorizationCode].clientSecret=gn(i+Ge.SecurityVariablesEnvSuffix.ClientSecret),a[re.AuthorizationCode].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[re.AuthorizationCode].scopes=[...Ja(t.flows?.authorizationCode?.scopes||{})||[]]),l===re.AuthorizationCodeWithPkce&&!a[re.AuthorizationCodeWithPkce].accessToken&&(a[re.AuthorizationCodeWithPkce].accessToken=o,a[re.AuthorizationCodeWithPkce].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),a[re.AuthorizationCodeWithPkce].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[re.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[re.AuthorizationCodeWithPkce].clientSecret=gn(i+Ge.SecurityVariablesEnvSuffix.ClientSecret),a[re.AuthorizationCodeWithPkce].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[re.AuthorizationCodeWithPkce].scopes=[...Ja(t.flows?.authorizationCode?.scopes||{})]),l===re.ClientCredentials&&!a[re.ClientCredentials].accessToken&&(a[re.ClientCredentials].accessToken=o,a[re.ClientCredentials].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),a[re.ClientCredentials].clientSecret=gn(i+Ge.SecurityVariablesEnvSuffix.ClientSecret),a[re.ClientCredentials].tokenUrl=t.flows?.clientCredentials?.tokenUrl||"",a[re.ClientCredentials].scopes=[...Ja(t.flows?.clientCredentials?.scopes||{})]),l===re.ClientCredentialsWithJwtAssertion&&!a[re.ClientCredentialsWithJwtAssertion].accessToken&&(a[re.ClientCredentialsWithJwtAssertion].accessToken=o,a[re.ClientCredentialsWithJwtAssertion].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),a[re.ClientCredentialsWithJwtAssertion].clientAssertion=gn(i+Ge.SecurityVariablesEnvSuffix.ClientAssertion),a[re.ClientCredentialsWithJwtAssertion].scopes=[...Ja(t.flows?.clientCredentials?.scopes||{})]),l===re.Implicit&&!a[re.Implicit].accessToken&&(a[re.Implicit].accessToken=o,a[re.Implicit].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),a[re.Implicit].authorizationUrl=t.flows?.implicit?.authorizationUrl||"",a[re.Implicit].availableScopes=Object.keys(t.flows?.implicit?.scopes||{})||[],a[re.Implicit].scopes=[...Ja(t.flows?.implicit?.scopes||{})]),l===re.Password&&!a[re.Password].accessToken&&(a[re.Password].accessToken=o,a[re.Password].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),a[re.Password].clientSecret=gn(i+Ge.SecurityVariablesEnvSuffix.ClientSecret),a[re.Password].tokenUrl=t.flows?.password?.tokenUrl||"",a[re.Password].scopes=[...Ja(t.flows?.password?.scopes||{})])})}if(r===J.OpenIDConnect){const s=gn(i+Ge.SecurityVariablesEnvSuffix.Token),o=n[J.OpenIDConnect];o[re.AuthorizationCode].accessToken||(o[re.AuthorizationCode].accessToken=s,o[re.AuthorizationCode].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),o[re.AuthorizationCode].clientSecret=gn(i+Ge.SecurityVariablesEnvSuffix.ClientSecret),o[re.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[re.AuthorizationCodeWithPkce].accessToken||(o[re.AuthorizationCodeWithPkce].accessToken=s,o[re.AuthorizationCodeWithPkce].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId),o[re.AuthorizationCodeWithPkce].clientSecret=gn(i+Ge.SecurityVariablesEnvSuffix.ClientSecret),o[re.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[re.Implicit].accessToken||(o[re.Implicit].accessToken=s,o[re.Implicit].clientId=gn(i+Ge.SecurityVariablesEnvSuffix.ClientId))}return n}function H7(t){try{const e=JSON.parse(t);return JSON.stringify(e,null,2)}catch(e){return console.error({error:e}),t}}function kxe(t,e){return t==="application/json"&&!!e}function J7(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function Txe(t){try{const e=JSON.stringify(t);return e===void 0?"undefined":e}catch{return String(t)}}function K7(t,e){return e&&e.length>0?X7(e):vo(t||[],{})}function $xe(t,e,n){if(e&&e.length>0){const r=X7(e);return Ixe(r,n)}return vo(t||[],{boundNames:n})}function Ixe(t,e){return t.map(n=>!n.key||!e.has(n.key)?n:{...n,value:`$inputs.${n.key}`,active:!0})}function Exe(t,e=!1,n="",r){const i=M$(t.parameters,"in"),s=eq(t),o=Lb(t),a=K7(i.query,i.querystring);return{id:crypto.randomUUID(),name:t.name,operationId:t.operationId,collectionPath:r,apiPath:{path:t.path,method:t.method},apiId:n,isAdditionalOperation:e,request:{pathParameters:vo(i.path||[],{}),method:t.method.toLowerCase()==="x-query"?"QUERY":t.method.toLocaleUpperCase(),url:Cg(sxe(t.path),a),headers:vo(i.header||[],{}),queryParameters:a,cookies:vo(i.cookie||[],{}),body:s,security:o},response:null}}function V$(t,e){const n=M$(t.parameters,"in"),r=eq(t),i=Lb(t),s=vo(n.path||[],{boundNames:"all"});return e?{parameters:{pathParameters:s,queryParameters:$xe(n.query,n.querystring,Z7(n.query,n.querystring,e)),headers:vo(n.header||[],{boundNames:td(n.header,"header",e)}),cookies:vo(n.cookie||[],{boundNames:td(n.cookie,"cookie",e)})},requestBody:r,security:i}:{parameters:{pathParameters:s,queryParameters:K7(n.query,n.querystring),headers:vo(n.header||[],{}),cookies:vo(n.cookie||[],{})},requestBody:r,security:i}}function Axe(t,e){const n=new Di({format:!0});if(typeof t=="string")return e?.includes("json")?H7(t):t;if(typeof t=="object"&&t!==null&&e?.includes("xml")){const i=Array.isArray(t)?t:{root:t};return n.build(i)}return JSON.stringify(t,null,2)}function Qxe(t){return zT.includes(t)}function eq(t){const e=t.body?.mediaTypes;if(!e||!Object.keys(e).length)return Id();const n=jxe(e,t),r=n?.name||"",i=Qxe(r),s=!i&&!GV.includes(r),o=mP(n),l=o.find(({key:f})=>f===t.body?.activeExampleName)?.value??o[0]?.value,c=s&&l?Axe(l,r):"",u={"multipart/form-data":W_(e["multipart/form-data"]),"application/x-www-form-urlencoded":W_(e["application/x-www-form-urlencoded"])};if(i&&l){const f=F7(l);f.length&&(u[r]=f)}return{...Id(),activeExampleName:t.body?.activeExampleName||o[0]?.key||"",...n&&{type:n.name},content:c,formData:u}}function tq(t){return t?{...(Object.keys(t?.body?.mediaTypes||{})||[]).reduce((n,r)=>(n[r]={name:r,extensions:void 0},n),{}),...Cc}:Cc}function W_(t){return t?t.parameters?t.parameters.map(e=>({id:crypto.randomUUID(),key:e.name,value:String(e.example)||"",active:!0,type:e.inputType,files:null})):[]:[]}const Rxe="Untitled example";function mP(t){const e=t?.examples;return Object.keys(e||{}).map(n=>{const r=e?.[n];return{name:(zd.isString(r?.summary)?r?.summary:r?.summary?.raw)?.trim()||n||Rxe,key:n,value:e?.[n].value}})}function jxe(t,e){const n=tq(e),r=Object.keys(t).find(i=>!!n[i]);return r?t[r]:null}function _xe(t){return!t?.security?.length||!t?[]:bxe(t)}function nq(t){const e=new Set;return t.flat().filter(n=>e.has(n.id)?!1:(e.add(n.id),!0))}function Vb(t){if(t.type==="http"){const e=t.scheme?.toLowerCase();if(e==="bearer")return J.JWT;if(e==="basic")return J.BasicAuth;if(e==="digest")return J.DigestAuth}else{if(t.type==="apiKey")return J.APIKey;if(t.type==="oauth2")return J.OAuth2;if(t.type==="openIdConnect")return J.OpenIDConnect}return J.NoAuth}function Dxe(t,e){if(t==="clientCredentials"&&e&&"x-assertionType"in e&&e["x-assertionType"]===hy)return re.ClientCredentialsWithJwtAssertion;if(t==="authorizationCode"&&e&&"x-usePkce"in e&&e["x-usePkce"])return re.AuthorizationCodeWithPkce;switch(t){case"implicit":return re.Implicit;case"password":return re.Password;case"clientCredentials":return re.ClientCredentials;case"authorizationCode":return re.AuthorizationCode;default:return re.AuthorizationCode}}function Nxe(t,e){const n=t?.security;if(!n?.length)return[];const s=vxe(n).flat().filter(o=>o.schemeId===e).find(o=>Vb(o)===J.OAuth2);return W$(s)}function W$(t){return Object.entries(t?.flows||{}).map(([e,n])=>Dxe(e,n)).filter(Boolean)}function Ki(t){try{return new URL(t),!0}catch{return!1}}function Mxe(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(c7(e))n=e;else if(!e.startsWith("/"))n=aP(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return aP(n)}function X_(t,e){let n=t;return e.forEach(({key:r,value:i,active:s})=>{i&&s&&(n=n.replaceAll(`{${r}}`,i))}),n}function rq(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function zxe(t){return t.startsWith("http://")||t.startsWith("https://")}function Dm({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(zxe(t)||!e)r=t;else{const i=new URL(e);i.pathname=t,i.search="",i.hash="",r=i.toString()}return n?`${n}${r}`:r}const iq="New Step";function OP({name:t=iq,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=Lxe(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function Lxe(t){return t.steps.filter(e=>e.state!==$t.Draft).map(e=>e.stepId)}function jo({name:t=iq,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:s,dynamicReplayValues:o,xOperation:a}={}){if(!n){const c=s?V$(s,o):null,u=[fs()];return{stepId:OP({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?$t.Draft:$t.Normal,parameters:{pathParameters:[],queryParameters:a?Pg(a.url):[],headers:[],cookies:[]},requestBody:Id(),xOperation:a??(i?null:{method:"GET",url:""}),security:u,operation:i??null,...c}}const l=n;return{stepId:OP({name:t,workflow:r}),description:l.description,outputs:l.outputs,successCriteria:l.successCriteria,state:e?$t.Draft:$t.Normal,parameters:l.parameters,requestBody:l.requestBody,xOperation:l.xOperation,security:l.security,operation:l.operation}}function xl(t){return t.xOperation?.method??t.operation?.method??""}function Ep(t){return t.xOperation?.url??t.operation?.path??""}function Wb(t,e,n,r,i){const{inputs:s,servers:o}=r,a=N0e(ll("path",[vn(e?.parameters.pathParameters,n?.components.parameters),vn(t.parameters.pathParameters,n?.components.parameters)]),r.inputs,i),l=t.xOperation??null,c=t.operation??null;let u="",f="";if(l)f=l.method,u=X_(l.url,a);else if(c){const m=o.find(O=>O.apiId===c.apiId);f=c.method==="x-query"?"query":c.method,u=(m?.value?rq(m.value,m.variables):"")+X_(c.path,a)}const h=u.split("?")[0];return{url:ed(h,s,i??{}),method:f.toUpperCase()}}function Vxe(){return structuredClone({id:crypto.randomUUID(),state:hn.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:De.Step,draftStep:jo(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1}})}function Wxe(t){return t?.data?.type===De.Step}function Xxe(t,e){const{collectionId:n,workflowId:r,stepId:i}=e,s=e.draftStep??null;return n&&r&&i?wg(t,{collectionId:n,workflowId:r,stepId:i})??s:s}function qxe(t,e,n,r,i,s){const o=a=>a??"";return o(t)===r&&o(e)===i&&o(n)===s}const vP="New workflow";function sq({name:t=vP,collection:e}){let r=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||vP).replaceAll(" ","-").toLowerCase();if(!e)return r;const i=Zxe(e);if(i.includes(r)){let s=1;for(;i.includes(`${r}-${s}`);)s++;r=`${r}-${s}`}return r}function Zxe(t){return t.workflows.filter(e=>e.state!==$t.Draft).map(e=>e.workflowId)}function X$({name:t=vP,isDraft:e=!1,collection:n}={}){return{workflowId:sq({name:t,collection:n}),summary:t,steps:[],state:e?$t.Draft:$t.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[fs()]}}function Uxe(t,e){const n=new Set,r=e?.components.parameters,{pathParameters:i,queryParameters:s,headers:o,cookies:a}=t.parameters,l=t.outputs;for(const{value:c}of[...vn([...i,...s,...o,...a],r),...l])for(const u of Xi(c))n.add(u);return t.steps.forEach(c=>{const u=c.security;for(const v of u)switch(v.securityType){case J.BasicAuth:case J.DigestAuth:for(const x of[v[v.securityType].username,v[v.securityType].password])for(const y of Xi(x))n.add(y);break;case J.JWT:for(const x of Xi(v[v.securityType].token))n.add(x);break;case J.APIKey:for(const x of Xi(v[v.securityType].key))n.add(x);break;case J.OAuth2:case J.OpenIDConnect:{const x=v[v.securityType];for(const y of Xi(x[x.grantType].accessToken))n.add(y);break}}const{pathParameters:f,queryParameters:h,headers:p,cookies:m}=c.parameters,g=c.outputs;for(const{value:v}of[...vn([...f,...h,...p,...m],r),...g])for(const x of Xi(v))n.add(x);const O=c.requestBody;switch(O.type){case gt.FormData:case gt.UrlEncoded:{for(const{value:v}of O.formData[O.type])for(const x of Xi(v))n.add(x);break}case gt.Binary:break;default:for(const v of Xi(O.content))n.add(v)}}),n}function oq(t,e,n,r){const i=Uxe(t,n);if(i.size===0){r(({inputs:s,...o})=>o);return}r(s=>{const o=s.inputs,a=typeof o=="object"&&o?.properties||{};return{...s,inputs:{type:"object",properties:Object.fromEntries(Array.from(i).map(l=>{const c=e.inputs.find(u=>u.name===l)?.isSecret;return[l,c?{type:"string",format:"password"}:a[l]||{type:"string"}]}))}}})}function of(t){return t.summary||t.workflowId||"Untitled Workflow"}function aq(t){return t.flatMap(e=>{const n=e.id,r=e.paths??{};return Object.keys(r).flatMap(i=>{const s=r[i]??{},o=Object.keys(s).filter(c=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(c.toLowerCase())).map(c=>{const u=s[c];return{apiId:n,path:i,method:c,operationId:u?.operationId||"",summary:u?.summary,isAdditionalOperation:!1}}),a=s.additionalOperations,l=a?Object.entries(a).map(([c,u])=>({apiId:n,path:i,method:c,operationId:u.operationId||"",summary:u.summary,isAdditionalOperation:!0})):[];return[...o,...l]})})}const Xb=(t,e,n)=>{if(!e)return null;const{apiId:r,method:i,path:s}=e,o=t.find(l=>l.id===r);if(!o)return null;if(n)try{return n(s,i,o)??null}catch(l){console.error("Failed to convert operation to replay value",l)}const a=o.paths?.[s]?.[i];return a?{id:a.operationId??"",name:a.summary??"",method:i,path:s,href:"",operationId:a.operationId,parameters:[],servers:[],security:[]}:null};function qb(t){const e=Vs(),{convertOperationToReplayValue:n}=Un();return b.useMemo(()=>Xb(e,t,n),[e,t,n])}function q$(){const t=YT(),{convertOperationToReplayValue:e}=Un();return{getApiOperation:b.useCallback(r=>Xb(t(),r,e),[t,e])}}function lq(t){const e=(t.match(/{([^}]+)}/g)||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function Bxe(t){const e=t.servers?.[0];if(!e)return{url:"",variables:[]};const n=e.url,i=lq(n).map(s=>({name:s,value:e.variables?.[s]?.default||""}));return{url:n,variables:i}}function cq(){const t=YT(),e=ds();function n(r){const i=t().find(a=>a.id===r);if(!i){console.error(`API ${r} not found`);return}const{url:s,variables:o}=Bxe(i);e(a=>{let l=!1;const c=a.map(u=>u.servers.some(f=>f.apiId===r)?u:(l=!0,{...u,servers:[...u.servers,{apiId:r,value:s,variables:o}]}));return l?c:a})}return{attachApiServerToEnvironments:n}}class qt{static utils=null;static async getUtils(){return qt.utils||(qt.utils=On()?await Promise.resolve().then(()=>require("./replay-tauri-path-CNqnykPe.js")):{join:Ha.join,resolve:Ha.resolve,isAbsolute:Ha.isAbsolute,relative:Ha.relative,extname:Ha.extname,dirname:Ha.dirname}),qt.utils}static async dirname(e){return(await qt.getUtils()).dirname(e)}static async join(...e){return(await qt.getUtils()).join(...e)}static async resolve(e){return(await qt.getUtils()).resolve(e)}static async isAbsolute(e){return(await qt.getUtils()).isAbsolute(e)}static async relative(e,n){return(await qt.getUtils()).relative(e,n)}static async extname(e){return(await qt.getUtils()).extname(e)}}function Fxe({apiName:t="new-api-source",sourceDescriptions:e}){let n=t.replaceAll(/[\s.]/g,"-").toLowerCase();if(!e.length)return n;const r=e.map(i=>i.name);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function q_(t,e){return`${t}\0${e}`}function Vc(){const t=_b(),e=Xo(),n=YT(),{attachApiServerToEnvironments:r}=cq();async function i({collectionId:l,apiId:c}){const u=Td(t(),l);if(!u)return;if(!u.sourceDescriptions.some(h=>h.apiId===c)){const p=n().find(g=>g.id===c)?.info.title,m=Ki(c)?c:await qt.relative(`/${l}/..`,`/${c}`);e(g=>ii(g,l,O=>O.sourceDescriptions.some(v=>v.apiId===c)?O:{...O,sourceDescriptions:[...O.sourceDescriptions,{name:Fxe({apiName:p,sourceDescriptions:O.sourceDescriptions}),url:m,apiId:c}]}))}r(c)}function s(l){return Td(t(),l)}function o(l,c){e(u=>ii(u,l,f=>({...f,sourceDescriptions:f.sourceDescriptions.filter(h=>c.name!==h.name)})))}function a(l,c){const u=new Set(c.map(f=>q_(f.workflowId??"",f.stepId)));e(f=>ii(f,l,h=>{const p=h.workflows.map(m=>{const g=m.steps.map(O=>!u.has(q_(m.workflowId,O.stepId))||!O.operation?O:{...O,xOperation:{method:O.operation.method,url:O.operation.path},operation:null});return g.every((O,v)=>O===m.steps[v])?m:{...m,steps:g}});return p.every((m,g)=>m===h.workflows[g])?h:{...h,workflows:p}}))}return{attachApiToCollection:i,getCollection:s,removeSourceDescription:o,disconnectStepsFromSource:a}}class Z_{storage;constructor(e){this.storage=e}async initialize(){await this.storage.initialize()}getAll(e){return this.storage.read(e)}getRecent(e=50,n){return this.storage.getRecent(e,n)}getById(e){return this.storage.getById(e)}addItem(e){return this.storage.addItem(e)}updateItem(e,n){return this.storage.updateItem(e,n)}deleteItem(e){return this.storage.deleteItem(e)}clear(){return this.storage.clear()}count(e){return this.storage.count(e)}}const yP=(t,e)=>e.some(n=>t instanceof n);let U_,B_;function Yxe(){return U_||(U_=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Gxe(){return B_||(B_=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const bP=new WeakMap,f1=new WeakMap,Zb=new WeakMap;function Hxe(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(hc(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return Zb.set(e,t),e}function Jxe(t){if(bP.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});bP.set(t,e)}let xP={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return bP.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return hc(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function uq(t){xP=t(xP)}function Kxe(t){return Gxe().includes(t)?function(...e){return t.apply(SP(this),e),hc(this.request)}:function(...e){return hc(t.apply(SP(this),e))}}function e1e(t){return typeof t=="function"?Kxe(t):(t instanceof IDBTransaction&&Jxe(t),yP(t,Yxe())?new Proxy(t,xP):t)}function hc(t){if(t instanceof IDBRequest)return Hxe(t);if(f1.has(t))return f1.get(t);const e=e1e(t);return e!==t&&(f1.set(t,e),Zb.set(e,t)),e}const SP=t=>Zb.get(t);function t1e(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=hc(o);return r&&o.addEventListener("upgradeneeded",l=>{r(hc(o.result),l.oldVersion,l.newVersion,hc(o.transaction),l)}),n&&o.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{s&&l.addEventListener("close",()=>s()),i&&l.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const n1e=["get","getKey","getAll","getAllKeys","count"],r1e=["put","add","delete","clear"],h1=new Map;function F_(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(h1.get(e))return h1.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=r1e.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||n1e.includes(n)))return;const s=async function(o,...a){const l=this.transaction(o,i?"readwrite":"readonly");let c=l.store;return r&&(c=c.index(a.shift())),(await Promise.all([c[n](...a),i&&l.done]))[0]};return h1.set(e,s),s}uq(t=>({...t,get:(e,n,r)=>F_(e,n)||t.get(e,n,r),has:(e,n)=>!!F_(e,n)||t.has(e,n)}));const i1e=["continue","continuePrimaryKey","advance"],Y_={},wP=new WeakMap,dq=new WeakMap,s1e={get(t,e){if(!i1e.includes(e))return t[e];let n=Y_[e];return n||(n=Y_[e]=function(...r){wP.set(this,dq.get(this)[e](...r))}),n}};async function*o1e(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,s1e);for(dq.set(n,e),Zb.set(n,SP(e));e;)yield n,e=await(wP.get(n)||e.continue()),wP.delete(n)}function G_(t,e){return e===Symbol.asyncIterator&&yP(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&yP(t,[IDBIndex,IDBObjectStore])}uq(t=>({...t,get(e,n,r){return G_(e,n)?o1e:t.get(e,n,r)},has(e,n){return G_(e,n)||t.has(e,n)}}));class Z${constructor(e,n,r){this.dbName=e,this.version=n,this.setupCallback=r}dbName;version;setupCallback;db=null;static createInstance(e,n,r){return new Z$(e,n,r)}async initialize(){this.db||(this.db=await t1e(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const a1e=1;class U${constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=Z$.createInstance(n,a1e,this.setupDatabase);return new U$(r)}static setupDatabase(e){if(!e.objectStoreNames.contains("history")){const n=e.createObjectStore("history",{keyPath:"id"});n.createIndex("by-date","date"),n.createIndex("by-type","type"),n.createIndex("by-workflow","workflowId")}}get storeName(){return"history"}async getDb(){return await this.indexedDB.initialize(),this.indexedDB.db}async initialize(){await this.indexedDB.initialize()}async read(e){const r=(await this.getDb()).transaction(this.storeName,"readonly"),i=e?.type?await r.store.index("by-type").getAll(e.type):await r.store.index("by-date").getAll();return await r.done,i.sort((s,o)=>o.date-s.date)}async addItem(e){await(await this.getDb()).put(this.storeName,e)}async updateItem(e,n){const r=await this.getDb(),i=await r.get(this.storeName,e);if(i){const{id:s,type:o,...a}=n;await r.put(this.storeName,{...i,...a})}}async deleteItem(e){await(await this.getDb()).delete(this.storeName,e)}async clear(){await(await this.getDb()).clear(this.storeName)}async getById(e){return await(await this.getDb()).get(this.storeName,e)||null}async getRecent(e,n){const i=(await this.getDb()).transaction(this.storeName,"readonly"),s=n?.type?await i.store.index("by-type").getAll(n.type):await i.store.index("by-date").getAll();return await i.done,s.sort((o,a)=>a.date-o.date).slice(0,e)}async count(e){const n=await this.getDb();if(e?.type){const r=n.transaction(this.storeName,"readonly"),i=await r.store.index("by-type").count(e.type);return await r.done,i}return await n.count(this.storeName)}}class cl{static instance=null;static async initialize(e,n){this.close(),this.instance=await l1e(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function l1e(t,e){if(e){const{HistorySqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-HistorySqliteDBStorage-BrILW8Fu.js")),r=Ip.getInstance(),i=new n(r);return new Z_(i)}else{const n=U$.create(t.id);return new Z_(n)}}const $r={all:["history"],lists:()=>[...$r.all,"list"],list:t=>[...$r.lists(),t],recent:(t,e)=>[...$r.all,"recent",t,e],detail:t=>[...$r.all,"detail",t],count:t=>[...$r.all,"count",t]};function c1e(t){return qr.useQuery({queryKey:$r.list(t),queryFn:async()=>cl.getInstance().getAll(t)})}function fq(){const t=qr.useQueryClient();return qr.useMutation({mutationFn:async e=>{await cl.getInstance().addItem(e)},onMutate:e=>{t.setQueryData($r.detail(e.id),e)},onSuccess:()=>{t.invalidateQueries({queryKey:$r.lists()}),t.invalidateQueries({queryKey:$r.count()})},onError:(e,n)=>{t.removeQueries({queryKey:$r.detail(n.id)}),console.error("Failed to add history item:",e)}})}function u1e(){const t=qr.useQueryClient();return qr.useMutation({mutationFn:async e=>{await cl.getInstance().deleteItem(e)},onSuccess:(e,n)=>{t.removeQueries({queryKey:$r.detail(n)}),t.invalidateQueries({queryKey:$r.lists()}),t.invalidateQueries({queryKey:$r.count()})},onError:(e,n)=>{console.error(`Failed to delete history item ${n}:`,e)}})}function d1e(){const t=qr.useQueryClient();return qr.useMutation({mutationFn:async()=>{await cl.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:$r.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function f1e(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function h1e(){const t=fq();return b.useCallback(({step:e,response:n})=>{const r=f1e(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function p1e(){const t=fq();return b.useCallback(async({workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:s,durationMs:o})=>{const a=crypto.randomUUID(),l={id:a,date:Date.now(),type:"workflow",workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:s,durationMs:o};try{return await t.mutateAsync(l),a}catch{return null}},[t])}function g1e(){const t=qr.useQueryClient();async function e(n){return t.ensureQueryData({queryKey:$r.detail(n),queryFn:()=>cl.getInstance().getById(n)})}return{getHistoryItem:e}}function hq(){const t=_b();return{getStep:n=>wg(t(),n)}}function m1e(t){const e=Yr();return wg(e,{collectionId:t?.collectionId??null,workflowId:t?.workflowId??null,stepId:t?.stepId??null})??t?.draftStep??null}function pq(t,e){const n=t?.collectionId??null,r=t?.workflowId??null,i=t?.stepId??null,s=Yr(),o=Xo(),a=wg(s,{collectionId:n,workflowId:r,stepId:i});if(a)return{step:a,updateStep:c=>o(u=>Db(u,{collectionId:n,workflowId:r,stepId:i},c))};const l=t?.draftStep??null;return l?{step:l,updateStep:c=>e(u=>({...u,draftStep:u.draftStep?c(u.draftStep):u.draftStep}))}:null}function B$(){const t=_b();return{getWorkflow:({collectionId:n,workflowId:r})=>Sg(t(),{collectionId:n,workflowId:r})}}function ei(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)}function TO(t,e,n,r,i){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var lu,no,cu,$O;const H_="__TAURI_TO_IPC_KEY__";function gq(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}class mq{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,lu.set(this,()=>{}),no.set(this,0),cu.set(this,[]),this.id=gq(({message:e,id:n})=>{if(n==ei(this,no,"f"))for(ei(this,lu,"f").call(this,e),TO(this,no,ei(this,no,"f")+1);ei(this,no,"f")in ei(this,cu,"f");){const r=ei(this,cu,"f")[ei(this,no,"f")];ei(this,lu,"f").call(this,r),delete ei(this,cu,"f")[ei(this,no,"f")],TO(this,no,ei(this,no,"f")+1)}else ei(this,cu,"f")[n]=e})}set onmessage(e){TO(this,lu,e)}get onmessage(){return ei(this,lu,"f")}[(lu=new WeakMap,no=new WeakMap,cu=new WeakMap,H_)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[H_]()}}async function Ze(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}class O1e{get rid(){return ei(this,$O,"f")}constructor(e){$O.set(this,void 0),TO(this,$O,e)}async close(){return Ze("plugin:resources|close",{rid:this.rid})}}$O=new WeakMap;var nn;(function(t){t[t.Audio=1]="Audio",t[t.Cache=2]="Cache",t[t.Config=3]="Config",t[t.Data=4]="Data",t[t.LocalData=5]="LocalData",t[t.Document=6]="Document",t[t.Download=7]="Download",t[t.Picture=8]="Picture",t[t.Public=9]="Public",t[t.Video=10]="Video",t[t.Resource=11]="Resource",t[t.Temp=12]="Temp",t[t.AppConfig=13]="AppConfig",t[t.AppData=14]="AppData",t[t.AppLocalData=15]="AppLocalData",t[t.AppCache=16]="AppCache",t[t.AppLog=17]="AppLog",t[t.Desktop=18]="Desktop",t[t.Executable=19]="Executable",t[t.Font=20]="Font",t[t.Home=21]="Home",t[t.Runtime=22]="Runtime",t[t.Template=23]="Template"})(nn||(nn={}));async function v1e(){return Ze("plugin:path|resolve_directory",{directory:nn.AppConfig})}async function CP(){return Ze("plugin:path|resolve_directory",{directory:nn.AppData})}async function y1e(){return Ze("plugin:path|resolve_directory",{directory:nn.AppLocalData})}async function b1e(){return Ze("plugin:path|resolve_directory",{directory:nn.AppCache})}async function x1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Audio})}async function S1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Cache})}async function w1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Config})}async function C1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Data})}async function Oq(){return Ze("plugin:path|resolve_directory",{directory:nn.Desktop})}async function P1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Document})}async function k1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Download})}async function T1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Executable})}async function $1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Font})}async function I1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Home})}async function E1e(){return Ze("plugin:path|resolve_directory",{directory:nn.LocalData})}async function A1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Picture})}async function Q1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Public})}async function R1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Resource})}async function j1e(t){return Ze("plugin:path|resolve_directory",{directory:nn.Resource,path:t})}async function _1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Runtime})}async function D1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Template})}async function N1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Video})}async function M1e(){return Ze("plugin:path|resolve_directory",{directory:nn.AppLog})}async function z1e(){return Ze("plugin:path|resolve_directory",{directory:nn.Temp})}function vq(){return window.__TAURI_INTERNALS__.plugins.path.sep}function L1e(){return window.__TAURI_INTERNALS__.plugins.path.delimiter}async function yq(...t){return Ze("plugin:path|resolve",{paths:t})}async function V1e(t){return Ze("plugin:path|normalize",{path:t})}async function F$(...t){return Ze("plugin:path|join",{paths:t})}async function bq(t){return Ze("plugin:path|dirname",{path:t})}async function xq(t){return Ze("plugin:path|extname",{path:t})}async function Y$(t,e){return Ze("plugin:path|basename",{path:t,ext:e})}async function Sq(t){return Ze("plugin:path|is_absolute",{path:t})}const wq=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return nn},appCacheDir:b1e,appConfigDir:v1e,appDataDir:CP,appLocalDataDir:y1e,appLogDir:M1e,audioDir:x1e,basename:Y$,cacheDir:S1e,configDir:w1e,dataDir:C1e,delimiter:L1e,desktopDir:Oq,dirname:bq,documentDir:P1e,downloadDir:k1e,executableDir:T1e,extname:xq,fontDir:$1e,homeDir:I1e,isAbsolute:Sq,join:F$,localDataDir:E1e,normalize:V1e,pictureDir:A1e,publicDir:Q1e,resolve:yq,resolveResource:j1e,resourceDir:R1e,runtimeDir:_1e,sep:vq,tempDir:z1e,templateDir:D1e,videoDir:N1e},Symbol.toStringTag,{value:"Module"}));var PP;(function(t){t[t.Start=0]="Start",t[t.Current=1]="Current",t[t.End=2]="End"})(PP||(PP={}));function G$(t){return{isFile:t.isFile,isDirectory:t.isDirectory,isSymlink:t.isSymlink,size:t.size,mtime:t.mtime!==null?new Date(t.mtime):null,atime:t.atime!==null?new Date(t.atime):null,birthtime:t.birthtime!==null?new Date(t.birthtime):null,readonly:t.readonly,fileAttributes:t.fileAttributes,dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,blksize:t.blksize,blocks:t.blocks}}class H$ extends O1e{async read(e){if(e.byteLength===0)return 0;const[n,r]=await Ze("plugin:fs|read",{rid:this.rid,len:e.byteLength});return e.set(n),r===0?null:r}async seek(e,n){return await Ze("plugin:fs|seek",{rid:this.rid,offset:e,whence:n})}async stat(){const e=await Ze("plugin:fs|fstat",{rid:this.rid});return G$(e)}async truncate(e){await Ze("plugin:fs|ftruncate",{rid:this.rid,len:e})}async write(e){return await Ze("plugin:fs|write",{rid:this.rid,data:e})}}async function W1e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await Ze("plugin:fs|create",{path:t instanceof URL?t.toString():t,options:e});return new H$(n)}async function X1e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await Ze("plugin:fs|open",{path:t instanceof URL?t.toString():t,options:e});return new H$(n)}async function q1e(t,e,n){if(t instanceof URL&&t.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await Ze("plugin:fs|copy_file",{fromPath:t instanceof URL?t.toString():t,toPath:e instanceof URL?e.toString():e,options:n})}async function Cq(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Ze("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})}async function Pq(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await Ze("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})}async function kq(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await Ze("plugin:fs|read_file",{path:t instanceof URL?t.toString():t,options:e});return n instanceof ArrayBuffer?new Uint8Array(n):Uint8Array.from(n)}async function J$(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await Ze("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e})}async function Z1e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=t instanceof URL?t.toString():t;return await Promise.resolve({path:n,rid:null,async next(){this.rid===null&&(this.rid=await Ze("plugin:fs|read_text_file_lines",{path:n,options:e}));const[r,i]=await Ze("plugin:fs|read_text_file_lines_next",{rid:this.rid});return i&&(this.rid=null),{value:i?"":r,done:i}},[Symbol.asyncIterator](){return this}})}async function Tq(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Ze("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})}async function $q(t,e,n){if(t instanceof URL&&t.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await Ze("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:n})}async function U1e(t,e){const n=await Ze("plugin:fs|stat",{path:t instanceof URL?t.toString():t,options:e});return G$(n)}async function B1e(t,e){const n=await Ze("plugin:fs|lstat",{path:t instanceof URL?t.toString():t,options:e});return G$(n)}async function F1e(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Ze("plugin:fs|truncate",{path:t instanceof URL?t.toString():t,len:e,options:n})}async function Y1e(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Ze("plugin:fs|write_file",e,{headers:{path:t instanceof URL?t.toString():t,options:JSON.stringify(n)}})}async function Iq(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await Ze("plugin:fs|write_text_file",{path:t instanceof URL?t.toString():t,data:e,options:n})}async function K$(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await Ze("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})}async function Eq(t){await Ze("plugin:fs|unwatch",{rid:t})}async function G1e(t,e,n){const r={recursive:!1,delayMs:2e3,...n},i=Array.isArray(t)?t:[t];for(const a of i)if(a instanceof URL&&a.protocol!=="file:")throw new TypeError("Must be a file URL.");const s=new mq;s.onmessage=e;const o=await Ze("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{Eq(o)}}async function H1e(t,e,n){const r={recursive:!1,...n,delayMs:null},i=Array.isArray(t)?t:[t];for(const a of i)if(a instanceof URL&&a.protocol!=="file:")throw new TypeError("Must be a file URL.");const s=new mq;s.onmessage=e;const o=await Ze("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{Eq(o)}}const Ub=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return nn},FileHandle:H$,get SeekMode(){return PP},copyFile:q1e,create:W1e,exists:K$,lstat:B1e,mkdir:Cq,open:X1e,readDir:Pq,readFile:kq,readTextFile:J$,readTextFileLines:Z1e,remove:Tq,rename:$q,stat:U1e,truncate:F1e,watch:G1e,watchImmediate:H1e,writeFile:Y1e,writeTextFile:Iq},Symbol.toStringTag,{value:"Module"})),Ao=window.__TAURI__?.http.fetch??globalThis.fetch;function J_(t){try{const e=new URL(t);return(e.protocol==="http:"&&e.port==="80"||e.protocol==="https:"&&e.port==="443")&&(e.port=""),e.hostname=e.hostname.toLowerCase(),e.protocol+"//"+e.hostname+(e.port?":"+e.port:"")}catch(e){return console.error("Invalid URL",e),null}}function Aq(t,e){let n=J_(t);const r=e.find(({host:i,port:s})=>J_(`https://${i}:${s}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}const J1e={id:"default",userFilesDir:"default",systemFilesDir:"default"},py=Il(gr(J1e));py.debugLabel="project";function Wc(){return ir(py)}function kP(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const K1e=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function eSe(){const{userFilesDir:t}=Wc(),{certificates:e}=di(),n=Dt(),{getCollection:r}=Vc();return{execute:async(s,o,a)=>{const l=r(s),{inputs:c,servers:u}=n,f=l?.sourceDescriptions??[],h=`${t}/${s}`,[{createConfig:p},{ExternalResolver:m}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-D5Z0mNdH.js")),Promise.resolve().then(()=>require("./replay-external-resolver-CnBhw18p.js"))]),g=new m,O=c.map(w=>JSON.stringify({[w.name]:w.value})),v=tSe(u,f),{run:x}=await Promise.resolve().then(()=>require("./replay-respect-run-CMwBljW2.js")),y=await x({files:[h],workflow:o?[o]:[],fetch:(w,S)=>{const k=K1e(w),{clientCert:T,clientKey:$}=Aq(k,e);return Ao(k,{...S,clientCert:T,clientKey:$})},logger:Nb,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async w=>{if(!await K$(w))throw new Error(`File ${w} doesn't exist or isn't readable.`);try{const k=await J$(w),T=new TextEncoder().encode(k);return new File([T],await Y$(w))}catch(k){throw new Error(`Failed to read file ${w}: ${k}`)}}},envVariables:{},config:await p({}),externalRefResolver:g,input:O,server:v,severity:JSON.stringify(a),skipLint:!0,noSecretsMasking:!0});try{await w0e(s,o,y?.[0]?.ctx)}catch(w){console.error("Failed to persist workflow step context:",w)}return y}}}function tSe(t,e){return e.map(n=>{const r=t.find(s=>s.apiId===n.apiId);if(!r)return null;let i=r.value;if(r.variables)for(const s of r.variables){const o=new RegExp(`\\{${s.name}\\}`,"g");i=i.replace(o,s.value)}return`${n.name}=${i}`}).filter(n=>n!==null)}const nSe="com.redocly.tab.openFailed";function Mu(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:De.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,...t}}function TP(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function rSe(t,e,n){const r=t.draftStep,i=r?.xOperation;if(!r||!i)return;const s=n.url&&i.url!==n.url?n.url:null,o=i.method!==n.method?n.method:null;s===null&&o===null||e(a=>{const l=a.draftStep;return l?.xOperation?{...a,draftStep:{...l,xOperation:{...l.xOperation,...s!==null&&{url:s},...o!==null&&{method:o}},parameters:s===null?l.parameters:{...l.parameters,queryParameters:LT(Pg(s),l.parameters.queryParameters)}}}:a})}function Ln(){const{getTabs:t,getActiveTabIdx:e,setTabs:n,setActiveTabIdx:r,updateTabAt:i,updateTabDataAt:s}=Dc(),{dynamicReplayValues:o}=Un(),{getStep:a}=hq(),{getHistoryItem:l}=g1e(),{getWorkflow:c}=B$(),{getCollection:u}=Vc(),{getApiOperation:f}=q$(),{sendEvent:h}=Be(),p=Ybe(),m=b.useCallback((j,X,z,W)=>{console.warn(`[useTabHandlers] ${j}`,W),h(nSe,[{...Oe("tab",X),reason:z,...W}])},[h]),g=b.useCallback((j,X)=>{const z=t()[j];z&&z.state!==X&&i(j,W=>({...W,state:X}))},[t,i]),O=b.useCallback(j=>{r(j)},[r]),v=b.useCallback(()=>{const j=t().length;n(X=>[...X,Vxe()]),r(j)},[t,n,r]),x=b.useCallback(j=>{const X=[...t().filter(W=>W.state!==hn.Preview)];X.push(j),n(()=>X);const z=X.length-1;return r(z),z},[t,n,r]),y=b.useCallback(j=>{const X=f(j),z=eI(j,X,o);x(z)},[x,o,f]),w=b.useCallback(j=>{const X=t().findIndex(({data:z})=>an(z,De.Step)&&z.draftStep?.operation?.apiId===j.apiId&&z.draftStep?.operation?.path===j.path&&z.draftStep?.operation?.method===j.method);return X===-1?!1:(O(X),!0)},[t,O]),S=b.useCallback((j,X)=>{const z=t(),W=F=>z.findIndex(({data:G})=>an(G,De.Step)&&F(G));if(X){const F=W(ee=>ee.sourceFile===X);if(F!==-1){rSe(z[F].data,ee=>s(F,ee),j),O(F);return}const G=W(ee=>!ee.sourceFile&&TP(ee,j));if(G!==-1){s(G,ee=>({...ee,sourceFile:X})),O(G);return}}else{const F=W(G=>TP(G,j));if(F!==-1){O(F);return}}const B=jo({xOperation:j,name:X??void 0});x({id:crypto.randomUUID(),state:hn.Normal,data:Mu({draftStep:B,activeTabName:rc(B),sourceFile:X??null})})},[t,s,O,x]),k=b.useCallback(j=>{const X=t(),z=e(),W=X[z]?.id,B=X.filter((G,ee)=>ee!==j);n(()=>B);const F=j===z||!W?-1:B.findIndex(G=>G.id===W);r(F===-1?Math.max(0,j-1):F)},[t,e,r,n]),T=b.useCallback(()=>{n(()=>[]),r(0)},[r,n]);function $({collectionId:j,workflowId:X,stepId:z}){const W=t(),B=new Set;for(let F=0;F<W.length;F++){const G=W[F].data;switch(G.type){case De.Step:G.collectionId===j&&G.workflowId===X&&G.stepId===z&&B.add(F);break;case De.Workflow:case De.WorkflowRun:G.collectionId===j&&G.workflowId===X&&!z&&B.add(F);break;case De.Collection:G.collectionId===j&&!X&&!z&&B.add(F);break}}B.size&&(n(F=>F.filter((G,ee)=>!B.has(ee))),r(0))}const E=b.useCallback(async j=>{const X=t().findIndex(({data:z})=>an(z,De.Step)&&z.historyId===j);if(X!==-1)r(X);else{const z=await l(j);if(!z||!QC(z)){m("Step history not found","stepHistoryTab","step_history_not_found",{historyId:j});return}const W=z.step;x({id:crypto.randomUUID(),state:hn.Preview,data:Mu({historyId:j,draftStep:structuredClone(W),response:structuredClone(z.response),activeTabName:rc(W)})})}},[r,t,x,l,m]),_=b.useCallback(({collectionId:j,activeTabName:X})=>{const z=t().findIndex(W=>{const B=W.data;return an(B,De.Collection)&&B.collectionId===j});if(z!==-1)r(z);else{if(!u(j)){m("Collection not found","collectionTab","collection_not_found",{collectionId:j});return}x({id:crypto.randomUUID(),state:hn.Preview,data:{collectionId:j,type:De.Collection,activeTabName:X??He.COLLECTION_SETTINGS}})}},[r,t,x,u,m]),D=b.useCallback(({collectionId:j,workflowId:X})=>{if(!c({collectionId:j,workflowId:X})){m("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:j,workflowId:X});return}x({id:crypto.randomUUID(),state:hn.Normal,data:{collectionId:j,workflowId:X,historyId:null,runDate:null,type:De.WorkflowRun,result:null,severitySettings:kP()}})},[x,c,m]),R=b.useCallback(async(j,{state:X=hn.Preview}={})=>{const z=t().findIndex(({data:W})=>an(W,De.WorkflowRun)&&W.historyId===j);if(z!==-1)X===hn.Normal&&t()[z].state===hn.Preview&&g(z,hn.Normal),r(z);else{const W=await l(j);if(!W||!RC(W)){m("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:j});return}x({id:crypto.randomUUID(),state:X,data:{collectionId:W.collectionId,workflowId:W.workflowId,historyId:j,runDate:W.date,type:De.WorkflowRun,result:structuredClone(W.workflowResult),severitySettings:kP(),label:of(W.workflow),secretValues:p().inputs.filter(B=>B.isSecret&&B.value).map(B=>String(B.value))}})}},[r,t,x,g,l,m,p]),M=b.useCallback(({collectionId:j,workflowId:X})=>{const z=t().findIndex(({data:W})=>an(W,De.WorkflowRun)&&W.collectionId===j&&W.workflowId===X);return z===-1?!1:(t()[z].state===hn.Preview&&g(z,hn.Normal),O(z),!0)},[t,g,O]),L=b.useCallback(({collectionId:j,workflowId:X,activeTabName:z})=>{const W=t().findIndex(B=>{const F=B.data;return an(F,De.Workflow)&&F.workflowId===X&&F.collectionId===j});if(W!==-1)z&&s(W,B=>({...B,activeTabName:z})),r(W);else{if(!c({collectionId:j,workflowId:X})){m("Workflow not found","workflowTab","workflow_not_found",{collectionId:j,workflowId:X});return}x({id:crypto.randomUUID(),state:hn.Preview,data:{collectionId:j,workflowId:X,type:De.Workflow,activeTabName:z??He.WORKFLOW_SETTINGS}})}},[r,t,s,x,c,m]),V=b.useCallback(({collectionId:j,workflowId:X,stepId:z,state:W})=>{const B=t().findIndex(({data:F})=>an(F,De.Step)&&F.collectionId===j&&F.workflowId===X&&F.stepId===z&&F.historyId===null);if(B!==-1)r(B);else{const F=a({collectionId:j,workflowId:X,stepId:z});if(!F){m("Step not found","stepTab","step_not_found",{collectionId:j,workflowId:X,stepId:z});return}x({id:crypto.randomUUID(),state:W??hn.Preview,data:Mu({stepId:z,collectionId:j,workflowId:X,activeTabName:rc(F)})})}},[r,t,a,x,m]),I=b.useCallback(({step:j})=>{x({id:crypto.randomUUID(),state:hn.Normal,data:Mu({stepId:j.stepId??null,workflowId:j.workflowId??null,draftStep:structuredClone(j),activeTabName:rc(j)})})},[x]),q=b.useCallback((j,X)=>{if(j===X)return;const z=e(),W=[...t()],B=W[z]?.id,[F]=W.splice(j,1);if(W.splice(X,0,F),n(()=>W),B){const G=W.findIndex(ee=>ee.id===B);r(G)}},[e,t,n,r]);return{handleNewTabOpen:v,addNewTab:x,openStepTabFromOperation:y,focusOperationTab:w,openStepTabFromXOperation:S,handleTabChange:O,handleTabClose:k,handleCloseAllTabs:T,handleCloseByDataId:$,openCollectionTab:_,openWorkflowTab:L,openWorkflowRunTab:D,openWorkflowRunTabFromHistory:R,focusWorkflowRunTab:M,openStepTabFromHistory:E,openStepTabFromCollection:V,openStepTab:I,handleTabReorder:q,changeTabState:g}}function eI(t,e,n){const r=jo({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:hn.Preview,data:Mu({draftStep:r,activeTabName:rc(r)})}}function iSe(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const sSe=({transform:t})=>({...t,y:0}),oSe=({transform:t,draggingNodeRect:e,containerNodeRect:n})=>!e||!n?t:{...t,x:Math.max(n.left-e.left,Math.min(t.x,n.right-e.right))},Xc=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,aSe=t=>d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",...t,children:[d.jsx("path",{d:"M10.8623 6.60461C11.0548 6.64292 11.2314 6.73734 11.3701 6.8761C11.5089 7.01487 11.6033 7.19144 11.6416 7.38391C11.6799 7.57633 11.661 7.77588 11.5859 7.95715C11.5108 8.13849 11.3829 8.29342 11.2197 8.40247C11.0566 8.51141 10.8651 8.5694 10.6689 8.56946C10.4939 8.5686 10.3221 8.52031 10.1729 8.42883L9.40625 9.19739C9.58461 9.44901 9.67969 9.75029 9.67969 10.0587C9.67965 10.3669 9.5844 10.6676 9.40625 10.9191L10.1729 11.6886C10.3221 11.5971 10.4938 11.5479 10.6689 11.547C10.865 11.5471 11.0567 11.6052 11.2197 11.714C11.3829 11.823 11.5108 11.9781 11.5859 12.1593C11.6611 12.3406 11.6799 12.541 11.6416 12.7335C11.6033 12.9259 11.5088 13.1026 11.3701 13.2413C11.2314 13.38 11.0547 13.4745 10.8623 13.5128C10.6698 13.5511 10.4704 13.5313 10.2891 13.4562C10.1078 13.3811 9.95279 13.2541 9.84375 13.0909C9.7347 12.9277 9.67578 12.7355 9.67578 12.5392C9.6767 12.3641 9.7258 12.1923 9.81738 12.0431L9.04883 11.2765C8.79719 11.4549 8.49595 11.5509 8.1875 11.5509C7.87917 11.5509 7.57871 11.4548 7.32715 11.2765L6.55762 12.0431C6.6492 12.1923 6.6983 12.3641 6.69922 12.5392C6.69922 12.7354 6.6412 12.9278 6.53223 13.0909C6.42318 13.2541 6.26728 13.3811 6.08594 13.4562C5.90468 13.5312 5.7051 13.5511 5.5127 13.5128C5.32032 13.4745 5.14359 13.38 5.00488 13.2413C4.86618 13.1026 4.77174 12.9259 4.7334 12.7335C4.69511 12.541 4.71493 12.3406 4.79004 12.1593C4.86518 11.9782 4.99222 11.8229 5.15527 11.714C5.31843 11.605 5.51083 11.547 5.70703 11.547C5.88211 11.5479 6.05389 11.597 6.20312 11.6886L6.96973 10.9191C6.79143 10.6675 6.69535 10.367 6.69531 10.0587C6.69531 9.75027 6.79134 9.44902 6.96973 9.19739L6.20312 8.42883C6.0539 8.52041 5.88211 8.56853 5.70703 8.56946C5.51075 8.56946 5.31847 8.51151 5.15527 8.40247C4.99211 8.29342 4.86514 8.13846 4.79004 7.95715C4.71493 7.77581 4.69511 7.57642 4.7334 7.38391C4.77168 7.19148 4.86618 7.01486 5.00488 6.8761C5.14358 6.7374 5.32034 6.64296 5.5127 6.60461C5.70502 6.56636 5.90473 6.58534 6.08594 6.66028C6.26728 6.73539 6.42318 6.86329 6.53223 7.02649C6.64104 7.18953 6.69917 7.38125 6.69922 7.57727C6.69836 7.7524 6.64917 7.92407 6.55762 8.07336L7.32715 8.83997C7.57865 8.66181 7.87929 8.56656 8.1875 8.56653C8.49595 8.56653 8.79719 8.66158 9.04883 8.83997L9.81738 8.07336C9.72588 7.9241 9.67664 7.75235 9.67578 7.57727C9.67583 7.38112 9.7348 7.1896 9.84375 7.02649C9.9528 6.86329 10.1077 6.73539 10.2891 6.66028C10.4703 6.58526 10.6699 6.56634 10.8623 6.60461ZM5.60938 12.0529C5.51328 12.0721 5.42476 12.1193 5.35547 12.1886C5.28617 12.2579 5.23889 12.3464 5.21973 12.4425C5.20058 12.5388 5.21049 12.6389 5.24805 12.7296C5.28559 12.8202 5.34915 12.8978 5.43066 12.9523C5.51226 13.0068 5.60889 13.0353 5.70703 13.0353C5.83843 13.0352 5.96467 12.9836 6.05762 12.8907C6.15067 12.7977 6.20312 12.6708 6.20312 12.5392C6.20305 12.4412 6.1736 12.3453 6.11914 12.2638C6.06462 12.1822 5.98712 12.1187 5.89648 12.0812C5.80581 12.0436 5.70563 12.0337 5.60938 12.0529ZM10.5723 12.0529C10.476 12.072 10.3868 12.1192 10.3174 12.1886C10.2481 12.2579 10.2008 12.3464 10.1816 12.4425C10.1625 12.5388 10.1724 12.6389 10.21 12.7296C10.2475 12.8202 10.3111 12.8978 10.3926 12.9523C10.4742 13.0068 10.5708 13.0353 10.6689 13.0353C10.8004 13.0352 10.9266 12.9836 11.0195 12.8907C11.1126 12.7977 11.165 12.6708 11.165 12.5392C11.165 12.4412 11.1355 12.3453 11.0811 12.2638C11.0265 12.1823 10.949 12.1187 10.8584 12.0812C10.7679 12.0437 10.6684 12.0338 10.5723 12.0529ZM5.80371 7.09094C5.70746 7.0718 5.60727 7.08171 5.5166 7.11926C5.42601 7.15683 5.34843 7.22033 5.29395 7.30188C5.2395 7.3834 5.21 7.47924 5.20996 7.57727C5.20996 7.70887 5.26241 7.83578 5.35547 7.92883C5.44852 8.02183 5.57548 8.07336 5.70703 8.07336C5.80501 8.07328 5.90095 8.04479 5.98242 7.99036C6.06394 7.93589 6.12747 7.85825 6.16504 7.7677C6.2026 7.67703 6.21251 7.57684 6.19336 7.48059C6.17421 7.38441 6.12694 7.29605 6.05762 7.22668C5.9883 7.15736 5.89985 7.11013 5.80371 7.09094ZM10.6689 7.08118C10.5373 7.08118 10.4104 7.13363 10.3174 7.22668C10.2245 7.31967 10.1729 7.44586 10.1729 7.57727C10.1729 7.67541 10.2013 7.77204 10.2559 7.85364C10.3104 7.9351 10.388 7.99873 10.4785 8.03625C10.5692 8.07381 10.6694 8.08372 10.7656 8.06457C10.8617 8.04544 10.9502 7.99808 11.0195 7.92883C11.0889 7.85944 11.1361 7.7702 11.1553 7.67395C11.1743 7.57784 11.1644 7.47835 11.127 7.38782C11.0894 7.29719 11.0259 7.21968 10.9443 7.16516C10.8628 7.11069 10.767 7.08123 10.6689 7.08118Z"}),d.jsx("path",{d:"M10.5 0.880005C10.9812 0.880005 11.375 1.27375 11.375 1.755V5.88489C11.375 5.95116 11.3212 6.005 11.2549 6.005H10.6201C10.5538 6.005 10.5 5.95116 10.5 5.88489V1.755H7V4.38C7 4.86125 6.60625 5.255 6.125 5.255H3.5V13.0099C3.5 13.0762 3.44616 13.13 3.37988 13.13H2.74512C2.67884 13.13 2.625 13.0762 2.625 13.0099V4.38C2.625 4.24875 2.66836 4.16086 2.75586 4.07336L5.81836 1.01086C5.90586 0.923364 5.99375 0.880005 6.125 0.880005H10.5ZM3.6748 4.38H6.125V1.92981L3.6748 4.38Z"})]}),Bb=C.default(aSe)`
634
634
  path {
635
635
  fill: ${({color:t})=>Xc(t)};
636
636
  }
@@ -971,7 +971,7 @@ ${z}`),q.pop(),`{${G}}`}case"number":return isFinite(I)?String(I):y?y(I):"null";
971
971
  display: flex;
972
972
  flex-direction: column;
973
973
  gap: var(--spacing-xs);
974
- `;function lwe({collection:t}){return d.jsx("div",{children:"TODO: ComponentsTab"})}function Lq(t){const{attachApiServerToEnvironments:e}=cq(),n=Xo(),{removeSourceDescription:r,disconnectStepsFromSource:i}=Vc(),s=b.useCallback(l=>{const{name:c,apiId:u,sourceUrl:f,sourceDescriptionToEdit:h,sourceDescriptionToEditIndex:p}=l,m=c.trim(),g=h!==null&&p!==null;n(O=>ii(O,t,v=>{if(g&&h!==null&&p!==null){const x=v.sourceDescriptions[p];if(x===void 0)return v;const y=[...v.sourceDescriptions];return y[p]={...x,name:m,url:f,apiId:u},{...v,sourceDescriptions:y}}return{...v,sourceDescriptions:[...v.sourceDescriptions,{name:m,url:f,apiId:u}]}})),e(u)},[t,n,e]),o=b.useCallback(l=>{r(t,l)},[t,r]),a=b.useCallback(l=>{i(t,l)},[t,i]);return{createOrUpdateSource:s,removeSourceDescription:o,disconnectStepsFromSource:a}}async function gy(t,e){const[{bundle:n,Config:r},{ExternalResolver:i}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-C7MCjO6i.js")),Promise.resolve().then(()=>require("./replay-external-resolver-1bxcPBye.js"))]),s=new r({});s.getRulesForSpecVersion=()=>[];const o=await qt.dirname(t),a={config:s,base:o,externalRefResolver:new i,dereference:!0};e?a.doc={source:{absoluteRef:t},parsed:e}:a.ref=t;const{bundle:{parsed:l},fileDependencies:c}=await n(a);return{definition:l,fileDependencies:c}}const ai={FS:"fs",WEB:"web"},r5=/^[A-Za-z0-9_-]+$/,cwe="apis";function uwe(t){if(!t)return{name:"",activeTab:cwe,selectedApiId:null,url:""};const e=Ki(t.url)||Ki(t.apiId);return{name:t.name,activeTab:e?"url":"apis",selectedApiId:e?null:t.apiId,url:e?t.url:""}}function dwe(t,e,n){return t.length===0?null:e?n?"This name already exists":null:"Name must match [A-Za-z0-9_-]+"}function fwe({collection:t,sourceDescriptionToEdit:e,sourceDescriptionToEditIndex:n}){const r=Vs(),i=GT(),{createOrUpdateSource:s}=Lq(t.id),o=uwe(e),[a,l]=b.useState(o.name),[c,u]=b.useState(o.activeTab),[f,h]=b.useState(o.selectedApiId),[p,m]=b.useState(o.url),g=!!e,O=a.trim(),v=b.useMemo(()=>new Set(t.sourceDescriptions.filter((M,L)=>L!==n).map(M=>M.name)),[t.sourceDescriptions,n]),x=O.length>0&&v.has(O),y=r5.test(O),w=dwe(O,y,x),S=O.length>0&&y&&!x,k=p.trim(),T=k.length>0&&Ki(k),$=k.length>0&&!T?"Please enter a valid URL":null,E=S&&(c==="apis"?!!f:!!T),_=b.useMemo(()=>r.map(M=>({id:M.id,name:M.info.title,path:Ki(M.id)?M.id:`./${M.id.replace(/^\//,"")}`})),[r]),D=b.useCallback(async()=>{const M=t.id,L=p.trim();if(c==="apis"){if(!f)return null;const I=Ki(f)?f:await qt.relative(`/${M}/..`,`/${f}`);return{apiId:f,sourceUrl:I}}if(!L||!Ki(L))return null;if(!r.some(I=>I.id===L)){const{definition:I,fileDependencies:q}=await gy(L);i(j=>[...j,{id:L,srcType:ai.WEB,...I,...q&&{fileDependencies:q}}])}return{apiId:L,sourceUrl:L}},[c,r,i,t,f,p]),R=b.useCallback(async()=>{const M=a.trim();if(!M||!r5.test(M))return;const L=await D();if(!L)return;const{apiId:V,sourceUrl:I}=L;s({name:M,apiId:V,sourceUrl:I,sourceDescriptionToEdit:g?e:null,sourceDescriptionToEditIndex:g?n:null})},[a,s,g,D,e,n]);return{name:a,setName:l,activeTab:c,setActiveTab:u,selectedApiId:f,setSelectedApiId:h,url:p,setUrl:m,nameErrorText:w,urlErrorText:$,canSubmit:E,apiItems:_,handleSubmit:R}}const hwe=t=>d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",...t,children:[d.jsx("path",{d:"M10.5 0.875C10.9812 0.875 11.375 1.26875 11.375 1.75V6.87988C11.375 6.94616 11.3212 7 11.2549 7H10.6201C10.5538 7 10.5 6.94616 10.5 6.87988V1.75H7V4.375C7 4.85625 6.60625 5.25 6.125 5.25H3.5V12.25H5.12402C5.19012 12.2502 5.24316 12.304 5.24316 12.3701V13.0049C5.24316 13.071 5.19012 13.1248 5.12402 13.125H3.5C3.01875 13.125 2.625 12.7312 2.625 12.25V4.375C2.625 4.24375 2.66836 4.15586 2.75586 4.06836L5.81836 1.00586C5.90586 0.91836 5.99375 0.875 6.125 0.875H10.5ZM3.6748 4.375H6.125V1.9248L3.6748 4.375Z"}),d.jsx("path",{d:"M5.94824 6.92676C6.27209 6.7761 6.63792 6.7394 6.98535 6.82227C7.33272 6.90515 7.64233 7.10322 7.86328 7.38379C8.08406 7.66425 8.20392 8.01124 8.20312 8.36816C8.20397 8.70923 8.09223 9.04201 7.88574 9.31348L8.84082 10.2686C9.11428 10.0645 9.44687 9.95442 9.78809 9.9541C10.1451 9.95374 10.4922 10.0737 10.7725 10.2949C11.0525 10.5161 11.2495 10.8256 11.332 11.1729C11.4145 11.5202 11.3774 11.8854 11.2266 12.209C11.0757 12.5325 10.82 12.7959 10.501 12.9561C10.1818 13.1162 9.81742 13.1642 9.46777 13.0918C9.11819 13.0193 8.80342 12.8304 8.57422 12.5566C8.34508 12.2829 8.21496 11.9399 8.20508 11.583C8.19522 11.2261 8.30582 10.8759 8.51953 10.5898L7.56641 9.63477C7.28031 9.84854 6.93025 9.95915 6.57324 9.94922C6.21639 9.93927 5.87331 9.80925 5.59961 9.58008C5.32584 9.35068 5.13674 9.03533 5.06445 8.68555C4.99217 8.33576 5.04075 7.97147 5.20117 7.65234C5.36158 7.33342 5.62457 7.07737 5.94824 6.92676ZM6.83789 7.25781C6.61834 7.21421 6.3904 7.2366 6.18359 7.32227C5.97685 7.40796 5.80015 7.55319 5.67578 7.73926C5.55143 7.92536 5.48544 8.14435 5.48535 8.36816C5.48535 8.66836 5.60422 8.95661 5.81641 9.16895C6.02874 9.38128 6.31691 9.50094 6.61719 9.50098C6.84098 9.50098 7.05997 9.43479 7.24609 9.31055C7.43231 9.18612 7.57738 9.00867 7.66309 8.80176C7.74879 8.59484 7.77123 8.36712 7.72754 8.14746C7.68383 7.92801 7.57615 7.72663 7.41797 7.56836C7.2596 7.40999 7.05755 7.30151 6.83789 7.25781Z"})]}),iI=C.default(hwe)`
974
+ `;function lwe({collection:t}){return d.jsx("div",{children:"TODO: ComponentsTab"})}function Lq(t){const{attachApiServerToEnvironments:e}=cq(),n=Xo(),{removeSourceDescription:r,disconnectStepsFromSource:i}=Vc(),s=b.useCallback(l=>{const{name:c,apiId:u,sourceUrl:f,sourceDescriptionToEdit:h,sourceDescriptionToEditIndex:p}=l,m=c.trim(),g=h!==null&&p!==null;n(O=>ii(O,t,v=>{if(g&&h!==null&&p!==null){const x=v.sourceDescriptions[p];if(x===void 0)return v;const y=[...v.sourceDescriptions];return y[p]={...x,name:m,url:f,apiId:u},{...v,sourceDescriptions:y}}return{...v,sourceDescriptions:[...v.sourceDescriptions,{name:m,url:f,apiId:u}]}})),e(u)},[t,n,e]),o=b.useCallback(l=>{r(t,l)},[t,r]),a=b.useCallback(l=>{i(t,l)},[t,i]);return{createOrUpdateSource:s,removeSourceDescription:o,disconnectStepsFromSource:a}}async function gy(t,e){const[{bundle:n,Config:r},{ExternalResolver:i}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-D5Z0mNdH.js")),Promise.resolve().then(()=>require("./replay-external-resolver-CnBhw18p.js"))]),s=new r({});s.getRulesForSpecVersion=()=>[];const o=await qt.dirname(t),a={config:s,base:o,externalRefResolver:new i,dereference:!0};e?a.doc={source:{absoluteRef:t},parsed:e}:a.ref=t;const{bundle:{parsed:l},fileDependencies:c}=await n(a);return{definition:l,fileDependencies:c}}const ai={FS:"fs",WEB:"web"},r5=/^[A-Za-z0-9_-]+$/,cwe="apis";function uwe(t){if(!t)return{name:"",activeTab:cwe,selectedApiId:null,url:""};const e=Ki(t.url)||Ki(t.apiId);return{name:t.name,activeTab:e?"url":"apis",selectedApiId:e?null:t.apiId,url:e?t.url:""}}function dwe(t,e,n){return t.length===0?null:e?n?"This name already exists":null:"Name must match [A-Za-z0-9_-]+"}function fwe({collection:t,sourceDescriptionToEdit:e,sourceDescriptionToEditIndex:n}){const r=Vs(),i=GT(),{createOrUpdateSource:s}=Lq(t.id),o=uwe(e),[a,l]=b.useState(o.name),[c,u]=b.useState(o.activeTab),[f,h]=b.useState(o.selectedApiId),[p,m]=b.useState(o.url),g=!!e,O=a.trim(),v=b.useMemo(()=>new Set(t.sourceDescriptions.filter((M,L)=>L!==n).map(M=>M.name)),[t.sourceDescriptions,n]),x=O.length>0&&v.has(O),y=r5.test(O),w=dwe(O,y,x),S=O.length>0&&y&&!x,k=p.trim(),T=k.length>0&&Ki(k),$=k.length>0&&!T?"Please enter a valid URL":null,E=S&&(c==="apis"?!!f:!!T),_=b.useMemo(()=>r.map(M=>({id:M.id,name:M.info.title,path:Ki(M.id)?M.id:`./${M.id.replace(/^\//,"")}`})),[r]),D=b.useCallback(async()=>{const M=t.id,L=p.trim();if(c==="apis"){if(!f)return null;const I=Ki(f)?f:await qt.relative(`/${M}/..`,`/${f}`);return{apiId:f,sourceUrl:I}}if(!L||!Ki(L))return null;if(!r.some(I=>I.id===L)){const{definition:I,fileDependencies:q}=await gy(L);i(j=>[...j,{id:L,srcType:ai.WEB,...I,...q&&{fileDependencies:q}}])}return{apiId:L,sourceUrl:L}},[c,r,i,t,f,p]),R=b.useCallback(async()=>{const M=a.trim();if(!M||!r5.test(M))return;const L=await D();if(!L)return;const{apiId:V,sourceUrl:I}=L;s({name:M,apiId:V,sourceUrl:I,sourceDescriptionToEdit:g?e:null,sourceDescriptionToEditIndex:g?n:null})},[a,s,g,D,e,n]);return{name:a,setName:l,activeTab:c,setActiveTab:u,selectedApiId:f,setSelectedApiId:h,url:p,setUrl:m,nameErrorText:w,urlErrorText:$,canSubmit:E,apiItems:_,handleSubmit:R}}const hwe=t=>d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",...t,children:[d.jsx("path",{d:"M10.5 0.875C10.9812 0.875 11.375 1.26875 11.375 1.75V6.87988C11.375 6.94616 11.3212 7 11.2549 7H10.6201C10.5538 7 10.5 6.94616 10.5 6.87988V1.75H7V4.375C7 4.85625 6.60625 5.25 6.125 5.25H3.5V12.25H5.12402C5.19012 12.2502 5.24316 12.304 5.24316 12.3701V13.0049C5.24316 13.071 5.19012 13.1248 5.12402 13.125H3.5C3.01875 13.125 2.625 12.7312 2.625 12.25V4.375C2.625 4.24375 2.66836 4.15586 2.75586 4.06836L5.81836 1.00586C5.90586 0.91836 5.99375 0.875 6.125 0.875H10.5ZM3.6748 4.375H6.125V1.9248L3.6748 4.375Z"}),d.jsx("path",{d:"M5.94824 6.92676C6.27209 6.7761 6.63792 6.7394 6.98535 6.82227C7.33272 6.90515 7.64233 7.10322 7.86328 7.38379C8.08406 7.66425 8.20392 8.01124 8.20312 8.36816C8.20397 8.70923 8.09223 9.04201 7.88574 9.31348L8.84082 10.2686C9.11428 10.0645 9.44687 9.95442 9.78809 9.9541C10.1451 9.95374 10.4922 10.0737 10.7725 10.2949C11.0525 10.5161 11.2495 10.8256 11.332 11.1729C11.4145 11.5202 11.3774 11.8854 11.2266 12.209C11.0757 12.5325 10.82 12.7959 10.501 12.9561C10.1818 13.1162 9.81742 13.1642 9.46777 13.0918C9.11819 13.0193 8.80342 12.8304 8.57422 12.5566C8.34508 12.2829 8.21496 11.9399 8.20508 11.583C8.19522 11.2261 8.30582 10.8759 8.51953 10.5898L7.56641 9.63477C7.28031 9.84854 6.93025 9.95915 6.57324 9.94922C6.21639 9.93927 5.87331 9.80925 5.59961 9.58008C5.32584 9.35068 5.13674 9.03533 5.06445 8.68555C4.99217 8.33576 5.04075 7.97147 5.20117 7.65234C5.36158 7.33342 5.62457 7.07737 5.94824 6.92676ZM6.83789 7.25781C6.61834 7.21421 6.3904 7.2366 6.18359 7.32227C5.97685 7.40796 5.80015 7.55319 5.67578 7.73926C5.55143 7.92536 5.48544 8.14435 5.48535 8.36816C5.48535 8.66836 5.60422 8.95661 5.81641 9.16895C6.02874 9.38128 6.31691 9.50094 6.61719 9.50098C6.84098 9.50098 7.05997 9.43479 7.24609 9.31055C7.43231 9.18612 7.57738 9.00867 7.66309 8.80176C7.74879 8.59484 7.77123 8.36712 7.72754 8.14746C7.68383 7.92801 7.57615 7.72663 7.41797 7.56836C7.2596 7.40999 7.05755 7.30151 6.83789 7.25781Z"})]}),iI=C.default(hwe)`
975
975
  path {
976
976
  fill: ${({color:t})=>Xc(t)};
977
977
  }
@@ -1445,7 +1445,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
1445
1445
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
1446
1446
  `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){const n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){const r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){yy(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const r=!this.onKeyLine&&this.indent===e.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let s=[];if(i&&n.sep&&!n.value){const o=[];for(let a=0;a<n.sep.length;++a){const l=n.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.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(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ka(n.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(e6(n.key)&&!Ka(n.sep,"newline")){const o=hu(n.start),a=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(Ka(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const o=hu(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:s,key:null,sep:[this.sourceToken]}):Ka(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const o=this.flowScalar(this.type);i||n.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{const o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Ka(n.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 r&&e.items.push({start:s});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){const n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){const r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){yy(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||Ka(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){const r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{const r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){const i=Wm(r),s=hu(i);aD(e);const o=e.end.splice(1,e.end.length);o.push(this.sourceToken);const a={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]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
1447
1447
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
1448
- `,n)+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;const n=Wm(e),r=hu(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=Wm(e),r=hu(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.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())}}};function Oke(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new gke||null,prettyErrors:e}}function vke(t,e={}){const{lineCounter:n,prettyErrors:r}=Oke(e),i=new mke(n?.addNewLine),s=new uke(e);let o=null;for(const a of s.compose(i.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new ih(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(nD(t,n)),o.warnings.forEach(nD(t,n))),o}function xI(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function t6(t){return!Jt(t)||t.value==null?null:typeof t.value=="string"?t.value:xI(t.value)?t.source??String(t.value):null}function Z1(t,e){return t6(t)===e}function Dh(t){return Jt(t)&&t.value==null}function Wl(t){return t==null||Dh(t)||Pr(t)||t instanceof kt}function U1(t){return t==null||Pr(t)||Jt(t)&&(t.value==null||xI(t.value))}function yke(t){return Jt(t)&&typeof t.value=="string"}function Cs(t,e){return Pr(t.getIn(e,!0))}function bke(t){const{contents:e}=t;return e instanceof kt&&e.items.length===0&&!e.commentBefore&&!e.comment&&!t.commentBefore&&!t.comment}const xke="<<",lD="$ref";class Ske{constructor(e,n){this.providers=e,this.basePath=n}providers;basePath;sectionProblem(e){if(this.basePath.length===0){const s=e.contents;return Wl(s)?s instanceof kt?this.environmentsProblem(e,s,"environments"):null:"The environments store must be a map of environment names"}const n=this.basePath.join("."),r=this.parentProblem(e,n);if(r)return r;if(Cs(e,this.basePath))return null;if(this.hasRefAbove(e))return`Replay does not follow $ref, so it cannot manage the ${n} section here`;const i=e.getIn(this.basePath,!0);return Wl(i)?i instanceof kt?this.environmentsProblem(e,i,n):null:`The ${n} section must be a map of environment names`}environmentsProblem(e,n,r){const i=this.managedKeysProblem(n,r);if(i)return i;for(const s of n.items){const o=String(s.key);if(bl(o))continue;if(!Wl(s.value))return`Environment ${o} in ${r} must be a map`;if(!(s.value instanceof kt))continue;const a=this.environmentBodyProblem(e,o,s.value,r);if(a)return a}return null}environmentBodyProblem(e,n,r,i){const s=this.reservedKeysProblem(r,i);if(s)return s;const o=r.get("inputs",!0);if(!Wl(o))return`The inputs of ${n} in ${i} must be a map`;if(o instanceof kt){const l=`the inputs of ${n}`,c=this.managedKeysProblem(o,l);if(c)return c;for(const u of o.items)if(!U1(u.value)&&!(u.value instanceof kt&&this.isMarkerNode(e,u.value)))return`Input ${String(u.key)} of ${n} in ${i} must be a single value`}const a=r.get("servers",!0);if(!Wl(a))return`The servers of ${n} in ${i} must be a map`;if(a instanceof kt){const l=`the servers of ${n}`,c=this.managedKeysProblem(a,l);if(c)return c;for(const u of a.items){const f=this.serverBodyProblem(String(u.key),u.value,n,i);if(f)return f}}return null}serverBodyProblem(e,n,r,i){if(!Wl(n))return`Server ${e} of ${r} in ${i} must be a map`;if(!(n instanceof kt))return null;const s=this.reservedKeysProblem(n,`server ${e} of ${r}`);if(s)return s;const o=n.get("value",!0);if(!U1(o))return`The value of server ${e} of ${r} in ${i} must be a single value`;const a=n.get("variables",!0);if(!Wl(a))return`The variables of server ${e} of ${r} in ${i} must be a map`;if(a instanceof kt){const l=`the variables of server ${e} of ${r}`,c=this.managedKeysProblem(a,l);if(c)return c;for(const u of a.items)if(!U1(u.value))return`Variable ${String(u.key)} of server ${e} of ${r} in ${i} must be a single value`}return null}managedKeysProblem(e,n){const r=this.reservedKeysProblem(e,n);if(r)return r;for(const i of e.items)if(!yke(i.key))return`Replay reads only string keys, and ${n} holds ${String(i.key)}`;return null}reservedKeysProblem(e,n){return e.has(xke)?`Replay cannot read a merge key, and ${n} uses one`:e.has(lD)?`Replay does not follow $ref, and ${n} uses one`:null}isMarkerNode(e,n){try{return this.providers.resolveProviderForMarker(n.toJS(e))!==null}catch{return!1}}parentProblem(e,n){for(let r=1;r<this.basePath.length;r++){const i=this.basePath.slice(0,r),s=e.getIn(i,!0);if(s==null||Dh(s))return null;const o=i.join(".");if(Pr(s))return`The ${o} key is an alias, so Replay cannot manage the ${n} section inside it`;if(!(s instanceof kt))return`The ${o} key must be a map for Replay to manage the ${n} section`}return null}hasRefAbove(e){for(let n=1;n<=this.basePath.length;n++){const r=e.getIn(this.basePath.slice(0,n),!0);if(r instanceof kt&&r.has(lD))return!0}return!1}}const wke=new Set(["inputs","servers"]),Cke=new Set(["value","variables"]);class Pke{constructor(e,n=[]){this.providers=e,this.basePath=n,this.validator=new Ske(e,n)}providers;basePath;validator;hasSection(e){return this.basePath.length===0||e.hasIn(this.basePath)}sectionPath(...e){return[...this.basePath,...e]}leafText(e,n,r){const i=e.getIn(n,!0),s=Pr(i)?i.resolve(e):i;return t6(s)??(xI(r)?String(r):"")}extractEnvironments(e,n){const r=this.readSectionData(e);return r?Object.keys(r).filter(s=>!bl(s)).map(s=>{const o=r[s]??{},a=Object.entries(o.inputs??{}).map(([c,u])=>{const f=this.providers.resolveProviderForMarker(u);return f?{name:c,value:f.resolve(n,s,c),isSecret:!0}:{name:c,value:this.leafText(e,this.sectionPath(s,"inputs",c),u),isSecret:!1}}),l=Object.entries(o.servers??{}).map(([c,u])=>{const f=this.sectionPath(s,"servers",c);return{apiId:c,value:this.leafText(e,[...f,"value"],u?.value),variables:Object.entries(u?.variables??{}).map(([h,p])=>({name:h,value:this.leafText(e,[...f,"variables",h],p)}))}});return{name:s,inputs:a,servers:l,state:$t.Normal}}):[]}hydrateDocument(e,n,r){if(Cs(e,this.basePath))return e;for(let s=1;s<=this.basePath.length;s++){const o=this.basePath.slice(0,s);Dh(e.getIn(o,!0))&&e.setIn(o,this.createBlockMap(e))}const i=new Set(n.map(s=>s.name).filter(Boolean));this.deleteRemovedKeys(e,this.sectionPath(),i);for(const s of n){if(!s.name)continue;const o=this.sectionPath(s.name);Cs(e,o)||(e.hasIn(o)||this.ensureBlockMap(e,o),this.syncInputs(e,s.name,s.inputs,r),this.syncServers(e,s.name,s.servers))}return this.unflowSectionAncestors(e),e}removeSection(e){if(this.basePath.length!==0){e.deleteIn(this.basePath);for(let n=this.basePath.length-1;n>0;n--){const r=this.basePath.slice(0,n),i=e.getIn(r,!0);i instanceof kt&&i.items.length===0&&e.deleteIn(r)}}}sectionProblem(e){return this.validator.sectionProblem(e)}isSectionAliased(e){return this.basePath.length>0&&Cs(e,this.basePath)}hasEnvironments(e){const n=this.basePath.length===0?e.contents:e.getIn(this.basePath,!0);return n instanceof kt&&n.items.length>0}hasUnreadContent(e){const n=e.getIn(this.basePath,!0);return n instanceof kt?n.items.some(r=>this.environmentHoldsUnreadContent(r.value)):!1}environmentHoldsUnreadContent(e){return Pr(e)?!0:e instanceof kt?e.items.some(n=>{const r=String(n.key);return!wke.has(r)||Pr(n.value)?!0:r!=="servers"||!(n.value instanceof kt)?!1:n.value.items.some(i=>{const s=i.value;return Pr(s)?!0:s instanceof kt?s.items.some(o=>!Cke.has(String(o.key))):!1})}):!1}unflowSectionAncestors(e){for(let n=1;n<=this.basePath.length;n++){const r=e.getIn(this.basePath.slice(0,n),!0);r instanceof kt&&r.flow&&(r.flow=!1)}}readSectionData(e){if(this.basePath.length===0){const i=e.toJS();return i==null||typeof i!="object"||Array.isArray(i)?null:i}const n=e.getIn(this.basePath,!0);if(n==null||Dh(n))return null;if(!Pr(n)&&!(n instanceof kt))throw new Error(`Expected \`${this.basePath.join(".")}\` to be a map of environments`);const r=n.toJS(e);if(r==null)return null;if(typeof r!="object"||Array.isArray(r))throw new Error(`Expected \`${this.basePath.join(".")}\` to be a map of environments`);return r}syncInputs(e,n,r,i){const s=new Set(r.map(a=>a.name)),o=this.sectionPath(n,"inputs");if(!Cs(e,o)){this.deleteRemovedKeys(e,o,s),r.length>0&&this.ensureBlockMap(e,o);for(const a of r){const l=[...o,a.name];if(!Cs(e,l)){if(a.isSecret){const c=e.getIn(l,!0),u=c instanceof kt?c.toJS(e):e.getIn(l),f=this.providers.resolveProviderForMarker(u);f||e.setIn(l,e.createNode(this.providers.getDefaultProvider().createMarker())),(f??this.providers.getDefaultProvider()).store(i,n,a.name,a.value);continue}Z1(e.getIn(l,!0),a.value)||e.setIn(l,a.value)}}}}syncServers(e,n,r){const i=new Set(r.map(o=>o.apiId)),s=this.sectionPath(n,"servers");if(!Cs(e,s)){this.deleteRemovedKeys(e,s,i),r.length>0&&this.ensureBlockMap(e,s);for(const o of r){const a=[...s,o.apiId];if(Cs(e,a))continue;Dh(e.getIn(a,!0))&&e.setIn(a,this.createBlockMap(e));const l=[...a,"value"];!Cs(e,l)&&!Z1(e.getIn(l,!0),o.value)&&e.setIn(l,o.value);const c=[...a,"variables"];if(Cs(e,c))continue;const u=new Set(o.variables.map(f=>f.name));this.deleteRemovedKeys(e,c,u),o.variables.length>0&&this.ensureBlockMap(e,c);for(const f of o.variables){const h=[...c,f.name];Cs(e,h)||Z1(e.getIn(h,!0),f.value)||e.setIn(h,f.value)}}}}ensureBlockMap(e,n){for(let r=this.basePath.length+1;r<=n.length;r++){const i=n.slice(0,r),s=e.getIn(i,!0);if(s instanceof kt){s.flow=!1;continue}if(Pr(s))return;e.setIn(i,this.createBlockMap(e))}}createBlockMap(e){const n=e.createNode({});return n instanceof kt&&(n.flow=!1),n}deleteRemovedKeys(e,n,r){for(const i of this.getMapKeys(e,...n))!i.trim()||bl(i)||r.has(i)||e.deleteIn([...n,i])}getMapKeys(e,...n){const r=n.length===0?e.contents:e.getIn(n,!0);return r instanceof kt?r.items.map(i=>String(i.key)):[]}}class kke{id="local";isMarker(e){return typeof e=="object"&&e!==null&&"provider"in e&&e.provider===this.id}createMarker(){return{provider:this.id}}resolve(e,n,r){return e[n]?.[r]??""}store(e,n,r,i){e[n]||(e[n]={}),e[n][r]=i}}class Tke{constructor(e,n){this.defaultProviderId=n,this.providersById=new Map(e.map(r=>[r.id,r]))}defaultProviderId;providersById;getDefaultProvider(){const e=this.providersById.get(this.defaultProviderId);if(!e)throw new Error(`Missing default secrets provider strategy: ${this.defaultProviderId}`);return e}resolveProviderForMarker(e){return this.isProviderMarker(e)?this.providersById.get(e.provider)??this.getDefaultProvider():null}isProviderMarker(e){return typeof e=="object"&&e!==null&&"provider"in e&&typeof e.provider=="string"}}class $ke{constructor(e){this.storage=e}storage;async getAll(){return this.storage.getAll()}async set(e,n){await this.storage.set(e,n)}async clear(e){await this.storage.clear(e)}}class Ike{notifications=new Map;async getAll(){return Array.from(this.notifications.values())}async set(e,n){const r=n.filter(s=>s.severity==="error").length,i=n.filter(s=>s.severity==="warning").length;this.notifications.set(e,{id:e,source:e,issues:n,errorCount:r,warningCount:i})}async clear(e){this.notifications.delete(e)}}const Dg={all:["notifications"],lists:()=>[...Dg.all,"list"]};function Eke(){return qr.useQuery({queryKey:Dg.lists(),queryFn:async()=>Rp.getInstance().getAll()})}function Ake(){return qr.useQuery({queryKey:Dg.lists(),queryFn:async()=>Rp.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class Rp{static instance=null;static initialize(){this.close();const e=new Ike;this.instance=new $ke(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let B1=null;function o0(){return B1||(B1=new qr.QueryClient({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),B1}function Qke(t){const e=t.match(/\bline\s+(\d+)\b/i);if(!e)return;const n=Number.parseInt(e[1],10);return Number.isNaN(n)?void 0:n}function Rke(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:Qke(e)}]}function jke(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function SI(t){try{const e=Rp.getInstance();await t(e),o0().invalidateQueries({queryKey:Dg.all})}catch{}}async function by(t,e){await SI(async n=>{await n.set(t,Rke(e))})}async function _ke(t,e){e.length!==0&&await SI(async n=>{await n.set(t,jke(e))})}async function xy(t){await SI(async e=>{await e.clear(t)})}function cD(t){return F1(t,e=>e.name).map(e=>({...e,inputs:EC(e.inputs),servers:F1(e.servers,n=>n.apiId).map(n=>({...n,variables:F1(n.variables,r=>r.name)}))}))}function F1(t,e){const n=new Set,r=[];for(const i of t){const s=e(i);!Dke(s)||n.has(s)||(n.add(s),r.push(i))}return r}function Dke(t){return!!t.trim()&&!bl(t)}function Nke(t,e){return uD(t)===uD(e)}function uD(t){const e=(n,r)=>[...n].sort((i,s)=>r(i).localeCompare(r(s)));return JSON.stringify(e(t.filter(n=>n.name),n=>n.name).map(n=>[n.name,e(n.inputs,r=>r.name).map(r=>[r.name,r.value,r.isSecret]),e(n.servers,r=>r.apiId).map(r=>[r.apiId,r.value,e(r.variables,i=>i.name).map(i=>[i.name,i.value])])]))}function dD(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===Jd&&e.inputs.length===0&&e.servers.length===0}class Mke{constructor(e,n,r){this.storage=e,this.localStorageSecretsProvider=n,this.candidatePaths=r.filePaths,this.basePath=r.basePath,this.rebuildWhenUnparseable=r.rebuildWhenUnparseable,this.handler=new Pke(new Tke([new kke],"local"),r.basePath)}storage;localStorageSecretsProvider;configError=null;handler;candidatePaths;basePath;rebuildWhenUnparseable;pendingWrite=Promise.resolve();get isSection(){return this.basePath.length>0}getConfigError(){return this.configError}async read(){const e=this.pendingWrite.then(()=>this.readSection());return this.pendingWrite=e.then(()=>{},()=>{}),e}async write(e,{willRetry:n=!1}={}){const r=this.pendingWrite.then(()=>this.writeSection(e,n));return this.pendingWrite=r.catch(()=>{}),r}async readSection(){const e=await this.loadDocumentFromStorage();if(e.status==="unreadable")return await this.blockOn(e.filePath,e.error),[];if(e.status!=="ok")return[];try{const n=await this.readSecrets(),r=this.handler.extractEnvironments(e.document,n);return await this.clearNotifications(),r}catch(n){return console.info("Error reading replay environments",n),await this.blockOn(e.filePath,pu(n)),[]}}async writeSection(e,n){const r=await this.loadDocumentFromStorage(),i=await this.applyWrite(r,e,n);return(i==="written"||i==="unchanged"&&r.status==="ok")&&await this.clearNotifications(),i}async applyWrite(e,n,r){const i=cD(n);if(e.status==="unreadable"){if(!this.rebuildWhenUnparseable)return await this.reportUnavailable(e.filePath,e.error,"file",r),"unavailable"}else if(e.status==="invalid"&&!this.rebuildWhenUnparseable)return"blocked";const s=e.status==="ok"?e.document:null,o=await this.readSecrets();if(s&&this.isUnchanged(s,o,i))return"unchanged";if(s&&this.handler.isSectionAliased(s))return await this.blockOn(e.filePath,new Error(`The ${this.basePath.join(".")} section is an alias, so Replay cannot change it`)),"blocked";if(dD(i)){if(this.isSection){if(dD(n)){const a=await this.clearSection(e.filePath,s,r);if(a)return a}else if(!s||!this.handler.hasSection(s))return"unchanged"}else if(!s)return"unchanged"}return this.writeEnvironments(e.filePath,s,o,i,r)}async clearSection(e,n,r){if(!n||!this.handler.hasSection(n)||!this.handler.hasEnvironments(n))return"unchanged";if(this.handler.hasUnreadContent(n))return null;this.handler.removeSection(n);const i=await this.serialize(e,n,{allowEmptyFile:!0});return i===null?"blocked":this.store(e,i,r)}isUnchanged(e,n,r){try{return Nke(cD(this.handler.extractEnvironments(e,n)),r)}catch{return!1}}async writeEnvironments(e,n,r,i,s){let o;try{o=this.handler.hydrateDocument(n??new jg({}),i,r)}catch(l){return console.error(`Failed to update ${e}`,l),await this.blockOn(e,pu(l)),"blocked"}if(this.isSection&&!this.isUnchanged(o,r,i))return await this.blockOn(e,new Error(`Replay could not save the ${this.basePath.join(".")} section as edited`)),"blocked";const a=await this.serialize(e,o);if(a===null)return"blocked";try{await this.localStorageSecretsProvider.set(JSON.stringify(r))}catch(l){return await this.reportUnavailable(e,pu(l),"secrets",s),"unavailable"}return this.store(e,a,s)}async serialize(e,n,{allowEmptyFile:r=!1}={}){try{return r&&bke(n)?"":n.toString()}catch(i){return console.error(`Failed to serialize ${e}`,i),await this.blockOn(e,pu(i)),null}}async store(e,n,r){try{await this.storage.set(e,n)}catch(i){return await this.reportUnavailable(e,pu(i),"file",r),"unavailable"}return"written"}async blockOn(e,n){this.configError={filePath:e,issues:[{message:n.message}]},await by(e,n)}async reportUnavailable(e,n,r,i){const s=r==="secrets"?"the environment secrets":e;console.error(`Failed to save ${s}`,n);const o=i?" and will retry":"";await by(e,new Error(`Replay could not save ${s}${o}: ${n.message}`))}async loadDocumentFromStorage(){const e=await this.readActiveFile();if("error"in e)return console.error(`Failed to read ${e.filePath}`,e.error),{status:"unreadable",filePath:e.filePath,error:e.error};const{filePath:n,content:r}=e;if(!r)return this.configError=null,await this.clearNotifications(),{status:"absent",filePath:n};const i=vke(r);if(i.errors.length>0)return console.error("Environments file has YAML errors",i.errors),this.configError={filePath:n,issues:i.errors.map(o=>({message:o.message.trim(),line:o.linePos?.[0]?.line}))},await _ke(n,i.errors),{status:"invalid",filePath:n};this.configError=null;const s=this.handler.sectionProblem(i);return s?(await this.blockOn(n,new Error(s)),{status:"invalid",filePath:n}):{status:"ok",filePath:n,document:i}}async readActiveFile(){let e=null;for(const n of this.candidatePaths){let r;try{r=await this.storage.get(n)}catch(i){return{filePath:n,error:pu(i)}}if(r)return{filePath:n,content:r};r!==null&&e===null&&(e=n)}return{filePath:e??this.candidatePaths[0],content:null}}async clearNotifications(){await Promise.all(this.candidatePaths.map(e=>xy(e)))}async readSecrets(){const e=await this.localStorageSecretsProvider.get();if(!e)return{};try{return JSON.parse(e)}catch(n){return console.error("Failed to parse replay secrets sidecar",n),{}}}}function pu(t){return t instanceof Error?t:new Error(String(t))}const fD=[1e3,3e3,1e4];class zke{constructor(e,n){this.storage=e,this.rebuildWhenUnparseable=n}storage;rebuildWhenUnparseable;configFileErrorAccessor=null;retryAttempt=0;retryTimer=null;writeId=0;setConfigFileErrorAccessor(e){this.configFileErrorAccessor=e}publishConfigError(){this.configFileErrorAccessor?.set(this.storage.getConfigError())}async write(e){this.cancelRetry(),this.retryAttempt=0,this.writeId+=1,await this.persist(e,this.writeId)}async persist(e,n){const r=this.retryAttempt<fD.length,i=await this.storage.write(e,{willRetry:r});n===this.writeId&&(this.reportConfigError(),i==="unavailable"&&this.scheduleRetry(e,n))}scheduleRetry(e,n){const r=fD[this.retryAttempt];r!==void 0&&(this.cancelRetry(),this.retryAttempt+=1,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.persist(e,n)},r))}cancelRetry(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null)}reportConfigError(){if(this.rebuildWhenUnparseable||!this.configFileErrorAccessor)return;const e=this.storage.getConfigError();!e&&!this.configFileErrorAccessor.get()||this.configFileErrorAccessor.set(e)}}class Lke{constructor(e,n,r){this.storage=e,this.filePath=n,this.defaultValue=r}storage;filePath;defaultValue;async parse(e){return JSON.parse(e)}stringify(e){return JSON.stringify(e)}async read(){let e;try{e=await this.storage.get(this.filePath)}catch(n){return console.error(`Failed to read ${this.filePath}`,n),this.defaultValue}return e?await this.parse(e):this.defaultValue}async write(e){return this.storage.set(this.filePath,this.stringify(e))}}const DP=(t,e)=>({data:t,version:e});class n6 extends Lke{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return DP(this.defaultValue,this.version);const n=this.migrationMap[e.version](e);return n.version===this.version?n:this.migrate(n)}async parse(e){const n=JSON.parse(e);if(n.version!==this.version){const r=this.migrate(n);return await this.write(r.data),r.data}return n.data}stringify(e){return JSON.stringify(DP(e,this.version))}}const hD={activeTabIdx:0,tabs:[]};function Vke(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===De.Step?{...e,data:{...e.data,draftStep:{...e.data.step,security:e.data.step.security.securities},step:void 0,hasUnsavedChanges:void 0,showUnsavedChangesModal:void 0}}:e)},version:2}}function Wke(t){const e=Id();return{...e,...t,formData:{...e.formData,...t?.formData},graphql:{...e.graphql,...t?.graphql}}}const Y1=2,Xke="tabs.json";class qke extends n6{migrationMap={1:Vke};constructor(e){super(e,Xke,Ro(hD),Y1)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=DP(Ro(hD),Y1)),n.version!==Y1&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===De.Step){if(i.data.draftStep){i.data.draftStep.requestBody=Wke(i.data.draftStep.requestBody);const s=i.data.draftStep.requestBody.formData;s["multipart/form-data"]=await pD(s["multipart/form-data"]),s["application/x-www-form-urlencoded"]=await pD(s["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await Eg(i.data.draftStep.requestBody.binary.absolutePath))}return{...i,data:{...i.data,isProcessingRequest:!1}}}return i}));return{...n.data,tabs:r}}stringify(e){const n={...e,tabs:e.tabs.map(r=>{if(r.data.type===De.Step){const{isProcessingRequest:i,...s}=r.data;return{...r,data:{...s,response:null}}}return r.data.type===De.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function pD(t){return Promise.all(t.map(async e=>{const n={...e};if(e.files){const r=e.files.map(i=>i.absolutePath).filter(i=>i!==null);n.files=await lZ(r)}return n}))}const Zke=1;class r6{constructor(e,n,r,i,s,o,a){this.systemFilesStorage=e,this.userFilesStorage=n,this.project=r,this.isApiPersisted=i,this.environmentsPersistence=s,this.convertOperationToReplayValue=o,this.telemetry=a,this.localStorageSecretsProvider=new RCe(this.project.id);const l=new QCe;this.activeEnvironmentIdStorage=new n6(this.systemFilesStorage,"active_environment_id.json",Jd,Zke),this.tabsStateStorage=new qke(this.systemFilesStorage),this.environmentsStorage=new Mke(this.userFilesStorage,this.localStorageSecretsProvider,s),this.environmentsWriter=new zke(this.environmentsStorage,s.rebuildWhenUnparseable),this.collectionsStorage=new lPe(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new jCe(this.isApiPersisted?this.userFilesStorage:l)}systemFilesStorage;userFilesStorage;project;isApiPersisted;environmentsPersistence;convertOperationToReplayValue;telemetry;activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;localStorageSecretsProvider;persistExcludedIds=new Set;watchExcludedIds=new Set;environmentsWriter;setConfigFileErrorAccessor(e){this.environmentsWriter.setConfigFileErrorAccessor(e)}getEnvironmentsConfigError(){return this.environmentsStorage.getConfigError()}publishEnvironmentsConfigError(){this.environmentsWriter.publishConfigError()}writeActiveEnvironmentId(e){return this.activeEnvironmentIdStorage.write(e)}writeTabsState(e){return this.tabsStateStorage.write(e)}async writeApis(e){this.isApiPersisted&&await this.apisStorage.applyChanges(e)}async writeCollections(e){await this.collectionsStorage.applyChanges(e)}writeEnvironments(e){return this.environmentsWriter.write(e)}addPersistExcludedId(e){this.persistExcludedIds.add(e),this.userFilesStorage.setWriteExcludedKeys(new Set([...this.persistExcludedIds]))}removePersistExcludedId(e){this.persistExcludedIds.delete(e),this.userFilesStorage.setWriteExcludedKeys(new Set([...this.persistExcludedIds]))}addWatchExcludedId(e){this.watchExcludedIds.add(e)}removeWatchExcludedId(e){this.watchExcludedIds.delete(e)}isWatchExcluded(e){return this.watchExcludedIds.has(e)}}class Uke extends r6{constructor(e,n,r){const i=new IP(e.systemFilesDir),s=new IP(e.userFilesDir);super(i,s,e,!1,{filePaths:[ECe],basePath:[],rebuildWhenUnparseable:!0},n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[Oe("storageOperation","detectFiles","storage")],e?.parentCtx),i=(await this.userFilesStorage.ls()).filter(l=>/\.(ya?ml|json)$/.test(l)),s=[],o=[],a=new Set;return await Promise.all(i.map(async l=>{const c=await this.userFilesStorage.get(l);if(c)try{const u=Sl.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const f=await qt.resolve(await qt.join(this.userFilesStorage.baseDir,l)),{definition:h}=await gy(f,u);s.push({uri:l,type:ai.FS,content:h}),await xy(l)}else typeof u.arazzo=="string"&&(o.push({uri:l,type:ai.FS,content:u}),await xy(l),u.sourceDescriptions?.forEach(f=>{const h=f.type,p=f.url,m=!h||h==="openapi",g=typeof p=="string"&&Ki(p);m&&g&&a.add(p)}))}catch(u){console.info(`Error parsing YAML/JSON file ${l}:`,u),await by(l,u)}})),n?.setAttribute("status","completed"),n?.setAttribute("filesCount",i.length),n?.setAttribute("apiFilesCount",s.length),n?.setAttribute("collectionFilesCount",o.length),n?.setAttribute("apiUrlsCount",a.size),n?.setStatus(exports.SpanStatusCode.OK),n?.end(),{apiFiles:s,collectionFiles:o,apiUrls:a}}async loadApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.loadApis",[{...Oe("storageOperation","loadApis","storage"),apiUrlsCount:e.size}],n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async s=>{try{const{definition:o}=await gy(s);i.push({uri:s,type:ai.WEB,content:o})}catch(o){console.error(`Error parsing YAML from ${s}:`,o)}})),r?.setAttribute("status","completed"),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),i}async parseApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.parseApis",[{...Oe("storageOperation","parseApis","storage"),apisCount:e.length}],n?.parentCtx),i=await this.apisStorage.parseMany(e);return r?.setAttribute("status","completed"),r?.setAttribute("parsedApisCount",i.length),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),i}async parseCollections(e,n,r){const i=this.telemetry?.startSpan("com.redocly.storage.parseCollections",[{...Oe("storageOperation","parseCollections","storage"),collectionsCount:e.length}],r?.parentCtx),s=await this.collectionsStorage.parseMany(e,n);return i?.setAttribute("status","completed"),i?.setAttribute("parsedCollectionsCount",s.length),i?.setStatus(exports.SpanStatusCode.OK),i?.end(),s}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",[Oe("storageOperation","read","storage")],void 0),n=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[Oe("storageOperation","loadUserState","storage")],e?.parentCtx),[r,i,s]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);n?.setAttribute("status","completed"),n?.setAttribute("environmentCount",s.length),n?.setStatus(exports.SpanStatusCode.OK),n?.end();const{apiFiles:o,collectionFiles:a,apiUrls:l}=await this.detectProjectFiles(e),c=await this.loadApis(l,e),u=await this.parseApis([...o,...c],e),f=await this.parseCollections(a,u,e);return e?.setAttribute("status","completed"),e?.setStatus(exports.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:i,environments:s,apis:u,collections:f}}}function Bke(t,e){const n=new Map(t.map(i=>[i.id,i])),r=new Set(e.map(i=>i.id));return{written:e.filter(i=>n.get(i.id)!==i),removed:t.filter(i=>!r.has(i.id)).map(i=>i.id)}}function Fke(t,e){const n=new Map(t.map(i=>[i.id,i])),r=new Set(e.map(i=>i.id));return{written:e.filter(i=>{const s=n.get(i.id);return s!==i&&!fp(s,i)}),removed:t.filter(i=>!r.has(i.id)).map(i=>i.id)}}function i6(t=!1){let e,n,r=!1,i=Promise.resolve(),s=null,o=null,a=null,l=null,c=[],u=null,f=!1,h=null,p=null,m=[],g=[];function O(T){if(v(),!e)return;m=T.get(Ui),g=T.get(Ts);let $=!1;c.push(T.sub(Is,()=>{r||!e||e.writeActiveEnvironmentId(T.get(Is))}),T.sub(Cr,()=>{r||!e||f||e.writeEnvironments(T.get(Cr))}),T.sub(Ui,()=>{const _=T.get(Ui),D=Bke(m,_);m=_,!(r||!e)&&e.writeApis(D)}),T.sub(Ts,()=>{const _=T.get(Ts),D=Fke(g,_);g=_,!(r||!e)&&e.writeCollections(D)}),T.sub(Ir,E),T.sub(Ii,E));function E(){if(r||!e||$)return;$=!0;const _=e;queueMicrotask(()=>{$=!1,!(r||e!==_)&&_.writeTabsState({activeTabIdx:T.get(Ii),tabs:T.get(Ir)})})}}function v(){c.forEach(T=>T()),c=[]}function x(){l&&(l(),l=null)}async function y(T){if(!(!On()||!e||!a||!u||!h||!p)){await w();try{const{FileWatcher:$}=await Promise.resolve().then(()=>require("./replay-FileWatcher-CUqV5dPp.js")),E=a.get(py).userFilesDir;o=new $(e,E,T,u,h,p),await o.start()}catch($){console.error("Failed to start file watcher:",$),o=null}}}async function w(){o&&(await o.stop(),o=null)}async function S(){On()&&(await w(),await Ze("cleanup_all_managed_watchers"))}const k=async(T,$,E,_)=>{r=!0;try{const{convertOperationToReplayValue:D,aiEnabled:R}=$,M=On();if(a=E,x(),v(),t){E.set(Cr,[]);return}if(M){const{TauriRootStorage:z}=await Promise.resolve().then(()=>require("./replay-TauriRootStorage-BY7MGWGe.js"));n=new z(T,D,_),e=n}else n=void 0,e=new Uke(T,D,_);if(M){await w();const{getSemanticSearchService:z}=await Promise.resolve().then(()=>require("./replay-index-rbCwID24.js"));z().setProject(T.id)}u={get:()=>E.get(Cr),set:z=>{f=!0;try{E.set(Cr,z)}finally{f=!1}}},h={get:()=>E.get(Ui),set:z=>E.set(Ui,z)},p={get:()=>E.get(Ts),set:z=>E.set(Ts,z)},e.setConfigFileErrorAccessor({get:()=>E.get(my),set:z=>E.set(my,z)});const{project:L,activeEnvironmentId:V,environments:I,apis:q,collections:j,tabsState:X}=await e.read();if(E.set(py,L),E.set(Is,V),E.set(Cr,I),E.set(Ui,q),E.set(Ts,j),E.set(Ir,X.tabs),E.set(Ii,X.activeTabIdx),O(E),M&&e.publishEnvironmentsConfigError(),!M)return;if(await y(R??!1),R){const[{getSemanticSearchService:z},{createIndexSnapshotGetter:W,startPeriodicIndexRevalidation:B}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-rbCwID24.js")),Promise.resolve().then(()=>require("./replay-periodic-revalidation-KHXYhF4T.js"))]),F=z();F.preloadModel().catch(()=>{}),F.reindex(W(E)).catch(G=>{console.error("Semantic reindex failed:",G)}),l=B(F,E)}}finally{r=!1}};return{getTauriRootStorage:()=>n,cleanup:async()=>{s=null,x(),v(),await S()},init:async(T,$,E,_)=>{if(s&&s.store===E&&s.projectId===T.id)return s.run;const D=i,R=(async()=>(await D,k(T,$,E,_)))();i=R.then(()=>{},()=>{});const M={store:E,projectId:T.id,run:R};return s=M,R.catch(()=>{s===M&&(s=null)}),R}}}const Yke=i6(),s6=b.createContext(Yke),Gke=s6.Provider;function o6(){return b.useContext(s6)}const Hke="Fetching from URL...",Jke="Source updated",G1="Failed to re-fetch source";function Kke({sourceUrl:t,apiId:e}){const r=o6().getTauriRootStorage(),i=GT(),{loading:s,updateToast:o,dismissToast:a}=C3.useToast(),[l,c]=b.useState(!1),[u,f]=b.useState(!1),h=b.useRef(null);Vd(b.useId(),l),b.useEffect(()=>()=>{h.current&&a(h.current)},[a]);const p=b.useCallback(O=>{c(O)},[]),m=b.useCallback(()=>{c(!1)},[]),g=b.useCallback(async()=>{if(u)return;f(!0),c(!1);const O=s(Hke);h.current=O;try{if(!r)throw new Error(G1);const[v]=await r.loadAndParseApis([{absolute_path:t,relative_path:e}],void 0,!0);if(!v)throw new Error(G1);i(x=>x.some(y=>y.id===e)?x.map(y=>y.id===e?v:y):[...x,v]),o(O,{type:"success",title:Jke})}catch(v){const x=v instanceof Error?v.message:G1;o(O,{type:"error",title:x})}finally{h.current===O&&(h.current=null),f(!1)}},[e,i,u,s,t,r,o]);return d.jsx(xn,{trigger:"click",placement:"bottomRight",visible:l,onVisibleChange:p,content:d.jsx(eTe,{sourceUrl:t,onClose:m,onConfirm:g}),children:d.jsx(yn.Tooltip,{tip:"Re-fetch source",children:d.jsx(aTe,{children:d.jsx(me.Button,{variant:"text",size:"small",icon:d.jsx(P3.RenewIcon,{size:"14px"}),disabled:u})})})})}function eTe({sourceUrl:t,onClose:e,onConfirm:n}){return d.jsxs(tTe,{onClick:r=>r.stopPropagation(),children:[d.jsxs(nTe,{children:[d.jsxs(rTe,{children:[d.jsx(iTe,{children:d.jsx(ma.WarningFilledIcon,{size:"16px",color:"--color-warning-base"})}),d.jsx(Xn.Typography,{children:"Re-fetch source"})]}),d.jsx(Xn.Typography,{lineHeight:"var(--line-height-sm)",fontSize:"var(--font-size-sm)",fontWeight:"var(--font-weight-regular)",color:"var(--text-color-secondary)",children:"Downloads the latest file from the URL and replaces the stored version."}),d.jsx(sTe,{title:t,children:t})]}),d.jsxs(oTe,{children:[d.jsx(me.Button,{variant:"text",size:"small",onClick:e,children:"Cancel"}),d.jsx(me.Button,{variant:"primary",size:"small",onClick:n,children:"Re-fetch"})]})]})}const tTe=C.default.div`
1448
+ `,n)+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;const n=Wm(e),r=hu(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=Wm(e),r=hu(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.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())}}};function Oke(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new gke||null,prettyErrors:e}}function vke(t,e={}){const{lineCounter:n,prettyErrors:r}=Oke(e),i=new mke(n?.addNewLine),s=new uke(e);let o=null;for(const a of s.compose(i.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new ih(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(nD(t,n)),o.warnings.forEach(nD(t,n))),o}function xI(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function t6(t){return!Jt(t)||t.value==null?null:typeof t.value=="string"?t.value:xI(t.value)?t.source??String(t.value):null}function Z1(t,e){return t6(t)===e}function Dh(t){return Jt(t)&&t.value==null}function Wl(t){return t==null||Dh(t)||Pr(t)||t instanceof kt}function U1(t){return t==null||Pr(t)||Jt(t)&&(t.value==null||xI(t.value))}function yke(t){return Jt(t)&&typeof t.value=="string"}function Cs(t,e){return Pr(t.getIn(e,!0))}function bke(t){const{contents:e}=t;return e instanceof kt&&e.items.length===0&&!e.commentBefore&&!e.comment&&!t.commentBefore&&!t.comment}const xke="<<",lD="$ref";class Ske{constructor(e,n){this.providers=e,this.basePath=n}providers;basePath;sectionProblem(e){if(this.basePath.length===0){const s=e.contents;return Wl(s)?s instanceof kt?this.environmentsProblem(e,s,"environments"):null:"The environments store must be a map of environment names"}const n=this.basePath.join("."),r=this.parentProblem(e,n);if(r)return r;if(Cs(e,this.basePath))return null;if(this.hasRefAbove(e))return`Replay does not follow $ref, so it cannot manage the ${n} section here`;const i=e.getIn(this.basePath,!0);return Wl(i)?i instanceof kt?this.environmentsProblem(e,i,n):null:`The ${n} section must be a map of environment names`}environmentsProblem(e,n,r){const i=this.managedKeysProblem(n,r);if(i)return i;for(const s of n.items){const o=String(s.key);if(bl(o))continue;if(!Wl(s.value))return`Environment ${o} in ${r} must be a map`;if(!(s.value instanceof kt))continue;const a=this.environmentBodyProblem(e,o,s.value,r);if(a)return a}return null}environmentBodyProblem(e,n,r,i){const s=this.reservedKeysProblem(r,i);if(s)return s;const o=r.get("inputs",!0);if(!Wl(o))return`The inputs of ${n} in ${i} must be a map`;if(o instanceof kt){const l=`the inputs of ${n}`,c=this.managedKeysProblem(o,l);if(c)return c;for(const u of o.items)if(!U1(u.value)&&!(u.value instanceof kt&&this.isMarkerNode(e,u.value)))return`Input ${String(u.key)} of ${n} in ${i} must be a single value`}const a=r.get("servers",!0);if(!Wl(a))return`The servers of ${n} in ${i} must be a map`;if(a instanceof kt){const l=`the servers of ${n}`,c=this.managedKeysProblem(a,l);if(c)return c;for(const u of a.items){const f=this.serverBodyProblem(String(u.key),u.value,n,i);if(f)return f}}return null}serverBodyProblem(e,n,r,i){if(!Wl(n))return`Server ${e} of ${r} in ${i} must be a map`;if(!(n instanceof kt))return null;const s=this.reservedKeysProblem(n,`server ${e} of ${r}`);if(s)return s;const o=n.get("value",!0);if(!U1(o))return`The value of server ${e} of ${r} in ${i} must be a single value`;const a=n.get("variables",!0);if(!Wl(a))return`The variables of server ${e} of ${r} in ${i} must be a map`;if(a instanceof kt){const l=`the variables of server ${e} of ${r}`,c=this.managedKeysProblem(a,l);if(c)return c;for(const u of a.items)if(!U1(u.value))return`Variable ${String(u.key)} of server ${e} of ${r} in ${i} must be a single value`}return null}managedKeysProblem(e,n){const r=this.reservedKeysProblem(e,n);if(r)return r;for(const i of e.items)if(!yke(i.key))return`Replay reads only string keys, and ${n} holds ${String(i.key)}`;return null}reservedKeysProblem(e,n){return e.has(xke)?`Replay cannot read a merge key, and ${n} uses one`:e.has(lD)?`Replay does not follow $ref, and ${n} uses one`:null}isMarkerNode(e,n){try{return this.providers.resolveProviderForMarker(n.toJS(e))!==null}catch{return!1}}parentProblem(e,n){for(let r=1;r<this.basePath.length;r++){const i=this.basePath.slice(0,r),s=e.getIn(i,!0);if(s==null||Dh(s))return null;const o=i.join(".");if(Pr(s))return`The ${o} key is an alias, so Replay cannot manage the ${n} section inside it`;if(!(s instanceof kt))return`The ${o} key must be a map for Replay to manage the ${n} section`}return null}hasRefAbove(e){for(let n=1;n<=this.basePath.length;n++){const r=e.getIn(this.basePath.slice(0,n),!0);if(r instanceof kt&&r.has(lD))return!0}return!1}}const wke=new Set(["inputs","servers"]),Cke=new Set(["value","variables"]);class Pke{constructor(e,n=[]){this.providers=e,this.basePath=n,this.validator=new Ske(e,n)}providers;basePath;validator;hasSection(e){return this.basePath.length===0||e.hasIn(this.basePath)}sectionPath(...e){return[...this.basePath,...e]}leafText(e,n,r){const i=e.getIn(n,!0),s=Pr(i)?i.resolve(e):i;return t6(s)??(xI(r)?String(r):"")}extractEnvironments(e,n){const r=this.readSectionData(e);return r?Object.keys(r).filter(s=>!bl(s)).map(s=>{const o=r[s]??{},a=Object.entries(o.inputs??{}).map(([c,u])=>{const f=this.providers.resolveProviderForMarker(u);return f?{name:c,value:f.resolve(n,s,c),isSecret:!0}:{name:c,value:this.leafText(e,this.sectionPath(s,"inputs",c),u),isSecret:!1}}),l=Object.entries(o.servers??{}).map(([c,u])=>{const f=this.sectionPath(s,"servers",c);return{apiId:c,value:this.leafText(e,[...f,"value"],u?.value),variables:Object.entries(u?.variables??{}).map(([h,p])=>({name:h,value:this.leafText(e,[...f,"variables",h],p)}))}});return{name:s,inputs:a,servers:l,state:$t.Normal}}):[]}hydrateDocument(e,n,r){if(Cs(e,this.basePath))return e;for(let s=1;s<=this.basePath.length;s++){const o=this.basePath.slice(0,s);Dh(e.getIn(o,!0))&&e.setIn(o,this.createBlockMap(e))}const i=new Set(n.map(s=>s.name).filter(Boolean));this.deleteRemovedKeys(e,this.sectionPath(),i);for(const s of n){if(!s.name)continue;const o=this.sectionPath(s.name);Cs(e,o)||(e.hasIn(o)||this.ensureBlockMap(e,o),this.syncInputs(e,s.name,s.inputs,r),this.syncServers(e,s.name,s.servers))}return this.unflowSectionAncestors(e),e}removeSection(e){if(this.basePath.length!==0){e.deleteIn(this.basePath);for(let n=this.basePath.length-1;n>0;n--){const r=this.basePath.slice(0,n),i=e.getIn(r,!0);i instanceof kt&&i.items.length===0&&e.deleteIn(r)}}}sectionProblem(e){return this.validator.sectionProblem(e)}isSectionAliased(e){return this.basePath.length>0&&Cs(e,this.basePath)}hasEnvironments(e){const n=this.basePath.length===0?e.contents:e.getIn(this.basePath,!0);return n instanceof kt&&n.items.length>0}hasUnreadContent(e){const n=e.getIn(this.basePath,!0);return n instanceof kt?n.items.some(r=>this.environmentHoldsUnreadContent(r.value)):!1}environmentHoldsUnreadContent(e){return Pr(e)?!0:e instanceof kt?e.items.some(n=>{const r=String(n.key);return!wke.has(r)||Pr(n.value)?!0:r!=="servers"||!(n.value instanceof kt)?!1:n.value.items.some(i=>{const s=i.value;return Pr(s)?!0:s instanceof kt?s.items.some(o=>!Cke.has(String(o.key))):!1})}):!1}unflowSectionAncestors(e){for(let n=1;n<=this.basePath.length;n++){const r=e.getIn(this.basePath.slice(0,n),!0);r instanceof kt&&r.flow&&(r.flow=!1)}}readSectionData(e){if(this.basePath.length===0){const i=e.toJS();return i==null||typeof i!="object"||Array.isArray(i)?null:i}const n=e.getIn(this.basePath,!0);if(n==null||Dh(n))return null;if(!Pr(n)&&!(n instanceof kt))throw new Error(`Expected \`${this.basePath.join(".")}\` to be a map of environments`);const r=n.toJS(e);if(r==null)return null;if(typeof r!="object"||Array.isArray(r))throw new Error(`Expected \`${this.basePath.join(".")}\` to be a map of environments`);return r}syncInputs(e,n,r,i){const s=new Set(r.map(a=>a.name)),o=this.sectionPath(n,"inputs");if(!Cs(e,o)){this.deleteRemovedKeys(e,o,s),r.length>0&&this.ensureBlockMap(e,o);for(const a of r){const l=[...o,a.name];if(!Cs(e,l)){if(a.isSecret){const c=e.getIn(l,!0),u=c instanceof kt?c.toJS(e):e.getIn(l),f=this.providers.resolveProviderForMarker(u);f||e.setIn(l,e.createNode(this.providers.getDefaultProvider().createMarker())),(f??this.providers.getDefaultProvider()).store(i,n,a.name,a.value);continue}Z1(e.getIn(l,!0),a.value)||e.setIn(l,a.value)}}}}syncServers(e,n,r){const i=new Set(r.map(o=>o.apiId)),s=this.sectionPath(n,"servers");if(!Cs(e,s)){this.deleteRemovedKeys(e,s,i),r.length>0&&this.ensureBlockMap(e,s);for(const o of r){const a=[...s,o.apiId];if(Cs(e,a))continue;Dh(e.getIn(a,!0))&&e.setIn(a,this.createBlockMap(e));const l=[...a,"value"];!Cs(e,l)&&!Z1(e.getIn(l,!0),o.value)&&e.setIn(l,o.value);const c=[...a,"variables"];if(Cs(e,c))continue;const u=new Set(o.variables.map(f=>f.name));this.deleteRemovedKeys(e,c,u),o.variables.length>0&&this.ensureBlockMap(e,c);for(const f of o.variables){const h=[...c,f.name];Cs(e,h)||Z1(e.getIn(h,!0),f.value)||e.setIn(h,f.value)}}}}ensureBlockMap(e,n){for(let r=this.basePath.length+1;r<=n.length;r++){const i=n.slice(0,r),s=e.getIn(i,!0);if(s instanceof kt){s.flow=!1;continue}if(Pr(s))return;e.setIn(i,this.createBlockMap(e))}}createBlockMap(e){const n=e.createNode({});return n instanceof kt&&(n.flow=!1),n}deleteRemovedKeys(e,n,r){for(const i of this.getMapKeys(e,...n))!i.trim()||bl(i)||r.has(i)||e.deleteIn([...n,i])}getMapKeys(e,...n){const r=n.length===0?e.contents:e.getIn(n,!0);return r instanceof kt?r.items.map(i=>String(i.key)):[]}}class kke{id="local";isMarker(e){return typeof e=="object"&&e!==null&&"provider"in e&&e.provider===this.id}createMarker(){return{provider:this.id}}resolve(e,n,r){return e[n]?.[r]??""}store(e,n,r,i){e[n]||(e[n]={}),e[n][r]=i}}class Tke{constructor(e,n){this.defaultProviderId=n,this.providersById=new Map(e.map(r=>[r.id,r]))}defaultProviderId;providersById;getDefaultProvider(){const e=this.providersById.get(this.defaultProviderId);if(!e)throw new Error(`Missing default secrets provider strategy: ${this.defaultProviderId}`);return e}resolveProviderForMarker(e){return this.isProviderMarker(e)?this.providersById.get(e.provider)??this.getDefaultProvider():null}isProviderMarker(e){return typeof e=="object"&&e!==null&&"provider"in e&&typeof e.provider=="string"}}class $ke{constructor(e){this.storage=e}storage;async getAll(){return this.storage.getAll()}async set(e,n){await this.storage.set(e,n)}async clear(e){await this.storage.clear(e)}}class Ike{notifications=new Map;async getAll(){return Array.from(this.notifications.values())}async set(e,n){const r=n.filter(s=>s.severity==="error").length,i=n.filter(s=>s.severity==="warning").length;this.notifications.set(e,{id:e,source:e,issues:n,errorCount:r,warningCount:i})}async clear(e){this.notifications.delete(e)}}const Dg={all:["notifications"],lists:()=>[...Dg.all,"list"]};function Eke(){return qr.useQuery({queryKey:Dg.lists(),queryFn:async()=>Rp.getInstance().getAll()})}function Ake(){return qr.useQuery({queryKey:Dg.lists(),queryFn:async()=>Rp.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class Rp{static instance=null;static initialize(){this.close();const e=new Ike;this.instance=new $ke(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let B1=null;function o0(){return B1||(B1=new qr.QueryClient({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),B1}function Qke(t){const e=t.match(/\bline\s+(\d+)\b/i);if(!e)return;const n=Number.parseInt(e[1],10);return Number.isNaN(n)?void 0:n}function Rke(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:Qke(e)}]}function jke(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function SI(t){try{const e=Rp.getInstance();await t(e),o0().invalidateQueries({queryKey:Dg.all})}catch{}}async function by(t,e){await SI(async n=>{await n.set(t,Rke(e))})}async function _ke(t,e){e.length!==0&&await SI(async n=>{await n.set(t,jke(e))})}async function xy(t){await SI(async e=>{await e.clear(t)})}function cD(t){return F1(t,e=>e.name).map(e=>({...e,inputs:EC(e.inputs),servers:F1(e.servers,n=>n.apiId).map(n=>({...n,variables:F1(n.variables,r=>r.name)}))}))}function F1(t,e){const n=new Set,r=[];for(const i of t){const s=e(i);!Dke(s)||n.has(s)||(n.add(s),r.push(i))}return r}function Dke(t){return!!t.trim()&&!bl(t)}function Nke(t,e){return uD(t)===uD(e)}function uD(t){const e=(n,r)=>[...n].sort((i,s)=>r(i).localeCompare(r(s)));return JSON.stringify(e(t.filter(n=>n.name),n=>n.name).map(n=>[n.name,e(n.inputs,r=>r.name).map(r=>[r.name,r.value,r.isSecret]),e(n.servers,r=>r.apiId).map(r=>[r.apiId,r.value,e(r.variables,i=>i.name).map(i=>[i.name,i.value])])]))}function dD(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===Jd&&e.inputs.length===0&&e.servers.length===0}class Mke{constructor(e,n,r){this.storage=e,this.localStorageSecretsProvider=n,this.candidatePaths=r.filePaths,this.basePath=r.basePath,this.rebuildWhenUnparseable=r.rebuildWhenUnparseable,this.handler=new Pke(new Tke([new kke],"local"),r.basePath)}storage;localStorageSecretsProvider;configError=null;handler;candidatePaths;basePath;rebuildWhenUnparseable;pendingWrite=Promise.resolve();get isSection(){return this.basePath.length>0}getConfigError(){return this.configError}async read(){const e=this.pendingWrite.then(()=>this.readSection());return this.pendingWrite=e.then(()=>{},()=>{}),e}async write(e,{willRetry:n=!1}={}){const r=this.pendingWrite.then(()=>this.writeSection(e,n));return this.pendingWrite=r.catch(()=>{}),r}async readSection(){const e=await this.loadDocumentFromStorage();if(e.status==="unreadable")return await this.blockOn(e.filePath,e.error),[];if(e.status!=="ok")return[];try{const n=await this.readSecrets(),r=this.handler.extractEnvironments(e.document,n);return await this.clearNotifications(),r}catch(n){return console.info("Error reading replay environments",n),await this.blockOn(e.filePath,pu(n)),[]}}async writeSection(e,n){const r=await this.loadDocumentFromStorage(),i=await this.applyWrite(r,e,n);return(i==="written"||i==="unchanged"&&r.status==="ok")&&await this.clearNotifications(),i}async applyWrite(e,n,r){const i=cD(n);if(e.status==="unreadable"){if(!this.rebuildWhenUnparseable)return await this.reportUnavailable(e.filePath,e.error,"file",r),"unavailable"}else if(e.status==="invalid"&&!this.rebuildWhenUnparseable)return"blocked";const s=e.status==="ok"?e.document:null,o=await this.readSecrets();if(s&&this.isUnchanged(s,o,i))return"unchanged";if(s&&this.handler.isSectionAliased(s))return await this.blockOn(e.filePath,new Error(`The ${this.basePath.join(".")} section is an alias, so Replay cannot change it`)),"blocked";if(dD(i)){if(this.isSection){if(dD(n)){const a=await this.clearSection(e.filePath,s,r);if(a)return a}else if(!s||!this.handler.hasSection(s))return"unchanged"}else if(!s)return"unchanged"}return this.writeEnvironments(e.filePath,s,o,i,r)}async clearSection(e,n,r){if(!n||!this.handler.hasSection(n)||!this.handler.hasEnvironments(n))return"unchanged";if(this.handler.hasUnreadContent(n))return null;this.handler.removeSection(n);const i=await this.serialize(e,n,{allowEmptyFile:!0});return i===null?"blocked":this.store(e,i,r)}isUnchanged(e,n,r){try{return Nke(cD(this.handler.extractEnvironments(e,n)),r)}catch{return!1}}async writeEnvironments(e,n,r,i,s){let o;try{o=this.handler.hydrateDocument(n??new jg({}),i,r)}catch(l){return console.error(`Failed to update ${e}`,l),await this.blockOn(e,pu(l)),"blocked"}if(this.isSection&&!this.isUnchanged(o,r,i))return await this.blockOn(e,new Error(`Replay could not save the ${this.basePath.join(".")} section as edited`)),"blocked";const a=await this.serialize(e,o);if(a===null)return"blocked";try{await this.localStorageSecretsProvider.set(JSON.stringify(r))}catch(l){return await this.reportUnavailable(e,pu(l),"secrets",s),"unavailable"}return this.store(e,a,s)}async serialize(e,n,{allowEmptyFile:r=!1}={}){try{return r&&bke(n)?"":n.toString()}catch(i){return console.error(`Failed to serialize ${e}`,i),await this.blockOn(e,pu(i)),null}}async store(e,n,r){try{await this.storage.set(e,n)}catch(i){return await this.reportUnavailable(e,pu(i),"file",r),"unavailable"}return"written"}async blockOn(e,n){this.configError={filePath:e,issues:[{message:n.message}]},await by(e,n)}async reportUnavailable(e,n,r,i){const s=r==="secrets"?"the environment secrets":e;console.error(`Failed to save ${s}`,n);const o=i?" and will retry":"";await by(e,new Error(`Replay could not save ${s}${o}: ${n.message}`))}async loadDocumentFromStorage(){const e=await this.readActiveFile();if("error"in e)return console.error(`Failed to read ${e.filePath}`,e.error),{status:"unreadable",filePath:e.filePath,error:e.error};const{filePath:n,content:r}=e;if(!r)return this.configError=null,await this.clearNotifications(),{status:"absent",filePath:n};const i=vke(r);if(i.errors.length>0)return console.error("Environments file has YAML errors",i.errors),this.configError={filePath:n,issues:i.errors.map(o=>({message:o.message.trim(),line:o.linePos?.[0]?.line}))},await _ke(n,i.errors),{status:"invalid",filePath:n};this.configError=null;const s=this.handler.sectionProblem(i);return s?(await this.blockOn(n,new Error(s)),{status:"invalid",filePath:n}):{status:"ok",filePath:n,document:i}}async readActiveFile(){let e=null;for(const n of this.candidatePaths){let r;try{r=await this.storage.get(n)}catch(i){return{filePath:n,error:pu(i)}}if(r)return{filePath:n,content:r};r!==null&&e===null&&(e=n)}return{filePath:e??this.candidatePaths[0],content:null}}async clearNotifications(){await Promise.all(this.candidatePaths.map(e=>xy(e)))}async readSecrets(){const e=await this.localStorageSecretsProvider.get();if(!e)return{};try{return JSON.parse(e)}catch(n){return console.error("Failed to parse replay secrets sidecar",n),{}}}}function pu(t){return t instanceof Error?t:new Error(String(t))}const fD=[1e3,3e3,1e4];class zke{constructor(e,n){this.storage=e,this.rebuildWhenUnparseable=n}storage;rebuildWhenUnparseable;configFileErrorAccessor=null;retryAttempt=0;retryTimer=null;writeId=0;setConfigFileErrorAccessor(e){this.configFileErrorAccessor=e}publishConfigError(){this.configFileErrorAccessor?.set(this.storage.getConfigError())}async write(e){this.cancelRetry(),this.retryAttempt=0,this.writeId+=1,await this.persist(e,this.writeId)}async persist(e,n){const r=this.retryAttempt<fD.length,i=await this.storage.write(e,{willRetry:r});n===this.writeId&&(this.reportConfigError(),i==="unavailable"&&this.scheduleRetry(e,n))}scheduleRetry(e,n){const r=fD[this.retryAttempt];r!==void 0&&(this.cancelRetry(),this.retryAttempt+=1,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.persist(e,n)},r))}cancelRetry(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null)}reportConfigError(){if(this.rebuildWhenUnparseable||!this.configFileErrorAccessor)return;const e=this.storage.getConfigError();!e&&!this.configFileErrorAccessor.get()||this.configFileErrorAccessor.set(e)}}class Lke{constructor(e,n,r){this.storage=e,this.filePath=n,this.defaultValue=r}storage;filePath;defaultValue;async parse(e){return JSON.parse(e)}stringify(e){return JSON.stringify(e)}async read(){let e;try{e=await this.storage.get(this.filePath)}catch(n){return console.error(`Failed to read ${this.filePath}`,n),this.defaultValue}return e?await this.parse(e):this.defaultValue}async write(e){return this.storage.set(this.filePath,this.stringify(e))}}const DP=(t,e)=>({data:t,version:e});class n6 extends Lke{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return DP(this.defaultValue,this.version);const n=this.migrationMap[e.version](e);return n.version===this.version?n:this.migrate(n)}async parse(e){const n=JSON.parse(e);if(n.version!==this.version){const r=this.migrate(n);return await this.write(r.data),r.data}return n.data}stringify(e){return JSON.stringify(DP(e,this.version))}}const hD={activeTabIdx:0,tabs:[]};function Vke(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===De.Step?{...e,data:{...e.data,draftStep:{...e.data.step,security:e.data.step.security.securities},step:void 0,hasUnsavedChanges:void 0,showUnsavedChangesModal:void 0}}:e)},version:2}}function Wke(t){const e=Id();return{...e,...t,formData:{...e.formData,...t?.formData},graphql:{...e.graphql,...t?.graphql}}}const Y1=2,Xke="tabs.json";class qke extends n6{migrationMap={1:Vke};constructor(e){super(e,Xke,Ro(hD),Y1)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=DP(Ro(hD),Y1)),n.version!==Y1&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===De.Step){if(i.data.draftStep){i.data.draftStep.requestBody=Wke(i.data.draftStep.requestBody);const s=i.data.draftStep.requestBody.formData;s["multipart/form-data"]=await pD(s["multipart/form-data"]),s["application/x-www-form-urlencoded"]=await pD(s["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await Eg(i.data.draftStep.requestBody.binary.absolutePath))}return{...i,data:{...i.data,isProcessingRequest:!1}}}return i}));return{...n.data,tabs:r}}stringify(e){const n={...e,tabs:e.tabs.map(r=>{if(r.data.type===De.Step){const{isProcessingRequest:i,...s}=r.data;return{...r,data:{...s,response:null}}}return r.data.type===De.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function pD(t){return Promise.all(t.map(async e=>{const n={...e};if(e.files){const r=e.files.map(i=>i.absolutePath).filter(i=>i!==null);n.files=await lZ(r)}return n}))}const Zke=1;class r6{constructor(e,n,r,i,s,o,a){this.systemFilesStorage=e,this.userFilesStorage=n,this.project=r,this.isApiPersisted=i,this.environmentsPersistence=s,this.convertOperationToReplayValue=o,this.telemetry=a,this.localStorageSecretsProvider=new RCe(this.project.id);const l=new QCe;this.activeEnvironmentIdStorage=new n6(this.systemFilesStorage,"active_environment_id.json",Jd,Zke),this.tabsStateStorage=new qke(this.systemFilesStorage),this.environmentsStorage=new Mke(this.userFilesStorage,this.localStorageSecretsProvider,s),this.environmentsWriter=new zke(this.environmentsStorage,s.rebuildWhenUnparseable),this.collectionsStorage=new lPe(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new jCe(this.isApiPersisted?this.userFilesStorage:l)}systemFilesStorage;userFilesStorage;project;isApiPersisted;environmentsPersistence;convertOperationToReplayValue;telemetry;activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;localStorageSecretsProvider;persistExcludedIds=new Set;watchExcludedIds=new Set;environmentsWriter;setConfigFileErrorAccessor(e){this.environmentsWriter.setConfigFileErrorAccessor(e)}getEnvironmentsConfigError(){return this.environmentsStorage.getConfigError()}publishEnvironmentsConfigError(){this.environmentsWriter.publishConfigError()}writeActiveEnvironmentId(e){return this.activeEnvironmentIdStorage.write(e)}writeTabsState(e){return this.tabsStateStorage.write(e)}async writeApis(e){this.isApiPersisted&&await this.apisStorage.applyChanges(e)}async writeCollections(e){await this.collectionsStorage.applyChanges(e)}writeEnvironments(e){return this.environmentsWriter.write(e)}addPersistExcludedId(e){this.persistExcludedIds.add(e),this.userFilesStorage.setWriteExcludedKeys(new Set([...this.persistExcludedIds]))}removePersistExcludedId(e){this.persistExcludedIds.delete(e),this.userFilesStorage.setWriteExcludedKeys(new Set([...this.persistExcludedIds]))}addWatchExcludedId(e){this.watchExcludedIds.add(e)}removeWatchExcludedId(e){this.watchExcludedIds.delete(e)}isWatchExcluded(e){return this.watchExcludedIds.has(e)}}class Uke extends r6{constructor(e,n,r){const i=new IP(e.systemFilesDir),s=new IP(e.userFilesDir);super(i,s,e,!1,{filePaths:[ECe],basePath:[],rebuildWhenUnparseable:!0},n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[Oe("storageOperation","detectFiles","storage")],e?.parentCtx),i=(await this.userFilesStorage.ls()).filter(l=>/\.(ya?ml|json)$/.test(l)),s=[],o=[],a=new Set;return await Promise.all(i.map(async l=>{const c=await this.userFilesStorage.get(l);if(c)try{const u=Sl.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const f=await qt.resolve(await qt.join(this.userFilesStorage.baseDir,l)),{definition:h}=await gy(f,u);s.push({uri:l,type:ai.FS,content:h}),await xy(l)}else typeof u.arazzo=="string"&&(o.push({uri:l,type:ai.FS,content:u}),await xy(l),u.sourceDescriptions?.forEach(f=>{const h=f.type,p=f.url,m=!h||h==="openapi",g=typeof p=="string"&&Ki(p);m&&g&&a.add(p)}))}catch(u){console.info(`Error parsing YAML/JSON file ${l}:`,u),await by(l,u)}})),n?.setAttribute("status","completed"),n?.setAttribute("filesCount",i.length),n?.setAttribute("apiFilesCount",s.length),n?.setAttribute("collectionFilesCount",o.length),n?.setAttribute("apiUrlsCount",a.size),n?.setStatus(exports.SpanStatusCode.OK),n?.end(),{apiFiles:s,collectionFiles:o,apiUrls:a}}async loadApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.loadApis",[{...Oe("storageOperation","loadApis","storage"),apiUrlsCount:e.size}],n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async s=>{try{const{definition:o}=await gy(s);i.push({uri:s,type:ai.WEB,content:o})}catch(o){console.error(`Error parsing YAML from ${s}:`,o)}})),r?.setAttribute("status","completed"),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),i}async parseApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.parseApis",[{...Oe("storageOperation","parseApis","storage"),apisCount:e.length}],n?.parentCtx),i=await this.apisStorage.parseMany(e);return r?.setAttribute("status","completed"),r?.setAttribute("parsedApisCount",i.length),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),i}async parseCollections(e,n,r){const i=this.telemetry?.startSpan("com.redocly.storage.parseCollections",[{...Oe("storageOperation","parseCollections","storage"),collectionsCount:e.length}],r?.parentCtx),s=await this.collectionsStorage.parseMany(e,n);return i?.setAttribute("status","completed"),i?.setAttribute("parsedCollectionsCount",s.length),i?.setStatus(exports.SpanStatusCode.OK),i?.end(),s}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",[Oe("storageOperation","read","storage")],void 0),n=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[Oe("storageOperation","loadUserState","storage")],e?.parentCtx),[r,i,s]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);n?.setAttribute("status","completed"),n?.setAttribute("environmentCount",s.length),n?.setStatus(exports.SpanStatusCode.OK),n?.end();const{apiFiles:o,collectionFiles:a,apiUrls:l}=await this.detectProjectFiles(e),c=await this.loadApis(l,e),u=await this.parseApis([...o,...c],e),f=await this.parseCollections(a,u,e);return e?.setAttribute("status","completed"),e?.setStatus(exports.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:i,environments:s,apis:u,collections:f}}}function Bke(t,e){const n=new Map(t.map(i=>[i.id,i])),r=new Set(e.map(i=>i.id));return{written:e.filter(i=>n.get(i.id)!==i),removed:t.filter(i=>!r.has(i.id)).map(i=>i.id)}}function Fke(t,e){const n=new Map(t.map(i=>[i.id,i])),r=new Set(e.map(i=>i.id));return{written:e.filter(i=>{const s=n.get(i.id);return s!==i&&!fp(s,i)}),removed:t.filter(i=>!r.has(i.id)).map(i=>i.id)}}function i6(t=!1){let e,n,r=!1,i=Promise.resolve(),s=null,o=null,a=null,l=null,c=[],u=null,f=!1,h=null,p=null,m=[],g=[];function O(T){if(v(),!e)return;m=T.get(Ui),g=T.get(Ts);let $=!1;c.push(T.sub(Is,()=>{r||!e||e.writeActiveEnvironmentId(T.get(Is))}),T.sub(Cr,()=>{r||!e||f||e.writeEnvironments(T.get(Cr))}),T.sub(Ui,()=>{const _=T.get(Ui),D=Bke(m,_);m=_,!(r||!e)&&e.writeApis(D)}),T.sub(Ts,()=>{const _=T.get(Ts),D=Fke(g,_);g=_,!(r||!e)&&e.writeCollections(D)}),T.sub(Ir,E),T.sub(Ii,E));function E(){if(r||!e||$)return;$=!0;const _=e;queueMicrotask(()=>{$=!1,!(r||e!==_)&&_.writeTabsState({activeTabIdx:T.get(Ii),tabs:T.get(Ir)})})}}function v(){c.forEach(T=>T()),c=[]}function x(){l&&(l(),l=null)}async function y(T){if(!(!On()||!e||!a||!u||!h||!p)){await w();try{const{FileWatcher:$}=await Promise.resolve().then(()=>require("./replay-FileWatcher-BNFHO596.js")),E=a.get(py).userFilesDir;o=new $(e,E,T,u,h,p),await o.start()}catch($){console.error("Failed to start file watcher:",$),o=null}}}async function w(){o&&(await o.stop(),o=null)}async function S(){On()&&(await w(),await Ze("cleanup_all_managed_watchers"))}const k=async(T,$,E,_)=>{r=!0;try{const{convertOperationToReplayValue:D,aiEnabled:R}=$,M=On();if(a=E,x(),v(),t){E.set(Cr,[]);return}if(M){const{TauriRootStorage:z}=await Promise.resolve().then(()=>require("./replay-TauriRootStorage-DylcqkvS.js"));n=new z(T,D,_),e=n}else n=void 0,e=new Uke(T,D,_);if(M){await w();const{getSemanticSearchService:z}=await Promise.resolve().then(()=>require("./replay-index-_gr2NUI6.js"));z().setProject(T.id)}u={get:()=>E.get(Cr),set:z=>{f=!0;try{E.set(Cr,z)}finally{f=!1}}},h={get:()=>E.get(Ui),set:z=>E.set(Ui,z)},p={get:()=>E.get(Ts),set:z=>E.set(Ts,z)},e.setConfigFileErrorAccessor({get:()=>E.get(my),set:z=>E.set(my,z)});const{project:L,activeEnvironmentId:V,environments:I,apis:q,collections:j,tabsState:X}=await e.read();if(E.set(py,L),E.set(Is,V),E.set(Cr,I),E.set(Ui,q),E.set(Ts,j),E.set(Ir,X.tabs),E.set(Ii,X.activeTabIdx),O(E),M&&e.publishEnvironmentsConfigError(),!M)return;if(await y(R??!1),R){const[{getSemanticSearchService:z},{createIndexSnapshotGetter:W,startPeriodicIndexRevalidation:B}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-_gr2NUI6.js")),Promise.resolve().then(()=>require("./replay-periodic-revalidation--AI8Odct.js"))]),F=z();F.preloadModel().catch(()=>{}),F.reindex(W(E)).catch(G=>{console.error("Semantic reindex failed:",G)}),l=B(F,E)}}finally{r=!1}};return{getTauriRootStorage:()=>n,cleanup:async()=>{s=null,x(),v(),await S()},init:async(T,$,E,_)=>{if(s&&s.store===E&&s.projectId===T.id)return s.run;const D=i,R=(async()=>(await D,k(T,$,E,_)))();i=R.then(()=>{},()=>{});const M={store:E,projectId:T.id,run:R};return s=M,R.catch(()=>{s===M&&(s=null)}),R}}}const Yke=i6(),s6=b.createContext(Yke),Gke=s6.Provider;function o6(){return b.useContext(s6)}const Hke="Fetching from URL...",Jke="Source updated",G1="Failed to re-fetch source";function Kke({sourceUrl:t,apiId:e}){const r=o6().getTauriRootStorage(),i=GT(),{loading:s,updateToast:o,dismissToast:a}=C3.useToast(),[l,c]=b.useState(!1),[u,f]=b.useState(!1),h=b.useRef(null);Vd(b.useId(),l),b.useEffect(()=>()=>{h.current&&a(h.current)},[a]);const p=b.useCallback(O=>{c(O)},[]),m=b.useCallback(()=>{c(!1)},[]),g=b.useCallback(async()=>{if(u)return;f(!0),c(!1);const O=s(Hke);h.current=O;try{if(!r)throw new Error(G1);const[v]=await r.loadAndParseApis([{absolute_path:t,relative_path:e}],void 0,!0);if(!v)throw new Error(G1);i(x=>x.some(y=>y.id===e)?x.map(y=>y.id===e?v:y):[...x,v]),o(O,{type:"success",title:Jke})}catch(v){const x=v instanceof Error?v.message:G1;o(O,{type:"error",title:x})}finally{h.current===O&&(h.current=null),f(!1)}},[e,i,u,s,t,r,o]);return d.jsx(xn,{trigger:"click",placement:"bottomRight",visible:l,onVisibleChange:p,content:d.jsx(eTe,{sourceUrl:t,onClose:m,onConfirm:g}),children:d.jsx(yn.Tooltip,{tip:"Re-fetch source",children:d.jsx(aTe,{children:d.jsx(me.Button,{variant:"text",size:"small",icon:d.jsx(P3.RenewIcon,{size:"14px"}),disabled:u})})})})}function eTe({sourceUrl:t,onClose:e,onConfirm:n}){return d.jsxs(tTe,{onClick:r=>r.stopPropagation(),children:[d.jsxs(nTe,{children:[d.jsxs(rTe,{children:[d.jsx(iTe,{children:d.jsx(ma.WarningFilledIcon,{size:"16px",color:"--color-warning-base"})}),d.jsx(Xn.Typography,{children:"Re-fetch source"})]}),d.jsx(Xn.Typography,{lineHeight:"var(--line-height-sm)",fontSize:"var(--font-size-sm)",fontWeight:"var(--font-weight-regular)",color:"var(--text-color-secondary)",children:"Downloads the latest file from the URL and replaces the stored version."}),d.jsx(sTe,{title:t,children:t})]}),d.jsxs(oTe,{children:[d.jsx(me.Button,{variant:"text",size:"small",onClick:e,children:"Cancel"}),d.jsx(me.Button,{variant:"primary",size:"small",onClick:n,children:"Re-fetch"})]})]})}const tTe=C.default.div`
1449
1449
  display: flex;
1450
1450
  flex-direction: column;
1451
1451
  gap: var(--spacing-xxs);
@@ -2481,7 +2481,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
2481
2481
  border-top: none;
2482
2482
  overflow: auto;
2483
2483
  }
2484
- `;function u5e(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function k0(t,...e){if(!u5e(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function qN(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function d5e(t,e){k0(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Lp(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function CS(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function io(t,e){return t<<32-e|t>>>e}function f5e(t,e){return t<<e|t>>>32-e>>>0}const h5e=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",p5e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Vp(t){if(k0(t),h5e)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=p5e[t[n]];return e}function g5e(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function pB(t){return typeof t=="string"&&(t=g5e(t)),k0(t),t}class m5e{}function gB(t){const e=r=>t().update(pB(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function O5e(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),l=r?4:0,c=r?0:4;t.setUint32(e+l,o,r),t.setUint32(e+c,a,r)}function FP(t,e,n){return t&e^~t&n}function v5e(t,e,n){return t&e^t&n^e&n}class mB extends m5e{constructor(e,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=CS(this.buffer)}update(e){qN(this),e=pB(e),k0(e);const{view:n,buffer:r,blockLen:i}=this,s=e.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const l=CS(e);for(;i<=s-o;o+=i)this.process(l,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){qN(this),d5e(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,Lp(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let f=o;f<i;f++)n[f]=0;O5e(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=CS(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=l/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)a.setUint32(4*f,u[f],s)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:s,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=s,e.length=i,e.pos=a,i%n&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const qa=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),y5e=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),b5e=Math.pow(2,32),x5e=Array.from({length:64},(t,e)=>Math.floor(b5e*Math.abs(Math.sin(e+1)))),Jm=y5e.slice(0,4),PS=new Uint32Array(16);class S5e extends mB{constructor(){super(64,16,8,!0),this.A=Jm[0]|0,this.B=Jm[1]|0,this.C=Jm[2]|0,this.D=Jm[3]|0}get(){const{A:e,B:n,C:r,D:i}=this;return[e,n,r,i]}set(e,n,r,i){this.A=e|0,this.B=n|0,this.C=r|0,this.D=i|0}process(e,n){for(let a=0;a<16;a++,n+=4)PS[a]=e.getUint32(n,!0);let{A:r,B:i,C:s,D:o}=this;for(let a=0;a<64;a++){let l,c,u;a<16?(l=FP(i,s,o),c=a,u=[7,12,17,22]):a<32?(l=FP(o,i,s),c=(5*a+1)%16,u=[5,9,14,20]):a<48?(l=i^s^o,c=(3*a+5)%16,u=[4,11,16,23]):(l=s^(i|~o),c=7*a%16,u=[6,10,15,21]),l=l+r+x5e[a]+PS[c],r=o,o=s,s=i,i=i+f5e(l,u[a%4])}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,this.set(r,i,s,o)}roundClean(){Lp(PS)}destroy(){this.set(0,0,0,0),Lp(this.buffer)}}const T0=gB(()=>new S5e),w5e=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Za=new Uint32Array(64);class C5e extends mB{constructor(e=32){super(64,e,8,!1),this.A=qa[0]|0,this.B=qa[1]|0,this.C=qa[2]|0,this.D=qa[3]|0,this.E=qa[4]|0,this.F=qa[5]|0,this.G=qa[6]|0,this.H=qa[7]|0}get(){const{A:e,B:n,C:r,D:i,E:s,F:o,G:a,H:l}=this;return[e,n,r,i,s,o,a,l]}set(e,n,r,i,s,o,a,l){this.A=e|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=l|0}process(e,n){for(let f=0;f<16;f++,n+=4)Za[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const h=Za[f-15],p=Za[f-2],m=io(h,7)^io(h,18)^h>>>3,g=io(p,17)^io(p,19)^p>>>10;Za[f]=g+Za[f-7]+m+Za[f-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:l,G:c,H:u}=this;for(let f=0;f<64;f++){const h=io(a,6)^io(a,11)^io(a,25),p=u+h+FP(a,l,c)+w5e[f]+Za[f]|0,g=(io(r,2)^io(r,13)^io(r,22))+v5e(r,i,s)|0;u=c,c=l,l=a,a=o+p|0,o=s,s=i,i=r,r=p+g|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,i,s,o,a,l,c,u)}roundClean(){Lp(Za)}destroy(){this.set(0,0,0,0,0,0,0,0),Lp(this.buffer)}}const OB=gB(()=>new C5e);function P5e(t){const e=t.substring(7).split(", "),n={};for(const r of e){const[i,s]=r.split("=");n[i]=s.replace(/"/g,"")}return n}function k5e(t,e,n,r,i={}){const{inputs:s}=r,{requestBody:{content:o}}=t,{url:a,method:l}=Wb(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast($=>$.securityType===J.DigestAuth);if(!c)return"";const{username:u,password:f,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,opaque:x}=c[J.DigestAuth],y=ed(u,s,i),{pathname:w,search:S}=new URL(a),k=S?`${w}${S}`:w,T=T5e({username:y,password:ed(f,s,i),uri:k,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,method:l,bodyContent:ed(o,s,i)});return`Digest username="${y}", realm="${h}", nonce="${p}", uri="${k}", qop=${O}, nc=${v}, cnonce="${m}", response="${T}", algorithm=${g}${x?`, opaque="${x}"`:""}`}function T5e(t){const{username:e,password:n,realm:r,nonce:i,cnonce:s,algorithm:o,qop:a,nc:l,uri:c,method:u,bodyContent:f}=t,h=$5e(o),p=o?.endsWith("-sess")?h(`${h(`${e}:${r}:${n}`)}:${i}:${s}`):h(`${e}:${r}:${n}`),m=a?.includes("auth-int")?h(`${u}:${c}:${h(f)}`):h(`${u}:${c}`);return h(`${p}:${i}:${l}:${s}:${a}:${m}`).toString()}function $5e(t){return t?.replace("-sess","")==="SHA-256"?e=>Vp(OB(e)):e=>Vp(T0(e))}function YP(t){return new TextEncoder().encode(t)}function I5e(t){const e=new ArrayBuffer(t.length),n=new Uint8Array(e);for(let r=0,i=t.length;r<i;r++)n[r]=t.charCodeAt(r);return e}function E5e(t){return btoa(String.fromCharCode(...YP(t)))}function ZN(t){return btoa(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function A5e(t){return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}async function Q5e(t){const e=new TextEncoder().encode(t);return crypto?.subtle.digest("SHA-256",e)}function R5e(t){if(t)return btoa(String.fromCharCode.apply(null,new Uint8Array(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function j5e(t){try{const n=new URL(t).hostname;return n==="localhost"||n==="127.0.0.1"}catch{return!1}}function Iy(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function _5e(t){return t?t.split(";").map(r=>r.trim()).map(r=>{const i=r.indexOf("="),s=r.slice(0,i).trim(),o=r.slice(i+1).trim();return[s,o]}):[]}const D5e=["json","xml","html","text"],N5e=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function kS(t,e){return t.get(e)??t.get(e.toLowerCase())}function M5e(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function z5e(t){if(!t)return;const e=t.match(/filename\*=(?:UTF-8'')?([^;\n]+)/i);if(e?.[1])try{return decodeURIComponent(e[1].replace(/(^")|("$)/g,"").trim())}catch{return e[1].replace(/(^")|("$)/g,"").trim()}const n=t.match(/filename=([^;\n]+)/i);if(n?.[1])return n[1].replace(/(^")|("$)/g,"").trim()}function L5e(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function V5e(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return N5e.some(r=>n.includes(r))?!0:n.startsWith("application/")?!D5e.some(r=>n.includes(r)):!1}async function W5e(t,e){const n=kS(t.headers,"content-type")?.split(";")[0].trim(),r=kS(t.headers,"content-disposition"),i=M5e(kS(t.headers,"content-length")),s=V5e(n,r),o=_5e(document.cookie);if(s){const h={fileName:z5e(r)||L5e(t.url)||"response",contentType:n,contentLength:i,status:"pending"};return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:new ArrayBuffer(0),body:"",duration:e,cookies:o,size:i??0,download:h,bodyNotStored:!0,url:t.url}}const l=await t.clone().arrayBuffer(),c=new TextDecoder().decode(l),u=new Uint8Array(l).length;return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:l,body:c,duration:e,cookies:o,size:u,url:t.url}}const X5e=":/?#[]@!$&'()*+,;=",q5e=new Set(["!","'","(",")","*"]);function Z5e(t){return q5e.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function UN(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...X5e].map(i=>({char:i,encoded:Z5e(i)}));for(const{char:i,encoded:s}of r)n=n.split(s).join(i);return n}function U5e(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function B5e(t,e){const{exists:n}=await Promise.resolve().then(()=>Ub),{join:r}=await Promise.resolve().then(()=>wq),{baseName:i,extension:s}=U5e(e);let o=0;for(;;){const a=o===0?"":` (${o})`,l=`${i}${a}${s}`,c=await r(t,l);if(!await n(c))return c;o+=1}}function F5e(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}const lh=new Map;function Y5e(t){lh.get(t)?.abort()}function vB(t){return t?t instanceof FormData||t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function G5e(t){if(!vB(t))return t}function $0(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function yB(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL($0(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}async function bB({collections:t,selectedEnvironment:e,step:n,onStepChange:r,settings:i,workflow:s,onWorkflowChange:o,collection:a,signal:l}){const{corsProxyUrl:c,credentialOrigin:u,certificates:f}=i,h=await Mb(t,a?.id,s?.workflowId,_$(n,s,a,e)),{url:p,method:m}=Wb(n,s??void 0,a??void 0,e,h),g=c||"",O=CB(n,s,a,e,h),v=lDe(p,u),x=cDe({proxyUrl:g,resolvedUrl:p,ignoreProxy:v,queryParameters:O}),y=await J5e(n,s??void 0,x,u,l);let w=n,S=s??void 0;const k=a??void 0;y?.target==="step"?(w=Km(w,y),r(I=>Km(I,y))):y?.target==="workflow"&&S&&(S=Km(S,y),o?.(I=>Km(I,y)));const T=I0(w,S,k,e,h),$=G5e(YI(w,e,h)),{clientCert:E,clientKey:_}=Aq(p,f),D=$0(x),R=m.toUpperCase(),M=!Zd.includes(R),L=M?"POST":R,V=M?{...T,"X-HTTP-Method-Override":R}:T;return{urlWithProxyAndProtocol:D,fetchMethod:L,fetchHeaders:V,body:$,credentials:yB(D,u),mode:Iy(D)?"same-origin":"cors",clientCert:E,clientKey:_,resolvedUrl:p}}async function xB(t,e,n,r,i,s){const{tabId:o,updateData:a}=t,l=Ro(e.step);a(h=>({...h,isProcessingRequest:!0})),lh.get(o)?.abort();const c=new AbortController;lh.set(o,c);const{signal:u}=c,f=()=>lh.get(o)===c;try{const h=await bB({selectedEnvironment:r,settings:n,signal:u,...e}),p=Date.now(),m={signal:u,method:h.fetchMethod,headers:h.fetchHeaders,body:h.body,mode:h.mode,credentials:h.credentials,clientCert:h.clientCert,clientKey:h.clientKey},g=await Ao(h.urlWithProxyAndProtocol,m),O=Date.now()-p,v=await W5e(g,O);if(!f())return;a(y=>({...y,requestError:null,response:v}));const x=Ro(v);i?.(l,x),s?.({outcome:"success",status:v.status,duration:v.duration,size:v.size})}catch(h){if(!f()||(a(p=>({...p,response:null})),h.name==="AbortError"))return;a(p=>({...p,requestError:h.message||String(h)})),i?.(l,null),s?.({outcome:"error",error:h.message||String(h)})}finally{f()&&(lh.delete(o),a(h=>({...h,isProcessingRequest:!1})))}}async function H5e({selectedEnvironment:t,settings:e,fileName:n,onProgress:r,...i}){const s=await bB({selectedEnvironment:t,settings:e,...i}),o={method:s.fetchMethod,headers:s.fetchHeaders,body:s.body,mode:s.mode,credentials:s.credentials,clientCert:s.clientCert,clientKey:s.clientKey},{clientCert:a,clientKey:l}=o,c=On(),u=n||"response";let f=null;if(c){const{open:w}=await Promise.resolve().then(()=>require("./replay-index-Clfun2IN.js")),S=await w({directory:!0,multiple:!1});if(!S)return;const k=Array.isArray(S)?S[0]:S;f=await B5e(k,u)}const h=await Ao(s.urlWithProxyAndProtocol,o),p=h.headers.get("content-length"),m=p?Number.parseInt(p,10):void 0,g=Number.isFinite(m)?m:void 0,O=h.headers.get("content-type")??void 0;let v;if(h.body?.getReader){const w=h.body.getReader(),S=[];let k=0;for(;;){const{done:T,value:$}=await w.read();if(T)break;if($){const E=new Uint8Array($.byteLength);E.set($),S.push(E.buffer),k+=$.byteLength,r?.({receivedBytes:k,totalBytes:g,done:!1})}}v=new Blob(S,{type:O}),r?.({receivedBytes:k,totalBytes:g,done:!0})}else v=await h.blob(),r?.({receivedBytes:v.size,totalBytes:g,done:!0});if(c){const{writeFile:w}=await Promise.resolve().then(()=>Ub),S=new Uint8Array(await v.arrayBuffer());if(!f)return;await w(f,S);return}const x=window.URL.createObjectURL(v),y=document.createElement("a");y.href=x,y.download=u,y.rel="noopener",y.click(),window.URL.revokeObjectURL(x)}function Km(t,e){return{...t,security:t.security.map((n,r)=>r===e.index?{...n,[J.DigestAuth]:{...n[J.DigestAuth],...e.fields}}:n)}}async function J5e(t,e,n,r,i){const s=xl(t),o=e?.security??[],l=[...o,...t.security].findLastIndex(p=>p.securityType===J.DigestAuth);if(l===-1)return null;const c=$0(n),u=await Ao(c,{signal:i,method:s.toUpperCase(),credentials:yB(c,r),mode:Iy(c)?"same-origin":"cors"}),f=P5e(u.headers.get("WWW-Authenticate")||""),h=l<o.length;return{target:h?"workflow":"step",index:h?l:l-o.length,fields:{nonce:f.nonce,realm:f.realm,qop:f.qop,algorithm:f.algorithm,opaque:f.opaque,cnonce:crypto.randomUUID(),nc:"00000001"}}}function K5e(t,e,n,r,i){return[...e?.security||[],...t.security].map(s=>{switch(s.securityType){case J.BasicAuth:{const o=s[J.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+E5e(`${Rr(o.username,r,i)}:${Rr(o.password,r,i)}`),active:!0,in:"header"}}case J.DigestAuth:return{id:"",key:"Authorization",value:k5e(t,e,n,r,i),active:!0,in:"header"};case J.JWT:return{id:"",key:"Authorization",value:"Bearer "+s[J.JWT].token,active:!0,in:"header"};case J.OAuth2:{const{grantType:o}=s[J.OAuth2],{accessToken:a}=s[J.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case J.OpenIDConnect:{const{grantType:o}=s[J.OpenIDConnect],{accessToken:a}=s[J.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case J.APIKey:{const o=s[J.APIKey];return o.location===$i.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(s=>!!s)}function eDe(t,e,n){const{operation:r,requestBody:i,parameters:s}=e,{headers:o,cookies:a,queryParameters:l}=s;if(!n)return!0;const c=n.parameters??[],u=c.filter(w=>w.in==="query"),f=c.filter(w=>w.in==="header"),h=c.filter(w=>w.in==="cookie"),p=r?.path!==n.path,m=n.method.toLowerCase()!==r?.method.toLowerCase(),g=n.body?.mediaTypes&&n.body?.mediaTypes?.[i.type]===void 0,O=!f.every(w=>o.some(S=>!dc(S)&&S.key===w.name)),v=!h.every(w=>a.some(S=>!dc(S)&&S.key===w.name)),x=!u.every(w=>l.some(S=>!dc(S)&&S.key===w.name)),y=pxe(t,e,n);return!p&&!m&&!g&&!O&&!v&&!x&&!y}function FI(t,e,n={}){const{requestBody:r}=t,s=xl(t).toUpperCase();if(s==="GET"||s==="HEAD"||s==="OPTIONS")return null;try{switch(r.type){case gt.FormData:return rDe(t,e,n);case gt.UrlEncoded:return nDe(t,e,n);case gt.Binary:return r.binary;default:return Rr(r.content,e,n)}}catch(o){console.error(o)}}function YI(t,e,n={}){const{requestBody:r}=t,i=FI(t,e,n);if(i===null)return null;switch(r.type){default:return i;case gt.FormData:return iDe(i);case gt.UrlEncoded:return tDe(i);case gt.Binary:return r.binary?.file??null}}function tDe(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function nDe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[gt.UrlEncoded];return $B(s).forEach(o=>{const a=Rr(o.value,e,n);i.push({key:Rr(o.key,e,n),value:a,type:"text"})}),i}function rDe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[gt.FormData];return $B(s).forEach(({type:o,files:a,value:l,key:c})=>{const u=Rr(c,e,n);if(o==="file"&&a)for(const f of a)i.push({key:u,value:f,type:o});else if(l){const f=Rr(l,e,n);i.push({key:u,value:f,type:o})}}),i}function iDe(t){const e=new FormData;return t.forEach(({key:n,value:r,type:i})=>{i==="file"?e.append(n,r.file):r&&e.append(n,r)}),e}function SB(t,e,n){return t.filter(r=>{const{securityType:i,[J.APIKey]:s}=r;return i===J.APIKey&&s.location===e&&!!s.name}).map(r=>{const{[J.APIKey]:i}=r;return{id:"",key:i.name,value:i.key,active:!0,in:n}})}function BN(t=[]){return SB(t,$i.Query,"query")}function wB(t,e,n){const r=n?.components.parameters;return ll("query",[BN(e?.security),BN(t.security),vn(e?.parameters.queryParameters,r),vn(t.parameters.queryParameters,r)])}function CB(t,e,n,r,i={}){return wB(t,e,n).map(o=>{const a=Rr(o.value,r,i),l=UN(a,o.allowReserved);return`${UN(o.key)}=${l}`}).join("&")}function PB(t,e,n,r,i={}){return wB(t,e,n).reduce((o,a)=>{const l=Rr(a.value,r,i),c=Rr(a.key,r,i);return o[c]=l,o},{})}function kB(t){const e=t.split("?")[0],n=F5e(e),r=/^\{[^\s]+\}$/,i=n.filter(s=>r.test(s)).map(s=>s.slice(1,-1));return new Set(i)}function I0(t,e,n,r,i={}){const s=aDe(t,r,i),o=K5e(t,e,n,r,i),a=sDe(t,e,n,r,i),l=n?.components.parameters;return ll("header",[s,o,a,vn(e?.parameters.headers,l),vn(t.parameters.headers,l)]).reduce((f,{key:h,value:p})=>(f[h]=Rr(p,r,i),f),{})}function sDe(t,e,n,r,i={}){const o=TB(t,e,n).map(a=>`${a.key}=${Rr(a.value,r,i)}`).join("; ");return o?[{id:"",key:"Cookie",value:o,active:!0,in:"header"},{id:"",key:"X-Redocly-Cookie",value:o,active:!0,in:"header"}]:[]}function oDe(t,e,n,r,i={}){return TB(t,e,n).reduce((o,a)=>{const l=Rr(a.value,r,i);return{...o,[Rr(a.key,r,i)]:l}},{})}function FN(t=[]){return SB(t,$i.Cookie,"cookie")}function TB(t,e,n){const r=n?.components.parameters;return ll("cookie",[FN(e?.security),FN(t.security),vn(e?.parameters.cookies,r),vn(t.parameters.cookies,r)])}function $B(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function aDe(t,e,n={}){return new Set([gt.FormData]).has(t.requestBody.type)?[]:vB(YI(t,e,n))?[]:[{id:"",key:"Content-Type",value:t.requestBody.type,active:!0,in:"header"}]}function Rr(t,e,n={}){return ed(t,e?.inputs,n)}function lDe(t,e){return j5e(t)||Iy(t)||!!(e&&Iy($0(t),e))}function cDe({proxyUrl:t,resolvedUrl:e,ignoreProxy:n,queryParameters:r=""}){const i=t!=="/"?aP(t):t;let s;return n||!i?s=e:s=`${i}/${e}`,r&&(s+=`?${r}`),s}const uDe=({step:t,collectionId:e,workflowId:n})=>{const r=_b(),i=Ql({collectionId:e??null,workflowId:n??null}),s=xg(e??null),o=Dt(),a=o,l=b.useMemo(()=>_$(t,i,s,o),[t,i,s,o]),c=JSON.stringify(l),[u,f]=b.useState({});b.useEffect(()=>{let x=!1;return Mb(r(),e??void 0,n??void 0,l).then(y=>{x||f(y)}),()=>{x=!0}},[r,e,n,c]);const{url:h,method:p}=Wb(t,i??void 0,s??void 0,o,u),m=CB(t,i,s,a,u),g=dDe(t,i??void 0,s??void 0,a,u);let O=h+(m?`?${m}`:"");!O.startsWith("http://")&&!O.startsWith("https://")&&(O=`https://${O}`);const v=fDe(t,a,u);return{httpVersion:"HTTP/1.1",cookies:[],url:O,method:p,headers:g,postData:v}};function dDe(t,e,n,r,i){const s=I0(t,e??void 0,n??void 0,r,i);return Object.entries(s).filter(([a])=>a!=="X-Redocly-Cookie").map(([a,l])=>({name:a,value:l}))}function fDe(t,e,n){const r=FI(t,e,n),i=hDe(t.requestBody.type);if(r!==null)switch(i){case"multipart/form-data":{const o=r.map(({key:a,value:l})=>{if(typeof l=="string")return{name:a,value:l};const c=l,u=c?.absolutePath;return{name:a,fileName:u??void 0,contentType:c?c.file.type??"application/octet-stream":void 0}});return{mimeType:i,params:o}}case"application/x-www-form-urlencoded":{const o=r.map(({key:a,value:l})=>({name:a,value:l}));return{mimeType:i,params:o}}case"application/octet-stream":{const o=r?.absolutePath;return{mimeType:i,text:o?`@${o}`:void 0}}default:return{mimeType:i,text:r}}}function hDe(t){return t?t==="JSON"?"application/json":t:"text/plain"}const pDe=({onClose:t})=>{const{step:e,workflow:n,collection:r}=Zs(),i=Dt(),s=uDe({step:e,collectionId:r?.id,workflowId:n?.workflowId}),o=b.useMemo(()=>{const{inputs:a}=i;return a.filter(l=>l.isSecret&&l.value).map(l=>l.value)},[i]);return d.jsx(gDe,{title:"Generate code",isOpen:!0,onClose:t,content:d.jsx(i5e,{har:s,secretValues:o})})},gDe=C.default(cs)`
2484
+ `;function u5e(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function k0(t,...e){if(!u5e(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function qN(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function d5e(t,e){k0(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Lp(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function CS(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function io(t,e){return t<<32-e|t>>>e}function f5e(t,e){return t<<e|t>>>32-e>>>0}const h5e=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",p5e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Vp(t){if(k0(t),h5e)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=p5e[t[n]];return e}function g5e(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function pB(t){return typeof t=="string"&&(t=g5e(t)),k0(t),t}class m5e{}function gB(t){const e=r=>t().update(pB(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function O5e(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),l=r?4:0,c=r?0:4;t.setUint32(e+l,o,r),t.setUint32(e+c,a,r)}function FP(t,e,n){return t&e^~t&n}function v5e(t,e,n){return t&e^t&n^e&n}class mB extends m5e{constructor(e,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=CS(this.buffer)}update(e){qN(this),e=pB(e),k0(e);const{view:n,buffer:r,blockLen:i}=this,s=e.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const l=CS(e);for(;i<=s-o;o+=i)this.process(l,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){qN(this),d5e(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,Lp(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let f=o;f<i;f++)n[f]=0;O5e(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=CS(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=l/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)a.setUint32(4*f,u[f],s)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:s,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=s,e.length=i,e.pos=a,i%n&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const qa=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),y5e=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),b5e=Math.pow(2,32),x5e=Array.from({length:64},(t,e)=>Math.floor(b5e*Math.abs(Math.sin(e+1)))),Jm=y5e.slice(0,4),PS=new Uint32Array(16);class S5e extends mB{constructor(){super(64,16,8,!0),this.A=Jm[0]|0,this.B=Jm[1]|0,this.C=Jm[2]|0,this.D=Jm[3]|0}get(){const{A:e,B:n,C:r,D:i}=this;return[e,n,r,i]}set(e,n,r,i){this.A=e|0,this.B=n|0,this.C=r|0,this.D=i|0}process(e,n){for(let a=0;a<16;a++,n+=4)PS[a]=e.getUint32(n,!0);let{A:r,B:i,C:s,D:o}=this;for(let a=0;a<64;a++){let l,c,u;a<16?(l=FP(i,s,o),c=a,u=[7,12,17,22]):a<32?(l=FP(o,i,s),c=(5*a+1)%16,u=[5,9,14,20]):a<48?(l=i^s^o,c=(3*a+5)%16,u=[4,11,16,23]):(l=s^(i|~o),c=7*a%16,u=[6,10,15,21]),l=l+r+x5e[a]+PS[c],r=o,o=s,s=i,i=i+f5e(l,u[a%4])}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,this.set(r,i,s,o)}roundClean(){Lp(PS)}destroy(){this.set(0,0,0,0),Lp(this.buffer)}}const T0=gB(()=>new S5e),w5e=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Za=new Uint32Array(64);class C5e extends mB{constructor(e=32){super(64,e,8,!1),this.A=qa[0]|0,this.B=qa[1]|0,this.C=qa[2]|0,this.D=qa[3]|0,this.E=qa[4]|0,this.F=qa[5]|0,this.G=qa[6]|0,this.H=qa[7]|0}get(){const{A:e,B:n,C:r,D:i,E:s,F:o,G:a,H:l}=this;return[e,n,r,i,s,o,a,l]}set(e,n,r,i,s,o,a,l){this.A=e|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=l|0}process(e,n){for(let f=0;f<16;f++,n+=4)Za[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const h=Za[f-15],p=Za[f-2],m=io(h,7)^io(h,18)^h>>>3,g=io(p,17)^io(p,19)^p>>>10;Za[f]=g+Za[f-7]+m+Za[f-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:l,G:c,H:u}=this;for(let f=0;f<64;f++){const h=io(a,6)^io(a,11)^io(a,25),p=u+h+FP(a,l,c)+w5e[f]+Za[f]|0,g=(io(r,2)^io(r,13)^io(r,22))+v5e(r,i,s)|0;u=c,c=l,l=a,a=o+p|0,o=s,s=i,i=r,r=p+g|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,i,s,o,a,l,c,u)}roundClean(){Lp(Za)}destroy(){this.set(0,0,0,0,0,0,0,0),Lp(this.buffer)}}const OB=gB(()=>new C5e);function P5e(t){const e=t.substring(7).split(", "),n={};for(const r of e){const[i,s]=r.split("=");n[i]=s.replace(/"/g,"")}return n}function k5e(t,e,n,r,i={}){const{inputs:s}=r,{requestBody:{content:o}}=t,{url:a,method:l}=Wb(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast($=>$.securityType===J.DigestAuth);if(!c)return"";const{username:u,password:f,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,opaque:x}=c[J.DigestAuth],y=ed(u,s,i),{pathname:w,search:S}=new URL(a),k=S?`${w}${S}`:w,T=T5e({username:y,password:ed(f,s,i),uri:k,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,method:l,bodyContent:ed(o,s,i)});return`Digest username="${y}", realm="${h}", nonce="${p}", uri="${k}", qop=${O}, nc=${v}, cnonce="${m}", response="${T}", algorithm=${g}${x?`, opaque="${x}"`:""}`}function T5e(t){const{username:e,password:n,realm:r,nonce:i,cnonce:s,algorithm:o,qop:a,nc:l,uri:c,method:u,bodyContent:f}=t,h=$5e(o),p=o?.endsWith("-sess")?h(`${h(`${e}:${r}:${n}`)}:${i}:${s}`):h(`${e}:${r}:${n}`),m=a?.includes("auth-int")?h(`${u}:${c}:${h(f)}`):h(`${u}:${c}`);return h(`${p}:${i}:${l}:${s}:${a}:${m}`).toString()}function $5e(t){return t?.replace("-sess","")==="SHA-256"?e=>Vp(OB(e)):e=>Vp(T0(e))}function YP(t){return new TextEncoder().encode(t)}function I5e(t){const e=new ArrayBuffer(t.length),n=new Uint8Array(e);for(let r=0,i=t.length;r<i;r++)n[r]=t.charCodeAt(r);return e}function E5e(t){return btoa(String.fromCharCode(...YP(t)))}function ZN(t){return btoa(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function A5e(t){return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}async function Q5e(t){const e=new TextEncoder().encode(t);return crypto?.subtle.digest("SHA-256",e)}function R5e(t){if(t)return btoa(String.fromCharCode.apply(null,new Uint8Array(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function j5e(t){try{const n=new URL(t).hostname;return n==="localhost"||n==="127.0.0.1"}catch{return!1}}function Iy(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function _5e(t){return t?t.split(";").map(r=>r.trim()).map(r=>{const i=r.indexOf("="),s=r.slice(0,i).trim(),o=r.slice(i+1).trim();return[s,o]}):[]}const D5e=["json","xml","html","text"],N5e=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function kS(t,e){return t.get(e)??t.get(e.toLowerCase())}function M5e(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function z5e(t){if(!t)return;const e=t.match(/filename\*=(?:UTF-8'')?([^;\n]+)/i);if(e?.[1])try{return decodeURIComponent(e[1].replace(/(^")|("$)/g,"").trim())}catch{return e[1].replace(/(^")|("$)/g,"").trim()}const n=t.match(/filename=([^;\n]+)/i);if(n?.[1])return n[1].replace(/(^")|("$)/g,"").trim()}function L5e(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function V5e(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return N5e.some(r=>n.includes(r))?!0:n.startsWith("application/")?!D5e.some(r=>n.includes(r)):!1}async function W5e(t,e){const n=kS(t.headers,"content-type")?.split(";")[0].trim(),r=kS(t.headers,"content-disposition"),i=M5e(kS(t.headers,"content-length")),s=V5e(n,r),o=_5e(document.cookie);if(s){const h={fileName:z5e(r)||L5e(t.url)||"response",contentType:n,contentLength:i,status:"pending"};return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:new ArrayBuffer(0),body:"",duration:e,cookies:o,size:i??0,download:h,bodyNotStored:!0,url:t.url}}const l=await t.clone().arrayBuffer(),c=new TextDecoder().decode(l),u=new Uint8Array(l).length;return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:l,body:c,duration:e,cookies:o,size:u,url:t.url}}const X5e=":/?#[]@!$&'()*+,;=",q5e=new Set(["!","'","(",")","*"]);function Z5e(t){return q5e.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function UN(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...X5e].map(i=>({char:i,encoded:Z5e(i)}));for(const{char:i,encoded:s}of r)n=n.split(s).join(i);return n}function U5e(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function B5e(t,e){const{exists:n}=await Promise.resolve().then(()=>Ub),{join:r}=await Promise.resolve().then(()=>wq),{baseName:i,extension:s}=U5e(e);let o=0;for(;;){const a=o===0?"":` (${o})`,l=`${i}${a}${s}`,c=await r(t,l);if(!await n(c))return c;o+=1}}function F5e(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}const lh=new Map;function Y5e(t){lh.get(t)?.abort()}function vB(t){return t?t instanceof FormData||t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function G5e(t){if(!vB(t))return t}function $0(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function yB(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL($0(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}async function bB({collections:t,selectedEnvironment:e,step:n,onStepChange:r,settings:i,workflow:s,onWorkflowChange:o,collection:a,signal:l}){const{corsProxyUrl:c,credentialOrigin:u,certificates:f}=i,h=await Mb(t,a?.id,s?.workflowId,_$(n,s,a,e)),{url:p,method:m}=Wb(n,s??void 0,a??void 0,e,h),g=c||"",O=CB(n,s,a,e,h),v=lDe(p,u),x=cDe({proxyUrl:g,resolvedUrl:p,ignoreProxy:v,queryParameters:O}),y=await J5e(n,s??void 0,x,u,l);let w=n,S=s??void 0;const k=a??void 0;y?.target==="step"?(w=Km(w,y),r(I=>Km(I,y))):y?.target==="workflow"&&S&&(S=Km(S,y),o?.(I=>Km(I,y)));const T=I0(w,S,k,e,h),$=G5e(YI(w,e,h)),{clientCert:E,clientKey:_}=Aq(p,f),D=$0(x),R=m.toUpperCase(),M=!Zd.includes(R),L=M?"POST":R,V=M?{...T,"X-HTTP-Method-Override":R}:T;return{urlWithProxyAndProtocol:D,fetchMethod:L,fetchHeaders:V,body:$,credentials:yB(D,u),mode:Iy(D)?"same-origin":"cors",clientCert:E,clientKey:_,resolvedUrl:p}}async function xB(t,e,n,r,i,s){const{tabId:o,updateData:a}=t,l=Ro(e.step);a(h=>({...h,isProcessingRequest:!0})),lh.get(o)?.abort();const c=new AbortController;lh.set(o,c);const{signal:u}=c,f=()=>lh.get(o)===c;try{const h=await bB({selectedEnvironment:r,settings:n,signal:u,...e}),p=Date.now(),m={signal:u,method:h.fetchMethod,headers:h.fetchHeaders,body:h.body,mode:h.mode,credentials:h.credentials,clientCert:h.clientCert,clientKey:h.clientKey},g=await Ao(h.urlWithProxyAndProtocol,m),O=Date.now()-p,v=await W5e(g,O);if(!f())return;a(y=>({...y,requestError:null,response:v}));const x=Ro(v);i?.(l,x),s?.({outcome:"success",status:v.status,duration:v.duration,size:v.size})}catch(h){if(!f()||(a(p=>({...p,response:null})),h.name==="AbortError"))return;a(p=>({...p,requestError:h.message||String(h)})),i?.(l,null),s?.({outcome:"error",error:h.message||String(h)})}finally{f()&&(lh.delete(o),a(h=>({...h,isProcessingRequest:!1})))}}async function H5e({selectedEnvironment:t,settings:e,fileName:n,onProgress:r,...i}){const s=await bB({selectedEnvironment:t,settings:e,...i}),o={method:s.fetchMethod,headers:s.fetchHeaders,body:s.body,mode:s.mode,credentials:s.credentials,clientCert:s.clientCert,clientKey:s.clientKey},{clientCert:a,clientKey:l}=o,c=On(),u=n||"response";let f=null;if(c){const{open:w}=await Promise.resolve().then(()=>require("./replay-index-kTnSyklR.js")),S=await w({directory:!0,multiple:!1});if(!S)return;const k=Array.isArray(S)?S[0]:S;f=await B5e(k,u)}const h=await Ao(s.urlWithProxyAndProtocol,o),p=h.headers.get("content-length"),m=p?Number.parseInt(p,10):void 0,g=Number.isFinite(m)?m:void 0,O=h.headers.get("content-type")??void 0;let v;if(h.body?.getReader){const w=h.body.getReader(),S=[];let k=0;for(;;){const{done:T,value:$}=await w.read();if(T)break;if($){const E=new Uint8Array($.byteLength);E.set($),S.push(E.buffer),k+=$.byteLength,r?.({receivedBytes:k,totalBytes:g,done:!1})}}v=new Blob(S,{type:O}),r?.({receivedBytes:k,totalBytes:g,done:!0})}else v=await h.blob(),r?.({receivedBytes:v.size,totalBytes:g,done:!0});if(c){const{writeFile:w}=await Promise.resolve().then(()=>Ub),S=new Uint8Array(await v.arrayBuffer());if(!f)return;await w(f,S);return}const x=window.URL.createObjectURL(v),y=document.createElement("a");y.href=x,y.download=u,y.rel="noopener",y.click(),window.URL.revokeObjectURL(x)}function Km(t,e){return{...t,security:t.security.map((n,r)=>r===e.index?{...n,[J.DigestAuth]:{...n[J.DigestAuth],...e.fields}}:n)}}async function J5e(t,e,n,r,i){const s=xl(t),o=e?.security??[],l=[...o,...t.security].findLastIndex(p=>p.securityType===J.DigestAuth);if(l===-1)return null;const c=$0(n),u=await Ao(c,{signal:i,method:s.toUpperCase(),credentials:yB(c,r),mode:Iy(c)?"same-origin":"cors"}),f=P5e(u.headers.get("WWW-Authenticate")||""),h=l<o.length;return{target:h?"workflow":"step",index:h?l:l-o.length,fields:{nonce:f.nonce,realm:f.realm,qop:f.qop,algorithm:f.algorithm,opaque:f.opaque,cnonce:crypto.randomUUID(),nc:"00000001"}}}function K5e(t,e,n,r,i){return[...e?.security||[],...t.security].map(s=>{switch(s.securityType){case J.BasicAuth:{const o=s[J.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+E5e(`${Rr(o.username,r,i)}:${Rr(o.password,r,i)}`),active:!0,in:"header"}}case J.DigestAuth:return{id:"",key:"Authorization",value:k5e(t,e,n,r,i),active:!0,in:"header"};case J.JWT:return{id:"",key:"Authorization",value:"Bearer "+s[J.JWT].token,active:!0,in:"header"};case J.OAuth2:{const{grantType:o}=s[J.OAuth2],{accessToken:a}=s[J.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case J.OpenIDConnect:{const{grantType:o}=s[J.OpenIDConnect],{accessToken:a}=s[J.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case J.APIKey:{const o=s[J.APIKey];return o.location===$i.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(s=>!!s)}function eDe(t,e,n){const{operation:r,requestBody:i,parameters:s}=e,{headers:o,cookies:a,queryParameters:l}=s;if(!n)return!0;const c=n.parameters??[],u=c.filter(w=>w.in==="query"),f=c.filter(w=>w.in==="header"),h=c.filter(w=>w.in==="cookie"),p=r?.path!==n.path,m=n.method.toLowerCase()!==r?.method.toLowerCase(),g=n.body?.mediaTypes&&n.body?.mediaTypes?.[i.type]===void 0,O=!f.every(w=>o.some(S=>!dc(S)&&S.key===w.name)),v=!h.every(w=>a.some(S=>!dc(S)&&S.key===w.name)),x=!u.every(w=>l.some(S=>!dc(S)&&S.key===w.name)),y=pxe(t,e,n);return!p&&!m&&!g&&!O&&!v&&!x&&!y}function FI(t,e,n={}){const{requestBody:r}=t,s=xl(t).toUpperCase();if(s==="GET"||s==="HEAD"||s==="OPTIONS")return null;try{switch(r.type){case gt.FormData:return rDe(t,e,n);case gt.UrlEncoded:return nDe(t,e,n);case gt.Binary:return r.binary;default:return Rr(r.content,e,n)}}catch(o){console.error(o)}}function YI(t,e,n={}){const{requestBody:r}=t,i=FI(t,e,n);if(i===null)return null;switch(r.type){default:return i;case gt.FormData:return iDe(i);case gt.UrlEncoded:return tDe(i);case gt.Binary:return r.binary?.file??null}}function tDe(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function nDe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[gt.UrlEncoded];return $B(s).forEach(o=>{const a=Rr(o.value,e,n);i.push({key:Rr(o.key,e,n),value:a,type:"text"})}),i}function rDe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[gt.FormData];return $B(s).forEach(({type:o,files:a,value:l,key:c})=>{const u=Rr(c,e,n);if(o==="file"&&a)for(const f of a)i.push({key:u,value:f,type:o});else if(l){const f=Rr(l,e,n);i.push({key:u,value:f,type:o})}}),i}function iDe(t){const e=new FormData;return t.forEach(({key:n,value:r,type:i})=>{i==="file"?e.append(n,r.file):r&&e.append(n,r)}),e}function SB(t,e,n){return t.filter(r=>{const{securityType:i,[J.APIKey]:s}=r;return i===J.APIKey&&s.location===e&&!!s.name}).map(r=>{const{[J.APIKey]:i}=r;return{id:"",key:i.name,value:i.key,active:!0,in:n}})}function BN(t=[]){return SB(t,$i.Query,"query")}function wB(t,e,n){const r=n?.components.parameters;return ll("query",[BN(e?.security),BN(t.security),vn(e?.parameters.queryParameters,r),vn(t.parameters.queryParameters,r)])}function CB(t,e,n,r,i={}){return wB(t,e,n).map(o=>{const a=Rr(o.value,r,i),l=UN(a,o.allowReserved);return`${UN(o.key)}=${l}`}).join("&")}function PB(t,e,n,r,i={}){return wB(t,e,n).reduce((o,a)=>{const l=Rr(a.value,r,i),c=Rr(a.key,r,i);return o[c]=l,o},{})}function kB(t){const e=t.split("?")[0],n=F5e(e),r=/^\{[^\s]+\}$/,i=n.filter(s=>r.test(s)).map(s=>s.slice(1,-1));return new Set(i)}function I0(t,e,n,r,i={}){const s=aDe(t,r,i),o=K5e(t,e,n,r,i),a=sDe(t,e,n,r,i),l=n?.components.parameters;return ll("header",[s,o,a,vn(e?.parameters.headers,l),vn(t.parameters.headers,l)]).reduce((f,{key:h,value:p})=>(f[h]=Rr(p,r,i),f),{})}function sDe(t,e,n,r,i={}){const o=TB(t,e,n).map(a=>`${a.key}=${Rr(a.value,r,i)}`).join("; ");return o?[{id:"",key:"Cookie",value:o,active:!0,in:"header"},{id:"",key:"X-Redocly-Cookie",value:o,active:!0,in:"header"}]:[]}function oDe(t,e,n,r,i={}){return TB(t,e,n).reduce((o,a)=>{const l=Rr(a.value,r,i);return{...o,[Rr(a.key,r,i)]:l}},{})}function FN(t=[]){return SB(t,$i.Cookie,"cookie")}function TB(t,e,n){const r=n?.components.parameters;return ll("cookie",[FN(e?.security),FN(t.security),vn(e?.parameters.cookies,r),vn(t.parameters.cookies,r)])}function $B(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function aDe(t,e,n={}){return new Set([gt.FormData]).has(t.requestBody.type)?[]:vB(YI(t,e,n))?[]:[{id:"",key:"Content-Type",value:t.requestBody.type,active:!0,in:"header"}]}function Rr(t,e,n={}){return ed(t,e?.inputs,n)}function lDe(t,e){return j5e(t)||Iy(t)||!!(e&&Iy($0(t),e))}function cDe({proxyUrl:t,resolvedUrl:e,ignoreProxy:n,queryParameters:r=""}){const i=t!=="/"?aP(t):t;let s;return n||!i?s=e:s=`${i}/${e}`,r&&(s+=`?${r}`),s}const uDe=({step:t,collectionId:e,workflowId:n})=>{const r=_b(),i=Ql({collectionId:e??null,workflowId:n??null}),s=xg(e??null),o=Dt(),a=o,l=b.useMemo(()=>_$(t,i,s,o),[t,i,s,o]),c=JSON.stringify(l),[u,f]=b.useState({});b.useEffect(()=>{let x=!1;return Mb(r(),e??void 0,n??void 0,l).then(y=>{x||f(y)}),()=>{x=!0}},[r,e,n,c]);const{url:h,method:p}=Wb(t,i??void 0,s??void 0,o,u),m=CB(t,i,s,a,u),g=dDe(t,i??void 0,s??void 0,a,u);let O=h+(m?`?${m}`:"");!O.startsWith("http://")&&!O.startsWith("https://")&&(O=`https://${O}`);const v=fDe(t,a,u);return{httpVersion:"HTTP/1.1",cookies:[],url:O,method:p,headers:g,postData:v}};function dDe(t,e,n,r,i){const s=I0(t,e??void 0,n??void 0,r,i);return Object.entries(s).filter(([a])=>a!=="X-Redocly-Cookie").map(([a,l])=>({name:a,value:l}))}function fDe(t,e,n){const r=FI(t,e,n),i=hDe(t.requestBody.type);if(r!==null)switch(i){case"multipart/form-data":{const o=r.map(({key:a,value:l})=>{if(typeof l=="string")return{name:a,value:l};const c=l,u=c?.absolutePath;return{name:a,fileName:u??void 0,contentType:c?c.file.type??"application/octet-stream":void 0}});return{mimeType:i,params:o}}case"application/x-www-form-urlencoded":{const o=r.map(({key:a,value:l})=>({name:a,value:l}));return{mimeType:i,params:o}}case"application/octet-stream":{const o=r?.absolutePath;return{mimeType:i,text:o?`@${o}`:void 0}}default:return{mimeType:i,text:r}}}function hDe(t){return t?t==="JSON"?"application/json":t:"text/plain"}const pDe=({onClose:t})=>{const{step:e,workflow:n,collection:r}=Zs(),i=Dt(),s=uDe({step:e,collectionId:r?.id,workflowId:n?.workflowId}),o=b.useMemo(()=>{const{inputs:a}=i;return a.filter(l=>l.isSecret&&l.value).map(l=>l.value)},[i]);return d.jsx(gDe,{title:"Generate code",isOpen:!0,onClose:t,content:d.jsx(i5e,{har:s,secretValues:o})})},gDe=C.default(cs)`
2485
2485
  & > div {
2486
2486
  width: calc(100%);
2487
2487
  max-width: 920px;
@@ -3643,7 +3643,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
3643
3643
  font-size: var(--font-size-base);
3644
3644
  font-weight: var(--font-weight-regular);
3645
3645
  line-height: var(--line-height-base);
3646
- `,T3e=["text","file"];function $3e({onParameterChange:t,files:e}){const n=b.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(On())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-Clfun2IN.js")),l=await a({multiple:!0});if(!l)return;const u=(Array.isArray(l)?l:[l]).map(Eg),h=(await Promise.all(u)).filter(p=>p!==null);t(h)}catch(a){console.error("Failed to open file dialog or read file:",a)}else n.current?.click()},s=b.useCallback(()=>{t(null)},[t]),o=b.useMemo(()=>{if(!e)return null;if(e.length===1)return d.jsx(nM,{icon:d.jsx(li.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsx(rM,{children:e[0].file.name})});if(e.length>1)return d.jsx(nM,{icon:d.jsx(li.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsxs(rM,{children:[e.length," files"]})})},[e,s]);return d.jsx(I3e,{children:d.jsxs(E3e,{children:[d.jsx(A3e,{children:o||d.jsx(j3e,{children:"Add files here"})}),d.jsxs(Q3e,{children:[d.jsx(R3e,{onClick:i,variant:"secondary",size:"small","data-testid":"add-button",icon:d.jsx(rr.AddIcon,{color:"--button-content-color"})}),d.jsx("input",{"data-testid":"file-input",hidden:!0,ref:n,type:"file",multiple:!0,accept:"files/*",onChange:r})]})]})})}const I3e=C.default.div`
3646
+ `,T3e=["text","file"];function $3e({onParameterChange:t,files:e}){const n=b.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(On())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-kTnSyklR.js")),l=await a({multiple:!0});if(!l)return;const u=(Array.isArray(l)?l:[l]).map(Eg),h=(await Promise.all(u)).filter(p=>p!==null);t(h)}catch(a){console.error("Failed to open file dialog or read file:",a)}else n.current?.click()},s=b.useCallback(()=>{t(null)},[t]),o=b.useMemo(()=>{if(!e)return null;if(e.length===1)return d.jsx(nM,{icon:d.jsx(li.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsx(rM,{children:e[0].file.name})});if(e.length>1)return d.jsx(nM,{icon:d.jsx(li.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsxs(rM,{children:[e.length," files"]})})},[e,s]);return d.jsx(I3e,{children:d.jsxs(E3e,{children:[d.jsx(A3e,{children:o||d.jsx(j3e,{children:"Add files here"})}),d.jsxs(Q3e,{children:[d.jsx(R3e,{onClick:i,variant:"secondary",size:"small","data-testid":"add-button",icon:d.jsx(rr.AddIcon,{color:"--button-content-color"})}),d.jsx("input",{"data-testid":"file-input",hidden:!0,ref:n,type:"file",multiple:!0,accept:"files/*",onChange:r})]})]})})}const I3e=C.default.div`
3647
3647
  position: relative;
3648
3648
  display: flex;
3649
3649
  flex-grow: 1;
@@ -3782,7 +3782,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
3782
3782
  `,U3e=C.default.div`
3783
3783
  display: flex;
3784
3784
  justify-content: center;
3785
- `,p8=t=>t==="file"?d.jsx(XF.FileIcon,{size:"14px"}):d.jsx(WF.CharacterIcon,{size:"14px"}),B3e=T3e.map(t=>({label:d.jsxs(_3e,{children:[p8(t),d.jsx(q3e,{children:t})]}),value:t}));function iM({isLast:t,index:e,parameter:n,onKeyChange:r,onValueChange:i,onActiveChange:s,onTypeChange:o,onFilesChange:a,environment:l,keyName:c,enableInputTypeSelection:u,autoCompleteOptions:f,actions:h}){const{value:p,key:m,active:g,type:O,files:v}=n,x=t?"form-data-name-ghost":`form-data-name-${e}`,y=t?"form-data-value-ghost":`form-data-value-${e}`,w=t?"form-data-checkbox-ghost":`form-data-checkbox-${e}`;return d.jsxs(z3e,{children:[d.jsx(L3e,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx(V3e,{"data-testid":w,type:"checkbox",checked:g,onChange:({target:S})=>s(S.checked)}),d.jsx(W3e,{checked:g})]})}),d.jsx(Le,{}),d.jsxs(d.Fragment,{children:[d.jsx(Ct,{dataTestId:x,placeholder:`${t?"New ":""}${c}`,value:m,environment:l,onChange:r}),u&&d.jsx(U3e,{children:d.jsx(Z3e,{options:B3e,value:{label:p8(O),value:O,active:!0},onChange:({value:S})=>o(S),withArrow:!1,size:"small"})})]}),d.jsx(Le,{}),O==="file"?d.jsx($3e,{files:v,onParameterChange:a}):d.jsx(Ct,{dataTestId:y,placeholder:"Value",value:p,environment:l,options:f,onChange:i}),d.jsx(Le,{}),d.jsx(X3e,{children:!t&&h(e)})]})}function F3e({title:t,enableInputTypeSelection:e=!1,onParameterChange:n,actions:r,formElements:i,onFormElementsChange:s,keyName:o,environment:a,createEmptyParameter:l}){const c=fi(),{ghost:u,updateGhost:f,promoteGhost:h}=n8({createEmptyParameter:l,onPromote:g=>{s?.(O=>[...O,g]),n?.()}});function p(g,O){s?.(v=>v.map((x,y)=>y===g?{...x,...O}:x)),n?.()}const m={environment:a,keyName:o,enableInputTypeSelection:e,autoCompleteOptions:c,actions:r};return d.jsxs(D3e,{children:[t&&d.jsx(N3e,{children:t}),d.jsx(M3e,{children:[...i.map((g,O)=>d.jsx(iM,{isLast:!1,index:O,parameter:g,onKeyChange:v=>p(O,{key:v}),onValueChange:v=>p(O,{value:v}),onActiveChange:v=>p(O,{active:v}),onTypeChange:v=>p(O,{type:v}),onFilesChange:v=>p(O,{files:v}),...m},g.id)),l?d.jsx(iM,{isLast:!0,index:i.length,parameter:u,onKeyChange:g=>h({key:g}),onValueChange:g=>h({value:g}),onActiveChange:g=>f({active:g}),onTypeChange:g=>f({type:g}),onFilesChange:g=>h({files:g}),...m},u.id):null]})]})}function Y3e({formElements:t,onFormElementsChange:e,type:n}){const r=Dt();function i(s){e(o=>o.filter((a,l)=>l!==s))}return d.jsx(F3e,{keyName:"Param",formElements:t,onFormElementsChange:e,environment:r,enableInputTypeSelection:n!==gt.UrlEncoded,createEmptyParameter:_0e,actions:s=>d.jsx(Qi,{onClick:()=>i(s),variant:"text",icon:d.jsx(An.TrashCanIcon,{})})})}const G3e=({binary:t,onBinaryChange:e})=>{const[n,r]=b.useState(!1),i=b.useRef(null),s=l=>{const c=l.target.files?.[0];if(c){r(!0);const u=new FileReader;u.onload=()=>{r(!1),e({absolutePath:null,file:c})},u.readAsDataURL(c)}},o=async()=>{if(On())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-Clfun2IN.js")),c=await l();if(!c)return;const u=await Eg(c);e(u)}catch(l){console.error("Failed to open file dialog or read file:",l)}else i.current?.click()},a=()=>{e(null)};return n?d.jsx(IS,{children:d.jsxs(H3e,{children:[d.jsx(Ok.Spinner,{}),"Loading..."]})}):t&&t.file?.name?d.jsx(IS,{children:d.jsxs(J3e,{children:[d.jsxs(K3e,{children:[d.jsx(ZF.DocumentBlankIcon,{size:"16px"}),d.jsx(e4e,{children:t.file?.name})]}),d.jsx(Qi,{onClick:a,icon:d.jsx(An.TrashCanIcon,{})})]})}):d.jsx(IS,{children:d.jsx(g8,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"file",hidden:!0,ref:i,onChange:s}),d.jsx(me.Button,{type:"button",variant:"text",onClick:o,icon:d.jsx(qF.CloudUploadIcon,{}),children:"Upload file"})]})})})},IS=C.default(d7)`
3785
+ `,p8=t=>t==="file"?d.jsx(XF.FileIcon,{size:"14px"}):d.jsx(WF.CharacterIcon,{size:"14px"}),B3e=T3e.map(t=>({label:d.jsxs(_3e,{children:[p8(t),d.jsx(q3e,{children:t})]}),value:t}));function iM({isLast:t,index:e,parameter:n,onKeyChange:r,onValueChange:i,onActiveChange:s,onTypeChange:o,onFilesChange:a,environment:l,keyName:c,enableInputTypeSelection:u,autoCompleteOptions:f,actions:h}){const{value:p,key:m,active:g,type:O,files:v}=n,x=t?"form-data-name-ghost":`form-data-name-${e}`,y=t?"form-data-value-ghost":`form-data-value-${e}`,w=t?"form-data-checkbox-ghost":`form-data-checkbox-${e}`;return d.jsxs(z3e,{children:[d.jsx(L3e,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx(V3e,{"data-testid":w,type:"checkbox",checked:g,onChange:({target:S})=>s(S.checked)}),d.jsx(W3e,{checked:g})]})}),d.jsx(Le,{}),d.jsxs(d.Fragment,{children:[d.jsx(Ct,{dataTestId:x,placeholder:`${t?"New ":""}${c}`,value:m,environment:l,onChange:r}),u&&d.jsx(U3e,{children:d.jsx(Z3e,{options:B3e,value:{label:p8(O),value:O,active:!0},onChange:({value:S})=>o(S),withArrow:!1,size:"small"})})]}),d.jsx(Le,{}),O==="file"?d.jsx($3e,{files:v,onParameterChange:a}):d.jsx(Ct,{dataTestId:y,placeholder:"Value",value:p,environment:l,options:f,onChange:i}),d.jsx(Le,{}),d.jsx(X3e,{children:!t&&h(e)})]})}function F3e({title:t,enableInputTypeSelection:e=!1,onParameterChange:n,actions:r,formElements:i,onFormElementsChange:s,keyName:o,environment:a,createEmptyParameter:l}){const c=fi(),{ghost:u,updateGhost:f,promoteGhost:h}=n8({createEmptyParameter:l,onPromote:g=>{s?.(O=>[...O,g]),n?.()}});function p(g,O){s?.(v=>v.map((x,y)=>y===g?{...x,...O}:x)),n?.()}const m={environment:a,keyName:o,enableInputTypeSelection:e,autoCompleteOptions:c,actions:r};return d.jsxs(D3e,{children:[t&&d.jsx(N3e,{children:t}),d.jsx(M3e,{children:[...i.map((g,O)=>d.jsx(iM,{isLast:!1,index:O,parameter:g,onKeyChange:v=>p(O,{key:v}),onValueChange:v=>p(O,{value:v}),onActiveChange:v=>p(O,{active:v}),onTypeChange:v=>p(O,{type:v}),onFilesChange:v=>p(O,{files:v}),...m},g.id)),l?d.jsx(iM,{isLast:!0,index:i.length,parameter:u,onKeyChange:g=>h({key:g}),onValueChange:g=>h({value:g}),onActiveChange:g=>f({active:g}),onTypeChange:g=>f({type:g}),onFilesChange:g=>h({files:g}),...m},u.id):null]})]})}function Y3e({formElements:t,onFormElementsChange:e,type:n}){const r=Dt();function i(s){e(o=>o.filter((a,l)=>l!==s))}return d.jsx(F3e,{keyName:"Param",formElements:t,onFormElementsChange:e,environment:r,enableInputTypeSelection:n!==gt.UrlEncoded,createEmptyParameter:_0e,actions:s=>d.jsx(Qi,{onClick:()=>i(s),variant:"text",icon:d.jsx(An.TrashCanIcon,{})})})}const G3e=({binary:t,onBinaryChange:e})=>{const[n,r]=b.useState(!1),i=b.useRef(null),s=l=>{const c=l.target.files?.[0];if(c){r(!0);const u=new FileReader;u.onload=()=>{r(!1),e({absolutePath:null,file:c})},u.readAsDataURL(c)}},o=async()=>{if(On())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-kTnSyklR.js")),c=await l();if(!c)return;const u=await Eg(c);e(u)}catch(l){console.error("Failed to open file dialog or read file:",l)}else i.current?.click()},a=()=>{e(null)};return n?d.jsx(IS,{children:d.jsxs(H3e,{children:[d.jsx(Ok.Spinner,{}),"Loading..."]})}):t&&t.file?.name?d.jsx(IS,{children:d.jsxs(J3e,{children:[d.jsxs(K3e,{children:[d.jsx(ZF.DocumentBlankIcon,{size:"16px"}),d.jsx(e4e,{children:t.file?.name})]}),d.jsx(Qi,{onClick:a,icon:d.jsx(An.TrashCanIcon,{})})]})}):d.jsx(IS,{children:d.jsx(g8,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"file",hidden:!0,ref:i,onChange:s}),d.jsx(me.Button,{type:"button",variant:"text",onClick:o,icon:d.jsx(qF.CloudUploadIcon,{}),children:"Upload file"})]})})})},IS=C.default(d7)`
3786
3786
  align-items: flex-start;
3787
3787
  `,g8=C.default.div`
3788
3788
  display: flex;
@@ -6092,7 +6092,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
6092
6092
  display: inline-block;
6093
6093
  color: var(--text-color-secondary);
6094
6094
  margin-left: var(--spacing-xs);
6095
- `,Y7e="request",G7e=new Set(["replay:","redocly-replay:"]),H7e=8*1024,J7e=4*1024,ck=1024,K7e=new Set([$n.JSON,$n.XML,$n.HTML,$n.Text]);function uk(t){return A$(t).length>0}function eqe(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function dF(t,e){return!t||t.length>ck||e.length>ck||uk(e)}function NS(t,e,n){const r=[];for(const[i,s]of t){if(!i.startsWith(e))continue;const o=i.slice(e.length);if(dF(o,s))return null;r.push(eqe(n,o,s))}return r}function tqe(t){if(t.length>H7e)return null;let e;try{e=new URL(t)}catch{return null}if(!G7e.has(e.protocol)||e.hostname.toLowerCase()!==Y7e)return null;const n=e.searchParams,r=n.get("url");if(!r||uk(r))return null;let i;try{i=new URL(r)}catch{return null}if(i.protocol!=="http:"&&i.protocol!=="https:")return null;const s=(n.get("method")||"GET").toUpperCase();if(!Zd.includes(s))return null;const o=NS(n,"header.","header"),a=NS(n,"query.","query"),l=NS(n,"cookie.","cookie");if(!o||!a||!l)return null;const c=Pg(r);if(c.some(p=>dF(p.key,p.value)))return null;const u=n.get("body");if(u!==null&&(u.length>J7e||uk(u)))return null;const f=n.get("contentType")?.trim();if(f&&!K7e.has(f))return null;const h=n.get("env")?.trim();return h&&h.length>ck?null:{xOperation:{method:s,url:r},headers:o,queryParameters:[...c,...a],cookies:l,...u!==null&&{body:{content:u,...f&&{type:f}}},...h&&{environment:h}}}function nqe(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function rqe({onEnvironmentNotFound:t}={}){const{getTabs:e,setActiveTabIdx:n,updateTabDataAt:r}=Dc(),{addNewTab:i}=Ln(),s=Wo(),o=sf();return b.useCallback(a=>{const l=e().findIndex(({data:u})=>an(u,De.Step)&&nqe(u)&&TP(u,a.xOperation));let c;if(l!==-1)c=l,n(c);else{const u=jo({xOperation:a.xOperation});c=i({id:crypto.randomUUID(),state:hn.Normal,data:Mu({draftStep:u,activeTabName:rc(u)})})}e()[c]&&r(c,u=>{const f={...u,response:null,requestError:null,isProcessingRequest:!1};if(!f.draftStep)return f;const h=Id();return{...f,draftStep:{...f.draftStep,parameters:{...f.draftStep.parameters,headers:a.headers,queryParameters:a.queryParameters,cookies:a.cookies},requestBody:a.body?{...h,content:a.body.content,...a.body.type&&{type:a.body.type}}:h}}}),a.environment&&(s.some(f=>f.name===a.environment)?o(a.environment):t?.(a.environment))},[e,n,r,i,s,o,t])}const iqe="com.redocly.deepLink.opened";let YM=!1;function sqe(){const{warning:t}=C3.useToast(),e=Be(),n=rqe({onEnvironmentNotFound:i=>t(`Environment "${i}" not found`)}),r=b.useRef(n);r.current=n,b.useEffect(()=>{let i,s=!1;const o=a=>{const l=a[0]&&tqe(a[0]);l&&(r.current(l),e.sendEvent(iqe,[{...Oe("deepLink","request"),scheme:a[0].startsWith("redocly-replay:")?"redocly-replay":"replay"}]))};return(async()=>{const{onOpenUrl:a,getCurrent:l}=await Promise.resolve().then(()=>require("./replay-index-3lwhSmvi.js")),c=await a(o);if(s){c();return}if(i=c,!YM){const u=await l();if(s)return;YM=!0,u?.[0]&&o(u)}})(),()=>{s=!0,i?.()}},[])}function oqe(t){const e=t||"default";return{id:Vp(T0(e)),systemFilesDir:TC.join("/replay",e),userFilesDir:TC.join("/projects",e)}}async function aqe(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=Vp(T0(t)),n=await lqe(),r=await F$(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function lqe(){if(!oP)return CP();try{return await Oq()}catch{return CP()}}function dk(t,e){const n=`apis/${t.info.title}`.replace(/\s+/g,"-").toLowerCase(),r=a=>`${a}.yaml`,i=a=>e.some(l=>l.id===r(a));if(!i(n))return r(n);let s=1,o=`${n}-${s}`;for(;i(o);)s++,o=`${n}-${s}`;return r(o)}function nO(t,e){if(e.size===0)return t;let n=t;for(let r=0;r<t.length;r++){const i=t[r];!hg(i)||!i.key||!e.has(i.key)||(n===t&&(n=[...t]),n[r]={...i,value:`$inputs.${i.key}`,active:!0})}return n}function fF(t,e,n){if(typeof e=="string"){const s=os(e);return s&&n.has(s)?e:t}if(!e||typeof e!="object"||Array.isArray(e)||!t||typeof t!="object"||Array.isArray(t))return t;const r=t;let i=r;for(const[s,o]of Object.entries(e)){const a=fF(r[s],o,n);a!==r[s]&&(i===r&&(i={...r}),i[s]=a)}return i}function cqe(t,e,n){if(n.size===0)return t;let r=t;for(const i of e){if(!i.securitySchemeId)continue;const s=t.findIndex(a=>a.securitySchemeId===i.securitySchemeId);if(s===-1)continue;const o=fF(r[s],i,n);o!==r[s]&&(r===t&&(r=[...t]),r[s]=o)}return r}function uqe(t,e,n){const r=M$(e.parameters,"in"),{pathParameters:i,queryParameters:s,headers:o,cookies:a}=t.parameters;return{...t,parameters:{...t.parameters,pathParameters:nO(i,td(r.path,"path",n)),queryParameters:nO(s,Z7(r.query,r.querystring,n)),headers:nO(o,td(r.header,"header",n)),cookies:nO(a,td(r.cookie,"cookie",n))},security:cqe(t.security,Lb(e),B9e(e,n))}}function GM(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=dqe(t,e,n);return{operations:r}}function dqe(t,e,n){const r=[];for(const[i,s]of Object.entries(t.paths)){for(const[o,a]of Object.entries(s))o!=="parameters"&&o!=="servers"&&o!=="description"&&o!=="summary"&&o!=="additionalOperations"&&(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(c=>{const{operation:u}=HM(i,o,t,c,e,!1,n);u&&r.push(u)});if(s.additionalOperations)for(const[o,a]of Object.entries(s.additionalOperations))(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(c=>{const{operation:u}=HM(i,o,t,c,e,!0,n);u&&r.push(u)})}return{operations:r}}function HM(t,e,n,r,i,s,o){if(!o)return{operation:null};const a=o(t,e,n);if(!a)return{operation:null};const l=`${n.info.title}/${r}/${a.name}`;return{operation:Exe(a,s,i,l)}}function fqe({store:t,selectedEnvironment:e,selectedEnvironmentSeq:n}){const r=b.useRef({seq:n,name:e});b.useEffect(()=>{!e||!(n===void 0?e!==r.current.name:n!==r.current.seq)||(r.current={seq:n,name:e},t.set(Is,e))},[t,e,n])}const JM=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:s}=uZ({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===s}return!1});class hqe{storage;constructor(e){this.storage=e}findAll(){return this.storage.findAll()}findOne(e){return this.storage.findOne(e)}upsert(e){return this.storage.upsert(e)}remove(e){return this.storage.remove(e)}findRecentChatsPage(e){return this.storage.findRecentChatsPage(e)}}class fk{static instance=null;static async initialize(e,n){this.close(),this.instance=await pqe(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function pqe(t,e){if(e){const{AiChatSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-AiChatSqliteDBStorage-B9waB0dA.js")),r=Ip.getInstance(),i=new n(r);return new hqe(i)}else throw new Error("Not implemented")}const Su="ai-chat",MS="detail",gqe="title",KM="infinite-history",hF={all:()=>[Su],details:()=>[Su,MS],detail:t=>[Su,MS,t],detailTitle:t=>[Su,MS,t,gqe],infiniteHistories:()=>[Su,KM],infiniteHistory:t=>[Su,KM,t]};function mqe(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const Oqe=2;function vqe(t){const e=JSON.parse(t);let n;return e.version===1?n=mqe(e):n=e,n.version!==Oqe&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const zS="history.json",yqe="history.json.backup";class bqe{static async migrateFromStorage(e,n,r){try{const i=await e.get(zS);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const s=vqe(i);if(s.length===0)return console.log(`No history items found in ${r}`),{migrated:!1,itemCount:0};await this.bulkInsert(n,s);try{await e.rename(zS,yqe)}catch{await e.remove(zS)}return console.log(`Migrated ${s.length} history items from ${r}`),{migrated:!0,itemCount:s.length}}catch(i){const s=i instanceof Error?i.message:"Unknown error";return console.error(`History migration from ${r} failed:`,s),{migrated:!1,itemCount:0,error:s}}}static async bulkInsert(e,n){for(let i=0;i<n.length;i+=100){const s=n.slice(i,i+100);await Promise.all(s.map(o=>e.addItem(o)))}}static async migrate(e,n,r){if(r){const{TauriFileSystemAdapter:i}=await Promise.resolve().then(()=>require("./replay-TauriFileSystemAdapter-Zb6LTS_-.js")),s=new i(e.systemFilesDir);return this.migrateFromStorage(s,n,"JSON file")}else{const i=new IP(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}const $E=t=>d.jsx(xqe,{...t},t.settings.storageKey),xqe=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:s,selectedEnvironmentSeq:o})=>{const a=o6(),l=Be(),c=qr.useQueryClient(),[u]=b.useState(Ck),f=b.useRef(e);f.current=e;const h=b.useRef(!1);b.useEffect(()=>(h.current=!1,()=>{h.current=!0}),[]);const[p]=b.useState(()=>m());async function m(){const v=On()?await aqe(f.current.storageKey):oqe(f.current.storageKey);if(f.current.layout!=="preview"&&On()&&Rp.initialize(),await a.init(v,f.current,u,l),f.current.layout!=="preview"){if(h.current)return;if(On()){const y=`${v.systemFilesDir}/replay.db`;await Ip.initialize(y),await fk.initialize(v,On())}if(h.current)return;await cl.initialize(v,On()),await Es.initialize(On());try{await Es.getInstance()?.pruneOlderThan(Date.now()-S0e)}catch(y){console.error("Failed to prune step context:",y)}if(h.current)return;try{const y=await bqe.migrate(v,cl.getInstance(),On());y.migrated&&l.sendEvent("com.redocly.history.migration",[{...Oe("migration","historyMigration","storage"),status:"success",itemCount:y.itemCount}])}catch(y){console.error("History migration failed:",y),l.sendEvent("com.redocly.history.migration",[{...Oe("migration","historyMigration","storage"),status:"error",error:y instanceof Error?y.message:"Unknown error"}])}}x(),u.get(Cr).length===0&&u.set(Cr,NT);function x(){if(!n)return;const y=dk(n,[]),{operations:w}=GM(n,y,f.current.convertOperationToReplayValue);if(!w?.length||!w[0].collectionPath?.split("/")?.[0]||(u.set(Ui,[{id:y,srcType:ai.FS,...n}]),u.set(HI,y),!r&&!i))return;const k=JM(w,r,i),{path:T,method:$}=k?.apiPath||{};if(!k||!T||!$)return;const E=f.current.convertOperationToReplayValue?.(T,$,n);E&&e3(u,y,E,f.current),Pqe(u,{apiId:y,path:T,method:$,operationId:k.operationId,isAdditionalOperation:k.isAdditionalOperation},E,f.current.dynamicReplayValues)}}b.useEffect(()=>{if(e.layout!=="preview")return c.invalidateQueries({queryKey:$r.all}),c.invalidateQueries({queryKey:hF.all()}),c.invalidateQueries({queryKey:Dg.all}),()=>{cl.close(),fk.close(),Rp.close(),Es.close(),On()&&Ip.close().catch(v=>{console.error("Failed to close SqliteDBConnection:",v)})}},[e.layout,c]),fqe({store:u,selectedEnvironment:e.selectedEnvironment,selectedEnvironmentSeq:o});const g=b.useMemo(()=>{if(!n||!e.convertOperationToReplayValue)return null;const v=dk(n,[]),{operations:x}=GM(n,v,e.convertOperationToReplayValue);return x?.length?{apiId:v,operations:x}:null},[n,e.convertOperationToReplayValue]);b.useEffect(()=>{if(!n||!g||!e.convertOperationToReplayValue)return;const v=JM(g.operations,r,i),{path:x,method:y}=v?.apiPath||{};if(!v||!x||!y)return;const w=e.convertOperationToReplayValue(x,y,n);w&&e3(u,g.apiId,w,e)},[g,e.convertOperationToReplayValue,e.predefinedEnvValues,e.gateEnvironments,e.dynamicReplayValues,e.allowedEnvironments,e.selectedEnvironment,n,r,i]);const O=e.layout==="preview"?null:d.jsx(U7e,{projectPath:e.storageKey});return d.jsx(b.Suspense,{fallback:O,children:d.jsx(Sqe,{initStore:p,store:u,settings:e,api:n,onLoad:s,children:t})})};function Sqe({initStore:t,store:e,children:n,settings:r,api:i,onLoad:s}){b.use(t);const o=tJ(r,i);return b.useEffect(()=>{s?.()},[]),d.jsx(qY,{store:e,children:d.jsxs(wqe,{settings:o,apiId:r.apiId,children:[On()&&d.jsx(Cqe,{}),n]})})}function wqe({settings:t,apiId:e,children:n}){YY([[gh,t],[Qh,e]]);const r=Pa();return b.useEffect(()=>{fp(r.get(gh),t)||r.set(gh,t)},[r,t]),b.useEffect(()=>{r.get(Qh)!==e&&r.set(Qh,e)},[r,e]),d.jsx(d.Fragment,{children:n})}function Cqe(){return sqe(),null}const e3=(t,e,n,r)=>{const i=t.get(Cr),{environments:s,generatedInputs:o,synthesizedEnvironmentNames:a}=J9e(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues,r.gateEnvironments);t3(t.get(Ay),o)||t.set(Ay,o);const{newEnvironments:l,predefinedEnvironmentNames:c,activeEnvName:u}=K9e({envs:s,synthesizedEnvironmentNames:a,existingEnvironments:i,allowedEnvironments:r.allowedEnvironments,selectedEnvironment:r.selectedEnvironment,activeEnvironmentId:t.get(Is)});t3(t.get(Ey),c)||t.set(Ey,c),fp(l,t.get(Cr))||t.set(Cr,l),t.set(Is,u)},t3=(t,e)=>t.size===e.size&&[...t].every(n=>e.has(n)),Pqe=(t,e,n,r)=>{const i=t.get(Ir).findIndex(({data:s})=>an(s,De.Step)&&s.draftStep?.operation?.apiId===e.apiId&&s.draftStep?.operation?.path===e.path&&s.draftStep?.operation?.method===e.method);if(i!==-1)n&&r&&t.set(Ir,s=>kk(s,i,o=>o.draftStep?{...o,draftStep:uqe(o.draftStep,n,r)}:o)),t.set(Ii,i);else{const s=eI(e,n,r),o=[...t.get(Ir),{...s,state:hn.Normal}];t.set(Ir,o),t.set(Ii,o.length-1)}};function kqe(t){const e=b.useMemo(()=>i6(!0),[]);return d.jsx(qr.QueryClientProvider,{client:o0(),children:d.jsx(Gke,{value:e,children:d.jsx(Zy.Provider,{value:t.settings,children:d.jsx($E,{...t,selectedEnvironmentSeq:void 0,children:d.jsx(rF,{onError:n=>console.error(n),children:d.jsx(Tqe,{...t})})})})})})}function Tqe(t){return t.settings.disableDraft=!0,d.jsx(b.StrictMode,{children:d.jsxs($qe,{children:[d.jsx(Iqe,{children:d.jsx(TE,{})}),d.jsx(Lh,{hideTabs:!0})]})})}const $qe=C.default.div`
6095
+ `,Y7e="request",G7e=new Set(["replay:","redocly-replay:"]),H7e=8*1024,J7e=4*1024,ck=1024,K7e=new Set([$n.JSON,$n.XML,$n.HTML,$n.Text]);function uk(t){return A$(t).length>0}function eqe(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function dF(t,e){return!t||t.length>ck||e.length>ck||uk(e)}function NS(t,e,n){const r=[];for(const[i,s]of t){if(!i.startsWith(e))continue;const o=i.slice(e.length);if(dF(o,s))return null;r.push(eqe(n,o,s))}return r}function tqe(t){if(t.length>H7e)return null;let e;try{e=new URL(t)}catch{return null}if(!G7e.has(e.protocol)||e.hostname.toLowerCase()!==Y7e)return null;const n=e.searchParams,r=n.get("url");if(!r||uk(r))return null;let i;try{i=new URL(r)}catch{return null}if(i.protocol!=="http:"&&i.protocol!=="https:")return null;const s=(n.get("method")||"GET").toUpperCase();if(!Zd.includes(s))return null;const o=NS(n,"header.","header"),a=NS(n,"query.","query"),l=NS(n,"cookie.","cookie");if(!o||!a||!l)return null;const c=Pg(r);if(c.some(p=>dF(p.key,p.value)))return null;const u=n.get("body");if(u!==null&&(u.length>J7e||uk(u)))return null;const f=n.get("contentType")?.trim();if(f&&!K7e.has(f))return null;const h=n.get("env")?.trim();return h&&h.length>ck?null:{xOperation:{method:s,url:r},headers:o,queryParameters:[...c,...a],cookies:l,...u!==null&&{body:{content:u,...f&&{type:f}}},...h&&{environment:h}}}function nqe(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function rqe({onEnvironmentNotFound:t}={}){const{getTabs:e,setActiveTabIdx:n,updateTabDataAt:r}=Dc(),{addNewTab:i}=Ln(),s=Wo(),o=sf();return b.useCallback(a=>{const l=e().findIndex(({data:u})=>an(u,De.Step)&&nqe(u)&&TP(u,a.xOperation));let c;if(l!==-1)c=l,n(c);else{const u=jo({xOperation:a.xOperation});c=i({id:crypto.randomUUID(),state:hn.Normal,data:Mu({draftStep:u,activeTabName:rc(u)})})}e()[c]&&r(c,u=>{const f={...u,response:null,requestError:null,isProcessingRequest:!1};if(!f.draftStep)return f;const h=Id();return{...f,draftStep:{...f.draftStep,parameters:{...f.draftStep.parameters,headers:a.headers,queryParameters:a.queryParameters,cookies:a.cookies},requestBody:a.body?{...h,content:a.body.content,...a.body.type&&{type:a.body.type}}:h}}}),a.environment&&(s.some(f=>f.name===a.environment)?o(a.environment):t?.(a.environment))},[e,n,r,i,s,o,t])}const iqe="com.redocly.deepLink.opened";let YM=!1;function sqe(){const{warning:t}=C3.useToast(),e=Be(),n=rqe({onEnvironmentNotFound:i=>t(`Environment "${i}" not found`)}),r=b.useRef(n);r.current=n,b.useEffect(()=>{let i,s=!1;const o=a=>{const l=a[0]&&tqe(a[0]);l&&(r.current(l),e.sendEvent(iqe,[{...Oe("deepLink","request"),scheme:a[0].startsWith("redocly-replay:")?"redocly-replay":"replay"}]))};return(async()=>{const{onOpenUrl:a,getCurrent:l}=await Promise.resolve().then(()=>require("./replay-index-3lwhSmvi.js")),c=await a(o);if(s){c();return}if(i=c,!YM){const u=await l();if(s)return;YM=!0,u?.[0]&&o(u)}})(),()=>{s=!0,i?.()}},[])}function oqe(t){const e=t||"default";return{id:Vp(T0(e)),systemFilesDir:TC.join("/replay",e),userFilesDir:TC.join("/projects",e)}}async function aqe(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=Vp(T0(t)),n=await lqe(),r=await F$(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function lqe(){if(!oP)return CP();try{return await Oq()}catch{return CP()}}function dk(t,e){const n=`apis/${t.info.title}`.replace(/\s+/g,"-").toLowerCase(),r=a=>`${a}.yaml`,i=a=>e.some(l=>l.id===r(a));if(!i(n))return r(n);let s=1,o=`${n}-${s}`;for(;i(o);)s++,o=`${n}-${s}`;return r(o)}function nO(t,e){if(e.size===0)return t;let n=t;for(let r=0;r<t.length;r++){const i=t[r];!hg(i)||!i.key||!e.has(i.key)||(n===t&&(n=[...t]),n[r]={...i,value:`$inputs.${i.key}`,active:!0})}return n}function fF(t,e,n){if(typeof e=="string"){const s=os(e);return s&&n.has(s)?e:t}if(!e||typeof e!="object"||Array.isArray(e)||!t||typeof t!="object"||Array.isArray(t))return t;const r=t;let i=r;for(const[s,o]of Object.entries(e)){const a=fF(r[s],o,n);a!==r[s]&&(i===r&&(i={...r}),i[s]=a)}return i}function cqe(t,e,n){if(n.size===0)return t;let r=t;for(const i of e){if(!i.securitySchemeId)continue;const s=t.findIndex(a=>a.securitySchemeId===i.securitySchemeId);if(s===-1)continue;const o=fF(r[s],i,n);o!==r[s]&&(r===t&&(r=[...t]),r[s]=o)}return r}function uqe(t,e,n){const r=M$(e.parameters,"in"),{pathParameters:i,queryParameters:s,headers:o,cookies:a}=t.parameters;return{...t,parameters:{...t.parameters,pathParameters:nO(i,td(r.path,"path",n)),queryParameters:nO(s,Z7(r.query,r.querystring,n)),headers:nO(o,td(r.header,"header",n)),cookies:nO(a,td(r.cookie,"cookie",n))},security:cqe(t.security,Lb(e),B9e(e,n))}}function GM(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=dqe(t,e,n);return{operations:r}}function dqe(t,e,n){const r=[];for(const[i,s]of Object.entries(t.paths)){for(const[o,a]of Object.entries(s))o!=="parameters"&&o!=="servers"&&o!=="description"&&o!=="summary"&&o!=="additionalOperations"&&(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(c=>{const{operation:u}=HM(i,o,t,c,e,!1,n);u&&r.push(u)});if(s.additionalOperations)for(const[o,a]of Object.entries(s.additionalOperations))(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(c=>{const{operation:u}=HM(i,o,t,c,e,!0,n);u&&r.push(u)})}return{operations:r}}function HM(t,e,n,r,i,s,o){if(!o)return{operation:null};const a=o(t,e,n);if(!a)return{operation:null};const l=`${n.info.title}/${r}/${a.name}`;return{operation:Exe(a,s,i,l)}}function fqe({store:t,selectedEnvironment:e,selectedEnvironmentSeq:n}){const r=b.useRef({seq:n,name:e});b.useEffect(()=>{!e||!(n===void 0?e!==r.current.name:n!==r.current.seq)||(r.current={seq:n,name:e},t.set(Is,e))},[t,e,n])}const JM=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:s}=uZ({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===s}return!1});class hqe{storage;constructor(e){this.storage=e}findAll(){return this.storage.findAll()}findOne(e){return this.storage.findOne(e)}upsert(e){return this.storage.upsert(e)}remove(e){return this.storage.remove(e)}findRecentChatsPage(e){return this.storage.findRecentChatsPage(e)}}class fk{static instance=null;static async initialize(e,n){this.close(),this.instance=await pqe(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function pqe(t,e){if(e){const{AiChatSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-AiChatSqliteDBStorage-BlEocJgY.js")),r=Ip.getInstance(),i=new n(r);return new hqe(i)}else throw new Error("Not implemented")}const Su="ai-chat",MS="detail",gqe="title",KM="infinite-history",hF={all:()=>[Su],details:()=>[Su,MS],detail:t=>[Su,MS,t],detailTitle:t=>[Su,MS,t,gqe],infiniteHistories:()=>[Su,KM],infiniteHistory:t=>[Su,KM,t]};function mqe(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const Oqe=2;function vqe(t){const e=JSON.parse(t);let n;return e.version===1?n=mqe(e):n=e,n.version!==Oqe&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const zS="history.json",yqe="history.json.backup";class bqe{static async migrateFromStorage(e,n,r){try{const i=await e.get(zS);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const s=vqe(i);if(s.length===0)return console.log(`No history items found in ${r}`),{migrated:!1,itemCount:0};await this.bulkInsert(n,s);try{await e.rename(zS,yqe)}catch{await e.remove(zS)}return console.log(`Migrated ${s.length} history items from ${r}`),{migrated:!0,itemCount:s.length}}catch(i){const s=i instanceof Error?i.message:"Unknown error";return console.error(`History migration from ${r} failed:`,s),{migrated:!1,itemCount:0,error:s}}}static async bulkInsert(e,n){for(let i=0;i<n.length;i+=100){const s=n.slice(i,i+100);await Promise.all(s.map(o=>e.addItem(o)))}}static async migrate(e,n,r){if(r){const{TauriFileSystemAdapter:i}=await Promise.resolve().then(()=>require("./replay-TauriFileSystemAdapter-BvJ1azsj.js")),s=new i(e.systemFilesDir);return this.migrateFromStorage(s,n,"JSON file")}else{const i=new IP(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}const $E=t=>d.jsx(xqe,{...t},t.settings.storageKey),xqe=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:s,selectedEnvironmentSeq:o})=>{const a=o6(),l=Be(),c=qr.useQueryClient(),[u]=b.useState(Ck),f=b.useRef(e);f.current=e;const h=b.useRef(!1);b.useEffect(()=>(h.current=!1,()=>{h.current=!0}),[]);const[p]=b.useState(()=>m());async function m(){const v=On()?await aqe(f.current.storageKey):oqe(f.current.storageKey);if(f.current.layout!=="preview"&&On()&&Rp.initialize(),await a.init(v,f.current,u,l),f.current.layout!=="preview"){if(h.current)return;if(On()){const y=`${v.systemFilesDir}/replay.db`;await Ip.initialize(y),await fk.initialize(v,On())}if(h.current)return;await cl.initialize(v,On()),await Es.initialize(On());try{await Es.getInstance()?.pruneOlderThan(Date.now()-S0e)}catch(y){console.error("Failed to prune step context:",y)}if(h.current)return;try{const y=await bqe.migrate(v,cl.getInstance(),On());y.migrated&&l.sendEvent("com.redocly.history.migration",[{...Oe("migration","historyMigration","storage"),status:"success",itemCount:y.itemCount}])}catch(y){console.error("History migration failed:",y),l.sendEvent("com.redocly.history.migration",[{...Oe("migration","historyMigration","storage"),status:"error",error:y instanceof Error?y.message:"Unknown error"}])}}x(),u.get(Cr).length===0&&u.set(Cr,NT);function x(){if(!n)return;const y=dk(n,[]),{operations:w}=GM(n,y,f.current.convertOperationToReplayValue);if(!w?.length||!w[0].collectionPath?.split("/")?.[0]||(u.set(Ui,[{id:y,srcType:ai.FS,...n}]),u.set(HI,y),!r&&!i))return;const k=JM(w,r,i),{path:T,method:$}=k?.apiPath||{};if(!k||!T||!$)return;const E=f.current.convertOperationToReplayValue?.(T,$,n);E&&e3(u,y,E,f.current),Pqe(u,{apiId:y,path:T,method:$,operationId:k.operationId,isAdditionalOperation:k.isAdditionalOperation},E,f.current.dynamicReplayValues)}}b.useEffect(()=>{if(e.layout!=="preview")return c.invalidateQueries({queryKey:$r.all}),c.invalidateQueries({queryKey:hF.all()}),c.invalidateQueries({queryKey:Dg.all}),()=>{cl.close(),fk.close(),Rp.close(),Es.close(),On()&&Ip.close().catch(v=>{console.error("Failed to close SqliteDBConnection:",v)})}},[e.layout,c]),fqe({store:u,selectedEnvironment:e.selectedEnvironment,selectedEnvironmentSeq:o});const g=b.useMemo(()=>{if(!n||!e.convertOperationToReplayValue)return null;const v=dk(n,[]),{operations:x}=GM(n,v,e.convertOperationToReplayValue);return x?.length?{apiId:v,operations:x}:null},[n,e.convertOperationToReplayValue]);b.useEffect(()=>{if(!n||!g||!e.convertOperationToReplayValue)return;const v=JM(g.operations,r,i),{path:x,method:y}=v?.apiPath||{};if(!v||!x||!y)return;const w=e.convertOperationToReplayValue(x,y,n);w&&e3(u,g.apiId,w,e)},[g,e.convertOperationToReplayValue,e.predefinedEnvValues,e.gateEnvironments,e.dynamicReplayValues,e.allowedEnvironments,e.selectedEnvironment,n,r,i]);const O=e.layout==="preview"?null:d.jsx(U7e,{projectPath:e.storageKey});return d.jsx(b.Suspense,{fallback:O,children:d.jsx(Sqe,{initStore:p,store:u,settings:e,api:n,onLoad:s,children:t})})};function Sqe({initStore:t,store:e,children:n,settings:r,api:i,onLoad:s}){b.use(t);const o=tJ(r,i);return b.useEffect(()=>{s?.()},[]),d.jsx(qY,{store:e,children:d.jsxs(wqe,{settings:o,apiId:r.apiId,children:[On()&&d.jsx(Cqe,{}),n]})})}function wqe({settings:t,apiId:e,children:n}){YY([[gh,t],[Qh,e]]);const r=Pa();return b.useEffect(()=>{fp(r.get(gh),t)||r.set(gh,t)},[r,t]),b.useEffect(()=>{r.get(Qh)!==e&&r.set(Qh,e)},[r,e]),d.jsx(d.Fragment,{children:n})}function Cqe(){return sqe(),null}const e3=(t,e,n,r)=>{const i=t.get(Cr),{environments:s,generatedInputs:o,synthesizedEnvironmentNames:a}=J9e(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues,r.gateEnvironments);t3(t.get(Ay),o)||t.set(Ay,o);const{newEnvironments:l,predefinedEnvironmentNames:c,activeEnvName:u}=K9e({envs:s,synthesizedEnvironmentNames:a,existingEnvironments:i,allowedEnvironments:r.allowedEnvironments,selectedEnvironment:r.selectedEnvironment,activeEnvironmentId:t.get(Is)});t3(t.get(Ey),c)||t.set(Ey,c),fp(l,t.get(Cr))||t.set(Cr,l),t.set(Is,u)},t3=(t,e)=>t.size===e.size&&[...t].every(n=>e.has(n)),Pqe=(t,e,n,r)=>{const i=t.get(Ir).findIndex(({data:s})=>an(s,De.Step)&&s.draftStep?.operation?.apiId===e.apiId&&s.draftStep?.operation?.path===e.path&&s.draftStep?.operation?.method===e.method);if(i!==-1)n&&r&&t.set(Ir,s=>kk(s,i,o=>o.draftStep?{...o,draftStep:uqe(o.draftStep,n,r)}:o)),t.set(Ii,i);else{const s=eI(e,n,r),o=[...t.get(Ir),{...s,state:hn.Normal}];t.set(Ir,o),t.set(Ii,o.length-1)}};function kqe(t){const e=b.useMemo(()=>i6(!0),[]);return d.jsx(qr.QueryClientProvider,{client:o0(),children:d.jsx(Gke,{value:e,children:d.jsx(Zy.Provider,{value:t.settings,children:d.jsx($E,{...t,selectedEnvironmentSeq:void 0,children:d.jsx(rF,{onError:n=>console.error(n),children:d.jsx(Tqe,{...t})})})})})})}function Tqe(t){return t.settings.disableDraft=!0,d.jsx(b.StrictMode,{children:d.jsxs($qe,{children:[d.jsx(Iqe,{children:d.jsx(TE,{})}),d.jsx(Lh,{hideTabs:!0})]})})}const $qe=C.default.div`
6096
6096
  display: flex;
6097
6097
  flex-direction: column;
6098
6098
  max-height: 80vh;
@@ -6977,7 +6977,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
6977
6977
  border-right: ${({$isOverlayLayout:t})=>t?"1px solid var(--border-color-secondary)":"none"};
6978
6978
  width: 100%;
6979
6979
  user-select: none;
6980
- `;function h3({children:t}){const e=rf(),{sendEvent:n}=Be(),{tabsParams:r}=N0(e,!1),[i,s]=b.useState(r[0]?.key||null),o=b.useCallback(l=>{s(l),n("com.redocly.tab.change",[{...Oe("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a={tabsParams:r,activeTab:i,onTabChange:o};return d.jsx(PF.Provider,{value:a,children:t})}function HUe(){const[t,e]=b.useState(()=>{const n=document.documentElement.clientWidth;return p3(n)});return b.useEffect(()=>{const n=()=>{const r=document.documentElement.clientWidth;e(p3(r))};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}function p3(t){return t>=1512?24:t>=1280?28:t>=1024?32:35}const JUe={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},TF=b.createContext(JUe);function $F(){return b.useContext(TF)}const KUe=b.lazy(()=>Promise.resolve().then(()=>require("./replay-AiPanel-IRetnmbM.js")).then(t=>({default:t.AiPanel}))),eBe=20,tBe=25,nBe=40;function rBe({panel:t,panelProps:e}){const[n,r]=b.useState(!1),{layout:i,aiEnabled:s}=Un(),o=HUe(),{isOpen:a,openPanel:l,closePanel:c}=$F(),{panelProps:u,panel:f}=h0(!a),h=s===!0,p=i==="overlay",{onCollapse:m,onExpand:g,...O}=u;return b.useEffect(()=>{a&&f.isCollapsed&&f.expand(),!a&&!f.isCollapsed&&f.collapse()},[f,a]),i==="preview"?d.jsx(Lh,{hideTabs:!0}):p?d.jsx(h3,{children:d.jsxs(g3,{direction:"horizontal",autoSaveId:"replay-layout-overlay",children:[d.jsx(Bf,{id:"main-panel",defaultSize:75,minSize:55,$isResizing:n,children:d.jsx(Lh,{})}),d.jsx(Mh,{direction:"vertical",onDragging:r}),d.jsx(Bf,{id:"content-panel",defaultSize:30,minSize:o,...e,$isResizing:n,children:d.jsx(f3,{isOverlayLayout:p})}),d.jsx(u3,{panel:t,isOverlayLayout:p})]})}):d.jsx(h3,{children:d.jsxs(g3,{direction:"horizontal",autoSaveId:"replay-layout",children:[d.jsx(u3,{panel:t,isOverlayLayout:p}),d.jsx(Bf,{id:"content-panel",defaultSize:30,minSize:o,...e,$isResizing:n,children:d.jsx(f3,{isOverlayLayout:p})}),d.jsx(Mh,{direction:"vertical",onDragging:r}),d.jsx(Bf,{id:"main-panel",defaultSize:70,minSize:nBe,$isResizing:n,children:d.jsx(Lh,{})}),h&&d.jsxs(d.Fragment,{children:[d.jsx(Mh,{direction:"vertical",onDragging:r}),d.jsx(Bf,{...O,id:"ai-panel",defaultSize:a?tBe:0,collapsedSize:0,minSize:eBe,maxSize:50,$isResizing:n,onCollapse:()=>{m?.(),c()},onExpand:()=>{g?.(),l()},children:d.jsx(b.Suspense,{fallback:null,children:d.jsx(KUe,{})})})]})]})})}const g3=C.default(f0)`
6980
+ `;function h3({children:t}){const e=rf(),{sendEvent:n}=Be(),{tabsParams:r}=N0(e,!1),[i,s]=b.useState(r[0]?.key||null),o=b.useCallback(l=>{s(l),n("com.redocly.tab.change",[{...Oe("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a={tabsParams:r,activeTab:i,onTabChange:o};return d.jsx(PF.Provider,{value:a,children:t})}function HUe(){const[t,e]=b.useState(()=>{const n=document.documentElement.clientWidth;return p3(n)});return b.useEffect(()=>{const n=()=>{const r=document.documentElement.clientWidth;e(p3(r))};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}function p3(t){return t>=1512?24:t>=1280?28:t>=1024?32:35}const JUe={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},TF=b.createContext(JUe);function $F(){return b.useContext(TF)}const KUe=b.lazy(()=>Promise.resolve().then(()=>require("./replay-AiPanel-DYVgRVdG.js")).then(t=>({default:t.AiPanel}))),eBe=20,tBe=25,nBe=40;function rBe({panel:t,panelProps:e}){const[n,r]=b.useState(!1),{layout:i,aiEnabled:s}=Un(),o=HUe(),{isOpen:a,openPanel:l,closePanel:c}=$F(),{panelProps:u,panel:f}=h0(!a),h=s===!0,p=i==="overlay",{onCollapse:m,onExpand:g,...O}=u;return b.useEffect(()=>{a&&f.isCollapsed&&f.expand(),!a&&!f.isCollapsed&&f.collapse()},[f,a]),i==="preview"?d.jsx(Lh,{hideTabs:!0}):p?d.jsx(h3,{children:d.jsxs(g3,{direction:"horizontal",autoSaveId:"replay-layout-overlay",children:[d.jsx(Bf,{id:"main-panel",defaultSize:75,minSize:55,$isResizing:n,children:d.jsx(Lh,{})}),d.jsx(Mh,{direction:"vertical",onDragging:r}),d.jsx(Bf,{id:"content-panel",defaultSize:30,minSize:o,...e,$isResizing:n,children:d.jsx(f3,{isOverlayLayout:p})}),d.jsx(u3,{panel:t,isOverlayLayout:p})]})}):d.jsx(h3,{children:d.jsxs(g3,{direction:"horizontal",autoSaveId:"replay-layout",children:[d.jsx(u3,{panel:t,isOverlayLayout:p}),d.jsx(Bf,{id:"content-panel",defaultSize:30,minSize:o,...e,$isResizing:n,children:d.jsx(f3,{isOverlayLayout:p})}),d.jsx(Mh,{direction:"vertical",onDragging:r}),d.jsx(Bf,{id:"main-panel",defaultSize:70,minSize:nBe,$isResizing:n,children:d.jsx(Lh,{})}),h&&d.jsxs(d.Fragment,{children:[d.jsx(Mh,{direction:"vertical",onDragging:r}),d.jsx(Bf,{...O,id:"ai-panel",defaultSize:a?tBe:0,collapsedSize:0,minSize:eBe,maxSize:50,$isResizing:n,onCollapse:()=>{m?.(),c()},onExpand:()=>{g?.(),l()},children:d.jsx(b.Suspense,{fallback:null,children:d.jsx(KUe,{})})})]})]})})}const g3=C.default(f0)`
6981
6981
  padding: 0 var(--spacing-xs);
6982
6982
  `,Bf=C.default(Rd)`
6983
6983
  transition-property: ${t=>t.$isResizing?"none":"flex-grow"};
@@ -6987,7 +6987,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
6987
6987
  @media (prefers-reduced-motion: reduce) {
6988
6988
  transition-duration: 0s;
6989
6989
  }
6990
- `,iBe=b.lazy(()=>Promise.resolve().then(()=>require("./replay-AiChatProvider-B1_-wlJK.js")).then(t=>({default:t.AiChatProvider}))),sBe=({className:t,renderProjectSelect:e})=>{const{isMobile:n,closeButton:r}=Xs(),i=h0(!1),{layout:s,aiEnabled:o}=Un(),a=Xq(),l=s==="preview",c=o===!0,u=a?d.jsx(DUe,{error:a}):null,f=n?u||d.jsx(PUe,{}):d.jsxs(d.Fragment,{children:[!l&&d.jsx(Rqe,{}),u||d.jsx(rBe,{panel:i.panel,panelProps:i.panelProps})]});return d.jsxs(d.Fragment,{children:[!n&&!l&&r,d.jsx(aBe,{className:t,isPreviewLayout:l,children:d.jsx(rF,{onError:h=>console.error(h),children:d.jsx(jUe,{children:d.jsx(_Ue,{renderProjectSelect:e,children:c?d.jsx(b.Suspense,{fallback:null,children:d.jsx(iBe,{children:f})}):f})})})})]})};function IF({className:t,renderProjectSelect:e}){return d.jsx(sBe,{className:t,renderProjectSelect:e})}function oBe({className:t,renderProjectSelect:e}){return d.jsx(CF,{children:d.jsx(IF,{className:t,renderProjectSelect:e})})}const aBe=C.default.div`
6990
+ `,iBe=b.lazy(()=>Promise.resolve().then(()=>require("./replay-AiChatProvider-6XfGmlMO.js")).then(t=>({default:t.AiChatProvider}))),sBe=({className:t,renderProjectSelect:e})=>{const{isMobile:n,closeButton:r}=Xs(),i=h0(!1),{layout:s,aiEnabled:o}=Un(),a=Xq(),l=s==="preview",c=o===!0,u=a?d.jsx(DUe,{error:a}):null,f=n?u||d.jsx(PUe,{}):d.jsxs(d.Fragment,{children:[!l&&d.jsx(Rqe,{}),u||d.jsx(rBe,{panel:i.panel,panelProps:i.panelProps})]});return d.jsxs(d.Fragment,{children:[!n&&!l&&r,d.jsx(aBe,{className:t,isPreviewLayout:l,children:d.jsx(rF,{onError:h=>console.error(h),children:d.jsx(jUe,{children:d.jsx(_Ue,{renderProjectSelect:e,children:c?d.jsx(b.Suspense,{fallback:null,children:d.jsx(iBe,{children:f})}):f})})})})]})};function IF({className:t,renderProjectSelect:e}){return d.jsx(sBe,{className:t,renderProjectSelect:e})}function oBe({className:t,renderProjectSelect:e}){return d.jsx(CF,{children:d.jsx(IF,{className:t,renderProjectSelect:e})})}const aBe=C.default.div`
6991
6991
  display: flex;
6992
6992
  flex-direction: column;
6993
6993
  height: 100vh;
@@ -7023,4 +7023,4 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
7023
7023
  @media (max-width: ${Ar}px) {
7024
7024
  width: 100vw;
7025
7025
  }
7026
- `;async function xBe(t,e,n,r){const{validateApiKey:i}=await Promise.resolve().then(()=>require("./replay-validate-key-BQB45O00.js"));return i(t,e,n,r)}async function SBe(){return(await Promise.resolve().then(()=>require("./replay-agent-loop-BB-UIrKo.js"))).AgentLoop}exports.AI_PROVIDERS=Dq;exports.AiChatContext=Mq;exports.AiChatServiceFactory=fk;exports.AiPanelContext=TF;exports.Builder=Di;exports.CriterionType=lr;exports.DEFAULT_ENVIRONMENTS=NT;exports.DEFAULT_MAX_RETRIES=ESe;exports.DEFAULT_MAX_STEPS=ISe;exports.Divider=it;exports.EmbeddedReplay=kqe;exports.GRANT_TYPE_MAP=axe;exports.ItemState=$t;exports.JsonPointerLib=mp;exports.MAX_OUTPUT_TOKENS_FOR_VALIDATION=QSe;exports.Markdown=lB;exports.Modal=cs;exports.OAUTH2_SECURITY=gP;exports.PathUtils=qt;exports.REDOCLY_CONFIG_FILE_NAMES=TCe;exports.REPLAY_CHANGE_PREVIEW_SNAPSHOT_KEY=jSe;exports.REPLAY_ENVIRONMENTS_SECTION_PATH=ACe;exports.REPLAY_MESSAGE_METADATA_NS=RSe;exports.REQUEST_METHODS=Zd;exports.REUNITE_AI_PROVIDER=tI;exports.REUNITE_MODEL_OPTION=$P;exports.Replay=OBe;exports.ReplayOverlay=yBe;exports.RootStorage=r6;exports.SECRET_MASK=BI;exports.SecurityFlows=re;exports.SecurityTypes=J;exports.SourceType=ai;exports.StyledSpinner=k$;exports.TAB_NAMES=He;exports.TOOL_CALL_MESSAGES_TO_KEEP=ASe;exports.TabDataType=De;exports.TabState=hn;exports.TelemetryClient=l7;exports.TextContentType=$n;exports.VerticalDivider=Le;exports.activeEnvironmentIdAtom=Is;exports.activeTabAtom=Pk;exports.activeTabIdxAtom=Ii;exports.aiChatKeys=hF;exports.apiUrlToApiId=cZ;exports.apisAtom=Ui;exports.applyThemeToDOM=O_e;exports.bgRed=Mce;exports.blue=_ce;exports.bold=Ice;exports.bytesToHex=Vp;exports.clearNotificationsForSource=xy;exports.cloneObject=Ro;exports.collectionsAtom=Ts;exports.context=Io;exports.createResource=Oe;exports.createTabFromOperation=eI;exports.dayjs=Wg;exports.defaultAiChatContextValue=Nq;exports.dim=Ece;exports.dirname=bq;exports.environmentsAtom=Cr;exports.evaluateRuntimeExpression=yl;exports.evaluateRuntimeExpressionPayload=kh;exports.exists=K$;exports.extname=xq;exports.fetch=Ao;exports.findCollection=Td;exports.findStep=wg;exports.findWorkflow=Sg;exports.getAPIKeyLocation=fZ;exports.getActiveTab=KY;exports.getActiveTabIndex=eG;exports.getApiOperationFromStore=Xb;exports.getCurrentTheme=S0;exports.getDefaultExportFromCjs=Ia;exports.getEmptyCriterionObject=B7;exports.getEmptyRequestParameter=dy;exports.getEmptySingleSecurity=fs;exports.getNewCollection=$I;exports.getNewStep=jo;exports.getNewWorkflow=X$;exports.getOperationsList=aq;exports.getSelectedEnvironment=Lc;exports.getStepFailures=gLe;exports.getStepForActiveStepTab=Xxe;exports.getStepMethod=xl;exports.getStepUrl=Ep;exports.getValueFromContext=pp;exports.getWorkflowRunVerdict=pE;exports.gray=Nce;exports.green=Rce;exports.hasAllStepPassed=hE;exports.inverse=Qce;exports.invoke=Ze;exports.isAbsolute=Sq;exports.isAbsoluteUrl=c7;exports.isInlineRequestParameter=hg;exports.isPlainObject=Hd;exports.isRedoclyConfigFile=ICe;exports.isReservedEnvironmentFileKey=bl;exports.isStepTab=Wxe;exports.isTabType=an;exports.isTauriApp=On;exports.isWebUrl=Ki;exports.join=F$;exports.loadAgentLoop=SBe;exports.loadAndBundleDefinition=gy;exports.makeProviderRecord=_Se;exports.makeRequest=xB;exports.markdownParserMarked=aB;exports.maskSecretsInText=ff;exports.md5=T0;exports.mergeUrlParametersWithPreviousParameters=LT;exports.mkdir=Cq;exports.module=$V;exports.path=TC;exports.pathBrowserifyExports=Ha;exports.readDir=Pq;exports.readTextFile=J$;exports.red=Dr;exports.remove=Tq;exports.removeCollection=b7;exports.removeStep=dP;exports.removeWorkflow=uP;exports.rename=$q;exports.reportParseError=by;exports.requireFastDeepEqual=EV;exports.resolve=yq;exports.resolvePath=Yce;exports.resolveTheme=m_e;exports.resolveWorkflowReference=jV;exports.sep=vq;exports.sha256=OB;exports.stringToQueryParameters=Pg;exports.tabStepUidsMatch=qxe;exports.tabsAtom=Ir;exports.toCompactJson=Txe;exports.trace=zr;exports.transformCallback=gq;exports.tty=IV;exports.ulid=Pp;exports.underline=Ace;exports.updateCollection=ii;exports.updateStep=Db;exports.updateTabDataAt=tG;exports.updateWorkflow=Fi;exports.useActiveTab=ka;exports.useAiChatContext=Tg;exports.useAiPanel=$F;exports.useApiOperationGetter=q$;exports.useApis=Vs;exports.useAtomValue=ir;exports.useCollectionActions=Vc;exports.useCollections=Yr;exports.useRunWorkflow=L8;exports.useSettings=di;exports.useSettingsContext=Un;exports.useStore=Pa;exports.useTabHandlers=Ln;exports.useTelemetry=Be;exports.useTelemetryClient=zbe;exports.validateApiKey=xBe;exports.validateEnvironmentName=kE;exports.white=Dce;exports.writeTextFile=Iq;exports.yaml=Sl;exports.yellow=jce;
7026
+ `;async function xBe(t,e,n,r){const{validateApiKey:i}=await Promise.resolve().then(()=>require("./replay-validate-key-BY6-63zj.js"));return i(t,e,n,r)}async function SBe(){return(await Promise.resolve().then(()=>require("./replay-agent-loop-DgP7lcS9.js"))).AgentLoop}exports.AI_PROVIDERS=Dq;exports.AiChatContext=Mq;exports.AiChatServiceFactory=fk;exports.AiPanelContext=TF;exports.Builder=Di;exports.CriterionType=lr;exports.DEFAULT_ENVIRONMENTS=NT;exports.DEFAULT_MAX_RETRIES=ESe;exports.DEFAULT_MAX_STEPS=ISe;exports.Divider=it;exports.EmbeddedReplay=kqe;exports.GRANT_TYPE_MAP=axe;exports.ItemState=$t;exports.JsonPointerLib=mp;exports.MAX_OUTPUT_TOKENS_FOR_VALIDATION=QSe;exports.Markdown=lB;exports.Modal=cs;exports.OAUTH2_SECURITY=gP;exports.PathUtils=qt;exports.REDOCLY_CONFIG_FILE_NAMES=TCe;exports.REPLAY_CHANGE_PREVIEW_SNAPSHOT_KEY=jSe;exports.REPLAY_ENVIRONMENTS_SECTION_PATH=ACe;exports.REPLAY_MESSAGE_METADATA_NS=RSe;exports.REQUEST_METHODS=Zd;exports.REUNITE_AI_PROVIDER=tI;exports.REUNITE_MODEL_OPTION=$P;exports.Replay=OBe;exports.ReplayOverlay=yBe;exports.RootStorage=r6;exports.SECRET_MASK=BI;exports.SecurityFlows=re;exports.SecurityTypes=J;exports.SourceType=ai;exports.StyledSpinner=k$;exports.TAB_NAMES=He;exports.TOOL_CALL_MESSAGES_TO_KEEP=ASe;exports.TabDataType=De;exports.TabState=hn;exports.TelemetryClient=l7;exports.TextContentType=$n;exports.VerticalDivider=Le;exports.activeEnvironmentIdAtom=Is;exports.activeTabAtom=Pk;exports.activeTabIdxAtom=Ii;exports.aiChatKeys=hF;exports.apiUrlToApiId=cZ;exports.apisAtom=Ui;exports.applyThemeToDOM=O_e;exports.bgRed=Mce;exports.blue=_ce;exports.bold=Ice;exports.bytesToHex=Vp;exports.clearNotificationsForSource=xy;exports.cloneObject=Ro;exports.collectionsAtom=Ts;exports.context=Io;exports.createResource=Oe;exports.createTabFromOperation=eI;exports.dayjs=Wg;exports.defaultAiChatContextValue=Nq;exports.dim=Ece;exports.dirname=bq;exports.environmentsAtom=Cr;exports.evaluateRuntimeExpression=yl;exports.evaluateRuntimeExpressionPayload=kh;exports.exists=K$;exports.extname=xq;exports.fetch=Ao;exports.findCollection=Td;exports.findStep=wg;exports.findWorkflow=Sg;exports.getAPIKeyLocation=fZ;exports.getActiveTab=KY;exports.getActiveTabIndex=eG;exports.getApiOperationFromStore=Xb;exports.getCurrentTheme=S0;exports.getDefaultExportFromCjs=Ia;exports.getEmptyCriterionObject=B7;exports.getEmptyRequestParameter=dy;exports.getEmptySingleSecurity=fs;exports.getNewCollection=$I;exports.getNewStep=jo;exports.getNewWorkflow=X$;exports.getOperationsList=aq;exports.getSelectedEnvironment=Lc;exports.getStepFailures=gLe;exports.getStepForActiveStepTab=Xxe;exports.getStepMethod=xl;exports.getStepUrl=Ep;exports.getValueFromContext=pp;exports.getWorkflowRunVerdict=pE;exports.gray=Nce;exports.green=Rce;exports.hasAllStepPassed=hE;exports.inverse=Qce;exports.invoke=Ze;exports.isAbsolute=Sq;exports.isAbsoluteUrl=c7;exports.isInlineRequestParameter=hg;exports.isPlainObject=Hd;exports.isRedoclyConfigFile=ICe;exports.isReservedEnvironmentFileKey=bl;exports.isStepTab=Wxe;exports.isTabType=an;exports.isTauriApp=On;exports.isWebUrl=Ki;exports.join=F$;exports.loadAgentLoop=SBe;exports.loadAndBundleDefinition=gy;exports.makeProviderRecord=_Se;exports.makeRequest=xB;exports.markdownParserMarked=aB;exports.maskSecretsInText=ff;exports.md5=T0;exports.mergeUrlParametersWithPreviousParameters=LT;exports.mkdir=Cq;exports.module=$V;exports.path=TC;exports.pathBrowserifyExports=Ha;exports.readDir=Pq;exports.readTextFile=J$;exports.red=Dr;exports.remove=Tq;exports.removeCollection=b7;exports.removeStep=dP;exports.removeWorkflow=uP;exports.rename=$q;exports.reportParseError=by;exports.requireFastDeepEqual=EV;exports.resolve=yq;exports.resolvePath=Yce;exports.resolveTheme=m_e;exports.resolveWorkflowReference=jV;exports.sep=vq;exports.sha256=OB;exports.stringToQueryParameters=Pg;exports.tabStepUidsMatch=qxe;exports.tabsAtom=Ir;exports.toCompactJson=Txe;exports.trace=zr;exports.transformCallback=gq;exports.tty=IV;exports.ulid=Pp;exports.underline=Ace;exports.updateCollection=ii;exports.updateStep=Db;exports.updateTabDataAt=tG;exports.updateWorkflow=Fi;exports.useActiveTab=ka;exports.useAiChatContext=Tg;exports.useAiPanel=$F;exports.useApiOperationGetter=q$;exports.useApis=Vs;exports.useAtomValue=ir;exports.useCollectionActions=Vc;exports.useCollections=Yr;exports.useRunWorkflow=L8;exports.useSettings=di;exports.useSettingsContext=Un;exports.useStore=Pa;exports.useTabHandlers=Ln;exports.useTelemetry=Be;exports.useTelemetryClient=zbe;exports.validateApiKey=xBe;exports.validateEnvironmentName=kE;exports.white=Dce;exports.writeTextFile=Iq;exports.yaml=Sl;exports.yellow=jce;