sliccy 6.1.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/ui/assets/{account-store-BnUIIjUC.js → account-store-DhS8k8-S.js} +1 -1
  2. package/dist/ui/assets/account-store-Uj6VFvmJ.js +101 -0
  3. package/dist/ui/assets/adobe-B8qKdXEi.js +1 -0
  4. package/dist/ui/assets/{adobe-JmXV9kQp.js → adobe-DEqarHF7.js} +1 -1
  5. package/dist/ui/assets/{anthropic-messages-Cx3KdHDK.js → anthropic-messages-C8dDJE2X.js} +3 -3
  6. package/dist/ui/assets/{apps-eLp3JMi9.js → apps-Bie0e1m2.js} +1 -1
  7. package/dist/ui/assets/{azure-openai-WQPrzmzl.js → azure-openai-DuVr84k9.js} +1 -1
  8. package/dist/ui/assets/azure-openai-DvSSRCkA.js +1 -0
  9. package/dist/ui/assets/azure-openai-responses-CzG7X9qb.js +1 -0
  10. package/dist/ui/assets/bedrock-camp-DS0ilb3O.js +1 -0
  11. package/dist/ui/assets/cerebras-BpS22jYI.js +1 -0
  12. package/dist/ui/assets/{cerebras-Bzd0OB3R.js → cerebras-DzesQTXW.js} +1 -1
  13. package/dist/ui/assets/{connect-surface-C79IWXLS.js → connect-surface-Ct1AdFki.js} +1 -1
  14. package/dist/ui/assets/frozen-archive-format-CqpMlNNW.js +1 -0
  15. package/dist/ui/assets/{fs-BKwOXUGY.js → fs-CvnWZ6Jt.js} +1 -1
  16. package/dist/ui/assets/{fs-CPzDCGWj.js → fs-DIJccx8q.js} +2 -2
  17. package/dist/ui/assets/{github-copilot-BZDUFdt5.js → github-copilot-BiPqFhNX.js} +1 -1
  18. package/dist/ui/assets/github-copilot-VvH4s7sA.js +1 -0
  19. package/dist/ui/assets/{github-XkSGCSpp.js → github-dAErpFvL.js} +1 -1
  20. package/dist/ui/assets/{github-CDT9ErFJ.js → github-pk5_ylPv.js} +2 -2
  21. package/dist/ui/assets/google-generative-ai-DzD1vsXe.js +1 -0
  22. package/dist/ui/assets/{google-shared-DLE9jWCI.js → google-shared-BAKd3aSn.js} +1 -1
  23. package/dist/ui/assets/google-vertex-oQOD3HKr.js +1 -0
  24. package/dist/ui/assets/{kernel-worker-B4A3VjuZ.js → kernel-worker-ajcnNy0f.js} +630 -616
  25. package/dist/ui/assets/legacy-api-aliases-YuuBU-he.js +1 -0
  26. package/dist/ui/assets/{local-llm-BknCmmbt.js → local-llm-CJRbK1cS.js} +1 -1
  27. package/dist/ui/assets/{local-llm-6IajVSOQ.js → local-llm-CfVfbBNa.js} +1 -1
  28. package/dist/ui/assets/{main-5mEHTbp1.js → main-7V25oAV9.js} +3 -3
  29. package/dist/ui/assets/{mistral-conversations-BBexKxUC.js → mistral-conversations-CKK59QJS.js} +2 -2
  30. package/dist/ui/assets/{mount-DbCOeMHV.js → mount-Bsul2M7V.js} +2 -2
  31. package/dist/ui/assets/{mount-B6vXbOCk.js → mount-CRp56aa2.js} +1 -1
  32. package/dist/ui/assets/{mount-recovery-DFVBuWuW.js → mount-recovery-B6-FEnb7.js} +1 -1
  33. package/dist/ui/assets/new-session-BMY81iI-.js +2 -0
  34. package/dist/ui/assets/{oauth-bootstrap-9zGNab0F.js → oauth-bootstrap-DFhqreg0.js} +2 -2
  35. package/dist/ui/assets/{openai-codex-DhP3Bc4o.js → openai-codex-5ly8mDcH.js} +1 -1
  36. package/dist/ui/assets/openai-codex-o65C3vHM.js +1 -0
  37. package/dist/ui/assets/openai-codex-responses-DU5CHdDQ.js +7 -0
  38. package/dist/ui/assets/openai-completions-DhKgaAgM.js +5 -0
  39. package/dist/ui/assets/openai-responses-C4_jiYtu.js +1 -0
  40. package/dist/ui/assets/{openai-responses-shared-BU1VYwTh.js → openai-responses-shared-CiIL52L-.js} +5 -5
  41. package/dist/ui/assets/openrouter-Bl8rKbdM.js +1 -0
  42. package/dist/ui/assets/{openrouter-C6LzaTJh.js → openrouter-DZzCgoha.js} +1 -1
  43. package/dist/ui/assets/{openrouter-oauth-DIXeQ6QT.js → openrouter-oauth-DIW_pyO2.js} +1 -1
  44. package/dist/ui/assets/{openrouter-oauth-CLIQCCLY.js → openrouter-oauth-tJu_AMDh.js} +1 -1
  45. package/dist/ui/assets/{panel-rpc-handlers-Dyt8XcM7.js → panel-rpc-handlers-BN4BCAVK.js} +2 -2
  46. package/dist/ui/assets/{provider-BxyjRM0f.js → provider-BCQiQFKs.js} +1 -1
  47. package/dist/ui/assets/{provider-DW9RLF-a.js → provider-BaiyZqj2.js} +2 -2
  48. package/dist/ui/assets/{provider-settings-BXwbB8RF.js → provider-settings-CXes7fTR.js} +1 -1
  49. package/dist/ui/assets/{provider-settings-CzM2hHtV.js → provider-settings-VxXaQXu5.js} +1 -1
  50. package/dist/ui/assets/{provider-store-access-M-631pba.js → provider-store-access-B0oECQqK.js} +2 -2
  51. package/dist/ui/assets/provider-store-access-fl-MsQpU.js +1 -0
  52. package/dist/ui/assets/{providers-DQpYSqlR.js → providers-BwP_K_jW.js} +1 -1
  53. package/dist/ui/assets/{providers-BU_CYZEQ.js → providers-Bz0SwL53.js} +2 -2
  54. package/dist/ui/assets/{quick-llm-BmxcWrG9.js → quick-llm-P9wxZ7EU.js} +1 -1
  55. package/dist/ui/assets/{session-freezer-C9bwD5or.js → session-freezer-CueXX5nZ.js} +2 -2
  56. package/dist/ui/assets/{setup-standalone-prelude-DmP6XzHq.js → setup-standalone-prelude-BfeEnJkN.js} +1 -1
  57. package/dist/ui/assets/{setup-sudo-Disgv7TU.js → setup-sudo-DCOcjx2c.js} +2 -2
  58. package/dist/ui/assets/{skills-JWBWz93Y.js → skills-D_Ep23NZ.js} +1 -1
  59. package/dist/ui/assets/{sprinkle-manager-DwLCgrU9.js → sprinkle-manager-HaNmX2ye.js} +1 -1
  60. package/dist/ui/assets/{src-Bq5z8yvo.js → src-BTviaay1.js} +2 -2
  61. package/dist/ui/assets/{store-W4scCsQ2.js → store-CguDkxqH.js} +1 -1
  62. package/dist/ui/assets/{sudo-DlJO76Iy.js → sudo-V2MeKwLU.js} +1 -1
  63. package/dist/ui/assets/{telemetry-C8rZr13D.js → telemetry-DqIqVG5n.js} +3 -3
  64. package/dist/ui/assets/{models-CvUrqKSj.js → transform-messages-Bp94o3FD.js} +1 -1
  65. package/dist/ui/assets/{upgrade-detection-I9bwQZ3A.js → upgrade-detection-CGfE8fu7.js} +1 -1
  66. package/dist/ui/assets/{wc-attach-BCbFKAxf.js → wc-attach-KYdIYwcc.js} +2 -2
  67. package/dist/ui/assets/{wc-extension-C8rP0TQ5.js → wc-extension-CqFkjCEc.js} +2 -2
  68. package/dist/ui/assets/{wc-follower-BZbGw9cM.js → wc-follower-bcBXL4QF.js} +3 -3
  69. package/dist/ui/assets/wc-live-1igAgrHi.js +8 -0
  70. package/dist/ui/assets/{wc-nav-CeMp5ghF.js → wc-nav-s0llKqeE.js} +2 -2
  71. package/dist/ui/assets/{wc-onboarding-BW3KMsBt.js → wc-onboarding-CedoFc5j.js} +2 -2
  72. package/dist/ui/assets/{wc-placeholder-CvsaP7X6.js → wc-placeholder-DhOwMxPG.js} +2 -2
  73. package/dist/ui/assets/{wc-settings-nRxDO_kn.js → wc-settings-_h48_7UA.js} +2 -2
  74. package/dist/ui/assets/{wc-shell-DGg7WImK.js → wc-shell-Dmpb_Nl-.js} +21 -21
  75. package/dist/ui/assets/{wc-sprinkles-DiBOBknV.js → wc-sprinkles-BUPl0ZFx.js} +2 -2
  76. package/dist/ui/assets/{wc-tray-HHHE6vhN.js → wc-tray-C-KZScxb.js} +2 -2
  77. package/dist/ui/assets/xai-grok-BOdrR1oK.js +1 -0
  78. package/dist/ui/assets/{xai-grok-Dw-lxH04.js → xai-grok-JLJFEJOt.js} +1 -1
  79. package/dist/ui/index.html +7 -7
  80. package/dist/ui/llm-proxy-sw.js +1 -1
  81. package/dist/ui/packages/webapp/index.html +7 -7
  82. package/package.json +1 -1
  83. package/dist/ui/assets/account-store-Bj2PFEoD.js +0 -44
  84. package/dist/ui/assets/adobe-Czr7m_TT.js +0 -1
  85. package/dist/ui/assets/azure-openai-DmUBjHKn.js +0 -1
  86. package/dist/ui/assets/azure-openai-responses-D2e4727V.js +0 -1
  87. package/dist/ui/assets/bedrock-camp-CvcU-31w.js +0 -1
  88. package/dist/ui/assets/cerebras-B6OFJhQY.js +0 -1
  89. package/dist/ui/assets/compat-BHfpuQ4D.js +0 -1
  90. package/dist/ui/assets/cone-memory-budget-CfbbleAM.js +0 -15
  91. package/dist/ui/assets/context-compaction-DDE4L-Sj.js +0 -58
  92. package/dist/ui/assets/github-copilot-BLsTiukB.js +0 -1
  93. package/dist/ui/assets/google-generative-ai-BPByyH06.js +0 -1
  94. package/dist/ui/assets/google-vertex-0jNZ5aI-.js +0 -1
  95. package/dist/ui/assets/legacy-api-aliases-BLiHiLlu.js +0 -1
  96. package/dist/ui/assets/new-session-Cu_fMVmN.js +0 -2
  97. package/dist/ui/assets/openai-codex-CBAEHdaT.js +0 -1
  98. package/dist/ui/assets/openai-codex-responses-CBhbcvRK.js +0 -7
  99. package/dist/ui/assets/openai-completions-CBeXb_ux.js +0 -5
  100. package/dist/ui/assets/openai-responses-B5d1rOIe.js +0 -1
  101. package/dist/ui/assets/openrouter-D2M_Nolr.js +0 -1
  102. package/dist/ui/assets/provider-store-access-0M5vSpmv.js +0 -1
  103. package/dist/ui/assets/session-freezer-sudk6sSl.js +0 -1
  104. package/dist/ui/assets/wc-live-z1Woib4_.js +0 -8
  105. package/dist/ui/assets/xai-grok-9vAl224Q.js +0 -1
  106. /package/dist/ui/assets/{session-store-DQztDoVa.js → chat-session-store-DQztDoVa.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/oauth-service-Dk3L2UWh.js","assets/preload-helper-Czpn1I53.js","assets/proxied-fetch-CfcFb0B0.js","assets/rolldown-runtime-aKtaBQYM.js","assets/base64-DpPqYZJF.js","assets/src-DoFhVmQT.js","assets/runtime-env-DH4NDw4t.js","assets/fetch-body-D2PwksUW.js","assets/panel-rpc-DmJSNs0I.js","assets/wc-permissions-registry-Blyunq37.js"])))=>i.map(i=>d[i]);
2
- import{n as e,t}from"./rolldown-runtime-aKtaBQYM.js";import{t as n}from"./preload-helper-Czpn1I53.js";import{i as r,n as i,r as a}from"./compat-CkpNnFQS.js";import"./context-compaction-C3e7rcEG.js";import{t as o}from"./logger-DDBAeTLF.js";import"./src-DoFhVmQT.js";import{o as s,t as c}from"./proxied-fetch-CfcFb0B0.js";import{t as l}from"./secret-topology-Baeul5rD.js";import{t as u}from"./secrets-bridge-client-CLRo0NLf.js";import"./tool-ui-DfXu6quJ.js";import"./tool-result-images-BFdAnBEq.js";import{n as d,o as f,t as p}from"./providers-BU_CYZEQ.js";import{n as m,t as h}from"./panel-rpc-DmJSNs0I.js";import{c as g,r as _,t as v}from"./bedrock-camp-CJY4i7di.js";var y={assign:0,create:0,clone:0,discard:0,update:0};function b(e){return Array.isArray(e)}function x(e){return C(e,null)}function S(e){return C(typeof e,`object`)&&!x(e)}function C(e,t){return e===t}function ee(e){return C(e,`__proto__`)||C(e,`constructor`)||C(e,`prototype`)}function te(e,t){return ee(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function ne(e){return Object.getOwnPropertyNames(e)}function re(e){return S(e)&&te(e,`~guard`)}function ie(e){return e}function ae(e){return e.map(e=>ce(e))}function w(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let e of Object.keys(n)){let r=n[e];te(r,`value`)&&Object.defineProperty(t,e,{...r,value:ce(r.value)})}return t}function oe(e){return new RegExp(e.source,e.flags)}function se(e){return e}function ce(e){return e instanceof RegExp?oe(e):re(e)?ie(e):b(e)?ae(e):S(e)?w(e):se(e)}function le(e){return y.clone+=1,ce(e)}var ue={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1};function de(){return ue}function fe(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function pe(e,t){return{...e,...t}}function me(e,t,n={}){y.create+=1;let r=de(),i=pe(t,n),a=r.enumerableKind?pe(i,e):fe(i,e);return r.immutableTypes?Object.freeze(a):a}function he(e,t,n){y.update+=1;let r=de(),i=le(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return i}function ge(e){return S(e)}function _e(e){return he(e,{"~optional":!0},{})}function ve(e){return _e(e)}function ye(e){return ge(e)&&te(e,`~optional`)}function be(e,t){return me({"~kind":`Array`},{type:`array`,items:e},t)}function xe(e){return ne(e).filter(t=>!ye(e[t]))}function Se(e,t={}){let n=xe(e);return me({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}var Ce;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(Ce||={}),Array.from({length:256}).map((e,t)=>BigInt(t));var we=new Float64Array(1);new DataView(we.buffer),new Uint8Array(we.buffer),new TextEncoder;var Te=`-?(?:0|[1-9][0-9]*)`,Ee=`-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?`;function De(e){return me({"~kind":`Number`},{type:`number`},e)}function T(e){return me({"~kind":`String`},{type:`string`},e)}var Oe=`^${Te}$`;`${Ee}`;function ke(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}var Ae=[...ke(97,122),...ke(65,90)],je=[`0`,...ke(49,57)];[...je],[...Ae,...je],[...je],new RegExp(Oe);var Me=Symbol.for(`yaml.alias`),Ne=Symbol.for(`yaml.document`),E=Symbol.for(`yaml.map`),Pe=Symbol.for(`yaml.pair`),Fe=Symbol.for(`yaml.scalar`),Ie=Symbol.for(`yaml.seq`),D=Symbol.for(`yaml.node.type`),Le=e=>!!e&&typeof e==`object`&&e[D]===Me,Re=e=>!!e&&typeof e==`object`&&e[D]===Ne,ze=e=>!!e&&typeof e==`object`&&e[D]===E,O=e=>!!e&&typeof e==`object`&&e[D]===Pe,k=e=>!!e&&typeof e==`object`&&e[D]===Fe,Be=e=>!!e&&typeof e==`object`&&e[D]===Ie;function A(e){if(e&&typeof e==`object`)switch(e[D]){case E:case Ie:return!0}return!1}function j(e){if(e&&typeof e==`object`)switch(e[D]){case Me:case E:case Fe:case Ie:return!0}return!1}var Ve=e=>(k(e)||A(e))&&!!e.anchor,M=Symbol(`break visit`),He=Symbol(`skip children`),N=Symbol(`remove node`);function Ue(e,t){let n=Ge(t);Re(e)?P(null,e.contents,n,Object.freeze([e]))===N&&(e.contents=null):P(null,e,n,Object.freeze([]))}Ue.BREAK=M,Ue.SKIP=He,Ue.REMOVE=N;function P(e,t,n,r){let i=Ke(e,t,n,r);if(j(i)||O(i))return qe(e,r,i),P(e,i,n,r);if(typeof i!=`symbol`){if(A(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=P(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===M)return M;else i===N&&(t.items.splice(e,1),--e)}}else if(O(t)){r=Object.freeze(r.concat(t));let e=P(`key`,t.key,n,r);if(e===M)return M;e===N&&(t.key=null);let i=P(`value`,t.value,n,r);if(i===M)return M;i===N&&(t.value=null)}}return i}async function We(e,t){let n=Ge(t);Re(e)?await F(null,e.contents,n,Object.freeze([e]))===N&&(e.contents=null):await F(null,e,n,Object.freeze([]))}We.BREAK=M,We.SKIP=He,We.REMOVE=N;async function F(e,t,n,r){let i=await Ke(e,t,n,r);if(j(i)||O(i))return qe(e,r,i),F(e,i,n,r);if(typeof i!=`symbol`){if(A(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await F(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===M)return M;else i===N&&(t.items.splice(e,1),--e)}}else if(O(t)){r=Object.freeze(r.concat(t));let e=await F(`key`,t.key,n,r);if(e===M)return M;e===N&&(t.key=null);let i=await F(`value`,t.value,n,r);if(i===M)return M;i===N&&(t.value=null)}}return i}function Ge(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Ke(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(ze(t))return n.Map?.(e,t,r);if(Be(t))return n.Seq?.(e,t,r);if(O(t))return n.Pair?.(e,t,r);if(k(t))return n.Scalar?.(e,t,r);if(Le(t))return n.Alias?.(e,t,r)}function qe(e,t,n){let r=t[t.length-1];if(A(r))r.items[e]=n;else if(O(r))e===`key`?r.key=n:r.value=n;else if(Re(r))r.contents=n;else{let e=Le(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var Je={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},Ye=e=>e.replace(/[!,[\]{}]/g,e=>Je[e]),Xe=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Ye(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&j(e.contents)){let t={};Ue(e.contents,(e,n)=>{j(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
2
+ import{n as e,t}from"./rolldown-runtime-aKtaBQYM.js";import{t as n}from"./preload-helper-Czpn1I53.js";import{i as r,n as i,r as a}from"./compat-CkpNnFQS.js";import"./context-compaction-C3e7rcEG.js";import{t as o}from"./logger-DDBAeTLF.js";import"./src-DoFhVmQT.js";import{o as s,t as c}from"./proxied-fetch-CfcFb0B0.js";import{t as l}from"./secret-topology-Baeul5rD.js";import{t as u}from"./secrets-bridge-client-CLRo0NLf.js";import"./tool-ui-DfXu6quJ.js";import"./tool-result-images-BFdAnBEq.js";import{n as d,o as f,t as p}from"./providers-Bz0SwL53.js";import{n as m,t as h}from"./panel-rpc-DmJSNs0I.js";import{c as g,r as _,t as v}from"./bedrock-camp-CJY4i7di.js";var y={assign:0,create:0,clone:0,discard:0,update:0};function b(e){return Array.isArray(e)}function x(e){return C(e,null)}function S(e){return C(typeof e,`object`)&&!x(e)}function C(e,t){return e===t}function ee(e){return C(e,`__proto__`)||C(e,`constructor`)||C(e,`prototype`)}function te(e,t){return ee(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function ne(e){return Object.getOwnPropertyNames(e)}function re(e){return S(e)&&te(e,`~guard`)}function ie(e){return e}function ae(e){return e.map(e=>ce(e))}function w(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let e of Object.keys(n)){let r=n[e];te(r,`value`)&&Object.defineProperty(t,e,{...r,value:ce(r.value)})}return t}function oe(e){return new RegExp(e.source,e.flags)}function se(e){return e}function ce(e){return e instanceof RegExp?oe(e):re(e)?ie(e):b(e)?ae(e):S(e)?w(e):se(e)}function le(e){return y.clone+=1,ce(e)}var ue={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1};function de(){return ue}function fe(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function pe(e,t){return{...e,...t}}function me(e,t,n={}){y.create+=1;let r=de(),i=pe(t,n),a=r.enumerableKind?pe(i,e):fe(i,e);return r.immutableTypes?Object.freeze(a):a}function he(e,t,n){y.update+=1;let r=de(),i=le(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return i}function ge(e){return S(e)}function _e(e){return he(e,{"~optional":!0},{})}function ve(e){return _e(e)}function ye(e){return ge(e)&&te(e,`~optional`)}function be(e,t){return me({"~kind":`Array`},{type:`array`,items:e},t)}function xe(e){return ne(e).filter(t=>!ye(e[t]))}function Se(e,t={}){let n=xe(e);return me({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}var Ce;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(Ce||={}),Array.from({length:256}).map((e,t)=>BigInt(t));var we=new Float64Array(1);new DataView(we.buffer),new Uint8Array(we.buffer),new TextEncoder;var Te=`-?(?:0|[1-9][0-9]*)`,Ee=`-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?`;function De(e){return me({"~kind":`Number`},{type:`number`},e)}function T(e){return me({"~kind":`String`},{type:`string`},e)}var Oe=`^${Te}$`;`${Ee}`;function ke(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}var Ae=[...ke(97,122),...ke(65,90)],je=[`0`,...ke(49,57)];[...je],[...Ae,...je],[...je],new RegExp(Oe);var Me=Symbol.for(`yaml.alias`),Ne=Symbol.for(`yaml.document`),E=Symbol.for(`yaml.map`),Pe=Symbol.for(`yaml.pair`),Fe=Symbol.for(`yaml.scalar`),Ie=Symbol.for(`yaml.seq`),D=Symbol.for(`yaml.node.type`),Le=e=>!!e&&typeof e==`object`&&e[D]===Me,Re=e=>!!e&&typeof e==`object`&&e[D]===Ne,ze=e=>!!e&&typeof e==`object`&&e[D]===E,O=e=>!!e&&typeof e==`object`&&e[D]===Pe,k=e=>!!e&&typeof e==`object`&&e[D]===Fe,Be=e=>!!e&&typeof e==`object`&&e[D]===Ie;function A(e){if(e&&typeof e==`object`)switch(e[D]){case E:case Ie:return!0}return!1}function j(e){if(e&&typeof e==`object`)switch(e[D]){case Me:case E:case Fe:case Ie:return!0}return!1}var Ve=e=>(k(e)||A(e))&&!!e.anchor,M=Symbol(`break visit`),He=Symbol(`skip children`),N=Symbol(`remove node`);function Ue(e,t){let n=Ge(t);Re(e)?P(null,e.contents,n,Object.freeze([e]))===N&&(e.contents=null):P(null,e,n,Object.freeze([]))}Ue.BREAK=M,Ue.SKIP=He,Ue.REMOVE=N;function P(e,t,n,r){let i=Ke(e,t,n,r);if(j(i)||O(i))return qe(e,r,i),P(e,i,n,r);if(typeof i!=`symbol`){if(A(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=P(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===M)return M;else i===N&&(t.items.splice(e,1),--e)}}else if(O(t)){r=Object.freeze(r.concat(t));let e=P(`key`,t.key,n,r);if(e===M)return M;e===N&&(t.key=null);let i=P(`value`,t.value,n,r);if(i===M)return M;i===N&&(t.value=null)}}return i}async function We(e,t){let n=Ge(t);Re(e)?await F(null,e.contents,n,Object.freeze([e]))===N&&(e.contents=null):await F(null,e,n,Object.freeze([]))}We.BREAK=M,We.SKIP=He,We.REMOVE=N;async function F(e,t,n,r){let i=await Ke(e,t,n,r);if(j(i)||O(i))return qe(e,r,i),F(e,i,n,r);if(typeof i!=`symbol`){if(A(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await F(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===M)return M;else i===N&&(t.items.splice(e,1),--e)}}else if(O(t)){r=Object.freeze(r.concat(t));let e=await F(`key`,t.key,n,r);if(e===M)return M;e===N&&(t.key=null);let i=await F(`value`,t.value,n,r);if(i===M)return M;i===N&&(t.value=null)}}return i}function Ge(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Ke(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(ze(t))return n.Map?.(e,t,r);if(Be(t))return n.Seq?.(e,t,r);if(O(t))return n.Pair?.(e,t,r);if(k(t))return n.Scalar?.(e,t,r);if(Le(t))return n.Alias?.(e,t,r)}function qe(e,t,n){let r=t[t.length-1];if(A(r))r.items[e]=n;else if(O(r))e===`key`?r.key=n:r.value=n;else if(Re(r))r.contents=n;else{let e=Le(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var Je={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},Ye=e=>e.replace(/[!,[\]{}]/g,e=>Je[e]),Xe=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Ye(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&j(e.contents)){let t={};Ue(e.contents,(e,n)=>{j(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
3
3
  `)}};Xe.defaultYaml={explicit:!1,version:`1.2`},Xe.defaultTags={"!!":`tag:yaml.org,2002:`};function Ze(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function Qe(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=Qe(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=Qe(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=Qe(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=Qe(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function I(e,t,n){if(Array.isArray(e))return e.map((e,t)=>I(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Ve(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var $e=class{constructor(e){Object.defineProperty(this,D,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Re(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=I(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Qe(i,{"":o},``,o):o}},et=class extends $e{constructor(e){super(Me),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Ue(e,{Node:(e,t)=>{(Le(t)||Ve(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(I(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=tt(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Ze(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function tt(e,t,n){if(Le(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(A(t)){let r=0;for(let i of t.items){let t=tt(e,i,n);t>r&&(r=t)}return r}else if(O(t)){let r=tt(e,t.key,n),i=tt(e,t.value,n);return Math.max(r,i)}return 1}var nt=e=>!e||typeof e!=`function`&&typeof e!=`object`,L=class extends $e{constructor(e){super(Fe),this.value=e}toJSON(e,t){return t?.keep?this.value:I(this.value,e,t)}toString(){return String(this.value)}};L.BLOCK_FOLDED=`BLOCK_FOLDED`,L.BLOCK_LITERAL=`BLOCK_LITERAL`,L.PLAIN=`PLAIN`,L.QUOTE_DOUBLE=`QUOTE_DOUBLE`,L.QUOTE_SINGLE=`QUOTE_SINGLE`;var rt=`tag:yaml.org,2002:`;function it(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function at(e,t,n){if(Re(e)&&(e=e.contents),j(e))return e;if(O(e)){let t=n.schema[E].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??=i(e),new et(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=rt+t.slice(2));let l=it(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new L(e);return c&&(c.node=t),t}l=e instanceof Map?o[E]:Symbol.iterator in Object(e)?o[Ie]:o[E]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new L(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function ot(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return at(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var st=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,ct=class extends $e{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>j(t)||O(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(st(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(A(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,ot(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(A(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&k(i)?i.value:i:A(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!O(t))return!1;let n=t.value;return n==null||e&&k(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return A(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(A(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,ot(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},lt=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function ut(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var R=(e,t,n)=>e.endsWith(`
4
4
  `)?ut(n,t):n.includes(`
5
5
  `)?`
@@ -0,0 +1,101 @@
1
+ import{n as e,t}from"./rolldown-runtime-aKtaBQYM.js";import{t as n}from"./logger-LESFN7Hj.js";import{n as r,r as i}from"./panel-rpc-CjFVE0nK.js";import{n as a,o,t as s}from"./providers-BwP_K_jW.js";import"./src-BcePBv4G.js";import{r as c,s as l,t as u}from"./proxied-fetch-GabK83LB.js";import{t as d}from"./runtime-env-byAg9ij-.js";import{i as f,r as p}from"./tool-ui-t6ocn6AG.js";import{t as m}from"./port-bridge-client-DXYvHFiB.js";import{n as h,r as g,t as ee}from"./tool-result-images-AGln5sut.js";import{c as _,d as v,f as te,l as ne,r as re,t as ie,u as ae}from"./bedrock-camp-DS0ilb3O.js";const oe=`slicc_oauth_extra_domains`;function se(e){try{let t=e.getItem(oe);if(!t)return{};let n=JSON.parse(t);if(typeof n!=`object`||!n||Array.isArray(n))return{};let r={};for(let[e,t]of Object.entries(n)){if(typeof e!=`string`||!Array.isArray(t))continue;let n=t.filter(e=>typeof e==`string`&&e.length>0);n.length>0&&(r[e]=n)}return r}catch{return{}}}function ce(e,t){try{e.setItem(oe,JSON.stringify(t))}catch(e){throw Error(`Failed to persist OAuth extras (localStorage quota exceeded?): ${e instanceof Error?e.message:String(e)}`)}}function le(){return d()?`extension-direct`:c()?`extension-delegate`:globalThis.__slicc_connect_mode?`connect`:`node-rest`}function ue(){return le()===`node-rest`}const de={assign:0,create:0,clone:0,discard:0,update:0};function y(e,t){return de.assign+=1,{...e,...t}}function fe(e,t,n){return e>=t&&e<=n}function pe(e){return fe(e,127462,127487)}function me(e){return fe(e,65024,65039)}function he(e){return fe(e,768,879)||fe(e,6832,6911)||fe(e,7616,7679)||fe(e,65056,65071)}function ge(e){return e>65535?2:1}function _e(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(he(n)||me(n))t+=ge(n);else break}return t}function ve(e,t){let n=e.codePointAt(t),r=t+ge(n);for(r=_e(e,r);r<e.length-1&&e[r]===`‍`;){let t=e.codePointAt(r+1);r+=1+ge(t),r=_e(e,r)}return pe(n)&&r<e.length&&pe(e.codePointAt(r))&&(r+=ge(e.codePointAt(r))),r}function ye(e){return fe(e,55296,56319)||fe(e,768,879)||e===8205}function be(e){let t=0,n=0;for(;n<e.length;)n=ve(e,n),t++;return t}function xe(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=ve(e,r),n++,n>=t)return!0;return!1}function Se(e,t){let n=0,r=0;for(;r<e.length;)if(r=ve(e,r),n++,n>t)return!1;return!0}function Ce(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(ye(e.charCodeAt(n)))return xe(e,t);if(n++,n>=t)return!0}return!1}function we(e,t){let n=0;for(;n<e.length;){if(ye(e.charCodeAt(n)))return Se(e,t);if(n++,n>t)return!1}return!0}var Te=e({Entries:()=>et,EntriesRegExp:()=>$e,Every:()=>Xe,EveryAll:()=>Ze,GraphemeCount:()=>qe,HasPropertyKey:()=>C,IsArray:()=>Ee,IsAsyncIterator:()=>De,IsBigInt:()=>Oe,IsBoolean:()=>ke,IsClassInstance:()=>Ge,IsConstructor:()=>Ae,IsDeepEqual:()=>at,IsEqual:()=>x,IsFunction:()=>je,IsGreaterEqualThan:()=>Ue,IsGreaterThan:()=>Be,IsInteger:()=>Me,IsIterator:()=>Ne,IsLessEqualThan:()=>He,IsLessThan:()=>Ve,IsMaxLength:()=>Je,IsMinLength:()=>Ye,IsMultipleOf:()=>We,IsNull:()=>Pe,IsNumber:()=>Fe,IsObject:()=>b,IsObjectNotArray:()=>Ie,IsString:()=>Le,IsSymbol:()=>Re,IsUndefined:()=>ze,IsUnsafePropertyKey:()=>Qe,IsValueLike:()=>Ke,Keys:()=>w,Symbols:()=>tt,TakeLeft:()=>S,Values:()=>nt});function Ee(e){return Array.isArray(e)}function De(e){return b(e)&&Symbol.asyncIterator in e}function Oe(e){return x(typeof e,`bigint`)}function ke(e){return x(typeof e,`boolean`)}function Ae(e){if(ze(e)||!je(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function je(e){return x(typeof e,`function`)}function Me(e){return Number.isInteger(e)}function Ne(e){return b(e)&&Symbol.iterator in e}function Pe(e){return x(e,null)}function Fe(e){return Number.isFinite(e)}function Ie(e){return b(e)&&!Ee(e)}function b(e){return x(typeof e,`object`)&&!Pe(e)}function Le(e){return x(typeof e,`string`)}function Re(e){return x(typeof e,`symbol`)}function ze(e){return x(e,void 0)}function x(e,t){return e===t}function Be(e,t){return e>t}function Ve(e,t){return e<t}function He(e,t){return e<=t}function Ue(e,t){return e>=t}function We(e,t){if(Oe(e)||Oe(t))return BigInt(e)%BigInt(t)===0n;if(!Fe(e)||Me(e)&&1/t%1==0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t))<1e-10}function Ge(e){if(!b(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!Pe(t)&&x(typeof t.constructor,`function`)&&!(x(t.constructor,globalThis.Object)||x(t.constructor.name,`Object`))}function Ke(e){return Oe(e)||ke(e)||Pe(e)||Fe(e)||Le(e)||ze(e)}function qe(e){return be(e)}function Je(e,t){return we(e,t)}function Ye(e,t){return Ce(e,t)}function Xe(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function Ze(e,t,n){let r=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(r=!1);return r}function S(e,t,n){return x(e.length,0)?n():t(e[0],e.slice(1))}function Qe(e){return x(e,`__proto__`)||x(e,`constructor`)||x(e,`prototype`)}function C(e,t){return Qe(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function $e(e){return w(e).map(t=>[RegExp(`^${t}$`),e[t]])}function et(e){return Object.entries(e)}function w(e){return Object.getOwnPropertyNames(e)}function tt(e){return Object.getOwnPropertySymbols(e)}function nt(e){return Object.values(e)}function rt(e,t){if(!b(t))return!1;let n=w(e);return x(n.length,w(t).length)&&n.every(n=>at(e[n],t[n]))}function it(e,t){return Ee(t)&&x(e.length,t.length)&&e.every((n,r)=>at(e[r],t[r]))}function at(e,t){return Ee(e)?it(e,t):b(e)?rt(e,t):x(e,t)}function ot(e){return e instanceof Boolean}function st(e){return e instanceof Number}function ct(e){return e instanceof String}function lt(e){return globalThis.ArrayBuffer.isView(e)}function ut(e){return e instanceof globalThis.RegExp}function dt(e){return e instanceof globalThis.Date}function ft(e){return e instanceof globalThis.Set}function pt(e){return e instanceof globalThis.Map}function mt(e){return b(e)&&C(e,`~guard`)}function ht(e){return e}function gt(e){return e.map(e=>bt(e))}function _t(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let e of Object.keys(n)){let r=n[e];C(r,`value`)&&Object.defineProperty(t,e,{...r,value:bt(r.value)})}return t}function vt(e){return new RegExp(e.source,e.flags)}function yt(e){return e}function bt(e){return e instanceof RegExp?vt(e):mt(e)?ht(e):Ee(e)?gt(e):b(e)?_t(e):yt(e)}function xt(e){return de.clone+=1,bt(e)}const St={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1};function Ct(){return St}function wt(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function Tt(e,t){return{...e,...t}}function T(e,t,n={}){de.create+=1;let r=Ct(),i=Tt(t,n),a=r.enumerableKind?Tt(i,e):wt(i,e);return r.immutableTypes?Object.freeze(a):a}function Et(e,t){de.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(xt(e)),i=new Set(t);for(let e of Object.keys(r))i.has(e)||Object.defineProperty(n,e,r[e]);return n}function E(e,t,n){de.update+=1;let r=Ct(),i=xt(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return i}function D(e,t){return b(e)&&C(e,`~kind`)&&x(e[`~kind`],t)}function Dt(e){return b(e)}function Ot(e){return b(e)&&C(e,`~kind`)&&C(e,`type`)&&x(e[`~kind`],`OptionalAddAction`)&&Dt(e.type)}function kt(e){return b(e)&&C(e,`~kind`)&&C(e,`type`)&&x(e[`~kind`],`OptionalRemoveAction`)&&Dt(e.type)}function At(e){return b(e)&&C(e,`~kind`)&&C(e,`type`)&&x(e[`~kind`],`ReadonlyAddAction`)&&Dt(e.type)}function jt(e){return b(e)&&C(e,`~kind`)&&C(e,`type`)&&x(e[`~kind`],`ReadonlyRemoveAction`)&&Dt(e.type)}function O(e,t,n){return T({"~kind":`Deferred`},{action:e,parameters:t,options:n},{})}function Mt(e){return D(e,`Deferred`)}function Nt(e,t){return T({"~kind":`Promise`},{type:`promise`,item:e},t)}function Pt(e){return D(e,`Promise`)}function Ft(e){return Et(e,[`~kind`,`type`,`item`])}function It(e){return E(e,{"~immutable":!0},{})}function Lt(e){return It(e)}function Rt(e){return Dt(e)&&C(e,`~immutable`)}function zt(e){return Et(e,[`~optional`])}function Bt(e){return E(e,{"~optional":!0},{})}function Vt(e){return Bt(e)}function Ht(e){return Dt(e)&&C(e,`~optional`)}function Ut(e){return Et(e,[`~readonly`])}function Wt(e){return E(e,{"~readonly":!0},{})}function Gt(e){return Wt(e)}function Kt(e){return Dt(e)&&C(e,`~readonly`)}function qt(e){return{enumerable:Ct().enumerableKind,writable:!1,configurable:!1,value:e}}var Jt=class{constructor(){globalThis.Object.defineProperty(this,`~kind`,qt(`Base`)),globalThis.Object.defineProperty(this,`~guard`,qt({check:e=>this.Check(e),errors:e=>this.Errors(e)}))}Check(e){return!0}Errors(e){return[]}Convert(e){return e}Clean(e){return e}Default(e){return e}Create(){throw Error(`Create not implemented`)}Clone(){throw Error(`Clone not implemented`)}};function Yt(e){return D(e,`Base`)}function Xt(e,t){return T({"~kind":`Array`},{type:`array`,items:e},t)}function Zt(e){return D(e,`Array`)}function Qt(e){return Et(e,[`~kind`,`type`,`items`])}function $t(e,t){return T({"~kind":`AsyncIterator`},{type:`asyncIterator`,iteratorItems:e},t)}function en(e){return D(e,`AsyncIterator`)}function tn(e){return Et(e,[`~kind`,`type`,`iteratorItems`])}function nn(e,t,n={}){return T({"~kind":`Constructor`},{type:`constructor`,parameters:e,instanceType:t},n)}function rn(e){return D(e,`Constructor`)}function an(e){return Et(e,[`~kind`,`type`,`parameters`,`instanceType`])}function on(e,t,n={}){return T({"~kind":`Function`},{type:`function`,parameters:e,returnType:t},n)}function sn(e){return D(e,`Function`)}function cn(e){return Et(e,[`~kind`,`type`,`parameters`,`returnType`])}function ln(e,t){return T({"~kind":`Ref`},{$ref:e},t)}function un(e){return D(e,`Ref`)}function dn(e,t){return T({"~kind":`Generic`},{type:`generic`,parameters:e,expression:t})}function fn(e){return D(e,`Generic`)}function pn(e){return T({"~kind":`Any`},{},e)}function mn(e){return D(e,`Any`)}function k(e){return T({"~kind":`Never`},{not:{}},e)}function hn(e){return D(e,`Never`)}function gn(e){return w(e).filter(t=>!Ht(e[t]))}function _n(e){return w(e)}function vn(e){return nt(e)}function A(e,t={}){let n=gn(e);return T({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}function j(e){return D(e,`Object`)}function yn(e){return Et(e,[`~kind`,`type`,`properties`,`required`])}function M(e,t={}){return T({"~kind":`Union`},{anyOf:e},t)}function N(e){return D(e,`Union`)}function bn(e){return Et(e,[`~kind`,`anyOf`])}function xn(e){return T({"~kind":`Unknown`},{},e)}function Sn(e){return D(e,`Unknown`)}function Cn(e,t,n){return T({"~kind":`Cyclic`},{$defs:w(e).reduce((t,n)=>({...t,[n]:E(e[n],{},{$id:n})}),{}),$ref:t},n)}function wn(e){return D(e,`Cyclic`)}function Tn(e){return Ie(e)&&C(e,`~unsafe`)&&Pe(e[`~unsafe`])}function En(e){return D(e,`Infer`)}function Dn(e){return D(e,`Enum`)}function On(e,t={}){return T({"~kind":`Intersect`},{allOf:e},t)}function P(e){return D(e,`Intersect`)}function kn(e){return Et(e,[`~kind`,`allOf`])}function An(){throw Error(`Unreachable`)}var jn=e({Hash:()=>ir,HashCode:()=>rr});function Mn(e){let t=new Set,n=e;for(;n&&n!==Object.prototype;){for(let e of Reflect.ownKeys(n))e!==`constructor`&&typeof e!=`symbol`&&t.add(e);n=Object.getPrototypeOf(n)}return[...t]}function Nn(e){return typeof e==`number`}var F;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(F||={});let Pn=BigInt(`14695981039346656037`);const[Fn,In]=[BigInt(`1099511628211`),BigInt(`18446744073709551616`)],Ln=Array.from({length:256}).map((e,t)=>BigInt(t)),Rn=new Float64Array(1),zn=new DataView(Rn.buffer),Bn=new Uint8Array(Rn.buffer);function I(e){Pn^=Ln[e],Pn=Pn*Fn%In}function Vn(e){I(F.Array);for(let t of e)nr(t)}function Hn(e){I(F.BigInt),zn.setBigInt64(0,e);for(let e of Bn)I(e)}function Un(e){I(F.Boolean),I(+!!e)}function Wn(e){I(F.Constructor),nr(e.toString())}function Gn(e){I(F.Date),nr(e.getTime())}function Kn(e){I(F.Function),nr(e.toString())}function qn(e){I(F.Null)}function Jn(e){I(F.Number),zn.setFloat64(0,e,!0);for(let e of Bn)I(e)}function Yn(e){I(F.Object);for(let t of Mn(e).sort())nr(t),nr(e[t])}function Xn(e){I(F.RegExp),Qn(e.toString())}const Zn=new TextEncoder;function Qn(e){I(F.String);for(let t of Zn.encode(e))I(t)}function $n(e){I(F.Symbol),nr(e.toString())}function er(e){I(F.TypeArray);let t=new Uint8Array(e.buffer);for(let e=0;e<t.length;e++)I(t[e])}function tr(e){return I(F.Undefined)}function nr(e){return lt(e)?er(e):dt(e)?Gn(e):ut(e)?Xn(e):ot(e)?Un(e.valueOf()):ct(e)?Qn(e.valueOf()):st(e)?Jn(e.valueOf()):Nn(e)?Jn(e):Ee(e)?Vn(e):ke(e)?Un(e):Oe(e)?Hn(e):Ae(e)?Wn(e):Pe(e)?qn(e):b(e)?Yn(e):Le(e)?Qn(e):Re(e)?$n(e):ze(e)?tr(e):je(e)?Kn(e):An()}function rr(e){return Pn=BigInt(`14695981039346656037`),nr(e),Pn}function ir(e){return rr(e).toString(16).padStart(16,`0`)}function ar(e){return Dt(e)&&C(e,`~codec`)&&b(e[`~codec`])&&C(e[`~codec`],`encode`)&&C(e[`~codec`],`decode`)}function or(e){return T({"~kind":`BigInt`},{type:`bigint`},e)}function sr(e){return D(e,`BigInt`)}function cr(e){return D(e,`Boolean`)}const lr=`-?(?:0|[1-9][0-9]*)`;function ur(e){return T({"~kind":`Integer`},{type:`integer`},e)}function dr(e){return D(e,`Integer`)}function fr(e,t){return T({"~kind":`Iterator`},{type:`iterator`,iteratorItems:e},t)}function pr(e){return D(e,`Iterator`)}function mr(e){return Et(e,[`~kind`,`type`,`iteratorItems`])}var hr=class extends Error{constructor(e){super(`Invalid Literal value`),Object.defineProperty(this,"cause",{value:{value:e},writable:!1,configurable:!1,enumerable:!1})}};function gr(e){return Oe(e)?`bigint`:ke(e)?`boolean`:Fe(e)?`number`:Le(e)?`string`:(()=>{throw new hr(e)})()}function L(e,t){return T({"~kind":`Literal`},{type:gr(e),const:e},t)}function _r(e){return Oe(e)||ke(e)||Fe(e)||Le(e)}function vr(e){return R(e)&&Oe(e.const)}function yr(e){return R(e)&&ke(e.const)}function br(e){return R(e)&&Fe(e.const)}function xr(e){return R(e)&&Le(e.const)}function R(e){return D(e,`Literal`)}function Sr(e){return T({"~kind":`Null`},{type:`null`},e)}function Cr(e){return D(e,`Null`)}const wr=`-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?`;function Tr(e){return T({"~kind":`Number`},{type:`number`},e)}function Er(e){return D(e,`Number`)}function Dr(e){return T({"~kind":`Symbol`},{type:`symbol`},e)}function Or(e){return D(e,`Symbol`)}function kr(e){return T({"~kind":`String`},{type:`string`},e)}function Ar(e){return D(e,`String`)}function jr(e){let t=Ua(e);return x(t.length,2)?t[0]:[]}function Mr(e){return!0}function Nr(e){return S(e,(e,t)=>Fr(e)?Nr(t):!1,()=>!0)}function Pr(e){return!x(e.length,0)&&Nr(e)}function Fr(e){return N(e)?Pr(e.anyOf):R(e)?Mr(e.const):!1}function Ir(e){return Pr(e)}function Lr(e){return T({"~kind":`TemplateLiteral`},{type:`string`,pattern:e},{})}function Rr(e,t,n=[]){return S(e,(e,r)=>Rr(r,t,[...n,`${e}${t}`]),()=>n)}function zr(e,t){return x(e.length,0)?[`${t}`]:Rr(e,t)}function Br(e,t,n=[]){return S(t,(t,r)=>Br(e,r,[...n,...Vr(e,t)]),()=>n)}function Vr(e,t){return N(t)?Br(e,t.anyOf):R(t)?zr(e,t.const):An()}function Hr(e,t){return S(t,(t,n)=>Hr(Vr(e,t),n),()=>e)}function Ur(e){return e.map(e=>L(e))}function Wr(e){return M(Ur(Hr([],e)))}function Gr(e){return x(e.length,0)?An():x(e.length,1)&&R(e[0])?e[0]:Wr(e)}function Kr(e){let t=jr(e);return x(t.length,0)?kr():Ir(t)?Gr(t):Lr(e)}function qr(e){let t=Kr(e);return uo(t)?kr():t}function Jr(e,t){return T({"~kind":`Record`},{type:`object`,patternProperties:{[e]:t}})}function Yr(e){return Jr(Hi,e)}function Xr(e){return A({true:e,false:e})}function Zr(e){return Le(e)||Fe(e)?L(e):Pe(e)?Sr():k()}function Qr(e){return e.map(e=>Zr(e))}function $r(e){return M(Qr(e))}function ei(e){return $r(e.enum)}function ti(e,t){return Li($r(e),t)}function ni(e,t){return Jr(Bi,t)}function ri(e,t={}){let[n,r,i]=[e,e.length,!1];return T({"~kind":`Tuple`},{type:`array`,additionalItems:i,items:n,minItems:r},t)}function z(e){return D(e,`Tuple`)}function ii(e){return Et(e,[`~kind`,`type`,`items`,`minItems`,`additionalItems`])}function ai(e){return e.reduceRight((e,t,n)=>({[n]:t,...e}),{})}function oi(e){return A(ai(e.items))}function si(e,t){return Kt(e)?!!Kt(t):!1}function ci(e,t){return Ht(e)?!!Ht(t):!1}function li(e,t){let n=si(e,t),r=ci(e,t),i=Ut(zt(xi([e,t])));return n&&r?Wt(Bt(i)):n&&!r?Wt(i):!n&&r?Bt(i):i}function ui(e,t,n){return n in e?n in t?li(e[n],t[n]):e[n]:n in t?t[n]:k()}function di(e,t){return[...new Set([...w(t),...w(e)])].reduce((n,r)=>({...n,[r]:ui(e,t,r)}),{})}function fi(e){return j(e)?e.properties:z(e)?ai(e.items):An()}function pi(e,t){return A(di(fi(e),fi(t)))}function mi(e,t){let n=oc(e,t);return x(n,`left-inside`)?e:x(n,`right-inside`)||x(n,`equal`)?t:k()}function hi(e){return j(e)||z(e)}function gi(e,t){let n=N(e),r=N(t);return n||r}function _i(e,t){let n=Ci(e),r=Ci(t),i=gi(n,r),a=hi(n),o=hi(r);return i?xi([n,r]):a&&o?pi(n,r):a&&!o?n:!a&&o?r:mi(n,r)}function vi(e,t,n=[]){return S(t,(t,r)=>vi(e,r,[...n,_i(e,t)]),()=>x(n.length,0)?[e]:n)}function yi(e,t,n=[]){return S(e,(e,r)=>yi(r,t,[...n,...bi([e],t)]),()=>n)}function bi(e,t=[]){return S(e,(e,n)=>N(e)?bi(n,yi(e.anyOf,t)):bi(n,vi(e,t)),()=>t)}function xi(e){return dc(bi(e))}function Si(e){return dc(e)}function Ci(e){return P(e)?xi(e.allOf):N(e)?Si(e.anyOf):e}function wi(e){return x(e.length,1)?e[0]:x(e.length,0)?k():M(e)}function Ti(e,t){return Li(xi(e),t)}function Ei(e,t){return Le(e)||Fe(e)?A({[e]:t}):x(e,!1)?A({false:t}):x(e,!0)?A({true:t}):A({})}function Di(e,t){return Jr(Vi,t)}function Oi(e,t){return C(e,`pattern`)&&(Le(e.pattern)||e.pattern instanceof RegExp)?Jr(e.pattern.toString(),t):Jr(Hi,t)}function ki(e,t){return Ir(jr(e))?Li(qr(e),t):Jr(e,t)}function Ai(e){return N(e)?ji(e.anyOf):[e]}function ji(e){return e.reduce((e,t)=>[...e,...Ai(t)],[])}function Mi(e){return e.some(e=>Ar(e)||Er(e)||dr(e))}function Ni(e,t){return x(Mi(e),!0)?Jr(Hi,t):void 0}function Pi(e,t){return e.reduce((e,n)=>R(n)&&(Le(n.const)||Fe(n.const))?{...e,[n.const]:t}:e,{})}function Fi(e,t){return A(Pi(e,t))}function Ii(e,t){let n=ji(e),r=Ni(n,t);return Dt(r)?r:Fi(n,t)}function Li(e,t){return mn(e)?Yr(t):cr(e)?Xr(t):Dn(e)?ti(e.enum,t):dr(e)?ni(e,t):P(e)?Ti(e.allOf,t):R(e)?Ei(e.const,t):Er(e)?Di(e,t):N(e)?Ii(e.anyOf,t):Ar(e)?Oi(e,t):uo(e)?ki(e.pattern,t):A({})}function Ri(e,t,n){return G([e])?E(Li(e,t),{},n):Ui(e,t,n)}function zi(e,t,n,r,i){return Ri(K(e,t,n),K(e,t,r),i)}const Bi=`^${lr}$`,Vi=`^${wr}$`,Hi=`^.*$`;function Ui(e,t,n={}){return O(`Record`,[e,t],n)}function Wi(e,t,n={}){return Ri(e,t,n)}function Gi(e,t){return Jr(e,t)}function Ki(e){return w(e.patternProperties)[0]}function qi(e){let t=Ki(e);return x(t,Hi)?kr():x(t,Bi)?ur():x(t,Vi)?Tr():Kr(t)}function Ji(e){return e.patternProperties[Ki(e)]}function Yi(e){return D(e,`Record`)}function Xi(e){return T({"~kind":`Rest`},{type:`rest`,items:e},{})}function Zi(e){return D(e,`Rest`)}function Qi(e){return D(e,`This`)}function $i(e){return T({"~kind":`Undefined`},{type:`undefined`},e)}function ea(e){return D(e,`Undefined`)}function ta(e){return D(e,`Void`)}function na(e){return or()}function ra(e){return kr()}function ia(e){return Tr()}function aa(e){return ur()}function oa(e){return k()}function sa(e){return L(e)}function ca(e){return e}function la(e){return M(e[1])}function ua(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function da(e){return[e[0],...e[1]]}function fa(e){return e}function pa(e){return e[1]}function ma(e){return x(e.length,2)}function ha(e,t,n){return ma(e)?t(e[0],e[1]):n()}function ga(e,t){return x(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function _a(e,t){for(let n=0;n<e.length;n++){let r=ga(e[n],t);if(ma(r))return r}return[]}function va(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}const ya=[...va(97,122),...va(65,90)],ba=[`0`,...va(49,57)];function xa(e){let t=e.indexOf(`*/`);return x(t,-1)?``:e.slice(t+2)}function Sa(e){let t=e.indexOf(`
2
+ `);return x(t,-1)?``:e.slice(t)}function Ca(e){return e.replace(/^[ \t\r\f\v]+/,``)}function wa(e){let t=Ca(e);return t.startsWith(`/*`)?wa(xa(t.slice(2))):t.startsWith(`//`)?wa(Sa(t.slice(2))):t}function Ta(e){let t=e.trimStart();return t.startsWith(`/*`)?Ta(xa(t.slice(2))):t.startsWith(`//`)?Ta(Sa(t.slice(2))):t}[...ba];function Ea(e,t){return _a([e],t)}function Da(e,t){return x(e,``)?[``,t]:e.startsWith(`
3
+ `)?Ea(e,wa(t)):e.startsWith(` `)?Ea(e,t):Ea(e,Ta(t))}[...ya,...ba],[...ba];function Oa(e){return x(e,``)?[]:[e.slice(0,1),e.slice(1)]}function ka(e,t){return S(e,(e,n)=>t.startsWith(e)?!0:ka(n,t),()=>!1)}function Aa(e,t,n=``){return ha(Oa(t),(r,i)=>ka(e,t)?[n,t]:Aa(e,i,`${n}${r}`),()=>[])}function ja(e,t){return ha(Aa(e,t),(e,t)=>x(e,``)?[]:[e,t],()=>[])}const B=(e,t,n=()=>[])=>e.length===2?t(e):n(),Ma=e=>B(Da(`-?(?:0|[1-9][0-9]*)n`,e),([e,t])=>[na(e),t]),Na=e=>B(Da(`.*`,e),([e,t])=>[ra(e),t]),Pa=e=>B(Da(`-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?`,e),([e,t])=>[ia(e),t]),Fa=e=>B(Da(`-?(?:0|[1-9][0-9]*)`,e),([e,t])=>[aa(e),t]),Ia=e=>B(Da(`(?!)`,e),([e,t])=>[oa(e),t]),La=e=>B(ja([`-?(?:0|[1-9][0-9]*)n`,`.*`,`-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?`,`-?(?:0|[1-9][0-9]*)`,`(?!)`,`(`,`)`,`$`,`|`],e),([e,t])=>[sa(e),t]),Ra=e=>B(B(Ma(e),([e,t])=>[e,t],()=>B(Na(e),([e,t])=>[e,t],()=>B(Pa(e),([e,t])=>[e,t],()=>B(Fa(e),([e,t])=>[e,t],()=>B(Ia(e),([e,t])=>[e,t],()=>B(za(e),([e,t])=>[e,t],()=>B(La(e),([e,t])=>[e,t],()=>[]))))))),([e,t])=>[ca(e),t]),za=e=>B(B(Da(`(`,e),([e,t])=>B(Ha(t),([t,n])=>B(Da(`)`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[la(e),t]),Ba=e=>B(B(B(Va(e),([e,t])=>B(Da(`|`,t),([t,n])=>B(Ba(n),([n,r])=>[[e,t,n],r]))),([e,t])=>[e,t],()=>B(B(Va(e),([e,t])=>[[e],t]),([e,t])=>[e,t],()=>B([[],e],([e,t])=>[e,t],()=>[]))),([e,t])=>[ua(e),t]),Va=e=>B(B(Ra(e),([e,t])=>B(Ha(t),([t,n])=>[[e,t],n])),([e,t])=>[da(e),t]),Ha=e=>B(B(Ba(e),([e,t])=>[e,t],()=>B(Va(e),([e,t])=>[e,t],()=>[])),([e,t])=>[fa(e),t]),Ua=e=>B(B(Da(`^`,e),([e,t])=>B(Ha(t),([t,n])=>B(Da(`$`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[pa(e),t]);function Wa(e){return e.join(`|`)}function Ga(e){return e.slice(1,e.length-1)}function Ka(e,t,n){return ro(t,`${n}${e}`)}function qa(e,t){return ro(e,`${t}-?(?:0|[1-9][0-9]*)n`)}function Ja(e,t){return ro(e,`${t}${lr}`)}function Ya(e,t){return ro(e,`${t}${wr}`)}function Xa(e,t){return no(M([L(`false`),L(`true`)]),e,t)}function Za(e,t){return ro(e,`${t}.*`)}function Qa(e,t,n){return ro(t,`${n}${Ga(e)}`)}function $a(e,t,n){return no(oo(e,{}),t,n)}function eo(e,t,n){return to(Qr(e),t,n)}function to(e,t,n,r=[]){return S(e,(e,i)=>to(i,t,n,[...r,no(e,[],``)]),()=>ro(t,`${n}(${Wa(r)})`))}function no(e,t,n){return Dn(e)?eo(e.enum,t,n):dr(e)?Ja(t,n):R(e)?Ka(e.const,t,n):sr(e)?qa(t,n):cr(e)?Xa(t,n):Er(e)?Ya(t,n):Ar(e)?Za(t,n):uo(e)?Qa(e.pattern,t,n):lo(e)?$a(e.parameters[0],t,n):N(e)?to(e.anyOf,t,n):`(?!)`}function ro(e,t){return S(e,(e,n)=>no(e,n,t),()=>t)}function io(e){return`^${ro(e,``)}$`}function ao(e){return Lr(io(e))}function oo(e,t){return G(e)?E(ao(e),{},t):co(e,t)}function so(e,t,n,r){return oo(of(e,t,n),r)}function co(e,t={}){return O(`TemplateLiteral`,[e],t)}function lo(e){return Dt(e)&&C(e,`action`)&&x(e.action,`TemplateLiteral`)}function uo(e){return D(e,`TemplateLiteral`)}function fo(e){return T({"~kind":`ExtendsUnion`},{inferred:e})}function po(e){return b(e)&&C(e,`~kind`)&&C(e,`inferred`)&&x(e[`~kind`],`ExtendsUnion`)&&b(e.inferred)}function V(e){return T({"~kind":`ExtendsTrue`},{inferred:e})}function mo(e){return b(e)&&C(e,`~kind`)&&C(e,`inferred`)&&x(e[`~kind`],`ExtendsTrue`)&&b(e.inferred)}function H(){return T({"~kind":`ExtendsFalse`},{})}function ho(e){return b(e)&&C(e,`~kind`)&&x(e[`~kind`],`ExtendsFalse`)}function go(e){return po(e)||mo(e)}function _o(e,t,n){return go(e)?t(e.inferred):n()}function vo(e,t,n,r){return _o(W(e,n,r),r=>V(y(y(e,r),{[t]:n})),()=>H())}function yo(e,t){return V(e)}function bo(e,t,n){return W(e,t,$r(n))}function xo(e,t,n){return S(n,(n,r)=>_o(W(e,t,n),e=>xo(e,t,r),()=>H()),()=>V(e))}function So(e,t,n){return W(e,t,qr(n))}function Co(e,t,n){return S(n,(n,r)=>_o(W(e,t,n),e=>V(e),()=>Co(e,t,r)),()=>H())}function U(e,t,n){return mn(n)?yo(e,t):Dn(n)?bo(e,t,n.enum):En(n)?vo(e,n.name,t,n.extends):P(n)?xo(e,t,n.allOf):uo(n)?So(e,t,n.pattern):N(n)?Co(e,t,n.anyOf):Sn(n)?V(e):H()}function wo(e,t,n){return En(n)?U(e,t,n):mn(n)||Sn(n)?V(e):fo(e)}function To(e,t){let n=Rt(e),r=Rt(t);return n&&r||!n&&r?!0:!(n&&!r)}function Eo(e,t,n,r){return Zt(r)?To(t,r)?W(e,n,r.items):H():U(e,t,r)}function Do(e,t,n){return en(n)?W(e,t,n.iteratorItems):U(e,$t(t),n)}function Oo(e,t,n){return sr(n)?V(e):U(e,t,n)}function ko(e,t,n){return cr(n)?V(e):U(e,t,n)}function Ao(e,t,n,r,i){let a=En(r)?t:r,o=En(r)?r:t,s=Ht(t),c=Ht(r);return!s&&c?H():_o(W(e,a,o),e=>No(e,n,i),()=>H())}function jo(e,t,n,r){return S(r,(r,i)=>Ao(e,t,n,r,i),()=>Ht(t)?V(e):H())}function Mo(e,t,n){return S(t,(t,r)=>jo(e,t,r,n),()=>V(e))}function No(e,t,n){return Mo(e,t,n)}function Po(e,t,n){return ta(n)?V(e):W(e,t,n)}function Fo(e,t,n,r){return mn(r)||Sn(r)?V(e):rn(r)?_o(No(e,t,r.parameters),e=>Po(e,n,r.instanceType),()=>H()):H()}function Io(e,t,n){return W(e,ei(t),n)}function Lo(e,t,n,r){return mn(r)||Sn(r)?V(e):sn(r)?_o(No(e,t,r.parameters),e=>Po(e,n,r.returnType),()=>H()):H()}function Ro(e,t,n){return dr(n)||Er(n)?V(e):U(e,t,n)}function zo(e,t,n){return W(e,xi(t),n)}function Bo(e,t,n){return pr(n)?W(e,t,n.iteratorItems):U(e,fr(t),n)}function Vo(e,t,n){return t===n?V(e):H()}function Ho(e,t,n){return R(n)?Vo(e,t,n.const):sr(n)?V(e):U(e,L(t),n)}function Uo(e,t,n){return R(n)?Vo(e,t,n.const):cr(n)?V(e):U(e,L(t),n)}function Wo(e,t,n){return R(n)?Vo(e,t,n.const):Er(n)?V(e):U(e,L(t),n)}function Go(e,t,n){return R(n)?Vo(e,t,n.const):Ar(n)?V(e):U(e,L(t),n)}function Ko(e,t,n){return Oe(t.const)?Ho(e,t.const,n):ke(t.const)?Uo(e,t.const,n):Fe(t.const)?Wo(e,t.const,n):Le(t.const)?Go(e,t.const,n):An()}function qo(e,t,n){return En(n)?U(e,t,n):V(e)}function Jo(e,t,n){return Cr(n)?V(e):U(e,t,n)}function Yo(e,t,n){return Er(n)?V(e):U(e,t,n)}function Xo(e,t,n){return Ht(t)?Ht(n)?V(e):H():V(e)}function Zo(e,t,n){return En(n)&&hn(n.extends)?H():_o(W(e,t,n),e=>Xo(e,t,n),()=>H())}function Qo(e,t){return e.reduce((e,n)=>n in t&&go(t[n])?{...e,...t[n].inferred}:An(),{})}function $o(e,t,n){let r={};for(let i of w(n))r[i]=i in t?Zo({},t[i],n[i]):Ht(n[i])?En(n[i])?V(y(e,{[n[i].name]:n[i].extends})):V(e):H();let i=nt(r).every(e=>go(e)),a=i?Qo(w(r),r):{};return i?V(a):H()}function es(e,t,n){let r=$o(e,t,n);return go(r)?V(y(e,r.inferred)):H()}function ts(e,t,n){return es(e,t,n)}function ns(e,t,n){return j(n)?ts(e,t,n.properties):U(e,A(t),n)}function rs(e,t,n){return Pt(n)?W(e,t,n.item):U(e,Nt(t),n)}function is(e,t,n){return Ar(n)?V(e):U(e,t,n)}function as(e,t,n){return Or(n)?V(e):U(e,t,n)}function os(e,t,n){return W(e,qr(t),n)}function ss(e,t){return T({"~kind":`Inferrable`},{name:e,type:t},{})}function cs(e){return b(e)&&C(e,`~kind`)&&C(e,`name`)&&C(e,`type`)&&x(e[`~kind`],`Inferrable`)&&Le(e.name)&&b(e.type)}function ls(e){return Zi(e)?En(e.items)?Zt(e.items.extends)?ss(e.items.name,e.items.extends.items):Sn(e.items.extends)?ss(e.items.name,e.items.extends):void 0:An():void 0}function us(e){return En(e)?ss(e.name,e.extends):void 0}function ds(e,t,n=[]){return S(e,(e,r)=>_o(W({},e,t),()=>ds(r,t,[...n,e]),()=>void 0),()=>n)}function fs(e,t,n,r){let i=ds(n,r);return Ee(i)?V(y(e,{[t]:ri(i)})):H()}function ps(e,t,n,r){let i=ds(n,r);return Ee(i)?V(y(e,{[t]:M(i)})):H()}function ms(e){return[...e].reverse()}function hs(e,t){return t?ms(e):e}function gs(e){let t=e.length>0?e[0]:void 0;return Dt(Dt(t)?ls(t):void 0)}function _s(e,t,n,r,i,a){return _o(W(e,n,i),e=>bs(e,t,r,a),()=>H())}function vs(e,t,n,r,i){let a=ls(r);return cs(a)?fs(e,a.name,hs(n,t),a.type):S(n,(n,a)=>_s(e,t,n,a,r,i),()=>H())}function ys(e,t,n,r){return S(r,(r,i)=>vs(e,t,n,r,i),()=>x(n.length,0)?V(e):H())}function bs(e,t,n,r){return ys(e,t,n,r)}function xs(e,t,n){let r=af(e,{callstack:[]},n),i=gs(r);return bs(e,i,hs(t,i),hs(r,i))}function Ss(e,t,n){let r=us(n);return cs(r)?ps(e,r.name,t,r.type):S(t,(t,r)=>_o(W(e,t,n),e=>Ss(e,r,n),()=>H()),()=>V(e))}function Cs(e,t,n){let r=af(e,{callstack:[]},t);return z(n)?xs(e,r,n.items):Zt(n)?Ss(e,r,n.items):U(e,ri(r),n)}function ws(e,t,n){return ta(n)||ea(n)?V(e):U(e,t,n)}function Ts(e,t,n){return S(n,(n,r)=>_o(W(e,t,n),e=>V(e),()=>Ts(e,t,r)),()=>H())}function Es(e,t,n){return S(t,(t,r)=>_o(Ts(e,t,n),e=>Es(e,r,n),()=>H()),()=>V(e))}function Ds(e,t,n){let r=us(n);return cs(r)?ps(e,r.name,t,r.type):N(n)?Es(e,t,n.anyOf):Es(e,t,[n])}function Os(e,t,n){return En(n)?U(e,t,n):mn(n)||Sn(n)?V(e):H()}function ks(e,t,n){return ta(n)?V(e):U(e,t,n)}function W(e,t,n){return mn(t)?wo(e,t,n):Zt(t)?Eo(e,t,t.items,n):en(t)?Do(e,t.iteratorItems,n):sr(t)?Oo(e,t,n):cr(t)?ko(e,t,n):rn(t)?Fo(e,t.parameters,t.instanceType,n):Dn(t)?Io(e,t,n):sn(t)?Lo(e,t.parameters,t.returnType,n):dr(t)?Ro(e,t,n):P(t)?zo(e,t.allOf,n):pr(t)?Bo(e,t.iteratorItems,n):R(t)?Ko(e,t,n):hn(t)?qo(e,t,n):Cr(t)?Jo(e,t,n):Er(t)?Yo(e,t,n):j(t)?ns(e,t.properties,n):Pt(t)?rs(e,t.item,n):Ar(t)?is(e,t,n):Or(t)?as(e,t,n):uo(t)?os(e,t.pattern,n):z(t)?Cs(e,t.items,n):ea(t)?ws(e,t,n):N(t)?Ds(e,t.anyOf,n):Sn(t)?Os(e,t,n):ta(t)?ks(e,t,n):H()}function As(e,t){return xi([...e,A(t)])}function js(e,t,n){return G(e)?E(As(e,t),{},n):Ns(e,t,n)}function Ms(e,t,n,r,i){return js(of(e,t,n),rf(e,t,r),i)}function Ns(e,t,n={}){return O(`Interface`,[e,t],n)}function Ps(e){return Dt(e)&&C(e,`action`)&&x(e.action,`Interface`)}function Fs(e,t,n){return e.includes(n)?!0:Rs([...e,n],t,t[n])}function Is(e,t,n){return Ls(e,t,vn(n))}function Ls(e,t,n){return S(n,(n,r)=>Rs(e,t,n)?!0:Ls(e,t,r),()=>!1)}function Rs(e,t,n){return un(n)?Fs(e,t,n.$ref):Zt(n)?Rs(e,t,n.items):en(n)?Rs(e,t,n.iteratorItems):rn(n)?Ls(e,t,[...n.parameters,n.instanceType]):sn(n)?Ls(e,t,[...n.parameters,n.returnType]):Ps(n)?Is(e,t,n.parameters[1]):P(n)?Ls(e,t,n.allOf):pr(n)?Rs(e,t,n.iteratorItems):j(n)?Is(e,t,n.properties):Pt(n)?Rs(e,t,n.item):N(n)?Ls(e,t,n.anyOf):z(n)?Ls(e,t,n.items):Yi(n)?Rs(e,t,Ji(n)):!1}function zs(e,t,n){return Rs(e,t,n)}function Bs(e,t){return t.reduce((t,n)=>n in e?zs([n],e,e[n])?[...t,n]:t:An(),[])}function Vs(e){return Bs(e,_n(e))}function Hs(e,t,n){return n.includes(t)?n:t in e?Gs(e,e[t],[...n,t]):An()}function Us(e,t,n){return Ws(e,vn(t),n)}function Ws(e,t,n){return t.reduce((t,n)=>Gs(e,n,t),n)}function Gs(e,t,n){return un(t)?Hs(e,t.$ref,n):Zt(t)?Gs(e,t.items,n):en(t)?Gs(e,t.iteratorItems,n):rn(t)?Ws(e,[...t.parameters,t.instanceType],n):sn(t)?Ws(e,[...t.parameters,t.returnType],n):Ps(t)?Us(e,t.parameters[1],n):P(t)?Ws(e,t.allOf,n):pr(t)?Gs(e,t.iteratorItems,n):j(t)?Us(e,t.properties,n):Pt(t)?Gs(e,t.item,n):N(t)?Ws(e,t.anyOf,n):z(t)?Ws(e,t.items,n):Yi(t)?Gs(e,Ji(t),n):n}function Ks(e,t,n){return Gs(e,n,[t])}function qs(e){return pn()}function Js(e){return w(e).reduce((t,n)=>({...t,[n]:Xs(e[n])}),{})}function Ys(e){return e.reduce((e,t)=>[...e,Xs(t)],[])}function Xs(e){return un(e)?qs(e.$ref):Zt(e)?Xt(Xs(e.items),Qt(e)):en(e)?$t(Xs(e.iteratorItems)):rn(e)?nn(Ys(e.parameters),Xs(e.instanceType)):sn(e)?on(Ys(e.parameters),Xs(e.returnType)):P(e)?On(Ys(e.allOf)):pr(e)?fr(Xs(e.iteratorItems)):j(e)?A(Js(e.properties)):Pt(e)?Nt(Xs(e.item)):Yi(e)?Wi(qi(e),Xs(Ji(e))):N(e)?M(Ys(e.anyOf)):z(e)?ri(Ys(e.items)):e}function Zs(e,t){return t in e?Xs(e[t]):xn()}function Qs(e){return Zs(e.$defs,e.$ref)}function $s(e,t,n){let r=of(e,{callstack:[]},t),i=rf({},{callstack:[]},n);return xi([...r,A(i)])}function ec(e,t){return w(e).filter(e=>t.includes(e)).reduce((t,n)=>{let r=e[n],i=Ps(r)?$s(e,r.parameters[0],r.parameters[1]):r;return{...t,[n]:i}},{})}function tc(e,t,n){return Cn(ec(e,Ks(e,t,n)),t)}function nc(e,t){return t in e?un(e[t])?nc(e,e[t].$ref):e[t]:k()}function rc(e,t){return nc(e,t)}function ic(e){return wn(e)?Qs(e):Tn(e)?xn():e}function ac(e,t,n){return W(e,ic(t),ic(n))}function oc(e,t){let n=[Sn(e)?H():ac({},e,t),Sn(e)?V({}):ac({},t,e)];return go(n[0])&&go(n[1])?`equal`:go(n[0])&&ho(n[1])?`left-inside`:ho(n[0])&&go(n[1])?`right-inside`:`disjoint`}function sc(e,t){return t.filter(t=>oc(e,t)!==`right-inside`)}function cc(e,t){return x(t.some(t=>{let n=oc(e,t);return x(n,`left-inside`)||x(n,`equal`)}),!1)}function lc(e,t){let n=Ci(e);return mn(n)?[n]:cc(n,t)?[...sc(n,t),n]:t}function uc(e){return e.reduce((e,t)=>j(t)?[...e,t]:hn(t)?e:lc(t,e),[])}function dc(e){let t=ji(uc(e));return t.length===0?k():t.length===1?t[0]:M(t)}function fc(e,t){return E(Ci(e),{},t)}function pc(e,t,n,r){return fc(K(e,t,n),r)}function mc(e,t=[]){return Mt(e)&&x(e.action,`Conditional`)?un(e.parameters[0])?mc(e.parameters[2],mc(e.parameters[3],[...t,e.parameters[0].$ref])):mc(e.parameters[2],mc(e.parameters[3],t)):Mt(e)&&x(e.action,`Mapped`)&&Mt(e.parameters[1])&&x(e.parameters[1].action,`KeyOf`)&&un(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function hc(e,t){return e.reduce((e,n)=>[...e,t.includes(n.name)],[])}function gc(e,t,n=[]){return S(e,(e,r)=>S(t,(t,i)=>gc(r,i,[...n,[t,e]]),()=>n),()=>n)}function _c(e){return N(e)?[...e.anyOf]:[e]}function vc(e,t){return e.reduce((e,n)=>[...e,[...n,t]],[])}function yc(e,t){return t.reduce((t,n)=>[...t,...vc(e,n)],[])}function bc(e){return e.reduce((e,t)=>x(t[0],!0)?yc(e,_c(t[1])):yc(e,[t[1]]),[[]])}function xc(e,t,n){let r=gc(t,hc(e,mc(n)));return Mt(n)&&x(n.action,`Conditional`)||Mt(n)&&x(n.action,`Mapped`)?bc(r):[t]}function Sc(){return[`(not-resolvable)`,k()]}function Cc(){return[`(not-generic)`,k()]}function wc(e,t,n){return[e,dn(t,n)]}function Tc(e,t,n){return t in e?Ec(e,t,e[t],n):Sc()}function Ec(e,t,n,r){return fn(n)?wc(t,n.parameters,n.expression):un(n)?Tc(e,n.$ref,r):Cc()}function Dc(e,t,n){return Ec(e,`(anonymous)`,t,n)}function Oc(e,t,n){if(En(t)||Bc(t)||go(ac({},t,n)))return;let r={parameter:e,expect:n,actual:t};throw Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function kc(e,t,n,r,i){let a=K(e,t,i);return Oc(n,a,r),y(e,{[n]:a})}function Ac(e,t,n,r,i){let a=K(e,t,n.extends),o=K(e,t,n.equals);return S(i,(i,o)=>jc(kc(e,t,n.name,a,i),t,r,o),()=>jc(kc(e,t,n.name,a,o),t,r,[]))}function jc(e,t,n,r){return S(n,(n,i)=>Ac(e,t,n,i,r),()=>e)}function Mc(e,t,n,r){return jc(e,t,n,r)}function Nc(e){return Be(e.callstack.length,0)?e.callstack[e.callstack.length-1]:``}function Pc(e,t){return x(Nc(e),t)}function Fc(e,t,n,r,i,a){return K(e,t,K(Mc(e,t,r,a),{callstack:[...t.callstack,n.$ref]},i))}function Ic(e,t,n,r,i,a){return a.reduce((a,o)=>[...a,Fc(e,t,n,r,i,o)],[])}function Lc(e,t,n,r,i,a){let o=Ic(e,t,n,r,i,xc(r,a,i));return x(o.length,1)?o[0]:Si(o)}function Rc(e,t,n,r){let i=of(e,t,r),a=Dc(e,n,r),o=a[0],s=a[1];return fn(s)?Pc(t,o)?zc(ln(o),i):Lc(e,t,ln(o),s.parameters,s.expression,i):zc(n,i)}function zc(e,t){return T({"~kind":`Call`},{target:e,arguments:t},{})}function Bc(e){return D(e,`Call`)}function Vc(e,t){return e(t)}function Hc(e,t){return Le(t)?L(Vc(e,t)):L(t)}function Uc(e,t){return Gc(e,qr(t))}function Wc(e,t){return M(t.map(t=>Gc(e,t)))}function Gc(e,t){return R(t)?Hc(e,t.const):uo(t)?Uc(e,t.pattern):N(t)?Wc(e,t.anyOf):t}function Kc(e,t={}){return O(`Capitalize`,[e],t)}function qc(e,t={}){return O(`Lowercase`,[e],t)}function Jc(e,t={}){return O(`Uncapitalize`,[e],t)}function Yc(e,t={}){return O(`Uppercase`,[e],t)}const Xc=e=>e[0].toUpperCase()+e.slice(1),Zc=e=>e.toLowerCase(),Qc=e=>e[0].toLowerCase()+e.slice(1),$c=e=>e.toUpperCase();function el(e,t){return G([e])?E(Gc(Xc,e),{},t):Kc(e,t)}function tl(e,t){return G([e])?E(Gc(Zc,e),{},t):qc(e,t)}function nl(e,t){return G([e])?E(Gc(Qc,e),{},t):Jc(e,t)}function rl(e,t){return G([e])?E(Gc($c,e),{},t):Yc(e,t)}function il(e,t,n,r){return el(K(e,t,n),r)}function al(e,t,n,r){return tl(K(e,t,n),r)}function ol(e,t,n,r){return nl(K(e,t,n),r)}function sl(e,t,n,r){return rl(K(e,t,n),r)}function cl(e,t,n,r,i={}){return O(`Conditional`,[e,t,n,r],i)}function ll(e,t,n,r,i,a){let o=ac(e,n,r);return po(o)?M([K(o.inferred,t,i),K(e,t,a)]):mo(o)?K(o.inferred,t,i):K(e,t,a)}function ul(e,t,n,r,i,a,o){return G([n,r])?E(ll(e,t,n,r,i,a),{},o):cl(n,r,i,a,o)}function dl(e,t,n,r,i,a,o){return ul(e,t,K(e,t,n),K(e,t,r),i,a,o)}function fl(e,t={}){return O(`ConstructorParameters`,[e],t)}function pl(e){return ri(af({},{callstack:[]},rn(e)?e.parameters:[]))}function ml(e,t){return G([e])?E(pl(e),{},t):fl(e,t)}function hl(e,t,n,r){return ml(K(e,t,n),r)}function gl(e,t,n={}){return O(`Exclude`,[e,t],n)}function _l(e,t){return e.reduce((e,n)=>[...e,...vl(n,t)],[])}function vl(e,t){return go(ac({},e,t))?[]:[e]}function yl(e,t){return Si(Dn(e)?_l(Qr(e.enum),t):N(e)?_l(ji(e.anyOf),t):vl(e,t))}function bl(e,t,n){return G([e,t])?E(yl(e,t),{},n):gl(e,t,n)}function xl(e,t,n,r,i){return bl(K(e,t,n),K(e,t,r),i)}function Sl(e,t,n={}){return O(`Extract`,[e,t],n)}function Cl(e,t){return e.reduce((e,n)=>[...e,...wl(n,t)],[])}function wl(e,t){return go(ac({},e,t))?[e]:[]}function Tl(e,t){return Si(Dn(e)?Cl(Qr(e.enum),t):N(e)?Cl(ji(e.anyOf),t):wl(e,t))}function El(e,t,n){return G([e,t])?E(Tl(e,t),{},n):Sl(e,t,n)}function Dl(e,t,n,r,i){return El(K(e,t,n),K(e,t,r),i)}function Ol(e,t,n={}){return O(`Index`,[e,t],n)}function kl(e,t){return Ll(rc(e,t))}function Al(e,t){let n=w(e).filter(e=>!C(t,e)),r=w(t).filter(t=>!C(e,t)),i=w(e).filter(e=>C(t,e)),a=n.reduce((t,n)=>({...t,[n]:e[n]}),{}),o=r.reduce((e,n)=>({...e,[n]:t[n]}),{}),s=i.reduce((n,r)=>({...n,[r]:xi([e[r],t[r]])}),{});return y(y(a,o),s)}function jl(e){return e.reduce((e,t)=>Al(e,Ll(t)),{})}function Ml(e){return e}function Nl(e){return Ll(oi(ri(e)))}function Pl(e,t){return w(e).filter(e=>e in t).reduce((n,r)=>({...n,[r]:Si([e[r],t[r]])}),{})}function Fl(e,t){return S(e,(e,n)=>Fl(n,Pl(t,Ll(e))),()=>t)}function Il(e){return S(e,(e,t)=>Fl(t,Ll(e)),()=>An())}function Ll(e){return wn(e)?kl(e.$defs,e.$ref):P(e)?jl(e.allOf):N(e)?Il(e.anyOf):z(e)?Nl(e.items):j(e)?Ml(e.properties):{}}function Rl(e){return A(Ll(e))}const zl=RegExp(`^(?:0|[1-9][0-9]*)$`);function Bl(e){let t=`${e}`;return zl.test(t)?parseInt(t):e}function Vl(e){return L(Bl(e))}function Hl(e){return e.map(e=>Ul(e))}function Ul(e){return P(e)?On(Hl(e.allOf)):N(e)?M(Hl(e.anyOf)):R(e)?Vl(e.const):e}function Wl(e,t){return go(ac({},Ul(t),Tr()))?e:R(t)&&x(t.const,`length`)?Tr():k()}function Gl(e,t){return Zl(rc(e,t))}function Kl(e){return e.reduce((e,t)=>[...e,...Zl(t)],[])}function ql(e){return Kl(Qr(e))}function Jl(e){return Zl(xi(e))}function Yl(e){return[`${e}`]}function Xl(e){return Zl(qr(e))}function Zl(e){return wn(e)?Gl(e.$defs,e.$ref):Dn(e)?ql(e.enum):P(e)?Jl(e.allOf):R(e)?Yl(e.const):uo(e)?Xl(e.pattern):N(e)?Kl(e.anyOf):[]}function Ql(e){return Zl(e)}function $l(e,t){return t.map(t=>eu(e,t))}function eu(e,t){return Zt(t)?Xt(eu(e,t.items)):en(t)?$t(eu(e,t.iteratorItems)):rn(t)?nn($l(e,t.parameters),eu(e,t.instanceType)):sn(t)?on($l(e,t.parameters),eu(e,t.returnType)):pr(t)?fr(eu(e,t.iteratorItems)):Pt(t)?Nt(eu(e,t.item)):z(t)?ri($l(e,t.items)):N(t)?M($l(e,t.anyOf)):P(t)?On($l(e,t.allOf)):Qi(t)?A(e):t}function tu(e,t){return eu(e,t)}function nu(e,t){return tu(e,t in e?e[t]:k())}function ru(e,t){return t.reduce((t,n)=>[...t,nu(e,n)],[])}function iu(e,t){return Si(ru(e,Ql(t)))}const au=new RegExp(Bi);function ou(e){return e.filter(e=>au.test(e))}function su(e){return Si(ru(e,ou(_n(e))))}function cu(e,t){return Er(t)?su(e):iu(e,t)}function lu(e){return L(Bl(e))}function uu(e){return e.map(e=>du(e))}function du(e){return P(e)?On(uu(e.allOf)):N(e)?M(uu(e.anyOf)):R(e)?lu(e.const):e}function fu(e,t){return e.reduceRight((e,n,r)=>go(ac({},L(r),t))?[n,...e]:e,[])}function pu(e,t){return wi(fu(e,du(t)))}function mu(e){return wi(e)}function hu(e,t){return R(t)&&x(t.const,`length`)?L(e.length):Er(t)||dr(t)?mu(e):pu(e,t)}function gu(e,t){return Zt(e)?Wl(e.items,t):j(e)?cu(e.properties,t):z(e)?hu(e.items,t):k()}function _u(e){return wn(e)||P(e)||N(e)?Rl(e):e}function vu(e,t,n){return G([e,t])?E(gu(_u(e),t),{},n):Ol(e,t,n)}function yu(e,t,n,r,i){return vu(K(e,t,n),K(e,t,r),i)}function bu(e,t={}){return O(`InstanceType`,[e],t)}function xu(e){return rn(e)?e.instanceType:k()}function Su(e,t){return G([e])?E(xu(e),{},t):bu(e,t)}function Cu(e,t,n,r={}){return Su(K(e,t,n),r)}function wu(e,t={}){return O(`KeyOf`,[e],t)}function Tu(){return M([Tr(),kr(),Dr()])}function Eu(e){return Tr()}function Du(e){return e.reduce((e,t)=>_r(t)?[...e,L(Bl(t))]:An(),[])}function Ou(e){return wi(Du(w(e)))}function ku(e){return qi(e)}function Au(e){return wi(e.map((e,t)=>L(t)))}function ju(e){return mn(e)?Tu():Zt(e)?Eu(e.items):j(e)?Ou(e.properties):Yi(e)?ku(e):z(e)?Au(e.items):k()}function Mu(e){return wn(e)||P(e)||N(e)?Rl(e):e}function Nu(e,t){return G([e])?E(ju(Mu(e)),{},t):wu(e,t)}function Pu(e,t,n,r){return Nu(K(e,t,n),r)}function Fu(e,t,n,r,i={}){return O(`Mapped`,[e,t,n,r],i)}function Iu(e){return zu(qr(e))}function Lu(e){return e.reduce((e,t)=>[...e,...zu(t)],[])}function Ru(e){return Fe(e)?[L(`${e}`)]:[L(e)]}function zu(e){return Dn(e)?Lu(Qr(e.enum)):R(e)?Ru(e.const):uo(e)?Iu(e.pattern):N(e)?Lu(e.anyOf):[e]}function Bu(e){return zu(e)}function Vu(e){return uo(e)?qr(e.pattern):e}function Hu(e,t,n,r,i,a){let o=y(e,{[n.name]:r}),s=Vu(K(o,t,i)),c=K(o,t,a);return br(s)||xr(s)?{[s.const]:c}:{}}function Uu(e,t,n,r,i,a){return r.reduce((r,o)=>[...r,Hu(e,t,n,o,i,a)],[])}function Wu(e){return e.reduce((e,t)=>[...e,A(t)],[])}function Gu(e,t,n,r,i,a){return xi(Wu(Uu(e,t,n,Bu(r),i,a)))}function Ku(e,t,n,r,i,a,o){return G([r])?E(Gu(e,t,n,r,i,a),{},o):Fu(n,r,i,a,o)}function qu(e,t,n,r,i,a,o){return Ku(e,t,n,K(e,t,r),i,a,o)}function Ju(e,t){return w(e).filter(e=>t.includes(e)).reduce((t,n)=>({...t,[n]:tc(e,n,e[n])}),{})}function Yu(e,t){return w(e).filter(e=>!t.includes(e)).reduce((t,n)=>({...t,[n]:K(e,{callstack:[]},e[n])}),{})}function Xu(e,t){let n=Vs(e),r=Ju(e,n),i=Yu(e,n);return E({...r,...i},{},t)}function Zu(e,t,n,r){return Xu(y(e,n),r)}function Qu(e,t={}){return O(`NonNullable`,[e],t)}function $u(e){return bl(e,M([Sr(),$i()]),{})}function ed(e,t){return G([e])?E($u(e),{},t):Qu(e,t)}function td(e,t,n,r){return ed(K(e,t,n),r)}function nd(e,t,n={}){return O(`Omit`,[e,t],n)}function rd(e){let t=Rl(e);return j(t)?t.properties:An()}function id(e,t){return w(e).reduce((n,r)=>t.includes(r)?n:{...n,[r]:e[r]},{})}function ad(e,t){return A(id(rd(e),Ql(t)))}function od(e,t,n){return G([e,t])?E(ad(e,t),{},n):nd(e,t,n)}function sd(e,t,n,r,i){return od(K(e,t,n),K(e,t,r),i)}function cd(e,t){return O(`Options`,[e,t],{})}function ld(e,t){return ud(e,t)}function ud(e,t){return G([e])?E(e,{},t):cd(e,t)}function dd(e,t,n,r){return ud(K(e,t,n),r)}function fd(e,t={}){return O(`Parameters`,[e],t)}function pd(e){return ri(af({},{callstack:[]},sn(e)?e.parameters:[]))}function md(e,t){return G([e])?E(pd(e),{},t):fd(e,t)}function hd(e,t,n,r){return md(K(e,t,n),r)}function gd(e,t={}){return O(`Partial`,[e],t)}function _d(e,t){let n=xd(rc(e,t));return Cn(y(e,{[t]:n}),t)}function vd(e){return xi(e.map(e=>xd(e)))}function yd(e){return M(e.map(e=>xd(e)))}function bd(e){return A(w(e).reduce((t,n)=>({...t,[n]:Vt(e[n])}),{}))}function xd(e){return wn(e)?_d(e.$defs,e.$ref):P(e)?vd(e.allOf):N(e)?yd(e.anyOf):j(e)?bd(e.properties):A({})}function Sd(e,t){return G([e])?E(xd(e),{},t):gd(e,t)}function Cd(e,t,n,r){return Sd(K(e,t,n),r)}function wd(e,t,n={}){return O(`Pick`,[e,t],n)}function Td(e,t){return w(e).reduce((n,r)=>t.includes(r)?y(n,{[r]:e[r]}):n,{})}function Ed(e,t){return A(Td(rd(e),Ql(t)))}function Dd(e,t,n){return G([e,t])?E(Ed(e,t),{},n):wd(e,t,n)}function Od(e,t,n,r,i){return Dd(K(e,t,n),K(e,t,r),i)}function kd(e,t={}){return O(`ReadonlyObject`,[e],t)}function Ad(e){return Lt(Xt(e))}function jd(e,t){let n=Id(rc(e,t));return Cn(y(e,{[t]:n}),t)}function Md(e){return xi(e.map(e=>Id(e)))}function Nd(e){return A(w(e).reduce((t,n)=>({...t,[n]:Gt(e[n])}),{}))}function Pd(e){return Lt(ri(e))}function Fd(e){return M(e.map(e=>Id(e)))}function Id(e){return Zt(e)?Ad(e.items):wn(e)?jd(e.$defs,e.$ref):P(e)?Md(e.allOf):j(e)?Nd(e.properties):z(e)?Pd(e.items):N(e)?Fd(e.anyOf):e}function Ld(e,t){return G([e])?E(Id(e),{},t):kd(e)}function Rd(e,t,n,r){return Ld(K(e,t,n),r)}function zd(e,t,n,r){return r in e?zs([r],e,e[r])?n:K(e,t,e[r]):n}function Bd(e,t){let n=Wd(rc(e,t));return Cn(y(e,{[t]:n}),t)}function Vd(e){return xi(e.map(e=>Wd(e)))}function Hd(e){return M(e.map(e=>Wd(e)))}function Ud(e){return A(w(e).reduce((t,n)=>({...t,[n]:zt(e[n])}),{}))}function Wd(e){return wn(e)?Bd(e.$defs,e.$ref):P(e)?Vd(e.allOf):N(e)?Hd(e.anyOf):j(e)?Ud(e.properties):A({})}function Gd(e,t={}){return O(`Required`,[e],t)}function Kd(e,t){return G([e])?E(Wd(e),{},t):Gd(e,t)}function qd(e,t,n,r){return Kd(K(e,t,n),r)}function Jd(e,t={}){return O(`ReturnType`,[e],t)}function Yd(e){return sn(e)?e.returnType:k()}function Xd(e,t){return G([e])?E(Yd(e),{},t):Jd(e,t)}function Zd(e,t,n,r={}){return Xd(K(e,t,n),r)}function Qd(e){return Zi(e)?z(e.items)?$d(e.items.items):En(e.items)||un(e.items)?[e]:[k()]:[e]}function $d(e){return e.reduce((e,t)=>[...e,...Qd(t)],[])}function G(e){return S(e,(e,t)=>!un(e)&&G(t),()=>!0)}function ef(e,t,n){return jt(e)?ef(e.type,`remove`,n):kt(e)?ef(e.type,t,`remove`):At(e)?ef(e.type,`add`,n):Ot(e)?ef(e.type,t,`add`):[e,t,n]}function tf(e,t){return x(e,`remove`)?Ut(t):x(e,`add`)?Wt(t):t}function nf(e,t){return x(e,`remove`)?zt(t):x(e,`add`)?Bt(t):t}function rf(e,t,n){return w(n).reduce((r,i)=>({...r,[i]:K(e,t,n[i])}),{})}function af(e,t,n){return $d(of(e,t,n))}function of(e,t,n){return n.map(n=>K(e,t,n))}function sf(e,t,n,r,i){return x(n,`Awaited`)?df(e,t,r[0],i):x(n,`Capitalize`)?il(e,t,r[0],i):x(n,`Conditional`)?dl(e,t,r[0],r[1],r[2],r[3],i):x(n,`ConstructorParameters`)?hl(e,t,r[0],i):x(n,`Evaluate`)?pc(e,t,r[0],i):x(n,`Exclude`)?xl(e,t,r[0],r[1],i):x(n,`Extract`)?Dl(e,t,r[0],r[1],i):x(n,`Index`)?yu(e,t,r[0],r[1],i):x(n,`InstanceType`)?Cu(e,t,r[0],i):x(n,`Interface`)?Ms(e,t,r[0],r[1],i):x(n,`KeyOf`)?Pu(e,t,r[0],i):x(n,`Lowercase`)?al(e,t,r[0],i):x(n,`Mapped`)?qu(e,t,r[0],r[1],r[2],r[3],i):x(n,`Module`)?Zu(e,t,r[0],i):x(n,`NonNullable`)?td(e,t,r[0],i):x(n,`Pick`)?Od(e,t,r[0],r[1],i):x(n,`Options`)?dd(e,t,r[0],r[1]):x(n,`Parameters`)?hd(e,t,r[0],i):x(n,`Partial`)?Cd(e,t,r[0],i):x(n,`Omit`)?sd(e,t,r[0],r[1],i):x(n,`ReadonlyObject`)?Rd(e,t,r[0],i):x(n,`Record`)?zi(e,t,r[0],r[1],i):x(n,`Required`)?qd(e,t,r[0],i):x(n,`ReturnType`)?Zd(e,t,r[0],i):x(n,`TemplateLiteral`)?so(e,t,r[0],i):x(n,`Uncapitalize`)?ol(e,t,r[0],i):x(n,`Uppercase`)?sl(e,t,r[0],i):O(n,r,i)}function K(e,t,n){let r=Rt(n),i=ef(n,Kt(n)?`add`:`none`,Ht(n)?`add`:`none`),a=Yt(i[0])?i[0].Clone():i[0],o=un(a)?zd(e,t,a,a.$ref):Zt(a)?Xt(K(e,t,a.items),Qt(a)):en(a)?$t(K(e,t,a.iteratorItems),tn(a)):Bc(a)?Rc(e,t,a.target,a.arguments):rn(a)?nn(of(e,t,a.parameters),K(e,t,a.instanceType),an(a)):Mt(a)?sf(e,t,a.action,a.parameters,a.options):sn(a)?on(of(e,t,a.parameters),K(e,t,a.returnType),cn(a)):P(a)?On(of(e,t,a.allOf),kn(a)):pr(a)?fr(K(e,t,a.iteratorItems),mr(a)):j(a)?A(rf(e,t,a.properties),yn(a)):Pt(a)?Nt(K(e,t,a.item),Ft(a)):Yi(a)?Gi(Ki(a),K(e,t,Ji(a))):Zi(a)?Xi(K(e,t,a.items)):z(a)?ri(af(e,t,a.items),ii(a)):N(a)?M(of(e,t,a.anyOf),bn(a)):a,s=r?Lt(o):o;return tf(i[1],nf(i[2],s))}function cf(e,t){return K(e,{callstack:[]},t)}function lf(e){return Pt(e)?lf(e.item):e}function uf(e,t){return G([e])?E(lf(e),{},t):ff(e,t)}function df(e,t,n,r){return uf(K(e,t,n),r)}function ff(e,t={}){return O(`Awaited`,[e],t)}function pf(e,t={}){return fc(e,t)}const mf=Symbol.for(`yaml.alias`),hf=Symbol.for(`yaml.document`),gf=Symbol.for(`yaml.map`),_f=Symbol.for(`yaml.pair`),vf=Symbol.for(`yaml.scalar`),yf=Symbol.for(`yaml.seq`),bf=Symbol.for(`yaml.node.type`),xf=e=>!!e&&typeof e==`object`&&e[bf]===mf,Sf=e=>!!e&&typeof e==`object`&&e[bf]===hf,Cf=e=>!!e&&typeof e==`object`&&e[bf]===gf,q=e=>!!e&&typeof e==`object`&&e[bf]===_f,J=e=>!!e&&typeof e==`object`&&e[bf]===vf,wf=e=>!!e&&typeof e==`object`&&e[bf]===yf;function Tf(e){if(e&&typeof e==`object`)switch(e[bf]){case gf:case yf:return!0}return!1}function Y(e){if(e&&typeof e==`object`)switch(e[bf]){case mf:case gf:case vf:case yf:return!0}return!1}const Ef=e=>(J(e)||Tf(e))&&!!e.anchor,Df=Symbol(`break visit`),Of=Symbol(`skip children`),kf=Symbol(`remove node`);function Af(e,t){let n=Pf(t);Sf(e)?jf(null,e.contents,n,Object.freeze([e]))===kf&&(e.contents=null):jf(null,e,n,Object.freeze([]))}Af.BREAK=Df,Af.SKIP=Of,Af.REMOVE=kf;function jf(e,t,n,r){let i=Ff(e,t,n,r);if(Y(i)||q(i))return If(e,r,i),jf(e,i,n,r);if(typeof i!=`symbol`){if(Tf(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=jf(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Df)return Df;else i===kf&&(t.items.splice(e,1),--e)}}else if(q(t)){r=Object.freeze(r.concat(t));let e=jf(`key`,t.key,n,r);if(e===Df)return Df;e===kf&&(t.key=null);let i=jf(`value`,t.value,n,r);if(i===Df)return Df;i===kf&&(t.value=null)}}return i}async function Mf(e,t){let n=Pf(t);Sf(e)?await Nf(null,e.contents,n,Object.freeze([e]))===kf&&(e.contents=null):await Nf(null,e,n,Object.freeze([]))}Mf.BREAK=Df,Mf.SKIP=Of,Mf.REMOVE=kf;async function Nf(e,t,n,r){let i=await Ff(e,t,n,r);if(Y(i)||q(i))return If(e,r,i),Nf(e,i,n,r);if(typeof i!=`symbol`){if(Tf(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await Nf(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Df)return Df;else i===kf&&(t.items.splice(e,1),--e)}}else if(q(t)){r=Object.freeze(r.concat(t));let e=await Nf(`key`,t.key,n,r);if(e===Df)return Df;e===kf&&(t.key=null);let i=await Nf(`value`,t.value,n,r);if(i===Df)return Df;i===kf&&(t.value=null)}}return i}function Pf(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Ff(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Cf(t))return n.Map?.(e,t,r);if(wf(t))return n.Seq?.(e,t,r);if(q(t))return n.Pair?.(e,t,r);if(J(t))return n.Scalar?.(e,t,r);if(xf(t))return n.Alias?.(e,t,r)}function If(e,t,n){let r=t[t.length-1];if(Tf(r))r.items[e]=n;else if(q(r))e===`key`?r.key=n:r.value=n;else if(Sf(r))r.contents=n;else{let e=xf(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}const Lf={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},Rf=e=>e.replace(/[!,[\]{}]/g,e=>Lf[e]);var zf=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Rf(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&Y(e.contents)){let t={};Af(e.contents,(e,n)=>{Y(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
4
+ `)}};zf.defaultYaml={explicit:!1,version:`1.2`},zf.defaultTags={"!!":`tag:yaml.org,2002:`};function Bf(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function Vf(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=Vf(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=Vf(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=Vf(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=Vf(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function Hf(e,t,n){if(Array.isArray(e))return e.map((e,t)=>Hf(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Ef(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Uf=class{constructor(e){Object.defineProperty(this,bf,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Sf(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=Hf(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Vf(i,{"":o},``,o):o}},Wf=class extends Uf{constructor(e){super(mf),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Af(e,{Node:(e,t)=>{(xf(t)||Ef(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(Hf(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Gf(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Bf(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function Gf(e,t,n){if(xf(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(Tf(t)){let r=0;for(let i of t.items){let t=Gf(e,i,n);t>r&&(r=t)}return r}else if(q(t)){let r=Gf(e,t.key,n),i=Gf(e,t.value,n);return Math.max(r,i)}return 1}const Kf=e=>!e||typeof e!=`function`&&typeof e!=`object`;var X=class extends Uf{constructor(e){super(vf),this.value=e}toJSON(e,t){return t?.keep?this.value:Hf(this.value,e,t)}toString(){return String(this.value)}};X.BLOCK_FOLDED=`BLOCK_FOLDED`,X.BLOCK_LITERAL=`BLOCK_LITERAL`,X.PLAIN=`PLAIN`,X.QUOTE_DOUBLE=`QUOTE_DOUBLE`,X.QUOTE_SINGLE=`QUOTE_SINGLE`;function qf(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function Jf(e,t,n){if(Sf(e)&&(e=e.contents),Y(e))return e;if(q(e)){let t=n.schema[gf].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??=i(e),new Wf(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=`tag:yaml.org,2002:`+t.slice(2));let l=qf(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new X(e);return c&&(c.node=t),t}l=e instanceof Map?o[gf]:Symbol.iterator in Object(e)?o[yf]:o[gf]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new X(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Yf(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return Jf(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}const Xf=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;var Zf=class extends Uf{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>Y(t)||q(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Xf(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(Tf(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Yf(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(Tf(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&J(i)?i.value:i:Tf(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!q(t))return!1;let n=t.value;return n==null||e&&J(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return Tf(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(Tf(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Yf(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};const Qf=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function $f(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const ep=(e,t,n)=>e.endsWith(`
5
+ `)?$f(n,t):n.includes(`
6
+ `)?`
7
+ `+$f(n,t):(e.endsWith(` `)?``:` `)+n,tp=`flow`;function np(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,ee=-1;n===`block`&&(h=rp(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}ee=h}if(r===`
8
+ `)n===`block`&&(h=rp(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
9
+ `&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
10
+ `&&t!==` `&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>ee+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let _=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?_=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(_+=`${e[i]}\\`),_+=`\n${t}${e.slice(i+1,a)}`)}return _}function rp(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
11
+ `);r=t,i=t+1,a=e[i]}return r}const ip=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),ap=e=>/^(%|---|\.\.\.)/m.test(e);function op(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
12
+ `){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function sp(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(ap(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
13
+
14
+ `;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
15
+ `,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:np(o,a,`quoted`,ip(t,!1))}function cp(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
16
+ `)||/[ \t]\n|\n[ \t]/.test(e))return sp(e,t);let n=t.indent||(ap(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:np(r,n,tp,ip(t,!1))}function lp(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=sp;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?cp:i&&!t?sp:n?cp:sp}return r(e,t)}let up;try{up=RegExp(`(^|(?<!
17
+ ))
18
+ +(?!
19
+ |$)`,`g`)}catch{up=/\n+(?!\n|$)/g}function dp({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return lp(n,r);let l=r.indent||(r.forceBlockIndent||ap(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===X.BLOCK_FOLDED?!1:t===X.BLOCK_LITERAL||!op(n,c,l.length);if(!n)return u?`|
20
+ `:`>
21
+ `;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
22
+ `&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
23
+ `);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
24
+ `&&(p=p.slice(0,-1)),p.replace(up,`$&${l}`));let h=!1,g,ee=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
25
+ `)ee=g;else break}let _=n.substring(0,ee<g?ee+1:g);_&&=(n=n.substring(_.length),_.replace(/\n+/g,`$&${l}`));let v=(h?l?`2`:`1`:``)+d;if(e&&(v+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
26
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=ip(r,!0);o!==`folded`&&t!==X.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=np(`${_}${e}${p}`,l,`block`,a);if(!i)return`>${v}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${v}\n${l}${_}${n}${p}`}function fp(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
27
+ `)||u&&/[[\]{},]/.test(a))return lp(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
28
+ `)?lp(a,t):dp(e,t,n,r);if(!s&&!u&&i!==X.PLAIN&&a.includes(`
29
+ `))return dp(e,t,n,r);if(ap(a)){if(c===``)return t.forceBlockIndent=!0,dp(e,t,n,r);if(s&&c===l)return lp(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return lp(a,t)}return s?d:np(d,c,tp,ip(t,!1))}function pp(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==X.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=X.QUOTE_DOUBLE);let c=e=>{switch(e){case X.BLOCK_FOLDED:case X.BLOCK_LITERAL:return i||a?lp(o.value,t):dp(o,t,n,r);case X.QUOTE_DOUBLE:return sp(o.value,t);case X.QUOTE_SINGLE:return cp(o.value,t);case X.PLAIN:return fp(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function mp(e,t){let n=Object.assign({blockQuote:!0,commentString:Qf,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function hp(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(J(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function gp(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(J(e)||Tf(e))&&e.anchor;a&&Bf(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function _p(e,t,n,r){if(q(e))return e.toString(t,n,r);if(xf(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=Y(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=hp(t.doc.schema.tags,a);let o=gp(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):J(a)?pp(a,t,n,r):a.toString(t,n,r);return o?J(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function vp({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=Y(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(Tf(e)||!Y(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||Tf(e)||(J(e)?e.type===X.BLOCK_FOLDED||e.type===X.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=_p(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=ep(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=ep(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=ep(g,n.indent,l(f))));let ee,_,v;Y(t)?(ee=!!t.spaceBefore,_=t.commentBefore,v=t.comment):(ee=!1,_=null,v=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&J(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&wf(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let te=!1,ne=_p(t,n,()=>te=!0,()=>h=!0),re=` `;if(f||ee||_){if(re=ee?`
30
+ `:``,_){let e=l(_);re+=`\n${$f(e,n.indent)}`}ne===``&&!n.inFlow?re===`
31
+ `&&v&&(re=`
32
+
33
+ `):re+=`\n${n.indent}`}else if(!p&&Tf(t)){let e=ne[0],r=ne.indexOf(`
34
+ `),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=ne.indexOf(` `);e===`&`&&n!==-1&&n<r&&ne[n+1]===`!`&&(n=ne.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(re=`\n${n.indent}`)}}else(ne===``||ne[0]===`
35
+ `)&&(re=``);return g+=re+ne,n.inFlow?te&&r&&r():v&&!te?g+=ep(g,n.indent,l(v)):h&&i&&i(),g}function yp(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}const bp={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new X(Symbol(`<<`)),{addToJSMap:Sp}),stringify:()=>`<<`},xp=(e,t)=>(bp.identify(t)||J(t)&&(!t.type||t.type===X.PLAIN)&&bp.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===bp.tag&&e.default);function Sp(e,t,n){let r=wp(e,n);if(wf(r))for(let n of r.items)Cp(e,t,n);else if(Array.isArray(r))for(let n of r)Cp(e,t,n);else Cp(e,t,r)}function Cp(e,t,n){let r=wp(e,n);if(!Cf(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function wp(e,t){return e&&xf(t)?t.resolve(e.doc,e):t}function Tp(e,t,{key:n,value:r}){if(Y(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(xp(e,n))Sp(e,t,r);else{let i=Hf(n,``,e);if(t instanceof Map)t.set(i,Hf(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Ep(n,i,e),o=Hf(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Ep(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(Y(e)&&n?.doc){let t=mp(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),yp(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Dp(e,t,n){return new Op(Jf(e,void 0,n),Jf(t,void 0,n))}var Op=class e{constructor(e,t=null){Object.defineProperty(this,bf,{value:_f}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return Y(n)&&(n=n.clone(t)),Y(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Tp(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?vp(this,e,t,n):JSON.stringify(this)}};function kp(e,t,n){return(t.inFlow??e.flow?jp:Ap)(e,t,n)}function Ap({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(Y(i))!d&&i.spaceBefore&&f.push(``),Mp(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(q(i)){let e=Y(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Mp(n,f,e.commentBefore,d))}d=!1;let s=_p(i,u,()=>o=null,()=>d=!0);o&&(s+=ep(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
36
+ `}}return e?(p+=`
37
+ `+$f(l(e),c),s&&s()):d&&o&&o(),p}function jp({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(Y(i))i.spaceBefore&&d.push(``),Mp(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(q(i)){let e=Y(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Mp(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=Y(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=_p(i,c,()=>a=null);l||=d.length>u||o.includes(`
38
+ `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=ep(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
39
+ `;return`${e}\n${i}${p}`}else return`${f}${o}${d.join(` `)}${o}${p}`}function Mp({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=$f(t(r),e);n.push(i.trimStart())}}function Np(e,t){let n=J(t)?t.value:t;for(let r of e)if(q(r)&&(r.key===t||r.key===n||J(r.key)&&r.key.value===n))return r}var Pp=class extends Zf{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(gf,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Dp(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=q(e)?e:!e||typeof e!=`object`||!(`key`in e)?new Op(e,e?.value):new Op(e.key,e.value);let r=Np(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);J(r.value)&&Kf(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=Np(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Np(this.items,e)?.value;return(!t&&J(n)?n.value:n)??void 0}has(e){return!!Np(this.items,e)}set(e,t){this.add(new Op(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Tp(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!q(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),kp(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}};const Fp={collection:`map`,default:!0,nodeClass:Pp,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Cf(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Pp.from(e,t,n)};var Ip=class extends Zf{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(yf,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Lp(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=Lp(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&J(r)?r.value:r}has(e){let t=Lp(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Lp(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];J(r)&&Kf(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(Hf(e,String(r++),t));return n}toString(e,t,n){return e?kp(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(Jf(a,void 0,n))}}return i}};function Lp(e){let t=J(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}const Rp={collection:`seq`,default:!0,nodeClass:Ip,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return wf(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Ip.from(e,t,n)};function zp(e){return typeof e==`bigint`||Number.isInteger(e)}const Bp=({value:e})=>JSON.stringify(e),Vp=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Bp},{identify:e=>e==null,createNode:()=>new X(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Bp},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Bp},{identify:zp,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>zp(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Bp}];[Fp,Rp].concat(Vp,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function Hp(e,t,n){let{replacer:r}=n,i=new Ip(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e))if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`);else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Dp(o,s,n))}return i}var Up=class e extends Ip{constructor(){super(),this.add=Pp.prototype.add.bind(this),this.delete=Pp.prototype.delete.bind(this),this.get=Pp.prototype.get.bind(this),this.has=Pp.prototype.has.bind(this),this.set=Pp.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(q(e)?(r=Hf(e.key,``,t),i=Hf(e.value,r,t)):r=Hf(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Hp(e,t,n),i=new this;return i.items=r.items,i}};Up.tag=`tag:yaml.org,2002:omap`;var Wp=class e extends Pp{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=q(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new Op(e.key,null):new Op(e,null),Np(this.items,t.key)||this.items.push(t)}get(e,t){let n=Np(this.items,e);return!t&&q(n)?J(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Np(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Op(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Dp(e,null,n));return i}};Wp.tag=`tag:yaml.org,2002:set`;const Gp=Symbol(`break visit`),Kp=Symbol(`skip children`),qp=Symbol(`remove item`);function Jp(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Yp(Object.freeze([]),e,t)}Jp.BREAK=Gp,Jp.SKIP=Kp,Jp.REMOVE=qp,Jp.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Jp.parentCollection=(e,t)=>{let n=Jp.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function Yp(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=Yp(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Gp)return Gp;else r===qp&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}t(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}let r=/^\s+$/,i=/(?:[^\\]|^)\\$/,a=/^\\!/,o=/^\\#/,s=/\r?\n/g,c=/^\.{0,2}\/|^\.{1,2}$/,l=/\/$/,u=`node-ignore`;typeof Symbol<`u`&&(u=Symbol.for(`node-ignore`));let d=u,f=(e,t,n)=>(Object.defineProperty(e,t,{value:n}),n),p=/([0-z])-([0-z])/g,m=()=>!1,h=e=>e.replace(p,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),g=e=>{let{length:t}=e;return e.slice(0,t-t%2)},ee=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${g(r)}${i}`:i===`]`&&r.length%2==0?`[${h(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`]],_=/(^|\\\/)?\\\*$/,v=`regex`,te=`checkRegex`,ne={[v](e,t){return`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`},[te](e,t){return`${t?`${t}[^/]*`:`[^/]*`}(?=$|\\/$)`}},re=e=>ee.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),ie=e=>typeof e==`string`,ae=e=>e&&ie(e)&&!r.test(e)&&!i.test(e)&&e.indexOf(`#`)!==0,oe=e=>e.split(s).filter(Boolean);var se=class{constructor(e,t,n,r,i,a){this.pattern=e,this.mark=t,this.negative=i,f(this,`body`,n),f(this,`ignoreCase`,r),f(this,`regexPrefix`,a)}get regex(){let e=`_regex`;return this[e]?this[e]:this._make(v,e)}get checkRegex(){let e=`_checkRegex`;return this[e]?this[e]:this._make(te,e)}_make(e,t){let n=this.regexPrefix.replace(_,ne[e]),r=this.ignoreCase?new RegExp(n,`i`):new RegExp(n);return f(this,t,r)}};let ce=({pattern:e,mark:t},n)=>{let r=!1,i=e;i.indexOf(`!`)===0&&(r=!0,i=i.substr(1)),i=i.replace(a,`!`).replace(o,`#`);let s=re(i);return new se(e,t,i,n,r,s)};var le=class{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[d]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(ie(e)&&(e={pattern:e}),ae(e.pattern)){let t=ce(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(ie(e)?oe(e):e).forEach(this._add,this),this._added}test(e,t,n){let r=!1,i=!1,a;this._rules.forEach(o=>{let{negative:s}=o;i===s&&r!==i||s&&!r&&!i&&!t||o[n].test(e)&&(r=!s,i=s,a=s?void 0:o)});let o={ignored:r,unignored:i};return a&&(o.rule=a),o}};let ue=(e,t)=>{throw new t(e)},de=(e,t,n)=>ie(e)?e?!de.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),y=e=>c.test(e);de.isNotRelative=y,de.convert=e=>e;var fe=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){f(this,d,!0),this._rules=new le(t),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,t,n,r){let i=e&&de.convert(e);return de(i,e,this._strictPathCheck?ue:m),this._t(i,t,n,r)}checkIgnore(e){if(!l.test(e))return this.test(e);let t=e.split(`/`).filter(Boolean);if(t.pop(),t.length){let e=this._t(t.join(`/`)+`/`,this._testCache,!0,t);if(e.ignored)return e}return this._rules.test(e,!1,te)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`).filter(Boolean),r.pop(),!r.length)return t[e]=this._rules.test(e,n,v);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._rules.test(e,n,v)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let pe=e=>new fe(e),me=e=>de(e&&de.convert(e),e,m),he=()=>{de.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;de.isNotRelative=t=>e.test(t)||y(t)};typeof process<`u`&&process.platform===`win32`&&he(),t.exports=pe,pe.default=pe,t.exports.isPathValid=me,f(t.exports,Symbol.for(`setupWindows`),he)}))(),globalThis.Buffer,A({command:kr({description:`Bash command to execute`}),timeout:Vt(Tr({description:`Timeout in seconds (optional, no default timeout)`}))});var Xp=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends Xp{};function Zp(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Qp(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function $p(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function em(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function tm(e,t){return $p(e,t,``)}function nm(e,t){return em(e,t,``)}function rm(e,t){return t.slice(0,im(e,t))}function im(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function am(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function om(e,t){if(t)return cm(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function sm(e,t){if(t)return cm(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function cm(e,t){if(!t)return[sm(e),om(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=am(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}const lm=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,um=RegExp(`[${lm}]+|\\s+|[^${lm}]`,`ug`);new class extends Xp{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=am(e,r)}else n=e.match(um)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&dm(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&dm(n,i,r,null,t.intlSegmenter),e}};function dm(e,t,n,r,i){if(t&&n){let[a,o]=cm(t.value,i),[s,c]=cm(n.value,i);if(e){let r=Zp(a,s);e.value=em(e.value,s,r),t.value=tm(t.value,r),n.value=tm(n.value,r)}if(r){let e=Qp(o,c);r.value=$p(r.value,c,e),t.value=nm(t.value,e),n.value=nm(n.value,e)}}else if(n){if(e){let e=sm(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=sm(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=sm(r.value,i),[a,o]=cm(t.value,i),s=Zp(n,a);t.value=tm(t.value,s);let c=Qp(tm(n,s),o);t.value=nm(t.value,c),r.value=$p(r.value,n,c),e.value=em(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=sm(r.value,i),n=rm(om(t.value,i),e);t.value=nm(t.value,n)}else if(e){let n=rm(om(e.value,i),sm(t.value,i));t.value=tm(t.value,n)}}new class extends Xp{tokenize(e){let t=RegExp(`(\\r?\\n)|[${lm}]+|[^\\S\\n\\r]+|[^${lm}]`,`ug`);return e.match(t)||[]}},new class extends Xp{constructor(){super(...arguments),this.tokenize=fm}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
40
+ `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
41
+ `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
42
+ `)&&(e=e.slice(0,-1)),t.endsWith(`
43
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function fm(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
44
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function pm(e){return e==`.`||e==`!`||e==`?`}new class extends Xp{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(pm(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends Xp{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends Xp{constructor(){super(...arguments),this.tokenize=fm}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(mm(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function mm(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=mm(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=mm(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends Xp{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};const hm=A({oldText:kr({description:`Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call.`}),newText:kr({description:`Replacement text for this targeted edit.`})},{});A({path:kr({description:`Path to the file to edit (relative or absolute)`}),edits:Xt(hm,{description:`One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead.`})},{}),A({path:kr({description:`Path to the file to read (relative or absolute)`}),offset:Vt(Tr({description:`Line number to start reading from (1-indexed)`})),limit:Vt(Tr({description:`Maximum number of lines to read`}))}),A({path:kr({description:`Path to the file to write (relative or absolute)`}),content:kr({description:`Content to write to the file`})});const gm={enabled:!0,reserveTokens:16384,keepRecentTokens:2e4};function _m(e,t,n){return n.enabled?e>t-n.reserveTokens:!1}function vm(e){if(typeof e==`string`)return e.length;let t=0;for(let n of e)n.type===`text`&&n.text?t+=n.text.length:n.type===`image`&&(t+=4800);return t}function ym(e){let t=0;switch(e.role){case`user`:return t=vm(e.content),Math.ceil(t/4);case`assistant`:{let n=e;for(let e of n.content)e.type===`text`?t+=e.text.length:e.type===`thinking`?t+=e.thinking.length:e.type===`toolCall`&&(t+=e.name.length+JSON.stringify(e.arguments).length);return Math.ceil(t/4)}case`custom`:case`toolResult`:return t=vm(e.content),Math.ceil(t/4);case`bashExecution`:return t=e.command.length+e.output.length,Math.ceil(t/4);case`branchSummary`:case`compactionSummary`:return t=e.summary.length,Math.ceil(t/4)}return 0}const bm=n(`context-compaction`);function xm(e,t){return e.role===t}function Sm(e){let t=0;for(;t<e.length&&xm(e[t],`toolResult`);){let n=e[t];bm.warn(`Dropping orphaned toolResult (no preceding assistant message)`,{toolCallId:n.toolCallId}),t++}return t>0?e.slice(t):e}function Cm(e){let t=[];for(let n of e){let e=n;switch(e.role){case`user`:t.push(`<user>\n${wm(e.content)}\n</user>`);break;case`assistant`:t.push(`<assistant>\n${wm(e.content)}\n</assistant>`);break;case`toolResult`:{let n=e.toolName??`tool`;t.push(`<tool-result name="${n}">\n${wm(e.content)}\n</tool-result>`);break}case`bashExecution`:t.push(`<bash>\n$ ${e.command??``}\n${e.output??``}\n</bash>`);break;case`branchSummary`:case`compactionSummary`:t.push(`<prior-summary>\n${e.summary??``}\n</prior-summary>`);break;default:t.push(`<${e.role}>\n${wm(e.content)}\n</${e.role}>`)}}return t.join(`
45
+
46
+ `)}function wm(e){if(typeof e==`string`)return e;if(!Array.isArray(e))return``;let t=[];for(let n of e){let e=n;e.type===`text`&&e.text?t.push(e.text):e.type===`thinking`&&e.thinking?t.push(`[thinking] ${e.thinking}`):e.type===`toolCall`?t.push(`[tool-call ${e.name??`?`}] ${JSON.stringify(e.arguments??{})}`):e.type===`image`&&t.push(`[image]`)}return t.join(`
47
+ `)}function Tm(e){return`You are a context compaction assistant. You are shown the prefix of a conversation between a user and an AI coding assistant, and asked to produce either a structured summary, durable memory bullets, or a short title — depending on the user's instruction.
48
+
49
+ Do NOT continue the conversation. Do NOT answer questions inside the conversation. Output ONLY what the user asks for in the format specified.
50
+
51
+ <conversation>
52
+ ${e}
53
+ </conversation>`}async function Em(e,t,n,r,i,a,o){let s=await ne(e,{systemPrompt:n,messages:[{role:`user`,content:[{type:`text`,text:r}],timestamp:Date.now()}]},{maxTokens:i,apiKey:t,headers:a,signal:o});if(s.stopReason===`error`)throw Error(`Compaction call failed: ${s.errorMessage||`Unknown error`}`);return s.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
54
+ `).trim()}function Dm(e){if(typeof e==`string`)return e.length;if(!Array.isArray(e))return 0;let t=0;for(let n of e){let e=n;if(e.type===`text`&&e.text)t+=e.text.length;else if(e.type===`thinking`&&e.thinking)t+=e.thinking.length;else if(e.type===`toolCall`&&e.arguments!==void 0)try{t+=JSON.stringify(e.arguments).length}catch{}else e.type===`image`&&e.source?.data&&(t+=e.source.data.length)}return t}function Om(e,t){let n=Math.max(1,Math.round(e/1024));return`[${t===`assistant`?`Assistant message elided`:`Tool result elided`}: ${n} KB, exceeds half the context window. Re-run with smaller arguments — e.g. open --view --size low.]`}function km(e,t,n){let r=(t-n)/2,i=0,a=0;return{messages:e.map(e=>{if(ym(e)<=r)return e;let t=e.role;if(t!==`toolResult`&&t!==`assistant`)return e;let n=e,o=Dm(n.content);if(t===`toolResult`)return i++,a+=o,{...e,content:[{type:`text`,text:Om(o,`toolResult`)}]};let s=(Array.isArray(n.content)?n.content:[]).filter(e=>e.type===`toolCall`);if(s.length===0)return e;let c=s.map(e=>{let t=0;if(e.arguments!==void 0)try{t=JSON.stringify(e.arguments).length}catch{}return{type:e.type,id:e.id,name:e.name,arguments:{elided:!0,originalBytes:t}}});return i++,a+=o,{...e,content:[{type:`text`,text:Om(o,`assistant`)},...c]}}),elidedCount:i,elidedBytes:a}}function Am(e){let t=0;for(let n of e)t+=ym(n);return t}function jm(e,t){try{e.onCompactionStateChange?.(t)}catch(e){bm.warn(`onCompactionStateChange listener threw`,{error:e instanceof Error?e.message:String(e)})}}function Mm(e,t,n,r,i,a){if(t<=n*i)return{messages:e,isHopeless:!1,earlyReturn:null};let o=km(e,n,r),s=o.messages;return bm.warn(`Compaction hopeless branch`,{totalTokens:t,contextWindow:n,multiplier:i,elidedCount:o.elidedCount,elidedBytes:o.elidedBytes}),{messages:s,isHopeless:!0,earlyReturn:_m(Am(s),n,a)?null:s}}function Nm(e,t){let n=0,r=e.length;for(let i=e.length-1;i>=0;i--){let a=ym(e[i]);if(n+a>t&&r<e.length)break;n+=a,r=i}for(;r>0&&xm(e[r],`toolResult`);)r--;return r<=0||r>=e.length?(bm.warn(`Cannot find valid cut point for compaction`),null):{messagesToSummarize:e.slice(0,r),messagesToKeep:Sm(e.slice(r))}}async function Pm(e,t,n,r){if(e.onMemoryUpdates)try{jm(e,`extracting-memory`);let i=await Em(e.model,t,n,`From the conversation above, extract durable memories worth persisting to a global memory file shared across future sessions.
55
+
56
+ Focus on:
57
+ - User preferences, working style, opinions stated explicitly.
58
+ - Stable project facts (architecture decisions, conventions, constraints).
59
+ - Validated approaches the user accepted ("yes, exactly", "perfect"), not just corrections.
60
+ - External resources/links the user named.
61
+
62
+ DO NOT include:
63
+ - Ephemeral state (current task, in-progress work).
64
+ - Information already obvious from the codebase (file paths, function names, framework conventions).
65
+ - Generic restatements of what the conversation was about.
66
+
67
+ If nothing in the conversation is worth persisting, return exactly the single line:
68
+ NONE
69
+
70
+ Otherwise, output ONLY a markdown bullet list (one bullet per memory), no headers, no preamble, no follow-up. Each bullet is one line. Be specific. Prefer one fact per bullet over multi-clause sentences.`,2048,e.headers,r);if(i?.trim()&&i.trim()!==`NONE`)try{await e.onMemoryUpdates(i.trim()),bm.info(`Memory extraction applied`,{bulletsLength:i.length})}catch(e){bm.warn(`onMemoryUpdates callback threw`,{error:e instanceof Error?e.message:String(e)})}else bm.info(`Memory extraction returned no durable memories`)}catch(e){bm.warn(`Memory extraction call failed (compaction still applied)`,{error:e instanceof Error?e.message:String(e)})}}async function Fm(e,t,n,r,i,a,o){try{let s=Tm(Cm(n)),c=Math.floor(.8*i);jm(e,`summarizing`);let l=await Em(e.model,t,s,`Produce a structured context checkpoint summary of the conversation above that another LLM can use to continue the work.
71
+
72
+ Use this EXACT format:
73
+
74
+ ## Goal
75
+ [What is the user trying to accomplish? Can be multiple items if the session covers different tasks.]
76
+
77
+ ## Constraints & Preferences
78
+ - [Any constraints, preferences, or requirements mentioned by user]
79
+ - [Or "(none)" if none were mentioned]
80
+
81
+ ## Progress
82
+ ### Done
83
+ - [x] [Completed tasks/changes]
84
+
85
+ ### In Progress
86
+ - [ ] [Current work]
87
+
88
+ ### Blocked
89
+ - [Issues preventing progress, if any]
90
+
91
+ ## Key Decisions
92
+ - **[Decision]**: [Brief rationale]
93
+
94
+ ## Next Steps
95
+ 1. [Ordered list of what should happen next]
96
+
97
+ ## Critical Context
98
+ - [Any data, examples, or references needed to continue]
99
+ - [Or "(none)" if not applicable]
100
+
101
+ Keep each section concise. Preserve exact file paths, function names, and error messages. Output ONLY the summary, with no preamble or follow-up.`,c,e.headers,o),u={role:`user`,content:[{type:`text`,text:`<context-summary>\n${l}\n</context-summary>`}],timestamp:Date.now()};return bm.info(`LLM summarization successful`,{originalMessages:a,compactedMessages:1+r.length,summaryLength:l.length}),await Pm(e,t,s,o),jm(e,`idle`),[u,...r]}catch(e){return bm.warn(`LLM summarization failed, falling back to naive drop`,{error:e instanceof Error?e.message:String(e)}),null}}function Im(e){let t=e.contextWindow??2e5,n=e.reserveTokens??gm.reserveTokens,r=e.keepRecentTokens??gm.keepRecentTokens,i=e.hopelessMultiplier??4,a={enabled:!0,reserveTokens:n,keepRecentTokens:r};return async(o,s)=>{if(o.length===0)return o;let c=Am(o);if(!_m(c,t,a))return o;let l=Mm(o,c,t,n,i,a);if(l.earlyReturn)return l.earlyReturn;let u=l.messages,d=l.isHopeless;bm.info(`Context compaction triggered`,{totalTokens:c,contextWindow:t,threshold:t-n,messageCount:u.length});let f=Nm(u,r);if(!f)return u;let{messagesToSummarize:p,messagesToKeep:m}=f;bm.info(`Compaction cut point`,{summarizing:p.length,keeping:m.length});let h=d?void 0:e.getApiKey();if(h){let t=await Fm(e,h,p,m,n,o.length,s);if(t)return t}else d||bm.warn(`No API key available for LLM summarization, falling back to naive drop`);jm(e,`idle`);let g={role:`user`,content:[{type:`text`,text:`[Earlier conversation messages were compacted to save context space]`}],timestamp:Date.now()};return bm.info(`Naive compaction applied`,{originalMessages:o.length,compactedMessages:1+m.length}),[g,...m]}}const Lm=m({portName:`secrets.crud`,panelRpcOp:`secrets-bridge`,timeoutMs:1e4,onUnavailable:`resolve-undefined`,makeError:e=>Error(e),logNamespace:`secrets-bridge`,toPortMessage:({type:e,payload:t})=>({type:e,...t}),toPanelRpcPayload:({type:e,payload:t})=>({type:e,payload:t})});function Rm(e,t){return Lm({type:e,payload:t})}const zm=n(`secret-scrub`),Bm=async e=>e;function Vm(){let e=le();return e===`extension-direct`?async e=>{if(!e)return e;try{let t=await new Promise(t=>{chrome.runtime.sendMessage({type:`secrets.scrub-tool-result`,text:e},e=>t(e??{}))});return t.error?(zm.debug(`SW scrub-tool-result returned error`,{error:t.error}),e):typeof t.text==`string`?t.text:e}catch(t){return zm.debug(`SW scrub-tool-result failed`,{error:t instanceof Error?t.message:String(t)}),e}}:e===`extension-delegate`?async e=>{if(!e)return e;try{let t=await Rm(`secrets.scrub-tool-result`,{text:e});return t?.error?(zm.debug(`Bridge scrub-tool-result returned error`,{error:t.error}),e):typeof t?.text==`string`?t.text:e}catch(t){return zm.debug(`Bridge scrub-tool-result failed`,{error:t instanceof Error?t.message:String(t)}),e}}:e===`connect`?Bm:async e=>{if(!e)return e;try{let t=await fetch(l(`/api/secrets/scrub`),{method:`POST`,headers:u({"content-type":`application/json`}),body:JSON.stringify({text:e})});if(!t.ok)return zm.debug(`Server scrub-tool-result returned non-ok`,{status:t.status}),e;let n=await t.json();return typeof n.text==`string`?n.text:e}catch(t){return zm.debug(`Server scrub-tool-result failed`,{error:t instanceof Error?t.message:String(t)}),e}}}const Hm=n(`tool-adapter`);function Um(e){let t=[],n=0;for(let r of e.matchAll(ee())){let i=h(r[0]);if(!i)continue;let a=e.slice(n,r.index);a.trim()&&t.push({type:`text`,text:a.trimEnd()}),t.push({type:`image`,mimeType:i.mimeType,data:i.data}),n=r.index+r[0].length}let r=e.slice(n);return(r.trim()||t.length===0)&&t.push({type:`text`,text:r||e}),t}async function Wm(e){let t=Um(e),n=[];for(let e of t)e.type===`image`?n.push(await g(e)):n.push(e);return n}function Gm(e,t,n,r){if(!r)return{tracked:null,effectiveSignal:n};let i=r.processManager.spawn({kind:`tool`,argv:[e.name,...Zm(t)],owner:r.owner,ppid:r.getParentPid?.()});n?.aborted?r.processManager.signal(i.pid,`SIGINT`):n&&n.addEventListener(`abort`,()=>r.processManager.signal(i.pid,`SIGINT`),{once:!0});let a=r.processManager.onSignal((e,t)=>{e.pid!==i.pid||t!==`SIGKILL`||r.processManager.exit(i.pid,null)});return{tracked:{record:i,manager:r.processManager,unsubscribeKill:a},effectiveSignal:i.abort.signal}}function Km(e,t){e&&e.manager.exit(e.record.pid,t)}async function qm(e,t,n){if(!n||typeof e!=`string`||e.length===0)return e;try{return await n.scrubToolResult(e)}catch(n){return Hm.warn(`Tool-result scrub failed, falling back to unscrubbed content`,{tool:t,error:n instanceof Error?n.message:String(n)}),e}}async function Jm(e,t){try{return await Wm(e)}catch(n){return Hm.warn(`Image processing failed, falling back to raw content`,{tool:t,error:n instanceof Error?n.message:String(n)}),Um(e)}}function Ym(e,t,n){return{name:e.name,label:e.name,description:e.description,parameters:e.inputSchema,async execute(r,i,a,o){let s;o&&(s=f({onUpdate:o,toolName:e.name,toolCallId:r}));let c=Gm(e,i,a,t);try{let t=await e.execute(i??{},c.effectiveSignal),r=await Jm(await qm(t.content,e.name,n),e.name);return Km(c.tracked,+!!t.isError),{content:r,details:{isError:t.isError}}}catch(e){throw Km(c.tracked,c.tracked?.record.abort.signal.aborted?null:1),e}finally{s&&p(s),c.tracked?.unsubscribeKill()}}}}function Xm(e,t,n){return e.map(e=>Ym(e,t,n))}function Zm(e){if(typeof e!=`object`||!e)return[];let t=e;for(let e of[`command`,`file_path`,`path`,`pattern`,`url`,`key`,`name`,`query`,`message`]){let n=t[e];if(typeof n==`string`&&n.length>0)return[n]}for(let e of Object.values(t))if(typeof e==`string`&&e.length>0)return[e];return[]}function Qm(e,t){let n={input:0,output:0,cacheRead:0,cacheWrite:0},r=_(e);if(!r)return n;let i;for(let e of t.values()){let t=_(e.id);!t||t.family!==r.family||(!i||t.major>i.major||t.major===i.major&&t.minor>i.minor)&&(i={major:t.major,minor:t.minor,cost:e.cost})}return i?.cost??n}var $m=e({ACCOUNTS_KEY:()=>nh,__test__:()=>dh,addAccount:()=>jh,applyProviderDefaults:()=>bh,clearAllSettings:()=>tg,clearApiKey:()=>Xh,clearBaseUrl:()=>$h,clearSelectedProvider:()=>qh,exportProviders:()=>eg,getAccounts:()=>Q,getAllAvailableModels:()=>wh,getAllExtraOAuthDomains:()=>Oh,getApiKey:()=>Jh,getApiKeyForProvider:()=>zh,getApiVersionForProvider:()=>Hh,getAvailableProviders:()=>fh,getBaseUrl:()=>Zh,getBaseUrlForProvider:()=>Bh,getDeploymentForProvider:()=>Vh,getExtraOAuthDomains:()=>Th,getOAuthAccountInfo:()=>vh,getProviderConfig:()=>hh,getProviderModels:()=>_h,getRawApiKeyForProvider:()=>Rh,getSelectedModelId:()=>Uh,getSelectedProvider:()=>$,isModelHiddenFromPicker:()=>Sh,logoutOAuthAccount:()=>Ph,maskOAuthTokenWithRetry:()=>Fh,migrateLegacyAuthOnlySelection:()=>lh,persistOAuthMaskViaServiceWorker:()=>Ih,providerOffersLlmModels:()=>ph,removeAccount:()=>Nh,resolveCurrentModel:()=>og,resolveModelById:()=>ag,resolveModelByShorthand:()=>sg,resolveModelIdForScoop:()=>lg,saveOAuthAccount:()=>Lh,setApiKey:()=>Yh,setBaseUrl:()=>Qh,setExtraOAuthDomains:()=>Eh,setExtraOAuthDomainsAsync:()=>Dh,setSelectedModelId:()=>Wh,setSelectedProvider:()=>Kh});const eh=ae,th=v,nh=`slicc_accounts`,rh=`selected-model`,ih=[`slicc_provider`,`slicc_api_key`,`slicc_base_url`,`anthropic_api_key`,`api_provider`,`azure_resource`,`bedrock_region`],ah=new Set([`github`]);function oh(e){let t;try{t=te()}catch{return!1}return t.includes(e)&&!o(e)}let sh=!1;function ch(){if(!sh){sh=!0;for(let e of ih)try{localStorage.removeItem(e)}catch{}lh()}}function lh(){try{let e=localStorage.getItem(rh);if(e){let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t);(ah.has(n)||oh(n))&&localStorage.removeItem(rh)}}}catch{}try{let e=localStorage.getItem(nh);if(!e)return;let t=JSON.parse(e);if(!Array.isArray(t))return;let n=t.filter(e=>!(typeof e==`object`&&e&&typeof e.providerId==`string`&&oh(e.providerId)));n.length!==t.length&&localStorage.setItem(nh,JSON.stringify(n))}catch{}}function uh(){sh=!1}const dh={_resetLegacyCleanup:uh};function fh(){let e=te().filter(o),t=a();return[...new Set([...e,...t])].filter(e=>!s(e)?.hidden)}function ph(e){try{if(_h(e).length>0)return!0}catch{}try{if(v(e).length>0)return!0}catch{}let t=s(e);return!!(t?.modelOverrides&&Object.keys(t.modelOverrides).length>0)}function mh(e,t){try{if(_h(e).some(e=>e.id===t))return!0}catch{}try{if(v(e).some(e=>e.id===t))return!0}catch{}let n=s(e);return!!(n?.modelOverrides&&Object.hasOwn(n.modelOverrides,t))}function hh(e){return s(e)||{id:e,name:e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `),description:`${e} provider`,requiresApiKey:!0,requiresBaseUrl:!1}}function gh(e,t){t.context_window!==void 0&&(e.contextWindow=t.context_window),t.max_tokens!==void 0&&(e.maxTokens=t.max_tokens),t.reasoning!==void 0&&(e.reasoning=t.reasoning),t.input!==void 0&&(e.input=t.input),t.cost!==void 0&&(e.cost=t.cost,e.inputCost=t.cost.input,e.outputCost=t.cost.output,e.cacheReadCost=t.cost.cacheRead,e.cacheWriteCost=t.cost.cacheWrite),t.compat!==void 0&&(e.compat={...e.compat??{},...t.compat}),t.thinkingLevelMap!==void 0&&(e.thinkingLevelMap={...e.thinkingLevelMap??{},...t.thinkingLevelMap})}function _h(e){try{if(e===`bedrock-camp`){let e=ie(Bh(`bedrock-camp`));return th(`amazon-bedrock`).filter(t=>re(t,e)).map(e=>({...e,api:`bedrock-camp-converse`,provider:`bedrock-camp`}))}let t=hh(e);if(t.getModelIds){let n;try{n=t.getModelIds()}catch(t){return Z.error(`Provider getModelIds callback failed`,{providerId:e,error:t instanceof Error?t.message:String(t)}),[]}let r=new Map;for(let e of te())try{for(let t of th(e))r.set(t.id,t)}catch{}return n.map(n=>{let i=n.api===`openai`?`openai`:`anthropic`,a=`${e}-${i}`,o=r.get(n.id),s;if(o)s={...o,api:a,provider:e};else if(s=rg(e,n.id,``,a),n.name&&(s.name=n.name),i===`anthropic`){let e=Qm(n.id,r);s.cost=e,s.inputCost=e.input,s.outputCost=e.output,s.cacheReadCost=e.cacheRead,s.cacheWriteCost=e.cacheWrite}let c=t.modelOverrides?.[n.id];return c&&gh(s,c),gh(s,n),s})}if(t.isOAuth){let n=th(`anthropic`),r=`${e}-anthropic`;return n.map(n=>{let i={...n,api:r,provider:e},a=t.modelOverrides?.[n.id];return a&&gh(i,a),i})}return th(e===`azure-ai-foundry`?`anthropic`:e)}catch(t){return Z.error(`Failed to load models`,{providerId:e,error:t instanceof Error?t.message:String(t)}),[]}}function vh(e){let t=Q().find(t=>t.providerId===e);if(!t?.accessToken)return null;let n=!!t.tokenExpiresAt&&Date.now()>t.tokenExpiresAt-6e4;return{token:t.accessToken,maskedValue:t.maskedValue,expiresAt:t.tokenExpiresAt,userName:t.userName,userAvatar:t.userAvatar,expired:n}}const yh=Object.assign({})[`/packages/webapp/providers.json`]??[],Z=n(`provider-settings`);function bh(e=yh){if(e.length===0||Q().length>0)return;let t=new Set(fh());for(let n of e)if(!(!n.providerId||!n.apiKey)){if(!t.has(n.providerId)){Z.warn(`Unknown provider "${n.providerId}" in providers.json — skipping`);continue}jh(n.providerId,n.apiKey,n.baseUrl)}let n=e.find(e=>e.providerId&&e.apiKey&&t.has(e.providerId));n?.model&&!localStorage.getItem(rh)&&localStorage.setItem(rh,`${n.providerId}:${n.model}`)}const xh=[/haiku/i];function Sh(e){return xh.some(t=>t.test(e))}function Ch(e){return e.filter(e=>!Sh(e.id))}function wh(){let e=Q();if(e.length===0)return[];let t=new Map;for(let n of e){if(t.has(n.providerId))continue;let e=hh(n.providerId);if(e.hidden||oh(n.providerId))continue;let r=Ch(_h(n.providerId));if(r.length===0)continue;let i={providerId:n.providerId,providerName:e.name,models:r};t.set(n.providerId,i)}return[...t.values()]}function Q(){ch();let e=localStorage.getItem(nh);if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&typeof e.providerId==`string`&&typeof e.apiKey==`string`):[]}catch{return[]}}function Th(e){return se(localStorage)[e]??[]}function Eh(e,t){let n=se(localStorage),r=t.map(e=>e.trim()).filter(e=>e.length>0);r.length===0?delete n[e]:n[e]=r,ce(localStorage,n)}async function Dh(e,t){if(i()){Eh(e,t);return}let n=r();if(!n)throw Error(`setExtraOAuthDomainsAsync: no DOM and no panel-rpc client — cannot persist to page localStorage`);let{storeAfter:a}=await n.call(`oauth-extras-set`,{providerId:e,domains:t});try{ce(localStorage,a)}catch(t){Z.warn(`worker-shim mirror failed after successful page write — reload to refresh`,{providerId:e,error:t instanceof Error?t.message:String(t)})}}function Oh(){return se(localStorage)}function kh(e){localStorage.setItem(nh,JSON.stringify(e))}async function Ah(e){if(i()){kh(e);return}let t=r();if(!t)throw Error(`saveAccountsAsync: no DOM and no panel-rpc client — cannot persist to page localStorage`);let n=JSON.stringify(e),{storedJson:a}=await t.call(`save-oauth-accounts`,{accountsJson:n});try{localStorage.setItem(nh,a)}catch(e){Z.warn(`worker-shim mirror failed after successful page write — reload to refresh`,{error:e instanceof Error?e.message:String(e)})}}function jh(e,t,n,r,i){let a=Q().filter(t=>t.providerId!==e),o={providerId:e,apiKey:t};n&&(o.baseUrl=n),r&&(o.deployment=r),i&&(o.apiVersion=i),a.push(o),kh(a)}async function Mh(e){let t=le();try{if(t===`extension-direct`){let t=await new Promise(t=>{chrome.runtime.sendMessage({type:`secrets.delete`,name:`oauth.${e}.token`},n=>{chrome.runtime.lastError&&Z.error(`SW secrets.delete transport failed`,{providerId:e,error:chrome.runtime.lastError.message}),t(n??{})})});t.error&&Z.error(`SW secrets.delete returned error`,{providerId:e,error:t.error})}else if(t===`extension-delegate`){let t=await Rm(`secrets.delete`,{name:`oauth.${e}.token`});t?.error&&Z.error(`Bridge secrets.delete returned error`,{providerId:e,error:t.error})}else if(t!==`connect`){let t=await fetch(l(`/api/secrets/oauth/${e}`),{method:`DELETE`,headers:u()});!t.ok&&t.status!==404&&Z.warn(`OAuth replica DELETE non-ok`,{providerId:e,status:t.status})}}catch(n){Z.error(`OAuth replica removal failed`,{providerId:e,topology:t,error:n instanceof Error?n.message:String(n)})}}async function Nh(e){let t=Q().find(t=>t.providerId===e),n=hh(e);t&&n?.isOAuth&&await Ph(e),await Mh(e),await Ah(Q().filter(t=>t.providerId!==e));let r=localStorage.getItem(rh)??``,i=r.indexOf(`:`);i>0&&r.slice(0,i)===e&&localStorage.removeItem(rh)}async function Ph(e){let t=Q().find(t=>t.providerId===e);if(!t)return;let n=hh(e);if(n?.isOAuth){if(n.onOAuthLogout)try{await n.onOAuthLogout()}catch(t){Z.warn(`onOAuthLogout failed`,{providerId:e,error:t instanceof Error?t.message:String(t)})}if(n.getOAuthLogoutUrl){let r=n.getOAuthLogoutUrl(t);if(r){let{openIdpLogoutUrl:t}=await import(`./oauth-service-bKcyWLK0.js`);await t(r).catch(t=>{Z.warn(`IdP logout popup failed`,{providerId:e,error:t instanceof Error?t.message:String(t)})})}}await Ah(Q().map(t=>t.providerId===e?{providerId:t.providerId,apiKey:``,baseUrl:t.baseUrl,userName:t.userName,userAvatar:t.userAvatar,loggedOut:!0}:t)),await Mh(e)}}async function Fh(e,t={}){let n=Math.max(1,t.attempts??3),r=t.delayMs??150,i=t.sleep??(e=>new Promise(t=>setTimeout(t,e))),a;for(let t=0;t<n;t++){let o=await e();if(o.maskedValue)return{maskedValue:o.maskedValue};o.error&&(a=o.error),t<n-1&&await i(r)}return{lastError:a}}async function Ih(e,t,n){let r={providerId:e.providerId,accessToken:e.accessToken,domains:e.domains.join(`,`)},{maskedValue:i,lastError:a}=await Fh(()=>t.sendMaskRequest(r),n);if(!i){Z.error(`OAuth mask give-up: no masked value after retries`,{providerId:e.providerId,reason:a??`no error reported (cold SW or empty reply)`});return}let o=t.getAccounts(),s=o.find(t=>t.providerId===e.providerId);s&&(s.maskedValue=i,await t.saveAccounts(o))}async function Lh(e){let t=Q().find(t=>t.providerId===e.providerId),n=Q().filter(t=>t.providerId!==e.providerId);n.push({providerId:e.providerId,apiKey:``,accessToken:e.accessToken,refreshToken:e.refreshToken,tokenExpiresAt:e.tokenExpiresAt,userName:e.userName,userAvatar:e.userAvatar,baseUrl:e.baseUrl??t?.baseUrl}),await Ah(n);let r=hh(e.providerId)?.oauthTokenDomains??[],i=Th(e.providerId),a=new Set,o=[];for(let e of[...r,...i]){let t=e.toLowerCase();a.has(t)||(a.add(t),o.push(e))}if(o.length===0)return;let s=le();try{if(s===`extension-direct`)await Ih({providerId:e.providerId,accessToken:e.accessToken,domains:o},{sendMaskRequest:t=>new Promise(n=>{chrome.runtime.sendMessage({type:`secrets.mask-oauth-token`,...t},t=>{chrome.runtime.lastError&&Z.error(`SW mask-oauth-token transport failed`,{providerId:e.providerId,error:chrome.runtime.lastError.message});let r=typeof t==`object`&&t?t:void 0;r?.error&&Z.warn(`SW mask-oauth-token returned error`,{providerId:e.providerId,error:r.error}),n(r??{})})}),getAccounts:Q,saveAccounts:Ah});else if(s===`extension-delegate`)await Ih({providerId:e.providerId,accessToken:e.accessToken,domains:o},{sendMaskRequest:t=>Rm(`secrets.mask-oauth-token`,t).then(t=>(t?.error&&Z.warn(`Bridge mask-oauth-token returned error`,{providerId:e.providerId,error:t.error}),t??{})).catch(t=>(Z.error(`Bridge mask-oauth-token transport failed`,{providerId:e.providerId,error:t instanceof Error?t.message:String(t)}),{})),getAccounts:Q,saveAccounts:Ah});else if(s!==`connect`){let t=await fetch(l(`/api/secrets/oauth-update`),{method:`POST`,headers:u({"Content-Type":`application/json`}),body:JSON.stringify({providerId:e.providerId,accessToken:e.accessToken,domains:o})});if(t.ok){let n=await t.json();if(typeof n.maskedValue==`string`){let t=Q(),r=t.find(t=>t.providerId===e.providerId);r&&(r.maskedValue=n.maskedValue,await Ah(t))}else Z.warn(`OAuth replica POST ok but missing maskedValue`,{providerId:e.providerId})}else Z.warn(`OAuth replica POST non-ok`,{providerId:e.providerId,status:t.status})}}catch(t){Z.error(`OAuth replica sync failed`,{providerId:e.providerId,topology:s,error:t instanceof Error?t.message:String(t)})}}function Rh(e){let t=Q().find(t=>t.providerId===e);return t&&(t.accessToken||t.apiKey)||null}function zh(e){let t=Q().find(t=>t.providerId===e);return t?t.accessToken||t.apiKey||(hh(e).optionalApiKey?`local`:null):null}function Bh(e){return Q().find(t=>t.providerId===e)?.baseUrl??null}function Vh(e){return Q().find(t=>t.providerId===e)?.deployment??null}function Hh(e){return Q().find(t=>t.providerId===e)?.apiVersion??null}function Uh(){let e=localStorage.getItem(rh)||``,t=e.indexOf(`:`);return t>=0?e.slice(t+1):e}function Wh(e){let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t),r=new Set([...a(),...fh()]),i=n.includes(`.`);if(r.has(n)||!i){localStorage.setItem(rh,e);return}}let n=$();localStorage.setItem(rh,`${n}:${e}`)}function Gh(){return localStorage.getItem(rh)||``}function $(){let e=Gh(),t=e.indexOf(`:`);if(t>0)return e.slice(0,t);let n=Q(),r=Uh();if(r){let e=n.find(e=>ph(e.providerId)&&mh(e.providerId,r));if(e)return e.providerId}let i=n.find(e=>ph(e.providerId));return i?i.providerId:n.length>0?n[0].providerId:`anthropic`}function Kh(e){let t=Uh();localStorage.setItem(rh,`${e}:${t}`)}function qh(){let e=Uh();localStorage.setItem(rh,e)}function Jh(){return zh($())}function Yh(e){let t=$();jh(t,e,Bh(t)??void 0)}async function Xh(){await Nh($())}function Zh(){return Bh($())}function Qh(e){let t=$(),n=Rh(t);n&&jh(t,n,e||void 0)}function $h(){let e=$(),t=Rh(e);t&&jh(e,t)}function eg(){let e=Q(),t=$(),n=Uh();return e.map(e=>{let r={providerId:e.providerId,apiKey:e.apiKey};return e.baseUrl&&(r.baseUrl=e.baseUrl),e.providerId===t&&n&&(r.model=n),r})}async function tg(){let e=Q();await Promise.allSettled(e.map(e=>Nh(e.providerId))),localStorage.removeItem(nh),localStorage.removeItem(rh);for(let e of ih)localStorage.removeItem(e)}function ng(e){return/^(?:gpt[-.]?|o[0-9]|chatgpt)/i.test(e)?`openai`:`anthropic`}function rg(e,t,n,r){return{id:t,name:t,provider:e,api:r??`${e}-${ng(t)}`,baseUrl:n??``,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},reasoning:!0}}function ig(e,t){return t.isOAuth||e===`azure-ai-foundry`?`anthropic`:e===`bedrock-camp`?`amazon-bedrock`:e}function ag(e){if(!e)return og();let t=$(),n=Bh(t),r=hh(t);try{let i=ig(t,r),a=eh(i,e);if(!a?.id)throw Error(`Model ${e} not found`);let o=a;return r.isOAuth?o=_h(t).find(t=>t.id===e)||{...o,api:`${t}-anthropic`,provider:t}:t===`bedrock-camp`&&(o={...o,api:`bedrock-camp-converse`,provider:`bedrock-camp`}),n&&(o={...o,baseUrl:n}),o}catch(i){if(Z.debug(`resolveModelById: pi-ai lookup miss, using provider fallback`,{providerId:t,modelId:e,error:i instanceof Error?i.message:String(i)}),r.isOAuth){let r=_h(t).find(t=>t.id===e);return r?n?{...r,baseUrl:n}:r:rg(t,e,n)}return og()}}function og(){let e=$(),t=Uh(),n=Bh(e),r=_h(e),i=hh(e),a=i.defaultModelId?r.find(e=>e.id.toLowerCase().includes(i.defaultModelId.toLowerCase()))?.id:void 0,o=t||a||r[0]?.id||`claude-sonnet-4-6`;try{let t=ig(e,i),a=eh(t,o);if(!a?.id)throw Error(`Model ${o} not found in ${t} registry`);let s=a;return i.isOAuth?s=r.find(e=>e.id===o)||{...s,api:`${e}-anthropic`,provider:e}:e===`bedrock-camp`&&(s={...s,api:`bedrock-camp-converse`,provider:`bedrock-camp`}),n&&(s={...s,baseUrl:n}),s}catch(t){Z.debug(`resolveCurrentModel: pi-ai lookup miss, using provider fallback`,{providerId:e,effectiveModelId:o,error:t instanceof Error?t.message:String(t)});let a=r.find(e=>e.id===o);return a?n?{...a,baseUrl:n}:a:i.isOAuth?rg(e,o,n):eh(`anthropic`,`claude-sonnet-4-0`)}}function sg(e){let t=e.toLowerCase();if(!t)return null;let n=null;try{n=$()}catch{}if(n!==null){let e=cg(t,[n]);if(e!==null)return e}return cg(t,Q().map(e=>e.providerId))}function cg(e,t){let n=null,r=-1;for(let i of t)for(let t of _h(i)){let i=t.id.toLowerCase(),a=(t.name??``).toLowerCase();if(!i.includes(e)&&!a.includes(e))continue;let o=t.contextWindow??0;(o>r||o===r&&ug(t.id,n??``)>0)&&(r=o,n=t.id)}return n}function lg(e){if(!e)return null;let t=[e],n=sg(e);n!==null&&n!==e&&t.push(n);let r=[];try{r=_h($())}catch{}for(let n of t)if(!(r.length>0&&!r.some(e=>e.id===n)))try{if(ag(n).id===n)return n}catch(t){Z.debug(`resolveModelIdForScoop: candidate did not resolve`,{input:e,candidate:n,error:t instanceof Error?t.message:String(t)})}return null}function ug(e,t){let n=e.match(/\d+/g)?.map(Number)??[],r=t.match(/\d+/g)?.map(Number)??[],i=Math.max(n.length,r.length);for(let e=0;e<i;e++){let t=(n[e]??0)-(r[e]??0);if(t!==0)return t}return 0}export{cf as $,lt as $t,Fh as A,Qe as An,P as At,Yh as B,ln as Bt,hh as C,Pe as Cn,dr as Ct,$ as D,Le as Dn,ir as Dt,Uh as E,Ie as En,ar as Et,og as F,ue as Fn,M as Ft,Kh as G,Jt as Gt,Eh as H,rn as Ht,ag as I,le as In,j as It,Vm as J,Pt as Jt,Qm as K,Yt as Kt,sg as L,A as Lt,Ih as M,w as Mn,wn as Mt,ph as N,tt as Nn,xn as Nt,Sh as O,Re as On,jn as Ot,Nh as P,Te as Pn,N as Pt,pf as Q,ft as Qt,lg as R,hn as Rt,vh as S,We as Sn,pr as St,Rh as T,b as Tn,sr as Tt,Dh as U,en as Ut,Qh as V,sn as Vt,Wh as W,Zt as Wt,Im as X,Ct as Xt,Rm as Y,Dt as Yt,Sm as Z,pt as Zt,fh as _,Ne as _n,vr as _t,bh as a,Ee as an,Yi as at,Vh as b,Je as bn,xr as bt,$h as c,ke as cn,z as ct,Q as d,at as dn,Ar as dt,et as en,ld as et,wh as f,x as fn,kr as ft,Hh as g,Me as gn,R as gt,zh as h,Be as hn,Cr as ht,jh as i,C as in,ea as it,lh as j,Ke as jn,Dn as jt,Ph as k,ze as kn,An as kt,qh as l,Ge as ln,ei as lt,Jh as m,Ue as mn,Er as mt,dh as n,Xe as nn,uo as nt,tg as o,De as on,Ki as ot,Oh as p,je as pn,Or as pt,Xm as q,Ht as qt,$m as r,Ze as rn,ta as rt,Xh as s,Oe as sn,Ji as st,nh as t,$e as tn,oc as tt,eg as u,Ae as un,qr as ut,Zh as v,He as vn,yr as vt,_h as w,Fe as wn,cr as wt,Th as x,Ye as xn,L as xt,Bh as y,Ve as yn,br as yt,Lh as z,un as zt};
@@ -0,0 +1 @@
1
+ import{n as e}from"./panel-rpc-CjFVE0nK.js";import{K as t,d as n,y as r,z as i}from"./account-store-Uj6VFvmJ.js";import{n as a}from"./event-stream-qbAZIAKV.js";import{a as o,d as s,f as c,i as l,o as u,p as d,s as f}from"./bedrock-camp-DS0ilb3O.js";import{a as p,r as m,s as h,t as g}from"./legacy-api-aliases-YuuBU-he.js";import{n as _}from"./llm-session-id-ZObKEXzb.js";import{n as v,t as ee}from"./silent-renew-backoff-Chq7fPuc.js";import{getOAuthPageOrigin as te}from"./oauth-service-bKcyWLK0.js";import"./provider-settings-VxXaQXu5.js";var ne={proxyEndpoint:`https://adobe-llm-proxy.paolo-moz.workers.dev`,redirectUri:`https://www.sliccy.ai/auth/callback`,extensionRedirectUri:`https://akjjllgokmbgpbdbmafpiefnhidlmbgf.chromiumapp.org/adobe`};function re(e,t){return o(e,t)}function y(e,t,n){return e!==`xhigh`||!t?e:f(t,n)?`xhigh`:u(t,n)?`max`:`high`}function ie(e,t){let n=e?t?.thinkingLevelMap?.[e]:void 0;return y((()=>{if(typeof n==`string`)return n;switch(e){case`minimal`:case`low`:return`low`;case`medium`:return`medium`;case`xhigh`:return`xhigh`;default:return`high`}})(),t?.id,t?.name)}function ae(e,t){return async(n,r)=>{let i=t?await t(n,r)??n:n,a=i.thinking;return a&&a.type===`enabled`&&(i.thinking={type:`adaptive`,...a.display===void 0?{}:{display:a.display}},i.output_config={...i.output_config??{},effort:e}),i}}function b(e,t){if(!re(e.id,e.name))return t;let n=t,r=y(n.effort??ie(n.reasoning,e),e.id,e.name);return{...t,onPayload:ae(r,n.onPayload)}}function oe(e,t){let n={id:e.id,name:e.name??e.id},r=t?.api??e.api,i=t?.context_window??e.context_window,a=t?.max_tokens??e.max_tokens,o=t?.reasoning??e.reasoning,s=t?.input??e.input;r&&(n.api=r),i!==void 0&&(n.context_window=i),a!==void 0&&(n.max_tokens=a),o!==void 0&&(n.reasoning=o),s&&(n.input=s);let c=t?.cost??e.cost;return c&&(n.cost=c),/haiku/i.test(e.id)&&(n.compat={supportsEagerToolInputStreaming:!1}),/sonnet-5\b/i.test(e.id)&&!n.thinkingLevelMap&&(n.thinkingLevelMap={xhigh:`xhigh`}),n}const x=Object.assign({"/packages/webapp/providers/adobe-config.json":ne})[`/packages/webapp/providers/adobe-config.json`]??{clientId:``,proxyEndpoint:``,scopes:`openid,profile,email`};function S(){let e=r(`adobe`);if(e)return e.replace(/\/$/,``);if(x.proxyEndpoint)return x.proxyEndpoint.replace(/\/$/,``);throw Error(`Adobe proxy endpoint not configured — set it in Settings or adobe-config.json`)}const C=new Map,w=new Map,T=`slicc-adobe-models`;function E(e){try{localStorage.setItem(T,JSON.stringify(e))}catch{}}async function D(e){let t=C.get(e);if(t)return t;try{let t=await fetch(`${e}/v1/config`,{headers:{[W]:`6.3.0`}});if(t.ok){let n=await t.json();return C.set(e,n),n}console.warn(`[adobe] Proxy /v1/config returned ${t.status}, falling back to build-time config`)}catch(e){console.warn(`[adobe] Failed to fetch proxy config:`,e instanceof Error?e.message:String(e))}return{}}function O(e){let t=e.clientId||x.clientId;if(!t)throw Error(`Could not determine IMS client ID — proxy /v1/config did not return one and adobe-config.json is empty`);return t}function k(e){return e.scopes||x.scopes}function A(e){return e.imsEnvironment||x.imsEnvironment||`prod`}const j={prod:`https://ims-na1.adobelogin.com`,stg1:`https://ims-na1-stg1.adobelogin.com`};function M(e){return j[e??x.imsEnvironment??`prod`]??j.prod}const N=typeof chrome<`u`&&!!chrome?.runtime?.id;function P(){return n().find(e=>e.providerId===`adobe`)}async function se(e,t){try{let n=await fetch(`${M(t)}/ims/userinfo/v2`,{headers:{Authorization:`Bearer ${e}`}});if(n.ok){let e=await n.json();return{name:e.displayName||e.name||e.email,avatar:e.picture||e.avatar_url}}console.warn(`[adobe] User profile fetch returned ${n.status}, account will have no display name`)}catch(e){console.warn(`[adobe] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function F(e){let t=e.indexOf(`#`);if(t<0)return null;let n=new URLSearchParams(e.slice(t+1)),r=n.get(`access_token`);return r?{accessToken:r,expiresIn:parseInt(n.get(`expires_in`)??`86400`,10)}:null}const I={id:`adobe`,name:`Adobe`,description:`Claude via Adobe — login with your Adobe ID`,requiresApiKey:!1,requiresBaseUrl:!x.proxyEndpoint,baseUrlPlaceholder:`https://your-proxy.example.com`,baseUrlDescription:`Anthropic-compatible proxy endpoint`,isOAuth:!0,defaultModelId:`sonnet`,oauthTokenDomains:[`ims-na1.adobelogin.com`,`ims-na1-stg1.adobelogin.com`,`*.adobelogin.com`,`*.adobe.io`,`firefall.adobe.io`,`admin.hlx.page`,`admin.hlx.live`,`admin.aem.page`,`admin.aem.live`],getModelIds:()=>{let e=e=>oe(e,w.get(e.id));for(let t of Q.values())if(t.length){let n=t.map(t=>e({id:t.id,name:t.name??t.id,reasoning:t.reasoning,input:t.input,cost:t.cost}));return E(n),n}for(let t of C.values())if(t.models?.length)return t.models.map(t=>e(t));try{let e=localStorage.getItem(T);if(e){let t=JSON.parse(e);if(t.length)return t}}catch{}return[{id:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`}]},onOAuthLogin:async(e,t,n)=>{let r=S(),a=await D(r),o=O(a),s=k(a),c=A(a),l=N?null:await te(),u=N?null:v({pageHref:l.href,pageOrigin:l.origin,configuredRedirectUri:x.redirectUri},()=>crypto.randomUUID()),d=N?x.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:u.redirectUri,f=u?.oauthState,p=u?.expectedNonce??null,m=new URLSearchParams({client_id:o,scope:s,response_type:`token`,redirect_uri:d});f&&m.set(`state`,f),n?.forceReauth&&m.set(`prompt`,`login`);let h=await e(`${M(c)}/ims/authorize/v2?${m}`);if(!h)return;if(p&&h)try{if(new URL(h).searchParams.get(`nonce`)!==p){console.error(`[adobe] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let g=F(h);if(!g){console.error(`[adobe] Could not extract token from redirect URL`);return}let _=await se(g.accessToken,c);await i({providerId:`adobe`,accessToken:g.accessToken,tokenExpiresAt:Date.now()+g.expiresIn*1e3,userName:_.name,userAvatar:_.avatar,baseUrl:x.proxyEndpoint?void 0:r}),await $().catch(e=>console.warn(`[adobe] Failed to fetch models after login:`,e instanceof Error?e.message:String(e))),t()},onOAuthLogout:async()=>{let e=P();if(e?.accessToken)try{let t=C.values().next().value??{},n=t.clientId||x.clientId,r=A(t);if(n){let t=await fetch(`${M(r)}/ims/revoke`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:e.accessToken,token_type_hint:`access_token`,client_id:n})});t.ok||console.warn(`[adobe] Token revocation returned ${t.status}, token may still be valid server-side`)}}catch(e){console.warn(`[adobe] Failed to revoke token:`,e instanceof Error?e.message:String(e))}await i({providerId:`adobe`,accessToken:``})},onSilentRenew:async()=>P()?.accessToken?z():null,refreshModels:async e=>{await $(e);let t=I.getModelIds?.();t?.length&&E(t)}};let L=null;const ce=ee();async function R(){let e=P();if(!e?.accessToken)throw Error(`Not logged in to Adobe — please log in first`);if((e.tokenExpiresAt??0)-Date.now()>6e4)return e.accessToken;console.log(`[adobe] Token expired or expiring soon, attempting silent renewal...`);let t=await ce.run(()=>z());if(t)return t;let n=P();if((n?.tokenExpiresAt??0)-Date.now()>0&&n?.accessToken)return n.accessToken;throw Error(`Adobe session expired — please log in again`)}function le(){let e=P();return!e?.tokenExpiresAt||Date.now()>e.tokenExpiresAt-6e4}async function z(){if(typeof window>`u`){let t=e();if(!t)return null;try{let{accessToken:e}=await t.call(`silent-renew`,{providerId:`adobe`},{timeoutMs:13e4});return e}catch(e){return console.warn(`[adobe] worker→page silent-renew bridge failed:`,e instanceof Error?e.message:String(e)),null}}return L||(L=U().finally(()=>{L=null}),L)}function B(e,t){let n=O(t),r=k(t),i=A(t),a=N?null:v({pageHref:window.location.href,pageOrigin:window.location.origin,configuredRedirectUri:x.redirectUri},()=>crypto.randomUUID()),o=N?x.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:a.redirectUri,s=a?.oauthState,c=a?.expectedNonce??null,l=new URLSearchParams({client_id:n,scope:r,response_type:`token`,redirect_uri:o,prompt:`none`});return s&&l.set(`state`,s),{authorizeUrl:`${M(i)}/ims/authorize/v2?${l}`,expectedNonce:c,proxyEndpoint:e}}function V(e,t){if(!t)return!0;try{if(new URL(e).searchParams.get(`nonce`)!==t)return console.error(`[adobe] OAuth nonce mismatch — possible CSRF`),!1}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}return!0}async function H(e,t){let n=P();await i({providerId:`adobe`,accessToken:e.accessToken,tokenExpiresAt:Date.now()+e.expiresIn*1e3,userName:n?.userName,userAvatar:n?.userAvatar,baseUrl:x.proxyEndpoint?void 0:t})}async function U(){try{let e=S(),{authorizeUrl:t,expectedNonce:n}=B(e,await D(e)),{createOAuthLauncher:r}=await import(`./oauth-service-bKcyWLK0.js`),i=await r()(t,{interactive:!1});if(!i||!V(i,n))return null;let a=F(i);return a?(await H(a,e),console.log(`[adobe] Token renewed silently`),await $().catch(e=>console.warn(`[adobe] Failed to refresh models after silent renewal:`,e instanceof Error?e.message:String(e))),a.accessToken):null}catch(e){return console.warn(`[adobe] Silent renewal error:`,e instanceof Error?e.message:String(e)),null}}const W=`X-Slicc-Version`;function G(e){let t={};if(e.headers)for(let[n,r]of Object.entries(e.headers))n.toLowerCase()!==`x-slicc-version`&&(t[n]=r);return t[W]=`6.3.0`,{...e,headers:t}}const K=new Set;function q(e,t){if(e.headers){for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()===`x-session-id`&&n!=null)return e}return K.has(t)||(K.add(t),console.warn(`[adobe] Missing X-Session-Id from ${t} — using daily fallback. Attach an X-Session-Id header at the call site (see scoop-context.ts streamWithSessionId or docs/pitfalls.md).`)),{...e,headers:{...e.headers??{},"X-Session-Id":_(`adobe-provider-fallback`)}}}function ue(){K.clear()}function J(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:`adobe-anthropic`,provider:`adobe`,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}const Y=(e,t,n={})=>{let r=a();return(async()=>{try{let i=await R();if(String(e.api).includes(`openai`)){let a=m({...e,baseUrl:`${S()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},t,G(q({...n,apiKey:i},`streamAdobe[openai]`)));for await(let e of a)r.push(e)}else{let a=g({...e,baseUrl:S(),api:`anthropic-messages`},t,G(q(b(e,l(e.id,e.name,{...n,apiKey:i})),`streamAdobe[anthropic]`)));for await(let e of a)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(J(e,t)),r.end()}})(),r},X=(e,t,n)=>{let r=a();return(async()=>{try{let i=await R();if(String(e.api).includes(`openai`)){let a=h({...e,baseUrl:`${S()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},t,G(q({...n,apiKey:i},`streamSimpleAdobe[openai]`)));for await(let e of a)r.push(e)}else{let a=p({...e,baseUrl:S(),api:`anthropic-messages`},t,G(q(b(e,l(e.id,e.name,{...n,apiKey:i})),`streamSimpleAdobe[anthropic]`)));for await(let e of a)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(J(e,t)),r.end()}})(),r};function Z(e){let t={id:e.id,name:e.name};return e.api!==void 0&&(t.api=e.api),e.context_window!==void 0&&(t.context_window=e.context_window),e.max_tokens!==void 0&&(t.max_tokens=e.max_tokens),e.reasoning!==void 0&&(t.reasoning=e.reasoning),e.input!==void 0&&(t.input=e.input),t}function de(){let e=new Map;for(let t of c())try{for(let n of s(t))e.set(n.id,n)}catch{}return e}function fe(e,n,r){let i=`adobe-${e.api===`openai`?`openai`:`anthropic`}`,a=r.get(e.id);if(a)return{...a,provider:`adobe`,api:i};let o=t(e.id,r);return{id:e.id,name:e.name??e.id,provider:`adobe`,api:i,baseUrl:n,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:o,inputCost:o.input,outputCost:o.output,cacheReadCost:o.cacheRead,cacheWriteCost:o.cacheWrite,reasoning:!0}}function pe(e,t){for(let t of e)w.set(t.id,Z(t));let n=de();return e.map(e=>fe(e,t,n))}async function me(e){try{let t=e??await R(),n=S(),r=await fetch(`${n}/v1/models`,{headers:{Authorization:`Bearer ${t}`,[W]:`6.3.0`}});if(!r.ok)console.warn(`[adobe] Proxy /v1/models returned ${r.status}, falling back to Anthropic models`);else{let e=await r.json();if(e.data?.length)return pe(e.data,n)}}catch(e){console.warn(`[adobe] Failed to fetch proxy models:`,e instanceof Error?e.message:String(e))}return null}const Q=new Map;function he(){return s(`anthropic`).map(e=>({...e,provider:`adobe`,api:`adobe-anthropic`}))}async function $(e){let t=S(),n=Q.get(t);if(n)return n;let r=await me(e);return r?(Q.set(t,r),r):he()}function ge(){d({api:`adobe-anthropic`,stream:Y,streamSimple:X}),d({api:`adobe-openai`,stream:Y,streamSimple:X})}export{ue as __resetAdobeSessionIdWarningCacheForTests,I as config,$ as getAdobeModels,R as getValidAccessToken,le as isTokenExpired,ge as register};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/oauth-service-Dk3L2UWh.js","assets/preload-helper-Czpn1I53.js","assets/proxied-fetch-CfcFb0B0.js","assets/rolldown-runtime-aKtaBQYM.js","assets/base64-DpPqYZJF.js","assets/src-DoFhVmQT.js","assets/runtime-env-DH4NDw4t.js","assets/fetch-body-D2PwksUW.js","assets/panel-rpc-DmJSNs0I.js","assets/wc-permissions-registry-Blyunq37.js"])))=>i.map(i=>d[i]);
2
- import{K as e,d as t,y as n,z as r}from"./account-store-BnUIIjUC.js";import{n as i}from"./event-stream-qbAZIAKV.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{a as o,i as s,r as c}from"./compat-CkpNnFQS.js";import{a as l,r as u,s as d,t as f}from"./legacy-api-aliases-BWm3gxUe.js";import{t as p}from"./panel-rpc-DmJSNs0I.js";import{a as m,i as h,o as g,s as _}from"./bedrock-camp-CJY4i7di.js";import"./provider-settings-BXwbB8RF.js";import{n as v,t as ee}from"./silent-renew-backoff-CqD4WRin.js";import{getOAuthPageOrigin as te}from"./oauth-service-Dk3L2UWh.js";import{t as ne}from"./llm-session-id-bZQs6gBN.js";var re={proxyEndpoint:`https://adobe-llm-proxy.paolo-moz.workers.dev`,redirectUri:`https://www.sliccy.ai/auth/callback`,extensionRedirectUri:`https://akjjllgokmbgpbdbmafpiefnhidlmbgf.chromiumapp.org/adobe`};function y(e,t){return m(e,t)}function b(e,t,n){return e!==`xhigh`||!t?e:_(t,n)?`xhigh`:g(t,n)?`max`:`high`}function ie(e,t){let n=e?t?.thinkingLevelMap?.[e]:void 0;return b((()=>{if(typeof n==`string`)return n;switch(e){case`minimal`:case`low`:return`low`;case`medium`:return`medium`;case`xhigh`:return`xhigh`;default:return`high`}})(),t?.id,t?.name)}function ae(e,t){return async(n,r)=>{let i=t?await t(n,r)??n:n,a=i.thinking;return a&&a.type===`enabled`&&(i.thinking={type:`adaptive`,...a.display===void 0?{}:{display:a.display}},i.output_config={...i.output_config??{},effort:e}),i}}function x(e,t){if(!y(e.id,e.name))return t;let n=t,r=b(n.effort??ie(n.reasoning,e),e.id,e.name);return{...t,onPayload:ae(r,n.onPayload)}}function oe(e,t){let n={id:e.id,name:e.name??e.id},r=t?.api??e.api,i=t?.context_window??e.context_window,a=t?.max_tokens??e.max_tokens,o=t?.reasoning??e.reasoning,s=t?.input??e.input;r&&(n.api=r),i!==void 0&&(n.context_window=i),a!==void 0&&(n.max_tokens=a),o!==void 0&&(n.reasoning=o),s&&(n.input=s);let c=t?.cost??e.cost;return c&&(n.cost=c),/haiku/i.test(e.id)&&(n.compat={supportsEagerToolInputStreaming:!1}),/sonnet-5\b/i.test(e.id)&&!n.thinkingLevelMap&&(n.thinkingLevelMap={xhigh:`xhigh`}),n}var S=Object.assign({"/packages/webapp/providers/adobe-config.json":re})[`/packages/webapp/providers/adobe-config.json`]??{clientId:``,proxyEndpoint:``,scopes:`openid,profile,email`};function C(){let e=n(`adobe`);if(e)return e.replace(/\/$/,``);if(S.proxyEndpoint)return S.proxyEndpoint.replace(/\/$/,``);throw Error(`Adobe proxy endpoint not configured — set it in Settings or adobe-config.json`)}var w=new Map,T=new Map,E=`slicc-adobe-models`;function D(e){try{localStorage.setItem(E,JSON.stringify(e))}catch{}}async function O(e){let t=w.get(e);if(t)return t;try{let t=await fetch(`${e}/v1/config`,{headers:{[W]:`6.1.0`}});if(t.ok){let n=await t.json();return w.set(e,n),n}console.warn(`[adobe] Proxy /v1/config returned ${t.status}, falling back to build-time config`)}catch(e){console.warn(`[adobe] Failed to fetch proxy config:`,e instanceof Error?e.message:String(e))}return{}}function k(e){let t=e.clientId||S.clientId;if(!t)throw Error(`Could not determine IMS client ID — proxy /v1/config did not return one and adobe-config.json is empty`);return t}function A(e){return e.scopes||S.scopes}function j(e){return e.imsEnvironment||S.imsEnvironment||`prod`}var M={prod:`https://ims-na1.adobelogin.com`,stg1:`https://ims-na1-stg1.adobelogin.com`};function N(e){return M[e??S.imsEnvironment??`prod`]??M.prod}var P=typeof chrome<`u`&&!!chrome?.runtime?.id;function F(){return t().find(e=>e.providerId===`adobe`)}async function se(e,t){try{let n=await fetch(`${N(t)}/ims/userinfo/v2`,{headers:{Authorization:`Bearer ${e}`}});if(n.ok){let e=await n.json();return{name:e.displayName||e.name||e.email,avatar:e.picture||e.avatar_url}}console.warn(`[adobe] User profile fetch returned ${n.status}, account will have no display name`)}catch(e){console.warn(`[adobe] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function I(e){let t=e.indexOf(`#`);if(t<0)return null;let n=new URLSearchParams(e.slice(t+1)),r=n.get(`access_token`);return r?{accessToken:r,expiresIn:parseInt(n.get(`expires_in`)??`86400`,10)}:null}var L={id:`adobe`,name:`Adobe`,description:`Claude via Adobe — login with your Adobe ID`,requiresApiKey:!1,requiresBaseUrl:!S.proxyEndpoint,baseUrlPlaceholder:`https://your-proxy.example.com`,baseUrlDescription:`Anthropic-compatible proxy endpoint`,isOAuth:!0,defaultModelId:`sonnet`,oauthTokenDomains:[`ims-na1.adobelogin.com`,`ims-na1-stg1.adobelogin.com`,`*.adobelogin.com`,`*.adobe.io`,`firefall.adobe.io`,`admin.hlx.page`,`admin.hlx.live`,`admin.aem.page`,`admin.aem.live`],getModelIds:()=>{let e=e=>oe(e,T.get(e.id));for(let t of Q.values())if(t.length){let n=t.map(t=>e({id:t.id,name:t.name??t.id,reasoning:t.reasoning,input:t.input,cost:t.cost}));return D(n),n}for(let t of w.values())if(t.models?.length)return t.models.map(t=>e(t));try{let e=localStorage.getItem(E);if(e){let t=JSON.parse(e);if(t.length)return t}}catch{}return[{id:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`}]},onOAuthLogin:async(e,t,n)=>{let i=C(),a=await O(i),o=k(a),s=A(a),c=j(a),l=P?null:await te(),u=P?null:v({pageHref:l.href,pageOrigin:l.origin,configuredRedirectUri:S.redirectUri},()=>crypto.randomUUID()),d=P?S.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:u.redirectUri,f=u?.oauthState,p=u?.expectedNonce??null,m=new URLSearchParams({client_id:o,scope:s,response_type:`token`,redirect_uri:d});f&&m.set(`state`,f),n?.forceReauth&&m.set(`prompt`,`login`);let h=await e(`${N(c)}/ims/authorize/v2?${m}`);if(!h)return;if(p&&h)try{if(new URL(h).searchParams.get(`nonce`)!==p){console.error(`[adobe] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let g=I(h);if(!g){console.error(`[adobe] Could not extract token from redirect URL`);return}let _=await se(g.accessToken,c);await r({providerId:`adobe`,accessToken:g.accessToken,tokenExpiresAt:Date.now()+g.expiresIn*1e3,userName:_.name,userAvatar:_.avatar,baseUrl:S.proxyEndpoint?void 0:i}),await $().catch(e=>console.warn(`[adobe] Failed to fetch models after login:`,e instanceof Error?e.message:String(e))),t()},onOAuthLogout:async()=>{let e=F();if(e?.accessToken)try{let t=w.values().next().value??{},n=t.clientId||S.clientId,r=j(t);if(n){let t=await fetch(`${N(r)}/ims/revoke`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:e.accessToken,token_type_hint:`access_token`,client_id:n})});t.ok||console.warn(`[adobe] Token revocation returned ${t.status}, token may still be valid server-side`)}}catch(e){console.warn(`[adobe] Failed to revoke token:`,e instanceof Error?e.message:String(e))}await r({providerId:`adobe`,accessToken:``})},onSilentRenew:async()=>F()?.accessToken?B():null,refreshModels:async e=>{await $(e);let t=L.getModelIds?.();t?.length&&D(t)}},R=null,ce=ee();async function z(){let e=F();if(!e?.accessToken)throw Error(`Not logged in to Adobe — please log in first`);if((e.tokenExpiresAt??0)-Date.now()>6e4)return e.accessToken;console.log(`[adobe] Token expired or expiring soon, attempting silent renewal...`);let t=await ce.run(()=>B());if(t)return t;let n=F();if((n?.tokenExpiresAt??0)-Date.now()>0&&n?.accessToken)return n.accessToken;throw Error(`Adobe session expired — please log in again`)}function le(){let e=F();return!e?.tokenExpiresAt||Date.now()>e.tokenExpiresAt-6e4}async function B(){if(typeof window>`u`){let e=p();if(!e)return null;try{let{accessToken:t}=await e.call(`silent-renew`,{providerId:`adobe`},{timeoutMs:13e4});return t}catch(e){return console.warn(`[adobe] worker→page silent-renew bridge failed:`,e instanceof Error?e.message:String(e)),null}}return R||(R=ue().finally(()=>{R=null}),R)}function V(e,t){let n=k(t),r=A(t),i=j(t),a=P?null:v({pageHref:window.location.href,pageOrigin:window.location.origin,configuredRedirectUri:S.redirectUri},()=>crypto.randomUUID()),o=P?S.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:a.redirectUri,s=a?.oauthState,c=a?.expectedNonce??null,l=new URLSearchParams({client_id:n,scope:r,response_type:`token`,redirect_uri:o,prompt:`none`});return s&&l.set(`state`,s),{authorizeUrl:`${N(i)}/ims/authorize/v2?${l}`,expectedNonce:c,proxyEndpoint:e}}function H(e,t){if(!t)return!0;try{if(new URL(e).searchParams.get(`nonce`)!==t)return console.error(`[adobe] OAuth nonce mismatch — possible CSRF`),!1}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}return!0}async function U(e,t){let n=F();await r({providerId:`adobe`,accessToken:e.accessToken,tokenExpiresAt:Date.now()+e.expiresIn*1e3,userName:n?.userName,userAvatar:n?.userAvatar,baseUrl:S.proxyEndpoint?void 0:t})}async function ue(){try{let e=C(),{authorizeUrl:t,expectedNonce:n}=V(e,await O(e)),{createOAuthLauncher:r}=await a(async()=>{let{createOAuthLauncher:e}=await import(`./oauth-service-Dk3L2UWh.js`);return{createOAuthLauncher:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),i=await r()(t,{interactive:!1});if(!i||!H(i,n))return null;let o=I(i);return o?(await U(o,e),console.log(`[adobe] Token renewed silently`),await $().catch(e=>console.warn(`[adobe] Failed to refresh models after silent renewal:`,e instanceof Error?e.message:String(e))),o.accessToken):null}catch(e){return console.warn(`[adobe] Silent renewal error:`,e instanceof Error?e.message:String(e)),null}}var W=`X-Slicc-Version`;function G(e){let t={},n=W.toLowerCase();if(e.headers)for(let[r,i]of Object.entries(e.headers))r.toLowerCase()!==n&&(t[r]=i);return t[W]=`6.1.0`,{...e,headers:t}}var de=`adobe-provider-fallback`,K=new Set;function q(e,t){if(e.headers){for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()===`x-session-id`&&n!=null)return e}return K.has(t)||(K.add(t),console.warn(`[adobe] Missing X-Session-Id from ${t} — using daily fallback. Attach an X-Session-Id header at the call site (see scoop-context.ts streamWithSessionId or docs/pitfalls.md).`)),{...e,headers:{...e.headers??{},"X-Session-Id":ne(de)}}}function fe(){K.clear()}function J(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:`adobe-anthropic`,provider:`adobe`,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}var Y=(e,t,n={})=>{let r=i();return(async()=>{try{let i=await z();if(String(e.api).includes(`openai`)){let a=u({...e,baseUrl:`${C()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},t,G(q({...n,apiKey:i},`streamAdobe[openai]`)));for await(let e of a)r.push(e)}else{let a=f({...e,baseUrl:C(),api:`anthropic-messages`},t,G(q(x(e,h(e.id,e.name,{...n,apiKey:i})),`streamAdobe[anthropic]`)));for await(let e of a)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(J(e,t)),r.end()}})(),r},X=(e,t,n)=>{let r=i();return(async()=>{try{let i=await z();if(String(e.api).includes(`openai`)){let a=d({...e,baseUrl:`${C()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},t,G(q({...n,apiKey:i},`streamSimpleAdobe[openai]`)));for await(let e of a)r.push(e)}else{let a=l({...e,baseUrl:C(),api:`anthropic-messages`},t,G(q(x(e,h(e.id,e.name,{...n,apiKey:i})),`streamSimpleAdobe[anthropic]`)));for await(let e of a)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(J(e,t)),r.end()}})(),r};function pe(e){let t={id:e.id,name:e.name};return e.api!==void 0&&(t.api=e.api),e.context_window!==void 0&&(t.context_window=e.context_window),e.max_tokens!==void 0&&(t.max_tokens=e.max_tokens),e.reasoning!==void 0&&(t.reasoning=e.reasoning),e.input!==void 0&&(t.input=e.input),t}function me(){let e=new Map;for(let t of s())try{for(let n of c(t))e.set(n.id,n)}catch{}return e}function he(t,n,r){let i=`adobe-${t.api===`openai`?`openai`:`anthropic`}`,a=r.get(t.id);if(a)return{...a,provider:`adobe`,api:i};let o=e(t.id,r);return{id:t.id,name:t.name??t.id,provider:`adobe`,api:i,baseUrl:n,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:o,inputCost:o.input,outputCost:o.output,cacheReadCost:o.cacheRead,cacheWriteCost:o.cacheWrite,reasoning:!0}}function ge(e,t){for(let t of e)T.set(t.id,pe(t));let n=me();return e.map(e=>he(e,t,n))}async function Z(e){try{let t=e??await z(),n=C(),r=await fetch(`${n}/v1/models`,{headers:{Authorization:`Bearer ${t}`,[W]:`6.1.0`}});if(!r.ok)console.warn(`[adobe] Proxy /v1/models returned ${r.status}, falling back to Anthropic models`);else{let e=await r.json();if(e.data?.length)return ge(e.data,n)}}catch(e){console.warn(`[adobe] Failed to fetch proxy models:`,e instanceof Error?e.message:String(e))}return null}var Q=new Map;function _e(){return c(`anthropic`).map(e=>({...e,provider:`adobe`,api:`adobe-anthropic`}))}async function $(e){let t=C(),n=Q.get(t);if(n)return n;let r=await Z(e);return r?(Q.set(t,r),r):_e()}function ve(){o({api:`adobe-anthropic`,stream:Y,streamSimple:X}),o({api:`adobe-openai`,stream:Y,streamSimple:X})}export{fe as __resetAdobeSessionIdWarningCacheForTests,L as config,$ as getAdobeModels,z as getValidAccessToken,le as isTokenExpired,ve as register};
2
+ import{K as e,d as t,y as n,z as r}from"./account-store-DhS8k8-S.js";import{n as i}from"./event-stream-qbAZIAKV.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{a as o,i as s,r as c}from"./compat-CkpNnFQS.js";import{a as l,r as u,s as d,t as f}from"./legacy-api-aliases-BWm3gxUe.js";import{t as p}from"./panel-rpc-DmJSNs0I.js";import{a as m,i as h,o as g,s as _}from"./bedrock-camp-CJY4i7di.js";import"./provider-settings-CXes7fTR.js";import{n as v,t as ee}from"./silent-renew-backoff-CqD4WRin.js";import{getOAuthPageOrigin as te}from"./oauth-service-Dk3L2UWh.js";import{t as ne}from"./llm-session-id-bZQs6gBN.js";var re={proxyEndpoint:`https://adobe-llm-proxy.paolo-moz.workers.dev`,redirectUri:`https://www.sliccy.ai/auth/callback`,extensionRedirectUri:`https://akjjllgokmbgpbdbmafpiefnhidlmbgf.chromiumapp.org/adobe`};function y(e,t){return m(e,t)}function b(e,t,n){return e!==`xhigh`||!t?e:_(t,n)?`xhigh`:g(t,n)?`max`:`high`}function ie(e,t){let n=e?t?.thinkingLevelMap?.[e]:void 0;return b((()=>{if(typeof n==`string`)return n;switch(e){case`minimal`:case`low`:return`low`;case`medium`:return`medium`;case`xhigh`:return`xhigh`;default:return`high`}})(),t?.id,t?.name)}function ae(e,t){return async(n,r)=>{let i=t?await t(n,r)??n:n,a=i.thinking;return a&&a.type===`enabled`&&(i.thinking={type:`adaptive`,...a.display===void 0?{}:{display:a.display}},i.output_config={...i.output_config??{},effort:e}),i}}function x(e,t){if(!y(e.id,e.name))return t;let n=t,r=b(n.effort??ie(n.reasoning,e),e.id,e.name);return{...t,onPayload:ae(r,n.onPayload)}}function oe(e,t){let n={id:e.id,name:e.name??e.id},r=t?.api??e.api,i=t?.context_window??e.context_window,a=t?.max_tokens??e.max_tokens,o=t?.reasoning??e.reasoning,s=t?.input??e.input;r&&(n.api=r),i!==void 0&&(n.context_window=i),a!==void 0&&(n.max_tokens=a),o!==void 0&&(n.reasoning=o),s&&(n.input=s);let c=t?.cost??e.cost;return c&&(n.cost=c),/haiku/i.test(e.id)&&(n.compat={supportsEagerToolInputStreaming:!1}),/sonnet-5\b/i.test(e.id)&&!n.thinkingLevelMap&&(n.thinkingLevelMap={xhigh:`xhigh`}),n}var S=Object.assign({"/packages/webapp/providers/adobe-config.json":re})[`/packages/webapp/providers/adobe-config.json`]??{clientId:``,proxyEndpoint:``,scopes:`openid,profile,email`};function C(){let e=n(`adobe`);if(e)return e.replace(/\/$/,``);if(S.proxyEndpoint)return S.proxyEndpoint.replace(/\/$/,``);throw Error(`Adobe proxy endpoint not configured — set it in Settings or adobe-config.json`)}var w=new Map,T=new Map,E=`slicc-adobe-models`;function D(e){try{localStorage.setItem(E,JSON.stringify(e))}catch{}}async function O(e){let t=w.get(e);if(t)return t;try{let t=await fetch(`${e}/v1/config`,{headers:{[W]:`6.3.0`}});if(t.ok){let n=await t.json();return w.set(e,n),n}console.warn(`[adobe] Proxy /v1/config returned ${t.status}, falling back to build-time config`)}catch(e){console.warn(`[adobe] Failed to fetch proxy config:`,e instanceof Error?e.message:String(e))}return{}}function k(e){let t=e.clientId||S.clientId;if(!t)throw Error(`Could not determine IMS client ID — proxy /v1/config did not return one and adobe-config.json is empty`);return t}function A(e){return e.scopes||S.scopes}function j(e){return e.imsEnvironment||S.imsEnvironment||`prod`}var M={prod:`https://ims-na1.adobelogin.com`,stg1:`https://ims-na1-stg1.adobelogin.com`};function N(e){return M[e??S.imsEnvironment??`prod`]??M.prod}var P=typeof chrome<`u`&&!!chrome?.runtime?.id;function F(){return t().find(e=>e.providerId===`adobe`)}async function se(e,t){try{let n=await fetch(`${N(t)}/ims/userinfo/v2`,{headers:{Authorization:`Bearer ${e}`}});if(n.ok){let e=await n.json();return{name:e.displayName||e.name||e.email,avatar:e.picture||e.avatar_url}}console.warn(`[adobe] User profile fetch returned ${n.status}, account will have no display name`)}catch(e){console.warn(`[adobe] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function I(e){let t=e.indexOf(`#`);if(t<0)return null;let n=new URLSearchParams(e.slice(t+1)),r=n.get(`access_token`);return r?{accessToken:r,expiresIn:parseInt(n.get(`expires_in`)??`86400`,10)}:null}var L={id:`adobe`,name:`Adobe`,description:`Claude via Adobe — login with your Adobe ID`,requiresApiKey:!1,requiresBaseUrl:!S.proxyEndpoint,baseUrlPlaceholder:`https://your-proxy.example.com`,baseUrlDescription:`Anthropic-compatible proxy endpoint`,isOAuth:!0,defaultModelId:`sonnet`,oauthTokenDomains:[`ims-na1.adobelogin.com`,`ims-na1-stg1.adobelogin.com`,`*.adobelogin.com`,`*.adobe.io`,`firefall.adobe.io`,`admin.hlx.page`,`admin.hlx.live`,`admin.aem.page`,`admin.aem.live`],getModelIds:()=>{let e=e=>oe(e,T.get(e.id));for(let t of Q.values())if(t.length){let n=t.map(t=>e({id:t.id,name:t.name??t.id,reasoning:t.reasoning,input:t.input,cost:t.cost}));return D(n),n}for(let t of w.values())if(t.models?.length)return t.models.map(t=>e(t));try{let e=localStorage.getItem(E);if(e){let t=JSON.parse(e);if(t.length)return t}}catch{}return[{id:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`}]},onOAuthLogin:async(e,t,n)=>{let i=C(),a=await O(i),o=k(a),s=A(a),c=j(a),l=P?null:await te(),u=P?null:v({pageHref:l.href,pageOrigin:l.origin,configuredRedirectUri:S.redirectUri},()=>crypto.randomUUID()),d=P?S.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:u.redirectUri,f=u?.oauthState,p=u?.expectedNonce??null,m=new URLSearchParams({client_id:o,scope:s,response_type:`token`,redirect_uri:d});f&&m.set(`state`,f),n?.forceReauth&&m.set(`prompt`,`login`);let h=await e(`${N(c)}/ims/authorize/v2?${m}`);if(!h)return;if(p&&h)try{if(new URL(h).searchParams.get(`nonce`)!==p){console.error(`[adobe] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let g=I(h);if(!g){console.error(`[adobe] Could not extract token from redirect URL`);return}let _=await se(g.accessToken,c);await r({providerId:`adobe`,accessToken:g.accessToken,tokenExpiresAt:Date.now()+g.expiresIn*1e3,userName:_.name,userAvatar:_.avatar,baseUrl:S.proxyEndpoint?void 0:i}),await $().catch(e=>console.warn(`[adobe] Failed to fetch models after login:`,e instanceof Error?e.message:String(e))),t()},onOAuthLogout:async()=>{let e=F();if(e?.accessToken)try{let t=w.values().next().value??{},n=t.clientId||S.clientId,r=j(t);if(n){let t=await fetch(`${N(r)}/ims/revoke`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:e.accessToken,token_type_hint:`access_token`,client_id:n})});t.ok||console.warn(`[adobe] Token revocation returned ${t.status}, token may still be valid server-side`)}}catch(e){console.warn(`[adobe] Failed to revoke token:`,e instanceof Error?e.message:String(e))}await r({providerId:`adobe`,accessToken:``})},onSilentRenew:async()=>F()?.accessToken?B():null,refreshModels:async e=>{await $(e);let t=L.getModelIds?.();t?.length&&D(t)}},R=null,ce=ee();async function z(){let e=F();if(!e?.accessToken)throw Error(`Not logged in to Adobe — please log in first`);if((e.tokenExpiresAt??0)-Date.now()>6e4)return e.accessToken;console.log(`[adobe] Token expired or expiring soon, attempting silent renewal...`);let t=await ce.run(()=>B());if(t)return t;let n=F();if((n?.tokenExpiresAt??0)-Date.now()>0&&n?.accessToken)return n.accessToken;throw Error(`Adobe session expired — please log in again`)}function le(){let e=F();return!e?.tokenExpiresAt||Date.now()>e.tokenExpiresAt-6e4}async function B(){if(typeof window>`u`){let e=p();if(!e)return null;try{let{accessToken:t}=await e.call(`silent-renew`,{providerId:`adobe`},{timeoutMs:13e4});return t}catch(e){return console.warn(`[adobe] worker→page silent-renew bridge failed:`,e instanceof Error?e.message:String(e)),null}}return R||(R=ue().finally(()=>{R=null}),R)}function V(e,t){let n=k(t),r=A(t),i=j(t),a=P?null:v({pageHref:window.location.href,pageOrigin:window.location.origin,configuredRedirectUri:S.redirectUri},()=>crypto.randomUUID()),o=P?S.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:a.redirectUri,s=a?.oauthState,c=a?.expectedNonce??null,l=new URLSearchParams({client_id:n,scope:r,response_type:`token`,redirect_uri:o,prompt:`none`});return s&&l.set(`state`,s),{authorizeUrl:`${N(i)}/ims/authorize/v2?${l}`,expectedNonce:c,proxyEndpoint:e}}function H(e,t){if(!t)return!0;try{if(new URL(e).searchParams.get(`nonce`)!==t)return console.error(`[adobe] OAuth nonce mismatch — possible CSRF`),!1}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}return!0}async function U(e,t){let n=F();await r({providerId:`adobe`,accessToken:e.accessToken,tokenExpiresAt:Date.now()+e.expiresIn*1e3,userName:n?.userName,userAvatar:n?.userAvatar,baseUrl:S.proxyEndpoint?void 0:t})}async function ue(){try{let e=C(),{authorizeUrl:t,expectedNonce:n}=V(e,await O(e)),{createOAuthLauncher:r}=await a(async()=>{let{createOAuthLauncher:e}=await import(`./oauth-service-Dk3L2UWh.js`);return{createOAuthLauncher:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),i=await r()(t,{interactive:!1});if(!i||!H(i,n))return null;let o=I(i);return o?(await U(o,e),console.log(`[adobe] Token renewed silently`),await $().catch(e=>console.warn(`[adobe] Failed to refresh models after silent renewal:`,e instanceof Error?e.message:String(e))),o.accessToken):null}catch(e){return console.warn(`[adobe] Silent renewal error:`,e instanceof Error?e.message:String(e)),null}}var W=`X-Slicc-Version`;function G(e){let t={},n=W.toLowerCase();if(e.headers)for(let[r,i]of Object.entries(e.headers))r.toLowerCase()!==n&&(t[r]=i);return t[W]=`6.3.0`,{...e,headers:t}}var de=`adobe-provider-fallback`,K=new Set;function q(e,t){if(e.headers){for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()===`x-session-id`&&n!=null)return e}return K.has(t)||(K.add(t),console.warn(`[adobe] Missing X-Session-Id from ${t} — using daily fallback. Attach an X-Session-Id header at the call site (see scoop-context.ts streamWithSessionId or docs/pitfalls.md).`)),{...e,headers:{...e.headers??{},"X-Session-Id":ne(de)}}}function fe(){K.clear()}function J(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:`adobe-anthropic`,provider:`adobe`,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}var Y=(e,t,n={})=>{let r=i();return(async()=>{try{let i=await z();if(String(e.api).includes(`openai`)){let a=u({...e,baseUrl:`${C()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},t,G(q({...n,apiKey:i},`streamAdobe[openai]`)));for await(let e of a)r.push(e)}else{let a=f({...e,baseUrl:C(),api:`anthropic-messages`},t,G(q(x(e,h(e.id,e.name,{...n,apiKey:i})),`streamAdobe[anthropic]`)));for await(let e of a)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(J(e,t)),r.end()}})(),r},X=(e,t,n)=>{let r=i();return(async()=>{try{let i=await z();if(String(e.api).includes(`openai`)){let a=d({...e,baseUrl:`${C()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},t,G(q({...n,apiKey:i},`streamSimpleAdobe[openai]`)));for await(let e of a)r.push(e)}else{let a=l({...e,baseUrl:C(),api:`anthropic-messages`},t,G(q(x(e,h(e.id,e.name,{...n,apiKey:i})),`streamSimpleAdobe[anthropic]`)));for await(let e of a)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(J(e,t)),r.end()}})(),r};function pe(e){let t={id:e.id,name:e.name};return e.api!==void 0&&(t.api=e.api),e.context_window!==void 0&&(t.context_window=e.context_window),e.max_tokens!==void 0&&(t.max_tokens=e.max_tokens),e.reasoning!==void 0&&(t.reasoning=e.reasoning),e.input!==void 0&&(t.input=e.input),t}function me(){let e=new Map;for(let t of s())try{for(let n of c(t))e.set(n.id,n)}catch{}return e}function he(t,n,r){let i=`adobe-${t.api===`openai`?`openai`:`anthropic`}`,a=r.get(t.id);if(a)return{...a,provider:`adobe`,api:i};let o=e(t.id,r);return{id:t.id,name:t.name??t.id,provider:`adobe`,api:i,baseUrl:n,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:o,inputCost:o.input,outputCost:o.output,cacheReadCost:o.cacheRead,cacheWriteCost:o.cacheWrite,reasoning:!0}}function ge(e,t){for(let t of e)T.set(t.id,pe(t));let n=me();return e.map(e=>he(e,t,n))}async function Z(e){try{let t=e??await z(),n=C(),r=await fetch(`${n}/v1/models`,{headers:{Authorization:`Bearer ${t}`,[W]:`6.3.0`}});if(!r.ok)console.warn(`[adobe] Proxy /v1/models returned ${r.status}, falling back to Anthropic models`);else{let e=await r.json();if(e.data?.length)return ge(e.data,n)}}catch(e){console.warn(`[adobe] Failed to fetch proxy models:`,e instanceof Error?e.message:String(e))}return null}var Q=new Map;function _e(){return c(`anthropic`).map(e=>({...e,provider:`adobe`,api:`adobe-anthropic`}))}async function $(e){let t=C(),n=Q.get(t);if(n)return n;let r=await Z(e);return r?(Q.set(t,r),r):_e()}function ve(){o({api:`adobe-anthropic`,stream:Y,streamSimple:X}),o({api:`adobe-openai`,stream:Y,streamSimple:X})}export{fe as __resetAdobeSessionIdWarningCacheForTests,L as config,$ as getAdobeModels,z as getValidAccessToken,le as isTokenExpired,ve as register};