@telepath-computer/television 1.3.3 → 1.3.5

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.
@@ -0,0 +1,721 @@
1
+ var R_=Object.defineProperty;var qg=n=>{throw TypeError(n)};var I_=(n,t,e)=>t in n?R_(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var C=(n,t,e)=>I_(n,typeof t!="symbol"?t+"":t,e),Dd=(n,t,e)=>t.has(n)||qg("Cannot "+e);var o=(n,t,e)=>(Dd(n,t,"read from private field"),e?e.call(n):t.get(n)),m=(n,t,e)=>t.has(n)?qg("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),d=(n,t,e,r)=>(Dd(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e),h=(n,t,e)=>(Dd(n,t,"access private method"),e);var Wc=(n,t,e,r)=>({set _(i){d(n,t,i,e)},get _(){return o(n,t,r)}});import{i as x_,a as P_,b as L_,c as D_,d as O_,e as M_,f as N_,g as z_,U as U_,A as F_,h as Z_}from"./artifact-bridge-BEUWXKq7.js";import{m as H_,a as V_,b as B_}from"./missing-artifact-page-DVzJ41AE.js";var Ei=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function W_(n){if(n.__esModule)return n;var t=n.default;if(typeof t=="function"){var e=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),e}var jg=Object.prototype.toString,oy=function(t){var e=jg.call(t),r=e==="[object Arguments]";return r||(r=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&jg.call(t.callee)==="[object Function]"),r},Od,Gg;function q_(){if(Gg)return Od;Gg=1;var n;if(!Object.keys){var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=oy,i=Object.prototype.propertyIsEnumerable,s=!i.call({toString:null},"toString"),a=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},p=function(){if(typeof window>"u")return!1;for(var v in window)try{if(!u["$"+v]&&t.call(window,v)&&window[v]!==null&&typeof window[v]=="object")try{c(window[v])}catch{return!0}}catch{return!0}return!1}(),g=function(v){if(typeof window>"u"||!p)return c(v);try{return c(v)}catch{return!1}};n=function(y){var E=y!==null&&typeof y=="object",A=e.call(y)==="[object Function]",x=r(y),L=E&&e.call(y)==="[object String]",D=[];if(!E&&!A&&!x)throw new TypeError("Object.keys called on a non-object");var V=a&&A;if(L&&y.length>0&&!t.call(y,0))for(var F=0;F<y.length;++F)D.push(String(F));if(x&&y.length>0)for(var G=0;G<y.length;++G)D.push(String(G));else for(var z in y)!(V&&z==="prototype")&&t.call(y,z)&&D.push(String(z));if(s)for(var J=g(y),re=0;re<l.length;++re)!(J&&l[re]==="constructor")&&t.call(y,l[re])&&D.push(l[re]);return D}}return Od=n,Od}var j_=Array.prototype.slice,G_=oy,Yg=Object.keys,mu=Yg?function(t){return Yg(t)}:q_(),Jg=Object.keys;mu.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(r){return G_(r)?Jg(j_.call(r)):Jg(r)})}else Object.keys=mu;return Object.keys||mu};var Y_=mu,gu=Object.defineProperty||!1;if(gu)try{gu({},"a",{value:1})}catch{gu=!1}var _c=gu,wr=SyntaxError,te=TypeError,J_=Object.getOwnPropertyDescriptor,vu=J_;if(vu)try{vu([],"length")}catch{vu=null}var la=vu,Kg=_c,K_=wr,Ns=te,Xg=la,ay=function(t,e,r){if(!t||typeof t!="object"&&typeof t!="function")throw new Ns("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new Ns("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ns("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ns("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ns("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ns("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,c=!!Xg&&Xg(t,e);if(Kg)Kg(t,e,{configurable:a===null&&c?c.configurable:!a,enumerable:i===null&&c?c.enumerable:!i,value:r,writable:s===null&&c?c.writable:!s});else if(l||!i&&!s&&!a)t[e]=r;else throw new K_("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Tp=_c,ly=function(){return!!Tp};ly.hasArrayLengthDefineBug=function(){if(!Tp)return null;try{return Tp([],"length",{value:1}).length!==1}catch{return!0}};var Qh=ly,X_=Y_,Q_=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",e6=Object.prototype.toString,t6=Array.prototype.concat,Qg=ay,n6=function(n){return typeof n=="function"&&e6.call(n)==="[object Function]"},cy=Qh(),r6=function(n,t,e,r){if(t in n){if(r===!0){if(n[t]===e)return}else if(!n6(r)||!r())return}cy?Qg(n,t,e,!0):Qg(n,t,e)},uy=function(n,t){var e=arguments.length>2?arguments[2]:{},r=X_(t);Q_&&(r=t6.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i<r.length;i+=1)r6(n,r[i],t[r[i]],e[r[i]])};uy.supportsDescriptors=!!cy;var Cs=uy,yu={exports:{}};typeof self<"u"?yu.exports=self:typeof window<"u"?yu.exports=window:yu.exports=Function("return this")();var hy=yu.exports,i6=hy,dy=function(){return typeof Ei!="object"||!Ei||Ei.Math!==Math||Ei.Array!==Array?i6:Ei},s6=Cs,o6=la,a6=dy,l6=function(){var t=a6();if(s6.supportsDescriptors){var e=o6(t,"globalThis");(!e||e.configurable&&(e.enumerable||!e.writable||globalThis!==t))&&Object.defineProperty(t,"globalThis",{configurable:!0,enumerable:!1,value:t,writable:!0})}else(typeof globalThis!="object"||globalThis!==t)&&(t.globalThis=t);return t},c6=Cs,u6=hy,py=dy,h6=l6,d6=py(),fy=function(){return d6};c6(fy,{getPolyfill:py,implementation:u6,shim:h6});var vm=fy,br=function(t){return!!t&&(typeof t=="function"||typeof t=="object")},ym=Object,my=Error,p6=EvalError,f6=RangeError,wm=ReferenceError,m6=URIError,g6=Math.abs,v6=Math.floor,y6=Math.max,w6=Math.min,b6=Math.pow,S6=Math.round,bm=Number.isNaN||function(t){return t!==t},_6=bm,A6=function(t){return _6(t)||t===0?t:t<0?-1:1},ca=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;t[e]=i;for(var s in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var a=Object.getOwnPropertySymbols(t);if(a.length!==1||a[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(t,e);if(l.value!==i||l.enumerable!==!0)return!1}return!0},e0=typeof Symbol<"u"&&Symbol,E6=ca,Sm=function(){return typeof e0!="function"||typeof Symbol!="function"||typeof e0("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:E6()},gy=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,k6=ym,vy=k6.getPrototypeOf||null,C6="Function.prototype.bind called on incompatible ",$6=Object.prototype.toString,T6=Math.max,R6="[object Function]",t0=function(t,e){for(var r=[],i=0;i<t.length;i+=1)r[i]=t[i];for(var s=0;s<e.length;s+=1)r[s+t.length]=e[s];return r},I6=function(t,e){for(var r=[],i=e,s=0;i<t.length;i+=1,s+=1)r[s]=t[i];return r},x6=function(n,t){for(var e="",r=0;r<n.length;r+=1)e+=n[r],r+1<n.length&&(e+=t);return e},P6=function(t){var e=this;if(typeof e!="function"||$6.apply(e)!==R6)throw new TypeError(C6+e);for(var r=I6(arguments,1),i,s=function(){if(this instanceof i){var p=e.apply(this,t0(r,arguments));return Object(p)===p?p:this}return e.apply(t,t0(r,arguments))},a=T6(0,e.length-r.length),l=[],c=0;c<a;c++)l[c]="$"+c;if(i=Function("binder","return function ("+x6(l,",")+"){ return binder.apply(this,arguments); }")(s),e.prototype){var u=function(){};u.prototype=e.prototype,i.prototype=new u,u.prototype=null}return i},L6=P6,Ac=Function.prototype.bind||L6,_m=Function.prototype.call,Am=Function.prototype.apply,D6=typeof Reflect<"u"&&Reflect&&Reflect.apply,O6=Ac,M6=Am,N6=_m,z6=D6,yy=z6||O6.call(N6,M6),U6=Ac,F6=te,Z6=_m,H6=yy,ed=function(t){if(t.length<1||typeof t[0]!="function")throw new F6("a function is required");return H6(U6,Z6,t)},V6=ed,n0=la,wy;try{wy=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var Md=!!wy&&n0&&n0(Object.prototype,"__proto__"),by=Object,r0=by.getPrototypeOf,B6=Md&&typeof Md.get=="function"?V6([Md.get]):typeof r0=="function"?function(t){return r0(t==null?t:by(t))}:!1,i0=gy,s0=vy,o0=B6,Sy=i0?function(t){return i0(t)}:s0?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return s0(t)}:o0?function(t){return o0(t)}:null,W6=Function.prototype.call,q6=Object.prototype.hasOwnProperty,j6=Ac,Sr=j6.call(W6,q6),Q,G6=ym,Y6=my,J6=p6,K6=f6,X6=wm,na=wr,ao=te,Q6=m6,e8=g6,t8=v6,n8=y6,r8=w6,i8=b6,s8=S6,o8=A6,_y=Function,Nd=function(n){try{return _y('"use strict"; return ('+n+").constructor;")()}catch{}},hl=la,a8=_c,zd=function(){throw new ao},l8=hl?function(){try{return arguments.callee,zd}catch{try{return hl(arguments,"callee").get}catch{return zd}}}():zd,zs=Sm(),De=Sy,c8=vy,u8=gy,Ay=Am,Ec=_m,Hs={},h8=typeof Uint8Array>"u"||!De?Q:De(Uint8Array),Ss={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Q:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Q:ArrayBuffer,"%ArrayIteratorPrototype%":zs&&De?De([][Symbol.iterator]()):Q,"%AsyncFromSyncIteratorPrototype%":Q,"%AsyncFunction%":Hs,"%AsyncGenerator%":Hs,"%AsyncGeneratorFunction%":Hs,"%AsyncIteratorPrototype%":Hs,"%Atomics%":typeof Atomics>"u"?Q:Atomics,"%BigInt%":typeof BigInt>"u"?Q:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Q:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Q:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Q:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Y6,"%eval%":eval,"%EvalError%":J6,"%Float16Array%":typeof Float16Array>"u"?Q:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Q:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Q:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Q:FinalizationRegistry,"%Function%":_y,"%GeneratorFunction%":Hs,"%Int8Array%":typeof Int8Array>"u"?Q:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Q:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Q:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":zs&&De?De(De([][Symbol.iterator]())):Q,"%JSON%":typeof JSON=="object"?JSON:Q,"%Map%":typeof Map>"u"?Q:Map,"%MapIteratorPrototype%":typeof Map>"u"||!zs||!De?Q:De(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":G6,"%Object.getOwnPropertyDescriptor%":hl,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Q:Promise,"%Proxy%":typeof Proxy>"u"?Q:Proxy,"%RangeError%":K6,"%ReferenceError%":X6,"%Reflect%":typeof Reflect>"u"?Q:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Q:Set,"%SetIteratorPrototype%":typeof Set>"u"||!zs||!De?Q:De(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Q:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":zs&&De?De(""[Symbol.iterator]()):Q,"%Symbol%":zs?Symbol:Q,"%SyntaxError%":na,"%ThrowTypeError%":l8,"%TypedArray%":h8,"%TypeError%":ao,"%Uint8Array%":typeof Uint8Array>"u"?Q:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Q:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Q:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Q:Uint32Array,"%URIError%":Q6,"%WeakMap%":typeof WeakMap>"u"?Q:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Q:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Q:WeakSet,"%Function.prototype.call%":Ec,"%Function.prototype.apply%":Ay,"%Object.defineProperty%":a8,"%Object.getPrototypeOf%":c8,"%Math.abs%":e8,"%Math.floor%":t8,"%Math.max%":n8,"%Math.min%":r8,"%Math.pow%":i8,"%Math.round%":s8,"%Math.sign%":o8,"%Reflect.getPrototypeOf%":u8};if(De)try{null.error}catch(n){var d8=De(De(n));Ss["%Error.prototype%"]=d8}var p8=function n(t){var e;if(t==="%AsyncFunction%")e=Nd("async function () {}");else if(t==="%GeneratorFunction%")e=Nd("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Nd("async function* () {}");else if(t==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&De&&(e=De(i.prototype))}return Ss[t]=e,e},a0={__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"]},kc=Ac,Xu=Sr,f8=kc.call(Ec,Array.prototype.concat),m8=kc.call(Ay,Array.prototype.splice),l0=kc.call(Ec,String.prototype.replace),Qu=kc.call(Ec,String.prototype.slice),g8=kc.call(Ec,RegExp.prototype.exec),v8=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,y8=/\\(\\)?/g,w8=function(t){var e=Qu(t,0,1),r=Qu(t,-1);if(e==="%"&&r!=="%")throw new na("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new na("invalid intrinsic syntax, expected opening `%`");var i=[];return l0(t,v8,function(s,a,l,c){i[i.length]=l?l0(c,y8,"$1"):a||s}),i},b8=function(t,e){var r=t,i;if(Xu(a0,r)&&(i=a0[r],r="%"+i[0]+"%"),Xu(Ss,r)){var s=Ss[r];if(s===Hs&&(s=p8(r)),typeof s>"u"&&!e)throw new ao("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new na("intrinsic "+t+" does not exist!")},zt=function(t,e){if(typeof t!="string"||t.length===0)throw new ao("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new ao('"allowMissing" argument must be a boolean');if(g8(/^%?[^%]*%?$/,t)===null)throw new na("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=w8(t),i=r.length>0?r[0]:"",s=b8("%"+i+"%",e),a=s.name,l=s.value,c=!1,u=s.alias;u&&(i=u[0],m8(r,f8([0,1],u)));for(var p=1,g=!0;p<r.length;p+=1){var v=r[p],y=Qu(v,0,1),E=Qu(v,-1);if((y==='"'||y==="'"||y==="`"||E==='"'||E==="'"||E==="`")&&y!==E)throw new na("property names with quotes must have matching quotes");if((v==="constructor"||!g)&&(c=!0),i+="."+v,a="%"+i+"%",Xu(Ss,a))l=Ss[a];else if(l!=null){if(!(v in l)){if(!e)throw new ao("base intrinsic for "+t+" exists, but the property is not available.");return}if(hl&&p+1>=r.length){var A=hl(l,v);g=!!A,g&&"get"in A&&!("originalValue"in A.get)?l=A.get:l=l[v]}else g=Xu(l,v),l=l[v];g&&!c&&(Ss[a]=l)}}return l},Ud,c0;function pi(){if(c0)return Ud;c0=1;var n=zt,t=ed,e=t([n("%String.prototype.indexOf%")]);return Ud=function(i,s){var a=n(i,!!s);return typeof a=="function"&&e(i,".prototype.")>-1?t([a]):a},Ud}var Fd,u0;function Em(){if(u0)return Fd;u0=1;var n=zt,t=n("%Array%"),e=!t.isArray&&pi()("Object.prototype.toString");return Fd=t.isArray||function(i){return e(i)==="[object Array]"},Fd}var S8=Qh,h0=_c,Ey=S8.hasArrayLengthDefineBug(),_8=Ey&&Em(),A8=pi(),E8=A8("Object.prototype.propertyIsEnumerable"),km=function(t,e,r,i,s,a){if(!h0){if(!t(a)||!a["[[Configurable]]"]||!a["[[Writable]]"]||s in i&&E8(i,s)!==!!a["[[Enumerable]]"])return!1;var l=a["[[Value]]"];return i[s]=l,e(i[s],l)}return Ey&&s==="length"&&"[[Value]]"in a&&_8(i)&&i.length!==a["[[Value]]"]?(i.length=a["[[Value]]"],i.length===a["[[Value]]"]):(h0(i,s,r(a)),!0)},k8=te,ka=Sr,C8={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},ua=function(t){if(!t||typeof t!="object")return!1;for(var e in t)if(ka(t,e)&&!C8[e])return!1;var r=ka(t,"[[Value]]")||ka(t,"[[Writable]]"),i=ka(t,"[[Get]]")||ka(t,"[[Set]]");if(r&&i)throw new k8("Property Descriptors may not be both accessor and data descriptors");return!0},ky=function(t){if(typeof t>"u")return t;var e={};return"[[Value]]"in t&&(e.value=t["[[Value]]"]),"[[Writable]]"in t&&(e.writable=!!t["[[Writable]]"]),"[[Get]]"in t&&(e.get=t["[[Get]]"]),"[[Set]]"in t&&(e.set=t["[[Set]]"]),"[[Enumerable]]"in t&&(e.enumerable=!!t["[[Enumerable]]"]),"[[Configurable]]"in t&&(e.configurable=!!t["[[Configurable]]"]),e},$8=te,T8=ua,R8=ky,Cy=function(t){if(typeof t<"u"&&!T8(t))throw new $8("Assertion failed: `Desc` must be a Property Descriptor");return R8(t)},I8=te,d0=Sr,x8=ua,$y=function(t){if(typeof t>"u")return!1;if(!x8(t))throw new I8("Assertion failed: `Desc` must be a Property Descriptor");return!(!d0(t,"[[Value]]")&&!d0(t,"[[Writable]]"))},ha=function(t){return typeof t=="string"||typeof t=="symbol"},p0=bm,Ty=function(t,e){return t===e?t===0?1/t===1/e:!0:p0(t)&&p0(e)},f0=te,P8=br,L8=km,D8=Cy,O8=$y,M8=ha,N8=Ty,Cm=function(t,e,r){if(!P8(t))throw new f0("Assertion failed: Type(O) is not Object");if(!M8(e))throw new f0("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return L8(O8,N8,D8,t,e,i)},Ry=Function.prototype.toString,no=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Rp,wu;if(typeof no=="function"&&typeof Object.defineProperty=="function")try{Rp=Object.defineProperty({},"length",{get:function(){throw wu}}),wu={},no(function(){throw 42},null,Rp)}catch(n){n!==wu&&(no=null)}else no=null;var z8=/^\s*class\b/,Ip=function(t){try{var e=Ry.call(t);return z8.test(e)}catch{return!1}},Zd=function(t){try{return Ip(t)?!1:(Ry.call(t),!0)}catch{return!1}},bu=Object.prototype.toString,U8="[object Object]",F8="[object Function]",Z8="[object GeneratorFunction]",H8="[object HTMLAllCollection]",V8="[object HTML document.all class]",B8="[object HTMLCollection]",W8=typeof Symbol=="function"&&!!Symbol.toStringTag,q8=!(0 in[,]),xp=function(){return!1};if(typeof document=="object"){var j8=document.all;bu.call(j8)===bu.call(document.all)&&(xp=function(t){if((q8||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=bu.call(t);return(e===H8||e===V8||e===B8||e===U8)&&t("")==null}catch{}return!1})}var Iy=no?function(t){if(xp(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{no(t,null,Rp)}catch(e){if(e!==wu)return!1}return!Ip(t)&&Zd(t)}:function(t){if(xp(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(W8)return Zd(t);if(Ip(t))return!1;var e=bu.call(t);return e!==F8&&e!==Z8&&!/^\[object HTML/.test(e)?!1:Zd(t)},G8=Iy,Y8=function(t){return!!t},nn=Sr,qc=te,J8=br,m0=G8,Hd=Y8,K8=function(t){if(!J8(t))throw new qc("ToPropertyDescriptor requires an object");var e={};if(nn(t,"enumerable")&&(e["[[Enumerable]]"]=Hd(t.enumerable)),nn(t,"configurable")&&(e["[[Configurable]]"]=Hd(t.configurable)),nn(t,"value")&&(e["[[Value]]"]=t.value),nn(t,"writable")&&(e["[[Writable]]"]=Hd(t.writable)),nn(t,"get")){var r=t.get;if(typeof r<"u"&&!m0(r))throw new qc("getter must be a function");e["[[Get]]"]=r}if(nn(t,"set")){var i=t.set;if(typeof i<"u"&&!m0(i))throw new qc("setter must be a function");e["[[Set]]"]=i}if((nn(e,"[[Get]]")||nn(e,"[[Set]]"))&&(nn(e,"[[Value]]")||nn(e,"[[Writable]]")))throw new qc("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},Vd=te,X8=br,g0=ua,Q8=km,eA=Cy,tA=$y,nA=ha,rA=Ty,iA=K8,sA=function(t,e,r){if(!X8(t))throw new Vd("Assertion failed: Type(O) is not Object");if(!nA(e))throw new Vd("Assertion failed: P is not a Property Key");var i=g0(r)?r:iA(r);if(!g0(i))throw new Vd("Assertion failed: Desc is not a valid Property Descriptor");return Q8(tA,rA,eA,t,e,i)},v0=te,oA=br,aA=sA,lA=ha,cA=function(t,e,r){if(!oA(t))throw new v0("Assertion failed: Type(O) is not Object");if(!lA(e))throw new v0("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return aA(t,e,i)},uA=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,hA=ym,dA=hA.setPrototypeOf||null,pA=ed,y0=la,fA=te,xy={};try{xy.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var mA=!("toString"in xy),Bd=y0&&y0(Object.prototype,"__proto__"),gA=mA&&(!!Bd&&typeof Bd.set=="function"&&pA([Bd.set])||function(t,e){if(t==null)throw new fA("set Object.prototype.__proto__ called on null or undefined");return t.__proto__=e,e}),w0=uA,vA=dA,b0=gA,yA=te,wA=w0?function(t,e){if(w0(t,e))return t;throw new yA("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:vA||(b0?function(t,e){return b0(t,e),t}:null),S0=te,bA=br,_0=Sy,SA=function(t){if(!bA(t))throw new S0("Assertion failed: O must be an Object");if(!_0)throw new S0("This environment does not support fetching prototypes.");return _0(t)},_A=te,AA=wA,EA=br,kA=SA,CA=function(t,e){if(e!==null&&!EA(e))throw new _A("Assertion failed: V must be Object or Null");try{AA(t,e)}catch{return!1}return kA(t)===e},Wd=Cm,A0=cA,Py=CA,$A=Qh(),$m=my;function Cc(n,t,e){var r=new $m(e);return Py(r,Su),delete r.constructor,A0(r,"error",n),A0(r,"suppressed",t),r}$A&&Object.defineProperty(Cc,"prototype",{writable:!1});var Su=Cc.prototype;if(!Wd(Su,"constructor",Cc)||!Wd(Su,"message","")||!Wd(Su,"name","SuppressedError"))throw new $m("unable to install SuppressedError.prototype properties; please report this!");Py(Cc.prototype,$m.prototype);var TA=Cc,RA=TA,Ly=function(){return typeof SuppressedError=="function"?SuppressedError:RA},IA=Cs,E0=vm(),xA=Ly,PA=function(){var t=xA();return IA(E0,{SuppressedError:t},{SuppressedError:function(){return E0.SuppressedError!==t}}),t};PA();var LA=te,DA=ua,OA=ky,MA=function(t){if(typeof t<"u"&&!DA(t))throw new LA("Assertion failed: `Desc` must be a Property Descriptor");return OA(t)},NA=te,k0=Sr,zA=ua,UA=function(t){if(typeof t>"u")return!1;if(!zA(t))throw new NA("Assertion failed: `Desc` must be a Property Descriptor");return!(!k0(t,"[[Value]]")&&!k0(t,"[[Writable]]"))},C0=bm,FA=function(t,e){return t===e?t===0?1/t===1/e:!0:C0(t)&&C0(e)},da=Iy,ZA=function(t){return!!t},rn=Sr,jc=te,HA=br,$0=da,qd=ZA,VA=function(t){if(!HA(t))throw new jc("ToPropertyDescriptor requires an object");var e={};if(rn(t,"enumerable")&&(e["[[Enumerable]]"]=qd(t.enumerable)),rn(t,"configurable")&&(e["[[Configurable]]"]=qd(t.configurable)),rn(t,"value")&&(e["[[Value]]"]=t.value),rn(t,"writable")&&(e["[[Writable]]"]=qd(t.writable)),rn(t,"get")){var r=t.get;if(typeof r<"u"&&!$0(r))throw new jc("getter must be a function");e["[[Get]]"]=r}if(rn(t,"set")){var i=t.set;if(typeof i<"u"&&!$0(i))throw new jc("setter must be a function");e["[[Set]]"]=i}if((rn(e,"[[Get]]")||rn(e,"[[Set]]"))&&(rn(e,"[[Value]]")||rn(e,"[[Writable]]")))throw new jc("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},jd=te,BA=br,T0=ua,WA=km,qA=MA,jA=UA,GA=ha,YA=FA,JA=VA,$c=function(t,e,r){if(!BA(t))throw new jd("Assertion failed: Type(O) is not Object");if(!GA(e))throw new jd("Assertion failed: P is not a Property Key");var i=T0(r)?r:JA(r);if(!T0(i))throw new jd("Assertion failed: Desc is not a valid Property Descriptor");return WA(jA,YA,qA,t,e,i)},KA=ca(),XA=KA?Symbol.dispose||Symbol("Symbol.dispose"):null,QA=ca,eE=XA,Tm=function(){return QA()&&Symbol.dispose||eE},tE=Sm,nE=$c,rE=Tm,iE=function(){var t=rE();return tE()&&nE(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},sE=ca(),oE=sE?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,aE=ca,lE=oE,Rm=function(){return aE()&&Symbol.asyncDispose||lE},cE=Sm,uE=$c,hE=Rm,dE=function(){var t=hE();return cE()&&uE(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},pE=Em(),fE=zt,mE=pi(),gE=te,vE=pE,yE=fE("%Reflect.apply%",!0)||mE("Function.prototype.apply"),td=function(t,e){var r=arguments.length>2?arguments[2]:[];if(!vE(r))throw new gE("Assertion failed: optional `argumentsList`, if provided, must be a List");return yE(t,e,r)};const wE={},bE=Object.freeze(Object.defineProperty({__proto__:null,default:wE},Symbol.toStringTag,{value:"Module"})),SE=W_(bE);var Im=typeof Map=="function"&&Map.prototype,Gd=Object.getOwnPropertyDescriptor&&Im?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,eh=Im&&Gd&&typeof Gd.get=="function"?Gd.get:null,R0=Im&&Map.prototype.forEach,xm=typeof Set=="function"&&Set.prototype,Yd=Object.getOwnPropertyDescriptor&&xm?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,th=xm&&Yd&&typeof Yd.get=="function"?Yd.get:null,I0=xm&&Set.prototype.forEach,_E=typeof WeakMap=="function"&&WeakMap.prototype,sl=_E?WeakMap.prototype.has:null,AE=typeof WeakSet=="function"&&WeakSet.prototype,ol=AE?WeakSet.prototype.has:null,EE=typeof WeakRef=="function"&&WeakRef.prototype,x0=EE?WeakRef.prototype.deref:null,kE=Boolean.prototype.valueOf,CE=Object.prototype.toString,$E=Function.prototype.toString,TE=String.prototype.match,Pm=String.prototype.slice,si=String.prototype.replace,RE=String.prototype.toUpperCase,P0=String.prototype.toLowerCase,Dy=RegExp.prototype.test,L0=Array.prototype.concat,Pn=Array.prototype.join,IE=Array.prototype.slice,D0=Math.floor,Pp=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Jd=Object.getOwnPropertySymbols,Lp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ra=typeof Symbol=="function"&&typeof Symbol.iterator=="object",al=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ra||!0)?Symbol.toStringTag:null,Oy=Object.prototype.propertyIsEnumerable,O0=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function M0(n,t){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||Dy.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-D0(-n):D0(n);if(r!==n){var i=String(r),s=Pm.call(t,i.length+1);return si.call(i,e,"$&_")+"."+si.call(si.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return si.call(t,e,"$&_")}var Dp=SE,N0=Dp.custom,z0=zy(N0)?N0:null,My={__proto__:null,double:'"',single:"'"},xE={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},pa=function n(t,e,r,i){var s=e||{};if(Bn(s,"quoteStyle")&&!Bn(My,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Bn(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 a=Bn(s,"customInspect")?s.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Bn(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(Bn(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=s.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return Fy(t,s);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var c=String(t);return l?M0(t,c):c}if(typeof t=="bigint"){var u=String(t)+"n";return l?M0(t,u):u}var p=typeof s.depth>"u"?5:s.depth;if(typeof r>"u"&&(r=0),r>=p&&p>0&&typeof t=="object")return Op(t)?"[Array]":"[Object]";var g=YE(s,r);if(typeof i>"u")i=[];else if(Uy(i,t)>=0)return"[Circular]";function v(tt,Zt,Is){if(Zt&&(i=IE.call(i),i.push(Zt)),Is){var Mc={depth:s.depth};return Bn(s,"quoteStyle")&&(Mc.quoteStyle=s.quoteStyle),n(tt,Mc,r+1,i)}return n(tt,s,r+1,i)}if(typeof t=="function"&&!U0(t)){var y=FE(t),E=Gc(t,v);return"[Function"+(y?": "+y:" (anonymous)")+"]"+(E.length>0?" { "+Pn.call(E,", ")+" }":"")}if(zy(t)){var A=ra?si.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Lp.call(t);return typeof t=="object"&&!ra?Ca(A):A}if(qE(t)){for(var x="<"+P0.call(String(t.nodeName)),L=t.attributes||[],D=0;D<L.length;D++)x+=" "+L[D].name+"="+Ny(PE(L[D].value),"double",s);return x+=">",t.childNodes&&t.childNodes.length&&(x+="..."),x+="</"+P0.call(String(t.nodeName))+">",x}if(Op(t)){if(t.length===0)return"[]";var V=Gc(t,v);return g&&!GE(V)?"["+Mp(V,g)+"]":"[ "+Pn.call(V,", ")+" ]"}if(DE(t)){var F=Gc(t,v);return!("cause"in Error.prototype)&&"cause"in t&&!Oy.call(t,"cause")?"{ ["+String(t)+"] "+Pn.call(L0.call("[cause]: "+v(t.cause),F),", ")+" }":F.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Pn.call(F,", ")+" }"}if(typeof t=="object"&&a){if(z0&&typeof t[z0]=="function"&&Dp)return Dp(t,{depth:p-r});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(ZE(t)){var G=[];return R0&&R0.call(t,function(tt,Zt){G.push(v(Zt,t,!0)+" => "+v(tt,t))}),F0("Map",eh.call(t),G,g)}if(BE(t)){var z=[];return I0&&I0.call(t,function(tt){z.push(v(tt,t))}),F0("Set",th.call(t),z,g)}if(HE(t))return Kd("WeakMap");if(WE(t))return Kd("WeakSet");if(VE(t))return Kd("WeakRef");if(ME(t))return Ca(v(Number(t)));if(zE(t))return Ca(v(Pp.call(t)));if(NE(t))return Ca(kE.call(t));if(OE(t))return Ca(v(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof Ei<"u"&&t===Ei)return"{ [object globalThis] }";if(!LE(t)&&!U0(t)){var J=Gc(t,v),re=O0?O0(t)===Object.prototype:t instanceof Object||t.constructor===Object,At=t instanceof Object?"":"null prototype",Me=!re&&al&&Object(t)===t&&al in t?Pm.call(fi(t),8,-1):At?"Object":"",he=re||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",Ne=he+(Me||At?"["+Pn.call(L0.call([],Me||[],At||[]),": ")+"] ":"");return J.length===0?Ne+"{}":g?Ne+"{"+Mp(J,g)+"}":Ne+"{ "+Pn.call(J,", ")+" }"}return String(t)};function Ny(n,t,e){var r=e.quoteStyle||t,i=My[r];return i+n+i}function PE(n){return si.call(String(n),/"/g,"&quot;")}function $s(n){return!al||!(typeof n=="object"&&(al in n||typeof n[al]<"u"))}function Op(n){return fi(n)==="[object Array]"&&$s(n)}function LE(n){return fi(n)==="[object Date]"&&$s(n)}function U0(n){return fi(n)==="[object RegExp]"&&$s(n)}function DE(n){return fi(n)==="[object Error]"&&$s(n)}function OE(n){return fi(n)==="[object String]"&&$s(n)}function ME(n){return fi(n)==="[object Number]"&&$s(n)}function NE(n){return fi(n)==="[object Boolean]"&&$s(n)}function zy(n){if(ra)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!Lp)return!1;try{return Lp.call(n),!0}catch{}return!1}function zE(n){if(!n||typeof n!="object"||!Pp)return!1;try{return Pp.call(n),!0}catch{}return!1}var UE=Object.prototype.hasOwnProperty||function(n){return n in this};function Bn(n,t){return UE.call(n,t)}function fi(n){return CE.call(n)}function FE(n){if(n.name)return n.name;var t=TE.call($E.call(n),/^function\s*([\w$]+)/);return t?t[1]:null}function Uy(n,t){if(n.indexOf)return n.indexOf(t);for(var e=0,r=n.length;e<r;e++)if(n[e]===t)return e;return-1}function ZE(n){if(!eh||!n||typeof n!="object")return!1;try{eh.call(n);try{th.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function HE(n){if(!sl||!n||typeof n!="object")return!1;try{sl.call(n,sl);try{ol.call(n,ol)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function VE(n){if(!x0||!n||typeof n!="object")return!1;try{return x0.call(n),!0}catch{}return!1}function BE(n){if(!th||!n||typeof n!="object")return!1;try{th.call(n);try{eh.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function WE(n){if(!ol||!n||typeof n!="object")return!1;try{ol.call(n,ol);try{sl.call(n,sl)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function qE(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function Fy(n,t){if(n.length>t.maxStringLength){var e=n.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return Fy(Pm.call(n,0,t.maxStringLength),t)+r}var i=xE[t.quoteStyle||"single"];i.lastIndex=0;var s=si.call(si.call(n,i,"\\$1"),/[\x00-\x1f]/g,jE);return Ny(s,"single",t)}function jE(n){var t=n.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+RE.call(t.toString(16))}function Ca(n){return"Object("+n+")"}function Kd(n){return n+" { ? }"}function F0(n,t,e,r){var i=r?Mp(e,r):Pn.call(e,", ");return n+" ("+t+") {"+i+"}"}function GE(n){for(var t=0;t<n.length;t++)if(Uy(n[t],`
2
+ `)>=0)return!1;return!0}function YE(n,t){var e;if(n.indent===" ")e=" ";else if(typeof n.indent=="number"&&n.indent>0)e=Pn.call(Array(n.indent+1)," ");else return null;return{base:e,prev:Pn.call(Array(t+1),e)}}function Mp(n,t){if(n.length===0)return"";var e=`
3
+ `+t.prev+t.base;return e+Pn.call(n,","+e)+`
4
+ `+t.prev}function Gc(n,t){var e=Op(n),r=[];if(e){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=Bn(n,i)?t(n[i],n):""}var s=typeof Jd=="function"?Jd(n):[],a;if(ra){a={};for(var l=0;l<s.length;l++)a["$"+s[l]]=s[l]}for(var c in n)Bn(n,c)&&(e&&String(Number(c))===c&&c<n.length||ra&&a["$"+c]instanceof Symbol||(Dy.call(/[^\w$]/,c)?r.push(t(c,n)+": "+t(n[c],n)):r.push(c+": "+t(n[c],n))));if(typeof Jd=="function")for(var u=0;u<s.length;u++)Oy.call(n,s[u])&&r.push("["+t(s[u])+"]: "+t(n[s[u]],n));return r}var JE=pa,KE=te,nd=function(n,t,e){for(var r=n,i;(i=r.next)!=null;r=i)if(i.key===t)return r.next=i.next,e||(i.next=n.next,n.next=i),i},XE=function(n,t){if(n){var e=nd(n,t);return e&&e.value}},QE=function(n,t,e){var r=nd(n,t);r?r.value=e:n.next={key:t,next:n.next,value:e}},ek=function(n,t){return n?!!nd(n,t):!1},tk=function(n,t){if(n)return nd(n,t,!0)},nk=function(){var t,e={assert:function(r){if(!e.has(r))throw new KE("Side channel does not contain "+JE(r))},delete:function(r){var i=tk(t,r);return i&&t&&!t.next&&(t=void 0),!!i},get:function(r){return XE(t,r)},has:function(r){return ek(t,r)},set:function(r,i){t||(t={next:void 0}),QE(t,r,i)}};return e},rk=zt,Tc=pi(),ik=pa,sk=te,Z0=rk("%Map%",!0),ok=Tc("Map.prototype.get",!0),ak=Tc("Map.prototype.set",!0),lk=Tc("Map.prototype.has",!0),ck=Tc("Map.prototype.delete",!0),uk=Tc("Map.prototype.size",!0),Zy=!!Z0&&function(){var t,e={assert:function(r){if(!e.has(r))throw new sk("Side channel does not contain "+ik(r))},delete:function(r){if(t){var i=ck(t,r);return uk(t)===0&&(t=void 0),i}return!1},get:function(r){if(t)return ok(t,r)},has:function(r){return t?lk(t,r):!1},set:function(r,i){t||(t=new Z0),ak(t,r,i)}};return e},hk=zt,rd=pi(),dk=pa,Yc=Zy,pk=te,Us=hk("%WeakMap%",!0),fk=rd("WeakMap.prototype.get",!0),mk=rd("WeakMap.prototype.set",!0),gk=rd("WeakMap.prototype.has",!0),vk=rd("WeakMap.prototype.delete",!0),yk=Us?function(){var t,e,r={assert:function(i){if(!r.has(i))throw new pk("Side channel does not contain "+dk(i))},delete:function(i){if(Us&&i&&(typeof i=="object"||typeof i=="function")){if(t)return vk(t,i)}else if(Yc&&e)return e.delete(i);return!1},get:function(i){return Us&&i&&(typeof i=="object"||typeof i=="function")&&t?fk(t,i):e&&e.get(i)},has:function(i){return Us&&i&&(typeof i=="object"||typeof i=="function")&&t?gk(t,i):!!e&&e.has(i)},set:function(i,s){Us&&i&&(typeof i=="object"||typeof i=="function")?(t||(t=new Us),mk(t,i,s)):Yc&&(e||(e=Yc()),e.set(i,s))}};return r}:Yc,wk=te,bk=pa,Sk=nk,_k=Zy,Ak=yk,Ek=Ak||_k||Sk,kk=function(){var t,e={assert:function(r){if(!e.has(r)){var i=r&&Object(r)===r?"the given object key":bk(r);throw new wk("Side channel does not contain "+i)}},delete:function(r){return!!t&&t.delete(r)},get:function(r){return t&&t.get(r)},has:function(r){return!!t&&t.has(r)},set:function(r,i){t||(t=Ek()),t.set(r,i)}};return e},Ck=Sr,$a=kk(),Fn=te,Lm={assert:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new Fn("`O` is not an object");if(typeof t!="string")throw new Fn("`slot` must be a string");if($a.assert(n),!Lm.has(n,t))throw new Fn("`"+t+"` is not present on `O`")},get:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new Fn("`O` is not an object");if(typeof t!="string")throw new Fn("`slot` must be a string");var e=$a.get(n);return e&&e["$"+t]},has:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new Fn("`O` is not an object");if(typeof t!="string")throw new Fn("`slot` must be a string");var e=$a.get(n);return!!e&&Ck(e,"$"+t)},set:function(n,t,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Fn("`O` is not an object");if(typeof t!="string")throw new Fn("`slot` must be a string");var r=$a.get(n);r||(r={},$a.set(n,r)),r["$"+t]=e}};Object.freeze&&Object.freeze(Lm);var Dm=Lm,Hy=wr,li=Dm,Rc=function n(t,e){if(!(this instanceof n))return new n(t,e);if(t!=="normal"&&t!=="break"&&t!=="continue"&&t!=="return"&&t!=="throw")throw new Hy('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');li.set(this,"[[Type]]",t),li.set(this,"[[Value]]",e)};Rc.prototype.type=function(){return li.get(this,"[[Type]]")};Rc.prototype.value=function(){return li.get(this,"[[Value]]")};Rc.prototype["?"]=function(){var t=li.get(this,"[[Type]]"),e=li.get(this,"[[Value]]");if(t==="throw")throw e;return e};Rc.prototype["!"]=function(){var t=li.get(this,"[[Type]]");if(t!=="normal")throw new Hy('Assertion failed: Completion Record is not of type "normal"');return li.get(this,"[[Value]]")};var Om=Rc,$k=Om,Mm=function(t){return new $k("normal",t)},Xd,H0;function Tk(){if(H0)return Xd;H0=1;var n=ca;return Xd=function(){return n()&&!!Symbol.toStringTag},Xd}var Rk=zt,V0=Rk("%Object.defineProperty%",!0),Ik=Tk()(),xk=Sr,Pk=te,Jc=Ik?Symbol.toStringTag:null,Vy=function(t,e){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 Pk("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Jc&&(r||!xk(t,Jc))&&(V0?V0(t,Jc,{configurable:!i,enumerable:!1,value:e,writable:!1}):t[Jc]=e)},By={exports:{}},Lk=zt,B0=ay,Dk=Qh(),W0=la,q0=te,Ok=Lk("%Math.floor%"),Mk=function(t,e){if(typeof t!="function")throw new q0("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||Ok(e)!==e)throw new q0("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in t&&W0){var a=W0(t,"length");a&&!a.configurable&&(i=!1),a&&!a.writable&&(s=!1)}return(i||s||!r)&&(Dk?B0(t,"length",e,!0,!0):B0(t,"length",e)),t},Nk=Ac,zk=Am,Uk=yy,Fk=function(){return Uk(Nk,zk,arguments)};(function(n){var t=Mk,e=_c,r=ed,i=Fk;n.exports=function(a){var l=r(arguments),c=1+a.length-(arguments.length-1);return t(l,c>0?c:0,!0)},e?e(n.exports,"apply",{value:i}):n.exports.apply=i})(By);var Nm=By.exports,Zk=function(t,e){for(var r=0;r<t.length;r+=1)if(!e(t[r],r,t))return!1;return!0},Hk=Object,Vk=function(t){return t&&typeof t=="object"&&(typeof t["[[ResourceValue]]"]>"u"||Hk(t["[[ResourceValue]]"])===t["[[ResourceValue]]"])&&(t["[[Hint]]"]==="SYNC-DISPOSE"||t["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof t["[[DisposeMethod]]"]=="function"||typeof t["[[DisposeMethod]]"]>"u")},Bk=Sr,Wk=Em(),qk=Zk,jk=Vk,Gk=function(t){return t&&typeof t=="object"&&Bk(t,"[[DisposableResourceStack]]")&&Wk(t["[[DisposableResourceStack]]"])&&(t["[[DisposableResourceStack]]"].length===0||qk(t["[[DisposableResourceStack]]"],jk))},Yk=br,Jk=function(t){if(t===null)return"Null";if(typeof t>"u")return"Undefined";if(Yk(t))return"Object";if(typeof t=="number")return"Number";if(typeof t=="boolean")return"Boolean";if(typeof t=="string")return"String"},Kk=Jk,zm=function(t){return typeof t=="symbol"?"Symbol":typeof t=="bigint"?"BigInt":Kk(t)},Xk=te,Qk=pa,e4=ha,t4=function(t,e){if(!e4(e))throw new Xk("Assertion failed: P is not a Property Key, got "+Qk(e));return t[e]},j0=te,n4=t4,r4=da,i4=ha,G0=pa,s4=function(t,e){if(!i4(e))throw new j0("Assertion failed: P is not a Property Key");var r=n4(t,e);if(r!=null){if(!r4(r))throw new j0(G0(e)+" is not a function: "+G0(r));return r}},Np={exports:{}},o4=zt,a4=o4,Y0=a4("%Reflect.construct%",!0),nh=$c;try{nh({},"",{"[[Get]]":function(){}})}catch{nh=null}if(nh&&Y0){var J0={},K0={};nh(K0,"length",{"[[Get]]":function(){throw J0},"[[Enumerable]]":!0}),Np.exports=function(t){try{Y0(t,K0)}catch(e){return e===J0}}}else Np.exports=function(t){return typeof t=="function"&&!!t.prototype};var l4=Np.exports,Qd=te,X0=da,c4=l4,u4=function(t){if(!c4(t))throw new Qd("C must be a constructor");var e={"[[Resolve]]":void 0,"[[Reject]]":void 0},r=new t(function(i,s){if(typeof e["[[Resolve]]"]<"u"||typeof e["[[Reject]]"]<"u")throw new Qd("executor has already been called");e["[[Resolve]]"]=i,e["[[Reject]]"]=s});if(!X0(e["[[Resolve]]"])||!X0(e["[[Reject]]"]))throw new Qd("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":e["[[Resolve]]"],"[[Reject]]":e["[[Reject]]"]}},Q0=wr,h4=te,ep=td,ev=s4,d4=u4,p4=zm,tv=Tm(),nv=Rm(),f4=function(t,e){if(p4(t)!=="Object")throw new h4("`V` must be an Object");if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new Q0("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(e==="ASYNC-DISPOSE"&&nv&&(r=ev(t,nv)),!r){if(!tv)throw new Q0("`Symbol.dispose` is not supported");if(r=ev(t,tv),typeof r<"u")return function(){var i=this;if(e==="ASYNC-DISPOSE"){var s=d4(Promise);try{ep(r,i),ep(s["[[Resolve]]"],void 0,[void 0])}catch(a){s["[[Reject]]"](a)}return s["[[Promise]]"]}ep(r,i)}}return r},m4=wr,tp=te,g4=da,v4=zm,y4=f4,w4=function(t,e){if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new m4("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(arguments.length<3)if(t==null)t=void 0,r=void 0;else{if(typeof t<"u"&&v4(t)!=="Object")throw new tp("`V` must be an Object, or `null` or `undefined`");if(r=y4(t,e),typeof r>"u")throw new tp("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!g4(r))throw new tp("`method`, when provided, must be a function");return{"[[ResourceValue]]":t,"[[Hint]]":e,"[[DisposeMethod]]":r}},b4=wr,Kc=te,S4=Gk,rv=w4,_4=pi(),A4=_4("Array.prototype.push"),Wy=function(t,e,r){if(!S4(t))throw new Kc("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new b4("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 Kc("Assertion failed: `method`, when present, must be a function");if(!t["[[DisposableResourceStack]]"])throw new Kc("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(e==null&&r==="SYNC_DISPOSE")return"UNUSED";s=rv(e,r)}else{if(typeof e<"u")throw new Kc("Assertion failed: `V` must be undefined when `method` is present");s=rv(void 0,r,i)}return A4(t["[[DisposableResourceStack]]"],s),"UNUSED"},np,iv;function Um(){if(iv)return np;iv=1;var n=zt,t=Nm,e=wr,r=n("%Promise.resolve%",!0),i=r&&t(r);return np=function(a,l){if(!i)throw new e("This environment does not support Promises.");return i(a,l)},np}var rp,sv;function E4(){if(sv)return rp;sv=1;var n=zt,t=wr,e=n("%Promise%",!0),r=td,i=Um(),s=zm;return rp=function(l,c,u){if(typeof l<"u"&&s(l)!=="Object")throw new t("Assertion failed: `V` must be `undefined` or an Object");if(c!=="SYNC-DISPOSE"&&c!=="ASYNC-DISPOSE")throw new t("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");if(typeof u<"u"&&typeof u!="function")throw new t("Assertion failed: `method` must be `undefined` or a function");var p=typeof u>"u"?u:r(u,l);if(c==="ASYNC-DISPOSE")return i(e,p)},rp}var ip,ov;function k4(){if(ov)return ip;ov=1;var n=Om;return ip=function(e){return new n("throw",e)},ip}var C4=zt,sp=wr,av=te,$4=C4("%Promise%",!0),T4=pi(),lv=T4("Promise.prototype.then",!0),R4=Om,cv=E4(),I4=Mm,x4=Um(),uv=k4(),P4=Ly(),qy=function(t,e){if(!(e instanceof R4))throw new av("`completion` must be a Completion Record");var r=t["[[DisposableResourceStack]]"];if(!r)throw new av("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 sp("mixed hint stacks are not supported");for(var a=i==="ASYNC-DISPOSE"&&x4($4,e),l=function(v){if(e.type()==="throw"){var y=e.value(),E=new P4(v,y);e=uv(E)}else e=uv(v)},c=i==="ASYNC-DISPOSE"&&function(y){return lv(a,function(){var E=cv(y["[[ResourceValue]]"],y["[[Hint]]"],y["[[DisposeMethod]]"]);if(!E)throw new sp("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return lv(E,I4)},l)},u=r.length-1;u>=0;u-=1)if(i==="ASYNC-DISPOSE")a=c(r[u]);else{var p=r[u];try{var g=cv(p["[[ResourceValue]]"],p["[[Hint]]"],p["[[DisposeMethod]]"]);if(g)throw new sp("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(v){l(v)}}return t["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?a:e},jy=function(){var t=[];return{"[[DisposableResourceStack]]":t}},id=wm,Fm=te,L4=td,fa=Cm,D4=$c,Gy=da,O4=Mm,at=Dm,M4=Vy,Yy=Cs.supportsDescriptors,N4=Nm,Zm=Wy,z4=qy,Jy=jy,hv=Tm(),Ot=function n(){if(!(this instanceof n)||at.has(this,"[[DisposableState]]")||at.has(this,"[[DisposeCapability]]"))throw new Fm("can only be used with new");at.set(this,"[[DisposableState]]","PENDING"),at.set(this,"[[DisposeCapability]]",Jy())},Ky=function(){var t=this;return at.assert(t,"[[DisposableState]]"),at.get(t,"[[DisposableState]]")==="DISPOSED"},Ic=N4(Ky);Yy?D4(Ot.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Ky}):Ot.prototype.disposed=!1;var Xy=function(t){at.set(t,"[[DisposableState]]","DISPOSED"),Yy||(t.disposed=!0)};fa(Ot.prototype,"dispose",function(){var t=this;if(!Ic(t))return Xy(t),z4(at.get(t,"[[DisposeCapability]]"),O4())["?"]()});fa(Ot.prototype,"use",function(t){var e=this;if(Ic(e))throw new id("a disposed stack can not use anything new");return Zm(at.get(e,"[[DisposeCapability]]"),t,"SYNC-DISPOSE"),t});fa(Ot.prototype,"adopt",function(t,e){var r=this;if(Ic(r))throw new id("a disposed stack can not use anything new");if(!Gy(e))throw new Fm("`onDispose` must be a function");var i=function(){return L4(e,void 0,[t])};return Zm(at.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),t});fa(Ot.prototype,"defer",function(t){var e=this;if(Ic(e))throw new id("a disposed stack can not defer anything new");if(!Gy(t))throw new Fm("`onDispose` must be a function");Zm(at.get(e,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",t)});fa(Ot.prototype,"move",function(){var t=this;if(Ic(t))throw new id("a disposed stack can not use anything new");var e=new Ot;return at.set(e,"[[DisposeCapability]]",at.get(t,"[[DisposeCapability]]")),at.set(t,"[[DisposeCapability]]",Jy()),Xy(t),e});hv&&fa(Ot.prototype,hv,Ot.prototype.dispose);M4(Ot.prototype,"DisposableStack");var U4=Ot,F4=U4,Z4=function(){return typeof DisposableStack=="function"?DisposableStack:F4},H4=Cs,V4=vm(),B4=Z4,W4=function(){var t=B4();return H4(V4,{DisposableStack:t},{DisposableStack:!0}),t},q4=zt,sd=wm,Hm=te,dv=q4("%Promise%",!0),Vm=Wy,j4=td,ma=Cm,G4=$c,Y4=qy,Qy=da,ew=jy,J4=Mm,pv=Um(),lt=Dm,K4=Vy,tw=Cs.supportsDescriptors,X4=Nm,Q4=pi(),eC=Q4("Promise.prototype.then",!0),fv=Rm(),Mt=function n(){if(!(this instanceof n)||lt.has(this,"[[AsyncDisposableState]]")||lt.has(this,"[[DisposeCapability]]"))throw new Hm("can only be used with new");lt.set(this,"[[AsyncDisposableState]]","pending"),lt.set(this,"[[DisposeCapability]]",ew())},nw=function(){var t=this;return lt.assert(t,"[[AsyncDisposableState]]"),lt.get(t,"[[AsyncDisposableState]]")==="disposed"},xc=X4(nw);tw?G4(Mt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":nw}):Mt.prototype.disposed=!1;var rw=function(t){lt.set(t,"[[AsyncDisposableState]]","disposed"),tw||(t.disposed=!0)};ma(Mt.prototype,"disposeAsync",function(){var t=this;return xc(t)?pv(dv):(rw(t),eC(pv(dv,Y4(lt.get(t,"[[DisposeCapability]]"),J4())),function(e){return e["?"]()}))});ma(Mt.prototype,"use",function(t){var e=this;if(xc(e))throw new sd("a disposed stack can not use anything new");return Vm(lt.get(e,"[[DisposeCapability]]"),t,"ASYNC-DISPOSE"),t});ma(Mt.prototype,"adopt",function(t,e){var r=this;if(xc(r))throw new sd("a disposed stack can not use anything new");if(!Qy(e))throw new Hm("`onDisposeAsync` must be a function");var i=function(){return j4(e,void 0,[t])};return i.value=t,Vm(lt.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),t});ma(Mt.prototype,"defer",function(t){var e=this;if(xc(e))throw new sd("a disposed stack can not defer anything new");if(!Qy(t))throw new Hm("`onDispose` must be a function");Vm(lt.get(e,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",t)});ma(Mt.prototype,"move",function(){var t=this;if(xc(t))throw new sd("a disposed stack can not use anything new");var e=new Mt;return lt.set(e,"[[DisposeCapability]]",lt.get(t,"[[DisposeCapability]]")),lt.set(t,"[[DisposeCapability]]",ew()),rw(t),e});fv&&ma(Mt.prototype,fv,Mt.prototype.disposeAsync);K4(Mt.prototype,"AsyncDisposableStack");var tC=Mt,nC=tC,rC=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:nC},iC=Cs,sC=vm(),oC=rC,aC=function(){var t=oC();return iC(sC,{AsyncDisposableStack:t},{AsyncDisposableStack:!0}),t},lC=iE,cC=dE,uC=W4,hC=aC,dC=function(){lC(),cC(),uC(),hC()};dC();const mv=new WeakMap;function pC(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function Fs(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function gv(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function fC(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class mC{constructor(){C(this,"entries",new Map);C(this,"constructionStack",[])}register(t,e){if(e===void 0){if(typeof t!="function")throw gv();this.validateClassRegistration(t),this.storeFactory(t,()=>this.instantiateClass(t));return}if(typeof e!="function")throw gv();if(e.constructor.name==="AsyncFunction")throw fC();this.storeFactory(t,e)}has(t){var e;return((e=this.entries.get(t))==null?void 0:e.factory)!==void 0}resolve(t){return this.resolveAny(t)}storeFactory(t,e){const r=this.getOrCreateEntry(t);r.factory=e,r.instance=void 0,r.error=void 0}validateClassRegistration(t){const e=mv.get(t);if(e){if(t.length!==e.length)throw new Error(`${Fs(t)} cannot be registered with register(Class). @injectable(...) declared ${e.length} dependencies but constructor arity is ${t.length}. Use register(Key, () => value) instead.`);return}if(t.length!==0)throw new Error(`${Fs(t)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(t){const e=mv.get(t);if(!e)return new t;const r=e.map(i=>this.resolveAny(i));return new t(...r)}resolveAny(t){return this.getOrCreateEntry(t).proxy}getOrCreateEntry(t){let e=this.entries.get(t);return e||(e={key:t},e.proxy=this.createProxy(e),this.entries.set(t,e),e)}createProxy(t){return new Proxy({},{get:(e,r)=>{if(r==="then")return;const i=this.getInstance(t),s=Reflect.get(i,r,i);return typeof s=="function"?s.bind(i):s},set:(e,r,i)=>{const s=this.getInstance(t);return Reflect.set(s,r,i,s)},has:(e,r)=>{const i=this.getInstance(t);return r in i}})}getInstance(t){if(t.instance)return t.instance;if(t.error)throw t.error;if(!t.factory)throw new Error(`${Fs(t.key)} was resolved but never registered`);const e=this.constructionStack.indexOf(t.key);if(e!==-1){const r=[...this.constructionStack.slice(e),t.key].map(i=>Fs(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(t.key);try{const r=t.factory();if(pC(r))throw new Error(`Factory for ${Fs(t.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${Fs(t.key)} returned a non-object value. Wrap primitives in an object.`);return t.instance=r,r}catch(r){throw t.error=r,r}finally{this.constructionStack.pop()}}}const iw=new mC,gC=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function vC(n){for(const t of Object.keys(n))if(gC.has(t))throw new Error(`Event payload key "${t}" is reserved; choose a different property name`)}function yC(n,t){vC(t);for(const e of Object.keys(t))Object.defineProperty(n,e,{value:t[e],writable:!0,enumerable:!0,configurable:!0})}function Ut(){class n extends Event{constructor(e,r){const{type:i,bubbles:s,cancelable:a,composed:l,...c}=r??{};if(i!==void 0)throw new Error('Do not pass "type" in init; use the constructor argument instead');super(e,{bubbles:s,cancelable:a,composed:l}),yC(this,c)}}return n}class mi extends globalThis.EventTarget{}const wC="X-Television-Client-Meta",bC="telemetry-activity",SC="telemetry-signal",sw={kind:"single",full_screen:!1},ow={width:560,height:740};function _C(n){return n.layout.flatMap(t=>t.artifactIds)}function AC(n){if(!Array.isArray(n))return{valid:!1,errors:["Layout must be an array of pages"]};const t=[];for(const[e,r]of n.entries())EC(r,e,t);return{valid:t.length===0,errors:t}}function dl(n){return n.flatMap(t=>t.artifactIds)}function zp(n,t){return n.flatMap(e=>{if(!e.artifactIds.includes(t))return[e];const r=e.artifactIds.filter(i=>i!==t);return r.length===0?[]:[{...e,artifactIds:r}]})}function EC(n,t,e){if(!op(n)){e.push(`Page ${t} must be an object`);return}for(const r of Object.keys(n))r!=="artifactIds"&&r!=="geometry"&&r!=="size"&&e.push(`Page ${t} has unknown field: ${r}`);if(!Array.isArray(n.artifactIds)||n.artifactIds.length===0?e.push(`Page ${t} must contain at least one artifact id`):n.artifactIds.some(r=>typeof r!="string"||r.length===0)&&e.push(`Page ${t} artifact ids must be non-empty strings`),!op(n.geometry)){e.push(`Page ${t} geometry must be an object`);return}for(const r of Object.keys(n.geometry))r!=="kind"&&r!=="full_screen"&&e.push(`Page ${t} geometry has unknown field: ${r}`);if(n.geometry.kind!=="single"){e.push(`Page ${t} has unknown geometry kind: ${String(n.geometry.kind)}`);return}if(typeof n.geometry.full_screen!="boolean"&&e.push(`Page ${t} single geometry must include a boolean full_screen`),!op(n.size)){e.push(`Page ${t} size must be an object`);return}for(const r of Object.keys(n.size))r!=="width"&&r!=="height"&&e.push(`Page ${t} size has unknown field: ${r}`);for(const r of["width","height"]){const i=n.size[r];(typeof i!="number"||!Number.isFinite(i)||i<=0)&&e.push(`Page ${t} size ${r} must be a finite positive number`)}}function op(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const Lt=Ut(),_u=Ut(),vv=Ut(),kC=Ut(),CC=Ut(),$C=Ut();function aw(n){class t extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return t}const ga=aw("RequestError"),yv=aw("ValidationError"),TC=200,RC=300,Xc=401;class IC{constructor(t,e){C(this,"serverURL");C(this,"token");C(this,"onUnauthorized");C(this,"telemetryMeta");this.serverURL=t.replace(/\/$/,""),this.token=e.token,this.onUnauthorized=e.onUnauthorized,this.telemetryMeta=e.telemetryMeta}async requestJSON(t,e,r){var a;const i=await this.request(t,e,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0),s=await xC(i);if(!i.ok||i.status<TC||i.status>=RC)throw i.status===Xc&&((a=this.onUnauthorized)==null||a.call(this)),this.createError(typeof s.error=="string"?s.error:i.statusText,i.status);return s}async requestVoid(t,e,r){var s;const i=await this.request(t,e,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0);if(!i.ok)throw i.status===Xc&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await ap(i,i.statusText),i.status)}async requestText(t,e){var i;const r=await this.request(t,e);if(!r.ok)throw r.status===Xc&&((i=this.onUnauthorized)==null||i.call(this)),this.createError(await ap(r,r.statusText),r.status);return r.text()}async requestRawVoid(t,e,r){var s;const i=await this.request(t,e,r,{"content-type":"text/markdown; charset=utf-8"});if(!i.ok)throw i.status===Xc&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await ap(i,i.statusText),i.status)}createError(t,e){const r={serverURL:this.serverURL};return e!==void 0&&(r.status=e),new ga(t,r)}async request(t,e,r,i){const s=`${this.serverURL}${e}`;try{return await fetch(s,{method:t,headers:this.buildHeaders(i),body:r})}catch(a){throw this.createError(a instanceof Error?a.message:"Failed to reach server")}}buildHeaders(t){const e={...t??{}};return this.token&&(e.Authorization=`Bearer ${this.token}`),this.telemetryMeta&&(e[wC]=JSON.stringify(this.telemetryMeta)),Object.keys(e).length>0?e:void 0}}async function xC(n){try{return await n.json()}catch{const t=await n.text().catch(()=>"");return t?{message:t}:{}}}async function ap(n,t){try{const e=await n.json();if(typeof e.error=="string")return e.error;if(typeof e.message=="string")return e.message}catch{}return t}function PC(n){return n.map(t=>`${t.name} (${t.id})`).join(", ")}var qn,bh,lw;class LC{constructor(t){m(this,bh);m(this,qn);d(this,qn,t)}list(){return o(this,qn).requestJSON("GET","/channels")}async get(t={}){const e=await h(this,bh,lw).call(this,t.channelID);return o(this,qn).requestJSON("GET",`/channels/${encodeURIComponent(e)}`)}create(t){const e={name:t.name};return t.id!==void 0&&(e.id=t.id),o(this,qn).requestJSON("POST","/channels",e)}update(t){const{channelID:e,...r}=t;return o(this,qn).requestJSON("PATCH",`/channels/${encodeURIComponent(e)}`,r)}remove(t){return o(this,qn).requestJSON("DELETE",`/channels/${encodeURIComponent(t.channelID)}`)}}qn=new WeakMap,bh=new WeakSet,lw=async function(t){if(t!==void 0)return t;const{channels:e}=await this.list();if(e.length===1)return e[0].id;throw e.length===0?new yv("channelID is required, but no channels exist."):new yv(`channelID is required when multiple channels exist. Available channels: ${PC(e)}`)};var jn;class DC{constructor(t){m(this,jn);d(this,jn,t)}create(t){const e={kind:t.kind,title:t.title};switch(t.kind){case"path":e.path=t.path;break;case"url":e.url=t.url;break}return e.channelID=t.channelID,o(this,jn).requestJSON("POST","/artifacts",e)}list(t={}){const e=new URLSearchParams;t.channelID!==void 0&&e.set("channelID",t.channelID);const r=e.toString();return o(this,jn).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(t){return o(this,jn).requestJSON("GET",`/artifacts/${encodeURIComponent(t.artifactID)}`)}update(t){const e={};return t.title!==void 0&&(e.title=t.title),t.path!==void 0&&(e.path=t.path),t.url!==void 0&&(e.url=t.url),o(this,jn).requestJSON("PATCH",`/artifacts/${encodeURIComponent(t.artifactID)}`,e)}delete(t){return o(this,jn).requestJSON("DELETE",`/artifacts/${encodeURIComponent(t.artifactID)}`)}}jn=new WeakMap;var uo;class OC{constructor(t){m(this,uo);d(this,uo,t)}list(){return o(this,uo).requestJSON("GET","/themes")}refresh(){return o(this,uo).requestJSON("POST","/themes/refresh")}}uo=new WeakMap;var ho;class MC{constructor(t){m(this,ho);d(this,ho,t)}get(t){return o(this,ho).requestText("GET",`/markdown/${encodeURIComponent(t.artifactID)}`)}update(t){return o(this,ho).requestRawVoid("PUT",`/markdown/${encodeURIComponent(t.artifactID)}`,t.content)}}ho=new WeakMap;var Ri;class NC{constructor(t){m(this,Ri);d(this,Ri,t)}status(){return o(this,Ri).requestJSON("GET","/telemetry")}enable(){return o(this,Ri).requestJSON("POST","/telemetry/enable")}disable(){return o(this,Ri).requestJSON("POST","/telemetry/disable")}}Ri=new WeakMap;var Ii;class zC{constructor(t){m(this,Ii);d(this,Ii,t)}get(){return o(this,Ii).requestJSON("GET","/display")}patch(t){const e={};return t.focusedChannelId!==void 0&&(e.focusedChannelId=t.focusedChannelId),t.pinnedChannelIds!==void 0&&(e.pinnedChannelIds=t.pinnedChannelIds),t.activeThemeName!==void 0&&(e.activeThemeName=t.activeThemeName),t.appearanceMode!==void 0&&(e.appearanceMode=t.appearanceMode),t.themeJavaScriptConsentIds!==void 0&&(e.themeJavaScriptConsentIds=t.themeJavaScriptConsentIds),o(this,Ii).requestVoid("PATCH","/display",e)}focus(t){return o(this,Ii).requestJSON("POST","/display/focus",{artifactID:t.artifactID})}}Ii=new WeakMap;var Ht;class UC{constructor(t,e={}){C(this,"channels");C(this,"artifacts");C(this,"display");C(this,"themes");C(this,"markdown");C(this,"telemetry");m(this,Ht);d(this,Ht,new IC(t,e)),this.channels=new LC(o(this,Ht)),this.artifacts=new DC(o(this,Ht)),this.display=new zC(o(this,Ht)),this.themes=new OC(o(this,Ht)),this.markdown=new MC(o(this,Ht)),this.telemetry=new NC(o(this,Ht))}health(){return o(this,Ht).requestJSON("GET","/health")}}Ht=new WeakMap;const rh="0.0.0",FC=/^\d+\.\d+\.\d+$/,ZC=3;function od(n){return FC.test(n)}function Bm(n,t){const e=n.split(".").map(Number),r=t.split(".").map(Number);for(let i=0;i<ZC;i++)if(e[i]!==r[i])return e[i]>r[i];return!1}function HC(n,t){return n===rh||t===rh?!1:n!==t}const VC=400,BC=404,cw=500,WC=600,qC={focusedChannelId:null,pinnedChannelIds:[],activeThemeName:null,activeThemeColorScheme:null,appearanceMode:"system",themeJavaScriptConsentIds:[],acpEnabled:!1};var ee,yl,wl,Gn,Ce,le,xi,Rr,Pi,Yn,pt,po,bl,P,sn,Up,Vs,uw,Fp,hw,Au,Zp,dw,Bs,pw,Hn,Hp,fw,ke;class jC extends mi{constructor(e){super();m(this,P);m(this,ee);m(this,yl);m(this,wl);m(this,Gn,new Set);C(this,"pendingPageWrites",new Map);m(this,Ce,new Map);m(this,le,JC());m(this,xi);m(this,Rr,!1);m(this,Pi,!1);m(this,Yn,0);m(this,pt,!1);m(this,po,()=>{if(o(this,pt))return;const e=o(this,ee).connection.status==="connected";e&&!o(this,Pi)?(d(this,Pi,!0),h(this,P,pw).call(this)):!e&&o(this,Pi)&&(d(this,Pi,!1),d(this,Yn,o(this,Yn)+1)),h(this,P,Hn).call(this)});m(this,bl,e=>{if(o(this,pt)||e.serverURL!==o(this,ee).connection.url)return;for(const i of o(this,Gn))i.push(e.event);const r=e.event;if(r.type==="artifact-content-changed"){this.dispatchEvent(new vv("artifact-content-changed",{artifactID:r.artifactID}));return}if(r.type==="artifact-focus"){o(this,Rr)&&ih(o(this,le),o(this,Ce),r.channelID,r.artifactID)&&h(this,P,Hn).call(this),this.dispatchEvent(new kC("artifact-focus",{channelID:r.channelID,artifactID:r.artifactID}));return}r.type==="theme-changed"&&this.dispatchEvent(new CC("theme-changed",{themeName:r.themeName,activeThemeColorScheme:r.activeThemeColorScheme,themeJavaScriptConsentIds:[...r.themeJavaScriptConsentIds]})),r.type==="appearance-changed"&&this.dispatchEvent(new $C("appearance-changed",{appearanceMode:r.appearanceMode})),o(this,Rr)&&(Qc(o(this,le),r,this.pendingPageWrites,o(this,Ce)),lp(o(this,le),o(this,Ce)),h(this,P,Hn).call(this))});d(this,ee,e.connectionOwner),d(this,yl,e.navigationKeyHandler),d(this,wl,e.retainedGateHalted??(()=>!1)),d(this,xi,h(this,P,Hp).call(this)),o(this,ee).addEventListener("change",o(this,po)),o(this,ee).addEventListener("server-event",o(this,bl)),o(this,po).call(this)}get snapshot(){return o(this,xi)}handleNavigationKey(e){var r;h(this,P,ke).call(this),(r=o(this,yl))==null||r.call(this,e)}authenticate(e){return h(this,P,ke).call(this),o(this,ee).authenticate(e)}async createChannel(e){h(this,P,ke).call(this);const{channel:r}=await h(this,P,sn).call(this,o(this,ee).connection.client.channels.create({name:e}),()=>h(this,P,uw).call(this));return r}focusChannel(e){return h(this,P,ke).call(this),h(this,P,sn).call(this,o(this,ee).connection.client.display.patch({focusedChannelId:e}),()=>h(this,P,Vs).call(this))}setPinnedChannelIds(e){return h(this,P,ke).call(this),h(this,P,sn).call(this,o(this,ee).connection.client.display.patch({pinnedChannelIds:[...e]}),()=>h(this,P,Vs).call(this))}listThemes(){return h(this,P,ke).call(this),o(this,ee).connection.client.themes.list()}refreshThemes(){return h(this,P,ke).call(this),o(this,ee).connection.client.themes.refresh()}setActiveTheme(e){return h(this,P,ke).call(this),h(this,P,sn).call(this,o(this,ee).connection.client.display.patch({activeThemeName:e}),()=>h(this,P,Vs).call(this))}setAppearanceMode(e){return h(this,P,ke).call(this),h(this,P,sn).call(this,o(this,ee).connection.client.display.patch({appearanceMode:e}),()=>h(this,P,Vs).call(this))}setThemeJavaScriptConsent(e,r){h(this,P,ke).call(this);const i=o(this,le).display.themeJavaScriptConsentIds,s=r?i.includes(e)?[...i]:[...i,e]:i.filter(a=>a!==e);return h(this,P,sn).call(this,o(this,ee).connection.client.display.patch({themeJavaScriptConsentIds:s}),()=>h(this,P,Vs).call(this))}selectPage(e,r){h(this,P,ke).call(this),ih(o(this,le),o(this,Ce),e,r)&&h(this,P,Hn).call(this)}async renameChannel(e,r){h(this,P,ke).call(this),await h(this,P,sn).call(this,o(this,ee).connection.client.channels.update({channelID:e,name:r}),()=>h(this,P,Fp).call(this,e))}async deleteChannel(e){h(this,P,ke).call(this),await h(this,P,sn).call(this,o(this,ee).connection.client.channels.remove({channelID:e}),()=>h(this,P,hw).call(this,e))}updateChannelPages(e,r){h(this,P,ke).call(this);const i=AC(r),s=o(this,le).channels.get(e);if(!i.valid||!s)return Promise.resolve();const a=Ci(r),l=Ci(s.channel.layout),c={previousPages:l};return _s(o(this,Ce),e,l,a),s.channel={...s.channel,layout:a},this.pendingPageWrites.set(e,c),h(this,P,Hn).call(this),o(this,ee).connection.client.channels.update({channelID:e,layout:Ci(a)}).then(()=>{this.pendingPageWrites.get(e)===c&&this.pendingPageWrites.delete(e)},async u=>{if(o(this,pt))throw u;const p=this.pendingPageWrites.get(e)===c;if(p&&this.pendingPageWrites.delete(e),bv(u))throw await h(this,P,Up).call(this,()=>h(this,P,Fp).call(this,e)),u;if(!p||!t$(u))throw u;const g=o(this,le).channels.get(e);if(!g)throw u;const v=Ci(c.previousPages);throw _s(o(this,Ce),e,g.channel.layout,v),g.channel={...g.channel,layout:v},h(this,P,Hn).call(this),u})}async deleteArtifact(e){h(this,P,ke).call(this);const r=Sv(o(this,le),e);await h(this,P,sn).call(this,o(this,ee).connection.client.artifacts.delete({artifactID:e}),()=>h(this,P,dw).call(this,e,r))}readMarkdown(e){return h(this,P,ke).call(this),o(this,ee).connection.client.markdown.get({artifactID:e})}writeMarkdown(e,r){return h(this,P,ke).call(this),o(this,ee).connection.client.markdown.update({artifactID:e,content:r})}getArtifactViewURL(e){return h(this,P,ke).call(this),o(this,ee).connection.getViewURL(e)}getArtifactContentURL(e){return h(this,P,ke).call(this),o(this,ee).connection.getContentURL(e)}dispose(){o(this,pt)||(d(this,pt,!0),d(this,Yn,o(this,Yn)+1),o(this,Gn).clear(),this.pendingPageWrites.clear(),o(this,Ce).clear(),o(this,ee).removeEventListener("change",o(this,po)),o(this,ee).removeEventListener("server-event",o(this,bl)))}}ee=new WeakMap,yl=new WeakMap,wl=new WeakMap,Gn=new WeakMap,Ce=new WeakMap,le=new WeakMap,xi=new WeakMap,Rr=new WeakMap,Pi=new WeakMap,Yn=new WeakMap,pt=new WeakMap,po=new WeakMap,bl=new WeakMap,P=new WeakSet,sn=async function(e,r){try{return await e}catch(i){throw!o(this,pt)&&bv(i)&&await h(this,P,Up).call(this,r),i}},Up=async function(e){try{await e()}catch{}},Vs=function(){const e=o(this,ee).connection.client;return h(this,P,Bs).call(this,()=>e.display.get(),r=>h(this,P,Au).call(this,r))},uw=function(){const e=o(this,ee).connection.client;return h(this,P,Bs).call(this,async()=>{const[{channels:r},i]=await Promise.all([e.channels.list(),e.display.get()]);return{channels:r,display:i}},({channels:r,display:i})=>{const s=new Set(r.map(({id:a})=>a));for(const a of o(this,le).channels.keys())s.has(a)||(this.pendingPageWrites.delete(a),o(this,Ce).delete(a),o(this,le).channels.delete(a));for(const a of r)o(this,le).channels.has(a.id)||o(this,le).channels.set(a.id,{channel:lo(a),artifacts:new Map});h(this,P,Au).call(this,i)})},Fp=function(e){const r=o(this,ee).connection.client;return h(this,P,Bs).call(this,()=>cp(()=>r.channels.get({channelID:e})),i=>h(this,P,Zp).call(this,e,i))},hw=function(e){const r=o(this,ee).connection.client;return h(this,P,Bs).call(this,async()=>{const[i,s]=await Promise.all([cp(()=>r.channels.get({channelID:e})),r.display.get()]);return{detail:i,display:s}},({detail:i,display:s})=>{h(this,P,Zp).call(this,e,i),h(this,P,Au).call(this,s)})},Au=function(e){o(this,le).display=Bp(e),o(this,ee).connection.acpClient.setEnabled(e.acpEnabled)},Zp=function(e,r){this.pendingPageWrites.delete(e);const i=o(this,le).channels.get(e);if(r===null){o(this,Ce).delete(e),o(this,le).channels.delete(e);return}_s(o(this,Ce),e,(i==null?void 0:i.channel.layout)??[],r.channel.layout),o(this,le).channels.set(e,{channel:lo(r.channel),artifacts:new Map(r.artifacts.map(s=>[s.id,structuredClone(s)]))})},dw=function(e,r){const i=o(this,ee).connection.client;return h(this,P,Bs).call(this,()=>cp(()=>i.artifacts.get({artifactID:e})),s=>{const a=Sv(o(this,le),e)??r;if(s===null){a!==null&&Qc(o(this,le),{type:"artifact-removed",channelID:a,artifactID:e},this.pendingPageWrites,o(this,Ce));return}const l=a===null?void 0:o(this,le).channels.get(a);l==null||l.artifacts.set(e,structuredClone(s.artifact))})},Bs=async function(e,r){const i=o(this,Yn),s=[];o(this,Gn).add(s);try{const a=await e();if(o(this,pt)||i!==o(this,Yn))return;r(a);for(const l of s)Qc(o(this,le),l,this.pendingPageWrites,o(this,Ce));lp(o(this,le),o(this,Ce)),h(this,P,Hn).call(this)}finally{o(this,Gn).delete(s)}},pw=async function(){const e=++Wc(this,Yn)._,r=o(this,ee).connection,i=r.client,s=[];o(this,Gn).add(s);try{const[{channels:a},l]=await Promise.all([i.channels.list(),i.display.get()]),c=await Promise.all(a.map(({id:g})=>i.channels.get({channelID:g})));if(o(this,pt)||e!==o(this,Yn))return;const u={channels:new Map,display:Bp(l)};for(const g of c)u.channels.set(g.channel.id,{channel:lo(g.channel),artifacts:new Map(g.artifacts.map(v=>[v.id,structuredClone(v)]))});KC(o(this,Ce),o(this,le),u);for(const g of s)Qc(u,g,this.pendingPageWrites,o(this,Ce));lp(u,o(this,Ce));const p=o(this,Rr)?GC(o(this,le),u):[];this.pendingPageWrites.clear(),d(this,le,u),d(this,Rr,!0),r.acpClient.setEnabled(l.acpEnabled),h(this,P,Hn).call(this);for(const g of p)this.dispatchEvent(new vv("artifact-content-changed",{artifactID:g}))}catch{}finally{o(this,Gn).delete(s)}},Hn=function(){o(this,pt)||(d(this,xi,h(this,P,Hp).call(this)),h(this,P,fw).call(this),this.dispatchEvent(new Lt("change")))},Hp=function(){var s;const e=[...o(this,le).channels.values()].map(a=>QC(a,o(this,Ce).get(a.channel.id))),r=e.find(({id:a})=>a===o(this,le).display.focusedChannelId)??null,i=o(this,ee).connection;return Object.freeze({ready:o(this,Rr),channels:Object.freeze(e),display:e$(o(this,le).display),focusedChannel:r,connection:Object.freeze({authorizationRequired:i.hasAuthRejected,authorizationRejected:i.hasAuthTokenRejected,gateHalted:i.bootState==="halted"||o(this,wl).call(this),status:i.status,hasEverConnected:i.hasEverConnected,firstConnectError:i.hasEverConnected?null:o(this,ee).connectError,nextRetryAt:i.nextRetryAt,upgradeInstructions:YC(((s=i.updateState)==null?void 0:s.desktop)??null)})})},fw=function(){const e=o(this,xi).focusedChannel;o(this,ee).connection.acpClient.setChannelContext(e?{channelID:e.id,channelName:e.name}:null)},ke=function(){if(o(this,pt))throw new Error("ApplicationService is disposed")};function GC(n,t){const e=t.display.focusedChannelId;if(e===null||n.display.focusedChannelId!==e)return[];const r=n.channels.get(e),i=t.channels.get(e);if(!r||!i)return[];const s=new Set(dl(r.channel.layout));return dl(i.channel.layout).filter(a=>{var l,c;return s.has(a)&&((l=r.artifacts.get(a))==null?void 0:l.kind)==="path"&&((c=i.artifacts.get(a))==null?void 0:c.kind)==="path"})}function YC(n){return n===null?null:Object.freeze({...n})}function JC(){return{channels:new Map,display:Bp(qC)}}function Qc(n,t,e,r){switch(t.type){case"channel-created":r.delete(t.channel.id),n.channels.set(t.channel.id,{channel:lo(t.channel),artifacts:new Map});return;case"channel-updated":{e.delete(t.channel.id);const i=n.channels.get(t.channel.id);if(!i){r.delete(t.channel.id),n.channels.set(t.channel.id,{channel:lo(t.channel),artifacts:new Map});return}_s(r,t.channel.id,i.channel.layout,t.channel.layout);const s=new Set(dl(t.channel.layout));i.channel=lo(t.channel);for(const a of i.artifacts.keys())s.has(a)||i.artifacts.delete(a);return}case"channel-removed":e.delete(t.channelID),r.delete(t.channelID),n.channels.delete(t.channelID);return;case"channel-changed":n.display.focusedChannelId=t.channelID;return;case"pinned-channels-changed":n.display.pinnedChannelIds=[...t.pinnedChannelIds];return;case"theme-changed":n.display.activeThemeName=t.themeName,n.display.activeThemeColorScheme=t.activeThemeColorScheme,n.display.themeJavaScriptConsentIds=[...t.themeJavaScriptConsentIds];return;case"appearance-changed":n.display.appearanceMode=t.appearanceMode;return;case"artifact-created":{const i=n.channels.get(t.channelID);if(!i)return;const s=e.get(t.channelID);if(s&&(s.previousPages=wv(s.previousPages,t.artifact.id)),!dl(i.channel.layout).includes(t.artifact.id)){const a=i.channel.layout,l=wv(a,t.artifact.id);_s(r,t.channelID,a,l),i.channel={...i.channel,layout:l}}i.artifacts.set(t.artifact.id,structuredClone(t.artifact));return}case"artifact-updated":for(const i of n.channels.values())if(i.artifacts.has(t.artifact.id)){i.artifacts.set(t.artifact.id,structuredClone(t.artifact));return}return;case"artifact-removed":{const i=n.channels.get(t.channelID);if(!i)return;const s=e.get(t.channelID);s&&(s.previousPages=zp(s.previousPages,t.artifactID)),i.artifacts.delete(t.artifactID);const a=i.channel.layout,l=zp(a,t.artifactID);_s(r,t.channelID,a,l),i.channel={...i.channel,layout:l};return}case"artifact-focus":ih(n,r,t.channelID,t.artifactID);return;case"artifact-content-changed":return;default:return n$(t)}}function KC(n,t,e){var r;for(const i of n.keys())e.channels.has(i)||n.delete(i);for(const[i,s]of e.channels)_s(n,i,((r=t.channels.get(i))==null?void 0:r.channel.layout)??[],s.channel.layout)}function _s(n,t,e,r){const i=n.get(t);if(i===void 0)return;if(r.length===0){n.delete(t);return}const s=Vp(r,i);if(s!==-1){n.set(t,[...r[s].artifactIds]);return}const a=Vp(e,i),l=a===-1?0:Math.min(a,r.length-1);n.set(t,[...r[l].artifactIds])}function ih(n,t,e,r){const i=n.channels.get(e),s=i==null?void 0:i.channel.layout.find(({artifactIds:l})=>l.includes(r));if(!s)return!1;const a=t.get(e);return a&&XC(a,s.artifactIds)?!1:(t.set(e,[...s.artifactIds]),!0)}function lp(n,t){var i,s;const e=n.display.focusedChannelId;if(e===null||t.has(e))return;const r=(s=(i=n.channels.get(e))==null?void 0:i.channel.layout[0])==null?void 0:s.artifactIds[0];r!==void 0&&ih(n,t,e,r)}function Vp(n,t){const e=new Set(t);return n.findIndex(r=>r.artifactIds.some(i=>e.has(i)))}function XC(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}function QC(n,t){const e=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=t===void 0?0:Vp(n.channel.layout,t),i=e[r]??e[0]??null,s=Object.freeze([...n.artifacts.values()].map(l=>Object.freeze(structuredClone(l)))),a={id:n.channel.id,name:n.channel.name,pages:e,selectedPage:i,artifacts:s};return Object.freeze(n.channel.onboarding?{...a,onboarding:Object.freeze({...n.channel.onboarding})}:a)}function e$(n){return Object.freeze({focusedChannelId:n.focusedChannelId,pinnedChannelIds:Object.freeze([...n.pinnedChannelIds]),activeThemeName:n.activeThemeName,activeThemeColorScheme:n.activeThemeColorScheme,appearanceMode:n.appearanceMode,themeJavaScriptConsentIds:Object.freeze([...n.themeJavaScriptConsentIds]),acpEnabled:n.acpEnabled})}function wv(n,t){return dl(n).includes(t)?Ci(n):[...Ci(n),{artifactIds:[t],geometry:{...sw},size:{...ow}}]}function t$(n){return n instanceof ga&&n.status!==void 0&&n.status>=VC&&n.status<cw}function bv(n){return n instanceof ga&&(n.status===void 0||n.status>=cw&&n.status<WC)}async function cp(n){try{return await n()}catch(t){if(t instanceof ga&&t.status===BC)return null;throw t}}function Sv(n,t){for(const[e,r]of n.channels)if(r.artifacts.has(t))return e;return null}function Ci(n){return n.map(t=>({artifactIds:[...t.artifactIds],geometry:{...t.geometry},size:{...t.size}}))}function lo(n){return{id:n.id,name:n.name,layout:Ci(n.layout),...n.onboarding?{onboarding:{...n.onboarding}}:{}}}function Bp(n){return{focusedChannelId:n.focusedChannelId,pinnedChannelIds:[...n.pinnedChannelIds],activeThemeName:n.activeThemeName,activeThemeColorScheme:n.activeThemeColorScheme,appearanceMode:n.appearanceMode,themeJavaScriptConsentIds:[...n.themeJavaScriptConsentIds],acpEnabled:n.acpEnabled}}function n$(n){throw new Error(`Unexpected server event: ${JSON.stringify(n)}`)}function r$(n,t){var c;const e=n.snapshot,r=e.focusedChannel;if(t==="ArrowLeft"||t==="ArrowRight"){if(r===null||r.selectedPage===null)return!1;const u=r.pages.indexOf(r.selectedPage),p=u+(t==="ArrowLeft"?-1:1),g=(c=r.pages[p])==null?void 0:c.artifactIds[0];return u===-1||g===void 0?!1:(_v(),n.selectPage(r.id,g),!0)}const i=i$(e),s=r===null?-1:i.indexOf(r.id),a=s+(t==="ArrowUp"?-1:1),l=i[a];return s===-1||l===void 0?!1:(_v(),n.focusChannel(l).catch(()=>{}),!0)}function i$(n){const t=new Map(n.channels.map(s=>[s.id,s])),e=n.display.pinnedChannelIds.filter(s=>t.has(s)),r=new Set(e),i=n.channels.filter(({id:s})=>!r.has(s)).map(({id:s})=>s).sort((s,a)=>a.localeCompare(s));return[...e,...i]}function _v(){const n=document.activeElement;n instanceof HTMLElement&&n.blur()}const mw="0123456789ABCDEFGHJKMNPQRSTVWXYZ",sh=32,s$=16,gw=10,Av=0xffffffffffff;var $i;(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"})($i||($i={}));class Fa extends Error{constructor(t,e){super(`${e} (${t})`),this.name="ULIDError",this.code=t}}function o$(n){const t=Math.floor(n()*sh)%sh;return mw.charAt(t)}function a$(n){const t=l$(),e=t&&(t.crypto||t.msCrypto)||null;if(typeof(e==null?void 0:e.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return e.getRandomValues(r),r[0]/256};if(typeof(e==null?void 0:e.randomBytes)=="function")return()=>e.randomBytes(1).readUInt8()/256;throw new Fa($i.PRNGDetectFailure,"Failed to find a reliable PRNG")}function l$(){return h$()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function c$(n,t){let e="";for(;n>0;n--)e=o$(t)+e;return e}function u$(n,t=gw){if(isNaN(n))throw new Fa($i.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>Av)throw new Fa($i.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Av}: ${n}`);if(n<0)throw new Fa($i.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Fa($i.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let e,r="";for(let i=t;i>0;i--)e=n%sh,r=mw.charAt(e)+r,n=(n-e)/sh;return r}function h$(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function Wm(n,t){const e=a$(),r=Date.now();return u$(r,gw)+c$(s$,e)}const Za=Ut(),vw=Ut(),yw=Ut(),d$=Ut(),up=Ut(),p$="store-";function ci(n){return new URL(n).origin}function f$(){return{authTokens:{}}}var Li,Di,Oi;class m$ extends mi{constructor(e,r,i={}){super();m(this,Li);m(this,Di);m(this,Oi);d(this,Li,`${p$}${e}`),d(this,Di,i.storage??v$());const s=o(this,Di).getItem(o(this,Li));s===null?(d(this,Oi,r),o(this,Di).setItem(o(this,Li),JSON.stringify(r))):d(this,Oi,y$(JSON.parse(s),r))}get(){return o(this,Oi)}set(e){d(this,Oi,e),o(this,Di).setItem(o(this,Li),JSON.stringify(e)),this.dispatchEvent(new Lt("change"))}}Li=new WeakMap,Di=new WeakMap,Oi=new WeakMap;function Ev(n,t){return n.authTokens[ci(t)]??null}function kv(n,t,e){return{authTokens:{...n.authTokens,[ci(t)]:e}}}function g$(n,t){const e=ci(t);if(!(e in n.authTokens))return n;const r={...n.authTokens};return delete r[e],{authTokens:r}}function v$(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function y$(n,t){if(typeof n!="object"||n===null||Array.isArray(n))return t;const e=n.authTokens;if(typeof e!="object"||e===null||Array.isArray(e))return t;const r={};for(const[i,s]of Object.entries(e))if(typeof s=="string")try{r[ci(i)]=s}catch{}return{authTokens:r}}function k(n,t,e){function r(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(n))return;l._zod.traits.add(n),t(l,c);const u=a.prototype,p=Object.keys(u);for(let g=0;g<p.length;g++){const v=p[g];v in l||(l[v]=u[v].bind(l))}}const i=(e==null?void 0:e.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function a(l){var c;const u=e!=null&&e.Parent?new s:this;r(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const p of u._zod.deferred)p();return u}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>{var c,u;return e!=null&&e.Parent&&l instanceof e.Parent?!0:(u=(c=l==null?void 0:l._zod)==null?void 0:c.traits)==null?void 0:u.has(n)}}),Object.defineProperty(a,"name",{value:n}),a}class co extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ww extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const bw={};function ui(n){return bw}function Sw(n){const t=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function Wp(n,t){return typeof t=="bigint"?t.toString():t}function ad(n){return{get value(){{const t=n();return Object.defineProperty(this,"value",{value:t}),t}}}}function qm(n){return n==null}function jm(n){const t=n.startsWith("^")?1:0,e=n.endsWith("$")?n.length-1:n.length;return n.slice(t,e)}function w$(n,t){const e=(n.toString().split(".")[1]||"").length,r=t.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=e>i?e:i,a=Number.parseInt(n.toFixed(s).replace(".","")),l=Number.parseInt(t.toFixed(s).replace(".",""));return a%l/10**s}const Cv=Symbol("evaluating");function ce(n,t,e){let r;Object.defineProperty(n,t,{get(){if(r!==Cv)return r===void 0&&(r=Cv,r=e()),r},set(i){Object.defineProperty(n,t,{value:i})},configurable:!0})}function Ts(n,t,e){Object.defineProperty(n,t,{value:e,writable:!0,enumerable:!0,configurable:!0})}function gi(...n){const t={};for(const e of n){const r=Object.getOwnPropertyDescriptors(e);Object.assign(t,r)}return Object.defineProperties({},t)}function $v(n){return JSON.stringify(n)}function b$(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const _w="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function pl(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const S$=ad(()=>{var n;if(typeof navigator<"u"&&((n=navigator==null?void 0:navigator.userAgent)!=null&&n.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function ia(n){if(pl(n)===!1)return!1;const t=n.constructor;if(t===void 0||typeof t!="function")return!0;const e=t.prototype;return!(pl(e)===!1||Object.prototype.hasOwnProperty.call(e,"isPrototypeOf")===!1)}function Aw(n){return ia(n)?{...n}:Array.isArray(n)?[...n]:n}const _$=new Set(["string","number","symbol"]);function sa(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vi(n,t,e){const r=new n._zod.constr(t??n._zod.def);return(!t||e!=null&&e.parent)&&(r._zod.parent=n),r}function U(n){const t=n;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function A$(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}const E$={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 k$(n,t){const e=n._zod.def,r=e.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=gi(n._zod.def,{get shape(){const a={};for(const l in t){if(!(l in e.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(a[l]=e.shape[l])}return Ts(this,"shape",a),a},checks:[]});return vi(n,s)}function C$(n,t){const e=n._zod.def,r=e.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=gi(n._zod.def,{get shape(){const a={...n._zod.def.shape};for(const l in t){if(!(l in e.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete a[l]}return Ts(this,"shape",a),a},checks:[]});return vi(n,s)}function $$(n,t){if(!ia(t))throw new Error("Invalid input to extend: expected a plain object");const e=n._zod.def.checks;if(e&&e.length>0){const s=n._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=gi(n._zod.def,{get shape(){const s={...n._zod.def.shape,...t};return Ts(this,"shape",s),s}});return vi(n,i)}function T$(n,t){if(!ia(t))throw new Error("Invalid input to safeExtend: expected a plain object");const e=gi(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t};return Ts(this,"shape",r),r}});return vi(n,e)}function R$(n,t){const e=gi(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t._zod.def.shape};return Ts(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return vi(n,e)}function I$(n,t,e){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=gi(t._zod.def,{get shape(){const l=t._zod.def.shape,c={...l};if(e)for(const u in e){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);e[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 Ts(this,"shape",c),c},checks:[]});return vi(t,a)}function x$(n,t,e){const r=gi(t._zod.def,{get shape(){const i=t._zod.def.shape,s={...i};if(e)for(const a in e){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(s[a]=new n({type:"nonoptional",innerType:i[a]}))}else for(const a in i)s[a]=new n({type:"nonoptional",innerType:i[a]});return Ts(this,"shape",s),s}});return vi(t,r)}function ro(n,t=0){var e;if(n.aborted===!0)return!0;for(let r=t;r<n.issues.length;r++)if(((e=n.issues[r])==null?void 0:e.continue)!==!0)return!0;return!1}function io(n,t){return t.map(e=>{var r;return(r=e).path??(r.path=[]),e.path.unshift(n),e})}function eu(n){return typeof n=="string"?n:n==null?void 0:n.message}function hi(n,t,e){var i,s,a,l,c,u;const r={...n,path:n.path??[]};if(!n.message){const p=eu((a=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:a.call(s,n))??eu((l=t==null?void 0:t.error)==null?void 0:l.call(t,n))??eu((c=e.customError)==null?void 0:c.call(e,n))??eu((u=e.localeError)==null?void 0:u.call(e,n))??"Invalid input";r.message=p}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Gm(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function fl(...n){const[t,e,r]=n;return typeof t=="string"?{message:t,code:"custom",input:e,inst:r}:{...t}}const Ew=(n,t)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:t,enumerable:!1}),n.message=JSON.stringify(t,Wp,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},kw=k("$ZodError",Ew),Cw=k("$ZodError",Ew,{Parent:Error});function P$(n,t=e=>e.message){const e={},r=[];for(const i of n.issues)i.path.length>0?(e[i.path[0]]=e[i.path[0]]||[],e[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:e}}function L$(n,t=e=>e.message){const e={_errors:[]},r=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a}));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)e._errors.push(t(s));else{let a=e,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return r(n),e}const Ym=n=>(t,e,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:e,issues:[]},s);if(a instanceof Promise)throw new co;if(a.issues.length){const l=new((i==null?void 0:i.Err)??n)(a.issues.map(c=>hi(c,s,ui())));throw _w(l,i==null?void 0:i.callee),l}return a.value},Jm=n=>async(t,e,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:e,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const l=new((i==null?void 0:i.Err)??n)(a.issues.map(c=>hi(c,s,ui())));throw _w(l,i==null?void 0:i.callee),l}return a.value},ld=n=>(t,e,r)=>{const i=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:e,issues:[]},i);if(s instanceof Promise)throw new co;return s.issues.length?{success:!1,error:new(n??kw)(s.issues.map(a=>hi(a,i,ui())))}:{success:!0,data:s.value}},D$=ld(Cw),cd=n=>async(t,e,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:e,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new n(s.issues.map(a=>hi(a,i,ui())))}:{success:!0,data:s.value}},O$=cd(Cw),M$=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ym(n)(t,e,i)},N$=n=>(t,e,r)=>Ym(n)(t,e,r),z$=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Jm(n)(t,e,i)},U$=n=>async(t,e,r)=>Jm(n)(t,e,r),F$=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ld(n)(t,e,i)},Z$=n=>(t,e,r)=>ld(n)(t,e,r),H$=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return cd(n)(t,e,i)},V$=n=>async(t,e,r)=>cd(n)(t,e,r),B$=/^[cC][^\s-]{8,}$/,W$=/^[0-9a-z]+$/,q$=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,j$=/^[0-9a-vA-V]{20}$/,G$=/^[A-Za-z0-9]{27}$/,Y$=/^[a-zA-Z0-9_-]{21}$/,J$=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,K$=/^([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})$/,Tv=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)$/,X$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Q$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function eT(){return new RegExp(Q$,"u")}const tT=/^(?:(?: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])$/,nT=/^(([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}|:))$/,rT=/^((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])$/,iT=/^(([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])$/,sT=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$w=/^[A-Za-z0-9_-]*$/,oT=/^\+[1-9]\d{6,14}$/,Tw="(?:(?:\\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])))",aT=new RegExp(`^${Tw}$`);function Rw(n){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${t}`:n.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${n.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function lT(n){return new RegExp(`^${Rw(n)}$`)}function cT(n){const t=Rw({precision:n.precision}),e=["Z"];n.local&&e.push(""),n.offset&&e.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${e.join("|")})`;return new RegExp(`^${Tw}T(?:${r})$`)}const uT=n=>{const t=n?`[\\s\\S]{${(n==null?void 0:n.minimum)??0},${(n==null?void 0:n.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},hT=/^-?\d+$/,Iw=/^-?\d+(?:\.\d+)?$/,dT=/^(?:true|false)$/i,pT=/^[^A-Z]*$/,fT=/^[^a-z]*$/,ht=k("$ZodCheck",(n,t)=>{var e;n._zod??(n._zod={}),n._zod.def=t,(e=n._zod).onattach??(e.onattach=[])}),xw={number:"number",bigint:"bigint",object:"date"},Pw=k("$ZodCheckLessThan",(n,t)=>{ht.init(n,t);const e=xw[typeof t.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),n._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:e,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),Lw=k("$ZodCheckGreaterThan",(n,t)=>{ht.init(n,t);const e=xw[typeof t.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),n._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:e,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),mT=k("$ZodCheckMultipleOf",(n,t)=>{ht.init(n,t),n._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),n._zod.check=e=>{if(typeof e.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof e.value=="bigint"?e.value%t.value===BigInt(0):w$(e.value,t.value)===0)||e.issues.push({origin:typeof e.value,code:"not_multiple_of",divisor:t.value,input:e.value,inst:n,continue:!t.abort})}}),gT=k("$ZodCheckNumberFormat",(n,t)=>{var a;ht.init(n,t),t.format=t.format||"float64";const e=(a=t.format)==null?void 0:a.includes("int"),r=e?"int":"number",[i,s]=E$[t.format];n._zod.onattach.push(l=>{const c=l._zod.bag;c.format=t.format,c.minimum=i,c.maximum=s,e&&(c.pattern=hT)}),n._zod.check=l=>{const c=l.value;if(e){if(!Number.isInteger(c)){l.issues.push({expected:r,format:t.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:!t.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:!t.abort});return}}c<i&&l.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!t.abort}),c>s&&l.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:n,continue:!t.abort})}}),vT=k("$ZodCheckMaxLength",(n,t)=>{var e;ht.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!qm(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(r._zod.bag.maximum=t.maximum)}),n._zod.check=r=>{const i=r.value;if(i.length<=t.maximum)return;const a=Gm(i);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),yT=k("$ZodCheckMinLength",(n,t)=>{var e;ht.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!qm(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.bag.minimum=t.minimum)}),n._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const a=Gm(i);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),wT=k("$ZodCheckLengthEquals",(n,t)=>{var e;ht.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!qm(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),n._zod.check=r=>{const i=r.value,s=i.length;if(s===t.length)return;const a=Gm(i),l=s>t.length;r.issues.push({origin:a,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!t.abort})}}),ud=k("$ZodCheckStringFormat",(n,t)=>{var e,r;ht.init(n,t),n._zod.onattach.push(i=>{const s=i._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(e=n._zod).check??(e.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:n,continue:!t.abort})}):(r=n._zod).check??(r.check=()=>{})}),bT=k("$ZodCheckRegex",(n,t)=>{ud.init(n,t),n._zod.check=e=>{t.pattern.lastIndex=0,!t.pattern.test(e.value)&&e.issues.push({origin:"string",code:"invalid_format",format:"regex",input:e.value,pattern:t.pattern.toString(),inst:n,continue:!t.abort})}}),ST=k("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=pT),ud.init(n,t)}),_T=k("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=fT),ud.init(n,t)}),AT=k("$ZodCheckIncludes",(n,t)=>{ht.init(n,t);const e=sa(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${e}`:e);t.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(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:n,continue:!t.abort})}}),ET=k("$ZodCheckStartsWith",(n,t)=>{ht.init(n,t);const e=new RegExp(`^${sa(t.prefix)}.*`);t.pattern??(t.pattern=e),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(e)}),n._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:n,continue:!t.abort})}}),kT=k("$ZodCheckEndsWith",(n,t)=>{ht.init(n,t);const e=new RegExp(`.*${sa(t.suffix)}$`);t.pattern??(t.pattern=e),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(e)}),n._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:n,continue:!t.abort})}}),CT=k("$ZodCheckOverwrite",(n,t)=>{ht.init(n,t),n._zod.check=e=>{e.value=t.tx(e.value)}});class $T{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
5
+ `).filter(a=>a),i=Math.min(...r.map(a=>a.length-a.trimStart().length)),s=r.map(a=>a.slice(i)).map(a=>" ".repeat(this.indent*2)+a);for(const a of s)this.content.push(a)}compile(){const t=Function,e=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new t(...e,i.join(`
6
+ `))}}const TT={major:4,minor:3,patch:6},we=k("$ZodType",(n,t)=>{var i;var e;n??(n={}),n._zod.def=t,n._zod.bag=n._zod.bag||{},n._zod.version=TT;const r=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&r.unshift(n);for(const s of r)for(const a of s._zod.onattach)a(n);if(r.length===0)(e=n._zod).deferred??(e.deferred=[]),(i=n._zod.deferred)==null||i.push(()=>{n._zod.run=n._zod.parse});else{const s=(l,c,u)=>{let p=ro(l),g;for(const v of c){if(v._zod.def.when){if(!v._zod.def.when(l))continue}else if(p)continue;const y=l.issues.length,E=v._zod.check(l);if(E instanceof Promise&&(u==null?void 0:u.async)===!1)throw new co;if(g||E instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await E,l.issues.length!==y&&(p||(p=ro(l,y)))});else{if(l.issues.length===y)continue;p||(p=ro(l,y))}}return g?g.then(()=>l):l},a=(l,c,u)=>{if(ro(l))return l.aborted=!0,l;const p=s(c,r,u);if(p instanceof Promise){if(u.async===!1)throw new co;return p.then(g=>n._zod.parse(g,u))}return n._zod.parse(p,u)};n._zod.run=(l,c)=>{if(c.skipChecks)return n._zod.parse(l,c);if(c.direction==="backward"){const p=n._zod.parse({value:l.value,issues:[]},{...c,skipChecks:!0});return p instanceof Promise?p.then(g=>a(g,l,c)):a(p,l,c)}const u=n._zod.parse(l,c);if(u instanceof Promise){if(c.async===!1)throw new co;return u.then(p=>s(p,r,c))}return s(u,r,c)}}ce(n,"~standard",()=>({validate:s=>{var a;try{const l=D$(n,s);return l.success?{value:l.data}:{issues:(a=l.error)==null?void 0:a.issues}}catch{return O$(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}))}),Km=k("$ZodString",(n,t)=>{var e;we.init(n,t),n._zod.pattern=[...((e=n==null?void 0:n._zod.bag)==null?void 0:e.patterns)??[]].pop()??uT(n._zod.bag),n._zod.parse=(r,i)=>{if(t.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}}),ve=k("$ZodStringFormat",(n,t)=>{ud.init(n,t),Km.init(n,t)}),RT=k("$ZodGUID",(n,t)=>{t.pattern??(t.pattern=K$),ve.init(n,t)}),IT=k("$ZodUUID",(n,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Tv(r))}else t.pattern??(t.pattern=Tv());ve.init(n,t)}),xT=k("$ZodEmail",(n,t)=>{t.pattern??(t.pattern=X$),ve.init(n,t)}),PT=k("$ZodURL",(n,t)=>{ve.init(n,t),n._zod.check=e=>{try{const r=e.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||e.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:e.value,inst:n,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||e.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:e.value,inst:n,continue:!t.abort})),t.normalize?e.value=i.href:e.value=r;return}catch{e.issues.push({code:"invalid_format",format:"url",input:e.value,inst:n,continue:!t.abort})}}}),LT=k("$ZodEmoji",(n,t)=>{t.pattern??(t.pattern=eT()),ve.init(n,t)}),DT=k("$ZodNanoID",(n,t)=>{t.pattern??(t.pattern=Y$),ve.init(n,t)}),OT=k("$ZodCUID",(n,t)=>{t.pattern??(t.pattern=B$),ve.init(n,t)}),MT=k("$ZodCUID2",(n,t)=>{t.pattern??(t.pattern=W$),ve.init(n,t)}),NT=k("$ZodULID",(n,t)=>{t.pattern??(t.pattern=q$),ve.init(n,t)}),zT=k("$ZodXID",(n,t)=>{t.pattern??(t.pattern=j$),ve.init(n,t)}),UT=k("$ZodKSUID",(n,t)=>{t.pattern??(t.pattern=G$),ve.init(n,t)}),FT=k("$ZodISODateTime",(n,t)=>{t.pattern??(t.pattern=cT(t)),ve.init(n,t)}),ZT=k("$ZodISODate",(n,t)=>{t.pattern??(t.pattern=aT),ve.init(n,t)}),HT=k("$ZodISOTime",(n,t)=>{t.pattern??(t.pattern=lT(t)),ve.init(n,t)}),VT=k("$ZodISODuration",(n,t)=>{t.pattern??(t.pattern=J$),ve.init(n,t)}),BT=k("$ZodIPv4",(n,t)=>{t.pattern??(t.pattern=tT),ve.init(n,t),n._zod.bag.format="ipv4"}),WT=k("$ZodIPv6",(n,t)=>{t.pattern??(t.pattern=nT),ve.init(n,t),n._zod.bag.format="ipv6",n._zod.check=e=>{try{new URL(`http://[${e.value}]`)}catch{e.issues.push({code:"invalid_format",format:"ipv6",input:e.value,inst:n,continue:!t.abort})}}}),qT=k("$ZodCIDRv4",(n,t)=>{t.pattern??(t.pattern=rT),ve.init(n,t)}),jT=k("$ZodCIDRv6",(n,t)=>{t.pattern??(t.pattern=iT),ve.init(n,t),n._zod.check=e=>{const r=e.value.split("/");try{if(r.length!==2)throw new Error;const[i,s]=r;if(!s)throw new Error;const a=Number(s);if(`${a}`!==s)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${i}]`)}catch{e.issues.push({code:"invalid_format",format:"cidrv6",input:e.value,inst:n,continue:!t.abort})}}});function Dw(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const GT=k("$ZodBase64",(n,t)=>{t.pattern??(t.pattern=sT),ve.init(n,t),n._zod.bag.contentEncoding="base64",n._zod.check=e=>{Dw(e.value)||e.issues.push({code:"invalid_format",format:"base64",input:e.value,inst:n,continue:!t.abort})}});function YT(n){if(!$w.test(n))return!1;const t=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),e=t.padEnd(Math.ceil(t.length/4)*4,"=");return Dw(e)}const JT=k("$ZodBase64URL",(n,t)=>{t.pattern??(t.pattern=$w),ve.init(n,t),n._zod.bag.contentEncoding="base64url",n._zod.check=e=>{YT(e.value)||e.issues.push({code:"invalid_format",format:"base64url",input:e.value,inst:n,continue:!t.abort})}}),KT=k("$ZodE164",(n,t)=>{t.pattern??(t.pattern=oT),ve.init(n,t)});function XT(n,t=null){try{const e=n.split(".");if(e.length!==3)return!1;const[r]=e;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const QT=k("$ZodJWT",(n,t)=>{ve.init(n,t),n._zod.check=e=>{XT(e.value,t.alg)||e.issues.push({code:"invalid_format",format:"jwt",input:e.value,inst:n,continue:!t.abort})}}),Ow=k("$ZodNumber",(n,t)=>{we.init(n,t),n._zod.pattern=n._zod.bag.pattern??Iw,n._zod.parse=(e,r)=>{if(t.coerce)try{e.value=Number(e.value)}catch{}const i=e.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return e;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return e.issues.push({expected:"number",code:"invalid_type",input:i,inst:n,...s?{received:s}:{}}),e}}),eR=k("$ZodNumberFormat",(n,t)=>{gT.init(n,t),Ow.init(n,t)}),tR=k("$ZodBoolean",(n,t)=>{we.init(n,t),n._zod.pattern=dT,n._zod.parse=(e,r)=>{if(t.coerce)try{e.value=!!e.value}catch{}const i=e.value;return typeof i=="boolean"||e.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:n}),e}}),nR=k("$ZodUnknown",(n,t)=>{we.init(n,t),n._zod.parse=e=>e}),rR=k("$ZodNever",(n,t)=>{we.init(n,t),n._zod.parse=(e,r)=>(e.issues.push({expected:"never",code:"invalid_type",input:e.value,inst:n}),e)});function Rv(n,t,e){n.issues.length&&t.issues.push(...io(e,n.issues)),t.value[e]=n.value}const iR=k("$ZodArray",(n,t)=>{we.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!Array.isArray(i))return e.issues.push({expected:"array",code:"invalid_type",input:i,inst:n}),e;e.value=Array(i.length);const s=[];for(let a=0;a<i.length;a++){const l=i[a],c=t.element._zod.run({value:l,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Rv(u,e,a))):Rv(c,e,a)}return s.length?Promise.all(s).then(()=>e):e}});function oh(n,t,e,r,i){if(n.issues.length){if(i&&!(e in r))return;t.issues.push(...io(e,n.issues))}n.value===void 0?e in r&&(t.value[e]=void 0):t.value[e]=n.value}function Mw(n){var r,i,s,a;const t=Object.keys(n.shape);for(const l of t)if(!((a=(s=(i=(r=n.shape)==null?void 0:r[l])==null?void 0:i._zod)==null?void 0:s.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${l}": expected a Zod schema`);const e=A$(n.shape);return{...n,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(e)}}function Nw(n,t,e,r,i,s){const a=[],l=i.keySet,c=i.catchall._zod,u=c.def.type,p=c.optout==="optional";for(const g in t){if(l.has(g))continue;if(u==="never"){a.push(g);continue}const v=c.run({value:t[g],issues:[]},r);v instanceof Promise?n.push(v.then(y=>oh(y,e,g,t,p))):oh(v,e,g,t,p)}return a.length&&e.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s}),n.length?Promise.all(n).then(()=>e):e}const sR=k("$ZodObject",(n,t)=>{we.init(n,t);const e=Object.getOwnPropertyDescriptor(t,"shape");if(!(e!=null&&e.get)){const l=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...l};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=ad(()=>Mw(t));ce(n._zod,"propValues",()=>{const l=t.shape,c={};for(const u in l){const p=l[u]._zod;if(p.values){c[u]??(c[u]=new Set);for(const g of p.values)c[u].add(g)}}return c});const i=pl,s=t.catchall;let a;n._zod.parse=(l,c)=>{a??(a=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 p=[],g=a.shape;for(const v of a.keys){const y=g[v],E=y._zod.optout==="optional",A=y._zod.run({value:u[v],issues:[]},c);A instanceof Promise?p.push(A.then(x=>oh(x,l,v,u,E))):oh(A,l,v,u,E)}return s?Nw(p,u,l,c,r.value,n):p.length?Promise.all(p).then(()=>l):l}}),oR=k("$ZodObjectJIT",(n,t)=>{sR.init(n,t);const e=n._zod.parse,r=ad(()=>Mw(t)),i=v=>{var V;const y=new $T(["shape","payload","ctx"]),E=r.value,A=F=>{const G=$v(F);return`shape[${G}]._zod.run({ value: input[${G}], issues: [] }, ctx)`};y.write("const input = payload.value;");const x=Object.create(null);let L=0;for(const F of E.keys)x[F]=`key_${L++}`;y.write("const newResult = {};");for(const F of E.keys){const G=x[F],z=$v(F),J=v[F],re=((V=J==null?void 0:J._zod)==null?void 0:V.optout)==="optional";y.write(`const ${G} = ${A(F)};`),re?y.write(`
7
+ if (${G}.issues.length) {
8
+ if (${z} in input) {
9
+ payload.issues = payload.issues.concat(${G}.issues.map(iss => ({
10
+ ...iss,
11
+ path: iss.path ? [${z}, ...iss.path] : [${z}]
12
+ })));
13
+ }
14
+ }
15
+
16
+ if (${G}.value === undefined) {
17
+ if (${z} in input) {
18
+ newResult[${z}] = undefined;
19
+ }
20
+ } else {
21
+ newResult[${z}] = ${G}.value;
22
+ }
23
+
24
+ `):y.write(`
25
+ if (${G}.issues.length) {
26
+ payload.issues = payload.issues.concat(${G}.issues.map(iss => ({
27
+ ...iss,
28
+ path: iss.path ? [${z}, ...iss.path] : [${z}]
29
+ })));
30
+ }
31
+
32
+ if (${G}.value === undefined) {
33
+ if (${z} in input) {
34
+ newResult[${z}] = undefined;
35
+ }
36
+ } else {
37
+ newResult[${z}] = ${G}.value;
38
+ }
39
+
40
+ `)}y.write("payload.value = newResult;"),y.write("return payload;");const D=y.compile();return(F,G)=>D(v,F,G)};let s;const a=pl,l=!bw.jitless,u=l&&S$.value,p=t.catchall;let g;n._zod.parse=(v,y)=>{g??(g=r.value);const E=v.value;return a(E)?l&&u&&(y==null?void 0:y.async)===!1&&y.jitless!==!0?(s||(s=i(t.shape)),v=s(v,y),p?Nw([],E,v,y,g,n):v):e(v,y):(v.issues.push({expected:"object",code:"invalid_type",input:E,inst:n}),v)}});function Iv(n,t,e,r){for(const s of n)if(s.issues.length===0)return t.value=s.value,t;const i=n.filter(s=>!ro(s));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:e,errors:n.map(s=>s.issues.map(a=>hi(a,r,ui())))}),t)}const zw=k("$ZodUnion",(n,t)=>{we.init(n,t),ce(n._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ce(n._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ce(n._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),ce(n._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){const i=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>jm(s.source)).join("|")})$`)}});const e=t.options.length===1,r=t.options[0]._zod.run;n._zod.parse=(i,s)=>{if(e)return r(i,s);let a=!1;const l=[];for(const c of t.options){const u=c._zod.run({value:i.value,issues:[]},s);if(u instanceof Promise)l.push(u),a=!0;else{if(u.issues.length===0)return u;l.push(u)}}return a?Promise.all(l).then(c=>Iv(c,i,n,s)):Iv(l,i,n,s)}}),aR=k("$ZodDiscriminatedUnion",(n,t)=>{t.inclusive=!1,zw.init(n,t);const e=n._zod.parse;ce(n._zod,"propValues",()=>{const i={};for(const s of t.options){const a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[l,c]of Object.entries(a)){i[l]||(i[l]=new Set);for(const u of c)i[l].add(u)}}return i});const r=ad(()=>{var a;const i=t.options,s=new Map;for(const l of i){const c=(a=l._zod.propValues)==null?void 0:a[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.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 a=i.value;if(!pl(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:n}),i;const l=r.value.get(a==null?void 0:a[t.discriminator]);return l?l._zod.run(i,s):t.unionFallback?e(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:n}),i)}}),lR=k("$ZodIntersection",(n,t)=>{we.init(n,t),n._zod.parse=(e,r)=>{const i=e.value,s=t.left._zod.run({value:i,issues:[]},r),a=t.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([c,u])=>xv(e,c,u)):xv(e,s,a)}});function qp(n,t){if(n===t)return{valid:!0,data:n};if(n instanceof Date&&t instanceof Date&&+n==+t)return{valid:!0,data:n};if(ia(n)&&ia(t)){const e=Object.keys(t),r=Object.keys(n).filter(s=>e.indexOf(s)!==-1),i={...n,...t};for(const s of r){const a=qp(n[s],t[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};i[s]=a.data}return{valid:!0,data:i}}if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return{valid:!1,mergeErrorPath:[]};const e=[];for(let r=0;r<n.length;r++){const i=n[r],s=t[r],a=qp(i,s);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};e.push(a.data)}return{valid:!0,data:e}}return{valid:!1,mergeErrorPath:[]}}function xv(n,t,e){const r=new Map;let i;for(const l of t.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 e.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}),ro(n))return n;const a=qp(t.value,e.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return n.value=a.data,n}const cR=k("$ZodRecord",(n,t)=>{we.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!ia(i))return e.issues.push({expected:"record",code:"invalid_type",input:i,inst:n}),e;const s=[],a=t.keyType._zod.values;if(a){e.value={};const l=new Set;for(const u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){l.add(typeof u=="number"?u.toString():u);const p=t.valueType._zod.run({value:i[u],issues:[]},r);p instanceof Promise?s.push(p.then(g=>{g.issues.length&&e.issues.push(...io(u,g.issues)),e.value[u]=g.value})):(p.issues.length&&e.issues.push(...io(u,p.issues)),e.value[u]=p.value)}let c;for(const u in i)l.has(u)||(c=c??[],c.push(u));c&&c.length>0&&e.issues.push({code:"unrecognized_keys",input:i,inst:n,keys:c})}else{e.value={};for(const l of Reflect.ownKeys(i)){if(l==="__proto__")continue;let c=t.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"&&Iw.test(l)&&c.issues.length){const g=t.keyType._zod.run({value:Number(l),issues:[]},r);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(c=g)}if(c.issues.length){t.mode==="loose"?e.value[l]=i[l]:e.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(g=>hi(g,r,ui())),input:l,path:[l],inst:n});continue}const p=t.valueType._zod.run({value:i[l],issues:[]},r);p instanceof Promise?s.push(p.then(g=>{g.issues.length&&e.issues.push(...io(l,g.issues)),e.value[c.value]=g.value})):(p.issues.length&&e.issues.push(...io(l,p.issues)),e.value[c.value]=p.value)}}return s.length?Promise.all(s).then(()=>e):e}}),uR=k("$ZodEnum",(n,t)=>{we.init(n,t);const e=Sw(t.entries),r=new Set(e);n._zod.values=r,n._zod.pattern=new RegExp(`^(${e.filter(i=>_$.has(typeof i)).map(i=>typeof i=="string"?sa(i):i.toString()).join("|")})$`),n._zod.parse=(i,s)=>{const a=i.value;return r.has(a)||i.issues.push({code:"invalid_value",values:e,input:a,inst:n}),i}}),hR=k("$ZodLiteral",(n,t)=>{if(we.init(n,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const e=new Set(t.values);n._zod.values=e,n._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?sa(r):r?sa(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,i)=>{const s=r.value;return e.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:n}),r}}),dR=k("$ZodTransform",(n,t)=>{we.init(n,t),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new ww(n.constructor.name);const i=t.transform(e.value,e);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(e.value=a,e));if(i instanceof Promise)throw new co;return e.value=i,e}});function Pv(n,t){return n.issues.length&&t===void 0?{issues:[],value:void 0}:n}const Uw=k("$ZodOptional",(n,t)=>{we.init(n,t),n._zod.optin="optional",n._zod.optout="optional",ce(n._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ce(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${jm(e.source)})?$`):void 0}),n._zod.parse=(e,r)=>{if(t.innerType._zod.optin==="optional"){const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>Pv(s,e.value)):Pv(i,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,r)}}),pR=k("$ZodExactOptional",(n,t)=>{Uw.init(n,t),ce(n._zod,"values",()=>t.innerType._zod.values),ce(n._zod,"pattern",()=>t.innerType._zod.pattern),n._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),fR=k("$ZodNullable",(n,t)=>{we.init(n,t),ce(n._zod,"optin",()=>t.innerType._zod.optin),ce(n._zod,"optout",()=>t.innerType._zod.optout),ce(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${jm(e.source)}|null)$`):void 0}),ce(n._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),n._zod.parse=(e,r)=>e.value===null?e:t.innerType._zod.run(e,r)}),mR=k("$ZodDefault",(n,t)=>{we.init(n,t),n._zod.optin="optional",ce(n._zod,"values",()=>t.innerType._zod.values),n._zod.parse=(e,r)=>{if(r.direction==="backward")return t.innerType._zod.run(e,r);if(e.value===void 0)return e.value=t.defaultValue,e;const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>Lv(s,t)):Lv(i,t)}});function Lv(n,t){return n.value===void 0&&(n.value=t.defaultValue),n}const gR=k("$ZodPrefault",(n,t)=>{we.init(n,t),n._zod.optin="optional",ce(n._zod,"values",()=>t.innerType._zod.values),n._zod.parse=(e,r)=>(r.direction==="backward"||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),vR=k("$ZodNonOptional",(n,t)=>{we.init(n,t),ce(n._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(r=>r!==void 0)):void 0}),n._zod.parse=(e,r)=>{const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>Dv(s,n)):Dv(i,n)}});function Dv(n,t){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:t}),n}const yR=k("$ZodCatch",(n,t)=>{we.init(n,t),ce(n._zod,"optin",()=>t.innerType._zod.optin),ce(n._zod,"optout",()=>t.innerType._zod.optout),ce(n._zod,"values",()=>t.innerType._zod.values),n._zod.parse=(e,r)=>{if(r.direction==="backward")return t.innerType._zod.run(e,r);const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(a=>hi(a,r,ui()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(s=>hi(s,r,ui()))},input:e.value}),e.issues=[]),e)}}),wR=k("$ZodPipe",(n,t)=>{we.init(n,t),ce(n._zod,"values",()=>t.in._zod.values),ce(n._zod,"optin",()=>t.in._zod.optin),ce(n._zod,"optout",()=>t.out._zod.optout),ce(n._zod,"propValues",()=>t.in._zod.propValues),n._zod.parse=(e,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(e,r);return s instanceof Promise?s.then(a=>tu(a,t.in,r)):tu(s,t.in,r)}const i=t.in._zod.run(e,r);return i instanceof Promise?i.then(s=>tu(s,t.out,r)):tu(i,t.out,r)}});function tu(n,t,e){return n.issues.length?(n.aborted=!0,n):t._zod.run({value:n.value,issues:n.issues},e)}const bR=k("$ZodReadonly",(n,t)=>{we.init(n,t),ce(n._zod,"propValues",()=>t.innerType._zod.propValues),ce(n._zod,"values",()=>t.innerType._zod.values),ce(n._zod,"optin",()=>{var e,r;return(r=(e=t.innerType)==null?void 0:e._zod)==null?void 0:r.optin}),ce(n._zod,"optout",()=>{var e,r;return(r=(e=t.innerType)==null?void 0:e._zod)==null?void 0:r.optout}),n._zod.parse=(e,r)=>{if(r.direction==="backward")return t.innerType._zod.run(e,r);const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(Ov):Ov(i)}});function Ov(n){return n.value=Object.freeze(n.value),n}const SR=k("$ZodCustom",(n,t)=>{ht.init(n,t),we.init(n,t),n._zod.parse=(e,r)=>e,n._zod.check=e=>{const r=e.value,i=t.fn(r);if(i instanceof Promise)return i.then(s=>Mv(s,e,r,n));Mv(i,e,r,n)}});function Mv(n,t,e,r){if(!n){const i={code:"custom",input:e,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(fl(i))}}var Nv;class _R{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...e){const r=e[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const e=this._map.get(t);return e&&typeof e=="object"&&"id"in e&&this._idmap.delete(e.id),this._map.delete(t),this}get(t){const e=t._zod.parent;if(e){const r={...this.get(e)??{}};delete r.id;const i={...r,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function AR(){return new _R}(Nv=globalThis).__zod_globalRegistry??(Nv.__zod_globalRegistry=AR());const Ha=globalThis.__zod_globalRegistry;function ER(n,t){return new n({type:"string",...U(t)})}function kR(n,t){return new n({type:"string",format:"email",check:"string_format",abort:!1,...U(t)})}function zv(n,t){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...U(t)})}function CR(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...U(t)})}function $R(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...U(t)})}function TR(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...U(t)})}function RR(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...U(t)})}function IR(n,t){return new n({type:"string",format:"url",check:"string_format",abort:!1,...U(t)})}function xR(n,t){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...U(t)})}function PR(n,t){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...U(t)})}function LR(n,t){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...U(t)})}function DR(n,t){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...U(t)})}function OR(n,t){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...U(t)})}function MR(n,t){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...U(t)})}function NR(n,t){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...U(t)})}function zR(n,t){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...U(t)})}function UR(n,t){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...U(t)})}function FR(n,t){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...U(t)})}function ZR(n,t){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...U(t)})}function HR(n,t){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...U(t)})}function VR(n,t){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...U(t)})}function BR(n,t){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...U(t)})}function WR(n,t){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...U(t)})}function qR(n,t){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...U(t)})}function jR(n,t){return new n({type:"string",format:"date",check:"string_format",...U(t)})}function GR(n,t){return new n({type:"string",format:"time",check:"string_format",precision:null,...U(t)})}function YR(n,t){return new n({type:"string",format:"duration",check:"string_format",...U(t)})}function JR(n,t){return new n({type:"number",checks:[],...U(t)})}function KR(n,t){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...U(t)})}function XR(n,t){return new n({type:"boolean",...U(t)})}function QR(n){return new n({type:"unknown"})}function eI(n,t){return new n({type:"never",...U(t)})}function Uv(n,t){return new Pw({check:"less_than",...U(t),value:n,inclusive:!1})}function hp(n,t){return new Pw({check:"less_than",...U(t),value:n,inclusive:!0})}function Fv(n,t){return new Lw({check:"greater_than",...U(t),value:n,inclusive:!1})}function dp(n,t){return new Lw({check:"greater_than",...U(t),value:n,inclusive:!0})}function Zv(n,t){return new mT({check:"multiple_of",...U(t),value:n})}function Fw(n,t){return new vT({check:"max_length",...U(t),maximum:n})}function ah(n,t){return new yT({check:"min_length",...U(t),minimum:n})}function Zw(n,t){return new wT({check:"length_equals",...U(t),length:n})}function tI(n,t){return new bT({check:"string_format",format:"regex",...U(t),pattern:n})}function nI(n){return new ST({check:"string_format",format:"lowercase",...U(n)})}function rI(n){return new _T({check:"string_format",format:"uppercase",...U(n)})}function iI(n,t){return new AT({check:"string_format",format:"includes",...U(t),includes:n})}function sI(n,t){return new ET({check:"string_format",format:"starts_with",...U(t),prefix:n})}function oI(n,t){return new kT({check:"string_format",format:"ends_with",...U(t),suffix:n})}function va(n){return new CT({check:"overwrite",tx:n})}function aI(n){return va(t=>t.normalize(n))}function lI(){return va(n=>n.trim())}function cI(){return va(n=>n.toLowerCase())}function uI(){return va(n=>n.toUpperCase())}function hI(){return va(n=>b$(n))}function dI(n,t,e){return new n({type:"array",element:t,...U(e)})}function pI(n,t,e){return new n({type:"custom",check:"custom",fn:t,...U(e)})}function fI(n){const t=mI(e=>(e.addIssue=r=>{if(typeof r=="string")e.issues.push(fl(r,e.value,t._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=e.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),e.issues.push(fl(i))}},n(e.value,e)));return t}function mI(n,t){const e=new ht({check:"custom",...U(t)});return e._zod.check=n,e}function Hw(n){let t=(n==null?void 0:n.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:n.processors??{},metadataRegistry:(n==null?void 0:n.metadata)??Ha,target:t,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 Te(n,t,e={path:[],schemaPath:[]}){var p,g;var r;const i=n._zod.def,s=t.seen.get(n);if(s)return s.count++,e.schemaPath.includes(n)&&(s.cycle=e.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:e.path};t.seen.set(n,a);const l=(g=(p=n._zod).toJSONSchema)==null?void 0:g.call(p);if(l)a.schema=l;else{const v={...e,schemaPath:[...e.schemaPath,n],path:e.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(t,a.schema,v);else{const E=a.schema,A=t.processors[i.type];if(!A)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);A(n,t,E,v)}const y=n._zod.parent;y&&(a.ref||(a.ref=y),Te(y,t,v),t.seen.get(y).isParent=!0)}const c=t.metadataRegistry.get(n);return c&&Object.assign(a.schema,c),t.io==="input"&&qe(n)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(n).schema}function Vw(n,t){var a,l,c,u;const e=n.seen.get(t);if(!e)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const p of n.seen.entries()){const g=(a=n.metadataRegistry.get(p[0]))==null?void 0:a.id;if(g){const v=r.get(g);if(v&&v!==p[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(g,p[0])}}const i=p=>{var A;const g=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const x=(A=n.external.registry.get(p[0]))==null?void 0:A.id,L=n.external.uri??(V=>V);if(x)return{ref:L(x)};const D=p[1].defId??p[1].schema.id??`schema${n.counter++}`;return p[1].defId=D,{defId:D,ref:`${L("__shared")}#/${g}/${D}`}}if(p[1]===e)return{ref:"#"};const y=`#/${g}/`,E=p[1].schema.id??`__schema${n.counter++}`;return{defId:E,ref:y+E}},s=p=>{if(p[1].schema.$ref)return;const g=p[1],{ref:v,defId:y}=i(p);g.def={...g.schema},y&&(g.defId=y);const E=g.schema;for(const A in E)delete E[A];E.$ref=v};if(n.cycles==="throw")for(const p of n.seen.entries()){const g=p[1];if(g.cycle)throw new Error(`Cycle detected: #/${(l=g.cycle)==null?void 0:l.join("/")}/<root>
41
+
42
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const p of n.seen.entries()){const g=p[1];if(t===p[0]){s(p);continue}if(n.external){const y=(c=n.external.registry.get(p[0]))==null?void 0:c.id;if(t!==p[0]&&y){s(p);continue}}if((u=n.metadataRegistry.get(p[0]))==null?void 0:u.id){s(p);continue}if(g.cycle){s(p);continue}if(g.count>1&&n.reused==="ref"){s(p);continue}}}function Bw(n,t){var a,l,c;const e=n.seen.get(t);if(!e)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=u=>{const p=n.seen.get(u);if(p.ref===null)return;const g=p.def??p.schema,v={...g},y=p.ref;if(p.ref=null,y){r(y);const A=n.seen.get(y),x=A.schema;if(x.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(x)):Object.assign(g,x),Object.assign(g,v),u._zod.parent===y)for(const D in g)D==="$ref"||D==="allOf"||D in v||delete g[D];if(x.$ref&&A.def)for(const D in g)D==="$ref"||D==="allOf"||D in A.def&&JSON.stringify(g[D])===JSON.stringify(A.def[D])&&delete g[D]}const E=u._zod.parent;if(E&&E!==y){r(E);const A=n.seen.get(E);if(A!=null&&A.schema.$ref&&(g.$ref=A.schema.$ref,A.def))for(const x in g)x==="$ref"||x==="allOf"||x in A.def&&JSON.stringify(g[x])===JSON.stringify(A.def[x])&&delete g[x]}n.override({zodSchema:u,jsonSchema:g,path:p.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,(a=n.external)!=null&&a.uri){const u=(l=n.external.registry.get(t))==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,e.def??e.schema);const s=((c=n.external)==null?void 0:c.defs)??{};for(const u of n.seen.entries()){const p=u[1];p.def&&p.defId&&(s[p.defId]=p.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:{...t["~standard"],jsonSchema:{input:lh(t,"input",n.processors),output:lh(t,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function qe(n,t){const e=t??{seen:new Set};if(e.seen.has(n))return!1;e.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return qe(r.element,e);if(r.type==="set")return qe(r.valueType,e);if(r.type==="lazy")return qe(r.getter(),e);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return qe(r.innerType,e);if(r.type==="intersection")return qe(r.left,e)||qe(r.right,e);if(r.type==="record"||r.type==="map")return qe(r.keyType,e)||qe(r.valueType,e);if(r.type==="pipe")return qe(r.in,e)||qe(r.out,e);if(r.type==="object"){for(const i in r.shape)if(qe(r.shape[i],e))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(qe(i,e))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(qe(i,e))return!0;return!!(r.rest&&qe(r.rest,e))}return!1}const gI=(n,t={})=>e=>{const r=Hw({...e,processors:t});return Te(n,r),Vw(r,n),Bw(r,n)},lh=(n,t,e={})=>r=>{const{libraryOptions:i,target:s}=r??{},a=Hw({...i??{},target:s,io:t,processors:e});return Te(n,a),Vw(a,n),Bw(a,n)},vI={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},yI=(n,t,e,r)=>{const i=e;i.type="string";const{minimum:s,maximum:a,format:l,patterns:c,contentEncoding:u}=n._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof a=="number"&&(i.maxLength=a),l&&(i.format=vI[l]??l,i.format===""&&delete i.format,l==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){const p=[...c];p.length===1?i.pattern=p[0].source:p.length>1&&(i.allOf=[...p.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},wI=(n,t,e,r)=>{const i=e,{minimum:s,maximum:a,format:l,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:p}=n._zod.bag;typeof l=="string"&&l.includes("int")?i.type="integer":i.type="number",typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=p,i.exclusiveMinimum=!0):i.exclusiveMinimum=p),typeof s=="number"&&(i.minimum=s,typeof p=="number"&&t.target!=="draft-04"&&(p>=s?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof a=="number"&&(i.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},bI=(n,t,e,r)=>{e.type="boolean"},SI=(n,t,e,r)=>{e.not={}},_I=(n,t,e,r)=>{},AI=(n,t,e,r)=>{const i=n._zod.def,s=Sw(i.entries);s.every(a=>typeof a=="number")&&(e.type="number"),s.every(a=>typeof a=="string")&&(e.type="string"),e.enum=s},EI=(n,t,e,r)=>{const i=n._zod.def,s=[];for(const a of i.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){const a=s[0];e.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?e.enum=[a]:e.const=a}else s.every(a=>typeof a=="number")&&(e.type="number"),s.every(a=>typeof a=="string")&&(e.type="string"),s.every(a=>typeof a=="boolean")&&(e.type="boolean"),s.every(a=>a===null)&&(e.type="null"),e.enum=s},kI=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},CI=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},$I=(n,t,e,r)=>{const i=e,s=n._zod.def,{minimum:a,maximum:l}=n._zod.bag;typeof a=="number"&&(i.minItems=a),typeof l=="number"&&(i.maxItems=l),i.type="array",i.items=Te(s.element,t,{...r,path:[...r.path,"items"]})},TI=(n,t,e,r)=>{var u;const i=e,s=n._zod.def;i.type="object",i.properties={};const a=s.shape;for(const p in a)i.properties[p]=Te(a[p],t,{...r,path:[...r.path,"properties",p]});const l=new Set(Object.keys(a)),c=new Set([...l].filter(p=>{const g=s.shape[p]._zod;return t.io==="input"?g.optin===void 0:g.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=Te(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},RI=(n,t,e,r)=>{const i=n._zod.def,s=i.inclusive===!1,a=i.options.map((l,c)=>Te(l,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?e.oneOf=a:e.anyOf=a},II=(n,t,e,r)=>{const i=n._zod.def,s=Te(i.left,t,{...r,path:[...r.path,"allOf",0]}),a=Te(i.right,t,{...r,path:[...r.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,c=[...l(s)?s.allOf:[s],...l(a)?a.allOf:[a]];e.allOf=c},xI=(n,t,e,r)=>{const i=e,s=n._zod.def;i.type="object";const a=s.keyType,l=a._zod.bag,c=l==null?void 0:l.patterns;if(s.mode==="loose"&&c&&c.size>0){const p=Te(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const g of c)i.patternProperties[g.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=Te(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=Te(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=a._zod.values;if(u){const p=[...u].filter(g=>typeof g=="string"||typeof g=="number");p.length>0&&(i.required=p)}},PI=(n,t,e,r)=>{const i=n._zod.def,s=Te(i.innerType,t,r),a=t.seen.get(n);t.target==="openapi-3.0"?(a.ref=i.innerType,e.nullable=!0):e.anyOf=[s,{type:"null"}]},LI=(n,t,e,r)=>{const i=n._zod.def;Te(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},DI=(n,t,e,r)=>{const i=n._zod.def;Te(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.default=JSON.parse(JSON.stringify(i.defaultValue))},OI=(n,t,e,r)=>{const i=n._zod.def;Te(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,t.io==="input"&&(e._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},MI=(n,t,e,r)=>{const i=n._zod.def;Te(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}e.default=a},NI=(n,t,e,r)=>{const i=n._zod.def,s=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;Te(s,t,r);const a=t.seen.get(n);a.ref=s},zI=(n,t,e,r)=>{const i=n._zod.def;Te(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.readOnly=!0},Ww=(n,t,e,r)=>{const i=n._zod.def;Te(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},UI=k("ZodISODateTime",(n,t)=>{FT.init(n,t),Se.init(n,t)});function FI(n){return qR(UI,n)}const ZI=k("ZodISODate",(n,t)=>{ZT.init(n,t),Se.init(n,t)});function HI(n){return jR(ZI,n)}const VI=k("ZodISOTime",(n,t)=>{HT.init(n,t),Se.init(n,t)});function BI(n){return GR(VI,n)}const WI=k("ZodISODuration",(n,t)=>{VT.init(n,t),Se.init(n,t)});function qI(n){return YR(WI,n)}const qw=(n,t)=>{kw.init(n,t),n.name="ZodError",Object.defineProperties(n,{format:{value:e=>L$(n,e)},flatten:{value:e=>P$(n,e)},addIssue:{value:e=>{n.issues.push(e),n.message=JSON.stringify(n.issues,Wp,2)}},addIssues:{value:e=>{n.issues.push(...e),n.message=JSON.stringify(n.issues,Wp,2)}},isEmpty:{get(){return n.issues.length===0}}})},Hv=k("ZodError",qw),Ft=k("ZodError",qw,{Parent:Error}),jI=Ym(Ft),GI=Jm(Ft),YI=ld(Ft),JI=cd(Ft),KI=M$(Ft),XI=N$(Ft),QI=z$(Ft),e3=U$(Ft),t3=F$(Ft),n3=Z$(Ft),r3=H$(Ft),i3=V$(Ft),be=k("ZodType",(n,t)=>(we.init(n,t),Object.assign(n["~standard"],{jsonSchema:{input:lh(n,"input"),output:lh(n,"output")}}),n.toJSONSchema=gI(n,{}),n.def=t,n.type=t.type,Object.defineProperty(n,"_def",{value:t}),n.check=(...e)=>n.clone(gi(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),n.with=n.check,n.clone=(e,r)=>vi(n,e,r),n.brand=()=>n,n.register=(e,r)=>(e.add(n,r),n),n.parse=(e,r)=>jI(n,e,r,{callee:n.parse}),n.safeParse=(e,r)=>YI(n,e,r),n.parseAsync=async(e,r)=>GI(n,e,r,{callee:n.parseAsync}),n.safeParseAsync=async(e,r)=>JI(n,e,r),n.spa=n.safeParseAsync,n.encode=(e,r)=>KI(n,e,r),n.decode=(e,r)=>XI(n,e,r),n.encodeAsync=async(e,r)=>QI(n,e,r),n.decodeAsync=async(e,r)=>e3(n,e,r),n.safeEncode=(e,r)=>t3(n,e,r),n.safeDecode=(e,r)=>n3(n,e,r),n.safeEncodeAsync=async(e,r)=>r3(n,e,r),n.safeDecodeAsync=async(e,r)=>i3(n,e,r),n.refine=(e,r)=>n.check(J3(e,r)),n.superRefine=e=>n.check(K3(e)),n.overwrite=e=>n.check(va(e)),n.optional=()=>Wv(n),n.exactOptional=()=>N3(n),n.nullable=()=>qv(n),n.nullish=()=>Wv(qv(n)),n.nonoptional=e=>V3(n,e),n.array=()=>M(n),n.or=e=>K([n,e]),n.and=e=>hd(n,e),n.transform=e=>jv(n,O3(e)),n.default=e=>F3(n,e),n.prefault=e=>H3(n,e),n.catch=e=>W3(n,e),n.pipe=e=>jv(n,e),n.readonly=()=>G3(n),n.describe=e=>{const r=n.clone();return Ha.add(r,{description:e}),r},Object.defineProperty(n,"description",{get(){var e;return(e=Ha.get(n))==null?void 0:e.description},configurable:!0}),n.meta=(...e)=>{if(e.length===0)return Ha.get(n);const r=n.clone();return Ha.add(r,e[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=e=>e(n),n)),jw=k("_ZodString",(n,t)=>{Km.init(n,t),be.init(n,t),n._zod.processJSONSchema=(r,i,s)=>yI(n,r,i);const e=n._zod.bag;n.format=e.format??null,n.minLength=e.minimum??null,n.maxLength=e.maximum??null,n.regex=(...r)=>n.check(tI(...r)),n.includes=(...r)=>n.check(iI(...r)),n.startsWith=(...r)=>n.check(sI(...r)),n.endsWith=(...r)=>n.check(oI(...r)),n.min=(...r)=>n.check(ah(...r)),n.max=(...r)=>n.check(Fw(...r)),n.length=(...r)=>n.check(Zw(...r)),n.nonempty=(...r)=>n.check(ah(1,...r)),n.lowercase=r=>n.check(nI(r)),n.uppercase=r=>n.check(rI(r)),n.trim=()=>n.check(lI()),n.normalize=(...r)=>n.check(aI(...r)),n.toLowerCase=()=>n.check(cI()),n.toUpperCase=()=>n.check(uI()),n.slugify=()=>n.check(hI())}),s3=k("ZodString",(n,t)=>{Km.init(n,t),jw.init(n,t),n.email=e=>n.check(kR(o3,e)),n.url=e=>n.check(IR(a3,e)),n.jwt=e=>n.check(WR(_3,e)),n.emoji=e=>n.check(xR(l3,e)),n.guid=e=>n.check(zv(Vv,e)),n.uuid=e=>n.check(CR(nu,e)),n.uuidv4=e=>n.check($R(nu,e)),n.uuidv6=e=>n.check(TR(nu,e)),n.uuidv7=e=>n.check(RR(nu,e)),n.nanoid=e=>n.check(PR(c3,e)),n.guid=e=>n.check(zv(Vv,e)),n.cuid=e=>n.check(LR(u3,e)),n.cuid2=e=>n.check(DR(h3,e)),n.ulid=e=>n.check(OR(d3,e)),n.base64=e=>n.check(HR(w3,e)),n.base64url=e=>n.check(VR(b3,e)),n.xid=e=>n.check(MR(p3,e)),n.ksuid=e=>n.check(NR(f3,e)),n.ipv4=e=>n.check(zR(m3,e)),n.ipv6=e=>n.check(UR(g3,e)),n.cidrv4=e=>n.check(FR(v3,e)),n.cidrv6=e=>n.check(ZR(y3,e)),n.e164=e=>n.check(BR(S3,e)),n.datetime=e=>n.check(FI(e)),n.date=e=>n.check(HI(e)),n.time=e=>n.check(BI(e)),n.duration=e=>n.check(qI(e))});function f(n){return ER(s3,n)}const Se=k("ZodStringFormat",(n,t)=>{ve.init(n,t),jw.init(n,t)}),o3=k("ZodEmail",(n,t)=>{xT.init(n,t),Se.init(n,t)}),Vv=k("ZodGUID",(n,t)=>{RT.init(n,t),Se.init(n,t)}),nu=k("ZodUUID",(n,t)=>{IT.init(n,t),Se.init(n,t)}),a3=k("ZodURL",(n,t)=>{PT.init(n,t),Se.init(n,t)}),l3=k("ZodEmoji",(n,t)=>{LT.init(n,t),Se.init(n,t)}),c3=k("ZodNanoID",(n,t)=>{DT.init(n,t),Se.init(n,t)}),u3=k("ZodCUID",(n,t)=>{OT.init(n,t),Se.init(n,t)}),h3=k("ZodCUID2",(n,t)=>{MT.init(n,t),Se.init(n,t)}),d3=k("ZodULID",(n,t)=>{NT.init(n,t),Se.init(n,t)}),p3=k("ZodXID",(n,t)=>{zT.init(n,t),Se.init(n,t)}),f3=k("ZodKSUID",(n,t)=>{UT.init(n,t),Se.init(n,t)}),m3=k("ZodIPv4",(n,t)=>{BT.init(n,t),Se.init(n,t)}),g3=k("ZodIPv6",(n,t)=>{WT.init(n,t),Se.init(n,t)}),v3=k("ZodCIDRv4",(n,t)=>{qT.init(n,t),Se.init(n,t)}),y3=k("ZodCIDRv6",(n,t)=>{jT.init(n,t),Se.init(n,t)}),w3=k("ZodBase64",(n,t)=>{GT.init(n,t),Se.init(n,t)}),b3=k("ZodBase64URL",(n,t)=>{JT.init(n,t),Se.init(n,t)}),S3=k("ZodE164",(n,t)=>{KT.init(n,t),Se.init(n,t)}),_3=k("ZodJWT",(n,t)=>{QT.init(n,t),Se.init(n,t)}),Gw=k("ZodNumber",(n,t)=>{Ow.init(n,t),be.init(n,t),n._zod.processJSONSchema=(r,i,s)=>wI(n,r,i),n.gt=(r,i)=>n.check(Fv(r,i)),n.gte=(r,i)=>n.check(dp(r,i)),n.min=(r,i)=>n.check(dp(r,i)),n.lt=(r,i)=>n.check(Uv(r,i)),n.lte=(r,i)=>n.check(hp(r,i)),n.max=(r,i)=>n.check(hp(r,i)),n.int=r=>n.check(Bv(r)),n.safe=r=>n.check(Bv(r)),n.positive=r=>n.check(Fv(0,r)),n.nonnegative=r=>n.check(dp(0,r)),n.negative=r=>n.check(Uv(0,r)),n.nonpositive=r=>n.check(hp(0,r)),n.multipleOf=(r,i)=>n.check(Zv(r,i)),n.step=(r,i)=>n.check(Zv(r,i)),n.finite=()=>n;const e=n._zod.bag;n.minValue=Math.max(e.minimum??Number.NEGATIVE_INFINITY,e.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(e.maximum??Number.POSITIVE_INFINITY,e.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(e.format??"").includes("int")||Number.isSafeInteger(e.multipleOf??.5),n.isFinite=!0,n.format=e.format??null});function j(n){return JR(Gw,n)}const A3=k("ZodNumberFormat",(n,t)=>{eR.init(n,t),Gw.init(n,t)});function Bv(n){return KR(A3,n)}const E3=k("ZodBoolean",(n,t)=>{tR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>bI(n,e,r)});function Oe(n){return XR(E3,n)}const k3=k("ZodUnknown",(n,t)=>{nR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>_I()});function S(){return QR(k3)}const C3=k("ZodNever",(n,t)=>{rR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>SI(n,e,r)});function $3(n){return eI(C3,n)}const T3=k("ZodArray",(n,t)=>{iR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>$I(n,e,r,i),n.element=t.element,n.min=(e,r)=>n.check(ah(e,r)),n.nonempty=e=>n.check(ah(1,e)),n.max=(e,r)=>n.check(Fw(e,r)),n.length=(e,r)=>n.check(Zw(e,r)),n.unwrap=()=>n.element});function M(n,t){return dI(T3,n,t)}const Yw=k("ZodObject",(n,t)=>{oR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>TI(n,e,r,i),ce(n,"shape",()=>t.shape),n.keyof=()=>Xw(Object.keys(n._zod.def.shape)),n.catchall=e=>n.clone({...n._zod.def,catchall:e}),n.passthrough=()=>n.clone({...n._zod.def,catchall:S()}),n.loose=()=>n.clone({...n._zod.def,catchall:S()}),n.strict=()=>n.clone({...n._zod.def,catchall:$3()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=e=>$$(n,e),n.safeExtend=e=>T$(n,e),n.merge=e=>R$(n,e),n.pick=e=>k$(n,e),n.omit=e=>C$(n,e),n.partial=(...e)=>I$(Qw,n,e[0]),n.required=(...e)=>x$(eb,n,e[0])});function Jw(n,t){const e={type:"object",shape:n??{},...U(t)};return new Yw(e)}function w(n,t){return new Yw({type:"object",shape:n,catchall:S(),...U(t)})}const Kw=k("ZodUnion",(n,t)=>{zw.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>RI(n,e,r,i),n.options=t.options});function K(n,t){return new Kw({type:"union",options:n,...U(t)})}const R3=k("ZodDiscriminatedUnion",(n,t)=>{Kw.init(n,t),aR.init(n,t)});function I3(n,t,e){return new R3({type:"union",options:t,discriminator:n,...U(e)})}const x3=k("ZodIntersection",(n,t)=>{lR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>II(n,e,r,i)});function hd(n,t){return new x3({type:"intersection",left:n,right:t})}const P3=k("ZodRecord",(n,t)=>{cR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>xI(n,e,r,i),n.keyType=t.keyType,n.valueType=t.valueType});function _(n,t,e){return new P3({type:"record",keyType:n,valueType:t,...U(e)})}const jp=k("ZodEnum",(n,t)=>{uR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(r,i,s)=>AI(n,r,i),n.enum=t.entries,n.options=Object.values(t.entries);const e=new Set(Object.keys(t.entries));n.extract=(r,i)=>{const s={};for(const a of r)if(e.has(a))s[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new jp({...t,checks:[],...U(i),entries:s})},n.exclude=(r,i)=>{const s={...t.entries};for(const a of r)if(e.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new jp({...t,checks:[],...U(i),entries:s})}});function Xw(n,t){const e=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new jp({type:"enum",entries:e,...U(t)})}const L3=k("ZodLiteral",(n,t)=>{hR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>EI(n,e,r),n.values=new Set(t.values),Object.defineProperty(n,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function $(n,t){return new L3({type:"literal",values:Array.isArray(n)?n:[n],...U(t)})}const D3=k("ZodTransform",(n,t)=>{dR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>CI(n,e),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new ww(n.constructor.name);e.addIssue=s=>{if(typeof s=="string")e.issues.push(fl(s,e.value,t));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=e.value),a.inst??(a.inst=n),e.issues.push(fl(a))}};const i=t.transform(e.value,e);return i instanceof Promise?i.then(s=>(e.value=s,e)):(e.value=i,e)}});function O3(n){return new D3({type:"transform",transform:n})}const Qw=k("ZodOptional",(n,t)=>{Uw.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>Ww(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function Wv(n){return new Qw({type:"optional",innerType:n})}const M3=k("ZodExactOptional",(n,t)=>{pR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>Ww(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function N3(n){return new M3({type:"optional",innerType:n})}const z3=k("ZodNullable",(n,t)=>{fR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>PI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function qv(n){return new z3({type:"nullable",innerType:n})}const U3=k("ZodDefault",(n,t)=>{mR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>DI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function F3(n,t){return new U3({type:"default",innerType:n,get defaultValue(){return typeof t=="function"?t():Aw(t)}})}const Z3=k("ZodPrefault",(n,t)=>{gR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>OI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function H3(n,t){return new Z3({type:"prefault",innerType:n,get defaultValue(){return typeof t=="function"?t():Aw(t)}})}const eb=k("ZodNonOptional",(n,t)=>{vR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>LI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function V3(n,t){return new eb({type:"nonoptional",innerType:n,...U(t)})}const B3=k("ZodCatch",(n,t)=>{yR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>MI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function W3(n,t){return new B3({type:"catch",innerType:n,catchValue:typeof t=="function"?t:()=>t})}const q3=k("ZodPipe",(n,t)=>{wR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>NI(n,e,r,i),n.in=t.in,n.out=t.out});function jv(n,t){return new q3({type:"pipe",in:n,out:t})}const j3=k("ZodReadonly",(n,t)=>{bR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>zI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function G3(n){return new j3({type:"readonly",innerType:n})}const Y3=k("ZodCustom",(n,t)=>{SR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>kI(n,e)});function J3(n,t={}){return pI(Y3,n,t)}function K3(n){return fI(n)}const X3=[".md",".markdown"];function tb(n){if(n.length===0)return!1;const t=n.at(-1);return t==="/"||t==="\\"}function nb(n){const t=n.lastIndexOf("/"),e=n.lastIndexOf("\\");return n.slice(Math.max(t,e)+1)}function Q3(n){return nb(n).toLowerCase()}function ex(n,t){const e=Q3(n);return t.some(r=>e.endsWith(r))}function Gp(n){return!tb(n)&&ex(n,X3)}function tx(n){let t;try{t=new URL(n)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"}function Wn(n){try{const{pathname:t}=new URL(n);return/^\/artifact\/[0-9A-Za-z]{26}(\/|$)/.test(t)}catch{return!1}}const nx=Jw({id:f().min(1),kind:$("path"),title:f(),path:f()}).strict(),rx=Jw({id:f().min(1),kind:$("url"),title:f(),url:f().refine(tx,{message:"url must be an http(s) URL"})}).strict();I3("kind",[nx,rx]);const ix=new Set(["about:","blob:","chrome-extension:","chrome:","data:","devtools:","file:","filesystem:","javascript:","view-source:"]);function sx(n,t){try{const e=new URL(t),r=new URL(n,e);return r.protocol==="http:"||r.protocol==="https:"?{kind:"web",url:r.href}:ix.has(r.protocol)?{kind:"browser-local",url:r.href}:{kind:"application",url:r.href}}catch{return{kind:"invalid"}}}function Gv(n,t){return sx(n,t).kind==="web"}const ox="/views/markdown/",ax="/views/url-unsupported/";function rb(n){return`/artifact/${encodeURIComponent(n)}`}function lx(n,t){return`${rb(n)}/${encodeURIComponent(t)}`}function cx(n){return`/markdown/${encodeURIComponent(n)}`}function Yp(n,t={electron:!1}){if(n.kind==="url")return t.electron?{renderer:"url-webview",viewURL:n.url,contentURL:null}:Wn(n.url)?{renderer:"proxy-iframe",viewURL:n.url,contentURL:null}:{renderer:"url-unsupported",viewURL:ax,contentURL:null};if(Gp(n.path)){const r={viewURL:ox,contentURL:cx(n.id)};return t.electron?{renderer:"url-webview",...r}:{renderer:"markdown",...r}}const e=tb(n.path)?`${rb(n.id)}/`:lx(n.id,nb(n.path));return t.electron?{renderer:"url-webview",viewURL:e,contentURL:null}:{renderer:"proxy-iframe",viewURL:e,contentURL:null}}const ux="serverURL",hx="token",dx="mode",px="desktopAppVersion",fx="electron";function mx(n=window.location.search,t=window.location.origin){const r=new URLSearchParams(n).get(ux);return r?new URL(r).origin:new URL(t).origin}function gx(n=window.location.search){return new URLSearchParams(n).get(hx)}function mr(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(dx)===fx}function ib(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(px)}const Yv="tv.telemetry.clientId",vx=5,yx=60,wx=1e3,bx=vx*yx*wx,Jv=["pointerdown","scroll","keydown"],Kv=["focus"],Xv=["visibilitychange"],Sx="hidden";function _x(n,t=$x){const e=n.getItem(Yv);if(e)return e;const r=t();return n.setItem(Yv,r),r}function Ax(n){return{clientId:_x(n.storage,n.idFactory),userAgent:n.userAgent??(typeof navigator>"u"?"":navigator.userAgent),clientApp:n.clientApp,...n.desktopAppVersion?{desktopAppVersion:n.desktopAppVersion}:{}}}function Ex(n){const t=new URLSearchParams;return t.set("clientId",n.clientId),t.set("userAgent",n.userAgent),t.set("clientApp",n.clientApp),n.desktopAppVersion&&t.set("desktopAppVersion",n.desktopAppVersion),t}function kx(n){return new Cx(n)}var Sl,Jn,Ir,_l,Al,Et,Mi,El,Sh,sb;class Cx{constructor(t){m(this,Sh);m(this,Sl);m(this,Jn);m(this,Ir);m(this,_l);m(this,Al);m(this,Et);m(this,Mi,!1);m(this,El,Number.NEGATIVE_INFINITY);d(this,Sl,t.meta),d(this,Jn,t.documentTarget),d(this,Ir,t.windowTarget),d(this,_l,t.send),d(this,Al,t.nowMs??Date.now),d(this,Et,()=>h(this,Sh,sb).call(this))}start(){if(!o(this,Mi)){d(this,Mi,!0);for(const t of Jv)o(this,Ir).addEventListener(t,o(this,Et)),o(this,Jn).addEventListener(t,o(this,Et));for(const t of Kv)o(this,Ir).addEventListener(t,o(this,Et));for(const t of Xv)o(this,Jn).addEventListener(t,o(this,Et))}}stop(){if(o(this,Mi)){d(this,Mi,!1);for(const t of Jv)o(this,Ir).removeEventListener(t,o(this,Et)),o(this,Jn).removeEventListener(t,o(this,Et));for(const t of Kv)o(this,Ir).removeEventListener(t,o(this,Et));for(const t of Xv)o(this,Jn).removeEventListener(t,o(this,Et))}}}Sl=new WeakMap,Jn=new WeakMap,Ir=new WeakMap,_l=new WeakMap,Al=new WeakMap,Et=new WeakMap,Mi=new WeakMap,El=new WeakMap,Sh=new WeakSet,sb=function(){if(o(this,Jn).visibilityState===Sx)return;const t=o(this,Al).call(this);t-o(this,El)<bx||(d(this,El,t),o(this,_l).call(this,{type:bC,clientId:o(this,Sl).clientId}))};function $x(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Wm().toLowerCase()}const me={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"},Zn={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"},Tx=1,Rx=w({_meta:_(f(),S()).nullish(),terminal:Oe().optional().default(!1)}),Ix=w({_meta:_(f(),S()).nullish(),label:f().nullish(),name:f(),optional:Oe().optional().default(!1),secret:Oe().optional().default(!0)}),xx=w({_meta:_(f(),S()).nullish(),description:f().nullish(),id:f(),name:f()}),Px=w({_meta:_(f(),S()).nullish(),description:f().nullish(),id:f(),link:f().nullish(),name:f(),vars:M(Ix)}),Lx=w({_meta:_(f(),S()).nullish(),args:M(f()).optional(),description:f().nullish(),env:_(f(),f()).optional(),id:f(),name:f()}),Dx=K([Px.and(w({type:$("env_var")})),Lx.and(w({type:$("terminal")})),xx]),Ox=w({_meta:_(f(),S()).nullish(),methodId:f()}),Mx=w({_meta:_(f(),S()).nullish()}),Nx=w({_meta:_(f(),S()).nullish(),blob:f(),mimeType:f().nullish(),uri:f()}),zx=w({default:Oe().nullish(),description:f().nullish(),title:f().nullish()}),Ux=w({_meta:_(f(),S()).nullish()}),Fx=w({_meta:_(f(),S()).nullish()}),Zx=w({amount:j(),currency:f()}),Hx=w({_meta:_(f(),S()).nullish(),terminalId:f()}),Vx=w({_meta:_(f(),S()).nullish(),newText:f(),oldText:f().nullish(),path:f()}),Bx=K([f(),j(),j(),Oe(),M(f())]),Wx=w({content:_(f(),Bx).nullish()}),qx=K([Wx.and(w({action:$("accept")})),w({action:$("decline")}),w({action:$("cancel")})]),jx=w({_meta:_(f(),S()).nullish()}),ob=f(),Gx=w({_meta:_(f(),S()).nullish(),elicitationId:ob}),Yx=w({_meta:_(f(),S()).nullish(),action:qx}),Jx=$("object"),Kx=$("string"),Xx=w({_meta:_(f(),S()).nullish()}),Qx=w({_meta:_(f(),S()).nullish(),form:jx.nullish(),url:Xx.nullish()}),eP=w({elicitationId:ob,url:f().url()}),ab=w({const:f(),title:f()}),lb=w({_meta:_(f(),S()).nullish(),name:f(),value:f()}),tP=K([$(-32700),$(-32600),$(-32601),$(-32602),$(-32603),$(-32800),$(-32e3),$(-32002),$(-32042),j().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),cb=w({code:tP,data:S().optional(),message:f()}),ub=S(),hb=S(),db=S(),nP=w({_meta:_(f(),S()).nullish(),readTextFile:Oe().optional().default(!1),writeTextFile:Oe().optional().default(!1)}),pb=w({_meta:_(f(),S()).nullish(),name:f(),value:f()}),fb=w({_meta:_(f(),S()).nullish(),name:f(),title:f().nullish(),version:f()}),rP=w({default:j().nullish(),description:f().nullish(),maximum:j().nullish(),minimum:j().nullish(),title:f().nullish()}),iP=w({_meta:_(f(),S()).nullish()}),sP=w({_meta:_(f(),S()).nullish(),additionalDirectories:M(f()).optional(),cursor:f().nullish(),cwd:f().nullish()}),oP=w({_meta:_(f(),S()).nullish()}),aP=w({_meta:_(f(),S()).nullish(),logout:oP.nullish()}),lP=w({_meta:_(f(),S()).nullish()}),cP=w({_meta:_(f(),S()).nullish()}),uP=w({_meta:_(f(),S()).nullish(),http:Oe().optional().default(!1),sse:Oe().optional().default(!1)}),hP=w({_meta:_(f(),S()).nullish(),headers:M(pb),name:f(),url:f()}),dP=w({_meta:_(f(),S()).nullish(),headers:M(pb),name:f(),url:f()}),pP=w({_meta:_(f(),S()).nullish(),args:M(f()),command:f(),env:M(lb),name:f()}),dd=K([hP.and(w({type:$("http")})),dP.and(w({type:$("sse")})),pP]),Xm=f(),fP=w({_meta:_(f(),S()).nullish(),description:f().nullish(),modelId:Xm,name:f()}),mP=K([$("error"),$("warning"),$("information"),$("hint")]),gP=w({_meta:_(f(),S()).nullish()}),vP=w({_meta:_(f(),S()).nullish()}),yP=w({_meta:_(f(),S()).nullish()}),wP=w({_meta:_(f(),S()).nullish()}),bP=w({_meta:_(f(),S()).nullish()}),SP=w({_meta:_(f(),S()).nullish(),maxCount:j().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),_P=w({diff:f(),uri:f()}),AP=w({endLine:j().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:j().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:f()}),EP=w({_meta:_(f(),S()).nullish()}),kP=w({_meta:_(f(),S()).nullish()}),CP=w({languageId:f(),text:f(),uri:f()}),$P=w({_meta:_(f(),S()).nullish(),maxCount:j().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),TP=K([$("rejected"),$("ignored"),$("replaced"),$("cancelled")]),RP=w({excerpts:M(AP),uri:f()}),IP=w({_meta:_(f(),S()).nullish()}),xP=w({_meta:_(f(),S()).nullish()}),PP=w({name:f(),owner:f(),remoteUrl:f()}),LP=w({_meta:_(f(),S()).nullish()}),DP=w({_meta:_(f(),S()).nullish(),jump:EP.nullish(),rename:xP.nullish(),searchAndReplace:LP.nullish()}),OP=w({id:f(),isRegex:Oe().nullish(),replace:f(),search:f(),uri:f()}),MP=K([$("automatic"),$("diagnostic"),$("manual")]),NP=w({_meta:_(f(),S()).nullish(),maxCount:j().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),zP=w({_meta:_(f(),S()).nullish(),diagnostics:gP.nullish(),editHistory:SP.nullish(),openFiles:kP.nullish(),recentFiles:$P.nullish(),relatedSnippets:IP.nullish(),userActions:NP.nullish()}),UP=w({_meta:_(f(),S()).nullish(),additionalDirectories:M(f()).optional(),cwd:f(),mcpServers:M(dd)}),FP=w({default:j().nullish(),description:f().nullish(),maximum:j().nullish(),minimum:j().nullish(),title:f().nullish()}),mb=f(),ZP=K([$("allow_once"),$("allow_always"),$("reject_once"),$("reject_always")]),HP=w({_meta:_(f(),S()).nullish(),kind:ZP,name:f(),optionId:mb}),VP=K([$("high"),$("medium"),$("low")]),BP=K([$("pending"),$("in_progress"),$("completed")]),WP=w({_meta:_(f(),S()).nullish(),content:f(),priority:VP,status:BP}),qP=w({_meta:_(f(),S()).nullish(),entries:M(WP)}),di=w({character:j().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:j().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),jP=w({id:f(),position:di,uri:f()}),GP=w({id:f(),newName:f(),position:di,uri:f()}),YP=w({action:f(),position:di,timestampMs:j(),uri:f()}),gb=K([$("utf-16"),$("utf-32"),$("utf-8")]),JP=w({_meta:_(f(),S()).nullish(),auth:Rx.optional().default({terminal:!1}),elicitation:Qx.nullish(),fs:nP.optional().default({readTextFile:!1,writeTextFile:!1}),nes:DP.nullish(),positionEncodings:M(gb).optional(),terminal:Oe().optional().default(!1)}),KP=w({_meta:_(f(),S()).nullish(),audio:Oe().optional().default(!1),embeddedContext:Oe().optional().default(!1),image:Oe().optional().default(!1)}),vb=j().int().gte(0).lte(65535),XP=w({_meta:_(f(),S()).nullish(),clientCapabilities:JP.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:fb.nullish(),protocolVersion:vb}),ya=w({end:di,start:di}),QP=w({message:f(),range:ya,severity:mP,uri:f()}),eL=w({languageId:f(),lastFocusedMs:j().nullish(),uri:f(),visibleRange:ya.nullish()}),tL=w({_meta:_(f(),S()).nullish(),diagnostics:M(QP).nullish(),editHistory:M(_P).nullish(),openFiles:M(eL).nullish(),recentFiles:M(CP).nullish(),relatedSnippets:M(RP).nullish(),userActions:M(YP).nullish()}),nL=w({newText:f(),range:ya}),rL=w({cursorPosition:di.nullish(),edits:M(nL),id:f(),uri:f()}),iL=K([rL.and(w({kind:$("edit")})),jP.and(w({kind:$("jump")})),GP.and(w({kind:$("rename")})),OP.and(w({kind:$("searchAndReplace")}))]),sL=w({_meta:_(f(),S()).nullish(),content:f()}),oL=w({_meta:_(f(),S()).nullish()}),As=K([j(),f()]).nullable();w({_meta:_(f(),S()).nullish(),requestId:As});const aL=Xw(["assistant","user"]),Pc=w({_meta:_(f(),S()).nullish(),audience:M(aL).nullish(),lastModified:f().nullish(),priority:j().nullish()}),lL=w({_meta:_(f(),S()).nullish(),annotations:Pc.nullish(),data:f(),mimeType:f()}),cL=w({_meta:_(f(),S()).nullish(),annotations:Pc.nullish(),data:f(),mimeType:f(),uri:f().nullish()}),uL=w({_meta:_(f(),S()).nullish(),annotations:Pc.nullish(),description:f().nullish(),mimeType:f().nullish(),name:f(),size:j().nullish(),title:f().nullish(),uri:f()}),hL=w({_meta:_(f(),S()).nullish(),optionId:mb}),dL=K([w({outcome:$("cancelled")}),hL.and(w({outcome:$("selected")}))]),pL=w({_meta:_(f(),S()).nullish(),outcome:dL}),fL=w({_meta:_(f(),S()).nullish()}),mL=w({_meta:_(f(),S()).nullish()}),gL=w({currentValue:Oe()}),vL=f(),yb=f(),yL=K([$("mode"),$("model"),$("thought_level"),f()]),Qm=f(),wb=w({_meta:_(f(),S()).nullish(),description:f().nullish(),name:f(),value:Qm}),wL=w({_meta:_(f(),S()).nullish(),group:vL,name:f(),options:M(wb)}),bL=K([M(wb),M(wL)]),SL=w({currentValue:Qm,options:bL}),wa=hd(K([SL.and(w({type:$("select")})),gL.and(w({type:$("boolean")}))]),w({_meta:_(f(),S()).nullish(),category:yL.nullish(),description:f().nullish(),id:yb,name:f()})),_L=w({_meta:_(f(),S()).nullish(),configOptions:M(wa)}),AL=w({_meta:_(f(),S()).nullish()}),ae=f(),EL=w({_meta:_(f(),S()).nullish(),id:f(),sessionId:ae}),kL=w({_meta:_(f(),S()).nullish(),sessionId:ae}),CL=w({_meta:_(f(),S()).nullish(),sessionId:ae}),$L=w({_meta:_(f(),S()).nullish(),sessionId:ae}),bb=w({_meta:_(f(),S()).nullish(),args:M(f()).optional(),command:f(),cwd:f().nullish(),env:M(lb).optional(),outputByteLimit:j().nullish(),sessionId:ae}),TL=w({_meta:_(f(),S()).nullish(),sessionId:ae,uri:f()}),RL=w({_meta:_(f(),S()).nullish(),position:di,sessionId:ae,uri:f(),version:j(),visibleRange:ya}),IL=w({_meta:_(f(),S()).nullish(),languageId:f(),sessionId:ae,text:f(),uri:f(),version:j()}),xL=w({_meta:_(f(),S()).nullish(),sessionId:ae,uri:f()}),PL=w({_meta:_(f(),S()).nullish(),additionalDirectories:M(f()).optional(),cwd:f(),mcpServers:M(dd).optional(),sessionId:ae}),Sb=w({_meta:_(f(),S()).nullish(),sessionId:ae,terminalId:f()}),LL=w({_meta:_(f(),S()).nullish(),additionalDirectories:M(f()).optional(),cwd:f(),mcpServers:M(dd),sessionId:ae}),_b=w({_meta:_(f(),S()).nullish(),limit:j().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:j().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:f(),sessionId:ae}),DL=w({_meta:_(f(),S()).nullish(),id:f(),reason:TP.nullish(),sessionId:ae}),Ab=w({_meta:_(f(),S()).nullish(),sessionId:ae,terminalId:f()}),OL=w({_meta:_(f(),S()).nullish(),additionalDirectories:M(f()).optional(),cwd:f(),mcpServers:M(dd).optional(),sessionId:ae}),ML=w({_meta:_(f(),S()).nullish(),additionalDirectories:M(f()).optional(),cwd:f(),sessionId:ae,title:f().nullish(),updatedAt:f().nullish()}),NL=w({_meta:_(f(),S()).nullish(),nextCursor:f().nullish(),sessions:M(ML)}),zL=w({_meta:_(f(),S()).nullish(),title:f().nullish(),updatedAt:f().nullish()}),UL=w({_meta:_(f(),S()).nullish()}),pd=f(),FL=w({_meta:_(f(),S()).nullish(),currentModeId:pd}),ZL=w({_meta:_(f(),S()).nullish(),description:f().nullish(),id:pd,name:f()}),fd=w({_meta:_(f(),S()).nullish(),availableModes:M(ZL),currentModeId:pd}),md=w({_meta:_(f(),S()).nullish(),availableModels:M(fP),currentModelId:Xm}),HL=w({_meta:_(f(),S()).nullish(),configOptions:M(wa).nullish(),models:md.nullish(),modes:fd.nullish(),sessionId:ae}),VL=w({_meta:_(f(),S()).nullish(),configOptions:M(wa).nullish(),models:md.nullish(),modes:fd.nullish()}),BL=w({_meta:_(f(),S()).nullish(),configOptions:M(wa).nullish(),models:md.nullish(),modes:fd.nullish(),sessionId:ae}),WL=w({_meta:_(f(),S()).nullish(),configOptions:M(wa).nullish(),models:md.nullish(),modes:fd.nullish()}),qL=w({_meta:_(f(),S()).nullish()}),jL=w({_meta:_(f(),S()).nullish(),additionalDirectories:fL.nullish(),close:mL.nullish(),fork:AL.nullish(),list:UL.nullish(),resume:qL.nullish()}),GL=hd(K([w({type:$("boolean"),value:Oe()}),w({value:Qm})]),w({_meta:_(f(),S()).nullish(),configId:yb,sessionId:ae})),YL=w({_meta:_(f(),S()).nullish(),configOptions:M(wa)}),JL=w({_meta:_(f(),S()).nullish(),modeId:pd,sessionId:ae}),KL=w({_meta:_(f(),S()).nullish()}),XL=w({_meta:_(f(),S()).nullish(),modelId:Xm,sessionId:ae}),QL=w({_meta:_(f(),S()).nullish()}),eD=w({_meta:_(f(),S()).nullish(),sessionId:ae}),tD=K([$("end_turn"),$("max_tokens"),$("max_turn_requests"),$("refusal"),$("cancelled")]),nD=K([$("email"),$("uri"),$("date"),$("date-time")]),rD=w({default:f().nullish(),description:f().nullish(),enum:M(f()).nullish(),format:nD.nullish(),maxLength:j().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:j().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:M(ab).nullish(),pattern:f().nullish(),title:f().nullish()}),iD=w({_meta:_(f(),S()).nullish(),context:tL.nullish(),position:di,selection:ya.nullish(),sessionId:ae,triggerKind:MP,uri:f(),version:j()}),sD=w({_meta:_(f(),S()).nullish(),suggestions:M(iL)}),oD=w({_meta:_(f(),S()).nullish(),terminalId:f()}),aD=w({_meta:_(f(),S()).nullish(),exitCode:j().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:f().nullish()}),Eb=w({_meta:_(f(),S()).nullish(),sessionId:ae,terminalId:f()}),lD=w({_meta:_(f(),S()).nullish(),exitStatus:aD.nullish(),output:f(),truncated:Oe()}),cD=w({_meta:_(f(),S()).nullish(),annotations:Pc.nullish(),text:f()}),uD=w({range:ya.nullish(),text:f()}),hD=w({_meta:_(f(),S()).nullish(),contentChanges:M(uD),sessionId:ae,uri:f(),version:j()});w({method:f(),params:K([kL,IL,hD,TL,xL,RL,EL,DL,ub]).nullish()});const dD=K([$("full"),$("incremental")]),pD=w({_meta:_(f(),S()).nullish(),syncKind:dD}),fD=w({_meta:_(f(),S()).nullish(),didChange:pD.nullish(),didClose:vP.nullish(),didFocus:yP.nullish(),didOpen:wP.nullish(),didSave:bP.nullish()}),mD=w({_meta:_(f(),S()).nullish(),document:fD.nullish()}),gD=w({_meta:_(f(),S()).nullish(),context:zP.nullish(),events:mD.nullish()}),vD=w({_meta:_(f(),S()).nullish(),auth:aP.optional().default({}),loadSession:Oe().optional().default(!1),mcpCapabilities:uP.optional().default({http:!1,sse:!1}),nes:gD.nullish(),positionEncoding:gb.nullish(),promptCapabilities:KP.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:jL.optional().default({})}),yD=w({_meta:_(f(),S()).nullish(),agentCapabilities:vD.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:fb.nullish(),authMethods:M(Dx).optional().default([]),protocolVersion:vb}),wD=w({_meta:_(f(),S()).nullish(),mimeType:f().nullish(),text:f(),uri:f()}),bD=K([wD,Nx]),SD=w({_meta:_(f(),S()).nullish(),annotations:Pc.nullish(),resource:bD}),eg=K([cD.and(w({type:$("text")})),cL.and(w({type:$("image")})),lL.and(w({type:$("audio")})),uL.and(w({type:$("resource_link")})),SD.and(w({type:$("resource")}))]),_D=w({_meta:_(f(),S()).nullish(),content:eg}),pp=w({_meta:_(f(),S()).nullish(),content:eg,messageId:f().nullish()}),AD=w({_meta:_(f(),S()).nullish(),messageId:f().nullish(),prompt:M(eg),sessionId:ae}),ED=w({anyOf:M(ab)}),kb=K([_D.and(w({type:$("content")})),Vx.and(w({type:$("diff")})),oD.and(w({type:$("terminal")}))]),Cb=f(),$b=w({_meta:_(f(),S()).nullish(),line:j().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:f()}),Tb=K([$("pending"),$("in_progress"),$("completed"),$("failed")]),Rb=K([$("read"),$("edit"),$("delete"),$("move"),$("search"),$("execute"),$("think"),$("fetch"),$("switch_mode"),$("other")]),kD=w({_meta:_(f(),S()).nullish(),content:M(kb).optional(),kind:Rb.optional(),locations:M($b).optional(),rawInput:S().optional(),rawOutput:S().optional(),status:Tb.optional(),title:f(),toolCallId:Cb}),Ib=w({_meta:_(f(),S()).nullish(),content:M(kb).nullish(),kind:Rb.nullish(),locations:M($b).nullish(),rawInput:S().optional(),rawOutput:S().optional(),status:Tb.nullish(),title:f().nullish(),toolCallId:Cb}),xb=w({_meta:_(f(),S()).nullish(),options:M(HP),sessionId:ae,toolCall:Ib}),CD=w({_meta:_(f(),S()).nullish(),hint:f()}),$D=CD,TD=w({_meta:_(f(),S()).nullish(),description:f(),input:$D.nullish(),name:f()}),RD=w({_meta:_(f(),S()).nullish(),availableCommands:M(TD)}),ID=w({enum:M(f()),type:Kx}),xD=K([ID,ED]),PD=w({default:M(f()).nullish(),description:f().nullish(),items:xD,maxItems:j().nullish(),minItems:j().nullish(),title:f().nullish()}),LD=K([rD.and(w({type:$("string")})),FP.and(w({type:$("number")})),rP.and(w({type:$("integer")})),zx.and(w({type:$("boolean")})),PD.and(w({type:$("array")}))]),DD=w({description:f().nullish(),properties:_(f(),LD).optional().default({}),required:M(f()).nullish(),title:f().nullish(),type:Jx.optional().default("object")}),OD=w({requestedSchema:DD}),MD=hd(K([OD.and(w({mode:$("form")})),eP.and(w({mode:$("url")}))]),w({_meta:_(f(),S()).nullish(),message:f(),sessionId:ae})),ND=w({cachedReadTokens:j().nullish(),cachedWriteTokens:j().nullish(),inputTokens:j(),outputTokens:j(),thoughtTokens:j().nullish(),totalTokens:j()}),zD=w({_meta:_(f(),S()).nullish(),stopReason:tD,usage:ND.nullish(),userMessageId:f().nullish()});K([w({id:As,result:K([yD,Mx,cP,BL,VL,NL,HL,WL,Fx,KL,YL,zD,QL,eD,sD,Ux,db])}),w({error:cb,id:As})]);const UD=w({_meta:_(f(),S()).nullish(),cost:Zx.nullish(),size:j(),used:j()}),FD=K([pp.and(w({sessionUpdate:$("user_message_chunk")})),pp.and(w({sessionUpdate:$("agent_message_chunk")})),pp.and(w({sessionUpdate:$("agent_thought_chunk")})),kD.and(w({sessionUpdate:$("tool_call")})),Ib.and(w({sessionUpdate:$("tool_call_update")})),qP.and(w({sessionUpdate:$("plan")})),RD.and(w({sessionUpdate:$("available_commands_update")})),FL.and(w({sessionUpdate:$("current_mode_update")})),_L.and(w({sessionUpdate:$("config_option_update")})),zL.and(w({sessionUpdate:$("session_info_update")})),UD.and(w({sessionUpdate:$("usage_update")}))]),Pb=w({_meta:_(f(),S()).nullish(),sessionId:ae,update:FD});w({method:f(),params:K([Pb,Gx,ub]).nullish()});const Lb=w({_meta:_(f(),S()).nullish(),sessionId:ae,terminalId:f()}),ZD=w({_meta:_(f(),S()).nullish(),exitCode:j().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:f().nullish()}),HD=w({name:f(),uri:f()}),VD=w({_meta:_(f(),S()).nullish(),repository:PP.nullish(),workspaceFolders:M(HD).nullish(),workspaceUri:f().nullish()});w({id:As,method:f(),params:K([XP,Ox,lP,UP,LL,sP,PL,OL,$L,JL,GL,AD,XL,VD,iD,CL,hb]).nullish()});const Db=w({_meta:_(f(),S()).nullish(),content:f(),path:f(),sessionId:ae});w({id:As,method:f(),params:K([Db,_b,xb,bb,Eb,Ab,Lb,Sb,MD,hb]).nullish()});const BD=w({_meta:_(f(),S()).nullish()});K([w({id:As,result:K([BD,sL,pL,Hx,lD,oL,ZD,iP,Yx,db])}),w({error:cb,id:As})]);var se;class WD{constructor(t,e){m(this,se);const r=t(this),i=async(a,l)=>{var c,u,p,g,v,y,E;switch(a){case Zn.fs_write_text_file:{const A=Db.parse(l);return(c=r.writeTextFile)==null?void 0:c.call(r,A)}case Zn.fs_read_text_file:{const A=_b.parse(l);return(u=r.readTextFile)==null?void 0:u.call(r,A)}case Zn.session_request_permission:{const A=xb.parse(l);return r.requestPermission(A)}case Zn.terminal_create:{const A=bb.parse(l);return(p=r.createTerminal)==null?void 0:p.call(r,A)}case Zn.terminal_output:{const A=Eb.parse(l);return(g=r.terminalOutput)==null?void 0:g.call(r,A)}case Zn.terminal_release:{const A=Ab.parse(l);return await((v=r.releaseTerminal)==null?void 0:v.call(r,A))??{}}case Zn.terminal_wait_for_exit:{const A=Lb.parse(l);return(y=r.waitForTerminalExit)==null?void 0:y.call(r,A)}case Zn.terminal_kill:{const A=Sb.parse(l);return await((E=r.killTerminal)==null?void 0:E.call(r,A))??{}}default:if(r.extMethod)return r.extMethod(a,l);throw Ie.methodNotFound(a)}},s=async(a,l)=>{switch(a){case Zn.session_update:{const c=Pb.parse(l);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(a,l);throw Ie.methodNotFound(a)}};d(this,se,new qD(i,s,e))}async initialize(t){return await o(this,se).sendRequest(me.initialize,t)}async newSession(t){return await o(this,se).sendRequest(me.session_new,t)}async loadSession(t){return await o(this,se).sendRequest(me.session_load,t)??{}}async unstable_forkSession(t){return await o(this,se).sendRequest(me.session_fork,t)}async listSessions(t){return await o(this,se).sendRequest(me.session_list,t)}async unstable_resumeSession(t){return await o(this,se).sendRequest(me.session_resume,t)}async unstable_closeSession(t){return await o(this,se).sendRequest(me.session_close,t)}async setSessionMode(t){return await o(this,se).sendRequest(me.session_set_mode,t)??{}}async unstable_setSessionModel(t){return await o(this,se).sendRequest(me.session_set_model,t)??{}}async setSessionConfigOption(t){return await o(this,se).sendRequest(me.session_set_config_option,t)}async authenticate(t){return await o(this,se).sendRequest(me.authenticate,t)??{}}async unstable_logout(t){return await o(this,se).sendRequest(me.logout,t)??{}}async prompt(t){return await o(this,se).sendRequest(me.session_prompt,t)}async cancel(t){return await o(this,se).sendNotification(me.session_cancel,t)}async unstable_startNes(t){return await o(this,se).sendRequest(me.nes_start,t)}async unstable_suggestNes(t){return await o(this,se).sendRequest(me.nes_suggest,t)}async unstable_closeNes(t){return await o(this,se).sendRequest(me.nes_close,t)??{}}async unstable_didOpenDocument(t){return await o(this,se).sendNotification(me.document_did_open,t)}async unstable_didChangeDocument(t){return await o(this,se).sendNotification(me.document_did_change,t)}async unstable_didCloseDocument(t){return await o(this,se).sendNotification(me.document_did_close,t)}async unstable_didSaveDocument(t){return await o(this,se).sendNotification(me.document_did_save,t)}async unstable_didFocusDocument(t){return await o(this,se).sendNotification(me.document_did_focus,t)}async unstable_acceptNes(t){return await o(this,se).sendNotification(me.nes_accept,t)}async unstable_rejectNes(t){return await o(this,se).sendNotification(me.nes_reject,t)}async extMethod(t,e){return await o(this,se).sendRequest(t,e)}async extNotification(t,e){return await o(this,se).sendNotification(t,e)}get signal(){return o(this,se).signal}get closed(){return o(this,se).closed}}se=new WeakMap;var xr,_h,kl,Cl,fo,mo,cn,$l,ye,Ob,Jp,Mb,Nb,zb,Ub,Kp,Va;class qD{constructor(t,e,r){m(this,ye);m(this,xr,new Map);m(this,_h,0);m(this,kl);m(this,Cl);m(this,fo);m(this,mo,Promise.resolve());m(this,cn,new AbortController);m(this,$l);d(this,kl,t),d(this,Cl,e),d(this,fo,r),d(this,$l,new Promise(i=>{o(this,cn).signal.addEventListener("abort",()=>i())})),h(this,ye,Ob).call(this)}get signal(){return o(this,cn).signal}get closed(){return o(this,$l)}async sendRequest(t,e){h(this,ye,Kp).call(this);const r=Wc(this,_h)._++,i=new Promise((s,a)=>{o(this,xr).set(r,{resolve:s,reject:a})});return await h(this,ye,Va).call(this,{jsonrpc:"2.0",id:r,method:t,params:e}),i}async sendNotification(t,e){h(this,ye,Kp).call(this),await h(this,ye,Va).call(this,{jsonrpc:"2.0",method:t,params:e})}}xr=new WeakMap,_h=new WeakMap,kl=new WeakMap,Cl=new WeakMap,fo=new WeakMap,mo=new WeakMap,cn=new WeakMap,$l=new WeakMap,ye=new WeakSet,Ob=async function(){let t;try{const e=o(this,fo).readable.getReader();try{for(;!o(this,cn).signal.aborted;){const{value:r,done:i}=await e.read();if(i)break;if(r)try{h(this,ye,Mb).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&h(this,ye,Va).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{e.releaseLock()}}catch(e){t=e}finally{h(this,ye,Jp).call(this,t)}},Jp=function(t){if(o(this,cn).signal.aborted)return;const e=t??new Error("ACP connection closed");for(const r of o(this,xr).values())r.reject(e);o(this,xr).clear(),o(this,cn).abort(e)},Mb=async function(t){if("method"in t&&"id"in t){const e=await h(this,ye,Nb).call(this,t.method,t.params);"error"in e&&console.error("Error handling request",t,e.error),await h(this,ye,Va).call(this,{jsonrpc:"2.0",id:t.id,...e})}else if("method"in t){const e=await h(this,ye,zb).call(this,t.method,t.params);"error"in e&&console.error("Error handling notification",t,e.error)}else"id"in t?h(this,ye,Ub).call(this,t):console.error("Invalid message",{message:t})},Nb=async function(t,e){try{return{result:await o(this,kl).call(this,t,e)??null}}catch(r){if(r instanceof Ie)return r.toResult();if(r instanceof Hv)return Ie.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 Ie.internalError(i?JSON.parse(i):{}).toResult()}catch{return Ie.internalError({details:i}).toResult()}}},zb=async function(t,e){try{return await o(this,Cl).call(this,t,e),{result:null}}catch(r){if(r instanceof Ie)return r.toResult();if(r instanceof Hv)return Ie.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 Ie.internalError(i?JSON.parse(i):{}).toResult()}catch{return Ie.internalError({details:i}).toResult()}}},Ub=function(t){const e=o(this,xr).get(t.id);if(e){if("result"in t)e.resolve(t.result);else if("error"in t){const{code:r,message:i,data:s}=t.error;e.reject(new Ie(r,i,s))}o(this,xr).delete(t.id)}else console.error("Got response to unknown request",t.id)},Kp=function(){if(o(this,cn).signal.aborted)throw o(this,cn).signal.reason??new Error("ACP connection closed")},Va=async function(t){return d(this,mo,o(this,mo).then(async()=>{const e=o(this,fo).writable.getWriter();try{await e.write(t)}finally{e.releaseLock()}}).catch(e=>{h(this,ye,Jp).call(this,e)})),o(this,mo)};class Ie extends Error{constructor(e,r,i){super(r);C(this,"code");C(this,"data");this.code=e,this.name="RequestError",this.data=i}static parseError(e,r){return new Ie(-32700,`Parse error${r?`: ${r}`:""}`,e)}static invalidRequest(e,r){return new Ie(-32600,`Invalid request${r?`: ${r}`:""}`,e)}static methodNotFound(e){return new Ie(-32601,`"Method not found": ${e}`,{method:e})}static invalidParams(e,r){return new Ie(-32602,`Invalid params${r?`: ${r}`:""}`,e)}static internalError(e,r){return new Ie(-32603,`Internal error${r?`: ${r}`:""}`,e)}static authRequired(e,r){return new Ie(-32e3,`Authentication required${r?`: ${r}`:""}`,e)}static resourceNotFound(e){return new Ie(-32002,`Resource not found${e?`: ${e}`:""}`,e&&{uri:e})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}}function jD(n,t,e){const r=n.dispose.bind(n);n.dispose=()=>{if(!t())return e(),r()}}function Fb(n){var e;class t extends n{constructor(...s){super(...s);m(this,e,!1);jD(this,()=>o(this,e),()=>{d(this,e,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return o(this,e)}}return e=new WeakMap,t}const GD=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,YD=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,JD=/\[Television channel context\][\s\S]*?\[\/Television channel context\]\n*/,KD=/\b(tv|television|channel|artifact|artifacts|viewer|filmstrip|layout|focus)\b/i,XD=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,QD="single_session",e5={name:"television-acp-client",version:"0.0.0"},Zb="agent:main:television",t5=Fb(mi);var go,un,ft,hn,Pr,Vt,Kn,dn,pn,Lr,Bt,vo,yo,fn,je,Xn,wo,Ni,Qn,Dr,Tl,Wt,mn,Ah,gn,R,Xp,Hb,Vb,Bb,Eu,Wb,qb,jb,Gb,Yb,Jb,Kb,_i,Ws,qs,Vn,Xb,js,Qp,ef,ku,Qb,Cu,tf,nf,Rl,Il,$u,Gs,rf,e2;class n5 extends t5{constructor(e){super();m(this,R);m(this,go,"disconnected");m(this,un,null);m(this,ft,new Map);m(this,hn,null);m(this,Pr,null);m(this,Vt,null);m(this,Kn,null);m(this,dn,null);m(this,pn,null);m(this,Lr);m(this,Bt,null);m(this,vo,0);m(this,yo,1);m(this,fn,null);m(this,je,null);m(this,Xn,!1);m(this,wo,!1);m(this,Ni,!1);m(this,Qn,null);m(this,Dr,new Set);m(this,Tl);m(this,Wt);m(this,mn);m(this,Ah,e=>{h(this,R,Vb).call(this,e)});m(this,gn,null);m(this,Rl,()=>{h(this,R,Gs).call(this,"ACP bridge websocket closed")});m(this,Il,()=>{h(this,R,Gs).call(this,"ACP bridge websocket error")});d(this,Wt,e),d(this,mn,e.sessionMode??QD),d(this,Lr,e.mappedSessionStore??r5()),d(this,Tl,e.createSocket??(r=>new WebSocket(r)))}get status(){return o(this,go)}get messages(){return[...o(this,ft).values()]}get enabled(){return o(this,Wt).enabled??!1}setToken(e){o(this,Wt).token=e??""}setEnabled(e){o(this,Wt).enabled=e,e||(h(this,R,$u).call(this),d(this,un,null),h(this,R,Vn).call(this,"disconnected"))}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(this.enabled&&this.status==="disconnected"){o(this,Pr)===null&&(d(this,un,null),d(this,Pr,h(this,R,Hb).call(this)));try{await o(this,Pr),await h(this,R,Eu).call(this)}catch(e){throw h(this,R,Gs).call(this,fp(e)),e}}}dispose(){h(this,R,$u).call(this),d(this,un,null),h(this,R,Vn).call(this,"disposed")}async sendMessage(e){if(await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await h(this,R,Xp).call(this,"ready")),(o(this,dn)===null||o(this,Bt)!==h(this,R,Cu).call(this))&&await h(this,R,Eu).call(this),this.status!=="ready")throw new Error("ACPClient is not ready to send a new message");const r=e.text.trim();if(!r)throw new Error("Cannot send an empty message");h(this,R,Ws).call(this,{id:h(this,R,js).call(this,"user"),kind:"user",text:r,status:"final"}),h(this,R,Vn).call(this,"running");try{const i=await h(this,R,ku).call(this).prompt({sessionId:h(this,R,ef).call(this),prompt:[{type:"text",text:h(this,R,Xb).call(this,r)}]});h(this,R,_i).call(this,i.stopReason==="cancelled"?"cancelled":"final"),h(this,R,Vn).call(this,"ready")}catch(i){throw h(this,R,e2).call(this)||(h(this,R,_i).call(this,"error"),h(this,R,Vn).call(this,"ready")),i}}async startNewSession(){var r;await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await h(this,R,Xp).call(this,"ready"));const e=h(this,R,Cu).call(this);((r=o(this,pn))==null?void 0:r.sessionIdStrategy)==="mapped"?o(this,Lr).clearActualSessionId(e):d(this,vo,o(this,vo)+1),d(this,Vt,null),d(this,Kn,null),d(this,dn,null),d(this,Bt,null),h(this,R,rf).call(this)}async cancel(){this.status==="running"&&(h(this,R,Vn).call(this,"cancelling"),await h(this,R,ku).call(this).cancel({sessionId:h(this,R,ef).call(this)}))}setChannelContext(e){var s,a,l;if(e===null){if(o(this,je)===null)return;d(this,je,null),d(this,Xn,!1);return}const r={channelID:e.channelID,channelName:e.channelName};if(((s=o(this,je))==null?void 0:s.channelID)===r.channelID&&((a=o(this,je))==null?void 0:a.channelName)===r.channelName)return;const i=((l=o(this,je))==null?void 0:l.channelID)??null;if(d(this,je,r),o(this,mn)==="single_session"){(!o(this,Bt)||i!==r.channelID)&&d(this,Xn,!0);return}o(this,Bt)!==h(this,R,tf).call(this,r.channelID)&&(d(this,Vt,null),d(this,Kn,null),o(this,hn)&&this.status==="ready"&&h(this,R,Eu).call(this).catch(c=>{h(this,R,Gs).call(this,fp(c))}))}}go=new WeakMap,un=new WeakMap,ft=new WeakMap,hn=new WeakMap,Pr=new WeakMap,Vt=new WeakMap,Kn=new WeakMap,dn=new WeakMap,pn=new WeakMap,Lr=new WeakMap,Bt=new WeakMap,vo=new WeakMap,yo=new WeakMap,fn=new WeakMap,je=new WeakMap,Xn=new WeakMap,wo=new WeakMap,Ni=new WeakMap,Qn=new WeakMap,Dr=new WeakMap,Tl=new WeakMap,Wt=new WeakMap,mn=new WeakMap,Ah=new WeakMap,gn=new WeakMap,R=new WeakSet,Xp=async function(e){if(this.status!==e){if(this.status==="disposed")throw new Error("ACPClient has been disposed");if(this.status==="disconnected")throw new Error(o(this,un)??"ACPClient is disconnected");await new Promise((r,i)=>{const s=()=>{this.removeEventListener("status-changed",a)},a=()=>{if(this.status===e){s(),r();return}if(this.status==="disposed"){s(),i(new Error("ACPClient has been disposed"));return}this.status==="disconnected"&&(s(),i(new Error(o(this,un)??"ACPClient is disconnected")))};this.addEventListener("status-changed",a)})}},Hb=async function(){try{const{stream:e,socket:r,metadata:i}=await a5({serverURL:o(this,Wt).serverURL,token:o(this,Wt).token,createSocket:o(this,Tl),onDisconnect:o(this,Ah)});d(this,pn,i),d(this,gn,r),r.addEventListener("close",o(this,Rl)),r.addEventListener("error",o(this,Il)),d(this,hn,new WD(s=>({connection:s,sessionUpdate:async a=>{await h(this,R,qb).call(this,a)},requestPermission:async a=>h(this,R,jb).call(this,a)}),e)),await o(this,hn).initialize({protocolVersion:Tx,clientCapabilities:{},clientInfo:e5})}catch(e){throw e}},Vb=function(e){h(this,R,Gs).call(this,fp(e))},Bb=function(e){const r=e==null?void 0:e.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})`)},Eu=async function(){const e=h(this,R,Cu).call(this);if(o(this,Vt)&&o(this,Kn)===e){await o(this,Vt);return}d(this,Kn,e),d(this,Vt,h(this,R,Wb).call(this,e)),await o(this,Vt)},Wb=async function(e){var c;const r=h(this,R,ku).call(this);h(this,R,rf).call(this);let i,s=!1,a=null;const l={cwd:h(this,R,Qb).call(this),mcpServers:[],_meta:{sessionKey:e}};try{if(d(this,Ni,!0),d(this,Qn,null),((c=o(this,pn))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=o(this,Lr).getActualSessionId(e);if(u)try{const p=await r.loadSession({...l,sessionId:u});if(i5(p))throw new Error("Mapped ACP session was not found");a=p,i=u,s=!0}catch{const p=await r.newSession(l);a=p,i=p.sessionId,o(this,Lr).setActualSessionId(e,i),s=!1}else{const p=await r.newSession(l);a=p,i=p.sessionId,o(this,Lr).setActualSessionId(e,i),s=!1}}else try{a=await r.loadSession({...l,sessionId:e}),i=e,s=o(this,ft).size>0}catch{const u=await r.newSession(l);a=u,i=u.sessionId,s=!1}}finally{d(this,Ni,!1),d(this,Qn,null),h(this,R,_i).call(this,"final")}h(this,R,Bb).call(this,a),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),d(this,dn,i),d(this,Bt,e),d(this,wo,!0),s?(o(this,Dr).add(e),o(this,mn)==="single_session"&&d(this,Xn,!1)):(o(this,Dr).delete(e),d(this,Xn,o(this,mn)==="single_session")),d(this,un,null),h(this,R,Vn).call(this,"ready")},qb=async function(e){const r=e.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&h(this,R,Kb).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&h(this,R,Gb).call(this,r.content.text);return;case"tool_call":h(this,R,Yb).call(this,r);return;case"tool_call_update":h(this,R,Jb).call(this,r);return;case"agent_thought_chunk":return;default:return}},jb=async function(e){return{outcome:{outcome:"cancelled"}}},Gb=function(e){d(this,Qn,null);const r=o5(e);if(!r)return;if(!o(this,fn)){const s={id:h(this,R,js).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};d(this,fn,s.id),h(this,R,Ws).call(this,s);return}const i=o(this,ft).get(o(this,fn));if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");h(this,R,qs).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},Yb=function(e){h(this,R,_i).call(this,"final");const r=h(this,R,Qp).call(this,e.toolCallId),i=e1("content"in e?e.content:void 0),s={id:(r==null?void 0:r.id)??h(this,R,js).call(this,"tool"),kind:"tool_call",toolCallId:e.toolCallId,title:e.title,toolKind:e.kind??"other",status:e.status==="failed"?"failed":e.status==="completed"?"completed":"in_progress",text:(r==null?void 0:r.text)??i,locations:e.locations??(r==null?void 0:r.locations)};if(r){h(this,R,qs).call(this,s);return}h(this,R,Ws).call(this,s)},Jb=function(e){const r=h(this,R,Qp).call(this,e.toolCallId),i=(r==null?void 0:r.text)??"",s=e1(e.content),a=s?`${i}${s}`:i,l={id:(r==null?void 0:r.id)??h(this,R,js).call(this,"tool"),kind:"tool_call",toolCallId:e.toolCallId,title:(r==null?void 0:r.title)??e.toolCallId,toolKind:(r==null?void 0:r.toolKind)??"other",status:e.status==="failed"?"failed":e.status==="completed"?"completed":"in_progress",text:a,locations:e.locations??(r==null?void 0:r.locations)};if(r){h(this,R,qs).call(this,l);return}h(this,R,Ws).call(this,l)},Kb=function(e){if(h(this,R,_i).call(this,"final"),!e)return;const r=o(this,Ni)?o(this,Qn):null;if(!r){const s=Qv(e);if(!s)return;const a={id:h(this,R,js).call(this,"user"),kind:"user",text:s,status:"final"};h(this,R,Ws).call(this,a),o(this,Ni)&&d(this,Qn,a.id);return}const i=o(this,ft).get(r);if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");h(this,R,qs).call(this,{...i,text:Qv(`${i.text}${e}`)})},_i=function(e){if(!o(this,fn))return;const r=o(this,ft).get(o(this,fn));(r==null?void 0:r.kind)==="assistant"&&h(this,R,qs).call(this,{...r,status:e}),d(this,fn,null)},Ws=function(e){o(this,ft).set(e.id,e),this.dispatchEvent(new up("messages-changed"))},qs=function(e){o(this,ft).set(e.id,e),this.dispatchEvent(new up("messages-changed"))},Vn=function(e){o(this,go)!==e&&(d(this,go,e),this.dispatchEvent(new d$("status-changed")))},Xb=function(e){const r=o(this,Bt);if(!r)return e;const i=o(this,je)?o(this,mn)==="single_session"?o(this,Xn)||!o(this,Dr).has(r):!o(this,Dr).has(r):!1,s=o(this,wo)&&(o(this,je)!==null||KD.test(e));if(!(s||i))return e;s&&d(this,wo,!1),i&&(d(this,Xn,!1),o(this,Dr).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 o(this,je)?(l.push("This conversation is currently attached to the channel below."),l.push(`channel_id: ${o(this,je).channelID}`),l.push(`channel_name: ${o(this,je).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]","",e),l.join(`
43
+ `)},js=function(e){const r=`${e}-${o(this,yo)}`;return d(this,yo,o(this,yo)+1),r},Qp=function(e){for(const r of o(this,ft).values())if((r==null?void 0:r.kind)==="tool_call"&&r.toolCallId===e)return r;return null},ef=function(){if(!o(this,dn))throw new Error("ACP session is not ready");return o(this,dn)},ku=function(){if(!o(this,hn))throw new Error("ACP connection is not ready");return o(this,hn)},Qb=function(){var r;const e=(r=o(this,pn))==null?void 0:r.sessionCwd;if(!e)throw new Error("ACP bridge session cwd is not ready");return e},Cu=function(){var r;if(o(this,mn)==="single_session")return h(this,R,nf).call(this,`${Zb}-${(o(this,Wt).clientGUID??"default-client").toLowerCase()}`);const e=(r=o(this,je))==null?void 0:r.channelID;if(!e)throw new Error("Channel context is required for per-channel session mode");return h(this,R,tf).call(this,e)},tf=function(e){return h(this,R,nf).call(this,s5(o(this,mn),e,o(this,Wt).clientGUID??"default-client"))},nf=function(e){var r;return((r=o(this,pn))==null?void 0:r.sessionIdStrategy)==="deterministic"&&o(this,vo)>0?`${e}:epoch-${o(this,vo)}`:e},Rl=new WeakMap,Il=new WeakMap,$u=function(){d(this,hn,null),d(this,Pr,null),d(this,Vt,null),d(this,Kn,null),d(this,dn,null),d(this,Bt,null),d(this,pn,null),o(this,gn)&&(o(this,gn).removeEventListener("close",o(this,Rl)),o(this,gn).removeEventListener("error",o(this,Il)),o(this,gn).close(),d(this,gn,null))},Gs=function(e){const r=o(this,hn)!==null||o(this,Pr)!==null||o(this,Vt)!==null||o(this,Kn)!==null||o(this,dn)!==null||o(this,Bt)!==null||o(this,pn)!==null||o(this,gn)!==null;this.disposed||this.status==="disconnected"&&!r||(h(this,R,_i).call(this,"error"),h(this,R,$u).call(this),d(this,un,e??null),h(this,R,Vn).call(this,"disconnected"))},rf=function(){const e=o(this,ft).size>0;d(this,fn,null),d(this,Qn,null),d(this,yo,1),o(this,ft).clear(),e&&this.dispatchEvent(new up("messages-changed"))},e2=function(){return this.status==="disconnected"};function r5(){const n=new Map;return{getActualSessionId(t){return n.get(t)??null},setActualSessionId(t,e){n.set(t,e)},clearActualSessionId(t){n.delete(t)}}}function i5(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function s5(n,t,e){return n==="single_session"?`${Zb}-${e.toLowerCase()}`:`agent:main:television-${e.toLowerCase()}-${t.toLowerCase()}`}function t2(n){return n.replace(/^(?:\s*\n)+/,"")}function Qv(n){let t=n;return t=t.replace(GD,""),t=t.replace(YD,""),t=t.replace(JD,""),t=t2(t),t}function o5(n){let t=n;return t=t.replace(XD,""),t=t2(t),t}function e1(n){return!n||n.length===0?"":n.flatMap(t=>t.type==="content"&&t.content.type==="text"?[t.content.text]:[]).join("")}async function a5(n){const t=n.createSocket(u5(n.serverURL,n.token));let e=!1,r,i;const s=new Promise((u,p)=>{r=u,i=p}),a=new ReadableStream({start(u){let p=!1;const g=()=>{t.send(JSON.stringify({type:"acp-bridge-connect"}))},v=A=>{const x=c5(A);if(!x)return;let L;try{L=JSON.parse(x)}catch(D){const V=D instanceof Error?D:new Error(String(D));i(V),u.error(V);return}switch(L.type){case"acp-bridge-status":if(L.status==="ready"){let D;try{D=l5(L)}catch(V){const F=V instanceof Error?V:new Error(String(V));e||i(F),u.error(F);return}e||(e=!0,r(D));return}if(L.status==="error"||L.status==="exited"){const D=new Error(L.error??`ACP bridge ${L.status}`);e||i(D),u.error(D)}return;case"acp-bridge-message":u.enqueue(L.message);return}},y=()=>{var x;if(p)return;p=!0;const A=new Error("ACP bridge websocket closed");e||i(A),(x=n.onDisconnect)==null||x.call(n,A),u.close()},E=()=>{var x;if(p)return;p=!0;const A=new Error("ACP bridge websocket error");e||i(A),(x=n.onDisconnect)==null||x.call(n,A),u.error(A)};t.addEventListener("open",g),t.addEventListener("message",v),t.addEventListener("close",y),t.addEventListener("error",E)}}),l=new WritableStream({async write(u){await s,t.send(JSON.stringify({type:"acp-bridge-message",message:u}))},close(){t.close()},abort(){t.close()}}),c=await s;return{stream:{readable:a,writable:l},socket:t,metadata:c}}function l5(n){const{agent:t,sessionIdStrategy:e,sessionCwd:r}=n;if((t==="openclaw"||t==="hermes")&&(e==="deterministic"||e==="mapped")&&typeof r=="string"&&r.length>0)return{agent:t,sessionIdStrategy:e,sessionCwd:r};throw new Error("ACP bridge ready status missing bootstrap metadata")}function c5(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 t=n.data;if(typeof t=="string")return t;if(t instanceof Uint8Array)return new TextDecoder().decode(t);if(Array.isArray(t))return Buffer.concat(t).toString("utf8")}return null}function u5(n,t){const e=new URL(n);return e.protocol=e.protocol==="https:"?"wss:":"ws:",e.pathname="/acp",e.search="",e.searchParams.set("token",t),e.hash="",e.toString()}function fp(n){return n instanceof Error?n.message:String(n)}const t1="television.acpClientGUID",n1="television.acpMappedSessions",r1=1;var bo;class h5{constructor(){m(this,bo,new Map)}getActualSessionId(t){return o(this,bo).get(t)??null}setActualSessionId(t,e){o(this,bo).set(t,e)}clearActualSessionId(t){o(this,bo).delete(t)}}bo=new WeakMap;var So,xl,yt,Tu,Ru,sf;class d5{constructor(t,e){m(this,yt);m(this,So);m(this,xl);d(this,So,t),d(this,xl,e)}getActualSessionId(t){const e=h(this,yt,Ru).call(this)[h(this,yt,Tu).call(this,t)];return typeof e=="string"&&e.length>0?e:null}setActualSessionId(t,e){const r=h(this,yt,Ru).call(this);r[h(this,yt,Tu).call(this,t)]=e,h(this,yt,sf).call(this,r)}clearActualSessionId(t){const e=h(this,yt,Ru).call(this);delete e[h(this,yt,Tu).call(this,t)],h(this,yt,sf).call(this,e)}}So=new WeakMap,xl=new WeakMap,yt=new WeakSet,Tu=function(t){return JSON.stringify([o(this,xl),t])},Ru=function(){const t=o(this,So).getItem(n1);if(!t)return{};let e;try{e=JSON.parse(t)}catch{return{}}if(typeof e!="object"||e===null||Array.isArray(e))return{};const r=e;return r.version!==r1?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},sf=function(t){const e={version:r1,entries:t};o(this,So).setItem(n1,JSON.stringify(e))};function n2(){return typeof window>"u"?null:window.localStorage}function p5(n){const t=n.getItem(t1);if(t)return t;const e=Wm().toLowerCase();return n.setItem(t1,e),e}const i1=4401,f5=401,ru=1e3,m5=3e4;class Iu extends Error{constructor(t="Authentication required"){super(t),this.name="AuthError"}}class g5 extends mi{constructor(e){var a,l;super();C(this,"url");C(this,"name");C(this,"telemetryMeta");C(this,"status","unauthorized");C(this,"channels",new Map);C(this,"client");C(this,"acpClient");C(this,"_token");C(this,"attempting",!1);C(this,"nextRetryAt",null);C(this,"hasEverConnected",!1);C(this,"hasAuthRejected",!1);C(this,"hasAuthTokenRejected",!1);C(this,"bootState","pending");C(this,"serverVersion",null);C(this,"updateState",null);C(this,"decideBoot");C(this,"navigationPending");C(this,"createSocket");C(this,"createClient");C(this,"socket",null);C(this,"connectAttempt",0);C(this,"autoReconnect",!1);C(this,"retryTimer",null);C(this,"retryDelay",ru);C(this,"visibilityEventTarget");C(this,"networkEventTarget");C(this,"onVisibilityChange");C(this,"onNetworkOnline");C(this,"telemetryActivityAgent");this.url=ci(e.url),this.name=e.name,this.decideBoot=e.decideBoot??null,this.navigationPending=e.navigationPending??(()=>!1),this._token=e.token??null,this.telemetryMeta=e.telemetryMeta??null,this.createSocket=e.createSocket??(c=>new WebSocket(c)),this.createClient=e.createClient??((c,u,p)=>new UC(c,{token:u??void 0,onUnauthorized:()=>this.handleAuthRejected(),...p?{telemetryMeta:p}:{}})),this.client=this.createClient(this.url,this._token,this.telemetryMeta);const r=e.mappedSessionStore??(e.acpStorage?new d5(e.acpStorage,this.url):new h5);this.acpClient=new n5({serverURL:this.url,token:this._token??"",...e.createACPSocket?{createSocket:e.createACPSocket}:e.createSocket?{createSocket:e.createSocket}:{},...e.clientGUID?{clientGUID:e.clientGUID}:{},mappedSessionStore:r}),this.visibilityEventTarget=e.visibilityEventTarget!==void 0?e.visibilityEventTarget:typeof document<"u"?document:null,this.networkEventTarget=e.networkEventTarget!==void 0?e.networkEventTarget:typeof window<"u"?window:null,this.onVisibilityChange=()=>{this.isPageVisible()&&this.kickReconnect()},this.onNetworkOnline=()=>{this.kickReconnect()},(a=this.visibilityEventTarget)==null||a.addEventListener("visibilitychange",this.onVisibilityChange),(l=this.networkEventTarget)==null||l.addEventListener("online",this.onNetworkOnline);const i=e.telemetryDocumentTarget!==void 0?e.telemetryDocumentTarget:typeof document<"u"?document:null,s=e.telemetryWindowTarget!==void 0?e.telemetryWindowTarget:typeof window<"u"?window:null;this.telemetryActivityAgent=this.telemetryMeta&&i&&s?kx({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(e){this._token=e,this.hasAuthRejected=!1,this.hasAuthTokenRejected=!1,this.acpClient.setToken(e),this.cancelRetryTimer(),this.retryDelay=ru,this.autoReconnect=!0,await this.attempt()}dispose(){var e,r,i,s;this.autoReconnect=!1,this.connectAttempt+=1,this.cancelRetryTimer(),(e=this.socket)==null||e.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(e){const r=Yp(e,{electron:mr()});return mr()?new URL(r.viewURL,this.url).toString():r.renderer==="proxy-iframe"?new URL(r.viewURL,this.url).toString():r.viewURL}getContentURL(e){const r=Yp(e,{electron:mr()}).contentURL;return r===null?null:new URL(r,this.url).toString()}async createChannel(e){const{channel:r}=await this.client.channels.create({name:e});return this.channels.set(r.id,structuredClone(r)),r}applyServerEvent(e){switch(e.type){case"channel-created":this.channels.set(e.channel.id,structuredClone(e.channel)),this.dispatchEvent(new Za("channels-changed"));break;case"channel-updated":this.channels.set(e.channel.id,structuredClone(e.channel)),this.dispatchEvent(new Za("channels-changed"));break;case"channel-removed":this.channels.delete(e.channelID),this.dispatchEvent(new Za("channels-changed"));break;case"artifact-created":{const r=this.channels.get(e.channelID);r&&!_C(r).includes(e.artifact.id)&&(r.layout=[...r.layout,{artifactIds:[e.artifact.id],geometry:{...sw},size:{...ow}}]);break}case"artifact-removed":{const r=this.channels.get(e.channelID);r&&(r.layout=zp(r.layout,e.artifactID));break}case"artifact-updated":case"artifact-content-changed":case"channel-changed":case"pinned-channels-changed":case"theme-changed":case"appearance-changed":case"artifact-focus":break;default:return v5(e,"server event")}}async attempt(){var i;this.attempting=!0,this.nextRetryAt=null,this.connectAttempt+=1,this.bootState="pending";const e=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this._token,this.telemetryMeta),this.setStatus("disconnected"),this.dispatchEvent(new Lt("change"));const r=this.createSocket(y5(this.url,this._token,this.telemetryMeta));return this.socket=r,await new Promise((s,a)=>{let l=!1;const c=()=>{var g;l||this.connectAttempt!==e||(l=!0,this.retryDelay=ru,this.hasEverConnected=!0,this.setStatus("connected"),(g=this.telemetryActivityAgent)==null||g.start(),s())},u=g=>{l||this.connectAttempt!==e||(l=!0,a(g))},p=async()=>{const g=this.hasEverConnected;try{const[{channels:v},y]=await Promise.all([this.client.channels.list(),this.client.display.get()]);this.channels=new Map(v.map(E=>[E.id,structuredClone(E)])),this.acpClient.setEnabled(y.acpEnabled),this.dispatchEvent(new Lt("change")),g&&this.dispatchEvent(new Za("channels-changed")),this.dispatchEvent(new _u("server-event",{serverURL:this.url,event:{type:"channel-changed",channelID:y.focusedChannelId}})),this.dispatchEvent(new _u("server-event",{serverURL:this.url,event:{type:"pinned-channels-changed",pinnedChannelIds:[...y.pinnedChannelIds]}})),c(),g&&this.connectAttempt===e&&this.dispatchEvent(new vw("server-reconnected",{serverURL:this.url}))}catch(v){if(E5(v)){u(new Iu);return}u(v instanceof Error?v:new Error(String(v)))}};r.addEventListener("open",()=>{this.decideBoot===null&&(this.bootState="booted",this.navigationPending()||p())}),r.addEventListener("message",g=>{const v=A5(g);if(!v)return;if(v.type==="server-status"){const E=v;this.serverVersion=E.version,this.updateState=E.update??null;let A=!1;this.decideBoot!==null&&this.bootState==="pending"&&this.connectAttempt===e&&(this.decideBoot(E)==="boot"?(this.bootState="booted",A=!0):(this.bootState="halted",this.attempting=!1)),this.dispatchEvent(new yw("server-status",{serverURL:this.url,message:E})),A?this.navigationPending()||p():this.bootState==="halted"&&!this.navigationPending()&&this.dispatchEvent(new Lt("change"));return}if(!_5(v.type))return;const y=v;this.applyServerEvent(y),this.dispatchEvent(new _u("server-event",{serverURL:this.url,event:y}))}),r.addEventListener("close",g=>{if(this.connectAttempt!==e)return;this.socket=null;const v=w5(g);if(!l){u(v===i1?new Iu:new Error("Connection closed before initialization"));return}if(v===i1){this.handleAuthRejected();return}this.handleTransportFailure(new Error("Connection closed"))}),r.addEventListener("error",()=>{if(this.connectAttempt===e){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(e){if(e instanceof Iu){this.handleAuthRejected();return}this.autoReconnect&&this.scheduleRetry()}handleTransportFailure(e){this.autoReconnect&&(this.setStatus("disconnected"),this.scheduleRetry())}scheduleRetry(){this.cancelRetryTimer(),this.connectAttempt+=1;const e=this.retryDelay;this.retryDelay=Math.min(this.retryDelay*2,m5),this.nextRetryAt=Date.now()+e,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.attempt().catch(()=>{})},e),this.dispatchEvent(new Lt("change"))}cancelRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.nextRetryAt!==null&&(this.nextRetryAt=null,this.dispatchEvent(new Lt("change")))}kickReconnect(){this.autoReconnect&&this.status!=="connected"&&(this.attempting||(this.cancelRetryTimer(),this.retryDelay=ru,this.attempt().catch(()=>{})))}sendTelemetryActivity(e){var r;this.status==="connected"&&((r=this.socket)==null||r.send(JSON.stringify(e)))}sendTelemetrySignal(e,r){var s;if(!this.telemetryMeta||this.status!=="connected"&&this.bootState!=="halted")return;const i={type:SC,clientId:this.telemetryMeta.clientId,event:e,properties:r};(s=this.socket)==null||s.send(JSON.stringify(i))}setStatus(e){this.status!==e&&(this.status=e,this.dispatchEvent(new Lt("change")))}isPageVisible(){return this.visibilityEventTarget===null?!0:this.visibilityEventTarget.visibilityState==="visible"}}function v5(n,t){throw new Error(`Unexpected ${t}: ${JSON.stringify(n)}`)}function y5(n,t,e=null){const r=new URL(n);if(r.protocol=r.protocol==="https:"?"wss:":"ws:",r.pathname="/events",r.search="",t&&r.searchParams.set("token",t),e)for(const[i,s]of Ex(e))r.searchParams.set(i,s);return r.hash="",r.toString()}function w5(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}const b5={"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,"appearance-changed":!0,"artifact-focus":!0},S5=new Set(Object.keys(b5));function _5(n){return S5.has(n)}function A5(n){const t=typeof n=="string"?n:typeof n=="object"&&n!==null&&"data"in n&&typeof n.data=="string"?n.data:"";if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}return typeof e!="object"||e===null||!("type"in e)||typeof e.type!="string"?null:e}function E5(n){return n instanceof ga&&n.status===f5}const k5="Local";var kt,qt,On,of,af,r2,Pl,Ll,Dl,Ol,Ml;class C5 extends mi{constructor(e){super();m(this,On);C(this,"connection");C(this,"clientGUID");C(this,"acpStorage");C(this,"connectError",null);m(this,kt);m(this,qt,!1);m(this,Pl,()=>{o(this,qt)||(h(this,On,r2).call(this),this.dispatchEvent(new Lt("change")))});m(this,Ll,e=>{o(this,qt)||this.dispatchEvent(new _u("server-event",{serverURL:e.serverURL,event:e.event}))});m(this,Dl,()=>{o(this,qt)||this.dispatchEvent(new Za("channels-changed"))});m(this,Ol,e=>{o(this,qt)||this.dispatchEvent(new vw("server-reconnected",{serverURL:e.serverURL}))});m(this,Ml,e=>{o(this,qt)||this.dispatchEvent(new yw("server-status",{serverURL:e.serverURL,message:e.message}))});d(this,kt,e.localStore),this.acpStorage=e.acpStorage===void 0?n2():e.acpStorage,this.clientGUID=e.clientGUID??(this.acpStorage?p5(this.acpStorage):Wm().toLowerCase());const r=ci(e.serverURL);e.launchToken!==void 0&&e.launchToken!==null&&o(this,kt).set(kv(o(this,kt).get(),r,e.launchToken));const i=e.launchToken??Ev(o(this,kt).get(),r),s=e.createSocket??(l=>new WebSocket(l)),a=e.createConnection??(l=>new g5(l));this.connection=a({url:r,name:e.connectionName??k5,token:i,createSocket:s,clientGUID:this.clientGUID,acpStorage:this.acpStorage,telemetryMeta:e.telemetryMeta??null,decideBoot:e.decideBoot,navigationPending:e.navigationPending}),this.connection.addEventListener("change",o(this,Pl)),this.connection.addEventListener("server-event",o(this,Ll)),this.connection.addEventListener("channels-changed",o(this,Dl)),this.connection.addEventListener("server-reconnected",o(this,Ol)),this.connection.addEventListener("server-status",o(this,Ml))}get storedAuthToken(){return Ev(o(this,kt).get(),this.connection.url)}async connect(){await h(this,On,of).call(this,this.connection.token)}async authenticate(e){o(this,kt).set(kv(o(this,kt).get(),this.connection.url,e)),await h(this,On,of).call(this,e)}dispose(){o(this,qt)||(d(this,qt,!0),this.connection.removeEventListener("change",o(this,Pl)),this.connection.removeEventListener("server-event",o(this,Ll)),this.connection.removeEventListener("channels-changed",o(this,Dl)),this.connection.removeEventListener("server-reconnected",o(this,Ol)),this.connection.removeEventListener("server-status",o(this,Ml)),this.connection.dispose())}}kt=new WeakMap,qt=new WeakMap,On=new WeakSet,of=async function(e){if(!o(this,qt)){h(this,On,af).call(this,null);try{await this.connection.connect(e)}catch(r){h(this,On,af).call(this,r instanceof Iu?null:r instanceof Error?r.message:String(r))}}},af=function(e){this.connectError!==e&&(this.connectError=e,this.dispatchEvent(new Lt("change")))},r2=function(){if(this.connection.status!=="unauthorized"||!this.connection.hasAuthRejected)return;const e=o(this,kt).get(),r=g$(e,this.connection.url);r!==e&&o(this,kt).set(r),this.connection.token!==null&&this.connection.clearToken()},Pl=new WeakMap,Ll=new WeakMap,Dl=new WeakMap,Ol=new WeakMap,Ml=new WeakMap;const lf="tv-nav:",oa="tv-reload",s1=100,$5=1e3,T5=60,R5=60,I5=24,x5=30,P5=x5*I5*R5*T5*$5;function gr(n){try{const t=new URL(n,window.location.href),e=t.searchParams.has(oa);return t.searchParams.delete(oa),t.origin===window.location.origin?`${t.pathname}${t.search}${t.hash}`:e?t.toString():n}catch{return n}}var Nl,_o,pe,de,zi,$e,i2,Ar,s2,cf,uf;class L5 extends mi{constructor(e,r){super();m(this,$e);m(this,Nl);m(this,_o);m(this,pe,[]);m(this,de,-1);m(this,zi,0);d(this,Nl,e),d(this,_o,gr(r)),h(this,$e,i2).call(this)}get currentURL(){var e;return o(this,de)===-1?null:((e=o(this,pe)[o(this,de)])==null?void 0:e.url)??null}get canGoBack(){return o(this,de)>-1}get canGoForward(){return o(this,de)<o(this,pe).length-1}get entries(){return o(this,pe).map(e=>({...e}))}get cursor(){return o(this,de)}navigate(e){const r=gr(e);if(r===o(this,_o)){if(o(this,de)===-1)return;d(this,de,-1),h(this,$e,Ar).call(this);return}o(this,de)<o(this,pe).length-1&&d(this,pe,o(this,pe).slice(0,o(this,de)+1)),o(this,pe).push({url:r}),d(this,de,o(this,pe).length-1),h(this,$e,cf).call(this),h(this,$e,Ar).call(this)}replace(e){var i;if(o(this,de)===-1){this.navigate(e);return}const r=gr(e);if(r===o(this,_o)){d(this,pe,o(this,pe).filter((s,a)=>a!==o(this,de))),d(this,de,-1),h(this,$e,Ar).call(this);return}((i=o(this,pe)[o(this,de)])==null?void 0:i.url)!==r&&(d(this,pe,o(this,pe).map((s,a)=>a===o(this,de)?{url:r}:s)),h(this,$e,Ar).call(this))}back(){o(this,de)!==-1&&(d(this,de,o(this,de)-1),h(this,$e,Ar).call(this))}forward(){this.canGoForward&&(d(this,de,o(this,de)+1),h(this,$e,Ar).call(this))}reset(){o(this,de)===-1&&o(this,pe).length===0||(d(this,pe,[]),d(this,de,-1),h(this,$e,Ar).call(this))}}Nl=new WeakMap,_o=new WeakMap,pe=new WeakMap,de=new WeakMap,zi=new WeakMap,$e=new WeakSet,i2=function(){const e=localStorage.getItem(o(this,$e,uf));if(e!==null)try{const r=JSON.parse(e);if(!o2(r))return;d(this,pe,r.entries.map(i=>({url:i.url}))),d(this,de,r.cursor),d(this,zi,r.lastWritten),h(this,$e,cf).call(this)}catch{d(this,pe,[]),d(this,de,-1),d(this,zi,0)}},Ar=function(){d(this,zi,Date.now());try{localStorage.setItem(o(this,$e,uf),JSON.stringify(h(this,$e,s2).call(this)))}catch(e){if(!M5(e))throw e}this.dispatchEvent(new Lt("change"))},s2=function(){return{v:1,entries:o(this,pe).map(e=>({...e})),cursor:o(this,de),lastWritten:o(this,zi)}},cf=function(){if(o(this,pe).length<=s1)return;const e=o(this,pe).length-s1;d(this,pe,o(this,pe).slice(e)),d(this,de,Math.max(-1,o(this,de)-e))},uf=function(){return D5(o(this,Nl))};function D5(n){return`${lf}${n}`}function O5(n){const t=Date.now()-P5,e=[];for(let r=0;r<localStorage.length;r+=1){const i=localStorage.key(r);if(!(i!=null&&i.startsWith(lf)))continue;const s=i.slice(lf.length),a=localStorage.getItem(i);if(a===null)continue;let l;try{l=JSON.parse(a)}catch{e.push(i);continue}if(!o2(l)){e.push(i);continue}!n.has(s)&&l.lastWritten<t&&e.push(i)}for(const r of e)localStorage.removeItem(r)}function M5(n){return n instanceof DOMException&&n.name==="QuotaExceededError"}function o2(n){if(typeof n!="object"||n===null)return!1;const t=n;if(t.v!==1||!Array.isArray(t.entries))return!1;const e=t.cursor;return typeof e!="number"||!Number.isInteger(e)||typeof t.lastWritten!="number"||!Number.isFinite(t.lastWritten)||e<-1||e>=t.entries.length?!1:t.entries.every(r=>typeof r=="object"&&r!==null&&typeof r.url=="string")}const mp="tv-channel-sidebar-width",hf=160,df=350,gp=260,N5=/^-?\d+$/;var Ui;class z5{constructor(t){m(this,Ui);d(this,Ui,t)}read(){const t=o(this,Ui).getItem(mp);if(t===null||!N5.test(t))return null;const e=BigInt(t);return e<BigInt(hf)?hf:e>BigInt(df)?df:Number(e)}commit(t){const e=a2(Math.round(t));try{o(this,Ui).setItem(mp,String(e))}catch{}return e}clear(){try{o(this,Ui).removeItem(mp)}catch{}}}Ui=new WeakMap;function a2(n){return Math.min(Math.max(n,hf),df)}const U5="1.3.5";function tg(n=U5){return n!==void 0&&n.length>0?n:"0.0.0"}function ng(){let n=!1;return{get pending(){return n},begin(t){n||(n=!0,t())}}}const pf="tv-reload-attempted";function F5(n){return n.originMatch?n.marker!==null&&n.bundleVersion===n.serverVersion?{action:"signal-autoreloaded",fromVersion:n.marker.fromVersion,toVersion:n.bundleVersion}:HC(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 Z5(n){const t=n.getItem(pf);if(t===null)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object")return null;const r=e;return typeof r.serverVersion!="string"||typeof r.fromVersion!="string"?null:{serverVersion:r.serverVersion,fromVersion:r.fromVersion}}function H5(n){const t=n.storage!==void 0?n.storage:typeof sessionStorage<"u"?sessionStorage:null,e=n.reload??(()=>location.reload()),r=n.navigationLatch??ng(),i=n.bundleVersion??tg();if(t===null)return{dispose(){}};let s=null;const a=()=>{if(s===null)return;const u=n.owner.connection;if(u.url!==n.primaryServerURL||u.status!=="connected")return;const p=s;s=null,u.sendTelemetrySignal("client_autoreloaded",{from_version:p.fromVersion,to_version:p.toVersion})},l=u=>{if(r.pending)return;const p=F5({bundleVersion:i,serverVersion:u.message.version,originMatch:u.serverURL===n.primaryServerURL,marker:Z5(t)});switch(p.action){case"reload":t.setItem(pf,JSON.stringify(p.marker)),r.begin(e);return;case"signal-autoreloaded":t.removeItem(pf),s={fromVersion:p.fromVersion,toVersion:p.toVersion},a();return;case"none":return}},c=()=>{a()};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 V5(n){const t=mr(n.search),e=ib(n.search),r=e!==null&&od(e)?e:null;return{electron:t,shellVersion:r}}function B5(n){return!n.electron||n.requiredDesktopVersion===null||!od(n.requiredDesktopVersion)?!1:n.shellVersion===null?!0:n.shellVersion===rh?!1:Bm(n.requiredDesktopVersion,n.shellVersion)}const W5=`# 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 l2(n){return n===null?W5:n.upgradeMarkdown}function q5(n){const t=B5(n);return{gated:t,instructionsMarkdown:t?l2(n.desktop):null,suppressUpdateToast:t}}function j5(n){const t=n.reload??(()=>location.reload()),e=n.navigationLatch??ng();let r=null,i=!1;const s=new Set,a=p=>{var g;return q5({electron:n.detection.electron,shellVersion:n.detection.shellVersion,requiredDesktopVersion:p.requiredDesktopVersion,desktop:((g=p.update)==null?void 0:g.desktop)??null})};function l(){var p;(p=n.presentation)==null||p.suppressToasts()}function c(p){const g=p.requiredDesktopVersion;if(g===null||s.has(g))return;s.add(g);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:g})}const u=p=>{e.pending||p.serverURL===n.primaryServerURL&&(a(p.message).gated?(i=!0,l(),c(p.message)):i&&e.begin(t))};return{get gated(){return i},decideBoot(p){return a(p).gated?"halt":"boot"},attach(p){r=p,p.addEventListener("server-status",u)},dispose(){r==null||r.removeEventListener("server-status",u),r=null}}}var Ao;class G5 extends mi{constructor(){super(...arguments);m(this,Ao,!1)}get toastsSuppressed(){return o(this,Ao)}suppressToasts(){o(this,Ao)||(d(this,Ao,!0),this.dispatchEvent(new Lt("change")))}}Ao=new WeakMap;function Y5(n,t=window){const e=t.__televisionAppearanceResolver;if(e!==void 0)return e;const r=t.matchMedia("(prefers-color-scheme: dark)");let i=n;const s=c=>c==="system"||c==="light"||c==="dark",a=()=>{const c=i==="system"?r.matches?"dark":"light":i;t.document.documentElement.dataset.theme=c},l={setPreference(c){s(c)&&(i=c,a())}};return t.__televisionAppearanceResolver=l,r.addEventListener("change",()=>{i==="system"&&a()}),a(),l}function c2(n){return typeof n=="object"&&n!==null}function u2(n){return!c2(n)||n.type!=="ready"?!1:!("id"in n)}function h2(n){return!(!c2(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}const d2=Ut(),p2="No handler registered for update-content",f2="handleUpdateContent: handler already registered",o1="television-artifact-bridge";function m2(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const g2=Fb(mi);var Eo,ko,Co,Fi,Zi,$o,xe,ff,v2,y2,Ys,xu,sy;let J5=(sy=class extends g2{constructor(e){super();m(this,xe);m(this,Eo);m(this,ko);m(this,Co);m(this,Fi,null);m(this,Zi,null);m(this,$o,!1);d(this,Eo,e);const r=e.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");d(this,ko,r),d(this,Co,i=>h(this,xe,v2).call(this,i)),o(this,ko).addEventListener("message",o(this,Co))}get content(){return o(this,Zi)}set content(e){h(this,xe,xu).call(this),d(this,Zi,e),o(this,$o)&&h(this,xe,ff).call(this,e)}handleUpdateContent(e){if(h(this,xe,xu).call(this),o(this,Fi)!==null)throw new Error(f2);d(this,Fi,e)}notifyStylesChanged(){if(h(this,xe,xu).call(this),!o(this,$o))return;const e={type:"styles-changed"};h(this,xe,Ys).call(this,e)}dispose(){o(this,ko).removeEventListener("message",o(this,Co)),d(this,Fi,null)}},Eo=new WeakMap,ko=new WeakMap,Co=new WeakMap,Fi=new WeakMap,Zi=new WeakMap,$o=new WeakMap,xe=new WeakSet,ff=function(e){const r={type:"content-updated",content:e};h(this,xe,Ys).call(this,r)},v2=function(e){if(this.disposed||e.source!==o(this,Eo).contentWindow)return;const r=e.data;if(u2(r)){d(this,$o,!0),this.dispatchEvent(new d2("ready")),o(this,Zi)!==null&&h(this,xe,ff).call(this,o(this,Zi));return}if(h2(r)){h(this,xe,y2).call(this,r);return}},y2=async function(e){const r=o(this,Fi);if(r===null){h(this,xe,Ys).call(this,{type:"response",id:e.id,error:{message:p2}});return}try{await r(e.content)}catch(i){if(this.disposed)return;h(this,xe,Ys).call(this,{type:"response",id:e.id,error:{message:m2(i)}});return}this.disposed||h(this,xe,Ys).call(this,{type:"response",id:e.id,result:{}})},Ys=function(e){const r=o(this,Eo).contentWindow;r&&r.postMessage(e,"*")},xu=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},sy);var Hi,To,Vi,Bi,Ro,Pe,mf,w2,b2,Js,Pu;class K5 extends g2{constructor(e){super();m(this,Pe);m(this,Hi);m(this,To);m(this,Vi,null);m(this,Bi,null);m(this,Ro,!1);d(this,Hi,e),d(this,To,r=>h(this,Pe,w2).call(this,r)),o(this,Hi).addEventListener("ipc-message",o(this,To))}get content(){return o(this,Bi)}set content(e){h(this,Pe,Pu).call(this),d(this,Bi,e),o(this,Ro)&&h(this,Pe,mf).call(this,e)}handleUpdateContent(e){if(h(this,Pe,Pu).call(this),o(this,Vi)!==null)throw new Error(f2);d(this,Vi,e)}notifyStylesChanged(){if(h(this,Pe,Pu).call(this),!o(this,Ro))return;const e={type:"styles-changed"};h(this,Pe,Js).call(this,e)}dispose(){o(this,Hi).removeEventListener("ipc-message",o(this,To)),d(this,Vi,null)}}Hi=new WeakMap,To=new WeakMap,Vi=new WeakMap,Bi=new WeakMap,Ro=new WeakMap,Pe=new WeakSet,mf=function(e){const r={type:"content-updated",content:e};h(this,Pe,Js).call(this,r)},w2=function(e){var s;if(this.disposed)return;const r=e.detail??e;if(!r||r.channel!==o1)return;const i=(s=r.args)==null?void 0:s[0];if(u2(i)){d(this,Ro,!0),this.dispatchEvent(new d2("ready")),o(this,Bi)!==null&&h(this,Pe,mf).call(this,o(this,Bi));return}if(h2(i)){h(this,Pe,b2).call(this,i);return}},b2=async function(e){const r=o(this,Vi);if(r===null){h(this,Pe,Js).call(this,{type:"response",id:e.id,error:{message:p2}});return}try{await r(e.content)}catch(i){if(this.disposed)return;h(this,Pe,Js).call(this,{type:"response",id:e.id,error:{message:m2(i)}});return}this.disposed||h(this,Pe,Js).call(this,{type:"response",id:e.id,result:{}})},Js=function(e){var r,i;(i=(r=o(this,Hi)).send)==null||i.call(r,o1,e)},Pu=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 ll=globalThis,a1=n=>n,ch=ll.trustedTypes,l1=ch?ch.createPolicy("lit-html",{createHTML:n=>n}):void 0,S2="$lit$",$r=`lit$${Math.random().toFixed(9).slice(2)}$`,_2="?"+$r,X5=`<${_2}>`,Es=document,ml=()=>Es.createComment(""),gl=n=>n===null||typeof n!="object"&&typeof n!="function",rg=Array.isArray,Q5=n=>rg(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",vp=`[
61
+ \f\r]`,Ta=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,c1=/-->/g,u1=/>/g,bi=RegExp(`>|${vp}(?:([^\\s"'>=/]+)(${vp}*=${vp}*(?:[^
62
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),h1=/'/g,d1=/"/g,A2=/^(?:script|style|textarea|title)$/i,eO=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),B=eO(1),Ke=Symbol.for("lit-noChange"),ie=Symbol.for("lit-nothing"),p1=new WeakMap,Ti=Es.createTreeWalker(Es,129);function E2(n,t){if(!rg(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return l1!==void 0?l1.createHTML(t):t}const tO=(n,t)=>{const e=n.length-1,r=[];let i,s=t===2?"<svg>":t===3?"<math>":"",a=Ta;for(let l=0;l<e;l++){const c=n[l];let u,p,g=-1,v=0;for(;v<c.length&&(a.lastIndex=v,p=a.exec(c),p!==null);)v=a.lastIndex,a===Ta?p[1]==="!--"?a=c1:p[1]!==void 0?a=u1:p[2]!==void 0?(A2.test(p[2])&&(i=RegExp("</"+p[2],"g")),a=bi):p[3]!==void 0&&(a=bi):a===bi?p[0]===">"?(a=i??Ta,g=-1):p[1]===void 0?g=-2:(g=a.lastIndex-p[2].length,u=p[1],a=p[3]===void 0?bi:p[3]==='"'?d1:h1):a===d1||a===h1?a=bi:a===c1||a===u1?a=Ta:(a=bi,i=void 0);const y=a===bi&&n[l+1].startsWith("/>")?" ":"";s+=a===Ta?c+X5:g>=0?(r.push(u),c.slice(0,g)+S2+c.slice(g)+$r+y):c+$r+(g===-2?l:y)}return[E2(n,s+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};class vl{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let s=0,a=0;const l=t.length-1,c=this.parts,[u,p]=tO(t,e);if(this.el=vl.createElement(u,r),Ti.currentNode=this.el.content,e===2||e===3){const g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(i=Ti.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const g of i.getAttributeNames())if(g.endsWith(S2)){const v=p[a++],y=i.getAttribute(g).split($r),E=/([.?@])?(.*)/.exec(v);c.push({type:1,index:s,name:E[2],strings:y,ctor:E[1]==="."?rO:E[1]==="?"?iO:E[1]==="@"?sO:vd}),i.removeAttribute(g)}else g.startsWith($r)&&(c.push({type:6,index:s}),i.removeAttribute(g));if(A2.test(i.tagName)){const g=i.textContent.split($r),v=g.length-1;if(v>0){i.textContent=ch?ch.emptyScript:"";for(let y=0;y<v;y++)i.append(g[y],ml()),Ti.nextNode(),c.push({type:2,index:++s});i.append(g[v],ml())}}}else if(i.nodeType===8)if(i.data===_2)c.push({type:2,index:s});else{let g=-1;for(;(g=i.data.indexOf($r,g+1))!==-1;)c.push({type:7,index:s}),g+=$r.length-1}s++}}static createElement(t,e){const r=Es.createElement("template");return r.innerHTML=t,r}}function aa(n,t,e=n,r){var a,l;if(t===Ke)return t;let i=r!==void 0?(a=e._$Co)==null?void 0:a[r]:e._$Cl;const s=gl(t)?void 0:t._$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,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=i:e._$Cl=i),i!==void 0&&(t=aa(n,i._$AS(n,t.values),i,r)),t}class nO{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:r}=this._$AD,i=((t==null?void 0:t.creationScope)??Es).importNode(e,!0);Ti.currentNode=i;let s=Ti.nextNode(),a=0,l=0,c=r[0];for(;c!==void 0;){if(a===c.index){let u;c.type===2?u=new gd(s,s.nextSibling,this,t):c.type===1?u=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(u=new oO(s,this,t)),this._$AV.push(u),c=r[++l]}a!==(c==null?void 0:c.index)&&(s=Ti.nextNode(),a++)}return Ti.currentNode=Es,i}p(t){let e=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}let gd=class k2{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=ie,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=aa(this,t,e),gl(t)?t===ie||t==null||t===""?(this._$AH!==ie&&this._$AR(),this._$AH=ie):t!==this._$AH&&t!==Ke&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Q5(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==ie&&gl(this._$AH)?this._$AA.nextSibling.data=t:this.T(Es.createTextNode(t)),this._$AH=t}$(t){var s;const{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=vl.createElement(E2(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(e);else{const a=new nO(i,this),l=a.u(this.options);a.p(e),this.T(l),this._$AH=a}}_$AC(t){let e=p1.get(t.strings);return e===void 0&&p1.set(t.strings,e=new vl(t)),e}k(t){rg(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,i=0;for(const s of t)i===e.length?e.push(r=new k2(this.O(ml()),this.O(ml()),this,this.options)):r=e[i],r._$AI(s),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t!==this._$AB;){const i=a1(t).nextSibling;a1(t).remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},vd=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,s){this.type=1,this._$AH=ie,this._$AN=void 0,this.element=t,this.name=e,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=ie}_$AI(t,e=this,r,i){const s=this.strings;let a=!1;if(s===void 0)t=aa(this,t,e,0),a=!gl(t)||t!==this._$AH&&t!==Ke,a&&(this._$AH=t);else{const l=t;let c,u;for(t=s[0],c=0;c<s.length-1;c++)u=aa(this,l[r+c],e,c),u===Ke&&(u=this._$AH[c]),a||(a=!gl(u)||u!==this._$AH[c]),u===ie?t=ie:t!==ie&&(t+=(u??"")+s[c+1]),this._$AH[c]=u}a&&!i&&this.j(t)}j(t){t===ie?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},rO=class extends vd{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===ie?void 0:t}},iO=class extends vd{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==ie)}},sO=class extends vd{constructor(t,e,r,i,s){super(t,e,r,i,s),this.type=5}_$AI(t,e=this){if((t=aa(this,t,e,0)??ie)===Ke)return;const r=this._$AH,i=t===ie&&r!==ie||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==ie&&(r===ie||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}};class oO{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){aa(this,t)}}const aO={I:gd},yp=ll.litHtmlPolyfillSupport;yp==null||yp(vl,gd),(ll.litHtmlVersions??(ll.litHtmlVersions=[])).push("3.3.2");const Lu=(n,t,e)=>{const r=t;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new gd(t.insertBefore(ml(),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:lO}=aO,f1=n=>n,C2=n=>n.strings===void 0,m1=()=>document.createComment(""),Ra=(n,t,e)=>{var s;const r=n._$AA.parentNode,i=t===void 0?n._$AB:t._$AA;if(e===void 0){const a=r.insertBefore(m1(),i),l=r.insertBefore(m1(),i);e=new lO(a,l,n,n.options)}else{const a=e._$AB.nextSibling,l=e._$AM,c=l!==n;if(c){let u;(s=e._$AQ)==null||s.call(e,n),e._$AM=n,e._$AP!==void 0&&(u=n._$AU)!==l._$AU&&e._$AP(u)}if(a!==i||c){let u=e._$AA;for(;u!==a;){const p=f1(u).nextSibling;f1(r).insertBefore(u,i),u=p}}}return e},Si=(n,t,e=n)=>(n._$AI(t,e),n),cO={},$2=(n,t=cO)=>n._$AH=t,uO=n=>n._$AH,wp=n=>{n._$AR(),n._$AA.remove()};/**
67
+ * @license
68
+ * Copyright 2017 Google LLC
69
+ * SPDX-License-Identifier: BSD-3-Clause
70
+ */const Ln={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4},ba=n=>(...t)=>({_$litDirective$:n,values:t});let Lc=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};/**
71
+ * @license
72
+ * Copyright 2017 Google LLC
73
+ * SPDX-License-Identifier: BSD-3-Clause
74
+ */const cl=(n,t)=>{var r;const e=n._$AN;if(e===void 0)return!1;for(const i of e)(r=i._$AO)==null||r.call(i,t,!1),cl(i,t);return!0},uh=n=>{let t,e;do{if((t=n._$AM)===void 0)break;e=t._$AN,e.delete(n),n=t}while((e==null?void 0:e.size)===0)},T2=n=>{for(let t;t=n._$AM;n=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(n))break;e.add(n),pO(t)}};function hO(n){this._$AN!==void 0?(uh(this),this._$AM=n,T2(this)):this._$AM=n}function dO(n,t=!1,e=0){const r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let s=e;s<r.length;s++)cl(r[s],!1),uh(r[s]);else r!=null&&(cl(r,!1),uh(r));else cl(this,n)}const pO=n=>{n.type==Ln.CHILD&&(n._$AP??(n._$AP=dO),n._$AQ??(n._$AQ=hO))};class R2 extends Lc{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),T2(this),this.isConnected=t._$AU}_$AO(t,e=!0){var r,i;t!==this.isConnected&&(this.isConnected=t,t?(r=this.reconnected)==null||r.call(this):(i=this.disconnected)==null||i.call(this)),e&&(cl(this,t),uh(this))}setValue(t){if(C2(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}var zl,Ul,Or,Wi;class St extends R2{constructor(){super(...arguments);m(this,zl,[]);m(this,Ul,!1);m(this,Or,!1);m(this,Wi,!1)}connected(){}template(...e){return Ke}render(...e){return!this.isConnected||o(this,Or)||this.setValue(e.length?e[0]:this.template(...o(this,zl))),Ke}update(e,r){d(this,zl,r),d(this,Wi,!1),d(this,Or,!0);try{return o(this,Ul)||(d(this,Ul,!0),this.connected()),this.template(...r)}finally{d(this,Or,!1)}}reconnected(){d(this,Or,!0);try{this.connected()}finally{d(this,Or,!1)}d(this,Wi,!0),queueMicrotask(()=>{o(this,Wi)&&(d(this,Wi,!1),this.render())})}}zl=new WeakMap,Ul=new WeakMap,Or=new WeakMap,Wi=new WeakMap;function _t(n){return ba(n)}function fO(n,t){var r;const e=n.connection;return e.authorizationRequired?e.authorizationRejected?{kind:"unauthorized",invalid:!0}:{kind:"unauthorized"}:e.gateHalted?{kind:"needs-upgrade",instructions:e.upgradeInstructions}:e.status!=="connected"?e.hasEverConnected?{kind:"disconnected",nextRetryAt:e.nextRetryAt}:e.firstConnectError!==null?{kind:"error",serverURL:t,message:e.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 yd(n){return B`<div class="dialog-overlay"><dialog open><div class="dialog-content">${n}</div></dialog></div>`}function wd(n,t){let e=!1;const r=s=>{s.preventDefault(),t("escape")},i=s=>{if(s.target!==n)return;const a=n.getBoundingClientRect();s.clientX>=a.left&&s.clientX<=a.right&&s.clientY>=a.top&&s.clientY<=a.bottom||t("backdrop")};n.addEventListener("cancel",r),n.addEventListener("click",i);for(const s of n.ownerDocument.querySelectorAll("tv-popover[open], tv-menu[open], tv-select[open]"))s.removeAttribute("open");return n.removeAttribute("open"),n.showModal(),{withdraw(){e||(e=!0,n.removeEventListener("cancel",r),n.removeEventListener("click",i),n.open&&n.close())}}}const gf=new WeakMap;function Ks(n,t,e){e===null?n.hasAttribute(t)&&n.removeAttribute(t):n.getAttribute(t)!==e&&n.setAttribute(t,e)}var Fl,Io,Mr,Eh,kh,Ch;class mO{constructor(t){C(this,"document");C(this,"panels",new Set);m(this,Fl,new AbortController);m(this,Io);m(this,Mr,0);m(this,Eh,t=>{var s,a,l;if(!(t.target instanceof Element))return;const e=t.target,r=new Set([...this.panels].filter(c=>c.contains(e))),i=[...this.panels].find(c=>{var u;return(u=c.trigger)==null?void 0:u.contains(e)});for(const c of[...this.panels])c.open&&!c.manual&&c!==i&&!r.has(c)&&c.close();if(i&&!((s=i.trigger)!=null&&s.disabled))i.toggle(t.detail===0);else for(const c of[...this.panels])c.open&&c.host.contains(e)&&((l=(a=c.behavior).click)==null||l.call(a,e))});m(this,kh,t=>{var e,r;if(t.target instanceof Element)for(const i of this.panels)i.open&&i.host.contains(t.target)&&((r=(e=i.behavior).pointermove)==null||r.call(e,t.target))});m(this,Ch,t=>{var s,a,l,c;const e=[...this.panels].filter(u=>u.open).reverse(),r=e.find(u=>u.behavior.select),i=r??e.find(u=>u.behavior.keydown);if(!((a=i==null?void 0:(s=i.behavior).keydown)!=null&&a.call(s,t))){if(t.key==="Escape"){if(!r&&e.some(p=>p.manual&&t.composedPath().includes(p.host)))return;const u=r??e.find(p=>!p.manual);u&&!u.manual&&(t.preventDefault(),t.stopImmediatePropagation(),u.close());return}for(const u of this.panels)if(!u.open&&u.trigger===this.document.activeElement&&((c=(l=u.behavior).keydown)!=null&&c.call(l,t)))return}});this.document=t;const e={signal:o(this,Fl).signal};t.addEventListener("click",o(this,Eh),e),t.addEventListener("keydown",o(this,Ch),{...e,capture:!0}),t.addEventListener("pointermove",o(this,kh),e),d(this,Io,new MutationObserver(()=>{for(const r of[...this.panels])r.refresh()})),o(this,Io).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:["id","trigger","selected","value","aria-expanded","role","aria-haspopup","aria-controls","aria-activedescendant"]})}animate(){if(o(this,Mr))return;const t=()=>{d(this,Mr,0);for(const e of this.panels)e.open&&e.place();[...this.panels].some(e=>e.open)&&d(this,Mr,this.document.defaultView.requestAnimationFrame(t))};d(this,Mr,this.document.defaultView.requestAnimationFrame(t))}remove(t){this.panels.delete(t),!this.panels.size&&(o(this,Fl).abort(),o(this,Io).disconnect(),this.document.defaultView.cancelAnimationFrame(o(this,Mr)),gf.delete(this.document))}}Fl=new WeakMap,Io=new WeakMap,Mr=new WeakMap,Eh=new WeakMap,kh=new WeakMap,Ch=new WeakMap;var Ge,Nr,qi,ji,bt,vf,yf,I2,wf;class ig{constructor(t,e={}){m(this,bt);C(this,"host");C(this,"behavior");C(this,"trigger",null);m(this,Ge);m(this,Nr,!1);m(this,qi,!1);m(this,ji,new Map);this.host=t,this.behavior=e}get open(){return this.host.hasAttribute("open")&&o(this,Nr)}get manual(){return this.host.hasAttribute("manual")}connect(){if(o(this,Ge))return;const t=this.host.ownerDocument;d(this,Ge,gf.get(t)),o(this,Ge)||(d(this,Ge,new mO(t)),gf.set(t,o(this,Ge))),o(this,Ge).panels.add(this),this.refresh()}disconnect(){var t,e,r;h(this,bt,yf).call(this),d(this,Nr,!1),this.host.removeAttribute("open"),(e=(t=this.behavior).closed)==null||e.call(t),h(this,bt,wf).call(this),h(this,bt,vf).call(this),(r=o(this,Ge))==null||r.remove(this),d(this,Ge,void 0)}refresh(){var r,i,s,a,l,c,u;if(!o(this,Ge))return;const t=this.host.ownerDocument.getElementById(this.host.getAttribute("trigger")??""),e=t instanceof HTMLButtonElement?t:null;if(e!==this.trigger&&(h(this,bt,vf).call(this),this.trigger=e),this.trigger&&Ks(this.trigger,"aria-expanded",this.host.hasAttribute("open")?"true":"false"),(i=(r=this.behavior).refresh)==null||i.call(r),this.host.hasAttribute("open")&&!this.trigger){this.host.removeAttribute("open");return}if(this.host.hasAttribute("open")!==o(this,Nr))if(this.host.hasAttribute("open")){if(!this.manual&&!this.behavior.select)for(const p of o(this,Ge).panels)p!==this&&!p.manual&&!p.behavior.select&&p.close();d(this,Nr,!0),h(this,bt,I2).call(this),this.place(),(a=(s=this.behavior).opened)==null||a.call(s,o(this,qi)),d(this,qi,!1),o(this,Ge).animate()}else{const p=this.host.contains(this.host.ownerDocument.activeElement);h(this,bt,yf).call(this),d(this,Nr,!1),(c=(l=this.behavior).closed)==null||c.call(l),h(this,bt,wf).call(this),p&&((u=this.trigger)==null||u.focus({preventScroll:!0}))}}toggle(t=!1){d(this,qi,t),this.host.toggleAttribute("open")}show(t=!1){d(this,qi,t),this.host.setAttribute("open","")}close(){this.host.removeAttribute("open")}contains(t){var e;return this.host.contains(t)||!!((e=this.trigger)!=null&&e.contains(t))}place(){var J,re,At;if(!this.open||!this.trigger)return;const t=this.host,e=t.ownerDocument.defaultView,r=this.trigger.getBoundingClientRect();if(!this.trigger.isConnected){this.close();return}const i=Number.parseFloat(e.getComputedStyle(t).getPropertyValue("--popover-distance"));if(!Number.isFinite(i))return;const s=t.scrollTop,a=t.scrollLeft;t.style.maxWidth="none",t.style.maxHeight="none",t.style.minWidth=this.behavior.select?`${Math.min(r.width,e.innerWidth-2*i)}px`:((J=o(this,ji).get("min-width"))==null?void 0:J.value)??"";const l=t.getBoundingClientRect(),c=Math.max(0,e.innerWidth-i-r.left),u=Math.max(0,r.right-i),p=l.width>c&&u>c,g=Math.min(e.innerWidth-2*i,p?u:c),v=Number.parseFloat(e.getComputedStyle(t).minWidth)||0;t.style.minWidth=`${Math.max(0,Math.min(v,g))}px`,t.style.maxWidth=`${Math.max(0,g)}px`;const y=t.getBoundingClientRect(),E=y.width,A=y.height,x=Math.max(i,Math.min(p?r.right-E:r.left,e.innerWidth-i-E));let L,D;if(this.behavior.select){const Me=(At=(re=this.behavior).selectedRow)==null?void 0:At.call(re),he=Me?Me.getBoundingClientRect().top+Me.offsetHeight/2-y.top:0,Ne=r.top+r.height/2-he;if(Ne>=i&&Ne+A<=e.innerHeight-i)L=Ne,D=e.innerHeight-i-Ne;else{const tt=e.innerHeight-i-r.top,Zt=r.bottom-i,Is=A>tt&&Zt>tt;D=Is?Zt:tt,L=Is?r.bottom-Math.min(A,D):r.top}}else{const Me=Math.max(0,e.innerHeight-i-r.bottom-i),he=Math.max(0,r.top-2*i),Ne=A>Me&&he>Me;D=Ne?he:Me,L=Ne?r.top-i-Math.min(A,he):r.bottom+i}t.style.maxHeight=`${Math.max(0,D)}px`,t.style.left=`${x}px`,t.style.top=`${Math.max(i,Math.min(L,e.innerHeight-i-Math.min(A,D)))}px`;const V=e.getComputedStyle(t),F=V.boxSizing==="border-box",G=parseFloat(V.width)+(F?0:parseFloat(V.paddingLeft)+parseFloat(V.paddingRight)+parseFloat(V.borderLeftWidth)+parseFloat(V.borderRightWidth)),z=parseFloat(V.height)+(F?0:parseFloat(V.paddingTop)+parseFloat(V.paddingBottom)+parseFloat(V.borderTopWidth)+parseFloat(V.borderBottomWidth));t.style.setProperty("--_panel-edge-inset",`${t.style.top} auto auto ${t.style.left}`),t.style.setProperty("--_panel-edge-width",`${G}px`),t.style.setProperty("--_panel-edge-height",`${z}px`),t.scrollTop=s,t.scrollLeft=a}}Ge=new WeakMap,Nr=new WeakMap,qi=new WeakMap,ji=new WeakMap,bt=new WeakSet,vf=function(){var t,e;this.trigger&&(this.trigger.removeAttribute("aria-expanded"),(e=(t=this.behavior).unpair)==null||e.call(t,this.trigger),this.trigger=null)},yf=function(){var t;for(const e of((t=o(this,Ge))==null?void 0:t.panels)??[])e!==this&&this.host.contains(e.host)&&e.close()},I2=function(){const t=this.host;for(const e of["position","z-index","left","top","margin","max-width","max-height","min-width","overflow","--_panel-edge-position","--_panel-edge-inset","--_panel-edge-width","--_panel-edge-height"])o(this,ji).set(e,{value:t.style.getPropertyValue(e),priority:t.style.getPropertyPriority(e)});t.style.position="fixed",t.style.zIndex="var(--layer-panel)",t.style.margin="0",t.style.overflow="auto",t.style.setProperty("--_panel-edge-position","fixed")},wf=function(){for(const[t,{value:e,priority:r}]of o(this,ji))e?this.host.style.setProperty(t,e,r):this.host.style.removeProperty(t);o(this,ji).clear()};class gO extends HTMLElement{constructor(){super(),this.attachInternals().role="menuitem"}connectedCallback(){this.tabIndex=-1}}var zr,Mn,bf,Sf,P2;class x2 extends HTMLElement{constructor(){super();m(this,Mn);m(this,zr,new ig(this,{opened:e=>{var r;e&&((r=h(this,Mn,bf).call(this)[0])==null||r.focus({preventScroll:!0}))},keydown:e=>h(this,Mn,P2).call(this,e),pointermove:e=>{var r;return(r=h(this,Mn,Sf).call(this,e))==null?void 0:r.focus({preventScroll:!0})},click:e=>{h(this,Mn,Sf).call(this,e)&&o(this,zr).close()}}));this.attachInternals().role="menu"}connectedCallback(){o(this,zr).connect()}disconnectedCallback(){o(this,zr).disconnect()}attributeChangedCallback(){o(this,zr).refresh()}}zr=new WeakMap,Mn=new WeakSet,bf=function(){return[...this.querySelectorAll("tv-menu-item")]},Sf=function(e){const r=e.closest("tv-menu-item");return(r==null?void 0:r.closest("tv-menu"))===this?r:null},P2=function(e){var s;if(!o(this,zr).open)return!1;const r=h(this,Mn,bf).call(this),i=r.indexOf(this.ownerDocument.activeElement);if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault(),e.stopImmediatePropagation();const a=i<0?e.key==="ArrowDown"?0:r.length-1:Math.max(0,Math.min(r.length-1,i+(e.key==="ArrowDown"?1:-1)));return(s=r[a])==null||s.focus({preventScroll:!0}),!0}return e.key==="Enter"&&i>=0?(e.preventDefault(),e.stopImmediatePropagation(),r[i].click(),!0):!1},C(x2,"observedAttributes",["open","trigger","manual"]);customElements.get("tv-menu-item")||customElements.define("tv-menu-item",gO);customElements.get("tv-menu")||customElements.define("tv-menu",x2);let vO=0;var Zl;class yO extends St{constructor(){super(...arguments);m(this,Zl,`menu-trigger-${++vO}`)}template(e,{trigger:r}){return B`${r(o(this,Zl))}<tv-menu trigger=${o(this,Zl)}>
75
+ ${e.map(i=>"separator"in i?B`<hr>`:B`<tv-menu-item intent=${i.destructive?"danger":ie} @click=${i.action}>${i.label}</tv-menu-item>`)}
76
+ </tv-menu>`}}Zl=new WeakMap;const L2=_t(yO);/**
77
+ * @license
78
+ * Copyright 2020 Google LLC
79
+ * SPDX-License-Identifier: BSD-3-Clause
80
+ */const Dn=()=>new wO;class wO{}const bp=new WeakMap,ut=ba(class extends R2{render(n){return ie}update(n,[t]){var r;const e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=(r=n.options)==null?void 0:r.host,this.rt(this.ct=n.element)),ie}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let e=bp.get(t);e===void 0&&(e=new WeakMap,bp.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){var n,t;return typeof this.G=="function"?(n=bp.get(this.ht??globalThis))==null?void 0:n.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});/**
81
+ * @license
82
+ * Copyright 2017 Google LLC
83
+ * SPDX-License-Identifier: BSD-3-Clause
84
+ */const g1=(n,t,e)=>{const r=new Map;for(let i=t;i<=e;i++)r.set(n[i],i);return r},hh=ba(class extends Lc{constructor(n){if(super(n),n.type!==Ln.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);const i=[],s=[];let a=0;for(const l of n)i[a]=r?r(l,a):a,s[a]=e(l,a),a++;return{values:s,keys:i}}render(n,t,e){return this.dt(n,t,e).values}update(n,[t,e,r]){const i=uO(n),{values:s,keys:a}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=a,s;const l=this.ut??(this.ut=[]),c=[];let u,p,g=0,v=i.length-1,y=0,E=s.length-1;for(;g<=v&&y<=E;)if(i[g]===null)g++;else if(i[v]===null)v--;else if(l[g]===a[y])c[y]=Si(i[g],s[y]),g++,y++;else if(l[v]===a[E])c[E]=Si(i[v],s[E]),v--,E--;else if(l[g]===a[E])c[E]=Si(i[g],s[E]),Ra(n,c[E+1],i[g]),g++,E--;else if(l[v]===a[y])c[y]=Si(i[v],s[y]),Ra(n,i[g],i[v]),v--,y++;else if(u===void 0&&(u=g1(a,y,E),p=g1(l,g,v)),u.has(l[g]))if(u.has(l[v])){const A=p.get(a[y]),x=A!==void 0?i[A]:null;if(x===null){const L=Ra(n,i[g]);Si(L,s[y]),c[y]=L}else c[y]=Si(x,s[y]),Ra(n,i[g],x),i[A]=null;y++}else wp(i[v]),v--;else wp(i[g]),g++;for(;y<=E;){const A=Ra(n,c[E+1]);Si(A,s[y]),c[y++]=A}for(;g<=v;){const A=i[g++];A!==null&&wp(A)}return this.ut=a,$2(n,c),Ke}});/**
85
+ * @license
86
+ * Copyright 2018 Google LLC
87
+ * SPDX-License-Identifier: BSD-3-Clause
88
+ */const D2="important",bO=" !"+D2,dh=ba(class extends Lc{constructor(n){var t;if(super(n),n.type!==Ln.ATTRIBUTE||n.name!=="style"||((t=n.strings)==null?void 0:t.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((t,e)=>{const r=n[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(n,[t]){const{style:e}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(const r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(const r in t){const i=t[r];if(i!=null){this.ft.add(r);const s=typeof i=="string"&&i.endsWith(bO);r.includes("-")||s?e.setProperty(r,s?i.slice(0,-11):i,s?D2:""):e[r]=i}}return Ke}}),SO=24;function _O(n){return!v1(n.source)||!v1(n.current)||!RO(n.source,n.current)||!IO(n)||!TO(n.geometry)?{kind:"invalidated"}:kO(n.pointer,n.geometry)==="pinned"?AO(n):EO(n)}function AO(n){var c;const{source:t,current:e,pointer:r,geometry:i}=n,a=(((c=i.placeholder)==null?void 0:c.side)==="pinned"&&r.y>=i.placeholder.top&&r.y<=i.placeholder.bottom?i.placeholder.index:null)??CO(r.y,i.pinnedRows),l=e.pinnedChannelIds.filter(u=>u!==t.channelId);return l.splice(a,0,t.channelId),{kind:"placement",side:"pinned",placeholder:{side:"pinned",index:a},operation:l}}function EO(n){const{source:t,current:e}=n,r=t.pinnedChannelIds.includes(t.channelId),i=r?$O(e.unpinnedChannelIds,t.channelId):t.unpinnedChannelIds.indexOf(t.channelId);return{kind:"placement",side:"unpinned",placeholder:r&&e.unpinnedChannelIds.length===0?null:{side:"unpinned",index:i},operation:r?e.pinnedChannelIds.filter(s=>s!==t.channelId):null}}function kO(n,t){const{sidebar:e}=t;if(n.x<e.left||n.x>e.right||n.y<e.top||n.y>e.bottom)return"unpinned";const i=t.unpinnedGroupTop??(t.pinnedContentBottom===null?Number.NEGATIVE_INFINITY:t.pinnedContentBottom+SO);return n.y<i?"pinned":"unpinned"}function CO(n,t){const e=t.findIndex(({top:r,bottom:i})=>n<r+(i-r)/2);return e===-1?t.length:e}function $O(n,t){const e=n.filter(i=>i!==t),r=e.findIndex(i=>i<t);return r===-1?e.length:r}function TO(n){return n.unpinnedGroupTop!==null||n.pinnedContentBottom!==null}function v1(n){const t=[...n.pinnedChannelIds,...n.unpinnedChannelIds];return new Set(t).size===t.length}function RO(n,t){return _f(n.pinnedChannelIds,t.pinnedChannelIds)&&_f(n.unpinnedChannelIds,t.unpinnedChannelIds)}function IO(n){const t=n.current.pinnedChannelIds.filter(s=>s!==n.source.channelId),e=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"?t.length:n.current.unpinnedChannelIds.length);return n.source.pinnedChannelIds.includes(n.source.channelId)!==n.source.unpinnedChannelIds.includes(n.source.channelId)&&_f(t,e)&&i}function _f(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}const xO='<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>',PO='<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>',LO='<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>',DO='<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>',OO='<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>',MO='<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>',NO='<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>',zO='<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>',UO='<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>',FO='<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>',ZO='<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>',HO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"><path d="M74 96 128 46 182 96"/><path d="M74 160 128 210 182 160"/></svg>',VO='<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>',BO='<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>',WO='<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>',qO='<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>',jO='<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>',GO='<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>',YO='<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>',JO='<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>',KO='<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>',XO='<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>',QO='<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>',eM='<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>',tM='<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>',nM='<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>',rM='<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>',iM='<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>',sM='<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>',oM='<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>',aM='<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>',lM='<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>',cM='<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>',uM='<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>',hM='<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>',dM='<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>',pM='<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>',fM='<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>',mM='<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>',gM='<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>',vM='<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>',yM='<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>',wM='<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>',bM='<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>',SM='<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>',_M='<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>',AM='<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>',EM='<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>',kM='<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>',CM='<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>',$M='<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>',TM='<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>',RM='<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>',IM='<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>',xM='<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>',PM='<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>',LM='<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>',DM='<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>',OM='<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>',MM='<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>',NM='<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>',zM='<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>',UM='<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>',FM='<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>',ZM='<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>',HM='<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>',VM='<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>',BM='<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>',WM='<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>',qM='<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>',jM='<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>',GM='<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>',YM='<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>',JM='<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>',KM='<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>',XM='<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>',QM='<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>',eN='<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>',tN=':host,tv-icon:not(:defined){display:inline-flex;flex:none;width:1em;height:1em;vertical-align:-.125em}:host([size="sm"]),tv-icon:not(:defined)[size=sm]{font-size:16px}:host([size="md"]),tv-icon:not(:defined)[size=md]{font-size:20px}:host([size="lg"]),tv-icon:not(:defined)[size=lg]{font-size:24px}:host([size="xl"]),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}}',O2=new CSSStyleSheet;O2.replaceSync(tN);const M2={check:xO,close:PO,copy:LO,pin:DO,search:OO,add:MO,more:NO,settings:zO,expand:UO,collapse:FO,"collapse-up":ZO,select:HO,skills:VO,notification:BO,artifact:WO,spinner:qO,locked:jO,unpin:GO,back:YO,forward:JO,television:KO,calendar:XO,grid:QO,hash:eM,delete:tM,edit:nM,link:rM,external:iM,download:sM,reload:oM,warning:aM,info:lM,file:cM,folder:uM,clock:hM,user:dM,upload:pM,star:fM,home:mM,send:gM,filter:vM,sort:yM,help:wM,chart:bM,image:SM,chat:_M,location:AM,play:EM,pause:kM,stop:CM,video:$M,music:TM,error:RM,email:IM,phone:xM,web:PM,tag:LM,bookmark:DM,table:OM,code:MM,group:NM,up:zM,down:UM,money:FM,bank:ZM,card:HM,wallet:VM,gauge:BM,activity:WM,"trend-up":qM,"trend-down":jM,database:GM,server:YM,deploy:JM,list:KM,terminal:XM,branch:QM,shield:eN};function nN(n){return n!==null&&Object.hasOwn(M2,n)}var Hl,Af;class N2 extends HTMLElement{constructor(){super(...arguments);m(this,Hl)}connectedCallback(){h(this,Hl,Af).call(this)}attributeChangedCallback(){this.isConnected&&h(this,Hl,Af).call(this)}}Hl=new WeakSet,Af=function(){const e=this.shadowRoot??this.attachShadow({mode:"open"});e.adoptedStyleSheets=[O2],this.replaceChildren();const r=this.getAttribute("name");e.innerHTML=nN(r)?M2[r]:""},C(N2,"observedAttributes",["name"]);customElements.get("tv-icon")||customElements.define("tv-icon",N2);const z2=4,so=200,Dt=28,ph=800,iu="ease",y1=.5,Ia=.5,rN="New channel",Zs=".channel-group:not(.channel-group-withdrawal) .channel-row",iN=24;var mt,rt,gt,vn,Gi,Ae,oe,er,Ct,yn,$t,it,Tt,Ur,wn,bn,Yi,xo,Po,T,Ef,U2,F2,$h,Z2,H2,Du,V2,B2,W2,q2,kf,Cf,Ba,Th,Rh,Ih,xh,j2,$f,G2,Y2,Vl,J2,K2,Wa,Tf,X2,Q2,qa,Rf,If,xf,eS,Ou,Bl,Wl,ql,jl,tS,Pf,Mu,Nu,ja,nS,Lf,Ph;class sN extends St{constructor(){super(...arguments);m(this,T);m(this,mt,null);m(this,rt,null);m(this,gt,null);m(this,vn,"");m(this,Gi,!1);m(this,Ae,null);m(this,oe,null);m(this,er,!1);m(this,Ct,null);m(this,yn,null);m(this,$t,null);m(this,it,null);m(this,Tt,null);m(this,Ur,null);m(this,wn,null);m(this,bn,null);m(this,Yi,Dn());m(this,xo,Dn());m(this,Po,Dn());m(this,$h,()=>{const e=o(this,mt),r=o(this,rt);if(e===null||r===null||o(this,Ct)!==null)return;const i={resultChannelId:null};d(this,Ct,i),this.render(),e.createChannel(rN).then(s=>{i.resultChannelId=s.id,e.focusChannel(s.id).catch(()=>{}),o(this,Ct)===i&&this.render()},()=>{o(this,Ct)!==i||o(this,yn)!==null||(d(this,Ct,null),this.render())})});m(this,Th,e=>{d(this,vn,e.currentTarget.value)});m(this,Rh,e=>{e.key==="Enter"?(e.preventDefault(),h(this,T,Ba).call(this,!0)):e.key==="Escape"&&(e.preventDefault(),h(this,T,Ba).call(this,!1))});m(this,Ih,()=>{h(this,T,Ba).call(this,!0)});m(this,xh,e=>{e.preventDefault(),h(this,T,Ba).call(this,!0)});m(this,Vl,e=>{const r=o(this,oe);if(r!==null){if(r.pointerId!==e.pointerId)return;e.preventDefault(),h(this,T,Wa).call(this,r,e);return}const i=o(this,Ae);if(!(i===null||i.pointerId!==e.pointerId)){if(e.buttons===0){d(this,Ae,null);return}Math.hypot(e.clientX-i.x,e.clientY-i.y)<=z2||h(this,T,J2).call(this,i,e)}});m(this,Bl,e=>{var i;const r=o(this,oe);if(r!==null&&r.pointerId===e.pointerId){if(r.completed)return;const s=r.captureTarget.hasPointerCapture(e.pointerId);h(this,T,Wa).call(this,r,e);const a=s&&r.placement.kind==="placement"?r.placement.operation:null,l=o(this,mt);if(a===null||l===null){h(this,T,ja).call(this,r,!1);return}r.completed=!0,h(this,T,qa).call(this,r),r.operation=[...a],l.setPinnedChannelIds([...a]).then(()=>{o(this,oe)===r&&(r.operationResolved=!0,h(this,T,Pf).call(this,o(this,rt)))},()=>{o(this,oe)===r&&(r.operationResolved=!0,r.operationRejected=!0,h(this,T,Mu).call(this,r))});return}((i=o(this,Ae))==null?void 0:i.pointerId)===e.pointerId&&d(this,Ae,null)});m(this,Wl,e=>{var r,i;((r=o(this,oe))==null?void 0:r.pointerId)===e.pointerId&&!o(this,oe).completed?h(this,T,Nu).call(this):((i=o(this,Ae))==null?void 0:i.pointerId)===e.pointerId&&d(this,Ae,null)});m(this,ql,e=>{const r=o(this,oe);r===null||r.pointerId!==e.pointerId||r.completed||h(this,T,ja).call(this,r,!1)});m(this,jl,e=>{e.key!=="Escape"||o(this,oe)===null||o(this,oe).completed||(e.preventDefault(),h(this,T,Nu).call(this))});m(this,Ph,e=>{const r=e.currentTarget;r.toggleAttribute("continues-start",r.scrollTop>0)})}connected(){window.addEventListener("pointermove",o(this,Vl)),window.addEventListener("pointerup",o(this,Bl)),window.addEventListener("pointercancel",o(this,Wl)),window.addEventListener("lostpointercapture",o(this,ql)),window.addEventListener("keydown",o(this,jl))}template(e,r,i){var l;const s=o(this,rt);d(this,mt,e),d(this,rt,r),h(this,T,tS).call(this,r),h(this,T,Z2).call(this,r),h(this,T,W2).call(this,s,r),o(this,gt)!==null&&!r.channels.some(({id:c})=>c===o(this,gt))&&(d(this,gt,null),d(this,vn,"")),h(this,T,Pf).call(this,r);const a=h(this,T,q2).call(this,w1(r,(l=o(this,oe))==null?void 0:l.source));return B`
89
+ <nav
90
+ class="sidebar"
91
+ ?dragging=${o(this,oe)!==null}
92
+ ${ut(o(this,Yi))}
93
+ >
94
+ <header
95
+ class="sidebar-titlebar"
96
+ ?electron-draggable=${i}
97
+ >
98
+ <button
99
+ class="channel-create"
100
+ variant="ghost"
101
+ icon
102
+ aria-label="New channel"
103
+ title="New channel"
104
+ type="button"
105
+ ?disabled=${o(this,Ct)!==null}
106
+ @click=${o(this,$h)}
107
+ >
108
+ <tv-icon name="add"></tv-icon>
109
+ </button>
110
+ </header>
111
+
112
+ <div class="sidebar-body" role="listbox" aria-label="Channels" @scroll=${o(this,Ph)}>
113
+ ${h(this,T,Ef).call(this,"Pinned",a.pinned)}
114
+ ${h(this,T,Ef).call(this,"Recent",a.unpinned)}
115
+ </div>
116
+ </nav>
117
+ ${h(this,T,B2).call(this)}
118
+ `}disconnected(){var e,r,i;window.removeEventListener("pointermove",o(this,Vl)),window.removeEventListener("pointerup",o(this,Bl)),window.removeEventListener("pointercancel",o(this,Wl)),window.removeEventListener("lostpointercapture",o(this,ql)),window.removeEventListener("keydown",o(this,jl)),h(this,T,nS).call(this),(e=o(this,bn))==null||e.withdraw(),d(this,bn,null),(r=o(this,Ur))==null||r.cancel(),d(this,Ur,null),(i=o(this,wn))==null||i.cancel(),d(this,wn,null),d(this,mt,null),d(this,rt,null),d(this,gt,null),d(this,vn,""),d(this,Gi,!1),d(this,Ae,null),d(this,er,!1),d(this,Ct,null),d(this,yn,null),d(this,$t,null),d(this,it,null),d(this,Tt,null)}}mt=new WeakMap,rt=new WeakMap,gt=new WeakMap,vn=new WeakMap,Gi=new WeakMap,Ae=new WeakMap,oe=new WeakMap,er=new WeakMap,Ct=new WeakMap,yn=new WeakMap,$t=new WeakMap,it=new WeakMap,Tt=new WeakMap,Ur=new WeakMap,wn=new WeakMap,bn=new WeakMap,Yi=new WeakMap,xo=new WeakMap,Po=new WeakMap,T=new WeakSet,Ef=function(e,r){var g;const i=e==="Pinned"?"pinned":"unpinned",s=o(this,oe);if(s===null&&r.length===0)return null;const a=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"&&((g=s.placement.placeholder)==null?void 0:g.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}`}),a!==void 0&&u.push({kind:"row",row:a});const p=s!==null&&l.length===0&&c===null;return B`
119
+ <div
120
+ class="channel-group"
121
+ role="group"
122
+ aria-labelledby=${`channel-group-${i}`}
123
+ data-channel-side=${i}
124
+ ?drag-collapsed=${p}
125
+ >
126
+ <div class="channel-group-label" id=${`channel-group-${i}`}>${e}</div>
127
+ ${hh(u,v=>v.kind==="row"?v.row.channel.id:v.key,v=>v.kind==="row"?h(this,T,U2).call(this,v.row):B`
128
+ <span
129
+ class="channel-placeholder"
130
+ aria-hidden="true"
131
+ data-channel-side=${i}
132
+ data-channel-index=${(c==null?void 0:c.index)??0}
133
+ style=${dh({height:`${(s==null?void 0:s.rowHeight)??0}px`})}
134
+ ></span>
135
+ `)}
136
+ </div>
137
+ `},U2=function(e){var u;const{channel:r,pinned:i,selected:s}=e,a=((u=o(this,oe))==null?void 0:u.channelId)===r.id?o(this,oe):null,l=a!==null&&i&&a.placement.kind==="placement"&&a.placement.side==="unpinned",c=r.id===o(this,gt);return B`
138
+ <div
139
+ class=${`channel-row${a!==null?" dragged":""}${l?" unpinning":""}`}
140
+ data-channel-id=${r.id}
141
+ style=${dh(a===null?{}:{left:`${a.currentX-a.grip.previewOffsetX}px`,top:`${a.currentY-a.grip.offsetY}px`,width:`${a.rowWidth}px`,height:`${a.rowHeight}px`})}
142
+ >
143
+ ${l?B`
144
+ <span class="channel-drag-action" aria-hidden="true">
145
+ <tv-icon name="unpin"></tv-icon>
146
+ Unpin
147
+ </span>
148
+ `:null}
149
+ ${c?B`
150
+ <input
151
+ class="channel-rename"
152
+ aria-label="Channel name"
153
+ .value=${o(this,vn)}
154
+ @input=${o(this,Th)}
155
+ @keydown=${o(this,Rh)}
156
+ @blur=${o(this,Ih)}
157
+ ${ut(o(this,xo))}
158
+ />
159
+ <button
160
+ class="channel-rename-commit"
161
+ variant="ghost"
162
+ icon
163
+ size="sm"
164
+ type="button"
165
+ tabindex="-1"
166
+ aria-label="Rename"
167
+ @pointerdown=${o(this,xh)}
168
+ >
169
+ <tv-icon name="check"></tv-icon>
170
+ </button>
171
+ `:B`
172
+ <div
173
+ class="channel"
174
+ role="option"
175
+ tabindex="-1"
176
+ @keydown=${p=>{p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),p.currentTarget.click())}}
177
+ aria-selected=${s?"true":ie}
178
+ @pointerdown=${p=>h(this,T,G2).call(this,r.id,p)}
179
+ @click=${p=>h(this,T,Y2).call(this,r.id,p)}
180
+ >
181
+ ${r.name}
182
+ </div>
183
+ ${L2(h(this,T,F2).call(this,e),{trigger:p=>B`
184
+ <button
185
+ class="channel-menu-trigger"
186
+ variant="ghost"
187
+ icon
188
+ size="sm"
189
+ type="button"
190
+ tabindex="-1"
191
+ id=${p}
192
+ aria-hidden="true"
193
+ title=${`${r.name} menu`}
194
+ >
195
+ <tv-icon name="expand"></tv-icon>
196
+ </button>
197
+ `})}
198
+ `}
199
+ </div>
200
+ `},F2=function(e){const{channel:r,pinned:i}=e;return[{label:"Rename",action:()=>h(this,T,Cf).call(this,r.id)},{label:i?"Unpin":"Pin",action:()=>h(this,T,j2).call(this,r.id,!i)},{separator:!0},{label:"Delete",destructive:!0,action:()=>h(this,T,H2).call(this,r.id,r.name)}]},$h=new WeakMap,Z2=function(e){const r=o(this,Ct);if(r===null||o(this,yn)!==null||r.resultChannelId===null)return;const i=e.channels.find(({id:s})=>s===r.resultChannelId);i!==void 0&&(d(this,yn,i.id),queueMicrotask(()=>h(this,T,kf).call(this,"create",i.id)))},H2=function(e,r){var s,a,l;if(o(this,$t)!==null||o(this,it)!==null)return;h(this,T,$f).call(this,e),d(this,$t,{channelId:e,name:r}),this.render();const i=(s=o(this,Po).value)==null?void 0:s.closest("dialog");i instanceof HTMLDialogElement&&(d(this,bn,wd(i,()=>{h(this,T,Du).call(this)})),(l=(a=o(this,Po).value)==null?void 0:a.querySelector(".dialog-actions button"))==null||l.focus())},Du=function(){const e=o(this,bn);d(this,bn,null),d(this,$t,null),e==null||e.withdraw(),this.render()},V2=function(){const e=o(this,mt),r=o(this,$t);e===null||r===null||o(this,it)!==null||(d(this,it,r.channelId),h(this,T,Du).call(this),e.deleteChannel(r.channelId).catch(()=>{o(this,it)!==r.channelId||o(this,Tt)!==null||(d(this,it,null),this.render())}))},B2=function(){const e=o(this,$t);return e===null?null:yd(B`
201
+ <div
202
+ class="dialog-alert channel-delete-alert"
203
+ role="alertdialog"
204
+ aria-labelledby="channel-delete-title"
205
+ aria-describedby="channel-delete-body"
206
+ ${ut(o(this,Po))}
207
+ >
208
+ <h2 id="channel-delete-title">Delete “${e.name}”?</h2>
209
+ <p id="channel-delete-body">
210
+ This will permanently delete this channel from Television.
211
+ </p>
212
+ <div class="dialog-actions">
213
+ <button type="button" autofocus @click=${()=>h(this,T,Du).call(this)}>
214
+ Cancel
215
+ </button>
216
+ <button type="button" intent="danger" @click=${()=>h(this,T,V2).call(this)}>
217
+ Delete
218
+ </button>
219
+ </div>
220
+ </div>
221
+ `)},W2=function(e,r){var p,g;o(this,$t)!==null&&!r.channels.some(({id:v})=>{var y;return v===((y=o(this,$t))==null?void 0:y.channelId)})&&((p=o(this,bn))==null||p.withdraw(),d(this,bn,null),d(this,$t,null));const i=o(this,Tt);if(i!==null&&r.channels.some(({id:v})=>v===i.row.channel.id)){(g=o(this,wn))==null||g.cancel(),d(this,wn,null),d(this,Tt,null),d(this,it,null);return}const s=o(this,it);if(s===null||i!==null||r.channels.some(({id:v})=>v===s))return;if(e===null){d(this,it,null);return}const a=w1(e),l=a.pinned.findIndex(({channel:v})=>v.id===s),c=a.unpinned.findIndex(({channel:v})=>v.id===s),u=l>=0?a.pinned[l]:a.unpinned[c];if(u===void 0){d(this,it,null);return}d(this,Tt,{row:{...u,selected:!1},side:l>=0?"pinned":"unpinned",index:l>=0?l:c}),queueMicrotask(()=>h(this,T,kf).call(this,"delete",s))},q2=function(e){const r=o(this,Tt);if(r===null)return e;const i=[...e[r.side]];return i.some(({channel:s})=>s.id===r.row.channel.id)||i.splice(r.index,0,r.row),{...e,[r.side]:i}},kf=function(e,r){var u,p;if(e==="create"&&o(this,yn)!==r||e==="delete"&&((u=o(this,Tt))==null?void 0:u.row.channel.id)!==r)return;const i=[...((p=o(this,Yi).value)==null?void 0:p.querySelectorAll(Zs))??[]].find(g=>g.dataset.channelId===r);if(i===void 0)return;const s=()=>{var g;if(e==="create"){if(o(this,yn)!==r)return;d(this,yn,null),d(this,Ct,null),h(this,T,Cf).call(this,r)}else{if(((g=o(this,Tt))==null?void 0:g.row.channel.id)!==r)return;d(this,Tt,null),d(this,it,null),this.render()}};if(typeof i.animate!="function"||matchMedia("(prefers-reduced-motion: reduce)").matches){s();return}const a=i.getBoundingClientRect().height,l=e==="create"?[{maxHeight:"0px",opacity:0},{maxHeight:`${a}px`,opacity:1}]:[{maxHeight:`${a}px`,opacity:1},{maxHeight:"0px",opacity:0}],c=i.animate(l,{duration:so,easing:iu});e==="create"?d(this,Ur,c):d(this,wn,c),c.finished.then(()=>{e==="create"&&o(this,Ur)!==c||e==="delete"&&o(this,wn)!==c||(e==="create"?d(this,Ur,null):d(this,wn,null),s())},()=>{})},Cf=function(e){var i;const r=(i=o(this,rt))==null?void 0:i.channels.find(({id:s})=>s===e);r!==void 0&&(d(this,gt,e),d(this,vn,r.name),d(this,Ae,null),this.render(),queueMicrotask(()=>{var s,a;o(this,gt)===e&&((s=o(this,xo).value)==null||s.focus(),(a=o(this,xo).value)==null||a.select())}))},Ba=function(e){if(o(this,gt)===null||o(this,Gi)||o(this,mt)===null)return;d(this,Gi,!0);const r=o(this,gt),i=o(this,vn).trim();d(this,gt,null),d(this,vn,""),this.render(),d(this,Gi,!1),e&&i.length>0&&o(this,mt).renameChannel(r,i).catch(()=>{})},Th=new WeakMap,Rh=new WeakMap,Ih=new WeakMap,xh=new WeakMap,j2=function(e,r){if(o(this,mt)===null||o(this,rt)===null)return;h(this,T,$f).call(this,e);const i=o(this,rt).display.pinnedChannelIds,s=r?[...i.filter(a=>a!==e),e]:i.filter(a=>a!==e);o(this,mt).setPinnedChannelIds(s).catch(()=>{})},$f=function(e){var s,a,l;const r=[...((s=o(this,Yi).value)==null?void 0:s.querySelectorAll(Zs))??[]].find(c=>c.dataset.channelId===e),i=r==null?void 0:r.querySelector(".channel-menu-trigger");i&&((l=(a=o(this,Yi).value)==null?void 0:a.ownerDocument.querySelector(`tv-menu[trigger="${i.id}"]`))==null||l.removeAttribute("open"))},G2=function(e,r){if(r.button!==0||o(this,Ae)!==null||o(this,oe)!==null||o(this,rt)===null)return;d(this,er,!1);const s=r.currentTarget.closest(".sidebar");if(s===null)return;const a=Ga(o(this,rt));!a.pinnedChannelIds.includes(e)&&!a.unpinnedChannelIds.includes(e)||d(this,Ae,{channelId:e,pointerId:r.pointerId,x:r.clientX,y:r.clientY,source:{channelId:e,...a},captureTarget:s})},Y2=function(e,r){var i;if(r.detail!==0&&o(this,er)){d(this,er,!1);return}d(this,er,!1),o(this,oe)===null&&((i=o(this,mt))==null||i.focusChannel(e).catch(()=>{}))},Vl=new WeakMap,J2=function(e,r){const i=[...e.captureTarget.querySelectorAll(Zs)].find(g=>g.dataset.channelId===e.channelId);if(i===void 0){d(this,Ae,null);return}const s=i.getBoundingClientRect(),a=h(this,T,K2).call(this,i),l=aN({wideRow:s,compactPreviewWidth:a,pointer:{x:e.x,y:e.y}}),c=e.captureTarget.querySelector('[data-channel-side="pinned"]'),u=e.captureTarget.querySelector('[data-channel-side="unpinned"]');try{e.captureTarget.setPointerCapture(e.pointerId)}catch{d(this,Ae,null);return}e.captureTarget.style.setProperty("--channel-sidebar-drag-grip-x",`${l.previewOffsetX}px`),e.captureTarget.style.setProperty("--channel-sidebar-drag-grip-y",`${l.offsetY}px`),e.captureTarget.style.setProperty("--channel-sidebar-drag-grip-correction-x",`${l.correctionX}px`),d(this,er,!0);const p={...e,placement:{kind:"invalidated"},currentX:r.clientX,currentY:r.clientY,grip:l,rowWidth:a,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,Ae,null),d(this,oe,p),h(this,T,Wa).call(this,p,r)},K2=function(e){const r=e.cloneNode(!0);for(const s of[r,...r.querySelectorAll("[id], [trigger]")])s.removeAttribute("id"),s.removeAttribute("trigger");r.classList.add("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},Wa=function(e,r,i=!0){if(e.completed)return;const s=o(this,rt);if(s===null){e.placement={kind:"invalidated"};return}e.currentX=r.clientX,e.currentY=r.clientY;const a=Ga(s),l=new Map([...e.captureTarget.querySelectorAll(Zs)].map(V=>[V.dataset.channelId,V])),c=a.pinnedChannelIds.filter(V=>V!==e.channelId).flatMap(V=>{const F=l.get(V);if(F===void 0)return[];const G=F.getBoundingClientRect();return[{channelId:V,top:G.top,bottom:G.bottom}]}),u=e.captureTarget.querySelector('.channel-group[data-channel-side="pinned"]:not([drag-collapsed]):not(.channel-group-withdrawal)'),p=e.captureTarget.querySelector('.channel-group[data-channel-side="unpinned"]:not([drag-collapsed]):not(.channel-group-withdrawal)'),g=e.captureTarget.querySelector(".channel-group:not(.channel-group-withdrawal) .channel-placeholder"),v=g==null?void 0:g.getBoundingClientRect(),y=g==null?void 0:g.dataset.channelSide,E=Number(g==null?void 0:g.dataset.channelIndex),A=e.captureTarget.getBoundingClientRect(),x=_O({source:e.source,current:a,pointer:{x:r.clientX,y:r.clientY},geometry:{sidebar:{left:A.left,right:A.right,top:A.top,bottom:A.bottom},pinnedRows:c,unpinnedGroupTop:(p==null?void 0:p.getBoundingClientRect().top)??e.originUnpinnedGroupTop,pinnedContentBottom:(u==null?void 0:u.getBoundingClientRect().bottom)??e.originPinnedContentBottom,placeholder:v!==void 0&&(y==="pinned"||y==="unpinned")&&Number.isInteger(E)?{side:y,index:E,top:v.top,bottom:v.bottom}:null}}),L=!lN(e.placement,x),D=L?h(this,T,If).call(this,e):null;e.placement=x,(L||i)&&h(this,T,xf).call(this,e,D,!1),h(this,T,Tf).call(this,e)},Tf=function(e){const r=e.captureTarget.querySelector(".sidebar-body"),i=r?h(this,T,Rf).call(this,r,e.currentY):0,s=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=i<0?((r==null?void 0:r.scrollTop)??0)<=y1:((r==null?void 0:r.scrollTop)??0)>=s-y1;if(e.completed||i===0||s===0||a||typeof requestAnimationFrame!="function"){h(this,T,qa).call(this,e);return}e.edgeScrollFrame===0&&(e.edgeScrollFrame=requestAnimationFrame(l=>{h(this,T,X2).call(this,e,l)}))},X2=function(e,r){if(e.edgeScrollFrame=0,o(this,oe)!==e||e.completed){e.edgeScrollTimestamp=null;return}const i=e.captureTarget.querySelector(".sidebar-body");if(i===null){e.edgeScrollTimestamp=null;return}const s=h(this,T,Rf).call(this,i,e.currentY),a=e.edgeScrollTimestamp;if(e.edgeScrollTimestamp=r,s!==0&&a!==null){const l=Math.max(0,r-a)/1e3,c=Math.max(0,i.scrollHeight-i.clientHeight),u=i.scrollTop,p=s*l+e.edgeScrollRemainder,g=Math.max(0,Math.min(c,u+p));i.scrollTop=g;const v=i.scrollTop-u;if(e.edgeScrollRemainder=g===0||g===c?0:p-v,v!==0){i.toggleAttribute("continues-start",i.scrollTop>0),h(this,T,Q2).call(this,e);return}}h(this,T,Tf).call(this,e)},Q2=function(e){h(this,T,Wa).call(this,e,{clientX:e.currentX,clientY:e.currentY},!1)},qa=function(e){e.edgeScrollFrame!==0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(e.edgeScrollFrame),e.edgeScrollFrame=0,e.edgeScrollTimestamp=null,e.edgeScrollRemainder=0},Rf=function(e,r){const i=e.getBoundingClientRect();return r>=i.top&&r<i.top+Dt?-ph*(i.top+Dt-r)/Dt:r>i.bottom-Dt&&r<=i.bottom?ph*(r-(i.bottom-Dt))/Dt:0},If=function(e){var s;for(const a of e.displacementAnimations)a.cancel();e.displacementAnimations.clear();const r=new Map;for(const a of e.captureTarget.querySelectorAll(Zs)){const l=a.dataset.channelId;if(l===void 0)continue;const c=a.getBoundingClientRect();r.set(l,{left:c.left,top:c.top})}const i=new Map;for(const a of e.captureTarget.querySelectorAll(".channel-group:not(.channel-group-withdrawal)")){const l=a.dataset.channelSide;if(l!=="pinned"&&l!=="unpinned")continue;const c=a.getBoundingClientRect(),u=a.cloneNode(!0);for(const p of[u,...u.querySelectorAll("[id], [trigger]")])p.removeAttribute("id"),p.removeAttribute("trigger");(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:a.hasAttribute("drag-collapsed")?0:c.height,withdrawal:u})}return{rows:r,groups:i}},xf=function(e,r,i){const s=e.captureTarget.querySelector(".sidebar-body"),a=(s==null?void 0:s.scrollTop)??0;this.render(),queueMicrotask(()=>{const l=e.captureTarget.querySelector(".sidebar-body");l!==null&&(l.scrollTop=a),r!==null&&h(this,T,eS).call(this,e,r,i)})},eS=function(e,r,i){if(!(typeof HTMLElement.prototype.animate!="function"||matchMedia("(prefers-reduced-motion: reduce)").matches)){for(const s of e.captureTarget.querySelectorAll(Zs)){const a=s.dataset.channelId;if(a===void 0||!i&&a===e.channelId)continue;const l=r.rows.get(a);if(l===void 0)continue;const c=s.getBoundingClientRect(),u=l.left-c.left,p=l.top-c.top;Math.hypot(u,p)<=Ia||h(this,T,Ou).call(this,e,s.animate({translate:[`${u}px ${p}px`,"0px 0px"]},{duration:so,easing:iu}))}for(const s of e.captureTarget.querySelectorAll(".channel-group:not(.channel-group-withdrawal)")){const a=s.dataset.channelSide;if(a!=="pinned"&&a!=="unpinned")continue;const l=r.groups.get(a),c=s.getBoundingClientRect(),u=s.hasAttribute("drag-collapsed")?0:c.height;if(l!==void 0){if(l.height<=Ia&&u>Ia)h(this,T,Ou).call(this,e,s.animate([{opacity:0,translate:`0px -${u}px`},{opacity:1,translate:"0px 0px"}],{duration:so,easing:iu}));else if(l.height>Ia&&u<=Ia&&l.withdrawal.childElementCount>0){const p=l.withdrawal;p.style.left=`${l.left}px`,p.style.top=`${l.top}px`,p.style.width=`${l.width}px`,p.style.height=`${l.height}px`,e.captureTarget.append(p);const g=p.animate([{opacity:1,translate:"0px 0px"},{opacity:0,translate:`0px -${l.height}px`}],{duration:so,easing:iu});h(this,T,Ou).call(this,e,g),g.finished.finally(()=>p.remove()).catch(()=>{})}}}}},Ou=function(e,r){e.displacementAnimations.add(r),r.finished.finally(()=>{e.displacementAnimations.delete(r)}).catch(()=>{})},Bl=new WeakMap,Wl=new WeakMap,ql=new WeakMap,jl=new WeakMap,tS=function(e){const r=Ga(e);o(this,oe)!==null&&!o(this,oe).completed&&!b1(o(this,oe).source,r)&&h(this,T,Nu).call(this),o(this,Ae)!==null&&!b1(o(this,Ae).source,r)&&d(this,Ae,null)},Pf=function(e){const r=o(this,oe);if(e===null||r===null||!r.completed||!r.operationResolved||r.restorationQueued)return;if(r.operationRejected){h(this,T,Mu).call(this,r);return}const i=r.operation;i!==null&&fh(Ga(e).pinnedChannelIds,i)&&h(this,T,Mu).call(this,r)},Mu=function(e){o(this,oe)!==e||e.restorationQueued||(e.restorationQueued=!0,queueMicrotask(()=>{o(this,oe)===e&&h(this,T,ja).call(this,e,!1)}))},Nu=function(){d(this,Ae,null);const e=o(this,oe);e!==null&&h(this,T,ja).call(this,e,!0)},ja=function(e,r){if(o(this,oe)!==e)return;h(this,T,qa).call(this,e);const i=h(this,T,If).call(this,e);d(this,oe,null),h(this,T,Lf).call(this,e),r&&e.captureTarget.hasPointerCapture(e.pointerId)&&e.captureTarget.releasePointerCapture(e.pointerId),h(this,T,xf).call(this,e,i,!0)},nS=function(){d(this,Ae,null);const e=o(this,oe);if(d(this,oe,null),e!==null){h(this,T,qa).call(this,e);for(const r of e.displacementAnimations)r.cancel();e.displacementAnimations.clear(),h(this,T,Lf).call(this,e),e.captureTarget.hasPointerCapture(e.pointerId)&&e.captureTarget.releasePointerCapture(e.pointerId)}},Lf=function(e){e.captureTarget.style.removeProperty("--channel-sidebar-drag-grip-x"),e.captureTarget.style.removeProperty("--channel-sidebar-drag-grip-y"),e.captureTarget.style.removeProperty("--channel-sidebar-drag-grip-correction-x")},Ph=new WeakMap;const oN=_t(sN);function aN(n){const t=Math.max(0,n.wideRow.right-n.wideRow.left),e=Math.max(0,n.wideRow.bottom-n.wideRow.top),r=S1(n.pointer.x-n.wideRow.left,0,t),i=Math.min(r,Math.max(0,n.compactPreviewWidth-iN));return{wideOffsetX:r,previewOffsetX:i,correctionX:r-i,offsetY:S1(n.pointer.y-n.wideRow.top,0,e)}}function w1(n,t=Ga(n)){var l,c;const e=new Map(n.channels.map(u=>[u.id,u])),r=t.pinnedChannelIds.flatMap(u=>{const p=e.get(u);return p===void 0?[]:[p]}),i=t.unpinnedChannelIds.flatMap(u=>{const p=e.get(u);return p===void 0?[]:[p]}),s=n.display.focusedChannelId,a=s!==null&&e.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===a})),unpinned:i.map(u=>({channel:u,pinned:!1,selected:u.id===a}))}}function Ga(n){const t=new Set(n.channels.map(({id:s})=>s)),e=n.display.pinnedChannelIds.filter(s=>t.has(s)),r=new Set(e),i=n.channels.filter(({id:s})=>!r.has(s)).map(({id:s})=>s).sort((s,a)=>a.localeCompare(s));return{pinnedChannelIds:e,unpinnedChannelIds:i}}function b1(n,t){return fh(n.pinnedChannelIds,t.pinnedChannelIds)&&fh(n.unpinnedChannelIds,t.unpinnedChannelIds)}function fh(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}function lN(n,t){var e,r,i,s;return n.kind!==t.kind?!1:n.kind==="invalidated"||t.kind==="invalidated"?!0:n.side===t.side&&((e=n.placeholder)==null?void 0:e.side)===((r=t.placeholder)==null?void 0:r.side)&&((i=n.placeholder)==null?void 0:i.index)===((s=t.placeholder)==null?void 0:s.index)&&n.operation===null==(t.operation===null)&&(n.operation===null||t.operation===null||fh(n.operation,t.operation))}function S1(n,t,e){return Math.max(t,Math.min(e,n))}const rS="television-active-theme",sg="tv-theme";let Tr=null,vr=null,oi=null,ai=null,Er=null,_1=0,mh=0;function cN(n){const t=document.createElement("link"),e=new URL("/theme/theme.css",n);e.searchParams.set(sg,og()),t.rel="stylesheet",t.href=e.toString(),t.dataset.televisionStyle=rS;const r=()=>{Tr===t&&document.dispatchEvent(new Event("television-theme-styles-changed"))};return t.addEventListener("load",r,{once:!0}),t.addEventListener("error",r,{once:!0}),Tr==null||Tr.remove(),document.head.append(t),Tr=t,t}function uN(){Tr&&(Tr.remove(),Tr=null,document.dispatchEvent(new Event("television-theme-styles-changed")))}function A1(n){const t=document.createElement("script"),e=new URL("/theme/main.js",n);return e.searchParams.set(sg,og()),t.src=e.toString(),t.dataset.televisionScript=rS,vr==null||vr.remove(),document.head.append(t),vr=t,t}function hN(){vr==null||vr.remove(),vr=null}function dN(){return vr}async function pN(n,t,e){const r=iS();if(t===null)return;let i;try{i=await e()}catch{return}if(r!==mh)return;const s=i.themes.find(p=>p.id===t);if(s===void 0)return;const a=document.querySelector("#app"),l=document.querySelector("#foreground-overlay");if(a===null||l===null)return;const c=s.enableIframeBackgroundJS===!0?E1(n,"background"):null,u=s.enableIframeOverlayJS===!0?E1(n,"overlay"):null;r===mh&&(c!==null&&(a.before(c),oi=c),u!==null&&(l.after(u),ai=u))}function fN(){iS()}function iS(){return mh+=1,oi==null||oi.remove(),ai==null||ai.remove(),oi=null,ai=null,mh}function E1(n,t){const e=t==="background"?new URL("/theme/iframe-background.js",n):new URL("/theme/iframe-overlay.js",n);e.searchParams.set(sg,og());const r=document.createElement("iframe");return r.id=t==="background"?"theme-iframe-background":"theme-iframe-overlay",r.setAttribute("sandbox","allow-scripts"),r.setAttribute("inert",""),r.setAttribute("tabindex","-1"),r.setAttribute("aria-hidden","true"),r.srcdoc=gN(e.toString(),mN()),r}function mN(){const n=document.documentElement.dataset.theme;if(n!=="light"&&n!=="dark")throw new Error("Application root has no effective theme-frame appearance");return n}function gN(n,t){return`<!doctype html>
222
+ <html data-theme="${t}">
223
+ <head>
224
+ <meta charset="utf-8">
225
+ <style>
226
+ html, body {
227
+ width: 100%;
228
+ height: 100%;
229
+ margin: 0;
230
+ overflow: hidden;
231
+ background: transparent;
232
+ color-scheme: ${t};
233
+ }
234
+ </style>
235
+ </head>
236
+ <body>
237
+ <script src="${n}"><\/script>
238
+ </body>
239
+ </html>`}function sS(n){var s;let t,e=n.button,r=n.buttons;switch(n.eventType){case"pointermove":t="television-theme-pointer-move",e=-1;break;case"pointerdown":t="television-theme-pointer-down";break;case"pointerup":t="television-theme-pointer-up";break;case"pointercancel":t="television-theme-pointer-cancel",e=-1,r=0;break;case"click":t="television-theme-pointer-click",r=0;break}const i={type:t,clientX:n.clientX,clientY:n.clientY,button:e,buttons:r};for(const a of[oi,ai])(a==null?void 0:a.isConnected)===!0&&((s=a.contentWindow)==null||s.postMessage(i,"*"))}function Dc(n){n.isTrusted&&sS({eventType:n.type,clientX:n.clientX,clientY:n.clientY,button:n.button,buttons:n.buttons})}document.addEventListener("pointermove",Dc,{capture:!0});document.addEventListener("pointerdown",Dc,{capture:!0});document.addEventListener("pointerup",Dc,{capture:!0});document.addEventListener("pointercancel",Dc,{capture:!0});document.addEventListener("click",Dc,{capture:!0});function oS(n){if(n!==oi&&n!==ai)return!1;const e=((Er==null?void 0:Er.isConnected)===!0&&Er!==oi&&Er!==ai&&Er.closest("#foreground-overlay")===null?Er:null)??document.querySelector("#app");return e==null||e.focus({preventScroll:!0}),!0}document.addEventListener("focusin",n=>{const t=n.target;t instanceof HTMLElement&&(oS(t)||t.isConnected&&t.closest("#foreground-overlay")===null&&(Er=t))},{capture:!0});window.addEventListener("blur",()=>{queueMicrotask(()=>oS(document.activeElement))},{capture:!0});function og(){return _1+=1,`${Date.now()}-${_1}`}const vN=404,yN="/views/url-unsupported/";function zu(n){const t=Yp(n.artifact,{electron:n.electron});let e;if(n.currentURL===null){const r=n.viewURL??t.viewURL;t.renderer==="markdown"?e={renderer:"markdown",viewURL:r,contentURL:n.contentURL??t.contentURL}:t.renderer==="url-webview"&&t.contentURL!==null?e={renderer:"url-webview",viewURL:r,contentURL:n.contentURL??t.contentURL}:e={...t,viewURL:r}}else k1(n.currentURL)&&!n.electron?e=Wn(n.currentURL)?{renderer:"proxy-iframe",viewURL:n.currentURL,contentURL:null}:{renderer:"proxy-iframe",viewURL:yN,contentURL:null}:k1(n.currentURL)?e={renderer:"url-webview",viewURL:n.currentURL,contentURL:null}:e={renderer:n.electron?"url-webview":"proxy-iframe",viewURL:SN(n.currentURL,n.viewURL),contentURL:null};return n.frameSrcOverride?{...e,viewURL:n.frameSrcOverride}:e}var Fe,Rt,Lo,Ji,Ki,jt,Xi,Do,st,Oo,Mo,Sn,Fr,Zr,Qi,Y,Uu,aS,lS,Df,cS,_n,Fu,Ya,Of,uS,Mf,Nf,Ai;class wN extends St{constructor(){super(...arguments);m(this,Y);m(this,Fe,null);m(this,Rt,null);m(this,Lo,"");m(this,Ji,()=>{});m(this,Ki,()=>{});m(this,jt,null);m(this,Xi,null);m(this,Do,null);m(this,st,null);m(this,Oo,null);m(this,Mo,null);m(this,Sn,null);m(this,Fr,null);m(this,Zr,null);m(this,Qi,null);m(this,_n,()=>{!o(this,Rt)||o(this,Rt)!==o(this,jt)||o(this,Ji).call(this,!0)})}get currentFrame(){return o(this,Rt)}connected(){h(this,Y,Fu).call(this),h(this,Y,Of).call(this)}disconnected(){h(this,Y,Ya).call(this),h(this,Y,Ai).call(this)}template(e,r,i=()=>{}){return d(this,Ji,r),d(this,Ki,i),e(this),o(this,Lo)}assignSource(e){const r=o(this,Fe),i=r?!_N(r.artifact,e.artifact):!0;((r==null?void 0:r.artifact.id)!==e.artifact.id||(r==null?void 0:r.artifact.kind)==="path"&&e.artifact.kind==="path"&&r.artifact.path!==e.artifact.path)&&d(this,Qi,null),i&&(d(this,Sn,null),o(this,st)&&(o(this,st).content=""),d(this,Fr,null),d(this,Zr,null)),d(this,Fe,e),h(this,Y,Uu).call(this)}handleArtifactContentChanged(e){const r=o(this,Fe);return e!==(r==null?void 0:r.artifact.id)||!o(this,st)&&!h(this,Y,Nf).call(this)?!1:(h(this,Y,Mf).call(this),!0)}handleThemeChanged(){var r;const e=(r=o(this,Fe))==null?void 0:r.artifact;return(e==null?void 0:e.kind)!=="path"||!Gp(e.path)||o(this,st)===null?!1:(o(this,st).notifyStylesChanged(),!0)}refreshFrameLoadState(){h(this,Y,Fu).call(this)}}Fe=new WeakMap,Rt=new WeakMap,Lo=new WeakMap,Ji=new WeakMap,Ki=new WeakMap,jt=new WeakMap,Xi=new WeakMap,Do=new WeakMap,st=new WeakMap,Oo=new WeakMap,Mo=new WeakMap,Sn=new WeakMap,Fr=new WeakMap,Zr=new WeakMap,Qi=new WeakMap,Y=new WeakSet,Uu=function(){const e=o(this,Fe);if(!e)return;if(e.artifact.kind==="path"&&h(this,Y,Nf).call(this)){h(this,Y,cS).call(this,e.artifact);return}const r=zu(e),i=h(this,Y,aS).call(this,r.renderer);h(this,Y,lS).call(this,i,r),h(this,Y,Df).call(this,i),h(this,Y,Fu).call(this),h(this,Y,Of).call(this)},aS=function(e){var s;const r=e==="url-webview"?"webview":"iframe";if(((s=o(this,Rt))==null?void 0:s.tagName.toLowerCase())===r)return o(this,Rt);h(this,Y,Ya).call(this),h(this,Y,Ai).call(this);const i=document.createElement(r);return i.className="artifact-content",r==="webview"&&i.setAttribute("allowpopups",""),d(this,Rt,i),i},lS=function(e,r){e.getAttribute("src")!==r.viewURL&&(o(this,Ki).call(this,null),o(this,Ki).call(this,e),e.setAttribute("src",r.viewURL)),r.contentURL===null?delete e.dataset.contentUrl:e.dataset.contentUrl=r.contentURL},Df=function(e){o(this,Lo)!==e&&(d(this,Lo,e),this.render(e))},cS=function(e){o(this,Ki).call(this,null),h(this,Y,Ya).call(this),h(this,Y,Ai).call(this),d(this,Rt,null),o(this,Ji).call(this,!1),h(this,Y,Df).call(this,B`
240
+ <section class="artifact-missing artifact-content" role="status" aria-label="Artifact file not found">
241
+ <div class="artifact-missing-wrapper">
242
+ <h1>${H_()}</h1>
243
+ <p>${V_()}</p>
244
+ <section class="artifact-missing-path" aria-label="Missing artifact path">
245
+ <p class="artifact-missing-path-label">Registered path:</p>
246
+ <p><code>${e.path}</code></p>
247
+ </section>
248
+ <p>${B_()}</p>
249
+ </div>
250
+ </section>
251
+ `)},_n=new WeakMap,Fu=function(){var s;const e=o(this,Rt),r=e?`${e.tagName.toLowerCase()}:${e.getAttribute("src")??""}:${e.dataset.contentUrl??""}`:null;if(e&&e===o(this,jt)&&r===o(this,Xi)||(h(this,Y,Ya).call(this),o(this,Ji).call(this,!1),!e||!r||!this.isConnected))return;if(d(this,jt,e),d(this,Xi,r),e.tagName.toLowerCase()==="webview"){e.addEventListener("did-finish-load",o(this,_n)),e.addEventListener("did-fail-load",o(this,_n));return}e.addEventListener("load",o(this,_n));const i=e;try{i.isConnected&&((s=i.contentDocument)==null?void 0:s.readyState)==="complete"&&o(this,_n).call(this)}catch{}},Ya=function(){if(!o(this,jt)){d(this,Xi,null);return}o(this,jt).removeEventListener("load",o(this,_n)),o(this,jt).removeEventListener("did-finish-load",o(this,_n)),o(this,jt).removeEventListener("did-fail-load",o(this,_n)),d(this,jt,null),d(this,Xi,null)},Of=function(){const e=o(this,Fe),r=o(this,Rt),i=(r==null?void 0:r.dataset.contentUrl)??null,s=(e==null?void 0:e.artifact.id)??null;if(!e||!r||!i||!s){h(this,Y,Ai).call(this,{clearContent:!0});return}if(r!==o(this,Do)||s!==o(this,Mo)){h(this,Y,Ai).call(this),d(this,Do,r),d(this,Oo,i),d(this,Mo,s);const a=r.tagName.toLowerCase()==="webview"?new K5(r):new J5(r);d(this,st,a),a.handleUpdateContent(async l=>{const c=o(this,Fe),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,Sn,l),o(this,st)===a&&(a.content=l)}),o(this,Sn)!==null&&(a.content=o(this,Sn))}else d(this,Oo,i);h(this,Y,uS).call(this)},uS=function(){const e=o(this,Fe),r=e==null?void 0:e.application;!e||!r||!o(this,st)||o(this,Fr)===e.artifact.id&&o(this,Zr)===r||(d(this,Fr,e.artifact.id),d(this,Zr,r),h(this,Y,Mf).call(this))},Mf=async function(){var s,a;const e=o(this,Fe),r=e==null?void 0:e.application;if(!e||!r)return;const i=e.artifact.id;try{const l=await r.readMarkdown(i);if(((s=o(this,Fe))==null?void 0:s.artifact.id)!==i||o(this,Fe).application!==r)return;d(this,Qi,null),d(this,Sn,l);const c=o(this,st);if(!c){h(this,Y,Uu).call(this);return}c.content=l}catch(l){if(((a=o(this,Fe))==null?void 0:a.artifact.id)!==i||o(this,Fe).application!==r)return;if(l instanceof ga&&l.status===vN){d(this,Qi,i),d(this,Sn,null),h(this,Y,Ai).call(this),h(this,Y,Uu).call(this);return}d(this,Fr,null),d(this,Zr,null)}},Nf=function(){var r;const e=(r=o(this,Fe))==null?void 0:r.artifact;return o(this,Qi)===(e==null?void 0:e.id)&&e.kind==="path"&&Gp(e.path)},Ai=function(e={}){var r;(r=o(this,st))==null||r.dispose(),d(this,st,null),d(this,Do,null),d(this,Oo,null),d(this,Mo,null),d(this,Fr,null),d(this,Zr,null),e.clearContent&&d(this,Sn,null)};const bN=_t(wN);function k1(n){return n.startsWith("http://")||n.startsWith("https://")}function SN(n,t){if(!n.startsWith("/")||!t)return n;try{return new URL(n,t).toString()}catch{return n}}function _N(n,t){return n.id!==t.id||n.kind!==t.kind?!1:n.kind==="path"&&t.kind==="path"?n.path===t.path:n.kind==="url"&&t.kind==="url"?n.url===t.url:!0}var Gl,No,An,tr,Hr,Vr,Br,Yl,Jl,Kl,Xl,wt,zf,Zu,Hu;class AN{constructor(t,e=()=>{}){m(this,wt);m(this,Gl);m(this,No);m(this,An,null);m(this,tr,null);m(this,Hr,null);m(this,Vr,null);m(this,Br,!1);m(this,Yl,t=>{const e=$1(t.data);if(!e)return;const r=o(this,Hr);if(!r||r.tagName.toLowerCase()!=="iframe"||!r.isConnected)return;const i=r,s=i.contentWindow;if(s===null)return;const a=e.type==="leaving",l=e.type==="navigation-request"&&e.native===!0&&e.sameDocument!==!0,c=s===t.source,u=(a||l)&&o(this,tr)!==null&&o(this,tr)===t.source,p=a&&kN(i)===t.origin;!c&&!u&&!p||h(this,wt,zf).call(this,e,i,{send:g=>{var v;return(v=i.contentWindow)==null?void 0:v.postMessage(g,"*")}})});m(this,Jl,t=>{var s;const e=t.detail??t;if(!e||e.channel!==C1)return;const r=$1((s=e.args)==null?void 0:s[0]),i=o(this,Vr);!r||!i||h(this,wt,zf).call(this,r,i,{send:a=>{var l;return(l=i.send)==null?void 0:l.call(i,C1,a)}})});m(this,Kl,t=>{const e=T1(t);e.isMainFrame===!0&&e.isInPlace!==!0&&this.reset()});m(this,Xl,t=>{T1(t).isMainFrame!==!1&&this.reset()});d(this,Gl,t),d(this,No,e)}get currentGuid(){return o(this,An)}get lifecycleWindow(){return o(this,tr)}get trustState(){return{currentGuid:o(this,An),lifecycleWindow:o(this,tr)}}connect(){o(this,Br)||(d(this,Br,!0),window.addEventListener("message",o(this,Yl)),h(this,wt,Zu).call(this))}disconnect(){o(this,Br)&&(window.removeEventListener("message",o(this,Yl)),d(this,Br,!1),h(this,wt,Hu).call(this))}reset(){d(this,An,null),d(this,tr,null),o(this,No).call(this)}setCurrentFrame(t){if(t===o(this,Hr)){h(this,wt,Zu).call(this);return}h(this,wt,Hu).call(this),o(this,Hr)!==null&&this.reset(),d(this,Hr,EN(t)?t:null),h(this,wt,Zu).call(this)}}Gl=new WeakMap,No=new WeakMap,An=new WeakMap,tr=new WeakMap,Hr=new WeakMap,Vr=new WeakMap,Br=new WeakMap,Yl=new WeakMap,Jl=new WeakMap,Kl=new WeakMap,Xl=new WeakMap,wt=new WeakSet,zf=function(t,e,r){t.type==="bridge-ready"&&t.guid!==o(this,An)?(o(this,An)!==null&&o(this,No).call(this),d(this,An,t.guid),d(this,tr,e.tagName.toLowerCase()==="iframe"?e.contentWindow:null)):t.type==="leaving"&&t.guid===o(this,An)&&this.reset(),o(this,Gl).call(this,t,r)},Zu=function(){if(!o(this,Br))return;const t=o(this,Hr),e=(t==null?void 0:t.tagName.toLowerCase())==="webview"?t:null;e!==o(this,Vr)&&(h(this,wt,Hu).call(this),e&&(e.addEventListener("ipc-message",o(this,Jl)),e.addEventListener("did-start-navigation",o(this,Kl)),e.addEventListener("did-fail-load",o(this,Xl)),d(this,Vr,e)))},Hu=function(){const t=o(this,Vr);t&&(t.removeEventListener("ipc-message",o(this,Jl)),t.removeEventListener("did-start-navigation",o(this,Kl)),t.removeEventListener("did-fail-load",o(this,Xl)),d(this,Vr,null))};const C1="television-artifact-bridge";function $1(n){return x_(n)||P_(n)||L_(n)||D_(n)||O_(n)||M_(n)||N_(n)||z_(n)?n:null}function EN(n){if(!n)return!1;const t=n.tagName.toLowerCase();return t==="iframe"||t==="webview"}function kN(n){try{return new URL(n.getAttribute("src")??n.src,window.location.href).origin}catch{return null}}function T1(n){return n.detail??n}const CN="/views/url-unsupported/";class $N extends St{constructor(){super(...arguments);C(this,"_artifact",null);C(this,"_viewURL",null);C(this,"_contentURL",null);C(this,"_application",null);C(this,"_fullScreen",!1);C(this,"_inert",!1);C(this,"_onFullScreenChange",()=>{});C(this,"_connected",!1);C(this,"_deleteConfirmationOpen",!1);C(this,"_dialogPresentation",null);C(this,"_subscribedWebview",null);C(this,"_documentHost",null);C(this,"_pendingDocumentSource",null);C(this,"_rootRef",Dn());C(this,"_trustedChannel",new AN((e,r)=>{this.handleTrustedFrameMessage(e,r)},()=>{this._missingArtifactReplyTransport=null}));C(this,"_activeReloadFrameSrc",null);C(this,"_applicationSubscriptionsAttached",!1);C(this,"_proxyReloadVersion",0);C(this,"_navigationState",null);C(this,"_navigationArtifactId",null);C(this,"_navigationCanonicalURL",null);C(this,"_preserveFrameSrcOnNavigationRender",!1);C(this,"_missingArtifactReplyTransport",null);C(this,"handleNavigationChange",()=>{const e=this._preserveFrameSrcOnNavigationRender,r=!e;r&&!mr()?(this.renderArtifact({preserveFrameSrc:!0}),this.forceCurrentFrameSrc()):this.renderArtifact({preserveFrameSrc:e,resetTrust:r}),this._preserveFrameSrcOnNavigationRender=!1});C(this,"handleArtifactContentChanged",e=>{var s;const r=e.artifactID,i=this._artifact;!i||r!==i.id||i.kind!=="path"||typeof r=="string"&&((s=this._documentHost)!=null&&s.handleArtifactContentChanged(r))||this.reloadProxyFrame()});C(this,"handleThemeChanged",()=>{var e,r;((e=this._artifact)==null?void 0:e.kind)==="url"&&Wn(this._artifact.url)||(r=this._documentHost)!=null&&r.handleThemeChanged()||this.reloadProxyFrame()});C(this,"handleWebviewDidNavigate",e=>{this.handleWebviewNavigationEvent(e)});C(this,"handleWebviewDidNavigateInPage",e=>{if(e.isMainFrame===!1)return;this._preserveFrameSrcOnNavigationRender=!0,this.handleWebviewNavigationEvent(e)||(this._preserveFrameSrcOnNavigationRender=!1)});C(this,"captureDocumentHost",e=>{this._documentHost=e,this._pendingDocumentSource&&(e.assignSource(this._pendingDocumentSource),this.syncFrameSubscriptions())});C(this,"handleEmbedLoadChange",e=>{var r;(r=this._rootRef.value)==null||r.toggleAttribute("data-embed-loaded",e)});C(this,"handleDocumentFrameChange",e=>{e===null&&this.resetTrustedFrame(),this.syncFrameTitle(e),this._trustedChannel.setCurrentFrame(e),this.syncWebviewSubscription(e)});C(this,"handleTitleBarDoubleClick",e=>{const r=e.target;r instanceof Element&&r.closest("button")||this.requestFullScreen(!this._fullScreen)})}update(e,r){var u;const[i,s,a]=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 p=c?!IN(c,s):!0;if(p&&(this._activeReloadFrameSrc=null),this._artifact=s,this.syncNavigationState(),this._connected){if(this.renderArtifact({resetTrust:p}),l=!0,c&&xN(c,s)){const g=this.currentMissingArtifactMessage();g&&((u=this._missingArtifactReplyTransport)==null||u.send(g))}}else p&&this.resetTrustedFrame()}return this._viewURL!==a.viewURL&&(this._viewURL=a.viewURL,this.syncNavigationState(),this._connected?(this.renderArtifact({resetTrust:!0}),l=!0):this._trustedChannel.reset()),this._contentURL!==a.contentURL&&(this._contentURL=a.contentURL,this._connected&&(this.renderArtifact(),l=!0)),this._fullScreen!==a.fullScreen&&(this._fullScreen=a.fullScreen,this._connected&&this._artifact&&(this.renderArtifact({preserveFrameSrc:!0}),l=!0)),this._inert=a.inert,this._onFullScreenChange=a.onFullScreenChange,this._connected&&!l&&this.renderArtifact({preserveFrameSrc:!0}),super.update(e,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 e;this._connected=!1,(e=this._dialogPresentation)==null||e.withdraw(),this._dialogPresentation=null,this._deleteConfirmationOpen=!1,this.resetTrustedFrame(),this._trustedChannel.disconnect(),this.unsubscribeFromWebview(),this.syncNavigationState(),this.detachApplicationSubscriptions()}handleTrustedFrameMessage(e,r){var i;switch(e.type){case"url-target-request":r.send({type:U_,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(e);return;case"navigation-key":(i=this._application)==null||i.handleNavigationKey(e.key);return;case"artifact-pointer":this.handleArtifactPointer(e);return;case"bridge-ready":case"leaving":return}}handleArtifactPointer(e){const r=this.currentFrame;if(r===null||r.clientWidth<=0||r.clientHeight<=0)return;const i=r.getBoundingClientRect();sS({eventType:e.eventType,clientX:i.left+e.clientX*i.width/r.clientWidth,clientY:i.top+e.clientY*i.height/r.clientHeight,button:e.button,buttons:e.buttons})}currentExternalTargetURL(){var r,i;const e=((r=this._navigationState)==null?void 0:r.currentURL)??null;return e&&RN(e)?e:((i=this._artifact)==null?void 0:i.kind)==="url"?this._artifact.url:null}currentMissingArtifactMessage(){const e=this._artifact;return(e==null?void 0:e.kind)!=="path"?null:{type:F_,title:e.title,path:e.path}}handleProxyContentChanged(){var e;((e=this._artifact)==null?void 0:e.kind)!=="url"||!Wn(this._artifact.url)||this.reloadProxyFrame()}handleNavigationRequest(e){if(!Gv(e.url,window.location.href))return;this.syncNavigationState();const r=this._navigationState;if(!r)return;const i=this.convertIframeNavigationURL(e.url);if(i===CN||i===r.currentURL)return;const s=e.native===!0;(e.sameDocument||s)&&(this._preserveFrameSrcOnNavigationRender=!0),e.replace?r.replace(i):r.navigate(i)}syncNavigationState(){if(!this._connected||!this._artifact){this.disposeNavigationState();return}const e=this.canonicalURLForArtifact(this._artifact);this._navigationState&&this._navigationArtifactId===this._artifact.id&&this._navigationCanonicalURL===e||(this.disposeNavigationState(),this._navigationState=new L5(this._artifact.id,e),this._navigationArtifactId=this._artifact.id,this._navigationCanonicalURL=e,this._navigationState.addEventListener("change",this.handleNavigationChange),this._navigationState.currentURL!==null?this.renderArtifact():this._navigationState.canGoForward&&this.renderArtifact({preserveFrameSrc:!0}))}disposeNavigationState(){var e;(e=this._navigationState)==null||e.removeEventListener("change",this.handleNavigationChange),this._navigationState=null,this._navigationArtifactId=null,this._navigationCanonicalURL=null,this._preserveFrameSrcOnNavigationRender=!1}canonicalURLForArtifact(e){const r=zu({artifact:e,application:this._application,electron:mr(),viewURL:this._viewURL,contentURL:this._contentURL,currentURL:null}),i=r.viewURL;return e.kind==="url"&&Wn(e.url)||r.renderer==="url-webview"?gr(i):R1(i,i)}convertIframeNavigationURL(e){var r;return((r=this._artifact)==null?void 0:r.kind)==="url"&&Wn(this._artifact.url)&&Wn(e)?gr(e):R1(e,this._viewURL??this._navigationCanonicalURL??null)}handleWebviewNavigationEvent(e){const r=e.url;if(typeof r!="string"||!Gv(r,window.location.href))return!1;this.syncNavigationState();const i=this._navigationState;if(!i)return!1;const s=gr(r);return s===i.currentURL?!1:(i.navigate(s),!0)}syncWebviewSubscription(e=this.currentFrame){const r=(e==null?void 0:e.tagName.toLowerCase())==="webview"?e: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 e;return((e=this._documentHost)==null?void 0:e.currentFrame)??null}syncFrameSubscriptions(){const e=this.currentFrame;this.syncFrameTitle(e),this._trustedChannel.setCurrentFrame(e),this.syncWebviewSubscription(e)}syncFrameTitle(e){e&&this._artifact&&e.getAttribute("title")!==this._artifact.title&&e.setAttribute("title",this._artifact.title)}resetTrustedFrame(){this._missingArtifactReplyTransport=null,this._trustedChannel.reset()}assignDocumentSource(e={}){var p,g,v;const r=this._artifact;if(!r)return;e.resetTrust&&this.resetTrustedFrame();const i={artifact:r,application:this._application,electron:mr(),viewURL:this._viewURL,contentURL:this._contentURL,currentURL:((p=this._navigationState)==null?void 0:p.currentURL)??null},s=zu(i),a=(g=this.currentFrame)==null?void 0:g.getAttribute("src");let l=null;this._activeReloadFrameSrc&&(hS(this._activeReloadFrameSrc,s.viewURL)?l=this._activeReloadFrameSrc:this._activeReloadFrameSrc=null);const c=e.frameSrcOverride??l??(e.preserveFrameSrc&&a?a:s.viewURL),u={...i,frameSrcOverride:c};this._pendingDocumentSource=u,(v=this._documentHost)==null||v.assignSource(u),this.syncFrameSubscriptions()}reloadProxyFrame(){var a,l,c,u,p;const e=this.currentFrame;if(!e||e.hasAttribute("data-content-url")||e.tagName.toLowerCase()==="webview"&&!(((a=this._artifact)==null?void 0:a.kind)==="path"||((l=this._artifact)==null?void 0:l.kind)==="url"&&Wn(this._artifact.url)))return;const r=((c=this._artifact)==null?void 0:c.kind)==="url"&&Wn(this._artifact.url)?((u=this._navigationState)==null?void 0:u.currentURL)??e.getAttribute("src"):e.getAttribute("src");if(r===null)return;const i=new URL(r,window.location.href);i.searchParams.set(oa,String(++this._proxyReloadVersion));const s=r.startsWith("/")?`${i.pathname}${i.search}${i.hash}`:i.href;this._activeReloadFrameSrc=s,(p=this._rootRef.value)==null||p.removeAttribute("data-embed-loaded"),this.renderArtifact({frameSrcOverride:s,resetTrust:!0})}forceCurrentFrameSrc(){var s,a,l;if(!this._artifact)return;const e=zu({artifact:this._artifact,application:this._application,electron:mr(),viewURL:this._viewURL,contentURL:this._contentURL,currentURL:((s=this._navigationState)==null?void 0:s.currentURL)??null});if(e.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,(a=this._rootRef.value)==null||a.removeAttribute("data-embed-loaded"),i.setAttribute("src",e.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 i;const e=this._rootRef.value,r=e==null?void 0:e.querySelector(".artifact-menu-trigger");r&&((i=e==null?void 0:e.ownerDocument.querySelector(`tv-menu[trigger="${r.id}"]`))==null||i.removeAttribute("open"))}requestFullScreen(e){this.closeMenu(),this._onFullScreenChange(e)}showDeleteConfirmation(){var r,i,s;if(this._deleteConfirmationOpen)return;this.closeMenu(),this._deleteConfirmationOpen=!0,this.renderArtifact({preserveFrameSrc:!0});const e=(r=this._rootRef.value)==null?void 0:r.querySelector("dialog");e&&(this._dialogPresentation=wd(e,()=>this.dismissDeleteConfirmation()),(s=(i=this._rootRef.value)==null?void 0:i.querySelector(".dialog-actions button"))==null||s.focus())}dismissDeleteConfirmation(){const e=this._dialogPresentation;this._dialogPresentation=null,this._deleteConfirmationOpen=!1,e==null||e.withdraw(),this.isConnected&&this._artifact&&this.renderArtifact({preserveFrameSrc:!0})}confirmDelete(){var i;const e=(i=this._artifact)==null?void 0:i.id,r=this._application;this.dismissDeleteConfirmation(),!(!e||!r)&&r.deleteArtifact(e).catch(()=>{})}navigationControlsTemplate(){const e=this._navigationState;return!e||!e.canGoBack&&!e.canGoForward?null:B`
252
+ <button
253
+ icon
254
+ size="sm"
255
+ variant="ghost"
256
+ class="artifact-back"
257
+ ?disabled=${!e.canGoBack}
258
+ @click=${()=>e.back()}
259
+ aria-label="Back"
260
+ >
261
+ <tv-icon name="back" size="sm"></tv-icon>
262
+ </button>
263
+ <button
264
+ icon
265
+ size="sm"
266
+ variant="ghost"
267
+ class="artifact-forward"
268
+ ?disabled=${!e.canGoForward}
269
+ @click=${()=>e.forward()}
270
+ aria-label="Forward"
271
+ >
272
+ <tv-icon name="forward" size="sm"></tv-icon>
273
+ </button>
274
+ <span class="artifact-bar-divider" aria-hidden="true"></span>
275
+ `}deleteConfirmationTemplate(){return!this._deleteConfirmationOpen||!this._artifact?null:yd(B`
276
+ <div class="dialog-alert" role="alertdialog">
277
+ <h2>Delete “${this._artifact.title}”?</h2>
278
+ <p>It’s removed from this channel; the file or web page it points to is not deleted.</p>
279
+ <div class="dialog-actions">
280
+ <button @click=${()=>this.dismissDeleteConfirmation()}>Cancel</button>
281
+ <button intent="danger" @click=${()=>this.confirmDelete()}>Delete</button>
282
+ </div>
283
+ </div>
284
+ `)}template(e,r,i){const s=this._artifact;return B`
285
+ <div
286
+ class="artifact-view artifact-frame"
287
+ kind=${s.kind}
288
+ ?full-screen=${this._fullScreen}
289
+ ?inert=${this._inert}
290
+ ._trustedChannel=${this._trustedChannel}
291
+ ${ut(this._rootRef)}
292
+ >
293
+ <div class="artifact-frame-clip">
294
+ ${bN(this.captureDocumentHost,this.handleEmbedLoadChange,this.handleDocumentFrameChange)}
295
+ <footer class="artifact-title-bar" @dblclick=${this.handleTitleBarDoubleClick}>
296
+ <tv-icon name="artifact"></tv-icon>
297
+ <span class="artifact-title">${s.title}</span>
298
+ ${this.navigationControlsTemplate()}
299
+ ${L2(this.menuEntries(),{trigger:a=>B`
300
+ <button
301
+ icon
302
+ size="sm"
303
+ variant="ghost"
304
+ class="artifact-menu-trigger"
305
+ id=${a}
306
+ aria-label=${`${s.title} menu`}
307
+ >
308
+ <tv-icon name="expand"></tv-icon>
309
+ </button>
310
+ `})}
311
+ </footer>
312
+ </div>
313
+ ${this.deleteConfirmationTemplate()}
314
+ </div>
315
+ `}renderArtifact(e={}){this._artifact&&(this.assignDocumentSource({preserveFrameSrc:e.preserveFrameSrc??!1,frameSrcOverride:e.frameSrcOverride,resetTrust:e.resetTrust}),this.render(),e.forceFrameSrc&&this.forceCurrentFrameSrc(),this.syncFrameSubscriptions())}}const TN=_t($N);function RN(n){return n.startsWith("http://")||n.startsWith("https://")}function IN(n,t){return n.id!==t.id||n.kind!==t.kind?!1:n.kind==="path"&&t.kind==="path"?n.path===t.path:n.kind==="url"&&t.kind==="url"?hS(n.url,t.url):!0}function xN(n,t){return n.kind==="path"&&t.kind==="path"&&n.id===t.id&&(n.title!==t.title||n.path!==t.path)}function hS(n,t){try{const e=new URL(n,window.location.href),r=new URL(t,window.location.href);return e.searchParams.delete(oa),r.searchParams.delete(oa),e.origin===r.origin&&e.pathname===r.pathname&&e.search===r.search}catch{return!1}}function R1(n,t){try{const e=new URL(n,window.location.href);if(t){const r=new URL(t,window.location.href);if(e.origin!=="null"&&e.origin===r.origin)return e.searchParams.delete(oa),`${e.pathname}${e.search}${e.hash}`}}catch{return gr(n)}return gr(n)}function dS(n,t,e,r,i){const s=t.pages.map(a=>({artifactIds:[...a.artifactIds],geometry:{...a.geometry,full_screen:a===e?i:a.geometry.full_screen},size:a===e?{...r}:{...a.size}}));n.updateChannelPages(t.id,s).catch(()=>{})}function Uf(n,t,e,r){dS(n,t,e,e.size,r)}const PN=1280,LN=800,I1=.4,x1=.4,pS=280,DN=14,ON=45,MN=16,P1=64,NN=100,zN=1,UN=24,FN=230,ZN=230;function ag(n){return{width:1-I1+I1*n.width/PN,height:1-x1+x1*n.height/LN}}function fS(n){return{width:Math.min(FN,n.width),height:Math.min(ZN,n.height)}}function L1(n,t){const e=ag(t),r=fS(t);return{width:Math.min(t.width,Math.max(r.width,n.width*e.width)),height:Math.min(t.height,Math.max(r.height,n.height*e.height))}}function HN(n,t){const e=ag(t);return{width:n.width/e.width,height:n.height/e.height}}const D1=.5,su=2,VN=120,BN=["left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"];var es,En,zo,nr,Uo,ts,Wr,qr,jr,rr,ns,rs,kn,Fo,ir,Cn,Ye,is,Z,mS,gS,Ja,vS,Ka,Ff,Vu,yS,Ql,ec,tc,nc,ss,rc,Zf,on,Hf,Xs,wS,bS,Bu;class WN extends St{constructor(){super(...arguments);m(this,Z);m(this,es,Dn());m(this,En,Dn());m(this,zo);m(this,nr);m(this,Uo);m(this,ts);m(this,Wr);m(this,qr,0);m(this,jr,0);m(this,rr,null);m(this,ns,null);m(this,rs,null);m(this,kn,null);m(this,Fo,[]);m(this,ir,null);m(this,Cn,null);m(this,Ye,null);m(this,is,new Set);m(this,Ql,e=>{const r=o(this,Ye);!r||e.pointerId!==r.pointerId||(r.lastPointer={x:e.clientX,y:e.clientY},r.option=e.altKey,h(this,Z,Zf).call(this,r))});m(this,ec,e=>{var r;e.pointerId===((r=o(this,Ye))==null?void 0:r.pointerId)&&h(this,Z,on).call(this,!0)});m(this,tc,e=>{var r;e.pointerId===((r=o(this,Ye))==null?void 0:r.pointerId)&&h(this,Z,on).call(this,!1)});m(this,nc,e=>{var r;e.pointerId===((r=o(this,Ye))==null?void 0:r.pointerId)&&h(this,Z,on).call(this,!1)});m(this,ss,e=>{const r=o(this,Ye);if(r){if(e.type==="keydown"&&e.key==="Escape"){e.preventDefault(),h(this,Z,on).call(this,!1);return}r.option!==e.altKey&&(r.option=e.altKey,h(this,Z,Zf).call(this,r))}});m(this,rc,()=>{const e=o(this,Ye);!e||O1(h(this,Z,Ja).call(this,e.filmstrip),e.pageBox)||(h(this,Z,Ff).call(this),h(this,Z,on).call(this,!1))})}connected(){d(this,zo,void 0),d(this,nr,void 0),d(this,Uo,void 0),d(this,ts,void 0),d(this,Wr,void 0)}template(e,r,i){var z;const s=(i==null?void 0:i.channelId)===(r==null?void 0:r.id)?i:null,a=jN(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,p=(l==null?void 0:l.geometry.full_screen)??null,g=o(this,ts)!==void 0,v=a.map(({key:J,page:re})=>`${J}:${re.geometry.full_screen}:${re.size.width}:${re.size.height}`).sort().join("|"),y=s===null?null:a.map(({key:J})=>J).join("|"),E=c!==o(this,zo),A=u!==o(this,nr),x=p!==o(this,Uo),L=v!==o(this,ts),D=y!==o(this,Wr),F=s!==null&&o(this,Wr)!==void 0&&o(this,Wr)!==null&&D?h(this,Z,wS).call(this):null,G=A&&!E&&o(this,nr)!==void 0&&o(this,nr)!==null&&u!==null;return o(this,Ye)&&(E||A||x)&&h(this,Z,on).call(this,!1),d(this,zo,c),d(this,nr,u),d(this,Uo,p),d(this,ts,v),d(this,Wr,y),d(this,Fo,a),L&&g&&h(this,Z,Vu).call(this),E&&((z=o(this,kn))==null||z.disconnect(),d(this,ns,null),d(this,rs,null),d(this,ir,null)),queueMicrotask(()=>h(this,Z,Ka).call(this)),E||A||L?queueMicrotask(()=>h(this,Z,mS).call(this,u,G)):D&&queueMicrotask(()=>{const J=o(this,En).value;J&&(h(this,Z,Xs).call(this,J,u,!1),F&&h(this,Z,bS).call(this,F))}),B`
316
+ <section
317
+ class="stage"
318
+ ${ut(o(this,es))}
319
+ style=${`--handle-band: ${DN}px; --handle-reach: ${ON}px; --handle-thickness: ${MN}px;`}
320
+ >
321
+ ${r!==null&&a.length===0?B`
322
+ <div class="stage-empty">
323
+ <tv-icon name="artifact" size="xl"></tv-icon>
324
+ <p>No artifacts yet — ask your agent to put something here.</p>
325
+ </div>
326
+ `:null}
327
+ ${hh([c],J=>J,()=>B`
328
+ <div class="filmstrip" ${ut(o(this,En))}>
329
+ <div class="filmstrip-inner">
330
+ ${hh(a,({key:J})=>J,({page:J,artifact:re,key:At})=>{if(r===null)return null;const Me=At===u;return B`
331
+ <div
332
+ class="page"
333
+ data-page-key=${At}
334
+ ?selected=${Me}
335
+ ?full-screen=${J.geometry.full_screen}
336
+ style=${h(this,Z,vS).call(this,J)}
337
+ @click=${Me||re===null?null:()=>e.selectPage(r.id,re.id)}
338
+ >
339
+ ${re?TN(e,re,{viewURL:e.getArtifactViewURL(re),contentURL:e.getArtifactContentURL(re),fullScreen:J.geometry.full_screen,inert:!Me,onFullScreenChange:he=>Uf(e,r,J,he)}):null}
340
+ ${Me?B`
341
+ <div class="page-handles" aria-hidden="true">
342
+ ${BN.map(he=>B`
343
+ <span
344
+ class="page-handle ${he}"
345
+ @pointerdown=${Ne=>h(this,Z,yS).call(this,Ne,he,e,r,J,At)}
346
+ ></span>
347
+ `)}
348
+ </div>
349
+ `:null}
350
+ </div>
351
+ `})}
352
+ </div>
353
+ </div>
354
+ `)}
355
+ </section>
356
+ `}disconnected(){var e;h(this,Z,on).call(this,!1),h(this,Z,Vu).call(this),h(this,Z,Bu).call(this),cancelAnimationFrame(o(this,qr)),d(this,qr,0),(e=o(this,kn))==null||e.disconnect(),d(this,kn,null),d(this,ns,null),d(this,rs,null),d(this,ir,null),d(this,Fo,[]);for(const r of o(this,is))r.cancel();o(this,is).clear()}}es=new WeakMap,En=new WeakMap,zo=new WeakMap,nr=new WeakMap,Uo=new WeakMap,ts=new WeakMap,Wr=new WeakMap,qr=new WeakMap,jr=new WeakMap,rr=new WeakMap,ns=new WeakMap,rs=new WeakMap,kn=new WeakMap,Fo=new WeakMap,ir=new WeakMap,Cn=new WeakMap,Ye=new WeakMap,is=new WeakMap,Z=new WeakSet,mS=function(e,r){const i=o(this,En).value;i&&(cancelAnimationFrame(o(this,qr)),d(this,qr,requestAnimationFrame(()=>{d(this,qr,0),h(this,Z,Xs).call(this,i,e,r)})))},gS=function(e,r){var i;typeof ResizeObserver>"u"||e===o(this,ns)&&r===o(this,rs)||((i=o(this,kn))==null||i.disconnect(),d(this,ns,e),d(this,rs,r),d(this,kn,new ResizeObserver(()=>{const s=h(this,Z,Ja).call(this,e);O1(s,o(this,ir))||(h(this,Z,Ff).call(this),o(this,Ye)&&h(this,Z,on).call(this,!1),h(this,Z,Ka).call(this,e)),o(this,rr)===null&&h(this,Z,Xs).call(this,e,o(this,nr)??null,!1)})),o(this,kn).observe(e),o(this,kn).observe(r))},Ja=function(e){const r=Number.parseFloat(getComputedStyle(e).getPropertyValue("--page-inset"))||0;return{width:Math.max(0,e.clientWidth-2*r),height:Math.max(0,e.clientHeight-r)}},vS=function(e){if(e.geometry.full_screen||o(this,ir)===null)return"";const r=L1(e.size,o(this,ir));return`width: ${r.width}px; height: ${r.height}px;`},Ka=function(e=o(this,En).value){var s;if(!e)return;const r=h(this,Z,Ja).call(this,e);d(this,ir,r);const i=new Map(o(this,Fo).map(a=>[a.key,a.page]));for(const a of e.querySelectorAll(".page")){if(a===((s=o(this,Ye))==null?void 0:s.pageElement))continue;const l=i.get(a.dataset.pageKey??"");if(!l)continue;if(l.geometry.full_screen){a.style.width="",a.style.height="";continue}const c=L1(l.size,r);a.style.width=`${c.width}px`,a.style.height=`${c.height}px`}},Ff=function(){const e=o(this,es).value;e&&(e.setAttribute("window-tracking",""),o(this,Cn)!==null&&clearTimeout(o(this,Cn)),d(this,Cn,setTimeout(()=>{d(this,Cn,null),e.removeAttribute("window-tracking")},VN)))},Vu=function(){var e;o(this,Cn)!==null&&(clearTimeout(o(this,Cn)),d(this,Cn,null)),(e=o(this,es).value)==null||e.removeAttribute("window-tracking")},yS=function(e,r,i,s,a,l){if(e.button!==0||!e.isPrimary)return;const c=e.currentTarget,u=c.closest(".page"),p=o(this,En).value,g=o(this,es).value;if(!u||!p||!g)return;h(this,Z,on).call(this,!1),h(this,Z,Vu).call(this),e.preventDefault(),e.stopPropagation();const v=u.getBoundingClientRect(),y=h(this,Z,Ja).call(this,p),E=ag(y),A=a.geometry.full_screen,x=r.includes("left")||r.includes("right"),L=r.includes("top")||r.includes("bottom");d(this,Ye,{application:i,channel:s,page:a,pageKey:l,pageElement:u,filmstrip:p,stage:g,handle:c,pointerId:e.pointerId,startPointer:{x:e.clientX,y:e.clientY},lastPointer:{x:e.clientX,y:e.clientY},startRendered:{width:v.width,height:v.height},rendered:{width:v.width,height:v.height},baselineSize:A?{width:y.width/E.width,height:y.height/E.height}:{...a.size},pageBox:y,wasFullScreen:A,horizontal:x,vertical:L,leftish:r.includes("left"),topish:r.includes("top"),option:e.altKey,armed:!1,leftFullScreen:!1}),g.setAttribute("resizing",""),c.addEventListener("pointermove",o(this,Ql)),c.addEventListener("pointerup",o(this,ec)),c.addEventListener("pointercancel",o(this,tc)),c.addEventListener("lostpointercapture",o(this,nc)),window.addEventListener("keydown",o(this,ss)),window.addEventListener("keyup",o(this,ss)),window.addEventListener("resize",o(this,rc)),c.setPointerCapture(e.pointerId)},Ql=new WeakMap,ec=new WeakMap,tc=new WeakMap,nc=new WeakMap,ss=new WeakMap,rc=new WeakMap,Zf=function(e){const r=e.lastPointer.x!==e.startPointer.x||e.lastPointer.y!==e.startPointer.y;if(e.wasFullScreen&&!e.leftFullScreen){if(!r)return;e.leftFullScreen=!0,e.pageElement.removeAttribute("full-screen")}const i=fS(e.pageBox);let s=e.startRendered.width,a=e.startRendered.height;if(e.horizontal){const l=e.leftish?-su:su;s=Math.min(e.pageBox.width,Math.max(i.width,e.startRendered.width+(e.lastPointer.x-e.startPointer.x)*l))}if(e.vertical){const l=e.topish?-su:su;a=Math.min(e.pageBox.height,Math.max(i.height,e.startRendered.height+(e.lastPointer.y-e.startPointer.y)*l))}e.armed=!e.option&&e.horizontal&&e.vertical&&s>=e.pageBox.width-P1&&a>=e.pageBox.height-P1,e.rendered=e.armed?{...e.pageBox}:{width:s,height:a},e.pageElement.style.width=`${e.rendered.width}px`,e.pageElement.style.height=`${e.rendered.height}px`,h(this,Z,Hf).call(this,e.stage,e.armed),h(this,Z,Xs).call(this,e.filmstrip,e.pageKey,!1)},on=function(e){const r=o(this,Ye);if(r){if(d(this,Ye,null),r.handle.removeEventListener("pointermove",o(this,Ql)),r.handle.removeEventListener("pointerup",o(this,ec)),r.handle.removeEventListener("pointercancel",o(this,tc)),r.handle.removeEventListener("lostpointercapture",o(this,nc)),window.removeEventListener("keydown",o(this,ss)),window.removeEventListener("keyup",o(this,ss)),window.removeEventListener("resize",o(this,rc)),r.handle.hasPointerCapture(r.pointerId)&&r.handle.releasePointerCapture(r.pointerId),h(this,Z,Hf).call(this,r.stage,!1),e&&r.armed)r.wasFullScreen&&r.pageElement.setAttribute("full-screen",""),Uf(r.application,r.channel,r.page,!0);else if(e){const i={...r.baselineSize},s=HN(r.rendered,r.pageBox);let a=r.wasFullScreen&&r.leftFullScreen;r.horizontal&&r.rendered.width!==r.startRendered.width&&(i.width=s.width,a=!0),r.vertical&&r.rendered.height!==r.startRendered.height&&(i.height=s.height,a=!0),a?dS(r.application,r.channel,r.page,i,!1):h(this,Z,Ka).call(this,r.filmstrip)}else r.pageElement.toggleAttribute("full-screen",r.wasFullScreen),h(this,Z,Ka).call(this,r.filmstrip);r.pageElement.getBoundingClientRect(),r.stage.removeAttribute("resizing"),h(this,Z,Xs).call(this,r.filmstrip,r.pageKey,!1)}},Hf=function(e,r){const i=e.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"),e.append(s)},Xs=function(e,r,i){const s=[...e.querySelectorAll(".page")].find(v=>v.dataset.pageKey===r);if(!s){h(this,Z,Bu).call(this);return}h(this,Z,gS).call(this,e,s);const a=s.getBoundingClientRect(),l=e.getBoundingClientRect(),c=Math.max(0,Math.min(e.scrollLeft+a.left+a.width/2-(l.left+l.width/2),e.scrollWidth-e.clientWidth));if(h(this,Z,Bu).call(this),!i||Math.abs(c-e.scrollLeft)<D1||matchMedia("(prefers-reduced-motion: reduce)").matches){e.scrollLeft=c;return}const u=e.scrollLeft,p=e.animate([{},{}],{duration:pS,easing:"ease"});d(this,rr,p);const g=()=>{var y;if(p!==o(this,rr))return;const v=p.playState==="finished"?1:((y=p.effect)==null?void 0:y.getComputedTiming().progress)??0;e.scrollLeft=u+(c-u)*v,p.playState==="finished"?(e.scrollLeft=c,d(this,rr,null),d(this,jr,0)):d(this,jr,requestAnimationFrame(g))};d(this,jr,requestAnimationFrame(g))},wS=function(){const e=o(this,En).value;return e?new Map([...e.querySelectorAll(".page")].map(r=>[r.dataset.pageKey??"",r.getBoundingClientRect().left])):new Map},bS=function(e){const r=o(this,En).value;if(r)for(const i of r.querySelectorAll(".page")){if(i.hasAttribute("selected"))continue;const s=e.get(i.dataset.pageKey??"");if(s===void 0)continue;const a=s-i.getBoundingClientRect().left;if(Math.abs(a)<=D1)continue;const l=i.animate({translate:[`${a}px 0`,"0px 0"]},{duration:so,easing:"ease"});o(this,is).add(l),l.finished.finally(()=>{o(this,is).delete(l)}).catch(()=>{})}},Bu=function(){var e;cancelAnimationFrame(o(this,jr)),d(this,jr,0),(e=o(this,rr))==null||e.cancel(),d(this,rr,null)};const qN=_t(WN);function jN(n,t){if(!n||!t)return[];const e=new Map(n.artifacts.map(r=>[r.id,r]));return t.map((r,i)=>{const s=r.artifactIds[0];return{page:r,artifact:s===void 0?null:e.get(s)??null,key:s??`empty-page-${i}`}})}function O1(n,t){return t!==null&&n.width===t.width&&n.height===t.height}/**
357
+ * @license
358
+ * Copyright 2017 Google LLC
359
+ * SPDX-License-Identifier: BSD-3-Clause
360
+ */class Vf extends Lc{constructor(t){if(super(t),this.it=ie,t.type!==Ln.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===ie||t==null)return this._t=void 0,this.it=t;if(t===Ke)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}Vf.directiveName="unsafeHTML",Vf.resultType=1;const SS=ba(Vf);/*! @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:_S,setPrototypeOf:M1,isFrozen:GN,getPrototypeOf:YN,getOwnPropertyDescriptor:JN}=Object;let{freeze:Qe,seal:Nt,create:Wu}=Object,{apply:Bf,construct:Wf}=typeof Reflect<"u"&&Reflect;Qe||(Qe=function(t){return t});Nt||(Nt=function(t){return t});Bf||(Bf=function(t,e){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return t.apply(e,i)});Wf||(Wf=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return new t(...r)});const ou=et(Array.prototype.forEach),KN=et(Array.prototype.lastIndexOf),N1=et(Array.prototype.pop),xa=et(Array.prototype.push),XN=et(Array.prototype.splice),qu=et(String.prototype.toLowerCase),Sp=et(String.prototype.toString),_p=et(String.prototype.match),Pa=et(String.prototype.replace),QN=et(String.prototype.indexOf),ez=et(String.prototype.trim),dt=et(Object.prototype.hasOwnProperty),We=et(RegExp.prototype.test),La=tz(TypeError);function et(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return Bf(n,t,r)}}function tz(n){return function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Wf(n,e)}}function X(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:qu;M1&&M1(n,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const s=e(i);s!==i&&(GN(t)||(t[r]=s),i=s)}n[i]=!0}return n}function nz(n){for(let t=0;t<n.length;t++)dt(n,t)||(n[t]=null);return n}function an(n){const t=Wu(null);for(const[e,r]of _S(n))dt(n,e)&&(Array.isArray(r)?t[e]=nz(r):r&&typeof r=="object"&&r.constructor===Object?t[e]=an(r):t[e]=r);return t}function Da(n,t){for(;n!==null;){const r=JN(n,t);if(r){if(r.get)return et(r.get);if(typeof r.value=="function")return et(r.value)}n=YN(n)}function e(){return null}return e}const z1=Qe(["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"]),Ap=Qe(["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"]),Ep=Qe(["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"]),rz=Qe(["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"]),kp=Qe(["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"]),iz=Qe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),U1=Qe(["#text"]),F1=Qe(["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"]),Cp=Qe(["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"]),Z1=Qe(["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"]),au=Qe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),sz=Nt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),oz=Nt(/<%[\w\W]*|[\w\W]*%>/gm),az=Nt(/\$\{[\w\W]*/gm),lz=Nt(/^data-[\-\w.\u00B7-\uFFFF]+$/),cz=Nt(/^aria-[\-\w]+$/),AS=Nt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),uz=Nt(/^(?:\w+script|data):/i),hz=Nt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ES=Nt(/^html$/i),dz=Nt(/^[a-z][.\w]*(-[.\w]+)+$/i);var H1=Object.freeze({__proto__:null,ARIA_ATTR:cz,ATTR_WHITESPACE:hz,CUSTOM_ELEMENT:dz,DATA_ATTR:lz,DOCTYPE_NAME:ES,ERB_EXPR:oz,IS_ALLOWED_URI:AS,IS_SCRIPT_OR_DATA:uz,MUSTACHE_EXPR:sz,TMPLIT_EXPR:az});const Oa={element:1,text:3,progressingInstruction:7,comment:8,document:9},pz=function(){return typeof window>"u"?null:window},fz=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";e&&e.hasAttribute(i)&&(r=e.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},V1=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function kS(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:pz();const t=H=>kS(H);if(t.version="3.3.3",t.removed=[],!n||!n.document||n.document.nodeType!==Oa.document||!n.Element)return t.isSupported=!1,t;let{document:e}=n;const r=e,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:u,NamedNodeMap:p=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:g,DOMParser:v,trustedTypes:y}=n,E=c.prototype,A=Da(E,"cloneNode"),x=Da(E,"remove"),L=Da(E,"nextSibling"),D=Da(E,"childNodes"),V=Da(E,"parentNode");if(typeof a=="function"){const H=e.createElement("template");H.content&&H.content.ownerDocument&&(e=H.content.ownerDocument)}let F,G="";const{implementation:z,createNodeIterator:J,createDocumentFragment:re,getElementsByTagName:At}=e,{importNode:Me}=r;let he=V1();t.isSupported=typeof _S=="function"&&typeof V=="function"&&z&&z.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ne,ERB_EXPR:tt,TMPLIT_EXPR:Zt,DATA_ATTR:Is,ARIA_ATTR:Mc,IS_SCRIPT_OR_DATA:w_,ATTR_WHITESPACE:_g,CUSTOM_ELEMENT:b_}=H1;let{IS_ALLOWED_URI:Ag}=H1,Le=null;const Eg=X({},[...z1,...Ap,...Ep,...kp,...U1]);let ze=null;const kg=X({},[...F1,...Cp,...Z1,...au]);let _e=Object.seal(Wu(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}})),_a=null,Nc=null;const _r=Object.seal(Wu(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Cg=!0,Ad=!0,$g=!1,Tg=!0,xs=!1,zc=!0,yi=!1,Ed=!1,kd=!1,Ps=!1,Uc=!1,Fc=!1,Rg=!0,Ig=!1;const S_="user-content-";let Cd=!0,Aa=!1,Ls={},en=null;const $d=X({},["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 xg=null;const Pg=X({},["audio","video","img","source","image","track"]);let Td=null;const Lg=X({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Zc="http://www.w3.org/1998/Math/MathML",Hc="http://www.w3.org/2000/svg",Nn="http://www.w3.org/1999/xhtml";let Ds=Nn,Rd=!1,Id=null;const __=X({},[Zc,Hc,Nn],Sp);let Vc=X({},["mi","mo","mn","ms","mtext"]),Bc=X({},["annotation-xml"]);const A_=X({},["title","style","font","a","script"]);let Ea=null;const E_=["application/xhtml+xml","text/html"],k_="text/html";let Re=null,Os=null;const C_=e.createElement("form"),Dg=function(b){return b instanceof RegExp||b instanceof Function},xd=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Os&&Os===b)){if((!b||typeof b!="object")&&(b={}),b=an(b),Ea=E_.indexOf(b.PARSER_MEDIA_TYPE)===-1?k_:b.PARSER_MEDIA_TYPE,Re=Ea==="application/xhtml+xml"?Sp:qu,Le=dt(b,"ALLOWED_TAGS")?X({},b.ALLOWED_TAGS,Re):Eg,ze=dt(b,"ALLOWED_ATTR")?X({},b.ALLOWED_ATTR,Re):kg,Id=dt(b,"ALLOWED_NAMESPACES")?X({},b.ALLOWED_NAMESPACES,Sp):__,Td=dt(b,"ADD_URI_SAFE_ATTR")?X(an(Lg),b.ADD_URI_SAFE_ATTR,Re):Lg,xg=dt(b,"ADD_DATA_URI_TAGS")?X(an(Pg),b.ADD_DATA_URI_TAGS,Re):Pg,en=dt(b,"FORBID_CONTENTS")?X({},b.FORBID_CONTENTS,Re):$d,_a=dt(b,"FORBID_TAGS")?X({},b.FORBID_TAGS,Re):an({}),Nc=dt(b,"FORBID_ATTR")?X({},b.FORBID_ATTR,Re):an({}),Ls=dt(b,"USE_PROFILES")?b.USE_PROFILES:!1,Cg=b.ALLOW_ARIA_ATTR!==!1,Ad=b.ALLOW_DATA_ATTR!==!1,$g=b.ALLOW_UNKNOWN_PROTOCOLS||!1,Tg=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,xs=b.SAFE_FOR_TEMPLATES||!1,zc=b.SAFE_FOR_XML!==!1,yi=b.WHOLE_DOCUMENT||!1,Ps=b.RETURN_DOM||!1,Uc=b.RETURN_DOM_FRAGMENT||!1,Fc=b.RETURN_TRUSTED_TYPE||!1,kd=b.FORCE_BODY||!1,Rg=b.SANITIZE_DOM!==!1,Ig=b.SANITIZE_NAMED_PROPS||!1,Cd=b.KEEP_CONTENT!==!1,Aa=b.IN_PLACE||!1,Ag=b.ALLOWED_URI_REGEXP||AS,Ds=b.NAMESPACE||Nn,Vc=b.MATHML_TEXT_INTEGRATION_POINTS||Vc,Bc=b.HTML_INTEGRATION_POINTS||Bc,_e=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&Dg(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(_e.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&Dg(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(_e.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(_e.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),xs&&(Ad=!1),Uc&&(Ps=!0),Ls&&(Le=X({},U1),ze=Wu(null),Ls.html===!0&&(X(Le,z1),X(ze,F1)),Ls.svg===!0&&(X(Le,Ap),X(ze,Cp),X(ze,au)),Ls.svgFilters===!0&&(X(Le,Ep),X(ze,Cp),X(ze,au)),Ls.mathMl===!0&&(X(Le,kp),X(ze,Z1),X(ze,au))),dt(b,"ADD_TAGS")||(_r.tagCheck=null),dt(b,"ADD_ATTR")||(_r.attributeCheck=null),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?_r.tagCheck=b.ADD_TAGS:(Le===Eg&&(Le=an(Le)),X(Le,b.ADD_TAGS,Re))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?_r.attributeCheck=b.ADD_ATTR:(ze===kg&&(ze=an(ze)),X(ze,b.ADD_ATTR,Re))),b.ADD_URI_SAFE_ATTR&&X(Td,b.ADD_URI_SAFE_ATTR,Re),b.FORBID_CONTENTS&&(en===$d&&(en=an(en)),X(en,b.FORBID_CONTENTS,Re)),b.ADD_FORBID_CONTENTS&&(en===$d&&(en=an(en)),X(en,b.ADD_FORBID_CONTENTS,Re)),Cd&&(Le["#text"]=!0),yi&&X(Le,["html","head","body"]),Le.table&&(X(Le,["tbody"]),delete _a.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw La('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw La('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');F=b.TRUSTED_TYPES_POLICY,G=F.createHTML("")}else F===void 0&&(F=fz(y,i)),F!==null&&typeof G=="string"&&(G=F.createHTML(""));Qe&&Qe(b),Os=b}},Og=X({},[...Ap,...Ep,...rz]),Mg=X({},[...kp,...iz]),$_=function(b){let I=V(b);(!I||!I.tagName)&&(I={namespaceURI:Ds,tagName:"template"});const O=qu(b.tagName),fe=qu(I.tagName);return Id[b.namespaceURI]?b.namespaceURI===Hc?I.namespaceURI===Nn?O==="svg":I.namespaceURI===Zc?O==="svg"&&(fe==="annotation-xml"||Vc[fe]):!!Og[O]:b.namespaceURI===Zc?I.namespaceURI===Nn?O==="math":I.namespaceURI===Hc?O==="math"&&Bc[fe]:!!Mg[O]:b.namespaceURI===Nn?I.namespaceURI===Hc&&!Bc[fe]||I.namespaceURI===Zc&&!Vc[fe]?!1:!Mg[O]&&(A_[O]||!Og[O]):!!(Ea==="application/xhtml+xml"&&Id[b.namespaceURI]):!1},tn=function(b){xa(t.removed,{element:b});try{V(b).removeChild(b)}catch{x(b)}},wi=function(b,I){try{xa(t.removed,{attribute:I.getAttributeNode(b),from:I})}catch{xa(t.removed,{attribute:null,from:I})}if(I.removeAttribute(b),b==="is")if(Ps||Uc)try{tn(I)}catch{}else try{I.setAttribute(b,"")}catch{}},Ng=function(b){let I=null,O=null;if(kd)b="<remove></remove>"+b;else{const Ee=_p(b,/^[\r\n\t ]+/);O=Ee&&Ee[0]}Ea==="application/xhtml+xml"&&Ds===Nn&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const fe=F?F.createHTML(b):b;if(Ds===Nn)try{I=new v().parseFromString(fe,Ea)}catch{}if(!I||!I.documentElement){I=z.createDocument(Ds,"template",null);try{I.documentElement.innerHTML=Rd?G:fe}catch{}}const He=I.body||I.documentElement;return b&&O&&He.insertBefore(e.createTextNode(O),He.childNodes[0]||null),Ds===Nn?At.call(I,yi?"html":"body")[0]:yi?I.documentElement:He},zg=function(b){return J.call(b.ownerDocument||b,b,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Pd=function(b){return b instanceof g&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof p)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},Ug=function(b){return typeof l=="function"&&b instanceof l};function zn(H,b,I){ou(H,O=>{O.call(t,b,I,Os)})}const Fg=function(b){let I=null;if(zn(he.beforeSanitizeElements,b,null),Pd(b))return tn(b),!0;const O=Re(b.nodeName);if(zn(he.uponSanitizeElement,b,{tagName:O,allowedTags:Le}),zc&&b.hasChildNodes()&&!Ug(b.firstElementChild)&&We(/<[/\w!]/g,b.innerHTML)&&We(/<[/\w!]/g,b.textContent)||b.nodeType===Oa.progressingInstruction||zc&&b.nodeType===Oa.comment&&We(/<[/\w]/g,b.data))return tn(b),!0;if(!(_r.tagCheck instanceof Function&&_r.tagCheck(O))&&(!Le[O]||_a[O])){if(!_a[O]&&Hg(O)&&(_e.tagNameCheck instanceof RegExp&&We(_e.tagNameCheck,O)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(O)))return!1;if(Cd&&!en[O]){const fe=V(b)||b.parentNode,He=D(b)||b.childNodes;if(He&&fe){const Ee=He.length;for(let nt=Ee-1;nt>=0;--nt){const Un=A(He[nt],!0);Un.__removalCount=(b.__removalCount||0)+1,fe.insertBefore(Un,L(b))}}}return tn(b),!0}return b instanceof c&&!$_(b)||(O==="noscript"||O==="noembed"||O==="noframes")&&We(/<\/no(script|embed|frames)/i,b.innerHTML)?(tn(b),!0):(xs&&b.nodeType===Oa.text&&(I=b.textContent,ou([Ne,tt,Zt],fe=>{I=Pa(I,fe," ")}),b.textContent!==I&&(xa(t.removed,{element:b.cloneNode()}),b.textContent=I)),zn(he.afterSanitizeElements,b,null),!1)},Zg=function(b,I,O){if(Nc[I]||Rg&&(I==="id"||I==="name")&&(O in e||O in C_))return!1;if(!(Ad&&!Nc[I]&&We(Is,I))){if(!(Cg&&We(Mc,I))){if(!(_r.attributeCheck instanceof Function&&_r.attributeCheck(I,b))){if(!ze[I]||Nc[I]){if(!(Hg(b)&&(_e.tagNameCheck instanceof RegExp&&We(_e.tagNameCheck,b)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(b))&&(_e.attributeNameCheck instanceof RegExp&&We(_e.attributeNameCheck,I)||_e.attributeNameCheck instanceof Function&&_e.attributeNameCheck(I,b))||I==="is"&&_e.allowCustomizedBuiltInElements&&(_e.tagNameCheck instanceof RegExp&&We(_e.tagNameCheck,O)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(O))))return!1}else if(!Td[I]){if(!We(Ag,Pa(O,_g,""))){if(!((I==="src"||I==="xlink:href"||I==="href")&&b!=="script"&&QN(O,"data:")===0&&xg[b])){if(!($g&&!We(w_,Pa(O,_g,"")))){if(O)return!1}}}}}}}return!0},Hg=function(b){return b!=="annotation-xml"&&_p(b,b_)},Vg=function(b){zn(he.beforeSanitizeAttributes,b,null);const{attributes:I}=b;if(!I||Pd(b))return;const O={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ze,forceKeepAttr:void 0};let fe=I.length;for(;fe--;){const He=I[fe],{name:Ee,namespaceURI:nt,value:Un}=He,Ms=Re(Ee),Ld=Un;let Ue=Ee==="value"?Ld:ez(Ld);if(O.attrName=Ms,O.attrValue=Ue,O.keepAttr=!0,O.forceKeepAttr=void 0,zn(he.uponSanitizeAttribute,b,O),Ue=O.attrValue,Ig&&(Ms==="id"||Ms==="name")&&(wi(Ee,b),Ue=S_+Ue),zc&&We(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ue)){wi(Ee,b);continue}if(Ms==="attributename"&&_p(Ue,"href")){wi(Ee,b);continue}if(O.forceKeepAttr)continue;if(!O.keepAttr){wi(Ee,b);continue}if(!Tg&&We(/\/>/i,Ue)){wi(Ee,b);continue}xs&&ou([Ne,tt,Zt],Wg=>{Ue=Pa(Ue,Wg," ")});const Bg=Re(b.nodeName);if(!Zg(Bg,Ms,Ue)){wi(Ee,b);continue}if(F&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!nt)switch(y.getAttributeType(Bg,Ms)){case"TrustedHTML":{Ue=F.createHTML(Ue);break}case"TrustedScriptURL":{Ue=F.createScriptURL(Ue);break}}if(Ue!==Ld)try{nt?b.setAttributeNS(nt,Ee,Ue):b.setAttribute(Ee,Ue),Pd(b)?tn(b):N1(t.removed)}catch{wi(Ee,b)}}zn(he.afterSanitizeAttributes,b,null)},T_=function H(b){let I=null;const O=zg(b);for(zn(he.beforeSanitizeShadowDOM,b,null);I=O.nextNode();)zn(he.uponSanitizeShadowNode,I,null),Fg(I),Vg(I),I.content instanceof s&&H(I.content);zn(he.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(H){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=null,O=null,fe=null,He=null;if(Rd=!H,Rd&&(H="<!-->"),typeof H!="string"&&!Ug(H))if(typeof H.toString=="function"){if(H=H.toString(),typeof H!="string")throw La("dirty is not a string, aborting")}else throw La("toString is not a function");if(!t.isSupported)return H;if(Ed||xd(b),t.removed=[],typeof H=="string"&&(Aa=!1),Aa){if(H.nodeName){const Un=Re(H.nodeName);if(!Le[Un]||_a[Un])throw La("root node is forbidden and cannot be sanitized in-place")}}else if(H instanceof l)I=Ng("<!---->"),O=I.ownerDocument.importNode(H,!0),O.nodeType===Oa.element&&O.nodeName==="BODY"||O.nodeName==="HTML"?I=O:I.appendChild(O);else{if(!Ps&&!xs&&!yi&&H.indexOf("<")===-1)return F&&Fc?F.createHTML(H):H;if(I=Ng(H),!I)return Ps?null:Fc?G:""}I&&kd&&tn(I.firstChild);const Ee=zg(Aa?H:I);for(;fe=Ee.nextNode();)Fg(fe),Vg(fe),fe.content instanceof s&&T_(fe.content);if(Aa)return H;if(Ps){if(Uc)for(He=re.call(I.ownerDocument);I.firstChild;)He.appendChild(I.firstChild);else He=I;return(ze.shadowroot||ze.shadowrootmode)&&(He=Me.call(r,He,!0)),He}let nt=yi?I.outerHTML:I.innerHTML;return yi&&Le["!doctype"]&&I.ownerDocument&&I.ownerDocument.doctype&&I.ownerDocument.doctype.name&&We(ES,I.ownerDocument.doctype.name)&&(nt="<!DOCTYPE "+I.ownerDocument.doctype.name+`>
361
+ `+nt),xs&&ou([Ne,tt,Zt],Un=>{nt=Pa(nt,Un," ")}),F&&Fc?F.createHTML(nt):nt},t.setConfig=function(){let H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xd(H),Ed=!0},t.clearConfig=function(){Os=null,Ed=!1},t.isValidAttribute=function(H,b,I){Os||xd({});const O=Re(H),fe=Re(b);return Zg(O,fe,I)},t.addHook=function(H,b){typeof b=="function"&&xa(he[H],b)},t.removeHook=function(H,b){if(b!==void 0){const I=KN(he[H],b);return I===-1?void 0:XN(he[H],I,1)[0]}return N1(he[H])},t.removeHooks=function(H){he[H]=[]},t.removeAllHooks=function(){he=V1()},t}var CS=kS();function lg(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Rs=lg();function $S(n){Rs=n}var ki={exec:()=>null};function ne(n,t=""){let e=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(Xe.caret,"$1"),e=e.replace(i,a),r},getRegex:()=>new RegExp(e,t)};return r}var mz=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Xe={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)}}>`)},gz=/^(?:[ \t]*(?:\n|$))+/,vz=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,yz=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Oc=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,wz=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,cg=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,TS=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,RS=ne(TS).replace(/bull/g,cg).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(),bz=ne(TS).replace(/bull/g,cg).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(),ug=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Sz=/^[^\n]+/,hg=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,_z=ne(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",hg).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Az=ne(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,cg).getRegex(),bd="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",dg=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ez=ne("^ {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",dg).replace("tag",bd).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),IS=ne(ug).replace("hr",Oc).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",bd).getRegex(),kz=ne(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",IS).getRegex(),pg={blockquote:kz,code:vz,def:_z,fences:yz,heading:wz,hr:Oc,html:Ez,lheading:RS,list:Az,newline:gz,paragraph:IS,table:ki,text:Sz},B1=ne("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Oc).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",bd).getRegex(),Cz={...pg,lheading:bz,table:B1,paragraph:ne(ug).replace("hr",Oc).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",B1).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",bd).getRegex()},$z={...pg,html:ne(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",dg).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:ki,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ne(ug).replace("hr",Oc).replace("heading",` *#{1,6} *[^
362
+ ]`).replace("lheading",RS).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Tz=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Rz=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,xS=/^( {2,}|\\)\n(?!\s*$)/,Iz=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Sa=/[\p{P}\p{S}]/u,Sd=/[\s\p{P}\p{S}]/u,fg=/[^\s\p{P}\p{S}]/u,xz=ne(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Sd).getRegex(),PS=/(?!~)[\p{P}\p{S}]/u,Pz=/(?!~)[\s\p{P}\p{S}]/u,Lz=/(?:[^\s\p{P}\p{S}]|~)/u,Dz=ne(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",mz?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),LS=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Oz=ne(LS,"u").replace(/punct/g,Sa).getRegex(),Mz=ne(LS,"u").replace(/punct/g,PS).getRegex(),DS="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Nz=ne(DS,"gu").replace(/notPunctSpace/g,fg).replace(/punctSpace/g,Sd).replace(/punct/g,Sa).getRegex(),zz=ne(DS,"gu").replace(/notPunctSpace/g,Lz).replace(/punctSpace/g,Pz).replace(/punct/g,PS).getRegex(),Uz=ne("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,fg).replace(/punctSpace/g,Sd).replace(/punct/g,Sa).getRegex(),Fz=ne(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Sa).getRegex(),Zz="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Hz=ne(Zz,"gu").replace(/notPunctSpace/g,fg).replace(/punctSpace/g,Sd).replace(/punct/g,Sa).getRegex(),Vz=ne(/\\(punct)/,"gu").replace(/punct/g,Sa).getRegex(),Bz=ne(/^<(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(),Wz=ne(dg).replace("(?:-->|$)","-->").getRegex(),qz=ne("^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",Wz).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),gh=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,jz=ne(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",gh).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),OS=ne(/^!?\[(label)\]\[(ref)\]/).replace("label",gh).replace("ref",hg).getRegex(),MS=ne(/^!?\[(ref)\](?:\[\])?/).replace("ref",hg).getRegex(),Gz=ne("reflink|nolink(?!\\()","g").replace("reflink",OS).replace("nolink",MS).getRegex(),W1=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,mg={_backpedal:ki,anyPunctuation:Vz,autolink:Bz,blockSkip:Dz,br:xS,code:Rz,del:ki,delLDelim:ki,delRDelim:ki,emStrongLDelim:Oz,emStrongRDelimAst:Nz,emStrongRDelimUnd:Uz,escape:Tz,link:jz,nolink:MS,punctuation:xz,reflink:OS,reflinkSearch:Gz,tag:qz,text:Iz,url:ki},Yz={...mg,link:ne(/^!?\[(label)\]\((.*?)\)/).replace("label",gh).getRegex(),reflink:ne(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",gh).getRegex()},qf={...mg,emStrongRDelimAst:zz,emStrongLDelim:Mz,delLDelim:Fz,delRDelim:Hz,url:ne(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",W1).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:ne(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",W1).getRegex()},Jz={...qf,br:ne(xS).replace("{2,}","*").getRegex(),text:ne(qf.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},lu={normal:pg,gfm:Cz,pedantic:$z},Ma={normal:mg,gfm:qf,breaks:Jz,pedantic:Yz},Kz={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},q1=n=>Kz[n];function ln(n,t){if(t){if(Xe.escapeTest.test(n))return n.replace(Xe.escapeReplace,q1)}else if(Xe.escapeTestNoEncode.test(n))return n.replace(Xe.escapeReplaceNoEncode,q1);return n}function j1(n){try{n=encodeURI(n).replace(Xe.percentDecode,"%")}catch{return null}return n}function G1(n,t){var s;let e=n.replace(Xe.findPipe,(a,l,c)=>{let u=!1,p=l;for(;--p>=0&&c[p]==="\\";)u=!u;return u?"|":" |"}),r=e.split(Xe.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Xe.slashPipe,"|");return r}function Na(n,t,e){let r=n.length;if(r===0)return"";let i=0;for(;i<r&&n.charAt(r-i-1)===t;)i++;return n.slice(0,r-i)}function Xz(n,t){if(n.indexOf(t[1])===-1)return-1;let e=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===t[0])e++;else if(n[r]===t[1]&&(e--,e<0))return r;return e>0?-2:-1}function Qz(n,t=0){let e=t,r="";for(let i of n)if(i===" "){let s=4-e%4;r+=" ".repeat(s),e+=s}else r+=i,e++;return r}function Y1(n,t,e,r,i){let s=t.href,a=t.title||null,l=n[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:n[0].charAt(0)==="!"?"image":"link",raw:e,href:s,title:a,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,c}function e9(n,t,e){let r=n.match(e.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
363
+ `).map(s=>{let a=s.match(e.other.beginningSpace);if(a===null)return s;let[l]=a;return l.length>=i.length?s.slice(i.length):s}).join(`
364
+ `)}var vh=class{constructor(n){C(this,"options");C(this,"rules");C(this,"lexer");this.options=n||Rs}space(n){let t=this.rules.block.newline.exec(n);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(n){let t=this.rules.block.code.exec(n);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:Na(e,`
365
+ `)}}}fences(n){let t=this.rules.block.fences.exec(n);if(t){let e=t[0],r=e9(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(n){let t=this.rules.block.heading.exec(n);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let r=Na(e,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(e=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(n){let t=this.rules.block.hr.exec(n);if(t)return{type:"hr",raw:Na(t[0],`
366
+ `)}}blockquote(n){let t=this.rules.block.blockquote.exec(n);if(t){let e=Na(t[0],`
367
+ `).split(`
368
+ `),r="",i="",s=[];for(;e.length>0;){let a=!1,l=[],c;for(c=0;c<e.length;c++)if(this.rules.other.blockquoteStart.test(e[c]))l.push(e[c]),a=!0;else if(!a)l.push(e[c]);else break;e=e.slice(c);let u=l.join(`
369
+ `),p=u.replace(this.rules.other.blockquoteSetextReplace,`
370
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
371
+ ${u}`:u,i=i?`${i}
372
+ ${p}`:p;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,s,!0),this.lexer.state.top=g,e.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,E=y.raw+`
373
+ `+e.join(`
374
+ `),A=this.blockquote(E);s[s.length-1]=A,r=r.substring(0,r.length-y.raw.length)+A.raw,i=i.substring(0,i.length-y.text.length)+A.text;break}else if((v==null?void 0:v.type)==="list"){let y=v,E=y.raw+`
375
+ `+e.join(`
376
+ `),A=this.list(E);s[s.length-1]=A,r=r.substring(0,r.length-v.raw.length)+A.raw,i=i.substring(0,i.length-y.raw.length)+A.raw,e=E.substring(s.at(-1).raw.length).split(`
377
+ `);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(n){var e,r;let t=this.rules.block.list.exec(n);if(t){let i=t[1].trim(),s=i.length>1,a={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 p=!1,g="",v="";if(!(t=l.exec(n))||this.rules.block.hr.test(n))break;g=t[0],n=n.substring(g.length);let y=Qz(t[2].split(`
378
+ `,1)[0],t[1].length),E=n.split(`
379
+ `,1)[0],A=!y.trim(),x=0;if(this.options.pedantic?(x=2,v=y.trimStart()):A?x=t[1].length+1:(x=y.search(this.rules.other.nonSpaceChar),x=x>4?1:x,v=y.slice(x),x+=t[1].length),A&&this.rules.other.blankLine.test(E)&&(g+=E+`
380
+ `,n=n.substring(E.length+1),p=!0),!p){let L=this.rules.other.nextBulletRegex(x),D=this.rules.other.hrRegex(x),V=this.rules.other.fencesBeginRegex(x),F=this.rules.other.headingBeginRegex(x),G=this.rules.other.htmlBeginRegex(x),z=this.rules.other.blockquoteBeginRegex(x);for(;n;){let J=n.split(`
381
+ `,1)[0],re;if(E=J,this.options.pedantic?(E=E.replace(this.rules.other.listReplaceNesting," "),re=E):re=E.replace(this.rules.other.tabCharGlobal," "),V.test(E)||F.test(E)||G.test(E)||z.test(E)||L.test(E)||D.test(E))break;if(re.search(this.rules.other.nonSpaceChar)>=x||!E.trim())v+=`
382
+ `+re.slice(x);else{if(A||y.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||V.test(y)||F.test(y)||D.test(y))break;v+=`
383
+ `+E}A=!E.trim(),g+=J+`
384
+ `,n=n.substring(J.length+1),y=re.slice(x)}}a.loose||(c?a.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),a.items.push({type:"list_item",raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(v),loose:!1,text:v,tokens:[]}),a.raw+=g}let u=a.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let p of a.items){if(this.lexer.state.top=!1,p.tokens=this.lexer.blockTokens(p.text,[]),p.task){if(p.text=p.text.replace(this.rules.other.listReplaceTask,""),((e=p.tokens[0])==null?void 0:e.type)==="text"||((r=p.tokens[0])==null?void 0:r.type)==="paragraph"){p.tokens[0].raw=p.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),p.tokens[0].text=p.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 g=this.rules.other.listTaskCheckbox.exec(p.raw);if(g){let v={type:"checkbox",raw:g[0]+" ",checked:g[0]!=="[ ]"};p.checked=v.checked,a.loose?p.tokens[0]&&["paragraph","text"].includes(p.tokens[0].type)&&"tokens"in p.tokens[0]&&p.tokens[0].tokens?(p.tokens[0].raw=v.raw+p.tokens[0].raw,p.tokens[0].text=v.raw+p.tokens[0].text,p.tokens[0].tokens.unshift(v)):p.tokens.unshift({type:"paragraph",raw:v.raw,text:v.raw,tokens:[v]}):p.tokens.unshift(v)}}if(!a.loose){let g=p.tokens.filter(y=>y.type==="space"),v=g.length>0&&g.some(y=>this.rules.other.anyLine.test(y.raw));a.loose=v}}if(a.loose)for(let p of a.items){p.loose=!0;for(let g of p.tokens)g.type==="text"&&(g.type="paragraph")}return a}}html(n){let t=this.rules.block.html.exec(n);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(n){let t=this.rules.block.def.exec(n);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:r,title:i}}}table(n){var a;let t=this.rules.block.table.exec(n);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let e=G1(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
385
+ `):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(e.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<e.length;l++)s.header.push({text:e[l],tokens:this.lexer.inline(e[l]),header:!0,align:s.align[l]});for(let l of i)s.rows.push(G1(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 t=this.rules.block.lheading.exec(n);if(t){let e=t[1].trim();return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(n){let t=this.rules.block.paragraph.exec(n);if(t){let e=t[1].charAt(t[1].length-1)===`
386
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(n){let t=this.rules.block.text.exec(n);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(n){let t=this.rules.inline.escape.exec(n);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(n){let t=this.rules.inline.tag.exec(n);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(n){let t=this.rules.inline.link.exec(n);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let s=Na(e.slice(0,-1),"\\");if((e.length-s.length)%2===0)return}else{let s=Xz(t[2],"()");if(s===-2)return;if(s>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?r=r.slice(1):r=r.slice(1,-1)),Y1(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(n,t){let e;if((e=this.rules.inline.reflink.exec(n))||(e=this.rules.inline.nolink.exec(n))){let r=(e[2]||e[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){let s=e[0].charAt(0);return{type:"text",raw:s,text:s}}return Y1(e,i,e[0],this.lexer,this.rules)}}emStrong(n,t,e=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&e.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!e||this.rules.inline.punctuation.exec(e))){let i=[...r[0]].length-1,s,a,l=i,c=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*n.length+i);(r=u.exec(t))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(a=[...s].length,r[3]||r[4]){l+=a;continue}else if((r[5]||r[6])&&i%3&&!((i+a)%3)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);let p=[...r[0]][0].length,g=n.slice(0,i+r.index+p+a);if(Math.min(i,a)%2){let y=g.slice(1,-1);return{type:"em",raw:g,text:y,tokens:this.lexer.inlineTokens(y)}}let v=g.slice(2,-2);return{type:"strong",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(n){let t=this.rules.inline.code.exec(n);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(e),i=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return r&&i&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(n){let t=this.rules.inline.br.exec(n);if(t)return{type:"br",raw:t[0]}}del(n,t,e=""){let r=this.rules.inline.delLDelim.exec(n);if(r&&(!r[1]||!e||this.rules.inline.punctuation.exec(e))){let i=[...r[0]].length-1,s,a,l=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,t=t.slice(-1*n.length+i);(r=c.exec(t))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(a=[...s].length,a!==i))continue;if(r[3]||r[4]){l+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l);let u=[...r[0]][0].length,p=n.slice(0,i+r.index+u+a),g=p.slice(i,-i);return{type:"del",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(n){let t=this.rules.inline.autolink.exec(n);if(t){let e,r;return t[2]==="@"?(e=t[1],r="mailto:"+e):(e=t[1],r=e),{type:"link",raw:t[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}url(n){var e;let t;if(t=this.rules.inline.url.exec(n)){let r,i;if(t[2]==="@")r=t[0],i="mailto:"+r;else{let s;do s=t[0],t[0]=((e=this.rules.inline._backpedal.exec(t[0]))==null?void 0:e[0])??"";while(s!==t[0]);r=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let t=this.rules.inline.text.exec(n);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},Yt=class jf{constructor(t){C(this,"tokens");C(this,"options");C(this,"state");C(this,"inlineQueue");C(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Rs,this.options.tokenizer=this.options.tokenizer||new vh,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 e={other:Xe,block:lu.normal,inline:Ma.normal};this.options.pedantic?(e.block=lu.pedantic,e.inline=Ma.pedantic):this.options.gfm&&(e.block=lu.gfm,this.options.breaks?e.inline=Ma.breaks:e.inline=Ma.gfm),this.tokenizer.rules=e}static get rules(){return{block:lu,inline:Ma}}static lex(t,e){return new jf(e).lex(t)}static lexInline(t,e){return new jf(e).inlineTokens(t)}lex(t){t=t.replace(Xe.carriageReturn,`
387
+ `),this.blockTokens(t,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let r=this.inlineQueue[e];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,e=[],r=!1){var i,s,a;for(this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(Xe.tabCharGlobal," ").replace(Xe.spaceLine,""));t;){let l;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(u=>(l=u.call({lexer:this},t,e))?(t=t.substring(l.raw.length),e.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);let u=e.at(-1);l.raw.length===1&&u!==void 0?u.raw+=`
388
+ `:e.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);let u=e.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
389
+ `)?"":`
390
+ `)+l.raw,u.text+=`
391
+ `+l.text,this.inlineQueue.at(-1).src=u.text):e.push(l);continue}if(l=this.tokenizer.fences(t)){t=t.substring(l.raw.length),e.push(l);continue}if(l=this.tokenizer.heading(t)){t=t.substring(l.raw.length),e.push(l);continue}if(l=this.tokenizer.hr(t)){t=t.substring(l.raw.length),e.push(l);continue}if(l=this.tokenizer.blockquote(t)){t=t.substring(l.raw.length),e.push(l);continue}if(l=this.tokenizer.list(t)){t=t.substring(l.raw.length),e.push(l);continue}if(l=this.tokenizer.html(t)){t=t.substring(l.raw.length),e.push(l);continue}if(l=this.tokenizer.def(t)){t=t.substring(l.raw.length);let u=e.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
392
+ `)?"":`
393
+ `)+l.raw,u.text+=`
394
+ `+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},e.push(l));continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),e.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),e.push(l);continue}let c=t;if((a=this.options.extensions)!=null&&a.startBlock){let u=1/0,p=t.slice(1),g;this.options.extensions.startBlock.forEach(v=>{g=v.call({lexer:this},p),typeof g=="number"&&g>=0&&(u=Math.min(u,g))}),u<1/0&&u>=0&&(c=t.substring(0,u+1))}if(this.state.top&&(l=this.tokenizer.paragraph(c))){let u=e.at(-1);r&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(`
395
+ `)?"":`
396
+ `)+l.raw,u.text+=`
397
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):e.push(l),r=c.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);let u=e.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
398
+ `)?"":`
399
+ `)+l.raw,u.text+=`
400
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):e.push(l);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,e}inline(t,e=[]){return this.inlineQueue.push({src:t,tokens:e}),e}inlineTokens(t,e=[]){var c,u,p,g,v;this.tokenizer.lexer=this;let r=t,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 a=!1,l="";for(;t;){a||(l=""),a=!1;let y;if((g=(p=this.options.extensions)==null?void 0:p.inline)!=null&&g.some(A=>(y=A.call({lexer:this},t,e))?(t=t.substring(y.raw.length),e.push(y),!0):!1))continue;if(y=this.tokenizer.escape(t)){t=t.substring(y.raw.length),e.push(y);continue}if(y=this.tokenizer.tag(t)){t=t.substring(y.raw.length),e.push(y);continue}if(y=this.tokenizer.link(t)){t=t.substring(y.raw.length),e.push(y);continue}if(y=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(y.raw.length);let A=e.at(-1);y.type==="text"&&(A==null?void 0:A.type)==="text"?(A.raw+=y.raw,A.text+=y.text):e.push(y);continue}if(y=this.tokenizer.emStrong(t,r,l)){t=t.substring(y.raw.length),e.push(y);continue}if(y=this.tokenizer.codespan(t)){t=t.substring(y.raw.length),e.push(y);continue}if(y=this.tokenizer.br(t)){t=t.substring(y.raw.length),e.push(y);continue}if(y=this.tokenizer.del(t,r,l)){t=t.substring(y.raw.length),e.push(y);continue}if(y=this.tokenizer.autolink(t)){t=t.substring(y.raw.length),e.push(y);continue}if(!this.state.inLink&&(y=this.tokenizer.url(t))){t=t.substring(y.raw.length),e.push(y);continue}let E=t;if((v=this.options.extensions)!=null&&v.startInline){let A=1/0,x=t.slice(1),L;this.options.extensions.startInline.forEach(D=>{L=D.call({lexer:this},x),typeof L=="number"&&L>=0&&(A=Math.min(A,L))}),A<1/0&&A>=0&&(E=t.substring(0,A+1))}if(y=this.tokenizer.inlineText(E)){t=t.substring(y.raw.length),y.raw.slice(-1)!=="_"&&(l=y.raw.slice(-1)),a=!0;let A=e.at(-1);(A==null?void 0:A.type)==="text"?(A.raw+=y.raw,A.text+=y.text):e.push(y);continue}if(t){let A="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(A);break}else throw new Error(A)}}return e}},yh=class{constructor(n){C(this,"options");C(this,"parser");this.options=n||Rs}space(n){return""}code({text:n,lang:t,escaped:e}){var s;let r=(s=(t||"").match(Xe.notSpaceStart))==null?void 0:s[0],i=n.replace(Xe.endingNewline,"")+`
401
+ `;return r?'<pre><code class="language-'+ln(r)+'">'+(e?i:ln(i,!0))+`</code></pre>
402
+ `:"<pre><code>"+(e?i:ln(i,!0))+`</code></pre>
403
+ `}blockquote({tokens:n}){return`<blockquote>
404
+ ${this.parser.parse(n)}</blockquote>
405
+ `}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:t}){return`<h${t}>${this.parser.parseInline(n)}</h${t}>
406
+ `}hr(n){return`<hr>
407
+ `}list(n){let t=n.ordered,e=n.start,r="";for(let a=0;a<n.items.length;a++){let l=n.items[a];r+=this.listitem(l)}let i=t?"ol":"ul",s=t&&e!==1?' start="'+e+'"':"";return"<"+i+s+`>
408
+ `+r+"</"+i+`>
409
+ `}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
410
+ `}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
411
+ `}table(n){let t="",e="";for(let i=0;i<n.header.length;i++)e+=this.tablecell(n.header[i]);t+=this.tablerow({text:e});let r="";for(let i=0;i<n.rows.length;i++){let s=n.rows[i];e="";for(let a=0;a<s.length;a++)e+=this.tablecell(s[a]);r+=this.tablerow({text:e})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
412
+ <thead>
413
+ `+t+`</thead>
414
+ `+r+`</table>
415
+ `}tablerow({text:n}){return`<tr>
416
+ ${n}</tr>
417
+ `}tablecell(n){let t=this.parser.parseInline(n.tokens),e=n.header?"th":"td";return(n.align?`<${e} align="${n.align}">`:`<${e}>`)+t+`</${e}>
418
+ `}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>${ln(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:t,tokens:e}){let r=this.parser.parseInline(e),i=j1(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return t&&(s+=' title="'+ln(t)+'"'),s+=">"+r+"</a>",s}image({href:n,title:t,text:e,tokens:r}){r&&(e=this.parser.parseInline(r,this.parser.textRenderer));let i=j1(n);if(i===null)return ln(e);n=i;let s=`<img src="${n}" alt="${ln(e)}"`;return t&&(s+=` title="${ln(t)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:ln(n.text)}},gg=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}},Jt=class Gf{constructor(t){C(this,"options");C(this,"renderer");C(this,"textRenderer");this.options=t||Rs,this.options.renderer=this.options.renderer||new yh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new gg}static parse(t,e){return new Gf(e).parse(t)}static parseInline(t,e){return new Gf(e).parseInline(t)}parse(t){var r,i;this.renderer.parser=this;let e="";for(let s=0;s<t.length;s++){let a=t[s];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[a.type]){let c=a,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)){e+=u||"";continue}}let l=a;switch(l.type){case"space":{e+=this.renderer.space(l);break}case"hr":{e+=this.renderer.hr(l);break}case"heading":{e+=this.renderer.heading(l);break}case"code":{e+=this.renderer.code(l);break}case"table":{e+=this.renderer.table(l);break}case"blockquote":{e+=this.renderer.blockquote(l);break}case"list":{e+=this.renderer.list(l);break}case"checkbox":{e+=this.renderer.checkbox(l);break}case"html":{e+=this.renderer.html(l);break}case"def":{e+=this.renderer.def(l);break}case"paragraph":{e+=this.renderer.paragraph(l);break}case"text":{e+=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 e}parseInline(t,e=this.renderer){var i,s;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let l=t[a];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+=e.text(c);break}case"html":{r+=e.html(c);break}case"link":{r+=e.link(c);break}case"image":{r+=e.image(c);break}case"checkbox":{r+=e.checkbox(c);break}case"strong":{r+=e.strong(c);break}case"em":{r+=e.em(c);break}case"codespan":{r+=e.codespan(c);break}case"br":{r+=e.br(c);break}case"del":{r+=e.del(c);break}case"text":{r+=e.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}},fu,Xa=(fu=class{constructor(n){C(this,"options");C(this,"block");this.options=n||Rs}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?Yt.lex:Yt.lexInline}provideParser(){return this.block?Jt.parse:Jt.parseInline}},C(fu,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),C(fu,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),fu),t9=class{constructor(...n){C(this,"defaults",lg());C(this,"options",this.setOptions);C(this,"parse",this.parseMarkdown(!0));C(this,"parseInline",this.parseMarkdown(!1));C(this,"Parser",Jt);C(this,"Renderer",yh);C(this,"TextRenderer",gg);C(this,"Lexer",Yt);C(this,"Tokenizer",vh);C(this,"Hooks",Xa);this.use(...n)}walkTokens(n,t){var r,i;let e=[];for(let s of n)switch(e=e.concat(t.call(this,s)),s.type){case"table":{let a=s;for(let l of a.header)e=e.concat(this.walkTokens(l.tokens,t));for(let l of a.rows)for(let c of l)e=e.concat(this.walkTokens(c.tokens,t));break}case"list":{let a=s;e=e.concat(this.walkTokens(a.items,t));break}default:{let a=s;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{let c=a[l].flat(1/0);e=e.concat(this.walkTokens(c,t))}):a.tokens&&(e=e.concat(this.walkTokens(a.tokens,t)))}}return e}use(...n){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(e=>{let r={...e};if(r.async=this.defaults.async||r.async||!1,e.extensions&&(e.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=t.renderers[i.name];s?t.renderers[i.name]=function(...a){let l=i.renderer.apply(this,a);return l===!1&&(l=s.apply(this,a)),l}:t.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=t[i.level];s?s.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),r.extensions=t),e.renderer){let i=this.defaults.renderer||new yh(this.defaults);for(let s in e.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,l=e.renderer[a],c=i[a];i[a]=(...u)=>{let p=l.apply(i,u);return p===!1&&(p=c.apply(i,u)),p||""}}r.renderer=i}if(e.tokenizer){let i=this.defaults.tokenizer||new vh(this.defaults);for(let s in e.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,l=e.tokenizer[a],c=i[a];i[a]=(...u)=>{let p=l.apply(i,u);return p===!1&&(p=c.apply(i,u)),p}}r.tokenizer=i}if(e.hooks){let i=this.defaults.hooks||new Xa;for(let s in e.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,l=e.hooks[a],c=i[a];Xa.passThroughHooks.has(s)?i[a]=u=>{if(this.defaults.async&&Xa.passThroughHooksRespectAsync.has(s))return(async()=>{let g=await l.call(i,u);return c.call(i,g)})();let p=l.call(i,u);return c.call(i,p)}:i[a]=(...u)=>{if(this.defaults.async)return(async()=>{let g=await l.apply(i,u);return g===!1&&(g=await c.apply(i,u)),g})();let p=l.apply(i,u);return p===!1&&(p=c.apply(i,u)),p}}r.hooks=i}if(e.walkTokens){let i=this.defaults.walkTokens,s=e.walkTokens;r.walkTokens=function(a){let l=[];return l.push(s.call(this,a)),i&&(l=l.concat(i.call(this,a))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,t){return Yt.lex(n,t??this.defaults)}parser(n,t){return Jt.parse(n,t??this.defaults)}parseMarkdown(n){return(t,e)=>{let r={...e},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 t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=n),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(t):t,l=await(i.hooks?await i.hooks.provideLexer():n?Yt.lex:Yt.lexInline)(a,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?Jt.parse:Jt.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let a=(i.hooks?i.hooks.provideLexer():n?Yt.lex:Yt.lexInline)(t,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():n?Jt.parse:Jt.parseInline)(a,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(a){return s(a)}}}onError(n,t){return e=>{if(e.message+=`
419
+ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+ln(e.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(e);throw e}}},ks=new t9;function ue(n,t){return ks.parse(n,t)}ue.options=ue.setOptions=function(n){return ks.setOptions(n),ue.defaults=ks.defaults,$S(ue.defaults),ue};ue.getDefaults=lg;ue.defaults=Rs;ue.use=function(...n){return ks.use(...n),ue.defaults=ks.defaults,$S(ue.defaults),ue};ue.walkTokens=function(n,t){return ks.walkTokens(n,t)};ue.parseInline=ks.parseInline;ue.Parser=Jt;ue.parser=Jt.parse;ue.Renderer=yh;ue.TextRenderer=gg;ue.Lexer=Yt;ue.lexer=Yt.lex;ue.Tokenizer=vh;ue.Hooks=Xa;ue.parse=ue;ue.options;ue.setOptions;ue.use;ue.walkTokens;ue.parseInline;Jt.parse;Yt.lex;CS.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function NS(n){const t=ue.parse(n,{async:!1});return CS.sanitize(t,{USE_PROFILES:{html:!0}})}var os,ic;class n9 extends St{constructor(){super(...arguments);m(this,os,null);m(this,ic,Dn())}connected(){queueMicrotask(()=>{var r;if(!this.isConnected||o(this,os)!==null)return;const e=((r=o(this,ic).value)==null?void 0:r.querySelector("dialog"))??null;if(e===null)throw new Error("Desktop upgrade gate requires its composed dialog");d(this,os,wd(e,()=>{}))})}disconnected(){var e;(e=o(this,os))==null||e.withdraw(),d(this,os,null)}template(e){return B`
420
+ <div class="desktop-upgrade-gate" ${ut(o(this,ic))}>
421
+ ${yd(B`<div class="upgrade-gate-body" data-testid="upgrade-gate-body">${SS(NS(l2(e)))}</div>`)}
422
+ </div>
423
+ `}}os=new WeakMap,ic=new WeakMap;const r9=_t(n9),i9=250,s9=1e3;var $n,Tn,as,Gr,ls,Zo,Qt,zS,Lh,Dh,US,Yf,FS;class o9 extends St{constructor(){super(...arguments);m(this,Qt);m(this,$n,l9());m(this,Tn,null);m(this,as,!1);m(this,Gr,null);m(this,ls,"");m(this,Zo,null);m(this,Lh,e=>{d(this,ls,e.currentTarget.value)});m(this,Dh,e=>{e.preventDefault();const r=o(this,ls).trim();r.length===0||o(this,Zo)===null||o(this,Zo).authenticate(r)})}disconnected(){var e;h(this,Qt,Yf).call(this),(e=o(this,Tn))==null||e.withdraw(),d(this,Tn,null),d(this,as,!1),Lu(null,o(this,$n))}template(e,r){var i;return d(this,Zo,r),h(this,Qt,US).call(this,e),e.kind==="needs-upgrade"?((i=o(this,Tn))==null||i.withdraw(),d(this,Tn,null),Lu(r9(e.instructions),o(this,$n)),o(this,$n)):(Lu(yd(h(this,Qt,zS).call(this,e)),o(this,$n)),h(this,Qt,FS).call(this),o(this,$n))}}$n=new WeakMap,Tn=new WeakMap,as=new WeakMap,Gr=new WeakMap,ls=new WeakMap,Zo=new WeakMap,Qt=new WeakSet,zS=function(e){switch(e.kind){case"connecting":return B`
424
+ <div class="system-modal" role="status" aria-live="polite">
425
+ <tv-icon name="spinner" size="xl" spinning></tv-icon>
426
+ <h2>Connecting</h2>
427
+ </div>
428
+ `;case"disconnected":return B`
429
+ <div class="system-modal" role="status" aria-live="polite">
430
+ <tv-icon name="spinner" size="xl" spinning></tv-icon>
431
+ <h2>Disconnected</h2>
432
+ <p>${c9(e.nextRetryAt)}</p>
433
+ </div>
434
+ `;case"unauthorized":{const r=!!e.invalid;return r&&d(this,ls,""),B`
435
+ <form class="system-modal auth-form" @submit=${o(this,Dh)}>
436
+ <tv-icon name="locked" size="xl"></tv-icon>
437
+ <h2>Enter access token</h2>
438
+ <p>This server requires an access token to connect.</p>
439
+ <input
440
+ class="auth-token"
441
+ type="password"
442
+ name="token"
443
+ placeholder="paste token here"
444
+ aria-label="Access token"
445
+ aria-invalid=${r?"true":ie}
446
+ aria-describedby=${r?"auth-token-error":ie}
447
+ .value=${o(this,ls)}
448
+ @input=${o(this,Lh)}
449
+ autofocus
450
+ required
451
+ />
452
+ ${r?B`<p id="auth-token-error" class="tv-error" role="alert">
453
+ The previous token was rejected. Try again.
454
+ </p>`:null}
455
+ <button type="submit" intent="primary" class="auth-submit">
456
+ Connect
457
+ </button>
458
+ </form>
459
+ `}case"error":return B`
460
+ <div class="system-modal">
461
+ <h2>Can’t connect with server</h2>
462
+ <p class="server-url">${e.serverURL}</p>
463
+ <p>${e.message}</p>
464
+ </div>
465
+ `}},Lh=new WeakMap,Dh=new WeakMap,US=function(e){const r=e.kind==="disconnected"&&e.nextRetryAt!==null;r&&o(this,Gr)===null?d(this,Gr,setInterval(()=>this.render(),i9)):r||h(this,Qt,Yf).call(this)},Yf=function(){o(this,Gr)!==null&&(clearInterval(o(this,Gr)),d(this,Gr,null))},FS=function(){o(this,Tn)!==null||o(this,as)||(d(this,as,!0),queueMicrotask(()=>{if(d(this,as,!1),!this.isConnected||!o(this,$n).isConnected||o(this,Tn)!==null)return;const e=o(this,$n).querySelector("dialog");e!==null&&d(this,Tn,wd(e,()=>{}))}))};const a9=_t(o9);function l9(){const n=document.createElement("section");return n.className="system-modal-host",n}function c9(n){if(n===null)return"Reattempting now…";const t=n-Date.now();return t<=0?"Reattempting now…":`Reattempting in ${Math.ceil(t/s9)}s…`}const u9=1400,cu=new WeakMap;function h9(n,t){var s;const e=t.ownerDocument,r=(s=e.defaultView)==null?void 0:s.navigator.clipboard;if(r&&typeof r.writeText=="function"){r.writeText(n).catch(()=>{});return}const i=e.createElement("textarea");i.value=n,i.setAttribute("readonly",""),i.style.position="fixed",i.style.opacity="0",e.body.append(i),i.select();try{e.execCommand("copy")}catch{}i.remove()}const d9={writeClipboard:h9,scheduler:{setTimeout(n,t){return globalThis.setTimeout(n,t)},clearTimeout(n){globalThis.clearTimeout(n)}}};function p9(n,t,e){const r=n.currentTarget;if(!r)return;t.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 a=cu.get(r);a&&a.scheduler.clearTimeout(a.handle);const l={handle:void 0,scheduler:t.scheduler};l.handle=t.scheduler.setTimeout(()=>{cu.get(r)===l&&(cu.delete(r),r.toggleAttribute("copied",!1),s&&(s.textContent=""))},u9),cu.set(r,l),e()}function ZS({label:n,prompt:t="",intent:e,copied:r=!1,onActivate:i=()=>{}},s=d9){return B`
466
+ <button
467
+ class="copy-button"
468
+ size="sm"
469
+ aria-label=${n}
470
+ intent=${e??ie}
471
+ ?copied=${r}
472
+ prompt=${t}
473
+ @click=${a=>p9(a,s,i)}
474
+ >
475
+ <span class="copy-button-idle"><tv-icon name="copy"></tv-icon>${n}</span>
476
+ <span class="copy-button-done"><tv-icon name="check"></tv-icon>Copied</span>
477
+ </button>
478
+ <span
479
+ class="copy-button-status"
480
+ role="status"
481
+ aria-live="polite"
482
+ >${r?"Copied":ie}</span
483
+ >
484
+ `}const HS="1.3.1",f9="tv-desktop-upgrade-recommendation-dismissed",m9="### Recommended desktop upgrade available\n\nTelevision now supports light/dark mode settings and better theming. To fully use them, upgrade the desktop app with `npm install -g @telepath-computer/television-desktop@latest`, then quit Television and relaunch it with `tv-desktop`.\n\nIf you don't need light/dark mode, you can keep using your current version.";function g9(n){var t;return!n.electron||n.noticesSuppressed||((t=n.updateState)==null?void 0:t.toast)!=null||n.shellVersion===null||!od(n.shellVersion)||n.shellVersion===rh?!1:Bm(HS,n.shellVersion)}var Ho;class VS extends HTMLElement{constructor(){super(...arguments);m(this,Ho,new ig(this))}connectedCallback(){o(this,Ho).connect()}disconnectedCallback(){o(this,Ho).disconnect()}attributeChangedCallback(){o(this,Ho).refresh()}}Ho=new WeakMap,C(VS,"observedAttributes",["open","trigger","manual"]);customElements.get("tv-popover")||customElements.define("tv-popover",VS);const v9="tv-update-dismissed",uu={update_available:"Update available",copy_prompt:"Copy upgrade prompt",later:"Later"},y9="update-popover";function w9(n,t){const e=n.target;if(!(e instanceof Element))return!1;const r=e.closest("button, a[href], input, select, textarea, [tabindex]");return r!==null&&t.contains(r)}var Vo,sr,Bo,sc,oc,Oh;class b9 extends St{constructor(){super(...arguments);m(this,Vo);m(this,sr);m(this,Bo,!1);m(this,sc,()=>{});m(this,oc,()=>{});m(this,Oh,e=>{var r;(r=o(this,sr))==null||r.disconnect(),d(this,sr,void 0),d(this,Vo,e),d(this,Bo,(e==null?void 0:e.hasAttribute("open"))??!1),e&&(d(this,sr,new MutationObserver(()=>{const i=e.hasAttribute("open");i!==o(this,Bo)&&(d(this,Bo,i),i?o(this,sc).call(this):o(this,oc).call(this))})),o(this,sr).observe(e,{attributes:!0,attributeFilter:["open"]}))})}disconnected(){var e;(e=o(this,sr))==null||e.disconnect(),d(this,sr,void 0),d(this,Vo,void 0)}template({body:e,prompt:r,copied:i=!1,panelRef:s,bellRef:a,onPresent:l=()=>{},onDismiss:c=()=>{},onCopy:u=()=>{}}){d(this,sc,l),d(this,oc,c);const p=()=>{var v;(v=o(this,Vo))==null||v.removeAttribute("open")},g=v=>{const y=v.currentTarget;v.key!=="Escape"||!w9(v,y)||(v.preventDefault(),v.stopPropagation(),y.removeAttribute("open"))};return B`
485
+ <button
486
+ class="update-bell"
487
+ id="update-bell"
488
+ icon
489
+ intent="alert"
490
+ aria-label=${uu.update_available}
491
+ title=${uu.update_available}
492
+ ${a===void 0?ie:ut(a)}
493
+ >
494
+ <tv-icon name="notification" size="sm"></tv-icon>
495
+ </button>
496
+
497
+ <tv-popover
498
+ id=${y9}
499
+ manual
500
+ trigger="update-bell"
501
+ role="status"
502
+ class="update-popover"
503
+ ${ut(o(this,Oh))}
504
+ ${s===void 0?ie:ut(s)}
505
+ @keydown=${g}
506
+ >
507
+ ${e}
508
+ <div class="update-actions">
509
+ <button size="sm" class="update-later" @click=${p}
510
+ >${uu.later}</button
511
+ >
512
+ ${r===void 0?ie:ZS({label:uu.copy_prompt,prompt:r,intent:"primary",copied:i,onActivate:u})}
513
+ </div>
514
+ </tv-popover>
515
+ `}}Vo=new WeakMap,sr=new WeakMap,Bo=new WeakMap,sc=new WeakMap,oc=new WeakMap,Oh=new WeakMap;const S9=_t(b9);function _9(n,t){return t===null?!0:Bm(n,t)}const J1=new Set;var It,vt,ac,lc,Wo,or,cs,us,qo,Ve,ar,hs,jo,Go,ds,Yr,W,Jf,Kf,Xf,Qf,em,cc,ps,ju,Qa,tm,BS,nm,rm,im,Mh,Nh,zh,Uh,Fh,el,WS;class A9{constructor(t=()=>{}){m(this,W);m(this,It,null);m(this,vt,null);m(this,ac,null);m(this,lc,"");m(this,Wo);m(this,or,!1);m(this,cs,!1);m(this,us,!1);m(this,qo,null);m(this,Ve,!1);m(this,ar,!1);m(this,hs,null);m(this,jo,null);m(this,Go,!1);m(this,ds,[]);m(this,Yr);m(this,cc,()=>{o(this,Yr).call(this)});m(this,ps,()=>{h(this,W,im).call(this),o(this,Yr).call(this)});m(this,Mh,()=>{var e;const t=h(this,W,Qa).call(this,((e=o(this,vt))==null?void 0:e.toastsSuppressed)??!1);t===null||o(this,Ve)||(d(this,Ve,!0),t.kind==="server"&&h(this,W,nm).call(this,t.toast),o(this,Yr).call(this))});m(this,Nh,()=>{var e,r;if(!o(this,Ve))return;const t=h(this,W,Qa).call(this,((e=o(this,vt))==null?void 0:e.toastsSuppressed)??!1);t!==null&&((r=h(this,W,Jf).call(this))==null||r.setItem(h(this,W,tm).call(this,t),t.version)),d(this,Ve,!1),d(this,ar,!0),o(this,Yr).call(this)});m(this,zh,()=>{var e;const t=h(this,W,Qa).call(this,((e=o(this,vt))==null?void 0:e.toastsSuppressed)??!1);(t==null?void 0:t.kind)!=="server"||t.prompt===void 0||h(this,W,rm).call(this,"update_prompt_copy_clicked",t.toast)});m(this,Uh,t=>{d(this,hs,t instanceof HTMLElement?t:null),h(this,W,el).call(this)});m(this,Fh,t=>{d(this,jo,t instanceof HTMLElement?t:null),h(this,W,el).call(this)});d(this,Yr,t)}get presented(){return o(this,Ve)}configure({connectionOwner:t=null,primaryServerURL:e="",presentation:r=null,dismissalStorage:i,desktopRecommendation:s=null}){t!==o(this,It)&&(h(this,W,Xf).call(this),d(this,It,t),h(this,W,Kf).call(this)),r!==o(this,vt)&&(h(this,W,em).call(this),d(this,vt,r),h(this,W,Qf).call(this)),d(this,lc,e),d(this,Wo,i),d(this,ac,s)}connect(){o(this,or)||(d(this,or,!0),h(this,W,Kf).call(this),h(this,W,Qf).call(this))}disconnect(){o(this,or)&&(h(this,W,Xf).call(this),h(this,W,em).call(this),d(this,or,!1),d(this,hs,null),d(this,jo,null))}template(){var l,c;const t=((l=o(this,vt))==null?void 0:l.toastsSuppressed)??!1,e=h(this,W,Qa).call(this,t),r=e===null?null:`${e.kind}:${e.version}`;if(e===null?(d(this,qo,null),d(this,Ve,!1),d(this,ar,!0)):r!==o(this,qo)&&(d(this,qo,r),d(this,Ve,_9(e.version,h(this,W,BS).call(this,h(this,W,tm).call(this,e)))),d(this,ar,!0),o(this,Ve)&&e.kind==="server"&&!t&&h(this,W,nm).call(this,e.toast)),e===null||t)return d(this,Ve,!1),d(this,ar,!0),h(this,W,el).call(this),ie;const i=(c=o(this,hs))==null?void 0:c.querySelector(".copy-button"),s=o(this,Ve)&&!o(this,ar)&&(i==null?void 0:i.hasAttribute("copied"))===!0,a=S9({body:SS(NS(e.markdown)),prompt:e.kind==="server"?e.prompt:void 0,copied:s,presented:o(this,Ve),panelRef:o(this,Uh),bellRef:o(this,Fh),onPresent:o(this,Mh),onDismiss:o(this,Nh),onCopy:o(this,zh)});return d(this,ar,!1),h(this,W,el).call(this),a}}It=new WeakMap,vt=new WeakMap,ac=new WeakMap,lc=new WeakMap,Wo=new WeakMap,or=new WeakMap,cs=new WeakMap,us=new WeakMap,qo=new WeakMap,Ve=new WeakMap,ar=new WeakMap,hs=new WeakMap,jo=new WeakMap,Go=new WeakMap,ds=new WeakMap,Yr=new WeakMap,W=new WeakSet,Jf=function(){return o(this,Wo)!==void 0?o(this,Wo):typeof localStorage>"u"?null:localStorage},Kf=function(){!o(this,or)||o(this,cs)||o(this,It)===null||(o(this,It).addEventListener("server-status",o(this,ps)),o(this,It).addEventListener("change",o(this,ps)),d(this,cs,!0))},Xf=function(){!o(this,cs)||o(this,It)===null||(o(this,It).removeEventListener("server-status",o(this,ps)),o(this,It).removeEventListener("change",o(this,ps)),d(this,cs,!1))},Qf=function(){!o(this,or)||o(this,us)||o(this,vt)===null||(o(this,vt).addEventListener("change",o(this,cc)),d(this,us,!0))},em=function(){!o(this,us)||o(this,vt)===null||(o(this,vt).removeEventListener("change",o(this,cc)),d(this,us,!1))},cc=new WeakMap,ps=new WeakMap,ju=function(){var e;const t=((e=o(this,It))==null?void 0:e.connection)??null;return(t==null?void 0:t.url)===o(this,lc)?t:null},Qa=function(t){var s;const e=((s=h(this,W,ju).call(this))==null?void 0:s.updateState)??null,r=(e==null?void 0:e.toast)??null;if(r!==null)return{kind:"server",version:r.version,markdown:r.markdown,...r.prompt===void 0?{}:{prompt:r.prompt},toast:r};const i=o(this,ac);return i!==null&&g9({...i,noticesSuppressed:t,updateState:e})?{kind:"desktop",version:HS,markdown:m9}:null},tm=function(t){return t.kind==="server"?v9:f9},BS=function(t){var r;const e=((r=h(this,W,Jf).call(this))==null?void 0:r.getItem(t))??null;return e!==null&&od(e)?e:null},nm=function(t){J1.has(t.version)||(J1.add(t.version),h(this,W,rm).call(this,"update_toast_shown",t))},rm=function(t,e){var r;o(this,ds).push({event:t,properties:{server_version:((r=h(this,W,ju).call(this))==null?void 0:r.serverVersion)??"",channel_version:e.version}}),h(this,W,im).call(this)},im=function(){if(o(this,ds).length===0)return;const t=h(this,W,ju).call(this);if(!t||t.status!=="connected")return;const e=o(this,ds);d(this,ds,[]);for(const r of e)t.sendTelemetrySignal(r.event,r.properties)},Mh=new WeakMap,Nh=new WeakMap,zh=new WeakMap,Uh=new WeakMap,Fh=new WeakMap,el=function(){o(this,Go)||(d(this,Go,!0),queueMicrotask(()=>{d(this,Go,!1),h(this,W,WS).call(this)}))},WS=function(){const t=o(this,hs);t!==null&&(o(this,Ve)&&o(this,jo)===null||t.toggleAttribute("open",o(this,Ve)))};const E9=""+new URL("calendar-DToAnkzj.png",import.meta.url).href,k9=""+new URL("table-oeG9uAN1.png",import.meta.url).href,C9=""+new URL("tasks-D4xqXFPl.png",import.meta.url).href,$9=""+new URL("markdown-DdDrJuVK.png",import.meta.url).href,K1="Artifact skills",T9="Artifact skills",R9="Ready-made starting prompts for creating Television artifacts. Copy one, add the details of what you want, and send it to your agent.",I9="Copy prompt";function hu({artifactSkill:n,name:t,description:e,prompt:r,thumbnail:i},s){return B`
516
+ <article class="skill-card">
517
+ <div class="skill-thumb"><img src=${i} alt="" /></div>
518
+ <div class="skill-name">${t}</div>
519
+ <p class="skill-desc">${e}</p>
520
+ ${ZS({label:I9,prompt:r,onActivate:()=>s==null?void 0:s.sendTelemetrySignal("artifact_skill_prompt_copy_clicked",{artifact_skill:n})})}
521
+ </article>
522
+ `}class x9 extends St{template(t=null){return B`
523
+ <button
524
+ class="skill-trigger"
525
+ variant="ghost"
526
+ icon
527
+ id="skills-trigger"
528
+ aria-label=${K1}
529
+ title=${K1}
530
+ >
531
+ <tv-icon name="skills" size="sm"></tv-icon>
532
+ </button>
533
+
534
+ <tv-popover
535
+ id="skills-popover"
536
+ trigger="skills-trigger"
537
+ class="skill-popover"
538
+ >
539
+ <div class="skill-heading">${T9}</div>
540
+ <p class="skill-intro">${R9}</p>
541
+ <div class="skill-grid">
542
+ ${hu({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:E9},t)}
543
+ ${hu({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:k9},t)}
544
+ ${hu({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:C9},t)}
545
+ ${hu({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:$9},t)}
546
+ </div>
547
+ </tv-popover>
548
+ `}}const P9=_t(x9),L9=600;let D9=0;const X1=new WeakMap,$p=n=>{if(n.id)return n.id;let t=X1.get(n);if(!t){do t=`tv-select-${++D9}`;while(n.ownerDocument.getElementById(t));X1.set(n,t)}return n.id=t,t},du=n=>{var t;return((t=n.textContent)==null?void 0:t.trim())??""};var uc;class qS extends HTMLElement{constructor(){super();m(this,uc,this.attachInternals());o(this,uc).role="option"}connectedCallback(){this.attributeChangedCallback()}attributeChangedCallback(){o(this,uc).ariaSelected=String(this.hasAttribute("selected"))}}uc=new WeakMap,C(qS,"observedAttributes",["selected"]);var Je,lr,Yo,Jr,Kr,hc,q,kr,Qs,sm,Gu,Cr,Yu,om,GS,Ju,YS;class jS extends HTMLElement{constructor(){super();m(this,q);m(this,Je,new ig(this,{select:!0,refresh:()=>h(this,q,Yu).call(this),opened:()=>{d(this,Kr,""),h(this,q,Cr).call(this,h(this,q,Qs).call(this))},closed:()=>{h(this,q,Cr).call(this,void 0),d(this,Kr,"")},keydown:e=>h(this,q,YS).call(this,e),pointermove:e=>{const r=h(this,q,sm).call(this,e);r&&h(this,q,Cr).call(this,r)},click:e=>{const r=h(this,q,sm).call(this,e);r&&h(this,q,Ju).call(this,r)},selectedRow:()=>h(this,q,Qs).call(this),unpair:e=>h(this,q,GS).call(this,e)}));m(this,lr);m(this,Yo,"");m(this,Jr);m(this,Kr,"");m(this,hc,0);this.attachInternals().role="listbox"}connectedCallback(){o(this,Je).connect()}disconnectedCallback(){o(this,Je).disconnect()}attributeChangedCallback(){o(this,Je).refresh()}get value(){var e;return((e=h(this,q,Qs).call(this))==null?void 0:e.getAttribute("value"))??""}set value(e){const r=h(this,q,kr).call(this).find(i=>i.getAttribute("value")===e);r&&(h(this,q,Gu).call(this,r),h(this,q,Yu).call(this))}}Je=new WeakMap,lr=new WeakMap,Yo=new WeakMap,Jr=new WeakMap,Kr=new WeakMap,hc=new WeakMap,q=new WeakSet,kr=function(){return[...this.querySelectorAll("tv-option")].filter(e=>e.closest("tv-select")===this)},Qs=function(){return h(this,q,kr).call(this).find(e=>e.hasAttribute("selected"))},sm=function(e){const r=e.closest("tv-option");return(r==null?void 0:r.closest("tv-select"))===this?r:void 0},Gu=function(e){for(const r of h(this,q,kr).call(this))r.toggleAttribute("selected",r===e)},Cr=function(e){for(const r of h(this,q,kr).call(this))r.toggleAttribute("highlighted",r===e);if(o(this,Je).trigger&&Ks(o(this,Je).trigger,"aria-activedescendant",e?$p(e):null),e){const r=e.getBoundingClientRect(),i=this.getBoundingClientRect();r.top<i.top+this.clientTop?this.scrollTop-=i.top+this.clientTop-r.top:r.bottom>i.top+this.clientTop+this.clientHeight&&(this.scrollTop+=r.bottom-i.top-this.clientTop-this.clientHeight)}},Yu=function(){var l;const e=h(this,q,kr).call(this),r=h(this,q,Qs).call(this)??e[0];r&&h(this,q,Gu).call(this,r);const i=o(this,Je).trigger;if(!i)return;Ks(i,"role","combobox"),Ks(i,"aria-haspopup","listbox"),Ks(i,"aria-controls",$p(this));for(const c of e)$p(c);const s=e.find(c=>c.hasAttribute("highlighted"));Ks(i,"aria-activedescendant",this.hasAttribute("open")&&s?s.id:null);const a=r?du(r):"";if(!(i.firstChild instanceof Text)||i.firstChild.nodeValue!==`${a} `||i.childNodes.length!==2||((l=i.lastElementChild)==null?void 0:l.getAttribute("name"))!=="select"){const c=this.ownerDocument.createElement("tv-icon");c.setAttribute("name","select"),c.setAttribute("aria-hidden","true"),i.replaceChildren(`${a} `,c)}h(this,q,om).call(this,i,e)},om=function(e,r){if(o(this,Jr)||(d(this,Jr,new ResizeObserver(()=>{const c=o(this,Je).trigger;c&&h(this,q,om).call(this,c,h(this,q,kr).call(this))})),o(this,Jr).observe(e)),!e.getClientRects().length)return;const i=this.ownerDocument.defaultView.getComputedStyle(e),s=JSON.stringify([e.id,r.map(du),i.font,i.letterSpacing,i.padding,i.borderWidth,i.gap]);if(s===o(this,Yo))return;d(this,Yo,s);const a=e.cloneNode(!0);a.removeAttribute("id"),a.style.cssText+=";position:absolute;visibility:hidden;pointer-events:none;width:max-content;min-width:0;max-width:none;",a.style.font=i.font,a.style.letterSpacing=i.letterSpacing,e.after(a);let l=0;for(const c of r)a.firstChild.nodeValue=`${du(c)} `,l=Math.max(l,a.getBoundingClientRect().width);a.remove(),o(this,lr)??d(this,lr,this.ownerDocument.createElement("style")),o(this,lr).textContent=`:where(button[id="${CSS.escape(e.id)}"]) { width: ${l}px; }`,o(this,lr).isConnected||this.ownerDocument.head.append(o(this,lr))},GS=function(e){var r,i;for(const s of["role","aria-haspopup","aria-controls","aria-activedescendant"])e.removeAttribute(s);(r=o(this,Jr))==null||r.disconnect(),d(this,Jr,void 0),(i=o(this,lr))==null||i.remove(),d(this,lr,void 0),d(this,Yo,"")},Ju=function(e){const r=h(this,q,Qs).call(this)!==e;h(this,q,Gu).call(this,e),h(this,q,Yu).call(this),o(this,Je).close(),r&&this.dispatchEvent(new Event("change",{bubbles:!0}))},YS=function(e){if(!o(this,Je).open)return this.ownerDocument.activeElement!==o(this,Je).trigger||!["Enter"," ","ArrowDown","ArrowUp"].includes(e.key)?!1:(e.preventDefault(),e.stopImmediatePropagation(),o(this,Je).show(!0),!0);const r=h(this,q,kr).call(this),i=r.findIndex(a=>a.hasAttribute("highlighted"));if(e.key==="Tab")return e.stopImmediatePropagation(),this.ownerDocument.activeElement!==o(this,Je).trigger?(e.preventDefault(),!0):(r[i]&&h(this,q,Ju).call(this,r[i]),!0);if(e.key==="Escape")return!1;const s=e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey;if(!["ArrowDown","ArrowUp","Home","End","Enter"," "].includes(e.key)&&!s)return!1;if(e.preventDefault(),e.stopImmediatePropagation(),e.key==="Enter"||e.key===" ")r[i]&&h(this,q,Ju).call(this,r[i]);else if(e.key==="Home")h(this,q,Cr).call(this,r[0]);else if(e.key==="End")h(this,q,Cr).call(this,r.at(-1));else if(e.key==="ArrowDown"||e.key==="ArrowUp")h(this,q,Cr).call(this,r[Math.max(0,Math.min(r.length-1,i+(e.key==="ArrowDown"?1:-1)))]);else{const a=performance.now();d(this,Kr,a-o(this,hc)>L9?e.key.toLowerCase():o(this,Kr)+e.key.toLowerCase()),d(this,hc,a);const c=[...r.slice(i+1),...r.slice(0,i+1)].find(u=>du(u).toLowerCase().startsWith(o(this,Kr)));c&&h(this,q,Cr).call(this,c)}return!0},C(jS,"observedAttributes",["open","trigger","manual"]);customElements.get("tv-option")||customElements.define("tv-option",qS);customElements.get("tv-select")||customElements.define("tv-select",jS);/**
549
+ * @license
550
+ * Copyright 2020 Google LLC
551
+ * SPDX-License-Identifier: BSD-3-Clause
552
+ */const O9=ba(class extends Lc{constructor(n){if(super(n),n.type!==Ln.PROPERTY&&n.type!==Ln.ATTRIBUTE&&n.type!==Ln.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!C2(n))throw Error("`live` bindings can only contain a single expression")}render(n){return n}update(n,[t]){if(t===Ke||t===ie)return t;const e=n.element,r=n.name;if(n.type===Ln.PROPERTY){if(t===e[r])return Ke}else if(n.type===Ln.BOOLEAN_ATTRIBUTE){if(!!t===e.hasAttribute(r))return Ke}else if(n.type===Ln.ATTRIBUTE&&e.getAttribute(r)===t+"")return Ke;return $2(n),t}}),Q1="Settings",ey="Refresh themes",M9="Themes directory",N9="None";function ty(n){return n instanceof Error?n.message:String(n)}var ot,fs,cr,Rn,dc,ur,hr,ms,Jo,Ko,Kt,JS,Zh,Hh,am,Vh,Bh,Wh,Ku;class z9 extends St{constructor(){super(...arguments);m(this,Kt);m(this,ot,null);m(this,fs,null);m(this,cr,!1);m(this,Rn,null);m(this,dc,!1);m(this,ur,0);m(this,hr,null);m(this,ms,!1);m(this,Jo,Dn());m(this,Ko,Dn());m(this,Zh,e=>{var i;if((i=o(this,hr))==null||i.disconnect(),d(this,hr,null),d(this,ms,!1),!e)return;const r=()=>{const s=e.hasAttribute("open");s!==o(this,ms)&&(d(this,ms,s),s&&h(this,Kt,am).call(this,!1))};d(this,hr,new MutationObserver(r)),o(this,hr).observe(e,{attributes:!0,attributeFilter:["open"]}),r()});m(this,Hh,()=>{h(this,Kt,am).call(this,!0)});m(this,Vh,e=>{var s;const r=e.currentTarget,i=r.value;r.value=((s=o(this,ot))==null?void 0:s.snapshot.display.appearanceMode)??"system",this.render(),h(this,Kt,Ku).call(this,()=>{var a;return(a=o(this,ot))==null?void 0:a.setAppearanceMode(i)},"Unable to change light/dark mode")});m(this,Bh,e=>{var s;const r=e.currentTarget,i=r.value||null;r.value=((s=o(this,ot))==null?void 0:s.snapshot.display.activeThemeName)??"",this.render(),h(this,Kt,Ku).call(this,()=>{var a;return(a=o(this,ot))==null?void 0:a.setActiveTheme(i)},"Unable to change theme")});m(this,Wh,e=>{var a;const r=e.currentTarget,i=r.value,s=r.checked;r.checked=((a=o(this,ot))==null?void 0:a.snapshot.display.themeJavaScriptConsentIds.includes(i))??!1,this.render(),h(this,Kt,Ku).call(this,()=>{var l;return(l=o(this,ot))==null?void 0:l.setThemeJavaScriptConsent(i,s)},"Unable to change theme JavaScript consent")})}template(e){var g,v;d(this,ot,e);const r=e.snapshot.connection.status==="connected";o(this,dc)&&!r&&h(this,Kt,JS).call(this),d(this,dc,r);const{activeThemeName:i,appearanceMode:s,themeJavaScriptConsentIds:a}=e.snapshot.display,l=((g=o(this,fs))==null?void 0:g.themes)??[],c=((v=o(this,fs))==null?void 0:v.errors)??[],u=i===null?void 0:l.find(y=>y.id===i&&y.enableMainJS===!0),p=i!==null&&a.includes(i);return queueMicrotask(()=>{var y,E;this.isConnected&&(o(this,Jo).value&&(o(this,Jo).value.value=((y=o(this,ot))==null?void 0:y.snapshot.display.appearanceMode)??"system"),o(this,Ko).value&&(o(this,Ko).value.value=((E=o(this,ot))==null?void 0:E.snapshot.display.activeThemeName)??""))}),B`
553
+ <button
554
+ class="settings-trigger"
555
+ variant="ghost"
556
+ icon
557
+ id="settings-trigger"
558
+ aria-label=${Q1}
559
+ title=${Q1}
560
+ >
561
+ <tv-icon name="settings" size="sm"></tv-icon>
562
+ </button>
563
+
564
+ <tv-popover
565
+ id="settings-popover"
566
+ trigger="settings-trigger"
567
+ class="settings-popover"
568
+ ${ut(o(this,Zh))}
569
+ >
570
+ <div class="settings-heading">Settings</div>
571
+
572
+ <div class="settings-field">
573
+ <label id="settings-appearance-label">Light/dark mode</label>
574
+ <button id="settings-appearance" aria-labelledby="settings-appearance-label"></button>
575
+ <tv-select
576
+ trigger="settings-appearance"
577
+ name="appearance-mode"
578
+ ${ut(o(this,Jo))}
579
+ @change=${o(this,Vh)}
580
+ >
581
+ <tv-option value="system" ?selected=${s==="system"}>Adapt to system</tv-option>
582
+ <tv-option value="light" ?selected=${s==="light"}>Light</tv-option>
583
+ <tv-option value="dark" ?selected=${s==="dark"}>Dark</tv-option>
584
+ </tv-select>
585
+ </div>
586
+
587
+ <div class="settings-field">
588
+ <label id="settings-theme-label">Theme</label>
589
+ <div class="settings-theme-control">
590
+ <button id="settings-theme" aria-labelledby="settings-theme-label"></button>
591
+ <tv-select
592
+ trigger="settings-theme"
593
+ name="theme"
594
+ ${ut(o(this,Ko))}
595
+ @change=${o(this,Bh)}
596
+ >
597
+ <tv-option value="" ?selected=${i===null}>${N9}</tv-option>
598
+ ${l.map(y=>B`
599
+ <tv-option
600
+ value=${y.id}
601
+ ?selected=${y.id===i}
602
+ >${y.name}</tv-option>
603
+ `)}
604
+ </tv-select>
605
+ <button
606
+ type="button"
607
+ variant="ghost"
608
+ icon
609
+ aria-label=${ey}
610
+ title=${ey}
611
+ ?disabled=${o(this,cr)||!r}
612
+ @click=${o(this,Hh)}
613
+ >
614
+ <tv-icon name="reload" size="sm"></tv-icon>
615
+ </button>
616
+ </div>
617
+ </div>
618
+
619
+ ${u?B`
620
+ <section
621
+ class="settings-javascript-consent"
622
+ aria-label="Experimental main-page JavaScript"
623
+ >
624
+ <p class="settings-javascript-disclosure">This theme uses experimental JavaScript. JavaScript can access your Television content, so only enable for themes you trust or have had your agent inspect.</p>
625
+ <label class="settings-javascript-toggle">
626
+ <input
627
+ type="checkbox"
628
+ role="switch"
629
+ name="theme-javascript-consent"
630
+ value=${u.id}
631
+ .checked=${O9(p)}
632
+ @change=${o(this,Wh)}
633
+ >
634
+ <span>Enable experimental javascript for this theme</span>
635
+ </label>
636
+ </section>
637
+ `:null}
638
+
639
+ ${o(this,cr)?B`<p class="settings-status" role="status">Loading themes…</p>`:null}
640
+ ${o(this,Rn)?B`<p class="settings-failure" role="alert">${o(this,Rn)}</p>`:null}
641
+ ${c.length>0?B`
642
+ <div class="settings-errors" aria-label="Theme validation errors">
643
+ ${c.map(y=>B`
644
+ <p><strong>${y.folder??M9}</strong>: ${y.error}</p>
645
+ `)}
646
+ </div>
647
+ `:null}
648
+ </tv-popover>
649
+ `}disconnected(){var e;(e=o(this,hr))==null||e.disconnect(),d(this,hr,null),d(this,ms,!1),d(this,ot,null),d(this,ur,o(this,ur)+1)}}ot=new WeakMap,fs=new WeakMap,cr=new WeakMap,Rn=new WeakMap,dc=new WeakMap,ur=new WeakMap,hr=new WeakMap,ms=new WeakMap,Jo=new WeakMap,Ko=new WeakMap,Kt=new WeakSet,JS=function(){d(this,fs,null),d(this,Rn,null),d(this,cr,!1),d(this,ur,o(this,ur)+1)},Zh=new WeakMap,Hh=new WeakMap,am=async function(e){const r=o(this,ot);if(r===null||r.snapshot.connection.status!=="connected"||o(this,cr))return;const i=++Wc(this,ur)._;d(this,cr,!0),d(this,Rn,null),this.render();try{const s=await(e?r.refreshThemes():r.listThemes());if(i!==o(this,ur))return;d(this,fs,s)}catch(s){if(i!==o(this,ur))return;d(this,Rn,`${e?"Unable to refresh themes":"Unable to load themes"}: ${ty(s)}`)}finally{i===o(this,ur)&&(d(this,cr,!1),this.render())}},Vh=new WeakMap,Bh=new WeakMap,Wh=new WeakMap,Ku=async function(e,r){d(this,Rn,null),this.render();try{await e()}catch(i){d(this,Rn,`${r}: ${ty(i)}`),this.render()}};const U9=_t(z9),za={start:"--item-fade-start",end:"--item-fade-end",left:"--item-fade-left",right:"--item-fade-right"},F9=(n,{items:t,distance:e,edges:r})=>{const i=new Set;let s=0,a=!1;const l=y=>{y.removeAttribute("data-item-edge-fade");for(const E of Object.values(za))y.style.removeProperty(E)},c=()=>{s=0;const y=new Set(n.querySelectorAll(t)),E=[];for(const z of i)y.has(z)||(p.unobserve(z),i.delete(z),E.push(z));for(const z of y)i.has(z)||(i.add(z),p.observe(z));const x=n.getBoundingClientRect().left+n.clientLeft,L=x+n.clientWidth,D=Math.max(0,Math.min(e,n.clientWidth/2)),V=0,F=n.scrollLeft<n.scrollWidth-n.clientWidth-1?D:0,G=[...y].map(z=>({item:z,bounds:z.getBoundingClientRect()}));for(const z of E)l(z);for(const{item:z,bounds:J}of G){if(!(F>0&&J.right>L-F&&J.left<L)){l(z);continue}z.style.setProperty(za.start,`${x-J.left}px`),z.style.setProperty(za.end,`${L-J.left}px`),z.style.setProperty(za.left,`${V}px`),z.style.setProperty(za.right,`${F}px`),z.setAttribute("data-item-edge-fade","")}},u=()=>{!a&&!s&&(s=requestAnimationFrame(c))},p=new ResizeObserver(u);p.observe(n);const g=new MutationObserver(u);return g.observe(n,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class"]}),n.addEventListener("scroll",u,{passive:!0}),u(),{refresh:u,dispose:()=>{if(!a){a=!0,cancelAnimationFrame(s),p.disconnect(),g.disconnect(),n.removeEventListener("scroll",u);for(const y of i)l(y);i.clear()}}}},Ua=.5;var xt,Xo,Qo,gs,Xr,dr,pr,Qr,ei,ti,Gt,ni,ea,ri,vs,pc,Ze,fr,ii,qh,N,KS,XS,fc,mc,gc,jh,vc,eo,lm,QS,cm,um,hm,dm,e_,t_,ta,yc,n_,to,pm,r_,i_,s_,tl,nl;class Z9 extends St{constructor(){super(...arguments);m(this,N);m(this,xt,Dn());m(this,Xo);m(this,Qo);m(this,gs,!1);m(this,Xr,0);m(this,dr,!1);m(this,pr,!1);m(this,Qr,!1);m(this,ei,0);m(this,ti,null);m(this,Gt,!1);m(this,ni,null);m(this,ea,null);m(this,ri,null);m(this,vs,null);m(this,pc,!1);m(this,Ze,null);m(this,fr,!1);m(this,ii,!1);m(this,qh,()=>{h(this,N,nl).call(this)});m(this,fc,e=>{var s;const r=o(this,Ze);if(r===null||r.pointerId!==e.pointerId||!r.dragging&&Math.hypot(e.clientX-r.originX,e.clientY-r.originY)<=z2)return;const i=o(this,xt).value;if(i){if(r.currentX=e.clientX,r.currentY=e.clientY,r.dragging)this.render();else{h(this,N,tl).call(this);const a=r.tab.getBoundingClientRect();d(this,fr,!0),r.dragging=!0,r.tabLeft=a.left,r.tabTop=a.top,r.tabWidth=a.width,r.tabHeight=a.height,i.setPointerCapture(e.pointerId),this.render(),(s=r.onReorderChange)==null||s.call(r,h(this,N,dm).call(this,r))}h(this,N,hm).call(this,r),h(this,N,lm).call(this,r)}});m(this,mc,e=>{const r=o(this,Ze);r===null||r.pointerId!==e.pointerId||h(this,N,eo).call(this,!0,!0)});m(this,gc,e=>{var r;((r=o(this,Ze))==null?void 0:r.pointerId)===e.pointerId&&h(this,N,eo).call(this,!1,!0)});m(this,jh,e=>{var r;((r=o(this,Ze))==null?void 0:r.pointerId)===e.pointerId&&h(this,N,eo).call(this,!1,!0)});m(this,vc,e=>{var r;e.key!=="Escape"||!((r=o(this,Ze))!=null&&r.dragging)||(e.preventDefault(),h(this,N,eo).call(this,!1,!0))});m(this,ta,()=>{d(this,Gt,!0),h(this,N,to).call(this,!1)});m(this,yc,()=>{d(this,Gt,!0),h(this,N,to).call(this,!0)})}connected(){var e;d(this,Xo,void 0),d(this,Qo,void 0),d(this,Gt,!1),h(this,N,n_).call(this),typeof document<"u"&&((e=document.fonts)==null||e.addEventListener("loadingdone",o(this,yc),{once:!0})),document.addEventListener("television-theme-styles-changed",o(this,ta)),d(this,vs,new MutationObserver(o(this,ta))),o(this,vs).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),window.addEventListener("pointermove",o(this,fc)),window.addEventListener("pointerup",o(this,mc)),window.addEventListener("pointercancel",o(this,gc)),window.addEventListener("keydown",o(this,vc))}template(e,r,i=null,s){var A,x;const a=(A=o(this,Ze))!=null&&A.dragging?o(this,Ze):null,l=(a==null?void 0:a.provisionalPages)??(r==null?void 0:r.pages),c=V9(r,l),u=(a==null?void 0:a.artifactId)??i,p=((x=r==null?void 0:r.selectedPage)==null?void 0:x.artifactIds[0])??null,g=`${(r==null?void 0:r.id)??""}:${c.map(({key:L,label:D})=>`${L}:${D}`).join("|")}`,v=p!==o(this,Xo),y=g!==o(this,Qo);v&&d(this,ii,!1);const E=v||a===null&&y;return y&&d(this,Gt,!0),d(this,Xo,p),d(this,Qo,g),h(this,N,to).call(this,E,v,v&&!y),B`
650
+ <div
651
+ class="tab-strip"
652
+ role="tablist"
653
+ ${ut(o(this,xt))}
654
+ ?tab-held=${a!==null}
655
+ @scroll=${o(this,qh)}
656
+ @lostpointercapture=${o(this,jh)}
657
+ >
658
+ ${hh(c,({key:L})=>L,(L,D)=>{const V=L.artifactId!==null&&L.artifactId===p,F=L.artifactId!==null&&L.artifactId===u,G=F&&a!==null;return B`
659
+ ${F?B`
660
+ <span
661
+ class="tab-placeholder"
662
+ aria-hidden="true"
663
+ style=${dh(G?{width:`${a.tabWidth}px`,height:`${a.tabHeight}px`}:{})}
664
+ ></span>
665
+ `:null}
666
+ <div
667
+ class=${F?"tab dragged":"tab"}
668
+ ?dragging=${G}
669
+ style=${dh(G?{left:`${a.tabLeft+a.currentX-a.originX}px`,top:`${a.tabTop+a.currentY-a.originY}px`,width:`${a.tabWidth}px`,height:`${a.tabHeight}px`}:{})}
670
+ @keydown=${z=>{z.key!=="Enter"&&z.key!==" "||(z.preventDefault(),z.currentTarget.click())}}
671
+ role="tab"
672
+ aria-selected=${V?"true":"false"}
673
+ tabindex=${V?"0":"-1"}
674
+ data-artifact-id=${L.artifactId??""}
675
+ @pointerdown=${u===null?z=>h(this,N,KS).call(this,z,e,r,L,s):null}
676
+ @click=${z=>h(this,N,XS).call(this,z,e,r,L)}
677
+ @dblclick=${V&&r!==null&&!G?()=>Uf(e,r,L.page,!L.page.geometry.full_screen):null}
678
+ >
679
+ <span class="tab-label">${L.label}</span>
680
+ </div>
681
+ `})}
682
+ </div>
683
+ `}disconnected(){var e,r,i,s;d(this,gs,!1),typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o(this,Xr)),d(this,Xr,0),d(this,dr,!1),d(this,pr,!1),d(this,Qr,!1),h(this,N,tl).call(this),d(this,ii,!1),d(this,Gt,!1),(e=o(this,ni))==null||e.disconnect(),d(this,ni,null),d(this,ea,null),(r=o(this,ri))==null||r.dispose(),d(this,ri,null),(i=o(this,vs))==null||i.disconnect(),d(this,vs,null),document.removeEventListener("television-theme-styles-changed",o(this,ta)),typeof document<"u"&&((s=document.fonts)==null||s.removeEventListener("loadingdone",o(this,yc))),window.removeEventListener("pointermove",o(this,fc)),window.removeEventListener("pointerup",o(this,mc)),window.removeEventListener("pointercancel",o(this,gc)),window.removeEventListener("keydown",o(this,vc)),h(this,N,eo).call(this,!1,!1),d(this,fr,!1)}}xt=new WeakMap,Xo=new WeakMap,Qo=new WeakMap,gs=new WeakMap,Xr=new WeakMap,dr=new WeakMap,pr=new WeakMap,Qr=new WeakMap,ei=new WeakMap,ti=new WeakMap,Gt=new WeakMap,ni=new WeakMap,ea=new WeakMap,ri=new WeakMap,vs=new WeakMap,pc=new WeakMap,Ze=new WeakMap,fr=new WeakMap,ii=new WeakMap,qh=new WeakMap,N=new WeakSet,KS=function(e,r,i,s,a){o(this,Ze)!==null||i===null||s.artifactId===null||e.button!==0||!e.isPrimary||(d(this,fr,!1),d(this,Ze,{pointerId:e.pointerId,originX:e.clientX,originY:e.clientY,tab:e.currentTarget,application:r,channelId:i.id,artifactId:s.artifactId,originalPages:i.pages,onReorderChange:a,displacementAnimations:new Set,provisionalPages:[...i.pages],slot:i.pages.indexOf(s.page),currentX:e.clientX,currentY:e.clientY,tabLeft:0,tabTop:0,tabWidth:0,tabHeight:0,edgeScrollFrame:0,edgeScrollTimestamp:null,edgeScrollRemainder:0,edgeScrollMoved:!1,dragging:!1}))},XS=function(e,r,i,s){var a;if(e.detail!==0&&o(this,fr)){d(this,fr,!1);return}d(this,fr,!1),!((a=o(this,Ze))!=null&&a.dragging||i===null||s.artifactId===null)&&r.selectPage(i.id,s.artifactId)},fc=new WeakMap,mc=new WeakMap,gc=new WeakMap,jh=new WeakMap,vc=new WeakMap,eo=function(e,r){var a;const i=o(this,Ze);if(i===null)return;if(h(this,N,cm).call(this,i),i.edgeScrollMoved&&d(this,ii,!0),i.dragging&&(d(this,dr,o(this,pr)),o(this,pr)||d(this,Qr,!1)),i.dragging&&e&&!B9(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(!e)for(const l of i.displacementAnimations)l.cancel();d(this,Ze,null),(a=i.onReorderChange)==null||a.call(i,null);const s=o(this,xt).value;i.dragging&&(s!=null&&s.hasPointerCapture(i.pointerId))&&s.releasePointerCapture(i.pointerId),r&&this.render()},lm=function(e){const r=o(this,xt).value,i=r?h(this,N,um).call(this,r,e.currentX):0,s=r?Math.max(0,r.scrollWidth-r.clientWidth):0,a=i<0?((r==null?void 0:r.scrollLeft)??0)<=Ua:((r==null?void 0:r.scrollLeft)??0)>=s-Ua;if(!e.dragging||i===0||s===0||a||typeof requestAnimationFrame!="function"){h(this,N,cm).call(this,e);return}e.edgeScrollFrame===0&&(e.edgeScrollFrame=requestAnimationFrame(l=>{h(this,N,QS).call(this,e,l)}))},QS=function(e,r){if(e.edgeScrollFrame=0,o(this,Ze)!==e||!e.dragging){e.edgeScrollTimestamp=null;return}const i=o(this,xt).value;if(!i){e.edgeScrollTimestamp=null;return}const s=h(this,N,um).call(this,i,e.currentX),a=e.edgeScrollTimestamp;if(e.edgeScrollTimestamp=r,s!==0&&a!==null){const l=Math.max(0,r-a)/1e3,c=Math.max(0,i.scrollWidth-i.clientWidth),u=i.scrollLeft,p=s*l+e.edgeScrollRemainder,g=Math.max(0,Math.min(c,u+p));i.scrollLeft=g;const v=i.scrollLeft-u;v!==0&&(e.edgeScrollMoved=!0),e.edgeScrollRemainder=g===0||g===c?0:p-v,v!==0&&(h(this,N,nl).call(this,i),h(this,N,hm).call(this,e))}h(this,N,lm).call(this,e)},cm=function(e){e.edgeScrollFrame!==0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(e.edgeScrollFrame),e.edgeScrollFrame=0,e.edgeScrollTimestamp=null,e.edgeScrollRemainder=0},um=function(e,r){const i=e.getBoundingClientRect();return r>=i.left&&r<i.left+Dt?-ph*(i.left+Dt-r)/Dt:r>i.right-Dt&&r<=i.right?ph*(r-(i.right-Dt))/Dt:0},hm=function(e){var E;const r=o(this,xt).value,i=r==null?void 0:r.querySelector(".tab-placeholder");if(!r||!i)return;const s=i.nextElementSibling,a=e.tab.getBoundingClientRect(),l=a.left+a.width/2;let c=e.slot,u=i.previousElementSibling;for(;u!=null&&u.classList.contains("tab");){const A=u.getBoundingClientRect();if(l>=A.left+A.width/2)break;c-=1,u=u.previousElementSibling}let p=s==null?void 0:s.nextElementSibling;for(;p!=null&&p.classList.contains("tab");){const A=p.getBoundingClientRect();if(l<=A.left+A.width/2)break;c+=1,p=p.nextElementSibling}if(c===e.slot)return;const g=h(this,N,e_).call(this,r),v=[...e.provisionalPages],[y]=v.splice(e.slot,1);y&&(v.splice(c,0,y),e.provisionalPages=v,e.slot=c,this.render(),(E=e.onReorderChange)==null||E.call(e,h(this,N,dm).call(this,e)),queueMicrotask(()=>h(this,N,t_).call(this,e,g)))},dm=function(e){return{channelId:e.channelId,pages:e.provisionalPages,carriedArtifactId:e.artifactId}},e_=function(e){return new Map([...e.querySelectorAll(".tab:not([dragging])")].map(r=>[r.dataset.artifactId??"",r.getBoundingClientRect().left]))},t_=function(e,r){const i=o(this,xt).value;if(i)for(const s of i.querySelectorAll(".tab:not([dragging])")){const a=r.get(s.dataset.artifactId??"");if(a===void 0)continue;const l=a-s.getBoundingClientRect().left;if(Math.abs(l)<=Ua)continue;const c=s.animate({translate:[`${l}px 0`,"0px 0"]},{duration:so,easing:"ease"});e.displacementAnimations.add(c),c.finished.finally(()=>{e.displacementAnimations.delete(c)}).catch(()=>{})}},ta=new WeakMap,yc=new WeakMap,n_=function(){o(this,pc)||typeof document>"u"||!document.fonts||(d(this,pc,!0),document.fonts.ready.then(()=>{this.isConnected&&(d(this,Gt,!0),h(this,N,to).call(this,!0))}))},to=function(e,r=!1,i=!1){o(this,dr)||d(this,dr,e),e&&r&&(d(this,pr,!0),d(this,Qr,i)),!(o(this,gs)||o(this,Xr)!==0)&&(d(this,gs,!0),queueMicrotask(()=>{if(d(this,gs,!1),!!this.isConnected){if(typeof requestAnimationFrame!="function"){h(this,N,pm).call(this);return}d(this,Xr,requestAnimationFrame(()=>{d(this,Xr,0),h(this,N,pm).call(this)}))}}))},pm=function(){var l,c;const e=o(this,xt).value;if(!e)return;o(this,Gt)&&(d(this,Gt,!1),h(this,N,r_).call(this,e)),h(this,N,i_).call(this,e);const r=((l=o(this,Ze))==null?void 0:l.dragging)===!0,i=o(this,pr),s=i&&o(this,Qr),a=!r&&(i||o(this,dr)&&!o(this,ii));r?d(this,dr,i):(d(this,dr,!1),d(this,pr,!1),d(this,Qr,!1),i&&d(this,ii,!1)),a&&h(this,N,s_).call(this,e,s),h(this,N,nl).call(this,e),(c=o(this,ri))==null||c.refresh()},r_=function(e){var r;for(const i of e.querySelectorAll(".tab")){const s=i.querySelector(".tab-label");if(!s)continue;const a=document.createRange();a.selectNodeContents(s);const l=(r=a.getBoundingClientRect)==null?void 0:r.call(a);if(!l||l.width<=0)continue;const c=getComputedStyle(i),u=pu(c.paddingLeft)+pu(c.paddingRight)+pu(c.borderLeftWidth)+pu(c.borderRightWidth),g=Math.ceil(l.width)+u>NN+zN?"capped":"hugging";i.dataset.compression!==g&&(i.dataset.compression=g)}},i_=function(e){var r,i;typeof ResizeObserver>"u"||o(this,ea)===e||((r=o(this,ni))==null||r.disconnect(),o(this,ni)??d(this,ni,new ResizeObserver(()=>h(this,N,to).call(this,!0))),o(this,ni).observe(e),d(this,ea,e),(i=o(this,ri))==null||i.dispose(),d(this,ri,F9(e,{items:".tab:not(.dragged)",distance:UN,edges:"right"})))},s_=function(e,r){const i=e.querySelector('.tab[aria-selected="true"]');if(!i){h(this,N,tl).call(this);return}const s=e.getBoundingClientRect(),a=i.getBoundingClientRect(),l=Math.max(0,Math.min(e.scrollLeft+a.left+a.width/2-(s.left+s.width/2),e.scrollWidth-e.clientWidth));if(h(this,N,tl).call(this),!r||Math.abs(e.scrollLeft-l)<=Ua||matchMedia("(prefers-reduced-motion: reduce)").matches){e.scrollLeft=l;return}const c=e.scrollLeft,u=e.animate([{},{}],{duration:pS,easing:"ease"});d(this,ti,u);const p=()=>{var v;if(u!==o(this,ti))return;const g=u.playState==="finished"?1:((v=u.effect)==null?void 0:v.getComputedTiming().progress)??0;e.scrollLeft=c+(l-c)*g,u.playState==="finished"?(e.scrollLeft=l,d(this,ti,null),d(this,ei,0),h(this,N,nl).call(this,e)):d(this,ei,requestAnimationFrame(p))};d(this,ei,requestAnimationFrame(p))},tl=function(){var e;typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o(this,ei)),d(this,ei,0),(e=o(this,ti))==null||e.cancel(),d(this,ti,null)},nl=function(e=o(this,xt).value){if(!e)return;const r=Math.max(0,e.scrollWidth-e.clientWidth);e.toggleAttribute("data-overflow",r>Ua)};const H9=_t(Z9);function V9(n,t){if(!n||!t)return[];const e=new Map(n.artifacts.map(r=>[r.id,r]));return t.map((r,i)=>{var a;const s=r.artifactIds[0]??null;return{page:r,artifactId:s,label:s===null?"":((a=e.get(s))==null?void 0:a.title)??"",key:s??`empty-page-${i}`}})}function B9(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}function pu(n){const t=Number.parseFloat(n);return Number.isFinite(t)?t:0}var ys;class W9 extends St{constructor(){super(...arguments);m(this,ys,new A9(()=>this.render()))}connected(){o(this,ys).connect()}template(e,r,i={}){var s;return o(this,ys).configure({connectionOwner:i.connectionOwner,primaryServerURL:i.primaryServerURL,presentation:i.updatePresentation,desktopRecommendation:i.desktopRecommendation,dismissalStorage:i.dismissalStorage}),i.onRenderComplete&&queueMicrotask(i.onRenderComplete),B`
684
+ <header class="top-bar">
685
+ ${H9(e,r,null,i.onTabReorderChange)}
686
+ <div class="top-bar-controls">
687
+ ${P9((s=i.connectionOwner)==null?void 0:s.connection)}
688
+ ${U9(e)}
689
+ ${o(this,ys).template()}
690
+ </div>
691
+ </header>
692
+ `}disconnected(){o(this,ys).disconnect()}}ys=new WeakMap;const q9=_t(W9);var In,wc,ws,xn,Pt,bc,Gh,bs,Yh,Jh,Kh,Sc,Xh,ct,rl,il,o_;class j9 extends St{constructor(){super(...arguments);m(this,ct);m(this,In,null);m(this,wc);m(this,ws,null);m(this,xn,gp);m(this,Pt,null);m(this,bc,e=>{var r;if(e.key==="Escape"&&o(this,Pt)!==null){e.preventDefault(),e.stopPropagation(),h(this,ct,rl).call(this);return}Z_(e,navigator.platform)&&(e.preventDefault(),e.stopPropagation(),(r=o(this,In))==null||r.handleNavigationKey(e.key))});m(this,Gh,e=>{d(this,wc,e??void 0),this.render()});m(this,bs,()=>{this.render()});m(this,Yh,e=>{if(e.button!==0||o(this,Pt)!==null)return;const r=e.currentTarget,i=r.closest("#app");i!==null&&(r.setPointerCapture(e.pointerId),d(this,Pt,{pointerId:e.pointerId,startX:e.clientX,startWidth:o(this,xn),root:i}),e.preventDefault())});m(this,Jh,e=>{const r=o(this,Pt);r===null||e.pointerId!==r.pointerId||h(this,ct,il).call(this,r.root,r.startWidth+e.clientX-r.startX)});m(this,Kh,e=>{var s;const r=o(this,Pt);if(r===null||e.pointerId!==r.pointerId)return;d(this,Pt,null);const i=((s=o(this,ws))==null?void 0:s.commit(o(this,xn)))??o(this,xn);h(this,ct,il).call(this,r.root,i)});m(this,Sc,e=>{const r=o(this,Pt);r===null||e.pointerId!==r.pointerId||h(this,ct,rl).call(this)});m(this,Xh,e=>{var i;const r=e.currentTarget.closest("#app");r!==null&&((i=o(this,ws))==null||i.clear(),h(this,ct,il).call(this,r,gp))})}update(e,r){const i=r[0],s=r[1].sidebarWidthPreference;return o(this,In)!==i&&(o(this,In)!==null&&this.isConnected&&(o(this,In).removeEventListener("change",o(this,bs)),i.addEventListener("change",o(this,bs))),d(this,In,i)),o(this,ws)!==s&&(h(this,ct,rl).call(this),d(this,ws,s),d(this,xn,s.read()??gp)),super.update(e,r)}connected(){var e;(e=o(this,In))==null||e.addEventListener("change",o(this,bs)),document.addEventListener("keydown",o(this,bc),{capture:!0})}disconnected(){var e;h(this,ct,rl).call(this),(e=o(this,In))==null||e.removeEventListener("change",o(this,bs)),document.removeEventListener("keydown",o(this,bc),{capture:!0})}template(e,r){const i=fO(e.snapshot,r.runtimeServerURL),s=e.snapshot;return r.onRenderComplete&&queueMicrotask(()=>{var a;this.isConnected&&((a=r.onRenderComplete)==null||a.call(r,i.kind))}),B`
693
+ <div
694
+ id="app"
695
+ tabindex="-1"
696
+ data-app-state=${i.kind}
697
+ style=${`--sidebar-width: ${o(this,xn)}px`}
698
+ >
699
+ ${Y9(i)?h(this,ct,o_).call(this,e,s,r):null}
700
+ ${J9(i)?a9(i,e):null}
701
+ </div>
702
+ <div id="foreground-overlay" inert aria-hidden="true"></div>
703
+ `}}In=new WeakMap,wc=new WeakMap,ws=new WeakMap,xn=new WeakMap,Pt=new WeakMap,bc=new WeakMap,Gh=new WeakMap,bs=new WeakMap,Yh=new WeakMap,Jh=new WeakMap,Kh=new WeakMap,Sc=new WeakMap,Xh=new WeakMap,ct=new WeakSet,rl=function(){const e=o(this,Pt);if(e===null)return;d(this,Pt,null),h(this,ct,il).call(this,e.root,e.startWidth);const r=e.root.querySelector(".app-sidebar-resize");r!=null&&r.hasPointerCapture(e.pointerId)&&r.releasePointerCapture(e.pointerId)},il=function(e,r){d(this,xn,a2(r)),e.style.setProperty("--sidebar-width",`${o(this,xn)}px`)},o_=function(e,r,i){return B`
704
+ <aside class="app-sidebar">
705
+ ${oN(e,r,i.electronMode)}
706
+ </aside>
707
+ <div
708
+ class="app-sidebar-resize"
709
+ aria-hidden="true"
710
+ @pointerdown=${o(this,Yh)}
711
+ @pointermove=${o(this,Jh)}
712
+ @pointerup=${o(this,Kh)}
713
+ @pointercancel=${o(this,Sc)}
714
+ @lostpointercapture=${o(this,Sc)}
715
+ @dblclick=${o(this,Xh)}
716
+ ></div>
717
+ <main class="app-main">
718
+ ${q9(e,r.focusedChannel,{connectionOwner:i.connectionOwner,primaryServerURL:i.primaryServerURL,updatePresentation:i.updatePresentation,desktopRecommendation:i.desktopRecommendation,onTabReorderChange:o(this,Gh)})}
719
+ ${qN(e,r.focusedChannel,o(this,wc))}
720
+ </main>
721
+ `};const G9=_t(j9);function Y9(n){return n.kind==="connected"||n.kind==="no-channel"||n.kind==="empty-channel"||n.kind==="disconnected"}function J9(n){return n.kind!=="connected"&&n.kind!=="no-channel"&&n.kind!=="empty-channel"}const a_="television-appearance-mode";function K9(n){return n==="system"||n==="light"||n==="dark"}function X9(){try{const n=window.localStorage.getItem(a_);return K9(n)?n:"system"}catch{return"system"}}function l_(){return window.__televisionAppearanceResolver??Y5(X9())}function Q9(n,t){return t==="light"||t==="dark"?t:n}function e7(n){l_().setPreference(n);try{window.localStorage.setItem(a_,n)}catch{}}document.documentElement.dataset.tvBundleVersion=tg();Object.defineProperty(window,"__tvVersion",{value:tg(),writable:!1,configurable:!1});l_();const t7=f7(),yr=mr(),vg=mx(),c_=gx(),n7=new m$(yr?"television-electron":"television-browser",f$()),r7=new z5(window.localStorage),ny=n2(),i7=ny?Ax({storage:ny,clientApp:yr?"desktop":"browser",desktopAppVersion:yr?ib():null}):null,yg=ci(yr?vg:window.location.origin),wg=V5({search:window.location.search}),Xt=ng(),u_=new G5,bg=j5({detection:wg,primaryServerURL:yg,navigationLatch:Xt,presentation:u_}),ge=new C5({localStore:n7,serverURL:vg,launchToken:c_,telemetryMeta:i7,navigationPending:()=>Xt.pending,...wg.electron?{decideBoot:n=>bg.decideBoot(n)}:{}}),s7=n=>{r$(Be,n)},Be=new jC({connectionOwner:ge,navigationKeyHandler:s7,retainedGateHalted:()=>bg.gated}),oo=globalThis.__televisionNativeBridge;yr&&oo&&oo.onNavigationKey(n=>Be.handleNavigationKey(n));if(c_){const n=new URL(window.location.href);n.searchParams.delete("token"),window.history.replaceState(window.history.state,"",`${n.pathname}${n.search}${n.hash}`)}H5({owner:ge,primaryServerURL:yg,navigationLatch:Xt});bg.attach(ge);const o7=()=>{const n=ge.connection;n.status==="connected"&&n.client.artifacts.list().then(({artifacts:t})=>{const e=new Set(t.map(r=>r.id));O5(e)}).catch(()=>{})},h_=()=>{ge.connection.status==="connected"&&cN(ge.connection.url)};let wh=null,fm=null,d_=ge.connection.status;const a7=()=>{Xt.pending||Xt.begin(()=>{const n=document.querySelector("#settings-popover");if(n!=null&&n.hasAttribute("open")){const t=new URL(window.location.href);t.searchParams.set("reopenSettings","1"),window.history.replaceState(window.history.state,"",`${t.pathname}${t.search}${t.hash}`)}window.location.reload()})},p_=(n,t,e)=>{if(Xt.pending||ge.connection.status!=="connected"||Be.snapshot.connection.status!=="connected"||!Be.snapshot.ready)return;const r={activeThemeName:n,consentIds:new Set(t)},i=wh,s=dN(),a=i!==null&&i.activeThemeName!==r.activeThemeName,l=(i==null?void 0:i.activeThemeName)!==null&&(i==null?void 0:i.activeThemeName)!==void 0&&i.consentIds.has(i.activeThemeName),c=r.activeThemeName!==null&&r.consentIds.has(r.activeThemeName),u=i!==null&&!a&&l&&!c,p=i!==null&&y_(i.consentIds,r.consentIds);if(wh=r,s!==null&&(a||u)){a7();return}if(s===null&&c){A1(ge.connection.url);return}s!==null&&c&&e&&!a&&p&&A1(ge.connection.url)},l7=()=>{const n=document.documentElement.dataset.theme;if(n!=="light"&&n!=="dark")throw new Error("Application root has no effective theme-frame appearance");return n},f_=(n,t)=>{if(Xt.pending||ge.connection.status!=="connected"||Be.snapshot.connection.status!=="connected"||!Be.snapshot.ready)return;const e={activeThemeName:n,serverURL:ge.connection.url,appearance:l7()},r=fm;fm=e,!(!t&&(r==null?void 0:r.activeThemeName)===e.activeThemeName&&r.serverURL===e.serverURL&&r.appearance===e.appearance)&&pN(e.serverURL,e.activeThemeName,()=>Be.listThemes())},m_=()=>{if(!Xt.pending){if(d_=ge.connection.status,ge.connection.status!=="connected"){uN(),hN(),fN(),wh=null,fm=null;return}h_(),o7()}};let mm,gm;const Sg=(n,t)=>{const e=Q9(n,t);e!==mm&&(e7(e),mm=e),e!==gm&&yr&&typeof(oo==null?void 0:oo.setAppearanceMode)=="function"&&(oo.setAppearanceMode(e),gm=e)},_d=()=>{const n=Be.snapshot;if(n.connection.status!=="connected"){mm=void 0,gm=void 0;return}n.ready&&(Sg(n.display.appearanceMode,n.display.activeThemeColorScheme),d_===ge.connection.status&&(p_(n.display.activeThemeName,n.display.themeJavaScriptConsentIds,!1),f_(n.display.activeThemeName,!1)))},c7=n=>{if(Xt.pending)return;Sg(Be.snapshot.display.appearanceMode,n.activeThemeColorScheme);const t=wh,e=t!==null&&t.activeThemeName===n.themeName&&!y_(t.consentIds,new Set(n.themeJavaScriptConsentIds));p_(n.themeName,n.themeJavaScriptConsentIds,!0),!(Xt.pending||e)&&(h_(),f_(n.themeName,!0))},u7=n=>{Xt.pending||Sg(n.appearanceMode,Be.snapshot.display.activeThemeColorScheme)};m_();_d();ge.addEventListener("change",m_);Be.addEventListener("change",_d);Be.addEventListener("theme-changed",c7);Be.addEventListener("appearance-changed",u7);const h7=new MutationObserver(()=>{_d()});h7.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});iw.register("ServerConnectionOwner",()=>ge);iw.register("ApplicationService",()=>Be);const ul=globalThis.__telepath??(globalThis.__telepath={});ul.applicationService=Be;ul.connectionOwner=ge;const d7=ul.renderCompleteCallbacks??(ul.renderCompleteCallbacks=new Set);yr&&document.body.classList.add("electron");let ry=!1,iy=!1;const p7=n=>{if(!t7||iy||n!=="connected"&&n!=="no-channel"&&n!=="empty-channel")return;const t=document.querySelector("#settings-popover");t!==null&&(iy=!0,t.setAttribute("open",""))},g_=()=>{ry||(Lu(G9(Be,{runtimeServerURL:vg,electronMode:yr,connectionOwner:ge,primaryServerURL:yg,updatePresentation:u_,desktopRecommendation:wg,sidebarWidthPreference:r7,onRenderComplete(n){p7(n);for(const t of d7)t(n)}}),document.body),ry=!0,_d())},v_=()=>{const n=ge.connection;n.bootState==="pending"&&!n.hasAuthRejected&&ge.connectError===null||(ge.removeEventListener("change",v_),g_())};yr?ge.addEventListener("change",v_):g_();ge.connect();function f7(){const n=new URL(window.location.href);return n.searchParams.get("reopenSettings")!=="1"?!1:(n.searchParams.delete("reopenSettings"),window.history.replaceState(window.history.state,"",`${n.pathname}${n.search}${n.hash}`),!0)}function y_(n,t){if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0}