@redocly/replay 0.24.0-next.2 → 0.24.0-next.3
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.
- package/dist/{replay-index-BRR5bL8a.js → replay-index-BjCQMY7D.js} +1 -1
- package/dist/{replay-index-B2hxHO71.js → replay-index-CJcnXz6B.js} +6 -6
- package/dist/{replay-index-CMDZK_WV.js → replay-index-IquGJvOX.js} +1 -1
- package/dist/{replay-index-DdH9X-06.js → replay-index-o0B_MaDr.js} +7 -7
- package/dist/{replay-respect-run-Bz6CHm6x.js → replay-respect-run-CfoAKhbR.js} +1 -1
- package/dist/{replay-respect-run-DMXH3z6E.js → replay-respect-run-DAhUpEqU.js} +1 -1
- package/dist/{replay-tauri-path-BZgQe2h9.js → replay-tauri-path-IOUXbhvr.js} +1 -1
- package/dist/{replay-tauri-path-CkKR4yjJ.js → replay-tauri-path-Wwbhczwf.js} +2 -2
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/package.json +2 -6
|
@@ -108,7 +108,7 @@ Repeats of \`in:${r.in}\` + \`name:${r.name}\`.`,location:o.PathItem.child(["par
|
|
|
108
108
|
${y}`,location:g};m&&(v.forceSeverity=m),l.report(v)}}})}}};return t.schemas!="off"&&(n.NamedSchemas={Schema(a,{location:l}){s(kA,l)}}),t.responses!="off"&&(n.NamedResponses={Response(a,{location:l}){s(TA,l)}}),t.parameters!="off"&&(n.NamedParameters={Parameter(a,{location:l}){s(PA,l)}}),t.requestBodies!="off"&&(n.NamedRequestBodies={RequestBody(a,{location:l}){s(IA,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=nAe(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 rAe(t){return eAe[t]??null}function nAe(t,e){return`${t}/${e}`}function iAe(t){const[e,r]=t.split("/");return{typeName:e,componentName:r}}const oAe=()=>({Root(t,{report:e,location:r}){if(!t.hasOwnProperty("servers")){e({message:"Servers must be present.",location:r.child(["openapi"]).key()});return}(!Array.isArray(t.servers)||t.servers.length===0)&&e({message:"Servers must be a non-empty array.",location:r.child(["servers"]).key()})}}),sAe=()=>({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()})}}),aAe=t=>{const e=n=>n.schema===void 0,r=n=>(i,o)=>{const{location:s,resolve:a}=o;if(af(i.example))l(i.example,s.child("example"));else if(xt(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(pi(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"||eO(d?c.value:c,i.schema,{location:u,ctx:o,allowAdditionalProperties:!!t.allowAdditionalProperties,ajvContext:n})}};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"})}}}},lAe=()=>({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"])})}}),cAe=()=>({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"])})}}),uAe=()=>({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=mz(i);o&&n.push(...o)}else{const i=mz(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()}),i==="invalidDefaultValue"&&e({message:"Server variable define `enum` and `default`. `enum` must include default value",location:r.child(["servers"]).key()})}});function mz(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 dAe=()=>({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"])});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")})}}),pAe=()=>{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","Header","Parameter","Response","Example","RequestBody","MediaTypesMap"].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()})})}},NamedSchemas:{Schema(r,{location:n,key:i}){r.allOf||e(n,i.toString())}},NamedParameters:{Parameter(r,{location:n,key:i}){e(n,i.toString())}},NamedResponses:{Response(r,{location:n,key:i}){e(n,i.toString())}},NamedExamples:{Example(r,{location:n,key:i}){e(n,i.toString())}},NamedRequestBodies:{RequestBody(r,{location:n,key:i}){e(n,i.toString())}},NamedHeaders:{Header(r,{location:n,key:i}){e(n,i.toString())}},NamedMediaTypes:{MediaTypesMap(r,{location:n,key:i}){e(n,i.toString())}}}},fAe=()=>({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"])})}}}),hAe=()=>({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()})},MediaType:{skip(t,e){return e!=="application/problem+json"},enter(t,e){$d("schema",t,e)},SchemaProperties(t,e){$d("type",t,e),$d("title",t,e)}}}}),mAe=({allowedValues:t})=>({Paths:{RequestBody:{leave(e,r){Om({type:"consumes",value:e},r,t)}},Callback:{RequestBody(){},Response:{leave(e,r){Om({type:"consumes",value:e},r,t)}}}},WebhooksMap:{Response:{leave(e,r){Om({type:"consumes",value:e},r,t)}}}}),gAe=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[zm(r)]||e[zm(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()})}}}}}},yAe=({allowedValues:t})=>({Paths:{Response:{leave(e,r){Om({type:"produces",value:e},r,t)}},Callback:{Response(){},RequestBody:{leave(e,r){Om({type:"produces",value:e},r,t)}}}},WebhooksMap:{RequestBody:{leave(e,r){Om({type:"produces",value:e},r,t)}}}}),vAe=()=>{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()})}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")}}}},OAe=()=>{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=_A(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")})}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"])})}}}},bAe=()=>({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}),n!==void 0&&e!==void 0&&i({message:"The 'serializedValue' and 'externalValue' fields of an example object are mutually exclusive.",location:o}),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()}),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()})}}),xAe=()=>({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()})}}}),wAe=()=>{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")});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")});return}i.add(o),o=t.find(s=>s.name===o)?.parent}}}}};function gz(t){return t.filter(e=>!("$ref"in e)&&e.in==="querystring").length}function yz(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})}function vz(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}),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}),r.querystringLocation??=e)}const SAe=()=>{let t={},e={},r=0;return{PathItem:{enter(n,i){t={},e={},r=0,yz(gz(n.parameters||[]),i)},Parameter(n,i){vz(n,i.location,t,i),n.in==="querystring"&&(r+=1)},Operation:{enter(n,i){e={...t};const o=r+gz(n.parameters||[]);yz(o,i)},Parameter(n,i){vz(n,i.location,e,i)}}}}},_Ae={struct:qf,"info-contact":$g,"info-license":oQ,"info-license-strict":YC,"operation-2xx-response":Pee,"operation-4xx-response":Tee,"operation-4xx-problem-details-rfc7807":hAe,assertions:Df,"operation-operationId-unique":$ee,"operation-parameters-unique":Aee,"operation-tag-defined":Nee,"no-example-value-and-externalValue":sAe,"no-mixed-number-range-constraints":GC,"no-enum-type-mismatch":hb,"no-path-trailing-slash":kee,"no-empty-servers":oAe,"path-declaration-must-exist":Mee,"operation-operationId-url-safe":Eee,"operation-operationId":JC,"operation-summary":jee,"tags-alphabetical":ek,"no-server-example.com":lAe,"no-server-trailing-slash":cAe,"tag-description":KC,"operation-description":Iee,"no-unused-components":pAe,"path-not-include-query":Lee,"path-parameters-defined":m1,"path-params-defined":m1,"parameter-description":Qee,"operation-singular-tag":Ree,"security-defined":Gee,"no-unresolved-refs":Lf,"paths-kebab-case":Bee,"boolean-parameter-prefixes":KEe,"path-http-verbs-order":Dee,"no-invalid-media-type-examples":aAe,"no-identical-paths":See,"no-ambiguous-paths":bee,"no-undefined-server-variable":dAe,"no-server-variables-empty-enum":uAe,"no-http-verbs-in-paths":wee,"request-mime-type":mAe,"response-mime-type":yAe,"path-segment-plural":Fee,"no-invalid-schema-examples":Cee,"no-invalid-parameter-examples":_ee,"response-contains-header":Zee,"response-contains-property":gAe,"scalar-property-missing-example":Xee,"spec-components-invalid-map-name":vAe,"required-string-property-missing-min-length":Wee,"spec-strict-refs":Yee,"component-name-unique":tAe,"array-parameter-serialization":HEe,"no-required-schema-properties-undefined":mb,"no-schema-type-mismatch":gb,"no-duplicated-tag-names":HC,"nullable-type-sibling":fAe,"spec-no-invalid-tag-parents":wAe,"spec-no-invalid-encoding-combinations":xAe,"spec-discriminator-defaultMapping":OAe,"spec-example-values":bAe,"spec-querystring-parameters":SAe},CAe={},kAe=()=>{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()})})}},NamedSchemas:{Schema(r,{location:n,key:i}){r.allOf||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())}}}},PAe=()=>({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"])}),i.add(c))})}}}),TAe=()=>({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"])}):i=!0})}}}),IAe={struct:qf,"no-unresolved-refs":Lf,assertions:Df,"info-license":oQ,"no-unused-components":kAe,"info-contact":$g,"spec-no-duplicated-method-params":PAe,"spec-no-required-params-after-optional":TAe},$Ae={},EAe={"info-contact":$g,struct:qf,"no-unresolved-refs":Lf,assertions:Df},AAe={},RAe={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"}},jAe={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"}},NAe={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"}},QAe={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"}},MAe={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"}},DAe={recommended:QAe,"recommended-strict":NAe,minimal:jAe,all:RAe,spec:MAe},Oz={id:"",rules:{oas3:_Ae,oas2:GEe,async2:PEe,async3:EEe,arazzo1:SEe,overlay1:EAe,openrpc1:IAe},preprocessors:{oas3:CAe,oas2:YEe,async2:TEe,async3:AEe,arazzo1:_Ee,overlay1:AAe,openrpc1:$Ae},decorators:{oas3:a$e,oas2:i$e,async2:JIe,async3:KIe,arazzo1:HIe,overlay1:c$e,openrpc1:l$e},configs:DAe};function yv(t,e){return t+"::"+e}function LAe(){return new Promise(t=>{setTimeout(t)})}class Um{constructor(e,r,n){this.absoluteRef=e,this.body=r,this.mimeType=n}getAst(e){return this._ast===void 0&&(this._ast=e(this.body,{filename:this.absoluteRef})??void 0,this._ast&&this._ast.kind===0&&this._ast.value===""&&this._ast.startPosition!==1&&(this._ast.startPosition=1,this._ast.endPosition=1)),this._ast}getLines(){return this._lines===void 0&&(this._lines=this.body.split(/\r\n|[\n\r]/g)),this._lines}}class sQ extends Error{constructor(e){super(e.message),this.originalError=e,Object.setPrototypeOf(this,sQ.prototype)}}function qAe(t,e){const r=new Um(e,t);try{return{source:r,parsed:rQ(t,{filename:e})}}catch(n){throw new Ig(n,r)}}class tk{constructor(e={http:{headers:[]}}){this.config=e,this.cache=new Map}getFiles(){return new Set(Array.from(this.cache.keys()))}resolveExternalRef(e,r){return ui(r)?r:e&&ui(e)?new URL(r,e).href:rn.resolve(e?rn.dirname(e):process.cwd(),r)}async loadExternalRef(e){try{if(ui(e)){const{body:r,mimeType:n}=await iH(e,this.config.http);return new Um(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 Um(e,r.replace(/\r\n/g,`
|
|
109
109
|
`))}}catch(r){throw r.message=r.message.replace(", lstat",""),new sQ(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:rQ(e.body,{filename:e.absoluteRef})}}catch(i){throw new Ig(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 bz(t,e){return{prev:t,node:e}}function zAe(t,e){for(;t;){if(t.node===e)return!0;t=t.prev}return!1}const fy={name:"unknown",properties:{}},UAe={name:"scalar",properties:{}};async function bm(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 h=u.source.absoluteRef,m=new Map;g(c,p,h+d);function g(v,O,b){if(!xt(v)&&!Array.isArray(v))return;const x=`${O.name}::${b}`;if(o.has(x))return;if(o.add(x),Array.isArray(v)){const S=O.items;if(S===void 0&&O!==fy&&O!==Bp)return;const $=typeof S=="function";for(let E=0;E<v.length;E++){let N=$?S(v[E],rd(b,E)):S;if(N===void 0&&O!==fy&&O!==Bp)continue;const R=N?.directResolveAs?{$ref:v[E]}:v[E];N=N?.directResolveAs||N,g(R,Td(N)?N:fy,rd(b,E))}return}const[w,_]=Object.entries(v).find(([S])=>S==="$anchor")||[];_&&m.set(`#${_}`,v);for(const S of Object.keys(v)){let $=v[S],E=lf(O.properties,S);E===void 0&&(E=O.additionalProperties),typeof E=="function"&&(E=E($,S)),E===void 0&&(E=fy),O.extensionsPrefix&&S.startsWith(O.extensionsPrefix)&&E===fy&&(E=Bp),!Td(E)&&E?.directResolveAs&&(E=E.directResolveAs,$={$ref:$}),E&&E.name===void 0&&E.resolvable!==!1&&(E=UAe),!(!Td(E)||!(xt($)||Array.isArray($)))&&g($,E,rd(b,Tp(S)))}if(pi(v)){const S=y(u,v,{prev:null,node:v}).then($=>{$.resolved&&l($.node,$.document,$.nodePointer,O)});s.push(S)}if(oH(v)){const S=y(u,{$ref:v.externalValue},{prev:null,node:v}).then($=>{$.resolved&&l($.node,$.document,$.nodePointer,O)});s.push(S)}}async function y(v,O,b){if(zAe(b.prev,O))throw new Error("Self-referencing circular pointer");if(nxe(O.$ref)){await LAe();const L={resolved:!0,isRemote:!1,node:m.get(O.$ref),document:v,nodePointer:O.$ref},D=yv(v.source.absoluteRef,O.$ref);return i.set(D,L),L}const{uri:x,pointer:w}=IN(O.$ref),_=x!==null&&r.resolveExternalRef(v.source.absoluteRef,x)!==v.source.absoluteRef;let S;try{S=_?await r.resolveDocument(v.source.absoluteRef,x):v}catch(L){const D={resolved:!1,isRemote:_,document:void 0,error:L},U=yv(v.source.absoluteRef,O.$ref);return i.set(U,D),D}let $={resolved:!0,document:S,isRemote:_,node:v.parsed,nodePointer:"#/"},E=S.parsed;const N=w;for(const L of N)if(xt(E)&&E[L]!==void 0)E=E[L],$.nodePointer=rd($.nodePointer,Tp(L));else if(Array.isArray(E)&&E[+L]!==void 0)E=E[+L],$.nodePointer=rd($.nodePointer,Tp(L));else if(pi(E))if($=await y(S,E,bz(b,E)),S=$.document||S,xt($.node))E=$.node[L],$.nodePointer=rd($.nodePointer,Tp(L));else if(Array.isArray($.node))E=$.node[+L],$.nodePointer=rd($.nodePointer,Tp(L));else{E=void 0;break}else{E=void 0;break}$.node=E,$.document=S;const R=yv(v.source.absoluteRef,O.$ref);return $.document&&pi(E)&&($=await y($.document,E,bz(b,E))),i.set(R,$),{...$}}}}const VAe={Root:"DefinitionRoot",ServerVariablesMap:"ServerVariableMap",Paths:["PathMap","PathsMap"],CallbacksMap:"CallbackMap",MediaTypesMap:"MediaTypeMap",ExamplesMap:"ExampleMap",EncodingMap:"EncodingsMap",HeadersMap:"HeaderMap",LinksMap:"LinkMap",OAuth2Flows:"SecuritySchemeFlows",Responses:"ResponsesMap"};function Zp(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 h of Object.values(a.properties)){if(h===l){p(s,u);continue}xt(h)&&h.name!==void 0&&d.add(h)}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(Bp);for(const h of Array.from(d.values()))n(s,h,l,c,u);function p(h,m){for(const g of m.slice(1))r[g.name]=r[g.name]||{enter:[],leave:[]},r[g.name].enter.push({...h,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,VAe[d]),h=r[d];if(!p)continue;let m,g,y;const v=xt(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 O=(m?1:0)+(g?1:0)+(y?1:0),b=v&&Object.keys(p).length>O,x={activatedOn:null,type:e[d],parent:l,isSkippedLevel:!1};if(b&&o(s,p,x,c+1),l&&n(s,l.type,e[d],l),m||v){if(m&&typeof m!="function")throw new Error("DEV: should be function");h.enter.push({...s,visit:m||(()=>{}),skip:y,depth:c,context:x})}if(g){if(typeof g!="function")throw new Error("DEV: should be function");h.leave.push({...s,visit:g,depth:c,context:x})}}}}const zr=(t,e)=>{if(e)for(const r of Object.keys(e))xt(t[r])&&typeof e[r]=="string"?t[r]={...t[r],severity:e[r]}:t[r]=e[r]};function mn(t,e){if(e)for(const r of Object.keys(e))t.hasOwnProperty(r)&&(xt(t[r])&&typeof e[r]=="string"?t[r]={...t[r],severity:e[r]}:t[r]=e[r])}function FAe(t){if(t.indexOf("/")>-1){const[e,r]=t.split("/");return{pluginId:e,configName:r}}else return{pluginId:"",configName:t}}function ri(t,e){if(!e)return t;const r={};for(const n of Object.keys(t))r[`${e}/${n}`]=t[n];return r}function Hee(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(xt(r)&&"extends"in r&&r.extends!==void 0)throw new Error(`'extends' is not supported in shared configs yet:
|
|
110
110
|
${JSON.stringify(r,null,2)}`);zr(e.rules,r.rules),zr(e.oas2Rules,r.oas2Rules),mn(e.oas2Rules,r.rules),zr(e.oas3_0Rules,r.oas3_0Rules),mn(e.oas3_0Rules,r.rules),zr(e.oas3_1Rules,r.oas3_1Rules),mn(e.oas3_1Rules,r.rules),zr(e.oas3_2Rules,r.oas3_2Rules),mn(e.oas3_2Rules,r.rules),zr(e.async2Rules,r.async2Rules),mn(e.async2Rules,r.rules),zr(e.async3Rules,r.async3Rules),mn(e.async3Rules,r.rules),zr(e.arazzo1Rules,r.arazzo1Rules),mn(e.arazzo1Rules,r.rules),zr(e.overlay1Rules,r.overlay1Rules),mn(e.overlay1Rules,r.rules),zr(e.openrpc1Rules,r.openrpc1Rules),mn(e.openrpc1Rules,r.rules),zr(e.preprocessors,r.preprocessors),zr(e.oas2Preprocessors,r.oas2Preprocessors),mn(e.oas2Preprocessors,r.preprocessors),zr(e.oas3_0Preprocessors,r.oas3_0Preprocessors),mn(e.oas3_0Preprocessors,r.preprocessors),zr(e.oas3_1Preprocessors,r.oas3_1Preprocessors),mn(e.oas3_1Preprocessors,r.preprocessors),zr(e.oas3_2Preprocessors,r.oas3_2Preprocessors),mn(e.oas3_2Preprocessors,r.preprocessors),zr(e.async2Preprocessors,r.async2Preprocessors),mn(e.async2Preprocessors,r.preprocessors),zr(e.async3Preprocessors,r.async3Preprocessors),mn(e.async3Preprocessors,r.preprocessors),zr(e.arazzo1Preprocessors,r.arazzo1Preprocessors),mn(e.arazzo1Preprocessors,r.preprocessors),zr(e.overlay1Preprocessors,r.overlay1Preprocessors),mn(e.overlay1Preprocessors,r.preprocessors),zr(e.openrpc1Preprocessors,r.openrpc1Preprocessors),mn(e.openrpc1Preprocessors,r.preprocessors),zr(e.decorators,r.decorators),zr(e.oas2Decorators,r.oas2Decorators),mn(e.oas2Decorators,r.decorators),zr(e.oas3_0Decorators,r.oas3_0Decorators),mn(e.oas3_0Decorators,r.decorators),zr(e.oas3_1Decorators,r.oas3_1Decorators),mn(e.oas3_1Decorators,r.decorators),zr(e.oas3_2Decorators,r.oas3_2Decorators),mn(e.oas3_2Decorators,r.decorators),zr(e.async2Decorators,r.async2Decorators),mn(e.async2Decorators,r.decorators),zr(e.async3Decorators,r.async3Decorators),mn(e.async3Decorators,r.decorators),zr(e.arazzo1Decorators,r.arazzo1Decorators),mn(e.arazzo1Decorators,r.decorators),zr(e.overlay1Decorators,r.overlay1Decorators),mn(e.overlay1Decorators,r.decorators),zr(e.openrpc1Decorators,r.openrpc1Decorators),mn(e.openrpc1Decorators,r.decorators)}return e}function BAe(t){return new Map(JSON.parse(JSON.stringify([...t])))}function xz(t){return xt(t)&&"id"in t}function WAe(t){return typeof t=="function"}function Jee({node:t,ctx:e,plugins:r}){if(!t.extends)return t;const n=(t.extends||[]).filter(Ia).map(i=>{if(!ui(i)&&!sf.extname(i))return iRe(i,r);const o=e.resolve({$ref:i});return o.location&&o.node!==void 0?o.node:null}).filter(Ia);return Hee([...n.map(i=>Jee({node:i,ctx:e,plugins:r})),{...t,extends:void 0}])}function hy(t,e){if(xt(t)&&Array.isArray(t.plugins)){const{plugins:r,rootConfigDir:n}=e.getVisitorData();r.push(...t.plugins.map(i=>ete(i,e.location.source.absoluteRef.replace(/^file:\/\//,""),n)))}}const ZAe=Zp([{severity:"error",ruleId:tee,visitor:{ref:{},ConfigGovernance:{leave(t,e){hy(t,e)}},ConfigApisProperties:{leave(t,e){hy(t,e)}},[ts.ScorecardClassicLevel]:{leave(t,e){hy(t,e)}},"rootRedoclyConfigSchema.scorecardClassic.levels_items":{leave(t,e){hy(t,e)}},ConfigRoot:{leave(t,e){hy(t,e)}}}}],fb);function my(t,e){if(xt(t)&&t.extends){const{plugins:r}=e.getVisitorData(),n=Jee({node:t,ctx:e,plugins:r});Object.assign(t,n),delete t.extends}}const XAe=Zp([{severity:"error",ruleId:eee,visitor:{ref:{leave(t,e,r){pA(t,r,e)}},ConfigGovernance:{leave(t,e){my(t,e)}},ConfigApisProperties:{leave(t,e){my(t,e)}},[ts.ScorecardClassicLevel]:{leave(t,e){my(t,e)}},"rootRedoclyConfigSchema.scorecardClassic.levels_items":{leave(t,e){my(t,e)}},ConfigRoot:{leave(t,e){my(t,e)}}}}],fb);function wz(t,e){return{prev:t,value:e}}function Sz(t){return t?.prev??null}function GAe(t){const e={};for(;t.parent;)e[t.parent.type.name]=t.parent.activatedOn?.value.node,t=t.parent;return e}function YAe(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 Xp(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 h of Object.keys(n))h==="any"||h==="ref"||(u[h]=l.concat(n[h]?.enter||[]),d[h]=(n[h]?.leave||[]).concat(c));p(e.parsed,r,new Lw(e.source,"#/"),void 0,"");function p(h,m,g,y,v){const O=(D,U=x.source.absoluteRef)=>{if(!pi(D))return{location:g,node:D};const F=yv(U,D.$ref),ee=i.get(F);if(!ee)return{location:void 0,node:void 0};const{resolved:se,node:re,document:ue,nodePointer:q,error:z}=ee;return{location:se?new Lw(ue.source,q):z instanceof Ig?new Lw(z.source,""):void 0,node:re,error:z}},b=g;let x=g;const w=pi(h),{node:_,location:S,error:$}=O(h),E=new Set;if(w){const D=n.ref.enter;for(const{visit:U,ruleId:F,severity:ee,message:se,context:re}of D)E.add(re),U(h,{report:q=>R(F,ee,se,q),resolve:O,rawNode:h,rawLocation:b,location:g,type:m,parent:y,key:v,parentLocations:{},specVersion:o.specVersion,config:o.config,getVisitorData:()=>L(F)},{node:_,location:S,error:$}),S?.source.absoluteRef&&o.refTypes&&o.refTypes.set(S?.source.absoluteRef,m)}if(_!==void 0&&S&&m.name!=="scalar"){x=S;const D=s[m.name]?.has?.(_);let U=!1;const F=u[m.name]||l.concat(n[m.name]?.enter||[]),ee=[],se=`${x.absolutePointer}${x.pointer}`;for(const{context:ue,visit:q,skip:z,ruleId:X,severity:G,message:M}of F){if(a.has(se))break;if(ue.isSkippedLevel)ue.parent.activatedOn&&!ue.parent.activatedOn.value.nextLevelTypeActivated&&!ue.seen.has(h)&&(ue.seen.add(h),U=!0,ee.push(ue));else if(ue.parent&&ue.parent.activatedOn&&ue.activatedOn?.value.withParentNode!==ue.parent.activatedOn.value.node&&ue.parent.activatedOn.value.nextLevelTypeActivated?.value!==m||!ue.parent&&!D){ee.push(ue);const Y={node:_,location:S,nextLevelTypeActivated:null,withParentNode:ue.parent?.activatedOn?.value.node,skipped:(ue.parent?.activatedOn?.value.skipped||z?.(_,v,{location:g,rawLocation:b,resolve:O,rawNode:h}))??!1};ue.activatedOn=wz(ue.activatedOn,Y);let H=ue.parent;for(;H;)H.activatedOn.value.nextLevelTypeActivated=wz(H.activatedOn.value.nextLevelTypeActivated,m),H=H.parent;Y.skipped||(U=!0,E.add(ue),N(q,_,h,ue,X,G,M))}}if(U||!D){if(s[m.name]=s[m.name]||new Set,s[m.name].add(_),Array.isArray(_)){const ue=m.items;if(ue!==void 0){const q=typeof ue=="function";for(let z=0;z<_.length;z++){const X=S.child([z]);let G=q?ue(_[z],X.absolutePointer):ue,M=_[z];G?.directResolveAs&&(G=G.directResolveAs,M={$ref:M}),Td(G)&&p(M,G,X,_,z)}}}else if(xt(_)){const ue=Object.keys(m.properties);m.additionalProperties?ue.push(...Object.keys(_).filter(q=>!ue.includes(q))):m.extensionsPrefix&&ue.push(...Object.keys(_).filter(q=>q.startsWith(m.extensionsPrefix))),w&&ue.push(...Object.keys(h).filter(q=>q!=="$ref"&&!ue.includes(q)));for(const q of ue){let z=_[q],X=S;z===void 0&&(z=h[q],X=g);let G=lf(m.properties,q);if(G===void 0&&(G=m.additionalProperties),typeof G=="function"&&(G=G(z,q)),G===void 0&&m.extensionsPrefix&&q.startsWith(m.extensionsPrefix)&&(G=Bp),!Td(G)&&G?.directResolveAs&&(G=G.directResolveAs,z={$ref:z}),G&&G.name===void 0&&G.resolvable!==!1&&(G={name:"scalar",properties:{}}),pi(h[q])&&G?.name==="scalar"){p(h[q],G,g.child([q]),h,q);continue}!Td(G)||G.name==="scalar"&&!pi(z)||p(z,G,X.child([q]),_,q)}}}const re=d[m.name]||(n[m.name]?.leave||[]).concat(c);for(const ue of ee.reverse())if(ue.isSkippedLevel)ue.seen.delete(_);else if(ue.activatedOn=Sz(ue.activatedOn),ue.parent){let q=ue.parent;for(;q;)q.activatedOn.value.nextLevelTypeActivated=Sz(q.activatedOn.value.nextLevelTypeActivated),q=q.parent}for(const{context:ue,visit:q,ruleId:z,severity:X,message:G}of re)!ue.isSkippedLevel&&E.has(ue)&&N(q,_,h,ue,z,X,G)}if(x=g,w){const D=n.ref.leave;for(const{visit:U,ruleId:F,severity:ee,context:se,message:re}of D)E.has(se)&&U(h,{report:q=>R(F,ee,re,q),resolve:O,rawNode:h,rawLocation:b,location:g,type:m,parent:y,key:v,parentLocations:{},specVersion:o.specVersion,config:o.config,getVisitorData:()=>L(F)},{node:_,location:S,error:$})}function N(D,U,F,ee,se,re,ue){D(U,{report:z=>R(se,re,ue,z),resolve:O,rawNode:F,location:x,rawLocation:b,type:m,parent:y,key:v,parentLocations:YAe(ee),specVersion:o.specVersion,config:o.config,ignoreNextVisitorsOnNode:()=>{a.add(`${x.absolutePointer}${x.pointer}`)},getVisitorData:()=>L(se)},GAe(ee),ee)}function R(D,U,F,ee){const re=(ee.location?Array.isArray(ee.location)?ee.location:[ee.location]:[{...x,reportOnKey:!1}]).map(q=>({...x,reportOnKey:!1,...q})),ue=ee.forceSeverity||U;ue!=="off"&&o.problems.push({ruleId:ee.ruleId||D,severity:ue,...ee,message:F?F.replace("{{message}}",ee.message):ee.message,suggest:ee.suggest||[],location:re})}function L(D){return o.visitorsData[D]=o.visitorsData[D]||{},o.visitorsData[D]}}}function _z(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 HAe({version:t,dereference:e,rootDocument:r,resolvedRefMap:n,keepUrlRefs:i,componentRenamingConflicts:o="warn"}){let s,a;const l={ref:{leave(h,m,g){if(!g.location||g.node===void 0){im(g,m.report,m.location);return}if(g.location.source===r.source&&g.location.source===m.location.source&&m.type.name!=="scalar"&&!e){h.$ref!==g.location.pointer&&(h.$ref=g.location.pointer);return}if(i&&ui(h.$ref))return;const y=_z(m.type.name,t);y?e?(u(y,g,m),pA(h,g,m)):(h.$ref=u(y,g,m),c(h,g,m)):pA(h,g,m)}},Example:{leave(h,m){if(oH(h)&&h.value===void 0){const g=m.resolve({$ref:h.externalValue});if(!g.location||g.node===void 0){im(g,m.report,m.location);return}if(i&&ui(h.externalValue))return;h.value=m.resolve({$ref:h.externalValue}).node,delete h.externalValue}}},Root:{enter(h,m){a=m.location,t==="oas3"?s=h.components=h.components||{}:t==="oas2"?s=h:t==="async2"?s=h.components=h.components||{}:t==="async3"?s=h.components=h.components||{}:t==="arazzo1"?s=h.components=h.components||{}:t==="openrpc1"&&(s=h.components=h.components||{})}}};if(t==="oas3"){const h=_z("Schema",t);l.Discriminator={leave(m,g){if(typeof m.defaultMapping!="string"||!Zv(m.defaultMapping))return;const y=g.resolve({$ref:m.defaultMapping});if(!y.location||y.node===void 0){im(y,g.report,g.location.child("defaultMapping"));return}m.defaultMapping=u(h,y,g)},DiscriminatorMapping:{leave(m,g){for(const y of Object.keys(m)){const v=m[y];if(!Zv(v))continue;const O=g.resolve({$ref:v});if(!O.location||O.node===void 0){im(O,g.report,g.location.child(y));return}m[y]=u(h,O,g)}}}}}function c(h,m,g){const y=yv(g.location.source.absoluteRef,h.$ref);n.set(y,{document:r,isRemote:!1,node:m.node,nodePointer:h.$ref,resolved:!0})}function u(h,m,g){s[h]=s[h]||{};const y=p(m,h,g);return s[h][y]=m.node,t==="oas3"||t==="async2"||t==="async3"||t==="openrpc1"?`#/components/${h}/${y}`:`#/${h}/${y}`}function d(h,m,g){return pi(h)&&g.resolve(h,a.absolutePointer).location?.absolutePointer===m.location.absolutePointer?!0:dA(h,m.node)}function p(h,m,g){const y=s[m],[v,O]=[h.location.source.absoluteRef,h.location.pointer];let b=txe(O)||rxe(v);const x=b;let w=2;for(;y[b]&&!d(y[b],h,g);)b=`${x}-${w}`,w++;return!y[b]&&x!==b&&g.report({message:`Two schemas are referenced with the same name but different content. Renamed ${x} to ${b}.`,location:g.location,forceSeverity:o}),b}return l}async function JAe(t){const{document:e,config:r,types:n,externalRefResolver:i,dereference:o=!1,removeUnusedComponents:s=!1,keepUrlRefs:a=!1,componentRenamingConflicts:l}=t,c=WC(e.parsed),u=lK(c),d=r.getRulesForSpecVersion(u),p=TN(r.extendTypes(n,c),r),h=p1(d,r,"preprocessors",c),m=p1(d,r,"decorators",c),g={problems:[],specVersion:c,config:r,refTypes:new Map,visitorsData:{}};let y=await bm({rootDocument:e,rootType:p.Root,externalRefResolver:i});h.length>0&&(Xp({document:e,rootType:p.Root,normalizedVisitors:Zp(h,p),resolvedRefMap:y,ctx:g}),y=await bm({rootDocument:e,rootType:p.Root,externalRefResolver:i}));const v=Zp([{severity:"error",ruleId:"bundler",visitor:HAe({version:u,dereference:o,rootDocument:e,resolvedRefMap:y,keepUrlRefs:a,componentRenamingConflicts:l})},...m.filter(O=>O.ruleId!=="remove-unused-components")],p);if(Xp({document:e,rootType:p.Root,normalizedVisitors:v,resolvedRefMap:y,ctx:g}),s||r.getDecoratorSettings("remove-unused-components",c).severity!=="off"){const O=await bm({rootDocument:e,rootType:p.Root,externalRefResolver:i}),b=Zp([{severity:"error",ruleId:"remove-unused-components",visitor:u==="oas2"?pee():fee()}],p);Xp({document:e,rootType:p.Root,normalizedVisitors:b,resolvedRefMap:O,ctx:g})}return{bundle:e,problems:g.problems.map(O=>r.addProblemToIgnore(O)),fileDependencies:i.getFiles(),rootType:p.Root,refTypes:g.refTypes,visitorsData:g.visitorsData}}function KAe(t,e,r){const n={plugins:[],rootConfigDir:r},i={problems:[],specVersion:"oas3_0",refTypes:new Map,visitorsData:{[tee]:n}};return Xp({document:t,rootType:fb.ConfigRoot,normalizedVisitors:ZAe,resolvedRefMap:e,ctx:i}),n.plugins}function eRe(t,e,r){const n={plugins:r},i={problems:[],specVersion:"oas3_0",refTypes:new Map,visitorsData:{[eee]:n}};return Xp({document:t,rootType:fb.ConfigRoot,normalizedVisitors:XAe,resolvedRefMap:e,ctx:i}),t.parsed??{}}async function Kee(t){const{ref:e,doc:r,externalRefResolver:n=new tk(t.config.resolve),base:i=null}=t;if(!(e||r))throw new Error(`Document or reference is required.
|
|
111
|
-
`);const o=r===void 0?await n.resolveDocument(i,e,!0):r;if(o instanceof Error)throw o;return t.collectSpecData?.(o.parsed),JAe({document:o,...t,externalRefResolver:n,types:LN(WC(o.parsed))})}function kT(t){return!ia(t)}const PT=new Map;async function tRe({rawConfigDocument:t,configPath:e,externalRefResolver:r,customExtends:n}){const i=t===void 0?UIe:t.parsed;if(n!==void 0&&xt(i)&&(i.extends=n),xt(i)&&(i?.extends?.some(kT)||i?.scorecardClassic?.levels?.some(p=>p?.extends?.some(kT))||i?.scorecard?.levels?.some(p=>p?.extends?.some(kT))))throw new Error("Configuration format not detected in extends: values must be strings.");const o=t??{source:new Um(e??"",JSON.stringify(i)),parsed:i},s=await bm({rootDocument:o,rootType:fb.ConfigRoot,externalRefResolver:r??new tk(ree(i?.resolve))});let a=[],l,c="";ea?l=[...(i?.plugins||[]).filter(h=>!ia(h)),Oz]:(c=rn.dirname(e??""),a=KAe(o,s,c),l=[...await nRe(a.map(h=>Cz(h)?h.absolutePath:h),c),Oz]);const u=eRe(o,BAe(s),l);u.apis&&(u.apis=Object.fromEntries(Object.entries(u.apis).map(([p,h])=>{const m=Hee([u,h]);return[p,{...h,...m}]})));const d=a.length?a.map(p=>Cz(p)&&p.isModule?p.rawPath:p.absolutePath&&rn.relative(c,p.absolutePath)).filter(af):void 0;return{resolvedConfig:{...u,plugins:d},resolvedRefMap:s,plugins:l}}function rRe(t){for(const e of BIe)(void 0)(rn.resolve(t,e))}function Cz(t){return"isModule"in t}const ete=(t,e,r)=>{if(!ia(t))return t;(void 0)(rn.resolve(rn.dirname(e),t));try{return{absolutePath:eH.createRequire((typeof document>"u"?require("url").pathToFileURL(__filename).href:Jc&&Jc.tagName.toUpperCase()==="SCRIPT"&&Jc.src||new URL("replay-index-
|
|
111
|
+
`);const o=r===void 0?await n.resolveDocument(i,e,!0):r;if(o instanceof Error)throw o;return t.collectSpecData?.(o.parsed),JAe({document:o,...t,externalRefResolver:n,types:LN(WC(o.parsed))})}function kT(t){return!ia(t)}const PT=new Map;async function tRe({rawConfigDocument:t,configPath:e,externalRefResolver:r,customExtends:n}){const i=t===void 0?UIe:t.parsed;if(n!==void 0&&xt(i)&&(i.extends=n),xt(i)&&(i?.extends?.some(kT)||i?.scorecardClassic?.levels?.some(p=>p?.extends?.some(kT))||i?.scorecard?.levels?.some(p=>p?.extends?.some(kT))))throw new Error("Configuration format not detected in extends: values must be strings.");const o=t??{source:new Um(e??"",JSON.stringify(i)),parsed:i},s=await bm({rootDocument:o,rootType:fb.ConfigRoot,externalRefResolver:r??new tk(ree(i?.resolve))});let a=[],l,c="";ea?l=[...(i?.plugins||[]).filter(h=>!ia(h)),Oz]:(c=rn.dirname(e??""),a=KAe(o,s,c),l=[...await nRe(a.map(h=>Cz(h)?h.absolutePath:h),c),Oz]);const u=eRe(o,BAe(s),l);u.apis&&(u.apis=Object.fromEntries(Object.entries(u.apis).map(([p,h])=>{const m=Hee([u,h]);return[p,{...h,...m}]})));const d=a.length?a.map(p=>Cz(p)&&p.isModule?p.rawPath:p.absolutePath&&rn.relative(c,p.absolutePath)).filter(af):void 0;return{resolvedConfig:{...u,plugins:d},resolvedRefMap:s,plugins:l}}function rRe(t){for(const e of BIe)(void 0)(rn.resolve(t,e))}function Cz(t){return"isModule"in t}const ete=(t,e,r)=>{if(!ia(t))return t;(void 0)(rn.resolve(rn.dirname(e),t));try{return{absolutePath:eH.createRequire((typeof document>"u"?require("url").pathToFileURL(__filename).href:Jc&&Jc.tagName.toUpperCase()==="SCRIPT"&&Jc.src||new URL("replay-index-o0B_MaDr.js",document.baseURI).href)??__dirname).resolve(t,{paths:[r,(typeof document>"u"?require("url").pathToFileURL(__filename).href:Jc&&Jc.tagName.toUpperCase()==="SCRIPT"&&Jc.src||new URL("replay-index-o0B_MaDr.js",document.baseURI).href)?rn.dirname((void 0)(typeof document>"u"?require("url").pathToFileURL(__filename).href:Jc&&Jc.tagName.toUpperCase()==="SCRIPT"&&Jc.src||new URL("replay-index-o0B_MaDr.js",document.baseURI).href)):__dirname]}),isModule:!0,rawPath:t}}catch{throw new Error(`Plugin "${t}" not found.`)}};async function nRe(t,e){if(!t)return[];const r=async a=>{if(!ia(a))return a;try{const l=rn.isAbsolute(a)?a:ete(a,rn.join(e,zIe),e).absolutePath;if(!PT.has(l)){let c;if(typeof __webpack_require__=="function")c=__non_webpack_require__(l);else{const m=await import((void 0)(l).pathname);c=m.default||m}const u={contentDir:e},d=Array.isArray(c)?c:[c];for(const m of d)m?.id&&xz(m)&&yn.info(`Deprecated plugin format detected: ${m.id}
|
|
112
112
|
`);const p=xz(c)?c:WAe(c)?await c(u):await c?.default?.(u),h=Array.isArray(p)?p:[p];p&&PT.set(l,h.map(m=>({...m,path:a,absolutePath:l})))}return PT.get(l)}catch(l){throw new Error(`Failed to load plugin "${a}": ${l.message}
|
|
113
113
|
|
|
114
114
|
${l.stack}`)}},n=new Map,i=rRe(e);i&&t.push(i);const o=new Set;return(await Promise.all(t.map(async a=>{if(ia(a)){if(ui(a))throw new Error(wr.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(wr.red(`Plugin must define \`id\` property in ${wr.blue(a.toString())}.`));const p=u.absolutePath??a.toString(),h=n.get(d);if(h){if(p!==h)throw new Error(wr.red(`Plugin "id" must be unique. Plugin ${wr.blue(p)} uses id "${wr.blue(d)}" already seen in ${wr.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=ri(u.rules.oas3,d)),u.rules.oas2&&(m.rules.oas2=ri(u.rules.oas2,d)),u.rules.async2&&(m.rules.async2=ri(u.rules.async2,d)),u.rules.async3&&(m.rules.async3=ri(u.rules.async3,d)),u.rules.arazzo1&&(m.rules.arazzo1=ri(u.rules.arazzo1,d)),u.rules.overlay1&&(m.rules.overlay1=ri(u.rules.overlay1,d)),u.rules.openrpc1&&(m.rules.openrpc1=ri(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=ri(u.preprocessors.oas3,d)),u.preprocessors.oas2&&(m.preprocessors.oas2=ri(u.preprocessors.oas2,d)),u.preprocessors.async2&&(m.preprocessors.async2=ri(u.preprocessors.async2,d)),u.preprocessors.async3&&(m.preprocessors.async3=ri(u.preprocessors.async3,d)),u.preprocessors.arazzo1&&(m.preprocessors.arazzo1=ri(u.preprocessors.arazzo1,d)),u.preprocessors.overlay1&&(m.preprocessors.overlay1=ri(u.preprocessors.overlay1,d)),u.preprocessors.openrpc1&&(m.preprocessors.openrpc1=ri(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=ri(u.decorators.oas3,d)),u.decorators.oas2&&(m.decorators.oas2=ri(u.decorators.oas2,d)),u.decorators.async2&&(m.decorators.async2=ri(u.decorators.async2,d)),u.decorators.async3&&(m.decorators.async3=ri(u.decorators.async3,d)),u.decorators.arazzo1&&(m.decorators.arazzo1=ri(u.decorators.arazzo1,d)),u.decorators.overlay1&&(m.decorators.overlay1=ri(u.decorators.overlay1,d)),u.decorators.openrpc1&&(m.decorators.openrpc1=ri(u.decorators.openrpc1,d))}return u.assertions&&(m.assertions=u.assertions),{...u,...m}}))).filter(af)}))).filter(af).flat()}function iRe(t,e){const{pluginId:r,configName:n}=FAe(t),i=e.find(s=>s.id===r);if(!i)throw new Error(`Invalid config ${wr.red(t)}: plugin ${r} is not included.`);const o=i.configs?.[n];if(!o)throw new Error(r?`Invalid config ${wr.red(t)}: plugin ${r} doesn't export config with name ${n}.`:`Invalid config ${wr.red(t)}: there is no such built-in config.`);return o}async function tte(t,{configPath:e,externalRefResolver:r,ignore:n}={}){const o=qAe(typeof t=="string"?t:"",e??"");typeof t!="string"&&t&&(o.parsed=t);const{resolvedConfig:s,resolvedRefMap:a,plugins:l}=await tRe({rawConfigDocument:oRe(o),configPath:e,externalRefResolver:r});return new XC(s,{configPath:e,document:o,resolvedRefMap:a,plugins:l,ignore:n})}function oRe(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 TT={},ol={},IT={},kz;function rk(){return kz||(kz=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})(IT)),IT}var nu={},Pz;function Eg(){if(Pz)return nu;Pz=1,Object.defineProperty(nu,"__esModule",{value:!0});function t(s){return typeof s>"u"||s===null}nu.isNothing=t;function e(s){return typeof s=="object"&&s!==null}nu.isObject=e;function r(s){return Array.isArray(s)?s:t(s)?[]:[s]}nu.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}nu.extend=n;function i(s,a){var l="",c;for(c=0;c<a;c+=1)l+=s;return l}nu.repeat=i;function o(s){return s===0&&Number.NEGATIVE_INFINITY===1/s}return nu.isNegativeZero=o,nu}var $T,Tz;function yb(){if(Tz)return $T;Tz=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 $T=t,$T}var ET,Iz;function sRe(){if(Iz)return ET;Iz=1;var t=Eg(),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
|
|
@@ -288,7 +288,7 @@ If multiple caches share the same key they might "fight" for each other's style
|
|
|
288
288
|
gap: var(--spacing-xs);
|
|
289
289
|
`,UDe=P.default(ip)`
|
|
290
290
|
width: 100%;
|
|
291
|
-
`;function vk({input:t,onSave:e,onCancel:r,...n}){const[i,o]=k.useState(!!t.isSecret),s=({name:a,value:l})=>{e({...t,name:a,value:l,isSecret:i})};return f.jsx(Ere,{variable:t,onSave:s,onCancel:r,maskValue:i,...n,children:f.jsx(iO,{children:f.jsx(Bte,{value:i,onChange:a=>o(a),title:"Make it secret"})})})}const j1=()=>({name:"",value:"",isSecret:!1}),zn=t=>KY+"$inputs."+t+kN,Are=(t,e)=>e.inputs.find(r=>r.get().name===t.match(`^${ub}$`)?.[1]);function VDe({environments:t,activeEnvironmentId:e}){return t.get().find(n=>n.name===e.get())?.inputs||[]}function Ku(t){const e=new RegExp(ub,"g"),r=new Set;if(!t)return r;for(const[n,i,o]of t.matchAll(e)){const s=i||o;s&&r.add(s)}return r}function zf(t){const e=/^\{?\$inputs\.([^\}\s]+)\}?$/,r=t.match(e);return r?r[1]:null}function Ww(t){const e=new Error(t);return e.source="ulid",e}const AQ="0123456789ABCDEFGHJKMNPQRSTVWXYZ",vv=AQ.length,w9=Math.pow(2,48)-1,FDe=10,BDe=16;function WDe(t){let e=Math.floor(t()*vv);return e===vv&&(e=vv-1),AQ.charAt(e)}function ZDe(t,e){if(isNaN(t))throw new Error(t+" must be a number");if(t>w9)throw Ww("cannot encode time greater than "+w9);if(t<0)throw Ww("time must be positive");if(Number.isInteger(Number(t))===!1)throw Ww("time must be an integer");let r,n="";for(;e>0;e--)r=t%vv,n=AQ.charAt(r)+n,t=(t-r)/vv;return n}function XDe(t,e){let r="";for(;t>0;t--)r=WDe(e)+r;return r}function GDe(t=!1,e){e||(e=typeof window<"u"?window:null);const r=e&&(e.crypto||e.msCrypto);if(r)return()=>{const n=new Uint8Array(1);return r.getRandomValues(n),n[0]/255};try{const n=require("crypto");return()=>n.randomBytes(1).readUInt8()/255}catch{}if(t){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return()=>Math.random()}throw Ww("secure crypto unusable, insecure Math.random not allowed")}function YDe(t){return t||(t=GDe()),function(r){return isNaN(r)&&(r=Date.now()),ZDe(r,FDe)+XDe(BDe,t)}}const Wm=YDe(),HDe=["id","specversion","object","datacontenttype","type","time","origin","env","category","signal","source","subject","subjects","data","actor","requestId","clientIp","organizationId","organizationSlug","projectId","projectSlug","osPlatform","userAgent","sessionId"];function JDe(t){const{type:e,data:r,actor:n,requestId:i,clientIp:o,origin:s,env:a,source:l,organizationId:c,organizationSlug:u,projectId:d,projectSlug:p,category:h="product",signal:m="log",osPlatform:g,userAgent:y,sessionId:v}=t,O=!!(r&&Array.isArray(r)),b=n?{id:n.id??`ann_${Wm()}`,object:n.object??"user",uri:n.uri??""}:null,x=`evt_${Wm()}`.toLowerCase(),w=new Date,_=l??b?.uri??null,S={...c!==void 0&&{organizationId:c},...u!==void 0&&{organizationSlug:u},...d!==void 0&&{projectId:d},...p!==void 0&&{projectSlug:p}},$={specversion:"1.0",object:"event",datacontenttype:"application/json; charset=utf-8",origin:s,env:a,category:h,signal:m,osPlatform:g,userAgent:y,clientIp:o,sessionId:v};if(O){const E=r,N=E.map(L=>({id:L.id??"",object:L.object??"",uri:L.uri??""})),R=E[0]?.id??null;Object.assign($,{...S,id:x,type:e,time:w,source:_,actor:b,subject:R,subjects:N,data:E,requestId:i??""})}else{const E=(Array.isArray(r)?r[0]:r)?.id??null;Object.assign($,{...S,id:x,type:e,time:w,source:_,actor:b,subject:E,requestId:i??"",data:r,...l!=null&&{request:{source:l}}})}return $}var KDe=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},Mp="1.9.0",S9=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function e5e(t){var e=new Set([t]),r=new Set,n=t.match(S9);if(!n)return function(){return!1};var i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(l){return l===t};function o(a){return r.add(a),!1}function s(a){return e.add(a),!0}return function(l){if(e.has(l))return!0;if(r.has(l))return!1;var c=l.match(S9);if(!c)return o(l);var u={major:+c[1],minor:+c[2],patch:+c[3],prerelease:c[4]};return u.prerelease!=null||i.major!==u.major?o(l):i.major===0?i.minor===u.minor&&i.patch<=u.patch?s(l):o(l):i.minor<=u.minor?s(l):o(l)}}var t5e=e5e(Mp),r5e=Mp.split(".")[0],uO=Symbol.for("opentelemetry.js.api."+r5e),dO=KDe;function wb(t,e,r,n){var i;n===void 0&&(n=!1);var o=dO[uO]=(i=dO[uO])!==null&&i!==void 0?i:{version:Mp};if(!n&&o[t]){var s=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return r.error(s.stack||s.message),!1}if(o.version!==Mp){var s=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+t+" does not match previously registered API v"+Mp);return r.error(s.stack||s.message),!1}return o[t]=e,r.debug("@opentelemetry/api: Registered a global for "+t+" v"+Mp+"."),!0}function cf(t){var e,r,n=(e=dO[uO])===null||e===void 0?void 0:e.version;if(!(!n||!t5e(n)))return(r=dO[uO])===null||r===void 0?void 0:r[t]}function Sb(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+Mp+".");var r=dO[uO];r&&delete r[t]}var n5e=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},i5e=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))},o5e=(function(){function t(e){this._namespace=e.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xy("debug",this._namespace,e)},t.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xy("error",this._namespace,e)},t.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xy("info",this._namespace,e)},t.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xy("warn",this._namespace,e)},t.prototype.verbose=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xy("verbose",this._namespace,e)},t})();function xy(t,e,r){var n=cf("diag");if(n)return r.unshift(e),n[t].apply(n,i5e([],n5e(r),!1))}var Ks;(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(Ks||(Ks={}));function s5e(t,e){t<Ks.NONE?t=Ks.NONE:t>Ks.ALL&&(t=Ks.ALL),e=e||{};function r(n,i){var o=e[n];return typeof o=="function"&&t>=i?o.bind(e):function(){}}return{error:r("error",Ks.ERROR),warn:r("warn",Ks.WARN),info:r("info",Ks.INFO),debug:r("debug",Ks.DEBUG),verbose:r("verbose",Ks.VERBOSE)}}var a5e=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},l5e=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))},c5e="diag",Dc=(function(){function t(){function e(i){return function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=cf("diag");if(a)return a[i].apply(a,l5e([],a5e(o),!1))}}var r=this,n=function(i,o){var s,a,l;if(o===void 0&&(o={logLevel:Ks.INFO}),i===r){var c=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((s=c.stack)!==null&&s!==void 0?s:c.message),!1}typeof o=="number"&&(o={logLevel:o});var u=cf("diag"),d=s5e((a=o.logLevel)!==null&&a!==void 0?a:Ks.INFO,i);if(u&&!o.suppressOverrideMessage){var p=(l=new Error().stack)!==null&&l!==void 0?l:"<failed to generate stacktrace>";u.warn("Current logger will be overwritten from "+p),d.warn("Current logger will overwrite one already registered from "+p)}return wb("diag",d,r,!0)};r.setLogger=n,r.disable=function(){Sb(c5e,r)},r.createComponentLogger=function(i){return new o5e(i)},r.verbose=e("verbose"),r.debug=e("debug"),r.info=e("info"),r.warn=e("warn"),r.error=e("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t})(),u5e=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},d5e=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},p5e=(function(){function t(e){this._entries=e?new Map(e):new Map}return t.prototype.getEntry=function(e){var r=this._entries.get(e);if(r)return Object.assign({},r)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var r=u5e(e,2),n=r[0],i=r[1];return[n,i]})},t.prototype.setEntry=function(e,r){var n=new t(this._entries);return n._entries.set(e,r),n},t.prototype.removeEntry=function(e){var r=new t(this._entries);return r._entries.delete(e),r},t.prototype.removeEntries=function(){for(var e,r,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=new t(this._entries);try{for(var s=d5e(n),a=s.next();!a.done;a=s.next()){var l=a.value;o._entries.delete(l)}}catch(c){e={error:c}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return o},t.prototype.clear=function(){return new t},t})(),f5e=Symbol("BaggageEntryMetadata"),h5e=Dc.instance();function m5e(t){return t===void 0&&(t={}),new p5e(new Map(Object.entries(t)))}function g5e(t){return typeof t!="string"&&(h5e.error("Cannot create baggage metadata from unknown type: "+typeof t),t=""),{__TYPE__:f5e,toString:function(){return t}}}function RQ(t){return Symbol.for(t)}var y5e=(function(){function t(e){var r=this;r._currentContext=e?new Map(e):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,i){var o=new t(r._currentContext);return o._currentContext.set(n,i),o},r.deleteValue=function(n){var i=new t(r._currentContext);return i._currentContext.delete(n),i}}return t})(),Wh=new y5e,Uf=(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),v5e=(function(){function t(){}return t.prototype.createGauge=function(e,r){return P5e},t.prototype.createHistogram=function(e,r){return T5e},t.prototype.createCounter=function(e,r){return k5e},t.prototype.createUpDownCounter=function(e,r){return I5e},t.prototype.createObservableGauge=function(e,r){return E5e},t.prototype.createObservableCounter=function(e,r){return $5e},t.prototype.createObservableUpDownCounter=function(e,r){return A5e},t.prototype.addBatchObservableCallback=function(e,r){},t.prototype.removeBatchObservableCallback=function(e){},t})(),Ok=(function(){function t(){}return t})(),O5e=(function(t){Uf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.add=function(r,n){},e})(Ok),b5e=(function(t){Uf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.add=function(r,n){},e})(Ok),x5e=(function(t){Uf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.record=function(r,n){},e})(Ok),w5e=(function(t){Uf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.record=function(r,n){},e})(Ok),jQ=(function(){function t(){}return t.prototype.addCallback=function(e){},t.prototype.removeCallback=function(e){},t})(),S5e=(function(t){Uf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(jQ),_5e=(function(t){Uf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(jQ),C5e=(function(t){Uf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(jQ),Rre=new v5e,k5e=new O5e,P5e=new x5e,T5e=new w5e,I5e=new b5e,$5e=new S5e,E5e=new _5e,A5e=new C5e;function R5e(){return Rre}var j5e={get:function(t,e){if(t!=null)return t[e]},keys:function(t){return t==null?[]:Object.keys(t)}},N5e={set:function(t,e,r){t!=null&&(t[e]=r)}},Q5e=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},M5e=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))},D5e=(function(){function t(){}return t.prototype.active=function(){return Wh},t.prototype.with=function(e,r,n){for(var i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return r.call.apply(r,M5e([n],Q5e(i),!1))},t.prototype.bind=function(e,r){return r},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t})(),L5e=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},q5e=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))},mI="context",z5e=new D5e,bk=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(e){return wb(mI,e,Dc.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(e,r,n){for(var i,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return(i=this._getContextManager()).with.apply(i,q5e([e,r,n],L5e(o),!1))},t.prototype.bind=function(e,r){return this._getContextManager().bind(e,r)},t.prototype._getContextManager=function(){return cf(mI)||z5e},t.prototype.disable=function(){this._getContextManager().disable(),Sb(mI,Dc.instance())},t})(),Au;(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(Au||(Au={}));var jre="0000000000000000",Nre="00000000000000000000000000000000",Qre={traceId:Nre,spanId:jre,traceFlags:Au.NONE},Ov=(function(){function t(e){e===void 0&&(e=Qre),this._spanContext=e}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(e,r){return this},t.prototype.setAttributes=function(e){return this},t.prototype.addEvent=function(e,r){return this},t.prototype.addLink=function(e){return this},t.prototype.addLinks=function(e){return this},t.prototype.setStatus=function(e){return this},t.prototype.updateName=function(e){return this},t.prototype.end=function(e){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(e,r){},t})(),NQ=RQ("OpenTelemetry Context Key SPAN");function QQ(t){return t.getValue(NQ)||void 0}function U5e(){return QQ(bk.getInstance().active())}function MQ(t,e){return t.setValue(NQ,e)}function V5e(t){return t.deleteValue(NQ)}function F5e(t,e){return MQ(t,new Ov(e))}function Mre(t){var e;return(e=QQ(t))===null||e===void 0?void 0:e.spanContext()}var B5e=/^([0-9a-f]{32})$/i,W5e=/^[0-9a-f]{16}$/i;function Dre(t){return B5e.test(t)&&t!==Nre}function Z5e(t){return W5e.test(t)&&t!==jre}function xk(t){return Dre(t.traceId)&&Z5e(t.spanId)}function X5e(t){return new Ov(t)}var gI=bk.getInstance(),Lre=(function(){function t(){}return t.prototype.startSpan=function(e,r,n){n===void 0&&(n=gI.active());var i=!!r?.root;if(i)return new Ov;var o=n&&Mre(n);return G5e(o)&&xk(o)?new Ov(o):new Ov},t.prototype.startActiveSpan=function(e,r,n,i){var o,s,a;if(!(arguments.length<2)){arguments.length===2?a=r:arguments.length===3?(o=r,a=n):(o=r,s=n,a=i);var l=s??gI.active(),c=this.startSpan(e,o,l),u=MQ(l,c);return gI.with(u,a,void 0,c)}},t})();function G5e(t){return typeof t=="object"&&typeof t.spanId=="string"&&typeof t.traceId=="string"&&typeof t.traceFlags=="number"}var Y5e=new Lre,H5e=(function(){function t(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}return t.prototype.startSpan=function(e,r,n){return this._getTracer().startSpan(e,r,n)},t.prototype.startActiveSpan=function(e,r,n,i){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Y5e},t})(),J5e=(function(){function t(){}return t.prototype.getTracer=function(e,r,n){return new Lre},t})(),K5e=new J5e,_9=(function(){function t(){}return t.prototype.getTracer=function(e,r,n){var i;return(i=this.getDelegateTracer(e,r,n))!==null&&i!==void 0?i:new H5e(this,e,r,n)},t.prototype.getDelegate=function(){var e;return(e=this._delegate)!==null&&e!==void 0?e:K5e},t.prototype.setDelegate=function(e){this._delegate=e},t.prototype.getDelegateTracer=function(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(e,r,n)},t})(),N1;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(N1||(N1={}));var JA;(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(JA||(JA={}));exports.SpanStatusCode=void 0;(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(exports.SpanStatusCode||(exports.SpanStatusCode={}));var wl=bk.getInstance(),Ht=Dc.instance(),eLe=(function(){function t(){}return t.prototype.getMeter=function(e,r,n){return Rre},t})(),tLe=new eLe,yI="metrics",rLe=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(e){return wb(yI,e,Dc.instance())},t.prototype.getMeterProvider=function(){return cf(yI)||tLe},t.prototype.getMeter=function(e,r,n){return this.getMeterProvider().getMeter(e,r,n)},t.prototype.disable=function(){Sb(yI,Dc.instance())},t})(),qre=rLe.getInstance(),nLe=(function(){function t(){}return t.prototype.inject=function(e,r){},t.prototype.extract=function(e,r){return e},t.prototype.fields=function(){return[]},t})(),DQ=RQ("OpenTelemetry Baggage Key");function zre(t){return t.getValue(DQ)||void 0}function iLe(){return zre(bk.getInstance().active())}function oLe(t,e){return t.setValue(DQ,e)}function sLe(t){return t.deleteValue(DQ)}var vI="propagation",aLe=new nLe,lLe=(function(){function t(){this.createBaggage=m5e,this.getBaggage=zre,this.getActiveBaggage=iLe,this.setBaggage=oLe,this.deleteBaggage=sLe}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(e){return wb(vI,e,Dc.instance())},t.prototype.inject=function(e,r,n){return n===void 0&&(n=N5e),this._getGlobalPropagator().inject(e,r,n)},t.prototype.extract=function(e,r,n){return n===void 0&&(n=j5e),this._getGlobalPropagator().extract(e,r,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){Sb(vI,Dc.instance())},t.prototype._getGlobalPropagator=function(){return cf(vI)||aLe},t})(),bv=lLe.getInstance(),OI="trace",cLe=(function(){function t(){this._proxyTracerProvider=new _9,this.wrapSpanContext=X5e,this.isSpanContextValid=xk,this.deleteSpan=V5e,this.getSpan=QQ,this.getActiveSpan=U5e,this.getSpanContext=Mre,this.setSpan=MQ,this.setSpanContext=F5e}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(e){var r=wb(OI,this._proxyTracerProvider,Dc.instance());return r&&this._proxyTracerProvider.setDelegate(e),r},t.prototype.getTracerProvider=function(){return cf(OI)||this._proxyTracerProvider},t.prototype.getTracer=function(e,r){return this.getTracerProvider().getTracer(e,r)},t.prototype.disable=function(){Sb(OI,Dc.instance()),this._proxyTracerProvider=new _9},t})(),ns=cLe.getInstance();const Ure=RQ("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function uLe(t){return t.setValue(Ure,!0)}function LQ(t){return t.getValue(Ure)===!0}const dLe="=",Vre=";",KA=",",bI="baggage",pLe=180,fLe=4096,hLe=8192;function mLe(t){return t.reduce((e,r)=>{const n=`${e}${e!==""?KA:""}${r}`;return n.length>hLe?e:n},"")}function gLe(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=Vre+r.metadata.toString()),n})}function yLe(t){if(!t)return;const e=t.indexOf(Vre),r=e===-1?t:t.substring(0,e),n=r.indexOf(dLe);if(n<=0)return;const i=r.substring(0,n).trim(),o=r.substring(n+1).trim();if(!i||!o)return;let s,a;try{s=decodeURIComponent(i),a=decodeURIComponent(o)}catch{return}let l;if(e!==-1&&e<t.length-1){const c=t.substring(e+1);l=g5e(c)}return{key:s,value:a,metadata:l}}class vLe{inject(e,r,n){const i=bv.getBaggage(e);if(!i||LQ(e))return;const o=gLe(i).filter(a=>a.length<=fLe).slice(0,pLe),s=mLe(o);s.length>0&&n.set(r,bI,s)}extract(e,r,n){const i=n.get(r,bI),o=Array.isArray(i)?i.join(KA):i;if(!o)return e;const s={};return o.length===0||(o.split(KA).forEach(l=>{const c=yLe(l);if(c){const u={value:c.value};c.metadata&&(u.metadata=c.metadata),s[c.key]=u}}),Object.entries(s).length===0)?e:bv.setBaggage(e,bv.createBaggage(s))}fields(){return[bI]}}function xv(t){const e={};if(typeof t!="object"||t==null)return e;for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!OLe(r)){Ht.warn(`Invalid attribute key: ${r}`);continue}const n=t[r];if(!Fre(n)){Ht.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}function OLe(t){return typeof t=="string"&&t!==""}function Fre(t){return t==null?!0:Array.isArray(t)?bLe(t):Bre(typeof t)}function bLe(t){let e;for(const r of t){if(r==null)continue;const n=typeof r;if(n!==e){if(!e){if(Bre(n)){e=n;continue}return!1}return!1}}return!0}function Bre(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}function xLe(){return t=>{Ht.error(wLe(t))}}function wLe(t){return typeof t=="string"?t:JSON.stringify(SLe(t))}function SLe(t){const e={};let r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;const i=r[n];i&&(e[n]=String(i))}),r=Object.getPrototypeOf(r);return e}let _Le=xLe();function Zm(t){try{_Le(t)}catch{}}const CLe="2.6.1",xI="exception.message",kLe="exception.stacktrace",wI="exception.type",Wre="service.name",PLe="service.version",eR="telemetry.sdk.language",TLe="webjs",tR="telemetry.sdk.name",rR="telemetry.sdk.version",ILe="process.runtime.name",SI={[tR]:"opentelemetry",[ILe]:"browser",[eR]:TLe,[rR]:CLe},am=performance,$Le=9,ELe=6,ALe=Math.pow(10,ELe),Q1=Math.pow(10,$Le);function lm(t){const e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*ALe);return[r,n]}function RLe(t){const e=lm(am.timeOrigin),r=lm(typeof t=="number"?t:am.now());return Xre(e,r)}function jLe(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=Q1),[r,n]}function NLe(t){return t[0]*Q1+t[1]}function Zre(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}function C9(t){return Zre(t)||typeof t=="number"||t instanceof Date}function Xre(t,e){const r=[t[0]+e[0],t[1]+e[1]];return r[1]>=Q1&&(r[1]-=Q1,r[0]+=1),r}var dc;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(dc||(dc={}));class QLe{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(e,r,n){for(const i of this._propagators)try{i.inject(e,r,n)}catch(o){Ht.warn(`Failed to inject with ${i.constructor.name}. Err: ${o.message}`)}}extract(e,r,n){return this._propagators.reduce((i,o)=>{try{return o.extract(i,r,n)}catch(s){Ht.warn(`Failed to extract with ${o.constructor.name}. Err: ${s.message}`)}return i},e)}fields(){return this._fields.slice()}}const nR="[_0-9a-z-*/]",MLe=`[a-z]${nR}{0,255}`,DLe=`[a-z0-9]${nR}{0,240}@[a-z]${nR}{0,13}`,LLe=new RegExp(`^(?:${MLe}|${DLe})$`),qLe=/^[ -~]{0,255}[!-~]$/,zLe=/,|=/;function ULe(t){return LLe.test(t)}function VLe(t){return qLe.test(t)&&!zLe.test(t)}const k9=32,FLe=512,P9=",",T9="=";class qQ{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,r){const n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n}unset(e){const r=this._clone();return r._internalState.delete(e),r}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,r)=>(e.push(r+T9+this.get(r)),e),[]).join(P9)}_parse(e){e.length>FLe||(this._internalState=e.split(P9).reverse().reduce((r,n)=>{const i=n.trim(),o=i.indexOf(T9);if(o!==-1){const s=i.slice(0,o),a=i.slice(o+1,n.length);ULe(s)&&VLe(a)&&r.set(s,a)}return r},new Map),this._internalState.size>k9&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,k9))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const e=new qQ;return e._internalState=new Map(this._internalState),e}}const _I="traceparent",CI="tracestate",BLe="00",WLe="(?!ff)[\\da-f]{2}",ZLe="(?![0]{32})[\\da-f]{32}",XLe="(?![0]{16})[\\da-f]{16}",GLe="[\\da-f]{2}",YLe=new RegExp(`^\\s?(${WLe})-(${ZLe})-(${XLe})-(${GLe})(-.*)?\\s?$`);function HLe(t){const e=YLe.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}class JLe{inject(e,r,n){const i=ns.getSpanContext(e);if(!i||LQ(e)||!xk(i))return;const o=`${BLe}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||Au.NONE).toString(16)}`;n.set(r,_I,o),i.traceState&&n.set(r,CI,i.traceState.serialize())}extract(e,r,n){const i=n.get(r,_I);if(!i)return e;const o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;const s=HLe(o);if(!s)return e;s.isRemote=!0;const a=n.get(r,CI);if(a){const l=Array.isArray(a)?a.join(","):a;s.traceState=new qQ(typeof l=="string"?l:void 0)}return ns.setSpanContext(e,s)}fields(){return[_I,CI]}}const KLe="[object Object]",eqe="[object Null]",tqe="[object Undefined]",rqe=Function.prototype,Gre=rqe.toString,nqe=Gre.call(Object),iqe=Object.getPrototypeOf,Yre=Object.prototype,Hre=Yre.hasOwnProperty,$p=Symbol?Symbol.toStringTag:void 0,Jre=Yre.toString;function I9(t){if(!oqe(t)||sqe(t)!==KLe)return!1;const e=iqe(t);if(e===null)return!0;const r=Hre.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Gre.call(r)===nqe}function oqe(t){return t!=null&&typeof t=="object"}function sqe(t){return t==null?t===void 0?tqe:eqe:$p&&$p in Object(t)?aqe(t):lqe(t)}function aqe(t){const e=Hre.call(t,$p),r=t[$p];let n=!1;try{t[$p]=void 0,n=!0}catch{}const i=Jre.call(t);return n&&(e?t[$p]=r:delete t[$p]),i}function lqe(t){return Jre.call(t)}const cqe=20;function uqe(...t){let e=t.shift();const r=new WeakMap;for(;t.length>0;)e=Kre(e,t.shift(),0,r);return e}function kI(t){return M1(t)?t.slice():t}function Kre(t,e,r=0,n){let i;if(!(r>cqe)){if(r++,Zw(t)||Zw(e)||ene(e))i=kI(e);else if(M1(t)){if(i=t.slice(),M1(e))for(let o=0,s=e.length;o<s;o++)i.push(kI(e[o]));else if(wy(e)){const o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){const l=o[s];i[l]=kI(e[l])}}}else if(wy(t))if(wy(e)){if(!dqe(t,e))return e;i=Object.assign({},t);const o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){const l=o[s],c=e[l];if(Zw(c))typeof c>"u"?delete i[l]:i[l]=c;else{const u=i[l],d=c;if($9(t,l,n)||$9(e,l,n))delete i[l];else{if(wy(u)&&wy(d)){const p=n.get(u)||[],h=n.get(d)||[];p.push({obj:t,key:l}),h.push({obj:e,key:l}),n.set(u,p),n.set(d,h)}i[l]=Kre(i[l],c,r,n)}}}}else i=e;return i}}function $9(t,e,r){const n=r.get(t[e])||[];for(let i=0,o=n.length;i<o;i++){const s=n[i];if(s.key===e&&s.obj===t)return!0}return!1}function M1(t){return Array.isArray(t)}function ene(t){return typeof t=="function"}function wy(t){return!Zw(t)&&!M1(t)&&!ene(t)&&typeof t=="object"}function Zw(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function dqe(t,e){return!(!I9(t)||!I9(e))}class pqe{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class fqe{_isCalled=!1;_deferred=new pqe;_callback;_that;constructor(e,r){this._callback=e,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}}let A0;function hqe(){if(A0===void 0)try{const t=globalThis.process.argv0;A0=t?`unknown_service:${t}`:"unknown_service"}catch{A0="unknown_service"}return A0}const Gy=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";class D1{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){const n=new D1({},r);return n._rawAttributes=E9(e),n._asyncAttributesPending=e.filter(([i,o])=>Gy(o)).length>0,n}constructor(e,r){const n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([i,o])=>(Gy(o)&&(this._asyncAttributesPending=!0),[i,o])),this._rawAttributes=E9(this._rawAttributes),this._schemaUrl=gqe(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){const[r,n]=this._rawAttributes[e];this._rawAttributes[e]=[r,Gy(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Ht.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const e={};for(const[r,n]of this._rawAttributes){if(Gy(n)){Ht.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(e[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;const r=yqe(this,e),n=r?{schemaUrl:r}:void 0;return D1.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}}function tne(t,e){return D1.FromAttributeList(Object.entries(t),e)}function mqe(){return tne({[Wre]:hqe(),[eR]:SI[eR],[tR]:SI[tR],[rR]:SI[rR]})}function E9(t){return t.map(([e,r])=>Gy(r)?[e,r.catch(n=>{Ht.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function gqe(t){if(typeof t=="string"||t===void 0)return t;Ht.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function yqe(t,e){const r=t?.schemaUrl,n=e?.schemaUrl,i=r===void 0||r==="",o=n===void 0||n==="";if(i)return n;if(o||r===n)return r;Ht.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}const vqe="exception";class Oqe{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:exports.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){const r=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=am.now(),this._performanceOffset=r-(this._performanceStartTime+am.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(const n of e.links)this.addLink(n);this.startTime=this._getTime(e.startTime??r),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,r){if(r==null||this._isSpanEnded())return this;if(e.length===0)return Ht.warn(`Invalid attribute key: ${e}`),this;if(!Fre(r))return Ht.warn(`Invalid attribute value set for key: ${e}`),this;const{attributeCountLimit:n}=this._spanLimits,i=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&i?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(r),i&&this._attributesCount++,this)}setAttributes(e){for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.setAttribute(r,e[r]);return this}addEvent(e,r,n){if(this._isSpanEnded())return this;const{eventCountLimit:i}=this._spanLimits;if(i===0)return Ht.warn("No events allowed."),this._droppedEventsCount++,this;i!==void 0&&this.events.length>=i&&(this._droppedEventsCount===0&&Ht.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),C9(r)&&(C9(n)||(n=r),r=void 0);const o=xv(r),{attributePerEventCountLimit:s}=this._spanLimits,a={};let l=0,c=0;for(const u in o){if(!Object.prototype.hasOwnProperty.call(o,u))continue;const d=o[u];if(s!==void 0&&c>=s){l++;continue}a[u]=this._truncateToSize(d),c++}return this.events.push({name:e,attributes:a,time:this._getTime(n),droppedAttributesCount:l}),this}addLink(e){if(this._isSpanEnded())return this;const{linkCountLimit:r}=this._spanLimits;if(r===0)return this._droppedLinksCount++,this;r!==void 0&&this.links.length>=r&&(this._droppedLinksCount===0&&Ht.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);const{attributePerLinkCountLimit:n}=this._spanLimits,i=xv(e.attributes),o={};let s=0,a=0;for(const c in i){if(!Object.prototype.hasOwnProperty.call(i,c))continue;const u=i[c];if(n!==void 0&&a>=n){s++;continue}o[c]=this._truncateToSize(u),a++}const l={context:e.context};return a>0&&(l.attributes=o),s>0&&(l.droppedAttributesCount=s),this.links.push(l),this}addLinks(e){for(const r of e)this.addLink(r);return this}setStatus(e){if(this._isSpanEnded())return this;if(e.code===exports.SpanStatusCode.UNSET)return this;if(this.status.code===exports.SpanStatusCode.OK)return this;const r={code:e.code};return e.code===exports.SpanStatusCode.ERROR&&(typeof e.message=="string"?r.message=e.message:e.message!=null&&Ht.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=r,this}updateName(e){return this._isSpanEnded()?this:(this.name=e,this)}end(e){if(this._isSpanEnded()){Ht.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=jLe(this.startTime,this.endTime),this._duration[0]<0&&(Ht.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&Ht.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&Ht.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e=="number"&&e<=am.now())return RLe(e+this._performanceOffset);if(typeof e=="number")return lm(e);if(e instanceof Date)return lm(e.getTime());if(Zre(e))return e;if(this._startTimeProvided)return lm(Date.now());const r=am.now()-this._performanceStartTime;return Xre(this.startTime,lm(r))}isRecording(){return this._ended===!1}recordException(e,r){const n={};typeof e=="string"?n[xI]=e:e&&(e.code?n[wI]=e.code.toString():e.name&&(n[wI]=e.name),e.message&&(n[xI]=e.message),e.stack&&(n[kLe]=e.stack)),n[wI]||n[xI]?this.addEvent(vqe,n,r):Ht.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){const e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);Ht.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,r){return e.length<=r?e:e.substring(0,r)}_truncateToSize(e){const r=this._attributeValueLengthLimit;return r<=0?(Ht.warn(`Attribute value limit must be positive, got ${r}`),e):typeof e=="string"?this._truncateToLimitUtil(e,r):Array.isArray(e)?e.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):e}}var Ec;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(Ec||(Ec={}));class L1{shouldSample(){return{decision:Ec.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class Sm{shouldSample(){return{decision:Ec.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class R0{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(Zm(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new Sm),this._remoteParentSampled=e.remoteParentSampled??new Sm,this._remoteParentNotSampled=e.remoteParentNotSampled??new L1,this._localParentSampled=e.localParentSampled??new Sm,this._localParentNotSampled=e.localParentNotSampled??new L1}shouldSample(e,r,n,i,o,s){const a=ns.getSpanContext(e);return!a||!xk(a)?this._root.shouldSample(e,r,n,i,o,s):a.isRemote?a.traceFlags&Au.SAMPLED?this._remoteParentSampled.shouldSample(e,r,n,i,o,s):this._remoteParentNotSampled.shouldSample(e,r,n,i,o,s):a.traceFlags&Au.SAMPLED?this._localParentSampled.shouldSample(e,r,n,i,o,s):this._localParentNotSampled.shouldSample(e,r,n,i,o,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class A9{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,r){return{decision:Dre(r)&&this._accumulate(r)<this._upperBound?Ec.RECORD_AND_SAMPLED:Ec.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!="number"||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let r=0;for(let n=0;n<e.length/8;n++){const i=n*8,o=parseInt(e.slice(i,i+8),16);r=(r^o)>>>0}return r}}var sc;(function(t){t.AlwaysOff="always_off",t.AlwaysOn="always_on",t.ParentBasedAlwaysOff="parentbased_always_off",t.ParentBasedAlwaysOn="parentbased_always_on",t.ParentBasedTraceIdRatio="parentbased_traceidratio",t.TraceIdRatio="traceidratio"})(sc||(sc={}));const R9=1;function rne(){return{sampler:nne(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function nne(){const t=sc.ParentBasedAlwaysOn;switch(t){case sc.AlwaysOn:return new Sm;case sc.AlwaysOff:return new L1;case sc.ParentBasedAlwaysOn:return new R0({root:new Sm});case sc.ParentBasedAlwaysOff:return new R0({root:new L1});case sc.TraceIdRatio:return new A9(j9());case sc.ParentBasedTraceIdRatio:return new R0({root:new A9(j9())});default:return Ht.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${sc.ParentBasedAlwaysOn}".`),new R0({root:new Sm})}}function j9(){return Ht.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${R9}.`),R9}const bqe=128,xqe=1/0;function wqe(t){const e={sampler:nne()},r=rne(),n=Object.assign({},r,e,t);return n.generalLimits=Object.assign({},r.generalLimits,t.generalLimits||{}),n.spanLimits=Object.assign({},r.spanLimits,t.spanLimits||{}),n}function Sqe(t){const e=Object.assign({},t.spanLimits);return e.attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??void 0??void 0??bqe,e.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??void 0??void 0??xqe,Object.assign({},t,{spanLimits:e})}class _qe{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,r){this._exporter=e,this._maxExportBatchSize=typeof r?.maxExportBatchSize=="number"?r.maxExportBatchSize:512,this._maxQueueSize=typeof r?.maxQueueSize=="number"?r.maxQueueSize:2048,this._scheduledDelayMillis=typeof r?.scheduledDelayMillis=="number"?r.scheduledDelayMillis:5e3,this._exportTimeoutMillis=typeof r?.exportTimeoutMillis=="number"?r.exportTimeoutMillis:3e4,this._shutdownOnce=new fqe(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(Ht.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,r){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&Au.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&Ht.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(Ht.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,r)=>{const n=[],i=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let o=0,s=i;o<s;o++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,r)=>{const n=setTimeout(()=>{r(new Error("Timeout"))},this._exportTimeoutMillis);wl.with(uLe(wl.active()),()=>{let i;this._finishedSpans.length<=this._maxExportBatchSize?(i=this._finishedSpans,this._finishedSpans=[]):i=this._finishedSpans.splice(0,this._maxExportBatchSize);const o=()=>this._exporter.export(i,a=>{clearTimeout(n),a.code===dc.SUCCESS?e():r(a.error??new Error("BatchSpanProcessor: span export failed"))});let s=null;for(let a=0,l=i.length;a<l;a++){const c=i[a];c.resource.asyncAttributesPending&&c.resource.waitForAsyncAttributes&&(s??=[],s.push(c.resource.waitForAsyncAttributes()))}s===null?o():Promise.all(s).then(o,a=>{Zm(a),r(a)})})})}_maybeStartTimer(){if(this._isExporting)return;const e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,Zm(r)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}class Cqe extends _qe{_visibilityChangeListener;_pageHideListener;constructor(e,r){super(e,r),this.onInit(r)}onInit(e){e?.disableAutoFlushOnDocumentHide!==!0&&typeof document<"u"&&(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush().catch(r=>{Zm(r)})},this._pageHideListener=()=>{this.forceFlush().catch(r=>{Zm(r)})},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){typeof document<"u"&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}}const kqe=16,Pqe=8,N9=new Uint8Array(kqe),Q9=new Uint8Array(Pqe),Tqe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function M9(t){for(let e=0;e<t.length;e++)t[e]=Math.random()*256>>>0;for(let e=0;e<t.length;e++)if(t[e]>0)return;t[t.length-1]=1}function D9(t){let e="";for(let r=0;r<t.length;r++)e+=Tqe[t[r]];return e}class Iqe{generateTraceId(){return M9(N9),D9(N9)}generateSpanId(){return M9(Q9),D9(Q9)}}const $qe="otel.span.parent.origin",L9="otel.span.sampling_result",Eqe="otel.sdk.span.live",Aqe="otel.sdk.span.started";class Rqe{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(Aqe,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter(Eqe,{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,r){const n=Nqe(r);if(this.startedSpans.add(1,{[$qe]:jqe(e),[L9]:n}),r===Ec.NOT_RECORD)return()=>{};const i={[L9]:n};return this.liveSpans.add(1,i),()=>{this.liveSpans.add(-1,i)}}}function jqe(t){return t?t.isRemote?"remote":"local":"none"}function Nqe(t){switch(t){case Ec.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case Ec.RECORD:return"RECORD_ONLY";case Ec.NOT_RECORD:return"DROP"}}const Qqe="2.6.1";class Mqe{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,r,n,i){const o=wqe(r);this._sampler=o.sampler,this._generalLimits=o.generalLimits,this._spanLimits=o.spanLimits,this._idGenerator=r.idGenerator||new Iqe,this._resource=n,this._spanProcessor=i,this.instrumentationScope=e;const s=o.meterProvider?o.meterProvider.getMeter("@opentelemetry/sdk-trace",Qqe):R5e();this._tracerMetrics=new Rqe(s)}startSpan(e,r={},n=wl.active()){r.root&&(n=ns.deleteSpan(n));const i=ns.getSpan(n);if(LQ(n))return Ht.debug("Instrumentation suppressed, returning Noop Span"),ns.wrapSpanContext(Qre);const o=i?.spanContext(),s=this._idGenerator.generateSpanId();let a,l,c;!o||!ns.isSpanContextValid(o)?l=this._idGenerator.generateTraceId():(l=o.traceId,c=o.traceState,a=o);const u=r.kind??JA.INTERNAL,d=(r.links??[]).map(b=>({context:b.context,attributes:xv(b.attributes)})),p=xv(r.attributes),h=this._sampler.shouldSample(n,l,e,u,p,d),m=this._tracerMetrics.startSpan(o,h.decision);c=h.traceState??c;const g=h.decision===N1.RECORD_AND_SAMPLED?Au.SAMPLED:Au.NONE,y={traceId:l,spanId:s,traceFlags:g,traceState:c};if(h.decision===N1.NOT_RECORD)return Ht.debug("Recording is off, propagating context in a non-recording span"),ns.wrapSpanContext(y);const v=xv(Object.assign(p,h.attributes));return new Oqe({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:y,name:e,kind:u,links:d,parentSpanContext:a,attributes:v,startTime:r.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:m})}startActiveSpan(e,r,n,i){let o,s,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(o=r,a=n):(o=r,s=n,a=i);const l=s??wl.active(),c=this.startSpan(e,o,l),u=ns.setSpan(l,c);return wl.with(u,a,void 0,c)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class Dqe{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){const e=[];for(const r of this._spanProcessors)e.push(r.forceFlush());return new Promise(r=>{Promise.all(e).then(()=>{r()}).catch(n=>{Zm(n||new Error("MultiSpanProcessor: forceFlush failed")),r()})})}onStart(e,r){for(const n of this._spanProcessors)n.onStart(e,r)}onEnding(e){for(const r of this._spanProcessors)r.onEnding&&r.onEnding(e)}onEnd(e){for(const r of this._spanProcessors)r.onEnd(e)}shutdown(){const e=[];for(const r of this._spanProcessors)e.push(r.shutdown());return new Promise((r,n)=>{Promise.all(e).then(()=>{r()},n)})}}var Ep;(function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"})(Ep||(Ep={}));class Lqe{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){const r=uqe({},rne(),Sqe(e));this._resource=r.resource??mqe(),this._config=Object.assign({},r,{resource:this._resource});const n=[];e.spanProcessors?.length&&n.push(...e.spanProcessors),this._activeSpanProcessor=new Dqe(n)}getTracer(e,r,n){const i=`${e}@${r||""}:${n?.schemaUrl||""}`;return this._tracers.has(i)||this._tracers.set(i,new Mqe({name:e,version:r,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(i)}forceFlush(){const e=this._config.forceFlushTimeoutMillis,r=this._activeSpanProcessor._spanProcessors.map(n=>new Promise(i=>{let o;const s=setTimeout(()=>{i(new Error(`Span processor did not completed within timeout period of ${e} ms`)),o=Ep.timeout},e);n.forceFlush().then(()=>{clearTimeout(s),o!==Ep.timeout&&(o=Ep.resolved,i(o))}).catch(a=>{clearTimeout(s),o=Ep.error,i(a)})}));return new Promise((n,i)=>{Promise.all(r).then(o=>{const s=o.filter(a=>a!==Ep.resolved);s.length>0?i(s):n()}).catch(o=>i([o]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}class qqe{_enabled=!1;_currentContext=Wh;_bindFunction(e=Wh,r){const n=this,i=function(...o){return n.with(e,()=>r.apply(this,o))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),i}active(){return this._currentContext}bind(e,r){return e===void 0&&(e=this.active()),typeof r=="function"?this._bindFunction(e,r):r}disable(){return this._currentContext=Wh,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=Wh,this)}with(e,r,n,...i){const o=this._currentContext;this._currentContext=e||Wh;try{return r.call(n,...i)}finally{this._currentContext=o}}}function zqe(t){if(t!==null){if(t===void 0){const e=new qqe;e.enable(),wl.setGlobalContextManager(e);return}t.enable(),wl.setGlobalContextManager(t)}}function Uqe(t){if(t!==null){if(t===void 0){bv.setGlobalPropagator(new QLe({propagators:[new JLe,new vLe]}));return}bv.setGlobalPropagator(t)}}class Vqe extends Lqe{constructor(e={}){super(e)}register(e={}){ns.setGlobalTracerProvider(this),Uqe(e.propagator),zqe(e.contextManager)}}class Fqe{_delegate;constructor(e){this._delegate=e}export(e,r){this._delegate.export(e,r)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}class q9 extends Error{code;name="OTLPExporterError";data;constructor(e,r,n){super(e),this.data=n,this.code=r}}function Bqe(t){if(Number.isFinite(t)&&t>0)return t;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${t}')`)}function Wqe(t){if(t!=null)return async()=>t}function Zqe(t,e,r){return{timeoutMillis:Bqe(t.timeoutMillis??e.timeoutMillis??r.timeoutMillis),concurrencyLimit:t.concurrencyLimit??e.concurrencyLimit??r.concurrencyLimit,compression:t.compression??e.compression??r.compression}}function Xqe(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}class Gqe{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(e);const r=()=>{const n=this._sendingPromises.indexOf(e);this._sendingPromises.splice(n,1)};e.then(r,r)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function Yqe(t){return new Gqe(t.concurrencyLimit)}function Hqe(t){return Object.prototype.hasOwnProperty.call(t,"partialSuccess")}function Jqe(){return{handleResponse(t){t==null||!Hqe(t)||t.partialSuccess==null||Object.keys(t.partialSuccess).length===0||Ht.warn("Received Partial Success response:",JSON.stringify(t.partialSuccess))}}}class Kqe{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,r,n,i,o){this._transport=e,this._serializer=r,this._responseHandler=n,this._promiseQueue=i,this._timeout=o,this._diagLogger=Ht.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,r){if(this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()){r({code:dc.FAILED,error:new Error("Concurrent export limit reached")});return}const n=this._serializer.serializeRequest(e);if(n==null){r({code:dc.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(i=>{if(i.status==="success"){if(i.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(i.data))}catch(o){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",o,i.data)}r({code:dc.SUCCESS});return}else if(i.status==="failure"&&i.error){r({code:dc.FAILED,error:i.error});return}else i.status==="retryable"?r({code:dc.FAILED,error:i.error??new q9("Export failed with retryable status")}):r({code:dc.FAILED,error:new q9("Export failed with unknown error")})},i=>r({code:dc.FAILED,error:i})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function e4e(t,e){return new Kqe(t.transport,t.serializer,Jqe(),t.promiseHandler,e.timeout)}function t4e(t,e,r){return e4e({transport:r,serializer:e,promiseHandler:Yqe(t)},{timeout:t.timeoutMillis})}function r4e(t,e){const r={attributes:wk(t.attributes,e),droppedAttributesCount:0},n=t.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function n4e(t){return{name:t.name,version:t.version}}function wk(t,e){return Object.keys(t).map(r=>i4e(r,t[r],e))}function i4e(t,e,r){return{key:t,value:iR(e,r)}}function iR(t,e){const r=typeof t;if(r==="string")return{stringValue:t};if(r==="number")return Number.isInteger(t)?{intValue:t}:{doubleValue:t};if(r==="boolean")return{boolValue:t};if(t instanceof Uint8Array)return{bytesValue:e.encodeUint8Array(t)};if(Array.isArray(t)){const n=new Array(t.length);for(let i=0;i<t.length;i++)n[i]=iR(t[i],e);return{arrayValue:{values:n}}}if(r==="object"&&t!=null){const n=Object.keys(t),i=new Array(n.length);for(let o=0;o<n.length;o++)i[o]={key:n[o],value:iR(t[n[o]],e)};return{kvlistValue:{values:i}}}return{}}function o4e(t){const e=BigInt(1e9);return BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))}function s4e(t){return o4e(t).toString()}const a4e=typeof BigInt<"u"?s4e:NLe;function z9(t){return t}const l4e={encodeHrTime:a4e,encodeSpanContext:z9,encodeOptionalSpanContext:z9,encodeUint8Array:t=>{if(typeof Buffer<"u")return Buffer.from(t).toString("base64");const e=new Array(t.length);for(let r=0;r<t.length;r++)e[r]=String.fromCharCode(t[r]);return btoa(e.join(""))}},c4e=256,u4e=512;function ine(t,e){let r=t&255|c4e;return e&&(r|=u4e),r}function d4e(t,e){const r=t.spanContext(),n=t.status,i=t.parentSpanContext?.spanId?e.encodeSpanContext(t.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(r.traceId),spanId:e.encodeSpanContext(r.spanId),parentSpanId:i,traceState:r.traceState?.serialize(),name:t.name,kind:t.kind==null?0:t.kind+1,startTimeUnixNano:e.encodeHrTime(t.startTime),endTimeUnixNano:e.encodeHrTime(t.endTime),attributes:wk(t.attributes,e),droppedAttributesCount:t.droppedAttributesCount,events:t.events.map(o=>f4e(o,e)),droppedEventsCount:t.droppedEventsCount,status:{code:n.code,message:n.message},links:t.links.map(o=>p4e(o,e)),droppedLinksCount:t.droppedLinksCount,flags:ine(r.traceFlags,t.parentSpanContext?.isRemote)}}function p4e(t,e){return{attributes:t.attributes?wk(t.attributes,e):[],spanId:e.encodeSpanContext(t.context.spanId),traceId:e.encodeSpanContext(t.context.traceId),traceState:t.context.traceState?.serialize(),droppedAttributesCount:t.droppedAttributesCount||0,flags:ine(t.context.traceFlags,t.context.isRemote)}}function f4e(t,e){return{attributes:t.attributes?wk(t.attributes,e):[],name:t.name,timeUnixNano:e.encodeHrTime(t.time),droppedAttributesCount:t.droppedAttributesCount||0}}function h4e(t,e){return{resourceSpans:g4e(t,e)}}function m4e(t){const e=new Map;for(const r of t){let n=e.get(r.resource);n||(n=new Map,e.set(r.resource,n));const i=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`;let o=n.get(i);o||(o=[],n.set(i,o)),o.push(r)}return e}function g4e(t,e){const r=m4e(t),n=[],i=r.entries();let o=i.next();for(;!o.done;){const[s,a]=o.value,l=[],c=a.values();let u=c.next();for(;!u.done;){const h=u.value;if(h.length>0){const m=h.map(g=>d4e(g,e));l.push({scope:n4e(h[0].instrumentationScope),spans:m,schemaUrl:h[0].instrumentationScope.schemaUrl})}u=c.next()}const d=r4e(s,e),p={resource:d,scopeSpans:l,schemaUrl:d.schemaUrl};n.push(p),o=i.next()}return n}const y4e={serializeRequest:t=>{const e=h4e(t,l4e);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};const e=new TextDecoder;return JSON.parse(e.decode(t))}},PI=5,v4e=1e3,O4e=5e3,b4e=1.5,U9=.2;function x4e(){return Math.random()*(2*U9)-U9}class w4e{_transport;constructor(e){this._transport=e}retry(e,r,n){return new Promise((i,o)=>{setTimeout(()=>{this._transport.send(e,r).then(i,o)},n)})}async send(e,r){let n=PI,i=v4e;const o=Date.now()+r;let s=await this._transport.send(e,r);for(;s.status==="retryable"&&n>0;){n--;const a=Math.max(Math.min(i*(1+x4e()),O4e),0);i=i*b4e;const l=s.retryInMillis??a,c=o-Date.now();if(l>c)return Ht.info(`Export retry time ${Math.round(l)}ms exceeds remaining timeout ${Math.round(c)}ms, not retrying further.`),s;Ht.verbose(`Scheduling export retry in ${Math.round(l)}ms`),s=await this.retry(e,c,l)}return s.status==="success"?Ht.verbose(`Export succeeded after ${PI-n} retry attempts.`):s.status==="retryable"?Ht.info(`Export failed after maximum retry attempts (${PI}).`):Ht.info(`Export failed with non-retryable error: ${s.error}`),s}shutdown(){return this._transport.shutdown()}}function S4e(t){return new w4e(t.transport)}function _4e(t){return t===429||t===502||t===503||t===504}function C4e(t){if(t==null)return;const e=Number.parseInt(t,10);if(Number.isInteger(e))return e>0?e*1e3:-1;const r=new Date(t).getTime()-Date.now();return r>=0?r:0}const k4e=60*1024,P4e=9;let TI=0,j0=0;class T4e{_parameters;constructor(e){this._parameters=e}async send(e,r){const n=new AbortController,i=setTimeout(()=>n.abort(),r);let o=globalThis.fetch;typeof o.__original=="function"&&(o=o.__original);const s=e.byteLength,a=TI+s>k4e,l=j0>=P4e,c=!a&&!l;if(c)TI+=s,j0++;else{const u=a?"size limit":"count limit";Ht.debug(`keepalive disabled: ${(s/1024).toFixed(1)}KB payload, ${j0} pending (${u})`)}try{const u=new URL(this._parameters.url),d=await o(u.href,{method:"POST",headers:await this._parameters.headers(),body:e,signal:n.signal,keepalive:c,mode:globalThis.location?globalThis.location.origin===u.origin?"same-origin":"cors":"no-cors"});if(d.status>=200&&d.status<=299)return Ht.debug(`export response success (status: ${d.status})`),{status:"success"};if(_4e(d.status)){Ht.warn(`export response retryable (status: ${d.status})`);const p=d.headers.get("Retry-After");return{status:"retryable",retryInMillis:C4e(p)}}return Ht.error(`export response failure (status: ${d.status})`),{status:"failure",error:new Error(`Fetch request failed with non-retryable status ${d.status}`)}}catch(u){return $4e(u)?(Ht.warn(`export request retryable (network error: ${u})`),{status:"retryable",error:new Error("Fetch request encountered a network error",{cause:u})}):(Ht.error(`export request failure (error: ${u})`),{status:"failure",error:new Error("Fetch request errored",{cause:u})})}finally{clearTimeout(i),c&&(TI-=s,j0--)}}shutdown(){}}function I4e(t){return new T4e(t)}function $4e(t){return t instanceof TypeError&&!t.cause}function E4e(t,e){return t4e(t,e,S4e({transport:I4e(t)}))}function A4e(t){const e={};return Object.entries(t??{}).forEach(([r,n])=>{typeof n<"u"?e[r]=String(n):Ht.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),e}function R4e(t,e,r){return async()=>{const n={...await r()},i={};return e!=null&&Object.assign(i,await e()),t!=null&&Object.assign(i,A4e(await t())),Object.assign(i,n)}}function j4e(t){if(t!=null)try{const e=globalThis.location?.href;return new URL(t,e).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${t}'`)}}function N4e(t,e,r){return{...Zqe(t,e,r),headers:R4e(t.headers,e.headers,r.headers),url:j4e(t.url)??e.url??r.url}}function Q4e(t,e){return{...Xqe(),headers:async()=>t,url:"http://localhost:4318/"+e}}function M4e(t){return typeof t.headers=="function"?t.headers:Wqe(t.headers)}function D4e(t,e,r){return N4e({url:t.url,timeoutMillis:t.timeoutMillis,headers:M4e(t),concurrencyLimit:t.concurrencyLimit},{},Q4e(r,e))}function L4e(t,e,r,n){const i=D4e(t,r,n);return E4e(i,e)}class q4e extends Fqe{constructor(e={}){super(L4e(e,y4e,"v1/traces",{"Content-Type":"application/json"}))}}let one=class{emit(e){}};const z4e=new one;class U4e{getLogger(e,r,n){return new one}}const sne=new U4e;class V4e{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;const e=this._provider.getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):z4e}}class V9{getLogger(e,r,n){var i;return(i=this.getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new V4e(this,e,r,n)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:sne}setDelegate(e){this._delegate=e}getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}}const F4e=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},N0=Symbol.for("io.opentelemetry.js.api.logs"),Sy=F4e;function B4e(t,e,r){return n=>n===t?e:r}const F9=1;class zQ{constructor(){this._proxyLoggerProvider=new V9}static getInstance(){return this._instance||(this._instance=new zQ),this._instance}setGlobalLoggerProvider(e){return Sy[N0]?this.getLoggerProvider():(Sy[N0]=B4e(F9,e,sne),this._proxyLoggerProvider.setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=Sy[N0])===null||e===void 0?void 0:e.call(Sy,F9))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete Sy[N0],this._proxyLoggerProvider=new V9}}const ane=zQ.getInstance();function W4e(t,e,r,n){for(let i=0,o=t.length;i<o;i++){const s=t[i];e&&s.setTracerProvider(e),r&&s.setMeterProvider(r),n&&s.setLoggerProvider&&s.setLoggerProvider(n),s.getConfig().enabled||s.enable()}}function Z4e(t){t.forEach(e=>e.disable())}function X4e(t){const e=t.tracerProvider||ns.getTracerProvider(),r=t.meterProvider||qre.getMeterProvider(),n=t.loggerProvider||ane.getLoggerProvider(),i=t.instrumentations?.flat()??[];return W4e(i,e,r,n),()=>{Z4e(i)}}let aa=console.error.bind(console);function _y(t,e,r){const n=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:n,writable:!0,value:r})}const lne=(t,e,r)=>{if(!t||!t[e]){aa("no original function "+String(e)+" to wrap");return}if(!r){aa("no wrapper function"),aa(new Error().stack);return}const n=t[e];if(typeof n!="function"||typeof r!="function"){aa("original object and wrapper must be functions");return}const i=r(n,e);return _y(i,"__original",n),_y(i,"__unwrap",()=>{t[e]===i&&_y(t,e,n)}),_y(i,"__wrapped",!0),_y(t,e,i),i},G4e=(t,e,r)=>{if(t)Array.isArray(t)||(t=[t]);else{aa("must provide one or more modules to patch"),aa(new Error().stack);return}if(!(e&&Array.isArray(e))){aa("must provide one or more functions to wrap on modules");return}t.forEach(n=>{e.forEach(i=>{lne(n,i,r)})})},cne=(t,e)=>{if(!t||!t[e]){aa("no function to unwrap."),aa(new Error().stack);return}const r=t[e];if(!r.__unwrap)aa("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{r.__unwrap();return}},Y4e=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{aa("must provide one or more modules to patch"),aa(new Error().stack);return}if(!(e&&Array.isArray(e))){aa("must provide one or more functions to unwrap on modules");return}t.forEach(r=>{e.forEach(n=>{cne(r,n)})})};class H4e{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,r,n){this.instrumentationName=e,this.instrumentationVersion=r,this.setConfig(n),this._diag=Ht.createComponentLogger({namespace:e}),this._tracer=ns.getTracer(e,r),this._meter=qre.getMeter(e,r),this._logger=ane.getLogger(e,r),this._updateMetricInstruments()}_wrap=lne;_unwrap=cne;_massWrap=G4e;_massUnwrap=Y4e;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){const e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,r,n,i){if(e)try{e(n,i)}catch(o){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:r},o)}}}class J4e extends H4e{constructor(e,r,n){super(e,r,n),this._config.enabled&&this.enable()}}class K4e{span=void 0;constructor(e){this.span=e}get context(){return this.span?.context}error(e){this.span&&(this.span.setStatus(exports.SpanStatusCode.ERROR,e.message),this.span.recordException(e),this.span.end())}setAttribute(e,r){this.span&&this.span.setAttribute(e,r)}setStatus(e,r){this.span&&this.span.setStatus(e,r)}end(){this.span&&(this.span.setStatus(exports.SpanStatusCode.OK),this.span.end())}}const une="context",q1=[une];function Xm(t){return t.replace(/([A-Z])/g,"_$1").toLowerCase()}function dne(t){const e={updated:[],notUpdated:[]};for(const r of t){if(!r||typeof r!="object")continue;const n=r.object;if(typeof n!="string")continue;const i=r,o=e.notUpdated.find(s=>s.object===n);o?(e.updated=[o,i],e.notUpdated=e.notUpdated.filter(s=>s.object!==n)):e.updated.some(s=>s.object===n)||e.notUpdated.push(i)}return e}function z1(t,e,r){const n=r?`${r}.`:"",i=e===""?"":`${e}.`;return`${t}.${n}${i}`}function pne(t,e){const r=t[une];return r==="before"||r==="after"?r:e===0?"after":"before"}function U1(t,e,r,n=!0,i){const o=i?.length?new Set(i):null;for(const[s,a]of Object.entries(t))if(!o?.has(s)&&a!==void 0){const l=n?Xm(s):s;r[`${e}${l}`]=a}}function eze(t,e,r){for(const[n,i]of Object.entries(t))i==null||typeof i=="object"||(r[`${e}.${Xm(n)}`]=i)}function tze(t,e,r){const n=e instanceof Date?e.toISOString():new Date(e).toISOString();return{"cloudevents.event_id":t.id,"cloudevents.event_type":t.type,"cloudevents.event_source":t.source??void 0,"cloudevents.event_spec_version":t.specversion,"cloudevents.event_data_content_type":t.datacontenttype??"application/json; charset=utf-8","cloudevents.event_time":n,"cloudevents.event_subject":t.subject??"","cloudevents.page.uri":typeof location<"u"?location.href:void 0,"cloudevents.event_version":r?.version,"cloudevents.event_origin":t.origin??r?.serviceName,"cloudevents.event_env":t.env,"cloudevents.event_source_details.id":t.actor?.id??"anonymous","cloudevents.event_source_details.object":t.actor?.object??"anonymous","cloudevents.event_source_details.uri":t.actor?.uri??void 0,"cloudevents.event_client_ip":t.clientIp,"cloudevents.event_object":t.object||"event","cloudevents.event_category":t.category,"cloudevents.event_signal":t.signal,"cloudevents.event_actor.id":t.actor?.id??void 0,"cloudevents.event_actor.object":t.actor?.object??void 0,"cloudevents.event_actor.uri":t.actor?.uri??void 0,"cloudevents.event_organization_id":t.organizationId,"cloudevents.event_organization_slug":t.organizationSlug,"cloudevents.event_project_id":t.projectId,"cloudevents.event_project_slug":t.projectSlug,"cloudevents.event_request_id":t.requestId,"cloudevents.event_os_platform":t.osPlatform,"cloudevents.event_user_agent":t.userAgent,"cloudevents.event_session_id":t.sessionId}}function rze(t,e,r){const n=t.data,i={...tze(t,e,r)};return nze(n,i),lze(t,i),cze(t,i),i}function nze(t,e){!t||typeof t!="object"||(Array.isArray(t)?ize(t,e):aze(t,e))}function ize(t,e){t.some(n=>n&&typeof n=="object"&&typeof n.object=="string")?oze(t,e):sze(t,e)}function oze(t,e){const r=dne(t);r.updated.forEach((n,i)=>{const o=z1("cloudevents.event_data",n.object,pne(n,i));U1(n,o,e,!0,q1)}),r.notUpdated.forEach(n=>{const i=z1("cloudevents.event_data",n.object,void 0);U1(n,i,e,!0,q1)})}function sze(t,e){for(const r of t)if(!(!r||typeof r!="object"))for(const[n,i]of Object.entries(r)){if(i===void 0)continue;const o=Xm(n);i!==null&&typeof i=="object"&&!Array.isArray(i)?eze(i,`cloudevents.event_data.${o}`,e):e[`cloudevents.event_data.${o}`]=i}}function aze(t,e){for(const[r,n]of Object.entries(t)){if(n==null)continue;const i=Xm(r);if(typeof n=="object"&&!Array.isArray(n))for(const[o,s]of Object.entries(n))s!=null&&(typeof s=="string"||typeof s=="number"||typeof s=="boolean")&&(e[`cloudevents.event_data.${i}.${o}`]=s);else(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&(e[`cloudevents.event_data.${i}`]=n)}}function lze(t,e){if(!t.subjects||!Array.isArray(t.subjects))return;const r=dne(t.subjects);r.updated.forEach((n,i)=>{const o=z1("cloudevents.event_subjects",n.object,pne(n,i));U1(n,o,e,!1,q1)}),r.notUpdated.forEach(n=>{const i=z1("cloudevents.event_subjects",n.object,void 0);U1(n,i,e,!1,q1)})}function cze(t,e){for(const[r,n]of Object.entries(t))if(!(HDe.includes(r)||n===void 0))if(n instanceof Object)for(const[i,o]of Object.entries(n))o!==void 0&&(e[`cloudevents.${r}.${i}`]=o);else e[`cloudevents.${r}`]=n}function uze(t,e,r){return rze(t,e,r)}class dze{config=null;tracer=null;tracerProvider=null;initialized=!1;sessionId=null;initTracer(e){throw new Error("initTracer must be implemented by the environment-specific client")}init(e){this.config=e,this.initTracer(e)}send(e){try{if(!this.tracer||!this.config)return;const r=e,n="time"in r&&r.time?new Date(r.time):new Date;this.tracer.startSpan(`event.${r.type}`,{attributes:this.processAttributes(r,n),startTime:n}).end(n)}catch(r){this.config?.isProd||console.error("Event reporting failed:",r)}}processAttributes(e,r){return uze(e,r,this.config)}startSpan(e,r){try{if(!this.tracer)return;let n;const i=e.time?new Date(e.time):new Date,o=this.tracer.startSpan(`event.${e.type}`,{attributes:this.processAttributes(e,i),root:!r},r);return r||(n=ns.setSpan(wl.active(),o)),{end:()=>o.end(),setAttribute:(s,a)=>{o.setAttribute(`cloudevents.event_data.${Xm(s)}`,a)},setStatus:(s,a)=>o.setStatus({code:s,message:a}),parentCtx:n}}catch(n){this.config?.isProd||console.error("Event reporting failed:",n);return}}startStepSpan(e,r){try{if(!this.tracer)return;const n=r||wl.active(),i=e,o=i.time?new Date(i.time):new Date,s=this.tracer.startSpan(`event.${i.type}`,{attributes:this.processAttributes(i,o)},n),a=ns.setSpan(n,s);return{end:()=>s.end(),setAttribute:(l,c)=>{s.setAttribute(`cloudevents.event_data.${Xm(l)}`,c)},setStatus:(l,c)=>s.setStatus({code:l,message:c}),recordException:l=>s.recordException(l),context:a}}catch(n){this.config?.isProd||console.error("Event reporting failed:",n);return}}traceStep(e){const r=this.startStepSpan(e);if(r)return new K4e(r)}async forceFlush(){return this.tracerProvider?.forceFlush()}async shutdown(){return this.tracerProvider?.shutdown()}}class pze extends dze{tracer=null;initialized=!1;constructor(){super()}initTracer(e){if(!e.collectorUrl&&!e.collectorTraceUrl)return;const r=`ses_${Wm()}`;this.sessionId=r;const n=tne({[Wre]:e.serviceName,[PLe]:e.serviceVersion,session_id:r}),i=e.collectorTraceUrl||`${e.collectorUrl}/v1/traces`;this.tracerProvider=new Vqe({resource:n,spanProcessors:[new Cqe(new q4e({url:i,headers:{}}))]}),this.tracer=this.tracerProvider.getTracer(e.tracerName),this.tracerProvider.register(),X4e({instrumentations:e.instrumentations??[]}),this.initialized=!0}}class md extends J4e{sendErrorEvent;originalConsoleError;constructor(e,r){super("errors","1.0",e||{}),this.sendErrorEvent=r}static toErrorEvent(e,r){return{type:"error",payload:[{handler:r,errorType:md.getErrorType(e),message:md.getErrorMessage(e),stack:md.getErrorStack(e)}]}}enable(){window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this.wrapConsoleError()}disable(){window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),this.unwrapConsoleError()}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>4096?r.substring(0,4096):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=>String(i)).join(" ");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")};wrapConsoleError(){this.originalConsoleError=console.error,console.error=(...e)=>{try{const r=md.combineConsoleErrorArgs(e);this.sendError(r,"console.error")}catch(r){process.env.NODE_ENV!=="production"&&this.originalConsoleError?.call(console,"Error reporting failed:",r)}this.originalConsoleError?.apply(console,e)}}unwrapConsoleError(){this.originalConsoleError&&(console.error=this.originalConsoleError,this.originalConsoleError=void 0)}sendError(e,r){this.sendErrorEvent(md.toErrorEvent(e,r))}}class fze{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new pze,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,instrumentations:[...e.otel.enableErrorInstrumentation===!0?[new md(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 JDe({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=md.toErrorEvent(e,r);this.sendToOtelService({type:n.type,data:n.payload})}sendTabChangeMessage(e,r){this.send("tab.change",e,r)}sendButtonClickMessage(e,r){this.send("button.click",e,r)}sendTabOpenFailedMessage(e,r){this.send("tab.open_failed",e,r)}sendChangeMessage(e,r){this.send("change",e,r)}sendContentCopyMessage(e,r){this.send("content.copy",e,r)}sendRequestSendMessage(e,r){this.send("request.send",e,r)}sendTokenGenerateMessage(e,r){this.send("token.generate",e,r)}sendAppLifecycleMessage(e,r){this.send("app.lifecycle",e,r)}sendEnvironmentManagementMessage(e,r){this.send("environment.management",e,r)}sendServerManagementMessage(e,r){this.send("server.management",e,r)}sendSourceManagementMessage(e,r){this.send("source.management",e,r)}sendInputManagementMessage(e,r){this.send("input.management",e,r)}sendNodeManagementMessage(e,r){this.send("node.management",e,r)}sendHistoryManagementMessage(e,r){this.send("history.management",e,r)}sendHistoryMigrationMessage(e,r){this.send("history.migration",e,r)}sendCredentialManagementMessage(e,r){this.send("credential.management",e,r)}sendPanelToggleMessage(e,r){this.send("panel.toggle",e,r)}sendWorkflowRunClickMessage(e,r){this.send("workflow.run.click",e,r)}sendWorkflowRunResultMessage(e,r){this.send("workflow.run.result",e,r)}sendStorageReadMessage(e){this.send("storage.read",void 0,e)}sendStorageLoadUserStateMessage(e){this.send("storage.loadUserState",void 0,e)}sendStorageDetectFilesMessage(e){this.send("storage.detectFiles",void 0,e)}sendStorageLoadApisMessage(e){this.send("storage.loadApis",void 0,e)}sendStorageParseApisMessage(e){this.send("storage.parseApis",void 0,e)}sendStorageParseCollectionsMessage(e){this.send("storage.parseCollections",void 0,e)}sendUpdaterCheckMessage(e){this.send("updater.check",void 0,e)}sendUpdaterDownloadMessage(e){this.send("updater.download",void 0,e)}sendUpdaterInstallMessage(e){this.send("updater.install",void 0,e)}sendUpdaterProcessMessage(e){this.send("updater.process",void 0,e)}sendErrorMessage(e,r){this.send("error",e,r)}sendCodeEditorSearchMessage(e,r){this.send("code_editor.search",e,r)}sendAiChatToolCallStartedMessage(e,r){this.send("com.redocly.ai_chat.tool_call_started",e,r)}sendAiChatToolCallFinishedMessage(e,r){this.send("com.redocly.ai_chat.tool_call_finished",e,r)}sendAiChatConversationStartedMessage(e,r){this.send("com.redocly.ai_chat.conversation_started",e,r)}sendAiChatConversationFinishedMessage(e,r){this.send("com.redocly.ai_chat.conversation_finished",e,r)}}const Rg=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],hze="https://cors.redocly.com/";function mze(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function B9(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function W9(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?B9(Object(r),!0).forEach(function(n){mze(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):B9(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function oo(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 Z9=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),II=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ed={INIT:"@@redux/INIT"+II(),REPLACE:"@@redux/REPLACE"+II(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+II()}};function fne(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 gze(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(Oze(t))return"date";if(vze(t))return"error";var r=yze(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 yze(t){return typeof t.constructor=="function"?t.constructor.name:null}function vze(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function Oze(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function sd(t){var e=typeof t;return process.env.NODE_ENV!=="production"&&(e=gze(t)),e}function Sk(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"?oo(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"?oo(1):"Expected the enhancer to be a function. Instead, received: '"+sd(r)+"'");return r(Sk)(t,e)}if(typeof t!="function")throw new Error(process.env.NODE_ENV==="production"?oo(2):"Expected the root reducer to be a function. Instead, received: '"+sd(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"?oo(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"?oo(4):"Expected the listener to be a function. Instead, received: '"+sd(g)+"'");if(l)throw new Error(process.env.NODE_ENV==="production"?oo(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"?oo(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 O=a.indexOf(g);a.splice(O,1),s=null}}}function p(g){if(!fne(g))throw new Error(process.env.NODE_ENV==="production"?oo(7):"Actions must be plain objects. Instead, the actual type was: '"+sd(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"?oo(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"?oo(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 O=y[v];O()}return g}function h(g){if(typeof g!="function")throw new Error(process.env.NODE_ENV==="production"?oo(10):"Expected the nextReducer to be a function. Instead, received: '"+sd(g));i=g,p({type:Ed.REPLACE})}function m(){var g,y=d;return g={subscribe:function(O){if(typeof O!="object"||O===null)throw new Error(process.env.NODE_ENV==="production"?oo(11):"Expected the observer to be an object. Instead, received: '"+sd(O)+"'");function b(){O.next&&O.next(u())}b();var x=y(b);return{unsubscribe:x}}},g[Z9]=function(){return this},g}return p({type:Ed.INIT}),n={dispatch:p,subscribe:d,getState:u,replaceReducer:h},n[Z9]=m,n}var bze=Sk;function oR(t){typeof console<"u"&&typeof console.error=="function"&&console.error(t);try{throw new Error(t)}catch{}}function xze(t,e,r,n){var i=Object.keys(e),o=r&&r.type===Ed.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(i.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!fne(t))return"The "+o+' has unexpected type of "'+sd(t)+'". Expected argument to be an object with the following '+('keys: "'+i.join('", "')+'"');var s=Object.keys(t).filter(function(a){return!e.hasOwnProperty(a)&&!n[a]});if(s.forEach(function(a){n[a]=!0}),!(r&&r.type===Ed.REPLACE)&&s.length>0)return"Unexpected "+(s.length>1?"keys":"key")+" "+('"'+s.join('", "')+'" found in '+o+". ")+"Expected to find one of the known reducer keys instead: "+('"'+i.join('", "')+'". Unexpected keys will be ignored.')}function wze(t){Object.keys(t).forEach(function(e){var r=t[e],n=r(void 0,{type:Ed.INIT});if(typeof n>"u")throw new Error(process.env.NODE_ENV==="production"?oo(12):'The slice reducer for key "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:Ed.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?oo(13):'The slice reducer for key "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle '"+Ed.INIT+`' or other actions in "redux/*" `)+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}function Sze(t){for(var e=Object.keys(t),r={},n=0;n<e.length;n++){var i=e[n];process.env.NODE_ENV!=="production"&&typeof t[i]>"u"&&oR('No reducer provided for key "'+i+'"'),typeof t[i]=="function"&&(r[i]=t[i])}var o=Object.keys(r),s;process.env.NODE_ENV!=="production"&&(s={});var a;try{wze(r)}catch(l){a=l}return function(c,u){if(c===void 0&&(c={}),a)throw a;if(process.env.NODE_ENV!=="production"){var d=xze(c,r,u,s);d&&oR(d)}for(var p=!1,h={},m=0;m<o.length;m++){var g=o[m],y=r[g],v=c[g],O=y(v,u);if(typeof O>"u"){var b=u&&u.type;throw new Error(process.env.NODE_ENV==="production"?oo(14):"When called with an action of type "+(b?'"'+String(b)+'"':"(unknown type)")+', the slice reducer for key "'+g+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.')}h[g]=O,p=p||O!==v}return p=p||o.length!==Object.keys(c).length,p?h:c}}function X9(t,e){return function(){return e(t.apply(this,arguments))}}function _ze(t,e){if(typeof t=="function")return X9(t,e);if(typeof t!="object"||t===null)throw new Error(process.env.NODE_ENV==="production"?oo(16):"bindActionCreators expected an object or a function, but instead received: '"+sd(t)+`'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?`);var r={};for(var n in t){var i=t[n];typeof i=="function"&&(r[n]=X9(i,e))}return r}function hne(){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 Cze(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(n){return function(){var i=n.apply(void 0,arguments),o=function(){throw new Error(process.env.NODE_ENV==="production"?oo(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},s={getState:i.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=e.map(function(l){return l(s)});return o=hne.apply(void 0,a)(i.dispatch),W9(W9({},i),{},{dispatch:o})}}}function G9(){}process.env.NODE_ENV!=="production"&&typeof G9.name=="string"&&G9.name!=="isCrushed"&&oR('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.');var kze=Object.freeze({__proto__:null,__DO_NOT_USE__ActionTypes:Ed,applyMiddleware:Cze,bindActionCreators:_ze,combineReducers:Sze,compose:hne,createStore:Sk,legacy_createStore:bze});function Pze(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Tze=Pze(kze);Tze.compose;var Ize=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(t){return t}};function $ze(t,e,r){var n=!1,i=!1,o=Sk(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,h=0,m=l.path;h<m.length;h++){var g=m[h];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})},Ize({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 Eze(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=$ze(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 Ir=(t=>(t.Normal="Normal",t.Edit="Edit",t.Draft="Draft",t))(Ir||{});const _b="default",mne=[{name:_b,inputs:[],servers:[],state:Ir.Normal}],sR={activeTabIdx:0,tabs:[]};var ac=(t=>(t.Idle="idle",t.Loading="loading",t.Success="success",t.Error="error",t))(ac||{});function Sl(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 aR(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(!aR(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)||!aR(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function Y9(t){return Object.keys(t).forEach(e=>{t[e]===void 0&&delete t[e]}),t}function xs(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 Xw(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 bh,Xl,xh,Gw;const H9="__TAURI_TO_IPC_KEY__";function gne(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}class yne{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,bh.set(this,()=>{}),Xl.set(this,0),xh.set(this,[]),this.id=gne(({message:e,id:r})=>{if(r==xs(this,Xl,"f"))for(xs(this,bh,"f").call(this,e),Xw(this,Xl,xs(this,Xl,"f")+1);xs(this,Xl,"f")in xs(this,xh,"f");){const n=xs(this,xh,"f")[xs(this,Xl,"f")];xs(this,bh,"f").call(this,n),delete xs(this,xh,"f")[xs(this,Xl,"f")],Xw(this,Xl,xs(this,Xl,"f")+1)}else xs(this,xh,"f")[r]=e})}set onmessage(e){Xw(this,bh,e)}get onmessage(){return xs(this,bh,"f")}[(bh=new WeakMap,Xl=new WeakMap,xh=new WeakMap,H9)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[H9]()}}async function tt(t,e={},r){return window.__TAURI_INTERNALS__.invoke(t,e,r)}class Aze{get rid(){return xs(this,Gw,"f")}constructor(e){Gw.set(this,void 0),Xw(this,Gw,e)}async close(){return tt("plugin:resources|close",{rid:this.rid})}}Gw=new WeakMap;function Xr(){return!!window?.__TAURI__}async function lR(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 yo={FS:"fs",WEB:"web"};var cn;(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"})(cn||(cn={}));async function Rze(){return tt("plugin:path|resolve_directory",{directory:cn.AppConfig})}async function vne(){return tt("plugin:path|resolve_directory",{directory:cn.AppData})}async function jze(){return tt("plugin:path|resolve_directory",{directory:cn.AppLocalData})}async function Nze(){return tt("plugin:path|resolve_directory",{directory:cn.AppCache})}async function Qze(){return tt("plugin:path|resolve_directory",{directory:cn.Audio})}async function Mze(){return tt("plugin:path|resolve_directory",{directory:cn.Cache})}async function Dze(){return tt("plugin:path|resolve_directory",{directory:cn.Config})}async function Lze(){return tt("plugin:path|resolve_directory",{directory:cn.Data})}async function One(){return tt("plugin:path|resolve_directory",{directory:cn.Desktop})}async function qze(){return tt("plugin:path|resolve_directory",{directory:cn.Document})}async function zze(){return tt("plugin:path|resolve_directory",{directory:cn.Download})}async function Uze(){return tt("plugin:path|resolve_directory",{directory:cn.Executable})}async function Vze(){return tt("plugin:path|resolve_directory",{directory:cn.Font})}async function Fze(){return tt("plugin:path|resolve_directory",{directory:cn.Home})}async function Bze(){return tt("plugin:path|resolve_directory",{directory:cn.LocalData})}async function Wze(){return tt("plugin:path|resolve_directory",{directory:cn.Picture})}async function Zze(){return tt("plugin:path|resolve_directory",{directory:cn.Public})}async function Xze(){return tt("plugin:path|resolve_directory",{directory:cn.Resource})}async function Gze(t){return tt("plugin:path|resolve_directory",{directory:cn.Resource,path:t})}async function Yze(){return tt("plugin:path|resolve_directory",{directory:cn.Runtime})}async function Hze(){return tt("plugin:path|resolve_directory",{directory:cn.Template})}async function Jze(){return tt("plugin:path|resolve_directory",{directory:cn.Video})}async function Kze(){return tt("plugin:path|resolve_directory",{directory:cn.AppLog})}async function e3e(){return tt("plugin:path|resolve_directory",{directory:cn.Temp})}function UQ(){return window.__TAURI_INTERNALS__.plugins.path.sep}function t3e(){return window.__TAURI_INTERNALS__.plugins.path.delimiter}async function bne(...t){return tt("plugin:path|resolve",{paths:t})}async function r3e(t){return tt("plugin:path|normalize",{path:t})}async function _m(...t){return tt("plugin:path|join",{paths:t})}async function xne(t){return tt("plugin:path|dirname",{path:t})}async function wne(t){return tt("plugin:path|extname",{path:t})}async function VQ(t,e){return tt("plugin:path|basename",{path:t,ext:e})}async function Sne(t){return tt("plugin:path|is_absolute",{path:t})}const _ne=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return cn},appCacheDir:Nze,appConfigDir:Rze,appDataDir:vne,appLocalDataDir:jze,appLogDir:Kze,audioDir:Qze,basename:VQ,cacheDir:Mze,configDir:Dze,dataDir:Lze,delimiter:t3e,desktopDir:One,dirname:xne,documentDir:qze,downloadDir:zze,executableDir:Uze,extname:wne,fontDir:Vze,homeDir:Fze,isAbsolute:Sne,join:_m,localDataDir:Bze,normalize:r3e,pictureDir:Wze,publicDir:Zze,resolve:bne,resolveResource:Gze,resourceDir:Xze,runtimeDir:Yze,sep:UQ,tempDir:e3e,templateDir:Hze,videoDir:Jze},Symbol.toStringTag,{value:"Module"}));var cR;(function(t){t[t.Start=0]="Start",t[t.Current=1]="Current",t[t.End=2]="End"})(cR||(cR={}));function FQ(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 BQ extends Aze{async read(e){if(e.byteLength===0)return 0;const[r,n]=await tt("plugin:fs|read",{rid:this.rid,len:e.byteLength});return e.set(r),n===0?null:n}async seek(e,r){return await tt("plugin:fs|seek",{rid:this.rid,offset:e,whence:r})}async stat(){const e=await tt("plugin:fs|fstat",{rid:this.rid});return FQ(e)}async truncate(e){await tt("plugin:fs|ftruncate",{rid:this.rid,len:e})}async write(e){return await tt("plugin:fs|write",{rid:this.rid,data:e})}}async function n3e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=await tt("plugin:fs|create",{path:t instanceof URL?t.toString():t,options:e});return new BQ(r)}async function i3e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=await tt("plugin:fs|open",{path:t instanceof URL?t.toString():t,options:e});return new BQ(r)}async function o3e(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 tt("plugin:fs|copy_file",{fromPath:t instanceof URL?t.toString():t,toPath:e instanceof URL?e.toString():e,options:r})}async function uR(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await tt("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})}async function WQ(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await tt("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})}async function Cne(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=await tt("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 _k(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await tt("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e})}async function s3e(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 tt("plugin:fs|read_text_file_lines",{path:r,options:e}));const[n,i]=await tt("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 kne(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await tt("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})}async function Pne(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 tt("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:r})}async function a3e(t,e){const r=await tt("plugin:fs|stat",{path:t instanceof URL?t.toString():t,options:e});return FQ(r)}async function l3e(t,e){const r=await tt("plugin:fs|lstat",{path:t instanceof URL?t.toString():t,options:e});return FQ(r)}async function c3e(t,e,r){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await tt("plugin:fs|truncate",{path:t instanceof URL?t.toString():t,len:e,options:r})}async function u3e(t,e,r){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await tt("plugin:fs|write_file",e,{headers:{path:t instanceof URL?t.toString():t,options:JSON.stringify(r)}})}async function Tne(t,e,r){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await tt("plugin:fs|write_text_file",{path:t instanceof URL?t.toString():t,data:e,options:r})}async function Ck(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await tt("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})}async function Ine(t){await tt("plugin:fs|unwatch",{rid:t})}async function d3e(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 yne;o.onmessage=e;const s=await tt("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:n,onEvent:o});return()=>{Ine(s)}}async function p3e(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 yne;o.onmessage=e;const s=await tt("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:n,onEvent:o});return()=>{Ine(s)}}const kk=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return cn},FileHandle:BQ,get SeekMode(){return cR},copyFile:o3e,create:n3e,exists:Ck,lstat:l3e,mkdir:uR,open:i3e,readDir:WQ,readFile:Cne,readTextFile:_k,readTextFileLines:s3e,remove:kne,rename:Pne,stat:a3e,truncate:c3e,watch:d3e,watchImmediate:p3e,writeFile:u3e,writeTextFile:Tne},Symbol.toStringTag,{value:"Module"}));class xr{static utils=null;static async getUtils(){return xr.utils||(xr.utils=Xr()?await Promise.resolve().then(()=>require("./replay-tauri-path-BZgQe2h9.js")):await Promise.resolve().then(()=>pbe)),xr.utils}static async dirname(e){return(await xr.getUtils()).dirname(e)}static async join(...e){return(await xr.getUtils()).join(...e)}static async resolve(e){return(await xr.getUtils()).resolve(e)}static async isAbsolute(e){return(await xr.getUtils()).isAbsolute(e)}static async relative(e,r){return(await xr.getUtils()).relative(e,r)}static async extname(e){return(await xr.getUtils()).extname(e)}}class ZQ{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 f3e=new Set(["node_modules"]);class dR extends ZQ{constructor(e){super(),this.baseDir=e,this.initializeDirectory(e)}writeExcludedKeys=new Set;writeEndTimers=new Map;async initializeDirectory(e){await uR(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 WQ(e);for(const i of n)if(i.isDirectory){if(f3e.has(i.name))continue;const o=await _m(e,i.name),s=await this.getDirEntryFilesRecursively(o);r.push(...s)}else{const o=await _m(e,i.name),s=await xr.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 _k(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 Ck(r)}async set(e,r){if(!this.writeExcludedKeys.has(e)){this.emit("write-start",e);try{const n=await this.getFullPath(e),i=UQ(),o=n.split(i).slice(0,-1).join(i);await uR(o,{recursive:!0}),await Tne(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 kne(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 Pne(n,i)}async getFullPath(e){return await _m(this.baseDir,e??"")}}class h3e{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 m3e{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 $ne{constructor(e){this.storage=e}itemIds=[];async getAbsolutePath(e){return await xr.resolve(await xr.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===Ir.Draft||e.srcType!==yo.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 g3e extends $ne{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 xr.extname(r)===".json"?JSON.stringify(o,null,2):$u.dump(o)}async write(e){await this.storage.has(e.id)||await super.write(e)}}var Qi=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(Qi||{});class V1{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 y3e{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 Ene{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new y3e(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}}const v3e=`
|
|
291
|
+
`;function vk({input:t,onSave:e,onCancel:r,...n}){const[i,o]=k.useState(!!t.isSecret),s=({name:a,value:l})=>{e({...t,name:a,value:l,isSecret:i})};return f.jsx(Ere,{variable:t,onSave:s,onCancel:r,maskValue:i,...n,children:f.jsx(iO,{children:f.jsx(Bte,{value:i,onChange:a=>o(a),title:"Make it secret"})})})}const j1=()=>({name:"",value:"",isSecret:!1}),zn=t=>KY+"$inputs."+t+kN,Are=(t,e)=>e.inputs.find(r=>r.get().name===t.match(`^${ub}$`)?.[1]);function VDe({environments:t,activeEnvironmentId:e}){return t.get().find(n=>n.name===e.get())?.inputs||[]}function Ku(t){const e=new RegExp(ub,"g"),r=new Set;if(!t)return r;for(const[n,i,o]of t.matchAll(e)){const s=i||o;s&&r.add(s)}return r}function zf(t){const e=/^\{?\$inputs\.([^\}\s]+)\}?$/,r=t.match(e);return r?r[1]:null}function Ww(t){const e=new Error(t);return e.source="ulid",e}const AQ="0123456789ABCDEFGHJKMNPQRSTVWXYZ",vv=AQ.length,w9=Math.pow(2,48)-1,FDe=10,BDe=16;function WDe(t){let e=Math.floor(t()*vv);return e===vv&&(e=vv-1),AQ.charAt(e)}function ZDe(t,e){if(isNaN(t))throw new Error(t+" must be a number");if(t>w9)throw Ww("cannot encode time greater than "+w9);if(t<0)throw Ww("time must be positive");if(Number.isInteger(Number(t))===!1)throw Ww("time must be an integer");let r,n="";for(;e>0;e--)r=t%vv,n=AQ.charAt(r)+n,t=(t-r)/vv;return n}function XDe(t,e){let r="";for(;t>0;t--)r=WDe(e)+r;return r}function GDe(t=!1,e){e||(e=typeof window<"u"?window:null);const r=e&&(e.crypto||e.msCrypto);if(r)return()=>{const n=new Uint8Array(1);return r.getRandomValues(n),n[0]/255};try{const n=require("crypto");return()=>n.randomBytes(1).readUInt8()/255}catch{}if(t){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return()=>Math.random()}throw Ww("secure crypto unusable, insecure Math.random not allowed")}function YDe(t){return t||(t=GDe()),function(r){return isNaN(r)&&(r=Date.now()),ZDe(r,FDe)+XDe(BDe,t)}}const Wm=YDe(),HDe=["id","specversion","object","datacontenttype","type","time","origin","env","category","signal","source","subject","subjects","data","actor","requestId","clientIp","organizationId","organizationSlug","projectId","projectSlug","osPlatform","userAgent","sessionId"];function JDe(t){const{type:e,data:r,actor:n,requestId:i,clientIp:o,origin:s,env:a,source:l,organizationId:c,organizationSlug:u,projectId:d,projectSlug:p,category:h="product",signal:m="log",osPlatform:g,userAgent:y,sessionId:v}=t,O=!!(r&&Array.isArray(r)),b=n?{id:n.id??`ann_${Wm()}`,object:n.object??"user",uri:n.uri??""}:null,x=`evt_${Wm()}`.toLowerCase(),w=new Date,_=l??b?.uri??null,S={...c!==void 0&&{organizationId:c},...u!==void 0&&{organizationSlug:u},...d!==void 0&&{projectId:d},...p!==void 0&&{projectSlug:p}},$={specversion:"1.0",object:"event",datacontenttype:"application/json; charset=utf-8",origin:s,env:a,category:h,signal:m,osPlatform:g,userAgent:y,clientIp:o,sessionId:v};if(O){const E=r,N=E.map(L=>({id:L.id??"",object:L.object??"",uri:L.uri??""})),R=E[0]?.id??null;Object.assign($,{...S,id:x,type:e,time:w,source:_,actor:b,subject:R,subjects:N,data:E,requestId:i??""})}else{const E=(Array.isArray(r)?r[0]:r)?.id??null;Object.assign($,{...S,id:x,type:e,time:w,source:_,actor:b,subject:E,requestId:i??"",data:r,...l!=null&&{request:{source:l}}})}return $}var KDe=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},Mp="1.9.0",S9=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function e5e(t){var e=new Set([t]),r=new Set,n=t.match(S9);if(!n)return function(){return!1};var i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(l){return l===t};function o(a){return r.add(a),!1}function s(a){return e.add(a),!0}return function(l){if(e.has(l))return!0;if(r.has(l))return!1;var c=l.match(S9);if(!c)return o(l);var u={major:+c[1],minor:+c[2],patch:+c[3],prerelease:c[4]};return u.prerelease!=null||i.major!==u.major?o(l):i.major===0?i.minor===u.minor&&i.patch<=u.patch?s(l):o(l):i.minor<=u.minor?s(l):o(l)}}var t5e=e5e(Mp),r5e=Mp.split(".")[0],uO=Symbol.for("opentelemetry.js.api."+r5e),dO=KDe;function wb(t,e,r,n){var i;n===void 0&&(n=!1);var o=dO[uO]=(i=dO[uO])!==null&&i!==void 0?i:{version:Mp};if(!n&&o[t]){var s=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return r.error(s.stack||s.message),!1}if(o.version!==Mp){var s=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+t+" does not match previously registered API v"+Mp);return r.error(s.stack||s.message),!1}return o[t]=e,r.debug("@opentelemetry/api: Registered a global for "+t+" v"+Mp+"."),!0}function cf(t){var e,r,n=(e=dO[uO])===null||e===void 0?void 0:e.version;if(!(!n||!t5e(n)))return(r=dO[uO])===null||r===void 0?void 0:r[t]}function Sb(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+Mp+".");var r=dO[uO];r&&delete r[t]}var n5e=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},i5e=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))},o5e=(function(){function t(e){this._namespace=e.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xy("debug",this._namespace,e)},t.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xy("error",this._namespace,e)},t.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xy("info",this._namespace,e)},t.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xy("warn",this._namespace,e)},t.prototype.verbose=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xy("verbose",this._namespace,e)},t})();function xy(t,e,r){var n=cf("diag");if(n)return r.unshift(e),n[t].apply(n,i5e([],n5e(r),!1))}var Ks;(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(Ks||(Ks={}));function s5e(t,e){t<Ks.NONE?t=Ks.NONE:t>Ks.ALL&&(t=Ks.ALL),e=e||{};function r(n,i){var o=e[n];return typeof o=="function"&&t>=i?o.bind(e):function(){}}return{error:r("error",Ks.ERROR),warn:r("warn",Ks.WARN),info:r("info",Ks.INFO),debug:r("debug",Ks.DEBUG),verbose:r("verbose",Ks.VERBOSE)}}var a5e=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},l5e=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))},c5e="diag",Dc=(function(){function t(){function e(i){return function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=cf("diag");if(a)return a[i].apply(a,l5e([],a5e(o),!1))}}var r=this,n=function(i,o){var s,a,l;if(o===void 0&&(o={logLevel:Ks.INFO}),i===r){var c=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((s=c.stack)!==null&&s!==void 0?s:c.message),!1}typeof o=="number"&&(o={logLevel:o});var u=cf("diag"),d=s5e((a=o.logLevel)!==null&&a!==void 0?a:Ks.INFO,i);if(u&&!o.suppressOverrideMessage){var p=(l=new Error().stack)!==null&&l!==void 0?l:"<failed to generate stacktrace>";u.warn("Current logger will be overwritten from "+p),d.warn("Current logger will overwrite one already registered from "+p)}return wb("diag",d,r,!0)};r.setLogger=n,r.disable=function(){Sb(c5e,r)},r.createComponentLogger=function(i){return new o5e(i)},r.verbose=e("verbose"),r.debug=e("debug"),r.info=e("info"),r.warn=e("warn"),r.error=e("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t})(),u5e=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},d5e=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},p5e=(function(){function t(e){this._entries=e?new Map(e):new Map}return t.prototype.getEntry=function(e){var r=this._entries.get(e);if(r)return Object.assign({},r)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var r=u5e(e,2),n=r[0],i=r[1];return[n,i]})},t.prototype.setEntry=function(e,r){var n=new t(this._entries);return n._entries.set(e,r),n},t.prototype.removeEntry=function(e){var r=new t(this._entries);return r._entries.delete(e),r},t.prototype.removeEntries=function(){for(var e,r,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=new t(this._entries);try{for(var s=d5e(n),a=s.next();!a.done;a=s.next()){var l=a.value;o._entries.delete(l)}}catch(c){e={error:c}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return o},t.prototype.clear=function(){return new t},t})(),f5e=Symbol("BaggageEntryMetadata"),h5e=Dc.instance();function m5e(t){return t===void 0&&(t={}),new p5e(new Map(Object.entries(t)))}function g5e(t){return typeof t!="string"&&(h5e.error("Cannot create baggage metadata from unknown type: "+typeof t),t=""),{__TYPE__:f5e,toString:function(){return t}}}function RQ(t){return Symbol.for(t)}var y5e=(function(){function t(e){var r=this;r._currentContext=e?new Map(e):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,i){var o=new t(r._currentContext);return o._currentContext.set(n,i),o},r.deleteValue=function(n){var i=new t(r._currentContext);return i._currentContext.delete(n),i}}return t})(),Wh=new y5e,Uf=(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),v5e=(function(){function t(){}return t.prototype.createGauge=function(e,r){return P5e},t.prototype.createHistogram=function(e,r){return T5e},t.prototype.createCounter=function(e,r){return k5e},t.prototype.createUpDownCounter=function(e,r){return I5e},t.prototype.createObservableGauge=function(e,r){return E5e},t.prototype.createObservableCounter=function(e,r){return $5e},t.prototype.createObservableUpDownCounter=function(e,r){return A5e},t.prototype.addBatchObservableCallback=function(e,r){},t.prototype.removeBatchObservableCallback=function(e){},t})(),Ok=(function(){function t(){}return t})(),O5e=(function(t){Uf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.add=function(r,n){},e})(Ok),b5e=(function(t){Uf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.add=function(r,n){},e})(Ok),x5e=(function(t){Uf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.record=function(r,n){},e})(Ok),w5e=(function(t){Uf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.record=function(r,n){},e})(Ok),jQ=(function(){function t(){}return t.prototype.addCallback=function(e){},t.prototype.removeCallback=function(e){},t})(),S5e=(function(t){Uf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(jQ),_5e=(function(t){Uf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(jQ),C5e=(function(t){Uf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(jQ),Rre=new v5e,k5e=new O5e,P5e=new x5e,T5e=new w5e,I5e=new b5e,$5e=new S5e,E5e=new _5e,A5e=new C5e;function R5e(){return Rre}var j5e={get:function(t,e){if(t!=null)return t[e]},keys:function(t){return t==null?[]:Object.keys(t)}},N5e={set:function(t,e,r){t!=null&&(t[e]=r)}},Q5e=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},M5e=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))},D5e=(function(){function t(){}return t.prototype.active=function(){return Wh},t.prototype.with=function(e,r,n){for(var i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return r.call.apply(r,M5e([n],Q5e(i),!1))},t.prototype.bind=function(e,r){return r},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t})(),L5e=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},q5e=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))},mI="context",z5e=new D5e,bk=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(e){return wb(mI,e,Dc.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(e,r,n){for(var i,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return(i=this._getContextManager()).with.apply(i,q5e([e,r,n],L5e(o),!1))},t.prototype.bind=function(e,r){return this._getContextManager().bind(e,r)},t.prototype._getContextManager=function(){return cf(mI)||z5e},t.prototype.disable=function(){this._getContextManager().disable(),Sb(mI,Dc.instance())},t})(),Au;(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(Au||(Au={}));var jre="0000000000000000",Nre="00000000000000000000000000000000",Qre={traceId:Nre,spanId:jre,traceFlags:Au.NONE},Ov=(function(){function t(e){e===void 0&&(e=Qre),this._spanContext=e}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(e,r){return this},t.prototype.setAttributes=function(e){return this},t.prototype.addEvent=function(e,r){return this},t.prototype.addLink=function(e){return this},t.prototype.addLinks=function(e){return this},t.prototype.setStatus=function(e){return this},t.prototype.updateName=function(e){return this},t.prototype.end=function(e){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(e,r){},t})(),NQ=RQ("OpenTelemetry Context Key SPAN");function QQ(t){return t.getValue(NQ)||void 0}function U5e(){return QQ(bk.getInstance().active())}function MQ(t,e){return t.setValue(NQ,e)}function V5e(t){return t.deleteValue(NQ)}function F5e(t,e){return MQ(t,new Ov(e))}function Mre(t){var e;return(e=QQ(t))===null||e===void 0?void 0:e.spanContext()}var B5e=/^([0-9a-f]{32})$/i,W5e=/^[0-9a-f]{16}$/i;function Dre(t){return B5e.test(t)&&t!==Nre}function Z5e(t){return W5e.test(t)&&t!==jre}function xk(t){return Dre(t.traceId)&&Z5e(t.spanId)}function X5e(t){return new Ov(t)}var gI=bk.getInstance(),Lre=(function(){function t(){}return t.prototype.startSpan=function(e,r,n){n===void 0&&(n=gI.active());var i=!!r?.root;if(i)return new Ov;var o=n&&Mre(n);return G5e(o)&&xk(o)?new Ov(o):new Ov},t.prototype.startActiveSpan=function(e,r,n,i){var o,s,a;if(!(arguments.length<2)){arguments.length===2?a=r:arguments.length===3?(o=r,a=n):(o=r,s=n,a=i);var l=s??gI.active(),c=this.startSpan(e,o,l),u=MQ(l,c);return gI.with(u,a,void 0,c)}},t})();function G5e(t){return typeof t=="object"&&typeof t.spanId=="string"&&typeof t.traceId=="string"&&typeof t.traceFlags=="number"}var Y5e=new Lre,H5e=(function(){function t(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}return t.prototype.startSpan=function(e,r,n){return this._getTracer().startSpan(e,r,n)},t.prototype.startActiveSpan=function(e,r,n,i){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Y5e},t})(),J5e=(function(){function t(){}return t.prototype.getTracer=function(e,r,n){return new Lre},t})(),K5e=new J5e,_9=(function(){function t(){}return t.prototype.getTracer=function(e,r,n){var i;return(i=this.getDelegateTracer(e,r,n))!==null&&i!==void 0?i:new H5e(this,e,r,n)},t.prototype.getDelegate=function(){var e;return(e=this._delegate)!==null&&e!==void 0?e:K5e},t.prototype.setDelegate=function(e){this._delegate=e},t.prototype.getDelegateTracer=function(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(e,r,n)},t})(),N1;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(N1||(N1={}));var JA;(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(JA||(JA={}));exports.SpanStatusCode=void 0;(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(exports.SpanStatusCode||(exports.SpanStatusCode={}));var wl=bk.getInstance(),Ht=Dc.instance(),eLe=(function(){function t(){}return t.prototype.getMeter=function(e,r,n){return Rre},t})(),tLe=new eLe,yI="metrics",rLe=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(e){return wb(yI,e,Dc.instance())},t.prototype.getMeterProvider=function(){return cf(yI)||tLe},t.prototype.getMeter=function(e,r,n){return this.getMeterProvider().getMeter(e,r,n)},t.prototype.disable=function(){Sb(yI,Dc.instance())},t})(),qre=rLe.getInstance(),nLe=(function(){function t(){}return t.prototype.inject=function(e,r){},t.prototype.extract=function(e,r){return e},t.prototype.fields=function(){return[]},t})(),DQ=RQ("OpenTelemetry Baggage Key");function zre(t){return t.getValue(DQ)||void 0}function iLe(){return zre(bk.getInstance().active())}function oLe(t,e){return t.setValue(DQ,e)}function sLe(t){return t.deleteValue(DQ)}var vI="propagation",aLe=new nLe,lLe=(function(){function t(){this.createBaggage=m5e,this.getBaggage=zre,this.getActiveBaggage=iLe,this.setBaggage=oLe,this.deleteBaggage=sLe}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(e){return wb(vI,e,Dc.instance())},t.prototype.inject=function(e,r,n){return n===void 0&&(n=N5e),this._getGlobalPropagator().inject(e,r,n)},t.prototype.extract=function(e,r,n){return n===void 0&&(n=j5e),this._getGlobalPropagator().extract(e,r,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){Sb(vI,Dc.instance())},t.prototype._getGlobalPropagator=function(){return cf(vI)||aLe},t})(),bv=lLe.getInstance(),OI="trace",cLe=(function(){function t(){this._proxyTracerProvider=new _9,this.wrapSpanContext=X5e,this.isSpanContextValid=xk,this.deleteSpan=V5e,this.getSpan=QQ,this.getActiveSpan=U5e,this.getSpanContext=Mre,this.setSpan=MQ,this.setSpanContext=F5e}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(e){var r=wb(OI,this._proxyTracerProvider,Dc.instance());return r&&this._proxyTracerProvider.setDelegate(e),r},t.prototype.getTracerProvider=function(){return cf(OI)||this._proxyTracerProvider},t.prototype.getTracer=function(e,r){return this.getTracerProvider().getTracer(e,r)},t.prototype.disable=function(){Sb(OI,Dc.instance()),this._proxyTracerProvider=new _9},t})(),ns=cLe.getInstance();const Ure=RQ("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function uLe(t){return t.setValue(Ure,!0)}function LQ(t){return t.getValue(Ure)===!0}const dLe="=",Vre=";",KA=",",bI="baggage",pLe=180,fLe=4096,hLe=8192;function mLe(t){return t.reduce((e,r)=>{const n=`${e}${e!==""?KA:""}${r}`;return n.length>hLe?e:n},"")}function gLe(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=Vre+r.metadata.toString()),n})}function yLe(t){if(!t)return;const e=t.indexOf(Vre),r=e===-1?t:t.substring(0,e),n=r.indexOf(dLe);if(n<=0)return;const i=r.substring(0,n).trim(),o=r.substring(n+1).trim();if(!i||!o)return;let s,a;try{s=decodeURIComponent(i),a=decodeURIComponent(o)}catch{return}let l;if(e!==-1&&e<t.length-1){const c=t.substring(e+1);l=g5e(c)}return{key:s,value:a,metadata:l}}class vLe{inject(e,r,n){const i=bv.getBaggage(e);if(!i||LQ(e))return;const o=gLe(i).filter(a=>a.length<=fLe).slice(0,pLe),s=mLe(o);s.length>0&&n.set(r,bI,s)}extract(e,r,n){const i=n.get(r,bI),o=Array.isArray(i)?i.join(KA):i;if(!o)return e;const s={};return o.length===0||(o.split(KA).forEach(l=>{const c=yLe(l);if(c){const u={value:c.value};c.metadata&&(u.metadata=c.metadata),s[c.key]=u}}),Object.entries(s).length===0)?e:bv.setBaggage(e,bv.createBaggage(s))}fields(){return[bI]}}function xv(t){const e={};if(typeof t!="object"||t==null)return e;for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!OLe(r)){Ht.warn(`Invalid attribute key: ${r}`);continue}const n=t[r];if(!Fre(n)){Ht.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}function OLe(t){return typeof t=="string"&&t!==""}function Fre(t){return t==null?!0:Array.isArray(t)?bLe(t):Bre(typeof t)}function bLe(t){let e;for(const r of t){if(r==null)continue;const n=typeof r;if(n!==e){if(!e){if(Bre(n)){e=n;continue}return!1}return!1}}return!0}function Bre(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}function xLe(){return t=>{Ht.error(wLe(t))}}function wLe(t){return typeof t=="string"?t:JSON.stringify(SLe(t))}function SLe(t){const e={};let r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;const i=r[n];i&&(e[n]=String(i))}),r=Object.getPrototypeOf(r);return e}let _Le=xLe();function Zm(t){try{_Le(t)}catch{}}const CLe="2.6.1",xI="exception.message",kLe="exception.stacktrace",wI="exception.type",Wre="service.name",PLe="service.version",eR="telemetry.sdk.language",TLe="webjs",tR="telemetry.sdk.name",rR="telemetry.sdk.version",ILe="process.runtime.name",SI={[tR]:"opentelemetry",[ILe]:"browser",[eR]:TLe,[rR]:CLe},am=performance,$Le=9,ELe=6,ALe=Math.pow(10,ELe),Q1=Math.pow(10,$Le);function lm(t){const e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*ALe);return[r,n]}function RLe(t){const e=lm(am.timeOrigin),r=lm(typeof t=="number"?t:am.now());return Xre(e,r)}function jLe(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=Q1),[r,n]}function NLe(t){return t[0]*Q1+t[1]}function Zre(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}function C9(t){return Zre(t)||typeof t=="number"||t instanceof Date}function Xre(t,e){const r=[t[0]+e[0],t[1]+e[1]];return r[1]>=Q1&&(r[1]-=Q1,r[0]+=1),r}var dc;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(dc||(dc={}));class QLe{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(e,r,n){for(const i of this._propagators)try{i.inject(e,r,n)}catch(o){Ht.warn(`Failed to inject with ${i.constructor.name}. Err: ${o.message}`)}}extract(e,r,n){return this._propagators.reduce((i,o)=>{try{return o.extract(i,r,n)}catch(s){Ht.warn(`Failed to extract with ${o.constructor.name}. Err: ${s.message}`)}return i},e)}fields(){return this._fields.slice()}}const nR="[_0-9a-z-*/]",MLe=`[a-z]${nR}{0,255}`,DLe=`[a-z0-9]${nR}{0,240}@[a-z]${nR}{0,13}`,LLe=new RegExp(`^(?:${MLe}|${DLe})$`),qLe=/^[ -~]{0,255}[!-~]$/,zLe=/,|=/;function ULe(t){return LLe.test(t)}function VLe(t){return qLe.test(t)&&!zLe.test(t)}const k9=32,FLe=512,P9=",",T9="=";class qQ{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,r){const n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n}unset(e){const r=this._clone();return r._internalState.delete(e),r}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,r)=>(e.push(r+T9+this.get(r)),e),[]).join(P9)}_parse(e){e.length>FLe||(this._internalState=e.split(P9).reverse().reduce((r,n)=>{const i=n.trim(),o=i.indexOf(T9);if(o!==-1){const s=i.slice(0,o),a=i.slice(o+1,n.length);ULe(s)&&VLe(a)&&r.set(s,a)}return r},new Map),this._internalState.size>k9&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,k9))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const e=new qQ;return e._internalState=new Map(this._internalState),e}}const _I="traceparent",CI="tracestate",BLe="00",WLe="(?!ff)[\\da-f]{2}",ZLe="(?![0]{32})[\\da-f]{32}",XLe="(?![0]{16})[\\da-f]{16}",GLe="[\\da-f]{2}",YLe=new RegExp(`^\\s?(${WLe})-(${ZLe})-(${XLe})-(${GLe})(-.*)?\\s?$`);function HLe(t){const e=YLe.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}class JLe{inject(e,r,n){const i=ns.getSpanContext(e);if(!i||LQ(e)||!xk(i))return;const o=`${BLe}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||Au.NONE).toString(16)}`;n.set(r,_I,o),i.traceState&&n.set(r,CI,i.traceState.serialize())}extract(e,r,n){const i=n.get(r,_I);if(!i)return e;const o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;const s=HLe(o);if(!s)return e;s.isRemote=!0;const a=n.get(r,CI);if(a){const l=Array.isArray(a)?a.join(","):a;s.traceState=new qQ(typeof l=="string"?l:void 0)}return ns.setSpanContext(e,s)}fields(){return[_I,CI]}}const KLe="[object Object]",eqe="[object Null]",tqe="[object Undefined]",rqe=Function.prototype,Gre=rqe.toString,nqe=Gre.call(Object),iqe=Object.getPrototypeOf,Yre=Object.prototype,Hre=Yre.hasOwnProperty,$p=Symbol?Symbol.toStringTag:void 0,Jre=Yre.toString;function I9(t){if(!oqe(t)||sqe(t)!==KLe)return!1;const e=iqe(t);if(e===null)return!0;const r=Hre.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Gre.call(r)===nqe}function oqe(t){return t!=null&&typeof t=="object"}function sqe(t){return t==null?t===void 0?tqe:eqe:$p&&$p in Object(t)?aqe(t):lqe(t)}function aqe(t){const e=Hre.call(t,$p),r=t[$p];let n=!1;try{t[$p]=void 0,n=!0}catch{}const i=Jre.call(t);return n&&(e?t[$p]=r:delete t[$p]),i}function lqe(t){return Jre.call(t)}const cqe=20;function uqe(...t){let e=t.shift();const r=new WeakMap;for(;t.length>0;)e=Kre(e,t.shift(),0,r);return e}function kI(t){return M1(t)?t.slice():t}function Kre(t,e,r=0,n){let i;if(!(r>cqe)){if(r++,Zw(t)||Zw(e)||ene(e))i=kI(e);else if(M1(t)){if(i=t.slice(),M1(e))for(let o=0,s=e.length;o<s;o++)i.push(kI(e[o]));else if(wy(e)){const o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){const l=o[s];i[l]=kI(e[l])}}}else if(wy(t))if(wy(e)){if(!dqe(t,e))return e;i=Object.assign({},t);const o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){const l=o[s],c=e[l];if(Zw(c))typeof c>"u"?delete i[l]:i[l]=c;else{const u=i[l],d=c;if($9(t,l,n)||$9(e,l,n))delete i[l];else{if(wy(u)&&wy(d)){const p=n.get(u)||[],h=n.get(d)||[];p.push({obj:t,key:l}),h.push({obj:e,key:l}),n.set(u,p),n.set(d,h)}i[l]=Kre(i[l],c,r,n)}}}}else i=e;return i}}function $9(t,e,r){const n=r.get(t[e])||[];for(let i=0,o=n.length;i<o;i++){const s=n[i];if(s.key===e&&s.obj===t)return!0}return!1}function M1(t){return Array.isArray(t)}function ene(t){return typeof t=="function"}function wy(t){return!Zw(t)&&!M1(t)&&!ene(t)&&typeof t=="object"}function Zw(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function dqe(t,e){return!(!I9(t)||!I9(e))}class pqe{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class fqe{_isCalled=!1;_deferred=new pqe;_callback;_that;constructor(e,r){this._callback=e,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}}let A0;function hqe(){if(A0===void 0)try{const t=globalThis.process.argv0;A0=t?`unknown_service:${t}`:"unknown_service"}catch{A0="unknown_service"}return A0}const Gy=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";class D1{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){const n=new D1({},r);return n._rawAttributes=E9(e),n._asyncAttributesPending=e.filter(([i,o])=>Gy(o)).length>0,n}constructor(e,r){const n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([i,o])=>(Gy(o)&&(this._asyncAttributesPending=!0),[i,o])),this._rawAttributes=E9(this._rawAttributes),this._schemaUrl=gqe(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){const[r,n]=this._rawAttributes[e];this._rawAttributes[e]=[r,Gy(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Ht.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const e={};for(const[r,n]of this._rawAttributes){if(Gy(n)){Ht.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(e[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;const r=yqe(this,e),n=r?{schemaUrl:r}:void 0;return D1.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}}function tne(t,e){return D1.FromAttributeList(Object.entries(t),e)}function mqe(){return tne({[Wre]:hqe(),[eR]:SI[eR],[tR]:SI[tR],[rR]:SI[rR]})}function E9(t){return t.map(([e,r])=>Gy(r)?[e,r.catch(n=>{Ht.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function gqe(t){if(typeof t=="string"||t===void 0)return t;Ht.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function yqe(t,e){const r=t?.schemaUrl,n=e?.schemaUrl,i=r===void 0||r==="",o=n===void 0||n==="";if(i)return n;if(o||r===n)return r;Ht.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}const vqe="exception";class Oqe{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:exports.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){const r=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=am.now(),this._performanceOffset=r-(this._performanceStartTime+am.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(const n of e.links)this.addLink(n);this.startTime=this._getTime(e.startTime??r),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,r){if(r==null||this._isSpanEnded())return this;if(e.length===0)return Ht.warn(`Invalid attribute key: ${e}`),this;if(!Fre(r))return Ht.warn(`Invalid attribute value set for key: ${e}`),this;const{attributeCountLimit:n}=this._spanLimits,i=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&i?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(r),i&&this._attributesCount++,this)}setAttributes(e){for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.setAttribute(r,e[r]);return this}addEvent(e,r,n){if(this._isSpanEnded())return this;const{eventCountLimit:i}=this._spanLimits;if(i===0)return Ht.warn("No events allowed."),this._droppedEventsCount++,this;i!==void 0&&this.events.length>=i&&(this._droppedEventsCount===0&&Ht.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),C9(r)&&(C9(n)||(n=r),r=void 0);const o=xv(r),{attributePerEventCountLimit:s}=this._spanLimits,a={};let l=0,c=0;for(const u in o){if(!Object.prototype.hasOwnProperty.call(o,u))continue;const d=o[u];if(s!==void 0&&c>=s){l++;continue}a[u]=this._truncateToSize(d),c++}return this.events.push({name:e,attributes:a,time:this._getTime(n),droppedAttributesCount:l}),this}addLink(e){if(this._isSpanEnded())return this;const{linkCountLimit:r}=this._spanLimits;if(r===0)return this._droppedLinksCount++,this;r!==void 0&&this.links.length>=r&&(this._droppedLinksCount===0&&Ht.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);const{attributePerLinkCountLimit:n}=this._spanLimits,i=xv(e.attributes),o={};let s=0,a=0;for(const c in i){if(!Object.prototype.hasOwnProperty.call(i,c))continue;const u=i[c];if(n!==void 0&&a>=n){s++;continue}o[c]=this._truncateToSize(u),a++}const l={context:e.context};return a>0&&(l.attributes=o),s>0&&(l.droppedAttributesCount=s),this.links.push(l),this}addLinks(e){for(const r of e)this.addLink(r);return this}setStatus(e){if(this._isSpanEnded())return this;if(e.code===exports.SpanStatusCode.UNSET)return this;if(this.status.code===exports.SpanStatusCode.OK)return this;const r={code:e.code};return e.code===exports.SpanStatusCode.ERROR&&(typeof e.message=="string"?r.message=e.message:e.message!=null&&Ht.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=r,this}updateName(e){return this._isSpanEnded()?this:(this.name=e,this)}end(e){if(this._isSpanEnded()){Ht.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=jLe(this.startTime,this.endTime),this._duration[0]<0&&(Ht.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&Ht.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&Ht.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e=="number"&&e<=am.now())return RLe(e+this._performanceOffset);if(typeof e=="number")return lm(e);if(e instanceof Date)return lm(e.getTime());if(Zre(e))return e;if(this._startTimeProvided)return lm(Date.now());const r=am.now()-this._performanceStartTime;return Xre(this.startTime,lm(r))}isRecording(){return this._ended===!1}recordException(e,r){const n={};typeof e=="string"?n[xI]=e:e&&(e.code?n[wI]=e.code.toString():e.name&&(n[wI]=e.name),e.message&&(n[xI]=e.message),e.stack&&(n[kLe]=e.stack)),n[wI]||n[xI]?this.addEvent(vqe,n,r):Ht.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){const e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);Ht.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,r){return e.length<=r?e:e.substring(0,r)}_truncateToSize(e){const r=this._attributeValueLengthLimit;return r<=0?(Ht.warn(`Attribute value limit must be positive, got ${r}`),e):typeof e=="string"?this._truncateToLimitUtil(e,r):Array.isArray(e)?e.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):e}}var Ec;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(Ec||(Ec={}));class L1{shouldSample(){return{decision:Ec.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class Sm{shouldSample(){return{decision:Ec.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class R0{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(Zm(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new Sm),this._remoteParentSampled=e.remoteParentSampled??new Sm,this._remoteParentNotSampled=e.remoteParentNotSampled??new L1,this._localParentSampled=e.localParentSampled??new Sm,this._localParentNotSampled=e.localParentNotSampled??new L1}shouldSample(e,r,n,i,o,s){const a=ns.getSpanContext(e);return!a||!xk(a)?this._root.shouldSample(e,r,n,i,o,s):a.isRemote?a.traceFlags&Au.SAMPLED?this._remoteParentSampled.shouldSample(e,r,n,i,o,s):this._remoteParentNotSampled.shouldSample(e,r,n,i,o,s):a.traceFlags&Au.SAMPLED?this._localParentSampled.shouldSample(e,r,n,i,o,s):this._localParentNotSampled.shouldSample(e,r,n,i,o,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class A9{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,r){return{decision:Dre(r)&&this._accumulate(r)<this._upperBound?Ec.RECORD_AND_SAMPLED:Ec.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!="number"||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let r=0;for(let n=0;n<e.length/8;n++){const i=n*8,o=parseInt(e.slice(i,i+8),16);r=(r^o)>>>0}return r}}var sc;(function(t){t.AlwaysOff="always_off",t.AlwaysOn="always_on",t.ParentBasedAlwaysOff="parentbased_always_off",t.ParentBasedAlwaysOn="parentbased_always_on",t.ParentBasedTraceIdRatio="parentbased_traceidratio",t.TraceIdRatio="traceidratio"})(sc||(sc={}));const R9=1;function rne(){return{sampler:nne(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function nne(){const t=sc.ParentBasedAlwaysOn;switch(t){case sc.AlwaysOn:return new Sm;case sc.AlwaysOff:return new L1;case sc.ParentBasedAlwaysOn:return new R0({root:new Sm});case sc.ParentBasedAlwaysOff:return new R0({root:new L1});case sc.TraceIdRatio:return new A9(j9());case sc.ParentBasedTraceIdRatio:return new R0({root:new A9(j9())});default:return Ht.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${sc.ParentBasedAlwaysOn}".`),new R0({root:new Sm})}}function j9(){return Ht.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${R9}.`),R9}const bqe=128,xqe=1/0;function wqe(t){const e={sampler:nne()},r=rne(),n=Object.assign({},r,e,t);return n.generalLimits=Object.assign({},r.generalLimits,t.generalLimits||{}),n.spanLimits=Object.assign({},r.spanLimits,t.spanLimits||{}),n}function Sqe(t){const e=Object.assign({},t.spanLimits);return e.attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??void 0??void 0??bqe,e.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??void 0??void 0??xqe,Object.assign({},t,{spanLimits:e})}class _qe{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,r){this._exporter=e,this._maxExportBatchSize=typeof r?.maxExportBatchSize=="number"?r.maxExportBatchSize:512,this._maxQueueSize=typeof r?.maxQueueSize=="number"?r.maxQueueSize:2048,this._scheduledDelayMillis=typeof r?.scheduledDelayMillis=="number"?r.scheduledDelayMillis:5e3,this._exportTimeoutMillis=typeof r?.exportTimeoutMillis=="number"?r.exportTimeoutMillis:3e4,this._shutdownOnce=new fqe(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(Ht.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,r){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&Au.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&Ht.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(Ht.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,r)=>{const n=[],i=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let o=0,s=i;o<s;o++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,r)=>{const n=setTimeout(()=>{r(new Error("Timeout"))},this._exportTimeoutMillis);wl.with(uLe(wl.active()),()=>{let i;this._finishedSpans.length<=this._maxExportBatchSize?(i=this._finishedSpans,this._finishedSpans=[]):i=this._finishedSpans.splice(0,this._maxExportBatchSize);const o=()=>this._exporter.export(i,a=>{clearTimeout(n),a.code===dc.SUCCESS?e():r(a.error??new Error("BatchSpanProcessor: span export failed"))});let s=null;for(let a=0,l=i.length;a<l;a++){const c=i[a];c.resource.asyncAttributesPending&&c.resource.waitForAsyncAttributes&&(s??=[],s.push(c.resource.waitForAsyncAttributes()))}s===null?o():Promise.all(s).then(o,a=>{Zm(a),r(a)})})})}_maybeStartTimer(){if(this._isExporting)return;const e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,Zm(r)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}class Cqe extends _qe{_visibilityChangeListener;_pageHideListener;constructor(e,r){super(e,r),this.onInit(r)}onInit(e){e?.disableAutoFlushOnDocumentHide!==!0&&typeof document<"u"&&(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush().catch(r=>{Zm(r)})},this._pageHideListener=()=>{this.forceFlush().catch(r=>{Zm(r)})},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){typeof document<"u"&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}}const kqe=16,Pqe=8,N9=new Uint8Array(kqe),Q9=new Uint8Array(Pqe),Tqe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function M9(t){for(let e=0;e<t.length;e++)t[e]=Math.random()*256>>>0;for(let e=0;e<t.length;e++)if(t[e]>0)return;t[t.length-1]=1}function D9(t){let e="";for(let r=0;r<t.length;r++)e+=Tqe[t[r]];return e}class Iqe{generateTraceId(){return M9(N9),D9(N9)}generateSpanId(){return M9(Q9),D9(Q9)}}const $qe="otel.span.parent.origin",L9="otel.span.sampling_result",Eqe="otel.sdk.span.live",Aqe="otel.sdk.span.started";class Rqe{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(Aqe,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter(Eqe,{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,r){const n=Nqe(r);if(this.startedSpans.add(1,{[$qe]:jqe(e),[L9]:n}),r===Ec.NOT_RECORD)return()=>{};const i={[L9]:n};return this.liveSpans.add(1,i),()=>{this.liveSpans.add(-1,i)}}}function jqe(t){return t?t.isRemote?"remote":"local":"none"}function Nqe(t){switch(t){case Ec.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case Ec.RECORD:return"RECORD_ONLY";case Ec.NOT_RECORD:return"DROP"}}const Qqe="2.6.1";class Mqe{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,r,n,i){const o=wqe(r);this._sampler=o.sampler,this._generalLimits=o.generalLimits,this._spanLimits=o.spanLimits,this._idGenerator=r.idGenerator||new Iqe,this._resource=n,this._spanProcessor=i,this.instrumentationScope=e;const s=o.meterProvider?o.meterProvider.getMeter("@opentelemetry/sdk-trace",Qqe):R5e();this._tracerMetrics=new Rqe(s)}startSpan(e,r={},n=wl.active()){r.root&&(n=ns.deleteSpan(n));const i=ns.getSpan(n);if(LQ(n))return Ht.debug("Instrumentation suppressed, returning Noop Span"),ns.wrapSpanContext(Qre);const o=i?.spanContext(),s=this._idGenerator.generateSpanId();let a,l,c;!o||!ns.isSpanContextValid(o)?l=this._idGenerator.generateTraceId():(l=o.traceId,c=o.traceState,a=o);const u=r.kind??JA.INTERNAL,d=(r.links??[]).map(b=>({context:b.context,attributes:xv(b.attributes)})),p=xv(r.attributes),h=this._sampler.shouldSample(n,l,e,u,p,d),m=this._tracerMetrics.startSpan(o,h.decision);c=h.traceState??c;const g=h.decision===N1.RECORD_AND_SAMPLED?Au.SAMPLED:Au.NONE,y={traceId:l,spanId:s,traceFlags:g,traceState:c};if(h.decision===N1.NOT_RECORD)return Ht.debug("Recording is off, propagating context in a non-recording span"),ns.wrapSpanContext(y);const v=xv(Object.assign(p,h.attributes));return new Oqe({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:y,name:e,kind:u,links:d,parentSpanContext:a,attributes:v,startTime:r.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:m})}startActiveSpan(e,r,n,i){let o,s,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(o=r,a=n):(o=r,s=n,a=i);const l=s??wl.active(),c=this.startSpan(e,o,l),u=ns.setSpan(l,c);return wl.with(u,a,void 0,c)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class Dqe{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){const e=[];for(const r of this._spanProcessors)e.push(r.forceFlush());return new Promise(r=>{Promise.all(e).then(()=>{r()}).catch(n=>{Zm(n||new Error("MultiSpanProcessor: forceFlush failed")),r()})})}onStart(e,r){for(const n of this._spanProcessors)n.onStart(e,r)}onEnding(e){for(const r of this._spanProcessors)r.onEnding&&r.onEnding(e)}onEnd(e){for(const r of this._spanProcessors)r.onEnd(e)}shutdown(){const e=[];for(const r of this._spanProcessors)e.push(r.shutdown());return new Promise((r,n)=>{Promise.all(e).then(()=>{r()},n)})}}var Ep;(function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"})(Ep||(Ep={}));class Lqe{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){const r=uqe({},rne(),Sqe(e));this._resource=r.resource??mqe(),this._config=Object.assign({},r,{resource:this._resource});const n=[];e.spanProcessors?.length&&n.push(...e.spanProcessors),this._activeSpanProcessor=new Dqe(n)}getTracer(e,r,n){const i=`${e}@${r||""}:${n?.schemaUrl||""}`;return this._tracers.has(i)||this._tracers.set(i,new Mqe({name:e,version:r,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(i)}forceFlush(){const e=this._config.forceFlushTimeoutMillis,r=this._activeSpanProcessor._spanProcessors.map(n=>new Promise(i=>{let o;const s=setTimeout(()=>{i(new Error(`Span processor did not completed within timeout period of ${e} ms`)),o=Ep.timeout},e);n.forceFlush().then(()=>{clearTimeout(s),o!==Ep.timeout&&(o=Ep.resolved,i(o))}).catch(a=>{clearTimeout(s),o=Ep.error,i(a)})}));return new Promise((n,i)=>{Promise.all(r).then(o=>{const s=o.filter(a=>a!==Ep.resolved);s.length>0?i(s):n()}).catch(o=>i([o]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}class qqe{_enabled=!1;_currentContext=Wh;_bindFunction(e=Wh,r){const n=this,i=function(...o){return n.with(e,()=>r.apply(this,o))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),i}active(){return this._currentContext}bind(e,r){return e===void 0&&(e=this.active()),typeof r=="function"?this._bindFunction(e,r):r}disable(){return this._currentContext=Wh,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=Wh,this)}with(e,r,n,...i){const o=this._currentContext;this._currentContext=e||Wh;try{return r.call(n,...i)}finally{this._currentContext=o}}}function zqe(t){if(t!==null){if(t===void 0){const e=new qqe;e.enable(),wl.setGlobalContextManager(e);return}t.enable(),wl.setGlobalContextManager(t)}}function Uqe(t){if(t!==null){if(t===void 0){bv.setGlobalPropagator(new QLe({propagators:[new JLe,new vLe]}));return}bv.setGlobalPropagator(t)}}class Vqe extends Lqe{constructor(e={}){super(e)}register(e={}){ns.setGlobalTracerProvider(this),Uqe(e.propagator),zqe(e.contextManager)}}class Fqe{_delegate;constructor(e){this._delegate=e}export(e,r){this._delegate.export(e,r)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}class q9 extends Error{code;name="OTLPExporterError";data;constructor(e,r,n){super(e),this.data=n,this.code=r}}function Bqe(t){if(Number.isFinite(t)&&t>0)return t;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${t}')`)}function Wqe(t){if(t!=null)return async()=>t}function Zqe(t,e,r){return{timeoutMillis:Bqe(t.timeoutMillis??e.timeoutMillis??r.timeoutMillis),concurrencyLimit:t.concurrencyLimit??e.concurrencyLimit??r.concurrencyLimit,compression:t.compression??e.compression??r.compression}}function Xqe(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}class Gqe{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(e);const r=()=>{const n=this._sendingPromises.indexOf(e);this._sendingPromises.splice(n,1)};e.then(r,r)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function Yqe(t){return new Gqe(t.concurrencyLimit)}function Hqe(t){return Object.prototype.hasOwnProperty.call(t,"partialSuccess")}function Jqe(){return{handleResponse(t){t==null||!Hqe(t)||t.partialSuccess==null||Object.keys(t.partialSuccess).length===0||Ht.warn("Received Partial Success response:",JSON.stringify(t.partialSuccess))}}}class Kqe{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,r,n,i,o){this._transport=e,this._serializer=r,this._responseHandler=n,this._promiseQueue=i,this._timeout=o,this._diagLogger=Ht.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,r){if(this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()){r({code:dc.FAILED,error:new Error("Concurrent export limit reached")});return}const n=this._serializer.serializeRequest(e);if(n==null){r({code:dc.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(i=>{if(i.status==="success"){if(i.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(i.data))}catch(o){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",o,i.data)}r({code:dc.SUCCESS});return}else if(i.status==="failure"&&i.error){r({code:dc.FAILED,error:i.error});return}else i.status==="retryable"?r({code:dc.FAILED,error:i.error??new q9("Export failed with retryable status")}):r({code:dc.FAILED,error:new q9("Export failed with unknown error")})},i=>r({code:dc.FAILED,error:i})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function e4e(t,e){return new Kqe(t.transport,t.serializer,Jqe(),t.promiseHandler,e.timeout)}function t4e(t,e,r){return e4e({transport:r,serializer:e,promiseHandler:Yqe(t)},{timeout:t.timeoutMillis})}function r4e(t,e){const r={attributes:wk(t.attributes,e),droppedAttributesCount:0},n=t.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function n4e(t){return{name:t.name,version:t.version}}function wk(t,e){return Object.keys(t).map(r=>i4e(r,t[r],e))}function i4e(t,e,r){return{key:t,value:iR(e,r)}}function iR(t,e){const r=typeof t;if(r==="string")return{stringValue:t};if(r==="number")return Number.isInteger(t)?{intValue:t}:{doubleValue:t};if(r==="boolean")return{boolValue:t};if(t instanceof Uint8Array)return{bytesValue:e.encodeUint8Array(t)};if(Array.isArray(t)){const n=new Array(t.length);for(let i=0;i<t.length;i++)n[i]=iR(t[i],e);return{arrayValue:{values:n}}}if(r==="object"&&t!=null){const n=Object.keys(t),i=new Array(n.length);for(let o=0;o<n.length;o++)i[o]={key:n[o],value:iR(t[n[o]],e)};return{kvlistValue:{values:i}}}return{}}function o4e(t){const e=BigInt(1e9);return BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))}function s4e(t){return o4e(t).toString()}const a4e=typeof BigInt<"u"?s4e:NLe;function z9(t){return t}const l4e={encodeHrTime:a4e,encodeSpanContext:z9,encodeOptionalSpanContext:z9,encodeUint8Array:t=>{if(typeof Buffer<"u")return Buffer.from(t).toString("base64");const e=new Array(t.length);for(let r=0;r<t.length;r++)e[r]=String.fromCharCode(t[r]);return btoa(e.join(""))}},c4e=256,u4e=512;function ine(t,e){let r=t&255|c4e;return e&&(r|=u4e),r}function d4e(t,e){const r=t.spanContext(),n=t.status,i=t.parentSpanContext?.spanId?e.encodeSpanContext(t.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(r.traceId),spanId:e.encodeSpanContext(r.spanId),parentSpanId:i,traceState:r.traceState?.serialize(),name:t.name,kind:t.kind==null?0:t.kind+1,startTimeUnixNano:e.encodeHrTime(t.startTime),endTimeUnixNano:e.encodeHrTime(t.endTime),attributes:wk(t.attributes,e),droppedAttributesCount:t.droppedAttributesCount,events:t.events.map(o=>f4e(o,e)),droppedEventsCount:t.droppedEventsCount,status:{code:n.code,message:n.message},links:t.links.map(o=>p4e(o,e)),droppedLinksCount:t.droppedLinksCount,flags:ine(r.traceFlags,t.parentSpanContext?.isRemote)}}function p4e(t,e){return{attributes:t.attributes?wk(t.attributes,e):[],spanId:e.encodeSpanContext(t.context.spanId),traceId:e.encodeSpanContext(t.context.traceId),traceState:t.context.traceState?.serialize(),droppedAttributesCount:t.droppedAttributesCount||0,flags:ine(t.context.traceFlags,t.context.isRemote)}}function f4e(t,e){return{attributes:t.attributes?wk(t.attributes,e):[],name:t.name,timeUnixNano:e.encodeHrTime(t.time),droppedAttributesCount:t.droppedAttributesCount||0}}function h4e(t,e){return{resourceSpans:g4e(t,e)}}function m4e(t){const e=new Map;for(const r of t){let n=e.get(r.resource);n||(n=new Map,e.set(r.resource,n));const i=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`;let o=n.get(i);o||(o=[],n.set(i,o)),o.push(r)}return e}function g4e(t,e){const r=m4e(t),n=[],i=r.entries();let o=i.next();for(;!o.done;){const[s,a]=o.value,l=[],c=a.values();let u=c.next();for(;!u.done;){const h=u.value;if(h.length>0){const m=h.map(g=>d4e(g,e));l.push({scope:n4e(h[0].instrumentationScope),spans:m,schemaUrl:h[0].instrumentationScope.schemaUrl})}u=c.next()}const d=r4e(s,e),p={resource:d,scopeSpans:l,schemaUrl:d.schemaUrl};n.push(p),o=i.next()}return n}const y4e={serializeRequest:t=>{const e=h4e(t,l4e);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};const e=new TextDecoder;return JSON.parse(e.decode(t))}},PI=5,v4e=1e3,O4e=5e3,b4e=1.5,U9=.2;function x4e(){return Math.random()*(2*U9)-U9}class w4e{_transport;constructor(e){this._transport=e}retry(e,r,n){return new Promise((i,o)=>{setTimeout(()=>{this._transport.send(e,r).then(i,o)},n)})}async send(e,r){let n=PI,i=v4e;const o=Date.now()+r;let s=await this._transport.send(e,r);for(;s.status==="retryable"&&n>0;){n--;const a=Math.max(Math.min(i*(1+x4e()),O4e),0);i=i*b4e;const l=s.retryInMillis??a,c=o-Date.now();if(l>c)return Ht.info(`Export retry time ${Math.round(l)}ms exceeds remaining timeout ${Math.round(c)}ms, not retrying further.`),s;Ht.verbose(`Scheduling export retry in ${Math.round(l)}ms`),s=await this.retry(e,c,l)}return s.status==="success"?Ht.verbose(`Export succeeded after ${PI-n} retry attempts.`):s.status==="retryable"?Ht.info(`Export failed after maximum retry attempts (${PI}).`):Ht.info(`Export failed with non-retryable error: ${s.error}`),s}shutdown(){return this._transport.shutdown()}}function S4e(t){return new w4e(t.transport)}function _4e(t){return t===429||t===502||t===503||t===504}function C4e(t){if(t==null)return;const e=Number.parseInt(t,10);if(Number.isInteger(e))return e>0?e*1e3:-1;const r=new Date(t).getTime()-Date.now();return r>=0?r:0}const k4e=60*1024,P4e=9;let TI=0,j0=0;class T4e{_parameters;constructor(e){this._parameters=e}async send(e,r){const n=new AbortController,i=setTimeout(()=>n.abort(),r);let o=globalThis.fetch;typeof o.__original=="function"&&(o=o.__original);const s=e.byteLength,a=TI+s>k4e,l=j0>=P4e,c=!a&&!l;if(c)TI+=s,j0++;else{const u=a?"size limit":"count limit";Ht.debug(`keepalive disabled: ${(s/1024).toFixed(1)}KB payload, ${j0} pending (${u})`)}try{const u=new URL(this._parameters.url),d=await o(u.href,{method:"POST",headers:await this._parameters.headers(),body:e,signal:n.signal,keepalive:c,mode:globalThis.location?globalThis.location.origin===u.origin?"same-origin":"cors":"no-cors"});if(d.status>=200&&d.status<=299)return Ht.debug(`export response success (status: ${d.status})`),{status:"success"};if(_4e(d.status)){Ht.warn(`export response retryable (status: ${d.status})`);const p=d.headers.get("Retry-After");return{status:"retryable",retryInMillis:C4e(p)}}return Ht.error(`export response failure (status: ${d.status})`),{status:"failure",error:new Error(`Fetch request failed with non-retryable status ${d.status}`)}}catch(u){return $4e(u)?(Ht.warn(`export request retryable (network error: ${u})`),{status:"retryable",error:new Error("Fetch request encountered a network error",{cause:u})}):(Ht.error(`export request failure (error: ${u})`),{status:"failure",error:new Error("Fetch request errored",{cause:u})})}finally{clearTimeout(i),c&&(TI-=s,j0--)}}shutdown(){}}function I4e(t){return new T4e(t)}function $4e(t){return t instanceof TypeError&&!t.cause}function E4e(t,e){return t4e(t,e,S4e({transport:I4e(t)}))}function A4e(t){const e={};return Object.entries(t??{}).forEach(([r,n])=>{typeof n<"u"?e[r]=String(n):Ht.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),e}function R4e(t,e,r){return async()=>{const n={...await r()},i={};return e!=null&&Object.assign(i,await e()),t!=null&&Object.assign(i,A4e(await t())),Object.assign(i,n)}}function j4e(t){if(t!=null)try{const e=globalThis.location?.href;return new URL(t,e).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${t}'`)}}function N4e(t,e,r){return{...Zqe(t,e,r),headers:R4e(t.headers,e.headers,r.headers),url:j4e(t.url)??e.url??r.url}}function Q4e(t,e){return{...Xqe(),headers:async()=>t,url:"http://localhost:4318/"+e}}function M4e(t){return typeof t.headers=="function"?t.headers:Wqe(t.headers)}function D4e(t,e,r){return N4e({url:t.url,timeoutMillis:t.timeoutMillis,headers:M4e(t),concurrencyLimit:t.concurrencyLimit},{},Q4e(r,e))}function L4e(t,e,r,n){const i=D4e(t,r,n);return E4e(i,e)}class q4e extends Fqe{constructor(e={}){super(L4e(e,y4e,"v1/traces",{"Content-Type":"application/json"}))}}let one=class{emit(e){}};const z4e=new one;class U4e{getLogger(e,r,n){return new one}}const sne=new U4e;class V4e{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;const e=this._provider.getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):z4e}}class V9{getLogger(e,r,n){var i;return(i=this.getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new V4e(this,e,r,n)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:sne}setDelegate(e){this._delegate=e}getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}}const F4e=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},N0=Symbol.for("io.opentelemetry.js.api.logs"),Sy=F4e;function B4e(t,e,r){return n=>n===t?e:r}const F9=1;class zQ{constructor(){this._proxyLoggerProvider=new V9}static getInstance(){return this._instance||(this._instance=new zQ),this._instance}setGlobalLoggerProvider(e){return Sy[N0]?this.getLoggerProvider():(Sy[N0]=B4e(F9,e,sne),this._proxyLoggerProvider.setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=Sy[N0])===null||e===void 0?void 0:e.call(Sy,F9))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete Sy[N0],this._proxyLoggerProvider=new V9}}const ane=zQ.getInstance();function W4e(t,e,r,n){for(let i=0,o=t.length;i<o;i++){const s=t[i];e&&s.setTracerProvider(e),r&&s.setMeterProvider(r),n&&s.setLoggerProvider&&s.setLoggerProvider(n),s.getConfig().enabled||s.enable()}}function Z4e(t){t.forEach(e=>e.disable())}function X4e(t){const e=t.tracerProvider||ns.getTracerProvider(),r=t.meterProvider||qre.getMeterProvider(),n=t.loggerProvider||ane.getLoggerProvider(),i=t.instrumentations?.flat()??[];return W4e(i,e,r,n),()=>{Z4e(i)}}let aa=console.error.bind(console);function _y(t,e,r){const n=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:n,writable:!0,value:r})}const lne=(t,e,r)=>{if(!t||!t[e]){aa("no original function "+String(e)+" to wrap");return}if(!r){aa("no wrapper function"),aa(new Error().stack);return}const n=t[e];if(typeof n!="function"||typeof r!="function"){aa("original object and wrapper must be functions");return}const i=r(n,e);return _y(i,"__original",n),_y(i,"__unwrap",()=>{t[e]===i&&_y(t,e,n)}),_y(i,"__wrapped",!0),_y(t,e,i),i},G4e=(t,e,r)=>{if(t)Array.isArray(t)||(t=[t]);else{aa("must provide one or more modules to patch"),aa(new Error().stack);return}if(!(e&&Array.isArray(e))){aa("must provide one or more functions to wrap on modules");return}t.forEach(n=>{e.forEach(i=>{lne(n,i,r)})})},cne=(t,e)=>{if(!t||!t[e]){aa("no function to unwrap."),aa(new Error().stack);return}const r=t[e];if(!r.__unwrap)aa("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{r.__unwrap();return}},Y4e=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{aa("must provide one or more modules to patch"),aa(new Error().stack);return}if(!(e&&Array.isArray(e))){aa("must provide one or more functions to unwrap on modules");return}t.forEach(r=>{e.forEach(n=>{cne(r,n)})})};class H4e{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,r,n){this.instrumentationName=e,this.instrumentationVersion=r,this.setConfig(n),this._diag=Ht.createComponentLogger({namespace:e}),this._tracer=ns.getTracer(e,r),this._meter=qre.getMeter(e,r),this._logger=ane.getLogger(e,r),this._updateMetricInstruments()}_wrap=lne;_unwrap=cne;_massWrap=G4e;_massUnwrap=Y4e;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){const e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,r,n,i){if(e)try{e(n,i)}catch(o){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:r},o)}}}class J4e extends H4e{constructor(e,r,n){super(e,r,n),this._config.enabled&&this.enable()}}class K4e{span=void 0;constructor(e){this.span=e}get context(){return this.span?.context}error(e){this.span&&(this.span.setStatus(exports.SpanStatusCode.ERROR,e.message),this.span.recordException(e),this.span.end())}setAttribute(e,r){this.span&&this.span.setAttribute(e,r)}setStatus(e,r){this.span&&this.span.setStatus(e,r)}end(){this.span&&(this.span.setStatus(exports.SpanStatusCode.OK),this.span.end())}}const une="context",q1=[une];function Xm(t){return t.replace(/([A-Z])/g,"_$1").toLowerCase()}function dne(t){const e={updated:[],notUpdated:[]};for(const r of t){if(!r||typeof r!="object")continue;const n=r.object;if(typeof n!="string")continue;const i=r,o=e.notUpdated.find(s=>s.object===n);o?(e.updated=[o,i],e.notUpdated=e.notUpdated.filter(s=>s.object!==n)):e.updated.some(s=>s.object===n)||e.notUpdated.push(i)}return e}function z1(t,e,r){const n=r?`${r}.`:"",i=e===""?"":`${e}.`;return`${t}.${n}${i}`}function pne(t,e){const r=t[une];return r==="before"||r==="after"?r:e===0?"after":"before"}function U1(t,e,r,n=!0,i){const o=i?.length?new Set(i):null;for(const[s,a]of Object.entries(t))if(!o?.has(s)&&a!==void 0){const l=n?Xm(s):s;r[`${e}${l}`]=a}}function eze(t,e,r){for(const[n,i]of Object.entries(t))i==null||typeof i=="object"||(r[`${e}.${Xm(n)}`]=i)}function tze(t,e,r){const n=e instanceof Date?e.toISOString():new Date(e).toISOString();return{"cloudevents.event_id":t.id,"cloudevents.event_type":t.type,"cloudevents.event_source":t.source??void 0,"cloudevents.event_spec_version":t.specversion,"cloudevents.event_data_content_type":t.datacontenttype??"application/json; charset=utf-8","cloudevents.event_time":n,"cloudevents.event_subject":t.subject??"","cloudevents.page.uri":typeof location<"u"?location.href:void 0,"cloudevents.event_version":r?.version,"cloudevents.event_origin":t.origin??r?.serviceName,"cloudevents.event_env":t.env,"cloudevents.event_source_details.id":t.actor?.id??"anonymous","cloudevents.event_source_details.object":t.actor?.object??"anonymous","cloudevents.event_source_details.uri":t.actor?.uri??void 0,"cloudevents.event_client_ip":t.clientIp,"cloudevents.event_object":t.object||"event","cloudevents.event_category":t.category,"cloudevents.event_signal":t.signal,"cloudevents.event_actor.id":t.actor?.id??void 0,"cloudevents.event_actor.object":t.actor?.object??void 0,"cloudevents.event_actor.uri":t.actor?.uri??void 0,"cloudevents.event_organization_id":t.organizationId,"cloudevents.event_organization_slug":t.organizationSlug,"cloudevents.event_project_id":t.projectId,"cloudevents.event_project_slug":t.projectSlug,"cloudevents.event_request_id":t.requestId,"cloudevents.event_os_platform":t.osPlatform,"cloudevents.event_user_agent":t.userAgent,"cloudevents.event_session_id":t.sessionId}}function rze(t,e,r){const n=t.data,i={...tze(t,e,r)};return nze(n,i),lze(t,i),cze(t,i),i}function nze(t,e){!t||typeof t!="object"||(Array.isArray(t)?ize(t,e):aze(t,e))}function ize(t,e){t.some(n=>n&&typeof n=="object"&&typeof n.object=="string")?oze(t,e):sze(t,e)}function oze(t,e){const r=dne(t);r.updated.forEach((n,i)=>{const o=z1("cloudevents.event_data",n.object,pne(n,i));U1(n,o,e,!0,q1)}),r.notUpdated.forEach(n=>{const i=z1("cloudevents.event_data",n.object,void 0);U1(n,i,e,!0,q1)})}function sze(t,e){for(const r of t)if(!(!r||typeof r!="object"))for(const[n,i]of Object.entries(r)){if(i===void 0)continue;const o=Xm(n);i!==null&&typeof i=="object"&&!Array.isArray(i)?eze(i,`cloudevents.event_data.${o}`,e):e[`cloudevents.event_data.${o}`]=i}}function aze(t,e){for(const[r,n]of Object.entries(t)){if(n==null)continue;const i=Xm(r);if(typeof n=="object"&&!Array.isArray(n))for(const[o,s]of Object.entries(n))s!=null&&(typeof s=="string"||typeof s=="number"||typeof s=="boolean")&&(e[`cloudevents.event_data.${i}.${o}`]=s);else(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&(e[`cloudevents.event_data.${i}`]=n)}}function lze(t,e){if(!t.subjects||!Array.isArray(t.subjects))return;const r=dne(t.subjects);r.updated.forEach((n,i)=>{const o=z1("cloudevents.event_subjects",n.object,pne(n,i));U1(n,o,e,!1,q1)}),r.notUpdated.forEach(n=>{const i=z1("cloudevents.event_subjects",n.object,void 0);U1(n,i,e,!1,q1)})}function cze(t,e){for(const[r,n]of Object.entries(t))if(!(HDe.includes(r)||n===void 0))if(n instanceof Object)for(const[i,o]of Object.entries(n))o!==void 0&&(e[`cloudevents.${r}.${i}`]=o);else e[`cloudevents.${r}`]=n}function uze(t,e,r){return rze(t,e,r)}class dze{config=null;tracer=null;tracerProvider=null;initialized=!1;sessionId=null;initTracer(e){throw new Error("initTracer must be implemented by the environment-specific client")}init(e){this.config=e,this.initTracer(e)}send(e){try{if(!this.tracer||!this.config)return;const r=e,n="time"in r&&r.time?new Date(r.time):new Date;this.tracer.startSpan(`event.${r.type}`,{attributes:this.processAttributes(r,n),startTime:n}).end(n)}catch(r){this.config?.isProd||console.error("Event reporting failed:",r)}}processAttributes(e,r){return uze(e,r,this.config)}startSpan(e,r){try{if(!this.tracer)return;let n;const i=e.time?new Date(e.time):new Date,o=this.tracer.startSpan(`event.${e.type}`,{attributes:this.processAttributes(e,i),root:!r},r);return r||(n=ns.setSpan(wl.active(),o)),{end:()=>o.end(),setAttribute:(s,a)=>{o.setAttribute(`cloudevents.event_data.${Xm(s)}`,a)},setStatus:(s,a)=>o.setStatus({code:s,message:a}),parentCtx:n}}catch(n){this.config?.isProd||console.error("Event reporting failed:",n);return}}startStepSpan(e,r){try{if(!this.tracer)return;const n=r||wl.active(),i=e,o=i.time?new Date(i.time):new Date,s=this.tracer.startSpan(`event.${i.type}`,{attributes:this.processAttributes(i,o)},n),a=ns.setSpan(n,s);return{end:()=>s.end(),setAttribute:(l,c)=>{s.setAttribute(`cloudevents.event_data.${Xm(l)}`,c)},setStatus:(l,c)=>s.setStatus({code:l,message:c}),recordException:l=>s.recordException(l),context:a}}catch(n){this.config?.isProd||console.error("Event reporting failed:",n);return}}traceStep(e){const r=this.startStepSpan(e);if(r)return new K4e(r)}async forceFlush(){return this.tracerProvider?.forceFlush()}async shutdown(){return this.tracerProvider?.shutdown()}}class pze extends dze{tracer=null;initialized=!1;constructor(){super()}initTracer(e){if(!e.collectorUrl&&!e.collectorTraceUrl)return;const r=`ses_${Wm()}`;this.sessionId=r;const n=tne({[Wre]:e.serviceName,[PLe]:e.serviceVersion,session_id:r}),i=e.collectorTraceUrl||`${e.collectorUrl}/v1/traces`;this.tracerProvider=new Vqe({resource:n,spanProcessors:[new Cqe(new q4e({url:i,headers:{}}))]}),this.tracer=this.tracerProvider.getTracer(e.tracerName),this.tracerProvider.register(),X4e({instrumentations:e.instrumentations??[]}),this.initialized=!0}}class md extends J4e{sendErrorEvent;originalConsoleError;constructor(e,r){super("errors","1.0",e||{}),this.sendErrorEvent=r}static toErrorEvent(e,r){return{type:"error",payload:[{handler:r,errorType:md.getErrorType(e),message:md.getErrorMessage(e),stack:md.getErrorStack(e)}]}}enable(){window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this.wrapConsoleError()}disable(){window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),this.unwrapConsoleError()}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>4096?r.substring(0,4096):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=>String(i)).join(" ");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")};wrapConsoleError(){this.originalConsoleError=console.error,console.error=(...e)=>{try{const r=md.combineConsoleErrorArgs(e);this.sendError(r,"console.error")}catch(r){process.env.NODE_ENV!=="production"&&this.originalConsoleError?.call(console,"Error reporting failed:",r)}this.originalConsoleError?.apply(console,e)}}unwrapConsoleError(){this.originalConsoleError&&(console.error=this.originalConsoleError,this.originalConsoleError=void 0)}sendError(e,r){this.sendErrorEvent(md.toErrorEvent(e,r))}}class fze{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new pze,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,instrumentations:[...e.otel.enableErrorInstrumentation===!0?[new md(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 JDe({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=md.toErrorEvent(e,r);this.sendToOtelService({type:n.type,data:n.payload})}sendTabChangeMessage(e,r){this.send("tab.change",e,r)}sendButtonClickMessage(e,r){this.send("button.click",e,r)}sendTabOpenFailedMessage(e,r){this.send("tab.open_failed",e,r)}sendChangeMessage(e,r){this.send("change",e,r)}sendContentCopyMessage(e,r){this.send("content.copy",e,r)}sendRequestSendMessage(e,r){this.send("request.send",e,r)}sendTokenGenerateMessage(e,r){this.send("token.generate",e,r)}sendAppLifecycleMessage(e,r){this.send("app.lifecycle",e,r)}sendEnvironmentManagementMessage(e,r){this.send("environment.management",e,r)}sendServerManagementMessage(e,r){this.send("server.management",e,r)}sendSourceManagementMessage(e,r){this.send("source.management",e,r)}sendInputManagementMessage(e,r){this.send("input.management",e,r)}sendNodeManagementMessage(e,r){this.send("node.management",e,r)}sendHistoryManagementMessage(e,r){this.send("history.management",e,r)}sendHistoryMigrationMessage(e,r){this.send("history.migration",e,r)}sendCredentialManagementMessage(e,r){this.send("credential.management",e,r)}sendPanelToggleMessage(e,r){this.send("panel.toggle",e,r)}sendWorkflowRunClickMessage(e,r){this.send("workflow.run.click",e,r)}sendWorkflowRunResultMessage(e,r){this.send("workflow.run.result",e,r)}sendStorageReadMessage(e){this.send("storage.read",void 0,e)}sendStorageLoadUserStateMessage(e){this.send("storage.loadUserState",void 0,e)}sendStorageDetectFilesMessage(e){this.send("storage.detectFiles",void 0,e)}sendStorageLoadApisMessage(e){this.send("storage.loadApis",void 0,e)}sendStorageParseApisMessage(e){this.send("storage.parseApis",void 0,e)}sendStorageParseCollectionsMessage(e){this.send("storage.parseCollections",void 0,e)}sendUpdaterCheckMessage(e){this.send("updater.check",void 0,e)}sendUpdaterDownloadMessage(e){this.send("updater.download",void 0,e)}sendUpdaterInstallMessage(e){this.send("updater.install",void 0,e)}sendUpdaterProcessMessage(e){this.send("updater.process",void 0,e)}sendErrorMessage(e,r){this.send("error",e,r)}sendCodeEditorSearchMessage(e,r){this.send("code_editor.search",e,r)}sendAiChatToolCallStartedMessage(e,r){this.send("com.redocly.ai_chat.tool_call_started",e,r)}sendAiChatToolCallFinishedMessage(e,r){this.send("com.redocly.ai_chat.tool_call_finished",e,r)}sendAiChatConversationStartedMessage(e,r){this.send("com.redocly.ai_chat.conversation_started",e,r)}sendAiChatConversationFinishedMessage(e,r){this.send("com.redocly.ai_chat.conversation_finished",e,r)}}const Rg=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],hze="https://cors.redocly.com/";function mze(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function B9(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function W9(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?B9(Object(r),!0).forEach(function(n){mze(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):B9(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function oo(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 Z9=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),II=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ed={INIT:"@@redux/INIT"+II(),REPLACE:"@@redux/REPLACE"+II(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+II()}};function fne(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 gze(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(Oze(t))return"date";if(vze(t))return"error";var r=yze(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 yze(t){return typeof t.constructor=="function"?t.constructor.name:null}function vze(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function Oze(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function sd(t){var e=typeof t;return process.env.NODE_ENV!=="production"&&(e=gze(t)),e}function Sk(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"?oo(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"?oo(1):"Expected the enhancer to be a function. Instead, received: '"+sd(r)+"'");return r(Sk)(t,e)}if(typeof t!="function")throw new Error(process.env.NODE_ENV==="production"?oo(2):"Expected the root reducer to be a function. Instead, received: '"+sd(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"?oo(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"?oo(4):"Expected the listener to be a function. Instead, received: '"+sd(g)+"'");if(l)throw new Error(process.env.NODE_ENV==="production"?oo(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"?oo(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 O=a.indexOf(g);a.splice(O,1),s=null}}}function p(g){if(!fne(g))throw new Error(process.env.NODE_ENV==="production"?oo(7):"Actions must be plain objects. Instead, the actual type was: '"+sd(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"?oo(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"?oo(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 O=y[v];O()}return g}function h(g){if(typeof g!="function")throw new Error(process.env.NODE_ENV==="production"?oo(10):"Expected the nextReducer to be a function. Instead, received: '"+sd(g));i=g,p({type:Ed.REPLACE})}function m(){var g,y=d;return g={subscribe:function(O){if(typeof O!="object"||O===null)throw new Error(process.env.NODE_ENV==="production"?oo(11):"Expected the observer to be an object. Instead, received: '"+sd(O)+"'");function b(){O.next&&O.next(u())}b();var x=y(b);return{unsubscribe:x}}},g[Z9]=function(){return this},g}return p({type:Ed.INIT}),n={dispatch:p,subscribe:d,getState:u,replaceReducer:h},n[Z9]=m,n}var bze=Sk;function oR(t){typeof console<"u"&&typeof console.error=="function"&&console.error(t);try{throw new Error(t)}catch{}}function xze(t,e,r,n){var i=Object.keys(e),o=r&&r.type===Ed.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(i.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!fne(t))return"The "+o+' has unexpected type of "'+sd(t)+'". Expected argument to be an object with the following '+('keys: "'+i.join('", "')+'"');var s=Object.keys(t).filter(function(a){return!e.hasOwnProperty(a)&&!n[a]});if(s.forEach(function(a){n[a]=!0}),!(r&&r.type===Ed.REPLACE)&&s.length>0)return"Unexpected "+(s.length>1?"keys":"key")+" "+('"'+s.join('", "')+'" found in '+o+". ")+"Expected to find one of the known reducer keys instead: "+('"'+i.join('", "')+'". Unexpected keys will be ignored.')}function wze(t){Object.keys(t).forEach(function(e){var r=t[e],n=r(void 0,{type:Ed.INIT});if(typeof n>"u")throw new Error(process.env.NODE_ENV==="production"?oo(12):'The slice reducer for key "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:Ed.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?oo(13):'The slice reducer for key "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle '"+Ed.INIT+`' or other actions in "redux/*" `)+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}function Sze(t){for(var e=Object.keys(t),r={},n=0;n<e.length;n++){var i=e[n];process.env.NODE_ENV!=="production"&&typeof t[i]>"u"&&oR('No reducer provided for key "'+i+'"'),typeof t[i]=="function"&&(r[i]=t[i])}var o=Object.keys(r),s;process.env.NODE_ENV!=="production"&&(s={});var a;try{wze(r)}catch(l){a=l}return function(c,u){if(c===void 0&&(c={}),a)throw a;if(process.env.NODE_ENV!=="production"){var d=xze(c,r,u,s);d&&oR(d)}for(var p=!1,h={},m=0;m<o.length;m++){var g=o[m],y=r[g],v=c[g],O=y(v,u);if(typeof O>"u"){var b=u&&u.type;throw new Error(process.env.NODE_ENV==="production"?oo(14):"When called with an action of type "+(b?'"'+String(b)+'"':"(unknown type)")+', the slice reducer for key "'+g+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.')}h[g]=O,p=p||O!==v}return p=p||o.length!==Object.keys(c).length,p?h:c}}function X9(t,e){return function(){return e(t.apply(this,arguments))}}function _ze(t,e){if(typeof t=="function")return X9(t,e);if(typeof t!="object"||t===null)throw new Error(process.env.NODE_ENV==="production"?oo(16):"bindActionCreators expected an object or a function, but instead received: '"+sd(t)+`'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?`);var r={};for(var n in t){var i=t[n];typeof i=="function"&&(r[n]=X9(i,e))}return r}function hne(){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 Cze(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(n){return function(){var i=n.apply(void 0,arguments),o=function(){throw new Error(process.env.NODE_ENV==="production"?oo(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},s={getState:i.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=e.map(function(l){return l(s)});return o=hne.apply(void 0,a)(i.dispatch),W9(W9({},i),{},{dispatch:o})}}}function G9(){}process.env.NODE_ENV!=="production"&&typeof G9.name=="string"&&G9.name!=="isCrushed"&&oR('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.');var kze=Object.freeze({__proto__:null,__DO_NOT_USE__ActionTypes:Ed,applyMiddleware:Cze,bindActionCreators:_ze,combineReducers:Sze,compose:hne,createStore:Sk,legacy_createStore:bze});function Pze(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Tze=Pze(kze);Tze.compose;var Ize=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(t){return t}};function $ze(t,e,r){var n=!1,i=!1,o=Sk(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,h=0,m=l.path;h<m.length;h++){var g=m[h];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})},Ize({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 Eze(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=$ze(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 Ir=(t=>(t.Normal="Normal",t.Edit="Edit",t.Draft="Draft",t))(Ir||{});const _b="default",mne=[{name:_b,inputs:[],servers:[],state:Ir.Normal}],sR={activeTabIdx:0,tabs:[]};var ac=(t=>(t.Idle="idle",t.Loading="loading",t.Success="success",t.Error="error",t))(ac||{});function Sl(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 aR(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(!aR(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)||!aR(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function Y9(t){return Object.keys(t).forEach(e=>{t[e]===void 0&&delete t[e]}),t}function xs(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 Xw(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 bh,Xl,xh,Gw;const H9="__TAURI_TO_IPC_KEY__";function gne(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}class yne{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,bh.set(this,()=>{}),Xl.set(this,0),xh.set(this,[]),this.id=gne(({message:e,id:r})=>{if(r==xs(this,Xl,"f"))for(xs(this,bh,"f").call(this,e),Xw(this,Xl,xs(this,Xl,"f")+1);xs(this,Xl,"f")in xs(this,xh,"f");){const n=xs(this,xh,"f")[xs(this,Xl,"f")];xs(this,bh,"f").call(this,n),delete xs(this,xh,"f")[xs(this,Xl,"f")],Xw(this,Xl,xs(this,Xl,"f")+1)}else xs(this,xh,"f")[r]=e})}set onmessage(e){Xw(this,bh,e)}get onmessage(){return xs(this,bh,"f")}[(bh=new WeakMap,Xl=new WeakMap,xh=new WeakMap,H9)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[H9]()}}async function tt(t,e={},r){return window.__TAURI_INTERNALS__.invoke(t,e,r)}class Aze{get rid(){return xs(this,Gw,"f")}constructor(e){Gw.set(this,void 0),Xw(this,Gw,e)}async close(){return tt("plugin:resources|close",{rid:this.rid})}}Gw=new WeakMap;function Xr(){return!!window?.__TAURI__}async function lR(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 yo={FS:"fs",WEB:"web"};var cn;(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"})(cn||(cn={}));async function Rze(){return tt("plugin:path|resolve_directory",{directory:cn.AppConfig})}async function vne(){return tt("plugin:path|resolve_directory",{directory:cn.AppData})}async function jze(){return tt("plugin:path|resolve_directory",{directory:cn.AppLocalData})}async function Nze(){return tt("plugin:path|resolve_directory",{directory:cn.AppCache})}async function Qze(){return tt("plugin:path|resolve_directory",{directory:cn.Audio})}async function Mze(){return tt("plugin:path|resolve_directory",{directory:cn.Cache})}async function Dze(){return tt("plugin:path|resolve_directory",{directory:cn.Config})}async function Lze(){return tt("plugin:path|resolve_directory",{directory:cn.Data})}async function One(){return tt("plugin:path|resolve_directory",{directory:cn.Desktop})}async function qze(){return tt("plugin:path|resolve_directory",{directory:cn.Document})}async function zze(){return tt("plugin:path|resolve_directory",{directory:cn.Download})}async function Uze(){return tt("plugin:path|resolve_directory",{directory:cn.Executable})}async function Vze(){return tt("plugin:path|resolve_directory",{directory:cn.Font})}async function Fze(){return tt("plugin:path|resolve_directory",{directory:cn.Home})}async function Bze(){return tt("plugin:path|resolve_directory",{directory:cn.LocalData})}async function Wze(){return tt("plugin:path|resolve_directory",{directory:cn.Picture})}async function Zze(){return tt("plugin:path|resolve_directory",{directory:cn.Public})}async function Xze(){return tt("plugin:path|resolve_directory",{directory:cn.Resource})}async function Gze(t){return tt("plugin:path|resolve_directory",{directory:cn.Resource,path:t})}async function Yze(){return tt("plugin:path|resolve_directory",{directory:cn.Runtime})}async function Hze(){return tt("plugin:path|resolve_directory",{directory:cn.Template})}async function Jze(){return tt("plugin:path|resolve_directory",{directory:cn.Video})}async function Kze(){return tt("plugin:path|resolve_directory",{directory:cn.AppLog})}async function e3e(){return tt("plugin:path|resolve_directory",{directory:cn.Temp})}function UQ(){return window.__TAURI_INTERNALS__.plugins.path.sep}function t3e(){return window.__TAURI_INTERNALS__.plugins.path.delimiter}async function bne(...t){return tt("plugin:path|resolve",{paths:t})}async function r3e(t){return tt("plugin:path|normalize",{path:t})}async function _m(...t){return tt("plugin:path|join",{paths:t})}async function xne(t){return tt("plugin:path|dirname",{path:t})}async function wne(t){return tt("plugin:path|extname",{path:t})}async function VQ(t,e){return tt("plugin:path|basename",{path:t,ext:e})}async function Sne(t){return tt("plugin:path|is_absolute",{path:t})}const _ne=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return cn},appCacheDir:Nze,appConfigDir:Rze,appDataDir:vne,appLocalDataDir:jze,appLogDir:Kze,audioDir:Qze,basename:VQ,cacheDir:Mze,configDir:Dze,dataDir:Lze,delimiter:t3e,desktopDir:One,dirname:xne,documentDir:qze,downloadDir:zze,executableDir:Uze,extname:wne,fontDir:Vze,homeDir:Fze,isAbsolute:Sne,join:_m,localDataDir:Bze,normalize:r3e,pictureDir:Wze,publicDir:Zze,resolve:bne,resolveResource:Gze,resourceDir:Xze,runtimeDir:Yze,sep:UQ,tempDir:e3e,templateDir:Hze,videoDir:Jze},Symbol.toStringTag,{value:"Module"}));var cR;(function(t){t[t.Start=0]="Start",t[t.Current=1]="Current",t[t.End=2]="End"})(cR||(cR={}));function FQ(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 BQ extends Aze{async read(e){if(e.byteLength===0)return 0;const[r,n]=await tt("plugin:fs|read",{rid:this.rid,len:e.byteLength});return e.set(r),n===0?null:n}async seek(e,r){return await tt("plugin:fs|seek",{rid:this.rid,offset:e,whence:r})}async stat(){const e=await tt("plugin:fs|fstat",{rid:this.rid});return FQ(e)}async truncate(e){await tt("plugin:fs|ftruncate",{rid:this.rid,len:e})}async write(e){return await tt("plugin:fs|write",{rid:this.rid,data:e})}}async function n3e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=await tt("plugin:fs|create",{path:t instanceof URL?t.toString():t,options:e});return new BQ(r)}async function i3e(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=await tt("plugin:fs|open",{path:t instanceof URL?t.toString():t,options:e});return new BQ(r)}async function o3e(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 tt("plugin:fs|copy_file",{fromPath:t instanceof URL?t.toString():t,toPath:e instanceof URL?e.toString():e,options:r})}async function uR(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await tt("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})}async function WQ(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await tt("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})}async function Cne(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=await tt("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 _k(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await tt("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e})}async function s3e(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 tt("plugin:fs|read_text_file_lines",{path:r,options:e}));const[n,i]=await tt("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 kne(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await tt("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})}async function Pne(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 tt("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:r})}async function a3e(t,e){const r=await tt("plugin:fs|stat",{path:t instanceof URL?t.toString():t,options:e});return FQ(r)}async function l3e(t,e){const r=await tt("plugin:fs|lstat",{path:t instanceof URL?t.toString():t,options:e});return FQ(r)}async function c3e(t,e,r){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await tt("plugin:fs|truncate",{path:t instanceof URL?t.toString():t,len:e,options:r})}async function u3e(t,e,r){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await tt("plugin:fs|write_file",e,{headers:{path:t instanceof URL?t.toString():t,options:JSON.stringify(r)}})}async function Tne(t,e,r){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");await tt("plugin:fs|write_text_file",{path:t instanceof URL?t.toString():t,data:e,options:r})}async function Ck(t,e){if(t instanceof URL&&t.protocol!=="file:")throw new TypeError("Must be a file URL.");return await tt("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})}async function Ine(t){await tt("plugin:fs|unwatch",{rid:t})}async function d3e(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 yne;o.onmessage=e;const s=await tt("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:n,onEvent:o});return()=>{Ine(s)}}async function p3e(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 yne;o.onmessage=e;const s=await tt("plugin:fs|watch",{paths:i.map(a=>a instanceof URL?a.toString():a),options:n,onEvent:o});return()=>{Ine(s)}}const kk=Object.freeze(Object.defineProperty({__proto__:null,get BaseDirectory(){return cn},FileHandle:BQ,get SeekMode(){return cR},copyFile:o3e,create:n3e,exists:Ck,lstat:l3e,mkdir:uR,open:i3e,readDir:WQ,readFile:Cne,readTextFile:_k,readTextFileLines:s3e,remove:kne,rename:Pne,stat:a3e,truncate:c3e,watch:d3e,watchImmediate:p3e,writeFile:u3e,writeTextFile:Tne},Symbol.toStringTag,{value:"Module"}));class xr{static utils=null;static async getUtils(){return xr.utils||(xr.utils=Xr()?await Promise.resolve().then(()=>require("./replay-tauri-path-IOUXbhvr.js")):await Promise.resolve().then(()=>pbe)),xr.utils}static async dirname(e){return(await xr.getUtils()).dirname(e)}static async join(...e){return(await xr.getUtils()).join(...e)}static async resolve(e){return(await xr.getUtils()).resolve(e)}static async isAbsolute(e){return(await xr.getUtils()).isAbsolute(e)}static async relative(e,r){return(await xr.getUtils()).relative(e,r)}static async extname(e){return(await xr.getUtils()).extname(e)}}class ZQ{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 f3e=new Set(["node_modules"]);class dR extends ZQ{constructor(e){super(),this.baseDir=e,this.initializeDirectory(e)}writeExcludedKeys=new Set;writeEndTimers=new Map;async initializeDirectory(e){await uR(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 WQ(e);for(const i of n)if(i.isDirectory){if(f3e.has(i.name))continue;const o=await _m(e,i.name),s=await this.getDirEntryFilesRecursively(o);r.push(...s)}else{const o=await _m(e,i.name),s=await xr.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 _k(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 Ck(r)}async set(e,r){if(!this.writeExcludedKeys.has(e)){this.emit("write-start",e);try{const n=await this.getFullPath(e),i=UQ(),o=n.split(i).slice(0,-1).join(i);await uR(o,{recursive:!0}),await Tne(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 kne(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 Pne(n,i)}async getFullPath(e){return await _m(this.baseDir,e??"")}}class h3e{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 m3e{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 $ne{constructor(e){this.storage=e}itemIds=[];async getAbsolutePath(e){return await xr.resolve(await xr.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===Ir.Draft||e.srcType!==yo.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 g3e extends $ne{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 xr.extname(r)===".json"?JSON.stringify(o,null,2):$u.dump(o)}async write(e){await this.storage.has(e.id)||await super.write(e)}}var Qi=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(Qi||{});class V1{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 y3e{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 Ene{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new y3e(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}}const v3e=`
|
|
292
292
|
`;function O3e(t,e){let r="";e.format&&e.indentBy.length>0&&(r=v3e);const n=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let o=0;o<e.stopNodes.length;o++){const s=e.stopNodes[o];typeof s=="string"?n.push(new V1(s)):s instanceof V1&&n.push(s)}const i=new Ene;return Ane(t,e,r,i,n)}function Ane(t,e,r,n,i){let o="",s=!1;if(e.maxNestedTags&&n.getDepth()>e.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(t!=null){let a=t.toString();return a=pR(a,e),a}return""}for(let a=0;a<t.length;a++){const l=t[a],c=jne(l);if(c===void 0)continue;const u=b3e(l[":@"],e);n.push(c,u);const d=w3e(n,i);if(c===e.textNodeName){let y=l[c];d||(y=e.tagValueProcessor(c,y),y=pR(y,e)),s&&(o+=r),o+=y,s=!1,n.pop();continue}else if(c===e.cdataPropName){s&&(o+=r);const y=l[c][0][e.textNodeName],v=String(y).replace(/\]\]>/g,"]]]]><![CDATA[>");o+=`<![CDATA[${v}]]>`,s=!1,n.pop();continue}else if(c===e.commentPropName){const y=l[c][0][e.textNodeName],v=String(y).replace(/--/g,"- -").replace(/-$/,"- ");o+=r+`<!--${v}-->`,s=!0,n.pop();continue}else if(c[0]==="?"){const y=J9(l[":@"],e,d),v=c==="?xml"?"":r;let O=l[c][0][e.textNodeName];O=O.length!==0?" "+O:"",o+=v+`<${c}${O}${y}?>`,s=!0,n.pop();continue}let p=r;p!==""&&(p+=e.indentBy);const h=J9(l[":@"],e,d),m=r+`<${c}${h}`;let g;d?g=Rne(l[c],e):g=Ane(l[c],e,p,n,i),e.unpairedTags.indexOf(c)!==-1?e.suppressUnpairedNode?o+=m+">":o+=m+"/>":(!g||g.length===0)&&e.suppressEmptyNode?o+=m+"/>":g&&g.endsWith(">")?o+=m+`>${g}${r}</${c}>`:(o+=m+">",g&&r!==""&&(g.includes("/>")||g.includes("</"))?o+=r+e.indentBy+g+r:o+=g,o+=`</${c}>`),s=!0,n.pop()}return o}function b3e(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]=t[i],n=!0}return n?r:null}function Rne(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=jne(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=x3e(i[":@"],e),a=Rne(i[o],e);!a||a.length===0?r+=`<${o}${s}/>`:r+=`<${o}${s}>${a}</${o}>`}}}return r}function x3e(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)}="${i}"`}return r}function jne(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 J9(t,e,r){let n="";if(t&&!e.ignoreAttributes)for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let o;r?o=t[i]:(o=e.attributeValueProcessor(i,t[i]),o=pR(o,e)),o===!0&&e.suppressBooleanAttributes?n+=` ${i.substr(e.attributeNamePrefix.length)}`:n+=` ${i.substr(e.attributeNamePrefix.length)}="${o}"`}return n}function w3e(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 pR(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 S3e(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 _3e={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:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0};function va(t){if(this.options=Object.assign({},_3e,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 V1(r)):r instanceof V1&&this.stopNodeExpressions.push(r)}this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=S3e(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=P3e),this.processTextOrObjNode=C3e,this.options.format?(this.indentate=k3e,this.tagEndChar=`>
|
|
293
293
|
`,this.newLine=`
|
|
294
294
|
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}va.prototype.build=function(t){if(this.options.preserveOrder)return O3e(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new Ene;return this.j2x(t,0,e).val}};va.prototype.j2x=function(t,e,r){let n="",i="";if(this.options.maxNestedTags&&r.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const o=this.options.jPath?r.toString():r,s=this.checkStopNode(r);for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a))if(typeof t[a]>"u")this.isAttribute(a)&&(i+="");else if(t[a]===null)this.isAttribute(a)||a===this.options.cdataPropName?i+="":a[0]==="?"?i+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(t[a]instanceof Date)i+=this.buildTextValNode(t[a],a,"",e,r);else if(typeof t[a]!="object"){const l=this.isAttribute(a);if(l&&!this.ignoreAttributesFn(l,o))n+=this.buildAttrPairStr(l,""+t[a],s);else if(!l)if(a===this.options.textNodeName){let c=this.options.tagValueProcessor(a,""+t[a]);i+=this.replaceEntitiesValue(c)}else{r.push(a);const c=this.checkStopNode(r);if(r.pop(),c){const u=""+t[a];u===""?i+=this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:i+=this.indentate(e)+"<"+a+">"+u+"</"+a+this.tagEndChar}else i+=this.buildTextValNode(t[a],a,"",e,r)}}else if(Array.isArray(t[a])){const l=t[a].length;let c="",u="";for(let d=0;d<l;d++){const p=t[a][d];if(!(typeof p>"u"))if(p===null)a[0]==="?"?i+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(typeof p=="object")if(this.options.oneListGroup){r.push(a);const h=this.j2x(p,e+1,r);r.pop(),c+=h.val,this.options.attributesGroupName&&p.hasOwnProperty(this.options.attributesGroupName)&&(u+=h.attrStr)}else c+=this.processTextOrObjNode(p,a,e,r);else if(this.options.oneListGroup){let h=this.options.tagValueProcessor(a,p);h=this.replaceEntitiesValue(h),c+=h}else{r.push(a);const h=this.checkStopNode(r);if(r.pop(),h){const m=""+p;m===""?c+=this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:c+=this.indentate(e)+"<"+a+">"+m+"</"+a+this.tagEndChar}else c+=this.buildTextValNode(p,a,"",e,r)}}this.options.oneListGroup&&(c=this.buildObjectNode(c,a,u,e)),i+=c}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const l=Object.keys(t[a]),c=l.length;for(let u=0;u<c;u++)n+=this.buildAttrPairStr(l[u],""+t[a][l[u]],s)}else i+=this.processTextOrObjNode(t[a],a,e,r);return{attrStr:n,val:i}};va.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+'="'+e+'"'};function C3e(t,e,r,n){const i=this.extractAttributes(t);if(n.push(e,i),this.checkStopNode(n)){const a=this.buildRawContent(t),l=this.buildAttributesForStopNode(t);return n.pop(),this.buildObjectNode(a,e,l,r)}const s=this.j2x(t,r+1,n);return n.pop(),t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,s.attrStr,r,n):this.buildObjectNode(s.val,e,s.attrStr,r)}va.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]=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]=t[n],r=!0)}return r?e:null};va.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};va.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};va.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;{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}};va.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};va.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};va.prototype.buildTextValNode=function(t,e,r,n,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName){const o=String(t).replace(/\]\]>/g,"]]]]><![CDATA[>");return this.indentate(n)+`<![CDATA[${o}]]>`+this.newLine}else if(this.options.commentPropName!==!1&&e===this.options.commentPropName){const o=String(t).replace(/--/g,"- -").replace(/-$/,"- ");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}}};va.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 k3e(t){return this.options.indentBy.repeat(t)}function P3e(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}const Nne=1024;let T3e=0,Ma=class{constructor(e,r){this.from=e,this.to=r}};class nr{constructor(e={}){this.id=T3e++,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=qo.match(e)),r=>{let n=e(r);return n===void 0?null:[this,n]}}}nr.closedBy=new nr({deserialize:t=>t.split(" ")});nr.openedBy=new nr({deserialize:t=>t.split(" ")});nr.group=new nr({deserialize:t=>t.split(" ")});nr.isolate=new nr({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});nr.contextHash=new nr({perNode:!0});nr.lookAhead=new nr({perNode:!0});nr.mounted=new nr({perNode:!0});class pO{constructor(e,r,n){this.tree=e,this.overlay=r,this.parser=n}static get(e){return e&&e.props&&e.props[nr.mounted.id]}}const I3e=Object.create(null);class qo{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):I3e,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new qo(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(nr.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(nr.group),o=-1;o<(i?i.length:0);o++){let s=r[o<0?n.name:i[o]];if(s)return s}}}}qo.none=new qo("",Object.create(null),0,8);class Pk{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 qo(n.name,i,n.id,n.flags):n)}return new Pk(r)}}const Q0=new WeakMap,K9=new WeakMap;var bn;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(bn||(bn={}));let wn=class fR{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=pO.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 F1(this.topNode,e)}cursorAt(e,r=0,n=0){let i=Q0.get(this)||this.topNode,o=new F1(i);return o.moveTo(e,r),Q0.set(this,o._tree),o}get topNode(){return new Ua(this,0,0,null)}resolve(e,r=0){let n=fO(Q0.get(this)||this.topNode,e,r,!1);return Q0.set(this,n),n}resolveInner(e,r=0){let n=fO(K9.get(this)||this.topNode,e,r,!0);return K9.set(this,n),n}resolveStack(e,r=0){return A3e(this,e,r)}iterate(e){let{enter:r,leave:n,from:i=0,to:o=this.length}=e,s=e.mode||0,a=(s&bn.IncludeAnonymous)>0;for(let l=this.cursor(s|bn.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:YQ(qo.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new fR(this.type,r,n,i,this.propValues),e.makeTree||((r,n,i)=>new fR(qo.none,r,n,i)))}static build(e){return R3e(e)}};wn.empty=new wn(qo.none,[],[],0);class XQ{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 XQ(this.buffer,this.index)}}class Ud{constructor(e,r,n){this.buffer=e,this.length=r,this.set=n}get type(){return qo.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&&!(Qne(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 Ud(o,s,this.set)}}function Qne(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 fO(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 Ua&&t.index<0?null:t.parent;if(!s)return t;t=s}let o=n?0:bn.IgnoreOverlays;if(n)for(let s=t,a=s.parent;a;s=a,a=s.parent)s instanceof Ua&&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 Mne{cursor(e=0){return new F1(this,e)}getChild(e,r=null,n=null){let i=eU(this,e,r,n);return i.length?i[0]:null}getChildren(e,r=null,n=null){return eU(this,e,r,n)}resolve(e,r=0){return fO(this,e,r,!1)}resolveInner(e,r=0){return fO(this,e,r,!0)}matchContext(e){return hR(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 Ua=class Yw extends Mne{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(Qne(i,n,d,d+u.length)){if(u instanceof Ud){if(o&bn.ExcludeBuffers)continue;let p=u.findChild(0,u.buffer.length,r,n-d,i);if(p>-1)return new bc(new $3e(s,u,e,d),null,p)}else if(o&bn.IncludeAnonymous||!u.type.isAnonymous||GQ(u)){let p;if(!(o&bn.IgnoreMounts)&&(p=pO.get(u))&&!p.overlay)return new Yw(p.tree,d,e,s);let h=new Yw(u,d,e,s);return o&bn.IncludeAnonymous||!h.type.isAnonymous?h:h.nextChild(r<0?u.children.length-1:0,r,n,i)}}}if(o&bn.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&bn.IgnoreOverlays)&&(i=pO.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 Yw(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 eU(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 hR(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 $3e{constructor(e,r,n,i){this.parent=e,this.buffer=r,this.index=n,this.start=i}}class bc extends Mne{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 bc(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&bn.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 bc(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 bc(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 bc(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 wn(this.type,e,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Dne(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 Ua&&r.index<0?null:r.parent,i=t.slice();return n?i[e]=n:i.splice(e,1),new E3e(i,r)}class E3e{constructor(e,r){this.heads=e,this.node=r}get next(){return Dne(this.heads)}}function A3e(t,e,r){let n=t.resolveInner(e,r),i=null;for(let o=n instanceof Ua?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=pO.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let a=new Ua(s.tree,s.overlay[0].from+o.from,-1,o);(i||(i=[n])).push(fO(a,e,r,!1))}}return i?Dne(i):n}class F1{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 Ua)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 Ua?(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&bn.ExcludeBuffers?!1:this.enterChild(1,e,r):this.yield(this._tree.enter(e,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&bn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&bn.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&bn.IncludeAnonymous||a instanceof Ud||!a.type.isAnonymous||GQ(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 bc(this.buffer,r,this.stack[i]);return this.bufferNode=new bc(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 hR(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 hR(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 GQ(t){return t.children.some(e=>e instanceof Ud||!e.type.isAnonymous||GQ(e))}function R3e(t){var e;let{buffer:r,nodeSet:n,maxBufferLength:i=Nne,reused:o=[],minRepeatType:s=n.types.length}=t,a=Array.isArray(r)?new XQ(r,r.length):r,l=n.types,c=0,u=0;function d(w,_,S,$,E,N){let{id:R,start:L,end:D,size:U}=a,F=u,ee=c;for(;U<0;)if(a.next(),U==-1){let z=o[R];S.push(z),$.push(L-w);return}else if(U==-3){c=R;return}else if(U==-4){u=R;return}else throw new RangeError(`Unrecognized record size: ${U}`);let se=l[R],re,ue,q=L-w;if(D-L<=i&&(ue=y(a.pos-_,E))){let z=new Uint16Array(ue.size-ue.skip),X=a.pos-ue.size,G=z.length;for(;a.pos>X;)G=v(ue.start,z,G);re=new Ud(z,D-ue.start,n),q=ue.start-w}else{let z=a.pos-U;a.next();let X=[],G=[],M=R>=s?R:-1,Y=0,H=D;for(;a.pos>z;)M>=0&&a.id==M&&a.size>=0?(a.end<=H-i&&(m(X,G,L,Y,a.end,H,M,F,ee),Y=X.length,H=a.end),a.next()):N>2500?p(L,z,X,G):d(L,z,X,G,M,N+1);if(M>=0&&Y>0&&Y<X.length&&m(X,G,L,Y,L,H,M,F,ee),X.reverse(),G.reverse(),M>-1&&Y>0){let B=h(se,ee);re=YQ(se,X,G,0,X.length,0,D-L,B,B)}else re=g(se,X,G,D-L,F-D,ee)}S.push(re),$.push(q)}function p(w,_,S,$){let E=[],N=0,R=-1;for(;a.pos>_;){let{id:L,start:D,end:U,size:F}=a;if(F>4)a.next();else{if(R>-1&&D<R)break;R<0&&(R=U-i),E.push(L,D,U),N++,a.next()}}if(N){let L=new Uint16Array(N*4),D=E[E.length-2];for(let U=E.length-3,F=0;U>=0;U-=3)L[F++]=E[U],L[F++]=E[U+1]-D,L[F++]=E[U+2]-D,L[F++]=F;S.push(new Ud(L,E[2]-D,n)),$.push(D-w)}}function h(w,_){return(S,$,E)=>{let N=0,R=S.length-1,L,D;if(R>=0&&(L=S[R])instanceof wn){if(!R&&L.type==w&&L.length==E)return L;(D=L.prop(nr.lookAhead))&&(N=$[R]+L.length+D)}return g(w,S,$,E,N,_)}}function m(w,_,S,$,E,N,R,L,D){let U=[],F=[];for(;w.length>$;)U.push(w.pop()),F.push(_.pop()+S-E);w.push(g(n.types[R],U,F,N-E,L-N,D)),_.push(E-S)}function g(w,_,S,$,E,N,R){if(N){let L=[nr.contextHash,N];R=R?[L].concat(R):[L]}if(E>25){let L=[nr.lookAhead,E];R=R?[L].concat(R):[L]}return new wn(w,_,S,$,R)}function y(w,_){let S=a.fork(),$=0,E=0,N=0,R=S.end-i,L={size:0,start:0,skip:0};e:for(let D=S.pos-w;S.pos>D;){let U=S.size;if(S.id==_&&U>=0){L.size=$,L.start=E,L.skip=N,N+=4,$+=4,S.next();continue}let F=S.pos-U;if(U<0||F<D||S.start<R)break;let ee=S.id>=s?4:0,se=S.start;for(S.next();S.pos>F;){if(S.size<0)if(S.size==-3)ee+=4;else break e;else S.id>=s&&(ee+=4);S.next()}E=se,$+=U,N+=ee}return(_<0||$==w)&&(L.size=$,L.start=E,L.skip=N),L.size>4?L:void 0}function v(w,_,S){let{id:$,start:E,end:N,size:R}=a;if(a.next(),R>=0&&$<s){let L=S;if(R>4){let D=a.pos-(R-4);for(;a.pos>D;)S=v(w,_,S)}_[--S]=L,_[--S]=N-w,_[--S]=E-w,_[--S]=$}else R==-3?c=$:R==-4&&(u=$);return S}let O=[],b=[];for(;a.pos>0;)d(t.start||0,t.bufferStart||0,O,b,-1,0);let x=(e=t.length)!==null&&e!==void 0?e:O.length?b[0]+O[0].length:0;return new wn(l[t.topID],O.reverse(),b.reverse(),x)}const tU=new WeakMap;function Hw(t,e){if(!t.isAnonymous||e instanceof Ud||e.type!=t)return 1;let r=tU.get(e);if(r==null){r=1;for(let n of e.children){if(n.type!=t||!(n instanceof wn)){r=1;break}r+=Hw(t,n)}tU.set(e,r)}return r}function YQ(t,e,r,n,i,o,s,a,l){let c=0;for(let m=n;m<i;m++)c+=Hw(t,e[m]);let u=Math.ceil(c*1.5/8),d=[],p=[];function h(m,g,y,v,O){for(let b=y;b<v;){let x=b,w=g[b],_=Hw(t,m[b]);for(b++;b<v;b++){let S=Hw(t,m[b]);if(_+S>=u)break;_+=S}if(b==x+1){if(_>u){let S=m[x];h(S.children,S.positions,0,S.children.length,g[x]+O);continue}d.push(m[x])}else{let S=g[b-1]+m[b-1].length-w;d.push(YQ(t,m,g,x,b,w,S,null,l))}p.push(w+O-o)}}return h(e,r,n,i,0),(a||l)(d,p,s)}class HQ{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 bc?this.setBuffer(e.context.buffer,e.index,r):e instanceof Ua&&this.map.set(e.tree,r)}get(e){return e instanceof bc?this.getBuffer(e.context.buffer,e.index):e instanceof Ua?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 Su{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 Su(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 h=Math.max(p.from,l)-c,m=Math.min(p.to,d)-c;p=h>=m?null:new Su(h,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 JQ=class{startParse(e,r,n){return typeof e=="string"&&(e=new j3e(e)),n=n?n.length?n.map(i=>new Ma(i.from,i.to)):[new Ma(0,0)]:[new Ma(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 j3e{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 N3e(t){return(e,r,n,i)=>new M3e(e,t,r,n,i)}class rU{constructor(e,r,n,i,o){this.parser=e,this.parse=r,this.overlay=n,this.target=i,this.from=o}}function nU(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class Q3e{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 mR=new nr({perNode:!0});class M3e{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 wn(n.type,n.children,n.positions,n.length,n.propValues.concat([[mR,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[nr.mounted.id]=new pO(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 q3e(this.fragments),r=null,n=null,i=new F1(new Ua(this.baseTree,this.ranges[0].from,0,null),bn.IncludeAnonymous|bn.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(h=>h.from<p&&h.to>d)&&r.ranges.push({from:d,to:p})}}a=!1}else if(n&&(s=D3e(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||L3e(i);let c=e.findMounts(i.from,o.parser);if(typeof o.overlay=="function")r=new Q3e(o.parser,o.overlay,c,this.inner.length,i.from,i.tree,r);else{let u=sU(this.ranges,o.overlay||(i.from<i.to?[new Ma(i.from,i.to)]:[]));u.length&&nU(u),(u.length||!o.overlay)&&this.inner.push(new rU(o.parser,u.length?o.parser.startParse(this.input,aU(c,u),u):o.parser.startParse(""),o.overlay?o.overlay.map(d=>new Ma(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 Ma(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=sU(this.ranges,r.ranges);c.length&&(nU(c),this.inner.splice(r.index,0,new rU(r.parser,r.parser.startParse(this.input,aU(r.mounts,c),c),r.ranges.map(u=>new Ma(u.from-r.start,u.to-r.start)),r.target,c[0].from))),r=r.prev}n&&!--n.depth&&(n=n.prev)}}}}function D3e(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 iU(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 L3e(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,h,m,g){let y=r[g],v=[],O=[];iU(s,u,y,v,O,h);let b=a[y+1],x=a[y+2];l.push(v.length);let w=g?c(y+4,a[y+3],s.set.types[a[y]],b,x-b,g-1):e.toTree();return v.push(w),O.push(b-h),iU(s,a[y+3],d,v,O,h),new wn(p,v,O,m)}i.children[o]=c(0,a.length,qo.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 Ua(d,p+t.from,u,t._tree))}}class oU{constructor(e,r){this.offset=r,this.done=!1,this.cursor=e.cursor(bn.IncludeAnonymous|bn.IgnoreMounts)}moveTo(e){let{cursor:r}=this,n=e-this.offset;for(;!this.done&&r.from<n;)r.to>=e&&r.enter(n,1,bn.IgnoreOverlays|bn.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 wn)r=r.children[0];else break}return!1}}let q3e=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(mR))!==null&&r!==void 0?r:n.to,this.inner=new oU(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(mR))!==null&&e!==void 0?e:r.to,this.inner=new oU(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(nr.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 sU(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 Ma(l.from,s),l.to>a&&r.splice(o+1,0,new Ma(a,l.to))):l.to>a?r[o--]=new Ma(a,l.to):r.splice(o--,1))}}return n}function z3e(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),h=Math.min(u,d,n);p<h&&c.push(new Ma(p,h))}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 aU(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 Ma(p.from+n,p.to+n)),d=z3e(e,u,l,c);for(let p=0,h=l;;p++){let m=p==d.length,g=m?c:d[p].from;if(g>h&&r.push(new Su(h,g,i.tree,-s,o.from>=h||o.openStart,o.to<=g||o.openEnd)),m)break;h=d[p].to}}else r.push(new Su(l,c,i.tree,-s,o.from>=s||o.openStart,o.to<=a||o.openEnd))}return r}class B1{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 B1(e,[],r,n,n,0,[],0,i?new lU(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 h=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,h,p+4,!0)}if(e&262144)this.state=this.stack[l];else{let h=this.stack[l-3];this.state=o.getGoto(h,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 B1(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 U3e(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 lU(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 lU{constructor(e,r){this.tracker=e,this.context=r,this.hash=e.strict?e.hash(r):0}}class U3e{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 W1{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 W1(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 W1(this.stack,this.pos,this.index)}}function Yy(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 Jw{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const cU=new Jw;class V3e{constructor(e,r){this.input=e,this.ranges=r,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=cU,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=cU,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 Cm{constructor(e,r){this.data=e,this.id=r}token(e,r){let{parser:n}=r.p;Lne(this.data,e,r,this.id,n.data,n.tokenPrecTable)}}Cm.prototype.contextual=Cm.prototype.fallback=Cm.prototype.extend=!1;class Z1{constructor(e,r,n){this.precTable=r,this.elseToken=n,this.data=typeof e=="string"?Yy(e):e}token(e,r){let n=e.pos,i=0;for(;;){let o=e.next<0,s=e.resolveOffset(1,1);if(Lne(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))}}Z1.prototype.contextual=Cm.prototype.fallback=Cm.prototype.extend=!1;class hi{constructor(e,r={}){this.token=e,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}}function Lne(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 h=s+3;h<c;h+=2)if((t[h+1]&a)>0){let m=t[h];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||F3e(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 h=d+p>>1,m=c+h+(h<<1),g=t[m],y=t[m+1]||65536;if(u<g)p=h;else if(u>=y)d=h+1;else{s=t[m+2],e.advance();continue e}}break}}function uU(t,e,r){for(let n=e,i;(i=t[n])!=65535;n++)if(i==r)return n-e;return-1}function F3e(t,e,r,n){let i=uU(r,n,e);return i<0||uU(r,n,t)<i}const Zs=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let $I=null;function dU(t,e,r){let n=t.cursor(bn.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 B3e{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?dU(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?dU(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 wn){if(s==e){if(s<this.safeFrom)return null;let a=s+o.length;if(a<=this.safeTo){let l=o.prop(nr.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 W3e{constructor(e,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Jw)}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 Jw,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 Jw,{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=gu(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(gu(a,c+2),r,n,i));break}a[c]==r&&(i=this.putAction(gu(a,c+1),r,n,i))}return i}}let Z3e=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 V3e(r,i),this.tokens=new W3e(e,this.stream),this.topTerm=e.top[1];let{from:o}=i[0];this.stacks=[B1.start(this,e.top[0],o)],this.fragments=n.length&&this.stream.end-o>e.bufferLength*4?new B3e(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&&G3e(i);if(s)return Zs&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw Zs&&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 Zs&&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=Zs?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(nr.contextHash)||0)==u))return e.useNode(d,p),Zs&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(d.type.id)})`),!0;if(!(d instanceof wn)||d.children.length==0||d.positions[0]>0)break;let h=d.children[0];if(h instanceof wn&&d.positions[0]==0)d=h;else break}}let a=o.stateSlot(e.state,4);if(a>0)return e.reduce(a),Zs&&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++],h=c==l.length||!n,m=h?e:e.split(),g=this.tokens.mainToken;if(m.apply(u,d,g?g.start:m.pos,p),Zs&&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"})`),h)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 pU(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=Zs?this.stackID(a)+" -> ":"";if(a.deadEnd&&(o||(o=!0,a.restart(),Zs&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,n))))continue;let d=a.split(),p=u;for(let h=0;d.forceReduce()&&h<10&&(Zs&&console.log(p+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,n));h++)Zs&&(p=this.stackID(d)+" -> ");for(let h of a.recoverByInsert(l))Zs&&console.log(u+this.stackID(h)+" (via recover-insert)"),this.advanceFully(h,n);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),Zs&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),pU(a,n)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),wn.build({buffer:W1.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=($I||($I=new WeakMap)).get(e);return r||$I.set(e,r=String.fromCodePoint(this.nextStackID++)),r+e}};function pU(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 X3e{constructor(e,r,n){this.source=e,this.flags=r,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}const EI=t=>t;class Cb{constructor(e){this.start=e.start,this.shift=e.shift||EI,this.reduce=e.reduce||EI,this.reuse=e.reuse||EI,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class kl extends JQ{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=nr[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 Pk(r.map((a,l)=>qo.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=Nne;let s=Yy(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(fU),this.states=Yy(e.states,Uint32Array),this.data=Yy(e.stateData),this.goto=Yy(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Cm(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 Z3e(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=gu(n,o+2)];else{if(n[o+1]==2)return gu(n,o+2);break}if(s==r||s==0)return gu(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=gu(this.data,o+2);else break;i=r(gu(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=gu(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(kl.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]=fU(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 X3e(e,n,i)}static deserialize(e){return new kl(e)}}function gu(t,e){return t[e]|t[e+1]<<16}function G3e(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 fU(t){if(t.external){let e=t.extend?1:0;return(r,n)=>t.external(r,n)<<1|e}return t.get}let Y3e=0,yu=class gR{constructor(e,r,n,i){this.name=e,this.set=r,this.base=n,this.modified=i,this.id=Y3e++}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 gR&&(r=e),r?.base)throw new Error("Can not derive from a modified tag");let i=new gR(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 X1(e);return n=>n.modified.indexOf(r)>-1?n:X1.get(n.base||n,n.modified.concat(r).sort((i,o)=>i.id-o.id))}},H3e=0;class X1{constructor(e){this.name=e,this.instances=[],this.id=H3e++}static get(e,r){if(!r.length)return e;let n=r[0].instances.find(a=>a.base==e&&J3e(r,a.modified));if(n)return n;let i=[],o=new yu(e.name,i,e,r);for(let a of r)a.instances.push(o);let s=K3e(r);for(let a of e.set)if(!a.modified.length)for(let l of s)i.push(X1.get(a,l));return o}}function J3e(t,e){return t.length==e.length&&t.every((r,n)=>r==e[n])}function K3e(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 zu(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 h=i[d++];if(d==i.length&&h=="!"){s=0;break}if(h!="/")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 G1(n,s,l>0?o.slice(0,l):null);e[c]=u.sort(e[c])}}return qne.add(e)}const qne=new nr;class G1{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}}G1.empty=new G1([],2,null);function zne(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 e9e(t,e){let r=null;for(let n of t){let i=n.style(e);i&&(r=r?r+" "+i:i)}return r}function t9e(t,e,r,n=0,i=t.length){let o=new r9e(n,Array.isArray(e)?e:[e],r);o.highlightRange(t.cursor(),n,i,"",o.highlighters),o.flush(i)}class r9e{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(h=>!h.scope||h.scope(s)));let c=i,u=n9e(e)||G1.empty,d=e9e(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(nr.mounted);if(p&&p.overlay){let h=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 O=y<p.overlay.length?p.overlay[y]:null,b=O?O.from+a:l,x=Math.max(r,v),w=Math.min(n,b);if(x<w&&g)for(;e.from<w&&(this.highlightRange(e,x,w,i,o),this.startSpan(Math.min(w,e.to),c),!(e.to>=b||!e.nextSibling())););if(!O||b>n)break;v=O.to+a,v>r&&(this.highlightRange(h.cursor(),Math.max(r,O.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 n9e(t){let e=t.type.prop(qne);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const st=yu.define,M0=st(),ad=st(),hU=st(ad),mU=st(ad),ld=st(),D0=st(ld),AI=st(ld),nc=st(),vp=st(nc),Gl=st(),Yl=st(),yR=st(),Cy=st(yR),L0=st(),V={comment:M0,lineComment:st(M0),blockComment:st(M0),docComment:st(M0),name:ad,variableName:st(ad),typeName:hU,tagName:st(hU),propertyName:mU,attributeName:st(mU),className:st(ad),labelName:st(ad),namespace:st(ad),macroName:st(ad),literal:ld,string:D0,docString:st(D0),character:st(D0),attributeValue:st(D0),number:AI,integer:st(AI),float:st(AI),bool:st(ld),regexp:st(ld),escape:st(ld),color:st(ld),url:st(ld),keyword:Gl,self:st(Gl),null:st(Gl),atom:st(Gl),unit:st(Gl),modifier:st(Gl),operatorKeyword:st(Gl),controlKeyword:st(Gl),definitionKeyword:st(Gl),moduleKeyword:st(Gl),operator:Yl,derefOperator:st(Yl),arithmeticOperator:st(Yl),logicOperator:st(Yl),bitwiseOperator:st(Yl),compareOperator:st(Yl),updateOperator:st(Yl),definitionOperator:st(Yl),typeOperator:st(Yl),controlOperator:st(Yl),punctuation:yR,separator:st(yR),bracket:Cy,angleBracket:st(Cy),squareBracket:st(Cy),paren:st(Cy),brace:st(Cy),content:nc,heading:vp,heading1:st(vp),heading2:st(vp),heading3:st(vp),heading4:st(vp),heading5:st(vp),heading6:st(vp),contentSeparator:st(nc),list:st(nc),quote:st(nc),emphasis:st(nc),strong:st(nc),link:st(nc),monospace:st(nc),strikethrough:st(nc),inserted:st(),deleted:st(),changed:st(),invalid:st(),meta:L0,documentMeta:st(L0),annotation:st(L0),processingInstruction:st(L0),definition:yu.defineModifier("definition"),constant:yu.defineModifier("constant"),function:yu.defineModifier("function"),standard:yu.defineModifier("standard"),local:yu.defineModifier("local"),special:yu.defineModifier("special")};for(let t in V){let e=V[t];e instanceof yu&&(e.name=t)}zne([{tag:V.link,class:"tok-link"},{tag:V.heading,class:"tok-heading"},{tag:V.emphasis,class:"tok-emphasis"},{tag:V.strong,class:"tok-strong"},{tag:V.keyword,class:"tok-keyword"},{tag:V.atom,class:"tok-atom"},{tag:V.bool,class:"tok-bool"},{tag:V.url,class:"tok-url"},{tag:V.labelName,class:"tok-labelName"},{tag:V.inserted,class:"tok-inserted"},{tag:V.deleted,class:"tok-deleted"},{tag:V.literal,class:"tok-literal"},{tag:V.string,class:"tok-string"},{tag:V.number,class:"tok-number"},{tag:[V.regexp,V.escape,V.special(V.string)],class:"tok-string2"},{tag:V.variableName,class:"tok-variableName"},{tag:V.local(V.variableName),class:"tok-variableName tok-local"},{tag:V.definition(V.variableName),class:"tok-variableName tok-definition"},{tag:V.special(V.variableName),class:"tok-variableName2"},{tag:V.definition(V.propertyName),class:"tok-propertyName tok-definition"},{tag:V.typeName,class:"tok-typeName"},{tag:V.namespace,class:"tok-namespace"},{tag:V.className,class:"tok-className"},{tag:V.macroName,class:"tok-macroName"},{tag:V.propertyName,class:"tok-propertyName"},{tag:V.operator,class:"tok-operator"},{tag:V.comment,class:"tok-comment"},{tag:V.meta,class:"tok-meta"},{tag:V.invalid,class:"tok-invalid"},{tag:V.punctuation,class:"tok-punctuation"}]);const i9e=zu({String:V.string,Number:V.number,"True False":V.bool,PropertyName:V.propertyName,Null:V.null,",":V.separator,"[ ]":V.squareBracket,"{ }":V.brace}),o9e=kl.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:[i9e],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 vR=[],Une=[];(()=>{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?Une:vR).push(r=r+t[e])})();function s9e(t){if(t<768)return!1;for(let e=0,r=vR.length;;){let n=e+r>>1;if(t<vR[n])r=n;else if(t>=Une[n])e=n+1;else return!0;if(e==r)return!1}}function gU(t){return t>=127462&&t<=127487}const yU=8205;function a9e(t,e,r=!0,n=!0){return(r?Vne:l9e)(t,e,n)}function Vne(t,e,r){if(e==t.length)return e;e&&Fne(t.charCodeAt(e))&&Bne(t.charCodeAt(e-1))&&e--;let n=RI(t,e);for(e+=vU(n);e<t.length;){let i=RI(t,e);if(n==yU||i==yU||r&&s9e(i))e+=vU(i),n=i;else if(gU(i)){let o=0,s=e-2;for(;s>=0&&gU(RI(t,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function l9e(t,e,r){for(;e>0;){let n=Vne(t,e-2,r);if(n<e)return n;e--}return 0}function RI(t,e){let r=t.charCodeAt(e);if(!Bne(r)||e+1==t.length)return r;let n=t.charCodeAt(e+1);return Fne(n)?(r-55296<<10)+(n-56320)+65536:r}function Fne(t){return t>=56320&&t<57344}function Bne(t){return t>=55296&&t<56320}function vU(t){return t<65536?1:2}class Sr{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]=Gm(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),mc.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]=Gm(this,e,r);let n=[];return this.decompose(e,r,n,0),mc.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 wv(this),o=new wv(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 wv(this,e)}iterRange(e,r=this.length){return new Wne(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 Zne(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]?Sr.empty:e.length<=32?new ai(e):mc.from(ai.split(e,[]))}}class ai extends Sr{constructor(e,r=c9e(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 u9e(i,a,n,s);i=a+1,n++}}decompose(e,r,n,i){let o=e<=0&&r>=this.length?this:new ai(OU(this.text,e,r),Math.min(r,this.length)-Math.max(0,e));if(i&1){let s=n.pop(),a=Kw(o.text,s.text.slice(),0,o.length);if(a.length<=32)n.push(new ai(a,s.length+o.length));else{let l=a.length>>1;n.push(new ai(a.slice(0,l)),new ai(a.slice(l)))}}else n.push(o)}replace(e,r,n){if(!(n instanceof ai))return super.replace(e,r,n);[e,r]=Gm(this,e,r);let i=Kw(this.text,Kw(n.text,OU(this.text,0,e)),r),o=this.length+n.length-(r-e);return i.length<=32?new ai(i,o):mc.from(ai.split(i,[]),o)}sliceString(e,r=this.length,n=`
|
|
@@ -353,7 +353,7 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function c8e(t){return t.
|
|
|
353
353
|
`];let v=-1,O=0;for(const b of y){const x=t.indexOf(b,u);if(x!==-1&&x<l.start){v=x,O=b.length;break}}if(v!==-1)d=v+O;else{const b=[`
|
|
354
354
|
`,`\r
|
|
355
355
|
`];for(const x of b){const w=t.indexOf(x,u);if(w!==-1&&w<l.start){d=w+x.length;break}}}}const g=l.start;e.push({boundaryStart:a.start,boundaryEnd:a.end,headersStart:c,headersEnd:u,bodyStart:d,bodyEnd:g,contentType:p})}return e}const Z8e=()=>Rr.fromClass(class{decorations;constructor(t){this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.viewportChanged)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){const e=t.state.doc.toString(),r=[],n=Je.mark({attributes:{style:"color: var(--color-carrot-8); font-weight: var(--font-weight-semibold);"}}),i=Je.mark({attributes:{style:"color: var(--color-blue-8);"}}),o=Je.mark({attributes:{style:"color: var(--color-purple-8);"}}),s=W8e(e),a=/^--[a-zA-Z0-9_\-\.]+(?:--)?(?:\r?\n|$)/gm,l=[];let c;for(;(c=a.exec(e))!==null;)l.push({start:c.index,end:c.index+c[0].length});for(const m of l)t.visibleRanges.some(y=>Math.max(y.from,m.start)<Math.min(y.to,m.end))&&r.push({from:m.start,to:m.end,value:n});const u=/^([a-zA-Z0-9\-]+):\s*(.+?)(?:\r?\n|$)/gm;for(const m of s){u.lastIndex=m.headersStart;let g;for(;(g=u.exec(e))!==null&&g.index<m.headersEnd;){const v=g.index+g[1].length+1+(g[2].match(/^\s*/)?.[0]?.length||0),O=g.index+g[0].length-(g[0].match(/\r?\n$/)?.[0]?.length||0);t.visibleRanges.some(x=>Math.max(x.from,v)<Math.min(x.to,O))&&O>v&&r.push({from:v,to:O,value:i})}}const d=/\[Binary\s+Data\]/gi;let p;for(;(p=d.exec(e))!==null;){const m=p.index,g=p[0].length;t.visibleRanges.some(v=>Math.max(v.from,m)<Math.min(v.to,m+g))&&r.push({from:m,to:m+g,value:o})}const h=Je.mark({attributes:{style:"color: var(--color-blue-8);"}});for(const m of s)if(m.contentType?.includes("json")){const g=e.slice(m.bodyStart,m.bodyEnd),y=g.trim();if(!y)continue;const v=g.length-g.trimStart().length,O=m.bodyStart+v;let b;try{const w=ug.create("inmemory://model.json","json",0,y),S=V8e.parseJSONDocument(w)?.root;b=F8e(S)?S:void 0}catch{b=void 0}if(!b)continue;const x=B8e(b);for(const w of x){const _=O+w.from,S=O+w.to;if(!t.visibleRanges.some(R=>Math.max(R.from,_)<Math.min(R.to,S))||!(e[_]==='"'&&e[S-1]==='"'))continue;const E=_+1,N=S-1;N<=E||r.push({from:E,to:N,value:h})}}return Je.set(r,!0)}},{decorations:t=>t.decorations}),X8e=()=>Rr.fromClass(class{decorations;constructor(t){this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.viewportChanged)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){const e=t.state.doc.toString(),r=[],n=Je.mark({attributes:{style:"color: var(--color-blue-8);"}}),i=/^([a-zA-Z0-9\-]+):\s*(.+?)(?:\r?\n|$)/gm;let o;for(;(o=i.exec(e))!==null;){let l=o.index+o[1].length+1;for(;l<e.length&&/\s/.test(e[l]);)l++;const u=o.index+o[0].length-(o[0].match(/\r?\n$/)?.[0]?.length||0);u<=l||!t.visibleRanges.some(p=>Math.max(p.from,l)<Math.min(p.to,u))||r.push({from:l,to:u,value:n})}return Je.set(r,!0)}},{decorations:t=>t.decorations}),G8e=zk({});function Y8e(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.type=="string"&&typeof e.offset=="number"&&typeof e.length=="number"}function H8e(t){const e=[];if(!t)return e;const r=[t];for(;r.length>0;){const n=r.pop();if(n.type==="property"){n.valueNode&&r.push(n.valueNode);continue}if(n.type==="string"){const i=n.offset,o=n.offset+n.length;o>i&&e.push({from:i,to:o})}if(n.children&&n.children.length)for(const i of n.children)r.push(i)}return e}const y$=()=>Rr.fromClass(class{decorations;constructor(t){this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.viewportChanged)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){const e=t.state.doc.toString(),r=[],n=Je.mark({attributes:{style:"color: var(--color-blue-8);"}}),i=Je.mark({attributes:{style:"color: var(--code-block-tokens-keyword-color); font-weight: var(--font-weight-bold);"}}),o=e.split(/\r?\n/);let s=0;for(let a=0;a<o.length;a++){const l=o[a],c=s,u=s+l.length;if(!l.trim()){s=u+(e[s+l.length]==="\r"?2:1);continue}let d=c,p=l;l.startsWith("0x1E")?(d=c+4,p=l.substring(4),r.push({from:c,to:c+4,value:i})):l.charCodeAt(0)===30&&(d=c+1,p=l.substring(1),r.push({from:c,to:c+1,value:i})),l.endsWith("0x0A")?(p=p.substring(0,p.length-4),r.push({from:u-4,to:u,value:i})):l.charCodeAt(l.length-1)===10&&(p=p.substring(0,p.length-1),r.push({from:u-1,to:u,value:i}));let h;try{const g=ug.create("inmemory://model.json","json",0,p),v=G8e.parseJSONDocument(g)?.root;h=Y8e(v)?v:void 0}catch{h=void 0}if(!h){s=u+(e[s+l.length]==="\r"?2:1);continue}const m=H8e(h);for(const g of m){const y=d+g.from,v=d+g.to;if(!t.visibleRanges.some(w=>Math.max(w.from,y)<Math.min(w.to,v))||!(e[y]==='"'&&e[v-1]==='"'))continue;const b=y+1,x=v-1;x<=b||r.push({from:b,to:x,value:n})}s=u+(e[s+l.length]==="\r"?2:1)}return Je.set(r,!0)}},{decorations:t=>t.decorations}),qg={[di.Text]:{name:"Text",extensions:[Xe.lineWrapping],stateExtensions:[U2]},[di.JSON]:{name:"JSON",extensions:[Doe(),SZe(j8e(),{delay:0,needsRefresh:t=>t.transactions.some(e=>e.effects.some(r=>r.is(Lae)))}),Moe.data.of({autocomplete:Q8e()}),N8e,Xe.lineWrapping],stateExtensions:[R8e,U8e]},[di.XML]:{name:"XML",extensions:[dZe(),Xe.lineWrapping],stateExtensions:[U2]}},qae={[di.MultipartMixed]:{name:"Multipart Mixed",extensions:[Xe.lineWrapping],stateExtensions:[Z8e]},[di.JSONL]:{name:"JSON Lines",extensions:[Xe.lineWrapping],stateExtensions:[y$]},[di.NDJSON]:{name:"NDJSON",extensions:[Doe(),Xe.lineWrapping],stateExtensions:[y$]},[di.JSONSeq]:{name:"JSON Sequence",extensions:[Xe.lineWrapping],stateExtensions:[y$]},[di.TextStream]:{name:"SSE",extensions:[Xe.lineWrapping],stateExtensions:[X8e]}},zae={[di.Image]:{name:"Image",extensions:[],stateExtensions:[]}},Uae={[di.HTML]:{name:"HTML",extensions:[z7e()],stateExtensions:[U2]}},tv={...qg,...zae,...Uae,...qae},WM={...qg,...zae,...Uae},qp={...qg,...qae},Vae={[di.FormData]:{name:"form-data",extensions:void 0},[di["application/x-www-form-urlencoded"]]:{name:"x-www-form-urlencoded",extensions:void 0}},Fae={[di.Binary]:{name:"Binary",extensions:void 0}},yf={...qg,...Vae,...Fae},J8e=Object.keys(qg),S_=Object.keys(Vae),Bae=Object.keys(Fae);function Wae(t=[],e){const r={};return t.forEach(n=>{const i=String(n[e]);r[i]||(r[i]=[]),r[i].push(n)}),r}const Qb={active:!0,key:"",value:""};function Hp(t,e){return[...t.map(n=>({id:crypto.randomUUID(),key:n.name,value:e.initializeWithInputs?`$inputs.${n.name}`:n.example?String(n.example):"",active:e.initializeWithInputs?!0:!!n.example,in:n.in,...n.allowReserved&&{allowReserved:n.allowReserved}})),Tr(e.in)]}function Mb(t,e){const[r]=t.split("?"),n=e.slice(0,-1).filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${r}${n?`?${n}`:""}`}function Qo(){return{id:crypto.randomUUID(),...Qb}}function ks(){return{id:crypto.randomUUID(),...Qb,description:""}}function Tr(t){return{...Qb,id:crypto.randomUUID(),in:t}}function Pu(){return{id:crypto.randomUUID(),...Qb,type:"text",files:null}}function ZM(){return{id:crypto.randomUUID(),...Qb,sendIn:No.URL}}function v$(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function Vk(t,e){return t.filter(r=>r.active&&r.value).map(({value:r})=>(e?Gr(r,e):r).trim())}function jd(t,e){const n=e.filter(i=>!!i).flatMap(i=>i).filter(i=>i.key&&i.active);return["path","header"].includes(t)?Array.from(new Map(n.map(i=>[i.key,i])).values()):n}function K8e(t,e){return t.map(({value:r,...n})=>({...n,value:Gr(r,e)}))}function eGe(t,e){if(!t.startsWith("$components.parameters."))return null;const r=t.replace("$components.parameters.","");return r&&e[r]||null}function Xn(t=[],e={}){const r=[];for(const n of t)if(Fp(n)){const i=eGe(n.reference,e);i&&r.push({...i,active:n.active,value:n.value||i.value})}else r.push(n);return r}function cd(t){return Object.entries(t).map(([e,r])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:r}))}function tGe(t,e){return[...t.flatMap(n=>{const i=n.schema,o=i?.fields||[];return o.length>0?o.flatMap(s=>MB(s.name,s.example,n.allowReserved)):MB(n.name,i?.example??n.example,n.allowReserved)}),Tr("query")]}function MB(t,e,r){if(e===void 0)return[O$(t,"",!1,r)];const n=V2(e,t);return n.length===0?[O$(t,"",!1,r)]:n.map(i=>O$(i.key,i.value,!0,r))}function V2(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((r,n)=>r!==null&&typeof r=="object"?V2(r,`${e}[${n}]`):[{key:e,value:String(r)}]):rGe(t)?Object.entries(t).flatMap(([r,n])=>V2(n,`${e}[${r}]`)):[{key:e,value:String(t)}]}function rGe(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function O$(t,e,r,n){return{id:crypto.randomUUID(),key:t,value:e,active:r,in:"query",...n&&{allowReserved:n}}}function nGe(t){return t.replace(/{/g,"{{").replace(/}/g,"}}")}const F2={documentedOAuth2Types:[],grantType:Se.ClientCredentials,authRequestExtraParams:[Qo()],tokenRequestExtraParams:[ZM()],[Se.ClientCredentials]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[ks()],accessToken:""},[Se.ClientCredentialsWithJwtAssertion]:{clientId:"",clientSecret:"",clientAssertion:"",tokenUrl:"",scopes:[ks()],accessToken:""},[Se.AuthorizationCode]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[ks()],codeVerifier:"",codeChallenge:"",accessToken:""},[Se.AuthorizationCodeWithPkce]:{clientId:"",clientSecret:"",tokenUrl:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[ks()],codeVerifier:"",codeChallenge:"",accessToken:""},[Se.Implicit]:{clientId:"",authorizationUrl:"",callbackUrl:"",availableScopes:[],scopes:[ks()],accessToken:""},[Se.Password]:{username:"",password:"",clientId:"",clientSecret:"",tokenUrl:"",accessToken:"",scopes:[ks()]}},iGe={securityType:ve.NoAuth,securitySchemeId:null,[ve.BasicAuth]:{username:"",password:""},[ve.JWT]:{token:""},[ve.DigestAuth]:{username:"",password:"",nc:"00000001",realm:"",nonce:"",opaque:"",qop:"",algorithm:"",cnonce:""},[ve.APIKey]:{location:sa.Header,name:"",key:""},[ve.OAuth2]:F2,[ve.OpenIDConnect]:{...F2,openIdConnectUrl:"",userInfoUrl:""}},oGe={clientCredentials:Se.ClientCredentials,clientCredentialsWithJwtAssertion:Se.ClientCredentialsWithJwtAssertion,authorizationCode:Se.AuthorizationCode,authorizationCodeWithPkce:Se.AuthorizationCodeWithPkce,implicit:Se.Implicit,password:Se.Password},B2="urn:ietf:params:oauth:client-assertion-type:jwt-bearer",sGe={[Qi.SIMPLE]:{condition:"",type:Qi.SIMPLE},[Qi.REGEX]:{condition:"",type:Qi.REGEX,context:""},[Qi.JSONPATH]:{condition:"",type:Qi.JSONPATH,context:""},[Qi.XPATH]:{condition:"",type:Qi.XPATH,context:""}};function __(){return structuredClone({type:Pn.Text,content:"",activeExampleName:"",formData:{"multipart/form-data":[Pu()],"application/x-www-form-urlencoded":[Pu()]},binary:null})}const aGe={method:"GET",url:"",security:[fa()],body:__(),queryParameters:[Qo()],headers:[Qo()],cookies:[Qo()],pathParameters:[Qo()]};function Zae(){return structuredClone(aGe)}function fa(){return Sl(iGe)}function XM(t){return Sl({id:crypto.randomUUID(),...sGe[t]})}function Xae(t,e,r){for(const n of r){const i=DB(t,n),o=DB(e,n);if(typeof i=="object"&&typeof o=="object"){if(!Xae(i,o,r))return!1}else if(i!==o)return!1}return!0}function DB(t,e){const r=e.split("/");let n=t;for(const i of r)if(n&&typeof n=="object"&&i in n)n=n[i];else return;return n}function lGe(t,e){return t.length===e.length&&t.sort().join()===e.sort().join()}function cGe(t,e){return t.every(r=>e.includes(r))}function uGe(t){switch(t){case"query":return sa.Query;case"cookie":return sa.Cookie;case"header":return sa.Header;default:return}}function dGe(t,e,r){const{security:n}=e,i=VDe(t);if(!r)return!1;const o=GM(r),s=o.map(u=>u.securityType),a=n.map(u=>u.securityType);if(!lGe(s,a))return!0;let c=[];return n.forEach(u=>{const d=u.securityType,p=u[ve.OAuth2]?.grantType,h=s.includes(d),m=o.find(O=>O.securityType===d),g=!m||Xae(u,m,fGe(d,p)),y=pGe(u,d,u[ve.OAuth2]?.grantType,i),v=!!(h&&m&&g&&y);c.push(!r.security?.length||v)}),c.includes(!1)}function pGe(t,e,r,n){if(e===ve.OAuth2&&(r===Se.AuthorizationCode||r===Se.AuthorizationCodeWithPkce||r===Se.Implicit)){const i=t[ve.OAuth2][r]?.availableScopes,o=Vk(t[ve.OAuth2][r]?.scopes,n);return cGe(o,i)}return!0}function fGe(t,e){return t===ve.APIKey?[`${ve.APIKey}/name`,`${ve.APIKey}/location`]:t===ve.OAuth2?[`${ve.OAuth2}/grantType`,...hGe(e)]:t===ve.OpenIDConnect?[`${ve.OpenIDConnect}/openIdConnectUrl`]:[]}function hGe(t){return t===Se.ClientCredentials?[`${ve.OAuth2}/${Se.ClientCredentials}/tokenUrl`]:t===Se.Password?[`${ve.OAuth2}/${Se.Password}/tokenUrl`]:t===Se.Implicit?[`${ve.OAuth2}/${Se.Implicit}/authorizationUrl`]:t===Se.AuthorizationCode?[`${ve.OAuth2}/${Se.AuthorizationCode}/tokenUrl`,`${ve.OAuth2}/${Se.AuthorizationCode}/authorizationUrl`]:t===Se.AuthorizationCodeWithPkce?[`${ve.OAuth2}/${Se.AuthorizationCodeWithPkce}/tokenUrl`,`${ve.OAuth2}/${Se.AuthorizationCodeWithPkce}/authorizationUrl`]:[]}function mGe(t){return t.map(e=>{const r=e.map(n=>n.id).join("_");return e.map(n=>({...n,schemeId:r}))})}function gGe(t){const e=t.security||[],r=e.map(n=>{let i="";const o=[];return n.forEach((s,a)=>{i=a===0?`${s.id}`:`${i}_${s.id}`,o.push(YM(s))}),{id:i,security:o}});return e.length?r:[]}function yGe(t,e){const r=t.security||[];return r?.length?Kae(r).map((n,i)=>YM(n)):[]}function GM(t){const r=(t.security||[])[0];return r?r.map(n=>YM(n)):[fa()]}function YM(t,e){const r={...fa(),securitySchemeId:t.id},n=Fk(t);r.securityType=n;const i=t.id;if(t.id&&n!==ve.NoAuth&&(r[n].schemeName=t.id),n===ve.BasicAuth&&(r[ve.BasicAuth].username||(r[ve.BasicAuth].username=zn(i+j.SecurityVariablesEnvSuffix.Username)),r[ve.BasicAuth].password||(r[ve.BasicAuth].password=zn(i+j.SecurityVariablesEnvSuffix.Password))),n===ve.DigestAuth&&(r[ve.DigestAuth].username||(r[ve.DigestAuth].username=zn(i+j.SecurityVariablesEnvSuffix.Username)),r[ve.DigestAuth].password||(r[ve.DigestAuth].password=zn(i+j.SecurityVariablesEnvSuffix.Password))),n===ve.JWT&&!r[ve.JWT].token&&(r[ve.JWT].token=zn(i+j.SecurityVariablesEnvSuffix.JWTToken)),n===ve.APIKey&&!r[ve.APIKey].key){r[ve.APIKey].name=t.name||"",r[ve.APIKey].key=zn(i+j.SecurityVariablesEnvSuffix.APIKey);const o=uGe(t.in);o&&(r[ve.APIKey].location=o)}if(n===ve.OAuth2){const o=KM(t),s=zn(i+j.SecurityVariablesEnvSuffix.Token),a=r[ve.OAuth2];a.grantType=o[0],o.forEach(l=>{l===Se.AuthorizationCode&&!a[Se.AuthorizationCode].accessToken&&(a[Se.AuthorizationCode].accessToken=s,a[Se.AuthorizationCode].clientId=zn(i+j.SecurityVariablesEnvSuffix.ClientId),a[Se.AuthorizationCode].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[Se.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[Se.AuthorizationCode].clientSecret=zn(i+j.SecurityVariablesEnvSuffix.ClientSecret),a[Se.AuthorizationCode].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[Se.AuthorizationCode].scopes=[...cd(t.flows?.authorizationCode?.scopes||{})||[],ks()]),l===Se.AuthorizationCodeWithPkce&&!a[Se.AuthorizationCodeWithPkce].accessToken&&(a[Se.AuthorizationCodeWithPkce].accessToken=s,a[Se.AuthorizationCodeWithPkce].clientId=zn(i+j.SecurityVariablesEnvSuffix.ClientId),a[Se.AuthorizationCodeWithPkce].authorizationUrl=t.flows?.authorizationCode?.authorizationUrl||"",a[Se.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||"",a[Se.AuthorizationCodeWithPkce].clientSecret=zn(i+j.SecurityVariablesEnvSuffix.ClientSecret),a[Se.AuthorizationCodeWithPkce].availableScopes=Object.keys(t.flows?.authorizationCode?.scopes||{})||[],a[Se.AuthorizationCodeWithPkce].scopes=[...cd(t.flows?.authorizationCode?.scopes||{}),ks()]),l===Se.ClientCredentials&&!a[Se.ClientCredentials].accessToken&&(a[Se.ClientCredentials].accessToken=s,a[Se.ClientCredentials].clientId=zn(i+j.SecurityVariablesEnvSuffix.ClientId),a[Se.ClientCredentials].clientSecret=zn(i+j.SecurityVariablesEnvSuffix.ClientSecret),a[Se.ClientCredentials].tokenUrl=t.flows?.clientCredentials?.tokenUrl||"",a[Se.ClientCredentials].scopes=[...cd(t.flows?.clientCredentials?.scopes||{}),ks()]),l===Se.ClientCredentialsWithJwtAssertion&&!a[Se.ClientCredentialsWithJwtAssertion].accessToken&&(a[Se.ClientCredentialsWithJwtAssertion].accessToken=s,a[Se.ClientCredentialsWithJwtAssertion].clientId=zn(i+j.SecurityVariablesEnvSuffix.ClientId),a[Se.ClientCredentialsWithJwtAssertion].clientAssertion=zn(i+j.SecurityVariablesEnvSuffix.ClientAssertion),a[Se.ClientCredentialsWithJwtAssertion].scopes=[...cd(t.flows?.clientCredentials?.scopes||{}),ks()]),l===Se.Implicit&&!a[Se.Implicit].accessToken&&(a[Se.Implicit].accessToken=s,a[Se.Implicit].clientId=zn(i+j.SecurityVariablesEnvSuffix.ClientId),a[Se.Implicit].authorizationUrl=t.flows?.implicit?.authorizationUrl||"",a[Se.Implicit].availableScopes=Object.keys(t.flows?.implicit?.scopes||{})||[],a[Se.Implicit].scopes=[...cd(t.flows?.implicit?.scopes||{}),ks()]),l===Se.Password&&!a[Se.Password].accessToken&&(a[Se.Password].accessToken=s,a[Se.Password].clientId=zn(i+j.SecurityVariablesEnvSuffix.ClientId),a[Se.Password].clientSecret=zn(i+j.SecurityVariablesEnvSuffix.ClientSecret),a[Se.Password].tokenUrl=t.flows?.password?.tokenUrl||"",a[Se.Password].scopes=[...cd(t.flows?.password?.scopes||{}),ks()])})}if(n===ve.OpenIDConnect){const o=zn(i+j.SecurityVariablesEnvSuffix.Token),s=r[ve.OpenIDConnect];s[Se.AuthorizationCode].accessToken||(s[Se.AuthorizationCode].accessToken=o,s[Se.AuthorizationCode].clientId=zn(i+j.SecurityVariablesEnvSuffix.ClientId),s[Se.AuthorizationCode].clientSecret=zn(i+j.SecurityVariablesEnvSuffix.ClientSecret),s[Se.AuthorizationCode].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),s[Se.AuthorizationCodeWithPkce].accessToken||(s[Se.AuthorizationCodeWithPkce].accessToken=o,s[Se.AuthorizationCodeWithPkce].clientId=zn(i+j.SecurityVariablesEnvSuffix.ClientId),s[Se.AuthorizationCodeWithPkce].clientSecret=zn(i+j.SecurityVariablesEnvSuffix.ClientSecret),s[Se.AuthorizationCodeWithPkce].tokenUrl=t.flows?.authorizationCode?.tokenUrl||""),s[Se.Implicit].accessToken||(s[Se.Implicit].accessToken=o,s[Se.Implicit].clientId=zn(i+j.SecurityVariablesEnvSuffix.ClientId))}return r}function Gae(t){try{const e=JSON.parse(t);return JSON.stringify(e,null,2)}catch(e){return console.error({error:e}),t}}function HM(t){try{const e=JSON.stringify(t);return e===void 0?"undefined":e}catch{return String(t)}}function Yae(t,e){return e&&e.length>0?tGe(e):Hp(t||[],{in:"query"})}function vGe(t,e=!1,r="",n){const i=Wae(t.parameters,"in"),o=Hae(t),s=GM(t),a=Yae(i.query,i.querystring);return{id:crypto.randomUUID(),name:t.name,operationId:t.operationId,collectionPath:n,apiPath:{path:t.path,method:t.method},apiId:r,isAdditionalOperation:e,request:{pathParameters:Hp(i.path||[],{in:"path"}),method:t.method.toLowerCase()==="x-query"?"QUERY":t.method.toLocaleUpperCase(),url:Mb(nGe(t.path),a),headers:Hp(i.header||[],{in:"header"}),queryParameters:a,cookies:Hp(i.cookie||[],{in:"cookie"}),body:o,security:s},response:null}}function JM(t){const e=Wae(t.parameters,"in"),r=Hae(t),n=GM(t);return{parameters:{queryParameters:Yae(e.query,e.querystring),headers:Hp(e.header||[],{in:"header"}),cookies:Hp(e.cookie||[],{in:"cookie"}),pathParameters:Hp(e.path||[],{initializeWithInputs:!0,in:"path"})},requestBody:r,security:n}}function OGe(t,e){const r=new va({format:!0});if(typeof t=="string")return e?.includes("json")?Gae(t):t;if(typeof t=="object"&&t!==null&&e?.includes("xml")){const i=Array.isArray(t)?t:{root:t};return r.build(i)}return JSON.stringify(t,null,2)}function Hae(t){const e=t.body?.mediaTypes;if(!e||!Object.keys(e).length)return __();const r=bGe(e,t),n=r?.name||"",i=!S_.includes(n)&&!Bae.includes(n),o=W2(r),a=o.find(({key:c})=>c===t.body?.activeExampleName)?.value??o[0]?.value,l=i&&a?OGe(a,n):"";return{...__(),activeExampleName:t.body?.activeExampleName||o[0]?.key||"",...r&&{type:r.name},content:l,formData:{"multipart/form-data":LB(e[di.FormData]),"application/x-www-form-urlencoded":LB(e[di["application/x-www-form-urlencoded"]])}}}function Jae(t){return t?{...(Object.keys(t?.body?.mediaTypes||{})||[]).reduce((r,n)=>(r[n]={name:n,extensions:void 0},r),{}),...yf}:yf}function LB(t){if(!t)return[Pu()];if(!t.parameters)return[Pu()];const e=t.parameters.map(r=>({id:crypto.randomUUID(),key:r.name,value:String(r.example)||"",active:!0,type:r.inputType,files:null}));return e.push(Pu()),e}function W2(t){const e=t?.examples;return Object.keys(e||{}).map(r=>{const n=e?.[r];return{name:j.isString(n?.summary)?n?.summary:n?.summary?.raw||r,key:r,value:e?.[r].value}})}function bGe(t,e){const r=Jae(e),n=Object.keys(t).find(i=>!!r[i]);return n?t[n]:null}function xGe(t){return!t?.security?.length||!t?[]:yGe(t)}function Kae(t){const e=new Set;return t.flat().filter(r=>e.has(r.id)?!1:(e.add(r.id),!0))}function Fk(t){if(t.type==="http"){if(t.scheme==="bearer")return ve.JWT;if(t.scheme==="basic")return ve.BasicAuth;if(t.scheme==="digest")return ve.DigestAuth}else{if(t.type==="apiKey")return ve.APIKey;if(t.type==="oauth2")return ve.OAuth2;if(t.type==="openIdConnect")return ve.OpenIDConnect}return ve.NoAuth}function wGe(t,e){if(t==="clientCredentials"&&e&&"x-assertionType"in e&&e["x-assertionType"]===B2)return Se.ClientCredentialsWithJwtAssertion;if(t==="authorizationCode"&&e&&"x-usePkce"in e&&e["x-usePkce"])return Se.AuthorizationCodeWithPkce;switch(t){case"implicit":return Se.Implicit;case"password":return Se.Password;case"clientCredentials":return Se.ClientCredentials;case"authorizationCode":return Se.AuthorizationCode;default:return Se.AuthorizationCode}}function SGe(t,e){const r=t?.security;if(!r?.length)return[];const o=mGe(r).flat().filter(s=>s.schemeId===e).find(s=>Fk(s)===ve.OAuth2);return KM(o)}function KM(t){return Object.entries(t?.flows||{}).map(([e,r])=>wGe(e,r)).filter(Boolean)}async function Db(t){try{const e=await Cne(t),r=await VQ(t);return{absolutePath:t,file:new File([e],r)}}catch(e){return console.error("Failed to init replay file",e),null}}async function ele(t){return(await Promise.allSettled(t.map(r=>Db(r)))).map(r=>r.status==="fulfilled"?r.value:null).filter(r=>r!==null)}function pS(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function Z2(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function _Ge(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function Ra(t){try{return new URL(t),!0}catch{return!1}}function CGe(t,e){let r;if(e.startsWith("//")){const{protocol:n}=new URL(t);r=`${n||"https:"}${e}`}else if(pS(e))r=e;else if(!e.startsWith("/"))r=Z2(t)+"/"+e;else{const n=new URL(t);n.pathname=e,r=n.toString()}return Z2(r)}function qB(t,e){let r=t;return e.forEach(({key:n,value:i,active:o})=>{i&&o&&(r=r.replaceAll(`{${n}}`,i))}),r}function tle(t,e){let r=t;return e.forEach(({name:n,value:i})=>{i&&(r=r.replaceAll(`{${n}}`,i))}),r}function kGe(t){return t.startsWith("http://")||t.startsWith("https://")}function lw({url:t,serverUrl:e,corsProxyUrl:r}){let n;if(kGe(t)||!e)n=t;else{const i=new URL(e);i.pathname=t,i.search="",i.hash="",n=i.toString()}return r?`${r}${n}`:n}async function PGe(t,e,r,n,i,o){const s=await Promise.all(t.sourceDescriptions?.map(async l=>({...l,apiId:await rle({projectPath:n,apiUrl:l.url,collectionId:e})}))),a={inputs:t.components?.inputs||{},parameters:Object.fromEntries(Object.entries(t.components?.parameters||{}).map(([l,c])=>[l,{...c,key:c.name,value:c.value,id:crypto.randomUUID(),active:!0}]))};return{...t,id:e,srcType:r,state:Ir.Normal,sourceDescriptions:s,components:a,workflows:await Promise.all(t.workflows.map(async l=>({...l,state:Ir.Normal,parameters:GB(l.parameters,l["x-replay-disabled-parameters"],t.components?.parameters),outputs:ZB(l.outputs),security:FB(l["x-security"]),steps:await Promise.all(l.steps.map(async c=>{const u=GB(c.parameters,c["x-replay-disabled-parameters"],t.components?.parameters),d=c["x-operation"]??null;d&&(d.url=Mb(d.url,u.queryParameters.filter(jl)));const p=TGe(c,s,i);let h;if(p&&o){const g=i?.find(y=>y.id===p.apiId);try{h=o(p.path,p.method,g)}catch(y){console.error("Failed to convert operation to replay value",y),h=void 0}}delete c.operationId,delete c["x-operation"];const m=await RGe(c.requestBody,n);return{...c,state:Ir.Normal,parameters:u,outputs:ZB(c.outputs),successCriteria:c.successCriteria?.map(g=>({...g,type:g.type??Qi.SIMPLE}))||[],requestBody:m,xOperation:d,security:FB(c["x-security"],h),operation:p}}))})))}}async function rle({projectPath:t,apiUrl:e,collectionId:r}){if(Ra(e))return e;if(await xr.isAbsolute(e))return await xr.relative(t,e);const n=await xr.resolve(await xr.join(t,r,"..",e));return await xr.relative(t,n)}function TGe(t,e,r){if(t["x-operation"])return null;const{path:n,method:i,apiId:o,isAdditionalOperation:s,sourceDescriptionName:a}=nle({operationPath:t.operationPath,parsedSourceDescriptions:e}),{operationId:l,apiId:c,sourceDescriptionName:u}=IGe({operationId:t.operationId,parsedSourceDescriptions:e}),d=c||o||e[0]?.apiId||"",p=r?.find(m=>m.id===d),h=u??a??void 0;if(l&&p&&!n&&!i){const m=NGe(l,p);return{apiId:d,path:m?.path??"",method:m?.method??"",operationId:l,isAdditionalOperation:m?.isAdditionalOperation??!1,sourceDescriptionName:h}}return{apiId:d,path:n??"",method:i??"",operationId:l,isAdditionalOperation:s,sourceDescriptionName:h}}function IGe({operationId:t,parsedSourceDescriptions:e}){if(!t)return{operationId:"",apiId:null,sourceDescriptionName:null};const r=t.split(".");if(r.length===1)return{operationId:t,apiId:e[0]?.apiId??"",sourceDescriptionName:null};const n=r[1],i=r.slice(2).join("."),o=e.find(({name:s})=>s===n);return{operationId:i,apiId:o?.apiId??"",sourceDescriptionName:n}}function zB(t){return"reference"in t&&typeof t.reference=="string"}function nle({operationPath:t,parsedSourceDescriptions:e}){if(!t)return{apiId:null,path:"",method:"",isAdditionalOperation:!1,sourceDescriptionName:null};try{const r=t.split("#"),n=r.length>1?r[1]:r[0],i=r.length>1?r[0]:"";if(!n)return{path:"",method:"",apiId:null,isAdditionalOperation:!1,sourceDescriptionName:null};let o=null,s=null;const a=/\$sourceDescriptions\.(.+)\.url/,l=i.match(a);if(l&&(o=l[1]),o){const h=e.find(({name:m})=>m===o);h&&(s=h.apiId)}const c=n.split("/"),u=c.pop()||"",d=c[c.length-1]==="additionalOperations";return d&&c.pop(),{path:O1.unescape(c.pop()||""),method:u.toLowerCase(),apiId:s,isAdditionalOperation:d,sourceDescriptionName:o}}catch{return{path:"",method:"",apiId:null,isAdditionalOperation:!1,sourceDescriptionName:null}}}function $Ge(t){switch(t.type){case"apiKey":return ve.APIKey;case"oauth2":return ve.OAuth2;case"openIdConnect":return ve.OpenIDConnect;case"http":return t.scheme==="basic"?ve.BasicAuth:t.scheme==="digest"?ve.DigestAuth:t.scheme==="bearer"?ve.JWT:ve.NoAuth;default:return ve.NoAuth}}function ile(t,e){const r={clientCredentials:Se.ClientCredentials,authorizationCode:Se.AuthorizationCode,implicit:Se.Implicit,password:Se.Password,clientCredentialsWithJwtAssertion:Se.ClientCredentialsWithJwtAssertion,authorizationCodeWithPkce:Se.AuthorizationCodeWithPkce};return t==="clientCredentials"&&e["x-assertionType"]==="urn:ietf:params:oauth:client-assertion-type:jwt-bearer"?Se.ClientCredentialsWithJwtAssertion:t==="authorizationCode"&&e["x-usePkce"]?Se.AuthorizationCodeWithPkce:r[t]??null}function ole(t){return{query:sa.Query,header:sa.Header,cookie:sa.Cookie}[t.toLowerCase()]||sa.Header}function EGe(t){return{body:No.Body,header:No.Header,url:No.URL}[t.toLowerCase()]||No.URL}function UB(t,e,r){return Object.keys(t).reduce((n,i)=>{const o=ile(i,t[i]);if(!o)return n;switch(o){case Se.ClientCredentials:n[o]={...r[o],clientId:e.clientId??"",clientSecret:e.clientSecret??"",clientAssertion:e.clientAssertion??"",tokenUrl:t[i].tokenUrl??"",scopes:Op(t[i].scopes,t[i]["x-replay-disabled-scopes"]),accessToken:e.accessToken??""};break;case Se.AuthorizationCode:n[o]={...r[o],clientId:e.clientId??"",clientSecret:e.clientSecret??"",tokenUrl:t[i].tokenUrl??"",authorizationUrl:t[i].authorizationUrl??"",callbackUrl:e.callbackUrl??"",availableScopes:t[i].availableScopes??[],scopes:Op(t[i].scopes,t[i]["x-replay-disabled-scopes"]),accessToken:e.accessToken??""};break;case Se.Implicit:n[o]={...r[o],clientId:e.clientId??"",authorizationUrl:t[i].authorizationUrl??"",callbackUrl:e.callbackUrl??"",availableScopes:Op(t[i].availableScopes),scopes:Op(t[i].scopes,t[i]["x-replay-disabled-scopes"]),accessToken:e.accessToken??""};break;case Se.Password:n[o]={...r[o],tokenUrl:t[i].tokenUrl??"",username:e.username??"",password:e.password??"",clientId:e.clientId??"",clientSecret:e.clientSecret??"",accessToken:e.accessToken??""};break;case Se.ClientCredentialsWithJwtAssertion:n[o]={...r[o],clientAssertion:e.clientAssertion??"",tokenUrl:t[i].tokenUrl??"",scopes:Op(t[i].scopes,t[i]["x-replay-disabled-scopes"]),clientId:e.clientId??"",clientSecret:e.clientSecret??"",accessToken:e.accessToken??""};break;case Se.AuthorizationCodeWithPkce:n[o]={...r[o],tokenUrl:t[i].tokenUrl??"",authorizationUrl:t[i].authorizationUrl??"",callbackUrl:e.callbackUrl??"",availableScopes:Op(t[i].availableScopes),scopes:Op(t[i].scopes,t[i]["x-replay-disabled-scopes"]),codeVerifier:e.codeVerifier??"",codeChallenge:e.codeChallenge??"",clientId:e.clientId??"",clientSecret:e.clientSecret??"",accessToken:e.accessToken??""};break}return n},r)}function VB(t,e,r){const i={...fa(),securityType:t},o=Object.keys(e.flows||{})[0],s=ile(o,e.flows?.[o])??Se.ClientCredentials;switch(t){case ve.BasicAuth:return{...i,[ve.BasicAuth]:{username:r.username,password:r.password,schemeName:e.id}};case ve.JWT:return{...i,[ve.JWT]:{token:r.token,schemeName:e.id}};case ve.DigestAuth:return{...i,[ve.DigestAuth]:{...i[ve.DigestAuth],username:r.username,password:r.password,schemeName:e.id}};case ve.APIKey:return{...i,[ve.APIKey]:{location:ole(e.in),name:e.name,key:r.apiKey,schemeName:e.id}};case ve.OAuth2:return{...i,[ve.OAuth2]:{...i[ve.OAuth2],...UB(e.flows||{},r||{},i[ve.OAuth2]),authRequestExtraParams:BB(r.authRequestExtraParams),tokenRequestExtraParams:WB(r.tokenRequestExtraParams),grantType:s,schemeName:e.id}};case ve.OpenIDConnect:return{...i,[ve.OpenIDConnect]:{...i[ve.OpenIDConnect],...UB(r.flows||{},r||{},i[ve.OpenIDConnect]),openIdConnectUrl:r.openIdConnectUrl,userInfoUrl:r.userInfoUrl,authRequestExtraParams:BB(r.authRequestExtraParams),tokenRequestExtraParams:WB(r.tokenRequestExtraParams),grantType:s,schemeName:e.id}};default:return i}}function AGe(t,e){return[...t.map(n=>{if("scheme"in n){const o=$Ge(n.scheme);return VB(o,n.scheme,n.values)}const i=e.find(o=>o.id===n.schemeName);if(i){const o=Fk(i),s=VB(o,i,n.values);return s.securitySchemeId=i.id,s}return fa()})]}function FB(t=[],e){const r=Kae(e?.security||[]);return t.length?AGe(t,r):[fa()]}function Op(t,e){const r=cd(t||{}),n=cd(e||{});return[...r,...n,ks()]}function BB(t){return(t||[]).map(e=>({id:crypto.randomUUID(),key:e.key??"",value:e.value??"",active:e.active??!0})).concat(Qo())}function WB(t){return(t||[]).map(e=>({id:crypto.randomUUID(),key:e.key??"",value:e.value??"",active:e.active??!0,sendIn:EGe(e.in)})).concat(ZM())}function ZB(t){if(!t)return[Qo()];const e=[];for(const r in t)e.push({id:crypto.randomUUID(),key:r,value:t[r],active:!0});return e.push(Qo()),e}const Ch={query:"queryParameters",path:"pathParameters",header:"headers",cookie:"cookies"};function XB(t,e){const r="$components.parameters.";if(t.reference.startsWith(r)){const n=t.reference.replace(r,"");return e?.[n]}}function GB(t,e,r){if(!t&&!e)return{pathParameters:[Tr("path")],queryParameters:[Tr("query")],headers:[Tr("header")],cookies:[Tr("cookie")]};const n={pathParameters:[],queryParameters:[],headers:[],cookies:[]};if(t)for(const i of t)if(zB(i)){const o=XB(i,r),s=Ch[o?.in];s&&n[s].push({reference:i.reference,active:!0,value:i.value})}else Ch[i.in]&&n[Ch[i.in]].push({id:crypto.randomUUID(),key:i.name,value:i.value,active:!0,in:i.in});if(e)for(const i of e)if(zB(i)){const o=XB(i,r),s=Ch[o?.in];s&&n[s].push({reference:i.reference,active:!1,value:i.value})}else Ch[i.in]&&n[Ch[i.in]].push({id:crypto.randomUUID(),key:i.name,value:i.value,active:!1,in:i.in});return n.pathParameters.push(Tr("path")),n.queryParameters.push(Tr("query")),n.headers.push(Tr("header")),n.cookies.push(Tr("cookie")),n}async function RGe(t,e){const r=Zae().body;if(!t)return r;switch(t.contentType){case"application/x-www-form-urlencoded":case"multipart/form-data":return{...r,type:t.contentType,formData:await jGe(t,e)};case"application/octet-stream":const n=t.payload?await sle(t.payload,e):[],i=n.length>0?await Db(n[0]):null;return{...r,type:t.contentType,binary:i};case"application/json":case"application/ld+json":return{...r,type:t.contentType,content:HB(t.payload)};default:{const o=typeof t.payload=="string",s=t.contentType||(o?"text/plain":"application/json");return{...r,type:s,content:o?t.payload:HB(t.payload)}}}}async function YB(t,e,r,n){const i=await sle(e,n),o=i.length>0||Array.isArray(e),s=o?await ele(i):void 0;return{id:crypto.randomUUID(),key:t,value:o?"":e,type:o?"file":"text",active:r,files:s}}async function jGe(t,e){const r=Zae().body.formData,n=t.contentType,i=t.payload?await Promise.all(Object.entries(t.payload).map(([a,l])=>YB(a,l,!0,e))):[],o=t["x-replay-disabled-payload"]?await Promise.all(Object.entries(t["x-replay-disabled-payload"]||{}).map(([a,l])=>YB(a,l,!1,e))):[];return{...r,[n]:[...i,...o,Pu()]}}function HB(t){return t?typeof t=="string"?t:JSON.stringify(t,null,2):""}function NGe(t,e){for(const r of Object.keys(e.paths)){const n=e.paths[r];for(const i of Object.keys(n)){const o=i.toLowerCase();if(["get","put","post","delete","options","head","patch","trace"].includes(o)&&n[o]?.operationId===t)return{method:o,path:r,isAdditionalOperation:!1}}if(n.additionalOperations){for(const[i,o]of Object.entries(n.additionalOperations))if(o?.operationId===t)return{method:i.toLowerCase(),path:r,isAdditionalOperation:!0}}}return null}async function sle(t,e){return Array.isArray(t)?(await Promise.all(t.map(r=>JB(r,e)))).flat():typeof t=="string"?await JB(t,e):[]}async function JB(t,e){const r=/\$file\(['"](.+?)['"]\)/g,n=Array.from(t.matchAll(r));return Promise.all(n.map(i=>QGe(i[1],e)))}async function QGe(t,e){return await xr.isAbsolute(t)?t:await xr.resolve(await xr.join(e,t))}const us=t=>!t||typeof t=="boolean"?{type:"object",properties:{}}:t.type?t:{...t,type:"object"},KB=(t,e,r)=>{if(!t.properties)return t;const n=t.properties[e],i=us(n);return{...t,properties:{...t.properties,[e]:{...i,...r}}}},MGe=(t,e,r)=>{if(!t.properties||e===r||!r.trim())return null;const n={...t.properties};return n[r]?null:(n[r]=n[e],delete n[e],{...t,properties:n})},DGe=(t,e)=>{if(!t.properties)return t;const r={...t.properties};return delete r[e],{...t,properties:r}},LGe=(t,e,r={type:"string"})=>{const n=t.properties||{};return{...t,type:"object",properties:{...n,[e]:r}}};function eW(t){const e=Object.assign({},...(t||[]).filter(({key:r,active:n})=>r&&n).map(r=>({[r.key]:r.value})));if(Object.keys(e).length!==0)return e}function tW(t){if(!t)return{};const e={queryParameters:"query",headers:"header",cookies:"cookie",pathParameters:"path"},r=[],n=[];return Object.keys(e).forEach(i=>{const o=i;t[o].forEach(s=>{if(Fp(s)){const a={reference:s.reference,value:s.value||void 0};s.active?r.push(a):n.push(a)}else{if(!s.key)return;const a={name:s.key,in:e[o],value:s.value};s.active?r.push(a):n.push(a)}})}),{parameters:r.length>0?r:void 0,"x-replay-disabled-parameters":n.length>0?n:void 0}}function qGe(t){const e=t?.map(r=>({condition:r.condition,context:r.context,type:r.type==Qi.SIMPLE?void 0:r.type}));if(e?.length!==0)return e}function zGe(t){if(!(!t||t.length===0))return[...t]}async function ale(t,e){return t.absolutePath?`$file('${await xr.relative(e,t.absolutePath)}')`:null}async function UGe(t,e){const{type:r,value:n,files:i}=t;switch(r){case"text":return n;case"file":let o=[];return i&&(o=(await Promise.all(Object.values(i).map(s=>ale(s,e)))).filter(s=>s!==null)),o.length===0?"":o.length===1?o[0]:o}}async function VGe(t,e){const r=t.type,n=t.formData[r],i={},o={};return await Promise.all(n.map(async s=>{const{key:a,active:l}=s;if(!a)return;const c=await UGe(s,e);l?i[a]=c:o[a]=c})),{payload:Object.keys(i).length>0?i:void 0,"x-replay-disabled-payload":Object.keys(o).length>0?o:void 0}}function FGe(t){if(!t)return t;try{const e=JSON.parse(t);return typeof e=="object"?e:t}catch{return t}}async function BGe(t,e){if(t)switch(t.type){case"application/x-www-form-urlencoded":case"multipart/form-data":return{contentType:t.type,...await VGe(t,e)};case"application/octet-stream":return{contentType:t.type,payload:t.binary?await ale(t.binary,e):null};case"application/json":case"application/ld+json":return t.content?{contentType:t.type,payload:FGe(t.content)}:void 0;default:return t.content?{contentType:t.type,payload:t.content}:void 0}}function WGe(t){return{...t.schemeName?{schemeName:t.schemeName}:{scheme:{type:"http",scheme:"basic"}},values:{username:t.username,password:t.password}}}function ZGe(t){return{...t.schemeName?{schemeName:t.schemeName}:{scheme:{type:"apiKey",name:t.name,in:t.location.toLowerCase()}},values:{apiKey:t.key}}}function XGe(t){return{...t.schemeName?{schemeName:t.schemeName}:{scheme:{type:"http",scheme:"bearer"}},values:{token:t.token}}}function GGe(t){return{...t.schemeName?{schemeName:t.schemeName}:{scheme:{type:"http",scheme:"digest"}},values:{username:t.username,password:t.password}}}function YGe(t){const{flows:e,values:r}=ule(t);return{...t.schemeName?{schemeName:t.schemeName}:{scheme:{type:"openIdConnect",flows:e}},values:{...r,openIdConnectUrl:t.openIdConnectUrl,userInfoUrl:t.userInfoUrl,authRequestExtraParams:lle(t.authRequestExtraParams),tokenRequestExtraParams:cle(t.tokenRequestExtraParams)}}}function HGe(t){const{flows:e,values:r}=ule(t);return{...t.schemeName?{schemeName:t.schemeName}:{scheme:{type:"oauth2",flows:e}},values:{...r,authRequestExtraParams:lle(t.authRequestExtraParams),tokenRequestExtraParams:cle(t.tokenRequestExtraParams)}}}function kh(t){const e={},r={};return t.forEach(n=>{n.value&&(n.active?e[n.value]=n.description:r[n.value]=n.description)}),{scopes:e,"x-replay-disabled-scopes":Object.keys(r).length>0?r:void 0}}function lle(t){return t.filter(e=>e.value||e.key).map(e=>({key:e.key,value:e.value,active:e.active}))}function cle(t){return t.filter(e=>e.value||e.key).map(e=>({key:e.key,value:e.value,active:e.active,in:e.sendIn.toLowerCase()}))}function ule(t){let e;switch(t.grantType){case Se.ClientCredentials:return e=t[Se.ClientCredentials],{flows:{clientCredentials:{tokenUrl:e.tokenUrl,...kh(e.scopes)}},values:{clientId:e.clientId,clientSecret:e.clientSecret,accessToken:e.accessToken}};case Se.Implicit:return e=t[Se.Implicit],{flows:{implicit:{authorizationUrl:e.authorizationUrl,...kh(e.scopes)}},values:{clientId:e.clientId,accessToken:e.accessToken,callbackUrl:e.callbackUrl}};case Se.Password:return e=t[Se.Password],{flows:{password:{tokenUrl:e.tokenUrl,...kh(e.scopes)}},values:{clientId:e.clientId,clientSecret:e.clientSecret,username:e.username,password:e.password,accessToken:e.accessToken}};case Se.AuthorizationCode:return e=t[Se.AuthorizationCode],{flows:{authorizationCode:{tokenUrl:e.tokenUrl,authorizationUrl:e.authorizationUrl,...kh(e.scopes)}},values:{accessToken:e.accessToken,clientId:e.clientId,callbackUrl:e.callbackUrl}};case Se.ClientCredentialsWithJwtAssertion:return e=t[Se.ClientCredentialsWithJwtAssertion],{flows:{clientCredentials:{tokenUrl:e.tokenUrl,...kh(e.scopes),"x-assertionType":"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}},values:{clientId:e.clientId,clientAssertion:e.clientAssertion,accessToken:e.accessToken}};case Se.AuthorizationCodeWithPkce:return e=t[Se.AuthorizationCodeWithPkce],{flows:{authorizationCode:{tokenUrl:e.tokenUrl,authorizationUrl:e.authorizationUrl,...kh(e.scopes),"x-usePkce":!0}},values:{clientId:e.clientId,clientSecret:e.clientSecret,accessToken:e.accessToken,codeVerifier:e.codeVerifier,codeChallenge:e.codeChallenge,callbackUrl:e.callbackUrl}}}}function rW(t){const e=t.map(r=>{switch(r.securityType){case ve.OpenIDConnect:{const i=r[ve.OpenIDConnect];return YGe(i)}case ve.OAuth2:{const i=r[ve.OAuth2];return HGe(i)}case ve.APIKey:{const i=r[ve.APIKey];return ZGe(i)}case ve.BasicAuth:{const i=r[ve.BasicAuth];return WGe(i)}case ve.DigestAuth:{const i=r[ve.DigestAuth];return GGe(i)}case ve.JWT:{const i=r[ve.JWT];return XGe(i)}default:return null}}).filter(r=>r!==null);return{"x-security":e.length?e:void 0}}function JGe(t){const{inputs:e,parameters:r,...n}=t;let i=n;return Object.keys(e).length&&(i.inputs=e),Object.keys(r).length&&(i.parameters=Object.fromEntries(Object.entries(r).map(([o,{id:s,active:a,key:l,...c}])=>[o,{...c,name:l}]))),Object.keys(i).length||(i=void 0),i}async function KGe(t,e){const{id:r,state:n,srcType:i,fileDependencies:o,sourceDescriptions:s,workflows:a,components:l,...c}=t;return{arazzoObject:{...c,sourceDescriptions:s.map(u=>({...u,name:u.name,url:u.url,type:u.type||"openapi",apiId:void 0})),components:JGe(l),workflows:await Promise.all(a.map(async({parameters:u,security:d,dependsOn:p,outputs:h,state:m,steps:g,inputs:y,...v})=>({...v,dependsOn:zGe(p),outputs:eW(h),inputs:y?us(y):void 0,...rW(d),...tW(u),steps:await Promise.all(g.map(async({parameters:O,security:b,operation:x,requestBody:w,successCriteria:_,outputs:S,state:$,xOperation:E,...N})=>{const R={operationId:void 0,operationPath:void 0,"x-operation":void 0};if(x){const D=(x.sourceDescriptionName?t.sourceDescriptions.find(({name:U})=>U===x.sourceDescriptionName):null)||t.sourceDescriptions.find(({apiId:U})=>U===x.apiId)||t.sourceDescriptions[0];if(x.operationId){const U=t.sourceDescriptions.length<=1;R.operationId=U?x.operationId:`$sourceDescriptions.${D.name}.${x.operationId}`}else R.operationPath=x.isAdditionalOperation?`{$sourceDescriptions.${D.name}.url}#/paths/${O1.escape(x.path)}/additionalOperations/${x.method}`:`{$sourceDescriptions.${D.name}.url}#/paths/${O1.escape(x.path)}/${x.method}`}else E&&(R["x-operation"]={...E,url:E.url.split("?")[0]});return{...N,...R,...rW(b),...tW(O),requestBody:await BGe(w,e),successCriteria:qGe(_),outputs:eW(S)}}))})))}}}class eYe extends $ne{constructor(e,r){super(e),this.convertOperationToReplayValue=r}async parse(e,r){return{...await PGe(e.content,e.uri,e.type,this.storage.baseDir,r,this.convertOperationToReplayValue),fileDependencies:e.fileDependencies}}async stringify(e){const{arazzoObject:r}=await KGe(e,this.storage.baseDir);return await xr.extname(e.id)===".json"?JSON.stringify(r,null,2):$u.dump(r)}}class tYe{constructor(e,r){this.storage=e,this.localStorageSecretsProvider=r}default=[];async read(){const e=await this.storage.get("replay-environments.yaml"),r=await this.localStorageSecretsProvider.get();let n=null,i=null;if(!e)return this.default;try{n=$u.load(e),i=r?JSON.parse(r):null}catch(a){return console.error("Failed to parse environments file",a),this.default}return n?Object.keys(n).filter(a=>a!=="version").map(a=>({name:a,inputs:Object.entries(n[a].inputs).map(([l,c])=>{if(typeof c=="string")return{name:l,value:c,isSecret:!1};const u=i?.[a]?.[l]??"";return{name:l,value:u,isSecret:!0}}),servers:Object.entries(n[a].servers).map(([l,c])=>({apiId:l,value:c.value,variables:Object.entries(c.variables||{}).map(([u,d])=>({name:u,value:d}))})),state:Ir.Normal})):this.default}async write(e){const r=await this.localStorageSecretsProvider.get(),n=r?JSON.parse(r):{},i=e.reduce((o,s)=>(s.name&&(o[s.name]={inputs:s.inputs.reduce((a,l)=>(l.isSecret&&n?(n[s.name]||(n[s.name]={}),n[s.name][l.name]=l.value,a[l.name]={provider:"local"}):a[l.name]=l.value,a),{}),servers:s.servers.reduce((a,l)=>(a[l.apiId]={value:l.value,variables:Object.fromEntries(l.variables.map(c=>[c.name,c.value]))},a),{})}),o),{});this.localStorageSecretsProvider.set(JSON.stringify(n)),i&&this.storage.set("replay-environments.yaml",$u.dump(i))}}class rYe{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 dle=(t,e)=>({data:t,version:e});class ple extends rYe{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(dle(e,this.version))}}function nYe(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===nt.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 b$=2,iYe="tabs.json";class oYe extends ple{migrationMap={1:nYe};constructor(e){super(e,iYe,Sl(sR),b$)}async parse(e){let r=null;try{r=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}r||(r=dle(Sl(sR),b$)),r.version!==b$&&(r=this.migrate(r));const n=await Promise.all(r.data.tabs.map(async i=>{if(i.data.type===nt.Step){if(i.data.draftStep){const o=i.data.draftStep.requestBody.formData;o["multipart/form-data"]=await nW(o["multipart/form-data"]),o["application/x-www-form-urlencoded"]=await nW(o["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await Db(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===nt.Step){const{isProcessingRequest:i,...o}=n.data;return{...n,data:{...o,response:null}}}return n.data.type===nt.WorkflowRun?{...n,data:{...n.data,result:null}}:n})};return super.stringify(r)}}async function nW(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 ele(n)}return r}))}const sYe=1;class fle{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 m3e(this.project.id);const a=new h3e;this.activeEnvironmentIdStorage=new ple(this.systemFilesStorage,"active_environment_id.json",_b,sYe),this.tabsStateStorage=new oYe(this.systemFilesStorage),this.environmentsStorage=new tYe(this.userFilesStorage,this.localStorageSecretsProvider),this.collectionsStorage=new eYe(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new g3e(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 x$={exports:{}},iW;function aYe(){return iW||(iW=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 h=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],h]:l._events[m].push(h):(l._events[m]=h,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,h=d.length,m=new Array(h);p<h;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,h,m){var g=r?r+c:c;if(!this._events[g])return!1;var y=this._events[g],v=arguments.length,O,b;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,h),!0;case 6:return y.fn.call(y.context,u,d,p,h,m),!0}for(b=1,O=new Array(v-1);b<v;b++)O[b-1]=arguments[b];y.fn.apply(y.context,O)}else{var x=y.length,w;for(b=0;b<x;b++)switch(y[b].once&&this.removeListener(c,y[b].fn,void 0,!0),v){case 1:y[b].fn.call(y[b].context);break;case 2:y[b].fn.call(y[b].context,u);break;case 3:y[b].fn.call(y[b].context,u,d);break;case 4:y[b].fn.call(y[b].context,u,d,p);break;default:if(!O)for(w=1,O=new Array(v-1);w<v;w++)O[w-1]=arguments[w];y[b].fn.apply(y[b].context,O)}}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 h=r?r+c:c;if(!this._events[h])return this;if(!u)return s(this,h),this;var m=this._events[h];if(m.fn)m.fn===u&&(!p||m.once)&&(!d||m.context===d)&&s(this,h);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[h]=y.length===1?y[0]:y:s(this,h)}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})(x$)),x$.exports}var lYe=aYe();const cYe=Oo(lYe);class hle extends Error{constructor(e){super(e),this.name="TimeoutError"}}let uYe=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}};const oW=t=>globalThis.DOMException===void 0?new uYe(t):new DOMException(t),sW=t=>{const e=t.reason===void 0?oW("This operation was aborted."):t.reason;return e instanceof Error?e:oW(e)};function dYe(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(sW(l)),l.addEventListener("abort",()=>{a(sW(l))})}i=n.customTimers.setTimeout.call(void 0,()=>{const l=`Promise timed out after ${e} milliseconds`,c=r instanceof Error?r:new hle(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 pYe(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 bp=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)},lu;class fYe{constructor(){lu.set(this,[])}enqueue(e,r){r={priority:0,...r};const n={priority:r.priority,run:e};if(this.size&&bp(this,lu,"f")[this.size-1].priority>=r.priority){bp(this,lu,"f").push(n);return}const i=pYe(bp(this,lu,"f"),n,(o,s)=>s.priority-o.priority);bp(this,lu,"f").splice(i,0,n)}dequeue(){const e=bp(this,lu,"f").shift();return e?.run}filter(e){return bp(this,lu,"f").filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return bp(this,lu,"f").length}}lu=new WeakMap;var Wn=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},Ot=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)},oi,$v,Ev,yd,C_,Av,fS,ml,rv,Js,hS,ra,Rv,ud,mS,aW,lW,mle,cW,uW,gS,w$,S$,k_,gle,yS;class yle extends Error{}class hYe extends cYe{constructor(e){var r,n,i,o;if(super(),oi.add(this),$v.set(this,void 0),Ev.set(this,void 0),yd.set(this,0),C_.set(this,void 0),Av.set(this,void 0),fS.set(this,0),ml.set(this,void 0),rv.set(this,void 0),Js.set(this,void 0),hS.set(this,void 0),ra.set(this,0),Rv.set(this,void 0),ud.set(this,void 0),mS.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:fYe,...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})`);Wn(this,$v,e.carryoverConcurrencyCount,"f"),Wn(this,Ev,e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,"f"),Wn(this,C_,e.intervalCap,"f"),Wn(this,Av,e.interval,"f"),Wn(this,Js,new e.queueClass,"f"),Wn(this,hS,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,Wn(this,mS,e.throwOnTimeout===!0,"f"),Wn(this,ud,e.autoStart===!1,"f")}get concurrency(){return Ot(this,Rv,"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})`);Wn(this,Rv,e,"f"),Ot(this,oi,"m",k_).call(this)}async add(e,r={}){return r={timeout:this.timeout,throwOnTimeout:Ot(this,mS,"f"),...r},new Promise((n,i)=>{Ot(this,Js,"f").enqueue(async()=>{var o,s,a;Wn(this,ra,(s=Ot(this,ra,"f"),s++,s),"f"),Wn(this,yd,(a=Ot(this,yd,"f"),a++,a),"f");try{if(!((o=r.signal)===null||o===void 0)&&o.aborted)throw new yle("The task was aborted.");let l=e({signal:r.signal});r.timeout&&(l=dYe(Promise.resolve(l),r.timeout)),r.signal&&(l=Promise.race([l,Ot(this,oi,"m",gle).call(this,r.signal)]));const c=await l;n(c),this.emit("completed",c)}catch(l){if(l instanceof hle&&!r.throwOnTimeout){n();return}i(l),this.emit("error",l)}finally{Ot(this,oi,"m",mle).call(this)}},r),this.emit("add"),Ot(this,oi,"m",gS).call(this)})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return Ot(this,ud,"f")?(Wn(this,ud,!1,"f"),Ot(this,oi,"m",k_).call(this),this):this}pause(){Wn(this,ud,!0,"f")}clear(){Wn(this,Js,new(Ot(this,hS,"f")),"f")}async onEmpty(){Ot(this,Js,"f").size!==0&&await Ot(this,oi,"m",yS).call(this,"empty")}async onSizeLessThan(e){Ot(this,Js,"f").size<e||await Ot(this,oi,"m",yS).call(this,"next",()=>Ot(this,Js,"f").size<e)}async onIdle(){Ot(this,ra,"f")===0&&Ot(this,Js,"f").size===0||await Ot(this,oi,"m",yS).call(this,"idle")}get size(){return Ot(this,Js,"f").size}sizeBy(e){return Ot(this,Js,"f").filter(e).length}get pending(){return Ot(this,ra,"f")}get isPaused(){return Ot(this,ud,"f")}}$v=new WeakMap,Ev=new WeakMap,yd=new WeakMap,C_=new WeakMap,Av=new WeakMap,fS=new WeakMap,ml=new WeakMap,rv=new WeakMap,Js=new WeakMap,hS=new WeakMap,ra=new WeakMap,Rv=new WeakMap,ud=new WeakMap,mS=new WeakMap,oi=new WeakSet,aW=function(){return Ot(this,Ev,"f")||Ot(this,yd,"f")<Ot(this,C_,"f")},lW=function(){return Ot(this,ra,"f")<Ot(this,Rv,"f")},mle=function(){var e;Wn(this,ra,(e=Ot(this,ra,"f"),e--,e),"f"),Ot(this,oi,"m",gS).call(this),this.emit("next")},cW=function(){Ot(this,oi,"m",S$).call(this),Ot(this,oi,"m",w$).call(this),Wn(this,rv,void 0,"f")},uW=function(){const e=Date.now();if(Ot(this,ml,"f")===void 0){const r=Ot(this,fS,"f")-e;if(r<0)Wn(this,yd,Ot(this,$v,"f")?Ot(this,ra,"f"):0,"f");else return Ot(this,rv,"f")===void 0&&Wn(this,rv,setTimeout(()=>{Ot(this,oi,"m",cW).call(this)},r),"f"),!0}return!1},gS=function(){if(Ot(this,Js,"f").size===0)return Ot(this,ml,"f")&&clearInterval(Ot(this,ml,"f")),Wn(this,ml,void 0,"f"),this.emit("empty"),Ot(this,ra,"f")===0&&this.emit("idle"),!1;if(!Ot(this,ud,"f")){const e=!Ot(this,oi,"a",uW);if(Ot(this,oi,"a",aW)&&Ot(this,oi,"a",lW)){const r=Ot(this,Js,"f").dequeue();return r?(this.emit("active"),r(),e&&Ot(this,oi,"m",w$).call(this),!0):!1}}return!1},w$=function(){Ot(this,Ev,"f")||Ot(this,ml,"f")!==void 0||(Wn(this,ml,setInterval(()=>{Ot(this,oi,"m",S$).call(this)},Ot(this,Av,"f")),"f"),Wn(this,fS,Date.now()+Ot(this,Av,"f"),"f"))},S$=function(){Ot(this,yd,"f")===0&&Ot(this,ra,"f")===0&&Ot(this,ml,"f")&&(clearInterval(Ot(this,ml,"f")),Wn(this,ml,void 0,"f")),Wn(this,yd,Ot(this,$v,"f")?Ot(this,ra,"f"):0,"f"),Ot(this,oi,"m",k_).call(this)},k_=function(){for(;Ot(this,oi,"m",gS).call(this););},gle=async function(e){return new Promise((r,n)=>{e.addEventListener("abort",()=>{n(new yle("The task was aborted."))},{once:!0})})},yS=async function(e,r){return new Promise(n=>{const i=()=>{r&&!r()||(this.off(e,i),n())};this.on(e,i)})};const _l=window.__TAURI__?.http.fetch??globalThis.fetch;class vle extends tk{constructor(){super()}resolveExternalRef(e,r){return pS(r)?r:e&&pS(e)?new URL(r,e).href:e?sf.resolve(sf.dirname(e),r):r}async loadExternalRef(e){if(pS(e)){const{body:r,mimeType:n}=await iH(e,{...this.config.http,customFetch:_l});return new Um(e,r,n)}else{if(!await Ck(e))throw new Error(`File not found at ${e}.`);try{throw await WQ(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 _k(e);return new Um(e,n.replace(/\r\n/g,`
|
|
356
|
-
`))}}}async function P_(t,e){const r=new XC({});r.getRulesForSpecVersion=()=>[];const n=await xr.dirname(t),i={config:r,base:n,externalRefResolver:new vle,dereference:!0};e?i.doc={source:{absoluteRef:t},parsed:e}:i.ref=t;const{bundle:{parsed:o},fileDependencies:s}=await Kee(i);return{definition:o,fileDependencies:s}}class mYe{constructor(e){this.apisStorage=e}data=new Map;loading=new Set;pQueue=new hYe({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=Ra(e)?yo.WEB:yo.FS,i=n===yo.WEB?e:await this.apisStorage.getAbsolutePath(e);try{const{definition:o,fileDependencies:s}=await P_(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()}}class dW extends fle{apiLoader;constructor(e,r,n){const i=new dR(e.systemFilesDir),o=new dR(e.userFilesDir);super(i,o,e,!0,r,n),this.apiLoader=new mYe(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("storage.read",void 0,void 0),r=this.telemetry?.startSpan("storage.loadUserState",{},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("storage.detectFiles",{},e?.parentCtx),{api_files:n,collection_files:i}=await tt("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("storage.parseApis",{apisCount:e.length},r?.parentCtx),o=await lR(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("storage.parseCollections",{collectionsCount:e.length},r?.parentCtx),i=await lR(e,20,async o=>{try{const s=await this.userFilesStorage.get(o.relative_path);if(!s)return null;const a=$u.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,h=!d||d==="openapi",m=await rle({projectPath:this.project.userFilesDir,apiUrl:p,collectionId:o.relative_path});if(h){const g=await this.apiLoader.get(m);g&&l.push(g)}}));const c=await xr.join(this.project.userFilesDir,o.relative_path);return await this.collectionsStorage.parse({uri:o.relative_path,type:yo.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 X2{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 gYe extends fle{constructor(e,r,n){const i=new X2(e.systemFilesDir),o=new X2(e.userFilesDir);super(i,o,e,!1,r,n)}async detectProjectFiles(e){const r=this.telemetry?.startSpan("storage.detectFiles",{},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=$u.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const d=await xr.resolve(await xr.join(this.userFilesStorage.baseDir,l)),{definition:p}=await P_(d,u);o.push({uri:l,type:yo.FS,content:p})}else typeof u.arazzo=="string"&&(s.push({uri:l,type:yo.FS,content:u}),u.sourceDescriptions?.forEach(d=>{const p=d.type,h=d.url,m=!p||p==="openapi",g=typeof h=="string"&&Ra(h);m&&g&&a.add(h)}))}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("storage.loadApis",{apiUrlsCount:e.size},r?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async o=>{try{const{definition:s}=await P_(o);i.push({uri:o,type:yo.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("storage.parseApis",{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("storage.parseCollections",{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("storage.read",void 0,void 0),r=this.telemetry?.startSpan("storage.loadUserState",{},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 pW;(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"})(pW||(pW={}));async function yYe(t,e){await tt("plugin:event|unlisten",{event:t,eventId:e})}async function vYe(t,e,r){var n;const i=(n=void 0)!==null&&n!==void 0?n:{kind:"Any"};return tt("plugin:event|listen",{event:t,target:i,handler:gne(e)}).then(o=>async()=>yYe(t,o))}function Zf(t){return t==null?"":typeof t=="string"?t:typeof t=="object"&&"raw"in t&&typeof t.raw=="string"?t.raw:String(t)}function zg(t){return t.replace(/\s+/g," ").trim()}function vf(t){return typeof t=="object"&&t!==null&&"$ref"in t}function eD(t){try{return JSON.stringify(t)}catch{return String(t)}}function Ole(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}const OYe=["get","put","post","delete","options","head","patch","trace"],bYe=["query","x-query"];function xYe(t){return vf(t)?null:t}function wYe(t){return vf(t)?null:t}function SYe(t){return vf(t)?null:t}function ble(t){return t.type?Array.isArray(t.type)?t.type.join("|"):t.type:t.oneOf?"oneOf":t.anyOf?"anyOf":t.allOf?"allOf":"object"}function _Ye(t){return t==="querystring"?"query":t==="query"||t==="header"||t==="path"||t==="cookie"?t:"query"}function CYe(t){const e=t.schema&&!vf(t.schema)?t.schema:null,r={name:t.name,in:_Ye(t.in),required:t.required??!1};return e&&(r.type=ble(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=Zf(t.description)),t.example!==void 0&&!r.example&&(r.example=String(t.example)),r}function kYe(t,e){const r=new Set,n=[],i=o=>{for(const s of o){const a=xYe(s);if(!a||!a.name)continue;const l=`${a.in}:${a.name}`;r.has(l)||(r.add(l),n.push(CYe(a)))}};return t.parameters&&i(t.parameters),e.parameters&&i(e.parameters),n}function xle(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:ble(o),required:n.has(i),readOnly:o.readOnly}))}function PYe(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&&!vf(o.schema)?o.schema:null,l=(s?xle(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(eD(o.example)),{textPart:u,schemaJson:JSON.stringify(l),examples:r}}function TYe(t){const e=[],r=[];for(const[n,i]of Object.entries(t)){if(vf(i))continue;const o=Zf(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&&!vf(c)){const u=xle(c);u.length>0&&(s.schemaProperties=JSON.stringify(u))}}r.push(s)}return{textParts:e,summaries:r}}function wle(t){const e=t.components?.securitySchemes;if(!e)return[];const r=[];for(const[n,i]of Object.entries(e)){const o=SYe(i);o&&r.push(IYe(n,o))}return r}function IYe(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 $Ye(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 EYe(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("; ")}.`}function G2(t){const{apiId:e,apiTitle:r,path:n,method:i,op:o,pathItem:s,globalSchemes:a,apiSecurity:l}=t,c=o.summary??"",u=Zf(o.description??""),d=o.operationId??"",p=o.tags??[],h=i.toUpperCase(),m=kYe(o,s),g=$Ye(o.security,l,a),y=g.length>0?g.map(N=>`api_sec:${e}:${N.schemeName}`):void 0,v=[r,`${h} ${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(Ole).join(". ")}.`);let O;const b=[],x=o.requestBody;if(x){const N=wYe(x);if(N){const R=PYe(N,{hideReadOnly:h==="POST"||h==="PUT"||h==="PATCH"});R.textPart&&v.push(R.textPart),O=R.schemaJson,b.push(...R.examples)}}const{textParts:w,summaries:_}=TYe(o.responses??{});w.length>0&&v.push(`Responses: ${w.join(", ")}.`);const S=EYe(g);S&&v.push(S);const $=`api_op:${e}:${n}:${i}:${d||`${n}-${i}`}`,E={type:"api_operation",id:$,contentHash:"",title:c||`${h} ${n}`,description:u||void 0,apiId:e,path:n,method:h,operationId:d||void 0,tags:p.length>0?p:void 0,deprecated:o.deprecated||void 0,parameterDetails:m.length>0?m:void 0,requestBodySchema:O,responseSchemas:_.length>0?_:void 0,securitySchemeRefs:y,examples:b.length>0?b:void 0};return{id:$,text:zg(v.filter(Boolean).join(" ")),payload:E}}function Y2(t){const e=t.info?.title??"Untitled API",r=Zf(t.info?.description??t.info?.summary??""),n=t.id;return{id:`api:${n}`,text:zg([e,r].filter(Boolean).join(" ")),payload:{type:"api",id:`api:${n}`,contentHash:"",title:e,description:r||void 0,apiId:n}}}function Sle(t){const e=[];for(const r of t){e.push(Y2(r));const n=r.info?.title??"Untitled API",i=r.id,o=wle(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:zg(`${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=[...OYe.filter(d=>d in l),...bYe.filter(d=>d in l)];for(const d of c){const p=l[d];!p||typeof p!="object"||e.push(G2({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(G2({apiId:i,apiTitle:n,path:a,method:d,op:p,pathItem:l,globalSchemes:o,apiSecurity:r.security}))}}return e}function AYe(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 H2(t){const e=t.id,r=t.info?.title??"Untitled Collection",n=Zf(t.info?.description??t.info?.summary??"");return{id:`collection:${e}`,text:zg([r,n].filter(Boolean).join(" ")),payload:{type:"collection",id:`collection:${e}`,contentHash:"",title:r,description:n||void 0,collectionId:e}}}function _le(t){const{collectionId:e,collectionTitle:r,workflow:n}=t,i=n.workflowId??"",o=n.summary??i,s=Zf(n.description??""),a=[r,o,s];if(n.inputs&&a.push(`Inputs schema: ${eD(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:zg(a.filter(Boolean).join(" ")),payload:{type:"workflow",id:`workflow:${e}:${i}`,contentHash:"",title:o,description:s||void 0,collectionId:e,workflowId:i}}}function Cle(t){const{collectionId:e,collectionTitle:r,workflowId:n,workflowTitle:i,step:o}=t,s=o.stepId??"",a=Zf(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?AYe(o.parameters):[];d.length>0&&u.push(`Parameters: ${d.map(Ole).join(". ")}.`),o.requestBody?.type&&u.push(`Request body type: ${o.requestBody.type}`);const h=(o.successCriteria??[]).map(g=>{let y=g.condition;return g.context&&(y+=` context: ${g.context}`),g.type&&(y+=` (${g.type})`),y});if(h.length>0&&u.push(`Success criteria: ${h.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:zg(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:h.length>0?h:void 0,requestBodySchema:o.requestBody?.type?eD(o.requestBody):void 0}}}function kle(t){const e=[];for(const r of t){const n=r.id,i=r.info?.title??"Untitled Collection";e.push(H2(r));for(const o of r.workflows??[]){e.push(_le({collectionId:n,collectionTitle:i,workflow:o}));const s=o.workflowId??"",a=o.summary??s;for(const l of o.steps??[])e.push(Cle({collectionId:n,collectionTitle:i,workflowId:s,workflowTitle:a,step:l}))}}return e}function RYe(t,e){return[...Sle(t),...kle(e)]}const _$=10,jYe=4;function fW(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r)|0;return e>>>0}function NYe(t){return Lm(cb(t))}class QYe extends ZQ{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 tt("semantic_search_get_ids_by_payload",{collectionName:this.collectionName,field:e,value:r})}async getAllIds(){return tt("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=NYe(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(fW)),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 tt("semantic_search_delete_by_payload",{collectionName:this.collectionName,field:e,value:r})}async getStoredDocumentCount(){try{return(await tt("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(fW),n=await tt("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+=_$)r.push({docs:e.slice(i,i+_$),index:Math.floor(i/_$)});await lR(r,jYe,async i=>{const o=i.docs.map(s=>({id:s.id,text:s.text||s.payload.title,payload:s.payload}));await tt("semantic_search_embed_and_upsert",{collectionName:this.collectionName,documents:o})})}async deletePoints(e){e.length!==0&&await tt("plugin:velesdb|delete_points",{request:{collection:this.collectionName,ids:e}})}async flush(){await tt("plugin:velesdb|flush",{name:this.collectionName}),await tt("semantic_search_write_hnsw_marker",{collectionName:this.collectionName}).catch(()=>{})}}const hW="replay_search",MYe=384,Ph={added:0,updated:0,removed:0,unchanged:0};class DYe extends ZQ{initialized=!1;projectId=null;indexer=null;indexQueue=Promise.resolve();get collectionName(){return this.projectId?`${hW}_${this.projectId}`:hW}createIndexer(){const e=new QYe(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 tt("semantic_search_unload_model")}catch{}}setProject(e){this.projectId!==e&&(this.projectId=e,this.initialized=!1,this.indexer=this.createIndexer())}async init(){if(Xr()&&!this.initialized){try{if((await tt("plugin:velesdb|list_collections"))?.some(r=>r.name===this.collectionName)){this.initialized=!0;return}}catch{}await tt("plugin:velesdb|create_collection",{request:{name:this.collectionName,dimension:MYe,metric:"cosine",storage_mode:"full"}}),this.initialized=!0}}async indexApis(e){if(!Xr())return Ph;await this.ensureInitialized();const r=this.collectionName,n=this.getIndexer(),i=Sle(e),o={apiIds:e.map(s=>s.id)};return this.enqueueIndex(async()=>this.collectionName!==r?Ph:n.indexDocuments(i,o))}async indexCollections(e){if(!Xr())return Ph;await this.ensureInitialized();const r=this.collectionName,n=this.getIndexer(),i=kle(e),o={collectionIds:e.map(s=>s.id)};return this.enqueueIndex(async()=>this.collectionName!==r?Ph:n.indexDocuments(i,o))}async removeApi(e){if(!Xr())return;await this.ensureInitialized(),await this.getIndexer().removeByPayloadFilter("apiId",e)}async removeCollection(e){if(!Xr())return;await this.ensureInitialized(),await this.getIndexer().removeByPayloadFilter("collectionId",e)}async reindex(e,r){if(!Xr())return Ph;await this.ensureInitialized();const n=this.collectionName,i=this.getIndexer(),o=RYe(e,r);return this.enqueueIndex(async()=>this.collectionName!==n?Ph:i.indexDocuments(o))}async search(e,r=10,n){if(!Xr())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 tt("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(!Xr())return{indexed:0,modelLoaded:!1};const e=await this.getIndexer().getStoredDocumentCount();let r=!1;try{r=(await tt("semantic_search_model_status")).loaded}catch{}return{indexed:e,modelLoaded:r}}async clear(){if(!(!Xr()||!this.initialized))try{await tt("plugin:velesdb|delete_collection",{name:this.collectionName}),this.initialized=!1}catch{}}async preloadModel(){if(Xr())try{await tt("semantic_search_preload_model")}catch{}}}let C$=null;function wu(){return C$||(C$=new DYe),C$}class LYe{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||wu().indexApis(e).catch(r=>console.error("Semantic index (apis):",r))}indexCollections(e){!this.aiEnabled||e.length===0||wu().indexCollections(e).catch(r=>console.error("Semantic index (collections):",r))}removeApis(e){if(!this.aiEnabled||e.length===0)return;const r=wu();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=wu();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 vYe("fs-watch-event",async e=>{const r=e.payload;try{await this.handleEvent(r)}catch(n){console.error("Error handling file change:",n)}}),await tt("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 tt("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 xr.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(h=>h.relative_path==="replay-environments.yaml"),n=e.filter(h=>h.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 xr.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 xr.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 Ple(t=!1){let e,r=!1,n=null,i=null;async function o(l){if(!(!Xr()||!e||!i)){await s();try{const c=i.project.userFilesDir.get();n=new LYe(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(){Xr()&&(await s(),await tt("cleanup_all_managed_watchers"))}return()=>({id:"RootStoragePlugin",onCreate:(l,c)=>({getTauriRootStorage:u=>()=>e instanceof dW?e:void 0,cleanup:()=>async()=>{await a()},init:u=>async(d,p,h)=>{if(r||u.path.length>0)return{isInitialized:!1};const{convertOperationToReplayValue:m,aiEnabled:g}=p,y=Xr();if(r=!0,i=u,t)return r=!1,{isInitialized:!0};e=y?new dW(d,m,h):new gYe(d,m,h);const v=await e.read();if(u.merge(v),!y)return r=!1,{isInitialized:!0};try{if(await o(g??!1),g){const O=wu();O.setProject(d.id),O.preloadModel().catch(()=>{}),O.reindex(v.apis,v.collections).catch(b=>{console.error("Semantic reindex failed:",b)})}}finally{r=!1}return{isInitialized:!0}}}),onSet(l,c,u){r||!t&&e&&e.update(c,u)},onDestroy:async()=>{await a()}})}function Tle({defaultEnvironments:t}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},tabsState:Sl(sR),activeEnvironmentId:_b,environments:t||mne,collections:[],apis:[],requestController:null,apps:{apps:[],appsLoadingState:ac.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set})}const qYe=BY(Tle(),WY(Eze({key:"replay-root-store"}),Ple())),tD=k.createContext(qYe),zYe=tD.Provider;function Wt(){const t=k.useContext(tD);return ZY(t)}function UYe(){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 VYe=UYe(),FYe=k.createContext(VYe);function bo(){const t=k.useContext(FYe);return ZY(t)}function BYe(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}=bo();n.set(t?.corsProxyUrl??hze),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"),k.useEffect(()=>{a.set(t?.certificates||[])},[t?.certificates])}const Bk=k.createContext({});function xo(){return k.useContext(Bk)||{}}const Ile=process.env.NODE_ENV==="development",mW=process.env.NODE_ENV==="production",WYe="0.24.0-next.2",ZYe={version:WYe},XYe={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"",origin:"replayUi"};class $le{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new fze}get isInitialized(){return this._isInitialized}get client(){return this._client}awaitInit(){return this._initPromise}updateCloudEventData(e){this._client.updateCloudEventData(e)}enrichGlobalAttributes(e){this._globalAttributes={...this._globalAttributes,...e}}getGlobalAttributes(){return{...this._globalAttributes}}clearGlobalAttributes(){this._globalAttributes={platform:"",deviceId:""}}init(e){if(this.isInitialized)return;const r=e?.tracerName||"desktop",n=e?.enableErrorInstrumentation??r==="desktop",i={serviceName:"replay",serviceVersion:ZYe.version,version:"1.0.0",tracerName:r,collectorUrl:"",isProd:mW,enableErrorInstrumentation:n};this._client.init({otel:{...i,...e}}),this._client.updateCloudEventData(()=>({...XYe,env:mW?"production":"development"})),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};Ile&&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 fm=new $le;function $t(){const{telemetry:t}=xo();fm.isInitialized||fm.init(t);const e=k.useCallback((n,i)=>{fm.sendEvent(n,i)},[]),r=k.useCallback((n,i,o)=>fm.startSpan(n,i,o),[]);return{sendEvent:e,startSpan:r}}const GYe=({awaitInit:t=!0}={})=>{const[e,r]=k.useState(void 0);return k.useEffect(()=>{(async()=>{const i=t?await fm.awaitInit():fm;r(i)})()},[t]),e},Do=800,ds=P.default(j.Button).attrs({variant:"text",size:"small",tone:"danger"})`
|
|
356
|
+
`))}}}async function P_(t,e){const r=new XC({});r.getRulesForSpecVersion=()=>[];const n=await xr.dirname(t),i={config:r,base:n,externalRefResolver:new vle,dereference:!0};e?i.doc={source:{absoluteRef:t},parsed:e}:i.ref=t;const{bundle:{parsed:o},fileDependencies:s}=await Kee(i);return{definition:o,fileDependencies:s}}class mYe{constructor(e){this.apisStorage=e}data=new Map;loading=new Set;pQueue=new hYe({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=Ra(e)?yo.WEB:yo.FS,i=n===yo.WEB?e:await this.apisStorage.getAbsolutePath(e);try{const{definition:o,fileDependencies:s}=await P_(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()}}class dW extends fle{apiLoader;constructor(e,r,n){const i=new dR(e.systemFilesDir),o=new dR(e.userFilesDir);super(i,o,e,!0,r,n),this.apiLoader=new mYe(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("storage.read",void 0,void 0),r=this.telemetry?.startSpan("storage.loadUserState",{},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("storage.detectFiles",{},e?.parentCtx),{api_files:n,collection_files:i}=await tt("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("storage.parseApis",{apisCount:e.length},r?.parentCtx),o=await lR(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("storage.parseCollections",{collectionsCount:e.length},r?.parentCtx),i=await lR(e,20,async o=>{try{const s=await this.userFilesStorage.get(o.relative_path);if(!s)return null;const a=$u.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,h=!d||d==="openapi",m=await rle({projectPath:this.project.userFilesDir,apiUrl:p,collectionId:o.relative_path});if(h){const g=await this.apiLoader.get(m);g&&l.push(g)}}));const c=await xr.join(this.project.userFilesDir,o.relative_path);return await this.collectionsStorage.parse({uri:o.relative_path,type:yo.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 X2{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 gYe extends fle{constructor(e,r,n){const i=new X2(e.systemFilesDir),o=new X2(e.userFilesDir);super(i,o,e,!1,r,n)}async detectProjectFiles(e){const r=this.telemetry?.startSpan("storage.detectFiles",{},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=$u.load(c);if(typeof u=="object"&&u!==null)if(typeof u.openapi=="string"){const d=await xr.resolve(await xr.join(this.userFilesStorage.baseDir,l)),{definition:p}=await P_(d,u);o.push({uri:l,type:yo.FS,content:p})}else typeof u.arazzo=="string"&&(s.push({uri:l,type:yo.FS,content:u}),u.sourceDescriptions?.forEach(d=>{const p=d.type,h=d.url,m=!p||p==="openapi",g=typeof h=="string"&&Ra(h);m&&g&&a.add(h)}))}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("storage.loadApis",{apiUrlsCount:e.size},r?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async o=>{try{const{definition:s}=await P_(o);i.push({uri:o,type:yo.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("storage.parseApis",{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("storage.parseCollections",{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("storage.read",void 0,void 0),r=this.telemetry?.startSpan("storage.loadUserState",{},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 pW;(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"})(pW||(pW={}));async function yYe(t,e){await tt("plugin:event|unlisten",{event:t,eventId:e})}async function vYe(t,e,r){var n;const i=(n=void 0)!==null&&n!==void 0?n:{kind:"Any"};return tt("plugin:event|listen",{event:t,target:i,handler:gne(e)}).then(o=>async()=>yYe(t,o))}function Zf(t){return t==null?"":typeof t=="string"?t:typeof t=="object"&&"raw"in t&&typeof t.raw=="string"?t.raw:String(t)}function zg(t){return t.replace(/\s+/g," ").trim()}function vf(t){return typeof t=="object"&&t!==null&&"$ref"in t}function eD(t){try{return JSON.stringify(t)}catch{return String(t)}}function Ole(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}const OYe=["get","put","post","delete","options","head","patch","trace"],bYe=["query","x-query"];function xYe(t){return vf(t)?null:t}function wYe(t){return vf(t)?null:t}function SYe(t){return vf(t)?null:t}function ble(t){return t.type?Array.isArray(t.type)?t.type.join("|"):t.type:t.oneOf?"oneOf":t.anyOf?"anyOf":t.allOf?"allOf":"object"}function _Ye(t){return t==="querystring"?"query":t==="query"||t==="header"||t==="path"||t==="cookie"?t:"query"}function CYe(t){const e=t.schema&&!vf(t.schema)?t.schema:null,r={name:t.name,in:_Ye(t.in),required:t.required??!1};return e&&(r.type=ble(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=Zf(t.description)),t.example!==void 0&&!r.example&&(r.example=String(t.example)),r}function kYe(t,e){const r=new Set,n=[],i=o=>{for(const s of o){const a=xYe(s);if(!a||!a.name)continue;const l=`${a.in}:${a.name}`;r.has(l)||(r.add(l),n.push(CYe(a)))}};return t.parameters&&i(t.parameters),e.parameters&&i(e.parameters),n}function xle(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:ble(o),required:n.has(i),readOnly:o.readOnly}))}function PYe(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&&!vf(o.schema)?o.schema:null,l=(s?xle(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(eD(o.example)),{textPart:u,schemaJson:JSON.stringify(l),examples:r}}function TYe(t){const e=[],r=[];for(const[n,i]of Object.entries(t)){if(vf(i))continue;const o=Zf(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&&!vf(c)){const u=xle(c);u.length>0&&(s.schemaProperties=JSON.stringify(u))}}r.push(s)}return{textParts:e,summaries:r}}function wle(t){const e=t.components?.securitySchemes;if(!e)return[];const r=[];for(const[n,i]of Object.entries(e)){const o=SYe(i);o&&r.push(IYe(n,o))}return r}function IYe(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 $Ye(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 EYe(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("; ")}.`}function G2(t){const{apiId:e,apiTitle:r,path:n,method:i,op:o,pathItem:s,globalSchemes:a,apiSecurity:l}=t,c=o.summary??"",u=Zf(o.description??""),d=o.operationId??"",p=o.tags??[],h=i.toUpperCase(),m=kYe(o,s),g=$Ye(o.security,l,a),y=g.length>0?g.map(N=>`api_sec:${e}:${N.schemeName}`):void 0,v=[r,`${h} ${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(Ole).join(". ")}.`);let O;const b=[],x=o.requestBody;if(x){const N=wYe(x);if(N){const R=PYe(N,{hideReadOnly:h==="POST"||h==="PUT"||h==="PATCH"});R.textPart&&v.push(R.textPart),O=R.schemaJson,b.push(...R.examples)}}const{textParts:w,summaries:_}=TYe(o.responses??{});w.length>0&&v.push(`Responses: ${w.join(", ")}.`);const S=EYe(g);S&&v.push(S);const $=`api_op:${e}:${n}:${i}:${d||`${n}-${i}`}`,E={type:"api_operation",id:$,contentHash:"",title:c||`${h} ${n}`,description:u||void 0,apiId:e,path:n,method:h,operationId:d||void 0,tags:p.length>0?p:void 0,deprecated:o.deprecated||void 0,parameterDetails:m.length>0?m:void 0,requestBodySchema:O,responseSchemas:_.length>0?_:void 0,securitySchemeRefs:y,examples:b.length>0?b:void 0};return{id:$,text:zg(v.filter(Boolean).join(" ")),payload:E}}function Y2(t){const e=t.info?.title??"Untitled API",r=Zf(t.info?.description??t.info?.summary??""),n=t.id;return{id:`api:${n}`,text:zg([e,r].filter(Boolean).join(" ")),payload:{type:"api",id:`api:${n}`,contentHash:"",title:e,description:r||void 0,apiId:n}}}function Sle(t){const e=[];for(const r of t){e.push(Y2(r));const n=r.info?.title??"Untitled API",i=r.id,o=wle(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:zg(`${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=[...OYe.filter(d=>d in l),...bYe.filter(d=>d in l)];for(const d of c){const p=l[d];!p||typeof p!="object"||e.push(G2({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(G2({apiId:i,apiTitle:n,path:a,method:d,op:p,pathItem:l,globalSchemes:o,apiSecurity:r.security}))}}return e}function AYe(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 H2(t){const e=t.id,r=t.info?.title??"Untitled Collection",n=Zf(t.info?.description??t.info?.summary??"");return{id:`collection:${e}`,text:zg([r,n].filter(Boolean).join(" ")),payload:{type:"collection",id:`collection:${e}`,contentHash:"",title:r,description:n||void 0,collectionId:e}}}function _le(t){const{collectionId:e,collectionTitle:r,workflow:n}=t,i=n.workflowId??"",o=n.summary??i,s=Zf(n.description??""),a=[r,o,s];if(n.inputs&&a.push(`Inputs schema: ${eD(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:zg(a.filter(Boolean).join(" ")),payload:{type:"workflow",id:`workflow:${e}:${i}`,contentHash:"",title:o,description:s||void 0,collectionId:e,workflowId:i}}}function Cle(t){const{collectionId:e,collectionTitle:r,workflowId:n,workflowTitle:i,step:o}=t,s=o.stepId??"",a=Zf(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?AYe(o.parameters):[];d.length>0&&u.push(`Parameters: ${d.map(Ole).join(". ")}.`),o.requestBody?.type&&u.push(`Request body type: ${o.requestBody.type}`);const h=(o.successCriteria??[]).map(g=>{let y=g.condition;return g.context&&(y+=` context: ${g.context}`),g.type&&(y+=` (${g.type})`),y});if(h.length>0&&u.push(`Success criteria: ${h.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:zg(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:h.length>0?h:void 0,requestBodySchema:o.requestBody?.type?eD(o.requestBody):void 0}}}function kle(t){const e=[];for(const r of t){const n=r.id,i=r.info?.title??"Untitled Collection";e.push(H2(r));for(const o of r.workflows??[]){e.push(_le({collectionId:n,collectionTitle:i,workflow:o}));const s=o.workflowId??"",a=o.summary??s;for(const l of o.steps??[])e.push(Cle({collectionId:n,collectionTitle:i,workflowId:s,workflowTitle:a,step:l}))}}return e}function RYe(t,e){return[...Sle(t),...kle(e)]}const _$=10,jYe=4;function fW(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r)|0;return e>>>0}function NYe(t){return Lm(cb(t))}class QYe extends ZQ{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 tt("semantic_search_get_ids_by_payload",{collectionName:this.collectionName,field:e,value:r})}async getAllIds(){return tt("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=NYe(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(fW)),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 tt("semantic_search_delete_by_payload",{collectionName:this.collectionName,field:e,value:r})}async getStoredDocumentCount(){try{return(await tt("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(fW),n=await tt("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+=_$)r.push({docs:e.slice(i,i+_$),index:Math.floor(i/_$)});await lR(r,jYe,async i=>{const o=i.docs.map(s=>({id:s.id,text:s.text||s.payload.title,payload:s.payload}));await tt("semantic_search_embed_and_upsert",{collectionName:this.collectionName,documents:o})})}async deletePoints(e){e.length!==0&&await tt("plugin:velesdb|delete_points",{request:{collection:this.collectionName,ids:e}})}async flush(){await tt("plugin:velesdb|flush",{name:this.collectionName}),await tt("semantic_search_write_hnsw_marker",{collectionName:this.collectionName}).catch(()=>{})}}const hW="replay_search",MYe=384,Ph={added:0,updated:0,removed:0,unchanged:0};class DYe extends ZQ{initialized=!1;projectId=null;indexer=null;indexQueue=Promise.resolve();get collectionName(){return this.projectId?`${hW}_${this.projectId}`:hW}createIndexer(){const e=new QYe(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 tt("semantic_search_unload_model")}catch{}}setProject(e){this.projectId!==e&&(this.projectId=e,this.initialized=!1,this.indexer=this.createIndexer())}async init(){if(Xr()&&!this.initialized){try{if((await tt("plugin:velesdb|list_collections"))?.some(r=>r.name===this.collectionName)){this.initialized=!0;return}}catch{}await tt("plugin:velesdb|create_collection",{request:{name:this.collectionName,dimension:MYe,metric:"cosine",storage_mode:"full"}}),this.initialized=!0}}async indexApis(e){if(!Xr())return Ph;await this.ensureInitialized();const r=this.collectionName,n=this.getIndexer(),i=Sle(e),o={apiIds:e.map(s=>s.id)};return this.enqueueIndex(async()=>this.collectionName!==r?Ph:n.indexDocuments(i,o))}async indexCollections(e){if(!Xr())return Ph;await this.ensureInitialized();const r=this.collectionName,n=this.getIndexer(),i=kle(e),o={collectionIds:e.map(s=>s.id)};return this.enqueueIndex(async()=>this.collectionName!==r?Ph:n.indexDocuments(i,o))}async removeApi(e){if(!Xr())return;await this.ensureInitialized(),await this.getIndexer().removeByPayloadFilter("apiId",e)}async removeCollection(e){if(!Xr())return;await this.ensureInitialized(),await this.getIndexer().removeByPayloadFilter("collectionId",e)}async reindex(e,r){if(!Xr())return Ph;await this.ensureInitialized();const n=this.collectionName,i=this.getIndexer(),o=RYe(e,r);return this.enqueueIndex(async()=>this.collectionName!==n?Ph:i.indexDocuments(o))}async search(e,r=10,n){if(!Xr())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 tt("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(!Xr())return{indexed:0,modelLoaded:!1};const e=await this.getIndexer().getStoredDocumentCount();let r=!1;try{r=(await tt("semantic_search_model_status")).loaded}catch{}return{indexed:e,modelLoaded:r}}async clear(){if(!(!Xr()||!this.initialized))try{await tt("plugin:velesdb|delete_collection",{name:this.collectionName}),this.initialized=!1}catch{}}async preloadModel(){if(Xr())try{await tt("semantic_search_preload_model")}catch{}}}let C$=null;function wu(){return C$||(C$=new DYe),C$}class LYe{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||wu().indexApis(e).catch(r=>console.error("Semantic index (apis):",r))}indexCollections(e){!this.aiEnabled||e.length===0||wu().indexCollections(e).catch(r=>console.error("Semantic index (collections):",r))}removeApis(e){if(!this.aiEnabled||e.length===0)return;const r=wu();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=wu();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 vYe("fs-watch-event",async e=>{const r=e.payload;try{await this.handleEvent(r)}catch(n){console.error("Error handling file change:",n)}}),await tt("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 tt("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 xr.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(h=>h.relative_path==="replay-environments.yaml"),n=e.filter(h=>h.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 xr.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 xr.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 Ple(t=!1){let e,r=!1,n=null,i=null;async function o(l){if(!(!Xr()||!e||!i)){await s();try{const c=i.project.userFilesDir.get();n=new LYe(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(){Xr()&&(await s(),await tt("cleanup_all_managed_watchers"))}return()=>({id:"RootStoragePlugin",onCreate:(l,c)=>({getTauriRootStorage:u=>()=>e instanceof dW?e:void 0,cleanup:()=>async()=>{await a()},init:u=>async(d,p,h)=>{if(r||u.path.length>0)return{isInitialized:!1};const{convertOperationToReplayValue:m,aiEnabled:g}=p,y=Xr();if(r=!0,i=u,t)return r=!1,{isInitialized:!0};e=y?new dW(d,m,h):new gYe(d,m,h);const v=await e.read();if(u.merge(v),!y)return r=!1,{isInitialized:!0};try{if(await o(g??!1),g){const O=wu();O.setProject(d.id),O.preloadModel().catch(()=>{}),O.reindex(v.apis,v.collections).catch(b=>{console.error("Semantic reindex failed:",b)})}}finally{r=!1}return{isInitialized:!0}}}),onSet(l,c,u){r||!t&&e&&e.update(c,u)},onDestroy:async()=>{await a()}})}function Tle({defaultEnvironments:t}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},tabsState:Sl(sR),activeEnvironmentId:_b,environments:t||mne,collections:[],apis:[],requestController:null,apps:{apps:[],appsLoadingState:ac.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set})}const qYe=BY(Tle(),WY(Eze({key:"replay-root-store"}),Ple())),tD=k.createContext(qYe),zYe=tD.Provider;function Wt(){const t=k.useContext(tD);return ZY(t)}function UYe(){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 VYe=UYe(),FYe=k.createContext(VYe);function bo(){const t=k.useContext(FYe);return ZY(t)}function BYe(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}=bo();n.set(t?.corsProxyUrl??hze),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"),k.useEffect(()=>{a.set(t?.certificates||[])},[t?.certificates])}const Bk=k.createContext({});function xo(){return k.useContext(Bk)||{}}const Ile=process.env.NODE_ENV==="development",mW=process.env.NODE_ENV==="production",WYe="0.24.0-next.3",ZYe={version:WYe},XYe={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"",origin:"replayUi"};class $le{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new fze}get isInitialized(){return this._isInitialized}get client(){return this._client}awaitInit(){return this._initPromise}updateCloudEventData(e){this._client.updateCloudEventData(e)}enrichGlobalAttributes(e){this._globalAttributes={...this._globalAttributes,...e}}getGlobalAttributes(){return{...this._globalAttributes}}clearGlobalAttributes(){this._globalAttributes={platform:"",deviceId:""}}init(e){if(this.isInitialized)return;const r=e?.tracerName||"desktop",n=e?.enableErrorInstrumentation??r==="desktop",i={serviceName:"replay",serviceVersion:ZYe.version,version:"1.0.0",tracerName:r,collectorUrl:"",isProd:mW,enableErrorInstrumentation:n};this._client.init({otel:{...i,...e}}),this._client.updateCloudEventData(()=>({...XYe,env:mW?"production":"development"})),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};Ile&&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 fm=new $le;function $t(){const{telemetry:t}=xo();fm.isInitialized||fm.init(t);const e=k.useCallback((n,i)=>{fm.sendEvent(n,i)},[]),r=k.useCallback((n,i,o)=>fm.startSpan(n,i,o),[]);return{sendEvent:e,startSpan:r}}const GYe=({awaitInit:t=!0}={})=>{const[e,r]=k.useState(void 0);return k.useEffect(()=>{(async()=>{const i=t?await fm.awaitInit():fm;r(i)})()},[t]),e},Do=800,ds=P.default(j.Button).attrs({variant:"text",size:"small",tone:"danger"})`
|
|
357
357
|
border: none;
|
|
358
358
|
margin: 0;
|
|
359
359
|
|
|
@@ -625,7 +625,7 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function c8e(t){return t.
|
|
|
625
625
|
border-radius: var(--border-radius);
|
|
626
626
|
border: 1px solid var(--border-color-primary);
|
|
627
627
|
padding: 0 calc(var(--spacing-xxs) / 2);
|
|
628
|
-
`,Gr=(t,e,r=new Set)=>{const n=dce(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=Gr(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 FKe(t,e){return e.find(r=>r.name===t.slice(1,-1))?.value||t}function BKe(t,e){const r=pce(t);if(!r.length)return f.jsx(EW,{children:t});let n=0;const i=r.flatMap(({start:o,end:s})=>{const a=t.slice(n,o),l=FKe(t.slice(o,s),e);return n=s,[a.length?a:null,l]});return t.slice(n).length&&i.push(t.slice(n)),f.jsx(EW,{children:i.join("")})}function fce(t){return NOe(t)}const hce="New Step";function rj({name:t=hce,workflow:e}={}){let r=t.replaceAll(" ","-").toLowerCase();if(!e)return r;const n=WKe(e);if(n.includes(r)){let i=1;for(;n.includes(`${r}-${i}`);)i++;r=`${r}-${i}`}return r}function WKe(t){return t.steps.filter(e=>e.state.get()!==Ir.Draft).map(e=>e.stepId.get())}function zc({name:t=hce,isDraft:e=!1,fromStep:r,workflow:n,operation:i,apiOperation:o,xOperation:s}={}){if(!r){const l=o?JM(o):null,c=[fa()];return{stepId:rj({name:t,workflow:n}),description:t,outputs:[Qo()],successCriteria:[],state:e?Ir.Draft:Ir.Normal,parameters:{pathParameters:[Tr("path")],queryParameters:[Tr("query")],headers:[Tr("header")],cookies:[Tr("cookie")]},requestBody:__(),xOperation:s??(i?null:{method:"GET",url:""}),security:c,operation:i??null,...l}}const a=r.get({noproxy:!0});return{stepId:rj({name:t,workflow:n}),description:a.description,outputs:a.outputs,successCriteria:a.successCriteria,state:e?Ir.Draft:Ir.Normal,parameters:a.parameters,requestBody:a.requestBody,xOperation:a.xOperation,security:a.security,operation:a.operation}}function Of(t){return fce(t)?t.xOperation?.ornull?.method.get()??t.operation.ornull?.method.get()??"":t.xOperation?.method??t.operation?.method??""}function j_(t){return fce(t)?t.xOperation?.ornull?.url.get()??t.operation.ornull?.nested("path").get()??"":t.xOperation?.url??t.operation?.path??""}function dD(t,e,r,n){const{inputs:i,servers:o}=n,s=K8e(jd("path",[Xn(e?.parameters.pathParameters,r?.components.parameters),Xn(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=qB(a.url,s);else if(l){const h=o.find(g=>g.apiId===l.apiId);u=l.method==="x-query"?"query":l.method,c=(h?.value?tle(h.value,h.variables):"")+qB(l.path,s)}const d=c.split("?")[0];return{url:Gr(d,i),method:u.toUpperCase()}}function ap(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 ZKe(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 XKe(t,e,r,n){const{inputs:i}=n,{requestBody:{content:o}}=t,{url:s,method:a}=dD(t,e,r,n),l=[...e?.security||[],...t.security].findLast(S=>S.securityType===ve.DigestAuth);if(!l)return"";const{username:c,password:u,realm:d,nonce:p,cnonce:h,algorithm:m,qop:g,nc:y,opaque:v}=l[ve.DigestAuth],O=Gr(c,i),{pathname:b,search:x}=new URL(s),w=x?`${b}${x}`:b,_=GKe({username:O,password:Gr(u,i),uri:w,realm:d,nonce:p,cnonce:h,algorithm:m,qop:g,nc:y,method:a,bodyContent:o});return`Digest username="${O}", realm="${d}", nonce="${p}", uri="${w}", qop=${g}, nc=${y}, cnonce="${h}", response="${_}", algorithm=${m}${v?`, opaque="${v}"`:""}`}function GKe(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=YKe(s),h=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(`${h}:${i}:${l}:${o}:${a}:${m}`).toString()}function YKe(t){switch(t?.replace("-sess","")){case"SHA-256":return e=>Lm(JY(e));default:return e=>Lm(cb(e))}}function HKe(t){try{const r=new URL(t).hostname;return r==="localhost"||r==="127.0.0.1"}catch{return!1}}function nj(t,e=window.location.origin){try{const r=new URL(t);return e===r.origin}catch{return!1}}function JKe(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 KKe=["json","xml","html","text"],eet=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function P$(t,e){return t.get(e)??t.get(e.toLowerCase())}function tet(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function ret(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 net(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function iet(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const r=t.toLowerCase();return eet.some(n=>r.includes(n))?!0:r.startsWith("application/")?!KKe.some(n=>r.includes(n)):!1}async function oet(t,e){const r=P$(t.headers,"content-type")?.split(";")[0].trim(),n=P$(t.headers,"content-disposition"),i=tet(P$(t.headers,"content-length")),o=iet(r,n),s=JKe(document.cookie);if(o){const p={fileName:ret(n)||net(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 set=":/?#[]@!$&'()*+,;=",aet=new Set(["!","'","(",")","*"]);function cet(t){return aet.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function AW(t,e=!1){let r=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return r;const n=[...set].map(i=>({char:i,encoded:cet(i)}));for(const{char:i,encoded:o}of n)r=r.split(o).join(i);return r}function RW(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 mce(t,e){let r=RW(t);const n=e.find(({host:i,port:o})=>RW(`https://${i}:${o}`)===r);return{clientCert:n?.crtFilePath,clientKey:n?.keyFilePath}}function uet(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function det(t,e){const{exists:r}=await Promise.resolve().then(()=>kk),{join:n}=await Promise.resolve().then(()=>_ne),{baseName:i,extension:o}=uet(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 pet(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}function fet(t){if(t!=null)return t}function pD(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function gce(t,e){if(!e)return"same-origin";try{const r=new URL(e).origin;return new URL(pD(t)).origin===r?"include":"same-origin"}catch{return"same-origin"}}async function yce({store:t,step:e,settings:r,workflow:n,collection:i,signal:o}){const{corsProxyUrl:s,credentialOrigin:a,certificates:l}=r.get(),c=Lg(t),{url:u,method:d}=dD(e.get(),n?.get(),i?.get(),c),p=s||"",h=xce(e,n,i,t),m=HKe(u)||nj(u),g=Iet({proxyUrl:p,resolvedUrl:u,ignoreProxy:m,queryParameters:h});await met(e,n??void 0,g,a,o);const y=hD(e,n??void 0,i??void 0,t),v=fet(fD(e,t)),{clientCert:O,clientKey:b}=mce(u,l||[]),x=pD(g),w=d.toUpperCase(),_=!Rg.includes(w),S=_?"POST":w,$=_?{...y,"X-HTTP-Method-Override":w}:y;return{urlWithProxyAndProtocol:x,fetchMethod:S,fetchHeaders:$,body:v,credentials:gce(x,a),mode:nj(x)?"same-origin":"cors",clientCert:O,clientKey:b,resolvedUrl:u}}async function vce(t,e,r,n){const{requestController:i}=t,s=Xf(t).data;if(s.type.get()!==nt.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()),h=p?.workflows.find(y=>y.workflowId.get()===l.get()),m=Sl(e.get({noproxy:!0}));d.set(!0),i.get()?.abort?.(),i.set(new AbortController);const g=i.get()?.signal;try{const y=await yce({store:t,step:e,settings:r,workflow:h,collection:p,signal:g}),v=Date.now(),O={signal:g,method:y.fetchMethod,headers:y.fetchHeaders,body:y.body,mode:y.mode,credentials:y.credentials,clientCert:y.clientCert,clientKey:y.clientKey},b=await _l(y.urlWithProxyAndProtocol,O),x=Date.now()-v;u.set(null),c.set(await oet(b,x));const w=Sl(c.value);n?.(m,w)}catch(y){if(c.set(null),y.name==="AbortError")return;u.set(y.message||String(y));const v=Sl(c.value);n?.(m,v)}finally{d.set(!1)}}async function het({store:t,step:e,settings:r,workflow:n,collection:i,fileName:o,onProgress:s}){const a=await yce({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=Xr(),p=o||"response";let h=null;if(d){const{open:_}=await Promise.resolve().then(()=>require("./replay-index-CMDZK_WV.js")),S=await _({directory:!0,multiple:!1});if(!S)return;const $=Array.isArray(S)?S[0]:S;h=await det($,p)}const m=await _l(a.urlWithProxyAndProtocol,l),g=m.headers.get("content-length"),y=g?Number.parseInt(g,10):void 0,v=Number.isFinite(y)?y:void 0,O=m.headers.get("content-type")??void 0;let b;if(m.body?.getReader){const _=m.body.getReader(),S=[];let $=0;for(;;){const{done:E,value:N}=await _.read();if(E)break;if(N){const R=new Uint8Array(N.byteLength);R.set(N),S.push(R.buffer),$+=N.byteLength,s?.({receivedBytes:$,totalBytes:v,done:!1})}}b=new Blob(S,{type:O}),s?.({receivedBytes:$,totalBytes:v,done:!0})}else b=await m.blob(),s?.({receivedBytes:b.size,totalBytes:v,done:!0});if(d){const{writeFile:_}=await Promise.resolve().then(()=>kk),S=new Uint8Array(await b.arrayBuffer());if(!h)return;await _(h,S);return}const x=window.URL.createObjectURL(b),w=document.createElement("a");w.href=x,w.download=p,w.rel="noopener",w.click(),window.URL.revokeObjectURL(x)}async function met(t,e,r,n,i){const o=Of(t),a=[...Array.from(e?.security||[]),...Array.from(t.security)].findLast(l=>l.securityType.get()===ve.DigestAuth);if(a){const l=pD(r),c=await _l(l,{signal:i,method:o.toUpperCase(),credentials:gce(l,n),mode:nj(l)?"same-origin":"cors"}),u=ZKe(c.headers.get("WWW-Authenticate")||"");a[ve.DigestAuth].merge({nonce:u.nonce,realm:u.realm,qop:u.qop,algorithm:u.algorithm,opaque:u.opaque,cnonce:crypto.randomUUID(),nc:"00000001"})}}function get(t,e,r,n){return[...e?.security.get()||[],...t.security.get()].map(i=>{switch(i.securityType){case ve.BasicAuth:{const o=i[ve.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+btoa(`${vo(o.username,n)}:${vo(o.password,n)}`),active:!0,in:"header"}}case ve.DigestAuth:{const o=Lg(n);return{id:"",key:"Authorization",value:XKe(t.get(),e?.get(),r?.get(),o),active:!0,in:"header"}}case ve.JWT:return{id:"",key:"Authorization",value:"Bearer "+i[ve.JWT].token,active:!0,in:"header"};case ve.OAuth2:{const{grantType:o}=i[ve.OAuth2],{accessToken:s}=i[ve.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+s,active:!0,in:"header"}}case ve.OpenIDConnect:{const{grantType:o}=i[ve.OpenIDConnect],{accessToken:s}=i[ve.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+s,active:!0,in:"header"}}case ve.APIKey:{const o=i[ve.APIKey];return o.location===sa.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(i=>!!i)}function yet(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?.filter(b=>b.in==="query"),u=r.parameters?.filter(b=>b.in==="header"),d=r.parameters?.filter(b=>b.in==="cookie"),p=n?.path!==r.path,h=r.method.toLowerCase()!==n?.method.toLowerCase(),m=r.body?.mediaTypes&&r.body?.mediaTypes?.[i.type]===void 0,g=u&&!u.every(b=>s.some(x=>!Fp(x)&&x.key===b.name)),y=d&&!d.every(b=>a.some(x=>!Fp(x)&&x.key===b.name)),v=c&&!c.every(b=>l.some(x=>!Fp(x)&&x.key===b.name)),O=dGe(t,e,r);return!p&&!h&&!m&&!g&&!y&&!v&&!O}function Oce(t,e){const{requestBody:r}=t,i=Of(t).toUpperCase();if(i==="GET"||i==="HEAD"||i==="OPTIONS")return null;try{switch(r.type.get()){case"JSON":return structuredClone(vo(r.content.get(),e));case"multipart/form-data":return bet(t,e);case"application/x-www-form-urlencoded":return Oet(t,e);case"application/octet-stream":return r.binary.get();default:return vo(r.content.get(),e)}}catch(o){console.error(o)}}function fD(t,e){const{requestBody:r}=t,n=Oce(t,e);if(n===null)return null;switch(r.type.get()){default:return n;case"multipart/form-data":return xet(n);case"application/x-www-form-urlencoded":return vet(n);case"application/octet-stream":return r.binary.ornull?.file.get()??null}}function vet(t){const e=new URLSearchParams;return t.forEach(({key:r,value:n})=>{e.append(r,n)}),e}function Oet(t,e){const{requestBody:r}=t,n=[],i=r.formData["application/x-www-form-urlencoded"];return Sce(i.get()).forEach(o=>{const s=vo(o.value,e);n.push({key:vo(o.key,e),value:s,type:"text"})}),n}function bet(t,e){const{requestBody:r}=t,n=[],i=r.formData["multipart/form-data"];return Sce(i.get()).forEach(({type:o,files:s,value:a,key:l})=>{const c=vo(l,e);if(o==="file"&&s)for(const u of s)n.push({key:c,value:u,type:o});else if(a){const u=vo(a,e);n.push({key:c,value:u,type:o})}}),n}function xet(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 jW(t=[]){return t.filter(e=>{const{securityType:r,[ve.APIKey]:n}=e;return r===ve.APIKey&&n.location===sa.Query&&!!n.name}).map(e=>{const{[ve.APIKey]:r}=e;return{id:"",key:r.name,value:r.key,active:!0,in:"query"}})}function bce(t,e,r){const n=r?.components.parameters.get();return jd("query",[jW(e?.security.get()),jW(t.security.get()),Xn(e?.parameters.queryParameters.get(),n),Xn(t.parameters.queryParameters.get(),n)])}function xce(t,e,r,n){return bce(t,e,r).map(o=>{const s=vo(o.value,n),a=AW(s,o.allowReserved);return`${AW(o.key)}=${a}`}).join("&")}function wet(t,e,r,n){return bce(t,e,r).reduce((o,s)=>{const a=vo(s.value,n),l=vo(s.key,n);return o[l]=a,o},{})}function _et(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 Cet(t){const e=t.split("?")[0],r=pet(e),n=/^\{[^\s]+\}$/,i=r.filter(o=>n.test(o)).map(o=>o.slice(1,-1));return new Set(i)}function hD(t,e,r,n){const i=Tet(t,n),o=get(t,e,r,n),s=ket(t,e,r,n),a=r?.components.parameters.get();return jd("header",[i,o,s,Xn(e?.parameters.headers.get(),a),Xn(t.parameters.headers.get(),a)]).reduce((u,{key:d,value:p})=>(u[d]=vo(p,n),u),{})}function ket(t,e,r,n){const o=wce(t,e,r).map(s=>`${s.key}=${vo(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 Pet(t,e,r,n){return wce(t,e,r).reduce((o,s)=>{const a=vo(s.value,n);return{...o,[vo(s.key,n)]:a}},{})}function NW(t=[]){return t.filter(e=>{const{securityType:r,[ve.APIKey]:n}=e;return r===ve.APIKey&&n.location===sa.Cookie&&!!n.name}).map(e=>{const{[ve.APIKey]:r}=e;return{id:"",key:r.name,value:r.key,active:!0,in:"cookie"}})}function wce(t,e,r){const n=r?.components.parameters.get();return jd("cookie",[NW(e?.security.get()),NW(t.security.get()),Xn(e?.parameters.cookies.get(),n),Xn(t.parameters.cookies.get(),n)])}function Sce(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function Tet(t,e){const{requestBody:r}=t;return!fD(t,e)||["binary","multipart/form-data"].includes(r.type.get())?[]:[{id:"",key:"Content-Type",value:r.type.get(),active:!0,in:"header"}]}function vo(t,e){return e?Gr(t,Lg(e)?.inputs):t}function Iet({proxyUrl:t,resolvedUrl:e,ignoreProxy:r,queryParameters:n=""}){const i=t!=="/"?Z2(t):t;let o;return r||!i?o=e:o=`${i}/${e}`,n&&(o+=`?${n}`),o}function mD(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()||"",h=d.summary.get();return{apiId:r,path:i,method:u,operationId:p,summary:h,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 _ce=(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 Xf({tabsState:{activeTabIdx:t,tabs:e}}){return e[t?.get()??0]}function $et(t){const{environments:e,apis:r,tabsState:{tabs:n}}=t,i=n.filter(l=>l.data.type.get()===nt.Step),o=mD(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:h,apiId:m}=p.get().operation??{};if(!d||!h)return null;const g=t.collections.find(S=>S.id.get()===c),y=g?.workflows.find(S=>S.workflowId.get()===u),v=o.find(S=>S.operationId===h&&S.apiId===m);if(!v)return null;const O=hD(p,y,g,t),b=fD(p,t),x=Pet(p,y,g,t),w=wet(p,y,g,t),_=p.requestBody.activeExampleName;return{apiPath:{path:v.path,method:v.method},requestValues:{cookie:x,header:O,query:w,body:b},activeExampleName:_.get()}}).filter(l=>l!==null),a=Lg(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 Eet(t){const e=t.data.get();switch(e.type){case nt.Workflow:return`${e.collectionId}/${e.workflowId}`;case nt.Collection:return e.collectionId;case nt.Step:return`${e.collectionId}/${e.workflowId}/${e.stepId}`;case nt.WorkflowRun:return`${e.collectionId}/${e.workflowId}`}}function Gf(t){const e=Wt(),r=Xf(e);return!r.get()||t&&!Nn(r.data.get(),t)?{tab:null,tabDataId:void 0}:{tab:r,tabDataId:Eet(r)}}function Aet(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return k.useMemo(()=>n=>{e.forEach(i=>i(n))},e)}const Xk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Fg(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function gD(t){return"nodeType"in t}function gs(t){var e,r;return t?Fg(t)?t:gD(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function yD(t){const{Document:e}=gs(t);return t instanceof e}function zb(t){return Fg(t)?!1:t instanceof gs(t).HTMLElement}function Cce(t){return t instanceof gs(t).SVGElement}function Bg(t){return t?Fg(t)?t.document:gD(t)?yD(t)?t:zb(t)||Cce(t)?t.ownerDocument:document:document:document}const Fa=Xk?k.useLayoutEffect:k.useEffect;function Gk(t){const e=k.useRef(t);return Fa(()=>{e.current=t}),k.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 Ret(){const t=k.useRef(null),e=k.useCallback((n,i)=>{t.current=setInterval(n,i)},[]),r=k.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function jO(t,e){e===void 0&&(e=[t]);const r=k.useRef(t);return Fa(()=>{r.current!==t&&(r.current=t)},e),r}function Ub(t,e){const r=k.useRef();return k.useMemo(()=>{const n=t(r.current);return r.current=n,n},[...e])}function N_(t){const e=Gk(t),r=k.useRef(null),n=k.useCallback(i=>{i!==r.current&&e?.(i,r.current),r.current=i},[]);return[r,n]}function Q_(t){const e=k.useRef();return k.useEffect(()=>{e.current=t},[t]),e.current}let T$={};function Vb(t,e){return k.useMemo(()=>{if(e)return e;const r=T$[t]==null?0:T$[t]+1;return T$[t]=r,t+"-"+r},[t,e])}function kce(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 Rm=kce(1),M_=kce(-1);function jet(t){return"clientX"in t&&"clientY"in t}function Yk(t){if(!t)return!1;const{KeyboardEvent:e}=gs(t.target);return e&&t instanceof e}function Net(t){if(!t)return!1;const{TouchEvent:e}=gs(t.target);return e&&t instanceof e}function D_(t){if(Net(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 jet(t)?{x:t.clientX,y:t.clientY}:null}const Zd=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[Zd.Translate.toString(t),Zd.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),QW="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Qet(t){return t.matches(QW)?t:t.querySelector(QW)}const Met={display:"none"};function Det(t){let{id:e,value:r}=t;return ye.default.createElement("div",{id:e,style:Met},r)}function Let(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 ye.default.createElement("div",{id:e,style:i,role:"status","aria-live":n,"aria-atomic":!0},r)}function qet(){const[t,e]=k.useState("");return{announce:k.useCallback(n=>{n!=null&&e(n)},[]),announcement:t}}const Pce=k.createContext(null);function zet(t){const e=k.useContext(Pce);k.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function Uet(){const[t]=k.useState(()=>new Set),e=k.useCallback(n=>(t.add(n),()=>t.delete(n)),[t]);return[k.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 Vet={draggable:`
|
|
628
|
+
`,Gr=(t,e,r=new Set)=>{const n=dce(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=Gr(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 FKe(t,e){return e.find(r=>r.name===t.slice(1,-1))?.value||t}function BKe(t,e){const r=pce(t);if(!r.length)return f.jsx(EW,{children:t});let n=0;const i=r.flatMap(({start:o,end:s})=>{const a=t.slice(n,o),l=FKe(t.slice(o,s),e);return n=s,[a.length?a:null,l]});return t.slice(n).length&&i.push(t.slice(n)),f.jsx(EW,{children:i.join("")})}function fce(t){return NOe(t)}const hce="New Step";function rj({name:t=hce,workflow:e}={}){let r=t.replaceAll(" ","-").toLowerCase();if(!e)return r;const n=WKe(e);if(n.includes(r)){let i=1;for(;n.includes(`${r}-${i}`);)i++;r=`${r}-${i}`}return r}function WKe(t){return t.steps.filter(e=>e.state.get()!==Ir.Draft).map(e=>e.stepId.get())}function zc({name:t=hce,isDraft:e=!1,fromStep:r,workflow:n,operation:i,apiOperation:o,xOperation:s}={}){if(!r){const l=o?JM(o):null,c=[fa()];return{stepId:rj({name:t,workflow:n}),description:t,outputs:[Qo()],successCriteria:[],state:e?Ir.Draft:Ir.Normal,parameters:{pathParameters:[Tr("path")],queryParameters:[Tr("query")],headers:[Tr("header")],cookies:[Tr("cookie")]},requestBody:__(),xOperation:s??(i?null:{method:"GET",url:""}),security:c,operation:i??null,...l}}const a=r.get({noproxy:!0});return{stepId:rj({name:t,workflow:n}),description:a.description,outputs:a.outputs,successCriteria:a.successCriteria,state:e?Ir.Draft:Ir.Normal,parameters:a.parameters,requestBody:a.requestBody,xOperation:a.xOperation,security:a.security,operation:a.operation}}function Of(t){return fce(t)?t.xOperation?.ornull?.method.get()??t.operation.ornull?.method.get()??"":t.xOperation?.method??t.operation?.method??""}function j_(t){return fce(t)?t.xOperation?.ornull?.url.get()??t.operation.ornull?.nested("path").get()??"":t.xOperation?.url??t.operation?.path??""}function dD(t,e,r,n){const{inputs:i,servers:o}=n,s=K8e(jd("path",[Xn(e?.parameters.pathParameters,r?.components.parameters),Xn(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=qB(a.url,s);else if(l){const h=o.find(g=>g.apiId===l.apiId);u=l.method==="x-query"?"query":l.method,c=(h?.value?tle(h.value,h.variables):"")+qB(l.path,s)}const d=c.split("?")[0];return{url:Gr(d,i),method:u.toUpperCase()}}function ap(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 ZKe(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 XKe(t,e,r,n){const{inputs:i}=n,{requestBody:{content:o}}=t,{url:s,method:a}=dD(t,e,r,n),l=[...e?.security||[],...t.security].findLast(S=>S.securityType===ve.DigestAuth);if(!l)return"";const{username:c,password:u,realm:d,nonce:p,cnonce:h,algorithm:m,qop:g,nc:y,opaque:v}=l[ve.DigestAuth],O=Gr(c,i),{pathname:b,search:x}=new URL(s),w=x?`${b}${x}`:b,_=GKe({username:O,password:Gr(u,i),uri:w,realm:d,nonce:p,cnonce:h,algorithm:m,qop:g,nc:y,method:a,bodyContent:o});return`Digest username="${O}", realm="${d}", nonce="${p}", uri="${w}", qop=${g}, nc=${y}, cnonce="${h}", response="${_}", algorithm=${m}${v?`, opaque="${v}"`:""}`}function GKe(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=YKe(s),h=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(`${h}:${i}:${l}:${o}:${a}:${m}`).toString()}function YKe(t){switch(t?.replace("-sess","")){case"SHA-256":return e=>Lm(JY(e));default:return e=>Lm(cb(e))}}function HKe(t){try{const r=new URL(t).hostname;return r==="localhost"||r==="127.0.0.1"}catch{return!1}}function nj(t,e=window.location.origin){try{const r=new URL(t);return e===r.origin}catch{return!1}}function JKe(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 KKe=["json","xml","html","text"],eet=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function P$(t,e){return t.get(e)??t.get(e.toLowerCase())}function tet(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function ret(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 net(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function iet(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const r=t.toLowerCase();return eet.some(n=>r.includes(n))?!0:r.startsWith("application/")?!KKe.some(n=>r.includes(n)):!1}async function oet(t,e){const r=P$(t.headers,"content-type")?.split(";")[0].trim(),n=P$(t.headers,"content-disposition"),i=tet(P$(t.headers,"content-length")),o=iet(r,n),s=JKe(document.cookie);if(o){const p={fileName:ret(n)||net(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 set=":/?#[]@!$&'()*+,;=",aet=new Set(["!","'","(",")","*"]);function cet(t){return aet.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function AW(t,e=!1){let r=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return r;const n=[...set].map(i=>({char:i,encoded:cet(i)}));for(const{char:i,encoded:o}of n)r=r.split(o).join(i);return r}function RW(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 mce(t,e){let r=RW(t);const n=e.find(({host:i,port:o})=>RW(`https://${i}:${o}`)===r);return{clientCert:n?.crtFilePath,clientKey:n?.keyFilePath}}function uet(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function det(t,e){const{exists:r}=await Promise.resolve().then(()=>kk),{join:n}=await Promise.resolve().then(()=>_ne),{baseName:i,extension:o}=uet(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 pet(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}function fet(t){if(t!=null)return t}function pD(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function gce(t,e){if(!e)return"same-origin";try{const r=new URL(e).origin;return new URL(pD(t)).origin===r?"include":"same-origin"}catch{return"same-origin"}}async function yce({store:t,step:e,settings:r,workflow:n,collection:i,signal:o}){const{corsProxyUrl:s,credentialOrigin:a,certificates:l}=r.get(),c=Lg(t),{url:u,method:d}=dD(e.get(),n?.get(),i?.get(),c),p=s||"",h=xce(e,n,i,t),m=HKe(u)||nj(u),g=Iet({proxyUrl:p,resolvedUrl:u,ignoreProxy:m,queryParameters:h});await met(e,n??void 0,g,a,o);const y=hD(e,n??void 0,i??void 0,t),v=fet(fD(e,t)),{clientCert:O,clientKey:b}=mce(u,l||[]),x=pD(g),w=d.toUpperCase(),_=!Rg.includes(w),S=_?"POST":w,$=_?{...y,"X-HTTP-Method-Override":w}:y;return{urlWithProxyAndProtocol:x,fetchMethod:S,fetchHeaders:$,body:v,credentials:gce(x,a),mode:nj(x)?"same-origin":"cors",clientCert:O,clientKey:b,resolvedUrl:u}}async function vce(t,e,r,n){const{requestController:i}=t,s=Xf(t).data;if(s.type.get()!==nt.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()),h=p?.workflows.find(y=>y.workflowId.get()===l.get()),m=Sl(e.get({noproxy:!0}));d.set(!0),i.get()?.abort?.(),i.set(new AbortController);const g=i.get()?.signal;try{const y=await yce({store:t,step:e,settings:r,workflow:h,collection:p,signal:g}),v=Date.now(),O={signal:g,method:y.fetchMethod,headers:y.fetchHeaders,body:y.body,mode:y.mode,credentials:y.credentials,clientCert:y.clientCert,clientKey:y.clientKey},b=await _l(y.urlWithProxyAndProtocol,O),x=Date.now()-v;u.set(null),c.set(await oet(b,x));const w=Sl(c.value);n?.(m,w)}catch(y){if(c.set(null),y.name==="AbortError")return;u.set(y.message||String(y));const v=Sl(c.value);n?.(m,v)}finally{d.set(!1)}}async function het({store:t,step:e,settings:r,workflow:n,collection:i,fileName:o,onProgress:s}){const a=await yce({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=Xr(),p=o||"response";let h=null;if(d){const{open:_}=await Promise.resolve().then(()=>require("./replay-index-IquGJvOX.js")),S=await _({directory:!0,multiple:!1});if(!S)return;const $=Array.isArray(S)?S[0]:S;h=await det($,p)}const m=await _l(a.urlWithProxyAndProtocol,l),g=m.headers.get("content-length"),y=g?Number.parseInt(g,10):void 0,v=Number.isFinite(y)?y:void 0,O=m.headers.get("content-type")??void 0;let b;if(m.body?.getReader){const _=m.body.getReader(),S=[];let $=0;for(;;){const{done:E,value:N}=await _.read();if(E)break;if(N){const R=new Uint8Array(N.byteLength);R.set(N),S.push(R.buffer),$+=N.byteLength,s?.({receivedBytes:$,totalBytes:v,done:!1})}}b=new Blob(S,{type:O}),s?.({receivedBytes:$,totalBytes:v,done:!0})}else b=await m.blob(),s?.({receivedBytes:b.size,totalBytes:v,done:!0});if(d){const{writeFile:_}=await Promise.resolve().then(()=>kk),S=new Uint8Array(await b.arrayBuffer());if(!h)return;await _(h,S);return}const x=window.URL.createObjectURL(b),w=document.createElement("a");w.href=x,w.download=p,w.rel="noopener",w.click(),window.URL.revokeObjectURL(x)}async function met(t,e,r,n,i){const o=Of(t),a=[...Array.from(e?.security||[]),...Array.from(t.security)].findLast(l=>l.securityType.get()===ve.DigestAuth);if(a){const l=pD(r),c=await _l(l,{signal:i,method:o.toUpperCase(),credentials:gce(l,n),mode:nj(l)?"same-origin":"cors"}),u=ZKe(c.headers.get("WWW-Authenticate")||"");a[ve.DigestAuth].merge({nonce:u.nonce,realm:u.realm,qop:u.qop,algorithm:u.algorithm,opaque:u.opaque,cnonce:crypto.randomUUID(),nc:"00000001"})}}function get(t,e,r,n){return[...e?.security.get()||[],...t.security.get()].map(i=>{switch(i.securityType){case ve.BasicAuth:{const o=i[ve.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+btoa(`${vo(o.username,n)}:${vo(o.password,n)}`),active:!0,in:"header"}}case ve.DigestAuth:{const o=Lg(n);return{id:"",key:"Authorization",value:XKe(t.get(),e?.get(),r?.get(),o),active:!0,in:"header"}}case ve.JWT:return{id:"",key:"Authorization",value:"Bearer "+i[ve.JWT].token,active:!0,in:"header"};case ve.OAuth2:{const{grantType:o}=i[ve.OAuth2],{accessToken:s}=i[ve.OAuth2][o];return{id:"",key:"Authorization",value:"Bearer "+s,active:!0,in:"header"}}case ve.OpenIDConnect:{const{grantType:o}=i[ve.OpenIDConnect],{accessToken:s}=i[ve.OpenIDConnect][o];return{id:"",key:"Authorization",value:"Bearer "+s,active:!0,in:"header"}}case ve.APIKey:{const o=i[ve.APIKey];return o.location===sa.Header?{id:"",key:o.name,value:o.key,active:!0,in:"header"}:null}default:return null}}).filter(i=>!!i)}function yet(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?.filter(b=>b.in==="query"),u=r.parameters?.filter(b=>b.in==="header"),d=r.parameters?.filter(b=>b.in==="cookie"),p=n?.path!==r.path,h=r.method.toLowerCase()!==n?.method.toLowerCase(),m=r.body?.mediaTypes&&r.body?.mediaTypes?.[i.type]===void 0,g=u&&!u.every(b=>s.some(x=>!Fp(x)&&x.key===b.name)),y=d&&!d.every(b=>a.some(x=>!Fp(x)&&x.key===b.name)),v=c&&!c.every(b=>l.some(x=>!Fp(x)&&x.key===b.name)),O=dGe(t,e,r);return!p&&!h&&!m&&!g&&!y&&!v&&!O}function Oce(t,e){const{requestBody:r}=t,i=Of(t).toUpperCase();if(i==="GET"||i==="HEAD"||i==="OPTIONS")return null;try{switch(r.type.get()){case"JSON":return structuredClone(vo(r.content.get(),e));case"multipart/form-data":return bet(t,e);case"application/x-www-form-urlencoded":return Oet(t,e);case"application/octet-stream":return r.binary.get();default:return vo(r.content.get(),e)}}catch(o){console.error(o)}}function fD(t,e){const{requestBody:r}=t,n=Oce(t,e);if(n===null)return null;switch(r.type.get()){default:return n;case"multipart/form-data":return xet(n);case"application/x-www-form-urlencoded":return vet(n);case"application/octet-stream":return r.binary.ornull?.file.get()??null}}function vet(t){const e=new URLSearchParams;return t.forEach(({key:r,value:n})=>{e.append(r,n)}),e}function Oet(t,e){const{requestBody:r}=t,n=[],i=r.formData["application/x-www-form-urlencoded"];return Sce(i.get()).forEach(o=>{const s=vo(o.value,e);n.push({key:vo(o.key,e),value:s,type:"text"})}),n}function bet(t,e){const{requestBody:r}=t,n=[],i=r.formData["multipart/form-data"];return Sce(i.get()).forEach(({type:o,files:s,value:a,key:l})=>{const c=vo(l,e);if(o==="file"&&s)for(const u of s)n.push({key:c,value:u,type:o});else if(a){const u=vo(a,e);n.push({key:c,value:u,type:o})}}),n}function xet(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 jW(t=[]){return t.filter(e=>{const{securityType:r,[ve.APIKey]:n}=e;return r===ve.APIKey&&n.location===sa.Query&&!!n.name}).map(e=>{const{[ve.APIKey]:r}=e;return{id:"",key:r.name,value:r.key,active:!0,in:"query"}})}function bce(t,e,r){const n=r?.components.parameters.get();return jd("query",[jW(e?.security.get()),jW(t.security.get()),Xn(e?.parameters.queryParameters.get(),n),Xn(t.parameters.queryParameters.get(),n)])}function xce(t,e,r,n){return bce(t,e,r).map(o=>{const s=vo(o.value,n),a=AW(s,o.allowReserved);return`${AW(o.key)}=${a}`}).join("&")}function wet(t,e,r,n){return bce(t,e,r).reduce((o,s)=>{const a=vo(s.value,n),l=vo(s.key,n);return o[l]=a,o},{})}function _et(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 Cet(t){const e=t.split("?")[0],r=pet(e),n=/^\{[^\s]+\}$/,i=r.filter(o=>n.test(o)).map(o=>o.slice(1,-1));return new Set(i)}function hD(t,e,r,n){const i=Tet(t,n),o=get(t,e,r,n),s=ket(t,e,r,n),a=r?.components.parameters.get();return jd("header",[i,o,s,Xn(e?.parameters.headers.get(),a),Xn(t.parameters.headers.get(),a)]).reduce((u,{key:d,value:p})=>(u[d]=vo(p,n),u),{})}function ket(t,e,r,n){const o=wce(t,e,r).map(s=>`${s.key}=${vo(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 Pet(t,e,r,n){return wce(t,e,r).reduce((o,s)=>{const a=vo(s.value,n);return{...o,[vo(s.key,n)]:a}},{})}function NW(t=[]){return t.filter(e=>{const{securityType:r,[ve.APIKey]:n}=e;return r===ve.APIKey&&n.location===sa.Cookie&&!!n.name}).map(e=>{const{[ve.APIKey]:r}=e;return{id:"",key:r.name,value:r.key,active:!0,in:"cookie"}})}function wce(t,e,r){const n=r?.components.parameters.get();return jd("cookie",[NW(e?.security.get()),NW(t.security.get()),Xn(e?.parameters.cookies.get(),n),Xn(t.parameters.cookies.get(),n)])}function Sce(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function Tet(t,e){const{requestBody:r}=t;return!fD(t,e)||["binary","multipart/form-data"].includes(r.type.get())?[]:[{id:"",key:"Content-Type",value:r.type.get(),active:!0,in:"header"}]}function vo(t,e){return e?Gr(t,Lg(e)?.inputs):t}function Iet({proxyUrl:t,resolvedUrl:e,ignoreProxy:r,queryParameters:n=""}){const i=t!=="/"?Z2(t):t;let o;return r||!i?o=e:o=`${i}/${e}`,n&&(o+=`?${n}`),o}function mD(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()||"",h=d.summary.get();return{apiId:r,path:i,method:u,operationId:p,summary:h,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 _ce=(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 Xf({tabsState:{activeTabIdx:t,tabs:e}}){return e[t?.get()??0]}function $et(t){const{environments:e,apis:r,tabsState:{tabs:n}}=t,i=n.filter(l=>l.data.type.get()===nt.Step),o=mD(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:h,apiId:m}=p.get().operation??{};if(!d||!h)return null;const g=t.collections.find(S=>S.id.get()===c),y=g?.workflows.find(S=>S.workflowId.get()===u),v=o.find(S=>S.operationId===h&&S.apiId===m);if(!v)return null;const O=hD(p,y,g,t),b=fD(p,t),x=Pet(p,y,g,t),w=wet(p,y,g,t),_=p.requestBody.activeExampleName;return{apiPath:{path:v.path,method:v.method},requestValues:{cookie:x,header:O,query:w,body:b},activeExampleName:_.get()}}).filter(l=>l!==null),a=Lg(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 Eet(t){const e=t.data.get();switch(e.type){case nt.Workflow:return`${e.collectionId}/${e.workflowId}`;case nt.Collection:return e.collectionId;case nt.Step:return`${e.collectionId}/${e.workflowId}/${e.stepId}`;case nt.WorkflowRun:return`${e.collectionId}/${e.workflowId}`}}function Gf(t){const e=Wt(),r=Xf(e);return!r.get()||t&&!Nn(r.data.get(),t)?{tab:null,tabDataId:void 0}:{tab:r,tabDataId:Eet(r)}}function Aet(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return k.useMemo(()=>n=>{e.forEach(i=>i(n))},e)}const Xk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Fg(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function gD(t){return"nodeType"in t}function gs(t){var e,r;return t?Fg(t)?t:gD(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function yD(t){const{Document:e}=gs(t);return t instanceof e}function zb(t){return Fg(t)?!1:t instanceof gs(t).HTMLElement}function Cce(t){return t instanceof gs(t).SVGElement}function Bg(t){return t?Fg(t)?t.document:gD(t)?yD(t)?t:zb(t)||Cce(t)?t.ownerDocument:document:document:document}const Fa=Xk?k.useLayoutEffect:k.useEffect;function Gk(t){const e=k.useRef(t);return Fa(()=>{e.current=t}),k.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 Ret(){const t=k.useRef(null),e=k.useCallback((n,i)=>{t.current=setInterval(n,i)},[]),r=k.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function jO(t,e){e===void 0&&(e=[t]);const r=k.useRef(t);return Fa(()=>{r.current!==t&&(r.current=t)},e),r}function Ub(t,e){const r=k.useRef();return k.useMemo(()=>{const n=t(r.current);return r.current=n,n},[...e])}function N_(t){const e=Gk(t),r=k.useRef(null),n=k.useCallback(i=>{i!==r.current&&e?.(i,r.current),r.current=i},[]);return[r,n]}function Q_(t){const e=k.useRef();return k.useEffect(()=>{e.current=t},[t]),e.current}let T$={};function Vb(t,e){return k.useMemo(()=>{if(e)return e;const r=T$[t]==null?0:T$[t]+1;return T$[t]=r,t+"-"+r},[t,e])}function kce(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 Rm=kce(1),M_=kce(-1);function jet(t){return"clientX"in t&&"clientY"in t}function Yk(t){if(!t)return!1;const{KeyboardEvent:e}=gs(t.target);return e&&t instanceof e}function Net(t){if(!t)return!1;const{TouchEvent:e}=gs(t.target);return e&&t instanceof e}function D_(t){if(Net(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 jet(t)?{x:t.clientX,y:t.clientY}:null}const Zd=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[Zd.Translate.toString(t),Zd.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),QW="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Qet(t){return t.matches(QW)?t:t.querySelector(QW)}const Met={display:"none"};function Det(t){let{id:e,value:r}=t;return ye.default.createElement("div",{id:e,style:Met},r)}function Let(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 ye.default.createElement("div",{id:e,style:i,role:"status","aria-live":n,"aria-atomic":!0},r)}function qet(){const[t,e]=k.useState("");return{announce:k.useCallback(n=>{n!=null&&e(n)},[]),announcement:t}}const Pce=k.createContext(null);function zet(t){const e=k.useContext(Pce);k.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function Uet(){const[t]=k.useState(()=>new Set),e=k.useCallback(n=>(t.add(n),()=>t.delete(n)),[t]);return[k.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 Vet={draggable:`
|
|
629
629
|
To pick up a draggable item, press the space bar.
|
|
630
630
|
While dragging, use the arrow keys to move the item.
|
|
631
631
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
@@ -3291,7 +3291,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
3291
3291
|
gap: var(--spacing-xs);
|
|
3292
3292
|
`,DS={[Qi.SIMPLE]:{label:"Simple",tooltipContent:"Success criteria conditions in the form of basic literals, operators, and loose comparisons"},[Qi.REGEX]:{label:"Regex",tooltipContent:"Regex patterns used as success criteria conditions"},[Qi.JSONPATH]:{label:"JSONPath",tooltipContent:"JSONPath expressions as success criteria conditions"},[Qi.XPATH]:{label:"XPath",tooltipContent:"XPath expressions as success criteria conditions"}},Obt=Object.keys(DS);function bbt({successCriteria:t}){const{sendEvent:e}=$t(),r=o=>{e("button.click",[{source:"workflow",action:"add_success_criteria",success_criteria_type:o}]),t.set(s=>[...s||[],{...XM(o)}])},n=k.useMemo(()=>t.filter(o=>o.get()!==void 0),[t]),i=o=>{e("button.click",[{source:"workflow",action:"remove_success_criteria",success_criteria_type:o.get().type,condition:o.get().condition}]),o.set(Zt)};return f.jsxs(f.Fragment,{children:[f.jsxs(Uc,{children:["Success criteria",f.jsx(Es,{content:"List of conditions required to complete the step."})]}),n.map(o=>f.jsx(k.Fragment,{children:f.jsx(hbt,{successCriteria:o,label:DS[o.get().type].label,tooltipContent:DS[o.get().type].tooltipContent,additionalActions:f.jsx(ds,{"data-testid":"remove-success-criteria-button",variant:"text",icon:f.jsx(j.TrashCanIcon,{}),onClick:()=>i(o)})})},o.get().id)),f.jsx(xbt,{renderInput:()=>f.jsx(j.Button,{variant:"outlined",icon:f.jsx(j.AddIcon,{}),iconPosition:"left",size:"small",children:"Add success criteria"}),dataTestId:"workflow-step-success-criteria-select",options:Obt.map(o=>({element:DS[o].label,label:o,value:o})),onChange:o=>{r(o)},placement:"top",hideCheckmarkIcon:!0})]})}const xbt=P.default(j.Select)`
|
|
3293
3293
|
border-radius: var(--border-radius-md);
|
|
3294
|
-
`;function wbt({step:t,workflowId:e,collectionId:r}){const{handleIdChange:n}=Wf(),i=t.stepId.get();return f.jsx(f.Fragment,{children:f.jsxs(efe,{children:[f.jsx(Uc,{children:"Info"}),f.jsxs(jr,{children:[f.jsxs(jr.Row,{children:[f.jsx(jr.Cell,{children:f.jsxs(ef,{children:["Step ID",f.jsx(Es,{content:"This step's unique identifier"})]})}),f.jsx(jr.Cell,{$readonly:!0,children:f.jsx(Nj,{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})}})})]}),f.jsxs(jr.Row,{children:[f.jsx(jr.Cell,{children:f.jsxs(ef,{children:["Description",f.jsx(Es,{content:"The step's purpose in the workflow."})]})}),f.jsx(jr.Cell,{children:f.jsx(UD,{state:t.description,placeholder:"Add description"})})]})]}),f.jsxs(Nm,{children:[f.jsx(Uc,{children:"Operation"}),f.jsx(ubt,{step:t,collectionId:r})]}),f.jsx(Nm,{children:f.jsx(Kpe,{outputs:t.outputs,tooltipText:"Data generated in this step that can be used in the next steps."})}),f.jsx(Nm,{children:f.jsx(bbt,{successCriteria:t.successCriteria})})]})})}function Sbt({onParameterChange:t,files:e}){const r=k.useRef(null),n=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(Xr())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-
|
|
3294
|
+
`;function wbt({step:t,workflowId:e,collectionId:r}){const{handleIdChange:n}=Wf(),i=t.stepId.get();return f.jsx(f.Fragment,{children:f.jsxs(efe,{children:[f.jsx(Uc,{children:"Info"}),f.jsxs(jr,{children:[f.jsxs(jr.Row,{children:[f.jsx(jr.Cell,{children:f.jsxs(ef,{children:["Step ID",f.jsx(Es,{content:"This step's unique identifier"})]})}),f.jsx(jr.Cell,{$readonly:!0,children:f.jsx(Nj,{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})}})})]}),f.jsxs(jr.Row,{children:[f.jsx(jr.Cell,{children:f.jsxs(ef,{children:["Description",f.jsx(Es,{content:"The step's purpose in the workflow."})]})}),f.jsx(jr.Cell,{children:f.jsx(UD,{state:t.description,placeholder:"Add description"})})]})]}),f.jsxs(Nm,{children:[f.jsx(Uc,{children:"Operation"}),f.jsx(ubt,{step:t,collectionId:r})]}),f.jsx(Nm,{children:f.jsx(Kpe,{outputs:t.outputs,tooltipText:"Data generated in this step that can be used in the next steps."})}),f.jsx(Nm,{children:f.jsx(bbt,{successCriteria:t.successCriteria})})]})})}function Sbt({onParameterChange:t,files:e}){const r=k.useRef(null),n=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(Xr())try{const{open:a}=await Promise.resolve().then(()=>require("./replay-index-IquGJvOX.js")),l=await a({multiple:!0});if(!l)return;const u=(Array.isArray(l)?l:[l]).map(Db),p=(await Promise.all(u)).filter(h=>h!==null);t(p)}catch(a){console.error("Failed to open file dialog or read file:",a)}else r.current?.click()},o=k.useCallback(()=>{t(null)},[t]),s=k.useMemo(()=>{if(!e)return null;if(e.length===1)return f.jsx(r6,{icon:f.jsx(j.CloseIcon,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:f.jsx(n6,{children:e[0].file.name})});if(e.length>1)return f.jsx(r6,{icon:f.jsx(j.CloseIcon,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:f.jsxs(n6,{children:[e.length," files"]})})},[e,o]);return f.jsx(_bt,{children:f.jsxs(Cbt,{children:[f.jsx(kbt,{children:s||f.jsx(Tbt,{children:"Add files here"})}),f.jsxs(Pbt,{children:[f.jsx(YYe,{onClick:i,variant:"text","data-testid":"add-button",icon:f.jsx(j.AddIcon,{color:"--text-color-secondary"})}),f.jsx("input",{"data-testid":"file-input",hidden:!0,ref:r,type:"file",multiple:!0,accept:"files/*",onChange:n})]})]})})}const _bt=P.default.div`
|
|
3295
3295
|
position: relative;
|
|
3296
3296
|
display: flex;
|
|
3297
3297
|
flex-grow: 1;
|
|
@@ -3418,7 +3418,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
3418
3418
|
`,Ubt=P.default.div`
|
|
3419
3419
|
display: flex;
|
|
3420
3420
|
justify-content: center;
|
|
3421
|
-
`;function Vbt({data:t,type:e}){const r=Nr(),n=t[e];function i(s,a){a&&n.merge([Pu()])}function o(s){n[s].set(Zt)}return f.jsx($bt,{keyName:"Param",formElements:n,onParameterChange:i,environment:r,enableInputTypeSelection:e!==di["application/x-www-form-urlencoded"],actions:s=>f.jsx(ds,{onClick:()=>o(s),variant:"text",icon:f.jsx(j.TrashCanIcon,{})})})}const Fbt=({data:t})=>{const e=t.get(),[r,n]=k.useState(!1),i=k.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(Xr())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-
|
|
3421
|
+
`;function Vbt({data:t,type:e}){const r=Nr(),n=t[e];function i(s,a){a&&n.merge([Pu()])}function o(s){n[s].set(Zt)}return f.jsx($bt,{keyName:"Param",formElements:n,onParameterChange:i,environment:r,enableInputTypeSelection:e!==di["application/x-www-form-urlencoded"],actions:s=>f.jsx(ds,{onClick:()=>o(s),variant:"text",icon:f.jsx(j.TrashCanIcon,{})})})}const Fbt=({data:t})=>{const e=t.get(),[r,n]=k.useState(!1),i=k.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(Xr())try{const{open:l}=await Promise.resolve().then(()=>require("./replay-index-IquGJvOX.js")),c=await l();if(!c)return;const u=await Db(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?f.jsxs(Bbt,{children:[f.jsx(j.SpinnerIcon,{}),"Loading..."]}):e&&e.file?.name?f.jsxs(Wbt,{children:[f.jsxs(Zbt,{children:[f.jsx(j.DocumentBlankIcon,{size:"16px"}),f.jsx(Xbt,{children:e.file?.name})]}),f.jsx(ds,{onClick:a,icon:f.jsx(j.TrashCanIcon,{})})]}):f.jsx(tfe,{children:!e&&f.jsxs(f.Fragment,{children:[f.jsx("input",{type:"file",hidden:!0,ref:i,onChange:o}),f.jsx(j.Button,{type:"button",variant:"text",onClick:s,icon:f.jsx(j.CloudUploadIcon,{}),children:"Upload file"})]})})},tfe=P.default.div`
|
|
3422
3422
|
display: flex;
|
|
3423
3423
|
align-items: center;
|
|
3424
3424
|
justify-content: flex-start;
|
|
@@ -4236,7 +4236,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
4236
4236
|
@media (max-width: ${Do}px) {
|
|
4237
4237
|
padding: var(--spacing-xs) var(--spacing-sm);
|
|
4238
4238
|
}
|
|
4239
|
-
`,tSt={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t},rSt=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function nSt({collectionId:t,workflowId:e}){const{project:{userFilesDir:r}}=Wt(),{certificates:n}=bo(),i=Nr(),{getCollection:o}=Fu(),s=o(t),a=r.get(),{inputs:l,servers:c}=i.get(),u=s?.sourceDescriptions.get()??[];return{execute:async p=>{const h=`${a}/${t}`,m=new vle,g=l.map(O=>JSON.stringify({[O.name]:O.value})),y=iSt(c,u),{run:v}=await Promise.resolve().then(()=>require("./replay-respect-run-
|
|
4239
|
+
`,tSt={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t},rSt=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function nSt({collectionId:t,workflowId:e}){const{project:{userFilesDir:r}}=Wt(),{certificates:n}=bo(),i=Nr(),{getCollection:o}=Fu(),s=o(t),a=r.get(),{inputs:l,servers:c}=i.get(),u=s?.sourceDescriptions.get()??[];return{execute:async p=>{const h=`${a}/${t}`,m=new vle,g=l.map(O=>JSON.stringify({[O.name]:O.value})),y=iSt(c,u),{run:v}=await Promise.resolve().then(()=>require("./replay-respect-run-DAhUpEqU.js"));return await v({files:[h],workflow:e?[e]:[],fetch:(O,b)=>{const x=rSt(O),{clientCert:w,clientKey:_}=mce(x,n?n.get({noproxy:!0}):[]);return _l(x,{...b,clientCert:w,clientKey:_})},logger:tSt,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async O=>{if(!await Ck(O))throw new Error(`File ${O} doesn't exist or isn't readable.`);try{const x=await _k(O),w=new TextEncoder().encode(x);return new File([w],await VQ(O))}catch(x){throw new Error(`Failed to read file ${O}: ${x}`)}}},envVariables:{},config:await tte({}),externalRefResolver:m,input:g,server:y,severity:JSON.stringify(p),skipLint:!0,noSecretsMasking:!0})}}}function iSt(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 EP(t){return t==null?"N/A":t<1e3?`${t} ms`:t<1e4?`${(t/1e3).toFixed(1)} s`:`${Math.round(t/1e3)} s`}function bfe({checks:t}){const e=t.filter(h=>h.severity!=="off"),r=e.filter(h=>h.passed).length,n=e.filter(h=>h.severity==="warn"&&!h.passed).length,i=e.length,o=i-r-n,s=r===i,a=r===0,[l,c]=ye.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?f.jsx(j.CheckmarkFilledIcon,{color:"var(--color-success-base)"}):o>0?f.jsx(j.ErrorFilledIcon,{color:"var(--color-error-base)"}):f.jsx(j.WarningFilledIcon,{color:"var(--color-warning-base)"}),p=h=>{h.stopPropagation(),c(!l)};return!e||e.length===0?null:f.jsxs(oSt,{children:[f.jsxs(sSt,{onClick:p,children:[f.jsxs(aSt,{children:[f.jsx(lSt,{children:f.jsx(cSt,{children:d()})}),f.jsxs(uSt,{children:[f.jsx(dSt,{children:u()}),f.jsxs(pSt,{children:[r," successful",n>0&&f.jsxs(f.Fragment,{children:[", ",n," ",n===1?"warning":"warnings"]}),o>0&&f.jsxs(f.Fragment,{children:[", ",o," failed"]})]})]})]}),f.jsx(fSt,{isExpanded:l,children:l?f.jsx(j.ChevronDownIcon,{}):f.jsx(j.ChevronRightIcon,{})})]}),f.jsx(hSt,{isExpanded:l,children:e.map((h,m)=>f.jsxs(mSt,{children:[f.jsx(gSt,{children:h.passed?f.jsx(j.CheckmarkIcon,{color:"var(--color-success-base)",size:"14px"}):!h.passed&&["warn"].includes(h.severity)?f.jsx(j.WarningFilledIcon,{color:"var(--color-warning-base)",size:"14px"}):f.jsx(j.CloseOutlineIcon,{color:"var(--color-error-base)",size:"14px"})}),f.jsxs(ySt,{children:[f.jsx(vSt,{children:h.name}),h.message&&f.jsx(OSt,{children:h.message})]})]},m))})]})}const oSt=P.default.div`
|
|
4240
4240
|
margin-bottom: 0;
|
|
4241
4241
|
margin-top: var(--spacing-xxs);
|
|
4242
4242
|
`,sSt=P.default.div`
|