@telepath-computer/television 0.1.216 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/THIRD-PARTY-NOTICES.txt +336 -0
  2. package/dist/canonical/v1/frozen.json +6 -0
  3. package/dist/canonical/v1/styles.css +7 -2
  4. package/dist/canonical/v2/components.js +1 -0
  5. package/dist/canonical/v2/fonts/Hind-Variable.933e9900.woff2 +0 -0
  6. package/dist/canonical/v2/styles.css +1153 -0
  7. package/dist/cli.cjs +1763 -761
  8. package/dist/onboarding/README.md +16 -14
  9. package/dist/onboarding/business-ops/about.html +4 -3
  10. package/dist/onboarding/business-ops/retention-vs-releases.html +25 -32
  11. package/dist/onboarding/business-ops/revenue-vs-goals.html +26 -31
  12. package/dist/onboarding/productivity/about.html +4 -3
  13. package/dist/onboarding/productivity/company-todos/THIRD-PARTY-NOTICES.txt +29 -0
  14. package/dist/onboarding/productivity/company-todos/index.html +20 -20
  15. package/dist/onboarding/productivity/company-todos/task.css +4 -5
  16. package/dist/onboarding/productivity/company-todos/task.js +1 -1
  17. package/dist/onboarding/productivity/meeting-prep.html +12 -12
  18. package/dist/onboarding/productivity/priorities-today.html +10 -10
  19. package/dist/onboarding/productivity/todays-calendar/calendar.css +1 -1
  20. package/dist/onboarding/productivity/todays-calendar/index.html +12 -14
  21. package/dist/onboarding/research/about.html +4 -3
  22. package/dist/onboarding/research/open-model-research.html +35 -35
  23. package/dist/onboarding/research/todays-news.html +72 -72
  24. package/dist/onboarding/tv-guide/welcome.html +178 -0
  25. package/dist/skills/television/SKILL.md +122 -67
  26. package/dist/skills/television/theming.md +1087 -0
  27. package/dist/skills/tv-calendar/SKILL.md +3 -1
  28. package/dist/skills/tv-calendar/calendar.css +1 -1
  29. package/dist/skills/tv-table/SKILL.md +5 -2
  30. package/dist/skills/tv-tasks/SKILL.md +19 -15
  31. package/dist/skills/tv-tasks/task.css +4 -26
  32. package/dist/skills/tv-tasks/task.js +1 -1
  33. package/dist/themes/README.md +5 -0
  34. package/dist/themes/aquarium/README.md +48 -0
  35. package/dist/themes/aquarium/iframe-background.js +137 -0
  36. package/dist/themes/aquarium/manifest.json +7 -0
  37. package/dist/themes/aquarium/theme.css +46 -0
  38. package/dist/themes/blueprint/README.md +31 -0
  39. package/dist/themes/blueprint/manifest.json +6 -0
  40. package/dist/themes/blueprint/theme.css +115 -0
  41. package/dist/themes/clouds/README.md +15 -0
  42. package/dist/themes/clouds/THIRD-PARTY-NOTICES.txt +81 -0
  43. package/dist/themes/clouds/manifest.json +6 -0
  44. package/dist/themes/clouds/theme.css +62 -0
  45. package/dist/themes/clouds/wallpaper-dark.webp +0 -0
  46. package/dist/themes/clouds/wallpaper.webp +0 -0
  47. package/dist/themes/crt-phosphor/README.md +31 -0
  48. package/dist/themes/crt-phosphor/manifest.json +6 -0
  49. package/dist/themes/crt-phosphor/theme.css +105 -0
  50. package/dist/themes/nord/README.md +9 -0
  51. package/dist/themes/nord/THIRD-PARTY-NOTICES.txt +29 -0
  52. package/dist/themes/nord/manifest.json +5 -0
  53. package/dist/themes/nord/theme.css +28 -0
  54. package/dist/themes/swiss/README.md +5 -0
  55. package/dist/themes/swiss/manifest.json +5 -0
  56. package/dist/themes/swiss/theme.css +34 -0
  57. package/dist/themes/tokyo-night/README.md +17 -0
  58. package/dist/themes/tokyo-night/THIRD-PARTY-NOTICES.txt +235 -0
  59. package/dist/themes/tokyo-night/manifest.json +5 -0
  60. package/dist/themes/tokyo-night/theme.css +31 -0
  61. package/dist/themes/tokyo-night/wallpaper.webp +0 -0
  62. package/dist/views/artifact-missing/index.html +40 -68
  63. package/dist/views/markdown/THIRD-PARTY-NOTICES.txt +26 -0
  64. package/dist/views/markdown/index.html +49 -23
  65. package/dist/web/THIRD-PARTY-NOTICES.txt +26 -0
  66. package/dist/web/assets/artifact-bridge-BEUWXKq7.js +1 -0
  67. package/dist/web/assets/{artifactMissing-BiK_l3Ts.js → artifactMissing-CUs1ZwDx.js} +1 -1
  68. package/dist/web/assets/main-3UimTRLK.css +1 -0
  69. package/dist/web/assets/main-CSSzbG7q.js +704 -0
  70. package/dist/web/assets/{urlUnsupported-RGIrhMDe.js → urlUnsupported-powR79PT.js} +1 -1
  71. package/dist/web/index.html +40 -5
  72. package/dist/web/views/artifact-missing/index.html +40 -68
  73. package/dist/web/views/url-unsupported/index.html +40 -68
  74. package/package.json +1 -1
  75. package/dist/onboarding/tv-guide/welcome/assets/television.svg +0 -71
  76. package/dist/onboarding/tv-guide/welcome/index.html +0 -203
  77. package/dist/skills/tv-theme/SKILL.md +0 -449
  78. package/dist/web/assets/artifact-bridge-3Trk-B2L.js +0 -1
  79. package/dist/web/assets/clouds-CAYIArXj.jpg +0 -0
  80. package/dist/web/assets/main-Blg8fuaV.css +0 -1
  81. package/dist/web/assets/main-V14r9Psb.js +0 -596
@@ -1,596 +0,0 @@
1
- var bb=Object.defineProperty;var t0=n=>{throw TypeError(n)};var _b=(n,e,t)=>e in n?bb(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var $=(n,e,t)=>_b(n,typeof e!="symbol"?e+"":e,t),ih=(n,e,t)=>e.has(n)||t0("Cannot "+t);var a=(n,e,t)=>(ih(n,e,"read from private field"),t?t.call(n):e.get(n)),g=(n,e,t)=>e.has(n)?t0("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),d=(n,e,t,r)=>(ih(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),h=(n,e,t)=>(ih(n,e,"access private method"),t);var sh=(n,e,t,r)=>({set _(i){d(n,e,i,t)},get _(){return a(n,e,r)}});import{i as Sb,a as Ab,b as kb,c as Eb,d as $b,e as Cb,f as Tb,U as Rb,A as Ib,g as xb}from"./artifact-bridge-3Trk-B2L.js";import{m as Pb,a as Db,b as Lb}from"./missing-artifact-page-DVzJ41AE.js";var Yr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ob(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var n0=Object.prototype.toString,u1=function(e){var t=n0.call(e),r=t==="[object Arguments]";return r||(r=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&n0.call(e.callee)==="[object Function]"),r},oh,r0;function zb(){if(r0)return oh;r0=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=u1,i=Object.prototype.propertyIsEnumerable,s=!i.call({toString:null},"toString"),o=i.call(function(){},"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],c=function(v){var y=v.constructor;return y&&y.prototype===v},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if(typeof window>"u")return!1;for(var v in window)try{if(!u["$"+v]&&e.call(window,v)&&window[v]!==null&&typeof window[v]=="object")try{c(window[v])}catch{return!0}}catch{return!0}return!1}(),m=function(v){if(typeof window>"u"||!f)return c(v);try{return c(v)}catch{return!1}};n=function(y){var k=y!==null&&typeof y=="object",S=t.call(y)==="[object Function]",x=r(y),M=k&&t.call(y)==="[object String]",Z=[];if(!k&&!S&&!x)throw new TypeError("Object.keys called on a non-object");var G=o&&S;if(M&&y.length>0&&!e.call(y,0))for(var F=0;F<y.length;++F)Z.push(String(F));if(x&&y.length>0)for(var W=0;W<y.length;++W)Z.push(String(W));else for(var Q in y)!(G&&Q==="prototype")&&e.call(y,Q)&&Z.push(String(Q));if(s)for(var ee=m(y),oe=0;oe<l.length;++oe)!(ee&&l[oe]==="constructor")&&e.call(y,l[oe])&&Z.push(l[oe]);return Z}}return oh=n,oh}var Nb=Array.prototype.slice,Mb=u1,i0=Object.keys,sc=i0?function(e){return i0(e)}:zb(),s0=Object.keys;sc.shim=function(){if(Object.keys){var e=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);e||(Object.keys=function(r){return Mb(r)?s0(Nb.call(r)):s0(r)})}else Object.keys=sc;return Object.keys||sc};var Ub=sc,oc=Object.defineProperty||!1;if(oc)try{oc({},"a",{value:1})}catch{oc=!1}var pl=oc,Kn=SyntaxError,J=TypeError,Zb=Object.getOwnPropertyDescriptor,ac=Zb;if(ac)try{ac([],"length")}catch{ac=null}var ao=ac,o0=pl,Fb=Kn,Qi=J,a0=ao,h1=function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Qi("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new Qi("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Qi("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Qi("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Qi("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Qi("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,c=!!a0&&a0(e,t);if(o0)o0(e,t,{configurable:o===null&&c?c.configurable:!o,enumerable:i===null&&c?c.enumerable:!i,value:r,writable:s===null&&c?c.writable:!s});else if(l||!i&&!s&&!o)e[t]=r;else throw new Fb("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Xh=pl,d1=function(){return!!Xh};d1.hasArrayLengthDefineBug=function(){if(!Xh)return null;try{return Xh([],"length",{value:1}).length!==1}catch{return!0}};var Su=d1,Hb=Ub,Vb=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Bb=Object.prototype.toString,qb=Array.prototype.concat,l0=h1,jb=function(n){return typeof n=="function"&&Bb.call(n)==="[object Function]"},f1=Su(),Wb=function(n,e,t,r){if(e in n){if(r===!0){if(n[e]===t)return}else if(!jb(r)||!r())return}f1?l0(n,e,t,!0):l0(n,e,t)},p1=function(n,e){var t=arguments.length>2?arguments[2]:{},r=Hb(e);Vb&&(r=qb.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i<r.length;i+=1)Wb(n,r[i],e[r[i]],t[r[i]])};p1.supportsDescriptors=!!f1;var Vi=p1,lc={exports:{}};typeof self<"u"?lc.exports=self:typeof window<"u"?lc.exports=window:lc.exports=Function("return this")();var m1=lc.exports,Gb=m1,g1=function(){return typeof Yr!="object"||!Yr||Yr.Math!==Math||Yr.Array!==Array?Gb:Yr},Yb=Vi,Kb=ao,Jb=g1,Xb=function(){var e=Jb();if(Yb.supportsDescriptors){var t=Kb(e,"globalThis");(!t||t.configurable&&(t.enumerable||!t.writable||globalThis!==e))&&Object.defineProperty(e,"globalThis",{configurable:!0,enumerable:!1,value:e,writable:!0})}else(typeof globalThis!="object"||globalThis!==e)&&(e.globalThis=e);return e},Qb=Vi,e_=m1,v1=g1,t_=Xb,n_=v1(),y1=function(){return n_};Qb(y1,{getPolyfill:v1,implementation:e_,shim:t_});var If=y1,Jn=function(e){return!!e&&(typeof e=="function"||typeof e=="object")},xf=Object,w1=Error,r_=EvalError,i_=RangeError,Pf=ReferenceError,s_=URIError,o_=Math.abs,a_=Math.floor,l_=Math.max,c_=Math.min,u_=Math.pow,h_=Math.round,Df=Number.isNaN||function(e){return e!==e},d_=Df,f_=function(e){return d_(e)||e===0?e:e<0?-1:1},lo=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),r=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(e,t);if(l.value!==i||l.enumerable!==!0)return!1}return!0},c0=typeof Symbol<"u"&&Symbol,p_=lo,Lf=function(){return typeof c0!="function"||typeof Symbol!="function"||typeof c0("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:p_()},b1=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,m_=xf,_1=m_.getPrototypeOf||null,g_="Function.prototype.bind called on incompatible ",v_=Object.prototype.toString,y_=Math.max,w_="[object Function]",u0=function(e,t){for(var r=[],i=0;i<e.length;i+=1)r[i]=e[i];for(var s=0;s<t.length;s+=1)r[s+e.length]=t[s];return r},b_=function(e,t){for(var r=[],i=t,s=0;i<e.length;i+=1,s+=1)r[s]=e[i];return r},__=function(n,e){for(var t="",r=0;r<n.length;r+=1)t+=n[r],r+1<n.length&&(t+=e);return t},S_=function(e){var t=this;if(typeof t!="function"||v_.apply(t)!==w_)throw new TypeError(g_+t);for(var r=b_(arguments,1),i,s=function(){if(this instanceof i){var f=t.apply(this,u0(r,arguments));return Object(f)===f?f:this}return t.apply(e,u0(r,arguments))},o=y_(0,t.length-r.length),l=[],c=0;c<o;c++)l[c]="$"+c;if(i=Function("binder","return function ("+__(l,",")+"){ return binder.apply(this,arguments); }")(s),t.prototype){var u=function(){};u.prototype=t.prototype,i.prototype=new u,u.prototype=null}return i},A_=S_,ml=Function.prototype.bind||A_,Of=Function.prototype.call,ah,h0;function zf(){return h0||(h0=1,ah=Function.prototype.apply),ah}var k_=typeof Reflect<"u"&&Reflect&&Reflect.apply,E_=ml,$_=zf(),C_=Of,T_=k_,S1=T_||E_.call(C_,$_),R_=ml,I_=J,x_=Of,P_=S1,Au=function(e){if(e.length<1||typeof e[0]!="function")throw new I_("a function is required");return P_(R_,x_,e)},D_=Au,d0=ao,A1;try{A1=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var lh=!!A1&&d0&&d0(Object.prototype,"__proto__"),k1=Object,f0=k1.getPrototypeOf,L_=lh&&typeof lh.get=="function"?D_([lh.get]):typeof f0=="function"?function(e){return f0(e==null?e:k1(e))}:!1,p0=b1,m0=_1,g0=L_,E1=p0?function(e){return p0(e)}:m0?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return m0(e)}:g0?function(e){return g0(e)}:null,O_=Function.prototype.call,z_=Object.prototype.hasOwnProperty,N_=ml,Xn=N_.call(O_,z_),K,M_=xf,U_=w1,Z_=r_,F_=i_,H_=Pf,to=Kn,vs=J,V_=s_,B_=o_,q_=a_,j_=l_,W_=c_,G_=u_,Y_=h_,K_=f_,$1=Function,ch=function(n){try{return $1('"use strict"; return ('+n+").constructor;")()}catch{}},la=ao,J_=pl,uh=function(){throw new vs},X_=la?function(){try{return arguments.callee,uh}catch{try{return la(arguments,"callee").get}catch{return uh}}}():uh,es=Lf(),Re=E1,Q_=_1,eS=b1,C1=zf(),gl=Of,ss={},tS=typeof Uint8Array>"u"||!Re?K:Re(Uint8Array),Mi={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?K:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?K:ArrayBuffer,"%ArrayIteratorPrototype%":es&&Re?Re([][Symbol.iterator]()):K,"%AsyncFromSyncIteratorPrototype%":K,"%AsyncFunction%":ss,"%AsyncGenerator%":ss,"%AsyncGeneratorFunction%":ss,"%AsyncIteratorPrototype%":ss,"%Atomics%":typeof Atomics>"u"?K:Atomics,"%BigInt%":typeof BigInt>"u"?K:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?K:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?K:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?K:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":U_,"%eval%":eval,"%EvalError%":Z_,"%Float16Array%":typeof Float16Array>"u"?K:Float16Array,"%Float32Array%":typeof Float32Array>"u"?K:Float32Array,"%Float64Array%":typeof Float64Array>"u"?K:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?K:FinalizationRegistry,"%Function%":$1,"%GeneratorFunction%":ss,"%Int8Array%":typeof Int8Array>"u"?K:Int8Array,"%Int16Array%":typeof Int16Array>"u"?K:Int16Array,"%Int32Array%":typeof Int32Array>"u"?K:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":es&&Re?Re(Re([][Symbol.iterator]())):K,"%JSON%":typeof JSON=="object"?JSON:K,"%Map%":typeof Map>"u"?K:Map,"%MapIteratorPrototype%":typeof Map>"u"||!es||!Re?K:Re(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":M_,"%Object.getOwnPropertyDescriptor%":la,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?K:Promise,"%Proxy%":typeof Proxy>"u"?K:Proxy,"%RangeError%":F_,"%ReferenceError%":H_,"%Reflect%":typeof Reflect>"u"?K:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?K:Set,"%SetIteratorPrototype%":typeof Set>"u"||!es||!Re?K:Re(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?K:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":es&&Re?Re(""[Symbol.iterator]()):K,"%Symbol%":es?Symbol:K,"%SyntaxError%":to,"%ThrowTypeError%":X_,"%TypedArray%":tS,"%TypeError%":vs,"%Uint8Array%":typeof Uint8Array>"u"?K:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?K:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?K:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?K:Uint32Array,"%URIError%":V_,"%WeakMap%":typeof WeakMap>"u"?K:WeakMap,"%WeakRef%":typeof WeakRef>"u"?K:WeakRef,"%WeakSet%":typeof WeakSet>"u"?K:WeakSet,"%Function.prototype.call%":gl,"%Function.prototype.apply%":C1,"%Object.defineProperty%":J_,"%Object.getPrototypeOf%":Q_,"%Math.abs%":B_,"%Math.floor%":q_,"%Math.max%":j_,"%Math.min%":W_,"%Math.pow%":G_,"%Math.round%":Y_,"%Math.sign%":K_,"%Reflect.getPrototypeOf%":eS};if(Re)try{null.error}catch(n){var nS=Re(Re(n));Mi["%Error.prototype%"]=nS}var rS=function n(e){var t;if(e==="%AsyncFunction%")t=ch("async function () {}");else if(e==="%GeneratorFunction%")t=ch("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=ch("async function* () {}");else if(e==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&Re&&(t=Re(i.prototype))}return Mi[e]=t,t},v0={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},vl=ml,zc=Xn,iS=vl.call(gl,Array.prototype.concat),sS=vl.call(C1,Array.prototype.splice),y0=vl.call(gl,String.prototype.replace),Nc=vl.call(gl,String.prototype.slice),oS=vl.call(gl,RegExp.prototype.exec),aS=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,lS=/\\(\\)?/g,cS=function(e){var t=Nc(e,0,1),r=Nc(e,-1);if(t==="%"&&r!=="%")throw new to("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new to("invalid intrinsic syntax, expected opening `%`");var i=[];return y0(e,aS,function(s,o,l,c){i[i.length]=l?y0(c,lS,"$1"):o||s}),i},uS=function(e,t){var r=e,i;if(zc(v0,r)&&(i=v0[r],r="%"+i[0]+"%"),zc(Mi,r)){var s=Mi[r];if(s===ss&&(s=rS(r)),typeof s>"u"&&!t)throw new vs("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new to("intrinsic "+e+" does not exist!")},_t=function(e,t){if(typeof e!="string"||e.length===0)throw new vs("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new vs('"allowMissing" argument must be a boolean');if(oS(/^%?[^%]*%?$/,e)===null)throw new to("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=cS(e),i=r.length>0?r[0]:"",s=uS("%"+i+"%",t),o=s.name,l=s.value,c=!1,u=s.alias;u&&(i=u[0],sS(r,iS([0,1],u)));for(var f=1,m=!0;f<r.length;f+=1){var v=r[f],y=Nc(v,0,1),k=Nc(v,-1);if((y==='"'||y==="'"||y==="`"||k==='"'||k==="'"||k==="`")&&y!==k)throw new to("property names with quotes must have matching quotes");if((v==="constructor"||!m)&&(c=!0),i+="."+v,o="%"+i+"%",zc(Mi,o))l=Mi[o];else if(l!=null){if(!(v in l)){if(!t)throw new vs("base intrinsic for "+e+" exists, but the property is not available.");return}if(la&&f+1>=r.length){var S=la(l,v);m=!!S,m&&"get"in S&&!("originalValue"in S.get)?l=S.get:l=l[v]}else m=zc(l,v),l=l[v];m&&!c&&(Mi[o]=l)}}return l},hh,w0;function zr(){if(w0)return hh;w0=1;var n=_t,e=Au,t=e([n("%String.prototype.indexOf%")]);return hh=function(i,s){var o=n(i,!!s);return typeof o=="function"&&t(i,".prototype.")>-1?e([o]):o},hh}var dh,b0;function Nf(){if(b0)return dh;b0=1;var n=_t,e=n("%Array%"),t=!e.isArray&&zr()("Object.prototype.toString");return dh=e.isArray||function(i){return t(i)==="[object Array]"},dh}var hS=Su,_0=pl,T1=hS.hasArrayLengthDefineBug(),dS=T1&&Nf(),fS=zr(),pS=fS("Object.prototype.propertyIsEnumerable"),Mf=function(e,t,r,i,s,o){if(!_0){if(!e(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&pS(i,s)!==!!o["[[Enumerable]]"])return!1;var l=o["[[Value]]"];return i[s]=l,t(i[s],l)}return T1&&s==="length"&&"[[Value]]"in o&&dS(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(_0(i,s,r(o)),!0)},mS=J,ko=Xn,gS={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},co=function(e){if(!e||typeof e!="object")return!1;for(var t in e)if(ko(e,t)&&!gS[t])return!1;var r=ko(e,"[[Value]]")||ko(e,"[[Writable]]"),i=ko(e,"[[Get]]")||ko(e,"[[Set]]");if(r&&i)throw new mS("Property Descriptors may not be both accessor and data descriptors");return!0},R1=function(e){if(typeof e>"u")return e;var t={};return"[[Value]]"in e&&(t.value=e["[[Value]]"]),"[[Writable]]"in e&&(t.writable=!!e["[[Writable]]"]),"[[Get]]"in e&&(t.get=e["[[Get]]"]),"[[Set]]"in e&&(t.set=e["[[Set]]"]),"[[Enumerable]]"in e&&(t.enumerable=!!e["[[Enumerable]]"]),"[[Configurable]]"in e&&(t.configurable=!!e["[[Configurable]]"]),t},vS=J,yS=co,wS=R1,I1=function(e){if(typeof e<"u"&&!yS(e))throw new vS("Assertion failed: `Desc` must be a Property Descriptor");return wS(e)},bS=J,S0=Xn,_S=co,x1=function(e){if(typeof e>"u")return!1;if(!_S(e))throw new bS("Assertion failed: `Desc` must be a Property Descriptor");return!(!S0(e,"[[Value]]")&&!S0(e,"[[Writable]]"))},uo=function(e){return typeof e=="string"||typeof e=="symbol"},A0=Df,P1=function(e,t){return e===t?e===0?1/e===1/t:!0:A0(e)&&A0(t)},k0=J,SS=Jn,AS=Mf,kS=I1,ES=x1,$S=uo,CS=P1,Uf=function(e,t,r){if(!SS(e))throw new k0("Assertion failed: Type(O) is not Object");if(!$S(t))throw new k0("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return AS(ES,CS,kS,e,t,i)},D1=Function.prototype.toString,fs=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Qh,cc;if(typeof fs=="function"&&typeof Object.defineProperty=="function")try{Qh=Object.defineProperty({},"length",{get:function(){throw cc}}),cc={},fs(function(){throw 42},null,Qh)}catch(n){n!==cc&&(fs=null)}else fs=null;var TS=/^\s*class\b/,ed=function(e){try{var t=D1.call(e);return TS.test(t)}catch{return!1}},fh=function(e){try{return ed(e)?!1:(D1.call(e),!0)}catch{return!1}},uc=Object.prototype.toString,RS="[object Object]",IS="[object Function]",xS="[object GeneratorFunction]",PS="[object HTMLAllCollection]",DS="[object HTML document.all class]",LS="[object HTMLCollection]",OS=typeof Symbol=="function"&&!!Symbol.toStringTag,zS=!(0 in[,]),td=function(){return!1};if(typeof document=="object"){var NS=document.all;uc.call(NS)===uc.call(document.all)&&(td=function(e){if((zS||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=uc.call(e);return(t===PS||t===DS||t===LS||t===RS)&&e("")==null}catch{}return!1})}var L1=fs?function(e){if(td(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{fs(e,null,Qh)}catch(t){if(t!==cc)return!1}return!ed(e)&&fh(e)}:function(e){if(td(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(OS)return fh(e);if(ed(e))return!1;var t=uc.call(e);return t!==IS&&t!==xS&&!/^\[object HTML/.test(t)?!1:fh(e)},MS=L1,US=function(e){return!!e},Mt=Xn,zl=J,ZS=Jn,E0=MS,ph=US,FS=function(e){if(!ZS(e))throw new zl("ToPropertyDescriptor requires an object");var t={};if(Mt(e,"enumerable")&&(t["[[Enumerable]]"]=ph(e.enumerable)),Mt(e,"configurable")&&(t["[[Configurable]]"]=ph(e.configurable)),Mt(e,"value")&&(t["[[Value]]"]=e.value),Mt(e,"writable")&&(t["[[Writable]]"]=ph(e.writable)),Mt(e,"get")){var r=e.get;if(typeof r<"u"&&!E0(r))throw new zl("getter must be a function");t["[[Get]]"]=r}if(Mt(e,"set")){var i=e.set;if(typeof i<"u"&&!E0(i))throw new zl("setter must be a function");t["[[Set]]"]=i}if((Mt(t,"[[Get]]")||Mt(t,"[[Set]]"))&&(Mt(t,"[[Value]]")||Mt(t,"[[Writable]]")))throw new zl("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},mh=J,HS=Jn,$0=co,VS=Mf,BS=I1,qS=x1,jS=uo,WS=P1,GS=FS,YS=function(e,t,r){if(!HS(e))throw new mh("Assertion failed: Type(O) is not Object");if(!jS(t))throw new mh("Assertion failed: P is not a Property Key");var i=$0(r)?r:GS(r);if(!$0(i))throw new mh("Assertion failed: Desc is not a valid Property Descriptor");return VS(qS,WS,BS,e,t,i)},C0=J,KS=Jn,JS=YS,XS=uo,QS=function(e,t,r){if(!KS(e))throw new C0("Assertion failed: Type(O) is not Object");if(!XS(t))throw new C0("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return JS(e,t,i)},e6=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,t6=xf,n6=t6.setPrototypeOf||null,r6=Au,T0=ao,i6=J,O1={};try{O1.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var s6=!("toString"in O1),gh=T0&&T0(Object.prototype,"__proto__"),o6=s6&&(!!gh&&typeof gh.set=="function"&&r6([gh.set])||function(e,t){if(e==null)throw new i6("set Object.prototype.__proto__ called on null or undefined");return e.__proto__=t,t}),R0=e6,a6=n6,I0=o6,l6=J,c6=R0?function(e,t){if(R0(e,t))return e;throw new l6("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:a6||(I0?function(e,t){return I0(e,t),e}:null),x0=J,u6=Jn,P0=E1,h6=function(e){if(!u6(e))throw new x0("Assertion failed: O must be an Object");if(!P0)throw new x0("This environment does not support fetching prototypes.");return P0(e)},d6=J,f6=c6,p6=Jn,m6=h6,g6=function(e,t){if(t!==null&&!p6(t))throw new d6("Assertion failed: V must be Object or Null");try{f6(e,t)}catch{return!1}return m6(e)===t},vh=Uf,D0=QS,z1=g6,v6=Su(),Zf=w1;function yl(n,e,t){var r=new Zf(t);return z1(r,hc),delete r.constructor,D0(r,"error",n),D0(r,"suppressed",e),r}v6&&Object.defineProperty(yl,"prototype",{writable:!1});var hc=yl.prototype;if(!vh(hc,"constructor",yl)||!vh(hc,"message","")||!vh(hc,"name","SuppressedError"))throw new Zf("unable to install SuppressedError.prototype properties; please report this!");z1(yl.prototype,Zf.prototype);var y6=yl,w6=y6,N1=function(){return typeof SuppressedError=="function"?SuppressedError:w6},b6=Vi,L0=If(),_6=N1,S6=function(){var e=_6();return b6(L0,{SuppressedError:e},{SuppressedError:function(){return L0.SuppressedError!==e}}),e};S6();var A6=J,k6=co,E6=R1,$6=function(e){if(typeof e<"u"&&!k6(e))throw new A6("Assertion failed: `Desc` must be a Property Descriptor");return E6(e)},C6=J,O0=Xn,T6=co,R6=function(e){if(typeof e>"u")return!1;if(!T6(e))throw new C6("Assertion failed: `Desc` must be a Property Descriptor");return!(!O0(e,"[[Value]]")&&!O0(e,"[[Writable]]"))},z0=Df,I6=function(e,t){return e===t?e===0?1/e===1/t:!0:z0(e)&&z0(t)},ho=L1,x6=function(e){return!!e},Ut=Xn,Nl=J,P6=Jn,N0=ho,yh=x6,D6=function(e){if(!P6(e))throw new Nl("ToPropertyDescriptor requires an object");var t={};if(Ut(e,"enumerable")&&(t["[[Enumerable]]"]=yh(e.enumerable)),Ut(e,"configurable")&&(t["[[Configurable]]"]=yh(e.configurable)),Ut(e,"value")&&(t["[[Value]]"]=e.value),Ut(e,"writable")&&(t["[[Writable]]"]=yh(e.writable)),Ut(e,"get")){var r=e.get;if(typeof r<"u"&&!N0(r))throw new Nl("getter must be a function");t["[[Get]]"]=r}if(Ut(e,"set")){var i=e.set;if(typeof i<"u"&&!N0(i))throw new Nl("setter must be a function");t["[[Set]]"]=i}if((Ut(t,"[[Get]]")||Ut(t,"[[Set]]"))&&(Ut(t,"[[Value]]")||Ut(t,"[[Writable]]")))throw new Nl("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},wh=J,L6=Jn,M0=co,O6=Mf,z6=$6,N6=R6,M6=uo,U6=I6,Z6=D6,wl=function(e,t,r){if(!L6(e))throw new wh("Assertion failed: Type(O) is not Object");if(!M6(t))throw new wh("Assertion failed: P is not a Property Key");var i=M0(r)?r:Z6(r);if(!M0(i))throw new wh("Assertion failed: Desc is not a valid Property Descriptor");return O6(N6,U6,z6,e,t,i)},F6=lo(),H6=F6?Symbol.dispose||Symbol("Symbol.dispose"):null,V6=lo,B6=H6,Ff=function(){return V6()&&Symbol.dispose||B6},q6=Lf,j6=wl,W6=Ff,G6=function(){var e=W6();return q6()&&j6(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},Y6=lo(),K6=Y6?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,J6=lo,X6=K6,Hf=function(){return J6()&&Symbol.asyncDispose||X6},Q6=Lf,e8=wl,t8=Hf,n8=function(){var e=t8();return Q6()&&e8(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},r8=Nf(),i8=_t,s8=zr(),o8=J,a8=r8,l8=i8("%Reflect.apply%",!0)||s8("Function.prototype.apply"),ku=function(e,t){var r=arguments.length>2?arguments[2]:[];if(!a8(r))throw new o8("Assertion failed: optional `argumentsList`, if provided, must be a List");return l8(e,t,r)};const c8={},u8=Object.freeze(Object.defineProperty({__proto__:null,default:c8},Symbol.toStringTag,{value:"Module"})),h8=Ob(u8);var Vf=typeof Map=="function"&&Map.prototype,bh=Object.getOwnPropertyDescriptor&&Vf?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Mc=Vf&&bh&&typeof bh.get=="function"?bh.get:null,U0=Vf&&Map.prototype.forEach,Bf=typeof Set=="function"&&Set.prototype,_h=Object.getOwnPropertyDescriptor&&Bf?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Uc=Bf&&_h&&typeof _h.get=="function"?_h.get:null,Z0=Bf&&Set.prototype.forEach,d8=typeof WeakMap=="function"&&WeakMap.prototype,na=d8?WeakMap.prototype.has:null,f8=typeof WeakSet=="function"&&WeakSet.prototype,ra=f8?WeakSet.prototype.has:null,p8=typeof WeakRef=="function"&&WeakRef.prototype,F0=p8?WeakRef.prototype.deref:null,m8=Boolean.prototype.valueOf,g8=Object.prototype.toString,v8=Function.prototype.toString,y8=String.prototype.match,qf=String.prototype.slice,Tr=String.prototype.replace,w8=String.prototype.toUpperCase,H0=String.prototype.toLowerCase,M1=RegExp.prototype.test,V0=Array.prototype.concat,pn=Array.prototype.join,b8=Array.prototype.slice,B0=Math.floor,nd=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Sh=Object.getOwnPropertySymbols,rd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,no=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ia=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===no||!0)?Symbol.toStringTag:null,U1=Object.prototype.propertyIsEnumerable,q0=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function j0(n,e){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||M1.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-B0(-n):B0(n);if(r!==n){var i=String(r),s=qf.call(e,i.length+1);return Tr.call(i,t,"$&_")+"."+Tr.call(Tr.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Tr.call(e,t,"$&_")}var id=h8,W0=id.custom,G0=H1(W0)?W0:null,Z1={__proto__:null,double:'"',single:"'"},_8={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},fo=function n(e,t,r,i){var s=t||{};if(Tn(s,"quoteStyle")&&!Tn(Z1,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Tn(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=Tn(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Tn(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Tn(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return B1(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return l?j0(e,c):c}if(typeof e=="bigint"){var u=String(e)+"n";return l?j0(e,u):u}var f=typeof s.depth>"u"?5:s.depth;if(typeof r>"u"&&(r=0),r>=f&&f>0&&typeof e=="object")return sd(e)?"[Array]":"[Object]";var m=U8(s,r);if(typeof i>"u")i=[];else if(V1(i,e)>=0)return"[Circular]";function v(Ot,Qn,ju){if(Qn&&(i=b8.call(i),i.push(Qn)),ju){var Cl={depth:s.depth};return Tn(s,"quoteStyle")&&(Cl.quoteStyle=s.quoteStyle),n(Ot,Cl,r+1,i)}return n(Ot,s,r+1,i)}if(typeof e=="function"&&!Y0(e)){var y=I8(e),k=Ml(e,v);return"[Function"+(y?": "+y:" (anonymous)")+"]"+(k.length>0?" { "+pn.call(k,", ")+" }":"")}if(H1(e)){var S=no?Tr.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):rd.call(e);return typeof e=="object"&&!no?Eo(S):S}if(z8(e)){for(var x="<"+H0.call(String(e.nodeName)),M=e.attributes||[],Z=0;Z<M.length;Z++)x+=" "+M[Z].name+"="+F1(S8(M[Z].value),"double",s);return x+=">",e.childNodes&&e.childNodes.length&&(x+="..."),x+="</"+H0.call(String(e.nodeName))+">",x}if(sd(e)){if(e.length===0)return"[]";var G=Ml(e,v);return m&&!M8(G)?"["+od(G,m)+"]":"[ "+pn.call(G,", ")+" ]"}if(k8(e)){var F=Ml(e,v);return!("cause"in Error.prototype)&&"cause"in e&&!U1.call(e,"cause")?"{ ["+String(e)+"] "+pn.call(V0.call("[cause]: "+v(e.cause),F),", ")+" }":F.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+pn.call(F,", ")+" }"}if(typeof e=="object"&&o){if(G0&&typeof e[G0]=="function"&&id)return id(e,{depth:f-r});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(x8(e)){var W=[];return U0&&U0.call(e,function(Ot,Qn){W.push(v(Qn,e,!0)+" => "+v(Ot,e))}),K0("Map",Mc.call(e),W,m)}if(L8(e)){var Q=[];return Z0&&Z0.call(e,function(Ot){Q.push(v(Ot,e))}),K0("Set",Uc.call(e),Q,m)}if(P8(e))return Ah("WeakMap");if(O8(e))return Ah("WeakSet");if(D8(e))return Ah("WeakRef");if($8(e))return Eo(v(Number(e)));if(T8(e))return Eo(v(nd.call(e)));if(C8(e))return Eo(m8.call(e));if(E8(e))return Eo(v(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof Yr<"u"&&e===Yr)return"{ [object globalThis] }";if(!A8(e)&&!Y0(e)){var ee=Ml(e,v),oe=q0?q0(e)===Object.prototype:e instanceof Object||e.constructor===Object,yn=e instanceof Object?"":"null prototype",wn=!oe&&ia&&Object(e)===e&&ia in e?qf.call(Nr(e),8,-1):yn?"Object":"",we=oe||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",bn=we+(wn||yn?"["+pn.call(V0.call([],wn||[],yn||[]),": ")+"] ":"");return ee.length===0?bn+"{}":m?bn+"{"+od(ee,m)+"}":bn+"{ "+pn.call(ee,", ")+" }"}return String(e)};function F1(n,e,t){var r=t.quoteStyle||e,i=Z1[r];return i+n+i}function S8(n){return Tr.call(String(n),/"/g,"&quot;")}function Bi(n){return!ia||!(typeof n=="object"&&(ia in n||typeof n[ia]<"u"))}function sd(n){return Nr(n)==="[object Array]"&&Bi(n)}function A8(n){return Nr(n)==="[object Date]"&&Bi(n)}function Y0(n){return Nr(n)==="[object RegExp]"&&Bi(n)}function k8(n){return Nr(n)==="[object Error]"&&Bi(n)}function E8(n){return Nr(n)==="[object String]"&&Bi(n)}function $8(n){return Nr(n)==="[object Number]"&&Bi(n)}function C8(n){return Nr(n)==="[object Boolean]"&&Bi(n)}function H1(n){if(no)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!rd)return!1;try{return rd.call(n),!0}catch{}return!1}function T8(n){if(!n||typeof n!="object"||!nd)return!1;try{return nd.call(n),!0}catch{}return!1}var R8=Object.prototype.hasOwnProperty||function(n){return n in this};function Tn(n,e){return R8.call(n,e)}function Nr(n){return g8.call(n)}function I8(n){if(n.name)return n.name;var e=y8.call(v8.call(n),/^function\s*([\w$]+)/);return e?e[1]:null}function V1(n,e){if(n.indexOf)return n.indexOf(e);for(var t=0,r=n.length;t<r;t++)if(n[t]===e)return t;return-1}function x8(n){if(!Mc||!n||typeof n!="object")return!1;try{Mc.call(n);try{Uc.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function P8(n){if(!na||!n||typeof n!="object")return!1;try{na.call(n,na);try{ra.call(n,ra)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function D8(n){if(!F0||!n||typeof n!="object")return!1;try{return F0.call(n),!0}catch{}return!1}function L8(n){if(!Uc||!n||typeof n!="object")return!1;try{Uc.call(n);try{Mc.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function O8(n){if(!ra||!n||typeof n!="object")return!1;try{ra.call(n,ra);try{na.call(n,na)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function z8(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function B1(n,e){if(n.length>e.maxStringLength){var t=n.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return B1(qf.call(n,0,e.maxStringLength),e)+r}var i=_8[e.quoteStyle||"single"];i.lastIndex=0;var s=Tr.call(Tr.call(n,i,"\\$1"),/[\x00-\x1f]/g,N8);return F1(s,"single",e)}function N8(n){var e=n.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+w8.call(e.toString(16))}function Eo(n){return"Object("+n+")"}function Ah(n){return n+" { ? }"}function K0(n,e,t,r){var i=r?od(t,r):pn.call(t,", ");return n+" ("+e+") {"+i+"}"}function M8(n){for(var e=0;e<n.length;e++)if(V1(n[e],`
2
- `)>=0)return!1;return!0}function U8(n,e){var t;if(n.indent===" ")t=" ";else if(typeof n.indent=="number"&&n.indent>0)t=pn.call(Array(n.indent+1)," ");else return null;return{base:t,prev:pn.call(Array(e+1),t)}}function od(n,e){if(n.length===0)return"";var t=`
3
- `+e.prev+e.base;return t+pn.call(n,","+t)+`
4
- `+e.prev}function Ml(n,e){var t=sd(n),r=[];if(t){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=Tn(n,i)?e(n[i],n):""}var s=typeof Sh=="function"?Sh(n):[],o;if(no){o={};for(var l=0;l<s.length;l++)o["$"+s[l]]=s[l]}for(var c in n)Tn(n,c)&&(t&&String(Number(c))===c&&c<n.length||no&&o["$"+c]instanceof Symbol||(M1.call(/[^\w$]/,c)?r.push(e(c,n)+": "+e(n[c],n)):r.push(c+": "+e(n[c],n))));if(typeof Sh=="function")for(var u=0;u<s.length;u++)U1.call(n,s[u])&&r.push("["+e(s[u])+"]: "+e(n[s[u]],n));return r}var Z8=fo,F8=J,Eu=function(n,e,t){for(var r=n,i;(i=r.next)!=null;r=i)if(i.key===e)return r.next=i.next,t||(i.next=n.next,n.next=i),i},H8=function(n,e){if(n){var t=Eu(n,e);return t&&t.value}},V8=function(n,e,t){var r=Eu(n,e);r?r.value=t:n.next={key:e,next:n.next,value:t}},B8=function(n,e){return n?!!Eu(n,e):!1},q8=function(n,e){if(n)return Eu(n,e,!0)},j8=function(){var e,t={assert:function(r){if(!t.has(r))throw new F8("Side channel does not contain "+Z8(r))},delete:function(r){var i=q8(e,r);return i&&e&&!e.next&&(e=void 0),!!i},get:function(r){return H8(e,r)},has:function(r){return B8(e,r)},set:function(r,i){e||(e={next:void 0}),V8(e,r,i)}};return t},W8=_t,bl=zr(),G8=fo,Y8=J,J0=W8("%Map%",!0),K8=bl("Map.prototype.get",!0),J8=bl("Map.prototype.set",!0),X8=bl("Map.prototype.has",!0),Q8=bl("Map.prototype.delete",!0),eA=bl("Map.prototype.size",!0),q1=!!J0&&function(){var e,t={assert:function(r){if(!t.has(r))throw new Y8("Side channel does not contain "+G8(r))},delete:function(r){if(e){var i=Q8(e,r);return eA(e)===0&&(e=void 0),i}return!1},get:function(r){if(e)return K8(e,r)},has:function(r){return e?X8(e,r):!1},set:function(r,i){e||(e=new J0),J8(e,r,i)}};return t},tA=_t,$u=zr(),nA=fo,Ul=q1,rA=J,ts=tA("%WeakMap%",!0),iA=$u("WeakMap.prototype.get",!0),sA=$u("WeakMap.prototype.set",!0),oA=$u("WeakMap.prototype.has",!0),aA=$u("WeakMap.prototype.delete",!0),lA=ts?function(){var e,t,r={assert:function(i){if(!r.has(i))throw new rA("Side channel does not contain "+nA(i))},delete:function(i){if(ts&&i&&(typeof i=="object"||typeof i=="function")){if(e)return aA(e,i)}else if(Ul&&t)return t.delete(i);return!1},get:function(i){return ts&&i&&(typeof i=="object"||typeof i=="function")&&e?iA(e,i):t&&t.get(i)},has:function(i){return ts&&i&&(typeof i=="object"||typeof i=="function")&&e?oA(e,i):!!t&&t.has(i)},set:function(i,s){ts&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new ts),sA(e,i,s)):Ul&&(t||(t=Ul()),t.set(i,s))}};return r}:Ul,cA=J,uA=fo,hA=j8,dA=q1,fA=lA,pA=fA||dA||hA,mA=function(){var e,t={assert:function(r){if(!t.has(r)){var i=r&&Object(r)===r?"the given object key":uA(r);throw new cA("Side channel does not contain "+i)}},delete:function(r){return!!e&&e.delete(r)},get:function(r){return e&&e.get(r)},has:function(r){return!!e&&e.has(r)},set:function(r,i){e||(e=pA()),e.set(r,i)}};return t},gA=Xn,$o=mA(),kn=J,jf={assert:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new kn("`O` is not an object");if(typeof e!="string")throw new kn("`slot` must be a string");if($o.assert(n),!jf.has(n,e))throw new kn("`"+e+"` is not present on `O`")},get:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new kn("`O` is not an object");if(typeof e!="string")throw new kn("`slot` must be a string");var t=$o.get(n);return t&&t["$"+e]},has:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new kn("`O` is not an object");if(typeof e!="string")throw new kn("`slot` must be a string");var t=$o.get(n);return!!t&&gA(t,"$"+e)},set:function(n,e,t){if(!n||typeof n!="object"&&typeof n!="function")throw new kn("`O` is not an object");if(typeof e!="string")throw new kn("`slot` must be a string");var r=$o.get(n);r||(r={},$o.set(n,r)),r["$"+e]=t}};Object.freeze&&Object.freeze(jf);var Wf=jf,j1=Kn,Ir=Wf,_l=function n(e,t){if(!(this instanceof n))return new n(e,t);if(e!=="normal"&&e!=="break"&&e!=="continue"&&e!=="return"&&e!=="throw")throw new j1('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');Ir.set(this,"[[Type]]",e),Ir.set(this,"[[Value]]",t)};_l.prototype.type=function(){return Ir.get(this,"[[Type]]")};_l.prototype.value=function(){return Ir.get(this,"[[Value]]")};_l.prototype["?"]=function(){var e=Ir.get(this,"[[Type]]"),t=Ir.get(this,"[[Value]]");if(e==="throw")throw t;return t};_l.prototype["!"]=function(){var e=Ir.get(this,"[[Type]]");if(e!=="normal")throw new j1('Assertion failed: Completion Record is not of type "normal"');return Ir.get(this,"[[Value]]")};var Gf=_l,vA=Gf,Yf=function(e){return new vA("normal",e)},kh,X0;function yA(){if(X0)return kh;X0=1;var n=lo;return kh=function(){return n()&&!!Symbol.toStringTag},kh}var wA=_t,Q0=wA("%Object.defineProperty%",!0),bA=yA()(),_A=Xn,SA=J,Zl=bA?Symbol.toStringTag:null,W1=function(e,t){var r=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof r<"u"&&typeof r!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new SA("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Zl&&(r||!_A(e,Zl))&&(Q0?Q0(e,Zl,{configurable:!i,enumerable:!1,value:t,writable:!1}):e[Zl]=t)},G1={exports:{}},AA=_t,em=h1,kA=Su(),tm=ao,nm=J,EA=AA("%Math.floor%"),$A=function(e,t){if(typeof e!="function")throw new nm("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||EA(t)!==t)throw new nm("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&tm){var o=tm(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(kA?em(e,"length",t,!0,!0):em(e,"length",t)),e},CA=ml,TA=zf(),RA=S1,IA=function(){return RA(CA,TA,arguments)};(function(n){var e=$A,t=pl,r=Au,i=IA;n.exports=function(o){var l=r(arguments),c=1+o.length-(arguments.length-1);return e(l,c>0?c:0,!0)},t?t(n.exports,"apply",{value:i}):n.exports.apply=i})(G1);var Kf=G1.exports,xA=function(e,t){for(var r=0;r<e.length;r+=1)if(!t(e[r],r,e))return!1;return!0},PA=Object,DA=function(e){return e&&typeof e=="object"&&(typeof e["[[ResourceValue]]"]>"u"||PA(e["[[ResourceValue]]"])===e["[[ResourceValue]]"])&&(e["[[Hint]]"]==="SYNC-DISPOSE"||e["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof e["[[DisposeMethod]]"]=="function"||typeof e["[[DisposeMethod]]"]>"u")},LA=Xn,OA=Nf(),zA=xA,NA=DA,MA=function(e){return e&&typeof e=="object"&&LA(e,"[[DisposableResourceStack]]")&&OA(e["[[DisposableResourceStack]]"])&&(e["[[DisposableResourceStack]]"].length===0||zA(e["[[DisposableResourceStack]]"],NA))},UA=Jn,ZA=function(e){if(e===null)return"Null";if(typeof e>"u")return"Undefined";if(UA(e))return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"},FA=ZA,Jf=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":FA(e)},HA=J,VA=fo,BA=uo,qA=function(e,t){if(!BA(t))throw new HA("Assertion failed: P is not a Property Key, got "+VA(t));return e[t]},rm=J,jA=qA,WA=ho,GA=uo,im=fo,YA=function(e,t){if(!GA(t))throw new rm("Assertion failed: P is not a Property Key");var r=jA(e,t);if(r!=null){if(!WA(r))throw new rm(im(t)+" is not a function: "+im(r));return r}},ad={exports:{}},KA=_t,JA=KA,sm=JA("%Reflect.construct%",!0),Zc=wl;try{Zc({},"",{"[[Get]]":function(){}})}catch{Zc=null}if(Zc&&sm){var om={},am={};Zc(am,"length",{"[[Get]]":function(){throw om},"[[Enumerable]]":!0}),ad.exports=function(e){try{sm(e,am)}catch(t){return t===om}}}else ad.exports=function(e){return typeof e=="function"&&!!e.prototype};var XA=ad.exports,Eh=J,lm=ho,QA=XA,ek=function(e){if(!QA(e))throw new Eh("C must be a constructor");var t={"[[Resolve]]":void 0,"[[Reject]]":void 0},r=new e(function(i,s){if(typeof t["[[Resolve]]"]<"u"||typeof t["[[Reject]]"]<"u")throw new Eh("executor has already been called");t["[[Resolve]]"]=i,t["[[Reject]]"]=s});if(!lm(t["[[Resolve]]"])||!lm(t["[[Reject]]"]))throw new Eh("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":t["[[Resolve]]"],"[[Reject]]":t["[[Reject]]"]}},cm=Kn,tk=J,$h=ku,um=YA,nk=ek,rk=Jf,hm=Ff(),dm=Hf(),ik=function(e,t){if(rk(e)!=="Object")throw new tk("`V` must be an Object");if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new cm("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(t==="ASYNC-DISPOSE"&&dm&&(r=um(e,dm)),!r){if(!hm)throw new cm("`Symbol.dispose` is not supported");if(r=um(e,hm),typeof r<"u")return function(){var i=this;if(t==="ASYNC-DISPOSE"){var s=nk(Promise);try{$h(r,i),$h(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}$h(r,i)}}return r},sk=Kn,Ch=J,ok=ho,ak=Jf,lk=ik,ck=function(e,t){if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new sk("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(arguments.length<3)if(e==null)e=void 0,r=void 0;else{if(typeof e<"u"&&ak(e)!=="Object")throw new Ch("`V` must be an Object, or `null` or `undefined`");if(r=lk(e,t),typeof r>"u")throw new Ch("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!ok(r))throw new Ch("`method`, when provided, must be a function");return{"[[ResourceValue]]":e,"[[Hint]]":t,"[[DisposeMethod]]":r}},uk=Kn,Fl=J,hk=MA,fm=ck,dk=zr(),fk=dk("Array.prototype.push"),Y1=function(e,t,r){if(!hk(e))throw new Fl("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new uk("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var i=arguments.length>3?arguments[3]:void 0;if(arguments.length>3&&typeof i!="function")throw new Fl("Assertion failed: `method`, when present, must be a function");if(!e["[[DisposableResourceStack]]"])throw new Fl("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(t==null&&r==="SYNC_DISPOSE")return"UNUSED";s=fm(t,r)}else{if(typeof t<"u")throw new Fl("Assertion failed: `V` must be undefined when `method` is present");s=fm(void 0,r,i)}return fk(e["[[DisposableResourceStack]]"],s),"UNUSED"},Th,pm;function Xf(){if(pm)return Th;pm=1;var n=_t,e=Kf,t=Kn,r=n("%Promise.resolve%",!0),i=r&&e(r);return Th=function(o,l){if(!i)throw new t("This environment does not support Promises.");return i(o,l)},Th}var Rh,mm;function pk(){if(mm)return Rh;mm=1;var n=_t,e=Kn,t=n("%Promise%",!0),r=ku,i=Xf(),s=Jf;return Rh=function(l,c,u){if(typeof l<"u"&&s(l)!=="Object")throw new e("Assertion failed: `V` must be `undefined` or an Object");if(c!=="SYNC-DISPOSE"&&c!=="ASYNC-DISPOSE")throw new e("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");if(typeof u<"u"&&typeof u!="function")throw new e("Assertion failed: `method` must be `undefined` or a function");var f=typeof u>"u"?u:r(u,l);if(c==="ASYNC-DISPOSE")return i(t,f)},Rh}var Ih,gm;function mk(){if(gm)return Ih;gm=1;var n=Gf;return Ih=function(t){return new n("throw",t)},Ih}var gk=_t,xh=Kn,vm=J,vk=gk("%Promise%",!0),yk=zr(),ym=yk("Promise.prototype.then",!0),wk=Gf,wm=pk(),bk=Yf,_k=Xf(),bm=mk(),Sk=N1(),K1=function(e,t){if(!(t instanceof wk))throw new vm("`completion` must be a Completion Record");var r=e["[[DisposableResourceStack]]"];if(!r)throw new vm("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");for(var i,s=r.length-1;s>=0;s-=1)if(!i)i=r[s]["[[Hint]]"];else if(i!==r[s]["[[Hint]]"])throw new xh("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&_k(vk,t),l=function(v){if(t.type()==="throw"){var y=t.value(),k=new Sk(v,y);t=bm(k)}else t=bm(v)},c=i==="ASYNC-DISPOSE"&&function(y){return ym(o,function(){var k=wm(y["[[ResourceValue]]"],y["[[Hint]]"],y["[[DisposeMethod]]"]);if(!k)throw new xh("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return ym(k,bk)},l)},u=r.length-1;u>=0;u-=1)if(i==="ASYNC-DISPOSE")o=c(r[u]);else{var f=r[u];try{var m=wm(f["[[ResourceValue]]"],f["[[Hint]]"],f["[[DisposeMethod]]"]);if(m)throw new xh("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(v){l(v)}}return e["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:t},J1=function(){var e=[];return{"[[DisposableResourceStack]]":e}},Cu=Pf,Qf=J,Ak=ku,po=Uf,kk=wl,X1=ho,Ek=Yf,Je=Wf,$k=W1,Q1=Vi.supportsDescriptors,Ck=Kf,ep=Y1,Tk=K1,ev=J1,_m=Ff(),yt=function n(){if(!(this instanceof n)||Je.has(this,"[[DisposableState]]")||Je.has(this,"[[DisposeCapability]]"))throw new Qf("can only be used with new");Je.set(this,"[[DisposableState]]","PENDING"),Je.set(this,"[[DisposeCapability]]",ev())},tv=function(){var e=this;return Je.assert(e,"[[DisposableState]]"),Je.get(e,"[[DisposableState]]")==="DISPOSED"},Sl=Ck(tv);Q1?kk(yt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":tv}):yt.prototype.disposed=!1;var nv=function(e){Je.set(e,"[[DisposableState]]","DISPOSED"),Q1||(e.disposed=!0)};po(yt.prototype,"dispose",function(){var e=this;if(!Sl(e))return nv(e),Tk(Je.get(e,"[[DisposeCapability]]"),Ek())["?"]()});po(yt.prototype,"use",function(e){var t=this;if(Sl(t))throw new Cu("a disposed stack can not use anything new");return ep(Je.get(t,"[[DisposeCapability]]"),e,"SYNC-DISPOSE"),e});po(yt.prototype,"adopt",function(e,t){var r=this;if(Sl(r))throw new Cu("a disposed stack can not use anything new");if(!X1(t))throw new Qf("`onDispose` must be a function");var i=function(){return Ak(t,void 0,[e])};return ep(Je.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),e});po(yt.prototype,"defer",function(e){var t=this;if(Sl(t))throw new Cu("a disposed stack can not defer anything new");if(!X1(e))throw new Qf("`onDispose` must be a function");ep(Je.get(t,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",e)});po(yt.prototype,"move",function(){var e=this;if(Sl(e))throw new Cu("a disposed stack can not use anything new");var t=new yt;return Je.set(t,"[[DisposeCapability]]",Je.get(e,"[[DisposeCapability]]")),Je.set(e,"[[DisposeCapability]]",ev()),nv(e),t});_m&&po(yt.prototype,_m,yt.prototype.dispose);$k(yt.prototype,"DisposableStack");var Rk=yt,Ik=Rk,xk=function(){return typeof DisposableStack=="function"?DisposableStack:Ik},Pk=Vi,Dk=If(),Lk=xk,Ok=function(){var e=Lk();return Pk(Dk,{DisposableStack:e},{DisposableStack:!0}),e},zk=_t,Tu=Pf,tp=J,Sm=zk("%Promise%",!0),np=Y1,Nk=ku,mo=Uf,Mk=wl,Uk=K1,rv=ho,iv=J1,Zk=Yf,Am=Xf(),Xe=Wf,Fk=W1,sv=Vi.supportsDescriptors,Hk=Kf,Vk=zr(),Bk=Vk("Promise.prototype.then",!0),km=Hf(),wt=function n(){if(!(this instanceof n)||Xe.has(this,"[[AsyncDisposableState]]")||Xe.has(this,"[[DisposeCapability]]"))throw new tp("can only be used with new");Xe.set(this,"[[AsyncDisposableState]]","pending"),Xe.set(this,"[[DisposeCapability]]",iv())},ov=function(){var e=this;return Xe.assert(e,"[[AsyncDisposableState]]"),Xe.get(e,"[[AsyncDisposableState]]")==="disposed"},Al=Hk(ov);sv?Mk(wt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":ov}):wt.prototype.disposed=!1;var av=function(e){Xe.set(e,"[[AsyncDisposableState]]","disposed"),sv||(e.disposed=!0)};mo(wt.prototype,"disposeAsync",function(){var e=this;return Al(e)?Am(Sm):(av(e),Bk(Am(Sm,Uk(Xe.get(e,"[[DisposeCapability]]"),Zk())),function(t){return t["?"]()}))});mo(wt.prototype,"use",function(e){var t=this;if(Al(t))throw new Tu("a disposed stack can not use anything new");return np(Xe.get(t,"[[DisposeCapability]]"),e,"ASYNC-DISPOSE"),e});mo(wt.prototype,"adopt",function(e,t){var r=this;if(Al(r))throw new Tu("a disposed stack can not use anything new");if(!rv(t))throw new tp("`onDisposeAsync` must be a function");var i=function(){return Nk(t,void 0,[e])};return i.value=e,np(Xe.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),e});mo(wt.prototype,"defer",function(e){var t=this;if(Al(t))throw new Tu("a disposed stack can not defer anything new");if(!rv(e))throw new tp("`onDispose` must be a function");np(Xe.get(t,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",e)});mo(wt.prototype,"move",function(){var e=this;if(Al(e))throw new Tu("a disposed stack can not use anything new");var t=new wt;return Xe.set(t,"[[DisposeCapability]]",Xe.get(e,"[[DisposeCapability]]")),Xe.set(e,"[[DisposeCapability]]",iv()),av(e),t});km&&mo(wt.prototype,km,wt.prototype.disposeAsync);Fk(wt.prototype,"AsyncDisposableStack");var qk=wt,jk=qk,Wk=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:jk},Gk=Vi,Yk=If(),Kk=Wk,Jk=function(){var e=Kk();return Gk(Yk,{AsyncDisposableStack:e},{AsyncDisposableStack:!0}),e},Xk=G6,Qk=n8,eE=Ok,tE=Jk,nE=function(){Xk(),Qk(),eE(),tE()};nE();const Em=new WeakMap;function rE(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function ns(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function $m(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function iE(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class sE{constructor(){$(this,"entries",new Map);$(this,"constructionStack",[])}register(e,t){if(t===void 0){if(typeof e!="function")throw $m();this.validateClassRegistration(e),this.storeFactory(e,()=>this.instantiateClass(e));return}if(typeof t!="function")throw $m();if(t.constructor.name==="AsyncFunction")throw iE();this.storeFactory(e,t)}has(e){var t;return((t=this.entries.get(e))==null?void 0:t.factory)!==void 0}resolve(e){return this.resolveAny(e)}storeFactory(e,t){const r=this.getOrCreateEntry(e);r.factory=t,r.instance=void 0,r.error=void 0}validateClassRegistration(e){const t=Em.get(e);if(t){if(e.length!==t.length)throw new Error(`${ns(e)} cannot be registered with register(Class). @injectable(...) declared ${t.length} dependencies but constructor arity is ${e.length}. Use register(Key, () => value) instead.`);return}if(e.length!==0)throw new Error(`${ns(e)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(e){const t=Em.get(e);if(!t)return new e;const r=t.map(i=>this.resolveAny(i));return new e(...r)}resolveAny(e){return this.getOrCreateEntry(e).proxy}getOrCreateEntry(e){let t=this.entries.get(e);return t||(t={key:e},t.proxy=this.createProxy(t),this.entries.set(e,t),t)}createProxy(e){return new Proxy({},{get:(t,r)=>{if(r==="then")return;const i=this.getInstance(e),s=Reflect.get(i,r,i);return typeof s=="function"?s.bind(i):s},set:(t,r,i)=>{const s=this.getInstance(e);return Reflect.set(s,r,i,s)},has:(t,r)=>{const i=this.getInstance(e);return r in i}})}getInstance(e){if(e.instance)return e.instance;if(e.error)throw e.error;if(!e.factory)throw new Error(`${ns(e.key)} was resolved but never registered`);const t=this.constructionStack.indexOf(e.key);if(t!==-1){const r=[...this.constructionStack.slice(t),e.key].map(i=>ns(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(e.key);try{const r=e.factory();if(rE(r))throw new Error(`Factory for ${ns(e.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${ns(e.key)} returned a non-object value. Wrap primitives in an object.`);return e.instance=r,r}catch(r){throw e.error=r,r}finally{this.constructionStack.pop()}}}const lv=new sE,oE=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function aE(n){for(const e of Object.keys(n))if(oE.has(e))throw new Error(`Event payload key "${e}" is reserved; choose a different property name`)}function lE(n,e){aE(e);for(const t of Object.keys(e))Object.defineProperty(n,t,{value:e[t],writable:!0,enumerable:!0,configurable:!0})}function Lt(){class n extends Event{constructor(t,r){const{type:i,bubbles:s,cancelable:o,composed:l,...c}=r??{};if(i!==void 0)throw new Error('Do not pass "type" in init; use the constructor argument instead');super(t,{bubbles:s,cancelable:o,composed:l}),lE(this,c)}}return n}class Mr extends globalThis.EventTarget{}const cE="X-Television-Client-Meta",uE="telemetry-activity",hE="telemetry-signal",cv={kind:"single",full_screen:!1},uv={width:560,height:740};function dE(n){return n.layout.flatMap(e=>e.artifactIds)}function fE(n){if(!Array.isArray(n))return{valid:!1,errors:["Layout must be an array of pages"]};const e=[];for(const[t,r]of n.entries())pE(r,t,e);return{valid:e.length===0,errors:e}}function ca(n){return n.flatMap(e=>e.artifactIds)}function ld(n,e){return n.flatMap(t=>{if(!t.artifactIds.includes(e))return[t];const r=t.artifactIds.filter(i=>i!==e);return r.length===0?[]:[{...t,artifactIds:r}]})}function pE(n,e,t){if(!Ph(n)){t.push(`Page ${e} must be an object`);return}for(const r of Object.keys(n))r!=="artifactIds"&&r!=="geometry"&&r!=="size"&&t.push(`Page ${e} has unknown field: ${r}`);if(!Array.isArray(n.artifactIds)||n.artifactIds.length===0?t.push(`Page ${e} must contain at least one artifact id`):n.artifactIds.some(r=>typeof r!="string"||r.length===0)&&t.push(`Page ${e} artifact ids must be non-empty strings`),!Ph(n.geometry)){t.push(`Page ${e} geometry must be an object`);return}for(const r of Object.keys(n.geometry))r!=="kind"&&r!=="full_screen"&&t.push(`Page ${e} geometry has unknown field: ${r}`);if(n.geometry.kind!=="single"){t.push(`Page ${e} has unknown geometry kind: ${String(n.geometry.kind)}`);return}if(typeof n.geometry.full_screen!="boolean"&&t.push(`Page ${e} single geometry must include a boolean full_screen`),!Ph(n.size)){t.push(`Page ${e} size must be an object`);return}for(const r of Object.keys(n.size))r!=="width"&&r!=="height"&&t.push(`Page ${e} size has unknown field: ${r}`);for(const r of["width","height"]){const i=n.size[r];(typeof i!="number"||!Number.isFinite(i)||i<=0)&&t.push(`Page ${e} size ${r} must be a finite positive number`)}}function Ph(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const gt=Lt(),dc=Lt(),Cm=Lt(),mE=Lt(),gE=Lt();function hv(n){class e extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return e}const go=hv("RequestError"),Tm=hv("ValidationError"),vE=200,yE=300,Hl=401;class wE{constructor(e,t){$(this,"serverURL");$(this,"token");$(this,"onUnauthorized");$(this,"telemetryMeta");this.serverURL=e.replace(/\/$/,""),this.token=t.token,this.onUnauthorized=t.onUnauthorized,this.telemetryMeta=t.telemetryMeta}async requestJSON(e,t,r){var o;const i=await this.request(e,t,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0),s=await bE(i);if(!i.ok||i.status<vE||i.status>=yE)throw i.status===Hl&&((o=this.onUnauthorized)==null||o.call(this)),this.createError(typeof s.error=="string"?s.error:i.statusText,i.status);return s}async requestVoid(e,t,r){var s;const i=await this.request(e,t,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0);if(!i.ok)throw i.status===Hl&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await Dh(i,i.statusText),i.status)}async requestText(e,t){var i;const r=await this.request(e,t);if(!r.ok)throw r.status===Hl&&((i=this.onUnauthorized)==null||i.call(this)),this.createError(await Dh(r,r.statusText),r.status);return r.text()}async requestRawVoid(e,t,r){var s;const i=await this.request(e,t,r,{"content-type":"text/markdown; charset=utf-8"});if(!i.ok)throw i.status===Hl&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await Dh(i,i.statusText),i.status)}createError(e,t){const r={serverURL:this.serverURL};return t!==void 0&&(r.status=t),new go(e,r)}async request(e,t,r,i){const s=`${this.serverURL}${t}`;try{return await fetch(s,{method:e,headers:this.buildHeaders(i),body:r})}catch(o){throw this.createError(o instanceof Error?o.message:"Failed to reach server")}}buildHeaders(e){const t={...e??{}};return this.token&&(t.Authorization=`Bearer ${this.token}`),this.telemetryMeta&&(t[cE]=JSON.stringify(this.telemetryMeta)),Object.keys(t).length>0?t:void 0}}async function bE(n){try{return await n.json()}catch{const e=await n.text().catch(()=>"");return e?{message:e}:{}}}async function Dh(n,e){try{const t=await n.json();if(typeof t.error=="string")return t.error;if(typeof t.message=="string")return t.message}catch{}return e}function _E(n){return n.map(e=>`${e.name} (${e.id})`).join(", ")}var In,tu,dv;class SE{constructor(e){g(this,tu);g(this,In);d(this,In,e)}list(){return a(this,In).requestJSON("GET","/channels")}async get(e={}){const t=await h(this,tu,dv).call(this,e.channelID);return a(this,In).requestJSON("GET",`/channels/${encodeURIComponent(t)}`)}create(e){const t={name:e.name};return e.id!==void 0&&(t.id=e.id),a(this,In).requestJSON("POST","/channels",t)}update(e){const{channelID:t,...r}=e;return a(this,In).requestJSON("PATCH",`/channels/${encodeURIComponent(t)}`,r)}remove(e){return a(this,In).requestJSON("DELETE",`/channels/${encodeURIComponent(e.channelID)}`)}}In=new WeakMap,tu=new WeakSet,dv=async function(e){if(e!==void 0)return e;const{channels:t}=await this.list();if(t.length===1)return t[0].id;throw t.length===0?new Tm("channelID is required, but no channels exist."):new Tm(`channelID is required when multiple channels exist. Available channels: ${_E(t)}`)};var xn;class AE{constructor(e){g(this,xn);d(this,xn,e)}create(e){const t={kind:e.kind,title:e.title};switch(e.kind){case"path":t.path=e.path;break;case"url":t.url=e.url;break}return t.channelID=e.channelID,a(this,xn).requestJSON("POST","/artifacts",t)}list(e={}){const t=new URLSearchParams;e.channelID!==void 0&&t.set("channelID",e.channelID);const r=t.toString();return a(this,xn).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(e){return a(this,xn).requestJSON("GET",`/artifacts/${encodeURIComponent(e.artifactID)}`)}update(e){const t={};return e.title!==void 0&&(t.title=e.title),e.path!==void 0&&(t.path=e.path),e.url!==void 0&&(t.url=e.url),a(this,xn).requestJSON("PATCH",`/artifacts/${encodeURIComponent(e.artifactID)}`,t)}delete(e){return a(this,xn).requestJSON("DELETE",`/artifacts/${encodeURIComponent(e.artifactID)}`)}}xn=new WeakMap;var bs;class kE{constructor(e){g(this,bs);d(this,bs,e)}get(e){return a(this,bs).requestText("GET",`/markdown/${encodeURIComponent(e.artifactID)}`)}update(e){return a(this,bs).requestRawVoid("PUT",`/markdown/${encodeURIComponent(e.artifactID)}`,e.content)}}bs=new WeakMap;var ei;class EE{constructor(e){g(this,ei);d(this,ei,e)}status(){return a(this,ei).requestJSON("GET","/telemetry")}enable(){return a(this,ei).requestJSON("POST","/telemetry/enable")}disable(){return a(this,ei).requestJSON("POST","/telemetry/disable")}}ei=new WeakMap;var ti;class $E{constructor(e){g(this,ti);d(this,ti,e)}get(){return a(this,ti).requestJSON("GET","/display")}patch(e){const t={};return e.focusedChannelId!==void 0&&(t.focusedChannelId=e.focusedChannelId),e.pinnedChannelIds!==void 0&&(t.pinnedChannelIds=e.pinnedChannelIds),e.activeThemeName!==void 0&&(t.activeThemeName=e.activeThemeName),a(this,ti).requestVoid("PATCH","/display",t)}focus(e){return a(this,ti).requestJSON("POST","/display/focus",{artifactID:e.artifactID})}}ti=new WeakMap;var Vt;class CE{constructor(e,t={}){$(this,"channels");$(this,"artifacts");$(this,"display");$(this,"markdown");$(this,"telemetry");g(this,Vt);d(this,Vt,new wE(e,t)),this.channels=new SE(a(this,Vt)),this.artifacts=new AE(a(this,Vt)),this.display=new $E(a(this,Vt)),this.markdown=new kE(a(this,Vt)),this.telemetry=new EE(a(this,Vt))}health(){return a(this,Vt).requestJSON("GET","/health")}}Vt=new WeakMap;const cd="0.0.0",TE=/^\d+\.\d+\.\d+$/,RE=3;function rp(n){return TE.test(n)}function fv(n,e){const t=n.split(".").map(Number),r=e.split(".").map(Number);for(let i=0;i<RE;i++)if(t[i]!==r[i])return t[i]>r[i];return!1}function IE(n,e){return n===cd||e===cd?!1:n!==e}const xE=400,PE=404,pv=500,DE=600,LE={focusedChannelId:null,pinnedChannelIds:[],activeThemeName:null,acpEnabled:!1};var te,ga,va,Pn,Ae,ae,ni,ir,ri,Dn,tt,_s,ya,P,qr,ud,hd,mv,dd,gv,fc,fd,vv,os,yv,$n,pd,wv,Ze;class OE extends Mr{constructor(t){super();g(this,P);g(this,te);g(this,ga);g(this,va);g(this,Pn,new Set);$(this,"pendingPageWrites",new Map);g(this,Ae,new Map);g(this,ae,ME());g(this,ni);g(this,ir,!1);g(this,ri,!1);g(this,Dn,0);g(this,tt,!1);g(this,_s,()=>{if(a(this,tt))return;const t=a(this,te).connection.status==="connected";t&&!a(this,ri)?(d(this,ri,!0),h(this,P,yv).call(this)):!t&&a(this,ri)&&(d(this,ri,!1),d(this,Dn,a(this,Dn)+1)),h(this,P,$n).call(this)});g(this,ya,t=>{if(a(this,tt)||t.serverURL!==a(this,te).connection.url)return;for(const i of a(this,Pn))i.push(t.event);const r=t.event;if(r.type==="artifact-content-changed"){this.dispatchEvent(new Cm("artifact-content-changed",{artifactID:r.artifactID}));return}if(r.type==="artifact-focus"){a(this,ir)&&Fc(a(this,ae),a(this,Ae),r.channelID,r.artifactID)&&h(this,P,$n).call(this),this.dispatchEvent(new mE("artifact-focus",{channelID:r.channelID,artifactID:r.artifactID}));return}r.type==="theme-changed"&&this.dispatchEvent(new gE("theme-changed",{themeName:r.themeName})),a(this,ir)&&(Vl(a(this,ae),r,this.pendingPageWrites,a(this,Ae)),Lh(a(this,ae),a(this,Ae)),h(this,P,$n).call(this))});d(this,te,t.connectionOwner),d(this,ga,t.navigationKeyHandler),d(this,va,t.retainedGateHalted??(()=>!1)),d(this,ni,h(this,P,pd).call(this)),a(this,te).addEventListener("change",a(this,_s)),a(this,te).addEventListener("server-event",a(this,ya)),a(this,_s).call(this)}get snapshot(){return a(this,ni)}handleNavigationKey(t){var r;h(this,P,Ze).call(this),(r=a(this,ga))==null||r.call(this,t)}authenticate(t){return h(this,P,Ze).call(this),a(this,te).authenticate(t)}async createChannel(t){h(this,P,Ze).call(this);const{channel:r}=await h(this,P,qr).call(this,a(this,te).connection.client.channels.create({name:t}),()=>h(this,P,mv).call(this));return r}focusChannel(t){return h(this,P,Ze).call(this),h(this,P,qr).call(this,a(this,te).connection.client.display.patch({focusedChannelId:t}),()=>h(this,P,hd).call(this))}setPinnedChannelIds(t){return h(this,P,Ze).call(this),h(this,P,qr).call(this,a(this,te).connection.client.display.patch({pinnedChannelIds:[...t]}),()=>h(this,P,hd).call(this))}selectPage(t,r){h(this,P,Ze).call(this),Fc(a(this,ae),a(this,Ae),t,r)&&h(this,P,$n).call(this)}async renameChannel(t,r){h(this,P,Ze).call(this),await h(this,P,qr).call(this,a(this,te).connection.client.channels.update({channelID:t,name:r}),()=>h(this,P,dd).call(this,t))}async deleteChannel(t){h(this,P,Ze).call(this),await h(this,P,qr).call(this,a(this,te).connection.client.channels.remove({channelID:t}),()=>h(this,P,gv).call(this,t))}updateChannelPages(t,r){h(this,P,Ze).call(this);const i=fE(r),s=a(this,ae).channels.get(t);if(!i.valid||!s)return Promise.resolve();const o=Jr(r),l=Jr(s.channel.layout),c={previousPages:l};return Ui(a(this,Ae),t,l,o),s.channel={...s.channel,layout:o},this.pendingPageWrites.set(t,c),h(this,P,$n).call(this),a(this,te).connection.client.channels.update({channelID:t,layout:Jr(o)}).then(()=>{this.pendingPageWrites.get(t)===c&&this.pendingPageWrites.delete(t)},async u=>{if(a(this,tt))throw u;const f=this.pendingPageWrites.get(t)===c;if(f&&this.pendingPageWrites.delete(t),Im(u))throw await h(this,P,ud).call(this,()=>h(this,P,dd).call(this,t)),u;if(!f||!VE(u))throw u;const m=a(this,ae).channels.get(t);if(!m)throw u;const v=Jr(c.previousPages);throw Ui(a(this,Ae),t,m.channel.layout,v),m.channel={...m.channel,layout:v},h(this,P,$n).call(this),u})}async deleteArtifact(t){h(this,P,Ze).call(this);const r=xm(a(this,ae),t);await h(this,P,qr).call(this,a(this,te).connection.client.artifacts.delete({artifactID:t}),()=>h(this,P,vv).call(this,t,r))}readMarkdown(t){return h(this,P,Ze).call(this),a(this,te).connection.client.markdown.get({artifactID:t})}writeMarkdown(t,r){return h(this,P,Ze).call(this),a(this,te).connection.client.markdown.update({artifactID:t,content:r})}getArtifactViewURL(t){return h(this,P,Ze).call(this),a(this,te).connection.getViewURL(t)}getArtifactContentURL(t){return h(this,P,Ze).call(this),a(this,te).connection.getContentURL(t)}dispose(){a(this,tt)||(d(this,tt,!0),d(this,Dn,a(this,Dn)+1),a(this,Pn).clear(),this.pendingPageWrites.clear(),a(this,Ae).clear(),a(this,te).removeEventListener("change",a(this,_s)),a(this,te).removeEventListener("server-event",a(this,ya)))}}te=new WeakMap,ga=new WeakMap,va=new WeakMap,Pn=new WeakMap,Ae=new WeakMap,ae=new WeakMap,ni=new WeakMap,ir=new WeakMap,ri=new WeakMap,Dn=new WeakMap,tt=new WeakMap,_s=new WeakMap,ya=new WeakMap,P=new WeakSet,qr=async function(t,r){try{return await t}catch(i){throw!a(this,tt)&&Im(i)&&await h(this,P,ud).call(this,r),i}},ud=async function(t){try{await t()}catch{}},hd=function(){const t=a(this,te).connection.client;return h(this,P,os).call(this,()=>t.display.get(),r=>h(this,P,fc).call(this,r))},mv=function(){const t=a(this,te).connection.client;return h(this,P,os).call(this,async()=>{const[{channels:r},i]=await Promise.all([t.channels.list(),t.display.get()]);return{channels:r,display:i}},({channels:r,display:i})=>{const s=new Set(r.map(({id:o})=>o));for(const o of a(this,ae).channels.keys())s.has(o)||(this.pendingPageWrites.delete(o),a(this,Ae).delete(o),a(this,ae).channels.delete(o));for(const o of r)a(this,ae).channels.has(o.id)||a(this,ae).channels.set(o.id,{channel:ys(o),artifacts:new Map});h(this,P,fc).call(this,i)})},dd=function(t){const r=a(this,te).connection.client;return h(this,P,os).call(this,()=>Oh(()=>r.channels.get({channelID:t})),i=>h(this,P,fd).call(this,t,i))},gv=function(t){const r=a(this,te).connection.client;return h(this,P,os).call(this,async()=>{const[i,s]=await Promise.all([Oh(()=>r.channels.get({channelID:t})),r.display.get()]);return{detail:i,display:s}},({detail:i,display:s})=>{h(this,P,fd).call(this,t,i),h(this,P,fc).call(this,s)})},fc=function(t){a(this,ae).display=gd(t),a(this,te).connection.acpClient.setEnabled(t.acpEnabled)},fd=function(t,r){this.pendingPageWrites.delete(t);const i=a(this,ae).channels.get(t);if(r===null){a(this,Ae).delete(t),a(this,ae).channels.delete(t);return}Ui(a(this,Ae),t,(i==null?void 0:i.channel.layout)??[],r.channel.layout),a(this,ae).channels.set(t,{channel:ys(r.channel),artifacts:new Map(r.artifacts.map(s=>[s.id,structuredClone(s)]))})},vv=function(t,r){const i=a(this,te).connection.client;return h(this,P,os).call(this,()=>Oh(()=>i.artifacts.get({artifactID:t})),s=>{const o=xm(a(this,ae),t)??r;if(s===null){o!==null&&Vl(a(this,ae),{type:"artifact-removed",channelID:o,artifactID:t},this.pendingPageWrites,a(this,Ae));return}const l=o===null?void 0:a(this,ae).channels.get(o);l==null||l.artifacts.set(t,structuredClone(s.artifact))})},os=async function(t,r){const i=a(this,Dn),s=[];a(this,Pn).add(s);try{const o=await t();if(a(this,tt)||i!==a(this,Dn))return;r(o);for(const l of s)Vl(a(this,ae),l,this.pendingPageWrites,a(this,Ae));Lh(a(this,ae),a(this,Ae)),h(this,P,$n).call(this)}finally{a(this,Pn).delete(s)}},yv=async function(){const t=++sh(this,Dn)._,r=a(this,te).connection,i=r.client,s=[];a(this,Pn).add(s);try{const[{channels:o},l]=await Promise.all([i.channels.list(),i.display.get()]),c=await Promise.all(o.map(({id:m})=>i.channels.get({channelID:m})));if(a(this,tt)||t!==a(this,Dn))return;const u={channels:new Map,display:gd(l)};for(const m of c)u.channels.set(m.channel.id,{channel:ys(m.channel),artifacts:new Map(m.artifacts.map(v=>[v.id,structuredClone(v)]))});UE(a(this,Ae),a(this,ae),u);for(const m of s)Vl(u,m,this.pendingPageWrites,a(this,Ae));Lh(u,a(this,Ae));const f=a(this,ir)?zE(a(this,ae),u):[];this.pendingPageWrites.clear(),d(this,ae,u),d(this,ir,!0),r.acpClient.setEnabled(l.acpEnabled),h(this,P,$n).call(this);for(const m of f)this.dispatchEvent(new Cm("artifact-content-changed",{artifactID:m}))}catch{}finally{a(this,Pn).delete(s)}},$n=function(){a(this,tt)||(d(this,ni,h(this,P,pd).call(this)),h(this,P,wv).call(this),this.dispatchEvent(new gt("change")))},pd=function(){var s;const t=[...a(this,ae).channels.values()].map(o=>FE(o,a(this,Ae).get(o.channel.id))),r=t.find(({id:o})=>o===a(this,ae).display.focusedChannelId)??null,i=a(this,te).connection;return Object.freeze({ready:a(this,ir),channels:Object.freeze(t),display:HE(a(this,ae).display),focusedChannel:r,connection:Object.freeze({authorizationRequired:i.hasAuthRejected,authorizationRejected:i.hasAuthTokenRejected,gateHalted:i.bootState==="halted"||a(this,va).call(this),status:i.status,hasEverConnected:i.hasEverConnected,firstConnectError:i.hasEverConnected?null:a(this,te).connectError,nextRetryAt:i.nextRetryAt,upgradeInstructions:NE(((s=i.updateState)==null?void 0:s.desktop)??null)})})},wv=function(){const t=a(this,ni).focusedChannel;a(this,te).connection.acpClient.setChannelContext(t?{channelID:t.id,channelName:t.name}:null)},Ze=function(){if(a(this,tt))throw new Error("ApplicationService is disposed")};function zE(n,e){const t=e.display.focusedChannelId;if(t===null||n.display.focusedChannelId!==t)return[];const r=n.channels.get(t),i=e.channels.get(t);if(!r||!i)return[];const s=new Set(ca(r.channel.layout));return ca(i.channel.layout).filter(o=>{var l,c;return s.has(o)&&((l=r.artifacts.get(o))==null?void 0:l.kind)==="path"&&((c=i.artifacts.get(o))==null?void 0:c.kind)==="path"})}function NE(n){return n===null?null:Object.freeze({...n})}function ME(){return{channels:new Map,display:gd(LE)}}function Vl(n,e,t,r){switch(e.type){case"channel-created":r.delete(e.channel.id),n.channels.set(e.channel.id,{channel:ys(e.channel),artifacts:new Map});return;case"channel-updated":{t.delete(e.channel.id);const i=n.channels.get(e.channel.id);if(!i){r.delete(e.channel.id),n.channels.set(e.channel.id,{channel:ys(e.channel),artifacts:new Map});return}Ui(r,e.channel.id,i.channel.layout,e.channel.layout);const s=new Set(ca(e.channel.layout));i.channel=ys(e.channel);for(const o of i.artifacts.keys())s.has(o)||i.artifacts.delete(o);return}case"channel-removed":t.delete(e.channelID),r.delete(e.channelID),n.channels.delete(e.channelID);return;case"channel-changed":n.display.focusedChannelId=e.channelID;return;case"pinned-channels-changed":n.display.pinnedChannelIds=[...e.pinnedChannelIds];return;case"theme-changed":n.display.activeThemeName=e.themeName;return;case"artifact-created":{const i=n.channels.get(e.channelID);if(!i)return;const s=t.get(e.channelID);if(s&&(s.previousPages=Rm(s.previousPages,e.artifact.id)),!ca(i.channel.layout).includes(e.artifact.id)){const o=i.channel.layout,l=Rm(o,e.artifact.id);Ui(r,e.channelID,o,l),i.channel={...i.channel,layout:l}}i.artifacts.set(e.artifact.id,structuredClone(e.artifact));return}case"artifact-updated":for(const i of n.channels.values())if(i.artifacts.has(e.artifact.id)){i.artifacts.set(e.artifact.id,structuredClone(e.artifact));return}return;case"artifact-removed":{const i=n.channels.get(e.channelID);if(!i)return;const s=t.get(e.channelID);s&&(s.previousPages=ld(s.previousPages,e.artifactID)),i.artifacts.delete(e.artifactID);const o=i.channel.layout,l=ld(o,e.artifactID);Ui(r,e.channelID,o,l),i.channel={...i.channel,layout:l};return}case"artifact-focus":Fc(n,r,e.channelID,e.artifactID);return;case"artifact-content-changed":return;default:return BE(e)}}function UE(n,e,t){var r;for(const i of n.keys())t.channels.has(i)||n.delete(i);for(const[i,s]of t.channels)Ui(n,i,((r=e.channels.get(i))==null?void 0:r.channel.layout)??[],s.channel.layout)}function Ui(n,e,t,r){const i=n.get(e);if(i===void 0)return;if(r.length===0){n.delete(e);return}const s=md(r,i);if(s!==-1){n.set(e,[...r[s].artifactIds]);return}const o=md(t,i),l=o===-1?0:Math.min(o,r.length-1);n.set(e,[...r[l].artifactIds])}function Fc(n,e,t,r){const i=n.channels.get(t),s=i==null?void 0:i.channel.layout.find(({artifactIds:l})=>l.includes(r));if(!s)return!1;const o=e.get(t);return o&&ZE(o,s.artifactIds)?!1:(e.set(t,[...s.artifactIds]),!0)}function Lh(n,e){var i,s;const t=n.display.focusedChannelId;if(t===null||e.has(t))return;const r=(s=(i=n.channels.get(t))==null?void 0:i.channel.layout[0])==null?void 0:s.artifactIds[0];r!==void 0&&Fc(n,e,t,r)}function md(n,e){const t=new Set(e);return n.findIndex(r=>r.artifactIds.some(i=>t.has(i)))}function ZE(n,e){return n.length===e.length&&n.every((t,r)=>t===e[r])}function FE(n,e){const t=Object.freeze(n.channel.layout.map(l=>Object.freeze({artifactIds:Object.freeze([...l.artifactIds]),geometry:Object.freeze({...l.geometry}),size:Object.freeze({...l.size})}))),r=e===void 0?0:md(n.channel.layout,e),i=t[r]??t[0]??null,s=Object.freeze([...n.artifacts.values()].map(l=>Object.freeze(structuredClone(l)))),o={id:n.channel.id,name:n.channel.name,pages:t,selectedPage:i,artifacts:s};return Object.freeze(n.channel.onboarding?{...o,onboarding:Object.freeze({...n.channel.onboarding})}:o)}function HE(n){return Object.freeze({focusedChannelId:n.focusedChannelId,pinnedChannelIds:Object.freeze([...n.pinnedChannelIds]),activeThemeName:n.activeThemeName,acpEnabled:n.acpEnabled})}function Rm(n,e){return ca(n).includes(e)?Jr(n):[...Jr(n),{artifactIds:[e],geometry:{...cv},size:{...uv}}]}function VE(n){return n instanceof go&&n.status!==void 0&&n.status>=xE&&n.status<pv}function Im(n){return n instanceof go&&(n.status===void 0||n.status>=pv&&n.status<DE)}async function Oh(n){try{return await n()}catch(e){if(e instanceof go&&e.status===PE)return null;throw e}}function xm(n,e){for(const[t,r]of n.channels)if(r.artifacts.has(e))return t;return null}function Jr(n){return n.map(e=>({artifactIds:[...e.artifactIds],geometry:{...e.geometry},size:{...e.size}}))}function ys(n){return{id:n.id,name:n.name,layout:Jr(n.layout),...n.onboarding?{onboarding:{...n.onboarding}}:{}}}function gd(n){return{focusedChannelId:n.focusedChannelId,pinnedChannelIds:[...n.pinnedChannelIds],activeThemeName:n.activeThemeName,acpEnabled:n.acpEnabled}}function BE(n){throw new Error(`Unexpected server event: ${JSON.stringify(n)}`)}function qE(n,e){var c;const t=n.snapshot,r=t.focusedChannel;if(e==="ArrowLeft"||e==="ArrowRight"){if(r===null||r.selectedPage===null)return!1;const u=r.pages.indexOf(r.selectedPage),f=u+(e==="ArrowLeft"?-1:1),m=(c=r.pages[f])==null?void 0:c.artifactIds[0];return u===-1||m===void 0?!1:(Pm(),n.selectPage(r.id,m),!0)}const i=jE(t),s=r===null?-1:i.indexOf(r.id),o=s+(e==="ArrowUp"?-1:1),l=i[o];return s===-1||l===void 0?!1:(Pm(),n.focusChannel(l).catch(()=>{}),!0)}function jE(n){const e=new Map(n.channels.map(s=>[s.id,s])),t=n.display.pinnedChannelIds.filter(s=>e.has(s)),r=new Set(t),i=n.channels.filter(({id:s})=>!r.has(s)).map(({id:s})=>s).sort((s,o)=>o.localeCompare(s));return[...t,...i]}function Pm(){const n=document.activeElement;n instanceof HTMLElement&&n.blur()}const bv="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Hc=32,WE=16,_v=10,Dm=0xffffffffffff;var Xr;(function(n){n.Base32IncorrectEncoding="B32_ENC_INVALID",n.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",n.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",n.EncodeTimeNegative="ENC_TIME_NEG",n.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",n.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",n.PRNGDetectFailure="PRNG_DETECT",n.ULIDInvalid="ULID_INVALID",n.Unexpected="UNEXPECTED",n.UUIDInvalid="UUID_INVALID"})(Xr||(Xr={}));class No extends Error{constructor(e,t){super(`${t} (${e})`),this.name="ULIDError",this.code=e}}function GE(n){const e=Math.floor(n()*Hc)%Hc;return bv.charAt(e)}function YE(n){const e=KE(),t=e&&(e.crypto||e.msCrypto)||null;if(typeof(t==null?void 0:t.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return t.getRandomValues(r),r[0]/256};if(typeof(t==null?void 0:t.randomBytes)=="function")return()=>t.randomBytes(1).readUInt8()/256;throw new No(Xr.PRNGDetectFailure,"Failed to find a reliable PRNG")}function KE(){return QE()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function JE(n,e){let t="";for(;n>0;n--)t=GE(e)+t;return t}function XE(n,e=_v){if(isNaN(n))throw new No(Xr.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>Dm)throw new No(Xr.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Dm}: ${n}`);if(n<0)throw new No(Xr.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new No(Xr.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let t,r="";for(let i=e;i>0;i--)t=n%Hc,r=bv.charAt(t)+r,n=(n-t)/Hc;return r}function QE(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function ip(n,e){const t=YE(),r=Date.now();return XE(r,_v)+JE(WE,t)}const Mo=Lt(),Sv=Lt(),Av=Lt(),e4=Lt(),zh=Lt(),t4="store-";function xr(n){return new URL(n).origin}function n4(){return{authTokens:{}}}var ii,si,oi;class r4 extends Mr{constructor(t,r,i={}){super();g(this,ii);g(this,si);g(this,oi);d(this,ii,`${t4}${t}`),d(this,si,i.storage??s4());const s=a(this,si).getItem(a(this,ii));s===null?(d(this,oi,r),a(this,si).setItem(a(this,ii),JSON.stringify(r))):d(this,oi,o4(JSON.parse(s),r))}get(){return a(this,oi)}set(t){d(this,oi,t),a(this,si).setItem(a(this,ii),JSON.stringify(t)),this.dispatchEvent(new gt("change"))}}ii=new WeakMap,si=new WeakMap,oi=new WeakMap;function Lm(n,e){return n.authTokens[xr(e)]??null}function Om(n,e,t){return{authTokens:{...n.authTokens,[xr(e)]:t}}}function i4(n,e){const t=xr(e);if(!(t in n.authTokens))return n;const r={...n.authTokens};return delete r[t],{authTokens:r}}function s4(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function o4(n,e){if(typeof n!="object"||n===null||Array.isArray(n))return e;const t=n.authTokens;if(typeof t!="object"||t===null||Array.isArray(t))return e;const r={};for(const[i,s]of Object.entries(t))if(typeof s=="string")try{r[xr(i)]=s}catch{}return{authTokens:r}}function E(n,e,t){function r(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),l._zod.traits.has(n))return;l._zod.traits.add(n),e(l,c);const u=o.prototype,f=Object.keys(u);for(let m=0;m<f.length;m++){const v=f[m];v in l||(l[v]=u[v].bind(l))}}const i=(t==null?void 0:t.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function o(l){var c;const u=t!=null&&t.Parent?new s:this;r(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const f of u._zod.deferred)f();return u}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:l=>{var c,u;return t!=null&&t.Parent&&l instanceof t.Parent?!0:(u=(c=l==null?void 0:l._zod)==null?void 0:c.traits)==null?void 0:u.has(n)}}),Object.defineProperty(o,"name",{value:n}),o}class ws extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class kv extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Ev={};function Pr(n){return Ev}function $v(n){const e=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function vd(n,e){return typeof e=="bigint"?e.toString():e}function Ru(n){return{get value(){{const e=n();return Object.defineProperty(this,"value",{value:e}),e}}}}function sp(n){return n==null}function op(n){const e=n.startsWith("^")?1:0,t=n.endsWith("$")?n.length-1:n.length;return n.slice(e,t)}function a4(n,e){const t=(n.toString().split(".")[1]||"").length,r=e.toString();let i=(r.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c!=null&&c[1]&&(i=Number.parseInt(c[1]))}const s=t>i?t:i,o=Number.parseInt(n.toFixed(s).replace(".","")),l=Number.parseInt(e.toFixed(s).replace(".",""));return o%l/10**s}const zm=Symbol("evaluating");function se(n,e,t){let r;Object.defineProperty(n,e,{get(){if(r!==zm)return r===void 0&&(r=zm,r=t()),r},set(i){Object.defineProperty(n,e,{value:i})},configurable:!0})}function qi(n,e,t){Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function Ur(...n){const e={};for(const t of n){const r=Object.getOwnPropertyDescriptors(t);Object.assign(e,r)}return Object.defineProperties({},e)}function Nm(n){return JSON.stringify(n)}function l4(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Cv="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function ua(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const c4=Ru(()=>{var n;if(typeof navigator<"u"&&((n=navigator==null?void 0:navigator.userAgent)!=null&&n.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ro(n){if(ua(n)===!1)return!1;const e=n.constructor;if(e===void 0||typeof e!="function")return!0;const t=e.prototype;return!(ua(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function Tv(n){return ro(n)?{...n}:Array.isArray(n)?[...n]:n}const u4=new Set(["string","number","symbol"]);function io(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Zr(n,e,t){const r=new n._zod.constr(e??n._zod.def);return(!e||t!=null&&t.parent)&&(r._zod.parent=n),r}function N(n){const e=n;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function h4(n){return Object.keys(n).filter(e=>n[e]._zod.optin==="optional"&&n[e]._zod.optout==="optional")}const d4={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function f4(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=Ur(n._zod.def,{get shape(){const o={};for(const l in e){if(!(l in t.shape))throw new Error(`Unrecognized key: "${l}"`);e[l]&&(o[l]=t.shape[l])}return qi(this,"shape",o),o},checks:[]});return Zr(n,s)}function p4(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=Ur(n._zod.def,{get shape(){const o={...n._zod.def.shape};for(const l in e){if(!(l in t.shape))throw new Error(`Unrecognized key: "${l}"`);e[l]&&delete o[l]}return qi(this,"shape",o),o},checks:[]});return Zr(n,s)}function m4(n,e){if(!ro(e))throw new Error("Invalid input to extend: expected a plain object");const t=n._zod.def.checks;if(t&&t.length>0){const s=n._zod.def.shape;for(const o in e)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=Ur(n._zod.def,{get shape(){const s={...n._zod.def.shape,...e};return qi(this,"shape",s),s}});return Zr(n,i)}function g4(n,e){if(!ro(e))throw new Error("Invalid input to safeExtend: expected a plain object");const t=Ur(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e};return qi(this,"shape",r),r}});return Zr(n,t)}function v4(n,e){const t=Ur(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e._zod.def.shape};return qi(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return Zr(n,t)}function y4(n,e,t){const i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=Ur(e._zod.def,{get shape(){const l=e._zod.def.shape,c={...l};if(t)for(const u in t){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(c[u]=n?new n({type:"optional",innerType:l[u]}):l[u])}else for(const u in l)c[u]=n?new n({type:"optional",innerType:l[u]}):l[u];return qi(this,"shape",c),c},checks:[]});return Zr(e,o)}function w4(n,e,t){const r=Ur(e._zod.def,{get shape(){const i=e._zod.def.shape,s={...i};if(t)for(const o in t){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(s[o]=new n({type:"nonoptional",innerType:i[o]}))}else for(const o in i)s[o]=new n({type:"nonoptional",innerType:i[o]});return qi(this,"shape",s),s}});return Zr(e,r)}function ps(n,e=0){var t;if(n.aborted===!0)return!0;for(let r=e;r<n.issues.length;r++)if(((t=n.issues[r])==null?void 0:t.continue)!==!0)return!0;return!1}function ms(n,e){return e.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(n),t})}function Bl(n){return typeof n=="string"?n:n==null?void 0:n.message}function Dr(n,e,t){var i,s,o,l,c,u;const r={...n,path:n.path??[]};if(!n.message){const f=Bl((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??Bl((l=e==null?void 0:e.error)==null?void 0:l.call(e,n))??Bl((c=t.customError)==null?void 0:c.call(t,n))??Bl((u=t.localeError)==null?void 0:u.call(t,n))??"Invalid input";r.message=f}return delete r.inst,delete r.continue,e!=null&&e.reportInput||delete r.input,r}function ap(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function ha(...n){const[e,t,r]=n;return typeof e=="string"?{message:e,code:"custom",input:t,inst:r}:{...e}}const Rv=(n,e)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:e,enumerable:!1}),n.message=JSON.stringify(e,vd,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},Iv=E("$ZodError",Rv),xv=E("$ZodError",Rv,{Parent:Error});function b4(n,e=t=>t.message){const t={},r=[];for(const i of n.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:t}}function _4(n,e=t=>t.message){const t={_errors:[]},r=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(o=>r({issues:o}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)t._errors.push(e(s));else{let o=t,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(e(s))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return r(n),t}const lp=n=>(e,t,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},o=e._zod.run({value:t,issues:[]},s);if(o instanceof Promise)throw new ws;if(o.issues.length){const l=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>Dr(c,s,Pr())));throw Cv(l,i==null?void 0:i.callee),l}return o.value},cp=n=>async(e,t,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=e._zod.run({value:t,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const l=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>Dr(c,s,Pr())));throw Cv(l,i==null?void 0:i.callee),l}return o.value},Iu=n=>(e,t,r)=>{const i=r?{...r,async:!1}:{async:!1},s=e._zod.run({value:t,issues:[]},i);if(s instanceof Promise)throw new ws;return s.issues.length?{success:!1,error:new(n??Iv)(s.issues.map(o=>Dr(o,i,Pr())))}:{success:!0,data:s.value}},S4=Iu(xv),xu=n=>async(e,t,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=e._zod.run({value:t,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new n(s.issues.map(o=>Dr(o,i,Pr())))}:{success:!0,data:s.value}},A4=xu(xv),k4=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return lp(n)(e,t,i)},E4=n=>(e,t,r)=>lp(n)(e,t,r),$4=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return cp(n)(e,t,i)},C4=n=>async(e,t,r)=>cp(n)(e,t,r),T4=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Iu(n)(e,t,i)},R4=n=>(e,t,r)=>Iu(n)(e,t,r),I4=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return xu(n)(e,t,i)},x4=n=>async(e,t,r)=>xu(n)(e,t,r),P4=/^[cC][^\s-]{8,}$/,D4=/^[0-9a-z]+$/,L4=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,O4=/^[0-9a-vA-V]{20}$/,z4=/^[A-Za-z0-9]{27}$/,N4=/^[a-zA-Z0-9_-]{21}$/,M4=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,U4=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Mm=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Z4=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,F4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function H4(){return new RegExp(F4,"u")}const V4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,B4=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,q4=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,j4=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,W4=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Pv=/^[A-Za-z0-9_-]*$/,G4=/^\+[1-9]\d{6,14}$/,Dv="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Y4=new RegExp(`^${Dv}$`);function Lv(n){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${e}`:n.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${n.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function K4(n){return new RegExp(`^${Lv(n)}$`)}function J4(n){const e=Lv({precision:n.precision}),t=["Z"];n.local&&t.push(""),n.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${t.join("|")})`;return new RegExp(`^${Dv}T(?:${r})$`)}const X4=n=>{const e=n?`[\\s\\S]{${(n==null?void 0:n.minimum)??0},${(n==null?void 0:n.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Q4=/^-?\d+$/,Ov=/^-?\d+(?:\.\d+)?$/,e$=/^(?:true|false)$/i,t$=/^[^A-Z]*$/,n$=/^[^a-z]*$/,Qe=E("$ZodCheck",(n,e)=>{var t;n._zod??(n._zod={}),n._zod.def=e,(t=n._zod).onattach??(t.onattach=[])}),zv={number:"number",bigint:"bigint",object:"date"},Nv=E("$ZodCheckLessThan",(n,e)=>{Qe.init(n,e);const t=zv[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:t,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),Mv=E("$ZodCheckGreaterThan",(n,e)=>{Qe.init(n,e);const t=zv[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:t,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),r$=E("$ZodCheckMultipleOf",(n,e)=>{Qe.init(n,e),n._zod.onattach.push(t=>{var r;(r=t._zod.bag).multipleOf??(r.multipleOf=e.value)}),n._zod.check=t=>{if(typeof t.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof t.value=="bigint"?t.value%e.value===BigInt(0):a4(t.value,e.value)===0)||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:e.value,input:t.value,inst:n,continue:!e.abort})}}),i$=E("$ZodCheckNumberFormat",(n,e)=>{var o;Qe.init(n,e),e.format=e.format||"float64";const t=(o=e.format)==null?void 0:o.includes("int"),r=t?"int":"number",[i,s]=d4[e.format];n._zod.onattach.push(l=>{const c=l._zod.bag;c.format=e.format,c.minimum=i,c.maximum=s,t&&(c.pattern=Q4)}),n._zod.check=l=>{const c=l.value;if(t){if(!Number.isInteger(c)){l.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:c,inst:n});return}if(!Number.isSafeInteger(c)){c>0?l.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!e.abort}):l.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!e.abort});return}}c<i&&l.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!e.abort}),c>s&&l.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:n,continue:!e.abort})}}),s$=E("$ZodCheckMaxLength",(n,e)=>{var t;Qe.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!sp(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),n._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const o=ap(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),o$=E("$ZodCheckMinLength",(n,e)=>{var t;Qe.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!sp(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),n._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const o=ap(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),a$=E("$ZodCheckLengthEquals",(n,e)=>{var t;Qe.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!sp(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),n._zod.check=r=>{const i=r.value,s=i.length;if(s===e.length)return;const o=ap(i),l=s>e.length;r.issues.push({origin:o,...l?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!e.abort})}}),Pu=E("$ZodCheckStringFormat",(n,e)=>{var t,r;Qe.init(n,e),n._zod.onattach.push(i=>{const s=i._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(t=n._zod).check??(t.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:n,continue:!e.abort})}):(r=n._zod).check??(r.check=()=>{})}),l$=E("$ZodCheckRegex",(n,e)=>{Pu.init(n,e),n._zod.check=t=>{e.pattern.lastIndex=0,!e.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:n,continue:!e.abort})}}),c$=E("$ZodCheckLowerCase",(n,e)=>{e.pattern??(e.pattern=t$),Pu.init(n,e)}),u$=E("$ZodCheckUpperCase",(n,e)=>{e.pattern??(e.pattern=n$),Pu.init(n,e)}),h$=E("$ZodCheckIncludes",(n,e)=>{Qe.init(n,e);const t=io(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${t}`:t);e.pattern=r,n._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),n._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:n,continue:!e.abort})}}),d$=E("$ZodCheckStartsWith",(n,e)=>{Qe.init(n,e);const t=new RegExp(`^${io(e.prefix)}.*`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:n,continue:!e.abort})}}),f$=E("$ZodCheckEndsWith",(n,e)=>{Qe.init(n,e);const t=new RegExp(`.*${io(e.suffix)}$`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:n,continue:!e.abort})}}),p$=E("$ZodCheckOverwrite",(n,e)=>{Qe.init(n,e),n._zod.check=t=>{t.value=e.tx(t.value)}});class m${constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
5
- `).filter(o=>o),i=Math.min(...r.map(o=>o.length-o.trimStart().length)),s=r.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(const o of s)this.content.push(o)}compile(){const e=Function,t=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new e(...t,i.join(`
6
- `))}}const g$={major:4,minor:3,patch:6},ge=E("$ZodType",(n,e)=>{var i;var t;n??(n={}),n._zod.def=e,n._zod.bag=n._zod.bag||{},n._zod.version=g$;const r=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&r.unshift(n);for(const s of r)for(const o of s._zod.onattach)o(n);if(r.length===0)(t=n._zod).deferred??(t.deferred=[]),(i=n._zod.deferred)==null||i.push(()=>{n._zod.run=n._zod.parse});else{const s=(l,c,u)=>{let f=ps(l),m;for(const v of c){if(v._zod.def.when){if(!v._zod.def.when(l))continue}else if(f)continue;const y=l.issues.length,k=v._zod.check(l);if(k instanceof Promise&&(u==null?void 0:u.async)===!1)throw new ws;if(m||k instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await k,l.issues.length!==y&&(f||(f=ps(l,y)))});else{if(l.issues.length===y)continue;f||(f=ps(l,y))}}return m?m.then(()=>l):l},o=(l,c,u)=>{if(ps(l))return l.aborted=!0,l;const f=s(c,r,u);if(f instanceof Promise){if(u.async===!1)throw new ws;return f.then(m=>n._zod.parse(m,u))}return n._zod.parse(f,u)};n._zod.run=(l,c)=>{if(c.skipChecks)return n._zod.parse(l,c);if(c.direction==="backward"){const f=n._zod.parse({value:l.value,issues:[]},{...c,skipChecks:!0});return f instanceof Promise?f.then(m=>o(m,l,c)):o(f,l,c)}const u=n._zod.parse(l,c);if(u instanceof Promise){if(c.async===!1)throw new ws;return u.then(f=>s(f,r,c))}return s(u,r,c)}}se(n,"~standard",()=>({validate:s=>{var o;try{const l=S4(n,s);return l.success?{value:l.data}:{issues:(o=l.error)==null?void 0:o.issues}}catch{return A4(n,s).then(c=>{var u;return c.success?{value:c.data}:{issues:(u=c.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}))}),up=E("$ZodString",(n,e)=>{var t;ge.init(n,e),n._zod.pattern=[...((t=n==null?void 0:n._zod.bag)==null?void 0:t.patterns)??[]].pop()??X4(n._zod.bag),n._zod.parse=(r,i)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:n}),r}}),pe=E("$ZodStringFormat",(n,e)=>{Pu.init(n,e),up.init(n,e)}),v$=E("$ZodGUID",(n,e)=>{e.pattern??(e.pattern=U4),pe.init(n,e)}),y$=E("$ZodUUID",(n,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Mm(r))}else e.pattern??(e.pattern=Mm());pe.init(n,e)}),w$=E("$ZodEmail",(n,e)=>{e.pattern??(e.pattern=Z4),pe.init(n,e)}),b$=E("$ZodURL",(n,e)=>{pe.init(n,e),n._zod.check=t=>{try{const r=t.value.trim(),i=new URL(r);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:t.value,inst:n,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:t.value,inst:n,continue:!e.abort})),e.normalize?t.value=i.href:t.value=r;return}catch{t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:n,continue:!e.abort})}}}),_$=E("$ZodEmoji",(n,e)=>{e.pattern??(e.pattern=H4()),pe.init(n,e)}),S$=E("$ZodNanoID",(n,e)=>{e.pattern??(e.pattern=N4),pe.init(n,e)}),A$=E("$ZodCUID",(n,e)=>{e.pattern??(e.pattern=P4),pe.init(n,e)}),k$=E("$ZodCUID2",(n,e)=>{e.pattern??(e.pattern=D4),pe.init(n,e)}),E$=E("$ZodULID",(n,e)=>{e.pattern??(e.pattern=L4),pe.init(n,e)}),$$=E("$ZodXID",(n,e)=>{e.pattern??(e.pattern=O4),pe.init(n,e)}),C$=E("$ZodKSUID",(n,e)=>{e.pattern??(e.pattern=z4),pe.init(n,e)}),T$=E("$ZodISODateTime",(n,e)=>{e.pattern??(e.pattern=J4(e)),pe.init(n,e)}),R$=E("$ZodISODate",(n,e)=>{e.pattern??(e.pattern=Y4),pe.init(n,e)}),I$=E("$ZodISOTime",(n,e)=>{e.pattern??(e.pattern=K4(e)),pe.init(n,e)}),x$=E("$ZodISODuration",(n,e)=>{e.pattern??(e.pattern=M4),pe.init(n,e)}),P$=E("$ZodIPv4",(n,e)=>{e.pattern??(e.pattern=V4),pe.init(n,e),n._zod.bag.format="ipv4"}),D$=E("$ZodIPv6",(n,e)=>{e.pattern??(e.pattern=B4),pe.init(n,e),n._zod.bag.format="ipv6",n._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:n,continue:!e.abort})}}}),L$=E("$ZodCIDRv4",(n,e)=>{e.pattern??(e.pattern=q4),pe.init(n,e)}),O$=E("$ZodCIDRv6",(n,e)=>{e.pattern??(e.pattern=j4),pe.init(n,e),n._zod.check=t=>{const r=t.value.split("/");try{if(r.length!==2)throw new Error;const[i,s]=r;if(!s)throw new Error;const o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${i}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:n,continue:!e.abort})}}});function Uv(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const z$=E("$ZodBase64",(n,e)=>{e.pattern??(e.pattern=W4),pe.init(n,e),n._zod.bag.contentEncoding="base64",n._zod.check=t=>{Uv(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:n,continue:!e.abort})}});function N$(n){if(!Pv.test(n))return!1;const e=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return Uv(t)}const M$=E("$ZodBase64URL",(n,e)=>{e.pattern??(e.pattern=Pv),pe.init(n,e),n._zod.bag.contentEncoding="base64url",n._zod.check=t=>{N$(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:n,continue:!e.abort})}}),U$=E("$ZodE164",(n,e)=>{e.pattern??(e.pattern=G4),pe.init(n,e)});function Z$(n,e=null){try{const t=n.split(".");if(t.length!==3)return!1;const[r]=t;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const F$=E("$ZodJWT",(n,e)=>{pe.init(n,e),n._zod.check=t=>{Z$(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:n,continue:!e.abort})}}),Zv=E("$ZodNumber",(n,e)=>{ge.init(n,e),n._zod.pattern=n._zod.bag.pattern??Ov,n._zod.parse=(t,r)=>{if(e.coerce)try{t.value=Number(t.value)}catch{}const i=t.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return t;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:i,inst:n,...s?{received:s}:{}}),t}}),H$=E("$ZodNumberFormat",(n,e)=>{i$.init(n,e),Zv.init(n,e)}),V$=E("$ZodBoolean",(n,e)=>{ge.init(n,e),n._zod.pattern=e$,n._zod.parse=(t,r)=>{if(e.coerce)try{t.value=!!t.value}catch{}const i=t.value;return typeof i=="boolean"||t.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:n}),t}}),B$=E("$ZodUnknown",(n,e)=>{ge.init(n,e),n._zod.parse=t=>t}),q$=E("$ZodNever",(n,e)=>{ge.init(n,e),n._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:n}),t)});function Um(n,e,t){n.issues.length&&e.issues.push(...ms(t,n.issues)),e.value[t]=n.value}const j$=E("$ZodArray",(n,e)=>{ge.init(n,e),n._zod.parse=(t,r)=>{const i=t.value;if(!Array.isArray(i))return t.issues.push({expected:"array",code:"invalid_type",input:i,inst:n}),t;t.value=Array(i.length);const s=[];for(let o=0;o<i.length;o++){const l=i[o],c=e.element._zod.run({value:l,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Um(u,t,o))):Um(c,t,o)}return s.length?Promise.all(s).then(()=>t):t}});function Vc(n,e,t,r,i){if(n.issues.length){if(i&&!(t in r))return;e.issues.push(...ms(t,n.issues))}n.value===void 0?t in r&&(e.value[t]=void 0):e.value[t]=n.value}function Fv(n){var r,i,s,o;const e=Object.keys(n.shape);for(const l of e)if(!((o=(s=(i=(r=n.shape)==null?void 0:r[l])==null?void 0:i._zod)==null?void 0:s.traits)!=null&&o.has("$ZodType")))throw new Error(`Invalid element at key "${l}": expected a Zod schema`);const t=h4(n.shape);return{...n,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}function Hv(n,e,t,r,i,s){const o=[],l=i.keySet,c=i.catchall._zod,u=c.def.type,f=c.optout==="optional";for(const m in e){if(l.has(m))continue;if(u==="never"){o.push(m);continue}const v=c.run({value:e[m],issues:[]},r);v instanceof Promise?n.push(v.then(y=>Vc(y,t,m,e,f))):Vc(v,t,m,e,f)}return o.length&&t.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:s}),n.length?Promise.all(n).then(()=>t):t}const W$=E("$ZodObject",(n,e)=>{ge.init(n,e);const t=Object.getOwnPropertyDescriptor(e,"shape");if(!(t!=null&&t.get)){const l=e.shape;Object.defineProperty(e,"shape",{get:()=>{const c={...l};return Object.defineProperty(e,"shape",{value:c}),c}})}const r=Ru(()=>Fv(e));se(n._zod,"propValues",()=>{const l=e.shape,c={};for(const u in l){const f=l[u]._zod;if(f.values){c[u]??(c[u]=new Set);for(const m of f.values)c[u].add(m)}}return c});const i=ua,s=e.catchall;let o;n._zod.parse=(l,c)=>{o??(o=r.value);const u=l.value;if(!i(u))return l.issues.push({expected:"object",code:"invalid_type",input:u,inst:n}),l;l.value={};const f=[],m=o.shape;for(const v of o.keys){const y=m[v],k=y._zod.optout==="optional",S=y._zod.run({value:u[v],issues:[]},c);S instanceof Promise?f.push(S.then(x=>Vc(x,l,v,u,k))):Vc(S,l,v,u,k)}return s?Hv(f,u,l,c,r.value,n):f.length?Promise.all(f).then(()=>l):l}}),G$=E("$ZodObjectJIT",(n,e)=>{W$.init(n,e);const t=n._zod.parse,r=Ru(()=>Fv(e)),i=v=>{var G;const y=new m$(["shape","payload","ctx"]),k=r.value,S=F=>{const W=Nm(F);return`shape[${W}]._zod.run({ value: input[${W}], issues: [] }, ctx)`};y.write("const input = payload.value;");const x=Object.create(null);let M=0;for(const F of k.keys)x[F]=`key_${M++}`;y.write("const newResult = {};");for(const F of k.keys){const W=x[F],Q=Nm(F),ee=v[F],oe=((G=ee==null?void 0:ee._zod)==null?void 0:G.optout)==="optional";y.write(`const ${W} = ${S(F)};`),oe?y.write(`
7
- if (${W}.issues.length) {
8
- if (${Q} in input) {
9
- payload.issues = payload.issues.concat(${W}.issues.map(iss => ({
10
- ...iss,
11
- path: iss.path ? [${Q}, ...iss.path] : [${Q}]
12
- })));
13
- }
14
- }
15
-
16
- if (${W}.value === undefined) {
17
- if (${Q} in input) {
18
- newResult[${Q}] = undefined;
19
- }
20
- } else {
21
- newResult[${Q}] = ${W}.value;
22
- }
23
-
24
- `):y.write(`
25
- if (${W}.issues.length) {
26
- payload.issues = payload.issues.concat(${W}.issues.map(iss => ({
27
- ...iss,
28
- path: iss.path ? [${Q}, ...iss.path] : [${Q}]
29
- })));
30
- }
31
-
32
- if (${W}.value === undefined) {
33
- if (${Q} in input) {
34
- newResult[${Q}] = undefined;
35
- }
36
- } else {
37
- newResult[${Q}] = ${W}.value;
38
- }
39
-
40
- `)}y.write("payload.value = newResult;"),y.write("return payload;");const Z=y.compile();return(F,W)=>Z(v,F,W)};let s;const o=ua,l=!Ev.jitless,u=l&&c4.value,f=e.catchall;let m;n._zod.parse=(v,y)=>{m??(m=r.value);const k=v.value;return o(k)?l&&u&&(y==null?void 0:y.async)===!1&&y.jitless!==!0?(s||(s=i(e.shape)),v=s(v,y),f?Hv([],k,v,y,m,n):v):t(v,y):(v.issues.push({expected:"object",code:"invalid_type",input:k,inst:n}),v)}});function Zm(n,e,t,r){for(const s of n)if(s.issues.length===0)return e.value=s.value,e;const i=n.filter(s=>!ps(s));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:n.map(s=>s.issues.map(o=>Dr(o,r,Pr())))}),e)}const Vv=E("$ZodUnion",(n,e)=>{ge.init(n,e),se(n._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),se(n._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),se(n._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),se(n._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){const i=e.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>op(s.source)).join("|")})$`)}});const t=e.options.length===1,r=e.options[0]._zod.run;n._zod.parse=(i,s)=>{if(t)return r(i,s);let o=!1;const l=[];for(const c of e.options){const u=c._zod.run({value:i.value,issues:[]},s);if(u instanceof Promise)l.push(u),o=!0;else{if(u.issues.length===0)return u;l.push(u)}}return o?Promise.all(l).then(c=>Zm(c,i,n,s)):Zm(l,i,n,s)}}),Y$=E("$ZodDiscriminatedUnion",(n,e)=>{e.inclusive=!1,Vv.init(n,e);const t=n._zod.parse;se(n._zod,"propValues",()=>{const i={};for(const s of e.options){const o=s._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(const[l,c]of Object.entries(o)){i[l]||(i[l]=new Set);for(const u of c)i[l].add(u)}}return i});const r=Ru(()=>{var o;const i=e.options,s=new Map;for(const l of i){const c=(o=l._zod.propValues)==null?void 0:o[e.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(l)}"`);for(const u of c){if(s.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,l)}}return s});n._zod.parse=(i,s)=>{const o=i.value;if(!ua(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:n}),i;const l=r.value.get(o==null?void 0:o[e.discriminator]);return l?l._zod.run(i,s):e.unionFallback?t(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:o,path:[e.discriminator],inst:n}),i)}}),K$=E("$ZodIntersection",(n,e)=>{ge.init(n,e),n._zod.parse=(t,r)=>{const i=t.value,s=e.left._zod.run({value:i,issues:[]},r),o=e.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([c,u])=>Fm(t,c,u)):Fm(t,s,o)}});function yd(n,e){if(n===e)return{valid:!0,data:n};if(n instanceof Date&&e instanceof Date&&+n==+e)return{valid:!0,data:n};if(ro(n)&&ro(e)){const t=Object.keys(e),r=Object.keys(n).filter(s=>t.indexOf(s)!==-1),i={...n,...e};for(const s of r){const o=yd(n[s],e[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let r=0;r<n.length;r++){const i=n[r],s=e[r],o=yd(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};t.push(o.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Fm(n,e,t){const r=new Map;let i;for(const l of e.issues)if(l.code==="unrecognized_keys"){i??(i=l);for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else n.issues.push(l);for(const l of t.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else n.issues.push(l);const s=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(s.length&&i&&n.issues.push({...i,keys:s}),ps(n))return n;const o=yd(e.value,t.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return n.value=o.data,n}const J$=E("$ZodRecord",(n,e)=>{ge.init(n,e),n._zod.parse=(t,r)=>{const i=t.value;if(!ro(i))return t.issues.push({expected:"record",code:"invalid_type",input:i,inst:n}),t;const s=[],o=e.keyType._zod.values;if(o){t.value={};const l=new Set;for(const u of o)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){l.add(typeof u=="number"?u.toString():u);const f=e.valueType._zod.run({value:i[u],issues:[]},r);f instanceof Promise?s.push(f.then(m=>{m.issues.length&&t.issues.push(...ms(u,m.issues)),t.value[u]=m.value})):(f.issues.length&&t.issues.push(...ms(u,f.issues)),t.value[u]=f.value)}let c;for(const u in i)l.has(u)||(c=c??[],c.push(u));c&&c.length>0&&t.issues.push({code:"unrecognized_keys",input:i,inst:n,keys:c})}else{t.value={};for(const l of Reflect.ownKeys(i)){if(l==="__proto__")continue;let c=e.keyType._zod.run({value:l,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Ov.test(l)&&c.issues.length){const m=e.keyType._zod.run({value:Number(l),issues:[]},r);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(c=m)}if(c.issues.length){e.mode==="loose"?t.value[l]=i[l]:t.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(m=>Dr(m,r,Pr())),input:l,path:[l],inst:n});continue}const f=e.valueType._zod.run({value:i[l],issues:[]},r);f instanceof Promise?s.push(f.then(m=>{m.issues.length&&t.issues.push(...ms(l,m.issues)),t.value[c.value]=m.value})):(f.issues.length&&t.issues.push(...ms(l,f.issues)),t.value[c.value]=f.value)}}return s.length?Promise.all(s).then(()=>t):t}}),X$=E("$ZodEnum",(n,e)=>{ge.init(n,e);const t=$v(e.entries),r=new Set(t);n._zod.values=r,n._zod.pattern=new RegExp(`^(${t.filter(i=>u4.has(typeof i)).map(i=>typeof i=="string"?io(i):i.toString()).join("|")})$`),n._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:t,input:o,inst:n}),i}}),Q$=E("$ZodLiteral",(n,e)=>{if(ge.init(n,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const t=new Set(e.values);n._zod.values=t,n._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?io(r):r?io(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,i)=>{const s=r.value;return t.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:n}),r}}),eC=E("$ZodTransform",(n,e)=>{ge.init(n,e),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new kv(n.constructor.name);const i=e.transform(t.value,t);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(t.value=o,t));if(i instanceof Promise)throw new ws;return t.value=i,t}});function Hm(n,e){return n.issues.length&&e===void 0?{issues:[],value:void 0}:n}const Bv=E("$ZodOptional",(n,e)=>{ge.init(n,e),n._zod.optin="optional",n._zod.optout="optional",se(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),se(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${op(t.source)})?$`):void 0}),n._zod.parse=(t,r)=>{if(e.innerType._zod.optin==="optional"){const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>Hm(s,t.value)):Hm(i,t.value)}return t.value===void 0?t:e.innerType._zod.run(t,r)}}),tC=E("$ZodExactOptional",(n,e)=>{Bv.init(n,e),se(n._zod,"values",()=>e.innerType._zod.values),se(n._zod,"pattern",()=>e.innerType._zod.pattern),n._zod.parse=(t,r)=>e.innerType._zod.run(t,r)}),nC=E("$ZodNullable",(n,e)=>{ge.init(n,e),se(n._zod,"optin",()=>e.innerType._zod.optin),se(n._zod,"optout",()=>e.innerType._zod.optout),se(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${op(t.source)}|null)$`):void 0}),se(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),n._zod.parse=(t,r)=>t.value===null?t:e.innerType._zod.run(t,r)}),rC=E("$ZodDefault",(n,e)=>{ge.init(n,e),n._zod.optin="optional",se(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);if(t.value===void 0)return t.value=e.defaultValue,t;const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>Vm(s,e)):Vm(i,e)}});function Vm(n,e){return n.value===void 0&&(n.value=e.defaultValue),n}const iC=E("$ZodPrefault",(n,e)=>{ge.init(n,e),n._zod.optin="optional",se(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>(r.direction==="backward"||t.value===void 0&&(t.value=e.defaultValue),e.innerType._zod.run(t,r))}),sC=E("$ZodNonOptional",(n,e)=>{ge.init(n,e),se(n._zod,"values",()=>{const t=e.innerType._zod.values;return t?new Set([...t].filter(r=>r!==void 0)):void 0}),n._zod.parse=(t,r)=>{const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>Bm(s,n)):Bm(i,n)}});function Bm(n,e){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:e}),n}const oC=E("$ZodCatch",(n,e)=>{ge.init(n,e),se(n._zod,"optin",()=>e.innerType._zod.optin),se(n._zod,"optout",()=>e.innerType._zod.optout),se(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>(t.value=s.value,s.issues.length&&(t.value=e.catchValue({...t,error:{issues:s.issues.map(o=>Dr(o,r,Pr()))},input:t.value}),t.issues=[]),t)):(t.value=i.value,i.issues.length&&(t.value=e.catchValue({...t,error:{issues:i.issues.map(s=>Dr(s,r,Pr()))},input:t.value}),t.issues=[]),t)}}),aC=E("$ZodPipe",(n,e)=>{ge.init(n,e),se(n._zod,"values",()=>e.in._zod.values),se(n._zod,"optin",()=>e.in._zod.optin),se(n._zod,"optout",()=>e.out._zod.optout),se(n._zod,"propValues",()=>e.in._zod.propValues),n._zod.parse=(t,r)=>{if(r.direction==="backward"){const s=e.out._zod.run(t,r);return s instanceof Promise?s.then(o=>ql(o,e.in,r)):ql(s,e.in,r)}const i=e.in._zod.run(t,r);return i instanceof Promise?i.then(s=>ql(s,e.out,r)):ql(i,e.out,r)}});function ql(n,e,t){return n.issues.length?(n.aborted=!0,n):e._zod.run({value:n.value,issues:n.issues},t)}const lC=E("$ZodReadonly",(n,e)=>{ge.init(n,e),se(n._zod,"propValues",()=>e.innerType._zod.propValues),se(n._zod,"values",()=>e.innerType._zod.values),se(n._zod,"optin",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optin}),se(n._zod,"optout",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optout}),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(qm):qm(i)}});function qm(n){return n.value=Object.freeze(n.value),n}const cC=E("$ZodCustom",(n,e)=>{Qe.init(n,e),ge.init(n,e),n._zod.parse=(t,r)=>t,n._zod.check=t=>{const r=t.value,i=e.fn(r);if(i instanceof Promise)return i.then(s=>jm(s,t,r,n));jm(i,t,r,n)}});function jm(n,e,t,r){if(!n){const i={code:"custom",input:t,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(ha(i))}}var Wm;class uC{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function hC(){return new uC}(Wm=globalThis).__zod_globalRegistry??(Wm.__zod_globalRegistry=hC());const Uo=globalThis.__zod_globalRegistry;function dC(n,e){return new n({type:"string",...N(e)})}function fC(n,e){return new n({type:"string",format:"email",check:"string_format",abort:!1,...N(e)})}function Gm(n,e){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...N(e)})}function pC(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...N(e)})}function mC(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...N(e)})}function gC(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...N(e)})}function vC(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...N(e)})}function yC(n,e){return new n({type:"string",format:"url",check:"string_format",abort:!1,...N(e)})}function wC(n,e){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...N(e)})}function bC(n,e){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...N(e)})}function _C(n,e){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...N(e)})}function SC(n,e){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...N(e)})}function AC(n,e){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...N(e)})}function kC(n,e){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...N(e)})}function EC(n,e){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...N(e)})}function $C(n,e){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...N(e)})}function CC(n,e){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...N(e)})}function TC(n,e){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...N(e)})}function RC(n,e){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...N(e)})}function IC(n,e){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...N(e)})}function xC(n,e){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...N(e)})}function PC(n,e){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...N(e)})}function DC(n,e){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...N(e)})}function LC(n,e){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...N(e)})}function OC(n,e){return new n({type:"string",format:"date",check:"string_format",...N(e)})}function zC(n,e){return new n({type:"string",format:"time",check:"string_format",precision:null,...N(e)})}function NC(n,e){return new n({type:"string",format:"duration",check:"string_format",...N(e)})}function MC(n,e){return new n({type:"number",checks:[],...N(e)})}function UC(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...N(e)})}function ZC(n,e){return new n({type:"boolean",...N(e)})}function FC(n){return new n({type:"unknown"})}function HC(n,e){return new n({type:"never",...N(e)})}function Ym(n,e){return new Nv({check:"less_than",...N(e),value:n,inclusive:!1})}function Nh(n,e){return new Nv({check:"less_than",...N(e),value:n,inclusive:!0})}function Km(n,e){return new Mv({check:"greater_than",...N(e),value:n,inclusive:!1})}function Mh(n,e){return new Mv({check:"greater_than",...N(e),value:n,inclusive:!0})}function Jm(n,e){return new r$({check:"multiple_of",...N(e),value:n})}function qv(n,e){return new s$({check:"max_length",...N(e),maximum:n})}function Bc(n,e){return new o$({check:"min_length",...N(e),minimum:n})}function jv(n,e){return new a$({check:"length_equals",...N(e),length:n})}function VC(n,e){return new l$({check:"string_format",format:"regex",...N(e),pattern:n})}function BC(n){return new c$({check:"string_format",format:"lowercase",...N(n)})}function qC(n){return new u$({check:"string_format",format:"uppercase",...N(n)})}function jC(n,e){return new h$({check:"string_format",format:"includes",...N(e),includes:n})}function WC(n,e){return new d$({check:"string_format",format:"starts_with",...N(e),prefix:n})}function GC(n,e){return new f$({check:"string_format",format:"ends_with",...N(e),suffix:n})}function vo(n){return new p$({check:"overwrite",tx:n})}function YC(n){return vo(e=>e.normalize(n))}function KC(){return vo(n=>n.trim())}function JC(){return vo(n=>n.toLowerCase())}function XC(){return vo(n=>n.toUpperCase())}function QC(){return vo(n=>l4(n))}function eT(n,e,t){return new n({type:"array",element:e,...N(t)})}function tT(n,e,t){return new n({type:"custom",check:"custom",fn:e,...N(t)})}function nT(n){const e=rT(t=>(t.addIssue=r=>{if(typeof r=="string")t.issues.push(ha(r,t.value,e._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=t.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),t.issues.push(ha(i))}},n(t.value,t)));return e}function rT(n,e){const t=new Qe({check:"custom",...N(e)});return t._zod.check=n,t}function Wv(n){let e=(n==null?void 0:n.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:n.processors??{},metadataRegistry:(n==null?void 0:n.metadata)??Uo,target:e,unrepresentable:(n==null?void 0:n.unrepresentable)??"throw",override:(n==null?void 0:n.override)??(()=>{}),io:(n==null?void 0:n.io)??"output",counter:0,seen:new Map,cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0}}function Ee(n,e,t={path:[],schemaPath:[]}){var f,m;var r;const i=n._zod.def,s=e.seen.get(n);if(s)return s.count++,t.schemaPath.includes(n)&&(s.cycle=t.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:t.path};e.seen.set(n,o);const l=(m=(f=n._zod).toJSONSchema)==null?void 0:m.call(f);if(l)o.schema=l;else{const v={...t,schemaPath:[...t.schemaPath,n],path:t.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(e,o.schema,v);else{const k=o.schema,S=e.processors[i.type];if(!S)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);S(n,e,k,v)}const y=n._zod.parent;y&&(o.ref||(o.ref=y),Ee(y,e,v),e.seen.get(y).isParent=!0)}const c=e.metadataRegistry.get(n);return c&&Object.assign(o.schema,c),e.io==="input"&&Fe(n)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(n).schema}function Gv(n,e){var o,l,c,u;const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const f of n.seen.entries()){const m=(o=n.metadataRegistry.get(f[0]))==null?void 0:o.id;if(m){const v=r.get(m);if(v&&v!==f[0])throw new Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(m,f[0])}}const i=f=>{var S;const m=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const x=(S=n.external.registry.get(f[0]))==null?void 0:S.id,M=n.external.uri??(G=>G);if(x)return{ref:M(x)};const Z=f[1].defId??f[1].schema.id??`schema${n.counter++}`;return f[1].defId=Z,{defId:Z,ref:`${M("__shared")}#/${m}/${Z}`}}if(f[1]===t)return{ref:"#"};const y=`#/${m}/`,k=f[1].schema.id??`__schema${n.counter++}`;return{defId:k,ref:y+k}},s=f=>{if(f[1].schema.$ref)return;const m=f[1],{ref:v,defId:y}=i(f);m.def={...m.schema},y&&(m.defId=y);const k=m.schema;for(const S in k)delete k[S];k.$ref=v};if(n.cycles==="throw")for(const f of n.seen.entries()){const m=f[1];if(m.cycle)throw new Error(`Cycle detected: #/${(l=m.cycle)==null?void 0:l.join("/")}/<root>
41
-
42
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const f of n.seen.entries()){const m=f[1];if(e===f[0]){s(f);continue}if(n.external){const y=(c=n.external.registry.get(f[0]))==null?void 0:c.id;if(e!==f[0]&&y){s(f);continue}}if((u=n.metadataRegistry.get(f[0]))==null?void 0:u.id){s(f);continue}if(m.cycle){s(f);continue}if(m.count>1&&n.reused==="ref"){s(f);continue}}}function Yv(n,e){var o,l,c;const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=u=>{const f=n.seen.get(u);if(f.ref===null)return;const m=f.def??f.schema,v={...m},y=f.ref;if(f.ref=null,y){r(y);const S=n.seen.get(y),x=S.schema;if(x.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(x)):Object.assign(m,x),Object.assign(m,v),u._zod.parent===y)for(const Z in m)Z==="$ref"||Z==="allOf"||Z in v||delete m[Z];if(x.$ref&&S.def)for(const Z in m)Z==="$ref"||Z==="allOf"||Z in S.def&&JSON.stringify(m[Z])===JSON.stringify(S.def[Z])&&delete m[Z]}const k=u._zod.parent;if(k&&k!==y){r(k);const S=n.seen.get(k);if(S!=null&&S.schema.$ref&&(m.$ref=S.schema.$ref,S.def))for(const x in m)x==="$ref"||x==="allOf"||x in S.def&&JSON.stringify(m[x])===JSON.stringify(S.def[x])&&delete m[x]}n.override({zodSchema:u,jsonSchema:m,path:f.path??[]})};for(const u of[...n.seen.entries()].reverse())r(u[0]);const i={};if(n.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":n.target,(o=n.external)!=null&&o.uri){const u=(l=n.external.registry.get(e))==null?void 0:l.id;if(!u)throw new Error("Schema is missing an `id` property");i.$id=n.external.uri(u)}Object.assign(i,t.def??t.schema);const s=((c=n.external)==null?void 0:c.defs)??{};for(const u of n.seen.entries()){const f=u[1];f.def&&f.defId&&(s[f.defId]=f.def)}n.external||Object.keys(s).length>0&&(n.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{const u=JSON.parse(JSON.stringify(i));return Object.defineProperty(u,"~standard",{value:{...e["~standard"],jsonSchema:{input:qc(e,"input",n.processors),output:qc(e,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Fe(n,e){const t=e??{seen:new Set};if(t.seen.has(n))return!1;t.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Fe(r.element,t);if(r.type==="set")return Fe(r.valueType,t);if(r.type==="lazy")return Fe(r.getter(),t);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Fe(r.innerType,t);if(r.type==="intersection")return Fe(r.left,t)||Fe(r.right,t);if(r.type==="record"||r.type==="map")return Fe(r.keyType,t)||Fe(r.valueType,t);if(r.type==="pipe")return Fe(r.in,t)||Fe(r.out,t);if(r.type==="object"){for(const i in r.shape)if(Fe(r.shape[i],t))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Fe(i,t))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Fe(i,t))return!0;return!!(r.rest&&Fe(r.rest,t))}return!1}const iT=(n,e={})=>t=>{const r=Wv({...t,processors:e});return Ee(n,r),Gv(r,n),Yv(r,n)},qc=(n,e,t={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=Wv({...i??{},target:s,io:e,processors:t});return Ee(n,o),Gv(o,n),Yv(o,n)},sT={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oT=(n,e,t,r)=>{const i=t;i.type="string";const{minimum:s,maximum:o,format:l,patterns:c,contentEncoding:u}=n._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),l&&(i.format=sT[l]??l,i.format===""&&delete i.format,l==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){const f=[...c];f.length===1?i.pattern=f[0].source:f.length>1&&(i.allOf=[...f.map(m=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},aT=(n,e,t,r)=>{const i=t,{minimum:s,maximum:o,format:l,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:f}=n._zod.bag;typeof l=="string"&&l.includes("int")?i.type="integer":i.type="number",typeof f=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.minimum=f,i.exclusiveMinimum=!0):i.exclusiveMinimum=f),typeof s=="number"&&(i.minimum=s,typeof f=="number"&&e.target!=="draft-04"&&(f>=s?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof o=="number"&&(i.maximum=o,typeof u=="number"&&e.target!=="draft-04"&&(u<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},lT=(n,e,t,r)=>{t.type="boolean"},cT=(n,e,t,r)=>{t.not={}},uT=(n,e,t,r)=>{},hT=(n,e,t,r)=>{const i=n._zod.def,s=$v(i.entries);s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),t.enum=s},dT=(n,e,t,r)=>{const i=n._zod.def,s=[];for(const o of i.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){const o=s[0];t.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[o]:t.const=o}else s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),s.every(o=>typeof o=="boolean")&&(t.type="boolean"),s.every(o=>o===null)&&(t.type="null"),t.enum=s},fT=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},pT=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},mT=(n,e,t,r)=>{const i=t,s=n._zod.def,{minimum:o,maximum:l}=n._zod.bag;typeof o=="number"&&(i.minItems=o),typeof l=="number"&&(i.maxItems=l),i.type="array",i.items=Ee(s.element,e,{...r,path:[...r.path,"items"]})},gT=(n,e,t,r)=>{var u;const i=t,s=n._zod.def;i.type="object",i.properties={};const o=s.shape;for(const f in o)i.properties[f]=Ee(o[f],e,{...r,path:[...r.path,"properties",f]});const l=new Set(Object.keys(o)),c=new Set([...l].filter(f=>{const m=s.shape[f]._zod;return e.io==="input"?m.optin===void 0:m.optout===void 0}));c.size>0&&(i.required=Array.from(c)),((u=s.catchall)==null?void 0:u._zod.def.type)==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=Ee(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},vT=(n,e,t,r)=>{const i=n._zod.def,s=i.inclusive===!1,o=i.options.map((l,c)=>Ee(l,e,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?t.oneOf=o:t.anyOf=o},yT=(n,e,t,r)=>{const i=n._zod.def,s=Ee(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=Ee(i.right,e,{...r,path:[...r.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,c=[...l(s)?s.allOf:[s],...l(o)?o.allOf:[o]];t.allOf=c},wT=(n,e,t,r)=>{const i=t,s=n._zod.def;i.type="object";const o=s.keyType,l=o._zod.bag,c=l==null?void 0:l.patterns;if(s.mode==="loose"&&c&&c.size>0){const f=Ee(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const m of c)i.patternProperties[m.source]=f}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=Ee(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=Ee(s.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const u=o._zod.values;if(u){const f=[...u].filter(m=>typeof m=="string"||typeof m=="number");f.length>0&&(i.required=f)}},bT=(n,e,t,r)=>{const i=n._zod.def,s=Ee(i.innerType,e,r),o=e.seen.get(n);e.target==="openapi-3.0"?(o.ref=i.innerType,t.nullable=!0):t.anyOf=[s,{type:"null"}]},_T=(n,e,t,r)=>{const i=n._zod.def;Ee(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},ST=(n,e,t,r)=>{const i=n._zod.def;Ee(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.default=JSON.parse(JSON.stringify(i.defaultValue))},AT=(n,e,t,r)=>{const i=n._zod.def;Ee(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,e.io==="input"&&(t._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},kT=(n,e,t,r)=>{const i=n._zod.def;Ee(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=o},ET=(n,e,t,r)=>{const i=n._zod.def,s=e.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;Ee(s,e,r);const o=e.seen.get(n);o.ref=s},$T=(n,e,t,r)=>{const i=n._zod.def;Ee(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.readOnly=!0},Kv=(n,e,t,r)=>{const i=n._zod.def;Ee(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},CT=E("ZodISODateTime",(n,e)=>{T$.init(n,e),ye.init(n,e)});function TT(n){return LC(CT,n)}const RT=E("ZodISODate",(n,e)=>{R$.init(n,e),ye.init(n,e)});function IT(n){return OC(RT,n)}const xT=E("ZodISOTime",(n,e)=>{I$.init(n,e),ye.init(n,e)});function PT(n){return zC(xT,n)}const DT=E("ZodISODuration",(n,e)=>{x$.init(n,e),ye.init(n,e)});function LT(n){return NC(DT,n)}const Jv=(n,e)=>{Iv.init(n,e),n.name="ZodError",Object.defineProperties(n,{format:{value:t=>_4(n,t)},flatten:{value:t=>b4(n,t)},addIssue:{value:t=>{n.issues.push(t),n.message=JSON.stringify(n.issues,vd,2)}},addIssues:{value:t=>{n.issues.push(...t),n.message=JSON.stringify(n.issues,vd,2)}},isEmpty:{get(){return n.issues.length===0}}})},Xm=E("ZodError",Jv),St=E("ZodError",Jv,{Parent:Error}),OT=lp(St),zT=cp(St),NT=Iu(St),MT=xu(St),UT=k4(St),ZT=E4(St),FT=$4(St),HT=C4(St),VT=T4(St),BT=R4(St),qT=I4(St),jT=x4(St),ve=E("ZodType",(n,e)=>(ge.init(n,e),Object.assign(n["~standard"],{jsonSchema:{input:qc(n,"input"),output:qc(n,"output")}}),n.toJSONSchema=iT(n,{}),n.def=e,n.type=e.type,Object.defineProperty(n,"_def",{value:e}),n.check=(...t)=>n.clone(Ur(e,{checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),n.with=n.check,n.clone=(t,r)=>Zr(n,t,r),n.brand=()=>n,n.register=(t,r)=>(t.add(n,r),n),n.parse=(t,r)=>OT(n,t,r,{callee:n.parse}),n.safeParse=(t,r)=>NT(n,t,r),n.parseAsync=async(t,r)=>zT(n,t,r,{callee:n.parseAsync}),n.safeParseAsync=async(t,r)=>MT(n,t,r),n.spa=n.safeParseAsync,n.encode=(t,r)=>UT(n,t,r),n.decode=(t,r)=>ZT(n,t,r),n.encodeAsync=async(t,r)=>FT(n,t,r),n.decodeAsync=async(t,r)=>HT(n,t,r),n.safeEncode=(t,r)=>VT(n,t,r),n.safeDecode=(t,r)=>BT(n,t,r),n.safeEncodeAsync=async(t,r)=>qT(n,t,r),n.safeDecodeAsync=async(t,r)=>jT(n,t,r),n.refine=(t,r)=>n.check(MR(t,r)),n.superRefine=t=>n.check(UR(t)),n.overwrite=t=>n.check(vo(t)),n.optional=()=>tg(n),n.exactOptional=()=>ER(n),n.nullable=()=>ng(n),n.nullish=()=>tg(ng(n)),n.nonoptional=t=>xR(n,t),n.array=()=>z(n),n.or=t=>j([n,t]),n.and=t=>Du(n,t),n.transform=t=>rg(n,AR(t)),n.default=t=>TR(n,t),n.prefault=t=>IR(n,t),n.catch=t=>DR(n,t),n.pipe=t=>rg(n,t),n.readonly=()=>zR(n),n.describe=t=>{const r=n.clone();return Uo.add(r,{description:t}),r},Object.defineProperty(n,"description",{get(){var t;return(t=Uo.get(n))==null?void 0:t.description},configurable:!0}),n.meta=(...t)=>{if(t.length===0)return Uo.get(n);const r=n.clone();return Uo.add(r,t[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=t=>t(n),n)),Xv=E("_ZodString",(n,e)=>{up.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(r,i,s)=>oT(n,r,i);const t=n._zod.bag;n.format=t.format??null,n.minLength=t.minimum??null,n.maxLength=t.maximum??null,n.regex=(...r)=>n.check(VC(...r)),n.includes=(...r)=>n.check(jC(...r)),n.startsWith=(...r)=>n.check(WC(...r)),n.endsWith=(...r)=>n.check(GC(...r)),n.min=(...r)=>n.check(Bc(...r)),n.max=(...r)=>n.check(qv(...r)),n.length=(...r)=>n.check(jv(...r)),n.nonempty=(...r)=>n.check(Bc(1,...r)),n.lowercase=r=>n.check(BC(r)),n.uppercase=r=>n.check(qC(r)),n.trim=()=>n.check(KC()),n.normalize=(...r)=>n.check(YC(...r)),n.toLowerCase=()=>n.check(JC()),n.toUpperCase=()=>n.check(XC()),n.slugify=()=>n.check(QC())}),WT=E("ZodString",(n,e)=>{up.init(n,e),Xv.init(n,e),n.email=t=>n.check(fC(GT,t)),n.url=t=>n.check(yC(YT,t)),n.jwt=t=>n.check(DC(uR,t)),n.emoji=t=>n.check(wC(KT,t)),n.guid=t=>n.check(Gm(Qm,t)),n.uuid=t=>n.check(pC(jl,t)),n.uuidv4=t=>n.check(mC(jl,t)),n.uuidv6=t=>n.check(gC(jl,t)),n.uuidv7=t=>n.check(vC(jl,t)),n.nanoid=t=>n.check(bC(JT,t)),n.guid=t=>n.check(Gm(Qm,t)),n.cuid=t=>n.check(_C(XT,t)),n.cuid2=t=>n.check(SC(QT,t)),n.ulid=t=>n.check(AC(eR,t)),n.base64=t=>n.check(IC(aR,t)),n.base64url=t=>n.check(xC(lR,t)),n.xid=t=>n.check(kC(tR,t)),n.ksuid=t=>n.check(EC(nR,t)),n.ipv4=t=>n.check($C(rR,t)),n.ipv6=t=>n.check(CC(iR,t)),n.cidrv4=t=>n.check(TC(sR,t)),n.cidrv6=t=>n.check(RC(oR,t)),n.e164=t=>n.check(PC(cR,t)),n.datetime=t=>n.check(TT(t)),n.date=t=>n.check(IT(t)),n.time=t=>n.check(PT(t)),n.duration=t=>n.check(LT(t))});function p(n){return dC(WT,n)}const ye=E("ZodStringFormat",(n,e)=>{pe.init(n,e),Xv.init(n,e)}),GT=E("ZodEmail",(n,e)=>{w$.init(n,e),ye.init(n,e)}),Qm=E("ZodGUID",(n,e)=>{v$.init(n,e),ye.init(n,e)}),jl=E("ZodUUID",(n,e)=>{y$.init(n,e),ye.init(n,e)}),YT=E("ZodURL",(n,e)=>{b$.init(n,e),ye.init(n,e)}),KT=E("ZodEmoji",(n,e)=>{_$.init(n,e),ye.init(n,e)}),JT=E("ZodNanoID",(n,e)=>{S$.init(n,e),ye.init(n,e)}),XT=E("ZodCUID",(n,e)=>{A$.init(n,e),ye.init(n,e)}),QT=E("ZodCUID2",(n,e)=>{k$.init(n,e),ye.init(n,e)}),eR=E("ZodULID",(n,e)=>{E$.init(n,e),ye.init(n,e)}),tR=E("ZodXID",(n,e)=>{$$.init(n,e),ye.init(n,e)}),nR=E("ZodKSUID",(n,e)=>{C$.init(n,e),ye.init(n,e)}),rR=E("ZodIPv4",(n,e)=>{P$.init(n,e),ye.init(n,e)}),iR=E("ZodIPv6",(n,e)=>{D$.init(n,e),ye.init(n,e)}),sR=E("ZodCIDRv4",(n,e)=>{L$.init(n,e),ye.init(n,e)}),oR=E("ZodCIDRv6",(n,e)=>{O$.init(n,e),ye.init(n,e)}),aR=E("ZodBase64",(n,e)=>{z$.init(n,e),ye.init(n,e)}),lR=E("ZodBase64URL",(n,e)=>{M$.init(n,e),ye.init(n,e)}),cR=E("ZodE164",(n,e)=>{U$.init(n,e),ye.init(n,e)}),uR=E("ZodJWT",(n,e)=>{F$.init(n,e),ye.init(n,e)}),Qv=E("ZodNumber",(n,e)=>{Zv.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(r,i,s)=>aT(n,r,i),n.gt=(r,i)=>n.check(Km(r,i)),n.gte=(r,i)=>n.check(Mh(r,i)),n.min=(r,i)=>n.check(Mh(r,i)),n.lt=(r,i)=>n.check(Ym(r,i)),n.lte=(r,i)=>n.check(Nh(r,i)),n.max=(r,i)=>n.check(Nh(r,i)),n.int=r=>n.check(eg(r)),n.safe=r=>n.check(eg(r)),n.positive=r=>n.check(Km(0,r)),n.nonnegative=r=>n.check(Mh(0,r)),n.negative=r=>n.check(Ym(0,r)),n.nonpositive=r=>n.check(Nh(0,r)),n.multipleOf=(r,i)=>n.check(Jm(r,i)),n.step=(r,i)=>n.check(Jm(r,i)),n.finite=()=>n;const t=n._zod.bag;n.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),n.isFinite=!0,n.format=t.format??null});function H(n){return MC(Qv,n)}const hR=E("ZodNumberFormat",(n,e)=>{H$.init(n,e),Qv.init(n,e)});function eg(n){return UC(hR,n)}const dR=E("ZodBoolean",(n,e)=>{V$.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>lT(n,t,r)});function Ie(n){return ZC(dR,n)}const fR=E("ZodUnknown",(n,e)=>{B$.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>uT()});function _(){return FC(fR)}const pR=E("ZodNever",(n,e)=>{q$.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>cT(n,t,r)});function mR(n){return HC(pR,n)}const gR=E("ZodArray",(n,e)=>{j$.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>mT(n,t,r,i),n.element=e.element,n.min=(t,r)=>n.check(Bc(t,r)),n.nonempty=t=>n.check(Bc(1,t)),n.max=(t,r)=>n.check(qv(t,r)),n.length=(t,r)=>n.check(jv(t,r)),n.unwrap=()=>n.element});function z(n,e){return eT(gR,n,e)}const ey=E("ZodObject",(n,e)=>{G$.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>gT(n,t,r,i),se(n,"shape",()=>e.shape),n.keyof=()=>ry(Object.keys(n._zod.def.shape)),n.catchall=t=>n.clone({...n._zod.def,catchall:t}),n.passthrough=()=>n.clone({...n._zod.def,catchall:_()}),n.loose=()=>n.clone({...n._zod.def,catchall:_()}),n.strict=()=>n.clone({...n._zod.def,catchall:mR()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=t=>m4(n,t),n.safeExtend=t=>g4(n,t),n.merge=t=>v4(n,t),n.pick=t=>f4(n,t),n.omit=t=>p4(n,t),n.partial=(...t)=>y4(iy,n,t[0]),n.required=(...t)=>w4(sy,n,t[0])});function ty(n,e){const t={type:"object",shape:n??{},...N(e)};return new ey(t)}function w(n,e){return new ey({type:"object",shape:n,catchall:_(),...N(e)})}const ny=E("ZodUnion",(n,e)=>{Vv.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>vT(n,t,r,i),n.options=e.options});function j(n,e){return new ny({type:"union",options:n,...N(e)})}const vR=E("ZodDiscriminatedUnion",(n,e)=>{ny.init(n,e),Y$.init(n,e)});function yR(n,e,t){return new vR({type:"union",options:e,discriminator:n,...N(t)})}const wR=E("ZodIntersection",(n,e)=>{K$.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>yT(n,t,r,i)});function Du(n,e){return new wR({type:"intersection",left:n,right:e})}const bR=E("ZodRecord",(n,e)=>{J$.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>wT(n,t,r,i),n.keyType=e.keyType,n.valueType=e.valueType});function A(n,e,t){return new bR({type:"record",keyType:n,valueType:e,...N(t)})}const wd=E("ZodEnum",(n,e)=>{X$.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(r,i,s)=>hT(n,r,i),n.enum=e.entries,n.options=Object.values(e.entries);const t=new Set(Object.keys(e.entries));n.extract=(r,i)=>{const s={};for(const o of r)if(t.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new wd({...e,checks:[],...N(i),entries:s})},n.exclude=(r,i)=>{const s={...e.entries};for(const o of r)if(t.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new wd({...e,checks:[],...N(i),entries:s})}});function ry(n,e){const t=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new wd({type:"enum",entries:t,...N(e)})}const _R=E("ZodLiteral",(n,e)=>{Q$.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>dT(n,t,r),n.values=new Set(e.values),Object.defineProperty(n,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function C(n,e){return new _R({type:"literal",values:Array.isArray(n)?n:[n],...N(e)})}const SR=E("ZodTransform",(n,e)=>{eC.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>pT(n,t),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new kv(n.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(ha(s,t.value,e));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),t.issues.push(ha(o))}};const i=e.transform(t.value,t);return i instanceof Promise?i.then(s=>(t.value=s,t)):(t.value=i,t)}});function AR(n){return new SR({type:"transform",transform:n})}const iy=E("ZodOptional",(n,e)=>{Bv.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Kv(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function tg(n){return new iy({type:"optional",innerType:n})}const kR=E("ZodExactOptional",(n,e)=>{tC.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Kv(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function ER(n){return new kR({type:"optional",innerType:n})}const $R=E("ZodNullable",(n,e)=>{nC.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>bT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function ng(n){return new $R({type:"nullable",innerType:n})}const CR=E("ZodDefault",(n,e)=>{rC.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>ST(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function TR(n,e){return new CR({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():Tv(e)}})}const RR=E("ZodPrefault",(n,e)=>{iC.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>AT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function IR(n,e){return new RR({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():Tv(e)}})}const sy=E("ZodNonOptional",(n,e)=>{sC.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>_T(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function xR(n,e){return new sy({type:"nonoptional",innerType:n,...N(e)})}const PR=E("ZodCatch",(n,e)=>{oC.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>kT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function DR(n,e){return new PR({type:"catch",innerType:n,catchValue:typeof e=="function"?e:()=>e})}const LR=E("ZodPipe",(n,e)=>{aC.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>ET(n,t,r,i),n.in=e.in,n.out=e.out});function rg(n,e){return new LR({type:"pipe",in:n,out:e})}const OR=E("ZodReadonly",(n,e)=>{lC.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>$T(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function zR(n){return new OR({type:"readonly",innerType:n})}const NR=E("ZodCustom",(n,e)=>{cC.init(n,e),ve.init(n,e),n._zod.processJSONSchema=(t,r,i)=>fT(n,t)});function MR(n,e={}){return tT(NR,n,e)}function UR(n){return nT(n)}const ZR=[".md",".markdown"];function oy(n){if(n.length===0)return!1;const e=n.at(-1);return e==="/"||e==="\\"}function ay(n){const e=n.lastIndexOf("/"),t=n.lastIndexOf("\\");return n.slice(Math.max(e,t)+1)}function FR(n){return ay(n).toLowerCase()}function HR(n,e){const t=FR(n);return e.some(r=>t.endsWith(r))}function ly(n){return!oy(n)&&HR(n,ZR)}function VR(n){let e;try{e=new URL(n)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function Rn(n){try{const{pathname:e}=new URL(n);return/^\/artifact\/[0-9A-Za-z]{26}(\/|$)/.test(e)}catch{return!1}}const BR=ty({id:p().min(1),kind:C("path"),title:p(),path:p()}).strict(),qR=ty({id:p().min(1),kind:C("url"),title:p(),url:p().refine(VR,{message:"url must be an http(s) URL"})}).strict();yR("kind",[BR,qR]);const jR=new Set(["about:","blob:","chrome-extension:","chrome:","data:","devtools:","file:","filesystem:","javascript:","view-source:"]);function WR(n,e){try{const t=new URL(e),r=new URL(n,t);return r.protocol==="http:"||r.protocol==="https:"?{kind:"web",url:r.href}:jR.has(r.protocol)?{kind:"browser-local",url:r.href}:{kind:"application",url:r.href}}catch{return{kind:"invalid"}}}function ig(n,e){return WR(n,e).kind==="web"}const GR="/views/markdown/",YR="/views/url-unsupported/";function cy(n){return`/artifact/${encodeURIComponent(n)}`}function KR(n,e){return`${cy(n)}/${encodeURIComponent(e)}`}function JR(n){return`/markdown/${encodeURIComponent(n)}`}function bd(n,e={electron:!1}){if(n.kind==="url")return e.electron?{renderer:"url-webview",viewURL:n.url,contentURL:null}:Rn(n.url)?{renderer:"proxy-iframe",viewURL:n.url,contentURL:null}:{renderer:"url-unsupported",viewURL:YR,contentURL:null};if(ly(n.path)){const r={viewURL:GR,contentURL:JR(n.id)};return e.electron?{renderer:"url-webview",...r}:{renderer:"markdown",...r}}const t=oy(n.path)?`${cy(n.id)}/`:KR(n.id,ay(n.path));return e.electron?{renderer:"url-webview",viewURL:t,contentURL:null}:{renderer:"proxy-iframe",viewURL:t,contentURL:null}}const XR="serverURL",QR="token",e3="mode",t3="desktopAppVersion",n3="electron";function r3(n=window.location.search,e=window.location.origin){const r=new URLSearchParams(n).get(XR);return r?new URL(r).origin:new URL(e).origin}function i3(n=window.location.search){return new URLSearchParams(n).get(QR)}function Gn(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(e3)===n3}function uy(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(t3)}const sg="tv.telemetry.clientId",s3=5,o3=60,a3=1e3,l3=s3*o3*a3,og=["pointerdown","scroll","keydown"],ag=["focus"],lg=["visibilitychange"],c3="hidden";function u3(n,e=m3){const t=n.getItem(sg);if(t)return t;const r=e();return n.setItem(sg,r),r}function h3(n){return{clientId:u3(n.storage,n.idFactory),userAgent:n.userAgent??(typeof navigator>"u"?"":navigator.userAgent),clientApp:n.clientApp,...n.desktopAppVersion?{desktopAppVersion:n.desktopAppVersion}:{}}}function d3(n){const e=new URLSearchParams;return e.set("clientId",n.clientId),e.set("userAgent",n.userAgent),e.set("clientApp",n.clientApp),n.desktopAppVersion&&e.set("desktopAppVersion",n.desktopAppVersion),e}function f3(n){return new p3(n)}var wa,Ln,sr,ba,_a,lt,ai,Sa,nu,hy;class p3{constructor(e){g(this,nu);g(this,wa);g(this,Ln);g(this,sr);g(this,ba);g(this,_a);g(this,lt);g(this,ai,!1);g(this,Sa,Number.NEGATIVE_INFINITY);d(this,wa,e.meta),d(this,Ln,e.documentTarget),d(this,sr,e.windowTarget),d(this,ba,e.send),d(this,_a,e.nowMs??Date.now),d(this,lt,()=>h(this,nu,hy).call(this))}start(){if(!a(this,ai)){d(this,ai,!0);for(const e of og)a(this,sr).addEventListener(e,a(this,lt)),a(this,Ln).addEventListener(e,a(this,lt));for(const e of ag)a(this,sr).addEventListener(e,a(this,lt));for(const e of lg)a(this,Ln).addEventListener(e,a(this,lt))}}stop(){if(a(this,ai)){d(this,ai,!1);for(const e of og)a(this,sr).removeEventListener(e,a(this,lt)),a(this,Ln).removeEventListener(e,a(this,lt));for(const e of ag)a(this,sr).removeEventListener(e,a(this,lt));for(const e of lg)a(this,Ln).removeEventListener(e,a(this,lt))}}}wa=new WeakMap,Ln=new WeakMap,sr=new WeakMap,ba=new WeakMap,_a=new WeakMap,lt=new WeakMap,ai=new WeakMap,Sa=new WeakMap,nu=new WeakSet,hy=function(){if(a(this,Ln).visibilityState===c3)return;const e=a(this,_a).call(this);e-a(this,Sa)<l3||(d(this,Sa,e),a(this,ba).call(this,{type:uE,clientId:a(this,wa).clientId}))};function m3(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():ip().toLowerCase()}const fe={authenticate:"authenticate",document_did_change:"document/didChange",document_did_close:"document/didClose",document_did_focus:"document/didFocus",document_did_open:"document/didOpen",document_did_save:"document/didSave",initialize:"initialize",logout:"logout",nes_accept:"nes/accept",nes_close:"nes/close",nes_reject:"nes/reject",nes_start:"nes/start",nes_suggest:"nes/suggest",session_cancel:"session/cancel",session_close:"session/close",session_fork:"session/fork",session_list:"session/list",session_load:"session/load",session_new:"session/new",session_prompt:"session/prompt",session_resume:"session/resume",session_set_config_option:"session/set_config_option",session_set_mode:"session/set_mode",session_set_model:"session/set_model"},En={fs_read_text_file:"fs/read_text_file",fs_write_text_file:"fs/write_text_file",session_request_permission:"session/request_permission",session_update:"session/update",terminal_create:"terminal/create",terminal_kill:"terminal/kill",terminal_output:"terminal/output",terminal_release:"terminal/release",terminal_wait_for_exit:"terminal/wait_for_exit"},g3=1,v3=w({_meta:A(p(),_()).nullish(),terminal:Ie().optional().default(!1)}),y3=w({_meta:A(p(),_()).nullish(),label:p().nullish(),name:p(),optional:Ie().optional().default(!1),secret:Ie().optional().default(!0)}),w3=w({_meta:A(p(),_()).nullish(),description:p().nullish(),id:p(),name:p()}),b3=w({_meta:A(p(),_()).nullish(),description:p().nullish(),id:p(),link:p().nullish(),name:p(),vars:z(y3)}),_3=w({_meta:A(p(),_()).nullish(),args:z(p()).optional(),description:p().nullish(),env:A(p(),p()).optional(),id:p(),name:p()}),S3=j([b3.and(w({type:C("env_var")})),_3.and(w({type:C("terminal")})),w3]),A3=w({_meta:A(p(),_()).nullish(),methodId:p()}),k3=w({_meta:A(p(),_()).nullish()}),E3=w({_meta:A(p(),_()).nullish(),blob:p(),mimeType:p().nullish(),uri:p()}),$3=w({default:Ie().nullish(),description:p().nullish(),title:p().nullish()}),C3=w({_meta:A(p(),_()).nullish()}),T3=w({_meta:A(p(),_()).nullish()}),R3=w({amount:H(),currency:p()}),I3=w({_meta:A(p(),_()).nullish(),terminalId:p()}),x3=w({_meta:A(p(),_()).nullish(),newText:p(),oldText:p().nullish(),path:p()}),P3=j([p(),H(),H(),Ie(),z(p())]),D3=w({content:A(p(),P3).nullish()}),L3=j([D3.and(w({action:C("accept")})),w({action:C("decline")}),w({action:C("cancel")})]),O3=w({_meta:A(p(),_()).nullish()}),dy=p(),z3=w({_meta:A(p(),_()).nullish(),elicitationId:dy}),N3=w({_meta:A(p(),_()).nullish(),action:L3}),M3=C("object"),U3=C("string"),Z3=w({_meta:A(p(),_()).nullish()}),F3=w({_meta:A(p(),_()).nullish(),form:O3.nullish(),url:Z3.nullish()}),H3=w({elicitationId:dy,url:p().url()}),fy=w({const:p(),title:p()}),py=w({_meta:A(p(),_()).nullish(),name:p(),value:p()}),V3=j([C(-32700),C(-32600),C(-32601),C(-32602),C(-32603),C(-32800),C(-32e3),C(-32002),C(-32042),H().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),my=w({code:V3,data:_().optional(),message:p()}),gy=_(),vy=_(),yy=_(),B3=w({_meta:A(p(),_()).nullish(),readTextFile:Ie().optional().default(!1),writeTextFile:Ie().optional().default(!1)}),wy=w({_meta:A(p(),_()).nullish(),name:p(),value:p()}),by=w({_meta:A(p(),_()).nullish(),name:p(),title:p().nullish(),version:p()}),q3=w({default:H().nullish(),description:p().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:p().nullish()}),j3=w({_meta:A(p(),_()).nullish()}),W3=w({_meta:A(p(),_()).nullish(),additionalDirectories:z(p()).optional(),cursor:p().nullish(),cwd:p().nullish()}),G3=w({_meta:A(p(),_()).nullish()}),Y3=w({_meta:A(p(),_()).nullish(),logout:G3.nullish()}),K3=w({_meta:A(p(),_()).nullish()}),J3=w({_meta:A(p(),_()).nullish()}),X3=w({_meta:A(p(),_()).nullish(),http:Ie().optional().default(!1),sse:Ie().optional().default(!1)}),Q3=w({_meta:A(p(),_()).nullish(),headers:z(wy),name:p(),url:p()}),eI=w({_meta:A(p(),_()).nullish(),headers:z(wy),name:p(),url:p()}),tI=w({_meta:A(p(),_()).nullish(),args:z(p()),command:p(),env:z(py),name:p()}),Lu=j([Q3.and(w({type:C("http")})),eI.and(w({type:C("sse")})),tI]),hp=p(),nI=w({_meta:A(p(),_()).nullish(),description:p().nullish(),modelId:hp,name:p()}),rI=j([C("error"),C("warning"),C("information"),C("hint")]),iI=w({_meta:A(p(),_()).nullish()}),sI=w({_meta:A(p(),_()).nullish()}),oI=w({_meta:A(p(),_()).nullish()}),aI=w({_meta:A(p(),_()).nullish()}),lI=w({_meta:A(p(),_()).nullish()}),cI=w({_meta:A(p(),_()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),uI=w({diff:p(),uri:p()}),hI=w({endLine:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:p()}),dI=w({_meta:A(p(),_()).nullish()}),fI=w({_meta:A(p(),_()).nullish()}),pI=w({languageId:p(),text:p(),uri:p()}),mI=w({_meta:A(p(),_()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),gI=j([C("rejected"),C("ignored"),C("replaced"),C("cancelled")]),vI=w({excerpts:z(hI),uri:p()}),yI=w({_meta:A(p(),_()).nullish()}),wI=w({_meta:A(p(),_()).nullish()}),bI=w({name:p(),owner:p(),remoteUrl:p()}),_I=w({_meta:A(p(),_()).nullish()}),SI=w({_meta:A(p(),_()).nullish(),jump:dI.nullish(),rename:wI.nullish(),searchAndReplace:_I.nullish()}),AI=w({id:p(),isRegex:Ie().nullish(),replace:p(),search:p(),uri:p()}),kI=j([C("automatic"),C("diagnostic"),C("manual")]),EI=w({_meta:A(p(),_()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),$I=w({_meta:A(p(),_()).nullish(),diagnostics:iI.nullish(),editHistory:cI.nullish(),openFiles:fI.nullish(),recentFiles:mI.nullish(),relatedSnippets:yI.nullish(),userActions:EI.nullish()}),CI=w({_meta:A(p(),_()).nullish(),additionalDirectories:z(p()).optional(),cwd:p(),mcpServers:z(Lu)}),TI=w({default:H().nullish(),description:p().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:p().nullish()}),_y=p(),RI=j([C("allow_once"),C("allow_always"),C("reject_once"),C("reject_always")]),II=w({_meta:A(p(),_()).nullish(),kind:RI,name:p(),optionId:_y}),xI=j([C("high"),C("medium"),C("low")]),PI=j([C("pending"),C("in_progress"),C("completed")]),DI=w({_meta:A(p(),_()).nullish(),content:p(),priority:xI,status:PI}),LI=w({_meta:A(p(),_()).nullish(),entries:z(DI)}),Lr=w({character:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),OI=w({id:p(),position:Lr,uri:p()}),zI=w({id:p(),newName:p(),position:Lr,uri:p()}),NI=w({action:p(),position:Lr,timestampMs:H(),uri:p()}),Sy=j([C("utf-16"),C("utf-32"),C("utf-8")]),MI=w({_meta:A(p(),_()).nullish(),auth:v3.optional().default({terminal:!1}),elicitation:F3.nullish(),fs:B3.optional().default({readTextFile:!1,writeTextFile:!1}),nes:SI.nullish(),positionEncodings:z(Sy).optional(),terminal:Ie().optional().default(!1)}),UI=w({_meta:A(p(),_()).nullish(),audio:Ie().optional().default(!1),embeddedContext:Ie().optional().default(!1),image:Ie().optional().default(!1)}),Ay=H().int().gte(0).lte(65535),ZI=w({_meta:A(p(),_()).nullish(),clientCapabilities:MI.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:by.nullish(),protocolVersion:Ay}),yo=w({end:Lr,start:Lr}),FI=w({message:p(),range:yo,severity:rI,uri:p()}),HI=w({languageId:p(),lastFocusedMs:H().nullish(),uri:p(),visibleRange:yo.nullish()}),VI=w({_meta:A(p(),_()).nullish(),diagnostics:z(FI).nullish(),editHistory:z(uI).nullish(),openFiles:z(HI).nullish(),recentFiles:z(pI).nullish(),relatedSnippets:z(vI).nullish(),userActions:z(NI).nullish()}),BI=w({newText:p(),range:yo}),qI=w({cursorPosition:Lr.nullish(),edits:z(BI),id:p(),uri:p()}),jI=j([qI.and(w({kind:C("edit")})),OI.and(w({kind:C("jump")})),zI.and(w({kind:C("rename")})),AI.and(w({kind:C("searchAndReplace")}))]),WI=w({_meta:A(p(),_()).nullish(),content:p()}),GI=w({_meta:A(p(),_()).nullish()}),Zi=j([H(),p()]).nullable();w({_meta:A(p(),_()).nullish(),requestId:Zi});const YI=ry(["assistant","user"]),kl=w({_meta:A(p(),_()).nullish(),audience:z(YI).nullish(),lastModified:p().nullish(),priority:H().nullish()}),KI=w({_meta:A(p(),_()).nullish(),annotations:kl.nullish(),data:p(),mimeType:p()}),JI=w({_meta:A(p(),_()).nullish(),annotations:kl.nullish(),data:p(),mimeType:p(),uri:p().nullish()}),XI=w({_meta:A(p(),_()).nullish(),annotations:kl.nullish(),description:p().nullish(),mimeType:p().nullish(),name:p(),size:H().nullish(),title:p().nullish(),uri:p()}),QI=w({_meta:A(p(),_()).nullish(),optionId:_y}),ex=j([w({outcome:C("cancelled")}),QI.and(w({outcome:C("selected")}))]),tx=w({_meta:A(p(),_()).nullish(),outcome:ex}),nx=w({_meta:A(p(),_()).nullish()}),rx=w({_meta:A(p(),_()).nullish()}),ix=w({currentValue:Ie()}),sx=p(),ky=p(),ox=j([C("mode"),C("model"),C("thought_level"),p()]),dp=p(),Ey=w({_meta:A(p(),_()).nullish(),description:p().nullish(),name:p(),value:dp}),ax=w({_meta:A(p(),_()).nullish(),group:sx,name:p(),options:z(Ey)}),lx=j([z(Ey),z(ax)]),cx=w({currentValue:dp,options:lx}),wo=Du(j([cx.and(w({type:C("select")})),ix.and(w({type:C("boolean")}))]),w({_meta:A(p(),_()).nullish(),category:ox.nullish(),description:p().nullish(),id:ky,name:p()})),ux=w({_meta:A(p(),_()).nullish(),configOptions:z(wo)}),hx=w({_meta:A(p(),_()).nullish()}),ie=p(),dx=w({_meta:A(p(),_()).nullish(),id:p(),sessionId:ie}),fx=w({_meta:A(p(),_()).nullish(),sessionId:ie}),px=w({_meta:A(p(),_()).nullish(),sessionId:ie}),mx=w({_meta:A(p(),_()).nullish(),sessionId:ie}),$y=w({_meta:A(p(),_()).nullish(),args:z(p()).optional(),command:p(),cwd:p().nullish(),env:z(py).optional(),outputByteLimit:H().nullish(),sessionId:ie}),gx=w({_meta:A(p(),_()).nullish(),sessionId:ie,uri:p()}),vx=w({_meta:A(p(),_()).nullish(),position:Lr,sessionId:ie,uri:p(),version:H(),visibleRange:yo}),yx=w({_meta:A(p(),_()).nullish(),languageId:p(),sessionId:ie,text:p(),uri:p(),version:H()}),wx=w({_meta:A(p(),_()).nullish(),sessionId:ie,uri:p()}),bx=w({_meta:A(p(),_()).nullish(),additionalDirectories:z(p()).optional(),cwd:p(),mcpServers:z(Lu).optional(),sessionId:ie}),Cy=w({_meta:A(p(),_()).nullish(),sessionId:ie,terminalId:p()}),_x=w({_meta:A(p(),_()).nullish(),additionalDirectories:z(p()).optional(),cwd:p(),mcpServers:z(Lu),sessionId:ie}),Ty=w({_meta:A(p(),_()).nullish(),limit:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:p(),sessionId:ie}),Sx=w({_meta:A(p(),_()).nullish(),id:p(),reason:gI.nullish(),sessionId:ie}),Ry=w({_meta:A(p(),_()).nullish(),sessionId:ie,terminalId:p()}),Ax=w({_meta:A(p(),_()).nullish(),additionalDirectories:z(p()).optional(),cwd:p(),mcpServers:z(Lu).optional(),sessionId:ie}),kx=w({_meta:A(p(),_()).nullish(),additionalDirectories:z(p()).optional(),cwd:p(),sessionId:ie,title:p().nullish(),updatedAt:p().nullish()}),Ex=w({_meta:A(p(),_()).nullish(),nextCursor:p().nullish(),sessions:z(kx)}),$x=w({_meta:A(p(),_()).nullish(),title:p().nullish(),updatedAt:p().nullish()}),Cx=w({_meta:A(p(),_()).nullish()}),Ou=p(),Tx=w({_meta:A(p(),_()).nullish(),currentModeId:Ou}),Rx=w({_meta:A(p(),_()).nullish(),description:p().nullish(),id:Ou,name:p()}),zu=w({_meta:A(p(),_()).nullish(),availableModes:z(Rx),currentModeId:Ou}),Nu=w({_meta:A(p(),_()).nullish(),availableModels:z(nI),currentModelId:hp}),Ix=w({_meta:A(p(),_()).nullish(),configOptions:z(wo).nullish(),models:Nu.nullish(),modes:zu.nullish(),sessionId:ie}),xx=w({_meta:A(p(),_()).nullish(),configOptions:z(wo).nullish(),models:Nu.nullish(),modes:zu.nullish()}),Px=w({_meta:A(p(),_()).nullish(),configOptions:z(wo).nullish(),models:Nu.nullish(),modes:zu.nullish(),sessionId:ie}),Dx=w({_meta:A(p(),_()).nullish(),configOptions:z(wo).nullish(),models:Nu.nullish(),modes:zu.nullish()}),Lx=w({_meta:A(p(),_()).nullish()}),Ox=w({_meta:A(p(),_()).nullish(),additionalDirectories:nx.nullish(),close:rx.nullish(),fork:hx.nullish(),list:Cx.nullish(),resume:Lx.nullish()}),zx=Du(j([w({type:C("boolean"),value:Ie()}),w({value:dp})]),w({_meta:A(p(),_()).nullish(),configId:ky,sessionId:ie})),Nx=w({_meta:A(p(),_()).nullish(),configOptions:z(wo)}),Mx=w({_meta:A(p(),_()).nullish(),modeId:Ou,sessionId:ie}),Ux=w({_meta:A(p(),_()).nullish()}),Zx=w({_meta:A(p(),_()).nullish(),modelId:hp,sessionId:ie}),Fx=w({_meta:A(p(),_()).nullish()}),Hx=w({_meta:A(p(),_()).nullish(),sessionId:ie}),Vx=j([C("end_turn"),C("max_tokens"),C("max_turn_requests"),C("refusal"),C("cancelled")]),Bx=j([C("email"),C("uri"),C("date"),C("date-time")]),qx=w({default:p().nullish(),description:p().nullish(),enum:z(p()).nullish(),format:Bx.nullish(),maxLength:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:z(fy).nullish(),pattern:p().nullish(),title:p().nullish()}),jx=w({_meta:A(p(),_()).nullish(),context:VI.nullish(),position:Lr,selection:yo.nullish(),sessionId:ie,triggerKind:kI,uri:p(),version:H()}),Wx=w({_meta:A(p(),_()).nullish(),suggestions:z(jI)}),Gx=w({_meta:A(p(),_()).nullish(),terminalId:p()}),Yx=w({_meta:A(p(),_()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:p().nullish()}),Iy=w({_meta:A(p(),_()).nullish(),sessionId:ie,terminalId:p()}),Kx=w({_meta:A(p(),_()).nullish(),exitStatus:Yx.nullish(),output:p(),truncated:Ie()}),Jx=w({_meta:A(p(),_()).nullish(),annotations:kl.nullish(),text:p()}),Xx=w({range:yo.nullish(),text:p()}),Qx=w({_meta:A(p(),_()).nullish(),contentChanges:z(Xx),sessionId:ie,uri:p(),version:H()});w({method:p(),params:j([fx,yx,Qx,gx,wx,vx,dx,Sx,gy]).nullish()});const eP=j([C("full"),C("incremental")]),tP=w({_meta:A(p(),_()).nullish(),syncKind:eP}),nP=w({_meta:A(p(),_()).nullish(),didChange:tP.nullish(),didClose:sI.nullish(),didFocus:oI.nullish(),didOpen:aI.nullish(),didSave:lI.nullish()}),rP=w({_meta:A(p(),_()).nullish(),document:nP.nullish()}),iP=w({_meta:A(p(),_()).nullish(),context:$I.nullish(),events:rP.nullish()}),sP=w({_meta:A(p(),_()).nullish(),auth:Y3.optional().default({}),loadSession:Ie().optional().default(!1),mcpCapabilities:X3.optional().default({http:!1,sse:!1}),nes:iP.nullish(),positionEncoding:Sy.nullish(),promptCapabilities:UI.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:Ox.optional().default({})}),oP=w({_meta:A(p(),_()).nullish(),agentCapabilities:sP.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:by.nullish(),authMethods:z(S3).optional().default([]),protocolVersion:Ay}),aP=w({_meta:A(p(),_()).nullish(),mimeType:p().nullish(),text:p(),uri:p()}),lP=j([aP,E3]),cP=w({_meta:A(p(),_()).nullish(),annotations:kl.nullish(),resource:lP}),fp=j([Jx.and(w({type:C("text")})),JI.and(w({type:C("image")})),KI.and(w({type:C("audio")})),XI.and(w({type:C("resource_link")})),cP.and(w({type:C("resource")}))]),uP=w({_meta:A(p(),_()).nullish(),content:fp}),Uh=w({_meta:A(p(),_()).nullish(),content:fp,messageId:p().nullish()}),hP=w({_meta:A(p(),_()).nullish(),messageId:p().nullish(),prompt:z(fp),sessionId:ie}),dP=w({anyOf:z(fy)}),xy=j([uP.and(w({type:C("content")})),x3.and(w({type:C("diff")})),Gx.and(w({type:C("terminal")}))]),Py=p(),Dy=w({_meta:A(p(),_()).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:p()}),Ly=j([C("pending"),C("in_progress"),C("completed"),C("failed")]),Oy=j([C("read"),C("edit"),C("delete"),C("move"),C("search"),C("execute"),C("think"),C("fetch"),C("switch_mode"),C("other")]),fP=w({_meta:A(p(),_()).nullish(),content:z(xy).optional(),kind:Oy.optional(),locations:z(Dy).optional(),rawInput:_().optional(),rawOutput:_().optional(),status:Ly.optional(),title:p(),toolCallId:Py}),zy=w({_meta:A(p(),_()).nullish(),content:z(xy).nullish(),kind:Oy.nullish(),locations:z(Dy).nullish(),rawInput:_().optional(),rawOutput:_().optional(),status:Ly.nullish(),title:p().nullish(),toolCallId:Py}),Ny=w({_meta:A(p(),_()).nullish(),options:z(II),sessionId:ie,toolCall:zy}),pP=w({_meta:A(p(),_()).nullish(),hint:p()}),mP=pP,gP=w({_meta:A(p(),_()).nullish(),description:p(),input:mP.nullish(),name:p()}),vP=w({_meta:A(p(),_()).nullish(),availableCommands:z(gP)}),yP=w({enum:z(p()),type:U3}),wP=j([yP,dP]),bP=w({default:z(p()).nullish(),description:p().nullish(),items:wP,maxItems:H().nullish(),minItems:H().nullish(),title:p().nullish()}),_P=j([qx.and(w({type:C("string")})),TI.and(w({type:C("number")})),q3.and(w({type:C("integer")})),$3.and(w({type:C("boolean")})),bP.and(w({type:C("array")}))]),SP=w({description:p().nullish(),properties:A(p(),_P).optional().default({}),required:z(p()).nullish(),title:p().nullish(),type:M3.optional().default("object")}),AP=w({requestedSchema:SP}),kP=Du(j([AP.and(w({mode:C("form")})),H3.and(w({mode:C("url")}))]),w({_meta:A(p(),_()).nullish(),message:p(),sessionId:ie})),EP=w({cachedReadTokens:H().nullish(),cachedWriteTokens:H().nullish(),inputTokens:H(),outputTokens:H(),thoughtTokens:H().nullish(),totalTokens:H()}),$P=w({_meta:A(p(),_()).nullish(),stopReason:Vx,usage:EP.nullish(),userMessageId:p().nullish()});j([w({id:Zi,result:j([oP,k3,J3,Px,xx,Ex,Ix,Dx,T3,Ux,Nx,$P,Fx,Hx,Wx,C3,yy])}),w({error:my,id:Zi})]);const CP=w({_meta:A(p(),_()).nullish(),cost:R3.nullish(),size:H(),used:H()}),TP=j([Uh.and(w({sessionUpdate:C("user_message_chunk")})),Uh.and(w({sessionUpdate:C("agent_message_chunk")})),Uh.and(w({sessionUpdate:C("agent_thought_chunk")})),fP.and(w({sessionUpdate:C("tool_call")})),zy.and(w({sessionUpdate:C("tool_call_update")})),LI.and(w({sessionUpdate:C("plan")})),vP.and(w({sessionUpdate:C("available_commands_update")})),Tx.and(w({sessionUpdate:C("current_mode_update")})),ux.and(w({sessionUpdate:C("config_option_update")})),$x.and(w({sessionUpdate:C("session_info_update")})),CP.and(w({sessionUpdate:C("usage_update")}))]),My=w({_meta:A(p(),_()).nullish(),sessionId:ie,update:TP});w({method:p(),params:j([My,z3,gy]).nullish()});const Uy=w({_meta:A(p(),_()).nullish(),sessionId:ie,terminalId:p()}),RP=w({_meta:A(p(),_()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:p().nullish()}),IP=w({name:p(),uri:p()}),xP=w({_meta:A(p(),_()).nullish(),repository:bI.nullish(),workspaceFolders:z(IP).nullish(),workspaceUri:p().nullish()});w({id:Zi,method:p(),params:j([ZI,A3,K3,CI,_x,W3,bx,Ax,mx,Mx,zx,hP,Zx,xP,jx,px,vy]).nullish()});const Zy=w({_meta:A(p(),_()).nullish(),content:p(),path:p(),sessionId:ie});w({id:Zi,method:p(),params:j([Zy,Ty,Ny,$y,Iy,Ry,Uy,Cy,kP,vy]).nullish()});const PP=w({_meta:A(p(),_()).nullish()});j([w({id:Zi,result:j([PP,WI,tx,I3,Kx,GI,RP,j3,N3,yy])}),w({error:my,id:Zi})]);var ne;class DP{constructor(e,t){g(this,ne);const r=e(this),i=async(o,l)=>{var c,u,f,m,v,y,k;switch(o){case En.fs_write_text_file:{const S=Zy.parse(l);return(c=r.writeTextFile)==null?void 0:c.call(r,S)}case En.fs_read_text_file:{const S=Ty.parse(l);return(u=r.readTextFile)==null?void 0:u.call(r,S)}case En.session_request_permission:{const S=Ny.parse(l);return r.requestPermission(S)}case En.terminal_create:{const S=$y.parse(l);return(f=r.createTerminal)==null?void 0:f.call(r,S)}case En.terminal_output:{const S=Iy.parse(l);return(m=r.terminalOutput)==null?void 0:m.call(r,S)}case En.terminal_release:{const S=Ry.parse(l);return await((v=r.releaseTerminal)==null?void 0:v.call(r,S))??{}}case En.terminal_wait_for_exit:{const S=Uy.parse(l);return(y=r.waitForTerminalExit)==null?void 0:y.call(r,S)}case En.terminal_kill:{const S=Cy.parse(l);return await((k=r.killTerminal)==null?void 0:k.call(r,S))??{}}default:if(r.extMethod)return r.extMethod(o,l);throw Ce.methodNotFound(o)}},s=async(o,l)=>{switch(o){case En.session_update:{const c=My.parse(l);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(o,l);throw Ce.methodNotFound(o)}};d(this,ne,new LP(i,s,t))}async initialize(e){return await a(this,ne).sendRequest(fe.initialize,e)}async newSession(e){return await a(this,ne).sendRequest(fe.session_new,e)}async loadSession(e){return await a(this,ne).sendRequest(fe.session_load,e)??{}}async unstable_forkSession(e){return await a(this,ne).sendRequest(fe.session_fork,e)}async listSessions(e){return await a(this,ne).sendRequest(fe.session_list,e)}async unstable_resumeSession(e){return await a(this,ne).sendRequest(fe.session_resume,e)}async unstable_closeSession(e){return await a(this,ne).sendRequest(fe.session_close,e)}async setSessionMode(e){return await a(this,ne).sendRequest(fe.session_set_mode,e)??{}}async unstable_setSessionModel(e){return await a(this,ne).sendRequest(fe.session_set_model,e)??{}}async setSessionConfigOption(e){return await a(this,ne).sendRequest(fe.session_set_config_option,e)}async authenticate(e){return await a(this,ne).sendRequest(fe.authenticate,e)??{}}async unstable_logout(e){return await a(this,ne).sendRequest(fe.logout,e)??{}}async prompt(e){return await a(this,ne).sendRequest(fe.session_prompt,e)}async cancel(e){return await a(this,ne).sendNotification(fe.session_cancel,e)}async unstable_startNes(e){return await a(this,ne).sendRequest(fe.nes_start,e)}async unstable_suggestNes(e){return await a(this,ne).sendRequest(fe.nes_suggest,e)}async unstable_closeNes(e){return await a(this,ne).sendRequest(fe.nes_close,e)??{}}async unstable_didOpenDocument(e){return await a(this,ne).sendNotification(fe.document_did_open,e)}async unstable_didChangeDocument(e){return await a(this,ne).sendNotification(fe.document_did_change,e)}async unstable_didCloseDocument(e){return await a(this,ne).sendNotification(fe.document_did_close,e)}async unstable_didSaveDocument(e){return await a(this,ne).sendNotification(fe.document_did_save,e)}async unstable_didFocusDocument(e){return await a(this,ne).sendNotification(fe.document_did_focus,e)}async unstable_acceptNes(e){return await a(this,ne).sendNotification(fe.nes_accept,e)}async unstable_rejectNes(e){return await a(this,ne).sendNotification(fe.nes_reject,e)}async extMethod(e,t){return await a(this,ne).sendRequest(e,t)}async extNotification(e,t){return await a(this,ne).sendNotification(e,t)}get signal(){return a(this,ne).signal}get closed(){return a(this,ne).closed}}ne=new WeakMap;var or,ru,Aa,ka,Ss,As,Bt,Ea,me,Fy,_d,Hy,Vy,By,qy,Sd,Zo;class LP{constructor(e,t,r){g(this,me);g(this,or,new Map);g(this,ru,0);g(this,Aa);g(this,ka);g(this,Ss);g(this,As,Promise.resolve());g(this,Bt,new AbortController);g(this,Ea);d(this,Aa,e),d(this,ka,t),d(this,Ss,r),d(this,Ea,new Promise(i=>{a(this,Bt).signal.addEventListener("abort",()=>i())})),h(this,me,Fy).call(this)}get signal(){return a(this,Bt).signal}get closed(){return a(this,Ea)}async sendRequest(e,t){h(this,me,Sd).call(this);const r=sh(this,ru)._++,i=new Promise((s,o)=>{a(this,or).set(r,{resolve:s,reject:o})});return await h(this,me,Zo).call(this,{jsonrpc:"2.0",id:r,method:e,params:t}),i}async sendNotification(e,t){h(this,me,Sd).call(this),await h(this,me,Zo).call(this,{jsonrpc:"2.0",method:e,params:t})}}or=new WeakMap,ru=new WeakMap,Aa=new WeakMap,ka=new WeakMap,Ss=new WeakMap,As=new WeakMap,Bt=new WeakMap,Ea=new WeakMap,me=new WeakSet,Fy=async function(){let e;try{const t=a(this,Ss).readable.getReader();try{for(;!a(this,Bt).signal.aborted;){const{value:r,done:i}=await t.read();if(i)break;if(r)try{h(this,me,Hy).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&h(this,me,Zo).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{t.releaseLock()}}catch(t){e=t}finally{h(this,me,_d).call(this,e)}},_d=function(e){if(a(this,Bt).signal.aborted)return;const t=e??new Error("ACP connection closed");for(const r of a(this,or).values())r.reject(t);a(this,or).clear(),a(this,Bt).abort(t)},Hy=async function(e){if("method"in e&&"id"in e){const t=await h(this,me,Vy).call(this,e.method,e.params);"error"in t&&console.error("Error handling request",e,t.error),await h(this,me,Zo).call(this,{jsonrpc:"2.0",id:e.id,...t})}else if("method"in e){const t=await h(this,me,By).call(this,e.method,e.params);"error"in t&&console.error("Error handling notification",e,t.error)}else"id"in e?h(this,me,qy).call(this,e):console.error("Invalid message",{message:e})},Vy=async function(e,t){try{return{result:await a(this,Aa).call(this,e,t)??null}}catch(r){if(r instanceof Ce)return r.toResult();if(r instanceof Xm)return Ce.invalidParams(r.format()).toResult();let i;(r instanceof Error||typeof r=="object"&&r!=null&&"message"in r&&typeof r.message=="string")&&(i=r.message);try{return Ce.internalError(i?JSON.parse(i):{}).toResult()}catch{return Ce.internalError({details:i}).toResult()}}},By=async function(e,t){try{return await a(this,ka).call(this,e,t),{result:null}}catch(r){if(r instanceof Ce)return r.toResult();if(r instanceof Xm)return Ce.invalidParams(r.format()).toResult();let i;(r instanceof Error||typeof r=="object"&&r!=null&&"message"in r&&typeof r.message=="string")&&(i=r.message);try{return Ce.internalError(i?JSON.parse(i):{}).toResult()}catch{return Ce.internalError({details:i}).toResult()}}},qy=function(e){const t=a(this,or).get(e.id);if(t){if("result"in e)t.resolve(e.result);else if("error"in e){const{code:r,message:i,data:s}=e.error;t.reject(new Ce(r,i,s))}a(this,or).delete(e.id)}else console.error("Got response to unknown request",e.id)},Sd=function(){if(a(this,Bt).signal.aborted)throw a(this,Bt).signal.reason??new Error("ACP connection closed")},Zo=async function(e){return d(this,As,a(this,As).then(async()=>{const t=a(this,Ss).writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(t=>{h(this,me,_d).call(this,t)})),a(this,As)};class Ce extends Error{constructor(t,r,i){super(r);$(this,"code");$(this,"data");this.code=t,this.name="RequestError",this.data=i}static parseError(t,r){return new Ce(-32700,`Parse error${r?`: ${r}`:""}`,t)}static invalidRequest(t,r){return new Ce(-32600,`Invalid request${r?`: ${r}`:""}`,t)}static methodNotFound(t){return new Ce(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,r){return new Ce(-32602,`Invalid params${r?`: ${r}`:""}`,t)}static internalError(t,r){return new Ce(-32603,`Internal error${r?`: ${r}`:""}`,t)}static authRequired(t,r){return new Ce(-32e3,`Authentication required${r?`: ${r}`:""}`,t)}static resourceNotFound(t){return new Ce(-32002,`Resource not found${t?`: ${t}`:""}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}}function OP(n,e,t){const r=n.dispose.bind(n);n.dispose=()=>{if(!e())return t(),r()}}function jy(n){var t;class e extends n{constructor(...s){super(...s);g(this,t,!1);OP(this,()=>a(this,t),()=>{d(this,t,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return a(this,t)}}return t=new WeakMap,e}const zP=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,NP=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,MP=/\[Television channel context\][\s\S]*?\[\/Television channel context\]\n*/,UP=/\b(tv|television|channel|artifact|artifacts|viewer|filmstrip|layout|focus)\b/i,ZP=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,FP="single_session",HP={name:"television-acp-client",version:"0.0.0"},Wy="agent:main:television",VP=jy(Mr);var ks,qt,nt,jt,ar,Et,On,Wt,Gt,lr,$t,Es,$s,Yt,He,zn,Cs,li,Nn,cr,$a,Ct,Kt,iu,Jt,R,Ad,Gy,Yy,Ky,pc,Jy,Xy,Qy,ew,tw,nw,rw,jr,as,ls,Cn,iw,cs,kd,Ed,mc,sw,gc,$d,Cd,Ca,Ta,vc,us,Td,ow;class BP extends VP{constructor(t){super();g(this,R);g(this,ks,"disconnected");g(this,qt,null);g(this,nt,new Map);g(this,jt,null);g(this,ar,null);g(this,Et,null);g(this,On,null);g(this,Wt,null);g(this,Gt,null);g(this,lr);g(this,$t,null);g(this,Es,0);g(this,$s,1);g(this,Yt,null);g(this,He,null);g(this,zn,!1);g(this,Cs,!1);g(this,li,!1);g(this,Nn,null);g(this,cr,new Set);g(this,$a);g(this,Ct);g(this,Kt);g(this,iu,t=>{h(this,R,Yy).call(this,t)});g(this,Jt,null);g(this,Ca,()=>{h(this,R,us).call(this,"ACP bridge websocket closed")});g(this,Ta,()=>{h(this,R,us).call(this,"ACP bridge websocket error")});d(this,Ct,t),d(this,Kt,t.sessionMode??FP),d(this,lr,t.mappedSessionStore??qP()),d(this,$a,t.createSocket??(r=>new WebSocket(r)))}get status(){return a(this,ks)}get messages(){return[...a(this,nt).values()]}get enabled(){return a(this,Ct).enabled??!1}setToken(t){a(this,Ct).token=t??""}setEnabled(t){a(this,Ct).enabled=t,t||(h(this,R,vc).call(this),d(this,qt,null),h(this,R,Cn).call(this,"disconnected"))}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(this.enabled&&this.status==="disconnected"){a(this,ar)===null&&(d(this,qt,null),d(this,ar,h(this,R,Gy).call(this)));try{await a(this,ar),await h(this,R,pc).call(this)}catch(t){throw h(this,R,us).call(this,Zh(t)),t}}}dispose(){h(this,R,vc).call(this),d(this,qt,null),h(this,R,Cn).call(this,"disposed")}async sendMessage(t){if(await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await h(this,R,Ad).call(this,"ready")),(a(this,Wt)===null||a(this,$t)!==h(this,R,gc).call(this))&&await h(this,R,pc).call(this),this.status!=="ready")throw new Error("ACPClient is not ready to send a new message");const r=t.text.trim();if(!r)throw new Error("Cannot send an empty message");h(this,R,as).call(this,{id:h(this,R,cs).call(this,"user"),kind:"user",text:r,status:"final"}),h(this,R,Cn).call(this,"running");try{const i=await h(this,R,mc).call(this).prompt({sessionId:h(this,R,Ed).call(this),prompt:[{type:"text",text:h(this,R,iw).call(this,r)}]});h(this,R,jr).call(this,i.stopReason==="cancelled"?"cancelled":"final"),h(this,R,Cn).call(this,"ready")}catch(i){throw h(this,R,ow).call(this)||(h(this,R,jr).call(this,"error"),h(this,R,Cn).call(this,"ready")),i}}async startNewSession(){var r;await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await h(this,R,Ad).call(this,"ready"));const t=h(this,R,gc).call(this);((r=a(this,Gt))==null?void 0:r.sessionIdStrategy)==="mapped"?a(this,lr).clearActualSessionId(t):d(this,Es,a(this,Es)+1),d(this,Et,null),d(this,On,null),d(this,Wt,null),d(this,$t,null),h(this,R,Td).call(this)}async cancel(){this.status==="running"&&(h(this,R,Cn).call(this,"cancelling"),await h(this,R,mc).call(this).cancel({sessionId:h(this,R,Ed).call(this)}))}setChannelContext(t){var s,o,l;if(t===null){if(a(this,He)===null)return;d(this,He,null),d(this,zn,!1);return}const r={channelID:t.channelID,channelName:t.channelName};if(((s=a(this,He))==null?void 0:s.channelID)===r.channelID&&((o=a(this,He))==null?void 0:o.channelName)===r.channelName)return;const i=((l=a(this,He))==null?void 0:l.channelID)??null;if(d(this,He,r),a(this,Kt)==="single_session"){(!a(this,$t)||i!==r.channelID)&&d(this,zn,!0);return}a(this,$t)!==h(this,R,$d).call(this,r.channelID)&&(d(this,Et,null),d(this,On,null),a(this,jt)&&this.status==="ready"&&h(this,R,pc).call(this).catch(c=>{h(this,R,us).call(this,Zh(c))}))}}ks=new WeakMap,qt=new WeakMap,nt=new WeakMap,jt=new WeakMap,ar=new WeakMap,Et=new WeakMap,On=new WeakMap,Wt=new WeakMap,Gt=new WeakMap,lr=new WeakMap,$t=new WeakMap,Es=new WeakMap,$s=new WeakMap,Yt=new WeakMap,He=new WeakMap,zn=new WeakMap,Cs=new WeakMap,li=new WeakMap,Nn=new WeakMap,cr=new WeakMap,$a=new WeakMap,Ct=new WeakMap,Kt=new WeakMap,iu=new WeakMap,Jt=new WeakMap,R=new WeakSet,Ad=async function(t){if(this.status!==t){if(this.status==="disposed")throw new Error("ACPClient has been disposed");if(this.status==="disconnected")throw new Error(a(this,qt)??"ACPClient is disconnected");await new Promise((r,i)=>{const s=()=>{this.removeEventListener("status-changed",o)},o=()=>{if(this.status===t){s(),r();return}if(this.status==="disposed"){s(),i(new Error("ACPClient has been disposed"));return}this.status==="disconnected"&&(s(),i(new Error(a(this,qt)??"ACPClient is disconnected")))};this.addEventListener("status-changed",o)})}},Gy=async function(){try{const{stream:t,socket:r,metadata:i}=await YP({serverURL:a(this,Ct).serverURL,token:a(this,Ct).token,createSocket:a(this,$a),onDisconnect:a(this,iu)});d(this,Gt,i),d(this,Jt,r),r.addEventListener("close",a(this,Ca)),r.addEventListener("error",a(this,Ta)),d(this,jt,new DP(s=>({connection:s,sessionUpdate:async o=>{await h(this,R,Xy).call(this,o)},requestPermission:async o=>h(this,R,Qy).call(this,o)}),t)),await a(this,jt).initialize({protocolVersion:g3,clientCapabilities:{},clientInfo:HP})}catch(t){throw t}},Yy=function(t){h(this,R,us).call(this,Zh(t))},Ky=function(t){const r=t==null?void 0:t.models;if(!(r!=null&&r.currentModelId))return;const i=r.availableModels.find(s=>s.modelId===r.currentModelId);console.info("[ACPClient] Current model:",(i==null?void 0:i.name)??r.currentModelId,`(${r.currentModelId})`)},pc=async function(){const t=h(this,R,gc).call(this);if(a(this,Et)&&a(this,On)===t){await a(this,Et);return}d(this,On,t),d(this,Et,h(this,R,Jy).call(this,t)),await a(this,Et)},Jy=async function(t){var c;const r=h(this,R,mc).call(this);h(this,R,Td).call(this);let i,s=!1,o=null;const l={cwd:h(this,R,sw).call(this),mcpServers:[],_meta:{sessionKey:t}};try{if(d(this,li,!0),d(this,Nn,null),((c=a(this,Gt))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=a(this,lr).getActualSessionId(t);if(u)try{const f=await r.loadSession({...l,sessionId:u});if(jP(f))throw new Error("Mapped ACP session was not found");o=f,i=u,s=!0}catch{const f=await r.newSession(l);o=f,i=f.sessionId,a(this,lr).setActualSessionId(t,i),s=!1}else{const f=await r.newSession(l);o=f,i=f.sessionId,a(this,lr).setActualSessionId(t,i),s=!1}}else try{o=await r.loadSession({...l,sessionId:t}),i=t,s=a(this,nt).size>0}catch{const u=await r.newSession(l);o=u,i=u.sessionId,s=!1}}finally{d(this,li,!1),d(this,Nn,null),h(this,R,jr).call(this,"final")}h(this,R,Ky).call(this,o),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),d(this,Wt,i),d(this,$t,t),d(this,Cs,!0),s?(a(this,cr).add(t),a(this,Kt)==="single_session"&&d(this,zn,!1)):(a(this,cr).delete(t),d(this,zn,a(this,Kt)==="single_session")),d(this,qt,null),h(this,R,Cn).call(this,"ready")},Xy=async function(t){const r=t.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&h(this,R,rw).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&h(this,R,ew).call(this,r.content.text);return;case"tool_call":h(this,R,tw).call(this,r);return;case"tool_call_update":h(this,R,nw).call(this,r);return;case"agent_thought_chunk":return;default:return}},Qy=async function(t){return{outcome:{outcome:"cancelled"}}},ew=function(t){d(this,Nn,null);const r=GP(t);if(!r)return;if(!a(this,Yt)){const s={id:h(this,R,cs).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};d(this,Yt,s.id),h(this,R,as).call(this,s);return}const i=a(this,nt).get(a(this,Yt));if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");h(this,R,ls).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},tw=function(t){h(this,R,jr).call(this,"final");const r=h(this,R,kd).call(this,t.toolCallId),i=ug("content"in t?t.content:void 0),s={id:(r==null?void 0:r.id)??h(this,R,cs).call(this,"tool"),kind:"tool_call",toolCallId:t.toolCallId,title:t.title,toolKind:t.kind??"other",status:t.status==="failed"?"failed":t.status==="completed"?"completed":"in_progress",text:(r==null?void 0:r.text)??i,locations:t.locations??(r==null?void 0:r.locations)};if(r){h(this,R,ls).call(this,s);return}h(this,R,as).call(this,s)},nw=function(t){const r=h(this,R,kd).call(this,t.toolCallId),i=(r==null?void 0:r.text)??"",s=ug(t.content),o=s?`${i}${s}`:i,l={id:(r==null?void 0:r.id)??h(this,R,cs).call(this,"tool"),kind:"tool_call",toolCallId:t.toolCallId,title:(r==null?void 0:r.title)??t.toolCallId,toolKind:(r==null?void 0:r.toolKind)??"other",status:t.status==="failed"?"failed":t.status==="completed"?"completed":"in_progress",text:o,locations:t.locations??(r==null?void 0:r.locations)};if(r){h(this,R,ls).call(this,l);return}h(this,R,as).call(this,l)},rw=function(t){if(h(this,R,jr).call(this,"final"),!t)return;const r=a(this,li)?a(this,Nn):null;if(!r){const s=cg(t);if(!s)return;const o={id:h(this,R,cs).call(this,"user"),kind:"user",text:s,status:"final"};h(this,R,as).call(this,o),a(this,li)&&d(this,Nn,o.id);return}const i=a(this,nt).get(r);if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");h(this,R,ls).call(this,{...i,text:cg(`${i.text}${t}`)})},jr=function(t){if(!a(this,Yt))return;const r=a(this,nt).get(a(this,Yt));(r==null?void 0:r.kind)==="assistant"&&h(this,R,ls).call(this,{...r,status:t}),d(this,Yt,null)},as=function(t){a(this,nt).set(t.id,t),this.dispatchEvent(new zh("messages-changed"))},ls=function(t){a(this,nt).set(t.id,t),this.dispatchEvent(new zh("messages-changed"))},Cn=function(t){a(this,ks)!==t&&(d(this,ks,t),this.dispatchEvent(new e4("status-changed")))},iw=function(t){const r=a(this,$t);if(!r)return t;const i=a(this,He)?a(this,Kt)==="single_session"?a(this,zn)||!a(this,cr).has(r):!a(this,cr).has(r):!1,s=a(this,Cs)&&(a(this,He)!==null||UP.test(t));if(!(s||i))return t;s&&d(this,Cs,!1),i&&(d(this,zn,!1),a(this,cr).add(r));const l=["[Television channel context]","This chat session is coming from a Television client.","Using Television requires the knowledge in the `television` skill. Re-read it only if it is not already in context or you know it changed.","If the skill is not installed, it can be installed via `tv skills install <your agent skills path>`."];return a(this,He)?(l.push("This conversation is currently attached to the channel below."),l.push(`channel_id: ${a(this,He).channelID}`),l.push(`channel_name: ${a(this,He).channelName??""}`),l.push("When the user asks to inspect or change Television state with the tv CLI, use this channel ID with the --channel argument.")):l.push("There is currently no active Television channel."),l.push("[/Television channel context]","",t),l.join(`
43
- `)},cs=function(t){const r=`${t}-${a(this,$s)}`;return d(this,$s,a(this,$s)+1),r},kd=function(t){for(const r of a(this,nt).values())if((r==null?void 0:r.kind)==="tool_call"&&r.toolCallId===t)return r;return null},Ed=function(){if(!a(this,Wt))throw new Error("ACP session is not ready");return a(this,Wt)},mc=function(){if(!a(this,jt))throw new Error("ACP connection is not ready");return a(this,jt)},sw=function(){var r;const t=(r=a(this,Gt))==null?void 0:r.sessionCwd;if(!t)throw new Error("ACP bridge session cwd is not ready");return t},gc=function(){var r;if(a(this,Kt)==="single_session")return h(this,R,Cd).call(this,`${Wy}-${(a(this,Ct).clientGUID??"default-client").toLowerCase()}`);const t=(r=a(this,He))==null?void 0:r.channelID;if(!t)throw new Error("Channel context is required for per-channel session mode");return h(this,R,$d).call(this,t)},$d=function(t){return h(this,R,Cd).call(this,WP(a(this,Kt),t,a(this,Ct).clientGUID??"default-client"))},Cd=function(t){var r;return((r=a(this,Gt))==null?void 0:r.sessionIdStrategy)==="deterministic"&&a(this,Es)>0?`${t}:epoch-${a(this,Es)}`:t},Ca=new WeakMap,Ta=new WeakMap,vc=function(){d(this,jt,null),d(this,ar,null),d(this,Et,null),d(this,On,null),d(this,Wt,null),d(this,$t,null),d(this,Gt,null),a(this,Jt)&&(a(this,Jt).removeEventListener("close",a(this,Ca)),a(this,Jt).removeEventListener("error",a(this,Ta)),a(this,Jt).close(),d(this,Jt,null))},us=function(t){const r=a(this,jt)!==null||a(this,ar)!==null||a(this,Et)!==null||a(this,On)!==null||a(this,Wt)!==null||a(this,$t)!==null||a(this,Gt)!==null||a(this,Jt)!==null;this.disposed||this.status==="disconnected"&&!r||(h(this,R,jr).call(this,"error"),h(this,R,vc).call(this),d(this,qt,t??null),h(this,R,Cn).call(this,"disconnected"))},Td=function(){const t=a(this,nt).size>0;d(this,Yt,null),d(this,Nn,null),d(this,$s,1),a(this,nt).clear(),t&&this.dispatchEvent(new zh("messages-changed"))},ow=function(){return this.status==="disconnected"};function qP(){const n=new Map;return{getActualSessionId(e){return n.get(e)??null},setActualSessionId(e,t){n.set(e,t)},clearActualSessionId(e){n.delete(e)}}}function jP(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function WP(n,e,t){return n==="single_session"?`${Wy}-${t.toLowerCase()}`:`agent:main:television-${t.toLowerCase()}-${e.toLowerCase()}`}function aw(n){return n.replace(/^(?:\s*\n)+/,"")}function cg(n){let e=n;return e=e.replace(zP,""),e=e.replace(NP,""),e=e.replace(MP,""),e=aw(e),e}function GP(n){let e=n;return e=e.replace(ZP,""),e=aw(e),e}function ug(n){return!n||n.length===0?"":n.flatMap(e=>e.type==="content"&&e.content.type==="text"?[e.content.text]:[]).join("")}async function YP(n){const e=n.createSocket(XP(n.serverURL,n.token));let t=!1,r,i;const s=new Promise((u,f)=>{r=u,i=f}),o=new ReadableStream({start(u){let f=!1;const m=()=>{e.send(JSON.stringify({type:"acp-bridge-connect"}))},v=S=>{const x=JP(S);if(!x)return;let M;try{M=JSON.parse(x)}catch(Z){const G=Z instanceof Error?Z:new Error(String(Z));i(G),u.error(G);return}switch(M.type){case"acp-bridge-status":if(M.status==="ready"){let Z;try{Z=KP(M)}catch(G){const F=G instanceof Error?G:new Error(String(G));t||i(F),u.error(F);return}t||(t=!0,r(Z));return}if(M.status==="error"||M.status==="exited"){const Z=new Error(M.error??`ACP bridge ${M.status}`);t||i(Z),u.error(Z)}return;case"acp-bridge-message":u.enqueue(M.message);return}},y=()=>{var x;if(f)return;f=!0;const S=new Error("ACP bridge websocket closed");t||i(S),(x=n.onDisconnect)==null||x.call(n,S),u.close()},k=()=>{var x;if(f)return;f=!0;const S=new Error("ACP bridge websocket error");t||i(S),(x=n.onDisconnect)==null||x.call(n,S),u.error(S)};e.addEventListener("open",m),e.addEventListener("message",v),e.addEventListener("close",y),e.addEventListener("error",k)}}),l=new WritableStream({async write(u){await s,e.send(JSON.stringify({type:"acp-bridge-message",message:u}))},close(){e.close()},abort(){e.close()}}),c=await s;return{stream:{readable:o,writable:l},socket:e,metadata:c}}function KP(n){const{agent:e,sessionIdStrategy:t,sessionCwd:r}=n;if((e==="openclaw"||e==="hermes")&&(t==="deterministic"||t==="mapped")&&typeof r=="string"&&r.length>0)return{agent:e,sessionIdStrategy:t,sessionCwd:r};throw new Error("ACP bridge ready status missing bootstrap metadata")}function JP(n){if(typeof n=="string")return n;if(n instanceof Uint8Array)return new TextDecoder().decode(n);if(typeof Buffer<"u"&&n instanceof Buffer)return n.toString("utf8");if(typeof n=="object"&&n!==null&&"data"in n){const e=n.data;if(typeof e=="string")return e;if(e instanceof Uint8Array)return new TextDecoder().decode(e);if(Array.isArray(e))return Buffer.concat(e).toString("utf8")}return null}function XP(n,e){const t=new URL(n);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/acp",t.search="",t.searchParams.set("token",e),t.hash="",t.toString()}function Zh(n){return n instanceof Error?n.message:String(n)}const hg="television.acpClientGUID",dg="television.acpMappedSessions",fg=1;var Ts;class QP{constructor(){g(this,Ts,new Map)}getActualSessionId(e){return a(this,Ts).get(e)??null}setActualSessionId(e,t){a(this,Ts).set(e,t)}clearActualSessionId(e){a(this,Ts).delete(e)}}Ts=new WeakMap;var Rs,Ra,ot,yc,wc,Rd;class e5{constructor(e,t){g(this,ot);g(this,Rs);g(this,Ra);d(this,Rs,e),d(this,Ra,t)}getActualSessionId(e){const t=h(this,ot,wc).call(this)[h(this,ot,yc).call(this,e)];return typeof t=="string"&&t.length>0?t:null}setActualSessionId(e,t){const r=h(this,ot,wc).call(this);r[h(this,ot,yc).call(this,e)]=t,h(this,ot,Rd).call(this,r)}clearActualSessionId(e){const t=h(this,ot,wc).call(this);delete t[h(this,ot,yc).call(this,e)],h(this,ot,Rd).call(this,t)}}Rs=new WeakMap,Ra=new WeakMap,ot=new WeakSet,yc=function(e){return JSON.stringify([a(this,Ra),e])},wc=function(){const e=a(this,Rs).getItem(dg);if(!e)return{};let t;try{t=JSON.parse(e)}catch{return{}}if(typeof t!="object"||t===null||Array.isArray(t))return{};const r=t;return r.version!==fg?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},Rd=function(e){const t={version:fg,entries:e};a(this,Rs).setItem(dg,JSON.stringify(t))};function lw(){return typeof window>"u"?null:window.localStorage}function t5(n){const e=n.getItem(hg);if(e)return e;const t=ip().toLowerCase();return n.setItem(hg,t),t}const pg=4401,n5=401,Wl=1e3,r5=3e4;class bc extends Error{constructor(e="Authentication required"){super(e),this.name="AuthError"}}class i5 extends Mr{constructor(t){var o,l;super();$(this,"url");$(this,"name");$(this,"telemetryMeta");$(this,"status","unauthorized");$(this,"channels",new Map);$(this,"client");$(this,"acpClient");$(this,"_token");$(this,"attempting",!1);$(this,"nextRetryAt",null);$(this,"hasEverConnected",!1);$(this,"hasAuthRejected",!1);$(this,"hasAuthTokenRejected",!1);$(this,"bootState","pending");$(this,"serverVersion",null);$(this,"updateState",null);$(this,"decideBoot");$(this,"navigationPending");$(this,"createSocket");$(this,"createClient");$(this,"socket",null);$(this,"connectAttempt",0);$(this,"autoReconnect",!1);$(this,"retryTimer",null);$(this,"retryDelay",Wl);$(this,"visibilityEventTarget");$(this,"networkEventTarget");$(this,"onVisibilityChange");$(this,"onNetworkOnline");$(this,"telemetryActivityAgent");this.url=xr(t.url),this.name=t.name,this.decideBoot=t.decideBoot??null,this.navigationPending=t.navigationPending??(()=>!1),this._token=t.token??null,this.telemetryMeta=t.telemetryMeta??null,this.createSocket=t.createSocket??(c=>new WebSocket(c)),this.createClient=t.createClient??((c,u,f)=>new CE(c,{token:u??void 0,onUnauthorized:()=>this.handleAuthRejected(),...f?{telemetryMeta:f}:{}})),this.client=this.createClient(this.url,this._token,this.telemetryMeta);const r=t.mappedSessionStore??(t.acpStorage?new e5(t.acpStorage,this.url):new QP);this.acpClient=new BP({serverURL:this.url,token:this._token??"",...t.createACPSocket?{createSocket:t.createACPSocket}:t.createSocket?{createSocket:t.createSocket}:{},...t.clientGUID?{clientGUID:t.clientGUID}:{},mappedSessionStore:r}),this.visibilityEventTarget=t.visibilityEventTarget!==void 0?t.visibilityEventTarget:typeof document<"u"?document:null,this.networkEventTarget=t.networkEventTarget!==void 0?t.networkEventTarget:typeof window<"u"?window:null,this.onVisibilityChange=()=>{this.isPageVisible()&&this.kickReconnect()},this.onNetworkOnline=()=>{this.kickReconnect()},(o=this.visibilityEventTarget)==null||o.addEventListener("visibilitychange",this.onVisibilityChange),(l=this.networkEventTarget)==null||l.addEventListener("online",this.onNetworkOnline);const i=t.telemetryDocumentTarget!==void 0?t.telemetryDocumentTarget:typeof document<"u"?document:null,s=t.telemetryWindowTarget!==void 0?t.telemetryWindowTarget:typeof window<"u"?window:null;this.telemetryActivityAgent=this.telemetryMeta&&i&&s?f3({meta:this.telemetryMeta,documentTarget:i,windowTarget:s,send:c=>this.sendTelemetryActivity(c)}):null}get token(){return this._token}clearToken(){this._token=null,this.acpClient.setToken(null),this.client=this.createClient(this.url,null,this.telemetryMeta)}async connect(t){this._token=t,this.hasAuthRejected=!1,this.hasAuthTokenRejected=!1,this.acpClient.setToken(t),this.cancelRetryTimer(),this.retryDelay=Wl,this.autoReconnect=!0,await this.attempt()}dispose(){var t,r,i,s;this.autoReconnect=!1,this.connectAttempt+=1,this.cancelRetryTimer(),(t=this.socket)==null||t.close(),this.socket=null,this.setStatus("unauthorized"),(r=this.visibilityEventTarget)==null||r.removeEventListener("visibilitychange",this.onVisibilityChange),(i=this.networkEventTarget)==null||i.removeEventListener("online",this.onNetworkOnline),(s=this.telemetryActivityAgent)==null||s.stop(),this.acpClient.dispose()}getViewURL(t){const r=bd(t,{electron:Gn()});return Gn()?new URL(r.viewURL,this.url).toString():r.renderer==="proxy-iframe"?new URL(r.viewURL,this.url).toString():r.viewURL}getContentURL(t){const r=bd(t,{electron:Gn()}).contentURL;return r===null?null:new URL(r,this.url).toString()}async createChannel(t){const{channel:r}=await this.client.channels.create({name:t});return this.channels.set(r.id,structuredClone(r)),r}applyServerEvent(t){switch(t.type){case"channel-created":this.channels.set(t.channel.id,structuredClone(t.channel)),this.dispatchEvent(new Mo("channels-changed"));break;case"channel-updated":this.channels.set(t.channel.id,structuredClone(t.channel)),this.dispatchEvent(new Mo("channels-changed"));break;case"channel-removed":this.channels.delete(t.channelID),this.dispatchEvent(new Mo("channels-changed"));break;case"artifact-created":{const r=this.channels.get(t.channelID);r&&!dE(r).includes(t.artifact.id)&&(r.layout=[...r.layout,{artifactIds:[t.artifact.id],geometry:{...cv},size:{...uv}}]);break}case"artifact-removed":{const r=this.channels.get(t.channelID);r&&(r.layout=ld(r.layout,t.artifactID));break}case"artifact-updated":case"artifact-content-changed":case"channel-changed":case"pinned-channels-changed":case"theme-changed":case"artifact-focus":break;default:return s5(t,"server event")}}async attempt(){var i;this.attempting=!0,this.nextRetryAt=null,this.connectAttempt+=1,this.bootState="pending";const t=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this._token,this.telemetryMeta),this.setStatus("disconnected"),this.dispatchEvent(new gt("change"));const r=this.createSocket(o5(this.url,this._token,this.telemetryMeta));return this.socket=r,await new Promise((s,o)=>{let l=!1;const c=()=>{var m;l||this.connectAttempt!==t||(l=!0,this.retryDelay=Wl,this.hasEverConnected=!0,this.setStatus("connected"),(m=this.telemetryActivityAgent)==null||m.start(),s())},u=m=>{l||this.connectAttempt!==t||(l=!0,o(m))},f=async()=>{const m=this.hasEverConnected;try{const[{channels:v},y]=await Promise.all([this.client.channels.list(),this.client.display.get()]);this.channels=new Map(v.map(k=>[k.id,structuredClone(k)])),this.acpClient.setEnabled(y.acpEnabled),this.dispatchEvent(new gt("change")),m&&this.dispatchEvent(new Mo("channels-changed")),this.dispatchEvent(new dc("server-event",{serverURL:this.url,event:{type:"channel-changed",channelID:y.focusedChannelId}})),this.dispatchEvent(new dc("server-event",{serverURL:this.url,event:{type:"pinned-channels-changed",pinnedChannelIds:[...y.pinnedChannelIds]}})),c(),m&&this.connectAttempt===t&&this.dispatchEvent(new Sv("server-reconnected",{serverURL:this.url}))}catch(v){if(d5(v)){u(new bc);return}u(v instanceof Error?v:new Error(String(v)))}};r.addEventListener("open",()=>{this.decideBoot===null&&(this.bootState="booted",this.navigationPending()||f())}),r.addEventListener("message",m=>{const v=h5(m);if(!v)return;if(v.type==="server-status"){const k=v;this.serverVersion=k.version,this.updateState=k.update??null;let S=!1;this.decideBoot!==null&&this.bootState==="pending"&&this.connectAttempt===t&&(this.decideBoot(k)==="boot"?(this.bootState="booted",S=!0):(this.bootState="halted",this.attempting=!1)),this.dispatchEvent(new Av("server-status",{serverURL:this.url,message:k})),S?this.navigationPending()||f():this.bootState==="halted"&&!this.navigationPending()&&this.dispatchEvent(new gt("change"));return}if(!u5(v.type))return;const y=v;this.applyServerEvent(y),this.dispatchEvent(new dc("server-event",{serverURL:this.url,event:y}))}),r.addEventListener("close",m=>{if(this.connectAttempt!==t)return;this.socket=null;const v=a5(m);if(!l){u(v===pg?new bc:new Error("Connection closed before initialization"));return}if(v===pg){this.handleAuthRejected();return}this.handleTransportFailure(new Error("Connection closed"))}),r.addEventListener("error",()=>{if(this.connectAttempt===t){if(l){this.handleTransportFailure(new Error("WebSocket error"));return}u(new Error("WebSocket connection failed"))}})}).then(()=>{this.attempting=!1},s=>{throw this.attempting=!1,this.handleAttemptFailure(s),s})}handleAuthRejected(){this.hasAuthRejected=!0,this.hasAuthTokenRejected=this._token!==null,this.autoReconnect=!1,this.cancelRetryTimer(),this.setStatus("unauthorized")}handleAttemptFailure(t){if(t instanceof bc){this.handleAuthRejected();return}this.autoReconnect&&this.scheduleRetry()}handleTransportFailure(t){this.autoReconnect&&(this.setStatus("disconnected"),this.scheduleRetry())}scheduleRetry(){this.cancelRetryTimer(),this.connectAttempt+=1;const t=this.retryDelay;this.retryDelay=Math.min(this.retryDelay*2,r5),this.nextRetryAt=Date.now()+t,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.attempt().catch(()=>{})},t),this.dispatchEvent(new gt("change"))}cancelRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.nextRetryAt!==null&&(this.nextRetryAt=null,this.dispatchEvent(new gt("change")))}kickReconnect(){this.autoReconnect&&this.status!=="connected"&&(this.attempting||(this.cancelRetryTimer(),this.retryDelay=Wl,this.attempt().catch(()=>{})))}sendTelemetryActivity(t){var r;this.status==="connected"&&((r=this.socket)==null||r.send(JSON.stringify(t)))}sendTelemetrySignal(t,r){var s;if(!this.telemetryMeta||this.status!=="connected"&&this.bootState!=="halted")return;const i={type:hE,clientId:this.telemetryMeta.clientId,event:t,properties:r};(s=this.socket)==null||s.send(JSON.stringify(i))}setStatus(t){this.status!==t&&(this.status=t,this.dispatchEvent(new gt("change")))}isPageVisible(){return this.visibilityEventTarget===null?!0:this.visibilityEventTarget.visibilityState==="visible"}}function s5(n,e){throw new Error(`Unexpected ${e}: ${JSON.stringify(n)}`)}function o5(n,e,t=null){const r=new URL(n);if(r.protocol=r.protocol==="https:"?"wss:":"ws:",r.pathname="/events",r.search="",e&&r.searchParams.set("token",e),t)for(const[i,s]of d3(t))r.searchParams.set(i,s);return r.hash="",r.toString()}function a5(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}const l5={"artifact-created":!0,"artifact-updated":!0,"artifact-content-changed":!0,"artifact-removed":!0,"channel-created":!0,"channel-updated":!0,"channel-removed":!0,"channel-changed":!0,"pinned-channels-changed":!0,"theme-changed":!0,"artifact-focus":!0},c5=new Set(Object.keys(l5));function u5(n){return c5.has(n)}function h5(n){const e=typeof n=="string"?n:typeof n=="object"&&n!==null&&"data"in n&&typeof n.data=="string"?n.data:"";if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||!("type"in t)||typeof t.type!="string"?null:t}function d5(n){return n instanceof go&&n.status===n5}const f5="Local";var ct,Tt,gn,Id,xd,cw,Ia,xa,Pa,Da,La;class p5 extends Mr{constructor(t){super();g(this,gn);$(this,"connection");$(this,"clientGUID");$(this,"acpStorage");$(this,"connectError",null);g(this,ct);g(this,Tt,!1);g(this,Ia,()=>{a(this,Tt)||(h(this,gn,cw).call(this),this.dispatchEvent(new gt("change")))});g(this,xa,t=>{a(this,Tt)||this.dispatchEvent(new dc("server-event",{serverURL:t.serverURL,event:t.event}))});g(this,Pa,()=>{a(this,Tt)||this.dispatchEvent(new Mo("channels-changed"))});g(this,Da,t=>{a(this,Tt)||this.dispatchEvent(new Sv("server-reconnected",{serverURL:t.serverURL}))});g(this,La,t=>{a(this,Tt)||this.dispatchEvent(new Av("server-status",{serverURL:t.serverURL,message:t.message}))});d(this,ct,t.localStore),this.acpStorage=t.acpStorage===void 0?lw():t.acpStorage,this.clientGUID=t.clientGUID??(this.acpStorage?t5(this.acpStorage):ip().toLowerCase());const r=xr(t.serverURL);t.launchToken!==void 0&&t.launchToken!==null&&a(this,ct).set(Om(a(this,ct).get(),r,t.launchToken));const i=t.launchToken??Lm(a(this,ct).get(),r),s=t.createSocket??(l=>new WebSocket(l)),o=t.createConnection??(l=>new i5(l));this.connection=o({url:r,name:t.connectionName??f5,token:i,createSocket:s,clientGUID:this.clientGUID,acpStorage:this.acpStorage,telemetryMeta:t.telemetryMeta??null,decideBoot:t.decideBoot,navigationPending:t.navigationPending}),this.connection.addEventListener("change",a(this,Ia)),this.connection.addEventListener("server-event",a(this,xa)),this.connection.addEventListener("channels-changed",a(this,Pa)),this.connection.addEventListener("server-reconnected",a(this,Da)),this.connection.addEventListener("server-status",a(this,La))}get storedAuthToken(){return Lm(a(this,ct).get(),this.connection.url)}async connect(){await h(this,gn,Id).call(this,this.connection.token)}async authenticate(t){a(this,ct).set(Om(a(this,ct).get(),this.connection.url,t)),await h(this,gn,Id).call(this,t)}dispose(){a(this,Tt)||(d(this,Tt,!0),this.connection.removeEventListener("change",a(this,Ia)),this.connection.removeEventListener("server-event",a(this,xa)),this.connection.removeEventListener("channels-changed",a(this,Pa)),this.connection.removeEventListener("server-reconnected",a(this,Da)),this.connection.removeEventListener("server-status",a(this,La)),this.connection.dispose())}}ct=new WeakMap,Tt=new WeakMap,gn=new WeakSet,Id=async function(t){if(!a(this,Tt)){h(this,gn,xd).call(this,null);try{await this.connection.connect(t)}catch(r){h(this,gn,xd).call(this,r instanceof bc?null:r instanceof Error?r.message:String(r))}}},xd=function(t){this.connectError!==t&&(this.connectError=t,this.dispatchEvent(new gt("change")))},cw=function(){if(this.connection.status!=="unauthorized"||!this.connection.hasAuthRejected)return;const t=a(this,ct).get(),r=i4(t,this.connection.url);r!==t&&a(this,ct).set(r),this.connection.token!==null&&this.connection.clearToken()},Ia=new WeakMap,xa=new WeakMap,Pa=new WeakMap,Da=new WeakMap,La=new WeakMap;const Pd="tv-nav:",so="tv-reload",mg=100,m5=1e3,g5=60,v5=60,y5=24,w5=30,b5=w5*y5*v5*g5*m5;function Yn(n){try{const e=new URL(n,window.location.href),t=e.searchParams.has(so);return e.searchParams.delete(so),e.origin===window.location.origin?`${e.pathname}${e.search}${e.hash}`:t?e.toString():n}catch{return n}}var Oa,Is,he,ce,ci,ke,uw,nr,hw,Dd,Ld;class _5 extends Mr{constructor(t,r){super();g(this,ke);g(this,Oa);g(this,Is);g(this,he,[]);g(this,ce,-1);g(this,ci,0);d(this,Oa,t),d(this,Is,Yn(r)),h(this,ke,uw).call(this)}get currentURL(){var t;return a(this,ce)===-1?null:((t=a(this,he)[a(this,ce)])==null?void 0:t.url)??null}get canGoBack(){return a(this,ce)>-1}get canGoForward(){return a(this,ce)<a(this,he).length-1}get entries(){return a(this,he).map(t=>({...t}))}get cursor(){return a(this,ce)}navigate(t){const r=Yn(t);if(r===a(this,Is)){if(a(this,ce)===-1)return;d(this,ce,-1),h(this,ke,nr).call(this);return}a(this,ce)<a(this,he).length-1&&d(this,he,a(this,he).slice(0,a(this,ce)+1)),a(this,he).push({url:r}),d(this,ce,a(this,he).length-1),h(this,ke,Dd).call(this),h(this,ke,nr).call(this)}replace(t){var i;if(a(this,ce)===-1){this.navigate(t);return}const r=Yn(t);if(r===a(this,Is)){d(this,he,a(this,he).filter((s,o)=>o!==a(this,ce))),d(this,ce,-1),h(this,ke,nr).call(this);return}((i=a(this,he)[a(this,ce)])==null?void 0:i.url)!==r&&(d(this,he,a(this,he).map((s,o)=>o===a(this,ce)?{url:r}:s)),h(this,ke,nr).call(this))}back(){a(this,ce)!==-1&&(d(this,ce,a(this,ce)-1),h(this,ke,nr).call(this))}forward(){this.canGoForward&&(d(this,ce,a(this,ce)+1),h(this,ke,nr).call(this))}reset(){a(this,ce)===-1&&a(this,he).length===0||(d(this,he,[]),d(this,ce,-1),h(this,ke,nr).call(this))}}Oa=new WeakMap,Is=new WeakMap,he=new WeakMap,ce=new WeakMap,ci=new WeakMap,ke=new WeakSet,uw=function(){const t=localStorage.getItem(a(this,ke,Ld));if(t!==null)try{const r=JSON.parse(t);if(!dw(r))return;d(this,he,r.entries.map(i=>({url:i.url}))),d(this,ce,r.cursor),d(this,ci,r.lastWritten),h(this,ke,Dd).call(this)}catch{d(this,he,[]),d(this,ce,-1),d(this,ci,0)}},nr=function(){d(this,ci,Date.now());try{localStorage.setItem(a(this,ke,Ld),JSON.stringify(h(this,ke,hw).call(this)))}catch(t){if(!k5(t))throw t}this.dispatchEvent(new gt("change"))},hw=function(){return{v:1,entries:a(this,he).map(t=>({...t})),cursor:a(this,ce),lastWritten:a(this,ci)}},Dd=function(){if(a(this,he).length<=mg)return;const t=a(this,he).length-mg;d(this,he,a(this,he).slice(t)),d(this,ce,Math.max(-1,a(this,ce)-t))},Ld=function(){return S5(a(this,Oa))};function S5(n){return`${Pd}${n}`}function A5(n){const e=Date.now()-b5,t=[];for(let r=0;r<localStorage.length;r+=1){const i=localStorage.key(r);if(!(i!=null&&i.startsWith(Pd)))continue;const s=i.slice(Pd.length),o=localStorage.getItem(i);if(o===null)continue;let l;try{l=JSON.parse(o)}catch{t.push(i);continue}if(!dw(l)){t.push(i);continue}!n.has(s)&&l.lastWritten<e&&t.push(i)}for(const r of t)localStorage.removeItem(r)}function k5(n){return n instanceof DOMException&&n.name==="QuotaExceededError"}function dw(n){if(typeof n!="object"||n===null)return!1;const e=n;if(e.v!==1||!Array.isArray(e.entries))return!1;const t=e.cursor;return typeof t!="number"||!Number.isInteger(t)||typeof e.lastWritten!="number"||!Number.isFinite(e.lastWritten)||t<-1||t>=e.entries.length?!1:e.entries.every(r=>typeof r=="object"&&r!==null&&typeof r.url=="string")}const E5="0.1.216";function pp(n=E5){return n!==void 0&&n.length>0?n:"0.0.0"}function mp(){let n=!1;return{get pending(){return n},begin(e){n||(n=!0,e())}}}const Od="tv-reload-attempted";function $5(n){return n.originMatch?n.marker!==null&&n.bundleVersion===n.serverVersion?{action:"signal-autoreloaded",fromVersion:n.marker.fromVersion,toVersion:n.bundleVersion}:IE(n.bundleVersion,n.serverVersion)?n.marker!==null&&n.marker.serverVersion===n.serverVersion?{action:"none"}:{action:"reload",marker:{serverVersion:n.serverVersion,fromVersion:n.bundleVersion}}:{action:"none"}:{action:"none"}}function C5(n){const e=n.getItem(Od);if(e===null)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const r=t;return typeof r.serverVersion!="string"||typeof r.fromVersion!="string"?null:{serverVersion:r.serverVersion,fromVersion:r.fromVersion}}function T5(n){const e=n.storage!==void 0?n.storage:typeof sessionStorage<"u"?sessionStorage:null,t=n.reload??(()=>location.reload()),r=n.navigationLatch??mp(),i=n.bundleVersion??pp();if(e===null)return{dispose(){}};let s=null;const o=()=>{if(s===null)return;const u=n.owner.connection;if(u.url!==n.primaryServerURL||u.status!=="connected")return;const f=s;s=null,u.sendTelemetrySignal("client_autoreloaded",{from_version:f.fromVersion,to_version:f.toVersion})},l=u=>{if(r.pending)return;const f=$5({bundleVersion:i,serverVersion:u.message.version,originMatch:u.serverURL===n.primaryServerURL,marker:C5(e)});switch(f.action){case"reload":e.setItem(Od,JSON.stringify(f.marker)),r.begin(t);return;case"signal-autoreloaded":e.removeItem(Od),s={fromVersion:f.fromVersion,toVersion:f.toVersion},o();return;case"none":return}},c=()=>{o()};return n.owner.addEventListener("server-status",l),n.owner.addEventListener("change",c),{dispose(){n.owner.removeEventListener("server-status",l),n.owner.removeEventListener("change",c)}}}function R5(n){const e=Gn(n.search),t=uy(n.search),r=t!==null&&rp(t)?t:null;return{electron:e,shellVersion:r}}function I5(n){return!n.electron||n.requiredDesktopVersion===null||!rp(n.requiredDesktopVersion)?!1:n.shellVersion===null?!0:n.shellVersion===cd?!1:fv(n.requiredDesktopVersion,n.shellVersion)}const x5=`# Desktop app upgrade required
44
-
45
- Your Television server requires a newer version of this desktop app.
46
- In a terminal, please upgrade:
47
-
48
- \`\`\`bash
49
- npm install -g @telepath-computer/television-desktop@latest
50
- \`\`\`
51
-
52
- Then quit this app, and relaunch it from the terminal with:
53
-
54
- \`\`\`bash
55
- tv-desktop
56
- \`\`\``;function fw(n){return n===null?x5:n.upgradeMarkdown}function P5(n){const e=I5(n);return{gated:e,instructionsMarkdown:e?fw(n.desktop):null,suppressUpdateToast:e}}function D5(n){const e=n.reload??(()=>location.reload()),t=n.navigationLatch??mp();let r=null,i=!1;const s=new Set,o=f=>{var m;return P5({electron:n.detection.electron,shellVersion:n.detection.shellVersion,requiredDesktopVersion:f.requiredDesktopVersion,desktop:((m=f.update)==null?void 0:m.desktop)??null})};function l(){var f;(f=n.presentation)==null||f.suppressToasts()}function c(f){const m=f.requiredDesktopVersion;if(m===null||s.has(m))return;s.add(m);const v=r==null?void 0:r.connection;(v==null?void 0:v.url)===n.primaryServerURL&&v.sendTelemetrySignal("desktop_upgrade_gate_shown",{...n.detection.shellVersion===null?{}:{desktop_app_version:n.detection.shellVersion},required_desktop_version:m})}const u=f=>{t.pending||f.serverURL===n.primaryServerURL&&(o(f.message).gated?(i=!0,l(),c(f.message)):i&&t.begin(e))};return{get gated(){return i},decideBoot(f){return o(f).gated?"halt":"boot"},attach(f){r=f,f.addEventListener("server-status",u)},dispose(){r==null||r.removeEventListener("server-status",u),r=null}}}var xs;class L5 extends Mr{constructor(){super(...arguments);g(this,xs,!1)}get toastsSuppressed(){return a(this,xs)}suppressToasts(){a(this,xs)||(d(this,xs,!0),this.dispatchEvent(new gt("change")))}}xs=new WeakMap;function pw(n){return typeof n=="object"&&n!==null}function mw(n){return!pw(n)||n.type!=="ready"?!1:!("id"in n)}function gw(n){return!(!pw(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}const vw=Lt(),yw="No handler registered for update-content",ww="handleUpdateContent: handler already registered",gg="television-artifact-bridge";function bw(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const _w=jy(Mr);var Ps,Ds,Ls,ui,hi,za,Le,zd,Sw,Aw,Fo,Nd,c1;let O5=(c1=class extends _w{constructor(t){super();g(this,Le);g(this,Ps);g(this,Ds);g(this,Ls);g(this,ui,null);g(this,hi,null);g(this,za,!1);d(this,Ps,t);const r=t.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");d(this,Ds,r),d(this,Ls,i=>h(this,Le,Sw).call(this,i)),a(this,Ds).addEventListener("message",a(this,Ls))}get content(){return a(this,hi)}set content(t){h(this,Le,Nd).call(this),d(this,hi,t),a(this,za)&&h(this,Le,zd).call(this,t)}handleUpdateContent(t){if(h(this,Le,Nd).call(this),a(this,ui)!==null)throw new Error(ww);d(this,ui,t)}dispose(){a(this,Ds).removeEventListener("message",a(this,Ls)),d(this,ui,null)}},Ps=new WeakMap,Ds=new WeakMap,Ls=new WeakMap,ui=new WeakMap,hi=new WeakMap,za=new WeakMap,Le=new WeakSet,zd=function(t){const r={type:"content-updated",content:t};h(this,Le,Fo).call(this,r)},Sw=function(t){if(this.disposed||t.source!==a(this,Ps).contentWindow)return;const r=t.data;if(mw(r)){d(this,za,!0),this.dispatchEvent(new vw("ready")),a(this,hi)!==null&&h(this,Le,zd).call(this,a(this,hi));return}if(gw(r)){h(this,Le,Aw).call(this,r);return}},Aw=async function(t){const r=a(this,ui);if(r===null){h(this,Le,Fo).call(this,{type:"response",id:t.id,error:{message:yw}});return}try{await r(t.content)}catch(i){if(this.disposed)return;h(this,Le,Fo).call(this,{type:"response",id:t.id,error:{message:bw(i)}});return}this.disposed||h(this,Le,Fo).call(this,{type:"response",id:t.id,result:{}})},Fo=function(t){const r=a(this,Ps).contentWindow;r&&r.postMessage(t,"*")},Nd=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},c1);var di,Os,fi,pi,Na,Oe,Md,kw,Ew,Ho,Ud;class z5 extends _w{constructor(t){super();g(this,Oe);g(this,di);g(this,Os);g(this,fi,null);g(this,pi,null);g(this,Na,!1);d(this,di,t),d(this,Os,r=>h(this,Oe,kw).call(this,r)),a(this,di).addEventListener("ipc-message",a(this,Os))}get content(){return a(this,pi)}set content(t){h(this,Oe,Ud).call(this),d(this,pi,t),a(this,Na)&&h(this,Oe,Md).call(this,t)}handleUpdateContent(t){if(h(this,Oe,Ud).call(this),a(this,fi)!==null)throw new Error(ww);d(this,fi,t)}dispose(){a(this,di).removeEventListener("ipc-message",a(this,Os)),d(this,fi,null)}}di=new WeakMap,Os=new WeakMap,fi=new WeakMap,pi=new WeakMap,Na=new WeakMap,Oe=new WeakSet,Md=function(t){const r={type:"content-updated",content:t};h(this,Oe,Ho).call(this,r)},kw=function(t){var s;if(this.disposed)return;const r=t.detail??t;if(!r||r.channel!==gg)return;const i=(s=r.args)==null?void 0:s[0];if(mw(i)){d(this,Na,!0),this.dispatchEvent(new vw("ready")),a(this,pi)!==null&&h(this,Oe,Md).call(this,a(this,pi));return}if(gw(i)){h(this,Oe,Ew).call(this,i);return}},Ew=async function(t){const r=a(this,fi);if(r===null){h(this,Oe,Ho).call(this,{type:"response",id:t.id,error:{message:yw}});return}try{await r(t.content)}catch(i){if(this.disposed)return;h(this,Oe,Ho).call(this,{type:"response",id:t.id,error:{message:bw(i)}});return}this.disposed||h(this,Oe,Ho).call(this,{type:"response",id:t.id,result:{}})},Ho=function(t){var r,i;(i=(r=a(this,di)).send)==null||i.call(r,gg,t)},Ud=function(){if(this.disposed)throw new Error("WebviewArtifactViewRuntime is disposed")};/**
57
- * @license
58
- * Copyright 2017 Google LLC
59
- * SPDX-License-Identifier: BSD-3-Clause
60
- */const sa=globalThis,vg=n=>n,jc=sa.trustedTypes,yg=jc?jc.createPolicy("lit-html",{createHTML:n=>n}):void 0,$w="$lit$",rr=`lit$${Math.random().toFixed(9).slice(2)}$`,Cw="?"+rr,N5=`<${Cw}>`,Fi=document,da=()=>Fi.createComment(""),fa=n=>n===null||typeof n!="object"&&typeof n!="function",gp=Array.isArray,M5=n=>gp(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",Fh=`[
61
- \f\r]`,Co=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,wg=/-->/g,bg=/>/g,Vr=RegExp(`>|${Fh}(?:([^\\s"'>=/]+)(${Fh}*=${Fh}*(?:[^
62
- \f\r"'\`<>=]|("|')|))|$)`,"g"),_g=/'/g,Sg=/"/g,Tw=/^(?:script|style|textarea|title)$/i,U5=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),V=U5(1),Pt=Symbol.for("lit-noChange"),ue=Symbol.for("lit-nothing"),Ag=new WeakMap,Qr=Fi.createTreeWalker(Fi,129);function Rw(n,e){if(!gp(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return yg!==void 0?yg.createHTML(e):e}const Z5=(n,e)=>{const t=n.length-1,r=[];let i,s=e===2?"<svg>":e===3?"<math>":"",o=Co;for(let l=0;l<t;l++){const c=n[l];let u,f,m=-1,v=0;for(;v<c.length&&(o.lastIndex=v,f=o.exec(c),f!==null);)v=o.lastIndex,o===Co?f[1]==="!--"?o=wg:f[1]!==void 0?o=bg:f[2]!==void 0?(Tw.test(f[2])&&(i=RegExp("</"+f[2],"g")),o=Vr):f[3]!==void 0&&(o=Vr):o===Vr?f[0]===">"?(o=i??Co,m=-1):f[1]===void 0?m=-2:(m=o.lastIndex-f[2].length,u=f[1],o=f[3]===void 0?Vr:f[3]==='"'?Sg:_g):o===Sg||o===_g?o=Vr:o===wg||o===bg?o=Co:(o=Vr,i=void 0);const y=o===Vr&&n[l+1].startsWith("/>")?" ":"";s+=o===Co?c+N5:m>=0?(r.push(u),c.slice(0,m)+$w+c.slice(m)+rr+y):c+rr+(m===-2?l:y)}return[Rw(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class pa{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,o=0;const l=e.length-1,c=this.parts,[u,f]=Z5(e,t);if(this.el=pa.createElement(u,r),Qr.currentNode=this.el.content,t===2||t===3){const m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=Qr.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const m of i.getAttributeNames())if(m.endsWith($w)){const v=f[o++],y=i.getAttribute(m).split(rr),k=/([.?@])?(.*)/.exec(v);c.push({type:1,index:s,name:k[2],strings:y,ctor:k[1]==="."?H5:k[1]==="?"?V5:k[1]==="@"?B5:Uu}),i.removeAttribute(m)}else m.startsWith(rr)&&(c.push({type:6,index:s}),i.removeAttribute(m));if(Tw.test(i.tagName)){const m=i.textContent.split(rr),v=m.length-1;if(v>0){i.textContent=jc?jc.emptyScript:"";for(let y=0;y<v;y++)i.append(m[y],da()),Qr.nextNode(),c.push({type:2,index:++s});i.append(m[v],da())}}}else if(i.nodeType===8)if(i.data===Cw)c.push({type:2,index:s});else{let m=-1;for(;(m=i.data.indexOf(rr,m+1))!==-1;)c.push({type:7,index:s}),m+=rr.length-1}s++}}static createElement(e,t){const r=Fi.createElement("template");return r.innerHTML=e,r}}function oo(n,e,t=n,r){var o,l;if(e===Pt)return e;let i=r!==void 0?(o=t._$Co)==null?void 0:o[r]:t._$Cl;const s=fa(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((l=i==null?void 0:i._$AO)==null||l.call(i,!1),s===void 0?i=void 0:(i=new s(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=i:t._$Cl=i),i!==void 0&&(e=oo(n,i._$AS(n,e.values),i,r)),e}class F5{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,i=((e==null?void 0:e.creationScope)??Fi).importNode(t,!0);Qr.currentNode=i;let s=Qr.nextNode(),o=0,l=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Mu(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new q5(s,this,e)),this._$AV.push(u),c=r[++l]}o!==(c==null?void 0:c.index)&&(s=Qr.nextNode(),o++)}return Qr.currentNode=Fi,i}p(e){let t=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}let Mu=class Iw{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=ue,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=oo(this,e,t),fa(e)?e===ue||e==null||e===""?(this._$AH!==ue&&this._$AR(),this._$AH=ue):e!==this._$AH&&e!==Pt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):M5(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==ue&&fa(this._$AH)?this._$AA.nextSibling.data=e:this.T(Fi.createTextNode(e)),this._$AH=e}$(e){var s;const{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=pa.createElement(Rw(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(t);else{const o=new F5(i,this),l=o.u(this.options);o.p(t),this.T(l),this._$AH=o}}_$AC(e){let t=Ag.get(e.strings);return t===void 0&&Ag.set(e.strings,t=new pa(e)),t}k(e){gp(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,i=0;for(const s of e)i===t.length?t.push(r=new Iw(this.O(da()),this.O(da()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,t);e!==this._$AB;){const i=vg(e).nextSibling;vg(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},Uu=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=ue,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=ue}_$AI(e,t=this,r,i){const s=this.strings;let o=!1;if(s===void 0)e=oo(this,e,t,0),o=!fa(e)||e!==this._$AH&&e!==Pt,o&&(this._$AH=e);else{const l=e;let c,u;for(e=s[0],c=0;c<s.length-1;c++)u=oo(this,l[r+c],t,c),u===Pt&&(u=this._$AH[c]),o||(o=!fa(u)||u!==this._$AH[c]),u===ue?e=ue:e!==ue&&(e+=(u??"")+s[c+1]),this._$AH[c]=u}o&&!i&&this.j(e)}j(e){e===ue?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},H5=class extends Uu{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ue?void 0:e}},V5=class extends Uu{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ue)}},B5=class extends Uu{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=oo(this,e,t,0)??ue)===Pt)return;const r=this._$AH,i=e===ue&&r!==ue||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==ue&&(r===ue||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}};class q5{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){oo(this,e)}}const j5={I:Mu},Hh=sa.litHtmlPolyfillSupport;Hh==null||Hh(pa,Mu),(sa.litHtmlVersions??(sa.litHtmlVersions=[])).push("3.3.2");const _c=(n,e,t)=>{const r=e;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new Mu(e.insertBefore(da(),null),null,void 0,{})),i._$AI(n),i};/**
63
- * @license
64
- * Copyright 2020 Google LLC
65
- * SPDX-License-Identifier: BSD-3-Clause
66
- */const{I:W5}=j5,kg=n=>n,G5=n=>n.strings===void 0,Eg=()=>document.createComment(""),To=(n,e,t)=>{var s;const r=n._$AA.parentNode,i=e===void 0?n._$AB:e._$AA;if(t===void 0){const o=r.insertBefore(Eg(),i),l=r.insertBefore(Eg(),i);t=new W5(o,l,n,n.options)}else{const o=t._$AB.nextSibling,l=t._$AM,c=l!==n;if(c){let u;(s=t._$AQ)==null||s.call(t,n),t._$AM=n,t._$AP!==void 0&&(u=n._$AU)!==l._$AU&&t._$AP(u)}if(o!==i||c){let u=t._$AA;for(;u!==o;){const f=kg(u).nextSibling;kg(r).insertBefore(u,i),u=f}}}return t},Br=(n,e,t=n)=>(n._$AI(e,t),n),Y5={},K5=(n,e=Y5)=>n._$AH=e,J5=n=>n._$AH,Vh=n=>{n._$AR(),n._$AA.remove()};/**
67
- * @license
68
- * Copyright 2017 Google LLC
69
- * SPDX-License-Identifier: BSD-3-Clause
70
- */const Zu={ATTRIBUTE:1,CHILD:2},El=n=>(...e)=>({_$litDirective$:n,values:e});let Fu=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};/**
71
- * @license
72
- * Copyright 2017 Google LLC
73
- * SPDX-License-Identifier: BSD-3-Clause
74
- */const oa=(n,e)=>{var r;const t=n._$AN;if(t===void 0)return!1;for(const i of t)(r=i._$AO)==null||r.call(i,e,!1),oa(i,e);return!0},Wc=n=>{let e,t;do{if((e=n._$AM)===void 0)break;t=e._$AN,t.delete(n),n=e}while((t==null?void 0:t.size)===0)},xw=n=>{for(let e;e=n._$AM;n=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(n))break;t.add(n),eD(e)}};function X5(n){this._$AN!==void 0?(Wc(this),this._$AM=n,xw(this)):this._$AM=n}function Q5(n,e=!1,t=0){const r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let s=t;s<r.length;s++)oa(r[s],!1),Wc(r[s]);else r!=null&&(oa(r,!1),Wc(r));else oa(this,n)}const eD=n=>{n.type==Zu.CHILD&&(n._$AP??(n._$AP=Q5),n._$AQ??(n._$AQ=X5))};class Pw extends Fu{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),xw(this),this.isConnected=e._$AU}_$AO(e,t=!0){var r,i;e!==this.isConnected&&(this.isConnected=e,e?(r=this.reconnected)==null||r.call(this):(i=this.disconnected)==null||i.call(this)),t&&(oa(this,e),Wc(this))}setValue(e){if(G5(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}var Ma,Ua,ur,mi;class At extends Pw{constructor(){super(...arguments);g(this,Ma,[]);g(this,Ua,!1);g(this,ur,!1);g(this,mi,!1)}connected(){}template(...t){return Pt}render(...t){return!this.isConnected||a(this,ur)||this.setValue(t.length?t[0]:this.template(...a(this,Ma))),Pt}update(t,r){d(this,Ma,r),d(this,mi,!1),d(this,ur,!0);try{return a(this,Ua)||(d(this,Ua,!0),this.connected()),this.template(...r)}finally{d(this,ur,!1)}}reconnected(){d(this,ur,!0);try{this.connected()}finally{d(this,ur,!1)}d(this,mi,!0),queueMicrotask(()=>{a(this,mi)&&(d(this,mi,!1),this.render())})}}Ma=new WeakMap,Ua=new WeakMap,ur=new WeakMap,mi=new WeakMap;function kt(n){return El(n)}function tD(n,e){var r;const t=n.connection;return t.authorizationRequired?t.authorizationRejected?{kind:"unauthorized",invalid:!0}:{kind:"unauthorized"}:t.gateHalted?{kind:"needs-upgrade",instructions:t.upgradeInstructions}:t.status!=="connected"?t.hasEverConnected?{kind:"disconnected",nextRetryAt:t.nextRetryAt}:t.firstConnectError!==null?{kind:"error",serverURL:e,message:t.firstConnectError}:{kind:"connecting"}:n.ready?n.channels.length===0?{kind:"no-channel"}:((r=n.focusedChannel)==null?void 0:r.pages.length)===0?{kind:"empty-channel"}:{kind:"connected"}:{kind:"connecting"}}function Hu(n,{overlay:e=!1}={}){const t=V`<dialog open>${n}</dialog>`;return e?V`<div class="dialog-overlay">${t}</div>`:t}function Vu(n,e){let t=!1;const r=s=>{s.preventDefault(),e("escape")},i=s=>{if(s.target!==n)return;const o=n.getBoundingClientRect();s.clientX>=o.left&&s.clientX<=o.right&&s.clientY>=o.top&&s.clientY<=o.bottom||e("backdrop")};return n.addEventListener("cancel",r),n.addEventListener("click",i),n.removeAttribute("open"),n.showModal(),{withdraw(){t||(t=!0,n.removeEventListener("cancel",r),n.removeEventListener("click",i),n.open&&n.close())}}}let nD=0;function rD(n){return"separator"in n}function Dw(n){return[...n.querySelectorAll(".menu-item")]}function iD(n){var e;n.newState!=="open"||!(n.currentTarget instanceof HTMLElement)||(e=Dw(n.currentTarget)[0])==null||e.focus()}function sD(n){var i;if(n.key!=="ArrowDown"&&n.key!=="ArrowUp"||!(n.currentTarget instanceof HTMLElement))return;n.preventDefault();const e=Dw(n.currentTarget),t=e.indexOf(document.activeElement),r=n.key==="ArrowDown"?Math.min(t+1,e.length-1):Math.max(t-1,0);(i=e[r])==null||i.focus()}var Za;class oD extends At{constructor(){super(...arguments);g(this,Za,`menu-${++nD}`)}template(t,{placement:r="bottom-start",trigger:i}){return V`${i(a(this,Za))}<div
75
- id=${a(this,Za)}
76
- popover
77
- placement=${r}
78
- class="menu"
79
- role="menu"
80
- @toggle=${iD}
81
- @keydown=${sD}
82
- >
83
- ${t.map(s=>rD(s)?V`<hr class="menu-separator" />`:V`<button
84
- class=${s.destructive?"menu-item destructive":"menu-item"}
85
- full-row
86
- role="menuitem"
87
- @click=${()=>s.action()}
88
- >
89
- ${s.label}
90
- </button>`)}
91
- </div>`}}Za=new WeakMap;const Lw=kt(oD);/**
92
- * @license
93
- * Copyright 2020 Google LLC
94
- * SPDX-License-Identifier: BSD-3-Clause
95
- */const Rr=()=>new aD;class aD{}const Bh=new WeakMap,mn=El(class extends Pw{render(n){return ue}update(n,[e]){var r;const t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=(r=n.options)==null?void 0:r.host,this.rt(this.ct=n.element)),ue}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=Bh.get(e);t===void 0&&(t=new WeakMap,Bh.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){var n,e;return typeof this.G=="function"?(n=Bh.get(this.ht??globalThis))==null?void 0:n.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});/**
96
- * @license
97
- * Copyright 2017 Google LLC
98
- * SPDX-License-Identifier: BSD-3-Clause
99
- */const $g=(n,e,t)=>{const r=new Map;for(let i=e;i<=t;i++)r.set(n[i],i);return r},Gc=El(class extends Fu{constructor(n){if(super(n),n.type!==Zu.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);const i=[],s=[];let o=0;for(const l of n)i[o]=r?r(l,o):o,s[o]=t(l,o),o++;return{values:s,keys:i}}render(n,e,t){return this.dt(n,e,t).values}update(n,[e,t,r]){const i=J5(n),{values:s,keys:o}=this.dt(e,t,r);if(!Array.isArray(i))return this.ut=o,s;const l=this.ut??(this.ut=[]),c=[];let u,f,m=0,v=i.length-1,y=0,k=s.length-1;for(;m<=v&&y<=k;)if(i[m]===null)m++;else if(i[v]===null)v--;else if(l[m]===o[y])c[y]=Br(i[m],s[y]),m++,y++;else if(l[v]===o[k])c[k]=Br(i[v],s[k]),v--,k--;else if(l[m]===o[k])c[k]=Br(i[m],s[k]),To(n,c[k+1],i[m]),m++,k--;else if(l[v]===o[y])c[y]=Br(i[v],s[y]),To(n,i[m],i[v]),v--,y++;else if(u===void 0&&(u=$g(o,y,k),f=$g(l,m,v)),u.has(l[m]))if(u.has(l[v])){const S=f.get(o[y]),x=S!==void 0?i[S]:null;if(x===null){const M=To(n,i[m]);Br(M,s[y]),c[y]=M}else c[y]=Br(x,s[y]),To(n,i[m],x),i[S]=null;y++}else Vh(i[v]),v--;else Vh(i[m]),m++;for(;y<=k;){const S=To(n,c[k+1]);Br(S,s[y]),c[y++]=S}for(;m<=v;){const S=i[m++];S!==null&&Vh(S)}return this.ut=o,K5(n,c),Pt}});/**
100
- * @license
101
- * Copyright 2018 Google LLC
102
- * SPDX-License-Identifier: BSD-3-Clause
103
- */const Ow="important",lD=" !"+Ow,Yc=El(class extends Fu{constructor(n){var e;if(super(n),n.type!==Zu.ATTRIBUTE||n.name!=="style"||((e=n.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(n){return Object.keys(n).reduce((e,t)=>{const r=n[t];return r==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(n,[e]){const{style:t}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const r of this.ft)e[r]==null&&(this.ft.delete(r),r.includes("-")?t.removeProperty(r):t[r]=null);for(const r in e){const i=e[r];if(i!=null){this.ft.add(r);const s=typeof i=="string"&&i.endsWith(lD);r.includes("-")||s?t.setProperty(r,s?i.slice(0,-11):i,s?Ow:""):t[r]=i}}return Pt}}),cD=24;function uD(n){return!Cg(n.source)||!Cg(n.current)||!vD(n.source,n.current)||!yD(n)||!gD(n.geometry)?{kind:"invalidated"}:fD(n.pointer,n.geometry)==="pinned"?hD(n):dD(n)}function hD(n){var c;const{source:e,current:t,pointer:r,geometry:i}=n,o=(((c=i.placeholder)==null?void 0:c.side)==="pinned"&&r.y>=i.placeholder.top&&r.y<=i.placeholder.bottom?i.placeholder.index:null)??pD(r.y,i.pinnedRows),l=t.pinnedChannelIds.filter(u=>u!==e.channelId);return l.splice(o,0,e.channelId),{kind:"placement",side:"pinned",placeholder:{side:"pinned",index:o},operation:l}}function dD(n){const{source:e,current:t}=n,r=e.pinnedChannelIds.includes(e.channelId),i=r?mD(t.unpinnedChannelIds,e.channelId):e.unpinnedChannelIds.indexOf(e.channelId);return{kind:"placement",side:"unpinned",placeholder:r&&t.unpinnedChannelIds.length===0?null:{side:"unpinned",index:i},operation:r?t.pinnedChannelIds.filter(s=>s!==e.channelId):null}}function fD(n,e){const{sidebar:t}=e;if(n.x<t.left||n.x>t.right||n.y<t.top||n.y>t.bottom)return"unpinned";const i=e.unpinnedGroupTop??(e.pinnedContentBottom===null?Number.NEGATIVE_INFINITY:e.pinnedContentBottom+cD);return n.y<i?"pinned":"unpinned"}function pD(n,e){const t=e.findIndex(({top:r,bottom:i})=>n<r+(i-r)/2);return t===-1?e.length:t}function mD(n,e){const t=n.filter(i=>i!==e),r=t.findIndex(i=>i<e);return r===-1?t.length:r}function gD(n){return n.unpinnedGroupTop!==null||n.pinnedContentBottom!==null}function Cg(n){const e=[...n.pinnedChannelIds,...n.unpinnedChannelIds];return new Set(e).size===e.length}function vD(n,e){return Zd(n.pinnedChannelIds,e.pinnedChannelIds)&&Zd(n.unpinnedChannelIds,e.unpinnedChannelIds)}function yD(n){const e=n.current.pinnedChannelIds.filter(s=>s!==n.source.channelId),t=n.geometry.pinnedRows.map(({channelId:s})=>s),r=n.geometry.placeholder,i=r===null||Number.isInteger(r.index)&&r.index>=0&&r.index<=(r.side==="pinned"?e.length:n.current.unpinnedChannelIds.length);return n.source.pinnedChannelIds.includes(n.source.channelId)!==n.source.unpinnedChannelIds.includes(n.source.channelId)&&Zd(e,t)&&i}function Zd(n,e){return n.length===e.length&&n.every((t,r)=>t===e[r])}const wD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"/></svg>',bD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/></svg>',_D='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"/></svg>',SD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z"/></svg>',AD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"/></svg>',kD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"/></svg>',ED='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z"/></svg>',$D='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm88-29.84q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.21,107.21,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.71,107.71,0,0,0-26.25-10.87,8,8,0,0,0-7.06,1.49L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.21,107.21,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06Zm-16.1-6.5a73.93,73.93,0,0,1,0,8.68,8,8,0,0,0,1.74,5.48l14.19,17.73a91.57,91.57,0,0,1-6.23,15L187,173.11a8,8,0,0,0-5.1,2.64,74.11,74.11,0,0,1-6.14,6.14,8,8,0,0,0-2.64,5.1l-2.51,22.58a91.32,91.32,0,0,1-15,6.23l-17.74-14.19a8,8,0,0,0-5-1.75h-.48a73.93,73.93,0,0,1-8.68,0,8,8,0,0,0-5.48,1.74L100.45,215.8a91.57,91.57,0,0,1-15-6.23L82.89,187a8,8,0,0,0-2.64-5.1,74.11,74.11,0,0,1-6.14-6.14,8,8,0,0,0-5.1-2.64L46.43,170.6a91.32,91.32,0,0,1-6.23-15l14.19-17.74a8,8,0,0,0,1.74-5.48,73.93,73.93,0,0,1,0-8.68,8,8,0,0,0-1.74-5.48L40.2,100.45a91.57,91.57,0,0,1,6.23-15L69,82.89a8,8,0,0,0,5.1-2.64,74.11,74.11,0,0,1,6.14-6.14A8,8,0,0,0,82.89,69L85.4,46.43a91.32,91.32,0,0,1,15-6.23l17.74,14.19a8,8,0,0,0,5.48,1.74,73.93,73.93,0,0,1,8.68,0,8,8,0,0,0,5.48-1.74L155.55,40.2a91.57,91.57,0,0,1,15,6.23L173.11,69a8,8,0,0,0,2.64,5.1,74.11,74.11,0,0,1,6.14,6.14,8,8,0,0,0,5.1,2.64l22.58,2.51a91.32,91.32,0,0,1,6.23,15l-14.19,17.74A8,8,0,0,0,199.87,123.66Z"/></svg>',CD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"/></svg>',TD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"/></svg>',RD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"/></svg>',ID='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M71.59,61.47a8,8,0,0,0-15.18,0l-40,120A8,8,0,0,0,24,192h80a8,8,0,0,0,7.59-10.53ZM35.1,176,64,89.3,92.9,176ZM208,76a52,52,0,1,0-52,52A52.06,52.06,0,0,0,208,76Zm-88,0a36,36,0,1,1,36,36A36,36,0,0,1,120,76Zm104,68H136a8,8,0,0,0-8,8v56a8,8,0,0,0,8,8h88a8,8,0,0,0,8-8V152A8,8,0,0,0,224,144Zm-8,56H144V160h72Z"/></svg>',xD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,71.1a8,8,0,0,1-10.78-3.42,94.13,94.13,0,0,0-33.46-36.91,8,8,0,1,1,8.54-13.54,111.46,111.46,0,0,1,39.12,43.09A8,8,0,0,1,224,71.1ZM35.71,72a8,8,0,0,0,7.1-4.32A94.13,94.13,0,0,1,76.27,30.77a8,8,0,1,0-8.54-13.54A111.46,111.46,0,0,0,28.61,60.32,8,8,0,0,0,35.71,72Zm186.1,103.94A16,16,0,0,1,208,200H167.2a40,40,0,0,1-78.4,0H48a16,16,0,0,1-13.79-24.06C43.22,160.39,48,138.28,48,112a80,80,0,0,1,160,0C208,138.27,212.78,160.38,221.81,175.94ZM150.62,200H105.38a24,24,0,0,0,45.24,0ZM208,184c-10.64-18.27-16-42.49-16-72a64,64,0,0,0-128,0c0,29.52-5.38,53.74-16,72Z"/></svg>',PD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,96V216H96V160h64V96Z" opacity="0.2"/><path d="M216,88H168V40a8,8,0,0,0-8-8H40a8,8,0,0,0-8,8V160a8,8,0,0,0,8,8H88v48a8,8,0,0,0,8,8H216a8,8,0,0,0,8-8V96A8,8,0,0,0,216,88ZM48,48H152V152H48ZM208,208H104V168h56a8,8,0,0,0,8-8V104h40Z"/></svg>',DD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"/></svg>',LD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,112a28,28,0,0,0-8,54.83V184a8,8,0,0,0,16,0V166.83A28,28,0,0,0,128,112Zm0,40a12,12,0,1,1,12-12A12,12,0,0,1,128,152Zm80-72H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"/></svg>',OD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M53.92,34.62A8,8,0,1,0,42.08,45.38L67.37,73.2A69.82,69.82,0,0,0,38,87.63a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33,89.75,89.75,0,0,0,11.58-20.27l21.84,24a8,8,0,1,0,11.84-10.76ZM155.9,208,48,100.08C58.23,91.83,69.2,87.72,80.66,87.81l87.16,95.88C165.59,193.56,160.24,202.23,155.9,208Zm79.42-104-44.64,44.79a8,8,0,1,1-11.33-11.3L224,92.7,163.32,32,122.1,73.35a8,8,0,0,1-11.33-11.29L152,20.7a16,16,0,0,1,22.63,0l60.69,60.68A16,16,0,0,1,235.32,104Z"/></svg>',zD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"/></svg>',ND='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"/></svg>',MD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,64H147.31l34.35-34.34a8,8,0,1,0-11.32-11.32L128,60.69,85.66,18.34A8,8,0,0,0,74.34,29.66L108.69,64H40A16,16,0,0,0,24,80V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V80A16,16,0,0,0,216,64ZM40,80H144V200H40ZM216,200H160V80h56V200Zm-16-84a12,12,0,1,1-12-12A12,12,0,0,1,200,116Zm0,48a12,12,0,1,1-12-12A12,12,0,0,1,200,164Z"/></svg>',UD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z"/></svg>',ZD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M104,40H56A16,16,0,0,0,40,56v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,104,40Zm0,64H56V56h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,64H152V56h48v48Zm-96,32H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm0,64H56V152h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48Z"/></svg>',FD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,88H175.4l8.47-46.57a8,8,0,0,0-15.74-2.86l-9,49.43H111.4l8.47-46.57a8,8,0,0,0-15.74-2.86L95.14,88H48a8,8,0,0,0,0,16H92.23L83.5,152H32a8,8,0,0,0,0,16H80.6l-8.47,46.57a8,8,0,0,0,6.44,9.3A7.79,7.79,0,0,0,80,224a8,8,0,0,0,7.86-6.57l9-49.43H144.6l-8.47,46.57a8,8,0,0,0,6.44,9.3A7.79,7.79,0,0,0,144,224a8,8,0,0,0,7.86-6.57l9-49.43H208a8,8,0,0,0,0-16H163.77l8.73-48H224a8,8,0,0,0,0-16Zm-76.5,64H99.77l8.73-48h47.73Z"/></svg>',HD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"/></svg>',VD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"/></svg>',BD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,16,.45A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"/></svg>',qD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"/></svg>',jD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"/></svg>',WD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"/></svg>',GD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"/></svg>',YD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/></svg>',KD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"/></svg>',JD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,72H131.31L104,44.69A15.86,15.86,0,0,0,92.69,40H40A16,16,0,0,0,24,56V200.62A15.4,15.4,0,0,0,39.38,216H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72ZM40,56H92.69l16,16H40ZM216,200H40V88H216Z"/></svg>',XD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z"/></svg>',QD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M230.92,212c-15.23-26.33-38.7-45.21-66.09-54.16a72,72,0,1,0-73.66,0C63.78,166.78,40.31,185.66,25.08,212a8,8,0,1,0,13.85,8c18.84-32.56,52.14-52,89.07-52s70.23,19.44,89.07,52a8,8,0,1,0,13.85-8ZM72,96a56,56,0,1,1,56,56A56.06,56.06,0,0,1,72,96Z"/></svg>',eL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM93.66,77.66,120,51.31V144a8,8,0,0,0,16,0V51.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,77.66Z"/></svg>',tL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z"/></svg>',nL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M219.31,108.68l-80-80a16,16,0,0,0-22.62,0l-80,80A15.87,15.87,0,0,0,32,120v96a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V160h32v56a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V120A15.87,15.87,0,0,0,219.31,108.68ZM208,208H160V152a8,8,0,0,0-8-8H104a8,8,0,0,0-8,8v56H48V120l80-80,80,80Z"/></svg>',rL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z"/></svg>',iL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M230.6,49.53A15.81,15.81,0,0,0,216,40H40A16,16,0,0,0,28.19,66.76l.08.09L96,139.17V216a16,16,0,0,0,24.87,13.32l32-21.34A16,16,0,0,0,160,194.66V139.17l67.74-72.32.08-.09A15.8,15.8,0,0,0,230.6,49.53ZM40,56h0Zm106.18,74.58A8,8,0,0,0,144,136v58.66L112,216V136a8,8,0,0,0-2.16-5.47L40,56H216Z"/></svg>',sL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M117.66,170.34a8,8,0,0,1,0,11.32l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L72,188.69V48a8,8,0,0,1,16,0V188.69l18.34-18.35A8,8,0,0,1,117.66,170.34Zm96-96-32-32a8,8,0,0,0-11.32,0l-32,32a8,8,0,0,0,11.32,11.32L168,67.31V208a8,8,0,0,0,16,0V67.31l18.34,18.35a8,8,0,0,0,11.32-11.32Z"/></svg>',oL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"/></svg>',aL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,200h-8V40a8,8,0,0,0-8-8H152a8,8,0,0,0-8,8V80H96a8,8,0,0,0-8,8v40H48a8,8,0,0,0-8,8v64H32a8,8,0,0,0,0,16H224a8,8,0,0,0,0-16ZM160,48h40V200H160ZM104,96h40V200H104ZM56,144H88v56H56Z"/></svg>',lL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"/></svg>',cL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z"/></svg>',uL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,64a40,40,0,1,0,40,40A40,40,0,0,0,128,64Zm0,64a24,24,0,1,1,24-24A24,24,0,0,1,128,128Zm0-112a88.1,88.1,0,0,0-88,88c0,31.4,14.51,64.68,42,96.25a254.19,254.19,0,0,0,41.45,38.3,8,8,0,0,0,9.18,0A254.19,254.19,0,0,0,174,200.25c27.45-31.57,42-64.85,42-96.25A88.1,88.1,0,0,0,128,16Zm0,206c-16.53-13-72-60.75-72-118a72,72,0,0,1,144,0C200,161.23,144.53,209,128,222Z"/></svg>',hL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z"/></svg>',dL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M200,32H160a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H160V48h40ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Zm0,176H56V48H96Z"/></svg>',fL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z"/></svg>',pL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"/></svg>',mL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M212.92,17.69a8,8,0,0,0-6.86-1.45l-128,32A8,8,0,0,0,72,56V166.08A36,36,0,1,0,88,196V110.25l112-28v51.83A36,36,0,1,0,216,164V24A8,8,0,0,0,212.92,17.69ZM52,216a20,20,0,1,1,20-20A20,20,0,0,1,52,216ZM88,93.75V62.25l112-28v31.5ZM180,184a20,20,0,1,1,20-20A20,20,0,0,1,180,184Z"/></svg>',gL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"/></svg>',vL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM203.43,64,128,133.15,52.57,64ZM216,192H40V74.19l82.59,75.71a8,8,0,0,0,10.82,0L216,74.19V192Z"/></svg>',yL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M222.37,158.46l-47.11-21.11-.13-.06a16,16,0,0,0-15.17,1.4,8.12,8.12,0,0,0-.75.56L134.87,160c-15.42-7.49-31.34-23.29-38.83-38.51l20.78-24.71c.2-.25.39-.5.57-.77a16,16,0,0,0,1.32-15.06l0-.12L97.54,33.64a16,16,0,0,0-16.62-9.52A56.26,56.26,0,0,0,32,80c0,79.4,64.6,144,144,144a56.26,56.26,0,0,0,55.88-48.92A16,16,0,0,0,222.37,158.46ZM176,208A128.14,128.14,0,0,1,48,80,40.2,40.2,0,0,1,82.87,40a.61.61,0,0,0,0,.12l21,47L83.2,111.86a6.13,6.13,0,0,0-.57.77,16,16,0,0,0-1,15.7c9.06,18.53,27.73,37.06,46.46,46.11a16,16,0,0,0,15.75-1.14,8.44,8.44,0,0,0,.74-.56L168.89,152l47,21.05h0s.08,0,.11,0A40.21,40.21,0,0,1,176,208Z"/></svg>',wL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24h0A104,104,0,1,0,232,128,104.12,104.12,0,0,0,128,24Zm88,104a87.61,87.61,0,0,1-3.33,24H174.16a157.44,157.44,0,0,0,0-48h38.51A87.61,87.61,0,0,1,216,128ZM102,168H154a115.11,115.11,0,0,1-26,45A115.27,115.27,0,0,1,102,168Zm-3.9-16a140.84,140.84,0,0,1,0-48h59.88a140.84,140.84,0,0,1,0,48ZM40,128a87.61,87.61,0,0,1,3.33-24H81.84a157.44,157.44,0,0,0,0,48H43.33A87.61,87.61,0,0,1,40,128ZM154,88H102a115.11,115.11,0,0,1,26-45A115.27,115.27,0,0,1,154,88Zm52.33,0H170.71a135.28,135.28,0,0,0-22.3-45.6A88.29,88.29,0,0,1,206.37,88ZM107.59,42.4A135.28,135.28,0,0,0,85.29,88H49.63A88.29,88.29,0,0,1,107.59,42.4ZM49.63,168H85.29a135.28,135.28,0,0,0,22.3,45.6A88.29,88.29,0,0,1,49.63,168Zm98.78,45.6a135.28,135.28,0,0,0,22.3-45.6h35.66A88.29,88.29,0,0,1,148.41,213.6Z"/></svg>',bL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M243.31,136,144,36.69A15.86,15.86,0,0,0,132.69,32H40a8,8,0,0,0-8,8v92.69A15.86,15.86,0,0,0,36.69,144L136,243.31a16,16,0,0,0,22.63,0l84.68-84.68a16,16,0,0,0,0-22.63Zm-96,96L48,132.69V48h84.69L232,147.31ZM96,84A12,12,0,1,1,84,72,12,12,0,0,1,96,84Z"/></svg>',_L='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M184,32H72A16,16,0,0,0,56,48V224a8,8,0,0,0,12.24,6.78L128,193.43l59.77,37.35A8,8,0,0,0,200,224V48A16,16,0,0,0,184,32Zm0,177.57-51.77-32.35a8,8,0,0,0-8.48,0L72,209.57V48H184Z"/></svg>',SL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM40,112H80v32H40Zm56,0H216v32H96ZM216,64V96H40V64ZM40,160H80v32H40Zm176,32H96V160H216v32Z"/></svg>',AL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M69.12,94.15,28.5,128l40.62,33.85a8,8,0,1,1-10.24,12.29l-48-40a8,8,0,0,1,0-12.29l48-40a8,8,0,0,1,10.24,12.3Zm176,27.7-48-40a8,8,0,1,0-10.24,12.3L227.5,128l-40.62,33.85a8,8,0,1,0,10.24,12.29l48-40a8,8,0,0,0,0-12.29ZM162.73,32.48a8,8,0,0,0-10.25,4.79l-64,176a8,8,0,0,0,4.79,10.26A8.14,8.14,0,0,0,96,224a8,8,0,0,0,7.52-5.27l64-176A8,8,0,0,0,162.73,32.48Z"/></svg>',kL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z"/></svg>',EL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z"/></svg>',$L='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z"/></svg>',CL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M152,120H136V56h8a32,32,0,0,1,32,32,8,8,0,0,0,16,0,48.05,48.05,0,0,0-48-48h-8V24a8,8,0,0,0-16,0V40h-8a48,48,0,0,0,0,96h8v64H104a32,32,0,0,1-32-32,8,8,0,0,0-16,0,48.05,48.05,0,0,0,48,48h16v16a8,8,0,0,0,16,0V216h16a48,48,0,0,0,0-96Zm-40,0a32,32,0,0,1,0-64h8v64Zm40,80H136V136h16a32,32,0,0,1,0,64Z"/></svg>',TL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M24,104H48v64H32a8,8,0,0,0,0,16H224a8,8,0,0,0,0-16H208V104h24a8,8,0,0,0,4.19-14.81l-104-64a8,8,0,0,0-8.38,0l-104,64A8,8,0,0,0,24,104Zm40,0H96v64H64Zm80,0v64H112V104Zm48,64H160V104h32ZM128,41.39,203.74,88H52.26ZM248,208a8,8,0,0,1-8,8H16a8,8,0,0,1,0-16H240A8,8,0,0,1,248,208Z"/></svg>',RL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,16V88H32V64Zm0,128H32V104H224v88Zm-16-24a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h32A8,8,0,0,1,208,168Zm-64,0a8,8,0,0,1-8,8H120a8,8,0,0,1,0-16h16A8,8,0,0,1,144,168Z"/></svg>',IL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,64H56a8,8,0,0,1,0-16H192a8,8,0,0,0,0-16H56A24,24,0,0,0,32,56V184a24,24,0,0,0,24,24H216a16,16,0,0,0,16-16V80A16,16,0,0,0,216,64Zm0,128H56a8,8,0,0,1-8-8V78.63A23.84,23.84,0,0,0,56,80H216Zm-48-60a12,12,0,1,1,12,12A12,12,0,0,1,168,132Z"/></svg>',xL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M207.06,72.67A111.24,111.24,0,0,0,128,40h-.4C66.07,40.21,16,91,16,153.13V176a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V152A111.25,111.25,0,0,0,207.06,72.67ZM224,176H119.71l54.76-75.3a8,8,0,0,0-12.94-9.42L99.92,176H32V153.13c0-3.08.15-6.12.43-9.13H56a8,8,0,0,0,0-16H35.27c10.32-38.86,44-68.24,84.73-71.66V80a8,8,0,0,0,16,0V56.33A96.14,96.14,0,0,1,221,128H200a8,8,0,0,0,0,16h23.67c.21,2.65.33,5.31.33,8Z"/></svg>',PL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,128a8,8,0,0,1-8,8H204.94l-37.78,75.58A8,8,0,0,1,160,216h-.4a8,8,0,0,1-7.08-5.14L95.35,60.76,63.28,131.31A8,8,0,0,1,56,136H24a8,8,0,0,1,0-16H50.85L88.72,36.69a8,8,0,0,1,14.76.46l57.51,151,31.85-63.71A8,8,0,0,1,200,120h32A8,8,0,0,1,240,128Z"/></svg>',DL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,56v64a8,8,0,0,1-16,0V75.31l-82.34,82.35a8,8,0,0,1-11.32,0L96,123.31,29.66,189.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0L136,140.69,212.69,64H168a8,8,0,0,1,0-16h64A8,8,0,0,1,240,56Z"/></svg>',LL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,128v64a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h44.69L136,107.31l-34.34,34.35a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,29.66,58.34L96,124.69l34.34-34.35a8,8,0,0,1,11.32,0L224,172.69V128a8,8,0,0,1,16,0Z"/></svg>',OL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24C74.17,24,32,48.6,32,80v96c0,31.4,42.17,56,96,56s96-24.6,96-56V80C224,48.6,181.83,24,128,24Zm80,104c0,9.62-7.88,19.43-21.61,26.92C170.93,163.35,150.19,168,128,168s-42.93-4.65-58.39-13.08C55.88,147.43,48,137.62,48,128V111.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64ZM69.61,53.08C85.07,44.65,105.81,40,128,40s42.93,4.65,58.39,13.08C200.12,60.57,208,70.38,208,80s-7.88,19.43-21.61,26.92C170.93,115.35,150.19,120,128,120s-42.93-4.65-58.39-13.08C55.88,99.43,48,89.62,48,80S55.88,60.57,69.61,53.08ZM186.39,202.92C170.93,211.35,150.19,216,128,216s-42.93-4.65-58.39-13.08C55.88,195.43,48,185.62,48,176V159.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64V176C208,185.62,200.12,195.43,186.39,202.92Z"/></svg>',zL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,136H48a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V152A16,16,0,0,0,208,136Zm0,64H48V152H208v48Zm0-160H48A16,16,0,0,0,32,56v48a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V56A16,16,0,0,0,208,40Zm0,64H48V56H208v48ZM192,80a12,12,0,1,1-12-12A12,12,0,0,1,192,80Zm0,96a12,12,0,1,1-12-12A12,12,0,0,1,192,176Z"/></svg>',NL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M223.85,47.12a16,16,0,0,0-15-15c-12.58-.75-44.73.4-71.41,27.07L132.69,64H74.36A15.91,15.91,0,0,0,63,68.68L28.7,103a16,16,0,0,0,9.07,27.16l38.47,5.37,44.21,44.21,5.37,38.49a15.94,15.94,0,0,0,10.78,12.92,16.11,16.11,0,0,0,5.1.83A15.91,15.91,0,0,0,153,227.3L187.32,193A15.91,15.91,0,0,0,192,181.64V123.31l4.77-4.77C223.45,91.86,224.6,59.71,223.85,47.12ZM74.36,80h42.33L77.16,119.52,40,114.34Zm74.41-9.45a76.65,76.65,0,0,1,59.11-22.47,76.46,76.46,0,0,1-22.42,59.16L128,164.68,91.32,128ZM176,181.64,141.67,216l-5.19-37.17L176,139.31Zm-74.16,9.5C97.34,201,82.29,224,40,224a8,8,0,0,1-8-8c0-42.29,23-57.34,32.86-61.85a8,8,0,0,1,6.64,14.56c-6.43,2.93-20.62,12.36-23.12,38.91,26.55-2.5,36-16.69,38.91-23.12a8,8,0,1,1,14.56,6.64Z"/></svg>',ML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z"/></svg>',UL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z"/></svg>',ZL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M232,64a32,32,0,1,0-40,31v17a8,8,0,0,1-8,8H96a23.84,23.84,0,0,0-8,1.38V95a32,32,0,1,0-16,0v66a32,32,0,1,0,16,0V144a8,8,0,0,1,8-8h88a24,24,0,0,0,24-24V95A32.06,32.06,0,0,0,232,64ZM64,64A16,16,0,1,1,80,80,16,16,0,0,1,64,64ZM96,192a16,16,0,1,1-16-16A16,16,0,0,1,96,192ZM200,80a16,16,0,1,1,16-16A16,16,0,0,1,200,80Z"/></svg>',FL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.27,47,25.53a8,8,0,0,0,4.2,0c1-.26,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0Z"/></svg>',HL=':host{display:inline-flex;flex:none;width:1em;height:1em;vertical-align:-.125em}:host([size="sm"]){font-size:16px}:host([size="md"]){font-size:20px}:host([size="lg"]){font-size:24px}:host([size="xl"]){font-size:32px}tv-icon:not(:defined){display:inline-flex;flex:none;width:1em;height:1em;vertical-align:-.125em}tv-icon:not(:defined)[size=sm]{font-size:16px}tv-icon:not(:defined)[size=md]{font-size:20px}tv-icon:not(:defined)[size=lg]{font-size:24px}tv-icon:not(:defined)[size=xl]{font-size:32px}svg{width:100%;height:100%}:host([spinning])>svg{animation:tv-icon-spin 1s linear infinite}@keyframes tv-icon-spin{to{rotate:1turn}}@media (prefers-reduced-motion: reduce){:host([spinning])>svg{animation:none}}',zw=new CSSStyleSheet;zw.replaceSync(HL);const Nw={check:wD,close:bD,copy:_D,pin:SD,search:AD,add:kD,more:ED,settings:$D,expand:CD,collapse:TD,"collapse-up":RD,skills:ID,notification:xD,artifact:PD,spinner:DD,locked:LD,unpin:OD,back:zD,forward:ND,television:MD,calendar:UD,grid:ZD,hash:FD,delete:HD,edit:VD,link:BD,external:qD,download:jD,reload:WD,warning:GD,info:YD,file:KD,folder:JD,clock:XD,user:QD,upload:eL,star:tL,home:nL,send:rL,filter:iL,sort:sL,help:oL,chart:aL,image:lL,chat:cL,location:uL,play:hL,pause:dL,stop:fL,video:pL,music:mL,error:gL,email:vL,phone:yL,web:wL,tag:bL,bookmark:_L,table:SL,code:AL,group:kL,up:EL,down:$L,money:CL,bank:TL,card:RL,wallet:IL,gauge:xL,activity:PL,"trend-up":DL,"trend-down":LL,database:OL,server:zL,deploy:NL,list:ML,terminal:UL,branch:ZL,shield:FL};function VL(n){return n!==null&&Object.hasOwn(Nw,n)}var Fa,Fd;class Mw extends HTMLElement{constructor(){super(...arguments);g(this,Fa)}connectedCallback(){h(this,Fa,Fd).call(this)}attributeChangedCallback(){this.isConnected&&h(this,Fa,Fd).call(this)}}Fa=new WeakSet,Fd=function(){const t=this.shadowRoot??this.attachShadow({mode:"open"});t.adoptedStyleSheets=[zw],this.replaceChildren();const r=this.getAttribute("name");t.innerHTML=VL(r)?Nw[r]:""},$(Mw,"observedAttributes",["name"]);customElements.get("tv-icon")||customElements.define("tv-icon",Mw);const Uw=4,gs=200,vt=28,Kc=800,Gl="ease",Tg=.5,Ro=.5,BL="New channel",rs=".channel-group:not(.channel-group-withdrawal) .channel-row",qL=24;var rt,Ye,it,Xt,gi,_e,re,Mn,ut,Qt,ht,Ke,dt,hr,en,tn,zs,Ns,Ms,T,Hd,Zw,Fw,su,Hw,Vw,Sc,Bw,qw,jw,Ww,Vd,Bd,Vo,ou,au,lu,cu,Gw,qd,Yw,Kw,Ha,Jw,Xw,Bo,jd,Qw,e2,qo,Wd,Gd,Yd,t2,Ac,Va,Ba,qa,ja,n2,Kd,kc,Ec,jo,r2,Jd,uu;class jL extends At{constructor(){super(...arguments);g(this,T);g(this,rt,null);g(this,Ye,null);g(this,it,null);g(this,Xt,"");g(this,gi,!1);g(this,_e,null);g(this,re,null);g(this,Mn,!1);g(this,ut,null);g(this,Qt,null);g(this,ht,null);g(this,Ke,null);g(this,dt,null);g(this,hr,null);g(this,en,null);g(this,tn,null);g(this,zs,Rr());g(this,Ns,Rr());g(this,Ms,Rr());g(this,su,()=>{const t=a(this,rt),r=a(this,Ye);if(t===null||r===null||a(this,ut)!==null)return;const i={resultChannelId:null};d(this,ut,i),this.render(),t.createChannel(BL).then(s=>{i.resultChannelId=s.id,t.focusChannel(s.id).catch(()=>{}),a(this,ut)===i&&this.render()},()=>{a(this,ut)!==i||a(this,Qt)!==null||(d(this,ut,null),this.render())})});g(this,ou,t=>{d(this,Xt,t.currentTarget.value)});g(this,au,t=>{t.key==="Enter"?(t.preventDefault(),h(this,T,Vo).call(this,!0)):t.key==="Escape"&&(t.preventDefault(),h(this,T,Vo).call(this,!1))});g(this,lu,()=>{h(this,T,Vo).call(this,!0)});g(this,cu,t=>{t.preventDefault(),h(this,T,Vo).call(this,!0)});g(this,Ha,t=>{const r=a(this,re);if(r!==null){if(r.pointerId!==t.pointerId)return;t.preventDefault(),h(this,T,Bo).call(this,r,t);return}const i=a(this,_e);if(!(i===null||i.pointerId!==t.pointerId)){if(t.buttons===0){d(this,_e,null);return}Math.hypot(t.clientX-i.x,t.clientY-i.y)<=Uw||h(this,T,Jw).call(this,i,t)}});g(this,Va,t=>{var i;const r=a(this,re);if(r!==null&&r.pointerId===t.pointerId){if(r.completed)return;const s=r.captureTarget.hasPointerCapture(t.pointerId);h(this,T,Bo).call(this,r,t);const o=s&&r.placement.kind==="placement"?r.placement.operation:null,l=a(this,rt);if(o===null||l===null){h(this,T,jo).call(this,r,!1);return}r.completed=!0,h(this,T,qo).call(this,r),r.operation=[...o],l.setPinnedChannelIds([...o]).then(()=>{a(this,re)===r&&(r.operationResolved=!0,h(this,T,Kd).call(this,a(this,Ye)))},()=>{a(this,re)===r&&(r.operationResolved=!0,r.operationRejected=!0,h(this,T,kc).call(this,r))});return}((i=a(this,_e))==null?void 0:i.pointerId)===t.pointerId&&d(this,_e,null)});g(this,Ba,t=>{var r,i;((r=a(this,re))==null?void 0:r.pointerId)===t.pointerId&&!a(this,re).completed?h(this,T,Ec).call(this):((i=a(this,_e))==null?void 0:i.pointerId)===t.pointerId&&d(this,_e,null)});g(this,qa,t=>{const r=a(this,re);r===null||r.pointerId!==t.pointerId||r.completed||h(this,T,jo).call(this,r,!1)});g(this,ja,t=>{t.key!=="Escape"||a(this,re)===null||a(this,re).completed||(t.preventDefault(),h(this,T,Ec).call(this))});g(this,uu,t=>{const r=t.currentTarget;r.toggleAttribute("continues-start",r.scrollTop>0)})}connected(){window.addEventListener("pointermove",a(this,Ha)),window.addEventListener("pointerup",a(this,Va)),window.addEventListener("pointercancel",a(this,Ba)),window.addEventListener("lostpointercapture",a(this,qa)),window.addEventListener("keydown",a(this,ja))}template(t,r,i){var l;const s=a(this,Ye);d(this,rt,t),d(this,Ye,r),h(this,T,n2).call(this,r),h(this,T,Hw).call(this,r),h(this,T,jw).call(this,s,r),a(this,it)!==null&&!r.channels.some(({id:c})=>c===a(this,it))&&(d(this,it,null),d(this,Xt,"")),h(this,T,Kd).call(this,r);const o=h(this,T,Ww).call(this,Rg(r,(l=a(this,re))==null?void 0:l.source));return V`
104
- <nav
105
- class="sidebar"
106
- aria-label="Channels"
107
- ?dragging=${a(this,re)!==null}
108
- ${mn(a(this,zs))}
109
- >
110
- <header
111
- class="sidebar-titlebar"
112
- ?electron-draggable=${i}
113
- ></header>
114
-
115
- <div class="sidebar-body" @scroll=${a(this,uu)}>
116
- ${h(this,T,Hd).call(this,"Pinned",o.pinned)}
117
- ${h(this,T,Hd).call(this,"Recent",o.unpinned)}
118
- </div>
119
-
120
- <footer class="sidebar-foot">
121
- <button
122
- class="channel-create"
123
- full-row
124
- variant="ghost"
125
- type="button"
126
- ?disabled=${a(this,ut)!==null}
127
- @click=${a(this,su)}
128
- >
129
- <tv-icon name="add"></tv-icon>
130
- New channel
131
- </button>
132
- </footer>
133
- </nav>
134
- ${h(this,T,qw).call(this)}
135
- `}disconnected(){var t,r,i;window.removeEventListener("pointermove",a(this,Ha)),window.removeEventListener("pointerup",a(this,Va)),window.removeEventListener("pointercancel",a(this,Ba)),window.removeEventListener("lostpointercapture",a(this,qa)),window.removeEventListener("keydown",a(this,ja)),h(this,T,r2).call(this),(t=a(this,tn))==null||t.withdraw(),d(this,tn,null),(r=a(this,hr))==null||r.cancel(),d(this,hr,null),(i=a(this,en))==null||i.cancel(),d(this,en,null),d(this,rt,null),d(this,Ye,null),d(this,it,null),d(this,Xt,""),d(this,gi,!1),d(this,_e,null),d(this,Mn,!1),d(this,ut,null),d(this,Qt,null),d(this,ht,null),d(this,Ke,null),d(this,dt,null)}}rt=new WeakMap,Ye=new WeakMap,it=new WeakMap,Xt=new WeakMap,gi=new WeakMap,_e=new WeakMap,re=new WeakMap,Mn=new WeakMap,ut=new WeakMap,Qt=new WeakMap,ht=new WeakMap,Ke=new WeakMap,dt=new WeakMap,hr=new WeakMap,en=new WeakMap,tn=new WeakMap,zs=new WeakMap,Ns=new WeakMap,Ms=new WeakMap,T=new WeakSet,Hd=function(t,r){var m;const i=t==="Pinned"?"pinned":"unpinned",s=a(this,re);if(s===null&&r.length===0)return null;const o=s===null?void 0:r.find(({channel:v})=>v.id===s.channelId),l=s===null?r:r.filter(({channel:v})=>v.id!==s.channelId),c=(s==null?void 0:s.placement.kind)==="placement"&&((m=s.placement.placeholder)==null?void 0:m.side)===i?s.placement.placeholder:null,u=l.map(v=>({kind:"row",row:v}));c!==null&&u.splice(c.index,0,{kind:"placeholder",key:`channel-placeholder-${i}`}),o!==void 0&&u.push({kind:"row",row:o});const f=s!==null&&l.length===0&&c===null;return V`
136
- <section
137
- class="channel-group"
138
- data-channel-side=${i}
139
- ?drag-collapsed=${f}
140
- >
141
- <h2 class="channel-group-label">${t}</h2>
142
- ${Gc(u,v=>v.kind==="row"?v.row.channel.id:v.key,v=>v.kind==="row"?h(this,T,Zw).call(this,v.row):V`
143
- <span
144
- class="channel-placeholder"
145
- aria-hidden="true"
146
- data-channel-side=${i}
147
- data-channel-index=${(c==null?void 0:c.index)??0}
148
- style=${Yc({height:`${(s==null?void 0:s.rowHeight)??0}px`})}
149
- ></span>
150
- `)}
151
- </section>
152
- `},Zw=function(t){var u;const{channel:r,pinned:i,selected:s}=t,o=((u=a(this,re))==null?void 0:u.channelId)===r.id?a(this,re):null,l=o!==null&&i&&o.placement.kind==="placement"&&o.placement.side==="unpinned",c=r.id===a(this,it);return V`
153
- <div
154
- class="channel-row"
155
- data-channel-id=${r.id}
156
- ?dragged=${o!==null}
157
- ?unpinning=${l}
158
- style=${Yc(o===null?{}:{left:`${o.currentX-o.grip.previewOffsetX}px`,top:`${o.currentY-o.grip.offsetY}px`,width:`${o.rowWidth}px`,height:`${o.rowHeight}px`})}
159
- >
160
- ${l?V`
161
- <span class="channel-drag-action" aria-hidden="true">
162
- <tv-icon name="unpin"></tv-icon>
163
- Unpin
164
- </span>
165
- `:null}
166
- ${c?V`
167
- <input
168
- class="channel-rename"
169
- aria-label="Channel name"
170
- .value=${a(this,Xt)}
171
- @input=${a(this,ou)}
172
- @keydown=${a(this,au)}
173
- @blur=${a(this,lu)}
174
- ${mn(a(this,Ns))}
175
- />
176
- <button
177
- class="channel-rename-commit"
178
- variant="ghost"
179
- icon-only
180
- size="sm"
181
- type="button"
182
- tabindex="-1"
183
- aria-label="Rename"
184
- @pointerdown=${a(this,cu)}
185
- >
186
- <tv-icon name="check"></tv-icon>
187
- </button>
188
- `:V`
189
- <button
190
- class="channel"
191
- type="button"
192
- aria-current=${s?"true":ue}
193
- @pointerdown=${f=>h(this,T,Yw).call(this,r.id,f)}
194
- @click=${f=>h(this,T,Kw).call(this,r.id,f)}
195
- >
196
- ${r.name}
197
- </button>
198
- ${Lw(h(this,T,Fw).call(this,t),{trigger:f=>V`
199
- <button
200
- class="channel-menu-trigger"
201
- variant="ghost"
202
- icon-only
203
- size="sm"
204
- type="button"
205
- tabindex="-1"
206
- popovertarget=${f}
207
- aria-label=${`${r.name} menu`}
208
- >
209
- <tv-icon name="expand"></tv-icon>
210
- </button>
211
- `})}
212
- `}
213
- </div>
214
- `},Fw=function(t){const{channel:r,pinned:i}=t;return[{label:"Rename",action:()=>h(this,T,Bd).call(this,r.id)},{label:i?"Unpin":"Pin",action:()=>h(this,T,Gw).call(this,r.id,!i)},{separator:!0},{label:"Delete",destructive:!0,action:()=>h(this,T,Vw).call(this,r.id,r.name)}]},su=new WeakMap,Hw=function(t){const r=a(this,ut);if(r===null||a(this,Qt)!==null||r.resultChannelId===null)return;const i=t.channels.find(({id:s})=>s===r.resultChannelId);i!==void 0&&(d(this,Qt,i.id),queueMicrotask(()=>h(this,T,Vd).call(this,"create",i.id)))},Vw=function(t,r){var s,o,l;if(a(this,ht)!==null||a(this,Ke)!==null)return;h(this,T,qd).call(this,t),d(this,ht,{channelId:t,name:r}),this.render();const i=(s=a(this,Ms).value)==null?void 0:s.closest("dialog");i instanceof HTMLDialogElement&&(d(this,tn,Vu(i,()=>{h(this,T,Sc).call(this)})),(l=(o=a(this,Ms).value)==null?void 0:o.querySelector(".dialog-actions button"))==null||l.focus())},Sc=function(){const t=a(this,tn);d(this,tn,null),d(this,ht,null),t==null||t.withdraw(),this.render()},Bw=function(){const t=a(this,rt),r=a(this,ht);t===null||r===null||a(this,Ke)!==null||(d(this,Ke,r.channelId),h(this,T,Sc).call(this),t.deleteChannel(r.channelId).catch(()=>{a(this,Ke)!==r.channelId||a(this,dt)!==null||(d(this,Ke,null),this.render())}))},qw=function(){const t=a(this,ht);return t===null?null:Hu(V`
215
- <div
216
- class="dialog-alert channel-delete-alert"
217
- role="alertdialog"
218
- aria-labelledby="channel-delete-title"
219
- aria-describedby="channel-delete-body"
220
- ${mn(a(this,Ms))}
221
- >
222
- <h2 id="channel-delete-title">Delete “${t.name}”?</h2>
223
- <p id="channel-delete-body">
224
- This will permanently delete this channel from Television.
225
- </p>
226
- <div class="dialog-actions">
227
- <button type="button" autofocus @click=${()=>h(this,T,Sc).call(this)}>
228
- Cancel
229
- </button>
230
- <button type="button" variant="danger" @click=${()=>h(this,T,Bw).call(this)}>
231
- Delete
232
- </button>
233
- </div>
234
- </div>
235
- `,{overlay:!0})},jw=function(t,r){var f,m;a(this,ht)!==null&&!r.channels.some(({id:v})=>{var y;return v===((y=a(this,ht))==null?void 0:y.channelId)})&&((f=a(this,tn))==null||f.withdraw(),d(this,tn,null),d(this,ht,null));const i=a(this,dt);if(i!==null&&r.channels.some(({id:v})=>v===i.row.channel.id)){(m=a(this,en))==null||m.cancel(),d(this,en,null),d(this,dt,null),d(this,Ke,null);return}const s=a(this,Ke);if(s===null||i!==null||r.channels.some(({id:v})=>v===s))return;if(t===null){d(this,Ke,null);return}const o=Rg(t),l=o.pinned.findIndex(({channel:v})=>v.id===s),c=o.unpinned.findIndex(({channel:v})=>v.id===s),u=l>=0?o.pinned[l]:o.unpinned[c];if(u===void 0){d(this,Ke,null);return}d(this,dt,{row:{...u,selected:!1},side:l>=0?"pinned":"unpinned",index:l>=0?l:c}),queueMicrotask(()=>h(this,T,Vd).call(this,"delete",s))},Ww=function(t){const r=a(this,dt);if(r===null)return t;const i=[...t[r.side]];return i.some(({channel:s})=>s.id===r.row.channel.id)||i.splice(r.index,0,r.row),{...t,[r.side]:i}},Vd=function(t,r){var u,f;if(t==="create"&&a(this,Qt)!==r||t==="delete"&&((u=a(this,dt))==null?void 0:u.row.channel.id)!==r)return;const i=[...((f=a(this,zs).value)==null?void 0:f.querySelectorAll(rs))??[]].find(m=>m.dataset.channelId===r);if(i===void 0)return;const s=()=>{var m;if(t==="create"){if(a(this,Qt)!==r)return;d(this,Qt,null),d(this,ut,null),h(this,T,Bd).call(this,r)}else{if(((m=a(this,dt))==null?void 0:m.row.channel.id)!==r)return;d(this,dt,null),d(this,Ke,null),this.render()}};if(typeof i.animate!="function"||matchMedia("(prefers-reduced-motion: reduce)").matches){s();return}const o=i.getBoundingClientRect().height,l=t==="create"?[{maxHeight:"0px",opacity:0},{maxHeight:`${o}px`,opacity:1}]:[{maxHeight:`${o}px`,opacity:1},{maxHeight:"0px",opacity:0}],c=i.animate(l,{duration:gs,easing:Gl});t==="create"?d(this,hr,c):d(this,en,c),c.finished.then(()=>{t==="create"&&a(this,hr)!==c||t==="delete"&&a(this,en)!==c||(t==="create"?d(this,hr,null):d(this,en,null),s())},()=>{})},Bd=function(t){var i;const r=(i=a(this,Ye))==null?void 0:i.channels.find(({id:s})=>s===t);r!==void 0&&(d(this,it,t),d(this,Xt,r.name),d(this,_e,null),this.render(),queueMicrotask(()=>{var s,o;a(this,it)===t&&((s=a(this,Ns).value)==null||s.focus(),(o=a(this,Ns).value)==null||o.select())}))},Vo=function(t){if(a(this,it)===null||a(this,gi)||a(this,rt)===null)return;d(this,gi,!0);const r=a(this,it),i=a(this,Xt).trim();d(this,it,null),d(this,Xt,""),this.render(),d(this,gi,!1),t&&i.length>0&&a(this,rt).renameChannel(r,i).catch(()=>{})},ou=new WeakMap,au=new WeakMap,lu=new WeakMap,cu=new WeakMap,Gw=function(t,r){if(a(this,rt)===null||a(this,Ye)===null)return;h(this,T,qd).call(this,t);const i=a(this,Ye).display.pinnedChannelIds,s=r?[...i.filter(o=>o!==t),t]:i.filter(o=>o!==t);a(this,rt).setPinnedChannelIds(s).catch(()=>{})},qd=function(t){var s;const r=[...((s=a(this,zs).value)==null?void 0:s.querySelectorAll(rs))??[]].find(o=>o.dataset.channelId===t),i=r==null?void 0:r.querySelector(".menu");i&&typeof i.hidePopover=="function"&&i.matches(":popover-open")&&i.hidePopover()},Yw=function(t,r){if(r.button!==0||a(this,_e)!==null||a(this,re)!==null||a(this,Ye)===null)return;d(this,Mn,!1);const s=r.currentTarget.closest(".sidebar");if(s===null)return;const o=Wo(a(this,Ye));!o.pinnedChannelIds.includes(t)&&!o.unpinnedChannelIds.includes(t)||d(this,_e,{channelId:t,pointerId:r.pointerId,x:r.clientX,y:r.clientY,source:{channelId:t,...o},captureTarget:s})},Kw=function(t,r){var i;if(r.detail!==0&&a(this,Mn)){d(this,Mn,!1);return}d(this,Mn,!1),a(this,re)===null&&((i=a(this,rt))==null||i.focusChannel(t).catch(()=>{}))},Ha=new WeakMap,Jw=function(t,r){const i=[...t.captureTarget.querySelectorAll(rs)].find(m=>m.dataset.channelId===t.channelId);if(i===void 0){d(this,_e,null);return}const s=i.getBoundingClientRect(),o=h(this,T,Xw).call(this,i),l=GL({wideRow:s,compactPreviewWidth:o,pointer:{x:t.x,y:t.y}}),c=t.captureTarget.querySelector('[data-channel-side="pinned"]'),u=t.captureTarget.querySelector('[data-channel-side="unpinned"]');try{t.captureTarget.setPointerCapture(t.pointerId)}catch{d(this,_e,null);return}t.captureTarget.style.setProperty("--channel-sidebar-drag-grip-x",`${l.previewOffsetX}px`),t.captureTarget.style.setProperty("--channel-sidebar-drag-grip-y",`${l.offsetY}px`),t.captureTarget.style.setProperty("--channel-sidebar-drag-grip-correction-x",`${l.correctionX}px`),d(this,Mn,!0);const f={...t,placement:{kind:"invalidated"},currentX:r.clientX,currentY:r.clientY,grip:l,rowWidth:o,rowHeight:s.height,originPinnedContentBottom:(c==null?void 0:c.getBoundingClientRect().bottom)??null,originUnpinnedGroupTop:(u==null?void 0:u.getBoundingClientRect().top)??null,displacementAnimations:new Set,edgeScrollFrame:0,edgeScrollTimestamp:null,edgeScrollRemainder:0,completed:!1,operation:null,operationResolved:!1,operationRejected:!1,restorationQueued:!1};d(this,_e,null),d(this,re,f),h(this,T,Bo).call(this,f,r)},Xw=function(t){const r=t.cloneNode(!0);for(const s of[r,...r.querySelectorAll("[id], [popovertarget]")])s.removeAttribute("id"),s.removeAttribute("popovertarget");r.setAttribute("dragged",""),r.style.position="fixed",r.style.left="-10000px",r.style.top="-10000px",r.style.visibility="hidden",r.style.pointerEvents="none",document.body.append(r);const i=r.getBoundingClientRect().width;return r.remove(),i},Bo=function(t,r,i=!0){if(t.completed)return;const s=a(this,Ye);if(s===null){t.placement={kind:"invalidated"};return}t.currentX=r.clientX,t.currentY=r.clientY;const o=Wo(s),l=new Map([...t.captureTarget.querySelectorAll(rs)].map(G=>[G.dataset.channelId,G])),c=o.pinnedChannelIds.filter(G=>G!==t.channelId).flatMap(G=>{const F=l.get(G);if(F===void 0)return[];const W=F.getBoundingClientRect();return[{channelId:G,top:W.top,bottom:W.bottom}]}),u=t.captureTarget.querySelector('.channel-group[data-channel-side="pinned"]:not([drag-collapsed]):not(.channel-group-withdrawal)'),f=t.captureTarget.querySelector('.channel-group[data-channel-side="unpinned"]:not([drag-collapsed]):not(.channel-group-withdrawal)'),m=t.captureTarget.querySelector(".channel-group:not(.channel-group-withdrawal) .channel-placeholder"),v=m==null?void 0:m.getBoundingClientRect(),y=m==null?void 0:m.dataset.channelSide,k=Number(m==null?void 0:m.dataset.channelIndex),S=t.captureTarget.getBoundingClientRect(),x=uD({source:t.source,current:o,pointer:{x:r.clientX,y:r.clientY},geometry:{sidebar:{left:S.left,right:S.right,top:S.top,bottom:S.bottom},pinnedRows:c,unpinnedGroupTop:(f==null?void 0:f.getBoundingClientRect().top)??t.originUnpinnedGroupTop,pinnedContentBottom:(u==null?void 0:u.getBoundingClientRect().bottom)??t.originPinnedContentBottom,placeholder:v!==void 0&&(y==="pinned"||y==="unpinned")&&Number.isInteger(k)?{side:y,index:k,top:v.top,bottom:v.bottom}:null}}),M=!YL(t.placement,x),Z=M?h(this,T,Gd).call(this,t):null;t.placement=x,(M||i)&&h(this,T,Yd).call(this,t,Z,!1),h(this,T,jd).call(this,t)},jd=function(t){const r=t.captureTarget.querySelector(".sidebar-body"),i=r?h(this,T,Wd).call(this,r,t.currentY):0,s=r?Math.max(0,r.scrollHeight-r.clientHeight):0,o=i<0?((r==null?void 0:r.scrollTop)??0)<=Tg:((r==null?void 0:r.scrollTop)??0)>=s-Tg;if(t.completed||i===0||s===0||o||typeof requestAnimationFrame!="function"){h(this,T,qo).call(this,t);return}t.edgeScrollFrame===0&&(t.edgeScrollFrame=requestAnimationFrame(l=>{h(this,T,Qw).call(this,t,l)}))},Qw=function(t,r){if(t.edgeScrollFrame=0,a(this,re)!==t||t.completed){t.edgeScrollTimestamp=null;return}const i=t.captureTarget.querySelector(".sidebar-body");if(i===null){t.edgeScrollTimestamp=null;return}const s=h(this,T,Wd).call(this,i,t.currentY),o=t.edgeScrollTimestamp;if(t.edgeScrollTimestamp=r,s!==0&&o!==null){const l=Math.max(0,r-o)/1e3,c=Math.max(0,i.scrollHeight-i.clientHeight),u=i.scrollTop,f=s*l+t.edgeScrollRemainder,m=Math.max(0,Math.min(c,u+f));i.scrollTop=m;const v=i.scrollTop-u;if(t.edgeScrollRemainder=m===0||m===c?0:f-v,v!==0){i.toggleAttribute("continues-start",i.scrollTop>0),h(this,T,e2).call(this,t);return}}h(this,T,jd).call(this,t)},e2=function(t){h(this,T,Bo).call(this,t,{clientX:t.currentX,clientY:t.currentY},!1)},qo=function(t){t.edgeScrollFrame!==0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(t.edgeScrollFrame),t.edgeScrollFrame=0,t.edgeScrollTimestamp=null,t.edgeScrollRemainder=0},Wd=function(t,r){const i=t.getBoundingClientRect();return r>=i.top&&r<i.top+vt?-Kc*(i.top+vt-r)/vt:r>i.bottom-vt&&r<=i.bottom?Kc*(r-(i.bottom-vt))/vt:0},Gd=function(t){var s;for(const o of t.displacementAnimations)o.cancel();t.displacementAnimations.clear();const r=new Map;for(const o of t.captureTarget.querySelectorAll(rs)){const l=o.dataset.channelId;if(l===void 0)continue;const c=o.getBoundingClientRect();r.set(l,{left:c.left,top:c.top})}const i=new Map;for(const o of t.captureTarget.querySelectorAll(".channel-group:not(.channel-group-withdrawal)")){const l=o.dataset.channelSide;if(l!=="pinned"&&l!=="unpinned")continue;const c=o.getBoundingClientRect(),u=o.cloneNode(!0);for(const f of[u,...u.querySelectorAll("[id], [popovertarget]")])f.removeAttribute("id"),f.removeAttribute("popovertarget");(s=u.querySelector(".channel-row[dragged]"))==null||s.remove(),u.classList.add("channel-group-withdrawal"),u.setAttribute("aria-hidden","true"),u.removeAttribute("drag-collapsed"),i.set(l,{left:c.left,top:c.top,width:c.width,height:o.hasAttribute("drag-collapsed")?0:c.height,withdrawal:u})}return{rows:r,groups:i}},Yd=function(t,r,i){const s=t.captureTarget.querySelector(".sidebar-body"),o=(s==null?void 0:s.scrollTop)??0;this.render(),queueMicrotask(()=>{const l=t.captureTarget.querySelector(".sidebar-body");l!==null&&(l.scrollTop=o),r!==null&&h(this,T,t2).call(this,t,r,i)})},t2=function(t,r,i){if(!(typeof HTMLElement.prototype.animate!="function"||matchMedia("(prefers-reduced-motion: reduce)").matches)){for(const s of t.captureTarget.querySelectorAll(rs)){const o=s.dataset.channelId;if(o===void 0||!i&&o===t.channelId)continue;const l=r.rows.get(o);if(l===void 0)continue;const c=s.getBoundingClientRect(),u=l.left-c.left,f=l.top-c.top;Math.hypot(u,f)<=Ro||h(this,T,Ac).call(this,t,s.animate({translate:[`${u}px ${f}px`,"0px 0px"]},{duration:gs,easing:Gl}))}for(const s of t.captureTarget.querySelectorAll(".channel-group:not(.channel-group-withdrawal)")){const o=s.dataset.channelSide;if(o!=="pinned"&&o!=="unpinned")continue;const l=r.groups.get(o),c=s.getBoundingClientRect(),u=s.hasAttribute("drag-collapsed")?0:c.height;if(l!==void 0){if(l.height<=Ro&&u>Ro)h(this,T,Ac).call(this,t,s.animate([{opacity:0,translate:`0px -${u}px`},{opacity:1,translate:"0px 0px"}],{duration:gs,easing:Gl}));else if(l.height>Ro&&u<=Ro&&l.withdrawal.childElementCount>0){const f=l.withdrawal;f.style.left=`${l.left}px`,f.style.top=`${l.top}px`,f.style.width=`${l.width}px`,f.style.height=`${l.height}px`,t.captureTarget.append(f);const m=f.animate([{opacity:1,translate:"0px 0px"},{opacity:0,translate:`0px -${l.height}px`}],{duration:gs,easing:Gl});h(this,T,Ac).call(this,t,m),m.finished.finally(()=>f.remove()).catch(()=>{})}}}}},Ac=function(t,r){t.displacementAnimations.add(r),r.finished.finally(()=>{t.displacementAnimations.delete(r)}).catch(()=>{})},Va=new WeakMap,Ba=new WeakMap,qa=new WeakMap,ja=new WeakMap,n2=function(t){const r=Wo(t);a(this,re)!==null&&!a(this,re).completed&&!Ig(a(this,re).source,r)&&h(this,T,Ec).call(this),a(this,_e)!==null&&!Ig(a(this,_e).source,r)&&d(this,_e,null)},Kd=function(t){const r=a(this,re);if(t===null||r===null||!r.completed||!r.operationResolved||r.restorationQueued)return;if(r.operationRejected){h(this,T,kc).call(this,r);return}const i=r.operation;i!==null&&Jc(Wo(t).pinnedChannelIds,i)&&h(this,T,kc).call(this,r)},kc=function(t){a(this,re)!==t||t.restorationQueued||(t.restorationQueued=!0,queueMicrotask(()=>{a(this,re)===t&&h(this,T,jo).call(this,t,!1)}))},Ec=function(){d(this,_e,null);const t=a(this,re);t!==null&&h(this,T,jo).call(this,t,!0)},jo=function(t,r){if(a(this,re)!==t)return;h(this,T,qo).call(this,t);const i=h(this,T,Gd).call(this,t);d(this,re,null),h(this,T,Jd).call(this,t),r&&t.captureTarget.hasPointerCapture(t.pointerId)&&t.captureTarget.releasePointerCapture(t.pointerId),h(this,T,Yd).call(this,t,i,!0)},r2=function(){d(this,_e,null);const t=a(this,re);if(d(this,re,null),t!==null){h(this,T,qo).call(this,t);for(const r of t.displacementAnimations)r.cancel();t.displacementAnimations.clear(),h(this,T,Jd).call(this,t),t.captureTarget.hasPointerCapture(t.pointerId)&&t.captureTarget.releasePointerCapture(t.pointerId)}},Jd=function(t){t.captureTarget.style.removeProperty("--channel-sidebar-drag-grip-x"),t.captureTarget.style.removeProperty("--channel-sidebar-drag-grip-y"),t.captureTarget.style.removeProperty("--channel-sidebar-drag-grip-correction-x")},uu=new WeakMap;const WL=kt(jL);function GL(n){const e=Math.max(0,n.wideRow.right-n.wideRow.left),t=Math.max(0,n.wideRow.bottom-n.wideRow.top),r=xg(n.pointer.x-n.wideRow.left,0,e),i=Math.min(r,Math.max(0,n.compactPreviewWidth-qL));return{wideOffsetX:r,previewOffsetX:i,correctionX:r-i,offsetY:xg(n.pointer.y-n.wideRow.top,0,t)}}function Rg(n,e=Wo(n)){var l,c;const t=new Map(n.channels.map(u=>[u.id,u])),r=e.pinnedChannelIds.flatMap(u=>{const f=t.get(u);return f===void 0?[]:[f]}),i=e.unpinnedChannelIds.flatMap(u=>{const f=t.get(u);return f===void 0?[]:[f]}),s=n.display.focusedChannelId,o=s!==null&&t.has(s)?s:((l=r[0])==null?void 0:l.id)??((c=i[0])==null?void 0:c.id)??null;return{pinned:r.map(u=>({channel:u,pinned:!0,selected:u.id===o})),unpinned:i.map(u=>({channel:u,pinned:!1,selected:u.id===o}))}}function Wo(n){const e=new Set(n.channels.map(({id:s})=>s)),t=n.display.pinnedChannelIds.filter(s=>e.has(s)),r=new Set(t),i=n.channels.filter(({id:s})=>!r.has(s)).map(({id:s})=>s).sort((s,o)=>o.localeCompare(s));return{pinnedChannelIds:t,unpinnedChannelIds:i}}function Ig(n,e){return Jc(n.pinnedChannelIds,e.pinnedChannelIds)&&Jc(n.unpinnedChannelIds,e.unpinnedChannelIds)}function Jc(n,e){return n.length===e.length&&n.every((t,r)=>t===e[r])}function YL(n,e){var t,r,i,s;return n.kind!==e.kind?!1:n.kind==="invalidated"||e.kind==="invalidated"?!0:n.side===e.side&&((t=n.placeholder)==null?void 0:t.side)===((r=e.placeholder)==null?void 0:r.side)&&((i=n.placeholder)==null?void 0:i.index)===((s=e.placeholder)==null?void 0:s.index)&&n.operation===null==(e.operation===null)&&(n.operation===null||e.operation===null||Jc(n.operation,e.operation))}function xg(n,e,t){return Math.max(e,Math.min(t,n))}const KL=404,JL="/views/url-unsupported/";function $c(n){const e=bd(n.artifact,{electron:n.electron});let t;if(n.currentURL===null){const r=n.viewURL??e.viewURL;e.renderer==="markdown"?t={renderer:"markdown",viewURL:r,contentURL:n.contentURL??e.contentURL}:e.renderer==="url-webview"&&e.contentURL!==null?t={renderer:"url-webview",viewURL:r,contentURL:n.contentURL??e.contentURL}:t={...e,viewURL:r}}else Pg(n.currentURL)&&!n.electron?t=Rn(n.currentURL)?{renderer:"proxy-iframe",viewURL:n.currentURL,contentURL:null}:{renderer:"proxy-iframe",viewURL:JL,contentURL:null}:Pg(n.currentURL)?t={renderer:"url-webview",viewURL:n.currentURL,contentURL:null}:t={renderer:n.electron?"url-webview":"proxy-iframe",viewURL:eO(n.currentURL,n.viewURL),contentURL:null};return n.frameSrcOverride?{...t,viewURL:n.frameSrcOverride}:t}var Ne,ft,Us,vi,yi,Rt,wi,Zs,pt,Fs,Hs,nn,dr,fr,bi,B,Cc,i2,s2,Xd,o2,rn,Tc,Go,Qd,a2,ef,tf,Wr;class XL extends At{constructor(){super(...arguments);g(this,B);g(this,Ne,null);g(this,ft,null);g(this,Us,"");g(this,vi,()=>{});g(this,yi,()=>{});g(this,Rt,null);g(this,wi,null);g(this,Zs,null);g(this,pt,null);g(this,Fs,null);g(this,Hs,null);g(this,nn,null);g(this,dr,null);g(this,fr,null);g(this,bi,null);g(this,rn,()=>{!a(this,ft)||a(this,ft)!==a(this,Rt)||a(this,vi).call(this,!0)})}get currentFrame(){return a(this,ft)}connected(){h(this,B,Tc).call(this),h(this,B,Qd).call(this)}disconnected(){h(this,B,Go).call(this),h(this,B,Wr).call(this)}template(t,r,i=()=>{}){return d(this,vi,r),d(this,yi,i),t(this),a(this,Us)}assignSource(t){const r=a(this,Ne),i=r?!tO(r.artifact,t.artifact):!0;((r==null?void 0:r.artifact.id)!==t.artifact.id||(r==null?void 0:r.artifact.kind)==="path"&&t.artifact.kind==="path"&&r.artifact.path!==t.artifact.path)&&d(this,bi,null),i&&(d(this,nn,null),a(this,pt)&&(a(this,pt).content=""),d(this,dr,null),d(this,fr,null)),d(this,Ne,t),h(this,B,Cc).call(this)}handleArtifactContentChanged(t){const r=a(this,Ne);return t!==(r==null?void 0:r.artifact.id)||!a(this,pt)&&!h(this,B,tf).call(this)?!1:(h(this,B,ef).call(this),!0)}refreshFrameLoadState(){h(this,B,Tc).call(this)}}Ne=new WeakMap,ft=new WeakMap,Us=new WeakMap,vi=new WeakMap,yi=new WeakMap,Rt=new WeakMap,wi=new WeakMap,Zs=new WeakMap,pt=new WeakMap,Fs=new WeakMap,Hs=new WeakMap,nn=new WeakMap,dr=new WeakMap,fr=new WeakMap,bi=new WeakMap,B=new WeakSet,Cc=function(){const t=a(this,Ne);if(!t)return;if(t.artifact.kind==="path"&&h(this,B,tf).call(this)){h(this,B,o2).call(this,t.artifact);return}const r=$c(t),i=h(this,B,i2).call(this,r.renderer);h(this,B,s2).call(this,i,r),h(this,B,Xd).call(this,i),h(this,B,Tc).call(this),h(this,B,Qd).call(this)},i2=function(t){var s;const r=t==="url-webview"?"webview":"iframe";if(((s=a(this,ft))==null?void 0:s.tagName.toLowerCase())===r)return a(this,ft);h(this,B,Go).call(this),h(this,B,Wr).call(this);const i=document.createElement(r);return i.className="artifact-content",r==="webview"&&i.setAttribute("allowpopups",""),d(this,ft,i),i},s2=function(t,r){t.getAttribute("src")!==r.viewURL&&(a(this,yi).call(this,null),a(this,yi).call(this,t),t.setAttribute("src",r.viewURL)),r.contentURL===null?delete t.dataset.contentUrl:t.dataset.contentUrl=r.contentURL},Xd=function(t){a(this,Us)!==t&&(d(this,Us,t),this.render(t))},o2=function(t){a(this,yi).call(this,null),h(this,B,Go).call(this),h(this,B,Wr).call(this),d(this,ft,null),a(this,vi).call(this,!1),h(this,B,Xd).call(this,V`
236
- <section class="artifact-missing artifact-content" role="status" aria-label="Artifact file not found">
237
- <div class="artifact-missing-wrapper">
238
- <h1>${Pb()}</h1>
239
- <p>${Db()}</p>
240
- <section class="artifact-missing-path" aria-label="Missing artifact path">
241
- <p class="artifact-missing-path-label">Registered path:</p>
242
- <p><code>${t.path}</code></p>
243
- </section>
244
- <p>${Lb()}</p>
245
- </div>
246
- </section>
247
- `)},rn=new WeakMap,Tc=function(){var s;const t=a(this,ft),r=t?`${t.tagName.toLowerCase()}:${t.getAttribute("src")??""}:${t.dataset.contentUrl??""}`:null;if(t&&t===a(this,Rt)&&r===a(this,wi)||(h(this,B,Go).call(this),a(this,vi).call(this,!1),!t||!r||!this.isConnected))return;if(d(this,Rt,t),d(this,wi,r),t.tagName.toLowerCase()==="webview"){t.addEventListener("did-finish-load",a(this,rn)),t.addEventListener("did-fail-load",a(this,rn));return}t.addEventListener("load",a(this,rn));const i=t;try{i.isConnected&&((s=i.contentDocument)==null?void 0:s.readyState)==="complete"&&a(this,rn).call(this)}catch{}},Go=function(){if(!a(this,Rt)){d(this,wi,null);return}a(this,Rt).removeEventListener("load",a(this,rn)),a(this,Rt).removeEventListener("did-finish-load",a(this,rn)),a(this,Rt).removeEventListener("did-fail-load",a(this,rn)),d(this,Rt,null),d(this,wi,null)},Qd=function(){const t=a(this,Ne),r=a(this,ft),i=(r==null?void 0:r.dataset.contentUrl)??null,s=(t==null?void 0:t.artifact.id)??null;if(!t||!r||!i||!s){h(this,B,Wr).call(this,{clearContent:!0});return}if(r!==a(this,Zs)||s!==a(this,Hs)){h(this,B,Wr).call(this),d(this,Zs,r),d(this,Fs,i),d(this,Hs,s);const o=r.tagName.toLowerCase()==="webview"?new z5(r):new O5(r);d(this,pt,o),o.handleUpdateContent(async l=>{const c=a(this,Ne),u=c==null?void 0:c.application;if(!c||!u)throw new Error("No markdown artifact selected");await u.writeMarkdown(c.artifact.id,l),d(this,nn,l),a(this,pt)===o&&(o.content=l)}),a(this,nn)!==null&&(o.content=a(this,nn))}else d(this,Fs,i);h(this,B,a2).call(this)},a2=function(){const t=a(this,Ne),r=t==null?void 0:t.application;!t||!r||!a(this,pt)||a(this,dr)===t.artifact.id&&a(this,fr)===r||(d(this,dr,t.artifact.id),d(this,fr,r),h(this,B,ef).call(this))},ef=async function(){var s,o;const t=a(this,Ne),r=t==null?void 0:t.application;if(!t||!r)return;const i=t.artifact.id;try{const l=await r.readMarkdown(i);if(((s=a(this,Ne))==null?void 0:s.artifact.id)!==i||a(this,Ne).application!==r)return;d(this,bi,null),d(this,nn,l);const c=a(this,pt);if(!c){h(this,B,Cc).call(this);return}c.content=l}catch(l){if(((o=a(this,Ne))==null?void 0:o.artifact.id)!==i||a(this,Ne).application!==r)return;if(l instanceof go&&l.status===KL){d(this,bi,i),d(this,nn,null),h(this,B,Wr).call(this),h(this,B,Cc).call(this);return}d(this,dr,null),d(this,fr,null)}},tf=function(){var r;const t=(r=a(this,Ne))==null?void 0:r.artifact;return a(this,bi)===(t==null?void 0:t.id)&&t.kind==="path"&&ly(t.path)},Wr=function(t={}){var r;(r=a(this,pt))==null||r.dispose(),d(this,pt,null),d(this,Zs,null),d(this,Fs,null),d(this,Hs,null),d(this,dr,null),d(this,fr,null),t.clearContent&&d(this,nn,null)};const QL=kt(XL);function Pg(n){return n.startsWith("http://")||n.startsWith("https://")}function eO(n,e){if(!n.startsWith("/")||!e)return n;try{return new URL(n,e).toString()}catch{return n}}function tO(n,e){return n.id!==e.id||n.kind!==e.kind?!1:n.kind==="path"&&e.kind==="path"?n.path===e.path:n.kind==="url"&&e.kind==="url"?n.url===e.url:!0}var Wa,Vs,sn,Un,pr,mr,gr,Ga,Ya,Ka,Ja,at,nf,Rc,Ic;class nO{constructor(e,t=()=>{}){g(this,at);g(this,Wa);g(this,Vs);g(this,sn,null);g(this,Un,null);g(this,pr,null);g(this,mr,null);g(this,gr,!1);g(this,Ga,e=>{const t=Lg(e.data);if(!t)return;const r=a(this,pr);if(!r||r.tagName.toLowerCase()!=="iframe"||!r.isConnected)return;const i=r,s=i.contentWindow;if(s===null)return;const o=t.type==="leaving",l=t.type==="navigation-request"&&t.native===!0&&t.sameDocument!==!0,c=s===e.source,u=(o||l)&&a(this,Un)!==null&&a(this,Un)===e.source,f=o&&iO(i)===e.origin;!c&&!u&&!f||h(this,at,nf).call(this,t,i,{send:m=>{var v;return(v=i.contentWindow)==null?void 0:v.postMessage(m,"*")}})});g(this,Ya,e=>{var s;const t=e.detail??e;if(!t||t.channel!==Dg)return;const r=Lg((s=t.args)==null?void 0:s[0]),i=a(this,mr);!r||!i||h(this,at,nf).call(this,r,i,{send:o=>{var l;return(l=i.send)==null?void 0:l.call(i,Dg,o)}})});g(this,Ka,e=>{const t=Og(e);t.isMainFrame===!0&&t.isInPlace!==!0&&this.reset()});g(this,Ja,e=>{Og(e).isMainFrame!==!1&&this.reset()});d(this,Wa,e),d(this,Vs,t)}get currentGuid(){return a(this,sn)}get lifecycleWindow(){return a(this,Un)}get trustState(){return{currentGuid:a(this,sn),lifecycleWindow:a(this,Un)}}connect(){a(this,gr)||(d(this,gr,!0),window.addEventListener("message",a(this,Ga)),h(this,at,Rc).call(this))}disconnect(){a(this,gr)&&(window.removeEventListener("message",a(this,Ga)),d(this,gr,!1),h(this,at,Ic).call(this))}reset(){d(this,sn,null),d(this,Un,null),a(this,Vs).call(this)}setCurrentFrame(e){if(e===a(this,pr)){h(this,at,Rc).call(this);return}h(this,at,Ic).call(this),a(this,pr)!==null&&this.reset(),d(this,pr,rO(e)?e:null),h(this,at,Rc).call(this)}}Wa=new WeakMap,Vs=new WeakMap,sn=new WeakMap,Un=new WeakMap,pr=new WeakMap,mr=new WeakMap,gr=new WeakMap,Ga=new WeakMap,Ya=new WeakMap,Ka=new WeakMap,Ja=new WeakMap,at=new WeakSet,nf=function(e,t,r){e.type==="bridge-ready"&&e.guid!==a(this,sn)?(a(this,sn)!==null&&a(this,Vs).call(this),d(this,sn,e.guid),d(this,Un,t.tagName.toLowerCase()==="iframe"?t.contentWindow:null)):e.type==="leaving"&&e.guid===a(this,sn)&&this.reset(),a(this,Wa).call(this,e,r)},Rc=function(){if(!a(this,gr))return;const e=a(this,pr),t=(e==null?void 0:e.tagName.toLowerCase())==="webview"?e:null;t!==a(this,mr)&&(h(this,at,Ic).call(this),t&&(t.addEventListener("ipc-message",a(this,Ya)),t.addEventListener("did-start-navigation",a(this,Ka)),t.addEventListener("did-fail-load",a(this,Ja)),d(this,mr,t)))},Ic=function(){const e=a(this,mr);e&&(e.removeEventListener("ipc-message",a(this,Ya)),e.removeEventListener("did-start-navigation",a(this,Ka)),e.removeEventListener("did-fail-load",a(this,Ja)),d(this,mr,null))};const Dg="television-artifact-bridge";function Lg(n){return Sb(n)||Ab(n)||kb(n)||Eb(n)||$b(n)||Cb(n)||Tb(n)?n:null}function rO(n){if(!n)return!1;const e=n.tagName.toLowerCase();return e==="iframe"||e==="webview"}function iO(n){try{return new URL(n.getAttribute("src")??n.src,window.location.href).origin}catch{return null}}function Og(n){return n.detail??n}const sO="/views/url-unsupported/";class oO extends At{constructor(){super(...arguments);$(this,"_artifact",null);$(this,"_viewURL",null);$(this,"_contentURL",null);$(this,"_application",null);$(this,"_fullScreen",!1);$(this,"_inert",!1);$(this,"_onFullScreenChange",()=>{});$(this,"_connected",!1);$(this,"_deleteConfirmationOpen",!1);$(this,"_dialogPresentation",null);$(this,"_subscribedWebview",null);$(this,"_documentHost",null);$(this,"_pendingDocumentSource",null);$(this,"_rootRef",Rr());$(this,"_trustedChannel",new nO((t,r)=>{this.handleTrustedFrameMessage(t,r)},()=>{this._missingArtifactReplyTransport=null}));$(this,"_activeReloadFrameSrc",null);$(this,"_applicationSubscriptionsAttached",!1);$(this,"_proxyReloadVersion",0);$(this,"_navigationState",null);$(this,"_navigationArtifactId",null);$(this,"_navigationCanonicalURL",null);$(this,"_preserveFrameSrcOnNavigationRender",!1);$(this,"_missingArtifactReplyTransport",null);$(this,"handleNavigationChange",()=>{const t=this._preserveFrameSrcOnNavigationRender,r=!t;r&&!Gn()?(this.renderArtifact({preserveFrameSrc:!0}),this.forceCurrentFrameSrc()):this.renderArtifact({preserveFrameSrc:t,resetTrust:r}),this._preserveFrameSrcOnNavigationRender=!1});$(this,"handleArtifactContentChanged",t=>{var s;const r=t.artifactID,i=this._artifact;!i||r!==i.id||i.kind!=="path"||typeof r=="string"&&((s=this._documentHost)!=null&&s.handleArtifactContentChanged(r))||this.reloadProxyFrame()});$(this,"handleThemeChanged",()=>{var t;((t=this._artifact)==null?void 0:t.kind)==="url"&&Rn(this._artifact.url)||this.reloadProxyFrame()});$(this,"handleWebviewDidNavigate",t=>{this.handleWebviewNavigationEvent(t)});$(this,"handleWebviewDidNavigateInPage",t=>{this._preserveFrameSrcOnNavigationRender=!0,this.handleWebviewNavigationEvent(t)||(this._preserveFrameSrcOnNavigationRender=!1)});$(this,"captureDocumentHost",t=>{this._documentHost=t,this._pendingDocumentSource&&(t.assignSource(this._pendingDocumentSource),this.syncFrameSubscriptions())});$(this,"handleEmbedLoadChange",t=>{var r;(r=this._rootRef.value)==null||r.toggleAttribute("data-embed-loaded",t)});$(this,"handleDocumentFrameChange",t=>{t===null&&this.resetTrustedFrame(),this.syncFrameTitle(t),this._trustedChannel.setCurrentFrame(t),this.syncWebviewSubscription(t)});$(this,"handleTitleBarDoubleClick",t=>{const r=t.target;r instanceof Element&&r.closest("button")||this.requestFullScreen(!this._fullScreen)})}update(t,r){var u;const[i,s,o]=r;let l=!1;this._application!==i&&(this.detachApplicationSubscriptions(),this._application=i,this.attachApplicationSubscriptions(),this._connected&&(this.assignDocumentSource({preserveFrameSrc:!0}),l=!0));const c=this._artifact;if(c!==s){const f=c?!cO(c,s):!0;if(f&&(this._activeReloadFrameSrc=null),this._artifact=s,this.syncNavigationState(),this._connected){if(this.renderArtifact({resetTrust:f}),l=!0,c&&uO(c,s)){const m=this.currentMissingArtifactMessage();m&&((u=this._missingArtifactReplyTransport)==null||u.send(m))}}else f&&this.resetTrustedFrame()}return this._viewURL!==o.viewURL&&(this._viewURL=o.viewURL,this.syncNavigationState(),this._connected?(this.renderArtifact({resetTrust:!0}),l=!0):this._trustedChannel.reset()),this._contentURL!==o.contentURL&&(this._contentURL=o.contentURL,this._connected&&(this.renderArtifact(),l=!0)),this._fullScreen!==o.fullScreen&&(this._fullScreen=o.fullScreen,this._connected&&this._artifact&&(this.renderArtifact({preserveFrameSrc:!0}),l=!0)),this._inert=o.inert,this._onFullScreenChange=o.onFullScreenChange,this._connected&&!l&&this.renderArtifact({preserveFrameSrc:!0}),super.update(t,r)}attachApplicationSubscriptions(){!this._application||this._applicationSubscriptionsAttached||(this._application.addEventListener("artifact-content-changed",this.handleArtifactContentChanged),this._application.addEventListener("theme-changed",this.handleThemeChanged),this._applicationSubscriptionsAttached=!0)}detachApplicationSubscriptions(){!this._application||!this._applicationSubscriptionsAttached||(this._application.removeEventListener("artifact-content-changed",this.handleArtifactContentChanged),this._application.removeEventListener("theme-changed",this.handleThemeChanged),this._applicationSubscriptionsAttached=!1)}get activeView(){return null}connected(){this._connected=!0,this._trustedChannel.connect(),this.attachApplicationSubscriptions(),this.resetTrustedFrame(),this.syncNavigationState(),this.renderArtifact(),this.syncFrameSubscriptions()}disconnected(){var t;this._connected=!1,(t=this._dialogPresentation)==null||t.withdraw(),this._dialogPresentation=null,this._deleteConfirmationOpen=!1,this.resetTrustedFrame(),this._trustedChannel.disconnect(),this.unsubscribeFromWebview(),this.syncNavigationState(),this.detachApplicationSubscriptions()}handleTrustedFrameMessage(t,r){var i;switch(t.type){case"url-target-request":r.send({type:Rb,url:this.currentExternalTargetURL()});return;case"artifact-missing-request":{const s=this.currentMissingArtifactMessage();s&&(this._missingArtifactReplyTransport=r,r.send(s));return}case"proxy-content-changed":this.handleProxyContentChanged();return;case"navigation-request":this.handleNavigationRequest(t);return;case"navigation-key":(i=this._application)==null||i.handleNavigationKey(t.key);return;case"bridge-ready":case"leaving":return}}currentExternalTargetURL(){var r,i;const t=((r=this._navigationState)==null?void 0:r.currentURL)??null;return t&&lO(t)?t:((i=this._artifact)==null?void 0:i.kind)==="url"?this._artifact.url:null}currentMissingArtifactMessage(){const t=this._artifact;return(t==null?void 0:t.kind)!=="path"?null:{type:Ib,title:t.title,path:t.path}}handleProxyContentChanged(){var t;((t=this._artifact)==null?void 0:t.kind)!=="url"||!Rn(this._artifact.url)||this.reloadProxyFrame()}handleNavigationRequest(t){if(!ig(t.url,window.location.href))return;this.syncNavigationState();const r=this._navigationState;if(!r)return;const i=this.convertIframeNavigationURL(t.url);if(i===sO||i===r.currentURL)return;const s=t.native===!0;(t.sameDocument||s)&&(this._preserveFrameSrcOnNavigationRender=!0),t.replace?r.replace(i):r.navigate(i)}syncNavigationState(){if(!this._connected||!this._artifact){this.disposeNavigationState();return}const t=this.canonicalURLForArtifact(this._artifact);this._navigationState&&this._navigationArtifactId===this._artifact.id&&this._navigationCanonicalURL===t||(this.disposeNavigationState(),this._navigationState=new _5(this._artifact.id,t),this._navigationArtifactId=this._artifact.id,this._navigationCanonicalURL=t,this._navigationState.addEventListener("change",this.handleNavigationChange),this._navigationState.currentURL!==null?this.renderArtifact():this._navigationState.canGoForward&&this.renderArtifact({preserveFrameSrc:!0}))}disposeNavigationState(){var t;(t=this._navigationState)==null||t.removeEventListener("change",this.handleNavigationChange),this._navigationState=null,this._navigationArtifactId=null,this._navigationCanonicalURL=null,this._preserveFrameSrcOnNavigationRender=!1}canonicalURLForArtifact(t){const r=$c({artifact:t,application:this._application,electron:Gn(),viewURL:this._viewURL,contentURL:this._contentURL,currentURL:null}),i=r.viewURL;return t.kind==="url"&&Rn(t.url)||r.renderer==="url-webview"?Yn(i):zg(i,i)}convertIframeNavigationURL(t){var r;return((r=this._artifact)==null?void 0:r.kind)==="url"&&Rn(this._artifact.url)&&Rn(t)?Yn(t):zg(t,this._viewURL??this._navigationCanonicalURL??null)}handleWebviewNavigationEvent(t){const r=t.url;if(typeof r!="string"||!ig(r,window.location.href))return!1;this.syncNavigationState();const i=this._navigationState;if(!i)return!1;const s=Yn(r);return s===i.currentURL?!1:(i.navigate(s),!0)}syncWebviewSubscription(t=this.currentFrame){const r=(t==null?void 0:t.tagName.toLowerCase())==="webview"?t:null;r!==this._subscribedWebview&&(this.unsubscribeFromWebview(),r&&(r.addEventListener("did-navigate",this.handleWebviewDidNavigate),r.addEventListener("did-navigate-in-page",this.handleWebviewDidNavigateInPage),this._subscribedWebview=r))}unsubscribeFromWebview(){this._subscribedWebview&&(this._subscribedWebview.removeEventListener("did-navigate",this.handleWebviewDidNavigate),this._subscribedWebview.removeEventListener("did-navigate-in-page",this.handleWebviewDidNavigateInPage),this._subscribedWebview=null)}get currentFrame(){var t;return((t=this._documentHost)==null?void 0:t.currentFrame)??null}syncFrameSubscriptions(){const t=this.currentFrame;this.syncFrameTitle(t),this._trustedChannel.setCurrentFrame(t),this.syncWebviewSubscription(t)}syncFrameTitle(t){t&&this._artifact&&t.getAttribute("title")!==this._artifact.title&&t.setAttribute("title",this._artifact.title)}resetTrustedFrame(){this._missingArtifactReplyTransport=null,this._trustedChannel.reset()}assignDocumentSource(t={}){var f,m,v;const r=this._artifact;if(!r)return;t.resetTrust&&this.resetTrustedFrame();const i={artifact:r,application:this._application,electron:Gn(),viewURL:this._viewURL,contentURL:this._contentURL,currentURL:((f=this._navigationState)==null?void 0:f.currentURL)??null},s=$c(i),o=(m=this.currentFrame)==null?void 0:m.getAttribute("src");let l=null;this._activeReloadFrameSrc&&(l2(this._activeReloadFrameSrc,s.viewURL)?l=this._activeReloadFrameSrc:this._activeReloadFrameSrc=null);const c=t.frameSrcOverride??l??(t.preserveFrameSrc&&o?o:s.viewURL),u={...i,frameSrcOverride:c};this._pendingDocumentSource=u,(v=this._documentHost)==null||v.assignSource(u),this.syncFrameSubscriptions()}reloadProxyFrame(){var o,l,c,u,f;const t=this.currentFrame;if(!t||t.hasAttribute("data-content-url")||t.tagName.toLowerCase()==="webview"&&!(((o=this._artifact)==null?void 0:o.kind)==="path"||((l=this._artifact)==null?void 0:l.kind)==="url"&&Rn(this._artifact.url)))return;const r=((c=this._artifact)==null?void 0:c.kind)==="url"&&Rn(this._artifact.url)?((u=this._navigationState)==null?void 0:u.currentURL)??t.getAttribute("src"):t.getAttribute("src");if(r===null)return;const i=new URL(r,window.location.href);i.searchParams.set(so,String(++this._proxyReloadVersion));const s=r.startsWith("/")?`${i.pathname}${i.search}${i.hash}`:i.href;this._activeReloadFrameSrc=s,(f=this._rootRef.value)==null||f.removeAttribute("data-embed-loaded"),this.renderArtifact({frameSrcOverride:s,resetTrust:!0})}forceCurrentFrameSrc(){var s,o,l;if(!this._artifact)return;const t=$c({artifact:this._artifact,application:this._application,electron:Gn(),viewURL:this._viewURL,contentURL:this._contentURL,currentURL:((s=this._navigationState)==null?void 0:s.currentURL)??null});if(t.renderer==="url-webview")return;const r=this.currentFrame,i=(r==null?void 0:r.tagName.toLowerCase())==="iframe"?r:null;i&&(this.resetTrustedFrame(),this._activeReloadFrameSrc=null,(o=this._rootRef.value)==null||o.removeAttribute("data-embed-loaded"),i.setAttribute("src",t.viewURL),(l=this._documentHost)==null||l.refreshFrameLoadState())}menuEntries(){return[{label:this._fullScreen?"Exit full-screen":"Make full-screen",action:()=>this.requestFullScreen(!this._fullScreen)},{separator:!0},{label:"Delete",destructive:!0,action:()=>this.showDeleteConfirmation()}]}closeMenu(){var r;const t=(r=this._rootRef.value)==null?void 0:r.querySelector(".menu");t&&typeof t.hidePopover=="function"&&t.matches(":popover-open")&&t.hidePopover()}requestFullScreen(t){this.closeMenu(),this._onFullScreenChange(t)}showDeleteConfirmation(){var r,i,s;if(this._deleteConfirmationOpen)return;this.closeMenu(),this._deleteConfirmationOpen=!0,this.renderArtifact({preserveFrameSrc:!0});const t=(r=this._rootRef.value)==null?void 0:r.querySelector("dialog");t&&(this._dialogPresentation=Vu(t,()=>this.dismissDeleteConfirmation()),(s=(i=this._rootRef.value)==null?void 0:i.querySelector(".dialog-actions button"))==null||s.focus())}dismissDeleteConfirmation(){const t=this._dialogPresentation;this._dialogPresentation=null,this._deleteConfirmationOpen=!1,t==null||t.withdraw(),this.isConnected&&this._artifact&&this.renderArtifact({preserveFrameSrc:!0})}confirmDelete(){var i;const t=(i=this._artifact)==null?void 0:i.id,r=this._application;this.dismissDeleteConfirmation(),!(!t||!r)&&r.deleteArtifact(t).catch(()=>{})}navigationControlsTemplate(){const t=this._navigationState;return!t||!t.canGoBack&&!t.canGoForward?null:V`
248
- <button
249
- icon-only
250
- size="sm"
251
- variant="ghost"
252
- class="artifact-back"
253
- ?disabled=${!t.canGoBack}
254
- @click=${()=>t.back()}
255
- aria-label="Back"
256
- >
257
- <tv-icon name="back" size="sm"></tv-icon>
258
- </button>
259
- <button
260
- icon-only
261
- size="sm"
262
- variant="ghost"
263
- class="artifact-forward"
264
- ?disabled=${!t.canGoForward}
265
- @click=${()=>t.forward()}
266
- aria-label="Forward"
267
- >
268
- <tv-icon name="forward" size="sm"></tv-icon>
269
- </button>
270
- <span class="artifact-bar-divider" aria-hidden="true"></span>
271
- `}deleteConfirmationTemplate(){return!this._deleteConfirmationOpen||!this._artifact?null:Hu(V`
272
- <div class="dialog-alert" role="alertdialog">
273
- <h2>Delete “${this._artifact.title}”?</h2>
274
- <p>It’s removed from this channel; the file or web page it points to is not deleted.</p>
275
- <div class="dialog-actions">
276
- <button @click=${()=>this.dismissDeleteConfirmation()}>Cancel</button>
277
- <button variant="danger" @click=${()=>this.confirmDelete()}>Delete</button>
278
- </div>
279
- </div>
280
- `,{overlay:!0})}template(t,r,i){const s=this._artifact;return V`
281
- <div
282
- class="artifact-view artifact-frame"
283
- kind=${s.kind}
284
- ?full-screen=${this._fullScreen}
285
- ?inert=${this._inert}
286
- ._trustedChannel=${this._trustedChannel}
287
- ${mn(this._rootRef)}
288
- >
289
- ${QL(this.captureDocumentHost,this.handleEmbedLoadChange,this.handleDocumentFrameChange)}
290
- <footer class="artifact-title-bar" @dblclick=${this.handleTitleBarDoubleClick}>
291
- <tv-icon name="artifact" size="sm"></tv-icon>
292
- <span class="artifact-title">${s.title}</span>
293
- ${this.navigationControlsTemplate()}
294
- ${Lw(this.menuEntries(),{placement:"top-end",trigger:o=>V`
295
- <button
296
- icon-only
297
- size="sm"
298
- variant="ghost"
299
- class="artifact-menu-trigger"
300
- popovertarget=${o}
301
- aria-label=${`${s.title} menu`}
302
- >
303
- <tv-icon name="expand" size="sm"></tv-icon>
304
- </button>
305
- `})}
306
- </footer>
307
- ${this.deleteConfirmationTemplate()}
308
- </div>
309
- `}renderArtifact(t={}){this._artifact&&(this.assignDocumentSource({preserveFrameSrc:t.preserveFrameSrc??!1,frameSrcOverride:t.frameSrcOverride,resetTrust:t.resetTrust}),this.render(),t.forceFrameSrc&&this.forceCurrentFrameSrc(),this.syncFrameSubscriptions())}}const aO=kt(oO);function lO(n){return n.startsWith("http://")||n.startsWith("https://")}function cO(n,e){return n.id!==e.id||n.kind!==e.kind?!1:n.kind==="path"&&e.kind==="path"?n.path===e.path:n.kind==="url"&&e.kind==="url"?l2(n.url,e.url):!0}function uO(n,e){return n.kind==="path"&&e.kind==="path"&&n.id===e.id&&(n.title!==e.title||n.path!==e.path)}function l2(n,e){try{const t=new URL(n,window.location.href),r=new URL(e,window.location.href);return t.searchParams.delete(so),r.searchParams.delete(so),t.origin===r.origin&&t.pathname===r.pathname&&t.search===r.search}catch{return!1}}function zg(n,e){try{const t=new URL(n,window.location.href);if(e){const r=new URL(e,window.location.href);if(t.origin!=="null"&&t.origin===r.origin)return t.searchParams.delete(so),`${t.pathname}${t.search}${t.hash}`}}catch{return Yn(n)}return Yn(n)}function c2(n,e,t,r,i){const s=e.pages.map(o=>({artifactIds:[...o.artifactIds],geometry:{...o.geometry,full_screen:o===t?i:o.geometry.full_screen},size:o===t?{...r}:{...o.size}}));n.updateChannelPages(e.id,s).catch(()=>{})}function rf(n,e,t,r){c2(n,e,t,t.size,r)}const hO=1280,dO=800,Ng=.4,Mg=.4,u2=280,fO=14,pO=45,mO=16,Ug=64,gO=100,vO=1,yO=230,wO=230;function vp(n){return{width:1-Ng+Ng*n.width/hO,height:1-Mg+Mg*n.height/dO}}function h2(n){return{width:Math.min(yO,n.width),height:Math.min(wO,n.height)}}function Zg(n,e){const t=vp(e),r=h2(e);return{width:Math.min(e.width,Math.max(r.width,n.width*t.width)),height:Math.min(e.height,Math.max(r.height,n.height*t.height))}}function bO(n,e){const t=vp(e);return{width:n.width/t.width,height:n.height/t.height}}const qh=.5,_O=4,Yl=2,SO=120,AO=["left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"];var _i,on,Bs,Zn,qs,Si,vr,yr,wr,Fn,Ai,ki,an,js,Hn,ln,Ve,Ei,O,d2,f2,Yo,p2,Ko,sf,xc,m2,Xa,Qa,el,tl,$i,nl,of,Zt,af,hs,g2,v2,Pc,Dc;class kO extends At{constructor(){super(...arguments);g(this,O);g(this,_i,Rr());g(this,on,Rr());g(this,Bs);g(this,Zn);g(this,qs);g(this,Si);g(this,vr);g(this,yr,0);g(this,wr,0);g(this,Fn,null);g(this,Ai,null);g(this,ki,null);g(this,an,null);g(this,js,[]);g(this,Hn,null);g(this,ln,null);g(this,Ve,null);g(this,Ei,new Set);g(this,Xa,t=>{const r=a(this,Ve);!r||t.pointerId!==r.pointerId||(r.lastPointer={x:t.clientX,y:t.clientY},r.option=t.altKey,h(this,O,of).call(this,r))});g(this,Qa,t=>{var r;t.pointerId===((r=a(this,Ve))==null?void 0:r.pointerId)&&h(this,O,Zt).call(this,!0)});g(this,el,t=>{var r;t.pointerId===((r=a(this,Ve))==null?void 0:r.pointerId)&&h(this,O,Zt).call(this,!1)});g(this,tl,t=>{var r;t.pointerId===((r=a(this,Ve))==null?void 0:r.pointerId)&&h(this,O,Zt).call(this,!1)});g(this,$i,t=>{const r=a(this,Ve);if(r){if(t.type==="keydown"&&t.key==="Escape"){t.preventDefault(),h(this,O,Zt).call(this,!1);return}r.option!==t.altKey&&(r.option=t.altKey,h(this,O,of).call(this,r))}});g(this,nl,()=>{const t=a(this,Ve);!t||Fg(h(this,O,Yo).call(this,t.filmstrip),t.pageBox)||(h(this,O,sf).call(this),h(this,O,Zt).call(this,!1))})}connected(){d(this,Bs,void 0),d(this,Zn,void 0),d(this,qs,void 0),d(this,Si,void 0),d(this,vr,void 0)}template(t,r,i){var Q;const s=(i==null?void 0:i.channelId)===(r==null?void 0:r.id)?i:null,o=$O(r,(s==null?void 0:s.pages)??(r==null?void 0:r.pages)),l=(r==null?void 0:r.selectedPage)??null,c=(r==null?void 0:r.id)??null,u=(l==null?void 0:l.artifactIds[0])??null,f=(l==null?void 0:l.geometry.full_screen)??null,m=a(this,Si)!==void 0,v=o.map(({key:ee,page:oe})=>`${ee}:${oe.geometry.full_screen}:${oe.size.width}:${oe.size.height}`).sort().join("|"),y=s===null?null:o.map(({key:ee})=>ee).join("|"),k=c!==a(this,Bs),S=u!==a(this,Zn),x=f!==a(this,qs),M=v!==a(this,Si),Z=y!==a(this,vr),F=s!==null&&a(this,vr)!==void 0&&a(this,vr)!==null&&Z?h(this,O,g2).call(this):null,W=S&&!k&&a(this,Zn)!==void 0&&a(this,Zn)!==null&&u!==null;return a(this,Ve)&&(k||S||x)&&h(this,O,Zt).call(this,!1),d(this,Bs,c),d(this,Zn,u),d(this,qs,f),d(this,Si,v),d(this,vr,y),d(this,js,o),M&&m&&h(this,O,xc).call(this),k&&((Q=a(this,an))==null||Q.disconnect(),d(this,Ai,null),d(this,ki,null),d(this,Hn,null)),queueMicrotask(()=>h(this,O,Ko).call(this)),k||S||M?queueMicrotask(()=>h(this,O,d2).call(this,u,W)):Z&&queueMicrotask(()=>{const ee=a(this,on).value;ee&&(h(this,O,hs).call(this,ee,u,!1),F&&h(this,O,v2).call(this,F))}),V`
310
- <section
311
- class="stage"
312
- ${mn(a(this,_i))}
313
- style=${`--handle-band: ${fO}px; --handle-reach: ${pO}px; --handle-thickness: ${mO}px;`}
314
- >
315
- ${r!==null&&o.length===0?V`
316
- <div class="stage-empty">
317
- <tv-icon name="artifact"></tv-icon>
318
- <p>No artifacts yet — ask your agent to put something here.</p>
319
- </div>
320
- `:null}
321
- ${Gc([c],ee=>ee,()=>V`
322
- <div class="filmstrip" ${mn(a(this,on))}>
323
- <div class="filmstrip-inner" ?tab-held=${s!==null}>
324
- ${Gc(o,({key:ee})=>ee,({page:ee,artifact:oe,key:yn})=>{if(r===null)return null;const wn=yn===u;return V`
325
- <div
326
- class="page"
327
- data-page-key=${yn}
328
- ?selected=${wn}
329
- ?full-screen=${ee.geometry.full_screen}
330
- style=${h(this,O,p2).call(this,ee)}
331
- @click=${wn||oe===null?null:()=>t.selectPage(r.id,oe.id)}
332
- >
333
- ${oe?aO(t,oe,{viewURL:t.getArtifactViewURL(oe),contentURL:t.getArtifactContentURL(oe),fullScreen:ee.geometry.full_screen,inert:!wn,onFullScreenChange:we=>rf(t,r,ee,we)}):null}
334
- ${wn?V`
335
- <div class="page-handles" aria-hidden="true">
336
- ${AO.map(we=>V`
337
- <span
338
- class="page-handle ${we}"
339
- @pointerdown=${bn=>h(this,O,m2).call(this,bn,we,t,r,ee,yn)}
340
- ></span>
341
- `)}
342
- </div>
343
- `:null}
344
- </div>
345
- `})}
346
- </div>
347
- </div>
348
- `)}
349
- </section>
350
- `}disconnected(){var t;h(this,O,Zt).call(this,!1),h(this,O,xc).call(this),h(this,O,Dc).call(this),cancelAnimationFrame(a(this,yr)),d(this,yr,0),(t=a(this,an))==null||t.disconnect(),d(this,an,null),d(this,Ai,null),d(this,ki,null),d(this,Hn,null),d(this,js,[]);for(const r of a(this,Ei))r.cancel();a(this,Ei).clear()}}_i=new WeakMap,on=new WeakMap,Bs=new WeakMap,Zn=new WeakMap,qs=new WeakMap,Si=new WeakMap,vr=new WeakMap,yr=new WeakMap,wr=new WeakMap,Fn=new WeakMap,Ai=new WeakMap,ki=new WeakMap,an=new WeakMap,js=new WeakMap,Hn=new WeakMap,ln=new WeakMap,Ve=new WeakMap,Ei=new WeakMap,O=new WeakSet,d2=function(t,r){const i=a(this,on).value;i&&(cancelAnimationFrame(a(this,yr)),d(this,yr,requestAnimationFrame(()=>{d(this,yr,0),h(this,O,hs).call(this,i,t,r)})))},f2=function(t,r){var i;typeof ResizeObserver>"u"||t===a(this,Ai)&&r===a(this,ki)||((i=a(this,an))==null||i.disconnect(),d(this,Ai,t),d(this,ki,r),d(this,an,new ResizeObserver(()=>{const s=h(this,O,Yo).call(this,t);Fg(s,a(this,Hn))||(h(this,O,sf).call(this),a(this,Ve)&&h(this,O,Zt).call(this,!1),h(this,O,Ko).call(this,t)),a(this,Fn)===null&&h(this,O,hs).call(this,t,a(this,Zn)??null,!1)})),a(this,an).observe(t),a(this,an).observe(r))},Yo=function(t){const r=Number.parseFloat(getComputedStyle(t).getPropertyValue("--stage-inset"))||0;return{width:Math.max(0,t.clientWidth-2*r),height:Math.max(0,t.clientHeight-r)}},p2=function(t){if(t.geometry.full_screen||a(this,Hn)===null)return"";const r=Zg(t.size,a(this,Hn));return`width: ${r.width}px; height: ${r.height}px;`},Ko=function(t=a(this,on).value){var s;if(!t)return;const r=h(this,O,Yo).call(this,t);d(this,Hn,r);const i=new Map(a(this,js).map(o=>[o.key,o.page]));for(const o of t.querySelectorAll(".page")){if(o===((s=a(this,Ve))==null?void 0:s.pageElement))continue;const l=i.get(o.dataset.pageKey??"");if(!l)continue;if(l.geometry.full_screen){o.style.width="",o.style.height="";continue}const c=Zg(l.size,r);o.style.width=`${c.width}px`,o.style.height=`${c.height}px`}},sf=function(){const t=a(this,_i).value;t&&(t.setAttribute("window-tracking",""),a(this,ln)!==null&&clearTimeout(a(this,ln)),d(this,ln,setTimeout(()=>{d(this,ln,null),t.removeAttribute("window-tracking")},SO)))},xc=function(){var t;a(this,ln)!==null&&(clearTimeout(a(this,ln)),d(this,ln,null)),(t=a(this,_i).value)==null||t.removeAttribute("window-tracking")},m2=function(t,r,i,s,o,l){if(t.button!==0||!t.isPrimary)return;const c=t.currentTarget,u=c.closest(".page"),f=a(this,on).value,m=a(this,_i).value;if(!u||!f||!m)return;h(this,O,Zt).call(this,!1),h(this,O,xc).call(this),t.preventDefault(),t.stopPropagation();const v=u.getBoundingClientRect(),y=h(this,O,Yo).call(this,f),k=vp(y),S=o.geometry.full_screen,x=r.includes("left")||r.includes("right"),M=r.includes("top")||r.includes("bottom");d(this,Ve,{application:i,channel:s,page:o,pageKey:l,pageElement:u,filmstrip:f,stage:m,handle:c,pointerId:t.pointerId,startPointer:{x:t.clientX,y:t.clientY},lastPointer:{x:t.clientX,y:t.clientY},startRendered:{width:v.width,height:v.height},rendered:{width:v.width,height:v.height},baselineSize:S?{width:y.width/k.width,height:y.height/k.height}:{...o.size},pageBox:y,wasFullScreen:S,horizontal:x,vertical:M,leftish:r.includes("left"),topish:r.includes("top"),option:t.altKey,armed:!1,leftFullScreen:!1}),m.setAttribute("resizing",""),c.addEventListener("pointermove",a(this,Xa)),c.addEventListener("pointerup",a(this,Qa)),c.addEventListener("pointercancel",a(this,el)),c.addEventListener("lostpointercapture",a(this,tl)),window.addEventListener("keydown",a(this,$i)),window.addEventListener("keyup",a(this,$i)),window.addEventListener("resize",a(this,nl)),c.setPointerCapture(t.pointerId)},Xa=new WeakMap,Qa=new WeakMap,el=new WeakMap,tl=new WeakMap,$i=new WeakMap,nl=new WeakMap,of=function(t){const r=t.lastPointer.x!==t.startPointer.x||t.lastPointer.y!==t.startPointer.y;if(t.wasFullScreen&&!t.leftFullScreen){if(!r)return;t.leftFullScreen=!0,t.pageElement.removeAttribute("full-screen")}const i=h2(t.pageBox);let s=t.startRendered.width,o=t.startRendered.height;if(t.horizontal){const l=t.leftish?-Yl:Yl;s=Math.min(t.pageBox.width,Math.max(i.width,t.startRendered.width+(t.lastPointer.x-t.startPointer.x)*l))}if(t.vertical){const l=t.topish?-Yl:Yl;o=Math.min(t.pageBox.height,Math.max(i.height,t.startRendered.height+(t.lastPointer.y-t.startPointer.y)*l))}t.armed=!t.option&&t.horizontal&&t.vertical&&s>=t.pageBox.width-Ug&&o>=t.pageBox.height-Ug,t.rendered=t.armed?{...t.pageBox}:{width:s,height:o},t.pageElement.style.width=`${t.rendered.width}px`,t.pageElement.style.height=`${t.rendered.height}px`,h(this,O,af).call(this,t.stage,t.armed),h(this,O,hs).call(this,t.filmstrip,t.pageKey,!1)},Zt=function(t){const r=a(this,Ve);if(r){if(d(this,Ve,null),r.handle.removeEventListener("pointermove",a(this,Xa)),r.handle.removeEventListener("pointerup",a(this,Qa)),r.handle.removeEventListener("pointercancel",a(this,el)),r.handle.removeEventListener("lostpointercapture",a(this,tl)),window.removeEventListener("keydown",a(this,$i)),window.removeEventListener("keyup",a(this,$i)),window.removeEventListener("resize",a(this,nl)),r.handle.hasPointerCapture(r.pointerId)&&r.handle.releasePointerCapture(r.pointerId),h(this,O,af).call(this,r.stage,!1),t&&r.armed)r.wasFullScreen&&r.pageElement.setAttribute("full-screen",""),rf(r.application,r.channel,r.page,!0);else if(t){const i={...r.baselineSize},s=bO(r.rendered,r.pageBox);let o=r.wasFullScreen&&r.leftFullScreen;r.horizontal&&r.rendered.width!==r.startRendered.width&&(i.width=s.width,o=!0),r.vertical&&r.rendered.height!==r.startRendered.height&&(i.height=s.height,o=!0),o?c2(r.application,r.channel,r.page,i,!1):h(this,O,Ko).call(this,r.filmstrip)}else r.pageElement.toggleAttribute("full-screen",r.wasFullScreen),h(this,O,Ko).call(this,r.filmstrip);r.pageElement.getBoundingClientRect(),r.stage.removeAttribute("resizing"),h(this,O,hs).call(this,r.filmstrip,r.pageKey,!1)}},af=function(t,r){const i=t.querySelector(":scope > .snap-outline");if(!r){i==null||i.remove();return}if(i)return;const s=document.createElement("div");s.className="snap-outline",s.setAttribute("aria-hidden","true"),t.append(s)},hs=function(t,r,i){const s=[...t.querySelectorAll(".page")].find(v=>v.dataset.pageKey===r);if(!s){h(this,O,Dc).call(this);return}h(this,O,f2).call(this,t,s);const o=s.getBoundingClientRect(),l=t.getBoundingClientRect(),c=Math.max(0,Math.min(t.scrollLeft+o.left+o.width/2-(l.left+l.width/2),t.scrollWidth-t.clientWidth));if(h(this,O,Dc).call(this),!i||Math.abs(c-t.scrollLeft)<qh||matchMedia("(prefers-reduced-motion: reduce)").matches){t.scrollLeft=c;for(let v=0;v<_O;v+=1){h(this,O,Pc).call(this,t);const y=s.getBoundingClientRect(),k=t.getBoundingClientRect(),S=y.left+y.width/2-(k.left+k.width/2);if(Math.abs(S)<qh)break;t.scrollLeft+=S}h(this,O,Pc).call(this,t);return}const u=t.scrollLeft,f=t.animate([{},{}],{duration:u2,easing:"ease"});d(this,Fn,f);const m=()=>{var y;if(f!==a(this,Fn))return;const v=f.playState==="finished"?1:((y=f.effect)==null?void 0:y.getComputedTiming().progress)??0;t.scrollLeft=u+(c-u)*v,h(this,O,Pc).call(this,t),f.playState==="finished"?(t.scrollLeft=c,d(this,Fn,null),d(this,wr,0)):d(this,wr,requestAnimationFrame(m))};d(this,wr,requestAnimationFrame(m))},g2=function(){const t=a(this,on).value;return t?new Map([...t.querySelectorAll(".page")].map(r=>[r.dataset.pageKey??"",r.getBoundingClientRect().left])):new Map},v2=function(t){const r=a(this,on).value,i=r==null?void 0:r.querySelector(".filmstrip-inner");if(!r||!i)return;const s=i.clientWidth===0?1:i.getBoundingClientRect().width/i.clientWidth;for(const o of r.querySelectorAll(".page")){if(o.hasAttribute("selected"))continue;const l=t.get(o.dataset.pageKey??"");if(l===void 0)continue;const c=(l-o.getBoundingClientRect().left)/(s||1);if(Math.abs(c)<=qh)continue;const u=o.animate({translate:[`${c}px 0`,"0px 0"]},{duration:gs,easing:"ease"});a(this,Ei).add(u),u.finished.finally(()=>{a(this,Ei).delete(u)}).catch(()=>{})}},Pc=function(t){const r=t.querySelector(".filmstrip-inner");r&&(r.style.transformOrigin=`${t.scrollLeft+t.clientWidth/2}px center`)},Dc=function(){var t;cancelAnimationFrame(a(this,wr)),d(this,wr,0),(t=a(this,Fn))==null||t.cancel(),d(this,Fn,null)};const EO=kt(kO);function $O(n,e){if(!n||!e)return[];const t=new Map(n.artifacts.map(r=>[r.id,r]));return e.map((r,i)=>{const s=r.artifactIds[0];return{page:r,artifact:s===void 0?null:t.get(s)??null,key:s??`empty-page-${i}`}})}function Fg(n,e){return e!==null&&n.width===e.width&&n.height===e.height}/**
351
- * @license
352
- * Copyright 2017 Google LLC
353
- * SPDX-License-Identifier: BSD-3-Clause
354
- */class lf extends Fu{constructor(e){if(super(e),this.it=ue,e.type!==Zu.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===ue||e==null)return this._t=void 0,this.it=e;if(e===Pt)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}lf.directiveName="unsafeHTML",lf.resultType=1;const y2=El(lf);/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:w2,setPrototypeOf:Hg,isFrozen:CO,getPrototypeOf:TO,getOwnPropertyDescriptor:RO}=Object;let{freeze:je,seal:bt,create:Lc}=Object,{apply:cf,construct:uf}=typeof Reflect<"u"&&Reflect;je||(je=function(e){return e});bt||(bt=function(e){return e});cf||(cf=function(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(t,i)});uf||(uf=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return new e(...r)});const Kl=We(Array.prototype.forEach),IO=We(Array.prototype.lastIndexOf),Vg=We(Array.prototype.pop),Io=We(Array.prototype.push),xO=We(Array.prototype.splice),Oc=We(String.prototype.toLowerCase),jh=We(String.prototype.toString),Wh=We(String.prototype.match),xo=We(String.prototype.replace),PO=We(String.prototype.indexOf),DO=We(String.prototype.trim),et=We(Object.prototype.hasOwnProperty),Ue=We(RegExp.prototype.test),Po=LO(TypeError);function We(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return cf(n,e,r)}}function LO(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return uf(n,t)}}function Y(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Oc;Hg&&Hg(n,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=t(i);s!==i&&(CO(e)||(e[r]=s),i=s)}n[i]=!0}return n}function OO(n){for(let e=0;e<n.length;e++)et(n,e)||(n[e]=null);return n}function Ft(n){const e=Lc(null);for(const[t,r]of w2(n))et(n,t)&&(Array.isArray(r)?e[t]=OO(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=Ft(r):e[t]=r);return e}function Do(n,e){for(;n!==null;){const r=RO(n,e);if(r){if(r.get)return We(r.get);if(typeof r.value=="function")return We(r.value)}n=TO(n)}function t(){return null}return t}const Bg=je(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Gh=je(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Yh=je(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),zO=je(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Kh=je(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),NO=je(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),qg=je(["#text"]),jg=je(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Jh=je(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Wg=je(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Jl=je(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),MO=bt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),UO=bt(/<%[\w\W]*|[\w\W]*%>/gm),ZO=bt(/\$\{[\w\W]*/gm),FO=bt(/^data-[\-\w.\u00B7-\uFFFF]+$/),HO=bt(/^aria-[\-\w]+$/),b2=bt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),VO=bt(/^(?:\w+script|data):/i),BO=bt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),_2=bt(/^html$/i),qO=bt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Gg=Object.freeze({__proto__:null,ARIA_ATTR:HO,ATTR_WHITESPACE:BO,CUSTOM_ELEMENT:qO,DATA_ATTR:FO,DOCTYPE_NAME:_2,ERB_EXPR:UO,IS_ALLOWED_URI:b2,IS_SCRIPT_OR_DATA:VO,MUSTACHE_EXPR:MO,TMPLIT_EXPR:ZO});const Lo={element:1,text:3,progressingInstruction:7,comment:8,document:9},jO=function(){return typeof window>"u"?null:window},WO=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(r=t.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Yg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function S2(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:jO();const e=U=>S2(U);if(e.version="3.3.3",e.removed=[],!n||!n.document||n.document.nodeType!==Lo.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const r=t,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:l,Element:c,NodeFilter:u,NamedNodeMap:f=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:m,DOMParser:v,trustedTypes:y}=n,k=c.prototype,S=Do(k,"cloneNode"),x=Do(k,"remove"),M=Do(k,"nextSibling"),Z=Do(k,"childNodes"),G=Do(k,"parentNode");if(typeof o=="function"){const U=t.createElement("template");U.content&&U.content.ownerDocument&&(t=U.content.ownerDocument)}let F,W="";const{implementation:Q,createNodeIterator:ee,createDocumentFragment:oe,getElementsByTagName:yn}=t,{importNode:wn}=r;let we=Yg();e.isSupported=typeof w2=="function"&&typeof G=="function"&&Q&&Q.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:bn,ERB_EXPR:Ot,TMPLIT_EXPR:Qn,DATA_ATTR:ju,ARIA_ATTR:Cl,IS_SCRIPT_OR_DATA:ub,ATTR_WHITESPACE:xp,CUSTOM_ELEMENT:hb}=Gg;let{IS_ALLOWED_URI:Pp}=Gg,Te=null;const Dp=Y({},[...Bg,...Gh,...Yh,...Kh,...qg]);let xe=null;const Lp=Y({},[...jg,...Jh,...Wg,...Jl]);let be=Object.seal(Lc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),_o=null,Tl=null;const er=Object.seal(Lc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Op=!0,Wu=!0,zp=!1,Np=!0,Wi=!1,Rl=!0,Fr=!1,Gu=!1,Yu=!1,Gi=!1,Il=!1,xl=!1,Mp=!0,Up=!1;const db="user-content-";let Ku=!0,So=!1,Yi={},zt=null;const Ju=Y({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Zp=null;const Fp=Y({},["audio","video","img","source","image","track"]);let Xu=null;const Hp=Y({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Pl="http://www.w3.org/1998/Math/MathML",Dl="http://www.w3.org/2000/svg",_n="http://www.w3.org/1999/xhtml";let Ki=_n,Qu=!1,eh=null;const fb=Y({},[Pl,Dl,_n],jh);let Ll=Y({},["mi","mo","mn","ms","mtext"]),Ol=Y({},["annotation-xml"]);const pb=Y({},["title","style","font","a","script"]);let Ao=null;const mb=["application/xhtml+xml","text/html"],gb="text/html";let $e=null,Ji=null;const vb=t.createElement("form"),Vp=function(b){return b instanceof RegExp||b instanceof Function},th=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ji&&Ji===b)){if((!b||typeof b!="object")&&(b={}),b=Ft(b),Ao=mb.indexOf(b.PARSER_MEDIA_TYPE)===-1?gb:b.PARSER_MEDIA_TYPE,$e=Ao==="application/xhtml+xml"?jh:Oc,Te=et(b,"ALLOWED_TAGS")?Y({},b.ALLOWED_TAGS,$e):Dp,xe=et(b,"ALLOWED_ATTR")?Y({},b.ALLOWED_ATTR,$e):Lp,eh=et(b,"ALLOWED_NAMESPACES")?Y({},b.ALLOWED_NAMESPACES,jh):fb,Xu=et(b,"ADD_URI_SAFE_ATTR")?Y(Ft(Hp),b.ADD_URI_SAFE_ATTR,$e):Hp,Zp=et(b,"ADD_DATA_URI_TAGS")?Y(Ft(Fp),b.ADD_DATA_URI_TAGS,$e):Fp,zt=et(b,"FORBID_CONTENTS")?Y({},b.FORBID_CONTENTS,$e):Ju,_o=et(b,"FORBID_TAGS")?Y({},b.FORBID_TAGS,$e):Ft({}),Tl=et(b,"FORBID_ATTR")?Y({},b.FORBID_ATTR,$e):Ft({}),Yi=et(b,"USE_PROFILES")?b.USE_PROFILES:!1,Op=b.ALLOW_ARIA_ATTR!==!1,Wu=b.ALLOW_DATA_ATTR!==!1,zp=b.ALLOW_UNKNOWN_PROTOCOLS||!1,Np=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Wi=b.SAFE_FOR_TEMPLATES||!1,Rl=b.SAFE_FOR_XML!==!1,Fr=b.WHOLE_DOCUMENT||!1,Gi=b.RETURN_DOM||!1,Il=b.RETURN_DOM_FRAGMENT||!1,xl=b.RETURN_TRUSTED_TYPE||!1,Yu=b.FORCE_BODY||!1,Mp=b.SANITIZE_DOM!==!1,Up=b.SANITIZE_NAMED_PROPS||!1,Ku=b.KEEP_CONTENT!==!1,So=b.IN_PLACE||!1,Pp=b.ALLOWED_URI_REGEXP||b2,Ki=b.NAMESPACE||_n,Ll=b.MATHML_TEXT_INTEGRATION_POINTS||Ll,Ol=b.HTML_INTEGRATION_POINTS||Ol,be=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&Vp(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(be.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&Vp(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(be.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(be.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Wi&&(Wu=!1),Il&&(Gi=!0),Yi&&(Te=Y({},qg),xe=Lc(null),Yi.html===!0&&(Y(Te,Bg),Y(xe,jg)),Yi.svg===!0&&(Y(Te,Gh),Y(xe,Jh),Y(xe,Jl)),Yi.svgFilters===!0&&(Y(Te,Yh),Y(xe,Jh),Y(xe,Jl)),Yi.mathMl===!0&&(Y(Te,Kh),Y(xe,Wg),Y(xe,Jl))),et(b,"ADD_TAGS")||(er.tagCheck=null),et(b,"ADD_ATTR")||(er.attributeCheck=null),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?er.tagCheck=b.ADD_TAGS:(Te===Dp&&(Te=Ft(Te)),Y(Te,b.ADD_TAGS,$e))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?er.attributeCheck=b.ADD_ATTR:(xe===Lp&&(xe=Ft(xe)),Y(xe,b.ADD_ATTR,$e))),b.ADD_URI_SAFE_ATTR&&Y(Xu,b.ADD_URI_SAFE_ATTR,$e),b.FORBID_CONTENTS&&(zt===Ju&&(zt=Ft(zt)),Y(zt,b.FORBID_CONTENTS,$e)),b.ADD_FORBID_CONTENTS&&(zt===Ju&&(zt=Ft(zt)),Y(zt,b.ADD_FORBID_CONTENTS,$e)),Ku&&(Te["#text"]=!0),Fr&&Y(Te,["html","head","body"]),Te.table&&(Y(Te,["tbody"]),delete _o.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Po('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Po('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');F=b.TRUSTED_TYPES_POLICY,W=F.createHTML("")}else F===void 0&&(F=WO(y,i)),F!==null&&typeof W=="string"&&(W=F.createHTML(""));je&&je(b),Ji=b}},Bp=Y({},[...Gh,...Yh,...zO]),qp=Y({},[...Kh,...NO]),yb=function(b){let I=G(b);(!I||!I.tagName)&&(I={namespaceURI:Ki,tagName:"template"});const L=Oc(b.tagName),de=Oc(I.tagName);return eh[b.namespaceURI]?b.namespaceURI===Dl?I.namespaceURI===_n?L==="svg":I.namespaceURI===Pl?L==="svg"&&(de==="annotation-xml"||Ll[de]):!!Bp[L]:b.namespaceURI===Pl?I.namespaceURI===_n?L==="math":I.namespaceURI===Dl?L==="math"&&Ol[de]:!!qp[L]:b.namespaceURI===_n?I.namespaceURI===Dl&&!Ol[de]||I.namespaceURI===Pl&&!Ll[de]?!1:!qp[L]&&(pb[L]||!Bp[L]):!!(Ao==="application/xhtml+xml"&&eh[b.namespaceURI]):!1},Nt=function(b){Io(e.removed,{element:b});try{G(b).removeChild(b)}catch{x(b)}},Hr=function(b,I){try{Io(e.removed,{attribute:I.getAttributeNode(b),from:I})}catch{Io(e.removed,{attribute:null,from:I})}if(I.removeAttribute(b),b==="is")if(Gi||Il)try{Nt(I)}catch{}else try{I.setAttribute(b,"")}catch{}},jp=function(b){let I=null,L=null;if(Yu)b="<remove></remove>"+b;else{const Se=Wh(b,/^[\r\n\t ]+/);L=Se&&Se[0]}Ao==="application/xhtml+xml"&&Ki===_n&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const de=F?F.createHTML(b):b;if(Ki===_n)try{I=new v().parseFromString(de,Ao)}catch{}if(!I||!I.documentElement){I=Q.createDocument(Ki,"template",null);try{I.documentElement.innerHTML=Qu?W:de}catch{}}const ze=I.body||I.documentElement;return b&&L&&ze.insertBefore(t.createTextNode(L),ze.childNodes[0]||null),Ki===_n?yn.call(I,Fr?"html":"body")[0]:Fr?I.documentElement:ze},Wp=function(b){return ee.call(b.ownerDocument||b,b,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},nh=function(b){return b instanceof m&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof f)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},Gp=function(b){return typeof l=="function"&&b instanceof l};function Sn(U,b,I){Kl(U,L=>{L.call(e,b,I,Ji)})}const Yp=function(b){let I=null;if(Sn(we.beforeSanitizeElements,b,null),nh(b))return Nt(b),!0;const L=$e(b.nodeName);if(Sn(we.uponSanitizeElement,b,{tagName:L,allowedTags:Te}),Rl&&b.hasChildNodes()&&!Gp(b.firstElementChild)&&Ue(/<[/\w!]/g,b.innerHTML)&&Ue(/<[/\w!]/g,b.textContent)||b.nodeType===Lo.progressingInstruction||Rl&&b.nodeType===Lo.comment&&Ue(/<[/\w]/g,b.data))return Nt(b),!0;if(!(er.tagCheck instanceof Function&&er.tagCheck(L))&&(!Te[L]||_o[L])){if(!_o[L]&&Jp(L)&&(be.tagNameCheck instanceof RegExp&&Ue(be.tagNameCheck,L)||be.tagNameCheck instanceof Function&&be.tagNameCheck(L)))return!1;if(Ku&&!zt[L]){const de=G(b)||b.parentNode,ze=Z(b)||b.childNodes;if(ze&&de){const Se=ze.length;for(let Ge=Se-1;Ge>=0;--Ge){const An=S(ze[Ge],!0);An.__removalCount=(b.__removalCount||0)+1,de.insertBefore(An,M(b))}}}return Nt(b),!0}return b instanceof c&&!yb(b)||(L==="noscript"||L==="noembed"||L==="noframes")&&Ue(/<\/no(script|embed|frames)/i,b.innerHTML)?(Nt(b),!0):(Wi&&b.nodeType===Lo.text&&(I=b.textContent,Kl([bn,Ot,Qn],de=>{I=xo(I,de," ")}),b.textContent!==I&&(Io(e.removed,{element:b.cloneNode()}),b.textContent=I)),Sn(we.afterSanitizeElements,b,null),!1)},Kp=function(b,I,L){if(Tl[I]||Mp&&(I==="id"||I==="name")&&(L in t||L in vb))return!1;if(!(Wu&&!Tl[I]&&Ue(ju,I))){if(!(Op&&Ue(Cl,I))){if(!(er.attributeCheck instanceof Function&&er.attributeCheck(I,b))){if(!xe[I]||Tl[I]){if(!(Jp(b)&&(be.tagNameCheck instanceof RegExp&&Ue(be.tagNameCheck,b)||be.tagNameCheck instanceof Function&&be.tagNameCheck(b))&&(be.attributeNameCheck instanceof RegExp&&Ue(be.attributeNameCheck,I)||be.attributeNameCheck instanceof Function&&be.attributeNameCheck(I,b))||I==="is"&&be.allowCustomizedBuiltInElements&&(be.tagNameCheck instanceof RegExp&&Ue(be.tagNameCheck,L)||be.tagNameCheck instanceof Function&&be.tagNameCheck(L))))return!1}else if(!Xu[I]){if(!Ue(Pp,xo(L,xp,""))){if(!((I==="src"||I==="xlink:href"||I==="href")&&b!=="script"&&PO(L,"data:")===0&&Zp[b])){if(!(zp&&!Ue(ub,xo(L,xp,"")))){if(L)return!1}}}}}}}return!0},Jp=function(b){return b!=="annotation-xml"&&Wh(b,hb)},Xp=function(b){Sn(we.beforeSanitizeAttributes,b,null);const{attributes:I}=b;if(!I||nh(b))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:xe,forceKeepAttr:void 0};let de=I.length;for(;de--;){const ze=I[de],{name:Se,namespaceURI:Ge,value:An}=ze,Xi=$e(Se),rh=An;let Pe=Se==="value"?rh:DO(rh);if(L.attrName=Xi,L.attrValue=Pe,L.keepAttr=!0,L.forceKeepAttr=void 0,Sn(we.uponSanitizeAttribute,b,L),Pe=L.attrValue,Up&&(Xi==="id"||Xi==="name")&&(Hr(Se,b),Pe=db+Pe),Rl&&Ue(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Pe)){Hr(Se,b);continue}if(Xi==="attributename"&&Wh(Pe,"href")){Hr(Se,b);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){Hr(Se,b);continue}if(!Np&&Ue(/\/>/i,Pe)){Hr(Se,b);continue}Wi&&Kl([bn,Ot,Qn],e0=>{Pe=xo(Pe,e0," ")});const Qp=$e(b.nodeName);if(!Kp(Qp,Xi,Pe)){Hr(Se,b);continue}if(F&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!Ge)switch(y.getAttributeType(Qp,Xi)){case"TrustedHTML":{Pe=F.createHTML(Pe);break}case"TrustedScriptURL":{Pe=F.createScriptURL(Pe);break}}if(Pe!==rh)try{Ge?b.setAttributeNS(Ge,Se,Pe):b.setAttribute(Se,Pe),nh(b)?Nt(b):Vg(e.removed)}catch{Hr(Se,b)}}Sn(we.afterSanitizeAttributes,b,null)},wb=function U(b){let I=null;const L=Wp(b);for(Sn(we.beforeSanitizeShadowDOM,b,null);I=L.nextNode();)Sn(we.uponSanitizeShadowNode,I,null),Yp(I),Xp(I),I.content instanceof s&&U(I.content);Sn(we.afterSanitizeShadowDOM,b,null)};return e.sanitize=function(U){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=null,L=null,de=null,ze=null;if(Qu=!U,Qu&&(U="<!-->"),typeof U!="string"&&!Gp(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw Po("dirty is not a string, aborting")}else throw Po("toString is not a function");if(!e.isSupported)return U;if(Gu||th(b),e.removed=[],typeof U=="string"&&(So=!1),So){if(U.nodeName){const An=$e(U.nodeName);if(!Te[An]||_o[An])throw Po("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof l)I=jp("<!---->"),L=I.ownerDocument.importNode(U,!0),L.nodeType===Lo.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?I=L:I.appendChild(L);else{if(!Gi&&!Wi&&!Fr&&U.indexOf("<")===-1)return F&&xl?F.createHTML(U):U;if(I=jp(U),!I)return Gi?null:xl?W:""}I&&Yu&&Nt(I.firstChild);const Se=Wp(So?U:I);for(;de=Se.nextNode();)Yp(de),Xp(de),de.content instanceof s&&wb(de.content);if(So)return U;if(Gi){if(Il)for(ze=oe.call(I.ownerDocument);I.firstChild;)ze.appendChild(I.firstChild);else ze=I;return(xe.shadowroot||xe.shadowrootmode)&&(ze=wn.call(r,ze,!0)),ze}let Ge=Fr?I.outerHTML:I.innerHTML;return Fr&&Te["!doctype"]&&I.ownerDocument&&I.ownerDocument.doctype&&I.ownerDocument.doctype.name&&Ue(_2,I.ownerDocument.doctype.name)&&(Ge="<!DOCTYPE "+I.ownerDocument.doctype.name+`>
355
- `+Ge),Wi&&Kl([bn,Ot,Qn],An=>{Ge=xo(Ge,An," ")}),F&&xl?F.createHTML(Ge):Ge},e.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};th(U),Gu=!0},e.clearConfig=function(){Ji=null,Gu=!1},e.isValidAttribute=function(U,b,I){Ji||th({});const L=$e(U),de=$e(b);return Kp(L,de,I)},e.addHook=function(U,b){typeof b=="function"&&Io(we[U],b)},e.removeHook=function(U,b){if(b!==void 0){const I=IO(we[U],b);return I===-1?void 0:xO(we[U],I,1)[0]}return Vg(we[U])},e.removeHooks=function(U){we[U]=[]},e.removeAllHooks=function(){we=Yg()},e}var A2=S2();function yp(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ji=yp();function k2(n){ji=n}var Kr={exec:()=>null};function X(n,e=""){let t=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Be.caret,"$1"),t=t.replace(i,o),r},getRegex:()=>new RegExp(t,e)};return r}var GO=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Be={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}>`)},YO=/^(?:[ \t]*(?:\n|$))+/,KO=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,JO=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,$l=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,XO=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,wp=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,E2=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,$2=X(E2).replace(/bull/g,wp).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),QO=X(E2).replace(/bull/g,wp).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),bp=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ez=/^[^\n]+/,_p=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,tz=X(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_p).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),nz=X(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,wp).getRegex(),Bu="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Sp=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,rz=X("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Sp).replace("tag",Bu).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),C2=X(bp).replace("hr",$l).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Bu).getRegex(),iz=X(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",C2).getRegex(),Ap={blockquote:iz,code:KO,def:tz,fences:JO,heading:XO,hr:$l,html:rz,lheading:$2,list:nz,newline:YO,paragraph:C2,table:Kr,text:ez},Kg=X("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",$l).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Bu).getRegex(),sz={...Ap,lheading:QO,table:Kg,paragraph:X(bp).replace("hr",$l).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Kg).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Bu).getRegex()},oz={...Ap,html:X(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Sp).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Kr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:X(bp).replace("hr",$l).replace("heading",` *#{1,6} *[^
356
- ]`).replace("lheading",$2).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},az=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,lz=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,T2=/^( {2,}|\\)\n(?!\s*$)/,cz=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,bo=/[\p{P}\p{S}]/u,qu=/[\s\p{P}\p{S}]/u,kp=/[^\s\p{P}\p{S}]/u,uz=X(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,qu).getRegex(),R2=/(?!~)[\p{P}\p{S}]/u,hz=/(?!~)[\s\p{P}\p{S}]/u,dz=/(?:[^\s\p{P}\p{S}]|~)/u,fz=X(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",GO?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),I2=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,pz=X(I2,"u").replace(/punct/g,bo).getRegex(),mz=X(I2,"u").replace(/punct/g,R2).getRegex(),x2="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",gz=X(x2,"gu").replace(/notPunctSpace/g,kp).replace(/punctSpace/g,qu).replace(/punct/g,bo).getRegex(),vz=X(x2,"gu").replace(/notPunctSpace/g,dz).replace(/punctSpace/g,hz).replace(/punct/g,R2).getRegex(),yz=X("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,kp).replace(/punctSpace/g,qu).replace(/punct/g,bo).getRegex(),wz=X(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,bo).getRegex(),bz="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",_z=X(bz,"gu").replace(/notPunctSpace/g,kp).replace(/punctSpace/g,qu).replace(/punct/g,bo).getRegex(),Sz=X(/\\(punct)/,"gu").replace(/punct/g,bo).getRegex(),Az=X(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),kz=X(Sp).replace("(?:-->|$)","-->").getRegex(),Ez=X("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",kz).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Xc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,$z=X(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Xc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),P2=X(/^!?\[(label)\]\[(ref)\]/).replace("label",Xc).replace("ref",_p).getRegex(),D2=X(/^!?\[(ref)\](?:\[\])?/).replace("ref",_p).getRegex(),Cz=X("reflink|nolink(?!\\()","g").replace("reflink",P2).replace("nolink",D2).getRegex(),Jg=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ep={_backpedal:Kr,anyPunctuation:Sz,autolink:Az,blockSkip:fz,br:T2,code:lz,del:Kr,delLDelim:Kr,delRDelim:Kr,emStrongLDelim:pz,emStrongRDelimAst:gz,emStrongRDelimUnd:yz,escape:az,link:$z,nolink:D2,punctuation:uz,reflink:P2,reflinkSearch:Cz,tag:Ez,text:cz,url:Kr},Tz={...Ep,link:X(/^!?\[(label)\]\((.*?)\)/).replace("label",Xc).getRegex(),reflink:X(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Xc).getRegex()},hf={...Ep,emStrongRDelimAst:vz,emStrongLDelim:mz,delLDelim:wz,delRDelim:_z,url:X(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Jg).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:X(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Jg).getRegex()},Rz={...hf,br:X(T2).replace("{2,}","*").getRegex(),text:X(hf.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Xl={normal:Ap,gfm:sz,pedantic:oz},Oo={normal:Ep,gfm:hf,breaks:Rz,pedantic:Tz},Iz={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Xg=n=>Iz[n];function Ht(n,e){if(e){if(Be.escapeTest.test(n))return n.replace(Be.escapeReplace,Xg)}else if(Be.escapeTestNoEncode.test(n))return n.replace(Be.escapeReplaceNoEncode,Xg);return n}function Qg(n){try{n=encodeURI(n).replace(Be.percentDecode,"%")}catch{return null}return n}function e1(n,e){var s;let t=n.replace(Be.findPipe,(o,l,c)=>{let u=!1,f=l;for(;--f>=0&&c[f]==="\\";)u=!u;return u?"|":" |"}),r=t.split(Be.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Be.slashPipe,"|");return r}function zo(n,e,t){let r=n.length;if(r===0)return"";let i=0;for(;i<r&&n.charAt(r-i-1)===e;)i++;return n.slice(0,r-i)}function xz(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===e[0])t++;else if(n[r]===e[1]&&(t--,t<0))return r;return t>0?-2:-1}function Pz(n,e=0){let t=e,r="";for(let i of n)if(i===" "){let s=4-t%4;r+=" ".repeat(s),t+=s}else r+=i,t++;return r}function t1(n,e,t,r,i){let s=e.href,o=e.title||null,l=n[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,c}function Dz(n,e,t){let r=n.match(t.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
357
- `).map(s=>{let o=s.match(t.other.beginningSpace);if(o===null)return s;let[l]=o;return l.length>=i.length?s.slice(i.length):s}).join(`
358
- `)}var Qc=class{constructor(n){$(this,"options");$(this,"rules");$(this,"lexer");this.options=n||ji}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:zo(t,`
359
- `)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=Dz(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let r=zo(t,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(t=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:zo(e[0],`
360
- `)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=zo(e[0],`
361
- `).split(`
362
- `),r="",i="",s=[];for(;t.length>0;){let o=!1,l=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))l.push(t[c]),o=!0;else if(!o)l.push(t[c]);else break;t=t.slice(c);let u=l.join(`
363
- `),f=u.replace(this.rules.other.blockquoteSetextReplace,`
364
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
365
- ${u}`:u,i=i?`${i}
366
- ${f}`:f;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(f,s,!0),this.lexer.state.top=m,t.length===0)break;let v=s.at(-1);if((v==null?void 0:v.type)==="code")break;if((v==null?void 0:v.type)==="blockquote"){let y=v,k=y.raw+`
367
- `+t.join(`
368
- `),S=this.blockquote(k);s[s.length-1]=S,r=r.substring(0,r.length-y.raw.length)+S.raw,i=i.substring(0,i.length-y.text.length)+S.text;break}else if((v==null?void 0:v.type)==="list"){let y=v,k=y.raw+`
369
- `+t.join(`
370
- `),S=this.list(k);s[s.length-1]=S,r=r.substring(0,r.length-v.raw.length)+S.raw,i=i.substring(0,i.length-y.raw.length)+S.raw,t=k.substring(s.at(-1).raw.length).split(`
371
- `);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(n){var t,r;let e=this.rules.block.list.exec(n);if(e){let i=e[1].trim(),s=i.length>1,o={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let l=this.rules.other.listItemRegex(i),c=!1;for(;n;){let f=!1,m="",v="";if(!(e=l.exec(n))||this.rules.block.hr.test(n))break;m=e[0],n=n.substring(m.length);let y=Pz(e[2].split(`
372
- `,1)[0],e[1].length),k=n.split(`
373
- `,1)[0],S=!y.trim(),x=0;if(this.options.pedantic?(x=2,v=y.trimStart()):S?x=e[1].length+1:(x=y.search(this.rules.other.nonSpaceChar),x=x>4?1:x,v=y.slice(x),x+=e[1].length),S&&this.rules.other.blankLine.test(k)&&(m+=k+`
374
- `,n=n.substring(k.length+1),f=!0),!f){let M=this.rules.other.nextBulletRegex(x),Z=this.rules.other.hrRegex(x),G=this.rules.other.fencesBeginRegex(x),F=this.rules.other.headingBeginRegex(x),W=this.rules.other.htmlBeginRegex(x),Q=this.rules.other.blockquoteBeginRegex(x);for(;n;){let ee=n.split(`
375
- `,1)[0],oe;if(k=ee,this.options.pedantic?(k=k.replace(this.rules.other.listReplaceNesting," "),oe=k):oe=k.replace(this.rules.other.tabCharGlobal," "),G.test(k)||F.test(k)||W.test(k)||Q.test(k)||M.test(k)||Z.test(k))break;if(oe.search(this.rules.other.nonSpaceChar)>=x||!k.trim())v+=`
376
- `+oe.slice(x);else{if(S||y.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||G.test(y)||F.test(y)||Z.test(y))break;v+=`
377
- `+k}S=!k.trim(),m+=ee+`
378
- `,n=n.substring(ee.length+1),y=oe.slice(x)}}o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(c=!0)),o.items.push({type:"list_item",raw:m,task:!!this.options.gfm&&this.rules.other.listIsTask.test(v),loose:!1,text:v,tokens:[]}),o.raw+=m}let u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let f of o.items){if(this.lexer.state.top=!1,f.tokens=this.lexer.blockTokens(f.text,[]),f.task){if(f.text=f.text.replace(this.rules.other.listReplaceTask,""),((t=f.tokens[0])==null?void 0:t.type)==="text"||((r=f.tokens[0])==null?void 0:r.type)==="paragraph"){f.tokens[0].raw=f.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),f.tokens[0].text=f.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let v=this.lexer.inlineQueue.length-1;v>=0;v--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[v].src)){this.lexer.inlineQueue[v].src=this.lexer.inlineQueue[v].src.replace(this.rules.other.listReplaceTask,"");break}}let m=this.rules.other.listTaskCheckbox.exec(f.raw);if(m){let v={type:"checkbox",raw:m[0]+" ",checked:m[0]!=="[ ]"};f.checked=v.checked,o.loose?f.tokens[0]&&["paragraph","text"].includes(f.tokens[0].type)&&"tokens"in f.tokens[0]&&f.tokens[0].tokens?(f.tokens[0].raw=v.raw+f.tokens[0].raw,f.tokens[0].text=v.raw+f.tokens[0].text,f.tokens[0].tokens.unshift(v)):f.tokens.unshift({type:"paragraph",raw:v.raw,text:v.raw,tokens:[v]}):f.tokens.unshift(v)}}if(!o.loose){let m=f.tokens.filter(y=>y.type==="space"),v=m.length>0&&m.some(y=>this.rules.other.anyLine.test(y.raw));o.loose=v}}if(o.loose)for(let f of o.items){f.loose=!0;for(let m of f.tokens)m.type==="text"&&(m.type="paragraph")}return o}}html(n){let e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:r,title:i}}}table(n){var o;let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=e1(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
379
- `):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===r.length){for(let l of r)this.rules.other.tableAlignRight.test(l)?s.align.push("right"):this.rules.other.tableAlignCenter.test(l)?s.align.push("center"):this.rules.other.tableAlignLeft.test(l)?s.align.push("left"):s.align.push(null);for(let l=0;l<t.length;l++)s.header.push({text:t[l],tokens:this.lexer.inline(t[l]),header:!0,align:s.align[l]});for(let l of i)s.rows.push(e1(l,s.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:s.align[u]})));return s}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
380
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=zo(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=xz(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?r=r.slice(1):r=r.slice(1,-1)),t1(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let r=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){let s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return t1(t,i,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...r[0]].length-1,s,o,l=i,c=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*n.length+i);(r=u.exec(e))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(o=[...s].length,r[3]||r[4]){l+=o;continue}else if((r[5]||r[6])&&i%3&&!((i+o)%3)){c+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+c);let f=[...r[0]][0].length,m=n.slice(0,i+r.index+f+o);if(Math.min(i,o)%2){let y=m.slice(1,-1);return{type:"em",raw:m,text:y,tokens:this.lexer.inlineTokens(y)}}let v=m.slice(2,-2);return{type:"strong",raw:m,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return r&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let r=this.rules.inline.delLDelim.exec(n);if(r&&(!r[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...r[0]].length-1,s,o,l=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*n.length+i);(r=c.exec(e))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(o=[...s].length,o!==i))continue;if(r[3]||r[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let u=[...r[0]][0].length,f=n.slice(0,i+r.index+u+o),m=f.slice(i,-i);return{type:"del",raw:f,text:m,tokens:this.lexer.inlineTokens(m)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,r;return e[2]==="@"?(t=e[1],r="mailto:"+t):(t=e[1],r=t),{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(n){var t;let e;if(e=this.rules.inline.url.exec(n)){let r,i;if(e[2]==="@")r=e[0],i="mailto:"+r;else{let s;do s=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(s!==e[0]);r=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},It=class df{constructor(e){$(this,"tokens");$(this,"options");$(this,"state");$(this,"inlineQueue");$(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ji,this.options.tokenizer=this.options.tokenizer||new Qc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Be,block:Xl.normal,inline:Oo.normal};this.options.pedantic?(t.block=Xl.pedantic,t.inline=Oo.pedantic):this.options.gfm&&(t.block=Xl.gfm,this.options.breaks?t.inline=Oo.breaks:t.inline=Oo.gfm),this.tokenizer.rules=t}static get rules(){return{block:Xl,inline:Oo}}static lex(e,t){return new df(t).lex(e)}static lexInline(e,t){return new df(t).inlineTokens(e)}lex(e){e=e.replace(Be.carriageReturn,`
381
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){var i,s,o;for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Be.tabCharGlobal," ").replace(Be.spaceLine,""));e;){let l;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(u=>(l=u.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.space(e)){e=e.substring(l.raw.length);let u=t.at(-1);l.raw.length===1&&u!==void 0?u.raw+=`
382
- `:t.push(l);continue}if(l=this.tokenizer.code(e)){e=e.substring(l.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
383
- `)?"":`
384
- `)+l.raw,u.text+=`
385
- `+l.text,this.inlineQueue.at(-1).src=u.text):t.push(l);continue}if(l=this.tokenizer.fences(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.heading(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.hr(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.blockquote(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.list(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.html(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.def(e)){e=e.substring(l.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
386
- `)?"":`
387
- `)+l.raw,u.text+=`
388
- `+l.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},t.push(l));continue}if(l=this.tokenizer.table(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.lheading(e)){e=e.substring(l.raw.length),t.push(l);continue}let c=e;if((o=this.options.extensions)!=null&&o.startBlock){let u=1/0,f=e.slice(1),m;this.options.extensions.startBlock.forEach(v=>{m=v.call({lexer:this},f),typeof m=="number"&&m>=0&&(u=Math.min(u,m))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(this.state.top&&(l=this.tokenizer.paragraph(c))){let u=t.at(-1);r&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(`
389
- `)?"":`
390
- `)+l.raw,u.text+=`
391
- `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(l),r=c.length!==e.length,e=e.substring(l.raw.length);continue}if(l=this.tokenizer.text(e)){e=e.substring(l.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
392
- `)?"":`
393
- `)+l.raw,u.text+=`
394
- `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(l);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var c,u,f,m,v;this.tokenizer.lexer=this;let r=e,i=null;if(this.tokens.links){let y=Object.keys(this.tokens.links);if(y.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)y.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)s=i[2]?i[2].length:0,r=r.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((u=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:u.call({lexer:this},r))??r;let o=!1,l="";for(;e;){o||(l=""),o=!1;let y;if((m=(f=this.options.extensions)==null?void 0:f.inline)!=null&&m.some(S=>(y=S.call({lexer:this},e,t))?(e=e.substring(y.raw.length),t.push(y),!0):!1))continue;if(y=this.tokenizer.escape(e)){e=e.substring(y.raw.length),t.push(y);continue}if(y=this.tokenizer.tag(e)){e=e.substring(y.raw.length),t.push(y);continue}if(y=this.tokenizer.link(e)){e=e.substring(y.raw.length),t.push(y);continue}if(y=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(y.raw.length);let S=t.at(-1);y.type==="text"&&(S==null?void 0:S.type)==="text"?(S.raw+=y.raw,S.text+=y.text):t.push(y);continue}if(y=this.tokenizer.emStrong(e,r,l)){e=e.substring(y.raw.length),t.push(y);continue}if(y=this.tokenizer.codespan(e)){e=e.substring(y.raw.length),t.push(y);continue}if(y=this.tokenizer.br(e)){e=e.substring(y.raw.length),t.push(y);continue}if(y=this.tokenizer.del(e,r,l)){e=e.substring(y.raw.length),t.push(y);continue}if(y=this.tokenizer.autolink(e)){e=e.substring(y.raw.length),t.push(y);continue}if(!this.state.inLink&&(y=this.tokenizer.url(e))){e=e.substring(y.raw.length),t.push(y);continue}let k=e;if((v=this.options.extensions)!=null&&v.startInline){let S=1/0,x=e.slice(1),M;this.options.extensions.startInline.forEach(Z=>{M=Z.call({lexer:this},x),typeof M=="number"&&M>=0&&(S=Math.min(S,M))}),S<1/0&&S>=0&&(k=e.substring(0,S+1))}if(y=this.tokenizer.inlineText(k)){e=e.substring(y.raw.length),y.raw.slice(-1)!=="_"&&(l=y.raw.slice(-1)),o=!0;let S=t.at(-1);(S==null?void 0:S.type)==="text"?(S.raw+=y.raw,S.text+=y.text):t.push(y);continue}if(e){let S="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(S);break}else throw new Error(S)}}return t}},eu=class{constructor(n){$(this,"options");$(this,"parser");this.options=n||ji}space(n){return""}code({text:n,lang:e,escaped:t}){var s;let r=(s=(e||"").match(Be.notSpaceStart))==null?void 0:s[0],i=n.replace(Be.endingNewline,"")+`
395
- `;return r?'<pre><code class="language-'+Ht(r)+'">'+(t?i:Ht(i,!0))+`</code></pre>
396
- `:"<pre><code>"+(t?i:Ht(i,!0))+`</code></pre>
397
- `}blockquote({tokens:n}){return`<blockquote>
398
- ${this.parser.parse(n)}</blockquote>
399
- `}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
400
- `}hr(n){return`<hr>
401
- `}list(n){let e=n.ordered,t=n.start,r="";for(let o=0;o<n.items.length;o++){let l=n.items[o];r+=this.listitem(l)}let i=e?"ol":"ul",s=e&&t!==1?' start="'+t+'"':"";return"<"+i+s+`>
402
- `+r+"</"+i+`>
403
- `}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
404
- `}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
405
- `}table(n){let e="",t="";for(let i=0;i<n.header.length;i++)t+=this.tablecell(n.header[i]);e+=this.tablerow({text:t});let r="";for(let i=0;i<n.rows.length;i++){let s=n.rows[i];t="";for(let o=0;o<s.length;o++)t+=this.tablecell(s[o]);r+=this.tablerow({text:t})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
406
- <thead>
407
- `+e+`</thead>
408
- `+r+`</table>
409
- `}tablerow({text:n}){return`<tr>
410
- ${n}</tr>
411
- `}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
412
- `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${Ht(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let r=this.parser.parseInline(t),i=Qg(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return e&&(s+=' title="'+Ht(e)+'"'),s+=">"+r+"</a>",s}image({href:n,title:e,text:t,tokens:r}){r&&(t=this.parser.parseInline(r,this.parser.textRenderer));let i=Qg(n);if(i===null)return Ht(t);n=i;let s=`<img src="${n}" alt="${Ht(t)}"`;return e&&(s+=` title="${Ht(e)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:Ht(n.text)}},$p=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},xt=class ff{constructor(e){$(this,"options");$(this,"renderer");$(this,"textRenderer");this.options=e||ji,this.options.renderer=this.options.renderer||new eu,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new $p}static parse(e,t){return new ff(t).parse(e)}static parseInline(e,t){return new ff(t).parseInline(e)}parse(e){var r,i;this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let o=e[s];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){let c=o,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){t+=u||"";continue}}let l=o;switch(l.type){case"space":{t+=this.renderer.space(l);break}case"hr":{t+=this.renderer.hr(l);break}case"heading":{t+=this.renderer.heading(l);break}case"code":{t+=this.renderer.code(l);break}case"table":{t+=this.renderer.table(l);break}case"blockquote":{t+=this.renderer.blockquote(l);break}case"list":{t+=this.renderer.list(l);break}case"checkbox":{t+=this.renderer.checkbox(l);break}case"html":{t+=this.renderer.html(l);break}case"def":{t+=this.renderer.def(l);break}case"paragraph":{t+=this.renderer.paragraph(l);break}case"text":{t+=this.renderer.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return t}parseInline(e,t=this.renderer){var i,s;this.renderer.parser=this;let r="";for(let o=0;o<e.length;o++){let l=e[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[l.type]){let u=this.options.extensions.renderers[l.type].call({parser:this},l);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){r+=u||"";continue}}let c=l;switch(c.type){case"escape":{r+=t.text(c);break}case"html":{r+=t.html(c);break}case"link":{r+=t.link(c);break}case"image":{r+=t.image(c);break}case"checkbox":{r+=t.checkbox(c);break}case"strong":{r+=t.strong(c);break}case"em":{r+=t.em(c);break}case"codespan":{r+=t.codespan(c);break}case"br":{r+=t.br(c);break}case"del":{r+=t.del(c);break}case"text":{r+=t.text(c);break}default:{let u='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},ic,Jo=(ic=class{constructor(n){$(this,"options");$(this,"block");this.options=n||ji}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?It.lex:It.lexInline}provideParser(){return this.block?xt.parse:xt.parseInline}},$(ic,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),$(ic,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),ic),Lz=class{constructor(...n){$(this,"defaults",yp());$(this,"options",this.setOptions);$(this,"parse",this.parseMarkdown(!0));$(this,"parseInline",this.parseMarkdown(!1));$(this,"Parser",xt);$(this,"Renderer",eu);$(this,"TextRenderer",$p);$(this,"Lexer",It);$(this,"Tokenizer",Qc);$(this,"Hooks",Jo);this.use(...n)}walkTokens(n,e){var r,i;let t=[];for(let s of n)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let o=s;for(let l of o.header)t=t.concat(this.walkTokens(l.tokens,e));for(let l of o.rows)for(let c of l)t=t.concat(this.walkTokens(c.tokens,e));break}case"list":{let o=s;t=t.concat(this.walkTokens(o.items,e));break}default:{let o=s;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{let c=o[l].flat(1/0);t=t.concat(this.walkTokens(c,e))}):o.tokens&&(t=t.concat(this.walkTokens(o.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let r={...t};if(r.async=this.defaults.async||r.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=s.apply(this,o)),l}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),t.renderer){let i=this.defaults.renderer||new eu(this.defaults);for(let s in t.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,l=t.renderer[o],c=i[o];i[o]=(...u)=>{let f=l.apply(i,u);return f===!1&&(f=c.apply(i,u)),f||""}}r.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new Qc(this.defaults);for(let s in t.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,l=t.tokenizer[o],c=i[o];i[o]=(...u)=>{let f=l.apply(i,u);return f===!1&&(f=c.apply(i,u)),f}}r.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Jo;for(let s in t.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,l=t.hooks[o],c=i[o];Jo.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&Jo.passThroughHooksRespectAsync.has(s))return(async()=>{let m=await l.call(i,u);return c.call(i,m)})();let f=l.call(i,u);return c.call(i,f)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let m=await l.apply(i,u);return m===!1&&(m=await c.apply(i,u)),m})();let f=l.apply(i,u);return f===!1&&(f=c.apply(i,u)),f}}r.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,s=t.walkTokens;r.walkTokens=function(o){let l=[];return l.push(s.call(this,o)),i&&(l=l.concat(i.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return It.lex(n,e??this.defaults)}parser(n,e){return xt.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let r={...t},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=n),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,l=await(i.hooks?await i.hooks.provideLexer():n?It.lex:It.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():n?xt.parse:xt.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer():n?It.lex:It.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():n?xt.parse:xt.parseInline)(o,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(o){return s(o)}}}onError(n,e){return t=>{if(t.message+=`
413
- Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+Ht(t.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(t);throw t}}},Hi=new Lz;function le(n,e){return Hi.parse(n,e)}le.options=le.setOptions=function(n){return Hi.setOptions(n),le.defaults=Hi.defaults,k2(le.defaults),le};le.getDefaults=yp;le.defaults=ji;le.use=function(...n){return Hi.use(...n),le.defaults=Hi.defaults,k2(le.defaults),le};le.walkTokens=function(n,e){return Hi.walkTokens(n,e)};le.parseInline=Hi.parseInline;le.Parser=xt;le.parser=xt.parse;le.Renderer=eu;le.TextRenderer=$p;le.Lexer=It;le.lexer=It.lex;le.Tokenizer=Qc;le.Hooks=Jo;le.parse=le;le.options;le.setOptions;le.use;le.walkTokens;le.parseInline;xt.parse;It.lex;A2.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function L2(n){const e=le.parse(n,{async:!1});return A2.sanitize(e,{USE_PROFILES:{html:!0}})}var Ci,rl;class Oz extends At{constructor(){super(...arguments);g(this,Ci,null);g(this,rl,Rr())}connected(){queueMicrotask(()=>{var r;if(!this.isConnected||a(this,Ci)!==null)return;const t=((r=a(this,rl).value)==null?void 0:r.querySelector("dialog"))??null;if(t===null)throw new Error("Desktop upgrade gate requires its composed dialog");d(this,Ci,Vu(t,()=>{}))})}disconnected(){var t;(t=a(this,Ci))==null||t.withdraw(),d(this,Ci,null)}template(t){return V`
414
- <div class="desktop-upgrade-gate" ${mn(a(this,rl))}>
415
- ${Hu(V`<div class="upgrade-gate-body" data-testid="upgrade-gate-body">${y2(L2(fw(t)))}</div>`,{overlay:!0})}
416
- </div>
417
- `}}Ci=new WeakMap,rl=new WeakMap;const zz=kt(Oz),Nz=250,Mz=1e3;var cn,un,Ti,br,Ri,Ws,Dt,O2,hu,du,z2,pf,N2;class Uz extends At{constructor(){super(...arguments);g(this,Dt);g(this,cn,Fz());g(this,un,null);g(this,Ti,!1);g(this,br,null);g(this,Ri,"");g(this,Ws,null);g(this,hu,t=>{d(this,Ri,t.currentTarget.value)});g(this,du,t=>{t.preventDefault();const r=a(this,Ri).trim();r.length===0||a(this,Ws)===null||a(this,Ws).authenticate(r)})}disconnected(){var t;h(this,Dt,pf).call(this),(t=a(this,un))==null||t.withdraw(),d(this,un,null),d(this,Ti,!1),_c(null,a(this,cn))}template(t,r){var i;return d(this,Ws,r),h(this,Dt,z2).call(this,t),t.kind==="needs-upgrade"?((i=a(this,un))==null||i.withdraw(),d(this,un,null),_c(zz(t.instructions),a(this,cn)),a(this,cn)):(_c(Hu(h(this,Dt,O2).call(this,t),{overlay:!0}),a(this,cn)),h(this,Dt,N2).call(this),a(this,cn))}}cn=new WeakMap,un=new WeakMap,Ti=new WeakMap,br=new WeakMap,Ri=new WeakMap,Ws=new WeakMap,Dt=new WeakSet,O2=function(t){switch(t.kind){case"connecting":return V`
418
- <div class="system-modal" role="status" aria-live="polite">
419
- <tv-icon name="spinner" size="xl" spinning></tv-icon>
420
- <h2>Connecting</h2>
421
- </div>
422
- `;case"disconnected":return V`
423
- <div class="system-modal" role="status" aria-live="polite">
424
- <tv-icon name="spinner" size="xl" spinning></tv-icon>
425
- <h2>Disconnected</h2>
426
- <p>${Hz(t.nextRetryAt)}</p>
427
- </div>
428
- `;case"unauthorized":{const r=!!t.invalid;return r&&d(this,Ri,""),V`
429
- <form class="system-modal auth-form" @submit=${a(this,du)}>
430
- <tv-icon name="locked" size="xl"></tv-icon>
431
- <h2>Enter access token</h2>
432
- <p>This server requires an access token to connect.</p>
433
- <input
434
- class=${r?"auth-token invalid":"auth-token"}
435
- type="password"
436
- name="token"
437
- placeholder="paste token here"
438
- aria-label="Access token"
439
- .value=${a(this,Ri)}
440
- @input=${a(this,hu)}
441
- autofocus
442
- required
443
- />
444
- ${r?V`<p class="auth-error" role="alert">
445
- The previous token was rejected. Try again.
446
- </p>`:null}
447
- <button type="submit" variant="primary" class="auth-submit">
448
- Connect
449
- </button>
450
- </form>
451
- `}case"error":return V`
452
- <div class="system-modal">
453
- <h2>Can’t connect with server</h2>
454
- <p class="server-url">${t.serverURL}</p>
455
- <p>${t.message}</p>
456
- </div>
457
- `}},hu=new WeakMap,du=new WeakMap,z2=function(t){const r=t.kind==="disconnected"&&t.nextRetryAt!==null;r&&a(this,br)===null?d(this,br,setInterval(()=>this.render(),Nz)):r||h(this,Dt,pf).call(this)},pf=function(){a(this,br)!==null&&(clearInterval(a(this,br)),d(this,br,null))},N2=function(){a(this,un)!==null||a(this,Ti)||(d(this,Ti,!0),queueMicrotask(()=>{if(d(this,Ti,!1),!this.isConnected||!a(this,cn).isConnected||a(this,un)!==null)return;const t=a(this,cn).querySelector("dialog");t!==null&&d(this,un,Vu(t,()=>{}))}))};const Zz=kt(Uz);function Fz(){const n=document.createElement("section");return n.className="system-modal-host",n}function Hz(n){if(n===null)return"Reattempting now…";const e=n-Date.now();return e<=0?"Reattempting now…":`Reattempting in ${Math.ceil(e/Mz)}s…`}const Vz=1400,Ql=new WeakMap;function Bz(n,e){var s;const t=e.ownerDocument,r=(s=t.defaultView)==null?void 0:s.navigator.clipboard;if(r&&typeof r.writeText=="function"){r.writeText(n).catch(()=>{});return}const i=t.createElement("textarea");i.value=n,i.setAttribute("readonly",""),i.style.position="fixed",i.style.opacity="0",t.body.append(i),i.select();try{t.execCommand("copy")}catch{}i.remove()}const qz={writeClipboard:Bz,scheduler:{setTimeout(n,e){return globalThis.setTimeout(n,e)},clearTimeout(n){globalThis.clearTimeout(n)}}};function jz(n,e,t){const r=n.currentTarget;if(!r)return;e.writeClipboard(r.getAttribute("prompt")??"",r),r.toggleAttribute("copied",!0);const i=r.nextElementSibling,s=i!=null&&i.classList.contains("copy-button-status")?i:null;s&&(s.textContent="",s.textContent="Copied");const o=Ql.get(r);o&&o.scheduler.clearTimeout(o.handle);const l={handle:void 0,scheduler:e.scheduler};l.handle=e.scheduler.setTimeout(()=>{Ql.get(r)===l&&(Ql.delete(r),r.toggleAttribute("copied",!1),s&&(s.textContent=""))},Vz),Ql.set(r,l),t()}function M2({label:n,prompt:e="",variant:t,copied:r=!1,onActivate:i=()=>{}},s=qz){return V`
458
- <button
459
- class="copy-button"
460
- size="sm"
461
- aria-label=${n}
462
- variant=${t??ue}
463
- ?copied=${r}
464
- prompt=${e}
465
- @click=${o=>jz(o,s,i)}
466
- >
467
- <span class="copy-button-idle"><tv-icon name="copy"></tv-icon>${n}</span>
468
- <span class="copy-button-done"><tv-icon name="check"></tv-icon>Copied</span>
469
- </button>
470
- <span
471
- class="copy-button-status"
472
- role="status"
473
- aria-live="polite"
474
- >${r?"Copied":ue}</span
475
- >
476
- `}const n1="tv-update-dismissed",ec={update_available:"Update available",copy_prompt:"Copy upgrade prompt",later:"Later"},r1="update-popover";function U2(n){try{return n.matches(":popover-open")}catch{return!1}}function Wz(n){const e=n.nextElementSibling;return e instanceof HTMLElement&&e.hasAttribute("popover")?e:null}function mf(n){typeof n.hidePopover=="function"&&U2(n)&&n.hidePopover()}function Gz(n,e){const t=n.target;if(!(t instanceof Element))return!1;const r=t.closest("button, a[href], input, select, textarea, [tabindex]");return r!==null&&e.contains(r)}class Yz extends At{template({body:e,prompt:t,copied:r=!1,presented:i=!1,panelRef:s,bellRef:o,onPresent:l=()=>{},onDismiss:c=()=>{},onCopy:u=()=>{}}){const f=y=>{const k=y.currentTarget,S=Wz(k);if(S!==null){if(typeof S.showPopover=="function"){S.addEventListener("toggle",x=>{x.newState==="open"?l():c()},{once:!0});return}i?c():l()}},m=y=>{const S=y.currentTarget.closest("[popover]");S!==null&&mf(S),c()},v=y=>{const k=y.currentTarget;y.key!=="Escape"||!Gz(y,k)||(y.preventDefault(),y.stopPropagation(),mf(k),c())};return V`
477
- <button
478
- class="update-bell"
479
- icon-only
480
- popovertarget=${r1}
481
- aria-label=${ec.update_available}
482
- title=${ec.update_available}
483
- ${mn(o)}
484
- @click=${f}
485
- >
486
- <tv-icon name="notification" size="sm"></tv-icon>
487
- </button>
488
-
489
- <div
490
- id=${r1}
491
- popover="manual"
492
- placement="bottom-end"
493
- role="status"
494
- class="update-popover"
495
- ${mn(s)}
496
- @keydown=${v}
497
- >
498
- ${e}
499
- <div class="update-actions">
500
- <button size="sm" class="update-later" @click=${m}
501
- >${ec.later}</button
502
- >
503
- ${t===void 0?ue:M2({label:ec.copy_prompt,prompt:t,variant:"primary",copied:r,onActivate:u})}
504
- </div>
505
- </div>
506
- `}}const Kz=kt(Yz);function Jz(n,e){return e===null?!0:fv(n,e)}const i1=new Set;var mt,hn,il,Gs,Vn,Ii,xi,Ys,Me,Bn,Pi,Ks,Js,Di,_r,q,gf,vf,yf,wf,bf,sl,Li,Gr,Z2,_f,Sf,Af,fu,pu,mu,gu,vu,Xo,F2;class Xz{constructor(e=()=>{}){g(this,q);g(this,mt,null);g(this,hn,null);g(this,il,"");g(this,Gs);g(this,Vn,!1);g(this,Ii,!1);g(this,xi,!1);g(this,Ys,null);g(this,Me,!1);g(this,Bn,!1);g(this,Pi,null);g(this,Ks,null);g(this,Js,!1);g(this,Di,[]);g(this,_r);g(this,sl,()=>{a(this,_r).call(this)});g(this,Li,()=>{h(this,q,Af).call(this),a(this,_r).call(this)});g(this,fu,()=>{var t,r;const e=((r=(t=h(this,q,Gr).call(this))==null?void 0:t.updateState)==null?void 0:r.toast)??null;e===null||a(this,Me)||(d(this,Me,!0),h(this,q,_f).call(this,e),a(this,_r).call(this))});g(this,pu,()=>{var t,r,i;if(!a(this,Me))return;const e=((r=(t=h(this,q,Gr).call(this))==null?void 0:t.updateState)==null?void 0:r.toast)??null;e!==null&&((i=h(this,q,gf).call(this))==null||i.setItem(n1,e.version)),d(this,Me,!1),d(this,Bn,!0),a(this,_r).call(this)});g(this,mu,()=>{var t,r;const e=((r=(t=h(this,q,Gr).call(this))==null?void 0:t.updateState)==null?void 0:r.toast)??null;(e==null?void 0:e.prompt)!==void 0&&h(this,q,Sf).call(this,"update_prompt_copy_clicked",e)});g(this,gu,e=>{d(this,Pi,e instanceof HTMLElement?e:null),h(this,q,Xo).call(this)});g(this,vu,e=>{d(this,Ks,e instanceof HTMLElement?e:null),h(this,q,Xo).call(this)});d(this,_r,e)}get presented(){return a(this,Me)}configure({connectionOwner:e=null,primaryServerURL:t="",presentation:r=null,dismissalStorage:i}){e!==a(this,mt)&&(h(this,q,yf).call(this),d(this,mt,e),h(this,q,vf).call(this)),r!==a(this,hn)&&(h(this,q,bf).call(this),d(this,hn,r),h(this,q,wf).call(this)),d(this,il,t),d(this,Gs,i)}connect(){a(this,Vn)||(d(this,Vn,!0),h(this,q,vf).call(this),h(this,q,wf).call(this))}disconnect(){a(this,Vn)&&(h(this,q,yf).call(this),h(this,q,bf).call(this),d(this,Vn,!1),d(this,Pi,null),d(this,Ks,null))}template(){var o,l,c,u;const e=((l=(o=h(this,q,Gr).call(this))==null?void 0:o.updateState)==null?void 0:l.toast)??null,t=((c=a(this,hn))==null?void 0:c.toastsSuppressed)??!1;if(e===null?(d(this,Ys,null),d(this,Me,!1),d(this,Bn,!0)):e.version!==a(this,Ys)&&(d(this,Ys,e.version),d(this,Me,Jz(e.version,h(this,q,Z2).call(this))),d(this,Bn,!0),a(this,Me)&&!t&&h(this,q,_f).call(this,e)),e===null||t)return d(this,Me,!1),d(this,Bn,!0),h(this,q,Xo).call(this),ue;const r=(u=a(this,Pi))==null?void 0:u.querySelector(".copy-button"),i=a(this,Me)&&!a(this,Bn)&&(r==null?void 0:r.hasAttribute("copied"))===!0,s=Kz({body:y2(L2(e.markdown)),prompt:e.prompt,copied:i,presented:a(this,Me),panelRef:a(this,gu),bellRef:a(this,vu),onPresent:a(this,fu),onDismiss:a(this,pu),onCopy:a(this,mu)});return d(this,Bn,!1),h(this,q,Xo).call(this),s}}mt=new WeakMap,hn=new WeakMap,il=new WeakMap,Gs=new WeakMap,Vn=new WeakMap,Ii=new WeakMap,xi=new WeakMap,Ys=new WeakMap,Me=new WeakMap,Bn=new WeakMap,Pi=new WeakMap,Ks=new WeakMap,Js=new WeakMap,Di=new WeakMap,_r=new WeakMap,q=new WeakSet,gf=function(){return a(this,Gs)!==void 0?a(this,Gs):typeof localStorage>"u"?null:localStorage},vf=function(){!a(this,Vn)||a(this,Ii)||a(this,mt)===null||(a(this,mt).addEventListener("server-status",a(this,Li)),a(this,mt).addEventListener("change",a(this,Li)),d(this,Ii,!0))},yf=function(){!a(this,Ii)||a(this,mt)===null||(a(this,mt).removeEventListener("server-status",a(this,Li)),a(this,mt).removeEventListener("change",a(this,Li)),d(this,Ii,!1))},wf=function(){!a(this,Vn)||a(this,xi)||a(this,hn)===null||(a(this,hn).addEventListener("change",a(this,sl)),d(this,xi,!0))},bf=function(){!a(this,xi)||a(this,hn)===null||(a(this,hn).removeEventListener("change",a(this,sl)),d(this,xi,!1))},sl=new WeakMap,Li=new WeakMap,Gr=function(){var t;const e=((t=a(this,mt))==null?void 0:t.connection)??null;return(e==null?void 0:e.url)===a(this,il)?e:null},Z2=function(){var t;const e=((t=h(this,q,gf).call(this))==null?void 0:t.getItem(n1))??null;return e!==null&&rp(e)?e:null},_f=function(e){i1.has(e.version)||(i1.add(e.version),h(this,q,Sf).call(this,"update_toast_shown",e))},Sf=function(e,t){var r;a(this,Di).push({event:e,properties:{server_version:((r=h(this,q,Gr).call(this))==null?void 0:r.serverVersion)??"",channel_version:t.version}}),h(this,q,Af).call(this)},Af=function(){if(a(this,Di).length===0)return;const e=h(this,q,Gr).call(this);if(!e||e.status!=="connected")return;const t=a(this,Di);d(this,Di,[]);for(const r of t)e.sendTelemetrySignal(r.event,r.properties)},fu=new WeakMap,pu=new WeakMap,mu=new WeakMap,gu=new WeakMap,vu=new WeakMap,Xo=function(){a(this,Js)||(d(this,Js,!0),queueMicrotask(()=>{d(this,Js,!1),h(this,q,F2).call(this)}))},F2=function(){const e=a(this,Pi);if(e!==null)if(a(this,Me)&&!U2(e)&&typeof e.showPopover=="function"){const t=a(this,Ks);if(t===null)return;e.showPopover({source:t})}else a(this,Me)||mf(e)};const Qz=""+new URL("calendar-DToAnkzj.png",import.meta.url).href,eN=""+new URL("table-oeG9uAN1.png",import.meta.url).href,tN=""+new URL("tasks-D4xqXFPl.png",import.meta.url).href,nN=""+new URL("markdown-DdDrJuVK.png",import.meta.url).href,s1="Artifact skills",rN="Artifact skills",iN="Ready-made starting prompts for creating Television artifacts. Copy one, add the details of what you want, and send it to your agent.",sN="Copy prompt";function tc({artifactSkill:n,name:e,description:t,prompt:r,thumbnail:i},s){return V`
507
- <article class="skill-card">
508
- <div class="skill-thumb"><img src=${i} alt="" /></div>
509
- <div class="skill-name">${e}</div>
510
- <p class="skill-desc">${t}</p>
511
- ${M2({label:sN,prompt:r,onActivate:()=>s==null?void 0:s.sendTelemetrySignal("artifact_skill_prompt_copy_clicked",{artifact_skill:n})})}
512
- </article>
513
- `}class oN extends At{template(e=null){return V`
514
- <button
515
- class="skill-trigger"
516
- variant="ghost"
517
- icon-only
518
- popovertarget="skills-popover"
519
- aria-label=${s1}
520
- title=${s1}
521
- >
522
- <tv-icon name="skills" size="sm"></tv-icon>
523
- </button>
524
-
525
- <div
526
- id="skills-popover"
527
- popover
528
- placement="bottom-end"
529
- class="skill-popover"
530
- >
531
- <div class="skill-heading">${rN}</div>
532
- <p class="skill-intro">${iN}</p>
533
- <div class="skill-grid">
534
- ${tc({artifactSkill:"calendar",name:"Calendar",description:"Visualize your calendar events across day and week views.",prompt:"Use the tv-calendar skill to make a calendar artifact for the following request, and put it on TV: ",thumbnail:Qz},e)}
535
- ${tc({artifactSkill:"table",name:"Table",description:"Beautiful tables with headers, grouping, and chips for displaying data.",prompt:"Use the tv-table skill to make a table artifact for the following request, and put it on TV: ",thumbnail:eN},e)}
536
- ${tc({artifactSkill:"tasks",name:"Tasks",description:"Track tasks and plans in a checklist, with due dates, projects, and labels.",prompt:"Use the tv-tasks skill to make a task list artifact for the following request, and put it on TV: ",thumbnail:tN},e)}
537
- ${tc({artifactSkill:"markdown",name:"Markdown",description:"An interactive markdown editor for Obsidian notes and other formatted docs.",prompt:"Make a markdown artifact for the following request, and put it on TV: ",thumbnail:nN},e)}
538
- </div>
539
- </div>
540
- `}}const aN=kt(oN),is=.5;var st,Xs,Qs,Oi,Sr,qn,jn,Ar,kr,Er,dn,$r,eo,ol,De,Wn,Cr,yu,D,H2,V2,al,ll,cl,wu,ul,ds,kf,B2,Ef,$f,Cf,Tf,q2,j2,W2,G2,hl,Y2,Qo,Rf,K2,J2,X2,ea,ta;class lN extends At{constructor(){super(...arguments);g(this,D);g(this,st,Rr());g(this,Xs);g(this,Qs);g(this,Oi,!1);g(this,Sr,0);g(this,qn,!1);g(this,jn,!1);g(this,Ar,!1);g(this,kr,0);g(this,Er,null);g(this,dn,!1);g(this,$r,null);g(this,eo,null);g(this,ol,!1);g(this,De,null);g(this,Wn,!1);g(this,Cr,!1);g(this,yu,()=>{h(this,D,ta).call(this)});g(this,al,t=>{var s;const r=a(this,De);if(r===null||r.pointerId!==t.pointerId||!r.dragging&&Math.hypot(t.clientX-r.originX,t.clientY-r.originY)<=Uw)return;const i=a(this,st).value;if(i){if(r.currentX=t.clientX,r.currentY=t.clientY,r.dragging)this.render();else{h(this,D,ea).call(this);const o=r.tab.getBoundingClientRect();d(this,Wn,!0),r.dragging=!0,r.tabLeft=o.left,r.tabTop=o.top,r.tabWidth=o.width,r.tabHeight=o.height,i.setPointerCapture(t.pointerId),this.render(),(s=r.onReorderChange)==null||s.call(r,h(this,D,Tf).call(this,r))}h(this,D,Cf).call(this,r),h(this,D,kf).call(this,r)}});g(this,ll,t=>{const r=a(this,De);r===null||r.pointerId!==t.pointerId||h(this,D,ds).call(this,!0,!0)});g(this,cl,t=>{var r;((r=a(this,De))==null?void 0:r.pointerId)===t.pointerId&&h(this,D,ds).call(this,!1,!0)});g(this,wu,t=>{var r;((r=a(this,De))==null?void 0:r.pointerId)===t.pointerId&&h(this,D,ds).call(this,!1,!0)});g(this,ul,t=>{var r;t.key!=="Escape"||!((r=a(this,De))!=null&&r.dragging)||(t.preventDefault(),h(this,D,ds).call(this,!1,!0))});g(this,hl,()=>{d(this,dn,!0),h(this,D,Qo).call(this,!0)})}connected(){var t;d(this,Xs,void 0),d(this,Qs,void 0),d(this,dn,!1),h(this,D,Y2).call(this),typeof document<"u"&&((t=document.fonts)==null||t.addEventListener("loadingdone",a(this,hl),{once:!0})),window.addEventListener("pointermove",a(this,al)),window.addEventListener("pointerup",a(this,ll)),window.addEventListener("pointercancel",a(this,cl)),window.addEventListener("keydown",a(this,ul))}template(t,r,i=null,s){var S,x;const o=(S=a(this,De))!=null&&S.dragging?a(this,De):null,l=(o==null?void 0:o.provisionalPages)??(r==null?void 0:r.pages),c=uN(r,l),u=(o==null?void 0:o.artifactId)??i,f=((x=r==null?void 0:r.selectedPage)==null?void 0:x.artifactIds[0])??null,m=`${(r==null?void 0:r.id)??""}:${c.map(({key:M,label:Z})=>`${M}:${Z}`).join("|")}`,v=f!==a(this,Xs),y=m!==a(this,Qs);v&&d(this,Cr,!1);const k=v||o===null&&y;return y&&d(this,dn,!0),d(this,Xs,f),d(this,Qs,m),h(this,D,Qo).call(this,k,v,v&&!y),V`
541
- <div
542
- class="tab-strip"
543
- role="tablist"
544
- ${mn(a(this,st))}
545
- ?tab-held=${o!==null}
546
- @scroll=${a(this,yu)}
547
- @lostpointercapture=${a(this,wu)}
548
- >
549
- ${Gc(c,({key:M})=>M,(M,Z)=>{const G=M.artifactId!==null&&M.artifactId===f,F=M.artifactId!==null&&M.artifactId===u,W=F&&o!==null;return V`
550
- ${F?V`
551
- <span
552
- class="tab-placeholder"
553
- aria-hidden="true"
554
- style=${Yc(W?{width:`${o.tabWidth}px`,height:`${o.tabHeight}px`}:{})}
555
- ></span>
556
- `:null}
557
- <button
558
- class="tab"
559
- ?dragged=${F}
560
- ?dragging=${W}
561
- style=${Yc(W?{left:`${o.tabLeft+o.currentX-o.originX}px`,top:`${o.tabTop+o.currentY-o.originY}px`,width:`${o.tabWidth}px`,height:`${o.tabHeight}px`}:{})}
562
- role="tab"
563
- aria-selected=${G?"true":"false"}
564
- tabindex=${G?"0":"-1"}
565
- data-artifact-id=${M.artifactId??""}
566
- @pointerdown=${u===null?Q=>h(this,D,H2).call(this,Q,t,r,M,s):null}
567
- @click=${Q=>h(this,D,V2).call(this,Q,t,r,M)}
568
- @dblclick=${G&&r!==null&&!W?()=>rf(t,r,M.page,!M.page.geometry.full_screen):null}
569
- @keydown=${Q=>h(this,D,W2).call(this,Q,t,r,c,Z)}
570
- >
571
- <span class="tab-label">${M.label}</span>
572
- </button>
573
- `})}
574
- </div>
575
- `}disconnected(){var t,r;d(this,Oi,!1),typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a(this,Sr)),d(this,Sr,0),d(this,qn,!1),d(this,jn,!1),d(this,Ar,!1),h(this,D,ea).call(this),d(this,Cr,!1),d(this,dn,!1),(t=a(this,$r))==null||t.disconnect(),d(this,$r,null),d(this,eo,null),typeof document<"u"&&((r=document.fonts)==null||r.removeEventListener("loadingdone",a(this,hl))),window.removeEventListener("pointermove",a(this,al)),window.removeEventListener("pointerup",a(this,ll)),window.removeEventListener("pointercancel",a(this,cl)),window.removeEventListener("keydown",a(this,ul)),h(this,D,ds).call(this,!1,!1),d(this,Wn,!1)}}st=new WeakMap,Xs=new WeakMap,Qs=new WeakMap,Oi=new WeakMap,Sr=new WeakMap,qn=new WeakMap,jn=new WeakMap,Ar=new WeakMap,kr=new WeakMap,Er=new WeakMap,dn=new WeakMap,$r=new WeakMap,eo=new WeakMap,ol=new WeakMap,De=new WeakMap,Wn=new WeakMap,Cr=new WeakMap,yu=new WeakMap,D=new WeakSet,H2=function(t,r,i,s,o){a(this,De)!==null||i===null||s.artifactId===null||t.button!==0||!t.isPrimary||(d(this,Wn,!1),d(this,De,{pointerId:t.pointerId,originX:t.clientX,originY:t.clientY,tab:t.currentTarget,application:r,channelId:i.id,artifactId:s.artifactId,originalPages:i.pages,onReorderChange:o,displacementAnimations:new Set,provisionalPages:[...i.pages],slot:i.pages.indexOf(s.page),currentX:t.clientX,currentY:t.clientY,tabLeft:0,tabTop:0,tabWidth:0,tabHeight:0,edgeScrollFrame:0,edgeScrollTimestamp:null,edgeScrollRemainder:0,edgeScrollMoved:!1,dragging:!1}))},V2=function(t,r,i,s){var o;if(t.detail!==0&&a(this,Wn)){d(this,Wn,!1);return}d(this,Wn,!1),!((o=a(this,De))!=null&&o.dragging||i===null||s.artifactId===null)&&r.selectPage(i.id,s.artifactId)},al=new WeakMap,ll=new WeakMap,cl=new WeakMap,wu=new WeakMap,ul=new WeakMap,ds=function(t,r){var o;const i=a(this,De);if(i===null)return;if(h(this,D,Ef).call(this,i),i.edgeScrollMoved&&d(this,Cr,!0),i.dragging&&(d(this,qn,a(this,jn)),a(this,jn)||d(this,Ar,!1)),i.dragging&&t&&!hN(i.originalPages,i.provisionalPages)){const l=i.provisionalPages.map(c=>({artifactIds:[...c.artifactIds],geometry:{...c.geometry},size:{...c.size}}));i.application.updateChannelPages(i.channelId,l).catch(()=>{})}if(!t)for(const l of i.displacementAnimations)l.cancel();d(this,De,null),(o=i.onReorderChange)==null||o.call(i,null);const s=a(this,st).value;i.dragging&&(s!=null&&s.hasPointerCapture(i.pointerId))&&s.releasePointerCapture(i.pointerId),r&&this.render()},kf=function(t){const r=a(this,st).value,i=r?h(this,D,$f).call(this,r,t.currentX):0,s=r?Math.max(0,r.scrollWidth-r.clientWidth):0,o=i<0?((r==null?void 0:r.scrollLeft)??0)<=is:((r==null?void 0:r.scrollLeft)??0)>=s-is;if(!t.dragging||i===0||s===0||o||typeof requestAnimationFrame!="function"){h(this,D,Ef).call(this,t);return}t.edgeScrollFrame===0&&(t.edgeScrollFrame=requestAnimationFrame(l=>{h(this,D,B2).call(this,t,l)}))},B2=function(t,r){if(t.edgeScrollFrame=0,a(this,De)!==t||!t.dragging){t.edgeScrollTimestamp=null;return}const i=a(this,st).value;if(!i){t.edgeScrollTimestamp=null;return}const s=h(this,D,$f).call(this,i,t.currentX),o=t.edgeScrollTimestamp;if(t.edgeScrollTimestamp=r,s!==0&&o!==null){const l=Math.max(0,r-o)/1e3,c=Math.max(0,i.scrollWidth-i.clientWidth),u=i.scrollLeft,f=s*l+t.edgeScrollRemainder,m=Math.max(0,Math.min(c,u+f));i.scrollLeft=m;const v=i.scrollLeft-u;v!==0&&(t.edgeScrollMoved=!0),t.edgeScrollRemainder=m===0||m===c?0:f-v,v!==0&&(h(this,D,ta).call(this,i),h(this,D,Cf).call(this,t))}h(this,D,kf).call(this,t)},Ef=function(t){t.edgeScrollFrame!==0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(t.edgeScrollFrame),t.edgeScrollFrame=0,t.edgeScrollTimestamp=null,t.edgeScrollRemainder=0},$f=function(t,r){const i=t.getBoundingClientRect();return r>=i.left&&r<i.left+vt?-Kc*(i.left+vt-r)/vt:r>i.right-vt&&r<=i.right?Kc*(r-(i.right-vt))/vt:0},Cf=function(t){var k;const r=a(this,st).value,i=r==null?void 0:r.querySelector(".tab-placeholder");if(!r||!i)return;const s=i.nextElementSibling,o=t.tab.getBoundingClientRect(),l=o.left+o.width/2;let c=t.slot,u=i.previousElementSibling;for(;u!=null&&u.classList.contains("tab");){const S=u.getBoundingClientRect();if(l>=S.left+S.width/2)break;c-=1,u=u.previousElementSibling}let f=s==null?void 0:s.nextElementSibling;for(;f!=null&&f.classList.contains("tab");){const S=f.getBoundingClientRect();if(l<=S.left+S.width/2)break;c+=1,f=f.nextElementSibling}if(c===t.slot)return;const m=h(this,D,q2).call(this,r),v=[...t.provisionalPages],[y]=v.splice(t.slot,1);y&&(v.splice(c,0,y),t.provisionalPages=v,t.slot=c,this.render(),(k=t.onReorderChange)==null||k.call(t,h(this,D,Tf).call(this,t)),queueMicrotask(()=>h(this,D,j2).call(this,t,m)))},Tf=function(t){return{channelId:t.channelId,pages:t.provisionalPages,carriedArtifactId:t.artifactId}},q2=function(t){return new Map([...t.querySelectorAll(".tab:not([dragging])")].map(r=>[r.dataset.artifactId??"",r.getBoundingClientRect().left]))},j2=function(t,r){const i=a(this,st).value;if(i)for(const s of i.querySelectorAll(".tab:not([dragging])")){const o=r.get(s.dataset.artifactId??"");if(o===void 0)continue;const l=o-s.getBoundingClientRect().left;if(Math.abs(l)<=is)continue;const c=s.animate({translate:[`${l}px 0`,"0px 0"]},{duration:gs,easing:"ease"});t.displacementAnimations.add(c),c.finished.finally(()=>{t.displacementAnimations.delete(c)}).catch(()=>{})}},W2=function(t,r,i,s,o){var u;if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;t.preventDefault();const l=Math.max(0,Math.min(s.length-1,o+(t.key==="ArrowLeft"?-1:1)));if(l===o||i===null)return;const c=(u=s[l])==null?void 0:u.artifactId;c&&(r.selectPage(i.id,c),queueMicrotask(()=>h(this,D,G2).call(this,c)))},G2=function(t){const r=a(this,st).value;if(!r)return;const i=[...r.querySelectorAll(".tab")].find(s=>s.dataset.artifactId===t);i==null||i.focus({preventScroll:!0})},hl=new WeakMap,Y2=function(){a(this,ol)||typeof document>"u"||!document.fonts||(d(this,ol,!0),document.fonts.ready.then(()=>{this.isConnected&&(d(this,dn,!0),h(this,D,Qo).call(this,!0))}))},Qo=function(t,r=!1,i=!1){a(this,qn)||d(this,qn,t),t&&r&&(d(this,jn,!0),d(this,Ar,i)),!(a(this,Oi)||a(this,Sr)!==0)&&(d(this,Oi,!0),queueMicrotask(()=>{if(d(this,Oi,!1),!!this.isConnected){if(typeof requestAnimationFrame!="function"){h(this,D,Rf).call(this);return}d(this,Sr,requestAnimationFrame(()=>{d(this,Sr,0),h(this,D,Rf).call(this)}))}}))},Rf=function(){var l;const t=a(this,st).value;if(!t)return;a(this,dn)&&(d(this,dn,!1),h(this,D,K2).call(this,t)),h(this,D,J2).call(this,t);const r=((l=a(this,De))==null?void 0:l.dragging)===!0,i=a(this,jn),s=i&&a(this,Ar),o=!r&&(i||a(this,qn)&&!a(this,Cr));r?d(this,qn,i):(d(this,qn,!1),d(this,jn,!1),d(this,Ar,!1),i&&d(this,Cr,!1)),o&&h(this,D,X2).call(this,t,s),h(this,D,ta).call(this,t)},K2=function(t){var r;for(const i of t.querySelectorAll(".tab")){const s=i.querySelector(".tab-label");if(!s)continue;const o=document.createRange();o.selectNodeContents(s);const l=(r=o.getBoundingClientRect)==null?void 0:r.call(o);if(!l||l.width<=0)continue;const c=getComputedStyle(i),u=nc(c.paddingLeft)+nc(c.paddingRight)+nc(c.borderLeftWidth)+nc(c.borderRightWidth),m=Math.ceil(l.width)+u>gO+vO?"capped":"hugging";i.dataset.compression!==m&&(i.dataset.compression=m)}},J2=function(t){var r;typeof ResizeObserver>"u"||a(this,eo)===t||((r=a(this,$r))==null||r.disconnect(),a(this,$r)??d(this,$r,new ResizeObserver(()=>h(this,D,Qo).call(this,!0))),a(this,$r).observe(t),d(this,eo,t))},X2=function(t,r){const i=t.querySelector('.tab[aria-selected="true"]');if(!i){h(this,D,ea).call(this);return}const s=t.getBoundingClientRect(),o=i.getBoundingClientRect(),l=Math.max(0,Math.min(t.scrollLeft+o.left+o.width/2-(s.left+s.width/2),t.scrollWidth-t.clientWidth));if(h(this,D,ea).call(this),!r||Math.abs(t.scrollLeft-l)<=is||matchMedia("(prefers-reduced-motion: reduce)").matches){t.scrollLeft=l;return}const c=t.scrollLeft,u=t.animate([{},{}],{duration:u2,easing:"ease"});d(this,Er,u);const f=()=>{var v;if(u!==a(this,Er))return;const m=u.playState==="finished"?1:((v=u.effect)==null?void 0:v.getComputedTiming().progress)??0;t.scrollLeft=c+(l-c)*m,u.playState==="finished"?(t.scrollLeft=l,d(this,Er,null),d(this,kr,0),h(this,D,ta).call(this,t)):d(this,kr,requestAnimationFrame(f))};d(this,kr,requestAnimationFrame(f))},ea=function(){var t;typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a(this,kr)),d(this,kr,0),(t=a(this,Er))==null||t.cancel(),d(this,Er,null)},ta=function(t=a(this,st).value){if(!t)return;const r=Math.max(0,t.scrollWidth-t.clientWidth);t.toggleAttribute("continues-start",t.scrollLeft>is),t.toggleAttribute("continues-end",t.scrollLeft<r-is)};const cN=kt(lN);function uN(n,e){if(!n||!e)return[];const t=new Map(n.artifacts.map(r=>[r.id,r]));return e.map((r,i)=>{var o;const s=r.artifactIds[0]??null;return{page:r,artifactId:s,label:s===null?"":((o=t.get(s))==null?void 0:o.title)??"",key:s??`empty-page-${i}`}})}function hN(n,e){return n.length===e.length&&n.every((t,r)=>t===e[r])}function nc(n){const e=Number.parseFloat(n);return Number.isFinite(e)?e:0}var zi;class dN extends At{constructor(){super(...arguments);g(this,zi,new Xz(()=>this.render()))}connected(){a(this,zi).connect()}template(t,r,i={}){var s;return a(this,zi).configure({connectionOwner:i.connectionOwner,primaryServerURL:i.primaryServerURL,presentation:i.updatePresentation,dismissalStorage:i.dismissalStorage}),i.onRenderComplete&&queueMicrotask(i.onRenderComplete),V`
576
- <header class="top-bar" ?electron-draggable=${i.electronMode??!1}>
577
- ${cN(t,r,null,i.onTabReorderChange)}
578
- <div class="top-bar-controls">
579
- ${aN((s=i.connectionOwner)==null?void 0:s.connection)}
580
- ${a(this,zi).template()}
581
- </div>
582
- </header>
583
- `}disconnected(){a(this,zi).disconnect()}}zi=new WeakMap;const fN=kt(dN);var fn,dl,fl,bu,Ni,_u,Q2;class pN extends At{constructor(){super(...arguments);g(this,_u);g(this,fn,null);g(this,dl);g(this,fl,t=>{var r;xb(t,navigator.platform)&&(t.preventDefault(),t.stopPropagation(),(r=a(this,fn))==null||r.handleNavigationKey(t.key))});g(this,bu,t=>{d(this,dl,t??void 0),this.render()});g(this,Ni,()=>{this.render()})}update(t,r){const i=r[0];return a(this,fn)!==i&&(a(this,fn)!==null&&this.isConnected&&(a(this,fn).removeEventListener("change",a(this,Ni)),i.addEventListener("change",a(this,Ni))),d(this,fn,i)),super.update(t,r)}connected(){var t;(t=a(this,fn))==null||t.addEventListener("change",a(this,Ni)),document.addEventListener("keydown",a(this,fl),{capture:!0})}disconnected(){var t;(t=a(this,fn))==null||t.removeEventListener("change",a(this,Ni)),document.removeEventListener("keydown",a(this,fl),{capture:!0})}template(t,r){const i=tD(t.snapshot,r.runtimeServerURL),s=t.snapshot;return r.onRenderComplete&&queueMicrotask(()=>{var o;this.isConnected&&((o=r.onRenderComplete)==null||o.call(r,i.kind))}),V`
584
- <div id="app" data-app-state=${i.kind}>
585
- ${gN(i)?h(this,_u,Q2).call(this,t,s,r):null}
586
- ${vN(i)?Zz(i,t):null}
587
- </div>
588
- `}}fn=new WeakMap,dl=new WeakMap,fl=new WeakMap,bu=new WeakMap,Ni=new WeakMap,_u=new WeakSet,Q2=function(t,r,i){return V`
589
- <aside class="app-sidebar">
590
- ${WL(t,r,i.electronMode)}
591
- </aside>
592
- <main class="app-main">
593
- ${fN(t,r.focusedChannel,{electronMode:i.electronMode,connectionOwner:i.connectionOwner,primaryServerURL:i.primaryServerURL,updatePresentation:i.updatePresentation,onTabReorderChange:a(this,bu)})}
594
- ${EO(t,r.focusedChannel,a(this,dl))}
595
- </main>
596
- `};const mN=kt(pN);function gN(n){return n.kind==="connected"||n.kind==="no-channel"||n.kind==="empty-channel"||n.kind==="disconnected"}function vN(n){return n.kind!=="connected"&&n.kind!=="no-channel"&&n.kind!=="empty-channel"}const eb=new CSSStyleSheet;try{"adoptedStyleSheets"in document&&(document.adoptedStyleSheets=[...document.adoptedStyleSheets,eb])}catch{}function tb(n){eb.replaceSync(n)}function ma(){tb("")}let tr=null;async function yN(n,e){if(tr==null||tr.abort(),n===null){tr=null,ma();return}const t=new AbortController;tr=t;try{const r=e.token?{Authorization:`Bearer ${e.token}`}:void 0,i=new URL(`/themes/${n}/theme.css`,e.url).toString(),s=await fetch(i,{signal:t.signal,...r?{headers:r}:{}});if(!s.ok)throw new Error(`Theme fetch failed: ${s.status}`);const o=await s.text();if(tr!==t)return;tb(o)}catch(r){if(r.name==="AbortError")return;ma();const i=r instanceof Error?r.message:String(r);console.warn(`applyTheme: ${i}`)}finally{tr===t&&(tr=null)}}document.documentElement.dataset.tvBundleVersion=pp();Object.defineProperty(window,"__tvVersion",{value:pp(),writable:!1,configurable:!1});const Or=Gn(),Cp=r3(),nb=i3(),wN=new r4(Or?"television-electron":"television-browser",n4()),o1=lw(),bN=o1?h3({storage:o1,clientApp:Or?"desktop":"browser",desktopAppVersion:Or?uy():null}):null,Tp=xr(Or?Cp:window.location.origin),rb=R5({search:window.location.search}),Rp=mp(),ib=new L5,Ip=D5({detection:rb,primaryServerURL:Tp,navigationLatch:Rp,presentation:ib}),qe=new p5({localStore:wN,serverURL:Cp,launchToken:nb,telemetryMeta:bN,navigationPending:()=>Rp.pending,...rb.electron?{decideBoot:n=>Ip.decideBoot(n)}:{}}),_N=n=>{qE(vn,n)},vn=new OE({connectionOwner:qe,navigationKeyHandler:_N,retainedGateHalted:()=>Ip.gated}),a1=globalThis.__televisionNativeBridge;Or&&a1&&a1.onNavigationKey(n=>vn.handleNavigationKey(n));if(nb){const n=new URL(window.location.href);n.searchParams.delete("token"),window.history.replaceState({},"",`${n.pathname}${n.search}${n.hash}`)}T5({owner:qe,primaryServerURL:Tp,navigationLatch:Rp});Ip.attach(qe);const SN=()=>{const n=qe.connection;n.status==="connected"&&n.client.artifacts.list().then(({artifacts:e})=>{const t=new Set(e.map(r=>r.id));A5(t)}).catch(()=>{})},sb=()=>{if(qe.connection.status!=="connected"){ma();return}SN()};let rc;const ob=n=>{yN(n,qe.connection).catch(()=>{vn.snapshot.connection.status==="connected"&&ma()})},ab=()=>{const n=vn.snapshot;if(n.connection.status!=="connected"){rc=void 0,ma();return}!n.ready||n.display.activeThemeName===rc||(rc=n.display.activeThemeName,ob(rc))},AN=n=>{const e=vn.snapshot;e.connection.status!=="connected"||!e.ready||n.themeName!==e.display.activeThemeName||ob(n.themeName)};sb();ab();qe.addEventListener("change",sb);vn.addEventListener("change",ab);vn.addEventListener("theme-changed",AN);lv.register("ServerConnectionOwner",()=>qe);lv.register("ApplicationService",()=>vn);const aa=globalThis.__telepath??(globalThis.__telepath={});aa.applicationService=vn;aa.connectionOwner=qe;const kN=aa.renderCompleteCallbacks??(aa.renderCompleteCallbacks=new Set);Or&&document.body.classList.add("electron");let l1=!1;const lb=()=>{l1||(_c(mN(vn,{runtimeServerURL:Cp,electronMode:Or,connectionOwner:qe,primaryServerURL:Tp,updatePresentation:ib,onRenderComplete(n){for(const e of kN)e(n)}}),document.body),l1=!0)},cb=()=>{const n=qe.connection;n.bootState==="pending"&&!n.hasAuthRejected&&qe.connectError===null||(qe.removeEventListener("change",cb),lb())};Or?qe.addEventListener("change",cb):lb();qe.connect();