@telepath-computer/television 1.4.29 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +678 -627
- package/dist/skills/television/SKILL.md +3 -1
- package/dist/skills/television/resources.md +1 -1
- package/dist/skills/tv-tasks/SKILL.md +3 -3
- package/dist/views/artifact-missing/assets/artifact-bridge-DTPacxDw.js +1 -0
- package/dist/{web/assets/artifactMissing-CUs1ZwDx.js → views/artifact-missing/assets/artifactMissing-CpOfWSs9.js} +1 -1
- package/dist/views/artifact-missing/assets/missing-artifact-page-DVzJ41AE.js +1 -0
- package/dist/views/artifact-missing/index.html +3 -3
- package/dist/views/markdown/index.html +13 -13
- package/dist/web/assets/artifact-bridge-DTPacxDw.js +1 -0
- package/dist/web/assets/artifactMissing-CpOfWSs9.js +1 -0
- package/dist/web/assets/main-C0UptF4P.js +848 -0
- package/dist/web/assets/{urlUnsupported-powR79PT.js → urlUnsupported-DKrVAwIf.js} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/views/artifact-missing/assets/artifact-bridge-DTPacxDw.js +1 -0
- package/dist/web/views/artifact-missing/assets/artifactMissing-CpOfWSs9.js +1 -0
- package/dist/web/views/artifact-missing/assets/missing-artifact-page-DVzJ41AE.js +1 -0
- package/dist/web/views/artifact-missing/index.html +3 -3
- package/dist/web/views/url-unsupported/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/artifact-bridge-BEUWXKq7.js +0 -1
- package/dist/web/assets/main-7DnHFmfr.js +0 -848
|
@@ -0,0 +1,848 @@
|
|
|
1
|
+
var A4=Object.defineProperty;var Zv=n=>{throw TypeError(n)};var E4=(n,t,e)=>t in n?A4(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var R=(n,t,e)=>E4(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 k4,a as T4,b as C4,c as R4,d as I4,e as $4,f as x4,g as P4,U as D4,A as O4,h as L4}from"./artifact-bridge-DTPacxDw.js";import{m as M4,a as N4,b as z4}from"./missing-artifact-page-DVzJ41AE.js";var Qs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function H4(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 Uv={},Fv={},cp,qv;function h8(){if(qv)return cp;qv=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,Vv;function Z4(){if(Vv)return up;Vv=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),Z=S&&e.call(v)==="[object String]",O=[];if(!S&&!_&&!$)throw new TypeError("Object.keys called on a non-object");var z=a&&_;if(Z&&v.length>0&&!t.call(v,0))for(var P=0;P<v.length;++P)O.push(String(P));if($&&v.length>0)for(var B=0;B<v.length;++B)O.push(String(B));else for(var F in v)!(z&&F==="prototype")&&t.call(v,F)&&O.push(String(F));if(s)for(var q=p(v),Q=0;Q<l.length;++Q)!(q&&l[Q]==="constructor")&&t.call(v,l[Q])&&O.push(l[Q]);return O}}return up=n,up}var hp,Bv;function U4(){if(Bv)return hp;Bv=1;var n=Array.prototype.slice,t=h8(),e=Object.keys,r=e?function(a){return e(a)}:Z4(),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,jv;function bh(){if(jv)return dp;jv=1;var n=Object.defineProperty||!1;if(n)try{n({},"a",{value:1})}catch{n=!1}return dp=n,dp}var fp,Wv;function ki(){return Wv||(Wv=1,fp=SyntaxError),fp}var pp,Gv;function fe(){return Gv||(Gv=1,pp=TypeError),pp}var mp,Jv;function F4(){return Jv||(Jv=1,mp=Object.getOwnPropertyDescriptor),mp}var gp,Yv;function Wl(){if(Yv)return gp;Yv=1;var n=F4();if(n)try{n([],"length")}catch{n=null}return gp=n,gp}var vp,Kv;function d8(){if(Kv)return vp;Kv=1;var n=bh(),t=ki(),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,Xv;function Hf(){if(Xv)return yp;Xv=1;var n=bh(),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,Qv;function sa(){if(Qv)return wp;Qv=1;var n=U4(),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=Hf()(),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:{}},ey;function f8(){return ey||(ey=1,typeof self<"u"?pc.exports=self:typeof window<"u"?pc.exports=window:pc.exports=Function("return this")()),pc.exports}var bp,ty;function p8(){if(ty)return bp;ty=1;var n=f8();return bp=function(){return typeof Qs!="object"||!Qs||Qs.Math!==Math||Qs.Array!==Array?n:Qs},bp}var Sp,ny;function q4(){if(ny)return Sp;ny=1;var n=sa(),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,ry;function O1(){if(ry)return _p;ry=1;var n=sa(),t=f8(),e=p8(),r=q4(),i=e(),s=function(){return i};return n(s,{getPolyfill:e,implementation:t,shim:r}),_p=s,_p}var Ap,iy;function Ti(){return iy||(iy=1,Ap=function(t){return!!t&&(typeof t=="function"||typeof t=="object")}),Ap}var Ep,sy;function L1(){return sy||(sy=1,Ep=Object),Ep}var kp,oy;function m8(){return oy||(oy=1,kp=Error),kp}var Tp,ay;function V4(){return ay||(ay=1,Tp=EvalError),Tp}var Cp,ly;function B4(){return ly||(ly=1,Cp=RangeError),Cp}var Rp,cy;function M1(){return cy||(cy=1,Rp=ReferenceError),Rp}var Ip,uy;function j4(){return uy||(uy=1,Ip=URIError),Ip}var $p,hy;function W4(){return hy||(hy=1,$p=Math.abs),$p}var xp,dy;function G4(){return dy||(dy=1,xp=Math.floor),xp}var Pp,fy;function J4(){return fy||(fy=1,Pp=Math.max),Pp}var Dp,py;function Y4(){return py||(py=1,Dp=Math.min),Dp}var Op,my;function K4(){return my||(my=1,Op=Math.pow),Op}var Lp,gy;function X4(){return gy||(gy=1,Lp=Math.round),Lp}var Mp,vy;function N1(){return vy||(vy=1,Mp=Number.isNaN||function(t){return t!==t}),Mp}var Np,yy;function Q4(){if(yy)return Np;yy=1;var n=N1();return Np=function(e){return n(e)||e===0?e:e<0?-1:1},Np}var zp,wy;function Gl(){return wy||(wy=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 Hp,by;function z1(){if(by)return Hp;by=1;var n=typeof Symbol<"u"&&Symbol,t=Gl();return Hp=function(){return typeof n!="function"||typeof Symbol!="function"||typeof n("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},Hp}var Zp,Sy;function g8(){return Sy||(Sy=1,Zp=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Zp}var Up,_y;function v8(){if(_y)return Up;_y=1;var n=L1();return Up=n.getPrototypeOf||null,Up}var Fp,Ay;function eE(){if(Ay)return Fp;Ay=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 Fp=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 Z=u.apply(this,i(f,arguments));return Object(Z)===Z?Z: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},Fp}var qp,Ey;function Sh(){if(Ey)return qp;Ey=1;var n=eE();return qp=Function.prototype.bind||n,qp}var Vp,ky;function H1(){return ky||(ky=1,Vp=Function.prototype.call),Vp}var Bp,Ty;function Z1(){return Ty||(Ty=1,Bp=Function.prototype.apply),Bp}var jp,Cy;function tE(){return Cy||(Cy=1,jp=typeof Reflect<"u"&&Reflect&&Reflect.apply),jp}var Wp,Ry;function y8(){if(Ry)return Wp;Ry=1;var n=Sh(),t=Z1(),e=H1(),r=tE();return Wp=r||n.call(e,t),Wp}var Gp,Iy;function Zf(){if(Iy)return Gp;Iy=1;var n=Sh(),t=fe(),e=H1(),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,$y;function nE(){if($y)return Jp;$y=1;var n=Zf(),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,xy;function w8(){if(xy)return Yp;xy=1;var n=g8(),t=v8(),e=nE();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,Py;function Ci(){if(Py)return Kp;Py=1;var n=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=Sh();return Kp=e.call(n,t),Kp}var Xp,Dy;function In(){if(Dy)return Xp;Dy=1;var n,t=L1(),e=m8(),r=V4(),i=B4(),s=M1(),a=ki(),l=fe(),c=j4(),u=W4(),f=G4(),p=J4(),y=Y4(),v=K4(),S=X4(),_=Q4(),$=Function,Z=function(bt){try{return $('"use strict"; return ('+bt+").constructor;")()}catch{}},O=Wl(),z=bh(),P=function(){throw new l},B=O?(function(){try{return arguments.callee,P}catch{try{return O(arguments,"callee").get}catch{return P}}})():P,F=z1()(),q=w8(),Q=v8(),V=g8(),ie=Z1(),Ne=H1(),xe={},et=typeof Uint8Array>"u"||!q?n:q(Uint8Array),le={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?n:ArrayBuffer,"%ArrayIteratorPrototype%":F&&q?q([][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%":F&&q?q(q([][Symbol.iterator]())):n,"%JSON%":typeof JSON=="object"?JSON:n,"%Map%":typeof Map>"u"?n:Map,"%MapIteratorPrototype%":typeof Map>"u"||!F||!q?n:q(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":t,"%Object.getOwnPropertyDescriptor%":O,"%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"||!F||!q?n:q(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":F&&q?q(""[Symbol.iterator]()):n,"%Symbol%":F?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%":ie,"%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%":V};if(q)try{null.error}catch(bt){var We=q(q(bt));le["%Error.prototype%"]=We}var Ot=function bt(Re){var Be;if(Re==="%AsyncFunction%")Be=Z("async function () {}");else if(Re==="%GeneratorFunction%")Be=Z("function* () {}");else if(Re==="%AsyncGeneratorFunction%")Be=Z("async function* () {}");else if(Re==="%AsyncGenerator%"){var Pe=bt("%AsyncGeneratorFunction%");Pe&&(Be=Pe.prototype)}else if(Re==="%AsyncIteratorPrototype%"){var Ge=bt("%AsyncGenerator%");Ge&&q&&(Be=q(Ge.prototype))}return le[Re]=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=Sh(),wt=Ci(),Ls=ht.call(Ne,Array.prototype.concat),ca=ht.call(ie,Array.prototype.splice),Ms=ht.call(Ne,String.prototype.replace),Ii=ht.call(Ne,String.prototype.slice),Ee=ht.call(Ne,RegExp.prototype.exec),sc=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Dn=/\\(\\)?/g,Ns=function(Re){var Be=Ii(Re,0,1),Pe=Ii(Re,-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 Ms(Re,sc,function(ce,pn,oe,at){Ge[Ge.length]=oe?Ms(at,Dn,"$1"):pn||ce}),Ge},oc=function(Re,Be){var Pe=Re,Ge;if(wt(Pn,Pe)&&(Ge=Pn[Pe],Pe="%"+Ge[0]+"%"),wt(le,Pe)){var ce=le[Pe];if(ce===xe&&(ce=Ot(Pe)),typeof ce>"u"&&!Be)throw new l("intrinsic "+Re+" exists, but is not available. Please file an issue!");return{alias:Ge,name:Pe,value:ce}}throw new a("intrinsic "+Re+" does not exist!")};return Xp=function(Re,Be){if(typeof Re!="string"||Re.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(/^%?[^%]*%?$/,Re)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Pe=Ns(Re),Ge=Pe.length>0?Pe[0]:"",ce=oc("%"+Ge+"%",Be),pn=ce.name,oe=ce.value,at=!1,ze=ce.alias;ze&&(Ge=ze[0],ca(Pe,Ls([0,1],ze)));for(var mn=1,On=!0;mn<Pe.length;mn+=1){var Je=Pe[mn],xr=Ii(Je,0,1),Xn=Ii(Je,-1);if((xr==='"'||xr==="'"||xr==="`"||Xn==='"'||Xn==="'"||Xn==="`")&&xr!==Xn)throw new a("property names with quotes must have matching quotes");if((Je==="constructor"||!On)&&(at=!0),Ge+="."+Je,pn="%"+Ge+"%",wt(le,pn))oe=le[pn];else if(oe!=null){if(!(Je in oe)){if(!Be)throw new l("base intrinsic for "+Re+" exists, but the property is not available.");return}if(O&&mn+1>=Pe.length){var Pr=O(oe,Je);On=!!Pr,On&&"get"in Pr&&!("originalValue"in Pr.get)?oe=Pr.get:oe=oe[Je]}else On=wt(oe,Je),oe=oe[Je];On&&!at&&(le[pn]=oe)}}return oe},Xp}var Qp,Oy;function Ps(){if(Oy)return Qp;Oy=1;var n=In(),t=Zf(),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,Ly;function U1(){if(Ly)return e0;Ly=1;var n=In(),t=n("%Array%"),e=!t.isArray&&Ps()("Object.prototype.toString");return e0=t.isArray||function(i){return e(i)==="[object Array]"},e0}var t0,My;function F1(){if(My)return t0;My=1;var n=Hf(),t=bh(),e=n.hasArrayLengthDefineBug(),r=e&&U1(),i=Ps(),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,Ny;function Jl(){if(Ny)return n0;Ny=1;var n=fe(),t=Ci(),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,zy;function b8(){return zy||(zy=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=Ci(),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,Uy;function Yl(){return Uy||(Uy=1,o0=function(t){return typeof t=="string"||typeof t=="symbol"}),o0}var a0,Fy;function A8(){if(Fy)return a0;Fy=1;var n=N1();return a0=function(e,r){return e===r?e===0?1/e===1/r:!0:n(e)&&n(r)},a0}var l0,qy;function q1(){if(qy)return l0;qy=1;var n=fe(),t=Ti(),e=F1(),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,Vy;function E8(){if(Vy)return c0;Vy=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(O){O!==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 Z=document.all;l.call(Z)===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,By;function rE(){return By||(By=1,u0=E8()),u0}var h0,jy;function iE(){return jy||(jy=1,h0=function(t){return!!t}),h0}var d0,Wy;function sE(){if(Wy)return d0;Wy=1;var n=Ci(),t=fe(),e=Ti(),r=rE(),i=iE();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,Gy;function oE(){if(Gy)return f0;Gy=1;var n=fe(),t=Ti(),e=Jl(),r=F1(),i=S8(),s=_8(),a=Yl(),l=A8(),c=sE();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,Jy;function aE(){if(Jy)return p0;Jy=1;var n=fe(),t=Ti(),e=oE(),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,Yy;function lE(){return Yy||(Yy=1,m0=typeof Reflect<"u"&&Reflect.setPrototypeOf||null),m0}var g0,Ky;function cE(){if(Ky)return g0;Ky=1;var n=L1();return g0=n.setPrototypeOf||null,g0}var v0,Xy;function uE(){if(Xy)return v0;Xy=1;var n=Zf(),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,Qy;function hE(){if(Qy)return y0;Qy=1;var n=lE(),t=cE(),e=uE(),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,ew;function dE(){if(ew)return w0;ew=1;var n=fe(),t=Ti(),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,tw;function fE(){if(tw)return b0;tw=1;var n=fe(),t=hE(),e=Ti(),r=dE();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,nw;function pE(){if(nw)return S0;nw=1;var n=q1(),t=aE(),e=fE(),r=Hf()(),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,rw;function k8(){if(rw)return _0;rw=1;var n=pE();return _0=function(){return typeof SuppressedError=="function"?SuppressedError:n},_0}var A0,iw;function mE(){if(iw)return A0;iw=1;var n=sa(),t=O1()(),e=k8();return A0=function(){var i=e();return n(t,{SuppressedError:i},{SuppressedError:function(){return t.SuppressedError!==i}}),i},A0}var sw;function gE(){return sw||(sw=1,mE()()),Fv}var E0,ow;function vE(){if(ow)return E0;ow=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,aw;function yE(){if(aw)return k0;aw=1;var n=fe(),t=Ci(),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,lw;function wE(){if(lw)return T0;lw=1;var n=N1();return T0=function(e,r){return e===r?e===0?1/e===1/r:!0:n(e)&&n(r)},T0}var C0,cw;function Kl(){return cw||(cw=1,C0=E8()),C0}var R0,uw;function bE(){return uw||(uw=1,R0=function(t){return!!t}),R0}var I0,hw;function SE(){if(hw)return I0;hw=1;var n=Ci(),t=fe(),e=Ti(),r=Kl(),i=bE();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,dw;function _h(){if(dw)return $0;dw=1;var n=fe(),t=Ti(),e=Jl(),r=F1(),i=vE(),s=yE(),a=Yl(),l=wE(),c=SE();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,fw;function _E(){if(fw)return x0;fw=1;var n=Gl()();return x0=n?Symbol.dispose||Symbol("Symbol.dispose"):null,x0}var P0,pw;function V1(){if(pw)return P0;pw=1;var n=Gl(),t=_E();return P0=function(){return n()&&Symbol.dispose||t},P0}var D0,mw;function AE(){if(mw)return D0;mw=1;var n=z1(),t=_h(),e=V1();return D0=function(){var i=e();return n()&&t(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":i}),i},D0}var O0,gw;function EE(){if(gw)return O0;gw=1;var n=Gl()();return O0=n?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,O0}var L0,vw;function B1(){if(vw)return L0;vw=1;var n=Gl(),t=EE();return L0=function(){return n()&&Symbol.asyncDispose||t},L0}var M0,yw;function kE(){if(yw)return M0;yw=1;var n=z1(),t=_h(),e=B1();return M0=function(){var i=e();return n()&&t(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":i}),i},M0}var N0,ww;function TE(){return ww||(ww=1,N0=U1()),N0}var z0,bw;function Uf(){if(bw)return z0;bw=1;var n=In(),t=Ps(),e=fe(),r=TE(),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 CE={},RE=Object.freeze(Object.defineProperty({__proto__:null,default:CE},Symbol.toStringTag,{value:"Module"})),IE=H4(RE);var H0,Sw;function Xl(){if(Sw)return H0;Sw=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,Z=String.prototype.match,O=String.prototype.slice,z=String.prototype.replace,P=String.prototype.toUpperCase,B=String.prototype.toLowerCase,F=RegExp.prototype.test,q=Array.prototype.concat,Q=Array.prototype.join,V=Array.prototype.slice,ie=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,Ot=Object.prototype.propertyIsEnumerable,Pn=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(k){return k.__proto__}:null);function ht(k,C){if(k===1/0||k===-1/0||k!==k||k&&k>-1e3&&k<1e3||F.call(/e/,C))return C;var pe=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof k=="number"){var Se=k<0?-ie(-k):ie(k);if(Se!==k){var ke=String(Se),ne=O.call(C,ke.length+1);return z.call(ke,pe,"$&_")+"."+z.call(z.call(ne,/([0-9]{3})/g,"$&_"),/_$/,"")}}return z.call(C,pe,"$&_")}var wt=IE,Ls=wt.custom,ca=ce(Ls)?Ls:null,Ms={__proto__:null,double:'"',single:"'"},Ii={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};H0=function k(C,pe,Se,ke){var ne=pe||{};if(at(ne,"quoteStyle")&&!at(Ms,ne.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(at(ne,"maxStringLength")&&(typeof ne.maxStringLength=="number"?ne.maxStringLength<0&&ne.maxStringLength!==1/0:ne.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var St=at(ne,"customInspect")?ne.customInspect:!0;if(typeof St!="boolean"&&St!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(at(ne,"indent")&&ne.indent!==null&&ne.indent!==" "&&!(parseInt(ne.indent,10)===ne.indent&&ne.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(at(ne,"numericSeparator")&&typeof ne.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var tr=ne.numericSeparator;if(typeof C>"u")return"undefined";if(C===null)return"null";if(typeof C=="boolean")return C?"true":"false";if(typeof C=="string")return er(C,ne);if(typeof C=="number"){if(C===0)return 1/0/C>0?"0":"-0";var dt=String(C);return tr?ht(C,dt):dt}if(typeof C=="bigint"){var Ln=String(C)+"n";return tr?ht(C,Ln):Ln}var ua=typeof ne.depth>"u"?5:ne.depth;if(typeof Se>"u"&&(Se=0),Se>=ua&&ua>0&&typeof C=="object")return Ns(C)?"[Array]":"[Object]";var Mr=xi(ne,Se);if(typeof ke>"u")ke=[];else if(On(ke,C)>=0)return"[Circular]";function ft(Oi,Fs,hc){if(Fs&&(ke=V.call(ke),ke.push(Fs)),hc){var dc={depth:ne.depth};return at(ne,"quoteStyle")&&(dc.quoteStyle=ne.quoteStyle),k(Oi,dc,Se+1,ke)}return k(Oi,ne,Se+1,ke)}if(typeof C=="function"&&!bt(C)){var Hs=mn(C),Yt=Lr(C,ft);return"[Function"+(Hs?": "+Hs:" (anonymous)")+"]"+(Yt.length>0?" { "+Q.call(Yt,", ")+" }":"")}if(ce(C)){var Nr=le?z.call(String(C),/^(Symbol\(.*\))_[^)]*$/,"$1"):et.call(C);return typeof C=="object"&&!le?Or(Nr):Nr}if(Qn(C)){for(var zr="<"+B.call(String(C.nodeName)),Zs=C.attributes||[],ha=0;ha<Zs.length;ha++)zr+=" "+Zs[ha].name+"="+Ee(sc(Zs[ha].value),"double",ne);return zr+=">",C.childNodes&&C.childNodes.length&&(zr+="..."),zr+="</"+B.call(String(C.nodeName))+">",zr}if(Ns(C)){if(C.length===0)return"[]";var da=Lr(C,ft);return Mr&&!ac(da)?"["+Pi(da,Mr)+"]":"[ "+Q.call(da,", ")+" ]"}if(Re(C)){var Us=Lr(C,ft);return!("cause"in Error.prototype)&&"cause"in C&&!Ot.call(C,"cause")?"{ ["+String(C)+"] "+Q.call(q.call("[cause]: "+ft(C.cause),Us),", ")+" }":Us.length===0?"["+String(C)+"]":"{ ["+String(C)+"] "+Q.call(Us,", ")+" }"}if(typeof C=="object"&&St){if(ca&&typeof C[ca]=="function"&&wt)return wt(C,{depth:ua-Se});if(St!=="symbol"&&typeof C.inspect=="function")return C.inspect()}if(Je(C)){var lc=[];return r&&r.call(C,function(Oi,Fs){lc.push(ft(Fs,C,!0)+" => "+ft(Oi,C))}),zs("Map",e.call(C),lc,Mr)}if(Pr(C)){var fa=[];return l&&l.call(C,function(Oi){fa.push(ft(Oi,C))}),zs("Set",a.call(C),fa,Mr)}if(xr(C))return $i("WeakMap");if(Ch(C))return $i("WeakSet");if(Xn(C))return $i("WeakRef");if(Pe(C))return Or(ft(Number(C)));if(pn(C))return Or(ft(Ne.call(C)));if(Ge(C))return Or(S.call(C));if(Be(C))return Or(ft(String(C)));if(typeof window<"u"&&C===window)return"{ [object Window] }";if(typeof globalThis<"u"&&C===globalThis||typeof Qs<"u"&&C===Qs)return"{ [object globalThis] }";if(!oc(C)&&!bt(C)){var cc=Lr(C,ft),Di=Pn?Pn(C)===Object.prototype:C instanceof Object||C.constructor===Object,uc=C instanceof Object?"":"null prototype",Rh=!Di&&We&&Object(C)===C&&We in C?O.call(ze(C),8,-1):uc?"Object":"",He=Di||typeof C.constructor!="function"?"":C.constructor.name?C.constructor.name+" ":"",nr=He+(Rh||uc?"["+Q.call(q.call([],Rh||[],uc||[]),": ")+"] ":"");return cc.length===0?nr+"{}":Mr?nr+"{"+Pi(cc,Mr)+"}":nr+"{ "+Q.call(cc,", ")+" }"}return String(C)};function Ee(k,C,pe){var Se=pe.quoteStyle||C,ke=Ms[Se];return ke+k+ke}function sc(k){return z.call(String(k),/"/g,""")}function Dn(k){return!We||!(typeof k=="object"&&(We in k||typeof k[We]<"u"))}function Ns(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 Re(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 pn(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,C){return oe.call(k,C)}function ze(k){return _.call(k)}function mn(k){if(k.name)return k.name;var C=Z.call($.call(k),/^function\s*([\w$]+)/);return C?C[1]:null}function On(k,C){if(k.indexOf)return k.indexOf(C);for(var pe=0,Se=k.length;pe<Se;pe++)if(k[pe]===C)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 Xn(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 Ch(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 Qn(k){return!k||typeof k!="object"?!1:typeof HTMLElement<"u"&&k instanceof HTMLElement?!0:typeof k.nodeName=="string"&&typeof k.getAttribute=="function"}function er(k,C){if(k.length>C.maxStringLength){var pe=k.length-C.maxStringLength,Se="... "+pe+" more character"+(pe>1?"s":"");return er(O.call(k,0,C.maxStringLength),C)+Se}var ke=Ii[C.quoteStyle||"single"];ke.lastIndex=0;var ne=z.call(z.call(k,ke,"\\$1"),/[\x00-\x1f]/g,Dr);return Ee(ne,"single",C)}function Dr(k){var C=k.charCodeAt(0),pe={8:"b",9:"t",10:"n",12:"f",13:"r"}[C];return pe?"\\"+pe:"\\x"+(C<16?"0":"")+P.call(C.toString(16))}function Or(k){return"Object("+k+")"}function $i(k){return k+" { ? }"}function zs(k,C,pe,Se){var ke=Se?Pi(pe,Se):Q.call(pe,", ");return k+" ("+C+") {"+ke+"}"}function ac(k){for(var C=0;C<k.length;C++)if(On(k[C],`
|
|
2
|
+
`)>=0)return!1;return!0}function xi(k,C){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(C+1),pe)}}function Pi(k,C){if(k.length===0)return"";var pe=`
|
|
3
|
+
`+C.prev+C.base;return pe+Q.call(k,","+pe)+`
|
|
4
|
+
`+C.prev}function Lr(k,C){var pe=Ns(k),Se=[];if(pe){Se.length=k.length;for(var ke=0;ke<k.length;ke++)Se[ke]=at(k,ke)?C(k[ke],k):""}var ne=typeof xe=="function"?xe(k):[],St;if(le){St={};for(var tr=0;tr<ne.length;tr++)St["$"+ne[tr]]=ne[tr]}for(var dt in k)at(k,dt)&&(pe&&String(Number(dt))===dt&&dt<k.length||le&&St["$"+dt]instanceof Symbol||(F.call(/[^\w$]/,dt)?Se.push(C(dt,k)+": "+C(k[dt],k)):Se.push(dt+": "+C(k[dt],k))));if(typeof xe=="function")for(var Ln=0;Ln<ne.length;Ln++)Ot.call(k,ne[Ln])&&Se.push("["+C(ne[Ln])+"]: "+C(k[ne[Ln]],k));return Se}return H0}var Z0,_w;function $E(){if(_w)return Z0;_w=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 Z0=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},Z0}var U0,Aw;function T8(){if(Aw)return U0;Aw=1;var n=In(),t=Ps(),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 U0=!!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},U0}var F0,Ew;function xE(){if(Ew)return F0;Ew=1;var n=In(),t=Ps(),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 F0=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,F0}var q0,kw;function PE(){if(kw)return q0;kw=1;var n=fe(),t=Xl(),e=$E(),r=T8(),i=xE(),s=i||r||e;return q0=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},q0}var V0,Tw;function j1(){if(Tw)return V0;Tw=1;var n=Ci(),t=PE()(),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),V0=r,V0}var B0,Cw;function W1(){if(Cw)return B0;Cw=1;var n=ki(),t=j1(),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,Rw;function G1(){if(Rw)return j0;Rw=1;var n=W1();return j0=function(e){return new n("normal",e)},j0}var W0,Iw;function DE(){if(Iw)return W0;Iw=1;var n=Gl();return W0=function(){return n()&&!!Symbol.toStringTag},W0}var G0,$w;function C8(){if($w)return G0;$w=1;var n=In(),t=n("%Object.defineProperty%",!0),e=DE()(),r=Ci(),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,xw;function OE(){if(xw)return Y0;xw=1;var n=In(),t=d8(),e=Hf()(),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,Pw;function LE(){if(Pw)return K0;Pw=1;var n=Sh(),t=Z1(),e=y8();return K0=function(){return e(n,t,arguments)},K0}var Dw;function J1(){return Dw||(Dw=1,(function(n){var t=OE(),e=bh(),r=Zf(),i=LE();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 ME(){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,Lw;function NE(){if(Lw)return Q0;Lw=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,Mw;function zE(){if(Mw)return em;Mw=1;var n=Ci(),t=U1(),e=ME(),r=NE();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,Nw;function HE(){if(Nw)return tm;Nw=1;var n=Ti();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,zw;function Y1(){if(zw)return nm;zw=1;var n=HE();return nm=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":n(e)},nm}var rm,Hw;function ZE(){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 UE(){if(Zw)return im;Zw=1;var n=fe(),t=ZE(),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 Mh={exports:{}},sm,Uw;function FE(){return Uw||(Uw=1,sm=In()),sm}var Fw;function qE(){if(Fw)return Mh.exports;Fw=1;var n=FE(),t=n("%Reflect.construct%",!0),e=_h();try{e({},"",{"[[Get]]":function(){}})}catch{e=null}if(e&&t){var r={},i={};e(i,"length",{"[[Get]]":function(){throw r},"[[Enumerable]]":!0}),Mh.exports=function(a){try{t(a,i)}catch(l){return l===r}}}else Mh.exports=function(a){return typeof a=="function"&&!!a.prototype};return Mh.exports}var om,qw;function VE(){if(qw)return om;qw=1;var n=fe(),t=Kl(),e=qE();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,Vw;function BE(){if(Vw)return am;Vw=1;var n=ki(),t=fe(),e=Uf(),r=UE(),i=VE(),s=Y1(),a=V1()(),l=B1()();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,Bw;function jE(){if(Bw)return lm;Bw=1;var n=ki(),t=fe(),e=Kl(),r=Y1(),i=BE();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,jw;function R8(){if(jw)return cm;jw=1;var n=ki(),t=fe(),e=zE(),r=jE(),i=Ps(),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,Ww;function K1(){if(Ww)return um;Ww=1;var n=In(),t=J1(),e=ki(),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,Gw;function WE(){if(Gw)return hm;Gw=1;var n=In(),t=ki(),e=n("%Promise%",!0),r=Uf(),i=K1(),s=Y1();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,Jw;function GE(){if(Jw)return dm;Jw=1;var n=W1();return dm=function(e){return new n("throw",e)},dm}var fm,Yw;function I8(){if(Yw)return fm;Yw=1;var n=In(),t=ki(),e=fe(),r=n("%Promise%",!0),i=Ps(),s=i("Promise.prototype.then",!0),a=W1(),l=WE(),c=G1(),u=K1(),f=GE(),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 $,Z=_.length-1;Z>=0;Z-=1)if(!$)$=_[Z]["[[Hint]]"];else if($!==_[Z]["[[Hint]]"])throw new t("mixed hint stacks are not supported");for(var O=$==="ASYNC-DISPOSE"&&u(r,S),z=function(Q){if(S.type()==="throw"){var V=S.value(),ie=new p(Q,V);S=f(ie)}else S=f(Q)},P=$==="ASYNC-DISPOSE"&&function(V){return s(O,function(){var ie=l(V["[[ResourceValue]]"],V["[[Hint]]"],V["[[DisposeMethod]]"]);if(!ie)throw new t("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return s(ie,c)},z)},B=_.length-1;B>=0;B-=1)if($==="ASYNC-DISPOSE")O=P(_[B]);else{var F=_[B];try{var q=l(F["[[ResourceValue]]"],F["[[Hint]]"],F["[[DisposeMethod]]"]);if(q)throw new t("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(Q){z(Q)}}return v["[[DisposableResourceStack]]"]=null,$==="ASYNC-DISPOSE"?O:S},fm}var pm,Kw;function $8(){return Kw||(Kw=1,pm=function(){var t=[];return{"[[DisposableResourceStack]]":t}}),pm}var mm,Xw;function JE(){if(Xw)return mm;Xw=1;var n=M1(),t=fe(),e=Uf(),r=q1(),i=_h(),s=Kl(),a=G1(),l=j1(),c=C8(),u=sa().supportsDescriptors,f=J1(),p=R8(),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"},Z=f($);u?i(_.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":$}):_.prototype.disposed=!1;var O=function(P){l.set(P,"[[DisposableState]]","DISPOSED"),u||(P.disposed=!0)};return r(_.prototype,"dispose",function(){var P=this;if(!Z(P))return O(P),y(l.get(P,"[[DisposeCapability]]"),a())["?"]()}),r(_.prototype,"use",function(P){var B=this;if(Z(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 F=this;if(Z(F))throw new n("a disposed stack can not use anything new");if(!s(B))throw new t("`onDispose` must be a function");var q=(function(){return e(B,void 0,[P])});return p(l.get(F,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",q),P}),r(_.prototype,"defer",function(P){var B=this;if(Z(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(Z(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()),O(P),B}),S&&r(_.prototype,S,_.prototype.dispose),c(_.prototype,"DisposableStack"),mm=_,mm}var gm,Qw;function YE(){if(Qw)return gm;Qw=1;var n=JE();return gm=function(){return typeof DisposableStack=="function"?DisposableStack:n},gm}var vm,e2;function KE(){if(e2)return vm;e2=1;var n=sa(),t=O1()(),e=YE();return vm=function(){var i=e();return n(t,{DisposableStack:i},{DisposableStack:!0}),i},vm}var ym,t2;function XE(){if(t2)return ym;t2=1;var n=In(),t=M1(),e=fe(),r=n("%Promise%",!0),i=R8(),s=Uf(),a=q1(),l=_h(),c=I8(),u=Kl(),f=$8(),p=G1(),y=K1(),v=j1(),S=C8(),_=sa().supportsDescriptors,$=J1(),Z=Ps(),O=Z("Promise.prototype.then",!0),z=B1()(),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 V=this;return v.assert(V,"[[AsyncDisposableState]]"),v.get(V,"[[AsyncDisposableState]]")==="disposed"},F=$(B);_?l(P.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":B}):P.prototype.disposed=!1;var q=function(V){v.set(V,"[[AsyncDisposableState]]","disposed"),_||(V.disposed=!0)};return a(P.prototype,"disposeAsync",function(){var V=this;return F(V)?y(r):(q(V),O(y(r,c(v.get(V,"[[DisposeCapability]]"),p())),function(ie){return ie["?"]()}))}),a(P.prototype,"use",function(V){var ie=this;if(F(ie))throw new t("a disposed stack can not use anything new");return i(v.get(ie,"[[DisposeCapability]]"),V,"ASYNC-DISPOSE"),V}),a(P.prototype,"adopt",function(V,ie){var Ne=this;if(F(Ne))throw new t("a disposed stack can not use anything new");if(!u(ie))throw new e("`onDisposeAsync` must be a function");var xe=(function(){return s(ie,void 0,[V])});return xe.value=V,i(v.get(Ne,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",xe),V}),a(P.prototype,"defer",function(V){var ie=this;if(F(ie))throw new t("a disposed stack can not defer anything new");if(!u(V))throw new e("`onDispose` must be a function");i(v.get(ie,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",V)}),a(P.prototype,"move",function(){var V=this;if(F(V))throw new t("a disposed stack can not use anything new");var ie=new P;return v.set(ie,"[[DisposeCapability]]",v.get(V,"[[DisposeCapability]]")),v.set(V,"[[DisposeCapability]]",f()),q(V),ie}),z&&a(P.prototype,z,P.prototype.disposeAsync),S(P.prototype,"AsyncDisposableStack"),ym=P,ym}var wm,n2;function QE(){if(n2)return wm;n2=1;var n=XE();return wm=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:n},wm}var bm,r2;function ek(){if(r2)return bm;r2=1;var n=sa(),t=O1()(),e=QE();return bm=function(){var i=e();return n(t,{AsyncDisposableStack:i},{AsyncDisposableStack:!0}),i},bm}var Sm,i2;function tk(){if(i2)return Sm;i2=1;var n=AE(),t=kE(),e=KE(),r=ek();return Sm=function(){n(),t(),e(),r()},Sm}var s2;function nk(){return s2||(s2=1,gE(),tk()()),Uv}nk();const o2=new WeakMap;function rk(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 a2(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function ik(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class sk{constructor(){R(this,"entries",new Map);R(this,"constructionStack",[])}register(t,e){if(e===void 0){if(typeof t!="function")throw a2();this.validateClassRegistration(t),this.storeFactory(t,()=>this.instantiateClass(t));return}if(typeof e!="function")throw a2();if(e.constructor.name==="AsyncFunction")throw ik();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=o2.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=o2.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(rk(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 sk,ok=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function ak(n){for(const t of Object.keys(n))if(ok.has(t))throw new Error(`Event payload key "${t}" is reserved; choose a different property name`)}function lk(n,t){ak(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}),lk(this,c)}}return n}class Ri extends globalThis.EventTarget{}const ck="X-Television-Client-Meta",uk="telemetry-activity",hk="telemetry-signal",P8={kind:"single",full_screen:!1},D8={width:760,height:770};function dk(n){return n.layout.flatMap(t=>t.artifactIds)}function fk(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())pk(r,e,t);return{valid:t.length===0,errors:t}}function Xc(n){return n.flatMap(t=>t.artifactIds)}function Vm(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 pk(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 Wt=$n(),Xh=$n(),l2=$n(),mk=$n(),gk=$n(),vk=$n();function O8(n){class t extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return t}const Ql=O8("RequestError"),c2=O8("ValidationError");function Ul(n,t){return Object.assign(new Error(t),{code:n})}const yk=new TextEncoder;function L8(n){return yk.encode(n).length}const M8=768,Qc=32;function u2(n){const t=n.split("/").filter(e=>e.length>0);return wk(t),t}function wk(n){if(n.length>Qc)throw Ul("invalid-path",`A path has at most ${Qc} segments.`);for(const t of n)if(!N8(t))throw Ul("invalid-path",`A path key is at most ${M8} bytes.`)}function h2(){return Ul("invalid-path",`A value can be at most ${Qc} keys below the store's root.`)}function N8(n){return n.length>0&&!n.includes("/")&&L8(n)<=M8}function bk(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 Sk{constructor(t){R(this,"serverValue");this.serverValue=t,Object.freeze(this)}}class _k{constructor(){Object.freeze(this)}}function ya(n){return Ul("invalid-value",n)}function Ak(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 h2();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(!Ak(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 h2();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 Ek(n){jm(n,!1,new Set,0)}function kk(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 Sk)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))kk(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 Tk(n){return Object.keys(n).map(t=>{const e=n[t];return e instanceof _k?{key:t,delete:!0}:{key:t,value:Wm(e)}})}const z8=16777216;function Ck(n){if(L8(n)>z8)throw Rk()}function Rk(){return Ul("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 Ik=12;new Array(Ik).fill(0);const Fr="/api/resources/v1",mc=(n,t="")=>`${Fr}/resources/${encodeURIComponent(n)}${t===""?"":`/${t}`}`,d2=(n,t)=>`${Fr}/artifacts/${encodeURIComponent(n)}/${t}`,jt={list:`${Fr}/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=>d2(n,"share"),unshare:n=>d2(n,"unshare"),jsonCreate:`${Fr}/json/create`,jsonGet:`${Fr}/json/value`,jsonSet:`${Fr}/json/set`,jsonUpdate:`${Fr}/json/update`,jsonPush:`${Fr}/json/push`,jsonRemove:`${Fr}/json/remove`},f2={artifactID:"artifact",resourceID:"resourceID"};function $k(n){return"artifactID"in n?new URLSearchParams({[f2.artifactID]:n.artifactID}):new URLSearchParams({[f2.resourceID]:n.resourceID})}const xk=200,Pk=300,gc=401,Dk="/events",Ok=4401;class Lk{constructor(t,e){R(this,"serverURL");R(this,"token");R(this,"onUnauthorized");R(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 Mk(i);if(!i.ok||i.status<xk||i.status>=Pk)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[ck]=JSON.stringify(this.telemetryMeta)),Object.keys(e).length>0?e:void 0}}async function Mk(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 Nk(n){return n.map(t=>`${t.name} (${t.id})`).join(", ")}var Vr,jd,H8;class zk{constructor(t){m(this,jd);m(this,Vr);d(this,Vr,t)}list(){return o(this,Vr).requestJSON("GET","/channels")}async get(t={}){const e=await h(this,jd,H8).call(this,t.channelID);return o(this,Vr).requestJSON("GET",`/channels/${encodeURIComponent(e)}`)}create(t){const e={name:t.name};return t.id!==void 0&&(e.id=t.id),o(this,Vr).requestJSON("POST","/channels",e)}update(t){const{channelID:e,...r}=t;return o(this,Vr).requestJSON("PATCH",`/channels/${encodeURIComponent(e)}`,r)}remove(t){return o(this,Vr).requestJSON("DELETE",`/channels/${encodeURIComponent(t.channelID)}`)}}Vr=new WeakMap,jd=new WeakSet,H8=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 c2("channelID is required, but no channels exist."):new c2(`channelID is required when multiple channels exist. Available channels: ${Nk(e)}`)};var Br;class Hk{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 Fa;class Zk{constructor(t){m(this,Fa);d(this,Fa,t)}list(){return o(this,Fa).requestJSON("GET","/themes")}refresh(){return o(this,Fa).requestJSON("POST","/themes/refresh")}}Fa=new WeakMap;var qa;class Uk{constructor(t){m(this,qa);d(this,qa,t)}get(t){return o(this,qa).requestText("GET",`/markdown/${encodeURIComponent(t.artifactID)}`)}update(t){return o(this,qa).requestRawVoid("PUT",`/markdown/${encodeURIComponent(t.artifactID)}`,t.content)}}qa=new WeakMap;var so;class Fk{constructor(t){m(this,so);d(this,so,t)}status(){return o(this,so).requestJSON("GET","/telemetry")}enable(){return o(this,so).requestJSON("POST","/telemetry/enable")}disable(){return o(this,so).requestJSON("POST","/telemetry/disable")}}so=new WeakMap;var oo;class qk{constructor(t){m(this,oo);d(this,oo,t)}get(){return o(this,oo).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,oo).requestVoid("PATCH","/display",e)}focus(t){return o(this,oo).requestJSON("POST","/display/focus",{artifactID:t.artifactID})}}oo=new WeakMap;function Z8(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(Dk));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===Ok?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 Vk(n,t){return!n.exists||!t.exists?n.exists===t.exists:Bm(n.value,t.value)}function Nh(n){return Ek(n),n}var ao,Bi,ba;class Bk{constructor(t){m(this,Bi);m(this,ao);d(this,ao,t)}async create(t){const e={description:t.description};return t.usage!==void 0&&(e.usage=t.usage),t.value!==void 0&&(e.value=Nh(t.value)),(await h(this,Bi,ba).call(this,jt.jsonCreate,e)).resource}get(t){const e=$k(t.store);return e.set("path",t.path),o(this,ao).requestJSON("GET",`${jt.jsonGet}?${e.toString()}`)}async set(t){await h(this,Bi,ba).call(this,jt.jsonSet,{store:t.store,path:t.path,value:Wm(Nh(t.value))})}async update(t){for(const e of Object.keys(t.values))Nh(t.values[e]);await h(this,Bi,ba).call(this,jt.jsonUpdate,{store:t.store,path:t.path,entries:Tk(t.values)})}async push(t){await h(this,Bi,ba).call(this,jt.jsonPush,{store:t.store,path:t.path,key:t.key,value:Wm(Nh(t.value))})}async remove(t){await h(this,Bi,ba).call(this,jt.jsonRemove,{store:t.store,path:t.path})}watch(t){let e;try{e=u2(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||!Vk(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=Z8(o(this,ao),{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 Ul("not-found",`Resource not found: ${u.resourceID}`);a();return}c.event!=="changed"||!f(c)||c.paths.some(p=>bk(u2(p),e))&&a()}},t.signal);return l.finished}}ao=new WeakMap,Bi=new WeakSet,ba=function(t,e){const r=JSON.stringify(e);return Ck(r),o(this,ao).requestSerializedJSON("POST",t,r)};var en;class jk{constructor(t){R(this,"json");m(this,en);d(this,en,t),this.json=new Bk(t)}share(t){return o(this,en).requestJSON("POST",jt.share(t.artifactID),t.access===void 0?{}:{access:t.access})}async unshare(t){await o(this,en).requestJSON("POST",jt.unshare(t.artifactID),{})}async list(t={}){const e=t.artifactID===void 0?"":`?${new URLSearchParams({artifact:t.artifactID}).toString()}`;return(await o(this,en).requestJSON("GET",`${jt.list}${e}`)).resources}async info(t){return(await o(this,en).requestJSON("GET",jt.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,en).requestJSON("POST",jt.describe(t.resourceID),e)).resource}destroy(t){return o(this,en).requestJSON("POST",jt.destroy(t.resourceID),t.force===void 0?{}:{force:t.force})}bind(t){return o(this,en).requestJSON("POST",jt.bind(t.resourceID),{artifactID:t.artifactID,access:t.access})}async unbind(t){await o(this,en).requestJSON("POST",jt.unbind(t.resourceID),{artifactID:t.artifactID})}events(t){return Z8(o(this,en),{onEvent:t.onEvent},t.signal).finished}}en=new WeakMap;var tn;class Wk{constructor(t,e={}){R(this,"channels");R(this,"artifacts");R(this,"display");R(this,"themes");R(this,"markdown");R(this,"telemetry");R(this,"resources");m(this,tn);d(this,tn,new Lk(t,e)),this.channels=new zk(o(this,tn)),this.artifacts=new Hk(o(this,tn)),this.display=new qk(o(this,tn)),this.themes=new Zk(o(this,tn)),this.markdown=new Uk(o(this,tn)),this.telemetry=new Fk(o(this,tn)),this.resources=new jk(o(this,tn))}health(){return o(this,tn).requestJSON("GET","/health")}demoMode(){return o(this,tn).requestJSON("GET","/demo-mode")}}tn=new WeakMap;const Id="0.0.0",Gk=/^\d+\.\d+\.\d+$/,Jk=3;function Ff(n){return Gk.test(n)}function X1(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 Yk(n,t){return n===Id||t===Id?!1:n!==t}const Kk=400,Xk=404,U8=500,Qk=600,eT={focusedChannelId:null,pinnedChannelIds:[],activeThemeName:null,activeThemeColorScheme:null,appearanceMode:"system",themeJavaScriptConsentIds:[],acpEnabled:!1};var de,au,lu,jr,Ye,_e,lo,ji,co,Wr,nn,Va,cu,U,ir,Gm,Sa,F8,Jm,q8,Qh,Ym,V8,_a,B8,Zr,Km,j8,tt;class tT extends Ri{constructor(e){super();m(this,U);m(this,de);m(this,au);m(this,lu);m(this,jr,new Set);R(this,"pendingPageWrites",new Map);m(this,Ye,new Map);m(this,_e,iT());m(this,lo);m(this,ji,!1);m(this,co,!1);m(this,Wr,0);m(this,nn,!1);m(this,Va,()=>{if(o(this,nn))return;const e=o(this,de).connection.status==="connected";e&&!o(this,co)?(d(this,co,!0),h(this,U,B8).call(this)):!e&&o(this,co)&&(d(this,co,!1),d(this,Wr,o(this,Wr)+1)),h(this,U,Zr).call(this)});m(this,cu,e=>{if(o(this,nn))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 l2("artifact-content-changed",{artifactID:r.artifactID}));return}if(r.type==="artifact-focus"){o(this,ji)&&$d(o(this,_e),o(this,Ye),r.channelID,r.artifactID)&&h(this,U,Zr).call(this),this.dispatchEvent(new mk("artifact-focus",{channelID:r.channelID,artifactID:r.artifactID}));return}r.type==="theme-changed"&&this.dispatchEvent(new gk("theme-changed",{themeName:r.themeName,activeThemeColorScheme:r.activeThemeColorScheme,themeJavaScriptConsentIds:[...r.themeJavaScriptConsentIds]})),r.type==="appearance-changed"&&this.dispatchEvent(new vk("appearance-changed",{appearanceMode:r.appearanceMode})),o(this,ji)&&(zh(o(this,_e),r,this.pendingPageWrites,o(this,Ye)),Em(o(this,_e),o(this,Ye)),h(this,U,Zr).call(this))});d(this,de,e.connectionOwner),d(this,au,e.navigationKeyHandler),d(this,lu,e.retainedGateHalted??(()=>!1)),d(this,lo,h(this,U,Km).call(this)),o(this,de).addEventListener("change",o(this,Va)),o(this,de).addEventListener("server-event",o(this,cu)),o(this,Va).call(this)}get snapshot(){return o(this,lo)}handleNavigationKey(e){var r;h(this,U,tt).call(this),(r=o(this,au))==null||r.call(this,e)}async createChannel(e){h(this,U,tt).call(this);const{channel:r}=await h(this,U,ir).call(this,o(this,de).connection.client.channels.create({name:e}),()=>h(this,U,F8).call(this));return r}focusChannel(e){return h(this,U,tt).call(this),h(this,U,ir).call(this,o(this,de).connection.client.display.patch({focusedChannelId:e}),()=>h(this,U,Sa).call(this))}setPinnedChannelIds(e){return h(this,U,tt).call(this),h(this,U,ir).call(this,o(this,de).connection.client.display.patch({pinnedChannelIds:[...e]}),()=>h(this,U,Sa).call(this))}listThemes(){return h(this,U,tt).call(this),o(this,de).connection.client.themes.list()}refreshThemes(){return h(this,U,tt).call(this),o(this,de).connection.client.themes.refresh()}setActiveTheme(e){return h(this,U,tt).call(this),h(this,U,ir).call(this,o(this,de).connection.client.display.patch({activeThemeName:e}),()=>h(this,U,Sa).call(this))}setAppearanceMode(e){return h(this,U,tt).call(this),h(this,U,ir).call(this,o(this,de).connection.client.display.patch({appearanceMode:e}),()=>h(this,U,Sa).call(this))}setThemeJavaScriptConsent(e,r){h(this,U,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,U,ir).call(this,o(this,de).connection.client.display.patch({themeJavaScriptConsentIds:s}),()=>h(this,U,Sa).call(this))}selectPage(e,r){h(this,U,tt).call(this),$d(o(this,_e),o(this,Ye),e,r)&&h(this,U,Zr).call(this)}async renameChannel(e,r){h(this,U,tt).call(this),await h(this,U,ir).call(this,o(this,de).connection.client.channels.update({channelID:e,name:r}),()=>h(this,U,Jm).call(this,e))}async deleteChannel(e){h(this,U,tt).call(this),await h(this,U,ir).call(this,o(this,de).connection.client.channels.remove({channelID:e}),()=>h(this,U,q8).call(this,e))}updateChannelPages(e,r){h(this,U,tt).call(this);const i=fk(r),s=o(this,_e).channels.get(e);if(!i.valid||!s)return Promise.resolve();const a=to(r),l=to(s.channel.layout),c={previousPages:l};return ta(o(this,Ye),e,l,a),s.channel={...s.channel,layout:a},this.pendingPageWrites.set(e,c),h(this,U,Zr).call(this),o(this,de).connection.client.channels.update({channelID:e,layout:to(a)}).then(()=>{this.pendingPageWrites.get(e)===c&&this.pendingPageWrites.delete(e)},async u=>{if(o(this,nn))throw u;const f=this.pendingPageWrites.get(e)===c;if(f&&this.pendingPageWrites.delete(e),m2(u))throw await h(this,U,Gm).call(this,()=>h(this,U,Jm).call(this,e)),u;if(!f||!cT(u))throw u;const p=o(this,_e).channels.get(e);if(!p)throw u;const y=to(c.previousPages);throw ta(o(this,Ye),e,p.channel.layout,y),p.channel={...p.channel,layout:y},h(this,U,Zr).call(this),u})}async deleteArtifact(e){h(this,U,tt).call(this);const r=g2(o(this,_e),e);await h(this,U,ir).call(this,o(this,de).connection.client.artifacts.delete({artifactID:e}),()=>h(this,U,V8).call(this,e,r))}readMarkdown(e){return h(this,U,tt).call(this),o(this,de).connection.client.markdown.get({artifactID:e})}writeMarkdown(e,r){return h(this,U,tt).call(this),o(this,de).connection.client.markdown.update({artifactID:e,content:r})}get browserDemoMode(){return o(this,de).connection.browserDemoMode}getArtifactViewURL(e){return h(this,U,tt).call(this),o(this,de).connection.getViewURL(e)}getArtifactContentURL(e){return h(this,U,tt).call(this),o(this,de).connection.getContentURL(e)}dispose(){o(this,nn)||(d(this,nn,!0),d(this,Wr,o(this,Wr)+1),o(this,jr).clear(),this.pendingPageWrites.clear(),o(this,Ye).clear(),o(this,de).removeEventListener("change",o(this,Va)),o(this,de).removeEventListener("server-event",o(this,cu)))}}de=new WeakMap,au=new WeakMap,lu=new WeakMap,jr=new WeakMap,Ye=new WeakMap,_e=new WeakMap,lo=new WeakMap,ji=new WeakMap,co=new WeakMap,Wr=new WeakMap,nn=new WeakMap,Va=new WeakMap,cu=new WeakMap,U=new WeakSet,ir=async function(e,r){try{return await e}catch(i){throw!o(this,nn)&&m2(i)&&await h(this,U,Gm).call(this,r),i}},Gm=async function(e){try{await e()}catch{}},Sa=function(){const e=o(this,de).connection.client;return h(this,U,_a).call(this,()=>e.display.get(),r=>h(this,U,Qh).call(this,r))},F8=function(){const e=o(this,de).connection.client;return h(this,U,_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:Ha(a),artifacts:new Map});h(this,U,Qh).call(this,i)})},Jm=function(e){const r=o(this,de).connection.client;return h(this,U,_a).call(this,()=>km(()=>r.channels.get({channelID:e})),i=>h(this,U,Ym).call(this,e,i))},q8=function(e){const r=o(this,de).connection.client;return h(this,U,_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,U,Ym).call(this,e,i),h(this,U,Qh).call(this,s)})},Qh=function(e){o(this,_e).display=Qm(e),o(this,de).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}ta(o(this,Ye),e,(i==null?void 0:i.channel.layout)??[],r.channel.layout),o(this,_e).channels.set(e,{channel:Ha(r.channel),artifacts:new Map(r.artifacts.map(s=>[s.id,structuredClone(s)]))})},V8=function(e,r){const i=o(this,de).connection.client;return h(this,U,_a).call(this,()=>km(()=>i.artifacts.get({artifactID:e})),s=>{const a=g2(o(this,_e),e)??r;if(s===null){a!==null&&zh(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,nn)||i!==o(this,Wr))return;r(a);for(const l of s)zh(o(this,_e),l,this.pendingPageWrites,o(this,Ye));Em(o(this,_e),o(this,Ye)),h(this,U,Zr).call(this)}finally{o(this,jr).delete(s)}},B8=async function(){const e=++Lh(this,Wr)._,r=o(this,de).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,nn)||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:Ha(p.channel),artifacts:new Map(p.artifacts.map(y=>[y.id,structuredClone(y)]))});sT(o(this,Ye),o(this,_e),u);for(const p of s)zh(u,p,this.pendingPageWrites,o(this,Ye));Em(u,o(this,Ye));const f=o(this,ji)?nT(o(this,_e),u):[];this.pendingPageWrites.clear(),d(this,_e,u),d(this,ji,!0),r.acpClient.setEnabled(l.acpEnabled),h(this,U,Zr).call(this);for(const p of f)this.dispatchEvent(new l2("artifact-content-changed",{artifactID:p}))}catch{}finally{o(this,jr).delete(s)}},Zr=function(){o(this,nn)||(d(this,lo,h(this,U,Km).call(this)),h(this,U,j8).call(this),this.dispatchEvent(new Wt("change")))},Km=function(){var s;const e=[...o(this,_e).channels.values()].map(a=>aT(a,o(this,Ye).get(a.channel.id))),r=e.find(({id:a})=>a===o(this,_e).display.focusedChannelId)??null,i=o(this,de).connection;return Object.freeze({ready:o(this,ji),channels:Object.freeze(e),display:lT(o(this,_e).display),focusedChannel:r,connection:Object.freeze({authorizationRequired:i.hasAuthRejected,gateHalted:i.bootState==="halted"||o(this,lu).call(this),status:i.status,hasEverConnected:i.hasEverConnected,failedReconnectAttempts:i.failedReconnectAttempts,firstConnectError:i.hasEverConnected?null:o(this,de).connectError,nextRetryAt:i.nextRetryAt,upgradeInstructions:rT(((s=i.updateState)==null?void 0:s.desktop)??null)})})},j8=function(){const e=o(this,lo).focusedChannel;o(this,de).connection.acpClient.setChannelContext(e?{channelID:e.id,channelName:e.name}:null)},tt=function(){if(o(this,nn))throw new Error("ApplicationService is disposed")};function nT(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 rT(n){return n===null?null:Object.freeze({...n})}function iT(){return{channels:new Map,display:Qm(eT)}}function zh(n,t,e,r){switch(t.type){case"channel-created":r.delete(t.channel.id),n.channels.set(t.channel.id,{channel:Ha(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:Ha(t.channel),artifacts:new Map});return}ta(r,t.channel.id,i.channel.layout,t.channel.layout);const s=new Set(Xc(t.channel.layout));i.channel=Ha(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=p2(s.previousPages,t.artifact.id)),!Xc(i.channel.layout).includes(t.artifact.id)){const a=i.channel.layout,l=p2(a,t.artifact.id);ta(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=Vm(s.previousPages,t.artifactID)),i.artifacts.delete(t.artifactID);const a=i.channel.layout,l=Vm(a,t.artifactID);ta(r,t.channelID,a,l),i.channel={...i.channel,layout:l};return}case"artifact-focus":$d(n,r,t.channelID,t.artifactID);return;case"artifact-content-changed":return;default:return uT(t)}}function sT(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)ta(n,i,((r=t.channels.get(i))==null?void 0:r.channel.layout)??[],s.channel.layout)}function ta(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 $d(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&&oT(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&&$d(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 oT(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}function aT(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 lT(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 p2(n,t){return Xc(n).includes(t)?to(n):[...to(n),{artifactIds:[t],geometry:{...P8},size:{...D8}}]}function cT(n){return n instanceof Ql&&n.status!==void 0&&n.status>=Kk&&n.status<U8}function m2(n){return n instanceof Ql&&(n.status===void 0||n.status>=U8&&n.status<Qk)}async function km(n){try{return await n()}catch(t){if(t instanceof Ql&&t.status===Xk)return null;throw t}}function g2(n,t){for(const[e,r]of n.channels)if(r.artifacts.has(t))return e;return null}function to(n){return n.map(t=>({artifactIds:[...t.artifactIds],geometry:{...t.geometry},size:{...t.size}}))}function Ha(n){return{id:n.id,name:n.name,layout:to(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 uT(n){throw new Error(`Unexpected server event: ${JSON.stringify(n)}`)}function hT(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:(v2(),n.selectPage(r.id,p),!0)}const i=dT(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:(v2(),n.focusChannel(l).catch(()=>{}),!0)}function dT(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 v2(){const n=document.activeElement;n instanceof HTMLElement&&n.blur()}const W8="0123456789ABCDEFGHJKMNPQRSTVWXYZ",xd=32,fT=16,G8=10,y2=0xffffffffffff;var no;(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"})(no||(no={}));class Rc extends Error{constructor(t,e){super(`${e} (${t})`),this.name="ULIDError",this.code=t}}function pT(n){const t=Math.floor(n()*xd)%xd;return W8.charAt(t)}function mT(n){const t=gT(),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 Rc(no.PRNGDetectFailure,"Failed to find a reliable PRNG")}function gT(){return wT()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function vT(n,t){let e="";for(;n>0;n--)e=pT(t)+e;return e}function yT(n,t=G8){if(isNaN(n))throw new Rc(no.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>y2)throw new Rc(no.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${y2}: ${n}`);if(n<0)throw new Rc(no.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Rc(no.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let e,r="";for(let i=t;i>0;i--)e=n%xd,r=W8.charAt(e)+r,n=(n-e)/xd;return r}function wT(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function Q1(n,t){const e=mT(),r=Date.now();return yT(r,G8)+vT(fT,e)}const Ic=$n(),J8=$n(),Y8=$n(),bT=$n(),Tm=$n(),ST="store-";function oa(n){return new URL(n).origin}function _T(){return{authTokens:{}}}var uo,ho,fo;class AT extends Ri{constructor(e,r,i={}){super();m(this,uo);m(this,ho);m(this,fo);d(this,uo,`${ST}${e}`),d(this,ho,i.storage??TT());const s=o(this,ho).getItem(o(this,uo));s===null?(d(this,fo,r),o(this,ho).setItem(o(this,uo),JSON.stringify(r))):d(this,fo,CT(JSON.parse(s),r))}get(){return o(this,fo)}set(e){d(this,fo,e),o(this,ho).setItem(o(this,uo),JSON.stringify(e)),this.dispatchEvent(new Wt("change"))}}uo=new WeakMap,ho=new WeakMap,fo=new WeakMap;function w2(n,t){return n.authTokens[oa(t)]??null}function ET(n,t,e){return{authTokens:{...n.authTokens,[oa(t)]:e}}}function kT(n,t){const e=oa(t);if(!(e in n.authTokens))return n;const r={...n.authTokens};return delete r[e],{authTokens:r}}function TT(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function CT(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[oa(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 Za 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 Rs(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 qf(n){return{get value(){{const t=n();return Object.defineProperty(this,"value",{value:t}),t}}}}function ev(n){return n==null}function tv(n){const t=n.startsWith("^")?1:0,e=n.endsWith("$")?n.length-1:n.length;return n.slice(t,e)}function RT(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 b2=Symbol("evaluating");function Ae(n,t,e){let r;Object.defineProperty(n,t,{get(){if(r!==b2)return r===void 0&&(r=b2,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 Ds(...n){const t={};for(const e of n){const r=Object.getOwnPropertyDescriptors(e);Object.assign(t,r)}return Object.defineProperties({},t)}function S2(n){return JSON.stringify(n)}function IT(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 $T=qf(()=>{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 Fl(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 Fl(n)?{...n}:Array.isArray(n)?[...n]:n}const xT=new Set(["string","number","symbol"]);function ql(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 PT(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}const DT={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 OT(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=Ds(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 LT(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=Ds(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 MT(n,t){if(!Fl(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=Ds(n._zod.def,{get shape(){const s={...n._zod.def.shape,...t};return aa(this,"shape",s),s}});return Os(n,i)}function NT(n,t){if(!Fl(t))throw new Error("Invalid input to safeExtend: expected a plain object");const e=Ds(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t};return aa(this,"shape",r),r}});return Os(n,e)}function zT(n,t){const e=Ds(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 HT(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=Ds(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 ZT(n,t,e){const r=Ds(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 Hh(n){return typeof n=="string"?n:n==null?void 0:n.message}function Is(n,t,e){var i,s,a,l,c,u;const r={...n,path:n.path??[]};if(!n.message){const f=Hh((a=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:a.call(s,n))??Hh((l=t==null?void 0:t.error)==null?void 0:l.call(t,n))??Hh((c=e.customError)==null?void 0:c.call(e,n))??Hh((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 nv(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 UT(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 FT(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 rv=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 Za;if(a.issues.length){const l=new((i==null?void 0:i.Err)??n)(a.issues.map(c=>Is(c,s,Rs())));throw e6(l,i==null?void 0:i.callee),l}return a.value},iv=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=>Is(c,s,Rs())));throw e6(l,i==null?void 0:i.callee),l}return a.value},Vf=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 Za;return s.issues.length?{success:!1,error:new(n??r6)(s.issues.map(a=>Is(a,i,Rs())))}:{success:!0,data:s.value}},qT=Vf(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=>Is(a,i,Rs())))}:{success:!0,data:s.value}},VT=Bf(i6),BT=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return rv(n)(t,e,i)},jT=n=>(t,e,r)=>rv(n)(t,e,r),WT=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return iv(n)(t,e,i)},GT=n=>async(t,e,r)=>iv(n)(t,e,r),JT=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Vf(n)(t,e,i)},YT=n=>(t,e,r)=>Vf(n)(t,e,r),KT=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Bf(n)(t,e,i)},XT=n=>async(t,e,r)=>Bf(n)(t,e,r),QT=/^[cC][^\s-]{8,}$/,eC=/^[0-9a-z]+$/,tC=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,nC=/^[0-9a-vA-V]{20}$/,rC=/^[A-Za-z0-9]{27}$/,iC=/^[a-zA-Z0-9_-]{21}$/,sC=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,oC=/^([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})$/,_2=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)$/,aC=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,lC="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function cC(){return new RegExp(lC,"u")}const uC=/^(?:(?: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])$/,hC=/^(([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}|:))$/,dC=/^((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])$/,fC=/^(([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])$/,pC=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,s6=/^[A-Za-z0-9_-]*$/,mC=/^\+[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])))",gC=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 vC(n){return new RegExp(`^${a6(n)}$`)}function yC(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 wC=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}$`)},bC=/^-?\d+$/,l6=/^-?\d+(?:\.\d+)?$/,SC=/^(?:true|false)$/i,_C=/^[^A-Z]*$/,AC=/^[^a-z]*$/,Jt=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)=>{Jt.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)=>{Jt.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})}}),EC=I("$ZodCheckMultipleOf",(n,t)=>{Jt.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):RT(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})}}),kC=I("$ZodCheckNumberFormat",(n,t)=>{var a;Jt.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]=DT[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=bC)}),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})}}),TC=I("$ZodCheckMaxLength",(n,t)=>{var e;Jt.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!ev(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=nv(i);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),CC=I("$ZodCheckMinLength",(n,t)=>{var e;Jt.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!ev(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=nv(i);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),RC=I("$ZodCheckLengthEquals",(n,t)=>{var e;Jt.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!ev(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=nv(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;Jt.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=()=>{})}),IC=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})}}),$C=I("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=_C),jf.init(n,t)}),xC=I("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=AC),jf.init(n,t)}),PC=I("$ZodCheckIncludes",(n,t)=>{Jt.init(n,t);const e=ql(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})}}),DC=I("$ZodCheckStartsWith",(n,t)=>{Jt.init(n,t);const e=new RegExp(`^${ql(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})}}),OC=I("$ZodCheckEndsWith",(n,t)=>{Jt.init(n,t);const e=new RegExp(`.*${ql(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})}}),LC=I("$ZodCheckOverwrite",(n,t)=>{Jt.init(n,t),n._zod.check=e=>{e.value=t.tx(e.value)}});class MC{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 NC={major:4,minor:3,patch:6},Ue=I("$ZodType",(n,t)=>{var i;var e;n??(n={}),n._zod.def=t,n._zod.bag=n._zod.bag||{},n._zod.version=NC;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 Za;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 Za;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 Za;return u.then(f=>s(f,r,c))}return s(u,r,c)}}Ae(n,"~standard",()=>({validate:s=>{var a;try{const l=qT(n,s);return l.success?{value:l.data}:{issues:(a=l.error)==null?void 0:a.issues}}catch{return VT(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}))}),sv=I("$ZodString",(n,t)=>{var e;Ue.init(n,t),n._zod.pattern=[...((e=n==null?void 0:n._zod.bag)==null?void 0:e.patterns)??[]].pop()??wC(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),sv.init(n,t)}),zC=I("$ZodGUID",(n,t)=>{t.pattern??(t.pattern=oC),Me.init(n,t)}),HC=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=_2(r))}else t.pattern??(t.pattern=_2());Me.init(n,t)}),ZC=I("$ZodEmail",(n,t)=>{t.pattern??(t.pattern=aC),Me.init(n,t)}),UC=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})}}}),FC=I("$ZodEmoji",(n,t)=>{t.pattern??(t.pattern=cC()),Me.init(n,t)}),qC=I("$ZodNanoID",(n,t)=>{t.pattern??(t.pattern=iC),Me.init(n,t)}),VC=I("$ZodCUID",(n,t)=>{t.pattern??(t.pattern=QT),Me.init(n,t)}),BC=I("$ZodCUID2",(n,t)=>{t.pattern??(t.pattern=eC),Me.init(n,t)}),jC=I("$ZodULID",(n,t)=>{t.pattern??(t.pattern=tC),Me.init(n,t)}),WC=I("$ZodXID",(n,t)=>{t.pattern??(t.pattern=nC),Me.init(n,t)}),GC=I("$ZodKSUID",(n,t)=>{t.pattern??(t.pattern=rC),Me.init(n,t)}),JC=I("$ZodISODateTime",(n,t)=>{t.pattern??(t.pattern=yC(t)),Me.init(n,t)}),YC=I("$ZodISODate",(n,t)=>{t.pattern??(t.pattern=gC),Me.init(n,t)}),KC=I("$ZodISOTime",(n,t)=>{t.pattern??(t.pattern=vC(t)),Me.init(n,t)}),XC=I("$ZodISODuration",(n,t)=>{t.pattern??(t.pattern=sC),Me.init(n,t)}),QC=I("$ZodIPv4",(n,t)=>{t.pattern??(t.pattern=uC),Me.init(n,t),n._zod.bag.format="ipv4"}),eR=I("$ZodIPv6",(n,t)=>{t.pattern??(t.pattern=hC),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})}}}),tR=I("$ZodCIDRv4",(n,t)=>{t.pattern??(t.pattern=dC),Me.init(n,t)}),nR=I("$ZodCIDRv6",(n,t)=>{t.pattern??(t.pattern=fC),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 rR=I("$ZodBase64",(n,t)=>{t.pattern??(t.pattern=pC),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 iR(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 sR=I("$ZodBase64URL",(n,t)=>{t.pattern??(t.pattern=s6),Me.init(n,t),n._zod.bag.contentEncoding="base64url",n._zod.check=e=>{iR(e.value)||e.issues.push({code:"invalid_format",format:"base64url",input:e.value,inst:n,continue:!t.abort})}}),oR=I("$ZodE164",(n,t)=>{t.pattern??(t.pattern=mC),Me.init(n,t)});function aR(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 lR=I("$ZodJWT",(n,t)=>{Me.init(n,t),n._zod.check=e=>{aR(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)=>{Ue.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}}),cR=I("$ZodNumberFormat",(n,t)=>{kC.init(n,t),f6.init(n,t)}),uR=I("$ZodBoolean",(n,t)=>{Ue.init(n,t),n._zod.pattern=SC,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}}),hR=I("$ZodUnknown",(n,t)=>{Ue.init(n,t),n._zod.parse=e=>e}),dR=I("$ZodNever",(n,t)=>{Ue.init(n,t),n._zod.parse=(e,r)=>(e.issues.push({expected:"never",code:"invalid_type",input:e.value,inst:n}),e)});function A2(n,t,e){n.issues.length&&t.issues.push(...Na(e,n.issues)),t.value[e]=n.value}const fR=I("$ZodArray",(n,t)=>{Ue.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=>A2(u,e,a))):A2(c,e,a)}return s.length?Promise.all(s).then(()=>e):e}});function Pd(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=PT(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=>Pd(v,e,p,t,f))):Pd(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 pR=I("$ZodObject",(n,t)=>{Ue.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=qf(()=>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($=>Pd($,l,y,u,S))):Pd(_,l,y,u,S)}return s?m6(f,u,l,c,r.value,n):f.length?Promise.all(f).then(()=>l):l}}),mR=I("$ZodObjectJIT",(n,t)=>{pR.init(n,t);const e=n._zod.parse,r=qf(()=>p6(t)),i=y=>{var z;const v=new MC(["shape","payload","ctx"]),S=r.value,_=P=>{const B=S2(P);return`shape[${B}]._zod.run({ value: input[${B}], issues: [] }, ctx)`};v.write("const input = payload.value;");const $=Object.create(null);let Z=0;for(const P of S.keys)$[P]=`key_${Z++}`;v.write("const newResult = {};");for(const P of S.keys){const B=$[P],F=S2(P),q=y[P],Q=((z=q==null?void 0:q._zod)==null?void 0:z.optout)==="optional";v.write(`const ${B} = ${_(P)};`),Q?v.write(`
|
|
29
|
+
if (${B}.issues.length) {
|
|
30
|
+
if (${F} in input) {
|
|
31
|
+
payload.issues = payload.issues.concat(${B}.issues.map(iss => ({
|
|
32
|
+
...iss,
|
|
33
|
+
path: iss.path ? [${F}, ...iss.path] : [${F}]
|
|
34
|
+
})));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (${B}.value === undefined) {
|
|
39
|
+
if (${F} in input) {
|
|
40
|
+
newResult[${F}] = undefined;
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
newResult[${F}] = ${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 ? [${F}, ...iss.path] : [${F}]
|
|
51
|
+
})));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (${B}.value === undefined) {
|
|
55
|
+
if (${F} in input) {
|
|
56
|
+
newResult[${F}] = undefined;
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
newResult[${F}] = ${B}.value;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
`)}v.write("payload.value = newResult;"),v.write("return payload;");const O=v.compile();return(P,B)=>O(y,P,B)};let s;const a=eu,l=!X8.jitless,u=l&&$T.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 E2(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=>Is(a,r,Rs())))}),t)}const g6=I("$ZodUnion",(n,t)=>{Ue.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=>tv(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=>E2(c,i,n,s)):E2(l,i,n,s)}}),gR=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=qf(()=>{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)}}),vR=I("$ZodIntersection",(n,t)=>{Ue.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])=>k2(e,c,u)):k2(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(Fl(n)&&Fl(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 k2(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 yR=I("$ZodRecord",(n,t)=>{Ue.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!Fl(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=>Is(p,r,Rs())),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}}),wR=I("$ZodEnum",(n,t)=>{Ue.init(n,t);const e=Q8(t.entries),r=new Set(e);n._zod.values=r,n._zod.pattern=new RegExp(`^(${e.filter(i=>xT.has(typeof i)).map(i=>typeof i=="string"?ql(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}}),bR=I("$ZodLiteral",(n,t)=>{if(Ue.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"?ql(r):r?ql(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}}),SR=I("$ZodTransform",(n,t)=>{Ue.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 Za;return e.value=i,e}});function T2(n,t){return n.issues.length&&t===void 0?{issues:[],value:void 0}:n}const v6=I("$ZodOptional",(n,t)=>{Ue.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(`^(${tv(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=>T2(s,e.value)):T2(i,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,r)}}),_R=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)}),AR=I("$ZodNullable",(n,t)=>{Ue.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(`^(${tv(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)}),ER=I("$ZodDefault",(n,t)=>{Ue.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 kR=I("$ZodPrefault",(n,t)=>{Ue.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))}),TR=I("$ZodNonOptional",(n,t)=>{Ue.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=>R2(s,n)):R2(i,n)}});function R2(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 CR=I("$ZodCatch",(n,t)=>{Ue.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=>Is(a,r,Rs()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(s=>Is(s,r,Rs()))},input:e.value}),e.issues=[]),e)}}),RR=I("$ZodPipe",(n,t)=>{Ue.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=>Zh(a,t.in,r)):Zh(s,t.in,r)}const i=t.in._zod.run(e,r);return i instanceof Promise?i.then(s=>Zh(s,t.out,r)):Zh(i,t.out,r)}});function Zh(n,t,e){return n.issues.length?(n.aborted=!0,n):t._zod.run({value:n.value,issues:n.issues},e)}const IR=I("$ZodReadonly",(n,t)=>{Ue.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(I2):I2(i)}});function I2(n){return n.value=Object.freeze(n.value),n}const $R=I("$ZodCustom",(n,t)=>{Jt.init(n,t),Ue.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=>$2(s,e,r,n));$2(i,e,r,n)}});function $2(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 x2;class xR{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 PR(){return new xR}(x2=globalThis).__zod_globalRegistry??(x2.__zod_globalRegistry=PR());const $c=globalThis.__zod_globalRegistry;function DR(n,t){return new n({type:"string",...Y(t)})}function OR(n,t){return new n({type:"string",format:"email",check:"string_format",abort:!1,...Y(t)})}function P2(n,t){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...Y(t)})}function LR(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...Y(t)})}function MR(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Y(t)})}function NR(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Y(t)})}function zR(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Y(t)})}function HR(n,t){return new n({type:"string",format:"url",check:"string_format",abort:!1,...Y(t)})}function ZR(n,t){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...Y(t)})}function UR(n,t){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...Y(t)})}function FR(n,t){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...Y(t)})}function qR(n,t){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...Y(t)})}function VR(n,t){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...Y(t)})}function BR(n,t){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...Y(t)})}function jR(n,t){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...Y(t)})}function WR(n,t){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...Y(t)})}function GR(n,t){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...Y(t)})}function JR(n,t){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Y(t)})}function YR(n,t){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Y(t)})}function KR(n,t){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...Y(t)})}function XR(n,t){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...Y(t)})}function QR(n,t){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...Y(t)})}function e3(n,t){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...Y(t)})}function t3(n,t){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Y(t)})}function n3(n,t){return new n({type:"string",format:"date",check:"string_format",...Y(t)})}function r3(n,t){return new n({type:"string",format:"time",check:"string_format",precision:null,...Y(t)})}function i3(n,t){return new n({type:"string",format:"duration",check:"string_format",...Y(t)})}function s3(n,t){return new n({type:"number",checks:[],...Y(t)})}function o3(n,t){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...Y(t)})}function a3(n,t){return new n({type:"boolean",...Y(t)})}function l3(n){return new n({type:"unknown"})}function c3(n,t){return new n({type:"never",...Y(t)})}function D2(n,t){return new u6({check:"less_than",...Y(t),value:n,inclusive:!1})}function Cm(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 Rm(n,t){return new h6({check:"greater_than",...Y(t),value:n,inclusive:!0})}function L2(n,t){return new EC({check:"multiple_of",...Y(t),value:n})}function y6(n,t){return new TC({check:"max_length",...Y(t),maximum:n})}function Dd(n,t){return new CC({check:"min_length",...Y(t),minimum:n})}function w6(n,t){return new RC({check:"length_equals",...Y(t),length:n})}function u3(n,t){return new IC({check:"string_format",format:"regex",...Y(t),pattern:n})}function h3(n){return new $C({check:"string_format",format:"lowercase",...Y(n)})}function d3(n){return new xC({check:"string_format",format:"uppercase",...Y(n)})}function f3(n,t){return new PC({check:"string_format",format:"includes",...Y(t),includes:n})}function p3(n,t){return new DC({check:"string_format",format:"starts_with",...Y(t),prefix:n})}function m3(n,t){return new OC({check:"string_format",format:"ends_with",...Y(t),suffix:n})}function ec(n){return new LC({check:"overwrite",tx:n})}function g3(n){return ec(t=>t.normalize(n))}function v3(){return ec(n=>n.trim())}function y3(){return ec(n=>n.toLowerCase())}function w3(){return ec(n=>n.toUpperCase())}function b3(){return ec(n=>IT(n))}function S3(n,t,e){return new n({type:"array",element:t,...Y(e)})}function _3(n,t,e){return new n({type:"custom",check:"custom",fn:t,...Y(e)})}function A3(n){const t=E3(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 E3(n,t){const e=new Jt({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,Z=n.external.uri??(z=>z);if($)return{ref:Z($)};const O=f[1].defId??f[1].schema.id??`schema${n.counter++}`;return f[1].defId=O,{defId:O,ref:`${Z("__shared")}#/${p}/${O}`}}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 O in p)O==="$ref"||O==="allOf"||O in y||delete p[O];if($.$ref&&_.def)for(const O in p)O==="$ref"||O==="allOf"||O in _.def&&JSON.stringify(p[O])===JSON.stringify(_.def[O])&&delete p[O]}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:Od(t,"input",n.processors),output:Od(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 k3=(n,t={})=>e=>{const r=b6({...e,processors:t});return Xe(n,r),S6(r,n),_6(r,n)},Od=(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)},T3={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},C3=(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=T3[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}))])}},R3=(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)},I3=(n,t,e,r)=>{e.type="boolean"},$3=(n,t,e,r)=>{e.not={}},x3=(n,t,e,r)=>{},P3=(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},D3=(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},O3=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},L3=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},M3=(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"]})},N3=(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)},z3=(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},H3=(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},Z3=(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)}},U3=(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"}]},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},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,e.default=JSON.parse(JSON.stringify(i.defaultValue))},V3=(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)))},B3=(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},j3=(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},W3=(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},G3=I("ZodISODateTime",(n,t)=>{JC.init(n,t),qe.init(n,t)});function J3(n){return t3(G3,n)}const Y3=I("ZodISODate",(n,t)=>{YC.init(n,t),qe.init(n,t)});function K3(n){return n3(Y3,n)}const X3=I("ZodISOTime",(n,t)=>{KC.init(n,t),qe.init(n,t)});function Q3(n){return r3(X3,n)}const eI=I("ZodISODuration",(n,t)=>{XC.init(n,t),qe.init(n,t)});function tI(n){return i3(eI,n)}const E6=(n,t)=>{r6.init(n,t),n.name="ZodError",Object.defineProperties(n,{format:{value:e=>FT(n,e)},flatten:{value:e=>UT(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}}})},M2=I("ZodError",E6),xn=I("ZodError",E6,{Parent:Error}),nI=rv(xn),rI=iv(xn),iI=Vf(xn),sI=Bf(xn),oI=BT(xn),aI=jT(xn),lI=WT(xn),cI=GT(xn),uI=JT(xn),hI=YT(xn),dI=KT(xn),fI=XT(xn),Fe=I("ZodType",(n,t)=>(Ue.init(n,t),Object.assign(n["~standard"],{jsonSchema:{input:Od(n,"input"),output:Od(n,"output")}}),n.toJSONSchema=k3(n,{}),n.def=t,n.type=t.type,Object.defineProperty(n,"_def",{value:t}),n.check=(...e)=>n.clone(Ds(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)=>nI(n,e,r,{callee:n.parse}),n.safeParse=(e,r)=>iI(n,e,r),n.parseAsync=async(e,r)=>rI(n,e,r,{callee:n.parseAsync}),n.safeParseAsync=async(e,r)=>sI(n,e,r),n.spa=n.safeParseAsync,n.encode=(e,r)=>oI(n,e,r),n.decode=(e,r)=>aI(n,e,r),n.encodeAsync=async(e,r)=>lI(n,e,r),n.decodeAsync=async(e,r)=>cI(n,e,r),n.safeEncode=(e,r)=>uI(n,e,r),n.safeDecode=(e,r)=>hI(n,e,r),n.safeEncodeAsync=async(e,r)=>dI(n,e,r),n.safeDecodeAsync=async(e,r)=>fI(n,e,r),n.refine=(e,r)=>n.check(s$(e,r)),n.superRefine=e=>n.check(o$(e)),n.overwrite=e=>n.check(ec(e)),n.optional=()=>H2(n),n.exactOptional=()=>jI(n),n.nullable=()=>Z2(n),n.nullish=()=>H2(Z2(n)),n.nonoptional=e=>XI(n,e),n.array=()=>G(n),n.or=e=>ae([n,e]),n.and=e=>Wf(n,e),n.transform=e=>U2(n,VI(e)),n.default=e=>JI(n,e),n.prefault=e=>KI(n,e),n.catch=e=>e$(n,e),n.pipe=e=>U2(n,e),n.readonly=()=>r$(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)=>{sv.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(r,i,s)=>C3(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(u3(...r)),n.includes=(...r)=>n.check(f3(...r)),n.startsWith=(...r)=>n.check(p3(...r)),n.endsWith=(...r)=>n.check(m3(...r)),n.min=(...r)=>n.check(Dd(...r)),n.max=(...r)=>n.check(y6(...r)),n.length=(...r)=>n.check(w6(...r)),n.nonempty=(...r)=>n.check(Dd(1,...r)),n.lowercase=r=>n.check(h3(r)),n.uppercase=r=>n.check(d3(r)),n.trim=()=>n.check(v3()),n.normalize=(...r)=>n.check(g3(...r)),n.toLowerCase=()=>n.check(y3()),n.toUpperCase=()=>n.check(w3()),n.slugify=()=>n.check(b3())}),pI=I("ZodString",(n,t)=>{sv.init(n,t),k6.init(n,t),n.email=e=>n.check(OR(mI,e)),n.url=e=>n.check(HR(gI,e)),n.jwt=e=>n.check(e3(xI,e)),n.emoji=e=>n.check(ZR(vI,e)),n.guid=e=>n.check(P2(N2,e)),n.uuid=e=>n.check(LR(Uh,e)),n.uuidv4=e=>n.check(MR(Uh,e)),n.uuidv6=e=>n.check(NR(Uh,e)),n.uuidv7=e=>n.check(zR(Uh,e)),n.nanoid=e=>n.check(UR(yI,e)),n.guid=e=>n.check(P2(N2,e)),n.cuid=e=>n.check(FR(wI,e)),n.cuid2=e=>n.check(qR(bI,e)),n.ulid=e=>n.check(VR(SI,e)),n.base64=e=>n.check(KR(RI,e)),n.base64url=e=>n.check(XR(II,e)),n.xid=e=>n.check(BR(_I,e)),n.ksuid=e=>n.check(jR(AI,e)),n.ipv4=e=>n.check(WR(EI,e)),n.ipv6=e=>n.check(GR(kI,e)),n.cidrv4=e=>n.check(JR(TI,e)),n.cidrv6=e=>n.check(YR(CI,e)),n.e164=e=>n.check(QR($I,e)),n.datetime=e=>n.check(J3(e)),n.date=e=>n.check(K3(e)),n.time=e=>n.check(Q3(e)),n.duration=e=>n.check(tI(e))});function g(n){return DR(pI,n)}const qe=I("ZodStringFormat",(n,t)=>{Me.init(n,t),k6.init(n,t)}),mI=I("ZodEmail",(n,t)=>{ZC.init(n,t),qe.init(n,t)}),N2=I("ZodGUID",(n,t)=>{zC.init(n,t),qe.init(n,t)}),Uh=I("ZodUUID",(n,t)=>{HC.init(n,t),qe.init(n,t)}),gI=I("ZodURL",(n,t)=>{UC.init(n,t),qe.init(n,t)}),vI=I("ZodEmoji",(n,t)=>{FC.init(n,t),qe.init(n,t)}),yI=I("ZodNanoID",(n,t)=>{qC.init(n,t),qe.init(n,t)}),wI=I("ZodCUID",(n,t)=>{VC.init(n,t),qe.init(n,t)}),bI=I("ZodCUID2",(n,t)=>{BC.init(n,t),qe.init(n,t)}),SI=I("ZodULID",(n,t)=>{jC.init(n,t),qe.init(n,t)}),_I=I("ZodXID",(n,t)=>{WC.init(n,t),qe.init(n,t)}),AI=I("ZodKSUID",(n,t)=>{GC.init(n,t),qe.init(n,t)}),EI=I("ZodIPv4",(n,t)=>{QC.init(n,t),qe.init(n,t)}),kI=I("ZodIPv6",(n,t)=>{eR.init(n,t),qe.init(n,t)}),TI=I("ZodCIDRv4",(n,t)=>{tR.init(n,t),qe.init(n,t)}),CI=I("ZodCIDRv6",(n,t)=>{nR.init(n,t),qe.init(n,t)}),RI=I("ZodBase64",(n,t)=>{rR.init(n,t),qe.init(n,t)}),II=I("ZodBase64URL",(n,t)=>{sR.init(n,t),qe.init(n,t)}),$I=I("ZodE164",(n,t)=>{oR.init(n,t),qe.init(n,t)}),xI=I("ZodJWT",(n,t)=>{lR.init(n,t),qe.init(n,t)}),T6=I("ZodNumber",(n,t)=>{f6.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(r,i,s)=>R3(n,r,i),n.gt=(r,i)=>n.check(O2(r,i)),n.gte=(r,i)=>n.check(Rm(r,i)),n.min=(r,i)=>n.check(Rm(r,i)),n.lt=(r,i)=>n.check(D2(r,i)),n.lte=(r,i)=>n.check(Cm(r,i)),n.max=(r,i)=>n.check(Cm(r,i)),n.int=r=>n.check(z2(r)),n.safe=r=>n.check(z2(r)),n.positive=r=>n.check(O2(0,r)),n.nonnegative=r=>n.check(Rm(0,r)),n.negative=r=>n.check(D2(0,r)),n.nonpositive=r=>n.check(Cm(0,r)),n.multipleOf=(r,i)=>n.check(L2(r,i)),n.step=(r,i)=>n.check(L2(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 se(n){return s3(T6,n)}const PI=I("ZodNumberFormat",(n,t)=>{cR.init(n,t),T6.init(n,t)});function z2(n){return o3(PI,n)}const DI=I("ZodBoolean",(n,t)=>{uR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>I3(n,e,r)});function ct(n){return a3(DI,n)}const OI=I("ZodUnknown",(n,t)=>{hR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>x3()});function E(){return l3(OI)}const LI=I("ZodNever",(n,t)=>{dR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>$3(n,e,r)});function MI(n){return c3(LI,n)}const NI=I("ZodArray",(n,t)=>{fR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>M3(n,e,r,i),n.element=t.element,n.min=(e,r)=>n.check(Dd(e,r)),n.nonempty=e=>n.check(Dd(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 S3(NI,n,t)}const C6=I("ZodObject",(n,t)=>{mR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>N3(n,e,r,i),Ae(n,"shape",()=>t.shape),n.keyof=()=>ov(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:MI()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=e=>MT(n,e),n.safeExtend=e=>NT(n,e),n.merge=e=>zT(n,e),n.pick=e=>OT(n,e),n.omit=e=>LT(n,e),n.partial=(...e)=>HT(I6,n,e[0]),n.required=(...e)=>ZT($6,n,e[0])});function ng(n,t){const e={type:"object",shape:n??{},...Y(t)};return new C6(e)}function b(n,t){return new C6({type:"object",shape:n,catchall:E(),...Y(t)})}const R6=I("ZodUnion",(n,t)=>{g6.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>z3(n,e,r,i),n.options=t.options});function ae(n,t){return new R6({type:"union",options:n,...Y(t)})}const zI=I("ZodDiscriminatedUnion",(n,t)=>{R6.init(n,t),gR.init(n,t)});function HI(n,t,e){return new zI({type:"union",options:t,discriminator:n,...Y(e)})}const ZI=I("ZodIntersection",(n,t)=>{vR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>H3(n,e,r,i)});function Wf(n,t){return new ZI({type:"intersection",left:n,right:t})}const UI=I("ZodRecord",(n,t)=>{yR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>Z3(n,e,r,i),n.keyType=t.keyType,n.valueType=t.valueType});function T(n,t,e){return new UI({type:"record",keyType:n,valueType:t,...Y(e)})}const rg=I("ZodEnum",(n,t)=>{wR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(r,i,s)=>P3(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 ov(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 FI=I("ZodLiteral",(n,t)=>{bR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>D3(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 FI({type:"literal",values:Array.isArray(n)?n:[n],...Y(t)})}const qI=I("ZodTransform",(n,t)=>{SR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>L3(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 VI(n){return new qI({type:"transform",transform:n})}const I6=I("ZodOptional",(n,t)=>{v6.init(n,t),Fe.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 BI=I("ZodExactOptional",(n,t)=>{_R.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>A6(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function jI(n){return new BI({type:"optional",innerType:n})}const WI=I("ZodNullable",(n,t)=>{AR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>U3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function Z2(n){return new WI({type:"nullable",innerType:n})}const GI=I("ZodDefault",(n,t)=>{ER.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>q3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function JI(n,t){return new GI({type:"default",innerType:n,get defaultValue(){return typeof t=="function"?t():t6(t)}})}const YI=I("ZodPrefault",(n,t)=>{kR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>V3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function KI(n,t){return new YI({type:"prefault",innerType:n,get defaultValue(){return typeof t=="function"?t():t6(t)}})}const $6=I("ZodNonOptional",(n,t)=>{TR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>F3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function XI(n,t){return new $6({type:"nonoptional",innerType:n,...Y(t)})}const QI=I("ZodCatch",(n,t)=>{CR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>B3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function e$(n,t){return new QI({type:"catch",innerType:n,catchValue:typeof t=="function"?t:()=>t})}const t$=I("ZodPipe",(n,t)=>{RR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>j3(n,e,r,i),n.in=t.in,n.out=t.out});function U2(n,t){return new t$({type:"pipe",in:n,out:t})}const n$=I("ZodReadonly",(n,t)=>{IR.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>W3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function r$(n){return new n$({type:"readonly",innerType:n})}const i$=I("ZodCustom",(n,t)=>{$R.init(n,t),Fe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>O3(n,e)});function s$(n,t={}){return _3(i$,n,t)}function o$(n){return A3(n)}const a$=[".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 l$(n){return P6(n).toLowerCase()}function c$(n,t){const e=l$(n);return t.some(r=>e.endsWith(r))}function ig(n){return!x6(n)&&c$(n,a$)}function u$(n){let t;try{t=new URL(n)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"}function qr(n){try{const{pathname:t}=new URL(n);return/^\/artifact\/[0-9A-Za-z]{26}(\/|$)/.test(t)}catch{return!1}}const h$=ng({id:g().min(1),kind:D("path"),title:g(),path:g(),store:g().optional(),share:ng({id:g().min(1),access:ov(["read","read-write"])}).strict().optional()}).strict(),d$=ng({id:g().min(1),kind:D("url"),title:g(),url:g().refine(u$,{message:"url must be an http(s) URL"})}).strict();HI("kind",[h$,d$]);const f$=new Set(["about:","blob:","chrome-extension:","chrome:","data:","devtools:","file:","filesystem:","javascript:","view-source:"]);function p$(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}:f$.has(r.protocol)?{kind:"browser-local",url:r.href}:{kind:"application",url:r.href}}catch{return{kind:"invalid"}}}function F2(n,t){return p$(n,t).kind==="web"}const m$="/views/markdown/",g$="/views/url-unsupported/";function v$(n){try{const{protocol:t}=new URL(n);return t==="http:"||t==="https:"}catch{return!1}}function D6(n){return`/artifact/${encodeURIComponent(n)}`}function y$(n,t){return`${D6(n)}/${encodeURIComponent(t)}`}function w$(n){return`/markdown/${encodeURIComponent(n)}`}function nu(n,t={electron:!1}){if(n.kind==="url")return t.electron?{renderer:"url-webview",viewURL:n.url,contentURL:null}:qr(n.url)?{renderer:"proxy-iframe",viewURL:n.url,contentURL:null}:t.browserDemo&&v$(n.url)?{renderer:"url-direct",viewURL:n.url,contentURL:null}:{renderer:"url-unsupported",viewURL:g$,contentURL:null};if(ig(n.path)){const r={viewURL:m$,contentURL:w$(n.id)};return t.electron?{renderer:"url-webview",...r}:{renderer:"markdown",...r}}const e=x6(n.path)?`${D6(n.id)}/`:y$(n.id,P6(n.path));return t.electron?{renderer:"url-webview",viewURL:e,contentURL:null}:{renderer:"proxy-iframe",viewURL:e,contentURL:null}}const b$="token",S$="mode",_$="desktopAppVersion",A$="electron";function E$(n=window.location.search){return new URLSearchParams(n).get(b$)}function bi(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(S$)===A$}function O6(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(_$)}const q2="tv.telemetry.clientId",k$=5,T$=60,C$=1e3,R$=k$*T$*C$,V2=["pointerdown","scroll","keydown"],B2=["focus"],j2=["visibilitychange"],I$="hidden";function $$(n,t=L$){const e=n.getItem(q2);if(e)return e;const r=t();return n.setItem(q2,r),r}function x$(n){return{clientId:$$(n.storage,n.idFactory),userAgent:n.userAgent??(typeof navigator>"u"?"":navigator.userAgent),clientApp:n.clientApp,...n.desktopAppVersion?{desktopAppVersion:n.desktopAppVersion}:{}}}function P$(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 D$(n){return new O$(n)}var uu,Gr,Wi,hu,du,yn,po,fu,Wd,L6;class O${constructor(t){m(this,Wd);m(this,uu);m(this,Gr);m(this,Wi);m(this,hu);m(this,du);m(this,yn);m(this,po,!1);m(this,fu,Number.NEGATIVE_INFINITY);d(this,uu,t.meta),d(this,Gr,t.documentTarget),d(this,Wi,t.windowTarget),d(this,hu,t.send),d(this,du,t.nowMs??Date.now),d(this,yn,()=>h(this,Wd,L6).call(this))}start(){if(!o(this,po)){d(this,po,!0);for(const t of V2)o(this,Wi).addEventListener(t,o(this,yn)),o(this,Gr).addEventListener(t,o(this,yn));for(const t of B2)o(this,Wi).addEventListener(t,o(this,yn));for(const t of j2)o(this,Gr).addEventListener(t,o(this,yn))}}stop(){if(o(this,po)){d(this,po,!1);for(const t of V2)o(this,Wi).removeEventListener(t,o(this,yn)),o(this,Gr).removeEventListener(t,o(this,yn));for(const t of B2)o(this,Wi).removeEventListener(t,o(this,yn));for(const t of j2)o(this,Gr).removeEventListener(t,o(this,yn))}}}uu=new WeakMap,Gr=new WeakMap,Wi=new WeakMap,hu=new WeakMap,du=new WeakMap,yn=new WeakMap,po=new WeakMap,fu=new WeakMap,Wd=new WeakSet,L6=function(){if(o(this,Gr).visibilityState===I$)return;const t=o(this,du).call(this);t-o(this,fu)<R$||(d(this,fu,t),o(this,hu).call(this,{type:uk,clientId:o(this,uu).clientId}))};function L$(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Q1().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"},Hr={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"},M$=1,N$=b({_meta:T(g(),E()).nullish(),terminal:ct().optional().default(!1)}),z$=b({_meta:T(g(),E()).nullish(),label:g().nullish(),name:g(),optional:ct().optional().default(!1),secret:ct().optional().default(!0)}),H$=b({_meta:T(g(),E()).nullish(),description:g().nullish(),id:g(),name:g()}),Z$=b({_meta:T(g(),E()).nullish(),description:g().nullish(),id:g(),link:g().nullish(),name:g(),vars:G(z$)}),U$=b({_meta:T(g(),E()).nullish(),args:G(g()).optional(),description:g().nullish(),env:T(g(),g()).optional(),id:g(),name:g()}),F$=ae([Z$.and(b({type:D("env_var")})),U$.and(b({type:D("terminal")})),H$]),q$=b({_meta:T(g(),E()).nullish(),methodId:g()}),V$=b({_meta:T(g(),E()).nullish()}),B$=b({_meta:T(g(),E()).nullish(),blob:g(),mimeType:g().nullish(),uri:g()}),j$=b({default:ct().nullish(),description:g().nullish(),title:g().nullish()}),W$=b({_meta:T(g(),E()).nullish()}),G$=b({_meta:T(g(),E()).nullish()}),J$=b({amount:se(),currency:g()}),Y$=b({_meta:T(g(),E()).nullish(),terminalId:g()}),K$=b({_meta:T(g(),E()).nullish(),newText:g(),oldText:g().nullish(),path:g()}),X$=ae([g(),se(),se(),ct(),G(g())]),Q$=b({content:T(g(),X$).nullish()}),ex=ae([Q$.and(b({action:D("accept")})),b({action:D("decline")}),b({action:D("cancel")})]),tx=b({_meta:T(g(),E()).nullish()}),M6=g(),nx=b({_meta:T(g(),E()).nullish(),elicitationId:M6}),rx=b({_meta:T(g(),E()).nullish(),action:ex}),ix=D("object"),sx=D("string"),ox=b({_meta:T(g(),E()).nullish()}),ax=b({_meta:T(g(),E()).nullish(),form:tx.nullish(),url:ox.nullish()}),lx=b({elicitationId:M6,url:g().url()}),N6=b({const:g(),title:g()}),z6=b({_meta:T(g(),E()).nullish(),name:g(),value:g()}),cx=ae([D(-32700),D(-32600),D(-32601),D(-32602),D(-32603),D(-32800),D(-32e3),D(-32002),D(-32042),se().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),H6=b({code:cx,data:E().optional(),message:g()}),Z6=E(),U6=E(),F6=E(),ux=b({_meta:T(g(),E()).nullish(),readTextFile:ct().optional().default(!1),writeTextFile:ct().optional().default(!1)}),q6=b({_meta:T(g(),E()).nullish(),name:g(),value:g()}),V6=b({_meta:T(g(),E()).nullish(),name:g(),title:g().nullish(),version:g()}),hx=b({default:se().nullish(),description:g().nullish(),maximum:se().nullish(),minimum:se().nullish(),title:g().nullish()}),dx=b({_meta:T(g(),E()).nullish()}),fx=b({_meta:T(g(),E()).nullish(),additionalDirectories:G(g()).optional(),cursor:g().nullish(),cwd:g().nullish()}),px=b({_meta:T(g(),E()).nullish()}),mx=b({_meta:T(g(),E()).nullish(),logout:px.nullish()}),gx=b({_meta:T(g(),E()).nullish()}),vx=b({_meta:T(g(),E()).nullish()}),yx=b({_meta:T(g(),E()).nullish(),http:ct().optional().default(!1),sse:ct().optional().default(!1)}),wx=b({_meta:T(g(),E()).nullish(),headers:G(q6),name:g(),url:g()}),bx=b({_meta:T(g(),E()).nullish(),headers:G(q6),name:g(),url:g()}),Sx=b({_meta:T(g(),E()).nullish(),args:G(g()),command:g(),env:G(z6),name:g()}),Gf=ae([wx.and(b({type:D("http")})),bx.and(b({type:D("sse")})),Sx]),av=g(),_x=b({_meta:T(g(),E()).nullish(),description:g().nullish(),modelId:av,name:g()}),Ax=ae([D("error"),D("warning"),D("information"),D("hint")]),Ex=b({_meta:T(g(),E()).nullish()}),kx=b({_meta:T(g(),E()).nullish()}),Tx=b({_meta:T(g(),E()).nullish()}),Cx=b({_meta:T(g(),E()).nullish()}),Rx=b({_meta:T(g(),E()).nullish()}),Ix=b({_meta:T(g(),E()).nullish(),maxCount:se().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),$x=b({diff:g(),uri:g()}),xx=b({endLine:se().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:se().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:g()}),Px=b({_meta:T(g(),E()).nullish()}),Dx=b({_meta:T(g(),E()).nullish()}),Ox=b({languageId:g(),text:g(),uri:g()}),Lx=b({_meta:T(g(),E()).nullish(),maxCount:se().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),Mx=ae([D("rejected"),D("ignored"),D("replaced"),D("cancelled")]),Nx=b({excerpts:G(xx),uri:g()}),zx=b({_meta:T(g(),E()).nullish()}),Hx=b({_meta:T(g(),E()).nullish()}),Zx=b({name:g(),owner:g(),remoteUrl:g()}),Ux=b({_meta:T(g(),E()).nullish()}),Fx=b({_meta:T(g(),E()).nullish(),jump:Px.nullish(),rename:Hx.nullish(),searchAndReplace:Ux.nullish()}),qx=b({id:g(),isRegex:ct().nullish(),replace:g(),search:g(),uri:g()}),Vx=ae([D("automatic"),D("diagnostic"),D("manual")]),Bx=b({_meta:T(g(),E()).nullish(),maxCount:se().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),jx=b({_meta:T(g(),E()).nullish(),diagnostics:Ex.nullish(),editHistory:Ix.nullish(),openFiles:Dx.nullish(),recentFiles:Lx.nullish(),relatedSnippets:zx.nullish(),userActions:Bx.nullish()}),Wx=b({_meta:T(g(),E()).nullish(),additionalDirectories:G(g()).optional(),cwd:g(),mcpServers:G(Gf)}),Gx=b({default:se().nullish(),description:g().nullish(),maximum:se().nullish(),minimum:se().nullish(),title:g().nullish()}),B6=g(),Jx=ae([D("allow_once"),D("allow_always"),D("reject_once"),D("reject_always")]),Yx=b({_meta:T(g(),E()).nullish(),kind:Jx,name:g(),optionId:B6}),Kx=ae([D("high"),D("medium"),D("low")]),Xx=ae([D("pending"),D("in_progress"),D("completed")]),Qx=b({_meta:T(g(),E()).nullish(),content:g(),priority:Kx,status:Xx}),eP=b({_meta:T(g(),E()).nullish(),entries:G(Qx)}),$s=b({character:se().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:se().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),tP=b({id:g(),position:$s,uri:g()}),nP=b({id:g(),newName:g(),position:$s,uri:g()}),rP=b({action:g(),position:$s,timestampMs:se(),uri:g()}),j6=ae([D("utf-16"),D("utf-32"),D("utf-8")]),iP=b({_meta:T(g(),E()).nullish(),auth:N$.optional().default({terminal:!1}),elicitation:ax.nullish(),fs:ux.optional().default({readTextFile:!1,writeTextFile:!1}),nes:Fx.nullish(),positionEncodings:G(j6).optional(),terminal:ct().optional().default(!1)}),sP=b({_meta:T(g(),E()).nullish(),audio:ct().optional().default(!1),embeddedContext:ct().optional().default(!1),image:ct().optional().default(!1)}),W6=se().int().gte(0).lte(65535),oP=b({_meta:T(g(),E()).nullish(),clientCapabilities:iP.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:V6.nullish(),protocolVersion:W6}),tc=b({end:$s,start:$s}),aP=b({message:g(),range:tc,severity:Ax,uri:g()}),lP=b({languageId:g(),lastFocusedMs:se().nullish(),uri:g(),visibleRange:tc.nullish()}),cP=b({_meta:T(g(),E()).nullish(),diagnostics:G(aP).nullish(),editHistory:G($x).nullish(),openFiles:G(lP).nullish(),recentFiles:G(Ox).nullish(),relatedSnippets:G(Nx).nullish(),userActions:G(rP).nullish()}),uP=b({newText:g(),range:tc}),hP=b({cursorPosition:$s.nullish(),edits:G(uP),id:g(),uri:g()}),dP=ae([hP.and(b({kind:D("edit")})),tP.and(b({kind:D("jump")})),nP.and(b({kind:D("rename")})),qx.and(b({kind:D("searchAndReplace")}))]),fP=b({_meta:T(g(),E()).nullish(),content:g()}),pP=b({_meta:T(g(),E()).nullish()}),na=ae([se(),g()]).nullable();b({_meta:T(g(),E()).nullish(),requestId:na});const mP=ov(["assistant","user"]),Ah=b({_meta:T(g(),E()).nullish(),audience:G(mP).nullish(),lastModified:g().nullish(),priority:se().nullish()}),gP=b({_meta:T(g(),E()).nullish(),annotations:Ah.nullish(),data:g(),mimeType:g()}),vP=b({_meta:T(g(),E()).nullish(),annotations:Ah.nullish(),data:g(),mimeType:g(),uri:g().nullish()}),yP=b({_meta:T(g(),E()).nullish(),annotations:Ah.nullish(),description:g().nullish(),mimeType:g().nullish(),name:g(),size:se().nullish(),title:g().nullish(),uri:g()}),wP=b({_meta:T(g(),E()).nullish(),optionId:B6}),bP=ae([b({outcome:D("cancelled")}),wP.and(b({outcome:D("selected")}))]),SP=b({_meta:T(g(),E()).nullish(),outcome:bP}),_P=b({_meta:T(g(),E()).nullish()}),AP=b({_meta:T(g(),E()).nullish()}),EP=b({currentValue:ct()}),kP=g(),G6=g(),TP=ae([D("mode"),D("model"),D("thought_level"),g()]),lv=g(),J6=b({_meta:T(g(),E()).nullish(),description:g().nullish(),name:g(),value:lv}),CP=b({_meta:T(g(),E()).nullish(),group:kP,name:g(),options:G(J6)}),RP=ae([G(J6),G(CP)]),IP=b({currentValue:lv,options:RP}),nc=Wf(ae([IP.and(b({type:D("select")})),EP.and(b({type:D("boolean")}))]),b({_meta:T(g(),E()).nullish(),category:TP.nullish(),description:g().nullish(),id:G6,name:g()})),$P=b({_meta:T(g(),E()).nullish(),configOptions:G(nc)}),xP=b({_meta:T(g(),E()).nullish()}),be=g(),PP=b({_meta:T(g(),E()).nullish(),id:g(),sessionId:be}),DP=b({_meta:T(g(),E()).nullish(),sessionId:be}),OP=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:se().nullish(),sessionId:be}),MP=b({_meta:T(g(),E()).nullish(),sessionId:be,uri:g()}),NP=b({_meta:T(g(),E()).nullish(),position:$s,sessionId:be,uri:g(),version:se(),visibleRange:tc}),zP=b({_meta:T(g(),E()).nullish(),languageId:g(),sessionId:be,text:g(),uri:g(),version:se()}),HP=b({_meta:T(g(),E()).nullish(),sessionId:be,uri:g()}),ZP=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()}),UP=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:se().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:se().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:g(),sessionId:be}),FP=b({_meta:T(g(),E()).nullish(),id:g(),reason:Mx.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()}),BP=b({_meta:T(g(),E()).nullish(),nextCursor:g().nullish(),sessions:G(VP)}),jP=b({_meta:T(g(),E()).nullish(),title:g().nullish(),updatedAt:g().nullish()}),WP=b({_meta:T(g(),E()).nullish()}),Jf=g(),GP=b({_meta:T(g(),E()).nullish(),currentModeId:Jf}),JP=b({_meta:T(g(),E()).nullish(),description:g().nullish(),id:Jf,name:g()}),Yf=b({_meta:T(g(),E()).nullish(),availableModes:G(JP),currentModeId:Jf}),Kf=b({_meta:T(g(),E()).nullish(),availableModels:G(_x),currentModelId:av}),YP=b({_meta:T(g(),E()).nullish(),configOptions:G(nc).nullish(),models:Kf.nullish(),modes:Yf.nullish(),sessionId:be}),KP=b({_meta:T(g(),E()).nullish(),configOptions:G(nc).nullish(),models:Kf.nullish(),modes:Yf.nullish()}),XP=b({_meta:T(g(),E()).nullish(),configOptions:G(nc).nullish(),models:Kf.nullish(),modes:Yf.nullish(),sessionId:be}),QP=b({_meta:T(g(),E()).nullish(),configOptions:G(nc).nullish(),models:Kf.nullish(),modes:Yf.nullish()}),e5=b({_meta:T(g(),E()).nullish()}),t5=b({_meta:T(g(),E()).nullish(),additionalDirectories:_P.nullish(),close:AP.nullish(),fork:xP.nullish(),list:WP.nullish(),resume:e5.nullish()}),n5=Wf(ae([b({type:D("boolean"),value:ct()}),b({value:lv})]),b({_meta:T(g(),E()).nullish(),configId:G6,sessionId:be})),r5=b({_meta:T(g(),E()).nullish(),configOptions:G(nc)}),i5=b({_meta:T(g(),E()).nullish(),modeId:Jf,sessionId:be}),s5=b({_meta:T(g(),E()).nullish()}),o5=b({_meta:T(g(),E()).nullish(),modelId:av,sessionId:be}),a5=b({_meta:T(g(),E()).nullish()}),l5=b({_meta:T(g(),E()).nullish(),sessionId:be}),c5=ae([D("end_turn"),D("max_tokens"),D("max_turn_requests"),D("refusal"),D("cancelled")]),u5=ae([D("email"),D("uri"),D("date"),D("date-time")]),h5=b({default:g().nullish(),description:g().nullish(),enum:G(g()).nullish(),format:u5.nullish(),maxLength:se().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:se().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:G(N6).nullish(),pattern:g().nullish(),title:g().nullish()}),d5=b({_meta:T(g(),E()).nullish(),context:cP.nullish(),position:$s,selection:tc.nullish(),sessionId:be,triggerKind:Vx,uri:g(),version:se()}),f5=b({_meta:T(g(),E()).nullish(),suggestions:G(dP)}),p5=b({_meta:T(g(),E()).nullish(),terminalId:g()}),m5=b({_meta:T(g(),E()).nullish(),exitCode:se().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()}),g5=b({_meta:T(g(),E()).nullish(),exitStatus:m5.nullish(),output:g(),truncated:ct()}),v5=b({_meta:T(g(),E()).nullish(),annotations:Ah.nullish(),text:g()}),y5=b({range:tc.nullish(),text:g()}),w5=b({_meta:T(g(),E()).nullish(),contentChanges:G(y5),sessionId:be,uri:g(),version:se()});b({method:g(),params:ae([DP,zP,w5,MP,HP,NP,PP,FP,Z6]).nullish()});const b5=ae([D("full"),D("incremental")]),S5=b({_meta:T(g(),E()).nullish(),syncKind:b5}),_5=b({_meta:T(g(),E()).nullish(),didChange:S5.nullish(),didClose:kx.nullish(),didFocus:Tx.nullish(),didOpen:Cx.nullish(),didSave:Rx.nullish()}),A5=b({_meta:T(g(),E()).nullish(),document:_5.nullish()}),E5=b({_meta:T(g(),E()).nullish(),context:jx.nullish(),events:A5.nullish()}),k5=b({_meta:T(g(),E()).nullish(),auth:mx.optional().default({}),loadSession:ct().optional().default(!1),mcpCapabilities:yx.optional().default({http:!1,sse:!1}),nes:E5.nullish(),positionEncoding:j6.nullish(),promptCapabilities:sP.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:t5.optional().default({})}),T5=b({_meta:T(g(),E()).nullish(),agentCapabilities:k5.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:V6.nullish(),authMethods:G(F$).optional().default([]),protocolVersion:W6}),C5=b({_meta:T(g(),E()).nullish(),mimeType:g().nullish(),text:g(),uri:g()}),R5=ae([C5,B$]),I5=b({_meta:T(g(),E()).nullish(),annotations:Ah.nullish(),resource:R5}),cv=ae([v5.and(b({type:D("text")})),vP.and(b({type:D("image")})),gP.and(b({type:D("audio")})),yP.and(b({type:D("resource_link")})),I5.and(b({type:D("resource")}))]),$5=b({_meta:T(g(),E()).nullish(),content:cv}),Im=b({_meta:T(g(),E()).nullish(),content:cv,messageId:g().nullish()}),x5=b({_meta:T(g(),E()).nullish(),messageId:g().nullish(),prompt:G(cv),sessionId:be}),P5=b({anyOf:G(N6)}),tS=ae([$5.and(b({type:D("content")})),K$.and(b({type:D("diff")})),p5.and(b({type:D("terminal")}))]),nS=g(),rS=b({_meta:T(g(),E()).nullish(),line:se().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")]),D5=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(Yx),sessionId:be,toolCall:oS}),O5=b({_meta:T(g(),E()).nullish(),hint:g()}),L5=O5,M5=b({_meta:T(g(),E()).nullish(),description:g(),input:L5.nullish(),name:g()}),N5=b({_meta:T(g(),E()).nullish(),availableCommands:G(M5)}),z5=b({enum:G(g()),type:sx}),H5=ae([z5,P5]),Z5=b({default:G(g()).nullish(),description:g().nullish(),items:H5,maxItems:se().nullish(),minItems:se().nullish(),title:g().nullish()}),U5=ae([h5.and(b({type:D("string")})),Gx.and(b({type:D("number")})),hx.and(b({type:D("integer")})),j$.and(b({type:D("boolean")})),Z5.and(b({type:D("array")}))]),F5=b({description:g().nullish(),properties:T(g(),U5).optional().default({}),required:G(g()).nullish(),title:g().nullish(),type:ix.optional().default("object")}),q5=b({requestedSchema:F5}),V5=Wf(ae([q5.and(b({mode:D("form")})),lx.and(b({mode:D("url")}))]),b({_meta:T(g(),E()).nullish(),message:g(),sessionId:be})),B5=b({cachedReadTokens:se().nullish(),cachedWriteTokens:se().nullish(),inputTokens:se(),outputTokens:se(),thoughtTokens:se().nullish(),totalTokens:se()}),j5=b({_meta:T(g(),E()).nullish(),stopReason:c5,usage:B5.nullish(),userMessageId:g().nullish()});ae([b({id:na,result:ae([T5,V$,vx,XP,KP,BP,YP,QP,G$,s5,r5,j5,a5,l5,f5,W$,F6])}),b({error:H6,id:na})]);const W5=b({_meta:T(g(),E()).nullish(),cost:J$.nullish(),size:se(),used:se()}),G5=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")})),D5.and(b({sessionUpdate:D("tool_call")})),oS.and(b({sessionUpdate:D("tool_call_update")})),eP.and(b({sessionUpdate:D("plan")})),N5.and(b({sessionUpdate:D("available_commands_update")})),GP.and(b({sessionUpdate:D("current_mode_update")})),$P.and(b({sessionUpdate:D("config_option_update")})),jP.and(b({sessionUpdate:D("session_info_update")})),W5.and(b({sessionUpdate:D("usage_update")}))]),lS=b({_meta:T(g(),E()).nullish(),sessionId:be,update:G5});b({method:g(),params:ae([lS,nx,Z6]).nullish()});const cS=b({_meta:T(g(),E()).nullish(),sessionId:be,terminalId:g()}),J5=b({_meta:T(g(),E()).nullish(),exitCode:se().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:g().nullish()}),Y5=b({name:g(),uri:g()}),K5=b({_meta:T(g(),E()).nullish(),repository:Zx.nullish(),workspaceFolders:G(Y5).nullish(),workspaceUri:g().nullish()});b({id:na,method:g(),params:ae([oP,q$,gx,Wx,UP,fx,ZP,qP,LP,i5,n5,x5,o5,K5,d5,OP,U6]).nullish()});const uS=b({_meta:T(g(),E()).nullish(),content:g(),path:g(),sessionId:be});b({id:na,method:g(),params:ae([uS,X6,aS,Y6,eS,Q6,cS,K6,V5,U6]).nullish()});const X5=b({_meta:T(g(),E()).nullish()});ae([b({id:na,result:ae([X5,fP,SP,Y$,g5,pP,J5,dx,rx,F6])}),b({error:H6,id:na})]);var we;class Q5{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 Hr.fs_write_text_file:{const _=uS.parse(l);return(c=r.writeTextFile)==null?void 0:c.call(r,_)}case Hr.fs_read_text_file:{const _=X6.parse(l);return(u=r.readTextFile)==null?void 0:u.call(r,_)}case Hr.session_request_permission:{const _=aS.parse(l);return r.requestPermission(_)}case Hr.terminal_create:{const _=Y6.parse(l);return(f=r.createTerminal)==null?void 0:f.call(r,_)}case Hr.terminal_output:{const _=eS.parse(l);return(p=r.terminalOutput)==null?void 0:p.call(r,_)}case Hr.terminal_release:{const _=Q6.parse(l);return await((y=r.releaseTerminal)==null?void 0:y.call(r,_))??{}}case Hr.terminal_wait_for_exit:{const _=cS.parse(l);return(v=r.waitForTerminalExit)==null?void 0:v.call(r,_)}case Hr.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 Hr.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 eD(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 Gi,Gd,pu,mu,Ba,ja,or,gu,Ze,hS,sg,dS,fS,pS,mS,og,xc;class eD{constructor(t,e,r){m(this,Ze);m(this,Gi,new Map);m(this,Gd,0);m(this,pu);m(this,mu);m(this,Ba);m(this,ja,Promise.resolve());m(this,or,new AbortController);m(this,gu);d(this,pu,t),d(this,mu,e),d(this,Ba,r),d(this,gu,new Promise(i=>{o(this,or).signal.addEventListener("abort",()=>i())})),h(this,Ze,hS).call(this)}get signal(){return o(this,or).signal}get closed(){return o(this,gu)}async sendRequest(t,e){h(this,Ze,og).call(this);const r=Lh(this,Gd)._++,i=new Promise((s,a)=>{o(this,Gi).set(r,{resolve:s,reject:a})});return await h(this,Ze,xc).call(this,{jsonrpc:"2.0",id:r,method:t,params:e}),i}async sendNotification(t,e){h(this,Ze,og).call(this),await h(this,Ze,xc).call(this,{jsonrpc:"2.0",method:t,params:e})}}Gi=new WeakMap,Gd=new WeakMap,pu=new WeakMap,mu=new WeakMap,Ba=new WeakMap,ja=new WeakMap,or=new WeakMap,gu=new WeakMap,Ze=new WeakSet,hS=async function(){let t;try{const e=o(this,Ba).readable.getReader();try{for(;!o(this,or).signal.aborted;){const{value:r,done:i}=await e.read();if(i)break;if(r)try{h(this,Ze,dS).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&h(this,Ze,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,Ze,sg).call(this,t)}},sg=function(t){if(o(this,or).signal.aborted)return;const e=t??new Error("ACP connection closed");for(const r of o(this,Gi).values())r.reject(e);o(this,Gi).clear(),o(this,or).abort(e)},dS=async function(t){if("method"in t&&"id"in t){const e=await h(this,Ze,fS).call(this,t.method,t.params);"error"in e&&console.error("Error handling request",t,e.error),await h(this,Ze,xc).call(this,{jsonrpc:"2.0",id:t.id,...e})}else if("method"in t){const e=await h(this,Ze,pS).call(this,t.method,t.params);"error"in e&&console.error("Error handling notification",t,e.error)}else"id"in t?h(this,Ze,mS).call(this,t):console.error("Invalid message",{message:t})},fS=async function(t,e){try{return{result:await o(this,pu).call(this,t,e)??null}}catch(r){if(r instanceof rt)return r.toResult();if(r instanceof M2)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,mu).call(this,t,e),{result:null}}catch(r){if(r instanceof rt)return r.toResult();if(r instanceof M2)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,Gi).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,Gi).delete(t.id)}else console.error("Got response to unknown request",t.id)},og=function(){if(o(this,or).signal.aborted)throw o(this,or).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,Ze,sg).call(this,e)})),o(this,ja)};class rt extends Error{constructor(e,r,i){super(r);R(this,"code");R(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 tD(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);tD(this,()=>o(this,e),()=>{d(this,e,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return o(this,e)}}return e=new WeakMap,t}const nD=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,rD=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,iD=/\[Television channel context\][\s\S]*?\[\/Television channel context\]\n*/,sD=/\b(tv|television|channel|artifact|artifacts|viewer|filmstrip|layout|focus)\b/i,oD=/^[A-Za-z0-9_@%+=:,./-]+$/,aD=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,lD="single_session",cD={name:"television-acp-client",version:"0.0.0"},vS="agent:main:television",uD=gS(Ri);var Wa,ar,rn,lr,Ji,Nn,Jr,cr,zn,Yi,Hn,Ga,Ja,ur,Et,Yr,Ya,mo,Kr,Ki,vu,Zn,hr,Jd,dr,L,ag,yS,wS,bS,ed,SS,_S,AS,ES,kS,TS,CS,Ws,Aa,Ea,Ur,RS,ka,lg,cg,td,IS,nd,ug,hg,yu,wu,rd,Ta,dg,$S;class hD extends uD{constructor(e){super();m(this,L);m(this,Wa,"disconnected");m(this,ar,null);m(this,rn,new Map);m(this,lr,null);m(this,Ji,null);m(this,Nn,null);m(this,Jr,null);m(this,cr,null);m(this,zn,null);m(this,Yi);m(this,Hn,null);m(this,Ga,0);m(this,Ja,1);m(this,ur,null);m(this,Et,null);m(this,Yr,!1);m(this,Ya,!1);m(this,mo,!1);m(this,Kr,null);m(this,Ki,new Set);m(this,vu);m(this,Zn);m(this,hr);m(this,Jd,e=>{h(this,L,wS).call(this,e)});m(this,dr,null);m(this,yu,()=>{h(this,L,Ta).call(this,"ACP bridge websocket closed")});m(this,wu,()=>{h(this,L,Ta).call(this,"ACP bridge websocket error")});d(this,Zn,e),d(this,hr,e.sessionMode??lD),d(this,Yi,e.mappedSessionStore??dD()),d(this,vu,e.createSocket??(r=>new WebSocket(r)))}get status(){return o(this,Wa)}get messages(){return[...o(this,rn).values()]}get enabled(){return o(this,Zn).enabled??!1}setToken(e){o(this,Zn).token=e??""}setEnabled(e){o(this,Zn).enabled=e,e||(h(this,L,rd).call(this),d(this,ar,null),h(this,L,Ur).call(this,"disconnected"))}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(this.enabled&&this.status==="disconnected"){o(this,Ji)===null&&(d(this,ar,null),d(this,Ji,h(this,L,yS).call(this)));try{await o(this,Ji),await h(this,L,ed).call(this)}catch(e){throw h(this,L,Ta).call(this,$m(e)),e}}}dispose(){h(this,L,rd).call(this),d(this,ar,null),h(this,L,Ur).call(this,"disposed")}async sendMessage(e){if(await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await h(this,L,ag).call(this,"ready")),(o(this,cr)===null||o(this,Hn)!==h(this,L,nd).call(this))&&await h(this,L,ed).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,L,Aa).call(this,{id:h(this,L,ka).call(this,"user"),kind:"user",text:r,status:"final"}),h(this,L,Ur).call(this,"running");try{const i=await h(this,L,td).call(this).prompt({sessionId:h(this,L,cg).call(this),prompt:[{type:"text",text:h(this,L,RS).call(this,r)}]});h(this,L,Ws).call(this,i.stopReason==="cancelled"?"cancelled":"final"),h(this,L,Ur).call(this,"ready")}catch(i){throw h(this,L,$S).call(this)||(h(this,L,Ws).call(this,"error"),h(this,L,Ur).call(this,"ready")),i}}async startNewSession(){var r;await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await h(this,L,ag).call(this,"ready"));const e=h(this,L,nd).call(this);((r=o(this,zn))==null?void 0:r.sessionIdStrategy)==="mapped"?o(this,Yi).clearActualSessionId(e):d(this,Ga,o(this,Ga)+1),d(this,Nn,null),d(this,Jr,null),d(this,cr,null),d(this,Hn,null),h(this,L,dg).call(this)}async cancel(){this.status==="running"&&(h(this,L,Ur).call(this,"cancelling"),await h(this,L,td).call(this).cancel({sessionId:h(this,L,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,hr)==="single_session"){(!o(this,Hn)||i!==r.channelID)&&d(this,Yr,!0);return}o(this,Hn)!==h(this,L,ug).call(this,r.channelID)&&(d(this,Nn,null),d(this,Jr,null),o(this,lr)&&this.status==="ready"&&h(this,L,ed).call(this).catch(c=>{h(this,L,Ta).call(this,$m(c))}))}}Wa=new WeakMap,ar=new WeakMap,rn=new WeakMap,lr=new WeakMap,Ji=new WeakMap,Nn=new WeakMap,Jr=new WeakMap,cr=new WeakMap,zn=new WeakMap,Yi=new WeakMap,Hn=new WeakMap,Ga=new WeakMap,Ja=new WeakMap,ur=new WeakMap,Et=new WeakMap,Yr=new WeakMap,Ya=new WeakMap,mo=new WeakMap,Kr=new WeakMap,Ki=new WeakMap,vu=new WeakMap,Zn=new WeakMap,hr=new WeakMap,Jd=new WeakMap,dr=new WeakMap,L=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,ar)??"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,ar)??"ACPClient is disconnected")))};this.addEventListener("status-changed",a)})}},yS=async function(){try{const{stream:e,socket:r,metadata:i}=await gD({serverURL:o(this,Zn).serverURL,token:o(this,Zn).token,createSocket:o(this,vu),onDisconnect:o(this,Jd)});d(this,zn,i),d(this,dr,r),r.addEventListener("close",o(this,yu)),r.addEventListener("error",o(this,wu)),d(this,lr,new Q5(s=>({connection:s,sessionUpdate:async a=>{await h(this,L,_S).call(this,a)},requestPermission:async a=>h(this,L,AS).call(this,a)}),e)),await o(this,lr).initialize({protocolVersion:M$,clientCapabilities:{},clientInfo:cD})}catch(e){throw e}},wS=function(e){h(this,L,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})`)},ed=async function(){const e=h(this,L,nd).call(this);if(o(this,Nn)&&o(this,Jr)===e){await o(this,Nn);return}d(this,Jr,e),d(this,Nn,h(this,L,SS).call(this,e)),await o(this,Nn)},SS=async function(e){var c;const r=h(this,L,td).call(this);h(this,L,dg).call(this);let i,s=!1,a=null;const l={cwd:h(this,L,IS).call(this),mcpServers:[],_meta:{sessionKey:e}};try{if(d(this,mo,!0),d(this,Kr,null),((c=o(this,zn))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=o(this,Yi).getActualSessionId(e);if(u)try{const f=await r.loadSession({...l,sessionId:u});if(fD(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,Yi).setActualSessionId(e,i),s=!1}else{const f=await r.newSession(l);a=f,i=f.sessionId,o(this,Yi).setActualSessionId(e,i),s=!1}}else try{a=await r.loadSession({...l,sessionId:e}),i=e,s=o(this,rn).size>0}catch{const u=await r.newSession(l);a=u,i=u.sessionId,s=!1}}finally{d(this,mo,!1),d(this,Kr,null),h(this,L,Ws).call(this,"final")}h(this,L,bS).call(this,a),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),d(this,cr,i),d(this,Hn,e),d(this,Ya,!0),s?(o(this,Ki).add(e),o(this,hr)==="single_session"&&d(this,Yr,!1)):(o(this,Ki).delete(e),d(this,Yr,o(this,hr)==="single_session")),d(this,ar,null),h(this,L,Ur).call(this,"ready")},_S=async function(e){const r=e.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&h(this,L,CS).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&h(this,L,ES).call(this,r.content.text);return;case"tool_call":h(this,L,kS).call(this,r);return;case"tool_call_update":h(this,L,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=mD(e);if(!r)return;if(!o(this,ur)){const s={id:h(this,L,ka).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};d(this,ur,s.id),h(this,L,Aa).call(this,s);return}const i=o(this,rn).get(o(this,ur));if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");h(this,L,Ea).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},kS=function(e){h(this,L,Ws).call(this,"final");const r=h(this,L,lg).call(this,e.toolCallId),i=G2("content"in e?e.content:void 0),s={id:(r==null?void 0:r.id)??h(this,L,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,L,Ea).call(this,s);return}h(this,L,Aa).call(this,s)},TS=function(e){const r=h(this,L,lg).call(this,e.toolCallId),i=(r==null?void 0:r.text)??"",s=G2(e.content),a=s?`${i}${s}`:i,l={id:(r==null?void 0:r.id)??h(this,L,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,L,Ea).call(this,l);return}h(this,L,Aa).call(this,l)},CS=function(e){if(h(this,L,Ws).call(this,"final"),!e)return;const r=o(this,mo)?o(this,Kr):null;if(!r){const s=W2(e);if(!s)return;const a={id:h(this,L,ka).call(this,"user"),kind:"user",text:s,status:"final"};h(this,L,Aa).call(this,a),o(this,mo)&&d(this,Kr,a.id);return}const i=o(this,rn).get(r);if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");h(this,L,Ea).call(this,{...i,text:W2(`${i.text}${e}`)})},Ws=function(e){if(!o(this,ur))return;const r=o(this,rn).get(o(this,ur));(r==null?void 0:r.kind)==="assistant"&&h(this,L,Ea).call(this,{...r,status:e}),d(this,ur,null)},Aa=function(e){o(this,rn).set(e.id,e),this.dispatchEvent(new Tm("messages-changed"))},Ea=function(e){o(this,rn).set(e.id,e),this.dispatchEvent(new Tm("messages-changed"))},Ur=function(e){o(this,Wa)!==e&&(d(this,Wa,e),this.dispatchEvent(new bT("status-changed")))},RS=function(e){var u;const r=o(this,Hn);if(!r)return e;const i=o(this,Et)?o(this,hr)==="single_session"?o(this,Yr)||!o(this,Ki).has(r):!o(this,Ki).has(r):!1,s=o(this,Ya)&&(o(this,Et)!==null||sD.test(e));if(!(s||i))return e;s&&d(this,Ya,!1),i&&(d(this,Yr,!1),o(this,Ki).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(wD).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,rn).values())if((r==null?void 0:r.kind)==="tool_call"&&r.toolCallId===e)return r;return null},cg=function(){if(!o(this,cr))throw new Error("ACP session is not ready");return o(this,cr)},td=function(){if(!o(this,lr))throw new Error("ACP connection is not ready");return o(this,lr)},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},nd=function(){var r;if(o(this,hr)==="single_session")return h(this,L,hg).call(this,`${vS}-${(o(this,Zn).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,L,ug).call(this,e)},ug=function(e){return h(this,L,hg).call(this,pD(o(this,hr),e,o(this,Zn).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},yu=new WeakMap,wu=new WeakMap,rd=function(){d(this,lr,null),d(this,Ji,null),d(this,Nn,null),d(this,Jr,null),d(this,cr,null),d(this,Hn,null),d(this,zn,null),o(this,dr)&&(o(this,dr).removeEventListener("close",o(this,yu)),o(this,dr).removeEventListener("error",o(this,wu)),o(this,dr).close(),d(this,dr,null))},Ta=function(e){const r=o(this,lr)!==null||o(this,Ji)!==null||o(this,Nn)!==null||o(this,Jr)!==null||o(this,cr)!==null||o(this,Hn)!==null||o(this,zn)!==null||o(this,dr)!==null;this.disposed||this.status==="disconnected"&&!r||(h(this,L,Ws).call(this,"error"),h(this,L,rd).call(this),d(this,ar,e??null),h(this,L,Ur).call(this,"disconnected"))},dg=function(){const e=o(this,rn).size>0;d(this,ur,null),d(this,Kr,null),d(this,Ja,1),o(this,rn).clear(),e&&this.dispatchEvent(new Tm("messages-changed"))},$S=function(){return this.status==="disconnected"};function dD(){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 fD(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function pD(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 W2(n){let t=n;return t=t.replace(nD,""),t=t.replace(rD,""),t=t.replace(iD,""),t=xS(t),t}function mD(n){let t=n;return t=t.replace(aD,""),t=xS(t),t}function G2(n){return!n||n.length===0?"":n.flatMap(t=>t.type==="content"&&t.content.type==="text"?[t.content.text]:[]).join("")}async function gD(n){const t=n.createSocket(SD(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 $=bD(_);if(!$)return;let Z;try{Z=JSON.parse($)}catch(O){const z=O instanceof Error?O:new Error(String(O));i(z),u.error(z);return}switch(Z.type){case"acp-bridge-status":if(Z.status==="ready"){let O;try{O=vD(Z)}catch(z){const P=z instanceof Error?z:new Error(String(z));e||i(P),u.error(P);return}e||(e=!0,r(O));return}if(Z.status==="error"||Z.status==="exited"){const O=new Error(Z.error??`ACP bridge ${Z.status}`);e||i(O),u.error(O)}return;case"acp-bridge-message":u.enqueue(Z.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 vD(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&&yD(i))return{agent:t,sessionIdStrategy:e,sessionCwd:r,tvArgs:i};throw new Error("ACP bridge ready status missing bootstrap metadata")}function yD(n){return Array.isArray(n)&&n.every(t=>typeof t=="string")}function wD(n){return oD.test(n)?n:`'${n.replace(/'/g,"'\\''")}'`}function bD(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 SD(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 J2="television.acpClientGUID",Y2="television.acpMappedSessions",K2=1;var Ka;class _D{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,bu,hn,id,sd,fg;class AD{constructor(t,e){m(this,hn);m(this,Xa);m(this,bu);d(this,Xa,t),d(this,bu,e)}getActualSessionId(t){const e=h(this,hn,sd).call(this)[h(this,hn,id).call(this,t)];return typeof e=="string"&&e.length>0?e:null}setActualSessionId(t,e){const r=h(this,hn,sd).call(this);r[h(this,hn,id).call(this,t)]=e,h(this,hn,fg).call(this,r)}clearActualSessionId(t){const e=h(this,hn,sd).call(this);delete e[h(this,hn,id).call(this,t)],h(this,hn,fg).call(this,e)}}Xa=new WeakMap,bu=new WeakMap,hn=new WeakSet,id=function(t){return JSON.stringify([o(this,bu),t])},sd=function(){const t=o(this,Xa).getItem(Y2);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!==K2?{}: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:K2,entries:t};o(this,Xa).setItem(Y2,JSON.stringify(e))};function PS(){return typeof window>"u"?null:window.localStorage}function ED(n){const t=n.getItem(J2);if(t)return t;const e=Q1().toLowerCase();return n.setItem(J2,e),e}const X2=4401,kD=401,Fh=1e3,TD=3e4;class od extends Error{constructor(t="Authentication required"){super(t),this.name="AuthError"}}class CD extends Ri{constructor(e){var a,l;super();R(this,"url");R(this,"name");R(this,"telemetryMeta");R(this,"status","unauthorized");R(this,"channels",new Map);R(this,"client");R(this,"acpClient");R(this,"_token");R(this,"attempting",!1);R(this,"nextRetryAt",null);R(this,"hasEverConnected",!1);R(this,"failedReconnectAttempts",0);R(this,"browserDemoMode",!1);R(this,"hasAuthRejected",!1);R(this,"bootState","pending");R(this,"serverVersion",null);R(this,"updateState",null);R(this,"decideBoot");R(this,"navigationPending");R(this,"createSocket");R(this,"createClient");R(this,"socket",null);R(this,"connectAttempt",0);R(this,"autoReconnect",!1);R(this,"retryTimer",null);R(this,"retryDelay",Fh);R(this,"visibilityEventTarget");R(this,"networkEventTarget");R(this,"onVisibilityChange");R(this,"onNetworkOnline");R(this,"telemetryActivityAgent");this.url=oa(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 Wk(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 AD(e.acpStorage,this.url):new _D);this.acpClient=new hD({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?D$({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=Fh,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=nu(e,this.renderOptions());return bi()?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:bi(),browserDemo:this.browserDemoMode}}getContentURL(e){const r=nu(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&&!dk(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=Vm(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 Wt("change"));const r=this.createSocket(ID(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=Fh,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 Wt("change")),y&&this.dispatchEvent(new Ic("channels-changed")),this.dispatchEvent(new Xh("server-event",{event:{type:"channel-changed",channelID:S.focusedChannelId}})),this.dispatchEvent(new Xh("server-event",{event:{type:"pinned-channels-changed",pinnedChannelIds:[...S.pinnedChannelIds]}})),u(),y&&this.connectAttempt===e&&this.dispatchEvent(new J8("server-reconnected"))}catch(v){if(LD(v)){f(new od);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=OD(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",{message:_})),$?this.navigationPending()||p():this.bootState==="halted"&&!this.navigationPending()&&this.dispatchEvent(new Wt("change"));return}if(!DD(v.type))return;const S=v;this.applyServerEvent(S),this.dispatchEvent(new Xh("server-event",{event:S}))}),r.addEventListener("close",y=>{if(this.connectAttempt!==e)return;this.socket=null;const v=$D(y);if(!l){f(v===X2?new od:new Error("Connection closed before initialization"));return}if(c){if(v===X2){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 od){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,TD),this.nextRetryAt=Date.now()+e,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.attempt().catch(()=>{})},e),this.dispatchEvent(new Wt("change"))}cancelRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.nextRetryAt!==null&&(this.nextRetryAt=null,this.dispatchEvent(new Wt("change")))}kickReconnect(){this.autoReconnect&&this.status!=="connected"&&(this.attempting||(this.cancelRetryTimer(),this.retryDelay=Fh,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:hk,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 Wt("change")))}isPageVisible(){return this.visibilityEventTarget===null?!0:this.visibilityEventTarget.visibilityState==="visible"}}function RD(n,t){throw new Error(`Unexpected ${t}: ${JSON.stringify(n)}`)}function ID(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 P$(e))r.searchParams.set(i,s);return r.hash="",r.toString()}function $D(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}const xD={"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},PD=new Set(Object.keys(xD));function DD(n){return PD.has(n)}function OD(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===kD}const MD="Local";var fr,Un,Ei,DS,pg,OS,Su,_u,Au,Eu,ku;class ND extends Ri{constructor(e){super();m(this,Ei);R(this,"connection");R(this,"clientGUID");R(this,"acpStorage");R(this,"connectError",null);m(this,fr);m(this,Un,!1);m(this,Su,()=>{o(this,Un)||(h(this,Ei,OS).call(this),this.dispatchEvent(new Wt("change")))});m(this,_u,e=>{o(this,Un)||this.dispatchEvent(new Xh("server-event",{event:e.event}))});m(this,Au,()=>{o(this,Un)||this.dispatchEvent(new Ic("channels-changed"))});m(this,Eu,()=>{o(this,Un)||this.dispatchEvent(new J8("server-reconnected"))});m(this,ku,e=>{o(this,Un)||this.dispatchEvent(new Y8("server-status",{message:e.message}))});d(this,fr,e.localStore),this.acpStorage=e.acpStorage===void 0?PS():e.acpStorage,this.clientGUID=e.clientGUID??(this.acpStorage?ED(this.acpStorage):Q1().toLowerCase());const r=oa(e.serverURL);e.launchToken!==void 0&&e.launchToken!==null&&o(this,fr).set(ET(o(this,fr).get(),r,e.launchToken));const i=e.launchToken??w2(o(this,fr).get(),r),s=e.createSocket??(l=>new WebSocket(l)),a=e.createConnection??(l=>new CD(l));this.connection=a({url:r,name:e.connectionName??MD,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,Su)),this.connection.addEventListener("server-event",o(this,_u)),this.connection.addEventListener("channels-changed",o(this,Au)),this.connection.addEventListener("server-reconnected",o(this,Eu)),this.connection.addEventListener("server-status",o(this,ku))}get storedAuthToken(){return w2(o(this,fr).get(),this.connection.url)}async connect(){await h(this,Ei,DS).call(this,this.connection.token)}dispose(){o(this,Un)||(d(this,Un,!0),this.connection.removeEventListener("change",o(this,Su)),this.connection.removeEventListener("server-event",o(this,_u)),this.connection.removeEventListener("channels-changed",o(this,Au)),this.connection.removeEventListener("server-reconnected",o(this,Eu)),this.connection.removeEventListener("server-status",o(this,ku)),this.connection.dispose())}}fr=new WeakMap,Un=new WeakMap,Ei=new WeakSet,DS=async function(e){if(!o(this,Un)){h(this,Ei,pg).call(this,null);try{await this.connection.connect(e)}catch(r){h(this,Ei,pg).call(this,r instanceof od?null:r instanceof Error?r.message:String(r))}}},pg=function(e){this.connectError!==e&&(this.connectError=e,this.dispatchEvent(new Wt("change")))},OS=function(){if(this.connection.status!=="unauthorized"||!this.connection.hasAuthRejected)return;const e=o(this,fr).get(),r=kT(e,this.connection.url);r!==e&&o(this,fr).set(r),this.connection.token!==null&&this.connection.clearToken()},Su=new WeakMap,_u=new WeakMap,Au=new WeakMap,Eu=new WeakMap,ku=new WeakMap;const mg="tv-nav:",Vl="tv-reload",Q2=100,zD=1e3,HD=60,ZD=60,UD=24,FD=30,qD=FD*UD*ZD*HD*zD;function Si(n){try{const t=new URL(n,window.location.href),e=t.searchParams.has(Vl);return t.searchParams.delete(Vl),t.origin===window.location.origin?`${t.pathname}${t.search}${t.hash}`:e?t.toString():n}catch{return n}}var Tu,Qa,$e,Ce,go,Ke,LS,zi,MS,gg,vg;class VD extends Ri{constructor(e,r){super();m(this,Ke);m(this,Tu);m(this,Qa);m(this,$e,[]);m(this,Ce,-1);m(this,go,0);d(this,Tu,e),d(this,Qa,Si(r)),h(this,Ke,LS).call(this)}get currentURL(){var e;return o(this,Ce)===-1?null:((e=o(this,$e)[o(this,Ce)])==null?void 0:e.url)??null}get canGoBack(){return o(this,Ce)>-1}get canGoForward(){return o(this,Ce)<o(this,$e).length-1}get entries(){return o(this,$e).map(e=>({...e}))}get cursor(){return o(this,Ce)}navigate(e){const r=Si(e);if(r===o(this,Qa)){if(o(this,Ce)===-1)return;d(this,Ce,-1),h(this,Ke,zi).call(this);return}o(this,Ce)<o(this,$e).length-1&&d(this,$e,o(this,$e).slice(0,o(this,Ce)+1)),o(this,$e).push({url:r}),d(this,Ce,o(this,$e).length-1),h(this,Ke,gg).call(this),h(this,Ke,zi).call(this)}replace(e){var i;if(o(this,Ce)===-1){this.navigate(e);return}const r=Si(e);if(r===o(this,Qa)){d(this,$e,o(this,$e).filter((s,a)=>a!==o(this,Ce))),d(this,Ce,-1),h(this,Ke,zi).call(this);return}((i=o(this,$e)[o(this,Ce)])==null?void 0:i.url)!==r&&(d(this,$e,o(this,$e).map((s,a)=>a===o(this,Ce)?{url:r}:s)),h(this,Ke,zi).call(this))}back(){o(this,Ce)!==-1&&(d(this,Ce,o(this,Ce)-1),h(this,Ke,zi).call(this))}forward(){this.canGoForward&&(d(this,Ce,o(this,Ce)+1),h(this,Ke,zi).call(this))}reset(){o(this,Ce)===-1&&o(this,$e).length===0||(d(this,$e,[]),d(this,Ce,-1),h(this,Ke,zi).call(this))}}Tu=new WeakMap,Qa=new WeakMap,$e=new WeakMap,Ce=new WeakMap,go=new WeakMap,Ke=new WeakSet,LS=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,Ce,r.cursor),d(this,go,r.lastWritten),h(this,Ke,gg).call(this)}catch{d(this,$e,[]),d(this,Ce,-1),d(this,go,0)}},zi=function(){d(this,go,Date.now());try{localStorage.setItem(o(this,Ke,vg),JSON.stringify(h(this,Ke,MS).call(this)))}catch(e){if(!WD(e))throw e}this.dispatchEvent(new Wt("change"))},MS=function(){return{v:1,entries:o(this,$e).map(e=>({...e})),cursor:o(this,Ce),lastWritten:o(this,go)}},gg=function(){if(o(this,$e).length<=Q2)return;const e=o(this,$e).length-Q2;d(this,$e,o(this,$e).slice(e)),d(this,Ce,Math.max(-1,o(this,Ce)-e))},vg=function(){return BD(o(this,Tu))};function BD(n){return`${mg}${n}`}function jD(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 WD(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 vo;class GD{constructor(t){m(this,vo);d(this,vo,t)}read(){return o(this,vo).getItem(xm)==="true"}setCollapsed(t){try{t?o(this,vo).setItem(xm,"true"):o(this,vo).removeItem(xm)}catch{}}}vo=new WeakMap;const Pm="tv-channel-sidebar-width",yg=160,wg=350,qh=260,JD=/^-?\d+$/;var yo;class YD{constructor(t){m(this,yo);d(this,yo,t)}read(){const t=o(this,yo).getItem(Pm);if(t===null||!JD.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,yo).setItem(Pm,String(e))}catch{}return e}clear(){try{o(this,yo).removeItem(Pm)}catch{}}}yo=new WeakMap;function zS(n){return Math.min(Math.max(n,yg),wg)}const KD="1.5.1";function uv(n=KD){return n!==void 0&&n.length>0?n:"0.0.0"}function hv(){let n=!1;return{get pending(){return n},begin(t){n||(n=!0,t())}}}const bg="tv-reload-attempted";function XD(n){return n.marker!==null&&n.bundleVersion===n.serverVersion?{action:"signal-autoreloaded",fromVersion:n.marker.fromVersion,toVersion:n.bundleVersion}:Yk(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"}}function QD(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 eO(n){const t=n.storage!==void 0?n.storage:typeof sessionStorage<"u"?sessionStorage:null,e=n.reload??(()=>location.reload()),r=n.navigationLatch??hv(),i=n.bundleVersion??uv();if(t===null)return{dispose(){}};let s=null;const a=()=>{if(s===null)return;const u=n.owner.connection;if(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=XD({bundleVersion:i,serverVersion:u.message.version,marker:QD(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 tO(n){const t=bi(n.search),e=O6(n.search),r=e!==null&&Ff(e)?e:null;return{electron:t,shellVersion:r}}function nO(n){return!n.electron||n.requiredDesktopVersion===null||!Ff(n.requiredDesktopVersion)?!1:n.shellVersion===null?!0:n.shellVersion===Id?!1:X1(n.requiredDesktopVersion,n.shellVersion)}const rO=`# 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.`,iO=`# 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 HS(n,t=!1){return t?rO:n===null?iO:n.upgradeMarkdown}function sO(n){const t=nO(n);return{gated:t,instructionsMarkdown:t?HS(n.desktop):null,suppressUpdateToast:t}}function oO(n){const t=n.reload??(()=>location.reload()),e=n.navigationLatch??hv();let r=null,i=!1;const s=new Set,a=f=>{var p;return sO({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;p===null||s.has(p)||(s.add(p),r==null||r.connection.sendTelemetrySignal("desktop_upgrade_gate_shown",{...n.detection.shellVersion===null?{}:{desktop_app_version:n.detection.shellVersion},required_desktop_version:p}))}const u=f=>{e.pending||(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 aO 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 Wt("change")))}}el=new WeakMap;const lO=`### Desktop app update ready
|
|
70
|
+
|
|
71
|
+
Television updates its desktop app automatically. Version {version} has downloaded and installs when you restart the app.`,cO="tv-desktop-self-update-dismissed";function uO(n){return lO.replace("{version}",n)}var Cu,tl,Ru,wo,nl;class hO extends Ri{constructor({electron:e,bridge:r}){super();m(this,Cu);m(this,tl);m(this,Ru,!1);m(this,wo,null);m(this,nl,!1);d(this,Cu,e),d(this,tl,r??null)}get version(){return o(this,wo)}get restarting(){return o(this,nl)}subscribe(){if(o(this,Ru))return;d(this,Ru,!0);const e=o(this,tl);!o(this,Cu)||typeof(e==null?void 0:e.onDesktopUpdateDownloaded)!="function"||e.onDesktopUpdateDownloaded(r=>{typeof r!="string"||r.length===0||r===o(this,wo)||(d(this,wo,r),this.dispatchEvent(new Wt("change")))})}restart(){var e,r;o(this,wo)===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 Wt("change")))}}Cu=new WeakMap,tl=new WeakMap,Ru=new WeakMap,wo=new WeakMap,nl=new WeakMap;function dO(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 ZS(n){return typeof n=="object"&&n!==null}function US(n){return!ZS(n)||n.type!=="ready"?!1:!("id"in n)}function FS(n){return!(!ZS(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}const qS=$n(),VS="No handler registered for update-content",BS="handleUpdateContent: handler already registered",eb="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,bo,So,ol,it,Sg,GS,JS,Ca,ad,u8;let fO=(u8=class extends WS{constructor(e){super();m(this,it);m(this,rl);m(this,il);m(this,sl);m(this,bo,null);m(this,So,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,So)}set content(e){h(this,it,ad).call(this),d(this,So,e),o(this,ol)&&h(this,it,Sg).call(this,e)}handleUpdateContent(e){if(h(this,it,ad).call(this),o(this,bo)!==null)throw new Error(BS);d(this,bo,e)}notifyStylesChanged(){if(h(this,it,ad).call(this),!o(this,ol))return;const e={type:"styles-changed"};h(this,it,Ca).call(this,e)}dispose(){o(this,il).removeEventListener("message",o(this,sl)),d(this,bo,null)}},rl=new WeakMap,il=new WeakMap,sl=new WeakMap,bo=new WeakMap,So=new WeakMap,ol=new WeakMap,it=new WeakSet,Sg=function(e){const r={type:"content-updated",content:e};h(this,it,Ca).call(this,r)},GS=function(e){if(this.disposed||e.source!==o(this,rl).contentWindow)return;const r=e.data;if(US(r)){d(this,ol,!0),this.dispatchEvent(new qS("ready")),o(this,So)!==null&&h(this,it,Sg).call(this,o(this,So));return}if(FS(r)){h(this,it,JS).call(this,r);return}},JS=async function(e){const r=o(this,bo);if(r===null){h(this,it,Ca).call(this,{type:"response",id:e.id,error:{message:VS}});return}try{await r(e.content)}catch(i){if(this.disposed)return;h(this,it,Ca).call(this,{type:"response",id:e.id,error:{message:jS(i)}});return}this.disposed||h(this,it,Ca).call(this,{type:"response",id:e.id,result:{}})},Ca=function(e){const r=o(this,rl).contentWindow;r&&r.postMessage(e,"*")},ad=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},u8);var _o,al,Ao,Eo,ll,st,_g,YS,KS,Ra,ld;class pO extends WS{constructor(e){super();m(this,st);m(this,_o);m(this,al);m(this,Ao,null);m(this,Eo,null);m(this,ll,!1);d(this,_o,e),d(this,al,r=>h(this,st,YS).call(this,r)),o(this,_o).addEventListener("ipc-message",o(this,al))}get content(){return o(this,Eo)}set content(e){h(this,st,ld).call(this),d(this,Eo,e),o(this,ll)&&h(this,st,_g).call(this,e)}handleUpdateContent(e){if(h(this,st,ld).call(this),o(this,Ao)!==null)throw new Error(BS);d(this,Ao,e)}notifyStylesChanged(){if(h(this,st,ld).call(this),!o(this,ll))return;const e={type:"styles-changed"};h(this,st,Ra).call(this,e)}dispose(){o(this,_o).removeEventListener("ipc-message",o(this,al)),d(this,Ao,null)}}_o=new WeakMap,al=new WeakMap,Ao=new WeakMap,Eo=new WeakMap,ll=new WeakMap,st=new WeakSet,_g=function(e){const r={type:"content-updated",content:e};h(this,st,Ra).call(this,r)},YS=function(e){var s;if(this.disposed)return;const r=e.detail??e;if(!r||r.channel!==eb)return;const i=(s=r.args)==null?void 0:s[0];if(US(i)){d(this,ll,!0),this.dispatchEvent(new qS("ready")),o(this,Eo)!==null&&h(this,st,_g).call(this,o(this,Eo));return}if(FS(i)){h(this,st,KS).call(this,i);return}},KS=async function(e){const r=o(this,Ao);if(r===null){h(this,st,Ra).call(this,{type:"response",id:e.id,error:{message:VS}});return}try{await r(e.content)}catch(i){if(this.disposed)return;h(this,st,Ra).call(this,{type:"response",id:e.id,error:{message:jS(i)}});return}this.disposed||h(this,st,Ra).call(this,{type:"response",id:e.id,result:{}})},Ra=function(e){var r,i;(i=(r=o(this,_o)).send)==null||i.call(r,eb,e)},ld=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,tb=n=>n,Ld=Jc.trustedTypes,nb=Ld?Ld.createPolicy("lit-html",{createHTML:n=>n}):void 0,XS="$lit$",qi=`lit$${Math.random().toFixed(9).slice(2)}$`,QS="?"+qi,mO=`<${QS}>`,ra=document,ru=()=>ra.createComment(""),iu=n=>n===null||typeof n!="object"&&typeof n!="function",dv=Array.isArray,gO=n=>dv(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",Dm=`[
|
|
76
|
+
\f\r]`,vc=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,rb=/-->/g,ib=/>/g,Vs=RegExp(`>|${Dm}(?:([^\\s"'>=/]+)(${Dm}*=${Dm}*(?:[^
|
|
77
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),sb=/'/g,ob=/"/g,e_=/^(?:script|style|textarea|title)$/i,vO=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),W=vO(1),$t=Symbol.for("lit-noChange"),he=Symbol.for("lit-nothing"),ab=new WeakMap,ro=ra.createTreeWalker(ra,129);function t_(n,t){if(!dv(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return nb!==void 0?nb.createHTML(t):t}const yO=(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=rb:f[1]!==void 0?a=ib:f[2]!==void 0?(e_.test(f[2])&&(i=RegExp("</"+f[2],"g")),a=Vs):f[3]!==void 0&&(a=Vs):a===Vs?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?Vs:f[3]==='"'?ob:sb):a===ob||a===sb?a=Vs:a===rb||a===ib?a=vc:(a=Vs,i=void 0);const v=a===Vs&&n[l+1].startsWith("/>")?" ":"";s+=a===vc?c+mO: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 su{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]=yO(t,e);if(this.el=su.createElement(u,r),ro.currentNode=this.el.content,e===2||e===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=ro.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]==="."?bO:S[1]==="?"?SO:S[1]==="@"?_O: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=Ld?Ld.emptyScript:"";for(let v=0;v<y;v++)i.append(p[v],ru()),ro.nextNode(),c.push({type:2,index:++s});i.append(p[y],ru())}}}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=ra.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=iu(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 wO{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)??ra).importNode(e,!0);ro.currentNode=i;let s=ro.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 AO(s,this,t)),this._$AV.push(u),c=r[++l]}a!==(c==null?void 0:c.index)&&(s=ro.nextNode(),a++)}return ro.currentNode=ra,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=he,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),iu(t)?t===he||t==null||t===""?(this._$AH!==he&&this._$AR(),this._$AH=he):t!==this._$AH&&t!==$t&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):gO(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!==he&&iu(this._$AH)?this._$AA.nextSibling.data=t:this.T(ra.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=su.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 wO(i,this),l=a.u(this.options);a.p(e),this.T(l),this._$AH=a}}_$AC(t){let e=ab.get(t.strings);return e===void 0&&ab.set(t.strings,e=new su(t)),e}k(t){dv(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(ru()),this.O(ru()),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=tb(t).nextSibling;tb(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=he,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=he}_$AI(t,e=this,r,i){const s=this.strings;let a=!1;if(s===void 0)t=Bl(this,t,e,0),a=!iu(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=!iu(u)||u!==this._$AH[c]),u===he?t=he:t!==he&&(t+=(u??"")+s[c+1]),this._$AH[c]=u}a&&!i&&this.j(t)}j(t){t===he?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},bO=class extends Qf{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===he?void 0:t}},SO=class extends Qf{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==he)}},_O=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)??he)===$t)return;const r=this._$AH,i=t===he&&r!==he||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==he&&(r===he||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 AO{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 EO={I:Xf},Om=Jc.litHtmlPolyfillSupport;Om==null||Om(su,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(ru(),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:kO}=EO,lb=n=>n,r_=n=>n.strings===void 0,cb=()=>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(cb(),i),l=r.insertBefore(cb(),i);e=new kO(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=lb(u).nextSibling;lb(r).insertBefore(u,i),u=f}}}return e},Bs=(n,t,e=n)=>(n._$AI(t,e),n),TO={},i_=(n,t=TO)=>n._$AH=t,CO=n=>n._$AH,Lm=n=>{n._$AR(),n._$AA.remove()};/**
|
|
82
|
+
* @license
|
|
83
|
+
* Copyright 2017 Google LLC
|
|
84
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
85
|
+
*/const Rr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4},rc=n=>(...t)=>({_$litDirective$:n,values:t});let Eh=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),$O(t)}};function RO(n){this._$AN!==void 0?(Md(this),this._$AM=n,s_(this)):this._$AM=n}function IO(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 $O=n=>{n.type==Rr.CHILD&&(n._$AP??(n._$AP=IO),n._$AQ??(n._$AQ=RO))};class o_ extends Eh{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 Iu,$u,Xi,ko;class dn extends o_{constructor(){super(...arguments);m(this,Iu,[]);m(this,$u,!1);m(this,Xi,!1);m(this,ko,!1)}connected(){}template(...e){return $t}render(...e){return!this.isConnected||o(this,Xi)||this.setValue(e.length?e[0]:this.template(...o(this,Iu))),$t}update(e,r){d(this,Iu,r),d(this,ko,!1),d(this,Xi,!0);try{return o(this,$u)||(d(this,$u,!0),this.connected()),this.template(...r)}finally{d(this,Xi,!1)}}reconnected(){d(this,Xi,!0);try{this.connected()}finally{d(this,Xi,!1)}d(this,ko,!0),queueMicrotask(()=>{o(this,ko)&&(d(this,ko,!1),this.render())})}}Iu=new WeakMap,$u=new WeakMap,Xi=new WeakMap,ko=new WeakMap;function fn(n){return rc(n)}const xO=3;function PO(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>=xO||!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 DO='<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>',OO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/></svg>',LO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"/></svg>',MO='<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>',NO='<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>',zO='<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>',HO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z"/></svg>',ZO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm88-29.84q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.21,107.21,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.71,107.71,0,0,0-26.25-10.87,8,8,0,0,0-7.06,1.49L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.21,107.21,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06Zm-16.1-6.5a73.93,73.93,0,0,1,0,8.68,8,8,0,0,0,1.74,5.48l14.19,17.73a91.57,91.57,0,0,1-6.23,15L187,173.11a8,8,0,0,0-5.1,2.64,74.11,74.11,0,0,1-6.14,6.14,8,8,0,0,0-2.64,5.1l-2.51,22.58a91.32,91.32,0,0,1-15,6.23l-17.74-14.19a8,8,0,0,0-5-1.75h-.48a73.93,73.93,0,0,1-8.68,0,8,8,0,0,0-5.48,1.74L100.45,215.8a91.57,91.57,0,0,1-15-6.23L82.89,187a8,8,0,0,0-2.64-5.1,74.11,74.11,0,0,1-6.14-6.14,8,8,0,0,0-5.1-2.64L46.43,170.6a91.32,91.32,0,0,1-6.23-15l14.19-17.74a8,8,0,0,0,1.74-5.48,73.93,73.93,0,0,1,0-8.68,8,8,0,0,0-1.74-5.48L40.2,100.45a91.57,91.57,0,0,1,6.23-15L69,82.89a8,8,0,0,0,5.1-2.64,74.11,74.11,0,0,1,6.14-6.14A8,8,0,0,0,82.89,69L85.4,46.43a91.32,91.32,0,0,1,15-6.23l17.74,14.19a8,8,0,0,0,5.48,1.74,73.93,73.93,0,0,1,8.68,0,8,8,0,0,0,5.48-1.74L155.55,40.2a91.57,91.57,0,0,1,15,6.23L173.11,69a8,8,0,0,0,2.64,5.1,74.11,74.11,0,0,1,6.14,6.14,8,8,0,0,0,5.1,2.64l22.58,2.51a91.32,91.32,0,0,1,6.23,15l-14.19,17.74A8,8,0,0,0,199.87,123.66Z"/></svg>',UO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"/></svg>',FO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"/></svg>',qO='<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>',VO='<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>',BO='<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>',jO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,71.1a8,8,0,0,1-10.78-3.42,94.13,94.13,0,0,0-33.46-36.91,8,8,0,1,1,8.54-13.54,111.46,111.46,0,0,1,39.12,43.09A8,8,0,0,1,224,71.1ZM35.71,72a8,8,0,0,0,7.1-4.32A94.13,94.13,0,0,1,76.27,30.77a8,8,0,1,0-8.54-13.54A111.46,111.46,0,0,0,28.61,60.32,8,8,0,0,0,35.71,72Zm186.1,103.94A16,16,0,0,1,208,200H167.2a40,40,0,0,1-78.4,0H48a16,16,0,0,1-13.79-24.06C43.22,160.39,48,138.28,48,112a80,80,0,0,1,160,0C208,138.27,212.78,160.38,221.81,175.94ZM150.62,200H105.38a24,24,0,0,0,45.24,0ZM208,184c-10.64-18.27-16-42.49-16-72a64,64,0,0,0-128,0c0,29.52-5.38,53.74-16,72Z"/></svg>',WO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,96V216H96V160h64V96Z" opacity="0.2"/><path d="M216,88H168V40a8,8,0,0,0-8-8H40a8,8,0,0,0-8,8V160a8,8,0,0,0,8,8H88v48a8,8,0,0,0,8,8H216a8,8,0,0,0,8-8V96A8,8,0,0,0,216,88ZM48,48H152V152H48ZM208,208H104V168h56a8,8,0,0,0,8-8V104h40Z"/></svg>',GO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"/></svg>',JO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,112a28,28,0,0,0-8,54.83V184a8,8,0,0,0,16,0V166.83A28,28,0,0,0,128,112Zm0,40a12,12,0,1,1,12-12A12,12,0,0,1,128,152Zm80-72H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"/></svg>',YO='<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>',KO='<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>',XO='<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>',QO='<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>',eL='<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>',tL='<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>',nL='<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>',rL='<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>',iL='<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>',sL='<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>',oL='<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>',aL='<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>',lL='<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>',cL='<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>',uL='<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>',hL='<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>',dL='<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>',fL='<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>',pL='<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>',mL='<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>',gL='<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>',vL='<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>',yL='<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>',wL='<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>',bL='<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>',SL='<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>',_L='<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>',AL='<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>',EL='<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>',kL='<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>',TL='<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>',CL='<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>',RL='<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>',IL='<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>',$L='<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>',xL='<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>',PL='<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>',DL='<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>',OL='<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>',LL='<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>',ML='<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>',NL='<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>',zL='<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>',HL='<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>',ZL='<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>',UL='<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>',FL='<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>',qL='<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>',VL='<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>',BL='<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>',jL='<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>',WL='<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>',GL='<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>',JL='<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>',YL='<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>',KL='<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>',XL='<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>',QL='<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>',eM='<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>',tM='<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>',nM='<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>',rM='<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>',iM='<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>',sM='<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>',oM='<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>',aM='<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>',lM='<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>',cM='<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>',uM='<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>',hM='<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>',dM='<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>',fM='<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>',pM='<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>',mM='<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>',gM='<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>',vM='<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>',yM='<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>',wM='<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>',bM='<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>',SM='<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>',_M='<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>',AM='<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>',EM='<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>',kM='<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>',TM=':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(TM);const l_={check:DO,close:OO,copy:LO,pin:MO,search:NO,add:zO,more:HO,settings:ZO,expand:UO,collapse:FO,"collapse-up":qO,select:VO,skills:BO,notification:jO,artifact:WO,spinner:GO,locked:JO,unpin:YO,back:KO,forward:XO,television:QO,calendar:eL,grid:tL,hash:nL,delete:rL,edit:iL,link:sL,external:oL,download:aL,reload:lL,warning:cL,info:uL,file:hL,folder:dL,clock:fL,user:pL,upload:mL,star:gL,home:vL,send:yL,filter:wL,sort:bL,help:SL,chart:_L,image:AL,chat:EL,location:kL,play:TL,pause:CL,stop:RL,video:IL,music:$L,error:xL,email:PL,phone:DL,web:OL,tag:LL,bookmark:ML,table:NL,code:zL,group:HL,up:ZL,down:UL,money:FL,bank:qL,card:VL,wallet:BL,gauge:jL,activity:WL,"trend-up":GL,"trend-down":JL,database:YL,server:KL,deploy:XL,list:QL,terminal:eM,branch:tM,shield:nM,sidebar:rM,plane:iM,car:sM,bus:oM,bed:aM,food:lM,cake:cM,tent:uM,microphone:hM,luggage:dM,key:fM,sun:pM,moon:mM,at:gM,briefcase:vM,bicycle:yM,train:wM,gift:bM,book:SM,camera:_M,inbox:AM,hourglass:EM,printer:kM};function CM(n){return n!==null&&Object.hasOwn(l_,n)}var xu,Eg;class c_ extends HTMLElement{constructor(){super(...arguments);m(this,xu)}connectedCallback(){h(this,xu,Eg).call(this)}attributeChangedCallback(){this.isConnected&&h(this,xu,Eg).call(this)}}xu=new WeakSet,Eg=function(){const e=this.shadowRoot??this.attachShadow({mode:"open"});e.adoptedStyleSheets=[a_],this.replaceChildren();const r=this.getAttribute("name");e.innerHTML=CM(r)?l_[r]:""},R(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 ou(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(),ou(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,Pu,Du,cl,Qi,xs,Tg,Yd,Kd,Xd,Qd,ef,Cg;class RM{constructor(t){m(this,xs);R(this,"document");R(this,"panels",new Set);m(this,Xr,new Map);m(this,Pu,new WeakMap);m(this,Du,new AbortController);m(this,cl);m(this,Qi,0);m(this,Yd,t=>{if(!(t.target instanceof Element))return;const e=t.target;o(this,Pu).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,Pu).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,xs,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,xs,Cg).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,xs,Tg).call(this);h(this,xs,Cg).call(this,t,e)});this.document=t;const e={signal:o(this,Du).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,Qi))return;const t=()=>{d(this,Qi,0);for(const e of this.panels)e.open&&e.place();[...this.panels].some(e=>e.open)&&d(this,Qi,this.document.defaultView.requestAnimationFrame(t))};d(this,Qi,this.document.defaultView.requestAnimationFrame(t))}remove(t){this.closed(t),this.panels.delete(t),!this.panels.size&&(o(this,Du).abort(),o(this,cl).disconnect(),this.document.defaultView.cancelAnimationFrame(o(this,Qi)),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,Pu=new WeakMap,Du=new WeakMap,cl=new WeakMap,Qi=new WeakMap,xs=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,Cg=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,es,To,ul,ts,ns,Dt,Rg,h_,Ig,Ou,d_,$g;class fv{constructor(t,e={}){m(this,Dt);R(this,"host");R(this,"behavior");R(this,"trigger",null);m(this,je);m(this,es,!1);m(this,To,!1);m(this,ul,!0);m(this,ts,new Map);m(this,ns,new Set);m(this,Ou,t=>{const e=t.target;e instanceof HTMLElement&&e!==this.host&&this.host.contains(e)&&o(this,ns).add(e)});this.host=t,this.behavior=e}get open(){return this.host.hasAttribute("open")&&o(this,es)}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,es,!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,Dt,Ig).call(this),h(this,Dt,$g).call(this),t&&((i=this.trigger)!=null&&i.isConnected)&&this.trigger.focus({preventScroll:!0}),h(this,Dt,Rg).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,Dt,Rg).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,es))if(this.host.hasAttribute("open"))o(this,je).prepareOpen(this),d(this,es,!0),h(this,Dt,h_).call(this),h(this,Dt,d_).call(this),this.place(),(a=(s=this.behavior).opened)==null||a.call(s,o(this,To)),d(this,To,!1),o(this,je).animate();else{const f=o(this,je).contains(this,this.host.ownerDocument.activeElement);d(this,es,!1),o(this,je).closeDescendants(this),o(this,je).closed(this),(c=(l=this.behavior).closed)==null||c.call(l),h(this,Dt,Ig).call(this),h(this,Dt,$g).call(this),f&&o(this,ul)&&((u=this.trigger)!=null&&u.isConnected)&&this.trigger.focus({preventScroll:!0})}}toggle(t=!1){d(this,To,t),this.host.toggleAttribute("open")}show(t=!1){d(this,To,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,ns)){if(!le.isConnected||!t.contains(le)){o(this,ns).delete(le);continue}l.push({element:le,scrollTop:le.scrollTop,scrollLeft:le.scrollLeft})}t.style.maxWidth="none";const c=o(this,ts).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,ts).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(),Z=$.width,O=$.height,z=Math.max(i,Math.min(v?r.right-Z:r.left,e.innerWidth-i-Z));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,Ot=r.top+r.height/2-We;if(Ot>=i&&Ot+O<=e.innerHeight-i)P=Ot,B=e.innerHeight-i-Ot;else{const Pn=e.innerHeight-i-r.top,ht=r.bottom-i,wt=O>Pn&&ht>Pn;B=wt?ht:Pn,P=wt?r.bottom-Math.min(O,B):r.top}}else{const le=Math.max(0,e.innerHeight-i-r.bottom-i),We=Math.max(0,r.top-2*i),Ot=O>le&&We>le;B=Ot?We:le,P=Ot?r.top-i-Math.min(O,We):r.bottom+i}const F=`${Math.max(0,B)}px`;t.style.maxHeight=u==="none"?F:`min(${u}, ${F})`,t.style.left=`${z}px`,t.style.top=`${Math.max(i,Math.min(P,e.innerHeight-i-Math.min(O,B)))}px`;const q=e.getComputedStyle(t),Q=q.boxSizing==="border-box",V=parseFloat(q.width)+(Q?0:parseFloat(q.paddingLeft)+parseFloat(q.paddingRight)+parseFloat(q.borderLeftWidth)+parseFloat(q.borderRightWidth)),ie=parseFloat(q.height)+(Q?0:parseFloat(q.paddingTop)+parseFloat(q.paddingBottom)+parseFloat(q.borderTopWidth)+parseFloat(q.borderBottomWidth));t.style.setProperty("--_panel-edge-inset",`${t.style.top} auto auto ${t.style.left}`),t.style.setProperty("--_panel-edge-width",`${V}px`),t.style.setProperty("--_panel-edge-height",`${ie}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,es=new WeakMap,To=new WeakMap,ul=new WeakMap,ts=new WeakMap,ns=new WeakMap,Dt=new WeakSet,Rg=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,ns).clear(),this.host.addEventListener("scroll",o(this,Ou),!0)},Ig=function(){this.host.removeEventListener("scroll",o(this,Ou),!0),o(this,ns).clear()},Ou=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,ts).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,ts))e?this.host.style.setProperty(t,e,r):this.host.style.removeProperty(t);o(this,ts).clear()};class IM extends HTMLElement{constructor(){super(),this.attachInternals().role="menuitem"}connectedCallback(){this.tabIndex=-1}}var rs,$r,xg,Pg,p_;class f_ extends HTMLElement{constructor(){super();m(this,$r);m(this,rs,new fv(this,{opened:e=>{e&&ou(h(this,$r,xg).call(this)[0])},keydown:e=>h(this,$r,p_).call(this,e),pointermove:e=>ou(h(this,$r,Pg).call(this,e)??void 0),click:e=>{h(this,$r,Pg).call(this,e)&&o(this,rs).close()}}));this.attachInternals().role="menu"}connectedCallback(){o(this,rs).connect()}disconnectedCallback(){o(this,rs).disconnect()}attributeChangedCallback(){o(this,rs).refresh()}}rs=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,rs).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},R(f_,"observedAttributes",["open","trigger","manual"]);customElements.get("tv-menu-item")||customElements.define("tv-menu-item",IM);customElements.get("tv-menu")||customElements.define("tv-menu",f_);let $M=0;var Lu;class xM extends dn{constructor(){super(...arguments);m(this,Lu,`menu-trigger-${++$M}`)}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":he} @click=${i.action}>${i.label}</tv-menu-item>`)}
|
|
91
|
+
</tv-menu>`}}Lu=new WeakMap;const m_=fn(xM);/**
|
|
92
|
+
* @license
|
|
93
|
+
* Copyright 2020 Google LLC
|
|
94
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
95
|
+
*/const Jn=()=>new PM;class PM{}const Mm=new WeakMap,vt=rc(class extends o_{render(n){return he}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)),he}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 ub=(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 Eh{constructor(n){if(super(n),n.type!==Rr.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=CO(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]=Bs(i[p],s[v]),p++,v++;else if(l[y]===a[S])c[S]=Bs(i[y],s[S]),y--,S--;else if(l[p]===a[S])c[S]=Bs(i[p],s[S]),yc(n,c[S+1],i[p]),p++,S--;else if(l[y]===a[v])c[v]=Bs(i[y],s[v]),yc(n,i[p],i[y]),y--,v++;else if(u===void 0&&(u=ub(a,v,S),f=ub(l,p,y)),u.has(l[p]))if(u.has(l[y])){const _=f.get(a[v]),$=_!==void 0?i[_]:null;if($===null){const Z=yc(n,i[p]);Bs(Z,s[v]),c[v]=Z}else c[v]=Bs($,s[v]),yc(n,i[p],$),i[_]=null;v++}else Lm(i[y]),y--;else Lm(i[p]),p++;for(;v<=S;){const _=yc(n,c[S+1]);Bs(_,s[v]),c[v++]=_}for(;p<=y;){const _=i[p++];_!==null&&Lm(_)}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",DM=" !"+g_,zd=rc(class extends Eh{constructor(n){var t;if(super(n),n.type!==Rr.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(DM);r.includes("-")||s?e.setProperty(r,s?i.slice(0,-11):i,s?g_:""):e[r]=i}}return $t}}),OM=24;function LM(n){return!hb(n.source)||!hb(n.current)||!FM(n.source,n.current)||!qM(n)||!UM(n.geometry)?{kind:"invalidated"}:zM(n.pointer,n.geometry)==="pinned"?MM(n):NM(n)}function MM(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)??HM(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 NM(n){const{source:t,current:e}=n,r=t.pinnedChannelIds.includes(t.channelId),i=r?ZM(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 zM(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+OM);return n.y<i?"pinned":"unpinned"}function HM(n,t){const e=t.findIndex(({top:r,bottom:i})=>n<r+(i-r)/2);return e===-1?t.length:e}function ZM(n,t){const e=n.filter(i=>i!==t),r=e.findIndex(i=>i<t);return r===-1?e.length:r}function UM(n){return n.unpinnedGroupTop!==null||n.pinnedContentBottom!==null}function hb(n){const t=[...n.pinnedChannelIds,...n.unpinnedChannelIds];return new Set(t).size===t.length}function FM(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,Rn=28,Hd=800,Vh="ease",db=.5,wc=.5,VM="New channel",js=".channel-group:not(.channel-group-withdrawal) .channel-row",BM=24;var Lt,sn,kt,mt,on,Mt,pr,Co,Oe,ye,wn,bn,Sn,Nt,zt,Ht,_n,Zt,mr,Qr,hl,dl,is,x,Og,w_,b_,S_,__,cd,A_,E_,k_,T_,Pc,$a,C_,R_,Lg,Dc,tf,nf,rf,sf,I_,Mg,Ng,$_,Mu,Nu,x_,of,zu,P_,D_,Oc,zg,O_,L_,Lc,Hg,Zg,Ug,M_,ud,Hu,Zu,Uu,Fu,N_,Fg,hd,dd,Mc,qg,Vg;class y_{constructor(t){m(this,x);m(this,Lt);m(this,sn,null);m(this,kt,null);m(this,mt,{management:!0});m(this,on,!1);m(this,Mt,null);m(this,pr,"");m(this,Co,!1);m(this,Oe,null);m(this,ye,null);m(this,wn,!1);m(this,bn,null);m(this,Sn,null);m(this,Nt,null);m(this,zt,null);m(this,Ht,null);m(this,_n,null);m(this,Zt,null);m(this,mr,null);m(this,Qr,Jn());m(this,hl,Jn());m(this,dl,Jn());m(this,is,null);R(this,"create",()=>{const t=o(this,sn),e=o(this,kt);if(t===null||e===null||o(this,bn)!==null)return;const r={resultChannelId:null};d(this,bn,r),o(this,Lt).call(this),t.createChannel(VM).then(i=>{r.resultChannelId=i.id,t.focusChannel(i.id).catch(()=>{}),o(this,bn)===r&&o(this,Lt).call(this)},()=>{o(this,bn)!==r||o(this,Sn)!==null||(d(this,bn,null),o(this,Lt).call(this))})});m(this,tf,t=>{d(this,pr,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,Mu,()=>{d(this,wn,!1)});m(this,Nu,t=>{!o(this,wn)||t.detail===0||(d(this,wn,!1),t.preventDefault(),t.stopImmediatePropagation())});m(this,of,t=>{var e;!o(this,mt).highlightOnPointerMove||o(this,ye)!==null||o(this,Mt)!==null||(e=o(this,Qr).value)!=null&&e.querySelector("tv-menu[open]")||ou(t.currentTarget)});m(this,zu,t=>{if(o(this,on)){d(this,Oe,null);return}const e=o(this,ye);if(e!==null){if(e.pointerId!==t.pointerId)return;t.preventDefault(),h(this,x,Oc).call(this,e,t);return}const r=o(this,Oe);if(!(r===null||r.pointerId!==t.pointerId)){if(t.buttons===0){d(this,Oe,null);return}Math.hypot(t.clientX-r.x,t.clientY-r.y)<=v_||h(this,x,P_).call(this,r,t)}});m(this,Hu,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,Oc).call(this,e,t);const s=i&&e.placement.kind==="placement"?e.placement.operation:null,a=o(this,sn);if(s===null||a===null){h(this,x,Mc).call(this,e,!1);return}e.completed=!0,h(this,x,Lc).call(this,e),e.operation=[...s],a.setPinnedChannelIds([...s]).then(()=>{o(this,ye)===e&&(e.operationResolved=!0,h(this,x,Fg).call(this,o(this,kt)))},()=>{o(this,ye)===e&&(e.operationResolved=!0,e.operationRejected=!0,h(this,x,hd).call(this,e))});return}((r=o(this,Oe))==null?void 0:r.pointerId)===t.pointerId&&d(this,Oe,null)});m(this,Zu,t=>{var e,r;((e=o(this,ye))==null?void 0:e.pointerId)===t.pointerId&&!o(this,ye).completed?h(this,x,dd).call(this):((r=o(this,Oe))==null?void 0:r.pointerId)===t.pointerId&&d(this,Oe,null)});m(this,Uu,t=>{const e=o(this,ye);e===null||e.pointerId!==t.pointerId||e.completed||h(this,x,Mc).call(this,e,!1)});m(this,Fu,t=>{t.key!=="Escape"||o(this,ye)===null||o(this,ye).completed||(t.preventDefault(),t.stopImmediatePropagation(),h(this,x,dd).call(this))});d(this,Lt,t)}get creating(){return o(this,bn)!==null}get dragging(){return o(this,ye)!==null}connect(){window.addEventListener("pointermove",o(this,zu)),window.addEventListener("pointerup",o(this,Hu)),window.addEventListener("pointercancel",o(this,Zu)),window.addEventListener("lostpointercapture",o(this,Uu)),window.addEventListener("keydown",o(this,Fu),!0),window.addEventListener("click",o(this,Nu),!0),window.addEventListener("pointerdown",o(this,Mu),!0)}update(t,e,r){const i=o(this,kt),s=o(this,on);d(this,sn,t),d(this,kt,e),d(this,mt,r),d(this,on,r.motionSuppressed??!1),!s&&o(this,on)&&h(this,x,C_).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,Mt)!==null&&!e.channels.some(({id:l})=>l===o(this,Mt))&&(d(this,Mt,null),d(this,pr,"")),h(this,x,Fg).call(this,e);const a=o(this,is);a!==null&&e.display.pinnedChannelIds.includes(a.channelId)===a.pinned&&(d(this,is,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,on)&&h(this,x,R_).call(this)}template(){var r;const t=o(this,kt);if(t===null)return he;const e=h(this,x,T_).call(this,fb(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,Og).call(this,"Pinned",e.pinned)}
|
|
111
|
+
${h(this,x,Og).call(this,"Recent",e.unpinned)}
|
|
112
|
+
</div>
|
|
113
|
+
`}overlayTemplate(){return o(this,mt).management?h(this,x,E_).call(this):he}disconnect(){var t,e,r;window.removeEventListener("pointermove",o(this,zu)),window.removeEventListener("pointerup",o(this,Hu)),window.removeEventListener("pointercancel",o(this,Zu)),window.removeEventListener("lostpointercapture",o(this,Uu)),window.removeEventListener("keydown",o(this,Fu),!0),window.removeEventListener("click",o(this,Nu),!0),window.removeEventListener("pointerdown",o(this,Mu),!0),h(this,x,qg).call(this),(t=o(this,mr))==null||t.withdraw(),d(this,mr,null),(e=o(this,_n))==null||e.cancel(),d(this,_n,null),(r=o(this,Zt))==null||r.cancel(),d(this,Zt,null),d(this,sn,null),d(this,kt,null),d(this,Mt,null),d(this,pr,""),d(this,Co,!1),d(this,Oe,null),d(this,wn,!1),d(this,bn,null),d(this,Sn,null),d(this,Nt,null),d(this,zt,null),d(this,Ht,null),d(this,is,null)}}Lt=new WeakMap,sn=new WeakMap,kt=new WeakMap,mt=new WeakMap,on=new WeakMap,Mt=new WeakMap,pr=new WeakMap,Co=new WeakMap,Oe=new WeakMap,ye=new WeakMap,wn=new WeakMap,bn=new WeakMap,Sn=new WeakMap,Nt=new WeakMap,zt=new WeakMap,Ht=new WeakMap,_n=new WeakMap,Zt=new WeakMap,mr=new WeakMap,Qr=new WeakMap,hl=new WeakMap,dl=new WeakMap,is=new WeakMap,x=new WeakSet,Og=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,Mt);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,pr)}
|
|
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":he}
|
|
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
|
+
`}):he}
|
|
194
|
+
`}
|
|
195
|
+
</div>
|
|
196
|
+
`},b_=function(t){const{channel:e,pinned:r}=t;return[{label:"Rename",action:()=>h(this,x,Lg).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,bn);if(e===null||o(this,Sn)!==null||e.resultChannelId===null)return;const r=t.channels.find(({id:i})=>i===e.resultChannelId);r!==void 0&&(d(this,Sn,r.id),queueMicrotask(()=>h(this,x,Pc).call(this,"create",r.id)))},__=function(t,e){var i,s,a,l,c;if(o(this,Nt)!==null||o(this,zt)!==null)return;h(this,x,Ng).call(this,t),d(this,Nt,{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,mr,tp(r,()=>{h(this,x,cd).call(this)})),(c=(l=o(this,dl).value)==null?void 0:l.querySelector(".dialog-actions button"))==null||c.focus())},cd=function(t=!1){var i,s;const e=o(this,Nt),r=o(this,mr);d(this,mr,null),d(this,Nt,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,sn),e=o(this,Nt);if(t===null||e===null||o(this,zt)!==null)return;d(this,zt,e.channelId),h(this,x,cd).call(this,!0);const r=o(this,mt).onDeleteEnd;t.deleteChannel(e.channelId).then(()=>{r==null||r(e.channelId,!0)}).catch(()=>{o(this,zt)===e.channelId&&o(this,Ht)===null&&(d(this,zt,null),o(this,Lt).call(this)),r==null||r(e.channelId,!1)})},E_=function(){const t=o(this,Nt);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,cd).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,Nt)!==null&&!e.channels.some(({id:p})=>{var y;return p===((y=o(this,Nt))==null?void 0:y.channelId)})){const p=o(this,Nt);(u=o(this,mr))==null||u.withdraw(),d(this,mr,null),d(this,Nt,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,Ht);if(r!==null&&e.channels.some(({id:p})=>p===r.row.channel.id)){(f=o(this,Zt))==null||f.cancel(),d(this,Zt,null),d(this,Ht,null),d(this,zt,null);return}const i=o(this,zt);if(i===null||r!==null||e.channels.some(({id:p})=>p===i))return;if(t===null){d(this,zt,null);return}const s=fb(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,zt,null);return}d(this,Ht,{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,Ht);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,Sn)!==e||t==="delete"&&((l=o(this,Ht))==null?void 0:l.row.channel.id)!==e||o(this,on))return;const r=[...((c=o(this,Qr).value)==null?void 0:c.querySelectorAll(js))??[]].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,_n,a):d(this,Zt,a),a.finished.then(()=>{t==="create"&&o(this,_n)!==a||t==="delete"&&o(this,Zt)!==a||(t==="create"?d(this,_n,null):d(this,Zt,null),h(this,x,$a).call(this,t,e))},()=>{})},$a=function(t,e){var r;if(t==="create"){if(o(this,Sn)!==e)return;d(this,Sn,null),d(this,bn,null),h(this,x,Lg).call(this,e);return}((r=o(this,Ht))==null?void 0:r.row.channel.id)===e&&(d(this,Ht,null),d(this,zt,null),o(this,Lt).call(this))},C_=function(){var r;d(this,Oe,null),h(this,x,qg).call(this);const t=o(this,Sn);o(this,_n)!==null&&(o(this,_n).cancel(),d(this,_n,null),t!==null&&queueMicrotask(()=>h(this,x,$a).call(this,"create",t)));const e=((r=o(this,Ht))==null?void 0:r.row.channel.id)??null;o(this,Zt)!==null&&(o(this,Zt).cancel(),d(this,Zt,null),e!==null&&queueMicrotask(()=>h(this,x,$a).call(this,"delete",e)))},R_=function(){var r;const t=o(this,Sn),e=((r=o(this,Ht))==null?void 0:r.row.channel.id)??null;t!==null&&o(this,_n)===null&&queueMicrotask(()=>h(this,x,Pc).call(this,"create",t)),e!==null&&o(this,Zt)===null&&queueMicrotask(()=>h(this,x,Pc).call(this,"delete",e))},Lg=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,Mt,t),d(this,pr,e.name),d(this,Oe,null),o(this,Lt).call(this),queueMicrotask(()=>{var i,s;o(this,Mt)===t&&((i=o(this,hl).value)==null||i.focus(),(s=o(this,hl).value)==null||s.select())}))},Dc=function(t){if(o(this,Mt)===null||o(this,Co)||o(this,sn)===null)return;d(this,Co,!0);const e=o(this,Mt),r=o(this,pr).trim();d(this,Mt,null),d(this,pr,""),o(this,Lt).call(this),d(this,Co,!1),t&&r.length>0&&o(this,sn).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,sn)===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,is,{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,sn).setPinnedChannelIds(i).catch(()=>{d(this,is,null)})},Mg=function(t){var e,r;return((r=[...((e=o(this,Qr).value)==null?void 0:e.querySelectorAll(js))??[]].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(js))??[]].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,Oe)!==null||o(this,ye)!==null||o(this,kt)===null)return;d(this,wn,!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,Oe,{channelId:t,pointerId:e.pointerId,x:e.clientX,y:e.clientY,source:{channelId:t,...s},captureTarget:i})},Mu=new WeakMap,Nu=new WeakMap,x_=function(t,e){var r;if(e.detail!==0&&o(this,wn)){d(this,wn,!1);return}d(this,wn,!1),o(this,ye)===null&&(o(this,mt).selectChannel?o(this,mt).selectChannel(t):(r=o(this,sn))==null||r.focusChannel(t).catch(()=>{}))},of=new WeakMap,zu=new WeakMap,P_=function(t,e){if(o(this,on)){d(this,Oe,null);return}const r=[...t.captureTarget.querySelectorAll(js)].find(f=>f.dataset.channelId===t.channelId);if(r===void 0){d(this,Oe,null);return}const i=r.getBoundingClientRect(),s=h(this,x,D_).call(this,r),a=jM({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,Oe,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,wn,!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,Oe,null),d(this,ye,u),h(this,x,Oc).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},Oc=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(js)].map(O=>[O.dataset.channelId,O])),l=s.pinnedChannelIds.filter(O=>O!==t.channelId).flatMap(O=>{const z=a.get(O);if(z===void 0)return[];const P=z.getBoundingClientRect();return[{channelId:O,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}}),$=!WM(t.placement,_),Z=$?h(this,x,Zg).call(this,t):null;t.placement=_,($||r)&&h(this,x,Ug).call(this,t,Z,!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,Hg).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)<=db:((e==null?void 0:e.scrollTop)??0)>=i-db;if(o(this,on)||t.completed||r===0||i===0||s||typeof requestAnimationFrame!="function"){h(this,x,Lc).call(this,t);return}t.edgeScrollFrame===0&&(t.edgeScrollFrame=requestAnimationFrame(a=>{h(this,x,O_).call(this,t,a)}))},O_=function(t,e){if(t.edgeScrollFrame=0,o(this,on)||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,Hg).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,L_).call(this,t);return}}h(this,x,zg).call(this,t)},L_=function(t){h(this,x,Oc).call(this,t,{clientX:t.currentX,clientY:t.currentY},!1)},Lc=function(t){t.edgeScrollFrame!==0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(t.edgeScrollFrame),t.edgeScrollFrame=0,t.edgeScrollTimestamp=null,t.edgeScrollRemainder=0},Hg=function(t,e){const r=t.getBoundingClientRect();return e>=r.top&&e<r.top+Rn?-Hd*(r.top+Rn-e)/Rn:e>r.bottom-Rn&&e<=r.bottom?Hd*(e-(r.bottom-Rn))/Rn:0},Zg=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(js)){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}},Ug=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,on)||typeof HTMLElement.prototype.animate!="function"||matchMedia("(prefers-reduced-motion: reduce)").matches)){for(const i of t.captureTarget.querySelectorAll(js)){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,ud).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,ud).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,ud).call(this,t,f),f.finished.finally(()=>u.remove()).catch(()=>{})}}}}},ud=function(t,e){t.displacementAnimations.add(e),e.finished.finally(()=>{t.displacementAnimations.delete(e)}).catch(()=>{})},Hu=new WeakMap,Zu=new WeakMap,Uu=new WeakMap,Fu=new WeakMap,N_=function(t){const e=Nc(t);o(this,ye)!==null&&!o(this,ye).completed&&!pb(o(this,ye).source,e)&&h(this,x,dd).call(this),o(this,Oe)!==null&&!pb(o(this,Oe).source,e)&&d(this,Oe,null)},Fg=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,hd).call(this,e);return}const r=e.operation;r!==null&&Zd(Nc(t).pinnedChannelIds,r)&&h(this,x,hd).call(this,e)},hd=function(t){o(this,ye)!==t||t.restorationQueued||(t.restorationQueued=!0,queueMicrotask(()=>{o(this,ye)===t&&h(this,x,Mc).call(this,t,!1)}))},dd=function(){d(this,Oe,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,Lc).call(this,t);const r=h(this,x,Zg).call(this,t);d(this,ye,null),h(this,x,Vg).call(this,t),e&&t.captureTarget.hasPointerCapture(t.pointerId)&&t.captureTarget.releasePointerCapture(t.pointerId),h(this,x,Ug).call(this,t,r,!0)},qg=function(){d(this,Oe,null);const t=o(this,ye);if(d(this,ye,null),t!==null){h(this,x,Lc).call(this,t);for(const e of t.displacementAnimations)e.cancel();t.displacementAnimations.clear(),h(this,x,Vg).call(this,t),t.captureTarget.hasPointerCapture(t.pointerId)&&t.captureTarget.releasePointerCapture(t.pointerId)}},Vg=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 jM(n){const t=Math.max(0,n.wideRow.right-n.wideRow.left),e=Math.max(0,n.wideRow.bottom-n.wideRow.top),r=mb(n.pointer.x-n.wideRow.left,0,t),i=Math.min(r,Math.max(0,n.compactPreviewWidth-BM));return{wideOffsetX:r,previewOffsetX:i,correctionX:r-i,offsetY:mb(n.pointer.y-n.wideRow.top,0,e)}}function fb(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 pb(n,t){return Zd(n.pinnedChannelIds,t.pinnedChannelIds)&&Zd(n.unpinnedChannelIds,t.unpinnedChannelIds)}function Zd(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}function WM(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||Zd(n.operation,t.operation))}function mb(n,t,e){return Math.max(t,Math.min(e,n))}var Fn,af;class GM extends dn{constructor(){super(...arguments);m(this,Fn,new y_(()=>this.render()));m(this,af,e=>{const r=e.currentTarget;r.toggleAttribute("continues-start",r.scrollTop>0)})}connected(){o(this,Fn).connect()}template(e,r,i,s,a,l=!1){return o(this,Fn).update(e,r,{management:!0,motionSuppressed:l}),W`
|
|
218
|
+
<nav class="sidebar" ?dragging=${o(this,Fn).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,Fn).creating}
|
|
231
|
+
@click=${o(this,Fn).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,Fn).template()}
|
|
259
|
+
</div>
|
|
260
|
+
</nav>
|
|
261
|
+
${o(this,Fn).overlayTemplate()}
|
|
262
|
+
`}disconnected(){o(this,Fn).disconnect()}}Fn=new WeakMap,af=new WeakMap;const JM=fn(GM),YM=1280,KM=800,gb=.4,vb=.4,z_=280,yb=180,XM=14,QM=45,eN=16,wb=64,tN=90,nN=1,rN=24,iN=230,sN=230;function oN(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+_,Z=c?Bg(($-u)/_):0;let O=n*l;if(l>e){const z=1-$/e,P=Math.min(1,n/z);O=n*e+P*(l-e)}return{sidebarBoundary:u,toggleLeft:p,toggleWipe:v,titlebarOpacity:S,switcherOpacity:Z,leadReservation:O}}function aN(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,ss,ti,fl,pl,Ro,Ai,fd,jg;class lN{constructor(t){m(this,Ai);m(this,ei,null);m(this,ss,0);m(this,ti);m(this,fl);m(this,pl);m(this,Ro,1);d(this,ti,t),d(this,fl,t),d(this,pl,t)}get boundary(){return h(this,Ai,fd).call(this),o(this,ti)}move(t){const e=this.boundary;if(h(this,Ai,jg).call(this),d(this,fl,e),d(this,pl,t.target),d(this,Ro,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:yb*r,easing:"linear"});i.id="sidebar-collapse-boundary",d(this,ei,i);const s=()=>{if(o(this,ei)===i){if(h(this,Ai,fd).call(this),t.onFrame(o(this,ti)),i.playState==="finished"){d(this,ei,null),d(this,ss,0),d(this,ti,t.target),t.onFrame(t.target),t.onFinish(t.target);return}d(this,ss,requestAnimationFrame(s))}};d(this,ss,requestAnimationFrame(s))}cancel(){h(this,Ai,fd).call(this),h(this,Ai,jg).call(this)}}ei=new WeakMap,ss=new WeakMap,ti=new WeakMap,fl=new WeakMap,pl=new WeakMap,Ro=new WeakMap,Ai=new WeakSet,fd=function(){const t=o(this,ei);if(t===null)return;const e=aN(1-o(this,fl)/o(this,Ro),1-o(this,pl)/o(this,Ro),Number(t.currentTime??0),yb);d(this,ti,o(this,Ro)*(1-e))},jg=function(){var t;cancelAnimationFrame(o(this,ss)),d(this,ss,0),(t=o(this,ei))==null||t.cancel(),d(this,ei,null)};const H_="television-active-theme",pv="tv-theme";let Vi=null,_i=null,Ts=null,Cs=null,Hi=null,bb=0,Ud=0;function cN(n){const t=document.createElement("link"),e=new URL("/theme/theme.css",n);e.searchParams.set(pv,mv()),t.rel="stylesheet",t.href=e.toString(),t.dataset.televisionStyle=H_;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 uN(){Vi&&(Vi.remove(),Vi=null,document.dispatchEvent(new Event("television-theme-styles-changed")))}function Sb(n){const t=document.createElement("script"),e=new URL("/theme/main.js",n);return e.searchParams.set(pv,mv()),t.src=e.toString(),t.dataset.televisionScript=H_,_i==null||_i.remove(),document.head.append(t),_i=t,t}function hN(){_i==null||_i.remove(),_i=null}function dN(){return _i}async function fN(n,t,e){const r=Z_();if(t===null)return;let i;try{i=await e()}catch{return}if(r!==Ud)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?_b(n,"background"):null,u=s.enableIframeOverlayJS===!0?_b(n,"overlay"):null;r===Ud&&(c!==null&&(a.before(c),Ts=c),u!==null&&(l.after(u),Cs=u))}function pN(){Z_()}function Z_(){return Ud+=1,Ts==null||Ts.remove(),Cs==null||Cs.remove(),Ts=null,Cs=null,Ud}function _b(n,t){const e=t==="background"?new URL("/theme/iframe-background.js",n):new URL("/theme/iframe-overlay.js",n);e.searchParams.set(pv,mv());const r=document.createElement("iframe");return r.id=t==="background"?"theme-iframe-background":"theme-iframe-overlay",r.setAttribute("sandbox","allow-scripts"),r.setAttribute("inert",""),r.setAttribute("tabindex","-1"),r.setAttribute("aria-hidden","true"),r.srcdoc=gN(e.toString(),mN()),r}function mN(){const n=document.documentElement.dataset.theme;if(n!=="light"&&n!=="dark")throw new Error("Application root has no effective theme-frame appearance");return n}function gN(n,t){return`<!doctype html>
|
|
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 U_(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,Cs])(a==null?void 0:a.isConnected)===!0&&((s=a.contentWindow)==null||s.postMessage(i,"*"))}function kh(n){n.isTrusted&&U_({eventType:n.type,clientX:n.clientX,clientY:n.clientY,button:n.button,buttons:n.buttons})}document.addEventListener("pointermove",kh,{capture:!0});document.addEventListener("pointerdown",kh,{capture:!0});document.addEventListener("pointerup",kh,{capture:!0});document.addEventListener("pointercancel",kh,{capture:!0});document.addEventListener("click",kh,{capture:!0});function F_(n){if(n!==Ts&&n!==Cs)return!1;const e=((Hi==null?void 0:Hi.isConnected)===!0&&Hi!==Ts&&Hi!==Cs&&Hi.closest("#foreground-overlay")===null?Hi:null)??document.querySelector("#app");return e==null||e.focus({preventScroll:!0}),!0}document.addEventListener("focusin",n=>{const t=n.target;t instanceof HTMLElement&&(F_(t)||t.isConnected&&t.closest("#foreground-overlay")===null&&(Hi=t))},{capture:!0});window.addEventListener("blur",()=>{queueMicrotask(()=>F_(document.activeElement))},{capture:!0});function mv(){return bb+=1,`${Date.now()}-${bb}`}const vN=404,yN="/views/url-unsupported/",wN="allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-downloads",bN="clipboard-write; fullscreen; autoplay; picture-in-picture; web-share; encrypted-media",SN="tv-artifact:",_N="tv-url-artifact";function pd(n){const t=nu(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 Ab(n.currentURL)&&!n.electron?e=qr(n.currentURL)?{renderer:"proxy-iframe",viewURL:n.currentURL,contentURL:null}:{renderer:"proxy-iframe",viewURL:yN,contentURL:null}:Ab(n.currentURL)?e={renderer:"url-webview",viewURL:n.currentURL,contentURL:null}:e={renderer:n.electron?"url-webview":"proxy-iframe",viewURL:CN(n.currentURL,n.viewURL),contentURL:null};return n.frameSrcOverride?{...e,viewURL:n.frameSrcOverride}:e}var lt,an,ml,Io,$o,qn,xo,gl,Ut,vl,yl,gr,os,as,Po,te,Wg,q_,md,V_,B_,Gg,j_,vr,gd,zc,Jg,W_,Yg,Kg,Gs;class AN extends dn{constructor(){super(...arguments);m(this,te);m(this,lt,null);m(this,an,null);m(this,ml,"");m(this,Io,()=>{});m(this,$o,()=>{});m(this,qn,null);m(this,xo,null);m(this,gl,null);m(this,Ut,null);m(this,vl,null);m(this,yl,null);m(this,gr,null);m(this,os,null);m(this,as,null);m(this,Po,null);m(this,vr,()=>{!o(this,an)||o(this,an)!==o(this,qn)||o(this,Io).call(this,!0)})}get currentFrame(){return o(this,an)}connected(){h(this,te,gd).call(this),h(this,te,Jg).call(this)}disconnected(){h(this,te,zc).call(this),h(this,te,Gs).call(this)}template(e,r,i=()=>{}){return d(this,Io,r),d(this,$o,i),e(this),o(this,ml)}assignSource(e){const r=o(this,lt),i=r?!RN(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,Po,null),i&&(d(this,gr,null),o(this,Ut)&&(o(this,Ut).content=""),d(this,os,null),d(this,as,null)),d(this,lt,e),h(this,te,md).call(this)}handleArtifactContentChanged(e){const r=o(this,lt);return e!==(r==null?void 0:r.artifact.id)||!o(this,Ut)&&!h(this,te,Kg).call(this)?!1:(h(this,te,Yg).call(this),!0)}handleThemeChanged(){var r;const e=(r=o(this,lt))==null?void 0:r.artifact;return(e==null?void 0:e.kind)!=="path"||!ig(e.path)||o(this,Ut)===null?!1:(o(this,Ut).notifyStylesChanged(),!0)}refreshFrameLoadState(){h(this,te,gd).call(this)}assignFrameSrc(e){o(this,an)&&h(this,te,Wg).call(this,o(this,an),e)}}lt=new WeakMap,an=new WeakMap,ml=new WeakMap,Io=new WeakMap,$o=new WeakMap,qn=new WeakMap,xo=new WeakMap,gl=new WeakMap,Ut=new WeakMap,vl=new WeakMap,yl=new WeakMap,gr=new WeakMap,os=new WeakMap,as=new WeakMap,Po=new WeakMap,te=new WeakSet,Wg=function(e,r){e.tagName.toLowerCase()==="iframe"&&(!h(this,te,q_).call(this)&&TN(r)?e.setAttribute("sandbox",wN):e.removeAttribute("sandbox")),e.setAttribute("src",r)},q_=function(){const e=o(this,lt);return e!==null&&nu(e.artifact,{electron:e.electron,browserDemo:e.browserDemo??!1}).renderer==="url-direct"},md=function(){const e=o(this,lt);if(!e)return;if(e.artifact.kind==="path"&&h(this,te,Kg).call(this)){h(this,te,j_).call(this,e.artifact);return}const r=pd(e),i=h(this,te,V_).call(this,r.renderer,kN(e));h(this,te,B_).call(this,i,r),h(this,te,Gg).call(this,i),h(this,te,gd).call(this),h(this,te,Jg).call(this)},V_=function(e,r){const i=e==="url-webview"?"webview":"iframe",s=o(this,an);if((s==null?void 0:s.tagName.toLowerCase())===i&&(i!=="webview"||s.getAttribute("partition")===r))return s;h(this,te,zc).call(this),h(this,te,Gs).call(this);const a=document.createElement(i);return a.className="artifact-content",i==="webview"?(r!==null&&a.setAttribute("partition",r),a.setAttribute("allowpopups","")):a.setAttribute("allow",bN),d(this,an,a),a},B_=function(e,r){e.getAttribute("src")!==r.viewURL&&(o(this,$o).call(this,null),o(this,$o).call(this,e),h(this,te,Wg).call(this,e,r.viewURL)),r.contentURL===null?delete e.dataset.contentUrl:e.dataset.contentUrl=r.contentURL},Gg=function(e){o(this,ml)!==e&&(d(this,ml,e),this.render(e))},j_=function(e){o(this,$o).call(this,null),h(this,te,zc).call(this),h(this,te,Gs).call(this),d(this,an,null),o(this,Io).call(this,!1),h(this,te,Gg).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>${M4()}</h1>
|
|
284
|
+
<p>${N4()}</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>${z4()}</p>
|
|
290
|
+
</div>
|
|
291
|
+
</section>
|
|
292
|
+
`)},vr=new WeakMap,gd=function(){var s;const e=o(this,an),r=e?`${e.tagName.toLowerCase()}:${e.getAttribute("src")??""}:${e.dataset.contentUrl??""}`:null;if(e&&e===o(this,qn)&&r===o(this,xo)||(h(this,te,zc).call(this),o(this,Io).call(this,!1),!e||!r||!this.isConnected))return;if(d(this,qn,e),d(this,xo,r),e.tagName.toLowerCase()==="webview"){e.addEventListener("did-finish-load",o(this,vr)),e.addEventListener("did-fail-load",o(this,vr));return}e.addEventListener("load",o(this,vr));const i=e;try{i.isConnected&&((s=i.contentDocument)==null?void 0:s.readyState)==="complete"&&o(this,vr).call(this)}catch{}},zc=function(){if(!o(this,qn)){d(this,xo,null);return}o(this,qn).removeEventListener("load",o(this,vr)),o(this,qn).removeEventListener("did-finish-load",o(this,vr)),o(this,qn).removeEventListener("did-fail-load",o(this,vr)),d(this,qn,null),d(this,xo,null)},Jg=function(){const e=o(this,lt),r=o(this,an),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,te,Gs).call(this,{clearContent:!0});return}if(r!==o(this,gl)||s!==o(this,yl)){h(this,te,Gs).call(this),d(this,gl,r),d(this,vl,i),d(this,yl,s);const a=r.tagName.toLowerCase()==="webview"?new pO(r):new fO(r);d(this,Ut,a),a.handleUpdateContent(async l=>{const c=o(this,lt),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,gr,l),o(this,Ut)===a&&(a.content=l)}),o(this,gr)!==null&&(a.content=o(this,gr))}else d(this,vl,i);h(this,te,W_).call(this)},W_=function(){const e=o(this,lt),r=e==null?void 0:e.application;!e||!r||!o(this,Ut)||o(this,os)===e.artifact.id&&o(this,as)===r||(d(this,os,e.artifact.id),d(this,as,r),h(this,te,Yg).call(this))},Yg=async function(){var s,a;const e=o(this,lt),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,lt))==null?void 0:s.artifact.id)!==i||o(this,lt).application!==r)return;d(this,Po,null),d(this,gr,l);const c=o(this,Ut);if(!c){h(this,te,md).call(this);return}c.content=l}catch(l){if(((a=o(this,lt))==null?void 0:a.artifact.id)!==i||o(this,lt).application!==r)return;if(l instanceof Ql&&l.status===vN){d(this,Po,i),d(this,gr,null),h(this,te,Gs).call(this),h(this,te,md).call(this);return}d(this,os,null),d(this,as,null)}},Kg=function(){var r;const e=(r=o(this,lt))==null?void 0:r.artifact;return o(this,Po)===(e==null?void 0:e.id)&&e.kind==="path"&&ig(e.path)},Gs=function(e={}){var r;(r=o(this,Ut))==null||r.dispose(),d(this,Ut,null),d(this,gl,null),d(this,vl,null),d(this,yl,null),d(this,os,null),d(this,as,null),e.clearContent&&d(this,gr,null)};const EN=fn(AN);function kN(n){const t=globalThis.__televisionNativeBridge;return!n.electron||(t==null?void 0:t.artifactPartitions)!==1?null:n.artifact.kind==="path"?`${SN}${n.artifact.id}`:_N}function Ab(n){return n.startsWith("http://")||n.startsWith("https://")}function TN(n){try{return/^\/artifact\/[^/]+(\/|$)/.test(new URL(n,window.location.href).pathname)}catch{return!1}}function CN(n,t){if(!n.startsWith("/")||!t)return n;try{return new URL(n,t).toString()}catch{return n}}function RN(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,Vu,yr,ni,ls,ri,cs,Bu,ju,Pt,G_,Wu,Gu,Xg,vd,yd;class IN{constructor(t,e=()=>{},r=()=>{}){m(this,Pt);m(this,qu);m(this,wl);m(this,Vu);m(this,yr,null);m(this,ni,null);m(this,ls,null);m(this,ri,null);m(this,cs,!1);m(this,Bu,t=>{const e=Tb(t.data);if(!e)return;const r=o(this,ls);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&&DN(i)===t.origin;!c&&!u&&!f||h(this,Pt,Xg).call(this,e,i,{send:p=>{var y;return(y=i.contentWindow)==null?void 0:y.postMessage(p,"*")}})});m(this,ju,t=>{var s,a;const e=t.detail??t;if((e==null?void 0:e.channel)===$N){h(this,Pt,G_).call(this,(s=e.args)==null?void 0:s[0]);return}if(!e||e.channel!==Eb)return;const r=Tb((a=e.args)==null?void 0:a[0]),i=o(this,ri);!r||!i||h(this,Pt,Xg).call(this,r,i,{send:l=>{var c;return(c=i.send)==null?void 0:c.call(i,Eb,l)}})});m(this,Wu,t=>{const e=Cb(t);e.isMainFrame===!0&&e.isInPlace!==!0&&this.reset()});m(this,Gu,t=>{Cb(t).isMainFrame!==!1&&this.reset()});d(this,qu,t),d(this,wl,e),d(this,Vu,r)}get currentGuid(){return o(this,yr)}get lifecycleWindow(){return o(this,ni)}get trustState(){return{currentGuid:o(this,yr),lifecycleWindow:o(this,ni)}}connect(){o(this,cs)||(d(this,cs,!0),window.addEventListener("message",o(this,Bu)),h(this,Pt,vd).call(this))}disconnect(){o(this,cs)&&(window.removeEventListener("message",o(this,Bu)),d(this,cs,!1),h(this,Pt,yd).call(this))}reset(){d(this,yr,null),d(this,ni,null),o(this,wl).call(this)}setCurrentFrame(t){if(t===o(this,ls)){h(this,Pt,vd).call(this);return}h(this,Pt,yd).call(this),o(this,ls)!==null&&this.reset(),d(this,ls,PN(t)?t:null),h(this,Pt,vd).call(this)}}qu=new WeakMap,wl=new WeakMap,Vu=new WeakMap,yr=new WeakMap,ni=new WeakMap,ls=new WeakMap,ri=new WeakMap,cs=new WeakMap,Bu=new WeakMap,ju=new WeakMap,Pt=new WeakSet,G_=function(t){const e=o(this,ri);!e||typeof t!="string"||!xN(e)||o(this,Vu).call(this,t)},Wu=new WeakMap,Gu=new WeakMap,Xg=function(t,e,r){t.type==="bridge-ready"&&t.guid!==o(this,yr)?(o(this,yr)!==null&&o(this,wl).call(this),d(this,yr,t.guid),d(this,ni,e.tagName.toLowerCase()==="iframe"?e.contentWindow:null)):t.type==="leaving"&&t.guid===o(this,yr)&&this.reset(),o(this,qu).call(this,t,r)},vd=function(){if(!o(this,cs))return;const t=o(this,ls),e=(t==null?void 0:t.tagName.toLowerCase())==="webview"?t:null;e!==o(this,ri)&&(h(this,Pt,yd).call(this),e&&(e.addEventListener("ipc-message",o(this,ju)),e.addEventListener("did-start-navigation",o(this,Wu)),e.addEventListener("did-fail-load",o(this,Gu)),d(this,ri,e)))},yd=function(){const t=o(this,ri);t&&(t.removeEventListener("ipc-message",o(this,ju)),t.removeEventListener("did-start-navigation",o(this,Wu)),t.removeEventListener("did-fail-load",o(this,Gu)),d(this,ri,null))};const Eb="television-artifact-bridge",$N="television-application-link";function kb(n){return n.protocol==="http:"||n.protocol==="https:"}function xN(n){var e;const t=window.location;if(!kb(t))return!1;try{const r=new URL(((e=n.getURL)==null?void 0:e.call(n))??"");return kb(r)&&r.origin===t.origin}catch{return!1}}function Tb(n){return k4(n)||T4(n)||C4(n)||R4(n)||I4(n)||$4(n)||x4(n)||P4(n)?n:null}function PN(n){if(!n)return!1;const t=n.tagName.toLowerCase();return t==="iframe"||t==="webview"}function DN(n){if(n.hasAttribute("sandbox"))return"null";try{return new URL(n.getAttribute("src")??n.src,window.location.href).origin}catch{return null}}function Cb(n){return n.detail??n}const ON="/views/url-unsupported/";class LN extends dn{constructor(){super(...arguments);R(this,"_artifact",null);R(this,"_viewURL",null);R(this,"_contentURL",null);R(this,"_application",null);R(this,"_fullScreen",!1);R(this,"_inert",!1);R(this,"_onFullScreenChange",()=>{});R(this,"_connected",!1);R(this,"_deleteConfirmationOpen",!1);R(this,"_dialogPresentation",null);R(this,"_subscribedWebview",null);R(this,"_documentHost",null);R(this,"_pendingDocumentSource",null);R(this,"_rootRef",Jn());R(this,"_trustedChannel",new IN((e,r)=>{this.handleTrustedFrameMessage(e,r)},()=>{this._missingArtifactReplyTransport=null},e=>zN(e)));R(this,"_activeReloadFrameSrc",null);R(this,"_applicationSubscriptionsAttached",!1);R(this,"_proxyReloadVersion",0);R(this,"_navigationState",null);R(this,"_navigationArtifactId",null);R(this,"_navigationCanonicalURL",null);R(this,"_preserveFrameSrcOnNavigationRender",!1);R(this,"_missingArtifactReplyTransport",null);R(this,"handleNavigationChange",()=>{const e=this._preserveFrameSrcOnNavigationRender,r=!e;r&&!bi()?(this.renderArtifact({preserveFrameSrc:!0}),this.forceCurrentFrameSrc()):this.renderArtifact({preserveFrameSrc:e,resetTrust:r}),this._preserveFrameSrcOnNavigationRender=!1});R(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()});R(this,"handleThemeChanged",()=>{var e,r;((e=this._artifact)==null?void 0:e.kind)==="url"&&qr(this._artifact.url)||this.isDemoPage()||(r=this._documentHost)!=null&&r.handleThemeChanged()||this.reloadProxyFrame()});R(this,"handleWebviewDidNavigate",e=>{this.handleWebviewNavigationEvent(e)});R(this,"handleWebviewDidNavigateInPage",e=>{if(e.isMainFrame===!1)return;this._preserveFrameSrcOnNavigationRender=!0,this.handleWebviewNavigationEvent(e)||(this._preserveFrameSrcOnNavigationRender=!1)});R(this,"captureDocumentHost",e=>{this._documentHost=e,this._pendingDocumentSource&&(e.assignSource(this._pendingDocumentSource),this.syncFrameSubscriptions())});R(this,"handleEmbedLoadChange",e=>{var r;(r=this._rootRef.value)==null||r.toggleAttribute("data-embed-loaded",e)});R(this,"handleDocumentFrameChange",e=>{e===null&&this.resetTrustedFrame(),this.syncFrameTitle(e),this._trustedChannel.setCurrentFrame(this.bridgeFrame(e)),this.syncWebviewSubscription(e)});R(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?!HN(c,s):!0;if(f&&(this._activeReloadFrameSrc=null),this._artifact=s,this.syncNavigationState(),this._connected){if(this.renderArtifact({resetTrust:f}),l=!0,c&&ZN(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:D4,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();U_({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&&NN(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:O4,title:e.title,path:e.path}}handleProxyContentChanged(){var e;((e=this._artifact)==null?void 0:e.kind)!=="url"||!qr(this._artifact.url)||this.reloadProxyFrame()}handleNavigationRequest(e){if(!F2(e.url,window.location.href))return;this.syncNavigationState();const r=this._navigationState;if(!r)return;const i=this.convertIframeNavigationURL(e.url);if(i===ON||i===r.currentURL)return;const s=e.native===!0;(e.sameDocument||s)&&(this._preserveFrameSrcOnNavigationRender=!0),e.replace?r.replace(i):r.navigate(i),this._preserveFrameSrcOnNavigationRender=!1}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=pd({artifact:e,application:this._application,electron:bi(),browserDemo:this.browserDemo,viewURL:this._viewURL,contentURL:this._contentURL,currentURL:null}),i=r.viewURL;return e.kind==="url"&&qr(e.url)||r.renderer==="url-webview"?Si(i):Rb(i,i)}convertIframeNavigationURL(e){var r;return((r=this._artifact)==null?void 0:r.kind)==="url"&&qr(this._artifact.url)&&qr(e)?Si(e):Rb(e,this._viewURL??this._navigationCanonicalURL??null)}handleWebviewNavigationEvent(e){const r=e.url;if(typeof r!="string"||!F2(r,window.location.href))return!1;this.syncNavigationState();const i=this._navigationState;if(!i)return!1;const s=Si(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?nu(e,{electron:bi(),browserDemo:this.browserDemo}).renderer==="url-direct":!1}returnToOriginalPage(){var i,s,a;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"),(s=this._documentHost)==null||s.assignFrameSrc(e.url),(a=this._documentHost)==null||a.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:bi(),browserDemo:this.browserDemo,viewURL:this._viewURL,contentURL:this._contentURL,currentURL:((f=this._navigationState)==null?void 0:f.currentURL)??null},s=pd(i),a=(p=this.currentFrame)==null?void 0:p.getAttribute("src");let l=null;this._activeReloadFrameSrc&&(J_(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"&&qr(this._artifact.url)))return;const r=((c=this._artifact)==null?void 0:c.kind)==="url"&&qr(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(Vl,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,c;if(!this._artifact)return;const e=pd({artifact:this._artifact,application:this._application,electron:bi(),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;(r==null?void 0:r.tagName.toLowerCase())==="iframe"&&r&&(this.resetTrustedFrame(),this._activeReloadFrameSrc=null,(a=this._rootRef.value)==null||a.removeAttribute("data-embed-loaded"),(l=this._documentHost)==null||l.assignFrameSrc(e.viewURL),(c=this._documentHost)==null||c.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
|
+
${EN(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 MN=fn(LN);function NN(n){return n.startsWith("http://")||n.startsWith("https://")}function zN(n){var e;const t=globalThis.__televisionNativeBridge;(e=t==null?void 0:t.openApplicationLink)==null||e.call(t,n)}function HN(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"?J_(n.url,t.url):!0}function ZN(n,t){return n.kind==="path"&&t.kind==="path"&&n.id===t.id&&(n.title!==t.title||n.path!==t.path)}function J_(n,t){try{const e=new URL(n,window.location.href),r=new URL(t,window.location.href);return e.searchParams.delete(Vl),r.searchParams.delete(Vl),e.origin===r.origin&&e.pathname===r.pathname&&e.search===r.search}catch{return!1}}function Rb(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(Vl),`${e.pathname}${e.search}${e.hash}`}}catch{return Si(n)}return Si(n)}function Y_(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 Qg(n,t,e,r){Y_(n,t,e,e.size,r)}function gv(n){return{width:1-gb+gb*n.width/YM,height:1-vb+vb*n.height/KM}}function K_(n){return{width:Math.min(iN,n.width),height:Math.min(sN,n.height)}}function Ib(n,t){const e=gv(t),r=K_(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 UN(n,t){const e=gv(t);return{width:n.width/e.width,height:n.height/e.height}}const $b=.5,Bh=2,FN=120,qN=["left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"];var Do,wr,bl,ii,Sl,Oo,us,hs,ds,si,Lo,Mo,br,_l,oi,Sr,Tt,ai,_r,J,X_,Q_,Hc,eA,Zc,e1,wd,tA,Ju,Yu,Ku,Xu,No,Qu,t1,Mn,n1,xa,nA,rA,Uc;class VN extends dn{constructor(){super(...arguments);m(this,J);m(this,Do,Jn());m(this,wr,Jn());m(this,bl);m(this,ii);m(this,Sl);m(this,Oo);m(this,us);m(this,hs,0);m(this,ds,0);m(this,si,null);m(this,Lo,null);m(this,Mo,null);m(this,br,null);m(this,_l,[]);m(this,oi,null);m(this,Sr,null);m(this,Tt,null);m(this,ai,new Set);m(this,_r,!1);m(this,Ju,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,t1).call(this,r))});m(this,Yu,e=>{var r;e.pointerId===((r=o(this,Tt))==null?void 0:r.pointerId)&&h(this,J,Mn).call(this,!0)});m(this,Ku,e=>{var r;e.pointerId===((r=o(this,Tt))==null?void 0:r.pointerId)&&h(this,J,Mn).call(this,!1)});m(this,Xu,e=>{var r;e.pointerId===((r=o(this,Tt))==null?void 0:r.pointerId)&&h(this,J,Mn).call(this,!1)});m(this,No,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,t1).call(this,r))}});m(this,Qu,()=>{const e=o(this,Tt);!e||xb(h(this,J,Hc).call(this,e.filmstrip),e.pageBox)||(h(this,J,e1).call(this),h(this,J,Mn).call(this,!1))})}connected(){d(this,bl,void 0),d(this,ii,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,_r)&&s;if(d(this,_r,s),a){h(this,J,Mn).call(this,!1),h(this,J,Uc).call(this);for(const V of o(this,ai))V.cancel();o(this,ai).clear()}const l=(i==null?void 0:i.channelId)===(r==null?void 0:r.id)?i:null,c=jN(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:V,page:ie})=>`${V}:${ie.geometry.full_screen}:${ie.size.width}:${ie.size.height}`).sort().join("|"),_=l===null?null:c.map(({key:V})=>V).join("|"),$=f!==o(this,bl),Z=p!==o(this,ii),O=y!==o(this,Sl),z=S!==o(this,Oo),P=_!==o(this,us),F=!o(this,_r)&&l!==null&&o(this,us)!==void 0&&o(this,us)!==null&&P?h(this,J,nA).call(this):null,q=!o(this,_r)&&Z&&!$&&o(this,ii)!==void 0&&o(this,ii)!==null&&p!==null;return o(this,Tt)&&($||Z||O)&&h(this,J,Mn).call(this,!1),d(this,bl,f),d(this,ii,p),d(this,Sl,y),d(this,Oo,S),d(this,us,_),d(this,_l,c),z&&v&&h(this,J,wd).call(this),$&&((Q=o(this,br))==null||Q.disconnect(),d(this,Lo,null),d(this,Mo,null),d(this,oi,null)),queueMicrotask(()=>h(this,J,Zc).call(this)),$||Z||z||a?queueMicrotask(()=>h(this,J,X_).call(this,p,q)):P&&queueMicrotask(()=>{const V=o(this,wr).value;V&&(h(this,J,xa).call(this,V,p,!1),F&&h(this,J,rA).call(this,F))}),W`
|
|
368
|
+
<section
|
|
369
|
+
class="stage"
|
|
370
|
+
${vt(o(this,Do))}
|
|
371
|
+
style=${`--handle-band: ${XM}px; --handle-reach: ${QM}px; --handle-thickness: ${eN}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],V=>V,()=>W`
|
|
380
|
+
<div class="filmstrip" ${vt(o(this,wr))}>
|
|
381
|
+
<div class="filmstrip-inner">
|
|
382
|
+
${Nd(c,({key:V})=>V,({page:V,artifact:ie,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=${V.geometry.full_screen}
|
|
388
|
+
style=${h(this,J,eA).call(this,V)}
|
|
389
|
+
@click=${xe||ie===null?null:()=>e.selectPage(r.id,ie.id)}
|
|
390
|
+
>
|
|
391
|
+
${ie?MN(e,ie,{viewURL:e.getArtifactViewURL(ie),contentURL:e.getArtifactContentURL(ie),fullScreen:V.geometry.full_screen,inert:!xe,onFullScreenChange:et=>Qg(e,r,V,et)}):null}
|
|
392
|
+
${xe?W`
|
|
393
|
+
<div class="page-handles" aria-hidden="true">
|
|
394
|
+
${qN.map(et=>W`
|
|
395
|
+
<span
|
|
396
|
+
class="page-handle ${et}"
|
|
397
|
+
@pointerdown=${le=>h(this,J,tA).call(this,le,et,e,r,V,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,wd).call(this),h(this,J,Uc).call(this),cancelAnimationFrame(o(this,hs)),d(this,hs,0),(e=o(this,br))==null||e.disconnect(),d(this,br,null),d(this,Lo,null),d(this,Mo,null),d(this,oi,null),d(this,_l,[]);for(const r of o(this,ai))r.cancel();o(this,ai).clear()}}Do=new WeakMap,wr=new WeakMap,bl=new WeakMap,ii=new WeakMap,Sl=new WeakMap,Oo=new WeakMap,us=new WeakMap,hs=new WeakMap,ds=new WeakMap,si=new WeakMap,Lo=new WeakMap,Mo=new WeakMap,br=new WeakMap,_l=new WeakMap,oi=new WeakMap,Sr=new WeakMap,Tt=new WeakMap,ai=new WeakMap,_r=new WeakMap,J=new WeakSet,X_=function(e,r){const i=o(this,wr).value;i&&(cancelAnimationFrame(o(this,hs)),d(this,hs,requestAnimationFrame(()=>{d(this,hs,0),h(this,J,xa).call(this,i,e,r)})))},Q_=function(e,r){var i;typeof ResizeObserver>"u"||e===o(this,Lo)&&r===o(this,Mo)||((i=o(this,br))==null||i.disconnect(),d(this,Lo,e),d(this,Mo,r),d(this,br,new ResizeObserver(()=>{const s=h(this,J,Hc).call(this,e);xb(s,o(this,oi))||(h(this,J,e1).call(this),o(this,Tt)&&h(this,J,Mn).call(this,!1),h(this,J,Zc).call(this,e)),o(this,si)===null&&h(this,J,xa).call(this,e,o(this,ii)??null,!1)})),o(this,br).observe(e),o(this,br).observe(r))},Hc=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)}},eA=function(e){if(e.geometry.full_screen||o(this,oi)===null)return"";const r=Ib(e.size,o(this,oi));return`width: ${r.width}px; height: ${r.height}px;`},Zc=function(e=o(this,wr).value){var s;if(!e)return;const r=h(this,J,Hc).call(this,e);d(this,oi,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`}},e1=function(){const e=o(this,Do).value;e&&(e.setAttribute("window-tracking",""),o(this,Sr)!==null&&clearTimeout(o(this,Sr)),d(this,Sr,setTimeout(()=>{d(this,Sr,null),e.removeAttribute("window-tracking")},FN)))},wd=function(){var e;o(this,Sr)!==null&&(clearTimeout(o(this,Sr)),d(this,Sr,null)),(e=o(this,Do).value)==null||e.removeAttribute("window-tracking")},tA=function(e,r,i,s,a,l){if(o(this,_r)||e.button!==0||!e.isPrimary)return;const c=e.currentTarget,u=c.closest(".page"),f=o(this,wr).value,p=o(this,Do).value;if(!u||!f||!p)return;h(this,J,Mn).call(this,!1),h(this,J,wd).call(this),e.preventDefault(),e.stopPropagation();const y=u.getBoundingClientRect(),v=h(this,J,Hc).call(this,f),S=gv(v),_=a.geometry.full_screen,$=r.includes("left")||r.includes("right"),Z=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:Z,leftish:r.includes("left"),topish:r.includes("top"),option:e.altKey,armed:!1,leftFullScreen:!1}),p.setAttribute("resizing",""),c.addEventListener("pointermove",o(this,Ju)),c.addEventListener("pointerup",o(this,Yu)),c.addEventListener("pointercancel",o(this,Ku)),c.addEventListener("lostpointercapture",o(this,Xu)),window.addEventListener("keydown",o(this,No)),window.addEventListener("keyup",o(this,No)),window.addEventListener("resize",o(this,Qu)),c.setPointerCapture(e.pointerId)},Ju=new WeakMap,Yu=new WeakMap,Ku=new WeakMap,Xu=new WeakMap,No=new WeakMap,Qu=new WeakMap,t1=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=K_(e.pageBox);let s=e.startRendered.width,a=e.startRendered.height;if(e.horizontal){const l=e.leftish?-Bh:Bh;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?-Bh:Bh;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-wb&&a>=e.pageBox.height-wb,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,n1).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,Ju)),r.handle.removeEventListener("pointerup",o(this,Yu)),r.handle.removeEventListener("pointercancel",o(this,Ku)),r.handle.removeEventListener("lostpointercapture",o(this,Xu)),window.removeEventListener("keydown",o(this,No)),window.removeEventListener("keyup",o(this,No)),window.removeEventListener("resize",o(this,Qu)),r.handle.hasPointerCapture(r.pointerId)&&r.handle.releasePointerCapture(r.pointerId),h(this,J,n1).call(this,r.stage,!1),e&&r.armed)r.wasFullScreen&&r.pageElement.setAttribute("full-screen",""),Qg(r.application,r.channel,r.page,!0);else if(e){const i={...r.baselineSize},s=UN(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?Y_(r.application,r.channel,r.page,i,!1):h(this,J,Zc).call(this,r.filmstrip)}else r.pageElement.toggleAttribute("full-screen",r.wasFullScreen),h(this,J,Zc).call(this,r.filmstrip);r.pageElement.getBoundingClientRect(),r.stage.removeAttribute("resizing"),h(this,J,xa).call(this,r.filmstrip,r.pageKey,!1)}},n1=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,Uc).call(this);return}h(this,J,Q_).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,Uc).call(this),o(this,_r)||!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,si,f);const p=()=>{var v;if(f!==o(this,si))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,si,null),d(this,ds,0)):d(this,ds,requestAnimationFrame(p))};d(this,ds,requestAnimationFrame(p))},nA=function(){const e=o(this,wr).value;return e?new Map([...e.querySelectorAll(".page")].map(r=>[r.dataset.pageKey??"",r.getBoundingClientRect().left])):new Map},rA=function(e){if(o(this,_r))return;const r=o(this,wr).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,ai).add(l),l.finished.finally(()=>{o(this,ai).delete(l)}).catch(()=>{})}},Uc=function(){var e;cancelAnimationFrame(o(this,ds)),d(this,ds,0),(e=o(this,si))==null||e.cancel(),d(this,si,null)};const BN=fn(VN);function jN(n,t){if(!n||!t)return[];const e=new Map(n.artifacts.map(r=>[r.id,r]));return t.map((r,i)=>{const s=r.artifactIds[0];return{page:r,artifact:s===void 0?null:e.get(s)??null,key:s??`empty-page-${i}`}})}function xb(n,t){return t!==null&&n.width===t.width&&n.height===t.height}const WN=250,GN=1e3;var fs,ps,zo,ms,Gt,iA,r1,sA,i1,oA;class JN extends dn{constructor(){super(...arguments);m(this,Gt);m(this,fs,KN());m(this,ps,null);m(this,zo,!1);m(this,ms,null)}disconnected(){var e;h(this,Gt,i1).call(this),(e=o(this,ps))==null||e.withdraw(),d(this,ps,null),d(this,zo,!1),Ag(null,o(this,fs))}template(e,r){return h(this,Gt,sA).call(this,e),Ag(ep(h(this,Gt,iA).call(this,e,r),aA(r.dragStrip)),o(this,fs)),h(this,Gt,oA).call(this),o(this,fs)}}fs=new WeakMap,ps=new WeakMap,zo=new WeakMap,ms=new WeakMap,Gt=new WeakSet,iA=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,Gt,r1).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,Gt,r1).call(this,r)}
|
|
432
|
+
</div>
|
|
433
|
+
`}},r1=function(e){return e.context==="local"?W`<button intent="danger" class="system-modal-disconnect" @click=${e.onDisconnect}>Disconnect from Server</button>`:null},sA=function(e){const r=(e.kind==="disconnected"||e.kind==="error")&&e.nextRetryAt!==null;r&&o(this,ms)===null?d(this,ms,setInterval(()=>this.render(),WN)):r||h(this,Gt,i1).call(this)},i1=function(){o(this,ms)!==null&&(clearInterval(o(this,ms)),d(this,ms,null))},oA=function(){o(this,ps)!==null||o(this,zo)||(d(this,zo,!0),queueMicrotask(()=>{if(d(this,zo,!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 YN=fn(JN);function KN(){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/GN)}s…`}function aA(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 s1 extends Eh{constructor(t){if(super(t),this.it=he,t.type!==Rr.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===he||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:[]}}}s1.directiveName="unsafeHTML",s1.resultType=1;const lA=rc(s1);/*! @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 XN(n){if(Array.isArray(n))return n}function QN(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 e9(){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 t9(n,t){return XN(n)||QN(n,t)||n9(n,t)||e9()}function n9(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 cA=Object.entries,Ob=Object.setPrototypeOf,r9=Object.isFrozen,i9=Object.getPrototypeOf,s9=Object.getOwnPropertyDescriptor;let ot=Object.freeze,ut=Object.seal,Pa=Object.create,uA=typeof Reflect<"u"&&Reflect,o1=uA.apply,a1=uA.construct;ot||(ot=function(t){return t});ut||(ut=function(t){return t});o1||(o1=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)});a1||(a1=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 Js=Qe(Array.prototype.forEach),o9=Qe(Array.prototype.lastIndexOf),Lb=Qe(Array.prototype.pop),bc=Qe(Array.prototype.push),a9=Qe(Array.prototype.splice),Ua=Array.isArray,Fc=Qe(String.prototype.toLowerCase),Nm=Qe(String.prototype.toString),Mb=Qe(String.prototype.match),Sc=Qe(String.prototype.replace),Nb=Qe(String.prototype.indexOf),l9=Qe(String.prototype.trim),c9=Qe(Number.prototype.toString),u9=Qe(Boolean.prototype.toString),zb=typeof BigInt>"u"?null:Qe(BigInt.prototype.toString),Hb=typeof Symbol>"u"?null:Qe(Symbol.prototype.toString),Bt=Qe(Object.prototype.hasOwnProperty),_c=Qe(Object.prototype.toString),pt=Qe(RegExp.prototype.test),Mi=h9(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 o1(n,t,r)}}function h9(n){return function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return a1(n,e)}}function ve(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Fc;if(Ob&&Ob(n,null),!Ua(t))return n;let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const s=e(i);s!==i&&(r9(t)||(t[r]=s),i=s)}n[i]=!0}return n}function d9(n){for(let t=0;t<n.length;t++)Bt(n,t)||(n[t]=null);return n}function Qt(n){const t=Pa(null);for(const r of cA(n)){var e=t9(r,2);const i=e[0],s=e[1];Bt(n,i)&&(Ua(s)?t[i]=d9(s):s&&typeof s=="object"&&s.constructor===Object?t[i]=Qt(s):t[i]=s)}return t}function f9(n){switch(typeof n){case"string":return n;case"number":return c9(n);case"boolean":return u9(n);case"bigint":return zb?zb(n):"0";case"symbol":return Hb?Hb(n):"Symbol()";case"undefined":return _c(n);case"function":case"object":{if(n===null)return _c(n);const t=n,e=vn(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 vn(n,t){for(;n!==null;){const r=s9(n,t);if(r){if(r.get)return Qe(r.get);if(typeof r.value=="function")return Qe(r.value)}n=i9(n)}function e(){return null}return e}function p9(n){try{return pt(n,""),!0}catch{return!1}}const Zb=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"]),Hm=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"]),m9=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"]),Zm=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"]),g9=ot(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ub=ot(["#text"]),Fb=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"]),Um=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"]),qb=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"]),jh=ot(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),v9=ut(/{{[\w\W]*|^[\w\W]*}}/g),y9=ut(/<%[\w\W]*|^[\w\W]*%>/g),w9=ut(/\${[\w\W]*/g),b9=ut(/^data-[\-\w.\u00B7-\uFFFF]+$/),S9=ut(/^aria-[\-\w]+$/),Vb=ut(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_9=ut(/^(?:\w+script|data):/i),A9=ut(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),E9=ut(/^html$/i),k9=ut(/^[a-z][.\w]*(-[.\w]+)+$/i),Bb=ut(/<[/\w!]/g),jb=ut(/<[/\w]/g),T9=ut(/<\/no(script|embed|frames)/i),C9=ut(/\/>/i),Xt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},hA=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],R9=ot(ve({},hA)),I9=(function(){const n={};return Js(hA,t=>{n[t]=ut(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),ot(n)})(),$9=function(){return typeof window>"u"?null:window},x9=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:[]}},Ni=function(t,e,r,i){return Bt(t,e)&&Ua(t[e])?ve(i.base?Qt(i.base):{},t[e],i.transform):r},Fm=function(t,e,r){const i=Bt(t,e)?t[e]:void 0;return i&&typeof i=="object"?Qt(i):r()};function dA(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$9();const t=N=>dA(N);if(t.version="3.4.16",t.removed=[],!n||!n.document||n.document.nodeType!==Xt.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=vn(p,"cloneNode"),v=vn(p,"remove"),S=vn(p,"removeAttributeNode"),_=vn(p,"nextSibling"),$=vn(p,"childNodes"),Z=vn(p,"parentNode"),O=vn(p,"shadowRoot"),z=vn(p,"attributes"),P=a&&a.prototype?vn(a.prototype,"nodeType"):null,B=a&&a.prototype?vn(a.prototype,"nodeName"):null,F=a&&a.prototype?vn(a.prototype,"ownerDocument"):null,q=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 V,ie="",Ne,xe=!1,et=0;const le=function(){if(et>0)throw Mi('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 V.createHTML(w)}finally{et--}},Ot=function(w){le(),et++;try{return V.createScriptURL(w)}finally{et--}},Pn=function(){return xe||(Ne=x9(f,i),xe=!0),Ne},ht=e,wt=ht.implementation,Ls=ht.createNodeIterator,ca=ht.createDocumentFragment,Ms=ht.getElementsByTagName,Ii=r.importNode;let Ee=Wb();t.isSupported=typeof cA=="function"&&typeof Z=="function"&&wt&&wt.createHTMLDocument!==void 0;const sc=v9,Dn=y9,Ns=w9,oc=b9,bt=S9,Re=_9,Be=A9,Pe=k9;let Ge=Vb,ce=null;const pn=ve({},[...Zb,...zm,...Hm,...Zm,...Ub]);let oe=null;const at=ve({},[...Fb,...Um,...qb,...jh]);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}})),mn=null,On=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,Xn=!0,Pr=!1,Ch=!0,Qn=!1,er=!0,Dr=!1,Or=!1,$i=null,zs=null,ac=!1,xi=!1,Pi=!1,Lr=!1,k=!0,C=!1;const pe="user-content-";let Se=!0,ke=!1,ne={},St=null;const tr=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 Ln=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",Yt="http://www.w3.org/1999/xhtml";let Nr=Yt,zr=!1,Zs=null;const ha=ve({},[ft,Hs,Yt],Nm),da=ot(["mi","mo","mn","ms","mtext"]);let Us=ve({},da);const lc=ot(["annotation-xml"]);let fa=ve({},lc);const cc=ve({},["title","style","font","a","script"]);let Di=null;const uc=["application/xhtml+xml","text/html"],Rh="text/html";let He=null,nr=null;const Oi=e.createElement("form"),Fs=function(w){return w instanceof RegExp||w instanceof Function},hc=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(nr&&nr===w)return;(!w||typeof w!="object")&&(w={}),w=Qt(w),Di=uc.indexOf(w.PARSER_MEDIA_TYPE)===-1?Rh:w.PARSER_MEDIA_TYPE,He=Di==="application/xhtml+xml"?Nm:Fc,ce=Ni(w,"ALLOWED_TAGS",pn,{transform:He}),oe=Ni(w,"ALLOWED_ATTR",at,{transform:He}),Zs=Ni(w,"ALLOWED_NAMESPACES",ha,{transform:Nm}),ua=Ni(w,"ADD_URI_SAFE_ATTR",Mr,{transform:He,base:Mr}),dt=Ni(w,"ADD_DATA_URI_TAGS",Ln,{transform:He,base:Ln}),St=Ni(w,"FORBID_CONTENTS",tr,{transform:He}),mn=Ni(w,"FORBID_TAGS",Qt({}),{transform:He}),On=Ni(w,"FORBID_ATTR",Qt({}),{transform:He}),ne=Bt(w,"USE_PROFILES")?w.USE_PROFILES&&typeof w.USE_PROFILES=="object"?Qt(w.USE_PROFILES):w.USE_PROFILES:!1,xr=w.ALLOW_ARIA_ATTR!==!1,Xn=w.ALLOW_DATA_ATTR!==!1,Pr=w.ALLOW_UNKNOWN_PROTOCOLS||!1,Ch=w.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Qn=w.SAFE_FOR_TEMPLATES||!1,er=w.SAFE_FOR_XML!==!1,Dr=w.WHOLE_DOCUMENT||!1,xi=w.RETURN_DOM||!1,Pi=w.RETURN_DOM_FRAGMENT||!1,Lr=w.RETURN_TRUSTED_TYPE||!1,ac=w.FORCE_BODY||!1,k=w.SANITIZE_DOM!==!1,C=w.SANITIZE_NAMED_PROPS||!1,Se=w.KEEP_CONTENT!==!1,ke=w.IN_PLACE||!1,Ge=p9(w.ALLOWED_URI_REGEXP)?w.ALLOWED_URI_REGEXP:Vb,Nr=typeof w.NAMESPACE=="string"?w.NAMESPACE:Yt,Us=Fm(w,"MATHML_TEXT_INTEGRATION_POINTS",()=>ve({},da)),fa=Fm(w,"HTML_INTEGRATION_POINTS",()=>ve({},lc));const A=Fm(w,"CUSTOM_ELEMENT_HANDLING",()=>Pa(null));if(ze=Pa(null),Bt(A,"tagNameCheck")&&Fs(A.tagNameCheck)&&(ze.tagNameCheck=A.tagNameCheck),Bt(A,"attributeNameCheck")&&Fs(A.attributeNameCheck)&&(ze.attributeNameCheck=A.attributeNameCheck),Bt(A,"allowCustomizedBuiltInElements")&&typeof A.allowCustomizedBuiltInElements=="boolean"&&(ze.allowCustomizedBuiltInElements=A.allowCustomizedBuiltInElements),ut(ze),Qn&&(Xn=!1),Pi&&(xi=!0),ne&&(ce=ve({},Ub),oe=Pa(null),ne.html===!0&&(ve(ce,Zb),ve(oe,Fb)),ne.svg===!0&&(ve(ce,zm),ve(oe,Um),ve(oe,jh)),ne.svgFilters===!0&&(ve(ce,Hm),ve(oe,Um),ve(oe,jh)),ne.mathMl===!0&&(ve(ce,Zm),ve(oe,qb),ve(oe,jh))),Je.tagCheck=null,Je.attributeCheck=null,Bt(w,"ADD_TAGS")&&(typeof w.ADD_TAGS=="function"?Je.tagCheck=w.ADD_TAGS:Ua(w.ADD_TAGS)&&(ce===pn&&(ce=Qt(ce)),ve(ce,w.ADD_TAGS,He))),Bt(w,"ADD_ATTR")&&(typeof w.ADD_ATTR=="function"?Je.attributeCheck=w.ADD_ATTR:Ua(w.ADD_ATTR)&&(oe===at&&(oe=Qt(oe)),ve(oe,w.ADD_ATTR,He))),Bt(w,"ADD_FORBID_CONTENTS")&&Ua(w.ADD_FORBID_CONTENTS)&&(St===tr&&(St=Qt(St)),ve(St,w.ADD_FORBID_CONTENTS,He)),Se&&(ce["#text"]=!0),Dr&&ve(ce,["html","head","body"]),ce.table&&(ve(ce,["tbody"]),delete mn.tbody),w.TRUSTED_TYPES_POLICY){if(typeof w.TRUSTED_TYPES_POLICY.createHTML!="function")throw Mi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof w.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Mi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const M=V;V=w.TRUSTED_TYPES_POLICY;try{ie=We("")}catch(H){throw V=M,H}}else w.TRUSTED_TYPES_POLICY===null?(V=void 0,ie=""):(V===void 0&&(V=Pn()),V&&typeof ie=="string"&&(ie=We("")));ot&&ot(w),nr=w},dc=ve({},[...zm,...Hm,...m9]),Iv=ve({},[...Zm,...g9]),d4=function(w,A,M){return A.namespaceURI===Yt?w==="svg":A.namespaceURI===ft?w==="svg"&&(M==="annotation-xml"||Us[M]):!!dc[w]},f4=function(w,A,M){return A.namespaceURI===Yt?w==="math":A.namespaceURI===Hs?w==="math"&&fa[M]:!!Iv[w]},p4=function(w,A,M){return A.namespaceURI===Hs&&!fa[M]||A.namespaceURI===ft&&!Us[M]?!1:!Iv[w]&&(cc[w]||!dc[w])},m4=function(w){let A=Z(w);(!A||!A.tagName)&&(A={namespaceURI:Nr,tagName:"template"});const M=Fc(w.tagName),H=Fc(A.tagName);return Zs[w.namespaceURI]?w.namespaceURI===Hs?d4(M,A,H):w.namespaceURI===ft?f4(M,A,H):w.namespaceURI===Yt?p4(M,A,H):!!(Di==="application/xhtml+xml"&&Zs[w.namespaceURI]):!1},Li=function(w){bc(t.removed,{element:w});try{Z(w).removeChild(w)}catch{if(v(w),!Z(w))throw Mi("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},$v=function(w,A,M){try{S(w,A)}catch{try{w.removeAttribute(M)}catch{}}},Ih=function(w){$h(w);const A=$(w);if(A){const H=[];Js(A,X=>{bc(H,X)}),Js(H,X=>{try{v(X)}catch{}})}const M=z(w);if(M)for(let H=M.length-1;H>=0;--H){const X=M[H],ue=X&&X.name;typeof ue=="string"&&$v(w,X,ue)}},qs=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(xi||Pi)try{Li(A)}catch{}else try{A.setAttribute(w,"")}catch{}},g4=function(w){const A=z(w);if(A)for(let M=A.length-1;M>=0;--M){const H=A[M],X=H&&H.name;typeof X!="string"||oe[He(X)]||$v(w,H,X)}},$h=function(w){const A=[w];for(;A.length>0;){const M=A.pop();q(M)===Xt.element&&g4(M);const H=$(M);if(H)for(let X=H.length-1;X>=0;--X)A.push(H[X])}},xv=function(w,A){return er?w==="patchsrc"?!0:w==="for"&&A!=="label"&&A!=="output":!1},v4=function(w){if(!er)return;const A=[w];for(;A.length>0;){const M=A.pop(),H=q(M);if(H===Xt.processingInstruction||H===Xt.comment&&pt(jb,M.data)){try{v(M)}catch{}continue}if(H===Xt.element){const ue=M,me=He(Q(M));try{ue.hasAttribute&&ue.hasAttribute("patchsrc")&&ue.removeAttribute("patchsrc"),ue.hasAttribute&&ue.hasAttribute("for")&&xv("for",me)&&ue.removeAttribute("for")}catch{}}const X=$(M);if(X)for(let ue=X.length-1;ue>=0;--ue)A.push(X[ue])}},Pv=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]}Di==="application/xhtml+xml"&&Nr===Yt&&(w='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+w+"</body></html>");const H=V?We(w):w;if(Nr===Yt)try{A=new u().parseFromString(H,Di)}catch{}if(!A||!A.documentElement){A=wt.createDocument(Nr,"template",null);try{A.documentElement.innerHTML=zr?ie:H}catch{}}const X=A.body||A.documentElement;return w&&M&&X.insertBefore(e.createTextNode(M),X.childNodes[0]||null),Nr===Yt?Ms.call(A,Dr?"html":"body")[0]:Dr?A.documentElement:X},Dv=function(w){const A=F?F(w):w.ownerDocument;return Ls.call(A||w,w,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},xh=function(w){return w=Sc(w,sc," "),w=Sc(w,Dn," "),w=Sc(w,Ns," "),w},sp=function(w){var A;w.normalize();const M=F?F(w):w.ownerDocument,H=Ls.call(M||w,w,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let X=H.nextNode();for(;X;)X.data=xh(X.data),X=H.nextNode();const ue=(A=w.querySelectorAll)===null||A===void 0?void 0:A.call(w,"template");ue&&Js(ue,me=>{pa(me.content)&&sp(me.content)})},Ph=function(w){const A=B?B(w):null;return typeof A!="string"||He(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)===Xt.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 rr(N,w,A){N.length!==0&&Js(N,M=>{M.call(t,w,A,nr)})}const y4=function(w,A){return!!(er&&w.hasChildNodes()&&!fc(w.firstElementChild)&&pt(Bb,w.textContent)&&pt(Bb,w.innerHTML)||er&&w.namespaceURI===Yt&&R9[A]&&(fc(w.firstElementChild)||typeof w.textContent=="string"&&pt(I9[A],w.textContent))||w.nodeType===Xt.processingInstruction||er&&w.nodeType===Xt.comment&&pt(jb,w.data))},Dh=function(w,A){if(w instanceof RegExp)return pt(w,A);if(w instanceof Function){for(var M=arguments.length,H=new Array(M>2?M-2:0),X=2;X<M;X++)H[X-2]=arguments[X];return!!w(A,...H)}return!1},w4=function(w,A,M){if(!mn[A]&&Nv(A)&&Dh(ze.tagNameCheck,A))return!1;if(Se&&!St[A]){const H=Z(w),X=$(w);if(X&&H){const ue=X.length;for(let me=ue-1;me>=0;--me){const Ve=w===M?y(X[me],!0):X[me];H.insertBefore(Ve,_(w))}}}return Li(w),!0},Ov=function(w,A,M,H){return w.length===0?A:A===M||A===H?Qt(A):A},ma=function(w,A){return w===A||Z(w)!==null?!1:(ke&&$h(w),!0)},Lv=function(w,A){if(rr(Ee.beforeSanitizeElements,w,null),ma(w,A))return!0;if(Ph(w))return Li(w),!0;const M=He(Q(w));if(ce=Ov(Ee.uponSanitizeElement,ce,pn,$i),rr(Ee.uponSanitizeElement,w,{tagName:M,allowedTags:ce}),ma(w,A))return!0;if(y4(w,M))return Li(w),!0;if(mn[M]||!(Je.tagCheck instanceof Function&&Je.tagCheck(M))&&!ce[M]){const H=w4(w,M,A);return H===!1&&(rr(Ee.afterSanitizeElements,w,null),ma(w,A))?!0:H}if(q(w)===Xt.element&&!m4(w)||(M==="noscript"||M==="noembed"||M==="noframes")&&pt(T9,w.innerHTML))return Li(w),!0;if(Qn&&w.nodeType===Xt.text){const H=xh(w.textContent);w.textContent!==H&&(bc(t.removed,{element:w.cloneNode()}),w.textContent=H)}return rr(Ee.afterSanitizeElements,w,null),ma(w,A)},Mv=function(w,A,M){if(On[A]||xv(A,w)||k&&(A==="id"||A==="name")&&(M in e||M in Oi))return!1;const H=oe[A]||Je.attributeCheck instanceof Function&&Je.attributeCheck(A,w);return Xn&&pt(oc,A)||xr&&pt(bt,A)?!0:H?ua[A]||pt(Ge,Sc(M,Be,""))||(A==="src"||A==="xlink:href"||A==="href")&&w!=="script"&&Nb(M,"data:")===0&&dt[w]||Pr&&!pt(Re,Sc(M,Be,""))?!0:!M:Nv(w)&&Dh(ze.tagNameCheck,w)&&Dh(ze.attributeNameCheck,A,w)||A==="is"&&ze.allowCustomizedBuiltInElements&&Dh(ze.tagNameCheck,M)},b4=ve({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Nv=function(w){return!b4[Fc(w)]&&pt(Pe,w)},S4=function(w,A,M,H){if(V&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!M)switch(f.getAttributeType(w,A)){case"TrustedHTML":return We(H);case"TrustedScriptURL":return Ot(H)}return H},_4=function(w,A,M,H){try{return M?w.setAttributeNS(M,A,H):w.setAttribute(A,H),Ph(w)?(Li(w),!1):!0}catch{return qs(A,w),!1}},zv=function(w,A){if(rr(Ee.beforeSanitizeAttributes,w,null),ma(w,A))return;const M=w.attributes;if(!M||Ph(w))return;oe=Ov(Ee.uponSanitizeAttribute,oe,at,zs);const H={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:oe,forceKeepAttr:void 0};let X=M.length;const ue=He(w.nodeName);for(;X--;){const me=M[X],Ve=me.name,gn=me.namespaceURI,Kt=me.value,ga=He(Ve),ap=Kt;let _t=Ve==="value"?ap:l9(ap),Hv=!1;if(H.attrName=ga,H.attrValue=_t,H.keepAttr=!0,H.forceKeepAttr=void 0,rr(Ee.uponSanitizeAttribute,w,H),_t=H.attrValue,C&&(ga==="id"||ga==="name")&&Nb(_t,pe)!==0&&(qs(Ve,w,me),_t=pe+_t,Hv=!0),er&&pt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,_t)){qs(Ve,w,me);continue}if(ga==="attributename"&&Mb(_t,"href")){qs(Ve,w,me);continue}if(!H.forceKeepAttr){if(!H.keepAttr){qs(Ve,w,me);continue}if(!Ch&&pt(C9,_t)){qs(Ve,w,me);continue}if(Qn&&(_t=xh(_t)),!Mv(ue,ga,_t)){qs(Ve,w,me);continue}_t=S4(ue,ga,gn,_t),_t!==ap&&_4(w,Ve,gn,_t)&&Hv&&Lb(t.removed)}}rr(Ee.afterSanitizeAttributes,w,null),ma(w,A)},Oh=function(w){let A=null;const M=Dv(w);for(rr(Ee.beforeSanitizeShadowDOM,w,null);A=M.nextNode();)if(rr(Ee.uponSanitizeShadowNode,A,null),Lv(A,w),zv(A,w),pa(A.content)&&Oh(A.content),q(A)===Xt.element){const H=O(A);pa(H)&&(op(H),Oh(H))}rr(Ee.afterSanitizeShadowDOM,w,null)},op=function(w){const A=[{node:w,shadow:null}];for(;A.length>0;){const M=A.pop();if(M.shadow){Oh(M.shadow);continue}const H=M.node,X=q(H)===Xt.element,ue=$(H);if(ue)for(let me=ue.length-1;me>=0;--me)A.push({node:ue[me],shadow:null});if(X){const me=B?B(H):null;if(typeof me=="string"&&He(me)==="template"){const Ve=H.content;pa(Ve)&&A.push({node:Ve,shadow:null})}}if(X){const me=O(H);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,H=null,X=null;if(zr=!N,zr&&(N="<!-->"),typeof N!="string"&&!fc(N)&&(N=f9(N),typeof N!="string"))throw Mi("dirty is not a string, aborting");if(!t.isSupported)return N;Or?(ce=$i,oe=zs):hc(w),(Ee.uponSanitizeElement.length>0||Ee.uponSanitizeAttribute.length>0)&&(ce=Qt(ce)),Ee.uponSanitizeAttribute.length>0&&(oe=Qt(oe)),t.removed=[];const ue=ke&&typeof N!="string"&&fc(N);if(ue){v4(N);const gn=Q(N);if(typeof gn=="string"){const Kt=He(gn);if(!ce[Kt]||mn[Kt])throw Ih(N),Mi("root node is forbidden and cannot be sanitized in-place")}if(Ph(N))throw Ih(N),Mi("root node is clobbered and cannot be sanitized in-place");try{op(N)}catch(Kt){throw Ih(N),Kt}}else if(fc(N))A=Pv("<!---->"),M=A.ownerDocument.importNode(N,!0),M.nodeType===Xt.element&&M.nodeName==="BODY"||M.nodeName==="HTML"?A=M:A.appendChild(M),op(A);else{if(!xi&&!Qn&&!Dr&&N.indexOf("<")===-1)return V&&Lr?We(N):N;if(A=Pv(N),!A)return xi?null:Lr?ie:""}A&&ac&&Li(A.firstChild);const me=ue?N:A;try{const gn=Dv(me);for(;H=gn.nextNode();)Lv(H,me),zv(H,me),pa(H.content)&&Oh(H.content)}catch(gn){throw ue&&(Ih(N),Js(t.removed,Kt=>{Kt.element&&$h(Kt.element)})),gn}if(ue){let gn=!1;if(Js(t.removed,Kt=>{Kt.element&&(Kt.element===N&&(gn=!0),$h(Kt.element))}),gn)throw Mi("a node selected for removal could not be safely returned; refusing to sanitize in place");return Qn&&sp(N),N}if(xi){if(Qn&&sp(A),Pi)for(X=ca.call(A.ownerDocument);A.firstChild;)X.appendChild(A.firstChild);else X=A;return(oe.shadowroot||oe.shadowrootmode)&&(X=Ii.call(r,X,!0)),X}let Ve=Dr?A.outerHTML:A.innerHTML;return Dr&&ce["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&pt(E9,A.ownerDocument.doctype.name)&&(Ve="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
|
|
439
|
+
`+Ve),Qn&&(Ve=xh(Ve)),V&&Lr?We(Ve):Ve},t.setConfig=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};hc(N),Or=!0,$i=ce,zs=oe},t.clearConfig=function(){nr=null,Or=!1,$i=null,zs=null,V=Ne,ie=""},t.isValidAttribute=function(N,w,A){nr||hc({});const M=He(N),H=He(w);return Mv(M,H,A)},t.addHook=function(N,w){typeof w=="function"&&Bt(Ee,N)&&bc(Ee[N],w)},t.removeHook=function(N,w){if(Bt(Ee,N)){if(w!==void 0){const A=o9(Ee[N],w);return A===-1?void 0:a9(Ee[N],A,1)[0]}return Lb(Ee[N])}},t.removeHooks=function(N){Bt(Ee,N)&&(Ee[N]=[])},t.removeAllHooks=function(){Ee=Wb()},t}var fA=dA();function vv(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var la=vv();function pA(n){la=n}var eo={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 P9=(()=>{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)}}>`)},D9=/^(?:[ \t]*(?:\n|$))+/,O9=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,L9=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Th=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,M9=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,yv=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,mA=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,gA=ge(mA).replace(/bull/g,yv).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(),N9=ge(mA).replace(/bull/g,yv).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(),wv=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,z9=/^[^\n]+/,bv=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,H9=ge(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",bv).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Z9=ge(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,yv).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",Sv=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,U9=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",Sv).replace("tag",np).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vA=ge(wv).replace("hr",Th).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(),F9=ge(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",vA).getRegex(),_v={blockquote:F9,code:O9,def:H9,fences:L9,heading:M9,hr:Th,html:U9,lheading:gA,list:Z9,newline:D9,paragraph:vA,table:eo,text:z9},Gb=ge("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Th).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(),q9={..._v,lheading:N9,table:Gb,paragraph:ge(wv).replace("hr",Th).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()},V9={..._v,html:ge(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Sv).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:eo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ge(wv).replace("hr",Th).replace("heading",` *#{1,6} *[^
|
|
440
|
+
]`).replace("lheading",gA).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},B9=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,j9=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,yA=/^( {2,}|\\)\n(?!\s*$)/,W9=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ic=/[\p{P}\p{S}]/u,rp=/[\s\p{P}\p{S}]/u,Av=/[^\s\p{P}\p{S}]/u,G9=ge(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,rp).getRegex(),wA=/(?!~)[\p{P}\p{S}]/u,J9=/(?!~)[\s\p{P}\p{S}]/u,Y9=/(?:[^\s\p{P}\p{S}]|~)/u,K9=ge(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",P9?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),bA=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,X9=ge(bA,"u").replace(/punct/g,ic).getRegex(),Q9=ge(bA,"u").replace(/punct/g,wA).getRegex(),SA="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ez=ge(SA,"gu").replace(/notPunctSpace/g,Av).replace(/punctSpace/g,rp).replace(/punct/g,ic).getRegex(),tz=ge(SA,"gu").replace(/notPunctSpace/g,Y9).replace(/punctSpace/g,J9).replace(/punct/g,wA).getRegex(),nz=ge("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Av).replace(/punctSpace/g,rp).replace(/punct/g,ic).getRegex(),rz=ge(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ic).getRegex(),iz="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",sz=ge(iz,"gu").replace(/notPunctSpace/g,Av).replace(/punctSpace/g,rp).replace(/punct/g,ic).getRegex(),oz=ge(/\\(punct)/,"gu").replace(/punct/g,ic).getRegex(),az=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(),lz=ge(Sv).replace("(?:-->|$)","-->").getRegex(),cz=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",lz).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Fd=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,uz=ge(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Fd).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),_A=ge(/^!?\[(label)\]\[(ref)\]/).replace("label",Fd).replace("ref",bv).getRegex(),AA=ge(/^!?\[(ref)\](?:\[\])?/).replace("ref",bv).getRegex(),hz=ge("reflink|nolink(?!\\()","g").replace("reflink",_A).replace("nolink",AA).getRegex(),Jb=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ev={_backpedal:eo,anyPunctuation:oz,autolink:az,blockSkip:K9,br:yA,code:j9,del:eo,delLDelim:eo,delRDelim:eo,emStrongLDelim:X9,emStrongRDelimAst:ez,emStrongRDelimUnd:nz,escape:B9,link:uz,nolink:AA,punctuation:G9,reflink:_A,reflinkSearch:hz,tag:cz,text:W9,url:eo},dz={...Ev,link:ge(/^!?\[(label)\]\((.*?)\)/).replace("label",Fd).getRegex(),reflink:ge(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Fd).getRegex()},l1={...Ev,emStrongRDelimAst:tz,emStrongLDelim:Q9,delLDelim:rz,delRDelim:sz,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()},fz={...l1,br:ge(yA).replace("{2,}","*").getRegex(),text:ge(l1.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Wh={normal:_v,gfm:q9,pedantic:V9},Ac={normal:Ev,gfm:l1,breaks:fz,pedantic:dz},pz={"&":"&","<":"<",">":">",'"':""","'":"'"},Yb=n=>pz[n];function sr(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 mz(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 gz(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 vz(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 qd=class{constructor(n){R(this,"options");R(this,"rules");R(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=vz(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=gz(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 Z=this.rules.other.nextBulletRegex($),O=this.rules.other.hrRegex($),z=this.rules.other.fencesBeginRegex($),P=this.rules.other.headingBeginRegex($),B=this.rules.other.htmlBeginRegex($),F=this.rules.other.blockquoteBeginRegex($);for(;n;){let q=n.split(`
|
|
459
|
+
`,1)[0],Q;if(S=q,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)||F.test(S)||Z.test(S)||O.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)||O.test(v))break;y+=`
|
|
461
|
+
`+S}_=!S.trim(),p+=q+`
|
|
462
|
+
`,n=n.substring(q.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=mz(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 c1{constructor(t){R(this,"tokens");R(this,"options");R(this,"state");R(this,"inlineQueue");R(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||la,this.options.tokenizer=this.options.tokenizer||new qd,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:Wh.normal,inline:Ac.normal};this.options.pedantic?(e.block=Wh.pedantic,e.inline=Ac.pedantic):this.options.gfm&&(e.block=Wh.gfm,this.options.breaks?e.inline=Ac.breaks:e.inline=Ac.gfm),this.tokenizer.rules=e}static get rules(){return{block:Wh,inline:Ac}}static lex(t,e){return new c1(e).lex(t)}static lexInline(t,e){return new c1(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),Z;this.options.extensions.startInline.forEach(O=>{Z=O.call({lexer:this},$),typeof Z=="number"&&Z>=0&&(_=Math.min(_,Z))}),_<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}},Vd=class{constructor(n){R(this,"options");R(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-'+sr(r)+'">'+(e?i:sr(i,!0))+`</code></pre>
|
|
480
|
+
`:"<pre><code>"+(e?i:sr(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>${sr(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="'+sr(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 sr(e);n=i;let s=`<img src="${n}" alt="${sr(e)}"`;return t&&(s+=` title="${sr(t)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:sr(n.text)}},kv=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 u1{constructor(t){R(this,"options");R(this,"renderer");R(this,"textRenderer");this.options=t||la,this.options.renderer=this.options.renderer||new Vd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new kv}static parse(t,e){return new u1(e).parse(t)}static parseInline(t,e){return new u1(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}},Kh,qc=(Kh=class{constructor(n){R(this,"options");R(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}},R(Kh,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),R(Kh,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Kh),yz=class{constructor(...n){R(this,"defaults",vv());R(this,"options",this.setOptions);R(this,"parse",this.parseMarkdown(!0));R(this,"parseInline",this.parseMarkdown(!1));R(this,"Parser",Gn);R(this,"Renderer",Vd);R(this,"TextRenderer",kv);R(this,"Lexer",Wn);R(this,"Tokenizer",qd);R(this,"Hooks",qc);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 Vd(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 qd(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 qc;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];qc.passThroughHooks.has(s)?i[a]=u=>{if(this.defaults.async&&qc.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>"+sr(e.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(e);throw e}}},ia=new yz;function Te(n,t){return ia.parse(n,t)}Te.options=Te.setOptions=function(n){return ia.setOptions(n),Te.defaults=ia.defaults,pA(Te.defaults),Te};Te.getDefaults=vv;Te.defaults=la;Te.use=function(...n){return ia.use(...n),Te.defaults=ia.defaults,pA(Te.defaults),Te};Te.walkTokens=function(n,t){return ia.walkTokens(n,t)};Te.parseInline=ia.parseInline;Te.Parser=Gn;Te.parser=Gn.parse;Te.Renderer=Vd;Te.TextRenderer=kv;Te.Lexer=Wn;Te.lexer=Wn.lex;Te.Tokenizer=qd;Te.Hooks=qc;Te.parse=Te;Te.options;Te.setOptions;Te.use;Te.walkTokens;Te.parseInline;Gn.parse;Wn.lex;fA.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function EA(n){const t=Te.parse(n,{async:!1});return fA.sanitize(t,{USE_PROFILES:{html:!0}})}const e8={restart_to_update:"Restart to update",restarting:"Restarting…"};var Ho,eh,Vn,lf,kA,Al,cf;class wz extends dn{constructor(){super(...arguments);m(this,lf);m(this,Ho,null);m(this,eh,Jn());m(this,Vn,null);m(this,Al,()=>{this.render()});m(this,cf,()=>{var e;(e=o(this,Vn))==null||e.restart()})}connected(){queueMicrotask(()=>{var r;if(!this.isConnected||o(this,Ho)!==null)return;const e=((r=o(this,eh).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,Vn))==null||r.removeEventListener("change",o(this,Al)),d(this,Vn,null)}template(e,r,i){var l,c;h(this,lf,kA).call(this,r??null);const s=((l=o(this,Vn))==null?void 0:l.version)??null,a=((c=o(this,Vn))==null?void 0:c.restarting)??!1;return W`
|
|
498
|
+
<div class="desktop-upgrade-gate" ${vt(o(this,eh))}>
|
|
499
|
+
${ep(W`<div class="upgrade-gate-body" data-testid="upgrade-gate-body">${lA(EA(HS(e,s!==null)))}</div>${s===null?he: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,eh=new WeakMap,Vn=new WeakMap,lf=new WeakSet,kA=function(e){var r;e!==o(this,Vn)&&((r=o(this,Vn))==null||r.removeEventListener("change",o(this,Al)),d(this,Vn,e),e==null||e.addEventListener("change",o(this,Al)),e==null||e.subscribe())},Al=new WeakMap,cf=new WeakMap;const bz=fn(wz),Sz=1400,Gh=new WeakMap;function _z(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 Az={writeClipboard:_z,scheduler:{setTimeout(n,t){return globalThis.setTimeout(n,t)},clearTimeout(n){globalThis.clearTimeout(n)}}};function Ez(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=Gh.get(r);a&&a.scheduler.clearTimeout(a.handle);const l={handle:void 0,scheduler:t.scheduler};l.handle=t.scheduler.setTimeout(()=>{Gh.get(r)===l&&(Gh.delete(r),r.toggleAttribute("copied",!1),s&&(s.textContent=""))},Sz),Gh.set(r,l),e()}function TA({label:n,prompt:t="",intent:e,size:r="sm",copied:i=!1,onActivate:s=()=>{}},a=Az){return W`
|
|
507
|
+
<button
|
|
508
|
+
class="copy-button"
|
|
509
|
+
size=${r==="default"?he:r}
|
|
510
|
+
aria-label=${n}
|
|
511
|
+
intent=${e??he}
|
|
512
|
+
?copied=${i}
|
|
513
|
+
prompt=${t}
|
|
514
|
+
@click=${l=>Ez(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":he}</span
|
|
524
|
+
>
|
|
525
|
+
`}const CA="1.4.0",kz="tv-desktop-upgrade-recommendation-dismissed",Tz=`### 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 Cz(n){var t;return!n.electron||n.noticesSuppressed||((t=n.updateState)==null?void 0:t.toast)!=null||n.shellVersion===null||!Ff(n.shellVersion)||n.shellVersion===Id?!1:X1(CA,n.shellVersion)}var El;class RA extends HTMLElement{constructor(){super(...arguments);m(this,El,new fv(this))}connectedCallback(){o(this,El).connect()}disconnectedCallback(){o(this,El).disconnect()}attributeChangedCallback(){o(this,El).refresh()}}El=new WeakMap,R(RA,"observedAttributes",["open","trigger","manual"]);customElements.get("tv-popover")||customElements.define("tv-popover",RA);const Rz="tv-update-dismissed",wa={update_available:"Update available",copy_prompt:"Copy upgrade prompt",later:"Later",restart_to_update:"Restart to update",restarting:"Restarting…"},Iz="update-popover";function $z(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,li,Tl,th,nh,uf;class xz extends dn{constructor(){super(...arguments);m(this,kl);m(this,li);m(this,Tl,!1);m(this,th,()=>{});m(this,nh,()=>{});m(this,uf,e=>{var r;(r=o(this,li))==null||r.disconnect(),d(this,li,void 0),d(this,kl,e),d(this,Tl,(e==null?void 0:e.hasAttribute("open"))??!1),e&&(d(this,li,new MutationObserver(()=>{const i=e.hasAttribute("open");i!==o(this,Tl)&&(d(this,Tl,i),i?o(this,th).call(this):o(this,nh).call(this))})),o(this,li).observe(e,{attributes:!0,attributeFilter:["open"]}))})}disconnected(){var e;(e=o(this,li))==null||e.disconnect(),d(this,li,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,th,c),d(this,nh,u);const y=()=>{var S;(S=o(this,kl))==null||S.removeAttribute("open")},v=S=>{const _=S.currentTarget;S.key!=="Escape"||!$z(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?he:vt(l)}
|
|
544
|
+
>
|
|
545
|
+
<tv-icon name="notification" size="sm"></tv-icon>
|
|
546
|
+
</button>
|
|
547
|
+
|
|
548
|
+
<tv-popover
|
|
549
|
+
id=${Iz}
|
|
550
|
+
manual
|
|
551
|
+
trigger="update-bell"
|
|
552
|
+
role="status"
|
|
553
|
+
class="update-popover"
|
|
554
|
+
${vt(o(this,uf))}
|
|
555
|
+
${a===void 0?he: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?he:TA({label:wa.copy_prompt,prompt:r,intent:"primary",copied:i,onActivate:f})}
|
|
564
|
+
${s===void 0?he: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,li=new WeakMap,Tl=new WeakMap,th=new WeakMap,nh=new WeakMap,uf=new WeakMap;const Pz=fn(xz);function Dz(n,t){return t===null?!0:X1(n,t)}const t8=new Set;var An,ln,rh,cn,Cl,Ar,Zo,Uo,Fo,Rl,gt,ci,qo,Il,$l,Vo,gs,ee,h1,d1,f1,p1,m1,g1,v1,Bo,jo,bd,Vc,y1,IA,w1,b1,S1,hf,df,ff,pf,mf,gf,Bc,$A;class Oz{constructor(t=()=>{}){m(this,ee);m(this,An,null);m(this,ln,null);m(this,rh,null);m(this,cn,null);m(this,Cl);m(this,Ar,!1);m(this,Zo,!1);m(this,Uo,!1);m(this,Fo,!1);m(this,Rl,null);m(this,gt,!1);m(this,ci,!1);m(this,qo,null);m(this,Il,null);m(this,$l,!1);m(this,Vo,[]);m(this,gs);m(this,Bo,()=>{o(this,gs).call(this)});m(this,jo,()=>{h(this,ee,S1).call(this),o(this,gs).call(this)});m(this,hf,()=>{var e;const t=h(this,ee,Vc).call(this,((e=o(this,ln))==null?void 0:e.toastsSuppressed)??!1);t===null||o(this,gt)||(d(this,gt,!0),t.kind==="server"&&h(this,ee,w1).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,Vc).call(this,((e=o(this,ln))==null?void 0:e.toastsSuppressed)??!1);t!==null&&((r=h(this,ee,h1).call(this))==null||r.setItem(h(this,ee,y1).call(this,t),t.version)),d(this,gt,!1),d(this,ci,!0),o(this,gs).call(this)});m(this,ff,()=>{var t;(t=o(this,cn))==null||t.restart()});m(this,pf,()=>{var e;const t=h(this,ee,Vc).call(this,((e=o(this,ln))==null?void 0:e.toastsSuppressed)??!1);(t==null?void 0:t.kind)!=="server"||t.prompt===void 0||h(this,ee,b1).call(this,"update_prompt_copy_clicked",t.toast)});m(this,mf,t=>{d(this,qo,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,presentation:e=null,dismissalStorage:r,desktopRecommendation:i=null,desktopUpdate:s=null}){t!==o(this,An)&&(h(this,ee,f1).call(this),d(this,An,t),h(this,ee,d1).call(this)),e!==o(this,ln)&&(h(this,ee,m1).call(this),d(this,ln,e),h(this,ee,p1).call(this)),s!==o(this,cn)&&(h(this,ee,v1).call(this),d(this,cn,s),h(this,ee,g1).call(this)),d(this,Cl,r),d(this,rh,i)}connect(){o(this,Ar)||(d(this,Ar,!0),h(this,ee,d1).call(this),h(this,ee,p1).call(this),h(this,ee,g1).call(this))}disconnect(){o(this,Ar)&&(h(this,ee,f1).call(this),h(this,ee,m1).call(this),h(this,ee,v1).call(this),d(this,Ar,!1),d(this,qo,null),d(this,Il,null))}template(){var l,c,u;const t=((l=o(this,ln))==null?void 0:l.toastsSuppressed)??!1,e=h(this,ee,Vc).call(this,t),r=e===null?null:`${e.kind}:${e.version}`;if(e===null?(d(this,Rl,null),d(this,gt,!1),d(this,ci,!0)):r!==o(this,Rl)&&(d(this,Rl,r),d(this,gt,h(this,ee,IA).call(this,e)),d(this,ci,!0),o(this,gt)&&e.kind==="server"&&!t&&h(this,ee,w1).call(this,e.toast)),e===null||t)return d(this,gt,!1),d(this,ci,!0),h(this,ee,Bc).call(this),he;const i=(c=o(this,qo))==null?void 0:c.querySelector(".copy-button"),s=o(this,gt)&&!o(this,ci)&&(i==null?void 0:i.hasAttribute("copied"))===!0,a=Pz({body:lA(EA(e.markdown)),prompt:e.kind==="server"?e.prompt:void 0,copied:s,restart:e.kind!=="desktop-self-update"?void 0:(u=o(this,cn))!=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,ci,!1),h(this,ee,Bc).call(this),a}}An=new WeakMap,ln=new WeakMap,rh=new WeakMap,cn=new WeakMap,Cl=new WeakMap,Ar=new WeakMap,Zo=new WeakMap,Uo=new WeakMap,Fo=new WeakMap,Rl=new WeakMap,gt=new WeakMap,ci=new WeakMap,qo=new WeakMap,Il=new WeakMap,$l=new WeakMap,Vo=new WeakMap,gs=new WeakMap,ee=new WeakSet,h1=function(){return o(this,Cl)!==void 0?o(this,Cl):typeof localStorage>"u"?null:localStorage},d1=function(){!o(this,Ar)||o(this,Zo)||o(this,An)===null||(o(this,An).addEventListener("server-status",o(this,jo)),o(this,An).addEventListener("change",o(this,jo)),d(this,Zo,!0))},f1=function(){!o(this,Zo)||o(this,An)===null||(o(this,An).removeEventListener("server-status",o(this,jo)),o(this,An).removeEventListener("change",o(this,jo)),d(this,Zo,!1))},p1=function(){!o(this,Ar)||o(this,Uo)||o(this,ln)===null||(o(this,ln).addEventListener("change",o(this,Bo)),d(this,Uo,!0))},m1=function(){!o(this,Uo)||o(this,ln)===null||(o(this,ln).removeEventListener("change",o(this,Bo)),d(this,Uo,!1))},g1=function(){!o(this,Ar)||o(this,Fo)||o(this,cn)===null||(o(this,cn).addEventListener("change",o(this,Bo)),o(this,cn).subscribe(),d(this,Fo,!0))},v1=function(){!o(this,Fo)||o(this,cn)===null||(o(this,cn).removeEventListener("change",o(this,Bo)),d(this,Fo,!1))},Bo=new WeakMap,jo=new WeakMap,bd=function(){var t;return((t=o(this,An))==null?void 0:t.connection)??null},Vc=function(t){var a,l;const e=((a=h(this,ee,bd).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,cn))==null?void 0:l.version)??null;if(i!==null)return{kind:"desktop-self-update",version:i,markdown:uO(i)};const s=o(this,rh);return s!==null&&Cz({...s,noticesSuppressed:t,updateState:e})?{kind:"recommendation",version:CA,markdown:Tz}:null},y1=function(t){switch(t.kind){case"server":return Rz;case"desktop-self-update":return cO;case"recommendation":return kz}},IA=function(t){var r;const e=((r=h(this,ee,h1).call(this))==null?void 0:r.getItem(h(this,ee,y1).call(this,t)))??null;return t.kind==="desktop-self-update"?e!==t.version:Dz(t.version,e!==null&&Ff(e)?e:null)},w1=function(t){t8.has(t.version)||(t8.add(t.version),h(this,ee,b1).call(this,"update_toast_shown",t))},b1=function(t,e){var r;o(this,Vo).push({event:t,properties:{server_version:((r=h(this,ee,bd).call(this))==null?void 0:r.serverVersion)??"",channel_version:e.version}}),h(this,ee,S1).call(this)},S1=function(){if(o(this,Vo).length===0)return;const t=h(this,ee,bd).call(this);if(!t||t.status!=="connected")return;const e=o(this,Vo);d(this,Vo,[]);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,$A).call(this)}))},$A=function(){const t=o(this,qo);t!==null&&(o(this,gt)&&o(this,Il)===null||t.toggleAttribute("open",o(this,gt)))};const Lz=""+new URL("calendar-DToAnkzj.png",import.meta.url).href,Mz=""+new URL("table-oeG9uAN1.png",import.meta.url).href,Nz=""+new URL("tasks-D4xqXFPl.png",import.meta.url).href,zz=""+new URL("markdown-DdDrJuVK.png",import.meta.url).href,n8="Artifact skills",Hz="Artifact skills",Zz="Ready-made starting prompts for creating Television artifacts. Copy one, add the details of what you want, and send it to your agent.",Uz="Copy prompt";function Jh({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
|
+
${TA({label:Uz,prompt:r,onActivate:()=>s==null?void 0:s.sendTelemetrySignal("artifact_skill_prompt_copy_clicked",{artifact_skill:n})})}
|
|
579
|
+
</article>
|
|
580
|
+
`}class Fz extends dn{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">${Hz}</div>
|
|
598
|
+
<p class="skill-intro">${Zz}</p>
|
|
599
|
+
<div class="skill-grid">
|
|
600
|
+
${Jh({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:Lz},t)}
|
|
601
|
+
${Jh({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:Mz},t)}
|
|
602
|
+
${Jh({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:Nz},t)}
|
|
603
|
+
${Jh({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:zz},t)}
|
|
604
|
+
</div>
|
|
605
|
+
</tv-popover>
|
|
606
|
+
`}}const qz=fn(Fz),Vz=600;let Bz=0;const r8=new WeakMap,qm=n=>{if(n.id)return n.id;let t=r8.get(n);if(!t){do t=`tv-select-${++Bz}`;while(n.ownerDocument.getElementById(t));r8.set(n,t)}return n.id=t,t},Yh=n=>{var t;return((t=n.textContent)==null?void 0:t.trim())??""};var ih;class xA extends HTMLElement{constructor(){super();m(this,ih,this.attachInternals());o(this,ih).role="option"}connectedCallback(){this.attributeChangedCallback()}attributeChangedCallback(){o(this,ih).ariaSelected=String(this.hasAttribute("selected"))}}ih=new WeakMap,R(xA,"observedAttributes",["selected"]);var Ct,ui,xl,vs,ys,sh,re,Zi,Da,_1,Sd,Ui,_d,A1,DA,Ad,OA;class PA extends HTMLElement{constructor(){super();m(this,re);m(this,Ct,new fv(this,{select:!0,refresh:()=>h(this,re,_d).call(this),opened:()=>{d(this,ys,""),h(this,re,Ui).call(this,h(this,re,Da).call(this))},closed:()=>{h(this,re,Ui).call(this,void 0),d(this,ys,"")},keydown:e=>h(this,re,OA).call(this,e),pointermove:e=>{const r=h(this,re,_1).call(this,e);r&&h(this,re,Ui).call(this,r)},click:e=>{const r=h(this,re,_1).call(this,e);r&&h(this,re,Ad).call(this,r)},selectedRow:()=>h(this,re,Da).call(this),unpair:e=>h(this,re,DA).call(this,e)}));m(this,ui);m(this,xl,"");m(this,vs);m(this,ys,"");m(this,sh,0);this.attachInternals().role="listbox"}connectedCallback(){o(this,Ct).connect()}disconnectedCallback(){o(this,Ct).disconnect()}attributeChangedCallback(){o(this,Ct).refresh()}get value(){var e;return((e=h(this,re,Da).call(this))==null?void 0:e.getAttribute("value"))??""}set value(e){const r=h(this,re,Zi).call(this).find(i=>i.getAttribute("value")===e);r&&(h(this,re,Sd).call(this,r),h(this,re,_d).call(this))}}Ct=new WeakMap,ui=new WeakMap,xl=new WeakMap,vs=new WeakMap,ys=new WeakMap,sh=new WeakMap,re=new WeakSet,Zi=function(){return[...this.querySelectorAll("tv-option")].filter(e=>e.closest("tv-select")===this)},Da=function(){return h(this,re,Zi).call(this).find(e=>e.hasAttribute("selected"))},_1=function(e){const r=e.closest("tv-option");return(r==null?void 0:r.closest("tv-select"))===this?r:void 0},Sd=function(e){for(const r of h(this,re,Zi).call(this))r.toggleAttribute("selected",r===e)},Ui=function(e){for(const r of h(this,re,Zi).call(this))r.toggleAttribute("highlighted",r===e);if(o(this,Ct).trigger&&Ia(o(this,Ct).trigger,"aria-activedescendant",e?qm(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)}},_d=function(){var l;const e=h(this,re,Zi).call(this),r=h(this,re,Da).call(this)??e[0];r&&h(this,re,Sd).call(this,r);const i=o(this,Ct).trigger;if(!i)return;Ia(i,"role","combobox"),Ia(i,"aria-haspopup","listbox"),Ia(i,"aria-controls",qm(this));for(const c of e)qm(c);const s=e.find(c=>c.hasAttribute("highlighted"));Ia(i,"aria-activedescendant",this.hasAttribute("open")&&s?s.id:null);const a=r?Yh(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,re,A1).call(this,i,e)},A1=function(e,r){if(o(this,vs)||(d(this,vs,new ResizeObserver(()=>{const c=o(this,Ct).trigger;c&&h(this,re,A1).call(this,c,h(this,re,Zi).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(Yh),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=`${Yh(c)} `,l=Math.max(l,a.getBoundingClientRect().width);a.remove(),o(this,ui)??d(this,ui,this.ownerDocument.createElement("style")),o(this,ui).textContent=`:where(button[id="${CSS.escape(e.id)}"]) { width: ${l}px; }`,o(this,ui).isConnected||this.ownerDocument.head.append(o(this,ui))},DA=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,ui))==null||i.remove(),d(this,ui,void 0),d(this,xl,"")},Ad=function(e){const r=h(this,re,Da).call(this)!==e;h(this,re,Sd).call(this,e),h(this,re,_d).call(this),o(this,Ct).close(),r&&this.dispatchEvent(new Event("change",{bubbles:!0}))},OA=function(e){if(!o(this,Ct).open)return this.ownerDocument.activeElement!==o(this,Ct).trigger||!["Enter"," ","ArrowDown","ArrowUp"].includes(e.key)?!1:(e.preventDefault(),e.stopImmediatePropagation(),o(this,Ct).show(!0),!0);const r=h(this,re,Zi).call(this),i=r.findIndex(a=>a.hasAttribute("highlighted"));if(e.key==="Tab")return e.stopImmediatePropagation(),this.ownerDocument.activeElement!==o(this,Ct).trigger?(e.preventDefault(),!0):(r[i]&&h(this,re,Ad).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,re,Ad).call(this,r[i]);else if(e.key==="Home")h(this,re,Ui).call(this,r[0]);else if(e.key==="End")h(this,re,Ui).call(this,r.at(-1));else if(e.key==="ArrowDown"||e.key==="ArrowUp")h(this,re,Ui).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,sh)>Vz?e.key.toLowerCase():o(this,ys)+e.key.toLowerCase()),d(this,sh,a);const c=[...r.slice(i+1),...r.slice(0,i+1)].find(u=>Yh(u).toLowerCase().startsWith(o(this,ys)));c&&h(this,re,Ui).call(this,c)}return!0},R(PA,"observedAttributes",["open","trigger","manual"]);customElements.get("tv-option")||customElements.define("tv-option",xA);customElements.get("tv-select")||customElements.define("tv-select",PA);/**
|
|
607
|
+
* @license
|
|
608
|
+
* Copyright 2020 Google LLC
|
|
609
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
610
|
+
*/const jz=rc(class extends Eh{constructor(n){if(super(n),n.type!==Rr.PROPERTY&&n.type!==Rr.ATTRIBUTE&&n.type!==Rr.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===he)return t;const e=n.element,r=n.name;if(n.type===Rr.PROPERTY){if(t===e[r])return $t}else if(n.type===Rr.BOOLEAN_ATTRIBUTE){if(!!t===e.hasAttribute(r))return $t}else if(n.type===Rr.ATTRIBUTE&&e.getAttribute(r)===t+"")return $t;return i_(n),t}}),i8="Settings",s8="Refresh themes",Wz="Themes directory",Gz="None";function o8(n){return n instanceof Error?n.message:String(n)}var Ft,Wo,hi,Er,oh,di,fi,Go,Pl,Dl,Yn,LA,vf,yf,E1,wf,bf,Sf,Ed;class Jz extends dn{constructor(){super(...arguments);m(this,Yn);m(this,Ft,null);m(this,Wo,null);m(this,hi,!1);m(this,Er,null);m(this,oh,!1);m(this,di,0);m(this,fi,null);m(this,Go,!1);m(this,Pl,Jn());m(this,Dl,Jn());m(this,vf,e=>{var i;if((i=o(this,fi))==null||i.disconnect(),d(this,fi,null),d(this,Go,!1),!e)return;const r=()=>{const s=e.hasAttribute("open");s!==o(this,Go)&&(d(this,Go,s),s&&h(this,Yn,E1).call(this,!1))};d(this,fi,new MutationObserver(r)),o(this,fi).observe(e,{attributes:!0,attributeFilter:["open"]}),r()});m(this,yf,()=>{h(this,Yn,E1).call(this,!0)});m(this,wf,e=>{var s;const r=e.currentTarget,i=r.value;r.value=((s=o(this,Ft))==null?void 0:s.snapshot.display.appearanceMode)??"system",this.render(),h(this,Yn,Ed).call(this,()=>{var a;return(a=o(this,Ft))==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,Ft))==null?void 0:s.snapshot.display.activeThemeName)??"",this.render(),h(this,Yn,Ed).call(this,()=>{var a;return(a=o(this,Ft))==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,Ft))==null?void 0:a.snapshot.display.themeJavaScriptConsentIds.includes(i))??!1,this.render(),h(this,Yn,Ed).call(this,()=>{var l;return(l=o(this,Ft))==null?void 0:l.setThemeJavaScriptConsent(i,s)},"Unable to change theme JavaScript consent")})}template(e){var p,y;d(this,Ft,e);const r=e.snapshot.connection.status==="connected";o(this,oh)&&!r&&h(this,Yn,LA).call(this),d(this,oh,r);const{activeThemeName:i,appearanceMode:s,themeJavaScriptConsentIds:a}=e.snapshot.display,l=((p=o(this,Wo))==null?void 0:p.themes)??[],c=((y=o(this,Wo))==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,Ft))==null?void 0:v.snapshot.display.appearanceMode)??"system"),o(this,Dl).value&&(o(this,Dl).value.value=((S=o(this,Ft))==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}>${Gz}</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,hi)||!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=${jz(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,hi)?W`<p class="settings-status" role="status">Loading themes…</p>`:null}
|
|
698
|
+
${o(this,Er)?W`<p class="settings-failure" role="alert">${o(this,Er)}</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??Wz}</strong>: ${v.error}</p>
|
|
703
|
+
`)}
|
|
704
|
+
</div>
|
|
705
|
+
`:null}
|
|
706
|
+
</tv-popover>
|
|
707
|
+
`}disconnected(){var e;(e=o(this,fi))==null||e.disconnect(),d(this,fi,null),d(this,Go,!1),d(this,Ft,null),d(this,di,o(this,di)+1)}}Ft=new WeakMap,Wo=new WeakMap,hi=new WeakMap,Er=new WeakMap,oh=new WeakMap,di=new WeakMap,fi=new WeakMap,Go=new WeakMap,Pl=new WeakMap,Dl=new WeakMap,Yn=new WeakSet,LA=function(){d(this,Wo,null),d(this,Er,null),d(this,hi,!1),d(this,di,o(this,di)+1)},vf=new WeakMap,yf=new WeakMap,E1=async function(e){const r=o(this,Ft);if(r===null||r.snapshot.connection.status!=="connected"||o(this,hi))return;const i=++Lh(this,di)._;d(this,hi,!0),d(this,Er,null),this.render();try{const s=await(e?r.refreshThemes():r.listThemes());if(i!==o(this,di))return;d(this,Wo,s)}catch(s){if(i!==o(this,di))return;d(this,Er,`${e?"Unable to refresh themes":"Unable to load themes"}: ${o8(s)}`)}finally{i===o(this,di)&&(d(this,hi,!1),this.render())}},wf=new WeakMap,bf=new WeakMap,Sf=new WeakMap,Ed=async function(e,r){d(this,Er,null),this.render();try{await e()}catch(i){d(this,Er,`${r}: ${o8(i)}`),this.render()}};const Yz=fn(Jz),kc={start:"--item-fade-start",end:"--item-fade-end",left:"--item-fade-left",right:"--item-fade-right"},Kz=(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 F of i)v.has(F)||(f.unobserve(F),i.delete(F),S.push(F));for(const F of v)i.has(F)||(i.add(F),f.observe(F));const $=n.getBoundingClientRect().left+n.clientLeft,Z=$+n.clientWidth,O=Math.max(0,Math.min(e,n.clientWidth/2)),z=n.scrollLeft>1?O:0,P=n.scrollLeft<n.scrollWidth-n.clientWidth-1?O:0,B=[...v].map(F=>({item:F,bounds:F.getBoundingClientRect()}));for(const F of S)l(F);for(const{item:F,bounds:q}of B){const Q=z>0&&q.left<$+z&&q.right>$,V=P>0&&q.right>Z-P&&q.left<Z;if(!Q&&!V){l(F);continue}F.style.setProperty(kc.start,`${$-q.left}px`),F.style.setProperty(kc.end,`${Z-q.left}px`),F.style.setProperty(kc.left,`${z}px`),F.style.setProperty(kc.right,`${P}px`),F.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,Ol,Ll,Jo,ws,kr,pi,mi,bs,Ss,Bn,_s,Ml,As,Yo,ah,nt,gi,vi,En,_f,j,MA,NA,lh,ch,uh,Af,hh,Oa,k1,zA,kd,T1,C1,R1,HA,ZA,Nl,dh,UA,Ys,Td,FA,qA,VA,BA,La,jA,jc;class Xz extends dn{constructor(){super(...arguments);m(this,j);m(this,qt,Jn());m(this,Ol);m(this,Ll);m(this,Jo,!1);m(this,ws,0);m(this,kr,!1);m(this,pi,!1);m(this,mi,!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,Yo,null);m(this,ah,!1);m(this,nt,null);m(this,gi,!1);m(this,vi,!1);m(this,En,!1);m(this,_f,()=>{h(this,j,jc).call(this)});m(this,lh,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,La).call(this);const a=r.tab.getBoundingClientRect();d(this,gi,!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,C1).call(this,r),h(this,j,k1).call(this,r)}});m(this,ch,e=>{const r=o(this,nt);r===null||r.pointerId!==e.pointerId||h(this,j,Oa).call(this,!0,!0)});m(this,uh,e=>{var r;((r=o(this,nt))==null?void 0:r.pointerId)===e.pointerId&&h(this,j,Oa).call(this,!1,!0)});m(this,Af,e=>{var r;((r=o(this,nt))==null?void 0:r.pointerId)===e.pointerId&&h(this,j,Oa).call(this,!1,!0)});m(this,hh,e=>{var r;e.key!=="Escape"||!((r=o(this,nt))!=null&&r.dragging)||(e.preventDefault(),h(this,j,Oa).call(this,!1,!0))});m(this,Nl,()=>{d(this,Bn,!0),h(this,j,Ys).call(this,!1)});m(this,dh,()=>{d(this,Bn,!0),h(this,j,Ys).call(this,!0)})}connected(){var e;d(this,Ol,void 0),d(this,Ll,void 0),d(this,Bn,!1),h(this,j,UA).call(this),typeof document<"u"&&((e=document.fonts)==null||e.addEventListener("loadingdone",o(this,dh))),document.addEventListener("television-theme-styles-changed",o(this,Nl)),d(this,Yo,new MutationObserver(o(this,Nl))),o(this,Yo).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),window.addEventListener("pointermove",o(this,lh)),window.addEventListener("pointerup",o(this,ch)),window.addEventListener("pointercancel",o(this,uh)),window.addEventListener("keydown",o(this,hh))}template(e,r,i=null,s,a=!1){var $,Z;h(this,j,jA).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=e7(r,c),f=(l==null?void 0:l.artifactId)??i,p=((Z=r==null?void 0:r.selectedPage)==null?void 0:Z.artifactIds[0])??null,y=`${(r==null?void 0:r.id)??""}:${u.map(({key:O,label:z})=>`${O}:${z}`).join("|")}`,v=p!==o(this,Ol),S=y!==o(this,Ll);v&&d(this,vi,!1);const _=v||l===null&&S;return S&&d(this,Bn,!0),d(this,Ol,p),d(this,Ll,y),h(this,j,Ys).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:O})=>O,(O,z)=>{const P=O.artifactId!==null&&O.artifactId===p,B=O.artifactId!==null&&O.artifactId===f,F=B&&l!==null;return W`
|
|
717
|
+
${B?W`
|
|
718
|
+
<span
|
|
719
|
+
class="tab-placeholder"
|
|
720
|
+
aria-hidden="true"
|
|
721
|
+
style=${zd(F?{width:`${l.tabWidth}px`,height:`${l.tabHeight}px`}:{})}
|
|
722
|
+
></span>
|
|
723
|
+
`:null}
|
|
724
|
+
<div
|
|
725
|
+
class=${B?"tab dragged":"tab"}
|
|
726
|
+
?dragging=${F}
|
|
727
|
+
style=${zd(F?{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=${q=>{q.key!=="Enter"&&q.key!==" "||(q.preventDefault(),q.currentTarget.click())}}
|
|
729
|
+
role="tab"
|
|
730
|
+
aria-selected=${P?"true":"false"}
|
|
731
|
+
tabindex=${P?"0":"-1"}
|
|
732
|
+
data-artifact-id=${O.artifactId??""}
|
|
733
|
+
@pointerdown=${f===null?q=>h(this,j,MA).call(this,q,e,r,O,s):null}
|
|
734
|
+
@click=${q=>h(this,j,NA).call(this,q,e,r,O)}
|
|
735
|
+
@dblclick=${P&&r!==null&&!F?()=>Qg(e,r,O.page,!O.page.geometry.full_screen):null}
|
|
736
|
+
>
|
|
737
|
+
<span class="tab-label">${O.label}</span>
|
|
738
|
+
</div>
|
|
739
|
+
`})}
|
|
740
|
+
</div>
|
|
741
|
+
`}disconnected(){var e,r,i,s;d(this,Jo,!1),typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o(this,ws)),d(this,ws,0),d(this,kr,!1),d(this,pi,!1),d(this,mi,!1),h(this,j,La).call(this),d(this,vi,!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,Yo))==null||i.disconnect(),d(this,Yo,null),document.removeEventListener("television-theme-styles-changed",o(this,Nl)),typeof document<"u"&&((s=document.fonts)==null||s.removeEventListener("loadingdone",o(this,dh))),window.removeEventListener("pointermove",o(this,lh)),window.removeEventListener("pointerup",o(this,ch)),window.removeEventListener("pointercancel",o(this,uh)),window.removeEventListener("keydown",o(this,hh)),h(this,j,Oa).call(this,!1,!1),d(this,gi,!1)}}qt=new WeakMap,Ol=new WeakMap,Ll=new WeakMap,Jo=new WeakMap,ws=new WeakMap,kr=new WeakMap,pi=new WeakMap,mi=new WeakMap,bs=new WeakMap,Ss=new WeakMap,Bn=new WeakMap,_s=new WeakMap,Ml=new WeakMap,As=new WeakMap,Yo=new WeakMap,ah=new WeakMap,nt=new WeakMap,gi=new WeakMap,vi=new WeakMap,En=new WeakMap,_f=new WeakMap,j=new WeakSet,MA=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,gi,!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}))},NA=function(e,r,i,s){var a;if(e.detail!==0&&o(this,gi)){d(this,gi,!1);return}d(this,gi,!1),!((a=o(this,nt))!=null&&a.dragging||i===null||s.artifactId===null)&&r.selectPage(i.id,s.artifactId)},lh=new WeakMap,ch=new WeakMap,uh=new WeakMap,Af=new WeakMap,hh=new WeakMap,Oa=function(e,r){var a;const i=o(this,nt);if(i===null)return;if(h(this,j,kd).call(this,i),i.edgeScrollMoved&&d(this,vi,!0),i.dragging&&(d(this,kr,o(this,pi)),o(this,pi)||d(this,mi,!1)),i.dragging&&e&&!t7(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()},k1=function(e){const r=o(this,qt).value,i=r?h(this,j,T1).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,kd).call(this,e);return}e.edgeScrollFrame===0&&(e.edgeScrollFrame=requestAnimationFrame(l=>{h(this,j,zA).call(this,e,l)}))},zA=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,T1).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,C1).call(this,e))}h(this,j,k1).call(this,e)},kd=function(e){e.edgeScrollFrame!==0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(e.edgeScrollFrame),e.edgeScrollFrame=0,e.edgeScrollTimestamp=null,e.edgeScrollRemainder=0},T1=function(e,r){const i=e.getBoundingClientRect();return r>=i.left&&r<i.left+Rn?-Hd*(i.left+Rn-r)/Rn:r>i.right-Rn&&r<=i.right?Hd*(r-(i.right-Rn))/Rn:0},C1=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,HA).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,ZA).call(this,e,p)))},R1=function(e){return{channelId:e.channelId,pages:e.provisionalPages,carriedArtifactId:e.artifactId}},HA=function(e){return new Map([...e.querySelectorAll(".tab:not([dragging])")].map(r=>[r.dataset.artifactId??"",r.getBoundingClientRect().left]))},ZA=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,dh=new WeakMap,UA=function(){o(this,ah)||typeof document>"u"||!document.fonts||(d(this,ah,!0),document.fonts.ready.then(()=>{this.isConnected&&(d(this,Bn,!0),h(this,j,Ys).call(this,!0))}))},Ys=function(e,r=!1,i=!1){o(this,kr)||d(this,kr,e),e&&r&&(d(this,pi,!0),d(this,mi,i&&!o(this,En))),!(o(this,Jo)||o(this,ws)!==0)&&(d(this,Jo,!0),queueMicrotask(()=>{if(d(this,Jo,!1),!!this.isConnected){if(typeof requestAnimationFrame!="function"){h(this,j,Td).call(this);return}d(this,ws,requestAnimationFrame(()=>{d(this,ws,0),h(this,j,Td).call(this)}))}}))},Td=function(){var l,c;const e=o(this,qt).value;if(!e)return;o(this,Bn)&&(d(this,Bn,!1),h(this,j,qA).call(this,e)),h(this,j,VA).call(this,e),h(this,j,FA).call(this,e);const r=((l=o(this,nt))==null?void 0:l.dragging)===!0,i=o(this,pi),s=i&&o(this,mi),a=!r&&(i||o(this,kr)&&!o(this,vi));r?d(this,kr,i):(d(this,kr,!1),d(this,pi,!1),d(this,mi,!1),i&&d(this,vi,!1)),a&&h(this,j,BA).call(this,e,s),h(this,j,jc).call(this,e),(c=o(this,As))==null||c.refresh()},FA=function(e){for(const r of e.querySelectorAll(".tab-label"))r.toggleAttribute("data-overflow",r.scrollWidth>r.clientWidth)},qA=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=Cc(c.paddingLeft)+Cc(c.paddingRight)+Cc(c.borderLeftWidth)+Cc(c.borderRightWidth),p=Math.ceil(l.width)+u>tN+nN?"capped":"hugging";i.dataset.compression!==p&&(i.dataset.compression=p)}},VA=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,kr,!0),h(this,j,Td).call(this)):h(this,j,Ys).call(this,!0)})),o(this,_s).observe(e),d(this,Ml,e),(i=o(this,As))==null||i.dispose(),d(this,As,Kz(e,{items:".tab:not(.dragged)",distance:rN,edges:"both"})))},BA=function(e,r){const i=e.querySelector('.tab[aria-selected="true"]');if(!i){h(this,j,La).call(this);return}const s=e.getBoundingClientRect(),a=i.getBoundingClientRect(),l=Cc(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,La).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))},La=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)},jA=function(e){var i;if(o(this,En)===e||(d(this,En,e),!e))return;h(this,j,La).call(this),d(this,mi,!1),d(this,vi,!1);const r=o(this,nt);if(r!==null){h(this,j,kd).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,Ys).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 Qz=fn(Xz);function e7(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 t7(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}function Cc(n){const t=Number.parseFloat(n);return Number.isFinite(t)?t:0}let n7=0;var Ko,Vt,fh,Rt,yi,Tr,zl,wi,ph,kn,Ef,kf,mh,jl,WA,Tf,Cf,GA,Rf,If;class r7 extends dn{constructor(){super(...arguments);m(this,jl);m(this,Ko,new Oz(()=>this.render()));m(this,Vt,new y_(()=>this.render()));m(this,fh,`channel-switcher-trigger-${++n7}`);m(this,Rt,null);m(this,yi,null);m(this,Tr,!1);m(this,zl,null);m(this,wi,null);m(this,ph,Jn());m(this,kn,null);m(this,Ef,e=>{var r,i,s;(r=o(this,Rt))==null||r.removeAttribute("open"),((i=o(this,wi))==null?void 0:i.display.focusedChannelId)!==e&&((s=o(this,zl))==null||s.focusChannel(e).catch(()=>{}))});m(this,kf,e=>{o(this,Tr)||(d(this,Tr,!0),this.render(),e.detail===0&&requestAnimationFrame(()=>{var r;(r=o(this,Rt))!=null&&r.hasAttribute("open")&&h(this,jl,WA).call(this,0)}))});m(this,mh,e=>{const r=o(this,Rt);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,Rt))==null?void 0:r.querySelector(".channel-switcher-pop-body"))==null?void 0:i.scrollTop)??0,result:null})});m(this,Cf,(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,Rf,e=>{var r;(r=o(this,yi))==null||r.disconnect(),d(this,yi,null),o(this,Rt)!==null&&o(this,kn)===null&&o(this,Vt).disconnect(),d(this,Rt,e instanceof HTMLElement?e:null),o(this,Rt)!==null&&(o(this,Vt).connect(),d(this,yi,new MutationObserver(o(this,If))),o(this,yi).observe(o(this,Rt),{attributes:!0,attributeFilter:["open"]}))});m(this,If,()=>{var e;(((e=o(this,Rt))==null?void 0:e.hasAttribute("open"))??!0)||o(this,kn)===null&&(d(this,Tr,!1),this.render())})}connected(){o(this,Ko).connect(),document.addEventListener("keydown",o(this,mh))}template(e,r,i={}){var l;d(this,zl,e),d(this,wi,r);const s=i.collapsed||i.sidebarTransitioning;(i.sidebarTransitioning||!s||r.focusedChannel===null)&&d(this,Tr,!1),o(this,Vt).update(e,r,{management:!0,dragging:!0,revealMovedRow:!0,onDeleteStart:o(this,Tf),onDeleteEnd:o(this,Cf),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,GA).call(this,a)),o(this,Ko).configure({connectionOwner:i.connectionOwner,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,ph))}>
|
|
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,fh)}
|
|
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,Tr)?W`
|
|
776
|
+
<tv-popover
|
|
777
|
+
class="channel-switcher-pop"
|
|
778
|
+
?dragging=${o(this,Vt).dragging}
|
|
779
|
+
trigger=${o(this,fh)}
|
|
780
|
+
${vt(o(this,Rf))}
|
|
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
|
+
${Qz(e,r.focusedChannel,null,i.onTabReorderChange,i.sidebarTransitioning)}
|
|
805
|
+
<div class="top-bar-controls">
|
|
806
|
+
${qz((l=i.connectionOwner)==null?void 0:l.connection)}
|
|
807
|
+
${Yz(e)}
|
|
808
|
+
${o(this,Ko).template()}
|
|
809
|
+
</div>
|
|
810
|
+
</header>
|
|
811
|
+
${o(this,Vt).overlayTemplate()}
|
|
812
|
+
`}disconnected(){var e;o(this,Ko).disconnect(),document.removeEventListener("keydown",o(this,mh)),o(this,Vt).disconnect(),(e=o(this,yi))==null||e.disconnect(),d(this,yi,null),d(this,Rt,null),d(this,Tr,!1),d(this,zl,null),d(this,wi,null),d(this,kn,null)}}Ko=new WeakMap,Vt=new WeakMap,fh=new WeakMap,Rt=new WeakMap,yi=new WeakMap,Tr=new WeakMap,zl=new WeakMap,wi=new WeakMap,ph=new WeakMap,kn=new WeakMap,Ef=new WeakMap,kf=new WeakMap,mh=new WeakMap,jl=new WeakSet,WA=function(e){var r;ou((r=o(this,Rt))==null?void 0:r.querySelectorAll('.channel[role="option"]')[e])},Tf=new WeakMap,Cf=new WeakMap,GA=function(e){var u,f;if(o(this,kn)!==e||o(this,wi)===null)return;d(this,kn,null);const r=o(this,wi).focusedChannel;d(this,Tr,r!==null),this.render();const i=o(this,Rt);if(i===null){o(this,Vt).disconnect(),(f=(u=o(this,ph).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,wi).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"}))},Rf=new WeakMap,If=new WeakMap;const i7=fn(r7);var Cr,gh,Xo,Hl,It,un,Tn,Cn,Qo,Ie,jn,Es,Zl,ks,vh,$f,ea,xf,Pf,Df,K,Cd,I1,JA,yh,Of,Fi,Ks,Wc,Rd,$1,YA,KA,Lf,Mf,Nf,wh,zf,Xs,Gc,XA;class s7 extends dn{constructor(){super(...arguments);m(this,K);m(this,Cr,null);m(this,gh);m(this,Xo,null);m(this,Hl,null);m(this,It,qh);m(this,un,!1);m(this,Tn,null);m(this,Cn,null);m(this,Qo,null);m(this,Ie,!1);m(this,jn,!1);m(this,Es,qh);m(this,Zl,0);m(this,ks,null);m(this,vh,e=>{var r;if(e.key==="Escape"&&o(this,Tn)!==null){e.preventDefault(),e.stopPropagation(),h(this,K,Xs).call(this);return}L4(e,navigator.platform)&&(e.preventDefault(),e.stopPropagation(),(r=o(this,Cr))==null||r.handleNavigationKey(e.key))});m(this,$f,e=>{d(this,gh,e??void 0),this.render()});m(this,ea,()=>{this.render()});m(this,xf,()=>h(this,K,Cd).call(this,!0));m(this,Pf,()=>h(this,K,Cd).call(this,!1));m(this,Df,()=>{const e=o(this,Ie)?!o(this,jn):!o(this,un);h(this,K,Cd).call(this,e)});m(this,yh,e=>{const r=o(this,ks),i=h(this,K,Ks).call(this).closest("#app");if(!r||!i)return;d(this,Es,e);const s=oN(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,Ks).call(this);l.style.removeProperty("left"),l.style.removeProperty("top")});m(this,Of,e=>{var s;if(!o(this,Ie))return;const r=e===0;if(r!==o(this,jn))return;const i=document.activeElement===o(this,Cn);h(this,K,Fi).call(this,r),this.render(),i&&((s=o(this,Cn))==null||s.focus({preventScroll:!0}))});m(this,Lf,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,Xo))==null?void 0:s.commit(o(this,It)))??o(this,It);h(this,K,Gc).call(this,r.root,i)});m(this,wh,e=>{const r=o(this,Tn);r===null||e.pointerId!==r.pointerId||h(this,K,Xs).call(this)});m(this,zf,e=>{var i;const r=e.currentTarget.closest("#app");r!==null&&((i=o(this,Xo))==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,ea)),i.addEventListener("change",o(this,ea))),d(this,Cr,i));const l=o(this,Xo)!==s,c=o(this,Hl)!==a;return l&&(h(this,K,Xs).call(this),d(this,Xo,s),d(this,It,s.read()??qh)),c&&(h(this,K,Xs).call(this),d(this,Hl,a),d(this,un,a.read())),(l||c)&&h(this,K,Fi).call(this,o(this,un)),super.update(e,r)}connected(){var e;(e=o(this,Cr))==null||e.addEventListener("change",o(this,ea)),document.addEventListener("keydown",o(this,vh),{capture:!0})}disconnected(){var e,r;h(this,K,Xs).call(this),o(this,Ie)?h(this,K,Fi).call(this,o(this,jn)):(e=o(this,Qo))==null||e.cancel(),(r=o(this,Cr))==null||r.removeEventListener("change",o(this,ea)),document.removeEventListener("keydown",o(this,vh),{capture:!0})}template(e,r){const i=PO(e.snapshot,r.serverURL),s=e.snapshot,a=a7(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,KA).call(this)}
|
|
820
|
+
>
|
|
821
|
+
${a?h(this,K,XA).call(this,e,s,r):null}
|
|
822
|
+
${i.kind==="needs-upgrade"?bz(i.instructions,r.desktopUpdate,aA(r.electronMode&&!a)):l7(i)?YN(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,gh=new WeakMap,Xo=new WeakMap,Hl=new WeakMap,It=new WeakMap,un=new WeakMap,Tn=new WeakMap,Cn=new WeakMap,Qo=new WeakMap,Ie=new WeakMap,jn=new WeakMap,Es=new WeakMap,Zl=new WeakMap,ks=new WeakMap,vh=new WeakMap,$f=new WeakMap,ea=new WeakMap,xf=new WeakMap,Pf=new WeakMap,Df=new WeakMap,K=new WeakSet,Cd=function(e){var c,u;if(!o(this,Ie)&&o(this,un)===e||o(this,Ie)&&o(this,jn)===e)return;h(this,K,Xs).call(this);const r=document.activeElement===o(this,Cn);if((c=o(this,Hl))==null||c.setCollapsed(e),matchMedia("(prefers-reduced-motion: reduce)").matches){h(this,K,Fi).call(this,e),this.render(),r&&((u=o(this,Cn))==null||u.focus({preventScroll:!0}));return}if(d(this,jn,e),o(this,Ie)){h(this,K,Wc).call(this),h(this,K,I1).call(this);return}const i=h(this,K,Ks).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,Fi).call(this,e),this.render();return}for(const f of s.getAnimations({subtree:!0}))f.cancel();d(this,Ie,!0),d(this,Zl,a.top-l.top),d(this,ks,null),i.style.left=`${a.left-l.left}px`,i.style.top=`${o(this,Zl)}px`,h(this,K,Wc).call(this),this.render(),queueMicrotask(()=>{o(this,Ie)&&(h(this,K,JA).call(this),r&&i.focus({preventScroll:!0}),h(this,K,I1).call(this))})},I1=function(){const e=h(this,K,Ks).call(this).closest("#app"),r=o(this,Qo);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,yh),onFinish:o(this,Of)})},JA=function(){const r=h(this,K,Ks).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,Fi).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,Zl),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,yh).call(this,o(this,Es))},yh=new WeakMap,Of=new WeakMap,Fi=function(e){var r;(r=o(this,Qo))==null||r.cancel(),d(this,un,e),d(this,Ie,!1),d(this,Es,e?0:o(this,It)),d(this,Qo,new lN(o(this,Es))),d(this,ks,null),h(this,K,YA).call(this),h(this,K,Wc).call(this)},Ks=function(){if(o(this,Cn)!==null)return o(this,Cn);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,Cn,e),h(this,K,Wc).call(this),e},Wc=function(){var s;const e=o(this,Cn);if(e===null)return;const r=o(this,Ie)?o(this,jn):o(this,un);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,$1).call(this,"expanded-paint"),h(this,K,$1).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},$1=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},YA=function(){const e=o(this,Cn);e!==null&&(e.style.removeProperty("left"),e.style.removeProperty("top"))},KA=function(){const e=[`--sidebar-width: ${o(this,It)}px`];return o(this,Ie)&&e.push(`--motion-boundary: ${o(this,Es)}px`),e.join("; ")},Lf=new WeakMap,Mf=new WeakMap,Nf=new WeakMap,wh=new WeakMap,zf=new WeakMap,Xs=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,Fi).call(this,o(this,un)),e.style.setProperty("--sidebar-width",`${o(this,It)}px`)},XA=function(e,r,i){const s=!o(this,un)||o(this,Ie),a=h(this,K,Ks).call(this);return W`
|
|
826
|
+
${s?W`
|
|
827
|
+
<aside class="app-sidebar">
|
|
828
|
+
${JM(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,Lf)}
|
|
835
|
+
@pointermove=${o(this,Mf)}
|
|
836
|
+
@pointerup=${o(this,Nf)}
|
|
837
|
+
@pointercancel=${o(this,wh)}
|
|
838
|
+
@lostpointercapture=${o(this,wh)}
|
|
839
|
+
@dblclick=${o(this,zf)}
|
|
840
|
+
></div>
|
|
841
|
+
`}
|
|
842
|
+
`:null}
|
|
843
|
+
<main class="app-main">
|
|
844
|
+
${i7(e,r,{connectionOwner:i.connectionOwner,updatePresentation:i.updatePresentation,desktopRecommendation:i.desktopRecommendation,desktopUpdate:i.desktopUpdate,onTabReorderChange:o(this,$f),collapsed:o(this,un),onExpandSidebar:o(this,Pf),sidebarToggle:o(this,Ie)?null:o(this,un)?a:void 0,sidebarTransitioning:o(this,Ie)})}
|
|
845
|
+
${BN(e,r.focusedChannel,o(this,gh),o(this,Ie))}
|
|
846
|
+
</main>
|
|
847
|
+
${o(this,Ie)?a:null}
|
|
848
|
+
`};const o7=fn(s7);function a7(n,t){return n.kind==="connected"||n.kind==="no-channel"||n.kind==="empty-channel"||n.kind==="disconnected"||n.kind==="error"&&t}function l7(n){return n.kind!=="connected"&&n.kind!=="no-channel"&&n.kind!=="empty-channel"}const QA="television-appearance-mode";function c7(n){return n==="system"||n==="light"||n==="dark"}function u7(){try{const n=window.localStorage.getItem(QA);return c7(n)?n:"system"}catch{return"system"}}function e4(){return window.__televisionAppearanceResolver??dO(u7())}function h7(n,t){return t==="light"||t==="dark"?t:n}function d7(n){e4().setPreference(n);try{window.localStorage.setItem(QA,n)}catch{}}document.documentElement.dataset.tvBundleVersion=uv();Object.defineProperty(window,"__tvVersion",{value:uv(),writable:!1,configurable:!1});e4();const f7=R7(),Ir=bi();Ir?document.documentElement.dataset.platform="electron":delete document.documentElement.dataset.platform;const t4=oa(window.location.origin),n4=E$(),p7=new AT(Ir?"television-electron":"television-browser",_T()),m7=new YD(window.localStorage),g7=new GD(window.localStorage),a8=PS(),v7=a8?x$({storage:a8,clientApp:Ir?"desktop":"browser",desktopAppVersion:Ir?O6():null}):null,Tv=tO({search:window.location.search}),Kn=hv(),r4=new aO,Cv=oO({detection:Tv,navigationLatch:Kn,presentation:r4}),Le=new ND({localStore:p7,serverURL:t4,launchToken:n4,telemetryMeta:v7,navigationPending:()=>Kn.pending,...Tv.electron?{decideBoot:n=>Cv.decideBoot(n)}:{}}),y7=n=>{hT(yt,n)},yt=new tT({connectionOwner:Le,navigationKeyHandler:y7,retainedGateHalted:()=>Cv.gated}),io=globalThis.__televisionNativeBridge;Ir&&io&&io.onNavigationKey(n=>yt.handleNavigationKey(n));const w7=new hO({electron:Ir,bridge:io});if(n4){const n=new URL(window.location.href);n.searchParams.delete("token"),window.history.replaceState(window.history.state,"",`${n.pathname}${n.search}${n.hash}`)}eO({owner:Le,navigationLatch:Kn});Cv.attach(Le);const b7=()=>{const n=Le.connection;n.status==="connected"&&n.client.artifacts.list().then(({artifacts:t})=>{const e=new Set(t.map(r=>r.id));jD(e)}).catch(()=>{})},i4=()=>{Le.connection.status==="connected"&&cN(Le.connection.url)};let Bd=null,x1=null,s4=Le.connection.status;const S7=()=>{Kn.pending||Kn.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()})},o4=(n,t,e)=>{if(Kn.pending||Le.connection.status!=="connected"||yt.snapshot.connection.status!=="connected"||!yt.snapshot.ready)return;const r={activeThemeName:n,consentIds:new Set(t)},i=Bd,s=dN(),a=i!==null&&i.activeThemeName!==r.activeThemeName,l=(i==null?void 0:i.activeThemeName)!==null&&(i==null?void 0:i.activeThemeName)!==void 0&&i.consentIds.has(i.activeThemeName),c=r.activeThemeName!==null&&r.consentIds.has(r.activeThemeName),u=i!==null&&!a&&l&&!c,f=i!==null&&h4(i.consentIds,r.consentIds);if(Bd=r,s!==null&&(a||u)){S7();return}if(s===null&&c){Sb(Le.connection.url);return}s!==null&&c&&e&&!a&&f&&Sb(Le.connection.url)},_7=()=>{const n=document.documentElement.dataset.theme;if(n!=="light"&&n!=="dark")throw new Error("Application root has no effective theme-frame appearance");return n},a4=(n,t)=>{if(Kn.pending||Le.connection.status!=="connected"||yt.snapshot.connection.status!=="connected"||!yt.snapshot.ready)return;const e={activeThemeName:n,serverURL:Le.connection.url,appearance:_7()},r=x1;x1=e,!(!t&&(r==null?void 0:r.activeThemeName)===e.activeThemeName&&r.serverURL===e.serverURL&&r.appearance===e.appearance)&&fN(e.serverURL,e.activeThemeName,()=>yt.listThemes())},l4=()=>{if(!Kn.pending){if(s4=Le.connection.status,Le.connection.status!=="connected"){uN(),hN(),pN(),Bd=null,x1=null;return}i4(),b7()}};let P1,D1;const Rv=(n,t)=>{const e=h7(n,t);e!==P1&&(d7(e),P1=e),e!==D1&&Ir&&typeof(io==null?void 0:io.setAppearanceMode)=="function"&&(io.setAppearanceMode(e),D1=e)},ip=()=>{const n=yt.snapshot;if(n.connection.status!=="connected"){P1=void 0,D1=void 0;return}n.ready&&(Rv(n.display.appearanceMode,n.display.activeThemeColorScheme),s4===Le.connection.status&&(o4(n.display.activeThemeName,n.display.themeJavaScriptConsentIds,!1),a4(n.display.activeThemeName,!1)))},A7=n=>{if(Kn.pending)return;Rv(yt.snapshot.display.appearanceMode,n.activeThemeColorScheme);const t=Bd,e=t!==null&&t.activeThemeName===n.themeName&&!h4(t.consentIds,new Set(n.themeJavaScriptConsentIds));o4(n.themeName,n.themeJavaScriptConsentIds,!0),!(Kn.pending||e)&&(i4(),a4(n.themeName,!0))},E7=n=>{Kn.pending||Rv(n.appearanceMode,yt.snapshot.display.activeThemeColorScheme)};l4();ip();Le.addEventListener("change",l4);yt.addEventListener("change",ip);yt.addEventListener("theme-changed",A7);yt.addEventListener("appearance-changed",E7);const k7=new MutationObserver(()=>{ip()});k7.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});x8.register("ServerConnectionOwner",()=>Le);x8.register("ApplicationService",()=>yt);const Kc=globalThis.__telepath??(globalThis.__telepath={});Kc.applicationService=yt;Kc.connectionOwner=Le;const T7=Kc.renderCompleteCallbacks??(Kc.renderCompleteCallbacks=new Set);Ir&&document.body.classList.add("electron");let l8=!1,c8=!1;const C7=n=>{if(!f7||c8||n!=="connected"&&n!=="no-channel"&&n!=="empty-channel")return;const t=document.querySelector("#settings-popover");t!==null&&(c8=!0,t.setAttribute("open",""))},c4=()=>{l8||(Ag(o7(yt,{serverURL:t4,electronMode:Ir,connectionOwner:Le,updatePresentation:r4,desktopRecommendation:Tv,desktopUpdate:w7,sidebarWidthPreference:m7,sidebarCollapsedPreference:g7,onRenderComplete(n){C7(n);for(const t of T7)t(n)}}),document.body),l8=!0,ip())},u4=()=>{const n=Le.connection;n.bootState==="pending"&&!n.hasAuthRejected&&Le.connectError===null||(Le.removeEventListener("change",u4),c4())};Ir?Le.addEventListener("change",u4):c4();Le.connect();function R7(){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 h4(n,t){if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0}
|