@redocly/replay 0.25.0-next.5 → 0.25.0-next.6

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.
@@ -115,7 +115,7 @@ Repeats of \`in:${r.in}\` + \`name:${r.name}\`.`,location:o.PathItem.child(["par
115
115
  ${y}`,location:g,reference:"https://redocly.com/docs/cli/rules/oas/component-name-unique"};m&&(v.forceSeverity=m),l.report(v)}}})}}};return t.schemas!="off"&&(n.NamedSchemas={Schema(a,{location:l}){s(cj,l)}}),t.responses!="off"&&(n.NamedResponses={Response(a,{location:l}){s(dj,l)}}),t.parameters!="off"&&(n.NamedParameters={Parameter(a,{location:l}){s(uj,l)}}),t.requestBodies!="off"&&(n.NamedRequestBodies={RequestBody(a,{location:l}){s(pj,l)}}),n;function i(a){const l=a.split("/").slice(-1)[0];return l.endsWith(".yml")||l.endsWith(".yaml")||l.endsWith(".json")?l.slice(0,l.lastIndexOf(".")):l}function o(a,l,c){const u=KDe(a,l),d=e.get(u)??{absolutePointers:new Set,locations:[]},p=c.absolutePointer.toString();d.absolutePointers.has(p)||(d.absolutePointers.add(p),d.locations.push(c)),e.set(u,d)}function s(a,l){const c=i(l.absolutePointer.toString());o(a,c,l)}};function JDe(t){return YDe[t]??null}function KDe(t,e){return`${t}/${e}`}function eQe(t){const[e,r]=t.split("/");return{typeName:e,componentName:r}}const tQe=()=>({Root(t,{report:e,location:r}){if(!t.hasOwnProperty("servers")){e({message:"Servers must be present.",location:r.child(["openapi"]).key(),reference:"https://redocly.com/docs/cli/rules/oas/no-empty-servers"});return}(!Array.isArray(t.servers)||t.servers.length===0)&&e({message:"Servers must be a non-empty array.",location:r.child(["servers"]).key(),reference:"https://redocly.com/docs/cli/rules/oas/no-empty-servers"})}}),rQe=()=>({Example(t,{report:e,location:r}){t.value&&t.externalValue&&e({message:"Example object can have either `value` or `externalValue` fields.",location:r.child(["value"]).key(),reference:"https://redocly.com/docs/cli/rules/oas/no-example-value-and-externalValue"})}}),nQe=t=>{const e=n=>n.schema===void 0,r=n=>(i,o)=>{const{location:s,resolve:a}=o;if(Bf(i.example))l(i.example,s.child("example"));else if(vt(i.examples))for(const c of Object.keys(i.examples))l(i.examples[c],s.child(["examples",c,"value"]),!0);function l(c,u,d){if(ni(c)){const p=a(c);if(!p.location)return;u=d?p.location.child("value"):p.location,c=p.node}d&&typeof c?.value>"u"||cb({example:d?c.value:c,schema:i.schema,options:{location:u,ctx:o,allowAdditionalProperties:!!t.allowAdditionalProperties,ajvContext:n},reference:"https://redocly.com/docs/cli/rules/oas/no-invalid-media-type-examples"})}};return{Parameter:{MediaType:{skip:e,leave:r({apiContext:"request"})}},RequestBody:{MediaType:{skip:e,leave:r({apiContext:"request"})}},Response:{MediaType:{skip:e,leave:r({apiContext:"response"})}}}},iQe=()=>({Server(t,{report:e,location:r}){const n=/^(.*[\/.])?(example\.com|localhost)([\/:?].*|$)/;t.url&&n.test(t.url)&&e({message:"Server `url` should not point to example.com or localhost.",location:r.child(["url"]),reference:"https://redocly.com/docs/cli/rules/oas/no-server-example-com"})}}),oQe=()=>({Server(t,{report:e,location:r}){t.url&&t.url.endsWith("/")&&t.url!=="/"&&e({message:"Server `url` should not have a trailing slash.",location:r.child(["url"]),reference:"https://redocly.com/docs/cli/rules/oas/no-server-trailing-slash"})}}),sQe=()=>({Root(t,{report:e,location:r}){if(!t.servers||t.servers.length===0)return;const n=[];if(Array.isArray(t.servers))for(const i of t.servers){const o=UV(i);o&&n.push(...o)}else{const i=UV(t.servers);if(!i)return;n.push(...i)}for(const i of n)i==="empty"&&e({message:"Server variable with `enum` must be a non-empty array.",location:r.child(["servers"]).key(),reference:"https://redocly.com/docs/cli/rules/oas/no-server-variables-empty-enum"}),i==="invalidDefaultValue"&&e({message:"Server variable define `enum` and `default`. `enum` must include default value",location:r.child(["servers"]).key(),reference:"https://redocly.com/docs/cli/rules/oas/no-server-variables-empty-enum"})}});function UV(t){if(t.variables&&Object.keys(t.variables).length===0)return;const e=[];for(const r in t.variables){const n=t.variables[r];if(!n.enum||(Array.isArray(n.enum)&&n.enum?.length===0&&e.push("empty"),!n.default))continue;const i=t.variables[r].default;n.enum&&!n.enum.includes(i)&&e.push("invalidDefaultValue")}if(e.length)return e}const aQe=()=>({Server(t,{report:e,location:r}){if(!t?.url)return;const n=t.url.match(/{[^}]+}/g)?.map(o=>o.slice(1,o.length-1))||[],i=t?.variables&&Object.keys(t.variables)||[];for(const o of n)i.includes(o)||e({message:`The \`${o}\` variable is not defined in the \`variables\` objects.`,location:r.child(["url"]),reference:"https://redocly.com/docs/cli/rules/oas/no-undefined-server-variable"});for(const o of i)n.includes(o)||e({message:`The \`${o}\` variable is not used in the server's \`url\` field.`,location:r.child(["variables",o]).key(),from:r.child("url"),reference:"https://redocly.com/docs/cli/rules/oas/no-undefined-server-variable"})}}),lQe=()=>{const t=new Map,e=new Map,r=new Set;function n(i,o,s=!1){t.set(i.absolutePointer,{used:t.get(i.absolutePointer)?.used||!1,referencesDiscriminator:s,location:i,name:o})}return{ref(i,{type:o,resolve:s,key:a,location:l}){if(["Schema","Header","Parameter","Response","Example","RequestBody","MediaTypesMap"].includes(o.name)){const c=s(i);if(!c.location)return;t.set(c.location.absolutePointer,{used:!0,name:a.toString(),location:l})}},Root:{leave(i,{report:o}){t.forEach(s=>{!s.used&&!s.referencesDiscriminator&&o({message:`Component: "${s.name}" is never used.`,location:s.location.key(),reference:"https://redocly.com/docs/cli/rules/oas/no-unused-components"})}),e.forEach((s,a)=>{r.has(a)||o({message:`Security scheme: "${a}" is never used.`,location:s.key(),reference:"https://redocly.com/docs/cli/rules/oas/no-unused-components"})})}},NamedSchemas:{Schema(i,{location:o,key:s,resolve:a}){const l=i.allOf?.some(c=>ni(c)&&a(c)?.node?.discriminator);n(o,s.toString(),l)}},NamedParameters:{Parameter(i,{location:o,key:s}){n(o,s.toString())}},NamedResponses:{Response(i,{location:o,key:s}){n(o,s.toString())}},NamedExamples:{Example(i,{location:o,key:s}){n(o,s.toString())}},NamedRequestBodies:{RequestBody(i,{location:o,key:s}){n(o,s.toString())}},NamedHeaders:{Header(i,{location:o,key:s}){n(o,s.toString())}},NamedMediaTypes:{MediaTypesMap(i,{location:o,key:s}){n(o,s.toString())}},NamedSecuritySchemes:{SecurityScheme(i,{rawLocation:o,key:s}){e.set(s.toString(),o)}},SecurityRequirement(i){for(const o of Object.keys(i))r.add(o)}}},cQe=()=>({Schema:{leave(t,e){"nullable"in t&&!("type"in t)&&e.report({message:"The `type` field must be defined when the `nullable` field is used.",location:e.location.child(["nullable"]),reference:"https://redocly.com/docs/cli/rules/oas/nullable-type-sibling"})}}}),uQe=()=>({Response:{skip(t,e){return!/4[Xx0-9]{2}/.test(`${e}`)},enter(t,{report:e,location:r}){(!t.content||!t.content["application/problem+json"])&&e({message:"Response `4xx` must have content-type `application/problem+json`.",location:r.key(),reference:"https://redocly.com/docs/cli/rules/oas/operation-4xx-problem-details-rfc7807"})},MediaType:{skip(t,e){return e!=="application/problem+json"},enter(t,e){sp({fieldName:"schema",value:t,ctx:e,reference:"https://redocly.com/docs/cli/rules/oas/operation-4xx-problem-details-rfc7807"})},SchemaProperties(t,e){sp({fieldName:"type",value:t,ctx:e,reference:"https://redocly.com/docs/cli/rules/oas/operation-4xx-problem-details-rfc7807"}),sp({fieldName:"title",value:t,ctx:e,reference:"https://redocly.com/docs/cli/rules/oas/operation-4xx-problem-details-rfc7807"})}}}}),dQe=({allowedValues:t})=>({Paths:{RequestBody:{leave(e,r){fg({type:"consumes",value:e,ctx:r,allowedValues:t,reference:"https://redocly.com/docs/cli/rules/oas/request-mime-type"})}},Callback:{RequestBody(){},Response:{leave(e,r){fg({type:"consumes",value:e,ctx:r,allowedValues:t,reference:"https://redocly.com/docs/cli/rules/oas/request-mime-type"})}}}},WebhooksMap:{Response:{leave(e,r){fg({type:"consumes",value:e,ctx:r,allowedValues:t,reference:"https://redocly.com/docs/cli/rules/oas/request-mime-type"})}}}}),pQe=t=>{const e=t.names||{};let r;return{Operation:{Response:{skip:(n,i)=>`${i}`=="204",enter:(n,i)=>{r=i.key},MediaType:{Schema(n,{report:i,location:o}){if(n.type!=="object")return;const s=e[r]||e[Dg(r)]||e[Dg(r).toLowerCase()]||[];for(const a of s)n.properties?.[a]||i({message:`Response object must contain a top-level "${a}" property.`,location:o.child("properties").key(),reference:"https://redocly.com/docs/cli/rules/oas/response-contains-property"})}}}}}},fQe=({allowedValues:t})=>({Paths:{Response:{leave(e,r){fg({type:"produces",value:e,ctx:r,allowedValues:t,reference:"https://redocly.com/docs/cli/rules/oas/response-mime-type"})}},Callback:{Response(){},RequestBody:{leave(e,r){fg({type:"produces",value:e,ctx:r,allowedValues:t,reference:"https://redocly.com/docs/cli/rules/oas/response-mime-type"})}}}},WebhooksMap:{RequestBody:{leave(e,r){fg({type:"produces",value:e,ctx:r,allowedValues:t,reference:"https://redocly.com/docs/cli/rules/oas/response-mime-type"})}}}}),hQe=()=>{const t="^[a-zA-Z0-9\\.\\-_]+$";function e(r,n,i,o){new RegExp(t).test(r)||n({message:`The map key in ${o} "${r}" does not match the regular expression "${t}"`,location:i.key(),reference:"https://redocly.com/docs/cli/rules/oas/spec-components-invalid-map-name"})}return{NamedSchemas:{Schema(r,{key:n,report:i,location:o}){e(n,i,o,"schemas")}},NamedParameters:{Parameter(r,{key:n,report:i,location:o}){e(n,i,o,"parameters")}},NamedResponses:{Response(r,{key:n,report:i,location:o}){e(n,i,o,"responses")}},NamedExamples:{Example(r,{key:n,report:i,location:o}){e(n,i,o,"examples")}},NamedRequestBodies:{RequestBody(r,{key:n,report:i,location:o}){e(n,i,o,"requestBodies")}},NamedHeaders:{Header(r,{key:n,report:i,location:o}){e(n,i,o,"headers")}},NamedSecuritySchemes:{SecurityScheme(r,{key:n,report:i,location:o}){e(n,i,o,"securitySchemes")}},NamedLinks:{Link(r,{key:n,report:i,location:o}){e(n,i,o,"links")}},NamedCallbacks:{Callback(r,{key:n,report:i,location:o}){e(n,i,o,"callbacks")}}}},mQe=()=>{let t=[];return{Root:{enter(e){t=Object.keys(e.components?.schemas||{})}},Schema:{leave(e,r){const n=e.discriminator?.propertyName;if(!n)return;const i=e.discriminator?.defaultMapping;if(i===void 0){const o=new Set,s=(a,l)=>{const c=aj(a,r,l);return!!(!c.schema||o.has(c.schema)||(o.add(c.schema),c.schema.required?.includes(n)||c.schema.allOf?.some(u=>s(u,c.location))||c.schema.oneOf?.every(u=>s(u,c.location))||c.schema.anyOf?.every(u=>s(u,c.location))))};s(e)||r.report({message:`Discriminator with optional property '${n}' must include a defaultMapping field.`,location:r.location.child("discriminator"),reference:"https://redocly.com/docs/cli/rules/oas/spec-discriminator-defaultMapping"})}else r.resolve({$ref:i}).node===void 0&&!t.includes(i)&&r.report({message:`defaultMapping value '${i}' does not point to an existing schema component.`,location:r.location.child(["discriminator","defaultMapping"]),reference:"https://redocly.com/docs/cli/rules/oas/spec-discriminator-defaultMapping"})}}}},gQe=()=>({Example({value:t,externalValue:e,dataValue:r,serializedValue:n},{report:i,location:o}){t!==void 0&&e!==void 0&&i({message:"The 'value' and 'externalValue' fields of an example object are mutually exclusive.",location:o,reference:"https://redocly.com/docs/cli/rules/oas/spec-example-values"}),n!==void 0&&e!==void 0&&i({message:"The 'serializedValue' and 'externalValue' fields of an example object are mutually exclusive.",location:o,reference:"https://redocly.com/docs/cli/rules/oas/spec-example-values"}),t!==void 0&&r!==void 0&&i({message:"The 'value' filed must be absent if 'dataValue' is present in an example object.",location:o.child("value").key(),reference:"https://redocly.com/docs/cli/rules/oas/spec-example-values"}),t!==void 0&&n!==void 0&&i({message:"The 'value' filed must be absent if 'serializedValue' is present in an example object.",location:o.child("value").key(),reference:"https://redocly.com/docs/cli/rules/oas/spec-example-values"})}}),yQe=()=>({MediaType:{leave(t,e){("prefixEncoding"in t&&"encoding"in t||"itemEncoding"in t&&"encoding"in t)&&e.report({message:"The 'encoding' field cannot be used together with 'prefixEncoding' or 'itemEncoding'.",location:e.location.child("encoding").key(),reference:"https://redocly.com/docs/cli/rules/oas/spec-no-invalid-encoding-combinations"})}}}),vQe=()=>{let t;return{Root:{enter(e){t=e.tags??[]}},Tag:{leave(e,{report:r,location:n}){if(e?.parent===void 0)return;if(!t.find(s=>s.name===e.parent)){r({message:`Tag parent '${e.parent}' is not defined in the API description.`,location:n.child("parent"),reference:"https://redocly.com/docs/cli/rules/oas/spec-no-invalid-tag-parents"});return}const i=new Set(e.name);let o=e.parent;for(;o!==void 0;){if(i.has(o)){r({message:`Circular reference detected in tag parent hierarchy for tag '${e.name}'.`,location:n.child("parent"),reference:"https://redocly.com/docs/cli/rules/oas/spec-no-invalid-tag-parents"});return}i.add(o),o=t.find(s=>s.name===o)?.parent}}}}};function VV(t){return t.filter(e=>!("$ref"in e)&&e.in==="querystring").length}function FV(t,e){const r=e.location.child("parameters");t>1&&e.report({message:"Parameters with `in: querystring` should be defined only once per path/operation parameter set.",location:r,reference:"https://redocly.com/docs/cli/rules/oas/spec-querystring-parameters"})}function BV(t,e,r,n){if(t.in==="query"){r.querystringLocation&&n.report({message:"Parameters with `in: query` cannot be used together with `in: querystring` in the same operation/path parameter set.",location:e,reference:"https://redocly.com/docs/cli/rules/oas/spec-querystring-parameters"}),r.queryLocation??=e;return}t.in==="querystring"&&(r.queryLocation&&n.report({message:"Parameters with `in: querystring` cannot be used together with `in: query` in the same operation/path parameter set.",location:e,reference:"https://redocly.com/docs/cli/rules/oas/spec-querystring-parameters"}),r.querystringLocation??=e)}const OQe=()=>{let t={},e={},r=0;return{PathItem:{enter(n,i){t={},e={},r=0,FV(VV(n.parameters||[]),i)},Parameter(n,i){BV(n,i.location,t,i),n.in==="querystring"&&(r+=1)},Operation:{enter(n,i){e={...t};const o=r+VV(n.parameters||[]);FV(o,i)},Parameter(n,i){BV(n,i.location,e,i)}}}}},bQe={struct:Ch,"info-contact":Py,"info-license":HQ,"info-license-strict":v$,"operation-2xx-response":koe,"operation-4xx-response":Poe,"operation-4xx-problem-details-rfc7807":uQe,assertions:Sh,"operation-operationId-unique":Toe,"operation-parameters-unique":Eoe,"operation-tag-defined":joe,"no-example-value-and-externalValue":rQe,"no-mixed-number-range-constraints":y$,"no-enum-type-mismatch":I0,"no-path-trailing-slash":Coe,"no-empty-servers":tQe,"path-declaration-must-exist":Moe,"operation-operationId-url-safe":Ioe,"operation-operationId":b$,"operation-summary":Roe,"tags-alphabetical":w$,"no-server-example.com":iQe,"no-server-trailing-slash":oQe,"tag-description":x$,"operation-description":$oe,"no-unused-components":lQe,"path-not-include-query":Qoe,"path-parameters-defined":EC,"path-params-defined":EC,"parameter-description":Noe,"operation-singular-tag":Aoe,"security-defined":Xoe,"no-unresolved-refs":_h,"paths-kebab-case":Foe,"boolean-parameter-prefixes":GDe,"path-http-verbs-order":Doe,"no-invalid-media-type-examples":nQe,"no-identical-paths":woe,"no-ambiguous-paths":Ooe,"no-undefined-server-variable":aQe,"no-server-variables-empty-enum":sQe,"no-http-verbs-in-paths":xoe,"request-mime-type":dQe,"response-mime-type":fQe,"path-segment-plural":Voe,"no-invalid-schema-examples":_oe,"no-invalid-parameter-examples":Soe,"response-contains-header":Woe,"response-contains-property":pQe,"scalar-property-missing-example":Zoe,"spec-components-invalid-map-name":hQe,"required-string-property-missing-min-length":Boe,"spec-strict-refs":Goe,"component-name-unique":HDe,"array-parameter-serialization":ZDe,"no-required-schema-properties-undefined":E0,"no-schema-type-mismatch":A0,"no-duplicated-tag-names":O$,"nullable-type-sibling":cQe,"spec-no-invalid-tag-parents":vQe,"spec-no-invalid-encoding-combinations":yQe,"spec-discriminator-defaultMapping":mQe,"spec-example-values":gQe,"spec-querystring-parameters":OQe},xQe={},wQe=()=>{const t=new Map;function e(r,n){t.set(r.absolutePointer,{used:t.get(r.absolutePointer)?.used||!1,location:r,name:n})}return{ref(r,{type:n,resolve:i,key:o,location:s}){if(["Schema","ContentDescriptor","Example","Link","ErrorObject","ExamplePairing","Tag"].includes(n.name)){const a=i(r);if(!a.location)return;t.set(a.location.absolutePointer,{used:!0,name:o.toString(),location:s})}},Root:{leave(r,{report:n}){t.forEach(i=>{i.used||n({message:`Component: "${i.name}" is never used.`,location:i.location.key(),reference:"https://redocly.com/docs/cli/rules/oas/no-unused-components"})})}},NamedSchemas:{Schema(r,{location:n,key:i}){e(n,i.toString())}},NamedContentDescriptors:{ContentDescriptor(r,{location:n,key:i}){e(n,i.toString())}},NamedExamples:{Example(r,{location:n,key:i}){e(n,i.toString())}},NamedLinks:{Link(r,{location:n,key:i}){e(n,i.toString())}},NamedErrors:{ErrorObject(r,{location:n,key:i}){e(n,i.toString())}},NamedExamplePairingObjects:{ExamplePairing(r,{location:n,key:i}){e(n,i.toString())}},NamedTags:{Tag(r,{location:n,key:i}){e(n,i.toString())}}}},SQe=()=>({Method:{leave(t,{report:e,resolve:r,location:n}){if(!t.params||!Array.isArray(t.params))return;const i=new Set;t.params.forEach((o,s)=>{const a=r(o);if(!a.node)return;const l=a.node,c=l.name;c&&(i.has(c)&&e({message:`Parameter names must be unique. Duplicate parameter name '${l.name}' found.`,location:n.child([s,"name"]),reference:"https://redocly.com/docs/cli/rules/openrpc/spec-no-duplicated-method-params"}),i.add(c))})}}}),_Qe=()=>({Method:{leave(t,{report:e,resolve:r,location:n}){if(!t.params||!Array.isArray(t.params))return;let i=!1;t.params.forEach((o,s)=>{const a=r(o);if(!a.node)return;const l=a.node;if(!l.name)return;l.required===!0?i&&e({message:`Required parameter '${l.name}' must be positioned before optional parameters.`,location:n.child([s,"name"]),reference:"https://redocly.com/docs/cli/rules/openrpc/spec-no-required-params-after-optional"}):i=!0})}}}),CQe={struct:Ch,"no-unresolved-refs":_h,assertions:Sh,"info-license":HQ,"no-unused-components":wQe,"info-contact":Py,"spec-no-duplicated-method-params":SQe,"spec-no-required-params-after-optional":_Qe},kQe={},PQe={"info-contact":Py,struct:Ch,"no-unresolved-refs":_h,assertions:Sh},$Qe={},TQe={rules:{struct:"error","no-unresolved-refs":"error"},oas2Rules:{"boolean-parameter-prefixes":"error","info-contact":"error","info-license":"error","info-license-strict":"error","no-path-trailing-slash":"error","no-identical-paths":"error","no-ambiguous-paths":"error","no-invalid-schema-examples":"error","no-invalid-parameter-examples":"error","no-http-verbs-in-paths":"error","no-enum-type-mismatch":"error","no-required-schema-properties-undefined":"error","no-schema-type-mismatch":"error","operation-summary":"error","operation-operationId":"error","operation-operationId-unique":"error","operation-operationId-url-safe":"error","operation-description":"error","operation-2xx-response":"error","operation-4xx-response":"error","operation-parameters-unique":"error","operation-tag-defined":"error","operation-singular-tag":"error","parameter-description":"error","path-declaration-must-exist":"error","path-not-include-query":"error","path-parameters-defined":"error","paths-kebab-case":"error","path-http-verbs-order":"error","path-params-defined":"error","path-segment-plural":"error","required-string-property-missing-min-length":"error","response-contains-header":"error","request-mime-type":{severity:"error",allowedValues:["application/json"]},"response-mime-type":{severity:"error",allowedValues:["application/json"]},"response-contains-property":"error","security-defined":"error","spec-strict-refs":"error","scalar-property-missing-example":"error","tag-description":"error","tags-alphabetical":"error","no-duplicated-tag-names":"error"},oas3_0Rules:{"array-parameter-serialization":"error","boolean-parameter-prefixes":"error","component-name-unique":"error","info-contact":"error","info-license":"error","info-license-strict":"error","no-path-trailing-slash":"error","no-identical-paths":"error","no-ambiguous-paths":"error","no-invalid-schema-examples":"error","no-invalid-parameter-examples":"error","no-http-verbs-in-paths":"error","no-enum-type-mismatch":"error","no-required-schema-properties-undefined":"error","no-schema-type-mismatch":"error","no-invalid-media-type-examples":"error","no-server-example.com":"error","no-server-trailing-slash":"error","no-empty-servers":"error","no-example-value-and-externalValue":"error","no-unused-components":"error","no-undefined-server-variable":"error","no-server-variables-empty-enum":"error","nullable-type-sibling":"error","operation-summary":"error","operation-operationId":"error","operation-operationId-unique":"error","operation-operationId-url-safe":"error","operation-description":"error","operation-2xx-response":"error","operation-4xx-response":"error","operation-4xx-problem-details-rfc7807":"error","operation-parameters-unique":"error","operation-tag-defined":"error","operation-singular-tag":"error","parameter-description":"error","path-declaration-must-exist":"error","path-not-include-query":"error","path-parameters-defined":"error","paths-kebab-case":"error","path-http-verbs-order":"error","path-params-defined":"error","path-segment-plural":"error","required-string-property-missing-min-length":"error","response-contains-header":"error","request-mime-type":{severity:"error",allowedValues:["application/json"]},"response-mime-type":{severity:"error",allowedValues:["application/json"]},"response-contains-property":"error","security-defined":"error","spec-strict-refs":"error","scalar-property-missing-example":"error","spec-components-invalid-map-name":"error","tag-description":"error","tags-alphabetical":"error","no-duplicated-tag-names":"error","spec-example-values":"error"},oas3_1Rules:{"array-parameter-serialization":"error","boolean-parameter-prefixes":"error","component-name-unique":"error","info-contact":"error","info-license":"error","info-license-strict":"error","no-path-trailing-slash":"error","no-identical-paths":"error","no-ambiguous-paths":"error","no-invalid-schema-examples":"error","no-invalid-parameter-examples":"error","no-http-verbs-in-paths":"error","no-enum-type-mismatch":"error","no-required-schema-properties-undefined":"error","no-schema-type-mismatch":"error","no-invalid-media-type-examples":"error","no-mixed-number-range-constraints":"error","no-server-example.com":"error","no-server-trailing-slash":"error","no-empty-servers":"error","no-example-value-and-externalValue":"error","no-unused-components":"error","no-undefined-server-variable":"error","no-server-variables-empty-enum":"error","parameter-description":"error","path-declaration-must-exist":"error","path-not-include-query":"error","path-parameters-defined":"error","paths-kebab-case":"error","path-http-verbs-order":"error","path-params-defined":"error","path-segment-plural":"error","operation-summary":"error","operation-operationId":"error","operation-operationId-unique":"error","operation-operationId-url-safe":"error","operation-description":"error","operation-2xx-response":"error","operation-4xx-response":"error","operation-4xx-problem-details-rfc7807":"error","operation-parameters-unique":"error","operation-tag-defined":"error","operation-singular-tag":"error","required-string-property-missing-min-length":"error","response-contains-header":"error","request-mime-type":{severity:"error",allowedValues:["application/json"]},"response-mime-type":{severity:"error",allowedValues:["application/json"]},"response-contains-property":"error","security-defined":"error","spec-strict-refs":"error","scalar-property-missing-example":"error","spec-components-invalid-map-name":"error","tag-description":"error","tags-alphabetical":"error","no-duplicated-tag-names":"error","spec-example-values":"error"},oas3_2Rules:{"array-parameter-serialization":"error","boolean-parameter-prefixes":"error","component-name-unique":"error","info-contact":"error","info-license":"error","info-license-strict":"error","no-path-trailing-slash":"error","no-identical-paths":"error","no-ambiguous-paths":"error","no-invalid-schema-examples":"error","no-invalid-parameter-examples":"error","no-http-verbs-in-paths":"error","no-enum-type-mismatch":"error","no-required-schema-properties-undefined":"error","no-schema-type-mismatch":"error","no-invalid-media-type-examples":"error","no-mixed-number-range-constraints":"error","no-server-example.com":"error","no-server-trailing-slash":"error","no-empty-servers":"error","no-unused-components":"error","no-undefined-server-variable":"error","no-server-variables-empty-enum":"error","parameter-description":"error","path-declaration-must-exist":"error","path-not-include-query":"error","path-parameters-defined":"error","paths-kebab-case":"error","path-http-verbs-order":"error","path-params-defined":"error","path-segment-plural":"error","operation-summary":"error","operation-operationId":"error","operation-operationId-unique":"error","operation-operationId-url-safe":"error","operation-description":"error","operation-2xx-response":"error","operation-4xx-response":"error","operation-4xx-problem-details-rfc7807":"error","operation-parameters-unique":"error","operation-tag-defined":"error","operation-singular-tag":"error","required-string-property-missing-min-length":"error","response-contains-header":"error","request-mime-type":{severity:"error",allowedValues:["application/json"]},"response-mime-type":{severity:"error",allowedValues:["application/json"]},"response-contains-property":"error","security-defined":"error","spec-strict-refs":"error","scalar-property-missing-example":"error","spec-components-invalid-map-name":"error","tag-description":"error","tags-alphabetical":"error","no-duplicated-tag-names":"error","spec-no-invalid-tag-parents":"error","spec-no-invalid-encoding-combinations":"error","spec-discriminator-defaultMapping":"error","spec-example-values":"error","spec-querystring-parameters":"error"},async2Rules:{"channels-kebab-case":"error","info-contact":"error","info-license-strict":"error","no-channel-trailing-slash":"error","operation-operationId":"error","tag-description":"error","tags-alphabetical":"error","no-duplicated-tag-names":"error","no-required-schema-properties-undefined":"error","no-enum-type-mismatch":"error","no-mixed-number-range-constraints":"error","no-schema-type-mismatch":"error"},async3Rules:{"channels-kebab-case":"error","info-contact":"error","info-license-strict":"error","no-channel-trailing-slash":"error","operation-operationId":"error","tag-description":"error","tags-alphabetical":"error","no-duplicated-tag-names":"error","no-required-schema-properties-undefined":"error","no-enum-type-mismatch":"error","no-mixed-number-range-constraints":"error","no-schema-type-mismatch":"error"},arazzo1Rules:{"criteria-unique":"error","no-criteria-xpath":"off","no-enum-type-mismatch":"error","no-mixed-number-range-constraints":"error","no-required-schema-properties-undefined":"error","no-schema-type-mismatch":"error","no-x-security-both-scheme-and-scheme-name":"off","no-x-security-scheme-name-without-openapi":"off","outputs-defined":"error","parameters-unique":"error","requestBody-replacements-unique":"error","respect-supported-versions":"off","sourceDescription-name-unique":"error","sourceDescription-type":"error","sourceDescriptions-not-empty":"error","step-onFailure-unique":"error","step-onSuccess-unique":"error","stepId-unique":"error","workflow-dependsOn":"error","workflowId-unique":"error","x-security-scheme-name-reference":"off","x-security-scheme-required-values":"off"},overlay1Rules:{"info-contact":"error"},openrpc1Rules:{"info-contact":"error","info-license":"error","no-unused-components":"error","spec-no-duplicated-method-params":"error","spec-no-required-params-after-optional":"error"}},IQe={rules:{struct:"error","no-unresolved-refs":"error"},oas2Rules:{"boolean-parameter-prefixes":"off","info-contact":"off","info-license":"off","info-license-strict":"off","no-ambiguous-paths":"warn","no-duplicated-tag-names":"off","no-enum-type-mismatch":"warn","no-http-verbs-in-paths":"off","no-identical-paths":"warn","no-invalid-parameter-examples":"off","no-invalid-schema-examples":"off","no-path-trailing-slash":"warn","no-required-schema-properties-undefined":"warn","no-schema-type-mismatch":"warn","operation-2xx-response":"warn","operation-4xx-response":"off","operation-description":"off","operation-operationId":"warn","operation-operationId-unique":"warn","operation-operationId-url-safe":"warn","operation-parameters-unique":"warn","operation-singular-tag":"off","operation-summary":"warn","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"warn","path-http-verbs-order":"off","path-not-include-query":"warn","path-params-defined":"off","path-parameters-defined":"warn","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"warn","spec-strict-refs":"off","tag-description":"warn","tags-alphabetical":"off"},oas3_0Rules:{"array-parameter-serialization":"off","boolean-parameter-prefixes":"off","component-name-unique":"off","info-contact":"off","info-license":"off","info-license-strict":"off","no-ambiguous-paths":"warn","no-duplicated-tag-names":"off","no-empty-servers":"warn","no-enum-type-mismatch":"warn","no-example-value-and-externalValue":"warn","no-http-verbs-in-paths":"off","no-identical-paths":"warn","no-invalid-media-type-examples":{severity:"warn",allowAdditionalProperties:!1},"no-invalid-parameter-examples":"off","no-invalid-schema-examples":"off","no-path-trailing-slash":"warn","no-required-schema-properties-undefined":"warn","no-schema-type-mismatch":"warn","no-server-example.com":"warn","no-server-trailing-slash":"error","no-server-variables-empty-enum":"error","no-undefined-server-variable":"warn","no-unused-components":"warn","nullable-type-sibling":"warn","operation-2xx-response":"warn","operation-4xx-problem-details-rfc7807":"off","operation-4xx-response":"off","operation-description":"off","operation-operationId":"warn","operation-operationId-unique":"warn","operation-operationId-url-safe":"warn","operation-parameters-unique":"warn","operation-singular-tag":"off","operation-summary":"warn","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"warn","path-http-verbs-order":"off","path-not-include-query":"warn","path-params-defined":"off","path-parameters-defined":"warn","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"warn","spec-components-invalid-map-name":"warn","spec-example-values":"off","spec-strict-refs":"off","tag-description":"warn","tags-alphabetical":"off"},oas3_1Rules:{"array-parameter-serialization":"off","boolean-parameter-prefixes":"off","component-name-unique":"off","info-contact":"off","info-license":"off","info-license-strict":"off","no-ambiguous-paths":"warn","no-duplicated-tag-names":"off","no-empty-servers":"warn","no-enum-type-mismatch":"warn","no-example-value-and-externalValue":"warn","no-http-verbs-in-paths":"off","no-identical-paths":"warn","no-invalid-media-type-examples":"warn","no-invalid-parameter-examples":"off","no-invalid-schema-examples":"off","no-mixed-number-range-constraints":"off","no-path-trailing-slash":"warn","no-required-schema-properties-undefined":"warn","no-schema-type-mismatch":"warn","no-server-example.com":"warn","no-server-trailing-slash":"error","no-server-variables-empty-enum":"error","no-undefined-server-variable":"warn","no-unused-components":"warn","operation-2xx-response":"warn","operation-4xx-problem-details-rfc7807":"off","operation-4xx-response":"off","operation-description":"off","operation-operationId":"warn","operation-operationId-unique":"warn","operation-operationId-url-safe":"warn","operation-parameters-unique":"warn","operation-singular-tag":"off","operation-summary":"warn","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"warn","path-http-verbs-order":"off","path-not-include-query":"warn","path-params-defined":"off","path-parameters-defined":"warn","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"warn","spec-components-invalid-map-name":"warn","spec-example-values":"off","spec-strict-refs":"off","tag-description":"warn","tags-alphabetical":"off"},oas3_2Rules:{"array-parameter-serialization":"off","boolean-parameter-prefixes":"off","component-name-unique":"off","info-contact":"off","info-license":"off","info-license-strict":"off","no-ambiguous-paths":"warn","no-duplicated-tag-names":"off","no-empty-servers":"warn","no-enum-type-mismatch":"warn","no-http-verbs-in-paths":"off","no-identical-paths":"warn","no-invalid-media-type-examples":"warn","no-invalid-parameter-examples":"off","no-invalid-schema-examples":"off","no-mixed-number-range-constraints":"off","no-path-trailing-slash":"warn","no-required-schema-properties-undefined":"warn","no-schema-type-mismatch":"warn","no-server-example.com":"warn","no-server-trailing-slash":"error","no-server-variables-empty-enum":"error","no-undefined-server-variable":"warn","no-unused-components":"warn","operation-2xx-response":"warn","operation-4xx-problem-details-rfc7807":"off","operation-4xx-response":"off","operation-description":"off","operation-operationId":"warn","operation-operationId-unique":"warn","operation-operationId-url-safe":"warn","operation-parameters-unique":"warn","operation-singular-tag":"off","operation-summary":"warn","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"warn","path-http-verbs-order":"off","path-not-include-query":"warn","path-params-defined":"off","path-parameters-defined":"warn","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"warn","spec-components-invalid-map-name":"warn","spec-discriminator-defaultMapping":"off","spec-example-values":"off","spec-no-invalid-encoding-combinations":"warn","spec-no-invalid-tag-parents":"warn","spec-querystring-parameters":"error","spec-strict-refs":"off","tag-description":"warn","tags-alphabetical":"off"},async2Rules:{"channels-kebab-case":"off","info-contact":"off","info-license-strict":"off","no-channel-trailing-slash":"off","no-duplicated-tag-names":"off","no-enum-type-mismatch":"warn","no-mixed-number-range-constraints":"off","no-required-schema-properties-undefined":"warn","no-schema-type-mismatch":"warn","operation-operationId":"warn","tag-description":"warn","tags-alphabetical":"off"},async3Rules:{"channels-kebab-case":"off","info-contact":"off","info-license-strict":"off","no-channel-trailing-slash":"off","no-duplicated-tag-names":"off","no-enum-type-mismatch":"warn","no-mixed-number-range-constraints":"off","no-required-schema-properties-undefined":"warn","no-schema-type-mismatch":"warn","operation-operationId":"warn","tag-description":"warn","tags-alphabetical":"off"},arazzo1Rules:{"criteria-unique":"off","no-criteria-xpath":"off","no-enum-type-mismatch":"warn","no-mixed-number-range-constraints":"off","no-required-schema-properties-undefined":"warn","no-schema-type-mismatch":"warn","no-x-security-both-scheme-and-scheme-name":"off","no-x-security-scheme-name-without-openapi":"off","outputs-defined":"off","parameters-unique":"off","requestBody-replacements-unique":"off","respect-supported-versions":"off","sourceDescription-name-unique":"off","sourceDescription-type":"off","sourceDescriptions-not-empty":"off","step-onFailure-unique":"off","step-onSuccess-unique":"off","stepId-unique":"error","workflow-dependsOn":"off","workflowId-unique":"error","x-security-scheme-name-reference":"off","x-security-scheme-required-values":"off"},overlay1Rules:{"info-contact":"off"},openrpc1Rules:{"info-contact":"off","info-license":"off","no-unused-components":"off","spec-no-duplicated-method-params":"error","spec-no-required-params-after-optional":"error"}},EQe={rules:{struct:"error","no-unresolved-refs":"error"},oas2Rules:{"boolean-parameter-prefixes":"off","info-contact":"off","info-license":"error","info-license-strict":"error","no-ambiguous-paths":"error","no-duplicated-tag-names":"error","no-enum-type-mismatch":"error","no-http-verbs-in-paths":"off","no-identical-paths":"error","no-invalid-parameter-examples":"error","no-invalid-schema-examples":"error","no-path-trailing-slash":"error","no-required-schema-properties-undefined":"error","no-schema-type-mismatch":"error","operation-2xx-response":"error","operation-4xx-response":"error","operation-description":"off","operation-operationId":"error","operation-operationId-unique":"error","operation-operationId-url-safe":"error","operation-parameters-unique":"error","operation-singular-tag":"off","operation-summary":"error","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"error","path-http-verbs-order":"off","path-not-include-query":"error","path-params-defined":"off","path-parameters-defined":"error","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"error","spec-strict-refs":"off","tag-description":"error","tags-alphabetical":"off"},oas3_0Rules:{"array-parameter-serialization":"off","boolean-parameter-prefixes":"off","component-name-unique":"off","info-contact":"off","info-license":"error","info-license-strict":"error","no-ambiguous-paths":"error","no-duplicated-tag-names":"error","no-empty-servers":"error","no-enum-type-mismatch":"error","no-example-value-and-externalValue":"error","no-http-verbs-in-paths":"off","no-identical-paths":"error","no-invalid-media-type-examples":{severity:"error",allowAdditionalProperties:!1},"no-invalid-parameter-examples":"error","no-invalid-schema-examples":"error","no-path-trailing-slash":"error","no-required-schema-properties-undefined":"error","no-schema-type-mismatch":"error","no-server-example.com":"error","no-server-trailing-slash":"error","no-server-variables-empty-enum":"error","no-undefined-server-variable":"error","no-unused-components":"error","nullable-type-sibling":"error","operation-2xx-response":"error","operation-4xx-problem-details-rfc7807":"off","operation-4xx-response":"error","operation-description":"off","operation-operationId":"error","operation-operationId-unique":"error","operation-operationId-url-safe":"error","operation-parameters-unique":"error","operation-singular-tag":"off","operation-summary":"error","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"error","path-http-verbs-order":"off","path-not-include-query":"error","path-params-defined":"off","path-parameters-defined":"error","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"error","spec-components-invalid-map-name":"error","spec-example-values":"off","spec-strict-refs":"off","tag-description":"error","tags-alphabetical":"off"},oas3_1Rules:{"array-parameter-serialization":"off","boolean-parameter-prefixes":"off","component-name-unique":"off","info-contact":"off","info-license":"error","info-license-strict":"error","no-ambiguous-paths":"error","no-duplicated-tag-names":"error","no-empty-servers":"error","no-enum-type-mismatch":"error","no-example-value-and-externalValue":"error","no-http-verbs-in-paths":"off","no-identical-paths":"error","no-invalid-media-type-examples":"error","no-invalid-parameter-examples":"error","no-invalid-schema-examples":"error","no-mixed-number-range-constraints":"error","no-path-trailing-slash":"error","no-required-schema-properties-undefined":"error","no-schema-type-mismatch":"error","no-server-example.com":"error","no-server-trailing-slash":"error","no-server-variables-empty-enum":"error","no-undefined-server-variable":"error","no-unused-components":"error","operation-2xx-response":"error","operation-4xx-problem-details-rfc7807":"off","operation-4xx-response":"error","operation-description":"off","operation-operationId":"error","operation-operationId-unique":"error","operation-operationId-url-safe":"error","operation-parameters-unique":"error","operation-singular-tag":"off","operation-summary":"error","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"error","path-http-verbs-order":"off","path-not-include-query":"error","path-params-defined":"off","path-parameters-defined":"error","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"error","spec-components-invalid-map-name":"error","spec-example-values":"off","spec-strict-refs":"off","tag-description":"error","tags-alphabetical":"off"},oas3_2Rules:{"array-parameter-serialization":"off","boolean-parameter-prefixes":"off","component-name-unique":"off","info-contact":"off","info-license":"error","info-license-strict":"error","no-ambiguous-paths":"error","no-duplicated-tag-names":"error","no-empty-servers":"error","no-enum-type-mismatch":"error","no-http-verbs-in-paths":"off","no-identical-paths":"error","no-invalid-media-type-examples":"error","no-invalid-parameter-examples":"error","no-invalid-schema-examples":"error","no-mixed-number-range-constraints":"error","no-path-trailing-slash":"error","no-required-schema-properties-undefined":"error","no-schema-type-mismatch":"error","no-server-example.com":"error","no-server-trailing-slash":"error","no-server-variables-empty-enum":"error","no-undefined-server-variable":"error","no-unused-components":"error","operation-2xx-response":"error","operation-4xx-problem-details-rfc7807":"off","operation-4xx-response":"error","operation-description":"off","operation-operationId":"error","operation-operationId-unique":"error","operation-operationId-url-safe":"error","operation-parameters-unique":"error","operation-singular-tag":"off","operation-summary":"error","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"error","path-http-verbs-order":"off","path-not-include-query":"error","path-params-defined":"off","path-parameters-defined":"error","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"error","spec-components-invalid-map-name":"error","spec-discriminator-defaultMapping":"error","spec-example-values":"error","spec-no-invalid-encoding-combinations":"error","spec-no-invalid-tag-parents":"error","spec-querystring-parameters":"error","spec-strict-refs":"off","tag-description":"error","tags-alphabetical":"off"},async2Rules:{"channels-kebab-case":"off","info-contact":"off","info-license-strict":"error","no-channel-trailing-slash":"off","no-duplicated-tag-names":"error","no-enum-type-mismatch":"error","no-mixed-number-range-constraints":"error","no-required-schema-properties-undefined":"error","no-schema-type-mismatch":"error","operation-operationId":"error","tag-description":"error","tags-alphabetical":"off"},async3Rules:{"channels-kebab-case":"off","info-contact":"off","info-license-strict":"error","no-channel-trailing-slash":"off","no-duplicated-tag-names":"error","no-enum-type-mismatch":"error","no-mixed-number-range-constraints":"error","no-required-schema-properties-undefined":"error","no-schema-type-mismatch":"error","operation-operationId":"error","tag-description":"error","tags-alphabetical":"off"},arazzo1Rules:{"criteria-unique":"error","no-criteria-xpath":"off","no-enum-type-mismatch":"error","no-mixed-number-range-constraints":"error","no-required-schema-properties-undefined":"error","no-schema-type-mismatch":"error","no-x-security-both-scheme-and-scheme-name":"off","no-x-security-scheme-name-without-openapi":"off","outputs-defined":"error","parameters-unique":"error","requestBody-replacements-unique":"error","respect-supported-versions":"off","sourceDescription-name-unique":"error","sourceDescription-type":"error","sourceDescriptions-not-empty":"error","step-onFailure-unique":"error","step-onSuccess-unique":"error","stepId-unique":"error","workflow-dependsOn":"error","workflowId-unique":"error","x-security-scheme-name-reference":"off","x-security-scheme-required-values":"off"},overlay1Rules:{"info-contact":"off"},openrpc1Rules:{"info-contact":"off","info-license":"error","no-unused-components":"error","spec-no-duplicated-method-params":"error","spec-no-required-params-after-optional":"error"}},AQe={rules:{struct:"error","no-unresolved-refs":"error"},oas2Rules:{"boolean-parameter-prefixes":"off","info-contact":"off","info-license":"warn","info-license-strict":"warn","no-ambiguous-paths":"warn","no-duplicated-tag-names":"warn","no-enum-type-mismatch":"error","no-http-verbs-in-paths":"off","no-identical-paths":"error","no-invalid-parameter-examples":"warn","no-invalid-schema-examples":"warn","no-path-trailing-slash":"error","no-required-schema-properties-undefined":"warn","no-schema-type-mismatch":"error","operation-2xx-response":"warn","operation-4xx-response":"warn","operation-description":"off","operation-operationId":"warn","operation-operationId-unique":"error","operation-operationId-url-safe":"error","operation-parameters-unique":"error","operation-singular-tag":"off","operation-summary":"error","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"error","path-http-verbs-order":"off","path-not-include-query":"error","path-params-defined":"off","path-parameters-defined":"error","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"error","spec-strict-refs":"off","tag-description":"warn","tags-alphabetical":"off"},oas3_0Rules:{"array-parameter-serialization":"off","boolean-parameter-prefixes":"off","component-name-unique":"off","info-contact":"off","info-license":"warn","info-license-strict":"warn","no-ambiguous-paths":"warn","no-duplicated-tag-names":"warn","no-empty-servers":"error","no-enum-type-mismatch":"error","no-example-value-and-externalValue":"error","no-http-verbs-in-paths":"off","no-identical-paths":"error","no-invalid-media-type-examples":{severity:"warn",allowAdditionalProperties:!1},"no-invalid-parameter-examples":"warn","no-invalid-schema-examples":"warn","no-path-trailing-slash":"error","no-required-schema-properties-undefined":"warn","no-schema-type-mismatch":"error","no-server-example.com":"warn","no-server-trailing-slash":"error","no-server-variables-empty-enum":"error","no-undefined-server-variable":"error","no-unused-components":"warn","nullable-type-sibling":"error","operation-2xx-response":"warn","operation-4xx-problem-details-rfc7807":"off","operation-4xx-response":"warn","operation-description":"off","operation-operationId":"warn","operation-operationId-unique":"error","operation-operationId-url-safe":"error","operation-parameters-unique":"error","operation-singular-tag":"off","operation-summary":"error","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"error","path-http-verbs-order":"off","path-not-include-query":"error","path-params-defined":"off","path-parameters-defined":"error","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"error","spec-components-invalid-map-name":"error","spec-example-values":"off","spec-strict-refs":"off","tag-description":"warn","tags-alphabetical":"off"},oas3_1Rules:{"array-parameter-serialization":"off","boolean-parameter-prefixes":"off","component-name-unique":"off","info-contact":"off","info-license":"warn","info-license-strict":"warn","no-ambiguous-paths":"warn","no-duplicated-tag-names":"warn","no-empty-servers":"error","no-enum-type-mismatch":"error","no-example-value-and-externalValue":"error","no-http-verbs-in-paths":"off","no-identical-paths":"error","no-invalid-media-type-examples":"warn","no-invalid-parameter-examples":"warn","no-invalid-schema-examples":"warn","no-mixed-number-range-constraints":"warn","no-path-trailing-slash":"error","no-required-schema-properties-undefined":"warn","no-schema-type-mismatch":"error","no-server-example.com":"warn","no-server-trailing-slash":"error","no-server-variables-empty-enum":"error","no-undefined-server-variable":"error","no-unused-components":"warn","operation-2xx-response":"warn","operation-4xx-problem-details-rfc7807":"off","operation-4xx-response":"warn","operation-description":"off","operation-operationId":"warn","operation-operationId-unique":"error","operation-operationId-url-safe":"error","operation-parameters-unique":"error","operation-singular-tag":"off","operation-summary":"error","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"error","path-http-verbs-order":"off","path-not-include-query":"error","path-params-defined":"off","path-parameters-defined":"error","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"error","spec-components-invalid-map-name":"error","spec-example-values":"off","spec-strict-refs":"off","tag-description":"warn","tags-alphabetical":"off"},oas3_2Rules:{"array-parameter-serialization":"off","boolean-parameter-prefixes":"off","component-name-unique":"off","info-contact":"off","info-license":"warn","info-license-strict":"warn","no-ambiguous-paths":"warn","no-duplicated-tag-names":"warn","no-empty-servers":"error","no-enum-type-mismatch":"error","no-http-verbs-in-paths":"off","no-identical-paths":"error","no-invalid-media-type-examples":"warn","no-invalid-parameter-examples":"warn","no-invalid-schema-examples":"warn","no-mixed-number-range-constraints":"warn","no-path-trailing-slash":"error","no-required-schema-properties-undefined":"warn","no-schema-type-mismatch":"error","no-server-example.com":"warn","no-server-trailing-slash":"error","no-server-variables-empty-enum":"error","no-undefined-server-variable":"error","no-unused-components":"warn","operation-2xx-response":"warn","operation-4xx-problem-details-rfc7807":"off","operation-4xx-response":"warn","operation-description":"off","operation-operationId":"warn","operation-operationId-unique":"error","operation-operationId-url-safe":"error","operation-parameters-unique":"error","operation-singular-tag":"off","operation-summary":"error","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"error","path-http-verbs-order":"off","path-not-include-query":"error","path-params-defined":"off","path-parameters-defined":"error","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"error","spec-components-invalid-map-name":"error","spec-discriminator-defaultMapping":"warn","spec-example-values":"error","spec-no-invalid-encoding-combinations":"error","spec-no-invalid-tag-parents":"error","spec-querystring-parameters":"error","spec-strict-refs":"off","tag-description":"warn","tags-alphabetical":"off"},async2Rules:{"channels-kebab-case":"off","info-contact":"off","info-license-strict":"warn","no-channel-trailing-slash":"off","no-duplicated-tag-names":"warn","no-enum-type-mismatch":"error","no-mixed-number-range-constraints":"warn","no-required-schema-properties-undefined":"warn","no-schema-type-mismatch":"error","operation-operationId":"warn","tag-description":"warn","tags-alphabetical":"off"},async3Rules:{"channels-kebab-case":"off","info-contact":"off","info-license-strict":"warn","no-channel-trailing-slash":"off","no-duplicated-tag-names":"warn","no-enum-type-mismatch":"error","no-mixed-number-range-constraints":"warn","no-required-schema-properties-undefined":"warn","no-schema-type-mismatch":"error","operation-operationId":"warn","tag-description":"warn","tags-alphabetical":"off"},arazzo1Rules:{"criteria-unique":"warn","no-criteria-xpath":"off","no-enum-type-mismatch":"error","no-mixed-number-range-constraints":"warn","no-required-schema-properties-undefined":"warn","no-schema-type-mismatch":"error","no-x-security-both-scheme-and-scheme-name":"off","no-x-security-scheme-name-without-openapi":"off","outputs-defined":"warn","parameters-unique":"error","requestBody-replacements-unique":"warn","respect-supported-versions":"off","sourceDescription-name-unique":"error","sourceDescription-type":"error","sourceDescriptions-not-empty":"error","step-onFailure-unique":"warn","step-onSuccess-unique":"warn","stepId-unique":"error","workflow-dependsOn":"error","workflowId-unique":"error","x-security-scheme-name-reference":"off","x-security-scheme-required-values":"off"},overlay1Rules:{"info-contact":"off"},openrpc1Rules:{"info-license":"warn","no-unused-components":"warn","info-contact":"off","spec-no-duplicated-method-params":"error","spec-no-required-params-after-optional":"error"}},RQe={rules:{struct:"error","no-unresolved-refs":"error"},oas2Rules:{"boolean-parameter-prefixes":"off","info-contact":"off","info-license":"off","info-license-strict":"off","no-ambiguous-paths":"off","no-duplicated-tag-names":"error","no-enum-type-mismatch":"off","no-http-verbs-in-paths":"off","no-identical-paths":"error","no-invalid-parameter-examples":"off","no-invalid-schema-examples":"off","no-path-trailing-slash":"off","no-required-schema-properties-undefined":"off","no-schema-type-mismatch":"off","operation-2xx-response":"off","operation-4xx-response":"off","operation-description":"off","operation-operationId":"off","operation-operationId-unique":"error","operation-operationId-url-safe":"off","operation-parameters-unique":"error","operation-singular-tag":"off","operation-summary":"off","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"error","path-http-verbs-order":"off","path-not-include-query":"error","path-params-defined":"off","path-parameters-defined":"error","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"off","spec-strict-refs":"error","tag-description":"off","tags-alphabetical":"off"},oas3_0Rules:{"array-parameter-serialization":"off","boolean-parameter-prefixes":"off","component-name-unique":"off","info-contact":"off","info-license":"off","info-license-strict":"off","no-ambiguous-paths":"off","no-duplicated-tag-names":"error","no-empty-servers":"off","no-enum-type-mismatch":"off","no-example-value-and-externalValue":"error","no-http-verbs-in-paths":"off","no-identical-paths":"error","no-invalid-media-type-examples":{severity:"off",allowAdditionalProperties:!1},"no-invalid-parameter-examples":"off","no-invalid-schema-examples":"off","no-path-trailing-slash":"off","no-required-schema-properties-undefined":"off","no-schema-type-mismatch":"off","no-server-example.com":"off","no-server-trailing-slash":"off","no-server-variables-empty-enum":"off","no-undefined-server-variable":"error","no-unused-components":"off","nullable-type-sibling":"error","operation-2xx-response":"off","operation-4xx-problem-details-rfc7807":"off","operation-4xx-response":"off","operation-description":"off","operation-operationId":"off","operation-operationId-unique":"error","operation-operationId-url-safe":"off","operation-parameters-unique":"error","operation-singular-tag":"off","operation-summary":"off","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"error","path-http-verbs-order":"off","path-not-include-query":"error","path-params-defined":"off","path-parameters-defined":"error","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"off","spec-components-invalid-map-name":"error","spec-example-values":"off","spec-strict-refs":"error","tag-description":"off","tags-alphabetical":"off"},oas3_1Rules:{"array-parameter-serialization":"off","boolean-parameter-prefixes":"off","component-name-unique":"off","info-contact":"off","info-license":"off","info-license-strict":"off","no-ambiguous-paths":"off","no-duplicated-tag-names":"error","no-empty-servers":"off","no-enum-type-mismatch":"off","no-example-value-and-externalValue":"error","no-http-verbs-in-paths":"off","no-identical-paths":"error","no-invalid-media-type-examples":"off","no-invalid-parameter-examples":"off","no-invalid-schema-examples":"off","no-mixed-number-range-constraints":"off","no-path-trailing-slash":"off","no-required-schema-properties-undefined":"off","no-schema-type-mismatch":"off","no-server-example.com":"off","no-server-trailing-slash":"off","no-server-variables-empty-enum":"off","no-undefined-server-variable":"error","no-unused-components":"off","operation-2xx-response":"off","operation-4xx-problem-details-rfc7807":"off","operation-4xx-response":"off","operation-description":"off","operation-operationId":"off","operation-operationId-unique":"error","operation-operationId-url-safe":"off","operation-parameters-unique":"error","operation-singular-tag":"off","operation-summary":"off","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"error","path-http-verbs-order":"off","path-not-include-query":"error","path-params-defined":"off","path-parameters-defined":"error","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"off","spec-components-invalid-map-name":"error","spec-example-values":"off","spec-strict-refs":"error","tag-description":"off","tags-alphabetical":"off"},oas3_2Rules:{"array-parameter-serialization":"off","boolean-parameter-prefixes":"off","component-name-unique":"off","info-contact":"off","info-license":"off","info-license-strict":"off","no-ambiguous-paths":"off","no-duplicated-tag-names":"error","no-empty-servers":"off","no-enum-type-mismatch":"off","no-http-verbs-in-paths":"off","no-identical-paths":"error","no-invalid-media-type-examples":"off","no-invalid-parameter-examples":"off","no-invalid-schema-examples":"off","no-mixed-number-range-constraints":"off","no-path-trailing-slash":"off","no-required-schema-properties-undefined":"off","no-schema-type-mismatch":"off","no-server-example.com":"off","no-server-trailing-slash":"off","no-server-variables-empty-enum":"off","no-undefined-server-variable":"error","no-unused-components":"off","operation-2xx-response":"off","operation-4xx-problem-details-rfc7807":"off","operation-4xx-response":"off","operation-description":"off","operation-operationId":"off","operation-operationId-unique":"error","operation-operationId-url-safe":"off","operation-parameters-unique":"error","operation-singular-tag":"off","operation-summary":"off","operation-tag-defined":"off","parameter-description":"off","path-declaration-must-exist":"error","path-http-verbs-order":"off","path-not-include-query":"error","path-params-defined":"off","path-parameters-defined":"error","path-segment-plural":"off","paths-kebab-case":"off","request-mime-type":"off","required-string-property-missing-min-length":"off","response-contains-header":"off","response-contains-property":"off","response-mime-type":"off","scalar-property-missing-example":"off","security-defined":"off","spec-components-invalid-map-name":"error","spec-discriminator-defaultMapping":"error","spec-example-values":"error","spec-no-invalid-encoding-combinations":"error","spec-no-invalid-tag-parents":"error","spec-querystring-parameters":"error","spec-strict-refs":"error","tag-description":"off","tags-alphabetical":"off"},async2Rules:{"channels-kebab-case":"off","info-contact":"off","info-license-strict":"off","no-channel-trailing-slash":"off","no-duplicated-tag-names":"off","no-enum-type-mismatch":"off","no-mixed-number-range-constraints":"off","no-required-schema-properties-undefined":"off","no-schema-type-mismatch":"off","operation-operationId":"off","tag-description":"off","tags-alphabetical":"off"},async3Rules:{"channels-kebab-case":"off","info-contact":"off","info-license-strict":"off","no-channel-trailing-slash":"off","no-duplicated-tag-names":"off","no-enum-type-mismatch":"off","no-mixed-number-range-constraints":"off","no-required-schema-properties-undefined":"off","no-schema-type-mismatch":"off","operation-operationId":"off","tag-description":"off","tags-alphabetical":"off"},arazzo1Rules:{"criteria-unique":"error","no-criteria-xpath":"off","no-enum-type-mismatch":"off","no-mixed-number-range-constraints":"off","no-required-schema-properties-undefined":"off","no-schema-type-mismatch":"off","no-x-security-both-scheme-and-scheme-name":"off","no-x-security-scheme-name-without-openapi":"off","outputs-defined":"error","parameters-unique":"error","requestBody-replacements-unique":"error","respect-supported-versions":"off","sourceDescription-name-unique":"error","sourceDescription-type":"error","sourceDescriptions-not-empty":"error","step-onFailure-unique":"error","step-onSuccess-unique":"error","stepId-unique":"error","workflow-dependsOn":"error","workflowId-unique":"error","x-security-scheme-name-reference":"off","x-security-scheme-required-values":"off"},overlay1Rules:{"info-contact":"off"},openrpc1Rules:{"info-contact":"off","info-license":"off","no-unused-components":"off","spec-no-duplicated-method-params":"error","spec-no-required-params-after-optional":"error"}},jQe={recommended:AQe,"recommended-strict":EQe,minimal:IQe,all:TQe,spec:RQe},WV={id:"",rules:{oas3:bQe,oas2:BDe,async2:SDe,async3:PDe,arazzo1:ODe,overlay1:PQe,openrpc1:CQe},preprocessors:{oas3:xQe,oas2:WDe,async2:_De,async3:$De,arazzo1:bDe,overlay1:$Qe,openrpc1:kQe},decorators:{oas3:lNe,oas2:oNe,async2:Kje,async3:eNe,arazzo1:Jje,overlay1:uNe,openrpc1:cNe},configs:jQe};function _O(t,e){return t+"::"+e}function NQe(){return new Promise(t=>{setTimeout(t)})}class Qg{absoluteRef;body;mimeType;constructor(e,r,n){this.absoluteRef=e,this.body=r,this.mimeType=n}#e;#t;getAst(e){return this.#e===void 0&&(this.#e=e(this.body,{filename:this.absoluteRef})??void 0,this.#e&&this.#e.kind===0&&this.#e.value===""&&this.#e.startPosition!==1&&(this.#e.startPosition=1,this.#e.endPosition=1)),this.#e}getLines(){return this.#t===void 0&&(this.#t=this.body.split(/\r\n|[\n\r]/g)),this.#t}}class JQ extends Error{originalError;constructor(e){super(e.message),this.originalError=e,Object.setPrototypeOf(this,JQ.prototype)}}function MQe(t,e){const r=new Qg(e,t);try{return{source:r,parsed:BQ(t,{filename:e})}}catch(n){throw new ky(n,r)}}class S${config;cache=new Map;constructor(e={http:{headers:[]}}){this.config=e}getFiles(){return new Set(Array.from(this.cache.keys()))}resolveExternalRef(e,r){return xi(r)?r:e&&xi(e)?new URL(r,e).href:cn.resolve(e?cn.dirname(e):process.cwd(),r)}async loadExternalRef(e){try{if(xi(e)){const{body:r,mimeType:n}=await Bte(e,this.config.http);return new Qg(e,r,n)}else{if((void 0)(e).isDirectory())throw new Error(`Expected a file but received a folder at ${e}.`);const r=await(void 0).readFile(e,"utf-8");return new Qg(e,r.replace(/\r\n/g,`
116
116
  `))}}catch(r){throw r.message=r.message.replace(", lstat",""),new JQ(r)}}parseDocument(e,r=!1){const n=e.absoluteRef.substr(e.absoluteRef.lastIndexOf("."));if(![".json",".json",".yml",".yaml"].includes(n)&&!e.mimeType?.match(/(json|yaml|openapi)/)&&!r)return{source:e,parsed:e.body};try{return{source:e,parsed:BQ(e.body,{filename:e.absoluteRef})}}catch(i){throw new ky(i,e)}}async resolveDocument(e,r,n=!1){const i=this.resolveExternalRef(e,r),o=this.cache.get(i);if(o)return o;const s=this.loadExternalRef(i).then(a=>this.parseDocument(a,n));return this.cache.set(i,s),s}}function ZV(t,e){return{prev:t,node:e}}function DQe(t,e){for(;t;){if(t.node===e)return!0;t=t.prev}return!1}const gv={name:"unknown",properties:{}},QQe={name:"scalar",properties:{}};async function hg(t){const{rootDocument:e,externalRefResolver:r,rootType:n}=t,i=new Map,o=new Set,s=[];l(e.parsed,e,"#/",n);let a;do a=await Promise.all(s);while(s.length!==a.length);return i;function l(c,u,d,p){const f=u.source.absoluteRef,m=new Map;g(c,p,f+d);function g(v,b,O){if(!vt(v)&&!Array.isArray(v))return;const w=`${b.name}::${O}`;if(o.has(w))return;if(o.add(w),Array.isArray(v)){const _=b.items;if(_===void 0&&b!==gv&&b!==Ef)return;const C=typeof _=="function";for(let $=0;$<v.length;$++){let j=C?_(v[$],Ad(O,$)):_;if(j===void 0&&b!==gv&&b!==Ef)continue;const R=j?.directResolveAs?{$ref:v[$]}:v[$];j=j?.directResolveAs||j,g(R,ip(j)?j:gv,Ad(O,$))}return}const[x,S]=Object.entries(v).find(([_])=>_==="$anchor")||[];S&&m.set(`#${S}`,v);for(const _ of Object.keys(v)){let C=v[_],$=Wf(b.properties,_);$===void 0&&($=b.additionalProperties),typeof $=="function"&&($=$(C,_)),$===void 0&&($=gv),b.extensionsPrefix&&_.startsWith(b.extensionsPrefix)&&$===gv&&($=Ef),!ip($)&&$?.directResolveAs&&($=$.directResolveAs,C={$ref:C}),$&&$.name===void 0&&$.resolvable!==!1&&($=QQe),!(!ip($)||!(vt(C)||Array.isArray(C)))&&g(C,$,Ad(O,df(_)))}if(ni(v)){const _=y(u,v,{prev:null,node:v}).then(C=>{C.resolved&&l(C.node,C.document,C.nodePointer,b)});s.push(_)}if(Wte(v)){const _=y(u,{$ref:v.externalValue},{prev:null,node:v}).then(C=>{C.resolved&&l(C.node,C.document,C.nodePointer,b)});s.push(_)}}async function y(v,b,O){if(DQe(O.prev,b))throw new Error("Self-referencing circular pointer");if(sCe(b.$ref)){await NQe();const D={resolved:!0,isRemote:!1,node:m.get(b.$ref),document:v,nodePointer:b.$ref},L=_O(v.source.absoluteRef,b.$ref);return i.set(L,D),D}const{uri:w,pointer:x}=_Q(b.$ref),S=w!==null&&r.resolveExternalRef(v.source.absoluteRef,w)!==v.source.absoluteRef;let _;try{_=S?await r.resolveDocument(v.source.absoluteRef,w):v}catch(D){const L={resolved:!1,isRemote:S,document:void 0,error:D},F=_O(v.source.absoluteRef,b.$ref);return i.set(F,L),L}let C={resolved:!0,document:_,isRemote:S,node:v.parsed,nodePointer:"#/"},$=_.parsed;const j=x;for(const D of j)if(vt($)&&$[D]!==void 0)$=$[D],C.nodePointer=Ad(C.nodePointer,df(D));else if(Array.isArray($)&&$[+D]!==void 0)$=$[+D],C.nodePointer=Ad(C.nodePointer,df(D));else if(ni($))if(C=await y(_,$,ZV(O,$)),_=C.document||_,vt(C.node))$=C.node[D],C.nodePointer=Ad(C.nodePointer,df(D));else if(Array.isArray(C.node))$=C.node[+D],C.nodePointer=Ad(C.nodePointer,df(D));else{$=void 0;break}else{$=void 0;break}C.node=$,C.document=_;const R=_O(v.source.absoluteRef,b.$ref);return C.document&&ni($)&&(C=await y(C.document,$,ZV(O,$))),i.set(R,C),{...C}}}}const LQe={Root:"DefinitionRoot",ServerVariablesMap:"ServerVariableMap",Paths:["PathMap","PathsMap"],CallbacksMap:"CallbackMap",MediaTypesMap:"MediaTypeMap",ExamplesMap:"ExampleMap",EncodingMap:"EncodingsMap",HeadersMap:"HeaderMap",LinksMap:"LinkMap",OAuth2Flows:"SecuritySchemeFlows",Responses:"ResponsesMap"};function Rf(t,e){const r={};r.any={enter:[],leave:[]};for(const s of Object.keys(e))r[s]={enter:[],leave:[]};r.ref={enter:[],leave:[]};for(const{ruleId:s,severity:a,message:l,visitor:c}of t)o({ruleId:s,severity:a,message:l},c,null);for(const s of Object.keys(r))r[s].enter.sort((a,l)=>l.depth-a.depth),r[s].leave.sort((a,l)=>a.depth-l.depth);return r;function n(s,a,l,c,u=[]){if(u.includes(a))return;u=[...u,a];const d=new Set;for(const f of Object.values(a.properties)){if(f===l){p(s,u);continue}vt(f)&&f.name!==void 0&&d.add(f)}a.additionalProperties&&typeof a.additionalProperties!="function"&&(a.additionalProperties===l?p(s,u):a.additionalProperties.name!==void 0&&d.add(a.additionalProperties)),a.items&&typeof a.items!="function"&&(a.items===l?p(s,u):a.items.name!==void 0&&d.add(a.items)),a.extensionsPrefix&&d.add(Ef);for(const f of Array.from(d.values()))n(s,f,l,c,u);function p(f,m){for(const g of m.slice(1))r[g.name]=r[g.name]||{enter:[],leave:[]},r[g.name].enter.push({...f,visit:()=>{},depth:0,context:{isSkippedLevel:!0,seen:new Set,parent:c}})}}function i(s,a){if(Array.isArray(a)){const l=a.find(c=>s[c])||void 0;return l&&s[l]}return s[a]}function o(s,a,l,c=0){const u=Object.keys(e);if(c===0)u.push("any"),u.push("ref");else{if(a.any)throw new Error("any() is allowed only on top level");if(a.ref)throw new Error("ref() is allowed only on top level")}for(const d of u){const p=a[d]||i(a,LQe[d]),f=r[d];if(!p)continue;let m,g,y;const v=vt(p);if(d==="ref"&&v&&p.skip)throw new Error("ref() visitor does not support skip");typeof p=="function"?m=p:v&&(m=p.enter,g=p.leave,y=p.skip);const b=(m?1:0)+(g?1:0)+(y?1:0),O=v&&Object.keys(p).length>b,w={activatedOn:null,type:e[d],parent:l,isSkippedLevel:!1};if(O&&o(s,p,w,c+1),l&&n(s,l.type,e[d],l),m||v){if(m&&typeof m!="function")throw new Error("DEV: should be function");f.enter.push({...s,visit:m||(()=>{}),skip:y,depth:c,context:w})}if(g){if(typeof g!="function")throw new Error("DEV: should be function");f.leave.push({...s,visit:g,depth:c,context:w})}}}}const Zr=(t,e)=>{if(e)for(const r of Object.keys(e))vt(t[r])&&typeof e[r]=="string"?t[r]={...t[r],severity:e[r]}:t[r]=e[r]};function xn(t,e){if(e)for(const r of Object.keys(e))t.hasOwnProperty(r)&&(vt(t[r])&&typeof e[r]=="string"?t[r]={...t[r],severity:e[r]}:t[r]=e[r])}function qQe(t){if(t.indexOf("/")>-1){const[e,r]=t.split("/");return{pluginId:e,configName:r}}else return{pluginId:"",configName:t}}function pi(t,e){if(!e)return t;const r={};for(const n of Object.keys(t))r[`${e}/${n}`]=t[n];return r}function Yoe(t){const e={rules:{},oas2Rules:{},oas3_0Rules:{},oas3_1Rules:{},oas3_2Rules:{},async2Rules:{},async3Rules:{},arazzo1Rules:{},overlay1Rules:{},openrpc1Rules:{},preprocessors:{},oas2Preprocessors:{},oas3_0Preprocessors:{},oas3_1Preprocessors:{},oas3_2Preprocessors:{},async2Preprocessors:{},async3Preprocessors:{},arazzo1Preprocessors:{},overlay1Preprocessors:{},openrpc1Preprocessors:{},decorators:{},oas2Decorators:{},oas3_0Decorators:{},oas3_1Decorators:{},oas3_2Decorators:{},async2Decorators:{},async3Decorators:{},arazzo1Decorators:{},overlay1Decorators:{},openrpc1Decorators:{}};for(const r of t){if(vt(r)&&"extends"in r&&r.extends!==void 0)throw new Error(`'extends' is not supported in shared configs yet:
117
117
  ${JSON.stringify(r,null,2)}`);Zr(e.rules,r.rules),Zr(e.oas2Rules,r.oas2Rules),xn(e.oas2Rules,r.rules),Zr(e.oas3_0Rules,r.oas3_0Rules),xn(e.oas3_0Rules,r.rules),Zr(e.oas3_1Rules,r.oas3_1Rules),xn(e.oas3_1Rules,r.rules),Zr(e.oas3_2Rules,r.oas3_2Rules),xn(e.oas3_2Rules,r.rules),Zr(e.async2Rules,r.async2Rules),xn(e.async2Rules,r.rules),Zr(e.async3Rules,r.async3Rules),xn(e.async3Rules,r.rules),Zr(e.arazzo1Rules,r.arazzo1Rules),xn(e.arazzo1Rules,r.rules),Zr(e.overlay1Rules,r.overlay1Rules),xn(e.overlay1Rules,r.rules),Zr(e.openrpc1Rules,r.openrpc1Rules),xn(e.openrpc1Rules,r.rules),Zr(e.preprocessors,r.preprocessors),Zr(e.oas2Preprocessors,r.oas2Preprocessors),xn(e.oas2Preprocessors,r.preprocessors),Zr(e.oas3_0Preprocessors,r.oas3_0Preprocessors),xn(e.oas3_0Preprocessors,r.preprocessors),Zr(e.oas3_1Preprocessors,r.oas3_1Preprocessors),xn(e.oas3_1Preprocessors,r.preprocessors),Zr(e.oas3_2Preprocessors,r.oas3_2Preprocessors),xn(e.oas3_2Preprocessors,r.preprocessors),Zr(e.async2Preprocessors,r.async2Preprocessors),xn(e.async2Preprocessors,r.preprocessors),Zr(e.async3Preprocessors,r.async3Preprocessors),xn(e.async3Preprocessors,r.preprocessors),Zr(e.arazzo1Preprocessors,r.arazzo1Preprocessors),xn(e.arazzo1Preprocessors,r.preprocessors),Zr(e.overlay1Preprocessors,r.overlay1Preprocessors),xn(e.overlay1Preprocessors,r.preprocessors),Zr(e.openrpc1Preprocessors,r.openrpc1Preprocessors),xn(e.openrpc1Preprocessors,r.preprocessors),Zr(e.decorators,r.decorators),Zr(e.oas2Decorators,r.oas2Decorators),xn(e.oas2Decorators,r.decorators),Zr(e.oas3_0Decorators,r.oas3_0Decorators),xn(e.oas3_0Decorators,r.decorators),Zr(e.oas3_1Decorators,r.oas3_1Decorators),xn(e.oas3_1Decorators,r.decorators),Zr(e.oas3_2Decorators,r.oas3_2Decorators),xn(e.oas3_2Decorators,r.decorators),Zr(e.async2Decorators,r.async2Decorators),xn(e.async2Decorators,r.decorators),Zr(e.async3Decorators,r.async3Decorators),xn(e.async3Decorators,r.decorators),Zr(e.arazzo1Decorators,r.arazzo1Decorators),xn(e.arazzo1Decorators,r.decorators),Zr(e.overlay1Decorators,r.overlay1Decorators),xn(e.overlay1Decorators,r.decorators),Zr(e.openrpc1Decorators,r.openrpc1Decorators),xn(e.openrpc1Decorators,r.decorators)}return e}function zQe(t){return new Map(JSON.parse(JSON.stringify([...t])))}function XV(t){return vt(t)&&"id"in t}function UQe(t){return typeof t=="function"}function Hoe({node:t,ctx:e,plugins:r}){if(!t.extends)return t;const n=(t.extends||[]).filter(fa).map(i=>{if(!xi(i)&&!Vf.extname(i))return s5e(i,r);const o=e.resolve({$ref:i});return o.location&&o.node!==void 0?o.node:null}).filter(fa);return Yoe([...n.map(i=>Hoe({node:i,ctx:e,plugins:r})),{...t,extends:void 0}])}function yv(t,e){if(vt(t)&&Array.isArray(t.plugins)){const{plugins:r,rootConfigDir:n}=e.getVisitorData();r.push(...t.plugins.map(i=>Koe(i,e.location.source.absoluteRef.replace(/^file:\/\//,""),n)))}}const VQe=Rf([{severity:"error",ruleId:Xie,visitor:{ref:{},ConfigGovernance:{leave(t,e){yv(t,e)}},ConfigApisProperties:{leave(t,e){yv(t,e)}},[ps.ScorecardClassicLevel]:{leave(t,e){yv(t,e)}},"rootRedoclyConfigSchema.scorecardClassic.levels_items":{leave(t,e){yv(t,e)}},ConfigRoot:{leave(t,e){yv(t,e)}}}}],T0);function vv(t,e){if(vt(t)&&t.extends){const{plugins:r}=e.getVisitorData(),n=Hoe({node:t,ctx:e,plugins:r});Object.assign(t,n),delete t.extends}}const FQe=Rf([{severity:"error",ruleId:Zie,visitor:{ref:{leave(t,e,r){G2(t,r,e)}},ConfigGovernance:{leave(t,e){vv(t,e)}},ConfigApisProperties:{leave(t,e){vv(t,e)}},[ps.ScorecardClassicLevel]:{leave(t,e){vv(t,e)}},"rootRedoclyConfigSchema.scorecardClassic.levels_items":{leave(t,e){vv(t,e)}},ConfigRoot:{leave(t,e){vv(t,e)}}}}],T0);function GV(t,e){return{prev:t,value:e}}function YV(t){return t?.prev??null}function BQe(t){const e={};for(;t.parent;)e[t.parent.type.name]=t.parent.activatedOn?.value.node,t=t.parent;return e}function WQe(t){const e={};for(;t.parent;)t.parent.activatedOn?.value.location&&(e[t.parent.type.name]=t.parent.activatedOn?.value.location),t=t.parent;return e}function jf(t){const{document:e,rootType:r,normalizedVisitors:n,resolvedRefMap:i,ctx:o}=t,s={},a=new Set,l=n.any.enter,c=n.any.leave,u={},d={};for(const f of Object.keys(n))f==="any"||f==="ref"||(u[f]=l.concat(n[f]?.enter||[]),d[f]=(n[f]?.leave||[]).concat(c));p(e.parsed,r,new H1(e.source,"#/"),void 0,"");function p(f,m,g,y,v){const b=(L,F=w.source.absoluteRef)=>{if(!ni(L))return{location:g,node:L};const X=_O(F,L.$ref),H=i.get(X);if(!H)return{location:void 0,node:void 0};const{resolved:te,node:re,document:ce,nodePointer:q,error:M}=H;return{location:te?new H1(ce.source,q):M instanceof ky?new H1(M.source,""):void 0,node:re,error:M}},O=g;let w=g;const x=ni(f),{node:S,location:_,error:C}=b(f),$=new Set;if(x){const L=n.ref.enter;for(const{visit:F,ruleId:X,severity:H,message:te,context:re}of L)$.add(re),F(f,{report:q=>R(X,H,te,q),resolve:b,rawNode:f,rawLocation:O,location:g,type:m,parent:y,key:v,parentLocations:{},specVersion:o.specVersion,config:o.config,getVisitorData:()=>D(X)},{node:S,location:_,error:C}),_?.source.absoluteRef&&o.refTypes&&o.refTypes.set(_?.source.absoluteRef,m)}if(S!==void 0&&_&&m.name!=="scalar"){w=_;const L=s[m.name]?.has?.(S);let F=!1;const X=u[m.name]||l.concat(n[m.name]?.enter||[]),H=[],te=`${w.absolutePointer}${w.pointer}`;for(const{context:ce,visit:q,skip:M,ruleId:Z,severity:V,message:A}of X){if(a.has(te))break;if(ce.isSkippedLevel)ce.parent.activatedOn&&!ce.parent.activatedOn.value.nextLevelTypeActivated&&!ce.seen.has(f)&&(ce.seen.add(f),F=!0,H.push(ce));else if(ce.parent&&ce.parent.activatedOn&&ce.activatedOn?.value.withParentNode!==ce.parent.activatedOn.value.node&&ce.parent.activatedOn.value.nextLevelTypeActivated?.value!==m||!ce.parent&&!L){H.push(ce);const Q={node:S,location:_,nextLevelTypeActivated:null,withParentNode:ce.parent?.activatedOn?.value.node,skipped:(ce.parent?.activatedOn?.value.skipped||M?.(S,v,{location:g,rawLocation:O,resolve:b,rawNode:f}))??!1};ce.activatedOn=GV(ce.activatedOn,Q);let W=ce.parent;for(;W;)W.activatedOn.value.nextLevelTypeActivated=GV(W.activatedOn.value.nextLevelTypeActivated,m),W=W.parent;Q.skipped||(F=!0,$.add(ce),j(q,S,f,ce,Z,V,A))}}if(F||!L){if(s[m.name]=s[m.name]||new Set,s[m.name].add(S),Array.isArray(S)){const ce=m.items;if(ce!==void 0){const q=typeof ce=="function";for(let M=0;M<S.length;M++){const Z=_.child([M]);let V=q?ce(S[M],Z.absolutePointer):ce,A=S[M];V?.directResolveAs&&(V=V.directResolveAs,A={$ref:A}),ip(V)&&p(A,V,Z,S,M)}}}else if(vt(S)){const ce=Object.keys(m.properties);m.additionalProperties?ce.push(...Object.keys(S).filter(q=>!ce.includes(q))):m.extensionsPrefix&&ce.push(...Object.keys(S).filter(q=>q.startsWith(m.extensionsPrefix))),x&&ce.push(...Object.keys(f).filter(q=>q!=="$ref"&&!ce.includes(q)));for(const q of ce){let M=S[q],Z=_;M===void 0&&(M=f[q],Z=g);let V=Wf(m.properties,q);if(V===void 0&&(V=m.additionalProperties),typeof V=="function"&&(V=V(M,q)),V===void 0&&m.extensionsPrefix&&q.startsWith(m.extensionsPrefix)&&(V=Ef),!ip(V)&&V?.directResolveAs&&(V=V.directResolveAs,M={$ref:M}),V&&V.name===void 0&&V.resolvable!==!1&&(V={name:"scalar",properties:{}}),ni(f[q])&&V?.name==="scalar"){p(f[q],V,g.child([q]),f,q);continue}!ip(V)||V.name==="scalar"&&!ni(M)||p(M,V,Z.child([q]),S,q)}}}const re=d[m.name]||(n[m.name]?.leave||[]).concat(c);for(const ce of H.reverse())if(ce.isSkippedLevel)ce.seen.delete(S);else if(ce.activatedOn=YV(ce.activatedOn),ce.parent){let q=ce.parent;for(;q;)q.activatedOn.value.nextLevelTypeActivated=YV(q.activatedOn.value.nextLevelTypeActivated),q=q.parent}for(const{context:ce,visit:q,ruleId:M,severity:Z,message:V}of re)!ce.isSkippedLevel&&$.has(ce)&&j(q,S,f,ce,M,Z,V)}if(w=g,x){const L=n.ref.leave;for(const{visit:F,ruleId:X,severity:H,context:te,message:re}of L)$.has(te)&&F(f,{report:q=>R(X,H,re,q),resolve:b,rawNode:f,rawLocation:O,location:g,type:m,parent:y,key:v,parentLocations:{},specVersion:o.specVersion,config:o.config,getVisitorData:()=>D(X)},{node:S,location:_,error:C})}function j(L,F,X,H,te,re,ce){L(F,{report:M=>R(te,re,ce,M),resolve:b,rawNode:X,location:w,rawLocation:O,type:m,parent:y,key:v,parentLocations:WQe(H),specVersion:o.specVersion,config:o.config,ignoreNextVisitorsOnNode:()=>{a.add(`${w.absolutePointer}${w.pointer}`)},getVisitorData:()=>D(te)},BQe(H),H)}function R(L,F,X,H){const re=(H.location?Array.isArray(H.location)?H.location:[H.location]:[{...w,reportOnKey:!1}]).map(q=>({...w,reportOnKey:!1,...q})),ce=H.forceSeverity||F;ce!=="off"&&o.problems.push({ruleId:H.ruleId||L,severity:ce,...H,message:X?X.replace("{{message}}",H.message):H.message,suggest:H.suggest||[],location:re})}function D(L){return o.visitorsData[L]=o.visitorsData[L]||{},o.visitorsData[L]}}}function HV(t,e){switch(e){case"oas3":switch(t){case"Schema":return"schemas";case"Parameter":return"parameters";case"Response":return"responses";case"Example":return"examples";case"RequestBody":return"requestBodies";case"Header":return"headers";case"SecuritySchema":return"securitySchemes";case"Link":return"links";case"Callback":return"callbacks";case"MediaTypesMap":return"mediaTypes";default:return null}case"oas2":switch(t){case"Schema":return"definitions";case"Parameter":return"parameters";case"Response":return"responses";default:return null}case"async2":switch(t){case"Schema":return"schemas";case"Parameter":return"parameters";default:return null}case"async3":switch(t){case"Schema":return"schemas";case"Parameter":return"parameters";default:return null}case"arazzo1":switch(t){case"Root.workflows_items.parameters_items":case"Root.workflows_items.steps_items.parameters_items":return"parameters";default:return null}case"overlay1":return null;case"openrpc1":switch(t){case"ContentDescriptor":return"contentDescriptors";case"Schema":return"schemas";case"Example":return"examples";case"Link":return"links";case"ErrorObject":return"errors";case"ExamplePairing":return"examplePairingObjects";case"Tag":return"tags";default:return null}}}function ZQe({version:t,dereference:e,rootDocument:r,resolvedRefMap:n,keepUrlRefs:i,componentRenamingConflicts:o="warn"}){let s,a;const l={ref:{leave(f,m,g){if(!g.location||g.node===void 0){Ym(g,m.report,m.location);return}if(g.location.source===r.source&&g.location.source===m.location.source&&m.type.name!=="scalar"&&!e){f.$ref!==g.location.pointer&&(f.$ref=g.location.pointer);return}if(i&&xi(f.$ref))return;const y=HV(m.type.name,t);y?e?(u(y,g,m),G2(f,g,m)):(f.$ref=u(y,g,m),c(f,g,m)):G2(f,g,m)}},Example:{leave(f,m){if(Wte(f)&&f.value===void 0){const g=m.resolve({$ref:f.externalValue});if(!g.location||g.node===void 0){Ym(g,m.report,m.location);return}if(i&&xi(f.externalValue))return;f.value=m.resolve({$ref:f.externalValue}).node,delete f.externalValue}}},Root:{enter(f,m){a=m.location,t==="oas3"?s=f.components=f.components||{}:t==="oas2"?s=f:t==="async2"?s=f.components=f.components||{}:t==="async3"?s=f.components=f.components||{}:t==="arazzo1"?s=f.components=f.components||{}:t==="openrpc1"&&(s=f.components=f.components||{})}}};if(t==="oas3"){const f=HV("Schema",t);l.Discriminator={leave(m,g){if(typeof m.defaultMapping!="string"||!rb(m.defaultMapping))return;const y=g.resolve({$ref:m.defaultMapping});if(!y.location||y.node===void 0){Ym(y,g.report,g.location.child("defaultMapping"));return}m.defaultMapping=u(f,y,g)},DiscriminatorMapping:{leave(m,g){for(const y of Object.keys(m)){const v=m[y];if(!rb(v))continue;const b=g.resolve({$ref:v});if(!b.location||b.node===void 0){Ym(b,g.report,g.location.child(y));return}m[y]=u(f,b,g)}}}}}function c(f,m,g){const y=_O(g.location.source.absoluteRef,f.$ref);n.set(y,{document:r,isRemote:!1,node:m.node,nodePointer:f.$ref,resolved:!0})}function u(f,m,g){s[f]=s[f]||{};const y=p(m,f,g);return s[f][y]=m.node,t==="oas3"||t==="async2"||t==="async3"||t==="openrpc1"?`#/components/${f}/${y}`:`#/${f}/${y}`}function d(f,m,g){return ni(f)&&g.resolve(f,a.absolutePointer).location?.absolutePointer===m.location.absolutePointer?!0:X2(f,m.node)}function p(f,m,g){const y=s[m],[v,b]=[f.location.source.absoluteRef,f.location.pointer];let O=iCe(b)||oCe(v);const w=O;let x=2;for(;y[O]&&!d(y[O],f,g);)O=`${w}-${x}`,x++;return!y[O]&&w!==O&&g.report({message:`Two schemas are referenced with the same name but different content. Renamed ${w} to ${O}.`,location:g.location,forceSeverity:o}),O}return l}async function XQe(t){const{document:e,config:r,types:n,externalRefResolver:i,dereference:o=!1,removeUnusedComponents:s=!1,keepUrlRefs:a=!1,componentRenamingConflicts:l}=t,c=u$(e.parsed),u=tie(c),d=r.getRulesForSpecVersion(u),p=SQ(r.extendTypes(n,c),r),f=kC(d,r,"preprocessors",c),m=kC(d,r,"decorators",c),g={problems:[],specVersion:c,config:r,refTypes:new Map,visitorsData:{}};let y=await hg({rootDocument:e,rootType:p.Root,externalRefResolver:i});f.length>0&&(jf({document:e,rootType:p.Root,normalizedVisitors:Rf(f,p),resolvedRefMap:y,ctx:g}),y=await hg({rootDocument:e,rootType:p.Root,externalRefResolver:i}));const v=Rf([{severity:"error",ruleId:"bundler",visitor:ZQe({version:u,dereference:o,rootDocument:e,resolvedRefMap:y,keepUrlRefs:a,componentRenamingConflicts:l})},...m.filter(b=>b.ruleId!=="remove-unused-components")],p);if(jf({document:e,rootType:p.Root,normalizedVisitors:v,resolvedRefMap:y,ctx:g}),s||r.getDecoratorSettings("remove-unused-components",c).severity!=="off"){const b=await hg({rootDocument:e,rootType:p.Root,externalRefResolver:i}),O=Rf([{severity:"error",ruleId:"remove-unused-components",visitor:u==="oas2"?ooe():soe()}],p);jf({document:e,rootType:p.Root,normalizedVisitors:O,resolvedRefMap:b,ctx:g})}return{bundle:e,problems:g.problems.map(b=>r.addProblemToIgnore(b)),fileDependencies:i.getFiles(),rootType:p.Root,refTypes:g.refTypes,visitorsData:g.visitorsData}}function GQe(t,e,r){const n={plugins:[],rootConfigDir:r},i={problems:[],specVersion:"oas3_0",refTypes:new Map,visitorsData:{[Xie]:n}};return jf({document:t,rootType:T0.ConfigRoot,normalizedVisitors:VQe,resolvedRefMap:e,ctx:i}),n.plugins}function YQe(t,e,r){const n={plugins:r},i={problems:[],specVersion:"oas3_0",refTypes:new Map,visitorsData:{[Zie]:n}};return jf({document:t,rootType:T0.ConfigRoot,normalizedVisitors:FQe,resolvedRefMap:e,ctx:i}),t.parsed??{}}async function Joe(t){const{ref:e,doc:r,externalRefResolver:n=new S$(t.config.resolve),base:i=null}=t;if(!(e||r))throw new Error(`Document or reference is required.
118
- `);const o=r===void 0?await n.resolveDocument(i,e,!0):r;if(o instanceof Error)throw o;return t.collectSpecData?.(o.parsed),XQe({document:o,...t,externalRefResolver:n,types:jQ(u$(o.parsed))})}function sE(t){return!va(t)}const KQ=new Map,HQe="v";let JQe=0;function KQe(t){return KQ.has(t)}function e5e(t){return KQ.get(t)}function t5e(t,e){KQ.set(t,e)}async function r5e(t){const e=(void 0)(t);return e.searchParams.set(HQe,String(JQe)),import(e.href)}async function n5e({rawConfigDocument:t,configPath:e,externalRefResolver:r,customExtends:n}){const i=t===void 0?Vje:t.parsed;if(n!==void 0&&vt(i)&&(i.extends=n),vt(i)&&(i?.extends?.some(sE)||i?.scorecardClassic?.levels?.some(p=>p?.extends?.some(sE))||i?.scorecard?.levels?.some(p=>p?.extends?.some(sE))))throw new Error("Configuration format not detected in extends: values must be strings.");const o=t??{source:new Qg(e??"",JSON.stringify(i)),parsed:i},s=await hg({rootDocument:o,rootType:T0.ConfigRoot,externalRefResolver:r??new S$(Gie(i?.resolve))});let a=[],l,c="";ha?l=[...(i?.plugins||[]).filter(f=>!va(f)),WV]:(c=cn.dirname(e??""),a=GQe(o,s,c),l=[...await o5e(a.map(f=>JV(f)?f.absolutePath:f),c),WV]);const u=YQe(o,zQe(s),l);u.apis&&(u.apis=Object.fromEntries(Object.entries(u.apis).map(([p,f])=>{const m=Yoe([u,f]);return[p,{...f,...m}]})));const d=a.length?a.map(p=>JV(p)&&p.isModule?p.rawPath:p.absolutePath&&cn.relative(c,p.absolutePath)).filter(Bf):void 0;return{resolvedConfig:{...u,plugins:d},resolvedRefMap:s,plugins:l}}function i5e(t){for(const e of Wje)(void 0)(cn.resolve(t,e))}function JV(t){return"isModule"in t}const Koe=(t,e,r)=>{if(!va(t))return t;(void 0)(cn.resolve(cn.dirname(e),t));try{return{absolutePath:zte.createRequire((typeof document>"u"?require("url").pathToFileURL(__filename).href:xu&&xu.tagName.toUpperCase()==="SCRIPT"&&xu.src||new URL("replay-index-CWUvqp-r.js",document.baseURI).href)??__dirname).resolve(t,{paths:[r,(typeof document>"u"?require("url").pathToFileURL(__filename).href:xu&&xu.tagName.toUpperCase()==="SCRIPT"&&xu.src||new URL("replay-index-CWUvqp-r.js",document.baseURI).href)?cn.dirname((void 0)(typeof document>"u"?require("url").pathToFileURL(__filename).href:xu&&xu.tagName.toUpperCase()==="SCRIPT"&&xu.src||new URL("replay-index-CWUvqp-r.js",document.baseURI).href)):__dirname]}),isModule:!0,rawPath:t}}catch{throw new Error(`Plugin "${t}" not found.`)}};async function o5e(t,e){if(!t)return[];const r=async a=>{if(!va(a))return a;try{const l=cn.isAbsolute(a)?a:Koe(a,cn.join(e,Uje),e).absolutePath;if(!KQe(l)){const c=await r5e(l),u=c.default||c,d={contentDir:e},p=Array.isArray(u)?u:[u];for(const g of p)g?.id&&XV(g)&&Sn.info(`Deprecated plugin format detected: ${g.id}
118
+ `);const o=r===void 0?await n.resolveDocument(i,e,!0):r;if(o instanceof Error)throw o;return t.collectSpecData?.(o.parsed),XQe({document:o,...t,externalRefResolver:n,types:jQ(u$(o.parsed))})}function sE(t){return!va(t)}const KQ=new Map,HQe="v";let JQe=0;function KQe(t){return KQ.has(t)}function e5e(t){return KQ.get(t)}function t5e(t,e){KQ.set(t,e)}async function r5e(t){const e=(void 0)(t);return e.searchParams.set(HQe,String(JQe)),import(e.href)}async function n5e({rawConfigDocument:t,configPath:e,externalRefResolver:r,customExtends:n}){const i=t===void 0?Vje:t.parsed;if(n!==void 0&&vt(i)&&(i.extends=n),vt(i)&&(i?.extends?.some(sE)||i?.scorecardClassic?.levels?.some(p=>p?.extends?.some(sE))||i?.scorecard?.levels?.some(p=>p?.extends?.some(sE))))throw new Error("Configuration format not detected in extends: values must be strings.");const o=t??{source:new Qg(e??"",JSON.stringify(i)),parsed:i},s=await hg({rootDocument:o,rootType:T0.ConfigRoot,externalRefResolver:r??new S$(Gie(i?.resolve))});let a=[],l,c="";ha?l=[...(i?.plugins||[]).filter(f=>!va(f)),WV]:(c=cn.dirname(e??""),a=GQe(o,s,c),l=[...await o5e(a.map(f=>JV(f)?f.absolutePath:f),c),WV]);const u=YQe(o,zQe(s),l);u.apis&&(u.apis=Object.fromEntries(Object.entries(u.apis).map(([p,f])=>{const m=Yoe([u,f]);return[p,{...f,...m}]})));const d=a.length?a.map(p=>JV(p)&&p.isModule?p.rawPath:p.absolutePath&&cn.relative(c,p.absolutePath)).filter(Bf):void 0;return{resolvedConfig:{...u,plugins:d},resolvedRefMap:s,plugins:l}}function i5e(t){for(const e of Wje)(void 0)(cn.resolve(t,e))}function JV(t){return"isModule"in t}const Koe=(t,e,r)=>{if(!va(t))return t;(void 0)(cn.resolve(cn.dirname(e),t));try{return{absolutePath:zte.createRequire((typeof document>"u"?require("url").pathToFileURL(__filename).href:xu&&xu.tagName.toUpperCase()==="SCRIPT"&&xu.src||new URL("replay-index-DuA4Mkjy.js",document.baseURI).href)??__dirname).resolve(t,{paths:[r,(typeof document>"u"?require("url").pathToFileURL(__filename).href:xu&&xu.tagName.toUpperCase()==="SCRIPT"&&xu.src||new URL("replay-index-DuA4Mkjy.js",document.baseURI).href)?cn.dirname((void 0)(typeof document>"u"?require("url").pathToFileURL(__filename).href:xu&&xu.tagName.toUpperCase()==="SCRIPT"&&xu.src||new URL("replay-index-DuA4Mkjy.js",document.baseURI).href)):__dirname]}),isModule:!0,rawPath:t}}catch{throw new Error(`Plugin "${t}" not found.`)}};async function o5e(t,e){if(!t)return[];const r=async a=>{if(!va(a))return a;try{const l=cn.isAbsolute(a)?a:Koe(a,cn.join(e,Uje),e).absolutePath;if(!KQe(l)){const c=await r5e(l),u=c.default||c,d={contentDir:e},p=Array.isArray(u)?u:[u];for(const g of p)g?.id&&XV(g)&&Sn.info(`Deprecated plugin format detected: ${g.id}
119
119
  `);const f=XV(u)?u:UQe(u)?await u(d):await u?.default?.(d),m=Array.isArray(f)?f:[f];f&&t5e(l,m.map(g=>({...g,path:a,absolutePath:l})))}return e5e(l)}catch(l){throw new Error(`Failed to load plugin "${a}": ${l.message}
120
120
 
121
121
  ${l.stack}`)}},n=new Map,i=i5e(e);i&&t.push(i);const o=new Set;return(await Promise.all(t.map(async a=>{if(va(a)){if(xi(a))throw new Error($r.red("We don't support remote plugins yet."));if(o.has(a))return;o.add(a)}const l=await r(a);if(!l)return;const c=Array.isArray(l)?l:[l];return(await Promise.all(c.map(async u=>{if(!u)return;const d=u.id;if(typeof d!="string")throw new Error($r.red(`Plugin must define \`id\` property in ${$r.blue(a.toString())}.`));const p=u.absolutePath??a.toString(),f=n.get(d);if(f){if(p!==f)throw new Error($r.red(`Plugin "id" must be unique. Plugin ${$r.blue(p)} uses id "${$r.blue(d)}" already seen in ${$r.blue(p)}`));return}n.set(d,p);const m={id:d,...u.configs?{configs:u.configs}:{},...u.typeExtension?{typeExtension:u.typeExtension}:{}};if(u.rules){if(!u.rules.oas3&&!u.rules.oas2&&!u.rules.async2&&!u.rules.async3&&!u.rules.arazzo1&&!u.rules.overlay1&&!u.rules.openrpc1)throw new Error(`Plugin rules must have \`oas3\`, \`oas2\`, \`async2\`, \`async3\`, \`arazzo\`, \`overlay1\`, or \`openrpc1\` rules "${a}.`);m.rules={},u.rules.oas3&&(m.rules.oas3=pi(u.rules.oas3,d)),u.rules.oas2&&(m.rules.oas2=pi(u.rules.oas2,d)),u.rules.async2&&(m.rules.async2=pi(u.rules.async2,d)),u.rules.async3&&(m.rules.async3=pi(u.rules.async3,d)),u.rules.arazzo1&&(m.rules.arazzo1=pi(u.rules.arazzo1,d)),u.rules.overlay1&&(m.rules.overlay1=pi(u.rules.overlay1,d)),u.rules.openrpc1&&(m.rules.openrpc1=pi(u.rules.openrpc1,d))}if(u.preprocessors){if(!u.preprocessors.oas3&&!u.preprocessors.oas2&&!u.preprocessors.async2&&!u.preprocessors.async3&&!u.preprocessors.arazzo1&&!u.preprocessors.overlay1&&!u.preprocessors.openrpc1)throw new Error(`Plugin \`preprocessors\` must have \`oas3\`, \`oas2\`, \`async2\`, \`async3\`, \`arazzo1\`, \`overlay1\`, or \`openrpc1\` preprocessors "${a}.`);m.preprocessors={},u.preprocessors.oas3&&(m.preprocessors.oas3=pi(u.preprocessors.oas3,d)),u.preprocessors.oas2&&(m.preprocessors.oas2=pi(u.preprocessors.oas2,d)),u.preprocessors.async2&&(m.preprocessors.async2=pi(u.preprocessors.async2,d)),u.preprocessors.async3&&(m.preprocessors.async3=pi(u.preprocessors.async3,d)),u.preprocessors.arazzo1&&(m.preprocessors.arazzo1=pi(u.preprocessors.arazzo1,d)),u.preprocessors.overlay1&&(m.preprocessors.overlay1=pi(u.preprocessors.overlay1,d)),u.preprocessors.openrpc1&&(m.preprocessors.openrpc1=pi(u.preprocessors.openrpc1,d))}if(u.decorators){if(!u.decorators.oas3&&!u.decorators.oas2&&!u.decorators.async2&&!u.decorators.async3&&!u.decorators.arazzo1&&!u.decorators.overlay1&&!u.decorators.openrpc1)throw new Error(`Plugin \`decorators\` must have \`oas3\`, \`oas2\`, \`async2\`, \`async3\`, \`arazzo1\`, \`overlay1\`, or \`openrpc1\` decorators "${a}.`);m.decorators={},u.decorators.oas3&&(m.decorators.oas3=pi(u.decorators.oas3,d)),u.decorators.oas2&&(m.decorators.oas2=pi(u.decorators.oas2,d)),u.decorators.async2&&(m.decorators.async2=pi(u.decorators.async2,d)),u.decorators.async3&&(m.decorators.async3=pi(u.decorators.async3,d)),u.decorators.arazzo1&&(m.decorators.arazzo1=pi(u.decorators.arazzo1,d)),u.decorators.overlay1&&(m.decorators.overlay1=pi(u.decorators.overlay1,d)),u.decorators.openrpc1&&(m.decorators.openrpc1=pi(u.decorators.openrpc1,d))}return u.assertions&&(m.assertions=u.assertions),{...u,...m}}))).filter(Bf)}))).filter(Bf).flat()}function s5e(t,e){const{pluginId:r,configName:n}=qQe(t),i=e.find(s=>s.id===r);if(!i)throw new Error(`Invalid config ${$r.red(t)}: plugin ${r} is not included.`);const o=i.configs?.[n];if(!o)throw new Error(r?`Invalid config ${$r.red(t)}: plugin ${r} doesn't export config with name ${n}.`:`Invalid config ${$r.red(t)}: there is no such built-in config.`);return o}async function ese(t,{configPath:e,externalRefResolver:r,ignore:n}={}){const o=MQe(typeof t=="string"?t:"",e??"");typeof t!="string"&&t&&(o.parsed=t);const{resolvedConfig:s,resolvedRefMap:a,plugins:l}=await n5e({rawConfigDocument:a5e(o),configPath:e,externalRefResolver:r});return new p$(s,{configPath:e,document:o,resolvedRefMap:a,plugins:l,ignore:n})}function a5e(t){if(!t.parsed)return t;const{plugins:e,resolve:r,...n}=t.parsed,i={...structuredClone(n),plugins:e?.slice(),...r&&{resolve:{...r}}};return{...t,parsed:i}}var aE={},wl={},lE={},KV;function _$(){return KV||(KV=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e;(function(l){l[l.SCALAR=0]="SCALAR",l[l.MAPPING=1]="MAPPING",l[l.MAP=2]="MAP",l[l.SEQ=3]="SEQ",l[l.ANCHOR_REF=4]="ANCHOR_REF",l[l.INCLUDE_REF=5]="INCLUDE_REF"})(e=t.Kind||(t.Kind={}));function r(l,c){var u=c?c.endPosition:l.endPosition+1,d={key:l,value:c,startPosition:l.startPosition,endPosition:u,kind:e.MAPPING,parent:null,errors:[]};return d}t.newMapping=r;function n(l,c,u,d){return{errors:[],referencesAnchor:l,value:d,startPosition:c,endPosition:u,kind:e.ANCHOR_REF,parent:null}}t.newAnchorRef=n;function i(l){l===void 0&&(l="");var c={errors:[],startPosition:-1,endPosition:-1,value:""+l,kind:e.SCALAR,parent:null,doubleQuoted:!1,rawValue:""+l};return typeof l!="string"&&(c.valueObject=l),c}t.newScalar=i;function o(){return{errors:[],startPosition:-1,endPosition:-1,items:[],kind:e.SEQ,parent:null}}t.newItems=o;function s(){return o()}t.newSeq=s;function a(l){return{errors:[],startPosition:-1,endPosition:-1,mappings:l||[],kind:e.MAP,parent:null}}t.newMap=a})(lE)),lE}var Tu={},eF;function $y(){if(eF)return Tu;eF=1,Object.defineProperty(Tu,"__esModule",{value:!0});function t(s){return typeof s>"u"||s===null}Tu.isNothing=t;function e(s){return typeof s=="object"&&s!==null}Tu.isObject=e;function r(s){return Array.isArray(s)?s:t(s)?[]:[s]}Tu.toArray=r;function n(s,a){var l,c,u,d;if(a)for(d=Object.keys(a),l=0,c=d.length;l<c;l+=1)u=d[l],s[u]=a[u];return s}Tu.extend=n;function i(s,a){var l="",c;for(c=0;c<a;c+=1)l+=s;return l}Tu.repeat=i;function o(s){return s===0&&Number.NEGATIVE_INFINITY===1/s}return Tu.isNegativeZero=o,Tu}var cE,tF;function R0(){if(tF)return cE;tF=1;var t=(function(){function e(r,n,i){n===void 0&&(n=null),i===void 0&&(i=!1),this.name="YAMLException",this.reason=r,this.mark=n,this.message=this.toString(!1),this.isWarning=i}return e.isInstance=function(r){if(r!=null&&r.getClassIdentifier&&typeof r.getClassIdentifier=="function")for(var n=0,i=r.getClassIdentifier();n<i.length;n++){var o=i[n];if(o==e.CLASS_IDENTIFIER)return!0}return!1},e.prototype.getClassIdentifier=function(){var r=[];return r.concat(e.CLASS_IDENTIFIER)},e.prototype.toString=function(r){r===void 0&&(r=!1);var n;return n="JS-YAML: "+(this.reason||"(unknown reason)"),!r&&this.mark&&(n+=" "+this.mark.toString()),n},e.CLASS_IDENTIFIER="yaml-ast-parser.YAMLException",e})();return cE=t,cE}var uE,rF;function l5e(){if(rF)return uE;rF=1;var t=$y(),e=(function(){function r(n,i,o,s,a){this.name=n,this.buffer=i,this.position=o,this.line=s,this.column=a}return r.prototype.getSnippet=function(n,i){n===void 0&&(n=0),i===void 0&&(i=75);var o,s,a,l,c;if(!this.buffer)return null;for(n=n||4,i=i||75,o="",s=this.position;s>0&&`\0\r
@@ -315,7 +315,7 @@ ${ce}`,pe=Math.min(H.length,$);let ye=0;for(;ye<pe-1;ye++){const U=D(String(ye),
315
315
  ${q}`,te.pop(),`[${G}]`}let M=Object.keys(H);const Z=M.length;if(Z===0)return"{}";if(C<te.length+1)return'"[Object]"';ce+=re;const V=`,
316
316
  ${ce}`;let A="",Q="",W=Math.min(Z,$);l(H)&&(A+=c(H,V,$),M=M.slice(H.length),W-=H.length,Q=V),S&&(M=s(M,_)),te.push(H);for(let G=0;G<W;G++){const K=M[G],pe=D(K,H[K],te,re,ce);pe!==void 0&&(A+=`${Q}${o(K)}: ${pe}`,Q=V)}if(Z>$){const G=Z-$;A+=`${Q}"...": "${m(G)} not stringified"`,Q=V}return Q!==""&&(A=`
317
317
  ${ce}${A}
318
- ${q}`),te.pop(),`{${A}}`}case"number":return isFinite(H)?String(H):O?O(H):"null";case"boolean":return H===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(H);default:return O?O(H):void 0}}function L(X,H,te){switch(typeof H){case"string":return o(H);case"object":{if(H===null)return"null";if(typeof H.toJSON=="function"){if(H=H.toJSON(X),typeof H!="object")return L(X,H,te);if(H===null)return"null"}if(te.indexOf(H)!==-1)return w;let re="";const ce=H.length!==void 0;if(ce&&Array.isArray(H)){if(H.length===0)return"[]";if(C<te.length+1)return'"[Array]"';te.push(H);const A=Math.min(H.length,$);let Q=0;for(;Q<A-1;Q++){const G=L(String(Q),H[Q],te);re+=G!==void 0?G:"null",re+=","}const W=L(String(Q),H[Q],te);if(re+=W!==void 0?W:"null",H.length-1>$){const G=H.length-$-1;re+=`,"... ${m(G)} not stringified"`}return te.pop(),`[${re}]`}let q=Object.keys(H);const M=q.length;if(M===0)return"{}";if(C<te.length+1)return'"[Object]"';let Z="",V=Math.min(M,$);ce&&l(H)&&(re+=c(H,",",$),q=q.slice(H.length),V-=H.length,Z=","),S&&(q=s(q,_)),te.push(H);for(let A=0;A<V;A++){const Q=q[A],W=L(Q,H[Q],te);W!==void 0&&(re+=`${Z}${o(Q)}:${W}`,Z=",")}if(M>$){const A=M-$;re+=`${Z}"...":"${m(A)} not stringified"`}return te.pop(),`{${re}}`}case"number":return isFinite(H)?String(H):O?O(H):"null";case"boolean":return H===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(H);default:return O?O(H):void 0}}function F(X,H,te){if(arguments.length>1){let re="";if(typeof te=="number"?re=" ".repeat(Math.min(te,10)):typeof te=="string"&&(re=te.slice(0,10)),H!=null){if(typeof H=="function")return j("",{"":X},[],H,re,"");if(Array.isArray(H))return R("",X,[],g(H),re,"")}if(re.length!==0)return D("",X,[],re,"")}return L("",X,[])}return F}})(zS,zS.exports)),zS.exports}var TWe=$We();const IWe=uo(TWe),EWe=IWe.configure;class wb extends fWe{static maxErrorTextChars=4096;static stringify=EWe({maximumDepth:2,maximumBreadth:10});sendErrorEvent;constructor(e,r){super("errors","1.0",e||{}),this.sendErrorEvent=r}static toErrorEvent(e,r){return{type:"error",payload:[{handler:r,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 r=String(e.stack);return r.length>this.maxErrorTextChars?r.substring(0,this.maxErrorTextChars):r}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 r=e.findIndex(i=>i instanceof Error),n=e.filter((i,o)=>o!==r).map(i=>typeof i=="string"?i:i instanceof Error?String(i):this.stringify(i)??String(i)).join(" ").substring(0,this.maxErrorTextChars);if(r===-1)return n;{const i=e[r];return n&&(i.message=`${i.message} ${n}`),i}}onError=e=>{this.sendError(e.error,"window.onerror")};onUnhandledRejection=e=>{this.sendError(e.reason,"window.onunhandledrejection")};patchConsoleError(){return e=>{const r=this;return function(...i){try{const o=wb.combineConsoleErrorArgs(i);r.sendError(o,"console.error")}catch(o){process.env.NODE_ENV!=="production"&&e?.call(this,"Error reporting failed:",o)}e?.apply(this,i)}}}sendError(e,r){this.sendErrorEvent(wb.toErrorEvent(e,r))}}class AWe{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new PWe,this.tracer={traceStep:(e,r)=>{const n=this.constructCloudEvent(e,r,{signal:"trace"});return this.otelClient.traceStep(n)}}}updateCloudEventData=e=>{this.config?.disabled||(this.useCloudEventData=e)};send(e,r,n){try{if(!this.config?.otel.isProd)return;const o=e&&typeof e=="object"&&"type"in e&&"data"in e?e:this.constructCloudEvent(e,r,{...n,signal:"log"});this.sendToOtelService(o)}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 wb(void 0,r=>{this.sendToOtelService({type:r.type,data:r.payload})})]:[],...e.otel.instrumentations||[]]}))}startSpan(e,r,n){if(this.config?.disabled)return;const i=this.constructCloudEvent(e,r,{signal:"trace"});return this.otelClient.startSpan(i,n)}constructCloudEvent(e,r,n){const i={...this.useCloudEventData(),...n};return f9e({type:e,data:r,...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,r){if(this.config?.disabled)return;const n=wb.toErrorEvent(e,r);this.sendToOtelService({type:n.type,data:n.payload})}sendTabChangeMessage(e,r){this.send("com.redocly.tab.change",e,r)}sendButtonClickMessage(e,r){this.send("com.redocly.button.click",e,r)}sendTabOpenFailedMessage(e,r){this.send("com.redocly.tab.openFailed",e,r)}sendChangeMessage(e,r){this.send("com.redocly.change.occurred",e,r)}sendContentCopyMessage(e,r){this.send("com.redocly.content.copy",e,r)}sendRequestSendMessage(e,r){this.send("com.redocly.request.send",e,r)}sendTokenGenerateMessage(e,r){this.send("com.redocly.token.generate",e,r)}sendAppLifecycleMessage(e,r){this.send("com.redocly.app.lifecycle",e,r)}sendEnvironmentManagementMessage(e,r){this.send("com.redocly.environment.management",e,r)}sendServerManagementMessage(e,r){this.send("com.redocly.server.management",e,r)}sendSourceManagementMessage(e,r){this.send("com.redocly.source.management",e,r)}sendInputManagementMessage(e,r){this.send("com.redocly.input.management",e,r)}sendNodeManagementMessage(e,r){this.send("com.redocly.node.management",e,r)}sendHistoryManagementMessage(e,r){this.send("com.redocly.history.management",e,r)}sendHistoryMigrationMessage(e,r){this.send("com.redocly.history.migration",e,r)}sendCredentialManagementMessage(e,r){this.send("com.redocly.credential.management",e,r)}sendPanelToggleMessage(e,r){this.send("com.redocly.panel.toggle",e,r)}sendWorkflowRunClickMessage(e,r){this.send("com.redocly.workflowRun.click",e,r)}sendWorkflowRunResultMessage(e,r){this.send("com.redocly.workflowRun.result",e,r)}sendStorageReadMessage(e){this.send("com.redocly.storage.read",void 0,e)}sendStorageLoadUserStateMessage(e){this.send("com.redocly.storage.loadUserState",void 0,e)}sendStorageDetectFilesMessage(e){this.send("com.redocly.storage.detectFiles",void 0,e)}sendStorageLoadApisMessage(e){this.send("com.redocly.storage.loadApis",void 0,e)}sendStorageParseApisMessage(e){this.send("com.redocly.storage.parseApis",void 0,e)}sendStorageParseCollectionsMessage(e){this.send("com.redocly.storage.parseCollections",void 0,e)}sendUpdaterCheckMessage(e){this.send("com.redocly.updater.check",void 0,e)}sendUpdaterDownloadMessage(e){this.send("com.redocly.updater.download",void 0,e)}sendUpdaterInstallMessage(e){this.send("com.redocly.updater.install",void 0,e)}sendUpdaterProcessMessage(e){this.send("com.redocly.updater.process",void 0,e)}sendErrorMessage(e,r){this.send("com.redocly.error.occurred",e,r)}sendBackendEventMessage(e,r){this.send("com.redocly.backend.event",e,r)}sendCodeEditorSearchMessage(e,r){this.send("com.redocly.codeEditor.search",e,r)}sendAiChatToolCallStartedMessage(e,r){this.send("com.redocly.aiChat.toolCallStarted",e,r)}sendAiChatToolCallFinishedMessage(e,r){this.send("com.redocly.aiChat.toolCallFinished",e,r)}sendAiChatConversationStartedMessage(e,r){this.send("com.redocly.aiChat.conversationStarted",e,r)}sendAiChatConversationFinishedMessage(e,r){this.send("com.redocly.aiChat.conversationFinished",e,r)}}const Iy=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],RWe="https://cors.redocly.com/";function La(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var CW=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),kW=function(){return Math.random().toString(36).substring(7).split("").join(".")},PW={INIT:"@@redux/INIT"+kW(),REPLACE:"@@redux/REPLACE"+kW()};function jWe(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function NWe(t){if(t===void 0)return"undefined";if(t===null)return"null";var e=typeof t;switch(e){case"boolean":case"string":case"number":case"symbol":case"function":return e}if(Array.isArray(t))return"array";if(QWe(t))return"date";if(DWe(t))return"error";var r=MWe(t);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return e.slice(8,-1).toLowerCase().replace(/\s/g,"")}function MWe(t){return typeof t.constructor=="function"?t.constructor.name:null}function DWe(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function QWe(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function cm(t){var e=typeof t;return process.env.NODE_ENV!=="production"&&(e=NWe(t)),e}function mle(t,e,r){var n;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?La(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?La(1):"Expected the enhancer to be a function. Instead, received: '"+cm(r)+"'");return r(mle)(t,e)}if(typeof t!="function")throw new Error(process.env.NODE_ENV==="production"?La(2):"Expected the root reducer to be a function. Instead, received: '"+cm(t)+"'");var i=t,o=e,s=[],a=s,l=!1;function c(){a===s&&(a=s.slice())}function u(){if(l)throw new Error(process.env.NODE_ENV==="production"?La(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return o}function d(g){if(typeof g!="function")throw new Error(process.env.NODE_ENV==="production"?La(4):"Expected the listener to be a function. Instead, received: '"+cm(g)+"'");if(l)throw new Error(process.env.NODE_ENV==="production"?La(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var y=!0;return c(),a.push(g),function(){if(y){if(l)throw new Error(process.env.NODE_ENV==="production"?La(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");y=!1,c();var b=a.indexOf(g);a.splice(b,1),s=null}}}function p(g){if(!jWe(g))throw new Error(process.env.NODE_ENV==="production"?La(7):"Actions must be plain objects. Instead, the actual type was: '"+cm(g)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof g.type>"u")throw new Error(process.env.NODE_ENV==="production"?La(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(l)throw new Error(process.env.NODE_ENV==="production"?La(9):"Reducers may not dispatch actions.");try{l=!0,o=i(o,g)}finally{l=!1}for(var y=s=a,v=0;v<y.length;v++){var b=y[v];b()}return g}function f(g){if(typeof g!="function")throw new Error(process.env.NODE_ENV==="production"?La(10):"Expected the nextReducer to be a function. Instead, received: '"+cm(g));i=g,p({type:PW.REPLACE})}function m(){var g,y=d;return g={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?La(11):"Expected the observer to be an object. Instead, received: '"+cm(b)+"'");function O(){b.next&&b.next(u())}O();var w=y(O);return{unsubscribe:w}}},g[CW]=function(){return this},g}return p({type:PW.INIT}),n={dispatch:p,subscribe:d,getState:u,replaceReducer:f},n[CW]=m,n}function LWe(t){typeof console<"u"&&typeof console.error=="function"&&console.error(t);try{throw new Error(t)}catch{}}function Op(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(n){return n}:e.length===1?e[0]:e.reduce(function(n,i){return function(){return n(i.apply(void 0,arguments))}})}function $W(){}process.env.NODE_ENV!=="production"&&typeof $W.name=="string"&&$W.name!=="isCrushed"&&LWe('You are currently using minified code outside of NODE_ENV === "production". This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) to ensure you have the correct code for your production build.');function qWe(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];if(e.length!==0)return typeof e[0]=="object"?Op:Op(...e)}process.env.NODE_ENV!=="production"&&typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;process.env.NODE_ENV!=="production"&&typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;const zWe=Object.keys||function(t){const e=[];for(const r in t)({}).hasOwnProperty.call(t,r)&&e.push(r);return e};function UWe(t,e,r){const n=zWe(t),i={};for(let o=0,s=n.length;o<s;o++){const a=n[o];i[a]=t[a]}return i[e]=r,i}function z5(t){const e=t||{};return e.features={pause:!0,export:!0,test:!0},e.type="redux",e.autoPause===void 0&&(e.autoPause=!0),e.latency===void 0&&(e.latency=500),function(r){return function(n,i){const o=r(n,i),s=o.dispatch,a=window.__REDUX_DEVTOOLS_EXTENSION__.connect(e);a.init(o.getState());const l=function(c){const u=s(c);return a.send(c,o.getState()),u};return Object.assign?Object.assign(o,{dispatch:l}):UWe(o,"dispatch",l)}}}function TW(t){return function(){return Op(Op(...arguments),z5(t))}}function VWe(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];if(typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__)return e.length===0?z5():typeof e[0]=="object"?TW(e[0]):TW()(...e);if(e.length!==0)return typeof e[0]=="object"?Op:Op(...e)}const FWe=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?z5:function(){return function(t){return t}};function BWe(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];if(e.length!==0)return typeof e[0]=="object"?Op:Op(...e)}process.env.NODE_ENV==="production"||typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;process.env.NODE_ENV==="production"||typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;const WWe=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(t){return t}};function ZWe(t,e,r){var n=!1,i=!1,o=mle(function(a,l){if(!i){var c=function(y){return Array.isArray(y)&&y.findIndex(function(v){return typeof v!="string"&&typeof v!="number"})===-1};if(l.type.startsWith("SET")){var u=function(y){try{n=!0,"value"in l?y.set(l.value):y.set(Zt)}finally{n=!1}};if(l.path){if(c(l.path)){l.path.length===0&&u(t);for(var d=t,p=!0,f=0,m=l.path;f<m.length;f++){var g=m[f];d[g]?d=d[g]:p=!1}p&&u(d)}}else u(t)}else l.type==="BREAKPOINT"&&r()}return t.promised||t.error?Zt:t.get({noproxy:!0})},WWe({name:"".concat(window.location.hostname,": ").concat(e),trace:!0,traceLimit:16,autoPause:!0,shouldHotReload:!1,features:{persist:!0,pause:!0,lock:!1,export:"custom",import:"custom",jump:!1,skip:!1,reorder:!1,dispatch:!0,test:!1}})),s=function(a,l){if(n)l&&l();else try{i=!0,o.dispatch(a)}finally{i=!1}};return s}function XWe(t){return function(){var e,r,n=!1;return{onInit:function(i,o){if(!(typeof window>"u"||!("__REDUX_DEVTOOLS_EXTENSION__"in window))){if(t?.key===void 0){if(o.identifier===void 0)throw Error("State is missing Identifiable extension or Devtools key option");e=o.identifier(i)}else e=t.key;r=ZWe(i,e,function(){n=!n}),i.promise||r?.({type:"CREATE",state:i.get({noproxy:!0,stealth:!0})})}},onSet:function(i,o){if(r?.({type:"SET [".concat(i.path.join("/"),"]"),state:i.get({noproxy:!0,stealth:!0}),descriptor:o}),n)debugger},onDestroy:function(){r?.({type:"DESTROY"})}}}}var Tr=(t=>(t.Normal="Normal",t.Edit="Edit",t.Draft="Draft",t))(Tr||{});const q0="default",gle=[{name:q0,inputs:[],servers:[],state:Tr.Normal}],Xj={activeTabIdx:0,tabs:[]};var Pc=(t=>(t.Idle="idle",t.Loading="loading",t.Success="success",t.Error="error",t))(Pc||{});function ql(t){const e=new WeakMap;function r(n){if(typeof n!="object"||n===null)return n;if(e.has(n))return e.get(n);const i=Array.isArray(n)?[]:{};e.set(n,i);for(const o in n)Object.prototype.hasOwnProperty.call(n,o)&&(i[o]=r(n[o]));return i}return r(t)}function Gj(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!Gj(t[i],e[i]))return!1;return!0}const r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(let i=0;i<r.length;i++){const o=r[i];if(!Object.prototype.hasOwnProperty.call(e,o)||!Gj(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function IW(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}function js(t,e,r,n){if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function s_(t,e,r,n,i){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,r),r}var um,hc,dm,a_;const EW="__TAURI_TO_IPC_KEY__";function yle(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}class vle{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,um.set(this,()=>{}),hc.set(this,0),dm.set(this,[]),this.id=yle(({message:e,id:r})=>{if(r==js(this,hc,"f"))for(js(this,um,"f").call(this,e),s_(this,hc,js(this,hc,"f")+1);js(this,hc,"f")in js(this,dm,"f");){const n=js(this,dm,"f")[js(this,hc,"f")];js(this,um,"f").call(this,n),delete js(this,dm,"f")[js(this,hc,"f")],s_(this,hc,js(this,hc,"f")+1)}else js(this,dm,"f")[r]=e})}set onmessage(e){s_(this,um,e)}get onmessage(){return js(this,um,"f")}[(um=new WeakMap,hc=new WeakMap,dm=new WeakMap,EW)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[EW]()}}async function rt(t,e={},r){return window.__TAURI_INTERNALS__.invoke(t,e,r)}class GWe{get rid(){return js(this,a_,"f")}constructor(e){a_.set(this,void 0),s_(this,a_,e)}async close(){return rt("plugin:resources|close",{rid:this.rid})}}a_=new WeakMap;function Br(){return!!window?.__TAURI__}async function Yj(t,e,r){const n=[],i=[];for(const o of t){const s=Promise.resolve().then(()=>r(o,t));if(n.push(s),e<=t.length){const a=s.then(()=>i.splice(i.indexOf(a),1));i.push(a),i.length>=e&&await Promise.race(i)}}return Promise.all(n)}const To={FS:"fs",WEB:"web"};var mn;(function(t){t[t.Audio=1]="Audio",t[t.Cache=2]="Cache",t[t.Config=3]="Config",t[t.Data=4]="Data",t[t.LocalData=5]="LocalData",t[t.Document=6]="Document",t[t.Download=7]="Download",t[t.Picture=8]="Picture",t[t.Public=9]="Public",t[t.Video=10]="Video",t[t.Resource=11]="Resource",t[t.Temp=12]="Temp",t[t.AppConfig=13]="AppConfig",t[t.AppData=14]="AppData",t[t.AppLocalData=15]="AppLocalData",t[t.AppCache=16]="AppCache",t[t.AppLog=17]="AppLog",t[t.Desktop=18]="Desktop",t[t.Executable=19]="Executable",t[t.Font=20]="Font",t[t.Home=21]="Home",t[t.Runtime=22]="Runtime",t[t.Template=23]="Template"})(mn||(mn={}));async function YWe(){return rt("plugin:path|resolve_directory",{directory:mn.AppConfig})}async function Ole(){return rt("plugin:path|resolve_directory",{directory:mn.AppData})}async function HWe(){return rt("plugin:path|resolve_directory",{directory:mn.AppLocalData})}async function JWe(){return rt("plugin:path|resolve_directory",{directory:mn.AppCache})}async function KWe(){return rt("plugin:path|resolve_directory",{directory:mn.Audio})}async function e7e(){return rt("plugin:path|resolve_directory",{directory:mn.Cache})}async function t7e(){return rt("plugin:path|resolve_directory",{directory:mn.Config})}async function r7e(){return rt("plugin:path|resolve_directory",{directory:mn.Data})}async function ble(){return rt("plugin:path|resolve_directory",{directory:mn.Desktop})}async function n7e(){return rt("plugin:path|resolve_directory",{directory:mn.Document})}async function i7e(){return rt("plugin:path|resolve_directory",{directory:mn.Download})}async function o7e(){return rt("plugin:path|resolve_directory",{directory:mn.Executable})}async function s7e(){return rt("plugin:path|resolve_directory",{directory:mn.Font})}async function a7e(){return rt("plugin:path|resolve_directory",{directory:mn.Home})}async function l7e(){return rt("plugin:path|resolve_directory",{directory:mn.LocalData})}async function c7e(){return rt("plugin:path|resolve_directory",{directory:mn.Picture})}async function u7e(){return rt("plugin:path|resolve_directory",{directory:mn.Public})}async function d7e(){return rt("plugin:path|resolve_directory",{directory:mn.Resource})}async function p7e(t){return rt("plugin:path|resolve_directory",{directory:mn.Resource,path:t})}async function f7e(){return rt("plugin:path|resolve_directory",{directory:mn.Runtime})}async function h7e(){return rt("plugin:path|resolve_directory",{directory:mn.Template})}async function m7e(){return rt("plugin:path|resolve_directory",{directory:mn.Video})}async function g7e(){return rt("plugin:path|resolve_directory",{directory:mn.AppLog})}async function y7e(){return rt("plugin:path|resolve_directory",{directory:mn.Temp})}function U5(){return window.__TAURI_INTERNALS__.plugins.path.sep}function v7e(){return window.__TAURI_INTERNALS__.plugins.path.delimiter}async function xle(...t){return rt("plugin:path|resolve",{paths:t})}async function O7e(t){return rt("plugin:path|normalize",{path:t})}async function vg(...t){return rt("plugin:path|join",{paths:t})}async function wle(t){return rt("plugin:path|dirname",{path:t})}async function Sle(t){return rt("plugin:path|extname",{path:t})}async function V5(t,e){return rt("plugin:path|basename",{path:t,ext:e})}async function _le(t){return rt("plugin:path|is_absolute",{path:t})}const Cle=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return mn},appCacheDir:JWe,appConfigDir:YWe,appDataDir:Ole,appLocalDataDir:HWe,appLogDir:g7e,audioDir:KWe,basename:V5,cacheDir:e7e,configDir:t7e,dataDir:r7e,delimiter:v7e,desktopDir:ble,dirname:wle,documentDir:n7e,downloadDir:i7e,executableDir:o7e,extname:Sle,fontDir:s7e,homeDir:a7e,isAbsolute:_le,join:vg,localDataDir:l7e,normalize:O7e,pictureDir:c7e,publicDir:u7e,resolve:xle,resolveResource:p7e,resourceDir:d7e,runtimeDir:f7e,sep:U5,tempDir:y7e,templateDir:h7e,videoDir:m7e},Symbol.toStringTag,{value:"Module"}));var Hj;(function(t){t[t.Start=0]="Start",t[t.Current=1]="Current",t[t.End=2]="End"})(Hj||(Hj={}));function F5(t){return{isFile:t.isFile,isDirectory:t.isDirectory,isSymlink:t.isSymlink,size:t.size,mtime:t.mtime!==null?new Date(t.mtime):null,atime:t.atime!==null?new Date(t.atime):null,birthtime:t.birthtime!==null?new Date(t.birthtime):null,readonly:t.readonly,fileAttributes:t.fileAttributes,dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,blksize:t.blksize,blocks:t.blocks}}class B5 extends GWe{async read(e){if(e.byteLength===0)return 0;const[r,n]=await rt("plugin:fs|read",{rid:this.rid,len:e.byteLength});return e.set(r),n===0?null:n}async seek(e,r){return await rt("plugin:fs|seek",{rid:this.rid,offset:e,whence:r})}async stat(){const e=await rt("plugin:fs|fstat",{rid:this.rid});return F5(e)}async truncate(e){await rt("plugin:fs|ftruncate",{rid:this.rid,len:e})}async write(e){return await rt("plugin:fs|write",{rid:this.rid,data:e})}}async function b7e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=await rt("plugin:fs|create",{path:t instanceof URL?t.toString():t,options:e});return new B5(r)}async function x7e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=await rt("plugin:fs|open",{path:t instanceof URL?t.toString():t,options:e});return new B5(r)}async function w7e(t,e,r){if(t instanceof URL&&t.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await rt("plugin:fs|copy_file",{fromPath:t instanceof URL?t.toString():t,toPath:e instanceof URL?e.toString():e,options:r})}async function Jj(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await rt("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})}async function W5(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await rt("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})}async function kle(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=await rt("plugin:fs|read_file",{path:t instanceof URL?t.toString():t,options:e});return r instanceof ArrayBuffer?new Uint8Array(r):Uint8Array.from(r)}async function z$(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await rt("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e})}async function S7e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=t instanceof URL?t.toString():t;return await Promise.resolve({path:r,rid:null,async next(){this.rid===null&&(this.rid=await rt("plugin:fs|read_text_file_lines",{path:r,options:e}));const[n,i]=await rt("plugin:fs|read_text_file_lines_next",{rid:this.rid});return i&&(this.rid=null),{value:i?"":n,done:i}},[Symbol.asyncIterator](){return this}})}async function Ple(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await rt("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})}async function $le(t,e,r){if(t instanceof URL&&t.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await rt("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:r})}async function _7e(t,e){const r=await rt("plugin:fs|stat",{path:t instanceof URL?t.toString():t,options:e});return F5(r)}async function C7e(t,e){const r=await rt("plugin:fs|lstat",{path:t instanceof URL?t.toString():t,options:e});return F5(r)}async function k7e(t,e,r){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await rt("plugin:fs|truncate",{path:t instanceof URL?t.toString():t,len:e,options:r})}async function P7e(t,e,r){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await rt("plugin:fs|write_file",e,{headers:{path:t instanceof URL?t.toString():t,options:JSON.stringify(r)}})}async function Tle(t,e,r){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await rt("plugin:fs|write_text_file",{path:t instanceof URL?t.toString():t,data:e,options:r})}async function U$(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await rt("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})}async function Ile(t){await rt("plugin:fs|unwatch",{rid:t})}async function $7e(t,e,r){const n={recursive:!1,delayMs:2e3,...r},i=Array.isArray(t)?t:[t];for(const a of i)if(a instanceof URL&&a.protocol!=="file:")throw new TypeError("Must be a file URL.");const o=new vle;o.onmessage=e;const s=await rt("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:n,onEvent:o});return()=>{Ile(s)}}async function T7e(t,e,r){const n={recursive:!1,...r,delayMs:null},i=Array.isArray(t)?t:[t];for(const a of i)if(a instanceof URL&&a.protocol!=="file:")throw new TypeError("Must be a file URL.");const o=new vle;o.onmessage=e;const s=await rt("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:n,onEvent:o});return()=>{Ile(s)}}const V$=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return mn},FileHandle:B5,get SeekMode(){return Hj},copyFile:w7e,create:b7e,exists:U$,lstat:C7e,mkdir:Jj,open:x7e,readDir:W5,readFile:kle,readTextFile:z$,readTextFileLines:S7e,remove:Ple,rename:$le,stat:_7e,truncate:k7e,watch:$7e,watchImmediate:T7e,writeFile:P7e,writeTextFile:Tle},Symbol.toStringTag,{value:"Module"}));class Pr{static utils=null;static async getUtils(){return Pr.utils||(Pr.utils=Br()?await Promise.resolve().then(()=>require("./replay-tauri-path-k_2_BOKf.js")):await Promise.resolve().then(()=>m_e)),Pr.utils}static async dirname(e){return(await Pr.getUtils()).dirname(e)}static async join(...e){return(await Pr.getUtils()).join(...e)}static async resolve(e){return(await Pr.getUtils()).resolve(e)}static async isAbsolute(e){return(await Pr.getUtils()).isAbsolute(e)}static async relative(e,r){return(await Pr.getUtils()).relative(e,r)}static async extname(e){return(await Pr.getUtils()).extname(e)}}class Z5{listeners=new Map;on(e,r){let n=this.listeners.get(e);n||(n=new Set,this.listeners.set(e,n)),n.add(r)}off(e,r){this.listeners.get(e)?.delete(r)}emit(e,r){const n=this.listeners.get(e);if(n)for(const i of n)i(r)}subscribe(e,r){return this.on(e,r),()=>{this.off(e,r)}}removeAllListeners(e){if(e!==void 0){this.listeners.delete(e);return}this.listeners.clear()}}const I7e=new Set(["node_modules"]);class Kj extends Z5{constructor(e){super(),this.baseDir=e,this.initializeDirectory(e)}writeExcludedKeys=new Set;writeEndTimers=new Map;async initializeDirectory(e){await Jj(e,{recursive:!0})}setWriteExcludedKeys(e){this.writeExcludedKeys=e}async ls(e){const r=await this.getFullPath(e);return this.getDirEntryFilesRecursively(r)}async getDirEntryFilesRecursively(e){try{const r=[],n=await W5(e);for(const i of n)if(i.isDirectory){if(I7e.has(i.name))continue;const o=await vg(e,i.name),s=await this.getDirEntryFilesRecursively(o);r.push(...s)}else{const o=await vg(e,i.name),s=await Pr.relative(this.baseDir,o);r.push(s)}return r}catch(r){return r.includes("forbidden path")||console.error(r),[]}}async get(e){const r=await this.getFullPath(e);try{return await z$(r)}catch(n){return!n.includes("No such file or directory")&&!n.includes("forbidden path")&&console.error(n),null}}async has(e){const r=await this.getFullPath(e);return await U$(r)}async set(e,r){if(!this.writeExcludedKeys.has(e)){this.emit("write-start",e);try{const n=await this.getFullPath(e),i=U5(),o=n.split(i).slice(0,-1).join(i);await Jj(o,{recursive:!0}),await Tle(n,r)}finally{const n=this.writeEndTimers.get(e);n&&clearTimeout(n);const i=setTimeout(()=>{this.emit("write-end",e),this.writeEndTimers.delete(e)},1e3);this.writeEndTimers.set(e,i)}}}async remove(e){if(!this.writeExcludedKeys.has(e)){this.emit("write-start",e);try{const r=await this.getFullPath(e);await Ple(r)}catch(r){!r.includes("No such file or directory")&&!r.includes("forbidden path")&&console.error(r)}finally{const r=this.writeEndTimers.get(e);r&&clearTimeout(r);const n=setTimeout(()=>{this.emit("write-end",e),this.writeEndTimers.delete(e)},1e3);this.writeEndTimers.set(e,n)}}}async rename(e,r){const n=await this.getFullPath(e),i=await this.getFullPath(r);await $le(n,i)}async getFullPath(e){return await vg(this.baseDir,e??"")}}class E7e{baseDir="";async ls(e=""){return[]}async get(e){return null}async has(e){return!1}async set(e,r){}async remove(e){}async rename(e,r){}setWriteExcludedKeys(e){}on(e,r){}off(e,r){}}class A7e{constructor(e){this.projectId=e}async get(){const e=this.getKey();return localStorage.getItem(e)??null}async set(e){const r=this.getKey();localStorage.setItem(r,e)}async remove(){const e=this.getKey();localStorage.removeItem(e)}getKey(){return`replay:secrets:${this.projectId}`}}class Ele{constructor(e){this.storage=e}itemIds=[];async getAbsolutePath(e){return await Pr.resolve(await Pr.join(this.storage.baseDir,"/",e))}async parseMany(e,r){return(await Promise.all(e.map(async i=>{try{return await this.parse(i,r)}catch(o){return console.error(`Error parsing from ${i.type} ${i.uri}:`,o),null}}))).filter(i=>i!==null)}setItemIds(e){this.itemIds=e}async write(e){e.state===Tr.Draft||e.srcType!==To.FS||await this.storage.set(e.id,await this.stringify(e))}async remove(e){await this.storage.remove(e)}async updateRoot(e,r){const n=e.actions;if(n){for(const o in n){const s=parseInt(o);switch(n[o]){case"D":await this.remove(this.itemIds[s]);break;case"I":case"U":await this.write(r[s]);break}}return}const i=this.itemIds.filter(o=>!r.some(s=>s.id===o));await Promise.all([...r.map(o=>this.write(o)),...i.map(o=>this.remove(o))])}async update(e,r){const i={path:e.path.slice(1),actions:e.actions};if(i.path.length===0&&await this.updateRoot(i,r),i.path.length>0){const o=i.path[0];i.path.length===1&&i.actions&&i.actions.id==="U"&&await this.remove(this.itemIds[o]),i.path[1]&&i.path[1]==="id"&&await this.remove(this.itemIds[o]),await this.write(r[o])}this.itemIds=r.map(o=>o.id)}}class R7e extends Ele{parse(e){return{...e.content,id:e.uri,srcType:e.type,fileDependencies:e.fileDependencies}}async stringify(e){const{id:r,srcType:n,fileDependencies:i,...o}=e;return await Pr.extname(r)===".json"?JSON.stringify(o,null,2):Ff.dump(o)}async write(e){await this.storage.has(e.id)||await super.write(e)}}var Wi=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(Wi||{});class ok{constructor(e,r={},n){this.pattern=e,this.separator=r.separator||".",this.segments=this._parse(e),this.data=n,this._hasDeepWildcard=this.segments.some(i=>i.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(i=>i.attrName!==void 0),this._hasPositionSelector=this.segments.some(i=>i.position!==void 0)}_parse(e){const r=[];let n=0,i="";for(;n<e.length;)e[n]===this.separator?n+1<e.length&&e[n+1]===this.separator?(i.trim()&&(r.push(this._parseSegment(i.trim())),i=""),r.push({type:"deep-wildcard"}),n+=2):(i.trim()&&r.push(this._parseSegment(i.trim())),i="",n++):(i+=e[n],n++);return i.trim()&&r.push(this._parseSegment(i.trim())),r}_parseSegment(e){const r={type:"tag"};let n=null,i=e;const o=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(o&&(i=o[1]+o[3],o[2])){const u=o[2].slice(1,-1);u&&(n=u)}let s,a=i;if(i.includes("::")){const u=i.indexOf("::");if(s=i.substring(0,u).trim(),a=i.substring(u+2).trim(),!s)throw new Error(`Invalid namespace in pattern: ${e}`)}let l,c=null;if(a.includes(":")){const u=a.lastIndexOf(":"),d=a.substring(0,u).trim(),p=a.substring(u+1).trim();["first","last","odd","even"].includes(p)||/^nth\(\d+\)$/.test(p)?(l=d,c=p):l=a}else l=a;if(!l)throw new Error(`Invalid segment pattern: ${e}`);if(r.tag=l,s&&(r.namespace=s),n)if(n.includes("=")){const u=n.indexOf("=");r.attrName=n.substring(0,u).trim(),r.attrValue=n.substring(u+1).trim()}else r.attrName=n.trim();if(c){const u=c.match(/^nth\((\d+)\)$/);u?(r.position="nth",r.positionValue=parseInt(u[1],10)):r.position=c}return r}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class j7e{constructor(e){this._matcher=e}get separator(){return this._matcher.separator}getCurrentTag(){const e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){const e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){const r=this._matcher.path;if(r.length!==0)return r[r.length-1].values?.[e]}hasAttr(e){const r=this._matcher.path;if(r.length===0)return!1;const n=r[r.length-1];return n.values!==void 0&&e in n.values}getPosition(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,r=!0){return this._matcher.toString(e,r)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}}class Ale{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new j7e(this)}push(e,r=null,n=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const i=this.path.length;this.siblingStacks[i]||(this.siblingStacks[i]=new Map);const o=this.siblingStacks[i],s=n?`${n}:${e}`:e,a=o.get(s)||0;let l=0;for(const u of o.values())l+=u;o.set(s,a+1);const c={tag:e,position:l,counter:a};n!=null&&(c.namespace=n),r!=null&&(c.values=r),this.path.push(c)}pop(){if(this.path.length===0)return;this._pathStringCache=null;const e=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),e}updateCurrent(e){if(this.path.length>0){const r=this.path[this.path.length-1];e!=null&&(r.values=e)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return!1;const r=this.path[this.path.length-1];return r.values!==void 0&&e in r.values}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,r=!0){const n=e||this.separator;if(n===this.separator&&r===!0){if(this._pathStringCache!==null)return this._pathStringCache;const o=this.path.map(s=>s.namespace?`${s.namespace}:${s.tag}`:s.tag).join(n);return this._pathStringCache=o,o}return this.path.map(o=>r&&o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(n)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[]}matches(e){const r=e.segments;return r.length===0?!1:e.hasDeepWildcard()?this._matchWithDeepWildcard(r):this._matchSimple(r)}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let r=0;r<e.length;r++)if(!this._matchSegment(e[r],this.path[r],r===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(e){let r=this.path.length-1,n=e.length-1;for(;n>=0&&r>=0;){const i=e[n];if(i.type==="deep-wildcard"){if(n--,n<0)return!0;const o=e[n];let s=!1;for(let a=r;a>=0;a--)if(this._matchSegment(o,this.path[a],a===this.path.length-1)){r=a-1,n--,s=!0;break}if(!s)return!1}else{if(!this._matchSegment(i,this.path[r],r===this.path.length-1))return!1;r--,n--}}return n<0}_matchSegment(e,r,n){if(e.tag!=="*"&&e.tag!==r.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==r.namespace||e.attrName!==void 0&&(!n||!r.values||!(e.attrName in r.values)||e.attrValue!==void 0&&String(r.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!n)return!1;const i=r.counter??0;if(e.position==="first"&&i!==0)return!1;if(e.position==="odd"&&i%2!==1)return!1;if(e.position==="even"&&i%2!==0)return!1;if(e.position==="nth"&&i!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>new Map(e))}}restore(e){this._pathStringCache=null,this.path=e.path.map(r=>({...r})),this.siblingStacks=e.siblingStacks.map(r=>new Map(r))}readOnly(){return this._view}}function Rle(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function jle(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function Vg(t){return String(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const Nle=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",N7e=Nle+"\\-\\.\\d·̀-ͯ‿-⁀",Mle=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",M7e=Mle+"\\-\\.\\d·̀-ͯ҇‿-⁀",Dle=(t,e,r="")=>{const n=t.replace(":",""),i=e.replace(":",""),o=`[${n}][${i}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,r),ncName:new RegExp(`^${o}$`,r),qName:new RegExp(`^${o}(?::${o})?$`,r),nmToken:new RegExp(`^[${e}]+$`,r),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,r)}},D7e=Dle(Nle,N7e),Q7e=Dle(Mle,M7e,"u"),L7e=(t="1.0")=>t==="1.1"?Q7e:D7e,Qle=(t,{xmlVersion:e="1.0"}={})=>L7e(e).qName.test(t),q7e=`
318
+ ${q}`),te.pop(),`{${A}}`}case"number":return isFinite(H)?String(H):O?O(H):"null";case"boolean":return H===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(H);default:return O?O(H):void 0}}function L(X,H,te){switch(typeof H){case"string":return o(H);case"object":{if(H===null)return"null";if(typeof H.toJSON=="function"){if(H=H.toJSON(X),typeof H!="object")return L(X,H,te);if(H===null)return"null"}if(te.indexOf(H)!==-1)return w;let re="";const ce=H.length!==void 0;if(ce&&Array.isArray(H)){if(H.length===0)return"[]";if(C<te.length+1)return'"[Array]"';te.push(H);const A=Math.min(H.length,$);let Q=0;for(;Q<A-1;Q++){const G=L(String(Q),H[Q],te);re+=G!==void 0?G:"null",re+=","}const W=L(String(Q),H[Q],te);if(re+=W!==void 0?W:"null",H.length-1>$){const G=H.length-$-1;re+=`,"... ${m(G)} not stringified"`}return te.pop(),`[${re}]`}let q=Object.keys(H);const M=q.length;if(M===0)return"{}";if(C<te.length+1)return'"[Object]"';let Z="",V=Math.min(M,$);ce&&l(H)&&(re+=c(H,",",$),q=q.slice(H.length),V-=H.length,Z=","),S&&(q=s(q,_)),te.push(H);for(let A=0;A<V;A++){const Q=q[A],W=L(Q,H[Q],te);W!==void 0&&(re+=`${Z}${o(Q)}:${W}`,Z=",")}if(M>$){const A=M-$;re+=`${Z}"...":"${m(A)} not stringified"`}return te.pop(),`{${re}}`}case"number":return isFinite(H)?String(H):O?O(H):"null";case"boolean":return H===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(H);default:return O?O(H):void 0}}function F(X,H,te){if(arguments.length>1){let re="";if(typeof te=="number"?re=" ".repeat(Math.min(te,10)):typeof te=="string"&&(re=te.slice(0,10)),H!=null){if(typeof H=="function")return j("",{"":X},[],H,re,"");if(Array.isArray(H))return R("",X,[],g(H),re,"")}if(re.length!==0)return D("",X,[],re,"")}return L("",X,[])}return F}})(zS,zS.exports)),zS.exports}var TWe=$We();const IWe=uo(TWe),EWe=IWe.configure;class wb extends fWe{static maxErrorTextChars=4096;static stringify=EWe({maximumDepth:2,maximumBreadth:10});sendErrorEvent;constructor(e,r){super("errors","1.0",e||{}),this.sendErrorEvent=r}static toErrorEvent(e,r){return{type:"error",payload:[{handler:r,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 r=String(e.stack);return r.length>this.maxErrorTextChars?r.substring(0,this.maxErrorTextChars):r}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 r=e.findIndex(i=>i instanceof Error),n=e.filter((i,o)=>o!==r).map(i=>typeof i=="string"?i:i instanceof Error?String(i):this.stringify(i)??String(i)).join(" ").substring(0,this.maxErrorTextChars);if(r===-1)return n;{const i=e[r];return n&&(i.message=`${i.message} ${n}`),i}}onError=e=>{this.sendError(e.error,"window.onerror")};onUnhandledRejection=e=>{this.sendError(e.reason,"window.onunhandledrejection")};patchConsoleError(){return e=>{const r=this;return function(...i){try{const o=wb.combineConsoleErrorArgs(i);r.sendError(o,"console.error")}catch(o){process.env.NODE_ENV!=="production"&&e?.call(this,"Error reporting failed:",o)}e?.apply(this,i)}}}sendError(e,r){this.sendErrorEvent(wb.toErrorEvent(e,r))}}class AWe{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new PWe,this.tracer={traceStep:(e,r)=>{const n=this.constructCloudEvent(e,r,{signal:"trace"});return this.otelClient.traceStep(n)}}}updateCloudEventData=e=>{this.config?.disabled||(this.useCloudEventData=e)};send(e,r,n){try{if(!this.config?.otel.isProd)return;const o=e&&typeof e=="object"&&"type"in e&&"data"in e?e:this.constructCloudEvent(e,r,{...n,signal:"log"});this.sendToOtelService(o)}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 wb(void 0,r=>{this.sendToOtelService({type:r.type,data:r.payload})})]:[],...e.otel.instrumentations||[]]}))}startSpan(e,r,n){if(this.config?.disabled)return;const i=this.constructCloudEvent(e,r,{signal:"trace"});return this.otelClient.startSpan(i,n)}constructCloudEvent(e,r,n){const i={...this.useCloudEventData(),...n};return f9e({type:e,data:r,...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,r){if(this.config?.disabled)return;const n=wb.toErrorEvent(e,r);this.sendToOtelService({type:n.type,data:n.payload})}sendTabChangeMessage(e,r){this.send("com.redocly.tab.change",e,r)}sendButtonClickMessage(e,r){this.send("com.redocly.button.click",e,r)}sendTabOpenFailedMessage(e,r){this.send("com.redocly.tab.openFailed",e,r)}sendChangeMessage(e,r){this.send("com.redocly.change.occurred",e,r)}sendContentCopyMessage(e,r){this.send("com.redocly.content.copy",e,r)}sendRequestSendMessage(e,r){this.send("com.redocly.request.send",e,r)}sendTokenGenerateMessage(e,r){this.send("com.redocly.token.generate",e,r)}sendAppLifecycleMessage(e,r){this.send("com.redocly.app.lifecycle",e,r)}sendEnvironmentManagementMessage(e,r){this.send("com.redocly.environment.management",e,r)}sendServerManagementMessage(e,r){this.send("com.redocly.server.management",e,r)}sendSourceManagementMessage(e,r){this.send("com.redocly.source.management",e,r)}sendInputManagementMessage(e,r){this.send("com.redocly.input.management",e,r)}sendNodeManagementMessage(e,r){this.send("com.redocly.node.management",e,r)}sendHistoryManagementMessage(e,r){this.send("com.redocly.history.management",e,r)}sendHistoryMigrationMessage(e,r){this.send("com.redocly.history.migration",e,r)}sendCredentialManagementMessage(e,r){this.send("com.redocly.credential.management",e,r)}sendPanelToggleMessage(e,r){this.send("com.redocly.panel.toggle",e,r)}sendWorkflowRunClickMessage(e,r){this.send("com.redocly.workflowRun.click",e,r)}sendWorkflowRunResultMessage(e,r){this.send("com.redocly.workflowRun.result",e,r)}sendStorageReadMessage(e){this.send("com.redocly.storage.read",void 0,e)}sendStorageLoadUserStateMessage(e){this.send("com.redocly.storage.loadUserState",void 0,e)}sendStorageDetectFilesMessage(e){this.send("com.redocly.storage.detectFiles",void 0,e)}sendStorageLoadApisMessage(e){this.send("com.redocly.storage.loadApis",void 0,e)}sendStorageParseApisMessage(e){this.send("com.redocly.storage.parseApis",void 0,e)}sendStorageParseCollectionsMessage(e){this.send("com.redocly.storage.parseCollections",void 0,e)}sendUpdaterCheckMessage(e){this.send("com.redocly.updater.check",void 0,e)}sendUpdaterDownloadMessage(e){this.send("com.redocly.updater.download",void 0,e)}sendUpdaterInstallMessage(e){this.send("com.redocly.updater.install",void 0,e)}sendUpdaterProcessMessage(e){this.send("com.redocly.updater.process",void 0,e)}sendErrorMessage(e,r){this.send("com.redocly.error.occurred",e,r)}sendBackendEventMessage(e,r){this.send("com.redocly.backend.event",e,r)}sendCodeEditorSearchMessage(e,r){this.send("com.redocly.codeEditor.search",e,r)}sendAiChatToolCallStartedMessage(e,r){this.send("com.redocly.aiChat.toolCallStarted",e,r)}sendAiChatToolCallFinishedMessage(e,r){this.send("com.redocly.aiChat.toolCallFinished",e,r)}sendAiChatConversationStartedMessage(e,r){this.send("com.redocly.aiChat.conversationStarted",e,r)}sendAiChatConversationFinishedMessage(e,r){this.send("com.redocly.aiChat.conversationFinished",e,r)}}const Iy=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],RWe="https://cors.redocly.com/";function La(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var CW=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),kW=function(){return Math.random().toString(36).substring(7).split("").join(".")},PW={INIT:"@@redux/INIT"+kW(),REPLACE:"@@redux/REPLACE"+kW()};function jWe(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function NWe(t){if(t===void 0)return"undefined";if(t===null)return"null";var e=typeof t;switch(e){case"boolean":case"string":case"number":case"symbol":case"function":return e}if(Array.isArray(t))return"array";if(QWe(t))return"date";if(DWe(t))return"error";var r=MWe(t);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return e.slice(8,-1).toLowerCase().replace(/\s/g,"")}function MWe(t){return typeof t.constructor=="function"?t.constructor.name:null}function DWe(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function QWe(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function cm(t){var e=typeof t;return process.env.NODE_ENV!=="production"&&(e=NWe(t)),e}function mle(t,e,r){var n;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?La(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?La(1):"Expected the enhancer to be a function. Instead, received: '"+cm(r)+"'");return r(mle)(t,e)}if(typeof t!="function")throw new Error(process.env.NODE_ENV==="production"?La(2):"Expected the root reducer to be a function. Instead, received: '"+cm(t)+"'");var i=t,o=e,s=[],a=s,l=!1;function c(){a===s&&(a=s.slice())}function u(){if(l)throw new Error(process.env.NODE_ENV==="production"?La(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return o}function d(g){if(typeof g!="function")throw new Error(process.env.NODE_ENV==="production"?La(4):"Expected the listener to be a function. Instead, received: '"+cm(g)+"'");if(l)throw new Error(process.env.NODE_ENV==="production"?La(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var y=!0;return c(),a.push(g),function(){if(y){if(l)throw new Error(process.env.NODE_ENV==="production"?La(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");y=!1,c();var b=a.indexOf(g);a.splice(b,1),s=null}}}function p(g){if(!jWe(g))throw new Error(process.env.NODE_ENV==="production"?La(7):"Actions must be plain objects. Instead, the actual type was: '"+cm(g)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof g.type>"u")throw new Error(process.env.NODE_ENV==="production"?La(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(l)throw new Error(process.env.NODE_ENV==="production"?La(9):"Reducers may not dispatch actions.");try{l=!0,o=i(o,g)}finally{l=!1}for(var y=s=a,v=0;v<y.length;v++){var b=y[v];b()}return g}function f(g){if(typeof g!="function")throw new Error(process.env.NODE_ENV==="production"?La(10):"Expected the nextReducer to be a function. Instead, received: '"+cm(g));i=g,p({type:PW.REPLACE})}function m(){var g,y=d;return g={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?La(11):"Expected the observer to be an object. Instead, received: '"+cm(b)+"'");function O(){b.next&&b.next(u())}O();var w=y(O);return{unsubscribe:w}}},g[CW]=function(){return this},g}return p({type:PW.INIT}),n={dispatch:p,subscribe:d,getState:u,replaceReducer:f},n[CW]=m,n}function LWe(t){typeof console<"u"&&typeof console.error=="function"&&console.error(t);try{throw new Error(t)}catch{}}function Op(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(n){return n}:e.length===1?e[0]:e.reduce(function(n,i){return function(){return n(i.apply(void 0,arguments))}})}function $W(){}process.env.NODE_ENV!=="production"&&typeof $W.name=="string"&&$W.name!=="isCrushed"&&LWe('You are currently using minified code outside of NODE_ENV === "production". This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) to ensure you have the correct code for your production build.');function qWe(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];if(e.length!==0)return typeof e[0]=="object"?Op:Op(...e)}process.env.NODE_ENV!=="production"&&typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;process.env.NODE_ENV!=="production"&&typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;const zWe=Object.keys||function(t){const e=[];for(const r in t)({}).hasOwnProperty.call(t,r)&&e.push(r);return e};function UWe(t,e,r){const n=zWe(t),i={};for(let o=0,s=n.length;o<s;o++){const a=n[o];i[a]=t[a]}return i[e]=r,i}function z5(t){const e=t||{};return e.features={pause:!0,export:!0,test:!0},e.type="redux",e.autoPause===void 0&&(e.autoPause=!0),e.latency===void 0&&(e.latency=500),function(r){return function(n,i){const o=r(n,i),s=o.dispatch,a=window.__REDUX_DEVTOOLS_EXTENSION__.connect(e);a.init(o.getState());const l=function(c){const u=s(c);return a.send(c,o.getState()),u};return Object.assign?Object.assign(o,{dispatch:l}):UWe(o,"dispatch",l)}}}function TW(t){return function(){return Op(Op(...arguments),z5(t))}}function VWe(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];if(typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__)return e.length===0?z5():typeof e[0]=="object"?TW(e[0]):TW()(...e);if(e.length!==0)return typeof e[0]=="object"?Op:Op(...e)}const FWe=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?z5:function(){return function(t){return t}};function BWe(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];if(e.length!==0)return typeof e[0]=="object"?Op:Op(...e)}process.env.NODE_ENV==="production"||typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;process.env.NODE_ENV==="production"||typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;const WWe=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(t){return t}};function ZWe(t,e,r){var n=!1,i=!1,o=mle(function(a,l){if(!i){var c=function(y){return Array.isArray(y)&&y.findIndex(function(v){return typeof v!="string"&&typeof v!="number"})===-1};if(l.type.startsWith("SET")){var u=function(y){try{n=!0,"value"in l?y.set(l.value):y.set(Zt)}finally{n=!1}};if(l.path){if(c(l.path)){l.path.length===0&&u(t);for(var d=t,p=!0,f=0,m=l.path;f<m.length;f++){var g=m[f];d[g]?d=d[g]:p=!1}p&&u(d)}}else u(t)}else l.type==="BREAKPOINT"&&r()}return t.promised||t.error?Zt:t.get({noproxy:!0})},WWe({name:"".concat(window.location.hostname,": ").concat(e),trace:!0,traceLimit:16,autoPause:!0,shouldHotReload:!1,features:{persist:!0,pause:!0,lock:!1,export:"custom",import:"custom",jump:!1,skip:!1,reorder:!1,dispatch:!0,test:!1}})),s=function(a,l){if(n)l&&l();else try{i=!0,o.dispatch(a)}finally{i=!1}};return s}function XWe(t){return function(){var e,r,n=!1;return{onInit:function(i,o){if(!(typeof window>"u"||!("__REDUX_DEVTOOLS_EXTENSION__"in window))){if(t?.key===void 0){if(o.identifier===void 0)throw Error("State is missing Identifiable extension or Devtools key option");e=o.identifier(i)}else e=t.key;r=ZWe(i,e,function(){n=!n}),i.promise||r?.({type:"CREATE",state:i.get({noproxy:!0,stealth:!0})})}},onSet:function(i,o){if(r?.({type:"SET [".concat(i.path.join("/"),"]"),state:i.get({noproxy:!0,stealth:!0}),descriptor:o}),n)debugger},onDestroy:function(){r?.({type:"DESTROY"})}}}}var Tr=(t=>(t.Normal="Normal",t.Edit="Edit",t.Draft="Draft",t))(Tr||{});const q0="default",gle=[{name:q0,inputs:[],servers:[],state:Tr.Normal}],Xj={activeTabIdx:0,tabs:[]};var Pc=(t=>(t.Idle="idle",t.Loading="loading",t.Success="success",t.Error="error",t))(Pc||{});function ql(t){const e=new WeakMap;function r(n){if(typeof n!="object"||n===null)return n;if(e.has(n))return e.get(n);const i=Array.isArray(n)?[]:{};e.set(n,i);for(const o in n)Object.prototype.hasOwnProperty.call(n,o)&&(i[o]=r(n[o]));return i}return r(t)}function Gj(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!Gj(t[i],e[i]))return!1;return!0}const r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(let i=0;i<r.length;i++){const o=r[i];if(!Object.prototype.hasOwnProperty.call(e,o)||!Gj(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function IW(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}function js(t,e,r,n){if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function s_(t,e,r,n,i){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,r),r}var um,hc,dm,a_;const EW="__TAURI_TO_IPC_KEY__";function yle(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}class vle{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,um.set(this,()=>{}),hc.set(this,0),dm.set(this,[]),this.id=yle(({message:e,id:r})=>{if(r==js(this,hc,"f"))for(js(this,um,"f").call(this,e),s_(this,hc,js(this,hc,"f")+1);js(this,hc,"f")in js(this,dm,"f");){const n=js(this,dm,"f")[js(this,hc,"f")];js(this,um,"f").call(this,n),delete js(this,dm,"f")[js(this,hc,"f")],s_(this,hc,js(this,hc,"f")+1)}else js(this,dm,"f")[r]=e})}set onmessage(e){s_(this,um,e)}get onmessage(){return js(this,um,"f")}[(um=new WeakMap,hc=new WeakMap,dm=new WeakMap,EW)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[EW]()}}async function rt(t,e={},r){return window.__TAURI_INTERNALS__.invoke(t,e,r)}class GWe{get rid(){return js(this,a_,"f")}constructor(e){a_.set(this,void 0),s_(this,a_,e)}async close(){return rt("plugin:resources|close",{rid:this.rid})}}a_=new WeakMap;function Br(){return!!window?.__TAURI__}async function Yj(t,e,r){const n=[],i=[];for(const o of t){const s=Promise.resolve().then(()=>r(o,t));if(n.push(s),e<=t.length){const a=s.then(()=>i.splice(i.indexOf(a),1));i.push(a),i.length>=e&&await Promise.race(i)}}return Promise.all(n)}const To={FS:"fs",WEB:"web"};var mn;(function(t){t[t.Audio=1]="Audio",t[t.Cache=2]="Cache",t[t.Config=3]="Config",t[t.Data=4]="Data",t[t.LocalData=5]="LocalData",t[t.Document=6]="Document",t[t.Download=7]="Download",t[t.Picture=8]="Picture",t[t.Public=9]="Public",t[t.Video=10]="Video",t[t.Resource=11]="Resource",t[t.Temp=12]="Temp",t[t.AppConfig=13]="AppConfig",t[t.AppData=14]="AppData",t[t.AppLocalData=15]="AppLocalData",t[t.AppCache=16]="AppCache",t[t.AppLog=17]="AppLog",t[t.Desktop=18]="Desktop",t[t.Executable=19]="Executable",t[t.Font=20]="Font",t[t.Home=21]="Home",t[t.Runtime=22]="Runtime",t[t.Template=23]="Template"})(mn||(mn={}));async function YWe(){return rt("plugin:path|resolve_directory",{directory:mn.AppConfig})}async function Ole(){return rt("plugin:path|resolve_directory",{directory:mn.AppData})}async function HWe(){return rt("plugin:path|resolve_directory",{directory:mn.AppLocalData})}async function JWe(){return rt("plugin:path|resolve_directory",{directory:mn.AppCache})}async function KWe(){return rt("plugin:path|resolve_directory",{directory:mn.Audio})}async function e7e(){return rt("plugin:path|resolve_directory",{directory:mn.Cache})}async function t7e(){return rt("plugin:path|resolve_directory",{directory:mn.Config})}async function r7e(){return rt("plugin:path|resolve_directory",{directory:mn.Data})}async function ble(){return rt("plugin:path|resolve_directory",{directory:mn.Desktop})}async function n7e(){return rt("plugin:path|resolve_directory",{directory:mn.Document})}async function i7e(){return rt("plugin:path|resolve_directory",{directory:mn.Download})}async function o7e(){return rt("plugin:path|resolve_directory",{directory:mn.Executable})}async function s7e(){return rt("plugin:path|resolve_directory",{directory:mn.Font})}async function a7e(){return rt("plugin:path|resolve_directory",{directory:mn.Home})}async function l7e(){return rt("plugin:path|resolve_directory",{directory:mn.LocalData})}async function c7e(){return rt("plugin:path|resolve_directory",{directory:mn.Picture})}async function u7e(){return rt("plugin:path|resolve_directory",{directory:mn.Public})}async function d7e(){return rt("plugin:path|resolve_directory",{directory:mn.Resource})}async function p7e(t){return rt("plugin:path|resolve_directory",{directory:mn.Resource,path:t})}async function f7e(){return rt("plugin:path|resolve_directory",{directory:mn.Runtime})}async function h7e(){return rt("plugin:path|resolve_directory",{directory:mn.Template})}async function m7e(){return rt("plugin:path|resolve_directory",{directory:mn.Video})}async function g7e(){return rt("plugin:path|resolve_directory",{directory:mn.AppLog})}async function y7e(){return rt("plugin:path|resolve_directory",{directory:mn.Temp})}function U5(){return window.__TAURI_INTERNALS__.plugins.path.sep}function v7e(){return window.__TAURI_INTERNALS__.plugins.path.delimiter}async function xle(...t){return rt("plugin:path|resolve",{paths:t})}async function O7e(t){return rt("plugin:path|normalize",{path:t})}async function vg(...t){return rt("plugin:path|join",{paths:t})}async function wle(t){return rt("plugin:path|dirname",{path:t})}async function Sle(t){return rt("plugin:path|extname",{path:t})}async function V5(t,e){return rt("plugin:path|basename",{path:t,ext:e})}async function _le(t){return rt("plugin:path|is_absolute",{path:t})}const Cle=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return mn},appCacheDir:JWe,appConfigDir:YWe,appDataDir:Ole,appLocalDataDir:HWe,appLogDir:g7e,audioDir:KWe,basename:V5,cacheDir:e7e,configDir:t7e,dataDir:r7e,delimiter:v7e,desktopDir:ble,dirname:wle,documentDir:n7e,downloadDir:i7e,executableDir:o7e,extname:Sle,fontDir:s7e,homeDir:a7e,isAbsolute:_le,join:vg,localDataDir:l7e,normalize:O7e,pictureDir:c7e,publicDir:u7e,resolve:xle,resolveResource:p7e,resourceDir:d7e,runtimeDir:f7e,sep:U5,tempDir:y7e,templateDir:h7e,videoDir:m7e},Symbol.toStringTag,{value:"Module"}));var Hj;(function(t){t[t.Start=0]="Start",t[t.Current=1]="Current",t[t.End=2]="End"})(Hj||(Hj={}));function F5(t){return{isFile:t.isFile,isDirectory:t.isDirectory,isSymlink:t.isSymlink,size:t.size,mtime:t.mtime!==null?new Date(t.mtime):null,atime:t.atime!==null?new Date(t.atime):null,birthtime:t.birthtime!==null?new Date(t.birthtime):null,readonly:t.readonly,fileAttributes:t.fileAttributes,dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,blksize:t.blksize,blocks:t.blocks}}class B5 extends GWe{async read(e){if(e.byteLength===0)return 0;const[r,n]=await rt("plugin:fs|read",{rid:this.rid,len:e.byteLength});return e.set(r),n===0?null:n}async seek(e,r){return await rt("plugin:fs|seek",{rid:this.rid,offset:e,whence:r})}async stat(){const e=await rt("plugin:fs|fstat",{rid:this.rid});return F5(e)}async truncate(e){await rt("plugin:fs|ftruncate",{rid:this.rid,len:e})}async write(e){return await rt("plugin:fs|write",{rid:this.rid,data:e})}}async function b7e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=await rt("plugin:fs|create",{path:t instanceof URL?t.toString():t,options:e});return new B5(r)}async function x7e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=await rt("plugin:fs|open",{path:t instanceof URL?t.toString():t,options:e});return new B5(r)}async function w7e(t,e,r){if(t instanceof URL&&t.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await rt("plugin:fs|copy_file",{fromPath:t instanceof URL?t.toString():t,toPath:e instanceof URL?e.toString():e,options:r})}async function Jj(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await rt("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})}async function W5(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await rt("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})}async function kle(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=await rt("plugin:fs|read_file",{path:t instanceof URL?t.toString():t,options:e});return r instanceof ArrayBuffer?new Uint8Array(r):Uint8Array.from(r)}async function z$(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await rt("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e})}async function S7e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=t instanceof URL?t.toString():t;return await Promise.resolve({path:r,rid:null,async next(){this.rid===null&&(this.rid=await rt("plugin:fs|read_text_file_lines",{path:r,options:e}));const[n,i]=await rt("plugin:fs|read_text_file_lines_next",{rid:this.rid});return i&&(this.rid=null),{value:i?"":n,done:i}},[Symbol.asyncIterator](){return this}})}async function Ple(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await rt("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})}async function $le(t,e,r){if(t instanceof URL&&t.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await rt("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:r})}async function _7e(t,e){const r=await rt("plugin:fs|stat",{path:t instanceof URL?t.toString():t,options:e});return F5(r)}async function C7e(t,e){const r=await rt("plugin:fs|lstat",{path:t instanceof URL?t.toString():t,options:e});return F5(r)}async function k7e(t,e,r){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await rt("plugin:fs|truncate",{path:t instanceof URL?t.toString():t,len:e,options:r})}async function P7e(t,e,r){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await rt("plugin:fs|write_file",e,{headers:{path:t instanceof URL?t.toString():t,options:JSON.stringify(r)}})}async function Tle(t,e,r){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await rt("plugin:fs|write_text_file",{path:t instanceof URL?t.toString():t,data:e,options:r})}async function U$(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await rt("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})}async function Ile(t){await rt("plugin:fs|unwatch",{rid:t})}async function $7e(t,e,r){const n={recursive:!1,delayMs:2e3,...r},i=Array.isArray(t)?t:[t];for(const a of i)if(a instanceof URL&&a.protocol!=="file:")throw new TypeError("Must be a file URL.");const o=new vle;o.onmessage=e;const s=await rt("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:n,onEvent:o});return()=>{Ile(s)}}async function T7e(t,e,r){const n={recursive:!1,...r,delayMs:null},i=Array.isArray(t)?t:[t];for(const a of i)if(a instanceof URL&&a.protocol!=="file:")throw new TypeError("Must be a file URL.");const o=new vle;o.onmessage=e;const s=await rt("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:n,onEvent:o});return()=>{Ile(s)}}const V$=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return mn},FileHandle:B5,get SeekMode(){return Hj},copyFile:w7e,create:b7e,exists:U$,lstat:C7e,mkdir:Jj,open:x7e,readDir:W5,readFile:kle,readTextFile:z$,readTextFileLines:S7e,remove:Ple,rename:$le,stat:_7e,truncate:k7e,watch:$7e,watchImmediate:T7e,writeFile:P7e,writeTextFile:Tle},Symbol.toStringTag,{value:"Module"}));class Pr{static utils=null;static async getUtils(){return Pr.utils||(Pr.utils=Br()?await Promise.resolve().then(()=>require("./replay-tauri-path-DHF_Nlch.js")):await Promise.resolve().then(()=>m_e)),Pr.utils}static async dirname(e){return(await Pr.getUtils()).dirname(e)}static async join(...e){return(await Pr.getUtils()).join(...e)}static async resolve(e){return(await Pr.getUtils()).resolve(e)}static async isAbsolute(e){return(await Pr.getUtils()).isAbsolute(e)}static async relative(e,r){return(await Pr.getUtils()).relative(e,r)}static async extname(e){return(await Pr.getUtils()).extname(e)}}class Z5{listeners=new Map;on(e,r){let n=this.listeners.get(e);n||(n=new Set,this.listeners.set(e,n)),n.add(r)}off(e,r){this.listeners.get(e)?.delete(r)}emit(e,r){const n=this.listeners.get(e);if(n)for(const i of n)i(r)}subscribe(e,r){return this.on(e,r),()=>{this.off(e,r)}}removeAllListeners(e){if(e!==void 0){this.listeners.delete(e);return}this.listeners.clear()}}const I7e=new Set(["node_modules"]);class Kj extends Z5{constructor(e){super(),this.baseDir=e,this.initializeDirectory(e)}writeExcludedKeys=new Set;writeEndTimers=new Map;async initializeDirectory(e){await Jj(e,{recursive:!0})}setWriteExcludedKeys(e){this.writeExcludedKeys=e}async ls(e){const r=await this.getFullPath(e);return this.getDirEntryFilesRecursively(r)}async getDirEntryFilesRecursively(e){try{const r=[],n=await W5(e);for(const i of n)if(i.isDirectory){if(I7e.has(i.name))continue;const o=await vg(e,i.name),s=await this.getDirEntryFilesRecursively(o);r.push(...s)}else{const o=await vg(e,i.name),s=await Pr.relative(this.baseDir,o);r.push(s)}return r}catch(r){return r.includes("forbidden path")||console.error(r),[]}}async get(e){const r=await this.getFullPath(e);try{return await z$(r)}catch(n){return!n.includes("No such file or directory")&&!n.includes("forbidden path")&&console.error(n),null}}async has(e){const r=await this.getFullPath(e);return await U$(r)}async set(e,r){if(!this.writeExcludedKeys.has(e)){this.emit("write-start",e);try{const n=await this.getFullPath(e),i=U5(),o=n.split(i).slice(0,-1).join(i);await Jj(o,{recursive:!0}),await Tle(n,r)}finally{const n=this.writeEndTimers.get(e);n&&clearTimeout(n);const i=setTimeout(()=>{this.emit("write-end",e),this.writeEndTimers.delete(e)},1e3);this.writeEndTimers.set(e,i)}}}async remove(e){if(!this.writeExcludedKeys.has(e)){this.emit("write-start",e);try{const r=await this.getFullPath(e);await Ple(r)}catch(r){!r.includes("No such file or directory")&&!r.includes("forbidden path")&&console.error(r)}finally{const r=this.writeEndTimers.get(e);r&&clearTimeout(r);const n=setTimeout(()=>{this.emit("write-end",e),this.writeEndTimers.delete(e)},1e3);this.writeEndTimers.set(e,n)}}}async rename(e,r){const n=await this.getFullPath(e),i=await this.getFullPath(r);await $le(n,i)}async getFullPath(e){return await vg(this.baseDir,e??"")}}class E7e{baseDir="";async ls(e=""){return[]}async get(e){return null}async has(e){return!1}async set(e,r){}async remove(e){}async rename(e,r){}setWriteExcludedKeys(e){}on(e,r){}off(e,r){}}class A7e{constructor(e){this.projectId=e}async get(){const e=this.getKey();return localStorage.getItem(e)??null}async set(e){const r=this.getKey();localStorage.setItem(r,e)}async remove(){const e=this.getKey();localStorage.removeItem(e)}getKey(){return`replay:secrets:${this.projectId}`}}class Ele{constructor(e){this.storage=e}itemIds=[];async getAbsolutePath(e){return await Pr.resolve(await Pr.join(this.storage.baseDir,"/",e))}async parseMany(e,r){return(await Promise.all(e.map(async i=>{try{return await this.parse(i,r)}catch(o){return console.error(`Error parsing from ${i.type} ${i.uri}:`,o),null}}))).filter(i=>i!==null)}setItemIds(e){this.itemIds=e}async write(e){e.state===Tr.Draft||e.srcType!==To.FS||await this.storage.set(e.id,await this.stringify(e))}async remove(e){await this.storage.remove(e)}async updateRoot(e,r){const n=e.actions;if(n){for(const o in n){const s=parseInt(o);switch(n[o]){case"D":await this.remove(this.itemIds[s]);break;case"I":case"U":await this.write(r[s]);break}}return}const i=this.itemIds.filter(o=>!r.some(s=>s.id===o));await Promise.all([...r.map(o=>this.write(o)),...i.map(o=>this.remove(o))])}async update(e,r){const i={path:e.path.slice(1),actions:e.actions};if(i.path.length===0&&await this.updateRoot(i,r),i.path.length>0){const o=i.path[0];i.path.length===1&&i.actions&&i.actions.id==="U"&&await this.remove(this.itemIds[o]),i.path[1]&&i.path[1]==="id"&&await this.remove(this.itemIds[o]),await this.write(r[o])}this.itemIds=r.map(o=>o.id)}}class R7e extends Ele{parse(e){return{...e.content,id:e.uri,srcType:e.type,fileDependencies:e.fileDependencies}}async stringify(e){const{id:r,srcType:n,fileDependencies:i,...o}=e;return await Pr.extname(r)===".json"?JSON.stringify(o,null,2):Ff.dump(o)}async write(e){await this.storage.has(e.id)||await super.write(e)}}var Wi=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(Wi||{});class ok{constructor(e,r={},n){this.pattern=e,this.separator=r.separator||".",this.segments=this._parse(e),this.data=n,this._hasDeepWildcard=this.segments.some(i=>i.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(i=>i.attrName!==void 0),this._hasPositionSelector=this.segments.some(i=>i.position!==void 0)}_parse(e){const r=[];let n=0,i="";for(;n<e.length;)e[n]===this.separator?n+1<e.length&&e[n+1]===this.separator?(i.trim()&&(r.push(this._parseSegment(i.trim())),i=""),r.push({type:"deep-wildcard"}),n+=2):(i.trim()&&r.push(this._parseSegment(i.trim())),i="",n++):(i+=e[n],n++);return i.trim()&&r.push(this._parseSegment(i.trim())),r}_parseSegment(e){const r={type:"tag"};let n=null,i=e;const o=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(o&&(i=o[1]+o[3],o[2])){const u=o[2].slice(1,-1);u&&(n=u)}let s,a=i;if(i.includes("::")){const u=i.indexOf("::");if(s=i.substring(0,u).trim(),a=i.substring(u+2).trim(),!s)throw new Error(`Invalid namespace in pattern: ${e}`)}let l,c=null;if(a.includes(":")){const u=a.lastIndexOf(":"),d=a.substring(0,u).trim(),p=a.substring(u+1).trim();["first","last","odd","even"].includes(p)||/^nth\(\d+\)$/.test(p)?(l=d,c=p):l=a}else l=a;if(!l)throw new Error(`Invalid segment pattern: ${e}`);if(r.tag=l,s&&(r.namespace=s),n)if(n.includes("=")){const u=n.indexOf("=");r.attrName=n.substring(0,u).trim(),r.attrValue=n.substring(u+1).trim()}else r.attrName=n.trim();if(c){const u=c.match(/^nth\((\d+)\)$/);u?(r.position="nth",r.positionValue=parseInt(u[1],10)):r.position=c}return r}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class j7e{constructor(e){this._matcher=e}get separator(){return this._matcher.separator}getCurrentTag(){const e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){const e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){const r=this._matcher.path;if(r.length!==0)return r[r.length-1].values?.[e]}hasAttr(e){const r=this._matcher.path;if(r.length===0)return!1;const n=r[r.length-1];return n.values!==void 0&&e in n.values}getPosition(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,r=!0){return this._matcher.toString(e,r)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}}class Ale{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new j7e(this)}push(e,r=null,n=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const i=this.path.length;this.siblingStacks[i]||(this.siblingStacks[i]=new Map);const o=this.siblingStacks[i],s=n?`${n}:${e}`:e,a=o.get(s)||0;let l=0;for(const u of o.values())l+=u;o.set(s,a+1);const c={tag:e,position:l,counter:a};n!=null&&(c.namespace=n),r!=null&&(c.values=r),this.path.push(c)}pop(){if(this.path.length===0)return;this._pathStringCache=null;const e=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),e}updateCurrent(e){if(this.path.length>0){const r=this.path[this.path.length-1];e!=null&&(r.values=e)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return!1;const r=this.path[this.path.length-1];return r.values!==void 0&&e in r.values}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,r=!0){const n=e||this.separator;if(n===this.separator&&r===!0){if(this._pathStringCache!==null)return this._pathStringCache;const o=this.path.map(s=>s.namespace?`${s.namespace}:${s.tag}`:s.tag).join(n);return this._pathStringCache=o,o}return this.path.map(o=>r&&o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(n)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[]}matches(e){const r=e.segments;return r.length===0?!1:e.hasDeepWildcard()?this._matchWithDeepWildcard(r):this._matchSimple(r)}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let r=0;r<e.length;r++)if(!this._matchSegment(e[r],this.path[r],r===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(e){let r=this.path.length-1,n=e.length-1;for(;n>=0&&r>=0;){const i=e[n];if(i.type==="deep-wildcard"){if(n--,n<0)return!0;const o=e[n];let s=!1;for(let a=r;a>=0;a--)if(this._matchSegment(o,this.path[a],a===this.path.length-1)){r=a-1,n--,s=!0;break}if(!s)return!1}else{if(!this._matchSegment(i,this.path[r],r===this.path.length-1))return!1;r--,n--}}return n<0}_matchSegment(e,r,n){if(e.tag!=="*"&&e.tag!==r.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==r.namespace||e.attrName!==void 0&&(!n||!r.values||!(e.attrName in r.values)||e.attrValue!==void 0&&String(r.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!n)return!1;const i=r.counter??0;if(e.position==="first"&&i!==0)return!1;if(e.position==="odd"&&i%2!==1)return!1;if(e.position==="even"&&i%2!==0)return!1;if(e.position==="nth"&&i!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>new Map(e))}}restore(e){this._pathStringCache=null,this.path=e.path.map(r=>({...r})),this.siblingStacks=e.siblingStacks.map(r=>new Map(r))}readOnly(){return this._view}}function Rle(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function jle(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function Vg(t){return String(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const Nle=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",N7e=Nle+"\\-\\.\\d·̀-ͯ‿-⁀",Mle=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",M7e=Mle+"\\-\\.\\d·̀-ͯ҇‿-⁀",Dle=(t,e,r="")=>{const n=t.replace(":",""),i=e.replace(":",""),o=`[${n}][${i}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,r),ncName:new RegExp(`^${o}$`,r),qName:new RegExp(`^${o}(?::${o})?$`,r),nmToken:new RegExp(`^[${e}]+$`,r),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,r)}},D7e=Dle(Nle,N7e),Q7e=Dle(Mle,M7e,"u"),L7e=(t="1.0")=>t==="1.1"?Q7e:D7e,Qle=(t,{xmlVersion:e="1.0"}={})=>L7e(e).qName.test(t),q7e=`
319
319
  `;function z7e(t,e){if(!Array.isArray(t)||t.length===0)return"1.0";const r=t[0];if(X5(r)==="?xml"){const i=r[":@"];if(i){const o=e.attributeNamePrefix+"version";if(i[o])return i[o]}}return"1.0"}function Lle(t,e,r,n,i){return!r.sanitizeName||Qle(t,{xmlVersion:i})?t:r.sanitizeName(t,{isAttribute:e,matcher:n.readOnly()})}function U7e(t,e){let r="";e.format&&(r=q7e);const n=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let s=0;s<e.stopNodes.length;s++){const a=e.stopNodes[s];typeof a=="string"?n.push(new ok(a)):a instanceof ok&&n.push(a)}const i=z7e(t,e),o=new Ale;return qle(t,e,r,o,n,i)}function qle(t,e,r,n,i,o){let s="",a=!1;if(e.maxNestedTags&&n.getDepth()>e.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(t!=null){let l=t.toString();return l=eN(l,e),l}return""}for(let l=0;l<t.length;l++){const c=t[l],u=X5(c);if(u===void 0)continue;const p=u===e.textNodeName||u===e.cdataPropName||u===e.commentPropName||u[0]==="?"?u:Lle(u,!1,e,n,o),f=V7e(c[":@"],e);n.push(p,f);const m=B7e(n,i);if(p===e.textNodeName){let O=c[u];m||(O=e.tagValueProcessor(p,O),O=eN(O,e)),a&&(s+=r),s+=O,a=!1,n.pop();continue}else if(p===e.cdataPropName){a&&(s+=r);const O=c[u][0][e.textNodeName],w=jle(O);s+=`<![CDATA[${w}]]>`,a=!1,n.pop();continue}else if(p===e.commentPropName){const O=c[u][0][e.textNodeName],w=Rle(O);s+=r+`<!--${w}-->`,a=!0,n.pop();continue}else if(p[0]==="?"){const O=AW(c[":@"],e,m,n,o);s+=(p==="?xml"?"":r)+`<${p}${O}?>`,a=!0,n.pop();continue}let g=r;g!==""&&(g+=e.indentBy);const y=AW(c[":@"],e,m,n,o),v=r+`<${p}${y}`;let b;m?b=zle(c[u],e):b=qle(c[u],e,g,n,i,o),e.unpairedTags.indexOf(p)!==-1?e.suppressUnpairedNode?s+=v+">":s+=v+"/>":(!b||b.length===0)&&e.suppressEmptyNode?s+=v+"/>":b&&b.endsWith(">")?s+=v+`>${b}${r}</${p}>`:(s+=v+">",b&&r!==""&&(b.includes("/>")||b.includes("</"))?s+=r+e.indentBy+b+r:s+=b,s+=`</${p}>`),a=!0,n.pop()}return s}function V7e(t,e){if(!t||e.ignoreAttributes)return null;const r={};let n=!1;for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;const o=i.startsWith(e.attributeNamePrefix)?i.substr(e.attributeNamePrefix.length):i;r[o]=Vg(t[i]),n=!0}return n?r:null}function zle(t,e){if(!Array.isArray(t))return t!=null?t.toString():"";let r="";for(let n=0;n<t.length;n++){const i=t[n],o=X5(i);if(o===e.textNodeName)r+=i[o];else if(o===e.cdataPropName)r+=i[o][0][e.textNodeName];else if(o===e.commentPropName)r+=i[o][0][e.textNodeName];else{if(o&&o[0]==="?")continue;if(o){const s=F7e(i[":@"],e),a=zle(i[o],e);!a||a.length===0?r+=`<${o}${s}/>`:r+=`<${o}${s}>${a}</${o}>`}}}return r}function F7e(t,e){let r="";if(t&&!e.ignoreAttributes)for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let i=t[n];i===!0&&e.suppressBooleanAttributes?r+=` ${n.substr(e.attributeNamePrefix.length)}`:r+=` ${n.substr(e.attributeNamePrefix.length)}="${Vg(i)}"`}return r}function X5(t){const e=Object.keys(t);for(let r=0;r<e.length;r++){const n=e[r];if(Object.prototype.hasOwnProperty.call(t,n)&&n!==":@")return n}}function AW(t,e,r,n,i){let o="";if(t&&!e.ignoreAttributes)for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;const a=s.substr(e.attributeNamePrefix.length),l=r?a:Lle(a,!0,e,n,i);let c;r?c=t[s]:(c=e.attributeValueProcessor(s,t[s]),c=eN(c,e)),c===!0&&e.suppressBooleanAttributes?o+=` ${l}`:o+=` ${l}="${Vg(c)}"`}return o}function B7e(t,e){if(!e||e.length===0)return!1;for(let r=0;r<e.length;r++)if(t.matches(e[r]))return!0;return!1}function eN(t,e){if(t&&t.length>0&&e.processEntities)for(let r=0;r<e.entities.length;r++){const n=e.entities[r];t=t.replace(n.regex,n.val)}return t}function W7e(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(const r of t)if(typeof r=="string"&&e===r||r instanceof RegExp&&r.test(e))return!0}:()=>!1}const Z7e={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0,sanitizeName:!1};function Aa(t){if(this.options=Object.assign({},Z7e,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(e=>typeof e=="string"&&e.startsWith("*.")?".."+e.substring(2):e)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let e=0;e<this.options.stopNodes.length;e++){const r=this.options.stopNodes[e];typeof r=="string"?this.stopNodeExpressions.push(new ok(r)):r instanceof ok&&this.stopNodeExpressions.push(r)}this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=W7e(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=H7e),this.processTextOrObjNode=G7e,this.options.format?(this.indentate=Y7e,this.tagEndChar=`>
320
320
  `,this.newLine=`
321
321
  `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function X7e(t,e){const r=t["?xml"];if(r&&typeof r=="object"){if(e.attributesGroupName&&r[e.attributesGroupName]){const i=r[e.attributesGroupName][e.attributeNamePrefix+"version"];if(i)return i}const n=r[e.attributeNamePrefix+"version"];if(n)return n}return"1.0"}function lA(t,e,r,n,i){return!r.sanitizeName||Qle(t,{xmlVersion:i})?t:r.sanitizeName(t,{isAttribute:e,matcher:n.readOnly()})}Aa.prototype.build=function(t){if(this.options.preserveOrder)return U7e(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new Ale,r=X7e(t,this.options);return this.j2x(t,0,e,r).val}};Aa.prototype.j2x=function(t,e,r,n){let i="",o="";if(this.options.maxNestedTags&&r.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const s=this.options.jPath?r.toString():r,a=this.checkStopNode(r);for(let l in t){if(!Object.prototype.hasOwnProperty.call(t,l))continue;const u=l===this.options.textNodeName||l===this.options.cdataPropName||l===this.options.commentPropName||this.options.attributesGroupName&&l===this.options.attributesGroupName||this.isAttribute(l)||l[0]==="?"?l:lA(l,!1,this.options,r,n);if(typeof t[l]>"u")this.isAttribute(l)&&(o+="");else if(t[l]===null)this.isAttribute(l)||u===this.options.cdataPropName||u===this.options.commentPropName?o+="":u[0]==="?"?o+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:o+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if(t[l]instanceof Date)o+=this.buildTextValNode(t[l],u,"",e,r);else if(typeof t[l]!="object"){const d=this.isAttribute(l);if(d&&!this.ignoreAttributesFn(d,s)){const p=lA(d,!0,this.options,r,n);i+=this.buildAttrPairStr(p,""+t[l],a)}else if(!d)if(l===this.options.textNodeName){let p=this.options.tagValueProcessor(l,""+t[l]);o+=this.replaceEntitiesValue(p)}else{r.push(u);const p=this.checkStopNode(r);if(r.pop(),p){const f=""+t[l];f===""?o+=this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:o+=this.indentate(e)+"<"+u+">"+f+"</"+u+this.tagEndChar}else o+=this.buildTextValNode(t[l],u,"",e,r)}}else if(Array.isArray(t[l])){const d=t[l].length;let p="",f="";for(let m=0;m<d;m++){const g=t[l][m];if(!(typeof g>"u"))if(g===null)u[0]==="?"?o+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:o+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if(typeof g=="object")if(this.options.oneListGroup){r.push(u);const y=this.j2x(g,e+1,r,n);r.pop(),p+=y.val,this.options.attributesGroupName&&g.hasOwnProperty(this.options.attributesGroupName)&&(f+=y.attrStr)}else p+=this.processTextOrObjNode(g,u,e,r,n);else if(this.options.oneListGroup){let y=this.options.tagValueProcessor(u,g);y=this.replaceEntitiesValue(y),p+=y}else{r.push(u);const y=this.checkStopNode(r);if(r.pop(),y){const v=""+g;v===""?p+=this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:p+=this.indentate(e)+"<"+u+">"+v+"</"+u+this.tagEndChar}else p+=this.buildTextValNode(g,u,"",e,r)}}this.options.oneListGroup&&(p=this.buildObjectNode(p,u,f,e)),o+=p}else if(this.options.attributesGroupName&&l===this.options.attributesGroupName){const d=Object.keys(t[l]),p=d.length;for(let f=0;f<p;f++){const m=lA(d[f],!0,this.options,r,n);i+=this.buildAttrPairStr(m,""+t[l][d[f]],a)}}else o+=this.processTextOrObjNode(t[l],u,e,r,n)}return{attrStr:i,val:o}};Aa.prototype.buildAttrPairStr=function(t,e,r){return r||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+Vg(e)+'"'};function G7e(t,e,r,n,i){const o=this.extractAttributes(t);if(n.push(e,o),this.checkStopNode(n)){const l=this.buildRawContent(t),c=this.buildAttributesForStopNode(t);return n.pop(),this.buildObjectNode(l,e,c,r)}const a=this.j2x(t,r+1,n,i);return n.pop(),e[0]==="?"?this.buildTextValNode("",e,a.attrStr,r,n):t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,a.attrStr,r,n):this.buildObjectNode(a.val,e,a.attrStr,r)}Aa.prototype.extractAttributes=function(t){if(!t||typeof t!="object")return null;const e={};let r=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const n=t[this.options.attributesGroupName];for(let i in n){if(!Object.prototype.hasOwnProperty.call(n,i))continue;const o=i.startsWith(this.options.attributeNamePrefix)?i.substring(this.options.attributeNamePrefix.length):i;e[o]=Vg(n[i]),r=!0}}else for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const i=this.isAttribute(n);i&&(e[i]=Vg(t[n]),r=!0)}return r?e:null};Aa.prototype.buildRawContent=function(t){if(typeof t=="string")return t;if(typeof t!="object"||t===null)return String(t);if(t[this.options.textNodeName]!==void 0)return t[this.options.textNodeName];let e="";for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||this.isAttribute(r)||this.options.attributesGroupName&&r===this.options.attributesGroupName)continue;const n=t[r];if(r===this.options.textNodeName)e+=n;else if(Array.isArray(n)){for(let i of n)if(typeof i=="string"||typeof i=="number")e+=`<${r}>${i}</${r}>`;else if(typeof i=="object"&&i!==null){const o=this.buildRawContent(i),s=this.buildAttributesForStopNode(i);o===""?e+=`<${r}${s}/>`:e+=`<${r}${s}>${o}</${r}>`}}else if(typeof n=="object"&&n!==null){const i=this.buildRawContent(n),o=this.buildAttributesForStopNode(n);i===""?e+=`<${r}${o}/>`:e+=`<${r}${o}>${i}</${r}>`}else e+=`<${r}>${n}</${r}>`}return e};Aa.prototype.buildAttributesForStopNode=function(t){if(!t||typeof t!="object")return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const r=t[this.options.attributesGroupName];for(let n in r){if(!Object.prototype.hasOwnProperty.call(r,n))continue;const i=n.startsWith(this.options.attributeNamePrefix)?n.substring(this.options.attributeNamePrefix.length):n,o=r[n];o===!0&&this.options.suppressBooleanAttributes?e+=" "+i:e+=" "+i+'="'+o+'"'}}else for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const n=this.isAttribute(r);if(n){const i=t[r];i===!0&&this.options.suppressBooleanAttributes?e+=" "+n:e+=" "+n+'="'+i+'"'}}return e};Aa.prototype.buildObjectNode=function(t,e,r,n){if(t==="")return e[0]==="?"?this.indentate(n)+"<"+e+r+"?"+this.tagEndChar:this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar;if(e[0]==="?")return this.indentate(n)+"<"+e+r+"?"+this.tagEndChar;{let i="</"+e+this.tagEndChar,o="";return e[0]==="?"&&(o="?",i=""),(r||r==="")&&t.indexOf("<")===-1?this.indentate(n)+"<"+e+r+o+">"+t+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&o.length===0?this.indentate(n)+`<!--${t}-->`+this.newLine:this.indentate(n)+"<"+e+r+o+this.tagEndChar+t+this.indentate(n)+i}};Aa.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};Aa.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||this.stopNodeExpressions.length===0)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1};Aa.prototype.buildTextValNode=function(t,e,r,n,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName){const o=jle(t);return this.indentate(n)+`<![CDATA[${o}]]>`+this.newLine}else if(this.options.commentPropName!==!1&&e===this.options.commentPropName){const o=Rle(t);return this.indentate(n)+`<!--${o}-->`+this.newLine}else{if(e[0]==="?")return this.indentate(n)+"<"+e+r+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(e,t);return o=this.replaceEntitiesValue(o),o===""?this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+r+">"+o+"</"+e+this.tagEndChar}}};Aa.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t};function Y7e(t){return this.options.indentBy.repeat(t)}function H7e(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}function Ule(t){return t.schema}function Vle(t){return Ule(t)?.fields??[]}function Fle(t,e){return t.flatMap(r=>{const n=Ule(r),i=n?.fields||[];return i.length>0?i.flatMap(o=>RW(o.name,o.example,r.allowReserved)):RW(r.name,n?.example??r.example,r.allowReserved)})}function RW(t,e,r){if(e===void 0)return[cA(t,"",!1,r)];const n=tN(e,t);return n.length===0?[cA(t,"",!1,r)]:n.map(i=>cA(i.key,i.value,!0,r))}function tN(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((r,n)=>r!==null&&typeof r=="object"?tN(r,`${e}[${n}]`):[{key:e,value:String(r)}]):J7e(t)?Object.entries(t).flatMap(([r,n])=>tN(n,`${e}[${r}]`)):[{key:e,value:String(t)}]}function J7e(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function cA(t,e,r,n){return{id:crypto.randomUUID(),key:t,value:e,active:r,in:"query",...n&&{allowReserved:n}}}const Ble={path:"path",query:"query",header:"headers",cookie:"cookie"};function G5(t){return t!==void 0}function F$(t){return"headers"in t||"body"in t||"query"in t||"path"in t||"cookie"in t||"security"in t||"envVariables"in t||"serverVariables"in t}function K7e(t,e){if(t)return F$(t)?t:t[e]}function jW(t,e,r){const n=r[Ble[e]],i=r.envVariables,o=new Set;for(const s of t??[])(n?.[s.name]||i?.[s.name])&&o.add(s.name);return o}function Og(t,e,r){if(F$(r))return jW(t,e,r);const n=new Set;for(const i of Object.values(r))if(i)for(const o of jW(t,e,i))n.add(o);return n}function NW(t,e,r){const n=r.query,i=r.envVariables;for(const o of e??[]){const s=Vle(o);for(const a of s)(n?.[a.name]||i?.[a.name])&&t.add(a.name);for(const a of[...Object.keys(n??{}),...Object.keys(i??{})])!n?.[a]&&!i?.[a]||s.some(l=>a===l.name||a.startsWith(`${l.name}[`))&&t.add(a)}}function Wle(t,e,r){const n=[...t??[],...e??[]],i=new Set(Og(n,"query",r));if(F$(r))return NW(i,e,r),i;for(const o of Object.values(r))o&&NW(i,e,o);return i}const Zle=1024;let eZe=0,Ha=class{constructor(e,r){this.from=e,this.to=r}};class sr{constructor(e={}){this.id=eZe++,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=Go.match(e)),r=>{let n=e(r);return n===void 0?null:[this,n]}}}sr.closedBy=new sr({deserialize:t=>t.split(" ")});sr.openedBy=new sr({deserialize:t=>t.split(" ")});sr.group=new sr({deserialize:t=>t.split(" ")});sr.isolate=new sr({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});sr.contextHash=new sr({perNode:!0});sr.lookAhead=new sr({perNode:!0});sr.mounted=new sr({perNode:!0});class Sb{constructor(e,r,n){this.tree=e,this.overlay=r,this.parser=n}static get(e){return e&&e.props&&e.props[sr.mounted.id]}}const tZe=Object.create(null);class Go{constructor(e,r,n,i=0){this.name=e,this.props=r,this.id=n,this.flags=i}static define(e){let r=e.props&&e.props.length?Object.create(null):tZe,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Go(e.name||"",r,e.id,n);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");r[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 r=this.prop(sr.group);return r?r.indexOf(e)>-1:!1}return this.id==e}static match(e){let r=Object.create(null);for(let n in e)for(let i of n.split(" "))r[i]=e[n];return n=>{for(let i=n.prop(sr.group),o=-1;o<(i?i.length:0);o++){let s=r[o<0?n.name:i[o]];if(s)return s}}}}Go.none=new Go("",Object.create(null),0,8);class B${constructor(e){this.types=e;for(let r=0;r<e.length;r++)if(e[r].id!=r)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let r=[];for(let n of this.types){let i=null;for(let o of e){let s=o(n);s&&(i||(i=Object.assign({},n.props)),i[s[0].id]=s[1])}r.push(i?new Go(n.name,i,n.id,n.flags):n)}return new B$(r)}}const US=new WeakMap,MW=new WeakMap;var kn;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(kn||(kn={}));let $n=class rN{constructor(e,r,n,i,o){if(this.type=e,this.children=r,this.positions=n,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=Sb.get(this);if(e&&!e.overlay)return e.tree.toString();let r="";for(let n of this.children){let i=n.toString();i&&(r&&(r+=","),r+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":""):r}cursor(e=0){return new sk(this.topNode,e)}cursorAt(e,r=0,n=0){let i=US.get(this)||this.topNode,o=new sk(i);return o.moveTo(e,r),US.set(this,o._tree),o}get topNode(){return new nl(this,0,0,null)}resolve(e,r=0){let n=_b(US.get(this)||this.topNode,e,r,!1);return US.set(this,n),n}resolveInner(e,r=0){let n=_b(MW.get(this)||this.topNode,e,r,!0);return MW.set(this,n),n}resolveStack(e,r=0){return iZe(this,e,r)}iterate(e){let{enter:r,leave:n,from:i=0,to:o=this.length}=e,s=e.mode||0,a=(s&kn.IncludeAnonymous)>0;for(let l=this.cursor(s|kn.IncludeAnonymous);;){let c=!1;if(l.from<=o&&l.to>=i&&(!a&&l.type.isAnonymous||r(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&n&&(a||!l.type.isAnonymous)&&n(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 r in this.props)e.push([+r,this.props[r]]);return e}balance(e={}){return this.children.length<=8?this:J5(Go.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new rN(this.type,r,n,i,this.propValues),e.makeTree||((r,n,i)=>new rN(Go.none,r,n,i)))}static build(e){return oZe(e)}};$n.empty=new $n(Go.none,[],[],0);class Y5{constructor(e,r){this.buffer=e,this.index=r}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 Y5(this.buffer,this.index)}}class bp{constructor(e,r,n){this.buffer=e,this.length=r,this.set=n}get type(){return Go.none}toString(){let e=[];for(let r=0;r<this.buffer.length;)e.push(this.childString(r)),r=this.buffer[r+3];return e.join(",")}childString(e){let r=this.buffer[e],n=this.buffer[e+3],i=this.set.types[r],o=i.name;if(/\W/.test(o)&&!i.isError&&(o=JSON.stringify(o)),e+=4,n==e)return o;let s=[];for(;e<n;)s.push(this.childString(e)),e=this.buffer[e+3];return o+"("+s.join(",")+")"}findChild(e,r,n,i,o){let{buffer:s}=this,a=-1;for(let l=e;l!=r&&!(Xle(o,i,s[l+1],s[l+2])&&(a=l,n>0));l=s[l+3]);return a}slice(e,r,n){let i=this.buffer,o=new Uint16Array(r-e),s=0;for(let a=e,l=0;a<r;){o[l++]=i[a++],o[l++]=i[a++]-n;let c=o[l++]=i[a++]-n;o[l++]=i[a++]-e,s=Math.max(s,c)}return new bp(o,s,this.set)}}function Xle(t,e,r,n){switch(t){case-2:return r<e;case-1:return n>=e&&r<e;case 0:return r<e&&n>e;case 1:return r<=e&&n>e;case 2:return n>e;case 4:return!0}}function _b(t,e,r,n){for(var i;t.from==t.to||(r<1?t.from>=e:t.from>e)||(r>-1?t.to<=e:t.to<e);){let s=!n&&t instanceof nl&&t.index<0?null:t.parent;if(!s)return t;t=s}let o=n?0:kn.IgnoreOverlays;if(n)for(let s=t,a=s.parent;a;s=a,a=s.parent)s instanceof nl&&s.index<0&&((i=a.enter(e,r,o))===null||i===void 0?void 0:i.from)!=s.from&&(t=a);for(;;){let s=t.enter(e,r,o);if(!s)return t;t=s}}class Gle{cursor(e=0){return new sk(this,e)}getChild(e,r=null,n=null){let i=DW(this,e,r,n);return i.length?i[0]:null}getChildren(e,r=null,n=null){return DW(this,e,r,n)}resolve(e,r=0){return _b(this,e,r,!1)}resolveInner(e,r=0){return _b(this,e,r,!0)}matchContext(e){return nN(this.parent,e)}enterUnfinishedNodesBefore(e){let r=this.childBefore(e),n=this;for(;r;){let i=r.lastChild;if(!i||i.to!=r.to)break;i.type.isError&&i.from==i.to?(n=r,r=i.prevSibling):r=i}return n}get node(){return this}get next(){return this.parent}}let nl=class l_ extends Gle{constructor(e,r,n,i){super(),this._tree=e,this.from=r,this.index=n,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,r,n,i,o=0){for(let s=this;;){for(let{children:a,positions:l}=s._tree,c=r>0?a.length:-1;e!=c;e+=r){let u=a[e],d=l[e]+s.from;if(Xle(i,n,d,d+u.length)){if(u instanceof bp){if(o&kn.ExcludeBuffers)continue;let p=u.findChild(0,u.buffer.length,r,n-d,i);if(p>-1)return new zc(new rZe(s,u,e,d),null,p)}else if(o&kn.IncludeAnonymous||!u.type.isAnonymous||H5(u)){let p;if(!(o&kn.IgnoreMounts)&&(p=Sb.get(u))&&!p.overlay)return new l_(p.tree,d,e,s);let f=new l_(u,d,e,s);return o&kn.IncludeAnonymous||!f.type.isAnonymous?f:f.nextChild(r<0?u.children.length-1:0,r,n,i)}}}if(o&kn.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+r:e=r<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,r,n=0){let i;if(!(n&kn.IgnoreOverlays)&&(i=Sb.get(this._tree))&&i.overlay){let o=e-this.from;for(let{from:s,to:a}of i.overlay)if((r>0?s<=o:s<o)&&(r<0?a>=o:a>o))return new l_(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,r,n)}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 DW(t,e,r,n){let i=t.cursor(),o=[];if(!i.firstChild())return o;if(r!=null){for(let s=!1;!s;)if(s=i.type.is(r),!i.nextSibling())return o}for(;;){if(n!=null&&i.type.is(n))return o;if(i.type.is(e)&&o.push(i.node),!i.nextSibling())return n==null?o:[]}}function nN(t,e,r=e.length-1){for(let n=t;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[r]&&e[r]!=n.name)return!1;r--}}return!0}class rZe{constructor(e,r,n,i){this.parent=e,this.buffer=r,this.index=n,this.start=i}}class zc extends Gle{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,r,n){super(),this.context=e,this._parent=r,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,r,n){let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],e,r-this.context.start,n);return o<0?null:new zc(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,r,n=0){if(n&kn.ExcludeBuffers)return null;let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],r>0?1:-1,e-this.context.start,r);return o<0?null:new zc(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,r=e.buffer[this.index+3];return r<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new zc(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new zc(this.context,this._parent,e.findChild(r,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],r=[],{buffer:n}=this.context,i=this.index+4,o=n.buffer[this.index+3];if(o>i){let s=n.buffer[this.index+1];e.push(n.slice(i,o,s)),r.push(0)}return new $n(this.type,e,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Yle(t){if(!t.length)return null;let e=0,r=t[0];for(let o=1;o<t.length;o++){let s=t[o];(s.from>r.from||s.to<r.to)&&(r=s,e=o)}let n=r instanceof nl&&r.index<0?null:r.parent,i=t.slice();return n?i[e]=n:i.splice(e,1),new nZe(i,r)}class nZe{constructor(e,r){this.heads=e,this.node=r}get next(){return Yle(this.heads)}}function iZe(t,e,r){let n=t.resolveInner(e,r),i=null;for(let o=n instanceof nl?n:n.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(i||(i=[n])).push(s.resolve(e,r)),o=s}else{let s=Sb.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let a=new nl(s.tree,s.overlay[0].from+o.from,-1,o);(i||(i=[n])).push(_b(a,e,r,!1))}}return i?Yle(i):n}class sk{get name(){return this.type.name}constructor(e,r=0){if(this.mode=r,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof nl)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.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,r){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=r||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return e?e instanceof nl?(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,r,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,r,n,this.mode));let{buffer:i}=this.buffer,o=i.findChild(this.index+4,i.buffer[this.index+3],e,r-this.buffer.start,n);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,r,n=this.mode){return this.buffer?n&kn.ExcludeBuffers?!1:this.enterChild(1,e,r):this.yield(this._tree.enter(e,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&kn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&kn.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:r}=this.buffer,n=this.stack.length-1;if(e<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(r.findChild(i,this.index,-1,0,4))}else{let i=r.buffer[this.index+3];if(i<(n<0?r.buffer.length:r.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<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 r,n,{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:r,parent:n}=i)}else({index:r,_parent:n}=this._tree);for(;n;{index:r,_parent:n}=n)if(r>-1)for(let o=r+e,s=e<0?-1:n._tree.children.length;o!=s;o+=e){let a=n._tree.children[o];if(this.mode&kn.IncludeAnonymous||a instanceof bp||!a.type.isAnonymous||H5(a))return!1}return!0}move(e,r){if(r&&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,r=0){for(;(this.from==this.to||(r<1?this.from>=e:this.from>e)||(r>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,r););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,r=null,n=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;r=s,n=o+1;break e}i=this.stack[--o]}for(let i=n;i<this.stack.length;i++)r=new zc(this.buffer,r,this.stack[i]);return this.bufferNode=new zc(this.buffer,r,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,r){for(let n=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&r&&r(this),i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return nN(this.node.parent,e);let{buffer:r}=this.buffer,{types:n}=r.set;for(let i=e.length-1,o=this.stack.length-1;i>=0;o--){if(o<0)return nN(this._tree,e,i);let s=n[r.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function H5(t){return t.children.some(e=>e instanceof bp||!e.type.isAnonymous||H5(e))}function oZe(t){var e;let{buffer:r,nodeSet:n,maxBufferLength:i=Zle,reused:o=[],minRepeatType:s=n.types.length}=t,a=Array.isArray(r)?new Y5(r,r.length):r,l=n.types,c=0,u=0;function d(x,S,_,C,$,j){let{id:R,start:D,end:L,size:F}=a,X=u,H=c;for(;F<0;)if(a.next(),F==-1){let M=o[R];_.push(M),C.push(D-x);return}else if(F==-3){c=R;return}else if(F==-4){u=R;return}else throw new RangeError(`Unrecognized record size: ${F}`);let te=l[R],re,ce,q=D-x;if(L-D<=i&&(ce=y(a.pos-S,$))){let M=new Uint16Array(ce.size-ce.skip),Z=a.pos-ce.size,V=M.length;for(;a.pos>Z;)V=v(ce.start,M,V);re=new bp(M,L-ce.start,n),q=ce.start-x}else{let M=a.pos-F;a.next();let Z=[],V=[],A=R>=s?R:-1,Q=0,W=L;for(;a.pos>M;)A>=0&&a.id==A&&a.size>=0?(a.end<=W-i&&(m(Z,V,D,Q,a.end,W,A,X,H),Q=Z.length,W=a.end),a.next()):j>2500?p(D,M,Z,V):d(D,M,Z,V,A,j+1);if(A>=0&&Q>0&&Q<Z.length&&m(Z,V,D,Q,D,W,A,X,H),Z.reverse(),V.reverse(),A>-1&&Q>0){let G=f(te,H);re=J5(te,Z,V,0,Z.length,0,L-D,G,G)}else re=g(te,Z,V,L-D,X-L,H)}_.push(re),C.push(q)}function p(x,S,_,C){let $=[],j=0,R=-1;for(;a.pos>S;){let{id:D,start:L,end:F,size:X}=a;if(X>4)a.next();else{if(R>-1&&L<R)break;R<0&&(R=F-i),$.push(D,L,F),j++,a.next()}}if(j){let D=new Uint16Array(j*4),L=$[$.length-2];for(let F=$.length-3,X=0;F>=0;F-=3)D[X++]=$[F],D[X++]=$[F+1]-L,D[X++]=$[F+2]-L,D[X++]=X;_.push(new bp(D,$[2]-L,n)),C.push(L-x)}}function f(x,S){return(_,C,$)=>{let j=0,R=_.length-1,D,L;if(R>=0&&(D=_[R])instanceof $n){if(!R&&D.type==x&&D.length==$)return D;(L=D.prop(sr.lookAhead))&&(j=C[R]+D.length+L)}return g(x,_,C,$,j,S)}}function m(x,S,_,C,$,j,R,D,L){let F=[],X=[];for(;x.length>C;)F.push(x.pop()),X.push(S.pop()+_-$);x.push(g(n.types[R],F,X,j-$,D-j,L)),S.push($-_)}function g(x,S,_,C,$,j,R){if(j){let D=[sr.contextHash,j];R=R?[D].concat(R):[D]}if($>25){let D=[sr.lookAhead,$];R=R?[D].concat(R):[D]}return new $n(x,S,_,C,R)}function y(x,S){let _=a.fork(),C=0,$=0,j=0,R=_.end-i,D={size:0,start:0,skip:0};e:for(let L=_.pos-x;_.pos>L;){let F=_.size;if(_.id==S&&F>=0){D.size=C,D.start=$,D.skip=j,j+=4,C+=4,_.next();continue}let X=_.pos-F;if(F<0||X<L||_.start<R)break;let H=_.id>=s?4:0,te=_.start;for(_.next();_.pos>X;){if(_.size<0)if(_.size==-3)H+=4;else break e;else _.id>=s&&(H+=4);_.next()}$=te,C+=F,j+=H}return(S<0||C==x)&&(D.size=C,D.start=$,D.skip=j),D.size>4?D:void 0}function v(x,S,_){let{id:C,start:$,end:j,size:R}=a;if(a.next(),R>=0&&C<s){let D=_;if(R>4){let L=a.pos-(R-4);for(;a.pos>L;)_=v(x,S,_)}S[--_]=D,S[--_]=j-x,S[--_]=$-x,S[--_]=C}else R==-3?c=C:R==-4&&(u=C);return _}let b=[],O=[];for(;a.pos>0;)d(t.start||0,t.bufferStart||0,b,O,-1,0);let w=(e=t.length)!==null&&e!==void 0?e:b.length?O[0]+b[0].length:0;return new $n(l[t.topID],b.reverse(),O.reverse(),w)}const QW=new WeakMap;function c_(t,e){if(!t.isAnonymous||e instanceof bp||e.type!=t)return 1;let r=QW.get(e);if(r==null){r=1;for(let n of e.children){if(n.type!=t||!(n instanceof $n)){r=1;break}r+=c_(t,n)}QW.set(e,r)}return r}function J5(t,e,r,n,i,o,s,a,l){let c=0;for(let m=n;m<i;m++)c+=c_(t,e[m]);let u=Math.ceil(c*1.5/8),d=[],p=[];function f(m,g,y,v,b){for(let O=y;O<v;){let w=O,x=g[O],S=c_(t,m[O]);for(O++;O<v;O++){let _=c_(t,m[O]);if(S+_>=u)break;S+=_}if(O==w+1){if(S>u){let _=m[w];f(_.children,_.positions,0,_.children.length,g[w]+b);continue}d.push(m[w])}else{let _=g[O-1]+m[O-1].length-x;d.push(J5(t,m,g,w,O,x,_,null,l))}p.push(x+b-o)}}return f(e,r,n,i,0),(a||l)(d,p,s)}class K5{constructor(){this.map=new WeakMap}setBuffer(e,r,n){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(r,n)}getBuffer(e,r){let n=this.map.get(e);return n&&n.get(r)}set(e,r){e instanceof zc?this.setBuffer(e.context.buffer,e.index,r):e instanceof nl&&this.map.set(e.tree,r)}get(e){return e instanceof zc?this.getBuffer(e.context.buffer,e.index):e instanceof nl?this.map.get(e.tree):void 0}cursorSet(e,r){e.buffer?this.setBuffer(e.buffer.buffer,e.index,r):this.map.set(e.tree,r)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Hu{constructor(e,r,n,i,o=!1,s=!1){this.from=e,this.to=r,this.tree=n,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,r=[],n=!1){let i=[new Hu(0,e.length,e,0,!1,n)];for(let o of r)o.to>e.length&&i.push(o);return i}static applyChanges(e,r,n=128){if(!r.length)return e;let i=[],o=1,s=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<r.length?r[a]:null,d=u?u.fromA:1e9;if(d-l>=n)for(;s&&s.from<d;){let p=s;if(l>=p.from||d<=p.to||c){let f=Math.max(p.from,l)-c,m=Math.min(p.to,d)-c;p=f>=m?null:new Hu(f,m,p.tree,p.offset+c,a>0,!!u)}if(p&&i.push(p),s.to>d)break;s=o<e.length?e[o++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}let eL=class{startParse(e,r,n){return typeof e=="string"&&(e=new sZe(e)),n=n?n.length?n.map(i=>new Ha(i.from,i.to)):[new Ha(0,0)]:[new Ha(0,e.length)],this.createParse(e,r||[],n)}parse(e,r,n){let i=this.startParse(e,r,n);for(;;){let o=i.advance();if(o)return o}}};class sZe{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,r){return this.string.slice(e,r)}}function aZe(t){return(e,r,n,i)=>new cZe(e,t,r,n,i)}class LW{constructor(e,r,n,i,o){this.parser=e,this.parse=r,this.overlay=n,this.target=i,this.from=o}}function qW(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class lZe{constructor(e,r,n,i,o,s,a){this.parser=e,this.predicate=r,this.mounts=n,this.index=i,this.start=o,this.target=s,this.prev=a,this.depth=0,this.ranges=[]}}const iN=new sr({perNode:!0});class cZe{constructor(e,r,n,i,o){this.nest=r,this.input=n,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 n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new $n(n.type,n.children,n.positions,n.length,n.propValues.concat([[iN,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],r=e.parse.advance();if(r){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[sr.mounted.id]=new Sb(r,e.overlay,e.parser),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let r=this.innerDone;r<this.inner.length;r++)this.inner[r].from<e&&(e=Math.min(e,this.inner[r].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let r=this.innerDone;r<this.inner.length;r++)this.inner[r].parse.stopAt(e)}startInner(){let e=new pZe(this.fragments),r=null,n=null,i=new sk(new nl(this.baseTree,this.ranges[0].from,0,null),kn.IncludeAnonymous|kn.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(r){let c=r.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let d=u.from+c.pos,p=u.to+c.pos;d>=i.from&&p<=i.to&&!r.ranges.some(f=>f.from<p&&f.to>d)&&r.ranges.push({from:d,to:p})}}a=!1}else if(n&&(s=uZe(n.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||dZe(i);let c=e.findMounts(i.from,o.parser);if(typeof o.overlay=="function")r=new lZe(o.parser,o.overlay,c,this.inner.length,i.from,i.tree,r);else{let u=VW(this.ranges,o.overlay||(i.from<i.to?[new Ha(i.from,i.to)]:[]));u.length&&qW(u),(u.length||!o.overlay)&&this.inner.push(new LW(o.parser,u.length?o.parser.startParse(this.input,FW(c,u),u):o.parser.startParse(""),o.overlay?o.overlay.map(d=>new Ha(d.from-i.from,d.to-i.from)):null,i.tree,u.length?u[0].from:i.from)),o.overlay?u.length&&(n={ranges:u,depth:0,prev:n}):a=!1}}else if(r&&(l=r.predicate(i))&&(l===!0&&(l=new Ha(i.from,i.to)),l.from<l.to)){let c=r.ranges.length-1;c>=0&&r.ranges[c].to==l.from?r.ranges[c]={from:r.ranges[c].from,to:l.to}:r.ranges.push(l)}if(a&&i.firstChild())r&&r.depth++,n&&n.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(r&&!--r.depth){let c=VW(this.ranges,r.ranges);c.length&&(qW(c),this.inner.splice(r.index,0,new LW(r.parser,r.parser.startParse(this.input,FW(r.mounts,c),c),r.ranges.map(u=>new Ha(u.from-r.start,u.to-r.start)),r.target,c[0].from))),r=r.prev}n&&!--n.depth&&(n=n.prev)}}}}function uZe(t,e,r){for(let n of t){if(n.from>=r)break;if(n.to>e)return n.from<=e&&n.to>=r?2:1}return 0}function zW(t,e,r,n,i,o){if(e<r){let s=t.buffer[e+1];n.push(t.slice(e,r,s)),i.push(s-o)}}function dZe(t){let{node:e}=t,r=[],n=e.context.buffer;do r.push(t.index),t.parent();while(!t.tree);let i=t.tree,o=i.children.indexOf(n),s=i.children[o],a=s.buffer,l=[o];function c(u,d,p,f,m,g){let y=r[g],v=[],b=[];zW(s,u,y,v,b,f);let O=a[y+1],w=a[y+2];l.push(v.length);let x=g?c(y+4,a[y+3],s.set.types[a[y]],O,w-O,g-1):e.toTree();return v.push(x),b.push(O-f),zW(s,a[y+3],d,v,b,f),new $n(p,v,b,m)}i.children[o]=c(0,a.length,Go.none,0,s.length,r.length-1);for(let u of l){let d=t.tree.children[u],p=t.tree.positions[u];t.yield(new nl(d,p+t.from,u,t._tree))}}class UW{constructor(e,r){this.offset=r,this.done=!1,this.cursor=e.cursor(kn.IncludeAnonymous|kn.IgnoreMounts)}moveTo(e){let{cursor:r}=this,n=e-this.offset;for(;!this.done&&r.from<n;)r.to>=e&&r.enter(n,1,kn.IgnoreOverlays|kn.ExcludeBuffers)||r.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 r=this.cursor.tree;;){if(r==e.tree)return!0;if(r.children.length&&r.positions[0]==0&&r.children[0]instanceof $n)r=r.children[0];else break}return!1}}let pZe=class{constructor(e){var r;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(r=n.tree.prop(iN))!==null&&r!==void 0?r:n.to,this.inner=new UW(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let r=this.curFrag=this.fragments[this.fragI];this.curTo=(e=r.tree.prop(iN))!==null&&e!==void 0?e:r.to,this.inner=new UW(r.tree,-r.offset)}}findMounts(e,r){var n;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let o=this.inner.cursor.node;o;o=o.parent){let s=(n=o.tree)===null||n===void 0?void 0:n.prop(sr.mounted);if(s&&s.parser==r)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=o.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:o.from-l.offset,mount:s})}}}return i}};function VW(t,e){let r=null,n=e;for(let i=1,o=0;i<t.length;i++){let s=t[i-1].to,a=t[i].from;for(;o<n.length;o++){let l=n[o];if(l.from>=a)break;l.to<=s||(r||(n=r=e.slice()),l.from<s?(r[o]=new Ha(l.from,s),l.to>a&&r.splice(o+1,0,new Ha(a,l.to))):l.to>a?r[o--]=new Ha(a,l.to):r.splice(o--,1))}}return n}function fZe(t,e,r,n){let i=0,o=0,s=!1,a=!1,l=-1e9,c=[];for(;;){let u=i==t.length?1e9:s?t[i].to:t[i].from,d=o==e.length?1e9:a?e[o].to:e[o].from;if(s!=a){let p=Math.max(l,r),f=Math.min(u,d,n);p<f&&c.push(new Ha(p,f))}if(l=Math.min(u,d),l==1e9)break;u==l&&(s?(s=!1,i++):s=!0),d==l&&(a?(a=!1,o++):a=!0)}return c}function FW(t,e){let r=[];for(let{pos:n,mount:i,frag:o}of t){let s=n+(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 u=i.overlay.map(p=>new Ha(p.from+n,p.to+n)),d=fZe(e,u,l,c);for(let p=0,f=l;;p++){let m=p==d.length,g=m?c:d[p].from;if(g>f&&r.push(new Hu(f,g,i.tree,-s,o.from>=f||o.openStart,o.to<=g||o.openEnd)),m)break;f=d[p].to}}else r.push(new Hu(l,c,i.tree,-s,o.from>=s||o.openStart,o.to<=a||o.openEnd))}return r}class ak{constructor(e,r,n,i,o,s,a,l,c,u=0,d){this.p=e,this.stack=r,this.state=n,this.reducePos=i,this.pos=o,this.score=s,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=d}toString(){return`[${this.stack.filter((e,r)=>r%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,r,n=0){let i=e.parser.context;return new ak(e,[],r,n,n,0,[],0,i?new BW(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,r){this.stack.push(this.state,r,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var r;let n=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),n==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-(n-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,u=this.reducePos-c;u>=2e3&&!(!((r=this.p.parser.nodeSet.types[i])===null||r===void 0)&&r.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=u));let d=l?this.stack[l-1]:0,p=this.bufferBase+this.buffer.length-d;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,r,n,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(r==n)return;if(s.buffer[a-2]>=r){s.buffer[a-2]=n;return}}}if(!o||this.pos==n)this.buffer.push(e,r,n,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]>n;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;s>0&&this.buffer[s-2]>n;)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]=r,this.buffer[s+2]=n,this.buffer[s+3]=i}}shift(e,r,n,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||r<=s.maxNode)&&(this.pos=i,s.stateFlag(o,1)||(this.reducePos=i)),this.pushState(o,n),this.shiftContext(r,n),r<=s.maxNode&&this.buffer.push(r,n,i,4)}else this.pos=i,this.shiftContext(r,n),r<=this.p.parser.maxNode&&this.buffer.push(r,n,i,4)}apply(e,r,n,i){e&65536?this.reduce(e):this.shift(e,r,n,i)}useNode(e,r){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(r,i),this.buffer.push(n,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,r=e.buffer.length;for(;r>0&&e.buffer[r-2]>e.reducePos;)r-=4;let n=e.buffer.slice(r),i=e.bufferBase+r;for(;e&&i==e.bufferBase;)e=e.parent;return new ak(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,r){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,r,4),this.storeNode(0,this.pos,r,n?8:4),this.pos=this.reducePos=r,this.score-=190}canShift(e){for(let r=new hZe(this);;){let n=this.p.parser.stateSlot(r.state,4)||this.p.parser.hasAction(r.state,e);if(n==0)return!1;if((n&65536)==0)return!0;r.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let r=this.p.parser.nextStates(this.state);if(r.length>8||this.stack.length>=120){let i=[];for(let o=0,s;o<r.length;o+=2)(s=r[o+1])!=this.state&&this.p.parser.hasAction(s,e)&&i.push(r[o],s);if(this.stack.length<120)for(let o=0;i.length<8&&o<r.length;o+=2){let s=r[o+1];i.some((a,l)=>l&1&&a==s)||i.push(r[o],s)}r=i}let n=[];for(let i=0;i<r.length&&n.length<4;i+=2){let o=r[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(r[i],this.pos),s.reducePos=this.pos,s.score-=200,n.push(s)}return n}forceReduce(){let{parser:e}=this.p,r=e.stateSlot(this.state,5);if((r&65536)==0)return!1;if(!e.validAction(this.state,r)){let n=r>>19,i=r&65535,o=this.stack.length-n*3;if(o<0||e.getGoto(this.stack[o],i,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;r=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(r),!0}findForcedReduction(){let{parser:e}=this.p,r=[],n=(i,o)=>{if(!r.includes(i))return r.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=n(s,o+1);if(a!=null)return a}})};return n(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 r=0;r<this.stack.length;r+=3)if(this.stack[r]!=e.stack[r])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,r){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(r)))}reduceContext(e,r){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(r)))}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 r=new BW(this.curContext.tracker,e);r.hash!=this.curContext.hash&&this.emitContext(),this.curContext=r}}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 BW{constructor(e,r){this.tracker=e,this.context=r,this.hash=e.strict?e.hash(r):0}}class hZe{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let r=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],r,!0);this.state=i}}class lk{constructor(e,r,n){this.stack=e,this.pos=r,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,r=e.bufferBase+e.buffer.length){return new lk(e,r,r-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 lk(this.stack,this.pos,this.index)}}function tO(t,e=Uint16Array){if(typeof t!="string")return t;let r=null;for(let n=0,i=0;n<t.length;){let o=0;for(;;){let s=t.charCodeAt(n++),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}r?r[i++]=o:r=new e(o)}return r}class u_{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const WW=new u_;class mZe{constructor(e,r){this.input=e,this.ranges=r,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=WW,this.rangeIndex=0,this.pos=this.chunkPos=r[0].from,this.range=r[0],this.end=r[r.length-1].to,this.readNext()}resolveOffset(e,r){let n=this.range,i=this.rangeIndex,o=this.pos+e;for(;o<n.from;){if(!i)return null;let s=this.ranges[--i];o-=n.from-s.to,n=s}for(;r<0?o>n.to:o>=n.to;){if(i==this.ranges.length-1)return null;let s=this.ranges[++i];o+=s.from-n.to,n=s}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let r of this.ranges)if(r.to>e)return Math.max(e,r.from);return this.end}peek(e){let r=this.chunkOff+e,n,i;if(r>=0&&r<this.chunk.length)n=this.pos+e,i=this.chunk.charCodeAt(r);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(n=o,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let s=this.rangeIndex,a=this.range;for(;a.to<=n;)a=this.ranges[++s];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-n)),i=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),i}acceptToken(e,r=0){let n=r?this.resolveOffset(r,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,r){this.token.value=e,this.token.end=r}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:r}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=r,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),r=this.pos+e.length;this.chunk=r>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,r){if(r?(this.token=r,r.start=e,r.lookAhead=e+1,r.value=r.extended=-1):this.token=WW,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,r){if(e>=this.chunkPos&&r<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,r-this.chunkPos);if(e>=this.chunk2Pos&&r<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,r-this.chunk2Pos);if(e>=this.range.from&&r<=this.range.to)return this.input.read(e,r);let n="";for(let i of this.ranges){if(i.from>=r)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,r)))}return n}}class bg{constructor(e,r){this.data=e,this.id=r}token(e,r){let{parser:n}=r.p;Hle(this.data,e,r,this.id,n.data,n.tokenPrecTable)}}bg.prototype.contextual=bg.prototype.fallback=bg.prototype.extend=!1;class ck{constructor(e,r,n){this.precTable=r,this.elseToken=n,this.data=typeof e=="string"?tO(e):e}token(e,r){let n=e.pos,i=0;for(;;){let o=e.next<0,s=e.resolveOffset(1,1);if(Hle(this.data,e,r,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(n,e.token),e.acceptToken(this.elseToken,i))}}ck.prototype.contextual=bg.prototype.fallback=bg.prototype.extend=!1;class Pi{constructor(e,r={}){this.token=e,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}}function Hle(t,e,r,n,i,o){let s=0,a=1<<n,{dialect:l}=r.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||gZe(m,e.token.value,i,o))){e.acceptToken(m);break}}let u=e.next,d=0,p=t[s+2];if(e.next<0&&p>d&&t[c+p*3-3]==65535){s=t[c+p*3-1];continue e}for(;d<p;){let f=d+p>>1,m=c+f+(f<<1),g=t[m],y=t[m+1]||65536;if(u<g)p=f;else if(u>=y)d=f+1;else{s=t[m+2],e.advance();continue e}}break}}function ZW(t,e,r){for(let n=e,i;(i=t[n])!=65535;n++)if(i==r)return n-e;return-1}function gZe(t,e,r,n){let i=ZW(r,n,e);return i<0||ZW(r,n,t)<i}const sa=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let uA=null;function XW(t,e,r){let n=t.cursor(kn.IncludeAnonymous);for(n.moveTo(e);;)if(!(r<0?n.childBefore(e):n.childAfter(e)))for(;;){if((r<0?n.to<e:n.from>e)&&!n.type.isError)return r<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(r<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return r<0?0:t.length}}class yZe{constructor(e,r){this.fragments=e,this.nodeSet=r,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?XW(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?XW(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 r=this.trees.length-1;if(r<0)return this.nextFragment(),null;let n=this.trees[r],i=this.index[r];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=n.children[i],s=this.start[r]+n.positions[i];if(s>e)return this.nextStart=s,null;if(o instanceof $n){if(s==e){if(s<this.safeFrom)return null;let a=s+o.length;if(a<=this.safeTo){let l=o.prop(sr.lookAhead);if(!l||a+l<this.fragment.to)return o}}this.index[r]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[r]++,this.nextStart=s+o.length}}}class vZe{constructor(e,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new u_)}getActions(e){let r=0,n=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 u=o[c],d=this.tokens[c];if(!(n&&!u.fallback)&&((u.contextual||d.start!=e.pos||d.mask!=s||d.context!=a)&&(this.updateCachedToken(d,u,e),d.mask=s,d.context=a),d.lookAhead>d.end+25&&(l=Math.max(d.lookAhead,l)),d.value!=0)){let p=r;if(d.extended>-1&&(r=this.addActions(e,d.extended,d.end,r)),r=this.addActions(e,d.value,d.end,r),!u.extend&&(n=d,r>p))break}}for(;this.actions.length>r;)this.actions.pop();return l&&e.setLookAhead(l),!n&&e.pos==this.stream.end&&(n=new u_,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,r=this.addActions(e,n.value,n.end,r)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let r=new u_,{pos:n,p:i}=e;return r.start=n,r.end=Math.min(n+1,i.stream.end),r.value=n==i.stream.end?i.parser.eofTerm:0,r}updateCachedToken(e,r,n){let i=this.stream.clipPos(n.pos);if(r.token(this.stream.reset(i,e),n),e.value>-1){let{parser:o}=n.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),n);if(a>=0&&n.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,r,n,i){for(let o=0;o<i;o+=3)if(this.actions[o]==e)return i;return this.actions[i++]=e,this.actions[i++]=r,this.actions[i++]=n,i}addActions(e,r,n,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=Vu(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(Vu(a,c+2),r,n,i));break}a[c]==r&&(i=this.putAction(Vu(a,c+1),r,n,i))}return i}}let OZe=class{constructor(e,r,n,i){this.parser=e,this.input=r,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new mZe(r,i),this.tokens=new vZe(e,this.stream),this.topTerm=e.top[1];let{from:o}=i[0];this.stacks=[ak.start(this,e.top[0],o)],this.fragments=n.length&&this.stream.end-o>e.bufferLength*4?new yZe(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,r=this.minStackPos,n=this.stacks=[],i,o;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<e.length;s++){let a=e[s];for(;;){if(this.tokens.mainToken=null,a.pos>r)n.push(a);else{if(this.advanceStack(a,n,e))continue;{i||(i=[],o=[]),i.push(a);let l=this.tokens.getMainToken(a);o.push(l.value,l.end)}}break}}if(!n.length){let s=i&&xZe(i);if(s)return sa&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw sa&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&i){let s=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,o,n);if(s)return sa&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(n.length>s)for(n.sort((a,l)=>l.score-a.score);n.length>s;)n.pop();n.some(a=>a.reducePos>r)&&this.recovering--}else if(n.length>1){e:for(let s=0;s<n.length-1;s++){let a=n[s];for(let l=s+1;l<n.length;l++){let c=n[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)n.splice(l--,1);else{n.splice(s--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let s=1;s<n.length;s++)n[s].pos<this.minStackPos&&(this.minStackPos=n[s].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,r,n){let i=e.pos,{parser:o}=this,s=sa?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let d=this.fragments.nodeAt(i);d;){let p=this.parser.nodeSet.types[d.type.id]==d.type?o.getGoto(e.state,d.type.id):-1;if(p>-1&&d.length&&(!c||(d.prop(sr.contextHash)||0)==u))return e.useNode(d,p),sa&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(d.type.id)})`),!0;if(!(d instanceof $n)||d.children.length==0||d.positions[0]>0)break;let f=d.children[0];if(f instanceof $n&&d.positions[0]==0)d=f;else break}}let a=o.stateSlot(e.state,4);if(a>0)return e.reduce(a),sa&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],d=l[c++],p=l[c++],f=c==l.length||!n,m=f?e:e.split(),g=this.tokens.mainToken;if(m.apply(u,d,g?g.start:m.pos,p),sa&&console.log(s+this.stackID(m)+` (via ${(u&65536)==0?"shift":`reduce of ${o.getName(u&65535)}`} for ${o.getName(d)} @ ${i}${m==e?"":", split"})`),f)return!0;m.pos>i?r.push(m):n.push(m)}return!1}advanceFully(e,r){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return GW(e,r),!0}}runRecovery(e,r,n){let i=null,o=!1;for(let s=0;s<e.length;s++){let a=e[s],l=r[s<<1],c=r[(s<<1)+1],u=sa?this.stackID(a)+" -> ":"";if(a.deadEnd&&(o||(o=!0,a.restart(),sa&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,n))))continue;let d=a.split(),p=u;for(let f=0;d.forceReduce()&&f<10&&(sa&&console.log(p+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,n));f++)sa&&(p=this.stackID(d)+" -> ");for(let f of a.recoverByInsert(l))sa&&console.log(u+this.stackID(f)+" (via recover-insert)"),this.advanceFully(f,n);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),sa&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),GW(a,n)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),$n.build({buffer:lk.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let r=(uA||(uA=new WeakMap)).get(e);return r||uA.set(e,r=String.fromCodePoint(this.nextStackID++)),r+e}};function GW(t,e){for(let r=0;r<e.length;r++){let n=e[r];if(n.pos==t.pos&&n.sameState(t)){e[r].score<t.score&&(e[r]=t);return}}e.push(t)}class bZe{constructor(e,r,n){this.source=e,this.flags=r,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}const dA=t=>t;class z0{constructor(e){this.start=e.start,this.shift=e.shift||dA,this.reduce=e.reduce||dA,this.reuse=e.reuse||dA,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Fl extends eL{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let r=e.nodeNames.split(" ");this.minRepeatTerm=r.length;for(let a=0;a<e.repeatNodeCount;a++)r.push("");let n=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<r.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=sr[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)o(u,l,a[c++]);else{let d=a[c+-u];for(let p=-u;p>0;p--)o(a[c++],l,d);c++}}}this.nodeSet=new B$(r.map((a,l)=>Go.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[l],top:n.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=Zle;let s=tO(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(YW),this.states=tO(e.states,Uint32Array),this.data=tO(e.stateData),this.goto=tO(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new bg(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,r,n){let i=new OZe(this,e,r,n);for(let o of this.wrappers)i=o(i,e,r,n);return i}getGoto(e,r,n=!1){let i=this.goto;if(r>=i[0])return-1;for(let o=i[r+1];;){let s=i[o++],a=s&1,l=i[o++];if(a&&n)return l;for(let c=o+(s>>1);o<c;o++)if(i[o]==e)return l;if(a)return-1}}hasAction(e,r){let n=this.data;for(let i=0;i<2;i++)for(let o=this.stateSlot(e,i?2:1),s;;o+=3){if((s=n[o])==65535)if(n[o+1]==1)s=n[o=Vu(n,o+2)];else{if(n[o+1]==2)return Vu(n,o+2);break}if(s==r||s==0)return Vu(n,o+1)}return 0}stateSlot(e,r){return this.states[e*6+r]}stateFlag(e,r){return(this.stateSlot(e,0)&r)>0}validAction(e,r){return!!this.allActions(e,n=>n==r?!0:null)}allActions(e,r){let n=this.stateSlot(e,4),i=n?r(n):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=Vu(this.data,o+2);else break;i=r(Vu(this.data,o+1))}return i}nextStates(e){let r=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Vu(this.data,n+2);else break;if((this.data[n+2]&1)==0){let i=this.data[n+1];r.some((o,s)=>s&1&&o==i)||r.push(this.data[n],i)}}return r}configure(e){let r=Object.assign(Object.create(Fl.prototype),this);if(e.props&&(r.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);r.top=n}return e.tokenizers&&(r.tokenizers=this.tokenizers.map(n=>{let i=e.tokenizers.find(o=>o.from==n);return i?i.to:n})),e.specializers&&(r.specializers=this.specializers.slice(),r.specializerSpecs=this.specializerSpecs.map((n,i)=>{let o=e.specializers.find(a=>a.from==n.external);if(!o)return n;let s=Object.assign(Object.assign({},n),{external:o.to});return r.specializers[i]=YW(s),s})),e.contextTracker&&(r.context=e.contextTracker),e.dialect&&(r.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(r.strict=e.strict),e.wrap&&(r.wrappers=r.wrappers.concat(e.wrap)),e.bufferLength!=null&&(r.bufferLength=e.bufferLength),r}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 r=this.dynamicPrecedences;return r==null?0:r[e]||0}parseDialect(e){let r=Object.keys(this.dialects),n=r.map(()=>!1);if(e)for(let o of e.split(" ")){let s=r.indexOf(o);s>=0&&(n[s]=!0)}let i=null;for(let o=0;o<r.length;o++)if(!n[o])for(let s=this.dialects[r[o]],a;(a=this.data[s++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new bZe(e,n,i)}static deserialize(e){return new Fl(e)}}function Vu(t,e){return t[e]|t[e+1]<<16}function xZe(t){let e=null;for(let r of t){let n=r.p.stoppedAt;(r.pos==r.p.stream.end||n!=null&&r.pos>n)&&r.p.parser.stateFlag(r.state,2)&&(!e||e.score<r.score)&&(e=r)}return e}function YW(t){if(t.external){let e=t.extend?1:0;return(r,n)=>t.external(r,n)<<1|e}return t.get}let wZe=0,Fu=class oN{constructor(e,r,n,i){this.name=e,this.set=r,this.base=n,this.modified=i,this.id=wZe++}toString(){let{name:e}=this;for(let r of this.modified)r.name&&(e=`${r.name}(${e})`);return e}static define(e,r){let n=typeof e=="string"?e:"?";if(e instanceof oN&&(r=e),r?.base)throw new Error("Can not derive from a modified tag");let i=new oN(n,[],null,[]);if(i.set.push(i),r)for(let o of r.set)i.set.push(o);return i}static defineModifier(e){let r=new uk(e);return n=>n.modified.indexOf(r)>-1?n:uk.get(n.base||n,n.modified.concat(r).sort((i,o)=>i.id-o.id))}},SZe=0;class uk{constructor(e){this.name=e,this.instances=[],this.id=SZe++}static get(e,r){if(!r.length)return e;let n=r[0].instances.find(a=>a.base==e&&_Ze(r,a.modified));if(n)return n;let i=[],o=new Fu(e.name,i,e,r);for(let a of r)a.instances.push(o);let s=CZe(r);for(let a of e.set)if(!a.modified.length)for(let l of s)i.push(uk.get(a,l));return o}}function _Ze(t,e){return t.length==e.length&&t.every((r,n)=>r==e[n])}function CZe(t){let e=[[]];for(let r=0;r<t.length;r++)for(let n=0,i=e.length;n<i;n++)e.push(e[n].concat(t[r]));return e.sort((r,n)=>n.length-r.length)}function gd(t){let e=Object.create(null);for(let r in t){let n=t[r];Array.isArray(n)||(n=[n]);for(let i of r.split(" "))if(i){let o=[],s=2,a=i;for(let d=0;;){if(a=="..."&&d>0&&d+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]),d+=p[0].length,d==i.length)break;let f=i[d++];if(d==i.length&&f=="!"){s=0;break}if(f!="/")throw new RangeError("Invalid path: "+i);a=i.slice(d)}let l=o.length-1,c=o[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new dk(n,s,l>0?o.slice(0,l):null);e[c]=u.sort(e[c])}}return Jle.add(e)}const Jle=new sr;class dk{constructor(e,r,n,i){this.tags=e,this.mode=r,this.context=n,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}}dk.empty=new dk([],2,null);function Kle(t,e){let r=Object.create(null);for(let o of t)if(!Array.isArray(o.tag))r[o.tag.id]=o.class;else for(let s of o.tag)r[s.id]=o.class;let{scope:n,all:i=null}=e||{};return{style:o=>{let s=i;for(let a of o)for(let l of a.set){let c=r[l.id];if(c){s=s?s+" "+c:c;break}}return s},scope:n}}function kZe(t,e){let r=null;for(let n of t){let i=n.style(e);i&&(r=r?r+" "+i:i)}return r}function PZe(t,e,r,n=0,i=t.length){let o=new $Ze(n,Array.isArray(e)?e:[e],r);o.highlightRange(t.cursor(),n,i,"",o.highlighters),o.flush(i)}class $Ze{constructor(e,r,n){this.at=e,this.highlighters=r,this.span=n,this.class=""}startSpan(e,r){r!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=r)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,r,n,i,o){let{type:s,from:a,to:l}=e;if(a>=n||l<=r)return;s.isTop&&(o=this.highlighters.filter(f=>!f.scope||f.scope(s)));let c=i,u=TZe(e)||dk.empty,d=kZe(o,u.tags);if(d&&(c&&(c+=" "),c+=d,u.mode==1&&(i+=(i?" ":"")+d)),this.startSpan(Math.max(r,a),c),u.opaque)return;let p=e.tree&&e.tree.prop(sr.mounted);if(p&&p.overlay){let f=e.node.enter(p.overlay[0].from+a,1),m=this.highlighters.filter(y=>!y.scope||y.scope(p.tree.type)),g=e.firstChild();for(let y=0,v=a;;y++){let b=y<p.overlay.length?p.overlay[y]:null,O=b?b.from+a:l,w=Math.max(r,v),x=Math.min(n,O);if(w<x&&g)for(;e.from<x&&(this.highlightRange(e,w,x,i,o),this.startSpan(Math.min(x,e.to),c),!(e.to>=O||!e.nextSibling())););if(!b||O>n)break;v=b.to+a,v>r&&(this.highlightRange(f.cursor(),Math.max(r,b.from+a),Math.min(n,v),"",m),this.startSpan(Math.min(n,v),c))}g&&e.parent()}else if(e.firstChild()){p&&(i="");do if(!(e.to<=r)){if(e.from>=n)break;this.highlightRange(e,r,n,i,o),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}}function TZe(t){let e=t.type.prop(Jle);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const st=Fu.define,VS=st(),Md=st(),HW=st(Md),JW=st(Md),Dd=st(),FS=st(Dd),pA=st(Dd),Sc=st(),Kp=st(Sc),mc=st(),gc=st(),sN=st(),$v=st(sN),BS=st(),J={comment:VS,lineComment:st(VS),blockComment:st(VS),docComment:st(VS),name:Md,variableName:st(Md),typeName:HW,tagName:st(HW),propertyName:JW,attributeName:st(JW),className:st(Md),labelName:st(Md),namespace:st(Md),macroName:st(Md),literal:Dd,string:FS,docString:st(FS),character:st(FS),attributeValue:st(FS),number:pA,integer:st(pA),float:st(pA),bool:st(Dd),regexp:st(Dd),escape:st(Dd),color:st(Dd),url:st(Dd),keyword:mc,self:st(mc),null:st(mc),atom:st(mc),unit:st(mc),modifier:st(mc),operatorKeyword:st(mc),controlKeyword:st(mc),definitionKeyword:st(mc),moduleKeyword:st(mc),operator:gc,derefOperator:st(gc),arithmeticOperator:st(gc),logicOperator:st(gc),bitwiseOperator:st(gc),compareOperator:st(gc),updateOperator:st(gc),definitionOperator:st(gc),typeOperator:st(gc),controlOperator:st(gc),punctuation:sN,separator:st(sN),bracket:$v,angleBracket:st($v),squareBracket:st($v),paren:st($v),brace:st($v),content:Sc,heading:Kp,heading1:st(Kp),heading2:st(Kp),heading3:st(Kp),heading4:st(Kp),heading5:st(Kp),heading6:st(Kp),contentSeparator:st(Sc),list:st(Sc),quote:st(Sc),emphasis:st(Sc),strong:st(Sc),link:st(Sc),monospace:st(Sc),strikethrough:st(Sc),inserted:st(),deleted:st(),changed:st(),invalid:st(),meta:BS,documentMeta:st(BS),annotation:st(BS),processingInstruction:st(BS),definition:Fu.defineModifier("definition"),constant:Fu.defineModifier("constant"),function:Fu.defineModifier("function"),standard:Fu.defineModifier("standard"),local:Fu.defineModifier("local"),special:Fu.defineModifier("special")};for(let t in J){let e=J[t];e instanceof Fu&&(e.name=t)}Kle([{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 IZe=gd({String:J.string,Number:J.number,"True False":J.bool,PropertyName:J.propertyName,Null:J.null,",":J.separator,"[ ]":J.squareBracket,"{ }":J.brace}),EZe=Fl.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[IZe],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 aN=[],ece=[];(()=>{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,r=0;e<t.length;e++)(e%2?ece:aN).push(r=r+t[e])})();function AZe(t){if(t<768)return!1;for(let e=0,r=aN.length;;){let n=e+r>>1;if(t<aN[n])r=n;else if(t>=ece[n])e=n+1;else return!0;if(e==r)return!1}}function KW(t){return t>=127462&&t<=127487}const e7=8205;function RZe(t,e,r=!0,n=!0){return(r?tce:jZe)(t,e,n)}function tce(t,e,r){if(e==t.length)return e;e&&rce(t.charCodeAt(e))&&nce(t.charCodeAt(e-1))&&e--;let n=fA(t,e);for(e+=t7(n);e<t.length;){let i=fA(t,e);if(n==e7||i==e7||r&&AZe(i))e+=t7(i),n=i;else if(KW(i)){let o=0,s=e-2;for(;s>=0&&KW(fA(t,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function jZe(t,e,r){for(;e>0;){let n=tce(t,e-2,r);if(n<e)return n;e--}return 0}function fA(t,e){let r=t.charCodeAt(e);if(!nce(r)||e+1==t.length)return r;let n=t.charCodeAt(e+1);return rce(n)?(r-55296<<10)+(n-56320)+65536:r}function rce(t){return t>=56320&&t<57344}function nce(t){return t>=55296&&t<56320}function t7(t){return t<65536?1:2}class Ir{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,r,n){[e,r]=Fg(this,e,r);let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(r,this.length,i,1),Nc.from(i,this.length-(r-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,r=this.length){[e,r]=Fg(this,e,r);let n=[];return this.decompose(e,r,n,0),Nc.from(n,r-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let r=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new TO(this),o=new TO(e);for(let s=r,a=r;;){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>=n)return!0}}iter(e=1){return new TO(this,e)}iterRange(e,r=this.length){return new ice(this,e,r)}iterLines(e,r){let n;if(e==null)n=this.iter();else{r==null&&(r=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,r==this.lines+1?this.length:r<=1?0:this.line(r-1).to))}return new oce(n)}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]?Ir.empty:e.length<=32?new yi(e):Nc.from(yi.split(e,[]))}}class yi extends Ir{constructor(e,r=NZe(e)){super(),this.text=e,this.length=r}get lines(){return this.text.length}get children(){return null}lineInner(e,r,n,i){for(let o=0;;o++){let s=this.text[o],a=i+s.length;if((r?n:a)>=e)return new MZe(i,a,n,s);i=a+1,n++}}decompose(e,r,n,i){let o=e<=0&&r>=this.length?this:new yi(r7(this.text,e,r),Math.min(r,this.length)-Math.max(0,e));if(i&1){let s=n.pop(),a=d_(o.text,s.text.slice(),0,o.length);if(a.length<=32)n.push(new yi(a,s.length+o.length));else{let l=a.length>>1;n.push(new yi(a.slice(0,l)),new yi(a.slice(l)))}}else n.push(o)}replace(e,r,n){if(!(n instanceof yi))return super.replace(e,r,n);[e,r]=Fg(this,e,r);let i=d_(this.text,d_(n.text,r7(this.text,0,e)),r),o=this.length+n.length-(r-e);return i.length<=32?new yi(i,o):Nc.from(yi.split(i,[]),o)}sliceString(e,r=this.length,n=`
@@ -510,7 +510,7 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
510
510
  `,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){const r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){const n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind";let o=[];if(i&&r.sep&&!r.value){const s=[];for(let a=0;a<r.sep.length;++a){const l=r.sep[a];switch(l.type){case"newline":s.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ld(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(lhe(r.key)&&!Ld(r.sep,"newline")){const s=vm(r.start),a=r.key,l=r.sep;l.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:l}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(Ld(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{const s=vm(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Ld(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{const s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Ld(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){const r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){const n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||Ld(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){const n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const n=this.startBlockValue(e);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===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){const i=O1(n),o=vm(i);GX(e);const s=e.end.splice(1,e.end.length);s.push(this.sourceToken);const a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(`
511
511
  `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
512
512
  `,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const r=O1(e),n=vm(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const r=O1(e),n=vm(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function Iit(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new $it||null,prettyErrors:e}}function Eit(t,e={}){const{lineCounter:r,prettyErrors:n}=Iit(e),i=new Tit(r?.addNewLine),o=new Sit(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 lO(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(FX(t,r)),s.warnings.forEach(FX(t,r))),s}class Ait{constructor(e){this.providers=e}extractEnvironments(e,r){const n=e.toJS();return Object.keys(n).filter(o=>o!=="version").map(o=>{const s=n[o],a=Object.entries(s.inputs??{}).map(([c,u])=>{const d=this.providers.resolveProviderForMarker(u);return d?{name:c,value:d.resolve(r,o,c),isSecret:!0}:{name:c,value:typeof u=="string"?u:"",isSecret:!1}}),l=Object.entries(s.servers??{}).map(([c,u])=>({apiId:c,value:u.value,variables:Object.entries(u.variables??{}).map(([d,p])=>({name:d,value:p}))}));return{name:o,inputs:a,servers:l,state:Tr.Normal}})}hydrateDocument(e,r,n){const i=new Set(r.map(o=>o.name).filter(Boolean));this.deleteRemovedKeys(e,[],i,"version");for(const o of r)if(o.name){if(!e.hasIn([o.name])){const s=e.createNode({});s instanceof ys&&(s.flow=!1),e.setIn([o.name],s)}this.syncInputs(e,o.name,o.inputs,n),this.syncServers(e,o.name,o.servers)}return e}syncInputs(e,r,n,i){const o=new Set(n.map(s=>s.name));this.deleteRemovedKeys(e,[r,"inputs"],o),n.length>0&&this.unflowMap(e,[r,"inputs"]);for(const s of n){const a=[r,"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,r,s.name,s.value);continue}e.getIn(a)!==s.value&&e.setIn(a,s.value)}}syncServers(e,r,n){const i=new Set(n.map(o=>o.apiId));this.deleteRemovedKeys(e,[r,"servers"],i),n.length>0&&this.unflowMap(e,[r,"servers"]);for(const o of n){const s=[r,"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,r){const n=e.getIn(r,!0);n instanceof ys&&n.flow&&(n.flow=!1)}deleteRemovedKeys(e,r,n,i){for(const o of this.getMapKeys(e,...r))o!==i&&!n.has(o)&&e.deleteIn([...r,o])}getMapKeys(e,...r){const n=r.length===0?e.contents:e.getIn(r,!0);return n instanceof ys?n.items.map(i=>String(i.key)):[]}}class Rit{id="local";isMarker(e){return typeof e=="object"&&e!==null&&"provider"in e&&e.provider===this.id}createMarker(){return{provider:this.id}}resolve(e,r,n){return e[r]?.[n]??""}store(e,r,n,i){e[r]||(e[r]={}),e[r][n]=i}}class jit{constructor(e,r){this.providers=e,this.defaultProviderId=r,this.providersById=new Map(e.map(n=>[n.id,n]))}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 Nit{constructor(e,r){this.storage=e,this.localStorageSecretsProvider=r}default=[];doc=null;handler=new Ait(new jit([new Rit],"local"));filePath="replay-environments.yaml";async read(){const e=await this.loadDocumentFromStorage();if(!e)return this.default;this.doc=e;const r=await this.readSecrets();return this.handler.extractEnvironments(e,r)}async write(e){const r=await this.ensureWritableDocument(),n=await this.readSecrets(),i=this.handler.hydrateDocument(r,e,n);await this.localStorageSecretsProvider.set(JSON.stringify(n)),await this.storage.set(this.filePath,i.toString()),this.doc=i}async ensureWritableDocument(){if(this.doc)return this.doc;const e=await this.loadDocumentFromStorage();return this.doc=e??new ix({}),this.doc}async loadDocumentFromStorage(){const e=await this.storage.get(this.filePath);if(!e)return null;const r=Eit(e);return r.contents?r.errors.length>0?(console.error("Environments file has YAML errors",r.errors),null):r:null}async readSecrets(){const e=await this.localStorageSecretsProvider.get();if(!e)return{};try{return JSON.parse(e)}catch(r){return console.error("Failed to parse replay secrets sidecar",r),{}}}}class Mit{constructor(e,r,n){this.storage=e,this.filePath=r,this.defaultValue=n}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 che=(t,e)=>({data:t,version:e});class uhe extends Mit{constructor(e,r,n,i){super(e,r,n),this.version=i}migrationMap={};migrate(e){if(!this.migrationMap[e.version])return this.defaultValue;const r=this.migrationMap[e.version](e);return r.version===this.version?r:this.migrate(r)}async parse(e){const r=JSON.parse(e);if(r.version!==this.version){const n=this.migrate(r);return await this.write(n.data),n.data}return r.data}stringify(e){return JSON.stringify(che(e,this.version))}}function Dit(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===tt.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 oR=2,Qit="tabs.json";class Lit extends uhe{migrationMap={1:Dit};constructor(e){super(e,Qit,ql(Xj),oR)}async parse(e){let r=null;try{r=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}r||(r=che(ql(Xj),oR)),r.version!==oR&&(r=this.migrate(r));const n=await Promise.all(r.data.tabs.map(async i=>{if(i.data.type===tt.Step){if(i.data.draftStep){const o=i.data.draftStep.requestBody.formData;o["multipart/form-data"]=await YX(o["multipart/form-data"]),o["application/x-www-form-urlencoded"]=await YX(o["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await ex(i.data.draftStep.requestBody.binary.absolutePath))}return{...i,data:{...i.data,isProcessingRequest:!1}}}return i}));return{...r.data,tabs:n}}stringify(e){const r={...e,tabs:e.tabs.map(n=>{if(n.data.type===tt.Step){const{isProcessingRequest:i,...o}=n.data;return{...n,data:{...o,response:null}}}return n.data.type===tt.WorkflowRun?{...n,data:{...n.data,result:null}}:n})};return super.stringify(r)}}async function YX(t){return Promise.all(t.map(async e=>{const r={...e};if(e.files){const n=e.files.map(i=>i.absolutePath).filter(i=>i!==null);r.files=await hfe(n)}return r}))}const qit=1;class dhe{constructor(e,r,n,i,o,s){this.systemFilesStorage=e,this.userFilesStorage=r,this.project=n,this.isApiPersisted=i,this.convertOperationToReplayValue=o,this.telemetry=s,this.localStorageSecretsProvider=new A7e(this.project.id);const a=new E7e;this.activeEnvironmentIdStorage=new uhe(this.systemFilesStorage,"active_environment_id.json",q0,qit),this.tabsStateStorage=new Lit(this.systemFilesStorage),this.environmentsStorage=new Nit(this.userFilesStorage,this.localStorageSecretsProvider),this.collectionsStorage=new bnt(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new R7e(this.isApiPersisted?this.userFilesStorage:a)}activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;localStorageSecretsProvider;persistExcludedIds=new Set;watchExcludedIds=new Set;addPersistExcludedId(e){this.persistExcludedIds.add(e),this.userFilesStorage.setWriteExcludedKeys(new Set([...this.persistExcludedIds]))}removePersistExcludedId(e){this.persistExcludedIds.delete(e),this.userFilesStorage.setWriteExcludedKeys(new Set([...this.persistExcludedIds]))}addWatchExcludedId(e){this.watchExcludedIds.add(e)}removeWatchExcludedId(e){this.watchExcludedIds.delete(e)}isWatchExcluded(e){return this.watchExcludedIds.has(e)}async update(e,r){switch(e.path[0]){case"activeEnvironmentId":this.activeEnvironmentIdStorage.write(r.activeEnvironmentId.get());break;case"tabsState":this.tabsStateStorage.write(r.tabsState.get());break;case"environments":this.environmentsStorage.write(r.environments.get());break;case"apis":this.isApiPersisted&&await this.apisStorage.update(e,r.apis.get());break;case"collections":await this.collectionsStorage.update(e,r.collections.get());break}}}var sR={exports:{}},HX;function zit(){return HX||(HX=1,(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(l,c,u){this.fn=l,this.context=c,this.once=u||!1}function o(l,c,u,d,p){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new i(u,d||l,p),m=r?r+c:c;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],f]:l._events[m].push(f):(l._events[m]=f,l._eventsCount++),l}function s(l,c){--l._eventsCount===0?l._events=new n:delete l._events[c]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],u,d;if(this._eventsCount===0)return c;for(d in u=this._events)e.call(u,d)&&c.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},a.prototype.listeners=function(c){var u=r?r+c:c,d=this._events[u];if(!d)return[];if(d.fn)return[d.fn];for(var p=0,f=d.length,m=new Array(f);p<f;p++)m[p]=d[p].fn;return m},a.prototype.listenerCount=function(c){var u=r?r+c:c,d=this._events[u];return d?d.fn?1:d.length:0},a.prototype.emit=function(c,u,d,p,f,m){var g=r?r+c:c;if(!this._events[g])return!1;var y=this._events[g],v=arguments.length,b,O;if(y.fn){switch(y.once&&this.removeListener(c,y.fn,void 0,!0),v){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,u),!0;case 3:return y.fn.call(y.context,u,d),!0;case 4:return y.fn.call(y.context,u,d,p),!0;case 5:return y.fn.call(y.context,u,d,p,f),!0;case 6:return y.fn.call(y.context,u,d,p,f,m),!0}for(O=1,b=new Array(v-1);O<v;O++)b[O-1]=arguments[O];y.fn.apply(y.context,b)}else{var w=y.length,x;for(O=0;O<w;O++)switch(y[O].once&&this.removeListener(c,y[O].fn,void 0,!0),v){case 1:y[O].fn.call(y[O].context);break;case 2:y[O].fn.call(y[O].context,u);break;case 3:y[O].fn.call(y[O].context,u,d);break;case 4:y[O].fn.call(y[O].context,u,d,p);break;default:if(!b)for(x=1,b=new Array(v-1);x<v;x++)b[x-1]=arguments[x];y[O].fn.apply(y[O].context,b)}}return!0},a.prototype.on=function(c,u,d){return o(this,c,u,d,!1)},a.prototype.once=function(c,u,d){return o(this,c,u,d,!0)},a.prototype.removeListener=function(c,u,d,p){var f=r?r+c:c;if(!this._events[f])return this;if(!u)return s(this,f),this;var m=this._events[f];if(m.fn)m.fn===u&&(!p||m.once)&&(!d||m.context===d)&&s(this,f);else{for(var g=0,y=[],v=m.length;g<v;g++)(m[g].fn!==u||p&&!m[g].once||d&&m[g].context!==d)&&y.push(m[g]);y.length?this._events[f]=y.length===1?y[0]:y:s(this,f)}return this},a.prototype.removeAllListeners=function(c){var u;return c?(u=r?r+c:c,this._events[u]&&s(this,u)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,t.exports=a})(sR)),sR.exports}var Uit=zit();const Vit=uo(Uit);class phe extends Error{constructor(e){super(e),this.name="TimeoutError"}}let Fit=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}};const JX=t=>globalThis.DOMException===void 0?new Fit(t):new DOMException(t),KX=t=>{const e=t.reason===void 0?JX("This operation was aborted."):t.reason;return e instanceof Error?e:JX(e)};function Bit(t,e,r,n){let i;const o=new Promise((s,a)=>{if(typeof e!="number"||Math.sign(e)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${e}\``);if(e===Number.POSITIVE_INFINITY){s(t);return}if(n={customTimers:{setTimeout,clearTimeout},...n},n.signal){const{signal:l}=n;l.aborted&&a(KX(l)),l.addEventListener("abort",()=>{a(KX(l))})}i=n.customTimers.setTimeout.call(void 0,()=>{const l=`Promise timed out after ${e} milliseconds`,c=r instanceof Error?r:new phe(l);typeof t.cancel=="function"&&t.cancel(),a(c)},e),(async()=>{try{s(await t)}catch(l){a(l)}finally{n.customTimers.clearTimeout.call(void 0,i)}})()});return o.clear=()=>{clearTimeout(i),i=void 0},o}function Wit(t,e,r){let n=0,i=t.length;for(;i>0;){const o=Math.trunc(i/2);let s=n+o;r(t[s],e)<=0?(n=++s,i-=o+1):i=o}return n}var tf=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Nu;class Zit{constructor(){Nu.set(this,[])}enqueue(e,r){r={priority:0,...r};const n={priority:r.priority,run:e};if(this.size&&tf(this,Nu,"f")[this.size-1].priority>=r.priority){tf(this,Nu,"f").push(n);return}const i=Wit(tf(this,Nu,"f"),n,(o,s)=>s.priority-o.priority);tf(this,Nu,"f").splice(i,0,n)}dequeue(){const e=tf(this,Nu,"f").shift();return e?.run}filter(e){return tf(this,Nu,"f").filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return tf(this,Nu,"f").length}}Nu=new WeakMap;var ei=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},bt=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},mi,LO,qO,Wd,Vk,zO,$_,Rl,cO,da,T_,ga,UO,qd,I_,e8,t8,fhe,r8,n8,E_,aR,lR,Fk,hhe,A_;class mhe extends Error{}class Xit extends Vit{constructor(e){var r,n,i,o;if(super(),mi.add(this),LO.set(this,void 0),qO.set(this,void 0),Wd.set(this,0),Vk.set(this,void 0),zO.set(this,void 0),$_.set(this,0),Rl.set(this,void 0),cO.set(this,void 0),da.set(this,void 0),T_.set(this,void 0),ga.set(this,0),UO.set(this,void 0),qd.set(this,void 0),I_.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:Zit,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(o=(i=e.interval)===null||i===void 0?void 0:i.toString())!==null&&o!==void 0?o:""}\` (${typeof e.interval})`);ei(this,LO,e.carryoverConcurrencyCount,"f"),ei(this,qO,e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,"f"),ei(this,Vk,e.intervalCap,"f"),ei(this,zO,e.interval,"f"),ei(this,da,new e.queueClass,"f"),ei(this,T_,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,ei(this,I_,e.throwOnTimeout===!0,"f"),ei(this,qd,e.autoStart===!1,"f")}get concurrency(){return bt(this,UO,"f")}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);ei(this,UO,e,"f"),bt(this,mi,"m",Fk).call(this)}async add(e,r={}){return r={timeout:this.timeout,throwOnTimeout:bt(this,I_,"f"),...r},new Promise((n,i)=>{bt(this,da,"f").enqueue(async()=>{var o,s,a;ei(this,ga,(s=bt(this,ga,"f"),s++,s),"f"),ei(this,Wd,(a=bt(this,Wd,"f"),a++,a),"f");try{if(!((o=r.signal)===null||o===void 0)&&o.aborted)throw new mhe("The task was aborted.");let l=e({signal:r.signal});r.timeout&&(l=Bit(Promise.resolve(l),r.timeout)),r.signal&&(l=Promise.race([l,bt(this,mi,"m",hhe).call(this,r.signal)]));const c=await l;n(c),this.emit("completed",c)}catch(l){if(l instanceof phe&&!r.throwOnTimeout){n();return}i(l),this.emit("error",l)}finally{bt(this,mi,"m",fhe).call(this)}},r),this.emit("add"),bt(this,mi,"m",E_).call(this)})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return bt(this,qd,"f")?(ei(this,qd,!1,"f"),bt(this,mi,"m",Fk).call(this),this):this}pause(){ei(this,qd,!0,"f")}clear(){ei(this,da,new(bt(this,T_,"f")),"f")}async onEmpty(){bt(this,da,"f").size!==0&&await bt(this,mi,"m",A_).call(this,"empty")}async onSizeLessThan(e){bt(this,da,"f").size<e||await bt(this,mi,"m",A_).call(this,"next",()=>bt(this,da,"f").size<e)}async onIdle(){bt(this,ga,"f")===0&&bt(this,da,"f").size===0||await bt(this,mi,"m",A_).call(this,"idle")}get size(){return bt(this,da,"f").size}sizeBy(e){return bt(this,da,"f").filter(e).length}get pending(){return bt(this,ga,"f")}get isPaused(){return bt(this,qd,"f")}}LO=new WeakMap,qO=new WeakMap,Wd=new WeakMap,Vk=new WeakMap,zO=new WeakMap,$_=new WeakMap,Rl=new WeakMap,cO=new WeakMap,da=new WeakMap,T_=new WeakMap,ga=new WeakMap,UO=new WeakMap,qd=new WeakMap,I_=new WeakMap,mi=new WeakSet,e8=function(){return bt(this,qO,"f")||bt(this,Wd,"f")<bt(this,Vk,"f")},t8=function(){return bt(this,ga,"f")<bt(this,UO,"f")},fhe=function(){var e;ei(this,ga,(e=bt(this,ga,"f"),e--,e),"f"),bt(this,mi,"m",E_).call(this),this.emit("next")},r8=function(){bt(this,mi,"m",lR).call(this),bt(this,mi,"m",aR).call(this),ei(this,cO,void 0,"f")},n8=function(){const e=Date.now();if(bt(this,Rl,"f")===void 0){const r=bt(this,$_,"f")-e;if(r<0)ei(this,Wd,bt(this,LO,"f")?bt(this,ga,"f"):0,"f");else return bt(this,cO,"f")===void 0&&ei(this,cO,setTimeout(()=>{bt(this,mi,"m",r8).call(this)},r),"f"),!0}return!1},E_=function(){if(bt(this,da,"f").size===0)return bt(this,Rl,"f")&&clearInterval(bt(this,Rl,"f")),ei(this,Rl,void 0,"f"),this.emit("empty"),bt(this,ga,"f")===0&&this.emit("idle"),!1;if(!bt(this,qd,"f")){const e=!bt(this,mi,"a",n8);if(bt(this,mi,"a",e8)&&bt(this,mi,"a",t8)){const r=bt(this,da,"f").dequeue();return r?(this.emit("active"),r(),e&&bt(this,mi,"m",aR).call(this),!0):!1}}return!1},aR=function(){bt(this,qO,"f")||bt(this,Rl,"f")!==void 0||(ei(this,Rl,setInterval(()=>{bt(this,mi,"m",lR).call(this)},bt(this,zO,"f")),"f"),ei(this,$_,Date.now()+bt(this,zO,"f"),"f"))},lR=function(){bt(this,Wd,"f")===0&&bt(this,ga,"f")===0&&bt(this,Rl,"f")&&(clearInterval(bt(this,Rl,"f")),ei(this,Rl,void 0,"f")),ei(this,Wd,bt(this,LO,"f")?bt(this,ga,"f"):0,"f"),bt(this,mi,"m",Fk).call(this)},Fk=function(){for(;bt(this,mi,"m",E_).call(this););},hhe=async function(e){return new Promise((r,n)=>{e.addEventListener("abort",()=>{n(new mhe("The task was aborted."))},{once:!0})})},A_=async function(e,r){return new Promise(n=>{const i=()=>{r&&!r()||(this.off(e,i),n())};this.on(e,i)})};const zl=window.__TAURI__?.http.fetch??globalThis.fetch;class ghe extends S${constructor(){super()}resolveExternalRef(e,r){return __(r)?r:e&&__(e)?new URL(r,e).href:e?Vf.resolve(Vf.dirname(e),r):r}async loadExternalRef(e){if(__(e)){const{body:r,mimeType:n}=await Bte(e,{...this.config.http,customFetch:zl});return new Qg(e,r,n)}else{if(!await U$(e))throw new Error(`File not found at ${e}.`);try{throw await W5(e),new Error(`Expected a file but received a folder at ${e}.`)}catch(i){if(i instanceof Error&&i.message.includes("Expected a file but received a folder"))throw i}const n=await z$(e);return new Qg(e,n.replace(/\r\n/g,`
513
- `))}}}async function Bk(t,e){const r=new p$({});r.getRulesForSpecVersion=()=>[];const n=await Pr.dirname(t),i={config:r,base:n,externalRefResolver:new ghe,dereference:!0};e?i.doc={source:{absoluteRef:t},parsed:e}:i.ref=t;const{bundle:{parsed:o},fileDependencies:s}=await Joe(i);return{definition:o,fileDependencies:s}}class Git{constructor(e){this.apisStorage=e}data=new Map;loading=new Set;pQueue=new Xit({concurrency:20});async get(e){return this.data.has(e)?this.data.get(e)??null:(await this.loadAndParse(e),this.data.get(e)??null)}async load(e,r=!1){this.data.has(e)&&!r||await this.loadAndParse(e,r)}async loadAndParse(e,r=!1){if(this.loading.has(e)){await this.pQueue.add(()=>this.get(e));return}r&&this.data.delete(e),this.loading.add(e),await this.pQueue.add(async()=>{const n=Za(e)?To.WEB:To.FS,i=n===To.WEB?e:await this.apisStorage.getAbsolutePath(e);try{const{definition:o,fileDependencies:s}=await Bk(i);if(!o){this.data.set(e,null);return}const a=this.apisStorage.parse({uri:e,type:n,content:o});this.data.set(e,{...a,fileDependencies:s})}catch(o){if(this.data.set(e,null),o instanceof Error&&(o.message.includes("Unsupported specification")||o.message.includes("File not found")))return;console.error("Error loading api "+e,o);return}}),this.loading.delete(e)}get size(){return this.data.size}delete(e){this.data.delete(e)}getAll(){return Array.from(this.data.values()).filter(e=>e!==null)}clear(){this.data.clear(),this.loading.clear()}}function qe(t,e,r="ui"){let n=`urn:redocly:replay:${r}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!Br()&&(n=mfe(window.location.href)),{object:t,id:e,uri:n}}class i8 extends dhe{apiLoader;constructor(e,r,n){const i=new Kj(e.systemFilesDir),o=new Kj(e.userFilesDir);super(i,o,e,!0,r,n),this.apiLoader=new Git(this.apisStorage),this.setupWriteListeners(o)}setupWriteListeners(e){e.on("write-start",r=>{this.addWatchExcludedId(r)}),e.on("write-end",r=>{this.removeWatchExcludedId(r)})}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",qe("storageOperation","read","storage"),void 0),r=this.telemetry?.startSpan("com.redocly.storage.loadUserState",qe("storageOperation","loadUserState","storage"),e?.parentCtx),[n,i,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);r?.setAttribute("status","completed"),r?.setAttribute("environmentCount",o.length),r?.setStatus(exports.SpanStatusCode.OK),r?.end();const{apiFiles:s,collectionFiles:a}=await this.detectProjectFiles(e);await this.loadAndParseApis(s,e);const c=(await this.loadAndParseCollections(a,e)).filter(d=>d!==null);this.collectionsStorage.setItemIds(c.map(d=>d.id));const u=this.apiLoader.getAll();return this.apisStorage.setItemIds(u.map(d=>d.id)),e?.setAttribute("status","completed"),e?.setStatus(exports.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:n,tabsState:i,environments:o,apis:u,collections:c}}async detectProjectFiles(e){const r=this.telemetry?.startSpan("com.redocly.storage.detectFiles",qe("storageOperation","detectFiles","storage"),e?.parentCtx),{api_files:n,collection_files:i}=await rt("fs_scan",{dir:this.project.userFilesDir});return r?.setAttribute("status","completed"),r?.setAttribute("filesCount",n.length+i.length),r?.setAttribute("apiFilesCount",n.length),r?.setAttribute("collectionFilesCount",i.length),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),{apiFiles:n,collectionFiles:i}}readEnviroments(){return this.environmentsStorage.read()}deleteApiFromCache(e){this.apiLoader.delete(e)}async loadAndParseApis(e,r,n=!1){const i=this.telemetry?.startSpan("com.redocly.storage.parseApis",{...qe("storageOperation","parseApis","storage"),apisCount:e.length},r?.parentCtx),o=await Yj(e,20,async s=>{try{return await this.apiLoader.load(s.relative_path,n),this.apiLoader.get(s.relative_path)}catch(a){return console.error(`Error parsing YAML/JSON file ${s.absolute_path}:`,a),null}});return i?.setAttribute("status","completed"),i?.setAttribute("parsedApisCount",this.apiLoader.size),i?.setStatus(exports.SpanStatusCode.OK),i?.end(),o}async loadAndParseCollections(e,r){const n=this.telemetry?.startSpan("com.redocly.storage.parseCollections",{...qe("storageOperation","parseCollections","storage"),collectionsCount:e.length},r?.parentCtx),i=await Yj(e,20,async o=>{try{const s=await this.userFilesStorage.get(o.relative_path);if(!s)return null;const a=Ff.load(s);if(typeof a!="object"||a===null||typeof a.arazzo!="string")return null;const l=[];await Promise.all(a.sourceDescriptions?.map(async u=>{const d=u.type,p=u.url,f=!d||d==="openapi",m=await yfe({projectPath:this.project.userFilesDir,apiUrl:p,collectionId:o.relative_path});if(f){const g=await this.apiLoader.get(m);g&&l.push(g)}}));const c=await Pr.join(this.project.userFilesDir,o.relative_path);return await this.collectionsStorage.parse({uri:o.relative_path,type:To.FS,content:a,fileDependencies:new Set([c])},l)}catch(s){return console.error(`Error parsing Arazzo file ${o.relative_path}:`,s),null}});return n?.setAttribute("status","completed"),n?.setAttribute("parsedCollectionsCount",i.length),n?.setStatus(exports.SpanStatusCode.OK),n?.end(),i}}class UM{constructor(e){this.baseDir=e}writeExcludedKeys=new Set;setWriteExcludedKeys(e){this.writeExcludedKeys=e}async ls(e=""){const r=this.makeKey(e);return Object.keys(localStorage).filter(n=>n.startsWith(r)).map(n=>n.replace(r,""))}async get(e){const r=this.makeKey(e);return localStorage.getItem(r)??null}async has(e){const r=this.makeKey(e);return localStorage.getItem(r)!==null}async set(e,r){if(this.writeExcludedKeys.has(e))return;const n=this.makeKey(e);localStorage.setItem(n,r)}async remove(e){if(this.writeExcludedKeys.has(e))return;const r=this.makeKey(e);localStorage.removeItem(r)}async rename(e,r){const n=this.makeKey(e),i=this.makeKey(r),o=localStorage.getItem(n);o!==null&&(localStorage.setItem(i,o),localStorage.removeItem(n))}makeKey(e){return`replay:fs:${this.baseDir}/${e}`}on(e,r){}off(e,r){}}class Yit extends dhe{constructor(e,r,n){const i=new UM(e.systemFilesDir),o=new UM(e.userFilesDir);super(i,o,e,!1,r,n)}async detectProjectFiles(e){const r=this.telemetry?.startSpan("com.redocly.storage.detectFiles",qe("storageOperation","detectFiles","storage"),e?.parentCtx),i=(await this.userFilesStorage.ls()).filter(l=>/\.(ya?ml|json)$/.test(l)),o=[],s=[],a=new Set;return await Promise.all(i.map(async l=>{const c=await this.userFilesStorage.get(l);if(c)try{const u=Ff.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const d=await Pr.resolve(await Pr.join(this.userFilesStorage.baseDir,l)),{definition:p}=await Bk(d,u);o.push({uri:l,type:To.FS,content:p})}else typeof u.arazzo=="string"&&(s.push({uri:l,type:To.FS,content:u}),u.sourceDescriptions?.forEach(d=>{const p=d.type,f=d.url,m=!p||p==="openapi",g=typeof f=="string"&&Za(f);m&&g&&a.add(f)}))}catch(u){console.error(`Error parsing YAML/JSON file ${l}:`,u)}})),r?.setAttribute("status","completed"),r?.setAttribute("filesCount",i.length),r?.setAttribute("apiFilesCount",o.length),r?.setAttribute("collectionFilesCount",s.length),r?.setAttribute("apiUrlsCount",a.size),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),{apiFiles:o,collectionFiles:s,apiUrls:a}}async loadApis(e,r){const n=this.telemetry?.startSpan("com.redocly.storage.loadApis",{...qe("storageOperation","loadApis","storage"),apiUrlsCount:e.size},r?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async o=>{try{const{definition:s}=await Bk(o);i.push({uri:o,type:To.WEB,content:s})}catch(s){console.error(`Error parsing YAML from ${o}:`,s)}})),n?.setAttribute("status","completed"),n?.setStatus(exports.SpanStatusCode.OK),n?.end(),i}async parseApis(e,r){const n=this.telemetry?.startSpan("com.redocly.storage.parseApis",{...qe("storageOperation","parseApis","storage"),apisCount:e.length},r?.parentCtx),i=await this.apisStorage.parseMany(e);return n?.setAttribute("status","completed"),n?.setAttribute("parsedApisCount",i.length),n?.setStatus(exports.SpanStatusCode.OK),n?.end(),i}async parseCollections(e,r,n){const i=this.telemetry?.startSpan("com.redocly.storage.parseCollections",{...qe("storageOperation","parseCollections","storage"),collectionsCount:e.length},n?.parentCtx),o=await this.collectionsStorage.parseMany(e,r);return i?.setAttribute("status","completed"),i?.setAttribute("parsedCollectionsCount",o.length),i?.setStatus(exports.SpanStatusCode.OK),i?.end(),o}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",qe("storageOperation","read","storage"),void 0),r=this.telemetry?.startSpan("com.redocly.storage.loadUserState",qe("storageOperation","loadUserState","storage"),e?.parentCtx),[n,i,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);r?.setAttribute("status","completed"),r?.setAttribute("environmentCount",o.length),r?.setStatus(exports.SpanStatusCode.OK),r?.end();const{apiFiles:s,collectionFiles:a,apiUrls:l}=await this.detectProjectFiles(e),c=await this.loadApis(l,e),u=await this.parseApis([...s,...c],e);this.apisStorage.setItemIds(u.map(p=>p.id));const d=await this.parseCollections(a,u,e);return this.collectionsStorage.setItemIds(d.map(p=>p.id)),e?.setAttribute("status","completed"),e?.setStatus(exports.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:n,tabsState:i,environments:o,apis:u,collections:d}}}var o8;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(o8||(o8={}));async function Hit(t,e){await rt("plugin:event|unlisten",{event:t,eventId:e})}async function Jit(t,e,r){var n;const i=(n=void 0)!==null&&n!==void 0?n:{kind:"Any"};return rt("plugin:event|listen",{event:t,target:i,handler:yle(e)}).then(o=>async()=>Hit(t,o))}function Ah(t){return t==null?"":typeof t=="string"?t:typeof t=="object"&&"raw"in t&&typeof t.raw=="string"?t.raw:String(t)}function Vy(t){return t.replace(/\s+/g," ").trim()}function Zb(t){return typeof t=="object"&&t!==null&&"$ref"in t}function vq(t){return Zb(t)?null:t}function Oq(t){try{return JSON.stringify(t)}catch{return String(t)}}function yhe(t){let e=`${t.name} (${t.in}`;return t.required&&(e+=", required"),t.type&&(e+=`, ${t.type}`),t.format&&(e+=`, format: ${t.format}`),t.enum&&(e+=`, enum: [${t.enum.join(",")}]`),t.pattern&&(e+=`, pattern: ${t.pattern}`),e+=")",e}function vhe(t){return t.type?Array.isArray(t.type)?t.type.join("|"):t.type:t.oneOf?"oneOf":t.anyOf?"anyOf":t.allOf?"allOf":"object"}function Kit(t){return t==="querystring"?"query":t==="query"||t==="header"||t==="path"||t==="cookie"?t:"query"}function eot(t){const e=t.schema&&!Zb(t.schema)?t.schema:null,r={name:t.name,in:Kit(t.in),required:t.required??!1};return e&&(r.type=vhe(e),e.format&&(r.format=e.format),e.enum&&(r.enum=e.enum.map(String)),e.pattern&&(r.pattern=e.pattern),e.example!==void 0&&(r.example=String(e.example))),t.description&&(r.description=Ah(t.description)),t.example!==void 0&&!r.example&&(r.example=String(t.example)),r}function tot(t,e){const r=new Set,n=[],i=o=>{for(const s of o){const a=vq(s);if(!a||!a.name)continue;const l=`${a.in}:${a.name}`;r.has(l)||(r.add(l),n.push(eot(a)))}};return t.parameters&&i(t.parameters),e.parameters&&i(e.parameters),n}function Ohe(t,e=2,r=0){if(r>=e||!t.properties)return[];const n=new Set(t.required??[]);return Object.entries(t.properties).map(([i,o])=>({name:i,type:vhe(o),required:n.has(i),readOnly:o.readOnly}))}function bhe(t){const e=t.components?.securitySchemes;if(!e)return[];const r=[];for(const[n,i]of Object.entries(e)){const o=vq(i);o&&r.push(rot(n,o))}return r}function rot(t,e){const r={schemeName:t,type:e.type};if(e.in&&(r.in=e.in),e.name&&(r.name=e.name),e.scheme&&(r.scheme=e.scheme),e.bearerFormat&&(r.bearerFormat=e.bearerFormat),e.flows){const n=Object.keys(e.flows).filter(o=>e.flows[o]);n.length>0&&(r.flows=n.join(", "));const i=new Set;for(const o of n){const s=e.flows[o];s?.scopes&&Object.keys(s.scopes).forEach(a=>i.add(a))}i.size>0&&(r.scopes=[...i].join(", "))}return r}function not(t,e,r){const n=t??e;if(!n||r.length===0)return[];const i=new Set;for(const o of n)for(const s of Object.keys(o))i.add(s);return r.filter(o=>i.has(o.schemeName))}function iot(t){return t.length===0?"":`Security: ${t.map(r=>{let n=`${r.schemeName} (${r.type}`;return r.scheme&&(n+=`, ${r.scheme}`),r.in&&r.name&&(n+=`, ${r.name} in ${r.in}`),n+=")",n}).join("; ")}.`}const oot=["get","put","post","delete","options","head","patch","trace"],sot=["query","x-query"];function aot(t,e){const r=[],n=Object.keys(t.content??{});if(n.length===0)return{textPart:"",schemaJson:"{}",examples:r};const i=n.find(d=>d.includes("json"))??n[0],o=t.content?.[i],s=o?.schema&&!Zb(o.schema)?o.schema:null,l=(s?Ohe(s):[]).filter(d=>!e.hideReadOnly||!d.readOnly),c=t.required?"required":"optional";let u=`Request body (${i}, ${c})`;if(l.length>0){const d=l.map(p=>`${p.name}: ${p.type}${p.required?" required":""}${p.readOnly?" readOnly":""}`);u+=`: {${d.join(", ")}}`}return o?.example!==void 0&&r.push(Oq(o.example)),{textPart:u,schemaJson:JSON.stringify(l),examples:r}}function lot(t){const e=[],r=[];for(const[n,i]of Object.entries(t)){if(Zb(i))continue;const o=Ah(i.description??"");e.push(`${n} ${o}`.trim());const s={statusCode:n};o&&(s.description=o);const a=i.content;if(a){const l=Object.keys(a).find(u=>u.includes("json"))??Object.keys(a)[0],c=a[l]?.schema;if(c&&!Zb(c)){const u=Ohe(c);u.length>0&&(s.schemaProperties=JSON.stringify(u))}}r.push(s)}return{textParts:e,summaries:r}}function VM(t){const{apiId:e,apiTitle:r,path:n,method:i,op:o,pathItem:s,globalSchemes:a,apiSecurity:l}=t,c=o.summary??"",u=Ah(o.description??""),d=o.operationId??"",p=o.tags??[],f=i.toUpperCase(),m=tot(o,s),g=not(o.security,l,a),y=g.length>0?g.map(j=>`api_sec:${e}:${j.schemeName}`):void 0,v=[r,`${f} ${n}`,c,u];d&&v.push(`operationId: ${d}`),p.length>0&&v.push(`Tags: ${p.join(", ")}`),o.deprecated&&v.push("DEPRECATED"),m.length>0&&v.push(`Parameters: ${m.map(yhe).join(". ")}.`);let b;const O=[],w=o.requestBody;if(w){const j=vq(w);if(j){const R=aot(j,{hideReadOnly:f==="POST"||f==="PUT"||f==="PATCH"});R.textPart&&v.push(R.textPart),b=R.schemaJson,O.push(...R.examples)}}const{textParts:x,summaries:S}=lot(o.responses??{});x.length>0&&v.push(`Responses: ${x.join(", ")}.`);const _=iot(g);_&&v.push(_);const C=`api_op:${e}:${n}:${i}:${d||`${n}-${i}`}`,$={type:"api_operation",id:C,contentHash:"",title:c||`${f} ${n}`,description:u||void 0,apiId:e,path:n,method:f,operationId:d||void 0,tags:p.length>0?p:void 0,deprecated:o.deprecated||void 0,parameterDetails:m.length>0?m:void 0,requestBodySchema:b,responseSchemas:S.length>0?S:void 0,securitySchemeRefs:y,examples:O.length>0?O:void 0};return{id:C,text:Vy(v.filter(Boolean).join(" ")),payload:$}}function FM(t){const e=t.info?.title??"Untitled API",r=Ah(t.info?.description??t.info?.summary??""),n=t.id;return{id:`api:${n}`,text:Vy([e,r].filter(Boolean).join(" ")),payload:{type:"api",id:`api:${n}`,contentHash:"",title:e,description:r||void 0,apiId:n}}}function xhe(t){const e=[];for(const r of t){e.push(FM(r));const n=r.info?.title??"Untitled API",i=r.id,o=bhe(r);for(const a of o){const l=`api_sec:${i}:${a.schemeName}`,c=[`${a.schemeName}: type=${a.type}`,a.scheme?`scheme=${a.scheme}`:"",a.in&&a.name?`${a.name} in ${a.in}`:"",a.bearerFormat?`format=${a.bearerFormat}`:"",a.flows?`flows=[${a.flows}]`:"",a.scopes?`scopes=[${a.scopes}]`:""].filter(Boolean).join(" ");e.push({id:l,text:Vy(`${n} Authentication. ${a.schemeName}. ${c}.`),payload:{type:"api_security",id:l,contentHash:"",title:`${n} — ${a.schemeName}`,apiId:i,securityScheme:a}})}const s=r.paths??{};for(const[a,l]of Object.entries(s)){if(!l||typeof l!="object")continue;const c=[...oot.filter(d=>d in l),...sot.filter(d=>d in l)];for(const d of c){const p=l[d];!p||typeof p!="object"||e.push(VM({apiId:i,apiTitle:n,path:a,method:d,op:p,pathItem:l,globalSchemes:o,apiSecurity:r.security}))}const u=l.additionalOperations;if(u&&typeof u=="object")for(const[d,p]of Object.entries(u))!p||typeof p!="object"||e.push(VM({apiId:i,apiTitle:n,path:a,method:d,op:p,pathItem:l,globalSchemes:o,apiSecurity:r.security}))}}return e}function cot(t){const e=[],r=[{list:t.queryParameters,loc:"query"},{list:t.headers,loc:"header"},{list:t.cookies,loc:"cookie"},{list:t.pathParameters,loc:"path"}];for(const{list:n,loc:i}of r)for(const o of n)if("key"in o){const s=o;e.push({name:s.key,in:i,required:!1})}return e}function BM(t){const e=t.id,r=t.info?.title??"Untitled Collection",n=Ah(t.info?.description??t.info?.summary??"");return{id:`collection:${e}`,text:Vy([r,n].filter(Boolean).join(" ")),payload:{type:"collection",id:`collection:${e}`,contentHash:"",title:r,description:n||void 0,collectionId:e}}}function whe(t){const{collectionId:e,collectionTitle:r,workflow:n}=t,i=n.workflowId??"",o=n.summary??i,s=Ah(n.description??""),a=[r,o,s];if(n.inputs&&a.push(`Inputs schema: ${Oq(n.inputs)}`),n.outputs?.length){const l=n.outputs.map(c=>c.key).filter(Boolean);l.length&&a.push(`Outputs: ${l.join(", ")}`)}return n.dependsOn?.length&&a.push(`Depends on: ${n.dependsOn.join(", ")}`),{id:`workflow:${e}:${i}`,text:Vy(a.filter(Boolean).join(" ")),payload:{type:"workflow",id:`workflow:${e}:${i}`,contentHash:"",title:o,description:s||void 0,collectionId:e,workflowId:i}}}function She(t){const{collectionId:e,collectionTitle:r,workflowId:n,workflowTitle:i,step:o}=t,s=o.stepId??"",a=Ah(o.description??""),l=o.operation,c=o.xOperation,u=[r,i,`step: ${s}`];a&&u.push(a),l?(u.push(`${l.method?.toUpperCase()} ${l.path}`),l.apiId&&u.push(`API: ${l.apiId}`),l.operationId&&u.push(`operationId: ${l.operationId}`)):c&&u.push(`${c.method?.toUpperCase()} ${c.url}`);const d=o.parameters?cot(o.parameters):[];d.length>0&&u.push(`Parameters: ${d.map(yhe).join(". ")}.`),o.requestBody?.type&&u.push(`Request body type: ${o.requestBody.type}`);const f=(o.successCriteria??[]).map(g=>{let y=g.condition;return g.context&&(y+=` context: ${g.context}`),g.type&&(y+=` (${g.type})`),y});if(f.length>0&&u.push(`Success criteria: ${f.join("; ")}`),o.outputs?.length){const g=o.outputs.map(y=>`${y.key}=${y.value}`).filter(Boolean);g.length&&u.push(`Outputs: ${g.join(", ")}`)}const m=`step:${e}:${n}:${s}`;return{id:m,text:Vy(u.filter(Boolean).join(" ")),payload:{type:"step",id:m,contentHash:"",title:s,description:a||void 0,collectionId:e,workflowId:n,stepId:s,path:l?.path??c?.url,method:(l?.method??c?.method)?.toUpperCase(),apiId:l?.apiId,operationId:l?.operationId,parameterDetails:d.length>0?d:void 0,successCriteria:f.length>0?f:void 0,requestBodySchema:o.requestBody?.type?Oq(o.requestBody):void 0}}}function _he(t){const e=[];for(const r of t){const n=r.id,i=r.info?.title??"Untitled Collection";e.push(BM(r));for(const o of r.workflows??[]){e.push(whe({collectionId:n,collectionTitle:i,workflow:o}));const s=o.workflowId??"",a=o.summary??s;for(const l of o.steps??[])e.push(She({collectionId:n,collectionTitle:i,workflowId:s,workflowTitle:a,step:l}))}}return e}function uot(t,e){return[...xhe(t),..._he(e)]}const cR=10,dot=4;function s8(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r)|0;return e>>>0}function pot(t){return Ng(S0(t))}class fot extends Z5{constructor(e){super(),this.collectionName=e}activeIndexJobs=0;getIndexingActivityState(){return{inProgress:this.activeIndexJobs>0}}beginIndexJob(){this.activeIndexJobs++,this.activeIndexJobs===1&&this.emit("indexing-activity",{inProgress:!0})}endIndexJob(){this.activeIndexJobs=Math.max(0,this.activeIndexJobs-1),this.activeIndexJobs===0&&this.emit("indexing-activity",{inProgress:!1})}async getIdsByPayload(e,r){return rt("semantic_search_get_ids_by_payload",{collectionName:this.collectionName,field:e,value:r})}async getAllIds(){return rt("semantic_search_get_all_ids",{collectionName:this.collectionName})}async getScopeHashes(e){const r=e.apiIds??[],n=e.collectionIds??[];let i;if(r.length===0&&n.length===0)i=await this.getAllIds();else{const s=[];for(const l of r)s.push(this.getIdsByPayload("apiId",l));for(const l of n)s.push(this.getIdsByPayload("collectionId",l));i=(await Promise.all(s)).flat()}const o=new Map;for(const s of i)o.set(s.id,s.contentHash);return o}async indexDocuments(e,r){if(e.length===0&&!r)return{added:0,updated:0,removed:0,unchanged:0};this.beginIndexJob();try{return await this.runIndexDocuments(e,r)}finally{this.endIndexJob()}}async runIndexDocuments(e,r){const n=await this.getScopeHashes(r??{}),i=[],o=new Set;let s=0,a=0;for(const u of e){const d=pot(u.text);u.payload.contentHash=d,o.add(u.id);const p=n.get(u.id);p===d?a++:(p||s++,i.push(u))}const l=i.length-s,c=[];for(const u of n.keys())o.has(u)||c.push(u);return c.length>0&&await this.deletePoints(c.map(s8)),i.length>0&&await this.embedAndUpsert(i),(c.length>0||i.length>0)&&await this.flush(),{added:s,updated:l,removed:c.length,unchanged:a}}async removeByPayloadFilter(e,r){return rt("semantic_search_delete_by_payload",{collectionName:this.collectionName,field:e,value:r})}async getStoredDocumentCount(){try{return(await rt("plugin:velesdb|list_collections"))?.find(n=>n.name===this.collectionName)?.count??0}catch{return 0}}async getDocumentsByIds(e){if(e.length===0)return new Map;const r=e.map(s8),n=await rt("plugin:velesdb|get_points",{request:{collection:this.collectionName,ids:r}}),i=new Map;for(const o of n??[])if(o?.payload){const s=o.payload;s.id&&i.set(s.id,s)}return i}async embedAndUpsert(e){const r=[],n=e.length;for(let i=0;i<n;i+=cR)r.push({docs:e.slice(i,i+cR),index:Math.floor(i/cR)});await Yj(r,dot,async i=>{const o=i.docs.map(s=>({id:s.id,text:s.text||s.payload.title,payload:s.payload}));await rt("semantic_search_embed_and_upsert",{collectionName:this.collectionName,documents:o})})}async deletePoints(e){e.length!==0&&await rt("plugin:velesdb|delete_points",{request:{collection:this.collectionName,ids:e}})}async flush(){await rt("plugin:velesdb|flush",{name:this.collectionName}),await rt("semantic_search_write_hnsw_marker",{collectionName:this.collectionName}).catch(()=>{})}}const a8="replay_search",hot=384,Om={added:0,updated:0,removed:0,unchanged:0};class mot extends Z5{initialized=!1;projectId=null;indexer=null;indexQueue=Promise.resolve();get collectionName(){return this.projectId?`${a8}_${this.projectId}`:a8}createIndexer(){const e=new fot(this.collectionName);return e.subscribe("indexing-activity",r=>{this.emit("indexing-activity",r)}),e}getIndexer(){return this.indexer||(this.indexer=this.createIndexer()),this.indexer}getIndexingActivityState(){return this.getIndexer().getIndexingActivityState()}async ensureInitialized(){this.initialized||await this.init()}enqueueIndex(e){const n=this.indexQueue.then(()=>e()).catch(i=>{throw console.error("Semantic index:",i),i}).finally(()=>this.unloadModel());return this.indexQueue=n.catch(()=>{}),n}async unloadModel(){try{await rt("semantic_search_unload_model")}catch{}}setProject(e){this.projectId!==e&&(this.projectId=e,this.initialized=!1,this.indexer=this.createIndexer())}async init(){if(Br()&&!this.initialized){try{if((await rt("plugin:velesdb|list_collections"))?.some(r=>r.name===this.collectionName)){this.initialized=!0;return}}catch{}await rt("plugin:velesdb|create_collection",{request:{name:this.collectionName,dimension:hot,metric:"cosine",storage_mode:"full"}}),this.initialized=!0}}async indexApis(e){if(!Br())return Om;await this.ensureInitialized();const r=this.collectionName,n=this.getIndexer(),i=xhe(e),o={apiIds:e.map(s=>s.id)};return this.enqueueIndex(async()=>this.collectionName!==r?Om:n.indexDocuments(i,o))}async indexCollections(e){if(!Br())return Om;await this.ensureInitialized();const r=this.collectionName,n=this.getIndexer(),i=_he(e),o={collectionIds:e.map(s=>s.id)};return this.enqueueIndex(async()=>this.collectionName!==r?Om:n.indexDocuments(i,o))}async removeApi(e){if(!Br())return;await this.ensureInitialized(),await this.getIndexer().removeByPayloadFilter("apiId",e)}async removeCollection(e){if(!Br())return;await this.ensureInitialized(),await this.getIndexer().removeByPayloadFilter("collectionId",e)}async reindex(e,r){if(!Br())return Om;await this.ensureInitialized();const n=this.collectionName,i=this.getIndexer(),o=uot(e,r);return this.enqueueIndex(async()=>this.collectionName!==n?Om:i.indexDocuments(o))}async search(e,r=10,n){if(!Br())return[];try{await this.ensureInitialized();const i=n&&Object.keys(n).length>0?{type:n.type,apiId:n.apiId,collectionId:n.collectionId,path:n.path,method:n.method,operationId:n.operationId,workflowId:n.workflowId,stepId:n.stepId}:void 0,s=((await rt("semantic_search_text",{collection:this.collectionName,query:e,topK:r,filters:i})).results??[]).map(a=>({...a.payload,score:a.score??0}));return await this.enrichWithRelatedSecurity(s),s}catch{return[]}}async enrichWithRelatedSecurity(e){const r=e.filter(o=>o.type==="api_operation"&&o.securitySchemeRefs?.length);if(r.length===0)return;const n=[...new Set(r.flatMap(o=>o.securitySchemeRefs??[]))],i=await this.getIndexer().getDocumentsByIds(n);for(const o of r){const s=[];for(const a of o.securitySchemeRefs??[]){const l=i.get(a);l?.securityScheme&&s.push(l.securityScheme)}s.length>0&&(o.relatedSecuritySchemes=s)}}async status(){if(!Br())return{indexed:0,modelLoaded:!1};const e=await this.getIndexer().getStoredDocumentCount();let r=!1;try{r=(await rt("semantic_search_model_status")).loaded}catch{}return{indexed:e,modelLoaded:r}}async clear(){if(!(!Br()||!this.initialized))try{await rt("plugin:velesdb|delete_collection",{name:this.collectionName}),this.initialized=!1}catch{}}async preloadModel(){if(Br())try{await rt("semantic_search_preload_model")}catch{}}}let uR=null;function ep(){return uR||(uR=new mot),uR}class got{constructor(e,r,n,i){this.storage=e,this.state=r,this.projectDir=n,this.aiEnabled=i}watchPath=null;unlistenEvent=null;get tauriStorage(){return this.storage}indexApis(e){!this.aiEnabled||e.length===0||ep().indexApis(e).catch(r=>console.error("Semantic index (apis):",r))}indexCollections(e){!this.aiEnabled||e.length===0||ep().indexCollections(e).catch(r=>console.error("Semantic index (collections):",r))}removeApis(e){if(!this.aiEnabled||e.length===0)return;const r=ep();Promise.all(e.map(n=>r.removeApi(n))).catch(n=>console.error("Semantic remove (apis):",n))}removeCollections(e){if(!this.aiEnabled||e.length===0)return;const r=ep();Promise.all(e.map(n=>r.removeCollection(n))).catch(n=>console.error("Semantic remove (collections):",n))}async start(){if(this.watchPath){console.warn("Watcher already started for:",this.watchPath);return}try{this.unlistenEvent=await Jit("fs-watch-event",async e=>{const r=e.payload;try{await this.handleEvent(r)}catch(n){console.error("Error handling file change:",n)}}),await rt("fs_watch",{path:this.projectDir,options:{recursive:!0,delayMs:500}}),this.watchPath=this.projectDir}catch(e){throw console.error("Failed to start file watcher:",e),this.unlistenEvent&&(this.unlistenEvent(),this.unlistenEvent=null),e}}async stop(){if(this.watchPath)try{await rt("fs_unwatch",{path:this.watchPath})}catch(e){console.error("Error stopping file watcher:",e)}finally{this.unlistenEvent&&(this.unlistenEvent(),this.unlistenEvent=null),this.watchPath=null}}async handleEvent(e){const{changeType:r,paths:n,pathTypes:i,type:o}=e;if(await this.isProjectFolderRemoved(n,r)){await this.handleProjectFolderRemoval();return}const s=this.filterSpecFiles(n,i);if(s.paths.length===0)return;const a=await this.toFileEntries(s.paths,s.pathTypes);switch(r){case"changed":(o.includes("Data")||o.includes("Name"))&&await this.handleModify(a);break;case"added":await this.handleCreate(a);break;case"deleted":await this.handleDelete(a);break;case"renamed":await this.handleRename(a);break;default:console.log("Unhandled change type:",r)}}filterSpecFiles(e,r){const n=[],i=[];for(let o=0;o<e.length;o++){const s=e[o],a=s.split(".").pop()?.toLowerCase();a&&["yaml","yml","json"].includes(a)&&(n.push(s),i.push(r[o]||"unknown"))}return{paths:n,pathTypes:i}}async toFileEntries(e,r){return Promise.all(e.map(async(n,i)=>({relative_path:await Pr.relative(this.projectDir,n),absolute_path:n,type:r[i]||"unknown"})))}consolidateFileEntries(e){const r=[],n=new Set;for(const i of e)n.has(i.relative_path)||(n.add(i.relative_path),this.storage.isWatchExcluded(i.relative_path)||r.push(i));return r}async handleModify(e){const r=!this.storage.isWatchExcluded("replay-environments.yaml")&&e.some(f=>f.relative_path==="replay-environments.yaml"),n=e.filter(f=>f.relative_path!=="replay-environments.yaml"),{newApiFiles:i,existingApiFiles:o}=this.categorizeApisFromFiles(n),{newCollectionFiles:s,existingCollectionFiles:a}=this.categorizeCollectionsFromFiles(n),l=await this.findApisToReload(e),c=await this.findCollectionsToReload(e),u=[...i,...s];u.length>0&&await this.handleCreate(u),r&&await this.reloadEnvironments();const d=this.consolidateFileEntries([...o,...l]),p=this.consolidateFileEntries([...a,...c]);await this.reloadApis(d),await this.reloadCollections(p)}async handleCreate(e){const r=e.filter(l=>l.type==="api"),n=e.filter(l=>l.type==="collection"),{newApiFiles:i,existingApiFiles:o}=this.categorizeApisFromFiles(r),{newCollectionFiles:s,existingCollectionFiles:a}=this.categorizeCollectionsFromFiles(n);if(i.length>0||s.length>0){i.forEach(p=>this.storage.addPersistExcludedId(p.relative_path)),s.forEach(p=>this.storage.addPersistExcludedId(p.relative_path));const l=i.length>0?await this.tauriStorage.loadAndParseApis(i,void 0,!0):[],c=s.length>0?await this.tauriStorage.loadAndParseCollections(s,void 0):[],u=l.filter(p=>p!==null),d=c.filter(p=>p!==null);this.state.apis.merge(u),this.state.collections.merge(d),this.indexApis(u),this.indexCollections(d),setTimeout(()=>{i.forEach(p=>this.storage.removePersistExcludedId(p.relative_path)),s.forEach(p=>this.storage.removePersistExcludedId(p.relative_path))},500)}o.length>0&&await this.reloadApis(o),a.length>0&&await this.reloadCollections(a)}categorizeApisFromFiles(e){const r=new Set,n=[],i=[];for(const o of e){if(r.has(o.relative_path))continue;r.add(o.relative_path),this.state.apis.get({noproxy:!0}).some(a=>a.id===o.relative_path)?i.push(o):o.type==="api"&&n.push(o)}return{newApiFiles:n,existingApiFiles:i}}categorizeCollectionsFromFiles(e){const r=new Set,n=[],i=[];for(const o of e){if(r.has(o.relative_path))continue;r.add(o.relative_path),this.state.collections.get({noproxy:!0}).some(a=>a.id===o.relative_path)?i.push(o):o.type==="collection"&&n.push(o)}return{newCollectionFiles:n,existingCollectionFiles:i}}async handleDelete(e){const r=[],n=[];for(const i of e){this.storage.addPersistExcludedId(i.relative_path);const o=this.state.apis.get({noproxy:!0}).findIndex(a=>a.id===i.relative_path);o>=0&&(this.state.apis[o].set(Zt),this.tauriStorage.deleteApiFromCache(i.relative_path),r.push(i.relative_path));const s=this.state.collections.get({noproxy:!0}).findIndex(a=>a.id===i.relative_path);s>=0&&(this.state.collections[s].set(Zt),n.push(i.relative_path)),setTimeout(()=>{this.storage.removePersistExcludedId(i.relative_path)},500)}this.removeApis(r),this.removeCollections(n)}async handleRename(e){if(e.length>=2){const[r,n]=e;await this.handleDelete([r]),await this.handleCreate([n])}else await this.handleCreate(e)}async isProjectFolderRemoved(e,r){if(e.length===0)return!1;if(r==="deleted"||r==="renamed"){for(const i of e)if(i===this.projectDir)return!0}return e.filter(i=>!i.startsWith(this.projectDir+"/")&&i!==this.projectDir).length>0&&r==="renamed"}async handleProjectFolderRemoval(){const e=this.state.apis.get({noproxy:!0}),r=e.map(o=>o.id);e.forEach(o=>{this.storage.addPersistExcludedId(o.id),this.tauriStorage.deleteApiFromCache(o.id)}),this.state.apis.set([]);const n=this.state.collections.get({noproxy:!0}),i=n.map(o=>o.id);n.forEach(o=>{this.storage.addPersistExcludedId(o.id)}),this.state.collections.set([]),setTimeout(()=>{e.forEach(o=>this.storage.removePersistExcludedId(o.id)),n.forEach(o=>this.storage.removePersistExcludedId(o.id))},500),this.removeApis(r),this.removeCollections(i),await this.stop()}async findApisToReload(e){const r=[];return await Promise.all(this.state.apis.map(async n=>{const i=n.fileDependencies?.get({noproxy:!0})??new Set,o=n.get({noproxy:!0}).id,s=e.find(a=>i.has(a.absolute_path));if(!this.storage.isWatchExcluded(o)&&s){const a=await Pr.join(this.projectDir,o);r.push({relative_path:o,absolute_path:a,type:"api"})}})),r}async findCollectionsToReload(e){const r=[];return await Promise.all(this.state.collections.map(async n=>{const i=n.fileDependencies?.get({noproxy:!0})??new Set,o=n.get({noproxy:!0}).id,s=e.find(a=>i.has(a.absolute_path));if(!this.storage.isWatchExcluded(o)&&s){const a=await Pr.join(this.projectDir,o);r.push({relative_path:o,absolute_path:a,type:"collection"})}})),r}async reloadEnvironments(){const e=await this.tauriStorage.readEnviroments();this.storage.addPersistExcludedId("replay-environments.yaml"),this.state.environments.set(e),setTimeout(()=>{this.storage.removePersistExcludedId("replay-environments.yaml")},500)}async reloadApis(e){if(e.length===0)return;const r=await this.tauriStorage.loadAndParseApis(e,void 0,!0),n=[];await Promise.all(r.map(async(i,o)=>{if(!i){await this.handleDelete([e[o]]);return}const s=this.state.apis.get({noproxy:!0}).findIndex(a=>a.id===i.id);s>=0?(this.storage.addPersistExcludedId(i.id),this.state.apis[s].set(i),n.push(i),setTimeout(()=>this.storage.removePersistExcludedId(i.id),500)):console.warn("API not found in state after reload:",i.id)})),n.length>0&&this.indexApis(n)}async reloadCollections(e){if(e.length===0)return;const r=await this.tauriStorage.loadAndParseCollections(e,void 0),n=[];await Promise.all(r.map(async(i,o)=>{if(!i){await this.handleDelete([e[o]]);return}const s=this.state.collections.get({noproxy:!0}).findIndex(a=>a.id===i.id);s>=0?(this.storage.addPersistExcludedId(i.id),this.state.collections[s].set(i),n.push(i),setTimeout(()=>this.storage.removePersistExcludedId(i.id),500)):console.warn("Collection not found in state after reload:",i.id)})),n.length>0&&this.indexCollections(n)}}function Che(t=!1){let e,r=!1,n=null,i=null;async function o(l){if(!(!Br()||!e||!i)){await s();try{const c=i.project.userFilesDir.get();n=new got(e,i,c,l),await n.start()}catch(c){console.error("Failed to start file watcher:",c),n=null}}}async function s(){n&&(await n.stop(),n=null)}async function a(){Br()&&(await s(),await rt("cleanup_all_managed_watchers"))}return()=>({id:"RootStoragePlugin",onCreate:(l,c)=>({getTauriRootStorage:u=>()=>e instanceof i8?e:void 0,cleanup:()=>async()=>{await a()},init:u=>async(d,p,f)=>{if(r||u.path.length>0)return{isInitialized:!1};const{convertOperationToReplayValue:m,aiEnabled:g}=p,y=Br();if(r=!0,i=u,t)return r=!1,{isInitialized:!0};e=y?new i8(d,m,f):new Yit(d,m,f);const v=await e.read();if(u.merge(v),!y)return r=!1,{isInitialized:!0};try{if(await o(g??!1),g){const b=ep();b.setProject(d.id),b.preloadModel().catch(()=>{}),b.reindex(v.apis,v.collections).catch(O=>{console.error("Semantic reindex failed:",O)})}}finally{r=!1}return{isInitialized:!0}}}),onSet(l,c,u){r||!t&&e&&e.update(c,u)},onDestroy:async()=>{await a()}})}function khe({defaultEnvironments:t}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},tabsState:ql(Xj),activeEnvironmentId:q0,environments:t||gle,collections:[],apis:[],requestController:null,apps:{apps:[],appsLoadingState:Pc.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set})}const yot=Rte(khe(),jte(XWe({key:"replay-root-store"}),Che())),bq=P.createContext(yot),vot=bq.Provider;function Wt(){const t=P.useContext(bq);return bQ(t)}function Oot(){return{theme:"light",disableCollectionsTab:!1,oAuth2RedirectURI:null,corsProxyUrl:void 0,credentialOrigin:void 0,certificates:[],isApiBased:!1,generatedEnvironments:[],generatedInputs:[],hideOtherSecuritySchemes:!1,aiEnabled:!1,isPreviewLayout:!1}}const bot=Oot(),xot=P.createContext(bot);function Eo(){const t=P.useContext(xot);return bQ(t)}function wot(t,e){const{apps:{apiId:r}}=Wt(),{corsProxyUrl:n,credentialOrigin:i,disableCollectionsTab:o,oAuth2RedirectURI:s,certificates:a,storageKey:l,isApiBased:c,aiEnabled:u,isPreviewLayout:d}=Eo();n.set(t?.corsProxyUrl??RWe),i.set(t?.credentialOrigin),r.set(t?.apiId),s.set(t?.oAuth2RedirectURI),o.set(!!t?.disableCollectionsTab),l.set(t?.storageKey),c.set(!!e),u.set(!!t?.aiEnabled),d.set(t?.layout==="preview"),P.useEffect(()=>{a.set(t?.certificates||[])},[t?.certificates])}const vT=P.createContext({});function eo(){return P.useContext(vT)||{}}const Phe=process.env.NODE_ENV==="development",l8=process.env.NODE_ENV==="production",Sot="0.25.0-next.5",_ot={version:Sot},Cot={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"",origin:"replayUi"};class $he{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new AWe}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(()=>({...Cot,...e,env:l8?"production":"development"}))}enrichGlobalAttributes(e){this._globalAttributes={...this._globalAttributes,...e}}getGlobalAttributes(){return{...this._globalAttributes}}clearGlobalAttributes(){this._globalAttributes={platform:"",deviceId:""}}init(e){if(this.isInitialized)return;const{cloudEventData:r,...n}=e??{},i=n.tracerName||"desktop",o=n.enableErrorInstrumentation??i==="desktop",s={serviceName:"replay",serviceVersion:_ot.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:l8,enableErrorInstrumentation:o};this._client.init({otel:{...s,...n}}),this.setCloudEventData(r),this._initResolve?.(this),this._isInitialized=!0}sendEvent(e,r){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const n=Array.isArray(r)?r.map(i=>({...this._globalAttributes,...i})):{...this._globalAttributes,...r};Phe&&console.log(`[Telemetry] ${e}:`,JSON.stringify(n,null,2));try{this.client.send(e,n)}catch(i){console.error("Failed to send telemetry event:",i)}}startSpan(e,r,n){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{return this._client.startSpan(e,{...this._globalAttributes,...r},n)}catch(i){console.error("Failed to start telemetry span:",i);return}}}const yf=new $he;function It(){const{telemetry:t}=eo();yf.isInitialized||yf.init(t);const e=t?.cloudEventData;P.useEffect(()=>{e&&yf.setCloudEventData(e)},[e]);const r=P.useCallback((i,o)=>{yf.sendEvent(i,o)},[]),n=P.useCallback((i,o,s)=>yf.startSpan(i,o,s),[]);return{sendEvent:r,startSpan:n}}const kot=({awaitInit:t=!0}={})=>{const[e,r]=P.useState(void 0);return P.useEffect(()=>{(async()=>{const i=t?await yf.awaitInit():yf;r(i)})()},[t]),e},Zo=800,_s=T.default(z.Button).attrs({variant:"text",size:"small",tone:"danger"})`
513
+ `))}}}async function Bk(t,e){const r=new p$({});r.getRulesForSpecVersion=()=>[];const n=await Pr.dirname(t),i={config:r,base:n,externalRefResolver:new ghe,dereference:!0};e?i.doc={source:{absoluteRef:t},parsed:e}:i.ref=t;const{bundle:{parsed:o},fileDependencies:s}=await Joe(i);return{definition:o,fileDependencies:s}}class Git{constructor(e){this.apisStorage=e}data=new Map;loading=new Set;pQueue=new Xit({concurrency:20});async get(e){return this.data.has(e)?this.data.get(e)??null:(await this.loadAndParse(e),this.data.get(e)??null)}async load(e,r=!1){this.data.has(e)&&!r||await this.loadAndParse(e,r)}async loadAndParse(e,r=!1){if(this.loading.has(e)){await this.pQueue.add(()=>this.get(e));return}r&&this.data.delete(e),this.loading.add(e),await this.pQueue.add(async()=>{const n=Za(e)?To.WEB:To.FS,i=n===To.WEB?e:await this.apisStorage.getAbsolutePath(e);try{const{definition:o,fileDependencies:s}=await Bk(i);if(!o){this.data.set(e,null);return}const a=this.apisStorage.parse({uri:e,type:n,content:o});this.data.set(e,{...a,fileDependencies:s})}catch(o){if(this.data.set(e,null),o instanceof Error&&(o.message.includes("Unsupported specification")||o.message.includes("File not found")))return;console.error("Error loading api "+e,o);return}}),this.loading.delete(e)}get size(){return this.data.size}delete(e){this.data.delete(e)}getAll(){return Array.from(this.data.values()).filter(e=>e!==null)}clear(){this.data.clear(),this.loading.clear()}}function qe(t,e,r="ui"){let n=`urn:redocly:replay:${r}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!Br()&&(n=mfe(window.location.href)),{object:t,id:e,uri:n}}class i8 extends dhe{apiLoader;constructor(e,r,n){const i=new Kj(e.systemFilesDir),o=new Kj(e.userFilesDir);super(i,o,e,!0,r,n),this.apiLoader=new Git(this.apisStorage),this.setupWriteListeners(o)}setupWriteListeners(e){e.on("write-start",r=>{this.addWatchExcludedId(r)}),e.on("write-end",r=>{this.removeWatchExcludedId(r)})}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",qe("storageOperation","read","storage"),void 0),r=this.telemetry?.startSpan("com.redocly.storage.loadUserState",qe("storageOperation","loadUserState","storage"),e?.parentCtx),[n,i,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);r?.setAttribute("status","completed"),r?.setAttribute("environmentCount",o.length),r?.setStatus(exports.SpanStatusCode.OK),r?.end();const{apiFiles:s,collectionFiles:a}=await this.detectProjectFiles(e);await this.loadAndParseApis(s,e);const c=(await this.loadAndParseCollections(a,e)).filter(d=>d!==null);this.collectionsStorage.setItemIds(c.map(d=>d.id));const u=this.apiLoader.getAll();return this.apisStorage.setItemIds(u.map(d=>d.id)),e?.setAttribute("status","completed"),e?.setStatus(exports.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:n,tabsState:i,environments:o,apis:u,collections:c}}async detectProjectFiles(e){const r=this.telemetry?.startSpan("com.redocly.storage.detectFiles",qe("storageOperation","detectFiles","storage"),e?.parentCtx),{api_files:n,collection_files:i}=await rt("fs_scan",{dir:this.project.userFilesDir});return r?.setAttribute("status","completed"),r?.setAttribute("filesCount",n.length+i.length),r?.setAttribute("apiFilesCount",n.length),r?.setAttribute("collectionFilesCount",i.length),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),{apiFiles:n,collectionFiles:i}}readEnviroments(){return this.environmentsStorage.read()}deleteApiFromCache(e){this.apiLoader.delete(e)}async loadAndParseApis(e,r,n=!1){const i=this.telemetry?.startSpan("com.redocly.storage.parseApis",{...qe("storageOperation","parseApis","storage"),apisCount:e.length},r?.parentCtx),o=await Yj(e,20,async s=>{try{return await this.apiLoader.load(s.relative_path,n),this.apiLoader.get(s.relative_path)}catch(a){return console.error(`Error parsing YAML/JSON file ${s.absolute_path}:`,a),null}});return i?.setAttribute("status","completed"),i?.setAttribute("parsedApisCount",this.apiLoader.size),i?.setStatus(exports.SpanStatusCode.OK),i?.end(),o}async loadAndParseCollections(e,r){const n=this.telemetry?.startSpan("com.redocly.storage.parseCollections",{...qe("storageOperation","parseCollections","storage"),collectionsCount:e.length},r?.parentCtx),i=await Yj(e,20,async o=>{try{const s=await this.userFilesStorage.get(o.relative_path);if(!s)return null;const a=Ff.load(s);if(typeof a!="object"||a===null||typeof a.arazzo!="string")return null;const l=[];await Promise.all(a.sourceDescriptions?.map(async u=>{const d=u.type,p=u.url,f=!d||d==="openapi",m=await yfe({projectPath:this.project.userFilesDir,apiUrl:p,collectionId:o.relative_path});if(f){const g=await this.apiLoader.get(m);g&&l.push(g)}}));const c=await Pr.join(this.project.userFilesDir,o.relative_path);return await this.collectionsStorage.parse({uri:o.relative_path,type:To.FS,content:a,fileDependencies:new Set([c])},l)}catch(s){return console.error(`Error parsing Arazzo file ${o.relative_path}:`,s),null}});return n?.setAttribute("status","completed"),n?.setAttribute("parsedCollectionsCount",i.length),n?.setStatus(exports.SpanStatusCode.OK),n?.end(),i}}class UM{constructor(e){this.baseDir=e}writeExcludedKeys=new Set;setWriteExcludedKeys(e){this.writeExcludedKeys=e}async ls(e=""){const r=this.makeKey(e);return Object.keys(localStorage).filter(n=>n.startsWith(r)).map(n=>n.replace(r,""))}async get(e){const r=this.makeKey(e);return localStorage.getItem(r)??null}async has(e){const r=this.makeKey(e);return localStorage.getItem(r)!==null}async set(e,r){if(this.writeExcludedKeys.has(e))return;const n=this.makeKey(e);localStorage.setItem(n,r)}async remove(e){if(this.writeExcludedKeys.has(e))return;const r=this.makeKey(e);localStorage.removeItem(r)}async rename(e,r){const n=this.makeKey(e),i=this.makeKey(r),o=localStorage.getItem(n);o!==null&&(localStorage.setItem(i,o),localStorage.removeItem(n))}makeKey(e){return`replay:fs:${this.baseDir}/${e}`}on(e,r){}off(e,r){}}class Yit extends dhe{constructor(e,r,n){const i=new UM(e.systemFilesDir),o=new UM(e.userFilesDir);super(i,o,e,!1,r,n)}async detectProjectFiles(e){const r=this.telemetry?.startSpan("com.redocly.storage.detectFiles",qe("storageOperation","detectFiles","storage"),e?.parentCtx),i=(await this.userFilesStorage.ls()).filter(l=>/\.(ya?ml|json)$/.test(l)),o=[],s=[],a=new Set;return await Promise.all(i.map(async l=>{const c=await this.userFilesStorage.get(l);if(c)try{const u=Ff.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const d=await Pr.resolve(await Pr.join(this.userFilesStorage.baseDir,l)),{definition:p}=await Bk(d,u);o.push({uri:l,type:To.FS,content:p})}else typeof u.arazzo=="string"&&(s.push({uri:l,type:To.FS,content:u}),u.sourceDescriptions?.forEach(d=>{const p=d.type,f=d.url,m=!p||p==="openapi",g=typeof f=="string"&&Za(f);m&&g&&a.add(f)}))}catch(u){console.error(`Error parsing YAML/JSON file ${l}:`,u)}})),r?.setAttribute("status","completed"),r?.setAttribute("filesCount",i.length),r?.setAttribute("apiFilesCount",o.length),r?.setAttribute("collectionFilesCount",s.length),r?.setAttribute("apiUrlsCount",a.size),r?.setStatus(exports.SpanStatusCode.OK),r?.end(),{apiFiles:o,collectionFiles:s,apiUrls:a}}async loadApis(e,r){const n=this.telemetry?.startSpan("com.redocly.storage.loadApis",{...qe("storageOperation","loadApis","storage"),apiUrlsCount:e.size},r?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async o=>{try{const{definition:s}=await Bk(o);i.push({uri:o,type:To.WEB,content:s})}catch(s){console.error(`Error parsing YAML from ${o}:`,s)}})),n?.setAttribute("status","completed"),n?.setStatus(exports.SpanStatusCode.OK),n?.end(),i}async parseApis(e,r){const n=this.telemetry?.startSpan("com.redocly.storage.parseApis",{...qe("storageOperation","parseApis","storage"),apisCount:e.length},r?.parentCtx),i=await this.apisStorage.parseMany(e);return n?.setAttribute("status","completed"),n?.setAttribute("parsedApisCount",i.length),n?.setStatus(exports.SpanStatusCode.OK),n?.end(),i}async parseCollections(e,r,n){const i=this.telemetry?.startSpan("com.redocly.storage.parseCollections",{...qe("storageOperation","parseCollections","storage"),collectionsCount:e.length},n?.parentCtx),o=await this.collectionsStorage.parseMany(e,r);return i?.setAttribute("status","completed"),i?.setAttribute("parsedCollectionsCount",o.length),i?.setStatus(exports.SpanStatusCode.OK),i?.end(),o}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",qe("storageOperation","read","storage"),void 0),r=this.telemetry?.startSpan("com.redocly.storage.loadUserState",qe("storageOperation","loadUserState","storage"),e?.parentCtx),[n,i,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);r?.setAttribute("status","completed"),r?.setAttribute("environmentCount",o.length),r?.setStatus(exports.SpanStatusCode.OK),r?.end();const{apiFiles:s,collectionFiles:a,apiUrls:l}=await this.detectProjectFiles(e),c=await this.loadApis(l,e),u=await this.parseApis([...s,...c],e);this.apisStorage.setItemIds(u.map(p=>p.id));const d=await this.parseCollections(a,u,e);return this.collectionsStorage.setItemIds(d.map(p=>p.id)),e?.setAttribute("status","completed"),e?.setStatus(exports.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:n,tabsState:i,environments:o,apis:u,collections:d}}}var o8;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(o8||(o8={}));async function Hit(t,e){await rt("plugin:event|unlisten",{event:t,eventId:e})}async function Jit(t,e,r){var n;const i=(n=void 0)!==null&&n!==void 0?n:{kind:"Any"};return rt("plugin:event|listen",{event:t,target:i,handler:yle(e)}).then(o=>async()=>Hit(t,o))}function Ah(t){return t==null?"":typeof t=="string"?t:typeof t=="object"&&"raw"in t&&typeof t.raw=="string"?t.raw:String(t)}function Vy(t){return t.replace(/\s+/g," ").trim()}function Zb(t){return typeof t=="object"&&t!==null&&"$ref"in t}function vq(t){return Zb(t)?null:t}function Oq(t){try{return JSON.stringify(t)}catch{return String(t)}}function yhe(t){let e=`${t.name} (${t.in}`;return t.required&&(e+=", required"),t.type&&(e+=`, ${t.type}`),t.format&&(e+=`, format: ${t.format}`),t.enum&&(e+=`, enum: [${t.enum.join(",")}]`),t.pattern&&(e+=`, pattern: ${t.pattern}`),e+=")",e}function vhe(t){return t.type?Array.isArray(t.type)?t.type.join("|"):t.type:t.oneOf?"oneOf":t.anyOf?"anyOf":t.allOf?"allOf":"object"}function Kit(t){return t==="querystring"?"query":t==="query"||t==="header"||t==="path"||t==="cookie"?t:"query"}function eot(t){const e=t.schema&&!Zb(t.schema)?t.schema:null,r={name:t.name,in:Kit(t.in),required:t.required??!1};return e&&(r.type=vhe(e),e.format&&(r.format=e.format),e.enum&&(r.enum=e.enum.map(String)),e.pattern&&(r.pattern=e.pattern),e.example!==void 0&&(r.example=String(e.example))),t.description&&(r.description=Ah(t.description)),t.example!==void 0&&!r.example&&(r.example=String(t.example)),r}function tot(t,e){const r=new Set,n=[],i=o=>{for(const s of o){const a=vq(s);if(!a||!a.name)continue;const l=`${a.in}:${a.name}`;r.has(l)||(r.add(l),n.push(eot(a)))}};return t.parameters&&i(t.parameters),e.parameters&&i(e.parameters),n}function Ohe(t,e=2,r=0){if(r>=e||!t.properties)return[];const n=new Set(t.required??[]);return Object.entries(t.properties).map(([i,o])=>({name:i,type:vhe(o),required:n.has(i),readOnly:o.readOnly}))}function bhe(t){const e=t.components?.securitySchemes;if(!e)return[];const r=[];for(const[n,i]of Object.entries(e)){const o=vq(i);o&&r.push(rot(n,o))}return r}function rot(t,e){const r={schemeName:t,type:e.type};if(e.in&&(r.in=e.in),e.name&&(r.name=e.name),e.scheme&&(r.scheme=e.scheme),e.bearerFormat&&(r.bearerFormat=e.bearerFormat),e.flows){const n=Object.keys(e.flows).filter(o=>e.flows[o]);n.length>0&&(r.flows=n.join(", "));const i=new Set;for(const o of n){const s=e.flows[o];s?.scopes&&Object.keys(s.scopes).forEach(a=>i.add(a))}i.size>0&&(r.scopes=[...i].join(", "))}return r}function not(t,e,r){const n=t??e;if(!n||r.length===0)return[];const i=new Set;for(const o of n)for(const s of Object.keys(o))i.add(s);return r.filter(o=>i.has(o.schemeName))}function iot(t){return t.length===0?"":`Security: ${t.map(r=>{let n=`${r.schemeName} (${r.type}`;return r.scheme&&(n+=`, ${r.scheme}`),r.in&&r.name&&(n+=`, ${r.name} in ${r.in}`),n+=")",n}).join("; ")}.`}const oot=["get","put","post","delete","options","head","patch","trace"],sot=["query","x-query"];function aot(t,e){const r=[],n=Object.keys(t.content??{});if(n.length===0)return{textPart:"",schemaJson:"{}",examples:r};const i=n.find(d=>d.includes("json"))??n[0],o=t.content?.[i],s=o?.schema&&!Zb(o.schema)?o.schema:null,l=(s?Ohe(s):[]).filter(d=>!e.hideReadOnly||!d.readOnly),c=t.required?"required":"optional";let u=`Request body (${i}, ${c})`;if(l.length>0){const d=l.map(p=>`${p.name}: ${p.type}${p.required?" required":""}${p.readOnly?" readOnly":""}`);u+=`: {${d.join(", ")}}`}return o?.example!==void 0&&r.push(Oq(o.example)),{textPart:u,schemaJson:JSON.stringify(l),examples:r}}function lot(t){const e=[],r=[];for(const[n,i]of Object.entries(t)){if(Zb(i))continue;const o=Ah(i.description??"");e.push(`${n} ${o}`.trim());const s={statusCode:n};o&&(s.description=o);const a=i.content;if(a){const l=Object.keys(a).find(u=>u.includes("json"))??Object.keys(a)[0],c=a[l]?.schema;if(c&&!Zb(c)){const u=Ohe(c);u.length>0&&(s.schemaProperties=JSON.stringify(u))}}r.push(s)}return{textParts:e,summaries:r}}function VM(t){const{apiId:e,apiTitle:r,path:n,method:i,op:o,pathItem:s,globalSchemes:a,apiSecurity:l}=t,c=o.summary??"",u=Ah(o.description??""),d=o.operationId??"",p=o.tags??[],f=i.toUpperCase(),m=tot(o,s),g=not(o.security,l,a),y=g.length>0?g.map(j=>`api_sec:${e}:${j.schemeName}`):void 0,v=[r,`${f} ${n}`,c,u];d&&v.push(`operationId: ${d}`),p.length>0&&v.push(`Tags: ${p.join(", ")}`),o.deprecated&&v.push("DEPRECATED"),m.length>0&&v.push(`Parameters: ${m.map(yhe).join(". ")}.`);let b;const O=[],w=o.requestBody;if(w){const j=vq(w);if(j){const R=aot(j,{hideReadOnly:f==="POST"||f==="PUT"||f==="PATCH"});R.textPart&&v.push(R.textPart),b=R.schemaJson,O.push(...R.examples)}}const{textParts:x,summaries:S}=lot(o.responses??{});x.length>0&&v.push(`Responses: ${x.join(", ")}.`);const _=iot(g);_&&v.push(_);const C=`api_op:${e}:${n}:${i}:${d||`${n}-${i}`}`,$={type:"api_operation",id:C,contentHash:"",title:c||`${f} ${n}`,description:u||void 0,apiId:e,path:n,method:f,operationId:d||void 0,tags:p.length>0?p:void 0,deprecated:o.deprecated||void 0,parameterDetails:m.length>0?m:void 0,requestBodySchema:b,responseSchemas:S.length>0?S:void 0,securitySchemeRefs:y,examples:O.length>0?O:void 0};return{id:C,text:Vy(v.filter(Boolean).join(" ")),payload:$}}function FM(t){const e=t.info?.title??"Untitled API",r=Ah(t.info?.description??t.info?.summary??""),n=t.id;return{id:`api:${n}`,text:Vy([e,r].filter(Boolean).join(" ")),payload:{type:"api",id:`api:${n}`,contentHash:"",title:e,description:r||void 0,apiId:n}}}function xhe(t){const e=[];for(const r of t){e.push(FM(r));const n=r.info?.title??"Untitled API",i=r.id,o=bhe(r);for(const a of o){const l=`api_sec:${i}:${a.schemeName}`,c=[`${a.schemeName}: type=${a.type}`,a.scheme?`scheme=${a.scheme}`:"",a.in&&a.name?`${a.name} in ${a.in}`:"",a.bearerFormat?`format=${a.bearerFormat}`:"",a.flows?`flows=[${a.flows}]`:"",a.scopes?`scopes=[${a.scopes}]`:""].filter(Boolean).join(" ");e.push({id:l,text:Vy(`${n} Authentication. ${a.schemeName}. ${c}.`),payload:{type:"api_security",id:l,contentHash:"",title:`${n} — ${a.schemeName}`,apiId:i,securityScheme:a}})}const s=r.paths??{};for(const[a,l]of Object.entries(s)){if(!l||typeof l!="object")continue;const c=[...oot.filter(d=>d in l),...sot.filter(d=>d in l)];for(const d of c){const p=l[d];!p||typeof p!="object"||e.push(VM({apiId:i,apiTitle:n,path:a,method:d,op:p,pathItem:l,globalSchemes:o,apiSecurity:r.security}))}const u=l.additionalOperations;if(u&&typeof u=="object")for(const[d,p]of Object.entries(u))!p||typeof p!="object"||e.push(VM({apiId:i,apiTitle:n,path:a,method:d,op:p,pathItem:l,globalSchemes:o,apiSecurity:r.security}))}}return e}function cot(t){const e=[],r=[{list:t.queryParameters,loc:"query"},{list:t.headers,loc:"header"},{list:t.cookies,loc:"cookie"},{list:t.pathParameters,loc:"path"}];for(const{list:n,loc:i}of r)for(const o of n)if("key"in o){const s=o;e.push({name:s.key,in:i,required:!1})}return e}function BM(t){const e=t.id,r=t.info?.title??"Untitled Collection",n=Ah(t.info?.description??t.info?.summary??"");return{id:`collection:${e}`,text:Vy([r,n].filter(Boolean).join(" ")),payload:{type:"collection",id:`collection:${e}`,contentHash:"",title:r,description:n||void 0,collectionId:e}}}function whe(t){const{collectionId:e,collectionTitle:r,workflow:n}=t,i=n.workflowId??"",o=n.summary??i,s=Ah(n.description??""),a=[r,o,s];if(n.inputs&&a.push(`Inputs schema: ${Oq(n.inputs)}`),n.outputs?.length){const l=n.outputs.map(c=>c.key).filter(Boolean);l.length&&a.push(`Outputs: ${l.join(", ")}`)}return n.dependsOn?.length&&a.push(`Depends on: ${n.dependsOn.join(", ")}`),{id:`workflow:${e}:${i}`,text:Vy(a.filter(Boolean).join(" ")),payload:{type:"workflow",id:`workflow:${e}:${i}`,contentHash:"",title:o,description:s||void 0,collectionId:e,workflowId:i}}}function She(t){const{collectionId:e,collectionTitle:r,workflowId:n,workflowTitle:i,step:o}=t,s=o.stepId??"",a=Ah(o.description??""),l=o.operation,c=o.xOperation,u=[r,i,`step: ${s}`];a&&u.push(a),l?(u.push(`${l.method?.toUpperCase()} ${l.path}`),l.apiId&&u.push(`API: ${l.apiId}`),l.operationId&&u.push(`operationId: ${l.operationId}`)):c&&u.push(`${c.method?.toUpperCase()} ${c.url}`);const d=o.parameters?cot(o.parameters):[];d.length>0&&u.push(`Parameters: ${d.map(yhe).join(". ")}.`),o.requestBody?.type&&u.push(`Request body type: ${o.requestBody.type}`);const f=(o.successCriteria??[]).map(g=>{let y=g.condition;return g.context&&(y+=` context: ${g.context}`),g.type&&(y+=` (${g.type})`),y});if(f.length>0&&u.push(`Success criteria: ${f.join("; ")}`),o.outputs?.length){const g=o.outputs.map(y=>`${y.key}=${y.value}`).filter(Boolean);g.length&&u.push(`Outputs: ${g.join(", ")}`)}const m=`step:${e}:${n}:${s}`;return{id:m,text:Vy(u.filter(Boolean).join(" ")),payload:{type:"step",id:m,contentHash:"",title:s,description:a||void 0,collectionId:e,workflowId:n,stepId:s,path:l?.path??c?.url,method:(l?.method??c?.method)?.toUpperCase(),apiId:l?.apiId,operationId:l?.operationId,parameterDetails:d.length>0?d:void 0,successCriteria:f.length>0?f:void 0,requestBodySchema:o.requestBody?.type?Oq(o.requestBody):void 0}}}function _he(t){const e=[];for(const r of t){const n=r.id,i=r.info?.title??"Untitled Collection";e.push(BM(r));for(const o of r.workflows??[]){e.push(whe({collectionId:n,collectionTitle:i,workflow:o}));const s=o.workflowId??"",a=o.summary??s;for(const l of o.steps??[])e.push(She({collectionId:n,collectionTitle:i,workflowId:s,workflowTitle:a,step:l}))}}return e}function uot(t,e){return[...xhe(t),..._he(e)]}const cR=10,dot=4;function s8(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r)|0;return e>>>0}function pot(t){return Ng(S0(t))}class fot extends Z5{constructor(e){super(),this.collectionName=e}activeIndexJobs=0;getIndexingActivityState(){return{inProgress:this.activeIndexJobs>0}}beginIndexJob(){this.activeIndexJobs++,this.activeIndexJobs===1&&this.emit("indexing-activity",{inProgress:!0})}endIndexJob(){this.activeIndexJobs=Math.max(0,this.activeIndexJobs-1),this.activeIndexJobs===0&&this.emit("indexing-activity",{inProgress:!1})}async getIdsByPayload(e,r){return rt("semantic_search_get_ids_by_payload",{collectionName:this.collectionName,field:e,value:r})}async getAllIds(){return rt("semantic_search_get_all_ids",{collectionName:this.collectionName})}async getScopeHashes(e){const r=e.apiIds??[],n=e.collectionIds??[];let i;if(r.length===0&&n.length===0)i=await this.getAllIds();else{const s=[];for(const l of r)s.push(this.getIdsByPayload("apiId",l));for(const l of n)s.push(this.getIdsByPayload("collectionId",l));i=(await Promise.all(s)).flat()}const o=new Map;for(const s of i)o.set(s.id,s.contentHash);return o}async indexDocuments(e,r){if(e.length===0&&!r)return{added:0,updated:0,removed:0,unchanged:0};this.beginIndexJob();try{return await this.runIndexDocuments(e,r)}finally{this.endIndexJob()}}async runIndexDocuments(e,r){const n=await this.getScopeHashes(r??{}),i=[],o=new Set;let s=0,a=0;for(const u of e){const d=pot(u.text);u.payload.contentHash=d,o.add(u.id);const p=n.get(u.id);p===d?a++:(p||s++,i.push(u))}const l=i.length-s,c=[];for(const u of n.keys())o.has(u)||c.push(u);return c.length>0&&await this.deletePoints(c.map(s8)),i.length>0&&await this.embedAndUpsert(i),(c.length>0||i.length>0)&&await this.flush(),{added:s,updated:l,removed:c.length,unchanged:a}}async removeByPayloadFilter(e,r){return rt("semantic_search_delete_by_payload",{collectionName:this.collectionName,field:e,value:r})}async getStoredDocumentCount(){try{return(await rt("plugin:velesdb|list_collections"))?.find(n=>n.name===this.collectionName)?.count??0}catch{return 0}}async getDocumentsByIds(e){if(e.length===0)return new Map;const r=e.map(s8),n=await rt("plugin:velesdb|get_points",{request:{collection:this.collectionName,ids:r}}),i=new Map;for(const o of n??[])if(o?.payload){const s=o.payload;s.id&&i.set(s.id,s)}return i}async embedAndUpsert(e){const r=[],n=e.length;for(let i=0;i<n;i+=cR)r.push({docs:e.slice(i,i+cR),index:Math.floor(i/cR)});await Yj(r,dot,async i=>{const o=i.docs.map(s=>({id:s.id,text:s.text||s.payload.title,payload:s.payload}));await rt("semantic_search_embed_and_upsert",{collectionName:this.collectionName,documents:o})})}async deletePoints(e){e.length!==0&&await rt("plugin:velesdb|delete_points",{request:{collection:this.collectionName,ids:e}})}async flush(){await rt("plugin:velesdb|flush",{name:this.collectionName}),await rt("semantic_search_write_hnsw_marker",{collectionName:this.collectionName}).catch(()=>{})}}const a8="replay_search",hot=384,Om={added:0,updated:0,removed:0,unchanged:0};class mot extends Z5{initialized=!1;projectId=null;indexer=null;indexQueue=Promise.resolve();get collectionName(){return this.projectId?`${a8}_${this.projectId}`:a8}createIndexer(){const e=new fot(this.collectionName);return e.subscribe("indexing-activity",r=>{this.emit("indexing-activity",r)}),e}getIndexer(){return this.indexer||(this.indexer=this.createIndexer()),this.indexer}getIndexingActivityState(){return this.getIndexer().getIndexingActivityState()}async ensureInitialized(){this.initialized||await this.init()}enqueueIndex(e){const n=this.indexQueue.then(()=>e()).catch(i=>{throw console.error("Semantic index:",i),i}).finally(()=>this.unloadModel());return this.indexQueue=n.catch(()=>{}),n}async unloadModel(){try{await rt("semantic_search_unload_model")}catch{}}setProject(e){this.projectId!==e&&(this.projectId=e,this.initialized=!1,this.indexer=this.createIndexer())}async init(){if(Br()&&!this.initialized){try{if((await rt("plugin:velesdb|list_collections"))?.some(r=>r.name===this.collectionName)){this.initialized=!0;return}}catch{}await rt("plugin:velesdb|create_collection",{request:{name:this.collectionName,dimension:hot,metric:"cosine",storage_mode:"full"}}),this.initialized=!0}}async indexApis(e){if(!Br())return Om;await this.ensureInitialized();const r=this.collectionName,n=this.getIndexer(),i=xhe(e),o={apiIds:e.map(s=>s.id)};return this.enqueueIndex(async()=>this.collectionName!==r?Om:n.indexDocuments(i,o))}async indexCollections(e){if(!Br())return Om;await this.ensureInitialized();const r=this.collectionName,n=this.getIndexer(),i=_he(e),o={collectionIds:e.map(s=>s.id)};return this.enqueueIndex(async()=>this.collectionName!==r?Om:n.indexDocuments(i,o))}async removeApi(e){if(!Br())return;await this.ensureInitialized(),await this.getIndexer().removeByPayloadFilter("apiId",e)}async removeCollection(e){if(!Br())return;await this.ensureInitialized(),await this.getIndexer().removeByPayloadFilter("collectionId",e)}async reindex(e,r){if(!Br())return Om;await this.ensureInitialized();const n=this.collectionName,i=this.getIndexer(),o=uot(e,r);return this.enqueueIndex(async()=>this.collectionName!==n?Om:i.indexDocuments(o))}async search(e,r=10,n){if(!Br())return[];try{await this.ensureInitialized();const i=n&&Object.keys(n).length>0?{type:n.type,apiId:n.apiId,collectionId:n.collectionId,path:n.path,method:n.method,operationId:n.operationId,workflowId:n.workflowId,stepId:n.stepId}:void 0,s=((await rt("semantic_search_text",{collection:this.collectionName,query:e,topK:r,filters:i})).results??[]).map(a=>({...a.payload,score:a.score??0}));return await this.enrichWithRelatedSecurity(s),s}catch{return[]}}async enrichWithRelatedSecurity(e){const r=e.filter(o=>o.type==="api_operation"&&o.securitySchemeRefs?.length);if(r.length===0)return;const n=[...new Set(r.flatMap(o=>o.securitySchemeRefs??[]))],i=await this.getIndexer().getDocumentsByIds(n);for(const o of r){const s=[];for(const a of o.securitySchemeRefs??[]){const l=i.get(a);l?.securityScheme&&s.push(l.securityScheme)}s.length>0&&(o.relatedSecuritySchemes=s)}}async status(){if(!Br())return{indexed:0,modelLoaded:!1};const e=await this.getIndexer().getStoredDocumentCount();let r=!1;try{r=(await rt("semantic_search_model_status")).loaded}catch{}return{indexed:e,modelLoaded:r}}async clear(){if(!(!Br()||!this.initialized))try{await rt("plugin:velesdb|delete_collection",{name:this.collectionName}),this.initialized=!1}catch{}}async preloadModel(){if(Br())try{await rt("semantic_search_preload_model")}catch{}}}let uR=null;function ep(){return uR||(uR=new mot),uR}class got{constructor(e,r,n,i){this.storage=e,this.state=r,this.projectDir=n,this.aiEnabled=i}watchPath=null;unlistenEvent=null;get tauriStorage(){return this.storage}indexApis(e){!this.aiEnabled||e.length===0||ep().indexApis(e).catch(r=>console.error("Semantic index (apis):",r))}indexCollections(e){!this.aiEnabled||e.length===0||ep().indexCollections(e).catch(r=>console.error("Semantic index (collections):",r))}removeApis(e){if(!this.aiEnabled||e.length===0)return;const r=ep();Promise.all(e.map(n=>r.removeApi(n))).catch(n=>console.error("Semantic remove (apis):",n))}removeCollections(e){if(!this.aiEnabled||e.length===0)return;const r=ep();Promise.all(e.map(n=>r.removeCollection(n))).catch(n=>console.error("Semantic remove (collections):",n))}async start(){if(this.watchPath){console.warn("Watcher already started for:",this.watchPath);return}try{this.unlistenEvent=await Jit("fs-watch-event",async e=>{const r=e.payload;try{await this.handleEvent(r)}catch(n){console.error("Error handling file change:",n)}}),await rt("fs_watch",{path:this.projectDir,options:{recursive:!0,delayMs:500}}),this.watchPath=this.projectDir}catch(e){throw console.error("Failed to start file watcher:",e),this.unlistenEvent&&(this.unlistenEvent(),this.unlistenEvent=null),e}}async stop(){if(this.watchPath)try{await rt("fs_unwatch",{path:this.watchPath})}catch(e){console.error("Error stopping file watcher:",e)}finally{this.unlistenEvent&&(this.unlistenEvent(),this.unlistenEvent=null),this.watchPath=null}}async handleEvent(e){const{changeType:r,paths:n,pathTypes:i,type:o}=e;if(await this.isProjectFolderRemoved(n,r)){await this.handleProjectFolderRemoval();return}const s=this.filterSpecFiles(n,i);if(s.paths.length===0)return;const a=await this.toFileEntries(s.paths,s.pathTypes);switch(r){case"changed":(o.includes("Data")||o.includes("Name"))&&await this.handleModify(a);break;case"added":await this.handleCreate(a);break;case"deleted":await this.handleDelete(a);break;case"renamed":await this.handleRename(a);break;default:console.log("Unhandled change type:",r)}}filterSpecFiles(e,r){const n=[],i=[];for(let o=0;o<e.length;o++){const s=e[o],a=s.split(".").pop()?.toLowerCase();a&&["yaml","yml","json"].includes(a)&&(n.push(s),i.push(r[o]||"unknown"))}return{paths:n,pathTypes:i}}async toFileEntries(e,r){return Promise.all(e.map(async(n,i)=>({relative_path:await Pr.relative(this.projectDir,n),absolute_path:n,type:r[i]||"unknown"})))}consolidateFileEntries(e){const r=[],n=new Set;for(const i of e)n.has(i.relative_path)||(n.add(i.relative_path),this.storage.isWatchExcluded(i.relative_path)||r.push(i));return r}async handleModify(e){const r=!this.storage.isWatchExcluded("replay-environments.yaml")&&e.some(f=>f.relative_path==="replay-environments.yaml"),n=e.filter(f=>f.relative_path!=="replay-environments.yaml"),{newApiFiles:i,existingApiFiles:o}=this.categorizeApisFromFiles(n),{newCollectionFiles:s,existingCollectionFiles:a}=this.categorizeCollectionsFromFiles(n),l=await this.findApisToReload(e),c=await this.findCollectionsToReload(e),u=[...i,...s];u.length>0&&await this.handleCreate(u),r&&await this.reloadEnvironments();const d=this.consolidateFileEntries([...o,...l]),p=this.consolidateFileEntries([...a,...c]);await this.reloadApis(d),await this.reloadCollections(p)}async handleCreate(e){const r=e.filter(l=>l.type==="api"),n=e.filter(l=>l.type==="collection"),{newApiFiles:i,existingApiFiles:o}=this.categorizeApisFromFiles(r),{newCollectionFiles:s,existingCollectionFiles:a}=this.categorizeCollectionsFromFiles(n);if(i.length>0||s.length>0){i.forEach(p=>this.storage.addPersistExcludedId(p.relative_path)),s.forEach(p=>this.storage.addPersistExcludedId(p.relative_path));const l=i.length>0?await this.tauriStorage.loadAndParseApis(i,void 0,!0):[],c=s.length>0?await this.tauriStorage.loadAndParseCollections(s,void 0):[],u=l.filter(p=>p!==null),d=c.filter(p=>p!==null);this.state.apis.merge(u),this.state.collections.merge(d),this.indexApis(u),this.indexCollections(d),setTimeout(()=>{i.forEach(p=>this.storage.removePersistExcludedId(p.relative_path)),s.forEach(p=>this.storage.removePersistExcludedId(p.relative_path))},500)}o.length>0&&await this.reloadApis(o),a.length>0&&await this.reloadCollections(a)}categorizeApisFromFiles(e){const r=new Set,n=[],i=[];for(const o of e){if(r.has(o.relative_path))continue;r.add(o.relative_path),this.state.apis.get({noproxy:!0}).some(a=>a.id===o.relative_path)?i.push(o):o.type==="api"&&n.push(o)}return{newApiFiles:n,existingApiFiles:i}}categorizeCollectionsFromFiles(e){const r=new Set,n=[],i=[];for(const o of e){if(r.has(o.relative_path))continue;r.add(o.relative_path),this.state.collections.get({noproxy:!0}).some(a=>a.id===o.relative_path)?i.push(o):o.type==="collection"&&n.push(o)}return{newCollectionFiles:n,existingCollectionFiles:i}}async handleDelete(e){const r=[],n=[];for(const i of e){this.storage.addPersistExcludedId(i.relative_path);const o=this.state.apis.get({noproxy:!0}).findIndex(a=>a.id===i.relative_path);o>=0&&(this.state.apis[o].set(Zt),this.tauriStorage.deleteApiFromCache(i.relative_path),r.push(i.relative_path));const s=this.state.collections.get({noproxy:!0}).findIndex(a=>a.id===i.relative_path);s>=0&&(this.state.collections[s].set(Zt),n.push(i.relative_path)),setTimeout(()=>{this.storage.removePersistExcludedId(i.relative_path)},500)}this.removeApis(r),this.removeCollections(n)}async handleRename(e){if(e.length>=2){const[r,n]=e;await this.handleDelete([r]),await this.handleCreate([n])}else await this.handleCreate(e)}async isProjectFolderRemoved(e,r){if(e.length===0)return!1;if(r==="deleted"||r==="renamed"){for(const i of e)if(i===this.projectDir)return!0}return e.filter(i=>!i.startsWith(this.projectDir+"/")&&i!==this.projectDir).length>0&&r==="renamed"}async handleProjectFolderRemoval(){const e=this.state.apis.get({noproxy:!0}),r=e.map(o=>o.id);e.forEach(o=>{this.storage.addPersistExcludedId(o.id),this.tauriStorage.deleteApiFromCache(o.id)}),this.state.apis.set([]);const n=this.state.collections.get({noproxy:!0}),i=n.map(o=>o.id);n.forEach(o=>{this.storage.addPersistExcludedId(o.id)}),this.state.collections.set([]),setTimeout(()=>{e.forEach(o=>this.storage.removePersistExcludedId(o.id)),n.forEach(o=>this.storage.removePersistExcludedId(o.id))},500),this.removeApis(r),this.removeCollections(i),await this.stop()}async findApisToReload(e){const r=[];return await Promise.all(this.state.apis.map(async n=>{const i=n.fileDependencies?.get({noproxy:!0})??new Set,o=n.get({noproxy:!0}).id,s=e.find(a=>i.has(a.absolute_path));if(!this.storage.isWatchExcluded(o)&&s){const a=await Pr.join(this.projectDir,o);r.push({relative_path:o,absolute_path:a,type:"api"})}})),r}async findCollectionsToReload(e){const r=[];return await Promise.all(this.state.collections.map(async n=>{const i=n.fileDependencies?.get({noproxy:!0})??new Set,o=n.get({noproxy:!0}).id,s=e.find(a=>i.has(a.absolute_path));if(!this.storage.isWatchExcluded(o)&&s){const a=await Pr.join(this.projectDir,o);r.push({relative_path:o,absolute_path:a,type:"collection"})}})),r}async reloadEnvironments(){const e=await this.tauriStorage.readEnviroments();this.storage.addPersistExcludedId("replay-environments.yaml"),this.state.environments.set(e),setTimeout(()=>{this.storage.removePersistExcludedId("replay-environments.yaml")},500)}async reloadApis(e){if(e.length===0)return;const r=await this.tauriStorage.loadAndParseApis(e,void 0,!0),n=[];await Promise.all(r.map(async(i,o)=>{if(!i){await this.handleDelete([e[o]]);return}const s=this.state.apis.get({noproxy:!0}).findIndex(a=>a.id===i.id);s>=0?(this.storage.addPersistExcludedId(i.id),this.state.apis[s].set(i),n.push(i),setTimeout(()=>this.storage.removePersistExcludedId(i.id),500)):console.warn("API not found in state after reload:",i.id)})),n.length>0&&this.indexApis(n)}async reloadCollections(e){if(e.length===0)return;const r=await this.tauriStorage.loadAndParseCollections(e,void 0),n=[];await Promise.all(r.map(async(i,o)=>{if(!i){await this.handleDelete([e[o]]);return}const s=this.state.collections.get({noproxy:!0}).findIndex(a=>a.id===i.id);s>=0?(this.storage.addPersistExcludedId(i.id),this.state.collections[s].set(i),n.push(i),setTimeout(()=>this.storage.removePersistExcludedId(i.id),500)):console.warn("Collection not found in state after reload:",i.id)})),n.length>0&&this.indexCollections(n)}}function Che(t=!1){let e,r=!1,n=null,i=null;async function o(l){if(!(!Br()||!e||!i)){await s();try{const c=i.project.userFilesDir.get();n=new got(e,i,c,l),await n.start()}catch(c){console.error("Failed to start file watcher:",c),n=null}}}async function s(){n&&(await n.stop(),n=null)}async function a(){Br()&&(await s(),await rt("cleanup_all_managed_watchers"))}return()=>({id:"RootStoragePlugin",onCreate:(l,c)=>({getTauriRootStorage:u=>()=>e instanceof i8?e:void 0,cleanup:()=>async()=>{await a()},init:u=>async(d,p,f)=>{if(r||u.path.length>0)return{isInitialized:!1};const{convertOperationToReplayValue:m,aiEnabled:g}=p,y=Br();if(r=!0,i=u,t)return r=!1,{isInitialized:!0};e=y?new i8(d,m,f):new Yit(d,m,f);const v=await e.read();if(u.merge(v),!y)return r=!1,{isInitialized:!0};try{if(await o(g??!1),g){const b=ep();b.setProject(d.id),b.preloadModel().catch(()=>{}),b.reindex(v.apis,v.collections).catch(O=>{console.error("Semantic reindex failed:",O)})}}finally{r=!1}return{isInitialized:!0}}}),onSet(l,c,u){r||!t&&e&&e.update(c,u)},onDestroy:async()=>{await a()}})}function khe({defaultEnvironments:t}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},tabsState:ql(Xj),activeEnvironmentId:q0,environments:t||gle,collections:[],apis:[],requestController:null,apps:{apps:[],appsLoadingState:Pc.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set})}const yot=Rte(khe(),jte(XWe({key:"replay-root-store"}),Che())),bq=P.createContext(yot),vot=bq.Provider;function Wt(){const t=P.useContext(bq);return bQ(t)}function Oot(){return{theme:"light",disableCollectionsTab:!1,oAuth2RedirectURI:null,corsProxyUrl:void 0,credentialOrigin:void 0,certificates:[],isApiBased:!1,generatedEnvironments:[],generatedInputs:[],hideOtherSecuritySchemes:!1,aiEnabled:!1,isPreviewLayout:!1}}const bot=Oot(),xot=P.createContext(bot);function Eo(){const t=P.useContext(xot);return bQ(t)}function wot(t,e){const{apps:{apiId:r}}=Wt(),{corsProxyUrl:n,credentialOrigin:i,disableCollectionsTab:o,oAuth2RedirectURI:s,certificates:a,storageKey:l,isApiBased:c,aiEnabled:u,isPreviewLayout:d}=Eo();n.set(t?.corsProxyUrl??RWe),i.set(t?.credentialOrigin),r.set(t?.apiId),s.set(t?.oAuth2RedirectURI),o.set(!!t?.disableCollectionsTab),l.set(t?.storageKey),c.set(!!e),u.set(!!t?.aiEnabled),d.set(t?.layout==="preview"),P.useEffect(()=>{a.set(t?.certificates||[])},[t?.certificates])}const vT=P.createContext({});function eo(){return P.useContext(vT)||{}}const Phe=process.env.NODE_ENV==="development",l8=process.env.NODE_ENV==="production",Sot="0.25.0-next.6",_ot={version:Sot},Cot={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"",origin:"replayUi"};class $he{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new AWe}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(()=>({...Cot,...e,env:l8?"production":"development"}))}enrichGlobalAttributes(e){this._globalAttributes={...this._globalAttributes,...e}}getGlobalAttributes(){return{...this._globalAttributes}}clearGlobalAttributes(){this._globalAttributes={platform:"",deviceId:""}}init(e){if(this.isInitialized)return;const{cloudEventData:r,...n}=e??{},i=n.tracerName||"desktop",o=n.enableErrorInstrumentation??i==="desktop",s={serviceName:"replay",serviceVersion:_ot.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:l8,enableErrorInstrumentation:o};this._client.init({otel:{...s,...n}}),this.setCloudEventData(r),this._initResolve?.(this),this._isInitialized=!0}sendEvent(e,r){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const n=Array.isArray(r)?r.map(i=>({...this._globalAttributes,...i})):{...this._globalAttributes,...r};Phe&&console.log(`[Telemetry] ${e}:`,JSON.stringify(n,null,2));try{this.client.send(e,n)}catch(i){console.error("Failed to send telemetry event:",i)}}startSpan(e,r,n){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{return this._client.startSpan(e,{...this._globalAttributes,...r},n)}catch(i){console.error("Failed to start telemetry span:",i);return}}}const yf=new $he;function It(){const{telemetry:t}=eo();yf.isInitialized||yf.init(t);const e=t?.cloudEventData;P.useEffect(()=>{e&&yf.setCloudEventData(e)},[e]);const r=P.useCallback((i,o)=>{yf.sendEvent(i,o)},[]),n=P.useCallback((i,o,s)=>yf.startSpan(i,o,s),[]);return{sendEvent:r,startSpan:n}}const kot=({awaitInit:t=!0}={})=>{const[e,r]=P.useState(void 0);return P.useEffect(()=>{(async()=>{const i=t?await yf.awaitInit():yf;r(i)})()},[t]),e},Zo=800,_s=T.default(z.Button).attrs({variant:"text",size:"small",tone:"danger"})`
514
514
  border: none;
515
515
  margin: 0;
516
516
 
@@ -782,7 +782,7 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
782
782
  border-radius: var(--border-radius);
783
783
  border: 1px solid var(--border-color-primary);
784
784
  padding: 0 calc(var(--spacing-xxs) / 2);
785
- `,en=(t,e,r=new Set)=>{const n=cme(t);if(!n.length)return t;let i=0;const o=n.flatMap(({start:s,end:a,name:l})=>{if(r.has(l))return null;const c=e.findLast(d=>d.name===l),u=t.slice(i,c?s:a);if(i=a,c){r.add(l);const d=en(c.value,e,r);return r.delete(l),[u.length?u:null,d||t.slice(s,a)]}return[u.length?u:null]});return t.slice(i).length&&o.push(t.slice(i)),o.join("")};function xlt(t,e){return e.find(r=>r.name===t.slice(1,-1))?.value||t}function wlt(t,e){const r=ume(t);if(!r.length)return h.jsx(_8,{children:t});let n=0;const i=r.flatMap(({start:o,end:s})=>{const a=t.slice(n,o),l=xlt(t.slice(o,s),e);return n=s,[a.length?a:null,l]});return t.slice(n).length&&i.push(t.slice(n)),h.jsx(_8,{children:i.join("")})}function dme(t){return Q1e(t)}const pme="New Step";function YM({name:t=pme,workflow:e}={}){let r=t.replaceAll(" ","-").toLowerCase();if(!e)return r;const n=Slt(e);if(n.includes(r)){let i=1;for(;n.includes(`${r}-${i}`);)i++;r=`${r}-${i}`}return r}function Slt(t){return t.steps.filter(e=>e.state.get()!==Tr.Draft).map(e=>e.stepId.get())}function cu({name:t=pme,isDraft:e=!1,fromStep:r,workflow:n,operation:i,apiOperation:o,dynamicReplayValues:s,xOperation:a}={}){if(!r){const c=o?rq(o,s):null,u=[Pa()];return{stepId:YM({name:t,workflow:n}),description:t,outputs:[],successCriteria:[],state:e?Tr.Draft:Tr.Normal,parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},requestBody:qk(),xOperation:a??(i?null:{method:"GET",url:""}),security:u,operation:i??null,...c}}const l=r.get({noproxy:!0});return{stepId:YM({name:t,workflow:n}),description:l.description,outputs:l.outputs,successCriteria:l.successCriteria,state:e?Tr.Draft:Tr.Normal,parameters:l.parameters,requestBody:l.requestBody,xOperation:l.xOperation,security:l.security,operation:l.operation}}function ih(t){return dme(t)?t.xOperation?.ornull?.method.get()??t.operation.ornull?.method.get()??"":t.xOperation?.method??t.operation?.method??""}function Jk(t){return dme(t)?t.xOperation?.ornull?.url.get()??t.operation.ornull?.nested("path").get()??"":t.xOperation?.url??t.operation?.path??""}function Iq(t,e,r,n){const{inputs:i,servers:o}=n,s=brt(cp("path",[ri(e?.parameters.pathParameters,r?.components.parameters),ri(t.parameters.pathParameters,r?.components.parameters)]),n.inputs),a=t.xOperation??null,l=t.operation??null;let c="",u="";if(a)u=a.method,c=wX(a.url,s);else if(l){const f=o.find(g=>g.apiId===l.apiId);u=l.method==="x-query"?"query":l.method,c=(f?.value?gfe(f.value,f.variables):"")+wX(l.path,s)}const d=c.split("?")[0];return{url:en(d,i),method:u.toUpperCase()}}function Lp(t,{collectionId:e,workflowId:r,stepId:n}){return t.collections.find(a=>a.id.get()===e)?.workflows.find(a=>a.workflowId.get()===r)?.steps.find(a=>a.stepId.get()===n)??null}function _lt(t){const e=t.substring(7).split(", "),r={};for(const n of e){const[i,o]=n.split("=");r[i]=o.replace(/"/g,"")}return r}function Clt(t,e,r,n){const{inputs:i}=n,{requestBody:{content:o}}=t,{url:s,method:a}=Iq(t,e,r,n),l=[...e?.security||[],...t.security].findLast(_=>_.securityType===Oe.DigestAuth);if(!l)return"";const{username:c,password:u,realm:d,nonce:p,cnonce:f,algorithm:m,qop:g,nc:y,opaque:v}=l[Oe.DigestAuth],b=en(c,i),{pathname:O,search:w}=new URL(s),x=w?`${O}${w}`:O,S=klt({username:b,password:en(u,i),uri:x,realm:d,nonce:p,cnonce:f,algorithm:m,qop:g,nc:y,method:a,bodyContent:o});return`Digest username="${b}", realm="${d}", nonce="${p}", uri="${x}", qop=${g}, nc=${y}, cnonce="${f}", response="${S}", algorithm=${m}${v?`, opaque="${v}"`:""}`}function klt(t){const{username:e,password:r,realm:n,nonce:i,cnonce:o,algorithm:s,qop:a,nc:l,uri:c,method:u,bodyContent:d}=t,p=Plt(s),f=s?.endsWith("-sess")?p(`${p(`${e}:${n}:${r}`)}:${i}:${o}`):p(`${e}:${n}:${r}`),m=a?.includes("auth-int")?p(`${u}:${c}:${p(d)}`):p(`${u}:${c}`);return p(`${f}:${i}:${l}:${o}:${a}:${m}`).toString()}function Plt(t){switch(t?.replace("-sess","")){case"SHA-256":return e=>Ng(Lte(e));default:return e=>Ng(S0(e))}}function $lt(t){try{const r=new URL(t).hostname;return r==="localhost"||r==="127.0.0.1"}catch{return!1}}function HM(t,e=window.location.origin){try{const r=new URL(t);return e===r.origin}catch{return!1}}function Tlt(t){return t?t.split(";").map(n=>n.trim()).map(n=>{const i=n.indexOf("="),o=n.slice(0,i).trim(),s=n.slice(i+1).trim();return[o,s]}):[]}const Ilt=["json","xml","html","text"],Elt=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function pR(t,e){return t.get(e)??t.get(e.toLowerCase())}function Alt(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function Rlt(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 r=t.match(/filename=([^;\n]+)/i);if(r?.[1])return r[1].replace(/(^")|("$)/g,"").trim()}function jlt(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function Nlt(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const r=t.toLowerCase();return Elt.some(n=>r.includes(n))?!0:r.startsWith("application/")?!Ilt.some(n=>r.includes(n)):!1}async function Mlt(t,e){const r=pR(t.headers,"content-type")?.split(";")[0].trim(),n=pR(t.headers,"content-disposition"),i=Alt(pR(t.headers,"content-length")),o=Nlt(r,n),s=Tlt(document.cookie);if(o){const p={fileName:Rlt(n)||jlt(t.url)||"response",contentType:r,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:p,bodyNotStored:!0,url:t.url}}const l=await t.clone().arrayBuffer(),c=new TextDecoder().decode(l),u=new Uint8Array(l).length;return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:l,body:c,duration:e,cookies:s,size:u,url:t.url}}const Dlt=":/?#[]@!$&'()*+,;=",Qlt=new Set(["!","'","(",")","*"]);function Llt(t){return Qlt.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function C8(t,e=!1){let r=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return r;const n=[...Dlt].map(i=>({char:i,encoded:Llt(i)}));for(const{char:i,encoded:o}of n)r=r.split(o).join(i);return r}function k8(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 fme(t,e){let r=k8(t);const n=e.find(({host:i,port:o})=>k8(`https://${i}:${o}`)===r);return{clientCert:n?.crtFilePath,clientKey:n?.keyFilePath}}function qlt(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function zlt(t,e){const{exists:r}=await Promise.resolve().then(()=>V$),{join:n}=await Promise.resolve().then(()=>Cle),{baseName:i,extension:o}=qlt(e);let s=0;for(;;){const a=s===0?"":` (${s})`,l=`${i}${a}${o}`,c=await n(t,l);if(!await r(c))return c;s+=1}}function Ult(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}function Vlt(t){if(t!=null)return t}function Eq(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function hme(t,e){if(!e)return"same-origin";try{const r=new URL(e).origin;return new URL(Eq(t)).origin===r?"include":"same-origin"}catch{return"same-origin"}}async function mme({store:t,step:e,settings:r,workflow:n,collection:i,signal:o}){const{corsProxyUrl:s,credentialOrigin:a,certificates:l}=r.get(),c=My(t),{url:u,method:d}=Iq(e.get(),n?.get(),i?.get(),c),p=s||"",f=Ome(e,n,i,t),m=$lt(u)||HM(u),g=ict({proxyUrl:p,resolvedUrl:u,ignoreProxy:m,queryParameters:f});await Blt(e,n??void 0,g,a,o);const y=Rq(e,n??void 0,i??void 0,t),v=Vlt(Aq(e,t)),{clientCert:b,clientKey:O}=fme(u,l||[]),w=Eq(g),x=d.toUpperCase(),S=!Iy.includes(x),_=S?"POST":x,C=S?{...y,"X-HTTP-Method-Override":x}:y;return{urlWithProxyAndProtocol:w,fetchMethod:_,fetchHeaders:C,body:v,credentials:hme(w,a),mode:HM(w)?"same-origin":"cors",clientCert:b,clientKey:O,resolvedUrl:u}}async function gme(t,e,r,n){const{requestController:i}=t,s=Rh(t).data;if(s.type.get()!==tt.Step){console.warn("not an operation tab");return}const{collectionId:a,workflowId:l,response:c,requestError:u,isProcessingRequest:d}=s,p=t.collections.find(y=>y.id.get()===a.get()),f=p?.workflows.find(y=>y.workflowId.get()===l.get()),m=ql(e.get({noproxy:!0}));d.set(!0),i.get()?.abort?.(),i.set(new AbortController);const g=i.get()?.signal;try{const y=await mme({store:t,step:e,settings:r,workflow:f,collection:p,signal:g}),v=Date.now(),b={signal:g,method:y.fetchMethod,headers:y.fetchHeaders,body:y.body,mode:y.mode,credentials:y.credentials,clientCert:y.clientCert,clientKey:y.clientKey},O=await zl(y.urlWithProxyAndProtocol,b),w=Date.now()-v;u.set(null),c.set(await Mlt(O,w));const x=ql(c.value);n?.(m,x)}catch(y){if(c.set(null),y.name==="AbortError")return;u.set(y.message||String(y));const v=ql(c.value);n?.(m,v)}finally{d.set(!1)}}async function Flt({store:t,step:e,settings:r,workflow:n,collection:i,fileName:o,onProgress:s}){const a=await mme({store:t,step:e,settings:r,workflow:n,collection:i}),l={method:a.fetchMethod,headers:a.fetchHeaders,body:a.body,mode:a.mode,credentials:a.credentials,clientCert:a.clientCert,clientKey:a.clientKey},{clientCert:c,clientKey:u}=l,d=Br(),p=o||"response";let f=null;if(d){const{open:S}=await Promise.resolve().then(()=>require("./replay-index-MYWxrMRM.js")),_=await S({directory:!0,multiple:!1});if(!_)return;const C=Array.isArray(_)?_[0]:_;f=await zlt(C,p)}const m=await zl(a.urlWithProxyAndProtocol,l),g=m.headers.get("content-length"),y=g?Number.parseInt(g,10):void 0,v=Number.isFinite(y)?y:void 0,b=m.headers.get("content-type")??void 0;let O;if(m.body?.getReader){const S=m.body.getReader(),_=[];let C=0;for(;;){const{done:$,value:j}=await S.read();if($)break;if(j){const R=new Uint8Array(j.byteLength);R.set(j),_.push(R.buffer),C+=j.byteLength,s?.({receivedBytes:C,totalBytes:v,done:!1})}}O=new Blob(_,{type:b}),s?.({receivedBytes:C,totalBytes:v,done:!0})}else O=await m.blob(),s?.({receivedBytes:O.size,totalBytes:v,done:!0});if(d){const{writeFile:S}=await Promise.resolve().then(()=>V$),_=new Uint8Array(await O.arrayBuffer());if(!f)return;await S(f,_);return}const w=window.URL.createObjectURL(O),x=document.createElement("a");x.href=w,x.download=p,x.rel="noopener",x.click(),window.URL.revokeObjectURL(w)}async function Blt(t,e,r,n,i){const o=ih(t),a=[...Array.from(e?.security||[]),...Array.from(t.security)].findLast(l=>l.securityType.get()===Oe.DigestAuth);if(a){const l=Eq(r),c=await zl(l,{signal:i,method:o.toUpperCase(),credentials:hme(l,n),mode:HM(l)?"same-origin":"cors"}),u=_lt(c.headers.get("WWW-Authenticate")||"");a[Oe.DigestAuth].merge({nonce:u.nonce,realm:u.realm,qop:u.qop,algorithm:u.algorithm,opaque:u.opaque,cnonce:crypto.randomUUID(),nc:"00000001"})}}function Wlt(t,e,r,n){return[...e?.security.get()||[],...t.security.get()].map(i=>{switch(i.securityType){case Oe.BasicAuth:{const o=i[Oe.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+btoa(`${Io(o.username,n)}:${Io(o.password,n)}`),active:!0,in:"header"}}case Oe.DigestAuth:{const o=My(n);return{id:"",key:"Authorization",value:Clt(t.get(),e?.get(),r?.get(),o),active:!0,in:"header"}}case Oe.JWT:return{id:"",key:"Authorization",value:"Bearer "+i[Oe.JWT].token,active:!0,in:"header"};case Oe.OAuth2:{const{grantType:o}=i[Oe.OAuth2],{accessToken:s}=i[Oe.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+s,active:!0,in:"header"}}case Oe.OpenIDConnect:{const{grantType:o}=i[Oe.OpenIDConnect],{accessToken:s}=i[Oe.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+s,active:!0,in:"header"}}case Oe.APIKey:{const o=i[Oe.APIKey];return o.location===ba.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(i=>!!i)}function Zlt(t,e,r){const{operation:n,requestBody:i,parameters:o}=e,{headers:s,cookies:a,queryParameters:l}=o;if(!r)return!0;const c=r.parameters??[],u=c.filter(w=>w.in==="query"),d=c.filter(w=>w.in==="header"),p=c.filter(w=>w.in==="cookie"),f=n?.path!==r.path,m=r.method.toLowerCase()!==n?.method.toLowerCase(),g=r.body?.mediaTypes&&r.body?.mediaTypes?.[i.type]===void 0,y=!d.every(w=>s.some(x=>!If(x)&&x.key===w.name)),v=!p.every(w=>a.some(x=>!If(x)&&x.key===w.name)),b=!u.every(w=>l.some(x=>!If(x)&&x.key===w.name)),O=Irt(t,e,r);return!f&&!m&&!g&&!y&&!v&&!b&&!O}function yme(t,e){const{requestBody:r}=t,i=ih(t).toUpperCase();if(i==="GET"||i==="HEAD"||i==="OPTIONS")return null;try{switch(r.type.get()){case"JSON":return structuredClone(Io(r.content.get(),e));case"multipart/form-data":return Ylt(t,e);case"application/x-www-form-urlencoded":return Glt(t,e);case"application/octet-stream":return r.binary.get();default:return Io(r.content.get(),e)}}catch(o){console.error(o)}}function Aq(t,e){const{requestBody:r}=t,n=yme(t,e);if(n===null)return null;switch(r.type.get()){default:return n;case"multipart/form-data":return Hlt(n);case"application/x-www-form-urlencoded":return Xlt(n);case"application/octet-stream":return r.binary.ornull?.file.get()??null}}function Xlt(t){const e=new URLSearchParams;return t.forEach(({key:r,value:n})=>{e.append(r,n)}),e}function Glt(t,e){const{requestBody:r}=t,n=[],i=r.formData["application/x-www-form-urlencoded"];return xme(i.get()).forEach(o=>{const s=Io(o.value,e);n.push({key:Io(o.key,e),value:s,type:"text"})}),n}function Ylt(t,e){const{requestBody:r}=t,n=[],i=r.formData["multipart/form-data"];return xme(i.get()).forEach(({type:o,files:s,value:a,key:l})=>{const c=Io(l,e);if(o==="file"&&s)for(const u of s)n.push({key:c,value:u,type:o});else if(a){const u=Io(a,e);n.push({key:c,value:u,type:o})}}),n}function Hlt(t){const e=new FormData;return t.forEach(({key:r,value:n,type:i})=>{i==="file"?e.append(r,n.file):n&&e.append(r,n)}),e}function P8(t=[]){return t.filter(e=>{const{securityType:r,[Oe.APIKey]:n}=e;return r===Oe.APIKey&&n.location===ba.Query&&!!n.name}).map(e=>{const{[Oe.APIKey]:r}=e;return{id:"",key:r.name,value:r.key,active:!0,in:"query"}})}function vme(t,e,r){const n=r?.components.parameters.get();return cp("query",[P8(e?.security.get()),P8(t.security.get()),ri(e?.parameters.queryParameters.get(),n),ri(t.parameters.queryParameters.get(),n)])}function Ome(t,e,r,n){return vme(t,e,r).map(o=>{const s=Io(o.value,n),a=C8(s,o.allowReserved);return`${C8(o.key)}=${a}`}).join("&")}function Jlt(t,e,r,n){return vme(t,e,r).reduce((o,s)=>{const a=Io(s.value,n),l=Io(s.key,n);return o[l]=a,o},{})}function Klt(t){const e=t.indexOf("?");if(e===-1)return[];const r=new URLSearchParams(t.slice(e+1)),n=[];for(const[i,o]of r.entries())n.push({id:crypto.randomUUID(),active:!0,key:i,value:o,in:"query"});return n}function ect(t){const e=t.split("?")[0],r=Ult(e),n=/^\{[^\s]+\}$/,i=r.filter(o=>n.test(o)).map(o=>o.slice(1,-1));return new Set(i)}function Rq(t,e,r,n){const i=nct(t,n),o=Wlt(t,e,r,n),s=tct(t,e,r,n),a=r?.components.parameters.get();return cp("header",[i,o,s,ri(e?.parameters.headers.get(),a),ri(t.parameters.headers.get(),a)]).reduce((u,{key:d,value:p})=>(u[d]=Io(p,n),u),{})}function tct(t,e,r,n){const o=bme(t,e,r).map(s=>`${s.key}=${Io(s.value,n)}`).join("; ");return o?[{id:"",key:"Cookie",value:o,active:!0,in:"header"},{id:"",key:"X-Redocly-Cookie",value:o,active:!0,in:"header"}]:[]}function rct(t,e,r,n){return bme(t,e,r).reduce((o,s)=>{const a=Io(s.value,n);return{...o,[Io(s.key,n)]:a}},{})}function $8(t=[]){return t.filter(e=>{const{securityType:r,[Oe.APIKey]:n}=e;return r===Oe.APIKey&&n.location===ba.Cookie&&!!n.name}).map(e=>{const{[Oe.APIKey]:r}=e;return{id:"",key:r.name,value:r.key,active:!0,in:"cookie"}})}function bme(t,e,r){const n=r?.components.parameters.get();return cp("cookie",[$8(e?.security.get()),$8(t.security.get()),ri(e?.parameters.cookies.get(),n),ri(t.parameters.cookies.get(),n)])}function xme(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function nct(t,e){const{requestBody:r}=t;return!Aq(t,e)||["binary","multipart/form-data"].includes(r.type.get())?[]:[{id:"",key:"Content-Type",value:r.type.get(),active:!0,in:"header"}]}function Io(t,e){return e?en(t,My(e)?.inputs):t}function ict({proxyUrl:t,resolvedUrl:e,ignoreProxy:r,queryParameters:n=""}){const i=t!=="/"?NM(t):t;let o;return r||!i?o=e:o=`${i}/${e}`,n&&(o+=`?${n}`),o}function jq(t){return t.flatMap(e=>{const r=e.id.get();return(e.paths?.keys??[]).flatMap(i=>{const o=e.paths.nested(i),a=(o.keys??[]).filter(u=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(u.toLowerCase())).map(u=>{const d=o.nested(u),p=d.operationId.get()||"",f=d.summary.get();return{apiId:r,path:i,method:u,operationId:p,summary:f,isAdditionalOperation:!1}}),l=o.additionalOperations?.get(),c=l?Object.entries(l).map(([u,d])=>({apiId:r,path:i,method:u,operationId:d.operationId||"",summary:d.summary,isAdditionalOperation:!0})):[];return[...a,...c]})})}const wme=(t,e,r)=>{if(!e)return null;const{apiId:n,method:i,path:o}=e,s=t.find(l=>l.id.get()===n);if(!s)return null;if(r)try{return r(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 Rh({tabsState:{activeTabIdx:t,tabs:e}}){return e[t?.get()??0]}function oct(t){const{environments:e,apis:r,tabsState:{tabs:n}}=t,i=n.filter(l=>l.data.type.get()===tt.Step),o=jq(r),s=i.map(l=>{const{collectionId:c,workflowId:u,satisfiesScheme:d}=l.data.get(),p=l.data.draftStep.ornull;if(p===null)return null;const{operationId:f,apiId:m}=p.get().operation??{};if(!d||!f)return null;const g=t.collections.find(_=>_.id.get()===c),y=g?.workflows.find(_=>_.workflowId.get()===u),v=o.find(_=>_.operationId===f&&_.apiId===m);if(!v)return null;const b=Rq(p,y,g,t),O=Aq(p,t),w=rct(p,y,g,t),x=Jlt(p,y,g,t),S=p.requestBody.activeExampleName;return{apiPath:{path:v.path,method:v.method},requestValues:{cookie:w,header:b,query:x,body:O},activeExampleName:S.get()}}).filter(l=>l!==null),a=My(t);return{operations:s,environment:a?.name,environments:Object.fromEntries(e.get().map(l=>[l.name,{...Object.fromEntries(l.inputs.map(({name:c,value:u})=>[c,u])),...Object.fromEntries(l.servers.map(({apiId:c,value:u})=>[c,u]))}]))}}function sct(t){const e=t.data.get();switch(e.type){case tt.Workflow:return`${e.collectionId}/${e.workflowId}`;case tt.Collection:return e.collectionId;case tt.Step:return`${e.collectionId}/${e.workflowId}/${e.stepId}`;case tt.WorkflowRun:return`${e.collectionId}/${e.workflowId}`}}function jh(t){const e=Wt(),r=Rh(e);return!r.get()||t&&!Rn(r.data.get(),t)?{tab:null,tabDataId:void 0}:{tab:r,tabDataId:sct(r)}}function act(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return P.useMemo(()=>n=>{e.forEach(i=>i(n))},e)}const xT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Wy(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Nq(t){return"nodeType"in t}function Ts(t){var e,r;return t?Wy(t)?t:Nq(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function Mq(t){const{Document:e}=Ts(t);return t instanceof e}function lx(t){return Wy(t)?!1:t instanceof Ts(t).HTMLElement}function Sme(t){return t instanceof Ts(t).SVGElement}function Zy(t){return t?Wy(t)?t.document:Nq(t)?Mq(t)?t:lx(t)||Sme(t)?t.ownerDocument:document:document:document}const sl=xT?P.useLayoutEffect:P.useEffect;function wT(t){const e=P.useRef(t);return sl(()=>{e.current=t}),P.useCallback(function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return e.current==null?void 0:e.current(...n)},[])}function lct(){const t=P.useRef(null),e=P.useCallback((n,i)=>{t.current=setInterval(n,i)},[]),r=P.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function Xb(t,e){e===void 0&&(e=[t]);const r=P.useRef(t);return sl(()=>{r.current!==t&&(r.current=t)},e),r}function cx(t,e){const r=P.useRef();return P.useMemo(()=>{const n=t(r.current);return r.current=n,n},[...e])}function Kk(t){const e=wT(t),r=P.useRef(null),n=P.useCallback(i=>{i!==r.current&&e?.(i,r.current),r.current=i},[]);return[r,n]}function eP(t){const e=P.useRef();return P.useEffect(()=>{e.current=t},[t]),e.current}let fR={};function ux(t,e){return P.useMemo(()=>{if(e)return e;const r=fR[t]==null?0:fR[t]+1;return fR[t]=r,t+"-"+r},[t,e])}function _me(t){return function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.reduce((o,s)=>{const a=Object.entries(s);for(const[l,c]of a){const u=o[l];u!=null&&(o[l]=u+t*c)}return o},{...e})}}const Ig=_me(1),tP=_me(-1);function cct(t){return"clientX"in t&&"clientY"in t}function ST(t){if(!t)return!1;const{KeyboardEvent:e}=Ts(t.target);return e&&t instanceof e}function uct(t){if(!t)return!1;const{TouchEvent:e}=Ts(t.target);return e&&t instanceof e}function rP(t){if(uct(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:r}=t.touches[0];return{x:e,y:r}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:r}=t.changedTouches[0];return{x:e,y:r}}}return cct(t)?{x:t.clientX,y:t.clientY}:null}const Cp=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:r}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:r}=t;return"scaleX("+e+") scaleY("+r+")"}},Transform:{toString(t){if(t)return[Cp.Translate.toString(t),Cp.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),T8="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function dct(t){return t.matches(T8)?t:t.querySelector(T8)}const pct={display:"none"};function fct(t){let{id:e,value:r}=t;return ve.default.createElement("div",{id:e,style:pct},r)}function hct(t){let{id:e,announcement:r,ariaLiveType:n="assertive"}=t;const i={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ve.default.createElement("div",{id:e,style:i,role:"status","aria-live":n,"aria-atomic":!0},r)}function mct(){const[t,e]=P.useState("");return{announce:P.useCallback(n=>{n!=null&&e(n)},[]),announcement:t}}const Cme=P.createContext(null);function gct(t){const e=P.useContext(Cme);P.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function yct(){const[t]=P.useState(()=>new Set),e=P.useCallback(n=>(t.add(n),()=>t.delete(n)),[t]);return[P.useCallback(n=>{let{type:i,event:o}=n;t.forEach(s=>{var a;return(a=s[i])==null?void 0:a.call(s,o)})},[t]),e]}const vct={draggable:`
785
+ `,en=(t,e,r=new Set)=>{const n=cme(t);if(!n.length)return t;let i=0;const o=n.flatMap(({start:s,end:a,name:l})=>{if(r.has(l))return null;const c=e.findLast(d=>d.name===l),u=t.slice(i,c?s:a);if(i=a,c){r.add(l);const d=en(c.value,e,r);return r.delete(l),[u.length?u:null,d||t.slice(s,a)]}return[u.length?u:null]});return t.slice(i).length&&o.push(t.slice(i)),o.join("")};function xlt(t,e){return e.find(r=>r.name===t.slice(1,-1))?.value||t}function wlt(t,e){const r=ume(t);if(!r.length)return h.jsx(_8,{children:t});let n=0;const i=r.flatMap(({start:o,end:s})=>{const a=t.slice(n,o),l=xlt(t.slice(o,s),e);return n=s,[a.length?a:null,l]});return t.slice(n).length&&i.push(t.slice(n)),h.jsx(_8,{children:i.join("")})}function dme(t){return Q1e(t)}const pme="New Step";function YM({name:t=pme,workflow:e}={}){let r=t.replaceAll(" ","-").toLowerCase();if(!e)return r;const n=Slt(e);if(n.includes(r)){let i=1;for(;n.includes(`${r}-${i}`);)i++;r=`${r}-${i}`}return r}function Slt(t){return t.steps.filter(e=>e.state.get()!==Tr.Draft).map(e=>e.stepId.get())}function cu({name:t=pme,isDraft:e=!1,fromStep:r,workflow:n,operation:i,apiOperation:o,dynamicReplayValues:s,xOperation:a}={}){if(!r){const c=o?rq(o,s):null,u=[Pa()];return{stepId:YM({name:t,workflow:n}),description:t,outputs:[],successCriteria:[],state:e?Tr.Draft:Tr.Normal,parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},requestBody:qk(),xOperation:a??(i?null:{method:"GET",url:""}),security:u,operation:i??null,...c}}const l=r.get({noproxy:!0});return{stepId:YM({name:t,workflow:n}),description:l.description,outputs:l.outputs,successCriteria:l.successCriteria,state:e?Tr.Draft:Tr.Normal,parameters:l.parameters,requestBody:l.requestBody,xOperation:l.xOperation,security:l.security,operation:l.operation}}function ih(t){return dme(t)?t.xOperation?.ornull?.method.get()??t.operation.ornull?.method.get()??"":t.xOperation?.method??t.operation?.method??""}function Jk(t){return dme(t)?t.xOperation?.ornull?.url.get()??t.operation.ornull?.nested("path").get()??"":t.xOperation?.url??t.operation?.path??""}function Iq(t,e,r,n){const{inputs:i,servers:o}=n,s=brt(cp("path",[ri(e?.parameters.pathParameters,r?.components.parameters),ri(t.parameters.pathParameters,r?.components.parameters)]),n.inputs),a=t.xOperation??null,l=t.operation??null;let c="",u="";if(a)u=a.method,c=wX(a.url,s);else if(l){const f=o.find(g=>g.apiId===l.apiId);u=l.method==="x-query"?"query":l.method,c=(f?.value?gfe(f.value,f.variables):"")+wX(l.path,s)}const d=c.split("?")[0];return{url:en(d,i),method:u.toUpperCase()}}function Lp(t,{collectionId:e,workflowId:r,stepId:n}){return t.collections.find(a=>a.id.get()===e)?.workflows.find(a=>a.workflowId.get()===r)?.steps.find(a=>a.stepId.get()===n)??null}function _lt(t){const e=t.substring(7).split(", "),r={};for(const n of e){const[i,o]=n.split("=");r[i]=o.replace(/"/g,"")}return r}function Clt(t,e,r,n){const{inputs:i}=n,{requestBody:{content:o}}=t,{url:s,method:a}=Iq(t,e,r,n),l=[...e?.security||[],...t.security].findLast(_=>_.securityType===Oe.DigestAuth);if(!l)return"";const{username:c,password:u,realm:d,nonce:p,cnonce:f,algorithm:m,qop:g,nc:y,opaque:v}=l[Oe.DigestAuth],b=en(c,i),{pathname:O,search:w}=new URL(s),x=w?`${O}${w}`:O,S=klt({username:b,password:en(u,i),uri:x,realm:d,nonce:p,cnonce:f,algorithm:m,qop:g,nc:y,method:a,bodyContent:o});return`Digest username="${b}", realm="${d}", nonce="${p}", uri="${x}", qop=${g}, nc=${y}, cnonce="${f}", response="${S}", algorithm=${m}${v?`, opaque="${v}"`:""}`}function klt(t){const{username:e,password:r,realm:n,nonce:i,cnonce:o,algorithm:s,qop:a,nc:l,uri:c,method:u,bodyContent:d}=t,p=Plt(s),f=s?.endsWith("-sess")?p(`${p(`${e}:${n}:${r}`)}:${i}:${o}`):p(`${e}:${n}:${r}`),m=a?.includes("auth-int")?p(`${u}:${c}:${p(d)}`):p(`${u}:${c}`);return p(`${f}:${i}:${l}:${o}:${a}:${m}`).toString()}function Plt(t){switch(t?.replace("-sess","")){case"SHA-256":return e=>Ng(Lte(e));default:return e=>Ng(S0(e))}}function $lt(t){try{const r=new URL(t).hostname;return r==="localhost"||r==="127.0.0.1"}catch{return!1}}function HM(t,e=window.location.origin){try{const r=new URL(t);return e===r.origin}catch{return!1}}function Tlt(t){return t?t.split(";").map(n=>n.trim()).map(n=>{const i=n.indexOf("="),o=n.slice(0,i).trim(),s=n.slice(i+1).trim();return[o,s]}):[]}const Ilt=["json","xml","html","text"],Elt=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function pR(t,e){return t.get(e)??t.get(e.toLowerCase())}function Alt(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function Rlt(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 r=t.match(/filename=([^;\n]+)/i);if(r?.[1])return r[1].replace(/(^")|("$)/g,"").trim()}function jlt(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function Nlt(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const r=t.toLowerCase();return Elt.some(n=>r.includes(n))?!0:r.startsWith("application/")?!Ilt.some(n=>r.includes(n)):!1}async function Mlt(t,e){const r=pR(t.headers,"content-type")?.split(";")[0].trim(),n=pR(t.headers,"content-disposition"),i=Alt(pR(t.headers,"content-length")),o=Nlt(r,n),s=Tlt(document.cookie);if(o){const p={fileName:Rlt(n)||jlt(t.url)||"response",contentType:r,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:p,bodyNotStored:!0,url:t.url}}const l=await t.clone().arrayBuffer(),c=new TextDecoder().decode(l),u=new Uint8Array(l).length;return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:l,body:c,duration:e,cookies:s,size:u,url:t.url}}const Dlt=":/?#[]@!$&'()*+,;=",Qlt=new Set(["!","'","(",")","*"]);function Llt(t){return Qlt.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function C8(t,e=!1){let r=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return r;const n=[...Dlt].map(i=>({char:i,encoded:Llt(i)}));for(const{char:i,encoded:o}of n)r=r.split(o).join(i);return r}function k8(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 fme(t,e){let r=k8(t);const n=e.find(({host:i,port:o})=>k8(`https://${i}:${o}`)===r);return{clientCert:n?.crtFilePath,clientKey:n?.keyFilePath}}function qlt(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function zlt(t,e){const{exists:r}=await Promise.resolve().then(()=>V$),{join:n}=await Promise.resolve().then(()=>Cle),{baseName:i,extension:o}=qlt(e);let s=0;for(;;){const a=s===0?"":` (${s})`,l=`${i}${a}${o}`,c=await n(t,l);if(!await r(c))return c;s+=1}}function Ult(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}function Vlt(t){if(t!=null)return t}function Eq(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function hme(t,e){if(!e)return"same-origin";try{const r=new URL(e).origin;return new URL(Eq(t)).origin===r?"include":"same-origin"}catch{return"same-origin"}}async function mme({store:t,step:e,settings:r,workflow:n,collection:i,signal:o}){const{corsProxyUrl:s,credentialOrigin:a,certificates:l}=r.get(),c=My(t),{url:u,method:d}=Iq(e.get(),n?.get(),i?.get(),c),p=s||"",f=Ome(e,n,i,t),m=$lt(u)||HM(u),g=ict({proxyUrl:p,resolvedUrl:u,ignoreProxy:m,queryParameters:f});await Blt(e,n??void 0,g,a,o);const y=Rq(e,n??void 0,i??void 0,t),v=Vlt(Aq(e,t)),{clientCert:b,clientKey:O}=fme(u,l||[]),w=Eq(g),x=d.toUpperCase(),S=!Iy.includes(x),_=S?"POST":x,C=S?{...y,"X-HTTP-Method-Override":x}:y;return{urlWithProxyAndProtocol:w,fetchMethod:_,fetchHeaders:C,body:v,credentials:hme(w,a),mode:HM(w)?"same-origin":"cors",clientCert:b,clientKey:O,resolvedUrl:u}}async function gme(t,e,r,n){const{requestController:i}=t,s=Rh(t).data;if(s.type.get()!==tt.Step){console.warn("not an operation tab");return}const{collectionId:a,workflowId:l,response:c,requestError:u,isProcessingRequest:d}=s,p=t.collections.find(y=>y.id.get()===a.get()),f=p?.workflows.find(y=>y.workflowId.get()===l.get()),m=ql(e.get({noproxy:!0}));d.set(!0),i.get()?.abort?.(),i.set(new AbortController);const g=i.get()?.signal;try{const y=await mme({store:t,step:e,settings:r,workflow:f,collection:p,signal:g}),v=Date.now(),b={signal:g,method:y.fetchMethod,headers:y.fetchHeaders,body:y.body,mode:y.mode,credentials:y.credentials,clientCert:y.clientCert,clientKey:y.clientKey},O=await zl(y.urlWithProxyAndProtocol,b),w=Date.now()-v;u.set(null),c.set(await Mlt(O,w));const x=ql(c.value);n?.(m,x)}catch(y){if(c.set(null),y.name==="AbortError")return;u.set(y.message||String(y));const v=ql(c.value);n?.(m,v)}finally{d.set(!1)}}async function Flt({store:t,step:e,settings:r,workflow:n,collection:i,fileName:o,onProgress:s}){const a=await mme({store:t,step:e,settings:r,workflow:n,collection:i}),l={method:a.fetchMethod,headers:a.fetchHeaders,body:a.body,mode:a.mode,credentials:a.credentials,clientCert:a.clientCert,clientKey:a.clientKey},{clientCert:c,clientKey:u}=l,d=Br(),p=o||"response";let f=null;if(d){const{open:S}=await Promise.resolve().then(()=>require("./replay-index-DeWVPgYM.js")),_=await S({directory:!0,multiple:!1});if(!_)return;const C=Array.isArray(_)?_[0]:_;f=await zlt(C,p)}const m=await zl(a.urlWithProxyAndProtocol,l),g=m.headers.get("content-length"),y=g?Number.parseInt(g,10):void 0,v=Number.isFinite(y)?y:void 0,b=m.headers.get("content-type")??void 0;let O;if(m.body?.getReader){const S=m.body.getReader(),_=[];let C=0;for(;;){const{done:$,value:j}=await S.read();if($)break;if(j){const R=new Uint8Array(j.byteLength);R.set(j),_.push(R.buffer),C+=j.byteLength,s?.({receivedBytes:C,totalBytes:v,done:!1})}}O=new Blob(_,{type:b}),s?.({receivedBytes:C,totalBytes:v,done:!0})}else O=await m.blob(),s?.({receivedBytes:O.size,totalBytes:v,done:!0});if(d){const{writeFile:S}=await Promise.resolve().then(()=>V$),_=new Uint8Array(await O.arrayBuffer());if(!f)return;await S(f,_);return}const w=window.URL.createObjectURL(O),x=document.createElement("a");x.href=w,x.download=p,x.rel="noopener",x.click(),window.URL.revokeObjectURL(w)}async function Blt(t,e,r,n,i){const o=ih(t),a=[...Array.from(e?.security||[]),...Array.from(t.security)].findLast(l=>l.securityType.get()===Oe.DigestAuth);if(a){const l=Eq(r),c=await zl(l,{signal:i,method:o.toUpperCase(),credentials:hme(l,n),mode:HM(l)?"same-origin":"cors"}),u=_lt(c.headers.get("WWW-Authenticate")||"");a[Oe.DigestAuth].merge({nonce:u.nonce,realm:u.realm,qop:u.qop,algorithm:u.algorithm,opaque:u.opaque,cnonce:crypto.randomUUID(),nc:"00000001"})}}function Wlt(t,e,r,n){return[...e?.security.get()||[],...t.security.get()].map(i=>{switch(i.securityType){case Oe.BasicAuth:{const o=i[Oe.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+btoa(`${Io(o.username,n)}:${Io(o.password,n)}`),active:!0,in:"header"}}case Oe.DigestAuth:{const o=My(n);return{id:"",key:"Authorization",value:Clt(t.get(),e?.get(),r?.get(),o),active:!0,in:"header"}}case Oe.JWT:return{id:"",key:"Authorization",value:"Bearer "+i[Oe.JWT].token,active:!0,in:"header"};case Oe.OAuth2:{const{grantType:o}=i[Oe.OAuth2],{accessToken:s}=i[Oe.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+s,active:!0,in:"header"}}case Oe.OpenIDConnect:{const{grantType:o}=i[Oe.OpenIDConnect],{accessToken:s}=i[Oe.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+s,active:!0,in:"header"}}case Oe.APIKey:{const o=i[Oe.APIKey];return o.location===ba.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(i=>!!i)}function Zlt(t,e,r){const{operation:n,requestBody:i,parameters:o}=e,{headers:s,cookies:a,queryParameters:l}=o;if(!r)return!0;const c=r.parameters??[],u=c.filter(w=>w.in==="query"),d=c.filter(w=>w.in==="header"),p=c.filter(w=>w.in==="cookie"),f=n?.path!==r.path,m=r.method.toLowerCase()!==n?.method.toLowerCase(),g=r.body?.mediaTypes&&r.body?.mediaTypes?.[i.type]===void 0,y=!d.every(w=>s.some(x=>!If(x)&&x.key===w.name)),v=!p.every(w=>a.some(x=>!If(x)&&x.key===w.name)),b=!u.every(w=>l.some(x=>!If(x)&&x.key===w.name)),O=Irt(t,e,r);return!f&&!m&&!g&&!y&&!v&&!b&&!O}function yme(t,e){const{requestBody:r}=t,i=ih(t).toUpperCase();if(i==="GET"||i==="HEAD"||i==="OPTIONS")return null;try{switch(r.type.get()){case"JSON":return structuredClone(Io(r.content.get(),e));case"multipart/form-data":return Ylt(t,e);case"application/x-www-form-urlencoded":return Glt(t,e);case"application/octet-stream":return r.binary.get();default:return Io(r.content.get(),e)}}catch(o){console.error(o)}}function Aq(t,e){const{requestBody:r}=t,n=yme(t,e);if(n===null)return null;switch(r.type.get()){default:return n;case"multipart/form-data":return Hlt(n);case"application/x-www-form-urlencoded":return Xlt(n);case"application/octet-stream":return r.binary.ornull?.file.get()??null}}function Xlt(t){const e=new URLSearchParams;return t.forEach(({key:r,value:n})=>{e.append(r,n)}),e}function Glt(t,e){const{requestBody:r}=t,n=[],i=r.formData["application/x-www-form-urlencoded"];return xme(i.get()).forEach(o=>{const s=Io(o.value,e);n.push({key:Io(o.key,e),value:s,type:"text"})}),n}function Ylt(t,e){const{requestBody:r}=t,n=[],i=r.formData["multipart/form-data"];return xme(i.get()).forEach(({type:o,files:s,value:a,key:l})=>{const c=Io(l,e);if(o==="file"&&s)for(const u of s)n.push({key:c,value:u,type:o});else if(a){const u=Io(a,e);n.push({key:c,value:u,type:o})}}),n}function Hlt(t){const e=new FormData;return t.forEach(({key:r,value:n,type:i})=>{i==="file"?e.append(r,n.file):n&&e.append(r,n)}),e}function P8(t=[]){return t.filter(e=>{const{securityType:r,[Oe.APIKey]:n}=e;return r===Oe.APIKey&&n.location===ba.Query&&!!n.name}).map(e=>{const{[Oe.APIKey]:r}=e;return{id:"",key:r.name,value:r.key,active:!0,in:"query"}})}function vme(t,e,r){const n=r?.components.parameters.get();return cp("query",[P8(e?.security.get()),P8(t.security.get()),ri(e?.parameters.queryParameters.get(),n),ri(t.parameters.queryParameters.get(),n)])}function Ome(t,e,r,n){return vme(t,e,r).map(o=>{const s=Io(o.value,n),a=C8(s,o.allowReserved);return`${C8(o.key)}=${a}`}).join("&")}function Jlt(t,e,r,n){return vme(t,e,r).reduce((o,s)=>{const a=Io(s.value,n),l=Io(s.key,n);return o[l]=a,o},{})}function Klt(t){const e=t.indexOf("?");if(e===-1)return[];const r=new URLSearchParams(t.slice(e+1)),n=[];for(const[i,o]of r.entries())n.push({id:crypto.randomUUID(),active:!0,key:i,value:o,in:"query"});return n}function ect(t){const e=t.split("?")[0],r=Ult(e),n=/^\{[^\s]+\}$/,i=r.filter(o=>n.test(o)).map(o=>o.slice(1,-1));return new Set(i)}function Rq(t,e,r,n){const i=nct(t,n),o=Wlt(t,e,r,n),s=tct(t,e,r,n),a=r?.components.parameters.get();return cp("header",[i,o,s,ri(e?.parameters.headers.get(),a),ri(t.parameters.headers.get(),a)]).reduce((u,{key:d,value:p})=>(u[d]=Io(p,n),u),{})}function tct(t,e,r,n){const o=bme(t,e,r).map(s=>`${s.key}=${Io(s.value,n)}`).join("; ");return o?[{id:"",key:"Cookie",value:o,active:!0,in:"header"},{id:"",key:"X-Redocly-Cookie",value:o,active:!0,in:"header"}]:[]}function rct(t,e,r,n){return bme(t,e,r).reduce((o,s)=>{const a=Io(s.value,n);return{...o,[Io(s.key,n)]:a}},{})}function $8(t=[]){return t.filter(e=>{const{securityType:r,[Oe.APIKey]:n}=e;return r===Oe.APIKey&&n.location===ba.Cookie&&!!n.name}).map(e=>{const{[Oe.APIKey]:r}=e;return{id:"",key:r.name,value:r.key,active:!0,in:"cookie"}})}function bme(t,e,r){const n=r?.components.parameters.get();return cp("cookie",[$8(e?.security.get()),$8(t.security.get()),ri(e?.parameters.cookies.get(),n),ri(t.parameters.cookies.get(),n)])}function xme(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function nct(t,e){const{requestBody:r}=t;return!Aq(t,e)||["binary","multipart/form-data"].includes(r.type.get())?[]:[{id:"",key:"Content-Type",value:r.type.get(),active:!0,in:"header"}]}function Io(t,e){return e?en(t,My(e)?.inputs):t}function ict({proxyUrl:t,resolvedUrl:e,ignoreProxy:r,queryParameters:n=""}){const i=t!=="/"?NM(t):t;let o;return r||!i?o=e:o=`${i}/${e}`,n&&(o+=`?${n}`),o}function jq(t){return t.flatMap(e=>{const r=e.id.get();return(e.paths?.keys??[]).flatMap(i=>{const o=e.paths.nested(i),a=(o.keys??[]).filter(u=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(u.toLowerCase())).map(u=>{const d=o.nested(u),p=d.operationId.get()||"",f=d.summary.get();return{apiId:r,path:i,method:u,operationId:p,summary:f,isAdditionalOperation:!1}}),l=o.additionalOperations?.get(),c=l?Object.entries(l).map(([u,d])=>({apiId:r,path:i,method:u,operationId:d.operationId||"",summary:d.summary,isAdditionalOperation:!0})):[];return[...a,...c]})})}const wme=(t,e,r)=>{if(!e)return null;const{apiId:n,method:i,path:o}=e,s=t.find(l=>l.id.get()===n);if(!s)return null;if(r)try{return r(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 Rh({tabsState:{activeTabIdx:t,tabs:e}}){return e[t?.get()??0]}function oct(t){const{environments:e,apis:r,tabsState:{tabs:n}}=t,i=n.filter(l=>l.data.type.get()===tt.Step),o=jq(r),s=i.map(l=>{const{collectionId:c,workflowId:u,satisfiesScheme:d}=l.data.get(),p=l.data.draftStep.ornull;if(p===null)return null;const{operationId:f,apiId:m}=p.get().operation??{};if(!d||!f)return null;const g=t.collections.find(_=>_.id.get()===c),y=g?.workflows.find(_=>_.workflowId.get()===u),v=o.find(_=>_.operationId===f&&_.apiId===m);if(!v)return null;const b=Rq(p,y,g,t),O=Aq(p,t),w=rct(p,y,g,t),x=Jlt(p,y,g,t),S=p.requestBody.activeExampleName;return{apiPath:{path:v.path,method:v.method},requestValues:{cookie:w,header:b,query:x,body:O},activeExampleName:S.get()}}).filter(l=>l!==null),a=My(t);return{operations:s,environment:a?.name,environments:Object.fromEntries(e.get().map(l=>[l.name,{...Object.fromEntries(l.inputs.map(({name:c,value:u})=>[c,u])),...Object.fromEntries(l.servers.map(({apiId:c,value:u})=>[c,u]))}]))}}function sct(t){const e=t.data.get();switch(e.type){case tt.Workflow:return`${e.collectionId}/${e.workflowId}`;case tt.Collection:return e.collectionId;case tt.Step:return`${e.collectionId}/${e.workflowId}/${e.stepId}`;case tt.WorkflowRun:return`${e.collectionId}/${e.workflowId}`}}function jh(t){const e=Wt(),r=Rh(e);return!r.get()||t&&!Rn(r.data.get(),t)?{tab:null,tabDataId:void 0}:{tab:r,tabDataId:sct(r)}}function act(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return P.useMemo(()=>n=>{e.forEach(i=>i(n))},e)}const xT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Wy(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Nq(t){return"nodeType"in t}function Ts(t){var e,r;return t?Wy(t)?t:Nq(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function Mq(t){const{Document:e}=Ts(t);return t instanceof e}function lx(t){return Wy(t)?!1:t instanceof Ts(t).HTMLElement}function Sme(t){return t instanceof Ts(t).SVGElement}function Zy(t){return t?Wy(t)?t.document:Nq(t)?Mq(t)?t:lx(t)||Sme(t)?t.ownerDocument:document:document:document}const sl=xT?P.useLayoutEffect:P.useEffect;function wT(t){const e=P.useRef(t);return sl(()=>{e.current=t}),P.useCallback(function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return e.current==null?void 0:e.current(...n)},[])}function lct(){const t=P.useRef(null),e=P.useCallback((n,i)=>{t.current=setInterval(n,i)},[]),r=P.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function Xb(t,e){e===void 0&&(e=[t]);const r=P.useRef(t);return sl(()=>{r.current!==t&&(r.current=t)},e),r}function cx(t,e){const r=P.useRef();return P.useMemo(()=>{const n=t(r.current);return r.current=n,n},[...e])}function Kk(t){const e=wT(t),r=P.useRef(null),n=P.useCallback(i=>{i!==r.current&&e?.(i,r.current),r.current=i},[]);return[r,n]}function eP(t){const e=P.useRef();return P.useEffect(()=>{e.current=t},[t]),e.current}let fR={};function ux(t,e){return P.useMemo(()=>{if(e)return e;const r=fR[t]==null?0:fR[t]+1;return fR[t]=r,t+"-"+r},[t,e])}function _me(t){return function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.reduce((o,s)=>{const a=Object.entries(s);for(const[l,c]of a){const u=o[l];u!=null&&(o[l]=u+t*c)}return o},{...e})}}const Ig=_me(1),tP=_me(-1);function cct(t){return"clientX"in t&&"clientY"in t}function ST(t){if(!t)return!1;const{KeyboardEvent:e}=Ts(t.target);return e&&t instanceof e}function uct(t){if(!t)return!1;const{TouchEvent:e}=Ts(t.target);return e&&t instanceof e}function rP(t){if(uct(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:r}=t.touches[0];return{x:e,y:r}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:r}=t.changedTouches[0];return{x:e,y:r}}}return cct(t)?{x:t.clientX,y:t.clientY}:null}const Cp=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:r}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:r}=t;return"scaleX("+e+") scaleY("+r+")"}},Transform:{toString(t){if(t)return[Cp.Translate.toString(t),Cp.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),T8="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function dct(t){return t.matches(T8)?t:t.querySelector(T8)}const pct={display:"none"};function fct(t){let{id:e,value:r}=t;return ve.default.createElement("div",{id:e,style:pct},r)}function hct(t){let{id:e,announcement:r,ariaLiveType:n="assertive"}=t;const i={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ve.default.createElement("div",{id:e,style:i,role:"status","aria-live":n,"aria-atomic":!0},r)}function mct(){const[t,e]=P.useState("");return{announce:P.useCallback(n=>{n!=null&&e(n)},[]),announcement:t}}const Cme=P.createContext(null);function gct(t){const e=P.useContext(Cme);P.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function yct(){const[t]=P.useState(()=>new Set),e=P.useCallback(n=>(t.add(n),()=>t.delete(n)),[t]);return[P.useCallback(n=>{let{type:i,event:o}=n;t.forEach(s=>{var a;return(a=s[i])==null?void 0:a.call(s,o)})},[t]),e]}const vct={draggable:`
786
786
  To pick up a draggable item, press the space bar.
787
787
  While dragging, use the arrow keys to move the item.
788
788
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -3438,7 +3438,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
3438
3438
  gap: var(--spacing-xs);
3439
3439
  `,K_={[Wi.SIMPLE]:{label:"Simple",tooltipContent:"Success criteria conditions in the form of basic literals, operators, and loose comparisons"},[Wi.REGEX]:{label:"Regex",tooltipContent:"Regex patterns used as success criteria conditions"},[Wi.JSONPATH]:{label:"JSONPath",tooltipContent:"JSONPath expressions as success criteria conditions"},[Wi.XPATH]:{label:"XPath",tooltipContent:"XPath expressions as success criteria conditions"}},Lkt=Object.keys(K_);function qkt({successCriteria:t}){const{sendEvent:e}=It(),r=o=>{e("com.redocly.button.click",[{...qe("button","addSuccessCriteria"),source:"workflow",action:"add_success_criteria",success_criteria_type:o}]),t.set(s=>[...s||[],{...KL(o)}])},n=P.useMemo(()=>t.filter(o=>o.get()!==void 0),[t]),i=o=>{e("com.redocly.button.click",[{...qe("button","removeSuccessCriteria"),source:"workflow",action:"remove_success_criteria",success_criteria_type:o.get().type,condition:o.get().condition}]),o.set(Zt)};return h.jsxs(h.Fragment,{children:[h.jsxs(uu,{children:["Success criteria",h.jsx(Vs,{content:"List of conditions required to complete the step."})]}),n.map(o=>h.jsx(P.Fragment,{children:h.jsx(jkt,{successCriteria:o,label:K_[o.get().type].label,tooltipContent:K_[o.get().type].tooltipContent,additionalActions:h.jsx(_s,{"data-testid":"remove-success-criteria-button",variant:"text",icon:h.jsx(z.TrashCanIcon,{}),onClick:()=>i(o)})})},o.get().id)),h.jsx(zkt,{renderInput:()=>h.jsx(z.Button,{variant:"outlined",icon:h.jsx(z.AddIcon,{}),iconPosition:"left",size:"small",children:"Add success criteria"}),dataTestId:"workflow-step-success-criteria-select",options:Lkt.map(o=>({element:K_[o].label,label:o,value:o})),onChange:o=>{r(o)},placement:"top",hideCheckmarkIcon:!0})]})}const zkt=T.default(z.Select)`
3440
3440
  border-radius: var(--border-radius-md);
3441
- `;function Ukt({step:t,workflowId:e,collectionId:r}){const{handleIdChange:n}=Ih(),i=t.stepId.get();return h.jsx(h.Fragment,{children:h.jsxs(oOe,{children:[h.jsx(uu,{children:"Info"}),h.jsxs(Qr,{children:[h.jsxs(Qr.Row,{children:[h.jsx(Qr.Cell,{children:h.jsxs(Lf,{children:["Step ID",h.jsx(Vs,{content:"This step's unique identifier"})]})}),h.jsx(Qr.Cell,{$readonly:!0,children:h.jsx(TD,{attribute:t.stepId,editorTitle:"Change step ID",placeholder:"Add step ID",onSave:o=>{r&&e&&n({collectionId:r,workflowId:e,stepId:i},{collectionId:r,workflowId:e,stepId:o})}})})]}),h.jsxs(Qr.Row,{children:[h.jsx(Qr.Cell,{children:h.jsxs(Lf,{children:["Description",h.jsx(Vs,{content:"The step's purpose in the workflow."})]})}),h.jsx(Qr.Cell,{children:h.jsx(az,{state:t.description,placeholder:"Add description"})})]})]}),h.jsxs(Ag,{children:[h.jsx(uu,{children:"Operation"}),h.jsx(Ikt,{step:t,collectionId:r})]}),h.jsx(Ag,{children:h.jsx(iOe,{outputs:t.outputs,tooltipText:"Data generated in this step that can be used in the next steps."})}),h.jsx(Ag,{children:h.jsx(qkt,{successCriteria:t.successCriteria})})]})})}function Vkt({onParameterChange:t,files:e}){const r=P.useRef(null),n=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(Br())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-MYWxrMRM.js")),l=await a({multiple:!0});if(!l)return;const u=(Array.isArray(l)?l:[l]).map(ex),p=(await Promise.all(u)).filter(f=>f!==null);t(p)}catch(a){console.error("Failed to open file dialog or read file:",a)}else r.current?.click()},o=P.useCallback(()=>{t(null)},[t]),s=P.useMemo(()=>{if(!e)return null;if(e.length===1)return h.jsx(WY,{icon:h.jsx(z.CloseIcon,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:h.jsx(ZY,{children:e[0].file.name})});if(e.length>1)return h.jsx(WY,{icon:h.jsx(z.CloseIcon,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:h.jsxs(ZY,{children:[e.length," files"]})})},[e,o]);return h.jsx(Fkt,{children:h.jsxs(Bkt,{children:[h.jsx(Wkt,{children:s||h.jsx(Xkt,{children:"Add files here"})}),h.jsxs(Zkt,{children:[h.jsx(Pot,{onClick:i,variant:"text","data-testid":"add-button",icon:h.jsx(z.AddIcon,{color:"--text-color-secondary"})}),h.jsx("input",{"data-testid":"file-input",hidden:!0,ref:r,type:"file",multiple:!0,accept:"files/*",onChange:n})]})]})})}const Fkt=T.default.div`
3441
+ `;function Ukt({step:t,workflowId:e,collectionId:r}){const{handleIdChange:n}=Ih(),i=t.stepId.get();return h.jsx(h.Fragment,{children:h.jsxs(oOe,{children:[h.jsx(uu,{children:"Info"}),h.jsxs(Qr,{children:[h.jsxs(Qr.Row,{children:[h.jsx(Qr.Cell,{children:h.jsxs(Lf,{children:["Step ID",h.jsx(Vs,{content:"This step's unique identifier"})]})}),h.jsx(Qr.Cell,{$readonly:!0,children:h.jsx(TD,{attribute:t.stepId,editorTitle:"Change step ID",placeholder:"Add step ID",onSave:o=>{r&&e&&n({collectionId:r,workflowId:e,stepId:i},{collectionId:r,workflowId:e,stepId:o})}})})]}),h.jsxs(Qr.Row,{children:[h.jsx(Qr.Cell,{children:h.jsxs(Lf,{children:["Description",h.jsx(Vs,{content:"The step's purpose in the workflow."})]})}),h.jsx(Qr.Cell,{children:h.jsx(az,{state:t.description,placeholder:"Add description"})})]})]}),h.jsxs(Ag,{children:[h.jsx(uu,{children:"Operation"}),h.jsx(Ikt,{step:t,collectionId:r})]}),h.jsx(Ag,{children:h.jsx(iOe,{outputs:t.outputs,tooltipText:"Data generated in this step that can be used in the next steps."})}),h.jsx(Ag,{children:h.jsx(qkt,{successCriteria:t.successCriteria})})]})})}function Vkt({onParameterChange:t,files:e}){const r=P.useRef(null),n=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(Br())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-DeWVPgYM.js")),l=await a({multiple:!0});if(!l)return;const u=(Array.isArray(l)?l:[l]).map(ex),p=(await Promise.all(u)).filter(f=>f!==null);t(p)}catch(a){console.error("Failed to open file dialog or read file:",a)}else r.current?.click()},o=P.useCallback(()=>{t(null)},[t]),s=P.useMemo(()=>{if(!e)return null;if(e.length===1)return h.jsx(WY,{icon:h.jsx(z.CloseIcon,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:h.jsx(ZY,{children:e[0].file.name})});if(e.length>1)return h.jsx(WY,{icon:h.jsx(z.CloseIcon,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:h.jsxs(ZY,{children:[e.length," files"]})})},[e,o]);return h.jsx(Fkt,{children:h.jsxs(Bkt,{children:[h.jsx(Wkt,{children:s||h.jsx(Xkt,{children:"Add files here"})}),h.jsxs(Zkt,{children:[h.jsx(Pot,{onClick:i,variant:"text","data-testid":"add-button",icon:h.jsx(z.AddIcon,{color:"--text-color-secondary"})}),h.jsx("input",{"data-testid":"file-input",hidden:!0,ref:r,type:"file",multiple:!0,accept:"files/*",onChange:n})]})]})})}const Fkt=T.default.div`
3442
3442
  position: relative;
3443
3443
  display: flex;
3444
3444
  flex-grow: 1;
@@ -3565,7 +3565,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
3565
3565
  `,lPt=T.default.div`
3566
3566
  display: flex;
3567
3567
  justify-content: center;
3568
- `;function cPt({data:t,type:e}){const r=qr(),n=t[e];function i(s,a){a&&n.merge([td()])}function o(s){n[s].set(Zt)}return h.jsx(Ykt,{keyName:"Param",formElements:n,onParameterChange:i,environment:r,enableInputTypeSelection:e!==wi["application/x-www-form-urlencoded"],actions:s=>h.jsx(_s,{onClick:()=>o(s),variant:"text",icon:h.jsx(z.TrashCanIcon,{})})})}const uPt=({data:t})=>{const e=t.get(),[r,n]=P.useState(!1),i=P.useRef(null),o=l=>{const c=l.target.files?.[0];if(c){n(!0);const u=new FileReader;u.onload=()=>{n(!1),t.set({absolutePath:null,file:c})},u.readAsDataURL(c)}},s=async()=>{if(Br())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-MYWxrMRM.js")),c=await l();if(!c)return;const u=await ex(c);t.set(u)}catch(l){console.error("Failed to open file dialog or read file:",l)}else i.current?.click()},a=()=>{t.set(null)};return r?h.jsxs(dPt,{children:[h.jsx(z.SpinnerIcon,{}),"Loading..."]}):e&&e.file?.name?h.jsxs(pPt,{children:[h.jsxs(fPt,{children:[h.jsx(z.DocumentBlankIcon,{size:"16px"}),h.jsx(hPt,{children:e.file?.name})]}),h.jsx(_s,{onClick:a,icon:h.jsx(z.TrashCanIcon,{})})]}):h.jsx(sOe,{children:!e&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"file",hidden:!0,ref:i,onChange:o}),h.jsx(z.Button,{type:"button",variant:"text",onClick:s,icon:h.jsx(z.CloudUploadIcon,{}),children:"Upload file"})]})})},sOe=T.default.div`
3568
+ `;function cPt({data:t,type:e}){const r=qr(),n=t[e];function i(s,a){a&&n.merge([td()])}function o(s){n[s].set(Zt)}return h.jsx(Ykt,{keyName:"Param",formElements:n,onParameterChange:i,environment:r,enableInputTypeSelection:e!==wi["application/x-www-form-urlencoded"],actions:s=>h.jsx(_s,{onClick:()=>o(s),variant:"text",icon:h.jsx(z.TrashCanIcon,{})})})}const uPt=({data:t})=>{const e=t.get(),[r,n]=P.useState(!1),i=P.useRef(null),o=l=>{const c=l.target.files?.[0];if(c){n(!0);const u=new FileReader;u.onload=()=>{n(!1),t.set({absolutePath:null,file:c})},u.readAsDataURL(c)}},s=async()=>{if(Br())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-DeWVPgYM.js")),c=await l();if(!c)return;const u=await ex(c);t.set(u)}catch(l){console.error("Failed to open file dialog or read file:",l)}else i.current?.click()},a=()=>{t.set(null)};return r?h.jsxs(dPt,{children:[h.jsx(z.SpinnerIcon,{}),"Loading..."]}):e&&e.file?.name?h.jsxs(pPt,{children:[h.jsxs(fPt,{children:[h.jsx(z.DocumentBlankIcon,{size:"16px"}),h.jsx(hPt,{children:e.file?.name})]}),h.jsx(_s,{onClick:a,icon:h.jsx(z.TrashCanIcon,{})})]}):h.jsx(sOe,{children:!e&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"file",hidden:!0,ref:i,onChange:o}),h.jsx(z.Button,{type:"button",variant:"text",onClick:s,icon:h.jsx(z.CloudUploadIcon,{}),children:"Upload file"})]})})},sOe=T.default.div`
3569
3569
  display: flex;
3570
3570
  align-items: center;
3571
3571
  justify-content: flex-start;
@@ -4383,7 +4383,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
4383
4383
  @media (max-width: ${Zo}px) {
4384
4384
  padding: var(--spacing-xs) var(--spacing-sm);
4385
4385
  }
4386
- `,xIt={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t},wIt=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function SIt({collectionId:t,workflowId:e}){const{project:{userFilesDir:r}}=Wt(),{certificates:n}=Eo(),i=qr(),{getCollection:o}=Od(),s=o(t),a=r.get(),{inputs:l,servers:c}=i.get(),u=s?.sourceDescriptions.get()??[];return{execute:async p=>{const f=`${a}/${t}`,m=new ghe,g=l.map(b=>JSON.stringify({[b.name]:b.value})),y=_It(c,u),{run:v}=await Promise.resolve().then(()=>require("./replay-respect-run-CeDRayiH.js"));return await v({files:[f],workflow:e?[e]:[],fetch:(b,O)=>{const w=wIt(b),{clientCert:x,clientKey:S}=fme(w,n?n.get({noproxy:!0}):[]);return zl(w,{...O,clientCert:x,clientKey:S})},logger:xIt,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async b=>{if(!await U$(b))throw new Error(`File ${b} doesn't exist or isn't readable.`);try{const w=await z$(b),x=new TextEncoder().encode(w);return new File([x],await V5(b))}catch(w){throw new Error(`Failed to read file ${b}: ${w}`)}}},envVariables:{},config:await ese({}),externalRefResolver:m,input:g,server:y,severity:JSON.stringify(p),skipLint:!0,noSecretsMasking:!0})}}}function _It(t,e){return e.map(r=>{const n=t.find(o=>o.apiId===r.apiId);if(!n)return null;let i=n.value;if(n.variables)for(const o of n.variables){const s=new RegExp(`\\{${o.name}\\}`,"g");i=i.replace(s,o.value)}return`${r.name}=${i}`}).filter(r=>r!==null)}function oI(t){return t==null?"N/A":t<1e3?`${t} ms`:t<1e4?`${(t/1e3).toFixed(1)} s`:`${Math.round(t/1e3)} s`}function _Oe({checks:t}){const e=t.filter(f=>f.severity!=="off"),r=e.filter(f=>f.passed).length,n=e.filter(f=>f.severity==="warn"&&!f.passed).length,i=e.length,o=i-r-n,s=r===i,a=r===0,[l,c]=ve.default.useState(o>0||n>0),u=()=>s?"All checks passed":a?"All checks failed":`Some ${i>1?"checks were":"check was"} not successful`,d=()=>s?h.jsx(z.CheckmarkFilledIcon,{color:"var(--color-success-base)"}):o>0?h.jsx(z.ErrorFilledIcon,{color:"var(--color-error-base)"}):h.jsx(z.WarningFilledIcon,{color:"var(--color-warning-base)"}),p=f=>{f.stopPropagation(),c(!l)};return!e||e.length===0?null:h.jsxs(CIt,{children:[h.jsxs(kIt,{onClick:p,children:[h.jsxs(PIt,{children:[h.jsx($It,{children:h.jsx(TIt,{children:d()})}),h.jsxs(IIt,{children:[h.jsx(EIt,{children:u()}),h.jsxs(AIt,{children:[r," successful",n>0&&h.jsxs(h.Fragment,{children:[", ",n," ",n===1?"warning":"warnings"]}),o>0&&h.jsxs(h.Fragment,{children:[", ",o," failed"]})]})]})]}),h.jsx(RIt,{isExpanded:l,children:l?h.jsx(z.ChevronDownIcon,{}):h.jsx(z.ChevronRightIcon,{})})]}),h.jsx(jIt,{isExpanded:l,children:e.map((f,m)=>h.jsxs(NIt,{children:[h.jsx(MIt,{children:f.passed?h.jsx(z.CheckmarkIcon,{color:"var(--color-success-base)",size:"14px"}):!f.passed&&["warn"].includes(f.severity)?h.jsx(z.WarningFilledIcon,{color:"var(--color-warning-base)",size:"14px"}):h.jsx(z.CloseOutlineIcon,{color:"var(--color-error-base)",size:"14px"})}),h.jsxs(DIt,{children:[h.jsx(QIt,{children:f.name}),f.message&&h.jsx(LIt,{children:f.message})]})]},m))})]})}const CIt=T.default.div`
4386
+ `,xIt={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t},wIt=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function SIt({collectionId:t,workflowId:e}){const{project:{userFilesDir:r}}=Wt(),{certificates:n}=Eo(),i=qr(),{getCollection:o}=Od(),s=o(t),a=r.get(),{inputs:l,servers:c}=i.get(),u=s?.sourceDescriptions.get()??[];return{execute:async p=>{const f=`${a}/${t}`,m=new ghe,g=l.map(b=>JSON.stringify({[b.name]:b.value})),y=_It(c,u),{run:v}=await Promise.resolve().then(()=>require("./replay-respect-run-BzjM57BJ.js"));return await v({files:[f],workflow:e?[e]:[],fetch:(b,O)=>{const w=wIt(b),{clientCert:x,clientKey:S}=fme(w,n?n.get({noproxy:!0}):[]);return zl(w,{...O,clientCert:x,clientKey:S})},logger:xIt,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async b=>{if(!await U$(b))throw new Error(`File ${b} doesn't exist or isn't readable.`);try{const w=await z$(b),x=new TextEncoder().encode(w);return new File([x],await V5(b))}catch(w){throw new Error(`Failed to read file ${b}: ${w}`)}}},envVariables:{},config:await ese({}),externalRefResolver:m,input:g,server:y,severity:JSON.stringify(p),skipLint:!0,noSecretsMasking:!0})}}}function _It(t,e){return e.map(r=>{const n=t.find(o=>o.apiId===r.apiId);if(!n)return null;let i=n.value;if(n.variables)for(const o of n.variables){const s=new RegExp(`\\{${o.name}\\}`,"g");i=i.replace(s,o.value)}return`${r.name}=${i}`}).filter(r=>r!==null)}function oI(t){return t==null?"N/A":t<1e3?`${t} ms`:t<1e4?`${(t/1e3).toFixed(1)} s`:`${Math.round(t/1e3)} s`}function _Oe({checks:t}){const e=t.filter(f=>f.severity!=="off"),r=e.filter(f=>f.passed).length,n=e.filter(f=>f.severity==="warn"&&!f.passed).length,i=e.length,o=i-r-n,s=r===i,a=r===0,[l,c]=ve.default.useState(o>0||n>0),u=()=>s?"All checks passed":a?"All checks failed":`Some ${i>1?"checks were":"check was"} not successful`,d=()=>s?h.jsx(z.CheckmarkFilledIcon,{color:"var(--color-success-base)"}):o>0?h.jsx(z.ErrorFilledIcon,{color:"var(--color-error-base)"}):h.jsx(z.WarningFilledIcon,{color:"var(--color-warning-base)"}),p=f=>{f.stopPropagation(),c(!l)};return!e||e.length===0?null:h.jsxs(CIt,{children:[h.jsxs(kIt,{onClick:p,children:[h.jsxs(PIt,{children:[h.jsx($It,{children:h.jsx(TIt,{children:d()})}),h.jsxs(IIt,{children:[h.jsx(EIt,{children:u()}),h.jsxs(AIt,{children:[r," successful",n>0&&h.jsxs(h.Fragment,{children:[", ",n," ",n===1?"warning":"warnings"]}),o>0&&h.jsxs(h.Fragment,{children:[", ",o," failed"]})]})]})]}),h.jsx(RIt,{isExpanded:l,children:l?h.jsx(z.ChevronDownIcon,{}):h.jsx(z.ChevronRightIcon,{})})]}),h.jsx(jIt,{isExpanded:l,children:e.map((f,m)=>h.jsxs(NIt,{children:[h.jsx(MIt,{children:f.passed?h.jsx(z.CheckmarkIcon,{color:"var(--color-success-base)",size:"14px"}):!f.passed&&["warn"].includes(f.severity)?h.jsx(z.WarningFilledIcon,{color:"var(--color-warning-base)",size:"14px"}):h.jsx(z.CloseOutlineIcon,{color:"var(--color-error-base)",size:"14px"})}),h.jsxs(DIt,{children:[h.jsx(QIt,{children:f.name}),f.message&&h.jsx(LIt,{children:f.message})]})]},m))})]})}const CIt=T.default.div`
4387
4387
  margin-bottom: 0;
4388
4388
  margin-top: var(--spacing-xxs);
4389
4389
  `,kIt=T.default.div`