@telepath-computer/television 1.4.26 → 1.4.28

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,848 @@
1
+ var bA=Object.defineProperty;var Zv=n=>{throw TypeError(n)};var SA=(n,t,e)=>t in n?bA(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var C=(n,t,e)=>SA(n,typeof t!="symbol"?t+"":t,e),lp=(n,t,e)=>t.has(n)||Zv("Cannot "+e);var o=(n,t,e)=>(lp(n,t,"read from private field"),e?e.call(n):t.get(n)),m=(n,t,e)=>t.has(n)?Zv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),d=(n,t,e,r)=>(lp(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e),h=(n,t,e)=>(lp(n,t,"access private method"),e);var Lh=(n,t,e,r)=>({set _(i){d(n,t,i,e)},get _(){return o(n,t,r)}});import{i as _A,a as AA,b as EA,c as kA,d as TA,e as RA,f as CA,g as IA,U as $A,A as xA,h as PA}from"./artifact-bridge-BEUWXKq7.js";import{m as DA,a as LA,b as OA}from"./missing-artifact-page-DVzJ41AE.js";var eo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function MA(n){if(Object.prototype.hasOwnProperty.call(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 qv={},Vv={},cp,Fv;function h8(){if(Fv)return cp;Fv=1;var n=Object.prototype.toString;return cp=function(e){var r=n.call(e),i=r==="[object Arguments]";return i||(i=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&n.call(e.callee)==="[object Function]"),i},cp}var up,Bv;function NA(){if(Bv)return up;Bv=1;var n;if(!Object.keys){var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=h8(),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(y){var v=y.constructor;return v&&v.prototype===y},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=(function(){if(typeof window>"u")return!1;for(var y in window)try{if(!u["$"+y]&&t.call(window,y)&&window[y]!==null&&typeof window[y]=="object")try{c(window[y])}catch{return!0}}catch{return!0}return!1})(),p=function(y){if(typeof window>"u"||!f)return c(y);try{return c(y)}catch{return!1}};n=function(v){var S=v!==null&&typeof v=="object",_=e.call(v)==="[object Function]",$=r(v),H=S&&e.call(v)==="[object String]",L=[];if(!S&&!_&&!$)throw new TypeError("Object.keys called on a non-object");var z=a&&_;if(H&&v.length>0&&!t.call(v,0))for(var P=0;P<v.length;++P)L.push(String(P));if($&&v.length>0)for(var B=0;B<v.length;++B)L.push(String(B));else for(var q in v)!(z&&q==="prototype")&&t.call(v,q)&&L.push(String(q));if(s)for(var V=p(v),Q=0;Q<l.length;++Q)!(V&&l[Q]==="constructor")&&t.call(v,l[Q])&&L.push(l[Q]);return L}}return up=n,up}var hp,jv;function zA(){if(jv)return hp;jv=1;var n=Array.prototype.slice,t=h8(),e=Object.keys,r=e?function(a){return e(a)}:NA(),i=Object.keys;return r.shim=function(){if(Object.keys){var a=(function(){var l=Object.keys(arguments);return l&&l.length===arguments.length})(1,2);a||(Object.keys=function(c){return t(c)?i(n.call(c)):i(c)})}else Object.keys=r;return Object.keys||r},hp=r,hp}var dp,Wv;function wh(){if(Wv)return dp;Wv=1;var n=Object.defineProperty||!1;if(n)try{n({},"a",{value:1})}catch{n=!1}return dp=n,dp}var fp,Gv;function Ei(){return Gv||(Gv=1,fp=SyntaxError),fp}var pp,Jv;function fe(){return Jv||(Jv=1,pp=TypeError),pp}var mp,Yv;function UA(){return Yv||(Yv=1,mp=Object.getOwnPropertyDescriptor),mp}var gp,Kv;function Wl(){if(Kv)return gp;Kv=1;var n=UA();if(n)try{n([],"length")}catch{n=null}return gp=n,gp}var vp,Xv;function d8(){if(Xv)return vp;Xv=1;var n=wh(),t=Ei(),e=fe(),r=Wl();return vp=function(s,a,l){if(!s||typeof s!="object"&&typeof s!="function")throw new e("`obj` must be an object or a function`");if(typeof a!="string"&&typeof a!="symbol")throw new e("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new e("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new e("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new e("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new e("`loose`, if provided, must be a boolean");var c=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,y=!!r&&r(s,a);if(n)n(s,a,{configurable:f===null&&y?y.configurable:!f,enumerable:c===null&&y?y.enumerable:!c,value:l,writable:u===null&&y?y.writable:!u});else if(p||!c&&!u&&!f)s[a]=l;else throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},vp}var yp,Qv;function Uf(){if(Qv)return yp;Qv=1;var n=wh(),t=function(){return!!n};return t.hasArrayLengthDefineBug=function(){if(!n)return null;try{return n([],"length",{value:1}).length!==1}catch{return!0}},yp=t,yp}var wp,ey;function oa(){if(ey)return wp;ey=1;var n=zA(),t=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",e=Object.prototype.toString,r=Array.prototype.concat,i=d8(),s=function(u){return typeof u=="function"&&e.call(u)==="[object Function]"},a=Uf()(),l=function(u,f,p,y){if(f in u){if(y===!0){if(u[f]===p)return}else if(!s(y)||!y())return}a?i(u,f,p,!0):i(u,f,p)},c=function(u,f){var p=arguments.length>2?arguments[2]:{},y=n(f);t&&(y=r.call(y,Object.getOwnPropertySymbols(f)));for(var v=0;v<y.length;v+=1)l(u,y[v],f[y[v]],p[y[v]])};return c.supportsDescriptors=!!a,wp=c,wp}var pc={exports:{}},ty;function f8(){return ty||(ty=1,typeof self<"u"?pc.exports=self:typeof window<"u"?pc.exports=window:pc.exports=Function("return this")()),pc.exports}var bp,ny;function p8(){if(ny)return bp;ny=1;var n=f8();return bp=function(){return typeof eo!="object"||!eo||eo.Math!==Math||eo.Array!==Array?n:eo},bp}var Sp,ry;function HA(){if(ry)return Sp;ry=1;var n=oa(),t=Wl(),e=p8();return Sp=function(){var i=e();if(n.supportsDescriptors){var s=t(i,"globalThis");(!s||s.configurable&&(s.enumerable||!s.writable||globalThis!==i))&&Object.defineProperty(i,"globalThis",{configurable:!0,enumerable:!1,value:i,writable:!0})}else(typeof globalThis!="object"||globalThis!==i)&&(i.globalThis=i);return i},Sp}var _p,iy;function D1(){if(iy)return _p;iy=1;var n=oa(),t=f8(),e=p8(),r=HA(),i=e(),s=function(){return i};return n(s,{getPolyfill:e,implementation:t,shim:r}),_p=s,_p}var Ap,sy;function ki(){return sy||(sy=1,Ap=function(t){return!!t&&(typeof t=="function"||typeof t=="object")}),Ap}var Ep,oy;function L1(){return oy||(oy=1,Ep=Object),Ep}var kp,ay;function m8(){return ay||(ay=1,kp=Error),kp}var Tp,ly;function ZA(){return ly||(ly=1,Tp=EvalError),Tp}var Rp,cy;function qA(){return cy||(cy=1,Rp=RangeError),Rp}var Cp,uy;function O1(){return uy||(uy=1,Cp=ReferenceError),Cp}var Ip,hy;function VA(){return hy||(hy=1,Ip=URIError),Ip}var $p,dy;function FA(){return dy||(dy=1,$p=Math.abs),$p}var xp,fy;function BA(){return fy||(fy=1,xp=Math.floor),xp}var Pp,py;function jA(){return py||(py=1,Pp=Math.max),Pp}var Dp,my;function WA(){return my||(my=1,Dp=Math.min),Dp}var Lp,gy;function GA(){return gy||(gy=1,Lp=Math.pow),Lp}var Op,vy;function JA(){return vy||(vy=1,Op=Math.round),Op}var Mp,yy;function M1(){return yy||(yy=1,Mp=Number.isNaN||function(t){return t!==t}),Mp}var Np,wy;function YA(){if(wy)return Np;wy=1;var n=M1();return Np=function(e){return n(e)||e===0?e:e<0?-1:1},Np}var zp,by;function Gl(){return by||(by=1,zp=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}),zp}var Up,Sy;function N1(){if(Sy)return Up;Sy=1;var n=typeof Symbol<"u"&&Symbol,t=Gl();return Up=function(){return typeof n!="function"||typeof Symbol!="function"||typeof n("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},Up}var Hp,_y;function g8(){return _y||(_y=1,Hp=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Hp}var Zp,Ay;function v8(){if(Ay)return Zp;Ay=1;var n=L1();return Zp=n.getPrototypeOf||null,Zp}var qp,Ey;function KA(){if(Ey)return qp;Ey=1;var n="Function.prototype.bind called on incompatible ",t=Object.prototype.toString,e=Math.max,r="[object Function]",i=function(c,u){for(var f=[],p=0;p<c.length;p+=1)f[p]=c[p];for(var y=0;y<u.length;y+=1)f[y+c.length]=u[y];return f},s=function(c,u){for(var f=[],p=u,y=0;p<c.length;p+=1,y+=1)f[y]=c[p];return f},a=function(l,c){for(var u="",f=0;f<l.length;f+=1)u+=l[f],f+1<l.length&&(u+=c);return u};return qp=function(c){var u=this;if(typeof u!="function"||t.apply(u)!==r)throw new TypeError(n+u);for(var f=s(arguments,1),p,y=function(){if(this instanceof p){var H=u.apply(this,i(f,arguments));return Object(H)===H?H:this}return u.apply(c,i(f,arguments))},v=e(0,u.length-f.length),S=[],_=0;_<v;_++)S[_]="$"+_;if(p=Function("binder","return function ("+a(S,",")+"){ return binder.apply(this,arguments); }")(y),u.prototype){var $=function(){};$.prototype=u.prototype,p.prototype=new $,$.prototype=null}return p},qp}var Vp,ky;function bh(){if(ky)return Vp;ky=1;var n=KA();return Vp=Function.prototype.bind||n,Vp}var Fp,Ty;function z1(){return Ty||(Ty=1,Fp=Function.prototype.call),Fp}var Bp,Ry;function U1(){return Ry||(Ry=1,Bp=Function.prototype.apply),Bp}var jp,Cy;function XA(){return Cy||(Cy=1,jp=typeof Reflect<"u"&&Reflect&&Reflect.apply),jp}var Wp,Iy;function y8(){if(Iy)return Wp;Iy=1;var n=bh(),t=U1(),e=z1(),r=XA();return Wp=r||n.call(e,t),Wp}var Gp,$y;function Hf(){if($y)return Gp;$y=1;var n=bh(),t=fe(),e=z1(),r=y8();return Gp=function(s){if(s.length<1||typeof s[0]!="function")throw new t("a function is required");return r(n,e,s)},Gp}var Jp,xy;function QA(){if(xy)return Jp;xy=1;var n=Hf(),t=Wl(),e;try{e=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var r=!!e&&t&&t(Object.prototype,"__proto__"),i=Object,s=i.getPrototypeOf;return Jp=r&&typeof r.get=="function"?n([r.get]):typeof s=="function"?function(l){return s(l==null?l:i(l))}:!1,Jp}var Yp,Py;function w8(){if(Py)return Yp;Py=1;var n=g8(),t=v8(),e=QA();return Yp=n?function(i){return n(i)}:t?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return t(i)}:e?function(i){return e(i)}:null,Yp}var Kp,Dy;function Ti(){if(Dy)return Kp;Dy=1;var n=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=bh();return Kp=e.call(n,t),Kp}var Xp,Ly;function In(){if(Ly)return Xp;Ly=1;var n,t=L1(),e=m8(),r=ZA(),i=qA(),s=O1(),a=Ei(),l=fe(),c=VA(),u=FA(),f=BA(),p=jA(),y=WA(),v=GA(),S=JA(),_=YA(),$=Function,H=function(bt){try{return $('"use strict"; return ('+bt+").constructor;")()}catch{}},L=Wl(),z=wh(),P=function(){throw new l},B=L?(function(){try{return arguments.callee,P}catch{try{return L(arguments,"callee").get}catch{return P}}})():P,q=N1()(),V=w8(),Q=v8(),F=g8(),re=U1(),Ne=z1(),xe={},et=typeof Uint8Array>"u"||!V?n:V(Uint8Array),le={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?n:ArrayBuffer,"%ArrayIteratorPrototype%":q&&V?V([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":xe,"%AsyncGenerator%":xe,"%AsyncGeneratorFunction%":xe,"%AsyncIteratorPrototype%":xe,"%Atomics%":typeof Atomics>"u"?n:Atomics,"%BigInt%":typeof BigInt>"u"?n:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?n:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":r,"%Float16Array%":typeof Float16Array>"u"?n:Float16Array,"%Float32Array%":typeof Float32Array>"u"?n:Float32Array,"%Float64Array%":typeof Float64Array>"u"?n:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?n:FinalizationRegistry,"%Function%":$,"%GeneratorFunction%":xe,"%Int8Array%":typeof Int8Array>"u"?n:Int8Array,"%Int16Array%":typeof Int16Array>"u"?n:Int16Array,"%Int32Array%":typeof Int32Array>"u"?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":q&&V?V(V([][Symbol.iterator]())):n,"%JSON%":typeof JSON=="object"?JSON:n,"%Map%":typeof Map>"u"?n:Map,"%MapIteratorPrototype%":typeof Map>"u"||!q||!V?n:V(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":t,"%Object.getOwnPropertyDescriptor%":L,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?n:Promise,"%Proxy%":typeof Proxy>"u"?n:Proxy,"%RangeError%":i,"%ReferenceError%":s,"%Reflect%":typeof Reflect>"u"?n:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?n:Set,"%SetIteratorPrototype%":typeof Set>"u"||!q||!V?n:V(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":q&&V?V(""[Symbol.iterator]()):n,"%Symbol%":q?Symbol:n,"%SyntaxError%":a,"%ThrowTypeError%":B,"%TypedArray%":et,"%TypeError%":l,"%Uint8Array%":typeof Uint8Array>"u"?n:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?n:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?n:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?n:Uint32Array,"%URIError%":c,"%WeakMap%":typeof WeakMap>"u"?n:WeakMap,"%WeakRef%":typeof WeakRef>"u"?n:WeakRef,"%WeakSet%":typeof WeakSet>"u"?n:WeakSet,"%Function.prototype.call%":Ne,"%Function.prototype.apply%":re,"%Object.defineProperty%":z,"%Object.getPrototypeOf%":Q,"%Math.abs%":u,"%Math.floor%":f,"%Math.max%":p,"%Math.min%":y,"%Math.pow%":v,"%Math.round%":S,"%Math.sign%":_,"%Reflect.getPrototypeOf%":F};if(V)try{null.error}catch(bt){var We=V(V(bt));le["%Error.prototype%"]=We}var Dt=function bt(Ce){var Be;if(Ce==="%AsyncFunction%")Be=H("async function () {}");else if(Ce==="%GeneratorFunction%")Be=H("function* () {}");else if(Ce==="%AsyncGeneratorFunction%")Be=H("async function* () {}");else if(Ce==="%AsyncGenerator%"){var Pe=bt("%AsyncGeneratorFunction%");Pe&&(Be=Pe.prototype)}else if(Ce==="%AsyncIteratorPrototype%"){var Ge=bt("%AsyncGenerator%");Ge&&V&&(Be=V(Ge.prototype))}return le[Ce]=Be,Be},Pn={__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"]},ht=bh(),wt=Ti(),Ms=ht.call(Ne,Array.prototype.concat),ca=ht.call(re,Array.prototype.splice),Ns=ht.call(Ne,String.prototype.replace),Ci=ht.call(Ne,String.prototype.slice),Ee=ht.call(Ne,RegExp.prototype.exec),sc=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Dn=/\\(\\)?/g,zs=function(Ce){var Be=Ci(Ce,0,1),Pe=Ci(Ce,-1);if(Be==="%"&&Pe!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(Pe==="%"&&Be!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var Ge=[];return Ns(Ce,sc,function(ce,fn,oe,at){Ge[Ge.length]=oe?Ns(at,Dn,"$1"):fn||ce}),Ge},oc=function(Ce,Be){var Pe=Ce,Ge;if(wt(Pn,Pe)&&(Ge=Pn[Pe],Pe="%"+Ge[0]+"%"),wt(le,Pe)){var ce=le[Pe];if(ce===xe&&(ce=Dt(Pe)),typeof ce>"u"&&!Be)throw new l("intrinsic "+Ce+" exists, but is not available. Please file an issue!");return{alias:Ge,name:Pe,value:ce}}throw new a("intrinsic "+Ce+" does not exist!")};return Xp=function(Ce,Be){if(typeof Ce!="string"||Ce.length===0)throw new l("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Be!="boolean")throw new l('"allowMissing" argument must be a boolean');if(Ee(/^%?[^%]*%?$/,Ce)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Pe=zs(Ce),Ge=Pe.length>0?Pe[0]:"",ce=oc("%"+Ge+"%",Be),fn=ce.name,oe=ce.value,at=!1,ze=ce.alias;ze&&(Ge=ze[0],ca(Pe,Ms([0,1],ze)));for(var pn=1,Ln=!0;pn<Pe.length;pn+=1){var Je=Pe[pn],xr=Ci(Je,0,1),Qn=Ci(Je,-1);if((xr==='"'||xr==="'"||xr==="`"||Qn==='"'||Qn==="'"||Qn==="`")&&xr!==Qn)throw new a("property names with quotes must have matching quotes");if((Je==="constructor"||!Ln)&&(at=!0),Ge+="."+Je,fn="%"+Ge+"%",wt(le,fn))oe=le[fn];else if(oe!=null){if(!(Je in oe)){if(!Be)throw new l("base intrinsic for "+Ce+" exists, but the property is not available.");return}if(L&&pn+1>=Pe.length){var Pr=L(oe,Je);Ln=!!Pr,Ln&&"get"in Pr&&!("originalValue"in Pr.get)?oe=Pr.get:oe=oe[Je]}else Ln=wt(oe,Je),oe=oe[Je];Ln&&!at&&(le[fn]=oe)}}return oe},Xp}var Qp,Oy;function Ds(){if(Oy)return Qp;Oy=1;var n=In(),t=Hf(),e=t([n("%String.prototype.indexOf%")]);return Qp=function(i,s){var a=n(i,!!s);return typeof a=="function"&&e(i,".prototype.")>-1?t([a]):a},Qp}var e0,My;function H1(){if(My)return e0;My=1;var n=In(),t=n("%Array%"),e=!t.isArray&&Ds()("Object.prototype.toString");return e0=t.isArray||function(i){return e(i)==="[object Array]"},e0}var t0,Ny;function Z1(){if(Ny)return t0;Ny=1;var n=Uf(),t=wh(),e=n.hasArrayLengthDefineBug(),r=e&&H1(),i=Ds(),s=i("Object.prototype.propertyIsEnumerable");return t0=function(l,c,u,f,p,y){if(!t){if(!l(y)||!y["[[Configurable]]"]||!y["[[Writable]]"]||p in f&&s(f,p)!==!!y["[[Enumerable]]"])return!1;var v=y["[[Value]]"];return f[p]=v,c(f[p],v)}return e&&p==="length"&&"[[Value]]"in y&&r(f)&&f.length!==y["[[Value]]"]?(f.length=y["[[Value]]"],f.length===y["[[Value]]"]):(t(f,p,u(y)),!0)},t0}var n0,zy;function Jl(){if(zy)return n0;zy=1;var n=fe(),t=Ti(),e={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};return n0=function(i){if(!i||typeof i!="object")return!1;for(var s in i)if(t(i,s)&&!e[s])return!1;var a=t(i,"[[Value]]")||t(i,"[[Writable]]"),l=t(i,"[[Get]]")||t(i,"[[Set]]");if(a&&l)throw new n("Property Descriptors may not be both accessor and data descriptors");return!0},n0}var r0,Uy;function b8(){return Uy||(Uy=1,r0=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}),r0}var i0,Hy;function S8(){if(Hy)return i0;Hy=1;var n=fe(),t=Jl(),e=b8();return i0=function(i){if(typeof i<"u"&&!t(i))throw new n("Assertion failed: `Desc` must be a Property Descriptor");return e(i)},i0}var s0,Zy;function _8(){if(Zy)return s0;Zy=1;var n=fe(),t=Ti(),e=Jl();return s0=function(i){if(typeof i>"u")return!1;if(!e(i))throw new n("Assertion failed: `Desc` must be a Property Descriptor");return!(!t(i,"[[Value]]")&&!t(i,"[[Writable]]"))},s0}var o0,qy;function Yl(){return qy||(qy=1,o0=function(t){return typeof t=="string"||typeof t=="symbol"}),o0}var a0,Vy;function A8(){if(Vy)return a0;Vy=1;var n=M1();return a0=function(e,r){return e===r?e===0?1/e===1/r:!0:n(e)&&n(r)},a0}var l0,Fy;function q1(){if(Fy)return l0;Fy=1;var n=fe(),t=ki(),e=Z1(),r=S8(),i=_8(),s=Yl(),a=A8();return l0=function(c,u,f){if(!t(c))throw new n("Assertion failed: Type(O) is not Object");if(!s(u))throw new n("Assertion failed: P is not a Property Key");var p={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":f,"[[Writable]]":!0};return e(i,a,r,c,u,p)},l0}var c0,By;function E8(){if(By)return c0;By=1;var n=Function.prototype.toString,t=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,e,r;if(typeof t=="function"&&typeof Object.defineProperty=="function")try{e=Object.defineProperty({},"length",{get:function(){throw r}}),r={},t(function(){throw 42},null,e)}catch(L){L!==r&&(t=null)}else t=null;var i=/^\s*class\b/,s=function(z){try{var P=n.call(z);return i.test(P)}catch{return!1}},a=function(z){try{return s(z)?!1:(n.call(z),!0)}catch{return!1}},l=Object.prototype.toString,c="[object Object]",u="[object Function]",f="[object GeneratorFunction]",p="[object HTMLAllCollection]",y="[object HTML document.all class]",v="[object HTMLCollection]",S=typeof Symbol=="function"&&!!Symbol.toStringTag,_=!(0 in[,]),$=function(){return!1};if(typeof document=="object"){var H=document.all;l.call(H)===l.call(document.all)&&($=function(z){if((_||!z)&&(typeof z>"u"||typeof z=="object"))try{var P=l.call(z);return(P===p||P===y||P===v||P===c)&&z("")==null}catch{}return!1})}return c0=t?function(z){if($(z))return!0;if(!z||typeof z!="function"&&typeof z!="object")return!1;try{t(z,null,e)}catch(P){if(P!==r)return!1}return!s(z)&&a(z)}:function(z){if($(z))return!0;if(!z||typeof z!="function"&&typeof z!="object")return!1;if(S)return a(z);if(s(z))return!1;var P=l.call(z);return P!==u&&P!==f&&!/^\[object HTML/.test(P)?!1:a(z)},c0}var u0,jy;function eE(){return jy||(jy=1,u0=E8()),u0}var h0,Wy;function tE(){return Wy||(Wy=1,h0=function(t){return!!t}),h0}var d0,Gy;function nE(){if(Gy)return d0;Gy=1;var n=Ti(),t=fe(),e=ki(),r=eE(),i=tE();return d0=function(a){if(!e(a))throw new t("ToPropertyDescriptor requires an object");var l={};if(n(a,"enumerable")&&(l["[[Enumerable]]"]=i(a.enumerable)),n(a,"configurable")&&(l["[[Configurable]]"]=i(a.configurable)),n(a,"value")&&(l["[[Value]]"]=a.value),n(a,"writable")&&(l["[[Writable]]"]=i(a.writable)),n(a,"get")){var c=a.get;if(typeof c<"u"&&!r(c))throw new t("getter must be a function");l["[[Get]]"]=c}if(n(a,"set")){var u=a.set;if(typeof u<"u"&&!r(u))throw new t("setter must be a function");l["[[Set]]"]=u}if((n(l,"[[Get]]")||n(l,"[[Set]]"))&&(n(l,"[[Value]]")||n(l,"[[Writable]]")))throw new t("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return l},d0}var f0,Jy;function rE(){if(Jy)return f0;Jy=1;var n=fe(),t=ki(),e=Jl(),r=Z1(),i=S8(),s=_8(),a=Yl(),l=A8(),c=nE();return f0=function(f,p,y){if(!t(f))throw new n("Assertion failed: Type(O) is not Object");if(!a(p))throw new n("Assertion failed: P is not a Property Key");var v=e(y)?y:c(y);if(!e(v))throw new n("Assertion failed: Desc is not a valid Property Descriptor");return r(s,l,i,f,p,v)},f0}var p0,Yy;function iE(){if(Yy)return p0;Yy=1;var n=fe(),t=ki(),e=rE(),r=Yl();return p0=function(s,a,l){if(!t(s))throw new n("Assertion failed: Type(O) is not Object");if(!r(a))throw new n("Assertion failed: P is not a Property Key");var c={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":l,"[[Writable]]":!0};return e(s,a,c)},p0}var m0,Ky;function sE(){return Ky||(Ky=1,m0=typeof Reflect<"u"&&Reflect.setPrototypeOf||null),m0}var g0,Xy;function oE(){if(Xy)return g0;Xy=1;var n=L1();return g0=n.setPrototypeOf||null,g0}var v0,Qy;function aE(){if(Qy)return v0;Qy=1;var n=Hf(),t=Wl(),e=fe(),r={};try{r.__proto__=null}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var i=!("toString"in r),s=t&&t(Object.prototype,"__proto__");return v0=i&&(!!s&&typeof s.set=="function"&&n([s.set])||function(l,c){if(l==null)throw new e("set Object.prototype.__proto__ called on null or undefined");return l.__proto__=c,c}),v0}var y0,ew;function lE(){if(ew)return y0;ew=1;var n=sE(),t=oE(),e=aE(),r=fe();return y0=n?function(s,a){if(n(s,a))return s;throw new r("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:t||(e?function(s,a){return e(s,a),s}:null),y0}var w0,tw;function cE(){if(tw)return w0;tw=1;var n=fe(),t=ki(),e=w8();return w0=function(i){if(!t(i))throw new n("Assertion failed: O must be an Object");if(!e)throw new n("This environment does not support fetching prototypes.");return e(i)},w0}var b0,nw;function uE(){if(nw)return b0;nw=1;var n=fe(),t=lE(),e=ki(),r=cE();return b0=function(s,a){if(a!==null&&!e(a))throw new n("Assertion failed: V must be Object or Null");try{t(s,a)}catch{return!1}return r(s)===a},b0}var S0,rw;function hE(){if(rw)return S0;rw=1;var n=q1(),t=iE(),e=uE(),r=Uf()(),i=m8();function s(l,c,u){var f=new i(u);return e(f,a),delete f.constructor,t(f,"error",l),t(f,"suppressed",c),f}r&&Object.defineProperty(s,"prototype",{writable:!1});var a=s.prototype;if(!n(a,"constructor",s)||!n(a,"message","")||!n(a,"name","SuppressedError"))throw new i("unable to install SuppressedError.prototype properties; please report this!");return e(s.prototype,i.prototype),S0=s,S0}var _0,iw;function k8(){if(iw)return _0;iw=1;var n=hE();return _0=function(){return typeof SuppressedError=="function"?SuppressedError:n},_0}var A0,sw;function dE(){if(sw)return A0;sw=1;var n=oa(),t=D1()(),e=k8();return A0=function(){var i=e();return n(t,{SuppressedError:i},{SuppressedError:function(){return t.SuppressedError!==i}}),i},A0}var ow;function fE(){return ow||(ow=1,dE()()),Vv}var E0,aw;function pE(){if(aw)return E0;aw=1;var n=fe(),t=Jl(),e=b8();return E0=function(i){if(typeof i<"u"&&!t(i))throw new n("Assertion failed: `Desc` must be a Property Descriptor");return e(i)},E0}var k0,lw;function mE(){if(lw)return k0;lw=1;var n=fe(),t=Ti(),e=Jl();return k0=function(i){if(typeof i>"u")return!1;if(!e(i))throw new n("Assertion failed: `Desc` must be a Property Descriptor");return!(!t(i,"[[Value]]")&&!t(i,"[[Writable]]"))},k0}var T0,cw;function gE(){if(cw)return T0;cw=1;var n=M1();return T0=function(e,r){return e===r?e===0?1/e===1/r:!0:n(e)&&n(r)},T0}var R0,uw;function Kl(){return uw||(uw=1,R0=E8()),R0}var C0,hw;function vE(){return hw||(hw=1,C0=function(t){return!!t}),C0}var I0,dw;function yE(){if(dw)return I0;dw=1;var n=Ti(),t=fe(),e=ki(),r=Kl(),i=vE();return I0=function(a){if(!e(a))throw new t("ToPropertyDescriptor requires an object");var l={};if(n(a,"enumerable")&&(l["[[Enumerable]]"]=i(a.enumerable)),n(a,"configurable")&&(l["[[Configurable]]"]=i(a.configurable)),n(a,"value")&&(l["[[Value]]"]=a.value),n(a,"writable")&&(l["[[Writable]]"]=i(a.writable)),n(a,"get")){var c=a.get;if(typeof c<"u"&&!r(c))throw new t("getter must be a function");l["[[Get]]"]=c}if(n(a,"set")){var u=a.set;if(typeof u<"u"&&!r(u))throw new t("setter must be a function");l["[[Set]]"]=u}if((n(l,"[[Get]]")||n(l,"[[Set]]"))&&(n(l,"[[Value]]")||n(l,"[[Writable]]")))throw new t("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return l},I0}var $0,fw;function Sh(){if(fw)return $0;fw=1;var n=fe(),t=ki(),e=Jl(),r=Z1(),i=pE(),s=mE(),a=Yl(),l=gE(),c=yE();return $0=function(f,p,y){if(!t(f))throw new n("Assertion failed: Type(O) is not Object");if(!a(p))throw new n("Assertion failed: P is not a Property Key");var v=e(y)?y:c(y);if(!e(v))throw new n("Assertion failed: Desc is not a valid Property Descriptor");return r(s,l,i,f,p,v)},$0}var x0,pw;function wE(){if(pw)return x0;pw=1;var n=Gl()();return x0=n?Symbol.dispose||Symbol("Symbol.dispose"):null,x0}var P0,mw;function V1(){if(mw)return P0;mw=1;var n=Gl(),t=wE();return P0=function(){return n()&&Symbol.dispose||t},P0}var D0,gw;function bE(){if(gw)return D0;gw=1;var n=N1(),t=Sh(),e=V1();return D0=function(){var i=e();return n()&&t(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":i}),i},D0}var L0,vw;function SE(){if(vw)return L0;vw=1;var n=Gl()();return L0=n?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,L0}var O0,yw;function F1(){if(yw)return O0;yw=1;var n=Gl(),t=SE();return O0=function(){return n()&&Symbol.asyncDispose||t},O0}var M0,ww;function _E(){if(ww)return M0;ww=1;var n=N1(),t=Sh(),e=F1();return M0=function(){var i=e();return n()&&t(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":i}),i},M0}var N0,bw;function AE(){return bw||(bw=1,N0=H1()),N0}var z0,Sw;function Zf(){if(Sw)return z0;Sw=1;var n=In(),t=Ds(),e=fe(),r=AE(),i=n("%Reflect.apply%",!0)||t("Function.prototype.apply");return z0=function(a,l){var c=arguments.length>2?arguments[2]:[];if(!r(c))throw new e("Assertion failed: optional `argumentsList`, if provided, must be a List");return i(a,l,c)},z0}const EE={},kE=Object.freeze(Object.defineProperty({__proto__:null,default:EE},Symbol.toStringTag,{value:"Module"})),TE=MA(kE);var U0,_w;function Xl(){if(_w)return U0;_w=1;var n=typeof Map=="function"&&Map.prototype,t=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,e=n&&t&&typeof t.get=="function"?t.get:null,r=n&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,s=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,a=i&&s&&typeof s.get=="function"?s.get:null,l=i&&Set.prototype.forEach,c=typeof WeakMap=="function"&&WeakMap.prototype,u=c?WeakMap.prototype.has:null,f=typeof WeakSet=="function"&&WeakSet.prototype,p=f?WeakSet.prototype.has:null,y=typeof WeakRef=="function"&&WeakRef.prototype,v=y?WeakRef.prototype.deref:null,S=Boolean.prototype.valueOf,_=Object.prototype.toString,$=Function.prototype.toString,H=String.prototype.match,L=String.prototype.slice,z=String.prototype.replace,P=String.prototype.toUpperCase,B=String.prototype.toLowerCase,q=RegExp.prototype.test,V=Array.prototype.concat,Q=Array.prototype.join,F=Array.prototype.slice,re=Math.floor,Ne=typeof BigInt=="function"?BigInt.prototype.valueOf:null,xe=Object.getOwnPropertySymbols,et=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,le=typeof Symbol=="function"&&typeof Symbol.iterator=="object",We=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===le||!0)?Symbol.toStringTag:null,Dt=Object.prototype.propertyIsEnumerable,Pn=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(k){return k.__proto__}:null);function ht(k,R){if(k===1/0||k===-1/0||k!==k||k&&k>-1e3&&k<1e3||q.call(/e/,R))return R;var pe=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof k=="number"){var Se=k<0?-re(-k):re(k);if(Se!==k){var ke=String(Se),te=L.call(R,ke.length+1);return z.call(ke,pe,"$&_")+"."+z.call(z.call(te,/([0-9]{3})/g,"$&_"),/_$/,"")}}return z.call(R,pe,"$&_")}var wt=TE,Ms=wt.custom,ca=ce(Ms)?Ms:null,Ns={__proto__:null,double:'"',single:"'"},Ci={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};U0=function k(R,pe,Se,ke){var te=pe||{};if(at(te,"quoteStyle")&&!at(Ns,te.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(at(te,"maxStringLength")&&(typeof te.maxStringLength=="number"?te.maxStringLength<0&&te.maxStringLength!==1/0:te.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var St=at(te,"customInspect")?te.customInspect:!0;if(typeof St!="boolean"&&St!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(at(te,"indent")&&te.indent!==null&&te.indent!==" "&&!(parseInt(te.indent,10)===te.indent&&te.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(at(te,"numericSeparator")&&typeof te.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var nr=te.numericSeparator;if(typeof R>"u")return"undefined";if(R===null)return"null";if(typeof R=="boolean")return R?"true":"false";if(typeof R=="string")return tr(R,te);if(typeof R=="number"){if(R===0)return 1/0/R>0?"0":"-0";var dt=String(R);return nr?ht(R,dt):dt}if(typeof R=="bigint"){var On=String(R)+"n";return nr?ht(R,On):On}var ua=typeof te.depth>"u"?5:te.depth;if(typeof Se>"u"&&(Se=0),Se>=ua&&ua>0&&typeof R=="object")return zs(R)?"[Array]":"[Object]";var Mr=$i(te,Se);if(typeof ke>"u")ke=[];else if(Ln(ke,R)>=0)return"[Circular]";function ft(Di,Vs,hc){if(Vs&&(ke=F.call(ke),ke.push(Vs)),hc){var dc={depth:te.depth};return at(te,"quoteStyle")&&(dc.quoteStyle=te.quoteStyle),k(Di,dc,Se+1,ke)}return k(Di,te,Se+1,ke)}if(typeof R=="function"&&!bt(R)){var Hs=pn(R),Jt=Or(R,ft);return"[Function"+(Hs?": "+Hs:" (anonymous)")+"]"+(Jt.length>0?" { "+Q.call(Jt,", ")+" }":"")}if(ce(R)){var Nr=le?z.call(String(R),/^(Symbol\(.*\))_[^)]*$/,"$1"):et.call(R);return typeof R=="object"&&!le?Lr(Nr):Nr}if(er(R)){for(var zr="<"+B.call(String(R.nodeName)),Zs=R.attributes||[],ha=0;ha<Zs.length;ha++)zr+=" "+Zs[ha].name+"="+Ee(sc(Zs[ha].value),"double",te);return zr+=">",R.childNodes&&R.childNodes.length&&(zr+="..."),zr+="</"+B.call(String(R.nodeName))+">",zr}if(zs(R)){if(R.length===0)return"[]";var da=Or(R,ft);return Mr&&!ac(da)?"["+xi(da,Mr)+"]":"[ "+Q.call(da,", ")+" ]"}if(Ce(R)){var qs=Or(R,ft);return!("cause"in Error.prototype)&&"cause"in R&&!Dt.call(R,"cause")?"{ ["+String(R)+"] "+Q.call(V.call("[cause]: "+ft(R.cause),qs),", ")+" }":qs.length===0?"["+String(R)+"]":"{ ["+String(R)+"] "+Q.call(qs,", ")+" }"}if(typeof R=="object"&&St){if(ca&&typeof R[ca]=="function"&&wt)return wt(R,{depth:ua-Se});if(St!=="symbol"&&typeof R.inspect=="function")return R.inspect()}if(Je(R)){var lc=[];return r&&r.call(R,function(Di,Vs){lc.push(ft(Vs,R,!0)+" => "+ft(Di,R))}),Us("Map",e.call(R),lc,Mr)}if(Pr(R)){var fa=[];return l&&l.call(R,function(Di){fa.push(ft(Di,R))}),Us("Set",a.call(R),fa,Mr)}if(xr(R))return Ii("WeakMap");if(Th(R))return Ii("WeakSet");if(Qn(R))return Ii("WeakRef");if(Pe(R))return Lr(ft(Number(R)));if(fn(R))return Lr(ft(Ne.call(R)));if(Ge(R))return Lr(S.call(R));if(Be(R))return Lr(ft(String(R)));if(typeof window<"u"&&R===window)return"{ [object Window] }";if(typeof globalThis<"u"&&R===globalThis||typeof eo<"u"&&R===eo)return"{ [object globalThis] }";if(!oc(R)&&!bt(R)){var cc=Or(R,ft),Pi=Pn?Pn(R)===Object.prototype:R instanceof Object||R.constructor===Object,uc=R instanceof Object?"":"null prototype",Rh=!Pi&&We&&Object(R)===R&&We in R?L.call(ze(R),8,-1):uc?"Object":"",Ue=Pi||typeof R.constructor!="function"?"":R.constructor.name?R.constructor.name+" ":"",rr=Ue+(Rh||uc?"["+Q.call(V.call([],Rh||[],uc||[]),": ")+"] ":"");return cc.length===0?rr+"{}":Mr?rr+"{"+xi(cc,Mr)+"}":rr+"{ "+Q.call(cc,", ")+" }"}return String(R)};function Ee(k,R,pe){var Se=pe.quoteStyle||R,ke=Ns[Se];return ke+k+ke}function sc(k){return z.call(String(k),/"/g,"&quot;")}function Dn(k){return!We||!(typeof k=="object"&&(We in k||typeof k[We]<"u"))}function zs(k){return ze(k)==="[object Array]"&&Dn(k)}function oc(k){return ze(k)==="[object Date]"&&Dn(k)}function bt(k){return ze(k)==="[object RegExp]"&&Dn(k)}function Ce(k){return ze(k)==="[object Error]"&&Dn(k)}function Be(k){return ze(k)==="[object String]"&&Dn(k)}function Pe(k){return ze(k)==="[object Number]"&&Dn(k)}function Ge(k){return ze(k)==="[object Boolean]"&&Dn(k)}function ce(k){if(le)return k&&typeof k=="object"&&k instanceof Symbol;if(typeof k=="symbol")return!0;if(!k||typeof k!="object"||!et)return!1;try{return et.call(k),!0}catch{}return!1}function fn(k){if(!k||typeof k!="object"||!Ne)return!1;try{return Ne.call(k),!0}catch{}return!1}var oe=Object.prototype.hasOwnProperty||function(k){return k in this};function at(k,R){return oe.call(k,R)}function ze(k){return _.call(k)}function pn(k){if(k.name)return k.name;var R=H.call($.call(k),/^function\s*([\w$]+)/);return R?R[1]:null}function Ln(k,R){if(k.indexOf)return k.indexOf(R);for(var pe=0,Se=k.length;pe<Se;pe++)if(k[pe]===R)return pe;return-1}function Je(k){if(!e||!k||typeof k!="object")return!1;try{e.call(k);try{a.call(k)}catch{return!0}return k instanceof Map}catch{}return!1}function xr(k){if(!u||!k||typeof k!="object")return!1;try{u.call(k,u);try{p.call(k,p)}catch{return!0}return k instanceof WeakMap}catch{}return!1}function Qn(k){if(!v||!k||typeof k!="object")return!1;try{return v.call(k),!0}catch{}return!1}function Pr(k){if(!a||!k||typeof k!="object")return!1;try{a.call(k);try{e.call(k)}catch{return!0}return k instanceof Set}catch{}return!1}function Th(k){if(!p||!k||typeof k!="object")return!1;try{p.call(k,p);try{u.call(k,u)}catch{return!0}return k instanceof WeakSet}catch{}return!1}function er(k){return!k||typeof k!="object"?!1:typeof HTMLElement<"u"&&k instanceof HTMLElement?!0:typeof k.nodeName=="string"&&typeof k.getAttribute=="function"}function tr(k,R){if(k.length>R.maxStringLength){var pe=k.length-R.maxStringLength,Se="... "+pe+" more character"+(pe>1?"s":"");return tr(L.call(k,0,R.maxStringLength),R)+Se}var ke=Ci[R.quoteStyle||"single"];ke.lastIndex=0;var te=z.call(z.call(k,ke,"\\$1"),/[\x00-\x1f]/g,Dr);return Ee(te,"single",R)}function Dr(k){var R=k.charCodeAt(0),pe={8:"b",9:"t",10:"n",12:"f",13:"r"}[R];return pe?"\\"+pe:"\\x"+(R<16?"0":"")+P.call(R.toString(16))}function Lr(k){return"Object("+k+")"}function Ii(k){return k+" { ? }"}function Us(k,R,pe,Se){var ke=Se?xi(pe,Se):Q.call(pe,", ");return k+" ("+R+") {"+ke+"}"}function ac(k){for(var R=0;R<k.length;R++)if(Ln(k[R],`
2
+ `)>=0)return!1;return!0}function $i(k,R){var pe;if(k.indent===" ")pe=" ";else if(typeof k.indent=="number"&&k.indent>0)pe=Q.call(Array(k.indent+1)," ");else return null;return{base:pe,prev:Q.call(Array(R+1),pe)}}function xi(k,R){if(k.length===0)return"";var pe=`
3
+ `+R.prev+R.base;return pe+Q.call(k,","+pe)+`
4
+ `+R.prev}function Or(k,R){var pe=zs(k),Se=[];if(pe){Se.length=k.length;for(var ke=0;ke<k.length;ke++)Se[ke]=at(k,ke)?R(k[ke],k):""}var te=typeof xe=="function"?xe(k):[],St;if(le){St={};for(var nr=0;nr<te.length;nr++)St["$"+te[nr]]=te[nr]}for(var dt in k)at(k,dt)&&(pe&&String(Number(dt))===dt&&dt<k.length||le&&St["$"+dt]instanceof Symbol||(q.call(/[^\w$]/,dt)?Se.push(R(dt,k)+": "+R(k[dt],k)):Se.push(dt+": "+R(k[dt],k))));if(typeof xe=="function")for(var On=0;On<te.length;On++)Dt.call(k,te[On])&&Se.push("["+R(te[On])+"]: "+R(k[te[On]],k));return Se}return U0}var H0,Aw;function RE(){if(Aw)return H0;Aw=1;var n=Xl(),t=fe(),e=function(l,c,u){for(var f=l,p;(p=f.next)!=null;f=p)if(p.key===c)return f.next=p.next,u||(p.next=l.next,l.next=p),p},r=function(l,c){if(l){var u=e(l,c);return u&&u.value}},i=function(l,c,u){var f=e(l,c);f?f.value=u:l.next={key:c,next:l.next,value:u}},s=function(l,c){return l?!!e(l,c):!1},a=function(l,c){if(l)return e(l,c,!0)};return H0=function(){var c,u={assert:function(f){if(!u.has(f))throw new t("Side channel does not contain "+n(f))},delete:function(f){var p=a(c,f);return p&&c&&!c.next&&(c=void 0),!!p},get:function(f){return r(c,f)},has:function(f){return s(c,f)},set:function(f,p){c||(c={next:void 0}),i(c,f,p)}};return u},H0}var Z0,Ew;function T8(){if(Ew)return Z0;Ew=1;var n=In(),t=Ds(),e=Xl(),r=fe(),i=n("%Map%",!0),s=t("Map.prototype.get",!0),a=t("Map.prototype.set",!0),l=t("Map.prototype.has",!0),c=t("Map.prototype.delete",!0),u=t("Map.prototype.size",!0);return Z0=!!i&&function(){var p,y={assert:function(v){if(!y.has(v))throw new r("Side channel does not contain "+e(v))},delete:function(v){if(p){var S=c(p,v);return u(p)===0&&(p=void 0),S}return!1},get:function(v){if(p)return s(p,v)},has:function(v){return p?l(p,v):!1},set:function(v,S){p||(p=new i),a(p,v,S)}};return y},Z0}var q0,kw;function CE(){if(kw)return q0;kw=1;var n=In(),t=Ds(),e=Xl(),r=T8(),i=fe(),s=n("%WeakMap%",!0),a=t("WeakMap.prototype.get",!0),l=t("WeakMap.prototype.set",!0),c=t("WeakMap.prototype.has",!0),u=t("WeakMap.prototype.delete",!0);return q0=s?function(){var p,y,v={assert:function(S){if(!v.has(S))throw new i("Side channel does not contain "+e(S))},delete:function(S){if(s&&S&&(typeof S=="object"||typeof S=="function")){if(p)return u(p,S)}else if(r&&y)return y.delete(S);return!1},get:function(S){return s&&S&&(typeof S=="object"||typeof S=="function")&&p?a(p,S):y&&y.get(S)},has:function(S){return s&&S&&(typeof S=="object"||typeof S=="function")&&p?c(p,S):!!y&&y.has(S)},set:function(S,_){s&&S&&(typeof S=="object"||typeof S=="function")?(p||(p=new s),l(p,S,_)):r&&(y||(y=r()),y.set(S,_))}};return v}:r,q0}var V0,Tw;function IE(){if(Tw)return V0;Tw=1;var n=fe(),t=Xl(),e=RE(),r=T8(),i=CE(),s=i||r||e;return V0=function(){var l,c={assert:function(u){if(!c.has(u)){var f=u&&Object(u)===u?"the given object key":t(u);throw new n("Side channel does not contain "+f)}},delete:function(u){return!!l&&l.delete(u)},get:function(u){return l&&l.get(u)},has:function(u){return!!l&&l.has(u)},set:function(u,f){l||(l=s()),l.set(u,f)}};return c},V0}var F0,Rw;function B1(){if(Rw)return F0;Rw=1;var n=Ti(),t=IE()(),e=fe(),r={assert:function(i,s){if(!i||typeof i!="object"&&typeof i!="function")throw new e("`O` is not an object");if(typeof s!="string")throw new e("`slot` must be a string");if(t.assert(i),!r.has(i,s))throw new e("`"+s+"` is not present on `O`")},get:function(i,s){if(!i||typeof i!="object"&&typeof i!="function")throw new e("`O` is not an object");if(typeof s!="string")throw new e("`slot` must be a string");var a=t.get(i);return a&&a["$"+s]},has:function(i,s){if(!i||typeof i!="object"&&typeof i!="function")throw new e("`O` is not an object");if(typeof s!="string")throw new e("`slot` must be a string");var a=t.get(i);return!!a&&n(a,"$"+s)},set:function(i,s,a){if(!i||typeof i!="object"&&typeof i!="function")throw new e("`O` is not an object");if(typeof s!="string")throw new e("`slot` must be a string");var l=t.get(i);l||(l={},t.set(i,l)),l["$"+s]=a}};return Object.freeze&&Object.freeze(r),F0=r,F0}var B0,Cw;function j1(){if(Cw)return B0;Cw=1;var n=Ei(),t=B1(),e=function r(i,s){if(!(this instanceof r))return new r(i,s);if(i!=="normal"&&i!=="break"&&i!=="continue"&&i!=="return"&&i!=="throw")throw new n('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');t.set(this,"[[Type]]",i),t.set(this,"[[Value]]",s)};return e.prototype.type=function(){return t.get(this,"[[Type]]")},e.prototype.value=function(){return t.get(this,"[[Value]]")},e.prototype["?"]=function(){var i=t.get(this,"[[Type]]"),s=t.get(this,"[[Value]]");if(i==="throw")throw s;return s},e.prototype["!"]=function(){var i=t.get(this,"[[Type]]");if(i!=="normal")throw new n('Assertion failed: Completion Record is not of type "normal"');return t.get(this,"[[Value]]")},B0=e,B0}var j0,Iw;function W1(){if(Iw)return j0;Iw=1;var n=j1();return j0=function(e){return new n("normal",e)},j0}var W0,$w;function $E(){if($w)return W0;$w=1;var n=Gl();return W0=function(){return n()&&!!Symbol.toStringTag},W0}var G0,xw;function R8(){if(xw)return G0;xw=1;var n=In(),t=n("%Object.defineProperty%",!0),e=$E()(),r=Ti(),i=fe(),s=e?Symbol.toStringTag:null;return G0=function(l,c){var u=arguments.length>2&&!!arguments[2]&&arguments[2].force,f=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof u<"u"&&typeof u!="boolean"||typeof f<"u"&&typeof f!="boolean")throw new i("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");s&&(u||!r(l,s))&&(t?t(l,s,{configurable:!f,enumerable:!1,value:c,writable:!1}):l[s]=c)},G0}var J0={exports:{}},Y0,Pw;function xE(){if(Pw)return Y0;Pw=1;var n=In(),t=d8(),e=Uf()(),r=Wl(),i=fe(),s=n("%Math.floor%");return Y0=function(l,c){if(typeof l!="function")throw new i("`fn` is not a function");if(typeof c!="number"||c<0||c>4294967295||s(c)!==c)throw new i("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],f=!0,p=!0;if("length"in l&&r){var y=r(l,"length");y&&!y.configurable&&(f=!1),y&&!y.writable&&(p=!1)}return(f||p||!u)&&(e?t(l,"length",c,!0,!0):t(l,"length",c)),l},Y0}var K0,Dw;function PE(){if(Dw)return K0;Dw=1;var n=bh(),t=U1(),e=y8();return K0=function(){return e(n,t,arguments)},K0}var Lw;function G1(){return Lw||(Lw=1,(function(n){var t=xE(),e=wh(),r=Hf(),i=PE();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})(J0)),J0.exports}var X0,Ow;function DE(){return Ow||(Ow=1,X0=function(t,e){for(var r=0;r<t.length;r+=1)if(!e(t[r],r,t))return!1;return!0}),X0}var Q0,Mw;function LE(){if(Mw)return Q0;Mw=1;var n=Object;return Q0=function(e){return e&&typeof e=="object"&&(typeof e["[[ResourceValue]]"]>"u"||n(e["[[ResourceValue]]"])===e["[[ResourceValue]]"])&&(e["[[Hint]]"]==="SYNC-DISPOSE"||e["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof e["[[DisposeMethod]]"]=="function"||typeof e["[[DisposeMethod]]"]>"u")},Q0}var em,Nw;function OE(){if(Nw)return em;Nw=1;var n=Ti(),t=H1(),e=DE(),r=LE();return em=function(s){return s&&typeof s=="object"&&n(s,"[[DisposableResourceStack]]")&&t(s["[[DisposableResourceStack]]"])&&(s["[[DisposableResourceStack]]"].length===0||e(s["[[DisposableResourceStack]]"],r))},em}var tm,zw;function ME(){if(zw)return tm;zw=1;var n=ki();return tm=function(e){if(e===null)return"Null";if(typeof e>"u")return"Undefined";if(n(e))return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"},tm}var nm,Uw;function J1(){if(Uw)return nm;Uw=1;var n=ME();return nm=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":n(e)},nm}var rm,Hw;function NE(){if(Hw)return rm;Hw=1;var n=fe(),t=Xl(),e=Yl();return rm=function(i,s){if(!e(s))throw new n("Assertion failed: P is not a Property Key, got "+t(s));return i[s]},rm}var im,Zw;function zE(){if(Zw)return im;Zw=1;var n=fe(),t=NE(),e=Kl(),r=Yl(),i=Xl();return im=function(a,l){if(!r(l))throw new n("Assertion failed: P is not a Property Key");var c=t(a,l);if(c!=null){if(!e(c))throw new n(i(l)+" is not a function: "+i(c));return c}},im}var Oh={exports:{}},sm,qw;function UE(){return qw||(qw=1,sm=In()),sm}var Vw;function HE(){if(Vw)return Oh.exports;Vw=1;var n=UE(),t=n("%Reflect.construct%",!0),e=Sh();try{e({},"",{"[[Get]]":function(){}})}catch{e=null}if(e&&t){var r={},i={};e(i,"length",{"[[Get]]":function(){throw r},"[[Enumerable]]":!0}),Oh.exports=function(a){try{t(a,i)}catch(l){return l===r}}}else Oh.exports=function(a){return typeof a=="function"&&!!a.prototype};return Oh.exports}var om,Fw;function ZE(){if(Fw)return om;Fw=1;var n=fe(),t=Kl(),e=HE();return om=function(i){if(!e(i))throw new n("C must be a constructor");var s={"[[Resolve]]":void 0,"[[Reject]]":void 0},a=new i(function(l,c){if(typeof s["[[Resolve]]"]<"u"||typeof s["[[Reject]]"]<"u")throw new n("executor has already been called");s["[[Resolve]]"]=l,s["[[Reject]]"]=c});if(!t(s["[[Resolve]]"])||!t(s["[[Reject]]"]))throw new n("executor must provide valid resolve and reject functions");return{"[[Promise]]":a,"[[Resolve]]":s["[[Resolve]]"],"[[Reject]]":s["[[Reject]]"]}},om}var am,Bw;function qE(){if(Bw)return am;Bw=1;var n=Ei(),t=fe(),e=Zf(),r=zE(),i=ZE(),s=J1(),a=V1()(),l=F1()();return am=function(u,f){if(s(u)!=="Object")throw new t("`V` must be an Object");if(f!=="SYNC-DISPOSE"&&f!=="ASYNC-DISPOSE")throw new n("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var p;if(f==="ASYNC-DISPOSE"&&l&&(p=r(u,l)),!p){if(!a)throw new n("`Symbol.dispose` is not supported");if(p=r(u,a),typeof p<"u")return function(){var y=this;if(f==="ASYNC-DISPOSE"){var v=i(Promise);try{e(p,y),e(v["[[Resolve]]"],void 0,[void 0])}catch(S){v["[[Reject]]"](S)}return v["[[Promise]]"]}e(p,y)}}return p},am}var lm,jw;function VE(){if(jw)return lm;jw=1;var n=Ei(),t=fe(),e=Kl(),r=J1(),i=qE();return lm=function(a,l){if(l!=="SYNC-DISPOSE"&&l!=="ASYNC-DISPOSE")throw new n("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var c;if(arguments.length<3)if(a==null)a=void 0,c=void 0;else{if(typeof a<"u"&&r(a)!=="Object")throw new t("`V` must be an Object, or `null` or `undefined`");if(c=i(a,l),typeof c>"u")throw new t("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(c=arguments[2],!e(c))throw new t("`method`, when provided, must be a function");return{"[[ResourceValue]]":a,"[[Hint]]":l,"[[DisposeMethod]]":c}},lm}var cm,Ww;function C8(){if(Ww)return cm;Ww=1;var n=Ei(),t=fe(),e=OE(),r=VE(),i=Ds(),s=i("Array.prototype.push");return cm=function(l,c,u){if(!e(l))throw new t("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(u!=="SYNC-DISPOSE"&&u!=="ASYNC-DISPOSE")throw new n("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var f=arguments.length>3?arguments[3]:void 0;if(arguments.length>3&&typeof f!="function")throw new t("Assertion failed: `method`, when present, must be a function");if(!l["[[DisposableResourceStack]]"])throw new t("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var p;if(arguments.length<4){if(c==null&&u==="SYNC_DISPOSE")return"UNUSED";p=r(c,u)}else{if(typeof c<"u")throw new t("Assertion failed: `V` must be undefined when `method` is present");p=r(void 0,u,f)}return s(l["[[DisposableResourceStack]]"],p),"UNUSED"},cm}var um,Gw;function Y1(){if(Gw)return um;Gw=1;var n=In(),t=G1(),e=Ei(),r=n("%Promise.resolve%",!0),i=r&&t(r);return um=function(a,l){if(!i)throw new e("This environment does not support Promises.");return i(a,l)},um}var hm,Jw;function FE(){if(Jw)return hm;Jw=1;var n=In(),t=Ei(),e=n("%Promise%",!0),r=Zf(),i=Y1(),s=J1();return hm=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 f=typeof u>"u"?u:r(u,l);if(c==="ASYNC-DISPOSE")return i(e,f)},hm}var dm,Yw;function BE(){if(Yw)return dm;Yw=1;var n=j1();return dm=function(e){return new n("throw",e)},dm}var fm,Kw;function I8(){if(Kw)return fm;Kw=1;var n=In(),t=Ei(),e=fe(),r=n("%Promise%",!0),i=Ds(),s=i("Promise.prototype.then",!0),a=j1(),l=FE(),c=W1(),u=Y1(),f=BE(),p=k8()();return fm=function(v,S){if(!(S instanceof a))throw new e("`completion` must be a Completion Record");var _=v["[[DisposableResourceStack]]"];if(!_)throw new e("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");for(var $,H=_.length-1;H>=0;H-=1)if(!$)$=_[H]["[[Hint]]"];else if($!==_[H]["[[Hint]]"])throw new t("mixed hint stacks are not supported");for(var L=$==="ASYNC-DISPOSE"&&u(r,S),z=function(Q){if(S.type()==="throw"){var F=S.value(),re=new p(Q,F);S=f(re)}else S=f(Q)},P=$==="ASYNC-DISPOSE"&&function(F){return s(L,function(){var re=l(F["[[ResourceValue]]"],F["[[Hint]]"],F["[[DisposeMethod]]"]);if(!re)throw new t("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return s(re,c)},z)},B=_.length-1;B>=0;B-=1)if($==="ASYNC-DISPOSE")L=P(_[B]);else{var q=_[B];try{var V=l(q["[[ResourceValue]]"],q["[[Hint]]"],q["[[DisposeMethod]]"]);if(V)throw new t("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(Q){z(Q)}}return v["[[DisposableResourceStack]]"]=null,$==="ASYNC-DISPOSE"?L:S},fm}var pm,Xw;function $8(){return Xw||(Xw=1,pm=function(){var t=[];return{"[[DisposableResourceStack]]":t}}),pm}var mm,Qw;function jE(){if(Qw)return mm;Qw=1;var n=O1(),t=fe(),e=Zf(),r=q1(),i=Sh(),s=Kl(),a=W1(),l=B1(),c=R8(),u=oa().supportsDescriptors,f=G1(),p=C8(),y=I8(),v=$8(),S=V1()(),_=function z(){if(!(this instanceof z)||l.has(this,"[[DisposableState]]")||l.has(this,"[[DisposeCapability]]"))throw new t("can only be used with new");l.set(this,"[[DisposableState]]","PENDING"),l.set(this,"[[DisposeCapability]]",v())},$=function(){var P=this;return l.assert(P,"[[DisposableState]]"),l.get(P,"[[DisposableState]]")==="DISPOSED"},H=f($);u?i(_.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":$}):_.prototype.disposed=!1;var L=function(P){l.set(P,"[[DisposableState]]","DISPOSED"),u||(P.disposed=!0)};return r(_.prototype,"dispose",function(){var P=this;if(!H(P))return L(P),y(l.get(P,"[[DisposeCapability]]"),a())["?"]()}),r(_.prototype,"use",function(P){var B=this;if(H(B))throw new n("a disposed stack can not use anything new");return p(l.get(B,"[[DisposeCapability]]"),P,"SYNC-DISPOSE"),P}),r(_.prototype,"adopt",function(P,B){var q=this;if(H(q))throw new n("a disposed stack can not use anything new");if(!s(B))throw new t("`onDispose` must be a function");var V=(function(){return e(B,void 0,[P])});return p(l.get(q,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",V),P}),r(_.prototype,"defer",function(P){var B=this;if(H(B))throw new n("a disposed stack can not defer anything new");if(!s(P))throw new t("`onDispose` must be a function");p(l.get(B,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",P)}),r(_.prototype,"move",function(){var P=this;if(H(P))throw new n("a disposed stack can not use anything new");var B=new _;return l.set(B,"[[DisposeCapability]]",l.get(P,"[[DisposeCapability]]")),l.set(P,"[[DisposeCapability]]",v()),L(P),B}),S&&r(_.prototype,S,_.prototype.dispose),c(_.prototype,"DisposableStack"),mm=_,mm}var gm,e2;function WE(){if(e2)return gm;e2=1;var n=jE();return gm=function(){return typeof DisposableStack=="function"?DisposableStack:n},gm}var vm,t2;function GE(){if(t2)return vm;t2=1;var n=oa(),t=D1()(),e=WE();return vm=function(){var i=e();return n(t,{DisposableStack:i},{DisposableStack:!0}),i},vm}var ym,n2;function JE(){if(n2)return ym;n2=1;var n=In(),t=O1(),e=fe(),r=n("%Promise%",!0),i=C8(),s=Zf(),a=q1(),l=Sh(),c=I8(),u=Kl(),f=$8(),p=W1(),y=Y1(),v=B1(),S=R8(),_=oa().supportsDescriptors,$=G1(),H=Ds(),L=H("Promise.prototype.then",!0),z=F1()(),P=function Q(){if(!(this instanceof Q)||v.has(this,"[[AsyncDisposableState]]")||v.has(this,"[[DisposeCapability]]"))throw new e("can only be used with new");v.set(this,"[[AsyncDisposableState]]","pending"),v.set(this,"[[DisposeCapability]]",f())},B=function(){var F=this;return v.assert(F,"[[AsyncDisposableState]]"),v.get(F,"[[AsyncDisposableState]]")==="disposed"},q=$(B);_?l(P.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":B}):P.prototype.disposed=!1;var V=function(F){v.set(F,"[[AsyncDisposableState]]","disposed"),_||(F.disposed=!0)};return a(P.prototype,"disposeAsync",function(){var F=this;return q(F)?y(r):(V(F),L(y(r,c(v.get(F,"[[DisposeCapability]]"),p())),function(re){return re["?"]()}))}),a(P.prototype,"use",function(F){var re=this;if(q(re))throw new t("a disposed stack can not use anything new");return i(v.get(re,"[[DisposeCapability]]"),F,"ASYNC-DISPOSE"),F}),a(P.prototype,"adopt",function(F,re){var Ne=this;if(q(Ne))throw new t("a disposed stack can not use anything new");if(!u(re))throw new e("`onDisposeAsync` must be a function");var xe=(function(){return s(re,void 0,[F])});return xe.value=F,i(v.get(Ne,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",xe),F}),a(P.prototype,"defer",function(F){var re=this;if(q(re))throw new t("a disposed stack can not defer anything new");if(!u(F))throw new e("`onDispose` must be a function");i(v.get(re,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",F)}),a(P.prototype,"move",function(){var F=this;if(q(F))throw new t("a disposed stack can not use anything new");var re=new P;return v.set(re,"[[DisposeCapability]]",v.get(F,"[[DisposeCapability]]")),v.set(F,"[[DisposeCapability]]",f()),V(F),re}),z&&a(P.prototype,z,P.prototype.disposeAsync),S(P.prototype,"AsyncDisposableStack"),ym=P,ym}var wm,r2;function YE(){if(r2)return wm;r2=1;var n=JE();return wm=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:n},wm}var bm,i2;function KE(){if(i2)return bm;i2=1;var n=oa(),t=D1()(),e=YE();return bm=function(){var i=e();return n(t,{AsyncDisposableStack:i},{AsyncDisposableStack:!0}),i},bm}var Sm,s2;function XE(){if(s2)return Sm;s2=1;var n=bE(),t=_E(),e=GE(),r=KE();return Sm=function(){n(),t(),e(),r()},Sm}var o2;function QE(){return o2||(o2=1,fE(),XE()()),qv}QE();const a2=new WeakMap;function ek(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function va(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function l2(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function tk(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class nk{constructor(){C(this,"entries",new Map);C(this,"constructionStack",[])}register(t,e){if(e===void 0){if(typeof t!="function")throw l2();this.validateClassRegistration(t),this.storeFactory(t,()=>this.instantiateClass(t));return}if(typeof e!="function")throw l2();if(e.constructor.name==="AsyncFunction")throw tk();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=a2.get(t);if(e){if(t.length!==e.length)throw new Error(`${va(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(`${va(t)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(t){const e=a2.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(`${va(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=>va(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(t.key);try{const r=t.factory();if(ek(r))throw new Error(`Factory for ${va(t.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${va(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 x8=new nk,rk=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function ik(n){for(const t of Object.keys(n))if(rk.has(t))throw new Error(`Event payload key "${t}" is reserved; choose a different property name`)}function sk(n,t){ik(t);for(const e of Object.keys(t))Object.defineProperty(n,e,{value:t[e],writable:!0,enumerable:!0,configurable:!0})}function $n(){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}),sk(this,c)}}return n}class Ri extends globalThis.EventTarget{}const ok="X-Television-Client-Meta",ak="telemetry-activity",lk="telemetry-signal",P8={kind:"single",full_screen:!1},D8={width:760,height:770};function ck(n){return n.layout.flatMap(t=>t.artifactIds)}function uk(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())hk(r,e,t);return{valid:t.length===0,errors:t}}function Xc(n){return n.flatMap(t=>t.artifactIds)}function Fm(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 hk(n,t,e){if(!_m(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`),!_m(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`),!_m(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 _m(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const jt=$n(),Kh=$n(),c2=$n(),dk=$n(),fk=$n(),pk=$n();function L8(n){class t extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return t}const Ql=L8("RequestError"),u2=L8("ValidationError");function Zl(n,t){return Object.assign(new Error(t),{code:n})}const mk=new TextEncoder;function O8(n){return mk.encode(n).length}const M8=768,Qc=32;function h2(n){const t=n.split("/").filter(e=>e.length>0);return gk(t),t}function gk(n){if(n.length>Qc)throw Zl("invalid-path",`A path has at most ${Qc} segments.`);for(const t of n)if(!N8(t))throw Zl("invalid-path",`A path key is at most ${M8} bytes.`)}function d2(){return Zl("invalid-path",`A value can be at most ${Qc} keys below the store's root.`)}function N8(n){return n.length>0&&!n.includes("/")&&O8(n)<=M8}function vk(n,t){const e=n.length<=t.length?n:t,r=e===n?t:n;return e.every((i,s)=>r[s]===i)}function Bm(n,t){if(n===t)return!0;if(n===void 0||t===void 0||n===null||t===null)return!1;if(Array.isArray(n)||Array.isArray(t))return!Array.isArray(n)||!Array.isArray(t)||n.length!==t.length?!1:n.every((r,i)=>Bm(r,t[i]));if(typeof n!="object"||typeof t!="object")return!1;const e=Object.keys(n);return e.length!==Object.keys(t).length?!1:e.every(r=>Object.hasOwn(t,r)&&Bm(n[r],t[r]))}class yk{constructor(t){C(this,"serverValue");this.serverValue=t,Object.freeze(this)}}class wk{constructor(){Object.freeze(this)}}function ya(n){return Zl("invalid-value",n)}function bk(n){const t=Object.getPrototypeOf(n);return t===Object.prototype||t===null}function jm(n,t,e,r){if(!(n===null||typeof n=="boolean"||typeof n=="string")){if(typeof n=="number"){if(!Number.isFinite(n))throw ya("A stored number must be finite.");return}if(typeof n!="object")throw ya(`A ${typeof n} is not a JSON value.`);if(e.has(n))throw ya("A value cannot contain itself.");if(e.add(n),Array.isArray(n)){if(n.length>0&&r>=Qc)throw d2();for(let i=0;i<n.length;i++){if(!(i in n))throw ya("An array cannot have holes.");jm(n[i],t,e,r+1)}}else{if(!bk(n))throw ya("Only plain objects, arrays, strings, finite numbers, booleans and null are JSON values.");const i=Object.keys(n);if(i.length>0&&r>=Qc)throw d2();for(const s of i){if(!N8(s))throw ya("An object key must be non-empty, contain no /, and be at most 768 bytes.");jm(n[s],t,e,r+1)}}e.delete(n)}}function Sk(n){jm(n,!1,new Set,0)}function _k(n,t,e){Object.defineProperty(n,t,{value:e,enumerable:!0,writable:!0,configurable:!0})}function Wm(n){const t=[],e=(i,s)=>{if(i instanceof yk)return t.push({at:s,serverValue:{...i.serverValue}}),null;if(Array.isArray(i))return i.map((a,l)=>e(a,[...s,String(l)]));if(i!==null&&typeof i=="object"){const a={};for(const l of Object.keys(i))_k(a,l,e(i[l],[...s,l]));return a}return i},r=e(n,[]);return t.length>0?{value:r,serverValues:t}:{value:r}}function Ak(n){return Object.keys(n).map(t=>{const e=n[t];return e instanceof wk?{key:t,delete:!0}:{key:t,value:Wm(e)}})}const z8=16777216;function Ek(n){if(O8(n)>z8)throw kk()}function kk(){return Zl("too-large",`A write is at most ${z8} bytes as sent.`)}/**
5
+ * @license
6
+ * Adapted from the Firebase JavaScript SDK, https://github.com/firebase/firebase-js-sdk:
7
+ * the push-ID generator in packages/database/src/core/util/NextPushId.ts, at
8
+ * commit 6cde0c0230b4c1da01d4a058333daa7663322fd1 (@firebase/database 1.1.5).
9
+ * Modified by Television: rewritten as one function that reads the clock
10
+ * itself, draws its random characters from crypto.getRandomValues, and stops
11
+ * the same-millisecond increment at the first character.
12
+ *
13
+ * Copyright 2017 Google LLC
14
+ *
15
+ * Licensed under the Apache License, Version 2.0 (the "License");
16
+ * you may not use this file except in compliance with the License.
17
+ * You may obtain a copy of the License at
18
+ *
19
+ * http://www.apache.org/licenses/LICENSE-2.0
20
+ *
21
+ * Unless required by applicable law or agreed to in writing, software
22
+ * distributed under the License is distributed on an "AS IS" BASIS,
23
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
+ * See the License for the specific language governing permissions and
25
+ * limitations under the License.
26
+ */const Tk=12;new Array(Tk).fill(0);const qr="/api/resources/v1",mc=(n,t="")=>`${qr}/resources/${encodeURIComponent(n)}${t===""?"":`/${t}`}`,f2=(n,t)=>`${qr}/artifacts/${encodeURIComponent(n)}/${t}`,Bt={list:`${qr}/resources`,info:n=>mc(n),describe:n=>mc(n,"describe"),bind:n=>mc(n,"bind"),unbind:n=>mc(n,"unbind"),destroy:n=>mc(n,"destroy"),share:n=>f2(n,"share"),unshare:n=>f2(n,"unshare"),jsonCreate:`${qr}/json/create`,jsonGet:`${qr}/json/value`,jsonSet:`${qr}/json/set`,jsonUpdate:`${qr}/json/update`,jsonPush:`${qr}/json/push`,jsonRemove:`${qr}/json/remove`},p2={artifactID:"artifact",resourceID:"resourceID"};function Rk(n){return"artifactID"in n?new URLSearchParams({[p2.artifactID]:n.artifactID}):new URLSearchParams({[p2.resourceID]:n.resourceID})}const Ck=200,Ik=300,gc=401,$k="/events",xk=4401;class Pk{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){return this.requestSerializedJSON(t,e,r!==void 0?JSON.stringify(r):void 0)}async requestSerializedJSON(t,e,r){var a;const i=await this.request(t,e,r,r!==void 0?{"content-type":"application/json"}:void 0),s=await Dk(i);if(!i.ok||i.status<Ck||i.status>=Ik)throw i.status===gc&&((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===gc&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await Am(i,i.statusText),i.status)}async requestText(t,e){var i;const r=await this.request(t,e);if(!r.ok)throw r.status===gc&&((i=this.onUnauthorized)==null||i.call(this)),this.createError(await Am(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===gc&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await Am(i,i.statusText),i.status)}webSocketURL(t){const e=new URL(`${this.serverURL}${t}`);return e.protocol=e.protocol==="https:"?"wss:":"ws:",this.token&&e.searchParams.set("token",this.token),e.toString()}unauthorizedError(t){var e;return(e=this.onUnauthorized)==null||e.call(this),this.createError(t,gc)}createError(t,e){const r={serverURL:this.serverURL};return e!==void 0&&(r.status=e),new Ql(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[ok]=JSON.stringify(this.telemetryMeta)),Object.keys(e).length>0?e:void 0}}async function Dk(n){try{return await n.json()}catch{const t=await n.text().catch(()=>"");return t?{message:t}:{}}}async function Am(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 Lk(n){return n.map(t=>`${t.name} (${t.id})`).join(", ")}var Fr,jd,U8;class Ok{constructor(t){m(this,jd);m(this,Fr);d(this,Fr,t)}list(){return o(this,Fr).requestJSON("GET","/channels")}async get(t={}){const e=await h(this,jd,U8).call(this,t.channelID);return o(this,Fr).requestJSON("GET",`/channels/${encodeURIComponent(e)}`)}create(t){const e={name:t.name};return t.id!==void 0&&(e.id=t.id),o(this,Fr).requestJSON("POST","/channels",e)}update(t){const{channelID:e,...r}=t;return o(this,Fr).requestJSON("PATCH",`/channels/${encodeURIComponent(e)}`,r)}remove(t){return o(this,Fr).requestJSON("DELETE",`/channels/${encodeURIComponent(t.channelID)}`)}}Fr=new WeakMap,jd=new WeakSet,U8=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 u2("channelID is required, but no channels exist."):new u2(`channelID is required when multiple channels exist. Available channels: ${Lk(e)}`)};var Br;class Mk{constructor(t){m(this,Br);d(this,Br,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,Br).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,Br).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(t){return o(this,Br).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,Br).requestJSON("PATCH",`/artifacts/${encodeURIComponent(t.artifactID)}`,e)}delete(t){return o(this,Br).requestJSON("DELETE",`/artifacts/${encodeURIComponent(t.artifactID)}`)}}Br=new WeakMap;var qa;class Nk{constructor(t){m(this,qa);d(this,qa,t)}list(){return o(this,qa).requestJSON("GET","/themes")}refresh(){return o(this,qa).requestJSON("POST","/themes/refresh")}}qa=new WeakMap;var Va;class zk{constructor(t){m(this,Va);d(this,Va,t)}get(t){return o(this,Va).requestText("GET",`/markdown/${encodeURIComponent(t.artifactID)}`)}update(t){return o(this,Va).requestRawVoid("PUT",`/markdown/${encodeURIComponent(t.artifactID)}`,t.content)}}Va=new WeakMap;var oo;class Uk{constructor(t){m(this,oo);d(this,oo,t)}status(){return o(this,oo).requestJSON("GET","/telemetry")}enable(){return o(this,oo).requestJSON("POST","/telemetry/enable")}disable(){return o(this,oo).requestJSON("POST","/telemetry/disable")}}oo=new WeakMap;var ao;class Hk{constructor(t){m(this,ao);d(this,ao,t)}get(){return o(this,ao).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,ao).requestVoid("PATCH","/display",e)}focus(t){return o(this,ao).requestJSON("POST","/display/focus",{artifactID:t.artifactID})}}ao=new WeakMap;function H8(n,t,e){let r=!1,i=()=>{};return{finished:new Promise((a,l)=>{let c=null;i=v=>{r||(r=!0,e==null||e.removeEventListener("abort",u),c==null||c.close(),v?l(v):a())};const u=()=>i();if(e!=null&&e.aborted){i();return}e==null||e.addEventListener("abort",u,{once:!0}),c=new WebSocket(n.webSocketURL($k));let f=!1,p=!1;const y=v=>{try{v()}catch(S){i(S instanceof Error?S:new Error(String(S)))}};c.addEventListener("open",()=>{f=!0}),c.addEventListener("message",v=>{if(r)return;p||(p=!0,t.onReady&&y(t.onReady));let S;try{S=JSON.parse(String(v.data))}catch{return}if(r||S.type!=="resource-event"||S.event===void 0)return;const _=S.event;y(()=>t.onEvent(_))}),c.addEventListener("close",v=>{v.code===xk?i(n.unauthorizedError("Unauthorized")):i(n.createError(f?"The event stream ended.":"Could not open the event stream."))})}),get ended(){return r},end:a=>i(a)}}function Zk(n,t){return!n.exists||!t.exists?n.exists===t.exists:Bm(n.value,t.value)}function Mh(n){return Sk(n),n}var lo,Fi,ba;class qk{constructor(t){m(this,Fi);m(this,lo);d(this,lo,t)}async create(t){const e={description:t.description};return t.usage!==void 0&&(e.usage=t.usage),t.value!==void 0&&(e.value=Mh(t.value)),(await h(this,Fi,ba).call(this,Bt.jsonCreate,e)).resource}get(t){const e=Rk(t.store);return e.set("path",t.path),o(this,lo).requestJSON("GET",`${Bt.jsonGet}?${e.toString()}`)}async set(t){await h(this,Fi,ba).call(this,Bt.jsonSet,{store:t.store,path:t.path,value:Wm(Mh(t.value))})}async update(t){for(const e of Object.keys(t.values))Mh(t.values[e]);await h(this,Fi,ba).call(this,Bt.jsonUpdate,{store:t.store,path:t.path,entries:Ak(t.values)})}async push(t){await h(this,Fi,ba).call(this,Bt.jsonPush,{store:t.store,path:t.path,key:t.key,value:Wm(Mh(t.value))})}async remove(t){await h(this,Fi,ba).call(this,Bt.jsonRemove,{store:t.store,path:t.path})}watch(t){let e;try{e=h2(t.path)}catch(c){return Promise.reject(c)}let r=null,i=!1,s=!1;const a=()=>{if(i){s=!0;return}i=!0,this.get({store:t.store,path:t.path}).then(c=>{if(i=!1,!l.ended){if(r===null||!Zk(c,r)){r=c;try{t.onValue(c)}catch(u){l.end(u instanceof Error?u:new Error(String(u)));return}}s&&(s=!1,a())}},c=>l.end(c instanceof Error?c:new Error(String(c))))},l=H8(o(this,lo),{onReady:a,onEvent:c=>{const{store:u}=t,f=p=>"artifactID"in u?p.artifactID===u.artifactID:p.resourceID===u.resourceID;if(c.event==="destroyed"&&f(c)){if("resourceID"in u)throw Zl("not-found",`Resource not found: ${u.resourceID}`);a();return}c.event!=="changed"||!f(c)||c.paths.some(p=>vk(h2(p),e))&&a()}},t.signal);return l.finished}}lo=new WeakMap,Fi=new WeakSet,ba=function(t,e){const r=JSON.stringify(e);return Ek(r),o(this,lo).requestSerializedJSON("POST",t,r)};var Qt;class Vk{constructor(t){C(this,"json");m(this,Qt);d(this,Qt,t),this.json=new qk(t)}share(t){return o(this,Qt).requestJSON("POST",Bt.share(t.artifactID),t.access===void 0?{}:{access:t.access})}async unshare(t){await o(this,Qt).requestJSON("POST",Bt.unshare(t.artifactID),{})}async list(t={}){const e=t.artifactID===void 0?"":`?${new URLSearchParams({artifact:t.artifactID}).toString()}`;return(await o(this,Qt).requestJSON("GET",`${Bt.list}${e}`)).resources}async info(t){return(await o(this,Qt).requestJSON("GET",Bt.info(t.resourceID))).resource}async describe(t){const e={};return t.description!==void 0&&(e.description=t.description),t.usage!==void 0&&(e.usage=t.usage),(await o(this,Qt).requestJSON("POST",Bt.describe(t.resourceID),e)).resource}destroy(t){return o(this,Qt).requestJSON("POST",Bt.destroy(t.resourceID),t.force===void 0?{}:{force:t.force})}bind(t){return o(this,Qt).requestJSON("POST",Bt.bind(t.resourceID),{artifactID:t.artifactID,access:t.access})}async unbind(t){await o(this,Qt).requestJSON("POST",Bt.unbind(t.resourceID),{artifactID:t.artifactID})}events(t){return H8(o(this,Qt),{onEvent:t.onEvent},t.signal).finished}}Qt=new WeakMap;var en;class Fk{constructor(t,e={}){C(this,"channels");C(this,"artifacts");C(this,"display");C(this,"themes");C(this,"markdown");C(this,"telemetry");C(this,"resources");m(this,en);d(this,en,new Pk(t,e)),this.channels=new Ok(o(this,en)),this.artifacts=new Mk(o(this,en)),this.display=new Hk(o(this,en)),this.themes=new Nk(o(this,en)),this.markdown=new zk(o(this,en)),this.telemetry=new Uk(o(this,en)),this.resources=new Vk(o(this,en))}health(){return o(this,en).requestJSON("GET","/health")}demoMode(){return o(this,en).requestJSON("GET","/demo-mode")}}en=new WeakMap;const Cd="0.0.0",Bk=/^\d+\.\d+\.\d+$/,jk=3;function qf(n){return Bk.test(n)}function K1(n,t){const e=n.split(".").map(Number),r=t.split(".").map(Number);for(let i=0;i<jk;i++)if(e[i]!==r[i])return e[i]>r[i];return!1}function Wk(n,t){return n===Cd||t===Cd?!1:n!==t}const Gk=400,Jk=404,Z8=500,Yk=600,Kk={focusedChannelId:null,pinnedChannelIds:[],activeThemeName:null,activeThemeColorScheme:null,appearanceMode:"system",themeJavaScriptConsentIds:[],acpEnabled:!1};var he,ou,au,jr,Ye,_e,co,Bi,uo,Wr,tn,Fa,lu,Z,sr,Gm,Sa,q8,Jm,V8,Xh,Ym,F8,_a,B8,Hr,Km,j8,tt;class Xk extends Ri{constructor(e){super();m(this,Z);m(this,he);m(this,ou);m(this,au);m(this,jr,new Set);C(this,"pendingPageWrites",new Map);m(this,Ye,new Map);m(this,_e,tT());m(this,co);m(this,Bi,!1);m(this,uo,!1);m(this,Wr,0);m(this,tn,!1);m(this,Fa,()=>{if(o(this,tn))return;const e=o(this,he).connection.status==="connected";e&&!o(this,uo)?(d(this,uo,!0),h(this,Z,B8).call(this)):!e&&o(this,uo)&&(d(this,uo,!1),d(this,Wr,o(this,Wr)+1)),h(this,Z,Hr).call(this)});m(this,lu,e=>{if(o(this,tn)||e.serverURL!==o(this,he).connection.url)return;for(const i of o(this,jr))i.push(e.event);const r=e.event;if(r.type==="artifact-content-changed"){this.dispatchEvent(new c2("artifact-content-changed",{artifactID:r.artifactID}));return}if(r.type==="artifact-focus"){o(this,Bi)&&Id(o(this,_e),o(this,Ye),r.channelID,r.artifactID)&&h(this,Z,Hr).call(this),this.dispatchEvent(new dk("artifact-focus",{channelID:r.channelID,artifactID:r.artifactID}));return}r.type==="theme-changed"&&this.dispatchEvent(new fk("theme-changed",{themeName:r.themeName,activeThemeColorScheme:r.activeThemeColorScheme,themeJavaScriptConsentIds:[...r.themeJavaScriptConsentIds]})),r.type==="appearance-changed"&&this.dispatchEvent(new pk("appearance-changed",{appearanceMode:r.appearanceMode})),o(this,Bi)&&(Nh(o(this,_e),r,this.pendingPageWrites,o(this,Ye)),Em(o(this,_e),o(this,Ye)),h(this,Z,Hr).call(this))});d(this,he,e.connectionOwner),d(this,ou,e.navigationKeyHandler),d(this,au,e.retainedGateHalted??(()=>!1)),d(this,co,h(this,Z,Km).call(this)),o(this,he).addEventListener("change",o(this,Fa)),o(this,he).addEventListener("server-event",o(this,lu)),o(this,Fa).call(this)}get snapshot(){return o(this,co)}handleNavigationKey(e){var r;h(this,Z,tt).call(this),(r=o(this,ou))==null||r.call(this,e)}async createChannel(e){h(this,Z,tt).call(this);const{channel:r}=await h(this,Z,sr).call(this,o(this,he).connection.client.channels.create({name:e}),()=>h(this,Z,q8).call(this));return r}focusChannel(e){return h(this,Z,tt).call(this),h(this,Z,sr).call(this,o(this,he).connection.client.display.patch({focusedChannelId:e}),()=>h(this,Z,Sa).call(this))}setPinnedChannelIds(e){return h(this,Z,tt).call(this),h(this,Z,sr).call(this,o(this,he).connection.client.display.patch({pinnedChannelIds:[...e]}),()=>h(this,Z,Sa).call(this))}listThemes(){return h(this,Z,tt).call(this),o(this,he).connection.client.themes.list()}refreshThemes(){return h(this,Z,tt).call(this),o(this,he).connection.client.themes.refresh()}setActiveTheme(e){return h(this,Z,tt).call(this),h(this,Z,sr).call(this,o(this,he).connection.client.display.patch({activeThemeName:e}),()=>h(this,Z,Sa).call(this))}setAppearanceMode(e){return h(this,Z,tt).call(this),h(this,Z,sr).call(this,o(this,he).connection.client.display.patch({appearanceMode:e}),()=>h(this,Z,Sa).call(this))}setThemeJavaScriptConsent(e,r){h(this,Z,tt).call(this);const i=o(this,_e).display.themeJavaScriptConsentIds,s=r?i.includes(e)?[...i]:[...i,e]:i.filter(a=>a!==e);return h(this,Z,sr).call(this,o(this,he).connection.client.display.patch({themeJavaScriptConsentIds:s}),()=>h(this,Z,Sa).call(this))}selectPage(e,r){h(this,Z,tt).call(this),Id(o(this,_e),o(this,Ye),e,r)&&h(this,Z,Hr).call(this)}async renameChannel(e,r){h(this,Z,tt).call(this),await h(this,Z,sr).call(this,o(this,he).connection.client.channels.update({channelID:e,name:r}),()=>h(this,Z,Jm).call(this,e))}async deleteChannel(e){h(this,Z,tt).call(this),await h(this,Z,sr).call(this,o(this,he).connection.client.channels.remove({channelID:e}),()=>h(this,Z,V8).call(this,e))}updateChannelPages(e,r){h(this,Z,tt).call(this);const i=uk(r),s=o(this,_e).channels.get(e);if(!i.valid||!s)return Promise.resolve();const a=no(r),l=no(s.channel.layout),c={previousPages:l};return na(o(this,Ye),e,l,a),s.channel={...s.channel,layout:a},this.pendingPageWrites.set(e,c),h(this,Z,Hr).call(this),o(this,he).connection.client.channels.update({channelID:e,layout:no(a)}).then(()=>{this.pendingPageWrites.get(e)===c&&this.pendingPageWrites.delete(e)},async u=>{if(o(this,tn))throw u;const f=this.pendingPageWrites.get(e)===c;if(f&&this.pendingPageWrites.delete(e),g2(u))throw await h(this,Z,Gm).call(this,()=>h(this,Z,Jm).call(this,e)),u;if(!f||!oT(u))throw u;const p=o(this,_e).channels.get(e);if(!p)throw u;const y=no(c.previousPages);throw na(o(this,Ye),e,p.channel.layout,y),p.channel={...p.channel,layout:y},h(this,Z,Hr).call(this),u})}async deleteArtifact(e){h(this,Z,tt).call(this);const r=v2(o(this,_e),e);await h(this,Z,sr).call(this,o(this,he).connection.client.artifacts.delete({artifactID:e}),()=>h(this,Z,F8).call(this,e,r))}readMarkdown(e){return h(this,Z,tt).call(this),o(this,he).connection.client.markdown.get({artifactID:e})}writeMarkdown(e,r){return h(this,Z,tt).call(this),o(this,he).connection.client.markdown.update({artifactID:e,content:r})}get browserDemoMode(){return o(this,he).connection.browserDemoMode}getArtifactViewURL(e){return h(this,Z,tt).call(this),o(this,he).connection.getViewURL(e)}getArtifactContentURL(e){return h(this,Z,tt).call(this),o(this,he).connection.getContentURL(e)}dispose(){o(this,tn)||(d(this,tn,!0),d(this,Wr,o(this,Wr)+1),o(this,jr).clear(),this.pendingPageWrites.clear(),o(this,Ye).clear(),o(this,he).removeEventListener("change",o(this,Fa)),o(this,he).removeEventListener("server-event",o(this,lu)))}}he=new WeakMap,ou=new WeakMap,au=new WeakMap,jr=new WeakMap,Ye=new WeakMap,_e=new WeakMap,co=new WeakMap,Bi=new WeakMap,uo=new WeakMap,Wr=new WeakMap,tn=new WeakMap,Fa=new WeakMap,lu=new WeakMap,Z=new WeakSet,sr=async function(e,r){try{return await e}catch(i){throw!o(this,tn)&&g2(i)&&await h(this,Z,Gm).call(this,r),i}},Gm=async function(e){try{await e()}catch{}},Sa=function(){const e=o(this,he).connection.client;return h(this,Z,_a).call(this,()=>e.display.get(),r=>h(this,Z,Xh).call(this,r))},q8=function(){const e=o(this,he).connection.client;return h(this,Z,_a).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,_e).channels.keys())s.has(a)||(this.pendingPageWrites.delete(a),o(this,Ye).delete(a),o(this,_e).channels.delete(a));for(const a of r)o(this,_e).channels.has(a.id)||o(this,_e).channels.set(a.id,{channel:Ua(a),artifacts:new Map});h(this,Z,Xh).call(this,i)})},Jm=function(e){const r=o(this,he).connection.client;return h(this,Z,_a).call(this,()=>km(()=>r.channels.get({channelID:e})),i=>h(this,Z,Ym).call(this,e,i))},V8=function(e){const r=o(this,he).connection.client;return h(this,Z,_a).call(this,async()=>{const[i,s]=await Promise.all([km(()=>r.channels.get({channelID:e})),r.display.get()]);return{detail:i,display:s}},({detail:i,display:s})=>{h(this,Z,Ym).call(this,e,i),h(this,Z,Xh).call(this,s)})},Xh=function(e){o(this,_e).display=Qm(e),o(this,he).connection.acpClient.setEnabled(e.acpEnabled)},Ym=function(e,r){this.pendingPageWrites.delete(e);const i=o(this,_e).channels.get(e);if(r===null){o(this,Ye).delete(e),o(this,_e).channels.delete(e);return}na(o(this,Ye),e,(i==null?void 0:i.channel.layout)??[],r.channel.layout),o(this,_e).channels.set(e,{channel:Ua(r.channel),artifacts:new Map(r.artifacts.map(s=>[s.id,structuredClone(s)]))})},F8=function(e,r){const i=o(this,he).connection.client;return h(this,Z,_a).call(this,()=>km(()=>i.artifacts.get({artifactID:e})),s=>{const a=v2(o(this,_e),e)??r;if(s===null){a!==null&&Nh(o(this,_e),{type:"artifact-removed",channelID:a,artifactID:e},this.pendingPageWrites,o(this,Ye));return}const l=a===null?void 0:o(this,_e).channels.get(a);l==null||l.artifacts.set(e,structuredClone(s.artifact))})},_a=async function(e,r){const i=o(this,Wr),s=[];o(this,jr).add(s);try{const a=await e();if(o(this,tn)||i!==o(this,Wr))return;r(a);for(const l of s)Nh(o(this,_e),l,this.pendingPageWrites,o(this,Ye));Em(o(this,_e),o(this,Ye)),h(this,Z,Hr).call(this)}finally{o(this,jr).delete(s)}},B8=async function(){const e=++Lh(this,Wr)._,r=o(this,he).connection,i=r.client,s=[];o(this,jr).add(s);try{const[{channels:a},l]=await Promise.all([i.channels.list(),i.display.get()]),c=await Promise.all(a.map(({id:p})=>i.channels.get({channelID:p})));if(o(this,tn)||e!==o(this,Wr))return;const u={channels:new Map,display:Qm(l)};for(const p of c)u.channels.set(p.channel.id,{channel:Ua(p.channel),artifacts:new Map(p.artifacts.map(y=>[y.id,structuredClone(y)]))});nT(o(this,Ye),o(this,_e),u);for(const p of s)Nh(u,p,this.pendingPageWrites,o(this,Ye));Em(u,o(this,Ye));const f=o(this,Bi)?Qk(o(this,_e),u):[];this.pendingPageWrites.clear(),d(this,_e,u),d(this,Bi,!0),r.acpClient.setEnabled(l.acpEnabled),h(this,Z,Hr).call(this);for(const p of f)this.dispatchEvent(new c2("artifact-content-changed",{artifactID:p}))}catch{}finally{o(this,jr).delete(s)}},Hr=function(){o(this,tn)||(d(this,co,h(this,Z,Km).call(this)),h(this,Z,j8).call(this),this.dispatchEvent(new jt("change")))},Km=function(){var s;const e=[...o(this,_e).channels.values()].map(a=>iT(a,o(this,Ye).get(a.channel.id))),r=e.find(({id:a})=>a===o(this,_e).display.focusedChannelId)??null,i=o(this,he).connection;return Object.freeze({ready:o(this,Bi),channels:Object.freeze(e),display:sT(o(this,_e).display),focusedChannel:r,connection:Object.freeze({authorizationRequired:i.hasAuthRejected,gateHalted:i.bootState==="halted"||o(this,au).call(this),status:i.status,hasEverConnected:i.hasEverConnected,failedReconnectAttempts:i.failedReconnectAttempts,firstConnectError:i.hasEverConnected?null:o(this,he).connectError,nextRetryAt:i.nextRetryAt,upgradeInstructions:eT(((s=i.updateState)==null?void 0:s.desktop)??null)})})},j8=function(){const e=o(this,co).focusedChannel;o(this,he).connection.acpClient.setChannelContext(e?{channelID:e.id,channelName:e.name}:null)},tt=function(){if(o(this,tn))throw new Error("ApplicationService is disposed")};function Qk(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(Xc(r.channel.layout));return Xc(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 eT(n){return n===null?null:Object.freeze({...n})}function tT(){return{channels:new Map,display:Qm(Kk)}}function Nh(n,t,e,r){switch(t.type){case"channel-created":r.delete(t.channel.id),n.channels.set(t.channel.id,{channel:Ua(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:Ua(t.channel),artifacts:new Map});return}na(r,t.channel.id,i.channel.layout,t.channel.layout);const s=new Set(Xc(t.channel.layout));i.channel=Ua(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=m2(s.previousPages,t.artifact.id)),!Xc(i.channel.layout).includes(t.artifact.id)){const a=i.channel.layout,l=m2(a,t.artifact.id);na(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=Fm(s.previousPages,t.artifactID)),i.artifacts.delete(t.artifactID);const a=i.channel.layout,l=Fm(a,t.artifactID);na(r,t.channelID,a,l),i.channel={...i.channel,layout:l};return}case"artifact-focus":Id(n,r,t.channelID,t.artifactID);return;case"artifact-content-changed":return;default:return aT(t)}}function nT(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)na(n,i,((r=t.channels.get(i))==null?void 0:r.channel.layout)??[],s.channel.layout)}function na(n,t,e,r){const i=n.get(t);if(i===void 0)return;if(r.length===0){n.delete(t);return}const s=Xm(r,i);if(s!==-1){n.set(t,[...r[s].artifactIds]);return}const a=Xm(e,i),l=a===-1?0:Math.min(a,r.length-1);n.set(t,[...r[l].artifactIds])}function Id(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&&rT(a,s.artifactIds)?!1:(t.set(e,[...s.artifactIds]),!0)}function Em(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&&Id(n,t,e,r)}function Xm(n,t){const e=new Set(t);return n.findIndex(r=>r.artifactIds.some(i=>e.has(i)))}function rT(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}function iT(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:Xm(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 sT(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 m2(n,t){return Xc(n).includes(t)?no(n):[...no(n),{artifactIds:[t],geometry:{...P8},size:{...D8}}]}function oT(n){return n instanceof Ql&&n.status!==void 0&&n.status>=Gk&&n.status<Z8}function g2(n){return n instanceof Ql&&(n.status===void 0||n.status>=Z8&&n.status<Yk)}async function km(n){try{return await n()}catch(t){if(t instanceof Ql&&t.status===Jk)return null;throw t}}function v2(n,t){for(const[e,r]of n.channels)if(r.artifacts.has(t))return e;return null}function no(n){return n.map(t=>({artifactIds:[...t.artifactIds],geometry:{...t.geometry},size:{...t.size}}))}function Ua(n){return{id:n.id,name:n.name,layout:no(n.layout),...n.onboarding?{onboarding:{...n.onboarding}}:{}}}function Qm(n){return{focusedChannelId:n.focusedChannelId,pinnedChannelIds:[...n.pinnedChannelIds],activeThemeName:n.activeThemeName,activeThemeColorScheme:n.activeThemeColorScheme,appearanceMode:n.appearanceMode,themeJavaScriptConsentIds:[...n.themeJavaScriptConsentIds],acpEnabled:n.acpEnabled}}function aT(n){throw new Error(`Unexpected server event: ${JSON.stringify(n)}`)}function lT(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),f=u+(t==="ArrowLeft"?-1:1),p=(c=r.pages[f])==null?void 0:c.artifactIds[0];return u===-1||p===void 0?!1:(y2(),n.selectPage(r.id,p),!0)}const i=cT(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:(y2(),n.focusChannel(l).catch(()=>{}),!0)}function cT(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 y2(){const n=document.activeElement;n instanceof HTMLElement&&n.blur()}const W8="0123456789ABCDEFGHJKMNPQRSTVWXYZ",$d=32,uT=16,G8=10,w2=0xffffffffffff;var ro;(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"})(ro||(ro={}));class Cc extends Error{constructor(t,e){super(`${e} (${t})`),this.name="ULIDError",this.code=t}}function hT(n){const t=Math.floor(n()*$d)%$d;return W8.charAt(t)}function dT(n){const t=fT(),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 Cc(ro.PRNGDetectFailure,"Failed to find a reliable PRNG")}function fT(){return gT()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function pT(n,t){let e="";for(;n>0;n--)e=hT(t)+e;return e}function mT(n,t=G8){if(isNaN(n))throw new Cc(ro.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>w2)throw new Cc(ro.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${w2}: ${n}`);if(n<0)throw new Cc(ro.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Cc(ro.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let e,r="";for(let i=t;i>0;i--)e=n%$d,r=W8.charAt(e)+r,n=(n-e)/$d;return r}function gT(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function X1(n,t){const e=dT(),r=Date.now();return mT(r,G8)+pT(uT,e)}const Ic=$n(),J8=$n(),Y8=$n(),vT=$n(),Tm=$n(),yT="store-";function Cs(n){return new URL(n).origin}function wT(){return{authTokens:{}}}var ho,fo,po;class bT extends Ri{constructor(e,r,i={}){super();m(this,ho);m(this,fo);m(this,po);d(this,ho,`${yT}${e}`),d(this,fo,i.storage??AT());const s=o(this,fo).getItem(o(this,ho));s===null?(d(this,po,r),o(this,fo).setItem(o(this,ho),JSON.stringify(r))):d(this,po,ET(JSON.parse(s),r))}get(){return o(this,po)}set(e){d(this,po,e),o(this,fo).setItem(o(this,ho),JSON.stringify(e)),this.dispatchEvent(new jt("change"))}}ho=new WeakMap,fo=new WeakMap,po=new WeakMap;function b2(n,t){return n.authTokens[Cs(t)]??null}function ST(n,t,e){return{authTokens:{...n.authTokens,[Cs(t)]:e}}}function _T(n,t){const e=Cs(t);if(!(e in n.authTokens))return n;const r={...n.authTokens};return delete r[e],{authTokens:r}}function AT(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function ET(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[Cs(i)]=s}catch{}return{authTokens:r}}function I(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,f=Object.keys(u);for(let p=0;p<f.length;p++){const y=f[p];y in l||(l[y]=u[y].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 f of u._zod.deferred)f();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 Ha extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class K8 extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const X8={};function Is(n){return X8}function Q8(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 eg(n,t){return typeof t=="bigint"?t.toString():t}function Vf(n){return{get value(){{const t=n();return Object.defineProperty(this,"value",{value:t}),t}}}}function Q1(n){return n==null}function ev(n){const t=n.startsWith("^")?1:0,e=n.endsWith("$")?n.length-1:n.length;return n.slice(t,e)}function kT(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 S2=Symbol("evaluating");function Ae(n,t,e){let r;Object.defineProperty(n,t,{get(){if(r!==S2)return r===void 0&&(r=S2,r=e()),r},set(i){Object.defineProperty(n,t,{value:i})},configurable:!0})}function aa(n,t,e){Object.defineProperty(n,t,{value:e,writable:!0,enumerable:!0,configurable:!0})}function Ls(...n){const t={};for(const e of n){const r=Object.getOwnPropertyDescriptors(e);Object.assign(t,r)}return Object.defineProperties({},t)}function _2(n){return JSON.stringify(n)}function TT(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const e6="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function eu(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const RT=Vf(()=>{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 ql(n){if(eu(n)===!1)return!1;const t=n.constructor;if(t===void 0||typeof t!="function")return!0;const e=t.prototype;return!(eu(e)===!1||Object.prototype.hasOwnProperty.call(e,"isPrototypeOf")===!1)}function t6(n){return ql(n)?{...n}:Array.isArray(n)?[...n]:n}const CT=new Set(["string","number","symbol"]);function Vl(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Os(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 Y(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 IT(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}const $T={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 xT(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=Ls(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 aa(this,"shape",a),a},checks:[]});return Os(n,s)}function PT(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=Ls(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 aa(this,"shape",a),a},checks:[]});return Os(n,s)}function DT(n,t){if(!ql(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=Ls(n._zod.def,{get shape(){const s={...n._zod.def.shape,...t};return aa(this,"shape",s),s}});return Os(n,i)}function LT(n,t){if(!ql(t))throw new Error("Invalid input to safeExtend: expected a plain object");const e=Ls(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t};return aa(this,"shape",r),r}});return Os(n,e)}function OT(n,t){const e=Ls(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t._zod.def.shape};return aa(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Os(n,e)}function MT(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=Ls(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 aa(this,"shape",c),c},checks:[]});return Os(t,a)}function NT(n,t,e){const r=Ls(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 aa(this,"shape",s),s}});return Os(t,r)}function Ma(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 Na(n,t){return t.map(e=>{var r;return(r=e).path??(r.path=[]),e.path.unshift(n),e})}function zh(n){return typeof n=="string"?n:n==null?void 0:n.message}function $s(n,t,e){var i,s,a,l,c,u;const r={...n,path:n.path??[]};if(!n.message){const f=zh((a=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:a.call(s,n))??zh((l=t==null?void 0:t.error)==null?void 0:l.call(t,n))??zh((c=e.customError)==null?void 0:c.call(e,n))??zh((u=e.localeError)==null?void 0:u.call(e,n))??"Invalid input";r.message=f}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function tv(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function tu(...n){const[t,e,r]=n;return typeof t=="string"?{message:t,code:"custom",input:e,inst:r}:{...t}}const n6=(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,eg,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},r6=I("$ZodError",n6),i6=I("$ZodError",n6,{Parent:Error});function zT(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 UT(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 nv=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 Ha;if(a.issues.length){const l=new((i==null?void 0:i.Err)??n)(a.issues.map(c=>$s(c,s,Is())));throw e6(l,i==null?void 0:i.callee),l}return a.value},rv=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=>$s(c,s,Is())));throw e6(l,i==null?void 0:i.callee),l}return a.value},Ff=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 Ha;return s.issues.length?{success:!1,error:new(n??r6)(s.issues.map(a=>$s(a,i,Is())))}:{success:!0,data:s.value}},HT=Ff(i6),Bf=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=>$s(a,i,Is())))}:{success:!0,data:s.value}},ZT=Bf(i6),qT=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return nv(n)(t,e,i)},VT=n=>(t,e,r)=>nv(n)(t,e,r),FT=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return rv(n)(t,e,i)},BT=n=>async(t,e,r)=>rv(n)(t,e,r),jT=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ff(n)(t,e,i)},WT=n=>(t,e,r)=>Ff(n)(t,e,r),GT=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Bf(n)(t,e,i)},JT=n=>async(t,e,r)=>Bf(n)(t,e,r),YT=/^[cC][^\s-]{8,}$/,KT=/^[0-9a-z]+$/,XT=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,QT=/^[0-9a-vA-V]{20}$/,eR=/^[A-Za-z0-9]{27}$/,tR=/^[a-zA-Z0-9_-]{21}$/,nR=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,rR=/^([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})$/,A2=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)$/,iR=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,sR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function oR(){return new RegExp(sR,"u")}const aR=/^(?:(?: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])$/,lR=/^(([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}|:))$/,cR=/^((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])$/,uR=/^(([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])$/,hR=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,s6=/^[A-Za-z0-9_-]*$/,dR=/^\+[1-9]\d{6,14}$/,o6="(?:(?:\\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])))",fR=new RegExp(`^${o6}$`);function a6(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 pR(n){return new RegExp(`^${a6(n)}$`)}function mR(n){const t=a6({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(`^${o6}T(?:${r})$`)}const gR=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}$`)},vR=/^-?\d+$/,l6=/^-?\d+(?:\.\d+)?$/,yR=/^(?:true|false)$/i,wR=/^[^A-Z]*$/,bR=/^[^a-z]*$/,Gt=I("$ZodCheck",(n,t)=>{var e;n._zod??(n._zod={}),n._zod.def=t,(e=n._zod).onattach??(e.onattach=[])}),c6={number:"number",bigint:"bigint",object:"date"},u6=I("$ZodCheckLessThan",(n,t)=>{Gt.init(n,t);const e=c6[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})}}),h6=I("$ZodCheckGreaterThan",(n,t)=>{Gt.init(n,t);const e=c6[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})}}),SR=I("$ZodCheckMultipleOf",(n,t)=>{Gt.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):kT(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})}}),_R=I("$ZodCheckNumberFormat",(n,t)=>{var a;Gt.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]=$T[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=vR)}),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})}}),AR=I("$ZodCheckMaxLength",(n,t)=>{var e;Gt.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!Q1(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=tv(i);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),ER=I("$ZodCheckMinLength",(n,t)=>{var e;Gt.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!Q1(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=tv(i);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),kR=I("$ZodCheckLengthEquals",(n,t)=>{var e;Gt.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!Q1(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=tv(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})}}),jf=I("$ZodCheckStringFormat",(n,t)=>{var e,r;Gt.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=()=>{})}),TR=I("$ZodCheckRegex",(n,t)=>{jf.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})}}),RR=I("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=wR),jf.init(n,t)}),CR=I("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=bR),jf.init(n,t)}),IR=I("$ZodCheckIncludes",(n,t)=>{Gt.init(n,t);const e=Vl(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})}}),$R=I("$ZodCheckStartsWith",(n,t)=>{Gt.init(n,t);const e=new RegExp(`^${Vl(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})}}),xR=I("$ZodCheckEndsWith",(n,t)=>{Gt.init(n,t);const e=new RegExp(`.*${Vl(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})}}),PR=I("$ZodCheckOverwrite",(n,t)=>{Gt.init(n,t),n._zod.check=e=>{e.value=t.tx(e.value)}});class DR{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(`
27
+ `).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(`
28
+ `))}}const LR={major:4,minor:3,patch:6},Ze=I("$ZodType",(n,t)=>{var i;var e;n??(n={}),n._zod.def=t,n._zod.bag=n._zod.bag||{},n._zod.version=LR;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 f=Ma(l),p;for(const y of c){if(y._zod.def.when){if(!y._zod.def.when(l))continue}else if(f)continue;const v=l.issues.length,S=y._zod.check(l);if(S instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Ha;if(p||S instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await S,l.issues.length!==v&&(f||(f=Ma(l,v)))});else{if(l.issues.length===v)continue;f||(f=Ma(l,v))}}return p?p.then(()=>l):l},a=(l,c,u)=>{if(Ma(l))return l.aborted=!0,l;const f=s(c,r,u);if(f instanceof Promise){if(u.async===!1)throw new Ha;return f.then(p=>n._zod.parse(p,u))}return n._zod.parse(f,u)};n._zod.run=(l,c)=>{if(c.skipChecks)return n._zod.parse(l,c);if(c.direction==="backward"){const f=n._zod.parse({value:l.value,issues:[]},{...c,skipChecks:!0});return f instanceof Promise?f.then(p=>a(p,l,c)):a(f,l,c)}const u=n._zod.parse(l,c);if(u instanceof Promise){if(c.async===!1)throw new Ha;return u.then(f=>s(f,r,c))}return s(u,r,c)}}Ae(n,"~standard",()=>({validate:s=>{var a;try{const l=HT(n,s);return l.success?{value:l.data}:{issues:(a=l.error)==null?void 0:a.issues}}catch{return ZT(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}))}),iv=I("$ZodString",(n,t)=>{var e;Ze.init(n,t),n._zod.pattern=[...((e=n==null?void 0:n._zod.bag)==null?void 0:e.patterns)??[]].pop()??gR(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}}),Me=I("$ZodStringFormat",(n,t)=>{jf.init(n,t),iv.init(n,t)}),OR=I("$ZodGUID",(n,t)=>{t.pattern??(t.pattern=rR),Me.init(n,t)}),MR=I("$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=A2(r))}else t.pattern??(t.pattern=A2());Me.init(n,t)}),NR=I("$ZodEmail",(n,t)=>{t.pattern??(t.pattern=iR),Me.init(n,t)}),zR=I("$ZodURL",(n,t)=>{Me.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})}}}),UR=I("$ZodEmoji",(n,t)=>{t.pattern??(t.pattern=oR()),Me.init(n,t)}),HR=I("$ZodNanoID",(n,t)=>{t.pattern??(t.pattern=tR),Me.init(n,t)}),ZR=I("$ZodCUID",(n,t)=>{t.pattern??(t.pattern=YT),Me.init(n,t)}),qR=I("$ZodCUID2",(n,t)=>{t.pattern??(t.pattern=KT),Me.init(n,t)}),VR=I("$ZodULID",(n,t)=>{t.pattern??(t.pattern=XT),Me.init(n,t)}),FR=I("$ZodXID",(n,t)=>{t.pattern??(t.pattern=QT),Me.init(n,t)}),BR=I("$ZodKSUID",(n,t)=>{t.pattern??(t.pattern=eR),Me.init(n,t)}),jR=I("$ZodISODateTime",(n,t)=>{t.pattern??(t.pattern=mR(t)),Me.init(n,t)}),WR=I("$ZodISODate",(n,t)=>{t.pattern??(t.pattern=fR),Me.init(n,t)}),GR=I("$ZodISOTime",(n,t)=>{t.pattern??(t.pattern=pR(t)),Me.init(n,t)}),JR=I("$ZodISODuration",(n,t)=>{t.pattern??(t.pattern=nR),Me.init(n,t)}),YR=I("$ZodIPv4",(n,t)=>{t.pattern??(t.pattern=aR),Me.init(n,t),n._zod.bag.format="ipv4"}),KR=I("$ZodIPv6",(n,t)=>{t.pattern??(t.pattern=lR),Me.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})}}}),XR=I("$ZodCIDRv4",(n,t)=>{t.pattern??(t.pattern=cR),Me.init(n,t)}),QR=I("$ZodCIDRv6",(n,t)=>{t.pattern??(t.pattern=uR),Me.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 d6(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const eC=I("$ZodBase64",(n,t)=>{t.pattern??(t.pattern=hR),Me.init(n,t),n._zod.bag.contentEncoding="base64",n._zod.check=e=>{d6(e.value)||e.issues.push({code:"invalid_format",format:"base64",input:e.value,inst:n,continue:!t.abort})}});function tC(n){if(!s6.test(n))return!1;const t=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),e=t.padEnd(Math.ceil(t.length/4)*4,"=");return d6(e)}const nC=I("$ZodBase64URL",(n,t)=>{t.pattern??(t.pattern=s6),Me.init(n,t),n._zod.bag.contentEncoding="base64url",n._zod.check=e=>{tC(e.value)||e.issues.push({code:"invalid_format",format:"base64url",input:e.value,inst:n,continue:!t.abort})}}),rC=I("$ZodE164",(n,t)=>{t.pattern??(t.pattern=dR),Me.init(n,t)});function iC(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 sC=I("$ZodJWT",(n,t)=>{Me.init(n,t),n._zod.check=e=>{iC(e.value,t.alg)||e.issues.push({code:"invalid_format",format:"jwt",input:e.value,inst:n,continue:!t.abort})}}),f6=I("$ZodNumber",(n,t)=>{Ze.init(n,t),n._zod.pattern=n._zod.bag.pattern??l6,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}}),oC=I("$ZodNumberFormat",(n,t)=>{_R.init(n,t),f6.init(n,t)}),aC=I("$ZodBoolean",(n,t)=>{Ze.init(n,t),n._zod.pattern=yR,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}}),lC=I("$ZodUnknown",(n,t)=>{Ze.init(n,t),n._zod.parse=e=>e}),cC=I("$ZodNever",(n,t)=>{Ze.init(n,t),n._zod.parse=(e,r)=>(e.issues.push({expected:"never",code:"invalid_type",input:e.value,inst:n}),e)});function E2(n,t,e){n.issues.length&&t.issues.push(...Na(e,n.issues)),t.value[e]=n.value}const uC=I("$ZodArray",(n,t)=>{Ze.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=>E2(u,e,a))):E2(c,e,a)}return s.length?Promise.all(s).then(()=>e):e}});function xd(n,t,e,r,i){if(n.issues.length){if(i&&!(e in r))return;t.issues.push(...Na(e,n.issues))}n.value===void 0?e in r&&(t.value[e]=void 0):t.value[e]=n.value}function p6(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=IT(n.shape);return{...n,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(e)}}function m6(n,t,e,r,i,s){const a=[],l=i.keySet,c=i.catchall._zod,u=c.def.type,f=c.optout==="optional";for(const p in t){if(l.has(p))continue;if(u==="never"){a.push(p);continue}const y=c.run({value:t[p],issues:[]},r);y instanceof Promise?n.push(y.then(v=>xd(v,e,p,t,f))):xd(y,e,p,t,f)}return a.length&&e.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s}),n.length?Promise.all(n).then(()=>e):e}const hC=I("$ZodObject",(n,t)=>{Ze.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=Vf(()=>p6(t));Ae(n._zod,"propValues",()=>{const l=t.shape,c={};for(const u in l){const f=l[u]._zod;if(f.values){c[u]??(c[u]=new Set);for(const p of f.values)c[u].add(p)}}return c});const i=eu,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 f=[],p=a.shape;for(const y of a.keys){const v=p[y],S=v._zod.optout==="optional",_=v._zod.run({value:u[y],issues:[]},c);_ instanceof Promise?f.push(_.then($=>xd($,l,y,u,S))):xd(_,l,y,u,S)}return s?m6(f,u,l,c,r.value,n):f.length?Promise.all(f).then(()=>l):l}}),dC=I("$ZodObjectJIT",(n,t)=>{hC.init(n,t);const e=n._zod.parse,r=Vf(()=>p6(t)),i=y=>{var z;const v=new DR(["shape","payload","ctx"]),S=r.value,_=P=>{const B=_2(P);return`shape[${B}]._zod.run({ value: input[${B}], issues: [] }, ctx)`};v.write("const input = payload.value;");const $=Object.create(null);let H=0;for(const P of S.keys)$[P]=`key_${H++}`;v.write("const newResult = {};");for(const P of S.keys){const B=$[P],q=_2(P),V=y[P],Q=((z=V==null?void 0:V._zod)==null?void 0:z.optout)==="optional";v.write(`const ${B} = ${_(P)};`),Q?v.write(`
29
+ if (${B}.issues.length) {
30
+ if (${q} in input) {
31
+ payload.issues = payload.issues.concat(${B}.issues.map(iss => ({
32
+ ...iss,
33
+ path: iss.path ? [${q}, ...iss.path] : [${q}]
34
+ })));
35
+ }
36
+ }
37
+
38
+ if (${B}.value === undefined) {
39
+ if (${q} in input) {
40
+ newResult[${q}] = undefined;
41
+ }
42
+ } else {
43
+ newResult[${q}] = ${B}.value;
44
+ }
45
+
46
+ `):v.write(`
47
+ if (${B}.issues.length) {
48
+ payload.issues = payload.issues.concat(${B}.issues.map(iss => ({
49
+ ...iss,
50
+ path: iss.path ? [${q}, ...iss.path] : [${q}]
51
+ })));
52
+ }
53
+
54
+ if (${B}.value === undefined) {
55
+ if (${q} in input) {
56
+ newResult[${q}] = undefined;
57
+ }
58
+ } else {
59
+ newResult[${q}] = ${B}.value;
60
+ }
61
+
62
+ `)}v.write("payload.value = newResult;"),v.write("return payload;");const L=v.compile();return(P,B)=>L(y,P,B)};let s;const a=eu,l=!X8.jitless,u=l&&RT.value,f=t.catchall;let p;n._zod.parse=(y,v)=>{p??(p=r.value);const S=y.value;return a(S)?l&&u&&(v==null?void 0:v.async)===!1&&v.jitless!==!0?(s||(s=i(t.shape)),y=s(y,v),f?m6([],S,y,v,p,n):y):e(y,v):(y.issues.push({expected:"object",code:"invalid_type",input:S,inst:n}),y)}});function k2(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=>!Ma(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=>$s(a,r,Is())))}),t)}const g6=I("$ZodUnion",(n,t)=>{Ze.init(n,t),Ae(n._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),Ae(n._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),Ae(n._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),Ae(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=>ev(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=>k2(c,i,n,s)):k2(l,i,n,s)}}),fC=I("$ZodDiscriminatedUnion",(n,t)=>{t.inclusive=!1,g6.init(n,t);const e=n._zod.parse;Ae(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=Vf(()=>{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(!eu(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)}}),pC=I("$ZodIntersection",(n,t)=>{Ze.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])=>T2(e,c,u)):T2(e,s,a)}});function tg(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(ql(n)&&ql(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=tg(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=tg(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 T2(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}),Ma(n))return n;const a=tg(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 mC=I("$ZodRecord",(n,t)=>{Ze.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!ql(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 f=t.valueType._zod.run({value:i[u],issues:[]},r);f instanceof Promise?s.push(f.then(p=>{p.issues.length&&e.issues.push(...Na(u,p.issues)),e.value[u]=p.value})):(f.issues.length&&e.issues.push(...Na(u,f.issues)),e.value[u]=f.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"&&l6.test(l)&&c.issues.length){const p=t.keyType._zod.run({value:Number(l),issues:[]},r);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(c=p)}if(c.issues.length){t.mode==="loose"?e.value[l]=i[l]:e.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>$s(p,r,Is())),input:l,path:[l],inst:n});continue}const f=t.valueType._zod.run({value:i[l],issues:[]},r);f instanceof Promise?s.push(f.then(p=>{p.issues.length&&e.issues.push(...Na(l,p.issues)),e.value[c.value]=p.value})):(f.issues.length&&e.issues.push(...Na(l,f.issues)),e.value[c.value]=f.value)}}return s.length?Promise.all(s).then(()=>e):e}}),gC=I("$ZodEnum",(n,t)=>{Ze.init(n,t);const e=Q8(t.entries),r=new Set(e);n._zod.values=r,n._zod.pattern=new RegExp(`^(${e.filter(i=>CT.has(typeof i)).map(i=>typeof i=="string"?Vl(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}}),vC=I("$ZodLiteral",(n,t)=>{if(Ze.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"?Vl(r):r?Vl(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}}),yC=I("$ZodTransform",(n,t)=>{Ze.init(n,t),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new K8(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 Ha;return e.value=i,e}});function R2(n,t){return n.issues.length&&t===void 0?{issues:[],value:void 0}:n}const v6=I("$ZodOptional",(n,t)=>{Ze.init(n,t),n._zod.optin="optional",n._zod.optout="optional",Ae(n._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ae(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ev(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=>R2(s,e.value)):R2(i,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,r)}}),wC=I("$ZodExactOptional",(n,t)=>{v6.init(n,t),Ae(n._zod,"values",()=>t.innerType._zod.values),Ae(n._zod,"pattern",()=>t.innerType._zod.pattern),n._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),bC=I("$ZodNullable",(n,t)=>{Ze.init(n,t),Ae(n._zod,"optin",()=>t.innerType._zod.optin),Ae(n._zod,"optout",()=>t.innerType._zod.optout),Ae(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ev(e.source)}|null)$`):void 0}),Ae(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)}),SC=I("$ZodDefault",(n,t)=>{Ze.init(n,t),n._zod.optin="optional",Ae(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=>C2(s,t)):C2(i,t)}});function C2(n,t){return n.value===void 0&&(n.value=t.defaultValue),n}const _C=I("$ZodPrefault",(n,t)=>{Ze.init(n,t),n._zod.optin="optional",Ae(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))}),AC=I("$ZodNonOptional",(n,t)=>{Ze.init(n,t),Ae(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=>I2(s,n)):I2(i,n)}});function I2(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 EC=I("$ZodCatch",(n,t)=>{Ze.init(n,t),Ae(n._zod,"optin",()=>t.innerType._zod.optin),Ae(n._zod,"optout",()=>t.innerType._zod.optout),Ae(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=>$s(a,r,Is()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(s=>$s(s,r,Is()))},input:e.value}),e.issues=[]),e)}}),kC=I("$ZodPipe",(n,t)=>{Ze.init(n,t),Ae(n._zod,"values",()=>t.in._zod.values),Ae(n._zod,"optin",()=>t.in._zod.optin),Ae(n._zod,"optout",()=>t.out._zod.optout),Ae(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=>Uh(a,t.in,r)):Uh(s,t.in,r)}const i=t.in._zod.run(e,r);return i instanceof Promise?i.then(s=>Uh(s,t.out,r)):Uh(i,t.out,r)}});function Uh(n,t,e){return n.issues.length?(n.aborted=!0,n):t._zod.run({value:n.value,issues:n.issues},e)}const TC=I("$ZodReadonly",(n,t)=>{Ze.init(n,t),Ae(n._zod,"propValues",()=>t.innerType._zod.propValues),Ae(n._zod,"values",()=>t.innerType._zod.values),Ae(n._zod,"optin",()=>{var e,r;return(r=(e=t.innerType)==null?void 0:e._zod)==null?void 0:r.optin}),Ae(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($2):$2(i)}});function $2(n){return n.value=Object.freeze(n.value),n}const RC=I("$ZodCustom",(n,t)=>{Gt.init(n,t),Ze.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=>x2(s,e,r,n));x2(i,e,r,n)}});function x2(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(tu(i))}}var P2;class CC{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 IC(){return new CC}(P2=globalThis).__zod_globalRegistry??(P2.__zod_globalRegistry=IC());const $c=globalThis.__zod_globalRegistry;function $C(n,t){return new n({type:"string",...Y(t)})}function xC(n,t){return new n({type:"string",format:"email",check:"string_format",abort:!1,...Y(t)})}function D2(n,t){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...Y(t)})}function PC(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...Y(t)})}function DC(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Y(t)})}function LC(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Y(t)})}function OC(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Y(t)})}function MC(n,t){return new n({type:"string",format:"url",check:"string_format",abort:!1,...Y(t)})}function NC(n,t){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...Y(t)})}function zC(n,t){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...Y(t)})}function UC(n,t){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...Y(t)})}function HC(n,t){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...Y(t)})}function ZC(n,t){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...Y(t)})}function qC(n,t){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...Y(t)})}function VC(n,t){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...Y(t)})}function FC(n,t){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...Y(t)})}function BC(n,t){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...Y(t)})}function jC(n,t){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Y(t)})}function WC(n,t){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Y(t)})}function GC(n,t){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...Y(t)})}function JC(n,t){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...Y(t)})}function YC(n,t){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...Y(t)})}function KC(n,t){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...Y(t)})}function XC(n,t){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Y(t)})}function QC(n,t){return new n({type:"string",format:"date",check:"string_format",...Y(t)})}function e3(n,t){return new n({type:"string",format:"time",check:"string_format",precision:null,...Y(t)})}function t3(n,t){return new n({type:"string",format:"duration",check:"string_format",...Y(t)})}function n3(n,t){return new n({type:"number",checks:[],...Y(t)})}function r3(n,t){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...Y(t)})}function i3(n,t){return new n({type:"boolean",...Y(t)})}function s3(n){return new n({type:"unknown"})}function o3(n,t){return new n({type:"never",...Y(t)})}function L2(n,t){return new u6({check:"less_than",...Y(t),value:n,inclusive:!1})}function Rm(n,t){return new u6({check:"less_than",...Y(t),value:n,inclusive:!0})}function O2(n,t){return new h6({check:"greater_than",...Y(t),value:n,inclusive:!1})}function Cm(n,t){return new h6({check:"greater_than",...Y(t),value:n,inclusive:!0})}function M2(n,t){return new SR({check:"multiple_of",...Y(t),value:n})}function y6(n,t){return new AR({check:"max_length",...Y(t),maximum:n})}function Pd(n,t){return new ER({check:"min_length",...Y(t),minimum:n})}function w6(n,t){return new kR({check:"length_equals",...Y(t),length:n})}function a3(n,t){return new TR({check:"string_format",format:"regex",...Y(t),pattern:n})}function l3(n){return new RR({check:"string_format",format:"lowercase",...Y(n)})}function c3(n){return new CR({check:"string_format",format:"uppercase",...Y(n)})}function u3(n,t){return new IR({check:"string_format",format:"includes",...Y(t),includes:n})}function h3(n,t){return new $R({check:"string_format",format:"starts_with",...Y(t),prefix:n})}function d3(n,t){return new xR({check:"string_format",format:"ends_with",...Y(t),suffix:n})}function ec(n){return new PR({check:"overwrite",tx:n})}function f3(n){return ec(t=>t.normalize(n))}function p3(){return ec(n=>n.trim())}function m3(){return ec(n=>n.toLowerCase())}function g3(){return ec(n=>n.toUpperCase())}function v3(){return ec(n=>TT(n))}function y3(n,t,e){return new n({type:"array",element:t,...Y(e)})}function w3(n,t,e){return new n({type:"custom",check:"custom",fn:t,...Y(e)})}function b3(n){const t=S3(e=>(e.addIssue=r=>{if(typeof r=="string")e.issues.push(tu(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(tu(i))}},n(e.value,e)));return t}function S3(n,t){const e=new Gt({check:"custom",...Y(t)});return e._zod.check=n,e}function b6(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)??$c,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 Xe(n,t,e={path:[],schemaPath:[]}){var f,p;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=(p=(f=n._zod).toJSONSchema)==null?void 0:p.call(f);if(l)a.schema=l;else{const y={...e,schemaPath:[...e.schemaPath,n],path:e.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(t,a.schema,y);else{const S=a.schema,_=t.processors[i.type];if(!_)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);_(n,t,S,y)}const v=n._zod.parent;v&&(a.ref||(a.ref=v),Xe(v,t,y),t.seen.get(v).isParent=!0)}const c=t.metadataRegistry.get(n);return c&&Object.assign(a.schema,c),t.io==="input"&&At(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 S6(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 f of n.seen.entries()){const p=(a=n.metadataRegistry.get(f[0]))==null?void 0:a.id;if(p){const y=r.get(p);if(y&&y!==f[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(p,f[0])}}const i=f=>{var _;const p=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const $=(_=n.external.registry.get(f[0]))==null?void 0:_.id,H=n.external.uri??(z=>z);if($)return{ref:H($)};const L=f[1].defId??f[1].schema.id??`schema${n.counter++}`;return f[1].defId=L,{defId:L,ref:`${H("__shared")}#/${p}/${L}`}}if(f[1]===e)return{ref:"#"};const v=`#/${p}/`,S=f[1].schema.id??`__schema${n.counter++}`;return{defId:S,ref:v+S}},s=f=>{if(f[1].schema.$ref)return;const p=f[1],{ref:y,defId:v}=i(f);p.def={...p.schema},v&&(p.defId=v);const S=p.schema;for(const _ in S)delete S[_];S.$ref=y};if(n.cycles==="throw")for(const f of n.seen.entries()){const p=f[1];if(p.cycle)throw new Error(`Cycle detected: #/${(l=p.cycle)==null?void 0:l.join("/")}/<root>
63
+
64
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const f of n.seen.entries()){const p=f[1];if(t===f[0]){s(f);continue}if(n.external){const v=(c=n.external.registry.get(f[0]))==null?void 0:c.id;if(t!==f[0]&&v){s(f);continue}}if((u=n.metadataRegistry.get(f[0]))==null?void 0:u.id){s(f);continue}if(p.cycle){s(f);continue}if(p.count>1&&n.reused==="ref"){s(f);continue}}}function _6(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 f=n.seen.get(u);if(f.ref===null)return;const p=f.def??f.schema,y={...p},v=f.ref;if(f.ref=null,v){r(v);const _=n.seen.get(v),$=_.schema;if($.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push($)):Object.assign(p,$),Object.assign(p,y),u._zod.parent===v)for(const L in p)L==="$ref"||L==="allOf"||L in y||delete p[L];if($.$ref&&_.def)for(const L in p)L==="$ref"||L==="allOf"||L in _.def&&JSON.stringify(p[L])===JSON.stringify(_.def[L])&&delete p[L]}const S=u._zod.parent;if(S&&S!==v){r(S);const _=n.seen.get(S);if(_!=null&&_.schema.$ref&&(p.$ref=_.schema.$ref,_.def))for(const $ in p)$==="$ref"||$==="allOf"||$ in _.def&&JSON.stringify(p[$])===JSON.stringify(_.def[$])&&delete p[$]}n.override({zodSchema:u,jsonSchema:p,path:f.path??[]})};for(const u of[...n.seen.entries()].reverse())r(u[0]);const i={};if(n.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":n.target,(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 f=u[1];f.def&&f.defId&&(s[f.defId]=f.def)}n.external||Object.keys(s).length>0&&(n.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{const u=JSON.parse(JSON.stringify(i));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:Dd(t,"input",n.processors),output:Dd(t,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function At(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 At(r.element,e);if(r.type==="set")return At(r.valueType,e);if(r.type==="lazy")return At(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 At(r.innerType,e);if(r.type==="intersection")return At(r.left,e)||At(r.right,e);if(r.type==="record"||r.type==="map")return At(r.keyType,e)||At(r.valueType,e);if(r.type==="pipe")return At(r.in,e)||At(r.out,e);if(r.type==="object"){for(const i in r.shape)if(At(r.shape[i],e))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(At(i,e))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(At(i,e))return!0;return!!(r.rest&&At(r.rest,e))}return!1}const _3=(n,t={})=>e=>{const r=b6({...e,processors:t});return Xe(n,r),S6(r,n),_6(r,n)},Dd=(n,t,e={})=>r=>{const{libraryOptions:i,target:s}=r??{},a=b6({...i??{},target:s,io:t,processors:e});return Xe(n,a),S6(a,n),_6(a,n)},A3={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},E3=(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=A3[l]??l,i.format===""&&delete i.format,l==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){const f=[...c];f.length===1?i.pattern=f[0].source:f.length>1&&(i.allOf=[...f.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},k3=(n,t,e,r)=>{const i=e,{minimum:s,maximum:a,format:l,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:f}=n._zod.bag;typeof l=="string"&&l.includes("int")?i.type="integer":i.type="number",typeof f=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=f,i.exclusiveMinimum=!0):i.exclusiveMinimum=f),typeof s=="number"&&(i.minimum=s,typeof f=="number"&&t.target!=="draft-04"&&(f>=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)},T3=(n,t,e,r)=>{e.type="boolean"},R3=(n,t,e,r)=>{e.not={}},C3=(n,t,e,r)=>{},I3=(n,t,e,r)=>{const i=n._zod.def,s=Q8(i.entries);s.every(a=>typeof a=="number")&&(e.type="number"),s.every(a=>typeof a=="string")&&(e.type="string"),e.enum=s},$3=(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},x3=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},P3=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},D3=(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=Xe(s.element,t,{...r,path:[...r.path,"items"]})},L3=(n,t,e,r)=>{var u;const i=e,s=n._zod.def;i.type="object",i.properties={};const a=s.shape;for(const f in a)i.properties[f]=Xe(a[f],t,{...r,path:[...r.path,"properties",f]});const l=new Set(Object.keys(a)),c=new Set([...l].filter(f=>{const p=s.shape[f]._zod;return t.io==="input"?p.optin===void 0:p.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=Xe(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},O3=(n,t,e,r)=>{const i=n._zod.def,s=i.inclusive===!1,a=i.options.map((l,c)=>Xe(l,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?e.oneOf=a:e.anyOf=a},M3=(n,t,e,r)=>{const i=n._zod.def,s=Xe(i.left,t,{...r,path:[...r.path,"allOf",0]}),a=Xe(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},N3=(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 f=Xe(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const p of c)i.patternProperties[p.source]=f}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=Xe(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=Xe(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=a._zod.values;if(u){const f=[...u].filter(p=>typeof p=="string"||typeof p=="number");f.length>0&&(i.required=f)}},z3=(n,t,e,r)=>{const i=n._zod.def,s=Xe(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"}]},U3=(n,t,e,r)=>{const i=n._zod.def;Xe(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},H3=(n,t,e,r)=>{const i=n._zod.def;Xe(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.default=JSON.parse(JSON.stringify(i.defaultValue))},Z3=(n,t,e,r)=>{const i=n._zod.def;Xe(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)))},q3=(n,t,e,r)=>{const i=n._zod.def;Xe(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},V3=(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;Xe(s,t,r);const a=t.seen.get(n);a.ref=s},F3=(n,t,e,r)=>{const i=n._zod.def;Xe(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.readOnly=!0},A6=(n,t,e,r)=>{const i=n._zod.def;Xe(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},B3=I("ZodISODateTime",(n,t)=>{jR.init(n,t),Ve.init(n,t)});function j3(n){return XC(B3,n)}const W3=I("ZodISODate",(n,t)=>{WR.init(n,t),Ve.init(n,t)});function G3(n){return QC(W3,n)}const J3=I("ZodISOTime",(n,t)=>{GR.init(n,t),Ve.init(n,t)});function Y3(n){return e3(J3,n)}const K3=I("ZodISODuration",(n,t)=>{JR.init(n,t),Ve.init(n,t)});function X3(n){return t3(K3,n)}const E6=(n,t)=>{r6.init(n,t),n.name="ZodError",Object.defineProperties(n,{format:{value:e=>UT(n,e)},flatten:{value:e=>zT(n,e)},addIssue:{value:e=>{n.issues.push(e),n.message=JSON.stringify(n.issues,eg,2)}},addIssues:{value:e=>{n.issues.push(...e),n.message=JSON.stringify(n.issues,eg,2)}},isEmpty:{get(){return n.issues.length===0}}})},N2=I("ZodError",E6),xn=I("ZodError",E6,{Parent:Error}),Q3=nv(xn),eI=rv(xn),tI=Ff(xn),nI=Bf(xn),rI=qT(xn),iI=VT(xn),sI=FT(xn),oI=BT(xn),aI=jT(xn),lI=WT(xn),cI=GT(xn),uI=JT(xn),qe=I("ZodType",(n,t)=>(Ze.init(n,t),Object.assign(n["~standard"],{jsonSchema:{input:Dd(n,"input"),output:Dd(n,"output")}}),n.toJSONSchema=_3(n,{}),n.def=t,n.type=t.type,Object.defineProperty(n,"_def",{value:t}),n.check=(...e)=>n.clone(Ls(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)=>Os(n,e,r),n.brand=()=>n,n.register=((e,r)=>(e.add(n,r),n)),n.parse=(e,r)=>Q3(n,e,r,{callee:n.parse}),n.safeParse=(e,r)=>tI(n,e,r),n.parseAsync=async(e,r)=>eI(n,e,r,{callee:n.parseAsync}),n.safeParseAsync=async(e,r)=>nI(n,e,r),n.spa=n.safeParseAsync,n.encode=(e,r)=>rI(n,e,r),n.decode=(e,r)=>iI(n,e,r),n.encodeAsync=async(e,r)=>sI(n,e,r),n.decodeAsync=async(e,r)=>oI(n,e,r),n.safeEncode=(e,r)=>aI(n,e,r),n.safeDecode=(e,r)=>lI(n,e,r),n.safeEncodeAsync=async(e,r)=>cI(n,e,r),n.safeDecodeAsync=async(e,r)=>uI(n,e,r),n.refine=(e,r)=>n.check(n$(e,r)),n.superRefine=e=>n.check(r$(e)),n.overwrite=e=>n.check(ec(e)),n.optional=()=>H2(n),n.exactOptional=()=>VI(n),n.nullable=()=>Z2(n),n.nullish=()=>H2(Z2(n)),n.nonoptional=e=>JI(n,e),n.array=()=>G(n),n.or=e=>ae([n,e]),n.and=e=>Wf(n,e),n.transform=e=>q2(n,ZI(e)),n.default=e=>jI(n,e),n.prefault=e=>GI(n,e),n.catch=e=>KI(n,e),n.pipe=e=>q2(n,e),n.readonly=()=>e$(n),n.describe=e=>{const r=n.clone();return $c.add(r,{description:e}),r},Object.defineProperty(n,"description",{get(){var e;return(e=$c.get(n))==null?void 0:e.description},configurable:!0}),n.meta=(...e)=>{if(e.length===0)return $c.get(n);const r=n.clone();return $c.add(r,e[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=e=>e(n),n)),k6=I("_ZodString",(n,t)=>{iv.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(r,i,s)=>E3(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(a3(...r)),n.includes=(...r)=>n.check(u3(...r)),n.startsWith=(...r)=>n.check(h3(...r)),n.endsWith=(...r)=>n.check(d3(...r)),n.min=(...r)=>n.check(Pd(...r)),n.max=(...r)=>n.check(y6(...r)),n.length=(...r)=>n.check(w6(...r)),n.nonempty=(...r)=>n.check(Pd(1,...r)),n.lowercase=r=>n.check(l3(r)),n.uppercase=r=>n.check(c3(r)),n.trim=()=>n.check(p3()),n.normalize=(...r)=>n.check(f3(...r)),n.toLowerCase=()=>n.check(m3()),n.toUpperCase=()=>n.check(g3()),n.slugify=()=>n.check(v3())}),hI=I("ZodString",(n,t)=>{iv.init(n,t),k6.init(n,t),n.email=e=>n.check(xC(dI,e)),n.url=e=>n.check(MC(fI,e)),n.jwt=e=>n.check(KC(CI,e)),n.emoji=e=>n.check(NC(pI,e)),n.guid=e=>n.check(D2(z2,e)),n.uuid=e=>n.check(PC(Hh,e)),n.uuidv4=e=>n.check(DC(Hh,e)),n.uuidv6=e=>n.check(LC(Hh,e)),n.uuidv7=e=>n.check(OC(Hh,e)),n.nanoid=e=>n.check(zC(mI,e)),n.guid=e=>n.check(D2(z2,e)),n.cuid=e=>n.check(UC(gI,e)),n.cuid2=e=>n.check(HC(vI,e)),n.ulid=e=>n.check(ZC(yI,e)),n.base64=e=>n.check(GC(kI,e)),n.base64url=e=>n.check(JC(TI,e)),n.xid=e=>n.check(qC(wI,e)),n.ksuid=e=>n.check(VC(bI,e)),n.ipv4=e=>n.check(FC(SI,e)),n.ipv6=e=>n.check(BC(_I,e)),n.cidrv4=e=>n.check(jC(AI,e)),n.cidrv6=e=>n.check(WC(EI,e)),n.e164=e=>n.check(YC(RI,e)),n.datetime=e=>n.check(j3(e)),n.date=e=>n.check(G3(e)),n.time=e=>n.check(Y3(e)),n.duration=e=>n.check(X3(e))});function g(n){return $C(hI,n)}const Ve=I("ZodStringFormat",(n,t)=>{Me.init(n,t),k6.init(n,t)}),dI=I("ZodEmail",(n,t)=>{NR.init(n,t),Ve.init(n,t)}),z2=I("ZodGUID",(n,t)=>{OR.init(n,t),Ve.init(n,t)}),Hh=I("ZodUUID",(n,t)=>{MR.init(n,t),Ve.init(n,t)}),fI=I("ZodURL",(n,t)=>{zR.init(n,t),Ve.init(n,t)}),pI=I("ZodEmoji",(n,t)=>{UR.init(n,t),Ve.init(n,t)}),mI=I("ZodNanoID",(n,t)=>{HR.init(n,t),Ve.init(n,t)}),gI=I("ZodCUID",(n,t)=>{ZR.init(n,t),Ve.init(n,t)}),vI=I("ZodCUID2",(n,t)=>{qR.init(n,t),Ve.init(n,t)}),yI=I("ZodULID",(n,t)=>{VR.init(n,t),Ve.init(n,t)}),wI=I("ZodXID",(n,t)=>{FR.init(n,t),Ve.init(n,t)}),bI=I("ZodKSUID",(n,t)=>{BR.init(n,t),Ve.init(n,t)}),SI=I("ZodIPv4",(n,t)=>{YR.init(n,t),Ve.init(n,t)}),_I=I("ZodIPv6",(n,t)=>{KR.init(n,t),Ve.init(n,t)}),AI=I("ZodCIDRv4",(n,t)=>{XR.init(n,t),Ve.init(n,t)}),EI=I("ZodCIDRv6",(n,t)=>{QR.init(n,t),Ve.init(n,t)}),kI=I("ZodBase64",(n,t)=>{eC.init(n,t),Ve.init(n,t)}),TI=I("ZodBase64URL",(n,t)=>{nC.init(n,t),Ve.init(n,t)}),RI=I("ZodE164",(n,t)=>{rC.init(n,t),Ve.init(n,t)}),CI=I("ZodJWT",(n,t)=>{sC.init(n,t),Ve.init(n,t)}),T6=I("ZodNumber",(n,t)=>{f6.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(r,i,s)=>k3(n,r,i),n.gt=(r,i)=>n.check(O2(r,i)),n.gte=(r,i)=>n.check(Cm(r,i)),n.min=(r,i)=>n.check(Cm(r,i)),n.lt=(r,i)=>n.check(L2(r,i)),n.lte=(r,i)=>n.check(Rm(r,i)),n.max=(r,i)=>n.check(Rm(r,i)),n.int=r=>n.check(U2(r)),n.safe=r=>n.check(U2(r)),n.positive=r=>n.check(O2(0,r)),n.nonnegative=r=>n.check(Cm(0,r)),n.negative=r=>n.check(L2(0,r)),n.nonpositive=r=>n.check(Rm(0,r)),n.multipleOf=(r,i)=>n.check(M2(r,i)),n.step=(r,i)=>n.check(M2(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 ie(n){return n3(T6,n)}const II=I("ZodNumberFormat",(n,t)=>{oC.init(n,t),T6.init(n,t)});function U2(n){return r3(II,n)}const $I=I("ZodBoolean",(n,t)=>{aC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>T3(n,e,r)});function lt(n){return i3($I,n)}const xI=I("ZodUnknown",(n,t)=>{lC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>C3()});function E(){return s3(xI)}const PI=I("ZodNever",(n,t)=>{cC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>R3(n,e,r)});function DI(n){return o3(PI,n)}const LI=I("ZodArray",(n,t)=>{uC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>D3(n,e,r,i),n.element=t.element,n.min=(e,r)=>n.check(Pd(e,r)),n.nonempty=e=>n.check(Pd(1,e)),n.max=(e,r)=>n.check(y6(e,r)),n.length=(e,r)=>n.check(w6(e,r)),n.unwrap=()=>n.element});function G(n,t){return y3(LI,n,t)}const R6=I("ZodObject",(n,t)=>{dC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>L3(n,e,r,i),Ae(n,"shape",()=>t.shape),n.keyof=()=>sv(Object.keys(n._zod.def.shape)),n.catchall=e=>n.clone({...n._zod.def,catchall:e}),n.passthrough=()=>n.clone({...n._zod.def,catchall:E()}),n.loose=()=>n.clone({...n._zod.def,catchall:E()}),n.strict=()=>n.clone({...n._zod.def,catchall:DI()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=e=>DT(n,e),n.safeExtend=e=>LT(n,e),n.merge=e=>OT(n,e),n.pick=e=>xT(n,e),n.omit=e=>PT(n,e),n.partial=(...e)=>MT(I6,n,e[0]),n.required=(...e)=>NT($6,n,e[0])});function ng(n,t){const e={type:"object",shape:n??{},...Y(t)};return new R6(e)}function b(n,t){return new R6({type:"object",shape:n,catchall:E(),...Y(t)})}const C6=I("ZodUnion",(n,t)=>{g6.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>O3(n,e,r,i),n.options=t.options});function ae(n,t){return new C6({type:"union",options:n,...Y(t)})}const OI=I("ZodDiscriminatedUnion",(n,t)=>{C6.init(n,t),fC.init(n,t)});function MI(n,t,e){return new OI({type:"union",options:t,discriminator:n,...Y(e)})}const NI=I("ZodIntersection",(n,t)=>{pC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>M3(n,e,r,i)});function Wf(n,t){return new NI({type:"intersection",left:n,right:t})}const zI=I("ZodRecord",(n,t)=>{mC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>N3(n,e,r,i),n.keyType=t.keyType,n.valueType=t.valueType});function T(n,t,e){return new zI({type:"record",keyType:n,valueType:t,...Y(e)})}const rg=I("ZodEnum",(n,t)=>{gC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(r,i,s)=>I3(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 rg({...t,checks:[],...Y(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 rg({...t,checks:[],...Y(i),entries:s})}});function sv(n,t){const e=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new rg({type:"enum",entries:e,...Y(t)})}const UI=I("ZodLiteral",(n,t)=>{vC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>$3(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 D(n,t){return new UI({type:"literal",values:Array.isArray(n)?n:[n],...Y(t)})}const HI=I("ZodTransform",(n,t)=>{yC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>P3(n,e),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new K8(n.constructor.name);e.addIssue=s=>{if(typeof s=="string")e.issues.push(tu(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(tu(a))}};const i=t.transform(e.value,e);return i instanceof Promise?i.then(s=>(e.value=s,e)):(e.value=i,e)}});function ZI(n){return new HI({type:"transform",transform:n})}const I6=I("ZodOptional",(n,t)=>{v6.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>A6(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function H2(n){return new I6({type:"optional",innerType:n})}const qI=I("ZodExactOptional",(n,t)=>{wC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>A6(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function VI(n){return new qI({type:"optional",innerType:n})}const FI=I("ZodNullable",(n,t)=>{bC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>z3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function Z2(n){return new FI({type:"nullable",innerType:n})}const BI=I("ZodDefault",(n,t)=>{SC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>H3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function jI(n,t){return new BI({type:"default",innerType:n,get defaultValue(){return typeof t=="function"?t():t6(t)}})}const WI=I("ZodPrefault",(n,t)=>{_C.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>Z3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function GI(n,t){return new WI({type:"prefault",innerType:n,get defaultValue(){return typeof t=="function"?t():t6(t)}})}const $6=I("ZodNonOptional",(n,t)=>{AC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>U3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function JI(n,t){return new $6({type:"nonoptional",innerType:n,...Y(t)})}const YI=I("ZodCatch",(n,t)=>{EC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>q3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function KI(n,t){return new YI({type:"catch",innerType:n,catchValue:typeof t=="function"?t:()=>t})}const XI=I("ZodPipe",(n,t)=>{kC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>V3(n,e,r,i),n.in=t.in,n.out=t.out});function q2(n,t){return new XI({type:"pipe",in:n,out:t})}const QI=I("ZodReadonly",(n,t)=>{TC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>F3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function e$(n){return new QI({type:"readonly",innerType:n})}const t$=I("ZodCustom",(n,t)=>{RC.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>x3(n,e)});function n$(n,t={}){return w3(t$,n,t)}function r$(n){return b3(n)}const i$=[".md",".markdown"];function x6(n){if(n.length===0)return!1;const t=n.at(-1);return t==="/"||t==="\\"}function P6(n){const t=n.lastIndexOf("/"),e=n.lastIndexOf("\\");return n.slice(Math.max(t,e)+1)}function s$(n){return P6(n).toLowerCase()}function o$(n,t){const e=s$(n);return t.some(r=>e.endsWith(r))}function ig(n){return!x6(n)&&o$(n,i$)}function a$(n){let t;try{t=new URL(n)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"}function Vr(n){try{const{pathname:t}=new URL(n);return/^\/artifact\/[0-9A-Za-z]{26}(\/|$)/.test(t)}catch{return!1}}const l$=ng({id:g().min(1),kind:D("path"),title:g(),path:g(),store:g().optional(),share:ng({id:g().min(1),access:sv(["read","read-write"])}).strict().optional()}).strict(),c$=ng({id:g().min(1),kind:D("url"),title:g(),url:g().refine(a$,{message:"url must be an http(s) URL"})}).strict();MI("kind",[l$,c$]);const u$=new Set(["about:","blob:","chrome-extension:","chrome:","data:","devtools:","file:","filesystem:","javascript:","view-source:"]);function h$(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}:u$.has(r.protocol)?{kind:"browser-local",url:r.href}:{kind:"application",url:r.href}}catch{return{kind:"invalid"}}}function V2(n,t){return h$(n,t).kind==="web"}const d$="/views/markdown/",f$="/views/url-unsupported/";function p$(n){try{const{protocol:t}=new URL(n);return t==="http:"||t==="https:"}catch{return!1}}function D6(n){return`/artifact/${encodeURIComponent(n)}`}function m$(n,t){return`${D6(n)}/${encodeURIComponent(t)}`}function g$(n){return`/markdown/${encodeURIComponent(n)}`}function Ld(n,t={electron:!1}){if(n.kind==="url")return t.electron?{renderer:"url-webview",viewURL:n.url,contentURL:null}:Vr(n.url)?{renderer:"proxy-iframe",viewURL:n.url,contentURL:null}:t.browserDemo&&p$(n.url)?{renderer:"url-direct",viewURL:n.url,contentURL:null}:{renderer:"url-unsupported",viewURL:f$,contentURL:null};if(ig(n.path)){const r={viewURL:d$,contentURL:g$(n.id)};return t.electron?{renderer:"url-webview",...r}:{renderer:"markdown",...r}}const e=x6(n.path)?`${D6(n.id)}/`:m$(n.id,P6(n.path));return t.electron?{renderer:"url-webview",viewURL:e,contentURL:null}:{renderer:"proxy-iframe",viewURL:e,contentURL:null}}const v$="serverURL",y$="token",w$="mode",b$="desktopAppVersion",S$="electron";function _$(n=window.location.search,t=window.location.origin){const r=new URLSearchParams(n).get(v$);return r?new URL(r).origin:new URL(t).origin}function A$(n=window.location.search){return new URLSearchParams(n).get(y$)}function wi(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(w$)===S$}function L6(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(b$)}const F2="tv.telemetry.clientId",E$=5,k$=60,T$=1e3,R$=E$*k$*T$,B2=["pointerdown","scroll","keydown"],j2=["focus"],W2=["visibilitychange"],C$="hidden";function I$(n,t=L$){const e=n.getItem(F2);if(e)return e;const r=t();return n.setItem(F2,r),r}function $$(n){return{clientId:I$(n.storage,n.idFactory),userAgent:n.userAgent??(typeof navigator>"u"?"":navigator.userAgent),clientApp:n.clientApp,...n.desktopAppVersion?{desktopAppVersion:n.desktopAppVersion}:{}}}function x$(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 P$(n){return new D$(n)}var cu,Gr,ji,uu,hu,vn,mo,du,Wd,O6;class D${constructor(t){m(this,Wd);m(this,cu);m(this,Gr);m(this,ji);m(this,uu);m(this,hu);m(this,vn);m(this,mo,!1);m(this,du,Number.NEGATIVE_INFINITY);d(this,cu,t.meta),d(this,Gr,t.documentTarget),d(this,ji,t.windowTarget),d(this,uu,t.send),d(this,hu,t.nowMs??Date.now),d(this,vn,()=>h(this,Wd,O6).call(this))}start(){if(!o(this,mo)){d(this,mo,!0);for(const t of B2)o(this,ji).addEventListener(t,o(this,vn)),o(this,Gr).addEventListener(t,o(this,vn));for(const t of j2)o(this,ji).addEventListener(t,o(this,vn));for(const t of W2)o(this,Gr).addEventListener(t,o(this,vn))}}stop(){if(o(this,mo)){d(this,mo,!1);for(const t of B2)o(this,ji).removeEventListener(t,o(this,vn)),o(this,Gr).removeEventListener(t,o(this,vn));for(const t of j2)o(this,ji).removeEventListener(t,o(this,vn));for(const t of W2)o(this,Gr).removeEventListener(t,o(this,vn))}}}cu=new WeakMap,Gr=new WeakMap,ji=new WeakMap,uu=new WeakMap,hu=new WeakMap,vn=new WeakMap,mo=new WeakMap,du=new WeakMap,Wd=new WeakSet,O6=function(){if(o(this,Gr).visibilityState===C$)return;const t=o(this,hu).call(this);t-o(this,du)<R$||(d(this,du,t),o(this,uu).call(this,{type:ak,clientId:o(this,cu).clientId}))};function L$(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():X1().toLowerCase()}const De={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"},Ur={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"},O$=1,M$=b({_meta:T(g(),E()).nullish(),terminal:lt().optional().default(!1)}),N$=b({_meta:T(g(),E()).nullish(),label:g().nullish(),name:g(),optional:lt().optional().default(!1),secret:lt().optional().default(!0)}),z$=b({_meta:T(g(),E()).nullish(),description:g().nullish(),id:g(),name:g()}),U$=b({_meta:T(g(),E()).nullish(),description:g().nullish(),id:g(),link:g().nullish(),name:g(),vars:G(N$)}),H$=b({_meta:T(g(),E()).nullish(),args:G(g()).optional(),description:g().nullish(),env:T(g(),g()).optional(),id:g(),name:g()}),Z$=ae([U$.and(b({type:D("env_var")})),H$.and(b({type:D("terminal")})),z$]),q$=b({_meta:T(g(),E()).nullish(),methodId:g()}),V$=b({_meta:T(g(),E()).nullish()}),F$=b({_meta:T(g(),E()).nullish(),blob:g(),mimeType:g().nullish(),uri:g()}),B$=b({default:lt().nullish(),description:g().nullish(),title:g().nullish()}),j$=b({_meta:T(g(),E()).nullish()}),W$=b({_meta:T(g(),E()).nullish()}),G$=b({amount:ie(),currency:g()}),J$=b({_meta:T(g(),E()).nullish(),terminalId:g()}),Y$=b({_meta:T(g(),E()).nullish(),newText:g(),oldText:g().nullish(),path:g()}),K$=ae([g(),ie(),ie(),lt(),G(g())]),X$=b({content:T(g(),K$).nullish()}),Q$=ae([X$.and(b({action:D("accept")})),b({action:D("decline")}),b({action:D("cancel")})]),ex=b({_meta:T(g(),E()).nullish()}),M6=g(),tx=b({_meta:T(g(),E()).nullish(),elicitationId:M6}),nx=b({_meta:T(g(),E()).nullish(),action:Q$}),rx=D("object"),ix=D("string"),sx=b({_meta:T(g(),E()).nullish()}),ox=b({_meta:T(g(),E()).nullish(),form:ex.nullish(),url:sx.nullish()}),ax=b({elicitationId:M6,url:g().url()}),N6=b({const:g(),title:g()}),z6=b({_meta:T(g(),E()).nullish(),name:g(),value:g()}),lx=ae([D(-32700),D(-32600),D(-32601),D(-32602),D(-32603),D(-32800),D(-32e3),D(-32002),D(-32042),ie().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),U6=b({code:lx,data:E().optional(),message:g()}),H6=E(),Z6=E(),q6=E(),cx=b({_meta:T(g(),E()).nullish(),readTextFile:lt().optional().default(!1),writeTextFile:lt().optional().default(!1)}),V6=b({_meta:T(g(),E()).nullish(),name:g(),value:g()}),F6=b({_meta:T(g(),E()).nullish(),name:g(),title:g().nullish(),version:g()}),ux=b({default:ie().nullish(),description:g().nullish(),maximum:ie().nullish(),minimum:ie().nullish(),title:g().nullish()}),hx=b({_meta:T(g(),E()).nullish()}),dx=b({_meta:T(g(),E()).nullish(),additionalDirectories:G(g()).optional(),cursor:g().nullish(),cwd:g().nullish()}),fx=b({_meta:T(g(),E()).nullish()}),px=b({_meta:T(g(),E()).nullish(),logout:fx.nullish()}),mx=b({_meta:T(g(),E()).nullish()}),gx=b({_meta:T(g(),E()).nullish()}),vx=b({_meta:T(g(),E()).nullish(),http:lt().optional().default(!1),sse:lt().optional().default(!1)}),yx=b({_meta:T(g(),E()).nullish(),headers:G(V6),name:g(),url:g()}),wx=b({_meta:T(g(),E()).nullish(),headers:G(V6),name:g(),url:g()}),bx=b({_meta:T(g(),E()).nullish(),args:G(g()),command:g(),env:G(z6),name:g()}),Gf=ae([yx.and(b({type:D("http")})),wx.and(b({type:D("sse")})),bx]),ov=g(),Sx=b({_meta:T(g(),E()).nullish(),description:g().nullish(),modelId:ov,name:g()}),_x=ae([D("error"),D("warning"),D("information"),D("hint")]),Ax=b({_meta:T(g(),E()).nullish()}),Ex=b({_meta:T(g(),E()).nullish()}),kx=b({_meta:T(g(),E()).nullish()}),Tx=b({_meta:T(g(),E()).nullish()}),Rx=b({_meta:T(g(),E()).nullish()}),Cx=b({_meta:T(g(),E()).nullish(),maxCount:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),Ix=b({diff:g(),uri:g()}),$x=b({endLine:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:g()}),xx=b({_meta:T(g(),E()).nullish()}),Px=b({_meta:T(g(),E()).nullish()}),Dx=b({languageId:g(),text:g(),uri:g()}),Lx=b({_meta:T(g(),E()).nullish(),maxCount:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),Ox=ae([D("rejected"),D("ignored"),D("replaced"),D("cancelled")]),Mx=b({excerpts:G($x),uri:g()}),Nx=b({_meta:T(g(),E()).nullish()}),zx=b({_meta:T(g(),E()).nullish()}),Ux=b({name:g(),owner:g(),remoteUrl:g()}),Hx=b({_meta:T(g(),E()).nullish()}),Zx=b({_meta:T(g(),E()).nullish(),jump:xx.nullish(),rename:zx.nullish(),searchAndReplace:Hx.nullish()}),qx=b({id:g(),isRegex:lt().nullish(),replace:g(),search:g(),uri:g()}),Vx=ae([D("automatic"),D("diagnostic"),D("manual")]),Fx=b({_meta:T(g(),E()).nullish(),maxCount:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),Bx=b({_meta:T(g(),E()).nullish(),diagnostics:Ax.nullish(),editHistory:Cx.nullish(),openFiles:Px.nullish(),recentFiles:Lx.nullish(),relatedSnippets:Nx.nullish(),userActions:Fx.nullish()}),jx=b({_meta:T(g(),E()).nullish(),additionalDirectories:G(g()).optional(),cwd:g(),mcpServers:G(Gf)}),Wx=b({default:ie().nullish(),description:g().nullish(),maximum:ie().nullish(),minimum:ie().nullish(),title:g().nullish()}),B6=g(),Gx=ae([D("allow_once"),D("allow_always"),D("reject_once"),D("reject_always")]),Jx=b({_meta:T(g(),E()).nullish(),kind:Gx,name:g(),optionId:B6}),Yx=ae([D("high"),D("medium"),D("low")]),Kx=ae([D("pending"),D("in_progress"),D("completed")]),Xx=b({_meta:T(g(),E()).nullish(),content:g(),priority:Yx,status:Kx}),Qx=b({_meta:T(g(),E()).nullish(),entries:G(Xx)}),xs=b({character:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),eP=b({id:g(),position:xs,uri:g()}),tP=b({id:g(),newName:g(),position:xs,uri:g()}),nP=b({action:g(),position:xs,timestampMs:ie(),uri:g()}),j6=ae([D("utf-16"),D("utf-32"),D("utf-8")]),rP=b({_meta:T(g(),E()).nullish(),auth:M$.optional().default({terminal:!1}),elicitation:ox.nullish(),fs:cx.optional().default({readTextFile:!1,writeTextFile:!1}),nes:Zx.nullish(),positionEncodings:G(j6).optional(),terminal:lt().optional().default(!1)}),iP=b({_meta:T(g(),E()).nullish(),audio:lt().optional().default(!1),embeddedContext:lt().optional().default(!1),image:lt().optional().default(!1)}),W6=ie().int().gte(0).lte(65535),sP=b({_meta:T(g(),E()).nullish(),clientCapabilities:rP.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:F6.nullish(),protocolVersion:W6}),tc=b({end:xs,start:xs}),oP=b({message:g(),range:tc,severity:_x,uri:g()}),aP=b({languageId:g(),lastFocusedMs:ie().nullish(),uri:g(),visibleRange:tc.nullish()}),lP=b({_meta:T(g(),E()).nullish(),diagnostics:G(oP).nullish(),editHistory:G(Ix).nullish(),openFiles:G(aP).nullish(),recentFiles:G(Dx).nullish(),relatedSnippets:G(Mx).nullish(),userActions:G(nP).nullish()}),cP=b({newText:g(),range:tc}),uP=b({cursorPosition:xs.nullish(),edits:G(cP),id:g(),uri:g()}),hP=ae([uP.and(b({kind:D("edit")})),eP.and(b({kind:D("jump")})),tP.and(b({kind:D("rename")})),qx.and(b({kind:D("searchAndReplace")}))]),dP=b({_meta:T(g(),E()).nullish(),content:g()}),fP=b({_meta:T(g(),E()).nullish()}),ra=ae([ie(),g()]).nullable();b({_meta:T(g(),E()).nullish(),requestId:ra});const pP=sv(["assistant","user"]),_h=b({_meta:T(g(),E()).nullish(),audience:G(pP).nullish(),lastModified:g().nullish(),priority:ie().nullish()}),mP=b({_meta:T(g(),E()).nullish(),annotations:_h.nullish(),data:g(),mimeType:g()}),gP=b({_meta:T(g(),E()).nullish(),annotations:_h.nullish(),data:g(),mimeType:g(),uri:g().nullish()}),vP=b({_meta:T(g(),E()).nullish(),annotations:_h.nullish(),description:g().nullish(),mimeType:g().nullish(),name:g(),size:ie().nullish(),title:g().nullish(),uri:g()}),yP=b({_meta:T(g(),E()).nullish(),optionId:B6}),wP=ae([b({outcome:D("cancelled")}),yP.and(b({outcome:D("selected")}))]),bP=b({_meta:T(g(),E()).nullish(),outcome:wP}),SP=b({_meta:T(g(),E()).nullish()}),_P=b({_meta:T(g(),E()).nullish()}),AP=b({currentValue:lt()}),EP=g(),G6=g(),kP=ae([D("mode"),D("model"),D("thought_level"),g()]),av=g(),J6=b({_meta:T(g(),E()).nullish(),description:g().nullish(),name:g(),value:av}),TP=b({_meta:T(g(),E()).nullish(),group:EP,name:g(),options:G(J6)}),RP=ae([G(J6),G(TP)]),CP=b({currentValue:av,options:RP}),nc=Wf(ae([CP.and(b({type:D("select")})),AP.and(b({type:D("boolean")}))]),b({_meta:T(g(),E()).nullish(),category:kP.nullish(),description:g().nullish(),id:G6,name:g()})),IP=b({_meta:T(g(),E()).nullish(),configOptions:G(nc)}),$P=b({_meta:T(g(),E()).nullish()}),be=g(),xP=b({_meta:T(g(),E()).nullish(),id:g(),sessionId:be}),PP=b({_meta:T(g(),E()).nullish(),sessionId:be}),DP=b({_meta:T(g(),E()).nullish(),sessionId:be}),LP=b({_meta:T(g(),E()).nullish(),sessionId:be}),Y6=b({_meta:T(g(),E()).nullish(),args:G(g()).optional(),command:g(),cwd:g().nullish(),env:G(z6).optional(),outputByteLimit:ie().nullish(),sessionId:be}),OP=b({_meta:T(g(),E()).nullish(),sessionId:be,uri:g()}),MP=b({_meta:T(g(),E()).nullish(),position:xs,sessionId:be,uri:g(),version:ie(),visibleRange:tc}),NP=b({_meta:T(g(),E()).nullish(),languageId:g(),sessionId:be,text:g(),uri:g(),version:ie()}),zP=b({_meta:T(g(),E()).nullish(),sessionId:be,uri:g()}),UP=b({_meta:T(g(),E()).nullish(),additionalDirectories:G(g()).optional(),cwd:g(),mcpServers:G(Gf).optional(),sessionId:be}),K6=b({_meta:T(g(),E()).nullish(),sessionId:be,terminalId:g()}),HP=b({_meta:T(g(),E()).nullish(),additionalDirectories:G(g()).optional(),cwd:g(),mcpServers:G(Gf),sessionId:be}),X6=b({_meta:T(g(),E()).nullish(),limit:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:g(),sessionId:be}),ZP=b({_meta:T(g(),E()).nullish(),id:g(),reason:Ox.nullish(),sessionId:be}),Q6=b({_meta:T(g(),E()).nullish(),sessionId:be,terminalId:g()}),qP=b({_meta:T(g(),E()).nullish(),additionalDirectories:G(g()).optional(),cwd:g(),mcpServers:G(Gf).optional(),sessionId:be}),VP=b({_meta:T(g(),E()).nullish(),additionalDirectories:G(g()).optional(),cwd:g(),sessionId:be,title:g().nullish(),updatedAt:g().nullish()}),FP=b({_meta:T(g(),E()).nullish(),nextCursor:g().nullish(),sessions:G(VP)}),BP=b({_meta:T(g(),E()).nullish(),title:g().nullish(),updatedAt:g().nullish()}),jP=b({_meta:T(g(),E()).nullish()}),Jf=g(),WP=b({_meta:T(g(),E()).nullish(),currentModeId:Jf}),GP=b({_meta:T(g(),E()).nullish(),description:g().nullish(),id:Jf,name:g()}),Yf=b({_meta:T(g(),E()).nullish(),availableModes:G(GP),currentModeId:Jf}),Kf=b({_meta:T(g(),E()).nullish(),availableModels:G(Sx),currentModelId:ov}),JP=b({_meta:T(g(),E()).nullish(),configOptions:G(nc).nullish(),models:Kf.nullish(),modes:Yf.nullish(),sessionId:be}),YP=b({_meta:T(g(),E()).nullish(),configOptions:G(nc).nullish(),models:Kf.nullish(),modes:Yf.nullish()}),KP=b({_meta:T(g(),E()).nullish(),configOptions:G(nc).nullish(),models:Kf.nullish(),modes:Yf.nullish(),sessionId:be}),XP=b({_meta:T(g(),E()).nullish(),configOptions:G(nc).nullish(),models:Kf.nullish(),modes:Yf.nullish()}),QP=b({_meta:T(g(),E()).nullish()}),e5=b({_meta:T(g(),E()).nullish(),additionalDirectories:SP.nullish(),close:_P.nullish(),fork:$P.nullish(),list:jP.nullish(),resume:QP.nullish()}),t5=Wf(ae([b({type:D("boolean"),value:lt()}),b({value:av})]),b({_meta:T(g(),E()).nullish(),configId:G6,sessionId:be})),n5=b({_meta:T(g(),E()).nullish(),configOptions:G(nc)}),r5=b({_meta:T(g(),E()).nullish(),modeId:Jf,sessionId:be}),i5=b({_meta:T(g(),E()).nullish()}),s5=b({_meta:T(g(),E()).nullish(),modelId:ov,sessionId:be}),o5=b({_meta:T(g(),E()).nullish()}),a5=b({_meta:T(g(),E()).nullish(),sessionId:be}),l5=ae([D("end_turn"),D("max_tokens"),D("max_turn_requests"),D("refusal"),D("cancelled")]),c5=ae([D("email"),D("uri"),D("date"),D("date-time")]),u5=b({default:g().nullish(),description:g().nullish(),enum:G(g()).nullish(),format:c5.nullish(),maxLength:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:G(N6).nullish(),pattern:g().nullish(),title:g().nullish()}),h5=b({_meta:T(g(),E()).nullish(),context:lP.nullish(),position:xs,selection:tc.nullish(),sessionId:be,triggerKind:Vx,uri:g(),version:ie()}),d5=b({_meta:T(g(),E()).nullish(),suggestions:G(hP)}),f5=b({_meta:T(g(),E()).nullish(),terminalId:g()}),p5=b({_meta:T(g(),E()).nullish(),exitCode:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:g().nullish()}),eS=b({_meta:T(g(),E()).nullish(),sessionId:be,terminalId:g()}),m5=b({_meta:T(g(),E()).nullish(),exitStatus:p5.nullish(),output:g(),truncated:lt()}),g5=b({_meta:T(g(),E()).nullish(),annotations:_h.nullish(),text:g()}),v5=b({range:tc.nullish(),text:g()}),y5=b({_meta:T(g(),E()).nullish(),contentChanges:G(v5),sessionId:be,uri:g(),version:ie()});b({method:g(),params:ae([PP,NP,y5,OP,zP,MP,xP,ZP,H6]).nullish()});const w5=ae([D("full"),D("incremental")]),b5=b({_meta:T(g(),E()).nullish(),syncKind:w5}),S5=b({_meta:T(g(),E()).nullish(),didChange:b5.nullish(),didClose:Ex.nullish(),didFocus:kx.nullish(),didOpen:Tx.nullish(),didSave:Rx.nullish()}),_5=b({_meta:T(g(),E()).nullish(),document:S5.nullish()}),A5=b({_meta:T(g(),E()).nullish(),context:Bx.nullish(),events:_5.nullish()}),E5=b({_meta:T(g(),E()).nullish(),auth:px.optional().default({}),loadSession:lt().optional().default(!1),mcpCapabilities:vx.optional().default({http:!1,sse:!1}),nes:A5.nullish(),positionEncoding:j6.nullish(),promptCapabilities:iP.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:e5.optional().default({})}),k5=b({_meta:T(g(),E()).nullish(),agentCapabilities:E5.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:F6.nullish(),authMethods:G(Z$).optional().default([]),protocolVersion:W6}),T5=b({_meta:T(g(),E()).nullish(),mimeType:g().nullish(),text:g(),uri:g()}),R5=ae([T5,F$]),C5=b({_meta:T(g(),E()).nullish(),annotations:_h.nullish(),resource:R5}),lv=ae([g5.and(b({type:D("text")})),gP.and(b({type:D("image")})),mP.and(b({type:D("audio")})),vP.and(b({type:D("resource_link")})),C5.and(b({type:D("resource")}))]),I5=b({_meta:T(g(),E()).nullish(),content:lv}),Im=b({_meta:T(g(),E()).nullish(),content:lv,messageId:g().nullish()}),$5=b({_meta:T(g(),E()).nullish(),messageId:g().nullish(),prompt:G(lv),sessionId:be}),x5=b({anyOf:G(N6)}),tS=ae([I5.and(b({type:D("content")})),Y$.and(b({type:D("diff")})),f5.and(b({type:D("terminal")}))]),nS=g(),rS=b({_meta:T(g(),E()).nullish(),line:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:g()}),iS=ae([D("pending"),D("in_progress"),D("completed"),D("failed")]),sS=ae([D("read"),D("edit"),D("delete"),D("move"),D("search"),D("execute"),D("think"),D("fetch"),D("switch_mode"),D("other")]),P5=b({_meta:T(g(),E()).nullish(),content:G(tS).optional(),kind:sS.optional(),locations:G(rS).optional(),rawInput:E().optional(),rawOutput:E().optional(),status:iS.optional(),title:g(),toolCallId:nS}),oS=b({_meta:T(g(),E()).nullish(),content:G(tS).nullish(),kind:sS.nullish(),locations:G(rS).nullish(),rawInput:E().optional(),rawOutput:E().optional(),status:iS.nullish(),title:g().nullish(),toolCallId:nS}),aS=b({_meta:T(g(),E()).nullish(),options:G(Jx),sessionId:be,toolCall:oS}),D5=b({_meta:T(g(),E()).nullish(),hint:g()}),L5=D5,O5=b({_meta:T(g(),E()).nullish(),description:g(),input:L5.nullish(),name:g()}),M5=b({_meta:T(g(),E()).nullish(),availableCommands:G(O5)}),N5=b({enum:G(g()),type:ix}),z5=ae([N5,x5]),U5=b({default:G(g()).nullish(),description:g().nullish(),items:z5,maxItems:ie().nullish(),minItems:ie().nullish(),title:g().nullish()}),H5=ae([u5.and(b({type:D("string")})),Wx.and(b({type:D("number")})),ux.and(b({type:D("integer")})),B$.and(b({type:D("boolean")})),U5.and(b({type:D("array")}))]),Z5=b({description:g().nullish(),properties:T(g(),H5).optional().default({}),required:G(g()).nullish(),title:g().nullish(),type:rx.optional().default("object")}),q5=b({requestedSchema:Z5}),V5=Wf(ae([q5.and(b({mode:D("form")})),ax.and(b({mode:D("url")}))]),b({_meta:T(g(),E()).nullish(),message:g(),sessionId:be})),F5=b({cachedReadTokens:ie().nullish(),cachedWriteTokens:ie().nullish(),inputTokens:ie(),outputTokens:ie(),thoughtTokens:ie().nullish(),totalTokens:ie()}),B5=b({_meta:T(g(),E()).nullish(),stopReason:l5,usage:F5.nullish(),userMessageId:g().nullish()});ae([b({id:ra,result:ae([k5,V$,gx,KP,YP,FP,JP,XP,W$,i5,n5,B5,o5,a5,d5,j$,q6])}),b({error:U6,id:ra})]);const j5=b({_meta:T(g(),E()).nullish(),cost:G$.nullish(),size:ie(),used:ie()}),W5=ae([Im.and(b({sessionUpdate:D("user_message_chunk")})),Im.and(b({sessionUpdate:D("agent_message_chunk")})),Im.and(b({sessionUpdate:D("agent_thought_chunk")})),P5.and(b({sessionUpdate:D("tool_call")})),oS.and(b({sessionUpdate:D("tool_call_update")})),Qx.and(b({sessionUpdate:D("plan")})),M5.and(b({sessionUpdate:D("available_commands_update")})),WP.and(b({sessionUpdate:D("current_mode_update")})),IP.and(b({sessionUpdate:D("config_option_update")})),BP.and(b({sessionUpdate:D("session_info_update")})),j5.and(b({sessionUpdate:D("usage_update")}))]),lS=b({_meta:T(g(),E()).nullish(),sessionId:be,update:W5});b({method:g(),params:ae([lS,tx,H6]).nullish()});const cS=b({_meta:T(g(),E()).nullish(),sessionId:be,terminalId:g()}),G5=b({_meta:T(g(),E()).nullish(),exitCode:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:g().nullish()}),J5=b({name:g(),uri:g()}),Y5=b({_meta:T(g(),E()).nullish(),repository:Ux.nullish(),workspaceFolders:G(J5).nullish(),workspaceUri:g().nullish()});b({id:ra,method:g(),params:ae([sP,q$,mx,jx,HP,dx,UP,qP,LP,r5,t5,$5,s5,Y5,h5,DP,Z6]).nullish()});const uS=b({_meta:T(g(),E()).nullish(),content:g(),path:g(),sessionId:be});b({id:ra,method:g(),params:ae([uS,X6,aS,Y6,eS,Q6,cS,K6,V5,Z6]).nullish()});const K5=b({_meta:T(g(),E()).nullish()});ae([b({id:ra,result:ae([K5,dP,bP,J$,m5,fP,G5,hx,nx,q6])}),b({error:U6,id:ra})]);var we;class X5{constructor(t,e){m(this,we);const r=t(this),i=async(a,l)=>{var c,u,f,p,y,v,S;switch(a){case Ur.fs_write_text_file:{const _=uS.parse(l);return(c=r.writeTextFile)==null?void 0:c.call(r,_)}case Ur.fs_read_text_file:{const _=X6.parse(l);return(u=r.readTextFile)==null?void 0:u.call(r,_)}case Ur.session_request_permission:{const _=aS.parse(l);return r.requestPermission(_)}case Ur.terminal_create:{const _=Y6.parse(l);return(f=r.createTerminal)==null?void 0:f.call(r,_)}case Ur.terminal_output:{const _=eS.parse(l);return(p=r.terminalOutput)==null?void 0:p.call(r,_)}case Ur.terminal_release:{const _=Q6.parse(l);return await((y=r.releaseTerminal)==null?void 0:y.call(r,_))??{}}case Ur.terminal_wait_for_exit:{const _=cS.parse(l);return(v=r.waitForTerminalExit)==null?void 0:v.call(r,_)}case Ur.terminal_kill:{const _=K6.parse(l);return await((S=r.killTerminal)==null?void 0:S.call(r,_))??{}}default:if(r.extMethod)return r.extMethod(a,l);throw rt.methodNotFound(a)}},s=async(a,l)=>{switch(a){case Ur.session_update:{const c=lS.parse(l);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(a,l);throw rt.methodNotFound(a)}};d(this,we,new Q5(i,s,e))}async initialize(t){return await o(this,we).sendRequest(De.initialize,t)}async newSession(t){return await o(this,we).sendRequest(De.session_new,t)}async loadSession(t){return await o(this,we).sendRequest(De.session_load,t)??{}}async unstable_forkSession(t){return await o(this,we).sendRequest(De.session_fork,t)}async listSessions(t){return await o(this,we).sendRequest(De.session_list,t)}async unstable_resumeSession(t){return await o(this,we).sendRequest(De.session_resume,t)}async unstable_closeSession(t){return await o(this,we).sendRequest(De.session_close,t)}async setSessionMode(t){return await o(this,we).sendRequest(De.session_set_mode,t)??{}}async unstable_setSessionModel(t){return await o(this,we).sendRequest(De.session_set_model,t)??{}}async setSessionConfigOption(t){return await o(this,we).sendRequest(De.session_set_config_option,t)}async authenticate(t){return await o(this,we).sendRequest(De.authenticate,t)??{}}async unstable_logout(t){return await o(this,we).sendRequest(De.logout,t)??{}}async prompt(t){return await o(this,we).sendRequest(De.session_prompt,t)}async cancel(t){return await o(this,we).sendNotification(De.session_cancel,t)}async unstable_startNes(t){return await o(this,we).sendRequest(De.nes_start,t)}async unstable_suggestNes(t){return await o(this,we).sendRequest(De.nes_suggest,t)}async unstable_closeNes(t){return await o(this,we).sendRequest(De.nes_close,t)??{}}async unstable_didOpenDocument(t){return await o(this,we).sendNotification(De.document_did_open,t)}async unstable_didChangeDocument(t){return await o(this,we).sendNotification(De.document_did_change,t)}async unstable_didCloseDocument(t){return await o(this,we).sendNotification(De.document_did_close,t)}async unstable_didSaveDocument(t){return await o(this,we).sendNotification(De.document_did_save,t)}async unstable_didFocusDocument(t){return await o(this,we).sendNotification(De.document_did_focus,t)}async unstable_acceptNes(t){return await o(this,we).sendNotification(De.nes_accept,t)}async unstable_rejectNes(t){return await o(this,we).sendNotification(De.nes_reject,t)}async extMethod(t,e){return await o(this,we).sendRequest(t,e)}async extNotification(t,e){return await o(this,we).sendNotification(t,e)}get signal(){return o(this,we).signal}get closed(){return o(this,we).closed}}we=new WeakMap;var Wi,Gd,fu,pu,Ba,ja,ar,mu,He,hS,sg,dS,fS,pS,mS,og,xc;class Q5{constructor(t,e,r){m(this,He);m(this,Wi,new Map);m(this,Gd,0);m(this,fu);m(this,pu);m(this,Ba);m(this,ja,Promise.resolve());m(this,ar,new AbortController);m(this,mu);d(this,fu,t),d(this,pu,e),d(this,Ba,r),d(this,mu,new Promise(i=>{o(this,ar).signal.addEventListener("abort",()=>i())})),h(this,He,hS).call(this)}get signal(){return o(this,ar).signal}get closed(){return o(this,mu)}async sendRequest(t,e){h(this,He,og).call(this);const r=Lh(this,Gd)._++,i=new Promise((s,a)=>{o(this,Wi).set(r,{resolve:s,reject:a})});return await h(this,He,xc).call(this,{jsonrpc:"2.0",id:r,method:t,params:e}),i}async sendNotification(t,e){h(this,He,og).call(this),await h(this,He,xc).call(this,{jsonrpc:"2.0",method:t,params:e})}}Wi=new WeakMap,Gd=new WeakMap,fu=new WeakMap,pu=new WeakMap,Ba=new WeakMap,ja=new WeakMap,ar=new WeakMap,mu=new WeakMap,He=new WeakSet,hS=async function(){let t;try{const e=o(this,Ba).readable.getReader();try{for(;!o(this,ar).signal.aborted;){const{value:r,done:i}=await e.read();if(i)break;if(r)try{h(this,He,dS).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&h(this,He,xc).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{e.releaseLock()}}catch(e){t=e}finally{h(this,He,sg).call(this,t)}},sg=function(t){if(o(this,ar).signal.aborted)return;const e=t??new Error("ACP connection closed");for(const r of o(this,Wi).values())r.reject(e);o(this,Wi).clear(),o(this,ar).abort(e)},dS=async function(t){if("method"in t&&"id"in t){const e=await h(this,He,fS).call(this,t.method,t.params);"error"in e&&console.error("Error handling request",t,e.error),await h(this,He,xc).call(this,{jsonrpc:"2.0",id:t.id,...e})}else if("method"in t){const e=await h(this,He,pS).call(this,t.method,t.params);"error"in e&&console.error("Error handling notification",t,e.error)}else"id"in t?h(this,He,mS).call(this,t):console.error("Invalid message",{message:t})},fS=async function(t,e){try{return{result:await o(this,fu).call(this,t,e)??null}}catch(r){if(r instanceof rt)return r.toResult();if(r instanceof N2)return rt.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 rt.internalError(i?JSON.parse(i):{}).toResult()}catch{return rt.internalError({details:i}).toResult()}}},pS=async function(t,e){try{return await o(this,pu).call(this,t,e),{result:null}}catch(r){if(r instanceof rt)return r.toResult();if(r instanceof N2)return rt.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 rt.internalError(i?JSON.parse(i):{}).toResult()}catch{return rt.internalError({details:i}).toResult()}}},mS=function(t){const e=o(this,Wi).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 rt(r,i,s))}o(this,Wi).delete(t.id)}else console.error("Got response to unknown request",t.id)},og=function(){if(o(this,ar).signal.aborted)throw o(this,ar).signal.reason??new Error("ACP connection closed")},xc=async function(t){return d(this,ja,o(this,ja).then(async()=>{const e=o(this,Ba).writable.getWriter();try{await e.write(t)}finally{e.releaseLock()}}).catch(e=>{h(this,He,sg).call(this,e)})),o(this,ja)};class rt 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 rt(-32700,`Parse error${r?`: ${r}`:""}`,e)}static invalidRequest(e,r){return new rt(-32600,`Invalid request${r?`: ${r}`:""}`,e)}static methodNotFound(e){return new rt(-32601,`"Method not found": ${e}`,{method:e})}static invalidParams(e,r){return new rt(-32602,`Invalid params${r?`: ${r}`:""}`,e)}static internalError(e,r){return new rt(-32603,`Internal error${r?`: ${r}`:""}`,e)}static authRequired(e,r){return new rt(-32e3,`Authentication required${r?`: ${r}`:""}`,e)}static resourceNotFound(e){return new rt(-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 eD(n,t,e){const r=n.dispose.bind(n);n.dispose=(()=>{if(!t())return e(),r()})}function gS(n){var e;class t extends n{constructor(...s){super(...s);m(this,e,!1);eD(this,()=>o(this,e),()=>{d(this,e,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return o(this,e)}}return e=new WeakMap,t}const tD=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,nD=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,rD=/\[Television channel context\][\s\S]*?\[\/Television channel context\]\n*/,iD=/\b(tv|television|channel|artifact|artifacts|viewer|filmstrip|layout|focus)\b/i,sD=/^[A-Za-z0-9_@%+=:,./-]+$/,oD=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,aD="single_session",lD={name:"television-acp-client",version:"0.0.0"},vS="agent:main:television",cD=gS(Ri);var Wa,lr,nn,cr,Gi,Nn,Jr,ur,zn,Ji,Un,Ga,Ja,hr,Et,Yr,Ya,go,Kr,Yi,gu,Hn,dr,Jd,fr,O,ag,yS,wS,bS,Qh,SS,_S,AS,ES,kS,TS,RS,Gs,Aa,Ea,Zr,CS,ka,lg,cg,ed,IS,td,ug,hg,vu,yu,nd,Ta,dg,$S;class uD extends cD{constructor(e){super();m(this,O);m(this,Wa,"disconnected");m(this,lr,null);m(this,nn,new Map);m(this,cr,null);m(this,Gi,null);m(this,Nn,null);m(this,Jr,null);m(this,ur,null);m(this,zn,null);m(this,Ji);m(this,Un,null);m(this,Ga,0);m(this,Ja,1);m(this,hr,null);m(this,Et,null);m(this,Yr,!1);m(this,Ya,!1);m(this,go,!1);m(this,Kr,null);m(this,Yi,new Set);m(this,gu);m(this,Hn);m(this,dr);m(this,Jd,e=>{h(this,O,wS).call(this,e)});m(this,fr,null);m(this,vu,()=>{h(this,O,Ta).call(this,"ACP bridge websocket closed")});m(this,yu,()=>{h(this,O,Ta).call(this,"ACP bridge websocket error")});d(this,Hn,e),d(this,dr,e.sessionMode??aD),d(this,Ji,e.mappedSessionStore??hD()),d(this,gu,e.createSocket??(r=>new WebSocket(r)))}get status(){return o(this,Wa)}get messages(){return[...o(this,nn).values()]}get enabled(){return o(this,Hn).enabled??!1}setToken(e){o(this,Hn).token=e??""}setEnabled(e){o(this,Hn).enabled=e,e||(h(this,O,nd).call(this),d(this,lr,null),h(this,O,Zr).call(this,"disconnected"))}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(this.enabled&&this.status==="disconnected"){o(this,Gi)===null&&(d(this,lr,null),d(this,Gi,h(this,O,yS).call(this)));try{await o(this,Gi),await h(this,O,Qh).call(this)}catch(e){throw h(this,O,Ta).call(this,$m(e)),e}}}dispose(){h(this,O,nd).call(this),d(this,lr,null),h(this,O,Zr).call(this,"disposed")}async sendMessage(e){if(await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await h(this,O,ag).call(this,"ready")),(o(this,ur)===null||o(this,Un)!==h(this,O,td).call(this))&&await h(this,O,Qh).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,O,Aa).call(this,{id:h(this,O,ka).call(this,"user"),kind:"user",text:r,status:"final"}),h(this,O,Zr).call(this,"running");try{const i=await h(this,O,ed).call(this).prompt({sessionId:h(this,O,cg).call(this),prompt:[{type:"text",text:h(this,O,CS).call(this,r)}]});h(this,O,Gs).call(this,i.stopReason==="cancelled"?"cancelled":"final"),h(this,O,Zr).call(this,"ready")}catch(i){throw h(this,O,$S).call(this)||(h(this,O,Gs).call(this,"error"),h(this,O,Zr).call(this,"ready")),i}}async startNewSession(){var r;await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await h(this,O,ag).call(this,"ready"));const e=h(this,O,td).call(this);((r=o(this,zn))==null?void 0:r.sessionIdStrategy)==="mapped"?o(this,Ji).clearActualSessionId(e):d(this,Ga,o(this,Ga)+1),d(this,Nn,null),d(this,Jr,null),d(this,ur,null),d(this,Un,null),h(this,O,dg).call(this)}async cancel(){this.status==="running"&&(h(this,O,Zr).call(this,"cancelling"),await h(this,O,ed).call(this).cancel({sessionId:h(this,O,cg).call(this)}))}setChannelContext(e){var s,a,l;if(e===null){if(o(this,Et)===null)return;d(this,Et,null),d(this,Yr,!1);return}const r={channelID:e.channelID,channelName:e.channelName};if(((s=o(this,Et))==null?void 0:s.channelID)===r.channelID&&((a=o(this,Et))==null?void 0:a.channelName)===r.channelName)return;const i=((l=o(this,Et))==null?void 0:l.channelID)??null;if(d(this,Et,r),o(this,dr)==="single_session"){(!o(this,Un)||i!==r.channelID)&&d(this,Yr,!0);return}o(this,Un)!==h(this,O,ug).call(this,r.channelID)&&(d(this,Nn,null),d(this,Jr,null),o(this,cr)&&this.status==="ready"&&h(this,O,Qh).call(this).catch(c=>{h(this,O,Ta).call(this,$m(c))}))}}Wa=new WeakMap,lr=new WeakMap,nn=new WeakMap,cr=new WeakMap,Gi=new WeakMap,Nn=new WeakMap,Jr=new WeakMap,ur=new WeakMap,zn=new WeakMap,Ji=new WeakMap,Un=new WeakMap,Ga=new WeakMap,Ja=new WeakMap,hr=new WeakMap,Et=new WeakMap,Yr=new WeakMap,Ya=new WeakMap,go=new WeakMap,Kr=new WeakMap,Yi=new WeakMap,gu=new WeakMap,Hn=new WeakMap,dr=new WeakMap,Jd=new WeakMap,fr=new WeakMap,O=new WeakSet,ag=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,lr)??"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,lr)??"ACPClient is disconnected")))};this.addEventListener("status-changed",a)})}},yS=async function(){try{const{stream:e,socket:r,metadata:i}=await mD({serverURL:o(this,Hn).serverURL,token:o(this,Hn).token,createSocket:o(this,gu),onDisconnect:o(this,Jd)});d(this,zn,i),d(this,fr,r),r.addEventListener("close",o(this,vu)),r.addEventListener("error",o(this,yu)),d(this,cr,new X5(s=>({connection:s,sessionUpdate:async a=>{await h(this,O,_S).call(this,a)},requestPermission:async a=>h(this,O,AS).call(this,a)}),e)),await o(this,cr).initialize({protocolVersion:O$,clientCapabilities:{},clientInfo:lD})}catch(e){throw e}},wS=function(e){h(this,O,Ta).call(this,$m(e))},bS=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})`)},Qh=async function(){const e=h(this,O,td).call(this);if(o(this,Nn)&&o(this,Jr)===e){await o(this,Nn);return}d(this,Jr,e),d(this,Nn,h(this,O,SS).call(this,e)),await o(this,Nn)},SS=async function(e){var c;const r=h(this,O,ed).call(this);h(this,O,dg).call(this);let i,s=!1,a=null;const l={cwd:h(this,O,IS).call(this),mcpServers:[],_meta:{sessionKey:e}};try{if(d(this,go,!0),d(this,Kr,null),((c=o(this,zn))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=o(this,Ji).getActualSessionId(e);if(u)try{const f=await r.loadSession({...l,sessionId:u});if(dD(f))throw new Error("Mapped ACP session was not found");a=f,i=u,s=!0}catch{const f=await r.newSession(l);a=f,i=f.sessionId,o(this,Ji).setActualSessionId(e,i),s=!1}else{const f=await r.newSession(l);a=f,i=f.sessionId,o(this,Ji).setActualSessionId(e,i),s=!1}}else try{a=await r.loadSession({...l,sessionId:e}),i=e,s=o(this,nn).size>0}catch{const u=await r.newSession(l);a=u,i=u.sessionId,s=!1}}finally{d(this,go,!1),d(this,Kr,null),h(this,O,Gs).call(this,"final")}h(this,O,bS).call(this,a),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),d(this,ur,i),d(this,Un,e),d(this,Ya,!0),s?(o(this,Yi).add(e),o(this,dr)==="single_session"&&d(this,Yr,!1)):(o(this,Yi).delete(e),d(this,Yr,o(this,dr)==="single_session")),d(this,lr,null),h(this,O,Zr).call(this,"ready")},_S=async function(e){const r=e.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&h(this,O,RS).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&h(this,O,ES).call(this,r.content.text);return;case"tool_call":h(this,O,kS).call(this,r);return;case"tool_call_update":h(this,O,TS).call(this,r);return;case"agent_thought_chunk":return;default:return}},AS=async function(e){return{outcome:{outcome:"cancelled"}}},ES=function(e){d(this,Kr,null);const r=pD(e);if(!r)return;if(!o(this,hr)){const s={id:h(this,O,ka).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};d(this,hr,s.id),h(this,O,Aa).call(this,s);return}const i=o(this,nn).get(o(this,hr));if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");h(this,O,Ea).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},kS=function(e){h(this,O,Gs).call(this,"final");const r=h(this,O,lg).call(this,e.toolCallId),i=J2("content"in e?e.content:void 0),s={id:(r==null?void 0:r.id)??h(this,O,ka).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,O,Ea).call(this,s);return}h(this,O,Aa).call(this,s)},TS=function(e){const r=h(this,O,lg).call(this,e.toolCallId),i=(r==null?void 0:r.text)??"",s=J2(e.content),a=s?`${i}${s}`:i,l={id:(r==null?void 0:r.id)??h(this,O,ka).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,O,Ea).call(this,l);return}h(this,O,Aa).call(this,l)},RS=function(e){if(h(this,O,Gs).call(this,"final"),!e)return;const r=o(this,go)?o(this,Kr):null;if(!r){const s=G2(e);if(!s)return;const a={id:h(this,O,ka).call(this,"user"),kind:"user",text:s,status:"final"};h(this,O,Aa).call(this,a),o(this,go)&&d(this,Kr,a.id);return}const i=o(this,nn).get(r);if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");h(this,O,Ea).call(this,{...i,text:G2(`${i.text}${e}`)})},Gs=function(e){if(!o(this,hr))return;const r=o(this,nn).get(o(this,hr));(r==null?void 0:r.kind)==="assistant"&&h(this,O,Ea).call(this,{...r,status:e}),d(this,hr,null)},Aa=function(e){o(this,nn).set(e.id,e),this.dispatchEvent(new Tm("messages-changed"))},Ea=function(e){o(this,nn).set(e.id,e),this.dispatchEvent(new Tm("messages-changed"))},Zr=function(e){o(this,Wa)!==e&&(d(this,Wa,e),this.dispatchEvent(new vT("status-changed")))},CS=function(e){var u;const r=o(this,Un);if(!r)return e;const i=o(this,Et)?o(this,dr)==="single_session"?o(this,Yr)||!o(this,Yi).has(r):!o(this,Yi).has(r):!1,s=o(this,Ya)&&(o(this,Et)!==null||iD.test(e));if(!(s||i))return e;s&&d(this,Ya,!1),i&&(d(this,Yr,!1),o(this,Yi).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>`."],c=((u=o(this,zn))==null?void 0:u.tvArgs)??[];return c.length>0&&l.push(`To reach this Television server, add these arguments to each tv command that contacts it: ${c.map(yD).join(" ")}`),o(this,Et)?(l.push("This conversation is currently attached to the channel below."),l.push(`channel_id: ${o(this,Et).channelID}`),l.push(`channel_name: ${o(this,Et).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(`
65
+ `)},ka=function(e){const r=`${e}-${o(this,Ja)}`;return d(this,Ja,o(this,Ja)+1),r},lg=function(e){for(const r of o(this,nn).values())if((r==null?void 0:r.kind)==="tool_call"&&r.toolCallId===e)return r;return null},cg=function(){if(!o(this,ur))throw new Error("ACP session is not ready");return o(this,ur)},ed=function(){if(!o(this,cr))throw new Error("ACP connection is not ready");return o(this,cr)},IS=function(){var r;const e=(r=o(this,zn))==null?void 0:r.sessionCwd;if(!e)throw new Error("ACP bridge session cwd is not ready");return e},td=function(){var r;if(o(this,dr)==="single_session")return h(this,O,hg).call(this,`${vS}-${(o(this,Hn).clientGUID??"default-client").toLowerCase()}`);const e=(r=o(this,Et))==null?void 0:r.channelID;if(!e)throw new Error("Channel context is required for per-channel session mode");return h(this,O,ug).call(this,e)},ug=function(e){return h(this,O,hg).call(this,fD(o(this,dr),e,o(this,Hn).clientGUID??"default-client"))},hg=function(e){var r;return((r=o(this,zn))==null?void 0:r.sessionIdStrategy)==="deterministic"&&o(this,Ga)>0?`${e}:epoch-${o(this,Ga)}`:e},vu=new WeakMap,yu=new WeakMap,nd=function(){d(this,cr,null),d(this,Gi,null),d(this,Nn,null),d(this,Jr,null),d(this,ur,null),d(this,Un,null),d(this,zn,null),o(this,fr)&&(o(this,fr).removeEventListener("close",o(this,vu)),o(this,fr).removeEventListener("error",o(this,yu)),o(this,fr).close(),d(this,fr,null))},Ta=function(e){const r=o(this,cr)!==null||o(this,Gi)!==null||o(this,Nn)!==null||o(this,Jr)!==null||o(this,ur)!==null||o(this,Un)!==null||o(this,zn)!==null||o(this,fr)!==null;this.disposed||this.status==="disconnected"&&!r||(h(this,O,Gs).call(this,"error"),h(this,O,nd).call(this),d(this,lr,e??null),h(this,O,Zr).call(this,"disconnected"))},dg=function(){const e=o(this,nn).size>0;d(this,hr,null),d(this,Kr,null),d(this,Ja,1),o(this,nn).clear(),e&&this.dispatchEvent(new Tm("messages-changed"))},$S=function(){return this.status==="disconnected"};function hD(){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 dD(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function fD(n,t,e){return n==="single_session"?`${vS}-${e.toLowerCase()}`:`agent:main:television-${e.toLowerCase()}-${t.toLowerCase()}`}function xS(n){return n.replace(/^(?:\s*\n)+/,"")}function G2(n){let t=n;return t=t.replace(tD,""),t=t.replace(nD,""),t=t.replace(rD,""),t=xS(t),t}function pD(n){let t=n;return t=t.replace(oD,""),t=xS(t),t}function J2(n){return!n||n.length===0?"":n.flatMap(t=>t.type==="content"&&t.content.type==="text"?[t.content.text]:[]).join("")}async function mD(n){const t=n.createSocket(bD(n.serverURL,n.token));let e=!1,r,i;const s=new Promise((u,f)=>{r=u,i=f}),a=new ReadableStream({start(u){let f=!1;const p=()=>{t.send(JSON.stringify({type:"acp-bridge-connect"}))},y=_=>{const $=wD(_);if(!$)return;let H;try{H=JSON.parse($)}catch(L){const z=L instanceof Error?L:new Error(String(L));i(z),u.error(z);return}switch(H.type){case"acp-bridge-status":if(H.status==="ready"){let L;try{L=gD(H)}catch(z){const P=z instanceof Error?z:new Error(String(z));e||i(P),u.error(P);return}e||(e=!0,r(L));return}if(H.status==="error"||H.status==="exited"){const L=new Error(H.error??`ACP bridge ${H.status}`);e||i(L),u.error(L)}return;case"acp-bridge-message":u.enqueue(H.message);return}},v=()=>{var $;if(f)return;f=!0;const _=new Error("ACP bridge websocket closed");e||i(_),($=n.onDisconnect)==null||$.call(n,_),u.close()},S=()=>{var $;if(f)return;f=!0;const _=new Error("ACP bridge websocket error");e||i(_),($=n.onDisconnect)==null||$.call(n,_),u.error(_)};t.addEventListener("open",p),t.addEventListener("message",y),t.addEventListener("close",v),t.addEventListener("error",S)}}),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 gD(n){const{agent:t,sessionIdStrategy:e,sessionCwd:r,tvArgs:i}=n;if((t==="openclaw"||t==="hermes")&&(e==="deterministic"||e==="mapped")&&typeof r=="string"&&r.length>0&&vD(i))return{agent:t,sessionIdStrategy:e,sessionCwd:r,tvArgs:i};throw new Error("ACP bridge ready status missing bootstrap metadata")}function vD(n){return Array.isArray(n)&&n.every(t=>typeof t=="string")}function yD(n){return sD.test(n)?n:`'${n.replace(/'/g,"'\\''")}'`}function wD(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 bD(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 $m(n){return n instanceof Error?n.message:String(n)}const Y2="television.acpClientGUID",K2="television.acpMappedSessions",X2=1;var Ka;class SD{constructor(){m(this,Ka,new Map)}getActualSessionId(t){return o(this,Ka).get(t)??null}setActualSessionId(t,e){o(this,Ka).set(t,e)}clearActualSessionId(t){o(this,Ka).delete(t)}}Ka=new WeakMap;var Xa,wu,cn,rd,id,fg;class _D{constructor(t,e){m(this,cn);m(this,Xa);m(this,wu);d(this,Xa,t),d(this,wu,e)}getActualSessionId(t){const e=h(this,cn,id).call(this)[h(this,cn,rd).call(this,t)];return typeof e=="string"&&e.length>0?e:null}setActualSessionId(t,e){const r=h(this,cn,id).call(this);r[h(this,cn,rd).call(this,t)]=e,h(this,cn,fg).call(this,r)}clearActualSessionId(t){const e=h(this,cn,id).call(this);delete e[h(this,cn,rd).call(this,t)],h(this,cn,fg).call(this,e)}}Xa=new WeakMap,wu=new WeakMap,cn=new WeakSet,rd=function(t){return JSON.stringify([o(this,wu),t])},id=function(){const t=o(this,Xa).getItem(K2);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!==X2?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},fg=function(t){const e={version:X2,entries:t};o(this,Xa).setItem(K2,JSON.stringify(e))};function PS(){return typeof window>"u"?null:window.localStorage}function AD(n){const t=n.getItem(Y2);if(t)return t;const e=X1().toLowerCase();return n.setItem(Y2,e),e}const Q2=4401,ED=401,Zh=1e3,kD=3e4;class sd extends Error{constructor(t="Authentication required"){super(t),this.name="AuthError"}}class TD extends Ri{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,"failedReconnectAttempts",0);C(this,"browserDemoMode",!1);C(this,"hasAuthRejected",!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",Zh);C(this,"visibilityEventTarget");C(this,"networkEventTarget");C(this,"onVisibilityChange");C(this,"onNetworkOnline");C(this,"telemetryActivityAgent");this.url=Cs(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,f)=>new Fk(c,{token:u??void 0,onUnauthorized:()=>this.handleAuthRejected(),...f?{telemetryMeta:f}:{}})),this.client=this.createClient(this.url,this._token,this.telemetryMeta);const r=e.mappedSessionStore??(e.acpStorage?new _D(e.acpStorage,this.url):new SD);this.acpClient=new uD({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?P$({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.acpClient.setToken(e),this.cancelRetryTimer(),this.retryDelay=Zh,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=Ld(e,this.renderOptions());return wi()?new URL(r.viewURL,this.url).toString():r.renderer==="proxy-iframe"?new URL(r.viewURL,this.url).toString():r.viewURL}async readDemoMode(){try{return await this.client.demoMode()}catch{return null}}renderOptions(){return{electron:wi(),browserDemo:this.browserDemoMode}}getContentURL(e){const r=Ld(e,this.renderOptions()).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 Ic("channels-changed"));break;case"channel-updated":this.channels.set(e.channel.id,structuredClone(e.channel)),this.dispatchEvent(new Ic("channels-changed"));break;case"channel-removed":this.channels.delete(e.channelID),this.dispatchEvent(new Ic("channels-changed"));break;case"artifact-created":{const r=this.channels.get(e.channelID);r&&!ck(r).includes(e.artifact.id)&&(r.layout=[...r.layout,{artifactIds:[e.artifact.id],geometry:{...P8},size:{...D8}}]);break}case"artifact-removed":{const r=this.channels.get(e.channelID);r&&(r.layout=Fm(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 RD(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 jt("change"));const r=this.createSocket(CD(this.url,this._token,this.telemetryMeta));return this.socket=r,await new Promise((s,a)=>{let l=!1,c=!1;const u=()=>{var y;l||this.connectAttempt!==e||(l=!0,c=!0,this.retryDelay=Zh,this.hasEverConnected=!0,this.failedReconnectAttempts=0,this.setStatus("connected"),(y=this.telemetryActivityAgent)==null||y.start(),s())},f=y=>{l||this.connectAttempt!==e||(l=!0,a(y))},p=async()=>{const y=this.hasEverConnected;try{const[{channels:v},S,_]=await Promise.all([this.client.channels.list(),this.client.display.get(),y?null:this.readDemoMode()]);y||(this.browserDemoMode=(_==null?void 0:_.browserExternalPages)===!0),this.channels=new Map(v.map($=>[$.id,structuredClone($)])),this.acpClient.setEnabled(S.acpEnabled),this.dispatchEvent(new jt("change")),y&&this.dispatchEvent(new Ic("channels-changed")),this.dispatchEvent(new Kh("server-event",{serverURL:this.url,event:{type:"channel-changed",channelID:S.focusedChannelId}})),this.dispatchEvent(new Kh("server-event",{serverURL:this.url,event:{type:"pinned-channels-changed",pinnedChannelIds:[...S.pinnedChannelIds]}})),u(),y&&this.connectAttempt===e&&this.dispatchEvent(new J8("server-reconnected",{serverURL:this.url}))}catch(v){if(LD(v)){f(new sd);return}f(v instanceof Error?v:new Error(String(v)))}};r.addEventListener("open",()=>{this.decideBoot===null&&(this.bootState="booted",this.navigationPending()||p())}),r.addEventListener("message",y=>{const v=DD(y);if(!v)return;if(v.type==="server-status"){const _=v;this.serverVersion=_.version,this.updateState=_.update??null;let $=!1;this.decideBoot!==null&&this.bootState==="pending"&&this.connectAttempt===e&&(this.decideBoot(_)==="boot"?(this.bootState="booted",$=!0):(this.bootState="halted",this.attempting=!1)),this.dispatchEvent(new Y8("server-status",{serverURL:this.url,message:_})),$?this.navigationPending()||p():this.bootState==="halted"&&!this.navigationPending()&&this.dispatchEvent(new jt("change"));return}if(!PD(v.type))return;const S=v;this.applyServerEvent(S),this.dispatchEvent(new Kh("server-event",{serverURL:this.url,event:S}))}),r.addEventListener("close",y=>{if(this.connectAttempt!==e)return;this.socket=null;const v=ID(y);if(!l){f(v===Q2?new sd:new Error("Connection closed before initialization"));return}if(c){if(v===Q2){this.handleAuthRejected();return}this.handleTransportFailure(new Error("Connection closed"))}}),r.addEventListener("error",()=>{if(this.connectAttempt===e){if(l){if(!c)return;this.handleTransportFailure(new Error("WebSocket error"));return}f(new Error("WebSocket connection failed"))}})}).then(()=>{this.attempting=!1},s=>{throw this.attempting=!1,this.handleAttemptFailure(s),s})}handleAuthRejected(){this.hasAuthRejected=!0,this.autoReconnect=!1,this.cancelRetryTimer(),this.setStatus("unauthorized")}handleAttemptFailure(e){if(e instanceof sd){this.handleAuthRejected();return}this.autoReconnect&&(this.hasEverConnected&&(this.failedReconnectAttempts+=1),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,kD),this.nextRetryAt=Date.now()+e,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.attempt().catch(()=>{})},e),this.dispatchEvent(new jt("change"))}cancelRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.nextRetryAt!==null&&(this.nextRetryAt=null,this.dispatchEvent(new jt("change")))}kickReconnect(){this.autoReconnect&&this.status!=="connected"&&(this.attempting||(this.cancelRetryTimer(),this.retryDelay=Zh,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:lk,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 jt("change")))}isPageVisible(){return this.visibilityEventTarget===null?!0:this.visibilityEventTarget.visibilityState==="visible"}}function RD(n,t){throw new Error(`Unexpected ${t}: ${JSON.stringify(n)}`)}function CD(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 x$(e))r.searchParams.set(i,s);return r.hash="",r.toString()}function ID(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}const $D={"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},xD=new Set(Object.keys($D));function PD(n){return xD.has(n)}function DD(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 LD(n){return n instanceof Ql&&n.status===ED}const OD="Local";var pr,Zn,Ai,DS,pg,LS,bu,Su,_u,Au,Eu;class MD extends Ri{constructor(e){super();m(this,Ai);C(this,"connection");C(this,"clientGUID");C(this,"acpStorage");C(this,"connectError",null);m(this,pr);m(this,Zn,!1);m(this,bu,()=>{o(this,Zn)||(h(this,Ai,LS).call(this),this.dispatchEvent(new jt("change")))});m(this,Su,e=>{o(this,Zn)||this.dispatchEvent(new Kh("server-event",{serverURL:e.serverURL,event:e.event}))});m(this,_u,()=>{o(this,Zn)||this.dispatchEvent(new Ic("channels-changed"))});m(this,Au,e=>{o(this,Zn)||this.dispatchEvent(new J8("server-reconnected",{serverURL:e.serverURL}))});m(this,Eu,e=>{o(this,Zn)||this.dispatchEvent(new Y8("server-status",{serverURL:e.serverURL,message:e.message}))});d(this,pr,e.localStore),this.acpStorage=e.acpStorage===void 0?PS():e.acpStorage,this.clientGUID=e.clientGUID??(this.acpStorage?AD(this.acpStorage):X1().toLowerCase());const r=Cs(e.serverURL);e.launchToken!==void 0&&e.launchToken!==null&&o(this,pr).set(ST(o(this,pr).get(),r,e.launchToken));const i=e.launchToken??b2(o(this,pr).get(),r),s=e.createSocket??(l=>new WebSocket(l)),a=e.createConnection??(l=>new TD(l));this.connection=a({url:r,name:e.connectionName??OD,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,bu)),this.connection.addEventListener("server-event",o(this,Su)),this.connection.addEventListener("channels-changed",o(this,_u)),this.connection.addEventListener("server-reconnected",o(this,Au)),this.connection.addEventListener("server-status",o(this,Eu))}get storedAuthToken(){return b2(o(this,pr).get(),this.connection.url)}async connect(){await h(this,Ai,DS).call(this,this.connection.token)}dispose(){o(this,Zn)||(d(this,Zn,!0),this.connection.removeEventListener("change",o(this,bu)),this.connection.removeEventListener("server-event",o(this,Su)),this.connection.removeEventListener("channels-changed",o(this,_u)),this.connection.removeEventListener("server-reconnected",o(this,Au)),this.connection.removeEventListener("server-status",o(this,Eu)),this.connection.dispose())}}pr=new WeakMap,Zn=new WeakMap,Ai=new WeakSet,DS=async function(e){if(!o(this,Zn)){h(this,Ai,pg).call(this,null);try{await this.connection.connect(e)}catch(r){h(this,Ai,pg).call(this,r instanceof sd?null:r instanceof Error?r.message:String(r))}}},pg=function(e){this.connectError!==e&&(this.connectError=e,this.dispatchEvent(new jt("change")))},LS=function(){if(this.connection.status!=="unauthorized"||!this.connection.hasAuthRejected)return;const e=o(this,pr).get(),r=_T(e,this.connection.url);r!==e&&o(this,pr).set(r),this.connection.token!==null&&this.connection.clearToken()},bu=new WeakMap,Su=new WeakMap,_u=new WeakMap,Au=new WeakMap,Eu=new WeakMap;const mg="tv-nav:",Fl="tv-reload",eb=100,ND=1e3,zD=60,UD=60,HD=24,ZD=30,qD=ZD*HD*UD*zD*ND;function bi(n){try{const t=new URL(n,window.location.href),e=t.searchParams.has(Fl);return t.searchParams.delete(Fl),t.origin===window.location.origin?`${t.pathname}${t.search}${t.hash}`:e?t.toString():n}catch{return n}}var ku,Qa,$e,Re,vo,Ke,OS,Ni,MS,gg,vg;class VD extends Ri{constructor(e,r){super();m(this,Ke);m(this,ku);m(this,Qa);m(this,$e,[]);m(this,Re,-1);m(this,vo,0);d(this,ku,e),d(this,Qa,bi(r)),h(this,Ke,OS).call(this)}get currentURL(){var e;return o(this,Re)===-1?null:((e=o(this,$e)[o(this,Re)])==null?void 0:e.url)??null}get canGoBack(){return o(this,Re)>-1}get canGoForward(){return o(this,Re)<o(this,$e).length-1}get entries(){return o(this,$e).map(e=>({...e}))}get cursor(){return o(this,Re)}navigate(e){const r=bi(e);if(r===o(this,Qa)){if(o(this,Re)===-1)return;d(this,Re,-1),h(this,Ke,Ni).call(this);return}o(this,Re)<o(this,$e).length-1&&d(this,$e,o(this,$e).slice(0,o(this,Re)+1)),o(this,$e).push({url:r}),d(this,Re,o(this,$e).length-1),h(this,Ke,gg).call(this),h(this,Ke,Ni).call(this)}replace(e){var i;if(o(this,Re)===-1){this.navigate(e);return}const r=bi(e);if(r===o(this,Qa)){d(this,$e,o(this,$e).filter((s,a)=>a!==o(this,Re))),d(this,Re,-1),h(this,Ke,Ni).call(this);return}((i=o(this,$e)[o(this,Re)])==null?void 0:i.url)!==r&&(d(this,$e,o(this,$e).map((s,a)=>a===o(this,Re)?{url:r}:s)),h(this,Ke,Ni).call(this))}back(){o(this,Re)!==-1&&(d(this,Re,o(this,Re)-1),h(this,Ke,Ni).call(this))}forward(){this.canGoForward&&(d(this,Re,o(this,Re)+1),h(this,Ke,Ni).call(this))}reset(){o(this,Re)===-1&&o(this,$e).length===0||(d(this,$e,[]),d(this,Re,-1),h(this,Ke,Ni).call(this))}}ku=new WeakMap,Qa=new WeakMap,$e=new WeakMap,Re=new WeakMap,vo=new WeakMap,Ke=new WeakSet,OS=function(){const e=localStorage.getItem(o(this,Ke,vg));if(e!==null)try{const r=JSON.parse(e);if(!NS(r))return;d(this,$e,r.entries.map(i=>({url:i.url}))),d(this,Re,r.cursor),d(this,vo,r.lastWritten),h(this,Ke,gg).call(this)}catch{d(this,$e,[]),d(this,Re,-1),d(this,vo,0)}},Ni=function(){d(this,vo,Date.now());try{localStorage.setItem(o(this,Ke,vg),JSON.stringify(h(this,Ke,MS).call(this)))}catch(e){if(!jD(e))throw e}this.dispatchEvent(new jt("change"))},MS=function(){return{v:1,entries:o(this,$e).map(e=>({...e})),cursor:o(this,Re),lastWritten:o(this,vo)}},gg=function(){if(o(this,$e).length<=eb)return;const e=o(this,$e).length-eb;d(this,$e,o(this,$e).slice(e)),d(this,Re,Math.max(-1,o(this,Re)-e))},vg=function(){return FD(o(this,ku))};function FD(n){return`${mg}${n}`}function BD(n){const t=Date.now()-qD,e=[];for(let r=0;r<localStorage.length;r+=1){const i=localStorage.key(r);if(!(i!=null&&i.startsWith(mg)))continue;const s=i.slice(mg.length),a=localStorage.getItem(i);if(a===null)continue;let l;try{l=JSON.parse(a)}catch{e.push(i);continue}if(!NS(l)){e.push(i);continue}!n.has(s)&&l.lastWritten<t&&e.push(i)}for(const r of e)localStorage.removeItem(r)}function jD(n){return n instanceof DOMException&&n.name==="QuotaExceededError"}function NS(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 xm="tv-channel-sidebar-collapsed";var yo;class WD{constructor(t){m(this,yo);d(this,yo,t)}read(){return o(this,yo).getItem(xm)==="true"}setCollapsed(t){try{t?o(this,yo).setItem(xm,"true"):o(this,yo).removeItem(xm)}catch{}}}yo=new WeakMap;const Pm="tv-channel-sidebar-width",yg=160,wg=350,qh=260,GD=/^-?\d+$/;var wo;class JD{constructor(t){m(this,wo);d(this,wo,t)}read(){const t=o(this,wo).getItem(Pm);if(t===null||!GD.test(t))return null;const e=BigInt(t);return e<BigInt(yg)?yg:e>BigInt(wg)?wg:Number(e)}commit(t){const e=zS(Math.round(t));try{o(this,wo).setItem(Pm,String(e))}catch{}return e}clear(){try{o(this,wo).removeItem(Pm)}catch{}}}wo=new WeakMap;function zS(n){return Math.min(Math.max(n,yg),wg)}const YD="1.4.28";function cv(n=YD){return n!==void 0&&n.length>0?n:"0.0.0"}function uv(){let n=!1;return{get pending(){return n},begin(t){n||(n=!0,t())}}}const bg="tv-reload-attempted";function KD(n){return n.originMatch?n.marker!==null&&n.bundleVersion===n.serverVersion?{action:"signal-autoreloaded",fromVersion:n.marker.fromVersion,toVersion:n.bundleVersion}:Wk(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 XD(n){const t=n.getItem(bg);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 QD(n){const t=n.storage!==void 0?n.storage:typeof sessionStorage<"u"?sessionStorage:null,e=n.reload??(()=>location.reload()),r=n.navigationLatch??uv(),i=n.bundleVersion??cv();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 f=s;s=null,u.sendTelemetrySignal("client_autoreloaded",{from_version:f.fromVersion,to_version:f.toVersion})},l=u=>{if(r.pending)return;const f=KD({bundleVersion:i,serverVersion:u.message.version,originMatch:u.serverURL===n.primaryServerURL,marker:XD(t)});switch(f.action){case"reload":t.setItem(bg,JSON.stringify(f.marker)),r.begin(e);return;case"signal-autoreloaded":t.removeItem(bg),s={fromVersion:f.fromVersion,toVersion:f.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 eL(n){const t=wi(n.search),e=L6(n.search),r=e!==null&&qf(e)?e:null;return{electron:t,shellVersion:r}}function tL(n){return!n.electron||n.requiredDesktopVersion===null||!qf(n.requiredDesktopVersion)?!1:n.shellVersion===null?!0:n.shellVersion===Cd?!1:K1(n.requiredDesktopVersion,n.shellVersion)}const nL=`# Desktop app update required
66
+
67
+ This version of the Television desktop app does not work with this server and needs to be updated. The new version has already downloaded and installs when you restart the app.`,rL=`# Desktop app update required
68
+
69
+ This version of the Television desktop app does not work with this server and needs to be updated. [Download the latest version for Mac](https://dl.todesktop.com/260923p52umxx/mac/dmg/arm64) and install it.`;function US(n,t=!1){return t?nL:n===null?rL:n.upgradeMarkdown}function iL(n){const t=tL(n);return{gated:t,instructionsMarkdown:t?US(n.desktop):null,suppressUpdateToast:t}}function sL(n){const t=n.reload??(()=>location.reload()),e=n.navigationLatch??uv();let r=null,i=!1;const s=new Set,a=f=>{var p;return iL({electron:n.detection.electron,shellVersion:n.detection.shellVersion,requiredDesktopVersion:f.requiredDesktopVersion,desktop:((p=f.update)==null?void 0:p.desktop)??null})};function l(){var f;(f=n.presentation)==null||f.suppressToasts()}function c(f){const p=f.requiredDesktopVersion;if(p===null||s.has(p))return;s.add(p);const y=r==null?void 0:r.connection;(y==null?void 0:y.url)===n.primaryServerURL&&y.sendTelemetrySignal("desktop_upgrade_gate_shown",{...n.detection.shellVersion===null?{}:{desktop_app_version:n.detection.shellVersion},required_desktop_version:p})}const u=f=>{e.pending||f.serverURL===n.primaryServerURL&&(a(f.message).gated?(i=!0,l(),c(f.message)):i&&e.begin(t))};return{get gated(){return i},decideBoot(f){return a(f).gated?"halt":"boot"},attach(f){r=f,f.addEventListener("server-status",u)},dispose(){r==null||r.removeEventListener("server-status",u),r=null}}}var el;class oL extends Ri{constructor(){super(...arguments);m(this,el,!1)}get toastsSuppressed(){return o(this,el)}suppressToasts(){o(this,el)||(d(this,el,!0),this.dispatchEvent(new jt("change")))}}el=new WeakMap;const aL=`### Desktop app update ready
70
+
71
+ Television updates its desktop app automatically. Version {version} has downloaded and installs when you restart the app.`,lL="tv-desktop-self-update-dismissed";function cL(n){return aL.replace("{version}",n)}var Tu,tl,Ru,bo,nl;class uL extends Ri{constructor({electron:e,bridge:r}){super();m(this,Tu);m(this,tl);m(this,Ru,!1);m(this,bo,null);m(this,nl,!1);d(this,Tu,e),d(this,tl,r??null)}get version(){return o(this,bo)}get restarting(){return o(this,nl)}subscribe(){if(o(this,Ru))return;d(this,Ru,!0);const e=o(this,tl);!o(this,Tu)||typeof(e==null?void 0:e.onDesktopUpdateDownloaded)!="function"||e.onDesktopUpdateDownloaded(r=>{typeof r!="string"||r.length===0||r===o(this,bo)||(d(this,bo,r),this.dispatchEvent(new jt("change")))})}restart(){var e,r;o(this,bo)===null||o(this,nl)||(d(this,nl,!0),(r=(e=o(this,tl))==null?void 0:e.restartToInstallUpdate)==null||r.call(e),this.dispatchEvent(new jt("change")))}}Tu=new WeakMap,tl=new WeakMap,Ru=new WeakMap,bo=new WeakMap,nl=new WeakMap;function hL(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 HS(n){return typeof n=="object"&&n!==null}function ZS(n){return!HS(n)||n.type!=="ready"?!1:!("id"in n)}function qS(n){return!(!HS(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}const VS=$n(),FS="No handler registered for update-content",BS="handleUpdateContent: handler already registered",tb="television-artifact-bridge";function jS(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const WS=gS(Ri);var rl,il,sl,So,_o,ol,it,Sg,GS,JS,Ra,od,u8;let dL=(u8=class extends WS{constructor(e){super();m(this,it);m(this,rl);m(this,il);m(this,sl);m(this,So,null);m(this,_o,null);m(this,ol,!1);d(this,rl,e);const r=e.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");d(this,il,r),d(this,sl,i=>h(this,it,GS).call(this,i)),o(this,il).addEventListener("message",o(this,sl))}get content(){return o(this,_o)}set content(e){h(this,it,od).call(this),d(this,_o,e),o(this,ol)&&h(this,it,Sg).call(this,e)}handleUpdateContent(e){if(h(this,it,od).call(this),o(this,So)!==null)throw new Error(BS);d(this,So,e)}notifyStylesChanged(){if(h(this,it,od).call(this),!o(this,ol))return;const e={type:"styles-changed"};h(this,it,Ra).call(this,e)}dispose(){o(this,il).removeEventListener("message",o(this,sl)),d(this,So,null)}},rl=new WeakMap,il=new WeakMap,sl=new WeakMap,So=new WeakMap,_o=new WeakMap,ol=new WeakMap,it=new WeakSet,Sg=function(e){const r={type:"content-updated",content:e};h(this,it,Ra).call(this,r)},GS=function(e){if(this.disposed||e.source!==o(this,rl).contentWindow)return;const r=e.data;if(ZS(r)){d(this,ol,!0),this.dispatchEvent(new VS("ready")),o(this,_o)!==null&&h(this,it,Sg).call(this,o(this,_o));return}if(qS(r)){h(this,it,JS).call(this,r);return}},JS=async function(e){const r=o(this,So);if(r===null){h(this,it,Ra).call(this,{type:"response",id:e.id,error:{message:FS}});return}try{await r(e.content)}catch(i){if(this.disposed)return;h(this,it,Ra).call(this,{type:"response",id:e.id,error:{message:jS(i)}});return}this.disposed||h(this,it,Ra).call(this,{type:"response",id:e.id,result:{}})},Ra=function(e){const r=o(this,rl).contentWindow;r&&r.postMessage(e,"*")},od=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},u8);var Ao,al,Eo,ko,ll,st,_g,YS,KS,Ca,ad;class fL extends WS{constructor(e){super();m(this,st);m(this,Ao);m(this,al);m(this,Eo,null);m(this,ko,null);m(this,ll,!1);d(this,Ao,e),d(this,al,r=>h(this,st,YS).call(this,r)),o(this,Ao).addEventListener("ipc-message",o(this,al))}get content(){return o(this,ko)}set content(e){h(this,st,ad).call(this),d(this,ko,e),o(this,ll)&&h(this,st,_g).call(this,e)}handleUpdateContent(e){if(h(this,st,ad).call(this),o(this,Eo)!==null)throw new Error(BS);d(this,Eo,e)}notifyStylesChanged(){if(h(this,st,ad).call(this),!o(this,ll))return;const e={type:"styles-changed"};h(this,st,Ca).call(this,e)}dispose(){o(this,Ao).removeEventListener("ipc-message",o(this,al)),d(this,Eo,null)}}Ao=new WeakMap,al=new WeakMap,Eo=new WeakMap,ko=new WeakMap,ll=new WeakMap,st=new WeakSet,_g=function(e){const r={type:"content-updated",content:e};h(this,st,Ca).call(this,r)},YS=function(e){var s;if(this.disposed)return;const r=e.detail??e;if(!r||r.channel!==tb)return;const i=(s=r.args)==null?void 0:s[0];if(ZS(i)){d(this,ll,!0),this.dispatchEvent(new VS("ready")),o(this,ko)!==null&&h(this,st,_g).call(this,o(this,ko));return}if(qS(i)){h(this,st,KS).call(this,i);return}},KS=async function(e){const r=o(this,Eo);if(r===null){h(this,st,Ca).call(this,{type:"response",id:e.id,error:{message:FS}});return}try{await r(e.content)}catch(i){if(this.disposed)return;h(this,st,Ca).call(this,{type:"response",id:e.id,error:{message:jS(i)}});return}this.disposed||h(this,st,Ca).call(this,{type:"response",id:e.id,result:{}})},Ca=function(e){var r,i;(i=(r=o(this,Ao)).send)==null||i.call(r,tb,e)},ad=function(){if(this.disposed)throw new Error("WebviewArtifactViewRuntime is disposed")};/**
72
+ * @license
73
+ * Copyright 2017 Google LLC
74
+ * SPDX-License-Identifier: BSD-3-Clause
75
+ */const Jc=globalThis,nb=n=>n,Od=Jc.trustedTypes,rb=Od?Od.createPolicy("lit-html",{createHTML:n=>n}):void 0,XS="$lit$",qi=`lit$${Math.random().toFixed(9).slice(2)}$`,QS="?"+qi,pL=`<${QS}>`,ia=document,nu=()=>ia.createComment(""),ru=n=>n===null||typeof n!="object"&&typeof n!="function",hv=Array.isArray,mL=n=>hv(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",Dm=`[
76
+ \f\r]`,vc=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ib=/-->/g,sb=/>/g,Bs=RegExp(`>|${Dm}(?:([^\\s"'>=/]+)(${Dm}*=${Dm}*(?:[^
77
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),ob=/'/g,ab=/"/g,e_=/^(?:script|style|textarea|title)$/i,gL=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),W=gL(1),$t=Symbol.for("lit-noChange"),de=Symbol.for("lit-nothing"),lb=new WeakMap,io=ia.createTreeWalker(ia,129);function t_(n,t){if(!hv(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return rb!==void 0?rb.createHTML(t):t}const vL=(n,t)=>{const e=n.length-1,r=[];let i,s=t===2?"<svg>":t===3?"<math>":"",a=vc;for(let l=0;l<e;l++){const c=n[l];let u,f,p=-1,y=0;for(;y<c.length&&(a.lastIndex=y,f=a.exec(c),f!==null);)y=a.lastIndex,a===vc?f[1]==="!--"?a=ib:f[1]!==void 0?a=sb:f[2]!==void 0?(e_.test(f[2])&&(i=RegExp("</"+f[2],"g")),a=Bs):f[3]!==void 0&&(a=Bs):a===Bs?f[0]===">"?(a=i??vc,p=-1):f[1]===void 0?p=-2:(p=a.lastIndex-f[2].length,u=f[1],a=f[3]===void 0?Bs:f[3]==='"'?ab:ob):a===ab||a===ob?a=Bs:a===ib||a===sb?a=vc:(a=Bs,i=void 0);const v=a===Bs&&n[l+1].startsWith("/>")?" ":"";s+=a===vc?c+pL:p>=0?(r.push(u),c.slice(0,p)+XS+c.slice(p)+qi+v):c+qi+(p===-2?l:v)}return[t_(n,s+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};class iu{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let s=0,a=0;const l=t.length-1,c=this.parts,[u,f]=vL(t,e);if(this.el=iu.createElement(u,r),io.currentNode=this.el.content,e===2||e===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=io.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(XS)){const y=f[a++],v=i.getAttribute(p).split(qi),S=/([.?@])?(.*)/.exec(y);c.push({type:1,index:s,name:S[2],strings:v,ctor:S[1]==="."?wL:S[1]==="?"?bL:S[1]==="@"?SL:Qf}),i.removeAttribute(p)}else p.startsWith(qi)&&(c.push({type:6,index:s}),i.removeAttribute(p));if(e_.test(i.tagName)){const p=i.textContent.split(qi),y=p.length-1;if(y>0){i.textContent=Od?Od.emptyScript:"";for(let v=0;v<y;v++)i.append(p[v],nu()),io.nextNode(),c.push({type:2,index:++s});i.append(p[y],nu())}}}else if(i.nodeType===8)if(i.data===QS)c.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(qi,p+1))!==-1;)c.push({type:7,index:s}),p+=qi.length-1}s++}}static createElement(t,e){const r=ia.createElement("template");return r.innerHTML=t,r}}function Bl(n,t,e=n,r){var a,l;if(t===$t)return t;let i=r!==void 0?(a=e._$Co)==null?void 0:a[r]:e._$Cl;const s=ru(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=Bl(n,i._$AS(n,t.values),i,r)),t}class yL{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)??ia).importNode(e,!0);io.currentNode=i;let s=io.nextNode(),a=0,l=0,c=r[0];for(;c!==void 0;){if(a===c.index){let u;c.type===2?u=new Xf(s,s.nextSibling,this,t):c.type===1?u=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(u=new _L(s,this,t)),this._$AV.push(u),c=r[++l]}a!==(c==null?void 0:c.index)&&(s=io.nextNode(),a++)}return io.currentNode=ia,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 Xf=class n_{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=de,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=Bl(this,t,e),ru(t)?t===de||t==null||t===""?(this._$AH!==de&&this._$AR(),this._$AH=de):t!==this._$AH&&t!==$t&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):mL(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!==de&&ru(this._$AH)?this._$AA.nextSibling.data=t:this.T(ia.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=iu.createElement(t_(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 yL(i,this),l=a.u(this.options);a.p(e),this.T(l),this._$AH=a}}_$AC(t){let e=lb.get(t.strings);return e===void 0&&lb.set(t.strings,e=new iu(t)),e}k(t){hv(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 n_(this.O(nu()),this.O(nu()),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=nb(t).nextSibling;nb(t).remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},Qf=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,s){this.type=1,this._$AH=de,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=de}_$AI(t,e=this,r,i){const s=this.strings;let a=!1;if(s===void 0)t=Bl(this,t,e,0),a=!ru(t)||t!==this._$AH&&t!==$t,a&&(this._$AH=t);else{const l=t;let c,u;for(t=s[0],c=0;c<s.length-1;c++)u=Bl(this,l[r+c],e,c),u===$t&&(u=this._$AH[c]),a||(a=!ru(u)||u!==this._$AH[c]),u===de?t=de:t!==de&&(t+=(u??"")+s[c+1]),this._$AH[c]=u}a&&!i&&this.j(t)}j(t){t===de?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},wL=class extends Qf{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===de?void 0:t}},bL=class extends Qf{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==de)}},SL=class extends Qf{constructor(t,e,r,i,s){super(t,e,r,i,s),this.type=5}_$AI(t,e=this){if((t=Bl(this,t,e,0)??de)===$t)return;const r=this._$AH,i=t===de&&r!==de||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==de&&(r===de||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 _L{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){Bl(this,t)}}const AL={I:Xf},Lm=Jc.litHtmlPolyfillSupport;Lm==null||Lm(iu,Xf),(Jc.litHtmlVersions??(Jc.litHtmlVersions=[])).push("3.3.2");const Ag=(n,t,e)=>{const r=t;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new Xf(t.insertBefore(nu(),null),null,void 0,{})),i._$AI(n),i};/**
78
+ * @license
79
+ * Copyright 2020 Google LLC
80
+ * SPDX-License-Identifier: BSD-3-Clause
81
+ */const{I:EL}=AL,cb=n=>n,r_=n=>n.strings===void 0,ub=()=>document.createComment(""),yc=(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(ub(),i),l=r.insertBefore(ub(),i);e=new EL(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 f=cb(u).nextSibling;cb(r).insertBefore(u,i),u=f}}}return e},js=(n,t,e=n)=>(n._$AI(t,e),n),kL={},i_=(n,t=kL)=>n._$AH=t,TL=n=>n._$AH,Om=n=>{n._$AR(),n._$AA.remove()};/**
82
+ * @license
83
+ * Copyright 2017 Google LLC
84
+ * SPDX-License-Identifier: BSD-3-Clause
85
+ */const Ir={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4},rc=n=>(...t)=>({_$litDirective$:n,values:t});let Ah=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)}};/**
86
+ * @license
87
+ * Copyright 2017 Google LLC
88
+ * SPDX-License-Identifier: BSD-3-Clause
89
+ */const Yc=(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),Yc(i,t);return!0},Md=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)},s_=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),IL(t)}};function RL(n){this._$AN!==void 0?(Md(this),this._$AM=n,s_(this)):this._$AM=n}function CL(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++)Yc(r[s],!1),Md(r[s]);else r!=null&&(Yc(r,!1),Md(r));else Yc(this,n)}const IL=n=>{n.type==Ir.CHILD&&(n._$AP??(n._$AP=CL),n._$AQ??(n._$AQ=RL))};class o_ extends Ah{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),s_(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&&(Yc(this,t),Md(this))}setValue(t){if(r_(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 Cu,Iu,Ki,To;class hn extends o_{constructor(){super(...arguments);m(this,Cu,[]);m(this,Iu,!1);m(this,Ki,!1);m(this,To,!1)}connected(){}template(...e){return $t}render(...e){return!this.isConnected||o(this,Ki)||this.setValue(e.length?e[0]:this.template(...o(this,Cu))),$t}update(e,r){d(this,Cu,r),d(this,To,!1),d(this,Ki,!0);try{return o(this,Iu)||(d(this,Iu,!0),this.connected()),this.template(...r)}finally{d(this,Ki,!1)}}reconnected(){d(this,Ki,!0);try{this.connected()}finally{d(this,Ki,!1)}d(this,To,!0),queueMicrotask(()=>{o(this,To)&&(d(this,To,!1),this.render())})}}Cu=new WeakMap,Iu=new WeakMap,Ki=new WeakMap,To=new WeakMap;function dn(n){return rc(n)}const $L=3;function xL(n,t){var r;const e=n.connection;return e.gateHalted?{kind:"needs-upgrade",instructions:e.upgradeInstructions}:e.authorizationRequired?{kind:"unauthorized"}:e.status!=="connected"?e.failedReconnectAttempts>=$L||!e.hasEverConnected&&e.firstConnectError!==null?{kind:"error",serverURL:t,nextRetryAt:e.nextRetryAt}:e.hasEverConnected?{kind:"disconnected",nextRetryAt:e.nextRetryAt}:{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"}}const PL='<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>',DL='<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>',LL='<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>',OL='<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>',ML='<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>',NL='<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>',zL='<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>',UL='<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>',HL='<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>',ZL='<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>',qL='<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>',VL='<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>',FL='<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>',BL='<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>',jL='<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>',WL='<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>',GL='<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>',JL='<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>',YL='<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>',KL='<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>',XL='<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>',QL='<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>',eO='<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>',tO='<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>',nO='<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>',rO='<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>',iO='<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>',sO='<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>',oO='<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>',aO='<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>',lO='<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>',cO='<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>',uO='<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>',hO='<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>',dO='<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>',fO='<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>',pO='<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>',mO='<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>',gO='<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>',vO='<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>',yO='<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>',wO='<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>',bO='<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>',SO='<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>',_O='<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>',AO='<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>',EO='<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>',kO='<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>',TO='<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>',RO='<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>',CO='<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>',IO='<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>',$O='<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>',xO='<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>',PO='<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>',DO='<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>',LO='<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>',OO='<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>',MO='<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>',NO='<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>',zO='<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>',UO='<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>',HO='<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>',ZO='<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>',qO='<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>',VO='<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>',FO='<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>',BO='<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>',jO='<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>',WO='<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>',GO='<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>',JO='<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>',YO='<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>',KO='<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>',XO='<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>',QO='<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>',eM='<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>',tM='<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>',nM='<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,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z"/></svg>',rM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M235.58,128.84,160,91.06V48a32,32,0,0,0-64,0V91.06L20.42,128.84A8,8,0,0,0,16,136v32a8,8,0,0,0,9.57,7.84L96,161.76v18.93L82.34,194.34A8,8,0,0,0,80,200v32a8,8,0,0,0,11,7.43l37-14.81,37,14.81A8,8,0,0,0,176,232V200a8,8,0,0,0-2.34-5.66L160,180.69V161.76l70.43,14.08A8,8,0,0,0,240,168V136A8,8,0,0,0,235.58,128.84ZM224,158.24l-70.43-14.08A8,8,0,0,0,144,152v32a8,8,0,0,0,2.34,5.66L160,203.31v16.87l-29-11.61a8,8,0,0,0-5.94,0L96,220.18V203.31l13.66-13.65A8,8,0,0,0,112,184V152a8,8,0,0,0-9.57-7.84L32,158.24v-17.3l75.58-37.78A8,8,0,0,0,112,96V48a16,16,0,0,1,32,0V96a8,8,0,0,0,4.42,7.16L224,140.94Z"/></svg>',iM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,104H229.2L201.42,41.5A16,16,0,0,0,186.8,32H69.2a16,16,0,0,0-14.62,9.5L26.8,104H16a8,8,0,0,0,0,16h8v80a16,16,0,0,0,16,16H64a16,16,0,0,0,16-16V184h96v16a16,16,0,0,0,16,16h24a16,16,0,0,0,16-16V120h8a8,8,0,0,0,0-16ZM69.2,48H186.8l24.89,56H44.31ZM64,200H40V184H64Zm128,0V184h24v16Zm24-32H40V120H216ZM56,144a8,8,0,0,1,8-8H80a8,8,0,0,1,0,16H64A8,8,0,0,1,56,144Zm112,0a8,8,0,0,1,8-8h16a8,8,0,0,1,0,16H176A8,8,0,0,1,168,144Z"/></svg>',sM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M184,32H72A32,32,0,0,0,40,64V208a16,16,0,0,0,16,16H80a16,16,0,0,0,16-16V192h64v16a16,16,0,0,0,16,16h24a16,16,0,0,0,16-16V64A32,32,0,0,0,184,32ZM56,176V120H200v56Zm0-96H200v24H56ZM72,48H184a16,16,0,0,1,16,16H56A16,16,0,0,1,72,48Zm8,160H56V192H80Zm96,0V192h24v16Zm-72-60a12,12,0,1,1-12-12A12,12,0,0,1,104,148Zm72,0a12,12,0,1,1-12-12A12,12,0,0,1,176,148Zm72-68v24a8,8,0,0,1-16,0V80a8,8,0,0,1,16,0ZM24,80v24a8,8,0,0,1-16,0V80a8,8,0,0,1,16,0Z"/></svg>',oM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,72H32V48a8,8,0,0,0-16,0V208a8,8,0,0,0,16,0V176H240v32a8,8,0,0,0,16,0V112A40,40,0,0,0,216,72ZM32,88h72v72H32Zm88,72V88h96a24,24,0,0,1,24,24v48Z"/></svg>',aM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M72,88V40a8,8,0,0,1,16,0V88a8,8,0,0,1-16,0ZM216,40V224a8,8,0,0,1-16,0V176H152a8,8,0,0,1-8-8,268.75,268.75,0,0,1,7.22-56.88c9.78-40.49,28.32-67.63,53.63-78.47A8,8,0,0,1,216,40ZM200,53.9c-32.17,24.57-38.47,84.42-39.7,106.1H200ZM119.89,38.69a8,8,0,1,0-15.78,2.63L112,88.63a32,32,0,0,1-64,0l7.88-47.31a8,8,0,1,0-15.78-2.63l-8,48A8.17,8.17,0,0,0,32,88a48.07,48.07,0,0,0,40,47.32V224a8,8,0,0,0,16,0V135.32A48.07,48.07,0,0,0,128,88a8.17,8.17,0,0,0-.11-1.31Z"/></svg>',lM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M232,112a24,24,0,0,0-24-24H136V79a32.06,32.06,0,0,0,24-31c0-28-26.44-45.91-27.56-46.66a8,8,0,0,0-8.88,0C122.44,2.09,96,20,96,48a32.06,32.06,0,0,0,24,31v9H48a24,24,0,0,0-24,24v23.33a40.84,40.84,0,0,0,8,24.24V200a24,24,0,0,0,24,24H200a24,24,0,0,0,24-24V159.57a40.84,40.84,0,0,0,8-24.24ZM112,48c0-13.57,10-24.46,16-29.79,6,5.33,16,16.22,16,29.79a16,16,0,0,1-32,0ZM40,112a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8v23.33c0,13.25-10.46,24.31-23.32,24.66A24,24,0,0,1,168,136a8,8,0,0,0-16,0,24,24,0,0,1-48,0,8,8,0,0,0-16,0,24,24,0,0,1-24.68,24C50.46,159.64,40,148.58,40,135.33Zm160,96H56a8,8,0,0,1-8-8V172.56A38.77,38.77,0,0,0,62.88,176a39.69,39.69,0,0,0,29-11.31A40.36,40.36,0,0,0,96,160a40,40,0,0,0,64,0,40.36,40.36,0,0,0,4.13,4.67A39.67,39.67,0,0,0,192,176c.38,0,.76,0,1.14,0A38.77,38.77,0,0,0,208,172.56V200A8,8,0,0,1,200,208Z"/></svg>',cM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M255.31,188.75l-64-144A8,8,0,0,0,184,40H72a8,8,0,0,0-7.27,4.69.21.21,0,0,0,0,.06l0,.12,0,0L.69,188.75A8,8,0,0,0,8,200H248a8,8,0,0,0,7.31-11.25ZM64,184H20.31L64,85.7Zm16,0V85.7L123.69,184Zm61.2,0L84.31,56H178.8l56.89,128Z"/></svg>',uM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"/></svg>',hM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,56H176V48a24,24,0,0,0-24-24H104A24,24,0,0,0,80,48v8H40A16,16,0,0,0,24,72V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V72A16,16,0,0,0,216,56ZM96,48a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm64,24V200H96V72ZM40,72H80V200H40ZM216,200H176V72h40V200Z"/></svg>',dM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216.57,39.43A80,80,0,0,0,83.91,120.78L28.69,176A15.86,15.86,0,0,0,24,187.31V216a16,16,0,0,0,16,16H72a8,8,0,0,0,8-8V208H96a8,8,0,0,0,8-8V184h16a8,8,0,0,0,5.66-2.34l9.56-9.57A79.73,79.73,0,0,0,160,176h.1A80,80,0,0,0,216.57,39.43ZM224,98.1c-1.09,34.09-29.75,61.86-63.89,61.9H160a63.7,63.7,0,0,1-23.65-4.51,8,8,0,0,0-8.84,1.68L116.69,168H96a8,8,0,0,0-8,8v16H72a8,8,0,0,0-8,8v16H40V187.31l58.83-58.82a8,8,0,0,0,1.68-8.84A63.72,63.72,0,0,1,96,95.92c0-34.14,27.81-62.8,61.9-63.89A64,64,0,0,1,224,98.1ZM192,76a12,12,0,1,1-12-12A12,12,0,0,1,192,76Z"/></svg>',fM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"/></svg>',pM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"/></svg>',mM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24a104,104,0,0,0,0,208c21.51,0,44.1-6.48,60.43-17.33a8,8,0,0,0-8.86-13.33C166,210.38,146.21,216,128,216a88,88,0,1,1,88-88c0,26.45-10.88,32-20,32s-20-5.55-20-32V88a8,8,0,0,0-16,0v4.26a48,48,0,1,0,5.93,65.1c6,12,16.35,18.64,30.07,18.64,22.54,0,36-17.94,36-48A104.11,104.11,0,0,0,128,24Zm0,136a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z"/></svg>',gM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,56H176V48a24,24,0,0,0-24-24H104A24,24,0,0,0,80,48v8H40A16,16,0,0,0,24,72V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V72A16,16,0,0,0,216,56ZM96,48a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96ZM216,72v41.61A184,184,0,0,1,128,136a184.07,184.07,0,0,1-88-22.38V72Zm0,128H40V131.64A200.19,200.19,0,0,0,128,152a200.25,200.25,0,0,0,88-20.37V200ZM104,112a8,8,0,0,1,8-8h32a8,8,0,0,1,0,16H112A8,8,0,0,1,104,112Z"/></svg>',vM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,112a47.81,47.81,0,0,0-16.93,3.09L165.93,72H192a8,8,0,0,1,8,8,8,8,0,0,0,16,0,24,24,0,0,0-24-24H152a8,8,0,0,0-6.91,12l11.65,20H99.26L82.91,60A8,8,0,0,0,76,56H48a8,8,0,0,0,0,16H71.41L85.12,95.51,69.41,117.06a48.13,48.13,0,1,0,12.92,9.44l11.59-15.9L125.09,164A8,8,0,1,0,138.91,156l-30.32-52h57.48l11.19,19.17A48,48,0,1,0,208,112ZM80,160a32,32,0,1,1-20.21-29.74l-18.25,25a8,8,0,1,0,12.92,9.42l18.25-25A31.88,31.88,0,0,1,80,160Zm128,32a32,32,0,0,1-22.51-54.72L201.09,164A8,8,0,1,0,214.91,156L199.3,129.21A32,32,0,1,1,208,192Z"/></svg>',yM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M184,24H72A32,32,0,0,0,40,56V184a32,32,0,0,0,32,32h8L65.6,235.2a8,8,0,1,0,12.8,9.6L100,216h56l21.6,28.8a8,8,0,1,0,12.8-9.6L176,216h8a32,32,0,0,0,32-32V56A32,32,0,0,0,184,24ZM56,120V80h64v40Zm80-40h64v40H136ZM72,40H184a16,16,0,0,1,16,16v8H56V56A16,16,0,0,1,72,40ZM184,200H72a16,16,0,0,1-16-16V136H200v48A16,16,0,0,1,184,200ZM96,172a12,12,0,1,1-12-12A12,12,0,0,1,96,172Zm88,0a12,12,0,1,1-12-12A12,12,0,0,1,184,172Z"/></svg>',wM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,72H180.92c.39-.33.79-.65,1.17-1A29.53,29.53,0,0,0,192,49.57,32.62,32.62,0,0,0,158.44,16,29.53,29.53,0,0,0,137,25.91a54.94,54.94,0,0,0-9,14.48,54.94,54.94,0,0,0-9-14.48A29.53,29.53,0,0,0,97.56,16,32.62,32.62,0,0,0,64,49.57,29.53,29.53,0,0,0,73.91,71c.38.33.78.65,1.17,1H40A16,16,0,0,0,24,88v32a16,16,0,0,0,16,16v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V136a16,16,0,0,0,16-16V88A16,16,0,0,0,216,72ZM149,36.51a13.69,13.69,0,0,1,10-4.5h.49A16.62,16.62,0,0,1,176,49.08a13.69,13.69,0,0,1-4.5,10c-9.49,8.4-25.24,11.36-35,12.4C137.7,60.89,141,45.5,149,36.51Zm-64.09.36A16.63,16.63,0,0,1,96.59,32h.49a13.69,13.69,0,0,1,10,4.5c8.39,9.48,11.35,25.2,12.39,34.92-9.72-1-25.44-4-34.92-12.39a13.69,13.69,0,0,1-4.5-10A16.6,16.6,0,0,1,84.87,36.87ZM40,88h80v32H40Zm16,48h64v64H56Zm144,64H136V136h64Zm16-80H136V88h80v32Z"/></svg>',bM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z"/></svg>',SM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H80a8,8,0,0,0,6.66-3.56L100.28,48h55.43l13.63,20.44A8,8,0,0,0,176,72h32a8,8,0,0,1,8,8ZM128,88a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,88Zm0,72a28,28,0,1,1,28-28A28,28,0,0,1,128,160Z"/></svg>',_M='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,16V152h-28.7A15.86,15.86,0,0,0,168,156.69L148.69,176H107.31L88,156.69A15.86,15.86,0,0,0,76.69,152H48V48Zm0,160H48V168H76.69L96,187.31A15.86,15.86,0,0,0,107.31,192h41.38A15.86,15.86,0,0,0,160,187.31L179.31,168H208v40Z"/></svg>',AM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M200,75.64V40a16,16,0,0,0-16-16H72A16,16,0,0,0,56,40V76a16.07,16.07,0,0,0,6.4,12.8L114.67,128,62.4,167.2A16.07,16.07,0,0,0,56,180v36a16,16,0,0,0,16,16H184a16,16,0,0,0,16-16V180.36a16.09,16.09,0,0,0-6.35-12.77L141.27,128l52.38-39.6A16.05,16.05,0,0,0,200,75.64ZM184,216H72V180l56-42,56,42.35Zm0-140.36L128,118,72,76V40H184Z"/></svg>',EM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M214.67,72H200V40a8,8,0,0,0-8-8H64a8,8,0,0,0-8,8V72H41.33C27.36,72,16,82.77,16,96v80a8,8,0,0,0,8,8H56v32a8,8,0,0,0,8,8H192a8,8,0,0,0,8-8V184h32a8,8,0,0,0,8-8V96C240,82.77,228.64,72,214.67,72ZM72,48H184V72H72ZM184,208H72V160H184Zm40-40H200V152a8,8,0,0,0-8-8H64a8,8,0,0,0-8,8v16H32V96c0-4.41,4.19-8,9.33-8H214.67c5.14,0,9.33,3.59,9.33,8Zm-24-52a12,12,0,1,1-12-12A12,12,0,0,1,200,116Z"/></svg>',kM=':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}}',a_=new CSSStyleSheet;a_.replaceSync(kM);const l_={check:PL,close:DL,copy:LL,pin:OL,search:ML,add:NL,more:zL,settings:UL,expand:HL,collapse:ZL,"collapse-up":qL,select:VL,skills:FL,notification:BL,artifact:jL,spinner:WL,locked:GL,unpin:JL,back:YL,forward:KL,television:XL,calendar:QL,grid:eO,hash:tO,delete:nO,edit:rO,link:iO,external:sO,download:oO,reload:aO,warning:lO,info:cO,file:uO,folder:hO,clock:dO,user:fO,upload:pO,star:mO,home:gO,send:vO,filter:yO,sort:wO,help:bO,chart:SO,image:_O,chat:AO,location:EO,play:kO,pause:TO,stop:RO,video:CO,music:IO,error:$O,email:xO,phone:PO,web:DO,tag:LO,bookmark:OO,table:MO,code:NO,group:zO,up:UO,down:HO,money:ZO,bank:qO,card:VO,wallet:FO,gauge:BO,activity:jO,"trend-up":WO,"trend-down":GO,database:JO,server:YO,deploy:KO,list:XO,terminal:QO,branch:eM,shield:tM,sidebar:nM,plane:rM,car:iM,bus:sM,bed:oM,food:aM,cake:lM,tent:cM,microphone:uM,luggage:hM,key:dM,sun:fM,moon:pM,at:mM,briefcase:gM,bicycle:vM,train:yM,gift:wM,book:bM,camera:SM,inbox:_M,hourglass:AM,printer:EM};function TM(n){return n!==null&&Object.hasOwn(l_,n)}var $u,Eg;class c_ extends HTMLElement{constructor(){super(...arguments);m(this,$u)}connectedCallback(){h(this,$u,Eg).call(this)}attributeChangedCallback(){this.isConnected&&h(this,$u,Eg).call(this)}}$u=new WeakSet,Eg=function(){const e=this.shadowRoot??this.attachShadow({mode:"open"});e.adoptedStyleSheets=[a_],this.replaceChildren();const r=this.getAttribute("name");e.innerHTML=TM(r)?l_[r]:""},C(c_,"observedAttributes",["name"]);customElements.get("tv-icon")||customElements.define("tv-icon",c_);function ep(n,t=null){return W`<div class="dialog-overlay"><dialog open>${t}<div class="dialog-content">${n}</div></dialog></div>`}function tp(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())}}}function su(n){n==null||n.focus({preventScroll:!0}),n==null||n.scrollIntoView({block:"nearest"})}function u_(n,t){if(n.key!=="ArrowDown"&&n.key!=="ArrowUp"||t.length===0)return!1;const e=t.indexOf(t[0].ownerDocument.activeElement),r=n.key==="ArrowDown",i=e<0?r?0:t.length-1:Math.max(0,Math.min(t.length-1,e+(r?1:-1)));return n.preventDefault(),n.stopImmediatePropagation(),su(t[i]),!0}const kg=new WeakMap;function Ia(n,t,e){e===null?n.hasAttribute(t)&&n.removeAttribute(t):n.getAttribute(t)!==e&&n.setAttribute(t,e)}var Xr,xu,Pu,cl,Xi,Ps,Tg,Yd,Kd,Xd,Qd,ef,Rg;class RM{constructor(t){m(this,Ps);C(this,"document");C(this,"panels",new Set);m(this,Xr,new Map);m(this,xu,new WeakMap);m(this,Pu,new AbortController);m(this,cl);m(this,Xi,0);m(this,Yd,t=>{if(!(t.target instanceof Element))return;const e=t.target;o(this,xu).set(t,{inside:new Set([...this.panels].filter(r=>{var i;return this.contains(r,e)||((i=r.trigger)==null?void 0:i.contains(e))})),open:[...this.panels].filter(r=>r.open)})});m(this,Kd,t=>{var s,a,l;if(!(t.target instanceof Element))return;const e=t.target,r=o(this,xu).get(t),i=[...this.panels].find(c=>{var u;return(u=c.trigger)==null?void 0:u.contains(e)});for(const c of(r==null?void 0:r.open)??[])c.open&&!c.manual&&c!==i&&!(r!=null&&r.inside.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,Xd,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,Qd,t=>{var s,a,l,c;const e=h(this,Ps,Tg).call(this),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"&&r){h(this,Ps,Rg).call(this,t,e,r);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}});m(this,ef,t=>{if(t.key!=="Escape"||t.defaultPrevented)return;const e=h(this,Ps,Tg).call(this);h(this,Ps,Rg).call(this,t,e)});this.document=t;const e={signal:o(this,Pu).signal};t.addEventListener("click",o(this,Yd),{...e,capture:!0}),t.addEventListener("click",o(this,Kd),e),t.addEventListener("keydown",o(this,Qd),{...e,capture:!0}),t.addEventListener("keydown",o(this,ef),e),t.addEventListener("pointermove",o(this,Xd),e),d(this,cl,new MutationObserver(()=>{for(const r of[...this.panels])r.refresh()})),o(this,cl).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,Xi))return;const t=()=>{d(this,Xi,0);for(const e of this.panels)e.open&&e.place();[...this.panels].some(e=>e.open)&&d(this,Xi,this.document.defaultView.requestAnimationFrame(t))};d(this,Xi,this.document.defaultView.requestAnimationFrame(t))}remove(t){this.closed(t),this.panels.delete(t),!this.panels.size&&(o(this,Pu).abort(),o(this,cl).disconnect(),this.document.defaultView.cancelAnimationFrame(o(this,Xi)),kg.delete(this.document))}prepareOpen(t){let e=null;for(const r of this.panels)r===t||!r.open||!t.trigger||!r.host.contains(t.trigger)||(e===null||e.host.contains(r.host))&&(e=r);if(o(this,Xr).set(t,e),!(t.manual||t.behavior.select))for(const r of this.panels)r.open&&r!==t&&!r.manual&&!r.behavior.select&&!this.isDescendant(t,r)&&r.close()}isDescendant(t,e){for(let r=o(this,Xr).get(t);r;r=o(this,Xr).get(r))if(r===e)return!0;return!1}contains(t,e){return e?t.host.contains(e)||[...this.panels].some(r=>this.isDescendant(r,t)&&r.host.contains(e)):!1}closeDescendants(t){for(const e of[...this.panels])this.isDescendant(e,t)&&e.close(!1)}closed(t){o(this,Xr).delete(t)}}Xr=new WeakMap,xu=new WeakMap,Pu=new WeakMap,cl=new WeakMap,Xi=new WeakMap,Ps=new WeakSet,Tg=function(){const t=e=>{let r=0;for(let i=o(this,Xr).get(e);i;i=o(this,Xr).get(i))r++;return r};return[...this.panels].filter(e=>e.open).reverse().sort((e,r)=>t(r)-t(e))},Yd=new WeakMap,Kd=new WeakMap,Xd=new WeakMap,Qd=new WeakMap,ef=new WeakMap,Rg=function(t,e,r){if(!r&&e.some(s=>s.manual&&t.composedPath().includes(s.host)))return;const i=r??e.find(s=>!s.manual);i&&!i.manual&&(t.preventDefault(),t.stopImmediatePropagation(),i.close())};var je,Qi,Ro,ul,es,ts,Pt,Cg,h_,Ig,Du,d_,$g;class dv{constructor(t,e={}){m(this,Pt);C(this,"host");C(this,"behavior");C(this,"trigger",null);m(this,je);m(this,Qi,!1);m(this,Ro,!1);m(this,ul,!0);m(this,es,new Map);m(this,ts,new Set);m(this,Du,t=>{const e=t.target;e instanceof HTMLElement&&e!==this.host&&this.host.contains(e)&&o(this,ts).add(e)});this.host=t,this.behavior=e}get open(){return this.host.hasAttribute("open")&&o(this,Qi)}get manual(){return this.host.hasAttribute("manual")}connect(){if(o(this,je))return;const t=this.host.ownerDocument;d(this,je,kg.get(t)),o(this,je)||(d(this,je,new RM(t)),kg.set(t,o(this,je))),o(this,je).panels.add(this),this.refresh()}disconnect(){var e,r,i,s;if(!o(this,je))return;const t=o(this,je).contains(this,this.host.ownerDocument.activeElement);d(this,Qi,!1),o(this,je).closeDescendants(this),o(this,je).closed(this),this.host.removeAttribute("open"),(r=(e=this.behavior).closed)==null||r.call(e),h(this,Pt,Ig).call(this),h(this,Pt,$g).call(this),t&&((i=this.trigger)!=null&&i.isConnected)&&this.trigger.focus({preventScroll:!0}),h(this,Pt,Cg).call(this),(s=o(this,je))==null||s.remove(this),d(this,je,void 0)}refresh(){var r,i,s,a,l,c,u;if(!o(this,je))return;const t=this.host.ownerDocument.getElementById(this.host.getAttribute("trigger")??""),e=t instanceof HTMLButtonElement?t:null;if(e!==this.trigger&&(h(this,Pt,Cg).call(this),this.trigger=e),this.trigger&&Ia(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,Qi))if(this.host.hasAttribute("open"))o(this,je).prepareOpen(this),d(this,Qi,!0),h(this,Pt,h_).call(this),h(this,Pt,d_).call(this),this.place(),(a=(s=this.behavior).opened)==null||a.call(s,o(this,Ro)),d(this,Ro,!1),o(this,je).animate();else{const f=o(this,je).contains(this,this.host.ownerDocument.activeElement);d(this,Qi,!1),o(this,je).closeDescendants(this),o(this,je).closed(this),(c=(l=this.behavior).closed)==null||c.call(l),h(this,Pt,Ig).call(this),h(this,Pt,$g).call(this),f&&o(this,ul)&&((u=this.trigger)!=null&&u.isConnected)&&this.trigger.focus({preventScroll:!0})}}toggle(t=!1){d(this,Ro,t),this.host.toggleAttribute("open")}show(t=!1){d(this,Ro,t),this.host.setAttribute("open","")}close(t=!0){d(this,ul,t),this.host.removeAttribute("open"),this.refresh(),d(this,ul,!0)}place(){var Ne,xe,et;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,l=[];for(const le of o(this,ts)){if(!le.isConnected||!t.contains(le)){o(this,ts).delete(le);continue}l.push({element:le,scrollTop:le.scrollTop,scrollLeft:le.scrollLeft})}t.style.maxWidth="none";const c=o(this,es).get("max-height");c!=null&&c.value?t.style.setProperty("max-height",c.value,c.priority):t.style.removeProperty("max-height");const u=e.getComputedStyle(t).maxHeight;t.style.minWidth=this.behavior.select?`${Math.min(r.width,e.innerWidth-2*i)}px`:((Ne=o(this,es).get("min-width"))==null?void 0:Ne.value)??"";const f=t.getBoundingClientRect(),p=Math.max(0,e.innerWidth-i-r.left),y=Math.max(0,r.right-i),v=f.width>p&&y>p,S=Math.min(e.innerWidth-2*i,v?y:p),_=Number.parseFloat(e.getComputedStyle(t).minWidth)||0;t.style.minWidth=`${Math.max(0,Math.min(_,S))}px`,t.style.maxWidth=`${Math.max(0,S)}px`;const $=t.getBoundingClientRect(),H=$.width,L=$.height,z=Math.max(i,Math.min(v?r.right-H:r.left,e.innerWidth-i-H));let P,B;if(this.behavior.select){const le=(et=(xe=this.behavior).selectedRow)==null?void 0:et.call(xe),We=le?le.getBoundingClientRect().top+le.offsetHeight/2-$.top:0,Dt=r.top+r.height/2-We;if(Dt>=i&&Dt+L<=e.innerHeight-i)P=Dt,B=e.innerHeight-i-Dt;else{const Pn=e.innerHeight-i-r.top,ht=r.bottom-i,wt=L>Pn&&ht>Pn;B=wt?ht:Pn,P=wt?r.bottom-Math.min(L,B):r.top}}else{const le=Math.max(0,e.innerHeight-i-r.bottom-i),We=Math.max(0,r.top-2*i),Dt=L>le&&We>le;B=Dt?We:le,P=Dt?r.top-i-Math.min(L,We):r.bottom+i}const q=`${Math.max(0,B)}px`;t.style.maxHeight=u==="none"?q:`min(${u}, ${q})`,t.style.left=`${z}px`,t.style.top=`${Math.max(i,Math.min(P,e.innerHeight-i-Math.min(L,B)))}px`;const V=e.getComputedStyle(t),Q=V.boxSizing==="border-box",F=parseFloat(V.width)+(Q?0:parseFloat(V.paddingLeft)+parseFloat(V.paddingRight)+parseFloat(V.borderLeftWidth)+parseFloat(V.borderRightWidth)),re=parseFloat(V.height)+(Q?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",`${F}px`),t.style.setProperty("--_panel-edge-height",`${re}px`),t.scrollTop=s,t.scrollLeft=a;for(const le of l)le.element.scrollTop=le.scrollTop,le.element.scrollLeft=le.scrollLeft}}je=new WeakMap,Qi=new WeakMap,Ro=new WeakMap,ul=new WeakMap,es=new WeakMap,ts=new WeakMap,Pt=new WeakSet,Cg=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)},h_=function(){o(this,ts).clear(),this.host.addEventListener("scroll",o(this,Du),!0)},Ig=function(){this.host.removeEventListener("scroll",o(this,Du),!0),o(this,ts).clear()},Du=new WeakMap,d_=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,es).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")},$g=function(){for(const[t,{value:e,priority:r}]of o(this,es))e?this.host.style.setProperty(t,e,r):this.host.style.removeProperty(t);o(this,es).clear()};class CM extends HTMLElement{constructor(){super(),this.attachInternals().role="menuitem"}connectedCallback(){this.tabIndex=-1}}var ns,$r,xg,Pg,p_;class f_ extends HTMLElement{constructor(){super();m(this,$r);m(this,ns,new dv(this,{opened:e=>{e&&su(h(this,$r,xg).call(this)[0])},keydown:e=>h(this,$r,p_).call(this,e),pointermove:e=>su(h(this,$r,Pg).call(this,e)??void 0),click:e=>{h(this,$r,Pg).call(this,e)&&o(this,ns).close()}}));this.attachInternals().role="menu"}connectedCallback(){o(this,ns).connect()}disconnectedCallback(){o(this,ns).disconnect()}attributeChangedCallback(){o(this,ns).refresh()}}ns=new WeakMap,$r=new WeakSet,xg=function(){return[...this.querySelectorAll("tv-menu-item")]},Pg=function(e){const r=e.closest("tv-menu-item");return(r==null?void 0:r.closest("tv-menu"))===this?r:null},p_=function(e){if(!o(this,ns).open)return!1;const r=h(this,$r,xg).call(this),i=r.indexOf(this.ownerDocument.activeElement);return u_(e,r)?!0:e.key==="Enter"&&i>=0?(e.preventDefault(),e.stopImmediatePropagation(),r[i].click(),!0):!1},C(f_,"observedAttributes",["open","trigger","manual"]);customElements.get("tv-menu-item")||customElements.define("tv-menu-item",CM);customElements.get("tv-menu")||customElements.define("tv-menu",f_);let IM=0;var Lu;class $M extends hn{constructor(){super(...arguments);m(this,Lu,`menu-trigger-${++IM}`)}template(e,{trigger:r}){return W`${r(o(this,Lu))}<tv-menu trigger=${o(this,Lu)}>
90
+ ${e.map(i=>"separator"in i?W`<hr>`:W`<tv-menu-item intent=${i.destructive?"danger":de} @click=${i.action}>${i.label}</tv-menu-item>`)}
91
+ </tv-menu>`}}Lu=new WeakMap;const m_=dn($M);/**
92
+ * @license
93
+ * Copyright 2020 Google LLC
94
+ * SPDX-License-Identifier: BSD-3-Clause
95
+ */const Jn=()=>new xM;class xM{}const Mm=new WeakMap,vt=rc(class extends o_{render(n){return de}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)),de}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let e=Mm.get(t);e===void 0&&(e=new WeakMap,Mm.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=Mm.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)}});/**
96
+ * @license
97
+ * Copyright 2017 Google LLC
98
+ * SPDX-License-Identifier: BSD-3-Clause
99
+ */const hb=(n,t,e)=>{const r=new Map;for(let i=t;i<=e;i++)r.set(n[i],i);return r},Nd=rc(class extends Ah{constructor(n){if(super(n),n.type!==Ir.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=TL(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,f,p=0,y=i.length-1,v=0,S=s.length-1;for(;p<=y&&v<=S;)if(i[p]===null)p++;else if(i[y]===null)y--;else if(l[p]===a[v])c[v]=js(i[p],s[v]),p++,v++;else if(l[y]===a[S])c[S]=js(i[y],s[S]),y--,S--;else if(l[p]===a[S])c[S]=js(i[p],s[S]),yc(n,c[S+1],i[p]),p++,S--;else if(l[y]===a[v])c[v]=js(i[y],s[v]),yc(n,i[p],i[y]),y--,v++;else if(u===void 0&&(u=hb(a,v,S),f=hb(l,p,y)),u.has(l[p]))if(u.has(l[y])){const _=f.get(a[v]),$=_!==void 0?i[_]:null;if($===null){const H=yc(n,i[p]);js(H,s[v]),c[v]=H}else c[v]=js($,s[v]),yc(n,i[p],$),i[_]=null;v++}else Om(i[y]),y--;else Om(i[p]),p++;for(;v<=S;){const _=yc(n,c[S+1]);js(_,s[v]),c[v++]=_}for(;p<=y;){const _=i[p++];_!==null&&Om(_)}return this.ut=a,i_(n,c),$t}});/**
100
+ * @license
101
+ * Copyright 2018 Google LLC
102
+ * SPDX-License-Identifier: BSD-3-Clause
103
+ */const g_="important",PM=" !"+g_,zd=rc(class extends Ah{constructor(n){var t;if(super(n),n.type!==Ir.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(PM);r.includes("-")||s?e.setProperty(r,s?i.slice(0,-11):i,s?g_:""):e[r]=i}}return $t}}),DM=24;function LM(n){return!db(n.source)||!db(n.current)||!ZM(n.source,n.current)||!qM(n)||!HM(n.geometry)?{kind:"invalidated"}:NM(n.pointer,n.geometry)==="pinned"?OM(n):MM(n)}function OM(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)??zM(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 MM(n){const{source:t,current:e}=n,r=t.pinnedChannelIds.includes(t.channelId),i=r?UM(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 NM(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+DM);return n.y<i?"pinned":"unpinned"}function zM(n,t){const e=t.findIndex(({top:r,bottom:i})=>n<r+(i-r)/2);return e===-1?t.length:e}function UM(n,t){const e=n.filter(i=>i!==t),r=e.findIndex(i=>i<t);return r===-1?e.length:r}function HM(n){return n.unpinnedGroupTop!==null||n.pinnedContentBottom!==null}function db(n){const t=[...n.pinnedChannelIds,...n.unpinnedChannelIds];return new Set(t).size===t.length}function ZM(n,t){return Dg(n.pinnedChannelIds,t.pinnedChannelIds)&&Dg(n.unpinnedChannelIds,t.unpinnedChannelIds)}function qM(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)&&Dg(t,e)&&i}function Dg(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}const v_=4,za=200,Cn=28,Ud=800,Vh="ease",fb=.5,wc=.5,VM="New channel",Ws=".channel-group:not(.channel-group-withdrawal) .channel-row",FM=24;var Lt,rn,kt,mt,sn,Ot,mr,Co,Le,ye,yn,wn,bn,Mt,Nt,zt,Sn,Ut,gr,Qr,hl,dl,rs,x,Lg,w_,b_,S_,__,ld,A_,E_,k_,T_,Pc,$a,R_,C_,Og,Dc,tf,nf,rf,sf,I_,Mg,Ng,$_,Ou,Mu,x_,of,Nu,P_,D_,Lc,zg,L_,O_,Oc,Ug,Hg,Zg,M_,cd,zu,Uu,Hu,Zu,N_,qg,ud,hd,Mc,Vg,Fg;class y_{constructor(t){m(this,x);m(this,Lt);m(this,rn,null);m(this,kt,null);m(this,mt,{management:!0});m(this,sn,!1);m(this,Ot,null);m(this,mr,"");m(this,Co,!1);m(this,Le,null);m(this,ye,null);m(this,yn,!1);m(this,wn,null);m(this,bn,null);m(this,Mt,null);m(this,Nt,null);m(this,zt,null);m(this,Sn,null);m(this,Ut,null);m(this,gr,null);m(this,Qr,Jn());m(this,hl,Jn());m(this,dl,Jn());m(this,rs,null);C(this,"create",()=>{const t=o(this,rn),e=o(this,kt);if(t===null||e===null||o(this,wn)!==null)return;const r={resultChannelId:null};d(this,wn,r),o(this,Lt).call(this),t.createChannel(VM).then(i=>{r.resultChannelId=i.id,t.focusChannel(i.id).catch(()=>{}),o(this,wn)===r&&o(this,Lt).call(this)},()=>{o(this,wn)!==r||o(this,bn)!==null||(d(this,wn,null),o(this,Lt).call(this))})});m(this,tf,t=>{d(this,mr,t.currentTarget.value)});m(this,nf,t=>{t.key==="Enter"?(t.preventDefault(),h(this,x,Dc).call(this,!0)):t.key==="Escape"&&(t.preventDefault(),h(this,x,Dc).call(this,!1))});m(this,rf,()=>{h(this,x,Dc).call(this,!0)});m(this,sf,t=>{t.preventDefault(),h(this,x,Dc).call(this,!0)});m(this,Ou,()=>{d(this,yn,!1)});m(this,Mu,t=>{!o(this,yn)||t.detail===0||(d(this,yn,!1),t.preventDefault(),t.stopImmediatePropagation())});m(this,of,t=>{var e;!o(this,mt).highlightOnPointerMove||o(this,ye)!==null||o(this,Ot)!==null||(e=o(this,Qr).value)!=null&&e.querySelector("tv-menu[open]")||su(t.currentTarget)});m(this,Nu,t=>{if(o(this,sn)){d(this,Le,null);return}const e=o(this,ye);if(e!==null){if(e.pointerId!==t.pointerId)return;t.preventDefault(),h(this,x,Lc).call(this,e,t);return}const r=o(this,Le);if(!(r===null||r.pointerId!==t.pointerId)){if(t.buttons===0){d(this,Le,null);return}Math.hypot(t.clientX-r.x,t.clientY-r.y)<=v_||h(this,x,P_).call(this,r,t)}});m(this,zu,t=>{var r;const e=o(this,ye);if(e!==null&&e.pointerId===t.pointerId){if(e.completed)return;const i=e.captureTarget.hasPointerCapture(t.pointerId);h(this,x,Lc).call(this,e,t);const s=i&&e.placement.kind==="placement"?e.placement.operation:null,a=o(this,rn);if(s===null||a===null){h(this,x,Mc).call(this,e,!1);return}e.completed=!0,h(this,x,Oc).call(this,e),e.operation=[...s],a.setPinnedChannelIds([...s]).then(()=>{o(this,ye)===e&&(e.operationResolved=!0,h(this,x,qg).call(this,o(this,kt)))},()=>{o(this,ye)===e&&(e.operationResolved=!0,e.operationRejected=!0,h(this,x,ud).call(this,e))});return}((r=o(this,Le))==null?void 0:r.pointerId)===t.pointerId&&d(this,Le,null)});m(this,Uu,t=>{var e,r;((e=o(this,ye))==null?void 0:e.pointerId)===t.pointerId&&!o(this,ye).completed?h(this,x,hd).call(this):((r=o(this,Le))==null?void 0:r.pointerId)===t.pointerId&&d(this,Le,null)});m(this,Hu,t=>{const e=o(this,ye);e===null||e.pointerId!==t.pointerId||e.completed||h(this,x,Mc).call(this,e,!1)});m(this,Zu,t=>{t.key!=="Escape"||o(this,ye)===null||o(this,ye).completed||(t.preventDefault(),t.stopImmediatePropagation(),h(this,x,hd).call(this))});d(this,Lt,t)}get creating(){return o(this,wn)!==null}get dragging(){return o(this,ye)!==null}connect(){window.addEventListener("pointermove",o(this,Nu)),window.addEventListener("pointerup",o(this,zu)),window.addEventListener("pointercancel",o(this,Uu)),window.addEventListener("lostpointercapture",o(this,Hu)),window.addEventListener("keydown",o(this,Zu),!0),window.addEventListener("click",o(this,Mu),!0),window.addEventListener("pointerdown",o(this,Ou),!0)}update(t,e,r){const i=o(this,kt),s=o(this,sn);d(this,rn,t),d(this,kt,e),d(this,mt,r),d(this,sn,r.motionSuppressed??!1),!s&&o(this,sn)&&h(this,x,R_).call(this),h(this,x,N_).call(this,e),h(this,x,S_).call(this,e),h(this,x,k_).call(this,i,e),o(this,Ot)!==null&&!e.channels.some(({id:l})=>l===o(this,Ot))&&(d(this,Ot,null),d(this,mr,"")),h(this,x,qg).call(this,e);const a=o(this,rs);a!==null&&e.display.pinnedChannelIds.includes(a.channelId)===a.pinned&&(d(this,rs,null),queueMicrotask(()=>{const l=h(this,x,Mg).call(this,a.channelId);l==null||l.scrollIntoView({block:"nearest"}),a.focus&&(l==null||l.focus({preventScroll:!0}))})),s&&!o(this,sn)&&h(this,x,C_).call(this)}template(){var r;const t=o(this,kt);if(t===null)return de;const e=h(this,x,T_).call(this,pb(t,(r=o(this,ye))==null?void 0:r.source));return W`
104
+ <div
105
+ class="channel-list"
106
+ role="listbox"
107
+ aria-label="Channels"
108
+ ${vt(o(this,Qr))}
109
+ >
110
+ ${h(this,x,Lg).call(this,"Pinned",e.pinned)}
111
+ ${h(this,x,Lg).call(this,"Recent",e.unpinned)}
112
+ </div>
113
+ `}overlayTemplate(){return o(this,mt).management?h(this,x,E_).call(this):de}disconnect(){var t,e,r;window.removeEventListener("pointermove",o(this,Nu)),window.removeEventListener("pointerup",o(this,zu)),window.removeEventListener("pointercancel",o(this,Uu)),window.removeEventListener("lostpointercapture",o(this,Hu)),window.removeEventListener("keydown",o(this,Zu),!0),window.removeEventListener("click",o(this,Mu),!0),window.removeEventListener("pointerdown",o(this,Ou),!0),h(this,x,Vg).call(this),(t=o(this,gr))==null||t.withdraw(),d(this,gr,null),(e=o(this,Sn))==null||e.cancel(),d(this,Sn,null),(r=o(this,Ut))==null||r.cancel(),d(this,Ut,null),d(this,rn,null),d(this,kt,null),d(this,Ot,null),d(this,mr,""),d(this,Co,!1),d(this,Le,null),d(this,yn,!1),d(this,wn,null),d(this,bn,null),d(this,Mt,null),d(this,Nt,null),d(this,zt,null),d(this,rs,null)}}Lt=new WeakMap,rn=new WeakMap,kt=new WeakMap,mt=new WeakMap,sn=new WeakMap,Ot=new WeakMap,mr=new WeakMap,Co=new WeakMap,Le=new WeakMap,ye=new WeakMap,yn=new WeakMap,wn=new WeakMap,bn=new WeakMap,Mt=new WeakMap,Nt=new WeakMap,zt=new WeakMap,Sn=new WeakMap,Ut=new WeakMap,gr=new WeakMap,Qr=new WeakMap,hl=new WeakMap,dl=new WeakMap,rs=new WeakMap,x=new WeakSet,Lg=function(t,e){var f;const r=t==="Pinned"?"pinned":"unpinned",i=o(this,ye);if(i===null&&e.length===0)return null;const s=i===null?void 0:e.find(({channel:p})=>p.id===i.channelId),a=i===null?e:e.filter(({channel:p})=>p.id!==i.channelId),l=(i==null?void 0:i.placement.kind)==="placement"&&((f=i.placement.placeholder)==null?void 0:f.side)===r?i.placement.placeholder:null,c=a.map(p=>({kind:"row",row:p}));l!==null&&c.splice(l.index,0,{kind:"placeholder",key:`channel-placeholder-${r}`}),s!==void 0&&c.push({kind:"row",row:s});const u=i!==null&&a.length===0&&l===null;return W`
114
+ <div
115
+ class="channel-group"
116
+ role="group"
117
+ aria-labelledby=${`channel-group-${r}`}
118
+ data-channel-side=${r}
119
+ ?drag-collapsed=${u}
120
+ >
121
+ <div class="channel-group-label" id=${`channel-group-${r}`}>${t}</div>
122
+ ${Nd(c,p=>p.kind==="row"?p.row.channel.id:p.key,p=>p.kind==="row"?h(this,x,w_).call(this,p.row):W`
123
+ <span
124
+ class="channel-placeholder"
125
+ aria-hidden="true"
126
+ data-channel-side=${r}
127
+ data-channel-index=${(l==null?void 0:l.index)??0}
128
+ style=${zd({height:`${(i==null?void 0:i.rowHeight)??0}px`})}
129
+ ></span>
130
+ `)}
131
+ </div>
132
+ `},w_=function(t){var c;const{channel:e,pinned:r,selected:i}=t,s=((c=o(this,ye))==null?void 0:c.channelId)===e.id?o(this,ye):null,a=s!==null&&r&&s.placement.kind==="placement"&&s.placement.side==="unpinned",l=e.id===o(this,Ot);return W`
133
+ <div
134
+ class=${`channel-row${s!==null?" dragged":""}${a?" unpinning":""}`}
135
+ data-channel-id=${e.id}
136
+ style=${zd(s===null?{}:{left:`${s.currentX-s.grip.previewOffsetX}px`,top:`${s.currentY-s.grip.offsetY}px`,width:`${s.rowWidth}px`,height:`${s.rowHeight}px`})}
137
+ >
138
+ ${a?W`
139
+ <span class="channel-drag-action" aria-hidden="true">
140
+ <tv-icon name="unpin"></tv-icon>
141
+ Unpin
142
+ </span>
143
+ `:null}
144
+ ${l?W`
145
+ <input
146
+ class="channel-rename"
147
+ aria-label="Channel name"
148
+ .value=${o(this,mr)}
149
+ @input=${o(this,tf)}
150
+ @keydown=${o(this,nf)}
151
+ @blur=${o(this,rf)}
152
+ ${vt(o(this,hl))}
153
+ />
154
+ <button
155
+ class="channel-rename-commit"
156
+ variant="ghost"
157
+ icon
158
+ size="sm"
159
+ type="button"
160
+ tabindex="-1"
161
+ aria-label="Rename"
162
+ @pointerdown=${o(this,sf)}
163
+ >
164
+ <tv-icon name="check"></tv-icon>
165
+ </button>
166
+ `:W`
167
+ <div
168
+ class="channel"
169
+ role="option"
170
+ tabindex="-1"
171
+ @keydown=${u=>{u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),u.stopPropagation(),u.currentTarget.click())}}
172
+ @pointermove=${o(this,of)}
173
+ aria-selected=${i?"true":de}
174
+ @pointerdown=${u=>o(this,mt).dragging??o(this,mt).management?h(this,x,$_).call(this,e.id,u):void 0}
175
+ @click=${u=>h(this,x,x_).call(this,e.id,u)}
176
+ >
177
+ ${e.name}
178
+ </div>
179
+ ${o(this,mt).management?m_(h(this,x,b_).call(this,t),{trigger:u=>W`
180
+ <button
181
+ class="channel-menu-trigger"
182
+ variant="ghost"
183
+ icon
184
+ size="sm"
185
+ type="button"
186
+ tabindex="-1"
187
+ id=${u}
188
+ aria-haspopup="menu"
189
+ title=${`${e.name} menu`}
190
+ >
191
+ <tv-icon name="expand"></tv-icon>
192
+ </button>
193
+ `}):de}
194
+ `}
195
+ </div>
196
+ `},b_=function(t){const{channel:e,pinned:r}=t;return[{label:"Rename",action:()=>h(this,x,Og).call(this,e.id)},{label:r?"Unpin":"Pin",action:()=>h(this,x,I_).call(this,e.id,!r)},{separator:!0},{label:"Delete",destructive:!0,action:()=>h(this,x,__).call(this,e.id,e.name)}]},S_=function(t){const e=o(this,wn);if(e===null||o(this,bn)!==null||e.resultChannelId===null)return;const r=t.channels.find(({id:i})=>i===e.resultChannelId);r!==void 0&&(d(this,bn,r.id),queueMicrotask(()=>h(this,x,Pc).call(this,"create",r.id)))},__=function(t,e){var i,s,a,l,c;if(o(this,Mt)!==null||o(this,Nt)!==null)return;h(this,x,Ng).call(this,t),d(this,Mt,{channelId:t,name:e}),(s=(i=o(this,mt)).onDeleteStart)==null||s.call(i,t),o(this,Lt).call(this);const r=(a=o(this,dl).value)==null?void 0:a.closest("dialog");r instanceof HTMLDialogElement&&(d(this,gr,tp(r,()=>{h(this,x,ld).call(this)})),(c=(l=o(this,dl).value)==null?void 0:l.querySelector(".dialog-actions button"))==null||c.focus())},ld=function(t=!1){var i,s;const e=o(this,Mt),r=o(this,gr);d(this,gr,null),d(this,Mt,null),r==null||r.withdraw(),o(this,Lt).call(this),!t&&e!==null&&((s=(i=o(this,mt)).onDeleteEnd)==null||s.call(i,e.channelId,!1))},A_=function(){const t=o(this,rn),e=o(this,Mt);if(t===null||e===null||o(this,Nt)!==null)return;d(this,Nt,e.channelId),h(this,x,ld).call(this,!0);const r=o(this,mt).onDeleteEnd;t.deleteChannel(e.channelId).then(()=>{r==null||r(e.channelId,!0)}).catch(()=>{o(this,Nt)===e.channelId&&o(this,zt)===null&&(d(this,Nt,null),o(this,Lt).call(this)),r==null||r(e.channelId,!1)})},E_=function(){const t=o(this,Mt);return t===null?null:ep(W`
197
+ <div
198
+ class="dialog-alert channel-delete-alert"
199
+ role="alertdialog"
200
+ aria-labelledby="channel-delete-title"
201
+ aria-describedby="channel-delete-body"
202
+ ${vt(o(this,dl))}
203
+ >
204
+ <h2 id="channel-delete-title">Delete “${t.name}”?</h2>
205
+ <p id="channel-delete-body">
206
+ This will permanently delete this channel from Television.
207
+ </p>
208
+ <div class="dialog-actions">
209
+ <button type="button" autofocus @click=${()=>h(this,x,ld).call(this)}>
210
+ Cancel
211
+ </button>
212
+ <button type="button" intent="danger" @click=${()=>h(this,x,A_).call(this)}>
213
+ Delete
214
+ </button>
215
+ </div>
216
+ </div>
217
+ `)},k_=function(t,e){var u,f;if(o(this,Mt)!==null&&!e.channels.some(({id:p})=>{var y;return p===((y=o(this,Mt))==null?void 0:y.channelId)})){const p=o(this,Mt);(u=o(this,gr))==null||u.withdraw(),d(this,gr,null),d(this,Mt,null),queueMicrotask(()=>{var y,v;return(v=(y=o(this,mt)).onDeleteEnd)==null?void 0:v.call(y,p.channelId,!0)})}const r=o(this,zt);if(r!==null&&e.channels.some(({id:p})=>p===r.row.channel.id)){(f=o(this,Ut))==null||f.cancel(),d(this,Ut,null),d(this,zt,null),d(this,Nt,null);return}const i=o(this,Nt);if(i===null||r!==null||e.channels.some(({id:p})=>p===i))return;if(t===null){d(this,Nt,null);return}const s=pb(t),a=s.pinned.findIndex(({channel:p})=>p.id===i),l=s.unpinned.findIndex(({channel:p})=>p.id===i),c=a>=0?s.pinned[a]:s.unpinned[l];if(c===void 0){d(this,Nt,null);return}d(this,zt,{row:{...c,selected:!1},side:a>=0?"pinned":"unpinned",index:a>=0?a:l}),queueMicrotask(()=>h(this,x,Pc).call(this,"delete",i))},T_=function(t){const e=o(this,zt);if(e===null)return t;const r=[...t[e.side]];return r.some(({channel:i})=>i.id===e.row.channel.id)||r.splice(e.index,0,e.row),{...t,[e.side]:r}},Pc=function(t,e){var l,c;if(t==="create"&&o(this,bn)!==e||t==="delete"&&((l=o(this,zt))==null?void 0:l.row.channel.id)!==e||o(this,sn))return;const r=[...((c=o(this,Qr).value)==null?void 0:c.querySelectorAll(Ws))??[]].find(u=>u.dataset.channelId===e);if(r===void 0){t==="delete"&&h(this,x,$a).call(this,t,e);return}if(typeof r.animate!="function"||matchMedia("(prefers-reduced-motion: reduce)").matches){h(this,x,$a).call(this,t,e);return}const i=r.getBoundingClientRect().height,s=t==="create"?[{maxHeight:"0px",opacity:0},{maxHeight:`${i}px`,opacity:1}]:[{maxHeight:`${i}px`,opacity:1},{maxHeight:"0px",opacity:0}],a=r.animate(s,{duration:za,easing:Vh});t==="create"?d(this,Sn,a):d(this,Ut,a),a.finished.then(()=>{t==="create"&&o(this,Sn)!==a||t==="delete"&&o(this,Ut)!==a||(t==="create"?d(this,Sn,null):d(this,Ut,null),h(this,x,$a).call(this,t,e))},()=>{})},$a=function(t,e){var r;if(t==="create"){if(o(this,bn)!==e)return;d(this,bn,null),d(this,wn,null),h(this,x,Og).call(this,e);return}((r=o(this,zt))==null?void 0:r.row.channel.id)===e&&(d(this,zt,null),d(this,Nt,null),o(this,Lt).call(this))},R_=function(){var r;d(this,Le,null),h(this,x,Vg).call(this);const t=o(this,bn);o(this,Sn)!==null&&(o(this,Sn).cancel(),d(this,Sn,null),t!==null&&queueMicrotask(()=>h(this,x,$a).call(this,"create",t)));const e=((r=o(this,zt))==null?void 0:r.row.channel.id)??null;o(this,Ut)!==null&&(o(this,Ut).cancel(),d(this,Ut,null),e!==null&&queueMicrotask(()=>h(this,x,$a).call(this,"delete",e)))},C_=function(){var r;const t=o(this,bn),e=((r=o(this,zt))==null?void 0:r.row.channel.id)??null;t!==null&&o(this,Sn)===null&&queueMicrotask(()=>h(this,x,Pc).call(this,"create",t)),e!==null&&o(this,Ut)===null&&queueMicrotask(()=>h(this,x,Pc).call(this,"delete",e))},Og=function(t){var r;const e=(r=o(this,kt))==null?void 0:r.channels.find(({id:i})=>i===t);e!==void 0&&(d(this,Ot,t),d(this,mr,e.name),d(this,Le,null),o(this,Lt).call(this),queueMicrotask(()=>{var i,s;o(this,Ot)===t&&((i=o(this,hl).value)==null||i.focus(),(s=o(this,hl).value)==null||s.select())}))},Dc=function(t){if(o(this,Ot)===null||o(this,Co)||o(this,rn)===null)return;d(this,Co,!0);const e=o(this,Ot),r=o(this,mr).trim();d(this,Ot,null),d(this,mr,""),o(this,Lt).call(this),d(this,Co,!1),t&&r.length>0&&o(this,rn).renameChannel(e,r).catch(()=>{})},tf=new WeakMap,nf=new WeakMap,rf=new WeakMap,sf=new WeakMap,I_=function(t,e){var s;if(o(this,rn)===null||o(this,kt)===null)return;if(h(this,x,Ng).call(this,t),o(this,mt).revealMovedRow){const a=h(this,x,Mg).call(this,t);d(this,rs,{channelId:t,pinned:e,focus:((s=a==null?void 0:a.parentElement)==null?void 0:s.contains(document.activeElement))??!1})}const r=o(this,kt).display.pinnedChannelIds,i=e?[...r.filter(a=>a!==t),t]:r.filter(a=>a!==t);o(this,rn).setPinnedChannelIds(i).catch(()=>{d(this,rs,null)})},Mg=function(t){var e,r;return((r=[...((e=o(this,Qr).value)==null?void 0:e.querySelectorAll(Ws))??[]].find(i=>i.dataset.channelId===t))==null?void 0:r.querySelector(".channel"))??void 0},Ng=function(t){var i,s,a;const e=[...((i=o(this,Qr).value)==null?void 0:i.querySelectorAll(Ws))??[]].find(l=>l.dataset.channelId===t),r=e==null?void 0:e.querySelector(".channel-menu-trigger");r&&((a=(s=o(this,Qr).value)==null?void 0:s.ownerDocument.querySelector(`tv-menu[trigger="${r.id}"]`))==null||a.removeAttribute("open"))},$_=function(t,e){if(e.button!==0||o(this,Le)!==null||o(this,ye)!==null||o(this,kt)===null)return;d(this,yn,!1);const i=e.currentTarget.closest(".sidebar, .channel-switcher-pop");if(i===null)return;const s=Nc(o(this,kt));!s.pinnedChannelIds.includes(t)&&!s.unpinnedChannelIds.includes(t)||d(this,Le,{channelId:t,pointerId:e.pointerId,x:e.clientX,y:e.clientY,source:{channelId:t,...s},captureTarget:i})},Ou=new WeakMap,Mu=new WeakMap,x_=function(t,e){var r;if(e.detail!==0&&o(this,yn)){d(this,yn,!1);return}d(this,yn,!1),o(this,ye)===null&&(o(this,mt).selectChannel?o(this,mt).selectChannel(t):(r=o(this,rn))==null||r.focusChannel(t).catch(()=>{}))},of=new WeakMap,Nu=new WeakMap,P_=function(t,e){if(o(this,sn)){d(this,Le,null);return}const r=[...t.captureTarget.querySelectorAll(Ws)].find(f=>f.dataset.channelId===t.channelId);if(r===void 0){d(this,Le,null);return}const i=r.getBoundingClientRect(),s=h(this,x,D_).call(this,r),a=BM({wideRow:i,compactPreviewWidth:s,pointer:{x:t.x,y:t.y}}),l=t.captureTarget.querySelector('[data-channel-side="pinned"]'),c=t.captureTarget.querySelector('[data-channel-side="unpinned"]');try{t.captureTarget.setPointerCapture(t.pointerId)}catch{d(this,Le,null);return}t.captureTarget.style.setProperty("--channel-sidebar-drag-grip-x",`${a.previewOffsetX}px`),t.captureTarget.style.setProperty("--channel-sidebar-drag-grip-y",`${a.offsetY}px`),t.captureTarget.style.setProperty("--channel-sidebar-drag-grip-correction-x",`${a.correctionX}px`),d(this,yn,!0);const u={...t,placement:{kind:"invalidated"},currentX:e.clientX,currentY:e.clientY,grip:a,rowWidth:s,rowHeight:i.height,originPinnedContentBottom:(l==null?void 0:l.getBoundingClientRect().bottom)??null,originUnpinnedGroupTop:(c==null?void 0:c.getBoundingClientRect().top)??null,displacementAnimations:new Set,edgeScrollFrame:0,edgeScrollTimestamp:null,edgeScrollRemainder:0,completed:!1,operation:null,operationResolved:!1,operationRejected:!1,restorationQueued:!1};d(this,Le,null),d(this,ye,u),h(this,x,Lc).call(this,u,e)},D_=function(t){const e=t.cloneNode(!0);for(const i of[e,...e.querySelectorAll("[id], [trigger]")])i.removeAttribute("id"),i.removeAttribute("trigger");e.classList.add("dragged"),e.style.position="fixed",e.style.left="-10000px",e.style.top="-10000px",e.style.visibility="hidden",e.style.pointerEvents="none",document.body.append(e);const r=e.getBoundingClientRect().width;return e.remove(),r},Lc=function(t,e,r=!0){if(t.completed)return;const i=o(this,kt);if(i===null){t.placement={kind:"invalidated"};return}t.currentX=e.clientX,t.currentY=e.clientY;const s=Nc(i),a=new Map([...t.captureTarget.querySelectorAll(Ws)].map(L=>[L.dataset.channelId,L])),l=s.pinnedChannelIds.filter(L=>L!==t.channelId).flatMap(L=>{const z=a.get(L);if(z===void 0)return[];const P=z.getBoundingClientRect();return[{channelId:L,top:P.top,bottom:P.bottom}]}),c=t.captureTarget.querySelector('.channel-group[data-channel-side="pinned"]:not([drag-collapsed]):not(.channel-group-withdrawal)'),u=t.captureTarget.querySelector('.channel-group[data-channel-side="unpinned"]:not([drag-collapsed]):not(.channel-group-withdrawal)'),f=t.captureTarget.querySelector(".channel-group:not(.channel-group-withdrawal) .channel-placeholder"),p=f==null?void 0:f.getBoundingClientRect(),y=f==null?void 0:f.dataset.channelSide,v=Number(f==null?void 0:f.dataset.channelIndex),S=t.captureTarget.getBoundingClientRect(),_=LM({source:t.source,current:s,pointer:{x:e.clientX,y:e.clientY},geometry:{sidebar:{left:S.left,right:S.right,top:S.top,bottom:S.bottom},pinnedRows:l,unpinnedGroupTop:(u==null?void 0:u.getBoundingClientRect().top)??t.originUnpinnedGroupTop,pinnedContentBottom:(c==null?void 0:c.getBoundingClientRect().bottom)??t.originPinnedContentBottom,placeholder:p!==void 0&&(y==="pinned"||y==="unpinned")&&Number.isInteger(v)?{side:y,index:v,top:p.top,bottom:p.bottom}:null}}),$=!jM(t.placement,_),H=$?h(this,x,Hg).call(this,t):null;t.placement=_,($||r)&&h(this,x,Zg).call(this,t,H,!1),h(this,x,zg).call(this,t)},zg=function(t){const e=t.captureTarget.querySelector(".sidebar-body, .channel-switcher-pop-body"),r=e?h(this,x,Ug).call(this,e,t.currentY):0,i=e?Math.max(0,e.scrollHeight-e.clientHeight):0,s=r<0?((e==null?void 0:e.scrollTop)??0)<=fb:((e==null?void 0:e.scrollTop)??0)>=i-fb;if(o(this,sn)||t.completed||r===0||i===0||s||typeof requestAnimationFrame!="function"){h(this,x,Oc).call(this,t);return}t.edgeScrollFrame===0&&(t.edgeScrollFrame=requestAnimationFrame(a=>{h(this,x,L_).call(this,t,a)}))},L_=function(t,e){if(t.edgeScrollFrame=0,o(this,sn)||o(this,ye)!==t||t.completed){t.edgeScrollTimestamp=null;return}const r=t.captureTarget.querySelector(".sidebar-body, .channel-switcher-pop-body");if(r===null){t.edgeScrollTimestamp=null;return}const i=h(this,x,Ug).call(this,r,t.currentY),s=t.edgeScrollTimestamp;if(t.edgeScrollTimestamp=e,i!==0&&s!==null){const a=Math.max(0,e-s)/1e3,l=Math.max(0,r.scrollHeight-r.clientHeight),c=r.scrollTop,u=i*a+t.edgeScrollRemainder,f=Math.max(0,Math.min(l,c+u));r.scrollTop=f;const p=r.scrollTop-c;if(t.edgeScrollRemainder=f===0||f===l?0:u-p,p!==0){r.toggleAttribute("continues-start",r.scrollTop>0),h(this,x,O_).call(this,t);return}}h(this,x,zg).call(this,t)},O_=function(t){h(this,x,Lc).call(this,t,{clientX:t.currentX,clientY:t.currentY},!1)},Oc=function(t){t.edgeScrollFrame!==0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(t.edgeScrollFrame),t.edgeScrollFrame=0,t.edgeScrollTimestamp=null,t.edgeScrollRemainder=0},Ug=function(t,e){const r=t.getBoundingClientRect();return e>=r.top&&e<r.top+Cn?-Ud*(r.top+Cn-e)/Cn:e>r.bottom-Cn&&e<=r.bottom?Ud*(e-(r.bottom-Cn))/Cn:0},Hg=function(t){var i;for(const s of t.displacementAnimations)s.cancel();t.displacementAnimations.clear();const e=new Map;for(const s of t.captureTarget.querySelectorAll(Ws)){const a=s.dataset.channelId;if(a===void 0)continue;const l=s.getBoundingClientRect();e.set(a,{left:l.left,top:l.top})}const r=new Map;for(const s of t.captureTarget.querySelectorAll(".channel-group:not(.channel-group-withdrawal)")){const a=s.dataset.channelSide;if(a!=="pinned"&&a!=="unpinned")continue;const l=s.getBoundingClientRect(),c=s.cloneNode(!0);for(const u of[c,...c.querySelectorAll("[id], [trigger]")])u.removeAttribute("id"),u.removeAttribute("trigger");(i=c.querySelector(".channel-row.dragged"))==null||i.remove(),c.classList.add("channel-group-withdrawal"),c.setAttribute("aria-hidden","true"),c.removeAttribute("drag-collapsed"),r.set(a,{left:l.left,top:l.top,width:l.width,height:s.hasAttribute("drag-collapsed")?0:l.height,withdrawal:c})}return{rows:e,groups:r}},Zg=function(t,e,r){const i=t.captureTarget.querySelector(".sidebar-body, .channel-switcher-pop-body"),s=(i==null?void 0:i.scrollTop)??0;o(this,Lt).call(this),queueMicrotask(()=>{const a=t.captureTarget.querySelector(".sidebar-body, .channel-switcher-pop-body");a!==null&&(a.scrollTop=s),e!==null&&h(this,x,M_).call(this,t,e,r)})},M_=function(t,e,r){if(!(o(this,sn)||typeof HTMLElement.prototype.animate!="function"||matchMedia("(prefers-reduced-motion: reduce)").matches)){for(const i of t.captureTarget.querySelectorAll(Ws)){const s=i.dataset.channelId;if(s===void 0||!r&&s===t.channelId)continue;const a=e.rows.get(s);if(a===void 0)continue;const l=i.getBoundingClientRect(),c=a.left-l.left,u=a.top-l.top;Math.hypot(c,u)<=wc||h(this,x,cd).call(this,t,i.animate({translate:[`${c}px ${u}px`,"0px 0px"]},{duration:za,easing:Vh}))}for(const i of t.captureTarget.querySelectorAll(".channel-group:not(.channel-group-withdrawal)")){const s=i.dataset.channelSide;if(s!=="pinned"&&s!=="unpinned")continue;const a=e.groups.get(s),l=i.getBoundingClientRect(),c=i.hasAttribute("drag-collapsed")?0:l.height;if(a!==void 0){if(a.height<=wc&&c>wc)h(this,x,cd).call(this,t,i.animate([{opacity:0,translate:`0px -${c}px`},{opacity:1,translate:"0px 0px"}],{duration:za,easing:Vh}));else if(a.height>wc&&c<=wc&&a.withdrawal.childElementCount>0){const u=a.withdrawal;u.style.left=`${a.left}px`,u.style.top=`${a.top}px`,u.style.width=`${a.width}px`,u.style.height=`${a.height}px`,t.captureTarget.append(u);const f=u.animate([{opacity:1,translate:"0px 0px"},{opacity:0,translate:`0px -${a.height}px`}],{duration:za,easing:Vh});h(this,x,cd).call(this,t,f),f.finished.finally(()=>u.remove()).catch(()=>{})}}}}},cd=function(t,e){t.displacementAnimations.add(e),e.finished.finally(()=>{t.displacementAnimations.delete(e)}).catch(()=>{})},zu=new WeakMap,Uu=new WeakMap,Hu=new WeakMap,Zu=new WeakMap,N_=function(t){const e=Nc(t);o(this,ye)!==null&&!o(this,ye).completed&&!mb(o(this,ye).source,e)&&h(this,x,hd).call(this),o(this,Le)!==null&&!mb(o(this,Le).source,e)&&d(this,Le,null)},qg=function(t){const e=o(this,ye);if(t===null||e===null||!e.completed||!e.operationResolved||e.restorationQueued)return;if(e.operationRejected){h(this,x,ud).call(this,e);return}const r=e.operation;r!==null&&Hd(Nc(t).pinnedChannelIds,r)&&h(this,x,ud).call(this,e)},ud=function(t){o(this,ye)!==t||t.restorationQueued||(t.restorationQueued=!0,queueMicrotask(()=>{o(this,ye)===t&&h(this,x,Mc).call(this,t,!1)}))},hd=function(){d(this,Le,null);const t=o(this,ye);t!==null&&h(this,x,Mc).call(this,t,!0)},Mc=function(t,e){if(o(this,ye)!==t)return;h(this,x,Oc).call(this,t);const r=h(this,x,Hg).call(this,t);d(this,ye,null),h(this,x,Fg).call(this,t),e&&t.captureTarget.hasPointerCapture(t.pointerId)&&t.captureTarget.releasePointerCapture(t.pointerId),h(this,x,Zg).call(this,t,r,!0)},Vg=function(){d(this,Le,null);const t=o(this,ye);if(d(this,ye,null),t!==null){h(this,x,Oc).call(this,t);for(const e of t.displacementAnimations)e.cancel();t.displacementAnimations.clear(),h(this,x,Fg).call(this,t),t.captureTarget.hasPointerCapture(t.pointerId)&&t.captureTarget.releasePointerCapture(t.pointerId)}},Fg=function(t){t.captureTarget.style.removeProperty("--channel-sidebar-drag-grip-x"),t.captureTarget.style.removeProperty("--channel-sidebar-drag-grip-y"),t.captureTarget.style.removeProperty("--channel-sidebar-drag-grip-correction-x")};function BM(n){const t=Math.max(0,n.wideRow.right-n.wideRow.left),e=Math.max(0,n.wideRow.bottom-n.wideRow.top),r=gb(n.pointer.x-n.wideRow.left,0,t),i=Math.min(r,Math.max(0,n.compactPreviewWidth-FM));return{wideOffsetX:r,previewOffsetX:i,correctionX:r-i,offsetY:gb(n.pointer.y-n.wideRow.top,0,e)}}function pb(n,t=Nc(n)){var l,c;const e=new Map(n.channels.map(u=>[u.id,u])),r=t.pinnedChannelIds.flatMap(u=>{const f=e.get(u);return f===void 0?[]:[f]}),i=t.unpinnedChannelIds.flatMap(u=>{const f=e.get(u);return f===void 0?[]:[f]}),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 Nc(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 mb(n,t){return Hd(n.pinnedChannelIds,t.pinnedChannelIds)&&Hd(n.unpinnedChannelIds,t.unpinnedChannelIds)}function Hd(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}function jM(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||Hd(n.operation,t.operation))}function gb(n,t,e){return Math.max(t,Math.min(e,n))}var qn,af;class WM extends hn{constructor(){super(...arguments);m(this,qn,new y_(()=>this.render()));m(this,af,e=>{const r=e.currentTarget;r.toggleAttribute("continues-start",r.scrollTop>0)})}connected(){o(this,qn).connect()}template(e,r,i,s,a,l=!1){return o(this,qn).update(e,r,{management:!0,motionSuppressed:l}),W`
218
+ <nav class="sidebar" ?dragging=${o(this,qn).dragging}>
219
+ <header
220
+ class="sidebar-titlebar"
221
+ ?electron-draggable=${i}
222
+ >
223
+ <button
224
+ class="channel-create"
225
+ variant="ghost"
226
+ icon
227
+ aria-label="New channel"
228
+ title="New channel"
229
+ type="button"
230
+ ?disabled=${o(this,qn).creating}
231
+ @click=${o(this,qn).create}
232
+ >
233
+ <tv-icon name="add"></tv-icon>
234
+ </button>
235
+ <span
236
+ class="toolbar-separator"
237
+ role="separator"
238
+ aria-orientation="vertical"
239
+ ></span>
240
+ ${a===void 0?W`
241
+ <button
242
+ class="sidebar-collapse"
243
+ variant="ghost"
244
+ icon
245
+ aria-label="Collapse sidebar"
246
+ title="Collapse sidebar"
247
+ type="button"
248
+ @click=${s}
249
+ >
250
+ <tv-icon name="sidebar" size="sm"></tv-icon>
251
+ </button>
252
+ `:a??W`
253
+ <span class="sidebar-toggle-seat" aria-hidden="true"></span>
254
+ `}
255
+ </header>
256
+
257
+ <div class="sidebar-body" @scroll=${o(this,af)}>
258
+ ${o(this,qn).template()}
259
+ </div>
260
+ </nav>
261
+ ${o(this,qn).overlayTemplate()}
262
+ `}disconnected(){o(this,qn).disconnect()}}qn=new WeakMap,af=new WeakMap;const GM=dn(WM),JM=1280,YM=800,vb=.4,yb=.4,z_=280,wb=180,KM=14,XM=45,QM=16,bb=64,eN=90,tN=1,nN=24,rN=230,iN=230;function sN(n,t){const{expandedSidebarWidth:e,expandedToggleLeft:r,collapsedToggleLeft:i,toggleWidth:s,toggleSwitcherGap:a,collapsedLeadReservation:l,hasSwitcher:c}=t,u=e*(1-n),f=e-r,p=Math.max(u-f,i),y=i+f,v=Math.max(0,Math.min(s,u-p)),S=Bg((u-y)/(e-y)),_=s+a,$=i+_,H=c?Bg(($-u)/_):0;let L=n*l;if(l>e){const z=1-$/e,P=Math.min(1,n/z);L=n*e+P*(l-e)}return{sidebarBoundary:u,toggleLeft:p,toggleWipe:v,titlebarOpacity:S,switcherOpacity:H,leadReservation:L}}function oN(n,t,e,r){const i=r*Math.abs(t-n);if(i===0)return t;const a=1-(1-Bg(e/i))**2;return n+(t-n)*a}function Bg(n){return Math.max(0,Math.min(1,n))}var ei,is,ti,fl,pl,Io,_i,dd,jg;class aN{constructor(t){m(this,_i);m(this,ei,null);m(this,is,0);m(this,ti);m(this,fl);m(this,pl);m(this,Io,1);d(this,ti,t),d(this,fl,t),d(this,pl,t)}get boundary(){return h(this,_i,dd).call(this),o(this,ti)}move(t){const e=this.boundary;if(h(this,_i,jg).call(this),d(this,fl,e),d(this,pl,t.target),d(this,Io,t.width),t.onFrame(e),matchMedia("(prefers-reduced-motion: reduce)").matches||Math.abs(t.target-e)<Number.EPSILON){d(this,ti,t.target),t.onFrame(t.target),t.onFinish(t.target);return}const r=Math.abs(t.target-e)/t.width,i=t.root.animate([{},{}],{duration:wb*r,easing:"linear"});i.id="sidebar-collapse-boundary",d(this,ei,i);const s=()=>{if(o(this,ei)===i){if(h(this,_i,dd).call(this),t.onFrame(o(this,ti)),i.playState==="finished"){d(this,ei,null),d(this,is,0),d(this,ti,t.target),t.onFrame(t.target),t.onFinish(t.target);return}d(this,is,requestAnimationFrame(s))}};d(this,is,requestAnimationFrame(s))}cancel(){h(this,_i,dd).call(this),h(this,_i,jg).call(this)}}ei=new WeakMap,is=new WeakMap,ti=new WeakMap,fl=new WeakMap,pl=new WeakMap,Io=new WeakMap,_i=new WeakSet,dd=function(){const t=o(this,ei);if(t===null)return;const e=oN(1-o(this,fl)/o(this,Io),1-o(this,pl)/o(this,Io),Number(t.currentTime??0),wb);d(this,ti,o(this,Io)*(1-e))},jg=function(){var t;cancelAnimationFrame(o(this,is)),d(this,is,0),(t=o(this,ei))==null||t.cancel(),d(this,ei,null)};const U_="television-active-theme",fv="tv-theme";let Vi=null,Si=null,Ts=null,Rs=null,zi=null,Sb=0,Zd=0;function lN(n){const t=document.createElement("link"),e=new URL("/theme/theme.css",n);e.searchParams.set(fv,pv()),t.rel="stylesheet",t.href=e.toString(),t.dataset.televisionStyle=U_;const r=()=>{Vi===t&&document.dispatchEvent(new Event("television-theme-styles-changed"))};return t.addEventListener("load",r,{once:!0}),t.addEventListener("error",r,{once:!0}),Vi==null||Vi.remove(),document.head.append(t),Vi=t,t}function cN(){Vi&&(Vi.remove(),Vi=null,document.dispatchEvent(new Event("television-theme-styles-changed")))}function _b(n){const t=document.createElement("script"),e=new URL("/theme/main.js",n);return e.searchParams.set(fv,pv()),t.src=e.toString(),t.dataset.televisionScript=U_,Si==null||Si.remove(),document.head.append(t),Si=t,t}function uN(){Si==null||Si.remove(),Si=null}function hN(){return Si}async function dN(n,t,e){const r=H_();if(t===null)return;let i;try{i=await e()}catch{return}if(r!==Zd)return;const s=i.themes.find(f=>f.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?Ab(n,"background"):null,u=s.enableIframeOverlayJS===!0?Ab(n,"overlay"):null;r===Zd&&(c!==null&&(a.before(c),Ts=c),u!==null&&(l.after(u),Rs=u))}function fN(){H_()}function H_(){return Zd+=1,Ts==null||Ts.remove(),Rs==null||Rs.remove(),Ts=null,Rs=null,Zd}function Ab(n,t){const e=t==="background"?new URL("/theme/iframe-background.js",n):new URL("/theme/iframe-overlay.js",n);e.searchParams.set(fv,pv());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=mN(e.toString(),pN()),r}function pN(){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 mN(n,t){return`<!doctype html>
263
+ <html data-theme="${t}">
264
+ <head>
265
+ <meta charset="utf-8">
266
+ <style>
267
+ html, body {
268
+ width: 100%;
269
+ height: 100%;
270
+ margin: 0;
271
+ overflow: hidden;
272
+ background: transparent;
273
+ color-scheme: ${t};
274
+ }
275
+ </style>
276
+ </head>
277
+ <body>
278
+ <script src="${n}"><\/script>
279
+ </body>
280
+ </html>`}function Z_(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[Ts,Rs])(a==null?void 0:a.isConnected)===!0&&((s=a.contentWindow)==null||s.postMessage(i,"*"))}function Eh(n){n.isTrusted&&Z_({eventType:n.type,clientX:n.clientX,clientY:n.clientY,button:n.button,buttons:n.buttons})}document.addEventListener("pointermove",Eh,{capture:!0});document.addEventListener("pointerdown",Eh,{capture:!0});document.addEventListener("pointerup",Eh,{capture:!0});document.addEventListener("pointercancel",Eh,{capture:!0});document.addEventListener("click",Eh,{capture:!0});function q_(n){if(n!==Ts&&n!==Rs)return!1;const e=((zi==null?void 0:zi.isConnected)===!0&&zi!==Ts&&zi!==Rs&&zi.closest("#foreground-overlay")===null?zi:null)??document.querySelector("#app");return e==null||e.focus({preventScroll:!0}),!0}document.addEventListener("focusin",n=>{const t=n.target;t instanceof HTMLElement&&(q_(t)||t.isConnected&&t.closest("#foreground-overlay")===null&&(zi=t))},{capture:!0});window.addEventListener("blur",()=>{queueMicrotask(()=>q_(document.activeElement))},{capture:!0});function pv(){return Sb+=1,`${Date.now()}-${Sb}`}const gN=404,vN="/views/url-unsupported/";function fd(n){const t=Ld(n.artifact,{electron:n.electron,browserDemo:n.browserDemo??!1});let e;if(t.renderer==="url-direct")e=t;else 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 Eb(n.currentURL)&&!n.electron?e=Vr(n.currentURL)?{renderer:"proxy-iframe",viewURL:n.currentURL,contentURL:null}:{renderer:"proxy-iframe",viewURL:vN,contentURL:null}:Eb(n.currentURL)?e={renderer:"url-webview",viewURL:n.currentURL,contentURL:null}:e={renderer:n.electron?"url-webview":"proxy-iframe",viewURL:bN(n.currentURL,n.viewURL),contentURL:null};return n.frameSrcOverride?{...e,viewURL:n.frameSrcOverride}:e}var ut,_n,ml,$o,xo,Vn,Po,gl,Ht,vl,yl,vr,ss,os,Do,se,pd,V_,F_,Wg,B_,yr,md,zc,Gg,j_,Jg,Yg,Js;class yN extends hn{constructor(){super(...arguments);m(this,se);m(this,ut,null);m(this,_n,null);m(this,ml,"");m(this,$o,()=>{});m(this,xo,()=>{});m(this,Vn,null);m(this,Po,null);m(this,gl,null);m(this,Ht,null);m(this,vl,null);m(this,yl,null);m(this,vr,null);m(this,ss,null);m(this,os,null);m(this,Do,null);m(this,yr,()=>{!o(this,_n)||o(this,_n)!==o(this,Vn)||o(this,$o).call(this,!0)})}get currentFrame(){return o(this,_n)}connected(){h(this,se,md).call(this),h(this,se,Gg).call(this)}disconnected(){h(this,se,zc).call(this),h(this,se,Js).call(this)}template(e,r,i=()=>{}){return d(this,$o,r),d(this,xo,i),e(this),o(this,ml)}assignSource(e){const r=o(this,ut),i=r?!SN(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,Do,null),i&&(d(this,vr,null),o(this,Ht)&&(o(this,Ht).content=""),d(this,ss,null),d(this,os,null)),d(this,ut,e),h(this,se,pd).call(this)}handleArtifactContentChanged(e){const r=o(this,ut);return e!==(r==null?void 0:r.artifact.id)||!o(this,Ht)&&!h(this,se,Yg).call(this)?!1:(h(this,se,Jg).call(this),!0)}handleThemeChanged(){var r;const e=(r=o(this,ut))==null?void 0:r.artifact;return(e==null?void 0:e.kind)!=="path"||!ig(e.path)||o(this,Ht)===null?!1:(o(this,Ht).notifyStylesChanged(),!0)}refreshFrameLoadState(){h(this,se,md).call(this)}}ut=new WeakMap,_n=new WeakMap,ml=new WeakMap,$o=new WeakMap,xo=new WeakMap,Vn=new WeakMap,Po=new WeakMap,gl=new WeakMap,Ht=new WeakMap,vl=new WeakMap,yl=new WeakMap,vr=new WeakMap,ss=new WeakMap,os=new WeakMap,Do=new WeakMap,se=new WeakSet,pd=function(){const e=o(this,ut);if(!e)return;if(e.artifact.kind==="path"&&h(this,se,Yg).call(this)){h(this,se,B_).call(this,e.artifact);return}const r=fd(e),i=h(this,se,V_).call(this,r.renderer);h(this,se,F_).call(this,i,r),h(this,se,Wg).call(this,i),h(this,se,md).call(this),h(this,se,Gg).call(this)},V_=function(e){var s;const r=e==="url-webview"?"webview":"iframe";if(((s=o(this,_n))==null?void 0:s.tagName.toLowerCase())===r)return o(this,_n);h(this,se,zc).call(this),h(this,se,Js).call(this);const i=document.createElement(r);return i.className="artifact-content",r==="webview"&&i.setAttribute("allowpopups",""),d(this,_n,i),i},F_=function(e,r){e.getAttribute("src")!==r.viewURL&&(o(this,xo).call(this,null),o(this,xo).call(this,e),e.setAttribute("src",r.viewURL)),r.contentURL===null?delete e.dataset.contentUrl:e.dataset.contentUrl=r.contentURL},Wg=function(e){o(this,ml)!==e&&(d(this,ml,e),this.render(e))},B_=function(e){o(this,xo).call(this,null),h(this,se,zc).call(this),h(this,se,Js).call(this),d(this,_n,null),o(this,$o).call(this,!1),h(this,se,Wg).call(this,W`
281
+ <section class="artifact-missing artifact-content" role="status" aria-label="Artifact file not found">
282
+ <div class="artifact-missing-wrapper">
283
+ <h1>${DA()}</h1>
284
+ <p>${LA()}</p>
285
+ <section class="artifact-missing-path" aria-label="Missing artifact path">
286
+ <p class="artifact-missing-path-label">Registered path:</p>
287
+ <p><code>${e.path}</code></p>
288
+ </section>
289
+ <p>${OA()}</p>
290
+ </div>
291
+ </section>
292
+ `)},yr=new WeakMap,md=function(){var s;const e=o(this,_n),r=e?`${e.tagName.toLowerCase()}:${e.getAttribute("src")??""}:${e.dataset.contentUrl??""}`:null;if(e&&e===o(this,Vn)&&r===o(this,Po)||(h(this,se,zc).call(this),o(this,$o).call(this,!1),!e||!r||!this.isConnected))return;if(d(this,Vn,e),d(this,Po,r),e.tagName.toLowerCase()==="webview"){e.addEventListener("did-finish-load",o(this,yr)),e.addEventListener("did-fail-load",o(this,yr));return}e.addEventListener("load",o(this,yr));const i=e;try{i.isConnected&&((s=i.contentDocument)==null?void 0:s.readyState)==="complete"&&o(this,yr).call(this)}catch{}},zc=function(){if(!o(this,Vn)){d(this,Po,null);return}o(this,Vn).removeEventListener("load",o(this,yr)),o(this,Vn).removeEventListener("did-finish-load",o(this,yr)),o(this,Vn).removeEventListener("did-fail-load",o(this,yr)),d(this,Vn,null),d(this,Po,null)},Gg=function(){const e=o(this,ut),r=o(this,_n),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,se,Js).call(this,{clearContent:!0});return}if(r!==o(this,gl)||s!==o(this,yl)){h(this,se,Js).call(this),d(this,gl,r),d(this,vl,i),d(this,yl,s);const a=r.tagName.toLowerCase()==="webview"?new fL(r):new dL(r);d(this,Ht,a),a.handleUpdateContent(async l=>{const c=o(this,ut),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,vr,l),o(this,Ht)===a&&(a.content=l)}),o(this,vr)!==null&&(a.content=o(this,vr))}else d(this,vl,i);h(this,se,j_).call(this)},j_=function(){const e=o(this,ut),r=e==null?void 0:e.application;!e||!r||!o(this,Ht)||o(this,ss)===e.artifact.id&&o(this,os)===r||(d(this,ss,e.artifact.id),d(this,os,r),h(this,se,Jg).call(this))},Jg=async function(){var s,a;const e=o(this,ut),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,ut))==null?void 0:s.artifact.id)!==i||o(this,ut).application!==r)return;d(this,Do,null),d(this,vr,l);const c=o(this,Ht);if(!c){h(this,se,pd).call(this);return}c.content=l}catch(l){if(((a=o(this,ut))==null?void 0:a.artifact.id)!==i||o(this,ut).application!==r)return;if(l instanceof Ql&&l.status===gN){d(this,Do,i),d(this,vr,null),h(this,se,Js).call(this),h(this,se,pd).call(this);return}d(this,ss,null),d(this,os,null)}},Yg=function(){var r;const e=(r=o(this,ut))==null?void 0:r.artifact;return o(this,Do)===(e==null?void 0:e.id)&&e.kind==="path"&&ig(e.path)},Js=function(e={}){var r;(r=o(this,Ht))==null||r.dispose(),d(this,Ht,null),d(this,gl,null),d(this,vl,null),d(this,yl,null),d(this,ss,null),d(this,os,null),e.clearContent&&d(this,vr,null)};const wN=dn(yN);function Eb(n){return n.startsWith("http://")||n.startsWith("https://")}function bN(n,t){if(!n.startsWith("/")||!t)return n;try{return new URL(n,t).toString()}catch{return n}}function SN(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 qu,wl,wr,ni,as,ls,cs,Vu,Fu,Bu,ju,un,Kg,gd,vd;class _N{constructor(t,e=()=>{}){m(this,un);m(this,qu);m(this,wl);m(this,wr,null);m(this,ni,null);m(this,as,null);m(this,ls,null);m(this,cs,!1);m(this,Vu,t=>{const e=Tb(t.data);if(!e)return;const r=o(this,as);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,ni)!==null&&o(this,ni)===t.source,f=a&&EN(i)===t.origin;!c&&!u&&!f||h(this,un,Kg).call(this,e,i,{send:p=>{var y;return(y=i.contentWindow)==null?void 0:y.postMessage(p,"*")}})});m(this,Fu,t=>{var s;const e=t.detail??t;if(!e||e.channel!==kb)return;const r=Tb((s=e.args)==null?void 0:s[0]),i=o(this,ls);!r||!i||h(this,un,Kg).call(this,r,i,{send:a=>{var l;return(l=i.send)==null?void 0:l.call(i,kb,a)}})});m(this,Bu,t=>{const e=Rb(t);e.isMainFrame===!0&&e.isInPlace!==!0&&this.reset()});m(this,ju,t=>{Rb(t).isMainFrame!==!1&&this.reset()});d(this,qu,t),d(this,wl,e)}get currentGuid(){return o(this,wr)}get lifecycleWindow(){return o(this,ni)}get trustState(){return{currentGuid:o(this,wr),lifecycleWindow:o(this,ni)}}connect(){o(this,cs)||(d(this,cs,!0),window.addEventListener("message",o(this,Vu)),h(this,un,gd).call(this))}disconnect(){o(this,cs)&&(window.removeEventListener("message",o(this,Vu)),d(this,cs,!1),h(this,un,vd).call(this))}reset(){d(this,wr,null),d(this,ni,null),o(this,wl).call(this)}setCurrentFrame(t){if(t===o(this,as)){h(this,un,gd).call(this);return}h(this,un,vd).call(this),o(this,as)!==null&&this.reset(),d(this,as,AN(t)?t:null),h(this,un,gd).call(this)}}qu=new WeakMap,wl=new WeakMap,wr=new WeakMap,ni=new WeakMap,as=new WeakMap,ls=new WeakMap,cs=new WeakMap,Vu=new WeakMap,Fu=new WeakMap,Bu=new WeakMap,ju=new WeakMap,un=new WeakSet,Kg=function(t,e,r){t.type==="bridge-ready"&&t.guid!==o(this,wr)?(o(this,wr)!==null&&o(this,wl).call(this),d(this,wr,t.guid),d(this,ni,e.tagName.toLowerCase()==="iframe"?e.contentWindow:null)):t.type==="leaving"&&t.guid===o(this,wr)&&this.reset(),o(this,qu).call(this,t,r)},gd=function(){if(!o(this,cs))return;const t=o(this,as),e=(t==null?void 0:t.tagName.toLowerCase())==="webview"?t:null;e!==o(this,ls)&&(h(this,un,vd).call(this),e&&(e.addEventListener("ipc-message",o(this,Fu)),e.addEventListener("did-start-navigation",o(this,Bu)),e.addEventListener("did-fail-load",o(this,ju)),d(this,ls,e)))},vd=function(){const t=o(this,ls);t&&(t.removeEventListener("ipc-message",o(this,Fu)),t.removeEventListener("did-start-navigation",o(this,Bu)),t.removeEventListener("did-fail-load",o(this,ju)),d(this,ls,null))};const kb="television-artifact-bridge";function Tb(n){return _A(n)||AA(n)||EA(n)||kA(n)||TA(n)||RA(n)||CA(n)||IA(n)?n:null}function AN(n){if(!n)return!1;const t=n.tagName.toLowerCase();return t==="iframe"||t==="webview"}function EN(n){try{return new URL(n.getAttribute("src")??n.src,window.location.href).origin}catch{return null}}function Rb(n){return n.detail??n}const kN="/views/url-unsupported/";class TN extends hn{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",Jn());C(this,"_trustedChannel",new _N((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&&!wi()?(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"&&Vr(this._artifact.url)||this.isDemoPage()||(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(this.bridgeFrame(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 f=c?!IN(c,s):!0;if(f&&(this._activeReloadFrameSrc=null),this._artifact=s,this.syncNavigationState(),this._connected){if(this.renderArtifact({resetTrust:f}),l=!0,c&&$N(c,s)){const p=this.currentMissingArtifactMessage();p&&((u=this._missingArtifactReplyTransport)==null||u.send(p))}}else f&&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:$A,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();Z_({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&&CN(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:xA,title:e.title,path:e.path}}handleProxyContentChanged(){var e;((e=this._artifact)==null?void 0:e.kind)!=="url"||!Vr(this._artifact.url)||this.reloadProxyFrame()}handleNavigationRequest(e){if(!V2(e.url,window.location.href))return;this.syncNavigationState();const r=this._navigationState;if(!r)return;const i=this.convertIframeNavigationURL(e.url);if(i===kN||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.isDemoPage()){this.disposeNavigationState();return}const e=this.canonicalURLForArtifact(this._artifact);this._navigationState&&this._navigationArtifactId===this._artifact.id&&this._navigationCanonicalURL===e||(this.disposeNavigationState(),this._navigationState=new VD(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=fd({artifact:e,application:this._application,electron:wi(),browserDemo:this.browserDemo,viewURL:this._viewURL,contentURL:this._contentURL,currentURL:null}),i=r.viewURL;return e.kind==="url"&&Vr(e.url)||r.renderer==="url-webview"?bi(i):Cb(i,i)}convertIframeNavigationURL(e){var r;return((r=this._artifact)==null?void 0:r.kind)==="url"&&Vr(this._artifact.url)&&Vr(e)?bi(e):Cb(e,this._viewURL??this._navigationCanonicalURL??null)}handleWebviewNavigationEvent(e){const r=e.url;if(typeof r!="string"||!V2(r,window.location.href))return!1;this.syncNavigationState();const i=this._navigationState;if(!i)return!1;const s=bi(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(this.bridgeFrame(e)),this.syncWebviewSubscription(e)}bridgeFrame(e){return this.isDemoPage()?null:e}get browserDemo(){var e;return((e=this._application)==null?void 0:e.browserDemoMode)===!0}isDemoPage(){const e=this._artifact;return e?Ld(e,{electron:wi(),browserDemo:this.browserDemo}).renderer==="url-direct":!1}returnToOriginalPage(){var i,s;const e=this._artifact,r=this.currentFrame;(e==null?void 0:e.kind)!=="url"||(r==null?void 0:r.tagName.toLowerCase())!=="iframe"||((i=this._rootRef.value)==null||i.removeAttribute("data-embed-loaded"),r.setAttribute("src",e.url),(s=this._documentHost)==null||s.refreshFrameLoadState())}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 f,p,y;const r=this._artifact;if(!r)return;e.resetTrust&&this.resetTrustedFrame();const i={artifact:r,application:this._application,electron:wi(),browserDemo:this.browserDemo,viewURL:this._viewURL,contentURL:this._contentURL,currentURL:((f=this._navigationState)==null?void 0:f.currentURL)??null},s=fd(i),a=(p=this.currentFrame)==null?void 0:p.getAttribute("src");let l=null;this._activeReloadFrameSrc&&(W_(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,(y=this._documentHost)==null||y.assignSource(u),this.syncFrameSubscriptions()}reloadProxyFrame(){var a,l,c,u,f;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"&&Vr(this._artifact.url)))return;const r=((c=this._artifact)==null?void 0:c.kind)==="url"&&Vr(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(Fl,String(++this._proxyReloadVersion));const s=r.startsWith("/")?`${i.pathname}${i.search}${i.hash}`:i.href;this._activeReloadFrameSrc=s,(f=this._rootRef.value)==null||f.removeAttribute("data-embed-loaded"),this.renderArtifact({frameSrcOverride:s,resetTrust:!0})}forceCurrentFrameSrc(){var s,a,l;if(!this._artifact)return;const e=fd({artifact:this._artifact,application:this._application,electron:wi(),browserDemo:this.browserDemo,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=tp(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(()=>{})}artifactIconTemplate(){return this.isDemoPage()?W`
293
+ <button
294
+ icon
295
+ size="sm"
296
+ variant="ghost"
297
+ class="artifact-return"
298
+ @click=${()=>this.returnToOriginalPage()}
299
+ aria-label="Return to the original page"
300
+ >
301
+ <tv-icon name="artifact"></tv-icon>
302
+ </button>
303
+ `:W`<tv-icon name="artifact"></tv-icon>`}navigationControlsTemplate(){const e=this._navigationState;return!e||!e.canGoBack&&!e.canGoForward?null:W`
304
+ <button
305
+ icon
306
+ size="sm"
307
+ variant="ghost"
308
+ class="artifact-back"
309
+ ?disabled=${!e.canGoBack}
310
+ @click=${()=>e.back()}
311
+ aria-label="Back"
312
+ >
313
+ <tv-icon name="back" size="sm"></tv-icon>
314
+ </button>
315
+ <button
316
+ icon
317
+ size="sm"
318
+ variant="ghost"
319
+ class="artifact-forward"
320
+ ?disabled=${!e.canGoForward}
321
+ @click=${()=>e.forward()}
322
+ aria-label="Forward"
323
+ >
324
+ <tv-icon name="forward" size="sm"></tv-icon>
325
+ </button>
326
+ <span class="artifact-bar-divider" aria-hidden="true"></span>
327
+ `}deleteConfirmationTemplate(){return!this._deleteConfirmationOpen||!this._artifact?null:ep(W`
328
+ <div class="dialog-alert" role="alertdialog">
329
+ <h2>Delete “${this._artifact.title}”?</h2>
330
+ <p>It’s removed from this channel; the file or web page it points to is not deleted.</p>
331
+ <div class="dialog-actions">
332
+ <button @click=${()=>this.dismissDeleteConfirmation()}>Cancel</button>
333
+ <button intent="danger" @click=${()=>this.confirmDelete()}>Delete</button>
334
+ </div>
335
+ </div>
336
+ `)}template(e,r,i){const s=this._artifact;return W`
337
+ <div
338
+ class="artifact-view artifact-frame"
339
+ kind=${s.kind}
340
+ ?full-screen=${this._fullScreen}
341
+ ?inert=${this._inert}
342
+ ._trustedChannel=${this._trustedChannel}
343
+ ${vt(this._rootRef)}
344
+ >
345
+ <div class="artifact-frame-clip">
346
+ ${wN(this.captureDocumentHost,this.handleEmbedLoadChange,this.handleDocumentFrameChange)}
347
+ <footer class="artifact-title-bar" @dblclick=${this.handleTitleBarDoubleClick}>
348
+ ${this.artifactIconTemplate()}
349
+ <span class="artifact-title">${s.title}</span>
350
+ ${this.navigationControlsTemplate()}
351
+ ${m_(this.menuEntries(),{trigger:a=>W`
352
+ <button
353
+ icon
354
+ size="sm"
355
+ variant="ghost"
356
+ class="artifact-menu-trigger"
357
+ id=${a}
358
+ aria-label=${`${s.title} menu`}
359
+ >
360
+ <tv-icon name="expand"></tv-icon>
361
+ </button>
362
+ `})}
363
+ </footer>
364
+ </div>
365
+ ${this.deleteConfirmationTemplate()}
366
+ </div>
367
+ `}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 RN=dn(TN);function CN(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"?W_(n.url,t.url):!0}function $N(n,t){return n.kind==="path"&&t.kind==="path"&&n.id===t.id&&(n.title!==t.title||n.path!==t.path)}function W_(n,t){try{const e=new URL(n,window.location.href),r=new URL(t,window.location.href);return e.searchParams.delete(Fl),r.searchParams.delete(Fl),e.origin===r.origin&&e.pathname===r.pathname&&e.search===r.search}catch{return!1}}function Cb(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(Fl),`${e.pathname}${e.search}${e.hash}`}}catch{return bi(n)}return bi(n)}function G_(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 Xg(n,t,e,r){G_(n,t,e,e.size,r)}function mv(n){return{width:1-vb+vb*n.width/JM,height:1-yb+yb*n.height/YM}}function J_(n){return{width:Math.min(rN,n.width),height:Math.min(iN,n.height)}}function Ib(n,t){const e=mv(t),r=J_(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 xN(n,t){const e=mv(t);return{width:n.width/e.width,height:n.height/e.height}}const $b=.5,Fh=2,PN=120,DN=["left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"];var Lo,br,bl,ri,Sl,Oo,us,hs,ds,ii,Mo,No,Sr,_l,si,_r,Tt,oi,Ar,J,Y_,K_,Uc,X_,Hc,Qg,yd,Q_,Wu,Gu,Ju,Yu,zo,Ku,e1,Mn,t1,xa,e4,t4,Zc;class LN extends hn{constructor(){super(...arguments);m(this,J);m(this,Lo,Jn());m(this,br,Jn());m(this,bl);m(this,ri);m(this,Sl);m(this,Oo);m(this,us);m(this,hs,0);m(this,ds,0);m(this,ii,null);m(this,Mo,null);m(this,No,null);m(this,Sr,null);m(this,_l,[]);m(this,si,null);m(this,_r,null);m(this,Tt,null);m(this,oi,new Set);m(this,Ar,!1);m(this,Wu,e=>{const r=o(this,Tt);!r||e.pointerId!==r.pointerId||(r.lastPointer={x:e.clientX,y:e.clientY},r.option=e.altKey,h(this,J,e1).call(this,r))});m(this,Gu,e=>{var r;e.pointerId===((r=o(this,Tt))==null?void 0:r.pointerId)&&h(this,J,Mn).call(this,!0)});m(this,Ju,e=>{var r;e.pointerId===((r=o(this,Tt))==null?void 0:r.pointerId)&&h(this,J,Mn).call(this,!1)});m(this,Yu,e=>{var r;e.pointerId===((r=o(this,Tt))==null?void 0:r.pointerId)&&h(this,J,Mn).call(this,!1)});m(this,zo,e=>{const r=o(this,Tt);if(r){if(e.type==="keydown"&&e.key==="Escape"){e.preventDefault(),h(this,J,Mn).call(this,!1);return}r.option!==e.altKey&&(r.option=e.altKey,h(this,J,e1).call(this,r))}});m(this,Ku,()=>{const e=o(this,Tt);!e||xb(h(this,J,Uc).call(this,e.filmstrip),e.pageBox)||(h(this,J,Qg).call(this),h(this,J,Mn).call(this,!1))})}connected(){d(this,bl,void 0),d(this,ri,void 0),d(this,Sl,void 0),d(this,Oo,void 0),d(this,us,void 0)}template(e,r,i,s=!1){var Q;const a=!o(this,Ar)&&s;if(d(this,Ar,s),a){h(this,J,Mn).call(this,!1),h(this,J,Zc).call(this);for(const F of o(this,oi))F.cancel();o(this,oi).clear()}const l=(i==null?void 0:i.channelId)===(r==null?void 0:r.id)?i:null,c=MN(r,(l==null?void 0:l.pages)??(r==null?void 0:r.pages)),u=(r==null?void 0:r.selectedPage)??null,f=(r==null?void 0:r.id)??null,p=(u==null?void 0:u.artifactIds[0])??null,y=(u==null?void 0:u.geometry.full_screen)??null,v=o(this,Oo)!==void 0,S=c.map(({key:F,page:re})=>`${F}:${re.geometry.full_screen}:${re.size.width}:${re.size.height}`).sort().join("|"),_=l===null?null:c.map(({key:F})=>F).join("|"),$=f!==o(this,bl),H=p!==o(this,ri),L=y!==o(this,Sl),z=S!==o(this,Oo),P=_!==o(this,us),q=!o(this,Ar)&&l!==null&&o(this,us)!==void 0&&o(this,us)!==null&&P?h(this,J,e4).call(this):null,V=!o(this,Ar)&&H&&!$&&o(this,ri)!==void 0&&o(this,ri)!==null&&p!==null;return o(this,Tt)&&($||H||L)&&h(this,J,Mn).call(this,!1),d(this,bl,f),d(this,ri,p),d(this,Sl,y),d(this,Oo,S),d(this,us,_),d(this,_l,c),z&&v&&h(this,J,yd).call(this),$&&((Q=o(this,Sr))==null||Q.disconnect(),d(this,Mo,null),d(this,No,null),d(this,si,null)),queueMicrotask(()=>h(this,J,Hc).call(this)),$||H||z||a?queueMicrotask(()=>h(this,J,Y_).call(this,p,V)):P&&queueMicrotask(()=>{const F=o(this,br).value;F&&(h(this,J,xa).call(this,F,p,!1),q&&h(this,J,t4).call(this,q))}),W`
368
+ <section
369
+ class="stage"
370
+ ${vt(o(this,Lo))}
371
+ style=${`--handle-band: ${KM}px; --handle-reach: ${XM}px; --handle-thickness: ${QM}px;`}
372
+ >
373
+ ${r!==null&&c.length===0?W`
374
+ <div class="stage-empty">
375
+ <tv-icon name="artifact" size="xl"></tv-icon>
376
+ <p>No artifacts yet — ask your agent to put something here.</p>
377
+ </div>
378
+ `:null}
379
+ ${Nd([f],F=>F,()=>W`
380
+ <div class="filmstrip" ${vt(o(this,br))}>
381
+ <div class="filmstrip-inner">
382
+ ${Nd(c,({key:F})=>F,({page:F,artifact:re,key:Ne})=>{if(r===null)return null;const xe=Ne===p;return W`
383
+ <div
384
+ class="page"
385
+ data-page-key=${Ne}
386
+ ?selected=${xe}
387
+ ?full-screen=${F.geometry.full_screen}
388
+ style=${h(this,J,X_).call(this,F)}
389
+ @click=${xe||re===null?null:()=>e.selectPage(r.id,re.id)}
390
+ >
391
+ ${re?RN(e,re,{viewURL:e.getArtifactViewURL(re),contentURL:e.getArtifactContentURL(re),fullScreen:F.geometry.full_screen,inert:!xe,onFullScreenChange:et=>Xg(e,r,F,et)}):null}
392
+ ${xe?W`
393
+ <div class="page-handles" aria-hidden="true">
394
+ ${DN.map(et=>W`
395
+ <span
396
+ class="page-handle ${et}"
397
+ @pointerdown=${le=>h(this,J,Q_).call(this,le,et,e,r,F,Ne)}
398
+ ></span>
399
+ `)}
400
+ </div>
401
+ `:null}
402
+ </div>
403
+ `})}
404
+ </div>
405
+ </div>
406
+ `)}
407
+ </section>
408
+ `}disconnected(){var e;h(this,J,Mn).call(this,!1),h(this,J,yd).call(this),h(this,J,Zc).call(this),cancelAnimationFrame(o(this,hs)),d(this,hs,0),(e=o(this,Sr))==null||e.disconnect(),d(this,Sr,null),d(this,Mo,null),d(this,No,null),d(this,si,null),d(this,_l,[]);for(const r of o(this,oi))r.cancel();o(this,oi).clear()}}Lo=new WeakMap,br=new WeakMap,bl=new WeakMap,ri=new WeakMap,Sl=new WeakMap,Oo=new WeakMap,us=new WeakMap,hs=new WeakMap,ds=new WeakMap,ii=new WeakMap,Mo=new WeakMap,No=new WeakMap,Sr=new WeakMap,_l=new WeakMap,si=new WeakMap,_r=new WeakMap,Tt=new WeakMap,oi=new WeakMap,Ar=new WeakMap,J=new WeakSet,Y_=function(e,r){const i=o(this,br).value;i&&(cancelAnimationFrame(o(this,hs)),d(this,hs,requestAnimationFrame(()=>{d(this,hs,0),h(this,J,xa).call(this,i,e,r)})))},K_=function(e,r){var i;typeof ResizeObserver>"u"||e===o(this,Mo)&&r===o(this,No)||((i=o(this,Sr))==null||i.disconnect(),d(this,Mo,e),d(this,No,r),d(this,Sr,new ResizeObserver(()=>{const s=h(this,J,Uc).call(this,e);xb(s,o(this,si))||(h(this,J,Qg).call(this),o(this,Tt)&&h(this,J,Mn).call(this,!1),h(this,J,Hc).call(this,e)),o(this,ii)===null&&h(this,J,xa).call(this,e,o(this,ri)??null,!1)})),o(this,Sr).observe(e),o(this,Sr).observe(r))},Uc=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)}},X_=function(e){if(e.geometry.full_screen||o(this,si)===null)return"";const r=Ib(e.size,o(this,si));return`width: ${r.width}px; height: ${r.height}px;`},Hc=function(e=o(this,br).value){var s;if(!e)return;const r=h(this,J,Uc).call(this,e);d(this,si,r);const i=new Map(o(this,_l).map(a=>[a.key,a.page]));for(const a of e.querySelectorAll(".page")){if(a===((s=o(this,Tt))==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=Ib(l.size,r);a.style.width=`${c.width}px`,a.style.height=`${c.height}px`}},Qg=function(){const e=o(this,Lo).value;e&&(e.setAttribute("window-tracking",""),o(this,_r)!==null&&clearTimeout(o(this,_r)),d(this,_r,setTimeout(()=>{d(this,_r,null),e.removeAttribute("window-tracking")},PN)))},yd=function(){var e;o(this,_r)!==null&&(clearTimeout(o(this,_r)),d(this,_r,null)),(e=o(this,Lo).value)==null||e.removeAttribute("window-tracking")},Q_=function(e,r,i,s,a,l){if(o(this,Ar)||e.button!==0||!e.isPrimary)return;const c=e.currentTarget,u=c.closest(".page"),f=o(this,br).value,p=o(this,Lo).value;if(!u||!f||!p)return;h(this,J,Mn).call(this,!1),h(this,J,yd).call(this),e.preventDefault(),e.stopPropagation();const y=u.getBoundingClientRect(),v=h(this,J,Uc).call(this,f),S=mv(v),_=a.geometry.full_screen,$=r.includes("left")||r.includes("right"),H=r.includes("top")||r.includes("bottom");d(this,Tt,{application:i,channel:s,page:a,pageKey:l,pageElement:u,filmstrip:f,stage:p,handle:c,pointerId:e.pointerId,startPointer:{x:e.clientX,y:e.clientY},lastPointer:{x:e.clientX,y:e.clientY},startRendered:{width:y.width,height:y.height},rendered:{width:y.width,height:y.height},baselineSize:_?{width:v.width/S.width,height:v.height/S.height}:{...a.size},pageBox:v,wasFullScreen:_,horizontal:$,vertical:H,leftish:r.includes("left"),topish:r.includes("top"),option:e.altKey,armed:!1,leftFullScreen:!1}),p.setAttribute("resizing",""),c.addEventListener("pointermove",o(this,Wu)),c.addEventListener("pointerup",o(this,Gu)),c.addEventListener("pointercancel",o(this,Ju)),c.addEventListener("lostpointercapture",o(this,Yu)),window.addEventListener("keydown",o(this,zo)),window.addEventListener("keyup",o(this,zo)),window.addEventListener("resize",o(this,Ku)),c.setPointerCapture(e.pointerId)},Wu=new WeakMap,Gu=new WeakMap,Ju=new WeakMap,Yu=new WeakMap,zo=new WeakMap,Ku=new WeakMap,e1=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=J_(e.pageBox);let s=e.startRendered.width,a=e.startRendered.height;if(e.horizontal){const l=e.leftish?-Fh:Fh;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?-Fh:Fh;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-bb&&a>=e.pageBox.height-bb,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,J,t1).call(this,e.stage,e.armed),h(this,J,xa).call(this,e.filmstrip,e.pageKey,!1)},Mn=function(e){const r=o(this,Tt);if(r){if(d(this,Tt,null),r.handle.removeEventListener("pointermove",o(this,Wu)),r.handle.removeEventListener("pointerup",o(this,Gu)),r.handle.removeEventListener("pointercancel",o(this,Ju)),r.handle.removeEventListener("lostpointercapture",o(this,Yu)),window.removeEventListener("keydown",o(this,zo)),window.removeEventListener("keyup",o(this,zo)),window.removeEventListener("resize",o(this,Ku)),r.handle.hasPointerCapture(r.pointerId)&&r.handle.releasePointerCapture(r.pointerId),h(this,J,t1).call(this,r.stage,!1),e&&r.armed)r.wasFullScreen&&r.pageElement.setAttribute("full-screen",""),Xg(r.application,r.channel,r.page,!0);else if(e){const i={...r.baselineSize},s=xN(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?G_(r.application,r.channel,r.page,i,!1):h(this,J,Hc).call(this,r.filmstrip)}else r.pageElement.toggleAttribute("full-screen",r.wasFullScreen),h(this,J,Hc).call(this,r.filmstrip);r.pageElement.getBoundingClientRect(),r.stage.removeAttribute("resizing"),h(this,J,xa).call(this,r.filmstrip,r.pageKey,!1)}},t1=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)},xa=function(e,r,i){const s=[...e.querySelectorAll(".page")].find(y=>y.dataset.pageKey===r);if(!s){h(this,J,Zc).call(this);return}h(this,J,K_).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,J,Zc).call(this),o(this,Ar)||!i||Math.abs(c-e.scrollLeft)<$b||matchMedia("(prefers-reduced-motion: reduce)").matches){e.scrollLeft=c;return}const u=e.scrollLeft,f=e.animate([{},{}],{duration:z_,easing:"ease"});d(this,ii,f);const p=()=>{var v;if(f!==o(this,ii))return;const y=f.playState==="finished"?1:((v=f.effect)==null?void 0:v.getComputedTiming().progress)??0;e.scrollLeft=u+(c-u)*y,f.playState==="finished"?(e.scrollLeft=c,d(this,ii,null),d(this,ds,0)):d(this,ds,requestAnimationFrame(p))};d(this,ds,requestAnimationFrame(p))},e4=function(){const e=o(this,br).value;return e?new Map([...e.querySelectorAll(".page")].map(r=>[r.dataset.pageKey??"",r.getBoundingClientRect().left])):new Map},t4=function(e){if(o(this,Ar))return;const r=o(this,br).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)<=$b)continue;const l=i.animate({translate:[`${a}px 0`,"0px 0"]},{duration:za,easing:"ease"});o(this,oi).add(l),l.finished.finally(()=>{o(this,oi).delete(l)}).catch(()=>{})}},Zc=function(){var e;cancelAnimationFrame(o(this,ds)),d(this,ds,0),(e=o(this,ii))==null||e.cancel(),d(this,ii,null)};const ON=dn(LN);function MN(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 xb(n,t){return t!==null&&n.width===t.width&&n.height===t.height}const NN=250,zN=1e3;var fs,ps,Uo,ms,Wt,n4,n1,r4,r1,i4;class UN extends hn{constructor(){super(...arguments);m(this,Wt);m(this,fs,ZN());m(this,ps,null);m(this,Uo,!1);m(this,ms,null)}disconnected(){var e;h(this,Wt,r1).call(this),(e=o(this,ps))==null||e.withdraw(),d(this,ps,null),d(this,Uo,!1),Ag(null,o(this,fs))}template(e,r){return h(this,Wt,r4).call(this,e),Ag(ep(h(this,Wt,n4).call(this,e,r),s4(r.dragStrip)),o(this,fs)),h(this,Wt,i4).call(this),o(this,fs)}}fs=new WeakMap,ps=new WeakMap,Uo=new WeakMap,ms=new WeakMap,Wt=new WeakSet,n4=function(e,r){switch(e.kind){case"connecting":return W`
409
+ <div class="system-modal" role="status" aria-live="polite">
410
+ <tv-icon name="spinner" size="xl" spinning></tv-icon>
411
+ <h2>Connecting</h2>
412
+ </div>
413
+ `;case"disconnected":return W`
414
+ <div class="system-modal" role="status" aria-live="polite">
415
+ <tv-icon name="spinner" size="xl" spinning></tv-icon>
416
+ <h2>Disconnected</h2>
417
+ <p>${Pb(e.nextRetryAt)}</p>
418
+ </div>
419
+ `;case"unauthorized":return W`
420
+ <div class="system-modal">
421
+ <tv-icon name="locked" size="xl"></tv-icon>
422
+ <h2>Access token required</h2>
423
+ <p>${{browser:"This server requires a valid access token to connect. Ask your agent for the current link, and paste the whole link into the address bar.",desktop:"This server requires a valid access token to connect. Choose Television › Disconnect from Server, then try again.",local:"This server requires a valid access token to connect. Disconnect from Server, then paste the current link from your agent."}[r.context]}</p>
424
+ ${h(this,Wt,n1).call(this,r)}
425
+ </div>
426
+ `;case"error":return W`
427
+ <div class="system-modal">
428
+ <h2>Can’t connect with server</h2>
429
+ <p class="server-url">${e.serverURL}</p>
430
+ <p>Check your internet connection and that the server is running. ${Pb(e.nextRetryAt)}</p>
431
+ ${h(this,Wt,n1).call(this,r)}
432
+ </div>
433
+ `}},n1=function(e){return e.context==="local"?W`<button intent="danger" class="system-modal-disconnect" @click=${e.onDisconnect}>Disconnect from Server</button>`:null},r4=function(e){const r=(e.kind==="disconnected"||e.kind==="error")&&e.nextRetryAt!==null;r&&o(this,ms)===null?d(this,ms,setInterval(()=>this.render(),NN)):r||h(this,Wt,r1).call(this)},r1=function(){o(this,ms)!==null&&(clearInterval(o(this,ms)),d(this,ms,null))},i4=function(){o(this,ps)!==null||o(this,Uo)||(d(this,Uo,!0),queueMicrotask(()=>{if(d(this,Uo,!1),!this.isConnected||!o(this,fs).isConnected||o(this,ps)!==null)return;const e=o(this,fs).querySelector("dialog");e!==null&&d(this,ps,tp(e,()=>{}))}))};const HN=dn(UN);function ZN(){const n=document.createElement("section");return n.className="system-modal-host",n}function Pb(n){if(n===null)return"Reconnecting now…";const t=n-Date.now();return t<=0?"Reconnecting now…":`Reconnecting in ${Math.ceil(t/zN)}s…`}function s4(n=!1){return n?W`<div class="window-drag-strip" electron-draggable aria-hidden="true"></div>`:null}/**
434
+ * @license
435
+ * Copyright 2017 Google LLC
436
+ * SPDX-License-Identifier: BSD-3-Clause
437
+ */class i1 extends Ah{constructor(t){if(super(t),this.it=de,t.type!==Ir.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===de||t==null)return this._t=void 0,this.it=t;if(t===$t)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:[]}}}i1.directiveName="unsafeHTML",i1.resultType=1;const o4=rc(i1);/*! @license DOMPurify 3.4.16 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.16/LICENSE */function Db(n,t){(t==null||t>n.length)&&(t=n.length);for(var e=0,r=Array(t);e<t;e++)r[e]=n[e];return r}function qN(n){if(Array.isArray(n))return n}function VN(n,t){var e=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(e!=null){var r,i,s,a,l=[],c=!0,u=!1;try{if(s=(e=e.call(n)).next,t!==0)for(;!(c=(r=s.call(e)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(f){u=!0,i=f}finally{try{if(!c&&e.return!=null&&(a=e.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function FN(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
438
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */function BN(n,t){return qN(n)||VN(n,t)||jN(n,t)||FN()}function jN(n,t){if(n){if(typeof n=="string")return Db(n,t);var e={}.toString.call(n).slice(8,-1);return e==="Object"&&n.constructor&&(e=n.constructor.name),e==="Map"||e==="Set"?Array.from(n):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Db(n,t):void 0}}const a4=Object.entries,Lb=Object.setPrototypeOf,WN=Object.isFrozen,GN=Object.getPrototypeOf,JN=Object.getOwnPropertyDescriptor;let ot=Object.freeze,ct=Object.seal,Pa=Object.create,l4=typeof Reflect<"u"&&Reflect,s1=l4.apply,o1=l4.construct;ot||(ot=function(t){return t});ct||(ct=function(t){return t});s1||(s1=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)});o1||(o1=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 Ys=Qe(Array.prototype.forEach),YN=Qe(Array.prototype.lastIndexOf),Ob=Qe(Array.prototype.pop),bc=Qe(Array.prototype.push),KN=Qe(Array.prototype.splice),Za=Array.isArray,qc=Qe(String.prototype.toLowerCase),Nm=Qe(String.prototype.toString),Mb=Qe(String.prototype.match),Sc=Qe(String.prototype.replace),Nb=Qe(String.prototype.indexOf),XN=Qe(String.prototype.trim),QN=Qe(Number.prototype.toString),e9=Qe(Boolean.prototype.toString),zb=typeof BigInt>"u"?null:Qe(BigInt.prototype.toString),Ub=typeof Symbol>"u"?null:Qe(Symbol.prototype.toString),Ft=Qe(Object.prototype.hasOwnProperty),_c=Qe(Object.prototype.toString),pt=Qe(RegExp.prototype.test),Oi=t9(TypeError);function Qe(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 s1(n,t,r)}}function t9(n){return function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return o1(n,e)}}function ve(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:qc;if(Lb&&Lb(n,null),!Za(t))return n;let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const s=e(i);s!==i&&(WN(t)||(t[r]=s),i=s)}n[i]=!0}return n}function n9(n){for(let t=0;t<n.length;t++)Ft(n,t)||(n[t]=null);return n}function Xt(n){const t=Pa(null);for(const r of a4(n)){var e=BN(r,2);const i=e[0],s=e[1];Ft(n,i)&&(Za(s)?t[i]=n9(s):s&&typeof s=="object"&&s.constructor===Object?t[i]=Xt(s):t[i]=s)}return t}function r9(n){switch(typeof n){case"string":return n;case"number":return QN(n);case"boolean":return e9(n);case"bigint":return zb?zb(n):"0";case"symbol":return Ub?Ub(n):"Symbol()";case"undefined":return _c(n);case"function":case"object":{if(n===null)return _c(n);const t=n,e=gn(t,"toString");if(typeof e=="function"){const r=e(t);return typeof r=="string"?r:_c(r)}return _c(n)}default:return _c(n)}}function gn(n,t){for(;n!==null;){const r=JN(n,t);if(r){if(r.get)return Qe(r.get);if(typeof r.value=="function")return Qe(r.value)}n=GN(n)}function e(){return null}return e}function i9(n){try{return pt(n,""),!0}catch{return!1}}const Hb=ot(["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"]),zm=ot(["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"]),Um=ot(["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"]),s9=ot(["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"]),Hm=ot(["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"]),o9=ot(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Zb=ot(["#text"]),qb=ot(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","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"]),Zm=ot(["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","dominant-baseline","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","pointer-events","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-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","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"]),Vb=ot(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),Bh=ot(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),a9=ct(/{{[\w\W]*|^[\w\W]*}}/g),l9=ct(/<%[\w\W]*|^[\w\W]*%>/g),c9=ct(/\${[\w\W]*/g),u9=ct(/^data-[\-\w.\u00B7-\uFFFF]+$/),h9=ct(/^aria-[\-\w]+$/),Fb=ct(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),d9=ct(/^(?:\w+script|data):/i),f9=ct(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),p9=ct(/^html$/i),m9=ct(/^[a-z][.\w]*(-[.\w]+)+$/i),Bb=ct(/<[/\w!]/g),jb=ct(/<[/\w]/g),g9=ct(/<\/no(script|embed|frames)/i),v9=ct(/\/>/i),Kt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},c4=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],y9=ot(ve({},c4)),w9=(function(){const n={};return Ys(c4,t=>{n[t]=ct(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),ot(n)})(),b9=function(){return typeof window>"u"?null:window},S9=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}},Wb=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Mi=function(t,e,r,i){return Ft(t,e)&&Za(t[e])?ve(i.base?Xt(i.base):{},t[e],i.transform):r},qm=function(t,e,r){const i=Ft(t,e)?t[e]:void 0;return i&&typeof i=="object"?Xt(i):r()};function u4(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b9();const t=N=>u4(N);if(t.version="3.4.16",t.removed=[],!n||!n.document||n.document.nodeType!==Kt.document||!n.Element)return t.isSupported=!1,t;let e=n.document;const r=e,i=r.currentScript;n.DocumentFragment;const s=n.HTMLTemplateElement,a=n.Node,l=n.Element,c=n.NodeFilter;n.NamedNodeMap===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;const u=n.DOMParser,f=n.trustedTypes,p=l.prototype,y=gn(p,"cloneNode"),v=gn(p,"remove"),S=gn(p,"removeAttributeNode"),_=gn(p,"nextSibling"),$=gn(p,"childNodes"),H=gn(p,"parentNode"),L=gn(p,"shadowRoot"),z=gn(p,"attributes"),P=a&&a.prototype?gn(a.prototype,"nodeType"):null,B=a&&a.prototype?gn(a.prototype,"nodeName"):null,q=a&&a.prototype?gn(a.prototype,"ownerDocument"):null,V=function(w){return P?P(w):w.nodeType},Q=function(w){return B?B(w):w.nodeName};if(typeof s=="function"){const N=e.createElement("template");N.content&&N.content.ownerDocument&&(e=N.content.ownerDocument)}let F,re="",Ne,xe=!1,et=0;const le=function(){if(et>0)throw Oi('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},We=function(w){le(),et++;try{return F.createHTML(w)}finally{et--}},Dt=function(w){le(),et++;try{return F.createScriptURL(w)}finally{et--}},Pn=function(){return xe||(Ne=S9(f,i),xe=!0),Ne},ht=e,wt=ht.implementation,Ms=ht.createNodeIterator,ca=ht.createDocumentFragment,Ns=ht.getElementsByTagName,Ci=r.importNode;let Ee=Wb();t.isSupported=typeof a4=="function"&&typeof H=="function"&&wt&&wt.createHTMLDocument!==void 0;const sc=a9,Dn=l9,zs=c9,oc=u9,bt=h9,Ce=d9,Be=f9,Pe=m9;let Ge=Fb,ce=null;const fn=ve({},[...Hb,...zm,...Um,...Hm,...Zb]);let oe=null;const at=ve({},[...qb,...Zm,...Vb,...Bh]);let ze=Object.seal(Pa(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}})),pn=null,Ln=null;const Je=Object.seal(Pa(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let xr=!0,Qn=!0,Pr=!1,Th=!0,er=!1,tr=!0,Dr=!1,Lr=!1,Ii=null,Us=null,ac=!1,$i=!1,xi=!1,Or=!1,k=!0,R=!1;const pe="user-content-";let Se=!0,ke=!1,te={},St=null;const nr=ve({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let dt=null;const On=ve({},["audio","video","img","source","image","track"]);let ua=null;const Mr=ve({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ft="http://www.w3.org/1998/Math/MathML",Hs="http://www.w3.org/2000/svg",Jt="http://www.w3.org/1999/xhtml";let Nr=Jt,zr=!1,Zs=null;const ha=ve({},[ft,Hs,Jt],Nm),da=ot(["mi","mo","mn","ms","mtext"]);let qs=ve({},da);const lc=ot(["annotation-xml"]);let fa=ve({},lc);const cc=ve({},["title","style","font","a","script"]);let Pi=null;const uc=["application/xhtml+xml","text/html"],Rh="text/html";let Ue=null,rr=null;const Di=e.createElement("form"),Vs=function(w){return w instanceof RegExp||w instanceof Function},hc=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(rr&&rr===w)return;(!w||typeof w!="object")&&(w={}),w=Xt(w),Pi=uc.indexOf(w.PARSER_MEDIA_TYPE)===-1?Rh:w.PARSER_MEDIA_TYPE,Ue=Pi==="application/xhtml+xml"?Nm:qc,ce=Mi(w,"ALLOWED_TAGS",fn,{transform:Ue}),oe=Mi(w,"ALLOWED_ATTR",at,{transform:Ue}),Zs=Mi(w,"ALLOWED_NAMESPACES",ha,{transform:Nm}),ua=Mi(w,"ADD_URI_SAFE_ATTR",Mr,{transform:Ue,base:Mr}),dt=Mi(w,"ADD_DATA_URI_TAGS",On,{transform:Ue,base:On}),St=Mi(w,"FORBID_CONTENTS",nr,{transform:Ue}),pn=Mi(w,"FORBID_TAGS",Xt({}),{transform:Ue}),Ln=Mi(w,"FORBID_ATTR",Xt({}),{transform:Ue}),te=Ft(w,"USE_PROFILES")?w.USE_PROFILES&&typeof w.USE_PROFILES=="object"?Xt(w.USE_PROFILES):w.USE_PROFILES:!1,xr=w.ALLOW_ARIA_ATTR!==!1,Qn=w.ALLOW_DATA_ATTR!==!1,Pr=w.ALLOW_UNKNOWN_PROTOCOLS||!1,Th=w.ALLOW_SELF_CLOSE_IN_ATTR!==!1,er=w.SAFE_FOR_TEMPLATES||!1,tr=w.SAFE_FOR_XML!==!1,Dr=w.WHOLE_DOCUMENT||!1,$i=w.RETURN_DOM||!1,xi=w.RETURN_DOM_FRAGMENT||!1,Or=w.RETURN_TRUSTED_TYPE||!1,ac=w.FORCE_BODY||!1,k=w.SANITIZE_DOM!==!1,R=w.SANITIZE_NAMED_PROPS||!1,Se=w.KEEP_CONTENT!==!1,ke=w.IN_PLACE||!1,Ge=i9(w.ALLOWED_URI_REGEXP)?w.ALLOWED_URI_REGEXP:Fb,Nr=typeof w.NAMESPACE=="string"?w.NAMESPACE:Jt,qs=qm(w,"MATHML_TEXT_INTEGRATION_POINTS",()=>ve({},da)),fa=qm(w,"HTML_INTEGRATION_POINTS",()=>ve({},lc));const A=qm(w,"CUSTOM_ELEMENT_HANDLING",()=>Pa(null));if(ze=Pa(null),Ft(A,"tagNameCheck")&&Vs(A.tagNameCheck)&&(ze.tagNameCheck=A.tagNameCheck),Ft(A,"attributeNameCheck")&&Vs(A.attributeNameCheck)&&(ze.attributeNameCheck=A.attributeNameCheck),Ft(A,"allowCustomizedBuiltInElements")&&typeof A.allowCustomizedBuiltInElements=="boolean"&&(ze.allowCustomizedBuiltInElements=A.allowCustomizedBuiltInElements),ct(ze),er&&(Qn=!1),xi&&($i=!0),te&&(ce=ve({},Zb),oe=Pa(null),te.html===!0&&(ve(ce,Hb),ve(oe,qb)),te.svg===!0&&(ve(ce,zm),ve(oe,Zm),ve(oe,Bh)),te.svgFilters===!0&&(ve(ce,Um),ve(oe,Zm),ve(oe,Bh)),te.mathMl===!0&&(ve(ce,Hm),ve(oe,Vb),ve(oe,Bh))),Je.tagCheck=null,Je.attributeCheck=null,Ft(w,"ADD_TAGS")&&(typeof w.ADD_TAGS=="function"?Je.tagCheck=w.ADD_TAGS:Za(w.ADD_TAGS)&&(ce===fn&&(ce=Xt(ce)),ve(ce,w.ADD_TAGS,Ue))),Ft(w,"ADD_ATTR")&&(typeof w.ADD_ATTR=="function"?Je.attributeCheck=w.ADD_ATTR:Za(w.ADD_ATTR)&&(oe===at&&(oe=Xt(oe)),ve(oe,w.ADD_ATTR,Ue))),Ft(w,"ADD_FORBID_CONTENTS")&&Za(w.ADD_FORBID_CONTENTS)&&(St===nr&&(St=Xt(St)),ve(St,w.ADD_FORBID_CONTENTS,Ue)),Se&&(ce["#text"]=!0),Dr&&ve(ce,["html","head","body"]),ce.table&&(ve(ce,["tbody"]),delete pn.tbody),w.TRUSTED_TYPES_POLICY){if(typeof w.TRUSTED_TYPES_POLICY.createHTML!="function")throw Oi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof w.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Oi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const M=F;F=w.TRUSTED_TYPES_POLICY;try{re=We("")}catch(U){throw F=M,U}}else w.TRUSTED_TYPES_POLICY===null?(F=void 0,re=""):(F===void 0&&(F=Pn()),F&&typeof re=="string"&&(re=We("")));ot&&ot(w),rr=w},dc=ve({},[...zm,...Um,...s9]),$v=ve({},[...Hm,...o9]),cA=function(w,A,M){return A.namespaceURI===Jt?w==="svg":A.namespaceURI===ft?w==="svg"&&(M==="annotation-xml"||qs[M]):!!dc[w]},uA=function(w,A,M){return A.namespaceURI===Jt?w==="math":A.namespaceURI===Hs?w==="math"&&fa[M]:!!$v[w]},hA=function(w,A,M){return A.namespaceURI===Hs&&!fa[M]||A.namespaceURI===ft&&!qs[M]?!1:!$v[w]&&(cc[w]||!dc[w])},dA=function(w){let A=H(w);(!A||!A.tagName)&&(A={namespaceURI:Nr,tagName:"template"});const M=qc(w.tagName),U=qc(A.tagName);return Zs[w.namespaceURI]?w.namespaceURI===Hs?cA(M,A,U):w.namespaceURI===ft?uA(M,A,U):w.namespaceURI===Jt?hA(M,A,U):!!(Pi==="application/xhtml+xml"&&Zs[w.namespaceURI]):!1},Li=function(w){bc(t.removed,{element:w});try{H(w).removeChild(w)}catch{if(v(w),!H(w))throw Oi("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},xv=function(w,A,M){try{S(w,A)}catch{try{w.removeAttribute(M)}catch{}}},Ch=function(w){Ih(w);const A=$(w);if(A){const U=[];Ys(A,X=>{bc(U,X)}),Ys(U,X=>{try{v(X)}catch{}})}const M=z(w);if(M)for(let U=M.length-1;U>=0;--U){const X=M[U],ue=X&&X.name;typeof ue=="string"&&xv(w,X,ue)}},Fs=function(w,A,M){if(!M)try{M=A.getAttributeNode(w)}catch{M=null}bc(t.removed,{attribute:M||null,from:A});try{M?S(A,M):A.removeAttribute(w)}catch{try{A.removeAttribute(w)}catch{}}if(w==="is")if($i||xi)try{Li(A)}catch{}else try{A.setAttribute(w,"")}catch{}},fA=function(w){const A=z(w);if(A)for(let M=A.length-1;M>=0;--M){const U=A[M],X=U&&U.name;typeof X!="string"||oe[Ue(X)]||xv(w,U,X)}},Ih=function(w){const A=[w];for(;A.length>0;){const M=A.pop();V(M)===Kt.element&&fA(M);const U=$(M);if(U)for(let X=U.length-1;X>=0;--X)A.push(U[X])}},Pv=function(w,A){return tr?w==="patchsrc"?!0:w==="for"&&A!=="label"&&A!=="output":!1},pA=function(w){if(!tr)return;const A=[w];for(;A.length>0;){const M=A.pop(),U=V(M);if(U===Kt.processingInstruction||U===Kt.comment&&pt(jb,M.data)){try{v(M)}catch{}continue}if(U===Kt.element){const ue=M,me=Ue(Q(M));try{ue.hasAttribute&&ue.hasAttribute("patchsrc")&&ue.removeAttribute("patchsrc"),ue.hasAttribute&&ue.hasAttribute("for")&&Pv("for",me)&&ue.removeAttribute("for")}catch{}}const X=$(M);if(X)for(let ue=X.length-1;ue>=0;--ue)A.push(X[ue])}},Dv=function(w){let A=null,M=null;if(ac)w="<remove></remove>"+w;else{const ue=Mb(w,/^[\r\n\t ]+/);M=ue&&ue[0]}Pi==="application/xhtml+xml"&&Nr===Jt&&(w='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+w+"</body></html>");const U=F?We(w):w;if(Nr===Jt)try{A=new u().parseFromString(U,Pi)}catch{}if(!A||!A.documentElement){A=wt.createDocument(Nr,"template",null);try{A.documentElement.innerHTML=zr?re:U}catch{}}const X=A.body||A.documentElement;return w&&M&&X.insertBefore(e.createTextNode(M),X.childNodes[0]||null),Nr===Jt?Ns.call(A,Dr?"html":"body")[0]:Dr?A.documentElement:X},Lv=function(w){const A=q?q(w):w.ownerDocument;return Ms.call(A||w,w,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},$h=function(w){return w=Sc(w,sc," "),w=Sc(w,Dn," "),w=Sc(w,zs," "),w},sp=function(w){var A;w.normalize();const M=q?q(w):w.ownerDocument,U=Ms.call(M||w,w,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let X=U.nextNode();for(;X;)X.data=$h(X.data),X=U.nextNode();const ue=(A=w.querySelectorAll)===null||A===void 0?void 0:A.call(w,"template");ue&&Ys(ue,me=>{pa(me.content)&&sp(me.content)})},xh=function(w){const A=B?B(w):null;return typeof A!="string"||Ue(A)!=="form"?!1:typeof w.nodeName!="string"||typeof w.textContent!="string"||typeof w.removeChild!="function"||w.attributes!==z(w)||typeof w.removeAttribute!="function"||typeof w.removeAttributeNode!="function"||typeof w.getAttributeNode!="function"||typeof w.setAttribute!="function"||typeof w.namespaceURI!="string"||typeof w.insertBefore!="function"||typeof w.hasChildNodes!="function"||w.nodeType!==P(w)||w.childNodes!==$(w)},pa=function(w){if(!P||typeof w!="object"||w===null)return!1;try{return P(w)===Kt.documentFragment}catch{return!1}},fc=function(w){if(!P||typeof w!="object"||w===null)return!1;try{return typeof P(w)=="number"}catch{return!1}};function ir(N,w,A){N.length!==0&&Ys(N,M=>{M.call(t,w,A,rr)})}const mA=function(w,A){return!!(tr&&w.hasChildNodes()&&!fc(w.firstElementChild)&&pt(Bb,w.textContent)&&pt(Bb,w.innerHTML)||tr&&w.namespaceURI===Jt&&y9[A]&&(fc(w.firstElementChild)||typeof w.textContent=="string"&&pt(w9[A],w.textContent))||w.nodeType===Kt.processingInstruction||tr&&w.nodeType===Kt.comment&&pt(jb,w.data))},Ph=function(w,A){if(w instanceof RegExp)return pt(w,A);if(w instanceof Function){for(var M=arguments.length,U=new Array(M>2?M-2:0),X=2;X<M;X++)U[X-2]=arguments[X];return!!w(A,...U)}return!1},gA=function(w,A,M){if(!pn[A]&&zv(A)&&Ph(ze.tagNameCheck,A))return!1;if(Se&&!St[A]){const U=H(w),X=$(w);if(X&&U){const ue=X.length;for(let me=ue-1;me>=0;--me){const Fe=w===M?y(X[me],!0):X[me];U.insertBefore(Fe,_(w))}}}return Li(w),!0},Ov=function(w,A,M,U){return w.length===0?A:A===M||A===U?Xt(A):A},ma=function(w,A){return w===A||H(w)!==null?!1:(ke&&Ih(w),!0)},Mv=function(w,A){if(ir(Ee.beforeSanitizeElements,w,null),ma(w,A))return!0;if(xh(w))return Li(w),!0;const M=Ue(Q(w));if(ce=Ov(Ee.uponSanitizeElement,ce,fn,Ii),ir(Ee.uponSanitizeElement,w,{tagName:M,allowedTags:ce}),ma(w,A))return!0;if(mA(w,M))return Li(w),!0;if(pn[M]||!(Je.tagCheck instanceof Function&&Je.tagCheck(M))&&!ce[M]){const U=gA(w,M,A);return U===!1&&(ir(Ee.afterSanitizeElements,w,null),ma(w,A))?!0:U}if(V(w)===Kt.element&&!dA(w)||(M==="noscript"||M==="noembed"||M==="noframes")&&pt(g9,w.innerHTML))return Li(w),!0;if(er&&w.nodeType===Kt.text){const U=$h(w.textContent);w.textContent!==U&&(bc(t.removed,{element:w.cloneNode()}),w.textContent=U)}return ir(Ee.afterSanitizeElements,w,null),ma(w,A)},Nv=function(w,A,M){if(Ln[A]||Pv(A,w)||k&&(A==="id"||A==="name")&&(M in e||M in Di))return!1;const U=oe[A]||Je.attributeCheck instanceof Function&&Je.attributeCheck(A,w);return Qn&&pt(oc,A)||xr&&pt(bt,A)?!0:U?ua[A]||pt(Ge,Sc(M,Be,""))||(A==="src"||A==="xlink:href"||A==="href")&&w!=="script"&&Nb(M,"data:")===0&&dt[w]||Pr&&!pt(Ce,Sc(M,Be,""))?!0:!M:zv(w)&&Ph(ze.tagNameCheck,w)&&Ph(ze.attributeNameCheck,A,w)||A==="is"&&ze.allowCustomizedBuiltInElements&&Ph(ze.tagNameCheck,M)},vA=ve({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),zv=function(w){return!vA[qc(w)]&&pt(Pe,w)},yA=function(w,A,M,U){if(F&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!M)switch(f.getAttributeType(w,A)){case"TrustedHTML":return We(U);case"TrustedScriptURL":return Dt(U)}return U},wA=function(w,A,M,U){try{return M?w.setAttributeNS(M,A,U):w.setAttribute(A,U),xh(w)?(Li(w),!1):!0}catch{return Fs(A,w),!1}},Uv=function(w,A){if(ir(Ee.beforeSanitizeAttributes,w,null),ma(w,A))return;const M=w.attributes;if(!M||xh(w))return;oe=Ov(Ee.uponSanitizeAttribute,oe,at,Us);const U={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:oe,forceKeepAttr:void 0};let X=M.length;const ue=Ue(w.nodeName);for(;X--;){const me=M[X],Fe=me.name,mn=me.namespaceURI,Yt=me.value,ga=Ue(Fe),ap=Yt;let _t=Fe==="value"?ap:XN(ap),Hv=!1;if(U.attrName=ga,U.attrValue=_t,U.keepAttr=!0,U.forceKeepAttr=void 0,ir(Ee.uponSanitizeAttribute,w,U),_t=U.attrValue,R&&(ga==="id"||ga==="name")&&Nb(_t,pe)!==0&&(Fs(Fe,w,me),_t=pe+_t,Hv=!0),tr&&pt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,_t)){Fs(Fe,w,me);continue}if(ga==="attributename"&&Mb(_t,"href")){Fs(Fe,w,me);continue}if(!U.forceKeepAttr){if(!U.keepAttr){Fs(Fe,w,me);continue}if(!Th&&pt(v9,_t)){Fs(Fe,w,me);continue}if(er&&(_t=$h(_t)),!Nv(ue,ga,_t)){Fs(Fe,w,me);continue}_t=yA(ue,ga,mn,_t),_t!==ap&&wA(w,Fe,mn,_t)&&Hv&&Ob(t.removed)}}ir(Ee.afterSanitizeAttributes,w,null),ma(w,A)},Dh=function(w){let A=null;const M=Lv(w);for(ir(Ee.beforeSanitizeShadowDOM,w,null);A=M.nextNode();)if(ir(Ee.uponSanitizeShadowNode,A,null),Mv(A,w),Uv(A,w),pa(A.content)&&Dh(A.content),V(A)===Kt.element){const U=L(A);pa(U)&&(op(U),Dh(U))}ir(Ee.afterSanitizeShadowDOM,w,null)},op=function(w){const A=[{node:w,shadow:null}];for(;A.length>0;){const M=A.pop();if(M.shadow){Dh(M.shadow);continue}const U=M.node,X=V(U)===Kt.element,ue=$(U);if(ue)for(let me=ue.length-1;me>=0;--me)A.push({node:ue[me],shadow:null});if(X){const me=B?B(U):null;if(typeof me=="string"&&Ue(me)==="template"){const Fe=U.content;pa(Fe)&&A.push({node:Fe,shadow:null})}}if(X){const me=L(U);pa(me)&&A.push({node:null,shadow:me},{node:me,shadow:null})}}};return t.sanitize=function(N){let w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,M=null,U=null,X=null;if(zr=!N,zr&&(N="<!-->"),typeof N!="string"&&!fc(N)&&(N=r9(N),typeof N!="string"))throw Oi("dirty is not a string, aborting");if(!t.isSupported)return N;Lr?(ce=Ii,oe=Us):hc(w),(Ee.uponSanitizeElement.length>0||Ee.uponSanitizeAttribute.length>0)&&(ce=Xt(ce)),Ee.uponSanitizeAttribute.length>0&&(oe=Xt(oe)),t.removed=[];const ue=ke&&typeof N!="string"&&fc(N);if(ue){pA(N);const mn=Q(N);if(typeof mn=="string"){const Yt=Ue(mn);if(!ce[Yt]||pn[Yt])throw Ch(N),Oi("root node is forbidden and cannot be sanitized in-place")}if(xh(N))throw Ch(N),Oi("root node is clobbered and cannot be sanitized in-place");try{op(N)}catch(Yt){throw Ch(N),Yt}}else if(fc(N))A=Dv("<!---->"),M=A.ownerDocument.importNode(N,!0),M.nodeType===Kt.element&&M.nodeName==="BODY"||M.nodeName==="HTML"?A=M:A.appendChild(M),op(A);else{if(!$i&&!er&&!Dr&&N.indexOf("<")===-1)return F&&Or?We(N):N;if(A=Dv(N),!A)return $i?null:Or?re:""}A&&ac&&Li(A.firstChild);const me=ue?N:A;try{const mn=Lv(me);for(;U=mn.nextNode();)Mv(U,me),Uv(U,me),pa(U.content)&&Dh(U.content)}catch(mn){throw ue&&(Ch(N),Ys(t.removed,Yt=>{Yt.element&&Ih(Yt.element)})),mn}if(ue){let mn=!1;if(Ys(t.removed,Yt=>{Yt.element&&(Yt.element===N&&(mn=!0),Ih(Yt.element))}),mn)throw Oi("a node selected for removal could not be safely returned; refusing to sanitize in place");return er&&sp(N),N}if($i){if(er&&sp(A),xi)for(X=ca.call(A.ownerDocument);A.firstChild;)X.appendChild(A.firstChild);else X=A;return(oe.shadowroot||oe.shadowrootmode)&&(X=Ci.call(r,X,!0)),X}let Fe=Dr?A.outerHTML:A.innerHTML;return Dr&&ce["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&pt(p9,A.ownerDocument.doctype.name)&&(Fe="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
439
+ `+Fe),er&&(Fe=$h(Fe)),F&&Or?We(Fe):Fe},t.setConfig=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};hc(N),Lr=!0,Ii=ce,Us=oe},t.clearConfig=function(){rr=null,Lr=!1,Ii=null,Us=null,F=Ne,re=""},t.isValidAttribute=function(N,w,A){rr||hc({});const M=Ue(N),U=Ue(w);return Nv(M,U,A)},t.addHook=function(N,w){typeof w=="function"&&Ft(Ee,N)&&bc(Ee[N],w)},t.removeHook=function(N,w){if(Ft(Ee,N)){if(w!==void 0){const A=YN(Ee[N],w);return A===-1?void 0:KN(Ee[N],A,1)[0]}return Ob(Ee[N])}},t.removeHooks=function(N){Ft(Ee,N)&&(Ee[N]=[])},t.removeAllHooks=function(){Ee=Wb()},t}var h4=u4();function gv(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var la=gv();function d4(n){la=n}var to={exec:()=>null};function ge(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(xt.caret,"$1"),e=e.replace(i,a),r},getRegex:()=>new RegExp(e,t)};return r}var _9=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),xt={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)}}>`)},A9=/^(?:[ \t]*(?:\n|$))+/,E9=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,k9=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,kh=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,T9=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,vv=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,f4=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,p4=ge(f4).replace(/bull/g,vv).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(),R9=ge(f4).replace(/bull/g,vv).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(),yv=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,C9=/^[^\n]+/,wv=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,I9=ge(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",wv).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),$9=ge(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,vv).getRegex(),np="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",bv=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,x9=ge("^ {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",bv).replace("tag",np).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),m4=ge(yv).replace("hr",kh).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",np).getRegex(),P9=ge(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",m4).getRegex(),Sv={blockquote:P9,code:E9,def:I9,fences:k9,heading:T9,hr:kh,html:x9,lheading:p4,list:$9,newline:A9,paragraph:m4,table:to,text:C9},Gb=ge("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",kh).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",np).getRegex(),D9={...Sv,lheading:R9,table:Gb,paragraph:ge(yv).replace("hr",kh).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Gb).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",np).getRegex()},L9={...Sv,html:ge(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",bv).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:to,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ge(yv).replace("hr",kh).replace("heading",` *#{1,6} *[^
440
+ ]`).replace("lheading",p4).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},O9=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,M9=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,g4=/^( {2,}|\\)\n(?!\s*$)/,N9=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ic=/[\p{P}\p{S}]/u,rp=/[\s\p{P}\p{S}]/u,_v=/[^\s\p{P}\p{S}]/u,z9=ge(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,rp).getRegex(),v4=/(?!~)[\p{P}\p{S}]/u,U9=/(?!~)[\s\p{P}\p{S}]/u,H9=/(?:[^\s\p{P}\p{S}]|~)/u,Z9=ge(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",_9?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),y4=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,q9=ge(y4,"u").replace(/punct/g,ic).getRegex(),V9=ge(y4,"u").replace(/punct/g,v4).getRegex(),w4="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",F9=ge(w4,"gu").replace(/notPunctSpace/g,_v).replace(/punctSpace/g,rp).replace(/punct/g,ic).getRegex(),B9=ge(w4,"gu").replace(/notPunctSpace/g,H9).replace(/punctSpace/g,U9).replace(/punct/g,v4).getRegex(),j9=ge("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,_v).replace(/punctSpace/g,rp).replace(/punct/g,ic).getRegex(),W9=ge(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ic).getRegex(),G9="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",J9=ge(G9,"gu").replace(/notPunctSpace/g,_v).replace(/punctSpace/g,rp).replace(/punct/g,ic).getRegex(),Y9=ge(/\\(punct)/,"gu").replace(/punct/g,ic).getRegex(),K9=ge(/^<(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(),X9=ge(bv).replace("(?:-->|$)","-->").getRegex(),Q9=ge("^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",X9).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),qd=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ez=ge(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",qd).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),b4=ge(/^!?\[(label)\]\[(ref)\]/).replace("label",qd).replace("ref",wv).getRegex(),S4=ge(/^!?\[(ref)\](?:\[\])?/).replace("ref",wv).getRegex(),tz=ge("reflink|nolink(?!\\()","g").replace("reflink",b4).replace("nolink",S4).getRegex(),Jb=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Av={_backpedal:to,anyPunctuation:Y9,autolink:K9,blockSkip:Z9,br:g4,code:M9,del:to,delLDelim:to,delRDelim:to,emStrongLDelim:q9,emStrongRDelimAst:F9,emStrongRDelimUnd:j9,escape:O9,link:ez,nolink:S4,punctuation:z9,reflink:b4,reflinkSearch:tz,tag:Q9,text:N9,url:to},nz={...Av,link:ge(/^!?\[(label)\]\((.*?)\)/).replace("label",qd).getRegex(),reflink:ge(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",qd).getRegex()},a1={...Av,emStrongRDelimAst:B9,emStrongLDelim:V9,delLDelim:W9,delRDelim:J9,url:ge(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Jb).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:ge(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Jb).getRegex()},rz={...a1,br:ge(g4).replace("{2,}","*").getRegex(),text:ge(a1.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},jh={normal:Sv,gfm:D9,pedantic:L9},Ac={normal:Av,gfm:a1,breaks:rz,pedantic:nz},iz={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Yb=n=>iz[n];function or(n,t){if(t){if(xt.escapeTest.test(n))return n.replace(xt.escapeReplace,Yb)}else if(xt.escapeTestNoEncode.test(n))return n.replace(xt.escapeReplaceNoEncode,Yb);return n}function Kb(n){try{n=encodeURI(n).replace(xt.percentDecode,"%")}catch{return null}return n}function Xb(n,t){var s;let e=n.replace(xt.findPipe,(a,l,c)=>{let u=!1,f=l;for(;--f>=0&&c[f]==="\\";)u=!u;return u?"|":" |"}),r=e.split(xt.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(xt.slashPipe,"|");return r}function Ec(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 sz(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 oz(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 Qb(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 az(n,t,e){let r=n.match(e.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
441
+ `).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(`
442
+ `)}var Vd=class{constructor(n){C(this,"options");C(this,"rules");C(this,"lexer");this.options=n||la}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:Ec(e,`
443
+ `)}}}fences(n){let t=this.rules.block.fences.exec(n);if(t){let e=t[0],r=az(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=Ec(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:Ec(t[0],`
444
+ `)}}blockquote(n){let t=this.rules.block.blockquote.exec(n);if(t){let e=Ec(t[0],`
445
+ `).split(`
446
+ `),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(`
447
+ `),f=u.replace(this.rules.other.blockquoteSetextReplace,`
448
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
449
+ ${u}`:u,i=i?`${i}
450
+ ${f}`:f;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(f,s,!0),this.lexer.state.top=p,e.length===0)break;let y=s.at(-1);if((y==null?void 0:y.type)==="code")break;if((y==null?void 0:y.type)==="blockquote"){let v=y,S=v.raw+`
451
+ `+e.join(`
452
+ `),_=this.blockquote(S);s[s.length-1]=_,r=r.substring(0,r.length-v.raw.length)+_.raw,i=i.substring(0,i.length-v.text.length)+_.text;break}else if((y==null?void 0:y.type)==="list"){let v=y,S=v.raw+`
453
+ `+e.join(`
454
+ `),_=this.list(S);s[s.length-1]=_,r=r.substring(0,r.length-y.raw.length)+_.raw,i=i.substring(0,i.length-v.raw.length)+_.raw,e=S.substring(s.at(-1).raw.length).split(`
455
+ `);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 f=!1,p="",y="";if(!(t=l.exec(n))||this.rules.block.hr.test(n))break;p=t[0],n=n.substring(p.length);let v=oz(t[2].split(`
456
+ `,1)[0],t[1].length),S=n.split(`
457
+ `,1)[0],_=!v.trim(),$=0;if(this.options.pedantic?($=2,y=v.trimStart()):_?$=t[1].length+1:($=v.search(this.rules.other.nonSpaceChar),$=$>4?1:$,y=v.slice($),$+=t[1].length),_&&this.rules.other.blankLine.test(S)&&(p+=S+`
458
+ `,n=n.substring(S.length+1),f=!0),!f){let H=this.rules.other.nextBulletRegex($),L=this.rules.other.hrRegex($),z=this.rules.other.fencesBeginRegex($),P=this.rules.other.headingBeginRegex($),B=this.rules.other.htmlBeginRegex($),q=this.rules.other.blockquoteBeginRegex($);for(;n;){let V=n.split(`
459
+ `,1)[0],Q;if(S=V,this.options.pedantic?(S=S.replace(this.rules.other.listReplaceNesting," "),Q=S):Q=S.replace(this.rules.other.tabCharGlobal," "),z.test(S)||P.test(S)||B.test(S)||q.test(S)||H.test(S)||L.test(S))break;if(Q.search(this.rules.other.nonSpaceChar)>=$||!S.trim())y+=`
460
+ `+Q.slice($);else{if(_||v.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||z.test(v)||P.test(v)||L.test(v))break;y+=`
461
+ `+S}_=!S.trim(),p+=V+`
462
+ `,n=n.substring(V.length+1),v=Q.slice($)}}a.loose||(c?a.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(c=!0)),a.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(y),loose:!1,text:y,tokens:[]}),a.raw+=p}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 f of a.items){if(this.lexer.state.top=!1,f.tokens=this.lexer.blockTokens(f.text,[]),f.task){if(f.text=f.text.replace(this.rules.other.listReplaceTask,""),((e=f.tokens[0])==null?void 0:e.type)==="text"||((r=f.tokens[0])==null?void 0:r.type)==="paragraph"){f.tokens[0].raw=f.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),f.tokens[0].text=f.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let y=this.lexer.inlineQueue.length-1;y>=0;y--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[y].src)){this.lexer.inlineQueue[y].src=this.lexer.inlineQueue[y].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(f.raw);if(p){let y={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};f.checked=y.checked,a.loose?f.tokens[0]&&["paragraph","text"].includes(f.tokens[0].type)&&"tokens"in f.tokens[0]&&f.tokens[0].tokens?(f.tokens[0].raw=y.raw+f.tokens[0].raw,f.tokens[0].text=y.raw+f.tokens[0].text,f.tokens[0].tokens.unshift(y)):f.tokens.unshift({type:"paragraph",raw:y.raw,text:y.raw,tokens:[y]}):f.tokens.unshift(y)}}if(!a.loose){let p=f.tokens.filter(v=>v.type==="space"),y=p.length>0&&p.some(v=>this.rules.other.anyLine.test(v.raw));a.loose=y}}if(a.loose)for(let f of a.items){f.loose=!0;for(let p of f.tokens)p.type==="text"&&(p.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=Xb(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(`
463
+ `):[],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(Xb(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)===`
464
+ `?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=Ec(e.slice(0,-1),"\\");if((e.length-s.length)%2===0)return}else{let s=sz(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)),Qb(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 Qb(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 f=[...r[0]][0].length,p=n.slice(0,i+r.index+f+a);if(Math.min(i,a)%2){let v=p.slice(1,-1);return{type:"em",raw:p,text:v,tokens:this.lexer.inlineTokens(v)}}let y=p.slice(2,-2);return{type:"strong",raw:p,text:y,tokens:this.lexer.inlineTokens(y)}}}}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,f=n.slice(0,i+r.index+u+a),p=f.slice(i,-i);return{type:"del",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}}}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}}}},Wn=class l1{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||la,this.options.tokenizer=this.options.tokenizer||new Vd,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:xt,block:jh.normal,inline:Ac.normal};this.options.pedantic?(e.block=jh.pedantic,e.inline=Ac.pedantic):this.options.gfm&&(e.block=jh.gfm,this.options.breaks?e.inline=Ac.breaks:e.inline=Ac.gfm),this.tokenizer.rules=e}static get rules(){return{block:jh,inline:Ac}}static lex(t,e){return new l1(e).lex(t)}static lexInline(t,e){return new l1(e).inlineTokens(t)}lex(t){t=t.replace(xt.carriageReturn,`
465
+ `),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(xt.tabCharGlobal," ").replace(xt.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+=`
466
+ `: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(`
467
+ `)?"":`
468
+ `)+l.raw,u.text+=`
469
+ `+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(`
470
+ `)?"":`
471
+ `)+l.raw,u.text+=`
472
+ `+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,f=t.slice(1),p;this.options.extensions.startBlock.forEach(y=>{p=y.call({lexer:this},f),typeof p=="number"&&p>=0&&(u=Math.min(u,p))}),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(`
473
+ `)?"":`
474
+ `)+l.raw,u.text+=`
475
+ `+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(`
476
+ `)?"":`
477
+ `)+l.raw,u.text+=`
478
+ `+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,f,p,y;this.tokenizer.lexer=this;let r=t,i=null;if(this.tokens.links){let v=Object.keys(this.tokens.links);if(v.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)v.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 v;if((p=(f=this.options.extensions)==null?void 0:f.inline)!=null&&p.some(_=>(v=_.call({lexer:this},t,e))?(t=t.substring(v.raw.length),e.push(v),!0):!1))continue;if(v=this.tokenizer.escape(t)){t=t.substring(v.raw.length),e.push(v);continue}if(v=this.tokenizer.tag(t)){t=t.substring(v.raw.length),e.push(v);continue}if(v=this.tokenizer.link(t)){t=t.substring(v.raw.length),e.push(v);continue}if(v=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(v.raw.length);let _=e.at(-1);v.type==="text"&&(_==null?void 0:_.type)==="text"?(_.raw+=v.raw,_.text+=v.text):e.push(v);continue}if(v=this.tokenizer.emStrong(t,r,l)){t=t.substring(v.raw.length),e.push(v);continue}if(v=this.tokenizer.codespan(t)){t=t.substring(v.raw.length),e.push(v);continue}if(v=this.tokenizer.br(t)){t=t.substring(v.raw.length),e.push(v);continue}if(v=this.tokenizer.del(t,r,l)){t=t.substring(v.raw.length),e.push(v);continue}if(v=this.tokenizer.autolink(t)){t=t.substring(v.raw.length),e.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(t))){t=t.substring(v.raw.length),e.push(v);continue}let S=t;if((y=this.options.extensions)!=null&&y.startInline){let _=1/0,$=t.slice(1),H;this.options.extensions.startInline.forEach(L=>{H=L.call({lexer:this},$),typeof H=="number"&&H>=0&&(_=Math.min(_,H))}),_<1/0&&_>=0&&(S=t.substring(0,_+1))}if(v=this.tokenizer.inlineText(S)){t=t.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(l=v.raw.slice(-1)),a=!0;let _=e.at(-1);(_==null?void 0:_.type)==="text"?(_.raw+=v.raw,_.text+=v.text):e.push(v);continue}if(t){let _="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(_);break}else throw new Error(_)}}return e}},Fd=class{constructor(n){C(this,"options");C(this,"parser");this.options=n||la}space(n){return""}code({text:n,lang:t,escaped:e}){var s;let r=(s=(t||"").match(xt.notSpaceStart))==null?void 0:s[0],i=n.replace(xt.endingNewline,"")+`
479
+ `;return r?'<pre><code class="language-'+or(r)+'">'+(e?i:or(i,!0))+`</code></pre>
480
+ `:"<pre><code>"+(e?i:or(i,!0))+`</code></pre>
481
+ `}blockquote({tokens:n}){return`<blockquote>
482
+ ${this.parser.parse(n)}</blockquote>
483
+ `}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:t}){return`<h${t}>${this.parser.parseInline(n)}</h${t}>
484
+ `}hr(n){return`<hr>
485
+ `}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+`>
486
+ `+r+"</"+i+`>
487
+ `}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
488
+ `}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
489
+ `}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>
490
+ <thead>
491
+ `+t+`</thead>
492
+ `+r+`</table>
493
+ `}tablerow({text:n}){return`<tr>
494
+ ${n}</tr>
495
+ `}tablecell(n){let t=this.parser.parseInline(n.tokens),e=n.header?"th":"td";return(n.align?`<${e} align="${n.align}">`:`<${e}>`)+t+`</${e}>
496
+ `}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>${or(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=Kb(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return t&&(s+=' title="'+or(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=Kb(n);if(i===null)return or(e);n=i;let s=`<img src="${n}" alt="${or(e)}"`;return t&&(s+=` title="${or(t)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:or(n.text)}},Ev=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}},Gn=class c1{constructor(t){C(this,"options");C(this,"renderer");C(this,"textRenderer");this.options=t||la,this.options.renderer=this.options.renderer||new Fd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ev}static parse(t,e){return new c1(e).parse(t)}static parseInline(t,e){return new c1(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}},Yh,Vc=(Yh=class{constructor(n){C(this,"options");C(this,"block");this.options=n||la}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?Wn.lex:Wn.lexInline}provideParser(){return this.block?Gn.parse:Gn.parseInline}},C(Yh,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),C(Yh,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Yh),lz=class{constructor(...n){C(this,"defaults",gv());C(this,"options",this.setOptions);C(this,"parse",this.parseMarkdown(!0));C(this,"parseInline",this.parseMarkdown(!1));C(this,"Parser",Gn);C(this,"Renderer",Fd);C(this,"TextRenderer",Ev);C(this,"Lexer",Wn);C(this,"Tokenizer",Vd);C(this,"Hooks",Vc);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 Fd(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 f=l.apply(i,u);return f===!1&&(f=c.apply(i,u)),f||""}}r.renderer=i}if(e.tokenizer){let i=this.defaults.tokenizer||new Vd(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 f=l.apply(i,u);return f===!1&&(f=c.apply(i,u)),f}}r.tokenizer=i}if(e.hooks){let i=this.defaults.hooks||new Vc;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];Vc.passThroughHooks.has(s)?i[a]=u=>{if(this.defaults.async&&Vc.passThroughHooksRespectAsync.has(s))return(async()=>{let p=await l.call(i,u);return c.call(i,p)})();let f=l.call(i,u);return c.call(i,f)}:i[a]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await l.apply(i,u);return p===!1&&(p=await c.apply(i,u)),p})();let f=l.apply(i,u);return f===!1&&(f=c.apply(i,u)),f}}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 Wn.lex(n,t??this.defaults)}parser(n,t){return Gn.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?Wn.lex:Wn.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?Gn.parse:Gn.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?Wn.lex:Wn.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?Gn.parse:Gn.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+=`
497
+ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+or(e.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(e);throw e}}},sa=new lz;function Te(n,t){return sa.parse(n,t)}Te.options=Te.setOptions=function(n){return sa.setOptions(n),Te.defaults=sa.defaults,d4(Te.defaults),Te};Te.getDefaults=gv;Te.defaults=la;Te.use=function(...n){return sa.use(...n),Te.defaults=sa.defaults,d4(Te.defaults),Te};Te.walkTokens=function(n,t){return sa.walkTokens(n,t)};Te.parseInline=sa.parseInline;Te.Parser=Gn;Te.parser=Gn.parse;Te.Renderer=Fd;Te.TextRenderer=Ev;Te.Lexer=Wn;Te.lexer=Wn.lex;Te.Tokenizer=Vd;Te.Hooks=Vc;Te.parse=Te;Te.options;Te.setOptions;Te.use;Te.walkTokens;Te.parseInline;Gn.parse;Wn.lex;h4.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function _4(n){const t=Te.parse(n,{async:!1});return h4.sanitize(t,{USE_PROFILES:{html:!0}})}const e8={restart_to_update:"Restart to update",restarting:"Restarting…"};var Ho,Xu,Fn,lf,A4,Al,cf;class cz extends hn{constructor(){super(...arguments);m(this,lf);m(this,Ho,null);m(this,Xu,Jn());m(this,Fn,null);m(this,Al,()=>{this.render()});m(this,cf,()=>{var e;(e=o(this,Fn))==null||e.restart()})}connected(){queueMicrotask(()=>{var r;if(!this.isConnected||o(this,Ho)!==null)return;const e=((r=o(this,Xu).value)==null?void 0:r.querySelector("dialog"))??null;if(e===null)throw new Error("Desktop upgrade gate requires its composed dialog");d(this,Ho,tp(e,()=>{}))})}disconnected(){var e,r;(e=o(this,Ho))==null||e.withdraw(),d(this,Ho,null),(r=o(this,Fn))==null||r.removeEventListener("change",o(this,Al)),d(this,Fn,null)}template(e,r,i){var l,c;h(this,lf,A4).call(this,r??null);const s=((l=o(this,Fn))==null?void 0:l.version)??null,a=((c=o(this,Fn))==null?void 0:c.restarting)??!1;return W`
498
+ <div class="desktop-upgrade-gate" ${vt(o(this,Xu))}>
499
+ ${ep(W`<div class="upgrade-gate-body" data-testid="upgrade-gate-body">${o4(_4(US(e,s!==null)))}</div>${s===null?de:W`<div class="upgrade-gate-actions"><button
500
+ intent="primary"
501
+ class="upgrade-gate-restart"
502
+ ?disabled=${a}
503
+ @click=${o(this,cf)}
504
+ >${a?e8.restarting:e8.restart_to_update}</button></div>`}`,i)}
505
+ </div>
506
+ `}}Ho=new WeakMap,Xu=new WeakMap,Fn=new WeakMap,lf=new WeakSet,A4=function(e){var r;e!==o(this,Fn)&&((r=o(this,Fn))==null||r.removeEventListener("change",o(this,Al)),d(this,Fn,e),e==null||e.addEventListener("change",o(this,Al)),e==null||e.subscribe())},Al=new WeakMap,cf=new WeakMap;const uz=dn(cz),hz=1400,Wh=new WeakMap;function dz(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 fz={writeClipboard:dz,scheduler:{setTimeout(n,t){return globalThis.setTimeout(n,t)},clearTimeout(n){globalThis.clearTimeout(n)}}};function pz(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=Wh.get(r);a&&a.scheduler.clearTimeout(a.handle);const l={handle:void 0,scheduler:t.scheduler};l.handle=t.scheduler.setTimeout(()=>{Wh.get(r)===l&&(Wh.delete(r),r.toggleAttribute("copied",!1),s&&(s.textContent=""))},hz),Wh.set(r,l),e()}function E4({label:n,prompt:t="",intent:e,size:r="sm",copied:i=!1,onActivate:s=()=>{}},a=fz){return W`
507
+ <button
508
+ class="copy-button"
509
+ size=${r==="default"?de:r}
510
+ aria-label=${n}
511
+ intent=${e??de}
512
+ ?copied=${i}
513
+ prompt=${t}
514
+ @click=${l=>pz(l,a,s)}
515
+ >
516
+ <span class="copy-button-idle"><tv-icon name="copy"></tv-icon>${n}</span>
517
+ <span class="copy-button-done"><tv-icon name="check"></tv-icon>Copied</span>
518
+ </button>
519
+ <span
520
+ class="copy-button-status"
521
+ role="status"
522
+ aria-live="polite"
523
+ >${i?"Copied":de}</span
524
+ >
525
+ `}const k4="1.4.0",mz="tv-desktop-upgrade-recommendation-dismissed",gz=`### Recommended desktop upgrade available
526
+
527
+ The Television desktop app is now a downloaded Mac app that updates itself. This copy was installed with npm and receives no more updates.
528
+
529
+ To move to the downloaded app on an Apple Silicon Mac:
530
+
531
+ 1. [Download Television for Mac](https://dl.todesktop.com/260923p52umxx/mac/dmg/arm64).
532
+ 2. Open the downloaded disk image and drag Television to Applications.
533
+ 3. Quit this app, then open Television from Applications. It keeps your saved server connection.
534
+
535
+ From then on, open Television from Applications, not with \`tv-desktop\`.`;function vz(n){var t;return!n.electron||n.noticesSuppressed||((t=n.updateState)==null?void 0:t.toast)!=null||n.shellVersion===null||!qf(n.shellVersion)||n.shellVersion===Cd?!1:K1(k4,n.shellVersion)}var El;class T4 extends HTMLElement{constructor(){super(...arguments);m(this,El,new dv(this))}connectedCallback(){o(this,El).connect()}disconnectedCallback(){o(this,El).disconnect()}attributeChangedCallback(){o(this,El).refresh()}}El=new WeakMap,C(T4,"observedAttributes",["open","trigger","manual"]);customElements.get("tv-popover")||customElements.define("tv-popover",T4);const yz="tv-update-dismissed",wa={update_available:"Update available",copy_prompt:"Copy upgrade prompt",later:"Later",restart_to_update:"Restart to update",restarting:"Restarting…"},wz="update-popover";function bz(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 kl,ai,Tl,Qu,eh,uf;class Sz extends hn{constructor(){super(...arguments);m(this,kl);m(this,ai);m(this,Tl,!1);m(this,Qu,()=>{});m(this,eh,()=>{});m(this,uf,e=>{var r;(r=o(this,ai))==null||r.disconnect(),d(this,ai,void 0),d(this,kl,e),d(this,Tl,(e==null?void 0:e.hasAttribute("open"))??!1),e&&(d(this,ai,new MutationObserver(()=>{const i=e.hasAttribute("open");i!==o(this,Tl)&&(d(this,Tl,i),i?o(this,Qu).call(this):o(this,eh).call(this))})),o(this,ai).observe(e,{attributes:!0,attributeFilter:["open"]}))})}disconnected(){var e;(e=o(this,ai))==null||e.disconnect(),d(this,ai,void 0),d(this,kl,void 0)}template({body:e,prompt:r,copied:i=!1,restart:s,panelRef:a,bellRef:l,onPresent:c=()=>{},onDismiss:u=()=>{},onCopy:f=()=>{},onRestart:p=()=>{}}){d(this,Qu,c),d(this,eh,u);const y=()=>{var S;(S=o(this,kl))==null||S.removeAttribute("open")},v=S=>{const _=S.currentTarget;S.key!=="Escape"||!bz(S,_)||(S.preventDefault(),S.stopPropagation(),_.removeAttribute("open"))};return W`
536
+ <button
537
+ class="update-bell"
538
+ id="update-bell"
539
+ icon
540
+ intent="alert"
541
+ aria-label=${wa.update_available}
542
+ title=${wa.update_available}
543
+ ${l===void 0?de:vt(l)}
544
+ >
545
+ <tv-icon name="notification" size="sm"></tv-icon>
546
+ </button>
547
+
548
+ <tv-popover
549
+ id=${wz}
550
+ manual
551
+ trigger="update-bell"
552
+ role="status"
553
+ class="update-popover"
554
+ ${vt(o(this,uf))}
555
+ ${a===void 0?de:vt(a)}
556
+ @keydown=${v}
557
+ >
558
+ ${e}
559
+ <div class="update-actions">
560
+ <button size="sm" class="update-later" @click=${y}
561
+ >${wa.later}</button
562
+ >
563
+ ${r===void 0?de:E4({label:wa.copy_prompt,prompt:r,intent:"primary",copied:i,onActivate:f})}
564
+ ${s===void 0?de:W`<button
565
+ size="sm"
566
+ intent="primary"
567
+ class="update-restart"
568
+ ?disabled=${s==="restarting"}
569
+ @click=${p}
570
+ >${s==="restarting"?wa.restarting:wa.restart_to_update}</button>`}
571
+ </div>
572
+ </tv-popover>
573
+ `}}kl=new WeakMap,ai=new WeakMap,Tl=new WeakMap,Qu=new WeakMap,eh=new WeakMap,uf=new WeakMap;const _z=dn(Sz);function Az(n,t){return t===null?!0:K1(n,t)}const t8=new Set;var An,on,th,an,nh,Rl,Er,Zo,qo,Vo,Cl,gt,li,Fo,Il,$l,Bo,gs,ee,u1,h1,d1,f1,p1,m1,g1,jo,Wo,wd,Fc,v1,R4,y1,w1,b1,hf,df,ff,pf,mf,gf,Bc,C4;class Ez{constructor(t=()=>{}){m(this,ee);m(this,An,null);m(this,on,null);m(this,th,null);m(this,an,null);m(this,nh,"");m(this,Rl);m(this,Er,!1);m(this,Zo,!1);m(this,qo,!1);m(this,Vo,!1);m(this,Cl,null);m(this,gt,!1);m(this,li,!1);m(this,Fo,null);m(this,Il,null);m(this,$l,!1);m(this,Bo,[]);m(this,gs);m(this,jo,()=>{o(this,gs).call(this)});m(this,Wo,()=>{h(this,ee,b1).call(this),o(this,gs).call(this)});m(this,hf,()=>{var e;const t=h(this,ee,Fc).call(this,((e=o(this,on))==null?void 0:e.toastsSuppressed)??!1);t===null||o(this,gt)||(d(this,gt,!0),t.kind==="server"&&h(this,ee,y1).call(this,t.toast),o(this,gs).call(this))});m(this,df,()=>{var e,r;if(!o(this,gt))return;const t=h(this,ee,Fc).call(this,((e=o(this,on))==null?void 0:e.toastsSuppressed)??!1);t!==null&&((r=h(this,ee,u1).call(this))==null||r.setItem(h(this,ee,v1).call(this,t),t.version)),d(this,gt,!1),d(this,li,!0),o(this,gs).call(this)});m(this,ff,()=>{var t;(t=o(this,an))==null||t.restart()});m(this,pf,()=>{var e;const t=h(this,ee,Fc).call(this,((e=o(this,on))==null?void 0:e.toastsSuppressed)??!1);(t==null?void 0:t.kind)!=="server"||t.prompt===void 0||h(this,ee,w1).call(this,"update_prompt_copy_clicked",t.toast)});m(this,mf,t=>{d(this,Fo,t instanceof HTMLElement?t:null),h(this,ee,Bc).call(this)});m(this,gf,t=>{d(this,Il,t instanceof HTMLElement?t:null),h(this,ee,Bc).call(this)});d(this,gs,t)}get presented(){return o(this,gt)}configure({connectionOwner:t=null,primaryServerURL:e="",presentation:r=null,dismissalStorage:i,desktopRecommendation:s=null,desktopUpdate:a=null}){t!==o(this,An)&&(h(this,ee,d1).call(this),d(this,An,t),h(this,ee,h1).call(this)),r!==o(this,on)&&(h(this,ee,p1).call(this),d(this,on,r),h(this,ee,f1).call(this)),a!==o(this,an)&&(h(this,ee,g1).call(this),d(this,an,a),h(this,ee,m1).call(this)),d(this,nh,e),d(this,Rl,i),d(this,th,s)}connect(){o(this,Er)||(d(this,Er,!0),h(this,ee,h1).call(this),h(this,ee,f1).call(this),h(this,ee,m1).call(this))}disconnect(){o(this,Er)&&(h(this,ee,d1).call(this),h(this,ee,p1).call(this),h(this,ee,g1).call(this),d(this,Er,!1),d(this,Fo,null),d(this,Il,null))}template(){var l,c,u;const t=((l=o(this,on))==null?void 0:l.toastsSuppressed)??!1,e=h(this,ee,Fc).call(this,t),r=e===null?null:`${e.kind}:${e.version}`;if(e===null?(d(this,Cl,null),d(this,gt,!1),d(this,li,!0)):r!==o(this,Cl)&&(d(this,Cl,r),d(this,gt,h(this,ee,R4).call(this,e)),d(this,li,!0),o(this,gt)&&e.kind==="server"&&!t&&h(this,ee,y1).call(this,e.toast)),e===null||t)return d(this,gt,!1),d(this,li,!0),h(this,ee,Bc).call(this),de;const i=(c=o(this,Fo))==null?void 0:c.querySelector(".copy-button"),s=o(this,gt)&&!o(this,li)&&(i==null?void 0:i.hasAttribute("copied"))===!0,a=_z({body:o4(_4(e.markdown)),prompt:e.kind==="server"?e.prompt:void 0,copied:s,restart:e.kind!=="desktop-self-update"?void 0:(u=o(this,an))!=null&&u.restarting?"restarting":"ready",presented:o(this,gt),panelRef:o(this,mf),bellRef:o(this,gf),onPresent:o(this,hf),onDismiss:o(this,df),onCopy:o(this,pf),onRestart:o(this,ff)});return d(this,li,!1),h(this,ee,Bc).call(this),a}}An=new WeakMap,on=new WeakMap,th=new WeakMap,an=new WeakMap,nh=new WeakMap,Rl=new WeakMap,Er=new WeakMap,Zo=new WeakMap,qo=new WeakMap,Vo=new WeakMap,Cl=new WeakMap,gt=new WeakMap,li=new WeakMap,Fo=new WeakMap,Il=new WeakMap,$l=new WeakMap,Bo=new WeakMap,gs=new WeakMap,ee=new WeakSet,u1=function(){return o(this,Rl)!==void 0?o(this,Rl):typeof localStorage>"u"?null:localStorage},h1=function(){!o(this,Er)||o(this,Zo)||o(this,An)===null||(o(this,An).addEventListener("server-status",o(this,Wo)),o(this,An).addEventListener("change",o(this,Wo)),d(this,Zo,!0))},d1=function(){!o(this,Zo)||o(this,An)===null||(o(this,An).removeEventListener("server-status",o(this,Wo)),o(this,An).removeEventListener("change",o(this,Wo)),d(this,Zo,!1))},f1=function(){!o(this,Er)||o(this,qo)||o(this,on)===null||(o(this,on).addEventListener("change",o(this,jo)),d(this,qo,!0))},p1=function(){!o(this,qo)||o(this,on)===null||(o(this,on).removeEventListener("change",o(this,jo)),d(this,qo,!1))},m1=function(){!o(this,Er)||o(this,Vo)||o(this,an)===null||(o(this,an).addEventListener("change",o(this,jo)),o(this,an).subscribe(),d(this,Vo,!0))},g1=function(){!o(this,Vo)||o(this,an)===null||(o(this,an).removeEventListener("change",o(this,jo)),d(this,Vo,!1))},jo=new WeakMap,Wo=new WeakMap,wd=function(){var e;const t=((e=o(this,An))==null?void 0:e.connection)??null;return(t==null?void 0:t.url)===o(this,nh)?t:null},Fc=function(t){var a,l;const e=((a=h(this,ee,wd).call(this))==null?void 0:a.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=t?null:((l=o(this,an))==null?void 0:l.version)??null;if(i!==null)return{kind:"desktop-self-update",version:i,markdown:cL(i)};const s=o(this,th);return s!==null&&vz({...s,noticesSuppressed:t,updateState:e})?{kind:"recommendation",version:k4,markdown:gz}:null},v1=function(t){switch(t.kind){case"server":return yz;case"desktop-self-update":return lL;case"recommendation":return mz}},R4=function(t){var r;const e=((r=h(this,ee,u1).call(this))==null?void 0:r.getItem(h(this,ee,v1).call(this,t)))??null;return t.kind==="desktop-self-update"?e!==t.version:Az(t.version,e!==null&&qf(e)?e:null)},y1=function(t){t8.has(t.version)||(t8.add(t.version),h(this,ee,w1).call(this,"update_toast_shown",t))},w1=function(t,e){var r;o(this,Bo).push({event:t,properties:{server_version:((r=h(this,ee,wd).call(this))==null?void 0:r.serverVersion)??"",channel_version:e.version}}),h(this,ee,b1).call(this)},b1=function(){if(o(this,Bo).length===0)return;const t=h(this,ee,wd).call(this);if(!t||t.status!=="connected")return;const e=o(this,Bo);d(this,Bo,[]);for(const r of e)t.sendTelemetrySignal(r.event,r.properties)},hf=new WeakMap,df=new WeakMap,ff=new WeakMap,pf=new WeakMap,mf=new WeakMap,gf=new WeakMap,Bc=function(){o(this,$l)||(d(this,$l,!0),queueMicrotask(()=>{d(this,$l,!1),h(this,ee,C4).call(this)}))},C4=function(){const t=o(this,Fo);t!==null&&(o(this,gt)&&o(this,Il)===null||t.toggleAttribute("open",o(this,gt)))};const kz=""+new URL("calendar-DToAnkzj.png",import.meta.url).href,Tz=""+new URL("table-oeG9uAN1.png",import.meta.url).href,Rz=""+new URL("tasks-D4xqXFPl.png",import.meta.url).href,Cz=""+new URL("markdown-DdDrJuVK.png",import.meta.url).href,n8="Artifact skills",Iz="Artifact skills",$z="Ready-made starting prompts for creating Television artifacts. Copy one, add the details of what you want, and send it to your agent.",xz="Copy prompt";function Gh({artifactSkill:n,name:t,description:e,prompt:r,thumbnail:i},s){return W`
574
+ <article class="skill-card">
575
+ <div class="skill-thumb"><img src=${i} alt="" /></div>
576
+ <div class="skill-name">${t}</div>
577
+ <p class="skill-desc">${e}</p>
578
+ ${E4({label:xz,prompt:r,onActivate:()=>s==null?void 0:s.sendTelemetrySignal("artifact_skill_prompt_copy_clicked",{artifact_skill:n})})}
579
+ </article>
580
+ `}class Pz extends hn{template(t=null){return W`
581
+ <button
582
+ class="skill-trigger"
583
+ variant="ghost"
584
+ icon
585
+ id="skills-trigger"
586
+ aria-label=${n8}
587
+ title=${n8}
588
+ >
589
+ <tv-icon name="skills" size="sm"></tv-icon>
590
+ </button>
591
+
592
+ <tv-popover
593
+ id="skills-popover"
594
+ trigger="skills-trigger"
595
+ class="skill-popover"
596
+ >
597
+ <div class="skill-heading">${Iz}</div>
598
+ <p class="skill-intro">${$z}</p>
599
+ <div class="skill-grid">
600
+ ${Gh({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:kz},t)}
601
+ ${Gh({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:Tz},t)}
602
+ ${Gh({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:Rz},t)}
603
+ ${Gh({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:Cz},t)}
604
+ </div>
605
+ </tv-popover>
606
+ `}}const Dz=dn(Pz),Lz=600;let Oz=0;const r8=new WeakMap,Vm=n=>{if(n.id)return n.id;let t=r8.get(n);if(!t){do t=`tv-select-${++Oz}`;while(n.ownerDocument.getElementById(t));r8.set(n,t)}return n.id=t,t},Jh=n=>{var t;return((t=n.textContent)==null?void 0:t.trim())??""};var rh;class I4 extends HTMLElement{constructor(){super();m(this,rh,this.attachInternals());o(this,rh).role="option"}connectedCallback(){this.attributeChangedCallback()}attributeChangedCallback(){o(this,rh).ariaSelected=String(this.hasAttribute("selected"))}}rh=new WeakMap,C(I4,"observedAttributes",["selected"]);var Rt,ci,xl,vs,ys,ih,ne,Ui,Da,S1,bd,Hi,Sd,_1,x4,_d,P4;class $4 extends HTMLElement{constructor(){super();m(this,ne);m(this,Rt,new dv(this,{select:!0,refresh:()=>h(this,ne,Sd).call(this),opened:()=>{d(this,ys,""),h(this,ne,Hi).call(this,h(this,ne,Da).call(this))},closed:()=>{h(this,ne,Hi).call(this,void 0),d(this,ys,"")},keydown:e=>h(this,ne,P4).call(this,e),pointermove:e=>{const r=h(this,ne,S1).call(this,e);r&&h(this,ne,Hi).call(this,r)},click:e=>{const r=h(this,ne,S1).call(this,e);r&&h(this,ne,_d).call(this,r)},selectedRow:()=>h(this,ne,Da).call(this),unpair:e=>h(this,ne,x4).call(this,e)}));m(this,ci);m(this,xl,"");m(this,vs);m(this,ys,"");m(this,ih,0);this.attachInternals().role="listbox"}connectedCallback(){o(this,Rt).connect()}disconnectedCallback(){o(this,Rt).disconnect()}attributeChangedCallback(){o(this,Rt).refresh()}get value(){var e;return((e=h(this,ne,Da).call(this))==null?void 0:e.getAttribute("value"))??""}set value(e){const r=h(this,ne,Ui).call(this).find(i=>i.getAttribute("value")===e);r&&(h(this,ne,bd).call(this,r),h(this,ne,Sd).call(this))}}Rt=new WeakMap,ci=new WeakMap,xl=new WeakMap,vs=new WeakMap,ys=new WeakMap,ih=new WeakMap,ne=new WeakSet,Ui=function(){return[...this.querySelectorAll("tv-option")].filter(e=>e.closest("tv-select")===this)},Da=function(){return h(this,ne,Ui).call(this).find(e=>e.hasAttribute("selected"))},S1=function(e){const r=e.closest("tv-option");return(r==null?void 0:r.closest("tv-select"))===this?r:void 0},bd=function(e){for(const r of h(this,ne,Ui).call(this))r.toggleAttribute("selected",r===e)},Hi=function(e){for(const r of h(this,ne,Ui).call(this))r.toggleAttribute("highlighted",r===e);if(o(this,Rt).trigger&&Ia(o(this,Rt).trigger,"aria-activedescendant",e?Vm(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)}},Sd=function(){var l;const e=h(this,ne,Ui).call(this),r=h(this,ne,Da).call(this)??e[0];r&&h(this,ne,bd).call(this,r);const i=o(this,Rt).trigger;if(!i)return;Ia(i,"role","combobox"),Ia(i,"aria-haspopup","listbox"),Ia(i,"aria-controls",Vm(this));for(const c of e)Vm(c);const s=e.find(c=>c.hasAttribute("highlighted"));Ia(i,"aria-activedescendant",this.hasAttribute("open")&&s?s.id:null);const a=r?Jh(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,ne,_1).call(this,i,e)},_1=function(e,r){if(o(this,vs)||(d(this,vs,new ResizeObserver(()=>{const c=o(this,Rt).trigger;c&&h(this,ne,_1).call(this,c,h(this,ne,Ui).call(this))})),o(this,vs).observe(e)),!e.getClientRects().length)return;const i=this.ownerDocument.defaultView.getComputedStyle(e),s=JSON.stringify([e.id,r.map(Jh),i.font,i.letterSpacing,i.padding,i.borderWidth,i.gap]);if(s===o(this,xl))return;d(this,xl,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=`${Jh(c)} `,l=Math.max(l,a.getBoundingClientRect().width);a.remove(),o(this,ci)??d(this,ci,this.ownerDocument.createElement("style")),o(this,ci).textContent=`:where(button[id="${CSS.escape(e.id)}"]) { width: ${l}px; }`,o(this,ci).isConnected||this.ownerDocument.head.append(o(this,ci))},x4=function(e){var r,i;for(const s of["role","aria-haspopup","aria-controls","aria-activedescendant"])e.removeAttribute(s);(r=o(this,vs))==null||r.disconnect(),d(this,vs,void 0),(i=o(this,ci))==null||i.remove(),d(this,ci,void 0),d(this,xl,"")},_d=function(e){const r=h(this,ne,Da).call(this)!==e;h(this,ne,bd).call(this,e),h(this,ne,Sd).call(this),o(this,Rt).close(),r&&this.dispatchEvent(new Event("change",{bubbles:!0}))},P4=function(e){if(!o(this,Rt).open)return this.ownerDocument.activeElement!==o(this,Rt).trigger||!["Enter"," ","ArrowDown","ArrowUp"].includes(e.key)?!1:(e.preventDefault(),e.stopImmediatePropagation(),o(this,Rt).show(!0),!0);const r=h(this,ne,Ui).call(this),i=r.findIndex(a=>a.hasAttribute("highlighted"));if(e.key==="Tab")return e.stopImmediatePropagation(),this.ownerDocument.activeElement!==o(this,Rt).trigger?(e.preventDefault(),!0):(r[i]&&h(this,ne,_d).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,ne,_d).call(this,r[i]);else if(e.key==="Home")h(this,ne,Hi).call(this,r[0]);else if(e.key==="End")h(this,ne,Hi).call(this,r.at(-1));else if(e.key==="ArrowDown"||e.key==="ArrowUp")h(this,ne,Hi).call(this,r[Math.max(0,Math.min(r.length-1,i+(e.key==="ArrowDown"?1:-1)))]);else{const a=performance.now();d(this,ys,a-o(this,ih)>Lz?e.key.toLowerCase():o(this,ys)+e.key.toLowerCase()),d(this,ih,a);const c=[...r.slice(i+1),...r.slice(0,i+1)].find(u=>Jh(u).toLowerCase().startsWith(o(this,ys)));c&&h(this,ne,Hi).call(this,c)}return!0},C($4,"observedAttributes",["open","trigger","manual"]);customElements.get("tv-option")||customElements.define("tv-option",I4);customElements.get("tv-select")||customElements.define("tv-select",$4);/**
607
+ * @license
608
+ * Copyright 2020 Google LLC
609
+ * SPDX-License-Identifier: BSD-3-Clause
610
+ */const Mz=rc(class extends Ah{constructor(n){if(super(n),n.type!==Ir.PROPERTY&&n.type!==Ir.ATTRIBUTE&&n.type!==Ir.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!r_(n))throw Error("`live` bindings can only contain a single expression")}render(n){return n}update(n,[t]){if(t===$t||t===de)return t;const e=n.element,r=n.name;if(n.type===Ir.PROPERTY){if(t===e[r])return $t}else if(n.type===Ir.BOOLEAN_ATTRIBUTE){if(!!t===e.hasAttribute(r))return $t}else if(n.type===Ir.ATTRIBUTE&&e.getAttribute(r)===t+"")return $t;return i_(n),t}}),i8="Settings",s8="Refresh themes",Nz="Themes directory",zz="None";function o8(n){return n instanceof Error?n.message:String(n)}var Zt,Go,ui,kr,sh,hi,di,Jo,Pl,Dl,Yn,D4,vf,yf,A1,wf,bf,Sf,Ad;class Uz extends hn{constructor(){super(...arguments);m(this,Yn);m(this,Zt,null);m(this,Go,null);m(this,ui,!1);m(this,kr,null);m(this,sh,!1);m(this,hi,0);m(this,di,null);m(this,Jo,!1);m(this,Pl,Jn());m(this,Dl,Jn());m(this,vf,e=>{var i;if((i=o(this,di))==null||i.disconnect(),d(this,di,null),d(this,Jo,!1),!e)return;const r=()=>{const s=e.hasAttribute("open");s!==o(this,Jo)&&(d(this,Jo,s),s&&h(this,Yn,A1).call(this,!1))};d(this,di,new MutationObserver(r)),o(this,di).observe(e,{attributes:!0,attributeFilter:["open"]}),r()});m(this,yf,()=>{h(this,Yn,A1).call(this,!0)});m(this,wf,e=>{var s;const r=e.currentTarget,i=r.value;r.value=((s=o(this,Zt))==null?void 0:s.snapshot.display.appearanceMode)??"system",this.render(),h(this,Yn,Ad).call(this,()=>{var a;return(a=o(this,Zt))==null?void 0:a.setAppearanceMode(i)},"Unable to change light/dark mode")});m(this,bf,e=>{var s;const r=e.currentTarget,i=r.value||null;r.value=((s=o(this,Zt))==null?void 0:s.snapshot.display.activeThemeName)??"",this.render(),h(this,Yn,Ad).call(this,()=>{var a;return(a=o(this,Zt))==null?void 0:a.setActiveTheme(i)},"Unable to change theme")});m(this,Sf,e=>{var a;const r=e.currentTarget,i=r.value,s=r.checked;r.checked=((a=o(this,Zt))==null?void 0:a.snapshot.display.themeJavaScriptConsentIds.includes(i))??!1,this.render(),h(this,Yn,Ad).call(this,()=>{var l;return(l=o(this,Zt))==null?void 0:l.setThemeJavaScriptConsent(i,s)},"Unable to change theme JavaScript consent")})}template(e){var p,y;d(this,Zt,e);const r=e.snapshot.connection.status==="connected";o(this,sh)&&!r&&h(this,Yn,D4).call(this),d(this,sh,r);const{activeThemeName:i,appearanceMode:s,themeJavaScriptConsentIds:a}=e.snapshot.display,l=((p=o(this,Go))==null?void 0:p.themes)??[],c=((y=o(this,Go))==null?void 0:y.errors)??[],u=i===null?void 0:l.find(v=>v.id===i&&v.enableMainJS===!0),f=i!==null&&a.includes(i);return queueMicrotask(()=>{var v,S;this.isConnected&&(o(this,Pl).value&&(o(this,Pl).value.value=((v=o(this,Zt))==null?void 0:v.snapshot.display.appearanceMode)??"system"),o(this,Dl).value&&(o(this,Dl).value.value=((S=o(this,Zt))==null?void 0:S.snapshot.display.activeThemeName)??""))}),W`
611
+ <button
612
+ class="settings-trigger"
613
+ variant="ghost"
614
+ icon
615
+ id="settings-trigger"
616
+ aria-label=${i8}
617
+ title=${i8}
618
+ >
619
+ <tv-icon name="settings" size="sm"></tv-icon>
620
+ </button>
621
+
622
+ <tv-popover
623
+ id="settings-popover"
624
+ trigger="settings-trigger"
625
+ class="settings-popover"
626
+ ${vt(o(this,vf))}
627
+ >
628
+ <div class="settings-heading">Settings</div>
629
+
630
+ <div class="settings-field">
631
+ <label id="settings-appearance-label">Light/dark mode</label>
632
+ <button id="settings-appearance" aria-labelledby="settings-appearance-label"></button>
633
+ <tv-select
634
+ trigger="settings-appearance"
635
+ name="appearance-mode"
636
+ ${vt(o(this,Pl))}
637
+ @change=${o(this,wf)}
638
+ >
639
+ <tv-option value="system" ?selected=${s==="system"}>Adapt to system</tv-option>
640
+ <tv-option value="light" ?selected=${s==="light"}>Light</tv-option>
641
+ <tv-option value="dark" ?selected=${s==="dark"}>Dark</tv-option>
642
+ </tv-select>
643
+ </div>
644
+
645
+ <div class="settings-field">
646
+ <label id="settings-theme-label">Theme</label>
647
+ <div class="settings-theme-control">
648
+ <button id="settings-theme" aria-labelledby="settings-theme-label"></button>
649
+ <tv-select
650
+ trigger="settings-theme"
651
+ name="theme"
652
+ ${vt(o(this,Dl))}
653
+ @change=${o(this,bf)}
654
+ >
655
+ <tv-option value="" ?selected=${i===null}>${zz}</tv-option>
656
+ ${l.map(v=>W`
657
+ <tv-option
658
+ value=${v.id}
659
+ ?selected=${v.id===i}
660
+ >${v.name}</tv-option>
661
+ `)}
662
+ </tv-select>
663
+ <button
664
+ type="button"
665
+ variant="ghost"
666
+ icon
667
+ aria-label=${s8}
668
+ title=${s8}
669
+ ?disabled=${o(this,ui)||!r}
670
+ @click=${o(this,yf)}
671
+ >
672
+ <tv-icon name="reload" size="sm"></tv-icon>
673
+ </button>
674
+ </div>
675
+ </div>
676
+
677
+ ${u?W`
678
+ <section
679
+ class="settings-javascript-consent"
680
+ aria-label="Experimental main-page JavaScript"
681
+ >
682
+ <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>
683
+ <label class="settings-javascript-toggle">
684
+ <input
685
+ type="checkbox"
686
+ role="switch"
687
+ name="theme-javascript-consent"
688
+ value=${u.id}
689
+ .checked=${Mz(f)}
690
+ @change=${o(this,Sf)}
691
+ >
692
+ <span>Enable experimental javascript for this theme</span>
693
+ </label>
694
+ </section>
695
+ `:null}
696
+
697
+ ${o(this,ui)?W`<p class="settings-status" role="status">Loading themes…</p>`:null}
698
+ ${o(this,kr)?W`<p class="settings-failure" role="alert">${o(this,kr)}</p>`:null}
699
+ ${c.length>0?W`
700
+ <div class="settings-errors" aria-label="Theme validation errors">
701
+ ${c.map(v=>W`
702
+ <p><strong>${v.folder??Nz}</strong>: ${v.error}</p>
703
+ `)}
704
+ </div>
705
+ `:null}
706
+ </tv-popover>
707
+ `}disconnected(){var e;(e=o(this,di))==null||e.disconnect(),d(this,di,null),d(this,Jo,!1),d(this,Zt,null),d(this,hi,o(this,hi)+1)}}Zt=new WeakMap,Go=new WeakMap,ui=new WeakMap,kr=new WeakMap,sh=new WeakMap,hi=new WeakMap,di=new WeakMap,Jo=new WeakMap,Pl=new WeakMap,Dl=new WeakMap,Yn=new WeakSet,D4=function(){d(this,Go,null),d(this,kr,null),d(this,ui,!1),d(this,hi,o(this,hi)+1)},vf=new WeakMap,yf=new WeakMap,A1=async function(e){const r=o(this,Zt);if(r===null||r.snapshot.connection.status!=="connected"||o(this,ui))return;const i=++Lh(this,hi)._;d(this,ui,!0),d(this,kr,null),this.render();try{const s=await(e?r.refreshThemes():r.listThemes());if(i!==o(this,hi))return;d(this,Go,s)}catch(s){if(i!==o(this,hi))return;d(this,kr,`${e?"Unable to refresh themes":"Unable to load themes"}: ${o8(s)}`)}finally{i===o(this,hi)&&(d(this,ui,!1),this.render())}},wf=new WeakMap,bf=new WeakMap,Sf=new WeakMap,Ad=async function(e,r){d(this,kr,null),this.render();try{await e()}catch(i){d(this,kr,`${r}: ${o8(i)}`),this.render()}};const Hz=dn(Uz),kc={start:"--item-fade-start",end:"--item-fade-end",left:"--item-fade-left",right:"--item-fade-right"},Zz=(n,{items:t,distance:e,edges:r})=>{const i=new Set;let s=0,a=!1;const l=v=>{v.removeAttribute("data-item-edge-fade");for(const S of Object.values(kc))v.style.removeProperty(S)},c=()=>{s=0;const v=new Set(n.querySelectorAll(t)),S=[];for(const q of i)v.has(q)||(f.unobserve(q),i.delete(q),S.push(q));for(const q of v)i.has(q)||(i.add(q),f.observe(q));const $=n.getBoundingClientRect().left+n.clientLeft,H=$+n.clientWidth,L=Math.max(0,Math.min(e,n.clientWidth/2)),z=n.scrollLeft>1?L:0,P=n.scrollLeft<n.scrollWidth-n.clientWidth-1?L:0,B=[...v].map(q=>({item:q,bounds:q.getBoundingClientRect()}));for(const q of S)l(q);for(const{item:q,bounds:V}of B){const Q=z>0&&V.left<$+z&&V.right>$,F=P>0&&V.right>H-P&&V.left<H;if(!Q&&!F){l(q);continue}q.style.setProperty(kc.start,`${$-V.left}px`),q.style.setProperty(kc.end,`${H-V.left}px`),q.style.setProperty(kc.left,`${z}px`),q.style.setProperty(kc.right,`${P}px`),q.setAttribute("data-item-edge-fade","")}},u=()=>{!a&&!s&&(s=requestAnimationFrame(c))},f=new ResizeObserver(u);f.observe(n);const p=new MutationObserver(u);return p.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),f.disconnect(),p.disconnect(),n.removeEventListener("scroll",u);for(const v of i)l(v);i.clear()}}}},Tc=.5;var qt,Ll,Ol,Yo,ws,Tr,fi,pi,bs,Ss,Bn,_s,Ml,As,Ko,oh,nt,mi,gi,En,_f,j,L4,O4,ah,lh,ch,Af,uh,La,E1,M4,Ed,k1,T1,R1,N4,z4,Nl,hh,U4,Ks,kd,H4,Z4,q4,V4,Oa,F4,jc;class qz extends hn{constructor(){super(...arguments);m(this,j);m(this,qt,Jn());m(this,Ll);m(this,Ol);m(this,Yo,!1);m(this,ws,0);m(this,Tr,!1);m(this,fi,!1);m(this,pi,!1);m(this,bs,0);m(this,Ss,null);m(this,Bn,!1);m(this,_s,null);m(this,Ml,null);m(this,As,null);m(this,Ko,null);m(this,oh,!1);m(this,nt,null);m(this,mi,!1);m(this,gi,!1);m(this,En,!1);m(this,_f,()=>{h(this,j,jc).call(this)});m(this,ah,e=>{var s;const r=o(this,nt);if(r===null||r.pointerId!==e.pointerId||!r.dragging&&Math.hypot(e.clientX-r.originX,e.clientY-r.originY)<=v_)return;const i=o(this,qt).value;if(i){if(r.currentX=e.clientX,r.currentY=e.clientY,r.dragging)this.render();else{h(this,j,Oa).call(this);const a=r.tab.getBoundingClientRect();d(this,mi,!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,j,R1).call(this,r))}h(this,j,T1).call(this,r),h(this,j,E1).call(this,r)}});m(this,lh,e=>{const r=o(this,nt);r===null||r.pointerId!==e.pointerId||h(this,j,La).call(this,!0,!0)});m(this,ch,e=>{var r;((r=o(this,nt))==null?void 0:r.pointerId)===e.pointerId&&h(this,j,La).call(this,!1,!0)});m(this,Af,e=>{var r;((r=o(this,nt))==null?void 0:r.pointerId)===e.pointerId&&h(this,j,La).call(this,!1,!0)});m(this,uh,e=>{var r;e.key!=="Escape"||!((r=o(this,nt))!=null&&r.dragging)||(e.preventDefault(),h(this,j,La).call(this,!1,!0))});m(this,Nl,()=>{d(this,Bn,!0),h(this,j,Ks).call(this,!1)});m(this,hh,()=>{d(this,Bn,!0),h(this,j,Ks).call(this,!0)})}connected(){var e;d(this,Ll,void 0),d(this,Ol,void 0),d(this,Bn,!1),h(this,j,U4).call(this),typeof document<"u"&&((e=document.fonts)==null||e.addEventListener("loadingdone",o(this,hh))),document.addEventListener("television-theme-styles-changed",o(this,Nl)),d(this,Ko,new MutationObserver(o(this,Nl))),o(this,Ko).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),window.addEventListener("pointermove",o(this,ah)),window.addEventListener("pointerup",o(this,lh)),window.addEventListener("pointercancel",o(this,ch)),window.addEventListener("keydown",o(this,uh))}template(e,r,i=null,s,a=!1){var $,H;h(this,j,F4).call(this,a);const l=($=o(this,nt))!=null&&$.dragging?o(this,nt):null,c=(l==null?void 0:l.provisionalPages)??(r==null?void 0:r.pages),u=Fz(r,c),f=(l==null?void 0:l.artifactId)??i,p=((H=r==null?void 0:r.selectedPage)==null?void 0:H.artifactIds[0])??null,y=`${(r==null?void 0:r.id)??""}:${u.map(({key:L,label:z})=>`${L}:${z}`).join("|")}`,v=p!==o(this,Ll),S=y!==o(this,Ol);v&&d(this,gi,!1);const _=v||l===null&&S;return S&&d(this,Bn,!0),d(this,Ll,p),d(this,Ol,y),h(this,j,Ks).call(this,_,v,v&&!S),W`
708
+ <div
709
+ class="tab-strip"
710
+ role="tablist"
711
+ ${vt(o(this,qt))}
712
+ ?tab-held=${l!==null}
713
+ @scroll=${o(this,_f)}
714
+ @lostpointercapture=${o(this,Af)}
715
+ >
716
+ ${Nd(u,({key:L})=>L,(L,z)=>{const P=L.artifactId!==null&&L.artifactId===p,B=L.artifactId!==null&&L.artifactId===f,q=B&&l!==null;return W`
717
+ ${B?W`
718
+ <span
719
+ class="tab-placeholder"
720
+ aria-hidden="true"
721
+ style=${zd(q?{width:`${l.tabWidth}px`,height:`${l.tabHeight}px`}:{})}
722
+ ></span>
723
+ `:null}
724
+ <div
725
+ class=${B?"tab dragged":"tab"}
726
+ ?dragging=${q}
727
+ style=${zd(q?{left:`${l.tabLeft+l.currentX-l.originX}px`,top:`${l.tabTop+l.currentY-l.originY}px`,width:`${l.tabWidth}px`,height:`${l.tabHeight}px`}:{})}
728
+ @keydown=${V=>{V.key!=="Enter"&&V.key!==" "||(V.preventDefault(),V.currentTarget.click())}}
729
+ role="tab"
730
+ aria-selected=${P?"true":"false"}
731
+ tabindex=${P?"0":"-1"}
732
+ data-artifact-id=${L.artifactId??""}
733
+ @pointerdown=${f===null?V=>h(this,j,L4).call(this,V,e,r,L,s):null}
734
+ @click=${V=>h(this,j,O4).call(this,V,e,r,L)}
735
+ @dblclick=${P&&r!==null&&!q?()=>Xg(e,r,L.page,!L.page.geometry.full_screen):null}
736
+ >
737
+ <span class="tab-label">${L.label}</span>
738
+ </div>
739
+ `})}
740
+ </div>
741
+ `}disconnected(){var e,r,i,s;d(this,Yo,!1),typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o(this,ws)),d(this,ws,0),d(this,Tr,!1),d(this,fi,!1),d(this,pi,!1),h(this,j,Oa).call(this),d(this,gi,!1),d(this,Bn,!1),(e=o(this,_s))==null||e.disconnect(),d(this,_s,null),d(this,Ml,null),(r=o(this,As))==null||r.dispose(),d(this,As,null),(i=o(this,Ko))==null||i.disconnect(),d(this,Ko,null),document.removeEventListener("television-theme-styles-changed",o(this,Nl)),typeof document<"u"&&((s=document.fonts)==null||s.removeEventListener("loadingdone",o(this,hh))),window.removeEventListener("pointermove",o(this,ah)),window.removeEventListener("pointerup",o(this,lh)),window.removeEventListener("pointercancel",o(this,ch)),window.removeEventListener("keydown",o(this,uh)),h(this,j,La).call(this,!1,!1),d(this,mi,!1)}}qt=new WeakMap,Ll=new WeakMap,Ol=new WeakMap,Yo=new WeakMap,ws=new WeakMap,Tr=new WeakMap,fi=new WeakMap,pi=new WeakMap,bs=new WeakMap,Ss=new WeakMap,Bn=new WeakMap,_s=new WeakMap,Ml=new WeakMap,As=new WeakMap,Ko=new WeakMap,oh=new WeakMap,nt=new WeakMap,mi=new WeakMap,gi=new WeakMap,En=new WeakMap,_f=new WeakMap,j=new WeakSet,L4=function(e,r,i,s,a){o(this,En)||o(this,nt)!==null||i===null||s.artifactId===null||e.button!==0||!e.isPrimary||(d(this,mi,!1),d(this,nt,{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}))},O4=function(e,r,i,s){var a;if(e.detail!==0&&o(this,mi)){d(this,mi,!1);return}d(this,mi,!1),!((a=o(this,nt))!=null&&a.dragging||i===null||s.artifactId===null)&&r.selectPage(i.id,s.artifactId)},ah=new WeakMap,lh=new WeakMap,ch=new WeakMap,Af=new WeakMap,uh=new WeakMap,La=function(e,r){var a;const i=o(this,nt);if(i===null)return;if(h(this,j,Ed).call(this,i),i.edgeScrollMoved&&d(this,gi,!0),i.dragging&&(d(this,Tr,o(this,fi)),o(this,fi)||d(this,pi,!1)),i.dragging&&e&&!Bz(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,nt,null),(a=i.onReorderChange)==null||a.call(i,null);const s=o(this,qt).value;i.dragging&&(s!=null&&s.hasPointerCapture(i.pointerId))&&s.releasePointerCapture(i.pointerId),r&&this.render()},E1=function(e){const r=o(this,qt).value,i=r?h(this,j,k1).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)<=Tc:((r==null?void 0:r.scrollLeft)??0)>=s-Tc;if(o(this,En)||!e.dragging||i===0||s===0||a||typeof requestAnimationFrame!="function"){h(this,j,Ed).call(this,e);return}e.edgeScrollFrame===0&&(e.edgeScrollFrame=requestAnimationFrame(l=>{h(this,j,M4).call(this,e,l)}))},M4=function(e,r){if(e.edgeScrollFrame=0,o(this,En)||o(this,nt)!==e||!e.dragging){e.edgeScrollTimestamp=null;return}const i=o(this,qt).value;if(!i){e.edgeScrollTimestamp=null;return}const s=h(this,j,k1).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,f=s*l+e.edgeScrollRemainder,p=Math.max(0,Math.min(c,u+f));i.scrollLeft=p;const y=i.scrollLeft-u;y!==0&&(e.edgeScrollMoved=!0),e.edgeScrollRemainder=p===0||p===c?0:f-y,y!==0&&(h(this,j,jc).call(this,i),h(this,j,T1).call(this,e))}h(this,j,E1).call(this,e)},Ed=function(e){e.edgeScrollFrame!==0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(e.edgeScrollFrame),e.edgeScrollFrame=0,e.edgeScrollTimestamp=null,e.edgeScrollRemainder=0},k1=function(e,r){const i=e.getBoundingClientRect();return r>=i.left&&r<i.left+Cn?-Ud*(i.left+Cn-r)/Cn:r>i.right-Cn&&r<=i.right?Ud*(r-(i.right-Cn))/Cn:0},T1=function(e){var S;const r=o(this,qt).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 _=u.getBoundingClientRect();if(l>=_.left+_.width/2)break;c-=1,u=u.previousElementSibling}let f=s==null?void 0:s.nextElementSibling;for(;f!=null&&f.classList.contains("tab");){const _=f.getBoundingClientRect();if(l<=_.left+_.width/2)break;c+=1,f=f.nextElementSibling}if(c===e.slot)return;const p=h(this,j,N4).call(this,r),y=[...e.provisionalPages],[v]=y.splice(e.slot,1);v&&(y.splice(c,0,v),e.provisionalPages=y,e.slot=c,this.render(),(S=e.onReorderChange)==null||S.call(e,h(this,j,R1).call(this,e)),queueMicrotask(()=>h(this,j,z4).call(this,e,p)))},R1=function(e){return{channelId:e.channelId,pages:e.provisionalPages,carriedArtifactId:e.artifactId}},N4=function(e){return new Map([...e.querySelectorAll(".tab:not([dragging])")].map(r=>[r.dataset.artifactId??"",r.getBoundingClientRect().left]))},z4=function(e,r){if(o(this,En))return;const i=o(this,qt).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)<=Tc)continue;const c=s.animate({translate:[`${l}px 0`,"0px 0"]},{duration:za,easing:"ease"});e.displacementAnimations.add(c),c.finished.finally(()=>{e.displacementAnimations.delete(c)}).catch(()=>{})}},Nl=new WeakMap,hh=new WeakMap,U4=function(){o(this,oh)||typeof document>"u"||!document.fonts||(d(this,oh,!0),document.fonts.ready.then(()=>{this.isConnected&&(d(this,Bn,!0),h(this,j,Ks).call(this,!0))}))},Ks=function(e,r=!1,i=!1){o(this,Tr)||d(this,Tr,e),e&&r&&(d(this,fi,!0),d(this,pi,i&&!o(this,En))),!(o(this,Yo)||o(this,ws)!==0)&&(d(this,Yo,!0),queueMicrotask(()=>{if(d(this,Yo,!1),!!this.isConnected){if(typeof requestAnimationFrame!="function"){h(this,j,kd).call(this);return}d(this,ws,requestAnimationFrame(()=>{d(this,ws,0),h(this,j,kd).call(this)}))}}))},kd=function(){var l,c;const e=o(this,qt).value;if(!e)return;o(this,Bn)&&(d(this,Bn,!1),h(this,j,Z4).call(this,e)),h(this,j,q4).call(this,e),h(this,j,H4).call(this,e);const r=((l=o(this,nt))==null?void 0:l.dragging)===!0,i=o(this,fi),s=i&&o(this,pi),a=!r&&(i||o(this,Tr)&&!o(this,gi));r?d(this,Tr,i):(d(this,Tr,!1),d(this,fi,!1),d(this,pi,!1),i&&d(this,gi,!1)),a&&h(this,j,V4).call(this,e,s),h(this,j,jc).call(this,e),(c=o(this,As))==null||c.refresh()},H4=function(e){for(const r of e.querySelectorAll(".tab-label"))r.toggleAttribute("data-overflow",r.scrollWidth>r.clientWidth)},Z4=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=Rc(c.paddingLeft)+Rc(c.paddingRight)+Rc(c.borderLeftWidth)+Rc(c.borderRightWidth),p=Math.ceil(l.width)+u>eN+tN?"capped":"hugging";i.dataset.compression!==p&&(i.dataset.compression=p)}},q4=function(e){var r,i;typeof ResizeObserver>"u"||o(this,Ml)===e||((r=o(this,_s))==null||r.disconnect(),o(this,_s)??d(this,_s,new ResizeObserver(()=>{o(this,En)?(d(this,Tr,!0),h(this,j,kd).call(this)):h(this,j,Ks).call(this,!0)})),o(this,_s).observe(e),d(this,Ml,e),(i=o(this,As))==null||i.dispose(),d(this,As,Zz(e,{items:".tab:not(.dragged)",distance:nN,edges:"both"})))},V4=function(e,r){const i=e.querySelector('.tab[aria-selected="true"]');if(!i){h(this,j,Oa).call(this);return}const s=e.getBoundingClientRect(),a=i.getBoundingClientRect(),l=Rc(getComputedStyle(i).translate),c=Math.max(0,Math.min(e.scrollLeft+a.left-l+a.width/2-(s.left+s.width/2),e.scrollWidth-e.clientWidth));if(h(this,j,Oa).call(this),o(this,En)||!r||Math.abs(e.scrollLeft-c)<=Tc||matchMedia("(prefers-reduced-motion: reduce)").matches){e.scrollLeft=c;return}const u=e.scrollLeft,f=e.animate([{},{}],{duration:z_,easing:"ease"});d(this,Ss,f);const p=()=>{var v;if(f!==o(this,Ss))return;const y=f.playState==="finished"?1:((v=f.effect)==null?void 0:v.getComputedTiming().progress)??0;e.scrollLeft=u+(c-u)*y,f.playState==="finished"?(e.scrollLeft=c,d(this,Ss,null),d(this,bs,0),h(this,j,jc).call(this,e)):d(this,bs,requestAnimationFrame(p))};d(this,bs,requestAnimationFrame(p))},Oa=function(){var e;typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o(this,bs)),d(this,bs,0),(e=o(this,Ss))==null||e.cancel(),d(this,Ss,null)},F4=function(e){var i;if(o(this,En)===e||(d(this,En,e),!e))return;h(this,j,Oa).call(this),d(this,pi,!1),d(this,gi,!1);const r=o(this,nt);if(r!==null){h(this,j,Ed).call(this,r);for(const s of r.displacementAnimations)s.cancel();r.displacementAnimations.clear(),d(this,nt,null),r.dragging&&((i=o(this,qt).value)!=null&&i.hasPointerCapture(r.pointerId))&&o(this,qt).value.releasePointerCapture(r.pointerId),queueMicrotask(()=>{var s;return(s=r.onReorderChange)==null?void 0:s.call(r,null)})}h(this,j,Ks).call(this,!0,!0,!1)},jc=function(e=o(this,qt).value){if(!e)return;const r=Math.max(0,e.scrollWidth-e.clientWidth);e.toggleAttribute("data-overflow",r>Tc)};const Vz=dn(qz);function Fz(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 Bz(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}function Rc(n){const t=Number.parseFloat(n);return Number.isFinite(t)?t:0}let jz=0;var Xo,Vt,dh,Ct,vi,Rr,zl,yi,fh,kn,Ef,kf,ph,jl,B4,Tf,Rf,j4,Cf,If;class Wz extends hn{constructor(){super(...arguments);m(this,jl);m(this,Xo,new Ez(()=>this.render()));m(this,Vt,new y_(()=>this.render()));m(this,dh,`channel-switcher-trigger-${++jz}`);m(this,Ct,null);m(this,vi,null);m(this,Rr,!1);m(this,zl,null);m(this,yi,null);m(this,fh,Jn());m(this,kn,null);m(this,Ef,e=>{var r,i,s;(r=o(this,Ct))==null||r.removeAttribute("open"),((i=o(this,yi))==null?void 0:i.display.focusedChannelId)!==e&&((s=o(this,zl))==null||s.focusChannel(e).catch(()=>{}))});m(this,kf,e=>{o(this,Rr)||(d(this,Rr,!0),this.render(),e.detail===0&&requestAnimationFrame(()=>{var r;(r=o(this,Ct))!=null&&r.hasAttribute("open")&&h(this,jl,B4).call(this,0)}))});m(this,ph,e=>{const r=o(this,Ct);r===null||!r.hasAttribute("open")||o(this,Vt).dragging||r.querySelector("input, tv-menu[open]")||u_(e,[...r.querySelectorAll('.channel[role="option"]')])});m(this,Tf,e=>{var r,i;d(this,kn,{channelId:e,scrollTop:((i=(r=o(this,Ct))==null?void 0:r.querySelector(".channel-switcher-pop-body"))==null?void 0:i.scrollTop)??0,result:null})});m(this,Rf,(e,r)=>{var i;((i=o(this,kn))==null?void 0:i.channelId)===e&&(o(this,kn).result=r?"deleted":"cancelled",this.render())});m(this,Cf,e=>{var r;(r=o(this,vi))==null||r.disconnect(),d(this,vi,null),o(this,Ct)!==null&&o(this,kn)===null&&o(this,Vt).disconnect(),d(this,Ct,e instanceof HTMLElement?e:null),o(this,Ct)!==null&&(o(this,Vt).connect(),d(this,vi,new MutationObserver(o(this,If))),o(this,vi).observe(o(this,Ct),{attributes:!0,attributeFilter:["open"]}))});m(this,If,()=>{var e;(((e=o(this,Ct))==null?void 0:e.hasAttribute("open"))??!0)||o(this,kn)===null&&(d(this,Rr,!1),this.render())})}connected(){o(this,Xo).connect(),document.addEventListener("keydown",o(this,ph))}template(e,r,i={}){var l;d(this,zl,e),d(this,yi,r);const s=i.collapsed||i.sidebarTransitioning;(i.sidebarTransitioning||!s||r.focusedChannel===null)&&d(this,Rr,!1),o(this,Vt).update(e,r,{management:!0,dragging:!0,revealMovedRow:!0,onDeleteStart:o(this,Tf),onDeleteEnd:o(this,Rf),selectChannel:o(this,Ef),highlightOnPointerMove:!0,motionSuppressed:i.sidebarTransitioning});const a=o(this,kn);return a!=null&&a.result&&(r.channels.length===0||r.focusedChannel!==null)&&(a.result==="cancelled"||!r.channels.some(({id:c})=>c===a.channelId))&&queueMicrotask(()=>h(this,jl,j4).call(this,a)),o(this,Xo).configure({connectionOwner:i.connectionOwner,primaryServerURL:i.primaryServerURL,presentation:i.updatePresentation,desktopRecommendation:i.desktopRecommendation,desktopUpdate:i.desktopUpdate,dismissalStorage:i.dismissalStorage}),i.onRenderComplete&&queueMicrotask(i.onRenderComplete),W`
742
+ <header class="top-bar" ${vt(o(this,fh))}>
743
+ ${s?W`
744
+ <div class="top-bar-lead">
745
+ ${i.sidebarToggle===void 0?W`
746
+ <button
747
+ class="sidebar-expand"
748
+ variant="ghost"
749
+ icon
750
+ aria-label="Show sidebar"
751
+ title="Show sidebar"
752
+ type="button"
753
+ @click=${i.onExpandSidebar}
754
+ >
755
+ <tv-icon name="sidebar" size="sm"></tv-icon>
756
+ </button>
757
+ `:i.sidebarToggle??W`
758
+ <span class="sidebar-toggle-seat" aria-hidden="true"></span>
759
+ `}
760
+ ${r.focusedChannel===null?null:W`
761
+ <button
762
+ class="channel-switcher"
763
+ variant="ghost"
764
+ target
765
+ aria-haspopup="listbox"
766
+ id=${o(this,dh)}
767
+ type="button"
768
+ @click=${o(this,kf)}
769
+ >
770
+ <span class="channel-switcher-name">
771
+ ${r.focusedChannel.name}
772
+ </span>
773
+ <tv-icon name="select" size="sm"></tv-icon>
774
+ </button>
775
+ ${o(this,Rr)?W`
776
+ <tv-popover
777
+ class="channel-switcher-pop"
778
+ ?dragging=${o(this,Vt).dragging}
779
+ trigger=${o(this,dh)}
780
+ ${vt(o(this,Cf))}
781
+ >
782
+ <div class="channel-switcher-pop-body">
783
+ ${o(this,Vt).template()}
784
+ </div>
785
+ <footer class="channel-switcher-pop-footer">
786
+ <button
787
+ class="channel-create"
788
+ variant="ghost"
789
+ icon
790
+ aria-label="New channel"
791
+ title="New channel"
792
+ type="button"
793
+ ?disabled=${o(this,Vt).creating}
794
+ @click=${o(this,Vt).create}
795
+ >
796
+ <tv-icon name="add"></tv-icon>
797
+ </button>
798
+ </footer>
799
+ </tv-popover>
800
+ `:null}
801
+ `}
802
+ </div>
803
+ `:null}
804
+ ${Vz(e,r.focusedChannel,null,i.onTabReorderChange,i.sidebarTransitioning)}
805
+ <div class="top-bar-controls">
806
+ ${Dz((l=i.connectionOwner)==null?void 0:l.connection)}
807
+ ${Hz(e)}
808
+ ${o(this,Xo).template()}
809
+ </div>
810
+ </header>
811
+ ${o(this,Vt).overlayTemplate()}
812
+ `}disconnected(){var e;o(this,Xo).disconnect(),document.removeEventListener("keydown",o(this,ph)),o(this,Vt).disconnect(),(e=o(this,vi))==null||e.disconnect(),d(this,vi,null),d(this,Ct,null),d(this,Rr,!1),d(this,zl,null),d(this,yi,null),d(this,kn,null)}}Xo=new WeakMap,Vt=new WeakMap,dh=new WeakMap,Ct=new WeakMap,vi=new WeakMap,Rr=new WeakMap,zl=new WeakMap,yi=new WeakMap,fh=new WeakMap,kn=new WeakMap,Ef=new WeakMap,kf=new WeakMap,ph=new WeakMap,jl=new WeakSet,B4=function(e){var r;su((r=o(this,Ct))==null?void 0:r.querySelectorAll('.channel[role="option"]')[e])},Tf=new WeakMap,Rf=new WeakMap,j4=function(e){var u,f;if(o(this,kn)!==e||o(this,yi)===null)return;d(this,kn,null);const r=o(this,yi).focusedChannel;d(this,Rr,r!==null),this.render();const i=o(this,Ct);if(i===null){o(this,Vt).disconnect(),(f=(u=o(this,fh).value)==null?void 0:u.querySelector(".sidebar-expand"))==null||f.focus();return}i.setAttribute("open","");const s=i.querySelector(".channel-switcher-pop-body");s&&(s.scrollTop=e.scrollTop);const a=e.result==="cancelled"&&o(this,yi).channels.some(({id:p})=>p===e.channelId)?e.channelId:r==null?void 0:r.id,l=[...i.querySelectorAll(".channel-row")].find(p=>p.dataset.channelId===a),c=l==null?void 0:l.querySelector(".channel");c==null||c.focus({preventScroll:!0}),e.result==="deleted"&&(c==null||c.scrollIntoView({block:"nearest"}))},Cf=new WeakMap,If=new WeakMap;const Gz=dn(Wz);var Cr,mh,Qo,Ul,It,ln,Tn,Rn,ea,Ie,jn,Es,Hl,ks,gh,$f,ta,xf,Pf,Df,K,Td,C1,W4,vh,Lf,Zi,Xs,Wc,Rd,I1,G4,J4,Of,Mf,Nf,yh,zf,Qs,Gc,Y4;class Jz extends hn{constructor(){super(...arguments);m(this,K);m(this,Cr,null);m(this,mh);m(this,Qo,null);m(this,Ul,null);m(this,It,qh);m(this,ln,!1);m(this,Tn,null);m(this,Rn,null);m(this,ea,null);m(this,Ie,!1);m(this,jn,!1);m(this,Es,qh);m(this,Hl,0);m(this,ks,null);m(this,gh,e=>{var r;if(e.key==="Escape"&&o(this,Tn)!==null){e.preventDefault(),e.stopPropagation(),h(this,K,Qs).call(this);return}PA(e,navigator.platform)&&(e.preventDefault(),e.stopPropagation(),(r=o(this,Cr))==null||r.handleNavigationKey(e.key))});m(this,$f,e=>{d(this,mh,e??void 0),this.render()});m(this,ta,()=>{this.render()});m(this,xf,()=>h(this,K,Td).call(this,!0));m(this,Pf,()=>h(this,K,Td).call(this,!1));m(this,Df,()=>{const e=o(this,Ie)?!o(this,jn):!o(this,ln);h(this,K,Td).call(this,e)});m(this,vh,e=>{const r=o(this,ks),i=h(this,K,Xs).call(this).closest("#app");if(!r||!i)return;d(this,Es,e);const s=sN(1-e/r.expandedSidebarWidth,r),a=(c,u)=>{i.style.setProperty(`--motion-${c}`,`${u}px`)};a("boundary",s.sidebarBoundary),a("toggle-left",s.toggleLeft),a("toggle-top",r.toggleTop),a("toggle-width",r.toggleWidth),a("toggle-height",r.toggleHeight),a("toggle-wipe",s.toggleWipe),a("lead-reservation",s.leadReservation),a("switcher-left",r.collapsedToggleLeft+r.toggleWidth+r.toggleSwitcherGap-s.sidebarBoundary-r.barInset),i.style.setProperty("--motion-titlebar-opacity",String(s.titlebarOpacity)),i.style.setProperty("--motion-switcher-opacity",String(s.switcherOpacity));const l=h(this,K,Xs).call(this);l.style.removeProperty("left"),l.style.removeProperty("top")});m(this,Lf,e=>{var s;if(!o(this,Ie))return;const r=e===0;if(r!==o(this,jn))return;const i=document.activeElement===o(this,Rn);h(this,K,Zi).call(this,r),this.render(),i&&((s=o(this,Rn))==null||s.focus({preventScroll:!0}))});m(this,Of,e=>{if(e.button!==0||o(this,Tn)!==null)return;const r=e.currentTarget,i=r.closest("#app");i!==null&&(r.setPointerCapture(e.pointerId),d(this,Tn,{pointerId:e.pointerId,startX:e.clientX,startWidth:o(this,It),root:i}),e.preventDefault())});m(this,Mf,e=>{const r=o(this,Tn);r===null||e.pointerId!==r.pointerId||h(this,K,Gc).call(this,r.root,r.startWidth+e.clientX-r.startX)});m(this,Nf,e=>{var s;const r=o(this,Tn);if(r===null||e.pointerId!==r.pointerId)return;d(this,Tn,null);const i=((s=o(this,Qo))==null?void 0:s.commit(o(this,It)))??o(this,It);h(this,K,Gc).call(this,r.root,i)});m(this,yh,e=>{const r=o(this,Tn);r===null||e.pointerId!==r.pointerId||h(this,K,Qs).call(this)});m(this,zf,e=>{var i;const r=e.currentTarget.closest("#app");r!==null&&((i=o(this,Qo))==null||i.clear(),h(this,K,Gc).call(this,r,qh))})}update(e,r){const i=r[0],s=r[1].sidebarWidthPreference,a=r[1].sidebarCollapsedPreference;o(this,Cr)!==i&&(o(this,Cr)!==null&&this.isConnected&&(o(this,Cr).removeEventListener("change",o(this,ta)),i.addEventListener("change",o(this,ta))),d(this,Cr,i));const l=o(this,Qo)!==s,c=o(this,Ul)!==a;return l&&(h(this,K,Qs).call(this),d(this,Qo,s),d(this,It,s.read()??qh)),c&&(h(this,K,Qs).call(this),d(this,Ul,a),d(this,ln,a.read())),(l||c)&&h(this,K,Zi).call(this,o(this,ln)),super.update(e,r)}connected(){var e;(e=o(this,Cr))==null||e.addEventListener("change",o(this,ta)),document.addEventListener("keydown",o(this,gh),{capture:!0})}disconnected(){var e,r;h(this,K,Qs).call(this),o(this,Ie)?h(this,K,Zi).call(this,o(this,jn)):(e=o(this,ea))==null||e.cancel(),(r=o(this,Cr))==null||r.removeEventListener("change",o(this,ta)),document.removeEventListener("keydown",o(this,gh),{capture:!0})}template(e,r){const i=xL(e.snapshot,r.runtimeServerURL),s=e.snapshot,a=Kz(i,s.connection.hasEverConnected);return r.onRenderComplete&&queueMicrotask(()=>{var l;this.isConnected&&((l=r.onRenderComplete)==null||l.call(r,i.kind))}),W`
813
+ <div
814
+ id="app"
815
+ tabindex="-1"
816
+ data-app-state=${i.kind}
817
+ ?data-sidebar-transition=${o(this,Ie)}
818
+ ?data-sidebar-motion=${o(this,Ie)}
819
+ style=${h(this,K,J4).call(this)}
820
+ >
821
+ ${a?h(this,K,Y4).call(this,e,s,r):null}
822
+ ${i.kind==="needs-upgrade"?uz(i.instructions,r.desktopUpdate,s4(r.electronMode&&!a)):Xz(i)?HN(i,{context:r.electronMode?"desktop":"browser",dragStrip:r.electronMode&&!a}):null}
823
+ </div>
824
+ <div id="foreground-overlay" inert aria-hidden="true"></div>
825
+ `}}Cr=new WeakMap,mh=new WeakMap,Qo=new WeakMap,Ul=new WeakMap,It=new WeakMap,ln=new WeakMap,Tn=new WeakMap,Rn=new WeakMap,ea=new WeakMap,Ie=new WeakMap,jn=new WeakMap,Es=new WeakMap,Hl=new WeakMap,ks=new WeakMap,gh=new WeakMap,$f=new WeakMap,ta=new WeakMap,xf=new WeakMap,Pf=new WeakMap,Df=new WeakMap,K=new WeakSet,Td=function(e){var c,u;if(!o(this,Ie)&&o(this,ln)===e||o(this,Ie)&&o(this,jn)===e)return;h(this,K,Qs).call(this);const r=document.activeElement===o(this,Rn);if((c=o(this,Ul))==null||c.setCollapsed(e),matchMedia("(prefers-reduced-motion: reduce)").matches){h(this,K,Zi).call(this,e),this.render(),r&&((u=o(this,Rn))==null||u.focus({preventScroll:!0}));return}if(d(this,jn,e),o(this,Ie)){h(this,K,Wc).call(this),h(this,K,C1).call(this);return}const i=h(this,K,Xs).call(this),s=i.closest("#app"),a=i.getBoundingClientRect(),l=s==null?void 0:s.getBoundingClientRect();if(!s||!l||a.width===0){h(this,K,Zi).call(this,e),this.render();return}for(const f of s.getAnimations({subtree:!0}))f.cancel();d(this,Ie,!0),d(this,Hl,a.top-l.top),d(this,ks,null),i.style.left=`${a.left-l.left}px`,i.style.top=`${o(this,Hl)}px`,h(this,K,Wc).call(this),this.render(),queueMicrotask(()=>{o(this,Ie)&&(h(this,K,W4).call(this),r&&i.focus({preventScroll:!0}),h(this,K,C1).call(this))})},C1=function(){const e=h(this,K,Xs).call(this).closest("#app"),r=o(this,ea);if(!e||!r||!o(this,ks))return;const i=o(this,jn)?0:o(this,It);r.move({root:e,width:o(this,It),target:i,onFrame:o(this,vh),onFinish:o(this,Lf)})},W4=function(){const r=h(this,K,Xs).call(this).closest("#app"),i=r==null?void 0:r.querySelector(".sidebar-titlebar > .sidebar-toggle-seat"),s=r==null?void 0:r.querySelector(".top-bar > .top-bar-lead"),a=s==null?void 0:s.querySelector(":scope > .sidebar-toggle-seat"),l=s==null?void 0:s.querySelector(":scope > .channel-switcher"),c=s==null?void 0:s.closest(".top-bar");if(!r||!i||!s||!a||!c){h(this,K,Zi).call(this,o(this,jn)),this.render();return}const u=i.closest(".app-sidebar");r.removeAttribute("data-sidebar-motion");const f=r.getBoundingClientRect(),p=s.style.display;s.style.display="none";const y=i.getBoundingClientRect();u.style.marginLeft=`${-o(this,It)}px`,s.style.display=p;const v=a.getBoundingClientRect(),S=l==null?void 0:l.getBoundingClientRect();d(this,ks,{expandedSidebarWidth:o(this,It),expandedToggleLeft:y.left-f.left,collapsedToggleLeft:v.left-f.left,toggleTop:o(this,Hl),toggleWidth:v.width,toggleHeight:v.height,toggleSwitcherGap:S?S.left-v.right:0,collapsedLeadReservation:s.getBoundingClientRect().width,hasSwitcher:!!l,barInset:c.getBoundingClientRect().left-f.left}),u.style.removeProperty("margin-left"),r.setAttribute("data-sidebar-motion",""),o(this,vh).call(this,o(this,Es))},vh=new WeakMap,Lf=new WeakMap,Zi=function(e){var r;(r=o(this,ea))==null||r.cancel(),d(this,ln,e),d(this,Ie,!1),d(this,Es,e?0:o(this,It)),d(this,ea,new aN(o(this,Es))),d(this,ks,null),h(this,K,G4).call(this),h(this,K,Wc).call(this)},Xs=function(){if(o(this,Rn)!==null)return o(this,Rn);const e=document.createElement("button");return e.type="button",e.setAttribute("variant","ghost"),e.setAttribute("icon",""),e.append(h(this,K,Rd).call(this)),e.addEventListener("pointerdown",r=>{r.button===0&&e.setPointerCapture(r.pointerId)}),e.addEventListener("click",o(this,Df)),d(this,Rn,e),h(this,K,Wc).call(this),e},Wc=function(){var s;const e=o(this,Rn);if(e===null)return;const r=o(this,Ie)?o(this,jn):o(this,ln);e.className=o(this,Ie)?"sidebar-motion-toggle sidebar-toggle":r?"sidebar-expand":"sidebar-collapse",o(this,Ie)?e.querySelectorAll(":scope > .sidebar-toggle-paint").length!==2&&e.replaceChildren(h(this,K,I1).call(this,"expanded-paint"),h(this,K,I1).call(this,"collapsed-paint")):(e.children.length!==1||!((s=e.firstElementChild)!=null&&s.matches("tv-icon[name='sidebar']")))&&e.replaceChildren(h(this,K,Rd).call(this));const i=r?"Show sidebar":"Collapse sidebar";e.setAttribute("aria-label",i),e.title=i},Rd=function(){const e=document.createElement("tv-icon");return e.setAttribute("name","sidebar"),e.setAttribute("size","sm"),e},I1=function(e){const r=document.createElement("span");return r.className=`sidebar-toggle-paint ${e}`,r.setAttribute("aria-hidden","true"),r.append(h(this,K,Rd).call(this)),r},G4=function(){const e=o(this,Rn);e!==null&&(e.style.removeProperty("left"),e.style.removeProperty("top"))},J4=function(){const e=[`--sidebar-width: ${o(this,It)}px`];return o(this,Ie)&&e.push(`--motion-boundary: ${o(this,Es)}px`),e.join("; ")},Of=new WeakMap,Mf=new WeakMap,Nf=new WeakMap,yh=new WeakMap,zf=new WeakMap,Qs=function(){const e=o(this,Tn);if(e===null)return;d(this,Tn,null),h(this,K,Gc).call(this,e.root,e.startWidth);const r=e.root.querySelector(".app-sidebar-resize");r!=null&&r.hasPointerCapture(e.pointerId)&&r.releasePointerCapture(e.pointerId)},Gc=function(e,r){d(this,It,zS(r)),h(this,K,Zi).call(this,o(this,ln)),e.style.setProperty("--sidebar-width",`${o(this,It)}px`)},Y4=function(e,r,i){const s=!o(this,ln)||o(this,Ie),a=h(this,K,Xs).call(this);return W`
826
+ ${s?W`
827
+ <aside class="app-sidebar">
828
+ ${GM(e,r,i.electronMode,o(this,xf),o(this,Ie)?null:a,o(this,Ie))}
829
+ </aside>
830
+ ${o(this,Ie)?null:W`
831
+ <div
832
+ class="app-sidebar-resize"
833
+ aria-hidden="true"
834
+ @pointerdown=${o(this,Of)}
835
+ @pointermove=${o(this,Mf)}
836
+ @pointerup=${o(this,Nf)}
837
+ @pointercancel=${o(this,yh)}
838
+ @lostpointercapture=${o(this,yh)}
839
+ @dblclick=${o(this,zf)}
840
+ ></div>
841
+ `}
842
+ `:null}
843
+ <main class="app-main">
844
+ ${Gz(e,r,{connectionOwner:i.connectionOwner,primaryServerURL:i.primaryServerURL,updatePresentation:i.updatePresentation,desktopRecommendation:i.desktopRecommendation,desktopUpdate:i.desktopUpdate,onTabReorderChange:o(this,$f),collapsed:o(this,ln),onExpandSidebar:o(this,Pf),sidebarToggle:o(this,Ie)?null:o(this,ln)?a:void 0,sidebarTransitioning:o(this,Ie)})}
845
+ ${ON(e,r.focusedChannel,o(this,mh),o(this,Ie))}
846
+ </main>
847
+ ${o(this,Ie)?a:null}
848
+ `};const Yz=dn(Jz);function Kz(n,t){return n.kind==="connected"||n.kind==="no-channel"||n.kind==="empty-channel"||n.kind==="disconnected"||n.kind==="error"&&t}function Xz(n){return n.kind!=="connected"&&n.kind!=="no-channel"&&n.kind!=="empty-channel"}const K4="television-appearance-mode";function Qz(n){return n==="system"||n==="light"||n==="dark"}function e7(){try{const n=window.localStorage.getItem(K4);return Qz(n)?n:"system"}catch{return"system"}}function X4(){return window.__televisionAppearanceResolver??hL(e7())}function t7(n,t){return t==="light"||t==="dark"?t:n}function n7(n){X4().setPreference(n);try{window.localStorage.setItem(K4,n)}catch{}}document.documentElement.dataset.tvBundleVersion=cv();Object.defineProperty(window,"__tvVersion",{value:cv(),writable:!1,configurable:!1});X4();const r7=y7(),Kn=wi();Kn?document.documentElement.dataset.platform="electron":delete document.documentElement.dataset.platform;const kv=_$(),Q4=A$(),i7=new bT(Kn?"television-electron":"television-browser",wT()),s7=new JD(window.localStorage),o7=new WD(window.localStorage),a8=PS(),a7=a8?$$({storage:a8,clientApp:Kn?"desktop":"browser",desktopAppVersion:Kn?L6():null}):null,Tv=Cs(Kn?kv:window.location.origin),Rv=eL({search:window.location.search}),Xn=uv(),eA=new oL,Cv=sL({detection:Rv,primaryServerURL:Tv,navigationLatch:Xn,presentation:eA}),Oe=new MD({localStore:i7,serverURL:kv,launchToken:Q4,telemetryMeta:a7,navigationPending:()=>Xn.pending,...Rv.electron?{decideBoot:n=>Cv.decideBoot(n)}:{}}),l7=n=>{lT(yt,n)},yt=new Xk({connectionOwner:Oe,navigationKeyHandler:l7,retainedGateHalted:()=>Cv.gated}),so=globalThis.__televisionNativeBridge;Kn&&so&&so.onNavigationKey(n=>yt.handleNavigationKey(n));const c7=new uL({electron:Kn,bridge:so});if(Q4){const n=new URL(window.location.href);n.searchParams.delete("token"),window.history.replaceState(window.history.state,"",`${n.pathname}${n.search}${n.hash}`)}QD({owner:Oe,primaryServerURL:Tv,navigationLatch:Xn});Cv.attach(Oe);const u7=()=>{const n=Oe.connection;n.status==="connected"&&n.client.artifacts.list().then(({artifacts:t})=>{const e=new Set(t.map(r=>r.id));BD(e)}).catch(()=>{})},tA=()=>{Oe.connection.status==="connected"&&lN(Oe.connection.url)};let Bd=null,$1=null,nA=Oe.connection.status;const h7=()=>{Xn.pending||Xn.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()})},rA=(n,t,e)=>{if(Xn.pending||Oe.connection.status!=="connected"||yt.snapshot.connection.status!=="connected"||!yt.snapshot.ready)return;const r={activeThemeName:n,consentIds:new Set(t)},i=Bd,s=hN(),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,f=i!==null&&lA(i.consentIds,r.consentIds);if(Bd=r,s!==null&&(a||u)){h7();return}if(s===null&&c){_b(Oe.connection.url);return}s!==null&&c&&e&&!a&&f&&_b(Oe.connection.url)},d7=()=>{const n=document.documentElement.dataset.theme;if(n!=="light"&&n!=="dark")throw new Error("Application root has no effective theme-frame appearance");return n},iA=(n,t)=>{if(Xn.pending||Oe.connection.status!=="connected"||yt.snapshot.connection.status!=="connected"||!yt.snapshot.ready)return;const e={activeThemeName:n,serverURL:Oe.connection.url,appearance:d7()},r=$1;$1=e,!(!t&&(r==null?void 0:r.activeThemeName)===e.activeThemeName&&r.serverURL===e.serverURL&&r.appearance===e.appearance)&&dN(e.serverURL,e.activeThemeName,()=>yt.listThemes())},sA=()=>{if(!Xn.pending){if(nA=Oe.connection.status,Oe.connection.status!=="connected"){cN(),uN(),fN(),Bd=null,$1=null;return}tA(),u7()}};let x1,P1;const Iv=(n,t)=>{const e=t7(n,t);e!==x1&&(n7(e),x1=e),e!==P1&&Kn&&typeof(so==null?void 0:so.setAppearanceMode)=="function"&&(so.setAppearanceMode(e),P1=e)},ip=()=>{const n=yt.snapshot;if(n.connection.status!=="connected"){x1=void 0,P1=void 0;return}n.ready&&(Iv(n.display.appearanceMode,n.display.activeThemeColorScheme),nA===Oe.connection.status&&(rA(n.display.activeThemeName,n.display.themeJavaScriptConsentIds,!1),iA(n.display.activeThemeName,!1)))},f7=n=>{if(Xn.pending)return;Iv(yt.snapshot.display.appearanceMode,n.activeThemeColorScheme);const t=Bd,e=t!==null&&t.activeThemeName===n.themeName&&!lA(t.consentIds,new Set(n.themeJavaScriptConsentIds));rA(n.themeName,n.themeJavaScriptConsentIds,!0),!(Xn.pending||e)&&(tA(),iA(n.themeName,!0))},p7=n=>{Xn.pending||Iv(n.appearanceMode,yt.snapshot.display.activeThemeColorScheme)};sA();ip();Oe.addEventListener("change",sA);yt.addEventListener("change",ip);yt.addEventListener("theme-changed",f7);yt.addEventListener("appearance-changed",p7);const m7=new MutationObserver(()=>{ip()});m7.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});x8.register("ServerConnectionOwner",()=>Oe);x8.register("ApplicationService",()=>yt);const Kc=globalThis.__telepath??(globalThis.__telepath={});Kc.applicationService=yt;Kc.connectionOwner=Oe;const g7=Kc.renderCompleteCallbacks??(Kc.renderCompleteCallbacks=new Set);Kn&&document.body.classList.add("electron");let l8=!1,c8=!1;const v7=n=>{if(!r7||c8||n!=="connected"&&n!=="no-channel"&&n!=="empty-channel")return;const t=document.querySelector("#settings-popover");t!==null&&(c8=!0,t.setAttribute("open",""))},oA=()=>{l8||(Ag(Yz(yt,{runtimeServerURL:kv,electronMode:Kn,connectionOwner:Oe,primaryServerURL:Tv,updatePresentation:eA,desktopRecommendation:Rv,desktopUpdate:c7,sidebarWidthPreference:s7,sidebarCollapsedPreference:o7,onRenderComplete(n){v7(n);for(const t of g7)t(n)}}),document.body),l8=!0,ip())},aA=()=>{const n=Oe.connection;n.bootState==="pending"&&!n.hasAuthRejected&&Oe.connectError===null||(Oe.removeEventListener("change",aA),oA())};Kn?Oe.addEventListener("change",aA):oA();Oe.connect();function y7(){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 lA(n,t){if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0}