@redocly/openapi-docs 3.25.0-next.1 → 3.25.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/dist/{redocly-openapi-docs.min.AiChatProvider-CDMc3dS6.js → redocly-openapi-docs.min.AiChatProvider-C_KLy-F0.js} +1 -1
  2. package/dist/{redocly-openapi-docs.min.AiChatSqliteDBStorage-BopXqcPv.js → redocly-openapi-docs.min.AiChatSqliteDBStorage-xPx3J3uK.js} +1 -1
  3. package/dist/{redocly-openapi-docs.min.AiPanel-DkXOeLs5.js → redocly-openapi-docs.min.AiPanel-BmK852q6.js} +1 -1
  4. package/dist/{redocly-openapi-docs.min.FileWatcher-DMjNW66W.js → redocly-openapi-docs.min.FileWatcher-BtXjqGQC.js} +1 -1
  5. package/dist/{redocly-openapi-docs.min.SemanticSearchService-DbpnWseN.js → redocly-openapi-docs.min.SemanticSearchService-gLmwyYO3.js} +1 -1
  6. package/dist/{redocly-openapi-docs.min.SqliteDBStorage-ak3Zqgtw.js → redocly-openapi-docs.min.SqliteDBStorage-DfF4kq1F.js} +1 -1
  7. package/dist/{redocly-openapi-docs.min.TauriFileSystemAdapter-Dl2fY3am.js → redocly-openapi-docs.min.TauriFileSystemAdapter-DZLjNpl_.js} +1 -1
  8. package/dist/{redocly-openapi-docs.min.TauriRootStorage-m4plsfqx.js → redocly-openapi-docs.min.TauriRootStorage-DMQv9g_J.js} +1 -1
  9. package/dist/{redocly-openapi-docs.min.ai-chat-mappers-Dg8U8w8r.js → redocly-openapi-docs.min.ai-chat-mappers-O-bg124u.js} +1 -1
  10. package/dist/{redocly-openapi-docs.min.external-resolver-Db7hewsm.js → redocly-openapi-docs.min.external-resolver-D89x3qoA.js} +1 -1
  11. package/dist/{redocly-openapi-docs.min.index-EVRmC_IQ.js → redocly-openapi-docs.min.index-BBNK1d3n.js} +1 -1
  12. package/dist/{redocly-openapi-docs.min.index-B5-R6EGY.js → redocly-openapi-docs.min.index-D4_45rLR.js} +1 -1
  13. package/dist/{redocly-openapi-docs.min.index-DeHk4n2z.js → redocly-openapi-docs.min.index-DQHVHxbB.js} +1 -1
  14. package/dist/{redocly-openapi-docs.min.index-D9U4Tk7n.js → redocly-openapi-docs.min.index-DbxjaOoh.js} +11 -11
  15. package/dist/redocly-openapi-docs.min.js +1 -1
  16. package/dist/{redocly-openapi-docs.min.lint-PvmGrAK3.js → redocly-openapi-docs.min.lint-DLjLNlT2.js} +2 -2
  17. package/dist/{redocly-openapi-docs.min.lint-graphql-CMMhYVr_.js → redocly-openapi-docs.min.lint-graphql-1y6KKl09.js} +1 -1
  18. package/dist/{redocly-openapi-docs.min.respect-run-DgsYdmxw.js → redocly-openapi-docs.min.respect-run-BdIceoa0.js} +1 -1
  19. package/dist/{redocly-openapi-docs.min.standalone-D9becCWS.js → redocly-openapi-docs.min.standalone-crUOAFz-.js} +10 -5
  20. package/dist/{redocly-openapi-docs.min.tauri-path-Bv9A5DVf.js → redocly-openapi-docs.min.tauri-path-BjTOYabX.js} +1 -1
  21. package/dist/{redocly-openapi-docs.min.useAiChatQueries-Cb-1pa0w.js → redocly-openapi-docs.min.useAiChatQueries-Rfa850wl.js} +2 -2
  22. package/package.json +4 -4
@@ -1,4 +1,4 @@
1
- import{r as v,g as it,a as x,j as u,u as pU,b as fU,c as gU,d as Td,C as Id,e as gr,E as zf,W as zo,f as Ed,h as Jt,B as de,P as js,t as mU,i as OU,R as _e,k as vU,l as Rd,J as _f,m as Ts,n as LC,o as qf,p as bc,q as Nf,S as Ke,s as yU,v as YC,w as Is,x as _o,y as bU,z as pa,A as Zf,D as BC,F as FC,G as xU,H as wU,I as SU,K as kU,L as CU,O as PU,M as $U,N as QU,Q as fa,T as GC,U as Er,V as H0,X as HC,Y as jU,Z as Rr,_ as ul,$ as Ar,a0 as ga,a1 as K0,a2 as TU,a3 as IU,a4 as EU,a5 as RU,a6 as AU,a7 as DU,a8 as An,a9 as Xf,aa as MU,ab as ki,ac as hn,ad as dl,ae as zU,af as _U,ag as qU,ah as KC,ai as NU,aj as ZU,ak as Vf,al as JC,am as XU,an as xc,ao as e3,ap as VU,aq as UU,ar as WU,as as LU,at as YU,au as BU,av as FU,aw as GU,ax as HU}from"./redocly-openapi-docs.min.standalone-D9becCWS.js";function KU(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}function J0(t,e){return`${t.replace(/\s+/g,"-").toLowerCase()}-${e}`}const JU=2500,eW=4e3;function tW(t,e,n){return n!==void 0?n:e==="loading"?null:t?eW:JU}const t3=v.createContext(null),nW=t=>u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",...t,children:u.jsx("path",{d:"M10.0002 1.24998C8.84911 1.24285 7.70808 1.4643 6.64326 1.9015C5.57844 2.3387 4.61101 2.98295 3.79707 3.79689C2.98313 4.61083 2.33889 5.57826 1.90168 6.64308C1.46448 7.7079 1.24303 8.84892 1.25017 9.99998C1.24303 11.151 1.46448 12.2921 1.90168 13.3569C2.33889 14.4217 2.98313 15.3891 3.79707 16.2031C4.61101 17.017 5.57844 17.6613 6.64326 18.0985C7.70808 18.5357 8.84911 18.7571 10.0002 18.75C11.1512 18.7571 12.2923 18.5357 13.3571 18.0985C14.4219 17.6613 15.3893 17.017 16.2033 16.2031C17.0172 15.3891 17.6614 14.4217 18.0986 13.3569C18.5359 12.2921 18.7573 11.151 18.7502 9.99998C18.7573 8.84892 18.5359 7.7079 18.0986 6.64308C17.6614 5.57826 17.0172 4.61083 16.2033 3.79689C15.3893 2.98295 14.4219 2.3387 13.3571 1.9015C12.2923 1.4643 11.1512 1.24285 10.0002 1.24998ZM13.4032 14.375L5.62517 6.5973L6.59748 5.62498L14.3752 13.403L13.4032 14.375Z",fill:"#F9316D"})}),n3=x(nW).attrs({"data-component-name":"icons/ErrorFilledIcon/ErrorFilledIcon"})`
1
+ import{r as v,g as it,a as x,j as u,u as pU,b as fU,c as gU,d as Td,C as Id,e as gr,E as zf,W as zo,f as Ed,h as Jt,B as de,P as js,t as mU,i as OU,R as _e,k as vU,l as Rd,J as _f,m as Ts,n as LC,o as qf,p as bc,q as Nf,S as Ke,s as yU,v as YC,w as Is,x as _o,y as bU,z as pa,A as Zf,D as BC,F as FC,G as xU,H as wU,I as SU,K as kU,L as CU,O as PU,M as $U,N as QU,Q as fa,T as GC,U as Er,V as H0,X as HC,Y as jU,Z as Rr,_ as ul,$ as Ar,a0 as ga,a1 as K0,a2 as TU,a3 as IU,a4 as EU,a5 as RU,a6 as AU,a7 as DU,a8 as An,a9 as Xf,aa as MU,ab as ki,ac as hn,ad as dl,ae as zU,af as _U,ag as qU,ah as KC,ai as NU,aj as ZU,ak as Vf,al as JC,am as XU,an as xc,ao as e3,ap as VU,aq as UU,ar as WU,as as LU,at as YU,au as BU,av as FU,aw as GU,ax as HU}from"./redocly-openapi-docs.min.standalone-crUOAFz-.js";function KU(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}function J0(t,e){return`${t.replace(/\s+/g,"-").toLowerCase()}-${e}`}const JU=2500,eW=4e3;function tW(t,e,n){return n!==void 0?n:e==="loading"?null:t?eW:JU}const t3=v.createContext(null),nW=t=>u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",...t,children:u.jsx("path",{d:"M10.0002 1.24998C8.84911 1.24285 7.70808 1.4643 6.64326 1.9015C5.57844 2.3387 4.61101 2.98295 3.79707 3.79689C2.98313 4.61083 2.33889 5.57826 1.90168 6.64308C1.46448 7.7079 1.24303 8.84892 1.25017 9.99998C1.24303 11.151 1.46448 12.2921 1.90168 13.3569C2.33889 14.4217 2.98313 15.3891 3.79707 16.2031C4.61101 17.017 5.57844 17.6613 6.64326 18.0985C7.70808 18.5357 8.84911 18.7571 10.0002 18.75C11.1512 18.7571 12.2923 18.5357 13.3571 18.0985C14.4219 17.6613 15.3893 17.017 16.2033 16.2031C17.0172 15.3891 17.6614 14.4217 18.0986 13.3569C18.5359 12.2921 18.7573 11.151 18.7502 9.99998C18.7573 8.84892 18.5359 7.7079 18.0986 6.64308C17.6614 5.57826 17.0172 4.61083 16.2033 3.79689C15.3893 2.98295 14.4219 2.3387 13.3571 1.9015C12.2923 1.4643 11.1512 1.24285 10.0002 1.24998ZM13.4032 14.375L5.62517 6.5973L6.59748 5.62498L14.3752 13.403L13.4032 14.375Z",fill:"#F9316D"})}),n3=x(nW).attrs({"data-component-name":"icons/ErrorFilledIcon/ErrorFilledIcon"})`
2
2
  path {
3
3
  fill: ${({color:t})=>it(t)};
4
4
  }
@@ -330,7 +330,7 @@ html body {
330
330
  `+D.slice(pe,be),pe=be+1),me=Ce;return ke+=`
331
331
  `,D.length-pe>F&&me>pe?ke+=D.slice(pe,me)+`
332
332
  `+D.slice(me+1):ke+=D.slice(pe),ke.slice(1)}function ct(D){let F="",Oe=0;for(let le=0;le<D.length;Oe>=65536?le+=2:le++){Oe=Te(D,le);const pe=R[Oe];!pe&&oe(Oe)?(F+=D[le],Oe>=65536&&(F+=D[le+1])):F+=pe||Z(Oe)}return F}function rn(D,F,Oe){let le="";const pe=D.tag;for(let be=0,me=Oe.length;be<me;be+=1){let Ce=Oe[be];D.replacer&&(Ce=D.replacer.call(Oe,String(be),Ce)),(se(D,F,Ce,!1,!1)||typeof Ce>"u"&&se(D,F,null,!1,!1))&&(le!==""&&(le+=","+(D.condenseFlow?"":" ")),le+=D.dump)}D.tag=pe,D.dump="["+le+"]"}function xt(D,F,Oe,le){let pe="";const be=D.tag;for(let me=0,Ce=Oe.length;me<Ce;me+=1){let ke=Oe[me];D.replacer&&(ke=D.replacer.call(Oe,String(me),ke)),(se(D,F+1,ke,!0,!0,!1,!0)||typeof ke>"u"&&se(D,F+1,null,!0,!0,!1,!0))&&((!le||pe!=="")&&(pe+=Y(D,F)),D.dump&&a===D.dump.charCodeAt(0)?pe+="-":pe+="- ",pe+=D.dump)}D.tag=be,D.dump=pe||"[]"}function mn(D,F,Oe){let le="";const pe=D.tag,be=Object.keys(Oe);for(let me=0,Ce=be.length;me<Ce;me+=1){let ke="";le!==""&&(ke+=", "),D.condenseFlow&&(ke+='"');const Ie=be[me];let je=Oe[Ie];D.replacer&&(je=D.replacer.call(Oe,Ie,je)),se(D,F,Ie,!1,!1)&&(D.dump.length>1024&&(ke+="? "),ke+=D.dump+(D.condenseFlow?'"':"")+":"+(D.condenseFlow?"":" "),se(D,F,je,!1,!1)&&(ke+=D.dump,le+=ke))}D.tag=pe,D.dump="{"+le+"}"}function C(D,F,Oe,le){let pe="";const be=D.tag,me=Object.keys(Oe);if(D.sortKeys===!0)me.sort();else if(typeof D.sortKeys=="function")me.sort(D.sortKeys);else if(D.sortKeys)throw new e("sortKeys must be a boolean or a function");for(let Ce=0,ke=me.length;Ce<ke;Ce+=1){let Ie="";(!le||pe!=="")&&(Ie+=Y(D,F));const je=me[Ce];let Ze=Oe[je];if(D.replacer&&(Ze=D.replacer.call(Oe,je,Ze)),!se(D,F+1,je,!0,!0,!0))continue;const Le=D.tag!==null&&D.tag!=="?"||D.dump&&D.dump.length>1024;Le&&(D.dump&&a===D.dump.charCodeAt(0)?Ie+="?":Ie+="? "),Ie+=D.dump,Le&&(Ie+=Y(D,F)),se(D,F+1,Ze,!0,Le)&&(D.dump&&a===D.dump.charCodeAt(0)?Ie+=":":Ie+=": ",Ie+=D.dump,pe+=Ie)}D.tag=be,D.dump=pe||"{}"}function H(D,F,Oe){const le=Oe?D.explicitTypes:D.implicitTypes;for(let pe=0,be=le.length;pe<be;pe+=1){const me=le[pe];if((me.instanceOf||me.predicate)&&(!me.instanceOf||typeof F=="object"&&F instanceof me.instanceOf)&&(!me.predicate||me.predicate(F))){if(Oe?me.multi&&me.representName?D.tag=me.representName(F):D.tag=me.tag:D.tag="?",me.represent){const Ce=D.styleMap[me.tag]||me.defaultStyle;let ke;if(r.call(me.represent)==="[object Function]")ke=me.represent(F,Ce);else if(i.call(me.represent,Ce))ke=me.represent[Ce](F,Ce);else throw new e("!<"+me.tag+'> tag resolver accepts not "'+Ce+'" style');D.dump=ke}return!0}}return!1}function se(D,F,Oe,le,pe,be,me){D.tag=null,D.dump=Oe,H(D,Oe,!1)||H(D,Oe,!0);const Ce=r.call(D.dump),ke=le;le&&(le=D.flowLevel<0||D.flowLevel>F);const Ie=Ce==="[object Object]"||Ce==="[object Array]";let je,Ze;if(Ie&&(je=D.duplicates.indexOf(Oe),Ze=je!==-1),(D.tag!==null&&D.tag!=="?"||Ze||D.indent!==2&&F>0)&&(pe=!1),Ze&&D.usedDuplicates[je])D.dump="*ref_"+je;else{if(Ie&&Ze&&!D.usedDuplicates[je]&&(D.usedDuplicates[je]=!0),Ce==="[object Object]")le&&Object.keys(D.dump).length!==0?(C(D,F,D.dump,pe),Ze&&(D.dump="&ref_"+je+D.dump)):(mn(D,F,D.dump),Ze&&(D.dump="&ref_"+je+" "+D.dump));else if(Ce==="[object Array]")le&&D.dump.length!==0?(D.noArrayIndent&&!me&&F>0?xt(D,F-1,D.dump,pe):xt(D,F,D.dump,pe),Ze&&(D.dump="&ref_"+je+D.dump)):(rn(D,F,D.dump),Ze&&(D.dump="&ref_"+je+" "+D.dump));else if(Ce==="[object String]")D.tag!=="?"&&$t(D,D.dump,F,be,ke);else{if(Ce==="[object Undefined]"||D.skipInvalid)return!1;throw new e("unacceptable kind of an object to dump "+Ce)}if(D.tag!==null&&D.tag!=="?"){let Le=encodeURI(D.tag[0]==="!"?D.tag.slice(1):D.tag).replace(/!/g,"%21");D.tag[0]==="!"?Le="!"+Le:Le.slice(0,18)==="tag:yaml.org,2002:"?Le="!!"+Le.slice(18):Le="!<"+Le+">",D.dump=Le+" "+D.dump}}return!0}function he(D,F){const Oe=[],le=[];ae(D,Oe,le);const pe=le.length;for(let be=0;be<pe;be+=1)F.duplicates.push(Oe[le[be]]);F.usedDuplicates=new Array(pe)}function ae(D,F,Oe){if(D!==null&&typeof D=="object"){const le=F.indexOf(D);if(le!==-1)Oe.indexOf(le)===-1&&Oe.push(le);else if(F.push(D),Array.isArray(D))for(let pe=0,be=D.length;pe<be;pe+=1)ae(D[pe],F,Oe);else{const pe=Object.keys(D);for(let be=0,me=pe.length;be<me;be+=1)ae(D[pe[be]],F,Oe)}}}function ue(D,F){F=F||{};const Oe=new W(F);Oe.noRefs||he(D,Oe);let le=D;return Oe.replacer&&(le=Oe.replacer.call({"":le},"",le)),se(Oe,0,le,!0,!0)?Oe.dump+`
333
- `:""}return $y.dump=ue,$y}var c4;function eG(){if(c4)return yr;c4=1;const t=KF(),e=JF();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 yr.Type=Mr(),yr.Schema=k9(),yr.FAILSAFE_SCHEMA=E9(),yr.JSON_SCHEMA=V9(),yr.CORE_SCHEMA=L9(),yr.DEFAULT_SCHEMA=Py(),yr.load=t.load,yr.loadAll=t.loadAll,yr.dump=e.dump,yr.YAMLException=Hd(),yr.types={binary:K9(),float:N9(),map:T9(),null:A9(),pairs:n4(),set:i4(),timestamp:B9(),bool:M9(),int:_9(),merge:G9(),omap:e4(),seq:Q9(),str:P9()},yr.safeLoad=n("safeLoad","load"),yr.safeLoadAll=n("safeLoadAll","loadAll"),yr.safeDump=n("safeDump","dump"),yr}var tG=eG();const vl=GF(tG),Gr={FS:"fs",WEB:"web"};class Vt{static utils=null;static async getUtils(){return Vt.utils||(Vt.utils=an()?await import("./redocly-openapi-docs.min.tauri-path-Bv9A5DVf.js"):{join:bc.join,resolve:bc.resolve,isAbsolute:bc.isAbsolute,relative:bc.relative,extname:bc.extname,dirname:bc.dirname}),Vt.utils}static async dirname(e){return(await Vt.getUtils()).dirname(e)}static async join(...e){return(await Vt.getUtils()).join(...e)}static async resolve(e){return(await Vt.getUtils()).resolve(e)}static async isAbsolute(e){return(await Vt.getUtils()).isAbsolute(e)}static async relative(e,n){return(await Vt.getUtils()).relative(e,n)}static async extname(e){return(await Vt.getUtils()).extname(e)}}async function Sg(t,e){const[{bundle:n,Config:r},{ExternalResolver:i}]=await Promise.all([import("./redocly-openapi-docs.min.index-DeHk4n2z.js"),import("./redocly-openapi-docs.min.external-resolver-Db7hewsm.js")]),o=new r({});o.getRulesForSpecVersion=()=>[];const s=await Vt.dirname(t),a={config:o,base:s,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 u4(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function Qy(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function d4(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function Ti(t){try{return new URL(t),!0}catch{return!1}}function nG(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(u4(e))n=e;else if(!e.startsWith("/"))n=Qy(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return Qy(n)}function h4(t,e){let n=t;return e.forEach(({key:r,value:i,active:o})=>{i&&o&&(n=n.replaceAll(`{${r}}`,i))}),n}function p4(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function rG(t){return t.startsWith("http://")||t.startsWith("https://")}function kg({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(rG(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 jy{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),o=localStorage.getItem(r);o!==null&&(localStorage.setItem(i,o),localStorage.removeItem(r))}makeKey(e){return`replay:fs:${this.baseDir}/${e}`}on(e,n){}off(e,n){}}class iG{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 oG{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 f4{constructor(e){this.storage=e}storage;itemIds=[];async getAbsolutePath(e){return await Vt.resolve(await Vt.join(this.storage.baseDir,"/",e))}async parseMany(e,n){return(await Promise.all(e.map(async r=>{try{return await this.parse(r,n)}catch(i){return console.error(`Error parsing from ${r.type} ${r.uri}:`,i),null}}))).filter(r=>r!==null)}setItemIds(e){this.itemIds=e}async write(e){e.state===It.Draft||e.srcType!==Gr.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 o in r){const s=parseInt(o);switch(r[o]){case"D":await this.remove(this.itemIds[s]);break;case"I":case"U":await this.write(n[s]);break}}return}const i=this.itemIds.filter(o=>!n.some(s=>s.id===o));await Promise.all([...n.map(o=>this.write(o)),...i.map(o=>this.remove(o))])}async update(e,n){const r={path:e.path.slice(1),actions:e.actions};if(r.path.length===0&&await this.updateRoot(r,n),r.path.length>0){const i=r.path[0];r.path.length===1&&r.actions&&r.actions.id==="U"&&await this.remove(this.itemIds[i]),r.path[1]&&r.path[1]==="id"&&await this.remove(this.itemIds[i]),await this.write(n[i])}this.itemIds=n.map(i=>i.id)}}class sG extends f4{parse(e){return{...e.content,id:e.uri,srcType:e.type,fileDependencies:e.fileDependencies}}async stringify(e){const{id:n,srcType:r,fileDependencies:i,...o}=e;return await Vt.extname(n)===".json"?JSON.stringify(o,null,2):vl.dump(o)}async write(e){await this.storage.has(e.id)||await super.write(e)}}var nr=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(nr||{});const Kd={active:!0,key:"",value:""},aG=/[\n\r\t]/g;function g4(t){return t.replace(aG,"").trim()}function Vo(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?g4(String(n.example)):"",active:r?!0:!!n.example,in:n.in,...n.allowReserved&&{allowReserved:n.allowReserved}}})}function Jd(t,e){const[n]=t.split("?"),r=e.filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${n}${r?`?${r}`:""}`}function eh(t){const e=t.indexOf("?");if(e===-1)return[];const n=new URLSearchParams(t.slice(e+1)),r=[];for(const[i,o]of n.entries())r.push({id:crypto.randomUUID(),active:!0,key:i,value:o,in:"query"});return r}function m4(){return{id:crypto.randomUUID(),...Kd}}function lG(){return{id:crypto.randomUUID(),...Kd,description:""}}function Cg(t){return{...Kd,id:crypto.randomUUID(),in:t}}function cG(){return{id:crypto.randomUUID(),...Kd,type:"text",files:null}}function uG(){return{id:crypto.randomUUID(),...Kd,sendIn:Or.URL}}function Ty(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function Pg(t,e){return t.filter(n=>n.active&&n.value).map(({value:n})=>(e?tn(n,e):n).trim())}function Ca(t,e){const n=e.filter(r=>!!r).flatMap(r=>r).filter(r=>r.key&&r.active);return["path","header"].includes(t)?Array.from(new Map(n.map(r=>[r.key,r])).values()):n}function dG(t,e,n){return t.map(({value:r,...i})=>({...i,value:Au(r,e,n??{})}))}function hG(t,e){if(!t.startsWith("$components.parameters."))return null;const n=t.replace("$components.parameters.","");return n&&e[n]||null}function ln(t=[],e={}){const n=[];for(const r of t)if(ml(r)){const i=hG(r.reference,e);i&&n.push({...i,active:r.active,value:r.value||i.value})}else n.push(r);return n}function Pa(t){return Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:n}))}function O4(t){return t.schema}function v4(t){return O4(t)?.fields??[]}function y4(t,e){return t.flatMap(n=>{const r=O4(n),i=r?.fields||[];return i.length>0?i.flatMap(o=>b4(o.name,o.example,n.allowReserved)):b4(n.name,r?.example??n.example,n.allowReserved)})}function b4(t,e,n){if(e===void 0)return[Ey(t,"",!1,n)];const r=Iy(e,t);return r.length===0?[Ey(t,"",!1,n)]:r.map(i=>Ey(i.key,i.value,!0,n))}function Iy(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((n,r)=>n!==null&&typeof n=="object"?Iy(n,`${e}[${r}]`):[{key:e,value:String(n)}]):pG(t)?Object.entries(t).flatMap(([n,r])=>Iy(r,`${e}[${n}]`)):[{key:e,value:String(t)}]}function pG(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ey(t,e,n,r){return{id:crypto.randomUUID(),key:t,value:g4(e),active:n,in:"query",...r&&{allowReserved:r}}}const x4={path:"path",query:"query",header:"headers",cookie:"cookie"};function Ry(t){return t!==void 0}function fG(t,e){if(t)return Nf(t)?t:t[e]}function w4(t,e,n){const r=n[x4[e]],i=n.envVariables,o=new Set;for(const s of t??[])(r?.[s.name]||i?.[s.name])&&o.add(s.name);return o}function Rc(t,e,n){if(Nf(n))return w4(t,e,n);const r=new Set;for(const i of Object.values(n))if(i)for(const o of w4(t,e,i))r.add(o);return r}function S4(t,e,n){const r=n.query,i=n.envVariables;for(const o of e??[]){const s=v4(o);for(const a of s)(r?.[a.name]||i?.[a.name])&&t.add(a.name);for(const a of[...Object.keys(r??{}),...Object.keys(i??{})])!r?.[a]&&!i?.[a]||s.some(l=>a===l.name||a.startsWith(`${l.name}[`))&&t.add(a)}}function k4(t,e,n){const r=[...t??[],...e??[]],i=new Set(Rc(r,"query",n));if(Nf(n))return S4(i,e,n),i;for(const o of Object.values(n))o&&S4(i,e,o);return i}const C4=1024;let gG=0,Ii=class{constructor(t,e){this.from=t,this.to=e}};class gt{constructor(e={}){this.id=gG++,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=jr.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}gt.closedBy=new gt({deserialize:t=>t.split(" ")}),gt.openedBy=new gt({deserialize:t=>t.split(" ")}),gt.group=new gt({deserialize:t=>t.split(" ")}),gt.isolate=new gt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),gt.contextHash=new gt({perNode:!0}),gt.lookAhead=new gt({perNode:!0}),gt.mounted=new gt({perNode:!0});class th{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[gt.mounted.id]}}const mG=Object.create(null);class jr{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):mG,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new jr(e.name||"",n,e.id,r);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(i)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[o[0].id]=o[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(gt.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(gt.group),o=-1;o<(i?i.length:0);o++){let s=n[o<0?r.name:i[o]];if(s)return s}}}}jr.none=new jr("",Object.create(null),0,8);class N0{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 o of e){let s=o(r);s&&(i||(i=Object.assign({},r.props)),i[s[0].id]=s[1])}n.push(i?new jr(r.name,i,r.id,r.flags):r)}return new N0(n)}}const $g=new WeakMap,P4=new WeakMap;var Lt;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(Lt||(Lt={}));let Yt=class RC{constructor(e,n,r,i,o){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,o&&o.length){this.props=Object.create(null);for(let[s,a]of o)this.props[typeof s=="number"?s:s.id]=a}}toString(){let e=th.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 Qg(this.topNode,e)}cursorAt(e,n=0,r=0){let i=$g.get(this)||this.topNode,o=new Qg(i);return o.moveTo(e,n),$g.set(this,o._tree),o}get topNode(){return new Ei(this,0,0,null)}resolve(e,n=0){let r=nh($g.get(this)||this.topNode,e,n,!1);return $g.set(this,r),r}resolveInner(e,n=0){let r=nh(P4.get(this)||this.topNode,e,n,!0);return P4.set(this,r),r}resolveStack(e,n=0){return yG(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:o=this.length}=e,s=e.mode||0,a=(s&Lt.IncludeAnonymous)>0;for(let l=this.cursor(s|Lt.IncludeAnonymous);;){let c=!1;if(l.from<=o&&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:My(jr.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new RC(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new RC(jr.none,n,r,i)))}static build(e){return bG(e)}};Yt.empty=new Yt(jr.none,[],[],0);class MC{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 MC(this.buffer,this.index)}}class el{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return jr.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],o=i.name;if(/\W/.test(o)&&!i.isError&&(o=JSON.stringify(o)),e+=4,r==e)return o;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return o+"("+s.join(",")+")"}findChild(e,n,r,i,o){let{buffer:s}=this,a=-1;for(let l=e;l!=n&&!($4(o,i,s[l+1],s[l+2])&&(a=l,r>0));l=s[l+3]);return a}slice(e,n,r){let i=this.buffer,o=new Uint16Array(n-e),s=0;for(let a=e,l=0;a<n;){o[l++]=i[a++],o[l++]=i[a++]-r;let c=o[l++]=i[a++]-r;o[l++]=i[a++]-e,s=Math.max(s,c)}return new el(o,s,this.set)}}function $4(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 nh(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 s=!r&&t instanceof Ei&&t.index<0?null:t.parent;if(!s)return t;t=s}let o=r?0:Lt.IgnoreOverlays;if(r)for(let s=t,a=s.parent;a;s=a,a=s.parent)s instanceof Ei&&s.index<0&&((i=a.enter(e,n,o))===null||i===void 0?void 0:i.from)!=s.from&&(t=a);for(;;){let s=t.enter(e,n,o);if(!s)return t;t=s}}class Q4{cursor(e=0){return new Qg(this,e)}getChild(e,n=null,r=null){let i=j4(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return j4(this,e,n,r)}resolve(e,n=0){return nh(this,e,n,!1)}resolveInner(e,n=0){return nh(this,e,n,!0)}matchContext(e){return Ay(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 Ei=class q0 extends Q4{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,o=0){for(let s=this;;){for(let{children:a,positions:l}=s._tree,c=n>0?a.length:-1;e!=c;e+=n){let d=a[e],h=l[e]+s.from;if($4(i,r,h,h+d.length)){if(d instanceof el){if(o&Lt.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,n,r-h,i);if(p>-1)return new vs(new OG(s,d,e,h),null,p)}else if(o&Lt.IncludeAnonymous||!d.type.isAnonymous||Dy(d)){let p;if(!(o&Lt.IgnoreMounts)&&(p=th.get(d))&&!p.overlay)return new q0(p.tree,h,e,s);let f=new q0(d,h,e,s);return o&Lt.IncludeAnonymous||!f.type.isAnonymous?f:f.nextChild(n<0?d.children.length-1:0,n,r,i)}}}if(o&Lt.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+n:e=n<0?-1:s._parent._tree.children.length,s=s._parent,!s))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&Lt.IgnoreOverlays)&&(i=th.get(this._tree))&&i.overlay){let o=e-this.from;for(let{from:s,to:a}of i.overlay)if((n>0?s<=o:s<o)&&(n<0?a>=o:a>o))return new q0(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 j4(t,e,n,r){let i=t.cursor(),o=[];if(!i.firstChild())return o;if(n!=null){for(let s=!1;!s;)if(s=i.type.is(n),!i.nextSibling())return o}for(;;){if(r!=null&&i.type.is(r))return o;if(i.type.is(e)&&o.push(i.node),!i.nextSibling())return r==null?o:[]}}function Ay(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 OG{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class vs extends Q4{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,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return o<0?null:new vs(this.context,this,o)}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&Lt.ExcludeBuffers)return null;let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return o<0?null:new vs(this.context,this,o)}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 vs(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 vs(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,o=r.buffer[this.index+3];if(o>i){let s=r.buffer[this.index+1];e.push(r.slice(i,o,s)),n.push(0)}return new Yt(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function T4(t){if(!t.length)return null;let e=0,n=t[0];for(let o=1;o<t.length;o++){let s=t[o];(s.from>n.from||s.to<n.to)&&(n=s,e=o)}let r=n instanceof Ei&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new vG(i,n)}class vG{constructor(e,n){this.heads=e,this.node=n}get next(){return T4(this.heads)}}function yG(t,e,n){let r=t.resolveInner(e,n),i=null;for(let o=r instanceof Ei?r:r.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(i||(i=[r])).push(s.resolve(e,n)),o=s}else{let s=th.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let a=new Ei(s.tree,s.overlay[0].from+o.from,-1,o);(i||(i=[r])).push(nh(a,e,n,!1))}}return i?T4(i):r}class Qg{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 Ei)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 Ei?(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,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}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&Lt.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Lt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Lt.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 o=0;o<this.index;o++)if(i.buffer.buffer[o+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 o=n+e,s=e<0?-1:r._tree.children.length;o!=s;o+=e){let a=r._tree.children[o];if(this.mode&Lt.IncludeAnonymous||a instanceof el||!a.type.isAnonymous||Dy(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,o=this.stack.length;o>=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;n=s,r=o+1;break e}i=this.stack[--o]}for(let i=r;i<this.stack.length;i++)n=new vs(this.buffer,n,this.stack[i]);return this.bufferNode=new vs(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 Ay(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,o=this.stack.length-1;i>=0;o--){if(o<0)return Ay(this._tree,e,i);let s=r[n.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function Dy(t){return t.children.some(e=>e instanceof el||!e.type.isAnonymous||Dy(e))}function bG(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=C4,reused:o=[],minRepeatType:s=r.types.length}=t,a=Array.isArray(n)?new MC(n,n.length):n,l=r.types,c=0,d=0;function h(S,$,P,Q,T,q){let{id:_,start:E,end:A,size:R}=a,M=d,I=c;for(;R<0;)if(a.next(),R==-1){let W=o[_];P.push(W),Q.push(E-S);return}else if(R==-3){c=_;return}else if(R==-4){d=_;return}else throw new RangeError(`Unrecognized record size: ${R}`);let N=l[_],Z,L,U=E-S;if(A-E<=i&&(L=O(a.pos-$,T))){let W=new Uint16Array(L.size-L.skip),B=a.pos-L.size,Y=W.length;for(;a.pos>B;)Y=y(L.start,W,Y);Z=new el(W,A-L.start,r),U=L.start-S}else{let W=a.pos-R;a.next();let B=[],Y=[],ie=_>=s?_:-1,G=0,oe=A;for(;a.pos>W;)ie>=0&&a.id==ie&&a.size>=0?(a.end<=oe-i&&(m(B,Y,E,G,a.end,oe,ie,M,I),G=B.length,oe=a.end),a.next()):q>2500?p(E,W,B,Y):h(E,W,B,Y,ie,q+1);if(ie>=0&&G>0&&G<B.length&&m(B,Y,E,G,E,oe,ie,M,I),B.reverse(),Y.reverse(),ie>-1&&G>0){let K=f(N,I);Z=My(N,B,Y,0,B.length,0,A-E,K,K)}else Z=g(N,B,Y,A-E,M-A,I)}P.push(Z),Q.push(U)}function p(S,$,P,Q){let T=[],q=0,_=-1;for(;a.pos>$;){let{id:E,start:A,end:R,size:M}=a;if(M>4)a.next();else{if(_>-1&&A<_)break;_<0&&(_=R-i),T.push(E,A,R),q++,a.next()}}if(q){let E=new Uint16Array(q*4),A=T[T.length-2];for(let R=T.length-3,M=0;R>=0;R-=3)E[M++]=T[R],E[M++]=T[R+1]-A,E[M++]=T[R+2]-A,E[M++]=M;P.push(new el(E,T[2]-A,r)),Q.push(A-S)}}function f(S,$){return(P,Q,T)=>{let q=0,_=P.length-1,E,A;if(_>=0&&(E=P[_])instanceof Yt){if(!_&&E.type==S&&E.length==T)return E;(A=E.prop(gt.lookAhead))&&(q=Q[_]+E.length+A)}return g(S,P,Q,T,q,$)}}function m(S,$,P,Q,T,q,_,E,A){let R=[],M=[];for(;S.length>Q;)R.push(S.pop()),M.push($.pop()+P-T);S.push(g(r.types[_],R,M,q-T,E-q,A)),$.push(T-P)}function g(S,$,P,Q,T,q,_){if(q){let E=[gt.contextHash,q];_=_?[E].concat(_):[E]}if(T>25){let E=[gt.lookAhead,T];_=_?[E].concat(_):[E]}return new Yt(S,$,P,Q,_)}function O(S,$){let P=a.fork(),Q=0,T=0,q=0,_=P.end-i,E={size:0,start:0,skip:0};e:for(let A=P.pos-S;P.pos>A;){let R=P.size;if(P.id==$&&R>=0){E.size=Q,E.start=T,E.skip=q,q+=4,Q+=4,P.next();continue}let M=P.pos-R;if(R<0||M<A||P.start<_)break;let I=P.id>=s?4:0,N=P.start;for(P.next();P.pos>M;){if(P.size<0)if(P.size==-3)I+=4;else break e;else P.id>=s&&(I+=4);P.next()}T=N,Q+=R,q+=I}return($<0||Q==S)&&(E.size=Q,E.start=T,E.skip=q),E.size>4?E:void 0}function y(S,$,P){let{id:Q,start:T,end:q,size:_}=a;if(a.next(),_>=0&&Q<s){let E=P;if(_>4){let A=a.pos-(_-4);for(;a.pos>A;)P=y(S,$,P)}$[--P]=E,$[--P]=q-S,$[--P]=T-S,$[--P]=Q}else _==-3?c=Q:_==-4&&(d=Q);return P}let b=[],w=[];for(;a.pos>0;)h(t.start||0,t.bufferStart||0,b,w,-1,0);let k=(e=t.length)!==null&&e!==void 0?e:b.length?w[0]+b[0].length:0;return new Yt(l[t.topID],b.reverse(),w.reverse(),k)}const I4=new WeakMap;function jg(t,e){if(!t.isAnonymous||e instanceof el||e.type!=t)return 1;let n=I4.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Yt)){n=1;break}n+=jg(t,r)}I4.set(e,n)}return n}function My(t,e,n,r,i,o,s,a,l){let c=0;for(let m=r;m<i;m++)c+=jg(t,e[m]);let d=Math.ceil(c*1.5/8),h=[],p=[];function f(m,g,O,y,b){for(let w=O;w<y;){let k=w,S=g[w],$=jg(t,m[w]);for(w++;w<y;w++){let P=jg(t,m[w]);if($+P>=d)break;$+=P}if(w==k+1){if($>d){let P=m[k];f(P.children,P.positions,0,P.children.length,g[k]+b);continue}h.push(m[k])}else{let P=g[w-1]+m[w-1].length-S;h.push(My(t,m,g,k,w,S,P,null,l))}p.push(S+b-o)}}return f(e,n,r,i,0),(a||l)(h,p,s)}class zy{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 vs?this.setBuffer(e.context.buffer,e.index,n):e instanceof Ei&&this.map.set(e.tree,n)}get(e){return e instanceof vs?this.getBuffer(e.context.buffer,e.index):e instanceof Ei?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 oa{constructor(e,n,r,i,o=!1,s=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(o?1:0)|(s?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 oa(0,e.length,e,0,!1,r)];for(let o of n)o.to>e.length&&i.push(o);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],o=1,s=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let d=a<n.length?n[a]:null,h=d?d.fromA:1e9;if(h-l>=r)for(;s&&s.from<h;){let p=s;if(l>=p.from||h<=p.to||c){let f=Math.max(p.from,l)-c,m=Math.min(p.to,h)-c;p=f>=m?null:new oa(f,m,p.tree,p.offset+c,a>0,!!d)}if(p&&i.push(p),s.to>h)break;s=o<e.length?e[o++]:null}if(!d)break;l=d.toA,c=d.toA-d.toB}return i}}let _y=class{startParse(t,e,n){return typeof t=="string"&&(t=new xG(t)),n=n?n.length?n.map(r=>new Ii(r.from,r.to)):[new Ii(0,0)]:[new Ii(0,t.length)],this.createParse(t,e||[],n)}parse(t,e,n){let r=this.startParse(t,e,n);for(;;){let i=r.advance();if(i)return i}}};class xG{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 wG(t){return(e,n,r,i)=>new kG(e,t,n,r,i)}class E4{constructor(e,n,r,i,o){this.parser=e,this.parse=n,this.overlay=r,this.target=i,this.from=o}}function R4(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class SG{constructor(e,n,r,i,o,s,a){this.parser=e,this.predicate=n,this.mounts=r,this.index=i,this.start=o,this.target=s,this.prev=a,this.depth=0,this.ranges=[]}}const qy=new gt({perNode:!0});class kG{constructor(e,n,r,i,o){this.nest=n,this.input=r,this.fragments=i,this.ranges=o,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 Yt(r.type,r.children,r.positions,r.length,r.propValues.concat([[qy,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[gt.mounted.id]=new th(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 $G(this.fragments),n=null,r=null,i=new Qg(new Ei(this.baseTree,this.ranges[0].from,0,null),Lt.IncludeAnonymous|Lt.IgnoreMounts);e:for(let o,s;;){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(d=>d.frag.from<=i.from&&d.frag.to>=i.to&&d.mount.overlay);if(c)for(let d of c.mount.overlay){let h=d.from+c.pos,p=d.to+c.pos;h>=i.from&&p<=i.to&&!n.ranges.some(f=>f.from<p&&f.to>h)&&n.ranges.push({from:h,to:p})}}a=!1}else if(r&&(s=CG(r.ranges,i.from,i.to)))a=s!=2;else if(!i.type.isAnonymous&&(o=this.nest(i,this.input))&&(i.from<i.to||!o.overlay)){i.tree||PG(i);let c=e.findMounts(i.from,o.parser);if(typeof o.overlay=="function")n=new SG(o.parser,o.overlay,c,this.inner.length,i.from,i.tree,n);else{let d=M4(this.ranges,o.overlay||(i.from<i.to?[new Ii(i.from,i.to)]:[]));d.length&&R4(d),(d.length||!o.overlay)&&this.inner.push(new E4(o.parser,d.length?o.parser.startParse(this.input,z4(c,d),d):o.parser.startParse(""),o.overlay?o.overlay.map(h=>new Ii(h.from-i.from,h.to-i.from)):null,i.tree,d.length?d[0].from:i.from)),o.overlay?d.length&&(r={ranges:d,depth:0,prev:r}):a=!1}}else if(n&&(l=n.predicate(i))&&(l===!0&&(l=new Ii(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=M4(this.ranges,n.ranges);c.length&&(R4(c),this.inner.splice(n.index,0,new E4(n.parser,n.parser.startParse(this.input,z4(n.mounts,c),c),n.ranges.map(d=>new Ii(d.from-n.start,d.to-n.start)),n.target,c[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function CG(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 A4(t,e,n,r,i,o){if(e<n){let s=t.buffer[e+1];r.push(t.slice(e,n,s)),i.push(s-o)}}function PG(t){let{node:e}=t,n=[],r=e.context.buffer;do n.push(t.index),t.parent();while(!t.tree);let i=t.tree,o=i.children.indexOf(r),s=i.children[o],a=s.buffer,l=[o];function c(d,h,p,f,m,g){let O=n[g],y=[],b=[];A4(s,d,O,y,b,f);let w=a[O+1],k=a[O+2];l.push(y.length);let S=g?c(O+4,a[O+3],s.set.types[a[O]],w,k-w,g-1):e.toTree();return y.push(S),b.push(w-f),A4(s,a[O+3],h,y,b,f),new Yt(p,y,b,m)}i.children[o]=c(0,a.length,jr.none,0,s.length,n.length-1);for(let d of l){let h=t.tree.children[d],p=t.tree.positions[d];t.yield(new Ei(h,p+t.from,d,t._tree))}}class D4{constructor(e,n){this.offset=n,this.done=!1,this.cursor=e.cursor(Lt.IncludeAnonymous|Lt.IgnoreMounts)}moveTo(e){let{cursor:n}=this,r=e-this.offset;for(;!this.done&&n.from<r;)n.to>=e&&n.enter(r,1,Lt.IgnoreOverlays|Lt.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 Yt)n=n.children[0];else break}return!1}}let $G=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let n=this.curFrag=t[0];this.curTo=(e=n.tree.prop(qy))!==null&&e!==void 0?e:n.to,this.inner=new D4(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=(t=e.tree.prop(qy))!==null&&t!==void 0?t:e.to,this.inner=new D4(e.tree,-e.offset)}}findMounts(t,e){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let i=this.inner.cursor.node;i;i=i.parent){let o=(n=i.tree)===null||n===void 0?void 0:n.prop(gt.mounted);if(o&&o.parser==e)for(let s=this.fragI;s<this.fragments.length;s++){let a=this.fragments[s];if(a.from>=i.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:i.from-a.offset,mount:o})}}}return r}};function M4(t,e){let n=null,r=e;for(let i=1,o=0;i<t.length;i++){let s=t[i-1].to,a=t[i].from;for(;o<r.length;o++){let l=r[o];if(l.from>=a)break;l.to<=s||(n||(r=n=e.slice()),l.from<s?(n[o]=new Ii(l.from,s),l.to>a&&n.splice(o+1,0,new Ii(a,l.to))):l.to>a?n[o--]=new Ii(a,l.to):n.splice(o--,1))}}return r}function QG(t,e,n,r){let i=0,o=0,s=!1,a=!1,l=-1e9,c=[];for(;;){let d=i==t.length?1e9:s?t[i].to:t[i].from,h=o==e.length?1e9:a?e[o].to:e[o].from;if(s!=a){let p=Math.max(l,n),f=Math.min(d,h,r);p<f&&c.push(new Ii(p,f))}if(l=Math.min(d,h),l==1e9)break;d==l&&(s?(s=!1,i++):s=!0),h==l&&(a?(a=!1,o++):a=!0)}return c}function z4(t,e){let n=[];for(let{pos:r,mount:i,frag:o}of t){let s=r+(i.overlay?i.overlay[0].from:0),a=s+i.tree.length,l=Math.max(o.from,s),c=Math.min(o.to,a);if(i.overlay){let d=i.overlay.map(p=>new Ii(p.from+r,p.to+r)),h=QG(e,d,l,c);for(let p=0,f=l;;p++){let m=p==h.length,g=m?c:h[p].from;if(g>f&&n.push(new oa(f,g,i.tree,-s,o.from>=f||o.openStart,o.to<=g||o.openEnd)),m)break;f=h[p].to}}else n.push(new oa(l,c,i.tree,-s,o.from>=s||o.openStart,o.to<=a||o.openEnd))}return n}var _4={};class Z0{constructor(e,n,r,i,o,s,a,l,c,d=0,h){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=o,this.score=s,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=d,this.parent=h}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 Z0(e,[],n,r,r,0,[],0,i?new q4(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:o}=this.p,s=this.reducePos<this.pos-25;s&&this.setLookAhead(this.pos);let a=o.dynamicPrecedence(i);if(a&&(this.score+=a),r==0){this.pushState(o.getGoto(this.state,i,!0),this.reducePos),i<o.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,s?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,d=this.reducePos-c;d>=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSize<d&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=d));let h=l?this.stack[l-1]:0,p=this.bufferBase+this.buffer.length-h;if(i<o.minRepeatTerm||e&131072){let f=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,f,p+4,!0)}if(e&262144)this.state=this.stack[l];else{let f=this.stack[l-3];this.state=o.getGoto(f,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,c)}storeNode(e,n,r,i=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,a=this.buffer.length;if(a==0&&s.parent&&(a=s.bufferBase-s.parent.bufferBase,s=s.parent),a>0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(n==r)return;if(s.buffer[a-2]>=n){s.buffer[a-2]=r;return}}}if(!o||this.pos==r)this.buffer.push(e,n,r,i);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0){let a=!1;for(let l=s;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;s>0&&this.buffer[s-2]>r;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,i>4&&(i-=4)}this.buffer[s]=e,this.buffer[s+1]=n,this.buffer[s+2]=r,this.buffer[s+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:s}=this.p;(i>this.pos||n<=s.maxNode)&&(this.pos=i,s.stateFlag(o,1)||(this.reducePos=i)),this.pushState(o,r),this.shiftContext(n,r),n<=s.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 Z0(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 jG(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 o=0,s;o<n.length;o+=2)(s=n[o+1])!=this.state&&this.p.parser.hasAction(s,e)&&i.push(n[o],s);if(this.stack.length<120)for(let o=0;i.length<8&&o<n.length;o+=2){let s=n[o+1];i.some((a,l)=>l&1&&a==s)||i.push(n[o],s)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let o=n[i+1];if(o==this.state)continue;let s=this.split();s.pushState(o,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(n[i],this.pos),s.reducePos=this.pos,s.score-=200,r.push(s)}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,o=this.stack.length-r*3;if(o<0||e.getGoto(this.stack[o],i,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;n=s}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,o)=>{if(!n.includes(i))return n.push(i),e.allActions(i,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-o;if(a>1){let l=s&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(s,o+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 q4(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 q4{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class jG{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 X0{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 X0(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 X0(this.stack,this.pos,this.index)}}function rh(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let o=0;for(;;){let s=t.charCodeAt(r++),a=!1;if(s==126){o=65535;break}s>=92&&s--,s>=34&&s--;let l=s-32;if(l>=46&&(l-=46,a=!0),o+=l,a)break;o*=46}n?n[i++]=o:n=new e(o)}return n}class Tg{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const N4=new Tg;class TG{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=N4,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,o=this.pos+e;for(;o<r.from;){if(!i)return null;let s=this.ranges[--i];o-=r.from-s.to,r=s}for(;n<0?o>r.to:o>=r.to;){if(i==this.ranges.length-1)return null;let s=this.ranges[++i];o+=s.from-r.to,r=s}return o}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 o=this.resolveOffset(e,1);if(o==null)return-1;if(r=o,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let s=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++s];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=N4,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 Ac{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;Z4(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Ac.prototype.contextual=Ac.prototype.fallback=Ac.prototype.extend=!1;class Ig{constructor(e,n,r){this.precTable=n,this.elseToken=r,this.data=typeof e=="string"?rh(e):e}token(e,n){let r=e.pos,i=0;for(;;){let o=e.next<0,s=e.resolveOffset(1,1);if(Z4(this.data,e,n,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(o||i++,s==null)break;e.reset(s,e.token)}i&&(e.reset(r,e.token),e.acceptToken(this.elseToken,i))}}Ig.prototype.contextual=Ac.prototype.fallback=Ac.prototype.extend=!1;class Pn{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function Z4(t,e,n,r,i,o){let s=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;(a&t[s])!=0;){let c=t[s+1];for(let f=s+3;f<c;f+=2)if((t[f+1]&a)>0){let m=t[f];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||IG(m,e.token.value,i,o))){e.acceptToken(m);break}}let d=e.next,h=0,p=t[s+2];if(e.next<0&&p>h&&t[c+p*3-3]==65535){s=t[c+p*3-1];continue e}for(;h<p;){let f=h+p>>1,m=c+f+(f<<1),g=t[m],O=t[m+1]||65536;if(d<g)p=f;else if(d>=O)h=f+1;else{s=t[m+2],e.advance();continue e}}break}}function X4(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function IG(t,e,n,r){let i=X4(n,r,e);return i<0||X4(n,r,t)<i}const li=typeof process<"u"&&_4&&/\bparse\b/.test(_4.LOG);let Ny=null;function V4(t,e,n){let r=t.cursor(Lt.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 EG{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?V4(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?V4(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 o=r.children[i],s=this.start[n]+r.positions[i];if(s>e)return this.nextStart=s,null;if(o instanceof Yt){if(s==e){if(s<this.safeFrom)return null;let a=s+o.length;if(a<=this.safeTo){let l=o.prop(gt.lookAhead);if(!l||a+l<this.fragment.to)return o}}this.index[n]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+o.length}}}class RG{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Tg)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:o}=i,s=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<o.length;c++){if((1<<c&s)==0)continue;let d=o[c],h=this.tokens[c];if(!(r&&!d.fallback)&&((d.contextual||h.start!=e.pos||h.mask!=s||h.context!=a)&&(this.updateCachedToken(h,d,e),h.mask=s,h.context=a),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let p=n;if(h.extended>-1&&(n=this.addActions(e,h.extended,h.end,n)),n=this.addActions(e,h.value,h.end,n),!d.extend&&(r=h,n>p))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new Tg,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 Tg,{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:o}=r.p;for(let s=0;s<o.specialized.length;s++)if(o.specialized[s]==e.value){let a=o.specializers[s](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 o=0;o<i;o+=3)if(this.actions[o]==e)return i;return this.actions[i++]=e,this.actions[i++]=n,this.actions[i++]=r,i}addActions(e,n,r,i){let{state:o}=e,{parser:s}=e.p,{data:a}=s;for(let l=0;l<2;l++)for(let c=s.stateSlot(o,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=As(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(As(a,c+2),n,r,i));break}a[c]==n&&(i=this.putAction(As(a,c+1),n,r,i))}return i}}let AG=class{constructor(t,e,n,r){this.parser=t,this.input=e,this.ranges=r,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 TG(e,r),this.tokens=new RG(t,this.stream),this.topTerm=t.top[1];let{from:i}=r[0];this.stacks=[Z0.start(this,t.top[0],i)],this.fragments=n.length&&this.stream.end-i>t.bufferLength*4?new EG(n,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&t.length==1){let[o]=t;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<t.length;o++){let s=t[o];for(;;){if(this.tokens.mainToken=null,s.pos>e)n.push(s);else{if(this.advanceStack(s,n,t))continue;{r||(r=[],i=[]),r.push(s);let a=this.tokens.getMainToken(s);i.push(a.value,a.end)}}break}}if(!n.length){let o=r&&MG(r);if(o)return li&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw li&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(o)return li&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((s,a)=>a.score-s.score);n.length>o;)n.pop();n.some(s=>s.reducePos>e)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let s=n[o];for(let a=o+1;a<n.length;a++){let l=n[a];if(s.sameState(l)||s.buffer.length>500&&l.buffer.length>500)if((s.score-l.score||s.buffer.length-l.buffer.length)>0)n.splice(a--,1);else{n.splice(o--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let o=1;o<n.length;o++)n[o].pos<this.minStackPos&&(this.minStackPos=n[o].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,n){let r=t.pos,{parser:i}=this,o=li?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let l=t.curContext&&t.curContext.tracker.strict,c=l?t.curContext.hash:0;for(let d=this.fragments.nodeAt(r);d;){let h=this.parser.nodeSet.types[d.type.id]==d.type?i.getGoto(t.state,d.type.id):-1;if(h>-1&&d.length&&(!l||(d.prop(gt.contextHash)||0)==c))return t.useNode(d,h),li&&console.log(o+this.stackID(t)+` (via reuse of ${i.getName(d.type.id)})`),!0;if(!(d instanceof Yt)||d.children.length==0||d.positions[0]>0)break;let p=d.children[0];if(p instanceof Yt&&d.positions[0]==0)d=p;else break}}let s=i.stateSlot(t.state,4);if(s>0)return t.reduce(s),li&&console.log(o+this.stackID(t)+` (via always-reduce ${i.getName(s&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let l=0;l<a.length;){let c=a[l++],d=a[l++],h=a[l++],p=l==a.length||!n,f=p?t:t.split(),m=this.tokens.mainToken;if(f.apply(c,d,m?m.start:f.pos,h),li&&console.log(o+this.stackID(f)+` (via ${(c&65536)==0?"shift":`reduce of ${i.getName(c&65535)}`} for ${i.getName(d)} @ ${r}${f==t?"":", split"})`),p)return!0;f.pos>r?e.push(f):n.push(f)}return!1}advanceFully(t,e){let n=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>n)return U4(t,e),!0}}runRecovery(t,e,n){let r=null,i=!1;for(let o=0;o<t.length;o++){let s=t[o],a=e[o<<1],l=e[(o<<1)+1],c=li?this.stackID(s)+" -> ":"";if(s.deadEnd&&(i||(i=!0,s.restart(),li&&console.log(c+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))))continue;let d=s.split(),h=c;for(let p=0;d.forceReduce()&&p<10&&(li&&console.log(h+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,n));p++)li&&(h=this.stackID(d)+" -> ");for(let p of s.recoverByInsert(a))li&&console.log(c+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,n);this.stream.end>s.pos?(l==s.pos&&(l++,a=0),s.recoverByDelete(a,l),li&&console.log(c+this.stackID(s)+` (via recover-delete ${this.parser.getName(a)})`),U4(s,n)):(!r||r.score<s.score)&&(r=s)}return r}stackToTree(t){return t.close(),Yt.build({buffer:X0.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(Ny||(Ny=new WeakMap)).get(t);return e||Ny.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}};function U4(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 DG{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}const Zy=t=>t;class ih{constructor(e){this.start=e.start,this.shift=e.shift||Zy,this.reduce=e.reduce||Zy,this.reuse=e.reuse||Zy,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Po extends _y{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 o(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=gt[l]);for(let c=1;c<a.length;){let d=a[c++];if(d>=0)o(d,l,a[c++]);else{let h=a[c+-d];for(let p=-d;p>0;p--)o(a[c++],l,h);c++}}}this.nodeSet=new N0(n.map((a,l)=>jr.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=C4;let s=rh(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(W4),this.states=rh(e.states,Uint32Array),this.data=rh(e.stateData),this.goto=rh(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Ac(s,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 AG(this,e,n,r);for(let o of this.wrappers)i=o(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let o=i[n+1];;){let s=i[o++],a=s&1,l=i[o++];if(a&&r)return l;for(let c=o+(s>>1);o<c;o++)if(i[o]==e)return l;if(a)return-1}}hasAction(e,n){let r=this.data;for(let i=0;i<2;i++)for(let o=this.stateSlot(e,i?2:1),s;;o+=3){if((s=r[o])==65535)if(r[o+1]==1)s=r[o=As(r,o+2)];else{if(r[o+1]==2)return As(r,o+2);break}if(s==n||s==0)return As(r,o+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 o=this.stateSlot(e,1);i==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=As(this.data,o+2);else break;i=n(As(this.data,o+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=As(this.data,r+2);else break;if((this.data[r+2]&1)==0){let i=this.data[r+1];n.some((o,s)=>s&1&&o==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(Po.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(o=>o.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let o=e.specializers.find(a=>a.from==r.external);if(!o)return r;let s=Object.assign(Object.assign({},r),{external:o.to});return n.specializers[i]=W4(s),s})),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 o of e.split(" ")){let s=n.indexOf(o);s>=0&&(r[s]=!0)}let i=null;for(let o=0;o<n.length;o++)if(!r[o])for(let s=this.dialects[n[o]],a;(a=this.data[s++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new DG(e,r,i)}static deserialize(e){return new Po(e)}}function As(t,e){return t[e]|t[e+1]<<16}function MG(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 W4(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}let zG=0,Ds=class AC{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=zG++}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 AC&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let i=new AC(r,[],null,[]);if(i.set.push(i),n)for(let o of n.set)i.set.push(o);return i}static defineModifier(e){let n=new V0(e);return r=>r.modified.indexOf(n)>-1?r:V0.get(r.base||r,r.modified.concat(n).sort((i,o)=>i.id-o.id))}},_G=0;class V0{constructor(e){this.name=e,this.instances=[],this.id=_G++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&qG(n,a.modified));if(r)return r;let i=[],o=new Ds(e.name,i,e,n);for(let a of n)a.instances.push(o);let s=NG(n);for(let a of e.set)if(!a.modified.length)for(let l of s)i.push(V0.get(a,l));return o}}function qG(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function NG(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 Ms(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 o=[],s=2,a=i;for(let h=0;;){if(a=="..."&&h>0&&h+3==i.length){s=1;break}let p=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!p)throw new RangeError("Invalid path: "+i);if(o.push(p[0]=="*"?"":p[0][0]=='"'?JSON.parse(p[0]):p[0]),h+=p[0].length,h==i.length)break;let f=i[h++];if(h==i.length&&f=="!"){s=0;break}if(f!="/")throw new RangeError("Invalid path: "+i);a=i.slice(h)}let l=o.length-1,c=o[l];if(!c)throw new RangeError("Invalid path: "+i);let d=new Eg(r,s,l>0?o.slice(0,l):null);e[c]=d.sort(e[c])}}return L4.add(e)}const L4=new gt;class Eg{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}}Eg.empty=new Eg([],2,null);function Y4(t,e){let n=Object.create(null);for(let o of t)if(!Array.isArray(o.tag))n[o.tag.id]=o.class;else for(let s of o.tag)n[s.id]=o.class;let{scope:r,all:i=null}=e||{};return{style:o=>{let s=i;for(let a of o)for(let l of a.set){let c=n[l.id];if(c){s=s?s+" "+c:c;break}}return s},scope:r}}function ZG(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function XG(t,e,n,r=0,i=t.length){let o=new VG(r,Array.isArray(e)?e:[e],n);o.highlightRange(t.cursor(),r,i,"",o.highlighters),o.flush(i)}class VG{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,o){let{type:s,from:a,to:l}=e;if(a>=r||l<=n)return;s.isTop&&(o=this.highlighters.filter(f=>!f.scope||f.scope(s)));let c=i,d=UG(e)||Eg.empty,h=ZG(o,d.tags);if(h&&(c&&(c+=" "),c+=h,d.mode==1&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(n,a),c),d.opaque)return;let p=e.tree&&e.tree.prop(gt.mounted);if(p&&p.overlay){let f=e.node.enter(p.overlay[0].from+a,1),m=this.highlighters.filter(O=>!O.scope||O.scope(p.tree.type)),g=e.firstChild();for(let O=0,y=a;;O++){let b=O<p.overlay.length?p.overlay[O]:null,w=b?b.from+a:l,k=Math.max(n,y),S=Math.min(r,w);if(k<S&&g)for(;e.from<S&&(this.highlightRange(e,k,S,i,o),this.startSpan(Math.min(S,e.to),c),!(e.to>=w||!e.nextSibling())););if(!b||w>r)break;y=b.to+a,y>n&&(this.highlightRange(f.cursor(),Math.max(n,b.from+a),Math.min(r,y),"",m),this.startSpan(Math.min(r,y),c))}g&&e.parent()}else if(e.firstChild()){p&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,o),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function UG(t){let e=t.type.prop(L4);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ee=Ds.define,Rg=Ee(),$a=Ee(),B4=Ee($a),F4=Ee($a),Qa=Ee(),Ag=Ee(Qa),Xy=Ee(Qa),Uo=Ee(),yl=Ee(Uo),Wo=Ee(),Lo=Ee(),Vy=Ee(),oh=Ee(Vy),Dg=Ee(),j={comment:Rg,lineComment:Ee(Rg),blockComment:Ee(Rg),docComment:Ee(Rg),name:$a,variableName:Ee($a),typeName:B4,tagName:Ee(B4),propertyName:F4,attributeName:Ee(F4),className:Ee($a),labelName:Ee($a),namespace:Ee($a),macroName:Ee($a),literal:Qa,string:Ag,docString:Ee(Ag),character:Ee(Ag),attributeValue:Ee(Ag),number:Xy,integer:Ee(Xy),float:Ee(Xy),bool:Ee(Qa),regexp:Ee(Qa),escape:Ee(Qa),color:Ee(Qa),url:Ee(Qa),keyword:Wo,self:Ee(Wo),null:Ee(Wo),atom:Ee(Wo),unit:Ee(Wo),modifier:Ee(Wo),operatorKeyword:Ee(Wo),controlKeyword:Ee(Wo),definitionKeyword:Ee(Wo),moduleKeyword:Ee(Wo),operator:Lo,derefOperator:Ee(Lo),arithmeticOperator:Ee(Lo),logicOperator:Ee(Lo),bitwiseOperator:Ee(Lo),compareOperator:Ee(Lo),updateOperator:Ee(Lo),definitionOperator:Ee(Lo),typeOperator:Ee(Lo),controlOperator:Ee(Lo),punctuation:Vy,separator:Ee(Vy),bracket:oh,angleBracket:Ee(oh),squareBracket:Ee(oh),paren:Ee(oh),brace:Ee(oh),content:Uo,heading:yl,heading1:Ee(yl),heading2:Ee(yl),heading3:Ee(yl),heading4:Ee(yl),heading5:Ee(yl),heading6:Ee(yl),contentSeparator:Ee(Uo),list:Ee(Uo),quote:Ee(Uo),emphasis:Ee(Uo),strong:Ee(Uo),link:Ee(Uo),monospace:Ee(Uo),strikethrough:Ee(Uo),inserted:Ee(),deleted:Ee(),changed:Ee(),invalid:Ee(),meta:Dg,documentMeta:Ee(Dg),annotation:Ee(Dg),processingInstruction:Ee(Dg),definition:Ds.defineModifier("definition"),constant:Ds.defineModifier("constant"),function:Ds.defineModifier("function"),standard:Ds.defineModifier("standard"),local:Ds.defineModifier("local"),special:Ds.defineModifier("special")};for(let t in j){let e=j[t];e instanceof Ds&&(e.name=t)}Y4([{tag:j.link,class:"tok-link"},{tag:j.heading,class:"tok-heading"},{tag:j.emphasis,class:"tok-emphasis"},{tag:j.strong,class:"tok-strong"},{tag:j.keyword,class:"tok-keyword"},{tag:j.atom,class:"tok-atom"},{tag:j.bool,class:"tok-bool"},{tag:j.url,class:"tok-url"},{tag:j.labelName,class:"tok-labelName"},{tag:j.inserted,class:"tok-inserted"},{tag:j.deleted,class:"tok-deleted"},{tag:j.literal,class:"tok-literal"},{tag:j.string,class:"tok-string"},{tag:j.number,class:"tok-number"},{tag:[j.regexp,j.escape,j.special(j.string)],class:"tok-string2"},{tag:j.variableName,class:"tok-variableName"},{tag:j.local(j.variableName),class:"tok-variableName tok-local"},{tag:j.definition(j.variableName),class:"tok-variableName tok-definition"},{tag:j.special(j.variableName),class:"tok-variableName2"},{tag:j.definition(j.propertyName),class:"tok-propertyName tok-definition"},{tag:j.typeName,class:"tok-typeName"},{tag:j.namespace,class:"tok-namespace"},{tag:j.className,class:"tok-className"},{tag:j.macroName,class:"tok-macroName"},{tag:j.propertyName,class:"tok-propertyName"},{tag:j.operator,class:"tok-operator"},{tag:j.comment,class:"tok-comment"},{tag:j.meta,class:"tok-meta"},{tag:j.invalid,class:"tok-invalid"},{tag:j.punctuation,class:"tok-punctuation"}]);const WG=Ms({String:j.string,Number:j.number,"True False":j.bool,PropertyName:j.propertyName,Null:j.null,",":j.separator,"[ ]":j.squareBracket,"{ }":j.brace}),LG=Po.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:"\u26A0 JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[WG],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 Uy=[],G4=[];(()=>{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?G4:Uy).push(n=n+t[e])})();function YG(t){if(t<768)return!1;for(let e=0,n=Uy.length;;){let r=e+n>>1;if(t<Uy[r])n=r;else if(t>=G4[r])e=r+1;else return!0;if(e==n)return!1}}function H4(t){return t>=127462&&t<=127487}const K4=8205;function BG(t,e,n=!0,r=!0){return(n?J4:FG)(t,e,r)}function J4(t,e,n){if(e==t.length)return e;e&&e7(t.charCodeAt(e))&&t7(t.charCodeAt(e-1))&&e--;let r=Wy(t,e);for(e+=n7(r);e<t.length;){let i=Wy(t,e);if(r==K4||i==K4||n&&YG(i))e+=n7(i),r=i;else if(H4(i)){let o=0,s=e-2;for(;s>=0&&H4(Wy(t,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function FG(t,e,n){for(;e>0;){let r=J4(t,e-2,n);if(r<e)return r;e--}return 0}function Wy(t,e){let n=t.charCodeAt(e);if(!t7(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return e7(r)?(n-55296<<10)+(r-56320)+65536:n}function e7(t){return t>=56320&&t<57344}function t7(t){return t>=55296&&t<56320}function n7(t){return t<65536?1:2}let Mt=class uU{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]=Dc(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),ys.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]=Dc(this,e,n);let r=[];return this.decompose(e,n,r,0),ys.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 sh(this),o=new sh(e);for(let s=n,a=n;;){if(i.next(s),o.next(s),s=0,i.lineBreak!=o.lineBreak||i.done!=o.done||i.value!=o.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new sh(this,e)}iterRange(e,n=this.length){return new i7(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 o7(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]?uU.empty:e.length<=32?new En(e):ys.from(En.split(e,[]))}};class En extends Mt{constructor(e,n=GG(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 o=0;;o++){let s=this.text[o],a=i+s.length;if((n?r:a)>=e)return new HG(i,a,r,s);i=a+1,r++}}decompose(e,n,r,i){let o=e<=0&&n>=this.length?this:new En(r7(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let s=r.pop(),a=Mg(o.text,s.text.slice(),0,o.length);if(a.length<=32)r.push(new En(a,s.length+o.length));else{let l=a.length>>1;r.push(new En(a.slice(0,l)),new En(a.slice(l)))}}else r.push(o)}replace(e,n,r){if(!(r instanceof En))return super.replace(e,n,r);[e,n]=Dc(this,e,n);let i=Mg(this.text,Mg(r.text,r7(this.text,0,e)),n),o=this.length+r.length-(n-e);return i.length<=32?new En(i,o):ys.from(En.split(i,[]),o)}sliceString(e,n=this.length,r=`
333
+ `:""}return $y.dump=ue,$y}var c4;function eG(){if(c4)return yr;c4=1;const t=KF(),e=JF();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 yr.Type=Mr(),yr.Schema=k9(),yr.FAILSAFE_SCHEMA=E9(),yr.JSON_SCHEMA=V9(),yr.CORE_SCHEMA=L9(),yr.DEFAULT_SCHEMA=Py(),yr.load=t.load,yr.loadAll=t.loadAll,yr.dump=e.dump,yr.YAMLException=Hd(),yr.types={binary:K9(),float:N9(),map:T9(),null:A9(),pairs:n4(),set:i4(),timestamp:B9(),bool:M9(),int:_9(),merge:G9(),omap:e4(),seq:Q9(),str:P9()},yr.safeLoad=n("safeLoad","load"),yr.safeLoadAll=n("safeLoadAll","loadAll"),yr.safeDump=n("safeDump","dump"),yr}var tG=eG();const vl=GF(tG),Gr={FS:"fs",WEB:"web"};class Vt{static utils=null;static async getUtils(){return Vt.utils||(Vt.utils=an()?await import("./redocly-openapi-docs.min.tauri-path-BjTOYabX.js"):{join:bc.join,resolve:bc.resolve,isAbsolute:bc.isAbsolute,relative:bc.relative,extname:bc.extname,dirname:bc.dirname}),Vt.utils}static async dirname(e){return(await Vt.getUtils()).dirname(e)}static async join(...e){return(await Vt.getUtils()).join(...e)}static async resolve(e){return(await Vt.getUtils()).resolve(e)}static async isAbsolute(e){return(await Vt.getUtils()).isAbsolute(e)}static async relative(e,n){return(await Vt.getUtils()).relative(e,n)}static async extname(e){return(await Vt.getUtils()).extname(e)}}async function Sg(t,e){const[{bundle:n,Config:r},{ExternalResolver:i}]=await Promise.all([import("./redocly-openapi-docs.min.index-DQHVHxbB.js"),import("./redocly-openapi-docs.min.external-resolver-D89x3qoA.js")]),o=new r({});o.getRulesForSpecVersion=()=>[];const s=await Vt.dirname(t),a={config:o,base:s,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 u4(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function Qy(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function d4(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function Ti(t){try{return new URL(t),!0}catch{return!1}}function nG(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(u4(e))n=e;else if(!e.startsWith("/"))n=Qy(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return Qy(n)}function h4(t,e){let n=t;return e.forEach(({key:r,value:i,active:o})=>{i&&o&&(n=n.replaceAll(`{${r}}`,i))}),n}function p4(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function rG(t){return t.startsWith("http://")||t.startsWith("https://")}function kg({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(rG(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 jy{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),o=localStorage.getItem(r);o!==null&&(localStorage.setItem(i,o),localStorage.removeItem(r))}makeKey(e){return`replay:fs:${this.baseDir}/${e}`}on(e,n){}off(e,n){}}class iG{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 oG{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 f4{constructor(e){this.storage=e}storage;itemIds=[];async getAbsolutePath(e){return await Vt.resolve(await Vt.join(this.storage.baseDir,"/",e))}async parseMany(e,n){return(await Promise.all(e.map(async r=>{try{return await this.parse(r,n)}catch(i){return console.error(`Error parsing from ${r.type} ${r.uri}:`,i),null}}))).filter(r=>r!==null)}setItemIds(e){this.itemIds=e}async write(e){e.state===It.Draft||e.srcType!==Gr.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 o in r){const s=parseInt(o);switch(r[o]){case"D":await this.remove(this.itemIds[s]);break;case"I":case"U":await this.write(n[s]);break}}return}const i=this.itemIds.filter(o=>!n.some(s=>s.id===o));await Promise.all([...n.map(o=>this.write(o)),...i.map(o=>this.remove(o))])}async update(e,n){const r={path:e.path.slice(1),actions:e.actions};if(r.path.length===0&&await this.updateRoot(r,n),r.path.length>0){const i=r.path[0];r.path.length===1&&r.actions&&r.actions.id==="U"&&await this.remove(this.itemIds[i]),r.path[1]&&r.path[1]==="id"&&await this.remove(this.itemIds[i]),await this.write(n[i])}this.itemIds=n.map(i=>i.id)}}class sG extends f4{parse(e){return{...e.content,id:e.uri,srcType:e.type,fileDependencies:e.fileDependencies}}async stringify(e){const{id:n,srcType:r,fileDependencies:i,...o}=e;return await Vt.extname(n)===".json"?JSON.stringify(o,null,2):vl.dump(o)}async write(e){await this.storage.has(e.id)||await super.write(e)}}var nr=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(nr||{});const Kd={active:!0,key:"",value:""},aG=/[\n\r\t]/g;function g4(t){return t.replace(aG,"").trim()}function Vo(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?g4(String(n.example)):"",active:r?!0:!!n.example,in:n.in,...n.allowReserved&&{allowReserved:n.allowReserved}}})}function Jd(t,e){const[n]=t.split("?"),r=e.filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${n}${r?`?${r}`:""}`}function eh(t){const e=t.indexOf("?");if(e===-1)return[];const n=new URLSearchParams(t.slice(e+1)),r=[];for(const[i,o]of n.entries())r.push({id:crypto.randomUUID(),active:!0,key:i,value:o,in:"query"});return r}function m4(){return{id:crypto.randomUUID(),...Kd}}function lG(){return{id:crypto.randomUUID(),...Kd,description:""}}function Cg(t){return{...Kd,id:crypto.randomUUID(),in:t}}function cG(){return{id:crypto.randomUUID(),...Kd,type:"text",files:null}}function uG(){return{id:crypto.randomUUID(),...Kd,sendIn:Or.URL}}function Ty(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function Pg(t,e){return t.filter(n=>n.active&&n.value).map(({value:n})=>(e?tn(n,e):n).trim())}function Ca(t,e){const n=e.filter(r=>!!r).flatMap(r=>r).filter(r=>r.key&&r.active);return["path","header"].includes(t)?Array.from(new Map(n.map(r=>[r.key,r])).values()):n}function dG(t,e,n){return t.map(({value:r,...i})=>({...i,value:Au(r,e,n??{})}))}function hG(t,e){if(!t.startsWith("$components.parameters."))return null;const n=t.replace("$components.parameters.","");return n&&e[n]||null}function ln(t=[],e={}){const n=[];for(const r of t)if(ml(r)){const i=hG(r.reference,e);i&&n.push({...i,active:r.active,value:r.value||i.value})}else n.push(r);return n}function Pa(t){return Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:n}))}function O4(t){return t.schema}function v4(t){return O4(t)?.fields??[]}function y4(t,e){return t.flatMap(n=>{const r=O4(n),i=r?.fields||[];return i.length>0?i.flatMap(o=>b4(o.name,o.example,n.allowReserved)):b4(n.name,r?.example??n.example,n.allowReserved)})}function b4(t,e,n){if(e===void 0)return[Ey(t,"",!1,n)];const r=Iy(e,t);return r.length===0?[Ey(t,"",!1,n)]:r.map(i=>Ey(i.key,i.value,!0,n))}function Iy(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((n,r)=>n!==null&&typeof n=="object"?Iy(n,`${e}[${r}]`):[{key:e,value:String(n)}]):pG(t)?Object.entries(t).flatMap(([n,r])=>Iy(r,`${e}[${n}]`)):[{key:e,value:String(t)}]}function pG(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ey(t,e,n,r){return{id:crypto.randomUUID(),key:t,value:g4(e),active:n,in:"query",...r&&{allowReserved:r}}}const x4={path:"path",query:"query",header:"headers",cookie:"cookie"};function Ry(t){return t!==void 0}function fG(t,e){if(t)return Nf(t)?t:t[e]}function w4(t,e,n){const r=n[x4[e]],i=n.envVariables,o=new Set;for(const s of t??[])(r?.[s.name]||i?.[s.name])&&o.add(s.name);return o}function Rc(t,e,n){if(Nf(n))return w4(t,e,n);const r=new Set;for(const i of Object.values(n))if(i)for(const o of w4(t,e,i))r.add(o);return r}function S4(t,e,n){const r=n.query,i=n.envVariables;for(const o of e??[]){const s=v4(o);for(const a of s)(r?.[a.name]||i?.[a.name])&&t.add(a.name);for(const a of[...Object.keys(r??{}),...Object.keys(i??{})])!r?.[a]&&!i?.[a]||s.some(l=>a===l.name||a.startsWith(`${l.name}[`))&&t.add(a)}}function k4(t,e,n){const r=[...t??[],...e??[]],i=new Set(Rc(r,"query",n));if(Nf(n))return S4(i,e,n),i;for(const o of Object.values(n))o&&S4(i,e,o);return i}const C4=1024;let gG=0,Ii=class{constructor(t,e){this.from=t,this.to=e}};class gt{constructor(e={}){this.id=gG++,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=jr.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}gt.closedBy=new gt({deserialize:t=>t.split(" ")}),gt.openedBy=new gt({deserialize:t=>t.split(" ")}),gt.group=new gt({deserialize:t=>t.split(" ")}),gt.isolate=new gt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),gt.contextHash=new gt({perNode:!0}),gt.lookAhead=new gt({perNode:!0}),gt.mounted=new gt({perNode:!0});class th{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[gt.mounted.id]}}const mG=Object.create(null);class jr{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):mG,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new jr(e.name||"",n,e.id,r);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(i)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[o[0].id]=o[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(gt.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(gt.group),o=-1;o<(i?i.length:0);o++){let s=n[o<0?r.name:i[o]];if(s)return s}}}}jr.none=new jr("",Object.create(null),0,8);class N0{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 o of e){let s=o(r);s&&(i||(i=Object.assign({},r.props)),i[s[0].id]=s[1])}n.push(i?new jr(r.name,i,r.id,r.flags):r)}return new N0(n)}}const $g=new WeakMap,P4=new WeakMap;var Lt;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(Lt||(Lt={}));let Yt=class RC{constructor(e,n,r,i,o){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,o&&o.length){this.props=Object.create(null);for(let[s,a]of o)this.props[typeof s=="number"?s:s.id]=a}}toString(){let e=th.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 Qg(this.topNode,e)}cursorAt(e,n=0,r=0){let i=$g.get(this)||this.topNode,o=new Qg(i);return o.moveTo(e,n),$g.set(this,o._tree),o}get topNode(){return new Ei(this,0,0,null)}resolve(e,n=0){let r=nh($g.get(this)||this.topNode,e,n,!1);return $g.set(this,r),r}resolveInner(e,n=0){let r=nh(P4.get(this)||this.topNode,e,n,!0);return P4.set(this,r),r}resolveStack(e,n=0){return yG(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:o=this.length}=e,s=e.mode||0,a=(s&Lt.IncludeAnonymous)>0;for(let l=this.cursor(s|Lt.IncludeAnonymous);;){let c=!1;if(l.from<=o&&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:My(jr.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new RC(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new RC(jr.none,n,r,i)))}static build(e){return bG(e)}};Yt.empty=new Yt(jr.none,[],[],0);class MC{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 MC(this.buffer,this.index)}}class el{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return jr.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],o=i.name;if(/\W/.test(o)&&!i.isError&&(o=JSON.stringify(o)),e+=4,r==e)return o;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return o+"("+s.join(",")+")"}findChild(e,n,r,i,o){let{buffer:s}=this,a=-1;for(let l=e;l!=n&&!($4(o,i,s[l+1],s[l+2])&&(a=l,r>0));l=s[l+3]);return a}slice(e,n,r){let i=this.buffer,o=new Uint16Array(n-e),s=0;for(let a=e,l=0;a<n;){o[l++]=i[a++],o[l++]=i[a++]-r;let c=o[l++]=i[a++]-r;o[l++]=i[a++]-e,s=Math.max(s,c)}return new el(o,s,this.set)}}function $4(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 nh(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 s=!r&&t instanceof Ei&&t.index<0?null:t.parent;if(!s)return t;t=s}let o=r?0:Lt.IgnoreOverlays;if(r)for(let s=t,a=s.parent;a;s=a,a=s.parent)s instanceof Ei&&s.index<0&&((i=a.enter(e,n,o))===null||i===void 0?void 0:i.from)!=s.from&&(t=a);for(;;){let s=t.enter(e,n,o);if(!s)return t;t=s}}class Q4{cursor(e=0){return new Qg(this,e)}getChild(e,n=null,r=null){let i=j4(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return j4(this,e,n,r)}resolve(e,n=0){return nh(this,e,n,!1)}resolveInner(e,n=0){return nh(this,e,n,!0)}matchContext(e){return Ay(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 Ei=class q0 extends Q4{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,o=0){for(let s=this;;){for(let{children:a,positions:l}=s._tree,c=n>0?a.length:-1;e!=c;e+=n){let d=a[e],h=l[e]+s.from;if($4(i,r,h,h+d.length)){if(d instanceof el){if(o&Lt.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,n,r-h,i);if(p>-1)return new vs(new OG(s,d,e,h),null,p)}else if(o&Lt.IncludeAnonymous||!d.type.isAnonymous||Dy(d)){let p;if(!(o&Lt.IgnoreMounts)&&(p=th.get(d))&&!p.overlay)return new q0(p.tree,h,e,s);let f=new q0(d,h,e,s);return o&Lt.IncludeAnonymous||!f.type.isAnonymous?f:f.nextChild(n<0?d.children.length-1:0,n,r,i)}}}if(o&Lt.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+n:e=n<0?-1:s._parent._tree.children.length,s=s._parent,!s))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&Lt.IgnoreOverlays)&&(i=th.get(this._tree))&&i.overlay){let o=e-this.from;for(let{from:s,to:a}of i.overlay)if((n>0?s<=o:s<o)&&(n<0?a>=o:a>o))return new q0(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 j4(t,e,n,r){let i=t.cursor(),o=[];if(!i.firstChild())return o;if(n!=null){for(let s=!1;!s;)if(s=i.type.is(n),!i.nextSibling())return o}for(;;){if(r!=null&&i.type.is(r))return o;if(i.type.is(e)&&o.push(i.node),!i.nextSibling())return r==null?o:[]}}function Ay(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 OG{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class vs extends Q4{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,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return o<0?null:new vs(this.context,this,o)}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&Lt.ExcludeBuffers)return null;let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return o<0?null:new vs(this.context,this,o)}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 vs(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 vs(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,o=r.buffer[this.index+3];if(o>i){let s=r.buffer[this.index+1];e.push(r.slice(i,o,s)),n.push(0)}return new Yt(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function T4(t){if(!t.length)return null;let e=0,n=t[0];for(let o=1;o<t.length;o++){let s=t[o];(s.from>n.from||s.to<n.to)&&(n=s,e=o)}let r=n instanceof Ei&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new vG(i,n)}class vG{constructor(e,n){this.heads=e,this.node=n}get next(){return T4(this.heads)}}function yG(t,e,n){let r=t.resolveInner(e,n),i=null;for(let o=r instanceof Ei?r:r.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(i||(i=[r])).push(s.resolve(e,n)),o=s}else{let s=th.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let a=new Ei(s.tree,s.overlay[0].from+o.from,-1,o);(i||(i=[r])).push(nh(a,e,n,!1))}}return i?T4(i):r}class Qg{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 Ei)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 Ei?(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,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}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&Lt.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Lt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Lt.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 o=0;o<this.index;o++)if(i.buffer.buffer[o+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 o=n+e,s=e<0?-1:r._tree.children.length;o!=s;o+=e){let a=r._tree.children[o];if(this.mode&Lt.IncludeAnonymous||a instanceof el||!a.type.isAnonymous||Dy(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,o=this.stack.length;o>=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;n=s,r=o+1;break e}i=this.stack[--o]}for(let i=r;i<this.stack.length;i++)n=new vs(this.buffer,n,this.stack[i]);return this.bufferNode=new vs(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 Ay(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,o=this.stack.length-1;i>=0;o--){if(o<0)return Ay(this._tree,e,i);let s=r[n.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function Dy(t){return t.children.some(e=>e instanceof el||!e.type.isAnonymous||Dy(e))}function bG(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=C4,reused:o=[],minRepeatType:s=r.types.length}=t,a=Array.isArray(n)?new MC(n,n.length):n,l=r.types,c=0,d=0;function h(S,$,P,Q,T,q){let{id:_,start:E,end:A,size:R}=a,M=d,I=c;for(;R<0;)if(a.next(),R==-1){let W=o[_];P.push(W),Q.push(E-S);return}else if(R==-3){c=_;return}else if(R==-4){d=_;return}else throw new RangeError(`Unrecognized record size: ${R}`);let N=l[_],Z,L,U=E-S;if(A-E<=i&&(L=O(a.pos-$,T))){let W=new Uint16Array(L.size-L.skip),B=a.pos-L.size,Y=W.length;for(;a.pos>B;)Y=y(L.start,W,Y);Z=new el(W,A-L.start,r),U=L.start-S}else{let W=a.pos-R;a.next();let B=[],Y=[],ie=_>=s?_:-1,G=0,oe=A;for(;a.pos>W;)ie>=0&&a.id==ie&&a.size>=0?(a.end<=oe-i&&(m(B,Y,E,G,a.end,oe,ie,M,I),G=B.length,oe=a.end),a.next()):q>2500?p(E,W,B,Y):h(E,W,B,Y,ie,q+1);if(ie>=0&&G>0&&G<B.length&&m(B,Y,E,G,E,oe,ie,M,I),B.reverse(),Y.reverse(),ie>-1&&G>0){let K=f(N,I);Z=My(N,B,Y,0,B.length,0,A-E,K,K)}else Z=g(N,B,Y,A-E,M-A,I)}P.push(Z),Q.push(U)}function p(S,$,P,Q){let T=[],q=0,_=-1;for(;a.pos>$;){let{id:E,start:A,end:R,size:M}=a;if(M>4)a.next();else{if(_>-1&&A<_)break;_<0&&(_=R-i),T.push(E,A,R),q++,a.next()}}if(q){let E=new Uint16Array(q*4),A=T[T.length-2];for(let R=T.length-3,M=0;R>=0;R-=3)E[M++]=T[R],E[M++]=T[R+1]-A,E[M++]=T[R+2]-A,E[M++]=M;P.push(new el(E,T[2]-A,r)),Q.push(A-S)}}function f(S,$){return(P,Q,T)=>{let q=0,_=P.length-1,E,A;if(_>=0&&(E=P[_])instanceof Yt){if(!_&&E.type==S&&E.length==T)return E;(A=E.prop(gt.lookAhead))&&(q=Q[_]+E.length+A)}return g(S,P,Q,T,q,$)}}function m(S,$,P,Q,T,q,_,E,A){let R=[],M=[];for(;S.length>Q;)R.push(S.pop()),M.push($.pop()+P-T);S.push(g(r.types[_],R,M,q-T,E-q,A)),$.push(T-P)}function g(S,$,P,Q,T,q,_){if(q){let E=[gt.contextHash,q];_=_?[E].concat(_):[E]}if(T>25){let E=[gt.lookAhead,T];_=_?[E].concat(_):[E]}return new Yt(S,$,P,Q,_)}function O(S,$){let P=a.fork(),Q=0,T=0,q=0,_=P.end-i,E={size:0,start:0,skip:0};e:for(let A=P.pos-S;P.pos>A;){let R=P.size;if(P.id==$&&R>=0){E.size=Q,E.start=T,E.skip=q,q+=4,Q+=4,P.next();continue}let M=P.pos-R;if(R<0||M<A||P.start<_)break;let I=P.id>=s?4:0,N=P.start;for(P.next();P.pos>M;){if(P.size<0)if(P.size==-3)I+=4;else break e;else P.id>=s&&(I+=4);P.next()}T=N,Q+=R,q+=I}return($<0||Q==S)&&(E.size=Q,E.start=T,E.skip=q),E.size>4?E:void 0}function y(S,$,P){let{id:Q,start:T,end:q,size:_}=a;if(a.next(),_>=0&&Q<s){let E=P;if(_>4){let A=a.pos-(_-4);for(;a.pos>A;)P=y(S,$,P)}$[--P]=E,$[--P]=q-S,$[--P]=T-S,$[--P]=Q}else _==-3?c=Q:_==-4&&(d=Q);return P}let b=[],w=[];for(;a.pos>0;)h(t.start||0,t.bufferStart||0,b,w,-1,0);let k=(e=t.length)!==null&&e!==void 0?e:b.length?w[0]+b[0].length:0;return new Yt(l[t.topID],b.reverse(),w.reverse(),k)}const I4=new WeakMap;function jg(t,e){if(!t.isAnonymous||e instanceof el||e.type!=t)return 1;let n=I4.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Yt)){n=1;break}n+=jg(t,r)}I4.set(e,n)}return n}function My(t,e,n,r,i,o,s,a,l){let c=0;for(let m=r;m<i;m++)c+=jg(t,e[m]);let d=Math.ceil(c*1.5/8),h=[],p=[];function f(m,g,O,y,b){for(let w=O;w<y;){let k=w,S=g[w],$=jg(t,m[w]);for(w++;w<y;w++){let P=jg(t,m[w]);if($+P>=d)break;$+=P}if(w==k+1){if($>d){let P=m[k];f(P.children,P.positions,0,P.children.length,g[k]+b);continue}h.push(m[k])}else{let P=g[w-1]+m[w-1].length-S;h.push(My(t,m,g,k,w,S,P,null,l))}p.push(S+b-o)}}return f(e,n,r,i,0),(a||l)(h,p,s)}class zy{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 vs?this.setBuffer(e.context.buffer,e.index,n):e instanceof Ei&&this.map.set(e.tree,n)}get(e){return e instanceof vs?this.getBuffer(e.context.buffer,e.index):e instanceof Ei?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 oa{constructor(e,n,r,i,o=!1,s=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(o?1:0)|(s?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 oa(0,e.length,e,0,!1,r)];for(let o of n)o.to>e.length&&i.push(o);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],o=1,s=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let d=a<n.length?n[a]:null,h=d?d.fromA:1e9;if(h-l>=r)for(;s&&s.from<h;){let p=s;if(l>=p.from||h<=p.to||c){let f=Math.max(p.from,l)-c,m=Math.min(p.to,h)-c;p=f>=m?null:new oa(f,m,p.tree,p.offset+c,a>0,!!d)}if(p&&i.push(p),s.to>h)break;s=o<e.length?e[o++]:null}if(!d)break;l=d.toA,c=d.toA-d.toB}return i}}let _y=class{startParse(t,e,n){return typeof t=="string"&&(t=new xG(t)),n=n?n.length?n.map(r=>new Ii(r.from,r.to)):[new Ii(0,0)]:[new Ii(0,t.length)],this.createParse(t,e||[],n)}parse(t,e,n){let r=this.startParse(t,e,n);for(;;){let i=r.advance();if(i)return i}}};class xG{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 wG(t){return(e,n,r,i)=>new kG(e,t,n,r,i)}class E4{constructor(e,n,r,i,o){this.parser=e,this.parse=n,this.overlay=r,this.target=i,this.from=o}}function R4(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class SG{constructor(e,n,r,i,o,s,a){this.parser=e,this.predicate=n,this.mounts=r,this.index=i,this.start=o,this.target=s,this.prev=a,this.depth=0,this.ranges=[]}}const qy=new gt({perNode:!0});class kG{constructor(e,n,r,i,o){this.nest=n,this.input=r,this.fragments=i,this.ranges=o,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 Yt(r.type,r.children,r.positions,r.length,r.propValues.concat([[qy,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[gt.mounted.id]=new th(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 $G(this.fragments),n=null,r=null,i=new Qg(new Ei(this.baseTree,this.ranges[0].from,0,null),Lt.IncludeAnonymous|Lt.IgnoreMounts);e:for(let o,s;;){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(d=>d.frag.from<=i.from&&d.frag.to>=i.to&&d.mount.overlay);if(c)for(let d of c.mount.overlay){let h=d.from+c.pos,p=d.to+c.pos;h>=i.from&&p<=i.to&&!n.ranges.some(f=>f.from<p&&f.to>h)&&n.ranges.push({from:h,to:p})}}a=!1}else if(r&&(s=CG(r.ranges,i.from,i.to)))a=s!=2;else if(!i.type.isAnonymous&&(o=this.nest(i,this.input))&&(i.from<i.to||!o.overlay)){i.tree||PG(i);let c=e.findMounts(i.from,o.parser);if(typeof o.overlay=="function")n=new SG(o.parser,o.overlay,c,this.inner.length,i.from,i.tree,n);else{let d=M4(this.ranges,o.overlay||(i.from<i.to?[new Ii(i.from,i.to)]:[]));d.length&&R4(d),(d.length||!o.overlay)&&this.inner.push(new E4(o.parser,d.length?o.parser.startParse(this.input,z4(c,d),d):o.parser.startParse(""),o.overlay?o.overlay.map(h=>new Ii(h.from-i.from,h.to-i.from)):null,i.tree,d.length?d[0].from:i.from)),o.overlay?d.length&&(r={ranges:d,depth:0,prev:r}):a=!1}}else if(n&&(l=n.predicate(i))&&(l===!0&&(l=new Ii(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=M4(this.ranges,n.ranges);c.length&&(R4(c),this.inner.splice(n.index,0,new E4(n.parser,n.parser.startParse(this.input,z4(n.mounts,c),c),n.ranges.map(d=>new Ii(d.from-n.start,d.to-n.start)),n.target,c[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function CG(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 A4(t,e,n,r,i,o){if(e<n){let s=t.buffer[e+1];r.push(t.slice(e,n,s)),i.push(s-o)}}function PG(t){let{node:e}=t,n=[],r=e.context.buffer;do n.push(t.index),t.parent();while(!t.tree);let i=t.tree,o=i.children.indexOf(r),s=i.children[o],a=s.buffer,l=[o];function c(d,h,p,f,m,g){let O=n[g],y=[],b=[];A4(s,d,O,y,b,f);let w=a[O+1],k=a[O+2];l.push(y.length);let S=g?c(O+4,a[O+3],s.set.types[a[O]],w,k-w,g-1):e.toTree();return y.push(S),b.push(w-f),A4(s,a[O+3],h,y,b,f),new Yt(p,y,b,m)}i.children[o]=c(0,a.length,jr.none,0,s.length,n.length-1);for(let d of l){let h=t.tree.children[d],p=t.tree.positions[d];t.yield(new Ei(h,p+t.from,d,t._tree))}}class D4{constructor(e,n){this.offset=n,this.done=!1,this.cursor=e.cursor(Lt.IncludeAnonymous|Lt.IgnoreMounts)}moveTo(e){let{cursor:n}=this,r=e-this.offset;for(;!this.done&&n.from<r;)n.to>=e&&n.enter(r,1,Lt.IgnoreOverlays|Lt.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 Yt)n=n.children[0];else break}return!1}}let $G=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let n=this.curFrag=t[0];this.curTo=(e=n.tree.prop(qy))!==null&&e!==void 0?e:n.to,this.inner=new D4(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=(t=e.tree.prop(qy))!==null&&t!==void 0?t:e.to,this.inner=new D4(e.tree,-e.offset)}}findMounts(t,e){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let i=this.inner.cursor.node;i;i=i.parent){let o=(n=i.tree)===null||n===void 0?void 0:n.prop(gt.mounted);if(o&&o.parser==e)for(let s=this.fragI;s<this.fragments.length;s++){let a=this.fragments[s];if(a.from>=i.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:i.from-a.offset,mount:o})}}}return r}};function M4(t,e){let n=null,r=e;for(let i=1,o=0;i<t.length;i++){let s=t[i-1].to,a=t[i].from;for(;o<r.length;o++){let l=r[o];if(l.from>=a)break;l.to<=s||(n||(r=n=e.slice()),l.from<s?(n[o]=new Ii(l.from,s),l.to>a&&n.splice(o+1,0,new Ii(a,l.to))):l.to>a?n[o--]=new Ii(a,l.to):n.splice(o--,1))}}return r}function QG(t,e,n,r){let i=0,o=0,s=!1,a=!1,l=-1e9,c=[];for(;;){let d=i==t.length?1e9:s?t[i].to:t[i].from,h=o==e.length?1e9:a?e[o].to:e[o].from;if(s!=a){let p=Math.max(l,n),f=Math.min(d,h,r);p<f&&c.push(new Ii(p,f))}if(l=Math.min(d,h),l==1e9)break;d==l&&(s?(s=!1,i++):s=!0),h==l&&(a?(a=!1,o++):a=!0)}return c}function z4(t,e){let n=[];for(let{pos:r,mount:i,frag:o}of t){let s=r+(i.overlay?i.overlay[0].from:0),a=s+i.tree.length,l=Math.max(o.from,s),c=Math.min(o.to,a);if(i.overlay){let d=i.overlay.map(p=>new Ii(p.from+r,p.to+r)),h=QG(e,d,l,c);for(let p=0,f=l;;p++){let m=p==h.length,g=m?c:h[p].from;if(g>f&&n.push(new oa(f,g,i.tree,-s,o.from>=f||o.openStart,o.to<=g||o.openEnd)),m)break;f=h[p].to}}else n.push(new oa(l,c,i.tree,-s,o.from>=s||o.openStart,o.to<=a||o.openEnd))}return n}var _4={};class Z0{constructor(e,n,r,i,o,s,a,l,c,d=0,h){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=o,this.score=s,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=d,this.parent=h}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 Z0(e,[],n,r,r,0,[],0,i?new q4(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:o}=this.p,s=this.reducePos<this.pos-25;s&&this.setLookAhead(this.pos);let a=o.dynamicPrecedence(i);if(a&&(this.score+=a),r==0){this.pushState(o.getGoto(this.state,i,!0),this.reducePos),i<o.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,s?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,d=this.reducePos-c;d>=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSize<d&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=d));let h=l?this.stack[l-1]:0,p=this.bufferBase+this.buffer.length-h;if(i<o.minRepeatTerm||e&131072){let f=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,f,p+4,!0)}if(e&262144)this.state=this.stack[l];else{let f=this.stack[l-3];this.state=o.getGoto(f,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,c)}storeNode(e,n,r,i=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,a=this.buffer.length;if(a==0&&s.parent&&(a=s.bufferBase-s.parent.bufferBase,s=s.parent),a>0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(n==r)return;if(s.buffer[a-2]>=n){s.buffer[a-2]=r;return}}}if(!o||this.pos==r)this.buffer.push(e,n,r,i);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0){let a=!1;for(let l=s;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;s>0&&this.buffer[s-2]>r;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,i>4&&(i-=4)}this.buffer[s]=e,this.buffer[s+1]=n,this.buffer[s+2]=r,this.buffer[s+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:s}=this.p;(i>this.pos||n<=s.maxNode)&&(this.pos=i,s.stateFlag(o,1)||(this.reducePos=i)),this.pushState(o,r),this.shiftContext(n,r),n<=s.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 Z0(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 jG(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 o=0,s;o<n.length;o+=2)(s=n[o+1])!=this.state&&this.p.parser.hasAction(s,e)&&i.push(n[o],s);if(this.stack.length<120)for(let o=0;i.length<8&&o<n.length;o+=2){let s=n[o+1];i.some((a,l)=>l&1&&a==s)||i.push(n[o],s)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let o=n[i+1];if(o==this.state)continue;let s=this.split();s.pushState(o,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(n[i],this.pos),s.reducePos=this.pos,s.score-=200,r.push(s)}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,o=this.stack.length-r*3;if(o<0||e.getGoto(this.stack[o],i,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;n=s}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,o)=>{if(!n.includes(i))return n.push(i),e.allActions(i,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-o;if(a>1){let l=s&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(s,o+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 q4(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 q4{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class jG{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 X0{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 X0(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 X0(this.stack,this.pos,this.index)}}function rh(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let o=0;for(;;){let s=t.charCodeAt(r++),a=!1;if(s==126){o=65535;break}s>=92&&s--,s>=34&&s--;let l=s-32;if(l>=46&&(l-=46,a=!0),o+=l,a)break;o*=46}n?n[i++]=o:n=new e(o)}return n}class Tg{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const N4=new Tg;class TG{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=N4,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,o=this.pos+e;for(;o<r.from;){if(!i)return null;let s=this.ranges[--i];o-=r.from-s.to,r=s}for(;n<0?o>r.to:o>=r.to;){if(i==this.ranges.length-1)return null;let s=this.ranges[++i];o+=s.from-r.to,r=s}return o}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 o=this.resolveOffset(e,1);if(o==null)return-1;if(r=o,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let s=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++s];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=N4,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 Ac{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;Z4(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Ac.prototype.contextual=Ac.prototype.fallback=Ac.prototype.extend=!1;class Ig{constructor(e,n,r){this.precTable=n,this.elseToken=r,this.data=typeof e=="string"?rh(e):e}token(e,n){let r=e.pos,i=0;for(;;){let o=e.next<0,s=e.resolveOffset(1,1);if(Z4(this.data,e,n,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(o||i++,s==null)break;e.reset(s,e.token)}i&&(e.reset(r,e.token),e.acceptToken(this.elseToken,i))}}Ig.prototype.contextual=Ac.prototype.fallback=Ac.prototype.extend=!1;class Pn{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function Z4(t,e,n,r,i,o){let s=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;(a&t[s])!=0;){let c=t[s+1];for(let f=s+3;f<c;f+=2)if((t[f+1]&a)>0){let m=t[f];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||IG(m,e.token.value,i,o))){e.acceptToken(m);break}}let d=e.next,h=0,p=t[s+2];if(e.next<0&&p>h&&t[c+p*3-3]==65535){s=t[c+p*3-1];continue e}for(;h<p;){let f=h+p>>1,m=c+f+(f<<1),g=t[m],O=t[m+1]||65536;if(d<g)p=f;else if(d>=O)h=f+1;else{s=t[m+2],e.advance();continue e}}break}}function X4(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function IG(t,e,n,r){let i=X4(n,r,e);return i<0||X4(n,r,t)<i}const li=typeof process<"u"&&_4&&/\bparse\b/.test(_4.LOG);let Ny=null;function V4(t,e,n){let r=t.cursor(Lt.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 EG{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?V4(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?V4(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 o=r.children[i],s=this.start[n]+r.positions[i];if(s>e)return this.nextStart=s,null;if(o instanceof Yt){if(s==e){if(s<this.safeFrom)return null;let a=s+o.length;if(a<=this.safeTo){let l=o.prop(gt.lookAhead);if(!l||a+l<this.fragment.to)return o}}this.index[n]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+o.length}}}class RG{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Tg)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:o}=i,s=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<o.length;c++){if((1<<c&s)==0)continue;let d=o[c],h=this.tokens[c];if(!(r&&!d.fallback)&&((d.contextual||h.start!=e.pos||h.mask!=s||h.context!=a)&&(this.updateCachedToken(h,d,e),h.mask=s,h.context=a),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let p=n;if(h.extended>-1&&(n=this.addActions(e,h.extended,h.end,n)),n=this.addActions(e,h.value,h.end,n),!d.extend&&(r=h,n>p))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new Tg,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 Tg,{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:o}=r.p;for(let s=0;s<o.specialized.length;s++)if(o.specialized[s]==e.value){let a=o.specializers[s](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 o=0;o<i;o+=3)if(this.actions[o]==e)return i;return this.actions[i++]=e,this.actions[i++]=n,this.actions[i++]=r,i}addActions(e,n,r,i){let{state:o}=e,{parser:s}=e.p,{data:a}=s;for(let l=0;l<2;l++)for(let c=s.stateSlot(o,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=As(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(As(a,c+2),n,r,i));break}a[c]==n&&(i=this.putAction(As(a,c+1),n,r,i))}return i}}let AG=class{constructor(t,e,n,r){this.parser=t,this.input=e,this.ranges=r,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 TG(e,r),this.tokens=new RG(t,this.stream),this.topTerm=t.top[1];let{from:i}=r[0];this.stacks=[Z0.start(this,t.top[0],i)],this.fragments=n.length&&this.stream.end-i>t.bufferLength*4?new EG(n,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&t.length==1){let[o]=t;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<t.length;o++){let s=t[o];for(;;){if(this.tokens.mainToken=null,s.pos>e)n.push(s);else{if(this.advanceStack(s,n,t))continue;{r||(r=[],i=[]),r.push(s);let a=this.tokens.getMainToken(s);i.push(a.value,a.end)}}break}}if(!n.length){let o=r&&MG(r);if(o)return li&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw li&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(o)return li&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((s,a)=>a.score-s.score);n.length>o;)n.pop();n.some(s=>s.reducePos>e)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let s=n[o];for(let a=o+1;a<n.length;a++){let l=n[a];if(s.sameState(l)||s.buffer.length>500&&l.buffer.length>500)if((s.score-l.score||s.buffer.length-l.buffer.length)>0)n.splice(a--,1);else{n.splice(o--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let o=1;o<n.length;o++)n[o].pos<this.minStackPos&&(this.minStackPos=n[o].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,n){let r=t.pos,{parser:i}=this,o=li?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let l=t.curContext&&t.curContext.tracker.strict,c=l?t.curContext.hash:0;for(let d=this.fragments.nodeAt(r);d;){let h=this.parser.nodeSet.types[d.type.id]==d.type?i.getGoto(t.state,d.type.id):-1;if(h>-1&&d.length&&(!l||(d.prop(gt.contextHash)||0)==c))return t.useNode(d,h),li&&console.log(o+this.stackID(t)+` (via reuse of ${i.getName(d.type.id)})`),!0;if(!(d instanceof Yt)||d.children.length==0||d.positions[0]>0)break;let p=d.children[0];if(p instanceof Yt&&d.positions[0]==0)d=p;else break}}let s=i.stateSlot(t.state,4);if(s>0)return t.reduce(s),li&&console.log(o+this.stackID(t)+` (via always-reduce ${i.getName(s&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let l=0;l<a.length;){let c=a[l++],d=a[l++],h=a[l++],p=l==a.length||!n,f=p?t:t.split(),m=this.tokens.mainToken;if(f.apply(c,d,m?m.start:f.pos,h),li&&console.log(o+this.stackID(f)+` (via ${(c&65536)==0?"shift":`reduce of ${i.getName(c&65535)}`} for ${i.getName(d)} @ ${r}${f==t?"":", split"})`),p)return!0;f.pos>r?e.push(f):n.push(f)}return!1}advanceFully(t,e){let n=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>n)return U4(t,e),!0}}runRecovery(t,e,n){let r=null,i=!1;for(let o=0;o<t.length;o++){let s=t[o],a=e[o<<1],l=e[(o<<1)+1],c=li?this.stackID(s)+" -> ":"";if(s.deadEnd&&(i||(i=!0,s.restart(),li&&console.log(c+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))))continue;let d=s.split(),h=c;for(let p=0;d.forceReduce()&&p<10&&(li&&console.log(h+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,n));p++)li&&(h=this.stackID(d)+" -> ");for(let p of s.recoverByInsert(a))li&&console.log(c+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,n);this.stream.end>s.pos?(l==s.pos&&(l++,a=0),s.recoverByDelete(a,l),li&&console.log(c+this.stackID(s)+` (via recover-delete ${this.parser.getName(a)})`),U4(s,n)):(!r||r.score<s.score)&&(r=s)}return r}stackToTree(t){return t.close(),Yt.build({buffer:X0.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(Ny||(Ny=new WeakMap)).get(t);return e||Ny.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}};function U4(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 DG{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}const Zy=t=>t;class ih{constructor(e){this.start=e.start,this.shift=e.shift||Zy,this.reduce=e.reduce||Zy,this.reuse=e.reuse||Zy,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Po extends _y{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 o(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=gt[l]);for(let c=1;c<a.length;){let d=a[c++];if(d>=0)o(d,l,a[c++]);else{let h=a[c+-d];for(let p=-d;p>0;p--)o(a[c++],l,h);c++}}}this.nodeSet=new N0(n.map((a,l)=>jr.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=C4;let s=rh(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(W4),this.states=rh(e.states,Uint32Array),this.data=rh(e.stateData),this.goto=rh(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Ac(s,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 AG(this,e,n,r);for(let o of this.wrappers)i=o(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let o=i[n+1];;){let s=i[o++],a=s&1,l=i[o++];if(a&&r)return l;for(let c=o+(s>>1);o<c;o++)if(i[o]==e)return l;if(a)return-1}}hasAction(e,n){let r=this.data;for(let i=0;i<2;i++)for(let o=this.stateSlot(e,i?2:1),s;;o+=3){if((s=r[o])==65535)if(r[o+1]==1)s=r[o=As(r,o+2)];else{if(r[o+1]==2)return As(r,o+2);break}if(s==n||s==0)return As(r,o+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 o=this.stateSlot(e,1);i==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=As(this.data,o+2);else break;i=n(As(this.data,o+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=As(this.data,r+2);else break;if((this.data[r+2]&1)==0){let i=this.data[r+1];n.some((o,s)=>s&1&&o==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(Po.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(o=>o.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let o=e.specializers.find(a=>a.from==r.external);if(!o)return r;let s=Object.assign(Object.assign({},r),{external:o.to});return n.specializers[i]=W4(s),s})),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 o of e.split(" ")){let s=n.indexOf(o);s>=0&&(r[s]=!0)}let i=null;for(let o=0;o<n.length;o++)if(!r[o])for(let s=this.dialects[n[o]],a;(a=this.data[s++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new DG(e,r,i)}static deserialize(e){return new Po(e)}}function As(t,e){return t[e]|t[e+1]<<16}function MG(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 W4(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}let zG=0,Ds=class AC{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=zG++}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 AC&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let i=new AC(r,[],null,[]);if(i.set.push(i),n)for(let o of n.set)i.set.push(o);return i}static defineModifier(e){let n=new V0(e);return r=>r.modified.indexOf(n)>-1?r:V0.get(r.base||r,r.modified.concat(n).sort((i,o)=>i.id-o.id))}},_G=0;class V0{constructor(e){this.name=e,this.instances=[],this.id=_G++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&qG(n,a.modified));if(r)return r;let i=[],o=new Ds(e.name,i,e,n);for(let a of n)a.instances.push(o);let s=NG(n);for(let a of e.set)if(!a.modified.length)for(let l of s)i.push(V0.get(a,l));return o}}function qG(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function NG(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 Ms(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 o=[],s=2,a=i;for(let h=0;;){if(a=="..."&&h>0&&h+3==i.length){s=1;break}let p=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!p)throw new RangeError("Invalid path: "+i);if(o.push(p[0]=="*"?"":p[0][0]=='"'?JSON.parse(p[0]):p[0]),h+=p[0].length,h==i.length)break;let f=i[h++];if(h==i.length&&f=="!"){s=0;break}if(f!="/")throw new RangeError("Invalid path: "+i);a=i.slice(h)}let l=o.length-1,c=o[l];if(!c)throw new RangeError("Invalid path: "+i);let d=new Eg(r,s,l>0?o.slice(0,l):null);e[c]=d.sort(e[c])}}return L4.add(e)}const L4=new gt;class Eg{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}}Eg.empty=new Eg([],2,null);function Y4(t,e){let n=Object.create(null);for(let o of t)if(!Array.isArray(o.tag))n[o.tag.id]=o.class;else for(let s of o.tag)n[s.id]=o.class;let{scope:r,all:i=null}=e||{};return{style:o=>{let s=i;for(let a of o)for(let l of a.set){let c=n[l.id];if(c){s=s?s+" "+c:c;break}}return s},scope:r}}function ZG(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function XG(t,e,n,r=0,i=t.length){let o=new VG(r,Array.isArray(e)?e:[e],n);o.highlightRange(t.cursor(),r,i,"",o.highlighters),o.flush(i)}class VG{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,o){let{type:s,from:a,to:l}=e;if(a>=r||l<=n)return;s.isTop&&(o=this.highlighters.filter(f=>!f.scope||f.scope(s)));let c=i,d=UG(e)||Eg.empty,h=ZG(o,d.tags);if(h&&(c&&(c+=" "),c+=h,d.mode==1&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(n,a),c),d.opaque)return;let p=e.tree&&e.tree.prop(gt.mounted);if(p&&p.overlay){let f=e.node.enter(p.overlay[0].from+a,1),m=this.highlighters.filter(O=>!O.scope||O.scope(p.tree.type)),g=e.firstChild();for(let O=0,y=a;;O++){let b=O<p.overlay.length?p.overlay[O]:null,w=b?b.from+a:l,k=Math.max(n,y),S=Math.min(r,w);if(k<S&&g)for(;e.from<S&&(this.highlightRange(e,k,S,i,o),this.startSpan(Math.min(S,e.to),c),!(e.to>=w||!e.nextSibling())););if(!b||w>r)break;y=b.to+a,y>n&&(this.highlightRange(f.cursor(),Math.max(n,b.from+a),Math.min(r,y),"",m),this.startSpan(Math.min(r,y),c))}g&&e.parent()}else if(e.firstChild()){p&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,o),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function UG(t){let e=t.type.prop(L4);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ee=Ds.define,Rg=Ee(),$a=Ee(),B4=Ee($a),F4=Ee($a),Qa=Ee(),Ag=Ee(Qa),Xy=Ee(Qa),Uo=Ee(),yl=Ee(Uo),Wo=Ee(),Lo=Ee(),Vy=Ee(),oh=Ee(Vy),Dg=Ee(),j={comment:Rg,lineComment:Ee(Rg),blockComment:Ee(Rg),docComment:Ee(Rg),name:$a,variableName:Ee($a),typeName:B4,tagName:Ee(B4),propertyName:F4,attributeName:Ee(F4),className:Ee($a),labelName:Ee($a),namespace:Ee($a),macroName:Ee($a),literal:Qa,string:Ag,docString:Ee(Ag),character:Ee(Ag),attributeValue:Ee(Ag),number:Xy,integer:Ee(Xy),float:Ee(Xy),bool:Ee(Qa),regexp:Ee(Qa),escape:Ee(Qa),color:Ee(Qa),url:Ee(Qa),keyword:Wo,self:Ee(Wo),null:Ee(Wo),atom:Ee(Wo),unit:Ee(Wo),modifier:Ee(Wo),operatorKeyword:Ee(Wo),controlKeyword:Ee(Wo),definitionKeyword:Ee(Wo),moduleKeyword:Ee(Wo),operator:Lo,derefOperator:Ee(Lo),arithmeticOperator:Ee(Lo),logicOperator:Ee(Lo),bitwiseOperator:Ee(Lo),compareOperator:Ee(Lo),updateOperator:Ee(Lo),definitionOperator:Ee(Lo),typeOperator:Ee(Lo),controlOperator:Ee(Lo),punctuation:Vy,separator:Ee(Vy),bracket:oh,angleBracket:Ee(oh),squareBracket:Ee(oh),paren:Ee(oh),brace:Ee(oh),content:Uo,heading:yl,heading1:Ee(yl),heading2:Ee(yl),heading3:Ee(yl),heading4:Ee(yl),heading5:Ee(yl),heading6:Ee(yl),contentSeparator:Ee(Uo),list:Ee(Uo),quote:Ee(Uo),emphasis:Ee(Uo),strong:Ee(Uo),link:Ee(Uo),monospace:Ee(Uo),strikethrough:Ee(Uo),inserted:Ee(),deleted:Ee(),changed:Ee(),invalid:Ee(),meta:Dg,documentMeta:Ee(Dg),annotation:Ee(Dg),processingInstruction:Ee(Dg),definition:Ds.defineModifier("definition"),constant:Ds.defineModifier("constant"),function:Ds.defineModifier("function"),standard:Ds.defineModifier("standard"),local:Ds.defineModifier("local"),special:Ds.defineModifier("special")};for(let t in j){let e=j[t];e instanceof Ds&&(e.name=t)}Y4([{tag:j.link,class:"tok-link"},{tag:j.heading,class:"tok-heading"},{tag:j.emphasis,class:"tok-emphasis"},{tag:j.strong,class:"tok-strong"},{tag:j.keyword,class:"tok-keyword"},{tag:j.atom,class:"tok-atom"},{tag:j.bool,class:"tok-bool"},{tag:j.url,class:"tok-url"},{tag:j.labelName,class:"tok-labelName"},{tag:j.inserted,class:"tok-inserted"},{tag:j.deleted,class:"tok-deleted"},{tag:j.literal,class:"tok-literal"},{tag:j.string,class:"tok-string"},{tag:j.number,class:"tok-number"},{tag:[j.regexp,j.escape,j.special(j.string)],class:"tok-string2"},{tag:j.variableName,class:"tok-variableName"},{tag:j.local(j.variableName),class:"tok-variableName tok-local"},{tag:j.definition(j.variableName),class:"tok-variableName tok-definition"},{tag:j.special(j.variableName),class:"tok-variableName2"},{tag:j.definition(j.propertyName),class:"tok-propertyName tok-definition"},{tag:j.typeName,class:"tok-typeName"},{tag:j.namespace,class:"tok-namespace"},{tag:j.className,class:"tok-className"},{tag:j.macroName,class:"tok-macroName"},{tag:j.propertyName,class:"tok-propertyName"},{tag:j.operator,class:"tok-operator"},{tag:j.comment,class:"tok-comment"},{tag:j.meta,class:"tok-meta"},{tag:j.invalid,class:"tok-invalid"},{tag:j.punctuation,class:"tok-punctuation"}]);const WG=Ms({String:j.string,Number:j.number,"True False":j.bool,PropertyName:j.propertyName,Null:j.null,",":j.separator,"[ ]":j.squareBracket,"{ }":j.brace}),LG=Po.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:"\u26A0 JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[WG],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 Uy=[],G4=[];(()=>{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?G4:Uy).push(n=n+t[e])})();function YG(t){if(t<768)return!1;for(let e=0,n=Uy.length;;){let r=e+n>>1;if(t<Uy[r])n=r;else if(t>=G4[r])e=r+1;else return!0;if(e==n)return!1}}function H4(t){return t>=127462&&t<=127487}const K4=8205;function BG(t,e,n=!0,r=!0){return(n?J4:FG)(t,e,r)}function J4(t,e,n){if(e==t.length)return e;e&&e7(t.charCodeAt(e))&&t7(t.charCodeAt(e-1))&&e--;let r=Wy(t,e);for(e+=n7(r);e<t.length;){let i=Wy(t,e);if(r==K4||i==K4||n&&YG(i))e+=n7(i),r=i;else if(H4(i)){let o=0,s=e-2;for(;s>=0&&H4(Wy(t,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function FG(t,e,n){for(;e>0;){let r=J4(t,e-2,n);if(r<e)return r;e--}return 0}function Wy(t,e){let n=t.charCodeAt(e);if(!t7(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return e7(r)?(n-55296<<10)+(r-56320)+65536:n}function e7(t){return t>=56320&&t<57344}function t7(t){return t>=55296&&t<56320}function n7(t){return t<65536?1:2}let Mt=class uU{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]=Dc(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),ys.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]=Dc(this,e,n);let r=[];return this.decompose(e,n,r,0),ys.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 sh(this),o=new sh(e);for(let s=n,a=n;;){if(i.next(s),o.next(s),s=0,i.lineBreak!=o.lineBreak||i.done!=o.done||i.value!=o.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new sh(this,e)}iterRange(e,n=this.length){return new i7(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 o7(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]?uU.empty:e.length<=32?new En(e):ys.from(En.split(e,[]))}};class En extends Mt{constructor(e,n=GG(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 o=0;;o++){let s=this.text[o],a=i+s.length;if((n?r:a)>=e)return new HG(i,a,r,s);i=a+1,r++}}decompose(e,n,r,i){let o=e<=0&&n>=this.length?this:new En(r7(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let s=r.pop(),a=Mg(o.text,s.text.slice(),0,o.length);if(a.length<=32)r.push(new En(a,s.length+o.length));else{let l=a.length>>1;r.push(new En(a.slice(0,l)),new En(a.slice(l)))}}else r.push(o)}replace(e,n,r){if(!(r instanceof En))return super.replace(e,n,r);[e,n]=Dc(this,e,n);let i=Mg(this.text,Mg(r.text,r7(this.text,0,e)),n),o=this.length+r.length-(n-e);return i.length<=32?new En(i,o):ys.from(En.split(i,[]),o)}sliceString(e,n=this.length,r=`
334
334
  `){[e,n]=Dc(this,e,n);let i="";for(let o=0,s=0;o<=n&&s<this.text.length;s++){let a=this.text[s],l=o+a.length;o>e&&s&&(i+=r),e<l&&n>o&&(i+=a.slice(Math.max(0,e-o),n-o)),o=l+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let o of e)r.push(o),i+=o.length+1,r.length==32&&(n.push(new En(r,i)),r=[],i=-1);return i>-1&&n.push(new En(r,i)),n}}class ys extends Mt{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let o=0;;o++){let s=this.children[o],a=i+s.length,l=r+s.lines-1;if((n?l:a)>=e)return s.lineInner(e,n,r,i);i=a+1,r=l+1}}decompose(e,n,r,i){for(let o=0,s=0;s<=n&&o<this.children.length;o++){let a=this.children[o],l=s+a.length;if(e<=l&&n>=s){let c=i&((s<=e?1:0)|(l>=n?2:0));s>=e&&l<=n&&!c?r.push(a):a.decompose(e-s,n-s,r,c)}s=l+1}}replace(e,n,r){if([e,n]=Dc(this,e,n),r.lines<this.lines)for(let i=0,o=0;i<this.children.length;i++){let s=this.children[i],a=o+s.length;if(e>=o&&n<=a){let l=s.replace(e-o,n-o,r),c=this.lines-s.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let d=this.children.slice();return d[i]=l,new ys(d,this.length-(n-e)+r.length)}return super.replace(o,a,l)}o=a+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
335
335
  `){[e,n]=Dc(this,e,n);let i="";for(let o=0,s=0;o<this.children.length&&s<=n;o++){let a=this.children[o],l=s+a.length;s>e&&o&&(i+=r),e<l&&n>s&&(i+=a.sliceString(e-s,n-s,r)),s=l+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof ys))return 0;let r=0,[i,o,s,a]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,o+=n){if(i==s||o==a)return r;let l=this.children[i],c=e.children[o];if(l!=c)return r+l.scanIdentical(c,n);r+=l.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let f of e)r+=f.lines;if(r<32){let f=[];for(let m of e)m.flatten(f);return new En(f,n)}let i=Math.max(32,r>>5),o=i<<1,s=i>>1,a=[],l=0,c=-1,d=[];function h(f){let m;if(f.lines>o&&f instanceof ys)for(let g of f.children)h(g);else f.lines>s&&(l>s||!l)?(p(),a.push(f)):f instanceof En&&l&&(m=d[d.length-1])instanceof En&&f.lines+m.lines<=32?(l+=f.lines,c+=f.length+1,d[d.length-1]=new En(m.text.concat(f.text),m.length+1+f.length)):(l+f.lines>i&&p(),l+=f.lines,c+=f.length+1,d.push(f))}function p(){l!=0&&(a.push(d.length==1?d[0]:ys.from(d,c)),c=-1,l=d.length=0)}for(let f of e)h(f);return p(),a.length==1?a[0]:new ys(a,n)}}Mt.empty=new En([""],0);function GG(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Mg(t,e,n=0,r=1e9){for(let i=0,o=0,s=!0;o<t.length&&i<=r;o++){let a=t[o],l=i+a.length;l>=n&&(l>r&&(a=a.slice(0,r-i)),i<n&&(a=a.slice(n-i)),s?(e[e.length-1]+=a,s=!1):e.push(a)),i=l+1}return e}function r7(t,e,n){return Mg(t,[""],e,n)}class sh{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof En?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],o=this.offsets[r],s=o>>1,a=i instanceof En?i.text.length:i.children.length;if(s==(n>0?a:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
336
336
  `,this;e--}else if(i instanceof En){let l=i.text[s+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[s+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof En?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class i7{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new sh(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class o7{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Mt.prototype[Symbol.iterator]=function(){return this.iter()},sh.prototype[Symbol.iterator]=i7.prototype[Symbol.iterator]=o7.prototype[Symbol.iterator]=function(){return this});let HG=class{constructor(t,e,n,r){this.from=t,this.to=e,this.number=n,this.text=r}get length(){return this.to-this.from}};function Dc(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function rr(t,e,n=!0,r=!0){return BG(t,e,n,r)}function KG(t){return t>=56320&&t<57344}function JG(t){return t>=55296&&t<56320}function Hr(t,e){let n=t.charCodeAt(e);if(!JG(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return KG(r)?(n-55296<<10)+(r-56320)+65536:n}function Ly(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Yo(t){return t<65536?1:2}const Yy=/\r\n?|\n/;var ir=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(ir||(ir={}));class Os{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,i=0;n<this.sections.length;){let o=this.sections[n++],s=this.sections[n++];s<0?(e(r,i,o),i+=o):i+=s,r+=o}}iterChangedRanges(e,n=!1){By(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];i<0?e.push(r,i):e.push(i,r)}return new Os(e)}composeDesc(e){return this.empty?e:e.empty?this:s7(this,e)}mapDesc(e,n=!1){return e.empty?this:Fy(this,e,n)}mapPos(e,n=-1,r=ir.Simple){let i=0,o=0;for(let s=0;s<this.sections.length;){let a=this.sections[s++],l=this.sections[s++],c=i+a;if(l<0){if(c>e)return o+(e-i);o+=a}else{if(r!=ir.Simple&&c>=e&&(r==ir.TrackDel&&i<e&&c>e||r==ir.TrackBefore&&i<e||r==ir.TrackAfter&&c>e))return null;if(c>e||c==e&&n<0&&!a)return e==i||n<0?o:o+l;o+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return o}touchesRange(e,n=e){for(let r=0,i=0;r<this.sections.length&&i<=n;){let o=this.sections[r++],s=this.sections[r++],a=i+o;if(s>=0&&i<=n&&a>=e)return i<e&&a>n?"cover":!0;i=a}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Os(e)}static create(e){return new Os(e)}}class Bn extends Os{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return By(this,(n,r,i,o,s)=>e=e.replace(i,i+(r-n),s),!1),e}mapDesc(e,n=!1){return Fy(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,o=0;i<n.length;i+=2){let s=n[i],a=n[i+1];if(a>=0){n[i]=a,n[i+1]=s;let l=i>>1;for(;r.length<l;)r.push(Mt.empty);r.push(s?e.slice(o,o+s):Mt.empty)}o+=s}return new Bn(n,r)}compose(e){return this.empty?e:e.empty?this:s7(this,e,!0)}map(e,n=!1){return e.empty?this:Fy(this,e,n,!0)}iterChanges(e,n=!1){By(this,e,n)}get desc(){return Os.create(this.sections)}filter(e){let n=[],r=[],i=[],o=new ah(this);e:for(let s=0,a=0;;){let l=s==e.length?1e9:e[s++];for(;a<l||a==l&&o.len==0;){if(o.done)break e;let d=Math.min(o.len,l-a);br(i,d,-1);let h=o.ins==-1?-1:o.off==0?o.ins:0;br(n,d,h),h>0&&ja(r,n,o.text),o.forward(d),a+=d}let c=e[s++];for(;a<c;){if(o.done)break e;let d=Math.min(o.len,c-a);br(n,d,-1),br(i,d,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(d),a+=d}}return{changes:new Bn(n,r),filtered:Os.create(i)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],i=this.sections[n+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let i=[],o=[],s=0,a=null;function l(d=!1){if(!d&&!i.length)return;s<n&&br(i,n-s,-1);let h=new Bn(i,o);a=a?a.compose(h.map(a)):h,i=[],o=[],s=0}function c(d){if(Array.isArray(d))for(let h of d)c(h);else if(d instanceof Bn){if(d.length!=n)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${n})`);l(),a=a?a.compose(d.map(a)):d}else{let{from:h,to:p=h,insert:f}=d;if(h>p||h<0||p>n)throw new RangeError(`Invalid change range ${h} to ${p} (in doc of length ${n})`);let m=f?typeof f=="string"?Mt.of(f.split(r||Yy)):f:Mt.empty,g=m.length;if(h==p&&g==0)return;h<s&&l(),h>s&&br(i,h-s,-1),br(i,p-h,g),ja(o,i,m),s=p}}return c(e),l(!a),a}static empty(e){return new Bn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;i<e.length;i++){let o=e[i];if(typeof o=="number")n.push(o,-1);else{if(!Array.isArray(o)||typeof o[0]!="number"||o.some((s,a)=>a&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)n.push(o[0],0);else{for(;r.length<i;)r.push(Mt.empty);r[i]=Mt.of(o.slice(1)),n.push(o[0],r[i].length)}}}return new Bn(n,r)}static createSet(e,n){return new Bn(e,n)}}function br(t,e,n,r=!1){if(e==0&&n<=0)return;let i=t.length-2;i>=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function ja(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(Mt.empty);t.push(n)}}function By(t,e,n){let r=t.inserted;for(let i=0,o=0,s=0;s<t.sections.length;){let a=t.sections[s++],l=t.sections[s++];if(l<0)i+=a,o+=a;else{let c=i,d=o,h=Mt.empty;for(;c+=a,d+=l,l&&r&&(h=h.append(r[s-2>>1])),!(n||s==t.sections.length||t.sections[s+1]<0);)a=t.sections[s++],l=t.sections[s++];e(i,c,o,d,h),i=c,o=d}}}function Fy(t,e,n,r=!1){let i=[],o=r?[]:null,s=new ah(t),a=new ah(e);for(let l=-1;;){if(s.done&&a.len||a.done&&s.len)throw new Error("Mismatched change set lengths");if(s.ins==-1&&a.ins==-1){let c=Math.min(s.len,a.len);br(i,c,-1),s.forward(c),a.forward(c)}else if(a.ins>=0&&(s.ins<0||l==s.i||s.off==0&&(a.len<s.len||a.len==s.len&&!n))){let c=a.len;for(br(i,a.ins,-1);c;){let d=Math.min(s.len,c);s.ins>=0&&l<s.i&&s.len<=d&&(br(i,0,s.ins),o&&ja(o,i,s.text),l=s.i),s.forward(d),c-=d}a.next()}else if(s.ins>=0){let c=0,d=s.len;for(;d;)if(a.ins==-1){let h=Math.min(d,a.len);c+=h,d-=h,a.forward(h)}else if(a.ins==0&&a.len<d)d-=a.len,a.next();else break;br(i,c,l<s.i?s.ins:0),o&&l<s.i&&ja(o,i,s.text),l=s.i,s.forward(s.len-d)}else{if(s.done&&a.done)return o?Bn.createSet(i,o):Os.create(i);throw new Error("Mismatched change set lengths")}}}function s7(t,e,n=!1){let r=[],i=n?[]:null,o=new ah(t),s=new ah(e);for(let a=!1;;){if(o.done&&s.done)return i?Bn.createSet(r,i):Os.create(r);if(o.ins==0)br(r,o.len,0,a),o.next();else if(s.len==0&&!s.done)br(r,0,s.ins,a),i&&ja(i,r,s.text),s.next();else{if(o.done||s.done)throw new Error("Mismatched change set lengths");{let l=Math.min(o.len2,s.len),c=r.length;if(o.ins==-1){let d=s.ins==-1?-1:s.off?0:s.ins;br(r,l,d,a),i&&d&&ja(i,r,s.text)}else s.ins==-1?(br(r,o.off?0:o.len,l,a),i&&ja(i,r,o.textBit(l))):(br(r,o.off?0:o.len,s.off?0:s.ins,a),i&&!s.off&&ja(i,r,s.text));a=(o.ins>l||s.ins>=0&&s.len>l)&&(a||r.length>c),o.forward2(l),s.forward(l)}}}}class ah{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?Mt.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Mt.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}let zg=class DC{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new DC(r,i,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return ve.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return ve.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return ve.range(e.anchor,e.head)}static create(e,n,r){return new DC(e,n,r)}};class ve{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:ve.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new ve([this.main],0)}addRange(e,n=!0){return ve.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,ve.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new ve(e.ranges.map(n=>zg.fromJSON(n)),e.main)}static single(e,n=e){return new ve([ve.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let o=e[i];if(o.empty?o.from<=r:o.from<r)return ve.normalized(e.slice(),n);r=o.to}return new ve(e,n)}static cursor(e,n=0,r,i){return zg.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,n,r,i){let o=(r??16777215)<<6|(i==null?7:Math.min(6,i));return n<e?zg.create(n,e,48|o):zg.create(e,n,(n>e?8:0)|o)}static normalized(e,n=0){let r=e[n];e.sort((i,o)=>i.from-o.from),n=e.indexOf(r);for(let i=1;i<e.length;i++){let o=e[i],s=e[i-1];if(o.empty?o.from<=s.to:o.from<s.to){let a=s.from,l=Math.max(o.to,s.to);i<=n&&n--,e.splice(--i,2,o.anchor>o.head?ve.range(l,a):ve.range(a,l))}}return new ve(e,n)}}function a7(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Gy=0;class ze{constructor(e,n,r,i,o){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=Gy++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new ze(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:Hy),!!e.static,e.enables)}of(e){return new _g([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new _g(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new _g(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function Hy(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class _g{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=Gy++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,o=this.id,s=e[o]>>1,a=this.type==2,l=!1,c=!1,d=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?c=!0:(((n=e[h.id])!==null&&n!==void 0?n:1)&1)==0&&d.push(e[h.id]);return{create(h){return h.values[s]=r(h),1},update(h,p){if(l&&p.docChanged||c&&(p.docChanged||p.selection)||Ky(h,d)){let f=r(h);if(a?!l7(f,h.values[s],i):!i(f,h.values[s]))return h.values[s]=f,1}return 0},reconfigure:(h,p)=>{let f,m=p.config.address[o];if(m!=null){let g=Ng(p,m);if(this.dependencies.every(O=>O instanceof ze?p.facet(O)===h.facet(O):O instanceof Yn?p.field(O,!1)==h.field(O,!1):!0)||(a?l7(f=r(h),g,i):i(f=r(h),g)))return h.values[s]=g,0}else f=r(h);return h.values[s]=f,1}}}}function l7(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function Ky(t,e){let n=!1;for(let r of e)ch(t,r)&1&&(n=!0);return n}function eH(t,e,n){let r=n.map(l=>t[l.id]),i=n.map(l=>l.type),o=r.filter(l=>!(l&1)),s=t[e.id]>>1;function a(l){let c=[];for(let d=0;d<r.length;d++){let h=Ng(l,r[d]);if(i[d]==2)for(let p of h)c.push(p);else c.push(h)}return e.combine(c)}return{create(l){for(let c of r)ch(l,c);return l.values[s]=a(l),1},update(l,c){if(!Ky(l,o))return 0;let d=a(l);return e.compare(d,l.values[s])?0:(l.values[s]=d,1)},reconfigure(l,c){let d=Ky(l,r),h=c.config.facets[e.id],p=c.facet(e);if(h&&!d&&Hy(n,h))return l.values[s]=p,0;let f=a(l);return e.compare(f,p)?(l.values[s]=p,0):(l.values[s]=f,1)}}}const qg=ze.define({static:!0});class Yn{constructor(e,n,r,i,o){this.id=e,this.createF=n,this.updateF=r,this.compareF=i,this.spec=o,this.provides=void 0}static define(e){let n=new Yn(Gy++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){return(e.facet(qg).find(r=>r.field==this)?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let o=r.values[n],s=this.updateF(o,i);return this.compareF(o,s)?0:(r.values[n]=s,1)},reconfigure:(r,i)=>{let o=r.facet(qg),s=i.facet(qg),a;return(a=o.find(l=>l.field==this))&&a!=s.find(l=>l.field==this)?(r.values[n]=a.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,qg.of({field:this,create:e})]}get extension(){return this}}const bl={lowest:4,low:3,default:2,high:1,highest:0};function lh(t){return e=>new c7(e,t)}const zr={highest:lh(bl.highest),high:lh(bl.high),default:lh(bl.default),low:lh(bl.low),lowest:lh(bl.lowest)};class c7{constructor(e,n){this.inner=e,this.prec=n}}class Pf{of(e){return new Jy(this,e)}reconfigure(e){return Pf.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Jy{constructor(e,n){this.compartment=e,this.inner=n}}class U0{constructor(e,n,r,i,o,s){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let i=[],o=Object.create(null),s=new Map;for(let p of tH(e,n,s))p instanceof Yn?i.push(p):(o[p.facet.id]||(o[p.facet.id]=[])).push(p);let a=Object.create(null),l=[],c=[];for(let p of i)a[p.id]=c.length<<1,c.push(f=>p.slot(f));let d=r?.config.facets;for(let p in o){let f=o[p],m=f[0].facet,g=d&&d[p]||[];if(f.every(O=>O.type==0))if(a[m.id]=l.length<<1|1,Hy(g,f))l.push(r.facet(m));else{let O=m.combine(f.map(y=>y.value));l.push(r&&m.compare(O,r.facet(m))?r.facet(m):O)}else{for(let O of f)O.type==0?(a[O.id]=l.length<<1|1,l.push(O.value)):(a[O.id]=c.length<<1,c.push(y=>O.dynamicSlot(y)));a[m.id]=c.length<<1,c.push(O=>eH(O,m,f))}}let h=c.map(p=>p(a));return new U0(e,s,h,a,l,o)}}function tH(t,e,n){let r=[[],[],[],[],[]],i=new Map;function o(s,a){let l=i.get(s);if(l!=null){if(l<=a)return;let c=r[l].indexOf(s);c>-1&&r[l].splice(c,1),s instanceof Jy&&n.delete(s.compartment)}if(i.set(s,a),Array.isArray(s))for(let c of s)o(c,a);else if(s instanceof Jy){if(n.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(s.compartment)||s.inner;n.set(s.compartment,c),o(c,a)}else if(s instanceof c7)o(s.inner,s.prec);else if(s instanceof Yn)r[a].push(s),s.provides&&o(s.provides,a);else if(s instanceof _g)r[a].push(s),s.facet.extensions&&o(s.facet.extensions,bl.default);else{let c=s.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(c,a)}}return o(t,bl.default),r.reduce((s,a)=>s.concat(a))}function ch(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function Ng(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const u7=ze.define(),eb=ze.define({combine:t=>t.some(e=>e),static:!0}),d7=ze.define({combine:t=>t.length?t[0]:void 0,static:!0}),h7=ze.define(),p7=ze.define(),f7=ze.define(),g7=ze.define({combine:t=>t.length?t[0]:!1});class Bo{constructor(e,n){this.type=e,this.value=n}static define(){return new nH}}class nH{of(e){return new Bo(this,e)}}class rH{constructor(e){this.map=e}of(e){return new ot(this,e)}}class ot{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new ot(this.type,n)}is(e){return this.type==e}static define(e={}){return new rH(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let o=i.map(n);o&&r.push(o)}return r}}ot.reconfigure=ot.define(),ot.appendConfig=ot.define();class _n{constructor(e,n,r,i,o,s){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,r&&a7(r,n.newLength),o.some(a=>a.type==_n.time)||(this.annotations=o.concat(_n.time.of(Date.now())))}static create(e,n,r,i,o,s){return new _n(e,n,r,i,o,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(_n.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}_n.time=Bo.define(),_n.userEvent=Bo.define(),_n.addToHistory=Bo.define(),_n.remote=Bo.define();function iH(t,e){let n=[];for(let r=0,i=0;;){let o,s;if(r<t.length&&(i==e.length||e[i]>=t[r]))o=t[r++],s=t[r++];else if(i<e.length)o=e[i++],s=e[i++];else return n;!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function m7(t,e,n){var r;let i,o,s;return n?(i=e.changes,o=Bn.empty(e.changes.length),s=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),o=t.changes.mapDesc(e.changes,!0),s=t.changes.compose(i)),{changes:s,selection:e.selection?e.selection.map(o):(r=t.selection)===null||r===void 0?void 0:r.map(i),effects:ot.mapEffects(t.effects,i).concat(ot.mapEffects(e.effects,o)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function tb(t,e,n){let r=e.selection,i=Mc(e.annotations);return e.userEvent&&(i=i.concat(_n.userEvent.of(e.userEvent))),{changes:e.changes instanceof Bn?e.changes:Bn.of(e.changes||[],n,t.facet(d7)),selection:r&&(r instanceof ve?r:ve.single(r.anchor,r.head)),effects:Mc(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function O7(t,e,n){let r=tb(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(n=!1);let s=!!e[o].sequential;r=m7(r,tb(t,e[o],s?r.changes.newLength:t.doc.length),s)}let i=_n.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return sH(n?oH(i):i)}function oH(t){let e=t.startState,n=!0;for(let i of e.facet(h7)){let o=i(t);if(o===!1){n=!1;break}Array.isArray(o)&&(n=n===!0?o:iH(n,o))}if(n!==!0){let i,o;if(n===!1)o=t.changes.invertedDesc,i=Bn.empty(e.doc.length);else{let s=t.changes.filter(n);i=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}t=_n.create(e,i,t.selection&&t.selection.map(o),ot.mapEffects(t.effects,o),t.annotations,t.scrollIntoView)}let r=e.facet(p7);for(let i=r.length-1;i>=0;i--){let o=r[i](t);o instanceof _n?t=o:Array.isArray(o)&&o.length==1&&o[0]instanceof _n?t=o[0]:t=O7(e,Mc(o),!1)}return t}function sH(t){let e=t.startState,n=e.facet(f7),r=t;for(let i=n.length-1;i>=0;i--){let o=n[i](t);o&&Object.keys(o).length&&(r=m7(r,tb(e,o,t.changes.newLength),!0))}return r==t?t:_n.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const aH=[];function Mc(t){return t==null?aH:Array.isArray(t)?t:[t]}var pn=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(pn||(pn={}));const lH=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let nb;try{nb=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function cH(t){if(nb)return nb.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>"\x80"&&(n.toUpperCase()!=n.toLowerCase()||lH.test(n)))return!0}return!1}function uH(t){return e=>{if(!/\S/.test(e))return pn.Space;if(cH(e))return pn.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return pn.Word;return pn.Other}}class Pt{constructor(e,n,r,i,o,s){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)ch(this,a<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return ch(this,r),Ng(this,r)}update(...e){return O7(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:i}=n;for(let a of e.effects)a.is(Pf.reconfigure)?(n&&(i=new Map,n.compartments.forEach((l,c)=>i.set(c,l)),n=null),i.set(a.value.compartment,a.value.extension)):a.is(ot.reconfigure)?(n=null,r=a.value):a.is(ot.appendConfig)&&(n=null,r=Mc(r).concat(a.value));let o;n?o=e.startState.values.slice():(n=U0.resolve(r,i,this),o=new Pt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(a,l)=>l.reconfigure(a,this),null).values);let s=e.startState.facet(eb)?e.newSelection:e.newSelection.asSingle();new Pt(n,e.newDoc,s,o,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:ve.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),o=[r.range],s=Mc(r.effects);for(let a=1;a<n.ranges.length;a++){let l=e(n.ranges[a]),c=this.changes(l.changes),d=c.map(i);for(let p=0;p<a;p++)o[p]=o[p].map(d);let h=i.mapDesc(c,!0);o.push(l.range.map(h)),i=i.compose(d),s=ot.mapEffects(s,d).concat(ot.mapEffects(Mc(l.effects),h))}return{changes:i,selection:ve.create(o,n.mainIndex),effects:s}}changes(e=[]){return e instanceof Bn?e:Bn.of(e,this.doc.length,this.facet(Pt.lineSeparator))}toText(e){return Mt.of(e.split(this.facet(Pt.lineSeparator)||Yy))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(ch(this,n),Ng(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof Yn&&this.config.address[i.id]!=null&&(n[r]=i.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let o in r)if(Object.prototype.hasOwnProperty.call(e,o)){let s=r[o],a=e[o];i.push(s.init(l=>s.spec.fromJSON(a,l)))}}return Pt.create({doc:e.doc,selection:ve.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=U0.resolve(e.extensions||[],new Map),r=e.doc instanceof Mt?e.doc:Mt.of((e.doc||"").split(n.staticFacet(Pt.lineSeparator)||Yy)),i=e.selection?e.selection instanceof ve?e.selection:ve.single(e.selection.anchor,e.selection.head):ve.single(0);return a7(i,r.length),n.staticFacet(eb)||(i=i.asSingle()),new Pt(n,r,i,n.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(Pt.tabSize)}get lineBreak(){return this.facet(Pt.lineSeparator)||`
@@ -521,7 +521,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
521
521
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
522
522
  `,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){const e=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,e.value){const n="end"in e.value?e.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else e.sep?e.sep.push(this.sourceToken):e.start.push(this.sourceToken);return;case"space":case"comment":if(e.value)t.items.push({start:[this.sourceToken]});else if(e.sep)e.sep.push(this.sourceToken);else{if(this.atIndentedComment(e.start,t.indent)){const n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){CO(n,e.start),n.push(this.sourceToken),t.items.pop();return}}e.start.push(this.sourceToken)}return}if(this.indent>=t.indent){const n=!this.onKeyLine&&this.indent===t.indent,r=n&&(e.sep||e.explicitKey)&&this.type!=="seq-item-ind";let i=[];if(r&&e.sep&&!e.value){const o=[];for(let s=0;s<e.sep.length;++s){const a=e.sep[s];switch(a.type){case"newline":o.push(s);break;case"space":break;case"comment":a.indent>t.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(i=e.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||e.value?(i.push(this.sourceToken),t.items.push({start:i}),this.onKeyLine=!0):e.sep?e.sep.push(this.sourceToken):e.start.push(this.sourceToken);return;case"explicit-key-ind":!e.sep&&!e.explicitKey?(e.start.push(this.sourceToken),e.explicitKey=!0):r||e.value?(i.push(this.sourceToken),t.items.push({start:i,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(e.explicitKey)if(e.sep)if(e.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Wa(e.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(OR(e.key)&&!Wa(e.sep,"newline")){const o=ku(e.start),s=e.key,a=e.sep;a.push(this.sourceToken),delete e.key,delete e.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:s,sep:a}]})}else i.length>0?e.sep=e.sep.concat(i,this.sourceToken):e.sep.push(this.sourceToken);else if(Wa(e.start,"newline"))Object.assign(e,{key:null,sep:[this.sourceToken]});else{const o=ku(e.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else e.sep?e.value||r?t.items.push({start:i,key:null,sep:[this.sourceToken]}):Wa(e.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):e.sep.push(this.sourceToken):Object.assign(e,{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);r||e.value?(t.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0):e.sep?this.stack.push(o):(Object.assign(e,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{const o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!e.explicitKey&&e.sep&&!Wa(e.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&t.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){const e=t.items[t.items.length-1];switch(this.type){case"newline":if(e.value){const n="end"in e.value?e.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else e.start.push(this.sourceToken);return;case"space":case"comment":if(e.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(e.start,t.indent)){const n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){CO(n,e.start),n.push(this.sourceToken),t.items.pop();return}}e.start.push(this.sourceToken)}return;case"anchor":case"tag":if(e.value||this.indent<=t.indent)break;e.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;e.value||Wa(e.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):e.start.push(this.sourceToken);return}if(this.indent>t.indent){const n=this.startBlockValue(t);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const e=t.items[t.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!e||e.sep?t.items.push({start:[this.sourceToken]}):e.start.push(this.sourceToken);return;case"map-value-ind":!e||e.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):e.sep?e.sep.push(this.sourceToken):Object.assign(e,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!e||e.value?t.items.push({start:[this.sourceToken]}):e.sep?e.sep.push(this.sourceToken):e.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const r=this.flowScalar(this.type);!e||e.value?t.items.push({start:[],key:r,sep:[]}):e.sep?this.stack.push(r):Object.assign(e,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const n=this.startBlockValue(t);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{const n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===t.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){const r=kO(n),i=ku(r);vR(t);const o=t.end.splice(1,t.end.length);o.push(this.sourceToken);const s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let e=this.source.indexOf(`
523
523
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
524
- `,e)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){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 e=kO(t),n=ku(e);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const e=kO(t),n=ku(e);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,e){return this.type!=="comment"||this.indent<=e?!1:t.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){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:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function nue(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new eue||null,prettyErrors:e}}function rue(t,e={}){const{lineCounter:n,prettyErrors:r}=nue(e),i=new tue(n?.addNewLine),o=new Fce(e);let s=null;for(const a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new lp(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(s.errors.forEach(oR(t,n)),s.warnings.forEach(oR(t,n))),s}class iue{constructor(e){this.providers=e}providers;extractEnvironments(e,n){const r=e.toJS();return Object.keys(r).filter(i=>i!=="version").map(i=>{const o=r[i],s=Object.entries(o.inputs??{}).map(([l,c])=>{const d=this.providers.resolveProviderForMarker(c);return d?{name:l,value:d.resolve(n,i,l),isSecret:!0}:{name:l,value:typeof c=="string"?c:"",isSecret:!1}}),a=Object.entries(o.servers??{}).map(([l,c])=>({apiId:l,value:c.value,variables:Object.entries(c.variables??{}).map(([d,h])=>({name:d,value:h}))}));return{name:i,inputs:s,servers:a,state:It.Normal}})}hydrateDocument(e,n,r){const i=new Set(n.map(o=>o.name).filter(Boolean));this.deleteRemovedKeys(e,[],i,"version");for(const o of n)if(o.name){if(!e.hasIn([o.name])){const s=e.createNode({});s instanceof Xr&&(s.flow=!1),e.setIn([o.name],s)}this.syncInputs(e,o.name,o.inputs,r),this.syncServers(e,o.name,o.servers)}return e}syncInputs(e,n,r,i){const o=new Set(r.map(s=>s.name));this.deleteRemovedKeys(e,[n,"inputs"],o),r.length>0&&this.unflowMap(e,[n,"inputs"]);for(const s of r){const a=[n,"inputs",s.name];if(s.isSecret){const l=this.providers.getDefaultProvider();l.isMarker(e.getIn(a))||e.setIn(a,e.createNode(l.createMarker())),l.store(i,n,s.name,s.value);continue}e.getIn(a)!==s.value&&e.setIn(a,s.value)}}syncServers(e,n,r){const i=new Set(r.map(o=>o.apiId));this.deleteRemovedKeys(e,[n,"servers"],i),r.length>0&&this.unflowMap(e,[n,"servers"]);for(const o of r){const s=[n,"servers",o.apiId];e.getIn([...s,"value"])!==o.value&&e.setIn([...s,"value"],o.value);const a=new Set(o.variables.map(l=>l.name));this.deleteRemovedKeys(e,[...s,"variables"],a),o.variables.length>0&&this.unflowMap(e,[...s,"variables"]);for(const l of o.variables){const c=[...s,"variables",l.name];e.getIn(c)!==l.value&&e.setIn(c,l.value)}}}unflowMap(e,n){const r=e.getIn(n,!0);r instanceof Xr&&r.flow&&(r.flow=!1)}deleteRemovedKeys(e,n,r,i){for(const o of this.getMapKeys(e,...n))o!==i&&!r.has(o)&&e.deleteIn([...n,o])}getMapKeys(e,...n){const r=n.length===0?e.contents:e.getIn(n,!0);return r instanceof Xr?r.items.map(i=>String(i.key)):[]}}class oue{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 sue{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 aue{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 lue{notifications=new Map;async getAll(){return Array.from(this.notifications.values())}async set(e,n){const r=n.filter(o=>o.severity==="error").length,i=n.filter(o=>o.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 hp={all:["notifications"],lists:()=>[...hp.all,"list"]};function cue(){return rg({queryKey:hp.lists(),queryFn:async()=>pp.getInstance().getAll()})}function uue(){return rg({queryKey:hp.lists(),queryFn:async()=>pp.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class pp{static instance=null;static initialize(){this.close();const e=new lue;this.instance=new aue(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let C2=null;function yR(){return C2||(C2=new CL({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),C2}function due(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 hue(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:due(e)}]}function pue(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function P2(t){try{const e=pp.getInstance();await t(e),yR().invalidateQueries({queryKey:hp.all})}catch{}}async function $2(t,e){await P2(async n=>{await n.set(t,hue(e))})}async function fue(t,e){e.length!==0&&await P2(async n=>{await n.set(t,pue(e))})}async function Cu(t){await P2(async e=>{await e.clear(t)})}class gue{constructor(e,n,r){this.storage=e,this.localStorageSecretsProvider=n,this.options=r}storage;localStorageSecretsProvider;options;default=[];configError=null;handler=new iue(new sue([new oue],"local"));filePath="replay-environments.yaml";getConfigError(){return this.configError}async read(){const e=await this.loadDocumentFromStorage();if(e.status!=="ok")return this.default;try{const n=await this.readSecrets(),r=this.handler.extractEnvironments(e.document,n);return await Cu(this.filePath),r}catch(n){return console.info("Error reading replay environments",n),await $2(this.filePath,n),this.default}}async write(e){const n=await this.loadDocumentFromStorage();if(n.status==="invalid"&&!this.options.rebuildWhenUnparseable)return;const r=n.status==="ok"?n.document:null;if(!r&&mue(e))return;const i=await this.readSecrets(),o=this.handler.hydrateDocument(r??new Rf({}),e,i);await this.localStorageSecretsProvider.set(JSON.stringify(i)),await this.storage.set(this.filePath,o.toString())}async loadDocumentFromStorage(){const e=await this.storage.get(this.filePath);if(!e)return this.configError=null,await Cu(this.filePath),{status:"absent"};const n=rue(e);return n.errors.length>0?(console.error("Environments file has YAML errors",n.errors),this.configError={filePath:this.filePath,issues:n.errors.map(r=>({message:r.message.trim(),line:r.linePos?.[0]?.line}))},await fue(this.filePath,n.errors),{status:"invalid"}):(this.configError=null,n.contents?{status:"ok",document:n}:(await Cu(this.filePath),{status:"absent"}))}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 mue(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===Ec&&e.inputs.length===0&&e.servers.length===0}class Oue{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 Q2=(t,e)=>({data:t,version:e});class bR extends Oue{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return Q2(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(Q2(e,this.version))}}function vue(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===De.Step?{...e,data:{...e.data,draftStep:{...e.data.step,security:e.data.step.security.securities},step:void 0,hasUnsavedChanges:void 0,showUnsavedChangesModal:void 0}}:e)},version:2}}const j2=2,yue="tabs.json";class bue extends bR{migrationMap={1:vue};constructor(e){super(e,yue,lo(sy),j2)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=Q2(lo(sy),j2)),n.version!==j2&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===De.Step){if(i.data.draftStep){const o=i.data.draftStep.requestBody.formData;o["multipart/form-data"]=await xR(o["multipart/form-data"]),o["application/x-www-form-urlencoded"]=await xR(o["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await ep(i.data.draftStep.requestBody.binary.absolutePath))}return{...i,data:{...i.data,isProcessingRequest:!1}}}return i}));return{...n.data,tabs:r}}stringify(e){const n={...e,tabs:e.tabs.map(r=>{if(r.data.type===De.Step){const{isProcessingRequest:i,...o}=r.data;return{...r,data:{...o,response:null}}}return r.data.type===De.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function xR(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 JI(r)}return n}))}const xue=1;class wR{constructor(e,n,r,i,o,s,a){this.systemFilesStorage=e,this.userFilesStorage=n,this.project=r,this.isApiPersisted=i,this.rebuildUnparseableEnvironments=o,this.convertOperationToReplayValue=s,this.telemetry=a,this.localStorageSecretsProvider=new oG(this.project.id);const l=new iG;this.activeEnvironmentIdStorage=new bR(this.systemFilesStorage,"active_environment_id.json",Ec,xue),this.tabsStateStorage=new bue(this.systemFilesStorage),this.environmentsStorage=new gue(this.userFilesStorage,this.localStorageSecretsProvider,{rebuildWhenUnparseable:o}),this.collectionsStorage=new Yle(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new sG(this.isApiPersisted?this.userFilesStorage:l)}systemFilesStorage;userFilesStorage;project;isApiPersisted;rebuildUnparseableEnvironments;convertOperationToReplayValue;telemetry;activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;localStorageSecretsProvider;persistExcludedIds=new Set;watchExcludedIds=new Set;getEnvironmentsConfigError(){return this.environmentsStorage.getConfigError()}reportEnvironmentsConfigError(e){if(this.rebuildUnparseableEnvironments)return;const n=this.getEnvironmentsConfigError();!n&&!e.configFileError.get({noproxy:!0})||e.configFileError.set(n)}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":await this.environmentsStorage.write(n.environments.get()),this.reportEnvironmentsConfigError(n);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 fe(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!an()&&(r=d4(window.location.href)),{object:t,id:e,uri:r}}class wue extends wR{constructor(e,n,r){const i=new jy(e.systemFilesDir),o=new jy(e.userFilesDir);super(i,o,e,!1,!0,n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[fe("storageOperation","detectFiles","storage")],e?.parentCtx),r=(await this.userFilesStorage.ls()).filter(a=>/\.(ya?ml|json)$/.test(a)),i=[],o=[],s=new Set;return await Promise.all(r.map(async a=>{const l=await this.userFilesStorage.get(a);if(l)try{const c=vl.load(l);if(typeof c=="object"&&c!==null)if(typeof c.openapi=="string"){const d=await Vt.resolve(await Vt.join(this.userFilesStorage.baseDir,a)),{definition:h}=await Sg(d,c);i.push({uri:a,type:Gr.FS,content:h}),await Cu(a)}else typeof c.arazzo=="string"&&(o.push({uri:a,type:Gr.FS,content:c}),await Cu(a),c.sourceDescriptions?.forEach(d=>{const h=d.type,p=d.url,f=!h||h==="openapi",m=typeof p=="string"&&Ti(p);f&&m&&s.add(p)}))}catch(c){console.info(`Error parsing YAML/JSON file ${a}:`,c),await $2(a,c)}})),n?.setAttribute("status","completed"),n?.setAttribute("filesCount",r.length),n?.setAttribute("apiFilesCount",i.length),n?.setAttribute("collectionFilesCount",o.length),n?.setAttribute("apiUrlsCount",s.size),n?.setStatus(Is.OK),n?.end(),{apiFiles:i,collectionFiles:o,apiUrls:s}}async loadApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.loadApis",[{...fe("storageOperation","loadApis","storage"),apiUrlsCount:e.size}],n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async o=>{try{const{definition:s}=await Sg(o);i.push({uri:o,type:Gr.WEB,content:s})}catch(s){console.error(`Error parsing YAML from ${o}:`,s)}})),r?.setAttribute("status","completed"),r?.setStatus(Is.OK),r?.end(),i}async parseApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.parseApis",[{...fe("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(Is.OK),r?.end(),i}async parseCollections(e,n,r){const i=this.telemetry?.startSpan("com.redocly.storage.parseCollections",[{...fe("storageOperation","parseCollections","storage"),collectionsCount:e.length}],r?.parentCtx),o=await this.collectionsStorage.parseMany(e,n);return i?.setAttribute("status","completed"),i?.setAttribute("parsedCollectionsCount",o.length),i?.setStatus(Is.OK),i?.end(),o}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",[fe("storageOperation","read","storage")],void 0),n=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[fe("storageOperation","loadUserState","storage")],e?.parentCtx),[r,i,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);n?.setAttribute("status","completed"),n?.setAttribute("environmentCount",o.length),n?.setStatus(Is.OK),n?.end();const{apiFiles:s,collectionFiles:a,apiUrls:l}=await this.detectProjectFiles(e),c=await this.loadApis(l,e),d=await this.parseApis([...s,...c],e);this.apisStorage.setItemIds(d.map(p=>p.id));const h=await this.parseCollections(a,d,e);return this.collectionsStorage.setItemIds(h.map(p=>p.id)),e?.setAttribute("status","completed"),e?.setStatus(Is.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:i,environments:o,apis:d,collections:h,configFileError:null}}}function Sue(t=!1){let e,n,r=!1,i=null,o=null,s=null;function a(){s&&(s(),s=null)}async function l(h){if(!(!an()||!e||!o)){await c();try{const{FileWatcher:p}=await import("./redocly-openapi-docs.min.FileWatcher-DMjNW66W.js"),f=o.project.userFilesDir.get();i=new p(e,o,f,h),await i.start()}catch(p){console.error("Failed to start file watcher:",p),i=null}}}async function c(){i&&(await i.stop(),i=null)}async function d(){an()&&(await c(),await Hn("cleanup_all_managed_watchers"))}return()=>({id:"RootStoragePlugin",onCreate:(h,p)=>({getTauriRootStorage:f=>()=>n,cleanup:()=>async()=>{a(),await d()},init:f=>async(m,g,O)=>{if(r||f.path.length>0)return{isInitialized:!1};const{convertOperationToReplayValue:y,aiEnabled:b}=g,w=an();if(r=!0,o=f,a(),t)return r=!1,{isInitialized:!0};if(w){const{TauriRootStorage:S}=await import("./redocly-openapi-docs.min.TauriRootStorage-m4plsfqx.js");n=new S(m,y,O),e=n}else n=void 0,e=new wue(m,y,O);if(w){await c();const{getSemanticSearchService:S}=await import("./redocly-openapi-docs.min.index-EVRmC_IQ.js");S().setProject(m.id)}const k=await e.read();if(f.merge(k),!w)return r=!1,{isInitialized:!0};try{if(await l(b??!1),b){const[{getSemanticSearchService:S},{createIndexSnapshotGetter:$,startPeriodicIndexRevalidation:P}]=await Promise.all([import("./redocly-openapi-docs.min.index-EVRmC_IQ.js"),import("./redocly-openapi-docs.min.periodic-revalidation-Dsp-n7ui.js")]),Q=S();Q.preloadModel().catch(()=>{}),Q.reindex($(o)).catch(T=>{console.error("Semantic reindex failed:",T)}),s=P(Q,o)}}finally{r=!1}return{isInitialized:!0}}}),onSet(h,p,f){r||!t&&e&&e.update(p,f)},onDestroy:async()=>{a(),await d()}})}function kue({defaultEnvironments:t}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},tabsState:lo(sy),activeEnvironmentId:Ec,environments:t||oy,collections:[],apis:[],apps:{apps:[],appsLoadingState:Xo.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set,configFileError:null})}const Cue=HW(kue(),JW(BF({key:"replay-root-store"}),Sue())),SR=v.createContext(Cue);function Fe(){const t=v.useContext(SR);return av(t)}function Vl(){const t=Fe(),{apis:e}=t;return{apis:e}}function fp(t){const{apis:e}=Vl();return{api:e.find(n=>n.id.get()===t)??null}}function PO(t,e,n){const{api:r}=fp(t);return{specDefault:r?.servers?.ornull?.find(i=>i.url.get()===e)?.variables?.ornull?.[n]?.ornull?.default?.get()}}function Pue({variable:t,apiId:e,serverUrl:n}){const{specDefault:r}=PO(e,n,t.get().name);return r===void 0?null:u.jsx($ue,{fullWidth:!0,variant:"ghost",size:"small",icon:u.jsx(xg,{size:"14px"}),onClick:()=>t.merge({value:r}),children:"Reset to default"})}const $ue=x(de)`
524
+ `,e)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){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 e=kO(t),n=ku(e);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const e=kO(t),n=ku(e);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,e){return this.type!=="comment"||this.indent<=e?!1:t.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){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:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function nue(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new eue||null,prettyErrors:e}}function rue(t,e={}){const{lineCounter:n,prettyErrors:r}=nue(e),i=new tue(n?.addNewLine),o=new Fce(e);let s=null;for(const a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new lp(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(s.errors.forEach(oR(t,n)),s.warnings.forEach(oR(t,n))),s}class iue{constructor(e){this.providers=e}providers;extractEnvironments(e,n){const r=e.toJS();return Object.keys(r).filter(i=>i!=="version").map(i=>{const o=r[i],s=Object.entries(o.inputs??{}).map(([l,c])=>{const d=this.providers.resolveProviderForMarker(c);return d?{name:l,value:d.resolve(n,i,l),isSecret:!0}:{name:l,value:typeof c=="string"?c:"",isSecret:!1}}),a=Object.entries(o.servers??{}).map(([l,c])=>({apiId:l,value:c.value,variables:Object.entries(c.variables??{}).map(([d,h])=>({name:d,value:h}))}));return{name:i,inputs:s,servers:a,state:It.Normal}})}hydrateDocument(e,n,r){const i=new Set(n.map(o=>o.name).filter(Boolean));this.deleteRemovedKeys(e,[],i,"version");for(const o of n)if(o.name){if(!e.hasIn([o.name])){const s=e.createNode({});s instanceof Xr&&(s.flow=!1),e.setIn([o.name],s)}this.syncInputs(e,o.name,o.inputs,r),this.syncServers(e,o.name,o.servers)}return e}syncInputs(e,n,r,i){const o=new Set(r.map(s=>s.name));this.deleteRemovedKeys(e,[n,"inputs"],o),r.length>0&&this.unflowMap(e,[n,"inputs"]);for(const s of r){const a=[n,"inputs",s.name];if(s.isSecret){const l=this.providers.getDefaultProvider();l.isMarker(e.getIn(a))||e.setIn(a,e.createNode(l.createMarker())),l.store(i,n,s.name,s.value);continue}e.getIn(a)!==s.value&&e.setIn(a,s.value)}}syncServers(e,n,r){const i=new Set(r.map(o=>o.apiId));this.deleteRemovedKeys(e,[n,"servers"],i),r.length>0&&this.unflowMap(e,[n,"servers"]);for(const o of r){const s=[n,"servers",o.apiId];e.getIn([...s,"value"])!==o.value&&e.setIn([...s,"value"],o.value);const a=new Set(o.variables.map(l=>l.name));this.deleteRemovedKeys(e,[...s,"variables"],a),o.variables.length>0&&this.unflowMap(e,[...s,"variables"]);for(const l of o.variables){const c=[...s,"variables",l.name];e.getIn(c)!==l.value&&e.setIn(c,l.value)}}}unflowMap(e,n){const r=e.getIn(n,!0);r instanceof Xr&&r.flow&&(r.flow=!1)}deleteRemovedKeys(e,n,r,i){for(const o of this.getMapKeys(e,...n))o!==i&&!r.has(o)&&e.deleteIn([...n,o])}getMapKeys(e,...n){const r=n.length===0?e.contents:e.getIn(n,!0);return r instanceof Xr?r.items.map(i=>String(i.key)):[]}}class oue{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 sue{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 aue{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 lue{notifications=new Map;async getAll(){return Array.from(this.notifications.values())}async set(e,n){const r=n.filter(o=>o.severity==="error").length,i=n.filter(o=>o.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 hp={all:["notifications"],lists:()=>[...hp.all,"list"]};function cue(){return rg({queryKey:hp.lists(),queryFn:async()=>pp.getInstance().getAll()})}function uue(){return rg({queryKey:hp.lists(),queryFn:async()=>pp.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class pp{static instance=null;static initialize(){this.close();const e=new lue;this.instance=new aue(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let C2=null;function yR(){return C2||(C2=new CL({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),C2}function due(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 hue(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:due(e)}]}function pue(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function P2(t){try{const e=pp.getInstance();await t(e),yR().invalidateQueries({queryKey:hp.all})}catch{}}async function $2(t,e){await P2(async n=>{await n.set(t,hue(e))})}async function fue(t,e){e.length!==0&&await P2(async n=>{await n.set(t,pue(e))})}async function Cu(t){await P2(async e=>{await e.clear(t)})}class gue{constructor(e,n,r){this.storage=e,this.localStorageSecretsProvider=n,this.options=r}storage;localStorageSecretsProvider;options;default=[];configError=null;handler=new iue(new sue([new oue],"local"));filePath="replay-environments.yaml";getConfigError(){return this.configError}async read(){const e=await this.loadDocumentFromStorage();if(e.status!=="ok")return this.default;try{const n=await this.readSecrets(),r=this.handler.extractEnvironments(e.document,n);return await Cu(this.filePath),r}catch(n){return console.info("Error reading replay environments",n),await $2(this.filePath,n),this.default}}async write(e){const n=await this.loadDocumentFromStorage();if(n.status==="invalid"&&!this.options.rebuildWhenUnparseable)return;const r=n.status==="ok"?n.document:null;if(!r&&mue(e))return;const i=await this.readSecrets(),o=this.handler.hydrateDocument(r??new Rf({}),e,i);await this.localStorageSecretsProvider.set(JSON.stringify(i)),await this.storage.set(this.filePath,o.toString())}async loadDocumentFromStorage(){const e=await this.storage.get(this.filePath);if(!e)return this.configError=null,await Cu(this.filePath),{status:"absent"};const n=rue(e);return n.errors.length>0?(console.error("Environments file has YAML errors",n.errors),this.configError={filePath:this.filePath,issues:n.errors.map(r=>({message:r.message.trim(),line:r.linePos?.[0]?.line}))},await fue(this.filePath,n.errors),{status:"invalid"}):(this.configError=null,n.contents?{status:"ok",document:n}:(await Cu(this.filePath),{status:"absent"}))}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 mue(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===Ec&&e.inputs.length===0&&e.servers.length===0}class Oue{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 Q2=(t,e)=>({data:t,version:e});class bR extends Oue{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return Q2(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(Q2(e,this.version))}}function vue(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===De.Step?{...e,data:{...e.data,draftStep:{...e.data.step,security:e.data.step.security.securities},step:void 0,hasUnsavedChanges:void 0,showUnsavedChangesModal:void 0}}:e)},version:2}}const j2=2,yue="tabs.json";class bue extends bR{migrationMap={1:vue};constructor(e){super(e,yue,lo(sy),j2)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=Q2(lo(sy),j2)),n.version!==j2&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===De.Step){if(i.data.draftStep){const o=i.data.draftStep.requestBody.formData;o["multipart/form-data"]=await xR(o["multipart/form-data"]),o["application/x-www-form-urlencoded"]=await xR(o["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await ep(i.data.draftStep.requestBody.binary.absolutePath))}return{...i,data:{...i.data,isProcessingRequest:!1}}}return i}));return{...n.data,tabs:r}}stringify(e){const n={...e,tabs:e.tabs.map(r=>{if(r.data.type===De.Step){const{isProcessingRequest:i,...o}=r.data;return{...r,data:{...o,response:null}}}return r.data.type===De.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function xR(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 JI(r)}return n}))}const xue=1;class wR{constructor(e,n,r,i,o,s,a){this.systemFilesStorage=e,this.userFilesStorage=n,this.project=r,this.isApiPersisted=i,this.rebuildUnparseableEnvironments=o,this.convertOperationToReplayValue=s,this.telemetry=a,this.localStorageSecretsProvider=new oG(this.project.id);const l=new iG;this.activeEnvironmentIdStorage=new bR(this.systemFilesStorage,"active_environment_id.json",Ec,xue),this.tabsStateStorage=new bue(this.systemFilesStorage),this.environmentsStorage=new gue(this.userFilesStorage,this.localStorageSecretsProvider,{rebuildWhenUnparseable:o}),this.collectionsStorage=new Yle(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new sG(this.isApiPersisted?this.userFilesStorage:l)}systemFilesStorage;userFilesStorage;project;isApiPersisted;rebuildUnparseableEnvironments;convertOperationToReplayValue;telemetry;activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;localStorageSecretsProvider;persistExcludedIds=new Set;watchExcludedIds=new Set;getEnvironmentsConfigError(){return this.environmentsStorage.getConfigError()}reportEnvironmentsConfigError(e){if(this.rebuildUnparseableEnvironments)return;const n=this.getEnvironmentsConfigError();!n&&!e.configFileError.get({noproxy:!0})||e.configFileError.set(n)}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":await this.environmentsStorage.write(n.environments.get()),this.reportEnvironmentsConfigError(n);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 fe(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!an()&&(r=d4(window.location.href)),{object:t,id:e,uri:r}}class wue extends wR{constructor(e,n,r){const i=new jy(e.systemFilesDir),o=new jy(e.userFilesDir);super(i,o,e,!1,!0,n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[fe("storageOperation","detectFiles","storage")],e?.parentCtx),r=(await this.userFilesStorage.ls()).filter(a=>/\.(ya?ml|json)$/.test(a)),i=[],o=[],s=new Set;return await Promise.all(r.map(async a=>{const l=await this.userFilesStorage.get(a);if(l)try{const c=vl.load(l);if(typeof c=="object"&&c!==null)if(typeof c.openapi=="string"){const d=await Vt.resolve(await Vt.join(this.userFilesStorage.baseDir,a)),{definition:h}=await Sg(d,c);i.push({uri:a,type:Gr.FS,content:h}),await Cu(a)}else typeof c.arazzo=="string"&&(o.push({uri:a,type:Gr.FS,content:c}),await Cu(a),c.sourceDescriptions?.forEach(d=>{const h=d.type,p=d.url,f=!h||h==="openapi",m=typeof p=="string"&&Ti(p);f&&m&&s.add(p)}))}catch(c){console.info(`Error parsing YAML/JSON file ${a}:`,c),await $2(a,c)}})),n?.setAttribute("status","completed"),n?.setAttribute("filesCount",r.length),n?.setAttribute("apiFilesCount",i.length),n?.setAttribute("collectionFilesCount",o.length),n?.setAttribute("apiUrlsCount",s.size),n?.setStatus(Is.OK),n?.end(),{apiFiles:i,collectionFiles:o,apiUrls:s}}async loadApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.loadApis",[{...fe("storageOperation","loadApis","storage"),apiUrlsCount:e.size}],n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async o=>{try{const{definition:s}=await Sg(o);i.push({uri:o,type:Gr.WEB,content:s})}catch(s){console.error(`Error parsing YAML from ${o}:`,s)}})),r?.setAttribute("status","completed"),r?.setStatus(Is.OK),r?.end(),i}async parseApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.parseApis",[{...fe("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(Is.OK),r?.end(),i}async parseCollections(e,n,r){const i=this.telemetry?.startSpan("com.redocly.storage.parseCollections",[{...fe("storageOperation","parseCollections","storage"),collectionsCount:e.length}],r?.parentCtx),o=await this.collectionsStorage.parseMany(e,n);return i?.setAttribute("status","completed"),i?.setAttribute("parsedCollectionsCount",o.length),i?.setStatus(Is.OK),i?.end(),o}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",[fe("storageOperation","read","storage")],void 0),n=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[fe("storageOperation","loadUserState","storage")],e?.parentCtx),[r,i,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);n?.setAttribute("status","completed"),n?.setAttribute("environmentCount",o.length),n?.setStatus(Is.OK),n?.end();const{apiFiles:s,collectionFiles:a,apiUrls:l}=await this.detectProjectFiles(e),c=await this.loadApis(l,e),d=await this.parseApis([...s,...c],e);this.apisStorage.setItemIds(d.map(p=>p.id));const h=await this.parseCollections(a,d,e);return this.collectionsStorage.setItemIds(h.map(p=>p.id)),e?.setAttribute("status","completed"),e?.setStatus(Is.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:i,environments:o,apis:d,collections:h,configFileError:null}}}function Sue(t=!1){let e,n,r=!1,i=null,o=null,s=null;function a(){s&&(s(),s=null)}async function l(h){if(!(!an()||!e||!o)){await c();try{const{FileWatcher:p}=await import("./redocly-openapi-docs.min.FileWatcher-BtXjqGQC.js"),f=o.project.userFilesDir.get();i=new p(e,o,f,h),await i.start()}catch(p){console.error("Failed to start file watcher:",p),i=null}}}async function c(){i&&(await i.stop(),i=null)}async function d(){an()&&(await c(),await Hn("cleanup_all_managed_watchers"))}return()=>({id:"RootStoragePlugin",onCreate:(h,p)=>({getTauriRootStorage:f=>()=>n,cleanup:()=>async()=>{a(),await d()},init:f=>async(m,g,O)=>{if(r||f.path.length>0)return{isInitialized:!1};const{convertOperationToReplayValue:y,aiEnabled:b}=g,w=an();if(r=!0,o=f,a(),t)return r=!1,{isInitialized:!0};if(w){const{TauriRootStorage:S}=await import("./redocly-openapi-docs.min.TauriRootStorage-DMQv9g_J.js");n=new S(m,y,O),e=n}else n=void 0,e=new wue(m,y,O);if(w){await c();const{getSemanticSearchService:S}=await import("./redocly-openapi-docs.min.index-BBNK1d3n.js");S().setProject(m.id)}const k=await e.read();if(f.merge(k),!w)return r=!1,{isInitialized:!0};try{if(await l(b??!1),b){const[{getSemanticSearchService:S},{createIndexSnapshotGetter:$,startPeriodicIndexRevalidation:P}]=await Promise.all([import("./redocly-openapi-docs.min.index-BBNK1d3n.js"),import("./redocly-openapi-docs.min.periodic-revalidation-Dsp-n7ui.js")]),Q=S();Q.preloadModel().catch(()=>{}),Q.reindex($(o)).catch(T=>{console.error("Semantic reindex failed:",T)}),s=P(Q,o)}}finally{r=!1}return{isInitialized:!0}}}),onSet(h,p,f){r||!t&&e&&e.update(p,f)},onDestroy:async()=>{a(),await d()}})}function kue({defaultEnvironments:t}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},tabsState:lo(sy),activeEnvironmentId:Ec,environments:t||oy,collections:[],apis:[],apps:{apps:[],appsLoadingState:Xo.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set,configFileError:null})}const Cue=HW(kue(),JW(BF({key:"replay-root-store"}),Sue())),SR=v.createContext(Cue);function Fe(){const t=v.useContext(SR);return av(t)}function Vl(){const t=Fe(),{apis:e}=t;return{apis:e}}function fp(t){const{apis:e}=Vl();return{api:e.find(n=>n.id.get()===t)??null}}function PO(t,e,n){const{api:r}=fp(t);return{specDefault:r?.servers?.ornull?.find(i=>i.url.get()===e)?.variables?.ornull?.[n]?.ornull?.default?.get()}}function Pue({variable:t,apiId:e,serverUrl:n}){const{specDefault:r}=PO(e,n,t.get().name);return r===void 0?null:u.jsx($ue,{fullWidth:!0,variant:"ghost",size:"small",icon:u.jsx(xg,{size:"14px"}),onClick:()=>t.merge({value:r}),children:"Reset to default"})}const $ue=x(de)`
525
525
  justify-content: flex-start;
526
526
  `;function Que({defaultValue:t,onReset:e,name:n}){const r=()=>{e(t)};return u.jsxs(jue,{children:[u.jsxs(Tue,{children:["Default: ",t]}),u.jsx(de,{variant:"ghost",size:"small",icon:u.jsx(xg,{size:"14px"}),onClick:r,"data-testid":n?`reset-server-variable-editor-${n}`:"reset-server-variable-editor",children:"Reset"})]})}const jue=x.div`
527
527
  display: flex;
@@ -733,7 +733,7 @@ ${L}`,ce=Math.min(I.length,T);let Se=0;for(;Se<ce-1;Se++){const ge=E(String(Se),
733
733
  ${U}`,N.pop(),`[${K}]`}let W=Object.keys(I);const B=W.length;if(B===0)return"{}";if(Q<N.length+1)return'"[Object]"';L+=Z;const Y=`,
734
734
  ${L}`;let ie="",G="",oe=Math.min(B,T);l(I)&&(ie+=c(I,Y,T),W=W.slice(I.length),oe-=I.length,G=Y),$&&(W=s(W,P)),N.push(I);for(let K=0;K<oe;K++){const ye=W[K],ce=E(ye,I[ye],N,Z,L);ce!==void 0&&(ie+=`${G}${o(ye)}: ${ce}`,G=Y)}if(B>T){const K=B-T;ie+=`${G}"...": "${m(K)} not stringified"`,G=Y}return G!==""&&(ie=`
735
735
  ${L}${ie}
736
- ${U}`),N.pop(),`{${ie}}`}case"number":return isFinite(I)?String(I):w?w(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return w?w(I):void 0}}function A(M,I,N){switch(typeof I){case"string":return o(I);case"object":{if(I===null)return"null";if(typeof I.toJSON=="function"){if(I=I.toJSON(M),typeof I!="object")return A(M,I,N);if(I===null)return"null"}if(N.indexOf(I)!==-1)return k;let Z="";const L=I.length!==void 0;if(L&&Array.isArray(I)){if(I.length===0)return"[]";if(Q<N.length+1)return'"[Array]"';N.push(I);const ie=Math.min(I.length,T);let G=0;for(;G<ie-1;G++){const K=A(String(G),I[G],N);Z+=K!==void 0?K:"null",Z+=","}const oe=A(String(G),I[G],N);if(Z+=oe!==void 0?oe:"null",I.length-1>T){const K=I.length-T-1;Z+=`,"... ${m(K)} not stringified"`}return N.pop(),`[${Z}]`}let U=Object.keys(I);const W=U.length;if(W===0)return"{}";if(Q<N.length+1)return'"[Object]"';let B="",Y=Math.min(W,T);L&&l(I)&&(Z+=c(I,",",T),U=U.slice(I.length),Y-=I.length,B=","),$&&(U=s(U,P)),N.push(I);for(let ie=0;ie<Y;ie++){const G=U[ie],oe=A(G,I[G],N);oe!==void 0&&(Z+=`${B}${o(G)}:${oe}`,B=",")}if(W>T){const ie=W-T;Z+=`${B}"...":"${m(ie)} not stringified"`}return N.pop(),`{${Z}}`}case"number":return isFinite(I)?String(I):w?w(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return w?w(I):void 0}}function R(M,I,N){if(arguments.length>1){let Z="";if(typeof N=="number"?Z=" ".repeat(Math.min(N,10)):typeof N=="string"&&(Z=N.slice(0,10)),I!=null){if(typeof I=="function")return q("",{"":M},[],I,Z,"");if(Array.isArray(I))return _("",M,[],g(I),Z,"")}if(Z.length!==0)return E("",M,[],Z,"")}return A("",M,[])}return R}})(t5,t5.exports)),t5.exports}var Wfe=Ufe();const Lfe=Td(Wfe),Yfe=Lfe.configure;class Mf extends QU{static maxErrorTextChars=4096;static stringify=Yfe({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,o)=>o!==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(...r){try{const i=Mf.combineConsoleErrorArgs(r);n.sendError(i,"console.error")}catch{}e?.apply(this,r)}}}sendError(e,n){this.sendErrorEvent(Mf.toErrorEvent(e,n))}}class Bfe{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new Vfe,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 i=e&&typeof e=="object"&&"type"in e&&"data"in e?e:this.constructCloudEvent(e,n,{...r,signal:"log"});this.sendToOtelService(i)}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 Mf(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 jfe({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=Mf.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 Iu=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],Ffe="https://cors.redocly.com/";function Gfe(){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 Hfe=Gfe(),Kfe=v.createContext(Hfe);function Vr(){const t=v.useContext(Kfe);return av(t)}function Jfe(t,e){const{apps:{apiId:n}}=Fe(),{corsProxyUrl:r,credentialOrigin:i,disableCollectionsTab:o,oAuth2RedirectURI:s,certificates:a,storageKey:l,isApiBased:c,aiEnabled:d,isPreviewLayout:h}=Vr();r.set(t?.corsProxyUrl??Ffe),i.set(t?.credentialOrigin),n.set(t?.apiId),s.set(t?.oAuth2RedirectURI),o.set(!!t?.disableCollectionsTab),l.set(t?.storageKey),c.set(!!e),d.set(!!t?.aiEnabled),h.set(t?.layout==="preview"),v.useEffect(()=>{a.set(t?.certificates||[])},[t?.certificates])}const BA=v.createContext({});function ar(){return v.useContext(BA)||{}}const ege=!0,tge="0.28.0-next.1",nge={version:tge},rge={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"};class FA{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new Bfe}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(()=>({...rge,...e,env:"production"}))}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",o=r.enableErrorInstrumentation??i==="desktop",s={serviceName:"replay",serviceVersion:nge.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:ege,enableErrorInstrumentation:o};this._client.init({otel:{...s,...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}));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(o=>({...this._globalAttributes,...o}));return this._client.startSpan(e,i,r)}catch(i){console.error("Failed to start telemetry span:",i);return}}}const kp=new FA;function We(){const{telemetry:t}=ar();kp.isInitialized||kp.init(t);const e=t?.cloudEventData;v.useEffect(()=>{e&&kp.setCloudEventData(e)},[e]);const n=v.useCallback((i,o)=>{kp.sendEvent(i,o)},[]),r=v.useCallback((i,o,s)=>kp.startSpan(i,o,s),[]);return{sendEvent:n,startSpan:r}}const ige=t=>u.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.jsx("path",{d:"M7 10.707L4.5 8.2065L5.2065 7.5L7 9.293L10.7925 5.5L11.5 6.2075L7 10.707Z"}),u.jsx("path",{d:"M8 1C6.61553 1 5.26216 1.41054 4.11101 2.17971C2.95987 2.94888 2.06266 4.04213 1.53285 5.32122C1.00303 6.6003 0.86441 8.00776 1.13451 9.36563C1.4046 10.7235 2.07129 11.9708 3.05026 12.9497C4.02922 13.9287 5.2765 14.5954 6.63437 14.8655C7.99224 15.1356 9.3997 14.997 10.6788 14.4672C11.9579 13.9373 13.0511 13.0401 13.8203 11.889C14.5895 10.7378 15 9.38447 15 8C15 6.14348 14.2625 4.36301 12.9497 3.05025C11.637 1.7375 9.85652 1 8 1ZM8 14C6.81332 14 5.65328 13.6481 4.66658 12.9888C3.67989 12.3295 2.91085 11.3925 2.45673 10.2961C2.0026 9.19974 1.88378 7.99334 2.11529 6.82946C2.3468 5.66557 2.91825 4.59647 3.75736 3.75736C4.59648 2.91824 5.66558 2.3468 6.82946 2.11529C7.99335 1.88378 9.19975 2.0026 10.2961 2.45672C11.3925 2.91085 12.3295 3.67988 12.9888 4.66658C13.6481 5.65327 14 6.81331 14 8C14 9.5913 13.3679 11.1174 12.2426 12.2426C11.1174 13.3679 9.5913 14 8 14Z"})]}),GA=x(ige).attrs({"data-component-name":"icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon"})`
736
+ ${U}`),N.pop(),`{${ie}}`}case"number":return isFinite(I)?String(I):w?w(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return w?w(I):void 0}}function A(M,I,N){switch(typeof I){case"string":return o(I);case"object":{if(I===null)return"null";if(typeof I.toJSON=="function"){if(I=I.toJSON(M),typeof I!="object")return A(M,I,N);if(I===null)return"null"}if(N.indexOf(I)!==-1)return k;let Z="";const L=I.length!==void 0;if(L&&Array.isArray(I)){if(I.length===0)return"[]";if(Q<N.length+1)return'"[Array]"';N.push(I);const ie=Math.min(I.length,T);let G=0;for(;G<ie-1;G++){const K=A(String(G),I[G],N);Z+=K!==void 0?K:"null",Z+=","}const oe=A(String(G),I[G],N);if(Z+=oe!==void 0?oe:"null",I.length-1>T){const K=I.length-T-1;Z+=`,"... ${m(K)} not stringified"`}return N.pop(),`[${Z}]`}let U=Object.keys(I);const W=U.length;if(W===0)return"{}";if(Q<N.length+1)return'"[Object]"';let B="",Y=Math.min(W,T);L&&l(I)&&(Z+=c(I,",",T),U=U.slice(I.length),Y-=I.length,B=","),$&&(U=s(U,P)),N.push(I);for(let ie=0;ie<Y;ie++){const G=U[ie],oe=A(G,I[G],N);oe!==void 0&&(Z+=`${B}${o(G)}:${oe}`,B=",")}if(W>T){const ie=W-T;Z+=`${B}"...":"${m(ie)} not stringified"`}return N.pop(),`{${Z}}`}case"number":return isFinite(I)?String(I):w?w(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return w?w(I):void 0}}function R(M,I,N){if(arguments.length>1){let Z="";if(typeof N=="number"?Z=" ".repeat(Math.min(N,10)):typeof N=="string"&&(Z=N.slice(0,10)),I!=null){if(typeof I=="function")return q("",{"":M},[],I,Z,"");if(Array.isArray(I))return _("",M,[],g(I),Z,"")}if(Z.length!==0)return E("",M,[],Z,"")}return A("",M,[])}return R}})(t5,t5.exports)),t5.exports}var Wfe=Ufe();const Lfe=Td(Wfe),Yfe=Lfe.configure;class Mf extends QU{static maxErrorTextChars=4096;static stringify=Yfe({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,o)=>o!==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(...r){try{const i=Mf.combineConsoleErrorArgs(r);n.sendError(i,"console.error")}catch{}e?.apply(this,r)}}}sendError(e,n){this.sendErrorEvent(Mf.toErrorEvent(e,n))}}class Bfe{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new Vfe,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 i=e&&typeof e=="object"&&"type"in e&&"data"in e?e:this.constructCloudEvent(e,n,{...r,signal:"log"});this.sendToOtelService(i)}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 Mf(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 jfe({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=Mf.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 Iu=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],Ffe="https://cors.redocly.com/";function Gfe(){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 Hfe=Gfe(),Kfe=v.createContext(Hfe);function Vr(){const t=v.useContext(Kfe);return av(t)}function Jfe(t,e){const{apps:{apiId:n}}=Fe(),{corsProxyUrl:r,credentialOrigin:i,disableCollectionsTab:o,oAuth2RedirectURI:s,certificates:a,storageKey:l,isApiBased:c,aiEnabled:d,isPreviewLayout:h}=Vr();r.set(t?.corsProxyUrl??Ffe),i.set(t?.credentialOrigin),n.set(t?.apiId),s.set(t?.oAuth2RedirectURI),o.set(!!t?.disableCollectionsTab),l.set(t?.storageKey),c.set(!!e),d.set(!!t?.aiEnabled),h.set(t?.layout==="preview"),v.useEffect(()=>{a.set(t?.certificates||[])},[t?.certificates])}const BA=v.createContext({});function ar(){return v.useContext(BA)||{}}const ege=!0,tge="0.28.0-next.2",nge={version:tge},rge={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"};class FA{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new Bfe}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(()=>({...rge,...e,env:"production"}))}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",o=r.enableErrorInstrumentation??i==="desktop",s={serviceName:"replay",serviceVersion:nge.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:ege,enableErrorInstrumentation:o};this._client.init({otel:{...s,...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}));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(o=>({...this._globalAttributes,...o}));return this._client.startSpan(e,i,r)}catch(i){console.error("Failed to start telemetry span:",i);return}}}const kp=new FA;function We(){const{telemetry:t}=ar();kp.isInitialized||kp.init(t);const e=t?.cloudEventData;v.useEffect(()=>{e&&kp.setCloudEventData(e)},[e]);const n=v.useCallback((i,o)=>{kp.sendEvent(i,o)},[]),r=v.useCallback((i,o,s)=>kp.startSpan(i,o,s),[]);return{sendEvent:n,startSpan:r}}const ige=t=>u.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.jsx("path",{d:"M7 10.707L4.5 8.2065L5.2065 7.5L7 9.293L10.7925 5.5L11.5 6.2075L7 10.707Z"}),u.jsx("path",{d:"M8 1C6.61553 1 5.26216 1.41054 4.11101 2.17971C2.95987 2.94888 2.06266 4.04213 1.53285 5.32122C1.00303 6.6003 0.86441 8.00776 1.13451 9.36563C1.4046 10.7235 2.07129 11.9708 3.05026 12.9497C4.02922 13.9287 5.2765 14.5954 6.63437 14.8655C7.99224 15.1356 9.3997 14.997 10.6788 14.4672C11.9579 13.9373 13.0511 13.0401 13.8203 11.889C14.5895 10.7378 15 9.38447 15 8C15 6.14348 14.2625 4.36301 12.9497 3.05025C11.637 1.7375 9.85652 1 8 1ZM8 14C6.81332 14 5.65328 13.6481 4.66658 12.9888C3.67989 12.3295 2.91085 11.3925 2.45673 10.2961C2.0026 9.19974 1.88378 7.99334 2.11529 6.82946C2.3468 5.66557 2.91825 4.59647 3.75736 3.75736C4.59648 2.91824 5.66558 2.3468 6.82946 2.11529C7.99335 1.88378 9.19975 2.0026 10.2961 2.45672C11.3925 2.91085 12.3295 3.67988 12.9888 4.66658C13.6481 5.65327 14 6.81331 14 8C14 9.5913 13.3679 11.1174 12.2426 12.2426C11.1174 13.3679 9.5913 14 8 14Z"})]}),GA=x(ige).attrs({"data-component-name":"icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon"})`
737
737
  path {
738
738
  fill: ${({color:t})=>it(t)};
739
739
  }
@@ -1074,7 +1074,7 @@ ${U}`),N.pop(),`{${ie}}`}case"number":return isFinite(I)?String(I):w?w(I):"null"
1074
1074
  border-radius: var(--border-radius);
1075
1075
  border: 1px solid var(--border-color-primary);
1076
1076
  padding: 0 calc(var(--spacing-xxs) / 2);
1077
- `,tn=(t,e,n=new Set)=>{const r=c5(t);if(!r.length)return t;let i=0;const o=r.flatMap(({start:s,end:a,name:l})=>{if(n.has(l))return null;const c=e.findLast(h=>h.name===l),d=t.slice(i,c?s:a);if(i=a,c){n.add(l);const h=tn(c.value,e,n);return n.delete(l),[d.length?d:null,h||t.slice(s,a)]}return[d.length?d:null]});return t.slice(i).length&&o.push(t.slice(i)),o.join("")};function Ige(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function Ege(t,e){const n=sD(t);if(!n.length)return u.jsx(aD,{children:t});let r=0;const i=n.flatMap(({start:o,end:s})=>{const a=t.slice(r,o),l=Ige(t.slice(o,s),e);return r=s,[a.length?a:null,l]});return t.slice(r).length&&i.push(t.slice(r)),u.jsx(aD,{children:i.join("")})}class Rge{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 $p{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 import("./redocly-openapi-docs.min.SqliteDBStorage-ak3Zqgtw.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 JO={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function Ul(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function Age(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function Dge(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:Age(t.body,n),header:e,contentType:n,time:t.duration}}async function u5(t,e){const n={};if(!t.some(({key:i,value:o,active:s})=>i&&o&&s))return n;const{evaluateRuntimeExpression:r}=await Promise.resolve().then(()=>LY);for(const{key:i,value:o,active:s}of t)if(!(!i||!o||!s))try{n[i]=r(o,e,JO)}catch{}return n}function Mge(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:Ul(i?.request)??null,response:Ul(i?.response)??null,outputs:Ul(i?.outputs)??{}}))}let lD=0;const d5=new Set;function zge(){lD+=1;for(const t of d5)t()}function _ge(){return lD}function qge(t){return d5.add(t),()=>{d5.delete(t)}}const Nge=10080*60*1e3;async function h5(t){const e=Oo.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:Zf(),date:Date.now(),...t}),zge()}catch(n){console.error("Failed to persist step context:",n)}}async function Zge(t,e,n){if(Oo.getInstance())for(const r of Mge(n,e))await h5({collectionId:t,workflowId:e,...r})}class Oo{static instance=null;static async initialize(e){if(this.close(),!e)return;const{StepContextSqliteDBStorage:n}=await import("./redocly-openapi-docs.min.StepContextSqliteDBStorage-DTB5U2yh.js"),r=$p.getInstance(),i=new n(r);this.instance=new Rge(i)}static getInstance(){return this.instance}static close(){this.instance=null}}const Xge={__replayClearedOutput:!0};function cD(t){return typeof t=="object"&&t!==null&&t.__replayClearedOutput===!0}async function uD(t,e){const n={};for(const r of t){if(n[r.stepId])continue;const i={...r.outputs??{}},o=e?.[r.stepId];if(o&&r.response){const s=o.filter(a=>a.key&&a.active&&!(a.key in i));if(s.length){const a=await u5(s,{$response:r.response,$request:r.request??void 0});for(const[l,c]of Object.entries(a))l in i||(i[l]=c)}}for(const s of Object.keys(i))cD(i[s])&&delete i[s];n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function dD(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const Vge=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function p5(t){const e=new RegExp(Vge),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const Uge=/^\{?\$steps\.([^.{}\s]+)\.(outputs|request|response)\.([^{}\s#]+)(?:#\/([^{}\s]*))?\}?$/;function hD(t){const e=Uge.exec(t.trim());if(!e)return null;const[,n,r,i,o]=e;return{stepId:n,kind:r,outputName:r==="outputs"&&!i.includes(".")?i:void 0,hasPointer:o!==void 0}}const Wge=/^(\{?)(\$steps\.[^.{}\s]+\.(?:request|response)\.[^{}\s#]+)#\/([^{}\s]*)(\}?)$/;function Lge(t,e){const n=Wge.exec(t);if(!n)return;const[,r,i,o,s]=n;if(!!r!=!!s)return;let a;try{a=ya(`${r}${i}${s}`,{$steps:e},JO)}catch{return}let l=a;try{for(const c of o.split("/").filter(Boolean)){if(l==null)return;typeof l=="string"&&(l=JSON.parse(l)),l=l[decodeURIComponent(c)]}}catch{return}return dD(l)}function pD(t,e){if(!t||!t.includes("$steps"))return t;const n=p5(t).map(({start:o,end:s})=>({match:t.slice(o,s),start:o,end:s}));if(!n.length)return t;let r=0;const i=[];for(const{match:o,start:s,end:a}of n){i.push(t.slice(r,s));let l=o;const c=Lge(o,e);if(c!==void 0)l=c;else try{const d=dD(ya(o,{$steps:e},JO));d!==void 0&&(l=d)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function fD(t,e,n){const r=t.collections.find(o=>o.id.get()===e)?.workflows.find(o=>o.workflowId.get()===n)?.steps.get({noproxy:!0});if(!r)return{};const i={};for(const o of r)i[o.stepId]=o.outputs??[];return i}async function gD(t,e){if(!t.response)return{hasValue:!1};const n=await u5([e],{$response:t.response,$request:t.request??void 0});return e.key in n?{hasValue:!0,value:n[e.key]}:{hasValue:!1}}async function Yge(t,e){if(!e)return!1;const n=t.outputs?.[e.key];if(n===void 0||cD(n))return!1;const r=await gD(t,e);return r.hasValue?JSON.stringify(r.value)!==JSON.stringify(n):!1}async function Bge(t,e){return e?(await gD(t,e)).hasValue:!1}const Fge=/\$steps\.([^.\s"'}]+)\./g;function Gge(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(Fge))e.add(n[1]);return[...e]}function f5(t,e,n,r){const i=[],o=s=>{if(s!=null)try{i.push(JSON.stringify(s))}catch(a){console.error("findReferencedStepIds: failed to scan a source for $steps references",a)}};o(t.get({noproxy:!0})),o(e?.get({noproxy:!0})),o(n?.components.parameters.get({noproxy:!0}));for(const s of r?.inputs??[])s.value&&i.push(s.value);return Gge(i.join("\0"))}async function e1(t,e,n,r){const i=Oo.getInstance(),o=[...new Set(r)];if(!i||!e||!n||!o.length)return{};const s=(await Promise.all(o.map(a=>i.getByKey(e,n,a)))).filter(a=>a!=null);return s.length?await uD(s,fD(t,e,n)):{}}function Au(t,e,n){return pD(tn(t,e),n)}function mD(t){return KW(t)}const OD="New Step";function g5({name:t=OD,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=Hge(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function Hge(t){return t.steps.filter(e=>e.state.get()!==It.Draft).map(e=>e.stepId.get())}function cs({name:t=OD,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:o,dynamicReplayValues:s,xOperation:a}={}){if(!n){const c=o?Ww(o,s):null,d=[qi()];return{stepId:g5({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?It.Draft:It.Normal,parameters:{pathParameters:[],queryParameters:a?eh(a.url):[],headers:[],cookies:[]},requestBody:Kh(),xOperation:a??(i?null:{method:"GET",url:""}),security:d,operation:i??null,...c}}const l=n.get({noproxy:!0});return{stepId:g5({name:t,workflow:r}),description:l.description,outputs:l.outputs,successCriteria:l.successCriteria,state:e?It.Draft:It.Normal,parameters:l.parameters,requestBody:l.requestBody,xOperation:l.xOperation,security:l.security,operation:l.operation}}function La(t){return mD(t)?t.xOperation?.ornull?.method.get()??t.operation.ornull?.method.get()??"":t.xOperation?.method??t.operation?.method??""}function Qp(t){return mD(t)?t.xOperation?.ornull?.url.get()??t.operation.ornull?.nested("path").get()??"":t.xOperation?.url??t.operation?.path??""}function t1(t,e,n,r,i){const{inputs:o,servers:s}=r,a=dG(Ca("path",[ln(e?.parameters.pathParameters,n?.components.parameters),ln(t.parameters.pathParameters,n?.components.parameters)]),r.inputs,i),l=t.xOperation??null,c=t.operation??null;let d="",h="";if(l)h=l.method,d=h4(l.url,a);else if(c){const f=s.find(m=>m.apiId===c.apiId);h=c.method==="x-query"?"query":c.method,d=(f?.value?p4(f.value,f.variables):"")+h4(c.path,a)}const p=d.split("?")[0];return{url:Au(p,o,i??{}),method:h.toUpperCase()}}function m5(t,{collectionId:e,workflowId:n,stepId:r}){return t.collections.find(i=>i.id.get()===e)?.workflows.find(i=>i.workflowId.get()===n)?.steps.find(i=>i.stepId.get()===r)??null}function Kge(t){const e=t.substring(7).split(", "),n={};for(const r of e){const[i,o]=r.split("=");n[i]=o.replace(/"/g,"")}return n}function Jge(t,e,n,r,i={}){const{inputs:o}=r,{requestBody:{content:s}}=t,{url:a,method:l}=t1(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast(Q=>Q.securityType===ee.DigestAuth);if(!c)return"";const{username:d,password:h,realm:p,nonce:f,cnonce:m,algorithm:g,qop:O,nc:y,opaque:b}=c[ee.DigestAuth],w=Au(d,o,i),{pathname:k,search:S}=new URL(a),$=S?`${k}${S}`:k,P=eme({username:w,password:Au(h,o,i),uri:$,realm:p,nonce:f,cnonce:m,algorithm:g,qop:O,nc:y,method:l,bodyContent:Au(s,o,i)});return`Digest username="${w}", realm="${p}", nonce="${f}", uri="${$}", qop=${O}, nc=${y}, cnonce="${m}", response="${P}", algorithm=${g}${b?`, opaque="${b}"`:""}`}function eme(t){const{username:e,password:n,realm:r,nonce:i,cnonce:o,algorithm:s,qop:a,nc:l,uri:c,method:d,bodyContent:h}=t,p=tme(s),f=s?.endsWith("-sess")?p(`${p(`${e}:${r}:${n}`)}:${i}:${o}`):p(`${e}:${r}:${n}`),m=a?.includes("auth-int")?p(`${d}:${c}:${p(h)}`):p(`${d}:${c}`);return p(`${f}:${i}:${l}:${o}:${a}:${m}`).toString()}function tme(t){return t?.replace("-sess","")==="SHA-256"?e=>_d(V3(e)):e=>_d(ag(e))}const us=window.__TAURI__?.http.fetch??globalThis.fetch;function nme(t){try{const e=new URL(t).hostname;return e==="localhost"||e==="127.0.0.1"}catch{return!1}}function n1(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function rme(t){return t?t.split(";").map(e=>e.trim()).map(e=>{const n=e.indexOf("="),r=e.slice(0,n).trim(),i=e.slice(n+1).trim();return[r,i]}):[]}const ime=["json","xml","html","text"],ome=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function O5(t,e){return t.get(e)??t.get(e.toLowerCase())}function sme(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function ame(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 lme(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function cme(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return ome.some(r=>n.includes(r))?!0:n.startsWith("application/")?!ime.some(r=>n.includes(r)):!1}async function ume(t,e){const n=O5(t.headers,"content-type")?.split(";")[0].trim(),r=O5(t.headers,"content-disposition"),i=sme(O5(t.headers,"content-length")),o=cme(n,r),s=rme(document.cookie);if(o){const d={fileName:ame(r)||lme(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:s,size:i??0,download:d,bodyNotStored:!0,url:t.url}}const a=await t.clone().arrayBuffer(),l=new TextDecoder().decode(a),c=new Uint8Array(a).length;return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:a,body:l,duration:e,cookies:s,size:c,url:t.url}}const dme=":/?#[]@!$&'()*+,;=",hme=new Set(["!","'","(",")","*"]);function pme(t){return hme.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function vD(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...dme].map(i=>({char:i,encoded:pme(i)}));for(const{char:i,encoded:o}of r)n=n.split(o).join(i);return n}function yD(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 bD(t,e){let n=yD(t);const r=e.find(({host:i,port:o})=>yD(`https://${i}:${o}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}function fme(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function gme(t,e){const{exists:n}=await Promise.resolve().then(()=>oO),{join:r}=await Promise.resolve().then(()=>LI),{baseName:i,extension:o}=fme(e);let s=0;for(;;){const a=s===0?"":` (${s})`,l=`${i}${a}${o}`,c=await r(t,l);if(!await n(c))return c;s+=1}}function mme(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}const jp=new Map;function Ome(t){jp.get(t)?.abort()}function xD(t){return t?t instanceof FormData||t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function vme(t){if(!xD(t))return t}function r1(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function wD(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL(r1(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}async function SD({store:t,step:e,settings:n,workflow:r,collection:i,signal:o}){const{corsProxyUrl:s,credentialOrigin:a,certificates:l}=n.get(),c=cu(t),d=await e1(t,i?.id.get(),r?.workflowId.get(),f5(e,r,i,c)),{url:h,method:p}=t1(e.get(),r?.get(),i?.get(),c,d),f=s||"",m=QD(e,r,i,t,d),g=Ime(h,a),O=Eme({proxyUrl:f,resolvedUrl:h,ignoreProxy:g,queryParameters:m});await bme(e,r??void 0,O,a,o);const y=i1(e,r??void 0,i??void 0,t,d),b=vme(y5(e,t,d)),{clientCert:w,clientKey:k}=bD(h,l||[]),S=r1(O),$=p.toUpperCase(),P=!Iu.includes($),Q=P?"POST":$,T=P?{...y,"X-HTTP-Method-Override":$}:y;return{urlWithProxyAndProtocol:S,fetchMethod:Q,fetchHeaders:T,body:b,credentials:wD(S,a),mode:n1(S)?"same-origin":"cors",clientCert:w,clientKey:k,resolvedUrl:h}}async function kD(t,e,n,r,i){const o=Tp(t),s=o.data;if(s.type.get()!==De.Step){console.warn("not an operation tab");return}const{collectionId:a,workflowId:l,response:c,requestError:d,isProcessingRequest:h}=s,p=t.collections.find(w=>w.id.get()===a.get()),f=p?.workflows.find(w=>w.workflowId.get()===l.get()),m=lo(e.get({noproxy:!0}));h.set(!0);const g=o.id.get();jp.get(g)?.abort();const O=new AbortController;jp.set(g,O);const{signal:y}=O,b=()=>jp.get(g)===O;try{const w=await SD({store:t,step:e,settings:n,workflow:f,collection:p,signal:y}),k=Date.now(),S={signal:y,method:w.fetchMethod,headers:w.fetchHeaders,body:w.body,mode:w.mode,credentials:w.credentials,clientCert:w.clientCert,clientKey:w.clientKey},$=await us(w.urlWithProxyAndProtocol,S),P=Date.now()-k,Q=await ume($,P);if(!b())return;d.set(null),c.set(Q);const T=lo(c.value);r?.(m,T),i?.({outcome:"success",status:Q.status,duration:Q.duration,size:Q.size})}catch(w){if(!b()||(c.set(null),w.name==="AbortError"))return;d.set(w.message||String(w));const k=lo(c.value);r?.(m,k),i?.({outcome:"error",error:w.message||String(w)})}finally{b()&&(jp.delete(g),h.set(!1))}}async function yme({store:t,step:e,settings:n,workflow:r,collection:i,fileName:o,onProgress:s}){const a=await SD({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},c=an(),d=o||"response";let h=null;if(c){const{open:k}=await import("./redocly-openapi-docs.min.index-B5-R6EGY.js"),S=await k({directory:!0,multiple:!1});if(!S)return;const $=Array.isArray(S)?S[0]:S;h=await gme($,d)}const p=await us(a.urlWithProxyAndProtocol,l),f=p.headers.get("content-length"),m=f?Number.parseInt(f,10):void 0,g=Number.isFinite(m)?m:void 0,O=p.headers.get("content-type")??void 0;let y;if(p.body?.getReader){const k=p.body.getReader(),S=[];let $=0;for(;;){const{done:P,value:Q}=await k.read();if(P)break;if(Q){const T=new Uint8Array(Q.byteLength);T.set(Q),S.push(T.buffer),$+=Q.byteLength,s?.({receivedBytes:$,totalBytes:g,done:!1})}}y=new Blob(S,{type:O}),s?.({receivedBytes:$,totalBytes:g,done:!0})}else y=await p.blob(),s?.({receivedBytes:y.size,totalBytes:g,done:!0});if(c){const{writeFile:k}=await Promise.resolve().then(()=>oO),S=new Uint8Array(await y.arrayBuffer());if(!h)return;await k(h,S);return}const b=window.URL.createObjectURL(y),w=document.createElement("a");w.href=b,w.download=d,w.rel="noopener",w.click(),window.URL.revokeObjectURL(b)}async function bme(t,e,n,r,i){const o=La(t),s=[...Array.from(e?.security||[]),...Array.from(t.security)].findLast(a=>a.securityType.get()===ee.DigestAuth);if(s){const a=r1(n),l=await us(a,{signal:i,method:o.toUpperCase(),credentials:wD(a,r),mode:n1(a)?"same-origin":"cors"}),c=Kge(l.headers.get("WWW-Authenticate")||"");s[ee.DigestAuth].merge({nonce:c.nonce,realm:c.realm,qop:c.qop,algorithm:c.algorithm,opaque:c.opaque,cnonce:crypto.randomUUID(),nc:"00000001"})}}function xme(t,e,n,r,i){return[...e?.security.get()||[],...t.security.get()].map(o=>{switch(o.securityType){case ee.BasicAuth:{const s=o[ee.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+btoa(`${lr(s.username,r,i)}:${lr(s.password,r,i)}`),active:!0,in:"header"}}case ee.DigestAuth:{const s=cu(r);return{id:"",key:"Authorization",value:Jge(t.get(),e?.get(),n?.get(),s,i),active:!0,in:"header"}}case ee.JWT:return{id:"",key:"Authorization",value:"Bearer "+o[ee.JWT].token,active:!0,in:"header"};case ee.OAuth2:{const{grantType:s}=o[ee.OAuth2],{accessToken:a}=o[ee.OAuth2][s];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ee.OpenIDConnect:{const{grantType:s}=o[ee.OpenIDConnect],{accessToken:a}=o[ee.OpenIDConnect][s];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ee.APIKey:{const s=o[ee.APIKey];return s.location===oi.Header?{id:"",key:s.name,value:s.key,active:!0,in:"header"}:null}default:return null}}).filter(o=>!!o)}function wme(t,e,n){const{operation:r,requestBody:i,parameters:o}=e,{headers:s,cookies:a,queryParameters:l}=o;if(!n)return!0;const c=n.parameters??[],d=c.filter(k=>k.in==="query"),h=c.filter(k=>k.in==="header"),p=c.filter(k=>k.in==="cookie"),f=r?.path!==n.path,m=n.method.toLowerCase()!==r?.method.toLowerCase(),g=n.body?.mediaTypes&&n.body?.mediaTypes?.[i.type]===void 0,O=!h.every(k=>s.some(S=>!ml(S)&&S.key===k.name)),y=!p.every(k=>a.some(S=>!ml(S)&&S.key===k.name)),b=!d.every(k=>l.some(S=>!ml(S)&&S.key===k.name)),w=ele(t,e,n);return!f&&!m&&!g&&!O&&!y&&!b&&!w}function v5(t,e,n={}){const{requestBody:r}=t,i=La(t).toUpperCase();if(i==="GET"||i==="HEAD"||i==="OPTIONS")return null;try{switch(r.type.get()){case"JSON":return structuredClone(lr(r.content.get(),e,n));case"multipart/form-data":return Cme(t,e,n);case"application/x-www-form-urlencoded":return kme(t,e,n);case"application/octet-stream":return r.binary.get();default:return lr(r.content.get(),e,n)}}catch(o){console.error(o)}}function y5(t,e,n={}){const{requestBody:r}=t,i=v5(t,e,n);if(i===null)return null;switch(r.type.get()){default:return i;case"multipart/form-data":return Pme(i);case"application/x-www-form-urlencoded":return Sme(i);case"application/octet-stream":return r.binary.ornull?.file.get()??null}}function Sme(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function kme(t,e,n={}){const{requestBody:r}=t,i=[],o=r.formData["application/x-www-form-urlencoded"];return ED(o.get()).forEach(s=>{const a=lr(s.value,e,n);i.push({key:lr(s.key,e,n),value:a,type:"text"})}),i}function Cme(t,e,n={}){const{requestBody:r}=t,i=[],o=r.formData["multipart/form-data"];return ED(o.get()).forEach(({type:s,files:a,value:l,key:c})=>{const d=lr(c,e,n);if(s==="file"&&a)for(const h of a)i.push({key:d,value:h,type:s});else if(l){const h=lr(l,e,n);i.push({key:d,value:h,type:s})}}),i}function Pme(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 CD(t,e,n){return t.filter(r=>{const{securityType:i,[ee.APIKey]:o}=r;return i===ee.APIKey&&o.location===e&&!!o.name}).map(r=>{const{[ee.APIKey]:i}=r;return{id:"",key:i.name,value:i.key,active:!0,in:n}})}function PD(t=[]){return CD(t,oi.Query,"query")}function $D(t,e,n){const r=n?.components.parameters.get();return Ca("query",[PD(e?.security.get()),PD(t.security.get()),ln(e?.parameters.queryParameters.get(),r),ln(t.parameters.queryParameters.get(),r)])}function QD(t,e,n,r,i={}){return $D(t,e,n).map(o=>{const s=lr(o.value,r,i),a=vD(s,o.allowReserved);return`${vD(o.key)}=${a}`}).join("&")}function jD(t,e,n,r,i={}){return $D(t,e,n).reduce((o,s)=>{const a=lr(s.value,r,i),l=lr(s.key,r,i);return o[l]=a,o},{})}function $me(t){const e=t.split("?")[0],n=mme(e),r=/^\{[^\s]+\}$/,i=n.filter(o=>r.test(o)).map(o=>o.slice(1,-1));return new Set(i)}function i1(t,e,n,r,i={}){const o=Tme(t,r,i),s=xme(t,e,n,r,i),a=Qme(t,e,n,r,i),l=n?.components.parameters.get();return Ca("header",[o,s,a,ln(e?.parameters.headers.get(),l),ln(t.parameters.headers.get(),l)]).reduce((c,{key:d,value:h})=>(c[d]=lr(h,r,i),c),{})}function Qme(t,e,n,r,i={}){const o=ID(t,e,n).map(s=>`${s.key}=${lr(s.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 jme(t,e,n,r,i={}){return ID(t,e,n).reduce((o,s)=>{const a=lr(s.value,r,i);return{...o,[lr(s.key,r,i)]:a}},{})}function TD(t=[]){return CD(t,oi.Cookie,"cookie")}function ID(t,e,n){const r=n?.components.parameters.get();return Ca("cookie",[TD(e?.security.get()),TD(t.security.get()),ln(e?.parameters.cookies.get(),r),ln(t.parameters.cookies.get(),r)])}function ED(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function Tme(t,e,n={}){const{requestBody:r}=t,i=y5(t,e,n);return["binary","multipart/form-data"].includes(r.type.get())?[]:xD(i)?[]:[{id:"",key:"Content-Type",value:r.type.get(),active:!0,in:"header"}]}function lr(t,e,n={}){return e?Au(t,cu(e)?.inputs,n):t}function Ime(t,e){return nme(t)||n1(t)||!!(e&&n1(r1(t),e))}function Eme({proxyUrl:t,resolvedUrl:e,ignoreProxy:n,queryParameters:r=""}){const i=t!=="/"?Qy(t):t;let o;return n||!i?o=e:o=`${i}/${e}`,r&&(o+=`?${r}`),o}function b5(t){return t.flatMap(e=>{const n=e.id.get();return(e.paths?.keys??[]).flatMap(r=>{const i=e.paths.nested(r),o=(i.keys??[]).filter(l=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(l.toLowerCase())).map(l=>{const c=i.nested(l),d=c.operationId.get()||"",h=c.summary.get();return{apiId:n,path:r,method:l,operationId:d,summary:h,isAdditionalOperation:!1}}),s=i.additionalOperations?.get(),a=s?Object.entries(s).map(([l,c])=>({apiId:n,path:r,method:l,operationId:c.operationId||"",summary:c.summary,isAdditionalOperation:!0})):[];return[...o,...a]})})}const RD=(t,e,n)=>{if(!e)return null;const{apiId:r,method:i,path:o}=e,s=t.find(l=>l.id.get()===r);if(!s)return null;if(n)try{return n(o,i,s.get({noproxy:!0}))??null}catch(l){console.error("Failed to convert operation to replay value",l)}const a=s.paths?.nested(o)?.nested(i)?.ornull;return a?{id:a.operationId.get()??"",name:a.summary.get()??"",method:i,path:o,href:"",operationId:a.operationId.get(),parameters:[],servers:[],security:[]}:null};function Tp({tabsState:{activeTabIdx:t,tabs:e}}){return e[t?.get()??0]}function Rme(t){const{environments:e,apis:n,tabsState:{tabs:r}}=t,i=r.filter(l=>l.data.type.get()===De.Step),o=b5(n),s=i.map(l=>{const{collectionId:c,workflowId:d,satisfiesScheme:h}=l.data.get(),p=l.data.draftStep.ornull;if(p===null)return null;const{operationId:f,apiId:m}=p.get().operation??{};if(!h||!f)return null;const g=t.collections.find(P=>P.id.get()===c),O=g?.workflows.find(P=>P.workflowId.get()===d),y=o.find(P=>P.operationId===f&&P.apiId===m);if(!y)return null;const b=i1(p,O,g,t),w=y5(p,t),k=jme(p,O,g,t),S=jD(p,O,g,t),$=p.requestBody.activeExampleName;return{apiPath:{path:y.path,method:y.method},requestValues:{cookie:k,header:b,query:S,body:w},activeExampleName:$.get()}}).filter(l=>l!==null),a=cu(t);return{operations:s,environment:a?.name,environments:Object.fromEntries(e.get().map(l=>[l.name,{...Object.fromEntries(l.inputs.filter(({isSecret:c})=>!c).map(({name:c,value:d})=>[c,d])),...Object.fromEntries(l.servers.map(({apiId:c,value:d})=>[c,d]))}]))}}function Ame(t){return t.filter(e=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(e.toLowerCase()))}function Dme(t){const e=new Map;return(t.paths?.keys??[]).forEach(n=>{const r=t.paths.nested(n);Ame(r.keys).forEach(o=>{const s=r.nested(o),a=s.tags?.get()||[],l=s.summary?.get(),c=s.operationId?.get();(a.length?a:["Untagged"]).forEach(d=>{const h=e.get(d)??[];h.push({path:n,method:o,summary:l,operationId:c,isAdditionalOperation:!1}),e.set(d,h)})});const i=r.additionalOperations?.get();i&&Object.entries(i).forEach(([o,s])=>{const a=s.tags||[],l=s.summary,c=s.operationId;(a.length?a:["Untagged"]).forEach(d=>{const h=e.get(d)??[];h.push({path:n,method:o,summary:l,operationId:c,isAdditionalOperation:!0}),e.set(d,h)})})}),e}function Mme({apiId:t,apiTitle:e,tagToOperations:n}){return Array.from(n.entries()).map(([r,i])=>{const o=i.map(s=>({id:x5({apiId:t,method:s.method,path:s.path}),name:s.summary||s.path,apiTitle:e,type:"operation",apiId:t,path:s.path,tagName:r,method:s.method,summary:s.summary,isAdditionalOperation:s.isAdditionalOperation}));return o.length===0?null:{id:`${t}-${r}`,name:r,apiTitle:e,type:"tag",apiId:t,tagName:r,children:o}}).filter(Boolean)}function AD(t){const e=t.id.get(),n=t.info?.title?.get()||e,r=Dme(t),i=Mme({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 x5=({apiId:t,method:e,path:n})=>`${t}-${e.toUpperCase()}-${n}`;function zme(t){const e=t.data.get();switch(e.type){case De.Workflow:return`${e.collectionId}/${e.workflowId}`;case De.Collection:return e.collectionId;case De.Step:return`${e.collectionId}/${e.workflowId}/${e.stepId}`;case De.WorkflowRun:return`${e.collectionId}/${e.workflowId}`}}function _me(t){const e=t.data.get();if(e.type!==De.Step)return;const{apiId:n,path:r,method:i}=e.draftStep?.operation??{};if(!(!n||!r||!i))return x5({apiId:n,path:r,method:i})}function Fs(t){const e=Fe(),n=Tp(e);return!n.get()||t&&!fn(n.data.get(),t)?{tab:null,tabDataId:void 0,apiNodeId:void 0}:{tab:n,tabDataId:zme(n),apiNodeId:_me(n)}}const qme=t=>u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:u.jsx("path",{d:"M7 13L7.705 12.295L3.915 8.5H14V7.5H3.915L7.705 3.705L7 3L2 8L7 13Z"})}),DD=x(qme).attrs({"data-component-name":"icons/ArrowLeftIcon/ArrowLeftIcon"})`
1077
+ `,tn=(t,e,n=new Set)=>{const r=c5(t);if(!r.length)return t;let i=0;const o=r.flatMap(({start:s,end:a,name:l})=>{if(n.has(l))return null;const c=e.findLast(h=>h.name===l),d=t.slice(i,c?s:a);if(i=a,c){n.add(l);const h=tn(c.value,e,n);return n.delete(l),[d.length?d:null,h||t.slice(s,a)]}return[d.length?d:null]});return t.slice(i).length&&o.push(t.slice(i)),o.join("")};function Ige(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function Ege(t,e){const n=sD(t);if(!n.length)return u.jsx(aD,{children:t});let r=0;const i=n.flatMap(({start:o,end:s})=>{const a=t.slice(r,o),l=Ige(t.slice(o,s),e);return r=s,[a.length?a:null,l]});return t.slice(r).length&&i.push(t.slice(r)),u.jsx(aD,{children:i.join("")})}class Rge{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 $p{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 import("./redocly-openapi-docs.min.SqliteDBStorage-DfF4kq1F.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 JO={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function Ul(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function Age(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function Dge(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:Age(t.body,n),header:e,contentType:n,time:t.duration}}async function u5(t,e){const n={};if(!t.some(({key:i,value:o,active:s})=>i&&o&&s))return n;const{evaluateRuntimeExpression:r}=await Promise.resolve().then(()=>LY);for(const{key:i,value:o,active:s}of t)if(!(!i||!o||!s))try{n[i]=r(o,e,JO)}catch{}return n}function Mge(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:Ul(i?.request)??null,response:Ul(i?.response)??null,outputs:Ul(i?.outputs)??{}}))}let lD=0;const d5=new Set;function zge(){lD+=1;for(const t of d5)t()}function _ge(){return lD}function qge(t){return d5.add(t),()=>{d5.delete(t)}}const Nge=10080*60*1e3;async function h5(t){const e=Oo.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:Zf(),date:Date.now(),...t}),zge()}catch(n){console.error("Failed to persist step context:",n)}}async function Zge(t,e,n){if(Oo.getInstance())for(const r of Mge(n,e))await h5({collectionId:t,workflowId:e,...r})}class Oo{static instance=null;static async initialize(e){if(this.close(),!e)return;const{StepContextSqliteDBStorage:n}=await import("./redocly-openapi-docs.min.StepContextSqliteDBStorage-DTB5U2yh.js"),r=$p.getInstance(),i=new n(r);this.instance=new Rge(i)}static getInstance(){return this.instance}static close(){this.instance=null}}const Xge={__replayClearedOutput:!0};function cD(t){return typeof t=="object"&&t!==null&&t.__replayClearedOutput===!0}async function uD(t,e){const n={};for(const r of t){if(n[r.stepId])continue;const i={...r.outputs??{}},o=e?.[r.stepId];if(o&&r.response){const s=o.filter(a=>a.key&&a.active&&!(a.key in i));if(s.length){const a=await u5(s,{$response:r.response,$request:r.request??void 0});for(const[l,c]of Object.entries(a))l in i||(i[l]=c)}}for(const s of Object.keys(i))cD(i[s])&&delete i[s];n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function dD(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const Vge=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function p5(t){const e=new RegExp(Vge),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const Uge=/^\{?\$steps\.([^.{}\s]+)\.(outputs|request|response)\.([^{}\s#]+)(?:#\/([^{}\s]*))?\}?$/;function hD(t){const e=Uge.exec(t.trim());if(!e)return null;const[,n,r,i,o]=e;return{stepId:n,kind:r,outputName:r==="outputs"&&!i.includes(".")?i:void 0,hasPointer:o!==void 0}}const Wge=/^(\{?)(\$steps\.[^.{}\s]+\.(?:request|response)\.[^{}\s#]+)#\/([^{}\s]*)(\}?)$/;function Lge(t,e){const n=Wge.exec(t);if(!n)return;const[,r,i,o,s]=n;if(!!r!=!!s)return;let a;try{a=ya(`${r}${i}${s}`,{$steps:e},JO)}catch{return}let l=a;try{for(const c of o.split("/").filter(Boolean)){if(l==null)return;typeof l=="string"&&(l=JSON.parse(l)),l=l[decodeURIComponent(c)]}}catch{return}return dD(l)}function pD(t,e){if(!t||!t.includes("$steps"))return t;const n=p5(t).map(({start:o,end:s})=>({match:t.slice(o,s),start:o,end:s}));if(!n.length)return t;let r=0;const i=[];for(const{match:o,start:s,end:a}of n){i.push(t.slice(r,s));let l=o;const c=Lge(o,e);if(c!==void 0)l=c;else try{const d=dD(ya(o,{$steps:e},JO));d!==void 0&&(l=d)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function fD(t,e,n){const r=t.collections.find(o=>o.id.get()===e)?.workflows.find(o=>o.workflowId.get()===n)?.steps.get({noproxy:!0});if(!r)return{};const i={};for(const o of r)i[o.stepId]=o.outputs??[];return i}async function gD(t,e){if(!t.response)return{hasValue:!1};const n=await u5([e],{$response:t.response,$request:t.request??void 0});return e.key in n?{hasValue:!0,value:n[e.key]}:{hasValue:!1}}async function Yge(t,e){if(!e)return!1;const n=t.outputs?.[e.key];if(n===void 0||cD(n))return!1;const r=await gD(t,e);return r.hasValue?JSON.stringify(r.value)!==JSON.stringify(n):!1}async function Bge(t,e){return e?(await gD(t,e)).hasValue:!1}const Fge=/\$steps\.([^.\s"'}]+)\./g;function Gge(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(Fge))e.add(n[1]);return[...e]}function f5(t,e,n,r){const i=[],o=s=>{if(s!=null)try{i.push(JSON.stringify(s))}catch(a){console.error("findReferencedStepIds: failed to scan a source for $steps references",a)}};o(t.get({noproxy:!0})),o(e?.get({noproxy:!0})),o(n?.components.parameters.get({noproxy:!0}));for(const s of r?.inputs??[])s.value&&i.push(s.value);return Gge(i.join("\0"))}async function e1(t,e,n,r){const i=Oo.getInstance(),o=[...new Set(r)];if(!i||!e||!n||!o.length)return{};const s=(await Promise.all(o.map(a=>i.getByKey(e,n,a)))).filter(a=>a!=null);return s.length?await uD(s,fD(t,e,n)):{}}function Au(t,e,n){return pD(tn(t,e),n)}function mD(t){return KW(t)}const OD="New Step";function g5({name:t=OD,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=Hge(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function Hge(t){return t.steps.filter(e=>e.state.get()!==It.Draft).map(e=>e.stepId.get())}function cs({name:t=OD,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:o,dynamicReplayValues:s,xOperation:a}={}){if(!n){const c=o?Ww(o,s):null,d=[qi()];return{stepId:g5({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?It.Draft:It.Normal,parameters:{pathParameters:[],queryParameters:a?eh(a.url):[],headers:[],cookies:[]},requestBody:Kh(),xOperation:a??(i?null:{method:"GET",url:""}),security:d,operation:i??null,...c}}const l=n.get({noproxy:!0});return{stepId:g5({name:t,workflow:r}),description:l.description,outputs:l.outputs,successCriteria:l.successCriteria,state:e?It.Draft:It.Normal,parameters:l.parameters,requestBody:l.requestBody,xOperation:l.xOperation,security:l.security,operation:l.operation}}function La(t){return mD(t)?t.xOperation?.ornull?.method.get()??t.operation.ornull?.method.get()??"":t.xOperation?.method??t.operation?.method??""}function Qp(t){return mD(t)?t.xOperation?.ornull?.url.get()??t.operation.ornull?.nested("path").get()??"":t.xOperation?.url??t.operation?.path??""}function t1(t,e,n,r,i){const{inputs:o,servers:s}=r,a=dG(Ca("path",[ln(e?.parameters.pathParameters,n?.components.parameters),ln(t.parameters.pathParameters,n?.components.parameters)]),r.inputs,i),l=t.xOperation??null,c=t.operation??null;let d="",h="";if(l)h=l.method,d=h4(l.url,a);else if(c){const f=s.find(m=>m.apiId===c.apiId);h=c.method==="x-query"?"query":c.method,d=(f?.value?p4(f.value,f.variables):"")+h4(c.path,a)}const p=d.split("?")[0];return{url:Au(p,o,i??{}),method:h.toUpperCase()}}function m5(t,{collectionId:e,workflowId:n,stepId:r}){return t.collections.find(i=>i.id.get()===e)?.workflows.find(i=>i.workflowId.get()===n)?.steps.find(i=>i.stepId.get()===r)??null}function Kge(t){const e=t.substring(7).split(", "),n={};for(const r of e){const[i,o]=r.split("=");n[i]=o.replace(/"/g,"")}return n}function Jge(t,e,n,r,i={}){const{inputs:o}=r,{requestBody:{content:s}}=t,{url:a,method:l}=t1(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast(Q=>Q.securityType===ee.DigestAuth);if(!c)return"";const{username:d,password:h,realm:p,nonce:f,cnonce:m,algorithm:g,qop:O,nc:y,opaque:b}=c[ee.DigestAuth],w=Au(d,o,i),{pathname:k,search:S}=new URL(a),$=S?`${k}${S}`:k,P=eme({username:w,password:Au(h,o,i),uri:$,realm:p,nonce:f,cnonce:m,algorithm:g,qop:O,nc:y,method:l,bodyContent:Au(s,o,i)});return`Digest username="${w}", realm="${p}", nonce="${f}", uri="${$}", qop=${O}, nc=${y}, cnonce="${m}", response="${P}", algorithm=${g}${b?`, opaque="${b}"`:""}`}function eme(t){const{username:e,password:n,realm:r,nonce:i,cnonce:o,algorithm:s,qop:a,nc:l,uri:c,method:d,bodyContent:h}=t,p=tme(s),f=s?.endsWith("-sess")?p(`${p(`${e}:${r}:${n}`)}:${i}:${o}`):p(`${e}:${r}:${n}`),m=a?.includes("auth-int")?p(`${d}:${c}:${p(h)}`):p(`${d}:${c}`);return p(`${f}:${i}:${l}:${o}:${a}:${m}`).toString()}function tme(t){return t?.replace("-sess","")==="SHA-256"?e=>_d(V3(e)):e=>_d(ag(e))}const us=window.__TAURI__?.http.fetch??globalThis.fetch;function nme(t){try{const e=new URL(t).hostname;return e==="localhost"||e==="127.0.0.1"}catch{return!1}}function n1(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function rme(t){return t?t.split(";").map(e=>e.trim()).map(e=>{const n=e.indexOf("="),r=e.slice(0,n).trim(),i=e.slice(n+1).trim();return[r,i]}):[]}const ime=["json","xml","html","text"],ome=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function O5(t,e){return t.get(e)??t.get(e.toLowerCase())}function sme(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function ame(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 lme(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function cme(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return ome.some(r=>n.includes(r))?!0:n.startsWith("application/")?!ime.some(r=>n.includes(r)):!1}async function ume(t,e){const n=O5(t.headers,"content-type")?.split(";")[0].trim(),r=O5(t.headers,"content-disposition"),i=sme(O5(t.headers,"content-length")),o=cme(n,r),s=rme(document.cookie);if(o){const d={fileName:ame(r)||lme(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:s,size:i??0,download:d,bodyNotStored:!0,url:t.url}}const a=await t.clone().arrayBuffer(),l=new TextDecoder().decode(a),c=new Uint8Array(a).length;return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:a,body:l,duration:e,cookies:s,size:c,url:t.url}}const dme=":/?#[]@!$&'()*+,;=",hme=new Set(["!","'","(",")","*"]);function pme(t){return hme.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function vD(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...dme].map(i=>({char:i,encoded:pme(i)}));for(const{char:i,encoded:o}of r)n=n.split(o).join(i);return n}function yD(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 bD(t,e){let n=yD(t);const r=e.find(({host:i,port:o})=>yD(`https://${i}:${o}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}function fme(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function gme(t,e){const{exists:n}=await Promise.resolve().then(()=>oO),{join:r}=await Promise.resolve().then(()=>LI),{baseName:i,extension:o}=fme(e);let s=0;for(;;){const a=s===0?"":` (${s})`,l=`${i}${a}${o}`,c=await r(t,l);if(!await n(c))return c;s+=1}}function mme(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}const jp=new Map;function Ome(t){jp.get(t)?.abort()}function xD(t){return t?t instanceof FormData||t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function vme(t){if(!xD(t))return t}function r1(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function wD(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL(r1(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}async function SD({store:t,step:e,settings:n,workflow:r,collection:i,signal:o}){const{corsProxyUrl:s,credentialOrigin:a,certificates:l}=n.get(),c=cu(t),d=await e1(t,i?.id.get(),r?.workflowId.get(),f5(e,r,i,c)),{url:h,method:p}=t1(e.get(),r?.get(),i?.get(),c,d),f=s||"",m=QD(e,r,i,t,d),g=Ime(h,a),O=Eme({proxyUrl:f,resolvedUrl:h,ignoreProxy:g,queryParameters:m});await bme(e,r??void 0,O,a,o);const y=i1(e,r??void 0,i??void 0,t,d),b=vme(y5(e,t,d)),{clientCert:w,clientKey:k}=bD(h,l||[]),S=r1(O),$=p.toUpperCase(),P=!Iu.includes($),Q=P?"POST":$,T=P?{...y,"X-HTTP-Method-Override":$}:y;return{urlWithProxyAndProtocol:S,fetchMethod:Q,fetchHeaders:T,body:b,credentials:wD(S,a),mode:n1(S)?"same-origin":"cors",clientCert:w,clientKey:k,resolvedUrl:h}}async function kD(t,e,n,r,i){const o=Tp(t),s=o.data;if(s.type.get()!==De.Step){console.warn("not an operation tab");return}const{collectionId:a,workflowId:l,response:c,requestError:d,isProcessingRequest:h}=s,p=t.collections.find(w=>w.id.get()===a.get()),f=p?.workflows.find(w=>w.workflowId.get()===l.get()),m=lo(e.get({noproxy:!0}));h.set(!0);const g=o.id.get();jp.get(g)?.abort();const O=new AbortController;jp.set(g,O);const{signal:y}=O,b=()=>jp.get(g)===O;try{const w=await SD({store:t,step:e,settings:n,workflow:f,collection:p,signal:y}),k=Date.now(),S={signal:y,method:w.fetchMethod,headers:w.fetchHeaders,body:w.body,mode:w.mode,credentials:w.credentials,clientCert:w.clientCert,clientKey:w.clientKey},$=await us(w.urlWithProxyAndProtocol,S),P=Date.now()-k,Q=await ume($,P);if(!b())return;d.set(null),c.set(Q);const T=lo(c.value);r?.(m,T),i?.({outcome:"success",status:Q.status,duration:Q.duration,size:Q.size})}catch(w){if(!b()||(c.set(null),w.name==="AbortError"))return;d.set(w.message||String(w));const k=lo(c.value);r?.(m,k),i?.({outcome:"error",error:w.message||String(w)})}finally{b()&&(jp.delete(g),h.set(!1))}}async function yme({store:t,step:e,settings:n,workflow:r,collection:i,fileName:o,onProgress:s}){const a=await SD({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},c=an(),d=o||"response";let h=null;if(c){const{open:k}=await import("./redocly-openapi-docs.min.index-D4_45rLR.js"),S=await k({directory:!0,multiple:!1});if(!S)return;const $=Array.isArray(S)?S[0]:S;h=await gme($,d)}const p=await us(a.urlWithProxyAndProtocol,l),f=p.headers.get("content-length"),m=f?Number.parseInt(f,10):void 0,g=Number.isFinite(m)?m:void 0,O=p.headers.get("content-type")??void 0;let y;if(p.body?.getReader){const k=p.body.getReader(),S=[];let $=0;for(;;){const{done:P,value:Q}=await k.read();if(P)break;if(Q){const T=new Uint8Array(Q.byteLength);T.set(Q),S.push(T.buffer),$+=Q.byteLength,s?.({receivedBytes:$,totalBytes:g,done:!1})}}y=new Blob(S,{type:O}),s?.({receivedBytes:$,totalBytes:g,done:!0})}else y=await p.blob(),s?.({receivedBytes:y.size,totalBytes:g,done:!0});if(c){const{writeFile:k}=await Promise.resolve().then(()=>oO),S=new Uint8Array(await y.arrayBuffer());if(!h)return;await k(h,S);return}const b=window.URL.createObjectURL(y),w=document.createElement("a");w.href=b,w.download=d,w.rel="noopener",w.click(),window.URL.revokeObjectURL(b)}async function bme(t,e,n,r,i){const o=La(t),s=[...Array.from(e?.security||[]),...Array.from(t.security)].findLast(a=>a.securityType.get()===ee.DigestAuth);if(s){const a=r1(n),l=await us(a,{signal:i,method:o.toUpperCase(),credentials:wD(a,r),mode:n1(a)?"same-origin":"cors"}),c=Kge(l.headers.get("WWW-Authenticate")||"");s[ee.DigestAuth].merge({nonce:c.nonce,realm:c.realm,qop:c.qop,algorithm:c.algorithm,opaque:c.opaque,cnonce:crypto.randomUUID(),nc:"00000001"})}}function xme(t,e,n,r,i){return[...e?.security.get()||[],...t.security.get()].map(o=>{switch(o.securityType){case ee.BasicAuth:{const s=o[ee.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+btoa(`${lr(s.username,r,i)}:${lr(s.password,r,i)}`),active:!0,in:"header"}}case ee.DigestAuth:{const s=cu(r);return{id:"",key:"Authorization",value:Jge(t.get(),e?.get(),n?.get(),s,i),active:!0,in:"header"}}case ee.JWT:return{id:"",key:"Authorization",value:"Bearer "+o[ee.JWT].token,active:!0,in:"header"};case ee.OAuth2:{const{grantType:s}=o[ee.OAuth2],{accessToken:a}=o[ee.OAuth2][s];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ee.OpenIDConnect:{const{grantType:s}=o[ee.OpenIDConnect],{accessToken:a}=o[ee.OpenIDConnect][s];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ee.APIKey:{const s=o[ee.APIKey];return s.location===oi.Header?{id:"",key:s.name,value:s.key,active:!0,in:"header"}:null}default:return null}}).filter(o=>!!o)}function wme(t,e,n){const{operation:r,requestBody:i,parameters:o}=e,{headers:s,cookies:a,queryParameters:l}=o;if(!n)return!0;const c=n.parameters??[],d=c.filter(k=>k.in==="query"),h=c.filter(k=>k.in==="header"),p=c.filter(k=>k.in==="cookie"),f=r?.path!==n.path,m=n.method.toLowerCase()!==r?.method.toLowerCase(),g=n.body?.mediaTypes&&n.body?.mediaTypes?.[i.type]===void 0,O=!h.every(k=>s.some(S=>!ml(S)&&S.key===k.name)),y=!p.every(k=>a.some(S=>!ml(S)&&S.key===k.name)),b=!d.every(k=>l.some(S=>!ml(S)&&S.key===k.name)),w=ele(t,e,n);return!f&&!m&&!g&&!O&&!y&&!b&&!w}function v5(t,e,n={}){const{requestBody:r}=t,i=La(t).toUpperCase();if(i==="GET"||i==="HEAD"||i==="OPTIONS")return null;try{switch(r.type.get()){case"JSON":return structuredClone(lr(r.content.get(),e,n));case"multipart/form-data":return Cme(t,e,n);case"application/x-www-form-urlencoded":return kme(t,e,n);case"application/octet-stream":return r.binary.get();default:return lr(r.content.get(),e,n)}}catch(o){console.error(o)}}function y5(t,e,n={}){const{requestBody:r}=t,i=v5(t,e,n);if(i===null)return null;switch(r.type.get()){default:return i;case"multipart/form-data":return Pme(i);case"application/x-www-form-urlencoded":return Sme(i);case"application/octet-stream":return r.binary.ornull?.file.get()??null}}function Sme(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function kme(t,e,n={}){const{requestBody:r}=t,i=[],o=r.formData["application/x-www-form-urlencoded"];return ED(o.get()).forEach(s=>{const a=lr(s.value,e,n);i.push({key:lr(s.key,e,n),value:a,type:"text"})}),i}function Cme(t,e,n={}){const{requestBody:r}=t,i=[],o=r.formData["multipart/form-data"];return ED(o.get()).forEach(({type:s,files:a,value:l,key:c})=>{const d=lr(c,e,n);if(s==="file"&&a)for(const h of a)i.push({key:d,value:h,type:s});else if(l){const h=lr(l,e,n);i.push({key:d,value:h,type:s})}}),i}function Pme(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 CD(t,e,n){return t.filter(r=>{const{securityType:i,[ee.APIKey]:o}=r;return i===ee.APIKey&&o.location===e&&!!o.name}).map(r=>{const{[ee.APIKey]:i}=r;return{id:"",key:i.name,value:i.key,active:!0,in:n}})}function PD(t=[]){return CD(t,oi.Query,"query")}function $D(t,e,n){const r=n?.components.parameters.get();return Ca("query",[PD(e?.security.get()),PD(t.security.get()),ln(e?.parameters.queryParameters.get(),r),ln(t.parameters.queryParameters.get(),r)])}function QD(t,e,n,r,i={}){return $D(t,e,n).map(o=>{const s=lr(o.value,r,i),a=vD(s,o.allowReserved);return`${vD(o.key)}=${a}`}).join("&")}function jD(t,e,n,r,i={}){return $D(t,e,n).reduce((o,s)=>{const a=lr(s.value,r,i),l=lr(s.key,r,i);return o[l]=a,o},{})}function $me(t){const e=t.split("?")[0],n=mme(e),r=/^\{[^\s]+\}$/,i=n.filter(o=>r.test(o)).map(o=>o.slice(1,-1));return new Set(i)}function i1(t,e,n,r,i={}){const o=Tme(t,r,i),s=xme(t,e,n,r,i),a=Qme(t,e,n,r,i),l=n?.components.parameters.get();return Ca("header",[o,s,a,ln(e?.parameters.headers.get(),l),ln(t.parameters.headers.get(),l)]).reduce((c,{key:d,value:h})=>(c[d]=lr(h,r,i),c),{})}function Qme(t,e,n,r,i={}){const o=ID(t,e,n).map(s=>`${s.key}=${lr(s.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 jme(t,e,n,r,i={}){return ID(t,e,n).reduce((o,s)=>{const a=lr(s.value,r,i);return{...o,[lr(s.key,r,i)]:a}},{})}function TD(t=[]){return CD(t,oi.Cookie,"cookie")}function ID(t,e,n){const r=n?.components.parameters.get();return Ca("cookie",[TD(e?.security.get()),TD(t.security.get()),ln(e?.parameters.cookies.get(),r),ln(t.parameters.cookies.get(),r)])}function ED(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function Tme(t,e,n={}){const{requestBody:r}=t,i=y5(t,e,n);return["binary","multipart/form-data"].includes(r.type.get())?[]:xD(i)?[]:[{id:"",key:"Content-Type",value:r.type.get(),active:!0,in:"header"}]}function lr(t,e,n={}){return e?Au(t,cu(e)?.inputs,n):t}function Ime(t,e){return nme(t)||n1(t)||!!(e&&n1(r1(t),e))}function Eme({proxyUrl:t,resolvedUrl:e,ignoreProxy:n,queryParameters:r=""}){const i=t!=="/"?Qy(t):t;let o;return n||!i?o=e:o=`${i}/${e}`,r&&(o+=`?${r}`),o}function b5(t){return t.flatMap(e=>{const n=e.id.get();return(e.paths?.keys??[]).flatMap(r=>{const i=e.paths.nested(r),o=(i.keys??[]).filter(l=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(l.toLowerCase())).map(l=>{const c=i.nested(l),d=c.operationId.get()||"",h=c.summary.get();return{apiId:n,path:r,method:l,operationId:d,summary:h,isAdditionalOperation:!1}}),s=i.additionalOperations?.get(),a=s?Object.entries(s).map(([l,c])=>({apiId:n,path:r,method:l,operationId:c.operationId||"",summary:c.summary,isAdditionalOperation:!0})):[];return[...o,...a]})})}const RD=(t,e,n)=>{if(!e)return null;const{apiId:r,method:i,path:o}=e,s=t.find(l=>l.id.get()===r);if(!s)return null;if(n)try{return n(o,i,s.get({noproxy:!0}))??null}catch(l){console.error("Failed to convert operation to replay value",l)}const a=s.paths?.nested(o)?.nested(i)?.ornull;return a?{id:a.operationId.get()??"",name:a.summary.get()??"",method:i,path:o,href:"",operationId:a.operationId.get(),parameters:[],servers:[],security:[]}:null};function Tp({tabsState:{activeTabIdx:t,tabs:e}}){return e[t?.get()??0]}function Rme(t){const{environments:e,apis:n,tabsState:{tabs:r}}=t,i=r.filter(l=>l.data.type.get()===De.Step),o=b5(n),s=i.map(l=>{const{collectionId:c,workflowId:d,satisfiesScheme:h}=l.data.get(),p=l.data.draftStep.ornull;if(p===null)return null;const{operationId:f,apiId:m}=p.get().operation??{};if(!h||!f)return null;const g=t.collections.find(P=>P.id.get()===c),O=g?.workflows.find(P=>P.workflowId.get()===d),y=o.find(P=>P.operationId===f&&P.apiId===m);if(!y)return null;const b=i1(p,O,g,t),w=y5(p,t),k=jme(p,O,g,t),S=jD(p,O,g,t),$=p.requestBody.activeExampleName;return{apiPath:{path:y.path,method:y.method},requestValues:{cookie:k,header:b,query:S,body:w},activeExampleName:$.get()}}).filter(l=>l!==null),a=cu(t);return{operations:s,environment:a?.name,environments:Object.fromEntries(e.get().map(l=>[l.name,{...Object.fromEntries(l.inputs.filter(({isSecret:c})=>!c).map(({name:c,value:d})=>[c,d])),...Object.fromEntries(l.servers.map(({apiId:c,value:d})=>[c,d]))}]))}}function Ame(t){return t.filter(e=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(e.toLowerCase()))}function Dme(t){const e=new Map;return(t.paths?.keys??[]).forEach(n=>{const r=t.paths.nested(n);Ame(r.keys).forEach(o=>{const s=r.nested(o),a=s.tags?.get()||[],l=s.summary?.get(),c=s.operationId?.get();(a.length?a:["Untagged"]).forEach(d=>{const h=e.get(d)??[];h.push({path:n,method:o,summary:l,operationId:c,isAdditionalOperation:!1}),e.set(d,h)})});const i=r.additionalOperations?.get();i&&Object.entries(i).forEach(([o,s])=>{const a=s.tags||[],l=s.summary,c=s.operationId;(a.length?a:["Untagged"]).forEach(d=>{const h=e.get(d)??[];h.push({path:n,method:o,summary:l,operationId:c,isAdditionalOperation:!0}),e.set(d,h)})})}),e}function Mme({apiId:t,apiTitle:e,tagToOperations:n}){return Array.from(n.entries()).map(([r,i])=>{const o=i.map(s=>({id:x5({apiId:t,method:s.method,path:s.path}),name:s.summary||s.path,apiTitle:e,type:"operation",apiId:t,path:s.path,tagName:r,method:s.method,summary:s.summary,isAdditionalOperation:s.isAdditionalOperation}));return o.length===0?null:{id:`${t}-${r}`,name:r,apiTitle:e,type:"tag",apiId:t,tagName:r,children:o}}).filter(Boolean)}function AD(t){const e=t.id.get(),n=t.info?.title?.get()||e,r=Dme(t),i=Mme({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 x5=({apiId:t,method:e,path:n})=>`${t}-${e.toUpperCase()}-${n}`;function zme(t){const e=t.data.get();switch(e.type){case De.Workflow:return`${e.collectionId}/${e.workflowId}`;case De.Collection:return e.collectionId;case De.Step:return`${e.collectionId}/${e.workflowId}/${e.stepId}`;case De.WorkflowRun:return`${e.collectionId}/${e.workflowId}`}}function _me(t){const e=t.data.get();if(e.type!==De.Step)return;const{apiId:n,path:r,method:i}=e.draftStep?.operation??{};if(!(!n||!r||!i))return x5({apiId:n,path:r,method:i})}function Fs(t){const e=Fe(),n=Tp(e);return!n.get()||t&&!fn(n.data.get(),t)?{tab:null,tabDataId:void 0,apiNodeId:void 0}:{tab:n,tabDataId:zme(n),apiNodeId:_me(n)}}const qme=t=>u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:u.jsx("path",{d:"M7 13L7.705 12.295L3.915 8.5H14V7.5H3.915L7.705 3.705L7 3L2 8L7 13Z"})}),DD=x(qme).attrs({"data-component-name":"icons/ArrowLeftIcon/ArrowLeftIcon"})`
1078
1078
  path {
1079
1079
  fill: ${({color:t})=>it(t)};
1080
1080
  }
@@ -1130,7 +1130,7 @@ ${U}`),N.pop(),`{${ie}}`}case"number":return isFinite(I)?String(I):w?w(I):"null"
1130
1130
 
1131
1131
  height: ${({size:t})=>t||"16px"};
1132
1132
  width: ${({size:t})=>t||"16px"};
1133
- `;function bM(t){return t.some(e=>!!(e.key||e.value||e.files?.length))}function q1e({type:t,formData:e,content:n}){if(tO.includes(t)){const r=bM(e["multipart/form-data"]),i=bM(e["application/x-www-form-urlencoded"]);return!r&&!i}return Uae.includes(t)?n.length===0:!0}function xM(t){const{disableCollectionsTab:e}=Vr();return v.useMemo(()=>{const n=[{name:Ge.SECURITY,icon:u.jsx(HC,{})},{name:Ge.BODY,icon:u.jsx(Np,{})},{name:Ge.PATH,icon:u.jsx(yM,{})},{name:Ge.QUERY,icon:u.jsx(vM,{})},{name:Ge.HEADERS,icon:u.jsx(_5,{})},{name:Ge.COOKIES,icon:u.jsx(z5,{})}];return!e.get()&&!t&&n.push({name:Ge.STEP_SETTINGS,icon:u.jsx(qu,{})}),n},[e,t])}function Wl(t){return q1e(t.requestBody)?Ge.QUERY:Ge.BODY}function q5(t){return t.type==="step"}function N5(t){return t.type==="workflow"}function Z5(t,e){const n=[],r=[];for(const i of e)i.active&&Md(i)?n.push(i):r.push(i);return[...t.map((i,o)=>{const s=n[o]?.id??i.id;return{...i,id:s}}),...r]}function N1e(){return structuredClone({id:crypto.randomUUID(),state:bn.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:De.Step,draftStep:cs(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0}})}function Z1e(t){return t!==void 0&&t.data?.type?.get()===De.Step}function X1e(t,e){const n=e.data.collectionId.get(),r=e.data.workflowId.get(),i=e.data.stepId.get();return n&&r&&i?m5(t,{collectionId:n,workflowId:r,stepId:i})??e.data.draftStep.ornull:e.data.draftStep.ornull}function V1e(t,e,n,r,i,o){const s=a=>a??"";return s(t)===r&&s(e)===i&&s(n)===o}const X5="New workflow";function wM({name:t=X5,collection:e}){let n=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||X5).replaceAll(" ","-").toLowerCase();if(!e)return n;const r=U1e(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function U1e(t){return t.workflows.filter(e=>e.state.get()!==It.Draft).map(e=>e.workflowId.get())}function V5({name:t=X5,isDraft:e=!1,collection:n}={}){return{workflowId:wM({name:t,collection:n}),summary:t,steps:[],state:e?It.Draft:It.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[qi()]}}function W1e(t,e){const n=new Set,{pathParameters:r,queryParameters:i,headers:o,cookies:s}=t.parameters.get(),a=t.outputs.get();for(const{value:l}of[...ln([...r,...i,...o,...s],e?.components.parameters.get()),...a])for(const c of Va(l))n.add(c);return t.steps.forEach(l=>{const c=l.security.get();for(const O of c)switch(O.securityType){case ee.BasicAuth:case ee.DigestAuth:for(const b of[O[O.securityType].username,O[O.securityType].password])for(const w of Va(b))n.add(w);break;case ee.JWT:for(const b of Va(O[O.securityType].token))n.add(b);break;case ee.APIKey:for(const b of Va(O[O.securityType].key))n.add(b);break;case ee.OAuth2:case ee.OpenIDConnect:const y=O[O.securityType];for(const b of Va(y[y.grantType].accessToken))n.add(b);break}const{pathParameters:d,queryParameters:h,headers:p,cookies:f}=l.parameters.get(),m=l.outputs.get();for(const{value:O}of[...ln([...d,...h,...p,...f],e?.components.parameters.get()),...m])for(const y of Va(O))n.add(y);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 y of Va(O))n.add(y);break}case"application/octet-stream":break;default:for(const O of Va(g.content))n.add(O)}}),n}function SM(t,e,n){const r=W1e(t,n);if(r.size===0){t.inputs.set(pt);return}t.inputs.set(i=>{const o=typeof i=="object"&&i?.properties||{};return{type:"object",properties:Object.fromEntries(Array.from(r).map(s=>{const a=e.inputs.find(l=>l.name.get()===s)?.isSecret;return[s,a?{type:"string",format:"password"}:o[s]||{type:"string"}]}))}})}function Nu(t){return t.summary||t.workflowId||"Untitled Workflow"}function kM(t,{collectionId:e,workflowId:n}){return t.collections.find(r=>r.id.get()===e)?.workflows.find(r=>r.workflowId.get()===n)??null}function Ll(){const{apis:t}=Fe(),{convertOperationToReplayValue:e}=ar();return{getApiOperation:v.useCallback(n=>RD(t,n,e),[t,e])}}function CM(t){const e=(t.match(/{([^}]+)}/g)||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function L1e(t){const e=t.servers.ornull?.[0];if(!e)return{url:"",variables:[]};const n=e.url.get(),r=CM(n).map(i=>({name:i,value:e.variables.ornull?.[i]?.default.get()||""}));return{url:n,variables:r}}function PM(){const t=Fe();function e(n){const r=t.apis.find(s=>s.id.get()===n);if(!r){console.error(`API ${n} not found`);return}const{url:i,variables:o}=L1e(r);t.environments.forEach(s=>{s.servers.find(a=>a.apiId.get()===n)||s.servers.merge([{apiId:n,value:i,variables:o}])})}return{attachApiServerToEnvironments:e}}const U5="New collection";function W5({name:t=U5,collections:e,isDraft:n=!1}={}){return{id:QM({name:t,collections:e}),srcType:Gr.FS,arazzo:"1.0.1",info:{version:"1.0.0",title:t},workflows:[],state:n?It.Draft:It.Normal,components:{inputs:{},parameters:{}},sourceDescriptions:[]}}function $M(t=U5){return`collections/${t.replaceAll(" ","-").toLowerCase()}.arazzo.yaml`}function QM({name:t=U5,collections:e}={}){let n=$M(t);if(!e?.length)return n;const r=Y1e(e);let i=1;for(;r.includes(n);)n=$M(`${t}-${i}`),i++;return n}function Y1e(t){return t.filter(e=>e.state.get()!==It.Draft).map(e=>e.id.get())}function jM(t,e){return t.collections.find(n=>n.id.get()===e)??null}function B1e({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 Fa(){const t=Fe(),{attachApiServerToEnvironments:e}=PM();async function n({collectionId:s,apiId:a}){const l=t.collections.find(c=>c.id.get()===s);if(l){if(!l.sourceDescriptions.get({noproxy:!0}).some(c=>c.apiId===a)){const c=t.apis.find(h=>h.id.get()===a)?.info.title.get(),d=Ti(a)?a:await Vt.relative(`/${s}/..`,`/${a}`);l.sourceDescriptions.set(h=>h.some(p=>p.apiId===a)?h:[...h,{name:B1e({apiName:c,sourceDescriptions:h}),url:d,apiId:a}])}e(a)}}function r(s){return jM(t,s)}function i(s,a){const l=s.sourceDescriptions.get({noproxy:!0}).filter(c=>a.name!==c.name);s.sourceDescriptions.set(l)}function o(s,a){const l=new Set(a.map(c=>`${c.workflowId??""}\0${c.stepId}`));s.workflows.forEach(c=>{const d=c.workflowId.get({noproxy:!0});c.steps.forEach(h=>{const p=h.stepId.get({noproxy:!0}),f=`${d}\0${p}`;if(!l.has(f))return;const m=h.operation.get({noproxy:!0});m&&(h.xOperation.set({method:m.method,url:m.path}),h.operation.set(null))})})}return{attachApiToCollection:n,getCollection:r,removeSourceDescription:i,disconnectStepsFromSource:o}}function Zu(t){const e=Fe();return t?e.collections.find(n=>n.id.get()===t)??null:null}const Cr={all:["history"],lists:()=>[...Cr.all,"list"],list:t=>[...Cr.lists(),t],recent:(t,e)=>[...Cr.all,"recent",t,e],detail:t=>[...Cr.all,"detail",t],count:t=>[...Cr.all,"count",t]};class TM{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 L5=(t,e)=>e.some(n=>t instanceof n);let IM,EM;function F1e(){return IM||(IM=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function G1e(){return EM||(EM=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Y5=new WeakMap,B5=new WeakMap,y1=new WeakMap;function H1e(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",o),t.removeEventListener("error",s)},o=()=>{n(Yl(t.result)),i()},s=()=>{r(t.error),i()};t.addEventListener("success",o),t.addEventListener("error",s)});return y1.set(e,t),e}function K1e(t){if(Y5.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",o),t.removeEventListener("error",s),t.removeEventListener("abort",s)},o=()=>{n(),i()},s=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",o),t.addEventListener("error",s),t.addEventListener("abort",s)});Y5.set(t,e)}let F5={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return Y5.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Yl(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 RM(t){F5=t(F5)}function J1e(t){return G1e().includes(t)?function(...e){return t.apply(G5(this),e),Yl(this.request)}:function(...e){return Yl(t.apply(G5(this),e))}}function e0e(t){return typeof t=="function"?J1e(t):(t instanceof IDBTransaction&&K1e(t),L5(t,F1e())?new Proxy(t,F5):t)}function Yl(t){if(t instanceof IDBRequest)return H1e(t);if(B5.has(t))return B5.get(t);const e=e0e(t);return e!==t&&(B5.set(t,e),y1.set(e,t)),e}const G5=t=>y1.get(t);function t0e(t,e,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(t,e),a=Yl(s);return r&&s.addEventListener("upgradeneeded",l=>{r(Yl(s.result),l.oldVersion,l.newVersion,Yl(s.transaction),l)}),n&&s.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{o&&l.addEventListener("close",()=>o()),i&&l.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const n0e=["get","getKey","getAll","getAllKeys","count"],r0e=["put","add","delete","clear"],H5=new Map;function AM(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(H5.get(e))return H5.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=r0e.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||n0e.includes(n)))return;const o=async function(s,...a){const l=this.transaction(s,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 H5.set(e,o),o}RM(t=>({...t,get:(e,n,r)=>AM(e,n)||t.get(e,n,r),has:(e,n)=>!!AM(e,n)||t.has(e,n)}));const i0e=["continue","continuePrimaryKey","advance"],DM={},K5=new WeakMap,MM=new WeakMap,o0e={get(t,e){if(!i0e.includes(e))return t[e];let n=DM[e];return n||(n=DM[e]=function(...r){K5.set(this,MM.get(this)[e](...r))}),n}};async function*s0e(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,o0e);for(MM.set(n,e),y1.set(n,G5(e));e;)yield n,e=await(K5.get(n)||e.continue()),K5.delete(n)}function zM(t,e){return e===Symbol.asyncIterator&&L5(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&L5(t,[IDBIndex,IDBObjectStore])}RM(t=>({...t,get(e,n,r){return zM(e,n)?s0e:t.get(e,n,r)},has(e,n){return zM(e,n)||t.has(e,n)}}));class UC{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 UC(e,n,r)}async initialize(){this.db||(this.db=await t0e(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const a0e=1;class WC{constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=UC.createInstance(n,a0e,this.setupDatabase);return new WC(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 n=(await this.getDb()).transaction(this.storeName,"readonly"),r=e?.type?await n.store.index("by-type").getAll(e.type):await n.store.index("by-date").getAll();return await n.done,r.sort((i,o)=>o.date-i.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:o,type:s,...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 r=(await this.getDb()).transaction(this.storeName,"readonly"),i=n?.type?await r.store.index("by-type").getAll(n.type):await r.store.index("by-date").getAll();return await r.done,i.sort((o,s)=>s.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 l0e(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const c0e=2;function u0e(t){const e=JSON.parse(t);let n;return e.version===1?n=l0e(e):n=e,n.version!==c0e&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const J5="history.json",d0e="history.json.backup";class h0e{static async migrateFromStorage(e,n,r){try{const i=await e.get(J5);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const o=u0e(i);if(o.length===0)return console.log(`No history items found in ${r}`),{migrated:!1,itemCount:0};await this.bulkInsert(n,o);try{await e.rename(J5,d0e)}catch{await e.remove(J5)}return console.log(`Migrated ${o.length} history items from ${r}`),{migrated:!0,itemCount:o.length}}catch(i){const o=i instanceof Error?i.message:"Unknown error";return console.error(`History migration from ${r} failed:`,o),{migrated:!1,itemCount:0,error:o}}}static async bulkInsert(e,n){for(let r=0;r<n.length;r+=100){const i=n.slice(r,r+100);await Promise.all(i.map(o=>e.addItem(o)))}}static async migrate(e,n,r){if(r){const{TauriFileSystemAdapter:i}=await import("./redocly-openapi-docs.min.TauriFileSystemAdapter-Dl2fY3am.js"),o=new i(e.systemFilesDir);return this.migrateFromStorage(o,n,"JSON file")}else{const i=new jy(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}class Ga{static instance=null;static async initialize(e,n){this.close(),this.instance=await p0e(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function p0e(t,e){if(e){const{HistorySqliteDBStorage:n}=await import("./redocly-openapi-docs.min.HistorySqliteDBStorage-DYnaxLim.js"),r=$p.getInstance(),i=new n(r);return new TM(i)}else{const n=WC.create(t.id);return new TM(n)}}function f0e(t){return rg({queryKey:Cr.list(t),queryFn:async()=>Ga.getInstance().getAll(t)})}function _M(){const t=ma();return ig({mutationFn:async e=>{await Ga.getInstance().addItem(e)},onMutate:e=>{t.setQueryData(Cr.detail(e.id),e)},onSuccess:()=>{t.invalidateQueries({queryKey:Cr.lists()}),t.invalidateQueries({queryKey:Cr.count()})},onError:(e,n)=>{t.removeQueries({queryKey:Cr.detail(n.id)}),console.error("Failed to add history item:",e)}})}function g0e(){const t=ma();return ig({mutationFn:async e=>{await Ga.getInstance().deleteItem(e)},onSuccess:(e,n)=>{t.removeQueries({queryKey:Cr.detail(n)}),t.invalidateQueries({queryKey:Cr.lists()}),t.invalidateQueries({queryKey:Cr.count()})},onError:(e,n)=>{console.error(`Failed to delete history item ${n}:`,e)}})}function m0e(){const t=ma();return ig({mutationFn:async()=>{await Ga.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:Cr.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function O0e(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function v0e(){const t=_M();return v.useCallback(({step:e,response:n})=>{const r=O0e(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function y0e(){const t=_M();return v.useCallback(async({workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:o,durationMs:s})=>{const a=crypto.randomUUID(),l={id:a,date:Date.now(),type:"workflow",workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:o,durationMs:s};try{return await t.mutateAsync(l),a}catch{return null}},[t])}function b0e(){const t=ma();async function e(n){return t.ensureQueryData({queryKey:Cr.detail(n),queryFn:()=>Ga.getInstance().getById(n)})}return{getHistoryItem:e}}function eS(){const t=Fe();return{getStep:e=>m5(t,e)}}function x0e({collectionId:t,workflowId:e,stepId:n}){const r=Fe().collections.find(o=>o.id.get()===t);if(!r)return null;const i=r.workflows.find(o=>o.workflowId.get()===e);return i?i.steps.find(o=>o.stepId.get()===n)??null:null}function tS(t){const e=t?.collectionId.get()??null,n=t?.workflowId.get()??null,r=t?.stepId.get()??null;return x0e({collectionId:e,workflowId:n,stepId:r})||t?.draftStep.ornull||null}function b1(){const t=Fe();return{getWorkflow:({collectionId:e,workflowId:n})=>kM(t,{collectionId:e,workflowId:n})}}function Ha({collectionId:t,workflowId:e}){const n=Fe().collections.find(r=>r.id.get()===t);return n?n.workflows.find(r=>r.workflowId.get()===e)??null:null}function nS(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const w0e=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function S0e(){const{project:{userFilesDir:t}}=Fe(),{certificates:e}=Vr(),n=zt(),{getCollection:r}=Fa();return{execute:async(i,o,s)=>{const a=r(i),l=t.get(),{inputs:c,servers:d}=n.get(),h=a?.sourceDescriptions.get()??[],p=`${l}/${i}`,[{createConfig:f},{ExternalResolver:m}]=await Promise.all([import("./redocly-openapi-docs.min.index-DeHk4n2z.js"),import("./redocly-openapi-docs.min.external-resolver-Db7hewsm.js")]),g=new m,O=c.map(k=>JSON.stringify({[k.name]:k.value})),y=k0e(d,h),{run:b}=await import("./redocly-openapi-docs.min.respect-run-DgsYdmxw.js"),w=await b({files:[p],workflow:o?[o]:[],fetch:(k,S)=>{const $=w0e(k),{clientCert:P,clientKey:Q}=bD($,e?e.get({noproxy:!0}):[]);return us($,{...S,clientCert:P,clientKey:Q})},logger:JO,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async k=>{if(!await Kw(k))throw new Error(`File ${k} doesn't exist or isn't readable.`);try{const S=await Hw(k),$=new TextEncoder().encode(S);return new File([$],await Fw(k))}catch(S){throw new Error(`Failed to read file ${k}: ${S}`)}}},envVariables:{},config:await f({}),externalRefResolver:g,input:O,server:y,severity:JSON.stringify(s),skipLint:!0,noSecretsMasking:!0});try{await Zge(i,o,w?.[0]?.ctx)}catch(k){console.error("Failed to persist workflow step context:",k)}return w}}}function k0e(t,e){return e.map(n=>{const r=t.find(o=>o.apiId===n.apiId);if(!r)return null;let i=r.value;if(r.variables)for(const o of r.variables){const s=new RegExp(`\\{${o.name}\\}`,"g");i=i.replace(s,o.value)}return`${n.name}=${i}`}).filter(n=>n!==null)}const C0e="com.redocly.tab.openFailed";function Xu(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:De.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0,...t}}function rS(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function P0e(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(Z5(eh(e.url),i))}r.method.get()!==e.method&&r.method.set(e.method)}}function Mn(){const{activeTabIdx:t,tabs:e}=Xa(),{dynamicReplayValues:n}=ar(),{getStep:r}=eS(),{getHistoryItem:i}=b0e(),{getWorkflow:o}=b1(),{getCollection:s}=Fa(),{getApiOperation:a}=Ll(),{sendEvent:l}=We(),c=zt(),d=v.useCallback((E,A,R,M)=>{console.warn(`[useTabHandlers] ${E}`,M),l(C0e,[{...fe("tab",A),reason:R,...M}])},[l]),h=v.useCallback((E,A)=>{const R=e[E];R&&R.ornull!==null&&R.state&&R.state.set(A)},[e]),p=v.useCallback(E=>{t.set(E)},[t]),f=v.useCallback(()=>{e.merge([N1e()]),t.set(e.length-1)},[e,t]),m=v.useCallback(E=>{const A=[...e.get({noproxy:!0}).filter(M=>M.state!==bn.Preview)];A.push(E),e.set(A);const R=A.length-1;return t.set(R),R},[e,t]),g=v.useCallback(E=>{const A=a(E),R=iS(E,A,n);m(R)},[m,n,a]),O=v.useCallback((E,A)=>{const R=e.get(),M=Z=>R.findIndex(({data:L})=>fn(L,De.Step)&&Z(L)),I=Z=>e[Z].data;if(A){const Z=M(U=>U.sourceFile===A);if(Z!==-1){P0e(I(Z),E),p(Z);return}const L=M(U=>!U.sourceFile&&rS(U,E));if(L!==-1){I(L).merge({sourceFile:A}),p(L);return}}else{const Z=M(L=>rS(L,E));if(Z!==-1){p(Z);return}}const N=cs({xOperation:E,name:A??void 0});m({id:crypto.randomUUID(),state:bn.Normal,data:Xu({draftStep:N,activeTabName:Wl(N),sourceFile:A??null})})},[e,p,m]),y=v.useCallback(async E=>{t.set(Math.max(0,E-1)),await new Promise(A=>setTimeout(()=>{e[E].set(pt),A()}))},[t,e]),b=v.useCallback(()=>{e.set([]),t.set(0)},[t,e]);function w({collectionId:E,workflowId:A,stepId:R}){const M=e.get({noproxy:!0}),I=new Set;for(let N=0;N<M.length;N++){const Z=M[N].data;switch(Z.type){case De.Step:Z.collectionId===E&&Z.workflowId===A&&Z.stepId===R&&I.add(N);break;case De.Workflow:case De.WorkflowRun:Z.collectionId===E&&Z.workflowId===A&&!R&&I.add(N);break;case De.Collection:Z.collectionId===E&&!A&&!R&&I.add(N);break}}I.size&&(e.merge(Object.fromEntries(I.values().map(N=>[N,pt]))),t.set(0))}const k=v.useCallback(async E=>{const A=e.get().find(({data:R})=>fn(R,De.Step)&&R.historyId===E);if(A)t.set(e.get().indexOf(A));else{const R=await i(E);if(!R||!q5(R)){d("Step history not found","stepHistoryTab","step_history_not_found",{historyId:E});return}const M=R.step;m({id:crypto.randomUUID(),state:bn.Preview,data:Xu({historyId:E,draftStep:structuredClone(M),response:structuredClone(R.response),activeTabName:Wl(M)})})}},[t,e,m,i,d]),S=v.useCallback(({collectionId:E,activeTabName:A})=>{const R=e.findIndex(M=>{const I=M.data.get();return fn(I,De.Collection)&&I.collectionId===E});if(R!==-1)t.set(R);else{if(!s(E)){d("Collection not found","collectionTab","collection_not_found",{collectionId:E});return}m({id:crypto.randomUUID(),state:bn.Preview,data:{collectionId:E,type:De.Collection,activeTabName:A??Ge.COLLECTION_SETTINGS}})}},[t,e,m,s,d]),$=v.useCallback(({collectionId:E,workflowId:A})=>{if(!o({collectionId:E,workflowId:A})){d("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:E,workflowId:A});return}m({id:crypto.randomUUID(),state:bn.Normal,data:{collectionId:E,workflowId:A,historyId:null,runDate:null,type:De.WorkflowRun,result:null,severitySettings:nS()}})},[m,o,d]),P=v.useCallback(async(E,{state:A=bn.Preview}={})=>{const R=e.get().find(({data:M})=>fn(M,De.WorkflowRun)&&M.historyId===E);if(R){const M=e.get().indexOf(R);A===bn.Normal&&R.state===bn.Preview&&h(M,bn.Normal),t.set(M)}else{const M=await i(E);if(!M||!N5(M)){d("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:E});return}m({id:crypto.randomUUID(),state:A,data:{collectionId:M.collectionId,workflowId:M.workflowId,historyId:E,runDate:M.date,type:De.WorkflowRun,result:structuredClone(M.workflowResult),severitySettings:nS(),label:Nu(M.workflow),secretValues:c.get().inputs.filter(I=>I.isSecret&&I.value).map(I=>String(I.value))}})}},[t,e,m,h,i,d,c]),Q=v.useCallback(({collectionId:E,workflowId:A,activeTabName:R})=>{const M=e.findIndex(I=>{const N=I.data.get();return fn(N,De.Workflow)&&N.workflowId===A&&N.collectionId===E});if(M!==-1){const I=e[M].data;R&&I.activeTabName.set(R),t.set(M)}else{if(!o({collectionId:E,workflowId:A})){d("Workflow not found","workflowTab","workflow_not_found",{collectionId:E,workflowId:A});return}m({id:crypto.randomUUID(),state:bn.Preview,data:{collectionId:E,workflowId:A,type:De.Workflow,activeTabName:R??Ge.WORKFLOW_SETTINGS}})}},[t,e,m,o,d]),T=v.useCallback(({collectionId:E,workflowId:A,stepId:R,state:M})=>{const I=e.get().find(({data:N})=>fn(N,De.Step)&&N.collectionId===E&&N.workflowId===A&&N.stepId===R&&N.historyId===null);if(I)t.set(e.get().indexOf(I));else{const N=r({collectionId:E,workflowId:A,stepId:R});if(!N){d("Step not found","stepTab","step_not_found",{collectionId:E,workflowId:A,stepId:R});return}const Z=N.get({noproxy:!0});m({id:crypto.randomUUID(),state:M??bn.Preview,data:Xu({stepId:R,collectionId:E,workflowId:A,activeTabName:Wl(Z)})})}},[t,e,r,m,d]),q=v.useCallback(({step:E})=>{m({id:crypto.randomUUID(),state:bn.Normal,data:Xu({stepId:E.stepId??null,workflowId:E.workflowId??null,draftStep:structuredClone(E),activeTabName:Wl(E)})})},[m]),_=v.useCallback((E,A)=>{if(E===A)return;const R=t.get(),M=[...e.get({noproxy:!0})],I=M[R]?.id,[N]=M.splice(E,1);if(M.splice(A,0,N),e.set(M),I){const Z=M.findIndex(L=>L.id===I);t.set(Z)}},[t,e]);return{handleNewTabOpen:f,addNewTab:m,openStepTabFromOperation:g,openStepTabFromXOperation:O,handleTabChange:p,handleTabClose:y,handleCloseAllTabs:b,handleCloseByDataId:w,openCollectionTab:S,openWorkflowTab:Q,openWorkflowRunTab:$,openWorkflowRunTabFromHistory:P,openStepTabFromHistory:k,openStepTabFromCollection:T,openStepTab:q,handleTabReorder:_,changeTabState:h}}function iS(t,e,n){const r=cs({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:bn.Preview,data:Xu({draftStep:r,activeTabName:Wl(r)})}}function $0e(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const Q0e=({transform:t})=>({...t,y:0}),j0e=({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))},Bl=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,T0e=t=>u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",...t,children:[u.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"}),u.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"})]}),x1=x(T0e)`
1133
+ `;function bM(t){return t.some(e=>!!(e.key||e.value||e.files?.length))}function q1e({type:t,formData:e,content:n}){if(tO.includes(t)){const r=bM(e["multipart/form-data"]),i=bM(e["application/x-www-form-urlencoded"]);return!r&&!i}return Uae.includes(t)?n.length===0:!0}function xM(t){const{disableCollectionsTab:e}=Vr();return v.useMemo(()=>{const n=[{name:Ge.SECURITY,icon:u.jsx(HC,{})},{name:Ge.BODY,icon:u.jsx(Np,{})},{name:Ge.PATH,icon:u.jsx(yM,{})},{name:Ge.QUERY,icon:u.jsx(vM,{})},{name:Ge.HEADERS,icon:u.jsx(_5,{})},{name:Ge.COOKIES,icon:u.jsx(z5,{})}];return!e.get()&&!t&&n.push({name:Ge.STEP_SETTINGS,icon:u.jsx(qu,{})}),n},[e,t])}function Wl(t){return q1e(t.requestBody)?Ge.QUERY:Ge.BODY}function q5(t){return t.type==="step"}function N5(t){return t.type==="workflow"}function Z5(t,e){const n=[],r=[];for(const i of e)i.active&&Md(i)?n.push(i):r.push(i);return[...t.map((i,o)=>{const s=n[o]?.id??i.id;return{...i,id:s}}),...r]}function N1e(){return structuredClone({id:crypto.randomUUID(),state:bn.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:De.Step,draftStep:cs(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0}})}function Z1e(t){return t!==void 0&&t.data?.type?.get()===De.Step}function X1e(t,e){const n=e.data.collectionId.get(),r=e.data.workflowId.get(),i=e.data.stepId.get();return n&&r&&i?m5(t,{collectionId:n,workflowId:r,stepId:i})??e.data.draftStep.ornull:e.data.draftStep.ornull}function V1e(t,e,n,r,i,o){const s=a=>a??"";return s(t)===r&&s(e)===i&&s(n)===o}const X5="New workflow";function wM({name:t=X5,collection:e}){let n=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||X5).replaceAll(" ","-").toLowerCase();if(!e)return n;const r=U1e(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function U1e(t){return t.workflows.filter(e=>e.state.get()!==It.Draft).map(e=>e.workflowId.get())}function V5({name:t=X5,isDraft:e=!1,collection:n}={}){return{workflowId:wM({name:t,collection:n}),summary:t,steps:[],state:e?It.Draft:It.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[qi()]}}function W1e(t,e){const n=new Set,{pathParameters:r,queryParameters:i,headers:o,cookies:s}=t.parameters.get(),a=t.outputs.get();for(const{value:l}of[...ln([...r,...i,...o,...s],e?.components.parameters.get()),...a])for(const c of Va(l))n.add(c);return t.steps.forEach(l=>{const c=l.security.get();for(const O of c)switch(O.securityType){case ee.BasicAuth:case ee.DigestAuth:for(const b of[O[O.securityType].username,O[O.securityType].password])for(const w of Va(b))n.add(w);break;case ee.JWT:for(const b of Va(O[O.securityType].token))n.add(b);break;case ee.APIKey:for(const b of Va(O[O.securityType].key))n.add(b);break;case ee.OAuth2:case ee.OpenIDConnect:const y=O[O.securityType];for(const b of Va(y[y.grantType].accessToken))n.add(b);break}const{pathParameters:d,queryParameters:h,headers:p,cookies:f}=l.parameters.get(),m=l.outputs.get();for(const{value:O}of[...ln([...d,...h,...p,...f],e?.components.parameters.get()),...m])for(const y of Va(O))n.add(y);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 y of Va(O))n.add(y);break}case"application/octet-stream":break;default:for(const O of Va(g.content))n.add(O)}}),n}function SM(t,e,n){const r=W1e(t,n);if(r.size===0){t.inputs.set(pt);return}t.inputs.set(i=>{const o=typeof i=="object"&&i?.properties||{};return{type:"object",properties:Object.fromEntries(Array.from(r).map(s=>{const a=e.inputs.find(l=>l.name.get()===s)?.isSecret;return[s,a?{type:"string",format:"password"}:o[s]||{type:"string"}]}))}})}function Nu(t){return t.summary||t.workflowId||"Untitled Workflow"}function kM(t,{collectionId:e,workflowId:n}){return t.collections.find(r=>r.id.get()===e)?.workflows.find(r=>r.workflowId.get()===n)??null}function Ll(){const{apis:t}=Fe(),{convertOperationToReplayValue:e}=ar();return{getApiOperation:v.useCallback(n=>RD(t,n,e),[t,e])}}function CM(t){const e=(t.match(/{([^}]+)}/g)||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function L1e(t){const e=t.servers.ornull?.[0];if(!e)return{url:"",variables:[]};const n=e.url.get(),r=CM(n).map(i=>({name:i,value:e.variables.ornull?.[i]?.default.get()||""}));return{url:n,variables:r}}function PM(){const t=Fe();function e(n){const r=t.apis.find(s=>s.id.get()===n);if(!r){console.error(`API ${n} not found`);return}const{url:i,variables:o}=L1e(r);t.environments.forEach(s=>{s.servers.find(a=>a.apiId.get()===n)||s.servers.merge([{apiId:n,value:i,variables:o}])})}return{attachApiServerToEnvironments:e}}const U5="New collection";function W5({name:t=U5,collections:e,isDraft:n=!1}={}){return{id:QM({name:t,collections:e}),srcType:Gr.FS,arazzo:"1.0.1",info:{version:"1.0.0",title:t},workflows:[],state:n?It.Draft:It.Normal,components:{inputs:{},parameters:{}},sourceDescriptions:[]}}function $M(t=U5){return`collections/${t.replaceAll(" ","-").toLowerCase()}.arazzo.yaml`}function QM({name:t=U5,collections:e}={}){let n=$M(t);if(!e?.length)return n;const r=Y1e(e);let i=1;for(;r.includes(n);)n=$M(`${t}-${i}`),i++;return n}function Y1e(t){return t.filter(e=>e.state.get()!==It.Draft).map(e=>e.id.get())}function jM(t,e){return t.collections.find(n=>n.id.get()===e)??null}function B1e({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 Fa(){const t=Fe(),{attachApiServerToEnvironments:e}=PM();async function n({collectionId:s,apiId:a}){const l=t.collections.find(c=>c.id.get()===s);if(l){if(!l.sourceDescriptions.get({noproxy:!0}).some(c=>c.apiId===a)){const c=t.apis.find(h=>h.id.get()===a)?.info.title.get(),d=Ti(a)?a:await Vt.relative(`/${s}/..`,`/${a}`);l.sourceDescriptions.set(h=>h.some(p=>p.apiId===a)?h:[...h,{name:B1e({apiName:c,sourceDescriptions:h}),url:d,apiId:a}])}e(a)}}function r(s){return jM(t,s)}function i(s,a){const l=s.sourceDescriptions.get({noproxy:!0}).filter(c=>a.name!==c.name);s.sourceDescriptions.set(l)}function o(s,a){const l=new Set(a.map(c=>`${c.workflowId??""}\0${c.stepId}`));s.workflows.forEach(c=>{const d=c.workflowId.get({noproxy:!0});c.steps.forEach(h=>{const p=h.stepId.get({noproxy:!0}),f=`${d}\0${p}`;if(!l.has(f))return;const m=h.operation.get({noproxy:!0});m&&(h.xOperation.set({method:m.method,url:m.path}),h.operation.set(null))})})}return{attachApiToCollection:n,getCollection:r,removeSourceDescription:i,disconnectStepsFromSource:o}}function Zu(t){const e=Fe();return t?e.collections.find(n=>n.id.get()===t)??null:null}const Cr={all:["history"],lists:()=>[...Cr.all,"list"],list:t=>[...Cr.lists(),t],recent:(t,e)=>[...Cr.all,"recent",t,e],detail:t=>[...Cr.all,"detail",t],count:t=>[...Cr.all,"count",t]};class TM{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 L5=(t,e)=>e.some(n=>t instanceof n);let IM,EM;function F1e(){return IM||(IM=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function G1e(){return EM||(EM=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Y5=new WeakMap,B5=new WeakMap,y1=new WeakMap;function H1e(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",o),t.removeEventListener("error",s)},o=()=>{n(Yl(t.result)),i()},s=()=>{r(t.error),i()};t.addEventListener("success",o),t.addEventListener("error",s)});return y1.set(e,t),e}function K1e(t){if(Y5.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",o),t.removeEventListener("error",s),t.removeEventListener("abort",s)},o=()=>{n(),i()},s=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",o),t.addEventListener("error",s),t.addEventListener("abort",s)});Y5.set(t,e)}let F5={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return Y5.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Yl(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 RM(t){F5=t(F5)}function J1e(t){return G1e().includes(t)?function(...e){return t.apply(G5(this),e),Yl(this.request)}:function(...e){return Yl(t.apply(G5(this),e))}}function e0e(t){return typeof t=="function"?J1e(t):(t instanceof IDBTransaction&&K1e(t),L5(t,F1e())?new Proxy(t,F5):t)}function Yl(t){if(t instanceof IDBRequest)return H1e(t);if(B5.has(t))return B5.get(t);const e=e0e(t);return e!==t&&(B5.set(t,e),y1.set(e,t)),e}const G5=t=>y1.get(t);function t0e(t,e,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(t,e),a=Yl(s);return r&&s.addEventListener("upgradeneeded",l=>{r(Yl(s.result),l.oldVersion,l.newVersion,Yl(s.transaction),l)}),n&&s.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{o&&l.addEventListener("close",()=>o()),i&&l.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const n0e=["get","getKey","getAll","getAllKeys","count"],r0e=["put","add","delete","clear"],H5=new Map;function AM(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(H5.get(e))return H5.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=r0e.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||n0e.includes(n)))return;const o=async function(s,...a){const l=this.transaction(s,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 H5.set(e,o),o}RM(t=>({...t,get:(e,n,r)=>AM(e,n)||t.get(e,n,r),has:(e,n)=>!!AM(e,n)||t.has(e,n)}));const i0e=["continue","continuePrimaryKey","advance"],DM={},K5=new WeakMap,MM=new WeakMap,o0e={get(t,e){if(!i0e.includes(e))return t[e];let n=DM[e];return n||(n=DM[e]=function(...r){K5.set(this,MM.get(this)[e](...r))}),n}};async function*s0e(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,o0e);for(MM.set(n,e),y1.set(n,G5(e));e;)yield n,e=await(K5.get(n)||e.continue()),K5.delete(n)}function zM(t,e){return e===Symbol.asyncIterator&&L5(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&L5(t,[IDBIndex,IDBObjectStore])}RM(t=>({...t,get(e,n,r){return zM(e,n)?s0e:t.get(e,n,r)},has(e,n){return zM(e,n)||t.has(e,n)}}));class UC{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 UC(e,n,r)}async initialize(){this.db||(this.db=await t0e(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const a0e=1;class WC{constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=UC.createInstance(n,a0e,this.setupDatabase);return new WC(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 n=(await this.getDb()).transaction(this.storeName,"readonly"),r=e?.type?await n.store.index("by-type").getAll(e.type):await n.store.index("by-date").getAll();return await n.done,r.sort((i,o)=>o.date-i.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:o,type:s,...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 r=(await this.getDb()).transaction(this.storeName,"readonly"),i=n?.type?await r.store.index("by-type").getAll(n.type):await r.store.index("by-date").getAll();return await r.done,i.sort((o,s)=>s.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 l0e(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const c0e=2;function u0e(t){const e=JSON.parse(t);let n;return e.version===1?n=l0e(e):n=e,n.version!==c0e&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const J5="history.json",d0e="history.json.backup";class h0e{static async migrateFromStorage(e,n,r){try{const i=await e.get(J5);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const o=u0e(i);if(o.length===0)return console.log(`No history items found in ${r}`),{migrated:!1,itemCount:0};await this.bulkInsert(n,o);try{await e.rename(J5,d0e)}catch{await e.remove(J5)}return console.log(`Migrated ${o.length} history items from ${r}`),{migrated:!0,itemCount:o.length}}catch(i){const o=i instanceof Error?i.message:"Unknown error";return console.error(`History migration from ${r} failed:`,o),{migrated:!1,itemCount:0,error:o}}}static async bulkInsert(e,n){for(let r=0;r<n.length;r+=100){const i=n.slice(r,r+100);await Promise.all(i.map(o=>e.addItem(o)))}}static async migrate(e,n,r){if(r){const{TauriFileSystemAdapter:i}=await import("./redocly-openapi-docs.min.TauriFileSystemAdapter-DZLjNpl_.js"),o=new i(e.systemFilesDir);return this.migrateFromStorage(o,n,"JSON file")}else{const i=new jy(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}class Ga{static instance=null;static async initialize(e,n){this.close(),this.instance=await p0e(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function p0e(t,e){if(e){const{HistorySqliteDBStorage:n}=await import("./redocly-openapi-docs.min.HistorySqliteDBStorage-DYnaxLim.js"),r=$p.getInstance(),i=new n(r);return new TM(i)}else{const n=WC.create(t.id);return new TM(n)}}function f0e(t){return rg({queryKey:Cr.list(t),queryFn:async()=>Ga.getInstance().getAll(t)})}function _M(){const t=ma();return ig({mutationFn:async e=>{await Ga.getInstance().addItem(e)},onMutate:e=>{t.setQueryData(Cr.detail(e.id),e)},onSuccess:()=>{t.invalidateQueries({queryKey:Cr.lists()}),t.invalidateQueries({queryKey:Cr.count()})},onError:(e,n)=>{t.removeQueries({queryKey:Cr.detail(n.id)}),console.error("Failed to add history item:",e)}})}function g0e(){const t=ma();return ig({mutationFn:async e=>{await Ga.getInstance().deleteItem(e)},onSuccess:(e,n)=>{t.removeQueries({queryKey:Cr.detail(n)}),t.invalidateQueries({queryKey:Cr.lists()}),t.invalidateQueries({queryKey:Cr.count()})},onError:(e,n)=>{console.error(`Failed to delete history item ${n}:`,e)}})}function m0e(){const t=ma();return ig({mutationFn:async()=>{await Ga.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:Cr.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function O0e(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function v0e(){const t=_M();return v.useCallback(({step:e,response:n})=>{const r=O0e(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function y0e(){const t=_M();return v.useCallback(async({workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:o,durationMs:s})=>{const a=crypto.randomUUID(),l={id:a,date:Date.now(),type:"workflow",workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:o,durationMs:s};try{return await t.mutateAsync(l),a}catch{return null}},[t])}function b0e(){const t=ma();async function e(n){return t.ensureQueryData({queryKey:Cr.detail(n),queryFn:()=>Ga.getInstance().getById(n)})}return{getHistoryItem:e}}function eS(){const t=Fe();return{getStep:e=>m5(t,e)}}function x0e({collectionId:t,workflowId:e,stepId:n}){const r=Fe().collections.find(o=>o.id.get()===t);if(!r)return null;const i=r.workflows.find(o=>o.workflowId.get()===e);return i?i.steps.find(o=>o.stepId.get()===n)??null:null}function tS(t){const e=t?.collectionId.get()??null,n=t?.workflowId.get()??null,r=t?.stepId.get()??null;return x0e({collectionId:e,workflowId:n,stepId:r})||t?.draftStep.ornull||null}function b1(){const t=Fe();return{getWorkflow:({collectionId:e,workflowId:n})=>kM(t,{collectionId:e,workflowId:n})}}function Ha({collectionId:t,workflowId:e}){const n=Fe().collections.find(r=>r.id.get()===t);return n?n.workflows.find(r=>r.workflowId.get()===e)??null:null}function nS(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const w0e=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function S0e(){const{project:{userFilesDir:t}}=Fe(),{certificates:e}=Vr(),n=zt(),{getCollection:r}=Fa();return{execute:async(i,o,s)=>{const a=r(i),l=t.get(),{inputs:c,servers:d}=n.get(),h=a?.sourceDescriptions.get()??[],p=`${l}/${i}`,[{createConfig:f},{ExternalResolver:m}]=await Promise.all([import("./redocly-openapi-docs.min.index-DQHVHxbB.js"),import("./redocly-openapi-docs.min.external-resolver-D89x3qoA.js")]),g=new m,O=c.map(k=>JSON.stringify({[k.name]:k.value})),y=k0e(d,h),{run:b}=await import("./redocly-openapi-docs.min.respect-run-BdIceoa0.js"),w=await b({files:[p],workflow:o?[o]:[],fetch:(k,S)=>{const $=w0e(k),{clientCert:P,clientKey:Q}=bD($,e?e.get({noproxy:!0}):[]);return us($,{...S,clientCert:P,clientKey:Q})},logger:JO,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async k=>{if(!await Kw(k))throw new Error(`File ${k} doesn't exist or isn't readable.`);try{const S=await Hw(k),$=new TextEncoder().encode(S);return new File([$],await Fw(k))}catch(S){throw new Error(`Failed to read file ${k}: ${S}`)}}},envVariables:{},config:await f({}),externalRefResolver:g,input:O,server:y,severity:JSON.stringify(s),skipLint:!0,noSecretsMasking:!0});try{await Zge(i,o,w?.[0]?.ctx)}catch(k){console.error("Failed to persist workflow step context:",k)}return w}}}function k0e(t,e){return e.map(n=>{const r=t.find(o=>o.apiId===n.apiId);if(!r)return null;let i=r.value;if(r.variables)for(const o of r.variables){const s=new RegExp(`\\{${o.name}\\}`,"g");i=i.replace(s,o.value)}return`${n.name}=${i}`}).filter(n=>n!==null)}const C0e="com.redocly.tab.openFailed";function Xu(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:De.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0,...t}}function rS(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function P0e(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(Z5(eh(e.url),i))}r.method.get()!==e.method&&r.method.set(e.method)}}function Mn(){const{activeTabIdx:t,tabs:e}=Xa(),{dynamicReplayValues:n}=ar(),{getStep:r}=eS(),{getHistoryItem:i}=b0e(),{getWorkflow:o}=b1(),{getCollection:s}=Fa(),{getApiOperation:a}=Ll(),{sendEvent:l}=We(),c=zt(),d=v.useCallback((E,A,R,M)=>{console.warn(`[useTabHandlers] ${E}`,M),l(C0e,[{...fe("tab",A),reason:R,...M}])},[l]),h=v.useCallback((E,A)=>{const R=e[E];R&&R.ornull!==null&&R.state&&R.state.set(A)},[e]),p=v.useCallback(E=>{t.set(E)},[t]),f=v.useCallback(()=>{e.merge([N1e()]),t.set(e.length-1)},[e,t]),m=v.useCallback(E=>{const A=[...e.get({noproxy:!0}).filter(M=>M.state!==bn.Preview)];A.push(E),e.set(A);const R=A.length-1;return t.set(R),R},[e,t]),g=v.useCallback(E=>{const A=a(E),R=iS(E,A,n);m(R)},[m,n,a]),O=v.useCallback((E,A)=>{const R=e.get(),M=Z=>R.findIndex(({data:L})=>fn(L,De.Step)&&Z(L)),I=Z=>e[Z].data;if(A){const Z=M(U=>U.sourceFile===A);if(Z!==-1){P0e(I(Z),E),p(Z);return}const L=M(U=>!U.sourceFile&&rS(U,E));if(L!==-1){I(L).merge({sourceFile:A}),p(L);return}}else{const Z=M(L=>rS(L,E));if(Z!==-1){p(Z);return}}const N=cs({xOperation:E,name:A??void 0});m({id:crypto.randomUUID(),state:bn.Normal,data:Xu({draftStep:N,activeTabName:Wl(N),sourceFile:A??null})})},[e,p,m]),y=v.useCallback(async E=>{t.set(Math.max(0,E-1)),await new Promise(A=>setTimeout(()=>{e[E].set(pt),A()}))},[t,e]),b=v.useCallback(()=>{e.set([]),t.set(0)},[t,e]);function w({collectionId:E,workflowId:A,stepId:R}){const M=e.get({noproxy:!0}),I=new Set;for(let N=0;N<M.length;N++){const Z=M[N].data;switch(Z.type){case De.Step:Z.collectionId===E&&Z.workflowId===A&&Z.stepId===R&&I.add(N);break;case De.Workflow:case De.WorkflowRun:Z.collectionId===E&&Z.workflowId===A&&!R&&I.add(N);break;case De.Collection:Z.collectionId===E&&!A&&!R&&I.add(N);break}}I.size&&(e.merge(Object.fromEntries(I.values().map(N=>[N,pt]))),t.set(0))}const k=v.useCallback(async E=>{const A=e.get().find(({data:R})=>fn(R,De.Step)&&R.historyId===E);if(A)t.set(e.get().indexOf(A));else{const R=await i(E);if(!R||!q5(R)){d("Step history not found","stepHistoryTab","step_history_not_found",{historyId:E});return}const M=R.step;m({id:crypto.randomUUID(),state:bn.Preview,data:Xu({historyId:E,draftStep:structuredClone(M),response:structuredClone(R.response),activeTabName:Wl(M)})})}},[t,e,m,i,d]),S=v.useCallback(({collectionId:E,activeTabName:A})=>{const R=e.findIndex(M=>{const I=M.data.get();return fn(I,De.Collection)&&I.collectionId===E});if(R!==-1)t.set(R);else{if(!s(E)){d("Collection not found","collectionTab","collection_not_found",{collectionId:E});return}m({id:crypto.randomUUID(),state:bn.Preview,data:{collectionId:E,type:De.Collection,activeTabName:A??Ge.COLLECTION_SETTINGS}})}},[t,e,m,s,d]),$=v.useCallback(({collectionId:E,workflowId:A})=>{if(!o({collectionId:E,workflowId:A})){d("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:E,workflowId:A});return}m({id:crypto.randomUUID(),state:bn.Normal,data:{collectionId:E,workflowId:A,historyId:null,runDate:null,type:De.WorkflowRun,result:null,severitySettings:nS()}})},[m,o,d]),P=v.useCallback(async(E,{state:A=bn.Preview}={})=>{const R=e.get().find(({data:M})=>fn(M,De.WorkflowRun)&&M.historyId===E);if(R){const M=e.get().indexOf(R);A===bn.Normal&&R.state===bn.Preview&&h(M,bn.Normal),t.set(M)}else{const M=await i(E);if(!M||!N5(M)){d("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:E});return}m({id:crypto.randomUUID(),state:A,data:{collectionId:M.collectionId,workflowId:M.workflowId,historyId:E,runDate:M.date,type:De.WorkflowRun,result:structuredClone(M.workflowResult),severitySettings:nS(),label:Nu(M.workflow),secretValues:c.get().inputs.filter(I=>I.isSecret&&I.value).map(I=>String(I.value))}})}},[t,e,m,h,i,d,c]),Q=v.useCallback(({collectionId:E,workflowId:A,activeTabName:R})=>{const M=e.findIndex(I=>{const N=I.data.get();return fn(N,De.Workflow)&&N.workflowId===A&&N.collectionId===E});if(M!==-1){const I=e[M].data;R&&I.activeTabName.set(R),t.set(M)}else{if(!o({collectionId:E,workflowId:A})){d("Workflow not found","workflowTab","workflow_not_found",{collectionId:E,workflowId:A});return}m({id:crypto.randomUUID(),state:bn.Preview,data:{collectionId:E,workflowId:A,type:De.Workflow,activeTabName:R??Ge.WORKFLOW_SETTINGS}})}},[t,e,m,o,d]),T=v.useCallback(({collectionId:E,workflowId:A,stepId:R,state:M})=>{const I=e.get().find(({data:N})=>fn(N,De.Step)&&N.collectionId===E&&N.workflowId===A&&N.stepId===R&&N.historyId===null);if(I)t.set(e.get().indexOf(I));else{const N=r({collectionId:E,workflowId:A,stepId:R});if(!N){d("Step not found","stepTab","step_not_found",{collectionId:E,workflowId:A,stepId:R});return}const Z=N.get({noproxy:!0});m({id:crypto.randomUUID(),state:M??bn.Preview,data:Xu({stepId:R,collectionId:E,workflowId:A,activeTabName:Wl(Z)})})}},[t,e,r,m,d]),q=v.useCallback(({step:E})=>{m({id:crypto.randomUUID(),state:bn.Normal,data:Xu({stepId:E.stepId??null,workflowId:E.workflowId??null,draftStep:structuredClone(E),activeTabName:Wl(E)})})},[m]),_=v.useCallback((E,A)=>{if(E===A)return;const R=t.get(),M=[...e.get({noproxy:!0})],I=M[R]?.id,[N]=M.splice(E,1);if(M.splice(A,0,N),e.set(M),I){const Z=M.findIndex(L=>L.id===I);t.set(Z)}},[t,e]);return{handleNewTabOpen:f,addNewTab:m,openStepTabFromOperation:g,openStepTabFromXOperation:O,handleTabChange:p,handleTabClose:y,handleCloseAllTabs:b,handleCloseByDataId:w,openCollectionTab:S,openWorkflowTab:Q,openWorkflowRunTab:$,openWorkflowRunTabFromHistory:P,openStepTabFromHistory:k,openStepTabFromCollection:T,openStepTab:q,handleTabReorder:_,changeTabState:h}}function iS(t,e,n){const r=cs({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:bn.Preview,data:Xu({draftStep:r,activeTabName:Wl(r)})}}function $0e(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const Q0e=({transform:t})=>({...t,y:0}),j0e=({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))},Bl=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,T0e=t=>u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",...t,children:[u.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"}),u.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"})]}),x1=x(T0e)`
1134
1134
  path {
1135
1135
  fill: ${({color:t})=>Bl(t)};
1136
1136
  }
@@ -4348,7 +4348,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
4348
4348
 
4349
4349
  height: ${({size:t})=>t||"16px"};
4350
4350
  width: ${({size:t})=>t||"16px"};
4351
- `,$$e=["text","file"];function Q$e({onParameterChange:t,files:e}){const n=v.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(an())try{const{open:a}=await import("./redocly-openapi-docs.min.index-B5-R6EGY.js"),l=await a({multiple:!0});if(!l)return;const c=(Array.isArray(l)?l:[l]).map(ep),d=(await Promise.all(c)).filter(h=>h!==null);t(d)}catch(a){console.error("Failed to open file dialog or read file:",a)}else n.current?.click()},o=v.useCallback(()=>{t(null)},[t]),s=v.useMemo(()=>{if(!e)return null;if(e.length===1)return u.jsx(AZ,{icon:u.jsx(gr,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:u.jsx(DZ,{children:e[0].file.name})});if(e.length>1)return u.jsx(AZ,{icon:u.jsx(gr,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:u.jsxs(DZ,{children:[e.length," files"]})})},[e,o]);return u.jsx(j$e,{children:u.jsxs(T$e,{children:[u.jsx(I$e,{children:s||u.jsx(A$e,{children:"Add files here"})}),u.jsxs(E$e,{children:[u.jsx(R$e,{onClick:i,variant:"secondary",size:"small","data-testid":"add-button",icon:u.jsx(Wn,{color:"--button-content-color"})}),u.jsx("input",{"data-testid":"file-input",hidden:!0,ref:n,type:"file",multiple:!0,accept:"files/*",onChange:r})]})]})})}const j$e=x.div`
4351
+ `,$$e=["text","file"];function Q$e({onParameterChange:t,files:e}){const n=v.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(an())try{const{open:a}=await import("./redocly-openapi-docs.min.index-D4_45rLR.js"),l=await a({multiple:!0});if(!l)return;const c=(Array.isArray(l)?l:[l]).map(ep),d=(await Promise.all(c)).filter(h=>h!==null);t(d)}catch(a){console.error("Failed to open file dialog or read file:",a)}else n.current?.click()},o=v.useCallback(()=>{t(null)},[t]),s=v.useMemo(()=>{if(!e)return null;if(e.length===1)return u.jsx(AZ,{icon:u.jsx(gr,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:u.jsx(DZ,{children:e[0].file.name})});if(e.length>1)return u.jsx(AZ,{icon:u.jsx(gr,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:u.jsxs(DZ,{children:[e.length," files"]})})},[e,o]);return u.jsx(j$e,{children:u.jsxs(T$e,{children:[u.jsx(I$e,{children:s||u.jsx(A$e,{children:"Add files here"})}),u.jsxs(E$e,{children:[u.jsx(R$e,{onClick:i,variant:"secondary",size:"small","data-testid":"add-button",icon:u.jsx(Wn,{color:"--button-content-color"})}),u.jsx("input",{"data-testid":"file-input",hidden:!0,ref:n,type:"file",multiple:!0,accept:"files/*",onChange:r})]})]})})}const j$e=x.div`
4352
4352
  position: relative;
4353
4353
  display: flex;
4354
4354
  flex-grow: 1;
@@ -4516,7 +4516,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
4516
4516
  width: 1.2em;
4517
4517
  height: 1.2em;
4518
4518
  }
4519
- `,tQe=({data:t})=>{const e=t.get(),[n,r]=v.useState(!1),i=v.useRef(null),o=l=>{const c=l.target.files?.[0];if(c){r(!0);const d=new FileReader;d.onload=()=>{r(!1),t.set({absolutePath:null,file:c})},d.readAsDataURL(c)}},s=async()=>{if(an())try{const{open:l}=await import("./redocly-openapi-docs.min.index-B5-R6EGY.js"),c=await l();if(!c)return;const d=await ep(c);t.set(d)}catch(l){console.error("Failed to open file dialog or read file:",l)}else i.current?.click()},a=()=>{t.set(null)};return n?u.jsxs(nQe,{children:[u.jsx(Q0,{}),"Loading..."]}):e&&e.file?.name?u.jsxs(rQe,{children:[u.jsxs(iQe,{children:[u.jsx(J$e,{size:"16px"}),u.jsx(oQe,{children:e.file?.name})]}),u.jsx(Oi,{onClick:a,icon:u.jsx(xn,{})})]}):u.jsx(_Z,{children:!e&&u.jsxs(u.Fragment,{children:[u.jsx("input",{type:"file",hidden:!0,ref:i,onChange:o}),u.jsx(de,{type:"button",variant:"text",onClick:s,icon:u.jsx(H$e,{}),children:"Upload file"})]})})},_Z=x.div`
4519
+ `,tQe=({data:t})=>{const e=t.get(),[n,r]=v.useState(!1),i=v.useRef(null),o=l=>{const c=l.target.files?.[0];if(c){r(!0);const d=new FileReader;d.onload=()=>{r(!1),t.set({absolutePath:null,file:c})},d.readAsDataURL(c)}},s=async()=>{if(an())try{const{open:l}=await import("./redocly-openapi-docs.min.index-D4_45rLR.js"),c=await l();if(!c)return;const d=await ep(c);t.set(d)}catch(l){console.error("Failed to open file dialog or read file:",l)}else i.current?.click()},a=()=>{t.set(null)};return n?u.jsxs(nQe,{children:[u.jsx(Q0,{}),"Loading..."]}):e&&e.file?.name?u.jsxs(rQe,{children:[u.jsxs(iQe,{children:[u.jsx(J$e,{size:"16px"}),u.jsx(oQe,{children:e.file?.name})]}),u.jsx(Oi,{onClick:a,icon:u.jsx(xn,{})})]}):u.jsx(_Z,{children:!e&&u.jsxs(u.Fragment,{children:[u.jsx("input",{type:"file",hidden:!0,ref:i,onChange:o}),u.jsx(de,{type:"button",variant:"text",onClick:s,icon:u.jsx(H$e,{}),children:"Upload file"})]})})},_Z=x.div`
4520
4520
  display: flex;
4521
4521
  align-items: center;
4522
4522
  justify-content: flex-start;
@@ -6901,7 +6901,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
6901
6901
  display: inline-block;
6902
6902
  color: var(--text-color-secondary);
6903
6903
  margin-left: var(--spacing-xs);
6904
- `,WRe="request",LRe=new Set(["replay:","redocly-replay:"]),YRe=8*1024,BRe=4*1024,OC=1024,FRe=new Set([yn.JSON,yn.XML,yn.HTML,yn.Text]);function vC(t){return c5(t).length>0}function GRe(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function SV(t,e){return!t||t.length>OC||e.length>OC||vC(e)}function yC(t,e,n){const r=[];for(const[i,o]of t){if(!i.startsWith(e))continue;const s=i.slice(e.length);if(SV(s,o))return null;r.push(GRe(n,s,o))}return r}function HRe(t){if(t.length>YRe)return null;let e;try{e=new URL(t)}catch{return null}if(!LRe.has(e.protocol)||e.hostname.toLowerCase()!==WRe)return null;const n=e.searchParams,r=n.get("url");if(!r||vC(r))return null;let i;try{i=new URL(r)}catch{return null}if(i.protocol!=="http:"&&i.protocol!=="https:")return null;const o=(n.get("method")||"GET").toUpperCase();if(!Iu.includes(o))return null;const s=yC(n,"header.","header"),a=yC(n,"query.","query"),l=yC(n,"cookie.","cookie");if(!s||!a||!l)return null;const c=eh(r);if(c.some(f=>SV(f.key,f.value)))return null;const d=n.get("body");if(d!==null&&(d.length>BRe||vC(d)))return null;const h=n.get("contentType")?.trim();if(h&&!FRe.has(h))return null;const p=n.get("env")?.trim();return p&&p.length>OC?null:{xOperation:{method:o,url:r},headers:s,queryParameters:[...c,...a],cookies:l,...d!==null&&{body:{content:d,...h&&{type:h}}},...p&&{environment:p}}}function KRe(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function JRe({onEnvironmentNotFound:t}={}){const{tabs:e,activeTabIdx:n}=Xa(),{addNewTab:r}=Mn(),{environments:i,activeEnvironmentId:o}=Fe();return v.useCallback(s=>{const a=e.get().findIndex(({data:h})=>fn(h,De.Step)&&KRe(h)&&rS(h,s.xOperation));let l;if(a!==-1)l=a,n.set(l);else{const h=cs({xOperation:s.xOperation});l=r({id:crypto.randomUUID(),state:bn.Normal,data:Xu({draftStep:h,activeTabName:Wl(h)})})}const c=e[l]?.data;c&&(c.response.set(null),c.requestError.set(null),c.isProcessingRequest.set(!1));const d=c?.draftStep.ornull;d&&(d.parameters.headers.set(s.headers),d.parameters.queryParameters.set(s.queryParameters),d.parameters.cookies.set(s.cookies),d.requestBody.set(Kh()),s.body&&d.requestBody.merge({content:s.body.content,...s.body.type&&{type:s.body.type}})),s.environment&&(i.get().some(h=>h.name===s.environment)?o.set(s.environment):t?.(s.environment))},[e,n,r,i,o,t])}const eAe="com.redocly.deepLink.opened";let kV=!1;function tAe(){const{warning:t}=l3(),e=We(),n=JRe({onEnvironmentNotFound:i=>t(`Environment "${i}" not found`)}),r=v.useRef(n);r.current=n,v.useEffect(()=>{let i,o=!1;const s=a=>{const l=a[0]&&HRe(a[0]);l&&(r.current(l),e.sendEvent(eAe,[{...fe("deepLink","request"),scheme:a[0].startsWith("redocly-replay:")?"redocly-replay":"replay"}]))};return(async()=>{const{onOpenUrl:a,getCurrent:l}=await import("./redocly-openapi-docs.min.index-YnvLQkG_.js"),c=await a(s);if(o){c();return}if(i=c,!kV){const d=await l();if(o)return;kV=!0,d?.[0]&&s(d)}})(),()=>{o=!0,i?.()}},[])}function nAe(t){const e=t||"default";return{id:_d(ag(e)),systemFilesDir:e3.join("/replay",e),userFilesDir:e3.join("/projects",e)}}async function rAe(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=_d(ag(t)),n=await iAe(),r=await Bw(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function iAe(){return NI()}function bC(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 o=1,s=`${n}-${o}`;for(;i(s);)o++,s=`${n}-${o}`;return r(s)}const oAe=[{suffix:Ke.Token,getValue:t=>t.token&&Object.prototype.hasOwnProperty.call(t.token,"access_token")?t.token.access_token:void 0},{suffix:Ke.Username,getValue:t=>t.username},{suffix:Ke.Password,getValue:t=>t.password},{suffix:Ke.ClientId,getValue:t=>t.client_id},{suffix:Ke.ClientSecret,getValue:t=>t.client_secret}];function CV(t,e){const n=[];for(const r of t?.flat()||[]){const i=e[r.id]??e.default;if(!i)continue;const o=r.id;for(const s of oAe){const a=s.getValue(i);Ry(a)&&n.push({name:o+s.suffix,value:a})}}return n}function sAe(t){const e=new Set,n=Object.values(Ke);for(const r of t.security?.flat()||[])if(r.id)for(const i of n)e.add(r.id+i);return e}function aAe(t,e){const n=new Set,r=sAe(t),i=o=>{if(o.security)for(const{name:s}of CV(t.security,o.security))n.add(s);for(const[s,a]of Object.entries(o.envVariables||{}))Ry(a)&&r.has(s)&&n.add(s)};if(Nf(e))return i(e),n;for(const o of Object.values(e))o&&i(o);return n}function lAe(t,e){const n=e.query??{},r=[],i=(o,s)=>{typeof s=="string"&&r.push({name:o,value:s})};for(const o of t.parameters){if(o.in!=="querystring")continue;const s=v4(o),a=new Set(s.map(l=>l.name));for(const l of a)i(l,n[l]);for(const[l,c]of Object.entries(n))for(const d of a)if(l.startsWith(`${d}[`)){i(l,c);break}}return r}function cAe(t,e,n){const r=fG(t,n);if(!r)return[];const i=new Map,o=(s,a,l=!1)=>{i.set(s,{name:s,value:a,isSecret:l})};for(const[s,a]of Object.entries(r.envVariables||{}))o(s,a);for(const{name:s,value:a}of lAe(e,r))o(s,a);for(const s of e.parameters){const a=x4[s.in];if(!a)continue;const l=r[a]?.[s.name];Ry(l)&&o(s.name,String(l))}if(r.security)for(const{name:s,value:a}of CV(e.security,r.security))o(s,a,!0);return Array.from(i.values())}function uAe(t,e){return t.find(n=>n.name===e)}function dAe(t,e,n){const r=Object.entries(e.variables??{}).map(([i,o])=>{const s=n?.variables.find(a=>a.name===i)?.value;return{name:i,value:s??o.default??""}});return{apiId:t,value:n?.value||e.url,specUrl:e.url,variables:r}}function hAe(t,e,n,r,i,o){const{servers:s,parameters:a}=e,l=a.filter(k=>k.in==="path"),c=fAe(e),d=new Set,h=l.map(k=>{const S=k.example?String(k.example):"";return d.add(k.name),{name:k.name,value:S,isSecret:!1}}),p=k=>c.map(S=>{const $=e.security?.flat().find(Q=>{const T=Q.id;return S.name.startsWith(T)});let P="";if($){const Q=$.serverValues?.[k];Q&&(Q["x-defaultUsername"]&&S.name.endsWith(Ke.Username)?P=Q["x-defaultUsername"]:Q["x-defaultPassword"]&&S.name.endsWith(Ke.Password)?P=Q["x-defaultPassword"]:Q["x-defaultClientId"]&&S.name.endsWith(Ke.ClientId)?P=Q["x-defaultClientId"]:Q["x-defaultClientSecret"]&&S.name.endsWith(Ke.ClientSecret)?P=Q["x-defaultClientSecret"]:Q["x-defaultAccessToken"]&&(P=Q["x-defaultAccessToken"])),P||($["x-defaultUsername"]&&S.name.endsWith(Ke.Username)?P=$["x-defaultUsername"]:$["x-defaultPassword"]&&S.name.endsWith(Ke.Password)?P=$["x-defaultPassword"]:$["x-defaultClientId"]&&S.name.endsWith(Ke.ClientId)?P=$["x-defaultClientId"]:$["x-defaultClientSecret"]&&S.name.endsWith(Ke.ClientSecret)?P=$["x-defaultClientSecret"]:$["x-defaultAccessToken"]&&(P=$["x-defaultAccessToken"]))}return d.add(S.name),{name:S.name,value:S.value||P||"",isSecret:S.isSecret}}),f=(k,S)=>{const $=uAe(n,S),P=$?.servers.find(M=>M.apiId===t),Q=dAe(t,k,P),T=p(k.url),q=cAe(i,e,k.url),_=q.map(M=>M.name),E=$?.inputs.filter(M=>M.value&&!_.includes(M.name))||[];for(const M of q)d.add(M.name);const A=mAe(gAe(E,h,T,q),r?.[S]),R=($?.servers??[]).filter(M=>M.apiId!==t).map(M=>({...M,variables:M.variables.map(I=>({...I}))}));return{name:S,inputs:A,servers:[Q,...R],state:It.Normal}},m=OAe(s),g=k=>k.name||k.description||k.url,O=m.map(k=>f(k,g(k))),y=new Set(O.map(k=>k.name)),b=m.find(k=>g(k)===o?.baseEnvironment)??m[0],w=(o?.names??[]).filter(k=>k.trim()&&!y.has(k)).map(k=>f(b,k));return{generatedInputs:d,environments:[...O,...w],synthesizedEnvironmentNames:new Set(w.map(k=>k.name))}}function pAe({envs:t,synthesizedEnvironmentNames:e,existingEnvironments:n,allowedEnvironments:r,selectedEnvironment:i,activeEnvironmentId:o}){if(r?.length){const l=t.filter(c=>e.has(c.name)||r.includes(c.name));return{newEnvironments:l,predefinedEnvironmentNames:new Set(l.map(c=>c.name)),activeEnvName:l.find(c=>c.name===i)?.name||l[0]?.name||""}}const s=new Set(t.map(l=>l.name)),a=[...t,...n.filter(l=>!s.has(l.name))];return{newEnvironments:a,predefinedEnvironmentNames:s,activeEnvName:a.find(l=>l.name===o)?.name||a.find(l=>l.name===i)?.name||a[0]?.name||""}}function fAe(t){const e=[];return(t.security?.flat()||[]).forEach(n=>{const r=iO(n),i=n.id;(r===ee.BasicAuth||r===ee.DigestAuth)&&(e.push(Co(i+Ke.Username,!1)),e.push(Co(i+Ke.Password))),r===ee.JWT&&e.push(Co(i+Ke.JWTToken)),r===ee.APIKey&&e.push(Co(i+Ke.APIKey)),r===ee.OAuth2&&(e.push(Co(i+Ke.Token)),Yw(n).forEach(o=>{e.push(Co(i+Ke.ClientId)),[J.Implicit,J.ClientCredentialsWithJwtAssertion].includes(o)||e.push(Co(i+Ke.ClientSecret)),o===J.ClientCredentialsWithJwtAssertion&&e.push(Co(i+Ke.ClientAssertion))})),r===ee.OpenIDConnect&&(e.push(Co(i+Ke.Token)),e.push(Co(i+Ke.ClientId)),e.push(Co(i+Ke.ClientSecret)))}),e}function Co(t,e=!0){return{name:t,value:"",isSecret:e}}function gAe(...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 xC(t){return typeof t=="string"?{value:t}:t}function mAe(t,e){if(!e)return t;const n=new Set(t.map(o=>o.name)),r=t.map(o=>{const s=e[o.name];if(s===void 0)return o;const{value:a,isSecret:l}=xC(s);return{...o,value:a,...l!==void 0&&{isSecret:l}}}),i=Object.entries(e).filter(([o])=>!n.has(o)).map(([o,s])=>{const{value:a,isSecret:l}=xC(s);return{name:o,value:a,isSecret:l??!1}});return[...r,...i]}function OAe(t){const e=d4(VU?window.location.href:globalThis.SSR_HOSTNAME||"");t.length===0&&(t=[{url:"/"}]);function n(r){return nG(e,r)}return t.map(r=>({...r,url:n(r.url),description:r.description||""}))}function M0(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];!Md(i)||!i.key||!e.has(i.key)||t[r].merge({value:`$inputs.${i.key}`,active:!0})}}function PV(t,e,n){if(typeof e=="string"){const i=_i(e);i&&n.has(i)&&t.set(e);return}if(!e||typeof e!="object"||Array.isArray(e))return;const r=t;for(const[i,o]of Object.entries(e)){const s=r[i];s&&PV(s,o,n)}}function vAe(t,e,n){if(n.size===0)return;const r=t.get({noproxy:!0});for(const i of e){if(!i.securitySchemeId)continue;const o=r.findIndex(s=>s.securitySchemeId===i.securitySchemeId);o!==-1&&PV(t[o],i,n)}}function yAe(t,e,n){const r=Xw(e.parameters,"in");M0(t.parameters.pathParameters,Rc(r.path,"path",n)),M0(t.parameters.queryParameters,k4(r.query,r.querystring,n)),M0(t.parameters.headers,Rc(r.header,"header",n)),M0(t.parameters.cookies,Rc(r.cookie,"cookie",n)),vAe(t.security,rO(e),aAe(e,n))}function $V(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=bAe(t,e,n);return{operations:r}}function bAe(t,e,n){const r=[];for(const[i,o]of Object.entries(t.paths)){for(const[s,a]of Object.entries(o))s!=="parameters"&&s!=="servers"&&s!=="description"&&s!=="summary"&&s!=="additionalOperations"&&(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(l=>{const{operation:c}=QV(i,s,t,l,e,!1,n);c&&r.push(c)});if(o.additionalOperations)for(const[s,a]of Object.entries(o.additionalOperations))(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(l=>{const{operation:c}=QV(i,s,t,l,e,!0,n);c&&r.push(c)})}return{operations:r}}function QV(t,e,n,r,i,o,s){if(!s)return{operation:null};const a=s(t,e,n);if(!a)return{operation:null};const l=`${n.info.title}/${r}/${a.name}`;return{operation:dle(a,o,i,l)}}const jV=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:o}=nE({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===o}return!1});class xAe{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 wC{static instance=null;static async initialize(e,n){this.close(),this.instance=await wAe(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function wAe(t,e){if(e){const{AiChatSqliteDBStorage:n}=await import("./redocly-openapi-docs.min.AiChatSqliteDBStorage-BopXqcPv.js"),r=$p.getInstance(),i=new n(r);return new xAe(i)}else throw new Error("Not implemented")}const dd="ai-chat",SC="detail",SAe="title",TV="infinite-history",IV={all:()=>[dd],details:()=>[dd,SC],detail:t=>[dd,SC,t],detailTitle:t=>[dd,SC,t,SAe],infiniteHistories:()=>[dd,TV],infiniteHistory:t=>[dd,TV,t]},kAe=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:o})=>{const s=v.useContext(SR),a=We(),l=ma(),c=v.useRef(e);c.current=e;const d=v.useMemo(async()=>{const p=an()?await rAe(e.storageKey):nAe(e.storageKey);e.layout!=="preview"&&an()&&pp.initialize();const{isInitialized:f}=await s.init(p,e,a);if(e.layout!=="preview"){if(an()){const k=`${p.systemFilesDir}/replay.db`;await $p.initialize(k),await wC.initialize(p,an())}await Ga.initialize(p,an()),await Oo.initialize(an());try{await Oo.getInstance()?.pruneOlderThan(Date.now()-Nge)}catch(k){console.error("Failed to prune step context:",k)}try{const k=await h0e.migrate(p,Ga.getInstance(),an());k.migrated&&a.sendEvent("com.redocly.history.migration",[{...fe("migration","historyMigration","storage"),status:"success",itemCount:k.itemCount}])}catch(k){console.error("History migration failed:",k),a.sendEvent("com.redocly.history.migration",[{...fe("migration","historyMigration","storage"),status:"error",error:k instanceof Error?k.message:"Unknown error"}])}}if(!f)return;if(!n){s.environments.length===0&&s.environments.set(oy);return}const m=bC(n,[]),{operations:g}=$V(n,m,e.convertOperationToReplayValue);if(!g?.length||!g[0].collectionPath?.split("/")?.[0]||(s.apis.set([{id:m,srcType:Gr.FS,...n}]),s.predefinedApiId.set(m),!r&&!i))return;const O=jV(g,r,i),{path:y,method:b}=O?.apiPath||{};if(!O||!y||!b)return;const w=e.convertOperationToReplayValue?.(y,b,n);w&&EV(s,m,w,c.current),$Ae(s,{apiId:m,path:y,method:b,operationId:O.operationId,isAdditionalOperation:O.isAdditionalOperation},w,e.dynamicReplayValues)},[e.storageKey]);v.useEffect(()=>{if(e.layout!=="preview")return l.invalidateQueries({queryKey:Cr.all}),l.invalidateQueries({queryKey:IV.all()}),l.invalidateQueries({queryKey:hp.all}),()=>{Ga.close(),wC.close(),pp.close(),Oo.close(),an()&&$p.close().catch(p=>{console.error("Failed to close SqliteDBConnection:",p)})}},[e.storageKey,e.layout,l]),v.useEffect(()=>{if(!n||!e.convertOperationToReplayValue)return;const p=bC(n,[]),{operations:f}=$V(n,p,e.convertOperationToReplayValue);if(!f?.length)return;const m=jV(f,r,i),{path:g,method:O}=m?.apiPath||{};if(!m||!g||!O)return;const y=e.convertOperationToReplayValue(g,O,n);y&&EV(s,p,y,e)},[e.convertOperationToReplayValue,e.predefinedEnvValues,e.gateEnvironments,e.dynamicReplayValues,e.allowedEnvironments,e.selectedEnvironment,n,r,i]);const h=e.layout==="preview"?null:u.jsx(XRe,{projectPath:e.storageKey});return u.jsx(v.Suspense,{fallback:h,children:u.jsx(CAe,{initStore:d,settings:e,api:n,onLoad:o,children:t})})};function CAe({initStore:t,children:e,settings:n,api:r,onLoad:i}){return v.use(t),Jfe(n,r),v.useEffect(()=>{i?.()},[]),u.jsxs(_e.Fragment,{children:[an()&&u.jsx(PAe,{}),e]},n.storageKey)}function PAe(){return tAe(),null}const EV=(t,e,n,r)=>{const i=t.environments.get({noproxy:!0}),{environments:o,generatedInputs:s,synthesizedEnvironmentNames:a}=hAe(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues,r.gateEnvironments);t.predefinedInputNames.set(s);const{newEnvironments:l,predefinedEnvironmentNames:c,activeEnvName:d}=pAe({envs:o,synthesizedEnvironmentNames:a,existingEnvironments:i,allowedEnvironments:r.allowedEnvironments,selectedEnvironment:r.selectedEnvironment,activeEnvironmentId:t.activeEnvironmentId.get()});t.predefinedEnvironmentNames.set(c),ay(l,t.environments.get({noproxy:!0}))||t.environments.set(l),t.activeEnvironmentId.set(d)},$Ae=(t,e,n,r)=>{const i=t.tabsState.tabs.get().findIndex(({data:o})=>fn(o,De.Step)&&o.draftStep?.operation?.apiId===e.apiId&&o.draftStep?.operation?.path===e.path&&o.draftStep?.operation?.method===e.method);if(i!==-1){const o=t.tabsState.tabs[i],s=o.data.get();if(n&&r&&fn(s,De.Step)){const a=o.data.draftStep.ornull;a&&yAe(a,n,r)}t.tabsState.activeTabIdx.set(i)}else{const o=iS(e,n,r);t.tabsState.tabs.merge([{...o,state:bn.Normal}]),t.tabsState.activeTabIdx.set(t.tabsState.tabs.length-1)}},RV=v.createContext({ReplayGate:null,ReplayTopBarActions:null}),QAe=RV.Provider,jAe=()=>v.useContext(RV);function TAe(t){const{activeEnvironmentId:e}=Fe(),[n,r]=v.useState(),[i,o]=v.useState(),s=v.useMemo(()=>t.predefinedEnvValues||n?IAe(t.predefinedEnvValues,n):void 0,[t.predefinedEnvValues,n]),a=v.useMemo(()=>n?{names:Object.keys(n),baseEnvironment:t.selectedEnvironment}:void 0,[n,t.selectedEnvironment]),l=v.useMemo(()=>({...t,...s&&{predefinedEnvValues:s},...a&&{gateEnvironments:a},...i&&{selectedEnvironment:i}}),[t,s,a,i]),c=v.useCallback((h,p)=>r(f=>({...f,[h]:{...f?.[h],...p}})),[]),d=v.useCallback(h=>{o(h),e.set(h)},[e]);return{mergedSettings:l,setEnvValues:c,setSelectedEnvironment:d}}function IAe(t,e){const n={...t};for(const[r,i]of Object.entries(e??{}))n[r]={...n[r],...i};return n}const AV=v.createContext({renderProjectSelect:()=>null});function EAe(){return v.useContext(AV)}function RAe(){const{environments:t,activeEnvironmentId:e}=Fe(),{sendEvent:n}=We(),r=v.useCallback(o=>{e.set(o),n("com.redocly.environment.management",[{...fe("environment","headerPanelEnvironment"),action:"selected",name:o}])},[e,n]),i=v.useCallback((o,s)=>{const a=t.find(c=>c.name.get()===o);if(!a)return;const l=a.inputs.get();for(const[c,d]of Object.entries(s)){const{value:h,isSecret:p}=xC(d),f=l.findIndex(m=>m.name===c);f!==-1?a.inputs[f].merge({value:h,...p!==void 0&&{isSecret:p}}):a.inputs.merge([{name:c,value:h,isSecret:p??!1}])}},[t]);return{environments:t.get(),activeEnvironment:e.get(),setSelectedEnvironment:r,setEnvironmentValues:i}}function AAe(){const{renderProjectSelect:t}=EAe(),{layout:e,apiId:n}=ar(),{apis:r}=Fe(),{environments:i,activeEnvironment:o,setEnvironmentValues:s,setSelectedEnvironment:a}=RAe(),{ReplayTopBarActions:l}=jAe(),c=r[0]?.get()?.info?.title,d=!t&&e==="overlay"&&c;return u.jsxs(DAe,{children:[t&&u.jsx(DV,{children:u.jsx(t,{})}),d&&u.jsx(DV,{children:u.jsx(MAe,{children:c})}),u.jsxs(zAe,{children:[l&&u.jsx(l,{environments:i,activeEnvironment:o,setEnvironmentValues:s,setSelectedEnvironment:a,apiId:n}),u.jsx(OV,{})]})]})}const DAe=x.div`
6904
+ `,WRe="request",LRe=new Set(["replay:","redocly-replay:"]),YRe=8*1024,BRe=4*1024,OC=1024,FRe=new Set([yn.JSON,yn.XML,yn.HTML,yn.Text]);function vC(t){return c5(t).length>0}function GRe(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function SV(t,e){return!t||t.length>OC||e.length>OC||vC(e)}function yC(t,e,n){const r=[];for(const[i,o]of t){if(!i.startsWith(e))continue;const s=i.slice(e.length);if(SV(s,o))return null;r.push(GRe(n,s,o))}return r}function HRe(t){if(t.length>YRe)return null;let e;try{e=new URL(t)}catch{return null}if(!LRe.has(e.protocol)||e.hostname.toLowerCase()!==WRe)return null;const n=e.searchParams,r=n.get("url");if(!r||vC(r))return null;let i;try{i=new URL(r)}catch{return null}if(i.protocol!=="http:"&&i.protocol!=="https:")return null;const o=(n.get("method")||"GET").toUpperCase();if(!Iu.includes(o))return null;const s=yC(n,"header.","header"),a=yC(n,"query.","query"),l=yC(n,"cookie.","cookie");if(!s||!a||!l)return null;const c=eh(r);if(c.some(f=>SV(f.key,f.value)))return null;const d=n.get("body");if(d!==null&&(d.length>BRe||vC(d)))return null;const h=n.get("contentType")?.trim();if(h&&!FRe.has(h))return null;const p=n.get("env")?.trim();return p&&p.length>OC?null:{xOperation:{method:o,url:r},headers:s,queryParameters:[...c,...a],cookies:l,...d!==null&&{body:{content:d,...h&&{type:h}}},...p&&{environment:p}}}function KRe(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function JRe({onEnvironmentNotFound:t}={}){const{tabs:e,activeTabIdx:n}=Xa(),{addNewTab:r}=Mn(),{environments:i,activeEnvironmentId:o}=Fe();return v.useCallback(s=>{const a=e.get().findIndex(({data:h})=>fn(h,De.Step)&&KRe(h)&&rS(h,s.xOperation));let l;if(a!==-1)l=a,n.set(l);else{const h=cs({xOperation:s.xOperation});l=r({id:crypto.randomUUID(),state:bn.Normal,data:Xu({draftStep:h,activeTabName:Wl(h)})})}const c=e[l]?.data;c&&(c.response.set(null),c.requestError.set(null),c.isProcessingRequest.set(!1));const d=c?.draftStep.ornull;d&&(d.parameters.headers.set(s.headers),d.parameters.queryParameters.set(s.queryParameters),d.parameters.cookies.set(s.cookies),d.requestBody.set(Kh()),s.body&&d.requestBody.merge({content:s.body.content,...s.body.type&&{type:s.body.type}})),s.environment&&(i.get().some(h=>h.name===s.environment)?o.set(s.environment):t?.(s.environment))},[e,n,r,i,o,t])}const eAe="com.redocly.deepLink.opened";let kV=!1;function tAe(){const{warning:t}=l3(),e=We(),n=JRe({onEnvironmentNotFound:i=>t(`Environment "${i}" not found`)}),r=v.useRef(n);r.current=n,v.useEffect(()=>{let i,o=!1;const s=a=>{const l=a[0]&&HRe(a[0]);l&&(r.current(l),e.sendEvent(eAe,[{...fe("deepLink","request"),scheme:a[0].startsWith("redocly-replay:")?"redocly-replay":"replay"}]))};return(async()=>{const{onOpenUrl:a,getCurrent:l}=await import("./redocly-openapi-docs.min.index-YnvLQkG_.js"),c=await a(s);if(o){c();return}if(i=c,!kV){const d=await l();if(o)return;kV=!0,d?.[0]&&s(d)}})(),()=>{o=!0,i?.()}},[])}function nAe(t){const e=t||"default";return{id:_d(ag(e)),systemFilesDir:e3.join("/replay",e),userFilesDir:e3.join("/projects",e)}}async function rAe(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=_d(ag(t)),n=await iAe(),r=await Bw(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function iAe(){return NI()}function bC(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 o=1,s=`${n}-${o}`;for(;i(s);)o++,s=`${n}-${o}`;return r(s)}const oAe=[{suffix:Ke.Token,getValue:t=>t.token&&Object.prototype.hasOwnProperty.call(t.token,"access_token")?t.token.access_token:void 0},{suffix:Ke.Username,getValue:t=>t.username},{suffix:Ke.Password,getValue:t=>t.password},{suffix:Ke.ClientId,getValue:t=>t.client_id},{suffix:Ke.ClientSecret,getValue:t=>t.client_secret}];function CV(t,e){const n=[];for(const r of t?.flat()||[]){const i=e[r.id]??e.default;if(!i)continue;const o=r.id;for(const s of oAe){const a=s.getValue(i);Ry(a)&&n.push({name:o+s.suffix,value:a})}}return n}function sAe(t){const e=new Set,n=Object.values(Ke);for(const r of t.security?.flat()||[])if(r.id)for(const i of n)e.add(r.id+i);return e}function aAe(t,e){const n=new Set,r=sAe(t),i=o=>{if(o.security)for(const{name:s}of CV(t.security,o.security))n.add(s);for(const[s,a]of Object.entries(o.envVariables||{}))Ry(a)&&r.has(s)&&n.add(s)};if(Nf(e))return i(e),n;for(const o of Object.values(e))o&&i(o);return n}function lAe(t,e){const n=e.query??{},r=[],i=(o,s)=>{typeof s=="string"&&r.push({name:o,value:s})};for(const o of t.parameters){if(o.in!=="querystring")continue;const s=v4(o),a=new Set(s.map(l=>l.name));for(const l of a)i(l,n[l]);for(const[l,c]of Object.entries(n))for(const d of a)if(l.startsWith(`${d}[`)){i(l,c);break}}return r}function cAe(t,e,n){const r=fG(t,n);if(!r)return[];const i=new Map,o=(s,a,l=!1)=>{i.set(s,{name:s,value:a,isSecret:l})};for(const[s,a]of Object.entries(r.envVariables||{}))o(s,a);for(const{name:s,value:a}of lAe(e,r))o(s,a);for(const s of e.parameters){const a=x4[s.in];if(!a)continue;const l=r[a]?.[s.name];Ry(l)&&o(s.name,String(l))}if(r.security)for(const{name:s,value:a}of CV(e.security,r.security))o(s,a,!0);return Array.from(i.values())}function uAe(t,e){return t.find(n=>n.name===e)}function dAe(t,e,n){const r=Object.entries(e.variables??{}).map(([i,o])=>{const s=n?.variables.find(a=>a.name===i)?.value;return{name:i,value:s??o.default??""}});return{apiId:t,value:n?.value||e.url,specUrl:e.url,variables:r}}function hAe(t,e,n,r,i,o){const{servers:s,parameters:a}=e,l=a.filter(k=>k.in==="path"),c=fAe(e),d=new Set,h=l.map(k=>{const S=k.example?String(k.example):"";return d.add(k.name),{name:k.name,value:S,isSecret:!1}}),p=k=>c.map(S=>{const $=e.security?.flat().find(Q=>{const T=Q.id;return S.name.startsWith(T)});let P="";if($){const Q=$.serverValues?.[k];Q&&(Q["x-defaultUsername"]&&S.name.endsWith(Ke.Username)?P=Q["x-defaultUsername"]:Q["x-defaultPassword"]&&S.name.endsWith(Ke.Password)?P=Q["x-defaultPassword"]:Q["x-defaultClientId"]&&S.name.endsWith(Ke.ClientId)?P=Q["x-defaultClientId"]:Q["x-defaultClientSecret"]&&S.name.endsWith(Ke.ClientSecret)?P=Q["x-defaultClientSecret"]:Q["x-defaultAccessToken"]&&(P=Q["x-defaultAccessToken"])),P||($["x-defaultUsername"]&&S.name.endsWith(Ke.Username)?P=$["x-defaultUsername"]:$["x-defaultPassword"]&&S.name.endsWith(Ke.Password)?P=$["x-defaultPassword"]:$["x-defaultClientId"]&&S.name.endsWith(Ke.ClientId)?P=$["x-defaultClientId"]:$["x-defaultClientSecret"]&&S.name.endsWith(Ke.ClientSecret)?P=$["x-defaultClientSecret"]:$["x-defaultAccessToken"]&&(P=$["x-defaultAccessToken"]))}return d.add(S.name),{name:S.name,value:S.value||P||"",isSecret:S.isSecret}}),f=(k,S)=>{const $=uAe(n,S),P=$?.servers.find(M=>M.apiId===t),Q=dAe(t,k,P),T=p(k.url),q=cAe(i,e,k.url),_=q.map(M=>M.name),E=$?.inputs.filter(M=>M.value&&!_.includes(M.name))||[];for(const M of q)d.add(M.name);const A=mAe(gAe(E,h,T,q),r?.[S]),R=($?.servers??[]).filter(M=>M.apiId!==t).map(M=>({...M,variables:M.variables.map(I=>({...I}))}));return{name:S,inputs:A,servers:[Q,...R],state:It.Normal}},m=OAe(s),g=k=>k.name||k.description||k.url,O=m.map(k=>f(k,g(k))),y=new Set(O.map(k=>k.name)),b=m.find(k=>g(k)===o?.baseEnvironment)??m[0],w=(o?.names??[]).filter(k=>k.trim()&&!y.has(k)).map(k=>f(b,k));return{generatedInputs:d,environments:[...O,...w],synthesizedEnvironmentNames:new Set(w.map(k=>k.name))}}function pAe({envs:t,synthesizedEnvironmentNames:e,existingEnvironments:n,allowedEnvironments:r,selectedEnvironment:i,activeEnvironmentId:o}){if(r?.length){const l=t.filter(c=>e.has(c.name)||r.includes(c.name));return{newEnvironments:l,predefinedEnvironmentNames:new Set(l.map(c=>c.name)),activeEnvName:l.find(c=>c.name===i)?.name||l[0]?.name||""}}const s=new Set(t.map(l=>l.name)),a=[...t,...n.filter(l=>!s.has(l.name))];return{newEnvironments:a,predefinedEnvironmentNames:s,activeEnvName:a.find(l=>l.name===o)?.name||a.find(l=>l.name===i)?.name||a[0]?.name||""}}function fAe(t){const e=[];return(t.security?.flat()||[]).forEach(n=>{const r=iO(n),i=n.id;(r===ee.BasicAuth||r===ee.DigestAuth)&&(e.push(Co(i+Ke.Username,!1)),e.push(Co(i+Ke.Password))),r===ee.JWT&&e.push(Co(i+Ke.JWTToken)),r===ee.APIKey&&e.push(Co(i+Ke.APIKey)),r===ee.OAuth2&&(e.push(Co(i+Ke.Token)),Yw(n).forEach(o=>{e.push(Co(i+Ke.ClientId)),[J.Implicit,J.ClientCredentialsWithJwtAssertion].includes(o)||e.push(Co(i+Ke.ClientSecret)),o===J.ClientCredentialsWithJwtAssertion&&e.push(Co(i+Ke.ClientAssertion))})),r===ee.OpenIDConnect&&(e.push(Co(i+Ke.Token)),e.push(Co(i+Ke.ClientId)),e.push(Co(i+Ke.ClientSecret)))}),e}function Co(t,e=!0){return{name:t,value:"",isSecret:e}}function gAe(...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 xC(t){return typeof t=="string"?{value:t}:t}function mAe(t,e){if(!e)return t;const n=new Set(t.map(o=>o.name)),r=t.map(o=>{const s=e[o.name];if(s===void 0)return o;const{value:a,isSecret:l}=xC(s);return{...o,value:a,...l!==void 0&&{isSecret:l}}}),i=Object.entries(e).filter(([o])=>!n.has(o)).map(([o,s])=>{const{value:a,isSecret:l}=xC(s);return{name:o,value:a,isSecret:l??!1}});return[...r,...i]}function OAe(t){const e=d4(VU?window.location.href:globalThis.SSR_HOSTNAME||"");t.length===0&&(t=[{url:"/"}]);function n(r){return nG(e,r)}return t.map(r=>({...r,url:n(r.url),description:r.description||""}))}function M0(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];!Md(i)||!i.key||!e.has(i.key)||t[r].merge({value:`$inputs.${i.key}`,active:!0})}}function PV(t,e,n){if(typeof e=="string"){const i=_i(e);i&&n.has(i)&&t.set(e);return}if(!e||typeof e!="object"||Array.isArray(e))return;const r=t;for(const[i,o]of Object.entries(e)){const s=r[i];s&&PV(s,o,n)}}function vAe(t,e,n){if(n.size===0)return;const r=t.get({noproxy:!0});for(const i of e){if(!i.securitySchemeId)continue;const o=r.findIndex(s=>s.securitySchemeId===i.securitySchemeId);o!==-1&&PV(t[o],i,n)}}function yAe(t,e,n){const r=Xw(e.parameters,"in");M0(t.parameters.pathParameters,Rc(r.path,"path",n)),M0(t.parameters.queryParameters,k4(r.query,r.querystring,n)),M0(t.parameters.headers,Rc(r.header,"header",n)),M0(t.parameters.cookies,Rc(r.cookie,"cookie",n)),vAe(t.security,rO(e),aAe(e,n))}function $V(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=bAe(t,e,n);return{operations:r}}function bAe(t,e,n){const r=[];for(const[i,o]of Object.entries(t.paths)){for(const[s,a]of Object.entries(o))s!=="parameters"&&s!=="servers"&&s!=="description"&&s!=="summary"&&s!=="additionalOperations"&&(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(l=>{const{operation:c}=QV(i,s,t,l,e,!1,n);c&&r.push(c)});if(o.additionalOperations)for(const[s,a]of Object.entries(o.additionalOperations))(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(l=>{const{operation:c}=QV(i,s,t,l,e,!0,n);c&&r.push(c)})}return{operations:r}}function QV(t,e,n,r,i,o,s){if(!s)return{operation:null};const a=s(t,e,n);if(!a)return{operation:null};const l=`${n.info.title}/${r}/${a.name}`;return{operation:dle(a,o,i,l)}}const jV=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:o}=nE({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===o}return!1});class xAe{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 wC{static instance=null;static async initialize(e,n){this.close(),this.instance=await wAe(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function wAe(t,e){if(e){const{AiChatSqliteDBStorage:n}=await import("./redocly-openapi-docs.min.AiChatSqliteDBStorage-xPx3J3uK.js"),r=$p.getInstance(),i=new n(r);return new xAe(i)}else throw new Error("Not implemented")}const dd="ai-chat",SC="detail",SAe="title",TV="infinite-history",IV={all:()=>[dd],details:()=>[dd,SC],detail:t=>[dd,SC,t],detailTitle:t=>[dd,SC,t,SAe],infiniteHistories:()=>[dd,TV],infiniteHistory:t=>[dd,TV,t]},kAe=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:o})=>{const s=v.useContext(SR),a=We(),l=ma(),c=v.useRef(e);c.current=e;const d=v.useMemo(async()=>{const p=an()?await rAe(e.storageKey):nAe(e.storageKey);e.layout!=="preview"&&an()&&pp.initialize();const{isInitialized:f}=await s.init(p,e,a);if(e.layout!=="preview"){if(an()){const k=`${p.systemFilesDir}/replay.db`;await $p.initialize(k),await wC.initialize(p,an())}await Ga.initialize(p,an()),await Oo.initialize(an());try{await Oo.getInstance()?.pruneOlderThan(Date.now()-Nge)}catch(k){console.error("Failed to prune step context:",k)}try{const k=await h0e.migrate(p,Ga.getInstance(),an());k.migrated&&a.sendEvent("com.redocly.history.migration",[{...fe("migration","historyMigration","storage"),status:"success",itemCount:k.itemCount}])}catch(k){console.error("History migration failed:",k),a.sendEvent("com.redocly.history.migration",[{...fe("migration","historyMigration","storage"),status:"error",error:k instanceof Error?k.message:"Unknown error"}])}}if(!f)return;if(!n){s.environments.length===0&&s.environments.set(oy);return}const m=bC(n,[]),{operations:g}=$V(n,m,e.convertOperationToReplayValue);if(!g?.length||!g[0].collectionPath?.split("/")?.[0]||(s.apis.set([{id:m,srcType:Gr.FS,...n}]),s.predefinedApiId.set(m),!r&&!i))return;const O=jV(g,r,i),{path:y,method:b}=O?.apiPath||{};if(!O||!y||!b)return;const w=e.convertOperationToReplayValue?.(y,b,n);w&&EV(s,m,w,c.current),$Ae(s,{apiId:m,path:y,method:b,operationId:O.operationId,isAdditionalOperation:O.isAdditionalOperation},w,e.dynamicReplayValues)},[e.storageKey]);v.useEffect(()=>{if(e.layout!=="preview")return l.invalidateQueries({queryKey:Cr.all}),l.invalidateQueries({queryKey:IV.all()}),l.invalidateQueries({queryKey:hp.all}),()=>{Ga.close(),wC.close(),pp.close(),Oo.close(),an()&&$p.close().catch(p=>{console.error("Failed to close SqliteDBConnection:",p)})}},[e.storageKey,e.layout,l]),v.useEffect(()=>{if(!n||!e.convertOperationToReplayValue)return;const p=bC(n,[]),{operations:f}=$V(n,p,e.convertOperationToReplayValue);if(!f?.length)return;const m=jV(f,r,i),{path:g,method:O}=m?.apiPath||{};if(!m||!g||!O)return;const y=e.convertOperationToReplayValue(g,O,n);y&&EV(s,p,y,e)},[e.convertOperationToReplayValue,e.predefinedEnvValues,e.gateEnvironments,e.dynamicReplayValues,e.allowedEnvironments,e.selectedEnvironment,n,r,i]);const h=e.layout==="preview"?null:u.jsx(XRe,{projectPath:e.storageKey});return u.jsx(v.Suspense,{fallback:h,children:u.jsx(CAe,{initStore:d,settings:e,api:n,onLoad:o,children:t})})};function CAe({initStore:t,children:e,settings:n,api:r,onLoad:i}){return v.use(t),Jfe(n,r),v.useEffect(()=>{i?.()},[]),u.jsxs(_e.Fragment,{children:[an()&&u.jsx(PAe,{}),e]},n.storageKey)}function PAe(){return tAe(),null}const EV=(t,e,n,r)=>{const i=t.environments.get({noproxy:!0}),{environments:o,generatedInputs:s,synthesizedEnvironmentNames:a}=hAe(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues,r.gateEnvironments);t.predefinedInputNames.set(s);const{newEnvironments:l,predefinedEnvironmentNames:c,activeEnvName:d}=pAe({envs:o,synthesizedEnvironmentNames:a,existingEnvironments:i,allowedEnvironments:r.allowedEnvironments,selectedEnvironment:r.selectedEnvironment,activeEnvironmentId:t.activeEnvironmentId.get()});t.predefinedEnvironmentNames.set(c),ay(l,t.environments.get({noproxy:!0}))||t.environments.set(l),t.activeEnvironmentId.set(d)},$Ae=(t,e,n,r)=>{const i=t.tabsState.tabs.get().findIndex(({data:o})=>fn(o,De.Step)&&o.draftStep?.operation?.apiId===e.apiId&&o.draftStep?.operation?.path===e.path&&o.draftStep?.operation?.method===e.method);if(i!==-1){const o=t.tabsState.tabs[i],s=o.data.get();if(n&&r&&fn(s,De.Step)){const a=o.data.draftStep.ornull;a&&yAe(a,n,r)}t.tabsState.activeTabIdx.set(i)}else{const o=iS(e,n,r);t.tabsState.tabs.merge([{...o,state:bn.Normal}]),t.tabsState.activeTabIdx.set(t.tabsState.tabs.length-1)}},RV=v.createContext({ReplayGate:null,ReplayTopBarActions:null}),QAe=RV.Provider,jAe=()=>v.useContext(RV);function TAe(t){const{activeEnvironmentId:e}=Fe(),[n,r]=v.useState(),[i,o]=v.useState(),s=v.useMemo(()=>t.predefinedEnvValues||n?IAe(t.predefinedEnvValues,n):void 0,[t.predefinedEnvValues,n]),a=v.useMemo(()=>n?{names:Object.keys(n),baseEnvironment:t.selectedEnvironment}:void 0,[n,t.selectedEnvironment]),l=v.useMemo(()=>({...t,...s&&{predefinedEnvValues:s},...a&&{gateEnvironments:a},...i&&{selectedEnvironment:i}}),[t,s,a,i]),c=v.useCallback((h,p)=>r(f=>({...f,[h]:{...f?.[h],...p}})),[]),d=v.useCallback(h=>{o(h),e.set(h)},[e]);return{mergedSettings:l,setEnvValues:c,setSelectedEnvironment:d}}function IAe(t,e){const n={...t};for(const[r,i]of Object.entries(e??{}))n[r]={...n[r],...i};return n}const AV=v.createContext({renderProjectSelect:()=>null});function EAe(){return v.useContext(AV)}function RAe(){const{environments:t,activeEnvironmentId:e}=Fe(),{sendEvent:n}=We(),r=v.useCallback(o=>{e.set(o),n("com.redocly.environment.management",[{...fe("environment","headerPanelEnvironment"),action:"selected",name:o}])},[e,n]),i=v.useCallback((o,s)=>{const a=t.find(c=>c.name.get()===o);if(!a)return;const l=a.inputs.get();for(const[c,d]of Object.entries(s)){const{value:h,isSecret:p}=xC(d),f=l.findIndex(m=>m.name===c);f!==-1?a.inputs[f].merge({value:h,...p!==void 0&&{isSecret:p}}):a.inputs.merge([{name:c,value:h,isSecret:p??!1}])}},[t]);return{environments:t.get(),activeEnvironment:e.get(),setSelectedEnvironment:r,setEnvironmentValues:i}}function AAe(){const{renderProjectSelect:t}=EAe(),{layout:e,apiId:n}=ar(),{apis:r}=Fe(),{environments:i,activeEnvironment:o,setEnvironmentValues:s,setSelectedEnvironment:a}=RAe(),{ReplayTopBarActions:l}=jAe(),c=r[0]?.get()?.info?.title,d=!t&&e==="overlay"&&c;return u.jsxs(DAe,{children:[t&&u.jsx(DV,{children:u.jsx(t,{})}),d&&u.jsx(DV,{children:u.jsx(MAe,{children:c})}),u.jsxs(zAe,{children:[l&&u.jsx(l,{environments:i,activeEnvironment:o,setEnvironmentValues:s,setSelectedEnvironment:a,apiId:n}),u.jsx(OV,{})]})]})}const DAe=x.div`
6905
6905
  display: flex;
6906
6906
  padding: 0 var(--spacing-xs);
6907
6907
  height: 40px;
@@ -7794,7 +7794,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
7794
7794
  border-right: ${({$isOverlayLayout:t})=>t?"1px solid var(--border-color-secondary)":"none"};
7795
7795
  width: 100%;
7796
7796
  user-select: none;
7797
- `;function oU({children:t}){const{apps:{apiId:e}}=Fe(),{sendEvent:n}=We(),{tabsParams:r}=_0(e.get(),!1),[i,o]=v.useState(r[0]?.key||null),s=v.useCallback(l=>{o(l),n("com.redocly.tab.change",[{...fe("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a={tabsParams:r,activeTab:i,onTabChange:s};return u.jsx(eU.Provider,{value:a,children:t})}function Kze(){const[t,e]=v.useState(()=>{const n=document.documentElement.clientWidth;return sU(n)});return v.useEffect(()=>{const n=()=>{const r=document.documentElement.clientWidth;e(sU(r))};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}function sU(t){return t>=1512?24:t>=1280?28:t>=1024?32:35}const Jze={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},IC=v.createContext(Jze);function EC(){return v.useContext(IC)}const e_e=v.lazy(()=>import("./redocly-openapi-docs.min.AiPanel-DkXOeLs5.js").then(t=>({default:t.AiPanel}))),t_e=20,n_e=25,r_e=40;function i_e({panel:t,panelProps:e}){const[n,r]=v.useState(!1),{layout:i,aiEnabled:o}=ar(),s=Kze(),{isOpen:a,openPanel:l,closePanel:c}=EC(),{panelProps:d,panel:h}=q1(!a),p=o===!0,f=i==="overlay",{onCollapse:m,onExpand:g,...O}=d;return v.useEffect(()=>{a&&h.isCollapsed&&h.expand(),!a&&!h.isCollapsed&&h.collapse()},[h,a]),i==="preview"?u.jsx(D0,{hideTabs:!0}):f?u.jsx(oU,{children:u.jsxs(aU,{direction:"horizontal",autoSaveId:"replay-layout-overlay",children:[u.jsx(kf,{id:"main-panel",defaultSize:75,minSize:55,$isResizing:n,children:u.jsx(D0,{})}),u.jsx(pf,{direction:"vertical",onDragging:r}),u.jsx(kf,{id:"content-panel",defaultSize:30,minSize:s,...e,$isResizing:n,children:u.jsx(iU,{isOverlayLayout:f})}),u.jsx(nU,{panel:t,isOverlayLayout:f})]})}):u.jsx(oU,{children:u.jsxs(aU,{direction:"horizontal",autoSaveId:"replay-layout",children:[u.jsx(nU,{panel:t,isOverlayLayout:f}),u.jsx(kf,{id:"content-panel",defaultSize:30,minSize:s,...e,$isResizing:n,children:u.jsx(iU,{isOverlayLayout:f})}),u.jsx(pf,{direction:"vertical",onDragging:r}),u.jsx(kf,{id:"main-panel",defaultSize:70,minSize:r_e,$isResizing:n,children:u.jsx(D0,{})}),p&&u.jsxs(u.Fragment,{children:[u.jsx(pf,{direction:"vertical",onDragging:r}),u.jsx(kf,{...O,id:"ai-panel",defaultSize:a?n_e:0,collapsedSize:0,minSize:t_e,maxSize:50,$isResizing:n,onCollapse:()=>{m?.(),c()},onExpand:()=>{g?.(),l()},children:u.jsx(v.Suspense,{fallback:null,children:u.jsx(e_e,{})})})]})]})})}const aU=x(_1)`
7797
+ `;function oU({children:t}){const{apps:{apiId:e}}=Fe(),{sendEvent:n}=We(),{tabsParams:r}=_0(e.get(),!1),[i,o]=v.useState(r[0]?.key||null),s=v.useCallback(l=>{o(l),n("com.redocly.tab.change",[{...fe("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a={tabsParams:r,activeTab:i,onTabChange:s};return u.jsx(eU.Provider,{value:a,children:t})}function Kze(){const[t,e]=v.useState(()=>{const n=document.documentElement.clientWidth;return sU(n)});return v.useEffect(()=>{const n=()=>{const r=document.documentElement.clientWidth;e(sU(r))};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}function sU(t){return t>=1512?24:t>=1280?28:t>=1024?32:35}const Jze={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},IC=v.createContext(Jze);function EC(){return v.useContext(IC)}const e_e=v.lazy(()=>import("./redocly-openapi-docs.min.AiPanel-BmK852q6.js").then(t=>({default:t.AiPanel}))),t_e=20,n_e=25,r_e=40;function i_e({panel:t,panelProps:e}){const[n,r]=v.useState(!1),{layout:i,aiEnabled:o}=ar(),s=Kze(),{isOpen:a,openPanel:l,closePanel:c}=EC(),{panelProps:d,panel:h}=q1(!a),p=o===!0,f=i==="overlay",{onCollapse:m,onExpand:g,...O}=d;return v.useEffect(()=>{a&&h.isCollapsed&&h.expand(),!a&&!h.isCollapsed&&h.collapse()},[h,a]),i==="preview"?u.jsx(D0,{hideTabs:!0}):f?u.jsx(oU,{children:u.jsxs(aU,{direction:"horizontal",autoSaveId:"replay-layout-overlay",children:[u.jsx(kf,{id:"main-panel",defaultSize:75,minSize:55,$isResizing:n,children:u.jsx(D0,{})}),u.jsx(pf,{direction:"vertical",onDragging:r}),u.jsx(kf,{id:"content-panel",defaultSize:30,minSize:s,...e,$isResizing:n,children:u.jsx(iU,{isOverlayLayout:f})}),u.jsx(nU,{panel:t,isOverlayLayout:f})]})}):u.jsx(oU,{children:u.jsxs(aU,{direction:"horizontal",autoSaveId:"replay-layout",children:[u.jsx(nU,{panel:t,isOverlayLayout:f}),u.jsx(kf,{id:"content-panel",defaultSize:30,minSize:s,...e,$isResizing:n,children:u.jsx(iU,{isOverlayLayout:f})}),u.jsx(pf,{direction:"vertical",onDragging:r}),u.jsx(kf,{id:"main-panel",defaultSize:70,minSize:r_e,$isResizing:n,children:u.jsx(D0,{})}),p&&u.jsxs(u.Fragment,{children:[u.jsx(pf,{direction:"vertical",onDragging:r}),u.jsx(kf,{...O,id:"ai-panel",defaultSize:a?n_e:0,collapsedSize:0,minSize:t_e,maxSize:50,$isResizing:n,onCollapse:()=>{m?.(),c()},onExpand:()=>{g?.(),l()},children:u.jsx(v.Suspense,{fallback:null,children:u.jsx(e_e,{})})})]})]})})}const aU=x(_1)`
7798
7798
  padding: 0 var(--spacing-xs);
7799
7799
  `,kf=x(Uu)`
7800
7800
  transition-property: ${t=>t.$isResizing?"none":"flex-grow"};
@@ -7804,7 +7804,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
7804
7804
  @media (prefers-reduced-motion: reduce) {
7805
7805
  transition-duration: 0s;
7806
7806
  }
7807
- `,o_e=v.lazy(()=>import("./redocly-openapi-docs.min.AiChatProvider-CDMc3dS6.js").then(t=>({default:t.AiChatProvider}))),s_e=({className:t,renderProjectSelect:e})=>{const{isMobile:n,closeButton:r}=hs(),i=q1(!1),{layout:o,aiEnabled:s}=ar(),{configFileError:a}=Fe(),l=o==="preview",c=s===!0,d=a.get({noproxy:!0}),h=d?u.jsx(zze,{error:d}):null,p=n?h||u.jsx(Pze,{}):u.jsxs(u.Fragment,{children:[!l&&u.jsx(AAe,{}),h||u.jsx(i_e,{panel:i.panel,panelProps:i.panelProps})]});return u.jsxs(u.Fragment,{children:[!n&&!l&&r,u.jsx(l_e,{className:t,isPreviewLayout:l,children:u.jsx(fEe,{onError:f=>console.error(f),children:u.jsx(Dze,{children:u.jsx(Mze,{renderProjectSelect:e,children:c?u.jsx(v.Suspense,{fallback:null,children:u.jsx(o_e,{children:p})}):p})})})})]})};function a_e({className:t,renderProjectSelect:e}){return u.jsx(s_e,{className:t,renderProjectSelect:e})}const l_e=x.div`
7807
+ `,o_e=v.lazy(()=>import("./redocly-openapi-docs.min.AiChatProvider-C_KLy-F0.js").then(t=>({default:t.AiChatProvider}))),s_e=({className:t,renderProjectSelect:e})=>{const{isMobile:n,closeButton:r}=hs(),i=q1(!1),{layout:o,aiEnabled:s}=ar(),{configFileError:a}=Fe(),l=o==="preview",c=s===!0,d=a.get({noproxy:!0}),h=d?u.jsx(zze,{error:d}):null,p=n?h||u.jsx(Pze,{}):u.jsxs(u.Fragment,{children:[!l&&u.jsx(AAe,{}),h||u.jsx(i_e,{panel:i.panel,panelProps:i.panelProps})]});return u.jsxs(u.Fragment,{children:[!n&&!l&&r,u.jsx(l_e,{className:t,isPreviewLayout:l,children:u.jsx(fEe,{onError:f=>console.error(f),children:u.jsx(Dze,{children:u.jsx(Mze,{renderProjectSelect:e,children:c?u.jsx(v.Suspense,{fallback:null,children:u.jsx(o_e,{children:p})}):p})})})})]})};function a_e({className:t,renderProjectSelect:e}){return u.jsx(s_e,{className:t,renderProjectSelect:e})}const l_e=x.div`
7808
7808
  display: flex;
7809
7809
  flex-direction: column;
7810
7810
  height: 100vh;