@redocly/replay 0.30.0-next.9 → 0.30.0

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 (58) hide show
  1. package/dist/{replay-AiChatProvider-V-vhKDxd.js → replay-AiChatProvider-CXLNIcfY.js} +6 -6
  2. package/dist/{replay-AiChatProvider-Cc1MYhNY.js → replay-AiChatProvider-DT3Egull.js} +1 -1
  3. package/dist/{replay-AiChatSqliteDBStorage-D3ABpus1.js → replay-AiChatSqliteDBStorage-DxeQj8Ji.js} +1 -1
  4. package/dist/{replay-AiChatSqliteDBStorage-DbuX33xq.js → replay-AiChatSqliteDBStorage-WVrs0IxC.js} +1 -1
  5. package/dist/{replay-AiPanel-C-_dfvYm.js → replay-AiPanel-3Lx6Liqa.js} +4 -4
  6. package/dist/{replay-AiPanel-DmxeL5Rf.js → replay-AiPanel-CXwPR7FC.js} +1 -1
  7. package/dist/{replay-FileWatcher-DzZhHEsP.js → replay-FileWatcher-CRqPa1oy.js} +1 -1
  8. package/dist/{replay-FileWatcher-DQayB_oR.js → replay-FileWatcher-DtPS3QVb.js} +2 -2
  9. package/dist/{replay-SemanticSearchService-C62OWDmC.js → replay-SemanticSearchService-BObzVsce.js} +1 -1
  10. package/dist/{replay-SemanticSearchService-KsRtLg0N.js → replay-SemanticSearchService-CDZxWaXg.js} +1 -1
  11. package/dist/{replay-SqliteDBStorage-Q03jo_lb.js → replay-SqliteDBStorage-CW42QHKM.js} +1 -1
  12. package/dist/{replay-SqliteDBStorage-CwK7K4cj.js → replay-SqliteDBStorage-DFswOoxk.js} +1 -1
  13. package/dist/{replay-TauriFileSystemAdapter-8vltlDfs.js → replay-TauriFileSystemAdapter-BwPAJXJU.js} +1 -1
  14. package/dist/{replay-TauriFileSystemAdapter-D1On4ntI.js → replay-TauriFileSystemAdapter-VW4nQJx3.js} +1 -1
  15. package/dist/{replay-TauriRootStorage-xFPjroQC.js → replay-TauriRootStorage-CV796F4B.js} +1 -1
  16. package/dist/{replay-TauriRootStorage-Itj7idaX.js → replay-TauriRootStorage-PDk2VJTL.js} +2 -2
  17. package/dist/{replay-agent-loop-rEld9oF-.js → replay-agent-loop-CrhqM5jp.js} +1 -1
  18. package/dist/{replay-agent-loop-1nHq9jnv.js → replay-agent-loop-DeChBPFl.js} +3 -3
  19. package/dist/{replay-ai-chat-mappers-DNfpJk85.js → replay-ai-chat-mappers-Bbi5qQnY.js} +1 -1
  20. package/dist/{replay-ai-chat-mappers-CZc31P4G.js → replay-ai-chat-mappers-BfSVq04m.js} +1 -1
  21. package/dist/{replay-create-model-D2PYVWYc.js → replay-create-model-BH_OQyM4.js} +3 -3
  22. package/dist/{replay-create-model-DcMU3Yxm.js → replay-create-model-CNUCimar.js} +3 -3
  23. package/dist/{replay-db-CFqFU1D2.js → replay-db-Dw3J7B4-.js} +1 -1
  24. package/dist/{replay-db-BZWPVXvS.js → replay-db-kOEFM7we.js} +1 -1
  25. package/dist/{replay-external-resolver-Dz9QqU4-.js → replay-external-resolver-DRERucjM.js} +1 -1
  26. package/dist/{replay-external-resolver-CI7sZxO3.js → replay-external-resolver-iYXwhjgN.js} +2 -2
  27. package/dist/{replay-index-CdLLebq6.js → replay-index-BNWwUamJ.js} +5 -5
  28. package/dist/{replay-index-BfiGpjV0.js → replay-index-BmAT6NH8.js} +1 -1
  29. package/dist/replay-index-CEzZ-nNg.js +4 -0
  30. package/dist/{replay-index-DMy5OBRE.js → replay-index-COdtZP45.js} +1 -1
  31. package/dist/{replay-index-DgTXgzAv.js → replay-index-CcB9D4eO.js} +27 -27
  32. package/dist/{replay-index-Cp0wQDgB.js → replay-index-CgMBbjl1.js} +1 -1
  33. package/dist/{replay-index-DSNoVX-p.js → replay-index-CwuYslX9.js} +16 -16
  34. package/dist/{replay-index-B_pYgKvz.js → replay-index-DaDM-o0F.js} +1 -1
  35. package/dist/{replay-index-BU0VNqJi.js → replay-index-TBsL9E-2.js} +1 -1
  36. package/dist/{replay-index-COk-TAX_.js → replay-index-eMgUixYk.js} +1 -1
  37. package/dist/{replay-index-BxakPLws.js → replay-index-hS-IPRQ5.js} +1 -1
  38. package/dist/{replay-index-D80fZ6cK.js → replay-index-m5iBbg-4.js} +1 -1
  39. package/dist/{replay-lint-BkctMZa_.js → replay-lint-CF99Iyje.js} +3 -3
  40. package/dist/{replay-lint-rCLmOycv.js → replay-lint-CaxOqxP-.js} +3 -3
  41. package/dist/{replay-lint-graphql-BGffGPIm.js → replay-lint-graphql-DwLEV5ID.js} +1 -1
  42. package/dist/{replay-lint-graphql-D3uY3Q9Q.js → replay-lint-graphql-UIkqcOe5.js} +2 -2
  43. package/dist/{replay-periodic-revalidation-Bi31UOvh.js → replay-periodic-revalidation-D0eDYez9.js} +1 -1
  44. package/dist/{replay-periodic-revalidation-BgUjxDxQ.js → replay-periodic-revalidation-DlW--kpo.js} +1 -1
  45. package/dist/{replay-resolve-B-14UldE.js → replay-resolve-Cmty1rPE.js} +1 -1
  46. package/dist/{replay-resolve-DACGscxu.js → replay-resolve-Cr6pQfRb.js} +1 -1
  47. package/dist/{replay-respect-run-CK8L1S-l.js → replay-respect-run-Df-HooUy.js} +1 -1
  48. package/dist/{replay-respect-run-CpYF1niv.js → replay-respect-run-DvUQJ4xs.js} +3 -3
  49. package/dist/{replay-tauri-path-CvHb2p4I.js → replay-tauri-path-CoJ56WRW.js} +2 -2
  50. package/dist/{replay-tauri-path-B8kon_Ur.js → replay-tauri-path-Co_LYqH4.js} +1 -1
  51. package/dist/{replay-useAiChatQueries-D2ikp2U7.js → replay-useAiChatQueries-DueDJeFu.js} +4 -4
  52. package/dist/{replay-useAiChatQueries-hHUMQ7YP.js → replay-useAiChatQueries-XWel_Kbw.js} +1 -1
  53. package/dist/{replay-validate-key-BxGJ5w4v.js → replay-validate-key-BpTzarpC.js} +2 -2
  54. package/dist/{replay-validate-key-BhXLTBqe.js → replay-validate-key-DIcOkWYk.js} +1 -1
  55. package/dist/replay.cjs +1 -1
  56. package/dist/replay.js +1 -1
  57. package/package.json +2 -2
  58. package/dist/replay-index-CzES_JFv.js +0 -4
@@ -523,7 +523,7 @@ ${j}`,ie=Math.min(A.length,E);let le=0;for(;le<ie-1;le++){const ae=R(String(le),
523
523
  ${L}`,U.pop(),`[${H}]`}let W=Object.keys(A);const q=W.length;if(q===0)return"{}";if(I<U.length+1)return'"[Object]"';j+=M;const B=`,
524
524
  ${j}`;let K="",te="",F=Math.min(q,E);l(A)&&(K+=c(A,B,E),W=W.slice(A.length),F-=A.length,te=B),P&&(W=o(W,k)),U.push(A);for(let H=0;H<F;H++){const J=W[H],ie=R(J,A[J],U,M,j);ie!==void 0&&(K+=`${te}${s(J)}: ${ie}`,te=B)}if(q>E){const H=q-E;K+=`${te}"...": "${m(H)} not stringified"`,te=B}return te!==""&&(K=`
525
525
  ${j}${K}
526
- ${L}`),U.pop(),`{${K}}`}case"number":return isFinite(A)?String(A):y?y(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(A);default:return y?y(A):void 0}}function D(X,A,U){switch(typeof A){case"string":return s(A);case"object":{if(A===null)return"null";if(typeof A.toJSON=="function"){if(A=A.toJSON(X),typeof A!="object")return D(X,A,U);if(A===null)return"null"}if(U.indexOf(A)!==-1)return w;let M="";const j=A.length!==void 0;if(j&&Array.isArray(A)){if(A.length===0)return"[]";if(I<U.length+1)return'"[Array]"';U.push(A);const K=Math.min(A.length,E);let te=0;for(;te<K-1;te++){const H=D(String(te),A[te],U);M+=H!==void 0?H:"null",M+=","}const F=D(String(te),A[te],U);if(M+=F!==void 0?F:"null",A.length-1>E){const H=A.length-E-1;M+=`,"... ${m(H)} not stringified"`}return U.pop(),`[${M}]`}let L=Object.keys(A);const W=L.length;if(W===0)return"{}";if(I<U.length+1)return'"[Object]"';let q="",B=Math.min(W,E);j&&l(A)&&(M+=c(A,",",E),L=L.slice(A.length),B-=A.length,q=","),P&&(L=o(L,k)),U.push(A);for(let K=0;K<B;K++){const te=L[K],F=D(te,A[te],U);F!==void 0&&(M+=`${q}${s(te)}:${F}`,q=",")}if(W>E){const K=W-E;M+=`${q}"...":"${m(K)} not stringified"`}return U.pop(),`{${M}}`}case"number":return isFinite(A)?String(A):y?y(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(A);default:return y?y(A):void 0}}function z(X,A,U){if(arguments.length>1){let M="";if(typeof U=="number"?M=" ".repeat(Math.min(U,10)):typeof U=="string"&&(M=U.slice(0,10)),A!=null){if(typeof A=="function")return Q("",{"":X},[],A,M,"");if(Array.isArray(A))return N("",X,[],g(A),M,"")}if(M.length!==0)return R("",X,[],M,"")}return D("",X,[])}return z}})(qv,qv.exports)),qv.exports}var CIe=TIe();const PIe=Vl(CIe),kIe=PIe.configure;class Qm{static maxErrorTextChars=4096;static stringify=kIe({maximumDepth:2,maximumBreadth:10});sendErrorEvent;originalConsoleError=null;constructor(e){this.sendErrorEvent=e}static toErrorEvent(e,n){return{type:"error",payload:[{handler:n,errorType:this.getErrorType(e),message:this.getErrorMessage(e),stack:this.getErrorStack(e)}]}}enable(){this.originalConsoleError||(window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this.originalConsoleError=console.error,console.error=this.patchConsoleError(this.originalConsoleError))}disable(){this.originalConsoleError&&(window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),console.error=this.originalConsoleError,this.originalConsoleError=null)}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(e){const n=this;return function(...i){try{const s=Qm.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(Qm.toErrorEvent(e,n))}}class fQ{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new dQ,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}),e.otel.enableErrorInstrumentation===!0&&this.otelClient.tracer&&new Qm(n=>{this.sendToOtelService({type:n.type,data:n.payload})}).enable())}withTracer(e){const n=new fQ;return n.config=this.config,n.initialized=this.initialized,n.useCloudEventData=()=>this.useCloudEventData(),n.otelClient=this.otelClient.withTracer(e),n}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 WCe({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=Qm.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)}sendAppLoadedMessage(e,n){this.send("com.redocly.app.loaded",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)}sendParameterEditedMessage(e,n){this.send("com.redocly.parameter.edited",e,n)}}const mE=process.env.NODE_ENV==="development",OV=process.env.NODE_ENV==="production",EIe="0.30.0-next.9",IIe={version:EIe},$Ie={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"},vV="desktop";class w6{_client;_scopedClients=new Map;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new fQ}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(()=>({...$Ie,...e,env:OV?"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||vV,s=r.enableErrorInstrumentation??i==="desktop",o={serviceName:"replay",serviceVersion:IIe.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:OV,enableErrorInstrumentation:s};this._client.init({otel:{...o,...r}}),this.setCloudEventData(n),this._initResolve?.(this),this._isInitialized=!0}getScopedClient(e){this.init(e);const n=e?.tracerName||vV;let r=this._scopedClients.get(n);if(!r){const i=this._client.withTracer(n);r={sendEvent:(s,o)=>this.emitEvent(i,s,o),startSpan:(s,o,a)=>this.emitSpan(i,s,o,a)},this._scopedClients.set(n,r)}return r}sendEvent(e,n){this.emitEvent(this._client,e,n)}startSpan(e,n,r){return this.emitSpan(this._client,e,n,r)}emitEvent(e,n,r){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const i=r.map(s=>({...this._globalAttributes,...s}));mE&&console.log(`[Telemetry] ${n}:`,JSON.stringify(i,null,2));try{e.send(n,i)}catch(s){console.error("Failed to send telemetry event:",s)}}emitSpan(e,n,r,i){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{const s=(r??[{}]).map(o=>({...this._globalAttributes,...o}));return mE&&console.log(`[Telemetry] span ${n}:`,JSON.stringify(s,null,2)),e.startSpan(n,s,i)}catch(s){console.error("Failed to start telemetry span:",s);return}}}const D0=new w6;function Ke(){const{telemetry:t}=Fn(),e=D0.getScopedClient(t),n=t?.cloudEventData;return b.useEffect(()=>{n&&D0.setCloudEventData(n)},[n]),e}const AIe=({awaitInit:t=!0}={})=>{const[e,n]=b.useState(void 0);return b.useEffect(()=>{(async()=>{const i=t?await D0.awaitInit():D0;n(i)})()},[t]),e};function T6(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function OE(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function C6(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function Rn(){return!!window?.__TAURI__}function be(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!Rn()&&(r=C6(window.location.href)),{object:t,id:e,uri:r}}const fi=800,Ts=T.default(ye.Button).attrs({variant:"text",size:"small",tone:"danger"})`
526
+ ${L}`),U.pop(),`{${K}}`}case"number":return isFinite(A)?String(A):y?y(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(A);default:return y?y(A):void 0}}function D(X,A,U){switch(typeof A){case"string":return s(A);case"object":{if(A===null)return"null";if(typeof A.toJSON=="function"){if(A=A.toJSON(X),typeof A!="object")return D(X,A,U);if(A===null)return"null"}if(U.indexOf(A)!==-1)return w;let M="";const j=A.length!==void 0;if(j&&Array.isArray(A)){if(A.length===0)return"[]";if(I<U.length+1)return'"[Array]"';U.push(A);const K=Math.min(A.length,E);let te=0;for(;te<K-1;te++){const H=D(String(te),A[te],U);M+=H!==void 0?H:"null",M+=","}const F=D(String(te),A[te],U);if(M+=F!==void 0?F:"null",A.length-1>E){const H=A.length-E-1;M+=`,"... ${m(H)} not stringified"`}return U.pop(),`[${M}]`}let L=Object.keys(A);const W=L.length;if(W===0)return"{}";if(I<U.length+1)return'"[Object]"';let q="",B=Math.min(W,E);j&&l(A)&&(M+=c(A,",",E),L=L.slice(A.length),B-=A.length,q=","),P&&(L=o(L,k)),U.push(A);for(let K=0;K<B;K++){const te=L[K],F=D(te,A[te],U);F!==void 0&&(M+=`${q}${s(te)}:${F}`,q=",")}if(W>E){const K=W-E;M+=`${q}"...":"${m(K)} not stringified"`}return U.pop(),`{${M}}`}case"number":return isFinite(A)?String(A):y?y(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(A);default:return y?y(A):void 0}}function z(X,A,U){if(arguments.length>1){let M="";if(typeof U=="number"?M=" ".repeat(Math.min(U,10)):typeof U=="string"&&(M=U.slice(0,10)),A!=null){if(typeof A=="function")return Q("",{"":X},[],A,M,"");if(Array.isArray(A))return N("",X,[],g(A),M,"")}if(M.length!==0)return R("",X,[],M,"")}return D("",X,[])}return z}})(qv,qv.exports)),qv.exports}var CIe=TIe();const PIe=Vl(CIe),kIe=PIe.configure;class Qm{static maxErrorTextChars=4096;static stringify=kIe({maximumDepth:2,maximumBreadth:10});sendErrorEvent;originalConsoleError=null;constructor(e){this.sendErrorEvent=e}static toErrorEvent(e,n){return{type:"error",payload:[{handler:n,errorType:this.getErrorType(e),message:this.getErrorMessage(e),stack:this.getErrorStack(e)}]}}enable(){this.originalConsoleError||(window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this.originalConsoleError=console.error,console.error=this.patchConsoleError(this.originalConsoleError))}disable(){this.originalConsoleError&&(window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),console.error=this.originalConsoleError,this.originalConsoleError=null)}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(e){const n=this;return function(...i){try{const s=Qm.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(Qm.toErrorEvent(e,n))}}class fQ{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new dQ,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}),e.otel.enableErrorInstrumentation===!0&&this.otelClient.tracer&&new Qm(n=>{this.sendToOtelService({type:n.type,data:n.payload})}).enable())}withTracer(e){const n=new fQ;return n.config=this.config,n.initialized=this.initialized,n.useCloudEventData=()=>this.useCloudEventData(),n.otelClient=this.otelClient.withTracer(e),n}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 WCe({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=Qm.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)}sendAppLoadedMessage(e,n){this.send("com.redocly.app.loaded",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)}sendParameterEditedMessage(e,n){this.send("com.redocly.parameter.edited",e,n)}}const mE=process.env.NODE_ENV==="development",OV=process.env.NODE_ENV==="production",EIe="0.30.0",IIe={version:EIe},$Ie={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"},vV="desktop";class w6{_client;_scopedClients=new Map;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new fQ}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(()=>({...$Ie,...e,env:OV?"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||vV,s=r.enableErrorInstrumentation??i==="desktop",o={serviceName:"replay",serviceVersion:IIe.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:OV,enableErrorInstrumentation:s};this._client.init({otel:{...o,...r}}),this.setCloudEventData(n),this._initResolve?.(this),this._isInitialized=!0}getScopedClient(e){this.init(e);const n=e?.tracerName||vV;let r=this._scopedClients.get(n);if(!r){const i=this._client.withTracer(n);r={sendEvent:(s,o)=>this.emitEvent(i,s,o),startSpan:(s,o,a)=>this.emitSpan(i,s,o,a)},this._scopedClients.set(n,r)}return r}sendEvent(e,n){this.emitEvent(this._client,e,n)}startSpan(e,n,r){return this.emitSpan(this._client,e,n,r)}emitEvent(e,n,r){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const i=r.map(s=>({...this._globalAttributes,...s}));mE&&console.log(`[Telemetry] ${n}:`,JSON.stringify(i,null,2));try{e.send(n,i)}catch(s){console.error("Failed to send telemetry event:",s)}}emitSpan(e,n,r,i){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{const s=(r??[{}]).map(o=>({...this._globalAttributes,...o}));return mE&&console.log(`[Telemetry] span ${n}:`,JSON.stringify(s,null,2)),e.startSpan(n,s,i)}catch(s){console.error("Failed to start telemetry span:",s);return}}}const D0=new w6;function Ke(){const{telemetry:t}=Fn(),e=D0.getScopedClient(t),n=t?.cloudEventData;return b.useEffect(()=>{n&&D0.setCloudEventData(n)},[n]),e}const AIe=({awaitInit:t=!0}={})=>{const[e,n]=b.useState(void 0);return b.useEffect(()=>{(async()=>{const i=t?await D0.awaitInit():D0;n(i)})()},[t]),e};function T6(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function OE(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function C6(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function Rn(){return!!window?.__TAURI__}function be(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!Rn()&&(r=C6(window.location.href)),{object:t,id:e,uri:r}}const fi=800,Ts=T.default(ye.Button).attrs({variant:"text",size:"small",tone:"danger"})`
527
527
  border: none;
528
528
  margin: 0;
529
529
 
@@ -780,10 +780,10 @@ ${L}`),U.pop(),`{${K}}`}case"number":return isFinite(A)?String(A):y?y(A):"null";
780
780
  border-radius: var(--border-radius);
781
781
  border: 1px solid var(--border-color-primary);
782
782
  padding: 0 calc(var(--spacing-xxs) / 2);
783
- `,jn=(t,e,n=new Set)=>{const r=xQ(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=jn(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 r$e(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function i$e(t,e){const n=Q6(t);if(!n.length)return d.jsx(xV,{children:t});let r=0;const i=n.flatMap(({start:s,end:o})=>{const a=t.slice(r,s),l=r$e(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(xV,{children:i.join("")})}const ko=Dl(Mr([]));ko.debugLabel="collections";function mi(){return $r(ko)}function yS(){const t=Vo();return b.useCallback(()=>t.get(ko),[t])}function CO(t){const e=mi();return Sh(e,t)}function qc(t){const e=mi();return PO(e,t)}function Wa(){const t=Tl(ko);return b.useCallback(e=>t(n=>e(n)),[t])}function s$e(t){const e=Wa();return b.useCallback(n=>e(r=>Xi(r,t,n)),[e,t])}function R6(t){const e=Wa(),{collectionId:n,workflowId:r}=t;return b.useCallback(i=>e(s=>Vs(s,{collectionId:n,workflowId:r},i)),[e,n,r])}function o$e(t){const e=Wa(),{collectionId:n,workflowId:r,stepId:i}=t;return b.useCallback(s=>e(o=>bS(o,{collectionId:n,workflowId:r,stepId:i},s)),[e,n,r,i])}function Sh(t,e){return t.find(n=>n.id===e)??null}function PO(t,{collectionId:e,workflowId:n}){return Sh(t,e)?.workflows.find(i=>i.workflowId===n)??null}function kO(t,{collectionId:e,workflowId:n,stepId:r}){return PO(t,{collectionId:e,workflowId:n})?.steps.find(s=>s.stepId===r)??null}function Xi(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 Vs(t,{collectionId:e,workflowId:n},r){return Xi(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 bS(t,{collectionId:e,workflowId:n,stepId:r},i){return Vs(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 _6(t,e){const n=t.findIndex(r=>r.id===e);return n===-1?t:t.filter((r,i)=>i!==n)}function bE(t,{collectionId:e,workflowId:n}){return Xi(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 xE(t,{collectionId:e,workflowId:n,stepId:r}){return Vs(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 a$e{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 Rm{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-Q03jo_lb.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 xS={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function Tu(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function l$e(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function c$e(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:l$e(t.body,n),header:e,contentType:n,time:t.duration}}async function SQ(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(()=>h0e);for(const{key:i,value:s,active:o}of t)if(!(!i||!s||!o))try{n[i]=r(s,e,xS)}catch{}return n}function u$e(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:Tu(i?.request)??null,response:Tu(i?.response)??null,outputs:Tu(i?.outputs)??{}}))}let j6=0;const SE=new Set;function d$e(){j6+=1;for(const t of SE)t()}function f$e(){return j6}function h$e(t){return SE.add(t),()=>{SE.delete(t)}}const p$e=10080*60*1e3;async function wQ(t){const e=Qo.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:vh(),date:Date.now(),...t}),d$e()}catch(n){console.error("Failed to persist step context:",n)}}async function g$e(t,e,n){if(Qo.getInstance())for(const i of u$e(n,e))await wQ({collectionId:t,workflowId:e,...i})}class Qo{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=Rm.getInstance(),i=new n(r);this.instance=new a$e(i)}static getInstance(){return this.instance}static close(){this.instance=null}}const m$e={__replayClearedOutput:!0};function N6(t){return typeof t=="object"&&t!==null&&t.__replayClearedOutput===!0}async function D6(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 SQ(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))N6(i[o])&&delete i[o];n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function M6(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const O$e=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function TQ(t){const e=new RegExp(O$e),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const v$e=/^\{?\$steps\.([^.{}\s]+)\.(outputs|request|response)\.([^{}\s#]+)(?:#\/([^{}\s]*))?\}?$/;function V6(t){const e=v$e.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 y$e=/^(\{?)(\$steps\.[^.{}\s]+\.(?:request|response)\.[^{}\s#]+)#\/([^{}\s]*)(\}?)$/;function b$e(t,e){const n=y$e.exec(t);if(!n)return;const[,r,i,s,o]=n;if(!!r!=!!o)return;let a;try{a=_c(`${r}${i}${o}`,{$steps:e},xS)}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 M6(l)}function L6(t,e){if(!t||!t.includes("$steps"))return t;const n=TQ(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=b$e(s,e);if(c!==void 0)l=c;else try{const u=M6(_c(s,{$steps:e},xS));u!==void 0&&(l=u)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function z6(t,e,n){const r=PO(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 X6(t,e){if(!t.response)return{hasValue:!1};const n=await SQ([e],{$response:t.response,$request:t.request??void 0});return e.key in n?{hasValue:!0,value:n[e.key]}:{hasValue:!1}}async function x$e(t,e){if(!e)return!1;const n=t.outputs?.[e.key];if(n===void 0||N6(n))return!1;const r=await X6(t,e);return r.hasValue?JSON.stringify(r.value)!==JSON.stringify(n):!1}async function S$e(t,e){return e?(await X6(t,e)).hasValue:!1}const w$e=/\$steps\.([^.\s"'}]+)\./g;function T$e(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(w$e))e.add(n[1]);return[...e]}function CQ(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 T$e(i.join("\0"))}async function SS(t,e,n,r){const i=Qo.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 D6(o,z6(t,e,n)):{}}function Mf(t,e,n){return L6(jn(t,e),n)}const C$e=/[\n\r\t]/g;function U6(t){return t.replace(C$e,"").trim()}function ya(t,e){return t.map(n=>{const r=e.boundNames==="all"||!!e.boundNames?.has(n.name),i=r?`$inputs.${n.name}`:n.example==null?"":U6(String(n.example)),s=n.in==="query"&&(n.example!==void 0||n.allowEmptyValue===!0);return{id:crypto.randomUUID(),key:n.name,value:i,active:r||i!==""||s,in:n.in,...n.allowReserved&&{allowReserved:n.allowReserved}}})}function EO(t,e){const[n]=t.split("?"),r=e.filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${n}${r?`?${r}`:""}`}function IO(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 F6(){return{id:crypto.randomUUID(),...bO}}function P$e(){return{id:crypto.randomUUID(),...bO,description:""}}function V0(t){return{...bO,id:crypto.randomUUID(),in:t}}function k$e(){return{id:crypto.randomUUID(),...bO,type:"text",files:null}}function E$e(){return{id:crypto.randomUUID(),...bO,sendIn:di.URL}}function K1(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function wS(t,e){return t.filter(n=>n.active&&n.value).map(({value:n})=>(e?jn(n,e):n).trim())}function Sc(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 I$e(t,e,n){return t.map(({value:r,...i})=>({...i,value:Mf(r,e,n??{})}))}function $$e(t,e){if(!t.startsWith("$components.parameters."))return null;const n=t.replace("$components.parameters.","");return n&&e[n]||null}function Ln(t=[],e={}){const n=[];for(const r of t)if($u(r)){const i=$$e(r.reference,e);i&&n.push({...i,active:r.active,value:r.value||i.value})}else n.push(r);return n}function lc(t){return Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:n}))}class L0{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 A$e{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 q6{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new A$e(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 W6(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function B6(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function wh(t){return String(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const Z6=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",Q$e=Z6+"\\-\\.\\d·̀-ͯ‿-⁀",G6=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",R$e=G6+"\\-\\.\\d·̀-ͯ҇‿-⁀",Y6=(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)}},_$e=Y6(Z6,Q$e),j$e=Y6(G6,R$e,"u"),N$e=(t="1.0")=>t==="1.1"?j$e:_$e,H6=(t,{xmlVersion:e="1.0"}={})=>N$e(e).qName.test(t),D$e=`
783
+ `,jn=(t,e,n=new Set)=>{const r=xQ(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=jn(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 r$e(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function i$e(t,e){const n=Q6(t);if(!n.length)return d.jsx(xV,{children:t});let r=0;const i=n.flatMap(({start:s,end:o})=>{const a=t.slice(r,s),l=r$e(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(xV,{children:i.join("")})}const ko=Dl(Mr([]));ko.debugLabel="collections";function mi(){return $r(ko)}function yS(){const t=Vo();return b.useCallback(()=>t.get(ko),[t])}function CO(t){const e=mi();return Sh(e,t)}function qc(t){const e=mi();return PO(e,t)}function Wa(){const t=Tl(ko);return b.useCallback(e=>t(n=>e(n)),[t])}function s$e(t){const e=Wa();return b.useCallback(n=>e(r=>Xi(r,t,n)),[e,t])}function R6(t){const e=Wa(),{collectionId:n,workflowId:r}=t;return b.useCallback(i=>e(s=>Vs(s,{collectionId:n,workflowId:r},i)),[e,n,r])}function o$e(t){const e=Wa(),{collectionId:n,workflowId:r,stepId:i}=t;return b.useCallback(s=>e(o=>bS(o,{collectionId:n,workflowId:r,stepId:i},s)),[e,n,r,i])}function Sh(t,e){return t.find(n=>n.id===e)??null}function PO(t,{collectionId:e,workflowId:n}){return Sh(t,e)?.workflows.find(i=>i.workflowId===n)??null}function kO(t,{collectionId:e,workflowId:n,stepId:r}){return PO(t,{collectionId:e,workflowId:n})?.steps.find(s=>s.stepId===r)??null}function Xi(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 Vs(t,{collectionId:e,workflowId:n},r){return Xi(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 bS(t,{collectionId:e,workflowId:n,stepId:r},i){return Vs(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 _6(t,e){const n=t.findIndex(r=>r.id===e);return n===-1?t:t.filter((r,i)=>i!==n)}function bE(t,{collectionId:e,workflowId:n}){return Xi(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 xE(t,{collectionId:e,workflowId:n,stepId:r}){return Vs(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 a$e{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 Rm{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-CW42QHKM.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 xS={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function Tu(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function l$e(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function c$e(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:l$e(t.body,n),header:e,contentType:n,time:t.duration}}async function SQ(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(()=>h0e);for(const{key:i,value:s,active:o}of t)if(!(!i||!s||!o))try{n[i]=r(s,e,xS)}catch{}return n}function u$e(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:Tu(i?.request)??null,response:Tu(i?.response)??null,outputs:Tu(i?.outputs)??{}}))}let j6=0;const SE=new Set;function d$e(){j6+=1;for(const t of SE)t()}function f$e(){return j6}function h$e(t){return SE.add(t),()=>{SE.delete(t)}}const p$e=10080*60*1e3;async function wQ(t){const e=Qo.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:vh(),date:Date.now(),...t}),d$e()}catch(n){console.error("Failed to persist step context:",n)}}async function g$e(t,e,n){if(Qo.getInstance())for(const i of u$e(n,e))await wQ({collectionId:t,workflowId:e,...i})}class Qo{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=Rm.getInstance(),i=new n(r);this.instance=new a$e(i)}static getInstance(){return this.instance}static close(){this.instance=null}}const m$e={__replayClearedOutput:!0};function N6(t){return typeof t=="object"&&t!==null&&t.__replayClearedOutput===!0}async function D6(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 SQ(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))N6(i[o])&&delete i[o];n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function M6(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const O$e=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function TQ(t){const e=new RegExp(O$e),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const v$e=/^\{?\$steps\.([^.{}\s]+)\.(outputs|request|response)\.([^{}\s#]+)(?:#\/([^{}\s]*))?\}?$/;function V6(t){const e=v$e.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 y$e=/^(\{?)(\$steps\.[^.{}\s]+\.(?:request|response)\.[^{}\s#]+)#\/([^{}\s]*)(\}?)$/;function b$e(t,e){const n=y$e.exec(t);if(!n)return;const[,r,i,s,o]=n;if(!!r!=!!o)return;let a;try{a=_c(`${r}${i}${o}`,{$steps:e},xS)}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 M6(l)}function L6(t,e){if(!t||!t.includes("$steps"))return t;const n=TQ(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=b$e(s,e);if(c!==void 0)l=c;else try{const u=M6(_c(s,{$steps:e},xS));u!==void 0&&(l=u)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function z6(t,e,n){const r=PO(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 X6(t,e){if(!t.response)return{hasValue:!1};const n=await SQ([e],{$response:t.response,$request:t.request??void 0});return e.key in n?{hasValue:!0,value:n[e.key]}:{hasValue:!1}}async function x$e(t,e){if(!e)return!1;const n=t.outputs?.[e.key];if(n===void 0||N6(n))return!1;const r=await X6(t,e);return r.hasValue?JSON.stringify(r.value)!==JSON.stringify(n):!1}async function S$e(t,e){return e?(await X6(t,e)).hasValue:!1}const w$e=/\$steps\.([^.\s"'}]+)\./g;function T$e(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(w$e))e.add(n[1]);return[...e]}function CQ(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 T$e(i.join("\0"))}async function SS(t,e,n,r){const i=Qo.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 D6(o,z6(t,e,n)):{}}function Mf(t,e,n){return L6(jn(t,e),n)}const C$e=/[\n\r\t]/g;function U6(t){return t.replace(C$e,"").trim()}function ya(t,e){return t.map(n=>{const r=e.boundNames==="all"||!!e.boundNames?.has(n.name),i=r?`$inputs.${n.name}`:n.example==null?"":U6(String(n.example)),s=n.in==="query"&&(n.example!==void 0||n.allowEmptyValue===!0);return{id:crypto.randomUUID(),key:n.name,value:i,active:r||i!==""||s,in:n.in,...n.allowReserved&&{allowReserved:n.allowReserved}}})}function EO(t,e){const[n]=t.split("?"),r=e.filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${n}${r?`?${r}`:""}`}function IO(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 F6(){return{id:crypto.randomUUID(),...bO}}function P$e(){return{id:crypto.randomUUID(),...bO,description:""}}function V0(t){return{...bO,id:crypto.randomUUID(),in:t}}function k$e(){return{id:crypto.randomUUID(),...bO,type:"text",files:null}}function E$e(){return{id:crypto.randomUUID(),...bO,sendIn:di.URL}}function K1(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function wS(t,e){return t.filter(n=>n.active&&n.value).map(({value:n})=>(e?jn(n,e):n).trim())}function Sc(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 I$e(t,e,n){return t.map(({value:r,...i})=>({...i,value:Mf(r,e,n??{})}))}function $$e(t,e){if(!t.startsWith("$components.parameters."))return null;const n=t.replace("$components.parameters.","");return n&&e[n]||null}function Ln(t=[],e={}){const n=[];for(const r of t)if($u(r)){const i=$$e(r.reference,e);i&&n.push({...i,active:r.active,value:r.value||i.value})}else n.push(r);return n}function lc(t){return Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:n}))}class L0{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 A$e{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 q6{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new A$e(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 W6(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function B6(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function wh(t){return String(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const Z6=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",Q$e=Z6+"\\-\\.\\d·̀-ͯ‿-⁀",G6=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",R$e=G6+"\\-\\.\\d·̀-ͯ҇‿-⁀",Y6=(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)}},_$e=Y6(Z6,Q$e),j$e=Y6(G6,R$e,"u"),N$e=(t="1.0")=>t==="1.1"?j$e:_$e,H6=(t,{xmlVersion:e="1.0"}={})=>N$e(e).qName.test(t),D$e=`
784
784
  `;function M$e(t,e){if(!Array.isArray(t)||t.length===0)return"1.0";const n=t[0];if(PQ(n)==="?xml"){const i=n[":@"];if(i){const s=e.attributeNamePrefix+"version";if(i[s])return i[s]}}return"1.0"}function J6(t,e,n,r,i){return!n.sanitizeName||H6(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}function V$e(t,e){let n="";e.format&&(n=D$e);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 L0(a)):a instanceof L0&&r.push(a)}const i=M$e(t,e),s=new q6;return K6(t,e,n,s,r,i)}function K6(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=wE(l,e),l}return""}for(let l=0;l<t.length;l++){const c=t[l],u=PQ(c);if(u===void 0)continue;const h=u===e.textNodeName||u===e.cdataPropName||u===e.commentPropName||u[0]==="?"?u:J6(u,!1,e,r,s),p=L$e(c[":@"],e);r.push(h,p);const m=X$e(r,i);if(h===e.textNodeName){let y=c[u];m||(y=e.tagValueProcessor(h,y),y=wE(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=B6(y);o+=`<![CDATA[${w}]]>`,a=!1,r.pop();continue}else if(h===e.commentPropName){const y=c[u][0][e.textNodeName],w=W6(y);o+=n+`<!--${w}-->`,a=!0,r.pop();continue}else if(h[0]==="?"){const y=SV(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=SV(c[":@"],e,m,r,s),v=n+`<${h}${O}`;let x;m?x=eG(c[u],e):x=K6(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 L$e(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]=wh(t[i]),r=!0}return r?n:null}function eG(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=PQ(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=z$e(i[":@"],e),a=eG(i[s],e);!a||a.length===0?n+=`<${s}${o}/>`:n+=`<${s}${o}>${a}</${s}>`}}}return n}function z$e(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)}="${wh(i)}"`}return n}function PQ(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 SV(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:J6(a,!0,e,r,i);let c;n?c=t[o]:(c=e.attributeValueProcessor(o,t[o]),c=wE(c,e)),c===!0&&e.suppressBooleanAttributes?s+=` ${l}`:s+=` ${l}="${wh(c)}"`}return s}function X$e(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 wE(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 U$e(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 F$e={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 Hi(t){if(this.options=Object.assign({},F$e,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 L0(n)):n instanceof L0&&this.stopNodeExpressions.push(n)}this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=U$e(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Z$e),this.processTextOrObjNode=W$e,this.options.format?(this.indentate=B$e,this.tagEndChar=`>
785
785
  `,this.newLine=`
786
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function q$e(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 eT(t,e,n,r,i){return!n.sanitizeName||H6(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}Hi.prototype.build=function(t){if(this.options.preserveOrder)return V$e(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new q6,n=q$e(t,this.options);return this.j2x(t,0,e,n).val}};Hi.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:eT(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=eT(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=eT(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}};Hi.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+'="'+wh(e)+'"'};function W$e(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)}Hi.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]=wh(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]=wh(t[r]),n=!0)}return n?e:null};Hi.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};Hi.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};Hi.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}};Hi.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};Hi.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};Hi.prototype.buildTextValNode=function(t,e,n,r,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName){const s=B6(t);return this.indentate(r)+`<![CDATA[${s}]]>`+this.newLine}else if(this.options.commentPropName!==!1&&e===this.options.commentPropName){const s=W6(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}}};Hi.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 B$e(t){return this.options.indentBy.repeat(t)}function Z$e(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}function tG(t){return t.schema}function nG(t){return tG(t)?.fields??[]}function rG(t,e){return t.flatMap(n=>{const r=tG(n),i=r?.fields||[];return i.length>0?i.flatMap(s=>wV(s.name,s.example,n.allowReserved)):wV(n.name,r?.example??n.example,n.allowReserved)})}function wV(t,e,n){if(e===void 0)return[tT(t,"",!1,n)];const r=TE(e,t);return r.length===0?[tT(t,"",!1,n)]:r.map(i=>tT(i.key,i.value,!0,n))}function TE(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((n,r)=>n!==null&&typeof n=="object"?TE(n,`${e}[${r}]`):[{key:e,value:String(n)}]):G$e(t)?Object.entries(t).flatMap(([n,r])=>TE(r,`${e}[${n}]`)):[{key:e,value:String(t)}]}function G$e(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function tT(t,e,n,r){return{id:crypto.randomUUID(),key:t,value:U6(e),active:n,in:"query",...r&&{allowReserved:r}}}const iG={path:"path",query:"query",header:"headers",cookie:"cookie"};function kQ(t){return t!==void 0}function Y$e(t,e){if(t)return hx.isDirectConfigureRequestValues(t)?t:t[e]}function TV(t,e,n){const r=n[iG[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 Vf(t,e,n){if(hx.isDirectConfigureRequestValues(n))return TV(t,e,n);const r=new Set;for(const i of Object.values(n))if(i)for(const s of TV(t,e,i))r.add(s);return r}function CV(t,e,n){const r=n.query,i=n.envVariables;for(const s of e??[]){const o=nG(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 sG(t,e,n){const r=[...t??[],...e??[]],i=new Set(Vf(r,"query",n));if(hx.isDirectConfigureRequestValues(n))return CV(i,e,n),i;for(const s of Object.values(n))s&&CV(i,e,s);return i}function EQ(t=[],e){const n={};return t.forEach(r=>{const i=String(r[e]);n[i]||(n[i]=[]),n[i].push(r)}),n}function H$e(t){return t.replace(/{/g,"{{").replace(/}/g,"}}")}var Os=(t=>(t.Query="Query",t.Header="Header",t.Cookie="Cookie",t))(Os||{});const CE={documentedOAuth2Types:[],grantType:oe.ClientCredentials,authRequestExtraParams:[],tokenRequestExtraParams:[],[oe.ClientCredentials]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[oe.ClientCredentialsWithJwtAssertion]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[oe.AuthorizationCode]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[oe.AuthorizationCodeWithPkce]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[oe.Implicit]:{clientId:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],accessToken:""},[oe.Password]:{username:"",password:"",clientId:"",clientSecret:"",tokenUrl:"",accessToken:"",scopes:[]}},J$e={securityType:ne.NoAuth,securitySchemeId:null,[ne.BasicAuth]:{username:"",password:""},[ne.JWT]:{token:""},[ne.DigestAuth]:{username:"",password:"",nc:"00000001",realm:"",nonce:"",opaque:"",qop:"",algorithm:"",cnonce:""},[ne.APIKey]:{location:Os.Header,name:"",key:""},[ne.OAuth2]:CE,[ne.OpenIDConnect]:{...CE,openIdConnectUrl:"",userInfoUrl:""}},K$e={clientCredentials:oe.ClientCredentials,clientCredentialsWithJwtAssertion:oe.ClientCredentialsWithJwtAssertion,authorizationCode:oe.AuthorizationCode,authorizationCodeWithPkce:oe.AuthorizationCodeWithPkce,implicit:oe.Implicit,password:oe.Password},z0="urn:ietf:params:oauth:client-assertion-type:jwt-bearer";var Ur=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(Ur||{});const eAe={[Ur.SIMPLE]:{condition:"",type:Ur.SIMPLE},[Ur.REGEX]:{condition:"",type:Ur.REGEX,context:""},[Ur.JSONPATH]:{condition:"",type:Ur.JSONPATH,context:""},[Ur.XPATH]:{condition:"",type:Ur.XPATH,context:""}};function Th(){return structuredClone({type:Hn.Text,content:"",activeExampleName:"",formData:{"multipart/form-data":[],"application/x-www-form-urlencoded":[]},binary:null})}const tAe={method:"GET",url:"",security:[lo()],body:Th(),queryParameters:[],headers:[],cookies:[],pathParameters:[]};function oG(){return structuredClone(tAe)}function lo(){return ja(J$e)}function aG(t){return ja({id:crypto.randomUUID(),...eAe[t]})}const nAe=new Hi({cdataPropName:"#cdata"}),rAe=/^[^\\/]+\.[a-z0-9]{1,5}$/i,lG=/^text\/|json|xml|x-www-form-urlencoded/i,iAe=new Set(["$ref","allOf"]);function sAe(t,e,n,r){const i=Ra(r)?r:void 0,s=lAe(i,t);return n&&mAe(n)?aAe(t,e,n,s,i):oAe(t,e,n,s,i)}function oAe(t,e,n,r,i){const s=uG(r,e,i),o=(n?.contentType??"").split(",").map(h=>h.trim()).filter(Boolean),a=o.find(h=>!h.split(";")[0].includes("*")),l=a??o[0],c=Array.isArray(e)?e:[e],u=c.filter(h=>gAe(h,l)),f=fG(n);if(s.binary==="encoded"){const h=hAe(f,s.contentEncoding);return u.map(p=>({key:t,value:Lf(p),file:!1,contentType:a??"application/octet-stream",headers:h}))}return dG(s,c)||o.length>0&&!lG.test(o[0])?c.map(h=>{const p={key:t,value:Lf(h),file:!0};return a&&(p.contentType=a),f&&(p.headers=f),p}):u.map(h=>{const p=o.length===0&&(hG(h)||s.type==="object"||s.type==="array"||s.type===void 0&&typeof h=="string"&&pG(h)),m=a??(p?"application/json":void 0),g={key:t,value:OAe(h,l,s.xmlName??t),file:!1};return m&&(g.contentType=m),f&&(g.headers=f),g})}function aAe(t,e,n,r,i){const s=n.style??"form",o=n.explode??s==="form",a=fG(n),l=(m,g)=>({key:m,value:Lf(g),file:!1,...a&&{headers:a}}),c=pAe(e);if(c===void 0)return[];const u=Array.isArray(c)?c:[c],f=dG(uG(r,c,i),u);if(Array.isArray(c)&&o&&s!=="deepObject")return c.map(m=>({...l(t,m),file:f}));if(!hG(c))return[{...l(t,c),file:f}];const h=s==="spaceDelimited"?" ":s==="pipeDelimited"?"|":",";if(Array.isArray(c))return[l(t,c.map(Lf).join(h))];const p=Object.entries(c);return s==="deepObject"?p.map(([m,g])=>l(`${t}[${m}]`,g)):o?p.map(([m,g])=>l(m,g)):[l(t,p.flatMap(([m,g])=>[m,Lf(g)]).join(h))]}function lAe(t,e){return cG(IQ(t,t).members.map(n=>Ra(n.properties)?n.properties[e]:void 0))}function cAe(t,e){return cG(IQ(t,e).members.map(n=>n.items))}function cG(t){const e=t.filter(Ra);return e.length>1?{allOf:e}:e[0]}function uG(t,e,n){const r=PV(t,n);return Array.isArray(e)||r.type==="array"?PV(cAe(t,n),n):r}function dG(t,e){return t.binary==="raw"||t.emptySchema===!0&&e.every(uAe)}function uAe(t){return t==null||t===""||typeof t=="string"&&rAe.test(t)}function PV(t,e){if(!t)return{};const{members:n,unresolved:r}=IQ(t,e),i=n.map(u=>fAe(u.type)).find(Boolean),s=n.map(u=>Ra(u.xml)?u.xml.name:void 0).find(u=>typeof u=="string"&&u!==""),o=n.map(u=>u.contentEncoding).find(u=>typeof u=="string")??(n.some(u=>u.format==="byte")?"base64":void 0);if(o&&o.toLowerCase()!=="binary")return{type:i,xmlName:s,binary:"encoded",contentEncoding:o};const a=n.map(u=>u.contentMediaType).find(u=>typeof u=="string"),l=o!==void 0||n.some(u=>u.format==="binary")||a!==void 0&&!lG.test(a),c=!r&&n.every(u=>Object.keys(u).every(f=>iAe.has(f)));return{type:i,xmlName:s,...l?{binary:"raw"}:c&&{emptySchema:!0}}}function IQ(t,e){const n=[];let r=!1;const i=s=>{if(!(!Ra(s)||n.includes(s))){if(n.push(s),typeof s.$ref=="string"){const o=dAe(e,s.$ref);o?i(o):r=!0}Array.isArray(s.allOf)&&s.allOf.forEach(i)}};return i(t),{members:n,unresolved:r}}function dAe(t,e){const n="#/components/schemas/";if(!e.startsWith(n))return;const r=Ra(t?.components)?t.components.schemas:void 0,i=Ra(r)?r[ph.unescape(e.slice(n.length))]:void 0;return Ra(i)?i:void 0}function fAe(t){return typeof t=="string"?t:Array.isArray(t)?t.find(e=>typeof e=="string"&&e!=="null"):void 0}function Ra(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function fG(t){const e=Object.entries(t?.headers??{});return e.length>0?Object.fromEntries(e):void 0}function hAe(t,e){const n=t??{};return Object.keys(n).some(r=>r.toLowerCase()==="content-transfer-encoding")?n:{...n,"Content-Transfer-Encoding":e}}function hG(t){return typeof t=="object"&&t!==null}function pAe(t){const e=Array.isArray(t)?t.filter(Vy):Ra(t)?Object.fromEntries(Object.entries(t).filter(([,n])=>Vy(n))):t;return Vy(e)&&!(typeof e=="object"&&Object.keys(e).length===0)?e:void 0}function gAe(t,e){return Vy(t)||e!==void 0&&/json/i.test(e)}function Vy(t){return t!=null}function mAe(t){return t.style!==void 0||t.explode!==void 0||t.allowReserved!==void 0}function Lf(t){return t==null?"":typeof t=="string"?t:JSON.stringify(t)}function OAe(t,e,n){return Ra(t)&&e&&/xml/i.test(e)?nAe.build({[n]:t}):e&&/json/i.test(e)?typeof t=="string"&&pG(t)?t:JSON.stringify(t)??"":Lf(t)}function pG(t){try{const e=JSON.parse(t);return typeof e=="object"&&e!==null}catch{return!1}}function gG(t,e,n,r){if(!t||typeof t!="object")return[];const i=e===Ye.FormData;return Object.entries(t).flatMap(([s,o])=>sAe(s,o,n?.[s],r).map(a=>({id:crypto.randomUUID(),key:a.key,value:a.value,active:!0,type:i&&a.file?"file":"text",files:null,...i&&a.contentType&&{contentType:a.contentType},...i&&a.headers&&{headers:a.headers}})))}function PE(t){return typeof t!="string"?JSON.stringify(t,null,2):t}function mG(t){let e=t;if(typeof e=="string")try{e=JSON.parse(e)}catch{return}if(!e||typeof e!="object"||Array.isArray(e))return;const n=e;return typeof n.query=="string"?n:void 0}function bl(t){const e=mG(t);return e?{query:e.query,variables:e.variables===void 0?"":PE(e.variables)}:{query:PE(t),variables:""}}function X0(t,e){return JSON.stringify({query:t,variables:e})}function OG(t){if(t.trim())try{const e=JSON.parse(t);return typeof e=="string"?t:e}catch{return t}}function vAe(t){const e=mG(t);return!e||typeof e.variables!="string"?t:JSON.stringify({...e,variables:OG(e.variables)},null,2)}function vG(t,e,n){for(const r of n){const i=kV(t,r),s=kV(e,r);if(typeof i=="object"&&typeof s=="object"){if(!vG(i,s,n))return!1}else if(i!==s)return!1}return!0}function kV(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 yAe(t,e){return t.length===e.length&&t.sort().join()===e.sort().join()}function bAe(t,e){return t.every(n=>e.includes(n))}function xAe(t){switch(t){case"query":return Os.Query;case"cookie":return Os.Cookie;case"header":return Os.Header;default:return}}function SAe(t,e,n){const{security:r}=e,i=t?.inputs??[];if(!n)return!1;const s=TS(n),o=s.map(c=>c.securityType),a=r.map(c=>c.securityType);return yAe(o,a)?!r.every(c=>{const u=c.securityType,f=c[ne.OAuth2]?.grantType,h=o.includes(u),p=s.find(v=>v.securityType===u),m=!p||vG(c,p,TAe(u,f)),g=wAe(c,u,c[ne.OAuth2]?.grantType,i),O=!!(h&&p&&m&&g);return!n.security?.length||O}):!0}function wAe(t,e,n,r){if(e===ne.OAuth2&&(n===oe.AuthorizationCode||n===oe.AuthorizationCodeWithPkce||n===oe.Implicit)){const i=t[ne.OAuth2][n]?.availableScopes,s=wS(t[ne.OAuth2][n]?.scopes,r);return bAe(s,i)}return!0}function TAe(t,e){return t===ne.APIKey?[`${ne.APIKey}/name`,`${ne.APIKey}/location`]:t===ne.OAuth2?[`${ne.OAuth2}/grantType`,...CAe(e)]:t===ne.OpenIDConnect?[`${ne.OpenIDConnect}/openIdConnectUrl`]:[]}function CAe(t){return t===oe.ClientCredentials?[`${ne.OAuth2}/${oe.ClientCredentials}/tokenUrl`]:t===oe.Password?[`${ne.OAuth2}/${oe.Password}/tokenUrl`]:t===oe.Implicit?[`${ne.OAuth2}/${oe.Implicit}/authorizationUrl`]:t===oe.AuthorizationCode?[`${ne.OAuth2}/${oe.AuthorizationCode}/tokenUrl`,`${ne.OAuth2}/${oe.AuthorizationCode}/authorizationUrl`]:t===oe.AuthorizationCodeWithPkce?[`${ne.OAuth2}/${oe.AuthorizationCodeWithPkce}/tokenUrl`,`${ne.OAuth2}/${oe.AuthorizationCodeWithPkce}/authorizationUrl`]:[]}function PAe(t){return t.map(e=>{const n=e.map(r=>r.id).join("_");return e.map(r=>({...r,schemeId:n}))})}function kAe(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(AQ(o))}),{id:i,security:s}});return e.length?n:[]}function EAe(t,e){const n=t.security||[];return n?.length?CG(n).map((r,i)=>AQ(r)):[]}function yG(t){if(!(t.securityType!==ne.NoAuth||!t.securitySchemeId))return t.unsupportedScheme}function IAe(t){return t==="mutualTLS"?"scheme needs a client certificate, which the console cannot attach to a request, so this request is sent without one.":"scheme is not supported, so this request is sent without credentials. If your API accepts an Authorization header, you can add it in the Headers tab."}function TS(t){const n=(t.security||[])[0];return n?n.map(r=>AQ(r)):[lo()]}const $Ae={[ne.OAuth2]:"oauth2",[ne.OpenIDConnect]:"openIdConnect",[ne.APIKey]:"apiKey",[ne.JWT]:"http-bearer"};function AAe(t){return $Ae[t]}function QAe(t){const e=$Q(t);return(e?[...cs(e)][0]:void 0)??RAe(t)}function RAe(t){const e=t.securitySchemeId;if(e){if(t.securityType===ne.JWT)return e+rt.SecurityVariablesEnvSuffix.JWTToken;if(t.securityType===ne.APIKey)return e+rt.SecurityVariablesEnvSuffix.APIKey;if(t.securityType===ne.OAuth2||t.securityType===ne.OpenIDConnect)return e+rt.SecurityVariablesEnvSuffix.Token}}function _Ae(t,e){const n=$Q(t);if(!n)return"";const r=[...cs(n)][0];return r?e.find(i=>i.name===r)?.value??"":n}function EV(t,e){if(t.securityType===ne.JWT)return{...t,[ne.JWT]:{...t[ne.JWT],token:e}};if(t.securityType===ne.APIKey)return{...t,[ne.APIKey]:{...t[ne.APIKey],key:e}};if(t.securityType===ne.OAuth2||t.securityType===ne.OpenIDConnect){const n=t.securityType,r=t[n],i=r.grantType;return{...t,[n]:{...r,[i]:{...r[i],accessToken:e}}}}return t}function $Q(t){if(t.securityType===ne.JWT)return t[ne.JWT].token;if(t.securityType===ne.APIKey)return t[ne.APIKey].key;if(t.securityType===ne.OAuth2){const e=t[ne.OAuth2];return e[e.grantType]?.accessToken}if(t.securityType===ne.OpenIDConnect){const e=t[ne.OpenIDConnect];return e[e.grantType]?.accessToken}}function AQ(t,e){const n={...lo(),securitySchemeId:t.id},r=CS(t);n.securityType=r,n.unsupportedScheme=r===ne.NoAuth?t.scheme||t.type:void 0;const i=t.id;if(t.id&&r!==ne.NoAuth&&(n[r].schemeName=t.id),r===ne.BasicAuth&&(n[ne.BasicAuth].username||(n[ne.BasicAuth].username=Dn(i+rt.SecurityVariablesEnvSuffix.Username)),n[ne.BasicAuth].password||(n[ne.BasicAuth].password=Dn(i+rt.SecurityVariablesEnvSuffix.Password))),r===ne.DigestAuth&&(n[ne.DigestAuth].username||(n[ne.DigestAuth].username=Dn(i+rt.SecurityVariablesEnvSuffix.Username)),n[ne.DigestAuth].password||(n[ne.DigestAuth].password=Dn(i+rt.SecurityVariablesEnvSuffix.Password))),r===ne.JWT&&!n[ne.JWT].token&&(n[ne.JWT].token=Dn(i+rt.SecurityVariablesEnvSuffix.JWTToken)),r===ne.APIKey&&!n[ne.APIKey].key){n[ne.APIKey].name=t.name||"",n[ne.APIKey].key=Dn(i+rt.SecurityVariablesEnvSuffix.APIKey);const s=xAe(t.in);s&&(n[ne.APIKey].location=s)}if(r===ne.OAuth2){const s=jQ(t),o=Dn(i+rt.SecurityVariablesEnvSuffix.Token),a=n[ne.OAuth2];a.grantType=s[0],s.forEach(l=>{l===oe.AuthorizationCode&&!a[oe.AuthorizationCode].accessToken&&(a[oe.AuthorizationCode].accessToken=o,a[oe.AuthorizationCode].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.AuthorizationCode].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[oe.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[oe.AuthorizationCode].clientSecret=Dn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.AuthorizationCode].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[oe.AuthorizationCode].scopes=[...lc(t.flows?.authorizationCode?.scopes||{})||[]]),l===oe.AuthorizationCodeWithPkce&&!a[oe.AuthorizationCodeWithPkce].accessToken&&(a[oe.AuthorizationCodeWithPkce].accessToken=o,a[oe.AuthorizationCodeWithPkce].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.AuthorizationCodeWithPkce].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[oe.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[oe.AuthorizationCodeWithPkce].clientSecret=Dn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.AuthorizationCodeWithPkce].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[oe.AuthorizationCodeWithPkce].scopes=[...lc(t.flows?.authorizationCode?.scopes||{})]),l===oe.ClientCredentials&&!a[oe.ClientCredentials].accessToken&&(a[oe.ClientCredentials].accessToken=o,a[oe.ClientCredentials].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.ClientCredentials].clientSecret=Dn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.ClientCredentials].tokenUrl=t.flows?.clientCredentials?.tokenUrl||"",a[oe.ClientCredentials].scopes=[...lc(t.flows?.clientCredentials?.scopes||{})]),l===oe.ClientCredentialsWithJwtAssertion&&!a[oe.ClientCredentialsWithJwtAssertion].accessToken&&(a[oe.ClientCredentialsWithJwtAssertion].accessToken=o,a[oe.ClientCredentialsWithJwtAssertion].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.ClientCredentialsWithJwtAssertion].clientAssertion=Dn(i+rt.SecurityVariablesEnvSuffix.ClientAssertion),a[oe.ClientCredentialsWithJwtAssertion].scopes=[...lc(t.flows?.clientCredentials?.scopes||{})]),l===oe.Implicit&&!a[oe.Implicit].accessToken&&(a[oe.Implicit].accessToken=o,a[oe.Implicit].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.Implicit].authorizationUrl=t.flows?.implicit?.authorizationUrl||"",a[oe.Implicit].availableScopes=Object.keys(t.flows?.implicit?.scopes||{})||[],a[oe.Implicit].scopes=[...lc(t.flows?.implicit?.scopes||{})]),l===oe.Password&&!a[oe.Password].accessToken&&(a[oe.Password].accessToken=o,a[oe.Password].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.Password].clientSecret=Dn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.Password].tokenUrl=t.flows?.password?.tokenUrl||"",a[oe.Password].scopes=[...lc(t.flows?.password?.scopes||{})])})}if(r===ne.OpenIDConnect){const s=Dn(i+rt.SecurityVariablesEnvSuffix.Token),o=n[ne.OpenIDConnect];!o.openIdConnectUrl&&t.openIdConnectUrl&&(o.openIdConnectUrl=t.openIdConnectUrl),o[oe.AuthorizationCode].accessToken||(o[oe.AuthorizationCode].accessToken=s,o[oe.AuthorizationCode].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),o[oe.AuthorizationCode].clientSecret=Dn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),o[oe.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[oe.AuthorizationCodeWithPkce].accessToken||(o[oe.AuthorizationCodeWithPkce].accessToken=s,o[oe.AuthorizationCodeWithPkce].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),o[oe.AuthorizationCodeWithPkce].clientSecret=Dn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),o[oe.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[oe.Implicit].accessToken||(o[oe.Implicit].accessToken=s,o[oe.Implicit].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId))}return n}function QQ(t){try{const e=JSON.parse(t);return JSON.stringify(e,null,2)}catch(e){return console.error({error:e}),t}}function bG(t,e){return t==="application/json"&&!!e}function xG(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function jAe(t){try{const e=JSON.stringify(t);return e===void 0?"undefined":e}catch{return String(t)}}function SG(t,e){return e&&e.length>0?rG(e):ya(t||[],{})}function NAe(t,e,n){if(e&&e.length>0){const r=rG(e);return DAe(r,n)}return ya(t||[],{boundNames:n})}function DAe(t,e){return t.map(n=>!n.key||!e.has(n.key)?n:{...n,value:`$inputs.${n.key}`,active:!0})}function MAe(t,e=!1,n="",r){const i=EQ(t.parameters,"in"),s=_Q(t),o=TS(t),a=SG(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:ya(i.path||[],{}),method:t.method.toLowerCase()==="x-query"?"QUERY":t.method.toLocaleUpperCase(),url:EO(H$e(t.path),a),headers:ya(i.header||[],{}),queryParameters:a,cookies:ya(i.cookie||[],{}),body:s,security:o},response:null}}function RQ(t,e){const n=EQ(t.parameters,"in"),r=_Q(t),i=TS(t),s=ya(n.path||[],{boundNames:"all"});return e?{parameters:{pathParameters:s,queryParameters:NAe(n.query,n.querystring,sG(n.query,n.querystring,e)),headers:ya(n.header||[],{boundNames:Vf(n.header,"header",e)}),cookies:ya(n.cookie||[],{boundNames:Vf(n.cookie,"cookie",e)})},requestBody:r,security:i}:{parameters:{pathParameters:s,queryParameters:SG(n.query,n.querystring),headers:ya(n.header||[],{}),cookies:ya(n.cookie||[],{})},requestBody:r,security:i}}function VAe(t,e){const n=new Hi({format:!0});if(typeof t=="string")return e?.includes("json")?QQ(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 LAe(t){return EA.includes(t)}function _Q(t){const e=t.body?.mediaTypes;if(!e||!Object.keys(e).length)return Th();const n=FAe(e,t),r=n?.name||"",i=LAe(r),s=!i&&!gB.includes(r),o=kE(n),l=o.find(({key:f})=>f===t.body?.activeExampleName)?.value??o[0]?.value,c=s&&l?VAe(l,r):"",u={"multipart/form-data":IV(e["multipart/form-data"]),"application/x-www-form-urlencoded":IV(e["application/x-www-form-urlencoded"])};if(i&&l){const f=gG(l,r,n?.encoding,n?.schema);f.length&&(u[r]=f)}return{...Th(),activeExampleName:t.body?.activeExampleName||o[0]?.key||"",...n&&{type:n.name},content:c,formData:u}}const zAe={[Ye.GraphqlJSON]:"graphql"};function ep(t,e){const n=zAe[t];return!n||e?.[n]===!0}function wG(t,e){return ep(t,e)?mc[t]:void 0}function TG(t,e){const n=Object.fromEntries(Object.entries(mc).filter(([r])=>ep(r,e)));return t?{...XAe(t),...n}:n}function XAe(t){return Object.keys(t.body?.mediaTypes||{}).reduce((e,n)=>(e[n]={name:n,extensions:void 0},e),{})}function IV(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 UAe="Untitled example";function kE(t){const e=t?.examples;return Object.keys(e||{}).map(n=>{const r=e?.[n];return{name:(wl.isString(r?.summary)?r?.summary:r?.summary?.raw)?.trim()||n||UAe,key:n,value:e?.[n].value}})}function FAe(t,e){const n=TG(e),r=Object.keys(t).find(i=>!!n[i]);return r?t[r]:null}function qAe(t){return!t?.security?.length||!t?[]:EAe(t)}function CG(t){const e=new Set;return t.flat().filter(n=>e.has(n.id)?!1:(e.add(n.id),!0))}function CS(t){if(t.type==="http"){const e=t.scheme?.toLowerCase();if(e==="bearer")return ne.JWT;if(e==="basic")return ne.BasicAuth;if(e==="digest")return ne.DigestAuth}else{if(t.type==="apiKey")return ne.APIKey;if(t.type==="oauth2")return ne.OAuth2;if(t.type==="openIdConnect")return ne.OpenIDConnect}return ne.NoAuth}function WAe(t,e){if(t==="clientCredentials"&&e&&"x-assertionType"in e&&e["x-assertionType"]===z0)return oe.ClientCredentialsWithJwtAssertion;if(t==="authorizationCode"&&e&&"x-usePkce"in e&&e["x-usePkce"])return oe.AuthorizationCodeWithPkce;switch(t){case"implicit":return oe.Implicit;case"password":return oe.Password;case"clientCredentials":return oe.ClientCredentials;case"authorizationCode":return oe.AuthorizationCode;default:return oe.AuthorizationCode}}function BAe(t,e){const n=t?.security;if(!n?.length)return[];const s=PAe(n).flat().filter(o=>o.schemeId===e).find(o=>CS(o)===ne.OAuth2);return jQ(s)}function jQ(t){return Object.entries(t?.flows||{}).map(([e,n])=>WAe(e,n)).filter(Boolean)}function PS(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function Fs(t){try{return new URL(t),!0}catch{return!1}}function ZAe(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(T6(e))n=e;else if(!e.startsWith("/"))n=OE(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return OE(n)}function $V(t,e){let n=t;return e.forEach(({key:r,value:i,active:s})=>{i&&s&&(n=n.replaceAll(`{${r}}`,i))}),n}function PG(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function GAe(t){return t.startsWith("http://")||t.startsWith("https://")}function Wv({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(GAe(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 kG="New Step";function EE({name:t=kG,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=YAe(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function YAe(t){return t.steps.filter(e=>e.state!==Xt.Draft).map(e=>e.stepId)}function Da({name:t=kG,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:s,dynamicReplayValues:o,xOperation:a}={}){if(!n){const l=s?RQ(s,o):null,c=[lo()];return{stepId:EE({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?Xt.Draft:Xt.Normal,parameters:{pathParameters:[],queryParameters:a?IO(a.url):[],headers:[],cookies:[]},requestBody:Th(),xOperation:a??(i?null:{method:"GET",url:""}),security:c,operation:i??null,...l}}return{stepId:EE({name:t,workflow:r}),description:n.description,outputs:n.outputs,successCriteria:n.successCriteria,state:e?Xt.Draft:Xt.Normal,parameters:n.parameters,requestBody:n.requestBody,xOperation:n.xOperation,security:n.security,operation:n.operation}}function Rl(t){return t.xOperation?.method??t.operation?.method??""}function Yu(t){return t.xOperation?.url??t.operation?.path??""}function IE({operation:t,requestBody:e}){return t?t.path==="/"&&e.type===Ye.GraphqlJSON?"":t.path:""}function kS(t,e,n,r,i){const{inputs:s,servers:o}=r,a=I$e(Sc("path",[Ln(e?.parameters.pathParameters,n?.components.parameters),Ln(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=$V(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?PG(m.value,m.variables):"")+$V(IE(t),a)}const h=u.split("?")[0];return{url:Mf(h,s,i??{}),method:f.toUpperCase()}}function EG(){return structuredClone({id:crypto.randomUUID(),state:xn.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Ue.Step,draftStep:Da(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1}})}function HAe(t){return t?.data?.type===Ue.Step}function JAe(t,e){const{collectionId:n,workflowId:r,stepId:i}=e,s=e.draftStep??null;return n&&r&&i?kO(t,{collectionId:n,workflowId:r,stepId:i})??s:s}function KAe(t,e,n,r,i,s){const o=a=>a??"";return o(t)===r&&o(e)===i&&o(n)===s}const $E="New workflow";function IG({name:t=$E,collection:e}){let r=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||$E).replaceAll(" ","-").toLowerCase();if(!e)return r;const i=eQe(e);if(i.includes(r)){let s=1;for(;i.includes(`${r}-${s}`);)s++;r=`${r}-${s}`}return r}function eQe(t){return t.workflows.filter(e=>e.state!==Xt.Draft).map(e=>e.workflowId)}function NQ({name:t=$E,isDraft:e=!1,collection:n}={}){return{workflowId:IG({name:t,collection:n}),summary:t,steps:[],state:e?Xt.Draft:Xt.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[lo()]}}function tQe(t,e,n){const r=new Set,i=e?.components.parameters,{pathParameters:s,queryParameters:o,headers:a,cookies:l}=t.parameters,c=t.outputs;for(const{value:u}of[...Ln([...s,...o,...a,...l],i),...c])for(const f of cs(u))r.add(f);return t.steps.forEach(u=>{const f=u.security;for(const x of f)switch(x.securityType){case ne.BasicAuth:case ne.DigestAuth:for(const y of[x[x.securityType].username,x[x.securityType].password])for(const w of cs(y))r.add(w);break;case ne.JWT:for(const y of cs(x[x.securityType].token))r.add(y);break;case ne.APIKey:for(const y of cs(x[x.securityType].key))r.add(y);break;case ne.OAuth2:case ne.OpenIDConnect:{const y=x[x.securityType];for(const w of cs(y[y.grantType].accessToken))r.add(w);break}}const{pathParameters:h,queryParameters:p,headers:m,cookies:g}=u.parameters,O=u.outputs;for(const{value:x}of[...Ln([...h,...p,...m,...g],i),...O])for(const y of cs(x))r.add(y);const v=u.requestBody;switch(v.type){case Ye.FormData:case Ye.UrlEncoded:{for(const{value:x}of v.formData[v.type])for(const y of cs(x))r.add(y);break}case Ye.Binary:break;case Ye.GraphqlJSON:{const{query:x,variables:y}=ep(Ye.GraphqlJSON,n)?bl(v.content):{query:v.content,variables:""};for(const w of[x,y])for(const S of cs(w))r.add(S);break}default:for(const x of cs(v.content))r.add(x)}}),r}function $G(t,e,n,r,i){const s=tQe(t,n,i);if(s.size===0){r(({inputs:o,...a})=>a);return}r(o=>{const a=o.inputs,l=typeof a=="object"&&a?.properties||{};return{...o,inputs:{type:"object",properties:Object.fromEntries(Array.from(s).map(c=>{const u=e.inputs.find(f=>f.name===c)?.isSecret;return[c,u?{type:"string",format:"password"}:l[c]||{type:"string"}]}))}}})}function tp(t){return t.summary||t.workflowId||"Untitled Workflow"}function AG(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 ES=(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,e.operationId)??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 IS(t){const e=Wo(),{convertOperationToReplayValue:n}=Fn();return b.useMemo(()=>ES(e,t,n),[e,t,n])}function DQ(){const t=VA(),{convertOperationToReplayValue:e}=Fn();return{getApiOperation:b.useCallback(r=>ES(t(),r,e),[t,e])}}function QG(t){const e=(t.match(new RegExp("\\{(?<!\\{[^}]*?\\{)([^}]+)\\}","g"))||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function nQe(t){const e=t.servers?.[0];if(!e)return{url:"",variables:[]};const n=e.url,i=QG(n).map(s=>({name:s,value:e.variables?.[s]?.default||""}));return{url:n,variables:i}}function RG(){const t=VA(),e=ao();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}=nQe(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 sn{static utils=null;static async getUtils(){return sn.utils||(sn.utils=Rn()?await Promise.resolve().then(()=>require("./replay-tauri-path-B8kon_Ur.js")):{join:ac.join,resolve:ac.resolve,isAbsolute:ac.isAbsolute,relative:ac.relative,extname:ac.extname,dirname:ac.dirname}),sn.utils}static async dirname(e){return(await sn.getUtils()).dirname(e)}static async join(...e){return(await sn.getUtils()).join(...e)}static async resolve(e){return(await sn.getUtils()).resolve(e)}static async isAbsolute(e){return(await sn.getUtils()).isAbsolute(e)}static async relative(e,n){return(await sn.getUtils()).relative(e,n)}static async extname(e){return(await sn.getUtils()).extname(e)}}function rQe({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 AV(t,e){return`${t}\0${e}`}function md(){const t=yS(),e=Wa(),n=VA(),{attachApiServerToEnvironments:r}=RG();async function i({collectionId:l,apiId:c}){const u=Sh(t(),l);if(!u)return;if(!u.sourceDescriptions.some(h=>h.apiId===c)){const p=n().find(g=>g.id===c)?.info.title,m=Fs(c)?c:await sn.relative(`/${l}/..`,`/${c}`);e(g=>Xi(g,l,O=>O.sourceDescriptions.some(v=>v.apiId===c)?O:{...O,sourceDescriptions:[...O.sourceDescriptions,{name:rQe({apiName:p,sourceDescriptions:O.sourceDescriptions}),url:m,apiId:c}]}))}r(c)}function s(l){return Sh(t(),l)}function o(l,c){e(u=>Xi(u,l,f=>({...f,sourceDescriptions:f.sourceDescriptions.filter(h=>c.name!==h.name)})))}function a(l,c){const u=new Set(c.map(f=>AV(f.workflowId??"",f.stepId)));e(f=>Xi(f,l,h=>{const p=h.workflows.map(m=>{const g=m.steps.map(O=>!u.has(AV(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 iQe{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 AE=(t,e)=>e.some(n=>t instanceof n);let QV,RV;function sQe(){return QV||(QV=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oQe(){return RV||(RV=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const QE=new WeakMap,nT=new WeakMap,$S=new WeakMap;function aQe(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(Qu(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return $S.set(e,t),e}function lQe(t){if(QE.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)});QE.set(t,e)}let RE={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return QE.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Qu(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 _G(t){RE=t(RE)}function cQe(t){return oQe().includes(t)?function(...e){return t.apply(_E(this),e),Qu(this.request)}:function(...e){return Qu(t.apply(_E(this),e))}}function uQe(t){return typeof t=="function"?cQe(t):(t instanceof IDBTransaction&&lQe(t),AE(t,sQe())?new Proxy(t,RE):t)}function Qu(t){if(t instanceof IDBRequest)return aQe(t);if(nT.has(t))return nT.get(t);const e=uQe(t);return e!==t&&(nT.set(t,e),$S.set(e,t)),e}const _E=t=>$S.get(t);function dQe(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Qu(o);return r&&o.addEventListener("upgradeneeded",l=>{r(Qu(o.result),l.oldVersion,l.newVersion,Qu(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 fQe=["get","getKey","getAll","getAllKeys","count"],hQe=["put","add","delete","clear"],rT=new Map;function _V(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(rT.get(e))return rT.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=hQe.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||fQe.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 rT.set(e,s),s}_G(t=>({...t,get:(e,n,r)=>_V(e,n)||t.get(e,n,r),has:(e,n)=>!!_V(e,n)||t.has(e,n)}));const pQe=["continue","continuePrimaryKey","advance"],jV={},jE=new WeakMap,jG=new WeakMap,gQe={get(t,e){if(!pQe.includes(e))return t[e];let n=jV[e];return n||(n=jV[e]=function(...r){jE.set(this,jG.get(this)[e](...r))}),n}};async function*mQe(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,gQe);for(jG.set(n,e),$S.set(n,_E(e));e;)yield n,e=await(jE.get(n)||e.continue()),jE.delete(n)}function NV(t,e){return e===Symbol.asyncIterator&&AE(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&AE(t,[IDBIndex,IDBObjectStore])}_G(t=>({...t,get(e,n,r){return NV(e,n)?mQe:t.get(e,n,r)},has(e,n){return NV(e,n)||t.has(e,n)}}));class MQ{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 MQ(e,n,r)}async initialize(){this.db||(this.db=await dQe(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const OQe=1;class VQ{constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=MQ.createInstance(n,OQe,this.setupDatabase);return new VQ(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 wc{static instance=null;static async initialize(e,n){this.close(),this.instance=await vQe(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function vQe(t,e){let n;if(e){const{HistorySqliteDBStorage:r}=await Promise.resolve().then(()=>require("./replay-HistorySqliteDBStorage-BrILW8Fu.js")),i=Rm.getInstance();n=new r(i)}else n=VQ.create(t.id);return new iQe(n)}const ui={all:["history"],lists:()=>[...ui.all,"list"],list:t=>[...ui.lists(),t],recent:(t,e)=>[...ui.all,"recent",t,e],detail:t=>[...ui.all,"detail",t],count:t=>[...ui.all,"count",t]};function yQe(t){return Pi.useQuery({queryKey:ui.list(t),queryFn:async()=>wc.getInstance().getAll(t)})}function NG(){const t=Pi.useQueryClient();return Pi.useMutation({mutationFn:async e=>{await wc.getInstance().addItem(e)},onMutate:e=>{t.setQueryData(ui.detail(e.id),e)},onSuccess:()=>{t.invalidateQueries({queryKey:ui.lists()}),t.invalidateQueries({queryKey:ui.count()})},onError:(e,n)=>{t.removeQueries({queryKey:ui.detail(n.id)}),console.error("Failed to add history item:",e)}})}function bQe(){const t=Pi.useQueryClient();return Pi.useMutation({mutationFn:async e=>{await wc.getInstance().deleteItem(e)},onSuccess:(e,n)=>{t.removeQueries({queryKey:ui.detail(n)}),t.invalidateQueries({queryKey:ui.lists()}),t.invalidateQueries({queryKey:ui.count()})},onError:(e,n)=>{console.error(`Failed to delete history item ${n}:`,e)}})}function xQe(){const t=Pi.useQueryClient();return Pi.useMutation({mutationFn:async()=>{await wc.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:ui.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function SQe(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function wQe(){const t=NG();return b.useCallback(({step:e,response:n})=>{const r=SQe(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function TQe(){const t=NG();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 CQe(){const t=Pi.useQueryClient();async function e(n){return t.ensureQueryData({queryKey:ui.detail(n),queryFn:()=>wc.getInstance().getById(n)})}return{getHistoryItem:e}}function DG(){const t=yS();return{getStep:n=>kO(t(),n)}}function PQe(t){const e=mi();return kO(e,{collectionId:t?.collectionId??null,workflowId:t?.workflowId??null,stepId:t?.stepId??null})??t?.draftStep??null}function MG(t,e){const n=t?.collectionId??null,r=t?.workflowId??null,i=t?.stepId??null,s=mi(),o=Wa(),a=kO(s,{collectionId:n,workflowId:r,stepId:i});if(a)return{step:a,updateStep:c=>o(u=>bS(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 LQ(){const t=yS();return{getWorkflow:({collectionId:n,workflowId:r})=>PO(t(),{collectionId:n,workflowId:r})}}function Lr(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 sf(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 nu,As,Dd,Bv,Ly;const DV="__TAURI_TO_IPC_KEY__";function VG(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}class LG{constructor(e){nu.set(this,void 0),As.set(this,0),Dd.set(this,[]),Bv.set(this,void 0),sf(this,nu,e||(()=>{})),this.id=VG(n=>{const r=n.index;if("end"in n){r==Lr(this,As,"f")?this.cleanupCallback():sf(this,Bv,r);return}const i=n.message;if(r==Lr(this,As,"f")){for(Lr(this,nu,"f").call(this,i),sf(this,As,Lr(this,As,"f")+1);Lr(this,As,"f")in Lr(this,Dd,"f");){const s=Lr(this,Dd,"f")[Lr(this,As,"f")];Lr(this,nu,"f").call(this,s),delete Lr(this,Dd,"f")[Lr(this,As,"f")],sf(this,As,Lr(this,As,"f")+1)}Lr(this,As,"f")===Lr(this,Bv,"f")&&this.cleanupCallback()}else Lr(this,Dd,"f")[r]=i})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){sf(this,nu,e)}get onmessage(){return Lr(this,nu,"f")}[(nu=new WeakMap,As=new WeakMap,Dd=new WeakMap,Bv=new WeakMap,DV)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[DV]()}}async function kn(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}class kQe{get rid(){return Lr(this,Ly,"f")}constructor(e){Ly.set(this,void 0),sf(this,Ly,e)}async close(){return kn("plugin:resources|close",{rid:this.rid})}}Ly=new WeakMap;var NE;(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"})(NE||(NE={}));var DE;(function(t){t[t.Start=0]="Start",t[t.Current=1]="Current",t[t.End=2]="End"})(DE||(DE={}));function zQ(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 XQ extends kQe{async read(e){if(e.byteLength===0)return 0;const[n,r]=await kn("plugin:fs|read",{rid:this.rid,len:e.byteLength});return e.set(n),r===0?null:r}async seek(e,n){return await kn("plugin:fs|seek",{rid:this.rid,offset:e,whence:n})}async stat(){const e=await kn("plugin:fs|fstat",{rid:this.rid});return zQ(e)}async truncate(e){await kn("plugin:fs|ftruncate",{rid:this.rid,len:e})}async write(e){return await kn("plugin:fs|write",{rid:this.rid,data:e})}}async function EQe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await kn("plugin:fs|create",{path:t instanceof URL?t.toString():t,options:e});return new XQ(n)}async function IQe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await kn("plugin:fs|open",{path:t instanceof URL?t.toString():t,options:e});return new XQ(n)}async function $Qe(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 kn("plugin:fs|copy_file",{fromPath:t instanceof URL?t.toString():t,toPath:e instanceof URL?e.toString():e,options:n})}async function zG(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})}async function XG(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await kn("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})}async function UG(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await kn("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 UQ(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await kn("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e})}async function AQe(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 kn("plugin:fs|read_text_file_lines",{path:n,options:e}));const[r,i]=await kn("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 FG(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})}async function qG(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 kn("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:n})}async function QQe(t,e){const n=await kn("plugin:fs|stat",{path:t instanceof URL?t.toString():t,options:e});return zQ(n)}async function RQe(t,e){const n=await kn("plugin:fs|lstat",{path:t instanceof URL?t.toString():t,options:e});return zQ(n)}async function _Qe(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|truncate",{path:t instanceof URL?t.toString():t,len:e,options:n})}async function jQe(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|write_file",e,{headers:{path:t instanceof URL?t.toString():t,options:JSON.stringify(n)}})}async function WG(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|write_text_file",{path:t instanceof URL?t.toString():t,data:e,options:n})}async function FQ(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await kn("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})}async function BG(t){await kn("plugin:fs|unwatch",{rid:t})}async function NQe(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 LG;s.onmessage=e;const o=await kn("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{BG(o)}}async function DQe(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 LG;s.onmessage=e;const o=await kn("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{BG(o)}}const $O=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return NE},FileHandle:XQ,get SeekMode(){return DE},copyFile:$Qe,create:EQe,exists:FQ,lstat:RQe,mkdir:zG,open:IQe,readDir:XG,readFile:UG,readTextFile:UQ,readTextFileLines:AQe,remove:FG,rename:qG,stat:QQe,truncate:_Qe,watch:NQe,watchImmediate:DQe,writeFile:jQe,writeTextFile:WG},Symbol.toStringTag,{value:"Module"}));function MQe(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function Gt(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}var $n;(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"})($n||($n={}));async function VQe(){return Gt("plugin:path|resolve_directory",{directory:$n.AppConfig})}async function ME(){return Gt("plugin:path|resolve_directory",{directory:$n.AppData})}async function LQe(){return Gt("plugin:path|resolve_directory",{directory:$n.AppLocalData})}async function zQe(){return Gt("plugin:path|resolve_directory",{directory:$n.AppCache})}async function XQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Audio})}async function UQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Cache})}async function FQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Config})}async function qQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Data})}async function ZG(){return Gt("plugin:path|resolve_directory",{directory:$n.Desktop})}async function WQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Document})}async function BQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Download})}async function ZQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Executable})}async function GQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Font})}async function YQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Home})}async function HQe(){return Gt("plugin:path|resolve_directory",{directory:$n.LocalData})}async function JQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Picture})}async function KQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Public})}async function eRe(){return Gt("plugin:path|resolve_directory",{directory:$n.Resource})}async function tRe(t){return Gt("plugin:path|resolve_directory",{directory:$n.Resource,path:t})}async function nRe(){return Gt("plugin:path|resolve_directory",{directory:$n.Runtime})}async function rRe(){return Gt("plugin:path|resolve_directory",{directory:$n.Template})}async function iRe(){return Gt("plugin:path|resolve_directory",{directory:$n.Video})}async function sRe(){return Gt("plugin:path|resolve_directory",{directory:$n.AppLog})}async function oRe(){return Gt("plugin:path|resolve_directory",{directory:$n.Temp})}function GG(){return window.__TAURI_INTERNALS__.plugins.path.sep}function aRe(){return window.__TAURI_INTERNALS__.plugins.path.delimiter}async function YG(...t){return Gt("plugin:path|resolve",{paths:t})}async function lRe(t){return Gt("plugin:path|normalize",{path:t})}async function qQ(...t){return Gt("plugin:path|join",{paths:t})}async function HG(t){return Gt("plugin:path|dirname",{path:t})}async function JG(t){return Gt("plugin:path|extname",{path:t})}async function WQ(t,e){return Gt("plugin:path|basename",{path:t,ext:e})}async function KG(t){return Gt("plugin:path|is_absolute",{path:t})}const BQ=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return $n},appCacheDir:zQe,appConfigDir:VQe,appDataDir:ME,appLocalDataDir:LQe,appLogDir:sRe,audioDir:XQe,basename:WQ,cacheDir:UQe,configDir:FQe,dataDir:qQe,delimiter:aRe,desktopDir:ZG,dirname:HG,documentDir:WQe,downloadDir:BQe,executableDir:ZQe,extname:JG,fontDir:GQe,homeDir:YQe,isAbsolute:KG,join:qQ,localDataDir:HQe,normalize:lRe,pictureDir:JQe,publicDir:KQe,resolve:YG,resolveResource:tRe,resourceDir:eRe,runtimeDir:nRe,sep:GG,tempDir:oRe,templateDir:rRe,videoDir:iRe},Symbol.toStringTag,{value:"Module"})),Ro=window.__TAURI__?.http.fetch??globalThis.fetch;function MV(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 eY(t,e){const n=MV(t),r=e.find(({host:i,port:s})=>MV(`https://${i}:${s}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}const cRe={id:"default",userFilesDir:"default",systemFilesDir:"default"},U0=Dl(Mr(cRe));U0.debugLabel="project";function Od(){return $r(U0)}function VE(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const uRe=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function dRe(){const{userFilesDir:t}=Od(),{certificates:e}=pi(),n=Ft(),{getCollection:r}=md();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-BU0VNqJi.js")),Promise.resolve().then(()=>require("./replay-external-resolver-Dz9QqU4-.js"))]),g=new m,O=c.map(w=>JSON.stringify({[w.name]:w.value})),v=fRe(u,f),{run:x}=await Promise.resolve().then(()=>require("./replay-respect-run-CK8L1S-l.js")),y=await x({files:[h],workflow:o?[o]:[],fetch:(w,S)=>{const P=uRe(w),{clientCert:k,clientKey:I}=eY(P,e);return Ro(P,{...S,clientCert:k,clientKey:I})},logger:xS,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async w=>{if(!await FQ(w))throw new Error(`File ${w} doesn't exist or isn't readable.`);try{const P=await UQ(w),k=new TextEncoder().encode(P);return new File([k],await WQ(w))}catch(P){throw new Error(`Failed to read file ${w}: ${P}`)}}},envVariables:{},config:await p({}),externalRefResolver:g,input:O,server:v,severity:JSON.stringify(a),skipLint:!0,noSecretsMasking:!0});try{await g$e(s,o,y?.[0]?.ctx)}catch(w){console.error("Failed to persist workflow step context:",w)}return y}}}function fRe(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 hRe="com.redocly.tab.openFailed";function yf(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Ue.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,...t}}function LE(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function pRe(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:IA(IO(s),l.parameters.queryParameters)}}}:a})}function pr(){const{getTabs:t,getActiveTabIdx:e,setTabs:n,setActiveTabIdx:r,updateTabAt:i,updateTabDataAt:s}=cd(),{dynamicReplayValues:o}=Fn(),{getStep:a}=DG(),{getHistoryItem:l}=CQe(),{getWorkflow:c}=LQ(),{getCollection:u}=md(),{getApiOperation:f}=DQ(),{sendEvent:h}=Ke(),p=zIe(),m=b.useCallback((M,j,L,W)=>{console.warn(`[useTabHandlers] ${M}`,W),h(hRe,[{...be("tab",j),reason:L,...W}])},[h]),g=b.useCallback((M,j)=>{const L=t()[M];L&&L.state!==j&&i(M,W=>({...W,state:j}))},[t,i]),O=b.useCallback(M=>{r(M)},[r]),v=b.useCallback(()=>{const M=t().length;n(j=>[...j,EG()]),r(M)},[t,n,r]),x=b.useCallback(M=>{const j=[...t().filter(W=>W.state!==xn.Preview)];j.push(M),n(()=>j);const L=j.length-1;return r(L),L},[t,n,r]),y=b.useCallback(M=>{const j=f(M),L=ZQ(M,j,o);x(L)},[x,o,f]),w=b.useCallback(M=>{const j=t().findIndex(({data:L})=>V9(L,M));return j===-1?!1:(O(j),!0)},[t,O]),S=b.useCallback((M,j)=>{const L=t(),W=B=>L.findIndex(({data:K})=>_n(K,Ue.Step)&&B(K));if(j){const B=W(te=>te.sourceFile===j);if(B!==-1){pRe(L[B].data,te=>s(B,te),M),O(B);return}const K=W(te=>!te.sourceFile&&LE(te,M));if(K!==-1){s(K,te=>({...te,sourceFile:j})),O(K);return}}else{const B=W(K=>LE(K,M));if(B!==-1){O(B);return}}const q=Da({xOperation:M,name:j??void 0});x({id:crypto.randomUUID(),state:xn.Normal,data:yf({draftStep:q,activeTabName:xu(q),sourceFile:j??null})})},[t,s,O,x]),P=b.useCallback(M=>{const j=t(),L=e(),W=j[L]?.id,q=j.filter((K,te)=>te!==M);n(()=>q);const B=M===L||!W?-1:q.findIndex(K=>K.id===W);r(B===-1?Math.max(0,M-1):B)},[t,e,r,n]),k=b.useCallback(()=>{n(()=>[]),r(0)},[r,n]);function I({collectionId:M,workflowId:j,stepId:L}){const W=t(),q=new Set;for(let B=0;B<W.length;B++){const K=W[B].data;switch(K.type){case Ue.Step:K.collectionId===M&&K.workflowId===j&&K.stepId===L&&q.add(B);break;case Ue.Workflow:case Ue.WorkflowRun:K.collectionId===M&&K.workflowId===j&&!L&&q.add(B);break;case Ue.Collection:K.collectionId===M&&!j&&!L&&q.add(B);break}}q.size&&(n(B=>B.filter((K,te)=>!q.has(te))),r(0))}const E=b.useCallback(async M=>{const j=t().findIndex(({data:L})=>_n(L,Ue.Step)&&L.historyId===M);if(j!==-1)r(j);else{const L=await l(M);if(!L||!Xk(L)){m("Step history not found","stepHistoryTab","step_history_not_found",{historyId:M});return}const W=L.step;x({id:crypto.randomUUID(),state:xn.Preview,data:yf({historyId:M,draftStep:structuredClone(W),response:structuredClone(L.response),activeTabName:xu(W)})})}},[r,t,x,l,m]),Q=b.useCallback(({collectionId:M,activeTabName:j})=>{const L=t().findIndex(W=>{const q=W.data;return _n(q,Ue.Collection)&&q.collectionId===M});if(L!==-1)r(L);else{if(!u(M)){m("Collection not found","collectionTab","collection_not_found",{collectionId:M});return}x({id:crypto.randomUUID(),state:xn.Preview,data:{collectionId:M,type:Ue.Collection,activeTabName:j??it.COLLECTION_SETTINGS}})}},[r,t,x,u,m]),N=b.useCallback(({collectionId:M,workflowId:j})=>{if(!c({collectionId:M,workflowId:j})){m("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:M,workflowId:j});return}x({id:crypto.randomUUID(),state:xn.Normal,data:{collectionId:M,workflowId:j,historyId:null,runDate:null,type:Ue.WorkflowRun,result:null,severitySettings:VE()}})},[x,c,m]),R=b.useCallback(async(M,{state:j=xn.Preview}={})=>{const L=t().findIndex(({data:W})=>_n(W,Ue.WorkflowRun)&&W.historyId===M);if(L!==-1)j===xn.Normal&&t()[L].state===xn.Preview&&g(L,xn.Normal),r(L);else{const W=await l(M);if(!W||!Uk(W)){m("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:M});return}x({id:crypto.randomUUID(),state:j,data:{collectionId:W.collectionId,workflowId:W.workflowId,historyId:M,runDate:W.date,type:Ue.WorkflowRun,result:structuredClone(W.workflowResult),severitySettings:VE(),label:tp(W.workflow),secretValues:p().inputs.filter(q=>q.isSecret&&q.value).map(q=>String(q.value))}})}},[r,t,x,g,l,m,p]),D=b.useCallback(({collectionId:M,workflowId:j})=>{const L=t().findIndex(({data:W})=>_n(W,Ue.WorkflowRun)&&W.collectionId===M&&W.workflowId===j);return L===-1?!1:(t()[L].state===xn.Preview&&g(L,xn.Normal),O(L),!0)},[t,g,O]),z=b.useCallback(({collectionId:M,workflowId:j,activeTabName:L})=>{const W=t().findIndex(q=>{const B=q.data;return _n(B,Ue.Workflow)&&B.workflowId===j&&B.collectionId===M});if(W!==-1)L&&s(W,q=>({...q,activeTabName:L})),r(W);else{if(!c({collectionId:M,workflowId:j})){m("Workflow not found","workflowTab","workflow_not_found",{collectionId:M,workflowId:j});return}x({id:crypto.randomUUID(),state:xn.Preview,data:{collectionId:M,workflowId:j,type:Ue.Workflow,activeTabName:L??it.WORKFLOW_SETTINGS}})}},[r,t,s,x,c,m]),X=b.useCallback(({collectionId:M,workflowId:j,stepId:L,state:W})=>{const q=t().findIndex(({data:B})=>_n(B,Ue.Step)&&B.collectionId===M&&B.workflowId===j&&B.stepId===L&&B.historyId===null);if(q!==-1)r(q);else{const B=a({collectionId:M,workflowId:j,stepId:L});if(!B){m("Step not found","stepTab","step_not_found",{collectionId:M,workflowId:j,stepId:L});return}x({id:crypto.randomUUID(),state:W??xn.Preview,data:yf({stepId:L,collectionId:M,workflowId:j,activeTabName:xu(B)})})}},[r,t,a,x,m]),A=b.useCallback(({step:M})=>{x({id:crypto.randomUUID(),state:xn.Normal,data:yf({stepId:M.stepId??null,workflowId:M.workflowId??null,draftStep:structuredClone(M),activeTabName:xu(M)})})},[x]),U=b.useCallback((M,j)=>{if(M===j)return;const L=e(),W=[...t()],q=W[L]?.id,[B]=W.splice(M,1);if(W.splice(j,0,B),n(()=>W),q){const K=W.findIndex(te=>te.id===q);r(K)}},[e,t,n,r]);return{handleNewTabOpen:v,addNewTab:x,openStepTabFromOperation:y,focusOperationTab:w,openStepTabFromXOperation:S,handleTabChange:O,handleTabClose:P,handleCloseAllTabs:k,handleCloseByDataId:I,openCollectionTab:Q,openWorkflowTab:z,openWorkflowRunTab:N,openWorkflowRunTabFromHistory:R,focusWorkflowRunTab:D,openStepTabFromHistory:E,openStepTabFromCollection:X,openStepTab:A,handleTabReorder:U,changeTabState:g}}function ZQ(t,e,n){const r=Da({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:xn.Preview,data:yf({draftStep:r,activeTabName:xu(r)})}}function gRe(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const mRe=({transform:t})=>({...t,y:0}),ORe=({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))},vd=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,vRe=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"})]}),AS=T.default(vRe)`
786
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function q$e(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 eT(t,e,n,r,i){return!n.sanitizeName||H6(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}Hi.prototype.build=function(t){if(this.options.preserveOrder)return V$e(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new q6,n=q$e(t,this.options);return this.j2x(t,0,e,n).val}};Hi.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:eT(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=eT(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=eT(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}};Hi.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+'="'+wh(e)+'"'};function W$e(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)}Hi.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]=wh(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]=wh(t[r]),n=!0)}return n?e:null};Hi.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};Hi.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};Hi.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}};Hi.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};Hi.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};Hi.prototype.buildTextValNode=function(t,e,n,r,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName){const s=B6(t);return this.indentate(r)+`<![CDATA[${s}]]>`+this.newLine}else if(this.options.commentPropName!==!1&&e===this.options.commentPropName){const s=W6(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}}};Hi.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 B$e(t){return this.options.indentBy.repeat(t)}function Z$e(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}function tG(t){return t.schema}function nG(t){return tG(t)?.fields??[]}function rG(t,e){return t.flatMap(n=>{const r=tG(n),i=r?.fields||[];return i.length>0?i.flatMap(s=>wV(s.name,s.example,n.allowReserved)):wV(n.name,r?.example??n.example,n.allowReserved)})}function wV(t,e,n){if(e===void 0)return[tT(t,"",!1,n)];const r=TE(e,t);return r.length===0?[tT(t,"",!1,n)]:r.map(i=>tT(i.key,i.value,!0,n))}function TE(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((n,r)=>n!==null&&typeof n=="object"?TE(n,`${e}[${r}]`):[{key:e,value:String(n)}]):G$e(t)?Object.entries(t).flatMap(([n,r])=>TE(r,`${e}[${n}]`)):[{key:e,value:String(t)}]}function G$e(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function tT(t,e,n,r){return{id:crypto.randomUUID(),key:t,value:U6(e),active:n,in:"query",...r&&{allowReserved:r}}}const iG={path:"path",query:"query",header:"headers",cookie:"cookie"};function kQ(t){return t!==void 0}function Y$e(t,e){if(t)return hx.isDirectConfigureRequestValues(t)?t:t[e]}function TV(t,e,n){const r=n[iG[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 Vf(t,e,n){if(hx.isDirectConfigureRequestValues(n))return TV(t,e,n);const r=new Set;for(const i of Object.values(n))if(i)for(const s of TV(t,e,i))r.add(s);return r}function CV(t,e,n){const r=n.query,i=n.envVariables;for(const s of e??[]){const o=nG(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 sG(t,e,n){const r=[...t??[],...e??[]],i=new Set(Vf(r,"query",n));if(hx.isDirectConfigureRequestValues(n))return CV(i,e,n),i;for(const s of Object.values(n))s&&CV(i,e,s);return i}function EQ(t=[],e){const n={};return t.forEach(r=>{const i=String(r[e]);n[i]||(n[i]=[]),n[i].push(r)}),n}function H$e(t){return t.replace(/{/g,"{{").replace(/}/g,"}}")}var Os=(t=>(t.Query="Query",t.Header="Header",t.Cookie="Cookie",t))(Os||{});const CE={documentedOAuth2Types:[],grantType:oe.ClientCredentials,authRequestExtraParams:[],tokenRequestExtraParams:[],[oe.ClientCredentials]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[oe.ClientCredentialsWithJwtAssertion]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[],accessToken:""},[oe.AuthorizationCode]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[oe.AuthorizationCodeWithPkce]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],codeVerifier:"",codeChallenge:"",accessToken:""},[oe.Implicit]:{clientId:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[],accessToken:""},[oe.Password]:{username:"",password:"",clientId:"",clientSecret:"",tokenUrl:"",accessToken:"",scopes:[]}},J$e={securityType:ne.NoAuth,securitySchemeId:null,[ne.BasicAuth]:{username:"",password:""},[ne.JWT]:{token:""},[ne.DigestAuth]:{username:"",password:"",nc:"00000001",realm:"",nonce:"",opaque:"",qop:"",algorithm:"",cnonce:""},[ne.APIKey]:{location:Os.Header,name:"",key:""},[ne.OAuth2]:CE,[ne.OpenIDConnect]:{...CE,openIdConnectUrl:"",userInfoUrl:""}},K$e={clientCredentials:oe.ClientCredentials,clientCredentialsWithJwtAssertion:oe.ClientCredentialsWithJwtAssertion,authorizationCode:oe.AuthorizationCode,authorizationCodeWithPkce:oe.AuthorizationCodeWithPkce,implicit:oe.Implicit,password:oe.Password},z0="urn:ietf:params:oauth:client-assertion-type:jwt-bearer";var Ur=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(Ur||{});const eAe={[Ur.SIMPLE]:{condition:"",type:Ur.SIMPLE},[Ur.REGEX]:{condition:"",type:Ur.REGEX,context:""},[Ur.JSONPATH]:{condition:"",type:Ur.JSONPATH,context:""},[Ur.XPATH]:{condition:"",type:Ur.XPATH,context:""}};function Th(){return structuredClone({type:Hn.Text,content:"",activeExampleName:"",formData:{"multipart/form-data":[],"application/x-www-form-urlencoded":[]},binary:null})}const tAe={method:"GET",url:"",security:[lo()],body:Th(),queryParameters:[],headers:[],cookies:[],pathParameters:[]};function oG(){return structuredClone(tAe)}function lo(){return ja(J$e)}function aG(t){return ja({id:crypto.randomUUID(),...eAe[t]})}const nAe=new Hi({cdataPropName:"#cdata"}),rAe=/^[^\\/]+\.[a-z0-9]{1,5}$/i,lG=/^text\/|json|xml|x-www-form-urlencoded/i,iAe=new Set(["$ref","allOf"]);function sAe(t,e,n,r){const i=Ra(r)?r:void 0,s=lAe(i,t);return n&&mAe(n)?aAe(t,e,n,s,i):oAe(t,e,n,s,i)}function oAe(t,e,n,r,i){const s=uG(r,e,i),o=(n?.contentType??"").split(",").map(h=>h.trim()).filter(Boolean),a=o.find(h=>!h.split(";")[0].includes("*")),l=a??o[0],c=Array.isArray(e)?e:[e],u=c.filter(h=>gAe(h,l)),f=fG(n);if(s.binary==="encoded"){const h=hAe(f,s.contentEncoding);return u.map(p=>({key:t,value:Lf(p),file:!1,contentType:a??"application/octet-stream",headers:h}))}return dG(s,c)||o.length>0&&!lG.test(o[0])?c.map(h=>{const p={key:t,value:Lf(h),file:!0};return a&&(p.contentType=a),f&&(p.headers=f),p}):u.map(h=>{const p=o.length===0&&(hG(h)||s.type==="object"||s.type==="array"||s.type===void 0&&typeof h=="string"&&pG(h)),m=a??(p?"application/json":void 0),g={key:t,value:OAe(h,l,s.xmlName??t),file:!1};return m&&(g.contentType=m),f&&(g.headers=f),g})}function aAe(t,e,n,r,i){const s=n.style??"form",o=n.explode??s==="form",a=fG(n),l=(m,g)=>({key:m,value:Lf(g),file:!1,...a&&{headers:a}}),c=pAe(e);if(c===void 0)return[];const u=Array.isArray(c)?c:[c],f=dG(uG(r,c,i),u);if(Array.isArray(c)&&o&&s!=="deepObject")return c.map(m=>({...l(t,m),file:f}));if(!hG(c))return[{...l(t,c),file:f}];const h=s==="spaceDelimited"?" ":s==="pipeDelimited"?"|":",";if(Array.isArray(c))return[l(t,c.map(Lf).join(h))];const p=Object.entries(c);return s==="deepObject"?p.map(([m,g])=>l(`${t}[${m}]`,g)):o?p.map(([m,g])=>l(m,g)):[l(t,p.flatMap(([m,g])=>[m,Lf(g)]).join(h))]}function lAe(t,e){return cG(IQ(t,t).members.map(n=>Ra(n.properties)?n.properties[e]:void 0))}function cAe(t,e){return cG(IQ(t,e).members.map(n=>n.items))}function cG(t){const e=t.filter(Ra);return e.length>1?{allOf:e}:e[0]}function uG(t,e,n){const r=PV(t,n);return Array.isArray(e)||r.type==="array"?PV(cAe(t,n),n):r}function dG(t,e){return t.binary==="raw"||t.emptySchema===!0&&e.every(uAe)}function uAe(t){return t==null||t===""||typeof t=="string"&&rAe.test(t)}function PV(t,e){if(!t)return{};const{members:n,unresolved:r}=IQ(t,e),i=n.map(u=>fAe(u.type)).find(Boolean),s=n.map(u=>Ra(u.xml)?u.xml.name:void 0).find(u=>typeof u=="string"&&u!==""),o=n.map(u=>u.contentEncoding).find(u=>typeof u=="string")??(n.some(u=>u.format==="byte")?"base64":void 0);if(o&&o.toLowerCase()!=="binary")return{type:i,xmlName:s,binary:"encoded",contentEncoding:o};const a=n.map(u=>u.contentMediaType).find(u=>typeof u=="string"),l=o!==void 0||n.some(u=>u.format==="binary")||a!==void 0&&!lG.test(a),c=!r&&n.every(u=>Object.keys(u).every(f=>iAe.has(f)));return{type:i,xmlName:s,...l?{binary:"raw"}:c&&{emptySchema:!0}}}function IQ(t,e){const n=[];let r=!1;const i=s=>{if(!(!Ra(s)||n.includes(s))){if(n.push(s),typeof s.$ref=="string"){const o=dAe(e,s.$ref);o?i(o):r=!0}Array.isArray(s.allOf)&&s.allOf.forEach(i)}};return i(t),{members:n,unresolved:r}}function dAe(t,e){const n="#/components/schemas/";if(!e.startsWith(n))return;const r=Ra(t?.components)?t.components.schemas:void 0,i=Ra(r)?r[ph.unescape(e.slice(n.length))]:void 0;return Ra(i)?i:void 0}function fAe(t){return typeof t=="string"?t:Array.isArray(t)?t.find(e=>typeof e=="string"&&e!=="null"):void 0}function Ra(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function fG(t){const e=Object.entries(t?.headers??{});return e.length>0?Object.fromEntries(e):void 0}function hAe(t,e){const n=t??{};return Object.keys(n).some(r=>r.toLowerCase()==="content-transfer-encoding")?n:{...n,"Content-Transfer-Encoding":e}}function hG(t){return typeof t=="object"&&t!==null}function pAe(t){const e=Array.isArray(t)?t.filter(Vy):Ra(t)?Object.fromEntries(Object.entries(t).filter(([,n])=>Vy(n))):t;return Vy(e)&&!(typeof e=="object"&&Object.keys(e).length===0)?e:void 0}function gAe(t,e){return Vy(t)||e!==void 0&&/json/i.test(e)}function Vy(t){return t!=null}function mAe(t){return t.style!==void 0||t.explode!==void 0||t.allowReserved!==void 0}function Lf(t){return t==null?"":typeof t=="string"?t:JSON.stringify(t)}function OAe(t,e,n){return Ra(t)&&e&&/xml/i.test(e)?nAe.build({[n]:t}):e&&/json/i.test(e)?typeof t=="string"&&pG(t)?t:JSON.stringify(t)??"":Lf(t)}function pG(t){try{const e=JSON.parse(t);return typeof e=="object"&&e!==null}catch{return!1}}function gG(t,e,n,r){if(!t||typeof t!="object")return[];const i=e===Ye.FormData;return Object.entries(t).flatMap(([s,o])=>sAe(s,o,n?.[s],r).map(a=>({id:crypto.randomUUID(),key:a.key,value:a.value,active:!0,type:i&&a.file?"file":"text",files:null,...i&&a.contentType&&{contentType:a.contentType},...i&&a.headers&&{headers:a.headers}})))}function PE(t){return typeof t!="string"?JSON.stringify(t,null,2):t}function mG(t){let e=t;if(typeof e=="string")try{e=JSON.parse(e)}catch{return}if(!e||typeof e!="object"||Array.isArray(e))return;const n=e;return typeof n.query=="string"?n:void 0}function bl(t){const e=mG(t);return e?{query:e.query,variables:e.variables===void 0?"":PE(e.variables)}:{query:PE(t),variables:""}}function X0(t,e){return JSON.stringify({query:t,variables:e})}function OG(t){if(t.trim())try{const e=JSON.parse(t);return typeof e=="string"?t:e}catch{return t}}function vAe(t){const e=mG(t);return!e||typeof e.variables!="string"?t:JSON.stringify({...e,variables:OG(e.variables)},null,2)}function vG(t,e,n){for(const r of n){const i=kV(t,r),s=kV(e,r);if(typeof i=="object"&&typeof s=="object"){if(!vG(i,s,n))return!1}else if(i!==s)return!1}return!0}function kV(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 yAe(t,e){return t.length===e.length&&t.sort().join()===e.sort().join()}function bAe(t,e){return t.every(n=>e.includes(n))}function xAe(t){switch(t){case"query":return Os.Query;case"cookie":return Os.Cookie;case"header":return Os.Header;default:return}}function SAe(t,e,n){const{security:r}=e,i=t?.inputs??[];if(!n)return!1;const s=TS(n),o=s.map(c=>c.securityType),a=r.map(c=>c.securityType);return yAe(o,a)?!r.every(c=>{const u=c.securityType,f=c[ne.OAuth2]?.grantType,h=o.includes(u),p=s.find(v=>v.securityType===u),m=!p||vG(c,p,TAe(u,f)),g=wAe(c,u,c[ne.OAuth2]?.grantType,i),O=!!(h&&p&&m&&g);return!n.security?.length||O}):!0}function wAe(t,e,n,r){if(e===ne.OAuth2&&(n===oe.AuthorizationCode||n===oe.AuthorizationCodeWithPkce||n===oe.Implicit)){const i=t[ne.OAuth2][n]?.availableScopes,s=wS(t[ne.OAuth2][n]?.scopes,r);return bAe(s,i)}return!0}function TAe(t,e){return t===ne.APIKey?[`${ne.APIKey}/name`,`${ne.APIKey}/location`]:t===ne.OAuth2?[`${ne.OAuth2}/grantType`,...CAe(e)]:t===ne.OpenIDConnect?[`${ne.OpenIDConnect}/openIdConnectUrl`]:[]}function CAe(t){return t===oe.ClientCredentials?[`${ne.OAuth2}/${oe.ClientCredentials}/tokenUrl`]:t===oe.Password?[`${ne.OAuth2}/${oe.Password}/tokenUrl`]:t===oe.Implicit?[`${ne.OAuth2}/${oe.Implicit}/authorizationUrl`]:t===oe.AuthorizationCode?[`${ne.OAuth2}/${oe.AuthorizationCode}/tokenUrl`,`${ne.OAuth2}/${oe.AuthorizationCode}/authorizationUrl`]:t===oe.AuthorizationCodeWithPkce?[`${ne.OAuth2}/${oe.AuthorizationCodeWithPkce}/tokenUrl`,`${ne.OAuth2}/${oe.AuthorizationCodeWithPkce}/authorizationUrl`]:[]}function PAe(t){return t.map(e=>{const n=e.map(r=>r.id).join("_");return e.map(r=>({...r,schemeId:n}))})}function kAe(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(AQ(o))}),{id:i,security:s}});return e.length?n:[]}function EAe(t,e){const n=t.security||[];return n?.length?CG(n).map((r,i)=>AQ(r)):[]}function yG(t){if(!(t.securityType!==ne.NoAuth||!t.securitySchemeId))return t.unsupportedScheme}function IAe(t){return t==="mutualTLS"?"scheme needs a client certificate, which the console cannot attach to a request, so this request is sent without one.":"scheme is not supported, so this request is sent without credentials. If your API accepts an Authorization header, you can add it in the Headers tab."}function TS(t){const n=(t.security||[])[0];return n?n.map(r=>AQ(r)):[lo()]}const $Ae={[ne.OAuth2]:"oauth2",[ne.OpenIDConnect]:"openIdConnect",[ne.APIKey]:"apiKey",[ne.JWT]:"http-bearer"};function AAe(t){return $Ae[t]}function QAe(t){const e=$Q(t);return(e?[...cs(e)][0]:void 0)??RAe(t)}function RAe(t){const e=t.securitySchemeId;if(e){if(t.securityType===ne.JWT)return e+rt.SecurityVariablesEnvSuffix.JWTToken;if(t.securityType===ne.APIKey)return e+rt.SecurityVariablesEnvSuffix.APIKey;if(t.securityType===ne.OAuth2||t.securityType===ne.OpenIDConnect)return e+rt.SecurityVariablesEnvSuffix.Token}}function _Ae(t,e){const n=$Q(t);if(!n)return"";const r=[...cs(n)][0];return r?e.find(i=>i.name===r)?.value??"":n}function EV(t,e){if(t.securityType===ne.JWT)return{...t,[ne.JWT]:{...t[ne.JWT],token:e}};if(t.securityType===ne.APIKey)return{...t,[ne.APIKey]:{...t[ne.APIKey],key:e}};if(t.securityType===ne.OAuth2||t.securityType===ne.OpenIDConnect){const n=t.securityType,r=t[n],i=r.grantType;return{...t,[n]:{...r,[i]:{...r[i],accessToken:e}}}}return t}function $Q(t){if(t.securityType===ne.JWT)return t[ne.JWT].token;if(t.securityType===ne.APIKey)return t[ne.APIKey].key;if(t.securityType===ne.OAuth2){const e=t[ne.OAuth2];return e[e.grantType]?.accessToken}if(t.securityType===ne.OpenIDConnect){const e=t[ne.OpenIDConnect];return e[e.grantType]?.accessToken}}function AQ(t,e){const n={...lo(),securitySchemeId:t.id},r=CS(t);n.securityType=r,n.unsupportedScheme=r===ne.NoAuth?t.scheme||t.type:void 0;const i=t.id;if(t.id&&r!==ne.NoAuth&&(n[r].schemeName=t.id),r===ne.BasicAuth&&(n[ne.BasicAuth].username||(n[ne.BasicAuth].username=Dn(i+rt.SecurityVariablesEnvSuffix.Username)),n[ne.BasicAuth].password||(n[ne.BasicAuth].password=Dn(i+rt.SecurityVariablesEnvSuffix.Password))),r===ne.DigestAuth&&(n[ne.DigestAuth].username||(n[ne.DigestAuth].username=Dn(i+rt.SecurityVariablesEnvSuffix.Username)),n[ne.DigestAuth].password||(n[ne.DigestAuth].password=Dn(i+rt.SecurityVariablesEnvSuffix.Password))),r===ne.JWT&&!n[ne.JWT].token&&(n[ne.JWT].token=Dn(i+rt.SecurityVariablesEnvSuffix.JWTToken)),r===ne.APIKey&&!n[ne.APIKey].key){n[ne.APIKey].name=t.name||"",n[ne.APIKey].key=Dn(i+rt.SecurityVariablesEnvSuffix.APIKey);const s=xAe(t.in);s&&(n[ne.APIKey].location=s)}if(r===ne.OAuth2){const s=jQ(t),o=Dn(i+rt.SecurityVariablesEnvSuffix.Token),a=n[ne.OAuth2];a.grantType=s[0],s.forEach(l=>{l===oe.AuthorizationCode&&!a[oe.AuthorizationCode].accessToken&&(a[oe.AuthorizationCode].accessToken=o,a[oe.AuthorizationCode].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.AuthorizationCode].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[oe.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[oe.AuthorizationCode].clientSecret=Dn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.AuthorizationCode].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[oe.AuthorizationCode].scopes=[...lc(t.flows?.authorizationCode?.scopes||{})||[]]),l===oe.AuthorizationCodeWithPkce&&!a[oe.AuthorizationCodeWithPkce].accessToken&&(a[oe.AuthorizationCodeWithPkce].accessToken=o,a[oe.AuthorizationCodeWithPkce].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.AuthorizationCodeWithPkce].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[oe.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[oe.AuthorizationCodeWithPkce].clientSecret=Dn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.AuthorizationCodeWithPkce].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[oe.AuthorizationCodeWithPkce].scopes=[...lc(t.flows?.authorizationCode?.scopes||{})]),l===oe.ClientCredentials&&!a[oe.ClientCredentials].accessToken&&(a[oe.ClientCredentials].accessToken=o,a[oe.ClientCredentials].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.ClientCredentials].clientSecret=Dn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.ClientCredentials].tokenUrl=t.flows?.clientCredentials?.tokenUrl||"",a[oe.ClientCredentials].scopes=[...lc(t.flows?.clientCredentials?.scopes||{})]),l===oe.ClientCredentialsWithJwtAssertion&&!a[oe.ClientCredentialsWithJwtAssertion].accessToken&&(a[oe.ClientCredentialsWithJwtAssertion].accessToken=o,a[oe.ClientCredentialsWithJwtAssertion].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.ClientCredentialsWithJwtAssertion].clientAssertion=Dn(i+rt.SecurityVariablesEnvSuffix.ClientAssertion),a[oe.ClientCredentialsWithJwtAssertion].scopes=[...lc(t.flows?.clientCredentials?.scopes||{})]),l===oe.Implicit&&!a[oe.Implicit].accessToken&&(a[oe.Implicit].accessToken=o,a[oe.Implicit].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.Implicit].authorizationUrl=t.flows?.implicit?.authorizationUrl||"",a[oe.Implicit].availableScopes=Object.keys(t.flows?.implicit?.scopes||{})||[],a[oe.Implicit].scopes=[...lc(t.flows?.implicit?.scopes||{})]),l===oe.Password&&!a[oe.Password].accessToken&&(a[oe.Password].accessToken=o,a[oe.Password].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),a[oe.Password].clientSecret=Dn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),a[oe.Password].tokenUrl=t.flows?.password?.tokenUrl||"",a[oe.Password].scopes=[...lc(t.flows?.password?.scopes||{})])})}if(r===ne.OpenIDConnect){const s=Dn(i+rt.SecurityVariablesEnvSuffix.Token),o=n[ne.OpenIDConnect];!o.openIdConnectUrl&&t.openIdConnectUrl&&(o.openIdConnectUrl=t.openIdConnectUrl),o[oe.AuthorizationCode].accessToken||(o[oe.AuthorizationCode].accessToken=s,o[oe.AuthorizationCode].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),o[oe.AuthorizationCode].clientSecret=Dn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),o[oe.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[oe.AuthorizationCodeWithPkce].accessToken||(o[oe.AuthorizationCodeWithPkce].accessToken=s,o[oe.AuthorizationCodeWithPkce].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId),o[oe.AuthorizationCodeWithPkce].clientSecret=Dn(i+rt.SecurityVariablesEnvSuffix.ClientSecret),o[oe.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),o[oe.Implicit].accessToken||(o[oe.Implicit].accessToken=s,o[oe.Implicit].clientId=Dn(i+rt.SecurityVariablesEnvSuffix.ClientId))}return n}function QQ(t){try{const e=JSON.parse(t);return JSON.stringify(e,null,2)}catch(e){return console.error({error:e}),t}}function bG(t,e){return t==="application/json"&&!!e}function xG(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function jAe(t){try{const e=JSON.stringify(t);return e===void 0?"undefined":e}catch{return String(t)}}function SG(t,e){return e&&e.length>0?rG(e):ya(t||[],{})}function NAe(t,e,n){if(e&&e.length>0){const r=rG(e);return DAe(r,n)}return ya(t||[],{boundNames:n})}function DAe(t,e){return t.map(n=>!n.key||!e.has(n.key)?n:{...n,value:`$inputs.${n.key}`,active:!0})}function MAe(t,e=!1,n="",r){const i=EQ(t.parameters,"in"),s=_Q(t),o=TS(t),a=SG(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:ya(i.path||[],{}),method:t.method.toLowerCase()==="x-query"?"QUERY":t.method.toLocaleUpperCase(),url:EO(H$e(t.path),a),headers:ya(i.header||[],{}),queryParameters:a,cookies:ya(i.cookie||[],{}),body:s,security:o},response:null}}function RQ(t,e){const n=EQ(t.parameters,"in"),r=_Q(t),i=TS(t),s=ya(n.path||[],{boundNames:"all"});return e?{parameters:{pathParameters:s,queryParameters:NAe(n.query,n.querystring,sG(n.query,n.querystring,e)),headers:ya(n.header||[],{boundNames:Vf(n.header,"header",e)}),cookies:ya(n.cookie||[],{boundNames:Vf(n.cookie,"cookie",e)})},requestBody:r,security:i}:{parameters:{pathParameters:s,queryParameters:SG(n.query,n.querystring),headers:ya(n.header||[],{}),cookies:ya(n.cookie||[],{})},requestBody:r,security:i}}function VAe(t,e){const n=new Hi({format:!0});if(typeof t=="string")return e?.includes("json")?QQ(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 LAe(t){return EA.includes(t)}function _Q(t){const e=t.body?.mediaTypes;if(!e||!Object.keys(e).length)return Th();const n=FAe(e,t),r=n?.name||"",i=LAe(r),s=!i&&!gB.includes(r),o=kE(n),l=o.find(({key:f})=>f===t.body?.activeExampleName)?.value??o[0]?.value,c=s&&l?VAe(l,r):"",u={"multipart/form-data":IV(e["multipart/form-data"]),"application/x-www-form-urlencoded":IV(e["application/x-www-form-urlencoded"])};if(i&&l){const f=gG(l,r,n?.encoding,n?.schema);f.length&&(u[r]=f)}return{...Th(),activeExampleName:t.body?.activeExampleName||o[0]?.key||"",...n&&{type:n.name},content:c,formData:u}}const zAe={[Ye.GraphqlJSON]:"graphql"};function ep(t,e){const n=zAe[t];return!n||e?.[n]===!0}function wG(t,e){return ep(t,e)?mc[t]:void 0}function TG(t,e){const n=Object.fromEntries(Object.entries(mc).filter(([r])=>ep(r,e)));return t?{...XAe(t),...n}:n}function XAe(t){return Object.keys(t.body?.mediaTypes||{}).reduce((e,n)=>(e[n]={name:n,extensions:void 0},e),{})}function IV(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 UAe="Untitled example";function kE(t){const e=t?.examples;return Object.keys(e||{}).map(n=>{const r=e?.[n];return{name:(wl.isString(r?.summary)?r?.summary:r?.summary?.raw)?.trim()||n||UAe,key:n,value:e?.[n].value}})}function FAe(t,e){const n=TG(e),r=Object.keys(t).find(i=>!!n[i]);return r?t[r]:null}function qAe(t){return!t?.security?.length||!t?[]:EAe(t)}function CG(t){const e=new Set;return t.flat().filter(n=>e.has(n.id)?!1:(e.add(n.id),!0))}function CS(t){if(t.type==="http"){const e=t.scheme?.toLowerCase();if(e==="bearer")return ne.JWT;if(e==="basic")return ne.BasicAuth;if(e==="digest")return ne.DigestAuth}else{if(t.type==="apiKey")return ne.APIKey;if(t.type==="oauth2")return ne.OAuth2;if(t.type==="openIdConnect")return ne.OpenIDConnect}return ne.NoAuth}function WAe(t,e){if(t==="clientCredentials"&&e&&"x-assertionType"in e&&e["x-assertionType"]===z0)return oe.ClientCredentialsWithJwtAssertion;if(t==="authorizationCode"&&e&&"x-usePkce"in e&&e["x-usePkce"])return oe.AuthorizationCodeWithPkce;switch(t){case"implicit":return oe.Implicit;case"password":return oe.Password;case"clientCredentials":return oe.ClientCredentials;case"authorizationCode":return oe.AuthorizationCode;default:return oe.AuthorizationCode}}function BAe(t,e){const n=t?.security;if(!n?.length)return[];const s=PAe(n).flat().filter(o=>o.schemeId===e).find(o=>CS(o)===ne.OAuth2);return jQ(s)}function jQ(t){return Object.entries(t?.flows||{}).map(([e,n])=>WAe(e,n)).filter(Boolean)}function PS(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function Fs(t){try{return new URL(t),!0}catch{return!1}}function ZAe(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(T6(e))n=e;else if(!e.startsWith("/"))n=OE(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return OE(n)}function $V(t,e){let n=t;return e.forEach(({key:r,value:i,active:s})=>{i&&s&&(n=n.replaceAll(`{${r}}`,i))}),n}function PG(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function GAe(t){return t.startsWith("http://")||t.startsWith("https://")}function Wv({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(GAe(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 kG="New Step";function EE({name:t=kG,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=YAe(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function YAe(t){return t.steps.filter(e=>e.state!==Xt.Draft).map(e=>e.stepId)}function Da({name:t=kG,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:s,dynamicReplayValues:o,xOperation:a}={}){if(!n){const l=s?RQ(s,o):null,c=[lo()];return{stepId:EE({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?Xt.Draft:Xt.Normal,parameters:{pathParameters:[],queryParameters:a?IO(a.url):[],headers:[],cookies:[]},requestBody:Th(),xOperation:a??(i?null:{method:"GET",url:""}),security:c,operation:i??null,...l}}return{stepId:EE({name:t,workflow:r}),description:n.description,outputs:n.outputs,successCriteria:n.successCriteria,state:e?Xt.Draft:Xt.Normal,parameters:n.parameters,requestBody:n.requestBody,xOperation:n.xOperation,security:n.security,operation:n.operation}}function Rl(t){return t.xOperation?.method??t.operation?.method??""}function Yu(t){return t.xOperation?.url??t.operation?.path??""}function IE({operation:t,requestBody:e}){return t?t.path==="/"&&e.type===Ye.GraphqlJSON?"":t.path:""}function kS(t,e,n,r,i){const{inputs:s,servers:o}=r,a=I$e(Sc("path",[Ln(e?.parameters.pathParameters,n?.components.parameters),Ln(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=$V(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?PG(m.value,m.variables):"")+$V(IE(t),a)}const h=u.split("?")[0];return{url:Mf(h,s,i??{}),method:f.toUpperCase()}}function EG(){return structuredClone({id:crypto.randomUUID(),state:xn.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Ue.Step,draftStep:Da(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1}})}function HAe(t){return t?.data?.type===Ue.Step}function JAe(t,e){const{collectionId:n,workflowId:r,stepId:i}=e,s=e.draftStep??null;return n&&r&&i?kO(t,{collectionId:n,workflowId:r,stepId:i})??s:s}function KAe(t,e,n,r,i,s){const o=a=>a??"";return o(t)===r&&o(e)===i&&o(n)===s}const $E="New workflow";function IG({name:t=$E,collection:e}){let r=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||$E).replaceAll(" ","-").toLowerCase();if(!e)return r;const i=eQe(e);if(i.includes(r)){let s=1;for(;i.includes(`${r}-${s}`);)s++;r=`${r}-${s}`}return r}function eQe(t){return t.workflows.filter(e=>e.state!==Xt.Draft).map(e=>e.workflowId)}function NQ({name:t=$E,isDraft:e=!1,collection:n}={}){return{workflowId:IG({name:t,collection:n}),summary:t,steps:[],state:e?Xt.Draft:Xt.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[lo()]}}function tQe(t,e,n){const r=new Set,i=e?.components.parameters,{pathParameters:s,queryParameters:o,headers:a,cookies:l}=t.parameters,c=t.outputs;for(const{value:u}of[...Ln([...s,...o,...a,...l],i),...c])for(const f of cs(u))r.add(f);return t.steps.forEach(u=>{const f=u.security;for(const x of f)switch(x.securityType){case ne.BasicAuth:case ne.DigestAuth:for(const y of[x[x.securityType].username,x[x.securityType].password])for(const w of cs(y))r.add(w);break;case ne.JWT:for(const y of cs(x[x.securityType].token))r.add(y);break;case ne.APIKey:for(const y of cs(x[x.securityType].key))r.add(y);break;case ne.OAuth2:case ne.OpenIDConnect:{const y=x[x.securityType];for(const w of cs(y[y.grantType].accessToken))r.add(w);break}}const{pathParameters:h,queryParameters:p,headers:m,cookies:g}=u.parameters,O=u.outputs;for(const{value:x}of[...Ln([...h,...p,...m,...g],i),...O])for(const y of cs(x))r.add(y);const v=u.requestBody;switch(v.type){case Ye.FormData:case Ye.UrlEncoded:{for(const{value:x}of v.formData[v.type])for(const y of cs(x))r.add(y);break}case Ye.Binary:break;case Ye.GraphqlJSON:{const{query:x,variables:y}=ep(Ye.GraphqlJSON,n)?bl(v.content):{query:v.content,variables:""};for(const w of[x,y])for(const S of cs(w))r.add(S);break}default:for(const x of cs(v.content))r.add(x)}}),r}function $G(t,e,n,r,i){const s=tQe(t,n,i);if(s.size===0){r(({inputs:o,...a})=>a);return}r(o=>{const a=o.inputs,l=typeof a=="object"&&a?.properties||{};return{...o,inputs:{type:"object",properties:Object.fromEntries(Array.from(s).map(c=>{const u=e.inputs.find(f=>f.name===c)?.isSecret;return[c,u?{type:"string",format:"password"}:l[c]||{type:"string"}]}))}}})}function tp(t){return t.summary||t.workflowId||"Untitled Workflow"}function AG(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 ES=(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,e.operationId)??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 IS(t){const e=Wo(),{convertOperationToReplayValue:n}=Fn();return b.useMemo(()=>ES(e,t,n),[e,t,n])}function DQ(){const t=VA(),{convertOperationToReplayValue:e}=Fn();return{getApiOperation:b.useCallback(r=>ES(t(),r,e),[t,e])}}function QG(t){const e=(t.match(new RegExp("\\{(?<!\\{[^}]*?\\{)([^}]+)\\}","g"))||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function nQe(t){const e=t.servers?.[0];if(!e)return{url:"",variables:[]};const n=e.url,i=QG(n).map(s=>({name:s,value:e.variables?.[s]?.default||""}));return{url:n,variables:i}}function RG(){const t=VA(),e=ao();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}=nQe(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 sn{static utils=null;static async getUtils(){return sn.utils||(sn.utils=Rn()?await Promise.resolve().then(()=>require("./replay-tauri-path-Co_LYqH4.js")):{join:ac.join,resolve:ac.resolve,isAbsolute:ac.isAbsolute,relative:ac.relative,extname:ac.extname,dirname:ac.dirname}),sn.utils}static async dirname(e){return(await sn.getUtils()).dirname(e)}static async join(...e){return(await sn.getUtils()).join(...e)}static async resolve(e){return(await sn.getUtils()).resolve(e)}static async isAbsolute(e){return(await sn.getUtils()).isAbsolute(e)}static async relative(e,n){return(await sn.getUtils()).relative(e,n)}static async extname(e){return(await sn.getUtils()).extname(e)}}function rQe({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 AV(t,e){return`${t}\0${e}`}function md(){const t=yS(),e=Wa(),n=VA(),{attachApiServerToEnvironments:r}=RG();async function i({collectionId:l,apiId:c}){const u=Sh(t(),l);if(!u)return;if(!u.sourceDescriptions.some(h=>h.apiId===c)){const p=n().find(g=>g.id===c)?.info.title,m=Fs(c)?c:await sn.relative(`/${l}/..`,`/${c}`);e(g=>Xi(g,l,O=>O.sourceDescriptions.some(v=>v.apiId===c)?O:{...O,sourceDescriptions:[...O.sourceDescriptions,{name:rQe({apiName:p,sourceDescriptions:O.sourceDescriptions}),url:m,apiId:c}]}))}r(c)}function s(l){return Sh(t(),l)}function o(l,c){e(u=>Xi(u,l,f=>({...f,sourceDescriptions:f.sourceDescriptions.filter(h=>c.name!==h.name)})))}function a(l,c){const u=new Set(c.map(f=>AV(f.workflowId??"",f.stepId)));e(f=>Xi(f,l,h=>{const p=h.workflows.map(m=>{const g=m.steps.map(O=>!u.has(AV(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 iQe{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 AE=(t,e)=>e.some(n=>t instanceof n);let QV,RV;function sQe(){return QV||(QV=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function oQe(){return RV||(RV=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const QE=new WeakMap,nT=new WeakMap,$S=new WeakMap;function aQe(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(Qu(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return $S.set(e,t),e}function lQe(t){if(QE.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)});QE.set(t,e)}let RE={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return QE.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Qu(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 _G(t){RE=t(RE)}function cQe(t){return oQe().includes(t)?function(...e){return t.apply(_E(this),e),Qu(this.request)}:function(...e){return Qu(t.apply(_E(this),e))}}function uQe(t){return typeof t=="function"?cQe(t):(t instanceof IDBTransaction&&lQe(t),AE(t,sQe())?new Proxy(t,RE):t)}function Qu(t){if(t instanceof IDBRequest)return aQe(t);if(nT.has(t))return nT.get(t);const e=uQe(t);return e!==t&&(nT.set(t,e),$S.set(e,t)),e}const _E=t=>$S.get(t);function dQe(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Qu(o);return r&&o.addEventListener("upgradeneeded",l=>{r(Qu(o.result),l.oldVersion,l.newVersion,Qu(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 fQe=["get","getKey","getAll","getAllKeys","count"],hQe=["put","add","delete","clear"],rT=new Map;function _V(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(rT.get(e))return rT.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=hQe.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||fQe.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 rT.set(e,s),s}_G(t=>({...t,get:(e,n,r)=>_V(e,n)||t.get(e,n,r),has:(e,n)=>!!_V(e,n)||t.has(e,n)}));const pQe=["continue","continuePrimaryKey","advance"],jV={},jE=new WeakMap,jG=new WeakMap,gQe={get(t,e){if(!pQe.includes(e))return t[e];let n=jV[e];return n||(n=jV[e]=function(...r){jE.set(this,jG.get(this)[e](...r))}),n}};async function*mQe(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,gQe);for(jG.set(n,e),$S.set(n,_E(e));e;)yield n,e=await(jE.get(n)||e.continue()),jE.delete(n)}function NV(t,e){return e===Symbol.asyncIterator&&AE(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&AE(t,[IDBIndex,IDBObjectStore])}_G(t=>({...t,get(e,n,r){return NV(e,n)?mQe:t.get(e,n,r)},has(e,n){return NV(e,n)||t.has(e,n)}}));class MQ{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 MQ(e,n,r)}async initialize(){this.db||(this.db=await dQe(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const OQe=1;class VQ{constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=MQ.createInstance(n,OQe,this.setupDatabase);return new VQ(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 wc{static instance=null;static async initialize(e,n){this.close(),this.instance=await vQe(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function vQe(t,e){let n;if(e){const{HistorySqliteDBStorage:r}=await Promise.resolve().then(()=>require("./replay-HistorySqliteDBStorage-BrILW8Fu.js")),i=Rm.getInstance();n=new r(i)}else n=VQ.create(t.id);return new iQe(n)}const ui={all:["history"],lists:()=>[...ui.all,"list"],list:t=>[...ui.lists(),t],recent:(t,e)=>[...ui.all,"recent",t,e],detail:t=>[...ui.all,"detail",t],count:t=>[...ui.all,"count",t]};function yQe(t){return Pi.useQuery({queryKey:ui.list(t),queryFn:async()=>wc.getInstance().getAll(t)})}function NG(){const t=Pi.useQueryClient();return Pi.useMutation({mutationFn:async e=>{await wc.getInstance().addItem(e)},onMutate:e=>{t.setQueryData(ui.detail(e.id),e)},onSuccess:()=>{t.invalidateQueries({queryKey:ui.lists()}),t.invalidateQueries({queryKey:ui.count()})},onError:(e,n)=>{t.removeQueries({queryKey:ui.detail(n.id)}),console.error("Failed to add history item:",e)}})}function bQe(){const t=Pi.useQueryClient();return Pi.useMutation({mutationFn:async e=>{await wc.getInstance().deleteItem(e)},onSuccess:(e,n)=>{t.removeQueries({queryKey:ui.detail(n)}),t.invalidateQueries({queryKey:ui.lists()}),t.invalidateQueries({queryKey:ui.count()})},onError:(e,n)=>{console.error(`Failed to delete history item ${n}:`,e)}})}function xQe(){const t=Pi.useQueryClient();return Pi.useMutation({mutationFn:async()=>{await wc.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:ui.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function SQe(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function wQe(){const t=NG();return b.useCallback(({step:e,response:n})=>{const r=SQe(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function TQe(){const t=NG();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 CQe(){const t=Pi.useQueryClient();async function e(n){return t.ensureQueryData({queryKey:ui.detail(n),queryFn:()=>wc.getInstance().getById(n)})}return{getHistoryItem:e}}function DG(){const t=yS();return{getStep:n=>kO(t(),n)}}function PQe(t){const e=mi();return kO(e,{collectionId:t?.collectionId??null,workflowId:t?.workflowId??null,stepId:t?.stepId??null})??t?.draftStep??null}function MG(t,e){const n=t?.collectionId??null,r=t?.workflowId??null,i=t?.stepId??null,s=mi(),o=Wa(),a=kO(s,{collectionId:n,workflowId:r,stepId:i});if(a)return{step:a,updateStep:c=>o(u=>bS(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 LQ(){const t=yS();return{getWorkflow:({collectionId:n,workflowId:r})=>PO(t(),{collectionId:n,workflowId:r})}}function Lr(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 sf(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 nu,As,Dd,Bv,Ly;const DV="__TAURI_TO_IPC_KEY__";function VG(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}class LG{constructor(e){nu.set(this,void 0),As.set(this,0),Dd.set(this,[]),Bv.set(this,void 0),sf(this,nu,e||(()=>{})),this.id=VG(n=>{const r=n.index;if("end"in n){r==Lr(this,As,"f")?this.cleanupCallback():sf(this,Bv,r);return}const i=n.message;if(r==Lr(this,As,"f")){for(Lr(this,nu,"f").call(this,i),sf(this,As,Lr(this,As,"f")+1);Lr(this,As,"f")in Lr(this,Dd,"f");){const s=Lr(this,Dd,"f")[Lr(this,As,"f")];Lr(this,nu,"f").call(this,s),delete Lr(this,Dd,"f")[Lr(this,As,"f")],sf(this,As,Lr(this,As,"f")+1)}Lr(this,As,"f")===Lr(this,Bv,"f")&&this.cleanupCallback()}else Lr(this,Dd,"f")[r]=i})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){sf(this,nu,e)}get onmessage(){return Lr(this,nu,"f")}[(nu=new WeakMap,As=new WeakMap,Dd=new WeakMap,Bv=new WeakMap,DV)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[DV]()}}async function kn(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}class kQe{get rid(){return Lr(this,Ly,"f")}constructor(e){Ly.set(this,void 0),sf(this,Ly,e)}async close(){return kn("plugin:resources|close",{rid:this.rid})}}Ly=new WeakMap;var NE;(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"})(NE||(NE={}));var DE;(function(t){t[t.Start=0]="Start",t[t.Current=1]="Current",t[t.End=2]="End"})(DE||(DE={}));function zQ(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 XQ extends kQe{async read(e){if(e.byteLength===0)return 0;const[n,r]=await kn("plugin:fs|read",{rid:this.rid,len:e.byteLength});return e.set(n),r===0?null:r}async seek(e,n){return await kn("plugin:fs|seek",{rid:this.rid,offset:e,whence:n})}async stat(){const e=await kn("plugin:fs|fstat",{rid:this.rid});return zQ(e)}async truncate(e){await kn("plugin:fs|ftruncate",{rid:this.rid,len:e})}async write(e){return await kn("plugin:fs|write",{rid:this.rid,data:e})}}async function EQe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await kn("plugin:fs|create",{path:t instanceof URL?t.toString():t,options:e});return new XQ(n)}async function IQe(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await kn("plugin:fs|open",{path:t instanceof URL?t.toString():t,options:e});return new XQ(n)}async function $Qe(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 kn("plugin:fs|copy_file",{fromPath:t instanceof URL?t.toString():t,toPath:e instanceof URL?e.toString():e,options:n})}async function zG(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})}async function XG(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await kn("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})}async function UG(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const n=await kn("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 UQ(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await kn("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e})}async function AQe(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 kn("plugin:fs|read_text_file_lines",{path:n,options:e}));const[r,i]=await kn("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 FG(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})}async function qG(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 kn("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:n})}async function QQe(t,e){const n=await kn("plugin:fs|stat",{path:t instanceof URL?t.toString():t,options:e});return zQ(n)}async function RQe(t,e){const n=await kn("plugin:fs|lstat",{path:t instanceof URL?t.toString():t,options:e});return zQ(n)}async function _Qe(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|truncate",{path:t instanceof URL?t.toString():t,len:e,options:n})}async function jQe(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|write_file",e,{headers:{path:t instanceof URL?t.toString():t,options:JSON.stringify(n)}})}async function WG(t,e,n){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await kn("plugin:fs|write_text_file",{path:t instanceof URL?t.toString():t,data:e,options:n})}async function FQ(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await kn("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})}async function BG(t){await kn("plugin:fs|unwatch",{rid:t})}async function NQe(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 LG;s.onmessage=e;const o=await kn("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{BG(o)}}async function DQe(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 LG;s.onmessage=e;const o=await kn("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:r,onEvent:s});return()=>{BG(o)}}const $O=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return NE},FileHandle:XQ,get SeekMode(){return DE},copyFile:$Qe,create:EQe,exists:FQ,lstat:RQe,mkdir:zG,open:IQe,readDir:XG,readFile:UG,readTextFile:UQ,readTextFileLines:AQe,remove:FG,rename:qG,stat:QQe,truncate:_Qe,watch:NQe,watchImmediate:DQe,writeFile:jQe,writeTextFile:WG},Symbol.toStringTag,{value:"Module"}));function MQe(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function Gt(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}var $n;(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"})($n||($n={}));async function VQe(){return Gt("plugin:path|resolve_directory",{directory:$n.AppConfig})}async function ME(){return Gt("plugin:path|resolve_directory",{directory:$n.AppData})}async function LQe(){return Gt("plugin:path|resolve_directory",{directory:$n.AppLocalData})}async function zQe(){return Gt("plugin:path|resolve_directory",{directory:$n.AppCache})}async function XQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Audio})}async function UQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Cache})}async function FQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Config})}async function qQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Data})}async function ZG(){return Gt("plugin:path|resolve_directory",{directory:$n.Desktop})}async function WQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Document})}async function BQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Download})}async function ZQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Executable})}async function GQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Font})}async function YQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Home})}async function HQe(){return Gt("plugin:path|resolve_directory",{directory:$n.LocalData})}async function JQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Picture})}async function KQe(){return Gt("plugin:path|resolve_directory",{directory:$n.Public})}async function eRe(){return Gt("plugin:path|resolve_directory",{directory:$n.Resource})}async function tRe(t){return Gt("plugin:path|resolve_directory",{directory:$n.Resource,path:t})}async function nRe(){return Gt("plugin:path|resolve_directory",{directory:$n.Runtime})}async function rRe(){return Gt("plugin:path|resolve_directory",{directory:$n.Template})}async function iRe(){return Gt("plugin:path|resolve_directory",{directory:$n.Video})}async function sRe(){return Gt("plugin:path|resolve_directory",{directory:$n.AppLog})}async function oRe(){return Gt("plugin:path|resolve_directory",{directory:$n.Temp})}function GG(){return window.__TAURI_INTERNALS__.plugins.path.sep}function aRe(){return window.__TAURI_INTERNALS__.plugins.path.delimiter}async function YG(...t){return Gt("plugin:path|resolve",{paths:t})}async function lRe(t){return Gt("plugin:path|normalize",{path:t})}async function qQ(...t){return Gt("plugin:path|join",{paths:t})}async function HG(t){return Gt("plugin:path|dirname",{path:t})}async function JG(t){return Gt("plugin:path|extname",{path:t})}async function WQ(t,e){return Gt("plugin:path|basename",{path:t,ext:e})}async function KG(t){return Gt("plugin:path|is_absolute",{path:t})}const BQ=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return $n},appCacheDir:zQe,appConfigDir:VQe,appDataDir:ME,appLocalDataDir:LQe,appLogDir:sRe,audioDir:XQe,basename:WQ,cacheDir:UQe,configDir:FQe,dataDir:qQe,delimiter:aRe,desktopDir:ZG,dirname:HG,documentDir:WQe,downloadDir:BQe,executableDir:ZQe,extname:JG,fontDir:GQe,homeDir:YQe,isAbsolute:KG,join:qQ,localDataDir:HQe,normalize:lRe,pictureDir:JQe,publicDir:KQe,resolve:YG,resolveResource:tRe,resourceDir:eRe,runtimeDir:nRe,sep:GG,tempDir:oRe,templateDir:rRe,videoDir:iRe},Symbol.toStringTag,{value:"Module"})),Ro=window.__TAURI__?.http.fetch??globalThis.fetch;function MV(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 eY(t,e){const n=MV(t),r=e.find(({host:i,port:s})=>MV(`https://${i}:${s}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}const cRe={id:"default",userFilesDir:"default",systemFilesDir:"default"},U0=Dl(Mr(cRe));U0.debugLabel="project";function Od(){return $r(U0)}function VE(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const uRe=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function dRe(){const{userFilesDir:t}=Od(),{certificates:e}=pi(),n=Ft(),{getCollection:r}=md();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-TBsL9E-2.js")),Promise.resolve().then(()=>require("./replay-external-resolver-DRERucjM.js"))]),g=new m,O=c.map(w=>JSON.stringify({[w.name]:w.value})),v=fRe(u,f),{run:x}=await Promise.resolve().then(()=>require("./replay-respect-run-Df-HooUy.js")),y=await x({files:[h],workflow:o?[o]:[],fetch:(w,S)=>{const P=uRe(w),{clientCert:k,clientKey:I}=eY(P,e);return Ro(P,{...S,clientCert:k,clientKey:I})},logger:xS,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async w=>{if(!await FQ(w))throw new Error(`File ${w} doesn't exist or isn't readable.`);try{const P=await UQ(w),k=new TextEncoder().encode(P);return new File([k],await WQ(w))}catch(P){throw new Error(`Failed to read file ${w}: ${P}`)}}},envVariables:{},config:await p({}),externalRefResolver:g,input:O,server:v,severity:JSON.stringify(a),skipLint:!0,noSecretsMasking:!0});try{await g$e(s,o,y?.[0]?.ctx)}catch(w){console.error("Failed to persist workflow step context:",w)}return y}}}function fRe(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 hRe="com.redocly.tab.openFailed";function yf(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Ue.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,...t}}function LE(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function pRe(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:IA(IO(s),l.parameters.queryParameters)}}}:a})}function pr(){const{getTabs:t,getActiveTabIdx:e,setTabs:n,setActiveTabIdx:r,updateTabAt:i,updateTabDataAt:s}=cd(),{dynamicReplayValues:o}=Fn(),{getStep:a}=DG(),{getHistoryItem:l}=CQe(),{getWorkflow:c}=LQ(),{getCollection:u}=md(),{getApiOperation:f}=DQ(),{sendEvent:h}=Ke(),p=zIe(),m=b.useCallback((M,j,L,W)=>{console.warn(`[useTabHandlers] ${M}`,W),h(hRe,[{...be("tab",j),reason:L,...W}])},[h]),g=b.useCallback((M,j)=>{const L=t()[M];L&&L.state!==j&&i(M,W=>({...W,state:j}))},[t,i]),O=b.useCallback(M=>{r(M)},[r]),v=b.useCallback(()=>{const M=t().length;n(j=>[...j,EG()]),r(M)},[t,n,r]),x=b.useCallback(M=>{const j=[...t().filter(W=>W.state!==xn.Preview)];j.push(M),n(()=>j);const L=j.length-1;return r(L),L},[t,n,r]),y=b.useCallback(M=>{const j=f(M),L=ZQ(M,j,o);x(L)},[x,o,f]),w=b.useCallback(M=>{const j=t().findIndex(({data:L})=>V9(L,M));return j===-1?!1:(O(j),!0)},[t,O]),S=b.useCallback((M,j)=>{const L=t(),W=B=>L.findIndex(({data:K})=>_n(K,Ue.Step)&&B(K));if(j){const B=W(te=>te.sourceFile===j);if(B!==-1){pRe(L[B].data,te=>s(B,te),M),O(B);return}const K=W(te=>!te.sourceFile&&LE(te,M));if(K!==-1){s(K,te=>({...te,sourceFile:j})),O(K);return}}else{const B=W(K=>LE(K,M));if(B!==-1){O(B);return}}const q=Da({xOperation:M,name:j??void 0});x({id:crypto.randomUUID(),state:xn.Normal,data:yf({draftStep:q,activeTabName:xu(q),sourceFile:j??null})})},[t,s,O,x]),P=b.useCallback(M=>{const j=t(),L=e(),W=j[L]?.id,q=j.filter((K,te)=>te!==M);n(()=>q);const B=M===L||!W?-1:q.findIndex(K=>K.id===W);r(B===-1?Math.max(0,M-1):B)},[t,e,r,n]),k=b.useCallback(()=>{n(()=>[]),r(0)},[r,n]);function I({collectionId:M,workflowId:j,stepId:L}){const W=t(),q=new Set;for(let B=0;B<W.length;B++){const K=W[B].data;switch(K.type){case Ue.Step:K.collectionId===M&&K.workflowId===j&&K.stepId===L&&q.add(B);break;case Ue.Workflow:case Ue.WorkflowRun:K.collectionId===M&&K.workflowId===j&&!L&&q.add(B);break;case Ue.Collection:K.collectionId===M&&!j&&!L&&q.add(B);break}}q.size&&(n(B=>B.filter((K,te)=>!q.has(te))),r(0))}const E=b.useCallback(async M=>{const j=t().findIndex(({data:L})=>_n(L,Ue.Step)&&L.historyId===M);if(j!==-1)r(j);else{const L=await l(M);if(!L||!Xk(L)){m("Step history not found","stepHistoryTab","step_history_not_found",{historyId:M});return}const W=L.step;x({id:crypto.randomUUID(),state:xn.Preview,data:yf({historyId:M,draftStep:structuredClone(W),response:structuredClone(L.response),activeTabName:xu(W)})})}},[r,t,x,l,m]),Q=b.useCallback(({collectionId:M,activeTabName:j})=>{const L=t().findIndex(W=>{const q=W.data;return _n(q,Ue.Collection)&&q.collectionId===M});if(L!==-1)r(L);else{if(!u(M)){m("Collection not found","collectionTab","collection_not_found",{collectionId:M});return}x({id:crypto.randomUUID(),state:xn.Preview,data:{collectionId:M,type:Ue.Collection,activeTabName:j??it.COLLECTION_SETTINGS}})}},[r,t,x,u,m]),N=b.useCallback(({collectionId:M,workflowId:j})=>{if(!c({collectionId:M,workflowId:j})){m("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:M,workflowId:j});return}x({id:crypto.randomUUID(),state:xn.Normal,data:{collectionId:M,workflowId:j,historyId:null,runDate:null,type:Ue.WorkflowRun,result:null,severitySettings:VE()}})},[x,c,m]),R=b.useCallback(async(M,{state:j=xn.Preview}={})=>{const L=t().findIndex(({data:W})=>_n(W,Ue.WorkflowRun)&&W.historyId===M);if(L!==-1)j===xn.Normal&&t()[L].state===xn.Preview&&g(L,xn.Normal),r(L);else{const W=await l(M);if(!W||!Uk(W)){m("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:M});return}x({id:crypto.randomUUID(),state:j,data:{collectionId:W.collectionId,workflowId:W.workflowId,historyId:M,runDate:W.date,type:Ue.WorkflowRun,result:structuredClone(W.workflowResult),severitySettings:VE(),label:tp(W.workflow),secretValues:p().inputs.filter(q=>q.isSecret&&q.value).map(q=>String(q.value))}})}},[r,t,x,g,l,m,p]),D=b.useCallback(({collectionId:M,workflowId:j})=>{const L=t().findIndex(({data:W})=>_n(W,Ue.WorkflowRun)&&W.collectionId===M&&W.workflowId===j);return L===-1?!1:(t()[L].state===xn.Preview&&g(L,xn.Normal),O(L),!0)},[t,g,O]),z=b.useCallback(({collectionId:M,workflowId:j,activeTabName:L})=>{const W=t().findIndex(q=>{const B=q.data;return _n(B,Ue.Workflow)&&B.workflowId===j&&B.collectionId===M});if(W!==-1)L&&s(W,q=>({...q,activeTabName:L})),r(W);else{if(!c({collectionId:M,workflowId:j})){m("Workflow not found","workflowTab","workflow_not_found",{collectionId:M,workflowId:j});return}x({id:crypto.randomUUID(),state:xn.Preview,data:{collectionId:M,workflowId:j,type:Ue.Workflow,activeTabName:L??it.WORKFLOW_SETTINGS}})}},[r,t,s,x,c,m]),X=b.useCallback(({collectionId:M,workflowId:j,stepId:L,state:W})=>{const q=t().findIndex(({data:B})=>_n(B,Ue.Step)&&B.collectionId===M&&B.workflowId===j&&B.stepId===L&&B.historyId===null);if(q!==-1)r(q);else{const B=a({collectionId:M,workflowId:j,stepId:L});if(!B){m("Step not found","stepTab","step_not_found",{collectionId:M,workflowId:j,stepId:L});return}x({id:crypto.randomUUID(),state:W??xn.Preview,data:yf({stepId:L,collectionId:M,workflowId:j,activeTabName:xu(B)})})}},[r,t,a,x,m]),A=b.useCallback(({step:M})=>{x({id:crypto.randomUUID(),state:xn.Normal,data:yf({stepId:M.stepId??null,workflowId:M.workflowId??null,draftStep:structuredClone(M),activeTabName:xu(M)})})},[x]),U=b.useCallback((M,j)=>{if(M===j)return;const L=e(),W=[...t()],q=W[L]?.id,[B]=W.splice(M,1);if(W.splice(j,0,B),n(()=>W),q){const K=W.findIndex(te=>te.id===q);r(K)}},[e,t,n,r]);return{handleNewTabOpen:v,addNewTab:x,openStepTabFromOperation:y,focusOperationTab:w,openStepTabFromXOperation:S,handleTabChange:O,handleTabClose:P,handleCloseAllTabs:k,handleCloseByDataId:I,openCollectionTab:Q,openWorkflowTab:z,openWorkflowRunTab:N,openWorkflowRunTabFromHistory:R,focusWorkflowRunTab:D,openStepTabFromHistory:E,openStepTabFromCollection:X,openStepTab:A,handleTabReorder:U,changeTabState:g}}function ZQ(t,e,n){const r=Da({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:xn.Preview,data:yf({draftStep:r,activeTabName:xu(r)})}}function gRe(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const mRe=({transform:t})=>({...t,y:0}),ORe=({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))},vd=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,vRe=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"})]}),AS=T.default(vRe)`
787
787
  path {
788
788
  fill: ${({color:t})=>vd(t)};
789
789
  }
@@ -1148,7 +1148,7 @@ ${L}`),U.pop(),`{${K}}`}case"number":return isFinite(A)?String(A):y?y(A):"null";
1148
1148
  display: flex;
1149
1149
  flex-direction: column;
1150
1150
  gap: var(--spacing-xs);
1151
- `;function C_e({collection:t}){return d.jsx("div",{children:"TODO: ComponentsTab"})}function uY(t){const{attachApiServerToEnvironments:e}=RG(),n=Wa(),{removeSourceDescription:r,disconnectStepsFromSource:i}=md(),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=>Xi(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 F0(t,e){const[{bundle:n,bundleFromString:r,createConfig:i},{ExternalResolver:s}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-BU0VNqJi.js")),Promise.resolve().then(()=>require("./replay-external-resolver-Dz9QqU4-.js"))]),o={config:await i({}),externalRefResolver:new s,dereference:!0},{bundle:{parsed:a},fileDependencies:l}=e?await r({...o,source:e,absoluteRef:t}):await n({...o,ref:t,base:await sn.dirname(t)});return{definition:a,fileDependencies:l}}const qi={FS:"fs",WEB:"web"},UV=/^[A-Za-z0-9_-]+$/,P_e="apis";function k_e(t){if(!t)return{name:"",activeTab:P_e,selectedApiId:null,url:""};const e=Fs(t.url)||Fs(t.apiId);return{name:t.name,activeTab:e?"url":"apis",selectedApiId:e?null:t.apiId,url:e?t.url:""}}function E_e(t,e,n){return t.length===0?null:e?n?"This name already exists":null:"Name must match [A-Za-z0-9_-]+"}function I_e({collection:t,sourceDescriptionToEdit:e,sourceDescriptionToEditIndex:n}){const r=Wo(),i=LA(),{createOrUpdateSource:s}=uY(t.id),o=k_e(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((D,z)=>z!==n).map(D=>D.name)),[t.sourceDescriptions,n]),x=O.length>0&&v.has(O),y=UV.test(O),w=E_e(O,y,x),S=O.length>0&&y&&!x,P=p.trim(),k=P.length>0&&Fs(P),I=P.length>0&&!k?"Please enter a valid URL":null,E=S&&(c==="apis"?!!f:!!k),Q=b.useMemo(()=>r.map(D=>({id:D.id,name:D.info.title,path:Fs(D.id)?D.id:`./${D.id.replace(/^\//,"")}`})),[r]),N=b.useCallback(async()=>{const D=t.id,z=p.trim();if(c==="apis"){if(!f)return null;const A=Fs(f)?f:await sn.relative(`/${D}/..`,`/${f}`);return{apiId:f,sourceUrl:A}}if(!z||!Fs(z))return null;if(!r.some(A=>A.id===z)){const{definition:A,fileDependencies:U}=await F0(z);i(M=>[...M,{id:z,srcType:qi.WEB,...A,...U&&{fileDependencies:U}}])}return{apiId:z,sourceUrl:z}},[c,r,i,t,f,p]),R=b.useCallback(async()=>{const D=a.trim();if(!D||!UV.test(D))return;const z=await N();if(!z)return;const{apiId:X,sourceUrl:A}=z;s({name:D,apiId:X,sourceUrl:A,sourceDescriptionToEdit:g?e:null,sourceDescriptionToEditIndex:g?n:null})},[a,s,g,N,e,n]);return{name:a,setName:l,activeTab:c,setActiveTab:u,selectedApiId:f,setSelectedApiId:h,url:p,setUrl:m,nameErrorText:w,urlErrorText:I,canSubmit:E,apiItems:Q,handleSubmit:R}}const $_e=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"})]}),JQ=T.default($_e)`
1151
+ `;function C_e({collection:t}){return d.jsx("div",{children:"TODO: ComponentsTab"})}function uY(t){const{attachApiServerToEnvironments:e}=RG(),n=Wa(),{removeSourceDescription:r,disconnectStepsFromSource:i}=md(),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=>Xi(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 F0(t,e){const[{bundle:n,bundleFromString:r,createConfig:i},{ExternalResolver:s}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-TBsL9E-2.js")),Promise.resolve().then(()=>require("./replay-external-resolver-DRERucjM.js"))]),o={config:await i({}),externalRefResolver:new s,dereference:!0},{bundle:{parsed:a},fileDependencies:l}=e?await r({...o,source:e,absoluteRef:t}):await n({...o,ref:t,base:await sn.dirname(t)});return{definition:a,fileDependencies:l}}const qi={FS:"fs",WEB:"web"},UV=/^[A-Za-z0-9_-]+$/,P_e="apis";function k_e(t){if(!t)return{name:"",activeTab:P_e,selectedApiId:null,url:""};const e=Fs(t.url)||Fs(t.apiId);return{name:t.name,activeTab:e?"url":"apis",selectedApiId:e?null:t.apiId,url:e?t.url:""}}function E_e(t,e,n){return t.length===0?null:e?n?"This name already exists":null:"Name must match [A-Za-z0-9_-]+"}function I_e({collection:t,sourceDescriptionToEdit:e,sourceDescriptionToEditIndex:n}){const r=Wo(),i=LA(),{createOrUpdateSource:s}=uY(t.id),o=k_e(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((D,z)=>z!==n).map(D=>D.name)),[t.sourceDescriptions,n]),x=O.length>0&&v.has(O),y=UV.test(O),w=E_e(O,y,x),S=O.length>0&&y&&!x,P=p.trim(),k=P.length>0&&Fs(P),I=P.length>0&&!k?"Please enter a valid URL":null,E=S&&(c==="apis"?!!f:!!k),Q=b.useMemo(()=>r.map(D=>({id:D.id,name:D.info.title,path:Fs(D.id)?D.id:`./${D.id.replace(/^\//,"")}`})),[r]),N=b.useCallback(async()=>{const D=t.id,z=p.trim();if(c==="apis"){if(!f)return null;const A=Fs(f)?f:await sn.relative(`/${D}/..`,`/${f}`);return{apiId:f,sourceUrl:A}}if(!z||!Fs(z))return null;if(!r.some(A=>A.id===z)){const{definition:A,fileDependencies:U}=await F0(z);i(M=>[...M,{id:z,srcType:qi.WEB,...A,...U&&{fileDependencies:U}}])}return{apiId:z,sourceUrl:z}},[c,r,i,t,f,p]),R=b.useCallback(async()=>{const D=a.trim();if(!D||!UV.test(D))return;const z=await N();if(!z)return;const{apiId:X,sourceUrl:A}=z;s({name:D,apiId:X,sourceUrl:A,sourceDescriptionToEdit:g?e:null,sourceDescriptionToEditIndex:g?n:null})},[a,s,g,N,e,n]);return{name:a,setName:l,activeTab:c,setActiveTab:u,selectedApiId:f,setSelectedApiId:h,url:p,setUrl:m,nameErrorText:w,urlErrorText:I,canSubmit:E,apiItems:Q,handleSubmit:R}}const $_e=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"})]}),JQ=T.default($_e)`
1152
1152
  path {
1153
1153
  fill: ${({color:t})=>vd(t)};
1154
1154
  }
@@ -1622,7 +1622,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
1622
1622
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
1623
1623
  `,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)){Z0(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(cc(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(k8(n.key)&&!cc(n.sep,"newline")){const o=zd(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(cc(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const o=zd(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]}):cc(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&&!cc(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)){Z0(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||cc(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=Kv(r),s=zd(i);BL(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(`
1624
1624
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
1625
- `,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=Kv(e),r=zd(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=Kv(e),r=zd(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 MNe(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new NNe||null,prettyErrors:e}}function VNe(t,e={}){const{lineCounter:n,prettyErrors:r}=MNe(e),i=new DNe(n?.addNewLine),s=new ANe(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 tg(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(XL(t,n)),o.warnings.forEach(XL(t,n))),o}function mR(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function E8(t){return!hn(t)||t.value==null?null:typeof t.value=="string"?t.value:mR(t.value)?t.source??String(t.value):null}function jT(t,e){return E8(t)===e}function Rg(t){return hn(t)&&t.value==null}function iu(t){return t==null||Rg(t)||oi(t)||t instanceof Nt}function NT(t){return t==null||oi(t)||hn(t)&&(t.value==null||mR(t.value))}function LNe(t){return hn(t)&&typeof t.value=="string"}function wo(t,e){return oi(t.getIn(e,!0))}function zNe(t){const{contents:e}=t;return e instanceof Nt&&e.items.length===0&&!e.commentBefore&&!e.comment&&!t.commentBefore&&!t.comment}const XNe="<<",ZL="$ref";class UNe{constructor(e,n){this.providers=e,this.basePath=n}providers;basePath;sectionProblem(e){if(this.basePath.length===0){const s=e.contents;return iu(s)?s instanceof Nt?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(wo(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 iu(i)?i instanceof Nt?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(jc(o))continue;if(!iu(s.value))return`Environment ${o} in ${r} must be a map`;if(!(s.value instanceof Nt))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(!iu(o))return`The inputs of ${n} in ${i} must be a map`;if(o instanceof Nt){const l=`the inputs of ${n}`,c=this.managedKeysProblem(o,l);if(c)return c;for(const u of o.items)if(!NT(u.value)&&!(u.value instanceof Nt&&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(!iu(a))return`The servers of ${n} in ${i} must be a map`;if(a instanceof Nt){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(!iu(n))return`Server ${e} of ${r} in ${i} must be a map`;if(!(n instanceof Nt))return null;const s=this.reservedKeysProblem(n,`server ${e} of ${r}`);if(s)return s;const o=n.get("value",!0);if(!NT(o))return`The value of server ${e} of ${r} in ${i} must be a single value`;const a=n.get("variables",!0);if(!iu(a))return`The variables of server ${e} of ${r} in ${i} must be a map`;if(a instanceof Nt){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(!NT(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(!LNe(i.key))return`Replay reads only string keys, and ${n} holds ${String(i.key)}`;return null}reservedKeysProblem(e,n){return e.has(XNe)?`Replay cannot read a merge key, and ${n} uses one`:e.has(ZL)?`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||Rg(s))return null;const o=i.join(".");if(oi(s))return`The ${o} key is an alias, so Replay cannot manage the ${n} section inside it`;if(!(s instanceof Nt))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 Nt&&r.has(ZL))return!0}return!1}}const FNe=new Set(["inputs","servers"]),qNe=new Set(["value","variables"]);class WNe{constructor(e,n=[]){this.providers=e,this.basePath=n,this.validator=new UNe(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=oi(i)?i.resolve(e):i;return E8(s)??(mR(r)?String(r):"")}extractEnvironments(e,n){const r=this.readSectionData(e);return r?Object.keys(r).filter(s=>!jc(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:Xt.Normal}}):[]}hydrateDocument(e,n,r){if(wo(e,this.basePath))return e;for(let s=1;s<=this.basePath.length;s++){const o=this.basePath.slice(0,s);Rg(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);wo(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 Nt&&i.items.length===0&&e.deleteIn(r)}}}sectionProblem(e){return this.validator.sectionProblem(e)}isSectionAliased(e){return this.basePath.length>0&&wo(e,this.basePath)}hasEnvironments(e){const n=this.basePath.length===0?e.contents:e.getIn(this.basePath,!0);return n instanceof Nt&&n.items.length>0}hasUnreadContent(e){const n=e.getIn(this.basePath,!0);return n instanceof Nt?n.items.some(r=>this.environmentHoldsUnreadContent(r.value)):!1}environmentHoldsUnreadContent(e){return oi(e)?!0:e instanceof Nt?e.items.some(n=>{const r=String(n.key);return!FNe.has(r)||oi(n.value)?!0:r!=="servers"||!(n.value instanceof Nt)?!1:n.value.items.some(i=>{const s=i.value;return oi(s)?!0:s instanceof Nt?s.items.some(o=>!qNe.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 Nt&&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||Rg(n))return null;if(!oi(n)&&!(n instanceof Nt))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(!wo(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(!wo(e,l)){if(a.isSecret){const c=e.getIn(l,!0),u=c instanceof Nt?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}jT(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(!wo(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(wo(e,a))continue;Rg(e.getIn(a,!0))&&e.setIn(a,this.createBlockMap(e));const l=[...a,"value"];!wo(e,l)&&!jT(e.getIn(l,!0),o.value)&&e.setIn(l,o.value);const c=[...a,"variables"];if(wo(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];wo(e,h)||jT(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 Nt){s.flow=!1;continue}if(oi(s))return;e.setIn(i,this.createBlockMap(e))}}createBlockMap(e){const n=e.createNode({});return n instanceof Nt&&(n.flow=!1),n}deleteRemovedKeys(e,n,r){for(const i of this.getMapKeys(e,...n))!i.trim()||jc(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 Nt?r.items.map(i=>String(i.key)):[]}}class BNe{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 ZNe{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 GNe{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 YNe{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 zO={all:["notifications"],lists:()=>[...zO.all,"list"]};function HNe(){return Pi.useQuery({queryKey:zO.lists(),queryFn:async()=>Nm.getInstance().getAll()})}function JNe(){return Pi.useQuery({queryKey:zO.lists(),queryFn:async()=>Nm.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class Nm{static instance=null;static initialize(){this.close();const e=new YNe;this.instance=new GNe(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let DT=null;function FS(){return DT||(DT=new Pi.QueryClient({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),DT}function KNe(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 eDe(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:KNe(e)}]}function tDe(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function OR(t){try{const e=Nm.getInstance();await t(e),FS().invalidateQueries({queryKey:zO.all})}catch{}}async function G0(t,e){await OR(async n=>{await n.set(t,eDe(e))})}async function nDe(t,e){e.length!==0&&await OR(async n=>{await n.set(t,tDe(e))})}async function Y0(t){await OR(async e=>{await e.clear(t)})}function GL(t){return MT(t,e=>e.name).map(e=>({...e,inputs:Lk(e.inputs),servers:MT(e.servers,n=>n.apiId).map(n=>({...n,variables:MT(n.variables,r=>r.name)}))}))}function MT(t,e){const n=new Set,r=[];for(const i of t){const s=e(i);!rDe(s)||n.has(s)||(n.add(s),r.push(i))}return r}function rDe(t){return!!t.trim()&&!jc(t)}function iDe(t,e){return YL(t)===YL(e)}function YL(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 HL(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===Bh&&e.inputs.length===0&&e.servers.length===0}class sDe{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 WNe(new ZNe([new BNe],"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,Xd(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=GL(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(HL(i)){if(this.isSection){if(HL(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 iDe(GL(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 VO({}),i,r)}catch(l){return console.error(`Failed to update ${e}`,l),await this.blockOn(e,Xd(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,Xd(l),"secrets",s),"unavailable"}return this.store(e,a,s)}async serialize(e,n,{allowEmptyFile:r=!1}={}){try{return r&&zNe(n)?"":n.toString()}catch(i){return console.error(`Failed to serialize ${e}`,i),await this.blockOn(e,Xd(i)),null}}async store(e,n,r){try{await this.storage.set(e,n)}catch(i){return await this.reportUnavailable(e,Xd(i),"file",r),"unavailable"}return"written"}async blockOn(e,n){this.configError={filePath:e,issues:[{message:n.message}]},await G0(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 G0(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=VNe(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 nDe(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:Xd(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=>Y0(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 Xd(t){return t instanceof Error?t:new Error(String(t))}const JL=[1e3,3e3,1e4];class oDe{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<JL.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=JL[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 aDe{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 GE=(t,e)=>({data:t,version:e});class I8 extends aDe{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return GE(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(GE(e,this.version))}}const KL={activeTabIdx:0,tabs:[]};function lDe(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===Ue.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 cDe(t){const e=Th();return{...e,...t,formData:{...e.formData,...t?.formData}}}const VT=2,uDe="tabs.json";class dDe extends I8{migrationMap={1:lDe};constructor(e){super(e,uDe,ja(KL),VT)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=GE(ja(KL),VT)),n.version!==VT&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===Ue.Step){if(i.data.draftStep){i.data.draftStep.requestBody=cDe(i.data.draftStep.requestBody);const s=i.data.draftStep.requestBody.formData;s["multipart/form-data"]=await e3(s["multipart/form-data"]),s["application/x-www-form-urlencoded"]=await e3(s["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await jO(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===Ue.Step){const{isProcessingRequest:i,...s}=r.data;return{...r,data:{...s,response:null}}}return r.data.type===Ue.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function e3(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 QY(r)}return n}))}const fDe=1;class $8{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 Y2e(this.project.id);const l=new G2e;this.activeEnvironmentIdStorage=new I8(this.systemFilesStorage,"active_environment_id.json",Bh,fDe),this.tabsStateStorage=new dDe(this.systemFilesStorage),this.environmentsStorage=new sDe(this.userFilesStorage,this.localStorageSecretsProvider,s),this.environmentsWriter=new oDe(this.environmentsStorage,s.rebuildWhenUnparseable),this.collectionsStorage=new Ije(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new H2e(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 hDe extends $8{constructor(e,n,r){const i=new XE(e.systemFilesDir),s=new XE(e.userFilesDir);super(i,s,e,!1,{filePaths:[B2e],basePath:[],rebuildWhenUnparseable:!0},n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[be("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=Nc.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const f=await sn.resolve(await sn.join(this.userFilesStorage.baseDir,l)),{definition:h}=await F0(f,c);s.push({uri:l,type:qi.FS,content:h}),await Y0(l)}else typeof u.arazzo=="string"&&(o.push({uri:l,type:qi.FS,content:u}),await Y0(l),u.sourceDescriptions?.forEach(f=>{const h=f.type,p=f.url,m=!h||h==="openapi",g=typeof p=="string"&&Fs(p);m&&g&&a.add(p)}))}catch(u){console.info(`Error parsing YAML/JSON file ${l}:`,u),await G0(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",[{...be("storageOperation","loadApis","storage"),apiUrlsCount:e.size}],n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async s=>{try{const{definition:o}=await F0(s);i.push({uri:s,type:qi.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",[{...be("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",[{...be("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",[be("storageOperation","read","storage")],void 0),n=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[be("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 pDe(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 gDe(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&&!Om(s,i)}),removed:t.filter(i=>!r.has(i.id)).map(i=>i.id)}}function A8(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(k){if(v(),!e)return;m=k.get(Ns),g=k.get(ko);let I=!1;c.push(k.sub(Ao,()=>{r||!e||e.writeActiveEnvironmentId(k.get(Ao))}),k.sub(si,()=>{r||!e||f||e.writeEnvironments(k.get(si))}),k.sub(Ns,()=>{const Q=k.get(Ns),N=pDe(m,Q);m=Q,!(r||!e)&&e.writeApis(N)}),k.sub(ko,()=>{const Q=k.get(ko),N=gDe(g,Q);g=Q,!(r||!e)&&e.writeCollections(N)}),k.sub(Er,E),k.sub(vs,E));function E(){if(r||!e||I)return;I=!0;const Q=e;queueMicrotask(()=>{I=!1,!(r||e!==Q)&&Q.writeTabsState({activeTabIdx:k.get(vs),tabs:k.get(Er)})})}}function v(){c.forEach(k=>k()),c=[]}function x(){l&&(l(),l=null)}async function y(k){if(!(!Rn()||!e||!a||!u||!h||!p)){await w();try{const{FileWatcher:I}=await Promise.resolve().then(()=>require("./replay-FileWatcher-DzZhHEsP.js")),E=a.get(U0).userFilesDir;o=new I(e,E,k,u,h,p),await o.start()}catch(I){console.error("Failed to start file watcher:",I),o=null}}}async function w(){o&&(await o.stop(),o=null)}async function S(){Rn()&&(await w(),await Gt("cleanup_all_managed_watchers"))}const P=async(k,I,E,Q)=>{r=!0;try{const{convertOperationToReplayValue:N,aiEnabled:R}=I,D=Rn();if(a=E,x(),v(),t){E.set(si,[]);return}if(D){const{TauriRootStorage:L}=await Promise.resolve().then(()=>require("./replay-TauriRootStorage-xFPjroQC.js"));n=new L(k,N,Q),e=n}else n=void 0,e=new hDe(k,N,Q);if(D){await w();const{getSemanticSearchService:L}=await Promise.resolve().then(()=>require("./replay-index-B_pYgKvz.js"));L().setProject(k.id)}u={get:()=>E.get(si),set:L=>{f=!0;try{E.set(si,L)}finally{f=!1}}},h={get:()=>E.get(Ns),set:L=>E.set(Ns,L)},p={get:()=>E.get(ko),set:L=>E.set(ko,L)},e.setConfigFileErrorAccessor({get:()=>E.get(q0),set:L=>E.set(q0,L)});const{project:z,activeEnvironmentId:X,environments:A,apis:U,collections:M,tabsState:j}=await e.read();if(E.set(U0,z),E.set(Ao,X),E.set(si,A),E.set(Ns,U),E.set(ko,M),E.set(Er,j.tabs),E.set(vs,j.activeTabIdx),O(E),D&&e.publishEnvironmentsConfigError(),!D)return;if(await y(R??!1),R){const[{getSemanticSearchService:L},{createIndexSnapshotGetter:W,startPeriodicIndexRevalidation:q}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-B_pYgKvz.js")),Promise.resolve().then(()=>require("./replay-periodic-revalidation-BgUjxDxQ.js"))]),B=L();B.preloadModel().catch(()=>{}),B.reindex(W(E)).catch(K=>{console.error("Semantic reindex failed:",K)}),l=q(B,E)}}finally{r=!1}};return{getTauriRootStorage:()=>n,cleanup:async()=>{s=null,x(),v(),await S()},init:async(k,I,E,Q)=>{if(s&&s.store===E&&s.projectId===k.id)return s.run;const N=i,R=(async()=>(await N,P(k,I,E,Q)))();i=R.then(()=>{},()=>{});const D={store:E,projectId:k.id,run:R};return s=D,R.catch(()=>{s===D&&(s=null)}),R}}}const mDe=A8(),Q8=b.createContext(mDe),ODe=Q8.Provider;function R8(){return b.useContext(Q8)}const vDe="Fetching from URL...",yDe="Source updated",LT="Failed to re-fetch source";function bDe({sourceUrl:t,apiId:e}){const r=R8().getTauriRootStorage(),i=LA(),{loading:s,updateToast:o,dismissToast:a}=jI.useToast(),[l,c]=b.useState(!1),[u,f]=b.useState(!1),h=b.useRef(null);_h(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(vDe);h.current=O;try{if(!r)throw new Error(LT);const[v]=await r.loadAndParseApis([{absolute_path:t,relative_path:e}],void 0,!0);if(!v)throw new Error(LT);i(x=>x.some(y=>y.id===e)?x.map(y=>y.id===e?v:y):[...x,v]),o(O,{type:"success",title:yDe})}catch(v){const x=v instanceof Error?v.message:LT;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(xDe,{sourceUrl:t,onClose:m,onConfirm:g}),children:d.jsx(En.Tooltip,{tip:"Re-fetch source",children:d.jsx(EDe,{children:d.jsx(ye.Button,{variant:"text",size:"small",icon:d.jsx(b9.RenewIcon,{size:"14px"}),"aria-label":"Re-fetch source",disabled:u})})})})}function xDe({sourceUrl:t,onClose:e,onConfirm:n}){return d.jsxs(SDe,{onClick:r=>r.stopPropagation(),children:[d.jsxs(wDe,{children:[d.jsxs(TDe,{children:[d.jsx(CDe,{children:d.jsx(Sl.WarningFilledIcon,{size:"16px",color:"--color-warning-base"})}),d.jsx(lr.Typography,{children:"Re-fetch source"})]}),d.jsx(lr.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(PDe,{title:t,children:t})]}),d.jsxs(kDe,{children:[d.jsx(ye.Button,{variant:"text",size:"small",onClick:e,children:"Cancel"}),d.jsx(ye.Button,{variant:"primary",size:"small",onClick:n,children:"Re-fetch"})]})]})}const SDe=T.default.div`
1625
+ `,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=Kv(e),r=zd(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=Kv(e),r=zd(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 MNe(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new NNe||null,prettyErrors:e}}function VNe(t,e={}){const{lineCounter:n,prettyErrors:r}=MNe(e),i=new DNe(n?.addNewLine),s=new ANe(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 tg(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(XL(t,n)),o.warnings.forEach(XL(t,n))),o}function mR(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function E8(t){return!hn(t)||t.value==null?null:typeof t.value=="string"?t.value:mR(t.value)?t.source??String(t.value):null}function jT(t,e){return E8(t)===e}function Rg(t){return hn(t)&&t.value==null}function iu(t){return t==null||Rg(t)||oi(t)||t instanceof Nt}function NT(t){return t==null||oi(t)||hn(t)&&(t.value==null||mR(t.value))}function LNe(t){return hn(t)&&typeof t.value=="string"}function wo(t,e){return oi(t.getIn(e,!0))}function zNe(t){const{contents:e}=t;return e instanceof Nt&&e.items.length===0&&!e.commentBefore&&!e.comment&&!t.commentBefore&&!t.comment}const XNe="<<",ZL="$ref";class UNe{constructor(e,n){this.providers=e,this.basePath=n}providers;basePath;sectionProblem(e){if(this.basePath.length===0){const s=e.contents;return iu(s)?s instanceof Nt?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(wo(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 iu(i)?i instanceof Nt?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(jc(o))continue;if(!iu(s.value))return`Environment ${o} in ${r} must be a map`;if(!(s.value instanceof Nt))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(!iu(o))return`The inputs of ${n} in ${i} must be a map`;if(o instanceof Nt){const l=`the inputs of ${n}`,c=this.managedKeysProblem(o,l);if(c)return c;for(const u of o.items)if(!NT(u.value)&&!(u.value instanceof Nt&&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(!iu(a))return`The servers of ${n} in ${i} must be a map`;if(a instanceof Nt){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(!iu(n))return`Server ${e} of ${r} in ${i} must be a map`;if(!(n instanceof Nt))return null;const s=this.reservedKeysProblem(n,`server ${e} of ${r}`);if(s)return s;const o=n.get("value",!0);if(!NT(o))return`The value of server ${e} of ${r} in ${i} must be a single value`;const a=n.get("variables",!0);if(!iu(a))return`The variables of server ${e} of ${r} in ${i} must be a map`;if(a instanceof Nt){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(!NT(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(!LNe(i.key))return`Replay reads only string keys, and ${n} holds ${String(i.key)}`;return null}reservedKeysProblem(e,n){return e.has(XNe)?`Replay cannot read a merge key, and ${n} uses one`:e.has(ZL)?`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||Rg(s))return null;const o=i.join(".");if(oi(s))return`The ${o} key is an alias, so Replay cannot manage the ${n} section inside it`;if(!(s instanceof Nt))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 Nt&&r.has(ZL))return!0}return!1}}const FNe=new Set(["inputs","servers"]),qNe=new Set(["value","variables"]);class WNe{constructor(e,n=[]){this.providers=e,this.basePath=n,this.validator=new UNe(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=oi(i)?i.resolve(e):i;return E8(s)??(mR(r)?String(r):"")}extractEnvironments(e,n){const r=this.readSectionData(e);return r?Object.keys(r).filter(s=>!jc(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:Xt.Normal}}):[]}hydrateDocument(e,n,r){if(wo(e,this.basePath))return e;for(let s=1;s<=this.basePath.length;s++){const o=this.basePath.slice(0,s);Rg(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);wo(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 Nt&&i.items.length===0&&e.deleteIn(r)}}}sectionProblem(e){return this.validator.sectionProblem(e)}isSectionAliased(e){return this.basePath.length>0&&wo(e,this.basePath)}hasEnvironments(e){const n=this.basePath.length===0?e.contents:e.getIn(this.basePath,!0);return n instanceof Nt&&n.items.length>0}hasUnreadContent(e){const n=e.getIn(this.basePath,!0);return n instanceof Nt?n.items.some(r=>this.environmentHoldsUnreadContent(r.value)):!1}environmentHoldsUnreadContent(e){return oi(e)?!0:e instanceof Nt?e.items.some(n=>{const r=String(n.key);return!FNe.has(r)||oi(n.value)?!0:r!=="servers"||!(n.value instanceof Nt)?!1:n.value.items.some(i=>{const s=i.value;return oi(s)?!0:s instanceof Nt?s.items.some(o=>!qNe.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 Nt&&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||Rg(n))return null;if(!oi(n)&&!(n instanceof Nt))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(!wo(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(!wo(e,l)){if(a.isSecret){const c=e.getIn(l,!0),u=c instanceof Nt?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}jT(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(!wo(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(wo(e,a))continue;Rg(e.getIn(a,!0))&&e.setIn(a,this.createBlockMap(e));const l=[...a,"value"];!wo(e,l)&&!jT(e.getIn(l,!0),o.value)&&e.setIn(l,o.value);const c=[...a,"variables"];if(wo(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];wo(e,h)||jT(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 Nt){s.flow=!1;continue}if(oi(s))return;e.setIn(i,this.createBlockMap(e))}}createBlockMap(e){const n=e.createNode({});return n instanceof Nt&&(n.flow=!1),n}deleteRemovedKeys(e,n,r){for(const i of this.getMapKeys(e,...n))!i.trim()||jc(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 Nt?r.items.map(i=>String(i.key)):[]}}class BNe{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 ZNe{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 GNe{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 YNe{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 zO={all:["notifications"],lists:()=>[...zO.all,"list"]};function HNe(){return Pi.useQuery({queryKey:zO.lists(),queryFn:async()=>Nm.getInstance().getAll()})}function JNe(){return Pi.useQuery({queryKey:zO.lists(),queryFn:async()=>Nm.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class Nm{static instance=null;static initialize(){this.close();const e=new YNe;this.instance=new GNe(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let DT=null;function FS(){return DT||(DT=new Pi.QueryClient({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),DT}function KNe(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 eDe(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:KNe(e)}]}function tDe(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function OR(t){try{const e=Nm.getInstance();await t(e),FS().invalidateQueries({queryKey:zO.all})}catch{}}async function G0(t,e){await OR(async n=>{await n.set(t,eDe(e))})}async function nDe(t,e){e.length!==0&&await OR(async n=>{await n.set(t,tDe(e))})}async function Y0(t){await OR(async e=>{await e.clear(t)})}function GL(t){return MT(t,e=>e.name).map(e=>({...e,inputs:Lk(e.inputs),servers:MT(e.servers,n=>n.apiId).map(n=>({...n,variables:MT(n.variables,r=>r.name)}))}))}function MT(t,e){const n=new Set,r=[];for(const i of t){const s=e(i);!rDe(s)||n.has(s)||(n.add(s),r.push(i))}return r}function rDe(t){return!!t.trim()&&!jc(t)}function iDe(t,e){return YL(t)===YL(e)}function YL(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 HL(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===Bh&&e.inputs.length===0&&e.servers.length===0}class sDe{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 WNe(new ZNe([new BNe],"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,Xd(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=GL(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(HL(i)){if(this.isSection){if(HL(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 iDe(GL(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 VO({}),i,r)}catch(l){return console.error(`Failed to update ${e}`,l),await this.blockOn(e,Xd(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,Xd(l),"secrets",s),"unavailable"}return this.store(e,a,s)}async serialize(e,n,{allowEmptyFile:r=!1}={}){try{return r&&zNe(n)?"":n.toString()}catch(i){return console.error(`Failed to serialize ${e}`,i),await this.blockOn(e,Xd(i)),null}}async store(e,n,r){try{await this.storage.set(e,n)}catch(i){return await this.reportUnavailable(e,Xd(i),"file",r),"unavailable"}return"written"}async blockOn(e,n){this.configError={filePath:e,issues:[{message:n.message}]},await G0(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 G0(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=VNe(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 nDe(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:Xd(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=>Y0(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 Xd(t){return t instanceof Error?t:new Error(String(t))}const JL=[1e3,3e3,1e4];class oDe{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<JL.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=JL[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 aDe{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 GE=(t,e)=>({data:t,version:e});class I8 extends aDe{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return GE(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(GE(e,this.version))}}const KL={activeTabIdx:0,tabs:[]};function lDe(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===Ue.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 cDe(t){const e=Th();return{...e,...t,formData:{...e.formData,...t?.formData}}}const VT=2,uDe="tabs.json";class dDe extends I8{migrationMap={1:lDe};constructor(e){super(e,uDe,ja(KL),VT)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=GE(ja(KL),VT)),n.version!==VT&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===Ue.Step){if(i.data.draftStep){i.data.draftStep.requestBody=cDe(i.data.draftStep.requestBody);const s=i.data.draftStep.requestBody.formData;s["multipart/form-data"]=await e3(s["multipart/form-data"]),s["application/x-www-form-urlencoded"]=await e3(s["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await jO(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===Ue.Step){const{isProcessingRequest:i,...s}=r.data;return{...r,data:{...s,response:null}}}return r.data.type===Ue.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function e3(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 QY(r)}return n}))}const fDe=1;class $8{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 Y2e(this.project.id);const l=new G2e;this.activeEnvironmentIdStorage=new I8(this.systemFilesStorage,"active_environment_id.json",Bh,fDe),this.tabsStateStorage=new dDe(this.systemFilesStorage),this.environmentsStorage=new sDe(this.userFilesStorage,this.localStorageSecretsProvider,s),this.environmentsWriter=new oDe(this.environmentsStorage,s.rebuildWhenUnparseable),this.collectionsStorage=new Ije(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new H2e(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 hDe extends $8{constructor(e,n,r){const i=new XE(e.systemFilesDir),s=new XE(e.userFilesDir);super(i,s,e,!1,{filePaths:[B2e],basePath:[],rebuildWhenUnparseable:!0},n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[be("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=Nc.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const f=await sn.resolve(await sn.join(this.userFilesStorage.baseDir,l)),{definition:h}=await F0(f,c);s.push({uri:l,type:qi.FS,content:h}),await Y0(l)}else typeof u.arazzo=="string"&&(o.push({uri:l,type:qi.FS,content:u}),await Y0(l),u.sourceDescriptions?.forEach(f=>{const h=f.type,p=f.url,m=!h||h==="openapi",g=typeof p=="string"&&Fs(p);m&&g&&a.add(p)}))}catch(u){console.info(`Error parsing YAML/JSON file ${l}:`,u),await G0(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",[{...be("storageOperation","loadApis","storage"),apiUrlsCount:e.size}],n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async s=>{try{const{definition:o}=await F0(s);i.push({uri:s,type:qi.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",[{...be("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",[{...be("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",[be("storageOperation","read","storage")],void 0),n=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[be("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 pDe(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 gDe(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&&!Om(s,i)}),removed:t.filter(i=>!r.has(i.id)).map(i=>i.id)}}function A8(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(k){if(v(),!e)return;m=k.get(Ns),g=k.get(ko);let I=!1;c.push(k.sub(Ao,()=>{r||!e||e.writeActiveEnvironmentId(k.get(Ao))}),k.sub(si,()=>{r||!e||f||e.writeEnvironments(k.get(si))}),k.sub(Ns,()=>{const Q=k.get(Ns),N=pDe(m,Q);m=Q,!(r||!e)&&e.writeApis(N)}),k.sub(ko,()=>{const Q=k.get(ko),N=gDe(g,Q);g=Q,!(r||!e)&&e.writeCollections(N)}),k.sub(Er,E),k.sub(vs,E));function E(){if(r||!e||I)return;I=!0;const Q=e;queueMicrotask(()=>{I=!1,!(r||e!==Q)&&Q.writeTabsState({activeTabIdx:k.get(vs),tabs:k.get(Er)})})}}function v(){c.forEach(k=>k()),c=[]}function x(){l&&(l(),l=null)}async function y(k){if(!(!Rn()||!e||!a||!u||!h||!p)){await w();try{const{FileWatcher:I}=await Promise.resolve().then(()=>require("./replay-FileWatcher-CRqPa1oy.js")),E=a.get(U0).userFilesDir;o=new I(e,E,k,u,h,p),await o.start()}catch(I){console.error("Failed to start file watcher:",I),o=null}}}async function w(){o&&(await o.stop(),o=null)}async function S(){Rn()&&(await w(),await Gt("cleanup_all_managed_watchers"))}const P=async(k,I,E,Q)=>{r=!0;try{const{convertOperationToReplayValue:N,aiEnabled:R}=I,D=Rn();if(a=E,x(),v(),t){E.set(si,[]);return}if(D){const{TauriRootStorage:L}=await Promise.resolve().then(()=>require("./replay-TauriRootStorage-CV796F4B.js"));n=new L(k,N,Q),e=n}else n=void 0,e=new hDe(k,N,Q);if(D){await w();const{getSemanticSearchService:L}=await Promise.resolve().then(()=>require("./replay-index-DaDM-o0F.js"));L().setProject(k.id)}u={get:()=>E.get(si),set:L=>{f=!0;try{E.set(si,L)}finally{f=!1}}},h={get:()=>E.get(Ns),set:L=>E.set(Ns,L)},p={get:()=>E.get(ko),set:L=>E.set(ko,L)},e.setConfigFileErrorAccessor({get:()=>E.get(q0),set:L=>E.set(q0,L)});const{project:z,activeEnvironmentId:X,environments:A,apis:U,collections:M,tabsState:j}=await e.read();if(E.set(U0,z),E.set(Ao,X),E.set(si,A),E.set(Ns,U),E.set(ko,M),E.set(Er,j.tabs),E.set(vs,j.activeTabIdx),O(E),D&&e.publishEnvironmentsConfigError(),!D)return;if(await y(R??!1),R){const[{getSemanticSearchService:L},{createIndexSnapshotGetter:W,startPeriodicIndexRevalidation:q}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-DaDM-o0F.js")),Promise.resolve().then(()=>require("./replay-periodic-revalidation-DlW--kpo.js"))]),B=L();B.preloadModel().catch(()=>{}),B.reindex(W(E)).catch(K=>{console.error("Semantic reindex failed:",K)}),l=q(B,E)}}finally{r=!1}};return{getTauriRootStorage:()=>n,cleanup:async()=>{s=null,x(),v(),await S()},init:async(k,I,E,Q)=>{if(s&&s.store===E&&s.projectId===k.id)return s.run;const N=i,R=(async()=>(await N,P(k,I,E,Q)))();i=R.then(()=>{},()=>{});const D={store:E,projectId:k.id,run:R};return s=D,R.catch(()=>{s===D&&(s=null)}),R}}}const mDe=A8(),Q8=b.createContext(mDe),ODe=Q8.Provider;function R8(){return b.useContext(Q8)}const vDe="Fetching from URL...",yDe="Source updated",LT="Failed to re-fetch source";function bDe({sourceUrl:t,apiId:e}){const r=R8().getTauriRootStorage(),i=LA(),{loading:s,updateToast:o,dismissToast:a}=jI.useToast(),[l,c]=b.useState(!1),[u,f]=b.useState(!1),h=b.useRef(null);_h(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(vDe);h.current=O;try{if(!r)throw new Error(LT);const[v]=await r.loadAndParseApis([{absolute_path:t,relative_path:e}],void 0,!0);if(!v)throw new Error(LT);i(x=>x.some(y=>y.id===e)?x.map(y=>y.id===e?v:y):[...x,v]),o(O,{type:"success",title:yDe})}catch(v){const x=v instanceof Error?v.message:LT;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(xDe,{sourceUrl:t,onClose:m,onConfirm:g}),children:d.jsx(En.Tooltip,{tip:"Re-fetch source",children:d.jsx(EDe,{children:d.jsx(ye.Button,{variant:"text",size:"small",icon:d.jsx(b9.RenewIcon,{size:"14px"}),"aria-label":"Re-fetch source",disabled:u})})})})}function xDe({sourceUrl:t,onClose:e,onConfirm:n}){return d.jsxs(SDe,{onClick:r=>r.stopPropagation(),children:[d.jsxs(wDe,{children:[d.jsxs(TDe,{children:[d.jsx(CDe,{children:d.jsx(Sl.WarningFilledIcon,{size:"16px",color:"--color-warning-base"})}),d.jsx(lr.Typography,{children:"Re-fetch source"})]}),d.jsx(lr.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(PDe,{title:t,children:t})]}),d.jsxs(kDe,{children:[d.jsx(ye.Button,{variant:"text",size:"small",onClick:e,children:"Cancel"}),d.jsx(ye.Button,{variant:"primary",size:"small",onClick:n,children:"Re-fetch"})]})]})}const SDe=T.default.div`
1626
1626
  display: flex;
1627
1627
  flex-direction: column;
1628
1628
  gap: var(--spacing-xxs);
@@ -2668,7 +2668,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
2668
2668
  border-top: none;
2669
2669
  overflow: auto;
2670
2670
  }
2671
- `;function jUe(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function lw(t,...e){if(!jUe(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 I4(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 NUe(t,e){lw(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Um(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function pC(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function oa(t,e){return t<<32-e|t>>>e}function DUe(t,e){return t<<e|t>>>32-e>>>0}const MUe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",VUe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Fm(t){if(lw(t),MUe)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=VUe[t[n]];return e}function LUe(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function LJ(t){return typeof t=="string"&&(t=LUe(t)),lw(t),t}class zUe{}function zJ(t){const e=r=>t().update(LJ(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function XUe(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 aI(t,e,n){return t&e^~t&n}function UUe(t,e,n){return t&e^t&n^e&n}class XJ extends zUe{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=pC(this.buffer)}update(e){I4(this),e=LJ(e),lw(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=pC(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){I4(this),NUe(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,Um(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let f=o;f<i;f++)n[f]=0;XUe(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=pC(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 ec=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),FUe=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),qUe=Math.pow(2,32),WUe=Array.from({length:64},(t,e)=>Math.floor(qUe*Math.abs(Math.sin(e+1)))),cy=FUe.slice(0,4),gC=new Uint32Array(16);class BUe extends XJ{constructor(){super(64,16,8,!0),this.A=cy[0]|0,this.B=cy[1]|0,this.C=cy[2]|0,this.D=cy[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)gC[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=aI(i,s,o),c=a,u=[7,12,17,22]):a<32?(l=aI(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+WUe[a]+gC[c],r=o,o=s,s=i,i=i+DUe(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(){Um(gC)}destroy(){this.set(0,0,0,0),Um(this.buffer)}}const cw=zJ(()=>new BUe),ZUe=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]),tc=new Uint32Array(64);class GUe extends XJ{constructor(e=32){super(64,e,8,!1),this.A=ec[0]|0,this.B=ec[1]|0,this.C=ec[2]|0,this.D=ec[3]|0,this.E=ec[4]|0,this.F=ec[5]|0,this.G=ec[6]|0,this.H=ec[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)tc[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const h=tc[f-15],p=tc[f-2],m=oa(h,7)^oa(h,18)^h>>>3,g=oa(p,17)^oa(p,19)^p>>>10;tc[f]=g+tc[f-7]+m+tc[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=oa(a,6)^oa(a,11)^oa(a,25),p=u+h+aI(a,l,c)+ZUe[f]+tc[f]|0,g=(oa(r,2)^oa(r,13)^oa(r,22))+UUe(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(){Um(tc)}destroy(){this.set(0,0,0,0,0,0,0,0),Um(this.buffer)}}const UJ=zJ(()=>new GUe);function YUe(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 HUe(t,e,n,r,i={}){const{inputs:s}=r,{requestBody:{content:o}}=t,{url:a,method:l}=kS(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast(I=>I.securityType===ne.DigestAuth);if(!c)return"";const{username:u,password:f,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,opaque:x}=c[ne.DigestAuth],y=Mf(u,s,i),{pathname:w,search:S}=new URL(a),P=S?`${w}${S}`:w,k=JUe({username:y,password:Mf(f,s,i),uri:P,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,method:l,bodyContent:Mf(o,s,i)});return`Digest username="${y}", realm="${h}", nonce="${p}", uri="${P}", qop=${O}, nc=${v}, cnonce="${m}", response="${k}", algorithm=${g}${x?`, opaque="${x}"`:""}`}function JUe(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=KUe(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 KUe(t){return t?.replace("-sess","")==="SHA-256"?e=>Fm(UJ(e)):e=>Fm(cw(e))}function lI(t){return new TextEncoder().encode(t)}function eFe(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 tFe(t){return btoa(String.fromCharCode(...lI(t)))}function $4(t){return btoa(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function nFe(t){return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}async function rFe(t){const e=new TextEncoder().encode(t);return crypto?.subtle.digest("SHA-256",e)}function iFe(t){if(t)return btoa(String.fromCharCode.apply(null,new Uint8Array(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(new RegExp("(?<!=)=+$"),"")}function sFe(t){try{const n=new URL(t).hostname;return n==="localhost"||n==="127.0.0.1"}catch{return!1}}function qm(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function oFe(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 aFe=["json","xml","html","text"],lFe=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function mC(t,e){return t.get(e)??t.get(e.toLowerCase())}function cFe(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function uFe(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 dFe(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function fFe(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return lFe.some(r=>n.includes(r))?!0:n.startsWith("application/")?!aFe.some(r=>n.includes(r)):!1}async function hFe(t,e){const n=mC(t.headers,"content-type")?.split(";")[0].trim(),r=mC(t.headers,"content-disposition"),i=cFe(mC(t.headers,"content-length")),s=fFe(n,r),o=oFe(document.cookie);if(s){const h={fileName:uFe(r)||dFe(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 pFe=":/?#[]@!$&'()*+,;=",gFe=new Set(["!","'","(",")","*"]);function mFe(t){return gFe.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function A4(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...pFe].map(i=>({char:i,encoded:mFe(i)}));for(const{char:i,encoded:s}of r)n=n.split(s).join(i);return n}function OFe(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function vFe(t,e){const{exists:n}=await Promise.resolve().then(()=>$O),{join:r}=await Promise.resolve().then(()=>BQ),{baseName:i,extension:s}=OFe(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 yFe(t){return t.split(new RegExp("(\\{(?<!\\{[^}]*?\\{)[^}]+\\}|\\/)","g")).filter(e=>e!=="")}const WR=t=>t?.find(([e])=>e.toLowerCase()==="content-type")?.[1].split(";")[0],cI=t=>{switch(!0){case t.includes("jsonl"):return nf.JSONL;case t.includes("x-ndjson"):return nf.NDJSON;case t.includes("json-seq"):return nf.JSONSeq;case t.includes("multipart/mixed"):return nf.MultipartMixed;case t.includes("text/event-stream"):return nf.TextStream;case t.includes("json"):return Hn.JSON;case t.includes("xml"):return Hn.XML;case t.includes("html"):return Hn.HTML;case t.includes("image"):return Hn.Image;default:return Hn.Text}},sg=new Map;function bFe(t){sg.get(t)?.abort()}function FJ(t){return t?t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function xFe(t){if(!FJ(t))return t}function qJ(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL(PS(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}const SFe="Something went wrong, please review your request and try again";function WJ(t){const e=t.toUpperCase();return hX.includes(e)?`This request cannot be sent: browsers do not allow the ${e} method.`:SFe}async function BR({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,features:h}=i,p=await SS(t,a?.id,s?.workflowId,CQ(n,s,a,e)),{url:m,method:g}=kS(n,s??void 0,a??void 0,e,p),O=g.toUpperCase();if(hX.includes(O))throw new Error(WJ(O));const v=c||"",x=YJ(n,s,a,e,p),y=jFe(m,u),w=NFe({proxyUrl:v,resolvedUrl:m,ignoreProxy:y,queryParameters:x}),S=await TFe(n,s??void 0,w,u,l);let P=n,k=s??void 0;const I=a??void 0;S?.target==="step"?(P=uy(P,S),r(j=>uy(j,S))):S?.target==="workflow"&&k&&(k=uy(k,S),o?.(j=>uy(j,S)));const E=dw(P,k,I,e,p,h),Q=xFe(GR(P,e,p,h)),{clientCert:N,clientKey:R}=eY(m,f),D=PS(w),A=(!y&&!!v||qm(D))&&!Mh.includes(O),U=A?"POST":O,M=A?{...E,"X-HTTP-Method-Override":O}:E;return{urlWithProxyAndProtocol:D,fetchMethod:U,fetchHeaders:M,body:Q,credentials:qJ(D,u),mode:qm(D)?"same-origin":"cors",clientCert:N,clientKey:R,resolvedUrl:m}}function ZR(t,e){return{signal:e,method:t.fetchMethod,headers:t.fetchHeaders,body:t.body,mode:t.mode,credentials:t.credentials,clientCert:t.clientCert,clientKey:t.clientKey}}async function BJ(t,e,n,r,i,s){const{tabId:o,updateData:a}=t,l=ja(e.step);a(h=>({...h,isProcessingRequest:!0})),sg.get(o)?.abort();const c=new AbortController;sg.set(o,c);const{signal:u}=c,f=()=>sg.get(o)===c;try{const h=await BR({selectedEnvironment:r,settings:n,signal:u,...e}),p=Date.now(),m=await Ro(h.urlWithProxyAndProtocol,ZR(h,u)),g=Date.now()-p,O=await hFe(m,g);if(!f())return;a(x=>({...x,requestError:null,response:O}));const v=ja(O);i?.(l,v),s?.({outcome:"success",status:O.status,duration:O.duration,size:O.size,content_type:WR(O.headers)})}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()&&(sg.delete(o),a(h=>({...h,isProcessingRequest:!1})))}}async function wFe({selectedEnvironment:t,settings:e,fileName:n,onProgress:r,...i}){const s=await BR({selectedEnvironment:t,settings:e,...i}),o=ZR(s),a=Rn(),l=n||"response";let c=null;if(a){const{open:x}=await Promise.resolve().then(()=>require("./replay-index-DMy5OBRE.js")),y=await x({directory:!0,multiple:!1});if(!y)return;const w=Array.isArray(y)?y[0]:y;c=await vFe(w,l)}const u=await Ro(s.urlWithProxyAndProtocol,o),f=u.headers.get("content-length"),h=f?Number.parseInt(f,10):void 0,p=Number.isFinite(h)?h:void 0,m=u.headers.get("content-type")??void 0;let g;if(u.body?.getReader){const x=u.body.getReader(),y=[];let w=0;for(;;){const{done:S,value:P}=await x.read();if(S)break;if(P){const k=new Uint8Array(P.byteLength);k.set(P),y.push(k.buffer),w+=P.byteLength,r?.({receivedBytes:w,totalBytes:p,done:!1})}}g=new Blob(y,{type:m}),r?.({receivedBytes:w,totalBytes:p,done:!0})}else g=await u.blob(),r?.({receivedBytes:g.size,totalBytes:p,done:!0});if(a){const{writeFile:x}=await Promise.resolve().then(()=>$O),y=new Uint8Array(await g.arrayBuffer());if(!c)return;await x(c,y);return}const O=window.URL.createObjectURL(g),v=document.createElement("a");v.href=O,v.download=l,v.rel="noopener",v.click(),window.URL.revokeObjectURL(O)}function uy(t,e){return{...t,security:t.security.map((n,r)=>r===e.index?{...n,[ne.DigestAuth]:{...n[ne.DigestAuth],...e.fields}}:n)}}async function TFe(t,e,n,r,i){const s=Rl(t),o=e?.security??[],l=[...o,...t.security].findLastIndex(p=>p.securityType===ne.DigestAuth);if(l===-1)return null;const c=PS(n),u=await Ro(c,{signal:i,method:s.toUpperCase(),credentials:qJ(c,r),mode:qm(c)?"same-origin":"cors"}),f=YUe(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 CFe(t,e,n,r,i){return[...e?.security||[],...t.security].map(s=>{switch(s.securityType){case ne.BasicAuth:{const o=s[ne.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+tFe(`${jr(o.username,r,i)}:${jr(o.password,r,i)}`),active:!0,in:"header"}}case ne.DigestAuth:return{id:"",key:"Authorization",value:HUe(t,e,n,r,i),active:!0,in:"header"};case ne.JWT:return{id:"",key:"Authorization",value:"Bearer "+s[ne.JWT].token,active:!0,in:"header"};case ne.OAuth2:{const{grantType:o}=s[ne.OAuth2],{accessToken:a}=s[ne.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ne.OpenIDConnect:{const{grantType:o}=s[ne.OpenIDConnect],{accessToken:a}=s[ne.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ne.APIKey:{const o=s[ne.APIKey];return o.location===Os.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(s=>!!s)}function PFe(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=>!$u(S)&&S.key===w.name)),v=!h.every(w=>a.some(S=>!$u(S)&&S.key===w.name)),x=!u.every(w=>l.some(S=>!$u(S)&&S.key===w.name)),y=SAe(t,e,n);return!p&&!m&&!g&&!O&&!v&&!x&&!y}function uw(t,e,n={},r){const{requestBody:i}=t,o=Rl(t).toUpperCase();if(o==="GET"||o==="HEAD"||o==="OPTIONS")return null;try{if(i.type===Ye.FormData)return IFe(t,e,n);if(i.type===Ye.UrlEncoded)return EFe(t,e,n);if(i.type===Ye.Binary)return i.binary;if(i.type===Ye.GraphqlJSON&&ep(Ye.GraphqlJSON,r)){const a=bl(i.content),l=jr(a.query,e,n),c=OG(jr(a.variables,e,n));return!l.trim()&&c===void 0?"":JSON.stringify({query:l,variables:c})}return jr(i.content,e,n)}catch(a){console.error(a)}}function GR(t,e,n={},r){const{requestBody:i}=t,s=uw(t,e,n,r);if(s===null)return null;switch(i.type){default:return s;case Ye.FormData:return $Fe(s);case Ye.UrlEncoded:return kFe(s);case Ye.Binary:return i.binary?.file??null}}function kFe(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function EFe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[Ye.UrlEncoded];return eK(s).forEach(o=>{const a=jr(o.value,e,n);i.push({key:jr(o.key,e,n),value:a,type:"text"})}),i}function IFe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[Ye.FormData];return eK(s).forEach(({type:o,files:a,value:l,key:c,contentType:u,headers:f})=>{const h=jr(c,e,n),p={...u&&{contentType:u},...f&&{headers:f}};if(o==="file")for(const m of a??[])i.push({key:h,value:m,type:o,...p});else if(l){const m=jr(l,e,n);i.push({key:h,value:m,type:o,...p})}}),i}function $Fe(t){const e=`----replay${crypto.randomUUID().replace(/-/g,"")}`,n=[];for(const{key:r,value:i,type:s,contentType:o,headers:a}of t){const l=s==="file"?i.file:void 0;if(!i||s==="file"&&!(l instanceof Blob))continue;const c=l?l.type||o||"application/octet-stream":o,u=[`Content-Disposition: form-data; name="${Q4(r)}"`+(l?`; filename="${Q4(l.name)}"`:""),...c?[`Content-Type: ${c}`]:[],...Object.entries(a??{}).filter(([f,h])=>!/[\r\n]/.test(`${f}${h}`)).map(([f,h])=>`${f}: ${h}`)];n.push(`--${e}\r
2671
+ `;function jUe(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function lw(t,...e){if(!jUe(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 I4(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 NUe(t,e){lw(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Um(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function pC(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function oa(t,e){return t<<32-e|t>>>e}function DUe(t,e){return t<<e|t>>>32-e>>>0}const MUe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",VUe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Fm(t){if(lw(t),MUe)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=VUe[t[n]];return e}function LUe(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function LJ(t){return typeof t=="string"&&(t=LUe(t)),lw(t),t}class zUe{}function zJ(t){const e=r=>t().update(LJ(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function XUe(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 aI(t,e,n){return t&e^~t&n}function UUe(t,e,n){return t&e^t&n^e&n}class XJ extends zUe{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=pC(this.buffer)}update(e){I4(this),e=LJ(e),lw(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=pC(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){I4(this),NUe(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,Um(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let f=o;f<i;f++)n[f]=0;XUe(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=pC(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 ec=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),FUe=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),qUe=Math.pow(2,32),WUe=Array.from({length:64},(t,e)=>Math.floor(qUe*Math.abs(Math.sin(e+1)))),cy=FUe.slice(0,4),gC=new Uint32Array(16);class BUe extends XJ{constructor(){super(64,16,8,!0),this.A=cy[0]|0,this.B=cy[1]|0,this.C=cy[2]|0,this.D=cy[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)gC[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=aI(i,s,o),c=a,u=[7,12,17,22]):a<32?(l=aI(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+WUe[a]+gC[c],r=o,o=s,s=i,i=i+DUe(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(){Um(gC)}destroy(){this.set(0,0,0,0),Um(this.buffer)}}const cw=zJ(()=>new BUe),ZUe=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]),tc=new Uint32Array(64);class GUe extends XJ{constructor(e=32){super(64,e,8,!1),this.A=ec[0]|0,this.B=ec[1]|0,this.C=ec[2]|0,this.D=ec[3]|0,this.E=ec[4]|0,this.F=ec[5]|0,this.G=ec[6]|0,this.H=ec[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)tc[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const h=tc[f-15],p=tc[f-2],m=oa(h,7)^oa(h,18)^h>>>3,g=oa(p,17)^oa(p,19)^p>>>10;tc[f]=g+tc[f-7]+m+tc[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=oa(a,6)^oa(a,11)^oa(a,25),p=u+h+aI(a,l,c)+ZUe[f]+tc[f]|0,g=(oa(r,2)^oa(r,13)^oa(r,22))+UUe(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(){Um(tc)}destroy(){this.set(0,0,0,0,0,0,0,0),Um(this.buffer)}}const UJ=zJ(()=>new GUe);function YUe(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 HUe(t,e,n,r,i={}){const{inputs:s}=r,{requestBody:{content:o}}=t,{url:a,method:l}=kS(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast(I=>I.securityType===ne.DigestAuth);if(!c)return"";const{username:u,password:f,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,opaque:x}=c[ne.DigestAuth],y=Mf(u,s,i),{pathname:w,search:S}=new URL(a),P=S?`${w}${S}`:w,k=JUe({username:y,password:Mf(f,s,i),uri:P,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,method:l,bodyContent:Mf(o,s,i)});return`Digest username="${y}", realm="${h}", nonce="${p}", uri="${P}", qop=${O}, nc=${v}, cnonce="${m}", response="${k}", algorithm=${g}${x?`, opaque="${x}"`:""}`}function JUe(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=KUe(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 KUe(t){return t?.replace("-sess","")==="SHA-256"?e=>Fm(UJ(e)):e=>Fm(cw(e))}function lI(t){return new TextEncoder().encode(t)}function eFe(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 tFe(t){return btoa(String.fromCharCode(...lI(t)))}function $4(t){return btoa(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function nFe(t){return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}async function rFe(t){const e=new TextEncoder().encode(t);return crypto?.subtle.digest("SHA-256",e)}function iFe(t){if(t)return btoa(String.fromCharCode.apply(null,new Uint8Array(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(new RegExp("(?<!=)=+$"),"")}function sFe(t){try{const n=new URL(t).hostname;return n==="localhost"||n==="127.0.0.1"}catch{return!1}}function qm(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function oFe(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 aFe=["json","xml","html","text"],lFe=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function mC(t,e){return t.get(e)??t.get(e.toLowerCase())}function cFe(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function uFe(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 dFe(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function fFe(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return lFe.some(r=>n.includes(r))?!0:n.startsWith("application/")?!aFe.some(r=>n.includes(r)):!1}async function hFe(t,e){const n=mC(t.headers,"content-type")?.split(";")[0].trim(),r=mC(t.headers,"content-disposition"),i=cFe(mC(t.headers,"content-length")),s=fFe(n,r),o=oFe(document.cookie);if(s){const h={fileName:uFe(r)||dFe(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 pFe=":/?#[]@!$&'()*+,;=",gFe=new Set(["!","'","(",")","*"]);function mFe(t){return gFe.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function A4(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...pFe].map(i=>({char:i,encoded:mFe(i)}));for(const{char:i,encoded:s}of r)n=n.split(s).join(i);return n}function OFe(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function vFe(t,e){const{exists:n}=await Promise.resolve().then(()=>$O),{join:r}=await Promise.resolve().then(()=>BQ),{baseName:i,extension:s}=OFe(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 yFe(t){return t.split(new RegExp("(\\{(?<!\\{[^}]*?\\{)[^}]+\\}|\\/)","g")).filter(e=>e!=="")}const WR=t=>t?.find(([e])=>e.toLowerCase()==="content-type")?.[1].split(";")[0],cI=t=>{switch(!0){case t.includes("jsonl"):return nf.JSONL;case t.includes("x-ndjson"):return nf.NDJSON;case t.includes("json-seq"):return nf.JSONSeq;case t.includes("multipart/mixed"):return nf.MultipartMixed;case t.includes("text/event-stream"):return nf.TextStream;case t.includes("json"):return Hn.JSON;case t.includes("xml"):return Hn.XML;case t.includes("html"):return Hn.HTML;case t.includes("image"):return Hn.Image;default:return Hn.Text}},sg=new Map;function bFe(t){sg.get(t)?.abort()}function FJ(t){return t?t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function xFe(t){if(!FJ(t))return t}function qJ(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL(PS(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}const SFe="Something went wrong, please review your request and try again";function WJ(t){const e=t.toUpperCase();return hX.includes(e)?`This request cannot be sent: browsers do not allow the ${e} method.`:SFe}async function BR({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,features:h}=i,p=await SS(t,a?.id,s?.workflowId,CQ(n,s,a,e)),{url:m,method:g}=kS(n,s??void 0,a??void 0,e,p),O=g.toUpperCase();if(hX.includes(O))throw new Error(WJ(O));const v=c||"",x=YJ(n,s,a,e,p),y=jFe(m,u),w=NFe({proxyUrl:v,resolvedUrl:m,ignoreProxy:y,queryParameters:x}),S=await TFe(n,s??void 0,w,u,l);let P=n,k=s??void 0;const I=a??void 0;S?.target==="step"?(P=uy(P,S),r(j=>uy(j,S))):S?.target==="workflow"&&k&&(k=uy(k,S),o?.(j=>uy(j,S)));const E=dw(P,k,I,e,p,h),Q=xFe(GR(P,e,p,h)),{clientCert:N,clientKey:R}=eY(m,f),D=PS(w),A=(!y&&!!v||qm(D))&&!Mh.includes(O),U=A?"POST":O,M=A?{...E,"X-HTTP-Method-Override":O}:E;return{urlWithProxyAndProtocol:D,fetchMethod:U,fetchHeaders:M,body:Q,credentials:qJ(D,u),mode:qm(D)?"same-origin":"cors",clientCert:N,clientKey:R,resolvedUrl:m}}function ZR(t,e){return{signal:e,method:t.fetchMethod,headers:t.fetchHeaders,body:t.body,mode:t.mode,credentials:t.credentials,clientCert:t.clientCert,clientKey:t.clientKey}}async function BJ(t,e,n,r,i,s){const{tabId:o,updateData:a}=t,l=ja(e.step);a(h=>({...h,isProcessingRequest:!0})),sg.get(o)?.abort();const c=new AbortController;sg.set(o,c);const{signal:u}=c,f=()=>sg.get(o)===c;try{const h=await BR({selectedEnvironment:r,settings:n,signal:u,...e}),p=Date.now(),m=await Ro(h.urlWithProxyAndProtocol,ZR(h,u)),g=Date.now()-p,O=await hFe(m,g);if(!f())return;a(x=>({...x,requestError:null,response:O}));const v=ja(O);i?.(l,v),s?.({outcome:"success",status:O.status,duration:O.duration,size:O.size,content_type:WR(O.headers)})}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()&&(sg.delete(o),a(h=>({...h,isProcessingRequest:!1})))}}async function wFe({selectedEnvironment:t,settings:e,fileName:n,onProgress:r,...i}){const s=await BR({selectedEnvironment:t,settings:e,...i}),o=ZR(s),a=Rn(),l=n||"response";let c=null;if(a){const{open:x}=await Promise.resolve().then(()=>require("./replay-index-COdtZP45.js")),y=await x({directory:!0,multiple:!1});if(!y)return;const w=Array.isArray(y)?y[0]:y;c=await vFe(w,l)}const u=await Ro(s.urlWithProxyAndProtocol,o),f=u.headers.get("content-length"),h=f?Number.parseInt(f,10):void 0,p=Number.isFinite(h)?h:void 0,m=u.headers.get("content-type")??void 0;let g;if(u.body?.getReader){const x=u.body.getReader(),y=[];let w=0;for(;;){const{done:S,value:P}=await x.read();if(S)break;if(P){const k=new Uint8Array(P.byteLength);k.set(P),y.push(k.buffer),w+=P.byteLength,r?.({receivedBytes:w,totalBytes:p,done:!1})}}g=new Blob(y,{type:m}),r?.({receivedBytes:w,totalBytes:p,done:!0})}else g=await u.blob(),r?.({receivedBytes:g.size,totalBytes:p,done:!0});if(a){const{writeFile:x}=await Promise.resolve().then(()=>$O),y=new Uint8Array(await g.arrayBuffer());if(!c)return;await x(c,y);return}const O=window.URL.createObjectURL(g),v=document.createElement("a");v.href=O,v.download=l,v.rel="noopener",v.click(),window.URL.revokeObjectURL(O)}function uy(t,e){return{...t,security:t.security.map((n,r)=>r===e.index?{...n,[ne.DigestAuth]:{...n[ne.DigestAuth],...e.fields}}:n)}}async function TFe(t,e,n,r,i){const s=Rl(t),o=e?.security??[],l=[...o,...t.security].findLastIndex(p=>p.securityType===ne.DigestAuth);if(l===-1)return null;const c=PS(n),u=await Ro(c,{signal:i,method:s.toUpperCase(),credentials:qJ(c,r),mode:qm(c)?"same-origin":"cors"}),f=YUe(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 CFe(t,e,n,r,i){return[...e?.security||[],...t.security].map(s=>{switch(s.securityType){case ne.BasicAuth:{const o=s[ne.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+tFe(`${jr(o.username,r,i)}:${jr(o.password,r,i)}`),active:!0,in:"header"}}case ne.DigestAuth:return{id:"",key:"Authorization",value:HUe(t,e,n,r,i),active:!0,in:"header"};case ne.JWT:return{id:"",key:"Authorization",value:"Bearer "+s[ne.JWT].token,active:!0,in:"header"};case ne.OAuth2:{const{grantType:o}=s[ne.OAuth2],{accessToken:a}=s[ne.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ne.OpenIDConnect:{const{grantType:o}=s[ne.OpenIDConnect],{accessToken:a}=s[ne.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ne.APIKey:{const o=s[ne.APIKey];return o.location===Os.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(s=>!!s)}function PFe(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=>!$u(S)&&S.key===w.name)),v=!h.every(w=>a.some(S=>!$u(S)&&S.key===w.name)),x=!u.every(w=>l.some(S=>!$u(S)&&S.key===w.name)),y=SAe(t,e,n);return!p&&!m&&!g&&!O&&!v&&!x&&!y}function uw(t,e,n={},r){const{requestBody:i}=t,o=Rl(t).toUpperCase();if(o==="GET"||o==="HEAD"||o==="OPTIONS")return null;try{if(i.type===Ye.FormData)return IFe(t,e,n);if(i.type===Ye.UrlEncoded)return EFe(t,e,n);if(i.type===Ye.Binary)return i.binary;if(i.type===Ye.GraphqlJSON&&ep(Ye.GraphqlJSON,r)){const a=bl(i.content),l=jr(a.query,e,n),c=OG(jr(a.variables,e,n));return!l.trim()&&c===void 0?"":JSON.stringify({query:l,variables:c})}return jr(i.content,e,n)}catch(a){console.error(a)}}function GR(t,e,n={},r){const{requestBody:i}=t,s=uw(t,e,n,r);if(s===null)return null;switch(i.type){default:return s;case Ye.FormData:return $Fe(s);case Ye.UrlEncoded:return kFe(s);case Ye.Binary:return i.binary?.file??null}}function kFe(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function EFe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[Ye.UrlEncoded];return eK(s).forEach(o=>{const a=jr(o.value,e,n);i.push({key:jr(o.key,e,n),value:a,type:"text"})}),i}function IFe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData[Ye.FormData];return eK(s).forEach(({type:o,files:a,value:l,key:c,contentType:u,headers:f})=>{const h=jr(c,e,n),p={...u&&{contentType:u},...f&&{headers:f}};if(o==="file")for(const m of a??[])i.push({key:h,value:m,type:o,...p});else if(l){const m=jr(l,e,n);i.push({key:h,value:m,type:o,...p})}}),i}function $Fe(t){const e=`----replay${crypto.randomUUID().replace(/-/g,"")}`,n=[];for(const{key:r,value:i,type:s,contentType:o,headers:a}of t){const l=s==="file"?i.file:void 0;if(!i||s==="file"&&!(l instanceof Blob))continue;const c=l?l.type||o||"application/octet-stream":o,u=[`Content-Disposition: form-data; name="${Q4(r)}"`+(l?`; filename="${Q4(l.name)}"`:""),...c?[`Content-Type: ${c}`]:[],...Object.entries(a??{}).filter(([f,h])=>!/[\r\n]/.test(`${f}${h}`)).map(([f,h])=>`${f}: ${h}`)];n.push(`--${e}\r
2672
2672
  ${u.join(`\r
2673
2673
  `)}\r
2674
2674
  \r
@@ -3868,7 +3868,7 @@ ${u.join(`\r
3868
3868
  font-size: var(--font-size-base);
3869
3869
  font-weight: var(--font-weight-regular);
3870
3870
  line-height: var(--line-height-base);
3871
- `,eBe=["text","file"];function tBe({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(Rn())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-DMy5OBRE.js")),l=await a({multiple:!0});if(!l)return;const u=(Array.isArray(l)?l:[l]).map(jO),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(U4,{icon:d.jsx(Wi.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsx(F4,{children:e[0].file.name})});if(e.length>1)return d.jsx(U4,{icon:d.jsx(Wi.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsxs(F4,{children:[e.length," files"]})})},[e,s]);return d.jsx(nBe,{children:d.jsxs(rBe,{children:[d.jsx(iBe,{children:o||d.jsx(aBe,{children:"Add files here"})}),d.jsxs(sBe,{children:[d.jsx(oBe,{onClick:i,variant:"secondary",size:"small","data-testid":"add-button",icon:d.jsx(Dr.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 nBe=T.default.div`
3871
+ `,eBe=["text","file"];function tBe({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(Rn())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-COdtZP45.js")),l=await a({multiple:!0});if(!l)return;const u=(Array.isArray(l)?l:[l]).map(jO),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(U4,{icon:d.jsx(Wi.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsx(F4,{children:e[0].file.name})});if(e.length>1)return d.jsx(U4,{icon:d.jsx(Wi.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsxs(F4,{children:[e.length," files"]})})},[e,s]);return d.jsx(nBe,{children:d.jsxs(rBe,{children:[d.jsx(iBe,{children:o||d.jsx(aBe,{children:"Add files here"})}),d.jsxs(sBe,{children:[d.jsx(oBe,{onClick:i,variant:"secondary",size:"small","data-testid":"add-button",icon:d.jsx(Dr.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 nBe=T.default.div`
3872
3872
  position: relative;
3873
3873
  display: flex;
3874
3874
  flex-grow: 1;
@@ -4007,7 +4007,7 @@ ${u.join(`\r
4007
4007
  `,yBe=T.default.div`
4008
4008
  display: flex;
4009
4009
  justify-content: center;
4010
- `,WK=t=>t==="file"?d.jsx(T9.FileIcon,{size:"14px"}):d.jsx(Dte.CharacterIcon,{size:"14px"}),bBe=eBe.map(t=>({label:d.jsxs(lBe,{children:[WK(t),d.jsx(OBe,{children:t})]}),value:t}));function q4({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(fBe,{children:[d.jsx(hBe,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx(pBe,{"data-testid":w,type:"checkbox",checked:g,onChange:({target:S})=>s(S.checked)}),d.jsx(gBe,{checked:g})]})}),d.jsx(Be,{}),d.jsxs(d.Fragment,{children:[d.jsx(Mt,{dataTestId:x,placeholder:`${t?"New ":""}${c}`,value:m,environment:l,onChange:r}),u&&d.jsx(yBe,{children:d.jsx(vBe,{options:bBe,value:{label:WK(O),value:O,active:!0},onChange:({value:S})=>o(S),withArrow:!1,size:"small"})})]}),d.jsx(Be,{}),O==="file"?d.jsx(tBe,{files:v,onParameterChange:a}):d.jsx(Mt,{dataTestId:y,placeholder:"Value",value:p,environment:l,options:f,onChange:i}),d.jsx(Be,{}),d.jsx(mBe,{children:!t&&h(e)})]})}function xBe({title:t,enableInputTypeSelection:e=!1,onParameterChange:n,actions:r,formElements:i,onFormElementsChange:s,keyName:o,environment:a,createEmptyParameter:l}){const c=Ji(),{ghost:u,updateGhost:f,promoteGhost:h}=IK({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(cBe,{children:[t&&d.jsx(uBe,{children:t}),d.jsx(dBe,{children:[...i.map((g,O)=>d.jsx(q4,{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(q4,{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 SBe({formElements:t,onFormElementsChange:e,type:n}){const r=Ft();function i(s){e(o=>o.filter((a,l)=>l!==s))}return d.jsx(xBe,{keyName:"Param",formElements:t,onFormElementsChange:e,environment:r,enableInputTypeSelection:n!==Ye.UrlEncoded,createEmptyParameter:k$e,actions:s=>d.jsx(Ts,{onClick:()=>i(s),variant:"text",icon:d.jsx(rr.TrashCanIcon,{})})})}const wBe=({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(Rn())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-DMy5OBRE.js")),c=await l();if(!c)return;const u=await jO(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(yC,{children:d.jsxs(TBe,{children:[d.jsx(fx.Spinner,{}),"Loading..."]})}):t&&t.file?.name?d.jsx(yC,{children:d.jsxs(CBe,{children:[d.jsxs(PBe,{children:[d.jsx(Vte.DocumentBlankIcon,{size:"16px"}),d.jsx(kBe,{children:t.file?.name})]}),d.jsx(Ts,{onClick:a,icon:d.jsx(rr.TrashCanIcon,{})})]})}):d.jsx(yC,{children:d.jsx(BK,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"file",hidden:!0,ref:i,onChange:s}),d.jsx(ye.Button,{type:"button",variant:"text",onClick:o,icon:d.jsx(Mte.CloudUploadIcon,{}),children:"Upload file"})]})})})},yC=T.default(mQ)`
4010
+ `,WK=t=>t==="file"?d.jsx(T9.FileIcon,{size:"14px"}):d.jsx(Dte.CharacterIcon,{size:"14px"}),bBe=eBe.map(t=>({label:d.jsxs(lBe,{children:[WK(t),d.jsx(OBe,{children:t})]}),value:t}));function q4({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(fBe,{children:[d.jsx(hBe,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx(pBe,{"data-testid":w,type:"checkbox",checked:g,onChange:({target:S})=>s(S.checked)}),d.jsx(gBe,{checked:g})]})}),d.jsx(Be,{}),d.jsxs(d.Fragment,{children:[d.jsx(Mt,{dataTestId:x,placeholder:`${t?"New ":""}${c}`,value:m,environment:l,onChange:r}),u&&d.jsx(yBe,{children:d.jsx(vBe,{options:bBe,value:{label:WK(O),value:O,active:!0},onChange:({value:S})=>o(S),withArrow:!1,size:"small"})})]}),d.jsx(Be,{}),O==="file"?d.jsx(tBe,{files:v,onParameterChange:a}):d.jsx(Mt,{dataTestId:y,placeholder:"Value",value:p,environment:l,options:f,onChange:i}),d.jsx(Be,{}),d.jsx(mBe,{children:!t&&h(e)})]})}function xBe({title:t,enableInputTypeSelection:e=!1,onParameterChange:n,actions:r,formElements:i,onFormElementsChange:s,keyName:o,environment:a,createEmptyParameter:l}){const c=Ji(),{ghost:u,updateGhost:f,promoteGhost:h}=IK({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(cBe,{children:[t&&d.jsx(uBe,{children:t}),d.jsx(dBe,{children:[...i.map((g,O)=>d.jsx(q4,{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(q4,{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 SBe({formElements:t,onFormElementsChange:e,type:n}){const r=Ft();function i(s){e(o=>o.filter((a,l)=>l!==s))}return d.jsx(xBe,{keyName:"Param",formElements:t,onFormElementsChange:e,environment:r,enableInputTypeSelection:n!==Ye.UrlEncoded,createEmptyParameter:k$e,actions:s=>d.jsx(Ts,{onClick:()=>i(s),variant:"text",icon:d.jsx(rr.TrashCanIcon,{})})})}const wBe=({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(Rn())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-COdtZP45.js")),c=await l();if(!c)return;const u=await jO(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(yC,{children:d.jsxs(TBe,{children:[d.jsx(fx.Spinner,{}),"Loading..."]})}):t&&t.file?.name?d.jsx(yC,{children:d.jsxs(CBe,{children:[d.jsxs(PBe,{children:[d.jsx(Vte.DocumentBlankIcon,{size:"16px"}),d.jsx(kBe,{children:t.file?.name})]}),d.jsx(Ts,{onClick:a,icon:d.jsx(rr.TrashCanIcon,{})})]})}):d.jsx(yC,{children:d.jsx(BK,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"file",hidden:!0,ref:i,onChange:s}),d.jsx(ye.Button,{type:"button",variant:"text",onClick:o,icon:d.jsx(Mte.CloudUploadIcon,{}),children:"Upload file"})]})})})},yC=T.default(mQ)`
4011
4011
  align-items: flex-start;
4012
4012
  `,BK=T.default.div`
4013
4013
  display: flex;
@@ -4153,7 +4153,7 @@ ${u.join(`\r
4153
4153
  `,H4=T.default.div`
4154
4154
  flex: 1;
4155
4155
  min-height: 0;
4156
- `;function pZe(t){const{body:e,onBodyChange:n,apiOperation:r}=t,{content:i,type:s}=e,{features:o}=Fn(),a=wG(s,o);return d.jsx(mQ,{children:d.jsx(io,{dataTestId:"request-body-tab-codemirror",value:i,apiOperation:r,onChange:l=>n(c=>({...c,content:l})),extensions:a?.extensions,stateExtensions:a?.stateExtensions})})}function tee({onBodyChange:t,apply:e}){return d.jsx(ye.Button,{variant:"text",size:"small",icon:d.jsx(Lte.MagicWandIcon,{size:"14px",color:"--button-content-color"}),onClick:()=>t(e),children:"Prettify"})}function gZe(t){const{tabId:e}=t,{step:n}=_i(),r=GK(e),i=eee(e),s=!!Yu(n),o=()=>i(c_.Manual),l=r?.status==="loading"?fx.Spinner:DI.DownloadIcon,c=s?"--button-content-color":"--dropdown-menu-item-color-disabled";return d.jsx(sd.DropdownMenuItem,{content:"Fetch schema",prefix:d.jsx(l,{size:"14px",color:c}),disabled:!s,onAction:s?o:void 0})}async function mZe(t){return Rn()?OZe(t):vZe(t)}async function OZe(t){const[{open:e},{readTextFile:n},{basename:r}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-DMy5OBRE.js")),Promise.resolve().then(()=>$O),Promise.resolve().then(()=>BQ)]),i=await e({multiple:!1,directory:!1,filters:[{name:"GraphQL schema",extensions:t.extensions}]});if(!i)return null;const[s,o]=await Promise.all([n(i),r(i)]);return{name:o,text:s}}function vZe(t){const e=document.createElement("input");return e.type="file",e.accept=t.extensions.map(n=>`.${n}`).join(","),e.style.display="none",document.body.appendChild(e),new Promise((n,r)=>{const i=s=>{e.remove(),s()};e.addEventListener("change",()=>{const s=e.files?.[0];if(!s){i(()=>n(null));return}s.text().then(o=>i(()=>n({name:s.name,text:o}))).catch(()=>i(()=>r(new Error("Failed to read the selected file."))))}),e.addEventListener("cancel",()=>i(()=>n(null))),e.click()})}const yZe=["graphql","graphqls","gql","json"];function bZe(t){const{tabId:e}=t,n=HK(),{showSchemaLoaded:r,showSchemaFailed:i}=KK(),s=(a,l)=>{const c=a instanceof Error?a.message:l;pI(e),n(e,()=>({status:"error",error:c})),i({error:c})},o=async()=>{let a;try{a=await mZe({extensions:yZe})}catch(l){s(l,"Failed to read the schema file.");return}if(a){pI(e),n(e,()=>({status:"loading"}));try{const l=ZBe(a.text);n(e,()=>({status:"ready",introspection:l})),r({fileName:a.name})}catch(l){s(l,"Failed to load the schema file.")}}};return d.jsx(sd.DropdownMenuItem,{content:"Load schema file",prefix:d.jsx(T9.FileIcon,{size:"14px",color:"--button-content-color"}),onAction:o})}function xZe(t){return d.jsx(Gi.Dropdown,{alignment:"end",trigger:d.jsx(ye.Button,{size:"small",variant:"text","aria-label":"Schema options",icon:d.jsx(RI.OverflowMenuHorizontalIcon,{size:"14px",color:"--button-content-color"})}),children:d.jsxs(Yi.DropdownMenu,{children:[d.jsx(gZe,{tabId:t.tabId}),d.jsx(bZe,{tabId:t.tabId})]})})}const SZe={matches:t=>EA.includes(t),applyExample:(t,e,n)=>{const r=t.type;return R5(t,r,()=>gG(e,r,n?.encoding,n?.schema))},Editor:({body:t,onBodyChange:e})=>d.jsx(SBe,{type:t.type,formElements:t.formData[t.type],onFormElementsChange:n=>e(r=>R5(r,t.type,n))})},wZe={matches:t=>gB.includes(t),Editor:({body:t,onBodyChange:e})=>d.jsx(wBe,{binary:t.binary,onBinaryChange:n=>e(r=>({...r,binary:n}))})},TZe={matches:t=>Ye.GraphqlJSON===t,applyExample:(t,e)=>{const{query:n,variables:r}=bl(e);return{...t,content:X0(n,r)}},prepareForTypeChange:t=>({...t,content:vAe(t.content)}),ToolbarActions:({body:t,onBodyChange:e,tabId:n})=>{const{query:r,variables:i}=bl(t.content),s=XBe(t.type,r),o=bG(Ye.JSON,i),a=l=>{const c=bl(l.content);return{...l,content:X0(s?FBe(c.query):c.query,o?QQ(c.variables):c.variables)}};return d.jsxs(d.Fragment,{children:[(s||o)&&d.jsx(tee,{onBodyChange:e,apply:a}),d.jsx(FK,{}),d.jsx(xZe,{tabId:n})]})},Editor:fZe},CZe={applyExample:(t,e)=>({...t,content:PE(e)}),ToolbarActions:({body:t,onBodyChange:e})=>d.jsx(d.Fragment,{children:bG(t.type,t.content)&&d.jsx(tee,{onBodyChange:e,apply:n=>({...n,content:QQ(n.content)})})}),Editor:pZe},PZe=[SZe,wZe,TZe],kZe=CZe;function og(t,e){return PZe.find(r=>r.matches(t)&&ep(t,e))??kZe}function EZe(t){const{apiOperation:e,type:n,activeExampleName:r,onBodyChange:i}=t,s=b.useMemo(()=>Object.keys(e?.body?.mediaTypes||{}),[e?.body?.mediaTypes]),{features:o}=Fn(),a=b.useMemo(()=>q7e(e,o),[e,o]),l=b.useMemo(()=>YR(s,a),[a,s]),c=b.useMemo(()=>a.find(({value:v})=>v===n)??qK(n,o),[a,n,o]),u=b.useMemo(()=>kE(e?.body?.mediaTypes?.[n]),[n,e]),f=!!og(n,o).applyExample,h=b.useMemo(()=>f?u.map(({key:v,name:x})=>({label:x,value:v})):[],[u,f]),p=b.useMemo(()=>h.find(v=>v.value===r),[h,r]),{sendEvent:m}=Ke();return{contentTypes:l,activeContentType:c,onContentTypeChange:({value:v})=>{const x=String(v),y=e?.body?.mediaTypes?.[x],[w]=kE(y),S=og(x,o),P=S.applyExample;i(k=>{const I=og(k.type,o),Q={...I!==S&&I.prepareForTypeChange?I.prepareForTypeChange(k):k,type:x};return!w||!P?Q:P({...Q,activeExampleName:w.key},w.value,y)}),m("com.redocly.change.occurred",[{...be("select","requestBodyType"),context:"type",source:"request_body",value:x}])},examples:h,activeExample:p,onExampleChange:v=>{const x=String(v.value),y=u.find(w=>w.key===x);y&&(i(w=>{const S=og(w.type,o).applyExample;return S?S({...w,activeExampleName:y.key},y.value,e?.body?.mediaTypes?.[w.type]):w}),m("com.redocly.change.occurred",[{...be("select","requestBodyExample"),context:"example",source:"request_body",value:y.name}]))}}}function IZe(t){const{body:e,onBodyChange:n,apiOperation:r,tabId:i}=t,s=EZe({apiOperation:r,onBodyChange:n,type:e.type,activeExampleName:e.activeExampleName}),{features:o}=Fn(),{Editor:a,ToolbarActions:l}=og(e.type,o);return d.jsx(W7e,{contentTypes:s.contentTypes,activeContentType:s.activeContentType,onContentTypeChange:s.onContentTypeChange,examples:s.examples,activeExample:s.activeExample,onExampleChange:s.onExampleChange,actions:l&&d.jsx(l,{body:e,onBodyChange:n,apiOperation:r,tabId:i}),children:d.jsx(a,{body:e,onBodyChange:n,apiOperation:r,tabId:i})})}const $Ze=({activeTabName:t,onChange:e})=>{const{isMobile:n}=co(),{isDraft:r}=_i(),i=mB(r);if(!n)return null;const s=i.find(({name:o})=>o===t);return d.jsx(QZe,{children:d.jsx(AZe,{dataTestId:"request-tab-change-select",options:i.map(({name:o})=>({element:o,label:o,value:o})),value:s?.name,onChange:o=>e(o)})})},AZe=T.default(ld.Select)`
4156
+ `;function pZe(t){const{body:e,onBodyChange:n,apiOperation:r}=t,{content:i,type:s}=e,{features:o}=Fn(),a=wG(s,o);return d.jsx(mQ,{children:d.jsx(io,{dataTestId:"request-body-tab-codemirror",value:i,apiOperation:r,onChange:l=>n(c=>({...c,content:l})),extensions:a?.extensions,stateExtensions:a?.stateExtensions})})}function tee({onBodyChange:t,apply:e}){return d.jsx(ye.Button,{variant:"text",size:"small",icon:d.jsx(Lte.MagicWandIcon,{size:"14px",color:"--button-content-color"}),onClick:()=>t(e),children:"Prettify"})}function gZe(t){const{tabId:e}=t,{step:n}=_i(),r=GK(e),i=eee(e),s=!!Yu(n),o=()=>i(c_.Manual),l=r?.status==="loading"?fx.Spinner:DI.DownloadIcon,c=s?"--button-content-color":"--dropdown-menu-item-color-disabled";return d.jsx(sd.DropdownMenuItem,{content:"Fetch schema",prefix:d.jsx(l,{size:"14px",color:c}),disabled:!s,onAction:s?o:void 0})}async function mZe(t){return Rn()?OZe(t):vZe(t)}async function OZe(t){const[{open:e},{readTextFile:n},{basename:r}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-COdtZP45.js")),Promise.resolve().then(()=>$O),Promise.resolve().then(()=>BQ)]),i=await e({multiple:!1,directory:!1,filters:[{name:"GraphQL schema",extensions:t.extensions}]});if(!i)return null;const[s,o]=await Promise.all([n(i),r(i)]);return{name:o,text:s}}function vZe(t){const e=document.createElement("input");return e.type="file",e.accept=t.extensions.map(n=>`.${n}`).join(","),e.style.display="none",document.body.appendChild(e),new Promise((n,r)=>{const i=s=>{e.remove(),s()};e.addEventListener("change",()=>{const s=e.files?.[0];if(!s){i(()=>n(null));return}s.text().then(o=>i(()=>n({name:s.name,text:o}))).catch(()=>i(()=>r(new Error("Failed to read the selected file."))))}),e.addEventListener("cancel",()=>i(()=>n(null))),e.click()})}const yZe=["graphql","graphqls","gql","json"];function bZe(t){const{tabId:e}=t,n=HK(),{showSchemaLoaded:r,showSchemaFailed:i}=KK(),s=(a,l)=>{const c=a instanceof Error?a.message:l;pI(e),n(e,()=>({status:"error",error:c})),i({error:c})},o=async()=>{let a;try{a=await mZe({extensions:yZe})}catch(l){s(l,"Failed to read the schema file.");return}if(a){pI(e),n(e,()=>({status:"loading"}));try{const l=ZBe(a.text);n(e,()=>({status:"ready",introspection:l})),r({fileName:a.name})}catch(l){s(l,"Failed to load the schema file.")}}};return d.jsx(sd.DropdownMenuItem,{content:"Load schema file",prefix:d.jsx(T9.FileIcon,{size:"14px",color:"--button-content-color"}),onAction:o})}function xZe(t){return d.jsx(Gi.Dropdown,{alignment:"end",trigger:d.jsx(ye.Button,{size:"small",variant:"text","aria-label":"Schema options",icon:d.jsx(RI.OverflowMenuHorizontalIcon,{size:"14px",color:"--button-content-color"})}),children:d.jsxs(Yi.DropdownMenu,{children:[d.jsx(gZe,{tabId:t.tabId}),d.jsx(bZe,{tabId:t.tabId})]})})}const SZe={matches:t=>EA.includes(t),applyExample:(t,e,n)=>{const r=t.type;return R5(t,r,()=>gG(e,r,n?.encoding,n?.schema))},Editor:({body:t,onBodyChange:e})=>d.jsx(SBe,{type:t.type,formElements:t.formData[t.type],onFormElementsChange:n=>e(r=>R5(r,t.type,n))})},wZe={matches:t=>gB.includes(t),Editor:({body:t,onBodyChange:e})=>d.jsx(wBe,{binary:t.binary,onBinaryChange:n=>e(r=>({...r,binary:n}))})},TZe={matches:t=>Ye.GraphqlJSON===t,applyExample:(t,e)=>{const{query:n,variables:r}=bl(e);return{...t,content:X0(n,r)}},prepareForTypeChange:t=>({...t,content:vAe(t.content)}),ToolbarActions:({body:t,onBodyChange:e,tabId:n})=>{const{query:r,variables:i}=bl(t.content),s=XBe(t.type,r),o=bG(Ye.JSON,i),a=l=>{const c=bl(l.content);return{...l,content:X0(s?FBe(c.query):c.query,o?QQ(c.variables):c.variables)}};return d.jsxs(d.Fragment,{children:[(s||o)&&d.jsx(tee,{onBodyChange:e,apply:a}),d.jsx(FK,{}),d.jsx(xZe,{tabId:n})]})},Editor:fZe},CZe={applyExample:(t,e)=>({...t,content:PE(e)}),ToolbarActions:({body:t,onBodyChange:e})=>d.jsx(d.Fragment,{children:bG(t.type,t.content)&&d.jsx(tee,{onBodyChange:e,apply:n=>({...n,content:QQ(n.content)})})}),Editor:pZe},PZe=[SZe,wZe,TZe],kZe=CZe;function og(t,e){return PZe.find(r=>r.matches(t)&&ep(t,e))??kZe}function EZe(t){const{apiOperation:e,type:n,activeExampleName:r,onBodyChange:i}=t,s=b.useMemo(()=>Object.keys(e?.body?.mediaTypes||{}),[e?.body?.mediaTypes]),{features:o}=Fn(),a=b.useMemo(()=>q7e(e,o),[e,o]),l=b.useMemo(()=>YR(s,a),[a,s]),c=b.useMemo(()=>a.find(({value:v})=>v===n)??qK(n,o),[a,n,o]),u=b.useMemo(()=>kE(e?.body?.mediaTypes?.[n]),[n,e]),f=!!og(n,o).applyExample,h=b.useMemo(()=>f?u.map(({key:v,name:x})=>({label:x,value:v})):[],[u,f]),p=b.useMemo(()=>h.find(v=>v.value===r),[h,r]),{sendEvent:m}=Ke();return{contentTypes:l,activeContentType:c,onContentTypeChange:({value:v})=>{const x=String(v),y=e?.body?.mediaTypes?.[x],[w]=kE(y),S=og(x,o),P=S.applyExample;i(k=>{const I=og(k.type,o),Q={...I!==S&&I.prepareForTypeChange?I.prepareForTypeChange(k):k,type:x};return!w||!P?Q:P({...Q,activeExampleName:w.key},w.value,y)}),m("com.redocly.change.occurred",[{...be("select","requestBodyType"),context:"type",source:"request_body",value:x}])},examples:h,activeExample:p,onExampleChange:v=>{const x=String(v.value),y=u.find(w=>w.key===x);y&&(i(w=>{const S=og(w.type,o).applyExample;return S?S({...w,activeExampleName:y.key},y.value,e?.body?.mediaTypes?.[w.type]):w}),m("com.redocly.change.occurred",[{...be("select","requestBodyExample"),context:"example",source:"request_body",value:y.name}]))}}}function IZe(t){const{body:e,onBodyChange:n,apiOperation:r,tabId:i}=t,s=EZe({apiOperation:r,onBodyChange:n,type:e.type,activeExampleName:e.activeExampleName}),{features:o}=Fn(),{Editor:a,ToolbarActions:l}=og(e.type,o);return d.jsx(W7e,{contentTypes:s.contentTypes,activeContentType:s.activeContentType,onContentTypeChange:s.onContentTypeChange,examples:s.examples,activeExample:s.activeExample,onExampleChange:s.onExampleChange,actions:l&&d.jsx(l,{body:e,onBodyChange:n,apiOperation:r,tabId:i}),children:d.jsx(a,{body:e,onBodyChange:n,apiOperation:r,tabId:i})})}const $Ze=({activeTabName:t,onChange:e})=>{const{isMobile:n}=co(),{isDraft:r}=_i(),i=mB(r);if(!n)return null;const s=i.find(({name:o})=>o===t);return d.jsx(QZe,{children:d.jsx(AZe,{dataTestId:"request-tab-change-select",options:i.map(({name:o})=>({element:o,label:o,value:o})),value:s?.name,onChange:o=>e(o)})})},AZe=T.default(ld.Select)`
4157
4157
  border-radius: var(--border-radius-md);
4158
4158
  background-color: var(--bg-color-active);
4159
4159
  `,QZe=T.default.div`
@@ -4209,7 +4209,7 @@ ${u.join(`\r
4209
4209
  font-size: var(--font-size-base);
4210
4210
  font-weight: var(--font-weight-medium);
4211
4211
  padding: var(--spacing-xs);
4212
- `;function WZe(t=32){let e="";for(;e.length<t;)e+=Math.random().toString(32).substring(2);return e.substring(0,t)}async function gI(t,e,n){const r=typeof t=="string"?t:t.toString();if(Rn()){const{openUrl:i}=await Promise.resolve().then(()=>require("./replay-index-COk-TAX_.js"));await i(r);return}window.open(r,e,n)}const J4="/_auth/oauth2-redirect.html";let hw=class ag{static async authorizeImplicit({authorizationUrl:e,clientId:n,scopes:r,extraAuthParams:i={},routingBasePath:s="/",redirectUri:o,successCallback:a,errorCallback:l}){const c=K4({date:new Date().toString()});try{const u=new URL(e),f=s==="/"?"":s,h=`${window.location.origin}${f}${J4}`;u.searchParams.set("client_id",n),u.searchParams.set("redirect_uri",o||h),u.searchParams.set("response_type","token"),u.searchParams.set("state",c),Array.isArray(r)&&u.searchParams.set("scope",r.join(" "));for(const p in i)u.searchParams.set(p,i[p]);window.redirectOAuth2={flow:"implicit",data:{authorizationUrl:e,clientId:n,scopes:r},state:c,successCallback:p=>{a(p),ag.clearRedirectData("implicit")},errorCallback:p=>{l(p),ag.clearRedirectData("implicit")}},await gI(u.toString())}catch(u){l(al.OAuth2Error.fromError(u))}}static async authorizeAuthorizationCode({authorizationUrl:e,tokenUrl:n,serverUrl:r,clientId:i,clientSecret:s,codeVerifier:o,codeChallenge:a,scopes:l,extraAuthParams:c={},extraTokenHeaders:u={},extraTokenBody:f={},extraTokenParams:h={},routingBasePath:p="/",redirectUri:m,withPkce:g,successCallback:O,errorCallback:v}){try{const x=Wv({url:e,serverUrl:r}),y=new URL(x),w=Wv({url:n,serverUrl:r}),S=new URL(w),P=p==="/"?"":p,k=`${window.location.origin}${P}${J4}`,I=K4({date:new Date().toString()});y.searchParams.set("client_id",i),y.searchParams.set("redirect_uri",m||k),y.searchParams.set("response_type","code"),y.searchParams.set("state",I),Array.isArray(l)&&y.searchParams.set("scope",l.join(" ")),g&&(!a&&!o&&(o=GZe(),a=await BZe(o)),a&&(y.searchParams.set("code_challenge",a),y.searchParams.set("code_challenge_method","S256")));for(const E in c)y.searchParams.set(E,c[E]);for(const E in h)S.searchParams.set(E,h[E]);window.redirectOAuth2={flow:"authorizationCode",data:{authorizationUrl:e,clientId:i,scopes:l},state:I,successCallback:async({auth_code:E})=>{const Q=ja({client_id:i,client_secret:s,...o&&{code_verifier:o},code:E,grant_type:"authorization_code",redirect_uri:m||k,...f});try{const N=await Ro(S,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...u},body:new URLSearchParams(Q).toString()});await xC(N,O,v)}catch(N){v(al.OAuth2Error.fromError(N))}ag.clearRedirectData("authorizationCode")},errorCallback:E=>{v(al.OAuth2Error.fromError(E)),ag.clearRedirectData("authorizationCode")}},await gI(y.toString())}catch(x){v(al.OAuth2Error.fromError(x))}}static clearRedirectData(e){window.redirectOAuth2={flow:e,data:{authorizationUrl:"",clientId:"",scopes:[]},state:"",successCallback:()=>{},errorCallback:()=>{}}}static async authorizeClientCredentials({tokenUrl:e,clientId:n,clientSecret:r,scopes:i=[],extraTokenParams:s={},extraTokenHeaders:o={},extraTokenBody:a={},corsProxyUrl:l,serverUrl:c,assertionType:u,clientAssertion:f,successCallback:h,errorCallback:p}){try{const m=u===z0,g={client_id:n,client_secret:r,grant_type:"client_credentials",scope:Array.isArray(i)&&i.length?i.join(" "):void 0,...m&&{client_assertion_type:u,client_assertion:f},...a},O=Wv({url:e,serverUrl:c,corsProxyUrl:l}),v=new URL(O);for(const y in s)v.searchParams.set(y,s[y]);const x=await Ro(O,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...o},body:new URLSearchParams(g5(g)).toString()});await xC(x,h,p)}catch(m){p(al.OAuth2Error.fromError(m))}}static async authorizePasswordGrant({username:e,password:n,tokenUrl:r,clientId:i,clientSecret:s,scopes:o=[],extraTokenParams:a={},extraTokenHeaders:l={},extraTokenBody:c={},corsProxyUrl:u,serverUrl:f,successCallback:h,errorCallback:p}){try{const m={client_id:i,client_secret:s,grant_type:"password",username:e,password:n,scope:Array.isArray(o)&&o.length?o.join(" "):void 0,...c},g=Wv({url:r,serverUrl:f,corsProxyUrl:u}),O=new URL(g);for(const x in a)O.searchParams.set(x,a[x]);const v=await Ro(g,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...l},body:new URLSearchParams(g5(m)).toString()});await xC(v,h,p)}catch(m){p(al.OAuth2Error.fromError(m))}}};function K4(t){const e={randomStr:WZe(),...t};return btoa(encodeURIComponent(JSON.stringify(e)))}async function xC(t,e,n){if(t.ok){const r=await t.json();if(r.error){n(al.OAuth2Error.fromJsonData(r));return}e(r)}else{if((t.headers.get("Content-Type")||"").indexOf("json")>-1){const s=await t.json();n(al.OAuth2Error.fromJsonData(s));return}n(al.OAuth2Error.fromTextData(await t.text()))}}async function BZe(t){return iFe(await rFe(t))}function ZZe(t){return("0"+t.toString(16)).slice(-2)}function GZe(){const t=new Uint32Array(28);return crypto.getRandomValues(t),Array.from(t,ZZe).join("")}function pw({scopes:t,onScopesChange:e,environment:n}){const r=i=>{e(s=>s.filter((o,a)=>a!==i))};return d.jsx(YZe,{children:d.jsx(HZe,{keyName:"Scopes",elements:t,onElementsChange:i=>e(s=>i(s)),createEmptyParameter:P$e,environment:n,actions:i=>d.jsx(Ts,{onClick:()=>r(i),variant:"text",icon:d.jsx(rr.TrashCanIcon,{})}),singleValue:!0,hideOuterBorders:!0,valuePlaceholder:"New scope item"})})}const YZe=T.default.div`
4212
+ `;function WZe(t=32){let e="";for(;e.length<t;)e+=Math.random().toString(32).substring(2);return e.substring(0,t)}async function gI(t,e,n){const r=typeof t=="string"?t:t.toString();if(Rn()){const{openUrl:i}=await Promise.resolve().then(()=>require("./replay-index-eMgUixYk.js"));await i(r);return}window.open(r,e,n)}const J4="/_auth/oauth2-redirect.html";let hw=class ag{static async authorizeImplicit({authorizationUrl:e,clientId:n,scopes:r,extraAuthParams:i={},routingBasePath:s="/",redirectUri:o,successCallback:a,errorCallback:l}){const c=K4({date:new Date().toString()});try{const u=new URL(e),f=s==="/"?"":s,h=`${window.location.origin}${f}${J4}`;u.searchParams.set("client_id",n),u.searchParams.set("redirect_uri",o||h),u.searchParams.set("response_type","token"),u.searchParams.set("state",c),Array.isArray(r)&&u.searchParams.set("scope",r.join(" "));for(const p in i)u.searchParams.set(p,i[p]);window.redirectOAuth2={flow:"implicit",data:{authorizationUrl:e,clientId:n,scopes:r},state:c,successCallback:p=>{a(p),ag.clearRedirectData("implicit")},errorCallback:p=>{l(p),ag.clearRedirectData("implicit")}},await gI(u.toString())}catch(u){l(al.OAuth2Error.fromError(u))}}static async authorizeAuthorizationCode({authorizationUrl:e,tokenUrl:n,serverUrl:r,clientId:i,clientSecret:s,codeVerifier:o,codeChallenge:a,scopes:l,extraAuthParams:c={},extraTokenHeaders:u={},extraTokenBody:f={},extraTokenParams:h={},routingBasePath:p="/",redirectUri:m,withPkce:g,successCallback:O,errorCallback:v}){try{const x=Wv({url:e,serverUrl:r}),y=new URL(x),w=Wv({url:n,serverUrl:r}),S=new URL(w),P=p==="/"?"":p,k=`${window.location.origin}${P}${J4}`,I=K4({date:new Date().toString()});y.searchParams.set("client_id",i),y.searchParams.set("redirect_uri",m||k),y.searchParams.set("response_type","code"),y.searchParams.set("state",I),Array.isArray(l)&&y.searchParams.set("scope",l.join(" ")),g&&(!a&&!o&&(o=GZe(),a=await BZe(o)),a&&(y.searchParams.set("code_challenge",a),y.searchParams.set("code_challenge_method","S256")));for(const E in c)y.searchParams.set(E,c[E]);for(const E in h)S.searchParams.set(E,h[E]);window.redirectOAuth2={flow:"authorizationCode",data:{authorizationUrl:e,clientId:i,scopes:l},state:I,successCallback:async({auth_code:E})=>{const Q=ja({client_id:i,client_secret:s,...o&&{code_verifier:o},code:E,grant_type:"authorization_code",redirect_uri:m||k,...f});try{const N=await Ro(S,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...u},body:new URLSearchParams(Q).toString()});await xC(N,O,v)}catch(N){v(al.OAuth2Error.fromError(N))}ag.clearRedirectData("authorizationCode")},errorCallback:E=>{v(al.OAuth2Error.fromError(E)),ag.clearRedirectData("authorizationCode")}},await gI(y.toString())}catch(x){v(al.OAuth2Error.fromError(x))}}static clearRedirectData(e){window.redirectOAuth2={flow:e,data:{authorizationUrl:"",clientId:"",scopes:[]},state:"",successCallback:()=>{},errorCallback:()=>{}}}static async authorizeClientCredentials({tokenUrl:e,clientId:n,clientSecret:r,scopes:i=[],extraTokenParams:s={},extraTokenHeaders:o={},extraTokenBody:a={},corsProxyUrl:l,serverUrl:c,assertionType:u,clientAssertion:f,successCallback:h,errorCallback:p}){try{const m=u===z0,g={client_id:n,client_secret:r,grant_type:"client_credentials",scope:Array.isArray(i)&&i.length?i.join(" "):void 0,...m&&{client_assertion_type:u,client_assertion:f},...a},O=Wv({url:e,serverUrl:c,corsProxyUrl:l}),v=new URL(O);for(const y in s)v.searchParams.set(y,s[y]);const x=await Ro(O,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...o},body:new URLSearchParams(g5(g)).toString()});await xC(x,h,p)}catch(m){p(al.OAuth2Error.fromError(m))}}static async authorizePasswordGrant({username:e,password:n,tokenUrl:r,clientId:i,clientSecret:s,scopes:o=[],extraTokenParams:a={},extraTokenHeaders:l={},extraTokenBody:c={},corsProxyUrl:u,serverUrl:f,successCallback:h,errorCallback:p}){try{const m={client_id:i,client_secret:s,grant_type:"password",username:e,password:n,scope:Array.isArray(o)&&o.length?o.join(" "):void 0,...c},g=Wv({url:r,serverUrl:f,corsProxyUrl:u}),O=new URL(g);for(const x in a)O.searchParams.set(x,a[x]);const v=await Ro(g,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",Accept:"application/json",...l},body:new URLSearchParams(g5(m)).toString()});await xC(v,h,p)}catch(m){p(al.OAuth2Error.fromError(m))}}};function K4(t){const e={randomStr:WZe(),...t};return btoa(encodeURIComponent(JSON.stringify(e)))}async function xC(t,e,n){if(t.ok){const r=await t.json();if(r.error){n(al.OAuth2Error.fromJsonData(r));return}e(r)}else{if((t.headers.get("Content-Type")||"").indexOf("json")>-1){const s=await t.json();n(al.OAuth2Error.fromJsonData(s));return}n(al.OAuth2Error.fromTextData(await t.text()))}}async function BZe(t){return iFe(await rFe(t))}function ZZe(t){return("0"+t.toString(16)).slice(-2)}function GZe(){const t=new Uint32Array(28);return crypto.getRandomValues(t),Array.from(t,ZZe).join("")}function pw({scopes:t,onScopesChange:e,environment:n}){const r=i=>{e(s=>s.filter((o,a)=>a!==i))};return d.jsx(YZe,{children:d.jsx(HZe,{keyName:"Scopes",elements:t,onElementsChange:i=>e(s=>i(s)),createEmptyParameter:P$e,environment:n,actions:i=>d.jsx(Ts,{onClick:()=>r(i),variant:"text",icon:d.jsx(rr.TrashCanIcon,{})}),singleValue:!0,hideOuterBorders:!0,valuePlaceholder:"New scope item"})})}const YZe=T.default.div`
4213
4213
  width: 100%;
4214
4214
 
4215
4215
  > div {
@@ -6476,7 +6476,7 @@ ${u.join(`\r
6476
6476
  display: inline-block;
6477
6477
  color: var(--text-color-secondary);
6478
6478
  margin-left: var(--spacing-xs);
6479
- `,het="request",pet=new Set(["replay:","redocly-replay:"]),get=8*1024,met=4*1024,TI=1024,Oet=new Set([Hn.JSON,Hn.XML,Hn.HTML,Hn.Text]);function CI(t){return xQ(t).length>0}function vet(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function ete(t,e){return!t||t.length>TI||e.length>TI||CI(e)}function EC(t,e,n){const r=[];for(const[i,s]of t){if(!i.startsWith(e))continue;const o=i.slice(e.length);if(ete(o,s))return null;r.push(vet(n,o,s))}return r}function yet(t){if(t.length>get)return null;let e;try{e=new URL(t)}catch{return null}if(!pet.has(e.protocol)||e.hostname.toLowerCase()!==het)return null;const n=e.searchParams,r=n.get("url");if(!r||CI(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(!Mh.includes(s))return null;const o=EC(n,"header.","header"),a=EC(n,"query.","query"),l=EC(n,"cookie.","cookie");if(!o||!a||!l)return null;const c=IO(r);if(c.some(p=>ete(p.key,p.value)))return null;const u=n.get("body");if(u!==null&&(u.length>met||CI(u)))return null;const f=n.get("contentType")?.trim();if(f&&!Oet.has(f))return null;const h=n.get("env")?.trim();return h&&h.length>TI?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 bet(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function xet({onEnvironmentNotFound:t}={}){const{getTabs:e,setActiveTabIdx:n,updateTabDataAt:r}=cd(),{addNewTab:i}=pr(),s=qa(),o=Kh();return b.useCallback(a=>{const l=e().findIndex(({data:h})=>_n(h,Ue.Step)&&bet(h)&&LE(h,a.xOperation)),c=Th(),u=a.body?{...c,content:a.body.content,...a.body.type&&{type:a.body.type}}:c;let f;if(l!==-1)f=l,n(f);else{const h={...Da({xOperation:a.xOperation}),requestBody:u};f=i({id:crypto.randomUUID(),state:xn.Normal,data:yf({draftStep:h,activeTabName:xu(h)})})}e()[f]&&r(f,h=>{const p={...h,response:null,requestError:null,isProcessingRequest:!1};return p.draftStep?{...p,draftStep:{...p.draftStep,parameters:{...p.draftStep.parameters,headers:a.headers,queryParameters:a.queryParameters,cookies:a.cookies},requestBody:u}}:p}),a.environment&&(s.some(p=>p.name===a.environment)?o(a.environment):t?.(a.environment))},[e,n,r,i,s,o,t])}const wet="com.redocly.deepLink.opened";let zz=!1;function Tet(){const{warning:t}=jI.useToast(),e=Ke(),n=xet({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]&&yet(a[0]);l&&(r.current(l),e.sendEvent(wet,[{...be("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-Cp0wQDgB.js")),c=await a(o);if(s){c();return}if(i=c,!zz){const u=await l();if(s)return;zz=!0,u?.[0]&&o(u)}})(),()=>{s=!0,i?.()}},[])}function Cet(t){const e=t||"default";return{id:Fm(cw(e)),systemFilesDir:Dk.join("/replay",e),userFilesDir:Dk.join("/projects",e)}}async function Pet(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=Fm(cw(t)),n=await ket(),r=await qQ(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function ket(){if(!mE)return ME();try{return await ZG()}catch{return ME()}}function hy(t,e){if(e.size===0)return t;let n=t;for(let r=0;r<t.length;r++){const i=t[r];!yO(i)||!i.key||!e.has(i.key)||(n===t&&(n=[...t]),n[r]={...i,value:`$inputs.${i.key}`,active:!0})}return n}function tte(t,e,n){if(typeof e=="string"){const s=no(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=tte(r[s],o,n);a!==r[s]&&(i===r&&(i={...r}),i[s]=a)}return i}function Eet(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=tte(r[s],i,n);o!==r[s]&&(r===t&&(r=[...t]),r[s]=o)}return r}function Iet(t,e,n){const r=EQ(e.parameters,"in"),{pathParameters:i,queryParameters:s,headers:o,cookies:a}=t.parameters;return{...t,parameters:{...t.parameters,pathParameters:hy(i,Vf(r.path,"path",n)),queryParameters:hy(s,sG(r.query,r.querystring,n)),headers:hy(o,Vf(r.header,"header",n)),cookies:hy(a,Vf(r.cookie,"cookie",n))},security:Eet(t.security,TS(e),hGe(e,n))}}function Q_(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)}const nte=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:s}=eR({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===s}return!1}),$et=new Set(["parameters","servers","description","summary","additionalOperations"]);function Aet(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=_et(t,e,n);return{operations:r}}function Qet(t){let e=0;for(const{method:n,tags:r,isAdditionalOperation:i}of R_(t))(i||L9([n]).length>0)&&(e+=r.length);return e}function Ret(t,e,n,r,i){const s=i?eR({operationPath:i,parsedSourceDescriptions:[]}):void 0;for(const o of R_(t)){const{path:a,method:l,operation:c,tags:u}=o,f=!!r&&c.operationId===r,h=s!==void 0&&s.path===a&&s.method===l.toLowerCase();if(!f&&!h)continue;const p=rte(o,t,u[0],e,n);return p&&nte([p.operation],r,i)?p:null}return null}function*R_(t){for(const[e,n]of Object.entries(t.paths??{})){for(const[r,i]of Object.entries(n))$et.has(r)||(yield{path:e,method:r,operation:i,tags:Xz(i),isAdditionalOperation:!1});for(const[r,i]of Object.entries(n.additionalOperations??{}))yield{path:e,method:r,operation:i,tags:Xz(i),isAdditionalOperation:!0}}}function Xz(t){return t.tags&&t.tags.length>0?t.tags:[XC]}function _et(t,e,n){const r=[];for(const i of R_(t))for(const s of i.tags){const o=rte(i,t,s,e,n);o&&r.push(o.operation)}return{operations:r}}function rte({path:t,method:e,isAdditionalOperation:n},r,i,s,o){const a=o?.(t,e,r);if(!a)return null;const l=`${r.info.title}/${i}/${a.name}`;return{operation:MAe(a,n,s,l),openApiOperation:a}}function jet(t){return"kind"in t&&"definition"in t}function Net(t,e,n){if(t)return jet(t)?t:{kind:"openapi",definition:{document:t},operation:Det(e,n)}}function Det(t,e){if(t&&e)return{operationId:t,pointer:e};if(t)return{operationId:t};if(e)return{pointer:e}}function Uz(t,e,n,r){return t==="openapi"?Met(e,n,r):(console.error(`Replay does not support the API kind "${String(t)}".`),null)}function Met(t,e,n){try{const r=Q_(t,[]),i=n?.operationId,s=n?.pointer,o=Ret(t,r,e,i,s);let a;if(o)a=Fz(o.operation,()=>o.openApiOperation);else{const{operations:l}=Aet(t,r,e);if(!l?.length)return null;a=Fz(nte(l,i,s),(c,u)=>e?.(c,u,t))}return{apiId:r,document:t,operationsCount:Qet(t),selectedOperation:a}}catch(r){return console.error("Replay cannot read the OpenAPI document of `api`.",r),null}}function Fz(t,e){const{path:n,method:r}=t?.apiPath??{};return!t||!n||!r?null:{requestOperation:t,path:n,method:r,openApiOperation:e(n,r)}}function Vet({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(Ao,e))},[t,e,n])}let ob=performance.now();function Let(){ob=performance.now()}const Jd=t=>Math.max(0,Math.round(t));function zet({loadTiming:t,firstRenderTime:e,operationsCount:n}){const{sendEvent:r}=Ke();b.useEffect(()=>{if(!t)return;const i=performance.now();let s=document.visibilityState==="hidden";const o=()=>{document.visibilityState==="hidden"&&(s=!0)};document.addEventListener("visibilitychange",o);let a;const l=requestAnimationFrame(()=>{a=setTimeout(()=>{if(document.removeEventListener("visibilitychange",o),s)return;const c=performance.now(),{startTime:u,definitionReadyTime:f=u}=t,h=Math.max(ob,f);r("com.redocly.app.loaded",[{...be("app","replayApp"),duration_ms:Jd(c-u),definition_ms:Jd(f-u),chunk_ms:Jd(ob-f),mount_ms:Jd(e-h),init_ms:Jd(i-e),render_ms:Jd(c-i),cold:ob>u,operations_count:n}])},0)});return()=>{cancelAnimationFrame(l),clearTimeout(a),document.removeEventListener("visibilitychange",o)}},[])}class Xet{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 PI{static instance=null;static async initialize(e,n){this.close(),this.instance=await Uet(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function Uet(t,e){if(e){const{AiChatSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-AiChatSqliteDBStorage-DbuX33xq.js")),r=Rm.getInstance(),i=new n(r);return new Xet(i)}else throw new Error("Not implemented")}const Kd="ai-chat",IC="detail",Fet="title",qz="infinite-history",ite={all:()=>[Kd],details:()=>[Kd,IC],detail:t=>[Kd,IC,t],detailTitle:t=>[Kd,IC,t,Fet],infiniteHistories:()=>[Kd,qz],infiniteHistory:t=>[Kd,qz,t]};function qet(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const Wet=2;function Bet(t){const e=JSON.parse(t);let n;return e.version===1?n=qet(e):n=e,n.version!==Wet&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const $C="history.json",Zet="history.json.backup";class Get{static async migrateFromStorage(e,n,r){try{const i=await e.get($C);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const s=Bet(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($C,Zet)}catch{await e.remove($C)}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-D1On4ntI.js")),s=new i(e.systemFilesDir);return this.migrateFromStorage(s,n,"JSON file")}else{const i=new XE(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}const __=t=>d.jsx(Yet,{...t},t.settings.storageKey),Yet=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:s,loadTiming:o,selectedEnvironmentSeq:a})=>{const[l]=b.useState(()=>performance.now()),c=R8(),u=Ke(),f=Pi.useQueryClient(),[h]=b.useState(XI),p=Net(n,r,i),m=b.useRef(e);m.current=e;const g=b.useRef(!1);b.useEffect(()=>(g.current=!1,()=>{g.current=!0}),[]);async function O(){const U=Rn()?await Pet(m.current.storageKey):Cet(m.current.storageKey);if(m.current.layout!=="preview"&&Rn()&&Nm.initialize(),await c.init(U,m.current,h,u),m.current.layout!=="preview"){if(g.current)return;if(Rn()){const j=`${U.systemFilesDir}/replay.db`;await Rm.initialize(j),await PI.initialize(U,Rn())}if(g.current)return;await wc.initialize(U,Rn()),await Qo.initialize(Rn());try{await Qo.getInstance()?.pruneOlderThan(Date.now()-p$e)}catch(j){console.error("Failed to prune step context:",j)}if(g.current)return;try{const j=await Get.migrate(U,wc.getInstance(),Rn());j.migrated&&u.sendEvent("com.redocly.history.migration",[{...be("migration","historyMigration","storage"),status:"success",itemCount:j.itemCount}])}catch(j){console.error("History migration failed:",j),u.sendEvent("com.redocly.history.migration",[{...be("migration","historyMigration","storage"),status:"error",error:j instanceof Error?j.message:"Unknown error"}])}}M(),h.get(si).length===0&&h.set(si,CA),m.current.layout==="preview"&&h.get(Er).length===0&&h.set(Er,[{...EG(),state:xn.Preview}]);function M(){if(!p)return;p.definition.graphql&&ett(h,p.definition.document,p.definition.graphql.sdl);const{convertOperationToReplayValue:j,dynamicReplayValues:L}=m.current,W=Uz(p.kind,p.definition.document,j,p.operation);if(!W)return;const{apiId:q,selectedOperation:B}=W,[K]=String(W.document.info.title).split("/");if(!K||(h.set(Ns,[{id:q,srcType:qi.FS,...W.document}]),h.set(HR,q),!B))return;const{requestOperation:te,path:F,method:H,openApiOperation:J}=B;J&&Wz(h,q,J,m.current),ttt(h,{apiId:q,path:F,method:H,operationId:te.operationId,isAdditionalOperation:te.isAdditionalOperation},J,L)}}const v=b.useRef(void 0),[x,y]=b.useState({status:"pending"}),w=b.useEffectEvent(O);b.useLayoutEffect(()=>{v.current??=w();let U=!0;return v.current.then(()=>U&&y({status:"fulfilled"}),M=>U&&y({status:"rejected",error:M})),()=>{U=!1}},[]),b.useEffect(()=>{if(e.layout!=="preview")return f.invalidateQueries({queryKey:ui.all}),f.invalidateQueries({queryKey:ite.all()}),f.invalidateQueries({queryKey:zO.all}),()=>{wc.close(),PI.close(),Nm.close(),Qo.close(),Rn()&&Rm.close().catch(U=>{console.error("Failed to close SqliteDBConnection:",U)})}},[e.layout,f]),Vet({store:h,selectedEnvironment:e.selectedEnvironment,selectedEnvironmentSeq:a});const S=p?.kind,P=p?.definition.document,k=e.convertOperationToReplayValue,I=p?.operation?.operationId,E=p?.operation?.pointer,Q=b.useMemo(()=>S&&P&&k?Uz(S,P,k,{operationId:I,pointer:E}):null,[S,P,k,I,E]),{predefinedEnvValues:N,dynamicReplayValues:R,gateEnvironments:D,allowedEnvironments:z,selectedEnvironment:X}=e;b.useEffect(()=>{Q?.selectedOperation?.openApiOperation&&Wz(h,Q.apiId,Q.selectedOperation.openApiOperation,{predefinedEnvValues:N,dynamicReplayValues:R,gateEnvironments:D,allowedEnvironments:z,selectedEnvironment:X})},[h,Q,N,R,D,z,X]);const A=e.layout==="preview"?null:d.jsx(uet,{projectPath:e.storageKey});if(x.status==="rejected")throw x.error;return d.jsx(b.Suspense,{fallback:A,children:x.status==="pending"?A:d.jsx(Het,{store:h,settings:e,api:n,onLoad:s,loadTiming:o,firstRenderTime:l,operationsCount:Q?.operationsCount??0,children:t})})};function Het({store:t,children:e,settings:n,api:r,onLoad:i,loadTiming:s,firstRenderTime:o,operationsCount:a}){zet({loadTiming:s,firstRenderTime:o,operationsCount:a});const l=Zie(n,r);return b.useEffect(()=>{i?.()},[]),d.jsx(Mne,{store:t,children:d.jsxs(Jet,{settings:l,apiId:n.apiId,children:[Rn()&&d.jsx(Ket,{}),e]})})}function Jet({settings:t,apiId:e,children:n}){Une([[hg,t],[Ig,e]]);const r=Vo();return b.useEffect(()=>{Om(r.get(hg),t)||r.set(hg,t)},[r,t]),b.useEffect(()=>{r.get(Ig)!==e&&r.set(Ig,e)},[r,e]),d.jsx(d.Fragment,{children:n})}function Ket(){return Tet(),null}const Wz=(t,e,n,r)=>{const i=t.get(si),{environments:s,generatedInputs:o,synthesizedEnvironmentNames:a}=vGe(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues,r.gateEnvironments);Bz(t.get(sx),o)||t.set(sx,o);const{newEnvironments:l,predefinedEnvironmentNames:c,activeEnvName:u}=yGe({envs:s,synthesizedEnvironmentNames:a,existingEnvironments:i,allowedEnvironments:r.allowedEnvironments,selectedEnvironment:r.selectedEnvironment,activeEnvironmentId:t.get(Ao)});Bz(t.get(ix),c)||t.set(ix,c),Om(l,t.get(si))||t.set(si,l),t.set(Ao,u)},Bz=(t,e)=>t.size===e.size&&[...t].every(n=>e.has(n)),ett=(t,e,n)=>{const r=e.info?.title;if(!r)return;let i;try{i=EBe(GBe(n))}catch(s){console.error(`Replay cannot read the GraphQL schema of "${r}".`,s),i={status:"error",error:s instanceof Error?s.message:String(s)}}IBe(t,Q_(e,[]),i)},ttt=(t,e,n,r)=>{const i=t.get(Er).findIndex(({data:s})=>V9(s,e));if(i!==-1){const s=n?.body?.activeExampleName;if(n&&s){const o=_Q(n);M9(t,i,a=>a.draftStep?.requestBody.type===o.type&&a.draftStep.requestBody.activeExampleName!==s?{...a,draftStep:{...a.draftStep,requestBody:o}}:a)}n&&r&&t.set(Er,o=>Vg(o,i,a=>a.draftStep?{...a,draftStep:Iet(a.draftStep,n,r)}:a)),t.set(vs,i)}else{const s=ZQ(e,n,r),o=[...t.get(Er),{...s,state:xn.Normal}];t.set(Er,o),t.set(vs,o.length-1)}},ste=.5,ntt=.01,rtt=({intersectionRatio:t})=>t>=ste-ntt;function itt(t,e){const n=b.useRef(!1);b.useEffect(()=>{const r=t.current;if(!r||n.current)return;const i=new IntersectionObserver(s=>{n.current||s.some(rtt)&&(i.disconnect(),n.current=!0,e())},{threshold:ste});return i.observe(r),()=>{i.disconnect()}},[t,e])}function stt(t){const e=b.useMemo(()=>A8(!0),[]);return d.jsx(Pi.QueryClientProvider,{client:FS(),children:d.jsx(k_,{children:d.jsx(ODe,{value:e,children:d.jsx(Sx.Provider,{value:t.settings,children:d.jsx(__,{...t,selectedEnvironmentSeq:void 0,children:d.jsx(Fee,{onError:n=>console.error(n),children:d.jsx(ott,{})})})})})})})}function ott(){const{sendEvent:t}=Ke(),e=b.useRef(null),n=b.useCallback(()=>{t("com.redocly.app.lifecycle",[{...be("app","replayApp"),action:"open"}])},[t]);return itt(e,n),d.jsx(b.StrictMode,{children:d.jsxs(att,{ref:e,children:[d.jsx(ltt,{children:d.jsx(A_,{})}),d.jsx(dx,{hideTabs:!0}),d.jsx(Wee,{})]})})}const att=T.default.div`
6479
+ `,het="request",pet=new Set(["replay:","redocly-replay:"]),get=8*1024,met=4*1024,TI=1024,Oet=new Set([Hn.JSON,Hn.XML,Hn.HTML,Hn.Text]);function CI(t){return xQ(t).length>0}function vet(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function ete(t,e){return!t||t.length>TI||e.length>TI||CI(e)}function EC(t,e,n){const r=[];for(const[i,s]of t){if(!i.startsWith(e))continue;const o=i.slice(e.length);if(ete(o,s))return null;r.push(vet(n,o,s))}return r}function yet(t){if(t.length>get)return null;let e;try{e=new URL(t)}catch{return null}if(!pet.has(e.protocol)||e.hostname.toLowerCase()!==het)return null;const n=e.searchParams,r=n.get("url");if(!r||CI(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(!Mh.includes(s))return null;const o=EC(n,"header.","header"),a=EC(n,"query.","query"),l=EC(n,"cookie.","cookie");if(!o||!a||!l)return null;const c=IO(r);if(c.some(p=>ete(p.key,p.value)))return null;const u=n.get("body");if(u!==null&&(u.length>met||CI(u)))return null;const f=n.get("contentType")?.trim();if(f&&!Oet.has(f))return null;const h=n.get("env")?.trim();return h&&h.length>TI?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 bet(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function xet({onEnvironmentNotFound:t}={}){const{getTabs:e,setActiveTabIdx:n,updateTabDataAt:r}=cd(),{addNewTab:i}=pr(),s=qa(),o=Kh();return b.useCallback(a=>{const l=e().findIndex(({data:h})=>_n(h,Ue.Step)&&bet(h)&&LE(h,a.xOperation)),c=Th(),u=a.body?{...c,content:a.body.content,...a.body.type&&{type:a.body.type}}:c;let f;if(l!==-1)f=l,n(f);else{const h={...Da({xOperation:a.xOperation}),requestBody:u};f=i({id:crypto.randomUUID(),state:xn.Normal,data:yf({draftStep:h,activeTabName:xu(h)})})}e()[f]&&r(f,h=>{const p={...h,response:null,requestError:null,isProcessingRequest:!1};return p.draftStep?{...p,draftStep:{...p.draftStep,parameters:{...p.draftStep.parameters,headers:a.headers,queryParameters:a.queryParameters,cookies:a.cookies},requestBody:u}}:p}),a.environment&&(s.some(p=>p.name===a.environment)?o(a.environment):t?.(a.environment))},[e,n,r,i,s,o,t])}const wet="com.redocly.deepLink.opened";let zz=!1;function Tet(){const{warning:t}=jI.useToast(),e=Ke(),n=xet({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]&&yet(a[0]);l&&(r.current(l),e.sendEvent(wet,[{...be("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-CgMBbjl1.js")),c=await a(o);if(s){c();return}if(i=c,!zz){const u=await l();if(s)return;zz=!0,u?.[0]&&o(u)}})(),()=>{s=!0,i?.()}},[])}function Cet(t){const e=t||"default";return{id:Fm(cw(e)),systemFilesDir:Dk.join("/replay",e),userFilesDir:Dk.join("/projects",e)}}async function Pet(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=Fm(cw(t)),n=await ket(),r=await qQ(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function ket(){if(!mE)return ME();try{return await ZG()}catch{return ME()}}function hy(t,e){if(e.size===0)return t;let n=t;for(let r=0;r<t.length;r++){const i=t[r];!yO(i)||!i.key||!e.has(i.key)||(n===t&&(n=[...t]),n[r]={...i,value:`$inputs.${i.key}`,active:!0})}return n}function tte(t,e,n){if(typeof e=="string"){const s=no(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=tte(r[s],o,n);a!==r[s]&&(i===r&&(i={...r}),i[s]=a)}return i}function Eet(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=tte(r[s],i,n);o!==r[s]&&(r===t&&(r=[...t]),r[s]=o)}return r}function Iet(t,e,n){const r=EQ(e.parameters,"in"),{pathParameters:i,queryParameters:s,headers:o,cookies:a}=t.parameters;return{...t,parameters:{...t.parameters,pathParameters:hy(i,Vf(r.path,"path",n)),queryParameters:hy(s,sG(r.query,r.querystring,n)),headers:hy(o,Vf(r.header,"header",n)),cookies:hy(a,Vf(r.cookie,"cookie",n))},security:Eet(t.security,TS(e),hGe(e,n))}}function Q_(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)}const nte=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:s}=eR({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===s}return!1}),$et=new Set(["parameters","servers","description","summary","additionalOperations"]);function Aet(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=_et(t,e,n);return{operations:r}}function Qet(t){let e=0;for(const{method:n,tags:r,isAdditionalOperation:i}of R_(t))(i||L9([n]).length>0)&&(e+=r.length);return e}function Ret(t,e,n,r,i){const s=i?eR({operationPath:i,parsedSourceDescriptions:[]}):void 0;for(const o of R_(t)){const{path:a,method:l,operation:c,tags:u}=o,f=!!r&&c.operationId===r,h=s!==void 0&&s.path===a&&s.method===l.toLowerCase();if(!f&&!h)continue;const p=rte(o,t,u[0],e,n);return p&&nte([p.operation],r,i)?p:null}return null}function*R_(t){for(const[e,n]of Object.entries(t.paths??{})){for(const[r,i]of Object.entries(n))$et.has(r)||(yield{path:e,method:r,operation:i,tags:Xz(i),isAdditionalOperation:!1});for(const[r,i]of Object.entries(n.additionalOperations??{}))yield{path:e,method:r,operation:i,tags:Xz(i),isAdditionalOperation:!0}}}function Xz(t){return t.tags&&t.tags.length>0?t.tags:[XC]}function _et(t,e,n){const r=[];for(const i of R_(t))for(const s of i.tags){const o=rte(i,t,s,e,n);o&&r.push(o.operation)}return{operations:r}}function rte({path:t,method:e,isAdditionalOperation:n},r,i,s,o){const a=o?.(t,e,r);if(!a)return null;const l=`${r.info.title}/${i}/${a.name}`;return{operation:MAe(a,n,s,l),openApiOperation:a}}function jet(t){return"kind"in t&&"definition"in t}function Net(t,e,n){if(t)return jet(t)?t:{kind:"openapi",definition:{document:t},operation:Det(e,n)}}function Det(t,e){if(t&&e)return{operationId:t,pointer:e};if(t)return{operationId:t};if(e)return{pointer:e}}function Uz(t,e,n,r){return t==="openapi"?Met(e,n,r):(console.error(`Replay does not support the API kind "${String(t)}".`),null)}function Met(t,e,n){try{const r=Q_(t,[]),i=n?.operationId,s=n?.pointer,o=Ret(t,r,e,i,s);let a;if(o)a=Fz(o.operation,()=>o.openApiOperation);else{const{operations:l}=Aet(t,r,e);if(!l?.length)return null;a=Fz(nte(l,i,s),(c,u)=>e?.(c,u,t))}return{apiId:r,document:t,operationsCount:Qet(t),selectedOperation:a}}catch(r){return console.error("Replay cannot read the OpenAPI document of `api`.",r),null}}function Fz(t,e){const{path:n,method:r}=t?.apiPath??{};return!t||!n||!r?null:{requestOperation:t,path:n,method:r,openApiOperation:e(n,r)}}function Vet({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(Ao,e))},[t,e,n])}let ob=performance.now();function Let(){ob=performance.now()}const Jd=t=>Math.max(0,Math.round(t));function zet({loadTiming:t,firstRenderTime:e,operationsCount:n}){const{sendEvent:r}=Ke();b.useEffect(()=>{if(!t)return;const i=performance.now();let s=document.visibilityState==="hidden";const o=()=>{document.visibilityState==="hidden"&&(s=!0)};document.addEventListener("visibilitychange",o);let a;const l=requestAnimationFrame(()=>{a=setTimeout(()=>{if(document.removeEventListener("visibilitychange",o),s)return;const c=performance.now(),{startTime:u,definitionReadyTime:f=u}=t,h=Math.max(ob,f);r("com.redocly.app.loaded",[{...be("app","replayApp"),duration_ms:Jd(c-u),definition_ms:Jd(f-u),chunk_ms:Jd(ob-f),mount_ms:Jd(e-h),init_ms:Jd(i-e),render_ms:Jd(c-i),cold:ob>u,operations_count:n}])},0)});return()=>{cancelAnimationFrame(l),clearTimeout(a),document.removeEventListener("visibilitychange",o)}},[])}class Xet{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 PI{static instance=null;static async initialize(e,n){this.close(),this.instance=await Uet(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function Uet(t,e){if(e){const{AiChatSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-AiChatSqliteDBStorage-WVrs0IxC.js")),r=Rm.getInstance(),i=new n(r);return new Xet(i)}else throw new Error("Not implemented")}const Kd="ai-chat",IC="detail",Fet="title",qz="infinite-history",ite={all:()=>[Kd],details:()=>[Kd,IC],detail:t=>[Kd,IC,t],detailTitle:t=>[Kd,IC,t,Fet],infiniteHistories:()=>[Kd,qz],infiniteHistory:t=>[Kd,qz,t]};function qet(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const Wet=2;function Bet(t){const e=JSON.parse(t);let n;return e.version===1?n=qet(e):n=e,n.version!==Wet&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const $C="history.json",Zet="history.json.backup";class Get{static async migrateFromStorage(e,n,r){try{const i=await e.get($C);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const s=Bet(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($C,Zet)}catch{await e.remove($C)}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-VW4nQJx3.js")),s=new i(e.systemFilesDir);return this.migrateFromStorage(s,n,"JSON file")}else{const i=new XE(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}const __=t=>d.jsx(Yet,{...t},t.settings.storageKey),Yet=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:s,loadTiming:o,selectedEnvironmentSeq:a})=>{const[l]=b.useState(()=>performance.now()),c=R8(),u=Ke(),f=Pi.useQueryClient(),[h]=b.useState(XI),p=Net(n,r,i),m=b.useRef(e);m.current=e;const g=b.useRef(!1);b.useEffect(()=>(g.current=!1,()=>{g.current=!0}),[]);async function O(){const U=Rn()?await Pet(m.current.storageKey):Cet(m.current.storageKey);if(m.current.layout!=="preview"&&Rn()&&Nm.initialize(),await c.init(U,m.current,h,u),m.current.layout!=="preview"){if(g.current)return;if(Rn()){const j=`${U.systemFilesDir}/replay.db`;await Rm.initialize(j),await PI.initialize(U,Rn())}if(g.current)return;await wc.initialize(U,Rn()),await Qo.initialize(Rn());try{await Qo.getInstance()?.pruneOlderThan(Date.now()-p$e)}catch(j){console.error("Failed to prune step context:",j)}if(g.current)return;try{const j=await Get.migrate(U,wc.getInstance(),Rn());j.migrated&&u.sendEvent("com.redocly.history.migration",[{...be("migration","historyMigration","storage"),status:"success",itemCount:j.itemCount}])}catch(j){console.error("History migration failed:",j),u.sendEvent("com.redocly.history.migration",[{...be("migration","historyMigration","storage"),status:"error",error:j instanceof Error?j.message:"Unknown error"}])}}M(),h.get(si).length===0&&h.set(si,CA),m.current.layout==="preview"&&h.get(Er).length===0&&h.set(Er,[{...EG(),state:xn.Preview}]);function M(){if(!p)return;p.definition.graphql&&ett(h,p.definition.document,p.definition.graphql.sdl);const{convertOperationToReplayValue:j,dynamicReplayValues:L}=m.current,W=Uz(p.kind,p.definition.document,j,p.operation);if(!W)return;const{apiId:q,selectedOperation:B}=W,[K]=String(W.document.info.title).split("/");if(!K||(h.set(Ns,[{id:q,srcType:qi.FS,...W.document}]),h.set(HR,q),!B))return;const{requestOperation:te,path:F,method:H,openApiOperation:J}=B;J&&Wz(h,q,J,m.current),ttt(h,{apiId:q,path:F,method:H,operationId:te.operationId,isAdditionalOperation:te.isAdditionalOperation},J,L)}}const v=b.useRef(void 0),[x,y]=b.useState({status:"pending"}),w=b.useEffectEvent(O);b.useLayoutEffect(()=>{v.current??=w();let U=!0;return v.current.then(()=>U&&y({status:"fulfilled"}),M=>U&&y({status:"rejected",error:M})),()=>{U=!1}},[]),b.useEffect(()=>{if(e.layout!=="preview")return f.invalidateQueries({queryKey:ui.all}),f.invalidateQueries({queryKey:ite.all()}),f.invalidateQueries({queryKey:zO.all}),()=>{wc.close(),PI.close(),Nm.close(),Qo.close(),Rn()&&Rm.close().catch(U=>{console.error("Failed to close SqliteDBConnection:",U)})}},[e.layout,f]),Vet({store:h,selectedEnvironment:e.selectedEnvironment,selectedEnvironmentSeq:a});const S=p?.kind,P=p?.definition.document,k=e.convertOperationToReplayValue,I=p?.operation?.operationId,E=p?.operation?.pointer,Q=b.useMemo(()=>S&&P&&k?Uz(S,P,k,{operationId:I,pointer:E}):null,[S,P,k,I,E]),{predefinedEnvValues:N,dynamicReplayValues:R,gateEnvironments:D,allowedEnvironments:z,selectedEnvironment:X}=e;b.useEffect(()=>{Q?.selectedOperation?.openApiOperation&&Wz(h,Q.apiId,Q.selectedOperation.openApiOperation,{predefinedEnvValues:N,dynamicReplayValues:R,gateEnvironments:D,allowedEnvironments:z,selectedEnvironment:X})},[h,Q,N,R,D,z,X]);const A=e.layout==="preview"?null:d.jsx(uet,{projectPath:e.storageKey});if(x.status==="rejected")throw x.error;return d.jsx(b.Suspense,{fallback:A,children:x.status==="pending"?A:d.jsx(Het,{store:h,settings:e,api:n,onLoad:s,loadTiming:o,firstRenderTime:l,operationsCount:Q?.operationsCount??0,children:t})})};function Het({store:t,children:e,settings:n,api:r,onLoad:i,loadTiming:s,firstRenderTime:o,operationsCount:a}){zet({loadTiming:s,firstRenderTime:o,operationsCount:a});const l=Zie(n,r);return b.useEffect(()=>{i?.()},[]),d.jsx(Mne,{store:t,children:d.jsxs(Jet,{settings:l,apiId:n.apiId,children:[Rn()&&d.jsx(Ket,{}),e]})})}function Jet({settings:t,apiId:e,children:n}){Une([[hg,t],[Ig,e]]);const r=Vo();return b.useEffect(()=>{Om(r.get(hg),t)||r.set(hg,t)},[r,t]),b.useEffect(()=>{r.get(Ig)!==e&&r.set(Ig,e)},[r,e]),d.jsx(d.Fragment,{children:n})}function Ket(){return Tet(),null}const Wz=(t,e,n,r)=>{const i=t.get(si),{environments:s,generatedInputs:o,synthesizedEnvironmentNames:a}=vGe(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues,r.gateEnvironments);Bz(t.get(sx),o)||t.set(sx,o);const{newEnvironments:l,predefinedEnvironmentNames:c,activeEnvName:u}=yGe({envs:s,synthesizedEnvironmentNames:a,existingEnvironments:i,allowedEnvironments:r.allowedEnvironments,selectedEnvironment:r.selectedEnvironment,activeEnvironmentId:t.get(Ao)});Bz(t.get(ix),c)||t.set(ix,c),Om(l,t.get(si))||t.set(si,l),t.set(Ao,u)},Bz=(t,e)=>t.size===e.size&&[...t].every(n=>e.has(n)),ett=(t,e,n)=>{const r=e.info?.title;if(!r)return;let i;try{i=EBe(GBe(n))}catch(s){console.error(`Replay cannot read the GraphQL schema of "${r}".`,s),i={status:"error",error:s instanceof Error?s.message:String(s)}}IBe(t,Q_(e,[]),i)},ttt=(t,e,n,r)=>{const i=t.get(Er).findIndex(({data:s})=>V9(s,e));if(i!==-1){const s=n?.body?.activeExampleName;if(n&&s){const o=_Q(n);M9(t,i,a=>a.draftStep?.requestBody.type===o.type&&a.draftStep.requestBody.activeExampleName!==s?{...a,draftStep:{...a.draftStep,requestBody:o}}:a)}n&&r&&t.set(Er,o=>Vg(o,i,a=>a.draftStep?{...a,draftStep:Iet(a.draftStep,n,r)}:a)),t.set(vs,i)}else{const s=ZQ(e,n,r),o=[...t.get(Er),{...s,state:xn.Normal}];t.set(Er,o),t.set(vs,o.length-1)}},ste=.5,ntt=.01,rtt=({intersectionRatio:t})=>t>=ste-ntt;function itt(t,e){const n=b.useRef(!1);b.useEffect(()=>{const r=t.current;if(!r||n.current)return;const i=new IntersectionObserver(s=>{n.current||s.some(rtt)&&(i.disconnect(),n.current=!0,e())},{threshold:ste});return i.observe(r),()=>{i.disconnect()}},[t,e])}function stt(t){const e=b.useMemo(()=>A8(!0),[]);return d.jsx(Pi.QueryClientProvider,{client:FS(),children:d.jsx(k_,{children:d.jsx(ODe,{value:e,children:d.jsx(Sx.Provider,{value:t.settings,children:d.jsx(__,{...t,selectedEnvironmentSeq:void 0,children:d.jsx(Fee,{onError:n=>console.error(n),children:d.jsx(ott,{})})})})})})})}function ott(){const{sendEvent:t}=Ke(),e=b.useRef(null),n=b.useCallback(()=>{t("com.redocly.app.lifecycle",[{...be("app","replayApp"),action:"open"}])},[t]);return itt(e,n),d.jsx(b.StrictMode,{children:d.jsxs(att,{ref:e,children:[d.jsx(ltt,{children:d.jsx(A_,{})}),d.jsx(dx,{hideTabs:!0}),d.jsx(Wee,{})]})})}const att=T.default.div`
6480
6480
  display: flex;
6481
6481
  flex-direction: column;
6482
6482
  height: 100%;
@@ -6866,7 +6866,7 @@ ${u.join(`\r
6866
6866
  `,Ont=T.default.div`
6867
6867
  display: flex;
6868
6868
  gap: var(--spacing-xs);
6869
- `;async function D_(t,e,n){try{const{join:r,dirname:i}=await Promise.resolve().then(()=>BQ),{exists:s}=await Promise.resolve().then(()=>$O),{revealItemInDir:o,openPath:a}=await Promise.resolve().then(()=>require("./replay-index-COk-TAX_.js")),l=await r(t,e);if(n||!await s(l)){const c=await i(l);await a(c);return}await o(l)}catch(r){throw console.error("Failed to reveal item in folder:",r),r}}function vnt({node:t}){const e=t.data.type==="api"&&t.data.api.srcType===qi.WEB,n=Od(),r=b.useMemo(()=>Rn(),[]),{sendEvent:i}=Ke();if(e)return null;const s=()=>{t.tree.delete(t.id)},o=async()=>{try{if(t.data.type==="api"){const a=t.data.api.id,l=n.userFilesDir;await D_(l,a),i("com.redocly.node.management",[{...be("api","apiNode"),action:"reveal_in_folder",node_type:"api",name:a}])}}catch(a){console.error("Failed to reveal API in folder:",a)}};return d.jsx(ynt,{onClick:a=>a.stopPropagation(),children:d.jsx(Xn,{content:"More actions",placement:"topRight",children:d.jsx(Gi.Dropdown,{trigger:d.jsx(ye.Button,{variant:"text",size:"small",icon:d.jsx(Rh.OverflowMenuVerticalIcon,{})}),alignment:"end",children:d.jsxs(Yi.DropdownMenu,{children:[r&&d.jsxs(br,{onClick:o,children:[d.jsx(VI.FolderIcon,{size:"14px"}),"Reveal in folder"]}),d.jsxs(br,{onClick:s,children:[d.jsx(rr.TrashCanIcon,{size:"14px"}),"Delete"]})]})})})})}const ynt=T.default.div`
6869
+ `;async function D_(t,e,n){try{const{join:r,dirname:i}=await Promise.resolve().then(()=>BQ),{exists:s}=await Promise.resolve().then(()=>$O),{revealItemInDir:o,openPath:a}=await Promise.resolve().then(()=>require("./replay-index-eMgUixYk.js")),l=await r(t,e);if(n||!await s(l)){const c=await i(l);await a(c);return}await o(l)}catch(r){throw console.error("Failed to reveal item in folder:",r),r}}function vnt({node:t}){const e=t.data.type==="api"&&t.data.api.srcType===qi.WEB,n=Od(),r=b.useMemo(()=>Rn(),[]),{sendEvent:i}=Ke();if(e)return null;const s=()=>{t.tree.delete(t.id)},o=async()=>{try{if(t.data.type==="api"){const a=t.data.api.id,l=n.userFilesDir;await D_(l,a),i("com.redocly.node.management",[{...be("api","apiNode"),action:"reveal_in_folder",node_type:"api",name:a}])}}catch(a){console.error("Failed to reveal API in folder:",a)}};return d.jsx(ynt,{onClick:a=>a.stopPropagation(),children:d.jsx(Xn,{content:"More actions",placement:"topRight",children:d.jsx(Gi.Dropdown,{trigger:d.jsx(ye.Button,{variant:"text",size:"small",icon:d.jsx(Rh.OverflowMenuVerticalIcon,{})}),alignment:"end",children:d.jsxs(Yi.DropdownMenu,{children:[r&&d.jsxs(br,{onClick:o,children:[d.jsx(VI.FolderIcon,{size:"14px"}),"Reveal in folder"]}),d.jsxs(br,{onClick:s,children:[d.jsx(rr.TrashCanIcon,{size:"14px"}),"Delete"]})]})})})})}const ynt=T.default.div`
6870
6870
  display: flex;
6871
6871
  gap: var(--spacing-xxs);
6872
6872
  `;function bnt({onImport:t}){return d.jsxs(xnt,{children:[d.jsx(Snt,{children:"No OpenAPI files were imported yet"}),d.jsx(wnt,{children:d.jsx(ye.Button,{icon:d.jsx(DI.DownloadIcon,{}),onClick:t,children:"Import OpenAPI file"})})]})}const xnt=T.default.div`
@@ -7240,7 +7240,7 @@ ${u.join(`\r
7240
7240
  gap: var(--spacing-sm);
7241
7241
  flex: 1;
7242
7242
  justify-content: flex-end;
7243
- `;function hit({children:t}){const[e,n]=b.useState(new Set),r=b.useCallback(o=>{n(a=>{const l=new Set(a);return l.add(o),l})},[]),i=b.useCallback(o=>{n(a=>{const l=new Set(a);return l.delete(o),l})},[]),s=b.useMemo(()=>({hasActiveOverlay:e.size>0,registerOverlay:r,unregisterOverlay:i}),[e.size,r,i]);return d.jsx(LI.Provider,{value:s,children:t})}function pit({children:t,renderProjectSelect:e}){return d.jsx(ote.Provider,{value:{renderProjectSelect:e},children:t})}function git({error:t}){const{userFilesDir:e}=Od(),n=b.useCallback(async()=>{try{const{openPath:r}=await Promise.resolve().then(()=>require("./replay-index-COk-TAX_.js")),i=await sn.join(e,t.filePath);await r(i)}catch(r){console.error(`Failed to open ${t.filePath}:`,r)}},[e,t.filePath]);return d.jsx(mit,{"data-testid":"replay-config-error",children:d.jsxs(Oit,{children:[d.jsx(Sl.WarningFilledIcon,{size:"24px",color:"--color-warning-base"}),d.jsxs(vit,{children:[d.jsxs(yit,{children:["Replay cannot use ",t.filePath]}),d.jsx(bit,{children:"Replay keeps its environments in the replay section of this file. Until this is resolved it will not change the file, so the rest of your project configuration stays intact."}),t.issues.length>0&&d.jsx(xit,{"data-testid":"replay-config-error-issues",children:t.issues.map((r,i)=>d.jsxs(Sit,{children:[r.line!==void 0&&d.jsxs(wit,{children:["Line ",r.line]}),d.jsx(Tit,{children:r.message})]},`${r.line??"unknown"}-${i}`))}),d.jsx(ye.Button,{"data-testid":"replay-config-error-open",variant:"secondary",size:"small",icon:d.jsx(Nr.EditIcon,{}),iconPosition:"left",onClick:n,children:"Open in editor"}),d.jsx(Cit,{children:"Replay picks up the fix as soon as you save."})]})]})})}const mit=T.default.div`
7243
+ `;function hit({children:t}){const[e,n]=b.useState(new Set),r=b.useCallback(o=>{n(a=>{const l=new Set(a);return l.add(o),l})},[]),i=b.useCallback(o=>{n(a=>{const l=new Set(a);return l.delete(o),l})},[]),s=b.useMemo(()=>({hasActiveOverlay:e.size>0,registerOverlay:r,unregisterOverlay:i}),[e.size,r,i]);return d.jsx(LI.Provider,{value:s,children:t})}function pit({children:t,renderProjectSelect:e}){return d.jsx(ote.Provider,{value:{renderProjectSelect:e},children:t})}function git({error:t}){const{userFilesDir:e}=Od(),n=b.useCallback(async()=>{try{const{openPath:r}=await Promise.resolve().then(()=>require("./replay-index-eMgUixYk.js")),i=await sn.join(e,t.filePath);await r(i)}catch(r){console.error(`Failed to open ${t.filePath}:`,r)}},[e,t.filePath]);return d.jsx(mit,{"data-testid":"replay-config-error",children:d.jsxs(Oit,{children:[d.jsx(Sl.WarningFilledIcon,{size:"24px",color:"--color-warning-base"}),d.jsxs(vit,{children:[d.jsxs(yit,{children:["Replay cannot use ",t.filePath]}),d.jsx(bit,{children:"Replay keeps its environments in the replay section of this file. Until this is resolved it will not change the file, so the rest of your project configuration stays intact."}),t.issues.length>0&&d.jsx(xit,{"data-testid":"replay-config-error-issues",children:t.issues.map((r,i)=>d.jsxs(Sit,{children:[r.line!==void 0&&d.jsxs(wit,{children:["Line ",r.line]}),d.jsx(Tit,{children:r.message})]},`${r.line??"unknown"}-${i}`))}),d.jsx(ye.Button,{"data-testid":"replay-config-error-open",variant:"secondary",size:"small",icon:d.jsx(Nr.EditIcon,{}),iconPosition:"left",onClick:n,children:"Open in editor"}),d.jsx(Cit,{children:"Replay picks up the fix as soon as you save."})]})]})})}const mit=T.default.div`
7244
7244
  display: flex;
7245
7245
  flex: 1;
7246
7246
  justify-content: center;
@@ -7360,7 +7360,7 @@ ${u.join(`\r
7360
7360
  border-right: ${({$isOverlayLayout:t})=>t?"1px solid var(--border-color-secondary)":"none"};
7361
7361
  width: 100%;
7362
7362
  user-select: none;
7363
- `;function i9({children:t}){const e=Jh(),{sendEvent:n}=Ke(),{tabsParams:r}=yw(e,!1),[i,s]=b.useState(r[0]?.key||null),o=b.useCallback(l=>{s(l),n("com.redocly.tab.change",[{...be("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a=b.useMemo(()=>({tabsParams:r,activeTab:i,onTabChange:o}),[r,i,o]);return d.jsx(Ote.Provider,{value:a,children:t})}const Ait={content:24,main:44,ai:27},Qit=[{fromWidth:1920,minSizes:{content:19,main:40,ai:16}},{fromWidth:1512,minSizes:{content:24,main:40,ai:20}},{fromWidth:1280,minSizes:{content:28,main:40,ai:24}}];function s9(t){return Qit.find(({fromWidth:e})=>t>=e)?.minSizes??Ait}function Rit(t,e){const n=e.mainMinSize??t.main,r=e.hasAiPanel?t.ai:0;return{content:{minSize:t.content,maxSize:100-n-r},main:{minSize:n},ai:{minSize:t.ai,maxSize:100-n-t.content}}}function _it({hasAiPanel:t,mainMinSize:e}){const[n,r]=b.useState(()=>s9(document.documentElement.clientWidth));return b.useEffect(()=>{const i=()=>{r(s9(document.documentElement.clientWidth))};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),b.useMemo(()=>Rit(n,{hasAiPanel:t,mainMinSize:e}),[n,t,e])}function EI(t){const e=t.parentElement;return e?[...e.children].filter(n=>n instanceof HTMLElement&&n.hasAttribute("data-panel-id")):[]}function yte(t){return EI(t).reduce((e,n)=>e+n.getBoundingClientRect().width,0)/100}const Dg={LEFT:"left",RIGHT:"right"};function jit(t,e,n,r,i){const s=Math.max(0,r-i),o=t+s,a=Math.min(n,o);return Math.max(e,a)}function Nit(t,e,n){const r=n/2,i=t.left+r,s=t.right-r;return e===Dg.LEFT?i:s}function Dit(t,e,n){const r=n<t,i=n>t;return e===Dg.LEFT?r:i}const Mit="cubic-bezier(0, 0, 0.2, 1)",o9=80;function M_(t){return parseFloat(getComputedStyle(t).transitionDuration)*1e3}function Vit(t){return t.flatMap(e=>typeof e.getAnimations=="function"?e.getAnimations():[])}function Lit(t,e){const n=t.map(s=>parseFloat(getComputedStyle(s).flexGrow)),r=t[0]?M_(t[0]):0,i=r>0&&typeof t[0].animate=="function";return e&&xte(e),i?{startSizes:n,animations:t.map((s,o)=>s.animate([{flexGrow:`${n[o]}`},{flexGrow:`${n[o]}`}],{duration:r,easing:Mit}))}:null}function zit({animations:t,startSizes:e},n){t.forEach((r,i)=>{const s=r.effect,o=n[i];!(r.playState==="running")||!s||o===void 0||s.setKeyframes([{flexGrow:`${e[i]}`},{flexGrow:`${o}`}])})}function bte(t){t.forEach(e=>{const{endTime:n,localTime:r}=e.effect?.getComputedTiming()??{},i=(Number(n??0)-Number(r??0))/e.playbackRate,s=e.playState==="running",o=i>o9;s&&o&&e.updatePlaybackRate(e.playbackRate*(i/o9))})}function Xit({animations:t}){bte(t)}function xte({animations:t}){t.forEach(e=>e.cancel())}const Uit=4;function Fit(){const t=b.useRef(null),e=b.useRef(null),n=()=>{window.clearTimeout(e.current?.timer),e.current?.moveListener.abort(),e.current=null};b.useEffect(()=>()=>{t.current?.moveListener.abort(),window.clearTimeout(e.current?.timer),e.current?.moveListener.abort()},[]);const r=l=>{const c=t.current;if(!c?.at)return;Math.hypot(l.clientX-c.at.x,l.clientY-c.at.y)>Uit&&(c.hasMoved=!0)};return{start:()=>{t.current?.moveListener.abort(),n();const l={at:null,hasMoved:!1,moveListener:new AbortController};t.current=l,window.addEventListener("pointermove",r,{signal:l.moveListener.signal})},finish:()=>{const l=t.current;return t.current=null,l?.moveListener.abort(),!l||l.hasMoved?null:l.at},resetCursorAfter:(l,c)=>{n();let u=l;const f=new AbortController;window.addEventListener("pointermove",p=>{u={x:p.clientX,y:p.clientY}},{capture:!0,passive:!0,signal:f.signal});const h=window.setTimeout(()=>{f.abort(),document.body.dispatchEvent(new PointerEvent("pointermove",{clientX:u.x,clientY:u.y,isPrimary:!0}))},c);e.current={timer:h,moveListener:f}},onPointerDownCapture:l=>{const c=t.current;c&&(c.at={x:l.clientX,y:l.clientY})}}}function qit(){const t=b.useRef(null);return b.useEffect(()=>()=>{t.current&&xte(t.current)},[]),b.useMemo(()=>({freeze:e=>{t.current=Lit(e,t.current)},slideTo:e=>{t.current&&zit(t.current,e)},finishFast:()=>{t.current&&Xit(t.current)},finishAllFast:e=>{bte(Vit(e))}}),[])}const Wit=50,Zf={OPEN:"open",CLOSED:"closed"},Bit={collapsible:!0,minSize:0,maxSize:0,defaultSize:void 0};function Zit(t){const{panel:e,element:n,foldsTo:r,minSize:i,maxSize:s,neighbourSize:o,neighbourMinSize:a}=t,l=e.getSize(),c=l===0,u=i*yte(n);return{phase:c?Zf.CLOSED:Zf.OPEN,openBounds:{collapsible:!1,minSize:i,maxSize:jit(l,i,s,o,a),defaultSize:void 0},foldLineX:Nit(n.getBoundingClientRect(),r,u),sizeAfterSnap:null,moveListener:new AbortController}}function a9(t){return t.phase===Zf.CLOSED?Bit:t.openBounds}function l9({groupRef:t,foldsTo:e,minSize:n,maxSize:r,neighbour:i,initiallyCollapsed:s=!1,onCollapse:o,onExpand:a}){const l=wR(s,{onCollapse:o,onExpand:a}),c=qit(),u=Fit(),[f,h]=b.useState(null),[p,m]=b.useState(!1),g=b.useRef(null),O=l.panelProps.ref;b.useEffect(()=>()=>g.current?.moveListener.abort(),[]);const v=()=>{const E=O.current;return E?document.getElementById(E.getId()):null},x=(E,Q)=>{h(E),m(Q)},y=(E,Q)=>{l.panelProps.onResize(E,Q);const N=g.current;if(!N)return;c.slideTo(t.current?.getLayout()??[]),N.sizeAfterSnap!==null&&E!==N.sizeAfterSnap&&(N.sizeAfterSnap=null,c.finishFast(),m(!0))},w=(E,Q)=>{const N=v(),R=O.current;!N||!R||(c.freeze(EI(N)),E.phase=Q,E.sizeAfterSnap=null,Ms.flushSync(()=>x(a9(E),!1)),E.sizeAfterSnap=R.getSize())},S=E=>{const Q=g.current;if(!Q)return;const R=Dit(Q.foldLineX,e,E.clientX)?Zf.CLOSED:Zf.OPEN;R!==Q.phase&&w(Q,R)},P=()=>{const E=O.current,Q=v(),N=i.ref.current?.getSize();if(!E||!Q||N===void 0)return;c.finishAllFast(EI(Q)),u.start();const R=Zit({panel:E,element:Q,foldsTo:e,minSize:n,maxSize:r,neighbourSize:N,neighbourMinSize:i.minSize});g.current=R,window.addEventListener("pointermove",S,{signal:R.moveListener.signal}),x(a9(R),!0)},k=(E,Q)=>{const N=O.current,R=v();!N||!R||(E.phase===Zf.CLOSED?N.expand():N.collapse(),u.resetCursorAfter(Q,M_(R)+Wit))},I=()=>{const E=g.current;if(!E)return;g.current=null,E.moveListener.abort();const Q=u.finish();Ms.flushSync(()=>x(null,!1)),Q&&k(E,Q)};return{panel:l.panel,isDragging:f!==null,isFollowingCursor:p,panelProps:{...l.panelProps,onResize:y,...f??{minSize:n,maxSize:r}},handleProps:{onDragging:E=>E?P():I(),onPointerDownCapture:u.onPointerDownCapture}}}const Git=50;function c9({panelRef:t,isCollapsed:e,isFollowingCursor:n}){const[r,i]=b.useState(void 0),s=b.useRef(e);return b.useLayoutEffect(()=>{if(e===s.current)return;s.current=e;const o=t.current,a=o&&document.getElementById(o.getId());if(!o||!a)return;const l=a.getBoundingClientRect().width,c=o.getSize()*yte(a);i(Math.round(e?l:Math.max(l,c)));const u=M_(a)+Git,f=setTimeout(()=>i(void 0),u);return()=>clearTimeout(f)},[e,t]),b.useLayoutEffect(()=>{n&&i(void 0)},[n]),r}const Yit={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},Ste=b.createContext(Yit);function wte(){return b.useContext(Ste)}const Hit=b.lazy(()=>Promise.resolve().then(()=>require("./replay-AiPanel-DmxeL5Rf.js")).then(t=>({default:t.AiPanel}))),Jit=55,Kit=30,est=25;function tst(){const{layout:t,aiEnabled:e}=Fn(),n=e===!0,r=t==="overlay",i=_it({hasAiPanel:n&&!r,mainMinSize:r?Jit:void 0}),{isOpen:s,openPanel:o,closePanel:a}=wte(),l=b.useRef(null),c=b.useRef(null),u={ref:c,minSize:i.main.minSize},f=l9({groupRef:l,foldsTo:r?Dg.RIGHT:Dg.LEFT,minSize:i.content.minSize,maxSize:i.content.maxSize,neighbour:u}),h=l9({groupRef:l,foldsTo:Dg.RIGHT,minSize:i.ai.minSize,maxSize:i.ai.maxSize,neighbour:u,initiallyCollapsed:!s,onCollapse:a,onExpand:o}),p=Math.min(Kit,i.content.maxSize),m=n&&!r&&s?Math.max(i.ai.minSize,Math.min(est,i.ai.maxSize)):0,g=100-p-m,O=c9({panelRef:f.panelProps.ref,isCollapsed:f.panel.isCollapsed,isFollowingCursor:f.isFollowingCursor}),v=c9({panelRef:h.panelProps.ref,isCollapsed:h.panel.isCollapsed,isFollowingCursor:h.isFollowingCursor}),x=b.useMemo(()=>d.jsx(dx,{}),[]),y=b.useMemo(()=>d.jsx(Iit,{isOverlayLayout:r}),[r]),w=b.useMemo(()=>d.jsx(b.Suspense,{fallback:null,children:d.jsx(Hit,{})}),[]);if(b.useEffect(()=>{s&&h.panel.isCollapsed&&h.panel.expand(),!s&&!h.panel.isCollapsed&&h.panel.collapse()},[h.panel,s]),t==="preview")return d.jsx(dx,{hideTabs:!0});const S=f.isDragging||h.isDragging;return r?d.jsx(i9,{children:d.jsxs(u9,{children:[d.jsxs(d9,{direction:"horizontal",autoSaveId:"replay-layout-overlay",ref:l,"data-dragging":S||void 0,children:[d.jsx(lf,{id:"main-panel",ref:c,defaultSize:g,minSize:i.main.minSize,children:x}),d.jsx(qf,{direction:"vertical",tip:d.jsx(bC,{isCollapsed:f.panel.isCollapsed}),tipPlacement:"left",...f.handleProps}),d.jsx(lf,{id:"content-panel",defaultSize:p,$pinnedWidth:O,$pinTo:"left",...f.panelProps,children:y})]}),d.jsx(n9,{panel:f.panel,isOverlayLayout:r})]})}):d.jsx(i9,{children:d.jsxs(u9,{children:[d.jsx(n9,{panel:f.panel,isOverlayLayout:r}),d.jsxs(d9,{direction:"horizontal",autoSaveId:"replay-layout",ref:l,"data-dragging":S||void 0,children:[d.jsx(lf,{id:"content-panel",defaultSize:p,$pinnedWidth:O,$pinTo:"right",...f.panelProps,children:y}),d.jsx(qf,{direction:"vertical",tip:d.jsx(bC,{isCollapsed:f.panel.isCollapsed}),...f.handleProps}),d.jsx(lf,{id:"main-panel",ref:c,defaultSize:g,minSize:i.main.minSize,children:x}),n&&d.jsxs(d.Fragment,{children:[(!h.panel.isCollapsed||h.isDragging)&&d.jsx(qf,{direction:"vertical",tip:d.jsx(bC,{isCollapsed:!1}),tipPlacement:"left",...h.handleProps}),d.jsx(lf,{id:"ai-panel",defaultSize:m,$pinnedWidth:v,$pinTo:"left",collapsedSize:0,...h.panelProps,children:w})]})]})]})})}const lf=T.default(Ju)`
7363
+ `;function i9({children:t}){const e=Jh(),{sendEvent:n}=Ke(),{tabsParams:r}=yw(e,!1),[i,s]=b.useState(r[0]?.key||null),o=b.useCallback(l=>{s(l),n("com.redocly.tab.change",[{...be("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a=b.useMemo(()=>({tabsParams:r,activeTab:i,onTabChange:o}),[r,i,o]);return d.jsx(Ote.Provider,{value:a,children:t})}const Ait={content:24,main:44,ai:27},Qit=[{fromWidth:1920,minSizes:{content:19,main:40,ai:16}},{fromWidth:1512,minSizes:{content:24,main:40,ai:20}},{fromWidth:1280,minSizes:{content:28,main:40,ai:24}}];function s9(t){return Qit.find(({fromWidth:e})=>t>=e)?.minSizes??Ait}function Rit(t,e){const n=e.mainMinSize??t.main,r=e.hasAiPanel?t.ai:0;return{content:{minSize:t.content,maxSize:100-n-r},main:{minSize:n},ai:{minSize:t.ai,maxSize:100-n-t.content}}}function _it({hasAiPanel:t,mainMinSize:e}){const[n,r]=b.useState(()=>s9(document.documentElement.clientWidth));return b.useEffect(()=>{const i=()=>{r(s9(document.documentElement.clientWidth))};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),b.useMemo(()=>Rit(n,{hasAiPanel:t,mainMinSize:e}),[n,t,e])}function EI(t){const e=t.parentElement;return e?[...e.children].filter(n=>n instanceof HTMLElement&&n.hasAttribute("data-panel-id")):[]}function yte(t){return EI(t).reduce((e,n)=>e+n.getBoundingClientRect().width,0)/100}const Dg={LEFT:"left",RIGHT:"right"};function jit(t,e,n,r,i){const s=Math.max(0,r-i),o=t+s,a=Math.min(n,o);return Math.max(e,a)}function Nit(t,e,n){const r=n/2,i=t.left+r,s=t.right-r;return e===Dg.LEFT?i:s}function Dit(t,e,n){const r=n<t,i=n>t;return e===Dg.LEFT?r:i}const Mit="cubic-bezier(0, 0, 0.2, 1)",o9=80;function M_(t){return parseFloat(getComputedStyle(t).transitionDuration)*1e3}function Vit(t){return t.flatMap(e=>typeof e.getAnimations=="function"?e.getAnimations():[])}function Lit(t,e){const n=t.map(s=>parseFloat(getComputedStyle(s).flexGrow)),r=t[0]?M_(t[0]):0,i=r>0&&typeof t[0].animate=="function";return e&&xte(e),i?{startSizes:n,animations:t.map((s,o)=>s.animate([{flexGrow:`${n[o]}`},{flexGrow:`${n[o]}`}],{duration:r,easing:Mit}))}:null}function zit({animations:t,startSizes:e},n){t.forEach((r,i)=>{const s=r.effect,o=n[i];!(r.playState==="running")||!s||o===void 0||s.setKeyframes([{flexGrow:`${e[i]}`},{flexGrow:`${o}`}])})}function bte(t){t.forEach(e=>{const{endTime:n,localTime:r}=e.effect?.getComputedTiming()??{},i=(Number(n??0)-Number(r??0))/e.playbackRate,s=e.playState==="running",o=i>o9;s&&o&&e.updatePlaybackRate(e.playbackRate*(i/o9))})}function Xit({animations:t}){bte(t)}function xte({animations:t}){t.forEach(e=>e.cancel())}const Uit=4;function Fit(){const t=b.useRef(null),e=b.useRef(null),n=()=>{window.clearTimeout(e.current?.timer),e.current?.moveListener.abort(),e.current=null};b.useEffect(()=>()=>{t.current?.moveListener.abort(),window.clearTimeout(e.current?.timer),e.current?.moveListener.abort()},[]);const r=l=>{const c=t.current;if(!c?.at)return;Math.hypot(l.clientX-c.at.x,l.clientY-c.at.y)>Uit&&(c.hasMoved=!0)};return{start:()=>{t.current?.moveListener.abort(),n();const l={at:null,hasMoved:!1,moveListener:new AbortController};t.current=l,window.addEventListener("pointermove",r,{signal:l.moveListener.signal})},finish:()=>{const l=t.current;return t.current=null,l?.moveListener.abort(),!l||l.hasMoved?null:l.at},resetCursorAfter:(l,c)=>{n();let u=l;const f=new AbortController;window.addEventListener("pointermove",p=>{u={x:p.clientX,y:p.clientY}},{capture:!0,passive:!0,signal:f.signal});const h=window.setTimeout(()=>{f.abort(),document.body.dispatchEvent(new PointerEvent("pointermove",{clientX:u.x,clientY:u.y,isPrimary:!0}))},c);e.current={timer:h,moveListener:f}},onPointerDownCapture:l=>{const c=t.current;c&&(c.at={x:l.clientX,y:l.clientY})}}}function qit(){const t=b.useRef(null);return b.useEffect(()=>()=>{t.current&&xte(t.current)},[]),b.useMemo(()=>({freeze:e=>{t.current=Lit(e,t.current)},slideTo:e=>{t.current&&zit(t.current,e)},finishFast:()=>{t.current&&Xit(t.current)},finishAllFast:e=>{bte(Vit(e))}}),[])}const Wit=50,Zf={OPEN:"open",CLOSED:"closed"},Bit={collapsible:!0,minSize:0,maxSize:0,defaultSize:void 0};function Zit(t){const{panel:e,element:n,foldsTo:r,minSize:i,maxSize:s,neighbourSize:o,neighbourMinSize:a}=t,l=e.getSize(),c=l===0,u=i*yte(n);return{phase:c?Zf.CLOSED:Zf.OPEN,openBounds:{collapsible:!1,minSize:i,maxSize:jit(l,i,s,o,a),defaultSize:void 0},foldLineX:Nit(n.getBoundingClientRect(),r,u),sizeAfterSnap:null,moveListener:new AbortController}}function a9(t){return t.phase===Zf.CLOSED?Bit:t.openBounds}function l9({groupRef:t,foldsTo:e,minSize:n,maxSize:r,neighbour:i,initiallyCollapsed:s=!1,onCollapse:o,onExpand:a}){const l=wR(s,{onCollapse:o,onExpand:a}),c=qit(),u=Fit(),[f,h]=b.useState(null),[p,m]=b.useState(!1),g=b.useRef(null),O=l.panelProps.ref;b.useEffect(()=>()=>g.current?.moveListener.abort(),[]);const v=()=>{const E=O.current;return E?document.getElementById(E.getId()):null},x=(E,Q)=>{h(E),m(Q)},y=(E,Q)=>{l.panelProps.onResize(E,Q);const N=g.current;if(!N)return;c.slideTo(t.current?.getLayout()??[]),N.sizeAfterSnap!==null&&E!==N.sizeAfterSnap&&(N.sizeAfterSnap=null,c.finishFast(),m(!0))},w=(E,Q)=>{const N=v(),R=O.current;!N||!R||(c.freeze(EI(N)),E.phase=Q,E.sizeAfterSnap=null,Ms.flushSync(()=>x(a9(E),!1)),E.sizeAfterSnap=R.getSize())},S=E=>{const Q=g.current;if(!Q)return;const R=Dit(Q.foldLineX,e,E.clientX)?Zf.CLOSED:Zf.OPEN;R!==Q.phase&&w(Q,R)},P=()=>{const E=O.current,Q=v(),N=i.ref.current?.getSize();if(!E||!Q||N===void 0)return;c.finishAllFast(EI(Q)),u.start();const R=Zit({panel:E,element:Q,foldsTo:e,minSize:n,maxSize:r,neighbourSize:N,neighbourMinSize:i.minSize});g.current=R,window.addEventListener("pointermove",S,{signal:R.moveListener.signal}),x(a9(R),!0)},k=(E,Q)=>{const N=O.current,R=v();!N||!R||(E.phase===Zf.CLOSED?N.expand():N.collapse(),u.resetCursorAfter(Q,M_(R)+Wit))},I=()=>{const E=g.current;if(!E)return;g.current=null,E.moveListener.abort();const Q=u.finish();Ms.flushSync(()=>x(null,!1)),Q&&k(E,Q)};return{panel:l.panel,isDragging:f!==null,isFollowingCursor:p,panelProps:{...l.panelProps,onResize:y,...f??{minSize:n,maxSize:r}},handleProps:{onDragging:E=>E?P():I(),onPointerDownCapture:u.onPointerDownCapture}}}const Git=50;function c9({panelRef:t,isCollapsed:e,isFollowingCursor:n}){const[r,i]=b.useState(void 0),s=b.useRef(e);return b.useLayoutEffect(()=>{if(e===s.current)return;s.current=e;const o=t.current,a=o&&document.getElementById(o.getId());if(!o||!a)return;const l=a.getBoundingClientRect().width,c=o.getSize()*yte(a);i(Math.round(e?l:Math.max(l,c)));const u=M_(a)+Git,f=setTimeout(()=>i(void 0),u);return()=>clearTimeout(f)},[e,t]),b.useLayoutEffect(()=>{n&&i(void 0)},[n]),r}const Yit={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},Ste=b.createContext(Yit);function wte(){return b.useContext(Ste)}const Hit=b.lazy(()=>Promise.resolve().then(()=>require("./replay-AiPanel-CXwPR7FC.js")).then(t=>({default:t.AiPanel}))),Jit=55,Kit=30,est=25;function tst(){const{layout:t,aiEnabled:e}=Fn(),n=e===!0,r=t==="overlay",i=_it({hasAiPanel:n&&!r,mainMinSize:r?Jit:void 0}),{isOpen:s,openPanel:o,closePanel:a}=wte(),l=b.useRef(null),c=b.useRef(null),u={ref:c,minSize:i.main.minSize},f=l9({groupRef:l,foldsTo:r?Dg.RIGHT:Dg.LEFT,minSize:i.content.minSize,maxSize:i.content.maxSize,neighbour:u}),h=l9({groupRef:l,foldsTo:Dg.RIGHT,minSize:i.ai.minSize,maxSize:i.ai.maxSize,neighbour:u,initiallyCollapsed:!s,onCollapse:a,onExpand:o}),p=Math.min(Kit,i.content.maxSize),m=n&&!r&&s?Math.max(i.ai.minSize,Math.min(est,i.ai.maxSize)):0,g=100-p-m,O=c9({panelRef:f.panelProps.ref,isCollapsed:f.panel.isCollapsed,isFollowingCursor:f.isFollowingCursor}),v=c9({panelRef:h.panelProps.ref,isCollapsed:h.panel.isCollapsed,isFollowingCursor:h.isFollowingCursor}),x=b.useMemo(()=>d.jsx(dx,{}),[]),y=b.useMemo(()=>d.jsx(Iit,{isOverlayLayout:r}),[r]),w=b.useMemo(()=>d.jsx(b.Suspense,{fallback:null,children:d.jsx(Hit,{})}),[]);if(b.useEffect(()=>{s&&h.panel.isCollapsed&&h.panel.expand(),!s&&!h.panel.isCollapsed&&h.panel.collapse()},[h.panel,s]),t==="preview")return d.jsx(dx,{hideTabs:!0});const S=f.isDragging||h.isDragging;return r?d.jsx(i9,{children:d.jsxs(u9,{children:[d.jsxs(d9,{direction:"horizontal",autoSaveId:"replay-layout-overlay",ref:l,"data-dragging":S||void 0,children:[d.jsx(lf,{id:"main-panel",ref:c,defaultSize:g,minSize:i.main.minSize,children:x}),d.jsx(qf,{direction:"vertical",tip:d.jsx(bC,{isCollapsed:f.panel.isCollapsed}),tipPlacement:"left",...f.handleProps}),d.jsx(lf,{id:"content-panel",defaultSize:p,$pinnedWidth:O,$pinTo:"left",...f.panelProps,children:y})]}),d.jsx(n9,{panel:f.panel,isOverlayLayout:r})]})}):d.jsx(i9,{children:d.jsxs(u9,{children:[d.jsx(n9,{panel:f.panel,isOverlayLayout:r}),d.jsxs(d9,{direction:"horizontal",autoSaveId:"replay-layout",ref:l,"data-dragging":S||void 0,children:[d.jsx(lf,{id:"content-panel",defaultSize:p,$pinnedWidth:O,$pinTo:"right",...f.panelProps,children:y}),d.jsx(qf,{direction:"vertical",tip:d.jsx(bC,{isCollapsed:f.panel.isCollapsed}),...f.handleProps}),d.jsx(lf,{id:"main-panel",ref:c,defaultSize:g,minSize:i.main.minSize,children:x}),n&&d.jsxs(d.Fragment,{children:[(!h.panel.isCollapsed||h.isDragging)&&d.jsx(qf,{direction:"vertical",tip:d.jsx(bC,{isCollapsed:!1}),tipPlacement:"left",...h.handleProps}),d.jsx(lf,{id:"ai-panel",defaultSize:m,$pinnedWidth:v,$pinTo:"left",collapsedSize:0,...h.panelProps,children:w})]})]})]})})}const lf=T.default(Ju)`
7364
7364
  transition-property: flex-grow;
7365
7365
  transition-duration: var(--replay-transition-duration);
7366
7366
  transition-timing-function: var(--replay-transition-timing-function);
@@ -7389,7 +7389,7 @@ ${u.join(`\r
7389
7389
  &[data-dragging] ${lf} {
7390
7390
  transition-property: none;
7391
7391
  }
7392
- `,nst=b.lazy(()=>Promise.resolve().then(()=>require("./replay-AiChatProvider-Cc1MYhNY.js")).then(t=>({default:t.AiChatProvider}))),rst=({className:t,renderProjectSelect:e})=>{const{isMobile:n,closeButton:r}=co(),{layout:i,aiEnabled:s}=Fn(),o=hY(),a=i==="preview",l=s===!0,c=o?d.jsx(git,{error:o}):null,u=n?c||d.jsx(iit,{}):d.jsxs(d.Fragment,{children:[!a&&d.jsx(ftt,{}),c||d.jsx(tst,{})]});return d.jsxs(d.Fragment,{children:[!n&&!a&&r,d.jsxs(sst,{className:t,isPreviewLayout:a,children:[d.jsx(Fee,{onError:f=>console.error(f),children:d.jsx(hit,{children:d.jsx(pit,{renderProjectSelect:e,children:l?d.jsx(b.Suspense,{fallback:null,children:d.jsx(nst,{children:u})}):u})})}),d.jsx(Wee,{})]})]})};function Tte({className:t,renderProjectSelect:e}){return d.jsx(rst,{className:t,renderProjectSelect:e})}function ist({className:t,renderProjectSelect:e}){return d.jsx(mte,{children:d.jsx(Tte,{className:t,renderProjectSelect:e})})}const sst=T.default.div`
7392
+ `,nst=b.lazy(()=>Promise.resolve().then(()=>require("./replay-AiChatProvider-DT3Egull.js")).then(t=>({default:t.AiChatProvider}))),rst=({className:t,renderProjectSelect:e})=>{const{isMobile:n,closeButton:r}=co(),{layout:i,aiEnabled:s}=Fn(),o=hY(),a=i==="preview",l=s===!0,c=o?d.jsx(git,{error:o}):null,u=n?c||d.jsx(iit,{}):d.jsxs(d.Fragment,{children:[!a&&d.jsx(ftt,{}),c||d.jsx(tst,{})]});return d.jsxs(d.Fragment,{children:[!n&&!a&&r,d.jsxs(sst,{className:t,isPreviewLayout:a,children:[d.jsx(Fee,{onError:f=>console.error(f),children:d.jsx(hit,{children:d.jsx(pit,{renderProjectSelect:e,children:l?d.jsx(b.Suspense,{fallback:null,children:d.jsx(nst,{children:u})}):u})})}),d.jsx(Wee,{})]})]})};function Tte({className:t,renderProjectSelect:e}){return d.jsx(rst,{className:t,renderProjectSelect:e})}function ist({className:t,renderProjectSelect:e}){return d.jsx(mte,{children:d.jsx(Tte,{className:t,renderProjectSelect:e})})}const sst=T.default.div`
7393
7393
  display: flex;
7394
7394
  flex-direction: column;
7395
7395
  height: 100vh;
@@ -7428,4 +7428,4 @@ ${u.join(`\r
7428
7428
  @media (max-width: ${fi}px) {
7429
7429
  width: 100vw;
7430
7430
  }
7431
- `;async function bst(t,e,n,r){const{validateApiKey:i}=await Promise.resolve().then(()=>require("./replay-validate-key-BhXLTBqe.js"));return i(t,e,n,r)}async function xst(){return(await Promise.resolve().then(()=>require("./replay-agent-loop-rEld9oF-.js"))).AgentLoop}Let();exports.AI_PROVIDERS=sY;exports.AiChatContext=aY;exports.AiChatServiceFactory=PI;exports.AiPanelContext=Ste;exports.Builder=Hi;exports.CriterionType=Ur;exports.DEFAULT_ENVIRONMENTS=CA;exports.DEFAULT_MAX_RETRIES=zRe;exports.DEFAULT_MAX_STEPS=LRe;exports.Divider=at;exports.EmbeddedReplay=stt;exports.GRANT_TYPE_MAP=K$e;exports.GraphQLError=Se;exports.ItemState=Xt;exports.JsonPointerLib=ph;exports.MAX_OUTPUT_TOKENS_FOR_VALIDATION=URe;exports.Markdown=_J;exports.Modal=Cs;exports.OAUTH2_SECURITY=CE;exports.PathUtils=sn;exports.REDOCLY_CONFIG_FILE_NAMES=F2e;exports.REPLAY_CHANGE_PREVIEW_SNAPSHOT_KEY=qRe;exports.REPLAY_ENVIRONMENTS_SECTION_PATH=Z2e;exports.REPLAY_MESSAGE_METADATA_NS=FRe;exports.REQUEST_METHODS=Mh;exports.REUNITE_AI_PROVIDER=GQ;exports.REUNITE_MODEL_OPTION=zE;exports.Replay=mst;exports.ReplayOverlay=vst;exports.RootStorage=$8;exports.SECRET_MASK=qR;exports.SecurityFlows=oe;exports.SecurityTypes=ne;exports.Source=e$;exports.SourceType=qi;exports.StyledSpinner=gQ;exports.TAB_NAMES=it;exports.TOOL_CALL_MESSAGES_TO_KEEP=XRe;exports.TabDataType=Ue;exports.TabState=xn;exports.TelemetryClient=w6;exports.TextContentType=Hn;exports.VerticalDivider=Be;exports.activeEnvironmentIdAtom=Ao;exports.activeTabAtom=UI;exports.activeTabIdxAtom=vs;exports.aiChatKeys=ite;exports.apiUrlToApiId=NY;exports.apisAtom=Ns;exports.applyThemeToDOM=XXe;exports.bgRed=zbe;exports.blue=Mbe;exports.bold=Qbe;exports.buildASTSchema=O$;exports.bytesToHex=Fm;exports.clearNotificationsForSource=Y0;exports.cloneObject=ja;exports.collectionsAtom=ko;exports.context=Aa;exports.createResource=be;exports.createTabFromOperation=ZQ;exports.dayjs=GO;exports.defaultAiChatContextValue=oY;exports.dim=Rbe;exports.dirname=HG;exports.environmentsAtom=si;exports.evaluateRuntimeExpression=_c;exports.evaluateRuntimeExpressionPayload=Tg;exports.exists=FQ;exports.extname=JG;exports.fetch=Ro;exports.findCollection=Sh;exports.findStep=kO;exports.findWorkflow=PO;exports.getAPIKeyLocation=MY;exports.getActiveTab=D9;exports.getActiveTabIndex=Zne;exports.getApiOperationFromStore=ES;exports.getCurrentTheme=iw;exports.getDefaultExportFromCjs=Vl;exports.getEmptyCriterionObject=aG;exports.getEmptyRequestParameter=V0;exports.getEmptySingleSecurity=lo;exports.getLocation=bb;exports.getNewCollection=CR;exports.getNewStep=Da;exports.getNewWorkflow=NQ;exports.getOperationsList=AG;exports.getSelectedEnvironment=gd;exports.getStepFailures=$Ye;exports.getStepForActiveStepTab=JAe;exports.getStepMethod=Rl;exports.getStepUrl=Yu;exports.getValueFromContext=bm;exports.getWorkflowRunVerdict=O_;exports.gray=Lbe;exports.green=Nbe;exports.hasAllStepPassed=m_;exports.inverse=jbe;exports.invoke=kn;exports.invoke$1=Gt;exports.isAbsolute=KG;exports.isAbsoluteUrl=T6;exports.isInlineRequestParameter=yO;exports.isPlainObject=Wh;exports.isRedoclyConfigFile=W2e;exports.isReservedEnvironmentFileKey=jc;exports.isStepTab=HAe;exports.isTabType=_n;exports.isTauriApp=Rn;exports.isWebUrl=Fs;exports.join=qQ;exports.loadAgentLoop=xst;exports.loadAndBundleDefinition=F0;exports.makeProviderRecord=WRe;exports.makeRequest=BJ;exports.markdownParserMarked=RJ;exports.maskSecretsInText=ap;exports.md5=cw;exports.mergeUrlParametersWithPreviousParameters=IA;exports.mkdir=zG;exports.module=W7;exports.parse=ud;exports.path=Dk;exports.pathBrowserifyExports=ac;exports.readDir=XG;exports.readTextFile=UQ;exports.red=yi;exports.remove=FG;exports.removeCollection=_6;exports.removeStep=xE;exports.removeWorkflow=bE;exports.rename=qG;exports.reportParseError=G0;exports.requireFastDeepEqual=Z7;exports.resolve=YG;exports.resolvePath=Jbe;exports.resolveTheme=zXe;exports.resolveWorkflowReference=J7;exports.sep=GG;exports.sha256=UJ;exports.stringToQueryParameters=IO;exports.tabStepUidsMatch=KAe;exports.tabsAtom=Er;exports.toCompactJson=jAe;exports.trace=ps;exports.transformCallback=MQe;exports.transformCallback$1=VG;exports.tty=B7;exports.ulid=vh;exports.underline=_be;exports.updateCollection=Xi;exports.updateStep=bS;exports.updateTabDataAt=M9;exports.updateTabDataById=Gne;exports.updateWorkflow=Vs;exports.useActiveTab=Ml;exports.useAiChatContext=QO;exports.useAiPanel=wte;exports.useApiOperationGetter=DQ;exports.useApis=Wo;exports.useAtomValue=$r;exports.useCollectionActions=md;exports.useCollections=mi;exports.useRunWorkflow=kee;exports.useSettings=pi;exports.useSettingsContext=Fn;exports.useStore=Vo;exports.useTabHandlers=pr;exports.useTelemetry=Ke;exports.useTelemetryClient=AIe;exports.validateApiKey=bst;exports.validateEnvironmentName=$_;exports.validateSchema=u$;exports.visit=Lh;exports.visitInParallel=n$;exports.white=Vbe;exports.writeTextFile=WG;exports.yaml=Nc;exports.yellow=Dbe;
7431
+ `;async function bst(t,e,n,r){const{validateApiKey:i}=await Promise.resolve().then(()=>require("./replay-validate-key-DIcOkWYk.js"));return i(t,e,n,r)}async function xst(){return(await Promise.resolve().then(()=>require("./replay-agent-loop-CrhqM5jp.js"))).AgentLoop}Let();exports.AI_PROVIDERS=sY;exports.AiChatContext=aY;exports.AiChatServiceFactory=PI;exports.AiPanelContext=Ste;exports.Builder=Hi;exports.CriterionType=Ur;exports.DEFAULT_ENVIRONMENTS=CA;exports.DEFAULT_MAX_RETRIES=zRe;exports.DEFAULT_MAX_STEPS=LRe;exports.Divider=at;exports.EmbeddedReplay=stt;exports.GRANT_TYPE_MAP=K$e;exports.GraphQLError=Se;exports.ItemState=Xt;exports.JsonPointerLib=ph;exports.MAX_OUTPUT_TOKENS_FOR_VALIDATION=URe;exports.Markdown=_J;exports.Modal=Cs;exports.OAUTH2_SECURITY=CE;exports.PathUtils=sn;exports.REDOCLY_CONFIG_FILE_NAMES=F2e;exports.REPLAY_CHANGE_PREVIEW_SNAPSHOT_KEY=qRe;exports.REPLAY_ENVIRONMENTS_SECTION_PATH=Z2e;exports.REPLAY_MESSAGE_METADATA_NS=FRe;exports.REQUEST_METHODS=Mh;exports.REUNITE_AI_PROVIDER=GQ;exports.REUNITE_MODEL_OPTION=zE;exports.Replay=mst;exports.ReplayOverlay=vst;exports.RootStorage=$8;exports.SECRET_MASK=qR;exports.SecurityFlows=oe;exports.SecurityTypes=ne;exports.Source=e$;exports.SourceType=qi;exports.StyledSpinner=gQ;exports.TAB_NAMES=it;exports.TOOL_CALL_MESSAGES_TO_KEEP=XRe;exports.TabDataType=Ue;exports.TabState=xn;exports.TelemetryClient=w6;exports.TextContentType=Hn;exports.VerticalDivider=Be;exports.activeEnvironmentIdAtom=Ao;exports.activeTabAtom=UI;exports.activeTabIdxAtom=vs;exports.aiChatKeys=ite;exports.apiUrlToApiId=NY;exports.apisAtom=Ns;exports.applyThemeToDOM=XXe;exports.bgRed=zbe;exports.blue=Mbe;exports.bold=Qbe;exports.buildASTSchema=O$;exports.bytesToHex=Fm;exports.clearNotificationsForSource=Y0;exports.cloneObject=ja;exports.collectionsAtom=ko;exports.context=Aa;exports.createResource=be;exports.createTabFromOperation=ZQ;exports.dayjs=GO;exports.defaultAiChatContextValue=oY;exports.dim=Rbe;exports.dirname=HG;exports.environmentsAtom=si;exports.evaluateRuntimeExpression=_c;exports.evaluateRuntimeExpressionPayload=Tg;exports.exists=FQ;exports.extname=JG;exports.fetch=Ro;exports.findCollection=Sh;exports.findStep=kO;exports.findWorkflow=PO;exports.getAPIKeyLocation=MY;exports.getActiveTab=D9;exports.getActiveTabIndex=Zne;exports.getApiOperationFromStore=ES;exports.getCurrentTheme=iw;exports.getDefaultExportFromCjs=Vl;exports.getEmptyCriterionObject=aG;exports.getEmptyRequestParameter=V0;exports.getEmptySingleSecurity=lo;exports.getLocation=bb;exports.getNewCollection=CR;exports.getNewStep=Da;exports.getNewWorkflow=NQ;exports.getOperationsList=AG;exports.getSelectedEnvironment=gd;exports.getStepFailures=$Ye;exports.getStepForActiveStepTab=JAe;exports.getStepMethod=Rl;exports.getStepUrl=Yu;exports.getValueFromContext=bm;exports.getWorkflowRunVerdict=O_;exports.gray=Lbe;exports.green=Nbe;exports.hasAllStepPassed=m_;exports.inverse=jbe;exports.invoke=kn;exports.invoke$1=Gt;exports.isAbsolute=KG;exports.isAbsoluteUrl=T6;exports.isInlineRequestParameter=yO;exports.isPlainObject=Wh;exports.isRedoclyConfigFile=W2e;exports.isReservedEnvironmentFileKey=jc;exports.isStepTab=HAe;exports.isTabType=_n;exports.isTauriApp=Rn;exports.isWebUrl=Fs;exports.join=qQ;exports.loadAgentLoop=xst;exports.loadAndBundleDefinition=F0;exports.makeProviderRecord=WRe;exports.makeRequest=BJ;exports.markdownParserMarked=RJ;exports.maskSecretsInText=ap;exports.md5=cw;exports.mergeUrlParametersWithPreviousParameters=IA;exports.mkdir=zG;exports.module=W7;exports.parse=ud;exports.path=Dk;exports.pathBrowserifyExports=ac;exports.readDir=XG;exports.readTextFile=UQ;exports.red=yi;exports.remove=FG;exports.removeCollection=_6;exports.removeStep=xE;exports.removeWorkflow=bE;exports.rename=qG;exports.reportParseError=G0;exports.requireFastDeepEqual=Z7;exports.resolve=YG;exports.resolvePath=Jbe;exports.resolveTheme=zXe;exports.resolveWorkflowReference=J7;exports.sep=GG;exports.sha256=UJ;exports.stringToQueryParameters=IO;exports.tabStepUidsMatch=KAe;exports.tabsAtom=Er;exports.toCompactJson=jAe;exports.trace=ps;exports.transformCallback=MQe;exports.transformCallback$1=VG;exports.tty=B7;exports.ulid=vh;exports.underline=_be;exports.updateCollection=Xi;exports.updateStep=bS;exports.updateTabDataAt=M9;exports.updateTabDataById=Gne;exports.updateWorkflow=Vs;exports.useActiveTab=Ml;exports.useAiChatContext=QO;exports.useAiPanel=wte;exports.useApiOperationGetter=DQ;exports.useApis=Wo;exports.useAtomValue=$r;exports.useCollectionActions=md;exports.useCollections=mi;exports.useRunWorkflow=kee;exports.useSettings=pi;exports.useSettingsContext=Fn;exports.useStore=Vo;exports.useTabHandlers=pr;exports.useTelemetry=Ke;exports.useTelemetryClient=AIe;exports.validateApiKey=bst;exports.validateEnvironmentName=$_;exports.validateSchema=u$;exports.visit=Lh;exports.visitInParallel=n$;exports.white=Vbe;exports.writeTextFile=WG;exports.yaml=Nc;exports.yellow=Dbe;