@redocly/replay 0.27.0 → 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/{replay-AiChatProvider-LQhrLIDL.js → replay-AiChatProvider-Cdve_kxz.js} +6 -6
  2. package/dist/{replay-AiChatProvider-Oms5CFgT.js → replay-AiChatProvider-IuOVaWMC.js} +1 -1
  3. package/dist/{replay-AiChatSqliteDBStorage-3-p1mthX.js → replay-AiChatSqliteDBStorage-B3aaY0Uo.js} +1 -1
  4. package/dist/{replay-AiChatSqliteDBStorage-GZibdHOQ.js → replay-AiChatSqliteDBStorage-jEhfZgK3.js} +1 -1
  5. package/dist/{replay-AiPanel-BvwwBTh1.js → replay-AiPanel-0GXuobhF.js} +1 -1
  6. package/dist/{replay-AiPanel-lcDNvgo0.js → replay-AiPanel-BT_RLVeR.js} +4 -4
  7. package/dist/{replay-FileWatcher-DR-wJLe2.js → replay-FileWatcher-CtHVgewC.js} +2 -2
  8. package/dist/{replay-FileWatcher-ClVd_wG0.js → replay-FileWatcher-NkpXJA-C.js} +1 -1
  9. package/dist/{replay-SemanticSearchService-CCqwCRo6.js → replay-SemanticSearchService--QXHzf7_.js} +1 -1
  10. package/dist/{replay-SemanticSearchService-U1eXQGfF.js → replay-SemanticSearchService-DJ_jBUyi.js} +1 -1
  11. package/dist/{replay-SqliteDBStorage-Dn6DoVWW.js → replay-SqliteDBStorage-0JYq0UPY.js} +1 -1
  12. package/dist/{replay-SqliteDBStorage-d_ZK6ScA.js → replay-SqliteDBStorage-ClD7MBeX.js} +1 -1
  13. package/dist/{replay-TauriFileSystemAdapter-CpiUuG3T.js → replay-TauriFileSystemAdapter-BnSXgnQc.js} +1 -1
  14. package/dist/{replay-TauriFileSystemAdapter-dwJ0xBYr.js → replay-TauriFileSystemAdapter-BuHbmM-L.js} +1 -1
  15. package/dist/{replay-TauriRootStorage-DhzbAahU.js → replay-TauriRootStorage-B1vFT2Rg.js} +1 -1
  16. package/dist/{replay-TauriRootStorage-CuVbYMXX.js → replay-TauriRootStorage-D6K0MuWv.js} +2 -2
  17. package/dist/{replay-agent-loop-BLSu4v_O.js → replay-agent-loop-X2MrvEk-.js} +1 -1
  18. package/dist/{replay-agent-loop-DgEHdXUt.js → replay-agent-loop-jUYXZfye.js} +3 -3
  19. package/dist/{replay-ai-chat-mappers-BvfcEubB.js → replay-ai-chat-mappers-B0Ay6VKi.js} +1 -1
  20. package/dist/{replay-ai-chat-mappers-Dy2kJ7ZG.js → replay-ai-chat-mappers-sgE5XiwA.js} +1 -1
  21. package/dist/{replay-create-model-bOIDB-e8.js → replay-create-model-DB6xE5Ap.js} +3 -3
  22. package/dist/{replay-create-model-DNPFcOIp.js → replay-create-model-NrGYVueM.js} +3 -3
  23. package/dist/{replay-db-BQGv3PGw.js → replay-db-BZNR8xEd.js} +1 -1
  24. package/dist/{replay-db-CMXZZs9v.js → replay-db-BiP6dME4.js} +1 -1
  25. package/dist/{replay-external-resolver-mrykFC2h.js → replay-external-resolver-DPAdPRks.js} +2 -2
  26. package/dist/{replay-external-resolver-n5OvQMRF.js → replay-external-resolver-PLyV0HZs.js} +1 -1
  27. package/dist/{replay-index-Bc5RHu5L.js → replay-index-B2RZCGOF.js} +21 -21
  28. package/dist/{replay-index-CepJ5Z0m.js → replay-index-D85qPcEF.js} +11 -11
  29. package/dist/{replay-index-CFLu-XMV.js → replay-index-DDUSidTx.js} +2 -2
  30. package/dist/{replay-index-QXosJxRc.js → replay-index-DKNhWzy4.js} +5 -5
  31. package/dist/{replay-index-CgCGhu4l.js → replay-index-DTD47ryK.js} +1 -1
  32. package/dist/{replay-index-DDjmUXWm.js → replay-index-DmAVD_C4.js} +1 -1
  33. package/dist/{replay-index-CSR_qlua.js → replay-index-HHtp5T42.js} +1 -1
  34. package/dist/{replay-index-CHGVyIdG.js → replay-index-yAV5TCua.js} +1 -1
  35. package/dist/{replay-lint-PWaLESz5.js → replay-lint-Bico-a-1.js} +3 -3
  36. package/dist/{replay-lint-DoHQIATV.js → replay-lint-DyUeemr_.js} +3 -3
  37. package/dist/{replay-lint-graphql-xh8VoAwd.js → replay-lint-graphql-D_p-TkyV.js} +1 -1
  38. package/dist/{replay-lint-graphql-zO8zunug.js → replay-lint-graphql-pt1vf5MX.js} +1 -1
  39. package/dist/{replay-resolve-B0AjmaE9.js → replay-resolve-CQzlNcS2.js} +1 -1
  40. package/dist/{replay-resolve-MVe_8Ube.js → replay-resolve-IKJYgmPW.js} +1 -1
  41. package/dist/{replay-respect-run-X4PSO6Fj.js → replay-respect-run-CtDn7oS8.js} +3 -3
  42. package/dist/{replay-respect-run-BJsR4a4m.js → replay-respect-run-rx_nPWZM.js} +1 -1
  43. package/dist/{replay-tauri-path-CkGiQWsb.js → replay-tauri-path-DrwBKGJP.js} +2 -2
  44. package/dist/{replay-tauri-path-D8FJsoZb.js → replay-tauri-path-iA6pF5e0.js} +1 -1
  45. package/dist/{replay-useAiChatQueries-BXL-_N2Q.js → replay-useAiChatQueries-BIZfilWh.js} +1 -1
  46. package/dist/{replay-useAiChatQueries-D7sHNAfV.js → replay-useAiChatQueries-PECgHJpT.js} +4 -4
  47. package/dist/{replay-validate-key-CmzSfORv.js → replay-validate-key-CTJn216O.js} +1 -1
  48. package/dist/{replay-validate-key-CtZEJRP7.js → replay-validate-key-CvZaTfXj.js} +2 -2
  49. package/dist/replay.cjs +1 -1
  50. package/dist/replay.js +1 -1
  51. package/package.json +2 -2
@@ -107,7 +107,7 @@ html body {
107
107
  `+R.slice(ae,Oe),ae=Oe+1),ye=Te;return Ie+=`
108
108
  `,R.length-ae>K&&ye>ae?Ie+=R.slice(ae,ye)+`
109
109
  `+R.slice(ye+1):Ie+=R.slice(ae),Ie.slice(1)}function ft(R){let K="",xe=0;for(let ce=0;ce<R.length;xe>=65536?ce+=2:ce++){xe=je(R,ce);const ae=N[xe];!ae&&se(xe)?(K+=R[ce],xe>=65536&&(K+=R[ce+1])):K+=ae||V(xe)}return K}function Xe(R,K,xe){let ce="";const ae=R.tag;for(let Oe=0,ye=xe.length;Oe<ye;Oe+=1){let Te=xe[Oe];R.replacer&&(Te=R.replacer.call(xe,String(Oe),Te)),(ue(R,K,Te,!1,!1)||typeof Te>"u"&&ue(R,K,null,!1,!1))&&(ce!==""&&(ce+=","+(R.condenseFlow?"":" ")),ce+=R.dump)}R.tag=ae,R.dump="["+ce+"]"}function et(R,K,xe,ce){let ae="";const Oe=R.tag;for(let ye=0,Te=xe.length;ye<Te;ye+=1){let Ie=xe[ye];R.replacer&&(Ie=R.replacer.call(xe,String(ye),Ie)),(ue(R,K+1,Ie,!0,!0,!1,!0)||typeof Ie>"u"&&ue(R,K+1,null,!0,!0,!1,!0))&&((!ce||ae!=="")&&(ae+=Y(R,K)),R.dump&&a===R.dump.charCodeAt(0)?ae+="-":ae+="- ",ae+=R.dump)}R.tag=Oe,R.dump=ae||"[]"}function Ct(R,K,xe){let ce="";const ae=R.tag,Oe=Object.keys(xe);for(let ye=0,Te=Oe.length;ye<Te;ye+=1){let Ie="";ce!==""&&(Ie+=", "),R.condenseFlow&&(Ie+='"');const Ee=Oe[ye];let Re=xe[Ee];R.replacer&&(Re=R.replacer.call(xe,Ee,Re)),ue(R,K,Ee,!1,!1)&&(R.dump.length>1024&&(Ie+="? "),Ie+=R.dump+(R.condenseFlow?'"':"")+":"+(R.condenseFlow?"":" "),ue(R,K,Re,!1,!1)&&(Ie+=R.dump,ce+=Ie))}R.tag=ae,R.dump="{"+ce+"}"}function C(R,K,xe,ce){let ae="";const Oe=R.tag,ye=Object.keys(xe);if(R.sortKeys===!0)ye.sort();else if(typeof R.sortKeys=="function")ye.sort(R.sortKeys);else if(R.sortKeys)throw new e("sortKeys must be a boolean or a function");for(let Te=0,Ie=ye.length;Te<Ie;Te+=1){let Ee="";(!ce||ae!=="")&&(Ee+=Y(R,K));const Re=ye[Te];let Ve=xe[Re];if(R.replacer&&(Ve=R.replacer.call(xe,Re,Ve)),!ue(R,K+1,Re,!0,!0,!0))continue;const Fe=R.tag!==null&&R.tag!=="?"||R.dump&&R.dump.length>1024;Fe&&(R.dump&&a===R.dump.charCodeAt(0)?Ee+="?":Ee+="? "),Ee+=R.dump,Fe&&(Ee+=Y(R,K)),ue(R,K+1,Ve,!0,Fe)&&(R.dump&&a===R.dump.charCodeAt(0)?Ee+=":":Ee+=": ",Ee+=R.dump,ae+=Ee)}R.tag=Oe,R.dump=ae||"{}"}function G(R,K,xe){const ce=xe?R.explicitTypes:R.implicitTypes;for(let ae=0,Oe=ce.length;ae<Oe;ae+=1){const ye=ce[ae];if((ye.instanceOf||ye.predicate)&&(!ye.instanceOf||typeof K=="object"&&K instanceof ye.instanceOf)&&(!ye.predicate||ye.predicate(K))){if(xe?ye.multi&&ye.representName?R.tag=ye.representName(K):R.tag=ye.tag:R.tag="?",ye.represent){const Te=R.styleMap[ye.tag]||ye.defaultStyle;let Ie;if(r.call(ye.represent)==="[object Function]")Ie=ye.represent(K,Te);else if(i.call(ye.represent,Te))Ie=ye.represent[Te](K,Te);else throw new e("!<"+ye.tag+'> tag resolver accepts not "'+Te+'" style');R.dump=Ie}return!0}}return!1}function ue(R,K,xe,ce,ae,Oe,ye){R.tag=null,R.dump=xe,G(R,xe,!1)||G(R,xe,!0);const Te=r.call(R.dump),Ie=ce;ce&&(ce=R.flowLevel<0||R.flowLevel>K);const Ee=Te==="[object Object]"||Te==="[object Array]";let Re,Ve;if(Ee&&(Re=R.duplicates.indexOf(xe),Ve=Re!==-1),(R.tag!==null&&R.tag!=="?"||Ve||R.indent!==2&&K>0)&&(ae=!1),Ve&&R.usedDuplicates[Re])R.dump="*ref_"+Re;else{if(Ee&&Ve&&!R.usedDuplicates[Re]&&(R.usedDuplicates[Re]=!0),Te==="[object Object]")ce&&Object.keys(R.dump).length!==0?(C(R,K,R.dump,ae),Ve&&(R.dump="&ref_"+Re+R.dump)):(Ct(R,K,R.dump),Ve&&(R.dump="&ref_"+Re+" "+R.dump));else if(Te==="[object Array]")ce&&R.dump.length!==0?(R.noArrayIndent&&!ye&&K>0?et(R,K-1,R.dump,ae):et(R,K,R.dump,ae),Ve&&(R.dump="&ref_"+Re+R.dump)):(Xe(R,K,R.dump),Ve&&(R.dump="&ref_"+Re+" "+R.dump));else if(Te==="[object String]")R.tag!=="?"&&Pt(R,R.dump,K,Oe,Ie);else{if(Te==="[object Undefined]")return!1;if(R.skipInvalid)return!1;throw new e("unacceptable kind of an object to dump "+Te)}if(R.tag!==null&&R.tag!=="?"){let Fe=encodeURI(R.tag[0]==="!"?R.tag.slice(1):R.tag).replace(/!/g,"%21");R.tag[0]==="!"?Fe="!"+Fe:Fe.slice(0,18)==="tag:yaml.org,2002:"?Fe="!!"+Fe.slice(18):Fe="!<"+Fe+">",R.dump=Fe+" "+R.dump}}return!0}function de(R,K){const xe=[],ce=[];le(R,xe,ce);const ae=ce.length;for(let Oe=0;Oe<ae;Oe+=1)K.duplicates.push(xe[ce[Oe]]);K.usedDuplicates=new Array(ae)}function le(R,K,xe){if(R!==null&&typeof R=="object"){const ce=K.indexOf(R);if(ce!==-1)xe.indexOf(ce)===-1&&xe.push(ce);else if(K.push(R),Array.isArray(R))for(let ae=0,Oe=R.length;ae<Oe;ae+=1)le(R[ae],K,xe);else{const ae=Object.keys(R);for(let Oe=0,ye=ae.length;Oe<ye;Oe+=1)le(R[ae[Oe]],K,xe)}}}function we(R,K){K=K||{};const xe=new q(K);xe.noRefs||de(R,xe);let ce=R;return xe.replacer&&(ce=xe.replacer.call({"":ce},"",ce)),ue(xe,0,ce,!0,!0)?xe.dump+`
110
- `:""}return Q0.dump=we,Q0}var qE;function lH(){if(qE)return vr;qE=1;const t=oH(),e=aH();function n(r,i){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+i+" instead, which is now safe by default.")}}return vr.Type=Zr(),vr.Schema=T3(),vr.FAILSAFE_SCHEMA=A3(),vr.JSON_SCHEMA=D3(),vr.CORE_SCHEMA=N3(),vr.DEFAULT_SCHEMA=XP(),vr.load=t.load,vr.loadAll=t.loadAll,vr.dump=e.dump,vr.YAMLException=Ap(),vr.types={binary:V3(),float:_3(),map:E3(),null:Q3(),pairs:X3(),set:W3(),timestamp:M3(),bool:R3(),int:j3(),merge:z3(),omap:L3(),seq:I3(),str:$3()},vr.safeLoad=n("safeLoad","load"),vr.safeLoadAll=n("safeLoadAll","loadAll"),vr.safeDump=n("safeDump","dump"),vr}var cH=lH();const Ja=iH(cH),{Type:kqe,Schema:Tqe,FAILSAFE_SCHEMA:$qe,JSON_SCHEMA:Iqe,CORE_SCHEMA:Eqe,DEFAULT_SCHEMA:Aqe,load:Qqe,loadAll:Rqe,dump:jqe,YAMLException:_qe,types:Dqe,safeLoad:Nqe,safeLoadAll:Mqe,safeDump:zqe}=Ja,zl="1.9.1",UE=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function uH(t){const e=new Set([t]),n=new Set,r=t.match(UE);if(!r)return()=>!1;const i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(l){return l===t};function s(a){return n.add(a),!1}function o(a){return e.add(a),!0}return function(l){if(e.has(l))return!0;if(n.has(l))return!1;const c=l.match(UE);if(!c)return s(l);const u={major:+c[1],minor:+c[2],patch:+c[3],prerelease:c[4]};return u.prerelease!=null||i.major!==u.major?s(l):i.major===0?i.minor===u.minor&&i.patch<=u.patch?o(l):s(l):i.minor<=u.minor?o(l):s(l)}}const dH=uH(zl),fH=zl.split(".")[0],Ih=Symbol.for(`opentelemetry.js.api.${fH}`),Eh=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};function Qp(t,e,n,r=!1){var i;const s=Eh[Ih]=(i=Eh[Ih])!==null&&i!==void 0?i:{version:zl};if(!r&&s[t]){const o=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return n.error(o.stack||o.message),!1}if(s.version!==zl){const o=new Error(`@opentelemetry/api: Registration of version v${s.version} for ${t} does not match previously registered API v${zl}`);return n.error(o.stack||o.message),!1}return s[t]=e,n.debug(`@opentelemetry/api: Registered a global for ${t} v${zl}.`),!0}function nc(t){var e,n;const r=(e=Eh[Ih])===null||e===void 0?void 0:e.version;if(!(!r||!dH(r)))return(n=Eh[Ih])===null||n===void 0?void 0:n[t]}function Rp(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v${zl}.`);const n=Eh[Ih];n&&delete n[t]}class hH{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return of("debug",this._namespace,e)}error(...e){return of("error",this._namespace,e)}info(...e){return of("info",this._namespace,e)}warn(...e){return of("warn",this._namespace,e)}verbose(...e){return of("verbose",this._namespace,e)}}function of(t,e,n){const r=nc("diag");if(r)return r[t](e,...n)}var vi;(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(vi||(vi={}));function pH(t,e){t<vi.NONE?t=vi.NONE:t>vi.ALL&&(t=vi.ALL),e=e||{};function n(r,i){const s=e[r];return typeof s=="function"&&t>=i?s.bind(e):function(){}}return{error:n("error",vi.ERROR),warn:n("warn",vi.WARN),info:n("info",vi.INFO),debug:n("debug",vi.DEBUG),verbose:n("verbose",vi.VERBOSE)}}const gH="diag";class Hi{static instance(){return this._instance||(this._instance=new Hi),this._instance}constructor(){function e(i){return function(...s){const o=nc("diag");if(o)return o[i](...s)}}const n=this,r=(i,s={logLevel:vi.INFO})=>{var o,a,l;if(i===n){const f=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error((o=f.stack)!==null&&o!==void 0?o:f.message),!1}typeof s=="number"&&(s={logLevel:s});const c=nc("diag"),u=pH((a=s.logLevel)!==null&&a!==void 0?a:vi.INFO,i);if(c&&!s.suppressOverrideMessage){const f=(l=new Error().stack)!==null&&l!==void 0?l:"<failed to generate stacktrace>";c.warn(`Current logger will be overwritten from ${f}`),u.warn(`Current logger will overwrite one already registered from ${f}`)}return Qp("diag",u,n,!0)};n.setLogger=r,n.disable=()=>{Rp(gH,n)},n.createComponentLogger=i=>new hH(i),n.verbose=e("verbose"),n.debug=e("debug"),n.info=e("info"),n.warn=e("warn"),n.error=e("error")}}class gu{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){const n=this._entries.get(e);if(n)return Object.assign({},n)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,n){const r=new gu(this._entries);return r._entries.set(e,n),r}removeEntry(e){const n=new gu(this._entries);return n._entries.delete(e),n}removeEntries(...e){const n=new gu(this._entries);for(const r of e)n._entries.delete(r);return n}clear(){return new gu}}const mH=Symbol("BaggageEntryMetadata"),OH=Hi.instance();function vH(t={}){return new gu(new Map(Object.entries(t)))}function yH(t){return typeof t!="string"&&(OH.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:mH,toString(){return t}}}function WP(t){return Symbol.for(t)}class zO{constructor(e){const n=this;n._currentContext=e?new Map(e):new Map,n.getValue=r=>n._currentContext.get(r),n.setValue=(r,i)=>{const s=new zO(n._currentContext);return s._currentContext.set(r,i),s},n.deleteValue=r=>{const i=new zO(n._currentContext);return i._currentContext.delete(r),i}}}const au=new zO;class bH{constructor(){}createGauge(e,n){return IH}createHistogram(e,n){return EH}createCounter(e,n){return $H}createUpDownCounter(e,n){return AH}createObservableGauge(e,n){return RH}createObservableCounter(e,n){return QH}createObservableUpDownCounter(e,n){return jH}addBatchObservableCallback(e,n){}removeBatchObservableCallback(e){}}class Iy{}class xH extends Iy{add(e,n){}}class SH extends Iy{add(e,n){}}class wH extends Iy{record(e,n){}}class CH extends Iy{record(e,n){}}class ZP{addCallback(e){}removeCallback(e){}}class PH extends ZP{}class kH extends ZP{}class TH extends ZP{}const Z3=new bH,$H=new xH,IH=new wH,EH=new CH,AH=new SH,QH=new PH,RH=new kH,jH=new TH;function _H(){return Z3}const DH={get(t,e){if(t!=null)return t[e]},keys(t){return t==null?[]:Object.keys(t)}},NH={set(t,e,n){t!=null&&(t[e]=n)}};class MH{active(){return au}with(e,n,r,...i){return n.call(r,...i)}bind(e,n){return n}enable(){return this}disable(){return this}}const R0="context",zH=new MH;class kd{constructor(){}static getInstance(){return this._instance||(this._instance=new kd),this._instance}setGlobalContextManager(e){return Qp(R0,e,Hi.instance())}active(){return this._getContextManager().active()}with(e,n,r,...i){return this._getContextManager().with(e,n,r,...i)}bind(e,n){return this._getContextManager().bind(e,n)}_getContextManager(){return nc(R0)||zH}disable(){this._getContextManager().disable(),Rp(R0,Hi.instance())}}var na;(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(na||(na={}));const q3="0000000000000000",U3="00000000000000000000000000000000",B3={traceId:U3,spanId:q3,traceFlags:na.NONE};class Gf{constructor(e=B3){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,n){return this}setAttributes(e){return this}addEvent(e,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,n){}}const qP=WP("OpenTelemetry Context Key SPAN");function UP(t){return t.getValue(qP)||void 0}function VH(){return UP(kd.getInstance().active())}function BP(t,e){return t.setValue(qP,e)}function LH(t){return t.deleteValue(qP)}function XH(t,e){return BP(t,new Gf(e))}function F3(t){var e;return(e=UP(t))===null||e===void 0?void 0:e.spanContext()}const Tg=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function Y3(t,e){if(typeof t!="string"||t.length!==e)return!1;let n=0;for(let r=0;r<t.length;r+=4)n+=(Tg[t.charCodeAt(r)]|0)+(Tg[t.charCodeAt(r+1)]|0)+(Tg[t.charCodeAt(r+2)]|0)+(Tg[t.charCodeAt(r+3)]|0);return n===e}function G3(t){return Y3(t,32)&&t!==U3}function WH(t){return Y3(t,16)&&t!==q3}function Ey(t){return G3(t.traceId)&&WH(t.spanId)}function ZH(t){return new Gf(t)}const j0=kd.getInstance();class H3{startSpan(e,n,r=j0.active()){if(!!n?.root)return new Gf;const s=r&&F3(r);return qH(s)&&Ey(s)?new Gf(s):new Gf}startActiveSpan(e,n,r,i){let s,o,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,o=r,a=i);const l=o??j0.active(),c=this.startSpan(e,s,l),u=BP(l,c);return j0.with(u,a,void 0,c)}}function qH(t){return t!==null&&typeof t=="object"&&"spanId"in t&&typeof t.spanId=="string"&&"traceId"in t&&typeof t.traceId=="string"&&"traceFlags"in t&&typeof t.traceFlags=="number"}const UH=new H3;class BH{constructor(e,n,r,i){this._provider=e,this.name=n,this.version=r,this.options=i}startSpan(e,n,r){return this._getTracer().startSpan(e,n,r)}startActiveSpan(e,n,r,i){const s=this._getTracer();return Reflect.apply(s.startActiveSpan,s,arguments)}_getTracer(){if(this._delegate)return this._delegate;const e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):UH}}class FH{getTracer(e,n,r){return new H3}}const YH=new FH;class BE{getTracer(e,n,r){var i;return(i=this.getDelegateTracer(e,n,r))!==null&&i!==void 0?i:new BH(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:YH}setDelegate(e){this._delegate=e}getDelegateTracer(e,n,r){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(e,n,r)}}var VO;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(VO||(VO={}));exports.SpanKind=void 0;(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(exports.SpanKind||(exports.SpanKind={}));exports.SpanStatusCode=void 0;(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(exports.SpanStatusCode||(exports.SpanStatusCode={}));const po=kd.getInstance(),ct=Hi.instance();class GH{getMeter(e,n,r){return Z3}}const HH=new GH,_0="metrics";class FP{constructor(){}static getInstance(){return this._instance||(this._instance=new FP),this._instance}setGlobalMeterProvider(e){return Qp(_0,e,Hi.instance())}getMeterProvider(){return nc(_0)||HH}getMeter(e,n,r){return this.getMeterProvider().getMeter(e,n,r)}disable(){Rp(_0,Hi.instance())}}const J3=FP.getInstance();class JH{inject(e,n){}extract(e,n){return e}fields(){return[]}}const YP=WP("OpenTelemetry Baggage Key");function K3(t){return t.getValue(YP)||void 0}function KH(){return K3(kd.getInstance().active())}function eJ(t,e){return t.setValue(YP,e)}function tJ(t){return t.deleteValue(YP)}const D0="propagation",nJ=new JH;class GP{constructor(){this.createBaggage=vH,this.getBaggage=K3,this.getActiveBaggage=KH,this.setBaggage=eJ,this.deleteBaggage=tJ}static getInstance(){return this._instance||(this._instance=new GP),this._instance}setGlobalPropagator(e){return Qp(D0,e,Hi.instance())}inject(e,n,r=NH){return this._getGlobalPropagator().inject(e,n,r)}extract(e,n,r=DH){return this._getGlobalPropagator().extract(e,n,r)}fields(){return this._getGlobalPropagator().fields()}disable(){Rp(D0,Hi.instance())}_getGlobalPropagator(){return nc(D0)||nJ}}const Hf=GP.getInstance(),N0="trace";class HP{constructor(){this._proxyTracerProvider=new BE,this.wrapSpanContext=ZH,this.isSpanContextValid=Ey,this.deleteSpan=LH,this.getSpan=UP,this.getActiveSpan=VH,this.getSpanContext=F3,this.setSpan=BP,this.setSpanContext=XH}static getInstance(){return this._instance||(this._instance=new HP),this._instance}setGlobalTracerProvider(e){const n=Qp(N0,this._proxyTracerProvider,Hi.instance());return n&&this._proxyTracerProvider.setDelegate(e),n}getTracerProvider(){return nc(N0)||this._proxyTracerProvider}getTracer(e,n){return this.getTracerProvider().getTracer(e,n)}disable(){Rp(N0,Hi.instance()),this._proxyTracerProvider=new BE}}const jr=HP.getInstance(),ri={FS:"fs",WEB:"web"};class Ht{static utils=null;static async getUtils(){return Ht.utils||(Ht.utils=hn()?await Promise.resolve().then(()=>require("./replay-tauri-path-D8FJsoZb.js")):{join:Qa.join,resolve:Qa.resolve,isAbsolute:Qa.isAbsolute,relative:Qa.relative,extname:Qa.extname,dirname:Qa.dirname}),Ht.utils}static async dirname(e){return(await Ht.getUtils()).dirname(e)}static async join(...e){return(await Ht.getUtils()).join(...e)}static async resolve(e){return(await Ht.getUtils()).resolve(e)}static async isAbsolute(e){return(await Ht.getUtils()).isAbsolute(e)}static async relative(e,n){return(await Ht.getUtils()).relative(e,n)}static async extname(e){return(await Ht.getUtils()).extname(e)}}async function LO(t,e){const[{bundle:n,Config:r},{ExternalResolver:i}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-CHGVyIdG.js")),Promise.resolve().then(()=>require("./replay-external-resolver-n5OvQMRF.js"))]),s=new r({});s.getRulesForSpecVersion=()=>[];const o=await Ht.dirname(t),a={config:s,base:o,externalRefResolver:new i,dereference:!0};e?a.doc={source:{absoluteRef:t},parsed:e}:a.ref=t;const{bundle:{parsed:l},fileDependencies:c}=await n(a);return{definition:l,fileDependencies:c}}function e4(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function PS(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function t4(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function Li(t){try{return new URL(t),!0}catch{return!1}}function rJ(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(e4(e))n=e;else if(!e.startsWith("/"))n=PS(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return PS(n)}function FE(t,e){let n=t;return e.forEach(({key:r,value:i,active:s})=>{i&&s&&(n=n.replaceAll(`{${r}}`,i))}),n}function n4(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function iJ(t){return t.startsWith("http://")||t.startsWith("https://")}function $g({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(iJ(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}class kS{constructor(e){this.baseDir=e}baseDir;writeExcludedKeys=new Set;setWriteExcludedKeys(e){this.writeExcludedKeys=e}async ls(e=""){const n=this.makeKey(e);return Object.keys(localStorage).filter(r=>r.startsWith(n)).map(r=>r.replace(n,""))}async get(e){const n=this.makeKey(e);return localStorage.getItem(n)??null}async has(e){const n=this.makeKey(e);return localStorage.getItem(n)!==null}async set(e,n){if(this.writeExcludedKeys.has(e))return;const r=this.makeKey(e);localStorage.setItem(r,n)}async remove(e){if(this.writeExcludedKeys.has(e))return;const n=this.makeKey(e);localStorage.removeItem(n)}async rename(e,n){const r=this.makeKey(e),i=this.makeKey(n),s=localStorage.getItem(r);s!==null&&(localStorage.setItem(i,s),localStorage.removeItem(r))}makeKey(e){return`replay:fs:${this.baseDir}/${e}`}on(e,n){}off(e,n){}}class sJ{baseDir="";async ls(e=""){return[]}async get(e){return null}async has(e){return!1}async set(e,n){}async remove(e){}async rename(e,n){}setWriteExcludedKeys(e){}on(e,n){}off(e,n){}}class oJ{constructor(e){this.projectId=e}projectId;async get(){const e=this.getKey();return localStorage.getItem(e)??null}async set(e){const n=this.getKey();localStorage.setItem(n,e)}async remove(){const e=this.getKey();localStorage.removeItem(e)}getKey(){return`replay:secrets:${this.projectId}`}}class r4{constructor(e){this.storage=e}storage;itemIds=[];async getAbsolutePath(e){return await Ht.resolve(await Ht.join(this.storage.baseDir,"/",e))}async parseMany(e,n){return(await Promise.all(e.map(async i=>{try{return await this.parse(i,n)}catch(s){return console.error(`Error parsing from ${i.type} ${i.uri}:`,s),null}}))).filter(i=>i!==null)}setItemIds(e){this.itemIds=e}async write(e){e.state===jt.Draft||e.srcType!==ri.FS||await this.storage.set(e.id,await this.stringify(e))}async remove(e){await this.storage.remove(e)}async updateRoot(e,n){const r=e.actions;if(r){for(const s in r){const o=parseInt(s);switch(r[s]){case"D":await this.remove(this.itemIds[o]);break;case"I":case"U":await this.write(n[o]);break}}return}const i=this.itemIds.filter(s=>!n.some(o=>o.id===s));await Promise.all([...n.map(s=>this.write(s)),...i.map(s=>this.remove(s))])}async update(e,n){const i={path:e.path.slice(1),actions:e.actions};if(i.path.length===0&&await this.updateRoot(i,n),i.path.length>0){const s=i.path[0];i.path.length===1&&i.actions&&i.actions.id==="U"&&await this.remove(this.itemIds[s]),i.path[1]&&i.path[1]==="id"&&await this.remove(this.itemIds[s]),await this.write(n[s])}this.itemIds=n.map(s=>s.id)}}class aJ extends r4{parse(e){return{...e.content,id:e.uri,srcType:e.type,fileDependencies:e.fileDependencies}}async stringify(e){const{id:n,srcType:r,fileDependencies:i,...s}=e;return await Ht.extname(n)===".json"?JSON.stringify(s,null,2):Ja.dump(s)}async write(e){await this.storage.has(e.id)||await super.write(e)}}var ar=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(ar||{});class XO{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 lJ{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}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 i4{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new lJ(this)}push(e,n=null,r=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const i=this.path.length;this.siblingStacks[i]||(this.siblingStacks[i]=new Map);const s=this.siblingStacks[i],o=r?`${r}:${e}`:e,a=s.get(o)||0;let l=0;for(const u of s.values())l+=u;s.set(o,a+1);const c={tag:e,position:l,counter:a};r!=null&&(c.namespace=r),n!=null&&(c.values=n),this.path.push(c)}pop(){if(this.path.length===0)return;this._pathStringCache=null;const e=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),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}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=[]}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=>new Map(e))}}restore(e){this._pathStringCache=null,this.path=e.path.map(n=>({...n})),this.siblingStacks=e.siblingStacks.map(n=>new Map(n))}readOnly(){return this._view}}function s4(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function o4(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function Bu(t){return String(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const a4=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",cJ=a4+"\\-\\.\\d·̀-ͯ‿-⁀",l4=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",uJ=l4+"\\-\\.\\d·̀-ͯ҇‿-⁀",c4=(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)}},dJ=c4(a4,cJ),fJ=c4(l4,uJ,"u"),hJ=(t="1.0")=>t==="1.1"?fJ:dJ,u4=(t,{xmlVersion:e="1.0"}={})=>hJ(e).qName.test(t),pJ=`
110
+ `:""}return Q0.dump=we,Q0}var qE;function lH(){if(qE)return vr;qE=1;const t=oH(),e=aH();function n(r,i){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+i+" instead, which is now safe by default.")}}return vr.Type=Zr(),vr.Schema=T3(),vr.FAILSAFE_SCHEMA=A3(),vr.JSON_SCHEMA=D3(),vr.CORE_SCHEMA=N3(),vr.DEFAULT_SCHEMA=XP(),vr.load=t.load,vr.loadAll=t.loadAll,vr.dump=e.dump,vr.YAMLException=Ap(),vr.types={binary:V3(),float:_3(),map:E3(),null:Q3(),pairs:X3(),set:W3(),timestamp:M3(),bool:R3(),int:j3(),merge:z3(),omap:L3(),seq:I3(),str:$3()},vr.safeLoad=n("safeLoad","load"),vr.safeLoadAll=n("safeLoadAll","loadAll"),vr.safeDump=n("safeDump","dump"),vr}var cH=lH();const Ja=iH(cH),{Type:kqe,Schema:Tqe,FAILSAFE_SCHEMA:$qe,JSON_SCHEMA:Iqe,CORE_SCHEMA:Eqe,DEFAULT_SCHEMA:Aqe,load:Qqe,loadAll:Rqe,dump:jqe,YAMLException:_qe,types:Dqe,safeLoad:Nqe,safeLoadAll:Mqe,safeDump:zqe}=Ja,zl="1.9.1",UE=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function uH(t){const e=new Set([t]),n=new Set,r=t.match(UE);if(!r)return()=>!1;const i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(l){return l===t};function s(a){return n.add(a),!1}function o(a){return e.add(a),!0}return function(l){if(e.has(l))return!0;if(n.has(l))return!1;const c=l.match(UE);if(!c)return s(l);const u={major:+c[1],minor:+c[2],patch:+c[3],prerelease:c[4]};return u.prerelease!=null||i.major!==u.major?s(l):i.major===0?i.minor===u.minor&&i.patch<=u.patch?o(l):s(l):i.minor<=u.minor?o(l):s(l)}}const dH=uH(zl),fH=zl.split(".")[0],Ih=Symbol.for(`opentelemetry.js.api.${fH}`),Eh=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};function Qp(t,e,n,r=!1){var i;const s=Eh[Ih]=(i=Eh[Ih])!==null&&i!==void 0?i:{version:zl};if(!r&&s[t]){const o=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return n.error(o.stack||o.message),!1}if(s.version!==zl){const o=new Error(`@opentelemetry/api: Registration of version v${s.version} for ${t} does not match previously registered API v${zl}`);return n.error(o.stack||o.message),!1}return s[t]=e,n.debug(`@opentelemetry/api: Registered a global for ${t} v${zl}.`),!0}function nc(t){var e,n;const r=(e=Eh[Ih])===null||e===void 0?void 0:e.version;if(!(!r||!dH(r)))return(n=Eh[Ih])===null||n===void 0?void 0:n[t]}function Rp(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v${zl}.`);const n=Eh[Ih];n&&delete n[t]}class hH{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return of("debug",this._namespace,e)}error(...e){return of("error",this._namespace,e)}info(...e){return of("info",this._namespace,e)}warn(...e){return of("warn",this._namespace,e)}verbose(...e){return of("verbose",this._namespace,e)}}function of(t,e,n){const r=nc("diag");if(r)return r[t](e,...n)}var vi;(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(vi||(vi={}));function pH(t,e){t<vi.NONE?t=vi.NONE:t>vi.ALL&&(t=vi.ALL),e=e||{};function n(r,i){const s=e[r];return typeof s=="function"&&t>=i?s.bind(e):function(){}}return{error:n("error",vi.ERROR),warn:n("warn",vi.WARN),info:n("info",vi.INFO),debug:n("debug",vi.DEBUG),verbose:n("verbose",vi.VERBOSE)}}const gH="diag";class Hi{static instance(){return this._instance||(this._instance=new Hi),this._instance}constructor(){function e(i){return function(...s){const o=nc("diag");if(o)return o[i](...s)}}const n=this,r=(i,s={logLevel:vi.INFO})=>{var o,a,l;if(i===n){const f=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error((o=f.stack)!==null&&o!==void 0?o:f.message),!1}typeof s=="number"&&(s={logLevel:s});const c=nc("diag"),u=pH((a=s.logLevel)!==null&&a!==void 0?a:vi.INFO,i);if(c&&!s.suppressOverrideMessage){const f=(l=new Error().stack)!==null&&l!==void 0?l:"<failed to generate stacktrace>";c.warn(`Current logger will be overwritten from ${f}`),u.warn(`Current logger will overwrite one already registered from ${f}`)}return Qp("diag",u,n,!0)};n.setLogger=r,n.disable=()=>{Rp(gH,n)},n.createComponentLogger=i=>new hH(i),n.verbose=e("verbose"),n.debug=e("debug"),n.info=e("info"),n.warn=e("warn"),n.error=e("error")}}class gu{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){const n=this._entries.get(e);if(n)return Object.assign({},n)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,n){const r=new gu(this._entries);return r._entries.set(e,n),r}removeEntry(e){const n=new gu(this._entries);return n._entries.delete(e),n}removeEntries(...e){const n=new gu(this._entries);for(const r of e)n._entries.delete(r);return n}clear(){return new gu}}const mH=Symbol("BaggageEntryMetadata"),OH=Hi.instance();function vH(t={}){return new gu(new Map(Object.entries(t)))}function yH(t){return typeof t!="string"&&(OH.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:mH,toString(){return t}}}function WP(t){return Symbol.for(t)}class zO{constructor(e){const n=this;n._currentContext=e?new Map(e):new Map,n.getValue=r=>n._currentContext.get(r),n.setValue=(r,i)=>{const s=new zO(n._currentContext);return s._currentContext.set(r,i),s},n.deleteValue=r=>{const i=new zO(n._currentContext);return i._currentContext.delete(r),i}}}const au=new zO;class bH{constructor(){}createGauge(e,n){return IH}createHistogram(e,n){return EH}createCounter(e,n){return $H}createUpDownCounter(e,n){return AH}createObservableGauge(e,n){return RH}createObservableCounter(e,n){return QH}createObservableUpDownCounter(e,n){return jH}addBatchObservableCallback(e,n){}removeBatchObservableCallback(e){}}class Iy{}class xH extends Iy{add(e,n){}}class SH extends Iy{add(e,n){}}class wH extends Iy{record(e,n){}}class CH extends Iy{record(e,n){}}class ZP{addCallback(e){}removeCallback(e){}}class PH extends ZP{}class kH extends ZP{}class TH extends ZP{}const Z3=new bH,$H=new xH,IH=new wH,EH=new CH,AH=new SH,QH=new PH,RH=new kH,jH=new TH;function _H(){return Z3}const DH={get(t,e){if(t!=null)return t[e]},keys(t){return t==null?[]:Object.keys(t)}},NH={set(t,e,n){t!=null&&(t[e]=n)}};class MH{active(){return au}with(e,n,r,...i){return n.call(r,...i)}bind(e,n){return n}enable(){return this}disable(){return this}}const R0="context",zH=new MH;class kd{constructor(){}static getInstance(){return this._instance||(this._instance=new kd),this._instance}setGlobalContextManager(e){return Qp(R0,e,Hi.instance())}active(){return this._getContextManager().active()}with(e,n,r,...i){return this._getContextManager().with(e,n,r,...i)}bind(e,n){return this._getContextManager().bind(e,n)}_getContextManager(){return nc(R0)||zH}disable(){this._getContextManager().disable(),Rp(R0,Hi.instance())}}var na;(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(na||(na={}));const q3="0000000000000000",U3="00000000000000000000000000000000",B3={traceId:U3,spanId:q3,traceFlags:na.NONE};class Gf{constructor(e=B3){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,n){return this}setAttributes(e){return this}addEvent(e,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,n){}}const qP=WP("OpenTelemetry Context Key SPAN");function UP(t){return t.getValue(qP)||void 0}function VH(){return UP(kd.getInstance().active())}function BP(t,e){return t.setValue(qP,e)}function LH(t){return t.deleteValue(qP)}function XH(t,e){return BP(t,new Gf(e))}function F3(t){var e;return(e=UP(t))===null||e===void 0?void 0:e.spanContext()}const Tg=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function Y3(t,e){if(typeof t!="string"||t.length!==e)return!1;let n=0;for(let r=0;r<t.length;r+=4)n+=(Tg[t.charCodeAt(r)]|0)+(Tg[t.charCodeAt(r+1)]|0)+(Tg[t.charCodeAt(r+2)]|0)+(Tg[t.charCodeAt(r+3)]|0);return n===e}function G3(t){return Y3(t,32)&&t!==U3}function WH(t){return Y3(t,16)&&t!==q3}function Ey(t){return G3(t.traceId)&&WH(t.spanId)}function ZH(t){return new Gf(t)}const j0=kd.getInstance();class H3{startSpan(e,n,r=j0.active()){if(!!n?.root)return new Gf;const s=r&&F3(r);return qH(s)&&Ey(s)?new Gf(s):new Gf}startActiveSpan(e,n,r,i){let s,o,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,o=r,a=i);const l=o??j0.active(),c=this.startSpan(e,s,l),u=BP(l,c);return j0.with(u,a,void 0,c)}}function qH(t){return t!==null&&typeof t=="object"&&"spanId"in t&&typeof t.spanId=="string"&&"traceId"in t&&typeof t.traceId=="string"&&"traceFlags"in t&&typeof t.traceFlags=="number"}const UH=new H3;class BH{constructor(e,n,r,i){this._provider=e,this.name=n,this.version=r,this.options=i}startSpan(e,n,r){return this._getTracer().startSpan(e,n,r)}startActiveSpan(e,n,r,i){const s=this._getTracer();return Reflect.apply(s.startActiveSpan,s,arguments)}_getTracer(){if(this._delegate)return this._delegate;const e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):UH}}class FH{getTracer(e,n,r){return new H3}}const YH=new FH;class BE{getTracer(e,n,r){var i;return(i=this.getDelegateTracer(e,n,r))!==null&&i!==void 0?i:new BH(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:YH}setDelegate(e){this._delegate=e}getDelegateTracer(e,n,r){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(e,n,r)}}var VO;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(VO||(VO={}));exports.SpanKind=void 0;(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(exports.SpanKind||(exports.SpanKind={}));exports.SpanStatusCode=void 0;(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(exports.SpanStatusCode||(exports.SpanStatusCode={}));const po=kd.getInstance(),ct=Hi.instance();class GH{getMeter(e,n,r){return Z3}}const HH=new GH,_0="metrics";class FP{constructor(){}static getInstance(){return this._instance||(this._instance=new FP),this._instance}setGlobalMeterProvider(e){return Qp(_0,e,Hi.instance())}getMeterProvider(){return nc(_0)||HH}getMeter(e,n,r){return this.getMeterProvider().getMeter(e,n,r)}disable(){Rp(_0,Hi.instance())}}const J3=FP.getInstance();class JH{inject(e,n){}extract(e,n){return e}fields(){return[]}}const YP=WP("OpenTelemetry Baggage Key");function K3(t){return t.getValue(YP)||void 0}function KH(){return K3(kd.getInstance().active())}function eJ(t,e){return t.setValue(YP,e)}function tJ(t){return t.deleteValue(YP)}const D0="propagation",nJ=new JH;class GP{constructor(){this.createBaggage=vH,this.getBaggage=K3,this.getActiveBaggage=KH,this.setBaggage=eJ,this.deleteBaggage=tJ}static getInstance(){return this._instance||(this._instance=new GP),this._instance}setGlobalPropagator(e){return Qp(D0,e,Hi.instance())}inject(e,n,r=NH){return this._getGlobalPropagator().inject(e,n,r)}extract(e,n,r=DH){return this._getGlobalPropagator().extract(e,n,r)}fields(){return this._getGlobalPropagator().fields()}disable(){Rp(D0,Hi.instance())}_getGlobalPropagator(){return nc(D0)||nJ}}const Hf=GP.getInstance(),N0="trace";class HP{constructor(){this._proxyTracerProvider=new BE,this.wrapSpanContext=ZH,this.isSpanContextValid=Ey,this.deleteSpan=LH,this.getSpan=UP,this.getActiveSpan=VH,this.getSpanContext=F3,this.setSpan=BP,this.setSpanContext=XH}static getInstance(){return this._instance||(this._instance=new HP),this._instance}setGlobalTracerProvider(e){const n=Qp(N0,this._proxyTracerProvider,Hi.instance());return n&&this._proxyTracerProvider.setDelegate(e),n}getTracerProvider(){return nc(N0)||this._proxyTracerProvider}getTracer(e,n){return this.getTracerProvider().getTracer(e,n)}disable(){Rp(N0,Hi.instance()),this._proxyTracerProvider=new BE}}const jr=HP.getInstance(),ri={FS:"fs",WEB:"web"};class Ht{static utils=null;static async getUtils(){return Ht.utils||(Ht.utils=hn()?await Promise.resolve().then(()=>require("./replay-tauri-path-iA6pF5e0.js")):{join:Qa.join,resolve:Qa.resolve,isAbsolute:Qa.isAbsolute,relative:Qa.relative,extname:Qa.extname,dirname:Qa.dirname}),Ht.utils}static async dirname(e){return(await Ht.getUtils()).dirname(e)}static async join(...e){return(await Ht.getUtils()).join(...e)}static async resolve(e){return(await Ht.getUtils()).resolve(e)}static async isAbsolute(e){return(await Ht.getUtils()).isAbsolute(e)}static async relative(e,n){return(await Ht.getUtils()).relative(e,n)}static async extname(e){return(await Ht.getUtils()).extname(e)}}async function LO(t,e){const[{bundle:n,Config:r},{ExternalResolver:i}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-yAV5TCua.js")),Promise.resolve().then(()=>require("./replay-external-resolver-PLyV0HZs.js"))]),s=new r({});s.getRulesForSpecVersion=()=>[];const o=await Ht.dirname(t),a={config:s,base:o,externalRefResolver:new i,dereference:!0};e?a.doc={source:{absoluteRef:t},parsed:e}:a.ref=t;const{bundle:{parsed:l},fileDependencies:c}=await n(a);return{definition:l,fileDependencies:c}}function e4(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function PS(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function t4(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function Li(t){try{return new URL(t),!0}catch{return!1}}function rJ(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(e4(e))n=e;else if(!e.startsWith("/"))n=PS(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return PS(n)}function FE(t,e){let n=t;return e.forEach(({key:r,value:i,active:s})=>{i&&s&&(n=n.replaceAll(`{${r}}`,i))}),n}function n4(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function iJ(t){return t.startsWith("http://")||t.startsWith("https://")}function $g({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(iJ(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}class kS{constructor(e){this.baseDir=e}baseDir;writeExcludedKeys=new Set;setWriteExcludedKeys(e){this.writeExcludedKeys=e}async ls(e=""){const n=this.makeKey(e);return Object.keys(localStorage).filter(r=>r.startsWith(n)).map(r=>r.replace(n,""))}async get(e){const n=this.makeKey(e);return localStorage.getItem(n)??null}async has(e){const n=this.makeKey(e);return localStorage.getItem(n)!==null}async set(e,n){if(this.writeExcludedKeys.has(e))return;const r=this.makeKey(e);localStorage.setItem(r,n)}async remove(e){if(this.writeExcludedKeys.has(e))return;const n=this.makeKey(e);localStorage.removeItem(n)}async rename(e,n){const r=this.makeKey(e),i=this.makeKey(n),s=localStorage.getItem(r);s!==null&&(localStorage.setItem(i,s),localStorage.removeItem(r))}makeKey(e){return`replay:fs:${this.baseDir}/${e}`}on(e,n){}off(e,n){}}class sJ{baseDir="";async ls(e=""){return[]}async get(e){return null}async has(e){return!1}async set(e,n){}async remove(e){}async rename(e,n){}setWriteExcludedKeys(e){}on(e,n){}off(e,n){}}class oJ{constructor(e){this.projectId=e}projectId;async get(){const e=this.getKey();return localStorage.getItem(e)??null}async set(e){const n=this.getKey();localStorage.setItem(n,e)}async remove(){const e=this.getKey();localStorage.removeItem(e)}getKey(){return`replay:secrets:${this.projectId}`}}class r4{constructor(e){this.storage=e}storage;itemIds=[];async getAbsolutePath(e){return await Ht.resolve(await Ht.join(this.storage.baseDir,"/",e))}async parseMany(e,n){return(await Promise.all(e.map(async i=>{try{return await this.parse(i,n)}catch(s){return console.error(`Error parsing from ${i.type} ${i.uri}:`,s),null}}))).filter(i=>i!==null)}setItemIds(e){this.itemIds=e}async write(e){e.state===jt.Draft||e.srcType!==ri.FS||await this.storage.set(e.id,await this.stringify(e))}async remove(e){await this.storage.remove(e)}async updateRoot(e,n){const r=e.actions;if(r){for(const s in r){const o=parseInt(s);switch(r[s]){case"D":await this.remove(this.itemIds[o]);break;case"I":case"U":await this.write(n[o]);break}}return}const i=this.itemIds.filter(s=>!n.some(o=>o.id===s));await Promise.all([...n.map(s=>this.write(s)),...i.map(s=>this.remove(s))])}async update(e,n){const i={path:e.path.slice(1),actions:e.actions};if(i.path.length===0&&await this.updateRoot(i,n),i.path.length>0){const s=i.path[0];i.path.length===1&&i.actions&&i.actions.id==="U"&&await this.remove(this.itemIds[s]),i.path[1]&&i.path[1]==="id"&&await this.remove(this.itemIds[s]),await this.write(n[s])}this.itemIds=n.map(s=>s.id)}}class aJ extends r4{parse(e){return{...e.content,id:e.uri,srcType:e.type,fileDependencies:e.fileDependencies}}async stringify(e){const{id:n,srcType:r,fileDependencies:i,...s}=e;return await Ht.extname(n)===".json"?JSON.stringify(s,null,2):Ja.dump(s)}async write(e){await this.storage.has(e.id)||await super.write(e)}}var ar=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(ar||{});class XO{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 lJ{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}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 i4{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new lJ(this)}push(e,n=null,r=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const i=this.path.length;this.siblingStacks[i]||(this.siblingStacks[i]=new Map);const s=this.siblingStacks[i],o=r?`${r}:${e}`:e,a=s.get(o)||0;let l=0;for(const u of s.values())l+=u;s.set(o,a+1);const c={tag:e,position:l,counter:a};r!=null&&(c.namespace=r),n!=null&&(c.values=n),this.path.push(c)}pop(){if(this.path.length===0)return;this._pathStringCache=null;const e=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),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}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=[]}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=>new Map(e))}}restore(e){this._pathStringCache=null,this.path=e.path.map(n=>({...n})),this.siblingStacks=e.siblingStacks.map(n=>new Map(n))}readOnly(){return this._view}}function s4(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function o4(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function Bu(t){return String(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const a4=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",cJ=a4+"\\-\\.\\d·̀-ͯ‿-⁀",l4=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",uJ=l4+"\\-\\.\\d·̀-ͯ҇‿-⁀",c4=(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)}},dJ=c4(a4,cJ),fJ=c4(l4,uJ,"u"),hJ=(t="1.0")=>t==="1.1"?fJ:dJ,u4=(t,{xmlVersion:e="1.0"}={})=>hJ(e).qName.test(t),pJ=`
111
111
  `;function gJ(t,e){if(!Array.isArray(t)||t.length===0)return"1.0";const n=t[0];if(JP(n)==="?xml"){const i=n[":@"];if(i){const s=e.attributeNamePrefix+"version";if(i[s])return i[s]}}return"1.0"}function d4(t,e,n,r,i){return!n.sanitizeName||u4(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}function mJ(t,e){let n="";e.format&&(n=pJ);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 XO(a)):a instanceof XO&&r.push(a)}const i=gJ(t,e),s=new i4;return f4(t,e,n,s,r,i)}function f4(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=TS(l,e),l}return""}for(let l=0;l<t.length;l++){const c=t[l],u=JP(c);if(u===void 0)continue;const h=u===e.textNodeName||u===e.cdataPropName||u===e.commentPropName||u[0]==="?"?u:d4(u,!1,e,r,s),p=OJ(c[":@"],e);r.push(h,p);const m=yJ(r,i);if(h===e.textNodeName){let x=c[u];m||(x=e.tagValueProcessor(h,x),x=TS(x,e)),a&&(o+=n),o+=x,a=!1,r.pop();continue}else if(h===e.cdataPropName){a&&(o+=n);const x=c[u][0][e.textNodeName],P=o4(x);o+=`<![CDATA[${P}]]>`,a=!1,r.pop();continue}else if(h===e.commentPropName){const x=c[u][0][e.textNodeName],P=s4(x);o+=n+`<!--${P}-->`,a=!0,r.pop();continue}else if(h[0]==="?"){const x=YE(c[":@"],e,m,r,s);o+=(h==="?xml"?"":n)+`<${h}${x}?>`,a=!0,r.pop();continue}let g=n;g!==""&&(g+=e.indentBy);const O=YE(c[":@"],e,m,r,s),v=n+`<${h}${O}`;let b;m?b=h4(c[u],e):b=f4(c[u],e,g,r,i,s),e.unpairedTags.indexOf(h)!==-1?e.suppressUnpairedNode?o+=v+">":o+=v+"/>":(!b||b.length===0)&&e.suppressEmptyNode?o+=v+"/>":b&&b.endsWith(">")?o+=v+`>${b}${n}</${h}>`:(o+=v+">",b&&n!==""&&(b.includes("/>")||b.includes("</"))?o+=n+e.indentBy+b+n:o+=b,o+=`</${h}>`),a=!0,r.pop()}return o}function OJ(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]=Bu(t[i]),r=!0}return r?n:null}function h4(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=JP(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=vJ(i[":@"],e),a=h4(i[s],e);!a||a.length===0?n+=`<${s}${o}/>`:n+=`<${s}${o}>${a}</${s}>`}}}return n}function vJ(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)}="${Bu(i)}"`}return n}function JP(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 YE(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:d4(a,!0,e,r,i);let c;n?c=t[o]:(c=e.attributeValueProcessor(o,t[o]),c=TS(c,e)),c===!0&&e.suppressBooleanAttributes?s+=` ${l}`:s+=` ${l}="${Bu(c)}"`}return s}function yJ(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 TS(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 bJ(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 xJ={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 Ei(t){if(this.options=Object.assign({},xJ,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 XO(n)):n instanceof XO&&this.stopNodeExpressions.push(n)}this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=bJ(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=PJ),this.processTextOrObjNode=wJ,this.options.format?(this.indentate=CJ,this.tagEndChar=`>
112
112
  `,this.newLine=`
113
113
  `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function SJ(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 M0(t,e,n,r,i){return!n.sanitizeName||u4(t,{xmlVersion:i})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}Ei.prototype.build=function(t){if(this.options.preserveOrder)return mJ(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new i4,n=SJ(t,this.options);return this.j2x(t,0,e,n).val}};Ei.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:M0(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=M0(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=M0(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}};Ei.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+'="'+Bu(e)+'"'};function wJ(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)}Ei.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]=Bu(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]=Bu(t[r]),n=!0)}return n?e:null};Ei.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};Ei.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};Ei.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}};Ei.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};Ei.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};Ei.prototype.buildTextValNode=function(t,e,n,r,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName){const s=o4(t);return this.indentate(r)+`<![CDATA[${s}]]>`+this.newLine}else if(this.options.commentPropName!==!1&&e===this.options.commentPropName){const s=s4(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}}};Ei.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 CJ(t){return this.options.indentBy.repeat(t)}function PJ(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}const jp={active:!0,key:"",value:""},kJ=/[\n\r\t]/g;function p4(t){return t.replace(kJ,"").trim()}function no(t,e){return t.map(n=>{const r=e.boundNames==="all"||!!e.boundNames?.has(n.name);return{id:crypto.randomUUID(),key:n.name,value:r?`$inputs.${n.name}`:n.example?p4(String(n.example)):"",active:r?!0:!!n.example,in:n.in,...n.allowReserved&&{allowReserved:n.allowReserved}}})}function _p(t,e){const[n]=t.split("?"),r=e.filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${n}${r?`?${r}`:""}`}function Dp(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 g4(){return{id:crypto.randomUUID(),...jp}}function TJ(){return{id:crypto.randomUUID(),...jp,description:""}}function WO(t){return{...jp,id:crypto.randomUUID(),in:t}}function $J(){return{id:crypto.randomUUID(),...jp,type:"text",files:null}}function IJ(){return{id:crypto.randomUUID(),...jp,sendIn:Tr.URL}}function z0(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function Ay(t,e){return t.filter(n=>n.active&&n.value).map(({value:n})=>(e?cn(n,e):n).trim())}function Za(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 EJ(t,e,n){return t.map(({value:r,...i})=>({...i,value:Lu(r,e,n??{})}))}function AJ(t,e){if(!t.startsWith("$components.parameters."))return null;const n=t.replace("$components.parameters.","");return n&&e[n]||null}function pn(t=[],e={}){const n=[];for(const r of t)if(Fl(r)){const i=AJ(r.reference,e);i&&n.push({...i,active:r.active,value:r.value||i.value})}else n.push(r);return n}function Ra(t){return Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:n}))}function m4(t){return t.schema}function O4(t){return m4(t)?.fields??[]}function v4(t,e){return t.flatMap(n=>{const r=m4(n),i=r?.fields||[];return i.length>0?i.flatMap(s=>GE(s.name,s.example,n.allowReserved)):GE(n.name,r?.example??n.example,n.allowReserved)})}function GE(t,e,n){if(e===void 0)return[V0(t,"",!1,n)];const r=$S(e,t);return r.length===0?[V0(t,"",!1,n)]:r.map(i=>V0(i.key,i.value,!0,n))}function $S(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((n,r)=>n!==null&&typeof n=="object"?$S(n,`${e}[${r}]`):[{key:e,value:String(n)}]):QJ(t)?Object.entries(t).flatMap(([n,r])=>$S(r,`${e}[${n}]`)):[{key:e,value:String(t)}]}function QJ(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function V0(t,e,n,r){return{id:crypto.randomUUID(),key:t,value:p4(e),active:n,in:"query",...r&&{allowReserved:r}}}const y4={path:"path",query:"query",header:"headers",cookie:"cookie"};function KP(t){return t!==void 0}function RJ(t,e){if(t)return oy.isDirectConfigureRequestValues(t)?t:t[e]}function HE(t,e,n){const r=n[y4[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 Tu(t,e,n){if(oy.isDirectConfigureRequestValues(n))return HE(t,e,n);const r=new Set;for(const i of Object.values(n))if(i)for(const s of HE(t,e,i))r.add(s);return r}function JE(t,e,n){const r=n.query,i=n.envVariables;for(const s of e??[]){const o=O4(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 b4(t,e,n){const r=[...t??[],...e??[]],i=new Set(Tu(r,"query",n));if(oy.isDirectConfigureRequestValues(n))return JE(i,e,n),i;for(const s of Object.values(n))s&&JE(i,e,s);return i}const x4=1024;let jJ=0,Zi=class{constructor(e,n){this.from=e,this.to=n}};class yt{constructor(e={}){this.id=jJ++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Ir.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}yt.closedBy=new yt({deserialize:t=>t.split(" ")});yt.openedBy=new yt({deserialize:t=>t.split(" ")});yt.group=new yt({deserialize:t=>t.split(" ")});yt.isolate=new yt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});yt.contextHash=new yt({perNode:!0});yt.lookAhead=new yt({perNode:!0});yt.mounted=new yt({perNode:!0});class Ah{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[yt.mounted.id]}}const _J=Object.create(null);class Ir{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):_J,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Ir(e.name||"",n,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(yt.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(yt.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}Ir.none=new Ir("",Object.create(null),0,8);class Qy{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let i=null;for(let s of e){let o=s(r);o&&(i||(i=Object.assign({},r.props)),i[o[0].id]=o[1])}n.push(i?new Ir(r.name,i,r.id,r.flags):r)}return new Qy(n)}}const Ig=new WeakMap,KE=new WeakMap;var rn;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(rn||(rn={}));let on=class IS{constructor(e,n,r,i,s){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=Ah.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new ZO(this.topNode,e)}cursorAt(e,n=0,r=0){let i=Ig.get(this)||this.topNode,s=new ZO(i);return s.moveTo(e,n),Ig.set(this,s._tree),s}get topNode(){return new Ji(this,0,0,null)}resolve(e,n=0){let r=Qh(Ig.get(this)||this.topNode,e,n,!1);return Ig.set(this,r),r}resolveInner(e,n=0){let r=Qh(KE.get(this)||this.topNode,e,n,!0);return KE.set(this,r),r}resolveStack(e,n=0){return MJ(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&rn.IncludeAnonymous)>0;for(let l=this.cursor(o|rn.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:nk(Ir.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new IS(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new IS(Ir.none,n,r,i)))}static build(e){return zJ(e)}};on.empty=new on(Ir.none,[],[],0);class ek{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ek(this.buffer,this.index)}}class Ka{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Ir.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,n,r,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=n&&!(S4(s,i,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let a=e,l=0;a<n;){s[l++]=i[a++],s[l++]=i[a++]-r;let c=s[l++]=i[a++]-r;s[l++]=i[a++]-e,o=Math.max(o,c)}return new Ka(s,o,this.set)}}function S4(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Qh(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof Ji&&t.index<0?null:t.parent;if(!o)return t;t=o}let s=r?0:rn.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof Ji&&o.index<0&&((i=a.enter(e,n,s))===null||i===void 0?void 0:i.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,n,s);if(!o)return t;t=o}}class w4{cursor(e=0){return new ZO(this,e)}getChild(e,n=null,r=null){let i=eA(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return eA(this,e,n,r)}resolve(e,n=0){return Qh(this,e,n,!1)}resolveInner(e,n=0){return Qh(this,e,n,!0)}matchContext(e){return ES(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}let Ji=class Nm extends w4{constructor(e,n,r,i){super(),this._tree=e,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,i,s=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=n>0?a.length:-1;e!=c;e+=n){let u=a[e],f=l[e]+o.from;if(S4(i,r,f,f+u.length)){if(u instanceof Ka){if(s&rn.ExcludeBuffers)continue;let h=u.findChild(0,u.buffer.length,n,r-f,i);if(h>-1)return new oo(new DJ(o,u,e,f),null,h)}else if(s&rn.IncludeAnonymous||!u.type.isAnonymous||tk(u)){let h;if(!(s&rn.IgnoreMounts)&&(h=Ah.get(u))&&!h.overlay)return new Nm(h.tree,f,e,o);let p=new Nm(u,f,e,o);return s&rn.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?u.children.length-1:0,n,r,i)}}}if(s&rn.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let i;if(!(r&rn.IgnoreOverlays)&&(i=Ah.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:a}of i.overlay)if((n>0?o<=s:o<s)&&(n<0?a>=s:a>s))return new Nm(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function eA(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function ES(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class DJ{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class oo extends w4{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new oo(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&rn.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new oo(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new oo(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new oo(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),n.push(0)}return new on(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function C4(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;s<t.length;s++){let o=t[s];(o.from>n.from||o.to<n.to)&&(n=o,e=s)}let r=n instanceof Ji&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new NJ(i,n)}class NJ{constructor(e,n){this.heads=e,this.node=n}get next(){return C4(this.heads)}}function MJ(t,e,n){let r=t.resolveInner(e,n),i=null;for(let s=r instanceof Ji?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,n)),s=o}else{let o=Ah.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Ji(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(Qh(a,e,n,!1))}}return i?C4(i):r}class ZO{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ji)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Ji?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&rn.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&rn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&rn.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let s=n+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&rn.IncludeAnonymous||a instanceof Ka||!a.type.isAnonymous||tk(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)n=new oo(this.buffer,n,this.stack[i]);return this.bufferNode=new oo(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return ES(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return ES(this._tree,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function tk(t){return t.children.some(e=>e instanceof Ka||!e.type.isAnonymous||tk(e))}function zJ(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=x4,reused:s=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(n)?new ek(n,n.length):n,l=r.types,c=0,u=0;function f(S,k,T,$,A,_){let{id:D,start:Q,end:M,size:N}=a,z=u,E=c;for(;N<0;)if(a.next(),N==-1){let q=s[D];T.push(q),$.push(Q-S);return}else if(N==-3){c=D;return}else if(N==-4){u=D;return}else throw new RangeError(`Unrecognized record size: ${N}`);let L=l[D],V,B,Z=Q-S;if(M-Q<=i&&(B=O(a.pos-k,A))){let q=new Uint16Array(B.size-B.skip),F=a.pos-B.size,Y=q.length;for(;a.pos>F;)Y=v(B.start,q,Y);V=new Ka(q,M-B.start,r),Z=B.start-S}else{let q=a.pos-N;a.next();let F=[],Y=[],ne=D>=o?D:-1,J=0,se=M;for(;a.pos>q;)ne>=0&&a.id==ne&&a.size>=0?(a.end<=se-i&&(m(F,Y,Q,J,a.end,se,ne,z,E),J=F.length,se=a.end),a.next()):_>2500?h(Q,q,F,Y):f(Q,q,F,Y,ne,_+1);if(ne>=0&&J>0&&J<F.length&&m(F,Y,Q,J,Q,se,ne,z,E),F.reverse(),Y.reverse(),ne>-1&&J>0){let H=p(L,E);V=nk(L,F,Y,0,F.length,0,M-Q,H,H)}else V=g(L,F,Y,M-Q,z-M,E)}T.push(V),$.push(Z)}function h(S,k,T,$){let A=[],_=0,D=-1;for(;a.pos>k;){let{id:Q,start:M,end:N,size:z}=a;if(z>4)a.next();else{if(D>-1&&M<D)break;D<0&&(D=N-i),A.push(Q,M,N),_++,a.next()}}if(_){let Q=new Uint16Array(_*4),M=A[A.length-2];for(let N=A.length-3,z=0;N>=0;N-=3)Q[z++]=A[N],Q[z++]=A[N+1]-M,Q[z++]=A[N+2]-M,Q[z++]=z;T.push(new Ka(Q,A[2]-M,r)),$.push(M-S)}}function p(S,k){return(T,$,A)=>{let _=0,D=T.length-1,Q,M;if(D>=0&&(Q=T[D])instanceof on){if(!D&&Q.type==S&&Q.length==A)return Q;(M=Q.prop(yt.lookAhead))&&(_=$[D]+Q.length+M)}return g(S,T,$,A,_,k)}}function m(S,k,T,$,A,_,D,Q,M){let N=[],z=[];for(;S.length>$;)N.push(S.pop()),z.push(k.pop()+T-A);S.push(g(r.types[D],N,z,_-A,Q-_,M)),k.push(A-T)}function g(S,k,T,$,A,_,D){if(_){let Q=[yt.contextHash,_];D=D?[Q].concat(D):[Q]}if(A>25){let Q=[yt.lookAhead,A];D=D?[Q].concat(D):[Q]}return new on(S,k,T,$,D)}function O(S,k){let T=a.fork(),$=0,A=0,_=0,D=T.end-i,Q={size:0,start:0,skip:0};e:for(let M=T.pos-S;T.pos>M;){let N=T.size;if(T.id==k&&N>=0){Q.size=$,Q.start=A,Q.skip=_,_+=4,$+=4,T.next();continue}let z=T.pos-N;if(N<0||z<M||T.start<D)break;let E=T.id>=o?4:0,L=T.start;for(T.next();T.pos>z;){if(T.size<0)if(T.size==-3)E+=4;else break e;else T.id>=o&&(E+=4);T.next()}A=L,$+=N,_+=E}return(k<0||$==S)&&(Q.size=$,Q.start=A,Q.skip=_),Q.size>4?Q:void 0}function v(S,k,T){let{id:$,start:A,end:_,size:D}=a;if(a.next(),D>=0&&$<o){let Q=T;if(D>4){let M=a.pos-(D-4);for(;a.pos>M;)T=v(S,k,T)}k[--T]=Q,k[--T]=_-S,k[--T]=A-S,k[--T]=$}else D==-3?c=$:D==-4&&(u=$);return T}let b=[],x=[];for(;a.pos>0;)f(t.start||0,t.bufferStart||0,b,x,-1,0);let P=(e=t.length)!==null&&e!==void 0?e:b.length?x[0]+b[0].length:0;return new on(l[t.topID],b.reverse(),x.reverse(),P)}const tA=new WeakMap;function Mm(t,e){if(!t.isAnonymous||e instanceof Ka||e.type!=t)return 1;let n=tA.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof on)){n=1;break}n+=Mm(t,r)}tA.set(e,n)}return n}function nk(t,e,n,r,i,s,o,a,l){let c=0;for(let m=r;m<i;m++)c+=Mm(t,e[m]);let u=Math.ceil(c*1.5/8),f=[],h=[];function p(m,g,O,v,b){for(let x=O;x<v;){let P=x,S=g[x],k=Mm(t,m[x]);for(x++;x<v;x++){let T=Mm(t,m[x]);if(k+T>=u)break;k+=T}if(x==P+1){if(k>u){let T=m[P];p(T.children,T.positions,0,T.children.length,g[P]+b);continue}f.push(m[P])}else{let T=g[x-1]+m[x-1].length-S;f.push(nk(t,m,g,P,x,S,T,null,l))}h.push(S+b-s)}}return p(e,n,r,i,0),(a||l)(f,h,o)}class rk{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof oo?this.setBuffer(e.context.buffer,e.index,n):e instanceof Ji&&this.map.set(e.tree,n)}get(e){return e instanceof oo?this.getBuffer(e.context.buffer,e.index):e instanceof Ji?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Ho{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new Ho(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<n.length?n[a]:null,f=u?u.fromA:1e9;if(f-l>=r)for(;o&&o.from<f;){let h=o;if(l>=h.from||f<=h.to||c){let p=Math.max(h.from,l)-c,m=Math.min(h.to,f)-c;h=p>=m?null:new Ho(p,m,h.tree,h.offset+c,a>0,!!u)}if(h&&i.push(h),o.to>f)break;o=s<e.length?e[s++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}let ik=class{startParse(e,n,r){return typeof e=="string"&&(e=new VJ(e)),r=r?r.length?r.map(i=>new Zi(i.from,i.to)):[new Zi(0,0)]:[new Zi(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}};class VJ{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}function LJ(t){return(e,n,r,i)=>new WJ(e,t,n,r,i)}class nA{constructor(e,n,r,i,s){this.parser=e,this.parse=n,this.overlay=r,this.target=i,this.from=s}}function rA(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class XJ{constructor(e,n,r,i,s,o,a){this.parser=e,this.predicate=n,this.mounts=r,this.index=i,this.start=s,this.target=o,this.prev=a,this.depth=0,this.ranges=[]}}const AS=new yt({perNode:!0});class WJ{constructor(e,n,r,i,s){this.nest=n,this.input=r,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new on(r.type,r.children,r.positions,r.length,r.propValues.concat([[AS,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],n=e.parse.advance();if(n){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[yt.mounted.id]=new Ah(n,e.overlay,e.parser),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].from<e&&(e=Math.min(e,this.inner[n].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].parse.stopAt(e)}startInner(){let e=new UJ(this.fragments),n=null,r=null,i=new ZO(new Ji(this.baseTree,this.ranges[0].from,0,null),rn.IncludeAnonymous|rn.IgnoreMounts);e:for(let s,o;;){let a=!0,l;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(n){let c=n.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let f=u.from+c.pos,h=u.to+c.pos;f>=i.from&&h<=i.to&&!n.ranges.some(p=>p.from<h&&p.to>f)&&n.ranges.push({from:f,to:h})}}a=!1}else if(r&&(o=ZJ(r.ranges,i.from,i.to)))a=o!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||qJ(i);let c=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")n=new XJ(s.parser,s.overlay,c,this.inner.length,i.from,i.tree,n);else{let u=oA(this.ranges,s.overlay||(i.from<i.to?[new Zi(i.from,i.to)]:[]));u.length&&rA(u),(u.length||!s.overlay)&&this.inner.push(new nA(s.parser,u.length?s.parser.startParse(this.input,aA(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(f=>new Zi(f.from-i.from,f.to-i.from)):null,i.tree,u.length?u[0].from:i.from)),s.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):a=!1}}else if(n&&(l=n.predicate(i))&&(l===!0&&(l=new Zi(i.from,i.to)),l.from<l.to)){let c=n.ranges.length-1;c>=0&&n.ranges[c].to==l.from?n.ranges[c]={from:n.ranges[c].from,to:l.to}:n.ranges.push(l)}if(a&&i.firstChild())n&&n.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(n&&!--n.depth){let c=oA(this.ranges,n.ranges);c.length&&(rA(c),this.inner.splice(n.index,0,new nA(n.parser,n.parser.startParse(this.input,aA(n.mounts,c),c),n.ranges.map(u=>new Zi(u.from-n.start,u.to-n.start)),n.target,c[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function ZJ(t,e,n){for(let r of t){if(r.from>=n)break;if(r.to>e)return r.from<=e&&r.to>=n?2:1}return 0}function iA(t,e,n,r,i,s){if(e<n){let o=t.buffer[e+1];r.push(t.slice(e,n,o)),i.push(o-s)}}function qJ(t){let{node:e}=t,n=[],r=e.context.buffer;do n.push(t.index),t.parent();while(!t.tree);let i=t.tree,s=i.children.indexOf(r),o=i.children[s],a=o.buffer,l=[s];function c(u,f,h,p,m,g){let O=n[g],v=[],b=[];iA(o,u,O,v,b,p);let x=a[O+1],P=a[O+2];l.push(v.length);let S=g?c(O+4,a[O+3],o.set.types[a[O]],x,P-x,g-1):e.toTree();return v.push(S),b.push(x-p),iA(o,a[O+3],f,v,b,p),new on(h,v,b,m)}i.children[s]=c(0,a.length,Ir.none,0,o.length,n.length-1);for(let u of l){let f=t.tree.children[u],h=t.tree.positions[u];t.yield(new Ji(f,h+t.from,u,t._tree))}}class sA{constructor(e,n){this.offset=n,this.done=!1,this.cursor=e.cursor(rn.IncludeAnonymous|rn.IgnoreMounts)}moveTo(e){let{cursor:n}=this,r=e-this.offset;for(;!this.done&&n.from<r;)n.to>=e&&n.enter(r,1,rn.IgnoreOverlays|rn.ExcludeBuffers)||n.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==e.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof on)n=n.children[0];else break}return!1}}let UJ=class{constructor(e){var n;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(n=r.tree.prop(AS))!==null&&n!==void 0?n:r.to,this.inner=new sA(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(e=n.tree.prop(AS))!==null&&e!==void 0?e:n.to,this.inner=new sA(n.tree,-n.offset)}}findMounts(e,n){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(r=s.tree)===null||r===void 0?void 0:r.prop(yt.mounted);if(o&&o.parser==n)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=s.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:s.from-l.offset,mount:o})}}}return i}};function oA(t,e){let n=null,r=e;for(let i=1,s=0;i<t.length;i++){let o=t[i-1].to,a=t[i].from;for(;s<r.length;s++){let l=r[s];if(l.from>=a)break;l.to<=o||(n||(r=n=e.slice()),l.from<o?(n[s]=new Zi(l.from,o),l.to>a&&n.splice(s+1,0,new Zi(a,l.to))):l.to>a?n[s--]=new Zi(a,l.to):n.splice(s--,1))}}return r}function BJ(t,e,n,r){let i=0,s=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let u=i==t.length?1e9:o?t[i].to:t[i].from,f=s==e.length?1e9:a?e[s].to:e[s].from;if(o!=a){let h=Math.max(l,n),p=Math.min(u,f,r);h<p&&c.push(new Zi(h,p))}if(l=Math.min(u,f),l==1e9)break;u==l&&(o?(o=!1,i++):o=!0),f==l&&(a?(a=!1,s++):a=!0)}return c}function aA(t,e){let n=[];for(let{pos:r,mount:i,frag:s}of t){let o=r+(i.overlay?i.overlay[0].from:0),a=o+i.tree.length,l=Math.max(s.from,o),c=Math.min(s.to,a);if(i.overlay){let u=i.overlay.map(h=>new Zi(h.from+r,h.to+r)),f=BJ(e,u,l,c);for(let h=0,p=l;;h++){let m=h==f.length,g=m?c:f[h].from;if(g>p&&n.push(new Ho(p,g,i.tree,-o,s.from>=p||s.openStart,s.to<=g||s.openEnd)),m)break;p=f[h].to}}else n.push(new Ho(l,c,i.tree,-o,s.from>=o||s.openStart,s.to<=a||s.openEnd))}return n}class qO{constructor(e,n,r,i,s,o,a,l,c,u=0,f){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new qO(e,[],n,r,r,0,[],0,i?new lA(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25;o&&this.setLookAhead(this.pos);let a=s.dynamicPrecedence(i);if(a&&(this.score+=a),r==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(i,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,u=this.reducePos-c;u>=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=u));let f=l?this.stack[l-1]:0,h=this.bufferBase+this.buffer.length-f;if(i<s.minRepeatTerm||e&131072){let p=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,p,h+4,!0)}if(e&262144)this.state=this.stack[l];else{let p=this.stack[l-3];this.state=s.getGoto(p,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,c)}storeNode(e,n,r,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(n==r)return;if(o.buffer[a-2]>=n){o.buffer[a-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,n,r,i);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;(i>this.pos||n<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,r),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,i,4)}else this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4)}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new qO(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new FJ(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,o;s<n.length;s+=2)(o=n[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(n[s],o);if(this.stack.length<120)for(let s=0;i.length<8&&s<n.length;s+=2){let o=n[s+1];i.some((a,l)=>l&1&&a==o)||i.push(n[s],o)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let s=n[i+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(n[i],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if((n&65536)==0)return!1;if(!e.validAction(this.state,n)){let r=n>>19,i=n&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,s+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new lA(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class lA{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class FJ{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class UO{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new UO(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new UO(this.stack,this.pos,this.index)}}function Ef(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let s=0;for(;;){let o=t.charCodeAt(r++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}n?n[i++]=s:n=new e(s)}return n}class zm{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const cA=new zm;class YJ{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=cA,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<r.from;){if(!i)return null;let o=this.ranges[--i];s-=r.from-o.to,r=o}for(;n<0?s>r.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(n);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(r=s,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=cA,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class $u{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;P4(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}$u.prototype.contextual=$u.prototype.fallback=$u.prototype.extend=!1;class BO{constructor(e,n,r){this.precTable=n,this.elseToken=r,this.data=typeof e=="string"?Ef(e):e}token(e,n){let r=e.pos,i=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(P4(this.data,e,n,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,o==null)break;e.reset(o,e.token)}i&&(e.reset(r,e.token),e.acceptToken(this.elseToken,i))}}BO.prototype.contextual=$u.prototype.fallback=$u.prototype.extend=!1;class Dn{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function P4(t,e,n,r,i,s){let o=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;(a&t[o])!=0;){let c=t[o+1];for(let p=o+3;p<c;p+=2)if((t[p+1]&a)>0){let m=t[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||GJ(m,e.token.value,i,s))){e.acceptToken(m);break}}let u=e.next,f=0,h=t[o+2];if(e.next<0&&h>f&&t[c+h*3-3]==65535){o=t[c+h*3-1];continue e}for(;f<h;){let p=f+h>>1,m=c+p+(p<<1),g=t[m],O=t[m+1]||65536;if(u<g)h=p;else if(u>=O)f=p+1;else{o=t[m+2],e.advance();continue e}}break}}function uA(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function GJ(t,e,n,r){let i=uA(n,r,e);return i<0||uA(n,r,t)<i}const hi=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let L0=null;function dA(t,e,n){let r=t.cursor(rn.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class HJ{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?dA(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?dA(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],i=this.index[n];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[i],o=this.start[n]+r.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof on){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(yt.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[n]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}}class JJ{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new zm)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<s.length;c++){if((1<<c&o)==0)continue;let u=s[c],f=this.tokens[c];if(!(r&&!u.fallback)&&((u.contextual||f.start!=e.pos||f.mask!=o||f.context!=a)&&(this.updateCachedToken(f,u,e),f.mask=o,f.context=a),f.lookAhead>f.end+25&&(l=Math.max(f.lookAhead,l)),f.value!=0)){let h=n;if(f.extended>-1&&(n=this.addActions(e,f.extended,f.end,n)),n=this.addActions(e,f.value,f.end,n),!u.extend&&(r=f,n>h))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new zm,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new zm,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.specializers[o](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=n,this.actions[i++]=r,i}addActions(e,n,r,i){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(s,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=qo(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(qo(a,c+2),n,r,i));break}a[c]==n&&(i=this.putAction(qo(a,c+1),n,r,i))}return i}}let KJ=class{constructor(e,n,r,i){this.parser=e,this.input=n,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new YJ(n,i),this.tokens=new JJ(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[qO.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new HJ(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>n)r.push(a);else{if(this.advanceStack(a,r,e))continue;{i||(i=[],s=[]),i.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!r.length){let o=i&&tK(i);if(o)return hi&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw hi&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return hi&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,l)=>l.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let l=o+1;l<r.length;l++){let c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(o--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let o=1;o<r.length;o++)r[o].pos<this.minStackPos&&(this.minStackPos=r[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let i=e.pos,{parser:s}=this,o=hi?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let h=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(e.state,f.type.id):-1;if(h>-1&&f.length&&(!c||(f.prop(yt.contextHash)||0)==u))return e.useNode(f,h),hi&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof on)||f.children.length==0||f.positions[0]>0)break;let p=f.children[0];if(p instanceof on&&f.positions[0]==0)f=p;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),hi&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],f=l[c++],h=l[c++],p=c==l.length||!r,m=p?e:e.split(),g=this.tokens.mainToken;if(m.apply(u,f,g?g.start:m.pos,h),hi&&console.log(o+this.stackID(m)+` (via ${(u&65536)==0?"shift":`reduce of ${s.getName(u&65535)}`} for ${s.getName(f)} @ ${i}${m==e?"":", split"})`),p)return!0;m.pos>i?n.push(m):r.push(m)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return fA(e,n),!0}}runRecovery(e,n,r){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=n[o<<1],c=n[(o<<1)+1],u=hi?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),hi&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let f=a.split(),h=u;for(let p=0;f.forceReduce()&&p<10&&(hi&&console.log(h+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));p++)hi&&(h=this.stackID(f)+" -> ");for(let p of a.recoverByInsert(l))hi&&console.log(u+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),hi&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),fA(a,r)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),on.build({buffer:UO.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(L0||(L0=new WeakMap)).get(e);return n||L0.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}};function fA(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class eK{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}const X0=t=>t;class Np{constructor(e){this.start=e.start,this.shift=e.shift||X0,this.reduce=e.reduce||X0,this.reuse=e.reuse||X0,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class ws extends ik{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<e.repeatNodeCount;a++)n.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<n.length;a++)i.push([]);function s(a,l,c){i[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=yt[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)s(u,l,a[c++]);else{let f=a[c+-u];for(let h=-u;h>0;h--)s(a[c++],l,f);c++}}}this.nodeSet=new Qy(n.map((a,l)=>Ir.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=x4;let o=Ef(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(hA),this.states=Ef(e.states,Uint32Array),this.data=Ef(e.stateData),this.goto=Ef(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new $u(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new KJ(this,e,n,r);for(let s of this.wrappers)i=s(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+1];;){let o=i[s++],a=o&1,l=i[s++];if(a&&r)return l;for(let c=s+(o>>1);s<c;s++)if(i[s]==e)return l;if(a)return-1}}hasAction(e,n){let r=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=r[s])==65535)if(r[s+1]==1)o=r[s=qo(r,s+2)];else{if(r[s+1]==2)return qo(r,s+2);break}if(o==n||o==0)return qo(r,s+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=qo(this.data,s+2);else break;i=n(qo(this.data,s+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=qo(this.data,r+2);else break;if((this.data[r+2]&1)==0){let i=this.data[r+1];n.some((s,o)=>o&1&&s==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(ws.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(a=>a.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return n.specializers[i]=hA(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let s of e.split(" ")){let o=n.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;s<n.length;s++)if(!r[s])for(let o=this.dialects[n[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new eK(e,r,i)}static deserialize(e){return new ws(e)}}function qo(t,e){return t[e]|t[e+1]<<16}function tK(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function hA(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}let nK=0,Uo=class QS{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=nK++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof QS&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let i=new QS(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new FO(e);return r=>r.modified.indexOf(n)>-1?r:FO.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}},rK=0;class FO{constructor(e){this.name=e,this.instances=[],this.id=rK++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&iK(n,a.modified));if(r)return r;let i=[],s=new Uo(e.name,i,e,n);for(let a of n)a.instances.push(s);let o=sK(n);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(FO.get(a,l));return s}}function iK(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function sK(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function da(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],o=2,a=i;for(let f=0;;){if(a=="..."&&f>0&&f+3==i.length){o=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!h)throw new RangeError("Invalid path: "+i);if(s.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),f+=h[0].length,f==i.length)break;let p=i[f++];if(f==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);a=i.slice(f)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new YO(r,o,l>0?s.slice(0,l):null);e[c]=u.sort(e[c])}}return k4.add(e)}const k4=new yt;class YO{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}YO.empty=new YO([],2,null);function T4(t,e){let n=Object.create(null);for(let s of t)if(!Array.isArray(s.tag))n[s.tag.id]=s.class;else for(let o of s.tag)n[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let l of a.set){let c=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function oK(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function aK(t,e,n,r=0,i=t.length){let s=new lK(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class lK{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=n)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=i,u=cK(e)||YO.empty,f=oK(s,u.tags);if(f&&(c&&(c+=" "),c+=f,u.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(n,a),c),u.opaque)return;let h=e.tree&&e.tree.prop(yt.mounted);if(h&&h.overlay){let p=e.node.enter(h.overlay[0].from+a,1),m=this.highlighters.filter(O=>!O.scope||O.scope(h.tree.type)),g=e.firstChild();for(let O=0,v=a;;O++){let b=O<h.overlay.length?h.overlay[O]:null,x=b?b.from+a:l,P=Math.max(n,v),S=Math.min(r,x);if(P<S&&g)for(;e.from<S&&(this.highlightRange(e,P,S,i,s),this.startSpan(Math.min(S,e.to),c),!(e.to>=x||!e.nextSibling())););if(!b||x>r)break;v=b.to+a,v>n&&(this.highlightRange(p.cursor(),Math.max(n,b.from+a),Math.min(r,v),"",m),this.startSpan(Math.min(r,v),c))}g&&e.parent()}else if(e.firstChild()){h&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function cK(t){let e=t.type.prop(k4);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ae=Uo.define,Eg=Ae(),ja=Ae(),pA=Ae(ja),gA=Ae(ja),_a=Ae(),Ag=Ae(_a),W0=Ae(_a),Bs=Ae(),kl=Ae(Bs),Ws=Ae(),Zs=Ae(),RS=Ae(),af=Ae(RS),Qg=Ae(),I={comment:Eg,lineComment:Ae(Eg),blockComment:Ae(Eg),docComment:Ae(Eg),name:ja,variableName:Ae(ja),typeName:pA,tagName:Ae(pA),propertyName:gA,attributeName:Ae(gA),className:Ae(ja),labelName:Ae(ja),namespace:Ae(ja),macroName:Ae(ja),literal:_a,string:Ag,docString:Ae(Ag),character:Ae(Ag),attributeValue:Ae(Ag),number:W0,integer:Ae(W0),float:Ae(W0),bool:Ae(_a),regexp:Ae(_a),escape:Ae(_a),color:Ae(_a),url:Ae(_a),keyword:Ws,self:Ae(Ws),null:Ae(Ws),atom:Ae(Ws),unit:Ae(Ws),modifier:Ae(Ws),operatorKeyword:Ae(Ws),controlKeyword:Ae(Ws),definitionKeyword:Ae(Ws),moduleKeyword:Ae(Ws),operator:Zs,derefOperator:Ae(Zs),arithmeticOperator:Ae(Zs),logicOperator:Ae(Zs),bitwiseOperator:Ae(Zs),compareOperator:Ae(Zs),updateOperator:Ae(Zs),definitionOperator:Ae(Zs),typeOperator:Ae(Zs),controlOperator:Ae(Zs),punctuation:RS,separator:Ae(RS),bracket:af,angleBracket:Ae(af),squareBracket:Ae(af),paren:Ae(af),brace:Ae(af),content:Bs,heading:kl,heading1:Ae(kl),heading2:Ae(kl),heading3:Ae(kl),heading4:Ae(kl),heading5:Ae(kl),heading6:Ae(kl),contentSeparator:Ae(Bs),list:Ae(Bs),quote:Ae(Bs),emphasis:Ae(Bs),strong:Ae(Bs),link:Ae(Bs),monospace:Ae(Bs),strikethrough:Ae(Bs),inserted:Ae(),deleted:Ae(),changed:Ae(),invalid:Ae(),meta:Qg,documentMeta:Ae(Qg),annotation:Ae(Qg),processingInstruction:Ae(Qg),definition:Uo.defineModifier("definition"),constant:Uo.defineModifier("constant"),function:Uo.defineModifier("function"),standard:Uo.defineModifier("standard"),local:Uo.defineModifier("local"),special:Uo.defineModifier("special")};for(let t in I){let e=I[t];e instanceof Uo&&(e.name=t)}T4([{tag:I.link,class:"tok-link"},{tag:I.heading,class:"tok-heading"},{tag:I.emphasis,class:"tok-emphasis"},{tag:I.strong,class:"tok-strong"},{tag:I.keyword,class:"tok-keyword"},{tag:I.atom,class:"tok-atom"},{tag:I.bool,class:"tok-bool"},{tag:I.url,class:"tok-url"},{tag:I.labelName,class:"tok-labelName"},{tag:I.inserted,class:"tok-inserted"},{tag:I.deleted,class:"tok-deleted"},{tag:I.literal,class:"tok-literal"},{tag:I.string,class:"tok-string"},{tag:I.number,class:"tok-number"},{tag:[I.regexp,I.escape,I.special(I.string)],class:"tok-string2"},{tag:I.variableName,class:"tok-variableName"},{tag:I.local(I.variableName),class:"tok-variableName tok-local"},{tag:I.definition(I.variableName),class:"tok-variableName tok-definition"},{tag:I.special(I.variableName),class:"tok-variableName2"},{tag:I.definition(I.propertyName),class:"tok-propertyName tok-definition"},{tag:I.typeName,class:"tok-typeName"},{tag:I.namespace,class:"tok-namespace"},{tag:I.className,class:"tok-className"},{tag:I.macroName,class:"tok-macroName"},{tag:I.propertyName,class:"tok-propertyName"},{tag:I.operator,class:"tok-operator"},{tag:I.comment,class:"tok-comment"},{tag:I.meta,class:"tok-meta"},{tag:I.invalid,class:"tok-invalid"},{tag:I.punctuation,class:"tok-punctuation"}]);const uK=da({String:I.string,Number:I.number,"True False":I.bool,PropertyName:I.propertyName,Null:I.null,",":I.separator,"[ ]":I.squareBracket,"{ }":I.brace}),dK=ws.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[uK],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});let jS=[],$4=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?$4:jS).push(n=n+t[e])})();function fK(t){if(t<768)return!1;for(let e=0,n=jS.length;;){let r=e+n>>1;if(t<jS[r])n=r;else if(t>=$4[r])e=r+1;else return!0;if(e==n)return!1}}function mA(t){return t>=127462&&t<=127487}const OA=8205;function hK(t,e,n=!0,r=!0){return(n?I4:pK)(t,e,r)}function I4(t,e,n){if(e==t.length)return e;e&&E4(t.charCodeAt(e))&&A4(t.charCodeAt(e-1))&&e--;let r=Z0(t,e);for(e+=vA(r);e<t.length;){let i=Z0(t,e);if(r==OA||i==OA||n&&fK(i))e+=vA(i),r=i;else if(mA(i)){let s=0,o=e-2;for(;o>=0&&mA(Z0(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function pK(t,e,n){for(;e>0;){let r=I4(t,e-2,n);if(r<e)return r;e--}return 0}function Z0(t,e){let n=t.charCodeAt(e);if(!A4(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return E4(r)?(n-55296<<10)+(r-56320)+65536:n}function E4(t){return t>=56320&&t<57344}function A4(t){return t>=55296&&t<56320}function vA(t){return t<65536?1:2}let zt=class Q4{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=Fu(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),ro.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Fu(this,e,n);let r=[];return this.decompose(e,n,r,0),ro.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new Jf(this),s=new Jf(e);for(let o=n,a=n;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new Jf(this,e)}iterRange(e,n=this.length){return new R4(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new j4(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Q4.empty:e.length<=32?new An(e):ro.from(An.split(e,[]))}};class An extends zt{constructor(e,n=gK(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((n?r:a)>=e)return new mK(i,a,r,o);i=a+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new An(yA(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=Vm(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new An(a,o.length+s.length));else{let l=a.length>>1;r.push(new An(a.slice(0,l)),new An(a.slice(l)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof An))return super.replace(e,n,r);[e,n]=Fu(this,e,n);let i=Vm(this.text,Vm(r.text,yA(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new An(i,s):ro.from(An.split(i,[]),s)}sliceString(e,n=this.length,r=`
@@ -301,7 +301,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
301
301
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
302
302
  `,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)){$v(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(Da(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(t7(n.key)&&!Da(n.sep,"newline")){const o=Hc(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(Da(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const o=Hc(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]}):Da(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&&!Da(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)){$v(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||Da(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=sm(r),s=Hc(i);hj(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(`
303
303
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
304
- `,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=sm(e),r=Hc(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=sm(e),r=Hc(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 Kfe(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Hfe||null,prettyErrors:e}}function ehe(t,e={}){const{lineCounter:n,prettyErrors:r}=Kfe(e),i=new Jfe(n?.addNewLine),s=new Ufe(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 Nf(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(lj(t,n)),o.warnings.forEach(lj(t,n))),o}class the{constructor(e){this.providers=e}providers;extractEnvironments(e,n){const r=e.toJS();return Object.keys(r).filter(s=>s!=="version").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:typeof u=="string"?u:"",isSecret:!1}}),l=Object.entries(o.servers??{}).map(([c,u])=>({apiId:c,value:u.value,variables:Object.entries(u.variables??{}).map(([f,h])=>({name:f,value:h}))}));return{name:s,inputs:a,servers:l,state:jt.Normal}})}hydrateDocument(e,n,r){const i=new Set(n.map(s=>s.name).filter(Boolean));this.deleteRemovedKeys(e,[],i,"version");for(const s of n)if(s.name){if(!e.hasIn([s.name])){const o=e.createNode({});o instanceof Dr&&(o.flow=!1),e.setIn([s.name],o)}this.syncInputs(e,s.name,s.inputs,r),this.syncServers(e,s.name,s.servers)}return e}syncInputs(e,n,r,i){const s=new Set(r.map(o=>o.name));this.deleteRemovedKeys(e,[n,"inputs"],s),r.length>0&&this.unflowMap(e,[n,"inputs"]);for(const o of r){const a=[n,"inputs",o.name];if(o.isSecret){const l=this.providers.getDefaultProvider();l.isMarker(e.getIn(a))||e.setIn(a,e.createNode(l.createMarker())),l.store(i,n,o.name,o.value);continue}e.getIn(a)!==o.value&&e.setIn(a,o.value)}}syncServers(e,n,r){const i=new Set(r.map(s=>s.apiId));this.deleteRemovedKeys(e,[n,"servers"],i),r.length>0&&this.unflowMap(e,[n,"servers"]);for(const s of r){const o=[n,"servers",s.apiId];e.getIn([...o,"value"])!==s.value&&e.setIn([...o,"value"],s.value);const a=new Set(s.variables.map(l=>l.name));this.deleteRemovedKeys(e,[...o,"variables"],a),s.variables.length>0&&this.unflowMap(e,[...o,"variables"]);for(const l of s.variables){const c=[...o,"variables",l.name];e.getIn(c)!==l.value&&e.setIn(c,l.value)}}}unflowMap(e,n){const r=e.getIn(n,!0);r instanceof Dr&&r.flow&&(r.flow=!1)}deleteRemovedKeys(e,n,r,i){for(const s of this.getMapKeys(e,...n))s!==i&&!r.has(s)&&e.deleteIn([...n,s])}getMapKeys(e,...n){const r=n.length===0?e.contents:e.getIn(n,!0);return r instanceof Dr?r.items.map(i=>String(i.key)):[]}}class nhe{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 rhe{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 ihe{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 she{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 ng={all:["notifications"],lists:()=>[...ng.all,"list"]};function ohe(){return Lr.useQuery({queryKey:ng.lists(),queryFn:async()=>np.getInstance().getAll()})}function ahe(){return Lr.useQuery({queryKey:ng.lists(),queryFn:async()=>np.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class np{static instance=null;static initialize(){this.close();const e=new she;this.instance=new ihe(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let Dx=null;function ab(){return Dx||(Dx=new Lr.QueryClient({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),Dx}function lhe(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 che(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:lhe(e)}]}function uhe(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function PT(t){try{const e=np.getInstance();await t(e),ab().invalidateQueries({queryKey:ng.all})}catch{}}async function kT(t,e){await PT(async n=>{await n.set(t,che(e))})}async function dhe(t,e){e.length!==0&&await PT(async n=>{await n.set(t,uhe(e))})}async function Mu(t){await PT(async e=>{await e.clear(t)})}class fhe{constructor(e,n){this.storage=e,this.localStorageSecretsProvider=n}storage;localStorageSecretsProvider;default=[];doc=null;handler=new the(new rhe([new nhe],"local"));filePath="replay-environments.yaml";async read(){const e=await this.loadDocumentFromStorage();if(!e)return this.default;this.doc=e;try{const n=await this.readSecrets(),r=this.handler.extractEnvironments(e,n);return await Mu(this.filePath),r}catch(n){return console.info("Error reading replay environments",n),await kT(this.filePath,n),this.default}}async write(e){const n=this.doc??await this.loadDocumentFromStorage();if(!n&&hhe(e))return;const r=await this.readSecrets(),i=this.handler.hydrateDocument(n??new eg({}),e,r);await this.localStorageSecretsProvider.set(JSON.stringify(r)),await this.storage.set(this.filePath,i.toString()),this.doc=i}async loadDocumentFromStorage(){const e=await this.storage.get(this.filePath);if(!e)return await Mu(this.filePath),null;const n=ehe(e);return n.contents?n.errors.length>0?(console.error("Environments file has YAML errors",n.errors),await dhe(this.filePath,n.errors),null):n:(await Mu(this.filePath),null)}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 hhe(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===Pd&&e.inputs.length===0&&e.servers.length===0}class phe{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(){const e=await this.storage.get(this.filePath);return e?await this.parse(e):this.defaultValue}async write(e){return this.storage.set(this.filePath,this.stringify(e))}}const gC=(t,e)=>({data:t,version:e});class n7 extends phe{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return gC(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(gC(e,this.version))}}function ghe(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===Le.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}}const Nx=2,mhe="tabs.json";class Ohe extends n7{migrationMap={1:ghe};constructor(e){super(e,mhe,xs(wS),Nx)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=gC(xs(wS),Nx)),n.version!==Nx&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===Le.Step){if(i.data.draftStep){const s=i.data.draftStep.requestBody.formData;s["multipart/form-data"]=await pj(s["multipart/form-data"]),s["application/x-www-form-urlencoded"]=await pj(s["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await Gp(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===Le.Step){const{isProcessingRequest:i,...s}=r.data;return{...r,data:{...s,response:null}}}return r.data.type===Le.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function pj(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 cX(r)}return n}))}const vhe=1;class r7{constructor(e,n,r,i,s,o){this.systemFilesStorage=e,this.userFilesStorage=n,this.project=r,this.isApiPersisted=i,this.convertOperationToReplayValue=s,this.telemetry=o,this.localStorageSecretsProvider=new oJ(this.project.id);const a=new sJ;this.activeEnvironmentIdStorage=new n7(this.systemFilesStorage,"active_environment_id.json",Pd,vhe),this.tabsStateStorage=new Ohe(this.systemFilesStorage),this.environmentsStorage=new fhe(this.userFilesStorage,this.localStorageSecretsProvider),this.collectionsStorage=new Zde(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new aJ(this.isApiPersisted?this.userFilesStorage:a)}systemFilesStorage;userFilesStorage;project;isApiPersisted;convertOperationToReplayValue;telemetry;activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;localStorageSecretsProvider;persistExcludedIds=new Set;watchExcludedIds=new Set;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)}async update(e,n){switch(e.path[0]){case"activeEnvironmentId":this.activeEnvironmentIdStorage.write(n.activeEnvironmentId.get());break;case"tabsState":this.tabsStateStorage.write(n.tabsState.get());break;case"environments":this.environmentsStorage.write(n.environments.get());break;case"apis":this.isApiPersisted&&await this.apisStorage.update(e,n.apis.get());break;case"collections":await this.collectionsStorage.update(e,n.collections.get());break}}}function he(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!hn()&&(r=t4(window.location.href)),{object:t,id:e,uri:r}}class yhe extends r7{constructor(e,n,r){const i=new kS(e.systemFilesDir),s=new kS(e.userFilesDir);super(i,s,e,!1,n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[he("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=Ja.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const f=await Ht.resolve(await Ht.join(this.userFilesStorage.baseDir,l)),{definition:h}=await LO(f,u);s.push({uri:l,type:ri.FS,content:h}),await Mu(l)}else typeof u.arazzo=="string"&&(o.push({uri:l,type:ri.FS,content:u}),await Mu(l),u.sourceDescriptions?.forEach(f=>{const h=f.type,p=f.url,m=!h||h==="openapi",g=typeof p=="string"&&Li(p);m&&g&&a.add(p)}))}catch(u){console.info(`Error parsing YAML/JSON file ${l}:`,u),await kT(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",[{...he("storageOperation","loadApis","storage"),apiUrlsCount:e.size}],n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async s=>{try{const{definition:o}=await LO(s);i.push({uri:s,type:ri.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",[{...he("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",[{...he("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",[he("storageOperation","read","storage")],void 0),n=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[he("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);this.apisStorage.setItemIds(u.map(h=>h.id));const f=await this.parseCollections(a,u,e);return this.collectionsStorage.setItemIds(f.map(h=>h.id)),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 i7(t=!1){let e,n,r=!1,i=null,s=null,o=null;function a(){o&&(o(),o=null)}async function l(f){if(!(!hn()||!e||!s)){await c();try{const{FileWatcher:h}=await Promise.resolve().then(()=>require("./replay-FileWatcher-ClVd_wG0.js")),p=s.project.userFilesDir.get();i=new h(e,s,p,f),await i.start()}catch(h){console.error("Failed to start file watcher:",h),i=null}}}async function c(){i&&(await i.stop(),i=null)}async function u(){hn()&&(await c(),await qe("cleanup_all_managed_watchers"))}return()=>({id:"RootStoragePlugin",onCreate:(f,h)=>({getTauriRootStorage:p=>()=>n,cleanup:()=>async()=>{a(),await u()},init:p=>async(m,g,O)=>{if(r||p.path.length>0)return{isInitialized:!1};const{convertOperationToReplayValue:v,aiEnabled:b}=g,x=hn();if(r=!0,s=p,a(),t)return r=!1,{isInitialized:!0};if(x){const{TauriRootStorage:S}=await Promise.resolve().then(()=>require("./replay-TauriRootStorage-DhzbAahU.js"));n=new S(m,v,O),e=n}else n=void 0,e=new yhe(m,v,O);if(x){await c();const{getSemanticSearchService:S}=await Promise.resolve().then(()=>require("./replay-index-DDjmUXWm.js"));S().setProject(m.id)}const P=await e.read();if(p.merge(P),!x)return r=!1,{isInitialized:!0};try{if(await l(b??!1),b){const[{getSemanticSearchService:S},{createIndexSnapshotGetter:k,startPeriodicIndexRevalidation:T}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-DDjmUXWm.js")),Promise.resolve().then(()=>require("./replay-periodic-revalidation-BoyLQHtg.js"))]),$=S();$.preloadModel().catch(()=>{}),$.reindex(k(s)).catch(A=>{console.error("Semantic reindex failed:",A)}),o=T($,s)}}finally{r=!1}return{isInitialized:!0}}}),onSet(f,h,p){r||!t&&e&&e.update(h,p)},onDestroy:async()=>{a(),await u()}})}function s7({defaultEnvironments:t}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},tabsState:xs(wS),activeEnvironmentId:Pd,environments:t||C3,collections:[],apis:[],apps:{apps:[],appsLoadingState:Fs.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set})}const bhe=OM(s7(),vM(nH({key:"replay-root-store"}),i7())),TT=y.createContext(bhe),xhe=TT.Provider;function nt(){const t=y.useContext(TT);return IP(t)}function Pc(){const t=nt(),{apis:e}=t;return{apis:e}}function rg(t){const{apis:e}=Pc();return{api:e.find(r=>r.id.get()===t)??null}}function lb(t,e,n){const{api:r}=rg(t);return{specDefault:r?.servers?.ornull?.find(s=>s.url.get()===e)?.variables?.ornull?.[n]?.ornull?.default?.get()}}function She({variable:t,apiId:e,serverUrl:n}){const{specDefault:r}=lb(e,n,t.get().name);return r===void 0?null:d.jsx(whe,{fullWidth:!0,variant:"ghost",size:"small",icon:d.jsx(HN.ResetIcon,{size:"14px"}),onClick:()=>t.merge({value:r}),children:"Reset to default"})}const whe=w.default(pe.Button)`
304
+ `,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=sm(e),r=Hc(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=sm(e),r=Hc(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 Kfe(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Hfe||null,prettyErrors:e}}function ehe(t,e={}){const{lineCounter:n,prettyErrors:r}=Kfe(e),i=new Jfe(n?.addNewLine),s=new Ufe(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 Nf(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(lj(t,n)),o.warnings.forEach(lj(t,n))),o}class the{constructor(e){this.providers=e}providers;extractEnvironments(e,n){const r=e.toJS();return Object.keys(r).filter(s=>s!=="version").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:typeof u=="string"?u:"",isSecret:!1}}),l=Object.entries(o.servers??{}).map(([c,u])=>({apiId:c,value:u.value,variables:Object.entries(u.variables??{}).map(([f,h])=>({name:f,value:h}))}));return{name:s,inputs:a,servers:l,state:jt.Normal}})}hydrateDocument(e,n,r){const i=new Set(n.map(s=>s.name).filter(Boolean));this.deleteRemovedKeys(e,[],i,"version");for(const s of n)if(s.name){if(!e.hasIn([s.name])){const o=e.createNode({});o instanceof Dr&&(o.flow=!1),e.setIn([s.name],o)}this.syncInputs(e,s.name,s.inputs,r),this.syncServers(e,s.name,s.servers)}return e}syncInputs(e,n,r,i){const s=new Set(r.map(o=>o.name));this.deleteRemovedKeys(e,[n,"inputs"],s),r.length>0&&this.unflowMap(e,[n,"inputs"]);for(const o of r){const a=[n,"inputs",o.name];if(o.isSecret){const l=this.providers.getDefaultProvider();l.isMarker(e.getIn(a))||e.setIn(a,e.createNode(l.createMarker())),l.store(i,n,o.name,o.value);continue}e.getIn(a)!==o.value&&e.setIn(a,o.value)}}syncServers(e,n,r){const i=new Set(r.map(s=>s.apiId));this.deleteRemovedKeys(e,[n,"servers"],i),r.length>0&&this.unflowMap(e,[n,"servers"]);for(const s of r){const o=[n,"servers",s.apiId];e.getIn([...o,"value"])!==s.value&&e.setIn([...o,"value"],s.value);const a=new Set(s.variables.map(l=>l.name));this.deleteRemovedKeys(e,[...o,"variables"],a),s.variables.length>0&&this.unflowMap(e,[...o,"variables"]);for(const l of s.variables){const c=[...o,"variables",l.name];e.getIn(c)!==l.value&&e.setIn(c,l.value)}}}unflowMap(e,n){const r=e.getIn(n,!0);r instanceof Dr&&r.flow&&(r.flow=!1)}deleteRemovedKeys(e,n,r,i){for(const s of this.getMapKeys(e,...n))s!==i&&!r.has(s)&&e.deleteIn([...n,s])}getMapKeys(e,...n){const r=n.length===0?e.contents:e.getIn(n,!0);return r instanceof Dr?r.items.map(i=>String(i.key)):[]}}class nhe{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 rhe{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 ihe{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 she{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 ng={all:["notifications"],lists:()=>[...ng.all,"list"]};function ohe(){return Lr.useQuery({queryKey:ng.lists(),queryFn:async()=>np.getInstance().getAll()})}function ahe(){return Lr.useQuery({queryKey:ng.lists(),queryFn:async()=>np.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class np{static instance=null;static initialize(){this.close();const e=new she;this.instance=new ihe(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let Dx=null;function ab(){return Dx||(Dx=new Lr.QueryClient({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),Dx}function lhe(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 che(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:lhe(e)}]}function uhe(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function PT(t){try{const e=np.getInstance();await t(e),ab().invalidateQueries({queryKey:ng.all})}catch{}}async function kT(t,e){await PT(async n=>{await n.set(t,che(e))})}async function dhe(t,e){e.length!==0&&await PT(async n=>{await n.set(t,uhe(e))})}async function Mu(t){await PT(async e=>{await e.clear(t)})}class fhe{constructor(e,n){this.storage=e,this.localStorageSecretsProvider=n}storage;localStorageSecretsProvider;default=[];doc=null;handler=new the(new rhe([new nhe],"local"));filePath="replay-environments.yaml";async read(){const e=await this.loadDocumentFromStorage();if(!e)return this.default;this.doc=e;try{const n=await this.readSecrets(),r=this.handler.extractEnvironments(e,n);return await Mu(this.filePath),r}catch(n){return console.info("Error reading replay environments",n),await kT(this.filePath,n),this.default}}async write(e){const n=this.doc??await this.loadDocumentFromStorage();if(!n&&hhe(e))return;const r=await this.readSecrets(),i=this.handler.hydrateDocument(n??new eg({}),e,r);await this.localStorageSecretsProvider.set(JSON.stringify(r)),await this.storage.set(this.filePath,i.toString()),this.doc=i}async loadDocumentFromStorage(){const e=await this.storage.get(this.filePath);if(!e)return await Mu(this.filePath),null;const n=ehe(e);return n.contents?n.errors.length>0?(console.error("Environments file has YAML errors",n.errors),await dhe(this.filePath,n.errors),null):n:(await Mu(this.filePath),null)}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 hhe(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===Pd&&e.inputs.length===0&&e.servers.length===0}class phe{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(){const e=await this.storage.get(this.filePath);return e?await this.parse(e):this.defaultValue}async write(e){return this.storage.set(this.filePath,this.stringify(e))}}const gC=(t,e)=>({data:t,version:e});class n7 extends phe{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return gC(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(gC(e,this.version))}}function ghe(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===Le.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}}const Nx=2,mhe="tabs.json";class Ohe extends n7{migrationMap={1:ghe};constructor(e){super(e,mhe,xs(wS),Nx)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=gC(xs(wS),Nx)),n.version!==Nx&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===Le.Step){if(i.data.draftStep){const s=i.data.draftStep.requestBody.formData;s["multipart/form-data"]=await pj(s["multipart/form-data"]),s["application/x-www-form-urlencoded"]=await pj(s["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await Gp(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===Le.Step){const{isProcessingRequest:i,...s}=r.data;return{...r,data:{...s,response:null}}}return r.data.type===Le.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function pj(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 cX(r)}return n}))}const vhe=1;class r7{constructor(e,n,r,i,s,o){this.systemFilesStorage=e,this.userFilesStorage=n,this.project=r,this.isApiPersisted=i,this.convertOperationToReplayValue=s,this.telemetry=o,this.localStorageSecretsProvider=new oJ(this.project.id);const a=new sJ;this.activeEnvironmentIdStorage=new n7(this.systemFilesStorage,"active_environment_id.json",Pd,vhe),this.tabsStateStorage=new Ohe(this.systemFilesStorage),this.environmentsStorage=new fhe(this.userFilesStorage,this.localStorageSecretsProvider),this.collectionsStorage=new Zde(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new aJ(this.isApiPersisted?this.userFilesStorage:a)}systemFilesStorage;userFilesStorage;project;isApiPersisted;convertOperationToReplayValue;telemetry;activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;localStorageSecretsProvider;persistExcludedIds=new Set;watchExcludedIds=new Set;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)}async update(e,n){switch(e.path[0]){case"activeEnvironmentId":this.activeEnvironmentIdStorage.write(n.activeEnvironmentId.get());break;case"tabsState":this.tabsStateStorage.write(n.tabsState.get());break;case"environments":this.environmentsStorage.write(n.environments.get());break;case"apis":this.isApiPersisted&&await this.apisStorage.update(e,n.apis.get());break;case"collections":await this.collectionsStorage.update(e,n.collections.get());break}}}function he(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!hn()&&(r=t4(window.location.href)),{object:t,id:e,uri:r}}class yhe extends r7{constructor(e,n,r){const i=new kS(e.systemFilesDir),s=new kS(e.userFilesDir);super(i,s,e,!1,n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[he("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=Ja.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const f=await Ht.resolve(await Ht.join(this.userFilesStorage.baseDir,l)),{definition:h}=await LO(f,u);s.push({uri:l,type:ri.FS,content:h}),await Mu(l)}else typeof u.arazzo=="string"&&(o.push({uri:l,type:ri.FS,content:u}),await Mu(l),u.sourceDescriptions?.forEach(f=>{const h=f.type,p=f.url,m=!h||h==="openapi",g=typeof p=="string"&&Li(p);m&&g&&a.add(p)}))}catch(u){console.info(`Error parsing YAML/JSON file ${l}:`,u),await kT(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",[{...he("storageOperation","loadApis","storage"),apiUrlsCount:e.size}],n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async s=>{try{const{definition:o}=await LO(s);i.push({uri:s,type:ri.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",[{...he("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",[{...he("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",[he("storageOperation","read","storage")],void 0),n=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[he("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);this.apisStorage.setItemIds(u.map(h=>h.id));const f=await this.parseCollections(a,u,e);return this.collectionsStorage.setItemIds(f.map(h=>h.id)),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 i7(t=!1){let e,n,r=!1,i=null,s=null,o=null;function a(){o&&(o(),o=null)}async function l(f){if(!(!hn()||!e||!s)){await c();try{const{FileWatcher:h}=await Promise.resolve().then(()=>require("./replay-FileWatcher-NkpXJA-C.js")),p=s.project.userFilesDir.get();i=new h(e,s,p,f),await i.start()}catch(h){console.error("Failed to start file watcher:",h),i=null}}}async function c(){i&&(await i.stop(),i=null)}async function u(){hn()&&(await c(),await qe("cleanup_all_managed_watchers"))}return()=>({id:"RootStoragePlugin",onCreate:(f,h)=>({getTauriRootStorage:p=>()=>n,cleanup:()=>async()=>{a(),await u()},init:p=>async(m,g,O)=>{if(r||p.path.length>0)return{isInitialized:!1};const{convertOperationToReplayValue:v,aiEnabled:b}=g,x=hn();if(r=!0,s=p,a(),t)return r=!1,{isInitialized:!0};if(x){const{TauriRootStorage:S}=await Promise.resolve().then(()=>require("./replay-TauriRootStorage-B1vFT2Rg.js"));n=new S(m,v,O),e=n}else n=void 0,e=new yhe(m,v,O);if(x){await c();const{getSemanticSearchService:S}=await Promise.resolve().then(()=>require("./replay-index-DmAVD_C4.js"));S().setProject(m.id)}const P=await e.read();if(p.merge(P),!x)return r=!1,{isInitialized:!0};try{if(await l(b??!1),b){const[{getSemanticSearchService:S},{createIndexSnapshotGetter:k,startPeriodicIndexRevalidation:T}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-DmAVD_C4.js")),Promise.resolve().then(()=>require("./replay-periodic-revalidation-BoyLQHtg.js"))]),$=S();$.preloadModel().catch(()=>{}),$.reindex(k(s)).catch(A=>{console.error("Semantic reindex failed:",A)}),o=T($,s)}}finally{r=!1}return{isInitialized:!0}}}),onSet(f,h,p){r||!t&&e&&e.update(h,p)},onDestroy:async()=>{a(),await u()}})}function s7({defaultEnvironments:t}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},tabsState:xs(wS),activeEnvironmentId:Pd,environments:t||C3,collections:[],apis:[],apps:{apps:[],appsLoadingState:Fs.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set})}const bhe=OM(s7(),vM(nH({key:"replay-root-store"}),i7())),TT=y.createContext(bhe),xhe=TT.Provider;function nt(){const t=y.useContext(TT);return IP(t)}function Pc(){const t=nt(),{apis:e}=t;return{apis:e}}function rg(t){const{apis:e}=Pc();return{api:e.find(r=>r.id.get()===t)??null}}function lb(t,e,n){const{api:r}=rg(t);return{specDefault:r?.servers?.ornull?.find(s=>s.url.get()===e)?.variables?.ornull?.[n]?.ornull?.default?.get()}}function She({variable:t,apiId:e,serverUrl:n}){const{specDefault:r}=lb(e,n,t.get().name);return r===void 0?null:d.jsx(whe,{fullWidth:!0,variant:"ghost",size:"small",icon:d.jsx(HN.ResetIcon,{size:"14px"}),onClick:()=>t.merge({value:r}),children:"Reset to default"})}const whe=w.default(pe.Button)`
305
305
  justify-content: flex-start;
306
306
  `;function Che({defaultValue:t,onReset:e,name:n}){const r=()=>{e(t)};return d.jsxs(Phe,{children:[d.jsxs(khe,{children:["Default: ",t]}),d.jsx(pe.Button,{variant:"ghost",size:"small",icon:d.jsx(HN.ResetIcon,{size:"14px"}),onClick:r,"data-testid":n?`reset-server-variable-editor-${n}`:"reset-server-variable-editor",children:"Reset"})]})}const Phe=w.default.div`
307
307
  display: flex;
@@ -506,7 +506,7 @@ ${B}`,me=Math.min(E.length,A);let be=0;for(;be<me-1;be++){const fe=Q(String(be),
506
506
  ${Z}`,L.pop(),`[${H}]`}let q=Object.keys(E);const F=q.length;if(F===0)return"{}";if($<L.length+1)return'"[Object]"';B+=V;const Y=`,
507
507
  ${B}`;let ne="",J="",se=Math.min(F,A);l(E)&&(ne+=c(E,Y,A),q=q.slice(E.length),se-=E.length,J=Y),k&&(q=o(q,T)),L.push(E);for(let H=0;H<se;H++){const ge=q[H],me=Q(ge,E[ge],L,V,B);me!==void 0&&(ne+=`${J}${s(ge)}: ${me}`,J=Y)}if(F>A){const H=F-A;ne+=`${J}"...": "${m(H)} not stringified"`,J=Y}return J!==""&&(ne=`
508
508
  ${B}${ne}
509
- ${Z}`),L.pop(),`{${ne}}`}case"number":return isFinite(E)?String(E):x?x(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(E);default:return x?x(E):void 0}}function M(z,E,L){switch(typeof E){case"string":return s(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(z),typeof E!="object")return M(z,E,L);if(E===null)return"null"}if(L.indexOf(E)!==-1)return P;let V="";const B=E.length!==void 0;if(B&&Array.isArray(E)){if(E.length===0)return"[]";if($<L.length+1)return'"[Array]"';L.push(E);const ne=Math.min(E.length,A);let J=0;for(;J<ne-1;J++){const H=M(String(J),E[J],L);V+=H!==void 0?H:"null",V+=","}const se=M(String(J),E[J],L);if(V+=se!==void 0?se:"null",E.length-1>A){const H=E.length-A-1;V+=`,"... ${m(H)} not stringified"`}return L.pop(),`[${V}]`}let Z=Object.keys(E);const q=Z.length;if(q===0)return"{}";if($<L.length+1)return'"[Object]"';let F="",Y=Math.min(q,A);B&&l(E)&&(V+=c(E,",",A),Z=Z.slice(E.length),Y-=E.length,F=","),k&&(Z=o(Z,T)),L.push(E);for(let ne=0;ne<Y;ne++){const J=Z[ne],se=M(J,E[J],L);se!==void 0&&(V+=`${F}${s(J)}:${se}`,F=",")}if(q>A){const ne=q-A;V+=`${F}"...":"${m(ne)} not stringified"`}return L.pop(),`{${V}}`}case"number":return isFinite(E)?String(E):x?x(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(E);default:return x?x(E):void 0}}function N(z,E,L){if(arguments.length>1){let V="";if(typeof L=="number"?V=" ".repeat(Math.min(L,10)):typeof L=="string"&&(V=L.slice(0,10)),E!=null){if(typeof E=="function")return _("",{"":z},[],E,V,"");if(Array.isArray(E))return D("",z,[],g(E),V,"")}if(V.length!==0)return Q("",z,[],V,"")}return M("",z,[])}return N}})(mm,mm.exports)),mm.exports}var Mbe=Nbe();const zbe=ua(Mbe),Vbe=zbe.configure;class cp extends Sbe{static maxErrorTextChars=4096;static stringify=Vbe({maximumDepth:2,maximumBreadth:10});sendErrorEvent;constructor(e,n){super("errors","1.0",e||{}),this.sendErrorEvent=n}static toErrorEvent(e,n){return{type:"error",payload:[{handler:n,errorType:this.getErrorType(e),message:this.getErrorMessage(e),stack:this.getErrorStack(e)}]}}enable(){window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this._wrap(console,"error",this.patchConsoleError())}disable(){window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),this._unwrap(console,"error")}init(){}static getErrorMessage(e){return e?(typeof e=="object"&&"message"in e?String(e.message):String(e)).trim():void 0}static getErrorStack(e){if(!e||typeof e!="object"||!("stack"in e)||!e.stack)return;const n=String(e.stack);return n.length>this.maxErrorTextChars?n.substring(0,this.maxErrorTextChars):n}static getErrorType(e){return!e||typeof e!="object"?typeof e:"name"in e?String(e.name):"constructor"in e&&"name"in e.constructor?String(e.constructor.name):"Error"}static combineConsoleErrorArgs(e){const n=e.findIndex(i=>i instanceof Error),r=e.filter((i,s)=>s!==n).map(i=>typeof i=="string"?i:i instanceof Error?String(i):this.stringify(i)??String(i)).join(" ").substring(0,this.maxErrorTextChars);if(n===-1)return r;{const i=e[n];return r&&(i.message=`${i.message} ${r}`),i}}onError=e=>{this.sendError(e.error,"window.onerror")};onUnhandledRejection=e=>{this.sendError(e.reason,"window.onunhandledrejection")};patchConsoleError(){return e=>{const n=this;return function(...i){try{const s=cp.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(cp.toErrorEvent(e,n))}}class Lbe{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new Dbe,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,instrumentations:[...e.otel.enableErrorInstrumentation===!0?[new cp(void 0,n=>{this.sendToOtelService({type:n.type,data:n.payload})})]:[],...e.otel.instrumentations||[]]}))}startSpan(e,n,r){if(this.config?.disabled)return;const i=this.constructCloudEvent(e,n,{signal:"trace"});return this.otelClient.startSpan(i,r)}constructCloudEvent(e,n,r){const i={...this.useCloudEventData(),...r};return zOe({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=cp.toErrorEvent(e,n);this.sendToOtelService({type:r.type,data:r.payload})}sendTabChangeMessage(e,n){this.send("com.redocly.tab.change",e,n)}sendButtonClickMessage(e,n){this.send("com.redocly.button.click",e,n)}sendTabOpenFailedMessage(e,n){this.send("com.redocly.tab.openFailed",e,n)}sendChangeMessage(e,n){this.send("com.redocly.change.occurred",e,n)}sendContentCopyMessage(e,n){this.send("com.redocly.content.copy",e,n)}sendRequestSendMessage(e,n){this.send("com.redocly.request.send",e,n)}sendResponseReceivedMessage(e,n){this.send("com.redocly.response.received",e,n)}sendTokenGenerateMessage(e,n){this.send("com.redocly.token.generate",e,n)}sendAppLifecycleMessage(e,n){this.send("com.redocly.app.lifecycle",e,n)}sendEnvironmentManagementMessage(e,n){this.send("com.redocly.environment.management",e,n)}sendServerManagementMessage(e,n){this.send("com.redocly.server.management",e,n)}sendSourceManagementMessage(e,n){this.send("com.redocly.source.management",e,n)}sendInputManagementMessage(e,n){this.send("com.redocly.input.management",e,n)}sendNodeManagementMessage(e,n){this.send("com.redocly.node.management",e,n)}sendHistoryManagementMessage(e,n){this.send("com.redocly.history.management",e,n)}sendHistoryMigrationMessage(e,n){this.send("com.redocly.history.migration",e,n)}sendCredentialManagementMessage(e,n){this.send("com.redocly.credential.management",e,n)}sendPanelToggleMessage(e,n){this.send("com.redocly.panel.toggle",e,n)}sendWorkflowRunClickMessage(e,n){this.send("com.redocly.workflowRun.click",e,n)}sendWorkflowRunResultMessage(e,n){this.send("com.redocly.workflowRun.result",e,n)}sendStorageReadMessage(e,n){this.send("com.redocly.storage.read",e,n)}sendStorageLoadUserStateMessage(e,n){this.send("com.redocly.storage.loadUserState",e,n)}sendStorageDetectFilesMessage(e,n){this.send("com.redocly.storage.detectFiles",e,n)}sendStorageLoadApisMessage(e,n){this.send("com.redocly.storage.loadApis",e,n)}sendStorageParseApisMessage(e,n){this.send("com.redocly.storage.parseApis",e,n)}sendStorageParseCollectionsMessage(e,n){this.send("com.redocly.storage.parseCollections",e,n)}sendUpdaterCheckMessage(e,n){this.send("com.redocly.updater.check",e,n)}sendUpdaterDownloadMessage(e,n){this.send("com.redocly.updater.download",e,n)}sendUpdaterInstallMessage(e,n){this.send("com.redocly.updater.install",e,n)}sendUpdaterProcessMessage(e,n){this.send("com.redocly.updater.process",e,n)}sendErrorMessage(e,n){this.send("com.redocly.error.occurred",e,n)}sendBackendEventMessage(e,n){this.send("com.redocly.backend.event",e,n)}sendCodeEditorSearchMessage(e,n){this.send("com.redocly.codeEditor.search",e,n)}sendAiChatToolCallStartedMessage(e,n){this.send("com.redocly.aiChat.toolCallStarted",e,n)}sendAiChatToolCallFinishedMessage(e,n){this.send("com.redocly.aiChat.toolCallFinished",e,n)}sendAiChatConversationStartedMessage(e,n){this.send("com.redocly.aiChat.conversationStarted",e,n)}sendAiChatConversationFinishedMessage(e,n){this.send("com.redocly.aiChat.conversationFinished",e,n)}sendDeepLinkOpenedMessage(e,n){this.send("com.redocly.deepLink.opened",e,n)}}const Vd=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],Xbe="https://cors.redocly.com/";function Wbe(){return{theme:"light",disableCollectionsTab:!1,oAuth2RedirectURI:void 0,corsProxyUrl:void 0,credentialOrigin:void 0,certificates:[],isApiBased:!1,generatedEnvironments:[],generatedInputs:[],hideOtherSecuritySchemes:!1,aiEnabled:!1,isPreviewLayout:!1}}const Zbe=Wbe(),qbe=y.createContext(Zbe);function qr(){const t=y.useContext(qbe);return IP(t)}function Ube(t,e){const{apps:{apiId:n}}=nt(),{corsProxyUrl:r,credentialOrigin:i,disableCollectionsTab:s,oAuth2RedirectURI:o,certificates:a,storageKey:l,isApiBased:c,aiEnabled:u,isPreviewLayout:f}=qr();r.set(t?.corsProxyUrl??Xbe),i.set(t?.credentialOrigin),n.set(t?.apiId),o.set(t?.oAuth2RedirectURI),s.set(!!t?.disableCollectionsTab),l.set(t?.storageKey),c.set(!!e),u.set(!!t?.aiEnabled),f.set(t?.layout==="preview"),y.useEffect(()=>{a.set(t?.certificates||[])},[t?.certificates])}const gb=y.createContext({});function gr(){return y.useContext(gb)||{}}const $C=process.env.NODE_ENV==="development",C_=process.env.NODE_ENV==="production",Bbe="0.27.0",Fbe={version:Bbe},Ybe={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"};class SW{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new Lbe}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(()=>({...Ybe,...e,env:C_?"production":"development"}))}enrichGlobalAttributes(e){this._globalAttributes={...this._globalAttributes,...e}}getGlobalAttributes(){return{...this._globalAttributes}}clearGlobalAttributes(){this._globalAttributes={platform:"",deviceId:""}}init(e){if(this.isInitialized)return;const{cloudEventData:n,...r}=e??{},i=r.tracerName||"desktop",s=r.enableErrorInstrumentation??i==="desktop",o={serviceName:"replay",serviceVersion:Fbe.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:C_,enableErrorInstrumentation:s};this._client.init({otel:{...o,...r}}),this.setCloudEventData(n),this._initResolve?.(this),this._isInitialized=!0}sendEvent(e,n){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const r=n.map(i=>({...this._globalAttributes,...i}));$C&&console.log(`[Telemetry] ${e}:`,JSON.stringify(r,null,2));try{this.client.send(e,r)}catch(i){console.error("Failed to send telemetry event:",i)}}startSpan(e,n,r){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{const i=(n??[{}]).map(s=>({...this._globalAttributes,...s}));return $C&&console.log(`[Telemetry] span ${e}:`,JSON.stringify(i,null,2)),this._client.startSpan(e,i,r)}catch(i){console.error("Failed to start telemetry span:",i);return}}}const _l=new SW;function Be(){const{telemetry:t}=gr();_l.isInitialized||_l.init(t);const e=t?.cloudEventData;y.useEffect(()=>{e&&_l.setCloudEventData(e)},[e]);const n=y.useCallback((i,s)=>{_l.sendEvent(i,s)},[]),r=y.useCallback((i,s,o)=>_l.startSpan(i,s,o),[]);return{sendEvent:n,startSpan:r}}const Gbe=({awaitInit:t=!0}={})=>{const[e,n]=y.useState(void 0);return y.useEffect(()=>{(async()=>{const i=t?await _l.awaitInit():_l;n(i)})()},[t]),e},$r=800,Ti=w.default(pe.Button).attrs({variant:"text",size:"small",tone:"danger"})`
509
+ ${Z}`),L.pop(),`{${ne}}`}case"number":return isFinite(E)?String(E):x?x(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(E);default:return x?x(E):void 0}}function M(z,E,L){switch(typeof E){case"string":return s(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(z),typeof E!="object")return M(z,E,L);if(E===null)return"null"}if(L.indexOf(E)!==-1)return P;let V="";const B=E.length!==void 0;if(B&&Array.isArray(E)){if(E.length===0)return"[]";if($<L.length+1)return'"[Array]"';L.push(E);const ne=Math.min(E.length,A);let J=0;for(;J<ne-1;J++){const H=M(String(J),E[J],L);V+=H!==void 0?H:"null",V+=","}const se=M(String(J),E[J],L);if(V+=se!==void 0?se:"null",E.length-1>A){const H=E.length-A-1;V+=`,"... ${m(H)} not stringified"`}return L.pop(),`[${V}]`}let Z=Object.keys(E);const q=Z.length;if(q===0)return"{}";if($<L.length+1)return'"[Object]"';let F="",Y=Math.min(q,A);B&&l(E)&&(V+=c(E,",",A),Z=Z.slice(E.length),Y-=E.length,F=","),k&&(Z=o(Z,T)),L.push(E);for(let ne=0;ne<Y;ne++){const J=Z[ne],se=M(J,E[J],L);se!==void 0&&(V+=`${F}${s(J)}:${se}`,F=",")}if(q>A){const ne=q-A;V+=`${F}"...":"${m(ne)} not stringified"`}return L.pop(),`{${V}}`}case"number":return isFinite(E)?String(E):x?x(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(E);default:return x?x(E):void 0}}function N(z,E,L){if(arguments.length>1){let V="";if(typeof L=="number"?V=" ".repeat(Math.min(L,10)):typeof L=="string"&&(V=L.slice(0,10)),E!=null){if(typeof E=="function")return _("",{"":z},[],E,V,"");if(Array.isArray(E))return D("",z,[],g(E),V,"")}if(V.length!==0)return Q("",z,[],V,"")}return M("",z,[])}return N}})(mm,mm.exports)),mm.exports}var Mbe=Nbe();const zbe=ua(Mbe),Vbe=zbe.configure;class cp extends Sbe{static maxErrorTextChars=4096;static stringify=Vbe({maximumDepth:2,maximumBreadth:10});sendErrorEvent;constructor(e,n){super("errors","1.0",e||{}),this.sendErrorEvent=n}static toErrorEvent(e,n){return{type:"error",payload:[{handler:n,errorType:this.getErrorType(e),message:this.getErrorMessage(e),stack:this.getErrorStack(e)}]}}enable(){window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this._wrap(console,"error",this.patchConsoleError())}disable(){window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),this._unwrap(console,"error")}init(){}static getErrorMessage(e){return e?(typeof e=="object"&&"message"in e?String(e.message):String(e)).trim():void 0}static getErrorStack(e){if(!e||typeof e!="object"||!("stack"in e)||!e.stack)return;const n=String(e.stack);return n.length>this.maxErrorTextChars?n.substring(0,this.maxErrorTextChars):n}static getErrorType(e){return!e||typeof e!="object"?typeof e:"name"in e?String(e.name):"constructor"in e&&"name"in e.constructor?String(e.constructor.name):"Error"}static combineConsoleErrorArgs(e){const n=e.findIndex(i=>i instanceof Error),r=e.filter((i,s)=>s!==n).map(i=>typeof i=="string"?i:i instanceof Error?String(i):this.stringify(i)??String(i)).join(" ").substring(0,this.maxErrorTextChars);if(n===-1)return r;{const i=e[n];return r&&(i.message=`${i.message} ${r}`),i}}onError=e=>{this.sendError(e.error,"window.onerror")};onUnhandledRejection=e=>{this.sendError(e.reason,"window.onunhandledrejection")};patchConsoleError(){return e=>{const n=this;return function(...i){try{const s=cp.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(cp.toErrorEvent(e,n))}}class Lbe{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new Dbe,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,instrumentations:[...e.otel.enableErrorInstrumentation===!0?[new cp(void 0,n=>{this.sendToOtelService({type:n.type,data:n.payload})})]:[],...e.otel.instrumentations||[]]}))}startSpan(e,n,r){if(this.config?.disabled)return;const i=this.constructCloudEvent(e,n,{signal:"trace"});return this.otelClient.startSpan(i,r)}constructCloudEvent(e,n,r){const i={...this.useCloudEventData(),...r};return zOe({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=cp.toErrorEvent(e,n);this.sendToOtelService({type:r.type,data:r.payload})}sendTabChangeMessage(e,n){this.send("com.redocly.tab.change",e,n)}sendButtonClickMessage(e,n){this.send("com.redocly.button.click",e,n)}sendTabOpenFailedMessage(e,n){this.send("com.redocly.tab.openFailed",e,n)}sendChangeMessage(e,n){this.send("com.redocly.change.occurred",e,n)}sendContentCopyMessage(e,n){this.send("com.redocly.content.copy",e,n)}sendRequestSendMessage(e,n){this.send("com.redocly.request.send",e,n)}sendResponseReceivedMessage(e,n){this.send("com.redocly.response.received",e,n)}sendTokenGenerateMessage(e,n){this.send("com.redocly.token.generate",e,n)}sendAppLifecycleMessage(e,n){this.send("com.redocly.app.lifecycle",e,n)}sendEnvironmentManagementMessage(e,n){this.send("com.redocly.environment.management",e,n)}sendServerManagementMessage(e,n){this.send("com.redocly.server.management",e,n)}sendSourceManagementMessage(e,n){this.send("com.redocly.source.management",e,n)}sendInputManagementMessage(e,n){this.send("com.redocly.input.management",e,n)}sendNodeManagementMessage(e,n){this.send("com.redocly.node.management",e,n)}sendHistoryManagementMessage(e,n){this.send("com.redocly.history.management",e,n)}sendHistoryMigrationMessage(e,n){this.send("com.redocly.history.migration",e,n)}sendCredentialManagementMessage(e,n){this.send("com.redocly.credential.management",e,n)}sendPanelToggleMessage(e,n){this.send("com.redocly.panel.toggle",e,n)}sendWorkflowRunClickMessage(e,n){this.send("com.redocly.workflowRun.click",e,n)}sendWorkflowRunResultMessage(e,n){this.send("com.redocly.workflowRun.result",e,n)}sendStorageReadMessage(e,n){this.send("com.redocly.storage.read",e,n)}sendStorageLoadUserStateMessage(e,n){this.send("com.redocly.storage.loadUserState",e,n)}sendStorageDetectFilesMessage(e,n){this.send("com.redocly.storage.detectFiles",e,n)}sendStorageLoadApisMessage(e,n){this.send("com.redocly.storage.loadApis",e,n)}sendStorageParseApisMessage(e,n){this.send("com.redocly.storage.parseApis",e,n)}sendStorageParseCollectionsMessage(e,n){this.send("com.redocly.storage.parseCollections",e,n)}sendUpdaterCheckMessage(e,n){this.send("com.redocly.updater.check",e,n)}sendUpdaterDownloadMessage(e,n){this.send("com.redocly.updater.download",e,n)}sendUpdaterInstallMessage(e,n){this.send("com.redocly.updater.install",e,n)}sendUpdaterProcessMessage(e,n){this.send("com.redocly.updater.process",e,n)}sendErrorMessage(e,n){this.send("com.redocly.error.occurred",e,n)}sendBackendEventMessage(e,n){this.send("com.redocly.backend.event",e,n)}sendCodeEditorSearchMessage(e,n){this.send("com.redocly.codeEditor.search",e,n)}sendAiChatToolCallStartedMessage(e,n){this.send("com.redocly.aiChat.toolCallStarted",e,n)}sendAiChatToolCallFinishedMessage(e,n){this.send("com.redocly.aiChat.toolCallFinished",e,n)}sendAiChatConversationStartedMessage(e,n){this.send("com.redocly.aiChat.conversationStarted",e,n)}sendAiChatConversationFinishedMessage(e,n){this.send("com.redocly.aiChat.conversationFinished",e,n)}sendDeepLinkOpenedMessage(e,n){this.send("com.redocly.deepLink.opened",e,n)}}const Vd=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],Xbe="https://cors.redocly.com/";function Wbe(){return{theme:"light",disableCollectionsTab:!1,oAuth2RedirectURI:void 0,corsProxyUrl:void 0,credentialOrigin:void 0,certificates:[],isApiBased:!1,generatedEnvironments:[],generatedInputs:[],hideOtherSecuritySchemes:!1,aiEnabled:!1,isPreviewLayout:!1}}const Zbe=Wbe(),qbe=y.createContext(Zbe);function qr(){const t=y.useContext(qbe);return IP(t)}function Ube(t,e){const{apps:{apiId:n}}=nt(),{corsProxyUrl:r,credentialOrigin:i,disableCollectionsTab:s,oAuth2RedirectURI:o,certificates:a,storageKey:l,isApiBased:c,aiEnabled:u,isPreviewLayout:f}=qr();r.set(t?.corsProxyUrl??Xbe),i.set(t?.credentialOrigin),n.set(t?.apiId),o.set(t?.oAuth2RedirectURI),s.set(!!t?.disableCollectionsTab),l.set(t?.storageKey),c.set(!!e),u.set(!!t?.aiEnabled),f.set(t?.layout==="preview"),y.useEffect(()=>{a.set(t?.certificates||[])},[t?.certificates])}const gb=y.createContext({});function gr(){return y.useContext(gb)||{}}const $C=process.env.NODE_ENV==="development",C_=process.env.NODE_ENV==="production",Bbe="0.27.1",Fbe={version:Bbe},Ybe={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"};class SW{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new Lbe}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(()=>({...Ybe,...e,env:C_?"production":"development"}))}enrichGlobalAttributes(e){this._globalAttributes={...this._globalAttributes,...e}}getGlobalAttributes(){return{...this._globalAttributes}}clearGlobalAttributes(){this._globalAttributes={platform:"",deviceId:""}}init(e){if(this.isInitialized)return;const{cloudEventData:n,...r}=e??{},i=r.tracerName||"desktop",s=r.enableErrorInstrumentation??i==="desktop",o={serviceName:"replay",serviceVersion:Fbe.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:C_,enableErrorInstrumentation:s};this._client.init({otel:{...o,...r}}),this.setCloudEventData(n),this._initResolve?.(this),this._isInitialized=!0}sendEvent(e,n){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const r=n.map(i=>({...this._globalAttributes,...i}));$C&&console.log(`[Telemetry] ${e}:`,JSON.stringify(r,null,2));try{this.client.send(e,r)}catch(i){console.error("Failed to send telemetry event:",i)}}startSpan(e,n,r){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{const i=(n??[{}]).map(s=>({...this._globalAttributes,...s}));return $C&&console.log(`[Telemetry] span ${e}:`,JSON.stringify(i,null,2)),this._client.startSpan(e,i,r)}catch(i){console.error("Failed to start telemetry span:",i);return}}}const _l=new SW;function Be(){const{telemetry:t}=gr();_l.isInitialized||_l.init(t);const e=t?.cloudEventData;y.useEffect(()=>{e&&_l.setCloudEventData(e)},[e]);const n=y.useCallback((i,s)=>{_l.sendEvent(i,s)},[]),r=y.useCallback((i,s,o)=>_l.startSpan(i,s,o),[]);return{sendEvent:n,startSpan:r}}const Gbe=({awaitInit:t=!0}={})=>{const[e,n]=y.useState(void 0);return y.useEffect(()=>{(async()=>{const i=t?await _l.awaitInit():_l;n(i)})()},[t]),e},$r=800,Ti=w.default(pe.Button).attrs({variant:"text",size:"small",tone:"danger"})`
510
510
  border: none;
511
511
  margin: 0;
512
512
 
@@ -762,14 +762,14 @@ ${Z}`),L.pop(),`{${ne}}`}case"number":return isFinite(E)?String(E):x?x(E):"null"
762
762
  border-radius: var(--border-radius);
763
763
  border: 1px solid var(--border-color-primary);
764
764
  padding: 0 calc(var(--spacing-xxs) / 2);
765
- `,cn=(t,e,n=new Set)=>{const r=JT(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.findLast(f=>f.name===l),u=t.slice(i,c?o:a);if(i=a,c){n.add(l);const f=cn(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 O0e(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function v0e(t,e){const n=IW(t);if(!n.length)return d.jsx(T_,{children:t});let r=0;const i=n.flatMap(({start:s,end:o})=>{const a=t.slice(r,s),l=O0e(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(T_,{children:i.join("")})}class y0e{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 up{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-d_ZK6ScA.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 mb={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function ql(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function b0e(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function x0e(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:b0e(t.body,n),header:e,contentType:n,time:t.duration}}async function EW(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(()=>qF);for(const{key:i,value:s,active:o}of t)if(!(!i||!s||!o))try{n[i]=r(s,e,mb)}catch{}return n}function S0e(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:ql(i?.request)??null,response:ql(i?.response)??null,outputs:ql(i?.outputs)??{}}))}const w0e=10080*60*1e3;async function AW(t){const e=Hl.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:lp(),date:Date.now(),...t})}catch(n){console.error("Failed to persist step context:",n)}}async function C0e(t,e,n){if(Hl.getInstance())for(const i of S0e(n,e))await AW({collectionId:t,workflowId:e,...i})}class Hl{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=up.getInstance(),i=new n(r);this.instance=new y0e(i)}static getInstance(){return this.instance}static close(){this.instance=null}}async function P0e(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 EW(o,{$response:r.response,$request:r.request??void 0});for(const[l,c]of Object.entries(a))l in i||(i[l]=c)}}n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function QW(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const k0e=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function T0e(t){const e=new RegExp(k0e),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const $0e=/^(\{?)(\$steps\.[^.{}\s]+\.(?:request|response)\.[^{}\s#]+)#\/([^{}\s]*)(\}?)$/;function I0e(t,e){const n=$0e.exec(t);if(!n)return;const[,r,i,s,o]=n;if(!!r!=!!o)return;let a;try{a=Ga(`${r}${i}${o}`,{$steps:e},mb)}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 QW(l)}function E0e(t,e){if(!t||!t.includes("$steps"))return t;const n=T0e(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=I0e(s,e);if(c!==void 0)l=c;else try{const u=QW(Ga(s,{$steps:e},mb));u!==void 0&&(l=u)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function A0e(t,e,n){const s=t.collections.find(a=>a.id.get()===e)?.workflows.find(a=>a.workflowId.get()===n)?.steps.get({noproxy:!0});if(!s)return{};const o={};for(const a of s)o[a.stepId]=a.outputs??[];return o}const Q0e=/\$steps\.([^.\s"'}]+)\./g;function R0e(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(Q0e))e.add(n[1]);return[...e]}function KT(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.get({noproxy:!0})),s(e?.get({noproxy:!0})),s(n?.components.parameters.get({noproxy:!0}));for(const o of r?.inputs??[])o.value&&i.push(o.value);return R0e(i.join("\0"))}async function e$(t,e,n,r){const i=Hl.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 P0e(o,A0e(t,e,n)):{}}function Lu(t,e,n){return E0e(cn(t,e),n)}function RW(t){return P8(t)}const jW="New Step";function AC({name:t=jW,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=j0e(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function j0e(t){return t.steps.filter(e=>e.state.get()!==jt.Draft).map(e=>e.stepId.get())}function wo({name:t=jW,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:s,dynamicReplayValues:o,xOperation:a}={}){if(!n){const c=s?nT(s,o):null,u=[ss()];return{stepId:AC({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?jt.Draft:jt.Normal,parameters:{pathParameters:[],queryParameters:a?Dp(a.url):[],headers:[],cookies:[]},requestBody:Kh(),xOperation:a??(i?null:{method:"GET",url:""}),security:u,operation:i??null,...c}}const l=n.get({noproxy:!0});return{stepId:AC({name:t,workflow:r}),description:l.description,outputs:l.outputs,successCriteria:l.successCriteria,state:e?jt.Draft:jt.Normal,parameters:l.parameters,requestBody:l.requestBody,xOperation:l.xOperation,security:l.security,operation:l.operation}}function sl(t){return RW(t)?t.xOperation?.ornull?.method.get()??t.operation.ornull?.method.get()??"":t.xOperation?.method??t.operation?.method??""}function dp(t){return RW(t)?t.xOperation?.ornull?.url.get()??t.operation.ornull?.nested("path").get()??"":t.xOperation?.url??t.operation?.path??""}function Ob(t,e,n,r,i){const{inputs:s,servers:o}=r,a=EJ(Za("path",[pn(e?.parameters.pathParameters,n?.components.parameters),pn(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=FE(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?n4(m.value,m.variables):"")+FE(c.path,a)}const h=u.split("?")[0];return{url:Lu(h,s,i??{}),method:f.toUpperCase()}}function t$(t,{collectionId:e,workflowId:n,stepId:r}){return t.collections.find(a=>a.id.get()===e)?.workflows.find(a=>a.workflowId.get()===n)?.steps.find(a=>a.stepId.get()===r)??null}function _0e(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 D0e(t,e,n,r,i={}){const{inputs:s}=r,{requestBody:{content:o}}=t,{url:a,method:l}=Ob(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast($=>$.securityType===te.DigestAuth);if(!c)return"";const{username:u,password:f,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,opaque:b}=c[te.DigestAuth],x=Lu(u,s,i),{pathname:P,search:S}=new URL(a),k=S?`${P}${S}`:P,T=N0e({username:x,password:Lu(f,s,i),uri:k,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,method:l,bodyContent:Lu(o,s,i)});return`Digest username="${x}", realm="${h}", nonce="${p}", uri="${k}", qop=${O}, nc=${v}, cnonce="${m}", response="${T}", algorithm=${g}${b?`, opaque="${b}"`:""}`}function N0e(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=M0e(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 M0e(t){return t?.replace("-sess","")==="SHA-256"?e=>xh(wM(e)):e=>xh(vy(e))}const yo=window.__TAURI__?.http.fetch??globalThis.fetch;function z0e(t){try{const n=new URL(t).hostname;return n==="localhost"||n==="127.0.0.1"}catch{return!1}}function Xv(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function V0e(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 L0e=["json","xml","html","text"],X0e=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function t1(t,e){return t.get(e)??t.get(e.toLowerCase())}function W0e(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function Z0e(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 q0e(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function U0e(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return X0e.some(r=>n.includes(r))?!0:n.startsWith("application/")?!L0e.some(r=>n.includes(r)):!1}async function B0e(t,e){const n=t1(t.headers,"content-type")?.split(";")[0].trim(),r=t1(t.headers,"content-disposition"),i=W0e(t1(t.headers,"content-length")),s=U0e(n,r),o=V0e(document.cookie);if(s){const h={fileName:Z0e(r)||q0e(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 F0e=":/?#[]@!$&'()*+,;=",Y0e=new Set(["!","'","(",")","*"]);function G0e(t){return Y0e.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function $_(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...F0e].map(i=>({char:i,encoded:G0e(i)}));for(const{char:i,encoded:s}of r)n=n.split(s).join(i);return n}function I_(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 _W(t,e){let n=I_(t);const r=e.find(({host:i,port:s})=>I_(`https://${i}:${s}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}function H0e(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function J0e(t,e){const{exists:n}=await Promise.resolve().then(()=>Hy),{join:r}=await Promise.resolve().then(()=>tX),{baseName:i,extension:s}=H0e(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 K0e(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}const Vf=new Map;function exe(t){Vf.get(t)?.abort()}function DW(t){return t?t instanceof FormData||t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function txe(t){if(!DW(t))return t}function vb(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function NW(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL(vb(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}async function MW({store:t,step:e,settings:n,workflow:r,collection:i,signal:s}){const{corsProxyUrl:o,credentialOrigin:a,certificates:l}=n.get(),c=Qd(t),u=await e$(t,i?.id.get(),r?.workflowId.get(),KT(e,r,i,c)),{url:f,method:h}=Ob(e.get(),r?.get(),i?.get(),c,u),p=o||"",m=XW(e,r,i,t,u),g=pxe(f,a),O=gxe({proxyUrl:p,resolvedUrl:f,ignoreProxy:g,queryParameters:m});await rxe(e,r??void 0,O,a,s);const v=yb(e,r??void 0,i??void 0,t,u),b=txe(r$(e,t,u)),{clientCert:x,clientKey:P}=_W(f,l||[]),S=vb(O),k=h.toUpperCase(),T=!Vd.includes(k),$=T?"POST":k,A=T?{...v,"X-HTTP-Method-Override":k}:v;return{urlWithProxyAndProtocol:S,fetchMethod:$,fetchHeaders:A,body:b,credentials:NW(S,a),mode:Xv(S)?"same-origin":"cors",clientCert:x,clientKey:P,resolvedUrl:f}}async function zW(t,e,n,r,i){const s=og(t),o=s.data;if(o.type.get()!==Le.Step){console.warn("not an operation tab");return}const{collectionId:a,workflowId:l,response:c,requestError:u,isProcessingRequest:f}=o,h=t.collections.find(b=>b.id.get()===a.get()),p=h?.workflows.find(b=>b.workflowId.get()===l.get()),m=xs(e.get({noproxy:!0}));f.set(!0);const g=s.id.get();Vf.get(g)?.abort();const O=new AbortController;Vf.set(g,O);const{signal:v}=O;try{const b=await MW({store:t,step:e,settings:n,workflow:p,collection:h,signal:v}),x=Date.now(),P={signal:v,method:b.fetchMethod,headers:b.fetchHeaders,body:b.body,mode:b.mode,credentials:b.credentials,clientCert:b.clientCert,clientKey:b.clientKey},S=await yo(b.urlWithProxyAndProtocol,P),k=Date.now()-x;u.set(null);const T=await B0e(S,k);c.set(T);const $=xs(c.value);r?.(m,$),i?.({outcome:"success",status:T.status,duration:T.duration,size:T.size})}catch(b){if(c.set(null),b.name==="AbortError")return;u.set(b.message||String(b));const x=xs(c.value);r?.(m,x),i?.({outcome:"error",error:b.message||String(b)})}finally{Vf.get(g)===O&&Vf.delete(g),f.set(!1)}}async function nxe({store:t,step:e,settings:n,workflow:r,collection:i,fileName:s,onProgress:o}){const a=await MW({store:t,step:e,settings:n,workflow:r,collection:i}),l={method:a.fetchMethod,headers:a.fetchHeaders,body:a.body,mode:a.mode,credentials:a.credentials,clientCert:a.clientCert,clientKey:a.clientKey},{clientCert:c,clientKey:u}=l,f=hn(),h=s||"response";let p=null;if(f){const{open:k}=await Promise.resolve().then(()=>require("./replay-index-CSR_qlua.js")),T=await k({directory:!0,multiple:!1});if(!T)return;const $=Array.isArray(T)?T[0]:T;p=await J0e($,h)}const m=await yo(a.urlWithProxyAndProtocol,l),g=m.headers.get("content-length"),O=g?Number.parseInt(g,10):void 0,v=Number.isFinite(O)?O:void 0,b=m.headers.get("content-type")??void 0;let x;if(m.body?.getReader){const k=m.body.getReader(),T=[];let $=0;for(;;){const{done:A,value:_}=await k.read();if(A)break;if(_){const D=new Uint8Array(_.byteLength);D.set(_),T.push(D.buffer),$+=_.byteLength,o?.({receivedBytes:$,totalBytes:v,done:!1})}}x=new Blob(T,{type:b}),o?.({receivedBytes:$,totalBytes:v,done:!0})}else x=await m.blob(),o?.({receivedBytes:x.size,totalBytes:v,done:!0});if(f){const{writeFile:k}=await Promise.resolve().then(()=>Hy),T=new Uint8Array(await x.arrayBuffer());if(!p)return;await k(p,T);return}const P=window.URL.createObjectURL(x),S=document.createElement("a");S.href=P,S.download=h,S.rel="noopener",S.click(),window.URL.revokeObjectURL(P)}async function rxe(t,e,n,r,i){const s=sl(t),a=[...Array.from(e?.security||[]),...Array.from(t.security)].findLast(l=>l.securityType.get()===te.DigestAuth);if(a){const l=vb(n),c=await yo(l,{signal:i,method:s.toUpperCase(),credentials:NW(l,r),mode:Xv(l)?"same-origin":"cors"}),u=_0e(c.headers.get("WWW-Authenticate")||"");a[te.DigestAuth].merge({nonce:u.nonce,realm:u.realm,qop:u.qop,algorithm:u.algorithm,opaque:u.opaque,cnonce:crypto.randomUUID(),nc:"00000001"})}}function ixe(t,e,n,r,i){return[...e?.security.get()||[],...t.security.get()].map(s=>{switch(s.securityType){case te.BasicAuth:{const o=s[te.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+btoa(`${pr(o.username,r,i)}:${pr(o.password,r,i)}`),active:!0,in:"header"}}case te.DigestAuth:{const o=Qd(r);return{id:"",key:"Authorization",value:D0e(t.get(),e?.get(),n?.get(),o,i),active:!0,in:"header"}}case te.JWT:return{id:"",key:"Authorization",value:"Bearer "+s[te.JWT].token,active:!0,in:"header"};case te.OAuth2:{const{grantType:o}=s[te.OAuth2],{accessToken:a}=s[te.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case te.OpenIDConnect:{const{grantType:o}=s[te.OpenIDConnect],{accessToken:a}=s[te.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case te.APIKey:{const o=s[te.APIKey];return o.location===Si.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(s=>!!s)}function sxe(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(P=>P.in==="query"),f=c.filter(P=>P.in==="header"),h=c.filter(P=>P.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(P=>o.some(S=>!Fl(S)&&S.key===P.name)),v=!h.every(P=>a.some(S=>!Fl(S)&&S.key===P.name)),b=!u.every(P=>l.some(S=>!Fl(S)&&S.key===P.name)),x=vue(t,e,n);return!p&&!m&&!g&&!O&&!v&&!b&&!x}function n$(t,e,n={}){const{requestBody:r}=t,s=sl(t).toUpperCase();if(s==="GET"||s==="HEAD"||s==="OPTIONS")return null;try{switch(r.type.get()){case"JSON":return structuredClone(pr(r.content.get(),e,n));case"multipart/form-data":return lxe(t,e,n);case"application/x-www-form-urlencoded":return axe(t,e,n);case"application/octet-stream":return r.binary.get();default:return pr(r.content.get(),e,n)}}catch(o){console.error(o)}}function r$(t,e,n={}){const{requestBody:r}=t,i=n$(t,e,n);if(i===null)return null;switch(r.type.get()){default:return i;case"multipart/form-data":return cxe(i);case"application/x-www-form-urlencoded":return oxe(i);case"application/octet-stream":return r.binary.ornull?.file.get()??null}}function oxe(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function axe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData["application/x-www-form-urlencoded"];return qW(s.get()).forEach(o=>{const a=pr(o.value,e,n);i.push({key:pr(o.key,e,n),value:a,type:"text"})}),i}function lxe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData["multipart/form-data"];return qW(s.get()).forEach(({type:o,files:a,value:l,key:c})=>{const u=pr(c,e,n);if(o==="file"&&a)for(const f of a)i.push({key:u,value:f,type:o});else if(l){const f=pr(l,e,n);i.push({key:u,value:f,type:o})}}),i}function cxe(t){const e=new FormData;return t.forEach(({key:n,value:r,type:i})=>{i==="file"?e.append(n,r.file):r&&e.append(n,r)}),e}function VW(t,e,n){return t.filter(r=>{const{securityType:i,[te.APIKey]:s}=r;return i===te.APIKey&&s.location===e&&!!s.name}).map(r=>{const{[te.APIKey]:i}=r;return{id:"",key:i.name,value:i.key,active:!0,in:n}})}function E_(t=[]){return VW(t,Si.Query,"query")}function LW(t,e,n){const r=n?.components.parameters.get();return Za("query",[E_(e?.security.get()),E_(t.security.get()),pn(e?.parameters.queryParameters.get(),r),pn(t.parameters.queryParameters.get(),r)])}function XW(t,e,n,r,i={}){return LW(t,e,n).map(o=>{const a=pr(o.value,r,i),l=$_(a,o.allowReserved);return`${$_(o.key)}=${l}`}).join("&")}function WW(t,e,n,r,i={}){return LW(t,e,n).reduce((o,a)=>{const l=pr(a.value,r,i),c=pr(a.key,r,i);return o[c]=l,o},{})}function uxe(t){const e=t.split("?")[0],n=K0e(e),r=/^\{[^\s]+\}$/,i=n.filter(s=>r.test(s)).map(s=>s.slice(1,-1));return new Set(i)}function yb(t,e,n,r,i={}){const s=hxe(t,r,i),o=ixe(t,e,n,r,i),a=dxe(t,e,n,r,i),l=n?.components.parameters.get();return Za("header",[s,o,a,pn(e?.parameters.headers.get(),l),pn(t.parameters.headers.get(),l)]).reduce((f,{key:h,value:p})=>(f[h]=pr(p,r,i),f),{})}function dxe(t,e,n,r,i={}){const o=ZW(t,e,n).map(a=>`${a.key}=${pr(a.value,r,i)}`).join("; ");return o?[{id:"",key:"Cookie",value:o,active:!0,in:"header"},{id:"",key:"X-Redocly-Cookie",value:o,active:!0,in:"header"}]:[]}function fxe(t,e,n,r,i={}){return ZW(t,e,n).reduce((o,a)=>{const l=pr(a.value,r,i);return{...o,[pr(a.key,r,i)]:l}},{})}function A_(t=[]){return VW(t,Si.Cookie,"cookie")}function ZW(t,e,n){const r=n?.components.parameters.get();return Za("cookie",[A_(e?.security.get()),A_(t.security.get()),pn(e?.parameters.cookies.get(),r),pn(t.parameters.cookies.get(),r)])}function qW(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function hxe(t,e,n={}){const{requestBody:r}=t,i=r$(t,e,n);return["binary","multipart/form-data"].includes(r.type.get())?[]:DW(i)?[]:[{id:"",key:"Content-Type",value:r.type.get(),active:!0,in:"header"}]}function pr(t,e,n={}){return e?Lu(t,Qd(e)?.inputs,n):t}function pxe(t,e){return z0e(t)||Xv(t)||!!(e&&Xv(vb(t),e))}function gxe({proxyUrl:t,resolvedUrl:e,ignoreProxy:n,queryParameters:r=""}){const i=t!=="/"?PS(t):t;let s;return n||!i?s=e:s=`${i}/${e}`,r&&(s+=`?${r}`),s}function i$(t){return t.flatMap(e=>{const n=e.id.get();return(e.paths?.keys??[]).flatMap(i=>{const s=e.paths.nested(i),a=(s.keys??[]).filter(u=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(u.toLowerCase())).map(u=>{const f=s.nested(u),h=f.operationId.get()||"",p=f.summary.get();return{apiId:n,path:i,method:u,operationId:h,summary:p,isAdditionalOperation:!1}}),l=s.additionalOperations?.get(),c=l?Object.entries(l).map(([u,f])=>({apiId:n,path:i,method:u,operationId:f.operationId||"",summary:f.summary,isAdditionalOperation:!0})):[];return[...a,...c]})})}const UW=(t,e,n)=>{if(!e)return null;const{apiId:r,method:i,path:s}=e,o=t.find(l=>l.id.get()===r);if(!o)return null;if(n)try{return n(s,i,o.get({noproxy:!0}))??null}catch(l){console.error("Failed to convert operation to replay value",l)}const a=o.paths?.nested(s)?.nested(i)?.ornull;return a?{id:a.operationId.get()??"",name:a.summary.get()??"",method:i,path:s,href:"",operationId:a.operationId.get(),parameters:[],servers:[],security:[]}:null};function og({tabsState:{activeTabIdx:t,tabs:e}}){return e[t?.get()??0]}function mxe(t){const{environments:e,apis:n,tabsState:{tabs:r}}=t,i=r.filter(l=>l.data.type.get()===Le.Step),s=i$(n),o=i.map(l=>{const{collectionId:c,workflowId:u,satisfiesScheme:f}=l.data.get(),h=l.data.draftStep.ornull;if(h===null)return null;const{operationId:p,apiId:m}=h.get().operation??{};if(!f||!p)return null;const g=t.collections.find(T=>T.id.get()===c),O=g?.workflows.find(T=>T.workflowId.get()===u),v=s.find(T=>T.operationId===p&&T.apiId===m);if(!v)return null;const b=yb(h,O,g,t),x=r$(h,t),P=fxe(h,O,g,t),S=WW(h,O,g,t),k=h.requestBody.activeExampleName;return{apiPath:{path:v.path,method:v.method},requestValues:{cookie:P,header:b,query:S,body:x},activeExampleName:k.get()}}).filter(l=>l!==null),a=Qd(t);return{operations:o,environment:a?.name,environments:Object.fromEntries(e.get().map(l=>[l.name,{...Object.fromEntries(l.inputs.filter(({isSecret:c})=>!c).map(({name:c,value:u})=>[c,u])),...Object.fromEntries(l.servers.map(({apiId:c,value:u})=>[c,u]))}]))}}function Oxe(t){return t.filter(e=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(e.toLowerCase()))}function vxe(t){const e=new Map;return(t.paths?.keys??[]).forEach(r=>{const i=t.paths.nested(r);Oxe(i.keys).forEach(a=>{const l=i.nested(a),c=l.tags?.get()||[],u=l.summary?.get(),f=l.operationId?.get();(c.length?c:["Untagged"]).forEach(p=>{const m=e.get(p)??[];m.push({path:r,method:a,summary:u,operationId:f,isAdditionalOperation:!1}),e.set(p,m)})});const o=i.additionalOperations?.get();o&&Object.entries(o).forEach(([a,l])=>{const c=l.tags||[],u=l.summary,f=l.operationId;(c.length?c:["Untagged"]).forEach(p=>{const m=e.get(p)??[];m.push({path:r,method:a,summary:u,operationId:f,isAdditionalOperation:!0}),e.set(p,m)})})}),e}function yxe({apiId:t,apiTitle:e,tagToOperations:n}){return Array.from(n.entries()).map(([i,s])=>{const o=s.map(a=>({id:s$({apiId:t,method:a.method,path:a.path}),name:a.summary||a.path,apiTitle:e,type:"operation",apiId:t,path:a.path,tagName:i,method:a.method,summary:a.summary,isAdditionalOperation:a.isAdditionalOperation}));return o.length===0?null:{id:`${t}-${i}`,name:i,apiTitle:e,type:"tag",apiId:t,tagName:i,children:o}}).filter(Boolean)}function BW(t){const e=t.id.get(),n=t.info?.title?.get()||e,r=vxe(t),i=yxe({apiId:e,apiTitle:n,tagToOperations:r});return i.length===0?null:{id:e,name:n,apiTitle:n,type:"api",apiId:e,api:t,children:i}}const s$=({apiId:t,method:e,path:n})=>`${t}-${e.toUpperCase()}-${n}`;function bxe(t){const e=t.data.get();switch(e.type){case Le.Workflow:return`${e.collectionId}/${e.workflowId}`;case Le.Collection:return e.collectionId;case Le.Step:return`${e.collectionId}/${e.workflowId}/${e.stepId}`;case Le.WorkflowRun:return`${e.collectionId}/${e.workflowId}`}}function xxe(t){const e=t.data.get();if(e.type!==Le.Step)return;const{apiId:n,path:r,method:i}=e.draftStep?.operation??{};if(!(!n||!r||!i))return s$({apiId:n,path:r,method:i})}function gl(t){const e=nt(),n=og(e);return!n.get()||t&&!bn(n.data.get(),t)?{tab:null,tabDataId:void 0,apiNodeId:void 0}:{tab:n,tabDataId:bxe(n),apiNodeId:xxe(n)}}function Sxe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return y.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const bb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Xd(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function o$(t){return"nodeType"in t}function Ur(t){var e,n;return t?Xd(t)?t:o$(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function a$(t){const{Document:e}=Ur(t);return t instanceof e}function ag(t){return Xd(t)?!1:t instanceof Ur(t).HTMLElement}function FW(t){return t instanceof Ur(t).SVGElement}function Wd(t){return t?Xd(t)?t.document:o$(t)?a$(t)?t:ag(t)||FW(t)?t.ownerDocument:document:document:document}const ns=bb?y.useLayoutEffect:y.useEffect;function xb(t){const e=y.useRef(t);return ns(()=>{e.current=t}),y.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function wxe(){const t=y.useRef(null),e=y.useCallback((r,i)=>{t.current=setInterval(r,i)},[]),n=y.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function fp(t,e){e===void 0&&(e=[t]);const n=y.useRef(t);return ns(()=>{n.current!==t&&(n.current=t)},e),n}function lg(t,e){const n=y.useRef();return y.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function Wv(t){const e=xb(t),n=y.useRef(null),r=y.useCallback(i=>{i!==n.current&&e?.(i,n.current),n.current=i},[]);return[n,r]}function Zv(t){const e=y.useRef();return y.useEffect(()=>{e.current=t},[t]),e.current}let n1={};function cg(t,e){return y.useMemo(()=>{if(e)return e;const n=n1[t]==null?0:n1[t]+1;return n1[t]=n,t+"-"+n},[t,e])}function YW(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const a=Object.entries(o);for(const[l,c]of a){const u=s[l];u!=null&&(s[l]=u+t*c)}return s},{...e})}}const Xu=YW(1),qv=YW(-1);function Cxe(t){return"clientX"in t&&"clientY"in t}function Sb(t){if(!t)return!1;const{KeyboardEvent:e}=Ur(t.target);return e&&t instanceof e}function Pxe(t){if(!t)return!1;const{TouchEvent:e}=Ur(t.target);return e&&t instanceof e}function Uv(t){if(Pxe(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return Cxe(t)?{x:t.clientX,y:t.clientY}:null}const ol=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[ol.Translate.toString(t),ol.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),Q_="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function kxe(t){return t.matches(Q_)?t:t.querySelector(Q_)}const Txe={display:"none"};function $xe(t){let{id:e,value:n}=t;return U.default.createElement("div",{id:e,style:Txe},n)}function Ixe(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const i={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return U.default.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function Exe(){const[t,e]=y.useState("");return{announce:y.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const GW=y.createContext(null);function Axe(t){const e=y.useContext(GW);y.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function Qxe(){const[t]=y.useState(()=>new Set),e=y.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[y.useCallback(r=>{let{type:i,event:s}=r;t.forEach(o=>{var a;return(a=o[i])==null?void 0:a.call(o,s)})},[t]),e]}const Rxe={draggable:`
765
+ `,cn=(t,e,n=new Set)=>{const r=JT(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.findLast(f=>f.name===l),u=t.slice(i,c?o:a);if(i=a,c){n.add(l);const f=cn(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 O0e(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function v0e(t,e){const n=IW(t);if(!n.length)return d.jsx(T_,{children:t});let r=0;const i=n.flatMap(({start:s,end:o})=>{const a=t.slice(r,s),l=O0e(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(T_,{children:i.join("")})}class y0e{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 up{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-ClD7MBeX.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 mb={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function ql(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function b0e(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function x0e(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:b0e(t.body,n),header:e,contentType:n,time:t.duration}}async function EW(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(()=>qF);for(const{key:i,value:s,active:o}of t)if(!(!i||!s||!o))try{n[i]=r(s,e,mb)}catch{}return n}function S0e(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:ql(i?.request)??null,response:ql(i?.response)??null,outputs:ql(i?.outputs)??{}}))}const w0e=10080*60*1e3;async function AW(t){const e=Hl.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:lp(),date:Date.now(),...t})}catch(n){console.error("Failed to persist step context:",n)}}async function C0e(t,e,n){if(Hl.getInstance())for(const i of S0e(n,e))await AW({collectionId:t,workflowId:e,...i})}class Hl{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=up.getInstance(),i=new n(r);this.instance=new y0e(i)}static getInstance(){return this.instance}static close(){this.instance=null}}async function P0e(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 EW(o,{$response:r.response,$request:r.request??void 0});for(const[l,c]of Object.entries(a))l in i||(i[l]=c)}}n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function QW(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const k0e=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function T0e(t){const e=new RegExp(k0e),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const $0e=/^(\{?)(\$steps\.[^.{}\s]+\.(?:request|response)\.[^{}\s#]+)#\/([^{}\s]*)(\}?)$/;function I0e(t,e){const n=$0e.exec(t);if(!n)return;const[,r,i,s,o]=n;if(!!r!=!!o)return;let a;try{a=Ga(`${r}${i}${o}`,{$steps:e},mb)}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 QW(l)}function E0e(t,e){if(!t||!t.includes("$steps"))return t;const n=T0e(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=I0e(s,e);if(c!==void 0)l=c;else try{const u=QW(Ga(s,{$steps:e},mb));u!==void 0&&(l=u)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function A0e(t,e,n){const s=t.collections.find(a=>a.id.get()===e)?.workflows.find(a=>a.workflowId.get()===n)?.steps.get({noproxy:!0});if(!s)return{};const o={};for(const a of s)o[a.stepId]=a.outputs??[];return o}const Q0e=/\$steps\.([^.\s"'}]+)\./g;function R0e(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(Q0e))e.add(n[1]);return[...e]}function KT(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.get({noproxy:!0})),s(e?.get({noproxy:!0})),s(n?.components.parameters.get({noproxy:!0}));for(const o of r?.inputs??[])o.value&&i.push(o.value);return R0e(i.join("\0"))}async function e$(t,e,n,r){const i=Hl.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 P0e(o,A0e(t,e,n)):{}}function Lu(t,e,n){return E0e(cn(t,e),n)}function RW(t){return P8(t)}const jW="New Step";function AC({name:t=jW,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=j0e(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function j0e(t){return t.steps.filter(e=>e.state.get()!==jt.Draft).map(e=>e.stepId.get())}function wo({name:t=jW,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:s,dynamicReplayValues:o,xOperation:a}={}){if(!n){const c=s?nT(s,o):null,u=[ss()];return{stepId:AC({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?jt.Draft:jt.Normal,parameters:{pathParameters:[],queryParameters:a?Dp(a.url):[],headers:[],cookies:[]},requestBody:Kh(),xOperation:a??(i?null:{method:"GET",url:""}),security:u,operation:i??null,...c}}const l=n.get({noproxy:!0});return{stepId:AC({name:t,workflow:r}),description:l.description,outputs:l.outputs,successCriteria:l.successCriteria,state:e?jt.Draft:jt.Normal,parameters:l.parameters,requestBody:l.requestBody,xOperation:l.xOperation,security:l.security,operation:l.operation}}function sl(t){return RW(t)?t.xOperation?.ornull?.method.get()??t.operation.ornull?.method.get()??"":t.xOperation?.method??t.operation?.method??""}function dp(t){return RW(t)?t.xOperation?.ornull?.url.get()??t.operation.ornull?.nested("path").get()??"":t.xOperation?.url??t.operation?.path??""}function Ob(t,e,n,r,i){const{inputs:s,servers:o}=r,a=EJ(Za("path",[pn(e?.parameters.pathParameters,n?.components.parameters),pn(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=FE(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?n4(m.value,m.variables):"")+FE(c.path,a)}const h=u.split("?")[0];return{url:Lu(h,s,i??{}),method:f.toUpperCase()}}function t$(t,{collectionId:e,workflowId:n,stepId:r}){return t.collections.find(a=>a.id.get()===e)?.workflows.find(a=>a.workflowId.get()===n)?.steps.find(a=>a.stepId.get()===r)??null}function _0e(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 D0e(t,e,n,r,i={}){const{inputs:s}=r,{requestBody:{content:o}}=t,{url:a,method:l}=Ob(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast($=>$.securityType===te.DigestAuth);if(!c)return"";const{username:u,password:f,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,opaque:b}=c[te.DigestAuth],x=Lu(u,s,i),{pathname:P,search:S}=new URL(a),k=S?`${P}${S}`:P,T=N0e({username:x,password:Lu(f,s,i),uri:k,realm:h,nonce:p,cnonce:m,algorithm:g,qop:O,nc:v,method:l,bodyContent:Lu(o,s,i)});return`Digest username="${x}", realm="${h}", nonce="${p}", uri="${k}", qop=${O}, nc=${v}, cnonce="${m}", response="${T}", algorithm=${g}${b?`, opaque="${b}"`:""}`}function N0e(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=M0e(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 M0e(t){return t?.replace("-sess","")==="SHA-256"?e=>xh(wM(e)):e=>xh(vy(e))}const yo=window.__TAURI__?.http.fetch??globalThis.fetch;function z0e(t){try{const n=new URL(t).hostname;return n==="localhost"||n==="127.0.0.1"}catch{return!1}}function Xv(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function V0e(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 L0e=["json","xml","html","text"],X0e=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function t1(t,e){return t.get(e)??t.get(e.toLowerCase())}function W0e(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function Z0e(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 q0e(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function U0e(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return X0e.some(r=>n.includes(r))?!0:n.startsWith("application/")?!L0e.some(r=>n.includes(r)):!1}async function B0e(t,e){const n=t1(t.headers,"content-type")?.split(";")[0].trim(),r=t1(t.headers,"content-disposition"),i=W0e(t1(t.headers,"content-length")),s=U0e(n,r),o=V0e(document.cookie);if(s){const h={fileName:Z0e(r)||q0e(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 F0e=":/?#[]@!$&'()*+,;=",Y0e=new Set(["!","'","(",")","*"]);function G0e(t){return Y0e.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function $_(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...F0e].map(i=>({char:i,encoded:G0e(i)}));for(const{char:i,encoded:s}of r)n=n.split(s).join(i);return n}function I_(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 _W(t,e){let n=I_(t);const r=e.find(({host:i,port:s})=>I_(`https://${i}:${s}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}function H0e(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function J0e(t,e){const{exists:n}=await Promise.resolve().then(()=>Hy),{join:r}=await Promise.resolve().then(()=>tX),{baseName:i,extension:s}=H0e(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 K0e(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}const Vf=new Map;function exe(t){Vf.get(t)?.abort()}function DW(t){return t?t instanceof FormData||t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function txe(t){if(!DW(t))return t}function vb(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function NW(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL(vb(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}async function MW({store:t,step:e,settings:n,workflow:r,collection:i,signal:s}){const{corsProxyUrl:o,credentialOrigin:a,certificates:l}=n.get(),c=Qd(t),u=await e$(t,i?.id.get(),r?.workflowId.get(),KT(e,r,i,c)),{url:f,method:h}=Ob(e.get(),r?.get(),i?.get(),c,u),p=o||"",m=XW(e,r,i,t,u),g=pxe(f,a),O=gxe({proxyUrl:p,resolvedUrl:f,ignoreProxy:g,queryParameters:m});await rxe(e,r??void 0,O,a,s);const v=yb(e,r??void 0,i??void 0,t,u),b=txe(r$(e,t,u)),{clientCert:x,clientKey:P}=_W(f,l||[]),S=vb(O),k=h.toUpperCase(),T=!Vd.includes(k),$=T?"POST":k,A=T?{...v,"X-HTTP-Method-Override":k}:v;return{urlWithProxyAndProtocol:S,fetchMethod:$,fetchHeaders:A,body:b,credentials:NW(S,a),mode:Xv(S)?"same-origin":"cors",clientCert:x,clientKey:P,resolvedUrl:f}}async function zW(t,e,n,r,i){const s=og(t),o=s.data;if(o.type.get()!==Le.Step){console.warn("not an operation tab");return}const{collectionId:a,workflowId:l,response:c,requestError:u,isProcessingRequest:f}=o,h=t.collections.find(b=>b.id.get()===a.get()),p=h?.workflows.find(b=>b.workflowId.get()===l.get()),m=xs(e.get({noproxy:!0}));f.set(!0);const g=s.id.get();Vf.get(g)?.abort();const O=new AbortController;Vf.set(g,O);const{signal:v}=O;try{const b=await MW({store:t,step:e,settings:n,workflow:p,collection:h,signal:v}),x=Date.now(),P={signal:v,method:b.fetchMethod,headers:b.fetchHeaders,body:b.body,mode:b.mode,credentials:b.credentials,clientCert:b.clientCert,clientKey:b.clientKey},S=await yo(b.urlWithProxyAndProtocol,P),k=Date.now()-x;u.set(null);const T=await B0e(S,k);c.set(T);const $=xs(c.value);r?.(m,$),i?.({outcome:"success",status:T.status,duration:T.duration,size:T.size})}catch(b){if(c.set(null),b.name==="AbortError")return;u.set(b.message||String(b));const x=xs(c.value);r?.(m,x),i?.({outcome:"error",error:b.message||String(b)})}finally{Vf.get(g)===O&&Vf.delete(g),f.set(!1)}}async function nxe({store:t,step:e,settings:n,workflow:r,collection:i,fileName:s,onProgress:o}){const a=await MW({store:t,step:e,settings:n,workflow:r,collection:i}),l={method:a.fetchMethod,headers:a.fetchHeaders,body:a.body,mode:a.mode,credentials:a.credentials,clientCert:a.clientCert,clientKey:a.clientKey},{clientCert:c,clientKey:u}=l,f=hn(),h=s||"response";let p=null;if(f){const{open:k}=await Promise.resolve().then(()=>require("./replay-index-HHtp5T42.js")),T=await k({directory:!0,multiple:!1});if(!T)return;const $=Array.isArray(T)?T[0]:T;p=await J0e($,h)}const m=await yo(a.urlWithProxyAndProtocol,l),g=m.headers.get("content-length"),O=g?Number.parseInt(g,10):void 0,v=Number.isFinite(O)?O:void 0,b=m.headers.get("content-type")??void 0;let x;if(m.body?.getReader){const k=m.body.getReader(),T=[];let $=0;for(;;){const{done:A,value:_}=await k.read();if(A)break;if(_){const D=new Uint8Array(_.byteLength);D.set(_),T.push(D.buffer),$+=_.byteLength,o?.({receivedBytes:$,totalBytes:v,done:!1})}}x=new Blob(T,{type:b}),o?.({receivedBytes:$,totalBytes:v,done:!0})}else x=await m.blob(),o?.({receivedBytes:x.size,totalBytes:v,done:!0});if(f){const{writeFile:k}=await Promise.resolve().then(()=>Hy),T=new Uint8Array(await x.arrayBuffer());if(!p)return;await k(p,T);return}const P=window.URL.createObjectURL(x),S=document.createElement("a");S.href=P,S.download=h,S.rel="noopener",S.click(),window.URL.revokeObjectURL(P)}async function rxe(t,e,n,r,i){const s=sl(t),a=[...Array.from(e?.security||[]),...Array.from(t.security)].findLast(l=>l.securityType.get()===te.DigestAuth);if(a){const l=vb(n),c=await yo(l,{signal:i,method:s.toUpperCase(),credentials:NW(l,r),mode:Xv(l)?"same-origin":"cors"}),u=_0e(c.headers.get("WWW-Authenticate")||"");a[te.DigestAuth].merge({nonce:u.nonce,realm:u.realm,qop:u.qop,algorithm:u.algorithm,opaque:u.opaque,cnonce:crypto.randomUUID(),nc:"00000001"})}}function ixe(t,e,n,r,i){return[...e?.security.get()||[],...t.security.get()].map(s=>{switch(s.securityType){case te.BasicAuth:{const o=s[te.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+btoa(`${pr(o.username,r,i)}:${pr(o.password,r,i)}`),active:!0,in:"header"}}case te.DigestAuth:{const o=Qd(r);return{id:"",key:"Authorization",value:D0e(t.get(),e?.get(),n?.get(),o,i),active:!0,in:"header"}}case te.JWT:return{id:"",key:"Authorization",value:"Bearer "+s[te.JWT].token,active:!0,in:"header"};case te.OAuth2:{const{grantType:o}=s[te.OAuth2],{accessToken:a}=s[te.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case te.OpenIDConnect:{const{grantType:o}=s[te.OpenIDConnect],{accessToken:a}=s[te.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case te.APIKey:{const o=s[te.APIKey];return o.location===Si.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(s=>!!s)}function sxe(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(P=>P.in==="query"),f=c.filter(P=>P.in==="header"),h=c.filter(P=>P.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(P=>o.some(S=>!Fl(S)&&S.key===P.name)),v=!h.every(P=>a.some(S=>!Fl(S)&&S.key===P.name)),b=!u.every(P=>l.some(S=>!Fl(S)&&S.key===P.name)),x=vue(t,e,n);return!p&&!m&&!g&&!O&&!v&&!b&&!x}function n$(t,e,n={}){const{requestBody:r}=t,s=sl(t).toUpperCase();if(s==="GET"||s==="HEAD"||s==="OPTIONS")return null;try{switch(r.type.get()){case"JSON":return structuredClone(pr(r.content.get(),e,n));case"multipart/form-data":return lxe(t,e,n);case"application/x-www-form-urlencoded":return axe(t,e,n);case"application/octet-stream":return r.binary.get();default:return pr(r.content.get(),e,n)}}catch(o){console.error(o)}}function r$(t,e,n={}){const{requestBody:r}=t,i=n$(t,e,n);if(i===null)return null;switch(r.type.get()){default:return i;case"multipart/form-data":return cxe(i);case"application/x-www-form-urlencoded":return oxe(i);case"application/octet-stream":return r.binary.ornull?.file.get()??null}}function oxe(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function axe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData["application/x-www-form-urlencoded"];return qW(s.get()).forEach(o=>{const a=pr(o.value,e,n);i.push({key:pr(o.key,e,n),value:a,type:"text"})}),i}function lxe(t,e,n={}){const{requestBody:r}=t,i=[],s=r.formData["multipart/form-data"];return qW(s.get()).forEach(({type:o,files:a,value:l,key:c})=>{const u=pr(c,e,n);if(o==="file"&&a)for(const f of a)i.push({key:u,value:f,type:o});else if(l){const f=pr(l,e,n);i.push({key:u,value:f,type:o})}}),i}function cxe(t){const e=new FormData;return t.forEach(({key:n,value:r,type:i})=>{i==="file"?e.append(n,r.file):r&&e.append(n,r)}),e}function VW(t,e,n){return t.filter(r=>{const{securityType:i,[te.APIKey]:s}=r;return i===te.APIKey&&s.location===e&&!!s.name}).map(r=>{const{[te.APIKey]:i}=r;return{id:"",key:i.name,value:i.key,active:!0,in:n}})}function E_(t=[]){return VW(t,Si.Query,"query")}function LW(t,e,n){const r=n?.components.parameters.get();return Za("query",[E_(e?.security.get()),E_(t.security.get()),pn(e?.parameters.queryParameters.get(),r),pn(t.parameters.queryParameters.get(),r)])}function XW(t,e,n,r,i={}){return LW(t,e,n).map(o=>{const a=pr(o.value,r,i),l=$_(a,o.allowReserved);return`${$_(o.key)}=${l}`}).join("&")}function WW(t,e,n,r,i={}){return LW(t,e,n).reduce((o,a)=>{const l=pr(a.value,r,i),c=pr(a.key,r,i);return o[c]=l,o},{})}function uxe(t){const e=t.split("?")[0],n=K0e(e),r=/^\{[^\s]+\}$/,i=n.filter(s=>r.test(s)).map(s=>s.slice(1,-1));return new Set(i)}function yb(t,e,n,r,i={}){const s=hxe(t,r,i),o=ixe(t,e,n,r,i),a=dxe(t,e,n,r,i),l=n?.components.parameters.get();return Za("header",[s,o,a,pn(e?.parameters.headers.get(),l),pn(t.parameters.headers.get(),l)]).reduce((f,{key:h,value:p})=>(f[h]=pr(p,r,i),f),{})}function dxe(t,e,n,r,i={}){const o=ZW(t,e,n).map(a=>`${a.key}=${pr(a.value,r,i)}`).join("; ");return o?[{id:"",key:"Cookie",value:o,active:!0,in:"header"},{id:"",key:"X-Redocly-Cookie",value:o,active:!0,in:"header"}]:[]}function fxe(t,e,n,r,i={}){return ZW(t,e,n).reduce((o,a)=>{const l=pr(a.value,r,i);return{...o,[pr(a.key,r,i)]:l}},{})}function A_(t=[]){return VW(t,Si.Cookie,"cookie")}function ZW(t,e,n){const r=n?.components.parameters.get();return Za("cookie",[A_(e?.security.get()),A_(t.security.get()),pn(e?.parameters.cookies.get(),r),pn(t.parameters.cookies.get(),r)])}function qW(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function hxe(t,e,n={}){const{requestBody:r}=t,i=r$(t,e,n);return["binary","multipart/form-data"].includes(r.type.get())?[]:DW(i)?[]:[{id:"",key:"Content-Type",value:r.type.get(),active:!0,in:"header"}]}function pr(t,e,n={}){return e?Lu(t,Qd(e)?.inputs,n):t}function pxe(t,e){return z0e(t)||Xv(t)||!!(e&&Xv(vb(t),e))}function gxe({proxyUrl:t,resolvedUrl:e,ignoreProxy:n,queryParameters:r=""}){const i=t!=="/"?PS(t):t;let s;return n||!i?s=e:s=`${i}/${e}`,r&&(s+=`?${r}`),s}function i$(t){return t.flatMap(e=>{const n=e.id.get();return(e.paths?.keys??[]).flatMap(i=>{const s=e.paths.nested(i),a=(s.keys??[]).filter(u=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(u.toLowerCase())).map(u=>{const f=s.nested(u),h=f.operationId.get()||"",p=f.summary.get();return{apiId:n,path:i,method:u,operationId:h,summary:p,isAdditionalOperation:!1}}),l=s.additionalOperations?.get(),c=l?Object.entries(l).map(([u,f])=>({apiId:n,path:i,method:u,operationId:f.operationId||"",summary:f.summary,isAdditionalOperation:!0})):[];return[...a,...c]})})}const UW=(t,e,n)=>{if(!e)return null;const{apiId:r,method:i,path:s}=e,o=t.find(l=>l.id.get()===r);if(!o)return null;if(n)try{return n(s,i,o.get({noproxy:!0}))??null}catch(l){console.error("Failed to convert operation to replay value",l)}const a=o.paths?.nested(s)?.nested(i)?.ornull;return a?{id:a.operationId.get()??"",name:a.summary.get()??"",method:i,path:s,href:"",operationId:a.operationId.get(),parameters:[],servers:[],security:[]}:null};function og({tabsState:{activeTabIdx:t,tabs:e}}){return e[t?.get()??0]}function mxe(t){const{environments:e,apis:n,tabsState:{tabs:r}}=t,i=r.filter(l=>l.data.type.get()===Le.Step),s=i$(n),o=i.map(l=>{const{collectionId:c,workflowId:u,satisfiesScheme:f}=l.data.get(),h=l.data.draftStep.ornull;if(h===null)return null;const{operationId:p,apiId:m}=h.get().operation??{};if(!f||!p)return null;const g=t.collections.find(T=>T.id.get()===c),O=g?.workflows.find(T=>T.workflowId.get()===u),v=s.find(T=>T.operationId===p&&T.apiId===m);if(!v)return null;const b=yb(h,O,g,t),x=r$(h,t),P=fxe(h,O,g,t),S=WW(h,O,g,t),k=h.requestBody.activeExampleName;return{apiPath:{path:v.path,method:v.method},requestValues:{cookie:P,header:b,query:S,body:x},activeExampleName:k.get()}}).filter(l=>l!==null),a=Qd(t);return{operations:o,environment:a?.name,environments:Object.fromEntries(e.get().map(l=>[l.name,{...Object.fromEntries(l.inputs.filter(({isSecret:c})=>!c).map(({name:c,value:u})=>[c,u])),...Object.fromEntries(l.servers.map(({apiId:c,value:u})=>[c,u]))}]))}}function Oxe(t){return t.filter(e=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(e.toLowerCase()))}function vxe(t){const e=new Map;return(t.paths?.keys??[]).forEach(r=>{const i=t.paths.nested(r);Oxe(i.keys).forEach(a=>{const l=i.nested(a),c=l.tags?.get()||[],u=l.summary?.get(),f=l.operationId?.get();(c.length?c:["Untagged"]).forEach(p=>{const m=e.get(p)??[];m.push({path:r,method:a,summary:u,operationId:f,isAdditionalOperation:!1}),e.set(p,m)})});const o=i.additionalOperations?.get();o&&Object.entries(o).forEach(([a,l])=>{const c=l.tags||[],u=l.summary,f=l.operationId;(c.length?c:["Untagged"]).forEach(p=>{const m=e.get(p)??[];m.push({path:r,method:a,summary:u,operationId:f,isAdditionalOperation:!0}),e.set(p,m)})})}),e}function yxe({apiId:t,apiTitle:e,tagToOperations:n}){return Array.from(n.entries()).map(([i,s])=>{const o=s.map(a=>({id:s$({apiId:t,method:a.method,path:a.path}),name:a.summary||a.path,apiTitle:e,type:"operation",apiId:t,path:a.path,tagName:i,method:a.method,summary:a.summary,isAdditionalOperation:a.isAdditionalOperation}));return o.length===0?null:{id:`${t}-${i}`,name:i,apiTitle:e,type:"tag",apiId:t,tagName:i,children:o}}).filter(Boolean)}function BW(t){const e=t.id.get(),n=t.info?.title?.get()||e,r=vxe(t),i=yxe({apiId:e,apiTitle:n,tagToOperations:r});return i.length===0?null:{id:e,name:n,apiTitle:n,type:"api",apiId:e,api:t,children:i}}const s$=({apiId:t,method:e,path:n})=>`${t}-${e.toUpperCase()}-${n}`;function bxe(t){const e=t.data.get();switch(e.type){case Le.Workflow:return`${e.collectionId}/${e.workflowId}`;case Le.Collection:return e.collectionId;case Le.Step:return`${e.collectionId}/${e.workflowId}/${e.stepId}`;case Le.WorkflowRun:return`${e.collectionId}/${e.workflowId}`}}function xxe(t){const e=t.data.get();if(e.type!==Le.Step)return;const{apiId:n,path:r,method:i}=e.draftStep?.operation??{};if(!(!n||!r||!i))return s$({apiId:n,path:r,method:i})}function gl(t){const e=nt(),n=og(e);return!n.get()||t&&!bn(n.data.get(),t)?{tab:null,tabDataId:void 0,apiNodeId:void 0}:{tab:n,tabDataId:bxe(n),apiNodeId:xxe(n)}}function Sxe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return y.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const bb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Xd(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function o$(t){return"nodeType"in t}function Ur(t){var e,n;return t?Xd(t)?t:o$(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function a$(t){const{Document:e}=Ur(t);return t instanceof e}function ag(t){return Xd(t)?!1:t instanceof Ur(t).HTMLElement}function FW(t){return t instanceof Ur(t).SVGElement}function Wd(t){return t?Xd(t)?t.document:o$(t)?a$(t)?t:ag(t)||FW(t)?t.ownerDocument:document:document:document}const ns=bb?y.useLayoutEffect:y.useEffect;function xb(t){const e=y.useRef(t);return ns(()=>{e.current=t}),y.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function wxe(){const t=y.useRef(null),e=y.useCallback((r,i)=>{t.current=setInterval(r,i)},[]),n=y.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function fp(t,e){e===void 0&&(e=[t]);const n=y.useRef(t);return ns(()=>{n.current!==t&&(n.current=t)},e),n}function lg(t,e){const n=y.useRef();return y.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function Wv(t){const e=xb(t),n=y.useRef(null),r=y.useCallback(i=>{i!==n.current&&e?.(i,n.current),n.current=i},[]);return[n,r]}function Zv(t){const e=y.useRef();return y.useEffect(()=>{e.current=t},[t]),e.current}let n1={};function cg(t,e){return y.useMemo(()=>{if(e)return e;const n=n1[t]==null?0:n1[t]+1;return n1[t]=n,t+"-"+n},[t,e])}function YW(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const a=Object.entries(o);for(const[l,c]of a){const u=s[l];u!=null&&(s[l]=u+t*c)}return s},{...e})}}const Xu=YW(1),qv=YW(-1);function Cxe(t){return"clientX"in t&&"clientY"in t}function Sb(t){if(!t)return!1;const{KeyboardEvent:e}=Ur(t.target);return e&&t instanceof e}function Pxe(t){if(!t)return!1;const{TouchEvent:e}=Ur(t.target);return e&&t instanceof e}function Uv(t){if(Pxe(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return Cxe(t)?{x:t.clientX,y:t.clientY}:null}const ol=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[ol.Translate.toString(t),ol.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),Q_="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function kxe(t){return t.matches(Q_)?t:t.querySelector(Q_)}const Txe={display:"none"};function $xe(t){let{id:e,value:n}=t;return U.default.createElement("div",{id:e,style:Txe},n)}function Ixe(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const i={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return U.default.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function Exe(){const[t,e]=y.useState("");return{announce:y.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const GW=y.createContext(null);function Axe(t){const e=y.useContext(GW);y.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function Qxe(){const[t]=y.useState(()=>new Set),e=y.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[y.useCallback(r=>{let{type:i,event:s}=r;t.forEach(o=>{var a;return(a=o[i])==null?void 0:a.call(o,s)})},[t]),e]}const Rxe={draggable:`
766
766
  To pick up a draggable item, press the space bar.
767
767
  While dragging, use the arrow keys to move the item.
768
768
  Press space again to drop the item in its new position, or press escape to cancel.
769
769
  `},jxe={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function _xe(t){let{announcements:e=jxe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Rxe}=t;const{announce:s,announcement:o}=Exe(),a=cg("DndLiveRegion"),[l,c]=y.useState(!1);if(y.useEffect(()=>{c(!0)},[]),Axe(y.useMemo(()=>({onDragStart(f){let{active:h}=f;s(e.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;e.onDragMove&&s(e.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;s(e.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;s(e.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;s(e.onDragCancel({active:h,over:p}))}}),[s,e])),!l)return null;const u=U.default.createElement(U.default.Fragment,null,U.default.createElement($xe,{id:r,value:i.draggable}),U.default.createElement(Ixe,{id:a,announcement:o}));return n?to.createPortal(u,n):u}var Gn;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Gn||(Gn={}));function Bv(){}function Dxe(t,e){return y.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function Nxe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return y.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const $s=Object.freeze({x:0,y:0});function Mxe(t,e){const n=Uv(t);if(!n)return"0 0";const r={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return r.x+"% "+r.y+"%"}function zxe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function Vxe(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function Lxe(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),i=Math.min(e.left+e.width,t.left+t.width),s=Math.min(e.top+e.height,t.top+t.height),o=i-r,a=s-n;if(r<i&&n<s){const l=e.width*e.height,c=t.width*t.height,u=o*a,f=u/(l+c-u);return Number(f.toFixed(4))}return 0}const Xxe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=[];for(const s of r){const{id:o}=s,a=n.get(o);if(a){const l=Lxe(a,e);l>0&&i.push({id:o,data:{droppableContainer:s,value:l}})}}return i.sort(zxe)};function Wxe(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function HW(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:$s}function Zxe(t){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];return i.reduce((o,a)=>({...o,top:o.top+t*a.y,bottom:o.bottom+t*a.y,left:o.left+t*a.x,right:o.right+t*a.x}),{...n})}}const qxe=Zxe(1);function JW(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function Uxe(t,e,n){const r=JW(e);if(!r)return t;const{scaleX:i,scaleY:s,x:o,y:a}=r,l=t.left-o-(1-i)*parseFloat(n),c=t.top-a-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),u=i?t.width/i:t.width,f=s?t.height/s:t.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const Bxe={ignoreTransform:!1};function Zd(t,e){e===void 0&&(e=Bxe);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:u}=Ur(t).getComputedStyle(t);c&&(n=Uxe(n,c,u))}const{top:r,left:i,width:s,height:o,bottom:a,right:l}=n;return{top:r,left:i,width:s,height:o,bottom:a,right:l}}function R_(t){return Zd(t,{ignoreTransform:!0})}function Fxe(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function Yxe(t,e){return e===void 0&&(e=Ur(t).getComputedStyle(t)),e.position==="fixed"}function Gxe(t,e){e===void 0&&(e=Ur(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const s=e[i];return typeof s=="string"?n.test(s):!1})}function l$(t,e){const n=[];function r(i){if(e!=null&&n.length>=e||!i)return n;if(a$(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!ag(i)||FW(i)||n.includes(i))return n;const s=Ur(t).getComputedStyle(i);return i!==t&&Gxe(i,s)&&n.push(i),Yxe(i,s)?n:r(i.parentNode)}return t?r(t):n}function KW(t){const[e]=l$(t,1);return e??null}function r1(t){return!bb||!t?null:Xd(t)?t:o$(t)?a$(t)||t===Wd(t).scrollingElement?window:ag(t)?t:null:null}function eZ(t){return Xd(t)?t.scrollX:t.scrollLeft}function tZ(t){return Xd(t)?t.scrollY:t.scrollTop}function QC(t){return{x:eZ(t),y:tZ(t)}}var er;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(er||(er={}));function nZ(t){return!bb||!t?!1:t===document.scrollingElement}function rZ(t){const e={x:0,y:0},n=nZ(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},i=t.scrollTop<=e.y,s=t.scrollLeft<=e.x,o=t.scrollTop>=r.y,a=t.scrollLeft>=r.x;return{isTop:i,isLeft:s,isBottom:o,isRight:a,maxScroll:r,minScroll:e}}const Hxe={x:.2,y:.2};function Jxe(t,e,n,r,i){let{top:s,left:o,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=Hxe);const{isTop:c,isBottom:u,isLeft:f,isRight:h}=rZ(t),p={x:0,y:0},m={x:0,y:0},g={height:e.height*i.y,width:e.width*i.x};return!c&&s<=e.top+g.height?(p.y=er.Backward,m.y=r*Math.abs((e.top+g.height-s)/g.height)):!u&&l>=e.bottom-g.height&&(p.y=er.Forward,m.y=r*Math.abs((e.bottom-g.height-l)/g.height)),!h&&a>=e.right-g.width?(p.x=er.Forward,m.x=r*Math.abs((e.right-g.width-a)/g.width)):!f&&o<=e.left+g.width&&(p.x=er.Backward,m.x=r*Math.abs((e.left+g.width-o)/g.width)),{direction:p,speed:m}}function Kxe(t){if(t===document.scrollingElement){const{innerWidth:s,innerHeight:o}=window;return{top:0,left:0,right:s,bottom:o,width:s,height:o}}const{top:e,left:n,right:r,bottom:i}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:i,width:t.clientWidth,height:t.clientHeight}}function iZ(t){return t.reduce((e,n)=>Xu(e,QC(n)),$s)}function e1e(t){return t.reduce((e,n)=>e+eZ(n),0)}function t1e(t){return t.reduce((e,n)=>e+tZ(n),0)}function sZ(t,e){if(e===void 0&&(e=Zd),!t)return;const{top:n,left:r,bottom:i,right:s}=e(t);KW(t)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const n1e=[["x",["left","right"],e1e],["y",["top","bottom"],t1e]];class c${constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=l$(n),i=iZ(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,o,a]of n1e)for(const l of o)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=i[s]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class dh{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var i;(i=this.target)==null||i.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function r1e(t){const{EventTarget:e}=Ur(t);return t instanceof e?t:Wd(t)}function i1(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var Vi;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Vi||(Vi={}));function j_(t){t.preventDefault()}function i1e(t){t.stopPropagation()}var Gt;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter"})(Gt||(Gt={}));const oZ={start:[Gt.Space,Gt.Enter],cancel:[Gt.Esc],end:[Gt.Space,Gt.Enter]},s1e=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case Gt.Right:return{...n,x:n.x+25};case Gt.Left:return{...n,x:n.x-25};case Gt.Down:return{...n,y:n.y+25};case Gt.Up:return{...n,y:n.y-25}}};class aZ{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new dh(Wd(n)),this.windowListeners=new dh(Ur(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Vi.Resize,this.handleCancel),this.windowListeners.add(Vi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Vi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&sZ(r),n($s)}handleKeyDown(e){if(Sb(e)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=oZ,coordinateGetter:o=s1e,scrollBehavior:a="smooth"}=i,{code:l}=e;if(s.end.includes(l)){this.handleEnd(e);return}if(s.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:$s;this.referenceCoordinates||(this.referenceCoordinates=u);const f=o(e,{active:n,context:r.current,currentCoordinates:u});if(f){const h=qv(f,u),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const g of m){const O=e.code,{isTop:v,isRight:b,isLeft:x,isBottom:P,maxScroll:S,minScroll:k}=rZ(g),T=Kxe(g),$={x:Math.min(O===Gt.Right?T.right-T.width/2:T.right,Math.max(O===Gt.Right?T.left:T.left+T.width/2,f.x)),y:Math.min(O===Gt.Down?T.bottom-T.height/2:T.bottom,Math.max(O===Gt.Down?T.top:T.top+T.height/2,f.y))},A=O===Gt.Right&&!b||O===Gt.Left&&!x,_=O===Gt.Down&&!P||O===Gt.Up&&!v;if(A&&$.x!==f.x){const D=g.scrollLeft+h.x,Q=O===Gt.Right&&D<=S.x||O===Gt.Left&&D>=k.x;if(Q&&!h.y){g.scrollTo({left:D,behavior:a});return}Q?p.x=g.scrollLeft-D:p.x=O===Gt.Right?g.scrollLeft-S.x:g.scrollLeft-k.x,p.x&&g.scrollBy({left:-p.x,behavior:a});break}else if(_&&$.y!==f.y){const D=g.scrollTop+h.y,Q=O===Gt.Down&&D<=S.y||O===Gt.Up&&D>=k.y;if(Q&&!h.x){g.scrollTo({top:D,behavior:a});return}Q?p.y=g.scrollTop-D:p.y=O===Gt.Down?g.scrollTop-S.y:g.scrollTop-k.y,p.y&&g.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(e,Xu(qv(f,this.referenceCoordinates),p))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}aZ.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=oZ,onActivation:i}=e,{active:s}=n;const{code:o}=t.nativeEvent;if(r.start.includes(o)){const a=s.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),i?.({event:t.nativeEvent}),!0)}return!1}}];function __(t){return!!(t&&"distance"in t)}function D_(t){return!!(t&&"delay"in t)}class u${constructor(e,n,r){var i;r===void 0&&(r=r1e(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:s}=e,{target:o}=s;this.props=e,this.events=n,this.document=Wd(o),this.documentListeners=new dh(this.document),this.listeners=new dh(r),this.windowListeners=new dh(Ur(o)),this.initialCoordinates=(i=Uv(s))!=null?i:$s,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(Vi.Resize,this.handleCancel),this.windowListeners.add(Vi.DragStart,j_),this.windowListeners.add(Vi.VisibilityChange,this.handleCancel),this.windowListeners.add(Vi.ContextMenu,j_),this.documentListeners.add(Vi.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(D_(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}if(__(n))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Vi.Click,i1e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Vi.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:i,props:s}=this,{onMove:o,options:{activationConstraint:a}}=s;if(!i)return;const l=(n=Uv(e))!=null?n:$s,c=qv(i,l);if(!r&&a){if(__(a)){if(a.tolerance!=null&&i1(c,a.tolerance))return this.handleCancel();if(i1(c,a.distance))return this.handleStart()}return D_(a)&&i1(c,a.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),o(l)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===Gt.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const o1e={move:{name:"pointermove"},end:{name:"pointerup"}};class d$ extends u${constructor(e){const{event:n}=e,r=Wd(n.target);super(e,o1e,r)}}d$.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const a1e={move:{name:"mousemove"},end:{name:"mouseup"}};var RC;(function(t){t[t.RightClick=2]="RightClick"})(RC||(RC={}));class l1e extends u${constructor(e){super(e,a1e,Wd(e.event.target))}}l1e.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===RC.RightClick?!1:(r?.({event:n}),!0)}}];const s1={move:{name:"touchmove"},end:{name:"touchend"}};class c1e extends u${constructor(e){super(e,s1)}static setup(){return window.addEventListener(s1.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(s1.move.name,e)};function e(){}}}c1e.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var fh;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(fh||(fh={}));var Fv;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Fv||(Fv={}));function u1e(t){let{acceleration:e,activator:n=fh.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:o=5,order:a=Fv.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:h}=t;const p=f1e({delta:f,disabled:!s}),[m,g]=wxe(),O=y.useRef({x:0,y:0}),v=y.useRef({x:0,y:0}),b=y.useMemo(()=>{switch(n){case fh.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case fh.DraggableRect:return i}},[n,i,l]),x=y.useRef(null),P=y.useCallback(()=>{const k=x.current;if(!k)return;const T=O.current.x*v.current.x,$=O.current.y*v.current.y;k.scrollBy(T,$)},[]),S=y.useMemo(()=>a===Fv.TreeOrder?[...c].reverse():c,[a,c]);y.useEffect(()=>{if(!s||!c.length||!b){g();return}for(const k of S){if(r?.(k)===!1)continue;const T=c.indexOf(k),$=u[T];if(!$)continue;const{direction:A,speed:_}=Jxe(k,$,b,e,h);for(const D of["x","y"])p[D][A[D]]||(_[D]=0,A[D]=0);if(_.x>0||_.y>0){g(),x.current=k,m(P,o),O.current=_,v.current=A;return}}O.current={x:0,y:0},v.current={x:0,y:0},g()},[e,P,r,g,s,o,JSON.stringify(b),JSON.stringify(p),m,c,S,u,JSON.stringify(h)])}const d1e={x:{[er.Backward]:!1,[er.Forward]:!1},y:{[er.Backward]:!1,[er.Forward]:!1}};function f1e(t){let{delta:e,disabled:n}=t;const r=Zv(e);return lg(i=>{if(n||!r||!i)return d1e;const s={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[er.Backward]:i.x[er.Backward]||s.x===-1,[er.Forward]:i.x[er.Forward]||s.x===1},y:{[er.Backward]:i.y[er.Backward]||s.y===-1,[er.Forward]:i.y[er.Forward]||s.y===1}}},[n,e,r])}function h1e(t,e){const n=e!==null?t.get(e):void 0,r=n?n.node.current:null;return lg(i=>{var s;return e===null?null:(s=r??i)!=null?s:null},[r,e])}function p1e(t,e){return y.useMemo(()=>t.reduce((n,r)=>{const{sensor:i}=r,s=i.activators.map(o=>({eventName:o.eventName,handler:e(o.handler,r)}));return[...n,...s]},[]),[t,e])}var hp;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(hp||(hp={}));var jC;(function(t){t.Optimized="optimized"})(jC||(jC={}));const N_=new Map;function g1e(t,e){let{dragging:n,dependencies:r,config:i}=e;const[s,o]=y.useState(null),{frequency:a,measure:l,strategy:c}=i,u=y.useRef(t),f=O(),h=fp(f),p=y.useCallback(function(v){v===void 0&&(v=[]),!h.current&&o(b=>b===null?v:b.concat(v.filter(x=>!b.includes(x))))},[h]),m=y.useRef(null),g=lg(v=>{if(f&&!n)return N_;if(!v||v===N_||u.current!==t||s!=null){const b=new Map;for(let x of t){if(!x)continue;if(s&&s.length>0&&!s.includes(x.id)&&x.rect.current){b.set(x.id,x.rect.current);continue}const P=x.node.current,S=P?new c$(l(P),P):null;x.rect.current=S,S&&b.set(x.id,S)}return b}return v},[t,s,n,f,l]);return y.useEffect(()=>{u.current=t},[t]),y.useEffect(()=>{f||p()},[n,f]),y.useEffect(()=>{s&&s.length>0&&o(null)},[JSON.stringify(s)]),y.useEffect(()=>{f||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},a))},[a,f,p,...r]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:s!=null};function O(){switch(c){case hp.Always:return!1;case hp.BeforeDragging:return n;default:return!n}}}function f$(t,e){return lg(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function m1e(t,e){return f$(t,e)}function O1e(t){let{callback:e,disabled:n}=t;const r=xb(e),i=y.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return y.useEffect(()=>()=>i?.disconnect(),[i]),i}function wb(t){let{callback:e,disabled:n}=t;const r=xb(e),i=y.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return y.useEffect(()=>()=>i?.disconnect(),[i]),i}function v1e(t){return new c$(Zd(t),t)}function M_(t,e,n){e===void 0&&(e=v1e);const[r,i]=y.useReducer(a,null),s=O1e({callback(l){if(t)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(t)){i();break}}}}),o=wb({callback:i});return ns(()=>{i(),t?(o?.observe(t),s?.observe(document.body,{childList:!0,subtree:!0})):(o?.disconnect(),s?.disconnect())},[t]),r;function a(l){if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=e(t);return JSON.stringify(l)===JSON.stringify(u)?l:u}}function y1e(t){const e=f$(t);return HW(t,e)}const z_=[];function b1e(t){const e=y.useRef(t),n=lg(r=>t?r&&r!==z_&&t&&e.current&&t.parentNode===e.current.parentNode?r:l$(t):z_,[t]);return y.useEffect(()=>{e.current=t},[t]),n}function x1e(t){const[e,n]=y.useState(null),r=y.useRef(t),i=y.useCallback(s=>{const o=r1(s.target);o&&n(a=>a?(a.set(o,QC(o)),new Map(a)):null)},[]);return y.useEffect(()=>{const s=r.current;if(t!==s){o(s);const a=t.map(l=>{const c=r1(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,QC(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=t}return()=>{o(t),o(s)};function o(a){a.forEach(l=>{const c=r1(l);c?.removeEventListener("scroll",i)})}},[i,t]),y.useMemo(()=>t.length?e?Array.from(e.values()).reduce((s,o)=>Xu(s,o),$s):iZ(t):$s,[t,e])}function V_(t,e){e===void 0&&(e=[]);const n=y.useRef(null);return y.useEffect(()=>{n.current=null},e),y.useEffect(()=>{const r=t!==$s;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?qv(t,n.current):$s}function S1e(t){y.useEffect(()=>{if(!bb)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function w1e(t,e){return y.useMemo(()=>t.reduce((n,r)=>{let{eventName:i,handler:s}=r;return n[i]=o=>{s(o,e)},n},{}),[t,e])}function lZ(t){return y.useMemo(()=>t?Fxe(t):null,[t])}const o1=[];function C1e(t,e){e===void 0&&(e=Zd);const[n]=t,r=lZ(n?Ur(n):null),[i,s]=y.useReducer(a,o1),o=wb({callback:s});return t.length>0&&i===o1&&s(),ns(()=>{t.length?t.forEach(l=>o?.observe(l)):(o?.disconnect(),s())},[t]),i;function a(){return t.length?t.map(l=>nZ(l)?r:new c$(e(l),l)):o1}}function cZ(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return ag(e)?e:t}function P1e(t){let{measure:e}=t;const[n,r]=y.useState(null),i=y.useCallback(c=>{for(const{target:u}of c)if(ag(u)){r(f=>{const h=e(u);return f?{...f,width:h.width,height:h.height}:h});break}},[e]),s=wb({callback:i}),o=y.useCallback(c=>{const u=cZ(c);s?.disconnect(),u&&s?.observe(u),r(u?e(u):null)},[e,s]),[a,l]=Wv(o);return y.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const k1e=[{sensor:d$,options:{}},{sensor:aZ,options:{}}],T1e={current:{}},lO={draggable:{measure:R_},droppable:{measure:R_,strategy:hp.WhileDragging,frequency:jC.Optimized},dragOverlay:{measure:Zd}};class hh extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const $1e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new hh,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Bv},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:lO,measureDroppableContainers:Bv,windowRect:null,measuringScheduled:!1},uZ={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Bv,draggableNodes:new Map,over:null,measureDroppableContainers:Bv},ug=y.createContext(uZ),dZ=y.createContext($1e);function I1e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new hh}}}function E1e(t,e){switch(e.type){case Gn.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Gn.DragMove:return t.draggable.active?{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}}:t;case Gn.DragEnd:case Gn.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Gn.RegisterDroppable:{const{element:n}=e,{id:r}=n,i=new hh(t.droppable.containers);return i.set(r,n),{...t,droppable:{...t.droppable,containers:i}}}case Gn.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const o=new hh(t.droppable.containers);return o.set(n,{...s,disabled:i}),{...t,droppable:{...t.droppable,containers:o}}}case Gn.UnregisterDroppable:{const{id:n,key:r}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const s=new hh(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function A1e(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:i}=y.useContext(ug),s=Zv(r),o=Zv(n?.id);return y.useEffect(()=>{if(!e&&!r&&s&&o!=null){if(!Sb(s)||document.activeElement===s.target)return;const a=i.get(o);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const f=kxe(u);if(f){f.focus();break}}})}},[r,e,i,o,s]),null}function fZ(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((i,s)=>s({transform:i,...r}),n):n}function Q1e(t){return y.useMemo(()=>({draggable:{...lO.draggable,...t?.draggable},droppable:{...lO.droppable,...t?.droppable},dragOverlay:{...lO.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function R1e(t){let{activeNode:e,measure:n,initialRect:r,config:i=!0}=t;const s=y.useRef(!1),{x:o,y:a}=typeof i=="boolean"?{x:i,y:i}:i;ns(()=>{if(!o&&!a||!e){s.current=!1;return}if(s.current||!r)return;const c=e?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),f=HW(u,r);if(o||(f.x=0),a||(f.y=0),s.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=KW(c);h&&h.scrollBy({top:f.y,left:f.x})}},[e,o,a,r,n])}const Cb=y.createContext({...$s,scaleX:1,scaleY:1});var Na;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Na||(Na={}));const j1e=y.memo(function(e){var n,r,i,s;let{id:o,accessibility:a,autoScroll:l=!0,children:c,sensors:u=k1e,collisionDetection:f=Xxe,measuring:h,modifiers:p,...m}=e;const g=y.useReducer(E1e,void 0,I1e),[O,v]=g,[b,x]=Qxe(),[P,S]=y.useState(Na.Uninitialized),k=P===Na.Initialized,{draggable:{active:T,nodes:$,translate:A},droppable:{containers:_}}=O,D=T?$.get(T):null,Q=y.useRef({initial:null,translated:null}),M=y.useMemo(()=>{var Te;return T!=null?{id:T,data:(Te=D?.data)!=null?Te:T1e,rect:Q}:null},[T,D]),N=y.useRef(null),[z,E]=y.useState(null),[L,V]=y.useState(null),B=fp(m,Object.values(m)),Z=cg("DndDescribedBy",o),q=y.useMemo(()=>_.getEnabled(),[_]),F=Q1e(h),{droppableRects:Y,measureDroppableContainers:ne,measuringScheduled:J}=g1e(q,{dragging:k,dependencies:[A.x,A.y],config:F.droppable}),se=h1e($,T),H=y.useMemo(()=>L?Uv(L):null,[L]),ge=ye(),me=m1e(se,F.draggable.measure);R1e({activeNode:T?$.get(T):null,config:ge.layoutShiftCompensation,initialRect:me,measure:F.draggable.measure});const be=M_(se,F.draggable.measure,me),je=M_(se?se.parentElement:null),fe=y.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:$,draggingNode:null,draggingNodeRect:null,droppableContainers:_,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Qe=_.getNodeFor((n=fe.current.over)==null?void 0:n.id),Se=P1e({measure:F.dragOverlay.measure}),He=(r=Se.nodeRef.current)!=null?r:se,Ge=k?(i=Se.rect)!=null?i:be:null,wt=!!(Se.nodeRef.current&&Se.rect),ut=y1e(wt?null:be),Pt=lZ(He?Ur(He):null),Qt=b1e(k?Qe??se:null),rt=C1e(Qt),ht=fZ(p,{transform:{x:A.x-ut.x,y:A.y-ut.y,scaleX:1,scaleY:1},activatorEvent:L,active:M,activeNodeRect:be,containerNodeRect:je,draggingNodeRect:Ge,over:fe.current.over,overlayNodeRect:Se.rect,scrollableAncestors:Qt,scrollableAncestorRects:rt,windowRect:Pt}),It=H?Xu(H,A):null,ft=x1e(Qt),Xe=V_(ft),et=V_(ft,[be]),Ct=Xu(ht,Xe),C=Ge?qxe(Ge,ht):null,G=M&&C?f({active:M,collisionRect:C,droppableRects:Y,droppableContainers:q,pointerCoordinates:It}):null,ue=Vxe(G,"id"),[de,le]=y.useState(null),we=wt?ht:Xu(ht,et),R=Wxe(we,(s=de?.rect)!=null?s:null,be),K=y.useCallback((Te,Ie)=>{let{sensor:Ee,options:Re}=Ie;if(N.current==null)return;const Ve=$.get(N.current);if(!Ve)return;const Fe=Te.nativeEvent,Mn=new Ee({active:N.current,activeNode:Ve,event:Fe,options:Re,context:fe,onStart(dt){const Lt=N.current;if(Lt==null)return;const qn=$.get(Lt);if(!qn)return;const{onDragStart:Br}=B.current,zn={active:{id:Lt,data:qn.data,rect:Q}};to.unstable_batchedUpdates(()=>{Br?.(zn),S(Na.Initializing),v({type:Gn.DragStart,initialCoordinates:dt,active:Lt}),b({type:"onDragStart",event:zn})})},onMove(dt){v({type:Gn.DragMove,coordinates:dt})},onEnd:Kt(Gn.DragEnd),onCancel:Kt(Gn.DragCancel)});to.unstable_batchedUpdates(()=>{E(Mn),V(Te.nativeEvent)});function Kt(dt){return async function(){const{active:qn,collisions:Br,over:zn,scrollAdjustedTranslate:Ao}=fe.current;let ui=null;if(qn&&Ao){const{cancelDrop:mr}=B.current;ui={activatorEvent:Fe,active:qn,collisions:Br,delta:Ao,over:zn},dt===Gn.DragEnd&&typeof mr=="function"&&await Promise.resolve(mr(ui))&&(dt=Gn.DragCancel)}N.current=null,to.unstable_batchedUpdates(()=>{v({type:dt}),S(Na.Uninitialized),le(null),E(null),V(null);const mr=dt===Gn.DragEnd?"onDragEnd":"onDragCancel";if(ui){const Fr=B.current[mr];Fr?.(ui),b({type:mr,event:ui})}})}}},[$]),xe=y.useCallback((Te,Ie)=>(Ee,Re)=>{const Ve=Ee.nativeEvent,Fe=$.get(Re);if(N.current!==null||!Fe||Ve.dndKit||Ve.defaultPrevented)return;const Mn={active:Fe};Te(Ee,Ie.options,Mn)===!0&&(Ve.dndKit={capturedBy:Ie.sensor},N.current=Re,K(Ee,Ie))},[$,K]),ce=p1e(u,xe);S1e(u),ns(()=>{be&&P===Na.Initializing&&S(Na.Initialized)},[be,P]),y.useEffect(()=>{const{onDragMove:Te}=B.current,{active:Ie,activatorEvent:Ee,collisions:Re,over:Ve}=fe.current;if(!Ie||!Ee)return;const Fe={active:Ie,activatorEvent:Ee,collisions:Re,delta:{x:Ct.x,y:Ct.y},over:Ve};to.unstable_batchedUpdates(()=>{Te?.(Fe),b({type:"onDragMove",event:Fe})})},[Ct.x,Ct.y]),y.useEffect(()=>{const{active:Te,activatorEvent:Ie,collisions:Ee,droppableContainers:Re,scrollAdjustedTranslate:Ve}=fe.current;if(!Te||N.current==null||!Ie||!Ve)return;const{onDragOver:Fe}=B.current,Mn=Re.get(ue),Kt=Mn&&Mn.rect.current?{id:Mn.id,rect:Mn.rect.current,data:Mn.data,disabled:Mn.disabled}:null,dt={active:Te,activatorEvent:Ie,collisions:Ee,delta:{x:Ve.x,y:Ve.y},over:Kt};to.unstable_batchedUpdates(()=>{le(Kt),Fe?.(dt),b({type:"onDragOver",event:dt})})},[ue]),ns(()=>{fe.current={activatorEvent:L,active:M,activeNode:se,collisionRect:C,collisions:G,droppableRects:Y,draggableNodes:$,draggingNode:He,draggingNodeRect:Ge,droppableContainers:_,over:de,scrollableAncestors:Qt,scrollAdjustedTranslate:Ct},Q.current={initial:Ge,translated:C}},[M,se,G,C,$,He,Ge,Y,_,de,Qt,Ct]),u1e({...ge,delta:A,draggingRect:C,pointerCoordinates:It,scrollableAncestors:Qt,scrollableAncestorRects:rt});const ae=y.useMemo(()=>({active:M,activeNode:se,activeNodeRect:be,activatorEvent:L,collisions:G,containerNodeRect:je,dragOverlay:Se,draggableNodes:$,droppableContainers:_,droppableRects:Y,over:de,measureDroppableContainers:ne,scrollableAncestors:Qt,scrollableAncestorRects:rt,measuringConfiguration:F,measuringScheduled:J,windowRect:Pt}),[M,se,be,L,G,je,Se,$,_,Y,de,ne,Qt,rt,F,J,Pt]),Oe=y.useMemo(()=>({activatorEvent:L,activators:ce,active:M,activeNodeRect:be,ariaDescribedById:{draggable:Z},dispatch:v,draggableNodes:$,over:de,measureDroppableContainers:ne}),[L,ce,M,be,v,Z,$,de,ne]);return U.default.createElement(GW.Provider,{value:x},U.default.createElement(ug.Provider,{value:Oe},U.default.createElement(dZ.Provider,{value:ae},U.default.createElement(Cb.Provider,{value:R},c)),U.default.createElement(A1e,{disabled:a?.restoreFocus===!1})),U.default.createElement(_xe,{...a,hiddenTextDescribedById:Z}));function ye(){const Te=z?.autoScrollEnabled===!1,Ie=typeof l=="object"?l.enabled===!1:l===!1,Ee=k&&!Te&&!Ie;return typeof l=="object"?{...l,enabled:Ee}:{enabled:Ee}}}),_1e=y.createContext(null),L_="button",D1e="Droppable";function N1e(t){let{id:e,data:n,disabled:r=!1,attributes:i}=t;const s=cg(D1e),{activators:o,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:h}=y.useContext(ug),{role:p=L_,roleDescription:m="draggable",tabIndex:g=0}=i??{},O=l?.id===e,v=y.useContext(O?Cb:_1e),[b,x]=Wv(),[P,S]=Wv(),k=w1e(o,e),T=fp(n);ns(()=>(f.set(e,{id:e,key:s,node:b,activatorNode:P,data:T}),()=>{const A=f.get(e);A&&A.key===s&&f.delete(e)}),[f,e]);const $=y.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":r,"aria-pressed":O&&p===L_?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,g,O,m,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:$,isDragging:O,listeners:r?void 0:k,node:b,over:h,setNodeRef:x,setActivatorNodeRef:S,transform:v}}function hZ(){return y.useContext(dZ)}const M1e="Droppable",z1e={timeout:25};function V1e(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const s=cg(M1e),{active:o,dispatch:a,over:l,measureDroppableContainers:c}=y.useContext(ug),u=y.useRef({disabled:n}),f=y.useRef(!1),h=y.useRef(null),p=y.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:O}={...z1e,...i},v=fp(g??r),b=y.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(v.current)?v.current:[v.current]),p.current=null},O)},[O]),x=wb({callback:b,disabled:m||!o}),P=y.useCallback(($,A)=>{x&&(A&&(x.unobserve(A),f.current=!1),$&&x.observe($))},[x]),[S,k]=Wv(P),T=fp(e);return y.useEffect(()=>{!x||!S.current||(x.disconnect(),f.current=!1,x.observe(S.current))},[S,x]),ns(()=>(a({type:Gn.RegisterDroppable,element:{id:r,key:s,disabled:n,node:S,rect:h,data:T}}),()=>a({type:Gn.UnregisterDroppable,key:s,id:r})),[r]),y.useEffect(()=>{n!==u.current.disabled&&(a({type:Gn.SetDroppableDisabled,id:r,key:s,disabled:n}),u.current.disabled=n)},[r,s,n,a]),{active:o,rect:h,isOver:l?.id===r,node:S,over:l,setNodeRef:k}}function L1e(t){let{animation:e,children:n}=t;const[r,i]=y.useState(null),[s,o]=y.useState(null),a=Zv(n);return!n&&!r&&a&&i(a),ns(()=>{if(!s)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){i(null);return}Promise.resolve(e(c,s)).then(()=>{i(null)})},[e,r,s]),U.default.createElement(U.default.Fragment,null,n,r?y.cloneElement(r,{ref:o}):null)}const X1e={x:0,y:0,scaleX:1,scaleY:1};function W1e(t){let{children:e}=t;return U.default.createElement(ug.Provider,{value:uZ},U.default.createElement(Cb.Provider,{value:X1e},e))}const Z1e={position:"fixed",touchAction:"none"},q1e=t=>Sb(t)?"transform 250ms ease":void 0,U1e=y.forwardRef((t,e)=>{let{as:n,activatorEvent:r,adjustScale:i,children:s,className:o,rect:a,style:l,transform:c,transition:u=q1e}=t;if(!a)return null;const f=i?c:{...c,scaleX:1,scaleY:1},h={...Z1e,width:a.width,height:a.height,top:a.top,left:a.left,transform:ol.Transform.toString(f),transformOrigin:i&&r?Mxe(r,a):void 0,transition:typeof u=="function"?u(r):u,...l};return U.default.createElement(n,{className:o,style:h,ref:e},s)}),B1e=t=>e=>{let{active:n,dragOverlay:r}=e;const i={},{styles:s,className:o}=t;if(s!=null&&s.active)for(const[a,l]of Object.entries(s.active))l!==void 0&&(i[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(s!=null&&s.dragOverlay)for(const[a,l]of Object.entries(s.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(const[l,c]of Object.entries(i))n.node.style.setProperty(l,c);o!=null&&o.active&&n.node.classList.remove(o.active)}},F1e=t=>{let{transform:{initial:e,final:n}}=t;return[{transform:ol.Transform.toString(e)},{transform:ol.Transform.toString(n)}]},Y1e={duration:250,easing:"ease",keyframes:F1e,sideEffects:B1e({styles:{active:{opacity:"0"}}})};function G1e(t){let{config:e,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=t;return xb((s,o)=>{if(e===null)return;const a=n.get(s);if(!a)return;const l=a.node.current;if(!l)return;const c=cZ(o);if(!c)return;const{transform:u}=Ur(o).getComputedStyle(o),f=JW(u);if(!f)return;const h=typeof e=="function"?e:H1e(e);return sZ(l,i.draggable.measure),h({active:{id:s,data:a.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:o,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:f})})}function H1e(t){const{duration:e,easing:n,sideEffects:r,keyframes:i}={...Y1e,...t};return s=>{let{active:o,dragOverlay:a,transform:l,...c}=s;if(!e)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},f={scaleX:l.scaleX!==1?o.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?o.rect.height*l.scaleY/a.rect.height:1},h={x:l.x-u.x,y:l.y-u.y,...f},p=i({...c,active:o,dragOverlay:a,transform:{initial:l,final:h}}),[m]=p,g=p[p.length-1];if(JSON.stringify(m)===JSON.stringify(g))return;const O=r?.({active:o,dragOverlay:a,...c}),v=a.node.animate(p,{duration:e,easing:n,fill:"forwards"});return new Promise(b=>{v.onfinish=()=>{O?.(),b()}})}}let X_=0;function J1e(t){return y.useMemo(()=>{if(t!=null)return X_++,X_},[t])}const K1e=U.default.memo(t=>{let{adjustScale:e=!1,children:n,dropAnimation:r,style:i,transition:s,modifiers:o,wrapperElement:a="div",className:l,zIndex:c=999}=t;const{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:m,droppableContainers:g,dragOverlay:O,over:v,measuringConfiguration:b,scrollableAncestors:x,scrollableAncestorRects:P,windowRect:S}=hZ(),k=y.useContext(Cb),T=J1e(f?.id),$=fZ(o,{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:O.rect,over:v,overlayNodeRect:O.rect,scrollableAncestors:x,scrollableAncestorRects:P,transform:k,windowRect:S}),A=f$(h),_=G1e({config:r,draggableNodes:m,droppableContainers:g,measuringConfiguration:b}),D=A?O.setRef:void 0;return U.default.createElement(W1e,null,U.default.createElement(L1e,{animation:_},f&&T?U.default.createElement(U1e,{key:T,id:f.id,ref:D,as:a,activatorEvent:u,adjustScale:e,className:l,transition:s,rect:A,style:{zIndex:c,...i},transform:$},n):null))});function pZ(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function eSe(t,e){return t.reduce((n,r,i)=>{const s=e.get(r);return s&&(n[i]=s),n},Array(t.length))}function Om(t){return t!==null&&t>=0}function tSe(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function nSe(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const vm={scaleX:1,scaleY:1},rSe=t=>{var e;let{rects:n,activeNodeRect:r,activeIndex:i,overIndex:s,index:o}=t;const a=(e=n[i])!=null?e:r;if(!a)return null;const l=iSe(n,o,i);if(o===i){const c=n[s];return c?{x:i<s?c.left+c.width-(a.left+a.width):c.left-a.left,y:0,...vm}:null}return o>i&&o<=s?{x:-a.width-l,y:0,...vm}:o<i&&o>=s?{x:a.width+l,y:0,...vm}:{x:0,y:0,...vm}};function iSe(t,e,n){const r=t[e],i=t[e-1],s=t[e+1];return!r||!i&&!s?0:n<e?i?r.left-(i.left+i.width):s.left-(r.left+r.width):s?s.left-(r.left+r.width):r.left-(i.left+i.width)}const gZ=t=>{let{rects:e,activeIndex:n,overIndex:r,index:i}=t;const s=pZ(e,r,n),o=e[i],a=s[i];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},mZ="Sortable",OZ=U.default.createContext({activeIndex:-1,containerId:mZ,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:gZ,disabled:{draggable:!1,droppable:!1}});function sSe(t){let{children:e,id:n,items:r,strategy:i=gZ,disabled:s=!1}=t;const{active:o,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=hZ(),f=cg(mZ,n),h=a.rect!==null,p=y.useMemo(()=>r.map(k=>typeof k=="object"&&"id"in k?k.id:k),[r]),m=o!=null,g=o?p.indexOf(o.id):-1,O=c?p.indexOf(c.id):-1,v=y.useRef(p),b=!tSe(p,v.current),x=O!==-1&&g===-1||b,P=nSe(s);ns(()=>{b&&m&&u(p)},[b,p,m,u]),y.useEffect(()=>{v.current=p},[p]);const S=y.useMemo(()=>({activeIndex:g,containerId:f,disabled:P,disableTransforms:x,items:p,overIndex:O,useDragOverlay:h,sortedRects:eSe(p,l),strategy:i}),[g,f,P.draggable,P.droppable,x,p,O,l,h,i]);return U.default.createElement(OZ.Provider,{value:S},e)}const oSe=t=>{let{id:e,items:n,activeIndex:r,overIndex:i}=t;return pZ(n,r,i).indexOf(e)},aSe=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:i,items:s,newIndex:o,previousItems:a,previousContainerId:l,transition:c}=t;return!c||!r||a!==s&&i===o?!1:n?!0:o!==i&&e===l},lSe={duration:200,easing:"ease"},vZ="transform",cSe=ol.Transition.toString({property:vZ,duration:0,easing:"linear"}),uSe={roleDescription:"sortable"};function dSe(t){let{disabled:e,index:n,node:r,rect:i}=t;const[s,o]=y.useState(null),a=y.useRef(n);return ns(()=>{if(!e&&n!==a.current&&r.current){const l=i.current;if(l){const c=Zd(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&o(u)}}n!==a.current&&(a.current=n)},[e,n,r,i]),y.useEffect(()=>{s&&o(null)},[s]),s}function fSe(t){let{animateLayoutChanges:e=aSe,attributes:n,disabled:r,data:i,getNewIndex:s=oSe,id:o,strategy:a,resizeObserverConfig:l,transition:c=lSe}=t;const{items:u,containerId:f,activeIndex:h,disabled:p,disableTransforms:m,sortedRects:g,overIndex:O,useDragOverlay:v,strategy:b}=y.useContext(OZ),x=hSe(r,p),P=u.indexOf(o),S=y.useMemo(()=>({sortable:{containerId:f,index:P,items:u},...i}),[f,i,P,u]),k=y.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:T,node:$,isOver:A,setNodeRef:_}=V1e({id:o,data:S,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...l}}),{active:D,activatorEvent:Q,activeNodeRect:M,attributes:N,setNodeRef:z,listeners:E,isDragging:L,over:V,setActivatorNodeRef:B,transform:Z}=N1e({id:o,data:S,attributes:{...uSe,...n},disabled:x.draggable}),q=Sxe(_,z),F=!!D,Y=F&&!m&&Om(h)&&Om(O),ne=!v&&L,J=ne&&Y?Z:null,H=Y?J??(a??b)({rects:g,activeNodeRect:M,activeIndex:h,overIndex:O,index:P}):null,ge=Om(h)&&Om(O)?s({id:o,items:u,activeIndex:h,overIndex:O}):P,me=D?.id,be=y.useRef({activeId:me,items:u,newIndex:ge,containerId:f}),je=u!==be.current.items,fe=e({active:D,containerId:f,isDragging:L,isSorting:F,id:o,index:P,items:u,newIndex:be.current.newIndex,previousItems:be.current.items,previousContainerId:be.current.containerId,transition:c,wasDragging:be.current.activeId!=null}),Qe=dSe({disabled:!fe,index:P,node:$,rect:T});return y.useEffect(()=>{F&&be.current.newIndex!==ge&&(be.current.newIndex=ge),f!==be.current.containerId&&(be.current.containerId=f),u!==be.current.items&&(be.current.items=u)},[F,ge,f,u]),y.useEffect(()=>{if(me===be.current.activeId)return;if(me&&!be.current.activeId){be.current.activeId=me;return}const He=setTimeout(()=>{be.current.activeId=me},50);return()=>clearTimeout(He)},[me]),{active:D,activeIndex:h,attributes:N,data:S,rect:T,index:P,newIndex:ge,items:u,isOver:A,isSorting:F,isDragging:L,listeners:E,node:$,overIndex:O,over:V,setNodeRef:q,setActivatorNodeRef:B,setDroppableNodeRef:_,setDraggableNodeRef:z,transform:Qe??H,transition:Se()};function Se(){if(Qe||je&&be.current.newIndex===P)return cSe;if(!(ne&&!Sb(Q)||!c)&&(F||fe))return ol.Transition.toString({...c,property:vZ})}}function hSe(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}Gt.Down,Gt.Right,Gt.Up,Gt.Left;const Me=w.default.div`
770
770
  border-right: 1px solid var(--border-color-secondary);
771
771
  align-self: stretch;
772
- `;function pSe(){const t=y.useRef(null),[e,n]=y.useState(!1);return xP.useMount(()=>{const r=t.current,i=()=>{r&&n(r.scrollWidth>r.clientWidth)};i();const s=new MutationObserver(()=>{i()});return r&&s.observe(r,{childList:!0,subtree:!0,attributes:!1}),window.addEventListener("resize",i),()=>{r&&s.disconnect(),window.removeEventListener("resize",i)}}),{containerRef:t,hasScrollbar:e}}const Je={SECURITY:"Security",BODY:"Body",PATH:"Path",QUERY:"Query",HEADERS:"Headers",COOKIES:"Cookies",COMPONENTS:"Components",SOURCES:"Sources",STEP_SETTINGS:"Step settings",WORKFLOW_SETTINGS:"Workflow settings",COLLECTION_SETTINGS:"Collection settings"};function W_(t){return t.some(e=>!!(e.key||e.value||e.files?.length))}function gSe({type:t,formData:e,content:n}){if(Cv.includes(t)){const r=W_(e["multipart/form-data"]),i=W_(e["application/x-www-form-urlencoded"]);return!r&&!i}return lue.includes(t)?n.length===0:!0}function yZ(t){const{disableCollectionsTab:e}=qr();return y.useMemo(()=>{const n=[{name:Je.SECURITY,icon:d.jsx(nM.SecurityIcon,{})},{name:Je.BODY,icon:d.jsx(wp.CodeIcon,{})},{name:Je.PATH,icon:d.jsx(tM.DataRefineryIcon,{})},{name:Je.QUERY,icon:d.jsx(eM.DataFormatIcon,{})},{name:Je.HEADERS,icon:d.jsx(wP.TableBuiltIcon,{})},{name:Je.COOKIES,icon:d.jsx(SP.CookieIcon,{})}];return!e.get()&&!t&&n.push({name:Je.STEP_SETTINGS,icon:d.jsx(Cp.SettingsCogIcon,{})}),n},[e,t])}function Ul(t){return gSe(t.requestBody)?Je.QUERY:Je.BODY}function _C(t){return t.type==="step"}function DC(t){return t.type==="workflow"}function h$(t,e){const n=[],r=[];for(const s of e)s.active&&Tp(s)?n.push(s):r.push(s);return[...t.map((s,o)=>{const l=n[o]?.id??s.id;return{...s,id:l}}),...r]}function mSe(){return structuredClone({id:crypto.randomUUID(),state:Sn.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Le.Step,draftStep:wo(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0}})}function OSe(t){return t!==void 0&&t.data?.type?.get()===Le.Step}function vSe(t,e){const n=e.data.collectionId.get(),r=e.data.workflowId.get(),i=e.data.stepId.get();return n&&r&&i?t$(t,{collectionId:n,workflowId:r,stepId:i})??e.data.draftStep.ornull:e.data.draftStep.ornull}function ySe(t,e,n,r,i,s){const o=a=>a??"";return o(t)===r&&o(e)===i&&o(n)===s}const NC="New workflow";function bZ({name:t=NC,collection:e}){let r=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||NC).replaceAll(" ","-").toLowerCase();if(!e)return r;const i=bSe(e);if(i.includes(r)){let s=1;for(;i.includes(`${r}-${s}`);)s++;r=`${r}-${s}`}return r}function bSe(t){return t.workflows.filter(e=>e.state.get()!==jt.Draft).map(e=>e.workflowId.get())}function p$({name:t=NC,isDraft:e=!1,collection:n}={}){return{workflowId:bZ({name:t,collection:n}),summary:t,steps:[],state:e?jt.Draft:jt.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[ss()]}}function xSe(t,e){const n=new Set,{pathParameters:r,queryParameters:i,headers:s,cookies:o}=t.parameters.get(),a=t.outputs.get();for(const{value:l}of[...pn([...r,...i,...s,...o],e?.components.parameters.get()),...a])for(const c of Ia(l))n.add(c);return t.steps.forEach(l=>{const c=l.security.get();for(const O of c)switch(O.securityType){case te.BasicAuth:case te.DigestAuth:for(const b of[O[O.securityType].username,O[O.securityType].password])for(const x of Ia(b))n.add(x);break;case te.JWT:for(const b of Ia(O[O.securityType].token))n.add(b);break;case te.APIKey:for(const b of Ia(O[O.securityType].key))n.add(b);break;case te.OAuth2:case te.OpenIDConnect:const v=O[O.securityType];for(const b of Ia(v[v.grantType].accessToken))n.add(b);break}const{pathParameters:u,queryParameters:f,headers:h,cookies:p}=l.parameters.get(),m=l.outputs.get();for(const{value:O}of[...pn([...u,...f,...h,...p],e?.components.parameters.get()),...m])for(const v of Ia(O))n.add(v);const g=l.requestBody.get();switch(g.type){case"multipart/form-data":case"application/x-www-form-urlencoded":{for(const{value:O}of g.formData[g.type])for(const v of Ia(O))n.add(v);break}case"application/octet-stream":break;default:for(const O of Ia(g.content))n.add(O)}}),n}function xZ(t,e,n){const r=xSe(t,n);if(r.size===0){t.inputs.set(vt);return}t.inputs.set(i=>{const s=typeof i=="object"&&i?.properties||{};return{type:"object",properties:Object.fromEntries(Array.from(r).map(o=>{const a=e.inputs.find(l=>l.name.get()===o)?.isSecret;return[o,a?{type:"string",format:"password"}:s[o]||{type:"string"}]}))}})}function qd(t){return t.summary||t.workflowId||"Untitled Workflow"}function SZ(t,{collectionId:e,workflowId:n}){return t.collections.find(s=>s.id.get()===e)?.workflows.find(s=>s.workflowId.get()===n)??null}function kc(){const{apis:t}=nt(),{convertOperationToReplayValue:e}=gr();return{getApiOperation:y.useCallback(r=>UW(t,r,e),[t,e])}}function wZ(t){const e=(t.match(/{([^}]+)}/g)||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function SSe(t){const e=t.servers.ornull?.[0];if(!e)return{url:"",variables:[]};const n=e.url.get(),i=wZ(n).map(s=>({name:s,value:e.variables.ornull?.[s]?.default.get()||""}));return{url:n,variables:i}}function CZ(){const t=nt();function e(n){const r=t.apis.find(o=>o.id.get()===n);if(!r){console.error(`API ${n} not found`);return}const{url:i,variables:s}=SSe(r);t.environments.forEach(o=>{o.servers.find(l=>l.apiId.get()===n)||o.servers.merge([{apiId:n,value:i,variables:s}])})}return{attachApiServerToEnvironments:e}}const g$="New collection";function m$({name:t=g$,collections:e,isDraft:n=!1}={}){return{id:PZ({name:t,collections:e}),srcType:ri.FS,arazzo:"1.0.1",info:{version:"1.0.0",title:t},workflows:[],state:n?jt.Draft:jt.Normal,components:{inputs:{},parameters:{}},sourceDescriptions:[]}}function Z_(t=g$){return`collections/${t.replaceAll(" ","-").toLowerCase()}.arazzo.yaml`}function PZ({name:t=g$,collections:e}={}){let n=Z_(t);if(!e?.length)return n;const r=wSe(e);let i=1;for(;r.includes(n);)n=Z_(`${t}-${i}`),i++;return n}function wSe(t){return t.filter(e=>e.state.get()!==jt.Draft).map(e=>e.id.get())}function kZ(t,e){return t.collections.find(r=>r.id.get()===e)??null}function CSe({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 ml(){const t=nt(),{attachApiServerToEnvironments:e}=CZ();async function n({collectionId:o,apiId:a}){const l=t.collections.find(u=>u.id.get()===o);if(!l)return;if(!l.sourceDescriptions.get({noproxy:!0}).some(u=>u.apiId===a)){const f=t.apis.find(p=>p.id.get()===a)?.info.title.get(),h=Li(a)?a:await Ht.relative(`/${o}/..`,`/${a}`);l.sourceDescriptions.set(p=>p.some(m=>m.apiId===a)?p:[...p,{name:CSe({apiName:f,sourceDescriptions:p}),url:h,apiId:a}])}e(a)}function r(o){return kZ(t,o)}function i(o,a){const l=o.sourceDescriptions.get({noproxy:!0}).filter(c=>a.name!==c.name);o.sourceDescriptions.set(l)}function s(o,a){const l=new Set(a.map(c=>`${c.workflowId??""}\0${c.stepId}`));o.workflows.forEach(c=>{const u=c.workflowId.get({noproxy:!0});c.steps.forEach(f=>{const h=f.stepId.get({noproxy:!0}),p=`${u}\0${h}`;if(!l.has(p))return;const m=f.operation.get({noproxy:!0});m&&(f.xOperation.set({method:m.method,url:m.path}),f.operation.set(null))})})}return{attachApiToCollection:n,getCollection:r,removeSourceDescription:i,disconnectStepsFromSource:s}}function Ud(t){const e=nt();return t?e.collections.find(r=>r.id.get()===t)??null:null}const kr={all:["history"],lists:()=>[...kr.all,"list"],list:t=>[...kr.lists(),t],recent:(t,e)=>[...kr.all,"recent",t,e],detail:t=>[...kr.all,"detail",t],count:t=>[...kr.all,"count",t]};class q_{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 MC=(t,e)=>e.some(n=>t instanceof n);let U_,B_;function PSe(){return U_||(U_=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function kSe(){return B_||(B_=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const zC=new WeakMap,a1=new WeakMap,Pb=new WeakMap;function TSe(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(Jl(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return Pb.set(e,t),e}function $Se(t){if(zC.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)});zC.set(t,e)}let VC={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return zC.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Jl(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 TZ(t){VC=t(VC)}function ISe(t){return kSe().includes(t)?function(...e){return t.apply(LC(this),e),Jl(this.request)}:function(...e){return Jl(t.apply(LC(this),e))}}function ESe(t){return typeof t=="function"?ISe(t):(t instanceof IDBTransaction&&$Se(t),MC(t,PSe())?new Proxy(t,VC):t)}function Jl(t){if(t instanceof IDBRequest)return TSe(t);if(a1.has(t))return a1.get(t);const e=ESe(t);return e!==t&&(a1.set(t,e),Pb.set(e,t)),e}const LC=t=>Pb.get(t);function ASe(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Jl(o);return r&&o.addEventListener("upgradeneeded",l=>{r(Jl(o.result),l.oldVersion,l.newVersion,Jl(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 QSe=["get","getKey","getAll","getAllKeys","count"],RSe=["put","add","delete","clear"],l1=new Map;function F_(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(l1.get(e))return l1.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=RSe.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||QSe.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 l1.set(e,s),s}TZ(t=>({...t,get:(e,n,r)=>F_(e,n)||t.get(e,n,r),has:(e,n)=>!!F_(e,n)||t.has(e,n)}));const jSe=["continue","continuePrimaryKey","advance"],Y_={},XC=new WeakMap,$Z=new WeakMap,_Se={get(t,e){if(!jSe.includes(e))return t[e];let n=Y_[e];return n||(n=Y_[e]=function(...r){XC.set(this,$Z.get(this)[e](...r))}),n}};async function*DSe(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,_Se);for($Z.set(n,e),Pb.set(n,LC(e));e;)yield n,e=await(XC.get(n)||e.continue()),XC.delete(n)}function G_(t,e){return e===Symbol.asyncIterator&&MC(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&MC(t,[IDBIndex,IDBObjectStore])}TZ(t=>({...t,get(e,n,r){return G_(e,n)?DSe:t.get(e,n,r)},has(e,n){return G_(e,n)||t.has(e,n)}}));class O${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 O$(e,n,r)}async initialize(){this.db||(this.db=await ASe(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const NSe=1;class v${constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=O$.createInstance(n,NSe,this.setupDatabase);return new v$(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)}}function MSe(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const zSe=2;function VSe(t){const e=JSON.parse(t);let n;return e.version===1?n=MSe(e):n=e,n.version!==zSe&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const c1="history.json",LSe="history.json.backup";class XSe{static async migrateFromStorage(e,n,r){try{const i=await e.get(c1);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const s=VSe(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(c1,LSe)}catch{await e.remove(c1)}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-dwJ0xBYr.js")),s=new i(e.systemFilesDir);return this.migrateFromStorage(s,n,"JSON file")}else{const i=new kS(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}class Fa{static instance=null;static async initialize(e,n){this.close(),this.instance=await WSe(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function WSe(t,e){if(e){const{HistorySqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-HistorySqliteDBStorage-BrILW8Fu.js")),r=up.getInstance(),i=new n(r);return new q_(i)}else{const n=v$.create(t.id);return new q_(n)}}function ZSe(t){return Lr.useQuery({queryKey:kr.list(t),queryFn:async()=>Fa.getInstance().getAll(t)})}function IZ(){const t=Lr.useQueryClient();return Lr.useMutation({mutationFn:async e=>{await Fa.getInstance().addItem(e)},onMutate:e=>{t.setQueryData(kr.detail(e.id),e)},onSuccess:()=>{t.invalidateQueries({queryKey:kr.lists()}),t.invalidateQueries({queryKey:kr.count()})},onError:(e,n)=>{t.removeQueries({queryKey:kr.detail(n.id)}),console.error("Failed to add history item:",e)}})}function qSe(){const t=Lr.useQueryClient();return Lr.useMutation({mutationFn:async e=>{await Fa.getInstance().deleteItem(e)},onSuccess:(e,n)=>{t.removeQueries({queryKey:kr.detail(n)}),t.invalidateQueries({queryKey:kr.lists()}),t.invalidateQueries({queryKey:kr.count()})},onError:(e,n)=>{console.error(`Failed to delete history item ${n}:`,e)}})}function USe(){const t=Lr.useQueryClient();return Lr.useMutation({mutationFn:async()=>{await Fa.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:kr.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function BSe(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function FSe(){const t=IZ();return y.useCallback(({step:e,response:n})=>{const r=BSe(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function YSe(){const t=IZ();return y.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 GSe(){const t=Lr.useQueryClient();async function e(n){return t.ensureQueryData({queryKey:kr.detail(n),queryFn:()=>Fa.getInstance().getById(n)})}return{getHistoryItem:e}}function y$(){const t=nt();return{getStep:n=>t$(t,n)}}function HSe({collectionId:t,workflowId:e,stepId:n}){const i=nt().collections.find(a=>a.id.get()===t);if(!i)return null;const s=i.workflows.find(a=>a.workflowId.get()===e);return s?s.steps.find(a=>a.stepId.get()===n)??null:null}function b$(t){const e=t?.collectionId.get()??null,n=t?.workflowId.get()??null,r=t?.stepId.get()??null,s=HSe({collectionId:e,workflowId:n,stepId:r})||t?.draftStep.ornull;return s||null}function kb(){const t=nt();return{getWorkflow:({collectionId:n,workflowId:r})=>SZ(t,{collectionId:n,workflowId:r})}}function Ol({collectionId:t,workflowId:e}){const r=nt().collections.find(s=>s.id.get()===t);return r?r.workflows.find(s=>s.workflowId.get()===e)??null:null}function WC(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const JSe=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function KSe(){const{project:{userFilesDir:t}}=nt(),{certificates:e}=qr(),n=Vt(),{getCollection:r}=ml();return{execute:async(s,o,a)=>{const l=r(s),c=t.get(),{inputs:u,servers:f}=n.get(),h=l?.sourceDescriptions.get()??[],p=`${c}/${s}`,[{createConfig:m},{ExternalResolver:g}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-CHGVyIdG.js")),Promise.resolve().then(()=>require("./replay-external-resolver-n5OvQMRF.js"))]),O=new g,v=u.map(S=>JSON.stringify({[S.name]:S.value})),b=ewe(f,h),{run:x}=await Promise.resolve().then(()=>require("./replay-respect-run-BJsR4a4m.js")),P=await x({files:[p],workflow:o?[o]:[],fetch:(S,k)=>{const T=JSe(S),{clientCert:$,clientKey:A}=_W(T,e?e.get({noproxy:!0}):[]);return yo(T,{...k,clientCert:$,clientKey:A})},logger:mb,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async S=>{if(!await cT(S))throw new Error(`File ${S} doesn't exist or isn't readable.`);try{const T=await lT(S),$=new TextEncoder().encode(T);return new File([$],await sT(S))}catch(T){throw new Error(`Failed to read file ${S}: ${T}`)}}},envVariables:{},config:await m({}),externalRefResolver:O,input:v,server:b,severity:JSON.stringify(a),skipLint:!0,noSecretsMasking:!0});try{await C0e(s,o,P?.[0]?.ctx)}catch(S){console.error("Failed to persist workflow step context:",S)}return P}}}function ewe(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 twe="com.redocly.tab.openFailed";function Pu(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Le.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0,...t}}function ZC(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function nwe(t,e){const n=t.draftStep.ornull,r=n?.xOperation.ornull;if(!(!n||!r)){if(e.url&&r.url.get()!==e.url){r.url.set(e.url);const i=n.parameters.queryParameters.get({noproxy:!0});n.parameters.queryParameters.set(h$(Dp(e.url),i))}r.method.get()!==e.method&&r.method.set(e.method)}}function Nn(){const{activeTabIdx:t,tabs:e}=pl(),{dynamicReplayValues:n}=gr(),{getStep:r}=y$(),{getHistoryItem:i}=GSe(),{getWorkflow:s}=kb(),{getCollection:o}=ml(),{getApiOperation:a}=kc(),{sendEvent:l}=Be(),c=Vt(),u=y.useCallback((Q,M,N,z)=>{console.warn(`[useTabHandlers] ${Q}`,z),l(twe,[{...he("tab",M),reason:N,...z}])},[l]),f=y.useCallback((Q,M)=>{const N=e[Q];N&&N.ornull!==null&&N.state&&N.state.set(M)},[e]),h=y.useCallback(Q=>{t.set(Q)},[t]),p=y.useCallback(()=>{e.merge([mSe()]),t.set(e.length-1)},[e,t]),m=y.useCallback(Q=>{const M=[...e.get({noproxy:!0}).filter(z=>z.state!==Sn.Preview)];M.push(Q),e.set(M);const N=M.length-1;return t.set(N),N},[e,t]),g=y.useCallback(Q=>{const M=a(Q),N=x$(Q,M,n);m(N)},[m,n,a]),O=y.useCallback((Q,M)=>{const N=e.get(),z=V=>N.findIndex(({data:B})=>bn(B,Le.Step)&&V(B)),E=V=>e[V].data;if(M){const V=z(Z=>Z.sourceFile===M);if(V!==-1){nwe(E(V),Q),h(V);return}const B=z(Z=>!Z.sourceFile&&ZC(Z,Q));if(B!==-1){E(B).merge({sourceFile:M}),h(B);return}}else{const V=z(B=>ZC(B,Q));if(V!==-1){h(V);return}}const L=wo({xOperation:Q,name:M??void 0});m({id:crypto.randomUUID(),state:Sn.Normal,data:Pu({draftStep:L,activeTabName:Ul(L),sourceFile:M??null})})},[e,h,m]),v=y.useCallback(async Q=>{t.set(Math.max(0,Q-1)),await new Promise(M=>setTimeout(()=>{e[Q].set(vt),M()}))},[t,e]),b=y.useCallback(()=>{e.set([]),t.set(0)},[t,e]);function x({collectionId:Q,workflowId:M,stepId:N}){const z=e.get({noproxy:!0}),E=new Set;for(let L=0;L<z.length;L++){const V=z[L].data;switch(V.type){case Le.Step:V.collectionId===Q&&V.workflowId===M&&V.stepId===N&&E.add(L);break;case Le.Workflow:case Le.WorkflowRun:V.collectionId===Q&&V.workflowId===M&&!N&&E.add(L);break;case Le.Collection:V.collectionId===Q&&!M&&!N&&E.add(L);break}}E.size&&(e.merge(Object.fromEntries(E.values().map(L=>[L,vt]))),t.set(0))}const P=y.useCallback(async Q=>{const M=e.get().find(({data:N})=>bn(N,Le.Step)&&N.historyId===Q);if(M)t.set(e.get().indexOf(M));else{const N=await i(Q);if(!N||!_C(N)){u("Step history not found","stepHistoryTab","step_history_not_found",{historyId:Q});return}const z=N.step;m({id:crypto.randomUUID(),state:Sn.Preview,data:Pu({historyId:Q,draftStep:structuredClone(z),response:structuredClone(N.response),activeTabName:Ul(z)})})}},[t,e,m,i,u]),S=y.useCallback(({collectionId:Q,activeTabName:M})=>{const N=e.findIndex(z=>{const E=z.data.get();return bn(E,Le.Collection)&&E.collectionId===Q});if(N!==-1)t.set(N);else{if(!o(Q)){u("Collection not found","collectionTab","collection_not_found",{collectionId:Q});return}m({id:crypto.randomUUID(),state:Sn.Preview,data:{collectionId:Q,type:Le.Collection,activeTabName:M??Je.COLLECTION_SETTINGS}})}},[t,e,m,o,u]),k=y.useCallback(({collectionId:Q,workflowId:M})=>{if(!s({collectionId:Q,workflowId:M})){u("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:Q,workflowId:M});return}m({id:crypto.randomUUID(),state:Sn.Normal,data:{collectionId:Q,workflowId:M,historyId:null,runDate:null,type:Le.WorkflowRun,result:null,severitySettings:WC()}})},[m,s,u]),T=y.useCallback(async(Q,{state:M=Sn.Preview}={})=>{const N=e.get().find(({data:z})=>bn(z,Le.WorkflowRun)&&z.historyId===Q);if(N){const z=e.get().indexOf(N);M===Sn.Normal&&N.state===Sn.Preview&&f(z,Sn.Normal),t.set(z)}else{const z=await i(Q);if(!z||!DC(z)){u("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:Q});return}m({id:crypto.randomUUID(),state:M,data:{collectionId:z.collectionId,workflowId:z.workflowId,historyId:Q,runDate:z.date,type:Le.WorkflowRun,result:structuredClone(z.workflowResult),severitySettings:WC(),label:qd(z.workflow),secretValues:c.get().inputs.filter(E=>E.isSecret&&E.value).map(E=>String(E.value))}})}},[t,e,m,f,i,u,c]),$=y.useCallback(({collectionId:Q,workflowId:M,activeTabName:N})=>{const z=e.findIndex(E=>{const L=E.data.get();return bn(L,Le.Workflow)&&L.workflowId===M&&L.collectionId===Q});if(z!==-1){const E=e[z].data;N&&E.activeTabName.set(N),t.set(z)}else{if(!s({collectionId:Q,workflowId:M})){u("Workflow not found","workflowTab","workflow_not_found",{collectionId:Q,workflowId:M});return}m({id:crypto.randomUUID(),state:Sn.Preview,data:{collectionId:Q,workflowId:M,type:Le.Workflow,activeTabName:N??Je.WORKFLOW_SETTINGS}})}},[t,e,m,s,u]),A=y.useCallback(({collectionId:Q,workflowId:M,stepId:N,state:z})=>{const E=e.get().find(({data:L})=>bn(L,Le.Step)&&L.collectionId===Q&&L.workflowId===M&&L.stepId===N&&L.historyId===null);if(E)t.set(e.get().indexOf(E));else{const L=r({collectionId:Q,workflowId:M,stepId:N});if(!L){u("Step not found","stepTab","step_not_found",{collectionId:Q,workflowId:M,stepId:N});return}const V=L.get({noproxy:!0});m({id:crypto.randomUUID(),state:z??Sn.Preview,data:Pu({stepId:N,collectionId:Q,workflowId:M,activeTabName:Ul(V)})})}},[t,e,r,m,u]),_=y.useCallback(({step:Q})=>{m({id:crypto.randomUUID(),state:Sn.Normal,data:Pu({stepId:Q.stepId??null,workflowId:Q.workflowId??null,draftStep:structuredClone(Q),activeTabName:Ul(Q)})})},[m]),D=y.useCallback((Q,M)=>{if(Q===M)return;const N=t.get(),z=[...e.get({noproxy:!0})],E=z[N]?.id,[L]=z.splice(Q,1);if(z.splice(M,0,L),e.set(z),E){const V=z.findIndex(B=>B.id===E);t.set(V)}},[t,e]);return{handleNewTabOpen:p,addNewTab:m,openStepTabFromOperation:g,openStepTabFromXOperation:O,handleTabChange:h,handleTabClose:v,handleCloseAllTabs:b,handleCloseByDataId:x,openCollectionTab:S,openWorkflowTab:$,openWorkflowRunTab:k,openWorkflowRunTabFromHistory:T,openStepTabFromHistory:P,openStepTabFromCollection:A,openStepTab:_,handleTabReorder:D,changeTabState:f}}function x$(t,e,n){const r=wo({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:Sn.Preview,data:Pu({draftStep:r,activeTabName:Ul(r)})}}function rwe(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const iwe=({transform:t})=>({...t,y:0}),swe=({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))},Tc=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,owe=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"})]}),Tb=w.default(owe)`
772
+ `;function pSe(){const t=y.useRef(null),[e,n]=y.useState(!1);return xP.useMount(()=>{const r=t.current,i=()=>{r&&n(r.scrollWidth>r.clientWidth)};i();const s=new MutationObserver(()=>{i()});return r&&s.observe(r,{childList:!0,subtree:!0,attributes:!1}),window.addEventListener("resize",i),()=>{r&&s.disconnect(),window.removeEventListener("resize",i)}}),{containerRef:t,hasScrollbar:e}}const Je={SECURITY:"Security",BODY:"Body",PATH:"Path",QUERY:"Query",HEADERS:"Headers",COOKIES:"Cookies",COMPONENTS:"Components",SOURCES:"Sources",STEP_SETTINGS:"Step settings",WORKFLOW_SETTINGS:"Workflow settings",COLLECTION_SETTINGS:"Collection settings"};function W_(t){return t.some(e=>!!(e.key||e.value||e.files?.length))}function gSe({type:t,formData:e,content:n}){if(Cv.includes(t)){const r=W_(e["multipart/form-data"]),i=W_(e["application/x-www-form-urlencoded"]);return!r&&!i}return lue.includes(t)?n.length===0:!0}function yZ(t){const{disableCollectionsTab:e}=qr();return y.useMemo(()=>{const n=[{name:Je.SECURITY,icon:d.jsx(nM.SecurityIcon,{})},{name:Je.BODY,icon:d.jsx(wp.CodeIcon,{})},{name:Je.PATH,icon:d.jsx(tM.DataRefineryIcon,{})},{name:Je.QUERY,icon:d.jsx(eM.DataFormatIcon,{})},{name:Je.HEADERS,icon:d.jsx(wP.TableBuiltIcon,{})},{name:Je.COOKIES,icon:d.jsx(SP.CookieIcon,{})}];return!e.get()&&!t&&n.push({name:Je.STEP_SETTINGS,icon:d.jsx(Cp.SettingsCogIcon,{})}),n},[e,t])}function Ul(t){return gSe(t.requestBody)?Je.QUERY:Je.BODY}function _C(t){return t.type==="step"}function DC(t){return t.type==="workflow"}function h$(t,e){const n=[],r=[];for(const s of e)s.active&&Tp(s)?n.push(s):r.push(s);return[...t.map((s,o)=>{const l=n[o]?.id??s.id;return{...s,id:l}}),...r]}function mSe(){return structuredClone({id:crypto.randomUUID(),state:Sn.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Le.Step,draftStep:wo(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0}})}function OSe(t){return t!==void 0&&t.data?.type?.get()===Le.Step}function vSe(t,e){const n=e.data.collectionId.get(),r=e.data.workflowId.get(),i=e.data.stepId.get();return n&&r&&i?t$(t,{collectionId:n,workflowId:r,stepId:i})??e.data.draftStep.ornull:e.data.draftStep.ornull}function ySe(t,e,n,r,i,s){const o=a=>a??"";return o(t)===r&&o(e)===i&&o(n)===s}const NC="New workflow";function bZ({name:t=NC,collection:e}){let r=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||NC).replaceAll(" ","-").toLowerCase();if(!e)return r;const i=bSe(e);if(i.includes(r)){let s=1;for(;i.includes(`${r}-${s}`);)s++;r=`${r}-${s}`}return r}function bSe(t){return t.workflows.filter(e=>e.state.get()!==jt.Draft).map(e=>e.workflowId.get())}function p$({name:t=NC,isDraft:e=!1,collection:n}={}){return{workflowId:bZ({name:t,collection:n}),summary:t,steps:[],state:e?jt.Draft:jt.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[ss()]}}function xSe(t,e){const n=new Set,{pathParameters:r,queryParameters:i,headers:s,cookies:o}=t.parameters.get(),a=t.outputs.get();for(const{value:l}of[...pn([...r,...i,...s,...o],e?.components.parameters.get()),...a])for(const c of Ia(l))n.add(c);return t.steps.forEach(l=>{const c=l.security.get();for(const O of c)switch(O.securityType){case te.BasicAuth:case te.DigestAuth:for(const b of[O[O.securityType].username,O[O.securityType].password])for(const x of Ia(b))n.add(x);break;case te.JWT:for(const b of Ia(O[O.securityType].token))n.add(b);break;case te.APIKey:for(const b of Ia(O[O.securityType].key))n.add(b);break;case te.OAuth2:case te.OpenIDConnect:const v=O[O.securityType];for(const b of Ia(v[v.grantType].accessToken))n.add(b);break}const{pathParameters:u,queryParameters:f,headers:h,cookies:p}=l.parameters.get(),m=l.outputs.get();for(const{value:O}of[...pn([...u,...f,...h,...p],e?.components.parameters.get()),...m])for(const v of Ia(O))n.add(v);const g=l.requestBody.get();switch(g.type){case"multipart/form-data":case"application/x-www-form-urlencoded":{for(const{value:O}of g.formData[g.type])for(const v of Ia(O))n.add(v);break}case"application/octet-stream":break;default:for(const O of Ia(g.content))n.add(O)}}),n}function xZ(t,e,n){const r=xSe(t,n);if(r.size===0){t.inputs.set(vt);return}t.inputs.set(i=>{const s=typeof i=="object"&&i?.properties||{};return{type:"object",properties:Object.fromEntries(Array.from(r).map(o=>{const a=e.inputs.find(l=>l.name.get()===o)?.isSecret;return[o,a?{type:"string",format:"password"}:s[o]||{type:"string"}]}))}})}function qd(t){return t.summary||t.workflowId||"Untitled Workflow"}function SZ(t,{collectionId:e,workflowId:n}){return t.collections.find(s=>s.id.get()===e)?.workflows.find(s=>s.workflowId.get()===n)??null}function kc(){const{apis:t}=nt(),{convertOperationToReplayValue:e}=gr();return{getApiOperation:y.useCallback(r=>UW(t,r,e),[t,e])}}function wZ(t){const e=(t.match(/{([^}]+)}/g)||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function SSe(t){const e=t.servers.ornull?.[0];if(!e)return{url:"",variables:[]};const n=e.url.get(),i=wZ(n).map(s=>({name:s,value:e.variables.ornull?.[s]?.default.get()||""}));return{url:n,variables:i}}function CZ(){const t=nt();function e(n){const r=t.apis.find(o=>o.id.get()===n);if(!r){console.error(`API ${n} not found`);return}const{url:i,variables:s}=SSe(r);t.environments.forEach(o=>{o.servers.find(l=>l.apiId.get()===n)||o.servers.merge([{apiId:n,value:i,variables:s}])})}return{attachApiServerToEnvironments:e}}const g$="New collection";function m$({name:t=g$,collections:e,isDraft:n=!1}={}){return{id:PZ({name:t,collections:e}),srcType:ri.FS,arazzo:"1.0.1",info:{version:"1.0.0",title:t},workflows:[],state:n?jt.Draft:jt.Normal,components:{inputs:{},parameters:{}},sourceDescriptions:[]}}function Z_(t=g$){return`collections/${t.replaceAll(" ","-").toLowerCase()}.arazzo.yaml`}function PZ({name:t=g$,collections:e}={}){let n=Z_(t);if(!e?.length)return n;const r=wSe(e);let i=1;for(;r.includes(n);)n=Z_(`${t}-${i}`),i++;return n}function wSe(t){return t.filter(e=>e.state.get()!==jt.Draft).map(e=>e.id.get())}function kZ(t,e){return t.collections.find(r=>r.id.get()===e)??null}function CSe({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 ml(){const t=nt(),{attachApiServerToEnvironments:e}=CZ();async function n({collectionId:o,apiId:a}){const l=t.collections.find(u=>u.id.get()===o);if(!l)return;if(!l.sourceDescriptions.get({noproxy:!0}).some(u=>u.apiId===a)){const f=t.apis.find(p=>p.id.get()===a)?.info.title.get(),h=Li(a)?a:await Ht.relative(`/${o}/..`,`/${a}`);l.sourceDescriptions.set(p=>p.some(m=>m.apiId===a)?p:[...p,{name:CSe({apiName:f,sourceDescriptions:p}),url:h,apiId:a}])}e(a)}function r(o){return kZ(t,o)}function i(o,a){const l=o.sourceDescriptions.get({noproxy:!0}).filter(c=>a.name!==c.name);o.sourceDescriptions.set(l)}function s(o,a){const l=new Set(a.map(c=>`${c.workflowId??""}\0${c.stepId}`));o.workflows.forEach(c=>{const u=c.workflowId.get({noproxy:!0});c.steps.forEach(f=>{const h=f.stepId.get({noproxy:!0}),p=`${u}\0${h}`;if(!l.has(p))return;const m=f.operation.get({noproxy:!0});m&&(f.xOperation.set({method:m.method,url:m.path}),f.operation.set(null))})})}return{attachApiToCollection:n,getCollection:r,removeSourceDescription:i,disconnectStepsFromSource:s}}function Ud(t){const e=nt();return t?e.collections.find(r=>r.id.get()===t)??null:null}const kr={all:["history"],lists:()=>[...kr.all,"list"],list:t=>[...kr.lists(),t],recent:(t,e)=>[...kr.all,"recent",t,e],detail:t=>[...kr.all,"detail",t],count:t=>[...kr.all,"count",t]};class q_{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 MC=(t,e)=>e.some(n=>t instanceof n);let U_,B_;function PSe(){return U_||(U_=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function kSe(){return B_||(B_=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const zC=new WeakMap,a1=new WeakMap,Pb=new WeakMap;function TSe(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(Jl(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return Pb.set(e,t),e}function $Se(t){if(zC.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)});zC.set(t,e)}let VC={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return zC.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Jl(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 TZ(t){VC=t(VC)}function ISe(t){return kSe().includes(t)?function(...e){return t.apply(LC(this),e),Jl(this.request)}:function(...e){return Jl(t.apply(LC(this),e))}}function ESe(t){return typeof t=="function"?ISe(t):(t instanceof IDBTransaction&&$Se(t),MC(t,PSe())?new Proxy(t,VC):t)}function Jl(t){if(t instanceof IDBRequest)return TSe(t);if(a1.has(t))return a1.get(t);const e=ESe(t);return e!==t&&(a1.set(t,e),Pb.set(e,t)),e}const LC=t=>Pb.get(t);function ASe(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Jl(o);return r&&o.addEventListener("upgradeneeded",l=>{r(Jl(o.result),l.oldVersion,l.newVersion,Jl(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 QSe=["get","getKey","getAll","getAllKeys","count"],RSe=["put","add","delete","clear"],l1=new Map;function F_(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(l1.get(e))return l1.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=RSe.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||QSe.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 l1.set(e,s),s}TZ(t=>({...t,get:(e,n,r)=>F_(e,n)||t.get(e,n,r),has:(e,n)=>!!F_(e,n)||t.has(e,n)}));const jSe=["continue","continuePrimaryKey","advance"],Y_={},XC=new WeakMap,$Z=new WeakMap,_Se={get(t,e){if(!jSe.includes(e))return t[e];let n=Y_[e];return n||(n=Y_[e]=function(...r){XC.set(this,$Z.get(this)[e](...r))}),n}};async function*DSe(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,_Se);for($Z.set(n,e),Pb.set(n,LC(e));e;)yield n,e=await(XC.get(n)||e.continue()),XC.delete(n)}function G_(t,e){return e===Symbol.asyncIterator&&MC(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&MC(t,[IDBIndex,IDBObjectStore])}TZ(t=>({...t,get(e,n,r){return G_(e,n)?DSe:t.get(e,n,r)},has(e,n){return G_(e,n)||t.has(e,n)}}));class O${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 O$(e,n,r)}async initialize(){this.db||(this.db=await ASe(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const NSe=1;class v${constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=O$.createInstance(n,NSe,this.setupDatabase);return new v$(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)}}function MSe(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const zSe=2;function VSe(t){const e=JSON.parse(t);let n;return e.version===1?n=MSe(e):n=e,n.version!==zSe&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const c1="history.json",LSe="history.json.backup";class XSe{static async migrateFromStorage(e,n,r){try{const i=await e.get(c1);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const s=VSe(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(c1,LSe)}catch{await e.remove(c1)}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-BuHbmM-L.js")),s=new i(e.systemFilesDir);return this.migrateFromStorage(s,n,"JSON file")}else{const i=new kS(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}class Fa{static instance=null;static async initialize(e,n){this.close(),this.instance=await WSe(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function WSe(t,e){if(e){const{HistorySqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-HistorySqliteDBStorage-BrILW8Fu.js")),r=up.getInstance(),i=new n(r);return new q_(i)}else{const n=v$.create(t.id);return new q_(n)}}function ZSe(t){return Lr.useQuery({queryKey:kr.list(t),queryFn:async()=>Fa.getInstance().getAll(t)})}function IZ(){const t=Lr.useQueryClient();return Lr.useMutation({mutationFn:async e=>{await Fa.getInstance().addItem(e)},onMutate:e=>{t.setQueryData(kr.detail(e.id),e)},onSuccess:()=>{t.invalidateQueries({queryKey:kr.lists()}),t.invalidateQueries({queryKey:kr.count()})},onError:(e,n)=>{t.removeQueries({queryKey:kr.detail(n.id)}),console.error("Failed to add history item:",e)}})}function qSe(){const t=Lr.useQueryClient();return Lr.useMutation({mutationFn:async e=>{await Fa.getInstance().deleteItem(e)},onSuccess:(e,n)=>{t.removeQueries({queryKey:kr.detail(n)}),t.invalidateQueries({queryKey:kr.lists()}),t.invalidateQueries({queryKey:kr.count()})},onError:(e,n)=>{console.error(`Failed to delete history item ${n}:`,e)}})}function USe(){const t=Lr.useQueryClient();return Lr.useMutation({mutationFn:async()=>{await Fa.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:kr.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function BSe(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function FSe(){const t=IZ();return y.useCallback(({step:e,response:n})=>{const r=BSe(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function YSe(){const t=IZ();return y.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 GSe(){const t=Lr.useQueryClient();async function e(n){return t.ensureQueryData({queryKey:kr.detail(n),queryFn:()=>Fa.getInstance().getById(n)})}return{getHistoryItem:e}}function y$(){const t=nt();return{getStep:n=>t$(t,n)}}function HSe({collectionId:t,workflowId:e,stepId:n}){const i=nt().collections.find(a=>a.id.get()===t);if(!i)return null;const s=i.workflows.find(a=>a.workflowId.get()===e);return s?s.steps.find(a=>a.stepId.get()===n)??null:null}function b$(t){const e=t?.collectionId.get()??null,n=t?.workflowId.get()??null,r=t?.stepId.get()??null,s=HSe({collectionId:e,workflowId:n,stepId:r})||t?.draftStep.ornull;return s||null}function kb(){const t=nt();return{getWorkflow:({collectionId:n,workflowId:r})=>SZ(t,{collectionId:n,workflowId:r})}}function Ol({collectionId:t,workflowId:e}){const r=nt().collections.find(s=>s.id.get()===t);return r?r.workflows.find(s=>s.workflowId.get()===e)??null:null}function WC(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const JSe=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function KSe(){const{project:{userFilesDir:t}}=nt(),{certificates:e}=qr(),n=Vt(),{getCollection:r}=ml();return{execute:async(s,o,a)=>{const l=r(s),c=t.get(),{inputs:u,servers:f}=n.get(),h=l?.sourceDescriptions.get()??[],p=`${c}/${s}`,[{createConfig:m},{ExternalResolver:g}]=await Promise.all([Promise.resolve().then(()=>require("./replay-index-yAV5TCua.js")),Promise.resolve().then(()=>require("./replay-external-resolver-PLyV0HZs.js"))]),O=new g,v=u.map(S=>JSON.stringify({[S.name]:S.value})),b=ewe(f,h),{run:x}=await Promise.resolve().then(()=>require("./replay-respect-run-rx_nPWZM.js")),P=await x({files:[p],workflow:o?[o]:[],fetch:(S,k)=>{const T=JSe(S),{clientCert:$,clientKey:A}=_W(T,e?e.get({noproxy:!0}):[]);return yo(T,{...k,clientCert:$,clientKey:A})},logger:mb,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async S=>{if(!await cT(S))throw new Error(`File ${S} doesn't exist or isn't readable.`);try{const T=await lT(S),$=new TextEncoder().encode(T);return new File([$],await sT(S))}catch(T){throw new Error(`Failed to read file ${S}: ${T}`)}}},envVariables:{},config:await m({}),externalRefResolver:O,input:v,server:b,severity:JSON.stringify(a),skipLint:!0,noSecretsMasking:!0});try{await C0e(s,o,P?.[0]?.ctx)}catch(S){console.error("Failed to persist workflow step context:",S)}return P}}}function ewe(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 twe="com.redocly.tab.openFailed";function Pu(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Le.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0,...t}}function ZC(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function nwe(t,e){const n=t.draftStep.ornull,r=n?.xOperation.ornull;if(!(!n||!r)){if(e.url&&r.url.get()!==e.url){r.url.set(e.url);const i=n.parameters.queryParameters.get({noproxy:!0});n.parameters.queryParameters.set(h$(Dp(e.url),i))}r.method.get()!==e.method&&r.method.set(e.method)}}function Nn(){const{activeTabIdx:t,tabs:e}=pl(),{dynamicReplayValues:n}=gr(),{getStep:r}=y$(),{getHistoryItem:i}=GSe(),{getWorkflow:s}=kb(),{getCollection:o}=ml(),{getApiOperation:a}=kc(),{sendEvent:l}=Be(),c=Vt(),u=y.useCallback((Q,M,N,z)=>{console.warn(`[useTabHandlers] ${Q}`,z),l(twe,[{...he("tab",M),reason:N,...z}])},[l]),f=y.useCallback((Q,M)=>{const N=e[Q];N&&N.ornull!==null&&N.state&&N.state.set(M)},[e]),h=y.useCallback(Q=>{t.set(Q)},[t]),p=y.useCallback(()=>{e.merge([mSe()]),t.set(e.length-1)},[e,t]),m=y.useCallback(Q=>{const M=[...e.get({noproxy:!0}).filter(z=>z.state!==Sn.Preview)];M.push(Q),e.set(M);const N=M.length-1;return t.set(N),N},[e,t]),g=y.useCallback(Q=>{const M=a(Q),N=x$(Q,M,n);m(N)},[m,n,a]),O=y.useCallback((Q,M)=>{const N=e.get(),z=V=>N.findIndex(({data:B})=>bn(B,Le.Step)&&V(B)),E=V=>e[V].data;if(M){const V=z(Z=>Z.sourceFile===M);if(V!==-1){nwe(E(V),Q),h(V);return}const B=z(Z=>!Z.sourceFile&&ZC(Z,Q));if(B!==-1){E(B).merge({sourceFile:M}),h(B);return}}else{const V=z(B=>ZC(B,Q));if(V!==-1){h(V);return}}const L=wo({xOperation:Q,name:M??void 0});m({id:crypto.randomUUID(),state:Sn.Normal,data:Pu({draftStep:L,activeTabName:Ul(L),sourceFile:M??null})})},[e,h,m]),v=y.useCallback(async Q=>{t.set(Math.max(0,Q-1)),await new Promise(M=>setTimeout(()=>{e[Q].set(vt),M()}))},[t,e]),b=y.useCallback(()=>{e.set([]),t.set(0)},[t,e]);function x({collectionId:Q,workflowId:M,stepId:N}){const z=e.get({noproxy:!0}),E=new Set;for(let L=0;L<z.length;L++){const V=z[L].data;switch(V.type){case Le.Step:V.collectionId===Q&&V.workflowId===M&&V.stepId===N&&E.add(L);break;case Le.Workflow:case Le.WorkflowRun:V.collectionId===Q&&V.workflowId===M&&!N&&E.add(L);break;case Le.Collection:V.collectionId===Q&&!M&&!N&&E.add(L);break}}E.size&&(e.merge(Object.fromEntries(E.values().map(L=>[L,vt]))),t.set(0))}const P=y.useCallback(async Q=>{const M=e.get().find(({data:N})=>bn(N,Le.Step)&&N.historyId===Q);if(M)t.set(e.get().indexOf(M));else{const N=await i(Q);if(!N||!_C(N)){u("Step history not found","stepHistoryTab","step_history_not_found",{historyId:Q});return}const z=N.step;m({id:crypto.randomUUID(),state:Sn.Preview,data:Pu({historyId:Q,draftStep:structuredClone(z),response:structuredClone(N.response),activeTabName:Ul(z)})})}},[t,e,m,i,u]),S=y.useCallback(({collectionId:Q,activeTabName:M})=>{const N=e.findIndex(z=>{const E=z.data.get();return bn(E,Le.Collection)&&E.collectionId===Q});if(N!==-1)t.set(N);else{if(!o(Q)){u("Collection not found","collectionTab","collection_not_found",{collectionId:Q});return}m({id:crypto.randomUUID(),state:Sn.Preview,data:{collectionId:Q,type:Le.Collection,activeTabName:M??Je.COLLECTION_SETTINGS}})}},[t,e,m,o,u]),k=y.useCallback(({collectionId:Q,workflowId:M})=>{if(!s({collectionId:Q,workflowId:M})){u("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:Q,workflowId:M});return}m({id:crypto.randomUUID(),state:Sn.Normal,data:{collectionId:Q,workflowId:M,historyId:null,runDate:null,type:Le.WorkflowRun,result:null,severitySettings:WC()}})},[m,s,u]),T=y.useCallback(async(Q,{state:M=Sn.Preview}={})=>{const N=e.get().find(({data:z})=>bn(z,Le.WorkflowRun)&&z.historyId===Q);if(N){const z=e.get().indexOf(N);M===Sn.Normal&&N.state===Sn.Preview&&f(z,Sn.Normal),t.set(z)}else{const z=await i(Q);if(!z||!DC(z)){u("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:Q});return}m({id:crypto.randomUUID(),state:M,data:{collectionId:z.collectionId,workflowId:z.workflowId,historyId:Q,runDate:z.date,type:Le.WorkflowRun,result:structuredClone(z.workflowResult),severitySettings:WC(),label:qd(z.workflow),secretValues:c.get().inputs.filter(E=>E.isSecret&&E.value).map(E=>String(E.value))}})}},[t,e,m,f,i,u,c]),$=y.useCallback(({collectionId:Q,workflowId:M,activeTabName:N})=>{const z=e.findIndex(E=>{const L=E.data.get();return bn(L,Le.Workflow)&&L.workflowId===M&&L.collectionId===Q});if(z!==-1){const E=e[z].data;N&&E.activeTabName.set(N),t.set(z)}else{if(!s({collectionId:Q,workflowId:M})){u("Workflow not found","workflowTab","workflow_not_found",{collectionId:Q,workflowId:M});return}m({id:crypto.randomUUID(),state:Sn.Preview,data:{collectionId:Q,workflowId:M,type:Le.Workflow,activeTabName:N??Je.WORKFLOW_SETTINGS}})}},[t,e,m,s,u]),A=y.useCallback(({collectionId:Q,workflowId:M,stepId:N,state:z})=>{const E=e.get().find(({data:L})=>bn(L,Le.Step)&&L.collectionId===Q&&L.workflowId===M&&L.stepId===N&&L.historyId===null);if(E)t.set(e.get().indexOf(E));else{const L=r({collectionId:Q,workflowId:M,stepId:N});if(!L){u("Step not found","stepTab","step_not_found",{collectionId:Q,workflowId:M,stepId:N});return}const V=L.get({noproxy:!0});m({id:crypto.randomUUID(),state:z??Sn.Preview,data:Pu({stepId:N,collectionId:Q,workflowId:M,activeTabName:Ul(V)})})}},[t,e,r,m,u]),_=y.useCallback(({step:Q})=>{m({id:crypto.randomUUID(),state:Sn.Normal,data:Pu({stepId:Q.stepId??null,workflowId:Q.workflowId??null,draftStep:structuredClone(Q),activeTabName:Ul(Q)})})},[m]),D=y.useCallback((Q,M)=>{if(Q===M)return;const N=t.get(),z=[...e.get({noproxy:!0})],E=z[N]?.id,[L]=z.splice(Q,1);if(z.splice(M,0,L),e.set(z),E){const V=z.findIndex(B=>B.id===E);t.set(V)}},[t,e]);return{handleNewTabOpen:p,addNewTab:m,openStepTabFromOperation:g,openStepTabFromXOperation:O,handleTabChange:h,handleTabClose:v,handleCloseAllTabs:b,handleCloseByDataId:x,openCollectionTab:S,openWorkflowTab:$,openWorkflowRunTab:k,openWorkflowRunTabFromHistory:T,openStepTabFromHistory:P,openStepTabFromCollection:A,openStepTab:_,handleTabReorder:D,changeTabState:f}}function x$(t,e,n){const r=wo({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:Sn.Preview,data:Pu({draftStep:r,activeTabName:Ul(r)})}}function rwe(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const iwe=({transform:t})=>({...t,y:0}),swe=({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))},Tc=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,owe=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"})]}),Tb=w.default(owe)`
773
773
  path {
774
774
  fill: ${({color:t})=>Tc(t)};
775
775
  }
@@ -3504,7 +3504,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
3504
3504
  gap: var(--spacing-xs);
3505
3505
  `,CO={[ar.SIMPLE]:{label:"Simple",tooltipContent:"Success criteria conditions in the form of basic literals, operators, and loose comparisons"},[ar.REGEX]:{label:"Regex",tooltipContent:"Regex patterns used as success criteria conditions"},[ar.JSONPATH]:{label:"JSONPath",tooltipContent:"JSONPath expressions as success criteria conditions"},[ar.XPATH]:{label:"XPath",tooltipContent:"XPath expressions as success criteria conditions"}},pDe=Object.keys(CO);function gDe({successCriteria:t}){const{sendEvent:e}=Be(),n=s=>{e("com.redocly.button.click",[{...he("button","addSuccessCriteria"),source:"workflow",action:"add_success_criteria",success_criteria_type:s}]),t.set(o=>[...o||[],{...VL(s)}])},r=y.useMemo(()=>t.filter(s=>s.get()!==void 0),[t]),i=s=>{e("com.redocly.button.click",[{...he("button","removeSuccessCriteria"),source:"workflow",action:"remove_success_criteria",success_criteria_type:s.get().type,condition:s.get().condition}]),s.set(vt)};return d.jsxs(d.Fragment,{children:[d.jsxs(Co,{children:["Success criteria",d.jsx(ni,{content:"List of conditions required to complete the step."})]}),r.map(s=>d.jsx(y.Fragment,{children:d.jsx(cDe,{successCriteria:s,label:CO[s.get().type].label,tooltipContent:CO[s.get().type].tooltipContent,additionalActions:d.jsx(Ti,{"data-testid":"remove-success-criteria-button",variant:"text",icon:d.jsx(jn.TrashCanIcon,{}),onClick:()=>i(s)})})},s.get().id)),d.jsx(mDe,{renderInput:()=>d.jsx(pe.Button,{variant:"outlined",icon:d.jsx(rr.AddIcon,{}),iconPosition:"left",size:"small",children:"Add success criteria"}),dataTestId:"workflow-step-success-criteria-select",options:pDe.map(s=>({element:CO[s].label,label:s,value:s})),onChange:s=>{n(s)},placement:"top",hideCheckmarkIcon:!0})]})}const mDe=w.default(bc.Select)`
3506
3506
  border-radius: var(--border-radius-md);
3507
- `;function ODe({step:t,workflowId:e,collectionId:n}){const{handleIdChange:r}=pl(),i=t.stepId.get();return d.jsx(d.Fragment,{children:d.jsxs(SU,{children:[d.jsx(Co,{children:"Info"}),d.jsxs(Mt,{children:[d.jsxs(Mt.Row,{children:[d.jsx(Mt.Cell,{children:d.jsxs(Kl,{children:["Step ID",d.jsx(ni,{content:"This step's unique identifier"})]})}),d.jsx(Mt.Cell,{$readonly:!0,children:d.jsx(oP,{attribute:t.stepId,editorTitle:"Change step ID",placeholder:"Add step ID",onSave:s=>{n&&e&&r({collectionId:n,workflowId:e,stepId:i},{collectionId:n,workflowId:e,stepId:s})}})})]}),d.jsxs(Mt.Row,{children:[d.jsx(Mt.Cell,{children:d.jsxs(Kl,{children:["Description",d.jsx(ni,{content:"The step's purpose in the workflow."})]})}),d.jsx(Mt.Cell,{children:d.jsx(C$,{state:t.description,placeholder:"Add description"})})]})]}),d.jsxs(Zu,{children:[d.jsx(Co,{children:"Operation"}),d.jsx(sDe,{step:t,collectionId:n})]}),d.jsx(Zu,{children:d.jsx(xU,{outputs:t.outputs,tooltipText:"Data generated in this step that can be used in the next steps."})}),d.jsx(Zu,{children:d.jsx(gDe,{successCriteria:t.successCriteria})})]})})}const vDe=["text","file"];function yDe({onParameterChange:t,files:e}){const n=y.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(hn())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-CSR_qlua.js")),l=await a({multiple:!0});if(!l)return;const u=(Array.isArray(l)?l:[l]).map(Gp),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=y.useCallback(()=>{t(null)},[t]),o=y.useMemo(()=>{if(!e)return null;if(e.length===1)return d.jsx(MD,{icon:d.jsx(ii.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsx(zD,{children:e[0].file.name})});if(e.length>1)return d.jsx(MD,{icon:d.jsx(ii.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsxs(zD,{children:[e.length," files"]})})},[e,s]);return d.jsx(bDe,{children:d.jsxs(xDe,{children:[d.jsx(SDe,{children:o||d.jsx(PDe,{children:"Add files here"})}),d.jsxs(wDe,{children:[d.jsx(CDe,{onClick:i,variant:"secondary",size:"small","data-testid":"add-button",icon:d.jsx(rr.AddIcon,{color:"--button-content-color"})}),d.jsx("input",{"data-testid":"file-input",hidden:!0,ref:n,type:"file",multiple:!0,accept:"files/*",onChange:r})]})]})})}const bDe=w.default.div`
3507
+ `;function ODe({step:t,workflowId:e,collectionId:n}){const{handleIdChange:r}=pl(),i=t.stepId.get();return d.jsx(d.Fragment,{children:d.jsxs(SU,{children:[d.jsx(Co,{children:"Info"}),d.jsxs(Mt,{children:[d.jsxs(Mt.Row,{children:[d.jsx(Mt.Cell,{children:d.jsxs(Kl,{children:["Step ID",d.jsx(ni,{content:"This step's unique identifier"})]})}),d.jsx(Mt.Cell,{$readonly:!0,children:d.jsx(oP,{attribute:t.stepId,editorTitle:"Change step ID",placeholder:"Add step ID",onSave:s=>{n&&e&&r({collectionId:n,workflowId:e,stepId:i},{collectionId:n,workflowId:e,stepId:s})}})})]}),d.jsxs(Mt.Row,{children:[d.jsx(Mt.Cell,{children:d.jsxs(Kl,{children:["Description",d.jsx(ni,{content:"The step's purpose in the workflow."})]})}),d.jsx(Mt.Cell,{children:d.jsx(C$,{state:t.description,placeholder:"Add description"})})]})]}),d.jsxs(Zu,{children:[d.jsx(Co,{children:"Operation"}),d.jsx(sDe,{step:t,collectionId:n})]}),d.jsx(Zu,{children:d.jsx(xU,{outputs:t.outputs,tooltipText:"Data generated in this step that can be used in the next steps."})}),d.jsx(Zu,{children:d.jsx(gDe,{successCriteria:t.successCriteria})})]})})}const vDe=["text","file"];function yDe({onParameterChange:t,files:e}){const n=y.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(hn())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-HHtp5T42.js")),l=await a({multiple:!0});if(!l)return;const u=(Array.isArray(l)?l:[l]).map(Gp),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=y.useCallback(()=>{t(null)},[t]),o=y.useMemo(()=>{if(!e)return null;if(e.length===1)return d.jsx(MD,{icon:d.jsx(ii.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsx(zD,{children:e[0].file.name})});if(e.length>1)return d.jsx(MD,{icon:d.jsx(ii.CloseIcon,{}),variant:"secondary",onClick:s,iconPosition:"right",size:"small",children:d.jsxs(zD,{children:[e.length," files"]})})},[e,s]);return d.jsx(bDe,{children:d.jsxs(xDe,{children:[d.jsx(SDe,{children:o||d.jsx(PDe,{children:"Add files here"})}),d.jsxs(wDe,{children:[d.jsx(CDe,{onClick:i,variant:"secondary",size:"small","data-testid":"add-button",icon:d.jsx(rr.AddIcon,{color:"--button-content-color"})}),d.jsx("input",{"data-testid":"file-input",hidden:!0,ref:n,type:"file",multiple:!0,accept:"files/*",onChange:r})]})]})})}const bDe=w.default.div`
3508
3508
  position: relative;
3509
3509
  display: flex;
3510
3510
  flex-grow: 1;
@@ -3643,7 +3643,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
3643
3643
  `,NDe=w.default.div`
3644
3644
  display: flex;
3645
3645
  justify-content: center;
3646
- `,wU=t=>t==="file"?d.jsx(JB.FileIcon,{size:"14px"}):d.jsx(HB.CharacterIcon,{size:"14px"}),MDe=vDe.map(t=>({label:d.jsxs(kDe,{children:[wU(t),d.jsx(_De,{children:t})]}),value:t}));function VD({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,b=t?"form-data-name-ghost":`form-data-name-${e}`,x=t?"form-data-value-ghost":`form-data-value-${e}`,P=t?"form-data-checkbox-ghost":`form-data-checkbox-${e}`;return d.jsxs(EDe,{children:[d.jsx(ADe,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx(QDe,{"data-testid":P,type:"checkbox",checked:g,onChange:({target:S})=>s(S.checked)}),d.jsx(RDe,{checked:g})]})}),d.jsx(Me,{}),d.jsxs(d.Fragment,{children:[d.jsx($t,{dataTestId:b,placeholder:`${t?"New ":""}${c}`,value:m,environment:l,onChange:r}),u&&d.jsx(NDe,{children:d.jsx(DDe,{options:MDe,value:{label:wU(O),value:O,active:!0},onChange:({value:S})=>o(S),withArrow:!1,size:"small"})})]}),d.jsx(Me,{}),O==="file"?d.jsx(yDe,{files:v,onParameterChange:a}):d.jsx($t,{dataTestId:x,placeholder:"Value",value:p,environment:l,options:f,onChange:i}),d.jsx(Me,{}),d.jsx(jDe,{children:!t&&h(e)})]})}function zDe({title:t,enableInputTypeSelection:e=!1,onParameterChange:n,actions:r,formElements:i,keyName:s,environment:o,createEmptyParameter:a}){const l=ci(),{ghostState:c,ghostValue:u,promoteGhost:f}=dU({elements:i,createEmptyParameter:a,onParameterChange:n}),h={environment:o,keyName:s,enableInputTypeSelection:e,autoCompleteOptions:l,actions:r};return d.jsxs(TDe,{children:[t&&d.jsx($De,{children:t}),d.jsx(IDe,{children:[...i.map((p,m)=>{const g=p.get();return d.jsx(VD,{isLast:!1,index:m,parameter:g,onKeyChange:O=>{p.nested("key").set(O),n?.(p)},onValueChange:O=>{p.nested("value").set(O),n?.(p)},onActiveChange:O=>{p.active.set(O),n?.(p)},onTypeChange:O=>{p.nested("type").set(O),n?.(p)},onFilesChange:O=>{p.nested("files").set(O),n?.(p)},...h},g.id)}),a?d.jsx(VD,{isLast:!0,index:i.length,parameter:u,onKeyChange:p=>f({key:p}),onValueChange:p=>f({value:p}),onActiveChange:p=>c.active.set(p),onTypeChange:p=>c.type.set(p),onFilesChange:p=>f({files:p}),...h},u.id):null]})]})}function VDe({data:t,type:e}){const n=Vt(),r=t[e];function i(s){r[s].set(vt)}return d.jsx(zDe,{keyName:"Param",formElements:r,environment:n,enableInputTypeSelection:e!==Hn["application/x-www-form-urlencoded"],createEmptyParameter:$J,actions:s=>d.jsx(Ti,{onClick:()=>i(s),variant:"text",icon:d.jsx(jn.TrashCanIcon,{})})})}const LDe=({data:t})=>{const e=t.get(),[n,r]=y.useState(!1),i=y.useRef(null),s=l=>{const c=l.target.files?.[0];if(c){r(!0);const u=new FileReader;u.onload=()=>{r(!1),t.set({absolutePath:null,file:c})},u.readAsDataURL(c)}},o=async()=>{if(hn())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-CSR_qlua.js")),c=await l();if(!c)return;const u=await Gp(c);t.set(u)}catch(l){console.error("Failed to open file dialog or read file:",l)}else i.current?.click()},a=()=>{t.set(null)};return n?d.jsxs(XDe,{children:[d.jsx(fy.SpinnerIcon,{}),"Loading..."]}):e&&e.file?.name?d.jsxs(WDe,{children:[d.jsxs(ZDe,{children:[d.jsx(e8.DocumentBlankIcon,{size:"16px"}),d.jsx(qDe,{children:e.file?.name})]}),d.jsx(Ti,{onClick:a,icon:d.jsx(jn.TrashCanIcon,{})})]}):d.jsx(CU,{children:!e&&d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"file",hidden:!0,ref:i,onChange:s}),d.jsx(pe.Button,{type:"button",variant:"text",onClick:o,icon:d.jsx(KB.CloudUploadIcon,{}),children:"Upload file"})]})})},CU=w.default.div`
3646
+ `,wU=t=>t==="file"?d.jsx(JB.FileIcon,{size:"14px"}):d.jsx(HB.CharacterIcon,{size:"14px"}),MDe=vDe.map(t=>({label:d.jsxs(kDe,{children:[wU(t),d.jsx(_De,{children:t})]}),value:t}));function VD({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,b=t?"form-data-name-ghost":`form-data-name-${e}`,x=t?"form-data-value-ghost":`form-data-value-${e}`,P=t?"form-data-checkbox-ghost":`form-data-checkbox-${e}`;return d.jsxs(EDe,{children:[d.jsx(ADe,{children:!t&&d.jsxs(d.Fragment,{children:[d.jsx(QDe,{"data-testid":P,type:"checkbox",checked:g,onChange:({target:S})=>s(S.checked)}),d.jsx(RDe,{checked:g})]})}),d.jsx(Me,{}),d.jsxs(d.Fragment,{children:[d.jsx($t,{dataTestId:b,placeholder:`${t?"New ":""}${c}`,value:m,environment:l,onChange:r}),u&&d.jsx(NDe,{children:d.jsx(DDe,{options:MDe,value:{label:wU(O),value:O,active:!0},onChange:({value:S})=>o(S),withArrow:!1,size:"small"})})]}),d.jsx(Me,{}),O==="file"?d.jsx(yDe,{files:v,onParameterChange:a}):d.jsx($t,{dataTestId:x,placeholder:"Value",value:p,environment:l,options:f,onChange:i}),d.jsx(Me,{}),d.jsx(jDe,{children:!t&&h(e)})]})}function zDe({title:t,enableInputTypeSelection:e=!1,onParameterChange:n,actions:r,formElements:i,keyName:s,environment:o,createEmptyParameter:a}){const l=ci(),{ghostState:c,ghostValue:u,promoteGhost:f}=dU({elements:i,createEmptyParameter:a,onParameterChange:n}),h={environment:o,keyName:s,enableInputTypeSelection:e,autoCompleteOptions:l,actions:r};return d.jsxs(TDe,{children:[t&&d.jsx($De,{children:t}),d.jsx(IDe,{children:[...i.map((p,m)=>{const g=p.get();return d.jsx(VD,{isLast:!1,index:m,parameter:g,onKeyChange:O=>{p.nested("key").set(O),n?.(p)},onValueChange:O=>{p.nested("value").set(O),n?.(p)},onActiveChange:O=>{p.active.set(O),n?.(p)},onTypeChange:O=>{p.nested("type").set(O),n?.(p)},onFilesChange:O=>{p.nested("files").set(O),n?.(p)},...h},g.id)}),a?d.jsx(VD,{isLast:!0,index:i.length,parameter:u,onKeyChange:p=>f({key:p}),onValueChange:p=>f({value:p}),onActiveChange:p=>c.active.set(p),onTypeChange:p=>c.type.set(p),onFilesChange:p=>f({files:p}),...h},u.id):null]})]})}function VDe({data:t,type:e}){const n=Vt(),r=t[e];function i(s){r[s].set(vt)}return d.jsx(zDe,{keyName:"Param",formElements:r,environment:n,enableInputTypeSelection:e!==Hn["application/x-www-form-urlencoded"],createEmptyParameter:$J,actions:s=>d.jsx(Ti,{onClick:()=>i(s),variant:"text",icon:d.jsx(jn.TrashCanIcon,{})})})}const LDe=({data:t})=>{const e=t.get(),[n,r]=y.useState(!1),i=y.useRef(null),s=l=>{const c=l.target.files?.[0];if(c){r(!0);const u=new FileReader;u.onload=()=>{r(!1),t.set({absolutePath:null,file:c})},u.readAsDataURL(c)}},o=async()=>{if(hn())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-HHtp5T42.js")),c=await l();if(!c)return;const u=await Gp(c);t.set(u)}catch(l){console.error("Failed to open file dialog or read file:",l)}else i.current?.click()},a=()=>{t.set(null)};return n?d.jsxs(XDe,{children:[d.jsx(fy.SpinnerIcon,{}),"Loading..."]}):e&&e.file?.name?d.jsxs(WDe,{children:[d.jsxs(ZDe,{children:[d.jsx(e8.DocumentBlankIcon,{size:"16px"}),d.jsx(qDe,{children:e.file?.name})]}),d.jsx(Ti,{onClick:a,icon:d.jsx(jn.TrashCanIcon,{})})]}):d.jsx(CU,{children:!e&&d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"file",hidden:!0,ref:i,onChange:s}),d.jsx(pe.Button,{type:"button",variant:"text",onClick:o,icon:d.jsx(KB.CloudUploadIcon,{}),children:"Upload file"})]})})},CU=w.default.div`
3647
3647
  display: flex;
3648
3648
  align-items: center;
3649
3649
  justify-content: flex-start;
@@ -6010,7 +6010,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
6010
6010
  display: inline-block;
6011
6011
  color: var(--text-color-secondary);
6012
6012
  margin-left: var(--spacing-xs);
6013
- `,RLe="request",jLe=new Set(["replay:","redocly-replay:"]),_Le=8*1024,DLe=4*1024,gP=1024,NLe=new Set([Cn.JSON,Cn.XML,Cn.HTML,Cn.Text]);function mP(t){return JT(t).length>0}function MLe(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function mB(t,e){return!t||t.length>gP||e.length>gP||mP(e)}function Y1(t,e,n){const r=[];for(const[i,s]of t){if(!i.startsWith(e))continue;const o=i.slice(e.length);if(mB(o,s))return null;r.push(MLe(n,o,s))}return r}function zLe(t){if(t.length>_Le)return null;let e;try{e=new URL(t)}catch{return null}if(!jLe.has(e.protocol)||e.hostname.toLowerCase()!==RLe)return null;const n=e.searchParams,r=n.get("url");if(!r||mP(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(!Vd.includes(s))return null;const o=Y1(n,"header.","header"),a=Y1(n,"query.","query"),l=Y1(n,"cookie.","cookie");if(!o||!a||!l)return null;const c=Dp(r);if(c.some(p=>mB(p.key,p.value)))return null;const u=n.get("body");if(u!==null&&(u.length>DLe||mP(u)))return null;const f=n.get("contentType")?.trim();if(f&&!NLe.has(f))return null;const h=n.get("env")?.trim();return h&&h.length>gP?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 VLe(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function LLe({onEnvironmentNotFound:t}={}){const{tabs:e,activeTabIdx:n}=pl(),{addNewTab:r}=Nn(),{environments:i,activeEnvironmentId:s}=nt();return y.useCallback(o=>{const l=e.get().findIndex(({data:h})=>bn(h,Le.Step)&&VLe(h)&&ZC(h,o.xOperation));let c;if(l!==-1)c=l,n.set(c);else{const h=wo({xOperation:o.xOperation});c=r({id:crypto.randomUUID(),state:Sn.Normal,data:Pu({draftStep:h,activeTabName:Ul(h)})})}const u=e[c]?.data;u&&(u.response.set(null),u.requestError.set(null),u.isProcessingRequest.set(!1));const f=u?.draftStep.ornull;f&&(f.parameters.headers.set(o.headers),f.parameters.queryParameters.set(o.queryParameters),f.parameters.cookies.set(o.cookies),f.requestBody.set(Kh()),o.body&&f.requestBody.merge({content:o.body.content,...o.body.type&&{type:o.body.type}})),o.environment&&(i.get().some(p=>p.name===o.environment)?s.set(o.environment):t?.(o.environment))},[e,n,r,i,s,t])}const XLe="com.redocly.deepLink.opened";let IN=!1;function WLe(){const{warning:t}=iM.useToast(),e=Be(),n=LLe({onEnvironmentNotFound:i=>t(`Environment "${i}" not found`)}),r=y.useRef(n);r.current=n,y.useEffect(()=>{let i,s=!1;const o=a=>{const l=a[0]&&zLe(a[0]);l&&(r.current(l),e.sendEvent(XLe,[{...he("deepLink","request"),scheme:a[0].startsWith("redocly-replay:")?"redocly-replay":"replay"}]))};return(async()=>{const{onOpenUrl:a,getCurrent:l}=await Promise.resolve().then(()=>require("./replay-index-3lwhSmvi.js")),c=await a(o);if(s){c();return}if(i=c,!IN){const u=await l();if(s)return;IN=!0,u?.[0]&&o(u)}})(),()=>{s=!0,i?.()}},[])}function ZLe(t){const e=t||"default";return{id:xh(vy(e)),systemFilesDir:oS.join("/replay",e),userFilesDir:oS.join("/projects",e)}}async function qLe(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=xh(vy(t)),n=await ULe(),r=await iT(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function ULe(){if(!$C)return aC();try{return await YL()}catch{return aC()}}function OP(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 BLe=[{suffix:st.SecurityVariablesEnvSuffix.Token,getValue:t=>t.token&&Object.prototype.hasOwnProperty.call(t.token,"access_token")?t.token.access_token:void 0},{suffix:st.SecurityVariablesEnvSuffix.Username,getValue:t=>t.username},{suffix:st.SecurityVariablesEnvSuffix.Password,getValue:t=>t.password},{suffix:st.SecurityVariablesEnvSuffix.ClientId,getValue:t=>t.client_id},{suffix:st.SecurityVariablesEnvSuffix.ClientSecret,getValue:t=>t.client_secret}];function OB(t,e){const n=[];for(const r of t?.flat()||[]){const i=e[r.id]??e.default;if(!i)continue;const s=r.id;for(const o of BLe){const a=o.getValue(i);KP(a)&&n.push({name:s+o.suffix,value:a})}}return n}function FLe(t){const e=new Set,n=Object.values(st.SecurityVariablesEnvSuffix);for(const r of t.security?.flat()||[])if(r.id)for(const i of n)e.add(r.id+i);return e}function YLe(t,e){const n=new Set,r=FLe(t),i=s=>{if(s.security)for(const{name:o}of OB(t.security,s.security))n.add(o);for(const[o,a]of Object.entries(s.envVariables||{}))KP(a)&&r.has(o)&&n.add(o)};if(oy.isDirectConfigureRequestValues(e))return i(e),n;for(const s of Object.values(e))s&&i(s);return n}function GLe(t,e){const n=e.query??{},r=[],i=(s,o)=>{typeof o=="string"&&r.push({name:s,value:o})};for(const s of t.parameters){if(s.in!=="querystring")continue;const o=O4(s),a=new Set(o.map(l=>l.name));for(const l of a)i(l,n[l]);for(const[l,c]of Object.entries(n))for(const u of a)if(l.startsWith(`${u}[`)){i(l,c);break}}return r}function HLe(t,e,n){const r=RJ(t,n);if(!r)return[];const i=new Map,s=(o,a,l=!1)=>{i.set(o,{name:o,value:a,isSecret:l})};for(const[o,a]of Object.entries(r.envVariables||{}))s(o,a);for(const{name:o,value:a}of GLe(e,r))s(o,a);for(const o of e.parameters){const a=y4[o.in];if(!a)continue;const l=r[a]?.[o.name];KP(l)&&s(o.name,String(l))}if(r.security)for(const{name:o,value:a}of OB(e.security,r.security))s(o,a,!0);return Array.from(i.values())}function JLe(t,e){return t.find(n=>n.name===e)}function KLe(t,e,n){const r=Object.entries(e.variables??{}).map(([i,s])=>{const o=n?.variables.find(a=>a.name===i)?.value;return{name:i,value:o??s.default??""}});return{apiId:t,value:n?.value||e.url,specUrl:e.url,variables:r}}function eXe(t,e,n,r,i){const{servers:s,parameters:o}=e,a=o.filter(h=>h.in==="path"),l=tXe(e),c=new Set,u=a.map(h=>{const p=h.example?String(h.example):"";return c.add(h.name),{name:h.name,value:p,isSecret:!1}}),f=h=>l.map(p=>{const m=e.security?.flat().find(O=>{const v=O.id;return p.name.startsWith(v)});let g="";if(m){const O=m.serverValues?.[h];O&&(O["x-defaultUsername"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.Username)?g=O["x-defaultUsername"]:O["x-defaultPassword"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.Password)?g=O["x-defaultPassword"]:O["x-defaultClientId"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.ClientId)?g=O["x-defaultClientId"]:O["x-defaultClientSecret"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.ClientSecret)?g=O["x-defaultClientSecret"]:O["x-defaultAccessToken"]&&(g=O["x-defaultAccessToken"])),g||(m["x-defaultUsername"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.Username)?g=m["x-defaultUsername"]:m["x-defaultPassword"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.Password)?g=m["x-defaultPassword"]:m["x-defaultClientId"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.ClientId)?g=m["x-defaultClientId"]:m["x-defaultClientSecret"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.ClientSecret)?g=m["x-defaultClientSecret"]:m["x-defaultAccessToken"]&&(g=m["x-defaultAccessToken"]))}return c.add(p.name),{name:p.name,value:p.value||g||"",isSecret:p.isSecret}});return{generatedInputs:c,environments:iXe(s).map(h=>{const p=h.name||h.description||h.url,m=JLe(n,p),g=m?.servers.find(k=>k.apiId===t),O=KLe(t,h,g),v=f(h.url),b=HLe(i,e,h.url),x=b.map(k=>k.name),P=m?.inputs.filter(k=>k.value&&!x.includes(k.name))||[];for(const k of b)c.add(k.name);const S=rXe(nXe(P,u,v,b),r?.[p]);return{name:p,inputs:S,servers:[O],state:jt.Normal}})}}function tXe(t){const e=[];return(t.security?.flat()||[]).forEach(r=>{const i=Gy(r),s=r.id;(i===te.BasicAuth||i===te.DigestAuth)&&(e.push(Os(s+st.SecurityVariablesEnvSuffix.Username,!1)),e.push(Os(s+st.SecurityVariablesEnvSuffix.Password))),i===te.JWT&&e.push(Os(s+st.SecurityVariablesEnvSuffix.JWTToken)),i===te.APIKey&&e.push(Os(s+st.SecurityVariablesEnvSuffix.APIKey)),i===te.OAuth2&&(e.push(Os(s+st.SecurityVariablesEnvSuffix.Token)),rT(r).forEach(a=>{e.push(Os(s+st.SecurityVariablesEnvSuffix.ClientId)),[ee.Implicit,ee.ClientCredentialsWithJwtAssertion].includes(a)||e.push(Os(s+st.SecurityVariablesEnvSuffix.ClientSecret)),a===ee.ClientCredentialsWithJwtAssertion&&e.push(Os(s+st.SecurityVariablesEnvSuffix.ClientAssertion))})),i===te.OpenIDConnect&&(e.push(Os(s+st.SecurityVariablesEnvSuffix.Token)),e.push(Os(s+st.SecurityVariablesEnvSuffix.ClientId)),e.push(Os(s+st.SecurityVariablesEnvSuffix.ClientSecret)))}),e}function Os(t,e=!0){return{name:t,value:"",isSecret:e}}function nXe(...t){const e=new Map;for(const n of t)for(const r of n){const i=e.get(r.name);e.set(r.name,{name:r.name,value:r.value||i?.value||"",isSecret:r.isSecret||i?.isSecret||!1})}return Array.from(e.values())}function vP(t){return typeof t=="string"?{value:t}:t}function rXe(t,e){if(!e)return t;const n=new Set(t.map(s=>s.name)),r=t.map(s=>{const o=e[s.name];if(o===void 0)return s;const{value:a,isSecret:l}=vP(o);return{...s,value:a,...l!==void 0&&{isSecret:l}}}),i=Object.entries(e).filter(([s])=>!n.has(s)).map(([s,o])=>{const{value:a,isSecret:l}=vP(o);return{name:s,value:a,isSecret:l??!1}});return[...r,...i]}function iXe(t){const n=t4(xd.IS_BROWSER?window.location.href:globalThis.SSR_HOSTNAME||"");t.length===0&&(t=[{url:"/"}]);function r(i){return rJ(n,i)}return t.map(i=>({...i,url:r(i.url),description:i.description||""}))}function Im(t,e){if(e.size===0)return;const n=t.get({noproxy:!0});for(let r=0;r<n.length;r++){const i=n[r];!Tp(i)||!i.key||!e.has(i.key)||t[r].merge({value:`$inputs.${i.key}`,active:!0})}}function vB(t,e,n){if(typeof e=="string"){const i=es(e);i&&n.has(i)&&t.set(e);return}if(!e||typeof e!="object"||Array.isArray(e))return;const r=t;for(const[i,s]of Object.entries(e)){const o=r[i];o&&vB(o,s,n)}}function sXe(t,e,n){if(n.size===0)return;const r=t.get({noproxy:!0});for(const i of e){if(!i.securitySchemeId)continue;const s=r.findIndex(o=>o.securitySchemeId===i.securitySchemeId);s!==-1&&vB(t[s],i,n)}}function oXe(t,e,n){const r=eT(e.parameters,"in");Im(t.parameters.pathParameters,Tu(r.path,"path",n)),Im(t.parameters.queryParameters,b4(r.query,r.querystring,n)),Im(t.parameters.headers,Tu(r.header,"header",n)),Im(t.parameters.cookies,Tu(r.cookie,"cookie",n)),sXe(t.security,Yy(e),YLe(e,n))}function EN(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=aXe(t,e,n);return{operations:r}}function aXe(t,e,n){const r=[];for(const[i,s]of Object.entries(t.paths)){for(const[o,a]of Object.entries(s))o!=="parameters"&&o!=="servers"&&o!=="description"&&o!=="summary"&&o!=="additionalOperations"&&(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(c=>{const{operation:u}=AN(i,o,t,c,e,!1,n);u&&r.push(u)});if(s.additionalOperations)for(const[o,a]of Object.entries(s.additionalOperations))(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(c=>{const{operation:u}=AN(i,o,t,c,e,!0,n);u&&r.push(u)})}return{operations:r}}function AN(t,e,n,r,i,s,o){if(!o)return{operation:null};const a=o(t,e,n);if(!a)return{operation:null};const l=`${n.info.title}/${r}/${a.name}`;return{operation:Iue(a,s,i,l)}}const QN=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:s}=dX({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===s}return!1});class lXe{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 yP{static instance=null;static async initialize(e,n){this.close(),this.instance=await cXe(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function cXe(t,e){if(e){const{AiChatSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-AiChatSqliteDBStorage-GZibdHOQ.js")),r=up.getInstance(),i=new n(r);return new lXe(i)}else throw new Error("Not implemented")}const ou="ai-chat",G1="detail",uXe="title",RN="infinite-history",yB={all:()=>[ou],details:()=>[ou,G1],detail:t=>[ou,G1,t],detailTitle:t=>[ou,G1,t,uXe],infiniteHistories:()=>[ou,RN],infiniteHistory:t=>[ou,RN,t]},wI=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:s})=>{const o=y.useContext(TT),a=Be(),l=Lr.useQueryClient(),c=y.useMemo(async()=>{const f=hn()?await qLe(e.storageKey):ZLe(e.storageKey);e.layout!=="preview"&&hn()&&np.initialize();const{isInitialized:h}=await o.init(f,e,a);if(e.layout!=="preview"){if(hn()){const P=`${f.systemFilesDir}/replay.db`;await up.initialize(P),await yP.initialize(f,hn())}await Fa.initialize(f,hn()),await Hl.initialize(hn());try{await Hl.getInstance()?.pruneOlderThan(Date.now()-w0e)}catch(P){console.error("Failed to prune step context:",P)}try{const P=await XSe.migrate(f,Fa.getInstance(),hn());P.migrated&&a.sendEvent("com.redocly.history.migration",[{...he("migration","historyMigration","storage"),status:"success",itemCount:P.itemCount}])}catch(P){console.error("History migration failed:",P),a.sendEvent("com.redocly.history.migration",[{...he("migration","historyMigration","storage"),status:"error",error:P instanceof Error?P.message:"Unknown error"}])}}if(!h)return;if(!n){o.environments.length===0&&o.environments.set(C3);return}const p=OP(n,[]),{operations:m}=EN(n,p,e.convertOperationToReplayValue);if(!m?.length||!m[0].collectionPath?.split("/")?.[0]||(o.apis.set([{id:p,srcType:ri.FS,...n}]),o.predefinedApiId.set(p),!r&&!i))return;const O=QN(m,r,i),{path:v,method:b}=O?.apiPath||{};if(!O||!v||!b)return;const x=e.convertOperationToReplayValue?.(v,b,n);x&&jN(o,p,x,e),hXe(o,{apiId:p,path:v,method:b,operationId:O.operationId,isAdditionalOperation:O.isAdditionalOperation},x,e.dynamicReplayValues)},[e.storageKey]);y.useEffect(()=>{if(e.layout!=="preview")return l.invalidateQueries({queryKey:kr.all}),l.invalidateQueries({queryKey:yB.all()}),l.invalidateQueries({queryKey:ng.all}),()=>{Fa.close(),yP.close(),np.close(),Hl.close(),hn()&&up.close().catch(f=>{console.error("Failed to close SqliteDBConnection:",f)})}},[e.storageKey,e.layout,l]),y.useEffect(()=>{if(!n||!e.convertOperationToReplayValue)return;const f=OP(n,[]),{operations:h}=EN(n,f,e.convertOperationToReplayValue);if(!h?.length)return;const p=QN(h,r,i),{path:m,method:g}=p?.apiPath||{};if(!p||!m||!g)return;const O=e.convertOperationToReplayValue(m,g,n);O&&jN(o,f,O,e)},[e.convertOperationToReplayValue,e.predefinedEnvValues,e.dynamicReplayValues,e.allowedEnvironments,e.selectedEnvironment,n,r,i]);const u=e.layout==="preview"?null:d.jsx(ELe,{projectPath:e.storageKey});return d.jsx(y.Suspense,{fallback:u,children:d.jsx(dXe,{initStore:c,settings:e,api:n,onLoad:s,children:t})})};function dXe({initStore:t,children:e,settings:n,api:r,onLoad:i}){return y.use(t),Ube(n,r),y.useEffect(()=>{i?.()},[]),d.jsxs(U.default.Fragment,{children:[hn()&&d.jsx(fXe,{}),e]},n.storageKey)}function fXe(){return WLe(),null}const jN=(t,e,n,r)=>{const i=t.environments.get({noproxy:!0}),{environments:s,generatedInputs:o}=eXe(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues);t.predefinedInputNames.set(o);let a,l,c;if(r.allowedEnvironments?.length){const u=s.filter(f=>r.allowedEnvironments?.includes(f.name));a=new Set(u.map(f=>f.name)),l=u,c=l.find(f=>f.name===r.selectedEnvironment)?.name||l[0]?.name||""}else{a=new Set(s.map(f=>f.name)),l=[...s,...i.filter(f=>!a.has(f.name))];const u=t.activeEnvironmentId.get();c=l.find(f=>f.name===u)?.name||l.find(f=>f.name===r.selectedEnvironment)?.name||l[0]?.name||""}t.predefinedEnvironmentNames.set(a),CS(l,t.environments.get({noproxy:!0}))||t.environments.set(l),t.activeEnvironmentId.set(c)},hXe=(t,e,n,r)=>{const i=t.tabsState.tabs.get().findIndex(({data:s})=>bn(s,Le.Step)&&s.draftStep?.operation?.apiId===e.apiId&&s.draftStep?.operation?.path===e.path&&s.draftStep?.operation?.method===e.method);if(i!==-1){const s=t.tabsState.tabs[i],o=s.data.get();if(n&&r&&bn(o,Le.Step)){const l=s.data.draftStep.ornull;l&&oXe(l,n,r)}t.tabsState.activeTabIdx.set(i)}else{const s=x$(e,n,r);t.tabsState.tabs.merge([{...s,state:Sn.Normal}]),t.tabsState.activeTabIdx.set(t.tabsState.tabs.length-1)}};function pXe(t){const e=y.useMemo(()=>OM(s7({defaultEnvironments:[]}),vM(i7(!0))),[]);return d.jsx(Lr.QueryClientProvider,{client:ab(),children:d.jsx(xhe,{value:e,children:d.jsx(gb.Provider,{value:t.settings,children:d.jsx(wI,{...t,children:d.jsx(lB,{onError:n=>console.error(n),children:d.jsx(gXe,{...t})})})})})})}function gXe(t){return t.settings.disableDraft=!0,d.jsx(y.StrictMode,{children:d.jsxs(mXe,{children:[d.jsx(OXe,{children:d.jsx(SI,{})}),d.jsx(vh,{hideTabs:!0})]})})}const mXe=w.default.div`
6013
+ `,RLe="request",jLe=new Set(["replay:","redocly-replay:"]),_Le=8*1024,DLe=4*1024,gP=1024,NLe=new Set([Cn.JSON,Cn.XML,Cn.HTML,Cn.Text]);function mP(t){return JT(t).length>0}function MLe(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function mB(t,e){return!t||t.length>gP||e.length>gP||mP(e)}function Y1(t,e,n){const r=[];for(const[i,s]of t){if(!i.startsWith(e))continue;const o=i.slice(e.length);if(mB(o,s))return null;r.push(MLe(n,o,s))}return r}function zLe(t){if(t.length>_Le)return null;let e;try{e=new URL(t)}catch{return null}if(!jLe.has(e.protocol)||e.hostname.toLowerCase()!==RLe)return null;const n=e.searchParams,r=n.get("url");if(!r||mP(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(!Vd.includes(s))return null;const o=Y1(n,"header.","header"),a=Y1(n,"query.","query"),l=Y1(n,"cookie.","cookie");if(!o||!a||!l)return null;const c=Dp(r);if(c.some(p=>mB(p.key,p.value)))return null;const u=n.get("body");if(u!==null&&(u.length>DLe||mP(u)))return null;const f=n.get("contentType")?.trim();if(f&&!NLe.has(f))return null;const h=n.get("env")?.trim();return h&&h.length>gP?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 VLe(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function LLe({onEnvironmentNotFound:t}={}){const{tabs:e,activeTabIdx:n}=pl(),{addNewTab:r}=Nn(),{environments:i,activeEnvironmentId:s}=nt();return y.useCallback(o=>{const l=e.get().findIndex(({data:h})=>bn(h,Le.Step)&&VLe(h)&&ZC(h,o.xOperation));let c;if(l!==-1)c=l,n.set(c);else{const h=wo({xOperation:o.xOperation});c=r({id:crypto.randomUUID(),state:Sn.Normal,data:Pu({draftStep:h,activeTabName:Ul(h)})})}const u=e[c]?.data;u&&(u.response.set(null),u.requestError.set(null),u.isProcessingRequest.set(!1));const f=u?.draftStep.ornull;f&&(f.parameters.headers.set(o.headers),f.parameters.queryParameters.set(o.queryParameters),f.parameters.cookies.set(o.cookies),f.requestBody.set(Kh()),o.body&&f.requestBody.merge({content:o.body.content,...o.body.type&&{type:o.body.type}})),o.environment&&(i.get().some(p=>p.name===o.environment)?s.set(o.environment):t?.(o.environment))},[e,n,r,i,s,t])}const XLe="com.redocly.deepLink.opened";let IN=!1;function WLe(){const{warning:t}=iM.useToast(),e=Be(),n=LLe({onEnvironmentNotFound:i=>t(`Environment "${i}" not found`)}),r=y.useRef(n);r.current=n,y.useEffect(()=>{let i,s=!1;const o=a=>{const l=a[0]&&zLe(a[0]);l&&(r.current(l),e.sendEvent(XLe,[{...he("deepLink","request"),scheme:a[0].startsWith("redocly-replay:")?"redocly-replay":"replay"}]))};return(async()=>{const{onOpenUrl:a,getCurrent:l}=await Promise.resolve().then(()=>require("./replay-index-3lwhSmvi.js")),c=await a(o);if(s){c();return}if(i=c,!IN){const u=await l();if(s)return;IN=!0,u?.[0]&&o(u)}})(),()=>{s=!0,i?.()}},[])}function ZLe(t){const e=t||"default";return{id:xh(vy(e)),systemFilesDir:oS.join("/replay",e),userFilesDir:oS.join("/projects",e)}}async function qLe(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=xh(vy(t)),n=await ULe(),r=await iT(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function ULe(){if(!$C)return aC();try{return await YL()}catch{return aC()}}function OP(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 BLe=[{suffix:st.SecurityVariablesEnvSuffix.Token,getValue:t=>t.token&&Object.prototype.hasOwnProperty.call(t.token,"access_token")?t.token.access_token:void 0},{suffix:st.SecurityVariablesEnvSuffix.Username,getValue:t=>t.username},{suffix:st.SecurityVariablesEnvSuffix.Password,getValue:t=>t.password},{suffix:st.SecurityVariablesEnvSuffix.ClientId,getValue:t=>t.client_id},{suffix:st.SecurityVariablesEnvSuffix.ClientSecret,getValue:t=>t.client_secret}];function OB(t,e){const n=[];for(const r of t?.flat()||[]){const i=e[r.id]??e.default;if(!i)continue;const s=r.id;for(const o of BLe){const a=o.getValue(i);KP(a)&&n.push({name:s+o.suffix,value:a})}}return n}function FLe(t){const e=new Set,n=Object.values(st.SecurityVariablesEnvSuffix);for(const r of t.security?.flat()||[])if(r.id)for(const i of n)e.add(r.id+i);return e}function YLe(t,e){const n=new Set,r=FLe(t),i=s=>{if(s.security)for(const{name:o}of OB(t.security,s.security))n.add(o);for(const[o,a]of Object.entries(s.envVariables||{}))KP(a)&&r.has(o)&&n.add(o)};if(oy.isDirectConfigureRequestValues(e))return i(e),n;for(const s of Object.values(e))s&&i(s);return n}function GLe(t,e){const n=e.query??{},r=[],i=(s,o)=>{typeof o=="string"&&r.push({name:s,value:o})};for(const s of t.parameters){if(s.in!=="querystring")continue;const o=O4(s),a=new Set(o.map(l=>l.name));for(const l of a)i(l,n[l]);for(const[l,c]of Object.entries(n))for(const u of a)if(l.startsWith(`${u}[`)){i(l,c);break}}return r}function HLe(t,e,n){const r=RJ(t,n);if(!r)return[];const i=new Map,s=(o,a,l=!1)=>{i.set(o,{name:o,value:a,isSecret:l})};for(const[o,a]of Object.entries(r.envVariables||{}))s(o,a);for(const{name:o,value:a}of GLe(e,r))s(o,a);for(const o of e.parameters){const a=y4[o.in];if(!a)continue;const l=r[a]?.[o.name];KP(l)&&s(o.name,String(l))}if(r.security)for(const{name:o,value:a}of OB(e.security,r.security))s(o,a,!0);return Array.from(i.values())}function JLe(t,e){return t.find(n=>n.name===e)}function KLe(t,e,n){const r=Object.entries(e.variables??{}).map(([i,s])=>{const o=n?.variables.find(a=>a.name===i)?.value;return{name:i,value:o??s.default??""}});return{apiId:t,value:n?.value||e.url,specUrl:e.url,variables:r}}function eXe(t,e,n,r,i){const{servers:s,parameters:o}=e,a=o.filter(h=>h.in==="path"),l=tXe(e),c=new Set,u=a.map(h=>{const p=h.example?String(h.example):"";return c.add(h.name),{name:h.name,value:p,isSecret:!1}}),f=h=>l.map(p=>{const m=e.security?.flat().find(O=>{const v=O.id;return p.name.startsWith(v)});let g="";if(m){const O=m.serverValues?.[h];O&&(O["x-defaultUsername"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.Username)?g=O["x-defaultUsername"]:O["x-defaultPassword"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.Password)?g=O["x-defaultPassword"]:O["x-defaultClientId"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.ClientId)?g=O["x-defaultClientId"]:O["x-defaultClientSecret"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.ClientSecret)?g=O["x-defaultClientSecret"]:O["x-defaultAccessToken"]&&(g=O["x-defaultAccessToken"])),g||(m["x-defaultUsername"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.Username)?g=m["x-defaultUsername"]:m["x-defaultPassword"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.Password)?g=m["x-defaultPassword"]:m["x-defaultClientId"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.ClientId)?g=m["x-defaultClientId"]:m["x-defaultClientSecret"]&&p.name.endsWith(st.SecurityVariablesEnvSuffix.ClientSecret)?g=m["x-defaultClientSecret"]:m["x-defaultAccessToken"]&&(g=m["x-defaultAccessToken"]))}return c.add(p.name),{name:p.name,value:p.value||g||"",isSecret:p.isSecret}});return{generatedInputs:c,environments:iXe(s).map(h=>{const p=h.name||h.description||h.url,m=JLe(n,p),g=m?.servers.find(k=>k.apiId===t),O=KLe(t,h,g),v=f(h.url),b=HLe(i,e,h.url),x=b.map(k=>k.name),P=m?.inputs.filter(k=>k.value&&!x.includes(k.name))||[];for(const k of b)c.add(k.name);const S=rXe(nXe(P,u,v,b),r?.[p]);return{name:p,inputs:S,servers:[O],state:jt.Normal}})}}function tXe(t){const e=[];return(t.security?.flat()||[]).forEach(r=>{const i=Gy(r),s=r.id;(i===te.BasicAuth||i===te.DigestAuth)&&(e.push(Os(s+st.SecurityVariablesEnvSuffix.Username,!1)),e.push(Os(s+st.SecurityVariablesEnvSuffix.Password))),i===te.JWT&&e.push(Os(s+st.SecurityVariablesEnvSuffix.JWTToken)),i===te.APIKey&&e.push(Os(s+st.SecurityVariablesEnvSuffix.APIKey)),i===te.OAuth2&&(e.push(Os(s+st.SecurityVariablesEnvSuffix.Token)),rT(r).forEach(a=>{e.push(Os(s+st.SecurityVariablesEnvSuffix.ClientId)),[ee.Implicit,ee.ClientCredentialsWithJwtAssertion].includes(a)||e.push(Os(s+st.SecurityVariablesEnvSuffix.ClientSecret)),a===ee.ClientCredentialsWithJwtAssertion&&e.push(Os(s+st.SecurityVariablesEnvSuffix.ClientAssertion))})),i===te.OpenIDConnect&&(e.push(Os(s+st.SecurityVariablesEnvSuffix.Token)),e.push(Os(s+st.SecurityVariablesEnvSuffix.ClientId)),e.push(Os(s+st.SecurityVariablesEnvSuffix.ClientSecret)))}),e}function Os(t,e=!0){return{name:t,value:"",isSecret:e}}function nXe(...t){const e=new Map;for(const n of t)for(const r of n){const i=e.get(r.name);e.set(r.name,{name:r.name,value:r.value||i?.value||"",isSecret:r.isSecret||i?.isSecret||!1})}return Array.from(e.values())}function vP(t){return typeof t=="string"?{value:t}:t}function rXe(t,e){if(!e)return t;const n=new Set(t.map(s=>s.name)),r=t.map(s=>{const o=e[s.name];if(o===void 0)return s;const{value:a,isSecret:l}=vP(o);return{...s,value:a,...l!==void 0&&{isSecret:l}}}),i=Object.entries(e).filter(([s])=>!n.has(s)).map(([s,o])=>{const{value:a,isSecret:l}=vP(o);return{name:s,value:a,isSecret:l??!1}});return[...r,...i]}function iXe(t){const n=t4(xd.IS_BROWSER?window.location.href:globalThis.SSR_HOSTNAME||"");t.length===0&&(t=[{url:"/"}]);function r(i){return rJ(n,i)}return t.map(i=>({...i,url:r(i.url),description:i.description||""}))}function Im(t,e){if(e.size===0)return;const n=t.get({noproxy:!0});for(let r=0;r<n.length;r++){const i=n[r];!Tp(i)||!i.key||!e.has(i.key)||t[r].merge({value:`$inputs.${i.key}`,active:!0})}}function vB(t,e,n){if(typeof e=="string"){const i=es(e);i&&n.has(i)&&t.set(e);return}if(!e||typeof e!="object"||Array.isArray(e))return;const r=t;for(const[i,s]of Object.entries(e)){const o=r[i];o&&vB(o,s,n)}}function sXe(t,e,n){if(n.size===0)return;const r=t.get({noproxy:!0});for(const i of e){if(!i.securitySchemeId)continue;const s=r.findIndex(o=>o.securitySchemeId===i.securitySchemeId);s!==-1&&vB(t[s],i,n)}}function oXe(t,e,n){const r=eT(e.parameters,"in");Im(t.parameters.pathParameters,Tu(r.path,"path",n)),Im(t.parameters.queryParameters,b4(r.query,r.querystring,n)),Im(t.parameters.headers,Tu(r.header,"header",n)),Im(t.parameters.cookies,Tu(r.cookie,"cookie",n)),sXe(t.security,Yy(e),YLe(e,n))}function EN(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=aXe(t,e,n);return{operations:r}}function aXe(t,e,n){const r=[];for(const[i,s]of Object.entries(t.paths)){for(const[o,a]of Object.entries(s))o!=="parameters"&&o!=="servers"&&o!=="description"&&o!=="summary"&&o!=="additionalOperations"&&(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(c=>{const{operation:u}=AN(i,o,t,c,e,!1,n);u&&r.push(u)});if(s.additionalOperations)for(const[o,a]of Object.entries(s.additionalOperations))(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(c=>{const{operation:u}=AN(i,o,t,c,e,!0,n);u&&r.push(u)})}return{operations:r}}function AN(t,e,n,r,i,s,o){if(!o)return{operation:null};const a=o(t,e,n);if(!a)return{operation:null};const l=`${n.info.title}/${r}/${a.name}`;return{operation:Iue(a,s,i,l)}}const QN=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:s}=dX({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===s}return!1});class lXe{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 yP{static instance=null;static async initialize(e,n){this.close(),this.instance=await cXe(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function cXe(t,e){if(e){const{AiChatSqliteDBStorage:n}=await Promise.resolve().then(()=>require("./replay-AiChatSqliteDBStorage-jEhfZgK3.js")),r=up.getInstance(),i=new n(r);return new lXe(i)}else throw new Error("Not implemented")}const ou="ai-chat",G1="detail",uXe="title",RN="infinite-history",yB={all:()=>[ou],details:()=>[ou,G1],detail:t=>[ou,G1,t],detailTitle:t=>[ou,G1,t,uXe],infiniteHistories:()=>[ou,RN],infiniteHistory:t=>[ou,RN,t]},wI=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:s})=>{const o=y.useContext(TT),a=Be(),l=Lr.useQueryClient(),c=y.useMemo(async()=>{const f=hn()?await qLe(e.storageKey):ZLe(e.storageKey);e.layout!=="preview"&&hn()&&np.initialize();const{isInitialized:h}=await o.init(f,e,a);if(e.layout!=="preview"){if(hn()){const P=`${f.systemFilesDir}/replay.db`;await up.initialize(P),await yP.initialize(f,hn())}await Fa.initialize(f,hn()),await Hl.initialize(hn());try{await Hl.getInstance()?.pruneOlderThan(Date.now()-w0e)}catch(P){console.error("Failed to prune step context:",P)}try{const P=await XSe.migrate(f,Fa.getInstance(),hn());P.migrated&&a.sendEvent("com.redocly.history.migration",[{...he("migration","historyMigration","storage"),status:"success",itemCount:P.itemCount}])}catch(P){console.error("History migration failed:",P),a.sendEvent("com.redocly.history.migration",[{...he("migration","historyMigration","storage"),status:"error",error:P instanceof Error?P.message:"Unknown error"}])}}if(!h)return;if(!n){o.environments.length===0&&o.environments.set(C3);return}const p=OP(n,[]),{operations:m}=EN(n,p,e.convertOperationToReplayValue);if(!m?.length||!m[0].collectionPath?.split("/")?.[0]||(o.apis.set([{id:p,srcType:ri.FS,...n}]),o.predefinedApiId.set(p),!r&&!i))return;const O=QN(m,r,i),{path:v,method:b}=O?.apiPath||{};if(!O||!v||!b)return;const x=e.convertOperationToReplayValue?.(v,b,n);x&&jN(o,p,x,e),hXe(o,{apiId:p,path:v,method:b,operationId:O.operationId,isAdditionalOperation:O.isAdditionalOperation},x,e.dynamicReplayValues)},[e.storageKey]);y.useEffect(()=>{if(e.layout!=="preview")return l.invalidateQueries({queryKey:kr.all}),l.invalidateQueries({queryKey:yB.all()}),l.invalidateQueries({queryKey:ng.all}),()=>{Fa.close(),yP.close(),np.close(),Hl.close(),hn()&&up.close().catch(f=>{console.error("Failed to close SqliteDBConnection:",f)})}},[e.storageKey,e.layout,l]),y.useEffect(()=>{if(!n||!e.convertOperationToReplayValue)return;const f=OP(n,[]),{operations:h}=EN(n,f,e.convertOperationToReplayValue);if(!h?.length)return;const p=QN(h,r,i),{path:m,method:g}=p?.apiPath||{};if(!p||!m||!g)return;const O=e.convertOperationToReplayValue(m,g,n);O&&jN(o,f,O,e)},[e.convertOperationToReplayValue,e.predefinedEnvValues,e.dynamicReplayValues,e.allowedEnvironments,e.selectedEnvironment,n,r,i]);const u=e.layout==="preview"?null:d.jsx(ELe,{projectPath:e.storageKey});return d.jsx(y.Suspense,{fallback:u,children:d.jsx(dXe,{initStore:c,settings:e,api:n,onLoad:s,children:t})})};function dXe({initStore:t,children:e,settings:n,api:r,onLoad:i}){return y.use(t),Ube(n,r),y.useEffect(()=>{i?.()},[]),d.jsxs(U.default.Fragment,{children:[hn()&&d.jsx(fXe,{}),e]},n.storageKey)}function fXe(){return WLe(),null}const jN=(t,e,n,r)=>{const i=t.environments.get({noproxy:!0}),{environments:s,generatedInputs:o}=eXe(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues);t.predefinedInputNames.set(o);let a,l,c;if(r.allowedEnvironments?.length){const u=s.filter(f=>r.allowedEnvironments?.includes(f.name));a=new Set(u.map(f=>f.name)),l=u,c=l.find(f=>f.name===r.selectedEnvironment)?.name||l[0]?.name||""}else{a=new Set(s.map(f=>f.name)),l=[...s,...i.filter(f=>!a.has(f.name))];const u=t.activeEnvironmentId.get();c=l.find(f=>f.name===u)?.name||l.find(f=>f.name===r.selectedEnvironment)?.name||l[0]?.name||""}t.predefinedEnvironmentNames.set(a),CS(l,t.environments.get({noproxy:!0}))||t.environments.set(l),t.activeEnvironmentId.set(c)},hXe=(t,e,n,r)=>{const i=t.tabsState.tabs.get().findIndex(({data:s})=>bn(s,Le.Step)&&s.draftStep?.operation?.apiId===e.apiId&&s.draftStep?.operation?.path===e.path&&s.draftStep?.operation?.method===e.method);if(i!==-1){const s=t.tabsState.tabs[i],o=s.data.get();if(n&&r&&bn(o,Le.Step)){const l=s.data.draftStep.ornull;l&&oXe(l,n,r)}t.tabsState.activeTabIdx.set(i)}else{const s=x$(e,n,r);t.tabsState.tabs.merge([{...s,state:Sn.Normal}]),t.tabsState.activeTabIdx.set(t.tabsState.tabs.length-1)}};function pXe(t){const e=y.useMemo(()=>OM(s7({defaultEnvironments:[]}),vM(i7(!0))),[]);return d.jsx(Lr.QueryClientProvider,{client:ab(),children:d.jsx(xhe,{value:e,children:d.jsx(gb.Provider,{value:t.settings,children:d.jsx(wI,{...t,children:d.jsx(lB,{onError:n=>console.error(n),children:d.jsx(gXe,{...t})})})})})})}function gXe(t){return t.settings.disableDraft=!0,d.jsx(y.StrictMode,{children:d.jsxs(mXe,{children:[d.jsx(OXe,{children:d.jsx(SI,{})}),d.jsx(vh,{hideTabs:!0})]})})}const mXe=w.default.div`
6014
6014
  display: flex;
6015
6015
  flex-direction: column;
6016
6016
  max-height: 80vh;
@@ -6832,7 +6832,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
6832
6832
  border-right: ${({$isOverlayLayout:t})=>t?"1px solid var(--border-color-secondary)":"none"};
6833
6833
  width: 100%;
6834
6834
  user-select: none;
6835
- `;function BN({children:t}){const{apps:{apiId:e}}=nt(),{sendEvent:n}=Be(),{tabsParams:r}=Kb(e.get(),!1),[i,s]=y.useState(r[0]?.key||null),o=y.useCallback(l=>{s(l),n("com.redocly.tab.change",[{...he("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a={tabsParams:r,activeTab:i,onTabChange:o};return d.jsx(QB.Provider,{value:a,children:t})}function kZe(){const[t,e]=y.useState(()=>{const n=document.documentElement.clientWidth;return FN(n)});return y.useEffect(()=>{const n=()=>{const r=document.documentElement.clientWidth;e(FN(r))};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}function FN(t){return t>=1512?24:t>=1280?28:t>=1024?32:35}const TZe={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},jB=y.createContext(TZe);function _B(){return y.useContext(jB)}const $Ze=y.lazy(()=>Promise.resolve().then(()=>require("./replay-AiPanel-BvwwBTh1.js")).then(t=>({default:t.AiPanel}))),IZe=20,EZe=25,AZe=40;function QZe({panel:t,panelProps:e}){const[n,r]=y.useState(!1),{layout:i,aiEnabled:s}=gr(),o=kZe(),{isOpen:a,openPanel:l,closePanel:c}=_B(),{panelProps:u,panel:f}=Nb(!a),h=s===!0,p=i==="overlay",{onCollapse:m,onExpand:g,...O}=u;return y.useEffect(()=>{a&&f.isCollapsed&&f.expand(),!a&&!f.isCollapsed&&f.collapse()},[f,a]),i==="preview"?d.jsx(vh,{hideTabs:!0}):p?d.jsx(BN,{children:d.jsxs(YN,{direction:"horizontal",autoSaveId:"replay-layout-overlay",children:[d.jsx(If,{id:"main-panel",defaultSize:75,minSize:55,$isResizing:n,children:d.jsx(vh,{})}),d.jsx(mh,{direction:"vertical",onDragging:r}),d.jsx(If,{id:"content-panel",defaultSize:30,minSize:o,...e,$isResizing:n,children:d.jsx(UN,{isOverlayLayout:p})}),d.jsx(ZN,{panel:t,isOverlayLayout:p})]})}):d.jsx(BN,{children:d.jsxs(YN,{direction:"horizontal",autoSaveId:"replay-layout",children:[d.jsx(ZN,{panel:t,isOverlayLayout:p}),d.jsx(If,{id:"content-panel",defaultSize:30,minSize:o,...e,$isResizing:n,children:d.jsx(UN,{isOverlayLayout:p})}),d.jsx(mh,{direction:"vertical",onDragging:r}),d.jsx(If,{id:"main-panel",defaultSize:70,minSize:AZe,$isResizing:n,children:d.jsx(vh,{})}),h&&d.jsxs(d.Fragment,{children:[d.jsx(mh,{direction:"vertical",onDragging:r}),d.jsx(If,{...O,id:"ai-panel",defaultSize:a?EZe:0,collapsedSize:0,minSize:IZe,maxSize:50,$isResizing:n,onCollapse:()=>{m?.(),c()},onExpand:()=>{g?.(),l()},children:d.jsx(y.Suspense,{fallback:null,children:d.jsx($Ze,{})})})]})]})})}const YN=w.default(Db)`
6835
+ `;function BN({children:t}){const{apps:{apiId:e}}=nt(),{sendEvent:n}=Be(),{tabsParams:r}=Kb(e.get(),!1),[i,s]=y.useState(r[0]?.key||null),o=y.useCallback(l=>{s(l),n("com.redocly.tab.change",[{...he("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a={tabsParams:r,activeTab:i,onTabChange:o};return d.jsx(QB.Provider,{value:a,children:t})}function kZe(){const[t,e]=y.useState(()=>{const n=document.documentElement.clientWidth;return FN(n)});return y.useEffect(()=>{const n=()=>{const r=document.documentElement.clientWidth;e(FN(r))};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}function FN(t){return t>=1512?24:t>=1280?28:t>=1024?32:35}const TZe={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},jB=y.createContext(TZe);function _B(){return y.useContext(jB)}const $Ze=y.lazy(()=>Promise.resolve().then(()=>require("./replay-AiPanel-0GXuobhF.js")).then(t=>({default:t.AiPanel}))),IZe=20,EZe=25,AZe=40;function QZe({panel:t,panelProps:e}){const[n,r]=y.useState(!1),{layout:i,aiEnabled:s}=gr(),o=kZe(),{isOpen:a,openPanel:l,closePanel:c}=_B(),{panelProps:u,panel:f}=Nb(!a),h=s===!0,p=i==="overlay",{onCollapse:m,onExpand:g,...O}=u;return y.useEffect(()=>{a&&f.isCollapsed&&f.expand(),!a&&!f.isCollapsed&&f.collapse()},[f,a]),i==="preview"?d.jsx(vh,{hideTabs:!0}):p?d.jsx(BN,{children:d.jsxs(YN,{direction:"horizontal",autoSaveId:"replay-layout-overlay",children:[d.jsx(If,{id:"main-panel",defaultSize:75,minSize:55,$isResizing:n,children:d.jsx(vh,{})}),d.jsx(mh,{direction:"vertical",onDragging:r}),d.jsx(If,{id:"content-panel",defaultSize:30,minSize:o,...e,$isResizing:n,children:d.jsx(UN,{isOverlayLayout:p})}),d.jsx(ZN,{panel:t,isOverlayLayout:p})]})}):d.jsx(BN,{children:d.jsxs(YN,{direction:"horizontal",autoSaveId:"replay-layout",children:[d.jsx(ZN,{panel:t,isOverlayLayout:p}),d.jsx(If,{id:"content-panel",defaultSize:30,minSize:o,...e,$isResizing:n,children:d.jsx(UN,{isOverlayLayout:p})}),d.jsx(mh,{direction:"vertical",onDragging:r}),d.jsx(If,{id:"main-panel",defaultSize:70,minSize:AZe,$isResizing:n,children:d.jsx(vh,{})}),h&&d.jsxs(d.Fragment,{children:[d.jsx(mh,{direction:"vertical",onDragging:r}),d.jsx(If,{...O,id:"ai-panel",defaultSize:a?EZe:0,collapsedSize:0,minSize:IZe,maxSize:50,$isResizing:n,onCollapse:()=>{m?.(),c()},onExpand:()=>{g?.(),l()},children:d.jsx(y.Suspense,{fallback:null,children:d.jsx($Ze,{})})})]})]})})}const YN=w.default(Db)`
6836
6836
  padding: 0 var(--spacing-xs);
6837
6837
  `,If=w.default(gd)`
6838
6838
  transition-property: ${t=>t.$isResizing?"none":"flex-grow"};
@@ -6842,7 +6842,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
6842
6842
  @media (prefers-reduced-motion: reduce) {
6843
6843
  transition-duration: 0s;
6844
6844
  }
6845
- `,RZe=y.lazy(()=>Promise.resolve().then(()=>require("./replay-AiChatProvider-Oms5CFgT.js")).then(t=>({default:t.AiChatProvider}))),jZe=({className:t,renderProjectSelect:e})=>{const{isMobile:n,closeButton:r}=Eo(),i=Nb(!1),{layout:s,aiEnabled:o}=gr(),a=s==="preview",l=o===!0,c=n?d.jsx(fZe,{}):d.jsxs(d.Fragment,{children:[!a&&d.jsx(CXe,{}),d.jsx(QZe,{panel:i.panel,panelProps:i.panelProps})]});return d.jsxs(d.Fragment,{children:[!n&&!a&&r,d.jsx(DZe,{className:t,isPreviewLayout:a,children:d.jsx(lB,{onError:u=>console.error(u),children:d.jsx(bZe,{children:d.jsx(xZe,{renderProjectSelect:e,children:l?d.jsx(y.Suspense,{fallback:null,children:d.jsx(RZe,{children:c})}):c})})})})]})};function DB({className:t,renderProjectSelect:e}){return d.jsx(jZe,{className:t,renderProjectSelect:e})}function _Ze({className:t,renderProjectSelect:e}){return d.jsx(AB,{children:d.jsx(DB,{className:t,renderProjectSelect:e})})}const DZe=w.default.div`
6845
+ `,RZe=y.lazy(()=>Promise.resolve().then(()=>require("./replay-AiChatProvider-IuOVaWMC.js")).then(t=>({default:t.AiChatProvider}))),jZe=({className:t,renderProjectSelect:e})=>{const{isMobile:n,closeButton:r}=Eo(),i=Nb(!1),{layout:s,aiEnabled:o}=gr(),a=s==="preview",l=o===!0,c=n?d.jsx(fZe,{}):d.jsxs(d.Fragment,{children:[!a&&d.jsx(CXe,{}),d.jsx(QZe,{panel:i.panel,panelProps:i.panelProps})]});return d.jsxs(d.Fragment,{children:[!n&&!a&&r,d.jsx(DZe,{className:t,isPreviewLayout:a,children:d.jsx(lB,{onError:u=>console.error(u),children:d.jsx(bZe,{children:d.jsx(xZe,{renderProjectSelect:e,children:l?d.jsx(y.Suspense,{fallback:null,children:d.jsx(RZe,{children:c})}):c})})})})]})};function DB({className:t,renderProjectSelect:e}){return d.jsx(jZe,{className:t,renderProjectSelect:e})}function _Ze({className:t,renderProjectSelect:e}){return d.jsx(AB,{children:d.jsx(DB,{className:t,renderProjectSelect:e})})}const DZe=w.default.div`
6846
6846
  display: flex;
6847
6847
  flex-direction: column;
6848
6848
  height: 100vh;
@@ -6872,4 +6872,4 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
6872
6872
  @media (max-width: ${$r}px) {
6873
6873
  width: 100vw;
6874
6874
  }
6875
- `;async function FZe(t,e,n,r){const{validateApiKey:i}=await Promise.resolve().then(()=>require("./replay-validate-key-CmzSfORv.js"));return i(t,e,n,r)}async function YZe(){return(await Promise.resolve().then(()=>require("./replay-agent-loop-BLSu4v_O.js"))).AgentLoop}exports.AI_PROVIDERS=RZ;exports.AiChatContext=_Z;exports.AiChatServiceFactory=yP;exports.AiPanelContext=jB;exports.Builder=Ei;exports.CriterionType=ar;exports.DEFAULT_MAX_RETRIES=$we;exports.DEFAULT_MAX_STEPS=Twe;exports.Divider=ot;exports.EmbeddedReplay=pXe;exports.GRANT_TYPE_MAP=due;exports.ItemState=jt;exports.JsonPointerLib=Ph;exports.MAX_OUTPUT_TOKENS_FOR_VALIDATION=Ewe;exports.Markdown=z6;exports.Modal=rs;exports.OAUTH2_SECURITY=sC;exports.PathUtils=Ht;exports.REPLAY_CHANGE_PREVIEW_SNAPSHOT_KEY=Qwe;exports.REPLAY_MESSAGE_METADATA_NS=Awe;exports.REQUEST_METHODS=Vd;exports.REUNITE_AI_PROVIDER=S$;exports.REUNITE_MODEL_OPTION=qC;exports.Replay=ZZe;exports.ReplayOverlay=UZe;exports.RootStorage=r7;exports.SECRET_MASK=H$;exports.SecurityFlows=ee;exports.SecurityTypes=te;exports.SourceType=ri;exports.StyledSpinner=FT;exports.TAB_NAMES=Je;exports.TOOL_CALL_MESSAGES_TO_KEEP=Iwe;exports.TabDataType=Le;exports.TabState=Sn;exports.TelemetryClient=SW;exports.TextContentType=Cn;exports.VerticalDivider=Me;exports.aiChatKeys=yB;exports.apiUrlToApiId=uX;exports.applyThemeToDOM=zRe;exports.bgRed=SF;exports.blue=yF;exports.bold=hF;exports.bytesToHex=xh;exports.clearNotificationsForSource=Mu;exports.cloneObject=xs;exports.context=po;exports.createResource=he;exports.createTabFromOperation=x$;exports.dayjs=Og;exports.defaultAiChatContextValue=jZ;exports.dim=pF;exports.dirname=JL;exports.evaluateRuntimeExpression=Ga;exports.evaluateRuntimeExpressionPayload=Yf;exports.exists=cT;exports.extname=KL;exports.fetch=yo;exports.getAPIKeyLocation=hX;exports.getActiveTab=og;exports.getApiOperationFromStore=UW;exports.getCollectionFromStore=kZ;exports.getCurrentTheme=Ub;exports.getDefaultExportFromCjs=ua;exports.getEmptyCriterionObject=VL;exports.getEmptyRequestParameter=WO;exports.getEmptySingleSecurity=ss;exports.getNewCollection=m$;exports.getNewStep=wo;exports.getNewWorkflow=p$;exports.getOperationsList=i$;exports.getStepFailures=e4e;exports.getStepForActiveStepTab=vSe;exports.getStepFromStore=t$;exports.getStepMethod=sl;exports.getStepUrl=dp;exports.getValueFromContext=wh;exports.getWorkflowFromStore=SZ;exports.getWorkflowRunVerdict=uI;exports.gray=xF;exports.green=OF;exports.hasAllStepPassed=cI;exports.inverse=mF;exports.invoke=qe;exports.isAbsolute=eX;exports.isAbsoluteUrl=e4;exports.isInlineRequestParameter=Tp;exports.isPlainObject=Cd;exports.isTabStepState=OSe;exports.isTabType=bn;exports.isTauriApp=hn;exports.isWebUrl=Li;exports.join=iT;exports.loadAgentLoop=YZe;exports.loadAndBundleDefinition=LO;exports.makeProviderRecord=Rwe;exports.makeRequest=zW;exports.markdownParserMarked=M6;exports.maskSecretsInText=Bd;exports.md5=vy;exports.mergeUrlParametersWithPreviousParameters=h$;exports.mkdir=nX;exports.module=PM;exports.none=vt;exports.path=oS;exports.pathBrowserifyExports=Qa;exports.readDir=rX;exports.readTextFile=lT;exports.red=Qr;exports.remove=sX;exports.rename=oX;exports.reportParseError=kT;exports.requireFastDeepEqual=TM;exports.resolve=HL;exports.resolvePath=RF;exports.resolveTheme=MRe;exports.resolveWorkflowReference=AM;exports.sep=GL;exports.sha256=wM;exports.stringToQueryParameters=Dp;exports.tabStepUidsMatch=ySe;exports.toCompactJson=kue;exports.trace=jr;exports.transformCallback=P3;exports.tty=kM;exports.ulid=lp;exports.underline=gF;exports.useActiveTab=gl;exports.useAiChatContext=fg;exports.useAiPanel=_B;exports.useApiOperation=kc;exports.useCollections=ml;exports.useGlobalStore=nt;exports.useRunWorkflow=qU;exports.useSettingsContext=gr;exports.useSettingsState=qr;exports.useSteps=y$;exports.useTabHandlers=Nn;exports.useTelemetry=Be;exports.useTelemetryClient=Gbe;exports.useWorkflows=kb;exports.validateApiKey=FZe;exports.white=bF;exports.writeTextFile=aX;exports.yaml=Ja;exports.yellow=vF;
6875
+ `;async function FZe(t,e,n,r){const{validateApiKey:i}=await Promise.resolve().then(()=>require("./replay-validate-key-CTJn216O.js"));return i(t,e,n,r)}async function YZe(){return(await Promise.resolve().then(()=>require("./replay-agent-loop-X2MrvEk-.js"))).AgentLoop}exports.AI_PROVIDERS=RZ;exports.AiChatContext=_Z;exports.AiChatServiceFactory=yP;exports.AiPanelContext=jB;exports.Builder=Ei;exports.CriterionType=ar;exports.DEFAULT_MAX_RETRIES=$we;exports.DEFAULT_MAX_STEPS=Twe;exports.Divider=ot;exports.EmbeddedReplay=pXe;exports.GRANT_TYPE_MAP=due;exports.ItemState=jt;exports.JsonPointerLib=Ph;exports.MAX_OUTPUT_TOKENS_FOR_VALIDATION=Ewe;exports.Markdown=z6;exports.Modal=rs;exports.OAUTH2_SECURITY=sC;exports.PathUtils=Ht;exports.REPLAY_CHANGE_PREVIEW_SNAPSHOT_KEY=Qwe;exports.REPLAY_MESSAGE_METADATA_NS=Awe;exports.REQUEST_METHODS=Vd;exports.REUNITE_AI_PROVIDER=S$;exports.REUNITE_MODEL_OPTION=qC;exports.Replay=ZZe;exports.ReplayOverlay=UZe;exports.RootStorage=r7;exports.SECRET_MASK=H$;exports.SecurityFlows=ee;exports.SecurityTypes=te;exports.SourceType=ri;exports.StyledSpinner=FT;exports.TAB_NAMES=Je;exports.TOOL_CALL_MESSAGES_TO_KEEP=Iwe;exports.TabDataType=Le;exports.TabState=Sn;exports.TelemetryClient=SW;exports.TextContentType=Cn;exports.VerticalDivider=Me;exports.aiChatKeys=yB;exports.apiUrlToApiId=uX;exports.applyThemeToDOM=zRe;exports.bgRed=SF;exports.blue=yF;exports.bold=hF;exports.bytesToHex=xh;exports.clearNotificationsForSource=Mu;exports.cloneObject=xs;exports.context=po;exports.createResource=he;exports.createTabFromOperation=x$;exports.dayjs=Og;exports.defaultAiChatContextValue=jZ;exports.dim=pF;exports.dirname=JL;exports.evaluateRuntimeExpression=Ga;exports.evaluateRuntimeExpressionPayload=Yf;exports.exists=cT;exports.extname=KL;exports.fetch=yo;exports.getAPIKeyLocation=hX;exports.getActiveTab=og;exports.getApiOperationFromStore=UW;exports.getCollectionFromStore=kZ;exports.getCurrentTheme=Ub;exports.getDefaultExportFromCjs=ua;exports.getEmptyCriterionObject=VL;exports.getEmptyRequestParameter=WO;exports.getEmptySingleSecurity=ss;exports.getNewCollection=m$;exports.getNewStep=wo;exports.getNewWorkflow=p$;exports.getOperationsList=i$;exports.getStepFailures=e4e;exports.getStepForActiveStepTab=vSe;exports.getStepFromStore=t$;exports.getStepMethod=sl;exports.getStepUrl=dp;exports.getValueFromContext=wh;exports.getWorkflowFromStore=SZ;exports.getWorkflowRunVerdict=uI;exports.gray=xF;exports.green=OF;exports.hasAllStepPassed=cI;exports.inverse=mF;exports.invoke=qe;exports.isAbsolute=eX;exports.isAbsoluteUrl=e4;exports.isInlineRequestParameter=Tp;exports.isPlainObject=Cd;exports.isTabStepState=OSe;exports.isTabType=bn;exports.isTauriApp=hn;exports.isWebUrl=Li;exports.join=iT;exports.loadAgentLoop=YZe;exports.loadAndBundleDefinition=LO;exports.makeProviderRecord=Rwe;exports.makeRequest=zW;exports.markdownParserMarked=M6;exports.maskSecretsInText=Bd;exports.md5=vy;exports.mergeUrlParametersWithPreviousParameters=h$;exports.mkdir=nX;exports.module=PM;exports.none=vt;exports.path=oS;exports.pathBrowserifyExports=Qa;exports.readDir=rX;exports.readTextFile=lT;exports.red=Qr;exports.remove=sX;exports.rename=oX;exports.reportParseError=kT;exports.requireFastDeepEqual=TM;exports.resolve=HL;exports.resolvePath=RF;exports.resolveTheme=MRe;exports.resolveWorkflowReference=AM;exports.sep=GL;exports.sha256=wM;exports.stringToQueryParameters=Dp;exports.tabStepUidsMatch=ySe;exports.toCompactJson=kue;exports.trace=jr;exports.transformCallback=P3;exports.tty=kM;exports.ulid=lp;exports.underline=gF;exports.useActiveTab=gl;exports.useAiChatContext=fg;exports.useAiPanel=_B;exports.useApiOperation=kc;exports.useCollections=ml;exports.useGlobalStore=nt;exports.useRunWorkflow=qU;exports.useSettingsContext=gr;exports.useSettingsState=qr;exports.useSteps=y$;exports.useTabHandlers=Nn;exports.useTelemetry=Be;exports.useTelemetryClient=Gbe;exports.useWorkflows=kb;exports.validateApiKey=FZe;exports.white=bF;exports.writeTextFile=aX;exports.yaml=Ja;exports.yellow=vF;