@telepath-computer/television 0.1.114 → 0.1.116

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.
@@ -1,9 +1,9 @@
1
- var Gw=Object.defineProperty;var Kd=n=>{throw TypeError(n)};var qw=(n,t,e)=>t in n?Gw(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var m=(n,t,e)=>qw(n,typeof t!="symbol"?t+"":t,e),dc=(n,t,e)=>t.has(n)||Kd("Cannot "+e);var l=(n,t,e)=>(dc(n,t,"read from private field"),e?e.call(n):t.get(n)),w=(n,t,e)=>t.has(n)?Kd("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),S=(n,t,e,r)=>(dc(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e),f=(n,t,e)=>(dc(n,t,"access private method"),e);var Jd=(n,t,e,r)=>({set _(i){S(n,t,i,e)},get _(){return l(n,t,r)}});(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function e(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=e(i);fetch(i.href,s)}})();var lr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yw(n){if(n.__esModule)return n;var t=n.default;if(typeof t=="function"){var e=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),e}var Qd=Object.prototype.toString,tm=function(t){var e=Qd.call(t),r=e==="[object Arguments]";return r||(r=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Qd.call(t.callee)==="[object Function]"),r},pc,ep;function Xw(){if(ep)return pc;ep=1;var n;if(!Object.keys){var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=tm,i=Object.prototype.propertyIsEnumerable,s=!i.call({toString:null},"toString"),o=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],c=function(v){var g=v.constructor;return g&&g.prototype===v},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if(typeof window>"u")return!1;for(var v in window)try{if(!u["$"+v]&&t.call(window,v)&&window[v]!==null&&typeof window[v]=="object")try{c(window[v])}catch{return!0}}catch{return!0}return!1}(),p=function(v){if(typeof window>"u"||!h)return c(v);try{return c(v)}catch{return!1}};n=function(g){var _=g!==null&&typeof g=="object",k=e.call(g)==="[object Function]",T=r(g),P=_&&e.call(g)==="[object String]",R=[];if(!_&&!k&&!T)throw new TypeError("Object.keys called on a non-object");var Z=o&&k;if(P&&g.length>0&&!t.call(g,0))for(var N=0;N<g.length;++N)R.push(String(N));if(T&&g.length>0)for(var F=0;F<g.length;++F)R.push(String(F));else for(var Y in g)!(Z&&Y==="prototype")&&t.call(g,Y)&&R.push(String(Y));if(s)for(var j=p(g),oe=0;oe<a.length;++oe)!(j&&a[oe]==="constructor")&&t.call(g,a[oe])&&R.push(a[oe]);return R}}return pc=n,pc}var Kw=Array.prototype.slice,Jw=tm,tp=Object.keys,ka=tp?function(t){return tp(t)}:Xw(),np=Object.keys;ka.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(r){return Jw(r)?np(Kw.call(r)):np(r)})}else Object.keys=ka;return Object.keys||ka};var Qw=ka,xa=Object.defineProperty||!1;if(xa)try{xa({},"a",{value:1})}catch{xa=!1}var zo=xa,bn=SyntaxError,X=TypeError,e0=Object.getOwnPropertyDescriptor,Ea=e0;if(Ea)try{Ea([],"length")}catch{Ea=null}var qi=Ea,rp=zo,t0=bn,Jr=X,ip=qi,nm=function(t,e,r){if(!t||typeof t!="object"&&typeof t!="function")throw new Jr("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new Jr("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Jr("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Jr("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Jr("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Jr("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,c=!!ip&&ip(t,e);if(rp)rp(t,e,{configurable:o===null&&c?c.configurable:!o,enumerable:i===null&&c?c.enumerable:!i,value:r,writable:s===null&&c?c.writable:!s});else if(a||!i&&!s&&!o)t[e]=r;else throw new t0("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},cu=zo,rm=function(){return!!cu};rm.hasArrayLengthDefineBug=function(){if(!cu)return null;try{return cu([],"length",{value:1}).length!==1}catch{return!0}};var Pl=rm,n0=Qw,r0=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",i0=Object.prototype.toString,s0=Array.prototype.concat,sp=nm,o0=function(n){return typeof n=="function"&&i0.call(n)==="[object Function]"},im=Pl(),a0=function(n,t,e,r){if(t in n){if(r===!0){if(n[t]===e)return}else if(!o0(r)||!r())return}im?sp(n,t,e,!0):sp(n,t,e)},sm=function(n,t){var e=arguments.length>2?arguments[2]:{},r=n0(t);r0&&(r=s0.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i<r.length;i+=1)a0(n,r[i],t[r[i]],e[r[i]])};sm.supportsDescriptors=!!im;var Zr=sm,Aa={exports:{}};typeof self<"u"?Aa.exports=self:typeof window<"u"?Aa.exports=window:Aa.exports=Function("return this")();var om=Aa.exports,l0=om,am=function(){return typeof lr!="object"||!lr||lr.Math!==Math||lr.Array!==Array?l0:lr},c0=Zr,u0=qi,h0=am,d0=function(){var t=h0();if(c0.supportsDescriptors){var e=u0(t,"globalThis");(!e||e.configurable&&(e.enumerable||!e.writable||globalThis!==t))&&Object.defineProperty(t,"globalThis",{configurable:!0,enumerable:!1,value:t,writable:!0})}else(typeof globalThis!="object"||globalThis!==t)&&(t.globalThis=t);return t},p0=Zr,f0=om,lm=am,g0=d0,m0=lm(),cm=function(){return m0};p0(cm,{getPolyfill:lm,implementation:f0,shim:g0});var wh=cm,wn=function(t){return!!t&&(typeof t=="function"||typeof t=="object")},Sh=Object,um=Error,v0=EvalError,y0=RangeError,_h=ReferenceError,b0=URIError,w0=Math.abs,S0=Math.floor,_0=Math.max,k0=Math.min,x0=Math.pow,E0=Math.round,kh=Number.isNaN||function(t){return t!==t},A0=kh,$0=function(t){return A0(t)||t===0?t:t<0?-1:1},Yi=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 o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==i||a.enumerable!==!0)return!1}return!0},op=typeof Symbol<"u"&&Symbol,T0=Yi,xh=function(){return typeof op!="function"||typeof Symbol!="function"||typeof op("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:T0()},hm=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,I0=Sh,dm=I0.getPrototypeOf||null,C0="Function.prototype.bind called on incompatible ",R0=Object.prototype.toString,P0=Math.max,D0="[object Function]",ap=function(t,e){for(var r=[],i=0;i<t.length;i+=1)r[i]=t[i];for(var s=0;s<e.length;s+=1)r[s+t.length]=e[s];return r},L0=function(t,e){for(var r=[],i=e,s=0;i<t.length;i+=1,s+=1)r[s]=t[i];return r},z0=function(n,t){for(var e="",r=0;r<n.length;r+=1)e+=n[r],r+1<n.length&&(e+=t);return e},O0=function(t){var e=this;if(typeof e!="function"||R0.apply(e)!==D0)throw new TypeError(C0+e);for(var r=L0(arguments,1),i,s=function(){if(this instanceof i){var h=e.apply(this,ap(r,arguments));return Object(h)===h?h:this}return e.apply(t,ap(r,arguments))},o=P0(0,e.length-r.length),a=[],c=0;c<o;c++)a[c]="$"+c;if(i=Function("binder","return function ("+z0(a,",")+"){ return binder.apply(this,arguments); }")(s),e.prototype){var u=function(){};u.prototype=e.prototype,i.prototype=new u,u.prototype=null}return i},M0=O0,Oo=Function.prototype.bind||M0,Eh=Function.prototype.call,Ah=Function.prototype.apply,N0=typeof Reflect<"u"&&Reflect&&Reflect.apply,U0=Oo,F0=Ah,H0=Eh,Z0=N0,pm=Z0||U0.call(H0,F0),W0=Oo,V0=X,B0=Eh,j0=pm,Dl=function(t){if(t.length<1||typeof t[0]!="function")throw new V0("a function is required");return j0(W0,B0,t)},G0=Dl,lp=qi,fm;try{fm=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var fc=!!fm&&lp&&lp(Object.prototype,"__proto__"),gm=Object,cp=gm.getPrototypeOf,q0=fc&&typeof fc.get=="function"?G0([fc.get]):typeof cp=="function"?function(t){return cp(t==null?t:gm(t))}:!1,up=hm,hp=dm,dp=q0,mm=up?function(t){return up(t)}:hp?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return hp(t)}:dp?function(t){return dp(t)}:null,Y0=Function.prototype.call,X0=Object.prototype.hasOwnProperty,K0=Oo,Sn=K0.call(Y0,X0),q,J0=Sh,Q0=um,eS=v0,tS=y0,nS=_h,Zi=bn,vi=X,rS=b0,iS=w0,sS=S0,oS=_0,aS=k0,lS=x0,cS=E0,uS=$0,vm=Function,gc=function(n){try{return vm('"use strict"; return ('+n+").constructor;")()}catch{}},Os=qi,hS=zo,mc=function(){throw new vi},dS=Os?function(){try{return arguments.callee,mc}catch{try{return Os(arguments,"callee").get}catch{return mc}}}():mc,Qr=xh(),Te=mm,pS=dm,fS=hm,ym=Ah,Mo=Eh,ii={},gS=typeof Uint8Array>"u"||!Te?q:Te(Uint8Array),Lr={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?q:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?q:ArrayBuffer,"%ArrayIteratorPrototype%":Qr&&Te?Te([][Symbol.iterator]()):q,"%AsyncFromSyncIteratorPrototype%":q,"%AsyncFunction%":ii,"%AsyncGenerator%":ii,"%AsyncGeneratorFunction%":ii,"%AsyncIteratorPrototype%":ii,"%Atomics%":typeof Atomics>"u"?q:Atomics,"%BigInt%":typeof BigInt>"u"?q:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?q:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?q:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?q:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Q0,"%eval%":eval,"%EvalError%":eS,"%Float16Array%":typeof Float16Array>"u"?q:Float16Array,"%Float32Array%":typeof Float32Array>"u"?q:Float32Array,"%Float64Array%":typeof Float64Array>"u"?q:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?q:FinalizationRegistry,"%Function%":vm,"%GeneratorFunction%":ii,"%Int8Array%":typeof Int8Array>"u"?q:Int8Array,"%Int16Array%":typeof Int16Array>"u"?q:Int16Array,"%Int32Array%":typeof Int32Array>"u"?q:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Qr&&Te?Te(Te([][Symbol.iterator]())):q,"%JSON%":typeof JSON=="object"?JSON:q,"%Map%":typeof Map>"u"?q:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Qr||!Te?q:Te(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":J0,"%Object.getOwnPropertyDescriptor%":Os,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?q:Promise,"%Proxy%":typeof Proxy>"u"?q:Proxy,"%RangeError%":tS,"%ReferenceError%":nS,"%Reflect%":typeof Reflect>"u"?q:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?q:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Qr||!Te?q:Te(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?q:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Qr&&Te?Te(""[Symbol.iterator]()):q,"%Symbol%":Qr?Symbol:q,"%SyntaxError%":Zi,"%ThrowTypeError%":dS,"%TypedArray%":gS,"%TypeError%":vi,"%Uint8Array%":typeof Uint8Array>"u"?q:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?q:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?q:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?q:Uint32Array,"%URIError%":rS,"%WeakMap%":typeof WeakMap>"u"?q:WeakMap,"%WeakRef%":typeof WeakRef>"u"?q:WeakRef,"%WeakSet%":typeof WeakSet>"u"?q:WeakSet,"%Function.prototype.call%":Mo,"%Function.prototype.apply%":ym,"%Object.defineProperty%":hS,"%Object.getPrototypeOf%":pS,"%Math.abs%":iS,"%Math.floor%":sS,"%Math.max%":oS,"%Math.min%":aS,"%Math.pow%":lS,"%Math.round%":cS,"%Math.sign%":uS,"%Reflect.getPrototypeOf%":fS};if(Te)try{null.error}catch(n){var mS=Te(Te(n));Lr["%Error.prototype%"]=mS}var vS=function n(t){var e;if(t==="%AsyncFunction%")e=gc("async function () {}");else if(t==="%GeneratorFunction%")e=gc("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=gc("async function* () {}");else if(t==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&Te&&(e=Te(i.prototype))}return Lr[t]=e,e},pp={__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"]},No=Oo,Ya=Sn,yS=No.call(Mo,Array.prototype.concat),bS=No.call(ym,Array.prototype.splice),fp=No.call(Mo,String.prototype.replace),Xa=No.call(Mo,String.prototype.slice),wS=No.call(Mo,RegExp.prototype.exec),SS=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,_S=/\\(\\)?/g,kS=function(t){var e=Xa(t,0,1),r=Xa(t,-1);if(e==="%"&&r!=="%")throw new Zi("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new Zi("invalid intrinsic syntax, expected opening `%`");var i=[];return fp(t,SS,function(s,o,a,c){i[i.length]=a?fp(c,_S,"$1"):o||s}),i},xS=function(t,e){var r=t,i;if(Ya(pp,r)&&(i=pp[r],r="%"+i[0]+"%"),Ya(Lr,r)){var s=Lr[r];if(s===ii&&(s=vS(r)),typeof s>"u"&&!e)throw new vi("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new Zi("intrinsic "+t+" does not exist!")},yt=function(t,e){if(typeof t!="string"||t.length===0)throw new vi("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new vi('"allowMissing" argument must be a boolean');if(wS(/^%?[^%]*%?$/,t)===null)throw new Zi("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=kS(t),i=r.length>0?r[0]:"",s=xS("%"+i+"%",e),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],bS(r,yS([0,1],u)));for(var h=1,p=!0;h<r.length;h+=1){var v=r[h],g=Xa(v,0,1),_=Xa(v,-1);if((g==='"'||g==="'"||g==="`"||_==='"'||_==="'"||_==="`")&&g!==_)throw new Zi("property names with quotes must have matching quotes");if((v==="constructor"||!p)&&(c=!0),i+="."+v,o="%"+i+"%",Ya(Lr,o))a=Lr[o];else if(a!=null){if(!(v in a)){if(!e)throw new vi("base intrinsic for "+t+" exists, but the property is not available.");return}if(Os&&h+1>=r.length){var k=Os(a,v);p=!!k,p&&"get"in k&&!("originalValue"in k.get)?a=k.get:a=a[v]}else p=Ya(a,v),a=a[v];p&&!c&&(Lr[o]=a)}}return a},vc,gp;function qn(){if(gp)return vc;gp=1;var n=yt,t=Dl,e=t([n("%String.prototype.indexOf%")]);return vc=function(i,s){var o=n(i,!!s);return typeof o=="function"&&e(i,".prototype.")>-1?t([o]):o},vc}var yc,mp;function $h(){if(mp)return yc;mp=1;var n=yt,t=n("%Array%"),e=!t.isArray&&qn()("Object.prototype.toString");return yc=t.isArray||function(i){return e(i)==="[object Array]"},yc}var ES=Pl,vp=zo,bm=ES.hasArrayLengthDefineBug(),AS=bm&&$h(),$S=qn(),TS=$S("Object.prototype.propertyIsEnumerable"),Th=function(t,e,r,i,s,o){if(!vp){if(!t(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&TS(i,s)!==!!o["[[Enumerable]]"])return!1;var a=o["[[Value]]"];return i[s]=a,e(i[s],a)}return bm&&s==="length"&&"[[Value]]"in o&&AS(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(vp(i,s,r(o)),!0)},IS=X,cs=Sn,CS={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},Xi=function(t){if(!t||typeof t!="object")return!1;for(var e in t)if(cs(t,e)&&!CS[e])return!1;var r=cs(t,"[[Value]]")||cs(t,"[[Writable]]"),i=cs(t,"[[Get]]")||cs(t,"[[Set]]");if(r&&i)throw new IS("Property Descriptors may not be both accessor and data descriptors");return!0},wm=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},RS=X,PS=Xi,DS=wm,Sm=function(t){if(typeof t<"u"&&!PS(t))throw new RS("Assertion failed: `Desc` must be a Property Descriptor");return DS(t)},LS=X,yp=Sn,zS=Xi,_m=function(t){if(typeof t>"u")return!1;if(!zS(t))throw new LS("Assertion failed: `Desc` must be a Property Descriptor");return!(!yp(t,"[[Value]]")&&!yp(t,"[[Writable]]"))},Ki=function(t){return typeof t=="string"||typeof t=="symbol"},bp=kh,km=function(t,e){return t===e?t===0?1/t===1/e:!0:bp(t)&&bp(e)},wp=X,OS=wn,MS=Th,NS=Sm,US=_m,FS=Ki,HS=km,Ih=function(t,e,r){if(!OS(t))throw new wp("Assertion failed: Type(O) is not Object");if(!FS(e))throw new wp("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return MS(US,HS,NS,t,e,i)},xm=Function.prototype.toString,fi=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,uu,$a;if(typeof fi=="function"&&typeof Object.defineProperty=="function")try{uu=Object.defineProperty({},"length",{get:function(){throw $a}}),$a={},fi(function(){throw 42},null,uu)}catch(n){n!==$a&&(fi=null)}else fi=null;var ZS=/^\s*class\b/,hu=function(t){try{var e=xm.call(t);return ZS.test(e)}catch{return!1}},bc=function(t){try{return hu(t)?!1:(xm.call(t),!0)}catch{return!1}},Ta=Object.prototype.toString,WS="[object Object]",VS="[object Function]",BS="[object GeneratorFunction]",jS="[object HTMLAllCollection]",GS="[object HTML document.all class]",qS="[object HTMLCollection]",YS=typeof Symbol=="function"&&!!Symbol.toStringTag,XS=!(0 in[,]),du=function(){return!1};if(typeof document=="object"){var KS=document.all;Ta.call(KS)===Ta.call(document.all)&&(du=function(t){if((XS||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=Ta.call(t);return(e===jS||e===GS||e===qS||e===WS)&&t("")==null}catch{}return!1})}var Em=fi?function(t){if(du(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{fi(t,null,uu)}catch(e){if(e!==$a)return!1}return!hu(t)&&bc(t)}:function(t){if(du(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(YS)return bc(t);if(hu(t))return!1;var e=Ta.call(t);return e!==VS&&e!==BS&&!/^\[object HTML/.test(e)?!1:bc(t)},JS=Em,QS=function(t){return!!t},Pt=Sn,ia=X,e_=wn,Sp=JS,wc=QS,t_=function(t){if(!e_(t))throw new ia("ToPropertyDescriptor requires an object");var e={};if(Pt(t,"enumerable")&&(e["[[Enumerable]]"]=wc(t.enumerable)),Pt(t,"configurable")&&(e["[[Configurable]]"]=wc(t.configurable)),Pt(t,"value")&&(e["[[Value]]"]=t.value),Pt(t,"writable")&&(e["[[Writable]]"]=wc(t.writable)),Pt(t,"get")){var r=t.get;if(typeof r<"u"&&!Sp(r))throw new ia("getter must be a function");e["[[Get]]"]=r}if(Pt(t,"set")){var i=t.set;if(typeof i<"u"&&!Sp(i))throw new ia("setter must be a function");e["[[Set]]"]=i}if((Pt(e,"[[Get]]")||Pt(e,"[[Set]]"))&&(Pt(e,"[[Value]]")||Pt(e,"[[Writable]]")))throw new ia("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},Sc=X,n_=wn,_p=Xi,r_=Th,i_=Sm,s_=_m,o_=Ki,a_=km,l_=t_,c_=function(t,e,r){if(!n_(t))throw new Sc("Assertion failed: Type(O) is not Object");if(!o_(e))throw new Sc("Assertion failed: P is not a Property Key");var i=_p(r)?r:l_(r);if(!_p(i))throw new Sc("Assertion failed: Desc is not a valid Property Descriptor");return r_(s_,a_,i_,t,e,i)},kp=X,u_=wn,h_=c_,d_=Ki,p_=function(t,e,r){if(!u_(t))throw new kp("Assertion failed: Type(O) is not Object");if(!d_(e))throw new kp("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return h_(t,e,i)},f_=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,g_=Sh,m_=g_.setPrototypeOf||null,v_=Dl,xp=qi,y_=X,Am={};try{Am.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var b_=!("toString"in Am),_c=xp&&xp(Object.prototype,"__proto__"),w_=b_&&(!!_c&&typeof _c.set=="function"&&v_([_c.set])||function(t,e){if(t==null)throw new y_("set Object.prototype.__proto__ called on null or undefined");return t.__proto__=e,e}),Ep=f_,S_=m_,Ap=w_,__=X,k_=Ep?function(t,e){if(Ep(t,e))return t;throw new __("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:S_||(Ap?function(t,e){return Ap(t,e),t}:null),$p=X,x_=wn,Tp=mm,E_=function(t){if(!x_(t))throw new $p("Assertion failed: O must be an Object");if(!Tp)throw new $p("This environment does not support fetching prototypes.");return Tp(t)},A_=X,$_=k_,T_=wn,I_=E_,C_=function(t,e){if(e!==null&&!T_(e))throw new A_("Assertion failed: V must be Object or Null");try{$_(t,e)}catch{return!1}return I_(t)===e},kc=Ih,Ip=p_,$m=C_,R_=Pl(),Ch=um;function Uo(n,t,e){var r=new Ch(e);return $m(r,Ia),delete r.constructor,Ip(r,"error",n),Ip(r,"suppressed",t),r}R_&&Object.defineProperty(Uo,"prototype",{writable:!1});var Ia=Uo.prototype;if(!kc(Ia,"constructor",Uo)||!kc(Ia,"message","")||!kc(Ia,"name","SuppressedError"))throw new Ch("unable to install SuppressedError.prototype properties; please report this!");$m(Uo.prototype,Ch.prototype);var P_=Uo,D_=P_,Tm=function(){return typeof SuppressedError=="function"?SuppressedError:D_},L_=Zr,Cp=wh(),z_=Tm,O_=function(){var t=z_();return L_(Cp,{SuppressedError:t},{SuppressedError:function(){return Cp.SuppressedError!==t}}),t};O_();var M_=X,N_=Xi,U_=wm,F_=function(t){if(typeof t<"u"&&!N_(t))throw new M_("Assertion failed: `Desc` must be a Property Descriptor");return U_(t)},H_=X,Rp=Sn,Z_=Xi,W_=function(t){if(typeof t>"u")return!1;if(!Z_(t))throw new H_("Assertion failed: `Desc` must be a Property Descriptor");return!(!Rp(t,"[[Value]]")&&!Rp(t,"[[Writable]]"))},Pp=kh,V_=function(t,e){return t===e?t===0?1/t===1/e:!0:Pp(t)&&Pp(e)},Ji=Em,B_=function(t){return!!t},Dt=Sn,sa=X,j_=wn,Dp=Ji,xc=B_,G_=function(t){if(!j_(t))throw new sa("ToPropertyDescriptor requires an object");var e={};if(Dt(t,"enumerable")&&(e["[[Enumerable]]"]=xc(t.enumerable)),Dt(t,"configurable")&&(e["[[Configurable]]"]=xc(t.configurable)),Dt(t,"value")&&(e["[[Value]]"]=t.value),Dt(t,"writable")&&(e["[[Writable]]"]=xc(t.writable)),Dt(t,"get")){var r=t.get;if(typeof r<"u"&&!Dp(r))throw new sa("getter must be a function");e["[[Get]]"]=r}if(Dt(t,"set")){var i=t.set;if(typeof i<"u"&&!Dp(i))throw new sa("setter must be a function");e["[[Set]]"]=i}if((Dt(e,"[[Get]]")||Dt(e,"[[Set]]"))&&(Dt(e,"[[Value]]")||Dt(e,"[[Writable]]")))throw new sa("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},Ec=X,q_=wn,Lp=Xi,Y_=Th,X_=F_,K_=W_,J_=Ki,Q_=V_,ek=G_,Fo=function(t,e,r){if(!q_(t))throw new Ec("Assertion failed: Type(O) is not Object");if(!J_(e))throw new Ec("Assertion failed: P is not a Property Key");var i=Lp(r)?r:ek(r);if(!Lp(i))throw new Ec("Assertion failed: Desc is not a valid Property Descriptor");return Y_(K_,Q_,X_,t,e,i)},tk=Yi(),nk=tk?Symbol.dispose||Symbol("Symbol.dispose"):null,rk=Yi,ik=nk,Rh=function(){return rk()&&Symbol.dispose||ik},sk=xh,ok=Fo,ak=Rh,lk=function(){var t=ak();return sk()&&ok(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},ck=Yi(),uk=ck?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,hk=Yi,dk=uk,Ph=function(){return hk()&&Symbol.asyncDispose||dk},pk=xh,fk=Fo,gk=Ph,mk=function(){var t=gk();return pk()&&fk(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},vk=$h(),yk=yt,bk=qn(),wk=X,Sk=vk,_k=yk("%Reflect.apply%",!0)||bk("Function.prototype.apply"),Ll=function(t,e){var r=arguments.length>2?arguments[2]:[];if(!Sk(r))throw new wk("Assertion failed: optional `argumentsList`, if provided, must be a List");return _k(t,e,r)};const kk={},xk=Object.freeze(Object.defineProperty({__proto__:null,default:kk},Symbol.toStringTag,{value:"Module"})),Ek=Yw(xk);var Dh=typeof Map=="function"&&Map.prototype,Ac=Object.getOwnPropertyDescriptor&&Dh?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Ka=Dh&&Ac&&typeof Ac.get=="function"?Ac.get:null,zp=Dh&&Map.prototype.forEach,Lh=typeof Set=="function"&&Set.prototype,$c=Object.getOwnPropertyDescriptor&&Lh?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Ja=Lh&&$c&&typeof $c.get=="function"?$c.get:null,Op=Lh&&Set.prototype.forEach,Ak=typeof WeakMap=="function"&&WeakMap.prototype,Cs=Ak?WeakMap.prototype.has:null,$k=typeof WeakSet=="function"&&WeakSet.prototype,Rs=$k?WeakSet.prototype.has:null,Tk=typeof WeakRef=="function"&&WeakRef.prototype,Mp=Tk?WeakRef.prototype.deref:null,Ik=Boolean.prototype.valueOf,Ck=Object.prototype.toString,Rk=Function.prototype.toString,Pk=String.prototype.match,zh=String.prototype.slice,Fn=String.prototype.replace,Dk=String.prototype.toUpperCase,Np=String.prototype.toLowerCase,Im=RegExp.prototype.test,Up=Array.prototype.concat,Xt=Array.prototype.join,Lk=Array.prototype.slice,Fp=Math.floor,pu=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Tc=Object.getOwnPropertySymbols,fu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Wi=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ps=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Wi||!0)?Symbol.toStringTag:null,Cm=Object.prototype.propertyIsEnumerable,Hp=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function Zp(n,t){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||Im.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-Fp(-n):Fp(n);if(r!==n){var i=String(r),s=zh.call(t,i.length+1);return Fn.call(i,e,"$&_")+"."+Fn.call(Fn.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Fn.call(t,e,"$&_")}var gu=Ek,Wp=gu.custom,Vp=Dm(Wp)?Wp:null,Rm={__proto__:null,double:'"',single:"'"},zk={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Qi=function n(t,e,r,i){var s=e||{};if(cn(s,"quoteStyle")&&!cn(Rm,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(cn(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=cn(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(cn(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(cn(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return zm(t,s);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var c=String(t);return a?Zp(t,c):c}if(typeof t=="bigint"){var u=String(t)+"n";return a?Zp(t,u):u}var h=typeof s.depth>"u"?5:s.depth;if(typeof r>"u"&&(r=0),r>=h&&h>0&&typeof t=="object")return mu(t)?"[Array]":"[Object]";var p=Qk(s,r);if(typeof i>"u")i=[];else if(Lm(i,t)>=0)return"[Circular]";function v(It,_n,ec){if(_n&&(i=Lk.call(i),i.push(_n)),ec){var Yo={depth:s.depth};return cn(s,"quoteStyle")&&(Yo.quoteStyle=s.quoteStyle),n(It,Yo,r+1,i)}return n(It,s,r+1,i)}if(typeof t=="function"&&!Bp(t)){var g=Vk(t),_=oa(t,v);return"[Function"+(g?": "+g:" (anonymous)")+"]"+(_.length>0?" { "+Xt.call(_,", ")+" }":"")}if(Dm(t)){var k=Wi?Fn.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):fu.call(t);return typeof t=="object"&&!Wi?us(k):k}if(Xk(t)){for(var T="<"+Np.call(String(t.nodeName)),P=t.attributes||[],R=0;R<P.length;R++)T+=" "+P[R].name+"="+Pm(Ok(P[R].value),"double",s);return T+=">",t.childNodes&&t.childNodes.length&&(T+="..."),T+="</"+Np.call(String(t.nodeName))+">",T}if(mu(t)){if(t.length===0)return"[]";var Z=oa(t,v);return p&&!Jk(Z)?"["+vu(Z,p)+"]":"[ "+Xt.call(Z,", ")+" ]"}if(Nk(t)){var N=oa(t,v);return!("cause"in Error.prototype)&&"cause"in t&&!Cm.call(t,"cause")?"{ ["+String(t)+"] "+Xt.call(Up.call("[cause]: "+v(t.cause),N),", ")+" }":N.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Xt.call(N,", ")+" }"}if(typeof t=="object"&&o){if(Vp&&typeof t[Vp]=="function"&&gu)return gu(t,{depth:h-r});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(Bk(t)){var F=[];return zp&&zp.call(t,function(It,_n){F.push(v(_n,t,!0)+" => "+v(It,t))}),jp("Map",Ka.call(t),F,p)}if(qk(t)){var Y=[];return Op&&Op.call(t,function(It){Y.push(v(It,t))}),jp("Set",Ja.call(t),Y,p)}if(jk(t))return Ic("WeakMap");if(Yk(t))return Ic("WeakSet");if(Gk(t))return Ic("WeakRef");if(Fk(t))return us(v(Number(t)));if(Zk(t))return us(v(pu.call(t)));if(Hk(t))return us(Ik.call(t));if(Uk(t))return us(v(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof lr<"u"&&t===lr)return"{ [object globalThis] }";if(!Mk(t)&&!Bp(t)){var j=oa(t,v),oe=Hp?Hp(t)===Object.prototype:t instanceof Object||t.constructor===Object,wt=t instanceof Object?"":"null prototype",Jn=!oe&&Ps&&Object(t)===t&&Ps in t?zh.call(Yn(t),8,-1):wt?"Object":"",Re=oe||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",Qn=Re+(Jn||wt?"["+Xt.call(Up.call([],Jn||[],wt||[]),": ")+"] ":"");return j.length===0?Qn+"{}":p?Qn+"{"+vu(j,p)+"}":Qn+"{ "+Xt.call(j,", ")+" }"}return String(t)};function Pm(n,t,e){var r=e.quoteStyle||t,i=Rm[r];return i+n+i}function Ok(n){return Fn.call(String(n),/"/g,"&quot;")}function Wr(n){return!Ps||!(typeof n=="object"&&(Ps in n||typeof n[Ps]<"u"))}function mu(n){return Yn(n)==="[object Array]"&&Wr(n)}function Mk(n){return Yn(n)==="[object Date]"&&Wr(n)}function Bp(n){return Yn(n)==="[object RegExp]"&&Wr(n)}function Nk(n){return Yn(n)==="[object Error]"&&Wr(n)}function Uk(n){return Yn(n)==="[object String]"&&Wr(n)}function Fk(n){return Yn(n)==="[object Number]"&&Wr(n)}function Hk(n){return Yn(n)==="[object Boolean]"&&Wr(n)}function Dm(n){if(Wi)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!fu)return!1;try{return fu.call(n),!0}catch{}return!1}function Zk(n){if(!n||typeof n!="object"||!pu)return!1;try{return pu.call(n),!0}catch{}return!1}var Wk=Object.prototype.hasOwnProperty||function(n){return n in this};function cn(n,t){return Wk.call(n,t)}function Yn(n){return Ck.call(n)}function Vk(n){if(n.name)return n.name;var t=Pk.call(Rk.call(n),/^function\s*([\w$]+)/);return t?t[1]:null}function Lm(n,t){if(n.indexOf)return n.indexOf(t);for(var e=0,r=n.length;e<r;e++)if(n[e]===t)return e;return-1}function Bk(n){if(!Ka||!n||typeof n!="object")return!1;try{Ka.call(n);try{Ja.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function jk(n){if(!Cs||!n||typeof n!="object")return!1;try{Cs.call(n,Cs);try{Rs.call(n,Rs)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function Gk(n){if(!Mp||!n||typeof n!="object")return!1;try{return Mp.call(n),!0}catch{}return!1}function qk(n){if(!Ja||!n||typeof n!="object")return!1;try{Ja.call(n);try{Ka.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function Yk(n){if(!Rs||!n||typeof n!="object")return!1;try{Rs.call(n,Rs);try{Cs.call(n,Cs)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function Xk(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function zm(n,t){if(n.length>t.maxStringLength){var e=n.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return zm(zh.call(n,0,t.maxStringLength),t)+r}var i=zk[t.quoteStyle||"single"];i.lastIndex=0;var s=Fn.call(Fn.call(n,i,"\\$1"),/[\x00-\x1f]/g,Kk);return Pm(s,"single",t)}function Kk(n){var t=n.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Dk.call(t.toString(16))}function us(n){return"Object("+n+")"}function Ic(n){return n+" { ? }"}function jp(n,t,e,r){var i=r?vu(e,r):Xt.call(e,", ");return n+" ("+t+") {"+i+"}"}function Jk(n){for(var t=0;t<n.length;t++)if(Lm(n[t],`
2
- `)>=0)return!1;return!0}function Qk(n,t){var e;if(n.indent===" ")e=" ";else if(typeof n.indent=="number"&&n.indent>0)e=Xt.call(Array(n.indent+1)," ");else return null;return{base:e,prev:Xt.call(Array(t+1),e)}}function vu(n,t){if(n.length===0)return"";var e=`
3
- `+t.prev+t.base;return e+Xt.call(n,","+e)+`
4
- `+t.prev}function oa(n,t){var e=mu(n),r=[];if(e){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=cn(n,i)?t(n[i],n):""}var s=typeof Tc=="function"?Tc(n):[],o;if(Wi){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var c in n)cn(n,c)&&(e&&String(Number(c))===c&&c<n.length||Wi&&o["$"+c]instanceof Symbol||(Im.call(/[^\w$]/,c)?r.push(t(c,n)+": "+t(n[c],n)):r.push(c+": "+t(n[c],n))));if(typeof Tc=="function")for(var u=0;u<s.length;u++)Cm.call(n,s[u])&&r.push("["+t(s[u])+"]: "+t(n[s[u]],n));return r}var ex=Qi,tx=X,zl=function(n,t,e){for(var r=n,i;(i=r.next)!=null;r=i)if(i.key===t)return r.next=i.next,e||(i.next=n.next,n.next=i),i},nx=function(n,t){if(n){var e=zl(n,t);return e&&e.value}},rx=function(n,t,e){var r=zl(n,t);r?r.value=e:n.next={key:t,next:n.next,value:e}},ix=function(n,t){return n?!!zl(n,t):!1},sx=function(n,t){if(n)return zl(n,t,!0)},ox=function(){var t,e={assert:function(r){if(!e.has(r))throw new tx("Side channel does not contain "+ex(r))},delete:function(r){var i=t&&t.next,s=sx(t,r);return s&&i&&i===s&&(t=void 0),!!s},get:function(r){return nx(t,r)},has:function(r){return ix(t,r)},set:function(r,i){t||(t={next:void 0}),rx(t,r,i)}};return e},ax=yt,Ho=qn(),lx=Qi,cx=X,Gp=ax("%Map%",!0),ux=Ho("Map.prototype.get",!0),hx=Ho("Map.prototype.set",!0),dx=Ho("Map.prototype.has",!0),px=Ho("Map.prototype.delete",!0),fx=Ho("Map.prototype.size",!0),Om=!!Gp&&function(){var t,e={assert:function(r){if(!e.has(r))throw new cx("Side channel does not contain "+lx(r))},delete:function(r){if(t){var i=px(t,r);return fx(t)===0&&(t=void 0),i}return!1},get:function(r){if(t)return ux(t,r)},has:function(r){return t?dx(t,r):!1},set:function(r,i){t||(t=new Gp),hx(t,r,i)}};return e},gx=yt,Ol=qn(),mx=Qi,aa=Om,vx=X,ei=gx("%WeakMap%",!0),yx=Ol("WeakMap.prototype.get",!0),bx=Ol("WeakMap.prototype.set",!0),wx=Ol("WeakMap.prototype.has",!0),Sx=Ol("WeakMap.prototype.delete",!0),_x=ei?function(){var t,e,r={assert:function(i){if(!r.has(i))throw new vx("Side channel does not contain "+mx(i))},delete:function(i){if(ei&&i&&(typeof i=="object"||typeof i=="function")){if(t)return Sx(t,i)}else if(aa&&e)return e.delete(i);return!1},get:function(i){return ei&&i&&(typeof i=="object"||typeof i=="function")&&t?yx(t,i):e&&e.get(i)},has:function(i){return ei&&i&&(typeof i=="object"||typeof i=="function")&&t?wx(t,i):!!e&&e.has(i)},set:function(i,s){ei&&i&&(typeof i=="object"||typeof i=="function")?(t||(t=new ei),bx(t,i,s)):aa&&(e||(e=aa()),e.set(i,s))}};return r}:aa,kx=X,xx=Qi,Ex=ox,Ax=Om,$x=_x,Tx=$x||Ax||Ex,Ix=function(){var t,e={assert:function(r){if(!e.has(r))throw new kx("Side channel does not contain "+xx(r))},delete:function(r){return!!t&&t.delete(r)},get:function(r){return t&&t.get(r)},has:function(r){return!!t&&t.has(r)},set:function(r,i){t||(t=Tx()),t.set(r,i)}};return e},Cx=Sn,hs=Ix(),rn=X,Oh={assert:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new rn("`O` is not an object");if(typeof t!="string")throw new rn("`slot` must be a string");if(hs.assert(n),!Oh.has(n,t))throw new rn("`"+t+"` is not present on `O`")},get:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new rn("`O` is not an object");if(typeof t!="string")throw new rn("`slot` must be a string");var e=hs.get(n);return e&&e["$"+t]},has:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new rn("`O` is not an object");if(typeof t!="string")throw new rn("`slot` must be a string");var e=hs.get(n);return!!e&&Cx(e,"$"+t)},set:function(n,t,e){if(!n||typeof n!="object"&&typeof n!="function")throw new rn("`O` is not an object");if(typeof t!="string")throw new rn("`slot` must be a string");var r=hs.get(n);r||(r={},hs.set(n,r)),r["$"+t]=e}};Object.freeze&&Object.freeze(Oh);var Mh=Oh,Mm=bn,Zn=Mh,Zo=function n(t,e){if(!(this instanceof n))return new n(t,e);if(t!=="normal"&&t!=="break"&&t!=="continue"&&t!=="return"&&t!=="throw")throw new Mm('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');Zn.set(this,"[[Type]]",t),Zn.set(this,"[[Value]]",e)};Zo.prototype.type=function(){return Zn.get(this,"[[Type]]")};Zo.prototype.value=function(){return Zn.get(this,"[[Value]]")};Zo.prototype["?"]=function(){var t=Zn.get(this,"[[Type]]"),e=Zn.get(this,"[[Value]]");if(t==="throw")throw e;return e};Zo.prototype["!"]=function(){var t=Zn.get(this,"[[Type]]");if(t!=="normal")throw new Mm('Assertion failed: Completion Record is not of type "normal"');return Zn.get(this,"[[Value]]")};var Nh=Zo,Rx=Nh,Uh=function(t){return new Rx("normal",t)},Cc,qp;function Px(){if(qp)return Cc;qp=1;var n=Yi;return Cc=function(){return n()&&!!Symbol.toStringTag},Cc}var Dx=yt,Yp=Dx("%Object.defineProperty%",!0),Lx=Px()(),zx=Sn,Ox=X,la=Lx?Symbol.toStringTag:null,Nm=function(t,e){var r=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof r<"u"&&typeof r!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new Ox("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");la&&(r||!zx(t,la))&&(Yp?Yp(t,la,{configurable:!i,enumerable:!1,value:e,writable:!1}):t[la]=e)},Um={exports:{}},Mx=yt,Xp=nm,Nx=Pl(),Kp=qi,Jp=X,Ux=Mx("%Math.floor%"),Fx=function(t,e){if(typeof t!="function")throw new Jp("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||Ux(e)!==e)throw new Jp("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in t&&Kp){var o=Kp(t,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(Nx?Xp(t,"length",e,!0,!0):Xp(t,"length",e)),t},Hx=Oo,Zx=Ah,Wx=pm,Vx=function(){return Wx(Hx,Zx,arguments)};(function(n){var t=Fx,e=zo,r=Dl,i=Vx;n.exports=function(o){var a=r(arguments),c=1+o.length-(arguments.length-1);return t(a,c>0?c:0,!0)},e?e(n.exports,"apply",{value:i}):n.exports.apply=i})(Um);var Fh=Um.exports,Bx=function(t,e){for(var r=0;r<t.length;r+=1)if(!e(t[r],r,t))return!1;return!0},jx=Object,Gx=function(t){return t&&typeof t=="object"&&(typeof t["[[ResourceValue]]"]>"u"||jx(t["[[ResourceValue]]"])===t["[[ResourceValue]]"])&&(t["[[Hint]]"]==="SYNC-DISPOSE"||t["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof t["[[DisposeMethod]]"]=="function"||typeof t["[[DisposeMethod]]"]>"u")},qx=Sn,Yx=$h(),Xx=Bx,Kx=Gx,Jx=function(t){return t&&typeof t=="object"&&qx(t,"[[DisposableResourceStack]]")&&Yx(t["[[DisposableResourceStack]]"])&&(t["[[DisposableResourceStack]]"].length===0||Xx(t["[[DisposableResourceStack]]"],Kx))},Qx=wn,eE=function(t){if(t===null)return"Null";if(typeof t>"u")return"Undefined";if(Qx(t))return"Object";if(typeof t=="number")return"Number";if(typeof t=="boolean")return"Boolean";if(typeof t=="string")return"String"},tE=eE,Hh=function(t){return typeof t=="symbol"?"Symbol":typeof t=="bigint"?"BigInt":tE(t)},nE=X,rE=Qi,iE=Ki,sE=function(t,e){if(!iE(e))throw new nE("Assertion failed: P is not a Property Key, got "+rE(e));return t[e]},Qp=X,oE=sE,aE=Ji,lE=Ki,ef=Qi,cE=function(t,e){if(!lE(e))throw new Qp("Assertion failed: P is not a Property Key");var r=oE(t,e);if(r!=null){if(!aE(r))throw new Qp(ef(e)+" is not a function: "+ef(r));return r}},yu={exports:{}},uE=yt,hE=uE,tf=hE("%Reflect.construct%",!0),Qa=Fo;try{Qa({},"",{"[[Get]]":function(){}})}catch{Qa=null}if(Qa&&tf){var nf={},rf={};Qa(rf,"length",{"[[Get]]":function(){throw nf},"[[Enumerable]]":!0}),yu.exports=function(t){try{tf(t,rf)}catch(e){return e===nf}}}else yu.exports=function(t){return typeof t=="function"&&!!t.prototype};var dE=yu.exports,Rc=X,sf=Ji,pE=dE,fE=function(t){if(!pE(t))throw new Rc("C must be a constructor");var e={"[[Resolve]]":void 0,"[[Reject]]":void 0},r=new t(function(i,s){if(typeof e["[[Resolve]]"]<"u"||typeof e["[[Reject]]"]<"u")throw new Rc("executor has already been called");e["[[Resolve]]"]=i,e["[[Reject]]"]=s});if(!sf(e["[[Resolve]]"])||!sf(e["[[Reject]]"]))throw new Rc("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":e["[[Resolve]]"],"[[Reject]]":e["[[Reject]]"]}},of=bn,gE=X,Pc=Ll,af=cE,mE=fE,vE=Hh,lf=Rh(),cf=Ph(),yE=function(t,e){if(vE(t)!=="Object")throw new gE("`V` must be an Object");if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new of("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(e==="ASYNC-DISPOSE"&&cf&&(r=af(t,cf)),!r){if(!lf)throw new of("`Symbol.dispose` is not supported");if(r=af(t,lf),typeof r<"u")return function(){var i=this;if(e==="ASYNC-DISPOSE"){var s=mE(Promise);try{Pc(r,i),Pc(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}Pc(r,i)}}return r},bE=bn,Dc=X,wE=Ji,SE=Hh,_E=yE,kE=function(t,e){if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new bE("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(arguments.length<3)if(t==null)t=void 0,r=void 0;else{if(typeof t<"u"&&SE(t)!=="Object")throw new Dc("`V` must be an Object, or `null` or `undefined`");if(r=_E(t,e),typeof r>"u")throw new Dc("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!wE(r))throw new Dc("`method`, when provided, must be a function");return{"[[ResourceValue]]":t,"[[Hint]]":e,"[[DisposeMethod]]":r}},xE=bn,ca=X,EE=Jx,uf=kE,AE=qn(),$E=AE("Array.prototype.push"),Fm=function(t,e,r){if(!EE(t))throw new ca("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new xE("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var i=arguments.length>3?arguments[3]:void 0;if(arguments.length>3&&typeof i!="function")throw new ca("Assertion failed: `method`, when present, must be a function");if(!t["[[DisposableResourceStack]]"])throw new ca("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(e==null&&r==="SYNC_DISPOSE")return"UNUSED";s=uf(e,r)}else{if(typeof e<"u")throw new ca("Assertion failed: `V` must be undefined when `method` is present");s=uf(void 0,r,i)}return $E(t["[[DisposableResourceStack]]"],s),"UNUSED"},Lc,hf;function Zh(){if(hf)return Lc;hf=1;var n=yt,t=Fh,e=bn,r=n("%Promise.resolve%",!0),i=r&&t(r);return Lc=function(o,a){if(!i)throw new e("This environment does not support Promises.");return i(o,a)},Lc}var zc,df;function TE(){if(df)return zc;df=1;var n=yt,t=bn,e=n("%Promise%",!0),r=Ll,i=Zh(),s=Hh;return zc=function(a,c,u){if(typeof a<"u"&&s(a)!=="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 h=typeof u>"u"?u:r(u,a);if(c==="ASYNC-DISPOSE")return i(e,h)},zc}var Oc,pf;function IE(){if(pf)return Oc;pf=1;var n=Nh;return Oc=function(e){return new n("throw",e)},Oc}var CE=yt,Mc=bn,ff=X,RE=CE("%Promise%",!0),PE=qn(),gf=PE("Promise.prototype.then",!0),DE=Nh,mf=TE(),LE=Uh,zE=Zh(),vf=IE(),OE=Tm(),Hm=function(t,e){if(!(e instanceof DE))throw new ff("`completion` must be a Completion Record");var r=t["[[DisposableResourceStack]]"];if(!r)throw new ff("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");for(var i,s=r.length-1;s>=0;s-=1)if(!i)i=r[s]["[[Hint]]"];else if(i!==r[s]["[[Hint]]"])throw new Mc("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&zE(RE,e),a=function(v){if(e.type()==="throw"){var g=e.value(),_=new OE(v,g);e=vf(_)}else e=vf(v)},c=i==="ASYNC-DISPOSE"&&function(g){return gf(o,function(){var _=mf(g["[[ResourceValue]]"],g["[[Hint]]"],g["[[DisposeMethod]]"]);if(!_)throw new Mc("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return gf(_,LE)},a)},u=r.length-1;u>=0;u-=1)if(i==="ASYNC-DISPOSE")o=c(r[u]);else{var h=r[u];try{var p=mf(h["[[ResourceValue]]"],h["[[Hint]]"],h["[[DisposeMethod]]"]);if(p)throw new Mc("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(v){a(v)}}return t["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:e},Zm=function(){var t=[];return{"[[DisposableResourceStack]]":t}},Ml=_h,Wh=X,ME=Ll,es=Ih,NE=Fo,Wm=Ji,UE=Uh,tt=Mh,FE=Nm,Vm=Zr.supportsDescriptors,HE=Fh,Vh=Fm,ZE=Hm,Bm=Zm,yf=Rh(),pt=function n(){if(!(this instanceof n)||tt.has(this,"[[DisposableState]]")||tt.has(this,"[[DisposeCapability]]"))throw new Wh("can only be used with new");tt.set(this,"[[DisposableState]]","PENDING"),tt.set(this,"[[DisposeCapability]]",Bm())},jm=function(){var t=this;return tt.assert(t,"[[DisposableState]]"),tt.get(t,"[[DisposableState]]")==="DISPOSED"},Wo=HE(jm);Vm?NE(pt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":jm}):pt.prototype.disposed=!1;var Gm=function(t){tt.set(t,"[[DisposableState]]","DISPOSED"),Vm||(t.disposed=!0)};es(pt.prototype,"dispose",function(){var t=this;if(!Wo(t))return Gm(t),ZE(tt.get(t,"[[DisposeCapability]]"),UE())["?"]()});es(pt.prototype,"use",function(t){var e=this;if(Wo(e))throw new Ml("a disposed stack can not use anything new");return Vh(tt.get(e,"[[DisposeCapability]]"),t,"SYNC-DISPOSE"),t});es(pt.prototype,"adopt",function(t,e){var r=this;if(Wo(r))throw new Ml("a disposed stack can not use anything new");if(!Wm(e))throw new Wh("`onDispose` must be a function");var i=function(){return ME(e,void 0,[t])};return Vh(tt.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),t});es(pt.prototype,"defer",function(t){var e=this;if(Wo(e))throw new Ml("a disposed stack can not defer anything new");if(!Wm(t))throw new Wh("`onDispose` must be a function");Vh(tt.get(e,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",t)});es(pt.prototype,"move",function(){var t=this;if(Wo(t))throw new Ml("a disposed stack can not use anything new");var e=new pt;return tt.set(e,"[[DisposeCapability]]",tt.get(t,"[[DisposeCapability]]")),tt.set(t,"[[DisposeCapability]]",Bm()),Gm(t),e});yf&&es(pt.prototype,yf,pt.prototype.dispose);FE(pt.prototype,"DisposableStack");var WE=pt,VE=WE,BE=function(){return typeof DisposableStack=="function"?DisposableStack:VE},jE=Zr,GE=wh(),qE=BE,YE=function(){var t=qE();return jE(GE,{DisposableStack:t},{DisposableStack:!0}),t},XE=yt,Nl=_h,Bh=X,bf=XE("%Promise%",!0),jh=Fm,KE=Ll,ts=Ih,JE=Fo,QE=Hm,qm=Ji,Ym=Zm,eA=Uh,wf=Zh(),nt=Mh,tA=Nm,Xm=Zr.supportsDescriptors,nA=Fh,rA=qn(),iA=rA("Promise.prototype.then",!0),Sf=Ph(),ft=function n(){if(!(this instanceof n)||nt.has(this,"[[AsyncDisposableState]]")||nt.has(this,"[[DisposeCapability]]"))throw new Bh("can only be used with new");nt.set(this,"[[AsyncDisposableState]]","pending"),nt.set(this,"[[DisposeCapability]]",Ym())},Km=function(){var t=this;return nt.assert(t,"[[AsyncDisposableState]]"),nt.get(t,"[[AsyncDisposableState]]")==="disposed"},Vo=nA(Km);Xm?JE(ft.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Km}):ft.prototype.disposed=!1;var Jm=function(t){nt.set(t,"[[AsyncDisposableState]]","disposed"),Xm||(t.disposed=!0)};ts(ft.prototype,"disposeAsync",function(){var t=this;return Vo(t)?wf(bf):(Jm(t),iA(wf(bf,QE(nt.get(t,"[[DisposeCapability]]"),eA())),function(e){return e["?"]()}))});ts(ft.prototype,"use",function(t){var e=this;if(Vo(e))throw new Nl("a disposed stack can not use anything new");return jh(nt.get(e,"[[DisposeCapability]]"),t,"ASYNC-DISPOSE"),t});ts(ft.prototype,"adopt",function(t,e){var r=this;if(Vo(r))throw new Nl("a disposed stack can not use anything new");if(!qm(e))throw new Bh("`onDisposeAsync` must be a function");var i=function(){return KE(e,void 0,[t])};return i.value=t,jh(nt.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),t});ts(ft.prototype,"defer",function(t){var e=this;if(Vo(e))throw new Nl("a disposed stack can not defer anything new");if(!qm(t))throw new Bh("`onDispose` must be a function");jh(nt.get(e,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",t)});ts(ft.prototype,"move",function(){var t=this;if(Vo(t))throw new Nl("a disposed stack can not use anything new");var e=new ft;return nt.set(e,"[[DisposeCapability]]",nt.get(t,"[[DisposeCapability]]")),nt.set(t,"[[DisposeCapability]]",Ym()),Jm(t),e});Sf&&ts(ft.prototype,Sf,ft.prototype.disposeAsync);tA(ft.prototype,"AsyncDisposableStack");var sA=ft,oA=sA,aA=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:oA},lA=Zr,cA=wh(),uA=aA,hA=function(){var t=uA();return lA(cA,{AsyncDisposableStack:t},{AsyncDisposableStack:!0}),t},dA=lk,pA=mk,fA=YE,gA=hA,mA=function(){dA(),pA(),fA(),gA()};mA();const _f=new WeakMap;function vA(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function ti(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function kf(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function yA(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class bA{constructor(){m(this,"entries",new Map);m(this,"constructionStack",[])}register(t,e){if(e===void 0){if(typeof t!="function")throw kf();this.validateClassRegistration(t),this.storeFactory(t,()=>this.instantiateClass(t));return}if(typeof e!="function")throw kf();if(e.constructor.name==="AsyncFunction")throw yA();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=_f.get(t);if(e){if(t.length!==e.length)throw new Error(`${ti(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(`${ti(t)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(t){const e=_f.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(`${ti(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=>ti(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(t.key);try{const r=t.factory();if(vA(r))throw new Error(`Factory for ${ti(t.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${ti(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 Kt=new bA,wA=.5,xf=.1,Ef=8,SA=4,Qm=3,ev=3,_A=4,dr=255,tv=.2126,nv=.7152,rv=.0722;async function iv(n){const t=kA(n);if(!t)return"light";try{return await AA(n,t)>=wA?"light":"dark"}catch{return"light"}}function kA(n){if(typeof document.elementsFromPoint!="function")return null;const t=n.getBoundingClientRect(),e=t.left+t.width/2,r=t.top+t.height/2,i=document.elementsFromPoint(e,r);for(const s of i){if(!(s instanceof HTMLElement)||s===n||n.contains(s))continue;const o=window.getComputedStyle(s);if(xA(o))return s}return null}function xA(n){return n.backgroundImage&&n.backgroundImage!=="none"?!0:EA(n.backgroundColor)>0}function EA(n){if(!n)return 0;const t=n.match(/rgba?\(([^)]+)\)/);if(!t)return 0;const e=t[1].split(/[\s,/]+/).filter(Boolean);return e.length===_A?parseFloat(e[Qm]):e.length===ev?1:0}async function AA(n,t){const e=n.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:ua((e.left-r.left)/r.width),y:ua((e.top-r.top)/r.height),width:ua(e.width/r.width),height:ua(e.height/r.height)},s=window.getComputedStyle(t),o=$A(s.backgroundImage);return o?IA({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):CA(s.backgroundColor)}function $A(n){const t=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return t?t[1]:null}const Af=new Map;function TA(n){let t=Af.get(n);return t||(t=new Promise((e,r)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=()=>e(i),i.onerror=()=>r(new Error(`Failed to load ${n}`)),i.src=n}),Af.set(n,t),t)}async function IA(n){const t=await TA(n.url),e=Math.max(Ef,Math.ceil(n.surfaceWidth*xf)),r=Math.max(Ef,Math.ceil(n.surfaceHeight*xf)),i=document.createElement("canvas");i.width=e,i.height=r;const s=i.getContext("2d",{willReadFrequently:!0});if(!s)return 1;const o=n.surfaceWidth/n.surfaceHeight,a=t.naturalWidth/t.naturalHeight;let c,u;a>o?(u=r,c=r*a):(c=e,u=e/a);const h=(e-c)/2,p=(r-u)/2;s.drawImage(t,h,p,c,u);const v=Math.max(0,Math.floor(n.region.x*e)),g=Math.max(0,Math.floor(n.region.y*r)),_=Math.max(1,Math.min(e-v,Math.floor(n.region.width*e))),k=Math.max(1,Math.min(r-g,Math.floor(n.region.height*r))),T=s.getImageData(v,g,_,k).data;let P=0,R=0;for(let Z=0;Z<T.length;Z+=SA){const N=T[Z]/dr,F=T[Z+1]/dr,Y=T[Z+2]/dr,j=T[Z+Qm]/dr;P+=j*(tv*N+nv*F+rv*Y),R+=1}return R>0?P/R:1}function CA(n){const t=n.match(/rgba?\(([^)]+)\)/);if(!t)return 1;const e=t[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(e.length<ev)return 1;const r=e[0]/dr,i=e[1]/dr,s=e[2]/dr;return tv*r+nv*i+rv*s}function ua(n){return n<0?0:n>1?1:n}const RA=["ghost","glass"],Ms=[...RA.flatMap(n=>[`button[variant="${n}"]`,`segmented-control[variant="${n}"]`]),'[material="glass"]'].join(", "),ha=new WeakSet,$f=new WeakSet;function sv(n){if($f.has(n))return;$f.add(n);for(const e of n.querySelectorAll(Ms))Nc(e);if(typeof MutationObserver!="function")return;new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const i of r.addedNodes)PA(i,Nc);else r.type==="attributes"&&r.target instanceof HTMLElement&&r.target.matches(Ms)&&Nc(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant","material"]})}function PA(n,t){if(n instanceof Element){n instanceof HTMLElement&&n.matches(Ms)&&t(n);for(const e of n.querySelectorAll(Ms))t(e)}}async function Nc(n){if(ha.has(n)||n.hasAttribute("tone"))return;ha.add(n);const t=await iv(n);if(!n.matches(Ms)){ha.delete(n);return}if(n.hasAttribute("tone")){ha.delete(n);return}n.setAttribute("tone",t)}const DA="*,*:before,*:after{box-sizing:border-box}html,body{margin:0;padding:0;width:100%;height:100%}h1,h2,h3,h4,h5,h6,p,ul,ol,blockquote,pre,hr{margin:0}button,input,textarea,select{font:inherit;color:inherit}@font-face{font-family:Hind;src:url("+new URL("Hind-Variable-C47b_dt9.woff2",import.meta.url).href+') format("woff2-variations");font-weight:300 700;font-style:normal;font-display:swap}:root{--font-sans: "Hind", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;--font-brand: var(--font-sans);--font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;--font-weight-body: 500;--text-base: 13.5px;--text-scale: 1.125;--text-sm: round(calc(var(--text-base) / var(--text-scale)), 1px);--text-lg: round(calc(var(--text-base) * var(--text-scale)), 1px);--text-xl: round(calc(var(--text-lg) * var(--text-scale)), 1px);--leading-base: 1.5;--control-height-xs: 18px;--control-height-sm: 24px;--control-height-md: 28px;--control-height-lg: 32px;--space-2: 2px;--space-4: 4px;--space-6: 6px;--space-8: 8px;--space-12: 12px;--space-16: 16px;--space-20: 20px;--space-24: 24px;--space-32: 32px;--space-48: 48px;--space-64: 64px;--radius-4: 4px;--radius-8: 8px;--radius-12: 12px;--radius-16: 16px;--radius-24: 24px;--radius-full: 9999px;--layer-chrome: 100;--layer-panel: 500;--layer-overlay: 2000;--shadow-hairline: 0 0 0 .5px var(--color-border);--shadow-control: 0 1px 1px rgb(0 0 0 / .04), 0 2px 6px rgb(0 0 0 / .06);--alpha-50: 4%;--alpha-100: 8%;--alpha-150: 11%;--alpha-200: 15%;--alpha-300: 22%;--alpha-400: 30%;--alpha-500: 40%;--alpha-600: 50%;--alpha-700: 65%;--alpha-800: 80%;--alpha-900: 90%;--alpha-950: 95%;--tint-50: color-mix(in srgb, currentColor var(--alpha-50), transparent);--tint-100: color-mix(in srgb, currentColor var(--alpha-100), transparent);--tint-150: color-mix(in srgb, currentColor var(--alpha-150), transparent);--tint-200: color-mix(in srgb, currentColor var(--alpha-200), transparent);--tint-300: color-mix(in srgb, currentColor var(--alpha-300), transparent);--tint-400: color-mix(in srgb, currentColor var(--alpha-400), transparent);--tint-500: color-mix(in srgb, currentColor var(--alpha-500), transparent);--tint-600: color-mix(in srgb, currentColor var(--alpha-600), transparent);--tint-700: color-mix(in srgb, currentColor var(--alpha-700), transparent);--tint-800: color-mix(in srgb, currentColor var(--alpha-800), transparent);--tint-900: color-mix(in srgb, currentColor var(--alpha-900), transparent);--tint-950: color-mix(in srgb, currentColor var(--alpha-950), transparent);--color-overlay-hover: color-mix(in srgb, var(--black) var(--alpha-100), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-300), transparent);--backdrop-blur-glass: blur(20px) saturate(1.4);--black: #000000;--white: #ffffff;--neutral-50: oklch(.985 0 0);--neutral-100: oklch(.97 0 0);--neutral-200: oklch(.923 0 0);--neutral-300: oklch(.869 0 0);--neutral-350: oklch(.79 0 0);--neutral-400: oklch(.709 0 0);--neutral-500: oklch(.553 0 0);--neutral-600: oklch(.444 0 0);--neutral-700: oklch(.374 0 0);--neutral-800: oklch(.268 0 0);--neutral-900: oklch(.216 0 0);--neutral-950: oklch(.147 0 0);--red-50: oklch(.969 .015 12.422);--red-100: oklch(.941 .03 12.58);--red-200: oklch(.892 .058 10.001);--red-300: oklch(.81 .117 11.638);--red-400: oklch(.712 .194 13.428);--red-500: oklch(.645 .246 16.439);--red-600: oklch(.586 .253 17.585);--red-700: oklch(.514 .222 16.935);--red-800: oklch(.455 .188 13.697);--red-900: oklch(.41 .159 10.272);--red-950: oklch(.271 .105 12.094);--orange-50: oklch(.98 .016 73.684);--orange-100: oklch(.954 .038 75.164);--orange-200: oklch(.901 .076 70.697);--orange-300: oklch(.837 .128 66.29);--orange-400: oklch(.75 .183 55.934);--orange-500: oklch(.705 .213 47.604);--orange-600: oklch(.646 .222 41.116);--orange-700: oklch(.553 .195 38.402);--orange-800: oklch(.47 .157 37.304);--orange-900: oklch(.408 .123 38.172);--orange-950: oklch(.266 .079 36.259);--yellow-50: oklch(.987 .026 102.212);--yellow-100: oklch(.973 .071 103.193);--yellow-200: oklch(.945 .129 101.54);--yellow-300: oklch(.905 .182 98.111);--yellow-400: oklch(.852 .199 91.936);--yellow-500: oklch(.795 .184 86.047);--yellow-600: oklch(.681 .162 75.834);--yellow-700: oklch(.554 .135 66.442);--yellow-800: oklch(.476 .114 61.907);--yellow-900: oklch(.421 .095 57.708);--yellow-950: oklch(.286 .066 53.813);--green-50: oklch(.979 .021 166.113);--green-100: oklch(.95 .052 163.051);--green-200: oklch(.905 .093 164.15);--green-300: oklch(.845 .143 164.978);--green-400: oklch(.765 .177 163.223);--green-500: oklch(.696 .17 162.48);--green-600: oklch(.596 .145 163.225);--green-700: oklch(.508 .118 165.612);--green-800: oklch(.432 .095 166.913);--green-900: oklch(.378 .077 168.94);--green-950: oklch(.262 .051 172.552);--blue-50: oklch(.97 .014 254.604);--blue-100: oklch(.932 .032 255.585);--blue-200: oklch(.882 .059 254.128);--blue-300: oklch(.809 .105 251.813);--blue-400: oklch(.707 .165 254.624);--blue-500: oklch(.623 .214 259.815);--blue-600: oklch(.546 .245 262.881);--blue-700: oklch(.488 .243 264.376);--blue-800: oklch(.424 .199 265.638);--blue-900: oklch(.379 .146 265.522);--blue-950: oklch(.282 .091 267.935);--purple-50: oklch(.969 .016 293.756);--purple-100: oklch(.943 .029 294.588);--purple-200: oklch(.894 .057 293.283);--purple-300: oklch(.811 .111 293.571);--purple-400: oklch(.702 .183 293.541);--purple-500: oklch(.606 .25 292.717);--purple-600: oklch(.541 .281 293.009);--purple-700: oklch(.491 .27 292.581);--purple-800: oklch(.432 .232 292.759);--purple-900: oklch(.38 .189 293.745);--purple-950: oklch(.283 .141 291.089)}@supports (corner-shape: squircle){:root{--radius-8: 10px;--radius-12: 15px;--radius-16: 20px;--radius-24: 30px}}:root[data-font=system]{--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif}:root{--color-bg: var(--neutral-50);--color-bg-muted: var(--neutral-100);--color-surface: var(--white);--color-surface-muted: var(--neutral-100);--color-interactive: var(--neutral-200);--color-interactive-hover: var(--neutral-300);--color-border: rgba(0, 0, 0, .1);--color-border-muted: rgba(0, 0, 0, .06);--color-text: var(--neutral-900);--color-text-muted: var(--neutral-500);--color-link: inherit;--color-focus-ring: var(--neutral-500);--color-overlay-backdrop: rgb(0 0 0 / .5);--color-highlight: rgb(255 255 255 / .5);--color-primary: var(--blue-500);--color-danger: var(--red-600);color-scheme:light}body{font-family:var(--font-sans);font-size:var(--text-base);font-weight:var(--font-weight-body);line-height:var(--leading-base);letter-spacing:.015em;color:var(--color-text);background:var(--color-bg);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{color:var(--color-link);text-underline-offset:.15em;text-decoration-thickness:.08em}h1,h2,h3,h4,h5,h6{font-weight:600;color:inherit}code{font-family:var(--font-mono);font-size:.9em;background:var(--color-bg-muted);padding:var(--space-2) var(--space-4);border-radius:var(--radius-4)}pre{font-family:var(--font-mono);background:var(--color-bg-muted);padding:var(--space-12);border-radius:var(--radius-8);overflow-x:auto}pre code{background:none;padding:0}blockquote{padding-left:var(--space-16);border-left:3px solid var(--color-border);color:var(--color-text-muted)}hr{border:none;border-top:1px solid var(--color-border)}table{border-collapse:collapse}th,td{padding:var(--space-8) var(--space-12);border:1px solid var(--color-border);text-align:left}th{background:var(--color-bg-muted);font-weight:600}input,textarea{border:.5px solid var(--tint-300);border-radius:var(--radius-12);background:var(--tint-100);color:inherit;font:inherit;box-sizing:border-box;transition:background .12s ease,border-color .12s ease,box-shadow .12s ease}input{height:var(--control-height-lg);padding:0 12px}textarea{padding:6px 10px;resize:none}input::placeholder,textarea::placeholder{color:var(--tint-500)}input:focus,textarea:focus{background:color-mix(in srgb,var(--white) var(--alpha-300),transparent);border-color:var(--color-primary);outline:none;box-shadow:0 0 0 1.5px var(--color-primary)}label.field{display:grid;gap:4px;font-size:13px}label.field>span{font-size:11.5px;font-weight:450;color:var(--tint-800)}@supports (corner-shape: squircle){*{corner-shape:squircle}}button{display:inline-flex;align-items:center;justify-content:center;gap:var(--space-6);box-sizing:border-box;height:var(--control-height-md);padding:0 14px 2px;font:inherit;cursor:default}button,segmented-control{background:var(--color-surface);border:.5px solid var(--tint-200);border-radius:var(--radius-12);box-shadow:var(--shadow-control);color:inherit}button:not([material]):hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}button:not([material]):active:not(:disabled){background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}button:focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}button[variant=primary]{background:var(--color-primary);border-color:#0000002e;color:var(--white)}button[variant=primary]:hover:not(:disabled){background:color-mix(in srgb,var(--color-primary) 92%,black)}button[variant=primary]:active:not(:disabled){background:color-mix(in srgb,var(--color-primary) 82%,black);box-shadow:inset 0 1px 2px #0000002e}button[variant=danger]{background:var(--color-danger);border-color:#0000002e;color:var(--white)}button[variant=danger]:hover:not(:disabled){background:color-mix(in srgb,var(--color-danger) 92%,black)}button[variant=danger]:active:not(:disabled){background:color-mix(in srgb,var(--color-danger) 82%,black);box-shadow:inset 0 1px 2px #0000002e}button[variant=ghost]{background:transparent;border-color:transparent;color:inherit;box-shadow:none}button[variant=ghost]:hover:not(:disabled){background:var(--tint-150);backdrop-filter:saturate(1.2);-webkit-backdrop-filter:saturate(1.2)}button[variant=ghost]:active:not(:disabled){background:var(--tint-300);backdrop-filter:saturate(1.4);-webkit-backdrop-filter:saturate(1.4);box-shadow:none}button[variant=ghost][data-active]:not(:disabled),button[variant=ghost][data-active]:hover:not(:disabled),button[variant=ghost][aria-pressed=true]:not(:disabled),button[variant=ghost][aria-pressed=true]:hover:not(:disabled),button[variant=ghost][aria-expanded=true]:not(:disabled),button[variant=ghost][aria-expanded=true]:hover:not(:disabled){background:var(--color-overlay-active);backdrop-filter:saturate(1.3);-webkit-backdrop-filter:saturate(1.3);box-shadow:none}button[variant=glass],segmented-control[variant=glass]{background:transparent;border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);box-shadow:none}button[variant=glass]{backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5)}button[variant=glass]:hover:not(:disabled){background:linear-gradient(var(--color-overlay-hover),var(--color-overlay-hover));backdrop-filter:blur(20px) brightness(.95) saturate(1.8);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.8)}button[variant=glass]:active:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active));backdrop-filter:blur(20px) brightness(.95) saturate(2.2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2.2)}button[variant=glass][aria-pressed=true]:not(:disabled),button[variant=glass][aria-pressed=true]:hover:not(:disabled),button[variant=glass][aria-expanded=true]:not(:disabled),button[variant=glass][aria-expanded=true]:hover:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active));backdrop-filter:blur(20px) brightness(.95) saturate(2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2)}[tone=dark] button[variant=glass],[tone=dark] segmented-control[variant=glass]{border-color:var(--tint-400)}button[material],segmented-control[material]{color:inherit;box-shadow:none}button[material]:hover:not(:disabled){background-image:linear-gradient(var(--color-overlay-hover),var(--color-overlay-hover))}button[material]:active:not(:disabled){background-image:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}[tone=dark] button[material],[tone=dark] segmented-control[material]{border-color:var(--tint-400)}button:disabled{background:var(--tint-300);border-color:transparent;color:var(--tint-700);box-shadow:none}button[variant=ghost]:disabled{background:transparent}:where([tone=dark]) button:not([variant]):not([material]):not(:disabled),:where([tone=dark]) button[variant=default]:not([material]):not(:disabled),:where([tone=dark]) segmented-control:not([variant]):not([material]),:where([tone=dark]) segmented-control[variant=default]:not([material]){background:var(--tint-200);border-color:var(--tint-300);box-shadow:inset 0 .5px 0 var(--tint-300)}:where([tone=dark]) button:not([variant]):hover:not(:disabled),:where([tone=dark]) button[variant=default]:hover:not(:disabled){background:var(--tint-300)}:where([tone=dark]) button:not([variant]):active:not(:disabled),:where([tone=dark]) button[variant=default]:active:not(:disabled){background:var(--tint-400);box-shadow:inset 0 1px 2px #0003}:where([tone=light]) button:not([variant]):not([material]):not(:disabled),:where([tone=light]) button[variant=default]:not([material]):not(:disabled),:where([tone=light]) segmented-control:not([variant]):not([material]),:where([tone=light]) segmented-control[variant=default]:not([material]){background:var(--color-surface);border-color:var(--tint-200);box-shadow:var(--shadow-control)}:where([tone=light]) button:not([variant]):hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}:where([tone=light]) button:not([variant]):active:not(:disabled){background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}button[size=sm],segmented-control[size=sm]{height:var(--control-height-sm)}button[size=sm][icon-only]{width:var(--control-height-sm)}button[size=xs]{height:var(--control-height-xs);padding:0 var(--space-6) 1px;border-radius:var(--radius-8)}button[size=xs][icon-only]{width:var(--control-height-xs);padding:0}button[icon-only]{width:var(--control-height-md);padding:0}[data-ui-icon]{display:inline-block;vertical-align:middle}[selectable],[selectable] *{user-select:text;-webkit-user-select:text}[unselectable],[unselectable] *{user-select:none;-webkit-user-select:none}.prose{line-height:var(--leading-base)}.prose h1{font-size:var(--text-xl);margin-bottom:var(--space-8)}.prose h2{font-size:var(--text-lg);margin-top:var(--space-24);margin-bottom:var(--space-8)}.prose h3,.prose h4,.prose h5,.prose h6{font-size:var(--text-base);margin-top:var(--space-24);margin-bottom:var(--space-8)}.prose p{margin:var(--space-12) 0}.prose ul,.prose ol{padding-left:var(--space-24);margin:var(--space-12) 0}.prose blockquote,.prose pre{margin:var(--space-12) 0}.prose hr{margin:var(--space-24) 0}.prose table{width:100%;margin:var(--space-12) 0}.prose img{max-width:100%;height:auto}.prose>:first-child{margin-top:0}.prose>:last-child{margin-bottom:0}[material=paper]{background:var(--white);border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);color:var(--color-text)}[material=glass]{background:transparent;border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5)}[material=glass-frosted]{background:color-mix(in srgb,var(--white) var(--alpha-800),transparent);border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);color:var(--color-text);backdrop-filter:var(--backdrop-blur-glass);-webkit-backdrop-filter:var(--backdrop-blur-glass)}[tone=dark]{color:color-mix(in srgb,var(--white) var(--alpha-950),transparent);border-color:color-mix(in srgb,var(--white) var(--alpha-200),transparent);--color-overlay-hover: color-mix(in srgb, var(--white) var(--alpha-100), transparent);--color-overlay-active: color-mix(in srgb, var(--white) var(--alpha-200), transparent)}[tone=dark][material=paper]{background:#000}[tone=dark][material=glass-frosted]{background:color-mix(in srgb,var(--black) 70%,transparent)}[tone=light]{color:var(--color-text);border-color:color-mix(in srgb,var(--black) var(--alpha-100),transparent);--color-overlay-hover: color-mix(in srgb, var(--black) var(--alpha-50), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-100), transparent)}[level="1"]{box-shadow:0 12px 32px #00000024}[level="2"]{box-shadow:0 4px 6px -2px #0000001f,0 40px 60px -16px #00000038}dropdown-menu{position:relative;display:inline-block;color:inherit}dropdown-group{display:grid;gap:var(--space-4)}dropdown-label{display:block;padding:var(--space-4) var(--space-8);color:var(--color-text-muted);font:inherit;font-size:var(--text-sm);font-weight:600;letter-spacing:.04em;text-transform:uppercase}dropdown-divider{display:block;height:1px;margin:2px 0;background:var(--color-border)}[data-dropdown-trigger][aria-expanded=true],[data-dropdown-trigger][aria-expanded=true]:hover,dropdown-menu[open]::part(trigger),dropdown-menu[open]::part(trigger):hover{background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}[data-dropdown-trigger-label],dropdown-menu::part(trigger-label){min-width:0}[data-dropdown-trigger-icon],dropdown-menu::part(trigger-icon){display:inline-flex;align-items:center;justify-content:center;flex:none;color:var(--color-text-muted);transform:translateY(1px)}dropdown-item:focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}ui-popover.dropdown-popover::part(panel){min-width:192px;padding:var(--space-4)}.dropdown-list{display:flex;flex-direction:column;gap:2px}dropdown-item{display:flex;align-items:center;gap:var(--space-8);margin:0;padding:6px 12px;border-radius:var(--radius-8);font:inherit;line-height:1.2;color:inherit;font-weight:var(--font-weight-body);-webkit-user-select:none;user-select:none}dropdown-item>[data-ui-icon]{flex:none}dropdown-item[selected]{background:var(--color-overlay-active)}dropdown-item:hover,dropdown-item[action]:hover{background:var(--color-primary);color:var(--white)}dropdown-item[action]{color:inherit}dropdown-item[danger]{color:var(--color-danger)}dropdown-item[danger]:hover{background:var(--color-danger);color:var(--white)}editable-text{display:inline-block;max-width:100%;vertical-align:top}editable-text>.editable-text-span{display:inline-block;max-width:100%;outline:none;overflow:hidden;white-space:nowrap;cursor:inherit;vertical-align:top}editable-text:not([data-editing])>.editable-text-span{text-overflow:ellipsis}editable-text[data-editing]>.editable-text-span{cursor:text}modal-overlay{color:inherit}modal-overlay::part(backdrop){position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--layer-overlay);display:flex;align-items:center;justify-content:center;padding:var(--space-16);background:linear-gradient(to bottom,color-mix(in srgb,var(--black) var(--alpha-50),transparent),color-mix(in srgb,var(--black) var(--alpha-400),transparent));backdrop-filter:blur(1px);-webkit-backdrop-filter:blur(1px)}panel-view{display:block}panel-view::part(panel){display:flex;flex-direction:column;gap:var(--space-16);color:var(--color-text)}panel-view::part(header){display:flex;align-items:center;justify-content:space-between;gap:var(--space-12)}panel-view::part(title){margin:0;font:inherit;font-size:var(--text-lg);font-weight:600;color:var(--color-text)}panel-view::part(button){display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;margin:0;border:1px solid var(--color-border);border-radius:var(--radius-4);background:var(--color-surface);color:var(--color-text);box-shadow:none}panel-view::part(button):hover{background:var(--color-interactive-hover)}panel-view::part(button):focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}panel-view::part(icon){display:inline-flex;align-items:center;justify-content:center;flex:none}ui-popover{display:contents}ui-popover::part(panel){position:fixed;inset:0 auto auto 0;margin:0;min-width:192px;max-width:384px;padding:var(--space-16) var(--space-20);border-radius:var(--radius-12);outline:none;z-index:2000}segmented-control{display:inline-flex;align-items:stretch;box-sizing:border-box;height:var(--control-height-md)}segmented-control>button{height:auto}segmented-control[variant=ghost]{background:transparent;box-shadow:none}[tone=dark] segmented-control[variant=ghost]{border-color:var(--tint-400)}segmented-control>button{position:relative}segmented-control>button[icon-only]{width:auto;height:auto;padding:0 var(--space-6)}segmented-control>button:not([variant]):not(:disabled),[tone] segmented-control>button:not([variant]):not(:disabled){background:transparent;border:0;box-shadow:none}segmented-control>button:first-child{border-top-right-radius:0;border-bottom-right-radius:0}segmented-control>button:last-child{border-top-left-radius:0;border-bottom-left-radius:0}segmented-control>button:not(:first-child):not(:last-child){border-radius:0}segmented-control>button:not([variant]):hover:not(:disabled),[tone] segmented-control>button:not([variant]):hover:not(:disabled){background:var(--color-overlay-hover)}segmented-control>button:not([variant]):active:not(:disabled),[tone] segmented-control>button:not([variant]):active:not(:disabled){background:var(--color-overlay-active);box-shadow:none}segmented-control>button:not([variant])[aria-pressed=true]:not(:disabled),segmented-control>button:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),segmented-control>button:not([variant])[aria-expanded=true]:not(:disabled),[tone] segmented-control>button:not([variant])[aria-pressed=true]:not(:disabled),[tone] segmented-control>button:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),[tone] segmented-control>button:not([variant])[aria-expanded=true]:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}segmented-control>button:not(:last-child):after{content:"";position:absolute;top:0;bottom:0;right:0;width:.5px;background:var(--tint-200);pointer-events:none}[tone=dark] segmented-control>button:not(:last-child):after{background:var(--tint-400)}segmented-control>dropdown-menu{display:inline-flex;align-items:stretch;height:auto}segmented-control>dropdown-menu>[slot=trigger]{height:auto;position:relative}segmented-control>dropdown-menu>[slot=trigger]:not([variant]):not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant]):not(:disabled){background:transparent;border:0;box-shadow:none}segmented-control>dropdown-menu:first-child>[slot=trigger]{border-top-right-radius:0;border-bottom-right-radius:0}segmented-control>dropdown-menu:last-child>[slot=trigger]{border-top-left-radius:0;border-bottom-left-radius:0}segmented-control>dropdown-menu:not(:first-child):not(:last-child)>[slot=trigger]{border-radius:0}segmented-control>dropdown-menu>[slot=trigger]:not([variant]):hover:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant]):hover:not(:disabled){background:var(--color-overlay-hover)}segmented-control>dropdown-menu>[slot=trigger]:not([variant]):active:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant]):active:not(:disabled){background:var(--color-overlay-active);box-shadow:none}segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-pressed=true]:not(:disabled),segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-expanded=true]:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-pressed=true]:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-expanded=true]:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}segmented-control[variant=glass]>button,segmented-control[variant=glass]>dropdown-menu{backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5)}segmented-control[variant=glass]>button:not(:disabled):hover,segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled):hover){backdrop-filter:blur(20px) brightness(.95) saturate(1.8);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.8)}segmented-control[variant=glass]>button:not(:disabled):active,segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled):active){backdrop-filter:blur(20px) brightness(.95) saturate(2.2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2.2)}segmented-control[variant=glass]>button:not(:disabled)[aria-pressed=true],segmented-control[variant=glass]>button:not(:disabled)[aria-current]:not([aria-current=false]),segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled)[aria-pressed=true]),segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled)[aria-current]:not([aria-current=false])){backdrop-filter:blur(20px) brightness(.95) saturate(1.8);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.8)}segmented-control[variant=glass]>button:not(:disabled)[aria-expanded=true],segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled)[aria-expanded=true]){backdrop-filter:blur(20px) brightness(.95) saturate(2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2)}segmented-control>dropdown-menu:not(:last-child):after{content:"";position:absolute;top:0;bottom:0;right:0;width:.5px;background:var(--tint-200);pointer-events:none}[tone=dark] segmented-control>dropdown-menu:not(:last-child):after{background:var(--tint-400)}ui-spinner{display:inline-flex;align-items:center;justify-content:center;line-height:0;color:inherit}ui-spinner .spin,.spin{display:inline-flex;animation:ui-spinner-spin 1s steps(8,end) infinite}@keyframes ui-spinner-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion: reduce){.spin{animation:none}}system-modal{display:flex;flex-direction:column;width:min(400px,100%);box-sizing:border-box;padding:var(--space-32) var(--space-24);border-radius:var(--radius-12)}system-modal header{display:flex;flex-direction:column;align-items:center;gap:var(--space-16);text-align:center}system-modal header>hgroup{display:flex;flex-direction:column;align-items:center;gap:var(--space-4);max-width:100%}system-modal header h2{margin:0;font-size:var(--text-lg);font-weight:600;letter-spacing:.01em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}system-modal header p{margin:0;font-size:var(--text-base);opacity:.7;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}ui-pill{display:inline-block;vertical-align:baseline;margin:2px 0;padding:0 var(--space-8);font-size:var(--text-sm);font-weight:500;line-height:1.7;border-radius:var(--radius-full);border:1px solid var(--neutral-300);background:var(--neutral-200);color:var(--neutral-900);white-space:nowrap}ui-pill[color=gray]{border-color:var(--neutral-300);background:var(--neutral-200);color:var(--neutral-900)}ui-pill[color=red]{border-color:var(--red-200);background:var(--red-100);color:var(--red-950)}ui-pill[color=orange]{border-color:var(--orange-200);background:var(--orange-100);color:var(--orange-950)}ui-pill[color=yellow]{border-color:var(--yellow-200);background:var(--yellow-100);color:var(--yellow-950)}ui-pill[color=green]{border-color:var(--green-200);background:var(--green-100);color:var(--green-950)}ui-pill[color=blue]{border-color:var(--blue-200);background:var(--blue-100);color:var(--blue-950)}ui-pill[color=purple]{border-color:var(--purple-200);background:var(--purple-100);color:var(--purple-950)}',Gh=new CSSStyleSheet;Gh.replaceSync(DA);const qh=new CSSStyleSheet;try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,Gh,qh]}catch{}sv(document);function ov(n){qh.replaceSync(n)}function el(){ov("")}function Yh(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,Gh,qh]}catch{}sv(n)}const LA=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function zA(n){for(const t of Object.keys(n))if(LA.has(t))throw new Error(`Event payload key "${t}" is reserved; choose a different property name`)}function OA(n,t){zA(t);for(const e of Object.keys(t))Object.defineProperty(n,e,{value:t[e],writable:!0,enumerable:!0,configurable:!0})}function Fe(){class n extends Event{constructor(e,r){const{type:i,bubbles:s,cancelable:o,composed:a,...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:o,composed:a}),OA(this,c)}}return n}class Jt extends globalThis.EventTarget{}function MA(n,t,e){const r=n.dispose.bind(n);n.dispose=()=>{if(!t())return e(),r()}}function Bo(n){var e;class t extends n{constructor(...s){super(...s);w(this,e,!1);MA(this,()=>l(this,e),()=>{S(this,e,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return l(this,e)}}return e=new WeakMap,t}const NA=Fe(),UA=Fe(),FA=Fe(),Ca=Fe(),HA=Fe(),Uc=Fe(),av="0123456789ABCDEFGHJKMNPQRSTVWXYZ",tl=32,ZA=16,lv=10,Tf=0xffffffffffff;var pr;(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"})(pr||(pr={}));class Ss extends Error{constructor(t,e){super(`${e} (${t})`),this.name="ULIDError",this.code=t}}function WA(n){const t=Math.floor(n()*tl)%tl;return av.charAt(t)}function VA(n){const t=BA(),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 Ss(pr.PRNGDetectFailure,"Failed to find a reliable PRNG")}function BA(){return qA()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function jA(n,t){let e="";for(;n>0;n--)e=WA(t)+e;return e}function GA(n,t=lv){if(isNaN(n))throw new Ss(pr.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>Tf)throw new Ss(pr.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Tf}: ${n}`);if(n<0)throw new Ss(pr.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Ss(pr.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let e,r="";for(let i=t;i>0;i--)e=n%tl,r=av.charAt(e)+r,n=(n-e)/tl;return r}function qA(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function Ul(n,t){const e=VA(),r=Date.now();return GA(r,lv)+jA(ZA,e)}const gt=4,lt=6,Ns=2,bu=2,Xh=8,YA=lt,Kh="auto",Wn="auto",En=120,If=50,le=16,zr=En*gt+le*(gt-1),nl=En*lt+le*(lt-1),XA=zr+le*2,KA=200,JA=4,da=150,QA=10,Cf=2,Rf=8,e1=300,t1=4;function cv(n){return dv(n)}function uv(n,t){return dv(n.flatMap(e=>fv(e,t)))}function hv(n){const t=[],e=new Set;for(const r of n){if(r.type==="row"){t.push(`Top-level rows are invalid: ${r.id}`);continue}gv(r,"strip",t,e)}return{valid:t.length===0,errors:t}}function fr(n){const t=cv(n),e=hv(t);if(!e.valid)throw new Error(`Invalid layout: ${e.errors.join("; ")}`);return{totalNodes:t.length,nodes:t.filter(r=>r.type!=="row").map(s1)}}function dv(n){const t=[];for(const e of n){const r=pv(e);for(const i of r){if(i.type==="row"){t.push(...i.children.map(vn));continue}t.push(i)}}return t}function pv(n){switch(n.type){case"card":return[vn(n)];case"row":{const t=n.children.map(vn);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=[];for(const e of n.children){const r=pv(e);for(const i of r){if(i.type==="stack"){t.push(...i.children.map(wu));continue}if(i.type==="row"){t.push({...i,children:i.children.map(vn)});continue}t.push(vn(i))}}return t.length===0?[]:t.length===1?[wu(t[0])]:[{...n,children:t}]}}}function fv(n,t){switch(n.type){case"card":return n.artifactID===t?[]:[vn(n)];case"row":{const e=n.children.filter(r=>r.artifactID!==t).map(vn);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=n.children.flatMap(r=>fv(r,t).filter(s=>s.type!=="stack"));return e.length===0?[]:e.length===1?[wu(e[0])]:[{...n,children:e}]}}}function gv(n,t,e,r){switch(n.type){case"card":mv(n,t,e,r);return;case"row":n1(n,t,e,r);return;case"stack":r1(n,t,e,r);return}}function mv(n,t,e,r){Jh(n.id,e),typeof n.artifactID!="string"||n.artifactID.length===0?e.push(`Card ${n.id} is missing artifactID`):r.has(n.artifactID)?e.push(`Duplicate artifactID in layout: ${n.artifactID}`):r.add(n.artifactID),i1(n.width)||e.push(`Card ${n.id} width must be an integer in the range ${Ns}-${Xh}`),vv(n.height)||e.push(`Card ${n.id} height must be an integer in the range 2-6 or "auto"`);const i=cr(n.width);t==="row"&&i<Ns&&e.push(`Row child ${n.id} must be at least 2 columns wide`)}function n1(n,t,e,r){if(Jh(n.id,e),t!=="stack"&&e.push(`Row ${n.id} may only appear inside a stack`),vv(n.height,t1)||e.push(`Row ${n.id} height must be an integer in the range 2-4 or "auto"`),!Array.isArray(n.children)||n.children.length===0){e.push(`Row ${n.id} must contain card nodes`);return}let i=0;for(const s of n.children){if(s.type!=="card"){e.push(`Row ${n.id} must contain only card nodes`);continue}mv(s,"row",e,r),i+=cr(s.width)}i!==gt&&e.push(`Row ${n.id} children must sum to 4 columns`)}function r1(n,t,e,r){if(Jh(n.id,e),t!=="strip"&&e.push(`Invalid nested stack at ${n.id}; stack children cannot contain another nested stack`),!Array.isArray(n.children)||n.children.length===0){e.push(`Stack ${n.id} must contain at least one child`);return}let i=0,s=0;for(const a of n.children){if(a.type==="stack"){e.push(`Stack ${n.id} cannot contain another nested stack`);continue}if(gv(a,"stack",e,r),a.height===Wn){s+=1;continue}i+=a.height}if(i>lt&&e.push(`Stack ${n.id} exceeds the 6-row budget`),s===0)return;const o=lt-i;if(o<s*bu||o%s!==0){e.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<bu&&e.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function Jh(n,t){(typeof n!="string"||n.length===0)&&t.push(`Node id must be a non-empty string: ${String(n)}`)}function i1(n){return n===Kh||Number.isInteger(n)&&n>=Ns&&n<=Xh}function vv(n,t=YA){return n===Wn||Number.isInteger(n)&&n>=bu&&n<=t}function cr(n){return n===Kh?gt:n}function s1(n){if(n.type==="card")return{id:n.id,type:"card",width:cr(n.width),cards:[{id:n.id,artifactID:n.artifactID,col:1,row:1,width:cr(n.width),height:yv(n.height,lt)}]};const t=o1(n.children),e=[];let r=1;for(let i=0;i<n.children.length;i+=1){const s=n.children[i],o=t[i];if(s.type==="card")e.push({id:s.id,artifactID:s.artifactID,col:1,row:r,width:Math.min(gt,cr(s.width)),height:o});else{let a=1;for(const c of s.children)e.push({id:c.id,artifactID:c.artifactID,col:a,row:r,width:cr(c.width),height:o}),a+=cr(c.width)}r+=o}return{id:n.id,type:"stack",width:e.reduce((i,s)=>Math.max(i,s.col+s.width-1),1),cards:e}}function o1(n){let t=0,e=0;for(const i of n)i.height===Wn?e+=1:t+=i.height;const r=e>0?(lt-t)/e:0;return n.map(i=>yv(i.height,r))}function yv(n,t){return n===Wn?t:n}function vn(n){return{...n}}function wu(n){return n.type==="card"?vn(n):{...n,children:n.children.map(vn)}}function bv(n,t={}){return{id:t.id??Ul(),type:"card",artifactID:n,width:t.width??Kh,height:t.height??Wn}}function wv(n,t){return n.some(e=>Sv(e,t))}function Sv(n,t){switch(n.type){case"card":return n.artifactID===t;case"row":return n.children.some(e=>e.artifactID===t);case"stack":return n.children.some(e=>Sv(e,t))}}function Pf(n){return n.layout.flatMap(_v)}function _v(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(t=>t.artifactID);case"stack":return n.children.flatMap(_v)}}const ae=Fe(),Su=Fe(),ni=Fe(),a1=Fe();function l1(n){class t extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return t}const kv=l1("RequestError"),c1=200,u1=300;class h1{constructor(t,e){m(this,"serverURL");m(this,"token");this.serverURL=t.replace(/\/$/,""),this.token=e.token}async requestJSON(t,e,r){const i=await this.request(t,e,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0),s=await d1(i);if(!i.ok||i.status<c1||i.status>=u1)throw this.createError(typeof s.error=="string"?s.error:i.statusText,i.status);return s}async requestVoid(t,e,r){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 this.createError(await Fc(i,i.statusText),i.status)}async requestText(t,e){const r=await this.request(t,e);if(!r.ok)throw this.createError(await Fc(r,r.statusText),r.status);return r.text()}async requestRawVoid(t,e,r){const i=await this.request(t,e,r,{"content-type":"text/plain"});if(!i.ok)throw this.createError(await Fc(i,i.statusText),i.status)}createError(t,e){const r={serverURL:this.serverURL};return e!==void 0&&(r.status=e),new kv(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(o){throw this.createError(o instanceof Error?o.message:"Failed to reach server")}}buildHeaders(t){const e={...t??{}};return this.token&&(e.Authorization=`Bearer ${this.token}`),Object.keys(e).length>0?e:void 0}}async function d1(n){try{return await n.json()}catch{const t=await n.text().catch(()=>"");return t?{message:t}:{}}}async function Fc(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 p1(n){return n.map(t=>`${t.name} (${t.id})`).join(", ")}var Ot,gl,xv;class f1{constructor(t){w(this,gl);w(this,Ot);S(this,Ot,t)}list(){return l(this,Ot).requestJSON("GET","/screens")}async get(t={}){const e=await f(this,gl,xv).call(this,t.screenID);return l(this,Ot).requestJSON("GET",`/screens/${encodeURIComponent(e)}`)}create(t){const e={name:t.name};return t.id!==void 0&&(e.id=t.id),l(this,Ot).requestJSON("POST","/screens",e)}update(t){const{screenID:e,...r}=t;return l(this,Ot).requestJSON("PATCH",`/screens/${encodeURIComponent(e)}`,r)}remove(t){return l(this,Ot).requestJSON("DELETE",`/screens/${encodeURIComponent(t.screenID)}`)}}Ot=new WeakMap,gl=new WeakSet,xv=async function(t){if(t!==void 0)return t;const{screens:e}=await this.list();if(e.length===1)return e[0].id;throw l(this,Ot).createError(`screenID is required when multiple screens exist. Available screens: ${p1(e)}`)};var Ue;class g1{constructor(t){w(this,Ue);S(this,Ue,t)}create(t){const e={kind:t.kind,title:t.title};switch(t.kind){case"markdown":e.externalFilePath=t.externalFilePath;break;case"url":e.externalURL=t.externalURL;break;case"web-bundle":t.skipPending!==void 0&&(e.skipPending=t.skipPending);break}return t.screenID!==void 0&&(e.screenID=t.screenID),l(this,Ue).requestJSON("POST","/artifacts",e)}list(t={}){const e=new URLSearchParams;t.screenID!==void 0&&e.set("screenID",t.screenID),t.unplaced&&e.set("unplaced","true");const r=e.toString();return l(this,Ue).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(t){return l(this,Ue).requestJSON("GET",`/artifacts/${encodeURIComponent(t.artifactID)}`)}update(t){const e={};return t.title!==void 0&&(e.title=t.title),l(this,Ue).requestJSON("PATCH",`/artifacts/${encodeURIComponent(t.artifactID)}`,e)}edit(t){return l(this,Ue).requestJSON("POST",`/artifacts/${encodeURIComponent(t.artifactID)}/edit`)}commitPending(t){return l(this,Ue).requestJSON("POST",`/artifacts/${encodeURIComponent(t.artifactID)}/commit`)}abandonPending(t){return l(this,Ue).requestVoid("POST",`/artifacts/${encodeURIComponent(t.artifactID)}/abandon`)}attach(t){return l(this,Ue).requestJSON("POST",`/screens/${encodeURIComponent(t.screenID)}/artifacts/${encodeURIComponent(t.artifactID)}`)}detach(t){return l(this,Ue).requestJSON("DELETE",`/screens/${encodeURIComponent(t.screenID)}/artifacts/${encodeURIComponent(t.artifactID)}`)}delete(t){return l(this,Ue).requestJSON("DELETE",`/artifacts/${encodeURIComponent(t.artifactID)}`)}getContent(t){return l(this,Ue).requestText("GET",`/artifacts/${encodeURIComponent(t.artifactID)}/content`)}putContent(t){return l(this,Ue).requestRawVoid("PUT",`/artifacts/${encodeURIComponent(t.artifactID)}/content`,t.content)}}Ue=new WeakMap;var mr;class m1{constructor(t){w(this,mr);S(this,mr,t)}get(){return l(this,mr).requestJSON("GET","/display")}patch(t){const e={};return t.activeScreenID!==void 0&&(e.activeScreenID=t.activeScreenID),t.activeThemeName!==void 0&&(e.activeThemeName=t.activeThemeName),l(this,mr).requestVoid("PATCH","/display",e)}focus(t){const e={artifactID:t.artifactID};return t.screenID!==void 0&&(e.screenID=t.screenID),l(this,mr).requestJSON("POST","/display/focus",e)}}mr=new WeakMap;var Vs;class v1{constructor(t){w(this,Vs);S(this,Vs,t)}async list(){const{views:t}=await l(this,Vs).requestJSON("GET","/views");return t}}Vs=new WeakMap;var un;class y1{constructor(t,e={}){m(this,"screens");m(this,"artifacts");m(this,"display");m(this,"views");w(this,un);S(this,un,new h1(t,e)),this.screens=new f1(l(this,un)),this.artifacts=new g1(l(this,un)),this.display=new m1(l(this,un)),this.views=new v1(l(this,un))}health(){return l(this,un).requestJSON("GET","/health")}}un=new WeakMap;const b1={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},w1="Local",S1="store-";function be(n){return new URL(n).origin}function _1(n){return{servers:[{url:be(n),name:w1}],activeServerURL:null,activeScreenID:null,tabs:{},screens:{}}}function k1(n,t){return[...n.tabs[be(t)]??[]]}function x1(n,t,e){const r=be(t),i=n.tabs[r]??[];return i.includes(e)?n:{...n,tabs:{...n.tabs,[r]:[...i,e]}}}function E1(n,t,e){const r=be(t),i=n.tabs[r]??[],s=i.filter(a=>a!==e);if(s.length===i.length)return n;const o={...n.tabs};return s.length===0?delete o[r]:o[r]=s,{...n,tabs:o}}var vr,yr,br;class A1 extends Jt{constructor(e,r,i={}){super();w(this,vr);w(this,yr);w(this,br);S(this,vr,`${S1}${e}`),S(this,yr,i.storage??$1());const s=l(this,yr).getItem(l(this,vr));s===null?(S(this,br,r),l(this,yr).setItem(l(this,vr),JSON.stringify(r))):S(this,br,T1(JSON.parse(s),r))}get(){return l(this,br)}set(e){S(this,br,e),l(this,yr).setItem(l(this,vr),JSON.stringify(e)),this.dispatchEvent(new ae("change"))}}vr=new WeakMap,yr=new WeakMap,br=new WeakMap;function $1(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function T1(n,t){return{servers:Array.isArray(n.servers)?n.servers:t.servers,activeServerURL:typeof n.activeServerURL=="string"||n.activeServerURL===null?n.activeServerURL:t.activeServerURL,activeScreenID:typeof n.activeScreenID=="string"||n.activeScreenID===null?n.activeScreenID:t.activeScreenID,tabs:n.tabs&&typeof n.tabs=="object"?n.tabs:t.tabs,screens:n.screens&&typeof n.screens=="object"?n.screens:t.screens}}const I1=Bo(Jt);var wr,Xe,Sr,We,$n,Tn,te,si,Ev,Bs,Av,$v,Tv,Iv,_u,ku,xu,Cv;class C1 extends I1{constructor(e){var i;super();w(this,te);m(this,"id");m(this,"server");w(this,wr);w(this,Xe,new Map);w(this,Sr);w(this,We);w(this,$n);w(this,Tn,null);w(this,Bs,e=>{if(this.disposed)return;const r=e.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&f(this,te,Av).call(this,r.screen);break;case"artifact-created":break;case"artifact-attached":r.screenID===this.id&&f(this,te,$v).call(this,r.cardID,r.artifact);break;case"artifact-updated":f(this,te,Tv).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&f(this,te,Iv).call(this,r.artifactID);break;case"artifact-content-changed":l(this,Xe).has(r.artifactID)&&this.dispatchEvent(new a1("artifact-content-changed",{artifactID:r.artifactID}));break}});this.id=e.screen.id,this.server=e.server,S(this,wr,e.localStore),S(this,Sr,e.screen.name),S(this,We,structuredClone(e.screen.layout));const r=((i=l(this,wr).get().screens[this.id])==null?void 0:i.scrollPosition)??0;S(this,$n,Math.max(0,r)),this.server.addEventListener("server-event",l(this,Bs)),f(this,te,Ev).call(this)}get name(){return l(this,Sr)}get layout(){return l(this,We)}get scrollPosition(){return l(this,$n)}get artifacts(){return l(this,Xe)}setScrollPosition(e){f(this,te,si).call(this);const r=Math.max(0,e);r!==l(this,$n)&&(S(this,$n,r),f(this,te,Cv).call(this),this.dispatchEvent(new ae("change")))}setLayout(e){f(this,te,si).call(this);const r=cv(e);if(!hv(r).valid)return;const s=f(this,te,ku).call(this);S(this,We,r),S(this,Tn,{layout:r,snapshot:s}),this.dispatchEvent(new ae("change")),this.server.client.screens.update({screenID:this.id,layout:r.map(o=>structuredClone(o))}).catch(()=>{var o;this.disposed||((o=l(this,Tn))==null?void 0:o.layout)===r&&(S(this,Tn,null),f(this,te,xu).call(this,s),this.dispatchEvent(new ae("change")))})}rename(e){f(this,te,si).call(this),S(this,Sr,e),this.dispatchEvent(new ae("change")),this.server.client.screens.update({screenID:this.id,name:e}).catch(()=>{})}async remove(){f(this,te,si).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(e){if(f(this,te,si).call(this),!l(this,Xe).has(e))return;const r=f(this,te,ku).call(this);f(this,te,_u).call(this,e),this.dispatchEvent(new ae("change")),this.server.client.artifacts.detach({artifactID:e,screenID:this.id}).catch(()=>{this.disposed||(f(this,te,xu).call(this,r),this.dispatchEvent(new ae("change")))})}dispose(){this.server.removeEventListener("server-event",l(this,Bs))}}wr=new WeakMap,Xe=new WeakMap,Sr=new WeakMap,We=new WeakMap,$n=new WeakMap,Tn=new WeakMap,te=new WeakSet,si=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},Ev=async function(){try{const e=await this.server.client.screens.get({screenID:this.id});if(this.disposed)return;for(const r of e.artifacts)l(this,Xe).set(r.id,r);this.dispatchEvent(new ae("change"))}catch{}},Bs=new WeakMap,Av=function(e){l(this,Tn)&&S(this,Tn,null),S(this,Sr,e.name),S(this,We,structuredClone(e.layout)),this.dispatchEvent(new ae("change"))},$v=function(e,r){wv(l(this,We),r.id)||S(this,We,[...l(this,We),bv(r.id,{id:e})]),l(this,Xe).set(r.id,r),this.dispatchEvent(new ae("change"))},Tv=function(e){const r=l(this,Xe).get(e.id);r&&(l(this,Xe).set(e.id,{...r,...e}),this.dispatchEvent(new ae("change")))},Iv=function(e){f(this,te,_u).call(this,e)&&this.dispatchEvent(new ae("change"))},_u=function(e){const r=l(this,Xe).delete(e),i=Pf({layout:l(this,We)}).length,s=uv(l(this,We),e),o=Pf({layout:s}).length;return S(this,We,s),r||i!==o},ku=function(){return{layout:structuredClone(l(this,We)),artifacts:new Map([...l(this,Xe).entries()].map(([e,r])=>[e,structuredClone(r)]))}},xu=function(e){S(this,We,structuredClone(e.layout)),l(this,Xe).clear();for(const[r,i]of e.artifacts)l(this,Xe).set(r,structuredClone(i))},Cv=function(){const e=l(this,wr).get();l(this,wr).set({...e,screens:{...e.screens,[this.id]:{scrollPosition:l(this,$n)}}})};const R1=Bo(Jt);var Le,Ke,Mt,js,Gs,qs,Be,Ra,Eu,oi;class P1 extends R1{constructor(e){super();w(this,Be);w(this,Le);w(this,Ke);w(this,Mt,null);w(this,js,()=>{this.disposed||f(this,Be,Ra).call(this)});w(this,Gs,()=>{this.disposed||f(this,Be,Ra).call(this)});w(this,qs,e=>{if(this.disposed)return;const r=e.event;if(r.type==="screen-removed"){this.removeTab(e.serverURL,r.screenID);const i=l(this,Le).get();i.activeServerURL===be(e.serverURL)&&i.activeScreenID===r.screenID&&f(this,Be,oi).call(this,e.serverURL,null);return}if(r.type==="screen-changed"){if(r.screenID===null){f(this,Be,oi).call(this,e.serverURL,null);return}const i=l(this,Ke).servers.get(be(e.serverURL));if(!i||!i.screens.has(r.screenID))return;this.addTab(e.serverURL,r.screenID),f(this,Be,oi).call(this,e.serverURL,r.screenID)}});S(this,Le,e.localStore),S(this,Ke,e.serverManager),l(this,Le).addEventListener("change",l(this,js)),l(this,Ke).addEventListener("change",l(this,Gs)),l(this,Ke).addEventListener("server-event",l(this,qs)),f(this,Be,Ra).call(this)}get activeScreen(){return l(this,Mt)}getTabs(e){const r=be(e),i=k1(l(this,Le).get(),r),s=l(this,Ke).servers.get(r);return s?i.filter(o=>s.screens.has(o)):i}hasTab(e,r){return this.getTabs(e).includes(r)}addTab(e,r){const i=be(e),s=l(this,Ke).servers.get(i);s&&!s.screens.has(r)||f(this,Be,Eu).call(this,x1(l(this,Le).get(),i,r))}removeTab(e,r){f(this,Be,Eu).call(this,E1(l(this,Le).get(),e,r))}setActive(e,r){const i=be(e),s=l(this,Ke).servers.get(i);!s||!s.screens.has(r)||f(this,Be,oi).call(this,i,r)&&s.client.display.patch({activeScreenID:r}).catch(()=>{})}clearActive(){const e=l(this,Le).get().activeServerURL;if(!e||!f(this,Be,oi).call(this,e,null))return;const r=l(this,Ke).servers.get(e);r==null||r.client.display.patch({activeScreenID:null}).catch(()=>{})}dispose(){var e;l(this,Le).removeEventListener("change",l(this,js)),l(this,Ke).removeEventListener("change",l(this,Gs)),l(this,Ke).removeEventListener("server-event",l(this,qs)),(e=l(this,Mt))==null||e.dispose(),S(this,Mt,null)}}Le=new WeakMap,Ke=new WeakMap,Mt=new WeakMap,js=new WeakMap,Gs=new WeakMap,qs=new WeakMap,Be=new WeakSet,Ra=function(){var c,u,h;const{activeServerURL:e,activeScreenID:r}=l(this,Le).get(),i=e?l(this,Ke).servers.get(e)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((c=l(this,Mt))==null?void 0:c.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=l(this,Mt))==null?void 0:u.server)===i||((h=l(this,Mt))==null||h.dispose(),S(this,Mt,i&&s?new C1({screen:s,server:i,localStore:l(this,Le)}):null),i&&i.acpClient.setScreenContext(s?{screenID:s.id,screenName:s.name}:null),this.dispatchEvent(new NA("active-screen-changed")))},Eu=function(e){e!==l(this,Le).get()&&(l(this,Le).set(e),this.dispatchEvent(new UA("tabs-changed")))},oi=function(e,r){const i=be(e),s=l(this,Le).get();return s.activeServerURL===i&&s.activeScreenID===r?!1:(l(this,Le).set({...s,activeServerURL:i,activeScreenID:r}),!0)};function A(n,t,e){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(n))return;a._zod.traits.add(n),t(a,c);const u=o.prototype,h=Object.keys(u);for(let p=0;p<h.length;p++){const v=h[p];v in a||(a[v]=u[v].bind(a))}}const i=(e==null?void 0:e.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function o(a){var c;const u=e!=null&&e.Parent?new s:this;r(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const h of u._zod.deferred)h();return u}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var c,u;return e!=null&&e.Parent&&a instanceof e.Parent?!0:(u=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:u.has(n)}}),Object.defineProperty(o,"name",{value:n}),o}class yi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Rv extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Pv={};function Vn(n){return Pv}function Dv(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 Au(n,t){return typeof t=="bigint"?t.toString():t}function Qh(n){return{get value(){{const t=n();return Object.defineProperty(this,"value",{value:t}),t}}}}function ed(n){return n==null}function td(n){const t=n.startsWith("^")?1:0,e=n.endsWith("$")?n.length-1:n.length;return n.slice(t,e)}function D1(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,o=Number.parseInt(n.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return o%a/10**s}const Df=Symbol("evaluating");function ne(n,t,e){let r;Object.defineProperty(n,t,{get(){if(r!==Df)return r===void 0&&(r=Df,r=e()),r},set(i){Object.defineProperty(n,t,{value:i})},configurable:!0})}function Vr(n,t,e){Object.defineProperty(n,t,{value:e,writable:!0,enumerable:!0,configurable:!0})}function Xn(...n){const t={};for(const e of n){const r=Object.getOwnPropertyDescriptors(e);Object.assign(t,r)}return Object.defineProperties({},t)}function Lf(n){return JSON.stringify(n)}function L1(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Lv="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function rl(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const z1=Qh(()=>{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 Vi(n){if(rl(n)===!1)return!1;const t=n.constructor;if(t===void 0||typeof t!="function")return!0;const e=t.prototype;return!(rl(e)===!1||Object.prototype.hasOwnProperty.call(e,"isPrototypeOf")===!1)}function zv(n){return Vi(n)?{...n}:Array.isArray(n)?[...n]:n}const O1=new Set(["string","number","symbol"]);function Bi(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Kn(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 M(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 M1(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}const N1={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 U1(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=Xn(n._zod.def,{get shape(){const o={};for(const a in t){if(!(a in e.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(o[a]=e.shape[a])}return Vr(this,"shape",o),o},checks:[]});return Kn(n,s)}function F1(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=Xn(n._zod.def,{get shape(){const o={...n._zod.def.shape};for(const a in t){if(!(a in e.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete o[a]}return Vr(this,"shape",o),o},checks:[]});return Kn(n,s)}function H1(n,t){if(!Vi(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 o in t)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=Xn(n._zod.def,{get shape(){const s={...n._zod.def.shape,...t};return Vr(this,"shape",s),s}});return Kn(n,i)}function Z1(n,t){if(!Vi(t))throw new Error("Invalid input to safeExtend: expected a plain object");const e=Xn(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t};return Vr(this,"shape",r),r}});return Kn(n,e)}function W1(n,t){const e=Xn(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t._zod.def.shape};return Vr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Kn(n,e)}function V1(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 o=Xn(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(e)for(const u in e){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);e[u]&&(c[u]=n?new n({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=n?new n({type:"optional",innerType:a[u]}):a[u];return Vr(this,"shape",c),c},checks:[]});return Kn(t,o)}function B1(n,t,e){const r=Xn(t._zod.def,{get shape(){const i=t._zod.def.shape,s={...i};if(e)for(const o in e){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(s[o]=new n({type:"nonoptional",innerType:i[o]}))}else for(const o in i)s[o]=new n({type:"nonoptional",innerType:i[o]});return Vr(this,"shape",s),s}});return Kn(t,r)}function gi(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 mi(n,t){return t.map(e=>{var r;return(r=e).path??(r.path=[]),e.path.unshift(n),e})}function pa(n){return typeof n=="string"?n:n==null?void 0:n.message}function Bn(n,t,e){var i,s,o,a,c,u;const r={...n,path:n.path??[]};if(!n.message){const h=pa((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??pa((a=t==null?void 0:t.error)==null?void 0:a.call(t,n))??pa((c=e.customError)==null?void 0:c.call(e,n))??pa((u=e.localeError)==null?void 0:u.call(e,n))??"Invalid input";r.message=h}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function nd(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function Us(...n){const[t,e,r]=n;return typeof t=="string"?{message:t,code:"custom",input:e,inst:r}:{...t}}const Ov=(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,Au,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},Mv=A("$ZodError",Ov),Nv=A("$ZodError",Ov,{Parent:Error});function j1(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 G1(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(o=>r({issues:o}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)e._errors.push(t(s));else{let o=e,a=0;for(;a<s.path.length;){const c=s.path[a];a===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(s))):o[c]=o[c]||{_errors:[]},o=o[c],a++}}};return r(n),e}const rd=n=>(t,e,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:e,issues:[]},s);if(o instanceof Promise)throw new yi;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>Bn(c,s,Vn())));throw Lv(a,i==null?void 0:i.callee),a}return o.value},id=n=>async(t,e,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:e,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>Bn(c,s,Vn())));throw Lv(a,i==null?void 0:i.callee),a}return o.value},Fl=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 yi;return s.issues.length?{success:!1,error:new(n??Mv)(s.issues.map(o=>Bn(o,i,Vn())))}:{success:!0,data:s.value}},q1=Fl(Nv),Hl=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(o=>Bn(o,i,Vn())))}:{success:!0,data:s.value}},Y1=Hl(Nv),X1=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return rd(n)(t,e,i)},K1=n=>(t,e,r)=>rd(n)(t,e,r),J1=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return id(n)(t,e,i)},Q1=n=>async(t,e,r)=>id(n)(t,e,r),e$=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Fl(n)(t,e,i)},t$=n=>(t,e,r)=>Fl(n)(t,e,r),n$=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Hl(n)(t,e,i)},r$=n=>async(t,e,r)=>Hl(n)(t,e,r),i$=/^[cC][^\s-]{8,}$/,s$=/^[0-9a-z]+$/,o$=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,a$=/^[0-9a-vA-V]{20}$/,l$=/^[A-Za-z0-9]{27}$/,c$=/^[a-zA-Z0-9_-]{21}$/,u$=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,h$=/^([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})$/,zf=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)$/,d$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,p$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function f$(){return new RegExp(p$,"u")}const g$=/^(?:(?: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])$/,m$=/^(([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}|:))$/,v$=/^((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])$/,y$=/^(([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])$/,b$=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Uv=/^[A-Za-z0-9_-]*$/,w$=/^\+[1-9]\d{6,14}$/,Fv="(?:(?:\\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])))",S$=new RegExp(`^${Fv}$`);function Hv(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 _$(n){return new RegExp(`^${Hv(n)}$`)}function k$(n){const t=Hv({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(`^${Fv}T(?:${r})$`)}const x$=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}$`)},E$=/^-?\d+$/,Zv=/^-?\d+(?:\.\d+)?$/,A$=/^(?:true|false)$/i,$$=/^[^A-Z]*$/,T$=/^[^a-z]*$/,rt=A("$ZodCheck",(n,t)=>{var e;n._zod??(n._zod={}),n._zod.def=t,(e=n._zod).onattach??(e.onattach=[])}),Wv={number:"number",bigint:"bigint",object:"date"},Vv=A("$ZodCheckLessThan",(n,t)=>{rt.init(n,t);const e=Wv[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})}}),Bv=A("$ZodCheckGreaterThan",(n,t)=>{rt.init(n,t);const e=Wv[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})}}),I$=A("$ZodCheckMultipleOf",(n,t)=>{rt.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):D1(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})}}),C$=A("$ZodCheckNumberFormat",(n,t)=>{var o;rt.init(n,t),t.format=t.format||"float64";const e=(o=t.format)==null?void 0:o.includes("int"),r=e?"int":"number",[i,s]=N1[t.format];n._zod.onattach.push(a=>{const c=a._zod.bag;c.format=t.format,c.minimum=i,c.maximum=s,e&&(c.pattern=E$)}),n._zod.check=a=>{const c=a.value;if(e){if(!Number.isInteger(c)){a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:n});return}if(!Number.isSafeInteger(c)){c>0?a.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}):a.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&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!t.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:n,continue:!t.abort})}}),R$=A("$ZodCheckMaxLength",(n,t)=>{var e;rt.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!ed(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 o=nd(i);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),P$=A("$ZodCheckMinLength",(n,t)=>{var e;rt.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!ed(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 o=nd(i);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),D$=A("$ZodCheckLengthEquals",(n,t)=>{var e;rt.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!ed(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 o=nd(i),a=s>t.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!t.abort})}}),Zl=A("$ZodCheckStringFormat",(n,t)=>{var e,r;rt.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=()=>{})}),L$=A("$ZodCheckRegex",(n,t)=>{Zl.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})}}),z$=A("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=$$),Zl.init(n,t)}),O$=A("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=T$),Zl.init(n,t)}),M$=A("$ZodCheckIncludes",(n,t)=>{rt.init(n,t);const e=Bi(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})}}),N$=A("$ZodCheckStartsWith",(n,t)=>{rt.init(n,t);const e=new RegExp(`^${Bi(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})}}),U$=A("$ZodCheckEndsWith",(n,t)=>{rt.init(n,t);const e=new RegExp(`.*${Bi(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})}}),F$=A("$ZodCheckOverwrite",(n,t)=>{rt.init(n,t),n._zod.check=e=>{e.value=t.tx(e.value)}});class H${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(`
1
+ var Yw=Object.defineProperty;var op=n=>{throw TypeError(n)};var Xw=(n,t,e)=>t in n?Yw(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var m=(n,t,e)=>Xw(n,typeof t!="symbol"?t+"":t,e),gc=(n,t,e)=>t.has(n)||op("Cannot "+e);var l=(n,t,e)=>(gc(n,t,"read from private field"),e?e.call(n):t.get(n)),w=(n,t,e)=>t.has(n)?op("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),S=(n,t,e,r)=>(gc(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e),f=(n,t,e)=>(gc(n,t,"access private method"),e);var ap=(n,t,e,r)=>({set _(i){S(n,t,i,e)},get _(){return l(n,t,r)}});(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function e(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=e(i);fetch(i.href,s)}})();var cr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Kw(n){if(n.__esModule)return n;var t=n.default;if(typeof t=="function"){var e=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),e}var lp=Object.prototype.toString,lm=function(t){var e=lp.call(t),r=e==="[object Arguments]";return r||(r=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&lp.call(t.callee)==="[object Function]"),r},mc,cp;function Jw(){if(cp)return mc;cp=1;var n;if(!Object.keys){var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=lm,i=Object.prototype.propertyIsEnumerable,s=!i.call({toString:null},"toString"),o=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],c=function(v){var g=v.constructor;return g&&g.prototype===v},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if(typeof window>"u")return!1;for(var v in window)try{if(!u["$"+v]&&t.call(window,v)&&window[v]!==null&&typeof window[v]=="object")try{c(window[v])}catch{return!0}}catch{return!0}return!1}(),p=function(v){if(typeof window>"u"||!h)return c(v);try{return c(v)}catch{return!1}};n=function(g){var _=g!==null&&typeof g=="object",k=e.call(g)==="[object Function]",I=r(g),P=_&&e.call(g)==="[object String]",R=[];if(!_&&!k&&!I)throw new TypeError("Object.keys called on a non-object");var Z=o&&k;if(P&&g.length>0&&!t.call(g,0))for(var N=0;N<g.length;++N)R.push(String(N));if(I&&g.length>0)for(var F=0;F<g.length;++F)R.push(String(F));else for(var Y in g)!(Z&&Y==="prototype")&&t.call(g,Y)&&R.push(String(Y));if(s)for(var j=p(g),oe=0;oe<a.length;++oe)!(j&&a[oe]==="constructor")&&t.call(g,a[oe])&&R.push(a[oe]);return R}}return mc=n,mc}var Qw=Array.prototype.slice,e0=lm,up=Object.keys,xa=up?function(t){return up(t)}:Jw(),hp=Object.keys;xa.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(r){return e0(r)?hp(Qw.call(r)):hp(r)})}else Object.keys=xa;return Object.keys||xa};var t0=xa,Ea=Object.defineProperty||!1;if(Ea)try{Ea({},"a",{value:1})}catch{Ea=!1}var Oo=Ea,_n=SyntaxError,X=TypeError,n0=Object.getOwnPropertyDescriptor,Aa=n0;if(Aa)try{Aa([],"length")}catch{Aa=null}var Yi=Aa,dp=Oo,r0=_n,Jr=X,pp=Yi,cm=function(t,e,r){if(!t||typeof t!="object"&&typeof t!="function")throw new Jr("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new Jr("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Jr("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Jr("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Jr("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Jr("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,c=!!pp&&pp(t,e);if(dp)dp(t,e,{configurable:o===null&&c?c.configurable:!o,enumerable:i===null&&c?c.enumerable:!i,value:r,writable:s===null&&c?c.writable:!s});else if(a||!i&&!s&&!o)t[e]=r;else throw new r0("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},gu=Oo,um=function(){return!!gu};um.hasArrayLengthDefineBug=function(){if(!gu)return null;try{return gu([],"length",{value:1}).length!==1}catch{return!0}};var zl=um,i0=t0,s0=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",o0=Object.prototype.toString,a0=Array.prototype.concat,fp=cm,l0=function(n){return typeof n=="function"&&o0.call(n)==="[object Function]"},hm=zl(),c0=function(n,t,e,r){if(t in n){if(r===!0){if(n[t]===e)return}else if(!l0(r)||!r())return}hm?fp(n,t,e,!0):fp(n,t,e)},dm=function(n,t){var e=arguments.length>2?arguments[2]:{},r=i0(t);s0&&(r=a0.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i<r.length;i+=1)c0(n,r[i],t[r[i]],e[r[i]])};dm.supportsDescriptors=!!hm;var Zr=dm,$a={exports:{}};typeof self<"u"?$a.exports=self:typeof window<"u"?$a.exports=window:$a.exports=Function("return this")();var pm=$a.exports,u0=pm,fm=function(){return typeof cr!="object"||!cr||cr.Math!==Math||cr.Array!==Array?u0:cr},h0=Zr,d0=Yi,p0=fm,f0=function(){var t=p0();if(h0.supportsDescriptors){var e=d0(t,"globalThis");(!e||e.configurable&&(e.enumerable||!e.writable||globalThis!==t))&&Object.defineProperty(t,"globalThis",{configurable:!0,enumerable:!1,value:t,writable:!0})}else(typeof globalThis!="object"||globalThis!==t)&&(t.globalThis=t);return t},g0=Zr,m0=pm,gm=fm,v0=f0,y0=gm(),mm=function(){return y0};g0(mm,{getPolyfill:gm,implementation:m0,shim:v0});var Ih=mm,kn=function(t){return!!t&&(typeof t=="function"||typeof t=="object")},Ch=Object,vm=Error,b0=EvalError,w0=RangeError,Rh=ReferenceError,S0=URIError,_0=Math.abs,k0=Math.floor,x0=Math.max,E0=Math.min,A0=Math.pow,$0=Math.round,Ph=Number.isNaN||function(t){return t!==t},T0=Ph,I0=function(t){return T0(t)||t===0?t:t<0?-1:1},Xi=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 o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==i||a.enumerable!==!0)return!1}return!0},gp=typeof Symbol<"u"&&Symbol,C0=Xi,Dh=function(){return typeof gp!="function"||typeof Symbol!="function"||typeof gp("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:C0()},vc,mp;function ym(){return mp||(mp=1,vc=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),vc}var yc,vp;function bm(){if(vp)return yc;vp=1;var n=Ch;return yc=n.getPrototypeOf||null,yc}var R0="Function.prototype.bind called on incompatible ",P0=Object.prototype.toString,D0=Math.max,L0="[object Function]",yp=function(t,e){for(var r=[],i=0;i<t.length;i+=1)r[i]=t[i];for(var s=0;s<e.length;s+=1)r[s+t.length]=e[s];return r},z0=function(t,e){for(var r=[],i=e,s=0;i<t.length;i+=1,s+=1)r[s]=t[i];return r},O0=function(n,t){for(var e="",r=0;r<n.length;r+=1)e+=n[r],r+1<n.length&&(e+=t);return e},M0=function(t){var e=this;if(typeof e!="function"||P0.apply(e)!==L0)throw new TypeError(R0+e);for(var r=z0(arguments,1),i,s=function(){if(this instanceof i){var h=e.apply(this,yp(r,arguments));return Object(h)===h?h:this}return e.apply(t,yp(r,arguments))},o=D0(0,e.length-r.length),a=[],c=0;c<o;c++)a[c]="$"+c;if(i=Function("binder","return function ("+O0(a,",")+"){ return binder.apply(this,arguments); }")(s),e.prototype){var u=function(){};u.prototype=e.prototype,i.prototype=new u,u.prototype=null}return i},N0=M0,Mo=Function.prototype.bind||N0,Lh=Function.prototype.call,zh=Function.prototype.apply,U0=typeof Reflect<"u"&&Reflect&&Reflect.apply,F0=Mo,H0=zh,Z0=Lh,W0=U0,wm=W0||F0.call(Z0,H0),V0=Mo,B0=X,j0=Lh,G0=wm,Ol=function(t){if(t.length<1||typeof t[0]!="function")throw new B0("a function is required");return G0(V0,j0,t)},bc,bp;function q0(){if(bp)return bc;bp=1;var n=Ol,t=Yi,e;try{e=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var r=!!e&&t&&t(Object.prototype,"__proto__"),i=Object,s=i.getPrototypeOf;return bc=r&&typeof r.get=="function"?n([r.get]):typeof s=="function"?function(a){return s(a==null?a:i(a))}:!1,bc}var wc,wp;function Sm(){if(wp)return wc;wp=1;var n=ym(),t=bm(),e=q0();return wc=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,wc}var Y0=Function.prototype.call,X0=Object.prototype.hasOwnProperty,K0=Mo,xn=K0.call(Y0,X0),q,J0=Ch,Q0=vm,eS=b0,tS=w0,nS=Rh,Wi=_n,vi=X,rS=S0,iS=_0,sS=k0,oS=x0,aS=E0,lS=A0,cS=$0,uS=I0,_m=Function,Sc=function(n){try{return _m('"use strict"; return ('+n+").constructor;")()}catch{}},Ms=Yi,hS=Oo,_c=function(){throw new vi},dS=Ms?function(){try{return arguments.callee,_c}catch{try{return Ms(arguments,"callee").get}catch{return _c}}}():_c,Qr=Dh(),Te=Sm(),pS=bm(),fS=ym(),km=zh,No=Lh,ii={},gS=typeof Uint8Array>"u"||!Te?q:Te(Uint8Array),Lr={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?q:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?q:ArrayBuffer,"%ArrayIteratorPrototype%":Qr&&Te?Te([][Symbol.iterator]()):q,"%AsyncFromSyncIteratorPrototype%":q,"%AsyncFunction%":ii,"%AsyncGenerator%":ii,"%AsyncGeneratorFunction%":ii,"%AsyncIteratorPrototype%":ii,"%Atomics%":typeof Atomics>"u"?q:Atomics,"%BigInt%":typeof BigInt>"u"?q:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?q:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?q:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?q:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Q0,"%eval%":eval,"%EvalError%":eS,"%Float16Array%":typeof Float16Array>"u"?q:Float16Array,"%Float32Array%":typeof Float32Array>"u"?q:Float32Array,"%Float64Array%":typeof Float64Array>"u"?q:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?q:FinalizationRegistry,"%Function%":_m,"%GeneratorFunction%":ii,"%Int8Array%":typeof Int8Array>"u"?q:Int8Array,"%Int16Array%":typeof Int16Array>"u"?q:Int16Array,"%Int32Array%":typeof Int32Array>"u"?q:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Qr&&Te?Te(Te([][Symbol.iterator]())):q,"%JSON%":typeof JSON=="object"?JSON:q,"%Map%":typeof Map>"u"?q:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Qr||!Te?q:Te(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":J0,"%Object.getOwnPropertyDescriptor%":Ms,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?q:Promise,"%Proxy%":typeof Proxy>"u"?q:Proxy,"%RangeError%":tS,"%ReferenceError%":nS,"%Reflect%":typeof Reflect>"u"?q:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?q:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Qr||!Te?q:Te(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?q:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Qr&&Te?Te(""[Symbol.iterator]()):q,"%Symbol%":Qr?Symbol:q,"%SyntaxError%":Wi,"%ThrowTypeError%":dS,"%TypedArray%":gS,"%TypeError%":vi,"%Uint8Array%":typeof Uint8Array>"u"?q:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?q:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?q:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?q:Uint32Array,"%URIError%":rS,"%WeakMap%":typeof WeakMap>"u"?q:WeakMap,"%WeakRef%":typeof WeakRef>"u"?q:WeakRef,"%WeakSet%":typeof WeakSet>"u"?q:WeakSet,"%Function.prototype.call%":No,"%Function.prototype.apply%":km,"%Object.defineProperty%":hS,"%Object.getPrototypeOf%":pS,"%Math.abs%":iS,"%Math.floor%":sS,"%Math.max%":oS,"%Math.min%":aS,"%Math.pow%":lS,"%Math.round%":cS,"%Math.sign%":uS,"%Reflect.getPrototypeOf%":fS};if(Te)try{null.error}catch(n){var mS=Te(Te(n));Lr["%Error.prototype%"]=mS}var vS=function n(t){var e;if(t==="%AsyncFunction%")e=Sc("async function () {}");else if(t==="%GeneratorFunction%")e=Sc("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Sc("async function* () {}");else if(t==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&Te&&(e=Te(i.prototype))}return Lr[t]=e,e},Sp={__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"]},Uo=Mo,Ja=xn,yS=Uo.call(No,Array.prototype.concat),bS=Uo.call(km,Array.prototype.splice),_p=Uo.call(No,String.prototype.replace),Qa=Uo.call(No,String.prototype.slice),wS=Uo.call(No,RegExp.prototype.exec),SS=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,_S=/\\(\\)?/g,kS=function(t){var e=Qa(t,0,1),r=Qa(t,-1);if(e==="%"&&r!=="%")throw new Wi("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new Wi("invalid intrinsic syntax, expected opening `%`");var i=[];return _p(t,SS,function(s,o,a,c){i[i.length]=a?_p(c,_S,"$1"):o||s}),i},xS=function(t,e){var r=t,i;if(Ja(Sp,r)&&(i=Sp[r],r="%"+i[0]+"%"),Ja(Lr,r)){var s=Lr[r];if(s===ii&&(s=vS(r)),typeof s>"u"&&!e)throw new vi("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new Wi("intrinsic "+t+" does not exist!")},yt=function(t,e){if(typeof t!="string"||t.length===0)throw new vi("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new vi('"allowMissing" argument must be a boolean');if(wS(/^%?[^%]*%?$/,t)===null)throw new Wi("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=kS(t),i=r.length>0?r[0]:"",s=xS("%"+i+"%",e),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],bS(r,yS([0,1],u)));for(var h=1,p=!0;h<r.length;h+=1){var v=r[h],g=Qa(v,0,1),_=Qa(v,-1);if((g==='"'||g==="'"||g==="`"||_==='"'||_==="'"||_==="`")&&g!==_)throw new Wi("property names with quotes must have matching quotes");if((v==="constructor"||!p)&&(c=!0),i+="."+v,o="%"+i+"%",Ja(Lr,o))a=Lr[o];else if(a!=null){if(!(v in a)){if(!e)throw new vi("base intrinsic for "+t+" exists, but the property is not available.");return}if(Ms&&h+1>=r.length){var k=Ms(a,v);p=!!k,p&&"get"in k&&!("originalValue"in k.get)?a=k.get:a=a[v]}else p=Ja(a,v),a=a[v];p&&!c&&(Lr[o]=a)}}return a},kc,kp;function Yn(){if(kp)return kc;kp=1;var n=yt,t=Ol,e=t([n("%String.prototype.indexOf%")]);return kc=function(i,s){var o=n(i,!!s);return typeof o=="function"&&e(i,".prototype.")>-1?t([o]):o},kc}var xc,xp;function Oh(){if(xp)return xc;xp=1;var n=yt,t=n("%Array%"),e=!t.isArray&&Yn()("Object.prototype.toString");return xc=t.isArray||function(i){return e(i)==="[object Array]"},xc}var ES=zl,Ep=Oo,xm=ES.hasArrayLengthDefineBug(),AS=xm&&Oh(),$S=Yn(),TS=$S("Object.prototype.propertyIsEnumerable"),Mh=function(t,e,r,i,s,o){if(!Ep){if(!t(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&TS(i,s)!==!!o["[[Enumerable]]"])return!1;var a=o["[[Value]]"];return i[s]=a,e(i[s],a)}return xm&&s==="length"&&"[[Value]]"in o&&AS(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(Ep(i,s,r(o)),!0)},IS=X,us=xn,CS={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},Ki=function(t){if(!t||typeof t!="object")return!1;for(var e in t)if(us(t,e)&&!CS[e])return!1;var r=us(t,"[[Value]]")||us(t,"[[Writable]]"),i=us(t,"[[Get]]")||us(t,"[[Set]]");if(r&&i)throw new IS("Property Descriptors may not be both accessor and data descriptors");return!0},Em=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},RS=X,PS=Ki,DS=Em,Am=function(t){if(typeof t<"u"&&!PS(t))throw new RS("Assertion failed: `Desc` must be a Property Descriptor");return DS(t)},LS=X,Ap=xn,zS=Ki,$m=function(t){if(typeof t>"u")return!1;if(!zS(t))throw new LS("Assertion failed: `Desc` must be a Property Descriptor");return!(!Ap(t,"[[Value]]")&&!Ap(t,"[[Writable]]"))},Ji=function(t){return typeof t=="string"||typeof t=="symbol"},$p=Ph,Tm=function(t,e){return t===e?t===0?1/t===1/e:!0:$p(t)&&$p(e)},Tp=X,OS=kn,MS=Mh,NS=Am,US=$m,FS=Ji,HS=Tm,Nh=function(t,e,r){if(!OS(t))throw new Tp("Assertion failed: Type(O) is not Object");if(!FS(e))throw new Tp("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return MS(US,HS,NS,t,e,i)},Im=Function.prototype.toString,fi=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,mu,Ta;if(typeof fi=="function"&&typeof Object.defineProperty=="function")try{mu=Object.defineProperty({},"length",{get:function(){throw Ta}}),Ta={},fi(function(){throw 42},null,mu)}catch(n){n!==Ta&&(fi=null)}else fi=null;var ZS=/^\s*class\b/,vu=function(t){try{var e=Im.call(t);return ZS.test(e)}catch{return!1}},Ec=function(t){try{return vu(t)?!1:(Im.call(t),!0)}catch{return!1}},Ia=Object.prototype.toString,WS="[object Object]",VS="[object Function]",BS="[object GeneratorFunction]",jS="[object HTMLAllCollection]",GS="[object HTML document.all class]",qS="[object HTMLCollection]",YS=typeof Symbol=="function"&&!!Symbol.toStringTag,XS=!(0 in[,]),yu=function(){return!1};if(typeof document=="object"){var KS=document.all;Ia.call(KS)===Ia.call(document.all)&&(yu=function(t){if((XS||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=Ia.call(t);return(e===jS||e===GS||e===qS||e===WS)&&t("")==null}catch{}return!1})}var Cm=fi?function(t){if(yu(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{fi(t,null,mu)}catch(e){if(e!==Ta)return!1}return!vu(t)&&Ec(t)}:function(t){if(yu(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(YS)return Ec(t);if(vu(t))return!1;var e=Ia.call(t);return e!==VS&&e!==BS&&!/^\[object HTML/.test(e)?!1:Ec(t)},JS=Cm,QS=function(t){return!!t},Pt=xn,sa=X,e_=kn,Ip=JS,Ac=QS,t_=function(t){if(!e_(t))throw new sa("ToPropertyDescriptor requires an object");var e={};if(Pt(t,"enumerable")&&(e["[[Enumerable]]"]=Ac(t.enumerable)),Pt(t,"configurable")&&(e["[[Configurable]]"]=Ac(t.configurable)),Pt(t,"value")&&(e["[[Value]]"]=t.value),Pt(t,"writable")&&(e["[[Writable]]"]=Ac(t.writable)),Pt(t,"get")){var r=t.get;if(typeof r<"u"&&!Ip(r))throw new sa("getter must be a function");e["[[Get]]"]=r}if(Pt(t,"set")){var i=t.set;if(typeof i<"u"&&!Ip(i))throw new sa("setter must be a function");e["[[Set]]"]=i}if((Pt(e,"[[Get]]")||Pt(e,"[[Set]]"))&&(Pt(e,"[[Value]]")||Pt(e,"[[Writable]]")))throw new sa("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},$c=X,n_=kn,Cp=Ki,r_=Mh,i_=Am,s_=$m,o_=Ji,a_=Tm,l_=t_,c_=function(t,e,r){if(!n_(t))throw new $c("Assertion failed: Type(O) is not Object");if(!o_(e))throw new $c("Assertion failed: P is not a Property Key");var i=Cp(r)?r:l_(r);if(!Cp(i))throw new $c("Assertion failed: Desc is not a valid Property Descriptor");return r_(s_,a_,i_,t,e,i)},Rp=X,u_=kn,h_=c_,d_=Ji,p_=function(t,e,r){if(!u_(t))throw new Rp("Assertion failed: Type(O) is not Object");if(!d_(e))throw new Rp("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return h_(t,e,i)},f_=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,g_=Ch,m_=g_.setPrototypeOf||null,v_=Ol,Pp=Yi,y_=X,Rm={};try{Rm.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var b_=!("toString"in Rm),Tc=Pp&&Pp(Object.prototype,"__proto__"),w_=b_&&(!!Tc&&typeof Tc.set=="function"&&v_([Tc.set])||function(t,e){if(t==null)throw new y_("set Object.prototype.__proto__ called on null or undefined");return t.__proto__=e,e}),Dp=f_,S_=m_,Lp=w_,__=X,k_=Dp?function(t,e){if(Dp(t,e))return t;throw new __("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:S_||(Lp?function(t,e){return Lp(t,e),t}:null),zp=X,x_=kn,Op=Sm(),E_=function(t){if(!x_(t))throw new zp("Assertion failed: O must be an Object");if(!Op)throw new zp("This environment does not support fetching prototypes.");return Op(t)},A_=X,$_=k_,T_=kn,I_=E_,C_=function(t,e){if(e!==null&&!T_(e))throw new A_("Assertion failed: V must be Object or Null");try{$_(t,e)}catch{return!1}return I_(t)===e},Ic=Nh,Mp=p_,Pm=C_,R_=zl(),Uh=vm;function Fo(n,t,e){var r=new Uh(e);return Pm(r,Ca),delete r.constructor,Mp(r,"error",n),Mp(r,"suppressed",t),r}R_&&Object.defineProperty(Fo,"prototype",{writable:!1});var Ca=Fo.prototype;if(!Ic(Ca,"constructor",Fo)||!Ic(Ca,"message","")||!Ic(Ca,"name","SuppressedError"))throw new Uh("unable to install SuppressedError.prototype properties; please report this!");Pm(Fo.prototype,Uh.prototype);var P_=Fo,D_=P_,Dm=function(){return typeof SuppressedError=="function"?SuppressedError:D_},L_=Zr,Np=Ih(),z_=Dm,O_=function(){var t=z_();return L_(Np,{SuppressedError:t},{SuppressedError:function(){return Np.SuppressedError!==t}}),t};O_();var M_=X,N_=Ki,U_=Em,F_=function(t){if(typeof t<"u"&&!N_(t))throw new M_("Assertion failed: `Desc` must be a Property Descriptor");return U_(t)},H_=X,Up=xn,Z_=Ki,W_=function(t){if(typeof t>"u")return!1;if(!Z_(t))throw new H_("Assertion failed: `Desc` must be a Property Descriptor");return!(!Up(t,"[[Value]]")&&!Up(t,"[[Writable]]"))},Fp=Ph,V_=function(t,e){return t===e?t===0?1/t===1/e:!0:Fp(t)&&Fp(e)},Qi=Cm,B_=function(t){return!!t},Dt=xn,oa=X,j_=kn,Hp=Qi,Cc=B_,G_=function(t){if(!j_(t))throw new oa("ToPropertyDescriptor requires an object");var e={};if(Dt(t,"enumerable")&&(e["[[Enumerable]]"]=Cc(t.enumerable)),Dt(t,"configurable")&&(e["[[Configurable]]"]=Cc(t.configurable)),Dt(t,"value")&&(e["[[Value]]"]=t.value),Dt(t,"writable")&&(e["[[Writable]]"]=Cc(t.writable)),Dt(t,"get")){var r=t.get;if(typeof r<"u"&&!Hp(r))throw new oa("getter must be a function");e["[[Get]]"]=r}if(Dt(t,"set")){var i=t.set;if(typeof i<"u"&&!Hp(i))throw new oa("setter must be a function");e["[[Set]]"]=i}if((Dt(e,"[[Get]]")||Dt(e,"[[Set]]"))&&(Dt(e,"[[Value]]")||Dt(e,"[[Writable]]")))throw new oa("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},Rc=X,q_=kn,Zp=Ki,Y_=Mh,X_=F_,K_=W_,J_=Ji,Q_=V_,ek=G_,Ho=function(t,e,r){if(!q_(t))throw new Rc("Assertion failed: Type(O) is not Object");if(!J_(e))throw new Rc("Assertion failed: P is not a Property Key");var i=Zp(r)?r:ek(r);if(!Zp(i))throw new Rc("Assertion failed: Desc is not a valid Property Descriptor");return Y_(K_,Q_,X_,t,e,i)},tk=Xi(),nk=tk?Symbol.dispose||Symbol("Symbol.dispose"):null,rk=Xi,ik=nk,Fh=function(){return rk()&&Symbol.dispose||ik},sk=Dh,ok=Ho,ak=Fh,lk=function(){var t=ak();return sk()&&ok(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},ck=Xi(),uk=ck?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,hk=Xi,dk=uk,Hh=function(){return hk()&&Symbol.asyncDispose||dk},pk=Dh,fk=Ho,gk=Hh,mk=function(){var t=gk();return pk()&&fk(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},vk=Oh(),yk=yt,bk=Yn(),wk=X,Sk=vk,_k=yk("%Reflect.apply%",!0)||bk("Function.prototype.apply"),Ml=function(t,e){var r=arguments.length>2?arguments[2]:[];if(!Sk(r))throw new wk("Assertion failed: optional `argumentsList`, if provided, must be a List");return _k(t,e,r)};const kk={},xk=Object.freeze(Object.defineProperty({__proto__:null,default:kk},Symbol.toStringTag,{value:"Module"})),Ek=Kw(xk);var Zh=typeof Map=="function"&&Map.prototype,Pc=Object.getOwnPropertyDescriptor&&Zh?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,el=Zh&&Pc&&typeof Pc.get=="function"?Pc.get:null,Wp=Zh&&Map.prototype.forEach,Wh=typeof Set=="function"&&Set.prototype,Dc=Object.getOwnPropertyDescriptor&&Wh?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,tl=Wh&&Dc&&typeof Dc.get=="function"?Dc.get:null,Vp=Wh&&Set.prototype.forEach,Ak=typeof WeakMap=="function"&&WeakMap.prototype,Rs=Ak?WeakMap.prototype.has:null,$k=typeof WeakSet=="function"&&WeakSet.prototype,Ps=$k?WeakSet.prototype.has:null,Tk=typeof WeakRef=="function"&&WeakRef.prototype,Bp=Tk?WeakRef.prototype.deref:null,Ik=Boolean.prototype.valueOf,Ck=Object.prototype.toString,Rk=Function.prototype.toString,Pk=String.prototype.match,Vh=String.prototype.slice,Hn=String.prototype.replace,Dk=String.prototype.toUpperCase,jp=String.prototype.toLowerCase,Lm=RegExp.prototype.test,Gp=Array.prototype.concat,Qt=Array.prototype.join,Lk=Array.prototype.slice,qp=Math.floor,bu=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Lc=Object.getOwnPropertySymbols,wu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Vi=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ds=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Vi||!0)?Symbol.toStringTag:null,zm=Object.prototype.propertyIsEnumerable,Yp=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function Xp(n,t){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||Lm.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-qp(-n):qp(n);if(r!==n){var i=String(r),s=Vh.call(t,i.length+1);return Hn.call(i,e,"$&_")+"."+Hn.call(Hn.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Hn.call(t,e,"$&_")}var Su=Ek,Kp=Su.custom,Jp=Nm(Kp)?Kp:null,Om={__proto__:null,double:'"',single:"'"},zk={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},es=function n(t,e,r,i){var s=e||{};if(dn(s,"quoteStyle")&&!dn(Om,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(dn(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=dn(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(dn(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(dn(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return Fm(t,s);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var c=String(t);return a?Xp(t,c):c}if(typeof t=="bigint"){var u=String(t)+"n";return a?Xp(t,u):u}var h=typeof s.depth>"u"?5:s.depth;if(typeof r>"u"&&(r=0),r>=h&&h>0&&typeof t=="object")return _u(t)?"[Array]":"[Object]";var p=Qk(s,r);if(typeof i>"u")i=[];else if(Um(i,t)>=0)return"[Circular]";function v(It,En,rc){if(En&&(i=Lk.call(i),i.push(En)),rc){var Xo={depth:s.depth};return dn(s,"quoteStyle")&&(Xo.quoteStyle=s.quoteStyle),n(It,Xo,r+1,i)}return n(It,s,r+1,i)}if(typeof t=="function"&&!Qp(t)){var g=Vk(t),_=aa(t,v);return"[Function"+(g?": "+g:" (anonymous)")+"]"+(_.length>0?" { "+Qt.call(_,", ")+" }":"")}if(Nm(t)){var k=Vi?Hn.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):wu.call(t);return typeof t=="object"&&!Vi?hs(k):k}if(Xk(t)){for(var I="<"+jp.call(String(t.nodeName)),P=t.attributes||[],R=0;R<P.length;R++)I+=" "+P[R].name+"="+Mm(Ok(P[R].value),"double",s);return I+=">",t.childNodes&&t.childNodes.length&&(I+="..."),I+="</"+jp.call(String(t.nodeName))+">",I}if(_u(t)){if(t.length===0)return"[]";var Z=aa(t,v);return p&&!Jk(Z)?"["+ku(Z,p)+"]":"[ "+Qt.call(Z,", ")+" ]"}if(Nk(t)){var N=aa(t,v);return!("cause"in Error.prototype)&&"cause"in t&&!zm.call(t,"cause")?"{ ["+String(t)+"] "+Qt.call(Gp.call("[cause]: "+v(t.cause),N),", ")+" }":N.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Qt.call(N,", ")+" }"}if(typeof t=="object"&&o){if(Jp&&typeof t[Jp]=="function"&&Su)return Su(t,{depth:h-r});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(Bk(t)){var F=[];return Wp&&Wp.call(t,function(It,En){F.push(v(En,t,!0)+" => "+v(It,t))}),ef("Map",el.call(t),F,p)}if(qk(t)){var Y=[];return Vp&&Vp.call(t,function(It){Y.push(v(It,t))}),ef("Set",tl.call(t),Y,p)}if(jk(t))return zc("WeakMap");if(Yk(t))return zc("WeakSet");if(Gk(t))return zc("WeakRef");if(Fk(t))return hs(v(Number(t)));if(Zk(t))return hs(v(bu.call(t)));if(Hk(t))return hs(Ik.call(t));if(Uk(t))return hs(v(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof cr<"u"&&t===cr)return"{ [object globalThis] }";if(!Mk(t)&&!Qp(t)){var j=aa(t,v),oe=Yp?Yp(t)===Object.prototype:t instanceof Object||t.constructor===Object,wt=t instanceof Object?"":"null prototype",Qn=!oe&&Ds&&Object(t)===t&&Ds in t?Vh.call(Xn(t),8,-1):wt?"Object":"",Re=oe||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",er=Re+(Qn||wt?"["+Qt.call(Gp.call([],Qn||[],wt||[]),": ")+"] ":"");return j.length===0?er+"{}":p?er+"{"+ku(j,p)+"}":er+"{ "+Qt.call(j,", ")+" }"}return String(t)};function Mm(n,t,e){var r=e.quoteStyle||t,i=Om[r];return i+n+i}function Ok(n){return Hn.call(String(n),/"/g,"&quot;")}function Wr(n){return!Ds||!(typeof n=="object"&&(Ds in n||typeof n[Ds]<"u"))}function _u(n){return Xn(n)==="[object Array]"&&Wr(n)}function Mk(n){return Xn(n)==="[object Date]"&&Wr(n)}function Qp(n){return Xn(n)==="[object RegExp]"&&Wr(n)}function Nk(n){return Xn(n)==="[object Error]"&&Wr(n)}function Uk(n){return Xn(n)==="[object String]"&&Wr(n)}function Fk(n){return Xn(n)==="[object Number]"&&Wr(n)}function Hk(n){return Xn(n)==="[object Boolean]"&&Wr(n)}function Nm(n){if(Vi)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!wu)return!1;try{return wu.call(n),!0}catch{}return!1}function Zk(n){if(!n||typeof n!="object"||!bu)return!1;try{return bu.call(n),!0}catch{}return!1}var Wk=Object.prototype.hasOwnProperty||function(n){return n in this};function dn(n,t){return Wk.call(n,t)}function Xn(n){return Ck.call(n)}function Vk(n){if(n.name)return n.name;var t=Pk.call(Rk.call(n),/^function\s*([\w$]+)/);return t?t[1]:null}function Um(n,t){if(n.indexOf)return n.indexOf(t);for(var e=0,r=n.length;e<r;e++)if(n[e]===t)return e;return-1}function Bk(n){if(!el||!n||typeof n!="object")return!1;try{el.call(n);try{tl.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function jk(n){if(!Rs||!n||typeof n!="object")return!1;try{Rs.call(n,Rs);try{Ps.call(n,Ps)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function Gk(n){if(!Bp||!n||typeof n!="object")return!1;try{return Bp.call(n),!0}catch{}return!1}function qk(n){if(!tl||!n||typeof n!="object")return!1;try{tl.call(n);try{el.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function Yk(n){if(!Ps||!n||typeof n!="object")return!1;try{Ps.call(n,Ps);try{Rs.call(n,Rs)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function Xk(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function Fm(n,t){if(n.length>t.maxStringLength){var e=n.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return Fm(Vh.call(n,0,t.maxStringLength),t)+r}var i=zk[t.quoteStyle||"single"];i.lastIndex=0;var s=Hn.call(Hn.call(n,i,"\\$1"),/[\x00-\x1f]/g,Kk);return Mm(s,"single",t)}function Kk(n){var t=n.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Dk.call(t.toString(16))}function hs(n){return"Object("+n+")"}function zc(n){return n+" { ? }"}function ef(n,t,e,r){var i=r?ku(e,r):Qt.call(e,", ");return n+" ("+t+") {"+i+"}"}function Jk(n){for(var t=0;t<n.length;t++)if(Um(n[t],`
2
+ `)>=0)return!1;return!0}function Qk(n,t){var e;if(n.indent===" ")e=" ";else if(typeof n.indent=="number"&&n.indent>0)e=Qt.call(Array(n.indent+1)," ");else return null;return{base:e,prev:Qt.call(Array(t+1),e)}}function ku(n,t){if(n.length===0)return"";var e=`
3
+ `+t.prev+t.base;return e+Qt.call(n,","+e)+`
4
+ `+t.prev}function aa(n,t){var e=_u(n),r=[];if(e){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=dn(n,i)?t(n[i],n):""}var s=typeof Lc=="function"?Lc(n):[],o;if(Vi){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var c in n)dn(n,c)&&(e&&String(Number(c))===c&&c<n.length||Vi&&o["$"+c]instanceof Symbol||(Lm.call(/[^\w$]/,c)?r.push(t(c,n)+": "+t(n[c],n)):r.push(c+": "+t(n[c],n))));if(typeof Lc=="function")for(var u=0;u<s.length;u++)zm.call(n,s[u])&&r.push("["+t(s[u])+"]: "+t(n[s[u]],n));return r}var ex=es,tx=X,Nl=function(n,t,e){for(var r=n,i;(i=r.next)!=null;r=i)if(i.key===t)return r.next=i.next,e||(i.next=n.next,n.next=i),i},nx=function(n,t){if(n){var e=Nl(n,t);return e&&e.value}},rx=function(n,t,e){var r=Nl(n,t);r?r.value=e:n.next={key:t,next:n.next,value:e}},ix=function(n,t){return n?!!Nl(n,t):!1},sx=function(n,t){if(n)return Nl(n,t,!0)},ox=function(){var t,e={assert:function(r){if(!e.has(r))throw new tx("Side channel does not contain "+ex(r))},delete:function(r){var i=t&&t.next,s=sx(t,r);return s&&i&&i===s&&(t=void 0),!!s},get:function(r){return nx(t,r)},has:function(r){return ix(t,r)},set:function(r,i){t||(t={next:void 0}),rx(t,r,i)}};return e},ax=yt,Zo=Yn(),lx=es,cx=X,tf=ax("%Map%",!0),ux=Zo("Map.prototype.get",!0),hx=Zo("Map.prototype.set",!0),dx=Zo("Map.prototype.has",!0),px=Zo("Map.prototype.delete",!0),fx=Zo("Map.prototype.size",!0),Hm=!!tf&&function(){var t,e={assert:function(r){if(!e.has(r))throw new cx("Side channel does not contain "+lx(r))},delete:function(r){if(t){var i=px(t,r);return fx(t)===0&&(t=void 0),i}return!1},get:function(r){if(t)return ux(t,r)},has:function(r){return t?dx(t,r):!1},set:function(r,i){t||(t=new tf),hx(t,r,i)}};return e},gx=yt,Ul=Yn(),mx=es,la=Hm,vx=X,ei=gx("%WeakMap%",!0),yx=Ul("WeakMap.prototype.get",!0),bx=Ul("WeakMap.prototype.set",!0),wx=Ul("WeakMap.prototype.has",!0),Sx=Ul("WeakMap.prototype.delete",!0),_x=ei?function(){var t,e,r={assert:function(i){if(!r.has(i))throw new vx("Side channel does not contain "+mx(i))},delete:function(i){if(ei&&i&&(typeof i=="object"||typeof i=="function")){if(t)return Sx(t,i)}else if(la&&e)return e.delete(i);return!1},get:function(i){return ei&&i&&(typeof i=="object"||typeof i=="function")&&t?yx(t,i):e&&e.get(i)},has:function(i){return ei&&i&&(typeof i=="object"||typeof i=="function")&&t?wx(t,i):!!e&&e.has(i)},set:function(i,s){ei&&i&&(typeof i=="object"||typeof i=="function")?(t||(t=new ei),bx(t,i,s)):la&&(e||(e=la()),e.set(i,s))}};return r}:la,kx=X,xx=es,Ex=ox,Ax=Hm,$x=_x,Tx=$x||Ax||Ex,Ix=function(){var t,e={assert:function(r){if(!e.has(r))throw new kx("Side channel does not contain "+xx(r))},delete:function(r){return!!t&&t.delete(r)},get:function(r){return t&&t.get(r)},has:function(r){return!!t&&t.has(r)},set:function(r,i){t||(t=Tx()),t.set(r,i)}};return e},Cx=xn,ds=Ix(),an=X,Bh={assert:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new an("`O` is not an object");if(typeof t!="string")throw new an("`slot` must be a string");if(ds.assert(n),!Bh.has(n,t))throw new an("`"+t+"` is not present on `O`")},get:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new an("`O` is not an object");if(typeof t!="string")throw new an("`slot` must be a string");var e=ds.get(n);return e&&e["$"+t]},has:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new an("`O` is not an object");if(typeof t!="string")throw new an("`slot` must be a string");var e=ds.get(n);return!!e&&Cx(e,"$"+t)},set:function(n,t,e){if(!n||typeof n!="object"&&typeof n!="function")throw new an("`O` is not an object");if(typeof t!="string")throw new an("`slot` must be a string");var r=ds.get(n);r||(r={},ds.set(n,r)),r["$"+t]=e}};Object.freeze&&Object.freeze(Bh);var jh=Bh,Zm=_n,Wn=jh,Wo=function n(t,e){if(!(this instanceof n))return new n(t,e);if(t!=="normal"&&t!=="break"&&t!=="continue"&&t!=="return"&&t!=="throw")throw new Zm('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');Wn.set(this,"[[Type]]",t),Wn.set(this,"[[Value]]",e)};Wo.prototype.type=function(){return Wn.get(this,"[[Type]]")};Wo.prototype.value=function(){return Wn.get(this,"[[Value]]")};Wo.prototype["?"]=function(){var t=Wn.get(this,"[[Type]]"),e=Wn.get(this,"[[Value]]");if(t==="throw")throw e;return e};Wo.prototype["!"]=function(){var t=Wn.get(this,"[[Type]]");if(t!=="normal")throw new Zm('Assertion failed: Completion Record is not of type "normal"');return Wn.get(this,"[[Value]]")};var Gh=Wo,Rx=Gh,qh=function(t){return new Rx("normal",t)},Oc,nf;function Px(){if(nf)return Oc;nf=1;var n=Xi;return Oc=function(){return n()&&!!Symbol.toStringTag},Oc}var Dx=yt,rf=Dx("%Object.defineProperty%",!0),Lx=Px()(),zx=xn,Ox=X,ca=Lx?Symbol.toStringTag:null,Wm=function(t,e){var r=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof r<"u"&&typeof r!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new Ox("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");ca&&(r||!zx(t,ca))&&(rf?rf(t,ca,{configurable:!i,enumerable:!1,value:e,writable:!1}):t[ca]=e)},Vm={exports:{}},Mx=yt,sf=cm,Nx=zl(),of=Yi,af=X,Ux=Mx("%Math.floor%"),Fx=function(t,e){if(typeof t!="function")throw new af("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||Ux(e)!==e)throw new af("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in t&&of){var o=of(t,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(Nx?sf(t,"length",e,!0,!0):sf(t,"length",e)),t},Hx=Mo,Zx=zh,Wx=wm,Vx=function(){return Wx(Hx,Zx,arguments)};(function(n){var t=Fx,e=Oo,r=Ol,i=Vx;n.exports=function(o){var a=r(arguments),c=1+o.length-(arguments.length-1);return t(a,c>0?c:0,!0)},e?e(n.exports,"apply",{value:i}):n.exports.apply=i})(Vm);var Yh=Vm.exports,Bx=function(t,e){for(var r=0;r<t.length;r+=1)if(!e(t[r],r,t))return!1;return!0},jx=Object,Gx=function(t){return t&&typeof t=="object"&&(typeof t["[[ResourceValue]]"]>"u"||jx(t["[[ResourceValue]]"])===t["[[ResourceValue]]"])&&(t["[[Hint]]"]==="SYNC-DISPOSE"||t["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof t["[[DisposeMethod]]"]=="function"||typeof t["[[DisposeMethod]]"]>"u")},qx=xn,Yx=Oh(),Xx=Bx,Kx=Gx,Jx=function(t){return t&&typeof t=="object"&&qx(t,"[[DisposableResourceStack]]")&&Yx(t["[[DisposableResourceStack]]"])&&(t["[[DisposableResourceStack]]"].length===0||Xx(t["[[DisposableResourceStack]]"],Kx))},Qx=kn,eE=function(t){if(t===null)return"Null";if(typeof t>"u")return"Undefined";if(Qx(t))return"Object";if(typeof t=="number")return"Number";if(typeof t=="boolean")return"Boolean";if(typeof t=="string")return"String"},tE=eE,Xh=function(t){return typeof t=="symbol"?"Symbol":typeof t=="bigint"?"BigInt":tE(t)},nE=X,rE=es,iE=Ji,sE=function(t,e){if(!iE(e))throw new nE("Assertion failed: P is not a Property Key, got "+rE(e));return t[e]},lf=X,oE=sE,aE=Qi,lE=Ji,cf=es,cE=function(t,e){if(!lE(e))throw new lf("Assertion failed: P is not a Property Key");var r=oE(t,e);if(r!=null){if(!aE(r))throw new lf(cf(e)+" is not a function: "+cf(r));return r}},xu={exports:{}},uE=yt,hE=uE,uf=hE("%Reflect.construct%",!0),nl=Ho;try{nl({},"",{"[[Get]]":function(){}})}catch{nl=null}if(nl&&uf){var hf={},df={};nl(df,"length",{"[[Get]]":function(){throw hf},"[[Enumerable]]":!0}),xu.exports=function(t){try{uf(t,df)}catch(e){return e===hf}}}else xu.exports=function(t){return typeof t=="function"&&!!t.prototype};var dE=xu.exports,Mc=X,pf=Qi,pE=dE,fE=function(t){if(!pE(t))throw new Mc("C must be a constructor");var e={"[[Resolve]]":void 0,"[[Reject]]":void 0},r=new t(function(i,s){if(typeof e["[[Resolve]]"]<"u"||typeof e["[[Reject]]"]<"u")throw new Mc("executor has already been called");e["[[Resolve]]"]=i,e["[[Reject]]"]=s});if(!pf(e["[[Resolve]]"])||!pf(e["[[Reject]]"]))throw new Mc("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":e["[[Resolve]]"],"[[Reject]]":e["[[Reject]]"]}},ff=_n,gE=X,Nc=Ml,gf=cE,mE=fE,vE=Xh,mf=Fh(),vf=Hh(),yE=function(t,e){if(vE(t)!=="Object")throw new gE("`V` must be an Object");if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new ff("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(e==="ASYNC-DISPOSE"&&vf&&(r=gf(t,vf)),!r){if(!mf)throw new ff("`Symbol.dispose` is not supported");if(r=gf(t,mf),typeof r<"u")return function(){var i=this;if(e==="ASYNC-DISPOSE"){var s=mE(Promise);try{Nc(r,i),Nc(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}Nc(r,i)}}return r},bE=_n,Uc=X,wE=Qi,SE=Xh,_E=yE,kE=function(t,e){if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new bE("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(arguments.length<3)if(t==null)t=void 0,r=void 0;else{if(typeof t<"u"&&SE(t)!=="Object")throw new Uc("`V` must be an Object, or `null` or `undefined`");if(r=_E(t,e),typeof r>"u")throw new Uc("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!wE(r))throw new Uc("`method`, when provided, must be a function");return{"[[ResourceValue]]":t,"[[Hint]]":e,"[[DisposeMethod]]":r}},xE=_n,ua=X,EE=Jx,yf=kE,AE=Yn(),$E=AE("Array.prototype.push"),Bm=function(t,e,r){if(!EE(t))throw new ua("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new xE("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var i=arguments.length>3?arguments[3]:void 0;if(arguments.length>3&&typeof i!="function")throw new ua("Assertion failed: `method`, when present, must be a function");if(!t["[[DisposableResourceStack]]"])throw new ua("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(e==null&&r==="SYNC_DISPOSE")return"UNUSED";s=yf(e,r)}else{if(typeof e<"u")throw new ua("Assertion failed: `V` must be undefined when `method` is present");s=yf(void 0,r,i)}return $E(t["[[DisposableResourceStack]]"],s),"UNUSED"},Fc,bf;function Kh(){if(bf)return Fc;bf=1;var n=yt,t=Yh,e=_n,r=n("%Promise.resolve%",!0),i=r&&t(r);return Fc=function(o,a){if(!i)throw new e("This environment does not support Promises.");return i(o,a)},Fc}var Hc,wf;function TE(){if(wf)return Hc;wf=1;var n=yt,t=_n,e=n("%Promise%",!0),r=Ml,i=Kh(),s=Xh;return Hc=function(a,c,u){if(typeof a<"u"&&s(a)!=="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 h=typeof u>"u"?u:r(u,a);if(c==="ASYNC-DISPOSE")return i(e,h)},Hc}var Zc,Sf;function IE(){if(Sf)return Zc;Sf=1;var n=Gh;return Zc=function(e){return new n("throw",e)},Zc}var CE=yt,Wc=_n,_f=X,RE=CE("%Promise%",!0),PE=Yn(),kf=PE("Promise.prototype.then",!0),DE=Gh,xf=TE(),LE=qh,zE=Kh(),Ef=IE(),OE=Dm(),jm=function(t,e){if(!(e instanceof DE))throw new _f("`completion` must be a Completion Record");var r=t["[[DisposableResourceStack]]"];if(!r)throw new _f("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");for(var i,s=r.length-1;s>=0;s-=1)if(!i)i=r[s]["[[Hint]]"];else if(i!==r[s]["[[Hint]]"])throw new Wc("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&zE(RE,e),a=function(v){if(e.type()==="throw"){var g=e.value(),_=new OE(v,g);e=Ef(_)}else e=Ef(v)},c=i==="ASYNC-DISPOSE"&&function(g){return kf(o,function(){var _=xf(g["[[ResourceValue]]"],g["[[Hint]]"],g["[[DisposeMethod]]"]);if(!_)throw new Wc("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return kf(_,LE)},a)},u=r.length-1;u>=0;u-=1)if(i==="ASYNC-DISPOSE")o=c(r[u]);else{var h=r[u];try{var p=xf(h["[[ResourceValue]]"],h["[[Hint]]"],h["[[DisposeMethod]]"]);if(p)throw new Wc("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(v){a(v)}}return t["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:e},Gm=function(){var t=[];return{"[[DisposableResourceStack]]":t}},Fl=Rh,Jh=X,ME=Ml,ts=Nh,NE=Ho,qm=Qi,UE=qh,tt=jh,FE=Wm,Ym=Zr.supportsDescriptors,HE=Yh,Qh=Bm,ZE=jm,Xm=Gm,Af=Fh(),pt=function n(){if(!(this instanceof n)||tt.has(this,"[[DisposableState]]")||tt.has(this,"[[DisposeCapability]]"))throw new Jh("can only be used with new");tt.set(this,"[[DisposableState]]","PENDING"),tt.set(this,"[[DisposeCapability]]",Xm())},Km=function(){var t=this;return tt.assert(t,"[[DisposableState]]"),tt.get(t,"[[DisposableState]]")==="DISPOSED"},Vo=HE(Km);Ym?NE(pt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Km}):pt.prototype.disposed=!1;var Jm=function(t){tt.set(t,"[[DisposableState]]","DISPOSED"),Ym||(t.disposed=!0)};ts(pt.prototype,"dispose",function(){var t=this;if(!Vo(t))return Jm(t),ZE(tt.get(t,"[[DisposeCapability]]"),UE())["?"]()});ts(pt.prototype,"use",function(t){var e=this;if(Vo(e))throw new Fl("a disposed stack can not use anything new");return Qh(tt.get(e,"[[DisposeCapability]]"),t,"SYNC-DISPOSE"),t});ts(pt.prototype,"adopt",function(t,e){var r=this;if(Vo(r))throw new Fl("a disposed stack can not use anything new");if(!qm(e))throw new Jh("`onDispose` must be a function");var i=function(){return ME(e,void 0,[t])};return Qh(tt.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),t});ts(pt.prototype,"defer",function(t){var e=this;if(Vo(e))throw new Fl("a disposed stack can not defer anything new");if(!qm(t))throw new Jh("`onDispose` must be a function");Qh(tt.get(e,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",t)});ts(pt.prototype,"move",function(){var t=this;if(Vo(t))throw new Fl("a disposed stack can not use anything new");var e=new pt;return tt.set(e,"[[DisposeCapability]]",tt.get(t,"[[DisposeCapability]]")),tt.set(t,"[[DisposeCapability]]",Xm()),Jm(t),e});Af&&ts(pt.prototype,Af,pt.prototype.dispose);FE(pt.prototype,"DisposableStack");var WE=pt,VE=WE,BE=function(){return typeof DisposableStack=="function"?DisposableStack:VE},jE=Zr,GE=Ih(),qE=BE,YE=function(){var t=qE();return jE(GE,{DisposableStack:t},{DisposableStack:!0}),t},XE=yt,Hl=Rh,ed=X,$f=XE("%Promise%",!0),td=Bm,KE=Ml,ns=Nh,JE=Ho,QE=jm,Qm=Qi,ev=Gm,eA=qh,Tf=Kh(),nt=jh,tA=Wm,tv=Zr.supportsDescriptors,nA=Yh,rA=Yn(),iA=rA("Promise.prototype.then",!0),If=Hh(),ft=function n(){if(!(this instanceof n)||nt.has(this,"[[AsyncDisposableState]]")||nt.has(this,"[[DisposeCapability]]"))throw new ed("can only be used with new");nt.set(this,"[[AsyncDisposableState]]","pending"),nt.set(this,"[[DisposeCapability]]",ev())},nv=function(){var t=this;return nt.assert(t,"[[AsyncDisposableState]]"),nt.get(t,"[[AsyncDisposableState]]")==="disposed"},Bo=nA(nv);tv?JE(ft.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":nv}):ft.prototype.disposed=!1;var rv=function(t){nt.set(t,"[[AsyncDisposableState]]","disposed"),tv||(t.disposed=!0)};ns(ft.prototype,"disposeAsync",function(){var t=this;return Bo(t)?Tf($f):(rv(t),iA(Tf($f,QE(nt.get(t,"[[DisposeCapability]]"),eA())),function(e){return e["?"]()}))});ns(ft.prototype,"use",function(t){var e=this;if(Bo(e))throw new Hl("a disposed stack can not use anything new");return td(nt.get(e,"[[DisposeCapability]]"),t,"ASYNC-DISPOSE"),t});ns(ft.prototype,"adopt",function(t,e){var r=this;if(Bo(r))throw new Hl("a disposed stack can not use anything new");if(!Qm(e))throw new ed("`onDisposeAsync` must be a function");var i=function(){return KE(e,void 0,[t])};return i.value=t,td(nt.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),t});ns(ft.prototype,"defer",function(t){var e=this;if(Bo(e))throw new Hl("a disposed stack can not defer anything new");if(!Qm(t))throw new ed("`onDispose` must be a function");td(nt.get(e,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",t)});ns(ft.prototype,"move",function(){var t=this;if(Bo(t))throw new Hl("a disposed stack can not use anything new");var e=new ft;return nt.set(e,"[[DisposeCapability]]",nt.get(t,"[[DisposeCapability]]")),nt.set(t,"[[DisposeCapability]]",ev()),rv(t),e});If&&ns(ft.prototype,If,ft.prototype.disposeAsync);tA(ft.prototype,"AsyncDisposableStack");var sA=ft,oA=sA,aA=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:oA},lA=Zr,cA=Ih(),uA=aA,hA=function(){var t=uA();return lA(cA,{AsyncDisposableStack:t},{AsyncDisposableStack:!0}),t},dA=lk,pA=mk,fA=YE,gA=hA,mA=function(){dA(),pA(),fA(),gA()};mA();const Cf=new WeakMap;function vA(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function ti(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function Rf(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function yA(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class bA{constructor(){m(this,"entries",new Map);m(this,"constructionStack",[])}register(t,e){if(e===void 0){if(typeof t!="function")throw Rf();this.validateClassRegistration(t),this.storeFactory(t,()=>this.instantiateClass(t));return}if(typeof e!="function")throw Rf();if(e.constructor.name==="AsyncFunction")throw yA();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=Cf.get(t);if(e){if(t.length!==e.length)throw new Error(`${ti(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(`${ti(t)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(t){const e=Cf.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(`${ti(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=>ti(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(t.key);try{const r=t.factory();if(vA(r))throw new Error(`Factory for ${ti(t.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${ti(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 en=new bA,wA=.5,Pf=.1,Df=8,SA=4,iv=3,sv=3,_A=4,pr=255,ov=.2126,av=.7152,lv=.0722;async function cv(n){const t=kA(n);if(!t)return"light";try{return await AA(n,t)>=wA?"light":"dark"}catch{return"light"}}function kA(n){if(typeof document.elementsFromPoint!="function")return null;const t=n.getBoundingClientRect(),e=t.left+t.width/2,r=t.top+t.height/2,i=document.elementsFromPoint(e,r);for(const s of i){if(!(s instanceof HTMLElement)||s===n||n.contains(s))continue;const o=window.getComputedStyle(s);if(xA(o))return s}return null}function xA(n){return n.backgroundImage&&n.backgroundImage!=="none"?!0:EA(n.backgroundColor)>0}function EA(n){if(!n)return 0;const t=n.match(/rgba?\(([^)]+)\)/);if(!t)return 0;const e=t[1].split(/[\s,/]+/).filter(Boolean);return e.length===_A?parseFloat(e[iv]):e.length===sv?1:0}async function AA(n,t){const e=n.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:ha((e.left-r.left)/r.width),y:ha((e.top-r.top)/r.height),width:ha(e.width/r.width),height:ha(e.height/r.height)},s=window.getComputedStyle(t),o=$A(s.backgroundImage);return o?IA({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):CA(s.backgroundColor)}function $A(n){const t=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return t?t[1]:null}const Lf=new Map;function TA(n){let t=Lf.get(n);return t||(t=new Promise((e,r)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=()=>e(i),i.onerror=()=>r(new Error(`Failed to load ${n}`)),i.src=n}),Lf.set(n,t),t)}async function IA(n){const t=await TA(n.url),e=Math.max(Df,Math.ceil(n.surfaceWidth*Pf)),r=Math.max(Df,Math.ceil(n.surfaceHeight*Pf)),i=document.createElement("canvas");i.width=e,i.height=r;const s=i.getContext("2d",{willReadFrequently:!0});if(!s)return 1;const o=n.surfaceWidth/n.surfaceHeight,a=t.naturalWidth/t.naturalHeight;let c,u;a>o?(u=r,c=r*a):(c=e,u=e/a);const h=(e-c)/2,p=(r-u)/2;s.drawImage(t,h,p,c,u);const v=Math.max(0,Math.floor(n.region.x*e)),g=Math.max(0,Math.floor(n.region.y*r)),_=Math.max(1,Math.min(e-v,Math.floor(n.region.width*e))),k=Math.max(1,Math.min(r-g,Math.floor(n.region.height*r))),I=s.getImageData(v,g,_,k).data;let P=0,R=0;for(let Z=0;Z<I.length;Z+=SA){const N=I[Z]/pr,F=I[Z+1]/pr,Y=I[Z+2]/pr,j=I[Z+iv]/pr;P+=j*(ov*N+av*F+lv*Y),R+=1}return R>0?P/R:1}function CA(n){const t=n.match(/rgba?\(([^)]+)\)/);if(!t)return 1;const e=t[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(e.length<sv)return 1;const r=e[0]/pr,i=e[1]/pr,s=e[2]/pr;return ov*r+av*i+lv*s}function ha(n){return n<0?0:n>1?1:n}const RA=["ghost","glass"],Ns=[...RA.flatMap(n=>[`button[variant="${n}"]`,`segmented-control[variant="${n}"]`]),'[material="glass"]'].join(", "),da=new WeakSet,zf=new WeakSet;function uv(n){if(zf.has(n))return;zf.add(n);for(const e of n.querySelectorAll(Ns))Vc(e);if(typeof MutationObserver!="function")return;new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const i of r.addedNodes)PA(i,Vc);else r.type==="attributes"&&r.target instanceof HTMLElement&&r.target.matches(Ns)&&Vc(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant","material"]})}function PA(n,t){if(n instanceof Element){n instanceof HTMLElement&&n.matches(Ns)&&t(n);for(const e of n.querySelectorAll(Ns))t(e)}}async function Vc(n){if(da.has(n)||n.hasAttribute("tone"))return;da.add(n);const t=await cv(n);if(!n.matches(Ns)){da.delete(n);return}if(n.hasAttribute("tone")){da.delete(n);return}n.setAttribute("tone",t)}const DA="*,*:before,*:after{box-sizing:border-box}html,body{margin:0;padding:0;width:100%;height:100%}h1,h2,h3,h4,h5,h6,p,ul,ol,blockquote,pre,hr{margin:0}button,input,textarea,select{font:inherit;color:inherit}@font-face{font-family:Hind;src:url("+new URL("Hind-Variable-C47b_dt9.woff2",import.meta.url).href+') format("woff2-variations");font-weight:300 700;font-style:normal;font-display:swap}:root{--font-sans: "Hind", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;--font-brand: var(--font-sans);--font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;--font-weight-body: 500;--text-base: 13.5px;--text-scale: 1.125;--text-sm: round(calc(var(--text-base) / var(--text-scale)), 1px);--text-lg: round(calc(var(--text-base) * var(--text-scale)), 1px);--text-xl: round(calc(var(--text-lg) * var(--text-scale)), 1px);--leading-base: 1.5;--control-height-xs: 18px;--control-height-sm: 24px;--control-height-md: 28px;--control-height-lg: 32px;--space-2: 2px;--space-4: 4px;--space-6: 6px;--space-8: 8px;--space-12: 12px;--space-16: 16px;--space-20: 20px;--space-24: 24px;--space-32: 32px;--space-48: 48px;--space-64: 64px;--radius-4: 4px;--radius-8: 8px;--radius-12: 12px;--radius-16: 16px;--radius-24: 24px;--radius-full: 9999px;--layer-chrome: 100;--layer-panel: 500;--layer-overlay: 2000;--shadow-hairline: 0 0 0 .5px var(--color-border);--shadow-control: 0 1px 1px rgb(0 0 0 / .04), 0 2px 6px rgb(0 0 0 / .06);--alpha-50: 4%;--alpha-100: 8%;--alpha-150: 11%;--alpha-200: 15%;--alpha-300: 22%;--alpha-400: 30%;--alpha-500: 40%;--alpha-600: 50%;--alpha-700: 65%;--alpha-800: 80%;--alpha-900: 90%;--alpha-950: 95%;--tint-50: color-mix(in srgb, currentColor var(--alpha-50), transparent);--tint-100: color-mix(in srgb, currentColor var(--alpha-100), transparent);--tint-150: color-mix(in srgb, currentColor var(--alpha-150), transparent);--tint-200: color-mix(in srgb, currentColor var(--alpha-200), transparent);--tint-300: color-mix(in srgb, currentColor var(--alpha-300), transparent);--tint-400: color-mix(in srgb, currentColor var(--alpha-400), transparent);--tint-500: color-mix(in srgb, currentColor var(--alpha-500), transparent);--tint-600: color-mix(in srgb, currentColor var(--alpha-600), transparent);--tint-700: color-mix(in srgb, currentColor var(--alpha-700), transparent);--tint-800: color-mix(in srgb, currentColor var(--alpha-800), transparent);--tint-900: color-mix(in srgb, currentColor var(--alpha-900), transparent);--tint-950: color-mix(in srgb, currentColor var(--alpha-950), transparent);--color-overlay-hover: color-mix(in srgb, var(--black) var(--alpha-100), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-300), transparent);--backdrop-blur-glass: blur(20px) saturate(1.4);--black: #000000;--white: #ffffff;--neutral-50: oklch(.985 0 0);--neutral-100: oklch(.97 0 0);--neutral-200: oklch(.923 0 0);--neutral-300: oklch(.869 0 0);--neutral-350: oklch(.79 0 0);--neutral-400: oklch(.709 0 0);--neutral-500: oklch(.553 0 0);--neutral-600: oklch(.444 0 0);--neutral-700: oklch(.374 0 0);--neutral-800: oklch(.268 0 0);--neutral-900: oklch(.216 0 0);--neutral-950: oklch(.147 0 0);--red-50: oklch(.969 .015 12.422);--red-100: oklch(.941 .03 12.58);--red-200: oklch(.892 .058 10.001);--red-300: oklch(.81 .117 11.638);--red-400: oklch(.712 .194 13.428);--red-500: oklch(.645 .246 16.439);--red-600: oklch(.586 .253 17.585);--red-700: oklch(.514 .222 16.935);--red-800: oklch(.455 .188 13.697);--red-900: oklch(.41 .159 10.272);--red-950: oklch(.271 .105 12.094);--orange-50: oklch(.98 .016 73.684);--orange-100: oklch(.954 .038 75.164);--orange-200: oklch(.901 .076 70.697);--orange-300: oklch(.837 .128 66.29);--orange-400: oklch(.75 .183 55.934);--orange-500: oklch(.705 .213 47.604);--orange-600: oklch(.646 .222 41.116);--orange-700: oklch(.553 .195 38.402);--orange-800: oklch(.47 .157 37.304);--orange-900: oklch(.408 .123 38.172);--orange-950: oklch(.266 .079 36.259);--yellow-50: oklch(.987 .026 102.212);--yellow-100: oklch(.973 .071 103.193);--yellow-200: oklch(.945 .129 101.54);--yellow-300: oklch(.905 .182 98.111);--yellow-400: oklch(.852 .199 91.936);--yellow-500: oklch(.795 .184 86.047);--yellow-600: oklch(.681 .162 75.834);--yellow-700: oklch(.554 .135 66.442);--yellow-800: oklch(.476 .114 61.907);--yellow-900: oklch(.421 .095 57.708);--yellow-950: oklch(.286 .066 53.813);--green-50: oklch(.979 .021 166.113);--green-100: oklch(.95 .052 163.051);--green-200: oklch(.905 .093 164.15);--green-300: oklch(.845 .143 164.978);--green-400: oklch(.765 .177 163.223);--green-500: oklch(.696 .17 162.48);--green-600: oklch(.596 .145 163.225);--green-700: oklch(.508 .118 165.612);--green-800: oklch(.432 .095 166.913);--green-900: oklch(.378 .077 168.94);--green-950: oklch(.262 .051 172.552);--blue-50: oklch(.97 .014 254.604);--blue-100: oklch(.932 .032 255.585);--blue-200: oklch(.882 .059 254.128);--blue-300: oklch(.809 .105 251.813);--blue-400: oklch(.707 .165 254.624);--blue-500: oklch(.623 .214 259.815);--blue-600: oklch(.546 .245 262.881);--blue-700: oklch(.488 .243 264.376);--blue-800: oklch(.424 .199 265.638);--blue-900: oklch(.379 .146 265.522);--blue-950: oklch(.282 .091 267.935);--purple-50: oklch(.969 .016 293.756);--purple-100: oklch(.943 .029 294.588);--purple-200: oklch(.894 .057 293.283);--purple-300: oklch(.811 .111 293.571);--purple-400: oklch(.702 .183 293.541);--purple-500: oklch(.606 .25 292.717);--purple-600: oklch(.541 .281 293.009);--purple-700: oklch(.491 .27 292.581);--purple-800: oklch(.432 .232 292.759);--purple-900: oklch(.38 .189 293.745);--purple-950: oklch(.283 .141 291.089)}@supports (corner-shape: squircle){:root{--radius-8: 10px;--radius-12: 15px;--radius-16: 20px;--radius-24: 30px}}:root[data-font=system]{--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif}:root{--color-bg: var(--neutral-50);--color-bg-muted: var(--neutral-100);--color-surface: var(--white);--color-surface-muted: var(--neutral-100);--color-interactive: var(--neutral-200);--color-interactive-hover: var(--neutral-300);--color-border: rgba(0, 0, 0, .1);--color-border-muted: rgba(0, 0, 0, .06);--color-text: var(--neutral-900);--color-text-muted: var(--neutral-500);--color-link: inherit;--color-focus-ring: var(--neutral-500);--color-overlay-backdrop: rgb(0 0 0 / .5);--color-highlight: rgb(255 255 255 / .5);--color-primary: var(--blue-500);--color-danger: var(--red-600);color-scheme:light}body{font-family:var(--font-sans);font-size:var(--text-base);font-weight:var(--font-weight-body);line-height:var(--leading-base);letter-spacing:.015em;color:var(--color-text);background:var(--color-bg);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{color:var(--color-link);text-underline-offset:.15em;text-decoration-thickness:.08em}h1,h2,h3,h4,h5,h6{font-weight:600;color:inherit}code{font-family:var(--font-mono);font-size:.9em;background:var(--color-bg-muted);padding:var(--space-2) var(--space-4);border-radius:var(--radius-4)}pre{font-family:var(--font-mono);background:var(--color-bg-muted);padding:var(--space-12);border-radius:var(--radius-8);overflow-x:auto}pre code{background:none;padding:0}blockquote{padding-left:var(--space-16);border-left:3px solid var(--color-border);color:var(--color-text-muted)}hr{border:none;border-top:1px solid var(--color-border)}table{border-collapse:collapse}th,td{padding:var(--space-8) var(--space-12);border:1px solid var(--color-border);text-align:left}th{background:var(--color-bg-muted);font-weight:600}input,textarea{border:.5px solid var(--tint-300);border-radius:var(--radius-12);background:var(--tint-100);color:inherit;font:inherit;box-sizing:border-box;transition:background .12s ease,border-color .12s ease,box-shadow .12s ease}input{height:var(--control-height-lg);padding:0 12px}textarea{padding:6px 10px;resize:none}input::placeholder,textarea::placeholder{color:var(--tint-500)}input:focus,textarea:focus{background:color-mix(in srgb,var(--white) var(--alpha-300),transparent);border-color:var(--color-primary);outline:none;box-shadow:0 0 0 1.5px var(--color-primary)}label.field{display:grid;gap:4px;font-size:13px}label.field>span{font-size:11.5px;font-weight:450;color:var(--tint-800)}@supports (corner-shape: squircle){*{corner-shape:squircle}}button{display:inline-flex;align-items:center;justify-content:center;gap:var(--space-6);box-sizing:border-box;height:var(--control-height-md);padding:0 14px 2px;font:inherit;cursor:default}button,segmented-control{background:var(--color-surface);border:.5px solid var(--tint-200);border-radius:var(--radius-12);box-shadow:var(--shadow-control);color:inherit}button:not([material]):hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}button:not([material]):active:not(:disabled){background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}button:focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}button[variant=primary]{background:var(--color-primary);border-color:#0000002e;color:var(--white)}button[variant=primary]:hover:not(:disabled){background:color-mix(in srgb,var(--color-primary) 92%,black)}button[variant=primary]:active:not(:disabled){background:color-mix(in srgb,var(--color-primary) 82%,black);box-shadow:inset 0 1px 2px #0000002e}button[variant=danger]{background:var(--color-danger);border-color:#0000002e;color:var(--white)}button[variant=danger]:hover:not(:disabled){background:color-mix(in srgb,var(--color-danger) 92%,black)}button[variant=danger]:active:not(:disabled){background:color-mix(in srgb,var(--color-danger) 82%,black);box-shadow:inset 0 1px 2px #0000002e}button[variant=ghost]{background:transparent;border-color:transparent;color:inherit;box-shadow:none}button[variant=ghost]:hover:not(:disabled){background:var(--tint-150);backdrop-filter:saturate(1.2);-webkit-backdrop-filter:saturate(1.2)}button[variant=ghost]:active:not(:disabled){background:var(--tint-300);backdrop-filter:saturate(1.4);-webkit-backdrop-filter:saturate(1.4);box-shadow:none}button[variant=ghost][data-active]:not(:disabled),button[variant=ghost][data-active]:hover:not(:disabled),button[variant=ghost][aria-pressed=true]:not(:disabled),button[variant=ghost][aria-pressed=true]:hover:not(:disabled),button[variant=ghost][aria-expanded=true]:not(:disabled),button[variant=ghost][aria-expanded=true]:hover:not(:disabled){background:var(--color-overlay-active);backdrop-filter:saturate(1.3);-webkit-backdrop-filter:saturate(1.3);box-shadow:none}button[variant=glass],segmented-control[variant=glass]{background:transparent;border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);box-shadow:none}button[variant=glass]{backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5)}button[variant=glass]:hover:not(:disabled){background:linear-gradient(var(--color-overlay-hover),var(--color-overlay-hover));backdrop-filter:blur(20px) brightness(.95) saturate(1.8);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.8)}button[variant=glass]:active:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active));backdrop-filter:blur(20px) brightness(.95) saturate(2.2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2.2)}button[variant=glass][aria-pressed=true]:not(:disabled),button[variant=glass][aria-pressed=true]:hover:not(:disabled),button[variant=glass][aria-expanded=true]:not(:disabled),button[variant=glass][aria-expanded=true]:hover:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active));backdrop-filter:blur(20px) brightness(.95) saturate(2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2)}[tone=dark] button[variant=glass],[tone=dark] segmented-control[variant=glass]{border-color:var(--tint-400)}button[material],segmented-control[material]{color:inherit;box-shadow:none}button[material]:hover:not(:disabled){background-image:linear-gradient(var(--color-overlay-hover),var(--color-overlay-hover))}button[material]:active:not(:disabled){background-image:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}[tone=dark] button[material],[tone=dark] segmented-control[material]{border-color:var(--tint-400)}button:disabled{background:var(--tint-300);border-color:transparent;color:var(--tint-700);box-shadow:none}button[variant=ghost]:disabled{background:transparent}:where([tone=dark]) button:not([variant]):not([material]):not(:disabled),:where([tone=dark]) button[variant=default]:not([material]):not(:disabled),:where([tone=dark]) segmented-control:not([variant]):not([material]),:where([tone=dark]) segmented-control[variant=default]:not([material]){background:var(--tint-200);border-color:var(--tint-300);box-shadow:inset 0 .5px 0 var(--tint-300)}:where([tone=dark]) button:not([variant]):hover:not(:disabled),:where([tone=dark]) button[variant=default]:hover:not(:disabled){background:var(--tint-300)}:where([tone=dark]) button:not([variant]):active:not(:disabled),:where([tone=dark]) button[variant=default]:active:not(:disabled){background:var(--tint-400);box-shadow:inset 0 1px 2px #0003}:where([tone=light]) button:not([variant]):not([material]):not(:disabled),:where([tone=light]) button[variant=default]:not([material]):not(:disabled),:where([tone=light]) segmented-control:not([variant]):not([material]),:where([tone=light]) segmented-control[variant=default]:not([material]){background:var(--color-surface);border-color:var(--tint-200);box-shadow:var(--shadow-control)}:where([tone=light]) button:not([variant]):hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}:where([tone=light]) button:not([variant]):active:not(:disabled){background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}button[size=sm],segmented-control[size=sm]{height:var(--control-height-sm)}button[size=sm][icon-only]{width:var(--control-height-sm)}button[size=xs]{height:var(--control-height-xs);padding:0 var(--space-6) 1px;border-radius:var(--radius-8)}button[size=xs][icon-only]{width:var(--control-height-xs);padding:0}button[icon-only]{width:var(--control-height-md);padding:0}[data-ui-icon]{display:inline-block;vertical-align:middle}[selectable],[selectable] *{user-select:text;-webkit-user-select:text}[unselectable],[unselectable] *{user-select:none;-webkit-user-select:none}.prose{line-height:var(--leading-base)}.prose h1{font-size:var(--text-xl);margin-bottom:var(--space-8)}.prose h2{font-size:var(--text-lg);margin-top:var(--space-24);margin-bottom:var(--space-8)}.prose h3,.prose h4,.prose h5,.prose h6{font-size:var(--text-base);margin-top:var(--space-24);margin-bottom:var(--space-8)}.prose p{margin:var(--space-12) 0}.prose ul,.prose ol{padding-left:var(--space-24);margin:var(--space-12) 0}.prose blockquote,.prose pre{margin:var(--space-12) 0}.prose hr{margin:var(--space-24) 0}.prose table{width:100%;margin:var(--space-12) 0}.prose img{max-width:100%;height:auto}.prose>:first-child{margin-top:0}.prose>:last-child{margin-bottom:0}[material=paper]{background:var(--white);border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);color:var(--color-text)}[material=glass]{background:transparent;border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5)}[material=glass-frosted]{background:color-mix(in srgb,var(--white) var(--alpha-800),transparent);border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);color:var(--color-text);backdrop-filter:var(--backdrop-blur-glass);-webkit-backdrop-filter:var(--backdrop-blur-glass)}[tone=dark]{color:color-mix(in srgb,var(--white) var(--alpha-950),transparent);border-color:color-mix(in srgb,var(--white) var(--alpha-200),transparent);--color-overlay-hover: color-mix(in srgb, var(--white) var(--alpha-100), transparent);--color-overlay-active: color-mix(in srgb, var(--white) var(--alpha-200), transparent)}[tone=dark][material=paper]{background:#000}[tone=dark][material=glass-frosted]{background:color-mix(in srgb,var(--black) 70%,transparent)}[tone=light]{color:var(--color-text);border-color:color-mix(in srgb,var(--black) var(--alpha-100),transparent);--color-overlay-hover: color-mix(in srgb, var(--black) var(--alpha-50), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-100), transparent)}[level="1"]{box-shadow:0 12px 32px #00000024}[level="2"]{box-shadow:0 4px 6px -2px #0000001f,0 40px 60px -16px #00000038}dropdown-menu{position:relative;display:inline-block;color:inherit}dropdown-group{display:grid;gap:var(--space-4)}dropdown-label{display:block;padding:var(--space-4) var(--space-8);color:var(--color-text-muted);font:inherit;font-size:var(--text-sm);font-weight:600;letter-spacing:.04em;text-transform:uppercase}dropdown-divider{display:block;height:1px;margin:2px 0;background:var(--color-border)}[data-dropdown-trigger][aria-expanded=true],[data-dropdown-trigger][aria-expanded=true]:hover,dropdown-menu[open]::part(trigger),dropdown-menu[open]::part(trigger):hover{background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}[data-dropdown-trigger-label],dropdown-menu::part(trigger-label){min-width:0}[data-dropdown-trigger-icon],dropdown-menu::part(trigger-icon){display:inline-flex;align-items:center;justify-content:center;flex:none;color:var(--color-text-muted);transform:translateY(1px)}dropdown-item:focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}ui-popover.dropdown-popover::part(panel){min-width:192px;padding:var(--space-4)}.dropdown-list{display:flex;flex-direction:column;gap:2px}dropdown-item{display:flex;align-items:center;gap:var(--space-8);margin:0;padding:6px 12px;border-radius:var(--radius-8);font:inherit;line-height:1.2;color:inherit;font-weight:var(--font-weight-body);-webkit-user-select:none;user-select:none}dropdown-item>[data-ui-icon]{flex:none}dropdown-item[selected]{background:var(--color-overlay-active)}dropdown-item:hover,dropdown-item[action]:hover{background:var(--color-primary);color:var(--white)}dropdown-item[action]{color:inherit}dropdown-item[danger]{color:var(--color-danger)}dropdown-item[danger]:hover{background:var(--color-danger);color:var(--white)}editable-text{display:inline-block;max-width:100%;vertical-align:top}editable-text>.editable-text-span{display:inline-block;max-width:100%;outline:none;overflow:hidden;white-space:nowrap;cursor:inherit;vertical-align:top}editable-text:not([data-editing])>.editable-text-span{text-overflow:ellipsis}editable-text[data-editing]>.editable-text-span{cursor:text}modal-overlay{color:inherit}modal-overlay::part(backdrop){position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--layer-overlay);display:flex;align-items:center;justify-content:center;padding:var(--space-16);background:linear-gradient(to bottom,color-mix(in srgb,var(--black) var(--alpha-50),transparent),color-mix(in srgb,var(--black) var(--alpha-400),transparent));backdrop-filter:blur(1px);-webkit-backdrop-filter:blur(1px)}panel-view{display:block}panel-view::part(panel){display:flex;flex-direction:column;gap:var(--space-16);color:var(--color-text)}panel-view::part(header){display:flex;align-items:center;justify-content:space-between;gap:var(--space-12)}panel-view::part(title){margin:0;font:inherit;font-size:var(--text-lg);font-weight:600;color:var(--color-text)}panel-view::part(button){display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;margin:0;border:1px solid var(--color-border);border-radius:var(--radius-4);background:var(--color-surface);color:var(--color-text);box-shadow:none}panel-view::part(button):hover{background:var(--color-interactive-hover)}panel-view::part(button):focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}panel-view::part(icon){display:inline-flex;align-items:center;justify-content:center;flex:none}ui-popover{display:contents}ui-popover::part(panel){position:fixed;inset:0 auto auto 0;margin:0;min-width:192px;max-width:384px;padding:var(--space-16) var(--space-20);border-radius:var(--radius-12);outline:none;z-index:2000}segmented-control{display:inline-flex;align-items:stretch;box-sizing:border-box;height:var(--control-height-md)}segmented-control>button{height:auto}segmented-control[variant=ghost]{background:transparent;box-shadow:none}[tone=dark] segmented-control[variant=ghost]{border-color:var(--tint-400)}segmented-control>button{position:relative}segmented-control>button[icon-only]{width:auto;height:auto;padding:0 var(--space-6)}segmented-control>button:not([variant]):not(:disabled),[tone] segmented-control>button:not([variant]):not(:disabled){background:transparent;border:0;box-shadow:none}segmented-control>button:first-child{border-top-right-radius:0;border-bottom-right-radius:0}segmented-control>button:last-child{border-top-left-radius:0;border-bottom-left-radius:0}segmented-control>button:not(:first-child):not(:last-child){border-radius:0}segmented-control>button:not([variant]):hover:not(:disabled),[tone] segmented-control>button:not([variant]):hover:not(:disabled){background:var(--color-overlay-hover)}segmented-control>button:not([variant]):active:not(:disabled),[tone] segmented-control>button:not([variant]):active:not(:disabled){background:var(--color-overlay-active);box-shadow:none}segmented-control>button:not([variant])[aria-pressed=true]:not(:disabled),segmented-control>button:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),segmented-control>button:not([variant])[aria-expanded=true]:not(:disabled),[tone] segmented-control>button:not([variant])[aria-pressed=true]:not(:disabled),[tone] segmented-control>button:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),[tone] segmented-control>button:not([variant])[aria-expanded=true]:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}segmented-control>button:not(:last-child):after{content:"";position:absolute;top:0;bottom:0;right:0;width:.5px;background:var(--tint-200);pointer-events:none}[tone=dark] segmented-control>button:not(:last-child):after{background:var(--tint-400)}segmented-control>dropdown-menu{display:inline-flex;align-items:stretch;height:auto}segmented-control>dropdown-menu>[slot=trigger]{height:auto;position:relative}segmented-control>dropdown-menu>[slot=trigger]:not([variant]):not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant]):not(:disabled){background:transparent;border:0;box-shadow:none}segmented-control>dropdown-menu:first-child>[slot=trigger]{border-top-right-radius:0;border-bottom-right-radius:0}segmented-control>dropdown-menu:last-child>[slot=trigger]{border-top-left-radius:0;border-bottom-left-radius:0}segmented-control>dropdown-menu:not(:first-child):not(:last-child)>[slot=trigger]{border-radius:0}segmented-control>dropdown-menu>[slot=trigger]:not([variant]):hover:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant]):hover:not(:disabled){background:var(--color-overlay-hover)}segmented-control>dropdown-menu>[slot=trigger]:not([variant]):active:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant]):active:not(:disabled){background:var(--color-overlay-active);box-shadow:none}segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-pressed=true]:not(:disabled),segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-expanded=true]:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-pressed=true]:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-expanded=true]:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}segmented-control[variant=glass]>button,segmented-control[variant=glass]>dropdown-menu{backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5)}segmented-control[variant=glass]>button:not(:disabled):hover,segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled):hover){backdrop-filter:blur(20px) brightness(.95) saturate(1.8);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.8)}segmented-control[variant=glass]>button:not(:disabled):active,segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled):active){backdrop-filter:blur(20px) brightness(.95) saturate(2.2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2.2)}segmented-control[variant=glass]>button:not(:disabled)[aria-pressed=true],segmented-control[variant=glass]>button:not(:disabled)[aria-current]:not([aria-current=false]),segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled)[aria-pressed=true]),segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled)[aria-current]:not([aria-current=false])){backdrop-filter:blur(20px) brightness(.95) saturate(1.8);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.8)}segmented-control[variant=glass]>button:not(:disabled)[aria-expanded=true],segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled)[aria-expanded=true]){backdrop-filter:blur(20px) brightness(.95) saturate(2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2)}segmented-control>dropdown-menu:not(:last-child):after{content:"";position:absolute;top:0;bottom:0;right:0;width:.5px;background:var(--tint-200);pointer-events:none}[tone=dark] segmented-control>dropdown-menu:not(:last-child):after{background:var(--tint-400)}ui-spinner{display:inline-flex;align-items:center;justify-content:center;line-height:0;color:inherit}ui-spinner .spin,.spin{display:inline-flex;animation:ui-spinner-spin 1s steps(8,end) infinite}@keyframes ui-spinner-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion: reduce){.spin{animation:none}}system-modal{display:flex;flex-direction:column;width:min(400px,100%);box-sizing:border-box;padding:var(--space-32) var(--space-24);border-radius:var(--radius-12)}system-modal header{display:flex;flex-direction:column;align-items:center;gap:var(--space-16);text-align:center}system-modal header>hgroup{display:flex;flex-direction:column;align-items:center;gap:var(--space-4);max-width:100%}system-modal header h2{margin:0;font-size:var(--text-lg);font-weight:600;letter-spacing:.01em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}system-modal header p{margin:0;font-size:var(--text-base);opacity:.7;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}ui-pill{display:inline-block;vertical-align:baseline;margin:2px 0;padding:0 var(--space-8);font-size:var(--text-sm);font-weight:500;line-height:1.7;border-radius:var(--radius-full);border:1px solid var(--neutral-300);background:var(--neutral-200);color:var(--neutral-900);white-space:nowrap}ui-pill[color=gray]{border-color:var(--neutral-300);background:var(--neutral-200);color:var(--neutral-900)}ui-pill[color=red]{border-color:var(--red-200);background:var(--red-100);color:var(--red-950)}ui-pill[color=orange]{border-color:var(--orange-200);background:var(--orange-100);color:var(--orange-950)}ui-pill[color=yellow]{border-color:var(--yellow-200);background:var(--yellow-100);color:var(--yellow-950)}ui-pill[color=green]{border-color:var(--green-200);background:var(--green-100);color:var(--green-950)}ui-pill[color=blue]{border-color:var(--blue-200);background:var(--blue-100);color:var(--blue-950)}ui-pill[color=purple]{border-color:var(--purple-200);background:var(--purple-100);color:var(--purple-950)}',nd=new CSSStyleSheet;nd.replaceSync(DA);const rd=new CSSStyleSheet;try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,nd,rd]}catch{}uv(document);function hv(n){rd.replaceSync(n)}function rl(){hv("")}function id(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,nd,rd]}catch{}uv(n)}const LA=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function zA(n){for(const t of Object.keys(n))if(LA.has(t))throw new Error(`Event payload key "${t}" is reserved; choose a different property name`)}function OA(n,t){zA(t);for(const e of Object.keys(t))Object.defineProperty(n,e,{value:t[e],writable:!0,enumerable:!0,configurable:!0})}function Fe(){class n extends Event{constructor(e,r){const{type:i,bubbles:s,cancelable:o,composed:a,...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:o,composed:a}),OA(this,c)}}return n}class tn extends globalThis.EventTarget{}function MA(n,t,e){const r=n.dispose.bind(n);n.dispose=()=>{if(!t())return e(),r()}}function jo(n){var e;class t extends n{constructor(...s){super(...s);w(this,e,!1);MA(this,()=>l(this,e),()=>{S(this,e,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return l(this,e)}}return e=new WeakMap,t}const NA=Fe(),UA=Fe(),FA=Fe(),Ra=Fe(),HA=Fe(),Bc=Fe(),dv="0123456789ABCDEFGHJKMNPQRSTVWXYZ",il=32,ZA=16,pv=10,Of=0xffffffffffff;var fr;(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"})(fr||(fr={}));class _s extends Error{constructor(t,e){super(`${e} (${t})`),this.name="ULIDError",this.code=t}}function WA(n){const t=Math.floor(n()*il)%il;return dv.charAt(t)}function VA(n){const t=BA(),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 _s(fr.PRNGDetectFailure,"Failed to find a reliable PRNG")}function BA(){return qA()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function jA(n,t){let e="";for(;n>0;n--)e=WA(t)+e;return e}function GA(n,t=pv){if(isNaN(n))throw new _s(fr.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>Of)throw new _s(fr.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Of}: ${n}`);if(n<0)throw new _s(fr.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new _s(fr.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let e,r="";for(let i=t;i>0;i--)e=n%il,r=dv.charAt(e)+r,n=(n-e)/il;return r}function qA(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function Zl(n,t){const e=VA(),r=Date.now();return GA(r,pv)+jA(ZA,e)}const gt=4,lt=6,Us=2,Eu=2,sd=8,YA=lt,od="auto",Vn="auto",Tn=120,Mf=50,le=16,zr=Tn*gt+le*(gt-1),sl=Tn*lt+le*(lt-1),XA=zr+le*2,KA=200,JA=4,pa=150,QA=10,Nf=2,Uf=8,e1=300,t1=4;function fv(n){return vv(n)}function gv(n,t){return vv(n.flatMap(e=>bv(e,t)))}function mv(n){const t=[],e=new Set;for(const r of n){if(r.type==="row"){t.push(`Top-level rows are invalid: ${r.id}`);continue}wv(r,"strip",t,e)}return{valid:t.length===0,errors:t}}function gr(n){const t=fv(n),e=mv(t);if(!e.valid)throw new Error(`Invalid layout: ${e.errors.join("; ")}`);return{totalNodes:t.length,nodes:t.filter(r=>r.type!=="row").map(s1)}}function vv(n){const t=[];for(const e of n){const r=yv(e);for(const i of r){if(i.type==="row"){t.push(...i.children.map(wn));continue}t.push(i)}}return t}function yv(n){switch(n.type){case"card":return[wn(n)];case"row":{const t=n.children.map(wn);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=[];for(const e of n.children){const r=yv(e);for(const i of r){if(i.type==="stack"){t.push(...i.children.map(Au));continue}if(i.type==="row"){t.push({...i,children:i.children.map(wn)});continue}t.push(wn(i))}}return t.length===0?[]:t.length===1?[Au(t[0])]:[{...n,children:t}]}}}function bv(n,t){switch(n.type){case"card":return n.artifactID===t?[]:[wn(n)];case"row":{const e=n.children.filter(r=>r.artifactID!==t).map(wn);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=n.children.flatMap(r=>bv(r,t).filter(s=>s.type!=="stack"));return e.length===0?[]:e.length===1?[Au(e[0])]:[{...n,children:e}]}}}function wv(n,t,e,r){switch(n.type){case"card":Sv(n,t,e,r);return;case"row":n1(n,t,e,r);return;case"stack":r1(n,t,e,r);return}}function Sv(n,t,e,r){ad(n.id,e),typeof n.artifactID!="string"||n.artifactID.length===0?e.push(`Card ${n.id} is missing artifactID`):r.has(n.artifactID)?e.push(`Duplicate artifactID in layout: ${n.artifactID}`):r.add(n.artifactID),i1(n.width)||e.push(`Card ${n.id} width must be an integer in the range ${Us}-${sd}`),_v(n.height)||e.push(`Card ${n.id} height must be an integer in the range 2-6 or "auto"`);const i=ur(n.width);t==="row"&&i<Us&&e.push(`Row child ${n.id} must be at least 2 columns wide`)}function n1(n,t,e,r){if(ad(n.id,e),t!=="stack"&&e.push(`Row ${n.id} may only appear inside a stack`),_v(n.height,t1)||e.push(`Row ${n.id} height must be an integer in the range 2-4 or "auto"`),!Array.isArray(n.children)||n.children.length===0){e.push(`Row ${n.id} must contain card nodes`);return}let i=0;for(const s of n.children){if(s.type!=="card"){e.push(`Row ${n.id} must contain only card nodes`);continue}Sv(s,"row",e,r),i+=ur(s.width)}i!==gt&&e.push(`Row ${n.id} children must sum to 4 columns`)}function r1(n,t,e,r){if(ad(n.id,e),t!=="strip"&&e.push(`Invalid nested stack at ${n.id}; stack children cannot contain another nested stack`),!Array.isArray(n.children)||n.children.length===0){e.push(`Stack ${n.id} must contain at least one child`);return}let i=0,s=0;for(const a of n.children){if(a.type==="stack"){e.push(`Stack ${n.id} cannot contain another nested stack`);continue}if(wv(a,"stack",e,r),a.height===Vn){s+=1;continue}i+=a.height}if(i>lt&&e.push(`Stack ${n.id} exceeds the 6-row budget`),s===0)return;const o=lt-i;if(o<s*Eu||o%s!==0){e.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<Eu&&e.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function ad(n,t){(typeof n!="string"||n.length===0)&&t.push(`Node id must be a non-empty string: ${String(n)}`)}function i1(n){return n===od||Number.isInteger(n)&&n>=Us&&n<=sd}function _v(n,t=YA){return n===Vn||Number.isInteger(n)&&n>=Eu&&n<=t}function ur(n){return n===od?gt:n}function s1(n){if(n.type==="card")return{id:n.id,type:"card",width:ur(n.width),cards:[{id:n.id,artifactID:n.artifactID,col:1,row:1,width:ur(n.width),height:kv(n.height,lt)}]};const t=o1(n.children),e=[];let r=1;for(let i=0;i<n.children.length;i+=1){const s=n.children[i],o=t[i];if(s.type==="card")e.push({id:s.id,artifactID:s.artifactID,col:1,row:r,width:Math.min(gt,ur(s.width)),height:o});else{let a=1;for(const c of s.children)e.push({id:c.id,artifactID:c.artifactID,col:a,row:r,width:ur(c.width),height:o}),a+=ur(c.width)}r+=o}return{id:n.id,type:"stack",width:e.reduce((i,s)=>Math.max(i,s.col+s.width-1),1),cards:e}}function o1(n){let t=0,e=0;for(const i of n)i.height===Vn?e+=1:t+=i.height;const r=e>0?(lt-t)/e:0;return n.map(i=>kv(i.height,r))}function kv(n,t){return n===Vn?t:n}function wn(n){return{...n}}function Au(n){return n.type==="card"?wn(n):{...n,children:n.children.map(wn)}}function xv(n,t={}){return{id:t.id??Zl(),type:"card",artifactID:n,width:t.width??od,height:t.height??Vn}}function Ev(n,t){return n.some(e=>Av(e,t))}function Av(n,t){switch(n.type){case"card":return n.artifactID===t;case"row":return n.children.some(e=>e.artifactID===t);case"stack":return n.children.some(e=>Av(e,t))}}function Ff(n){return n.layout.flatMap($v)}function $v(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(t=>t.artifactID);case"stack":return n.children.flatMap($v)}}const ae=Fe(),$u=Fe(),ni=Fe(),a1=Fe();function l1(n){class t extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return t}const Tv=l1("RequestError"),c1=200,u1=300;class h1{constructor(t,e){m(this,"serverURL");m(this,"token");this.serverURL=t.replace(/\/$/,""),this.token=e.token}async requestJSON(t,e,r){const i=await this.request(t,e,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0),s=await d1(i);if(!i.ok||i.status<c1||i.status>=u1)throw this.createError(typeof s.error=="string"?s.error:i.statusText,i.status);return s}async requestVoid(t,e,r){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 this.createError(await jc(i,i.statusText),i.status)}async requestText(t,e){const r=await this.request(t,e);if(!r.ok)throw this.createError(await jc(r,r.statusText),r.status);return r.text()}async requestRawVoid(t,e,r){const i=await this.request(t,e,r,{"content-type":"text/plain"});if(!i.ok)throw this.createError(await jc(i,i.statusText),i.status)}createError(t,e){const r={serverURL:this.serverURL};return e!==void 0&&(r.status=e),new Tv(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(o){throw this.createError(o instanceof Error?o.message:"Failed to reach server")}}buildHeaders(t){const e={...t??{}};return this.token&&(e.Authorization=`Bearer ${this.token}`),Object.keys(e).length>0?e:void 0}}async function d1(n){try{return await n.json()}catch{const t=await n.text().catch(()=>"");return t?{message:t}:{}}}async function jc(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 p1(n){return n.map(t=>`${t.name} (${t.id})`).join(", ")}var Ot,yl,Iv;class f1{constructor(t){w(this,yl);w(this,Ot);S(this,Ot,t)}list(){return l(this,Ot).requestJSON("GET","/screens")}async get(t={}){const e=await f(this,yl,Iv).call(this,t.screenID);return l(this,Ot).requestJSON("GET",`/screens/${encodeURIComponent(e)}`)}create(t){const e={name:t.name};return t.id!==void 0&&(e.id=t.id),l(this,Ot).requestJSON("POST","/screens",e)}update(t){const{screenID:e,...r}=t;return l(this,Ot).requestJSON("PATCH",`/screens/${encodeURIComponent(e)}`,r)}remove(t){return l(this,Ot).requestJSON("DELETE",`/screens/${encodeURIComponent(t.screenID)}`)}}Ot=new WeakMap,yl=new WeakSet,Iv=async function(t){if(t!==void 0)return t;const{screens:e}=await this.list();if(e.length===1)return e[0].id;throw l(this,Ot).createError(`screenID is required when multiple screens exist. Available screens: ${p1(e)}`)};var Ue;class g1{constructor(t){w(this,Ue);S(this,Ue,t)}create(t){const e={kind:t.kind,title:t.title};switch(t.kind){case"markdown":e.externalFilePath=t.externalFilePath;break;case"url":e.externalURL=t.externalURL;break;case"web-bundle":t.skipPending!==void 0&&(e.skipPending=t.skipPending);break}return t.screenID!==void 0&&(e.screenID=t.screenID),l(this,Ue).requestJSON("POST","/artifacts",e)}list(t={}){const e=new URLSearchParams;t.screenID!==void 0&&e.set("screenID",t.screenID),t.unplaced&&e.set("unplaced","true");const r=e.toString();return l(this,Ue).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(t){return l(this,Ue).requestJSON("GET",`/artifacts/${encodeURIComponent(t.artifactID)}`)}update(t){const e={};return t.title!==void 0&&(e.title=t.title),l(this,Ue).requestJSON("PATCH",`/artifacts/${encodeURIComponent(t.artifactID)}`,e)}edit(t){return l(this,Ue).requestJSON("POST",`/artifacts/${encodeURIComponent(t.artifactID)}/edit`)}commitPending(t){return l(this,Ue).requestJSON("POST",`/artifacts/${encodeURIComponent(t.artifactID)}/commit`)}abandonPending(t){return l(this,Ue).requestVoid("POST",`/artifacts/${encodeURIComponent(t.artifactID)}/abandon`)}attach(t){return l(this,Ue).requestJSON("POST",`/screens/${encodeURIComponent(t.screenID)}/artifacts/${encodeURIComponent(t.artifactID)}`)}detach(t){return l(this,Ue).requestJSON("DELETE",`/screens/${encodeURIComponent(t.screenID)}/artifacts/${encodeURIComponent(t.artifactID)}`)}delete(t){return l(this,Ue).requestJSON("DELETE",`/artifacts/${encodeURIComponent(t.artifactID)}`)}getContent(t){return l(this,Ue).requestText("GET",`/artifacts/${encodeURIComponent(t.artifactID)}/content`)}putContent(t){return l(this,Ue).requestRawVoid("PUT",`/artifacts/${encodeURIComponent(t.artifactID)}/content`,t.content)}}Ue=new WeakMap;var vr;class m1{constructor(t){w(this,vr);S(this,vr,t)}get(){return l(this,vr).requestJSON("GET","/display")}patch(t){const e={};return t.activeScreenID!==void 0&&(e.activeScreenID=t.activeScreenID),t.activeThemeName!==void 0&&(e.activeThemeName=t.activeThemeName),l(this,vr).requestVoid("PATCH","/display",e)}focus(t){const e={artifactID:t.artifactID};return t.screenID!==void 0&&(e.screenID=t.screenID),l(this,vr).requestJSON("POST","/display/focus",e)}}vr=new WeakMap;var Bs;class v1{constructor(t){w(this,Bs);S(this,Bs,t)}async list(){const{views:t}=await l(this,Bs).requestJSON("GET","/views");return t}}Bs=new WeakMap;var pn;class y1{constructor(t,e={}){m(this,"screens");m(this,"artifacts");m(this,"display");m(this,"views");w(this,pn);S(this,pn,new h1(t,e)),this.screens=new f1(l(this,pn)),this.artifacts=new g1(l(this,pn)),this.display=new m1(l(this,pn)),this.views=new v1(l(this,pn))}health(){return l(this,pn).requestJSON("GET","/health")}}pn=new WeakMap;const b1={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},w1="Local",S1="store-";function be(n){return new URL(n).origin}function _1(n){return{servers:[{url:be(n),name:w1}],activeServerURL:null,activeScreenID:null,tabs:{},screens:{}}}function k1(n,t){return[...n.tabs[be(t)]??[]]}function x1(n,t,e){const r=be(t),i=n.tabs[r]??[];return i.includes(e)?n:{...n,tabs:{...n.tabs,[r]:[...i,e]}}}function E1(n,t,e){const r=be(t),i=n.tabs[r]??[],s=i.filter(a=>a!==e);if(s.length===i.length)return n;const o={...n.tabs};return s.length===0?delete o[r]:o[r]=s,{...n,tabs:o}}var yr,br,wr;class A1 extends tn{constructor(e,r,i={}){super();w(this,yr);w(this,br);w(this,wr);S(this,yr,`${S1}${e}`),S(this,br,i.storage??$1());const s=l(this,br).getItem(l(this,yr));s===null?(S(this,wr,r),l(this,br).setItem(l(this,yr),JSON.stringify(r))):S(this,wr,T1(JSON.parse(s),r))}get(){return l(this,wr)}set(e){S(this,wr,e),l(this,br).setItem(l(this,yr),JSON.stringify(e)),this.dispatchEvent(new ae("change"))}}yr=new WeakMap,br=new WeakMap,wr=new WeakMap;function $1(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function T1(n,t){return{servers:Array.isArray(n.servers)?n.servers:t.servers,activeServerURL:typeof n.activeServerURL=="string"||n.activeServerURL===null?n.activeServerURL:t.activeServerURL,activeScreenID:typeof n.activeScreenID=="string"||n.activeScreenID===null?n.activeScreenID:t.activeScreenID,tabs:n.tabs&&typeof n.tabs=="object"?n.tabs:t.tabs,screens:n.screens&&typeof n.screens=="object"?n.screens:t.screens}}const I1=jo(tn);var Sr,Xe,_r,We,Cn,Rn,te,si,Cv,js,Rv,Pv,Dv,Lv,Tu,Iu,Cu,zv;class C1 extends I1{constructor(e){var i;super();w(this,te);m(this,"id");m(this,"server");w(this,Sr);w(this,Xe,new Map);w(this,_r);w(this,We);w(this,Cn);w(this,Rn,null);w(this,js,e=>{if(this.disposed)return;const r=e.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&f(this,te,Rv).call(this,r.screen);break;case"artifact-created":break;case"artifact-attached":r.screenID===this.id&&f(this,te,Pv).call(this,r.cardID,r.artifact);break;case"artifact-updated":f(this,te,Dv).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&f(this,te,Lv).call(this,r.artifactID);break;case"artifact-content-changed":l(this,Xe).has(r.artifactID)&&this.dispatchEvent(new a1("artifact-content-changed",{artifactID:r.artifactID}));break}});this.id=e.screen.id,this.server=e.server,S(this,Sr,e.localStore),S(this,_r,e.screen.name),S(this,We,structuredClone(e.screen.layout));const r=((i=l(this,Sr).get().screens[this.id])==null?void 0:i.scrollPosition)??0;S(this,Cn,Math.max(0,r)),this.server.addEventListener("server-event",l(this,js)),f(this,te,Cv).call(this)}get name(){return l(this,_r)}get layout(){return l(this,We)}get scrollPosition(){return l(this,Cn)}get artifacts(){return l(this,Xe)}setScrollPosition(e){f(this,te,si).call(this);const r=Math.max(0,e);r!==l(this,Cn)&&(S(this,Cn,r),f(this,te,zv).call(this),this.dispatchEvent(new ae("change")))}setLayout(e){f(this,te,si).call(this);const r=fv(e);if(!mv(r).valid)return;const s=f(this,te,Iu).call(this);S(this,We,r),S(this,Rn,{layout:r,snapshot:s}),this.dispatchEvent(new ae("change")),this.server.client.screens.update({screenID:this.id,layout:r.map(o=>structuredClone(o))}).catch(()=>{var o;this.disposed||((o=l(this,Rn))==null?void 0:o.layout)===r&&(S(this,Rn,null),f(this,te,Cu).call(this,s),this.dispatchEvent(new ae("change")))})}rename(e){f(this,te,si).call(this),S(this,_r,e),this.dispatchEvent(new ae("change")),this.server.client.screens.update({screenID:this.id,name:e}).catch(()=>{})}async remove(){f(this,te,si).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(e){if(f(this,te,si).call(this),!l(this,Xe).has(e))return;const r=f(this,te,Iu).call(this);f(this,te,Tu).call(this,e),this.dispatchEvent(new ae("change")),this.server.client.artifacts.detach({artifactID:e,screenID:this.id}).catch(()=>{this.disposed||(f(this,te,Cu).call(this,r),this.dispatchEvent(new ae("change")))})}dispose(){this.server.removeEventListener("server-event",l(this,js))}}Sr=new WeakMap,Xe=new WeakMap,_r=new WeakMap,We=new WeakMap,Cn=new WeakMap,Rn=new WeakMap,te=new WeakSet,si=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},Cv=async function(){try{const e=await this.server.client.screens.get({screenID:this.id});if(this.disposed)return;for(const r of e.artifacts)l(this,Xe).set(r.id,r);this.dispatchEvent(new ae("change"))}catch{}},js=new WeakMap,Rv=function(e){l(this,Rn)&&S(this,Rn,null),S(this,_r,e.name),S(this,We,structuredClone(e.layout)),this.dispatchEvent(new ae("change"))},Pv=function(e,r){Ev(l(this,We),r.id)||S(this,We,[...l(this,We),xv(r.id,{id:e})]),l(this,Xe).set(r.id,r),this.dispatchEvent(new ae("change"))},Dv=function(e){const r=l(this,Xe).get(e.id);r&&(l(this,Xe).set(e.id,{...r,...e}),this.dispatchEvent(new ae("change")))},Lv=function(e){f(this,te,Tu).call(this,e)&&this.dispatchEvent(new ae("change"))},Tu=function(e){const r=l(this,Xe).delete(e),i=Ff({layout:l(this,We)}).length,s=gv(l(this,We),e),o=Ff({layout:s}).length;return S(this,We,s),r||i!==o},Iu=function(){return{layout:structuredClone(l(this,We)),artifacts:new Map([...l(this,Xe).entries()].map(([e,r])=>[e,structuredClone(r)]))}},Cu=function(e){S(this,We,structuredClone(e.layout)),l(this,Xe).clear();for(const[r,i]of e.artifacts)l(this,Xe).set(r,structuredClone(i))},zv=function(){const e=l(this,Sr).get();l(this,Sr).set({...e,screens:{...e.screens,[this.id]:{scrollPosition:l(this,Cn)}}})};const R1=jo(tn);var Le,Ke,Mt,Gs,qs,Ys,Be,Pa,Ru,oi;class P1 extends R1{constructor(e){super();w(this,Be);w(this,Le);w(this,Ke);w(this,Mt,null);w(this,Gs,()=>{this.disposed||f(this,Be,Pa).call(this)});w(this,qs,()=>{this.disposed||f(this,Be,Pa).call(this)});w(this,Ys,e=>{if(this.disposed)return;const r=e.event;if(r.type==="screen-removed"){this.removeTab(e.serverURL,r.screenID);const i=l(this,Le).get();i.activeServerURL===be(e.serverURL)&&i.activeScreenID===r.screenID&&f(this,Be,oi).call(this,e.serverURL,null);return}if(r.type==="screen-changed"){if(r.screenID===null){f(this,Be,oi).call(this,e.serverURL,null);return}const i=l(this,Ke).servers.get(be(e.serverURL));if(!i||!i.screens.has(r.screenID))return;this.addTab(e.serverURL,r.screenID),f(this,Be,oi).call(this,e.serverURL,r.screenID)}});S(this,Le,e.localStore),S(this,Ke,e.serverManager),l(this,Le).addEventListener("change",l(this,Gs)),l(this,Ke).addEventListener("change",l(this,qs)),l(this,Ke).addEventListener("server-event",l(this,Ys)),f(this,Be,Pa).call(this)}get activeScreen(){return l(this,Mt)}getTabs(e){const r=be(e),i=k1(l(this,Le).get(),r),s=l(this,Ke).servers.get(r);return s?i.filter(o=>s.screens.has(o)):i}hasTab(e,r){return this.getTabs(e).includes(r)}addTab(e,r){const i=be(e),s=l(this,Ke).servers.get(i);s&&!s.screens.has(r)||f(this,Be,Ru).call(this,x1(l(this,Le).get(),i,r))}removeTab(e,r){f(this,Be,Ru).call(this,E1(l(this,Le).get(),e,r))}setActive(e,r){const i=be(e),s=l(this,Ke).servers.get(i);!s||!s.screens.has(r)||f(this,Be,oi).call(this,i,r)&&s.client.display.patch({activeScreenID:r}).catch(()=>{})}clearActive(){const e=l(this,Le).get().activeServerURL;if(!e||!f(this,Be,oi).call(this,e,null))return;const r=l(this,Ke).servers.get(e);r==null||r.client.display.patch({activeScreenID:null}).catch(()=>{})}dispose(){var e;l(this,Le).removeEventListener("change",l(this,Gs)),l(this,Ke).removeEventListener("change",l(this,qs)),l(this,Ke).removeEventListener("server-event",l(this,Ys)),(e=l(this,Mt))==null||e.dispose(),S(this,Mt,null)}}Le=new WeakMap,Ke=new WeakMap,Mt=new WeakMap,Gs=new WeakMap,qs=new WeakMap,Ys=new WeakMap,Be=new WeakSet,Pa=function(){var c,u,h;const{activeServerURL:e,activeScreenID:r}=l(this,Le).get(),i=e?l(this,Ke).servers.get(e)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((c=l(this,Mt))==null?void 0:c.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=l(this,Mt))==null?void 0:u.server)===i||((h=l(this,Mt))==null||h.dispose(),S(this,Mt,i&&s?new C1({screen:s,server:i,localStore:l(this,Le)}):null),i&&i.acpClient.setScreenContext(s?{screenID:s.id,screenName:s.name}:null),this.dispatchEvent(new NA("active-screen-changed")))},Ru=function(e){e!==l(this,Le).get()&&(l(this,Le).set(e),this.dispatchEvent(new UA("tabs-changed")))},oi=function(e,r){const i=be(e),s=l(this,Le).get();return s.activeServerURL===i&&s.activeScreenID===r?!1:(l(this,Le).set({...s,activeServerURL:i,activeScreenID:r}),!0)};function A(n,t,e){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(n))return;a._zod.traits.add(n),t(a,c);const u=o.prototype,h=Object.keys(u);for(let p=0;p<h.length;p++){const v=h[p];v in a||(a[v]=u[v].bind(a))}}const i=(e==null?void 0:e.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function o(a){var c;const u=e!=null&&e.Parent?new s:this;r(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const h of u._zod.deferred)h();return u}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var c,u;return e!=null&&e.Parent&&a instanceof e.Parent?!0:(u=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:u.has(n)}}),Object.defineProperty(o,"name",{value:n}),o}class yi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ov extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Mv={};function Bn(n){return Mv}function Nv(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 Pu(n,t){return typeof t=="bigint"?t.toString():t}function ld(n){return{get value(){{const t=n();return Object.defineProperty(this,"value",{value:t}),t}}}}function cd(n){return n==null}function ud(n){const t=n.startsWith("^")?1:0,e=n.endsWith("$")?n.length-1:n.length;return n.slice(t,e)}function D1(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,o=Number.parseInt(n.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return o%a/10**s}const Hf=Symbol("evaluating");function ne(n,t,e){let r;Object.defineProperty(n,t,{get(){if(r!==Hf)return r===void 0&&(r=Hf,r=e()),r},set(i){Object.defineProperty(n,t,{value:i})},configurable:!0})}function Vr(n,t,e){Object.defineProperty(n,t,{value:e,writable:!0,enumerable:!0,configurable:!0})}function Kn(...n){const t={};for(const e of n){const r=Object.getOwnPropertyDescriptors(e);Object.assign(t,r)}return Object.defineProperties({},t)}function Zf(n){return JSON.stringify(n)}function L1(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Uv="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function ol(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const z1=ld(()=>{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 Bi(n){if(ol(n)===!1)return!1;const t=n.constructor;if(t===void 0||typeof t!="function")return!0;const e=t.prototype;return!(ol(e)===!1||Object.prototype.hasOwnProperty.call(e,"isPrototypeOf")===!1)}function Fv(n){return Bi(n)?{...n}:Array.isArray(n)?[...n]:n}const O1=new Set(["string","number","symbol"]);function ji(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jn(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 M(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 M1(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}const N1={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 U1(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=Kn(n._zod.def,{get shape(){const o={};for(const a in t){if(!(a in e.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(o[a]=e.shape[a])}return Vr(this,"shape",o),o},checks:[]});return Jn(n,s)}function F1(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=Kn(n._zod.def,{get shape(){const o={...n._zod.def.shape};for(const a in t){if(!(a in e.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete o[a]}return Vr(this,"shape",o),o},checks:[]});return Jn(n,s)}function H1(n,t){if(!Bi(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 o in t)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=Kn(n._zod.def,{get shape(){const s={...n._zod.def.shape,...t};return Vr(this,"shape",s),s}});return Jn(n,i)}function Z1(n,t){if(!Bi(t))throw new Error("Invalid input to safeExtend: expected a plain object");const e=Kn(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t};return Vr(this,"shape",r),r}});return Jn(n,e)}function W1(n,t){const e=Kn(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t._zod.def.shape};return Vr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Jn(n,e)}function V1(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 o=Kn(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(e)for(const u in e){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);e[u]&&(c[u]=n?new n({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=n?new n({type:"optional",innerType:a[u]}):a[u];return Vr(this,"shape",c),c},checks:[]});return Jn(t,o)}function B1(n,t,e){const r=Kn(t._zod.def,{get shape(){const i=t._zod.def.shape,s={...i};if(e)for(const o in e){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(s[o]=new n({type:"nonoptional",innerType:i[o]}))}else for(const o in i)s[o]=new n({type:"nonoptional",innerType:i[o]});return Vr(this,"shape",s),s}});return Jn(t,r)}function gi(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 mi(n,t){return t.map(e=>{var r;return(r=e).path??(r.path=[]),e.path.unshift(n),e})}function fa(n){return typeof n=="string"?n:n==null?void 0:n.message}function jn(n,t,e){var i,s,o,a,c,u;const r={...n,path:n.path??[]};if(!n.message){const h=fa((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??fa((a=t==null?void 0:t.error)==null?void 0:a.call(t,n))??fa((c=e.customError)==null?void 0:c.call(e,n))??fa((u=e.localeError)==null?void 0:u.call(e,n))??"Invalid input";r.message=h}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function hd(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function Fs(...n){const[t,e,r]=n;return typeof t=="string"?{message:t,code:"custom",input:e,inst:r}:{...t}}const Hv=(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,Pu,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},Zv=A("$ZodError",Hv),Wv=A("$ZodError",Hv,{Parent:Error});function j1(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 G1(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(o=>r({issues:o}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)e._errors.push(t(s));else{let o=e,a=0;for(;a<s.path.length;){const c=s.path[a];a===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(s))):o[c]=o[c]||{_errors:[]},o=o[c],a++}}};return r(n),e}const dd=n=>(t,e,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:e,issues:[]},s);if(o instanceof Promise)throw new yi;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>jn(c,s,Bn())));throw Uv(a,i==null?void 0:i.callee),a}return o.value},pd=n=>async(t,e,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:e,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>jn(c,s,Bn())));throw Uv(a,i==null?void 0:i.callee),a}return o.value},Wl=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 yi;return s.issues.length?{success:!1,error:new(n??Zv)(s.issues.map(o=>jn(o,i,Bn())))}:{success:!0,data:s.value}},q1=Wl(Wv),Vl=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(o=>jn(o,i,Bn())))}:{success:!0,data:s.value}},Y1=Vl(Wv),X1=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return dd(n)(t,e,i)},K1=n=>(t,e,r)=>dd(n)(t,e,r),J1=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return pd(n)(t,e,i)},Q1=n=>async(t,e,r)=>pd(n)(t,e,r),e$=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Wl(n)(t,e,i)},t$=n=>(t,e,r)=>Wl(n)(t,e,r),n$=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Vl(n)(t,e,i)},r$=n=>async(t,e,r)=>Vl(n)(t,e,r),i$=/^[cC][^\s-]{8,}$/,s$=/^[0-9a-z]+$/,o$=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,a$=/^[0-9a-vA-V]{20}$/,l$=/^[A-Za-z0-9]{27}$/,c$=/^[a-zA-Z0-9_-]{21}$/,u$=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,h$=/^([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})$/,Wf=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)$/,d$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,p$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function f$(){return new RegExp(p$,"u")}const g$=/^(?:(?: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])$/,m$=/^(([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}|:))$/,v$=/^((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])$/,y$=/^(([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])$/,b$=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vv=/^[A-Za-z0-9_-]*$/,w$=/^\+[1-9]\d{6,14}$/,Bv="(?:(?:\\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])))",S$=new RegExp(`^${Bv}$`);function jv(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 _$(n){return new RegExp(`^${jv(n)}$`)}function k$(n){const t=jv({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(`^${Bv}T(?:${r})$`)}const x$=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}$`)},E$=/^-?\d+$/,Gv=/^-?\d+(?:\.\d+)?$/,A$=/^(?:true|false)$/i,$$=/^[^A-Z]*$/,T$=/^[^a-z]*$/,rt=A("$ZodCheck",(n,t)=>{var e;n._zod??(n._zod={}),n._zod.def=t,(e=n._zod).onattach??(e.onattach=[])}),qv={number:"number",bigint:"bigint",object:"date"},Yv=A("$ZodCheckLessThan",(n,t)=>{rt.init(n,t);const e=qv[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})}}),Xv=A("$ZodCheckGreaterThan",(n,t)=>{rt.init(n,t);const e=qv[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})}}),I$=A("$ZodCheckMultipleOf",(n,t)=>{rt.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):D1(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})}}),C$=A("$ZodCheckNumberFormat",(n,t)=>{var o;rt.init(n,t),t.format=t.format||"float64";const e=(o=t.format)==null?void 0:o.includes("int"),r=e?"int":"number",[i,s]=N1[t.format];n._zod.onattach.push(a=>{const c=a._zod.bag;c.format=t.format,c.minimum=i,c.maximum=s,e&&(c.pattern=E$)}),n._zod.check=a=>{const c=a.value;if(e){if(!Number.isInteger(c)){a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:n});return}if(!Number.isSafeInteger(c)){c>0?a.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}):a.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&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!t.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:n,continue:!t.abort})}}),R$=A("$ZodCheckMaxLength",(n,t)=>{var e;rt.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!cd(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 o=hd(i);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),P$=A("$ZodCheckMinLength",(n,t)=>{var e;rt.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!cd(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 o=hd(i);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),D$=A("$ZodCheckLengthEquals",(n,t)=>{var e;rt.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!cd(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 o=hd(i),a=s>t.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!t.abort})}}),Bl=A("$ZodCheckStringFormat",(n,t)=>{var e,r;rt.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=()=>{})}),L$=A("$ZodCheckRegex",(n,t)=>{Bl.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})}}),z$=A("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=$$),Bl.init(n,t)}),O$=A("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=T$),Bl.init(n,t)}),M$=A("$ZodCheckIncludes",(n,t)=>{rt.init(n,t);const e=ji(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})}}),N$=A("$ZodCheckStartsWith",(n,t)=>{rt.init(n,t);const e=new RegExp(`^${ji(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})}}),U$=A("$ZodCheckEndsWith",(n,t)=>{rt.init(n,t);const e=new RegExp(`.*${ji(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})}}),F$=A("$ZodCheckOverwrite",(n,t)=>{rt.init(n,t),n._zod.check=e=>{e.value=t.tx(e.value)}});class H${constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
5
5
  `).filter(o=>o),i=Math.min(...r.map(o=>o.length-o.trimStart().length)),s=r.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(const o of s)this.content.push(o)}compile(){const t=Function,e=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new t(...e,i.join(`
6
- `))}}const Z$={major:4,minor:3,patch:6},fe=A("$ZodType",(n,t)=>{var i;var e;n??(n={}),n._zod.def=t,n._zod.bag=n._zod.bag||{},n._zod.version=Z$;const r=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&r.unshift(n);for(const s of r)for(const o of s._zod.onattach)o(n);if(r.length===0)(e=n._zod).deferred??(e.deferred=[]),(i=n._zod.deferred)==null||i.push(()=>{n._zod.run=n._zod.parse});else{const s=(a,c,u)=>{let h=gi(a),p;for(const v of c){if(v._zod.def.when){if(!v._zod.def.when(a))continue}else if(h)continue;const g=a.issues.length,_=v._zod.check(a);if(_ instanceof Promise&&(u==null?void 0:u.async)===!1)throw new yi;if(p||_ instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await _,a.issues.length!==g&&(h||(h=gi(a,g)))});else{if(a.issues.length===g)continue;h||(h=gi(a,g))}}return p?p.then(()=>a):a},o=(a,c,u)=>{if(gi(a))return a.aborted=!0,a;const h=s(c,r,u);if(h instanceof Promise){if(u.async===!1)throw new yi;return h.then(p=>n._zod.parse(p,u))}return n._zod.parse(h,u)};n._zod.run=(a,c)=>{if(c.skipChecks)return n._zod.parse(a,c);if(c.direction==="backward"){const h=n._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return h instanceof Promise?h.then(p=>o(p,a,c)):o(h,a,c)}const u=n._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new yi;return u.then(h=>s(h,r,c))}return s(u,r,c)}}ne(n,"~standard",()=>({validate:s=>{var o;try{const a=q1(n,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return Y1(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}))}),sd=A("$ZodString",(n,t)=>{var e;fe.init(n,t),n._zod.pattern=[...((e=n==null?void 0:n._zod.bag)==null?void 0:e.patterns)??[]].pop()??x$(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}}),he=A("$ZodStringFormat",(n,t)=>{Zl.init(n,t),sd.init(n,t)}),W$=A("$ZodGUID",(n,t)=>{t.pattern??(t.pattern=h$),he.init(n,t)}),V$=A("$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=zf(r))}else t.pattern??(t.pattern=zf());he.init(n,t)}),B$=A("$ZodEmail",(n,t)=>{t.pattern??(t.pattern=d$),he.init(n,t)}),j$=A("$ZodURL",(n,t)=>{he.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})}}}),G$=A("$ZodEmoji",(n,t)=>{t.pattern??(t.pattern=f$()),he.init(n,t)}),q$=A("$ZodNanoID",(n,t)=>{t.pattern??(t.pattern=c$),he.init(n,t)}),Y$=A("$ZodCUID",(n,t)=>{t.pattern??(t.pattern=i$),he.init(n,t)}),X$=A("$ZodCUID2",(n,t)=>{t.pattern??(t.pattern=s$),he.init(n,t)}),K$=A("$ZodULID",(n,t)=>{t.pattern??(t.pattern=o$),he.init(n,t)}),J$=A("$ZodXID",(n,t)=>{t.pattern??(t.pattern=a$),he.init(n,t)}),Q$=A("$ZodKSUID",(n,t)=>{t.pattern??(t.pattern=l$),he.init(n,t)}),eT=A("$ZodISODateTime",(n,t)=>{t.pattern??(t.pattern=k$(t)),he.init(n,t)}),tT=A("$ZodISODate",(n,t)=>{t.pattern??(t.pattern=S$),he.init(n,t)}),nT=A("$ZodISOTime",(n,t)=>{t.pattern??(t.pattern=_$(t)),he.init(n,t)}),rT=A("$ZodISODuration",(n,t)=>{t.pattern??(t.pattern=u$),he.init(n,t)}),iT=A("$ZodIPv4",(n,t)=>{t.pattern??(t.pattern=g$),he.init(n,t),n._zod.bag.format="ipv4"}),sT=A("$ZodIPv6",(n,t)=>{t.pattern??(t.pattern=m$),he.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})}}}),oT=A("$ZodCIDRv4",(n,t)=>{t.pattern??(t.pattern=v$),he.init(n,t)}),aT=A("$ZodCIDRv6",(n,t)=>{t.pattern??(t.pattern=y$),he.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 o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>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 jv(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const lT=A("$ZodBase64",(n,t)=>{t.pattern??(t.pattern=b$),he.init(n,t),n._zod.bag.contentEncoding="base64",n._zod.check=e=>{jv(e.value)||e.issues.push({code:"invalid_format",format:"base64",input:e.value,inst:n,continue:!t.abort})}});function cT(n){if(!Uv.test(n))return!1;const t=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),e=t.padEnd(Math.ceil(t.length/4)*4,"=");return jv(e)}const uT=A("$ZodBase64URL",(n,t)=>{t.pattern??(t.pattern=Uv),he.init(n,t),n._zod.bag.contentEncoding="base64url",n._zod.check=e=>{cT(e.value)||e.issues.push({code:"invalid_format",format:"base64url",input:e.value,inst:n,continue:!t.abort})}}),hT=A("$ZodE164",(n,t)=>{t.pattern??(t.pattern=w$),he.init(n,t)});function dT(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 pT=A("$ZodJWT",(n,t)=>{he.init(n,t),n._zod.check=e=>{dT(e.value,t.alg)||e.issues.push({code:"invalid_format",format:"jwt",input:e.value,inst:n,continue:!t.abort})}}),Gv=A("$ZodNumber",(n,t)=>{fe.init(n,t),n._zod.pattern=n._zod.bag.pattern??Zv,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}}),fT=A("$ZodNumberFormat",(n,t)=>{C$.init(n,t),Gv.init(n,t)}),gT=A("$ZodBoolean",(n,t)=>{fe.init(n,t),n._zod.pattern=A$,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}}),mT=A("$ZodUnknown",(n,t)=>{fe.init(n,t),n._zod.parse=e=>e}),vT=A("$ZodNever",(n,t)=>{fe.init(n,t),n._zod.parse=(e,r)=>(e.issues.push({expected:"never",code:"invalid_type",input:e.value,inst:n}),e)});function Of(n,t,e){n.issues.length&&t.issues.push(...mi(e,n.issues)),t.value[e]=n.value}const yT=A("$ZodArray",(n,t)=>{fe.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 o=0;o<i.length;o++){const a=i[o],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Of(u,e,o))):Of(c,e,o)}return s.length?Promise.all(s).then(()=>e):e}});function il(n,t,e,r,i){if(n.issues.length){if(i&&!(e in r))return;t.issues.push(...mi(e,n.issues))}n.value===void 0?e in r&&(t.value[e]=void 0):t.value[e]=n.value}function qv(n){var r,i,s,o;const t=Object.keys(n.shape);for(const a of t)if(!((o=(s=(i=(r=n.shape)==null?void 0:r[a])==null?void 0:i._zod)==null?void 0:s.traits)!=null&&o.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const e=M1(n.shape);return{...n,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(e)}}function Yv(n,t,e,r,i,s){const o=[],a=i.keySet,c=i.catchall._zod,u=c.def.type,h=c.optout==="optional";for(const p in t){if(a.has(p))continue;if(u==="never"){o.push(p);continue}const v=c.run({value:t[p],issues:[]},r);v instanceof Promise?n.push(v.then(g=>il(g,e,p,t,h))):il(v,e,p,t,h)}return o.length&&e.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:s}),n.length?Promise.all(n).then(()=>e):e}const bT=A("$ZodObject",(n,t)=>{fe.init(n,t);const e=Object.getOwnPropertyDescriptor(t,"shape");if(!(e!=null&&e.get)){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=Qh(()=>qv(t));ne(n._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const h=a[u]._zod;if(h.values){c[u]??(c[u]=new Set);for(const p of h.values)c[u].add(p)}}return c});const i=rl,s=t.catchall;let o;n._zod.parse=(a,c)=>{o??(o=r.value);const u=a.value;if(!i(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:n}),a;a.value={};const h=[],p=o.shape;for(const v of o.keys){const g=p[v],_=g._zod.optout==="optional",k=g._zod.run({value:u[v],issues:[]},c);k instanceof Promise?h.push(k.then(T=>il(T,a,v,u,_))):il(k,a,v,u,_)}return s?Yv(h,u,a,c,r.value,n):h.length?Promise.all(h).then(()=>a):a}}),wT=A("$ZodObjectJIT",(n,t)=>{bT.init(n,t);const e=n._zod.parse,r=Qh(()=>qv(t)),i=v=>{var Z;const g=new H$(["shape","payload","ctx"]),_=r.value,k=N=>{const F=Lf(N);return`shape[${F}]._zod.run({ value: input[${F}], issues: [] }, ctx)`};g.write("const input = payload.value;");const T=Object.create(null);let P=0;for(const N of _.keys)T[N]=`key_${P++}`;g.write("const newResult = {};");for(const N of _.keys){const F=T[N],Y=Lf(N),j=v[N],oe=((Z=j==null?void 0:j._zod)==null?void 0:Z.optout)==="optional";g.write(`const ${F} = ${k(N)};`),oe?g.write(`
6
+ `))}}const Z$={major:4,minor:3,patch:6},fe=A("$ZodType",(n,t)=>{var i;var e;n??(n={}),n._zod.def=t,n._zod.bag=n._zod.bag||{},n._zod.version=Z$;const r=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&r.unshift(n);for(const s of r)for(const o of s._zod.onattach)o(n);if(r.length===0)(e=n._zod).deferred??(e.deferred=[]),(i=n._zod.deferred)==null||i.push(()=>{n._zod.run=n._zod.parse});else{const s=(a,c,u)=>{let h=gi(a),p;for(const v of c){if(v._zod.def.when){if(!v._zod.def.when(a))continue}else if(h)continue;const g=a.issues.length,_=v._zod.check(a);if(_ instanceof Promise&&(u==null?void 0:u.async)===!1)throw new yi;if(p||_ instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await _,a.issues.length!==g&&(h||(h=gi(a,g)))});else{if(a.issues.length===g)continue;h||(h=gi(a,g))}}return p?p.then(()=>a):a},o=(a,c,u)=>{if(gi(a))return a.aborted=!0,a;const h=s(c,r,u);if(h instanceof Promise){if(u.async===!1)throw new yi;return h.then(p=>n._zod.parse(p,u))}return n._zod.parse(h,u)};n._zod.run=(a,c)=>{if(c.skipChecks)return n._zod.parse(a,c);if(c.direction==="backward"){const h=n._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return h instanceof Promise?h.then(p=>o(p,a,c)):o(h,a,c)}const u=n._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new yi;return u.then(h=>s(h,r,c))}return s(u,r,c)}}ne(n,"~standard",()=>({validate:s=>{var o;try{const a=q1(n,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return Y1(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}))}),fd=A("$ZodString",(n,t)=>{var e;fe.init(n,t),n._zod.pattern=[...((e=n==null?void 0:n._zod.bag)==null?void 0:e.patterns)??[]].pop()??x$(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}}),he=A("$ZodStringFormat",(n,t)=>{Bl.init(n,t),fd.init(n,t)}),W$=A("$ZodGUID",(n,t)=>{t.pattern??(t.pattern=h$),he.init(n,t)}),V$=A("$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=Wf(r))}else t.pattern??(t.pattern=Wf());he.init(n,t)}),B$=A("$ZodEmail",(n,t)=>{t.pattern??(t.pattern=d$),he.init(n,t)}),j$=A("$ZodURL",(n,t)=>{he.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})}}}),G$=A("$ZodEmoji",(n,t)=>{t.pattern??(t.pattern=f$()),he.init(n,t)}),q$=A("$ZodNanoID",(n,t)=>{t.pattern??(t.pattern=c$),he.init(n,t)}),Y$=A("$ZodCUID",(n,t)=>{t.pattern??(t.pattern=i$),he.init(n,t)}),X$=A("$ZodCUID2",(n,t)=>{t.pattern??(t.pattern=s$),he.init(n,t)}),K$=A("$ZodULID",(n,t)=>{t.pattern??(t.pattern=o$),he.init(n,t)}),J$=A("$ZodXID",(n,t)=>{t.pattern??(t.pattern=a$),he.init(n,t)}),Q$=A("$ZodKSUID",(n,t)=>{t.pattern??(t.pattern=l$),he.init(n,t)}),eT=A("$ZodISODateTime",(n,t)=>{t.pattern??(t.pattern=k$(t)),he.init(n,t)}),tT=A("$ZodISODate",(n,t)=>{t.pattern??(t.pattern=S$),he.init(n,t)}),nT=A("$ZodISOTime",(n,t)=>{t.pattern??(t.pattern=_$(t)),he.init(n,t)}),rT=A("$ZodISODuration",(n,t)=>{t.pattern??(t.pattern=u$),he.init(n,t)}),iT=A("$ZodIPv4",(n,t)=>{t.pattern??(t.pattern=g$),he.init(n,t),n._zod.bag.format="ipv4"}),sT=A("$ZodIPv6",(n,t)=>{t.pattern??(t.pattern=m$),he.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})}}}),oT=A("$ZodCIDRv4",(n,t)=>{t.pattern??(t.pattern=v$),he.init(n,t)}),aT=A("$ZodCIDRv6",(n,t)=>{t.pattern??(t.pattern=y$),he.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 o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>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 Kv(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const lT=A("$ZodBase64",(n,t)=>{t.pattern??(t.pattern=b$),he.init(n,t),n._zod.bag.contentEncoding="base64",n._zod.check=e=>{Kv(e.value)||e.issues.push({code:"invalid_format",format:"base64",input:e.value,inst:n,continue:!t.abort})}});function cT(n){if(!Vv.test(n))return!1;const t=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),e=t.padEnd(Math.ceil(t.length/4)*4,"=");return Kv(e)}const uT=A("$ZodBase64URL",(n,t)=>{t.pattern??(t.pattern=Vv),he.init(n,t),n._zod.bag.contentEncoding="base64url",n._zod.check=e=>{cT(e.value)||e.issues.push({code:"invalid_format",format:"base64url",input:e.value,inst:n,continue:!t.abort})}}),hT=A("$ZodE164",(n,t)=>{t.pattern??(t.pattern=w$),he.init(n,t)});function dT(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 pT=A("$ZodJWT",(n,t)=>{he.init(n,t),n._zod.check=e=>{dT(e.value,t.alg)||e.issues.push({code:"invalid_format",format:"jwt",input:e.value,inst:n,continue:!t.abort})}}),Jv=A("$ZodNumber",(n,t)=>{fe.init(n,t),n._zod.pattern=n._zod.bag.pattern??Gv,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}}),fT=A("$ZodNumberFormat",(n,t)=>{C$.init(n,t),Jv.init(n,t)}),gT=A("$ZodBoolean",(n,t)=>{fe.init(n,t),n._zod.pattern=A$,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}}),mT=A("$ZodUnknown",(n,t)=>{fe.init(n,t),n._zod.parse=e=>e}),vT=A("$ZodNever",(n,t)=>{fe.init(n,t),n._zod.parse=(e,r)=>(e.issues.push({expected:"never",code:"invalid_type",input:e.value,inst:n}),e)});function Vf(n,t,e){n.issues.length&&t.issues.push(...mi(e,n.issues)),t.value[e]=n.value}const yT=A("$ZodArray",(n,t)=>{fe.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 o=0;o<i.length;o++){const a=i[o],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Vf(u,e,o))):Vf(c,e,o)}return s.length?Promise.all(s).then(()=>e):e}});function al(n,t,e,r,i){if(n.issues.length){if(i&&!(e in r))return;t.issues.push(...mi(e,n.issues))}n.value===void 0?e in r&&(t.value[e]=void 0):t.value[e]=n.value}function Qv(n){var r,i,s,o;const t=Object.keys(n.shape);for(const a of t)if(!((o=(s=(i=(r=n.shape)==null?void 0:r[a])==null?void 0:i._zod)==null?void 0:s.traits)!=null&&o.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const e=M1(n.shape);return{...n,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(e)}}function ey(n,t,e,r,i,s){const o=[],a=i.keySet,c=i.catchall._zod,u=c.def.type,h=c.optout==="optional";for(const p in t){if(a.has(p))continue;if(u==="never"){o.push(p);continue}const v=c.run({value:t[p],issues:[]},r);v instanceof Promise?n.push(v.then(g=>al(g,e,p,t,h))):al(v,e,p,t,h)}return o.length&&e.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:s}),n.length?Promise.all(n).then(()=>e):e}const bT=A("$ZodObject",(n,t)=>{fe.init(n,t);const e=Object.getOwnPropertyDescriptor(t,"shape");if(!(e!=null&&e.get)){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=ld(()=>Qv(t));ne(n._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const h=a[u]._zod;if(h.values){c[u]??(c[u]=new Set);for(const p of h.values)c[u].add(p)}}return c});const i=ol,s=t.catchall;let o;n._zod.parse=(a,c)=>{o??(o=r.value);const u=a.value;if(!i(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:n}),a;a.value={};const h=[],p=o.shape;for(const v of o.keys){const g=p[v],_=g._zod.optout==="optional",k=g._zod.run({value:u[v],issues:[]},c);k instanceof Promise?h.push(k.then(I=>al(I,a,v,u,_))):al(k,a,v,u,_)}return s?ey(h,u,a,c,r.value,n):h.length?Promise.all(h).then(()=>a):a}}),wT=A("$ZodObjectJIT",(n,t)=>{bT.init(n,t);const e=n._zod.parse,r=ld(()=>Qv(t)),i=v=>{var Z;const g=new H$(["shape","payload","ctx"]),_=r.value,k=N=>{const F=Zf(N);return`shape[${F}]._zod.run({ value: input[${F}], issues: [] }, ctx)`};g.write("const input = payload.value;");const I=Object.create(null);let P=0;for(const N of _.keys)I[N]=`key_${P++}`;g.write("const newResult = {};");for(const N of _.keys){const F=I[N],Y=Zf(N),j=v[N],oe=((Z=j==null?void 0:j._zod)==null?void 0:Z.optout)==="optional";g.write(`const ${F} = ${k(N)};`),oe?g.write(`
7
7
  if (${F}.issues.length) {
8
8
  if (${Y} in input) {
9
9
  payload.issues = payload.issues.concat(${F}.issues.map(iss => ({
@@ -37,59 +37,59 @@ var Gw=Object.defineProperty;var Kd=n=>{throw TypeError(n)};var qw=(n,t,e)=>t in
37
37
  newResult[${Y}] = ${F}.value;
38
38
  }
39
39
 
40
- `)}g.write("payload.value = newResult;"),g.write("return payload;");const R=g.compile();return(N,F)=>R(v,N,F)};let s;const o=rl,a=!Pv.jitless,u=a&&z1.value,h=t.catchall;let p;n._zod.parse=(v,g)=>{p??(p=r.value);const _=v.value;return o(_)?a&&u&&(g==null?void 0:g.async)===!1&&g.jitless!==!0?(s||(s=i(t.shape)),v=s(v,g),h?Yv([],_,v,g,p,n):v):e(v,g):(v.issues.push({expected:"object",code:"invalid_type",input:_,inst:n}),v)}});function Mf(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=>!gi(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(o=>Bn(o,r,Vn())))}),t)}const ST=A("$ZodUnion",(n,t)=>{fe.init(n,t),ne(n._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ne(n._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ne(n._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),ne(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=>td(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 o=!1;const a=[];for(const c of t.options){const u=c._zod.run({value:i.value,issues:[]},s);if(u instanceof Promise)a.push(u),o=!0;else{if(u.issues.length===0)return u;a.push(u)}}return o?Promise.all(a).then(c=>Mf(c,i,n,s)):Mf(a,i,n,s)}}),_T=A("$ZodIntersection",(n,t)=>{fe.init(n,t),n._zod.parse=(e,r)=>{const i=e.value,s=t.left._zod.run({value:i,issues:[]},r),o=t.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([c,u])=>Nf(e,c,u)):Nf(e,s,o)}});function $u(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(Vi(n)&&Vi(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 o=$u(n[s],t[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(n)&&Array.isArray(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],o=$u(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};e.push(o.data)}return{valid:!0,data:e}}return{valid:!1,mergeErrorPath:[]}}function Nf(n,t,e){const r=new Map;let i;for(const a of t.issues)if(a.code==="unrecognized_keys"){i??(i=a);for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else n.issues.push(a);for(const a of e.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else n.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&i&&n.issues.push({...i,keys:s}),gi(n))return n;const o=$u(t.value,e.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return n.value=o.data,n}const kT=A("$ZodRecord",(n,t)=>{fe.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!Vi(i))return e.issues.push({expected:"record",code:"invalid_type",input:i,inst:n}),e;const s=[],o=t.keyType._zod.values;if(o){e.value={};const a=new Set;for(const u of o)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);const h=t.valueType._zod.run({value:i[u],issues:[]},r);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&e.issues.push(...mi(u,p.issues)),e.value[u]=p.value})):(h.issues.length&&e.issues.push(...mi(u,h.issues)),e.value[u]=h.value)}let c;for(const u in i)a.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 a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let c=t.keyType._zod.run({value:a,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Zv.test(a)&&c.issues.length){const p=t.keyType._zod.run({value:Number(a),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[a]=i[a]:e.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>Bn(p,r,Vn())),input:a,path:[a],inst:n});continue}const h=t.valueType._zod.run({value:i[a],issues:[]},r);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&e.issues.push(...mi(a,p.issues)),e.value[c.value]=p.value})):(h.issues.length&&e.issues.push(...mi(a,h.issues)),e.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>e):e}}),xT=A("$ZodEnum",(n,t)=>{fe.init(n,t);const e=Dv(t.entries),r=new Set(e);n._zod.values=r,n._zod.pattern=new RegExp(`^(${e.filter(i=>O1.has(typeof i)).map(i=>typeof i=="string"?Bi(i):i.toString()).join("|")})$`),n._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:e,input:o,inst:n}),i}}),ET=A("$ZodLiteral",(n,t)=>{if(fe.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"?Bi(r):r?Bi(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}}),AT=A("$ZodTransform",(n,t)=>{fe.init(n,t),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new Rv(n.constructor.name);const i=t.transform(e.value,e);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(e.value=o,e));if(i instanceof Promise)throw new yi;return e.value=i,e}});function Uf(n,t){return n.issues.length&&t===void 0?{issues:[],value:void 0}:n}const Xv=A("$ZodOptional",(n,t)=>{fe.init(n,t),n._zod.optin="optional",n._zod.optout="optional",ne(n._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ne(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${td(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=>Uf(s,e.value)):Uf(i,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,r)}}),$T=A("$ZodExactOptional",(n,t)=>{Xv.init(n,t),ne(n._zod,"values",()=>t.innerType._zod.values),ne(n._zod,"pattern",()=>t.innerType._zod.pattern),n._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),TT=A("$ZodNullable",(n,t)=>{fe.init(n,t),ne(n._zod,"optin",()=>t.innerType._zod.optin),ne(n._zod,"optout",()=>t.innerType._zod.optout),ne(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${td(e.source)}|null)$`):void 0}),ne(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)}),IT=A("$ZodDefault",(n,t)=>{fe.init(n,t),n._zod.optin="optional",ne(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=>Ff(s,t)):Ff(i,t)}});function Ff(n,t){return n.value===void 0&&(n.value=t.defaultValue),n}const CT=A("$ZodPrefault",(n,t)=>{fe.init(n,t),n._zod.optin="optional",ne(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))}),RT=A("$ZodNonOptional",(n,t)=>{fe.init(n,t),ne(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=>Hf(s,n)):Hf(i,n)}});function Hf(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 PT=A("$ZodCatch",(n,t)=>{fe.init(n,t),ne(n._zod,"optin",()=>t.innerType._zod.optin),ne(n._zod,"optout",()=>t.innerType._zod.optout),ne(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(o=>Bn(o,r,Vn()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(s=>Bn(s,r,Vn()))},input:e.value}),e.issues=[]),e)}}),DT=A("$ZodPipe",(n,t)=>{fe.init(n,t),ne(n._zod,"values",()=>t.in._zod.values),ne(n._zod,"optin",()=>t.in._zod.optin),ne(n._zod,"optout",()=>t.out._zod.optout),ne(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(o=>fa(o,t.in,r)):fa(s,t.in,r)}const i=t.in._zod.run(e,r);return i instanceof Promise?i.then(s=>fa(s,t.out,r)):fa(i,t.out,r)}});function fa(n,t,e){return n.issues.length?(n.aborted=!0,n):t._zod.run({value:n.value,issues:n.issues},e)}const LT=A("$ZodReadonly",(n,t)=>{fe.init(n,t),ne(n._zod,"propValues",()=>t.innerType._zod.propValues),ne(n._zod,"values",()=>t.innerType._zod.values),ne(n._zod,"optin",()=>{var e,r;return(r=(e=t.innerType)==null?void 0:e._zod)==null?void 0:r.optin}),ne(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(Zf):Zf(i)}});function Zf(n){return n.value=Object.freeze(n.value),n}const zT=A("$ZodCustom",(n,t)=>{rt.init(n,t),fe.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=>Wf(s,e,r,n));Wf(i,e,r,n)}});function Wf(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(Us(i))}}var Vf;class OT{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 MT(){return new OT}(Vf=globalThis).__zod_globalRegistry??(Vf.__zod_globalRegistry=MT());const _s=globalThis.__zod_globalRegistry;function NT(n,t){return new n({type:"string",...M(t)})}function UT(n,t){return new n({type:"string",format:"email",check:"string_format",abort:!1,...M(t)})}function Bf(n,t){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...M(t)})}function FT(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...M(t)})}function HT(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...M(t)})}function ZT(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...M(t)})}function WT(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...M(t)})}function VT(n,t){return new n({type:"string",format:"url",check:"string_format",abort:!1,...M(t)})}function BT(n,t){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...M(t)})}function jT(n,t){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...M(t)})}function GT(n,t){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...M(t)})}function qT(n,t){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...M(t)})}function YT(n,t){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...M(t)})}function XT(n,t){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...M(t)})}function KT(n,t){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...M(t)})}function JT(n,t){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...M(t)})}function QT(n,t){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...M(t)})}function eI(n,t){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...M(t)})}function tI(n,t){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...M(t)})}function nI(n,t){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...M(t)})}function rI(n,t){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...M(t)})}function iI(n,t){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...M(t)})}function sI(n,t){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...M(t)})}function oI(n,t){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...M(t)})}function aI(n,t){return new n({type:"string",format:"date",check:"string_format",...M(t)})}function lI(n,t){return new n({type:"string",format:"time",check:"string_format",precision:null,...M(t)})}function cI(n,t){return new n({type:"string",format:"duration",check:"string_format",...M(t)})}function uI(n,t){return new n({type:"number",checks:[],...M(t)})}function hI(n,t){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...M(t)})}function dI(n,t){return new n({type:"boolean",...M(t)})}function pI(n){return new n({type:"unknown"})}function fI(n,t){return new n({type:"never",...M(t)})}function jf(n,t){return new Vv({check:"less_than",...M(t),value:n,inclusive:!1})}function Hc(n,t){return new Vv({check:"less_than",...M(t),value:n,inclusive:!0})}function Gf(n,t){return new Bv({check:"greater_than",...M(t),value:n,inclusive:!1})}function Zc(n,t){return new Bv({check:"greater_than",...M(t),value:n,inclusive:!0})}function qf(n,t){return new I$({check:"multiple_of",...M(t),value:n})}function Kv(n,t){return new R$({check:"max_length",...M(t),maximum:n})}function sl(n,t){return new P$({check:"min_length",...M(t),minimum:n})}function Jv(n,t){return new D$({check:"length_equals",...M(t),length:n})}function gI(n,t){return new L$({check:"string_format",format:"regex",...M(t),pattern:n})}function mI(n){return new z$({check:"string_format",format:"lowercase",...M(n)})}function vI(n){return new O$({check:"string_format",format:"uppercase",...M(n)})}function yI(n,t){return new M$({check:"string_format",format:"includes",...M(t),includes:n})}function bI(n,t){return new N$({check:"string_format",format:"starts_with",...M(t),prefix:n})}function wI(n,t){return new U$({check:"string_format",format:"ends_with",...M(t),suffix:n})}function ns(n){return new F$({check:"overwrite",tx:n})}function SI(n){return ns(t=>t.normalize(n))}function _I(){return ns(n=>n.trim())}function kI(){return ns(n=>n.toLowerCase())}function xI(){return ns(n=>n.toUpperCase())}function EI(){return ns(n=>L1(n))}function AI(n,t,e){return new n({type:"array",element:t,...M(e)})}function $I(n,t,e){return new n({type:"custom",check:"custom",fn:t,...M(e)})}function TI(n){const t=II(e=>(e.addIssue=r=>{if(typeof r=="string")e.issues.push(Us(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(Us(i))}},n(e.value,e)));return t}function II(n,t){const e=new rt({check:"custom",...M(t)});return e._zod.check=n,e}function Qv(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)??_s,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 Se(n,t,e={path:[],schemaPath:[]}){var h,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 o={schema:{},count:1,cycle:void 0,path:e.path};t.seen.set(n,o);const a=(p=(h=n._zod).toJSONSchema)==null?void 0:p.call(h);if(a)o.schema=a;else{const v={...e,schemaPath:[...e.schemaPath,n],path:e.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(t,o.schema,v);else{const _=o.schema,k=t.processors[i.type];if(!k)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);k(n,t,_,v)}const g=n._zod.parent;g&&(o.ref||(o.ref=g),Se(g,t,v),t.seen.get(g).isParent=!0)}const c=t.metadataRegistry.get(n);return c&&Object.assign(o.schema,c),t.io==="input"&&Ze(n)&&(delete o.schema.examples,delete o.schema.default),t.io==="input"&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(n).schema}function ey(n,t){var o,a,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 h of n.seen.entries()){const p=(o=n.metadataRegistry.get(h[0]))==null?void 0:o.id;if(p){const v=r.get(p);if(v&&v!==h[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,h[0])}}const i=h=>{var k;const p=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const T=(k=n.external.registry.get(h[0]))==null?void 0:k.id,P=n.external.uri??(Z=>Z);if(T)return{ref:P(T)};const R=h[1].defId??h[1].schema.id??`schema${n.counter++}`;return h[1].defId=R,{defId:R,ref:`${P("__shared")}#/${p}/${R}`}}if(h[1]===e)return{ref:"#"};const g=`#/${p}/`,_=h[1].schema.id??`__schema${n.counter++}`;return{defId:_,ref:g+_}},s=h=>{if(h[1].schema.$ref)return;const p=h[1],{ref:v,defId:g}=i(h);p.def={...p.schema},g&&(p.defId=g);const _=p.schema;for(const k in _)delete _[k];_.$ref=v};if(n.cycles==="throw")for(const h of n.seen.entries()){const p=h[1];if(p.cycle)throw new Error(`Cycle detected: #/${(a=p.cycle)==null?void 0:a.join("/")}/<root>
40
+ `)}g.write("payload.value = newResult;"),g.write("return payload;");const R=g.compile();return(N,F)=>R(v,N,F)};let s;const o=ol,a=!Mv.jitless,u=a&&z1.value,h=t.catchall;let p;n._zod.parse=(v,g)=>{p??(p=r.value);const _=v.value;return o(_)?a&&u&&(g==null?void 0:g.async)===!1&&g.jitless!==!0?(s||(s=i(t.shape)),v=s(v,g),h?ey([],_,v,g,p,n):v):e(v,g):(v.issues.push({expected:"object",code:"invalid_type",input:_,inst:n}),v)}});function Bf(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=>!gi(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(o=>jn(o,r,Bn())))}),t)}const ST=A("$ZodUnion",(n,t)=>{fe.init(n,t),ne(n._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ne(n._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ne(n._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),ne(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=>ud(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 o=!1;const a=[];for(const c of t.options){const u=c._zod.run({value:i.value,issues:[]},s);if(u instanceof Promise)a.push(u),o=!0;else{if(u.issues.length===0)return u;a.push(u)}}return o?Promise.all(a).then(c=>Bf(c,i,n,s)):Bf(a,i,n,s)}}),_T=A("$ZodIntersection",(n,t)=>{fe.init(n,t),n._zod.parse=(e,r)=>{const i=e.value,s=t.left._zod.run({value:i,issues:[]},r),o=t.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([c,u])=>jf(e,c,u)):jf(e,s,o)}});function Du(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(Bi(n)&&Bi(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 o=Du(n[s],t[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(n)&&Array.isArray(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],o=Du(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};e.push(o.data)}return{valid:!0,data:e}}return{valid:!1,mergeErrorPath:[]}}function jf(n,t,e){const r=new Map;let i;for(const a of t.issues)if(a.code==="unrecognized_keys"){i??(i=a);for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else n.issues.push(a);for(const a of e.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else n.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&i&&n.issues.push({...i,keys:s}),gi(n))return n;const o=Du(t.value,e.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return n.value=o.data,n}const kT=A("$ZodRecord",(n,t)=>{fe.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!Bi(i))return e.issues.push({expected:"record",code:"invalid_type",input:i,inst:n}),e;const s=[],o=t.keyType._zod.values;if(o){e.value={};const a=new Set;for(const u of o)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);const h=t.valueType._zod.run({value:i[u],issues:[]},r);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&e.issues.push(...mi(u,p.issues)),e.value[u]=p.value})):(h.issues.length&&e.issues.push(...mi(u,h.issues)),e.value[u]=h.value)}let c;for(const u in i)a.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 a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let c=t.keyType._zod.run({value:a,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Gv.test(a)&&c.issues.length){const p=t.keyType._zod.run({value:Number(a),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[a]=i[a]:e.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>jn(p,r,Bn())),input:a,path:[a],inst:n});continue}const h=t.valueType._zod.run({value:i[a],issues:[]},r);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&e.issues.push(...mi(a,p.issues)),e.value[c.value]=p.value})):(h.issues.length&&e.issues.push(...mi(a,h.issues)),e.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>e):e}}),xT=A("$ZodEnum",(n,t)=>{fe.init(n,t);const e=Nv(t.entries),r=new Set(e);n._zod.values=r,n._zod.pattern=new RegExp(`^(${e.filter(i=>O1.has(typeof i)).map(i=>typeof i=="string"?ji(i):i.toString()).join("|")})$`),n._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:e,input:o,inst:n}),i}}),ET=A("$ZodLiteral",(n,t)=>{if(fe.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"?ji(r):r?ji(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}}),AT=A("$ZodTransform",(n,t)=>{fe.init(n,t),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new Ov(n.constructor.name);const i=t.transform(e.value,e);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(e.value=o,e));if(i instanceof Promise)throw new yi;return e.value=i,e}});function Gf(n,t){return n.issues.length&&t===void 0?{issues:[],value:void 0}:n}const ty=A("$ZodOptional",(n,t)=>{fe.init(n,t),n._zod.optin="optional",n._zod.optout="optional",ne(n._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ne(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ud(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=>Gf(s,e.value)):Gf(i,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,r)}}),$T=A("$ZodExactOptional",(n,t)=>{ty.init(n,t),ne(n._zod,"values",()=>t.innerType._zod.values),ne(n._zod,"pattern",()=>t.innerType._zod.pattern),n._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),TT=A("$ZodNullable",(n,t)=>{fe.init(n,t),ne(n._zod,"optin",()=>t.innerType._zod.optin),ne(n._zod,"optout",()=>t.innerType._zod.optout),ne(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ud(e.source)}|null)$`):void 0}),ne(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)}),IT=A("$ZodDefault",(n,t)=>{fe.init(n,t),n._zod.optin="optional",ne(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=>qf(s,t)):qf(i,t)}});function qf(n,t){return n.value===void 0&&(n.value=t.defaultValue),n}const CT=A("$ZodPrefault",(n,t)=>{fe.init(n,t),n._zod.optin="optional",ne(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))}),RT=A("$ZodNonOptional",(n,t)=>{fe.init(n,t),ne(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=>Yf(s,n)):Yf(i,n)}});function Yf(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 PT=A("$ZodCatch",(n,t)=>{fe.init(n,t),ne(n._zod,"optin",()=>t.innerType._zod.optin),ne(n._zod,"optout",()=>t.innerType._zod.optout),ne(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(o=>jn(o,r,Bn()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(s=>jn(s,r,Bn()))},input:e.value}),e.issues=[]),e)}}),DT=A("$ZodPipe",(n,t)=>{fe.init(n,t),ne(n._zod,"values",()=>t.in._zod.values),ne(n._zod,"optin",()=>t.in._zod.optin),ne(n._zod,"optout",()=>t.out._zod.optout),ne(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(o=>ga(o,t.in,r)):ga(s,t.in,r)}const i=t.in._zod.run(e,r);return i instanceof Promise?i.then(s=>ga(s,t.out,r)):ga(i,t.out,r)}});function ga(n,t,e){return n.issues.length?(n.aborted=!0,n):t._zod.run({value:n.value,issues:n.issues},e)}const LT=A("$ZodReadonly",(n,t)=>{fe.init(n,t),ne(n._zod,"propValues",()=>t.innerType._zod.propValues),ne(n._zod,"values",()=>t.innerType._zod.values),ne(n._zod,"optin",()=>{var e,r;return(r=(e=t.innerType)==null?void 0:e._zod)==null?void 0:r.optin}),ne(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(Xf):Xf(i)}});function Xf(n){return n.value=Object.freeze(n.value),n}const zT=A("$ZodCustom",(n,t)=>{rt.init(n,t),fe.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=>Kf(s,e,r,n));Kf(i,e,r,n)}});function Kf(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(Fs(i))}}var Jf;class OT{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 MT(){return new OT}(Jf=globalThis).__zod_globalRegistry??(Jf.__zod_globalRegistry=MT());const ks=globalThis.__zod_globalRegistry;function NT(n,t){return new n({type:"string",...M(t)})}function UT(n,t){return new n({type:"string",format:"email",check:"string_format",abort:!1,...M(t)})}function Qf(n,t){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...M(t)})}function FT(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...M(t)})}function HT(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...M(t)})}function ZT(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...M(t)})}function WT(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...M(t)})}function VT(n,t){return new n({type:"string",format:"url",check:"string_format",abort:!1,...M(t)})}function BT(n,t){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...M(t)})}function jT(n,t){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...M(t)})}function GT(n,t){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...M(t)})}function qT(n,t){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...M(t)})}function YT(n,t){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...M(t)})}function XT(n,t){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...M(t)})}function KT(n,t){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...M(t)})}function JT(n,t){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...M(t)})}function QT(n,t){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...M(t)})}function eI(n,t){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...M(t)})}function tI(n,t){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...M(t)})}function nI(n,t){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...M(t)})}function rI(n,t){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...M(t)})}function iI(n,t){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...M(t)})}function sI(n,t){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...M(t)})}function oI(n,t){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...M(t)})}function aI(n,t){return new n({type:"string",format:"date",check:"string_format",...M(t)})}function lI(n,t){return new n({type:"string",format:"time",check:"string_format",precision:null,...M(t)})}function cI(n,t){return new n({type:"string",format:"duration",check:"string_format",...M(t)})}function uI(n,t){return new n({type:"number",checks:[],...M(t)})}function hI(n,t){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...M(t)})}function dI(n,t){return new n({type:"boolean",...M(t)})}function pI(n){return new n({type:"unknown"})}function fI(n,t){return new n({type:"never",...M(t)})}function eg(n,t){return new Yv({check:"less_than",...M(t),value:n,inclusive:!1})}function Gc(n,t){return new Yv({check:"less_than",...M(t),value:n,inclusive:!0})}function tg(n,t){return new Xv({check:"greater_than",...M(t),value:n,inclusive:!1})}function qc(n,t){return new Xv({check:"greater_than",...M(t),value:n,inclusive:!0})}function ng(n,t){return new I$({check:"multiple_of",...M(t),value:n})}function ny(n,t){return new R$({check:"max_length",...M(t),maximum:n})}function ll(n,t){return new P$({check:"min_length",...M(t),minimum:n})}function ry(n,t){return new D$({check:"length_equals",...M(t),length:n})}function gI(n,t){return new L$({check:"string_format",format:"regex",...M(t),pattern:n})}function mI(n){return new z$({check:"string_format",format:"lowercase",...M(n)})}function vI(n){return new O$({check:"string_format",format:"uppercase",...M(n)})}function yI(n,t){return new M$({check:"string_format",format:"includes",...M(t),includes:n})}function bI(n,t){return new N$({check:"string_format",format:"starts_with",...M(t),prefix:n})}function wI(n,t){return new U$({check:"string_format",format:"ends_with",...M(t),suffix:n})}function rs(n){return new F$({check:"overwrite",tx:n})}function SI(n){return rs(t=>t.normalize(n))}function _I(){return rs(n=>n.trim())}function kI(){return rs(n=>n.toLowerCase())}function xI(){return rs(n=>n.toUpperCase())}function EI(){return rs(n=>L1(n))}function AI(n,t,e){return new n({type:"array",element:t,...M(e)})}function $I(n,t,e){return new n({type:"custom",check:"custom",fn:t,...M(e)})}function TI(n){const t=II(e=>(e.addIssue=r=>{if(typeof r=="string")e.issues.push(Fs(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(Fs(i))}},n(e.value,e)));return t}function II(n,t){const e=new rt({check:"custom",...M(t)});return e._zod.check=n,e}function iy(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)??ks,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 Se(n,t,e={path:[],schemaPath:[]}){var h,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 o={schema:{},count:1,cycle:void 0,path:e.path};t.seen.set(n,o);const a=(p=(h=n._zod).toJSONSchema)==null?void 0:p.call(h);if(a)o.schema=a;else{const v={...e,schemaPath:[...e.schemaPath,n],path:e.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(t,o.schema,v);else{const _=o.schema,k=t.processors[i.type];if(!k)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);k(n,t,_,v)}const g=n._zod.parent;g&&(o.ref||(o.ref=g),Se(g,t,v),t.seen.get(g).isParent=!0)}const c=t.metadataRegistry.get(n);return c&&Object.assign(o.schema,c),t.io==="input"&&Ze(n)&&(delete o.schema.examples,delete o.schema.default),t.io==="input"&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(n).schema}function sy(n,t){var o,a,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 h of n.seen.entries()){const p=(o=n.metadataRegistry.get(h[0]))==null?void 0:o.id;if(p){const v=r.get(p);if(v&&v!==h[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,h[0])}}const i=h=>{var k;const p=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const I=(k=n.external.registry.get(h[0]))==null?void 0:k.id,P=n.external.uri??(Z=>Z);if(I)return{ref:P(I)};const R=h[1].defId??h[1].schema.id??`schema${n.counter++}`;return h[1].defId=R,{defId:R,ref:`${P("__shared")}#/${p}/${R}`}}if(h[1]===e)return{ref:"#"};const g=`#/${p}/`,_=h[1].schema.id??`__schema${n.counter++}`;return{defId:_,ref:g+_}},s=h=>{if(h[1].schema.$ref)return;const p=h[1],{ref:v,defId:g}=i(h);p.def={...p.schema},g&&(p.defId=g);const _=p.schema;for(const k in _)delete _[k];_.$ref=v};if(n.cycles==="throw")for(const h of n.seen.entries()){const p=h[1];if(p.cycle)throw new Error(`Cycle detected: #/${(a=p.cycle)==null?void 0:a.join("/")}/<root>
41
41
 
42
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of n.seen.entries()){const p=h[1];if(t===h[0]){s(h);continue}if(n.external){const g=(c=n.external.registry.get(h[0]))==null?void 0:c.id;if(t!==h[0]&&g){s(h);continue}}if((u=n.metadataRegistry.get(h[0]))==null?void 0:u.id){s(h);continue}if(p.cycle){s(h);continue}if(p.count>1&&n.reused==="ref"){s(h);continue}}}function ty(n,t){var o,a,c;const e=n.seen.get(t);if(!e)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=u=>{const h=n.seen.get(u);if(h.ref===null)return;const p=h.def??h.schema,v={...p},g=h.ref;if(h.ref=null,g){r(g);const k=n.seen.get(g),T=k.schema;if(T.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(T)):Object.assign(p,T),Object.assign(p,v),u._zod.parent===g)for(const R in p)R==="$ref"||R==="allOf"||R in v||delete p[R];if(T.$ref&&k.def)for(const R in p)R==="$ref"||R==="allOf"||R in k.def&&JSON.stringify(p[R])===JSON.stringify(k.def[R])&&delete p[R]}const _=u._zod.parent;if(_&&_!==g){r(_);const k=n.seen.get(_);if(k!=null&&k.schema.$ref&&(p.$ref=k.schema.$ref,k.def))for(const T in p)T==="$ref"||T==="allOf"||T in k.def&&JSON.stringify(p[T])===JSON.stringify(k.def[T])&&delete p[T]}n.override({zodSchema:u,jsonSchema:p,path:h.path??[]})};for(const u of[...n.seen.entries()].reverse())r(u[0]);const i={};if(n.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":n.target,(o=n.external)!=null&&o.uri){const u=(a=n.external.registry.get(t))==null?void 0:a.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 h=u[1];h.def&&h.defId&&(s[h.defId]=h.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:ol(t,"input",n.processors),output:ol(t,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Ze(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 Ze(r.element,e);if(r.type==="set")return Ze(r.valueType,e);if(r.type==="lazy")return Ze(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 Ze(r.innerType,e);if(r.type==="intersection")return Ze(r.left,e)||Ze(r.right,e);if(r.type==="record"||r.type==="map")return Ze(r.keyType,e)||Ze(r.valueType,e);if(r.type==="pipe")return Ze(r.in,e)||Ze(r.out,e);if(r.type==="object"){for(const i in r.shape)if(Ze(r.shape[i],e))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Ze(i,e))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Ze(i,e))return!0;return!!(r.rest&&Ze(r.rest,e))}return!1}const CI=(n,t={})=>e=>{const r=Qv({...e,processors:t});return Se(n,r),ey(r,n),ty(r,n)},ol=(n,t,e={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=Qv({...i??{},target:s,io:t,processors:e});return Se(n,o),ey(o,n),ty(o,n)},RI={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},PI=(n,t,e,r)=>{const i=e;i.type="string";const{minimum:s,maximum:o,format:a,patterns:c,contentEncoding:u}=n._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=RI[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){const h=[...c];h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},DI=(n,t,e,r)=>{const i=e,{minimum:s,maximum:o,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:h}=n._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h),typeof s=="number"&&(i.minimum=s,typeof h=="number"&&t.target!=="draft-04"&&(h>=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 o=="number"&&(i.maximum=o,typeof u=="number"&&t.target!=="draft-04"&&(u<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},LI=(n,t,e,r)=>{e.type="boolean"},zI=(n,t,e,r)=>{e.not={}},OI=(n,t,e,r)=>{},MI=(n,t,e,r)=>{const i=n._zod.def,s=Dv(i.entries);s.every(o=>typeof o=="number")&&(e.type="number"),s.every(o=>typeof o=="string")&&(e.type="string"),e.enum=s},NI=(n,t,e,r)=>{const i=n._zod.def,s=[];for(const o of i.values)if(o===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){const o=s[0];e.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0"?e.enum=[o]:e.const=o}else s.every(o=>typeof o=="number")&&(e.type="number"),s.every(o=>typeof o=="string")&&(e.type="string"),s.every(o=>typeof o=="boolean")&&(e.type="boolean"),s.every(o=>o===null)&&(e.type="null"),e.enum=s},UI=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},FI=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},HI=(n,t,e,r)=>{const i=e,s=n._zod.def,{minimum:o,maximum:a}=n._zod.bag;typeof o=="number"&&(i.minItems=o),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=Se(s.element,t,{...r,path:[...r.path,"items"]})},ZI=(n,t,e,r)=>{var u;const i=e,s=n._zod.def;i.type="object",i.properties={};const o=s.shape;for(const h in o)i.properties[h]=Se(o[h],t,{...r,path:[...r.path,"properties",h]});const a=new Set(Object.keys(o)),c=new Set([...a].filter(h=>{const p=s.shape[h]._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=Se(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},WI=(n,t,e,r)=>{const i=n._zod.def,s=i.inclusive===!1,o=i.options.map((a,c)=>Se(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?e.oneOf=o:e.anyOf=o},VI=(n,t,e,r)=>{const i=n._zod.def,s=Se(i.left,t,{...r,path:[...r.path,"allOf",0]}),o=Se(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];e.allOf=c},BI=(n,t,e,r)=>{const i=e,s=n._zod.def;i.type="object";const o=s.keyType,a=o._zod.bag,c=a==null?void 0:a.patterns;if(s.mode==="loose"&&c&&c.size>0){const h=Se(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const p of c)i.patternProperties[p.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=Se(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=Se(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=o._zod.values;if(u){const h=[...u].filter(p=>typeof p=="string"||typeof p=="number");h.length>0&&(i.required=h)}},jI=(n,t,e,r)=>{const i=n._zod.def,s=Se(i.innerType,t,r),o=t.seen.get(n);t.target==="openapi-3.0"?(o.ref=i.innerType,e.nullable=!0):e.anyOf=[s,{type:"null"}]},GI=(n,t,e,r)=>{const i=n._zod.def;Se(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},qI=(n,t,e,r)=>{const i=n._zod.def;Se(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.default=JSON.parse(JSON.stringify(i.defaultValue))},YI=(n,t,e,r)=>{const i=n._zod.def;Se(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)))},XI=(n,t,e,r)=>{const i=n._zod.def;Se(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}e.default=o},KI=(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;Se(s,t,r);const o=t.seen.get(n);o.ref=s},JI=(n,t,e,r)=>{const i=n._zod.def;Se(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.readOnly=!0},ny=(n,t,e,r)=>{const i=n._zod.def;Se(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},QI=A("ZodISODateTime",(n,t)=>{eT.init(n,t),me.init(n,t)});function eC(n){return oI(QI,n)}const tC=A("ZodISODate",(n,t)=>{tT.init(n,t),me.init(n,t)});function nC(n){return aI(tC,n)}const rC=A("ZodISOTime",(n,t)=>{nT.init(n,t),me.init(n,t)});function iC(n){return lI(rC,n)}const sC=A("ZodISODuration",(n,t)=>{rT.init(n,t),me.init(n,t)});function oC(n){return cI(sC,n)}const ry=(n,t)=>{Mv.init(n,t),n.name="ZodError",Object.defineProperties(n,{format:{value:e=>G1(n,e)},flatten:{value:e=>j1(n,e)},addIssue:{value:e=>{n.issues.push(e),n.message=JSON.stringify(n.issues,Au,2)}},addIssues:{value:e=>{n.issues.push(...e),n.message=JSON.stringify(n.issues,Au,2)}},isEmpty:{get(){return n.issues.length===0}}})},Yf=A("ZodError",ry),bt=A("ZodError",ry,{Parent:Error}),aC=rd(bt),lC=id(bt),cC=Fl(bt),uC=Hl(bt),hC=X1(bt),dC=K1(bt),pC=J1(bt),fC=Q1(bt),gC=e$(bt),mC=t$(bt),vC=n$(bt),yC=r$(bt),ge=A("ZodType",(n,t)=>(fe.init(n,t),Object.assign(n["~standard"],{jsonSchema:{input:ol(n,"input"),output:ol(n,"output")}}),n.toJSONSchema=CI(n,{}),n.def=t,n.type=t.type,Object.defineProperty(n,"_def",{value:t}),n.check=(...e)=>n.clone(Xn(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)=>Kn(n,e,r),n.brand=()=>n,n.register=(e,r)=>(e.add(n,r),n),n.parse=(e,r)=>aC(n,e,r,{callee:n.parse}),n.safeParse=(e,r)=>cC(n,e,r),n.parseAsync=async(e,r)=>lC(n,e,r,{callee:n.parseAsync}),n.safeParseAsync=async(e,r)=>uC(n,e,r),n.spa=n.safeParseAsync,n.encode=(e,r)=>hC(n,e,r),n.decode=(e,r)=>dC(n,e,r),n.encodeAsync=async(e,r)=>pC(n,e,r),n.decodeAsync=async(e,r)=>fC(n,e,r),n.safeEncode=(e,r)=>gC(n,e,r),n.safeDecode=(e,r)=>mC(n,e,r),n.safeEncodeAsync=async(e,r)=>vC(n,e,r),n.safeDecodeAsync=async(e,r)=>yC(n,e,r),n.refine=(e,r)=>n.check(cR(e,r)),n.superRefine=e=>n.check(uR(e)),n.overwrite=e=>n.check(ns(e)),n.optional=()=>Jf(n),n.exactOptional=()=>XC(n),n.nullable=()=>Qf(n),n.nullish=()=>Jf(Qf(n)),n.nonoptional=e=>nR(n,e),n.array=()=>L(n),n.or=e=>B([n,e]),n.and=e=>Wl(n,e),n.transform=e=>eg(n,qC(e)),n.default=e=>QC(n,e),n.prefault=e=>tR(n,e),n.catch=e=>iR(n,e),n.pipe=e=>eg(n,e),n.readonly=()=>aR(n),n.describe=e=>{const r=n.clone();return _s.add(r,{description:e}),r},Object.defineProperty(n,"description",{get(){var e;return(e=_s.get(n))==null?void 0:e.description},configurable:!0}),n.meta=(...e)=>{if(e.length===0)return _s.get(n);const r=n.clone();return _s.add(r,e[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=e=>e(n),n)),iy=A("_ZodString",(n,t)=>{sd.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(r,i,s)=>PI(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(gI(...r)),n.includes=(...r)=>n.check(yI(...r)),n.startsWith=(...r)=>n.check(bI(...r)),n.endsWith=(...r)=>n.check(wI(...r)),n.min=(...r)=>n.check(sl(...r)),n.max=(...r)=>n.check(Kv(...r)),n.length=(...r)=>n.check(Jv(...r)),n.nonempty=(...r)=>n.check(sl(1,...r)),n.lowercase=r=>n.check(mI(r)),n.uppercase=r=>n.check(vI(r)),n.trim=()=>n.check(_I()),n.normalize=(...r)=>n.check(SI(...r)),n.toLowerCase=()=>n.check(kI()),n.toUpperCase=()=>n.check(xI()),n.slugify=()=>n.check(EI())}),bC=A("ZodString",(n,t)=>{sd.init(n,t),iy.init(n,t),n.email=e=>n.check(UT(wC,e)),n.url=e=>n.check(VT(SC,e)),n.jwt=e=>n.check(sI(OC,e)),n.emoji=e=>n.check(BT(_C,e)),n.guid=e=>n.check(Bf(Xf,e)),n.uuid=e=>n.check(FT(ga,e)),n.uuidv4=e=>n.check(HT(ga,e)),n.uuidv6=e=>n.check(ZT(ga,e)),n.uuidv7=e=>n.check(WT(ga,e)),n.nanoid=e=>n.check(jT(kC,e)),n.guid=e=>n.check(Bf(Xf,e)),n.cuid=e=>n.check(GT(xC,e)),n.cuid2=e=>n.check(qT(EC,e)),n.ulid=e=>n.check(YT(AC,e)),n.base64=e=>n.check(nI(DC,e)),n.base64url=e=>n.check(rI(LC,e)),n.xid=e=>n.check(XT($C,e)),n.ksuid=e=>n.check(KT(TC,e)),n.ipv4=e=>n.check(JT(IC,e)),n.ipv6=e=>n.check(QT(CC,e)),n.cidrv4=e=>n.check(eI(RC,e)),n.cidrv6=e=>n.check(tI(PC,e)),n.e164=e=>n.check(iI(zC,e)),n.datetime=e=>n.check(eC(e)),n.date=e=>n.check(nC(e)),n.time=e=>n.check(iC(e)),n.duration=e=>n.check(oC(e))});function d(n){return NT(bC,n)}const me=A("ZodStringFormat",(n,t)=>{he.init(n,t),iy.init(n,t)}),wC=A("ZodEmail",(n,t)=>{B$.init(n,t),me.init(n,t)}),Xf=A("ZodGUID",(n,t)=>{W$.init(n,t),me.init(n,t)}),ga=A("ZodUUID",(n,t)=>{V$.init(n,t),me.init(n,t)}),SC=A("ZodURL",(n,t)=>{j$.init(n,t),me.init(n,t)}),_C=A("ZodEmoji",(n,t)=>{G$.init(n,t),me.init(n,t)}),kC=A("ZodNanoID",(n,t)=>{q$.init(n,t),me.init(n,t)}),xC=A("ZodCUID",(n,t)=>{Y$.init(n,t),me.init(n,t)}),EC=A("ZodCUID2",(n,t)=>{X$.init(n,t),me.init(n,t)}),AC=A("ZodULID",(n,t)=>{K$.init(n,t),me.init(n,t)}),$C=A("ZodXID",(n,t)=>{J$.init(n,t),me.init(n,t)}),TC=A("ZodKSUID",(n,t)=>{Q$.init(n,t),me.init(n,t)}),IC=A("ZodIPv4",(n,t)=>{iT.init(n,t),me.init(n,t)}),CC=A("ZodIPv6",(n,t)=>{sT.init(n,t),me.init(n,t)}),RC=A("ZodCIDRv4",(n,t)=>{oT.init(n,t),me.init(n,t)}),PC=A("ZodCIDRv6",(n,t)=>{aT.init(n,t),me.init(n,t)}),DC=A("ZodBase64",(n,t)=>{lT.init(n,t),me.init(n,t)}),LC=A("ZodBase64URL",(n,t)=>{uT.init(n,t),me.init(n,t)}),zC=A("ZodE164",(n,t)=>{hT.init(n,t),me.init(n,t)}),OC=A("ZodJWT",(n,t)=>{pT.init(n,t),me.init(n,t)}),sy=A("ZodNumber",(n,t)=>{Gv.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(r,i,s)=>DI(n,r,i),n.gt=(r,i)=>n.check(Gf(r,i)),n.gte=(r,i)=>n.check(Zc(r,i)),n.min=(r,i)=>n.check(Zc(r,i)),n.lt=(r,i)=>n.check(jf(r,i)),n.lte=(r,i)=>n.check(Hc(r,i)),n.max=(r,i)=>n.check(Hc(r,i)),n.int=r=>n.check(Kf(r)),n.safe=r=>n.check(Kf(r)),n.positive=r=>n.check(Gf(0,r)),n.nonnegative=r=>n.check(Zc(0,r)),n.negative=r=>n.check(jf(0,r)),n.nonpositive=r=>n.check(Hc(0,r)),n.multipleOf=(r,i)=>n.check(qf(r,i)),n.step=(r,i)=>n.check(qf(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 H(n){return uI(sy,n)}const MC=A("ZodNumberFormat",(n,t)=>{fT.init(n,t),sy.init(n,t)});function Kf(n){return hI(MC,n)}const NC=A("ZodBoolean",(n,t)=>{gT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>LI(n,e,r)});function Ie(n){return dI(NC,n)}const UC=A("ZodUnknown",(n,t)=>{mT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>OI()});function x(){return pI(UC)}const FC=A("ZodNever",(n,t)=>{vT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>zI(n,e,r)});function HC(n){return fI(FC,n)}const ZC=A("ZodArray",(n,t)=>{yT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>HI(n,e,r,i),n.element=t.element,n.min=(e,r)=>n.check(sl(e,r)),n.nonempty=e=>n.check(sl(1,e)),n.max=(e,r)=>n.check(Kv(e,r)),n.length=(e,r)=>n.check(Jv(e,r)),n.unwrap=()=>n.element});function L(n,t){return AI(ZC,n,t)}const oy=A("ZodObject",(n,t)=>{wT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>ZI(n,e,r,i),ne(n,"shape",()=>t.shape),n.keyof=()=>Fs(Object.keys(n._zod.def.shape)),n.catchall=e=>n.clone({...n._zod.def,catchall:e}),n.passthrough=()=>n.clone({...n._zod.def,catchall:x()}),n.loose=()=>n.clone({...n._zod.def,catchall:x()}),n.strict=()=>n.clone({...n._zod.def,catchall:HC()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=e=>H1(n,e),n.safeExtend=e=>Z1(n,e),n.merge=e=>W1(n,e),n.pick=e=>U1(n,e),n.omit=e=>F1(n,e),n.partial=(...e)=>V1(ly,n,e[0]),n.required=(...e)=>B1(cy,n,e[0])});function ay(n,t){const e={type:"object",shape:n??{},...M(t)};return new oy(e)}function y(n,t){return new oy({type:"object",shape:n,catchall:x(),...M(t)})}const WC=A("ZodUnion",(n,t)=>{ST.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>WI(n,e,r,i),n.options=t.options});function B(n,t){return new WC({type:"union",options:n,...M(t)})}const VC=A("ZodIntersection",(n,t)=>{_T.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>VI(n,e,r,i)});function Wl(n,t){return new VC({type:"intersection",left:n,right:t})}const BC=A("ZodRecord",(n,t)=>{kT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>BI(n,e,r,i),n.keyType=t.keyType,n.valueType=t.valueType});function E(n,t,e){return new BC({type:"record",keyType:n,valueType:t,...M(e)})}const Tu=A("ZodEnum",(n,t)=>{xT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(r,i,s)=>MI(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 o of r)if(e.has(o))s[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Tu({...t,checks:[],...M(i),entries:s})},n.exclude=(r,i)=>{const s={...t.entries};for(const o of r)if(e.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new Tu({...t,checks:[],...M(i),entries:s})}});function Fs(n,t){const e=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new Tu({type:"enum",entries:e,...M(t)})}const jC=A("ZodLiteral",(n,t)=>{ET.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>NI(n,e,r),n.values=new Set(t.values),Object.defineProperty(n,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function $(n,t){return new jC({type:"literal",values:Array.isArray(n)?n:[n],...M(t)})}const GC=A("ZodTransform",(n,t)=>{AT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>FI(n,e),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new Rv(n.constructor.name);e.addIssue=s=>{if(typeof s=="string")e.issues.push(Us(s,e.value,t));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=e.value),o.inst??(o.inst=n),e.issues.push(Us(o))}};const i=t.transform(e.value,e);return i instanceof Promise?i.then(s=>(e.value=s,e)):(e.value=i,e)}});function qC(n){return new GC({type:"transform",transform:n})}const ly=A("ZodOptional",(n,t)=>{Xv.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>ny(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function Jf(n){return new ly({type:"optional",innerType:n})}const YC=A("ZodExactOptional",(n,t)=>{$T.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>ny(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function XC(n){return new YC({type:"optional",innerType:n})}const KC=A("ZodNullable",(n,t)=>{TT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>jI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function Qf(n){return new KC({type:"nullable",innerType:n})}const JC=A("ZodDefault",(n,t)=>{IT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>qI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function QC(n,t){return new JC({type:"default",innerType:n,get defaultValue(){return typeof t=="function"?t():zv(t)}})}const eR=A("ZodPrefault",(n,t)=>{CT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>YI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function tR(n,t){return new eR({type:"prefault",innerType:n,get defaultValue(){return typeof t=="function"?t():zv(t)}})}const cy=A("ZodNonOptional",(n,t)=>{RT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>GI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function nR(n,t){return new cy({type:"nonoptional",innerType:n,...M(t)})}const rR=A("ZodCatch",(n,t)=>{PT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>XI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function iR(n,t){return new rR({type:"catch",innerType:n,catchValue:typeof t=="function"?t:()=>t})}const sR=A("ZodPipe",(n,t)=>{DT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>KI(n,e,r,i),n.in=t.in,n.out=t.out});function eg(n,t){return new sR({type:"pipe",in:n,out:t})}const oR=A("ZodReadonly",(n,t)=>{LT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>JI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function aR(n){return new oR({type:"readonly",innerType:n})}const lR=A("ZodCustom",(n,t)=>{zT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>UI(n,e)});function cR(n,t={}){return $I(lR,n,t)}function uR(n){return TI(n)}const sn={custom:"custom"},uy=["markdown","web-bundle","url"],hR=["committed","pending"];function dR(n){let t;try{t=new URL(n)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"}ay({id:d().min(1),kind:Fs(uy),title:d(),status:Fs(hR),externalFilePath:d().optional(),externalURL:d().optional()}).superRefine((n,t)=>{switch(n.externalFilePath!==void 0&&n.externalURL!==void 0&&t.addIssue({code:sn.custom,message:"externalFilePath and externalURL are mutually exclusive",path:["externalURL"]}),n.kind!=="web-bundle"&&n.status!=="committed"&&t.addIssue({code:sn.custom,message:"only web-bundle artifacts can be pending",path:["status"]}),n.kind){case"markdown":n.externalFilePath===void 0&&t.addIssue({code:sn.custom,message:"markdown artifacts require externalFilePath",path:["externalFilePath"]}),n.externalURL!==void 0&&t.addIssue({code:sn.custom,message:"markdown artifacts cannot set externalURL",path:["externalURL"]});break;case"web-bundle":n.externalFilePath!==void 0&&t.addIssue({code:sn.custom,message:"web-bundle artifacts cannot set externalFilePath",path:["externalFilePath"]}),n.externalURL!==void 0&&t.addIssue({code:sn.custom,message:"web-bundle artifacts cannot set externalURL",path:["externalURL"]});break;case"url":if(n.externalURL===void 0){t.addIssue({code:sn.custom,message:"url artifacts require externalURL",path:["externalURL"]});break}n.externalFilePath!==void 0&&t.addIssue({code:sn.custom,message:"url artifacts cannot set externalFilePath",path:["externalFilePath"]}),dR(n.externalURL)||t.addIssue({code:sn.custom,message:"externalURL must be an http(s) URL",path:["externalURL"]});break}});ay({name:d().min(1),description:d(),accepts:L(Fs(uy)).min(1)});function hy(n){return typeof n=="object"&&n!==null}function pR(n){return!hy(n)||n.type!=="ready"?!1:!("id"in n)}function fR(n){return!(!hy(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}function gR(n,t){return t.find(e=>e.accepts.includes(n))??null}const ue={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"},on={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"},mR=1,vR=y({_meta:E(d(),x()).nullish(),terminal:Ie().optional().default(!1)}),yR=y({_meta:E(d(),x()).nullish(),label:d().nullish(),name:d(),optional:Ie().optional().default(!1),secret:Ie().optional().default(!0)}),bR=y({_meta:E(d(),x()).nullish(),description:d().nullish(),id:d(),name:d()}),wR=y({_meta:E(d(),x()).nullish(),description:d().nullish(),id:d(),link:d().nullish(),name:d(),vars:L(yR)}),SR=y({_meta:E(d(),x()).nullish(),args:L(d()).optional(),description:d().nullish(),env:E(d(),d()).optional(),id:d(),name:d()}),_R=B([wR.and(y({type:$("env_var")})),SR.and(y({type:$("terminal")})),bR]),kR=y({_meta:E(d(),x()).nullish(),methodId:d()}),xR=y({_meta:E(d(),x()).nullish()}),ER=y({_meta:E(d(),x()).nullish(),blob:d(),mimeType:d().nullish(),uri:d()}),AR=y({default:Ie().nullish(),description:d().nullish(),title:d().nullish()}),$R=y({_meta:E(d(),x()).nullish()}),TR=y({_meta:E(d(),x()).nullish()}),IR=y({amount:H(),currency:d()}),CR=y({_meta:E(d(),x()).nullish(),terminalId:d()}),RR=y({_meta:E(d(),x()).nullish(),newText:d(),oldText:d().nullish(),path:d()}),PR=B([d(),H(),H(),Ie(),L(d())]),DR=y({content:E(d(),PR).nullish()}),LR=B([DR.and(y({action:$("accept")})),y({action:$("decline")}),y({action:$("cancel")})]),zR=y({_meta:E(d(),x()).nullish()}),dy=d(),OR=y({_meta:E(d(),x()).nullish(),elicitationId:dy}),MR=y({_meta:E(d(),x()).nullish(),action:LR}),NR=$("object"),UR=$("string"),FR=y({_meta:E(d(),x()).nullish()}),HR=y({_meta:E(d(),x()).nullish(),form:zR.nullish(),url:FR.nullish()}),ZR=y({elicitationId:dy,url:d().url()}),py=y({const:d(),title:d()}),fy=y({_meta:E(d(),x()).nullish(),name:d(),value:d()}),WR=B([$(-32700),$(-32600),$(-32601),$(-32602),$(-32603),$(-32800),$(-32e3),$(-32002),$(-32042),H().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),gy=y({code:WR,data:x().optional(),message:d()}),my=x(),vy=x(),yy=x(),VR=y({_meta:E(d(),x()).nullish(),readTextFile:Ie().optional().default(!1),writeTextFile:Ie().optional().default(!1)}),by=y({_meta:E(d(),x()).nullish(),name:d(),value:d()}),wy=y({_meta:E(d(),x()).nullish(),name:d(),title:d().nullish(),version:d()}),BR=y({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),jR=y({_meta:E(d(),x()).nullish()}),GR=y({_meta:E(d(),x()).nullish(),additionalDirectories:L(d()).optional(),cursor:d().nullish(),cwd:d().nullish()}),qR=y({_meta:E(d(),x()).nullish()}),YR=y({_meta:E(d(),x()).nullish(),logout:qR.nullish()}),XR=y({_meta:E(d(),x()).nullish()}),KR=y({_meta:E(d(),x()).nullish()}),JR=y({_meta:E(d(),x()).nullish(),http:Ie().optional().default(!1),sse:Ie().optional().default(!1)}),QR=y({_meta:E(d(),x()).nullish(),headers:L(by),name:d(),url:d()}),eP=y({_meta:E(d(),x()).nullish(),headers:L(by),name:d(),url:d()}),tP=y({_meta:E(d(),x()).nullish(),args:L(d()),command:d(),env:L(fy),name:d()}),Vl=B([QR.and(y({type:$("http")})),eP.and(y({type:$("sse")})),tP]),od=d(),nP=y({_meta:E(d(),x()).nullish(),description:d().nullish(),modelId:od,name:d()}),rP=B([$("error"),$("warning"),$("information"),$("hint")]),iP=y({_meta:E(d(),x()).nullish()}),sP=y({_meta:E(d(),x()).nullish()}),oP=y({_meta:E(d(),x()).nullish()}),aP=y({_meta:E(d(),x()).nullish()}),lP=y({_meta:E(d(),x()).nullish()}),cP=y({_meta:E(d(),x()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),uP=y({diff:d(),uri:d()}),hP=y({endLine:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:d()}),dP=y({_meta:E(d(),x()).nullish()}),pP=y({_meta:E(d(),x()).nullish()}),fP=y({languageId:d(),text:d(),uri:d()}),gP=y({_meta:E(d(),x()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),mP=B([$("rejected"),$("ignored"),$("replaced"),$("cancelled")]),vP=y({excerpts:L(hP),uri:d()}),yP=y({_meta:E(d(),x()).nullish()}),bP=y({_meta:E(d(),x()).nullish()}),wP=y({name:d(),owner:d(),remoteUrl:d()}),SP=y({_meta:E(d(),x()).nullish()}),_P=y({_meta:E(d(),x()).nullish(),jump:dP.nullish(),rename:bP.nullish(),searchAndReplace:SP.nullish()}),kP=y({id:d(),isRegex:Ie().nullish(),replace:d(),search:d(),uri:d()}),xP=B([$("automatic"),$("diagnostic"),$("manual")]),EP=y({_meta:E(d(),x()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),AP=y({_meta:E(d(),x()).nullish(),diagnostics:iP.nullish(),editHistory:cP.nullish(),openFiles:pP.nullish(),recentFiles:gP.nullish(),relatedSnippets:yP.nullish(),userActions:EP.nullish()}),$P=y({_meta:E(d(),x()).nullish(),additionalDirectories:L(d()).optional(),cwd:d(),mcpServers:L(Vl)}),TP=y({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),Sy=d(),IP=B([$("allow_once"),$("allow_always"),$("reject_once"),$("reject_always")]),CP=y({_meta:E(d(),x()).nullish(),kind:IP,name:d(),optionId:Sy}),RP=B([$("high"),$("medium"),$("low")]),PP=B([$("pending"),$("in_progress"),$("completed")]),DP=y({_meta:E(d(),x()).nullish(),content:d(),priority:RP,status:PP}),LP=y({_meta:E(d(),x()).nullish(),entries:L(DP)}),jn=y({character:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),zP=y({id:d(),position:jn,uri:d()}),OP=y({id:d(),newName:d(),position:jn,uri:d()}),MP=y({action:d(),position:jn,timestampMs:H(),uri:d()}),_y=B([$("utf-16"),$("utf-32"),$("utf-8")]),NP=y({_meta:E(d(),x()).nullish(),auth:vR.optional().default({terminal:!1}),elicitation:HR.nullish(),fs:VR.optional().default({readTextFile:!1,writeTextFile:!1}),nes:_P.nullish(),positionEncodings:L(_y).optional(),terminal:Ie().optional().default(!1)}),UP=y({_meta:E(d(),x()).nullish(),audio:Ie().optional().default(!1),embeddedContext:Ie().optional().default(!1),image:Ie().optional().default(!1)}),ky=H().int().gte(0).lte(65535),FP=y({_meta:E(d(),x()).nullish(),clientCapabilities:NP.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:wy.nullish(),protocolVersion:ky}),rs=y({end:jn,start:jn}),HP=y({message:d(),range:rs,severity:rP,uri:d()}),ZP=y({languageId:d(),lastFocusedMs:H().nullish(),uri:d(),visibleRange:rs.nullish()}),WP=y({_meta:E(d(),x()).nullish(),diagnostics:L(HP).nullish(),editHistory:L(uP).nullish(),openFiles:L(ZP).nullish(),recentFiles:L(fP).nullish(),relatedSnippets:L(vP).nullish(),userActions:L(MP).nullish()}),VP=y({newText:d(),range:rs}),BP=y({cursorPosition:jn.nullish(),edits:L(VP),id:d(),uri:d()}),jP=B([BP.and(y({kind:$("edit")})),zP.and(y({kind:$("jump")})),OP.and(y({kind:$("rename")})),kP.and(y({kind:$("searchAndReplace")}))]),GP=y({_meta:E(d(),x()).nullish(),content:d()}),qP=y({_meta:E(d(),x()).nullish()}),Or=B([H(),d()]).nullable();y({_meta:E(d(),x()).nullish(),requestId:Or});const YP=Fs(["assistant","user"]),jo=y({_meta:E(d(),x()).nullish(),audience:L(YP).nullish(),lastModified:d().nullish(),priority:H().nullish()}),XP=y({_meta:E(d(),x()).nullish(),annotations:jo.nullish(),data:d(),mimeType:d()}),KP=y({_meta:E(d(),x()).nullish(),annotations:jo.nullish(),data:d(),mimeType:d(),uri:d().nullish()}),JP=y({_meta:E(d(),x()).nullish(),annotations:jo.nullish(),description:d().nullish(),mimeType:d().nullish(),name:d(),size:H().nullish(),title:d().nullish(),uri:d()}),QP=y({_meta:E(d(),x()).nullish(),optionId:Sy}),eD=B([y({outcome:$("cancelled")}),QP.and(y({outcome:$("selected")}))]),tD=y({_meta:E(d(),x()).nullish(),outcome:eD}),nD=y({_meta:E(d(),x()).nullish()}),rD=y({_meta:E(d(),x()).nullish()}),iD=y({currentValue:Ie()}),sD=d(),xy=d(),oD=B([$("mode"),$("model"),$("thought_level"),d()]),ad=d(),Ey=y({_meta:E(d(),x()).nullish(),description:d().nullish(),name:d(),value:ad}),aD=y({_meta:E(d(),x()).nullish(),group:sD,name:d(),options:L(Ey)}),lD=B([L(Ey),L(aD)]),cD=y({currentValue:ad,options:lD}),is=Wl(B([cD.and(y({type:$("select")})),iD.and(y({type:$("boolean")}))]),y({_meta:E(d(),x()).nullish(),category:oD.nullish(),description:d().nullish(),id:xy,name:d()})),uD=y({_meta:E(d(),x()).nullish(),configOptions:L(is)}),hD=y({_meta:E(d(),x()).nullish()}),Q=d(),dD=y({_meta:E(d(),x()).nullish(),id:d(),sessionId:Q}),pD=y({_meta:E(d(),x()).nullish(),sessionId:Q}),fD=y({_meta:E(d(),x()).nullish(),sessionId:Q}),gD=y({_meta:E(d(),x()).nullish(),sessionId:Q}),Ay=y({_meta:E(d(),x()).nullish(),args:L(d()).optional(),command:d(),cwd:d().nullish(),env:L(fy).optional(),outputByteLimit:H().nullish(),sessionId:Q}),mD=y({_meta:E(d(),x()).nullish(),sessionId:Q,uri:d()}),vD=y({_meta:E(d(),x()).nullish(),position:jn,sessionId:Q,uri:d(),version:H(),visibleRange:rs}),yD=y({_meta:E(d(),x()).nullish(),languageId:d(),sessionId:Q,text:d(),uri:d(),version:H()}),bD=y({_meta:E(d(),x()).nullish(),sessionId:Q,uri:d()}),wD=y({_meta:E(d(),x()).nullish(),additionalDirectories:L(d()).optional(),cwd:d(),mcpServers:L(Vl).optional(),sessionId:Q}),$y=y({_meta:E(d(),x()).nullish(),sessionId:Q,terminalId:d()}),SD=y({_meta:E(d(),x()).nullish(),additionalDirectories:L(d()).optional(),cwd:d(),mcpServers:L(Vl),sessionId:Q}),Ty=y({_meta:E(d(),x()).nullish(),limit:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d(),sessionId:Q}),_D=y({_meta:E(d(),x()).nullish(),id:d(),reason:mP.nullish(),sessionId:Q}),Iy=y({_meta:E(d(),x()).nullish(),sessionId:Q,terminalId:d()}),kD=y({_meta:E(d(),x()).nullish(),additionalDirectories:L(d()).optional(),cwd:d(),mcpServers:L(Vl).optional(),sessionId:Q}),xD=y({_meta:E(d(),x()).nullish(),additionalDirectories:L(d()).optional(),cwd:d(),sessionId:Q,title:d().nullish(),updatedAt:d().nullish()}),ED=y({_meta:E(d(),x()).nullish(),nextCursor:d().nullish(),sessions:L(xD)}),AD=y({_meta:E(d(),x()).nullish(),title:d().nullish(),updatedAt:d().nullish()}),$D=y({_meta:E(d(),x()).nullish()}),Bl=d(),TD=y({_meta:E(d(),x()).nullish(),currentModeId:Bl}),ID=y({_meta:E(d(),x()).nullish(),description:d().nullish(),id:Bl,name:d()}),jl=y({_meta:E(d(),x()).nullish(),availableModes:L(ID),currentModeId:Bl}),Gl=y({_meta:E(d(),x()).nullish(),availableModels:L(nP),currentModelId:od}),CD=y({_meta:E(d(),x()).nullish(),configOptions:L(is).nullish(),models:Gl.nullish(),modes:jl.nullish(),sessionId:Q}),RD=y({_meta:E(d(),x()).nullish(),configOptions:L(is).nullish(),models:Gl.nullish(),modes:jl.nullish()}),PD=y({_meta:E(d(),x()).nullish(),configOptions:L(is).nullish(),models:Gl.nullish(),modes:jl.nullish(),sessionId:Q}),DD=y({_meta:E(d(),x()).nullish(),configOptions:L(is).nullish(),models:Gl.nullish(),modes:jl.nullish()}),LD=y({_meta:E(d(),x()).nullish()}),zD=y({_meta:E(d(),x()).nullish(),additionalDirectories:nD.nullish(),close:rD.nullish(),fork:hD.nullish(),list:$D.nullish(),resume:LD.nullish()}),OD=Wl(B([y({type:$("boolean"),value:Ie()}),y({value:ad})]),y({_meta:E(d(),x()).nullish(),configId:xy,sessionId:Q})),MD=y({_meta:E(d(),x()).nullish(),configOptions:L(is)}),ND=y({_meta:E(d(),x()).nullish(),modeId:Bl,sessionId:Q}),UD=y({_meta:E(d(),x()).nullish()}),FD=y({_meta:E(d(),x()).nullish(),modelId:od,sessionId:Q}),HD=y({_meta:E(d(),x()).nullish()}),ZD=y({_meta:E(d(),x()).nullish(),sessionId:Q}),WD=B([$("end_turn"),$("max_tokens"),$("max_turn_requests"),$("refusal"),$("cancelled")]),VD=B([$("email"),$("uri"),$("date"),$("date-time")]),BD=y({default:d().nullish(),description:d().nullish(),enum:L(d()).nullish(),format:VD.nullish(),maxLength:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:L(py).nullish(),pattern:d().nullish(),title:d().nullish()}),jD=y({_meta:E(d(),x()).nullish(),context:WP.nullish(),position:jn,selection:rs.nullish(),sessionId:Q,triggerKind:xP,uri:d(),version:H()}),GD=y({_meta:E(d(),x()).nullish(),suggestions:L(jP)}),qD=y({_meta:E(d(),x()).nullish(),terminalId:d()}),YD=y({_meta:E(d(),x()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),Cy=y({_meta:E(d(),x()).nullish(),sessionId:Q,terminalId:d()}),XD=y({_meta:E(d(),x()).nullish(),exitStatus:YD.nullish(),output:d(),truncated:Ie()}),KD=y({_meta:E(d(),x()).nullish(),annotations:jo.nullish(),text:d()}),JD=y({range:rs.nullish(),text:d()}),QD=y({_meta:E(d(),x()).nullish(),contentChanges:L(JD),sessionId:Q,uri:d(),version:H()});y({method:d(),params:B([pD,yD,QD,mD,bD,vD,dD,_D,my]).nullish()});const eL=B([$("full"),$("incremental")]),tL=y({_meta:E(d(),x()).nullish(),syncKind:eL}),nL=y({_meta:E(d(),x()).nullish(),didChange:tL.nullish(),didClose:sP.nullish(),didFocus:oP.nullish(),didOpen:aP.nullish(),didSave:lP.nullish()}),rL=y({_meta:E(d(),x()).nullish(),document:nL.nullish()}),iL=y({_meta:E(d(),x()).nullish(),context:AP.nullish(),events:rL.nullish()}),sL=y({_meta:E(d(),x()).nullish(),auth:YR.optional().default({}),loadSession:Ie().optional().default(!1),mcpCapabilities:JR.optional().default({http:!1,sse:!1}),nes:iL.nullish(),positionEncoding:_y.nullish(),promptCapabilities:UP.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:zD.optional().default({})}),oL=y({_meta:E(d(),x()).nullish(),agentCapabilities:sL.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:wy.nullish(),authMethods:L(_R).optional().default([]),protocolVersion:ky}),aL=y({_meta:E(d(),x()).nullish(),mimeType:d().nullish(),text:d(),uri:d()}),lL=B([aL,ER]),cL=y({_meta:E(d(),x()).nullish(),annotations:jo.nullish(),resource:lL}),ld=B([KD.and(y({type:$("text")})),KP.and(y({type:$("image")})),XP.and(y({type:$("audio")})),JP.and(y({type:$("resource_link")})),cL.and(y({type:$("resource")}))]),uL=y({_meta:E(d(),x()).nullish(),content:ld}),Wc=y({_meta:E(d(),x()).nullish(),content:ld,messageId:d().nullish()}),hL=y({_meta:E(d(),x()).nullish(),messageId:d().nullish(),prompt:L(ld),sessionId:Q}),dL=y({anyOf:L(py)}),Ry=B([uL.and(y({type:$("content")})),RR.and(y({type:$("diff")})),qD.and(y({type:$("terminal")}))]),Py=d(),Dy=y({_meta:E(d(),x()).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d()}),Ly=B([$("pending"),$("in_progress"),$("completed"),$("failed")]),zy=B([$("read"),$("edit"),$("delete"),$("move"),$("search"),$("execute"),$("think"),$("fetch"),$("switch_mode"),$("other")]),pL=y({_meta:E(d(),x()).nullish(),content:L(Ry).optional(),kind:zy.optional(),locations:L(Dy).optional(),rawInput:x().optional(),rawOutput:x().optional(),status:Ly.optional(),title:d(),toolCallId:Py}),Oy=y({_meta:E(d(),x()).nullish(),content:L(Ry).nullish(),kind:zy.nullish(),locations:L(Dy).nullish(),rawInput:x().optional(),rawOutput:x().optional(),status:Ly.nullish(),title:d().nullish(),toolCallId:Py}),My=y({_meta:E(d(),x()).nullish(),options:L(CP),sessionId:Q,toolCall:Oy}),fL=y({_meta:E(d(),x()).nullish(),hint:d()}),gL=fL,mL=y({_meta:E(d(),x()).nullish(),description:d(),input:gL.nullish(),name:d()}),vL=y({_meta:E(d(),x()).nullish(),availableCommands:L(mL)}),yL=y({enum:L(d()),type:UR}),bL=B([yL,dL]),wL=y({default:L(d()).nullish(),description:d().nullish(),items:bL,maxItems:H().nullish(),minItems:H().nullish(),title:d().nullish()}),SL=B([BD.and(y({type:$("string")})),TP.and(y({type:$("number")})),BR.and(y({type:$("integer")})),AR.and(y({type:$("boolean")})),wL.and(y({type:$("array")}))]),_L=y({description:d().nullish(),properties:E(d(),SL).optional().default({}),required:L(d()).nullish(),title:d().nullish(),type:NR.optional().default("object")}),kL=y({requestedSchema:_L}),xL=Wl(B([kL.and(y({mode:$("form")})),ZR.and(y({mode:$("url")}))]),y({_meta:E(d(),x()).nullish(),message:d(),sessionId:Q})),EL=y({cachedReadTokens:H().nullish(),cachedWriteTokens:H().nullish(),inputTokens:H(),outputTokens:H(),thoughtTokens:H().nullish(),totalTokens:H()}),AL=y({_meta:E(d(),x()).nullish(),stopReason:WD,usage:EL.nullish(),userMessageId:d().nullish()});B([y({id:Or,result:B([oL,xR,KR,PD,RD,ED,CD,DD,TR,UD,MD,AL,HD,ZD,GD,$R,yy])}),y({error:gy,id:Or})]);const $L=y({_meta:E(d(),x()).nullish(),cost:IR.nullish(),size:H(),used:H()}),TL=B([Wc.and(y({sessionUpdate:$("user_message_chunk")})),Wc.and(y({sessionUpdate:$("agent_message_chunk")})),Wc.and(y({sessionUpdate:$("agent_thought_chunk")})),pL.and(y({sessionUpdate:$("tool_call")})),Oy.and(y({sessionUpdate:$("tool_call_update")})),LP.and(y({sessionUpdate:$("plan")})),vL.and(y({sessionUpdate:$("available_commands_update")})),TD.and(y({sessionUpdate:$("current_mode_update")})),uD.and(y({sessionUpdate:$("config_option_update")})),AD.and(y({sessionUpdate:$("session_info_update")})),$L.and(y({sessionUpdate:$("usage_update")}))]),Ny=y({_meta:E(d(),x()).nullish(),sessionId:Q,update:TL});y({method:d(),params:B([Ny,OR,my]).nullish()});const Uy=y({_meta:E(d(),x()).nullish(),sessionId:Q,terminalId:d()}),IL=y({_meta:E(d(),x()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),CL=y({name:d(),uri:d()}),RL=y({_meta:E(d(),x()).nullish(),repository:wP.nullish(),workspaceFolders:L(CL).nullish(),workspaceUri:d().nullish()});y({id:Or,method:d(),params:B([FP,kR,XR,$P,SD,GR,wD,kD,gD,ND,OD,hL,FD,RL,jD,fD,vy]).nullish()});const Fy=y({_meta:E(d(),x()).nullish(),content:d(),path:d(),sessionId:Q});y({id:Or,method:d(),params:B([Fy,Ty,My,Ay,Cy,Iy,Uy,$y,xL,vy]).nullish()});const PL=y({_meta:E(d(),x()).nullish()});B([y({id:Or,result:B([PL,GP,tD,CR,XD,qP,IL,jR,MR,yy])}),y({error:gy,id:Or})]);var J;class DL{constructor(t,e){w(this,J);const r=t(this),i=async(o,a)=>{var c,u,h,p,v,g,_;switch(o){case on.fs_write_text_file:{const k=Fy.parse(a);return(c=r.writeTextFile)==null?void 0:c.call(r,k)}case on.fs_read_text_file:{const k=Ty.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,k)}case on.session_request_permission:{const k=My.parse(a);return r.requestPermission(k)}case on.terminal_create:{const k=Ay.parse(a);return(h=r.createTerminal)==null?void 0:h.call(r,k)}case on.terminal_output:{const k=Cy.parse(a);return(p=r.terminalOutput)==null?void 0:p.call(r,k)}case on.terminal_release:{const k=Iy.parse(a);return await((v=r.releaseTerminal)==null?void 0:v.call(r,k))??{}}case on.terminal_wait_for_exit:{const k=Uy.parse(a);return(g=r.waitForTerminalExit)==null?void 0:g.call(r,k)}case on.terminal_kill:{const k=$y.parse(a);return await((_=r.killTerminal)==null?void 0:_.call(r,k))??{}}default:if(r.extMethod)return r.extMethod(o,a);throw Ae.methodNotFound(o)}},s=async(o,a)=>{switch(o){case on.session_update:{const c=Ny.parse(a);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(o,a);throw Ae.methodNotFound(o)}};S(this,J,new LL(i,s,e))}async initialize(t){return await l(this,J).sendRequest(ue.initialize,t)}async newSession(t){return await l(this,J).sendRequest(ue.session_new,t)}async loadSession(t){return await l(this,J).sendRequest(ue.session_load,t)??{}}async unstable_forkSession(t){return await l(this,J).sendRequest(ue.session_fork,t)}async listSessions(t){return await l(this,J).sendRequest(ue.session_list,t)}async unstable_resumeSession(t){return await l(this,J).sendRequest(ue.session_resume,t)}async unstable_closeSession(t){return await l(this,J).sendRequest(ue.session_close,t)}async setSessionMode(t){return await l(this,J).sendRequest(ue.session_set_mode,t)??{}}async unstable_setSessionModel(t){return await l(this,J).sendRequest(ue.session_set_model,t)??{}}async setSessionConfigOption(t){return await l(this,J).sendRequest(ue.session_set_config_option,t)}async authenticate(t){return await l(this,J).sendRequest(ue.authenticate,t)??{}}async unstable_logout(t){return await l(this,J).sendRequest(ue.logout,t)??{}}async prompt(t){return await l(this,J).sendRequest(ue.session_prompt,t)}async cancel(t){return await l(this,J).sendNotification(ue.session_cancel,t)}async unstable_startNes(t){return await l(this,J).sendRequest(ue.nes_start,t)}async unstable_suggestNes(t){return await l(this,J).sendRequest(ue.nes_suggest,t)}async unstable_closeNes(t){return await l(this,J).sendRequest(ue.nes_close,t)??{}}async unstable_didOpenDocument(t){return await l(this,J).sendNotification(ue.document_did_open,t)}async unstable_didChangeDocument(t){return await l(this,J).sendNotification(ue.document_did_change,t)}async unstable_didCloseDocument(t){return await l(this,J).sendNotification(ue.document_did_close,t)}async unstable_didSaveDocument(t){return await l(this,J).sendNotification(ue.document_did_save,t)}async unstable_didFocusDocument(t){return await l(this,J).sendNotification(ue.document_did_focus,t)}async unstable_acceptNes(t){return await l(this,J).sendNotification(ue.nes_accept,t)}async unstable_rejectNes(t){return await l(this,J).sendNotification(ue.nes_reject,t)}async extMethod(t,e){return await l(this,J).sendRequest(t,e)}async extNotification(t,e){return await l(this,J).sendNotification(t,e)}get signal(){return l(this,J).signal}get closed(){return l(this,J).closed}}J=new WeakMap;var In,ml,Ys,Xs,bi,wi,Nt,Ks,pe,Hy,Iu,Zy,Wy,Vy,By,Cu,ks;class LL{constructor(t,e,r){w(this,pe);w(this,In,new Map);w(this,ml,0);w(this,Ys);w(this,Xs);w(this,bi);w(this,wi,Promise.resolve());w(this,Nt,new AbortController);w(this,Ks);S(this,Ys,t),S(this,Xs,e),S(this,bi,r),S(this,Ks,new Promise(i=>{l(this,Nt).signal.addEventListener("abort",()=>i())})),f(this,pe,Hy).call(this)}get signal(){return l(this,Nt).signal}get closed(){return l(this,Ks)}async sendRequest(t,e){f(this,pe,Cu).call(this);const r=Jd(this,ml)._++,i=new Promise((s,o)=>{l(this,In).set(r,{resolve:s,reject:o})});return await f(this,pe,ks).call(this,{jsonrpc:"2.0",id:r,method:t,params:e}),i}async sendNotification(t,e){f(this,pe,Cu).call(this),await f(this,pe,ks).call(this,{jsonrpc:"2.0",method:t,params:e})}}In=new WeakMap,ml=new WeakMap,Ys=new WeakMap,Xs=new WeakMap,bi=new WeakMap,wi=new WeakMap,Nt=new WeakMap,Ks=new WeakMap,pe=new WeakSet,Hy=async function(){let t;try{const e=l(this,bi).readable.getReader();try{for(;!l(this,Nt).signal.aborted;){const{value:r,done:i}=await e.read();if(i)break;if(r)try{f(this,pe,Zy).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&f(this,pe,ks).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{e.releaseLock()}}catch(e){t=e}finally{f(this,pe,Iu).call(this,t)}},Iu=function(t){if(l(this,Nt).signal.aborted)return;const e=t??new Error("ACP connection closed");for(const r of l(this,In).values())r.reject(e);l(this,In).clear(),l(this,Nt).abort(e)},Zy=async function(t){if("method"in t&&"id"in t){const e=await f(this,pe,Wy).call(this,t.method,t.params);"error"in e&&console.error("Error handling request",t,e.error),await f(this,pe,ks).call(this,{jsonrpc:"2.0",id:t.id,...e})}else if("method"in t){const e=await f(this,pe,Vy).call(this,t.method,t.params);"error"in e&&console.error("Error handling notification",t,e.error)}else"id"in t?f(this,pe,By).call(this,t):console.error("Invalid message",{message:t})},Wy=async function(t,e){try{return{result:await l(this,Ys).call(this,t,e)??null}}catch(r){if(r instanceof Ae)return r.toResult();if(r instanceof Yf)return Ae.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 Ae.internalError(i?JSON.parse(i):{}).toResult()}catch{return Ae.internalError({details:i}).toResult()}}},Vy=async function(t,e){try{return await l(this,Xs).call(this,t,e),{result:null}}catch(r){if(r instanceof Ae)return r.toResult();if(r instanceof Yf)return Ae.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 Ae.internalError(i?JSON.parse(i):{}).toResult()}catch{return Ae.internalError({details:i}).toResult()}}},By=function(t){const e=l(this,In).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 Ae(r,i,s))}l(this,In).delete(t.id)}else console.error("Got response to unknown request",t.id)},Cu=function(){if(l(this,Nt).signal.aborted)throw l(this,Nt).signal.reason??new Error("ACP connection closed")},ks=async function(t){return S(this,wi,l(this,wi).then(async()=>{const e=l(this,bi).writable.getWriter();try{await e.write(t)}finally{e.releaseLock()}}).catch(e=>{f(this,pe,Iu).call(this,e)})),l(this,wi)};class Ae extends Error{constructor(e,r,i){super(r);m(this,"code");m(this,"data");this.code=e,this.name="RequestError",this.data=i}static parseError(e,r){return new Ae(-32700,`Parse error${r?`: ${r}`:""}`,e)}static invalidRequest(e,r){return new Ae(-32600,`Invalid request${r?`: ${r}`:""}`,e)}static methodNotFound(e){return new Ae(-32601,`"Method not found": ${e}`,{method:e})}static invalidParams(e,r){return new Ae(-32602,`Invalid params${r?`: ${r}`:""}`,e)}static internalError(e,r){return new Ae(-32603,`Internal error${r?`: ${r}`:""}`,e)}static authRequired(e,r){return new Ae(-32e3,`Authentication required${r?`: ${r}`:""}`,e)}static resourceNotFound(e){return new Ae(-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}}}const zL=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,OL=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,ML=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,NL=/\b(tv|television|screen|artifact|artifacts|viewer|filmstrip|layout|focus)\b/i,UL=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,FL="single_session",HL={name:"television-acp-client",version:"0.0.0"},jy="agent:main:television",ZL=Bo(Jt);var Si,Ut,st,Ft,Cn,Ht,Rn,Pn,Dn,_r,hn,_i,Zt,Ve,dn,ki,kr,pn,Ln,Js,St,_t,vl,Wt,C,Gy,qy,Yy,Xy,Ru,Ky,Jy,Qy,eb,tb,nb,rb,or,ai,li,an,ib,ci,Pu,Du,Pa,sb,ob,Qs,eo,Da,ui,ab,lb;class WL extends ZL{constructor(e){super();w(this,C);w(this,Si,"disconnected");w(this,Ut,null);w(this,st,new Map);w(this,Ft,null);w(this,Cn,null);w(this,Ht,null);w(this,Rn,null);w(this,Pn,null);w(this,Dn,null);w(this,_r);w(this,hn,null);w(this,_i,1);w(this,Zt,null);w(this,Ve,null);w(this,dn,!1);w(this,ki,!1);w(this,kr,!1);w(this,pn,null);w(this,Ln,new Set);w(this,Js);w(this,St);w(this,_t);w(this,vl,e=>{f(this,C,Yy).call(this,e)});w(this,Wt,null);w(this,Qs,()=>{f(this,C,ui).call(this,"ACP bridge websocket closed")});w(this,eo,()=>{f(this,C,ui).call(this,"ACP bridge websocket error")});S(this,St,e),S(this,_t,e.sessionMode??FL),S(this,_r,e.mappedSessionStore??VL()),S(this,Js,e.createSocket??(r=>new WebSocket(r)))}get status(){return l(this,Si)}get messages(){return[...l(this,st).values()]}get enabled(){return l(this,St).enabled??!1}setEnabled(e){l(this,St).enabled=e,e||(f(this,C,Da).call(this),S(this,Ut,null),f(this,C,an).call(this,"disconnected"))}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(this.enabled&&this.status==="disconnected"){l(this,Cn)===null&&(S(this,Ut,null),S(this,Cn,f(this,C,qy).call(this)));try{await l(this,Cn),await f(this,C,Ru).call(this)}catch(e){throw f(this,C,ui).call(this,Vc(e)),e}}}dispose(){f(this,C,Da).call(this),S(this,Ut,null),f(this,C,an).call(this,"disposed")}async sendMessage(e){if(await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await f(this,C,Gy).call(this,"ready")),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");f(this,C,ai).call(this,{id:f(this,C,ci).call(this,"user"),kind:"user",text:r,status:"final"}),f(this,C,an).call(this,"running");try{const i=await f(this,C,Pa).call(this).prompt({sessionId:f(this,C,Du).call(this),prompt:[{type:"text",text:f(this,C,ib).call(this,r)}]});f(this,C,or).call(this,i.stopReason==="cancelled"?"cancelled":"final"),f(this,C,an).call(this,"ready")}catch(i){throw f(this,C,lb).call(this)||(f(this,C,or).call(this,"error"),f(this,C,an).call(this,"ready")),i}}async cancel(){this.status==="running"&&(f(this,C,an).call(this,"cancelling"),await f(this,C,Pa).call(this).cancel({sessionId:f(this,C,Du).call(this)}))}setScreenContext(e){var s,o,a;if(e===null){if(l(this,Ve)===null)return;S(this,Ve,null),S(this,dn,!1);return}const r={screenID:e.screenID,screenName:e.screenName};if(((s=l(this,Ve))==null?void 0:s.screenID)===r.screenID&&((o=l(this,Ve))==null?void 0:o.screenName)===r.screenName)return;const i=((a=l(this,Ve))==null?void 0:a.screenID)??null;if(S(this,Ve,r),l(this,_t)==="single_session"){(!l(this,hn)||i!==r.screenID)&&S(this,dn,!0);return}l(this,hn)!==tg(l(this,_t),r.screenID,l(this,St).clientGUID??"default-client")&&(S(this,Ht,null),S(this,Rn,null),l(this,Ft)&&this.status==="ready"&&f(this,C,Ru).call(this).catch(c=>{f(this,C,ui).call(this,Vc(c))}))}}Si=new WeakMap,Ut=new WeakMap,st=new WeakMap,Ft=new WeakMap,Cn=new WeakMap,Ht=new WeakMap,Rn=new WeakMap,Pn=new WeakMap,Dn=new WeakMap,_r=new WeakMap,hn=new WeakMap,_i=new WeakMap,Zt=new WeakMap,Ve=new WeakMap,dn=new WeakMap,ki=new WeakMap,kr=new WeakMap,pn=new WeakMap,Ln=new WeakMap,Js=new WeakMap,St=new WeakMap,_t=new WeakMap,vl=new WeakMap,Wt=new WeakMap,C=new WeakSet,Gy=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(l(this,Ut)??"ACPClient is disconnected");await new Promise((r,i)=>{const s=()=>{this.removeEventListener("status-changed",o)},o=()=>{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(l(this,Ut)??"ACPClient is disconnected")))};this.addEventListener("status-changed",o)})}},qy=async function(){try{const{stream:e,socket:r,metadata:i}=await GL({serverURL:l(this,St).serverURL,token:l(this,St).token,createSocket:l(this,Js),onDisconnect:l(this,vl)});S(this,Dn,i),S(this,Wt,r),r.addEventListener("close",l(this,Qs)),r.addEventListener("error",l(this,eo)),S(this,Ft,new DL(s=>({connection:s,sessionUpdate:async o=>{await f(this,C,Jy).call(this,o)},requestPermission:async o=>f(this,C,Qy).call(this,o)}),e)),await l(this,Ft).initialize({protocolVersion:mR,clientCapabilities:{},clientInfo:HL})}catch(e){throw e}},Yy=function(e){f(this,C,ui).call(this,Vc(e))},Xy=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})`)},Ru=async function(){const e=f(this,C,ob).call(this);if(l(this,Ht)&&l(this,Rn)===e){await l(this,Ht);return}S(this,Rn,e),S(this,Ht,f(this,C,Ky).call(this,e)),await l(this,Ht)},Ky=async function(e){var c;const r=f(this,C,Pa).call(this);f(this,C,ab).call(this);let i,s=!1,o=null;const a={cwd:f(this,C,sb).call(this),mcpServers:[],_meta:{sessionKey:e}};try{if(S(this,kr,!0),S(this,pn,null),((c=l(this,Dn))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=l(this,_r).getActualSessionId(e);if(u)try{const h=await r.loadSession({...a,sessionId:u});if(BL(h))throw new Error("Mapped ACP session was not found");o=h,i=u,s=!0}catch{const h=await r.newSession(a);o=h,i=h.sessionId,l(this,_r).setActualSessionId(e,i),s=!1}else{const h=await r.newSession(a);o=h,i=h.sessionId,l(this,_r).setActualSessionId(e,i),s=!1}}else try{o=await r.loadSession({...a,sessionId:e}),i=e,s=l(this,st).size>0}catch{const u=await r.newSession(a);o=u,i=u.sessionId,s=!1}}finally{S(this,kr,!1),S(this,pn,null),f(this,C,or).call(this,"final")}f(this,C,Xy).call(this,o),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),S(this,Pn,i),S(this,hn,e),S(this,ki,!0),s?(l(this,Ln).add(e),l(this,_t)==="single_session"&&S(this,dn,!1)):(l(this,Ln).delete(e),S(this,dn,l(this,_t)==="single_session")),S(this,Ut,null),f(this,C,an).call(this,"ready")},Jy=async function(e){const r=e.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&f(this,C,rb).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&f(this,C,eb).call(this,r.content.text);return;case"tool_call":f(this,C,tb).call(this,r);return;case"tool_call_update":f(this,C,nb).call(this,r);return;case"agent_thought_chunk":return;default:return}},Qy=async function(e){return{outcome:{outcome:"cancelled"}}},eb=function(e){S(this,pn,null);const r=jL(e);if(!r)return;if(!l(this,Zt)){const s={id:f(this,C,ci).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};S(this,Zt,s.id),f(this,C,ai).call(this,s);return}const i=l(this,st).get(l(this,Zt));if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");f(this,C,li).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},tb=function(e){f(this,C,or).call(this,"final");const r=f(this,C,Pu).call(this,e.toolCallId),i=rg("content"in e?e.content:void 0),s={id:(r==null?void 0:r.id)??f(this,C,ci).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){f(this,C,li).call(this,s);return}f(this,C,ai).call(this,s)},nb=function(e){const r=f(this,C,Pu).call(this,e.toolCallId),i=(r==null?void 0:r.text)??"",s=rg(e.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??f(this,C,ci).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:o,locations:e.locations??(r==null?void 0:r.locations)};if(r){f(this,C,li).call(this,a);return}f(this,C,ai).call(this,a)},rb=function(e){if(f(this,C,or).call(this,"final"),!e)return;const r=l(this,kr)?l(this,pn):null;if(!r){const s=ng(e);if(!s)return;const o={id:f(this,C,ci).call(this,"user"),kind:"user",text:s,status:"final"};f(this,C,ai).call(this,o),l(this,kr)&&S(this,pn,o.id);return}const i=l(this,st).get(r);if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");f(this,C,li).call(this,{...i,text:ng(`${i.text}${e}`)})},or=function(e){if(!l(this,Zt))return;const r=l(this,st).get(l(this,Zt));(r==null?void 0:r.kind)==="assistant"&&f(this,C,li).call(this,{...r,status:e}),S(this,Zt,null)},ai=function(e){l(this,st).set(e.id,e),this.dispatchEvent(new Uc("messages-changed"))},li=function(e){l(this,st).set(e.id,e),this.dispatchEvent(new Uc("messages-changed"))},an=function(e){l(this,Si)!==e&&(S(this,Si,e),this.dispatchEvent(new HA("status-changed")))},ib=function(e){const r=l(this,hn);if(!r)return e;const i=l(this,Ve)?l(this,_t)==="single_session"?l(this,dn)||!l(this,Ln).has(r):!l(this,Ln).has(r):!1,s=l(this,ki)&&(l(this,Ve)!==null||NL.test(e));if(!(s||i))return e;s&&S(this,ki,!1),i&&(S(this,dn,!1),l(this,Ln).add(r));const a=["[Television screen context]","This chat session is coming from a Television client.","Using Television requires the knowledge in the `television` skill. Re-read it only if it is not already in context or you know it changed.","If the skill is not installed, it can be installed via `tv skills install <your agent skills path>`."];return l(this,Ve)?(a.push("This conversation is currently attached to the screen below."),a.push(`screen_id: ${l(this,Ve).screenID}`),a.push(`screen_name: ${l(this,Ve).screenName??""}`),a.push("When the user asks to inspect or change Television state with the tv CLI, use this screen ID with the --screen argument.")):a.push("There is currently no active Television screen."),a.push("[/Television screen context]","",e),a.join(`
43
- `)},ci=function(e){const r=`${e}-${l(this,_i)}`;return S(this,_i,l(this,_i)+1),r},Pu=function(e){for(const r of l(this,st).values())if((r==null?void 0:r.kind)==="tool_call"&&r.toolCallId===e)return r;return null},Du=function(){if(!l(this,Pn))throw new Error("ACP session is not ready");return l(this,Pn)},Pa=function(){if(!l(this,Ft))throw new Error("ACP connection is not ready");return l(this,Ft)},sb=function(){var r;const e=(r=l(this,Dn))==null?void 0:r.sessionCwd;if(!e)throw new Error("ACP bridge session cwd is not ready");return e},ob=function(){var r;if(l(this,_t)==="single_session")return`${jy}-${(l(this,St).clientGUID??"default-client").toLowerCase()}`;const e=(r=l(this,Ve))==null?void 0:r.screenID;if(!e)throw new Error("Screen context is required for per-screen session mode");return tg(l(this,_t),e,l(this,St).clientGUID??"default-client")},Qs=new WeakMap,eo=new WeakMap,Da=function(){S(this,Ft,null),S(this,Cn,null),S(this,Ht,null),S(this,Rn,null),S(this,Pn,null),S(this,hn,null),S(this,Dn,null),l(this,Wt)&&(l(this,Wt).removeEventListener("close",l(this,Qs)),l(this,Wt).removeEventListener("error",l(this,eo)),l(this,Wt).close(),S(this,Wt,null))},ui=function(e){const r=l(this,Ft)!==null||l(this,Cn)!==null||l(this,Ht)!==null||l(this,Rn)!==null||l(this,Pn)!==null||l(this,hn)!==null||l(this,Dn)!==null||l(this,Wt)!==null;this.disposed||this.status==="disconnected"&&!r||(f(this,C,or).call(this,"error"),f(this,C,Da).call(this),S(this,Ut,e??null),f(this,C,an).call(this,"disconnected"))},ab=function(){const e=l(this,st).size>0;S(this,Zt,null),S(this,pn,null),S(this,_i,1),l(this,st).clear(),e&&this.dispatchEvent(new Uc("messages-changed"))},lb=function(){return this.status==="disconnected"};function VL(){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 BL(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function tg(n,t,e){return n==="single_session"?`${jy}-${e.toLowerCase()}`:`agent:main:television-${e.toLowerCase()}-${t.toLowerCase()}`}function cb(n){return n.replace(/^(?:\s*\n)+/,"")}function ng(n){let t=n;return t=t.replace(zL,""),t=t.replace(OL,""),t=t.replace(ML,""),t=cb(t),t}function jL(n){let t=n;return t=t.replace(UL,""),t=cb(t),t}function rg(n){return!n||n.length===0?"":n.flatMap(t=>t.type==="content"&&t.content.type==="text"?[t.content.text]:[]).join("")}async function GL(n){const t=n.createSocket(XL(n.serverURL,n.token));let e=!1,r,i;const s=new Promise((u,h)=>{r=u,i=h}),o=new ReadableStream({start(u){let h=!1;const p=()=>{t.send(JSON.stringify({type:"acp-bridge-connect"}))},v=k=>{const T=YL(k);if(!T)return;let P;try{P=JSON.parse(T)}catch(R){const Z=R instanceof Error?R:new Error(String(R));i(Z),u.error(Z);return}switch(P.type){case"acp-bridge-status":if(P.status==="ready"){let R;try{R=qL(P)}catch(Z){const N=Z instanceof Error?Z:new Error(String(Z));e||i(N),u.error(N);return}e||(e=!0,r(R));return}if(P.status==="error"||P.status==="exited"){const R=new Error(P.error??`ACP bridge ${P.status}`);e||i(R),u.error(R)}return;case"acp-bridge-message":u.enqueue(P.message);return}},g=()=>{var T;if(h)return;h=!0;const k=new Error("ACP bridge websocket closed");e||i(k),(T=n.onDisconnect)==null||T.call(n,k),u.close()},_=()=>{var T;if(h)return;h=!0;const k=new Error("ACP bridge websocket error");e||i(k),(T=n.onDisconnect)==null||T.call(n,k),u.error(k)};t.addEventListener("open",p),t.addEventListener("message",v),t.addEventListener("close",g),t.addEventListener("error",_)}}),a=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:o,writable:a},socket:t,metadata:c}}function qL(n){const{agent:t,sessionIdStrategy:e,sessionCwd:r}=n;if((t==="openclaw"||t==="hermes")&&(e==="deterministic"||e==="mapped")&&typeof r=="string"&&r.length>0)return{agent:t,sessionIdStrategy:e,sessionCwd:r};throw new Error("ACP bridge ready status missing bootstrap metadata")}function YL(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 XL(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 Vc(n){return n instanceof Error?n.message:String(n)}const ig="television.acpClientGUID",sg="television.acpMappedSessions",og=1;var xi;class KL{constructor(){w(this,xi,new Map)}getActualSessionId(t){return l(this,xi).get(t)??null}setActualSessionId(t,e){l(this,xi).set(t,e)}clearActualSessionId(t){l(this,xi).delete(t)}}xi=new WeakMap;var Ei,to,at,La,za,Lu;class JL{constructor(t,e){w(this,at);w(this,Ei);w(this,to);S(this,Ei,t),S(this,to,e)}getActualSessionId(t){const e=f(this,at,za).call(this)[f(this,at,La).call(this,t)];return typeof e=="string"&&e.length>0?e:null}setActualSessionId(t,e){const r=f(this,at,za).call(this);r[f(this,at,La).call(this,t)]=e,f(this,at,Lu).call(this,r)}clearActualSessionId(t){const e=f(this,at,za).call(this);delete e[f(this,at,La).call(this,t)],f(this,at,Lu).call(this,e)}}Ei=new WeakMap,to=new WeakMap,at=new WeakSet,La=function(t){return JSON.stringify([l(this,to),t])},za=function(){const t=l(this,Ei).getItem(sg);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!==og?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},Lu=function(t){const e={version:og,entries:t};l(this,Ei).setItem(sg,JSON.stringify(e))};function QL(){return typeof window>"u"?null:window.localStorage}function e2(n){const t=n.getItem(ig);if(t)return t;const e=Ul().toLowerCase();return n.setItem(ig,e),e}const ag=4401,t2=401,ma=1e3,n2=3e4;class Ds extends Error{constructor(t="Authentication required"){super(t),this.name="AuthError"}}class ub extends Jt{constructor(e){var i,s;super();m(this,"url");m(this,"name");m(this,"status","unauthorized");m(this,"screens",new Map);m(this,"views",[]);m(this,"client");m(this,"acpClient");m(this,"_token");m(this,"attempting",!1);m(this,"nextRetryAt",null);m(this,"hasEverConnected",!1);m(this,"createSocket");m(this,"createClient");m(this,"socket",null);m(this,"connectAttempt",0);m(this,"autoReconnect",!1);m(this,"retryTimer",null);m(this,"retryDelay",ma);m(this,"visibilityEventTarget");m(this,"networkEventTarget");m(this,"onVisibilityChange");m(this,"onNetworkOnline");this.url=be(e.url),this.name=e.name,this._token=e.token??null,this.createSocket=e.createSocket??(o=>new WebSocket(o)),this.createClient=e.createClient??((o,a)=>new y1(o,{token:a??void 0})),this.client=this.createClient(this.url,this._token);const r=e.mappedSessionStore??(e.acpStorage?new JL(e.acpStorage,this.url):new KL);this.acpClient=new WL({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()},(i=this.visibilityEventTarget)==null||i.addEventListener("visibilitychange",this.onVisibilityChange),(s=this.networkEventTarget)==null||s.addEventListener("online",this.onNetworkOnline)}get token(){return this._token}async connect(e){this._token=e,this.cancelRetryTimer(),this.retryDelay=ma,this.autoReconnect=!0,await this.attempt()}dispose(){var e,r,i;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),this.acpClient.dispose()}getViewURL(e){const r=gR(e.kind,this.views);if(!r)return null;const i=`${this.url}/views/${encodeURIComponent(r.id)}/`;return this._token===null?i:`${i}?token=${encodeURIComponent(this._token)}`}getContentURL(e){if(e.kind==="url")return null;const r=`${this.url}/artifacts/${encodeURIComponent(e.id)}/content/`;return this._token===null?r:`${r}?token=${encodeURIComponent(this._token)}`}async createScreen(e){const{screen:r}=await this.client.screens.create({name:e});return this.screens.set(r.id,structuredClone(r)),r}applyServerEvent(e){switch(e.type){case"screen-created":this.screens.set(e.screen.id,structuredClone(e.screen)),this.dispatchEvent(new Ca("screens-changed"));break;case"screen-updated":this.screens.set(e.screen.id,structuredClone(e.screen)),this.dispatchEvent(new Ca("screens-changed"));break;case"screen-removed":this.screens.delete(e.screenID),this.dispatchEvent(new Ca("screens-changed"));break;case"artifact-created":break;case"artifact-attached":{const r=this.screens.get(e.screenID);r&&!wv(r.layout,e.artifact.id)&&(r.layout=[...r.layout,bv(e.artifact.id,{id:e.cardID})]);break}case"artifact-removed":{const r=this.screens.get(e.screenID);r&&(r.layout=uv(r.layout,e.artifactID));break}case"artifact-updated":case"artifact-content-changed":case"screen-changed":case"theme-changed":case"artifact-focus":break;default:return r2(e,"server event")}}async attempt(){var i;this.attempting=!0,this.nextRetryAt=null,this.connectAttempt+=1;const e=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this._token),this.setStatus("disconnected"),this.dispatchEvent(new ae("change"));const r=this.createSocket(i2(this.url,this._token));return this.socket=r,await new Promise((s,o)=>{let a=!1;const c=()=>{a||this.connectAttempt!==e||(a=!0,this.retryDelay=ma,this.hasEverConnected=!0,this.setStatus("connected"),s())},u=p=>{a||this.connectAttempt!==e||(a=!0,o(p))},h=async()=>{try{const[{screens:p},v,g]=await Promise.all([this.client.screens.list(),this.client.views.list(),this.client.display.get()]);this.screens=new Map(p.map(_=>[_.id,structuredClone(_)])),this.views=v,this.acpClient.setEnabled(g.acpEnabled),this.dispatchEvent(new ae("change")),this.dispatchEvent(new Su("server-event",{serverURL:this.url,event:{type:"screen-changed",screenID:g.activeScreenID}})),c()}catch(p){if(a2(p)){u(new Ds);return}u(p instanceof Error?p:new Error(String(p)))}};r.addEventListener("open",()=>{h()}),r.addEventListener("message",p=>{const v=o2(p);v&&(this.applyServerEvent(v),this.dispatchEvent(new Su("server-event",{serverURL:this.url,event:v})))}),r.addEventListener("close",p=>{if(this.connectAttempt!==e)return;this.socket=null;const v=s2(p);if(!a){u(v===ag?new Ds:new Error("Connection closed before initialization"));return}if(v===ag){this.autoReconnect=!1,this.cancelRetryTimer(),this.setStatus("unauthorized");return}this.handleTransportFailure(new Error("Connection closed"))}),r.addEventListener("error",()=>{if(this.connectAttempt===e){if(a){this.handleTransportFailure(new Error("WebSocket error"));return}u(new Error("WebSocket connection failed"))}})}).then(()=>{this.attempting=!1},s=>{throw this.attempting=!1,this.handleAttemptFailure(s),s})}handleAttemptFailure(e){if(e instanceof Ds){this.autoReconnect=!1,this.cancelRetryTimer(),this.setStatus("unauthorized");return}this.autoReconnect&&this.scheduleRetry()}handleTransportFailure(e){this.autoReconnect&&(this.setStatus("disconnected"),this.scheduleRetry())}scheduleRetry(){this.cancelRetryTimer(),this.connectAttempt+=1;const e=this.retryDelay;this.retryDelay=Math.min(this.retryDelay*2,n2),this.nextRetryAt=Date.now()+e,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.attempt().catch(()=>{})},e),this.dispatchEvent(new ae("change"))}cancelRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.nextRetryAt!==null&&(this.nextRetryAt=null,this.dispatchEvent(new ae("change")))}kickReconnect(){this.autoReconnect&&this.status!=="connected"&&(this.attempting||(this.cancelRetryTimer(),this.retryDelay=ma,this.attempt().catch(()=>{})))}setStatus(e){this.status!==e&&(this.status=e,this.dispatchEvent(new ae("change")))}isPageVisible(){return this.visibilityEventTarget===null?!0:this.visibilityEventTarget.visibilityState==="visible"}}function r2(n,t){throw new Error(`Unexpected ${t}: ${JSON.stringify(n)}`)}function i2(n,t){const e=new URL(n);return e.protocol=e.protocol==="https:"?"wss:":"ws:",e.pathname="/events",e.search="",t&&e.searchParams.set("token",t),e.hash="",e.toString()}function s2(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}function o2(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;try{return JSON.parse(t)}catch{return null}}function a2(n){return n instanceof kv&&n.status===t2}const l2="Local";var no,zu;class c2 extends Jt{constructor(e){super();w(this,no);m(this,"servers",new Map);m(this,"localServerURL");m(this,"clientGUID");m(this,"acpStorage");m(this,"localStore");m(this,"createSocket");m(this,"lastActiveServerURL");m(this,"serverListeners",new Map);m(this,"handleLocalStoreChange",()=>{const e=this.localStore.get().activeServerURL;e!==this.lastActiveServerURL&&(this.lastActiveServerURL=e,this.dispatchEvent(new ae("change")))});this.localStore=e.localStore,this.localServerURL=e.localServerURL?be(e.localServerURL):null,this.createSocket=e.createSocket??(i=>new WebSocket(i)),this.lastActiveServerURL=this.localStore.get().activeServerURL;const r=e.acpStorage===void 0?QL():e.acpStorage;this.acpStorage=r,this.clientGUID=e.clientGUID??(r?e2(r):Ul().toLowerCase()),this.localStore.addEventListener("change",this.handleLocalStoreChange)}get activeServer(){const e=this.localStore.get().activeServerURL;return e===null?null:this.servers.get(e)??null}add(e){const r=be(e.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,e);const s=()=>{this.dispatchEvent(new ae("change"))},o=c=>{this.dispatchEvent(new Su("server-event",{serverURL:c.serverURL,event:c.event}))},a=()=>{this.dispatchEvent(new Ca("screens-changed"))};e.addEventListener("change",s),e.addEventListener("server-event",o),e.addEventListener("screens-changed",a),this.serverListeners.set(r,{onServerChange:s,onServerEvent:o,onScreensChanged:a}),this.dispatchEvent(new ae("change"))}remove(e){const r=be(e);if(this.localServerURL&&r===this.localServerURL)return;const i=this.servers.get(r);if(!i)return;const s=this.serverListeners.get(r);s&&(i.removeEventListener("change",s.onServerChange),i.removeEventListener("server-event",s.onServerEvent),i.removeEventListener("screens-changed",s.onScreensChanged),this.serverListeners.delete(r)),i.dispose(),this.servers.delete(r);const o=this.localStore.get(),a=o.activeServerURL===r;this.localStore.set({...o,servers:o.servers.filter(c=>c.url!==r),activeServerURL:a?null:o.activeServerURL}),this.dispatchEvent(new ae("change"))}setActive(e){const r=this.localStore.get(),i=e?be(e.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(e,r){const i=e?be(e):null;if(i){const a=this.localStore.get();a.servers.some(u=>be(u.url)===i)||this.localStore.set({...a,servers:[...a.servers,{url:i,name:l2}]})}const s=this.localStore.get().servers;for(const a of s){const c=be(a.url),h=i!==null&&c===i?r??null:null,p=f(this,no,zu).call(this,{url:a.url,name:a.name,token:h});this.add(p),p.connect(h).catch(()=>{})}const o=i?this.servers.get(i)??null:null;this.setActive(o??this.servers.values().next().value??null)}addServer(e,r){const i=be(e);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>be(a.url)!==i),{url:i,name:r}]});const o=f(this,no,zu).call(this,{url:i,name:r,token:null});this.add(o),this.setActive(o),o.connect(null).catch(()=>{})}removeServer(e){this.remove(e)}}no=new WeakSet,zu=function(e){return new ub({url:e.url,name:e.name,token:e.token,createSocket:this.createSocket,clientGUID:this.clientGUID,acpStorage:this.acpStorage})};var ro;class u2 extends Jt{constructor(){super();w(this,ro,e=>{const r=h2(e);r!==null&&(e.preventDefault(),this.dispatchEvent(new FA("shortcut-triggered",{shortcut:r})))});document.addEventListener("keydown",l(this,ro))}dispose(){document.removeEventListener("keydown",l(this,ro))}}ro=new WeakMap;function h2(n){for(const[t,e]of Object.entries(b1))if(d2(n,e.trigger))return t;return null}function d2(n,t){return!(n.key.toLowerCase()!==t.key.toLowerCase()||n.metaKey!==!!t.meta||n.ctrlKey!==!!t.ctrl||n.shiftKey!==!!t.shift||n.altKey!==!!t.alt)}const p2="serverURL",f2="token",g2="mode",m2="electron";function hb(n=window.location.search,t=window.location.origin){const r=new URLSearchParams(n).get(p2);return r?new URL(r).origin:new URL(t).origin}function lg(n=window.location.search){return new URLSearchParams(n).get(f2)}function cd(n=window.location.search){return new URLSearchParams(n).get(g2)===m2}let xn=null;async function db(n,t){if(xn==null||xn.abort(),n===null){xn=null,el();return}const e=new AbortController;xn=e;try{const r=t.token?{Authorization:`Bearer ${t.token}`}:void 0,i=new URL(`/themes/${n}/theme.css`,t.url).toString(),s=await fetch(i,{signal:e.signal,...r?{headers:r}:{}});if(!s.ok)throw new Error(`Theme fetch failed: ${s.status}`);const o=await s.text();if(xn!==e)return;ov(o)}catch(r){if(r.name==="AbortError")return;el();const i=r instanceof Error?r.message:String(r);console.warn(`applyTheme: ${i}`)}finally{xn===e&&(xn=null)}}/**
42
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of n.seen.entries()){const p=h[1];if(t===h[0]){s(h);continue}if(n.external){const g=(c=n.external.registry.get(h[0]))==null?void 0:c.id;if(t!==h[0]&&g){s(h);continue}}if((u=n.metadataRegistry.get(h[0]))==null?void 0:u.id){s(h);continue}if(p.cycle){s(h);continue}if(p.count>1&&n.reused==="ref"){s(h);continue}}}function oy(n,t){var o,a,c;const e=n.seen.get(t);if(!e)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=u=>{const h=n.seen.get(u);if(h.ref===null)return;const p=h.def??h.schema,v={...p},g=h.ref;if(h.ref=null,g){r(g);const k=n.seen.get(g),I=k.schema;if(I.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(I)):Object.assign(p,I),Object.assign(p,v),u._zod.parent===g)for(const R in p)R==="$ref"||R==="allOf"||R in v||delete p[R];if(I.$ref&&k.def)for(const R in p)R==="$ref"||R==="allOf"||R in k.def&&JSON.stringify(p[R])===JSON.stringify(k.def[R])&&delete p[R]}const _=u._zod.parent;if(_&&_!==g){r(_);const k=n.seen.get(_);if(k!=null&&k.schema.$ref&&(p.$ref=k.schema.$ref,k.def))for(const I in p)I==="$ref"||I==="allOf"||I in k.def&&JSON.stringify(p[I])===JSON.stringify(k.def[I])&&delete p[I]}n.override({zodSchema:u,jsonSchema:p,path:h.path??[]})};for(const u of[...n.seen.entries()].reverse())r(u[0]);const i={};if(n.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":n.target,(o=n.external)!=null&&o.uri){const u=(a=n.external.registry.get(t))==null?void 0:a.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 h=u[1];h.def&&h.defId&&(s[h.defId]=h.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:cl(t,"input",n.processors),output:cl(t,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Ze(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 Ze(r.element,e);if(r.type==="set")return Ze(r.valueType,e);if(r.type==="lazy")return Ze(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 Ze(r.innerType,e);if(r.type==="intersection")return Ze(r.left,e)||Ze(r.right,e);if(r.type==="record"||r.type==="map")return Ze(r.keyType,e)||Ze(r.valueType,e);if(r.type==="pipe")return Ze(r.in,e)||Ze(r.out,e);if(r.type==="object"){for(const i in r.shape)if(Ze(r.shape[i],e))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Ze(i,e))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Ze(i,e))return!0;return!!(r.rest&&Ze(r.rest,e))}return!1}const CI=(n,t={})=>e=>{const r=iy({...e,processors:t});return Se(n,r),sy(r,n),oy(r,n)},cl=(n,t,e={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=iy({...i??{},target:s,io:t,processors:e});return Se(n,o),sy(o,n),oy(o,n)},RI={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},PI=(n,t,e,r)=>{const i=e;i.type="string";const{minimum:s,maximum:o,format:a,patterns:c,contentEncoding:u}=n._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=RI[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){const h=[...c];h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},DI=(n,t,e,r)=>{const i=e,{minimum:s,maximum:o,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:h}=n._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h),typeof s=="number"&&(i.minimum=s,typeof h=="number"&&t.target!=="draft-04"&&(h>=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 o=="number"&&(i.maximum=o,typeof u=="number"&&t.target!=="draft-04"&&(u<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},LI=(n,t,e,r)=>{e.type="boolean"},zI=(n,t,e,r)=>{e.not={}},OI=(n,t,e,r)=>{},MI=(n,t,e,r)=>{const i=n._zod.def,s=Nv(i.entries);s.every(o=>typeof o=="number")&&(e.type="number"),s.every(o=>typeof o=="string")&&(e.type="string"),e.enum=s},NI=(n,t,e,r)=>{const i=n._zod.def,s=[];for(const o of i.values)if(o===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){const o=s[0];e.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0"?e.enum=[o]:e.const=o}else s.every(o=>typeof o=="number")&&(e.type="number"),s.every(o=>typeof o=="string")&&(e.type="string"),s.every(o=>typeof o=="boolean")&&(e.type="boolean"),s.every(o=>o===null)&&(e.type="null"),e.enum=s},UI=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},FI=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},HI=(n,t,e,r)=>{const i=e,s=n._zod.def,{minimum:o,maximum:a}=n._zod.bag;typeof o=="number"&&(i.minItems=o),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=Se(s.element,t,{...r,path:[...r.path,"items"]})},ZI=(n,t,e,r)=>{var u;const i=e,s=n._zod.def;i.type="object",i.properties={};const o=s.shape;for(const h in o)i.properties[h]=Se(o[h],t,{...r,path:[...r.path,"properties",h]});const a=new Set(Object.keys(o)),c=new Set([...a].filter(h=>{const p=s.shape[h]._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=Se(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},WI=(n,t,e,r)=>{const i=n._zod.def,s=i.inclusive===!1,o=i.options.map((a,c)=>Se(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?e.oneOf=o:e.anyOf=o},VI=(n,t,e,r)=>{const i=n._zod.def,s=Se(i.left,t,{...r,path:[...r.path,"allOf",0]}),o=Se(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];e.allOf=c},BI=(n,t,e,r)=>{const i=e,s=n._zod.def;i.type="object";const o=s.keyType,a=o._zod.bag,c=a==null?void 0:a.patterns;if(s.mode==="loose"&&c&&c.size>0){const h=Se(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const p of c)i.patternProperties[p.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=Se(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=Se(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=o._zod.values;if(u){const h=[...u].filter(p=>typeof p=="string"||typeof p=="number");h.length>0&&(i.required=h)}},jI=(n,t,e,r)=>{const i=n._zod.def,s=Se(i.innerType,t,r),o=t.seen.get(n);t.target==="openapi-3.0"?(o.ref=i.innerType,e.nullable=!0):e.anyOf=[s,{type:"null"}]},GI=(n,t,e,r)=>{const i=n._zod.def;Se(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},qI=(n,t,e,r)=>{const i=n._zod.def;Se(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.default=JSON.parse(JSON.stringify(i.defaultValue))},YI=(n,t,e,r)=>{const i=n._zod.def;Se(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)))},XI=(n,t,e,r)=>{const i=n._zod.def;Se(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}e.default=o},KI=(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;Se(s,t,r);const o=t.seen.get(n);o.ref=s},JI=(n,t,e,r)=>{const i=n._zod.def;Se(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.readOnly=!0},ay=(n,t,e,r)=>{const i=n._zod.def;Se(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},QI=A("ZodISODateTime",(n,t)=>{eT.init(n,t),me.init(n,t)});function eC(n){return oI(QI,n)}const tC=A("ZodISODate",(n,t)=>{tT.init(n,t),me.init(n,t)});function nC(n){return aI(tC,n)}const rC=A("ZodISOTime",(n,t)=>{nT.init(n,t),me.init(n,t)});function iC(n){return lI(rC,n)}const sC=A("ZodISODuration",(n,t)=>{rT.init(n,t),me.init(n,t)});function oC(n){return cI(sC,n)}const ly=(n,t)=>{Zv.init(n,t),n.name="ZodError",Object.defineProperties(n,{format:{value:e=>G1(n,e)},flatten:{value:e=>j1(n,e)},addIssue:{value:e=>{n.issues.push(e),n.message=JSON.stringify(n.issues,Pu,2)}},addIssues:{value:e=>{n.issues.push(...e),n.message=JSON.stringify(n.issues,Pu,2)}},isEmpty:{get(){return n.issues.length===0}}})},rg=A("ZodError",ly),bt=A("ZodError",ly,{Parent:Error}),aC=dd(bt),lC=pd(bt),cC=Wl(bt),uC=Vl(bt),hC=X1(bt),dC=K1(bt),pC=J1(bt),fC=Q1(bt),gC=e$(bt),mC=t$(bt),vC=n$(bt),yC=r$(bt),ge=A("ZodType",(n,t)=>(fe.init(n,t),Object.assign(n["~standard"],{jsonSchema:{input:cl(n,"input"),output:cl(n,"output")}}),n.toJSONSchema=CI(n,{}),n.def=t,n.type=t.type,Object.defineProperty(n,"_def",{value:t}),n.check=(...e)=>n.clone(Kn(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)=>Jn(n,e,r),n.brand=()=>n,n.register=(e,r)=>(e.add(n,r),n),n.parse=(e,r)=>aC(n,e,r,{callee:n.parse}),n.safeParse=(e,r)=>cC(n,e,r),n.parseAsync=async(e,r)=>lC(n,e,r,{callee:n.parseAsync}),n.safeParseAsync=async(e,r)=>uC(n,e,r),n.spa=n.safeParseAsync,n.encode=(e,r)=>hC(n,e,r),n.decode=(e,r)=>dC(n,e,r),n.encodeAsync=async(e,r)=>pC(n,e,r),n.decodeAsync=async(e,r)=>fC(n,e,r),n.safeEncode=(e,r)=>gC(n,e,r),n.safeDecode=(e,r)=>mC(n,e,r),n.safeEncodeAsync=async(e,r)=>vC(n,e,r),n.safeDecodeAsync=async(e,r)=>yC(n,e,r),n.refine=(e,r)=>n.check(cR(e,r)),n.superRefine=e=>n.check(uR(e)),n.overwrite=e=>n.check(rs(e)),n.optional=()=>og(n),n.exactOptional=()=>XC(n),n.nullable=()=>ag(n),n.nullish=()=>og(ag(n)),n.nonoptional=e=>nR(n,e),n.array=()=>L(n),n.or=e=>B([n,e]),n.and=e=>jl(n,e),n.transform=e=>lg(n,qC(e)),n.default=e=>QC(n,e),n.prefault=e=>tR(n,e),n.catch=e=>iR(n,e),n.pipe=e=>lg(n,e),n.readonly=()=>aR(n),n.describe=e=>{const r=n.clone();return ks.add(r,{description:e}),r},Object.defineProperty(n,"description",{get(){var e;return(e=ks.get(n))==null?void 0:e.description},configurable:!0}),n.meta=(...e)=>{if(e.length===0)return ks.get(n);const r=n.clone();return ks.add(r,e[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=e=>e(n),n)),cy=A("_ZodString",(n,t)=>{fd.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(r,i,s)=>PI(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(gI(...r)),n.includes=(...r)=>n.check(yI(...r)),n.startsWith=(...r)=>n.check(bI(...r)),n.endsWith=(...r)=>n.check(wI(...r)),n.min=(...r)=>n.check(ll(...r)),n.max=(...r)=>n.check(ny(...r)),n.length=(...r)=>n.check(ry(...r)),n.nonempty=(...r)=>n.check(ll(1,...r)),n.lowercase=r=>n.check(mI(r)),n.uppercase=r=>n.check(vI(r)),n.trim=()=>n.check(_I()),n.normalize=(...r)=>n.check(SI(...r)),n.toLowerCase=()=>n.check(kI()),n.toUpperCase=()=>n.check(xI()),n.slugify=()=>n.check(EI())}),bC=A("ZodString",(n,t)=>{fd.init(n,t),cy.init(n,t),n.email=e=>n.check(UT(wC,e)),n.url=e=>n.check(VT(SC,e)),n.jwt=e=>n.check(sI(OC,e)),n.emoji=e=>n.check(BT(_C,e)),n.guid=e=>n.check(Qf(ig,e)),n.uuid=e=>n.check(FT(ma,e)),n.uuidv4=e=>n.check(HT(ma,e)),n.uuidv6=e=>n.check(ZT(ma,e)),n.uuidv7=e=>n.check(WT(ma,e)),n.nanoid=e=>n.check(jT(kC,e)),n.guid=e=>n.check(Qf(ig,e)),n.cuid=e=>n.check(GT(xC,e)),n.cuid2=e=>n.check(qT(EC,e)),n.ulid=e=>n.check(YT(AC,e)),n.base64=e=>n.check(nI(DC,e)),n.base64url=e=>n.check(rI(LC,e)),n.xid=e=>n.check(XT($C,e)),n.ksuid=e=>n.check(KT(TC,e)),n.ipv4=e=>n.check(JT(IC,e)),n.ipv6=e=>n.check(QT(CC,e)),n.cidrv4=e=>n.check(eI(RC,e)),n.cidrv6=e=>n.check(tI(PC,e)),n.e164=e=>n.check(iI(zC,e)),n.datetime=e=>n.check(eC(e)),n.date=e=>n.check(nC(e)),n.time=e=>n.check(iC(e)),n.duration=e=>n.check(oC(e))});function d(n){return NT(bC,n)}const me=A("ZodStringFormat",(n,t)=>{he.init(n,t),cy.init(n,t)}),wC=A("ZodEmail",(n,t)=>{B$.init(n,t),me.init(n,t)}),ig=A("ZodGUID",(n,t)=>{W$.init(n,t),me.init(n,t)}),ma=A("ZodUUID",(n,t)=>{V$.init(n,t),me.init(n,t)}),SC=A("ZodURL",(n,t)=>{j$.init(n,t),me.init(n,t)}),_C=A("ZodEmoji",(n,t)=>{G$.init(n,t),me.init(n,t)}),kC=A("ZodNanoID",(n,t)=>{q$.init(n,t),me.init(n,t)}),xC=A("ZodCUID",(n,t)=>{Y$.init(n,t),me.init(n,t)}),EC=A("ZodCUID2",(n,t)=>{X$.init(n,t),me.init(n,t)}),AC=A("ZodULID",(n,t)=>{K$.init(n,t),me.init(n,t)}),$C=A("ZodXID",(n,t)=>{J$.init(n,t),me.init(n,t)}),TC=A("ZodKSUID",(n,t)=>{Q$.init(n,t),me.init(n,t)}),IC=A("ZodIPv4",(n,t)=>{iT.init(n,t),me.init(n,t)}),CC=A("ZodIPv6",(n,t)=>{sT.init(n,t),me.init(n,t)}),RC=A("ZodCIDRv4",(n,t)=>{oT.init(n,t),me.init(n,t)}),PC=A("ZodCIDRv6",(n,t)=>{aT.init(n,t),me.init(n,t)}),DC=A("ZodBase64",(n,t)=>{lT.init(n,t),me.init(n,t)}),LC=A("ZodBase64URL",(n,t)=>{uT.init(n,t),me.init(n,t)}),zC=A("ZodE164",(n,t)=>{hT.init(n,t),me.init(n,t)}),OC=A("ZodJWT",(n,t)=>{pT.init(n,t),me.init(n,t)}),uy=A("ZodNumber",(n,t)=>{Jv.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(r,i,s)=>DI(n,r,i),n.gt=(r,i)=>n.check(tg(r,i)),n.gte=(r,i)=>n.check(qc(r,i)),n.min=(r,i)=>n.check(qc(r,i)),n.lt=(r,i)=>n.check(eg(r,i)),n.lte=(r,i)=>n.check(Gc(r,i)),n.max=(r,i)=>n.check(Gc(r,i)),n.int=r=>n.check(sg(r)),n.safe=r=>n.check(sg(r)),n.positive=r=>n.check(tg(0,r)),n.nonnegative=r=>n.check(qc(0,r)),n.negative=r=>n.check(eg(0,r)),n.nonpositive=r=>n.check(Gc(0,r)),n.multipleOf=(r,i)=>n.check(ng(r,i)),n.step=(r,i)=>n.check(ng(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 H(n){return uI(uy,n)}const MC=A("ZodNumberFormat",(n,t)=>{fT.init(n,t),uy.init(n,t)});function sg(n){return hI(MC,n)}const NC=A("ZodBoolean",(n,t)=>{gT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>LI(n,e,r)});function Ie(n){return dI(NC,n)}const UC=A("ZodUnknown",(n,t)=>{mT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>OI()});function x(){return pI(UC)}const FC=A("ZodNever",(n,t)=>{vT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>zI(n,e,r)});function HC(n){return fI(FC,n)}const ZC=A("ZodArray",(n,t)=>{yT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>HI(n,e,r,i),n.element=t.element,n.min=(e,r)=>n.check(ll(e,r)),n.nonempty=e=>n.check(ll(1,e)),n.max=(e,r)=>n.check(ny(e,r)),n.length=(e,r)=>n.check(ry(e,r)),n.unwrap=()=>n.element});function L(n,t){return AI(ZC,n,t)}const hy=A("ZodObject",(n,t)=>{wT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>ZI(n,e,r,i),ne(n,"shape",()=>t.shape),n.keyof=()=>Hs(Object.keys(n._zod.def.shape)),n.catchall=e=>n.clone({...n._zod.def,catchall:e}),n.passthrough=()=>n.clone({...n._zod.def,catchall:x()}),n.loose=()=>n.clone({...n._zod.def,catchall:x()}),n.strict=()=>n.clone({...n._zod.def,catchall:HC()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=e=>H1(n,e),n.safeExtend=e=>Z1(n,e),n.merge=e=>W1(n,e),n.pick=e=>U1(n,e),n.omit=e=>F1(n,e),n.partial=(...e)=>V1(py,n,e[0]),n.required=(...e)=>B1(fy,n,e[0])});function dy(n,t){const e={type:"object",shape:n??{},...M(t)};return new hy(e)}function y(n,t){return new hy({type:"object",shape:n,catchall:x(),...M(t)})}const WC=A("ZodUnion",(n,t)=>{ST.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>WI(n,e,r,i),n.options=t.options});function B(n,t){return new WC({type:"union",options:n,...M(t)})}const VC=A("ZodIntersection",(n,t)=>{_T.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>VI(n,e,r,i)});function jl(n,t){return new VC({type:"intersection",left:n,right:t})}const BC=A("ZodRecord",(n,t)=>{kT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>BI(n,e,r,i),n.keyType=t.keyType,n.valueType=t.valueType});function E(n,t,e){return new BC({type:"record",keyType:n,valueType:t,...M(e)})}const Lu=A("ZodEnum",(n,t)=>{xT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(r,i,s)=>MI(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 o of r)if(e.has(o))s[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Lu({...t,checks:[],...M(i),entries:s})},n.exclude=(r,i)=>{const s={...t.entries};for(const o of r)if(e.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new Lu({...t,checks:[],...M(i),entries:s})}});function Hs(n,t){const e=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new Lu({type:"enum",entries:e,...M(t)})}const jC=A("ZodLiteral",(n,t)=>{ET.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>NI(n,e,r),n.values=new Set(t.values),Object.defineProperty(n,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function $(n,t){return new jC({type:"literal",values:Array.isArray(n)?n:[n],...M(t)})}const GC=A("ZodTransform",(n,t)=>{AT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>FI(n,e),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new Ov(n.constructor.name);e.addIssue=s=>{if(typeof s=="string")e.issues.push(Fs(s,e.value,t));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=e.value),o.inst??(o.inst=n),e.issues.push(Fs(o))}};const i=t.transform(e.value,e);return i instanceof Promise?i.then(s=>(e.value=s,e)):(e.value=i,e)}});function qC(n){return new GC({type:"transform",transform:n})}const py=A("ZodOptional",(n,t)=>{ty.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>ay(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function og(n){return new py({type:"optional",innerType:n})}const YC=A("ZodExactOptional",(n,t)=>{$T.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>ay(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function XC(n){return new YC({type:"optional",innerType:n})}const KC=A("ZodNullable",(n,t)=>{TT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>jI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function ag(n){return new KC({type:"nullable",innerType:n})}const JC=A("ZodDefault",(n,t)=>{IT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>qI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function QC(n,t){return new JC({type:"default",innerType:n,get defaultValue(){return typeof t=="function"?t():Fv(t)}})}const eR=A("ZodPrefault",(n,t)=>{CT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>YI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function tR(n,t){return new eR({type:"prefault",innerType:n,get defaultValue(){return typeof t=="function"?t():Fv(t)}})}const fy=A("ZodNonOptional",(n,t)=>{RT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>GI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function nR(n,t){return new fy({type:"nonoptional",innerType:n,...M(t)})}const rR=A("ZodCatch",(n,t)=>{PT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>XI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function iR(n,t){return new rR({type:"catch",innerType:n,catchValue:typeof t=="function"?t:()=>t})}const sR=A("ZodPipe",(n,t)=>{DT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>KI(n,e,r,i),n.in=t.in,n.out=t.out});function lg(n,t){return new sR({type:"pipe",in:n,out:t})}const oR=A("ZodReadonly",(n,t)=>{LT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>JI(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function aR(n){return new oR({type:"readonly",innerType:n})}const lR=A("ZodCustom",(n,t)=>{zT.init(n,t),ge.init(n,t),n._zod.processJSONSchema=(e,r,i)=>UI(n,e)});function cR(n,t={}){return $I(lR,n,t)}function uR(n){return TI(n)}const ln={custom:"custom"},gy=["markdown","web-bundle","url"],hR=["committed","pending"];function dR(n){let t;try{t=new URL(n)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"}dy({id:d().min(1),kind:Hs(gy),title:d(),status:Hs(hR),externalFilePath:d().optional(),externalURL:d().optional()}).superRefine((n,t)=>{switch(n.externalFilePath!==void 0&&n.externalURL!==void 0&&t.addIssue({code:ln.custom,message:"externalFilePath and externalURL are mutually exclusive",path:["externalURL"]}),n.kind!=="web-bundle"&&n.status!=="committed"&&t.addIssue({code:ln.custom,message:"only web-bundle artifacts can be pending",path:["status"]}),n.kind){case"markdown":n.externalFilePath===void 0&&t.addIssue({code:ln.custom,message:"markdown artifacts require externalFilePath",path:["externalFilePath"]}),n.externalURL!==void 0&&t.addIssue({code:ln.custom,message:"markdown artifacts cannot set externalURL",path:["externalURL"]});break;case"web-bundle":n.externalFilePath!==void 0&&t.addIssue({code:ln.custom,message:"web-bundle artifacts cannot set externalFilePath",path:["externalFilePath"]}),n.externalURL!==void 0&&t.addIssue({code:ln.custom,message:"web-bundle artifacts cannot set externalURL",path:["externalURL"]});break;case"url":if(n.externalURL===void 0){t.addIssue({code:ln.custom,message:"url artifacts require externalURL",path:["externalURL"]});break}n.externalFilePath!==void 0&&t.addIssue({code:ln.custom,message:"url artifacts cannot set externalFilePath",path:["externalFilePath"]}),dR(n.externalURL)||t.addIssue({code:ln.custom,message:"externalURL must be an http(s) URL",path:["externalURL"]});break}});dy({name:d().min(1),description:d(),accepts:L(Hs(gy)).min(1)});function my(n){return typeof n=="object"&&n!==null}function pR(n){return!my(n)||n.type!=="ready"?!1:!("id"in n)}function fR(n){return!(!my(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}function gR(n,t){return t.find(e=>e.accepts.includes(n))??null}const ue={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"},cn={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"},mR=1,vR=y({_meta:E(d(),x()).nullish(),terminal:Ie().optional().default(!1)}),yR=y({_meta:E(d(),x()).nullish(),label:d().nullish(),name:d(),optional:Ie().optional().default(!1),secret:Ie().optional().default(!0)}),bR=y({_meta:E(d(),x()).nullish(),description:d().nullish(),id:d(),name:d()}),wR=y({_meta:E(d(),x()).nullish(),description:d().nullish(),id:d(),link:d().nullish(),name:d(),vars:L(yR)}),SR=y({_meta:E(d(),x()).nullish(),args:L(d()).optional(),description:d().nullish(),env:E(d(),d()).optional(),id:d(),name:d()}),_R=B([wR.and(y({type:$("env_var")})),SR.and(y({type:$("terminal")})),bR]),kR=y({_meta:E(d(),x()).nullish(),methodId:d()}),xR=y({_meta:E(d(),x()).nullish()}),ER=y({_meta:E(d(),x()).nullish(),blob:d(),mimeType:d().nullish(),uri:d()}),AR=y({default:Ie().nullish(),description:d().nullish(),title:d().nullish()}),$R=y({_meta:E(d(),x()).nullish()}),TR=y({_meta:E(d(),x()).nullish()}),IR=y({amount:H(),currency:d()}),CR=y({_meta:E(d(),x()).nullish(),terminalId:d()}),RR=y({_meta:E(d(),x()).nullish(),newText:d(),oldText:d().nullish(),path:d()}),PR=B([d(),H(),H(),Ie(),L(d())]),DR=y({content:E(d(),PR).nullish()}),LR=B([DR.and(y({action:$("accept")})),y({action:$("decline")}),y({action:$("cancel")})]),zR=y({_meta:E(d(),x()).nullish()}),vy=d(),OR=y({_meta:E(d(),x()).nullish(),elicitationId:vy}),MR=y({_meta:E(d(),x()).nullish(),action:LR}),NR=$("object"),UR=$("string"),FR=y({_meta:E(d(),x()).nullish()}),HR=y({_meta:E(d(),x()).nullish(),form:zR.nullish(),url:FR.nullish()}),ZR=y({elicitationId:vy,url:d().url()}),yy=y({const:d(),title:d()}),by=y({_meta:E(d(),x()).nullish(),name:d(),value:d()}),WR=B([$(-32700),$(-32600),$(-32601),$(-32602),$(-32603),$(-32800),$(-32e3),$(-32002),$(-32042),H().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),wy=y({code:WR,data:x().optional(),message:d()}),Sy=x(),_y=x(),ky=x(),VR=y({_meta:E(d(),x()).nullish(),readTextFile:Ie().optional().default(!1),writeTextFile:Ie().optional().default(!1)}),xy=y({_meta:E(d(),x()).nullish(),name:d(),value:d()}),Ey=y({_meta:E(d(),x()).nullish(),name:d(),title:d().nullish(),version:d()}),BR=y({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),jR=y({_meta:E(d(),x()).nullish()}),GR=y({_meta:E(d(),x()).nullish(),additionalDirectories:L(d()).optional(),cursor:d().nullish(),cwd:d().nullish()}),qR=y({_meta:E(d(),x()).nullish()}),YR=y({_meta:E(d(),x()).nullish(),logout:qR.nullish()}),XR=y({_meta:E(d(),x()).nullish()}),KR=y({_meta:E(d(),x()).nullish()}),JR=y({_meta:E(d(),x()).nullish(),http:Ie().optional().default(!1),sse:Ie().optional().default(!1)}),QR=y({_meta:E(d(),x()).nullish(),headers:L(xy),name:d(),url:d()}),eP=y({_meta:E(d(),x()).nullish(),headers:L(xy),name:d(),url:d()}),tP=y({_meta:E(d(),x()).nullish(),args:L(d()),command:d(),env:L(by),name:d()}),Gl=B([QR.and(y({type:$("http")})),eP.and(y({type:$("sse")})),tP]),gd=d(),nP=y({_meta:E(d(),x()).nullish(),description:d().nullish(),modelId:gd,name:d()}),rP=B([$("error"),$("warning"),$("information"),$("hint")]),iP=y({_meta:E(d(),x()).nullish()}),sP=y({_meta:E(d(),x()).nullish()}),oP=y({_meta:E(d(),x()).nullish()}),aP=y({_meta:E(d(),x()).nullish()}),lP=y({_meta:E(d(),x()).nullish()}),cP=y({_meta:E(d(),x()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),uP=y({diff:d(),uri:d()}),hP=y({endLine:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:d()}),dP=y({_meta:E(d(),x()).nullish()}),pP=y({_meta:E(d(),x()).nullish()}),fP=y({languageId:d(),text:d(),uri:d()}),gP=y({_meta:E(d(),x()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),mP=B([$("rejected"),$("ignored"),$("replaced"),$("cancelled")]),vP=y({excerpts:L(hP),uri:d()}),yP=y({_meta:E(d(),x()).nullish()}),bP=y({_meta:E(d(),x()).nullish()}),wP=y({name:d(),owner:d(),remoteUrl:d()}),SP=y({_meta:E(d(),x()).nullish()}),_P=y({_meta:E(d(),x()).nullish(),jump:dP.nullish(),rename:bP.nullish(),searchAndReplace:SP.nullish()}),kP=y({id:d(),isRegex:Ie().nullish(),replace:d(),search:d(),uri:d()}),xP=B([$("automatic"),$("diagnostic"),$("manual")]),EP=y({_meta:E(d(),x()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),AP=y({_meta:E(d(),x()).nullish(),diagnostics:iP.nullish(),editHistory:cP.nullish(),openFiles:pP.nullish(),recentFiles:gP.nullish(),relatedSnippets:yP.nullish(),userActions:EP.nullish()}),$P=y({_meta:E(d(),x()).nullish(),additionalDirectories:L(d()).optional(),cwd:d(),mcpServers:L(Gl)}),TP=y({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),Ay=d(),IP=B([$("allow_once"),$("allow_always"),$("reject_once"),$("reject_always")]),CP=y({_meta:E(d(),x()).nullish(),kind:IP,name:d(),optionId:Ay}),RP=B([$("high"),$("medium"),$("low")]),PP=B([$("pending"),$("in_progress"),$("completed")]),DP=y({_meta:E(d(),x()).nullish(),content:d(),priority:RP,status:PP}),LP=y({_meta:E(d(),x()).nullish(),entries:L(DP)}),Gn=y({character:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),zP=y({id:d(),position:Gn,uri:d()}),OP=y({id:d(),newName:d(),position:Gn,uri:d()}),MP=y({action:d(),position:Gn,timestampMs:H(),uri:d()}),$y=B([$("utf-16"),$("utf-32"),$("utf-8")]),NP=y({_meta:E(d(),x()).nullish(),auth:vR.optional().default({terminal:!1}),elicitation:HR.nullish(),fs:VR.optional().default({readTextFile:!1,writeTextFile:!1}),nes:_P.nullish(),positionEncodings:L($y).optional(),terminal:Ie().optional().default(!1)}),UP=y({_meta:E(d(),x()).nullish(),audio:Ie().optional().default(!1),embeddedContext:Ie().optional().default(!1),image:Ie().optional().default(!1)}),Ty=H().int().gte(0).lte(65535),FP=y({_meta:E(d(),x()).nullish(),clientCapabilities:NP.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:Ey.nullish(),protocolVersion:Ty}),is=y({end:Gn,start:Gn}),HP=y({message:d(),range:is,severity:rP,uri:d()}),ZP=y({languageId:d(),lastFocusedMs:H().nullish(),uri:d(),visibleRange:is.nullish()}),WP=y({_meta:E(d(),x()).nullish(),diagnostics:L(HP).nullish(),editHistory:L(uP).nullish(),openFiles:L(ZP).nullish(),recentFiles:L(fP).nullish(),relatedSnippets:L(vP).nullish(),userActions:L(MP).nullish()}),VP=y({newText:d(),range:is}),BP=y({cursorPosition:Gn.nullish(),edits:L(VP),id:d(),uri:d()}),jP=B([BP.and(y({kind:$("edit")})),zP.and(y({kind:$("jump")})),OP.and(y({kind:$("rename")})),kP.and(y({kind:$("searchAndReplace")}))]),GP=y({_meta:E(d(),x()).nullish(),content:d()}),qP=y({_meta:E(d(),x()).nullish()}),Or=B([H(),d()]).nullable();y({_meta:E(d(),x()).nullish(),requestId:Or});const YP=Hs(["assistant","user"]),Go=y({_meta:E(d(),x()).nullish(),audience:L(YP).nullish(),lastModified:d().nullish(),priority:H().nullish()}),XP=y({_meta:E(d(),x()).nullish(),annotations:Go.nullish(),data:d(),mimeType:d()}),KP=y({_meta:E(d(),x()).nullish(),annotations:Go.nullish(),data:d(),mimeType:d(),uri:d().nullish()}),JP=y({_meta:E(d(),x()).nullish(),annotations:Go.nullish(),description:d().nullish(),mimeType:d().nullish(),name:d(),size:H().nullish(),title:d().nullish(),uri:d()}),QP=y({_meta:E(d(),x()).nullish(),optionId:Ay}),eD=B([y({outcome:$("cancelled")}),QP.and(y({outcome:$("selected")}))]),tD=y({_meta:E(d(),x()).nullish(),outcome:eD}),nD=y({_meta:E(d(),x()).nullish()}),rD=y({_meta:E(d(),x()).nullish()}),iD=y({currentValue:Ie()}),sD=d(),Iy=d(),oD=B([$("mode"),$("model"),$("thought_level"),d()]),md=d(),Cy=y({_meta:E(d(),x()).nullish(),description:d().nullish(),name:d(),value:md}),aD=y({_meta:E(d(),x()).nullish(),group:sD,name:d(),options:L(Cy)}),lD=B([L(Cy),L(aD)]),cD=y({currentValue:md,options:lD}),ss=jl(B([cD.and(y({type:$("select")})),iD.and(y({type:$("boolean")}))]),y({_meta:E(d(),x()).nullish(),category:oD.nullish(),description:d().nullish(),id:Iy,name:d()})),uD=y({_meta:E(d(),x()).nullish(),configOptions:L(ss)}),hD=y({_meta:E(d(),x()).nullish()}),Q=d(),dD=y({_meta:E(d(),x()).nullish(),id:d(),sessionId:Q}),pD=y({_meta:E(d(),x()).nullish(),sessionId:Q}),fD=y({_meta:E(d(),x()).nullish(),sessionId:Q}),gD=y({_meta:E(d(),x()).nullish(),sessionId:Q}),Ry=y({_meta:E(d(),x()).nullish(),args:L(d()).optional(),command:d(),cwd:d().nullish(),env:L(by).optional(),outputByteLimit:H().nullish(),sessionId:Q}),mD=y({_meta:E(d(),x()).nullish(),sessionId:Q,uri:d()}),vD=y({_meta:E(d(),x()).nullish(),position:Gn,sessionId:Q,uri:d(),version:H(),visibleRange:is}),yD=y({_meta:E(d(),x()).nullish(),languageId:d(),sessionId:Q,text:d(),uri:d(),version:H()}),bD=y({_meta:E(d(),x()).nullish(),sessionId:Q,uri:d()}),wD=y({_meta:E(d(),x()).nullish(),additionalDirectories:L(d()).optional(),cwd:d(),mcpServers:L(Gl).optional(),sessionId:Q}),Py=y({_meta:E(d(),x()).nullish(),sessionId:Q,terminalId:d()}),SD=y({_meta:E(d(),x()).nullish(),additionalDirectories:L(d()).optional(),cwd:d(),mcpServers:L(Gl),sessionId:Q}),Dy=y({_meta:E(d(),x()).nullish(),limit:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d(),sessionId:Q}),_D=y({_meta:E(d(),x()).nullish(),id:d(),reason:mP.nullish(),sessionId:Q}),Ly=y({_meta:E(d(),x()).nullish(),sessionId:Q,terminalId:d()}),kD=y({_meta:E(d(),x()).nullish(),additionalDirectories:L(d()).optional(),cwd:d(),mcpServers:L(Gl).optional(),sessionId:Q}),xD=y({_meta:E(d(),x()).nullish(),additionalDirectories:L(d()).optional(),cwd:d(),sessionId:Q,title:d().nullish(),updatedAt:d().nullish()}),ED=y({_meta:E(d(),x()).nullish(),nextCursor:d().nullish(),sessions:L(xD)}),AD=y({_meta:E(d(),x()).nullish(),title:d().nullish(),updatedAt:d().nullish()}),$D=y({_meta:E(d(),x()).nullish()}),ql=d(),TD=y({_meta:E(d(),x()).nullish(),currentModeId:ql}),ID=y({_meta:E(d(),x()).nullish(),description:d().nullish(),id:ql,name:d()}),Yl=y({_meta:E(d(),x()).nullish(),availableModes:L(ID),currentModeId:ql}),Xl=y({_meta:E(d(),x()).nullish(),availableModels:L(nP),currentModelId:gd}),CD=y({_meta:E(d(),x()).nullish(),configOptions:L(ss).nullish(),models:Xl.nullish(),modes:Yl.nullish(),sessionId:Q}),RD=y({_meta:E(d(),x()).nullish(),configOptions:L(ss).nullish(),models:Xl.nullish(),modes:Yl.nullish()}),PD=y({_meta:E(d(),x()).nullish(),configOptions:L(ss).nullish(),models:Xl.nullish(),modes:Yl.nullish(),sessionId:Q}),DD=y({_meta:E(d(),x()).nullish(),configOptions:L(ss).nullish(),models:Xl.nullish(),modes:Yl.nullish()}),LD=y({_meta:E(d(),x()).nullish()}),zD=y({_meta:E(d(),x()).nullish(),additionalDirectories:nD.nullish(),close:rD.nullish(),fork:hD.nullish(),list:$D.nullish(),resume:LD.nullish()}),OD=jl(B([y({type:$("boolean"),value:Ie()}),y({value:md})]),y({_meta:E(d(),x()).nullish(),configId:Iy,sessionId:Q})),MD=y({_meta:E(d(),x()).nullish(),configOptions:L(ss)}),ND=y({_meta:E(d(),x()).nullish(),modeId:ql,sessionId:Q}),UD=y({_meta:E(d(),x()).nullish()}),FD=y({_meta:E(d(),x()).nullish(),modelId:gd,sessionId:Q}),HD=y({_meta:E(d(),x()).nullish()}),ZD=y({_meta:E(d(),x()).nullish(),sessionId:Q}),WD=B([$("end_turn"),$("max_tokens"),$("max_turn_requests"),$("refusal"),$("cancelled")]),VD=B([$("email"),$("uri"),$("date"),$("date-time")]),BD=y({default:d().nullish(),description:d().nullish(),enum:L(d()).nullish(),format:VD.nullish(),maxLength:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:L(yy).nullish(),pattern:d().nullish(),title:d().nullish()}),jD=y({_meta:E(d(),x()).nullish(),context:WP.nullish(),position:Gn,selection:is.nullish(),sessionId:Q,triggerKind:xP,uri:d(),version:H()}),GD=y({_meta:E(d(),x()).nullish(),suggestions:L(jP)}),qD=y({_meta:E(d(),x()).nullish(),terminalId:d()}),YD=y({_meta:E(d(),x()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),zy=y({_meta:E(d(),x()).nullish(),sessionId:Q,terminalId:d()}),XD=y({_meta:E(d(),x()).nullish(),exitStatus:YD.nullish(),output:d(),truncated:Ie()}),KD=y({_meta:E(d(),x()).nullish(),annotations:Go.nullish(),text:d()}),JD=y({range:is.nullish(),text:d()}),QD=y({_meta:E(d(),x()).nullish(),contentChanges:L(JD),sessionId:Q,uri:d(),version:H()});y({method:d(),params:B([pD,yD,QD,mD,bD,vD,dD,_D,Sy]).nullish()});const eL=B([$("full"),$("incremental")]),tL=y({_meta:E(d(),x()).nullish(),syncKind:eL}),nL=y({_meta:E(d(),x()).nullish(),didChange:tL.nullish(),didClose:sP.nullish(),didFocus:oP.nullish(),didOpen:aP.nullish(),didSave:lP.nullish()}),rL=y({_meta:E(d(),x()).nullish(),document:nL.nullish()}),iL=y({_meta:E(d(),x()).nullish(),context:AP.nullish(),events:rL.nullish()}),sL=y({_meta:E(d(),x()).nullish(),auth:YR.optional().default({}),loadSession:Ie().optional().default(!1),mcpCapabilities:JR.optional().default({http:!1,sse:!1}),nes:iL.nullish(),positionEncoding:$y.nullish(),promptCapabilities:UP.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:zD.optional().default({})}),oL=y({_meta:E(d(),x()).nullish(),agentCapabilities:sL.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:Ey.nullish(),authMethods:L(_R).optional().default([]),protocolVersion:Ty}),aL=y({_meta:E(d(),x()).nullish(),mimeType:d().nullish(),text:d(),uri:d()}),lL=B([aL,ER]),cL=y({_meta:E(d(),x()).nullish(),annotations:Go.nullish(),resource:lL}),vd=B([KD.and(y({type:$("text")})),KP.and(y({type:$("image")})),XP.and(y({type:$("audio")})),JP.and(y({type:$("resource_link")})),cL.and(y({type:$("resource")}))]),uL=y({_meta:E(d(),x()).nullish(),content:vd}),Yc=y({_meta:E(d(),x()).nullish(),content:vd,messageId:d().nullish()}),hL=y({_meta:E(d(),x()).nullish(),messageId:d().nullish(),prompt:L(vd),sessionId:Q}),dL=y({anyOf:L(yy)}),Oy=B([uL.and(y({type:$("content")})),RR.and(y({type:$("diff")})),qD.and(y({type:$("terminal")}))]),My=d(),Ny=y({_meta:E(d(),x()).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d()}),Uy=B([$("pending"),$("in_progress"),$("completed"),$("failed")]),Fy=B([$("read"),$("edit"),$("delete"),$("move"),$("search"),$("execute"),$("think"),$("fetch"),$("switch_mode"),$("other")]),pL=y({_meta:E(d(),x()).nullish(),content:L(Oy).optional(),kind:Fy.optional(),locations:L(Ny).optional(),rawInput:x().optional(),rawOutput:x().optional(),status:Uy.optional(),title:d(),toolCallId:My}),Hy=y({_meta:E(d(),x()).nullish(),content:L(Oy).nullish(),kind:Fy.nullish(),locations:L(Ny).nullish(),rawInput:x().optional(),rawOutput:x().optional(),status:Uy.nullish(),title:d().nullish(),toolCallId:My}),Zy=y({_meta:E(d(),x()).nullish(),options:L(CP),sessionId:Q,toolCall:Hy}),fL=y({_meta:E(d(),x()).nullish(),hint:d()}),gL=fL,mL=y({_meta:E(d(),x()).nullish(),description:d(),input:gL.nullish(),name:d()}),vL=y({_meta:E(d(),x()).nullish(),availableCommands:L(mL)}),yL=y({enum:L(d()),type:UR}),bL=B([yL,dL]),wL=y({default:L(d()).nullish(),description:d().nullish(),items:bL,maxItems:H().nullish(),minItems:H().nullish(),title:d().nullish()}),SL=B([BD.and(y({type:$("string")})),TP.and(y({type:$("number")})),BR.and(y({type:$("integer")})),AR.and(y({type:$("boolean")})),wL.and(y({type:$("array")}))]),_L=y({description:d().nullish(),properties:E(d(),SL).optional().default({}),required:L(d()).nullish(),title:d().nullish(),type:NR.optional().default("object")}),kL=y({requestedSchema:_L}),xL=jl(B([kL.and(y({mode:$("form")})),ZR.and(y({mode:$("url")}))]),y({_meta:E(d(),x()).nullish(),message:d(),sessionId:Q})),EL=y({cachedReadTokens:H().nullish(),cachedWriteTokens:H().nullish(),inputTokens:H(),outputTokens:H(),thoughtTokens:H().nullish(),totalTokens:H()}),AL=y({_meta:E(d(),x()).nullish(),stopReason:WD,usage:EL.nullish(),userMessageId:d().nullish()});B([y({id:Or,result:B([oL,xR,KR,PD,RD,ED,CD,DD,TR,UD,MD,AL,HD,ZD,GD,$R,ky])}),y({error:wy,id:Or})]);const $L=y({_meta:E(d(),x()).nullish(),cost:IR.nullish(),size:H(),used:H()}),TL=B([Yc.and(y({sessionUpdate:$("user_message_chunk")})),Yc.and(y({sessionUpdate:$("agent_message_chunk")})),Yc.and(y({sessionUpdate:$("agent_thought_chunk")})),pL.and(y({sessionUpdate:$("tool_call")})),Hy.and(y({sessionUpdate:$("tool_call_update")})),LP.and(y({sessionUpdate:$("plan")})),vL.and(y({sessionUpdate:$("available_commands_update")})),TD.and(y({sessionUpdate:$("current_mode_update")})),uD.and(y({sessionUpdate:$("config_option_update")})),AD.and(y({sessionUpdate:$("session_info_update")})),$L.and(y({sessionUpdate:$("usage_update")}))]),Wy=y({_meta:E(d(),x()).nullish(),sessionId:Q,update:TL});y({method:d(),params:B([Wy,OR,Sy]).nullish()});const Vy=y({_meta:E(d(),x()).nullish(),sessionId:Q,terminalId:d()}),IL=y({_meta:E(d(),x()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),CL=y({name:d(),uri:d()}),RL=y({_meta:E(d(),x()).nullish(),repository:wP.nullish(),workspaceFolders:L(CL).nullish(),workspaceUri:d().nullish()});y({id:Or,method:d(),params:B([FP,kR,XR,$P,SD,GR,wD,kD,gD,ND,OD,hL,FD,RL,jD,fD,_y]).nullish()});const By=y({_meta:E(d(),x()).nullish(),content:d(),path:d(),sessionId:Q});y({id:Or,method:d(),params:B([By,Dy,Zy,Ry,zy,Ly,Vy,Py,xL,_y]).nullish()});const PL=y({_meta:E(d(),x()).nullish()});B([y({id:Or,result:B([PL,GP,tD,CR,XD,qP,IL,jR,MR,ky])}),y({error:wy,id:Or})]);var J;class DL{constructor(t,e){w(this,J);const r=t(this),i=async(o,a)=>{var c,u,h,p,v,g,_;switch(o){case cn.fs_write_text_file:{const k=By.parse(a);return(c=r.writeTextFile)==null?void 0:c.call(r,k)}case cn.fs_read_text_file:{const k=Dy.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,k)}case cn.session_request_permission:{const k=Zy.parse(a);return r.requestPermission(k)}case cn.terminal_create:{const k=Ry.parse(a);return(h=r.createTerminal)==null?void 0:h.call(r,k)}case cn.terminal_output:{const k=zy.parse(a);return(p=r.terminalOutput)==null?void 0:p.call(r,k)}case cn.terminal_release:{const k=Ly.parse(a);return await((v=r.releaseTerminal)==null?void 0:v.call(r,k))??{}}case cn.terminal_wait_for_exit:{const k=Vy.parse(a);return(g=r.waitForTerminalExit)==null?void 0:g.call(r,k)}case cn.terminal_kill:{const k=Py.parse(a);return await((_=r.killTerminal)==null?void 0:_.call(r,k))??{}}default:if(r.extMethod)return r.extMethod(o,a);throw Ae.methodNotFound(o)}},s=async(o,a)=>{switch(o){case cn.session_update:{const c=Wy.parse(a);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(o,a);throw Ae.methodNotFound(o)}};S(this,J,new LL(i,s,e))}async initialize(t){return await l(this,J).sendRequest(ue.initialize,t)}async newSession(t){return await l(this,J).sendRequest(ue.session_new,t)}async loadSession(t){return await l(this,J).sendRequest(ue.session_load,t)??{}}async unstable_forkSession(t){return await l(this,J).sendRequest(ue.session_fork,t)}async listSessions(t){return await l(this,J).sendRequest(ue.session_list,t)}async unstable_resumeSession(t){return await l(this,J).sendRequest(ue.session_resume,t)}async unstable_closeSession(t){return await l(this,J).sendRequest(ue.session_close,t)}async setSessionMode(t){return await l(this,J).sendRequest(ue.session_set_mode,t)??{}}async unstable_setSessionModel(t){return await l(this,J).sendRequest(ue.session_set_model,t)??{}}async setSessionConfigOption(t){return await l(this,J).sendRequest(ue.session_set_config_option,t)}async authenticate(t){return await l(this,J).sendRequest(ue.authenticate,t)??{}}async unstable_logout(t){return await l(this,J).sendRequest(ue.logout,t)??{}}async prompt(t){return await l(this,J).sendRequest(ue.session_prompt,t)}async cancel(t){return await l(this,J).sendNotification(ue.session_cancel,t)}async unstable_startNes(t){return await l(this,J).sendRequest(ue.nes_start,t)}async unstable_suggestNes(t){return await l(this,J).sendRequest(ue.nes_suggest,t)}async unstable_closeNes(t){return await l(this,J).sendRequest(ue.nes_close,t)??{}}async unstable_didOpenDocument(t){return await l(this,J).sendNotification(ue.document_did_open,t)}async unstable_didChangeDocument(t){return await l(this,J).sendNotification(ue.document_did_change,t)}async unstable_didCloseDocument(t){return await l(this,J).sendNotification(ue.document_did_close,t)}async unstable_didSaveDocument(t){return await l(this,J).sendNotification(ue.document_did_save,t)}async unstable_didFocusDocument(t){return await l(this,J).sendNotification(ue.document_did_focus,t)}async unstable_acceptNes(t){return await l(this,J).sendNotification(ue.nes_accept,t)}async unstable_rejectNes(t){return await l(this,J).sendNotification(ue.nes_reject,t)}async extMethod(t,e){return await l(this,J).sendRequest(t,e)}async extNotification(t,e){return await l(this,J).sendNotification(t,e)}get signal(){return l(this,J).signal}get closed(){return l(this,J).closed}}J=new WeakMap;var Pn,bl,Xs,Ks,bi,wi,Nt,Js,pe,jy,zu,Gy,qy,Yy,Xy,Ou,xs;class LL{constructor(t,e,r){w(this,pe);w(this,Pn,new Map);w(this,bl,0);w(this,Xs);w(this,Ks);w(this,bi);w(this,wi,Promise.resolve());w(this,Nt,new AbortController);w(this,Js);S(this,Xs,t),S(this,Ks,e),S(this,bi,r),S(this,Js,new Promise(i=>{l(this,Nt).signal.addEventListener("abort",()=>i())})),f(this,pe,jy).call(this)}get signal(){return l(this,Nt).signal}get closed(){return l(this,Js)}async sendRequest(t,e){f(this,pe,Ou).call(this);const r=ap(this,bl)._++,i=new Promise((s,o)=>{l(this,Pn).set(r,{resolve:s,reject:o})});return await f(this,pe,xs).call(this,{jsonrpc:"2.0",id:r,method:t,params:e}),i}async sendNotification(t,e){f(this,pe,Ou).call(this),await f(this,pe,xs).call(this,{jsonrpc:"2.0",method:t,params:e})}}Pn=new WeakMap,bl=new WeakMap,Xs=new WeakMap,Ks=new WeakMap,bi=new WeakMap,wi=new WeakMap,Nt=new WeakMap,Js=new WeakMap,pe=new WeakSet,jy=async function(){let t;try{const e=l(this,bi).readable.getReader();try{for(;!l(this,Nt).signal.aborted;){const{value:r,done:i}=await e.read();if(i)break;if(r)try{f(this,pe,Gy).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&f(this,pe,xs).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{e.releaseLock()}}catch(e){t=e}finally{f(this,pe,zu).call(this,t)}},zu=function(t){if(l(this,Nt).signal.aborted)return;const e=t??new Error("ACP connection closed");for(const r of l(this,Pn).values())r.reject(e);l(this,Pn).clear(),l(this,Nt).abort(e)},Gy=async function(t){if("method"in t&&"id"in t){const e=await f(this,pe,qy).call(this,t.method,t.params);"error"in e&&console.error("Error handling request",t,e.error),await f(this,pe,xs).call(this,{jsonrpc:"2.0",id:t.id,...e})}else if("method"in t){const e=await f(this,pe,Yy).call(this,t.method,t.params);"error"in e&&console.error("Error handling notification",t,e.error)}else"id"in t?f(this,pe,Xy).call(this,t):console.error("Invalid message",{message:t})},qy=async function(t,e){try{return{result:await l(this,Xs).call(this,t,e)??null}}catch(r){if(r instanceof Ae)return r.toResult();if(r instanceof rg)return Ae.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 Ae.internalError(i?JSON.parse(i):{}).toResult()}catch{return Ae.internalError({details:i}).toResult()}}},Yy=async function(t,e){try{return await l(this,Ks).call(this,t,e),{result:null}}catch(r){if(r instanceof Ae)return r.toResult();if(r instanceof rg)return Ae.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 Ae.internalError(i?JSON.parse(i):{}).toResult()}catch{return Ae.internalError({details:i}).toResult()}}},Xy=function(t){const e=l(this,Pn).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 Ae(r,i,s))}l(this,Pn).delete(t.id)}else console.error("Got response to unknown request",t.id)},Ou=function(){if(l(this,Nt).signal.aborted)throw l(this,Nt).signal.reason??new Error("ACP connection closed")},xs=async function(t){return S(this,wi,l(this,wi).then(async()=>{const e=l(this,bi).writable.getWriter();try{await e.write(t)}finally{e.releaseLock()}}).catch(e=>{f(this,pe,zu).call(this,e)})),l(this,wi)};class Ae extends Error{constructor(e,r,i){super(r);m(this,"code");m(this,"data");this.code=e,this.name="RequestError",this.data=i}static parseError(e,r){return new Ae(-32700,`Parse error${r?`: ${r}`:""}`,e)}static invalidRequest(e,r){return new Ae(-32600,`Invalid request${r?`: ${r}`:""}`,e)}static methodNotFound(e){return new Ae(-32601,`"Method not found": ${e}`,{method:e})}static invalidParams(e,r){return new Ae(-32602,`Invalid params${r?`: ${r}`:""}`,e)}static internalError(e,r){return new Ae(-32603,`Internal error${r?`: ${r}`:""}`,e)}static authRequired(e,r){return new Ae(-32e3,`Authentication required${r?`: ${r}`:""}`,e)}static resourceNotFound(e){return new Ae(-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}}}const zL=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,OL=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,ML=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,NL=/\b(tv|television|screen|artifact|artifacts|viewer|filmstrip|layout|focus)\b/i,UL=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,FL="single_session",HL={name:"television-acp-client",version:"0.0.0"},Ky="agent:main:television",ZL=jo(tn);var Si,Ut,st,Ft,Dn,St,fn,Ht,Zt,Ln,_t,_i,ki,Wt,Ve,gn,xi,kr,mn,zn,Qs,Vt,Bt,wl,jt,T,Mu,Jy,Qy,eb,Da,tb,nb,rb,ib,sb,ob,ab,ar,ai,li,un,lb,ci,Nu,Uu,La,cb,za,Fu,Hu,eo,to,Oa,ui,Zu,ub;class WL extends ZL{constructor(e){super();w(this,T);w(this,Si,"disconnected");w(this,Ut,null);w(this,st,new Map);w(this,Ft,null);w(this,Dn,null);w(this,St,null);w(this,fn,null);w(this,Ht,null);w(this,Zt,null);w(this,Ln);w(this,_t,null);w(this,_i,0);w(this,ki,1);w(this,Wt,null);w(this,Ve,null);w(this,gn,!1);w(this,xi,!1);w(this,kr,!1);w(this,mn,null);w(this,zn,new Set);w(this,Qs);w(this,Vt);w(this,Bt);w(this,wl,e=>{f(this,T,Qy).call(this,e)});w(this,jt,null);w(this,eo,()=>{f(this,T,ui).call(this,"ACP bridge websocket closed")});w(this,to,()=>{f(this,T,ui).call(this,"ACP bridge websocket error")});S(this,Vt,e),S(this,Bt,e.sessionMode??FL),S(this,Ln,e.mappedSessionStore??VL()),S(this,Qs,e.createSocket??(r=>new WebSocket(r)))}get status(){return l(this,Si)}get messages(){return[...l(this,st).values()]}get enabled(){return l(this,Vt).enabled??!1}setEnabled(e){l(this,Vt).enabled=e,e||(f(this,T,Oa).call(this),S(this,Ut,null),f(this,T,un).call(this,"disconnected"))}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(this.enabled&&this.status==="disconnected"){l(this,Dn)===null&&(S(this,Ut,null),S(this,Dn,f(this,T,Jy).call(this)));try{await l(this,Dn),await f(this,T,Da).call(this)}catch(e){throw f(this,T,ui).call(this,Xc(e)),e}}}dispose(){f(this,T,Oa).call(this),S(this,Ut,null),f(this,T,un).call(this,"disposed")}async sendMessage(e){if(await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await f(this,T,Mu).call(this,"ready")),(l(this,Ht)===null||l(this,_t)!==f(this,T,za).call(this))&&await f(this,T,Da).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");f(this,T,ai).call(this,{id:f(this,T,ci).call(this,"user"),kind:"user",text:r,status:"final"}),f(this,T,un).call(this,"running");try{const i=await f(this,T,La).call(this).prompt({sessionId:f(this,T,Uu).call(this),prompt:[{type:"text",text:f(this,T,lb).call(this,r)}]});f(this,T,ar).call(this,i.stopReason==="cancelled"?"cancelled":"final"),f(this,T,un).call(this,"ready")}catch(i){throw f(this,T,ub).call(this)||(f(this,T,ar).call(this,"error"),f(this,T,un).call(this,"ready")),i}}async startNewSession(){var r;await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await f(this,T,Mu).call(this,"ready"));const e=f(this,T,za).call(this);((r=l(this,Zt))==null?void 0:r.sessionIdStrategy)==="mapped"?l(this,Ln).clearActualSessionId(e):S(this,_i,l(this,_i)+1),S(this,St,null),S(this,fn,null),S(this,Ht,null),S(this,_t,null),f(this,T,Zu).call(this)}async cancel(){this.status==="running"&&(f(this,T,un).call(this,"cancelling"),await f(this,T,La).call(this).cancel({sessionId:f(this,T,Uu).call(this)}))}setScreenContext(e){var s,o,a;if(e===null){if(l(this,Ve)===null)return;S(this,Ve,null),S(this,gn,!1);return}const r={screenID:e.screenID,screenName:e.screenName};if(((s=l(this,Ve))==null?void 0:s.screenID)===r.screenID&&((o=l(this,Ve))==null?void 0:o.screenName)===r.screenName)return;const i=((a=l(this,Ve))==null?void 0:a.screenID)??null;if(S(this,Ve,r),l(this,Bt)==="single_session"){(!l(this,_t)||i!==r.screenID)&&S(this,gn,!0);return}l(this,_t)!==f(this,T,Fu).call(this,r.screenID)&&(S(this,St,null),S(this,fn,null),l(this,Ft)&&this.status==="ready"&&f(this,T,Da).call(this).catch(c=>{f(this,T,ui).call(this,Xc(c))}))}}Si=new WeakMap,Ut=new WeakMap,st=new WeakMap,Ft=new WeakMap,Dn=new WeakMap,St=new WeakMap,fn=new WeakMap,Ht=new WeakMap,Zt=new WeakMap,Ln=new WeakMap,_t=new WeakMap,_i=new WeakMap,ki=new WeakMap,Wt=new WeakMap,Ve=new WeakMap,gn=new WeakMap,xi=new WeakMap,kr=new WeakMap,mn=new WeakMap,zn=new WeakMap,Qs=new WeakMap,Vt=new WeakMap,Bt=new WeakMap,wl=new WeakMap,jt=new WeakMap,T=new WeakSet,Mu=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(l(this,Ut)??"ACPClient is disconnected");await new Promise((r,i)=>{const s=()=>{this.removeEventListener("status-changed",o)},o=()=>{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(l(this,Ut)??"ACPClient is disconnected")))};this.addEventListener("status-changed",o)})}},Jy=async function(){try{const{stream:e,socket:r,metadata:i}=await qL({serverURL:l(this,Vt).serverURL,token:l(this,Vt).token,createSocket:l(this,Qs),onDisconnect:l(this,wl)});S(this,Zt,i),S(this,jt,r),r.addEventListener("close",l(this,eo)),r.addEventListener("error",l(this,to)),S(this,Ft,new DL(s=>({connection:s,sessionUpdate:async o=>{await f(this,T,nb).call(this,o)},requestPermission:async o=>f(this,T,rb).call(this,o)}),e)),await l(this,Ft).initialize({protocolVersion:mR,clientCapabilities:{},clientInfo:HL})}catch(e){throw e}},Qy=function(e){f(this,T,ui).call(this,Xc(e))},eb=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})`)},Da=async function(){const e=f(this,T,za).call(this);if(l(this,St)&&l(this,fn)===e){await l(this,St);return}S(this,fn,e),S(this,St,f(this,T,tb).call(this,e)),await l(this,St)},tb=async function(e){var c;const r=f(this,T,La).call(this);f(this,T,Zu).call(this);let i,s=!1,o=null;const a={cwd:f(this,T,cb).call(this),mcpServers:[],_meta:{sessionKey:e}};try{if(S(this,kr,!0),S(this,mn,null),((c=l(this,Zt))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=l(this,Ln).getActualSessionId(e);if(u)try{const h=await r.loadSession({...a,sessionId:u});if(BL(h))throw new Error("Mapped ACP session was not found");o=h,i=u,s=!0}catch{const h=await r.newSession(a);o=h,i=h.sessionId,l(this,Ln).setActualSessionId(e,i),s=!1}else{const h=await r.newSession(a);o=h,i=h.sessionId,l(this,Ln).setActualSessionId(e,i),s=!1}}else try{o=await r.loadSession({...a,sessionId:e}),i=e,s=l(this,st).size>0}catch{const u=await r.newSession(a);o=u,i=u.sessionId,s=!1}}finally{S(this,kr,!1),S(this,mn,null),f(this,T,ar).call(this,"final")}f(this,T,eb).call(this,o),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),S(this,Ht,i),S(this,_t,e),S(this,xi,!0),s?(l(this,zn).add(e),l(this,Bt)==="single_session"&&S(this,gn,!1)):(l(this,zn).delete(e),S(this,gn,l(this,Bt)==="single_session")),S(this,Ut,null),f(this,T,un).call(this,"ready")},nb=async function(e){const r=e.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&f(this,T,ab).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&f(this,T,ib).call(this,r.content.text);return;case"tool_call":f(this,T,sb).call(this,r);return;case"tool_call_update":f(this,T,ob).call(this,r);return;case"agent_thought_chunk":return;default:return}},rb=async function(e){return{outcome:{outcome:"cancelled"}}},ib=function(e){S(this,mn,null);const r=GL(e);if(!r)return;if(!l(this,Wt)){const s={id:f(this,T,ci).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};S(this,Wt,s.id),f(this,T,ai).call(this,s);return}const i=l(this,st).get(l(this,Wt));if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");f(this,T,li).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},sb=function(e){f(this,T,ar).call(this,"final");const r=f(this,T,Nu).call(this,e.toolCallId),i=ug("content"in e?e.content:void 0),s={id:(r==null?void 0:r.id)??f(this,T,ci).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){f(this,T,li).call(this,s);return}f(this,T,ai).call(this,s)},ob=function(e){const r=f(this,T,Nu).call(this,e.toolCallId),i=(r==null?void 0:r.text)??"",s=ug(e.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??f(this,T,ci).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:o,locations:e.locations??(r==null?void 0:r.locations)};if(r){f(this,T,li).call(this,a);return}f(this,T,ai).call(this,a)},ab=function(e){if(f(this,T,ar).call(this,"final"),!e)return;const r=l(this,kr)?l(this,mn):null;if(!r){const s=cg(e);if(!s)return;const o={id:f(this,T,ci).call(this,"user"),kind:"user",text:s,status:"final"};f(this,T,ai).call(this,o),l(this,kr)&&S(this,mn,o.id);return}const i=l(this,st).get(r);if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");f(this,T,li).call(this,{...i,text:cg(`${i.text}${e}`)})},ar=function(e){if(!l(this,Wt))return;const r=l(this,st).get(l(this,Wt));(r==null?void 0:r.kind)==="assistant"&&f(this,T,li).call(this,{...r,status:e}),S(this,Wt,null)},ai=function(e){l(this,st).set(e.id,e),this.dispatchEvent(new Bc("messages-changed"))},li=function(e){l(this,st).set(e.id,e),this.dispatchEvent(new Bc("messages-changed"))},un=function(e){l(this,Si)!==e&&(S(this,Si,e),this.dispatchEvent(new HA("status-changed")))},lb=function(e){const r=l(this,_t);if(!r)return e;const i=l(this,Ve)?l(this,Bt)==="single_session"?l(this,gn)||!l(this,zn).has(r):!l(this,zn).has(r):!1,s=l(this,xi)&&(l(this,Ve)!==null||NL.test(e));if(!(s||i))return e;s&&S(this,xi,!1),i&&(S(this,gn,!1),l(this,zn).add(r));const a=["[Television screen context]","This chat session is coming from a Television client.","Using Television requires the knowledge in the `television` skill. Re-read it only if it is not already in context or you know it changed.","If the skill is not installed, it can be installed via `tv skills install <your agent skills path>`."];return l(this,Ve)?(a.push("This conversation is currently attached to the screen below."),a.push(`screen_id: ${l(this,Ve).screenID}`),a.push(`screen_name: ${l(this,Ve).screenName??""}`),a.push("When the user asks to inspect or change Television state with the tv CLI, use this screen ID with the --screen argument.")):a.push("There is currently no active Television screen."),a.push("[/Television screen context]","",e),a.join(`
43
+ `)},ci=function(e){const r=`${e}-${l(this,ki)}`;return S(this,ki,l(this,ki)+1),r},Nu=function(e){for(const r of l(this,st).values())if((r==null?void 0:r.kind)==="tool_call"&&r.toolCallId===e)return r;return null},Uu=function(){if(!l(this,Ht))throw new Error("ACP session is not ready");return l(this,Ht)},La=function(){if(!l(this,Ft))throw new Error("ACP connection is not ready");return l(this,Ft)},cb=function(){var r;const e=(r=l(this,Zt))==null?void 0:r.sessionCwd;if(!e)throw new Error("ACP bridge session cwd is not ready");return e},za=function(){var r;if(l(this,Bt)==="single_session")return f(this,T,Hu).call(this,`${Ky}-${(l(this,Vt).clientGUID??"default-client").toLowerCase()}`);const e=(r=l(this,Ve))==null?void 0:r.screenID;if(!e)throw new Error("Screen context is required for per-screen session mode");return f(this,T,Fu).call(this,e)},Fu=function(e){return f(this,T,Hu).call(this,jL(l(this,Bt),e,l(this,Vt).clientGUID??"default-client"))},Hu=function(e){var r;return((r=l(this,Zt))==null?void 0:r.sessionIdStrategy)==="deterministic"&&l(this,_i)>0?`${e}:epoch-${l(this,_i)}`:e},eo=new WeakMap,to=new WeakMap,Oa=function(){S(this,Ft,null),S(this,Dn,null),S(this,St,null),S(this,fn,null),S(this,Ht,null),S(this,_t,null),S(this,Zt,null),l(this,jt)&&(l(this,jt).removeEventListener("close",l(this,eo)),l(this,jt).removeEventListener("error",l(this,to)),l(this,jt).close(),S(this,jt,null))},ui=function(e){const r=l(this,Ft)!==null||l(this,Dn)!==null||l(this,St)!==null||l(this,fn)!==null||l(this,Ht)!==null||l(this,_t)!==null||l(this,Zt)!==null||l(this,jt)!==null;this.disposed||this.status==="disconnected"&&!r||(f(this,T,ar).call(this,"error"),f(this,T,Oa).call(this),S(this,Ut,e??null),f(this,T,un).call(this,"disconnected"))},Zu=function(){const e=l(this,st).size>0;S(this,Wt,null),S(this,mn,null),S(this,ki,1),l(this,st).clear(),e&&this.dispatchEvent(new Bc("messages-changed"))},ub=function(){return this.status==="disconnected"};function VL(){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 BL(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function jL(n,t,e){return n==="single_session"?`${Ky}-${e.toLowerCase()}`:`agent:main:television-${e.toLowerCase()}-${t.toLowerCase()}`}function hb(n){return n.replace(/^(?:\s*\n)+/,"")}function cg(n){let t=n;return t=t.replace(zL,""),t=t.replace(OL,""),t=t.replace(ML,""),t=hb(t),t}function GL(n){let t=n;return t=t.replace(UL,""),t=hb(t),t}function ug(n){return!n||n.length===0?"":n.flatMap(t=>t.type==="content"&&t.content.type==="text"?[t.content.text]:[]).join("")}async function qL(n){const t=n.createSocket(KL(n.serverURL,n.token));let e=!1,r,i;const s=new Promise((u,h)=>{r=u,i=h}),o=new ReadableStream({start(u){let h=!1;const p=()=>{t.send(JSON.stringify({type:"acp-bridge-connect"}))},v=k=>{const I=XL(k);if(!I)return;let P;try{P=JSON.parse(I)}catch(R){const Z=R instanceof Error?R:new Error(String(R));i(Z),u.error(Z);return}switch(P.type){case"acp-bridge-status":if(P.status==="ready"){let R;try{R=YL(P)}catch(Z){const N=Z instanceof Error?Z:new Error(String(Z));e||i(N),u.error(N);return}e||(e=!0,r(R));return}if(P.status==="error"||P.status==="exited"){const R=new Error(P.error??`ACP bridge ${P.status}`);e||i(R),u.error(R)}return;case"acp-bridge-message":u.enqueue(P.message);return}},g=()=>{var I;if(h)return;h=!0;const k=new Error("ACP bridge websocket closed");e||i(k),(I=n.onDisconnect)==null||I.call(n,k),u.close()},_=()=>{var I;if(h)return;h=!0;const k=new Error("ACP bridge websocket error");e||i(k),(I=n.onDisconnect)==null||I.call(n,k),u.error(k)};t.addEventListener("open",p),t.addEventListener("message",v),t.addEventListener("close",g),t.addEventListener("error",_)}}),a=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:o,writable:a},socket:t,metadata:c}}function YL(n){const{agent:t,sessionIdStrategy:e,sessionCwd:r}=n;if((t==="openclaw"||t==="hermes")&&(e==="deterministic"||e==="mapped")&&typeof r=="string"&&r.length>0)return{agent:t,sessionIdStrategy:e,sessionCwd:r};throw new Error("ACP bridge ready status missing bootstrap metadata")}function XL(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 KL(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 Xc(n){return n instanceof Error?n.message:String(n)}const hg="television.acpClientGUID",dg="television.acpMappedSessions",pg=1;var Ei;class JL{constructor(){w(this,Ei,new Map)}getActualSessionId(t){return l(this,Ei).get(t)??null}setActualSessionId(t,e){l(this,Ei).set(t,e)}clearActualSessionId(t){l(this,Ei).delete(t)}}Ei=new WeakMap;var Ai,no,at,Ma,Na,Wu;class QL{constructor(t,e){w(this,at);w(this,Ai);w(this,no);S(this,Ai,t),S(this,no,e)}getActualSessionId(t){const e=f(this,at,Na).call(this)[f(this,at,Ma).call(this,t)];return typeof e=="string"&&e.length>0?e:null}setActualSessionId(t,e){const r=f(this,at,Na).call(this);r[f(this,at,Ma).call(this,t)]=e,f(this,at,Wu).call(this,r)}clearActualSessionId(t){const e=f(this,at,Na).call(this);delete e[f(this,at,Ma).call(this,t)],f(this,at,Wu).call(this,e)}}Ai=new WeakMap,no=new WeakMap,at=new WeakSet,Ma=function(t){return JSON.stringify([l(this,no),t])},Na=function(){const t=l(this,Ai).getItem(dg);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!==pg?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},Wu=function(t){const e={version:pg,entries:t};l(this,Ai).setItem(dg,JSON.stringify(e))};function e2(){return typeof window>"u"?null:window.localStorage}function t2(n){const t=n.getItem(hg);if(t)return t;const e=Zl().toLowerCase();return n.setItem(hg,e),e}const fg=4401,n2=401,va=1e3,r2=3e4;class Ls extends Error{constructor(t="Authentication required"){super(t),this.name="AuthError"}}class db extends tn{constructor(e){var i,s;super();m(this,"url");m(this,"name");m(this,"status","unauthorized");m(this,"screens",new Map);m(this,"views",[]);m(this,"client");m(this,"acpClient");m(this,"_token");m(this,"attempting",!1);m(this,"nextRetryAt",null);m(this,"hasEverConnected",!1);m(this,"createSocket");m(this,"createClient");m(this,"socket",null);m(this,"connectAttempt",0);m(this,"autoReconnect",!1);m(this,"retryTimer",null);m(this,"retryDelay",va);m(this,"visibilityEventTarget");m(this,"networkEventTarget");m(this,"onVisibilityChange");m(this,"onNetworkOnline");this.url=be(e.url),this.name=e.name,this._token=e.token??null,this.createSocket=e.createSocket??(o=>new WebSocket(o)),this.createClient=e.createClient??((o,a)=>new y1(o,{token:a??void 0})),this.client=this.createClient(this.url,this._token);const r=e.mappedSessionStore??(e.acpStorage?new QL(e.acpStorage,this.url):new JL);this.acpClient=new WL({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()},(i=this.visibilityEventTarget)==null||i.addEventListener("visibilitychange",this.onVisibilityChange),(s=this.networkEventTarget)==null||s.addEventListener("online",this.onNetworkOnline)}get token(){return this._token}async connect(e){this._token=e,this.cancelRetryTimer(),this.retryDelay=va,this.autoReconnect=!0,await this.attempt()}dispose(){var e,r,i;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),this.acpClient.dispose()}getViewURL(e){const r=gR(e.kind,this.views);if(!r)return null;const i=`${this.url}/views/${encodeURIComponent(r.id)}/`;return this._token===null?i:`${i}?token=${encodeURIComponent(this._token)}`}getContentURL(e){if(e.kind==="url")return null;const r=`${this.url}/artifacts/${encodeURIComponent(e.id)}/content/`;return this._token===null?r:`${r}?token=${encodeURIComponent(this._token)}`}async createScreen(e){const{screen:r}=await this.client.screens.create({name:e});return this.screens.set(r.id,structuredClone(r)),r}applyServerEvent(e){switch(e.type){case"screen-created":this.screens.set(e.screen.id,structuredClone(e.screen)),this.dispatchEvent(new Ra("screens-changed"));break;case"screen-updated":this.screens.set(e.screen.id,structuredClone(e.screen)),this.dispatchEvent(new Ra("screens-changed"));break;case"screen-removed":this.screens.delete(e.screenID),this.dispatchEvent(new Ra("screens-changed"));break;case"artifact-created":break;case"artifact-attached":{const r=this.screens.get(e.screenID);r&&!Ev(r.layout,e.artifact.id)&&(r.layout=[...r.layout,xv(e.artifact.id,{id:e.cardID})]);break}case"artifact-removed":{const r=this.screens.get(e.screenID);r&&(r.layout=gv(r.layout,e.artifactID));break}case"artifact-updated":case"artifact-content-changed":case"screen-changed":case"theme-changed":case"artifact-focus":break;default:return i2(e,"server event")}}async attempt(){var i;this.attempting=!0,this.nextRetryAt=null,this.connectAttempt+=1;const e=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this._token),this.setStatus("disconnected"),this.dispatchEvent(new ae("change"));const r=this.createSocket(s2(this.url,this._token));return this.socket=r,await new Promise((s,o)=>{let a=!1;const c=()=>{a||this.connectAttempt!==e||(a=!0,this.retryDelay=va,this.hasEverConnected=!0,this.setStatus("connected"),s())},u=p=>{a||this.connectAttempt!==e||(a=!0,o(p))},h=async()=>{try{const[{screens:p},v,g]=await Promise.all([this.client.screens.list(),this.client.views.list(),this.client.display.get()]);this.screens=new Map(p.map(_=>[_.id,structuredClone(_)])),this.views=v,this.acpClient.setEnabled(g.acpEnabled),this.dispatchEvent(new ae("change")),this.dispatchEvent(new $u("server-event",{serverURL:this.url,event:{type:"screen-changed",screenID:g.activeScreenID}})),c()}catch(p){if(l2(p)){u(new Ls);return}u(p instanceof Error?p:new Error(String(p)))}};r.addEventListener("open",()=>{h()}),r.addEventListener("message",p=>{const v=a2(p);v&&(this.applyServerEvent(v),this.dispatchEvent(new $u("server-event",{serverURL:this.url,event:v})))}),r.addEventListener("close",p=>{if(this.connectAttempt!==e)return;this.socket=null;const v=o2(p);if(!a){u(v===fg?new Ls:new Error("Connection closed before initialization"));return}if(v===fg){this.autoReconnect=!1,this.cancelRetryTimer(),this.setStatus("unauthorized");return}this.handleTransportFailure(new Error("Connection closed"))}),r.addEventListener("error",()=>{if(this.connectAttempt===e){if(a){this.handleTransportFailure(new Error("WebSocket error"));return}u(new Error("WebSocket connection failed"))}})}).then(()=>{this.attempting=!1},s=>{throw this.attempting=!1,this.handleAttemptFailure(s),s})}handleAttemptFailure(e){if(e instanceof Ls){this.autoReconnect=!1,this.cancelRetryTimer(),this.setStatus("unauthorized");return}this.autoReconnect&&this.scheduleRetry()}handleTransportFailure(e){this.autoReconnect&&(this.setStatus("disconnected"),this.scheduleRetry())}scheduleRetry(){this.cancelRetryTimer(),this.connectAttempt+=1;const e=this.retryDelay;this.retryDelay=Math.min(this.retryDelay*2,r2),this.nextRetryAt=Date.now()+e,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.attempt().catch(()=>{})},e),this.dispatchEvent(new ae("change"))}cancelRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.nextRetryAt!==null&&(this.nextRetryAt=null,this.dispatchEvent(new ae("change")))}kickReconnect(){this.autoReconnect&&this.status!=="connected"&&(this.attempting||(this.cancelRetryTimer(),this.retryDelay=va,this.attempt().catch(()=>{})))}setStatus(e){this.status!==e&&(this.status=e,this.dispatchEvent(new ae("change")))}isPageVisible(){return this.visibilityEventTarget===null?!0:this.visibilityEventTarget.visibilityState==="visible"}}function i2(n,t){throw new Error(`Unexpected ${t}: ${JSON.stringify(n)}`)}function s2(n,t){const e=new URL(n);return e.protocol=e.protocol==="https:"?"wss:":"ws:",e.pathname="/events",e.search="",t&&e.searchParams.set("token",t),e.hash="",e.toString()}function o2(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}function a2(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;try{return JSON.parse(t)}catch{return null}}function l2(n){return n instanceof Tv&&n.status===n2}const c2="Local";var ro,Vu;class u2 extends tn{constructor(e){super();w(this,ro);m(this,"servers",new Map);m(this,"localServerURL");m(this,"clientGUID");m(this,"acpStorage");m(this,"localStore");m(this,"createSocket");m(this,"lastActiveServerURL");m(this,"serverListeners",new Map);m(this,"handleLocalStoreChange",()=>{const e=this.localStore.get().activeServerURL;e!==this.lastActiveServerURL&&(this.lastActiveServerURL=e,this.dispatchEvent(new ae("change")))});this.localStore=e.localStore,this.localServerURL=e.localServerURL?be(e.localServerURL):null,this.createSocket=e.createSocket??(i=>new WebSocket(i)),this.lastActiveServerURL=this.localStore.get().activeServerURL;const r=e.acpStorage===void 0?e2():e.acpStorage;this.acpStorage=r,this.clientGUID=e.clientGUID??(r?t2(r):Zl().toLowerCase()),this.localStore.addEventListener("change",this.handleLocalStoreChange)}get activeServer(){const e=this.localStore.get().activeServerURL;return e===null?null:this.servers.get(e)??null}add(e){const r=be(e.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,e);const s=()=>{this.dispatchEvent(new ae("change"))},o=c=>{this.dispatchEvent(new $u("server-event",{serverURL:c.serverURL,event:c.event}))},a=()=>{this.dispatchEvent(new Ra("screens-changed"))};e.addEventListener("change",s),e.addEventListener("server-event",o),e.addEventListener("screens-changed",a),this.serverListeners.set(r,{onServerChange:s,onServerEvent:o,onScreensChanged:a}),this.dispatchEvent(new ae("change"))}remove(e){const r=be(e);if(this.localServerURL&&r===this.localServerURL)return;const i=this.servers.get(r);if(!i)return;const s=this.serverListeners.get(r);s&&(i.removeEventListener("change",s.onServerChange),i.removeEventListener("server-event",s.onServerEvent),i.removeEventListener("screens-changed",s.onScreensChanged),this.serverListeners.delete(r)),i.dispose(),this.servers.delete(r);const o=this.localStore.get(),a=o.activeServerURL===r;this.localStore.set({...o,servers:o.servers.filter(c=>c.url!==r),activeServerURL:a?null:o.activeServerURL}),this.dispatchEvent(new ae("change"))}setActive(e){const r=this.localStore.get(),i=e?be(e.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(e,r){const i=e?be(e):null;if(i){const a=this.localStore.get();a.servers.some(u=>be(u.url)===i)||this.localStore.set({...a,servers:[...a.servers,{url:i,name:c2}]})}const s=this.localStore.get().servers;for(const a of s){const c=be(a.url),h=i!==null&&c===i?r??null:null,p=f(this,ro,Vu).call(this,{url:a.url,name:a.name,token:h});this.add(p),p.connect(h).catch(()=>{})}const o=i?this.servers.get(i)??null:null;this.setActive(o??this.servers.values().next().value??null)}addServer(e,r){const i=be(e);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>be(a.url)!==i),{url:i,name:r}]});const o=f(this,ro,Vu).call(this,{url:i,name:r,token:null});this.add(o),this.setActive(o),o.connect(null).catch(()=>{})}removeServer(e){this.remove(e)}}ro=new WeakSet,Vu=function(e){return new db({url:e.url,name:e.name,token:e.token,createSocket:this.createSocket,clientGUID:this.clientGUID,acpStorage:this.acpStorage})};var io;class h2 extends tn{constructor(){super();w(this,io,e=>{const r=d2(e);r!==null&&(e.preventDefault(),this.dispatchEvent(new FA("shortcut-triggered",{shortcut:r})))});document.addEventListener("keydown",l(this,io))}dispose(){document.removeEventListener("keydown",l(this,io))}}io=new WeakMap;function d2(n){for(const[t,e]of Object.entries(b1))if(p2(n,e.trigger))return t;return null}function p2(n,t){return!(n.key.toLowerCase()!==t.key.toLowerCase()||n.metaKey!==!!t.meta||n.ctrlKey!==!!t.ctrl||n.shiftKey!==!!t.shift||n.altKey!==!!t.alt)}const f2="serverURL",g2="token",m2="mode",v2="electron";function pb(n=window.location.search,t=window.location.origin){const r=new URLSearchParams(n).get(f2);return r?new URL(r).origin:new URL(t).origin}function gg(n=window.location.search){return new URLSearchParams(n).get(g2)}function yd(n=window.location.search){return new URLSearchParams(n).get(m2)===v2}let $n=null;async function fb(n,t){if($n==null||$n.abort(),n===null){$n=null,rl();return}const e=new AbortController;$n=e;try{const r=t.token?{Authorization:`Bearer ${t.token}`}:void 0,i=new URL(`/themes/${n}/theme.css`,t.url).toString(),s=await fetch(i,{signal:e.signal,...r?{headers:r}:{}});if(!s.ok)throw new Error(`Theme fetch failed: ${s.status}`);const o=await s.text();if($n!==e)return;hv(o)}catch(r){if(r.name==="AbortError")return;rl();const i=r instanceof Error?r.message:String(r);console.warn(`applyTheme: ${i}`)}finally{$n===e&&($n=null)}}/**
44
44
  * @license
45
45
  * Copyright 2017 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
- */const Ls=globalThis,cg=n=>n,al=Ls.trustedTypes,ug=al?al.createPolicy("lit-html",{createHTML:n=>n}):void 0,pb="$lit$",An=`lit$${Math.random().toFixed(9).slice(2)}$`,fb="?"+An,v2=`<${fb}>`,Mr=document,Hs=()=>Mr.createComment(""),Zs=n=>n===null||typeof n!="object"&&typeof n!="function",ud=Array.isArray,y2=n=>ud(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",Bc=`[
48
- \f\r]`,ds=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,hg=/-->/g,dg=/>/g,nr=RegExp(`>|${Bc}(?:([^\\s"'>=/]+)(${Bc}*=${Bc}*(?:[^
49
- \f\r"'\`<>=]|("|')|))|$)`,"g"),pg=/'/g,fg=/"/g,gb=/^(?:script|style|textarea|title)$/i,b2=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),z=b2(1),Nr=Symbol.for("lit-noChange"),se=Symbol.for("lit-nothing"),gg=new WeakMap,gr=Mr.createTreeWalker(Mr,129);function mb(n,t){if(!ud(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return ug!==void 0?ug.createHTML(t):t}const w2=(n,t)=>{const e=n.length-1,r=[];let i,s=t===2?"<svg>":t===3?"<math>":"",o=ds;for(let a=0;a<e;a++){const c=n[a];let u,h,p=-1,v=0;for(;v<c.length&&(o.lastIndex=v,h=o.exec(c),h!==null);)v=o.lastIndex,o===ds?h[1]==="!--"?o=hg:h[1]!==void 0?o=dg:h[2]!==void 0?(gb.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=nr):h[3]!==void 0&&(o=nr):o===nr?h[0]===">"?(o=i??ds,p=-1):h[1]===void 0?p=-2:(p=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?nr:h[3]==='"'?fg:pg):o===fg||o===pg?o=nr:o===hg||o===dg?o=ds:(o=nr,i=void 0);const g=o===nr&&n[a+1].startsWith("/>")?" ":"";s+=o===ds?c+v2:p>=0?(r.push(u),c.slice(0,p)+pb+c.slice(p)+An+g):c+An+(p===-2?a:g)}return[mb(n,s+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};class Ws{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let s=0,o=0;const a=t.length-1,c=this.parts,[u,h]=w2(t,e);if(this.el=Ws.createElement(u,r),gr.currentNode=this.el.content,e===2||e===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=gr.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(pb)){const v=h[o++],g=i.getAttribute(p).split(An),_=/([.?@])?(.*)/.exec(v);c.push({type:1,index:s,name:_[2],strings:g,ctor:_[1]==="."?_2:_[1]==="?"?k2:_[1]==="@"?x2:Yl}),i.removeAttribute(p)}else p.startsWith(An)&&(c.push({type:6,index:s}),i.removeAttribute(p));if(gb.test(i.tagName)){const p=i.textContent.split(An),v=p.length-1;if(v>0){i.textContent=al?al.emptyScript:"";for(let g=0;g<v;g++)i.append(p[g],Hs()),gr.nextNode(),c.push({type:2,index:++s});i.append(p[v],Hs())}}}else if(i.nodeType===8)if(i.data===fb)c.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(An,p+1))!==-1;)c.push({type:7,index:s}),p+=An.length-1}s++}}static createElement(t,e){const r=Mr.createElement("template");return r.innerHTML=t,r}}function ji(n,t,e=n,r){var o,a;if(t===Nr)return t;let i=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl;const s=Zs(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((a=i==null?void 0:i._$AO)==null||a.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=ji(n,i._$AS(n,t.values),i,r)),t}class S2{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)??Mr).importNode(e,!0);gr.currentNode=i;let s=gr.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new ql(s,s.nextSibling,this,t):c.type===1?u=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(u=new E2(s,this,t)),this._$AV.push(u),c=r[++a]}o!==(c==null?void 0:c.index)&&(s=gr.nextNode(),o++)}return gr.currentNode=Mr,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 ql=class vb{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=se,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=ji(this,t,e),Zs(t)?t===se||t==null||t===""?(this._$AH!==se&&this._$AR(),this._$AH=se):t!==this._$AH&&t!==Nr&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):y2(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!==se&&Zs(this._$AH)?this._$AA.nextSibling.data=t:this.T(Mr.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=Ws.createElement(mb(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(e);else{const o=new S2(i,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=gg.get(t.strings);return e===void 0&&gg.set(t.strings,e=new Ws(t)),e}k(t){ud(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 vb(this.O(Hs()),this.O(Hs()),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=cg(t).nextSibling;cg(t).remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},Yl=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,s){this.type=1,this._$AH=se,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=se}_$AI(t,e=this,r,i){const s=this.strings;let o=!1;if(s===void 0)t=ji(this,t,e,0),o=!Zs(t)||t!==this._$AH&&t!==Nr,o&&(this._$AH=t);else{const a=t;let c,u;for(t=s[0],c=0;c<s.length-1;c++)u=ji(this,a[r+c],e,c),u===Nr&&(u=this._$AH[c]),o||(o=!Zs(u)||u!==this._$AH[c]),u===se?t=se:t!==se&&(t+=(u??"")+s[c+1]),this._$AH[c]=u}o&&!i&&this.j(t)}j(t){t===se?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},_2=class extends Yl{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===se?void 0:t}},k2=class extends Yl{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==se)}},x2=class extends Yl{constructor(t,e,r,i,s){super(t,e,r,i,s),this.type=5}_$AI(t,e=this){if((t=ji(this,t,e,0)??se)===Nr)return;const r=this._$AH,i=t===se&&r!==se||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==se&&(r===se||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 E2{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){ji(this,t)}}const A2={I:ql},jc=Ls.litHtmlPolyfillSupport;jc==null||jc(Ws,ql),(Ls.litHtmlVersions??(Ls.litHtmlVersions=[])).push("3.3.2");const Ce=(n,t,e)=>{const r=t;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new ql(t.insertBefore(Hs(),null),null,void 0,{})),i._$AI(n),i};/**
47
+ */const zs=globalThis,mg=n=>n,ul=zs.trustedTypes,vg=ul?ul.createPolicy("lit-html",{createHTML:n=>n}):void 0,gb="$lit$",In=`lit$${Math.random().toFixed(9).slice(2)}$`,mb="?"+In,y2=`<${mb}>`,Mr=document,Zs=()=>Mr.createComment(""),Ws=n=>n===null||typeof n!="object"&&typeof n!="function",bd=Array.isArray,b2=n=>bd(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",Kc=`[
48
+ \f\r]`,ps=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,yg=/-->/g,bg=/>/g,rr=RegExp(`>|${Kc}(?:([^\\s"'>=/]+)(${Kc}*=${Kc}*(?:[^
49
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),wg=/'/g,Sg=/"/g,vb=/^(?:script|style|textarea|title)$/i,w2=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),z=w2(1),Nr=Symbol.for("lit-noChange"),se=Symbol.for("lit-nothing"),_g=new WeakMap,mr=Mr.createTreeWalker(Mr,129);function yb(n,t){if(!bd(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return vg!==void 0?vg.createHTML(t):t}const S2=(n,t)=>{const e=n.length-1,r=[];let i,s=t===2?"<svg>":t===3?"<math>":"",o=ps;for(let a=0;a<e;a++){const c=n[a];let u,h,p=-1,v=0;for(;v<c.length&&(o.lastIndex=v,h=o.exec(c),h!==null);)v=o.lastIndex,o===ps?h[1]==="!--"?o=yg:h[1]!==void 0?o=bg:h[2]!==void 0?(vb.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=rr):h[3]!==void 0&&(o=rr):o===rr?h[0]===">"?(o=i??ps,p=-1):h[1]===void 0?p=-2:(p=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?rr:h[3]==='"'?Sg:wg):o===Sg||o===wg?o=rr:o===yg||o===bg?o=ps:(o=rr,i=void 0);const g=o===rr&&n[a+1].startsWith("/>")?" ":"";s+=o===ps?c+y2:p>=0?(r.push(u),c.slice(0,p)+gb+c.slice(p)+In+g):c+In+(p===-2?a:g)}return[yb(n,s+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};class Vs{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let s=0,o=0;const a=t.length-1,c=this.parts,[u,h]=S2(t,e);if(this.el=Vs.createElement(u,r),mr.currentNode=this.el.content,e===2||e===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=mr.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(gb)){const v=h[o++],g=i.getAttribute(p).split(In),_=/([.?@])?(.*)/.exec(v);c.push({type:1,index:s,name:_[2],strings:g,ctor:_[1]==="."?k2:_[1]==="?"?x2:_[1]==="@"?E2:Jl}),i.removeAttribute(p)}else p.startsWith(In)&&(c.push({type:6,index:s}),i.removeAttribute(p));if(vb.test(i.tagName)){const p=i.textContent.split(In),v=p.length-1;if(v>0){i.textContent=ul?ul.emptyScript:"";for(let g=0;g<v;g++)i.append(p[g],Zs()),mr.nextNode(),c.push({type:2,index:++s});i.append(p[v],Zs())}}}else if(i.nodeType===8)if(i.data===mb)c.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(In,p+1))!==-1;)c.push({type:7,index:s}),p+=In.length-1}s++}}static createElement(t,e){const r=Mr.createElement("template");return r.innerHTML=t,r}}function Gi(n,t,e=n,r){var o,a;if(t===Nr)return t;let i=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl;const s=Ws(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((a=i==null?void 0:i._$AO)==null||a.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=Gi(n,i._$AS(n,t.values),i,r)),t}class _2{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)??Mr).importNode(e,!0);mr.currentNode=i;let s=mr.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Kl(s,s.nextSibling,this,t):c.type===1?u=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(u=new A2(s,this,t)),this._$AV.push(u),c=r[++a]}o!==(c==null?void 0:c.index)&&(s=mr.nextNode(),o++)}return mr.currentNode=Mr,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 Kl=class bb{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=se,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=Gi(this,t,e),Ws(t)?t===se||t==null||t===""?(this._$AH!==se&&this._$AR(),this._$AH=se):t!==this._$AH&&t!==Nr&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):b2(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!==se&&Ws(this._$AH)?this._$AA.nextSibling.data=t:this.T(Mr.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=Vs.createElement(yb(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(e);else{const o=new _2(i,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=_g.get(t.strings);return e===void 0&&_g.set(t.strings,e=new Vs(t)),e}k(t){bd(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 bb(this.O(Zs()),this.O(Zs()),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=mg(t).nextSibling;mg(t).remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},Jl=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,s){this.type=1,this._$AH=se,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=se}_$AI(t,e=this,r,i){const s=this.strings;let o=!1;if(s===void 0)t=Gi(this,t,e,0),o=!Ws(t)||t!==this._$AH&&t!==Nr,o&&(this._$AH=t);else{const a=t;let c,u;for(t=s[0],c=0;c<s.length-1;c++)u=Gi(this,a[r+c],e,c),u===Nr&&(u=this._$AH[c]),o||(o=!Ws(u)||u!==this._$AH[c]),u===se?t=se:t!==se&&(t+=(u??"")+s[c+1]),this._$AH[c]=u}o&&!i&&this.j(t)}j(t){t===se?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},k2=class extends Jl{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===se?void 0:t}},x2=class extends Jl{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==se)}},E2=class extends Jl{constructor(t,e,r,i,s){super(t,e,r,i,s),this.type=5}_$AI(t,e=this){if((t=Gi(this,t,e,0)??se)===Nr)return;const r=this._$AH,i=t===se&&r!==se||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==se&&(r===se||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 A2{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){Gi(this,t)}}const $2={I:Kl},Jc=zs.litHtmlPolyfillSupport;Jc==null||Jc(Vs,Kl),(zs.litHtmlVersions??(zs.litHtmlVersions=[])).push("3.3.2");const Ce=(n,t,e)=>{const r=t;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new Kl(t.insertBefore(Zs(),null),null,void 0,{})),i._$AI(n),i};/**
50
50
  * @license
51
51
  * Copyright 2017 Google LLC
52
52
  * SPDX-License-Identifier: BSD-3-Clause
53
- */const hd={CHILD:2},Xl=n=>(...t)=>({_$litDirective$:n,values:t});let dd=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)}};/**
53
+ */const wd={CHILD:2},Ql=n=>(...t)=>({_$litDirective$:n,values:t});let Sd=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)}};/**
54
54
  * @license
55
55
  * Copyright 2017 Google LLC
56
56
  * SPDX-License-Identifier: BSD-3-Clause
57
- */let ll=class extends dd{constructor(t){if(super(t),this.it=se,t.type!==hd.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===se||t==null)return this._t=void 0,this.it=t;if(t===Nr)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:[]}}};ll.directiveName="unsafeHTML",ll.resultType=1;const $2=Xl(ll);/**
57
+ */let hl=class extends Sd{constructor(t){if(super(t),this.it=se,t.type!==wd.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===se||t==null)return this._t=void 0,this.it=t;if(t===Nr)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:[]}}};hl.directiveName="unsafeHTML",hl.resultType=1;const T2=Ql(hl);/**
58
58
  * @license
59
59
  * Copyright 2017 Google LLC
60
60
  * SPDX-License-Identifier: BSD-3-Clause
61
- */let Ou=class extends ll{};Ou.directiveName="unsafeSVG",Ou.resultType=2;const yb=Xl(Ou),T2={size:16,color:"currentColor",weight:"regular"};function I2(n){return typeof n=="string"?{regular:n}:n}function Qt(n,t="0 0 256 256"){const e=I2(n);return r=>{const{size:i,color:s,weight:o}={...T2,...r},a=e[o]??e.regular;return z`<svg
61
+ */let Bu=class extends hl{};Bu.directiveName="unsafeSVG",Bu.resultType=2;const wb=Ql(Bu),I2={size:16,color:"currentColor",weight:"regular"};function C2(n){return typeof n=="string"?{regular:n}:n}function nn(n,t="0 0 256 256"){const e=C2(n);return r=>{const{size:i,color:s,weight:o}={...I2,...r},a=e[o]??e.regular;return z`<svg
62
62
  xmlns="http://www.w3.org/2000/svg"
63
63
  data-ui-icon=""
64
64
  width="${i}"
65
65
  height="${i}"
66
66
  viewBox="${t}"
67
67
  fill="${s}"
68
- >${yb(a)}</svg>`}}/**
68
+ >${wb(a)}</svg>`}}/**
69
69
  * @license
70
70
  * Copyright 2020 Google LLC
71
71
  * SPDX-License-Identifier: BSD-3-Clause
72
- */const{I:C2}=A2,mg=n=>n,R2=n=>n.strings===void 0,vg=()=>document.createComment(""),ps=(n,t,e)=>{var s;const r=n._$AA.parentNode,i=t===void 0?n._$AB:t._$AA;if(e===void 0){const o=r.insertBefore(vg(),i),a=r.insertBefore(vg(),i);e=new C2(o,a,n,n.options)}else{const o=e._$AB.nextSibling,a=e._$AM,c=a!==n;if(c){let u;(s=e._$AQ)==null||s.call(e,n),e._$AM=n,e._$AP!==void 0&&(u=n._$AU)!==a._$AU&&e._$AP(u)}if(o!==i||c){let u=e._$AA;for(;u!==o;){const h=mg(u).nextSibling;mg(r).insertBefore(u,i),u=h}}}return e},rr=(n,t,e=n)=>(n._$AI(t,e),n),P2={},D2=(n,t=P2)=>n._$AH=t,L2=n=>n._$AH,Gc=n=>{n._$AR(),n._$AA.remove()};/**
72
+ */const{I:R2}=$2,kg=n=>n,P2=n=>n.strings===void 0,xg=()=>document.createComment(""),fs=(n,t,e)=>{var s;const r=n._$AA.parentNode,i=t===void 0?n._$AB:t._$AA;if(e===void 0){const o=r.insertBefore(xg(),i),a=r.insertBefore(xg(),i);e=new R2(o,a,n,n.options)}else{const o=e._$AB.nextSibling,a=e._$AM,c=a!==n;if(c){let u;(s=e._$AQ)==null||s.call(e,n),e._$AM=n,e._$AP!==void 0&&(u=n._$AU)!==a._$AU&&e._$AP(u)}if(o!==i||c){let u=e._$AA;for(;u!==o;){const h=kg(u).nextSibling;kg(r).insertBefore(u,i),u=h}}}return e},ir=(n,t,e=n)=>(n._$AI(t,e),n),D2={},L2=(n,t=D2)=>n._$AH=t,z2=n=>n._$AH,Qc=n=>{n._$AR(),n._$AA.remove()};/**
73
73
  * @license
74
74
  * Copyright 2017 Google LLC
75
75
  * SPDX-License-Identifier: BSD-3-Clause
76
- */const zs=(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),zs(i,t);return!0},cl=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)},bb=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),M2(t)}};function z2(n){this._$AN!==void 0?(cl(this),this._$AM=n,bb(this)):this._$AM=n}function O2(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++)zs(r[s],!1),cl(r[s]);else r!=null&&(zs(r,!1),cl(r));else zs(this,n)}const M2=n=>{n.type==hd.CHILD&&(n._$AP??(n._$AP=O2),n._$AQ??(n._$AQ=z2))};class N2 extends dd{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),bb(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&&(zs(this,t),cl(this))}setValue(t){if(R2(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(){}}/**
76
+ */const Os=(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),Os(i,t);return!0},dl=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)},Sb=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),N2(t)}};function O2(n){this._$AN!==void 0?(dl(this),this._$AM=n,Sb(this)):this._$AM=n}function M2(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++)Os(r[s],!1),dl(r[s]);else r!=null&&(Os(r,!1),dl(r));else Os(this,n)}const N2=n=>{n.type==wd.CHILD&&(n._$AP??(n._$AP=M2),n._$AQ??(n._$AQ=O2))};class U2 extends Sd{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Sb(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&&(Os(this,t),dl(this))}setValue(t){if(P2(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(){}}/**
77
77
  * @license
78
78
  * Copyright 2020 Google LLC
79
79
  * SPDX-License-Identifier: BSD-3-Clause
80
- */const Oa=()=>new U2;class U2{}const qc=new WeakMap,Ma=Xl(class extends N2{render(n){return se}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)),se}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let e=qc.get(t);e===void 0&&(e=new WeakMap,qc.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=qc.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)}}),F2=Qt('<path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M200 224H56C53.8783 224 51.8434 223.157 50.3431 221.657C48.8429 220.157 48 218.122 48 216V40C48 37.8783 48.8429 35.8434 50.3431 34.3431C51.8434 32.8429 53.8783 32 56 32H152L208 88V216C208 218.122 207.157 220.157 205.657 221.657C204.157 223.157 202.122 224 200 224Z"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M152 32V88H208"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 88H124.5"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 128H175"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 169H175"/>'),pd=Qt('<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"/>'),H2=Qt('<path d="M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z"/>'),ul=Qt('<path d="M213.66,93.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,82.34L128,156.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"/>'),Z2=Qt('<path d="M213.66,162.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,53.66,173.66L128,99.31l74.34,74.35a8,8,0,0,0,11.32-11.32Z"/>'),W2=Qt({regular:'<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,64Zm0,136H40V80H216V200Z"/>',bold:'<path d="M216,60H157l27.52-27.52a12,12,0,0,0-17-17L128,55,88.49,15.51a12,12,0,0,0-17,17L99,60H40A20,20,0,0,0,20,80V200a20,20,0,0,0,20,20H216a20,20,0,0,0,20-20V80A20,20,0,0,0,216,60Zm-4,136H44V84H212Z"/>'}),V2=Qt({regular:'<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"/>',bold:'<path d="M100,36H56A20,20,0,0,0,36,56v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,100,36ZM96,96H60V60H96ZM200,36H156a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,60H160V60h36Zm-96,40H56a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V156A20,20,0,0,0,100,136Zm-4,60H60V160H96Zm104-60H156a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V156A20,20,0,0,0,200,136Zm-4,60H160V160h36Z"/>'}),B2=Qt('<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"/>'),wb=Qt({regular:'<path d="M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm88,88H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"/>',bold:'<path d="M140,32V64a12,12,0,0,1-24,0V32a12,12,0,0,1,24,0Zm84,84H192a12,12,0,0,0,0,24h32a12,12,0,0,0,0-24Zm-42.26,48.77a12,12,0,1,0-17,17l22.63,22.63a12,12,0,0,0,17-17ZM128,180a12,12,0,0,0-12,12v32a12,12,0,0,0,24,0V192A12,12,0,0,0,128,180ZM74.26,164.77,51.63,187.4a12,12,0,0,0,17,17l22.63-22.63a12,12,0,1,0-17-17ZM76,128a12,12,0,0,0-12-12H32a12,12,0,0,0,0,24H64A12,12,0,0,0,76,128ZM68.6,51.63a12,12,0,1,0-17,17L74.26,91.23a12,12,0,0,0,17-17Z"/>'}),j2=Qt('<path d="M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,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"/>');class G2 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}const yg='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',Yc=4;var ze,Je,xr,Qe,io,Ai,$i,V,Mu,Nu,_b,Na,kb,Uu,Fu,so,oo,Er,xb,Hu,Eb,Ab,Ua,hi;class Sb extends HTMLElement{constructor(){super();w(this,V);w(this,ze,!1);w(this,Je,null);w(this,xr);w(this,Qe,null);w(this,io,"bottom-start");w(this,Ai,!1);w(this,$i,!1);w(this,so,e=>{l(this,ze)&&(l(this,Ai)||e.composedPath().includes(this)||(this.open=!1))});w(this,oo,e=>{if(l(this,ze)){if(e.key==="Escape"){e.preventDefault(),this.open=!1;return}e.key==="Tab"&&f(this,V,xb).call(this,e)}});w(this,Er,()=>{l(this,ze)&&f(this,V,Ua).call(this)});S(this,xr,this.attachShadow({mode:"open"})),Yh(l(this,xr)),f(this,V,Nu).call(this,"anchor")}connectedCallback(){this.removeAttribute("popover"),this.hasAttribute("tone")||this.setAttribute("tone","light"),f(this,V,Nu).call(this,"open"),f(this,V,hi).call(this),l(this,ze)&&(f(this,V,Uu).call(this),f(this,V,Na).call(this))}disconnectedCallback(){var e;f(this,V,Fu).call(this),(e=l(this,Je))==null||e.removeAttribute("aria-expanded")}attributeChangedCallback(e){e==="open"?f(this,V,_b).call(this,this.hasAttribute("open")):e==="material"&&l(this,ze)&&(f(this,V,hi).call(this),f(this,V,Na).call(this))}get open(){return l(this,ze)}set open(e){this.toggleAttribute("open",e)}get anchor(){return l(this,Je)}set anchor(e){l(this,Je)!==e&&(l(this,Je)&&l(this,Je).removeAttribute("aria-expanded"),S(this,Je,e),f(this,V,Mu).call(this),l(this,ze)&&f(this,V,Ua).call(this))}}ze=new WeakMap,Je=new WeakMap,xr=new WeakMap,Qe=new WeakMap,io=new WeakMap,Ai=new WeakMap,$i=new WeakMap,V=new WeakSet,Mu=function(){l(this,Je)&&l(this,Je).setAttribute("aria-expanded",l(this,ze)?"true":"false")},Nu=function(e){if(!Object.prototype.hasOwnProperty.call(this,e))return;const r=this,i=r[e];delete r[e],r[e]=i},_b=function(e){var r,i,s;if(l(this,ze)!==e){if(S(this,ze,e),f(this,V,Mu).call(this),!this.isConnected){f(this,V,hi).call(this);return}e?(S(this,Ai,!0),setTimeout(()=>{S(this,Ai,!1)},0),f(this,V,hi).call(this),f(this,V,Uu).call(this),f(this,V,Na).call(this)):(f(this,V,Fu).call(this),(i=(r=l(this,Qe))==null?void 0:r.hidePopover)==null||i.call(r),f(this,V,hi).call(this),(s=l(this,Je))==null||s.focus(),this.dispatchEvent(new G2))}},Na=function(){l(this,$i)||(S(this,$i,!0),queueMicrotask(()=>{S(this,$i,!1),!(!l(this,ze)||!this.isConnected)&&(f(this,V,kb).call(this),f(this,V,Ab).call(this))}))},kb=function(){var e,r;if(l(this,Qe)){try{(r=(e=l(this,Qe)).showPopover)==null||r.call(e)}catch{}f(this,V,Ua).call(this)}},Uu=function(){document.addEventListener("click",l(this,so)),document.addEventListener("keydown",l(this,oo),!0),window.addEventListener("resize",l(this,Er)),window.addEventListener("scroll",l(this,Er),!0)},Fu=function(){document.removeEventListener("click",l(this,so)),document.removeEventListener("keydown",l(this,oo),!0),window.removeEventListener("resize",l(this,Er)),window.removeEventListener("scroll",l(this,Er),!0)},so=new WeakMap,oo=new WeakMap,Er=new WeakMap,xb=function(e){const r=f(this,V,Hu).call(this);if(r.length===0){e.preventDefault();return}const i=r[0],s=r[r.length-1],o=f(this,V,Eb).call(this),a=o instanceof HTMLElement&&r.includes(o);e.shiftKey?(!a||o===i)&&(e.preventDefault(),s.focus()):(!a||o===s)&&(e.preventDefault(),i.focus())},Hu=function(){if(!l(this,Qe))return[];const e=l(this,Qe).querySelector("slot");if(!(e instanceof HTMLSlotElement))return[];const r=[];for(const i of e.assignedElements({flatten:!0}))if(i instanceof HTMLElement){i.matches(yg)&&r.push(i);for(const s of i.querySelectorAll(yg))r.push(s)}return r},Eb=function(){var r;let e=document.activeElement;for(;e&&((r=e.shadowRoot)!=null&&r.activeElement);)e=e.shadowRoot.activeElement;return e},Ab=function(){var r;const e=f(this,V,Hu).call(this);e.length>0?e[0].focus():(r=l(this,Qe))==null||r.focus()},Ua=function(){if(!l(this,ze)||!l(this,Je)||!l(this,Qe))return;const e=l(this,Je).getBoundingClientRect(),r=l(this,Qe).getBoundingClientRect(),s=window.innerHeight-e.bottom,o=r.height+Yc,a=s<o&&e.top>o?"top-start":"bottom-start";S(this,io,a);const c=a==="bottom-start"?e.bottom+Yc:e.top-r.height-Yc,u=e.left;l(this,Qe).style.transform=`translate(${u}px, ${c}px)`,l(this,Qe).setAttribute("data-placement",a)},hi=function(){this.toggleAttribute("open",l(this,ze));const e=this.getAttribute("material")??"paper";Ce(l(this,ze)?z`<div
80
+ */const Ua=()=>new F2;class F2{}const eu=new WeakMap,Fa=Ql(class extends U2{render(n){return se}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)),se}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let e=eu.get(t);e===void 0&&(e=new WeakMap,eu.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=eu.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)}}),H2=nn('<path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M200 224H56C53.8783 224 51.8434 223.157 50.3431 221.657C48.8429 220.157 48 218.122 48 216V40C48 37.8783 48.8429 35.8434 50.3431 34.3431C51.8434 32.8429 53.8783 32 56 32H152L208 88V216C208 218.122 207.157 220.157 205.657 221.657C204.157 223.157 202.122 224 200 224Z"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M152 32V88H208"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 88H124.5"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 128H175"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 169H175"/>'),_d=nn('<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"/>'),Z2=nn('<path d="M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z"/>'),pl=nn('<path d="M213.66,93.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,82.34L128,156.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"/>'),W2=nn('<path d="M213.66,162.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,53.66,173.66L128,99.31l74.34,74.35a8,8,0,0,0,11.32-11.32Z"/>'),V2=nn({regular:'<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,64Zm0,136H40V80H216V200Z"/>',bold:'<path d="M216,60H157l27.52-27.52a12,12,0,0,0-17-17L128,55,88.49,15.51a12,12,0,0,0-17,17L99,60H40A20,20,0,0,0,20,80V200a20,20,0,0,0,20,20H216a20,20,0,0,0,20-20V80A20,20,0,0,0,216,60Zm-4,136H44V84H212Z"/>'}),B2=nn({regular:'<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"/>',bold:'<path d="M100,36H56A20,20,0,0,0,36,56v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,100,36ZM96,96H60V60H96ZM200,36H156a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,60H160V60h36Zm-96,40H56a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V156A20,20,0,0,0,100,136Zm-4,60H60V160H96Zm104-60H156a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V156A20,20,0,0,0,200,136Zm-4,60H160V160h36Z"/>'}),j2=nn('<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"/>'),_b=nn({regular:'<path d="M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm88,88H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"/>',bold:'<path d="M140,32V64a12,12,0,0,1-24,0V32a12,12,0,0,1,24,0Zm84,84H192a12,12,0,0,0,0,24h32a12,12,0,0,0,0-24Zm-42.26,48.77a12,12,0,1,0-17,17l22.63,22.63a12,12,0,0,0,17-17ZM128,180a12,12,0,0,0-12,12v32a12,12,0,0,0,24,0V192A12,12,0,0,0,128,180ZM74.26,164.77,51.63,187.4a12,12,0,0,0,17,17l22.63-22.63a12,12,0,1,0-17-17ZM76,128a12,12,0,0,0-12-12H32a12,12,0,0,0,0,24H64A12,12,0,0,0,76,128ZM68.6,51.63a12,12,0,1,0-17,17L74.26,91.23a12,12,0,0,0,17-17Z"/>'}),G2=nn('<path d="M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,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"/>');class q2 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}const Eg='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',tu=4;var ze,Je,xr,Qe,so,$i,Ti,V,ju,Gu,xb,Ha,Eb,qu,Yu,oo,ao,Er,Ab,Xu,$b,Tb,Za,hi;class kb extends HTMLElement{constructor(){super();w(this,V);w(this,ze,!1);w(this,Je,null);w(this,xr);w(this,Qe,null);w(this,so,"bottom-start");w(this,$i,!1);w(this,Ti,!1);w(this,oo,e=>{l(this,ze)&&(l(this,$i)||e.composedPath().includes(this)||(this.open=!1))});w(this,ao,e=>{if(l(this,ze)){if(e.key==="Escape"){e.preventDefault(),this.open=!1;return}e.key==="Tab"&&f(this,V,Ab).call(this,e)}});w(this,Er,()=>{l(this,ze)&&f(this,V,Za).call(this)});S(this,xr,this.attachShadow({mode:"open"})),id(l(this,xr)),f(this,V,Gu).call(this,"anchor")}connectedCallback(){this.removeAttribute("popover"),this.hasAttribute("tone")||this.setAttribute("tone","light"),f(this,V,Gu).call(this,"open"),f(this,V,hi).call(this),l(this,ze)&&(f(this,V,qu).call(this),f(this,V,Ha).call(this))}disconnectedCallback(){var e;f(this,V,Yu).call(this),(e=l(this,Je))==null||e.removeAttribute("aria-expanded")}attributeChangedCallback(e){e==="open"?f(this,V,xb).call(this,this.hasAttribute("open")):e==="material"&&l(this,ze)&&(f(this,V,hi).call(this),f(this,V,Ha).call(this))}get open(){return l(this,ze)}set open(e){this.toggleAttribute("open",e)}get anchor(){return l(this,Je)}set anchor(e){l(this,Je)!==e&&(l(this,Je)&&l(this,Je).removeAttribute("aria-expanded"),S(this,Je,e),f(this,V,ju).call(this),l(this,ze)&&f(this,V,Za).call(this))}}ze=new WeakMap,Je=new WeakMap,xr=new WeakMap,Qe=new WeakMap,so=new WeakMap,$i=new WeakMap,Ti=new WeakMap,V=new WeakSet,ju=function(){l(this,Je)&&l(this,Je).setAttribute("aria-expanded",l(this,ze)?"true":"false")},Gu=function(e){if(!Object.prototype.hasOwnProperty.call(this,e))return;const r=this,i=r[e];delete r[e],r[e]=i},xb=function(e){var r,i,s;if(l(this,ze)!==e){if(S(this,ze,e),f(this,V,ju).call(this),!this.isConnected){f(this,V,hi).call(this);return}e?(S(this,$i,!0),setTimeout(()=>{S(this,$i,!1)},0),f(this,V,hi).call(this),f(this,V,qu).call(this),f(this,V,Ha).call(this)):(f(this,V,Yu).call(this),(i=(r=l(this,Qe))==null?void 0:r.hidePopover)==null||i.call(r),f(this,V,hi).call(this),(s=l(this,Je))==null||s.focus(),this.dispatchEvent(new q2))}},Ha=function(){l(this,Ti)||(S(this,Ti,!0),queueMicrotask(()=>{S(this,Ti,!1),!(!l(this,ze)||!this.isConnected)&&(f(this,V,Eb).call(this),f(this,V,Tb).call(this))}))},Eb=function(){var e,r;if(l(this,Qe)){try{(r=(e=l(this,Qe)).showPopover)==null||r.call(e)}catch{}f(this,V,Za).call(this)}},qu=function(){document.addEventListener("click",l(this,oo)),document.addEventListener("keydown",l(this,ao),!0),window.addEventListener("resize",l(this,Er)),window.addEventListener("scroll",l(this,Er),!0)},Yu=function(){document.removeEventListener("click",l(this,oo)),document.removeEventListener("keydown",l(this,ao),!0),window.removeEventListener("resize",l(this,Er)),window.removeEventListener("scroll",l(this,Er),!0)},oo=new WeakMap,ao=new WeakMap,Er=new WeakMap,Ab=function(e){const r=f(this,V,Xu).call(this);if(r.length===0){e.preventDefault();return}const i=r[0],s=r[r.length-1],o=f(this,V,$b).call(this),a=o instanceof HTMLElement&&r.includes(o);e.shiftKey?(!a||o===i)&&(e.preventDefault(),s.focus()):(!a||o===s)&&(e.preventDefault(),i.focus())},Xu=function(){if(!l(this,Qe))return[];const e=l(this,Qe).querySelector("slot");if(!(e instanceof HTMLSlotElement))return[];const r=[];for(const i of e.assignedElements({flatten:!0}))if(i instanceof HTMLElement){i.matches(Eg)&&r.push(i);for(const s of i.querySelectorAll(Eg))r.push(s)}return r},$b=function(){var r;let e=document.activeElement;for(;e&&((r=e.shadowRoot)!=null&&r.activeElement);)e=e.shadowRoot.activeElement;return e},Tb=function(){var r;const e=f(this,V,Xu).call(this);e.length>0?e[0].focus():(r=l(this,Qe))==null||r.focus()},Za=function(){if(!l(this,ze)||!l(this,Je)||!l(this,Qe))return;const e=l(this,Je).getBoundingClientRect(),r=l(this,Qe).getBoundingClientRect(),s=window.innerHeight-e.bottom,o=r.height+tu,a=s<o&&e.top>o?"top-start":"bottom-start";S(this,so,a);const c=a==="bottom-start"?e.bottom+tu:e.top-r.height-tu,u=e.left;l(this,Qe).style.transform=`translate(${u}px, ${c}px)`,l(this,Qe).setAttribute("data-placement",a)},hi=function(){this.toggleAttribute("open",l(this,ze));const e=this.getAttribute("material")??"paper";Ce(l(this,ze)?z`<div
81
81
  class="panel"
82
82
  part="panel"
83
83
  popover="manual"
84
- data-placement=${l(this,io)}
84
+ data-placement=${l(this,so)}
85
85
  tabindex="-1"
86
86
  role="dialog"
87
87
  material=${e}
88
88
  level="1"
89
89
  >
90
90
  <slot></slot>
91
- </div>`:se,l(this,xr)),S(this,Qe,l(this,xr).querySelector(".panel"))},m(Sb,"observedAttributes",["open","material"]);customElements.get("ui-popover")||customElements.define("ui-popover",Sb);class $b extends Event{constructor(e){super("dropdown-item-select",{bubbles:!0,composed:!0});m(this,"value");this.value=e}}class q2 extends Event{constructor(e){super("select",{bubbles:!0,composed:!0});m(this,"value");this.value=e}}var et,kt,zn,On,re,ao,lo,O,Ib,xs,Cb,Rb,Zu,Pb,Es,ar,Ar,co,yl,uo,bl,Db,Lb,Wu,As,Vu,Bu,ln;class Tb extends HTMLElement{constructor(){super();w(this,O);w(this,et,!1);w(this,kt,null);w(this,zn,null);w(this,On);w(this,re,null);w(this,ao,Oa());w(this,lo,new MutationObserver(e=>f(this,O,Db).call(this,e)));w(this,Ar,()=>{f(this,O,Es).call(this,!l(this,et))});w(this,co,e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),l(this,Ar).call(this))});w(this,yl,()=>{l(this,et)&&f(this,O,Es).call(this,!1)});w(this,uo,e=>{e instanceof $b&&(e.stopPropagation(),S(this,et,!1),f(this,O,xs).call(this,e.value),f(this,O,ln).call(this),this.dispatchEvent(new q2(e.value)))});w(this,bl,()=>{f(this,O,Wu).call(this)});S(this,On,this.attachShadow({mode:"open"})),Yh(l(this,On))}connectedCallback(){this.addEventListener("dropdown-item-select",l(this,uo)),f(this,O,Ib).call(this),l(this,lo).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["selected","value","slot"]}),f(this,O,ln).call(this)}disconnectedCallback(){this.removeEventListener("dropdown-item-select",l(this,uo)),l(this,lo).disconnect(),f(this,O,Bu).call(this)}attributeChangedCallback(e){if(e==="open"){f(this,O,Es).call(this,this.hasAttribute("open"));return}f(this,O,ln).call(this)}get open(){return l(this,et)}set open(e){this.toggleAttribute("open",e)}get title(){return this.getAttribute("title")??""}get value(){return l(this,kt)}set value(e){e===null?(f(this,O,ar).call(this,null,null),f(this,O,Cb).call(this)):f(this,O,xs).call(this,e),f(this,O,ln).call(this)}close(){f(this,O,Es).call(this,!1)}}et=new WeakMap,kt=new WeakMap,zn=new WeakMap,On=new WeakMap,re=new WeakMap,ao=new WeakMap,lo=new WeakMap,O=new WeakSet,Ib=function(){var r;const e=this.querySelector("dropdown-item[selected]");e&&f(this,O,ar).call(this,e.value,((r=e.textContent)==null?void 0:r.trim())??null)},xs=function(e){var r;for(const i of l(this,O,Zu))i.value===e?(f(this,O,ar).call(this,e,((r=i.textContent)==null?void 0:r.trim())??null),i.hasAttribute("selected")||i.setAttribute("selected","")):i.hasAttribute("selected")&&i.removeAttribute("selected")},Cb=function(){const e=this.querySelectorAll("dropdown-item[selected]");for(const r of e)r.removeAttribute("selected")},Rb=function(e){for(const r of l(this,O,Zu))if(r.value===e)return r;return null},Zu=function(){return this.querySelectorAll("dropdown-item")},Pb=function(){return l(this,zn)??this.title},Es=function(e){l(this,et)!==e&&(S(this,et,e),f(this,O,ln).call(this))},ar=function(e,r){S(this,kt,e),S(this,zn,r)},Ar=new WeakMap,co=new WeakMap,yl=new WeakMap,uo=new WeakMap,bl=new WeakMap,Db=function(e){e.every(i=>i.target instanceof Element?i.target.closest('[slot="trigger"]')!==null:!1)||f(this,O,Lb).call(this)},Lb=function(){var r,i;const e=this.querySelector("dropdown-item[selected]");if(e){const s=e.value,o=((r=e.textContent)==null?void 0:r.trim())??null,a=l(this,kt)!==s||l(this,zn)!==o;f(this,O,ar).call(this,s,o),f(this,O,xs).call(this,s),a?f(this,O,ln).call(this):f(this,O,As).call(this);return}if(l(this,kt)!==null){const s=f(this,O,Rb).call(this,l(this,kt));if(s){const o=((i=s.textContent)==null?void 0:i.trim())??null,a=l(this,zn)!==o;f(this,O,ar).call(this,l(this,kt),o),f(this,O,xs).call(this,l(this,kt)),a?f(this,O,ln).call(this):f(this,O,As).call(this);return}}if(l(this,kt)!==null||l(this,zn)!==null){f(this,O,ar).call(this,null,null),f(this,O,ln).call(this);return}f(this,O,As).call(this)},Wu=function(){const e=l(this,On).querySelector('slot[name="trigger"]'),r=e instanceof HTMLSlotElement?e.assignedElements()[0]??null:null;l(this,re)!==r&&(f(this,O,Bu).call(this),S(this,re,r),l(this,re)&&(l(this,re).addEventListener("click",l(this,Ar)),l(this,re)instanceof HTMLButtonElement?l(this,re).hasAttribute("type")||(l(this,re).type="button"):(l(this,re).hasAttribute("role")||l(this,re).setAttribute("role","button"),l(this,re).hasAttribute("tabindex")||(l(this,re).tabIndex=0),l(this,re).addEventListener("keydown",l(this,co))))),f(this,O,As).call(this),f(this,O,Vu).call(this)},As=function(){l(this,re)&&(l(this,re).setAttribute("data-dropdown-trigger",""),l(this,re).setAttribute("aria-haspopup","listbox"),l(this,re).setAttribute("aria-expanded",l(this,et)?"true":"false"))},Vu=function(){const e=l(this,ao).value;if(!e)return;const r=l(this,On).querySelector("button.fallback-trigger");e.anchor=l(this,re)??r??null},Bu=function(){l(this,re)&&(l(this,re).removeEventListener("click",l(this,Ar)),l(this,re).removeEventListener("keydown",l(this,co)),l(this,re).removeAttribute("data-dropdown-trigger"),l(this,re).removeAttribute("aria-haspopup"),l(this,re).removeAttribute("aria-expanded"),S(this,re,null))},ln=function(){this.toggleAttribute("open",l(this,et)),Ce(z`
92
- <slot name="trigger" @slotchange=${l(this,bl)}>
91
+ </div>`:se,l(this,xr)),S(this,Qe,l(this,xr).querySelector(".panel"))},m(kb,"observedAttributes",["open","material"]);customElements.get("ui-popover")||customElements.define("ui-popover",kb);class Ib extends Event{constructor(e){super("dropdown-item-select",{bubbles:!0,composed:!0});m(this,"value");this.value=e}}class Y2 extends Event{constructor(e){super("select",{bubbles:!0,composed:!0});m(this,"value");this.value=e}}var et,kt,On,Mn,re,lo,co,O,Rb,Es,Pb,Db,Ku,Lb,As,lr,Ar,uo,Sl,ho,_l,zb,Ob,Ju,$s,Qu,eh,hn;class Cb extends HTMLElement{constructor(){super();w(this,O);w(this,et,!1);w(this,kt,null);w(this,On,null);w(this,Mn);w(this,re,null);w(this,lo,Ua());w(this,co,new MutationObserver(e=>f(this,O,zb).call(this,e)));w(this,Ar,()=>{f(this,O,As).call(this,!l(this,et))});w(this,uo,e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),l(this,Ar).call(this))});w(this,Sl,()=>{l(this,et)&&f(this,O,As).call(this,!1)});w(this,ho,e=>{e instanceof Ib&&(e.stopPropagation(),S(this,et,!1),f(this,O,Es).call(this,e.value),f(this,O,hn).call(this),this.dispatchEvent(new Y2(e.value)))});w(this,_l,()=>{f(this,O,Ju).call(this)});S(this,Mn,this.attachShadow({mode:"open"})),id(l(this,Mn))}connectedCallback(){this.addEventListener("dropdown-item-select",l(this,ho)),f(this,O,Rb).call(this),l(this,co).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["selected","value","slot"]}),f(this,O,hn).call(this)}disconnectedCallback(){this.removeEventListener("dropdown-item-select",l(this,ho)),l(this,co).disconnect(),f(this,O,eh).call(this)}attributeChangedCallback(e){if(e==="open"){f(this,O,As).call(this,this.hasAttribute("open"));return}f(this,O,hn).call(this)}get open(){return l(this,et)}set open(e){this.toggleAttribute("open",e)}get title(){return this.getAttribute("title")??""}get value(){return l(this,kt)}set value(e){e===null?(f(this,O,lr).call(this,null,null),f(this,O,Pb).call(this)):f(this,O,Es).call(this,e),f(this,O,hn).call(this)}close(){f(this,O,As).call(this,!1)}}et=new WeakMap,kt=new WeakMap,On=new WeakMap,Mn=new WeakMap,re=new WeakMap,lo=new WeakMap,co=new WeakMap,O=new WeakSet,Rb=function(){var r;const e=this.querySelector("dropdown-item[selected]");e&&f(this,O,lr).call(this,e.value,((r=e.textContent)==null?void 0:r.trim())??null)},Es=function(e){var r;for(const i of l(this,O,Ku))i.value===e?(f(this,O,lr).call(this,e,((r=i.textContent)==null?void 0:r.trim())??null),i.hasAttribute("selected")||i.setAttribute("selected","")):i.hasAttribute("selected")&&i.removeAttribute("selected")},Pb=function(){const e=this.querySelectorAll("dropdown-item[selected]");for(const r of e)r.removeAttribute("selected")},Db=function(e){for(const r of l(this,O,Ku))if(r.value===e)return r;return null},Ku=function(){return this.querySelectorAll("dropdown-item")},Lb=function(){return l(this,On)??this.title},As=function(e){l(this,et)!==e&&(S(this,et,e),f(this,O,hn).call(this))},lr=function(e,r){S(this,kt,e),S(this,On,r)},Ar=new WeakMap,uo=new WeakMap,Sl=new WeakMap,ho=new WeakMap,_l=new WeakMap,zb=function(e){e.every(i=>i.target instanceof Element?i.target.closest('[slot="trigger"]')!==null:!1)||f(this,O,Ob).call(this)},Ob=function(){var r,i;const e=this.querySelector("dropdown-item[selected]");if(e){const s=e.value,o=((r=e.textContent)==null?void 0:r.trim())??null,a=l(this,kt)!==s||l(this,On)!==o;f(this,O,lr).call(this,s,o),f(this,O,Es).call(this,s),a?f(this,O,hn).call(this):f(this,O,$s).call(this);return}if(l(this,kt)!==null){const s=f(this,O,Db).call(this,l(this,kt));if(s){const o=((i=s.textContent)==null?void 0:i.trim())??null,a=l(this,On)!==o;f(this,O,lr).call(this,l(this,kt),o),f(this,O,Es).call(this,l(this,kt)),a?f(this,O,hn).call(this):f(this,O,$s).call(this);return}}if(l(this,kt)!==null||l(this,On)!==null){f(this,O,lr).call(this,null,null),f(this,O,hn).call(this);return}f(this,O,$s).call(this)},Ju=function(){const e=l(this,Mn).querySelector('slot[name="trigger"]'),r=e instanceof HTMLSlotElement?e.assignedElements()[0]??null:null;l(this,re)!==r&&(f(this,O,eh).call(this),S(this,re,r),l(this,re)&&(l(this,re).addEventListener("click",l(this,Ar)),l(this,re)instanceof HTMLButtonElement?l(this,re).hasAttribute("type")||(l(this,re).type="button"):(l(this,re).hasAttribute("role")||l(this,re).setAttribute("role","button"),l(this,re).hasAttribute("tabindex")||(l(this,re).tabIndex=0),l(this,re).addEventListener("keydown",l(this,uo))))),f(this,O,$s).call(this),f(this,O,Qu).call(this)},$s=function(){l(this,re)&&(l(this,re).setAttribute("data-dropdown-trigger",""),l(this,re).setAttribute("aria-haspopup","listbox"),l(this,re).setAttribute("aria-expanded",l(this,et)?"true":"false"))},Qu=function(){const e=l(this,lo).value;if(!e)return;const r=l(this,Mn).querySelector("button.fallback-trigger");e.anchor=l(this,re)??r??null},eh=function(){l(this,re)&&(l(this,re).removeEventListener("click",l(this,Ar)),l(this,re).removeEventListener("keydown",l(this,uo)),l(this,re).removeAttribute("data-dropdown-trigger"),l(this,re).removeAttribute("aria-haspopup"),l(this,re).removeAttribute("aria-expanded"),S(this,re,null))},hn=function(){this.toggleAttribute("open",l(this,et)),Ce(z`
92
+ <slot name="trigger" @slotchange=${l(this,_l)}>
93
93
  <button
94
94
  class="fallback-trigger"
95
95
  part="trigger"
@@ -98,9 +98,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
98
98
  aria-expanded=${l(this,et)?"true":"false"}
99
99
  @click=${l(this,Ar)}
100
100
  >
101
- <span class="trigger-label" part="trigger-label">${l(this,O,Pb)}</span>
101
+ <span class="trigger-label" part="trigger-label">${l(this,O,Lb)}</span>
102
102
  <span class="trigger-icon" part="trigger-icon" aria-hidden="true">
103
- ${ul({size:16})}
103
+ ${pl({size:16})}
104
104
  </span>
105
105
  </button>
106
106
  </slot>
@@ -108,20 +108,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
108
108
  class="dropdown-popover"
109
109
  material="glass-frosted"
110
110
  ?open=${l(this,et)}
111
- @close=${l(this,yl)}
112
- ${Ma(l(this,ao))}
111
+ @close=${l(this,Sl)}
112
+ ${Fa(l(this,lo))}
113
113
  >
114
114
  ${l(this,et)?z`<div class="dropdown-list" part="list" role="listbox">
115
115
  <slot></slot>
116
116
  </div>`:se}
117
117
  </ui-popover>
118
- `,l(this,On)),f(this,O,Vu).call(this),queueMicrotask(()=>f(this,O,Wu).call(this))},m(Tb,"observedAttributes",["title","open"]);class Y2 extends HTMLElement{}class X2 extends HTMLElement{}class K2 extends HTMLElement{}var Hr,ju,Ob,ho,po;class zb extends HTMLElement{constructor(){super(...arguments);w(this,Hr);w(this,ho,()=>{this.action||f(this,Hr,Ob).call(this)});w(this,po,e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),this.click())})}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","option"),this.hasAttribute("tabindex")||(this.tabIndex=0),this.addEventListener("click",l(this,ho)),this.addEventListener("keydown",l(this,po)),f(this,Hr,ju).call(this)}disconnectedCallback(){this.removeEventListener("click",l(this,ho)),this.removeEventListener("keydown",l(this,po))}attributeChangedCallback(){f(this,Hr,ju).call(this)}get value(){return this.getAttribute("value")??""}get selected(){return this.hasAttribute("selected")}get action(){return this.hasAttribute("action")}}Hr=new WeakSet,ju=function(){if(this.action){this.setAttribute("role","button"),this.removeAttribute("aria-selected");return}this.setAttribute("role","option"),this.setAttribute("aria-selected",this.selected?"true":"false")},Ob=function(){this.dispatchEvent(new $b(this.value))},ho=new WeakMap,po=new WeakMap,m(zb,"observedAttributes",["action","selected","value"]);customElements.get("dropdown-menu")||customElements.define("dropdown-menu",Tb);customElements.get("dropdown-group")||customElements.define("dropdown-group",Y2);customElements.get("dropdown-label")||customElements.define("dropdown-label",X2);customElements.get("dropdown-divider")||customElements.define("dropdown-divider",K2);customElements.get("dropdown-item")||customElements.define("dropdown-item",zb);class J2 extends Event{constructor(e){super("rename",{bubbles:!0,composed:!0});m(this,"value");this.value=e}}var Vt,xt,ie,Oe,$s,fo,Gu,Fa,qu,go,mo,vo;class Mb extends HTMLElement{constructor(){super(...arguments);w(this,Oe);w(this,Vt,"");w(this,xt,!1);w(this,ie,null);w(this,fo,e=>{l(this,xt)||(e.preventDefault(),f(this,Oe,Gu).call(this))});w(this,go,e=>{e.stopPropagation()});w(this,mo,e=>{var r,i;e.key==="Enter"?(e.preventDefault(),f(this,Oe,Fa).call(this,!0),(r=l(this,ie))==null||r.blur()):e.key==="Escape"&&(e.preventDefault(),f(this,Oe,Fa).call(this,!1),(i=l(this,ie))==null||i.blur())});w(this,vo,()=>{f(this,Oe,Fa).call(this,!0)})}connectedCallback(){l(this,ie)||(S(this,ie,document.createElement("span")),l(this,ie).className="editable-text-span",this.append(l(this,ie)));const e=this.getAttribute("value");e!==null&&S(this,Vt,e),f(this,Oe,$s).call(this),this.addEventListener("dblclick",l(this,fo))}disconnectedCallback(){this.removeEventListener("dblclick",l(this,fo)),l(this,xt)&&f(this,Oe,qu).call(this)}attributeChangedCallback(e){if(e==="value"){const r=this.getAttribute("value")??"";S(this,Vt,r),l(this,xt)||f(this,Oe,$s).call(this)}}get value(){return l(this,Vt)}set value(e){S(this,Vt,e),l(this,xt)||f(this,Oe,$s).call(this)}startEditing(){l(this,xt)||f(this,Oe,Gu).call(this)}}Vt=new WeakMap,xt=new WeakMap,ie=new WeakMap,Oe=new WeakSet,$s=function(){l(this,ie)&&(l(this,ie).textContent=l(this,Vt))},fo=new WeakMap,Gu=function(){l(this,ie)&&(S(this,xt,!0),l(this,ie).setAttribute("contenteditable","plaintext-only"),l(this,ie).setAttribute("spellcheck","false"),l(this,ie).addEventListener("keydown",l(this,mo)),l(this,ie).addEventListener("blur",l(this,vo)),l(this,ie).addEventListener("mousedown",l(this,go)),this.toggleAttribute("data-editing",!0),queueMicrotask(()=>{var r;if(!l(this,ie))return;l(this,ie).focus();const e=(r=this.ownerDocument.defaultView)==null?void 0:r.getSelection();e==null||e.selectAllChildren(l(this,ie))}))},Fa=function(e){if(!l(this,xt)||!l(this,ie))return;const r=(l(this,ie).textContent??"").trim();S(this,xt,!1),l(this,ie).removeAttribute("contenteditable"),l(this,ie).removeAttribute("spellcheck"),this.toggleAttribute("data-editing",!1),f(this,Oe,qu).call(this),e&&r.length>0&&r!==l(this,Vt)&&(S(this,Vt,r),this.dispatchEvent(new J2(r))),f(this,Oe,$s).call(this)},qu=function(){var e,r,i;(e=l(this,ie))==null||e.removeEventListener("keydown",l(this,mo)),(r=l(this,ie))==null||r.removeEventListener("blur",l(this,vo)),(i=l(this,ie))==null||i.removeEventListener("mousedown",l(this,go))},go=new WeakMap,mo=new WeakMap,vo=new WeakMap,m(Mb,"observedAttributes",["value"]);customElements.get("editable-text")||customElements.define("editable-text",Mb);class Q2 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}var yo,Gn,Yu,wl,bo,Xu;class Nb extends HTMLElement{constructor(){super();w(this,Gn);w(this,yo);w(this,wl,e=>{e.target===e.currentTarget&&f(this,Gn,Yu).call(this)});w(this,bo,e=>{this.open&&e.key==="Escape"&&f(this,Gn,Yu).call(this)});S(this,yo,this.attachShadow({mode:"open"}))}connectedCallback(){document.addEventListener("keydown",l(this,bo)),f(this,Gn,Xu).call(this)}disconnectedCallback(){document.removeEventListener("keydown",l(this,bo))}attributeChangedCallback(){f(this,Gn,Xu).call(this)}get open(){return this.hasAttribute("open")}}yo=new WeakMap,Gn=new WeakSet,Yu=function(){this.dispatchEvent(new Q2)},wl=new WeakMap,bo=new WeakMap,Xu=function(){Ce(z`
118
+ `,l(this,Mn)),f(this,O,Qu).call(this),queueMicrotask(()=>f(this,O,Ju).call(this))},m(Cb,"observedAttributes",["title","open"]);class X2 extends HTMLElement{}class K2 extends HTMLElement{}class J2 extends HTMLElement{}var Hr,th,Nb,po,fo;class Mb extends HTMLElement{constructor(){super(...arguments);w(this,Hr);w(this,po,()=>{this.action||f(this,Hr,Nb).call(this)});w(this,fo,e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),this.click())})}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","option"),this.hasAttribute("tabindex")||(this.tabIndex=0),this.addEventListener("click",l(this,po)),this.addEventListener("keydown",l(this,fo)),f(this,Hr,th).call(this)}disconnectedCallback(){this.removeEventListener("click",l(this,po)),this.removeEventListener("keydown",l(this,fo))}attributeChangedCallback(){f(this,Hr,th).call(this)}get value(){return this.getAttribute("value")??""}get selected(){return this.hasAttribute("selected")}get action(){return this.hasAttribute("action")}}Hr=new WeakSet,th=function(){if(this.action){this.setAttribute("role","button"),this.removeAttribute("aria-selected");return}this.setAttribute("role","option"),this.setAttribute("aria-selected",this.selected?"true":"false")},Nb=function(){this.dispatchEvent(new Ib(this.value))},po=new WeakMap,fo=new WeakMap,m(Mb,"observedAttributes",["action","selected","value"]);customElements.get("dropdown-menu")||customElements.define("dropdown-menu",Cb);customElements.get("dropdown-group")||customElements.define("dropdown-group",X2);customElements.get("dropdown-label")||customElements.define("dropdown-label",K2);customElements.get("dropdown-divider")||customElements.define("dropdown-divider",J2);customElements.get("dropdown-item")||customElements.define("dropdown-item",Mb);class Q2 extends Event{constructor(e){super("rename",{bubbles:!0,composed:!0});m(this,"value");this.value=e}}var Gt,xt,ie,Oe,Ts,go,nh,Wa,rh,mo,vo,yo;class Ub extends HTMLElement{constructor(){super(...arguments);w(this,Oe);w(this,Gt,"");w(this,xt,!1);w(this,ie,null);w(this,go,e=>{l(this,xt)||(e.preventDefault(),f(this,Oe,nh).call(this))});w(this,mo,e=>{e.stopPropagation()});w(this,vo,e=>{var r,i;e.key==="Enter"?(e.preventDefault(),f(this,Oe,Wa).call(this,!0),(r=l(this,ie))==null||r.blur()):e.key==="Escape"&&(e.preventDefault(),f(this,Oe,Wa).call(this,!1),(i=l(this,ie))==null||i.blur())});w(this,yo,()=>{f(this,Oe,Wa).call(this,!0)})}connectedCallback(){l(this,ie)||(S(this,ie,document.createElement("span")),l(this,ie).className="editable-text-span",this.append(l(this,ie)));const e=this.getAttribute("value");e!==null&&S(this,Gt,e),f(this,Oe,Ts).call(this),this.addEventListener("dblclick",l(this,go))}disconnectedCallback(){this.removeEventListener("dblclick",l(this,go)),l(this,xt)&&f(this,Oe,rh).call(this)}attributeChangedCallback(e){if(e==="value"){const r=this.getAttribute("value")??"";S(this,Gt,r),l(this,xt)||f(this,Oe,Ts).call(this)}}get value(){return l(this,Gt)}set value(e){S(this,Gt,e),l(this,xt)||f(this,Oe,Ts).call(this)}startEditing(){l(this,xt)||f(this,Oe,nh).call(this)}}Gt=new WeakMap,xt=new WeakMap,ie=new WeakMap,Oe=new WeakSet,Ts=function(){l(this,ie)&&(l(this,ie).textContent=l(this,Gt))},go=new WeakMap,nh=function(){l(this,ie)&&(S(this,xt,!0),l(this,ie).setAttribute("contenteditable","plaintext-only"),l(this,ie).setAttribute("spellcheck","false"),l(this,ie).addEventListener("keydown",l(this,vo)),l(this,ie).addEventListener("blur",l(this,yo)),l(this,ie).addEventListener("mousedown",l(this,mo)),this.toggleAttribute("data-editing",!0),queueMicrotask(()=>{var r;if(!l(this,ie))return;l(this,ie).focus();const e=(r=this.ownerDocument.defaultView)==null?void 0:r.getSelection();e==null||e.selectAllChildren(l(this,ie))}))},Wa=function(e){if(!l(this,xt)||!l(this,ie))return;const r=(l(this,ie).textContent??"").trim();S(this,xt,!1),l(this,ie).removeAttribute("contenteditable"),l(this,ie).removeAttribute("spellcheck"),this.toggleAttribute("data-editing",!1),f(this,Oe,rh).call(this),e&&r.length>0&&r!==l(this,Gt)&&(S(this,Gt,r),this.dispatchEvent(new Q2(r))),f(this,Oe,Ts).call(this)},rh=function(){var e,r,i;(e=l(this,ie))==null||e.removeEventListener("keydown",l(this,vo)),(r=l(this,ie))==null||r.removeEventListener("blur",l(this,yo)),(i=l(this,ie))==null||i.removeEventListener("mousedown",l(this,mo))},mo=new WeakMap,vo=new WeakMap,yo=new WeakMap,m(Ub,"observedAttributes",["value"]);customElements.get("editable-text")||customElements.define("editable-text",Ub);class ez extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}var bo,qn,ih,kl,wo,sh;class Fb extends HTMLElement{constructor(){super();w(this,qn);w(this,bo);w(this,kl,e=>{e.target===e.currentTarget&&f(this,qn,ih).call(this)});w(this,wo,e=>{this.open&&e.key==="Escape"&&f(this,qn,ih).call(this)});S(this,bo,this.attachShadow({mode:"open"}))}connectedCallback(){document.addEventListener("keydown",l(this,wo)),f(this,qn,sh).call(this)}disconnectedCallback(){document.removeEventListener("keydown",l(this,wo))}attributeChangedCallback(){f(this,qn,sh).call(this)}get open(){return this.hasAttribute("open")}}bo=new WeakMap,qn=new WeakSet,ih=function(){this.dispatchEvent(new ez)},kl=new WeakMap,wo=new WeakMap,sh=function(){Ce(z`
119
119
  ${this.open?z`
120
- <div class="backdrop" part="backdrop" @click=${l(this,wl)}>
120
+ <div class="backdrop" part="backdrop" @click=${l(this,kl)}>
121
121
  <slot></slot>
122
122
  </div>
123
123
  `:null}
124
- `,l(this,yo))},m(Nb,"observedAttributes",["open"]);customElements.get("modal-overlay")||customElements.define("modal-overlay",Nb);const ez=16,Xc=24,tz=32;var Ti;class Ub extends HTMLElement{constructor(){super();w(this,Ti);S(this,Ti,this.attachShadow({mode:"open"})),Yh(l(this,Ti))}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}getSize(){const e=this.getAttribute("size");if(e===null)return Xc;const r=Number(e);return r===ez||r===Xc||r===tz?r:Xc}getWeight(){return this.getAttribute("weight")==="bold"?"bold":"regular"}render(){Ce(z`<span class="spin">${wb({size:this.getSize(),weight:this.getWeight()})}</span>`,l(this,Ti))}}Ti=new WeakMap,m(Ub,"observedAttributes",["size","weight"]);customElements.get("ui-spinner")||customElements.define("ui-spinner",Ub);class nz extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}class rz extends HTMLElement{}var wo,So,Ku;class Fb extends HTMLElement{constructor(){super();w(this,So);w(this,wo);S(this,wo,this.attachShadow({mode:"open"}))}connectedCallback(){f(this,So,Ku).call(this)}attributeChangedCallback(){f(this,So,Ku).call(this)}get closable(){return this.hasAttribute("closable")}}wo=new WeakMap,So=new WeakSet,Ku=function(){const e=this.querySelector("panel-page");Ce(z`
124
+ `,l(this,bo))},m(Fb,"observedAttributes",["open"]);customElements.get("modal-overlay")||customElements.define("modal-overlay",Fb);const tz=16,nu=24,nz=32;var Ii;class Hb extends HTMLElement{constructor(){super();w(this,Ii);S(this,Ii,this.attachShadow({mode:"open"})),id(l(this,Ii))}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}getSize(){const e=this.getAttribute("size");if(e===null)return nu;const r=Number(e);return r===tz||r===nu||r===nz?r:nu}getWeight(){return this.getAttribute("weight")==="bold"?"bold":"regular"}render(){Ce(z`<span class="spin">${_b({size:this.getSize(),weight:this.getWeight()})}</span>`,l(this,Ii))}}Ii=new WeakMap,m(Hb,"observedAttributes",["size","weight"]);customElements.get("ui-spinner")||customElements.define("ui-spinner",Hb);class rz extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}class iz extends HTMLElement{}var So,_o,oh;class Zb extends HTMLElement{constructor(){super();w(this,_o);w(this,So);S(this,So,this.attachShadow({mode:"open"}))}connectedCallback(){f(this,_o,oh).call(this)}attributeChangedCallback(){f(this,_o,oh).call(this)}get closable(){return this.hasAttribute("closable")}}So=new WeakMap,_o=new WeakSet,oh=function(){const e=this.querySelector("panel-page");Ce(z`
125
125
  <section class="panel" part="panel">
126
126
  <header class="title-bar" part="header">
127
127
  <h2 class="title" part="title">${(e==null?void 0:e.getAttribute("title"))??""}</h2>
@@ -131,16 +131,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
131
131
  class="title-button"
132
132
  part="button close-button"
133
133
  aria-label="Close"
134
- @click=${()=>this.dispatchEvent(new nz)}
134
+ @click=${()=>this.dispatchEvent(new rz)}
135
135
  >
136
- <span class="close-icon" part="icon close-icon">${pd({size:16})}</span>
136
+ <span class="close-icon" part="icon close-icon">${_d({size:16})}</span>
137
137
  </button>
138
138
  `:null}
139
139
  </header>
140
140
  <slot></slot>
141
141
  </section>
142
- `,l(this,wo))},m(Fb,"observedAttributes",["closable"]);customElements.get("panel-view")||customElements.define("panel-view",Fb);customElements.get("panel-page")||customElements.define("panel-page",rz);function Kl(n){return typeof n=="object"&&n!==null}function iz(n){return!Kl(n)||n.type!=="wheel"||typeof n.deltaX!="number"||typeof n.deltaY!="number"||typeof n.shiftKey!="boolean"?!1:!("id"in n)}function sz(n){return!Kl(n)||n.type!=="swipe-move"||typeof n.deltaX!="number"?!1:!("id"in n)}function oz(n){return!Kl(n)||n.type!=="swipe-end"||typeof n.velocityX!="number"?!1:!("id"in n)}function Hb(n){return!Kl(n)||n.type!=="open-artifact"||typeof n.artifactID!="string"?!1:!("id"in n)}function az(n=window){if(n.parent===n)return;let t=0,e=0;n.document.documentElement&&(n.document.documentElement.style.touchAction="pan-y"),n.addEventListener("wheel",u=>{const h=u;t=h.clientX,e=h.clientY,n.parent.postMessage({type:"wheel",deltaX:h.deltaX,deltaY:h.deltaY,shiftKey:h.shiftKey},"*"),h.preventDefault()},{passive:!1});const r=8,i=100,s=1e3,o=new Map;n.addEventListener("pointerdown",u=>{const h=u;h.pointerType==="touch"&&o.set(h.pointerId,{startX:h.clientX,startY:h.clientY,lastX:h.clientX,offset:0,active:!1,discarded:!1,samples:[{time:h.timeStamp,offset:0}]})},{passive:!0}),n.addEventListener("pointermove",u=>{const h=u,p=o.get(h.pointerId);if(!p||p.discarded)return;if(!p.active){const k=h.clientX-p.startX,T=h.clientY-p.startY,P=Math.abs(k),R=Math.abs(T);if(P<r&&R<r)return;if(R>=P){p.discarded=!0;return}p.active=!0}const v=h.clientX-p.lastX;p.lastX=h.clientX,p.offset+=v,p.samples.push({time:h.timeStamp,offset:p.offset});const g=h.timeStamp-i;let _=0;for(let k=0;k<p.samples.length;k+=1){if(p.samples[k].time>=g){_=k;break}_=k+1}if(_>0){const k=Math.max(0,_-1);p.samples.splice(0,k)}n.parent.postMessage({type:"swipe-move",deltaX:v},"*"),h.preventDefault()},{passive:!1}),n.addEventListener("pointerup",u=>{const h=u,p=o.get(h.pointerId);if(!p||(o.delete(h.pointerId),!p.active))return;let v=0;if(p.samples.length>=2){const g=p.samples[0],_=p.samples[p.samples.length-1],k=_.time-g.time;k>0&&(v=(_.offset-g.offset)/k*s)}n.parent.postMessage({type:"swipe-end",velocityX:v},"*")}),n.addEventListener("pointercancel",u=>{const h=u,p=o.get(h.pointerId);p&&(o.delete(h.pointerId),p.active&&n.parent.postMessage({type:"swipe-end",velocityX:0},"*"))}),n.addEventListener("message",u=>{var k,T;const h=u.data;if(h===null||typeof h!="object"||h.type!=="scroll")return;const p=h,v=typeof p.deltaX=="number"?p.deltaX:0,g=typeof p.deltaY=="number"?p.deltaY:0;let _=((T=(k=n.document).elementFromPoint)==null?void 0:T.call(k,t,e))??null;for(;_!==null;){const P=n.getComputedStyle(_);if(g!==0){const R=(P.overflowY==="auto"||P.overflowY==="scroll")&&_.scrollHeight>_.clientHeight,Z=g>0?_.scrollTop+_.clientHeight<_.scrollHeight:_.scrollTop>0;if(R&&Z){_.scrollBy(v,g);return}}if(v!==0){const R=(P.overflowX==="auto"||P.overflowX==="scroll")&&_.scrollWidth>_.clientWidth,Z=v>0?_.scrollLeft+_.clientWidth<_.scrollWidth:_.scrollLeft>0;if(R&&Z){_.scrollBy(v,g);return}}_=_.parentElement}n.scrollBy(v,g)});function a(u){if(typeof u!="string")return!1;let h;try{h=new URL(u)}catch{return!1}if(h.protocol!=="artifact:")return!1;const p=h.hostname||h.pathname.replace(/^\/+/,"");return p===""?!1:(n.parent.postMessage({type:"open-artifact",artifactID:p},"*"),!0)}n.document.addEventListener("click",u=>{const h=u,p=typeof h.composedPath=="function"?h.composedPath():[];let v=null;for(const k of p)if(k instanceof HTMLAnchorElement||k&&k.tagName==="A"){v=k;break}if(v===null)return;const g=v.getAttribute("href");if(g===null)return;let _;try{_=new URL(g,n.document.baseURI).toString()}catch{return}a(_)&&u.preventDefault()},!0);const c=n.navigation;c&&c.addEventListener("navigate",u=>{var p;a((p=u.destination)==null?void 0:p.url)&&u.preventDefault()})}function lz(){return`(${az.toString()})(window);`}const cz=Fe(),uz=Fe(),hz="No handler registered for update-content",dz="handleUpdateContent: handler already registered";function pz(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const fz=Bo(Jt);var Ii,Ci,Ri,$r,Tr,_o,Me,Ju,Zb,Wb,Ts,Qu,em;let gz=(em=class extends fz{constructor(e){super();w(this,Me);w(this,Ii);w(this,Ci);w(this,Ri);w(this,$r,null);w(this,Tr,null);w(this,_o,!1);S(this,Ii,e);const r=e.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");S(this,Ci,r),S(this,Ri,i=>f(this,Me,Zb).call(this,i)),l(this,Ci).addEventListener("message",l(this,Ri))}get content(){return l(this,Tr)}set content(e){f(this,Me,Qu).call(this),S(this,Tr,e),l(this,_o)&&f(this,Me,Ju).call(this,e)}handleUpdateContent(e){if(f(this,Me,Qu).call(this),l(this,$r)!==null)throw new Error(dz);S(this,$r,e)}dispose(){l(this,Ci).removeEventListener("message",l(this,Ri)),S(this,$r,null)}},Ii=new WeakMap,Ci=new WeakMap,Ri=new WeakMap,$r=new WeakMap,Tr=new WeakMap,_o=new WeakMap,Me=new WeakSet,Ju=function(e){const r={type:"content-updated",content:e};f(this,Me,Ts).call(this,r)},Zb=function(e){if(this.disposed||e.source!==l(this,Ii).contentWindow)return;const r=e.data;if(pR(r)){S(this,_o,!0),this.dispatchEvent(new cz("ready")),l(this,Tr)!==null&&f(this,Me,Ju).call(this,l(this,Tr));return}if(fR(r)){f(this,Me,Wb).call(this,r);return}if(Hb(r)){this.dispatchEvent(new uz("open-artifact",{artifactID:r.artifactID}));return}},Wb=async function(e){const r=l(this,$r);if(r===null){f(this,Me,Ts).call(this,{type:"response",id:e.id,error:{message:hz}});return}try{await r(e.content)}catch(i){if(this.disposed)return;f(this,Me,Ts).call(this,{type:"response",id:e.id,error:{message:pz(i)}});return}this.disposed||f(this,Me,Ts).call(this,{type:"response",id:e.id,result:{}})},Ts=function(e){const r=l(this,Ii).contentWindow;r&&r.postMessage(e,"*")},Qu=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},em);const mz="text/html";async function vz(n){const t=await fetch(n);if(!t.ok)throw new Error(`Failed to fetch artifact content: ${t.status}`);const e=await t.text(),r=new DOMParser().parseFromString(e,"text/html"),i=r.createElement("base");i.href=new URL(n,window.location.href).href,r.head.insertBefore(i,r.head.firstChild);const s=r.createElement("script");s.textContent=lz(),r.head.appendChild(s);const o=new Blob([`<!DOCTYPE html>
143
- ${r.documentElement.outerHTML}`],{type:mz});return URL.createObjectURL(o)}const bg="television-artifact-bridge",yz="_tvThemeBuster",Vb=Fe(),bz=Fe();class wz extends HTMLElement{constructor(){super(...arguments);m(this,"_artifact",null);m(this,"_viewURL",null);m(this,"_contentURL",null);m(this,"_screen",null);m(this,"_subscribedScreen",null);m(this,"_subscribedServer",null);m(this,"_activeView",null);m(this,"_contentState",{kind:"idle"});m(this,"_fetchSequence",0);m(this,"_blobSequence",0);m(this,"_themeReloadSequence",0);m(this,"_mountedViewURL",null);m(this,"_mountedDirectRenderURL",null);m(this,"_mountedDirectRenderStatus",null);m(this,"_directRender",!1);m(this,"_blobURL",null);m(this,"_subscribedWebview",null);m(this,"_directRenderMessageListener",null);m(this,"handleScreenContentChanged",e=>{if(!(!this._artifact||e.artifactID!==this._artifact.id)){if(this._activeView!==null){this.refetchContent();return}this._directRender&&this._contentURL!==null&&this._artifact.status==="committed"&&this.loadBlobFrame(this._contentURL)}});m(this,"handleServerEvent",e=>{const r=this._screen;if(!r||e.event.type!=="theme-changed"||e.serverURL!==r.server.url)return;const i=this.themeReloadSourceURL();i!==null&&(this._themeReloadSequence+=1,this.loadBlobFrame(this.withThemeBuster(i,this._themeReloadSequence)))});m(this,"handleOpenArtifact",e=>{this.requestFocus(e.artifactID)});m(this,"handleIframeMessage",e=>{const r=this.querySelector("iframe.artifact-frame");!r||r.contentWindow!==e.source||iz(e.data)&&this.dispatchArtifactWheel({deltaX:e.data.deltaX,deltaY:e.data.deltaY,shiftKey:e.data.shiftKey},i=>{var o;const s={type:"scroll",deltaX:0,deltaY:i};(o=r.contentWindow)==null||o.postMessage(s,this.iframeTargetOrigin(r))})});m(this,"handleWebviewIpcMessage",e=>{var o;const r=e.detail??e;if(!r||r.channel!==bg)return;const i=(o=r.args)==null?void 0:o[0];if(!i||i.type!=="wheel")return;const s=this._subscribedWebview;s&&this.dispatchArtifactWheel({deltaX:i.deltaX??0,deltaY:i.deltaY??0,shiftKey:i.shiftKey??!1},a=>{var c;(c=s.send)==null||c.call(s,bg,{type:"scroll",deltaX:0,deltaY:a})})})}set artifact(e){const r=this._artifact;this._artifact=e,this.render(),r!==null&&r!==e&&this.syncView()}get artifact(){return this._artifact}set viewURL(e){this._viewURL!==e&&(this._viewURL=e,this.syncView())}get viewURL(){return this._viewURL}set contentURL(e){this._contentURL!==e&&(this._contentURL=e,this.syncView())}get contentURL(){return this._contentURL}set screen(e){this._screen!==e&&(this._screen=e,this.syncScreenSubscription(),this.syncServerSubscription())}get screen(){return this._screen}get activeView(){return this._activeView}connectedCallback(){this.setAttribute("level","2"),this.render(),this.syncView(),this.syncScreenSubscription(),this.syncServerSubscription(),window.addEventListener("message",this.handleIframeMessage)}disconnectedCallback(){this.teardownView(),this.unsubscribeFromScreen(),this.unsubscribeFromServer(),window.removeEventListener("message",this.handleIframeMessage),this.unsubscribeFromWebview()}handleClose(){this._artifact&&this.dispatchEvent(new Vb("close-artifact",{artifactID:this._artifact.id,bubbles:!0,composed:!0}))}syncView(){if(!this.isConnected)return;const e=this._artifact;if(!e){this.teardownView(),this._contentState={kind:"idle"},this.render();return}switch(e.kind){case"url":this.teardownView(),this._contentState={kind:"ready"},this.render();return}if(this._viewURL!==null){if(this._directRender&&this.teardownView(),this._mountedViewURL!==this._viewURL){this.teardownView(),this._contentState={kind:"loading"},this._mountedViewURL=this._viewURL,this.render();const r=this.querySelector("iframe.artifact-frame");if(!r){this._contentState={kind:"error"},this.render();return}this._activeView=new gz(r),this._activeView.handleUpdateContent(async i=>{await this.saveContent(i)}),this._activeView.addEventListener("open-artifact",this.handleOpenArtifact),this.loadBlobFrame(this._viewURL),this.startContentFetch();return}this._activeView!==null&&this.startContentFetch();return}if(this._contentURL!==null){if(!this._directRender||this._mountedDirectRenderURL!==this._contentURL){this.teardownView(),this._directRender=!0,this._mountedDirectRenderURL=this._contentURL,this._contentState={kind:"idle"},this.render(),this.installDirectRenderMessageListener(),e.status==="committed"&&(this._mountedDirectRenderStatus="committed",this.loadBlobFrame(this._contentURL));return}this.installDirectRenderMessageListener(),e.status==="committed"&&this._mountedDirectRenderStatus!=="committed"&&(this._mountedDirectRenderStatus="committed",this.loadBlobFrame(this._contentURL));return}this.teardownView(),this._contentState={kind:"idle"},this.render()}async saveContent(e){const r=this._screen,i=this._artifact;if(!r||!i)throw new Error("artifact-view: cannot save without a screen and artifact");await r.server.client.artifacts.putContent({artifactID:i.id,content:e})}syncScreenSubscription(){if(!this.isConnected){this.unsubscribeFromScreen();return}this._subscribedScreen!==this._screen&&(this.unsubscribeFromScreen(),this._screen!==null&&(this._screen.addEventListener("artifact-content-changed",this.handleScreenContentChanged),this._subscribedScreen=this._screen))}syncServerSubscription(){var r;if(!this.isConnected){this.unsubscribeFromServer();return}const e=((r=this._screen)==null?void 0:r.server)??null;this._subscribedServer!==e&&(this.unsubscribeFromServer(),e!==null&&(e.addEventListener("server-event",this.handleServerEvent),this._subscribedServer=e))}unsubscribeFromScreen(){this._subscribedScreen!==null&&(this._subscribedScreen.removeEventListener("artifact-content-changed",this.handleScreenContentChanged),this._subscribedScreen=null)}unsubscribeFromServer(){this._subscribedServer!==null&&(this._subscribedServer.removeEventListener("server-event",this.handleServerEvent),this._subscribedServer=null)}themeReloadSourceURL(){var e;return this._viewURL!==null?this._activeView!==null?this._viewURL:null:this._directRender&&this._contentURL!==null&&((e=this._artifact)==null?void 0:e.status)==="committed"?this._contentURL:null}withThemeBuster(e,r){const i=new URL(e,window.location.href);return i.searchParams.set(yz,String(r)),i.toString()}startContentFetch(){this._fetchSequence+=1;const e=this._fetchSequence,r=this._contentURL,i=this._activeView;if(!i||r===null){this._contentState={kind:"error"},this.render();return}this._contentState={kind:"loading"},(async()=>{try{const s=await fetch(r);if(e!==this._fetchSequence)return;if(!s.ok){this._contentState={kind:"error"},this.teardownView(),this.render();return}const o=await s.text();if(e!==this._fetchSequence||this._activeView!==i)return;this._activeView.content=o,this._contentState={kind:"ready"}}catch{if(e!==this._fetchSequence)return;this._contentState={kind:"error"},this.teardownView(),this.render()}})()}refetchContent(){this._fetchSequence+=1;const e=this._fetchSequence,r=this._contentURL,i=this._activeView;!i||r===null||(async()=>{try{const s=await fetch(r);if(e!==this._fetchSequence||!s.ok)return;const o=await s.text();if(e!==this._fetchSequence||this._activeView!==i)return;this._activeView.content=o}catch{}})()}loadBlobFrame(e){this._blobSequence+=1;const r=this._blobSequence;(async()=>{try{const i=await vz(e);if(r!==this._blobSequence){URL.revokeObjectURL(i);return}const s=this._blobURL;this._blobURL=i,this.render();const o=this.querySelector("iframe.artifact-frame");o&&(o.src=i),s!==null&&s!==i&&URL.revokeObjectURL(s)}catch{if(r!==this._blobSequence)return;this._contentState={kind:"error"},this.teardownView(),this.render()}})()}teardownView(){this._activeView!==null&&(this._activeView.removeEventListener("open-artifact",this.handleOpenArtifact),this._activeView.dispose(),this._activeView=null),this.removeDirectRenderMessageListener(),this._blobURL!==null&&(URL.revokeObjectURL(this._blobURL),this._blobURL=null),this._mountedViewURL=null,this._mountedDirectRenderURL=null,this._mountedDirectRenderStatus=null,this._directRender=!1,this._fetchSequence+=1,this._blobSequence+=1}installDirectRenderMessageListener(){if(this._directRenderMessageListener!==null)return;const e=r=>{const i=this.querySelector("iframe.artifact-frame");i&&r.source===i.contentWindow&&Hb(r.data)&&this.requestFocus(r.data.artifactID)};this._directRenderMessageListener=e,window.addEventListener("message",e)}removeDirectRenderMessageListener(){this._directRenderMessageListener!==null&&(window.removeEventListener("message",this._directRenderMessageListener),this._directRenderMessageListener=null)}requestFocus(e){const r=this._screen;r&&r.server.client.display.focus({artifactID:e}).catch(i=>{console.warn("artifact-view: display.focus failed",i)})}contentTemplate(){const e=this._artifact;if((e==null?void 0:e.kind)==="url"){const r=e.externalURL;if(!r)throw new Error(`URL artifact ${e.id} is missing externalURL`);return cd()?z`
142
+ `,l(this,So))},m(Zb,"observedAttributes",["closable"]);customElements.get("panel-view")||customElements.define("panel-view",Zb);customElements.get("panel-page")||customElements.define("panel-page",iz);function ec(n){return typeof n=="object"&&n!==null}function sz(n){return!ec(n)||n.type!=="wheel"||typeof n.deltaX!="number"||typeof n.deltaY!="number"||typeof n.shiftKey!="boolean"?!1:!("id"in n)}function oz(n){return!ec(n)||n.type!=="swipe-move"||typeof n.deltaX!="number"?!1:!("id"in n)}function az(n){return!ec(n)||n.type!=="swipe-end"||typeof n.velocityX!="number"?!1:!("id"in n)}function Wb(n){return!ec(n)||n.type!=="open-artifact"||typeof n.artifactID!="string"?!1:!("id"in n)}function lz(n=window){if(n.parent===n)return;let t=0,e=0;n.document.documentElement&&(n.document.documentElement.style.touchAction="pan-y"),n.addEventListener("wheel",u=>{const h=u;t=h.clientX,e=h.clientY,n.parent.postMessage({type:"wheel",deltaX:h.deltaX,deltaY:h.deltaY,shiftKey:h.shiftKey},"*"),h.preventDefault()},{passive:!1});const r=8,i=100,s=1e3,o=new Map;n.addEventListener("pointerdown",u=>{const h=u;h.pointerType==="touch"&&o.set(h.pointerId,{startX:h.clientX,startY:h.clientY,lastX:h.clientX,offset:0,active:!1,discarded:!1,samples:[{time:h.timeStamp,offset:0}]})},{passive:!0}),n.addEventListener("pointermove",u=>{const h=u,p=o.get(h.pointerId);if(!p||p.discarded)return;if(!p.active){const k=h.clientX-p.startX,I=h.clientY-p.startY,P=Math.abs(k),R=Math.abs(I);if(P<r&&R<r)return;if(R>=P){p.discarded=!0;return}p.active=!0}const v=h.clientX-p.lastX;p.lastX=h.clientX,p.offset+=v,p.samples.push({time:h.timeStamp,offset:p.offset});const g=h.timeStamp-i;let _=0;for(let k=0;k<p.samples.length;k+=1){if(p.samples[k].time>=g){_=k;break}_=k+1}if(_>0){const k=Math.max(0,_-1);p.samples.splice(0,k)}n.parent.postMessage({type:"swipe-move",deltaX:v},"*"),h.preventDefault()},{passive:!1}),n.addEventListener("pointerup",u=>{const h=u,p=o.get(h.pointerId);if(!p||(o.delete(h.pointerId),!p.active))return;let v=0;if(p.samples.length>=2){const g=p.samples[0],_=p.samples[p.samples.length-1],k=_.time-g.time;k>0&&(v=(_.offset-g.offset)/k*s)}n.parent.postMessage({type:"swipe-end",velocityX:v},"*")}),n.addEventListener("pointercancel",u=>{const h=u,p=o.get(h.pointerId);p&&(o.delete(h.pointerId),p.active&&n.parent.postMessage({type:"swipe-end",velocityX:0},"*"))}),n.addEventListener("message",u=>{var k,I;const h=u.data;if(h===null||typeof h!="object"||h.type!=="scroll")return;const p=h,v=typeof p.deltaX=="number"?p.deltaX:0,g=typeof p.deltaY=="number"?p.deltaY:0;let _=((I=(k=n.document).elementFromPoint)==null?void 0:I.call(k,t,e))??null;for(;_!==null;){const P=n.getComputedStyle(_);if(g!==0){const R=(P.overflowY==="auto"||P.overflowY==="scroll")&&_.scrollHeight>_.clientHeight,Z=g>0?_.scrollTop+_.clientHeight<_.scrollHeight:_.scrollTop>0;if(R&&Z){_.scrollBy(v,g);return}}if(v!==0){const R=(P.overflowX==="auto"||P.overflowX==="scroll")&&_.scrollWidth>_.clientWidth,Z=v>0?_.scrollLeft+_.clientWidth<_.scrollWidth:_.scrollLeft>0;if(R&&Z){_.scrollBy(v,g);return}}_=_.parentElement}n.scrollBy(v,g)});function a(u){if(typeof u!="string")return!1;let h;try{h=new URL(u)}catch{return!1}if(h.protocol!=="artifact:")return!1;const p=h.hostname||h.pathname.replace(/^\/+/,"");return p===""?!1:(n.parent.postMessage({type:"open-artifact",artifactID:p},"*"),!0)}n.document.addEventListener("click",u=>{const h=u,p=typeof h.composedPath=="function"?h.composedPath():[];let v=null;for(const k of p)if(k instanceof HTMLAnchorElement||k&&k.tagName==="A"){v=k;break}if(v===null)return;const g=v.getAttribute("href");if(g===null)return;let _;try{_=new URL(g,n.document.baseURI).toString()}catch{return}a(_)&&u.preventDefault()},!0);const c=n.navigation;c&&c.addEventListener("navigate",u=>{var p;a((p=u.destination)==null?void 0:p.url)&&u.preventDefault()})}function cz(){return`(${lz.toString()})(window);`}const uz=Fe(),hz=Fe(),dz="No handler registered for update-content",pz="handleUpdateContent: handler already registered";function fz(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const gz=jo(tn);var Ci,Ri,Pi,$r,Tr,ko,Me,ah,Vb,Bb,Is,lh,am;let mz=(am=class extends gz{constructor(e){super();w(this,Me);w(this,Ci);w(this,Ri);w(this,Pi);w(this,$r,null);w(this,Tr,null);w(this,ko,!1);S(this,Ci,e);const r=e.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");S(this,Ri,r),S(this,Pi,i=>f(this,Me,Vb).call(this,i)),l(this,Ri).addEventListener("message",l(this,Pi))}get content(){return l(this,Tr)}set content(e){f(this,Me,lh).call(this),S(this,Tr,e),l(this,ko)&&f(this,Me,ah).call(this,e)}handleUpdateContent(e){if(f(this,Me,lh).call(this),l(this,$r)!==null)throw new Error(pz);S(this,$r,e)}dispose(){l(this,Ri).removeEventListener("message",l(this,Pi)),S(this,$r,null)}},Ci=new WeakMap,Ri=new WeakMap,Pi=new WeakMap,$r=new WeakMap,Tr=new WeakMap,ko=new WeakMap,Me=new WeakSet,ah=function(e){const r={type:"content-updated",content:e};f(this,Me,Is).call(this,r)},Vb=function(e){if(this.disposed||e.source!==l(this,Ci).contentWindow)return;const r=e.data;if(pR(r)){S(this,ko,!0),this.dispatchEvent(new uz("ready")),l(this,Tr)!==null&&f(this,Me,ah).call(this,l(this,Tr));return}if(fR(r)){f(this,Me,Bb).call(this,r);return}if(Wb(r)){this.dispatchEvent(new hz("open-artifact",{artifactID:r.artifactID}));return}},Bb=async function(e){const r=l(this,$r);if(r===null){f(this,Me,Is).call(this,{type:"response",id:e.id,error:{message:dz}});return}try{await r(e.content)}catch(i){if(this.disposed)return;f(this,Me,Is).call(this,{type:"response",id:e.id,error:{message:fz(i)}});return}this.disposed||f(this,Me,Is).call(this,{type:"response",id:e.id,result:{}})},Is=function(e){const r=l(this,Ci).contentWindow;r&&r.postMessage(e,"*")},lh=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},am);const vz="text/html";async function yz(n){const t=await fetch(n);if(!t.ok)throw new Error(`Failed to fetch artifact content: ${t.status}`);const e=await t.text(),r=new DOMParser().parseFromString(e,"text/html"),i=r.createElement("base");i.href=new URL(n,window.location.href).href,r.head.insertBefore(i,r.head.firstChild);const s=r.createElement("script");s.textContent=cz(),r.head.appendChild(s);const o=new Blob([`<!DOCTYPE html>
143
+ ${r.documentElement.outerHTML}`],{type:vz});return URL.createObjectURL(o)}const Ag="television-artifact-bridge",bz="_tvThemeBuster",jb=Fe(),wz=Fe();class Sz extends HTMLElement{constructor(){super(...arguments);m(this,"_artifact",null);m(this,"_viewURL",null);m(this,"_contentURL",null);m(this,"_screen",null);m(this,"_subscribedScreen",null);m(this,"_subscribedServer",null);m(this,"_activeView",null);m(this,"_contentState",{kind:"idle"});m(this,"_fetchSequence",0);m(this,"_blobSequence",0);m(this,"_themeReloadSequence",0);m(this,"_mountedViewURL",null);m(this,"_mountedDirectRenderURL",null);m(this,"_mountedDirectRenderStatus",null);m(this,"_directRender",!1);m(this,"_blobURL",null);m(this,"_subscribedWebview",null);m(this,"_directRenderMessageListener",null);m(this,"handleScreenContentChanged",e=>{if(!(!this._artifact||e.artifactID!==this._artifact.id)){if(this._activeView!==null){this.refetchContent();return}this._directRender&&this._contentURL!==null&&this._artifact.status==="committed"&&this.loadBlobFrame(this._contentURL)}});m(this,"handleServerEvent",e=>{const r=this._screen;if(!r||e.event.type!=="theme-changed"||e.serverURL!==r.server.url)return;const i=this.themeReloadSourceURL();i!==null&&(this._themeReloadSequence+=1,this.loadBlobFrame(this.withThemeBuster(i,this._themeReloadSequence)))});m(this,"handleOpenArtifact",e=>{this.requestFocus(e.artifactID)});m(this,"handleIframeMessage",e=>{const r=this.querySelector("iframe.artifact-frame");!r||r.contentWindow!==e.source||sz(e.data)&&this.dispatchArtifactWheel({deltaX:e.data.deltaX,deltaY:e.data.deltaY,shiftKey:e.data.shiftKey},i=>{var o;const s={type:"scroll",deltaX:0,deltaY:i};(o=r.contentWindow)==null||o.postMessage(s,this.iframeTargetOrigin(r))})});m(this,"handleWebviewIpcMessage",e=>{var o;const r=e.detail??e;if(!r||r.channel!==Ag)return;const i=(o=r.args)==null?void 0:o[0];if(!i||i.type!=="wheel")return;const s=this._subscribedWebview;s&&this.dispatchArtifactWheel({deltaX:i.deltaX??0,deltaY:i.deltaY??0,shiftKey:i.shiftKey??!1},a=>{var c;(c=s.send)==null||c.call(s,Ag,{type:"scroll",deltaX:0,deltaY:a})})})}set artifact(e){const r=this._artifact;this._artifact=e,this.render(),r!==null&&r!==e&&this.syncView()}get artifact(){return this._artifact}set viewURL(e){this._viewURL!==e&&(this._viewURL=e,this.syncView())}get viewURL(){return this._viewURL}set contentURL(e){this._contentURL!==e&&(this._contentURL=e,this.syncView())}get contentURL(){return this._contentURL}set screen(e){this._screen!==e&&(this._screen=e,this.syncScreenSubscription(),this.syncServerSubscription())}get screen(){return this._screen}get activeView(){return this._activeView}connectedCallback(){this.setAttribute("level","2"),this.render(),this.syncView(),this.syncScreenSubscription(),this.syncServerSubscription(),window.addEventListener("message",this.handleIframeMessage)}disconnectedCallback(){this.teardownView(),this.unsubscribeFromScreen(),this.unsubscribeFromServer(),window.removeEventListener("message",this.handleIframeMessage),this.unsubscribeFromWebview()}handleClose(){this._artifact&&this.dispatchEvent(new jb("close-artifact",{artifactID:this._artifact.id,bubbles:!0,composed:!0}))}syncView(){if(!this.isConnected)return;const e=this._artifact;if(!e){this.teardownView(),this._contentState={kind:"idle"},this.render();return}switch(e.kind){case"url":this.teardownView(),this._contentState={kind:"ready"},this.render();return}if(this._viewURL!==null){if(this._directRender&&this.teardownView(),this._mountedViewURL!==this._viewURL){this.teardownView(),this._contentState={kind:"loading"},this._mountedViewURL=this._viewURL,this.render();const r=this.querySelector("iframe.artifact-frame");if(!r){this._contentState={kind:"error"},this.render();return}this._activeView=new mz(r),this._activeView.handleUpdateContent(async i=>{await this.saveContent(i)}),this._activeView.addEventListener("open-artifact",this.handleOpenArtifact),this.loadBlobFrame(this._viewURL),this.startContentFetch();return}this._activeView!==null&&this.startContentFetch();return}if(this._contentURL!==null){if(!this._directRender||this._mountedDirectRenderURL!==this._contentURL){this.teardownView(),this._directRender=!0,this._mountedDirectRenderURL=this._contentURL,this._contentState={kind:"idle"},this.render(),this.installDirectRenderMessageListener(),e.status==="committed"&&(this._mountedDirectRenderStatus="committed",this.loadBlobFrame(this._contentURL));return}this.installDirectRenderMessageListener(),e.status==="committed"&&this._mountedDirectRenderStatus!=="committed"&&(this._mountedDirectRenderStatus="committed",this.loadBlobFrame(this._contentURL));return}this.teardownView(),this._contentState={kind:"idle"},this.render()}async saveContent(e){const r=this._screen,i=this._artifact;if(!r||!i)throw new Error("artifact-view: cannot save without a screen and artifact");await r.server.client.artifacts.putContent({artifactID:i.id,content:e})}syncScreenSubscription(){if(!this.isConnected){this.unsubscribeFromScreen();return}this._subscribedScreen!==this._screen&&(this.unsubscribeFromScreen(),this._screen!==null&&(this._screen.addEventListener("artifact-content-changed",this.handleScreenContentChanged),this._subscribedScreen=this._screen))}syncServerSubscription(){var r;if(!this.isConnected){this.unsubscribeFromServer();return}const e=((r=this._screen)==null?void 0:r.server)??null;this._subscribedServer!==e&&(this.unsubscribeFromServer(),e!==null&&(e.addEventListener("server-event",this.handleServerEvent),this._subscribedServer=e))}unsubscribeFromScreen(){this._subscribedScreen!==null&&(this._subscribedScreen.removeEventListener("artifact-content-changed",this.handleScreenContentChanged),this._subscribedScreen=null)}unsubscribeFromServer(){this._subscribedServer!==null&&(this._subscribedServer.removeEventListener("server-event",this.handleServerEvent),this._subscribedServer=null)}themeReloadSourceURL(){var e;return this._viewURL!==null?this._activeView!==null?this._viewURL:null:this._directRender&&this._contentURL!==null&&((e=this._artifact)==null?void 0:e.status)==="committed"?this._contentURL:null}withThemeBuster(e,r){const i=new URL(e,window.location.href);return i.searchParams.set(bz,String(r)),i.toString()}startContentFetch(){this._fetchSequence+=1;const e=this._fetchSequence,r=this._contentURL,i=this._activeView;if(!i||r===null){this._contentState={kind:"error"},this.render();return}this._contentState={kind:"loading"},(async()=>{try{const s=await fetch(r);if(e!==this._fetchSequence)return;if(!s.ok){this._contentState={kind:"error"},this.teardownView(),this.render();return}const o=await s.text();if(e!==this._fetchSequence||this._activeView!==i)return;this._activeView.content=o,this._contentState={kind:"ready"}}catch{if(e!==this._fetchSequence)return;this._contentState={kind:"error"},this.teardownView(),this.render()}})()}refetchContent(){this._fetchSequence+=1;const e=this._fetchSequence,r=this._contentURL,i=this._activeView;!i||r===null||(async()=>{try{const s=await fetch(r);if(e!==this._fetchSequence||!s.ok)return;const o=await s.text();if(e!==this._fetchSequence||this._activeView!==i)return;this._activeView.content=o}catch{}})()}loadBlobFrame(e){this._blobSequence+=1;const r=this._blobSequence;(async()=>{try{const i=await yz(e);if(r!==this._blobSequence){URL.revokeObjectURL(i);return}const s=this._blobURL;this._blobURL=i,this.render();const o=this.querySelector("iframe.artifact-frame");o&&(o.src=i),s!==null&&s!==i&&URL.revokeObjectURL(s)}catch{if(r!==this._blobSequence)return;this._contentState={kind:"error"},this.teardownView(),this.render()}})()}teardownView(){this._activeView!==null&&(this._activeView.removeEventListener("open-artifact",this.handleOpenArtifact),this._activeView.dispose(),this._activeView=null),this.removeDirectRenderMessageListener(),this._blobURL!==null&&(URL.revokeObjectURL(this._blobURL),this._blobURL=null),this._mountedViewURL=null,this._mountedDirectRenderURL=null,this._mountedDirectRenderStatus=null,this._directRender=!1,this._fetchSequence+=1,this._blobSequence+=1}installDirectRenderMessageListener(){if(this._directRenderMessageListener!==null)return;const e=r=>{const i=this.querySelector("iframe.artifact-frame");i&&r.source===i.contentWindow&&Wb(r.data)&&this.requestFocus(r.data.artifactID)};this._directRenderMessageListener=e,window.addEventListener("message",e)}removeDirectRenderMessageListener(){this._directRenderMessageListener!==null&&(window.removeEventListener("message",this._directRenderMessageListener),this._directRenderMessageListener=null)}requestFocus(e){const r=this._screen;r&&r.server.client.display.focus({artifactID:e}).catch(i=>{console.warn("artifact-view: display.focus failed",i)})}contentTemplate(){const e=this._artifact;if((e==null?void 0:e.kind)==="url"){const r=e.externalURL;if(!r)throw new Error(`URL artifact ${e.id} is missing externalURL`);return yd()?z`
144
144
  <webview
145
145
  class="artifact-frame artifact-content"
146
146
  src=${r}
@@ -170,7 +170,7 @@ ${r.documentElement.outerHTML}`],{type:mz});return URL.createObjectURL(o)}const
170
170
  ${this.contentTemplate()}
171
171
  <footer class="artifact-title-bar" drag-handle material="glass-frosted">
172
172
  <div class="artifact-title-group">
173
- <span class="artifact-title-icon">${F2({size:16})}</span>
173
+ <span class="artifact-title-icon">${H2({size:16})}</span>
174
174
  <span class="artifact-title">${e.title}</span>
175
175
  </div>
176
176
  <button
@@ -180,14 +180,14 @@ ${r.documentElement.outerHTML}`],{type:mz});return URL.createObjectURL(o)}const
180
180
  @click=${()=>this.handleClose()}
181
181
  aria-label="Close"
182
182
  >
183
- ${pd({size:16})}
183
+ ${_d({size:16})}
184
184
  </button>
185
185
  </footer>
186
- `}render(){this._artifact&&(this.setAttribute("kind",this._artifact.kind),Ce(this.template(),this),this.syncWebviewSubscription())}dispatchArtifactWheel(e,r){this.dispatchEvent(new bz("artifact-wheel",{bubbles:!0,composed:!0,deltaX:e.deltaX,deltaY:e.deltaY,shiftKey:e.shiftKey,scrollNative:r}))}syncWebviewSubscription(){const e=this.querySelector("webview");e!==this._subscribedWebview&&(this.unsubscribeFromWebview(),e&&(e.addEventListener("ipc-message",this.handleWebviewIpcMessage),this._subscribedWebview=e))}unsubscribeFromWebview(){this._subscribedWebview&&(this._subscribedWebview.removeEventListener("ipc-message",this.handleWebviewIpcMessage),this._subscribedWebview=null)}iframeTargetOrigin(e){const r=e.getAttribute("sandbox")??"";if(!new Set(r.split(/\s+/).filter(Boolean)).has("allow-same-origin"))return"*";const s=e.getAttribute("src")??e.src;if(!s)return"*";try{return new URL(s,window.location.href).origin}catch{return"*"}}}customElements.define("artifact-view",wz);/**
186
+ `}render(){this._artifact&&(this.setAttribute("kind",this._artifact.kind),Ce(this.template(),this),this.syncWebviewSubscription())}dispatchArtifactWheel(e,r){this.dispatchEvent(new wz("artifact-wheel",{bubbles:!0,composed:!0,deltaX:e.deltaX,deltaY:e.deltaY,shiftKey:e.shiftKey,scrollNative:r}))}syncWebviewSubscription(){const e=this.querySelector("webview");e!==this._subscribedWebview&&(this.unsubscribeFromWebview(),e&&(e.addEventListener("ipc-message",this.handleWebviewIpcMessage),this._subscribedWebview=e))}unsubscribeFromWebview(){this._subscribedWebview&&(this._subscribedWebview.removeEventListener("ipc-message",this.handleWebviewIpcMessage),this._subscribedWebview=null)}iframeTargetOrigin(e){const r=e.getAttribute("sandbox")??"";if(!new Set(r.split(/\s+/).filter(Boolean)).has("allow-same-origin"))return"*";const s=e.getAttribute("src")??e.src;if(!s)return"*";try{return new URL(s,window.location.href).origin}catch{return"*"}}}customElements.define("artifact-view",Sz);/**
187
187
  * @license
188
188
  * Copyright 2017 Google LLC
189
189
  * SPDX-License-Identifier: BSD-3-Clause
190
- */const wg=(n,t,e)=>{const r=new Map;for(let i=t;i<=e;i++)r.set(n[i],i);return r},Sg=Xl(class extends dd{constructor(n){if(super(n),n.type!==hd.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 o=0;for(const a of n)i[o]=r?r(a,o):o,s[o]=e(a,o),o++;return{values:s,keys:i}}render(n,t,e){return this.dt(n,t,e).values}update(n,[t,e,r]){const i=L2(n),{values:s,keys:o}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=o,s;const a=this.ut??(this.ut=[]),c=[];let u,h,p=0,v=i.length-1,g=0,_=s.length-1;for(;p<=v&&g<=_;)if(i[p]===null)p++;else if(i[v]===null)v--;else if(a[p]===o[g])c[g]=rr(i[p],s[g]),p++,g++;else if(a[v]===o[_])c[_]=rr(i[v],s[_]),v--,_--;else if(a[p]===o[_])c[_]=rr(i[p],s[_]),ps(n,c[_+1],i[p]),p++,_--;else if(a[v]===o[g])c[g]=rr(i[v],s[g]),ps(n,i[p],i[v]),v--,g++;else if(u===void 0&&(u=wg(o,g,_),h=wg(a,p,v)),u.has(a[p]))if(u.has(a[v])){const k=h.get(o[g]),T=k!==void 0?i[k]:null;if(T===null){const P=ps(n,i[p]);rr(P,s[g]),c[g]=P}else c[g]=rr(T,s[g]),ps(n,i[p],T),i[k]=null;g++}else Gc(i[v]),v--;else Gc(i[p]),p++;for(;g<=_;){const k=ps(n,c[_+1]);rr(k,s[g]),c[g++]=k}for(;p<=v;){const k=i[p++];k!==null&&Gc(k)}return this.ut=o,D2(n,c),Nr}}),Ee=n=>({type:"px",...n}),xe=n=>({type:"unit",...n}),va=2;class Sz{constructor(t){m(this,"basis");m(this,"min");m(this,"_gap");m(this,"_viewport");m(this,"_unit");this.basis=t.basis,this.min=t.min,this._viewport=t.viewport,this._gap=t.gap??Ee({x:le,y:le});const e=this._viewport.x??zr,r=this._viewport.y??nl,i=this._gap.x??le,s=this._gap.y??le,o=e<=XA,a=o?e-i*va:Math.min(zr,e-i*va),c=o?r-s*va:Math.min(nl,r-s*va),u=(a-i*(gt-1))/gt,h=(c-s*(lt-1))/lt,p=this.basis.x??0,v=this.basis.y??0,g=this.min.x??0,_=this.min.y??0;this._unit=Ee(o?{x:Math.max(g,u),y:Math.max(_,h)}:{x:Math.max(g,Math.min(p,u)),y:Math.max(_,Math.min(v,h))})}get unit(){return this._unit}get viewport(){return this._viewport}get gap(){return this._gap}toUnits(t){return xe({x:t.x==null?void 0:t.x/(this._unit.x??1),y:t.y==null?void 0:t.y/(this._unit.y??1)})}toPixels(t){const e=this._unit.x??0,r=this._unit.y??0,i=this._gap.x??le,s=this._gap.y??le,o=t.x==null?void 0:t.x*e+Math.max(0,t.x-1)*i,a=t.y==null?void 0:t.y*r+Math.max(0,t.y-1)*s;return Ee({x:o,y:a})}}const Ur=1e-4,At=1e-6,_z=40,kz=24;function Bb(n,t){return Math.max(0,n-t*2)}function jb(n){const t=[0];for(const e of n)t.push((t[t.length-1]??0)+e);return t}function Gb(n){const t=[0];for(let e=0;e<n.length;e+=1){const r=t[e]??0;t.push(r+n[e]+le)}return t}function qb(n,t,e){if(t<0||t>=n.length)return 0;let r=0,i=0;for(let s=t;s<n.length;s+=1){const o=n[s],a=i===0?o:r+le+o;if(a>e+Ur)break;r=a,i+=1}return Math.max(1,i)}function xz(n,t,e){if(t<0||t>=n.length)return 0;let r=0,i=0;for(let s=t;s>=0;s-=1){const o=n[s],a=i===0?o:r+le+o;if(a>e+Ur)break;r=a,i+=1}return Math.max(1,i)}function Ez(n,t){if(n.length===0)return 0;let e=0,r=0;for(let i=n.length-1;i>=0;i-=1){const s=n[i],o=r===0?s:e+le+s;if(o>t+Ur)break;e=o,r+=1}return Math.max(1,r)}function fd(n,t){if(n.length===0)return 0;const e=Ez(n,t);return Math.max(0,n.length-e)}function _g(n,t,e){if(n.length===0)return 0;const r=qb(n,t,e),i=Math.min(n.length,t+r);if(i<=t)return 0;const s=n.slice(t,i);return s.reduce((o,a)=>o+a,0)+Math.max(0,s.length-1)*le}function eh(n,t,e){const r=n[t]??0;return e-r}function di(n,t,e,r,i){if(n.length===0)return 0;const s=fd(n,i),o=t[s]??0,a=Math.max(0,Math.min(o,e));let c=0;for(let F=0;F<s;F+=1){const Y=t[F]??0,j=t[F+1]??Y;if(a>=Y&&a<=j+Ur){c=F;break}c=F+1}const u=Math.min(c+1,s),h=t[c]??0,p=t[u]??h,v=Math.max(p-h,Ur),g=u===c?0:(a-h)/v,_=Gb(n),k=_g(n,c,i),T=_g(n,u,i),P=(r-k)/2,R=(r-T)/2,Z=eh(_,c,P),N=eh(_,u,R);return Z+(N-Z)*g}function Az(n,t,e,r,i){const s=fd(n,r),o=t[s]??0;let a=0,c=o;for(let u=0;u<_z;u+=1){const h=(a+c)/2;di(n,t,h,e,r)>i?a=h:c=h}return(a+c)/2}function $z(n,t,e){const r=Gb(n),[i,s]=t,o=n.slice(i,s+1),a=o.reduce((u,h)=>u+h,0)+Math.max(0,o.length-1)*le,c=(e-a)/2;return eh(r,i,c)}function Tz(n,t,e){const r=qb(n,t,e);return[t,Math.min(n.length-1,t+r-1)]}function Iz(n,t,e){const r=xz(n,t,e);return[Math.max(0,t-r+1),t]}function Cz(n,t){return n[0]===t[0]&&n[1]===t[1]}function Rz(n){const{nodeCols:t,nodeWidthsPx:e,viewportWidthPx:r}=n;if(t.length===0||e.length===0)return{viewspans:[],minScroll:0,maxScroll:0};const i=e.length,s=n.gapPx??le,o=Bb(r,s),a=jb(t),c=fd(e,o),u=a[c]??0;function h(T){const P=$z(e,T,r),R=Az(e,a,r,o,P);return{nodeRange:T,anchor:Math.max(0,Math.min(u,R))}}const p=[];for(let T=0;T<i;){const P=Tz(e,T,o);p.push(h(P)),T=P[1]+1}const v=h(Iz(e,i-1,o)),g=p.filter(T=>T.nodeRange[0]<v.nodeRange[0]),_=g[g.length-1];return{viewspans:_&&Cz(_.nodeRange,v.nodeRange)?g:[...g,v],minScroll:0,maxScroll:u}}function ri(n,t){var i;let e=0,r=Number.POSITIVE_INFINITY;for(let s=0;s<n.length;s+=1){const o=Math.abs((((i=n[s])==null?void 0:i.anchor)??0)-t);if(o+At<r){r=o,e=s;continue}Math.abs(o-r)<=At&&s<e&&(e=s)}return e}function Pz(n,t,e){return e<=0?0:Math.max(0,Math.min(e-1,n+t))}function ir(n,t,e){return Math.max(t,Math.min(e,n))}function Dz(n,t){var e;for(let r=0;r<n.length;r+=1)if(Math.abs((((e=n[r])==null?void 0:e.anchor)??0)-t)<=At)return r;return-1}function Lz(n,t,e){var i,s;if(n.length===0)return t;const r=Dz(n,t);if(r>=0){const o=n[r+e];return(o==null?void 0:o.anchor)??n[e>0?n.length-1:0].anchor}if(e>0){for(const o of n)if(o.anchor>t+At)return o.anchor;return((i=n[n.length-1])==null?void 0:i.anchor)??t}for(let o=n.length-1;o>=0;o-=1){const a=n[o];if(a&&a.anchor<t-At)return a.anchor}return((s=n[0])==null?void 0:s.anchor)??t}class zz extends Jt{constructor(e){super();m(this,"_scroll",0);m(this,"_minScroll",0);m(this,"_maxScroll",0);m(this,"_viewspans",[]);m(this,"_activeViewspanIndex",0);m(this,"_nodeWidthsPx",[]);m(this,"_boundaryCols",[0]);m(this,"_viewportWidthPx",0);m(this,"_framedViewportWidthPx",0);this._scroll=(e==null?void 0:e.x)??0}get scroll(){return xe({x:this._scroll})}get translate(){return Ee({x:di(this._nodeWidthsPx,this._boundaryCols,this._scroll,this._viewportWidthPx,this._framedViewportWidthPx)})}get activeViewspan(){return this._viewspans[this._activeViewspanIndex]??null}get viewspans(){return this._viewspans}set scroll(e){const r=ir(e.x??this._scroll,this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=At||(this._scroll=r,this._activeViewspanIndex=ri(this._viewspans,this._scroll),this.dispatchEvent(new ni("layout-scroll",{scroll:this.scroll})))}rebuild(e){var v;const r=e.nodeWidths.map(g=>Math.max(0,g.x??0)),i=r.map(g=>e.grid.toPixels(xe({x:g})).x??0),s=e.grid.viewport.x??0,o=e.grid.gap.x??le,a=Rz({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this._nodeWidthsPx=i,this._boundaryCols=jb(r),this._viewportWidthPx=s,this._framedViewportWidthPx=Bb(s,o),this._viewspans=a.viewspans,this._minScroll=a.minScroll,this._maxScroll=a.maxScroll;const c=ir(this._scroll,this._minScroll,this._maxScroll);this._activeViewspanIndex=ri(this._viewspans,c);const h=e.snap!==!1?((v=this._viewspans[this._activeViewspanIndex])==null?void 0:v.anchor)??c:c,p=ir(h,this._minScroll,this._maxScroll);Math.abs(p-this._scroll)>At&&(this._scroll=p,this.dispatchEvent(new ni("layout-scroll",{scroll:this.scroll})))}step(e){var o;if(this._viewspans.length===0)return;const r=Pz(this._activeViewspanIndex,e,this._viewspans.length),i=((o=this._viewspans[r])==null?void 0:o.anchor)??this._scroll,s=ir(i,this._minScroll,this._maxScroll);this._activeViewspanIndex=r,!(Math.abs(s-this._scroll)<=At)&&(this._scroll=s,this.dispatchEvent(new ni("layout-scroll",{scroll:this.scroll})))}snap(e){var s;if(this._viewspans.length===0)return;const r=e===void 0?((s=this._viewspans[ri(this._viewspans,this._scroll)])==null?void 0:s.anchor)??this._scroll:Lz(this._viewspans,this._scroll,e),i=ir(r,this._minScroll,this._maxScroll);this._activeViewspanIndex=ri(this._viewspans,i),!(Math.abs(i-this._scroll)<=At)&&(this._scroll=i,this.dispatchEvent(new ni("layout-scroll",{scroll:this.scroll})))}wheel(e){const r=ir(this._scroll+(e.x??0),this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=At||(this._scroll=r,this._activeViewspanIndex=ri(this._viewspans,this._scroll),this.dispatchEvent(new ni("layout-scroll",{scroll:this.scroll})))}wheelPixels(e){const r=e.x??0;if(Math.abs(r)<=Ur)return;const i=di(this._nodeWidthsPx,this._boundaryCols,this._scroll,this._viewportWidthPx,this._framedViewportWidthPx),s=i-r,o=di(this._nodeWidthsPx,this._boundaryCols,this._maxScroll,this._viewportWidthPx,this._framedViewportWidthPx),a=di(this._nodeWidthsPx,this._boundaryCols,this._minScroll,this._viewportWidthPx,this._framedViewportWidthPx),c=Math.max(o,Math.min(a,s));if(Math.abs(c-i)<=Ur)return;let u=this._minScroll,h=this._maxScroll;for(let v=0;v<kz;v+=1){const g=(u+h)/2;di(this._nodeWidthsPx,this._boundaryCols,g,this._viewportWidthPx,this._framedViewportWidthPx)>c?u=g:h=g}const p=ir((u+h)/2,this._minScroll,this._maxScroll);Math.abs(p-this._scroll)<=At||(this._scroll=p,this._activeViewspanIndex=ri(this._viewspans,this._scroll),this.dispatchEvent(new ni("layout-scroll",{scroll:this.scroll})))}}const Kc={"stack-above":{left:.25,top:0,width:.5,height:.5},"stack-below":{left:.25,top:.5,width:.5,height:.5},"reorder-before":{left:0,top:0,width:.25,height:1},"reorder-after":{left:.75,top:0,width:.25,height:1}},Oz=["stack-above","stack-below","reorder-before","reorder-after"];function Jc(n,t){return{left:n.left+n.width*t.left,top:n.top+n.height*t.top,width:n.width*t.width,height:n.height*t.height}}function sr(n,t,e){return n>=e.left&&n<e.left+e.width&&t>=e.top&&t<e.top+e.height}function th(n){return Number.isFinite(n)?Math.max(Ns,Math.min(Xh,Math.round(n))):Ns}function Mz(n,t,e){const r=n.findIndex(a=>a.type==="card"&&a.id===t);if(r===-1)return n;const i=n[r];if(!i||i.type!=="card")return n;const s=th(e);if(i.width===s)return n;const o=[...n];return o[r]={...i,width:s},o}function Yb(n,t){for(const e of n){if(e.type==="card"&&e.id===t)return e;if(e.type==="stack")for(const r of e.children){if(r.type==="card"&&r.id===t)return r;if(r.type==="row"){for(const i of r.children)if(i.id===t)return i}}}return null}function nh(n){return n.height===lt||n.height===Wn?{...n,height:Wn}:n}function rh(n){return n.height===Wn?{...n,height:lt}:n}function Nz(n,t,e,r){const i=n.findIndex(h=>h.type==="stack"&&h.id===t);if(i===-1)return n;const s=n[i];if(!s||s.type!=="stack")return n;const o=s.children.find(h=>h.type==="card"&&h.id===e);if(!o||o.type!=="card")return n;const a=s.children.filter(h=>h.id!==e);if(a.length===s.children.length||a.length<1)return n;const c=[...n];if(a.length===1){const[h]=a;c[i]=h.type==="card"?rh(h):h}else c[i]={...s,children:a};const u=Math.max(0,Math.min(r,c.length));return c.splice(u,0,rh(o)),c}const Uz=Fe(),Fz=Fe(),Hz=50;function Zz(n,t){if(n.type!==t.type)return!1;switch(n.type){case"reorder":return t.index===n.index;case"stack":return t.targetCardId===n.targetCardId&&t.position===n.position;case"stack-child-noop":return!0;case"stack-child-extract":return t.toIndex===n.toIndex;case"stack-child-reorder":return t.position===n.position;default:return!1}}function Go(n){return{id:n.id,type:"drop-target",width:n.width,height:n.height}}function kg(n){return n.map(Vz)}function Wz(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function Vz(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n.type==="stack"?{...n,children:n.children.map(Wz)}:n}function Xb(n,t){return n.find(r=>r.type==="card"&&r.id===t)??null}function xg(n,t){return n.find(r=>r.type==="stack"&&r.id===t)??null}function Bz(n,t){const e=[...t],r=e.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(r===-1)return null;const i=e[r];if(!i||i.type!=="card")return null;e.splice(r,1);const s=Math.max(0,Math.min(n.lastReorderIndex,e.length));e.splice(s,0,i);const o=e.findIndex(a=>a.type==="card"&&a.id===n.nodeId);return o===-1?null:{base:e,visualDraggedIndex:o}}function jz(n,t,e,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(v=>v.type==="card"&&v.id===e.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=Xb(r,t.nodeId);if(!a)return null;const c=nh(a),u=nh(o),h=Go(c),p=e.position==="above"?[h,u]:[u,h];return i[s]={id:o.id,type:"stack",children:p},i}function Qc(n,t){return n.parentStackId?qz(n,t):Gz(n,t)}function Gz(n,t){const e=n.hitTarget;if(e.type==="reorder"){const r=t[n.sourceIndex];if(!r||r.type!=="card")return[...t];const i=[...t];return i.splice(n.sourceIndex,1),i.splice(e.index,0,Go(r)),i}if(e.type==="stack"){const r=Bz(n,t);return r?jz(r,n,e,t)??[...t]:[...t]}return[...t]}function qz(n,t){const e=n.hitTarget;switch(e.type){case"stack-child-reorder":return Yz(n,t,e.position);case"stack-child-extract":return Xz(n,t,e.toIndex);case"stack-child-noop":return Kz(n,t);default:return[...t]}}function Yz(n,t,e){const r=t.findIndex(v=>v.type==="stack"&&v.id===n.parentStackId);if(r===-1)return[...t];const i=t[r];if(!i||i.type!=="stack")return[...t];if(!i.children.every(v=>v.type==="card"))return[...t];const s=i.children,o=s.findIndex(v=>v.id===n.nodeId);if(o===-1)return[...t];const a=s[o],c=s.filter(v=>v.id!==n.nodeId),u=Go(a),h=e==="above"?[u,...c]:[...c,u],p=[...t];return p[r]={...i,children:h},p}function Xz(n,t,e){if(!n.parentStackId)return[...t];const r=Nz(t,n.parentStackId,n.nodeId,e);if(r===t)return[...t];const i=r.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(i===-1)return[...t];const s=r[i];if(!s||s.type!=="card")return[...t];const o=[...r];return o[i]=Go(s),o}function Kz(n,t){const e=t.findIndex(c=>c.type==="stack"&&c.id===n.parentStackId);if(e===-1)return[...t];const r=t[e];if(!r||r.type!=="stack")return[...t];const i=r.children.findIndex(c=>c.type==="card"&&c.id===n.nodeId);if(i===-1)return[...t];const s=r.children[i];if(!s||s.type!=="card")return[...t];const o=[...t],a=[...r.children];return a[i]=Go(s),o[e]={...r,children:a},o}function Jz(n,t){return t.find(r=>r.type==="stack"&&r.id===n.id)?n.id:Ul()}function Qz(n,t,e){if(n.type==="drop-target"){const r=Yb(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return nh(r)}return n}function eO(n,t,e){const r=n.children.map(s=>Qz(s,t,e));return{id:Jz(n,t),type:"stack",children:r}}function tO(n,t,e){if(n.type==="drop-target"){const r=Yb(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return Xb(t,e)!==null?r:rh(r)}return n.type==="card"||n.type==="row"?n:eO(n,t,e)}function nO(n,t,e){return n.map(r=>tO(r,t,e))}function rO(n,t){return JSON.stringify(n)===JSON.stringify(t)}const iO=Bo(Jt);class sO extends iO{constructor(e={}){super();m(this,"pending",null);m(this,"active",null)}start(e){if(this.pending||this.active)return;const r=e.pointer.x??0,i=e.pointer.y??0;this.pending={startX:r,startY:i,grabOffsetX:e.grabOffset.x??0,grabOffsetY:e.grabOffset.y??0,nodeId:e.nodeId,sourceIndex:e.source.index,parentStackId:e.source.parentId,width:e.size.x??0,height:e.size.y??0,baseLayout:e.layout}}update(e){const r=e.pointer.x??0,i=e.pointer.y??0,s=this.pending;if(s){const u=r-s.startX,h=i-s.startY;Math.hypot(u,h)>=JA&&(this.pending=null,this.active={...s,pointerX:r,pointerY:i,hitTarget:{type:"reorder",index:s.sourceIndex},lastReorderIndex:s.sourceIndex},this.emitDrag(),this.dispatchEvent(new ae("change")));return}if(!this.active)return;const o=Qc(this.active,this.active.baseLayout),a=this.getHitTargetForPointer(r,i,e,o),c=a.type==="reorder"?a.index:this.active.lastReorderIndex;this.active.pointerX===r&&this.active.pointerY===i&&Zz(this.active.hitTarget,a)&&this.active.lastReorderIndex===c||(this.active={...this.active,pointerX:r,pointerY:i,hitTarget:a,lastReorderIndex:c},this.emitDrag(),this.dispatchEvent(new ae("change")))}drop(){if(this.pending){this.cancel();return}if(!this.active)return;const e=this.active.baseLayout;let r=null;try{const i=Qc(this.active,e),s=nO(i,e,this.active.nodeId);rO(s,e)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new Fz("drop",{layout:r})),this.dispatchEvent(new ae("change"))}cancel(){!this.pending&&!this.active||(this.reset(),this.dispatchEvent(new ae("change")))}dispose(){this.reset()}get status(){return this.active?"active":this.pending?"pending":"idle"}reset(){this.pending=null,this.active=null}emitDrag(){if(!this.active)return;const e=Qc(this.active,this.active.baseLayout);this.dispatchEvent(new Uz("drag",{nodeId:this.active.nodeId,source:{index:this.active.sourceIndex,parentId:this.active.parentStackId},grabOffset:Ee({x:this.active.grabOffsetX,y:this.active.grabOffsetY}),pointer:Ee({x:this.active.pointerX,y:this.active.pointerY}),size:Ee({x:this.active.width,y:this.active.height}),projectedLayout:e}))}getHitTargetForPointer(e,r,i,s){return this.active?this.isPointerInsideDragBounds(e,r,i.viewport)?this.active.parentStackId?this.getStackChildHitTarget(e,r,i,s):this.getTopLevelCardHitTarget(e,r,i,s):{type:"reorder",index:this.active.sourceIndex}:{type:"reorder",index:0}}getStackChildHitTarget(e,r,i,s){var u;if(!((u=this.active)!=null&&u.parentStackId))return{type:"stack-child-noop"};const o=this.getSourceStackInteractionRect(i.geometry);if(o&&sr(e,r,o)){const h=o.top+o.height/2;return{type:"stack-child-reorder",position:r<h?"above":"below"}}const a=this.getSourceRemainingSiblingRect(i.geometry);if(a&&sr(e,r,a)){const h=a.top+a.height/2;return{type:"stack-child-reorder",position:r<h?"above":"below"}}return{type:"stack-child-extract",toIndex:this.getTopLevelReorderIndexForPointer(e,r,i,s)}}getSourceRemainingSiblingRect(e){var s,o;if(!((s=this.active)!=null&&s.parentStackId))return;const r=xg(this.active.baseLayout,this.active.parentStackId);if(!r)return;const i=r.children.find(a=>{var c;return a.type==="card"&&a.id!==((c=this.active)==null?void 0:c.nodeId)});if(i)return(o=e.find(a=>a.id===i.id))==null?void 0:o.rect}getSourceStackInteractionRect(e){var o;if(!((o=this.active)!=null&&o.parentStackId))return;const r=e.find(a=>{var c;return a.id===((c=this.active)==null?void 0:c.parentStackId)});if(r)return this.active.sourceStackRect=r.rect,r.rect;const i=xg(this.active.baseLayout,this.active.parentStackId);if(!i)return this.active.sourceStackRect;const s=i.children.find(a=>{var c;return a.type==="card"&&a.id!==((c=this.active)==null?void 0:c.nodeId)});if(s){const a=e.find(c=>c.id===s.id);if(a)return a.rect}return this.active.sourceStackRect}getTopLevelCardHitTarget(e,r,i,s){var g,_,k;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return{type:"reorder",index:((g=this.active)==null?void 0:g.sourceIndex)??0};const c=(i.effectiveVelocity??0)<=Hz;for(const T of o){const P=T.rect;if(!sr(e,r,P))continue;const R=this.resolveTopLevelTargetForCard(e,r,T,T.logicalIndex,c);if(R)return R;if(!c&&((_=this.active)!=null&&_.hitTarget))return this.active.hitTarget}const u=this.getNearestTargetableZone(e,o);if(!u)return{type:"reorder",index:((k=this.active)==null?void 0:k.sourceIndex)??0};const h=Math.max(u.rect.left,Math.min(u.rect.left+u.rect.width,e)),p=this.resolveTopLevelTargetForCard(h,r,u,u.logicalIndex,c);if(p)return p;const v=u.rect.left+u.rect.width/2;return{type:"reorder",index:e<v?u.logicalIndex:u.logicalIndex+1}}getTopLevelReorderIndexForPointer(e,r,i,s){var u,h;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return((u=this.active)==null?void 0:u.sourceIndex)??0;for(const p of o){if(!sr(e,r,p.rect))continue;const v=Jc(p.rect,Kc["reorder-before"]);if(sr(e,r,v))return p.logicalIndex;const g=Jc(p.rect,Kc["reorder-after"]);if(sr(e,r,g))return p.logicalIndex+1}const a=this.getNearestTargetableZone(e,o);if(!a)return((h=this.active)==null?void 0:h.sourceIndex)??0;const c=a.rect.left+a.rect.width/2;return e<c?a.logicalIndex:a.logicalIndex+1}getTopLevelZoneNodes(e,r){const i=new Map(r.map(a=>[a.id,a])),s=[];let o=0;for(const a of e){const c=i.get(a.id);c&&c.type!=="drop-target"&&(c.type==="card"||c.type==="stack")&&(s.push({id:c.id,rect:a.rect,logicalIndex:o}),o+=1)}return s}resolveTopLevelTargetForCard(e,r,i,s,o){const a=i.rect;for(const c of Oz){if(!o&&(c==="stack-above"||c==="stack-below"))continue;const u=Kc[c],h=Jc(a,u);if(sr(e,r,h))return c==="stack-above"?{type:"stack",targetCardId:i.id,position:"above"}:c==="stack-below"?{type:"stack",targetCardId:i.id,position:"below"}:c==="reorder-before"?{type:"reorder",index:s}:{type:"reorder",index:s+1}}return null}getNearestTargetableZone(e,r){let i=null,s=Number.POSITIVE_INFINITY;for(const o of r){const a=o.rect.left,c=o.rect.left+o.rect.width,u=e<a?a-e:e>c?e-c:0;u<s&&(s=u,i=o)}return i}isPointerInsideDragBounds(e,r,i){return e>=i.left&&e<=i.left+i.width&&r>=i.top&&r<=i.top+i.height}}const Eg=60,oO=80,Ag=.5,$g=10;class aO{constructor(){m(this,"awaitingFreshWheelGesture",!1);m(this,"lastWheelEventAt",Number.NEGATIVE_INFINITY);m(this,"lastWheelDeltaX",0);m(this,"activeGestureType","none");m(this,"lastWheelGestureAt",Number.NEGATIVE_INFINITY)}markKeyboardNavigation(t){this.awaitingFreshWheelGesture=!0,this.lastWheelEventAt=t,this.activeGestureType="none"}reset(){this.awaitingFreshWheelGesture=!1,this.lastWheelEventAt=Number.NEGATIVE_INFINITY,this.lastWheelDeltaX=0,this.activeGestureType="none",this.lastWheelGestureAt=Number.NEGATIVE_INFINITY}decide(t){const{now:e,shiftKey:r,deltaX:i,deltaY:s,overArtifactContent:o}=t;e-this.lastWheelGestureAt>=Eg&&(this.activeGestureType="none");const c=r&&s!==0,u=c?s:i,h=Math.abs(u),p=Math.abs(s);return this.activeGestureType==="vertical-artifact"&&o?h>=Ag&&h>=p*$g?this.classifyHorizontal(e,u):(this.lastWheelGestureAt=e,{type:"scroll-native"}):this.activeGestureType==="horizontal-filmstrip"?!c&&o&&p>0&&p>=h*$g?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=e,{type:"scroll-native"}):this.classifyHorizontal(e,u):h<Ag?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=e,{type:"scroll-native"}):c||h>p?this.classifyHorizontal(e,u):p>h?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=e,{type:"scroll-native"}):o?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=e,{type:"scroll-native"}):this.classifyHorizontal(e,u)}classifyHorizontal(t,e){const r=t-this.lastWheelEventAt,i=Math.sign(this.lastWheelDeltaX),s=Math.sign(e),o=i!==0&&s!==0&&i!==s,a=i!==0&&Math.abs(e)>=Math.abs(this.lastWheelDeltaX)+oO;return this.awaitingFreshWheelGesture&&r<Eg&&!o&&!a?{type:"ignore"}:(this.lastWheelEventAt=t,this.lastWheelDeltaX=e,this.lastWheelGestureAt=t,this.awaitingFreshWheelGesture=!1,this.activeGestureType="horizontal-filmstrip",{type:"scroll-horizontal",horizontalDelta:e})}}const lO=100,cO=1e3;class uO{constructor(t,e){m(this,"_status","idle");m(this,"cumulativeOffset",0);m(this,"samples",[]);m(this,"scroll");m(this,"setAnimating");this.scroll=t,this.setAnimating=e}get status(){return this._status}start(t){this._status="active",this.cumulativeOffset=0,this.samples=[{time:t,offset:0}]}move(t,e){this._status==="active"&&(this.cumulativeOffset+=e,this.samples.push({time:t,offset:this.cumulativeOffset}),this.pruneSamples(t),this.setAnimating(!1),this.scroll.wheelPixels(Ee({x:-e})))}end(){if(this._status!=="active")return;const t=this.computeVelocityPxPerSec();this.setAnimating(!0),Math.abs(t)<e1?this.scroll.snap():this.scroll.snap(t>0?-1:1),this.reset()}cancel(){this._status==="active"&&(this.setAnimating(!0),this.scroll.snap(),this.reset())}reset(){this._status="idle",this.cumulativeOffset=0,this.samples=[]}pruneSamples(t){const e=t-lO;let r=0;for(let i=0;i<this.samples.length;i+=1){if(this.samples[i].time>=e){r=i;break}r=i+1}if(r>0){const i=Math.max(0,r-1);this.samples=this.samples.slice(i)}}computeVelocityPxPerSec(){if(this.samples.length<2)return 0;const t=this.samples[0],e=this.samples[this.samples.length-1],r=e.time-t.time;return r<=0?0:(e.offset-t.offset)/r*cO}}function hO({baseLayout:n,visibleLayout:t,resolved:e,cardsByID:r,grid:i,dragState:s,isForeground:o}){var _;const a=new Map(t.map(k=>[k.id,k])),c=e.nodes.map((k,T)=>{const P=a.get(k.id),R=[];for(const N of k.cards){if(s&&N.id===s.nodeId){R.push({key:`placeholder:${N.id}`,kind:"placeholder",card:null,placement:N,isTopLevelCard:!1,isDragged:!1,sourceStackId:s.source.parentId??null});continue}const F=r.get(N.id);F&&R.push({key:F.id,kind:"card",card:F,placement:N,isTopLevelCard:(P==null?void 0:P.type)==="card",isDragged:!1,sourceStackId:null})}if(s!=null&&s.source.parentId&&k.id===s.source.parentId){const N=r.get(s.nodeId);if(N){const F={key:N.id,kind:"card",card:N,placement:null,isTopLevelCard:!1,isDragged:!0,sourceStackId:s.source.parentId},Y=dO(n,s.source.parentId,s.nodeId),j=Y<0?R.length:Math.min(Y,R.length);R.splice(j,0,F)}}const Z=!!(s&&(P==null?void 0:P.type)==="card"&&P.id===s.nodeId&&P.artifactID===s.nodeId);return{key:Z?`placeholder:${k.id}`:k.id,kind:"visible",nodeId:k.id,widthPx:i.toPixels(xe({x:k.width})).x??0,widthUnits:k.width,layoutIndex:T,isForeground:o(T),isPlaceholder:Z,slots:R}});if(!s||s.source.parentId&&a.has(s.source.parentId))return c;const u=r.get(s.nodeId);if(!u)return c;const h=s.source.parentId??s.nodeId,p=((_=fr(n).nodes[s.source.index])==null?void 0:_.width)??gt,v={key:h,kind:"ghost",nodeId:h,widthPx:0,widthUnits:p,layoutIndex:null,isForeground:!1,isPlaceholder:!1,slots:[{key:u.id,kind:"card",card:u,placement:null,isTopLevelCard:!s.source.parentId,isDragged:!0,sourceStackId:s.source.parentId??null}]},g=Math.max(0,Math.min(s.source.index,c.length));return c.splice(g,0,v),c}function Tg(n){if(!n)return null;const t=n.projectedLayout,e=n.source.parentId;for(const i of t){if(i.type!=="stack")continue;const s=i.children.findIndex(u=>u.type==="drop-target");if(s===-1)continue;const o=s===0?"above":"below";if(e&&e===i.id)return`stack-child-reorder:${o}`;const a=i.children.find(u=>u.type!=="drop-target");return`stack:${(a==null?void 0:a.type)==="card"?a.artifactID:(a==null?void 0:a.id)??""}:${o}`}const r=t.findIndex(i=>i.type==="drop-target");return r===-1?"none":e?`stack-child-extract:${r}`:`reorder:${r}`}function dO(n,t,e){const r=n.find(i=>i.type==="stack"&&i.id===t);return!r||r.type!=="stack"?-1:r.children.findIndex(i=>i.type==="card"&&i.id===e)}const pO=2,Ig=1e3,ya=1e-4,fO=120,Cg=!1;function Rg(n){return n.replace(/["\\]/g,"\\$&")}function Pg(n,t,e){if(n===0)return 0;const r=t.toPixels(xe({y:lt})).y??0;return(e-r)/pO}function eu(n){const t=n.clientWidth>0?n.clientWidth:zr,e=n.clientHeight>0?n.clientHeight:nl;let r=0,i=0;if(n.isConnected){const o=getComputedStyle(n);r=parseFloat(o.paddingTop)||0,i=parseFloat(o.paddingBottom)||0}const s=Math.max(1,e-r-i);return{width:t,height:s,offsetY:r}}class gO extends Event{constructor(e){super("scroll",{bubbles:!0,composed:!0});m(this,"scrollPosition");this.scrollPosition=e}}class Kb extends Event{constructor(e){super("layout-change",{bubbles:!0,composed:!0});m(this,"layout");this.layout=e}}class mO extends HTMLElement{constructor(){super();m(this,"_layout",[]);m(this,"_scrollPosition",0);m(this,"layoutGrid",null);m(this,"layoutScroll",new zz(xe({x:0})));m(this,"scrollModelKey","");m(this,"resizeObserver",null);m(this,"renderPending",!1);m(this,"animateNextRender",!0);m(this,"wheelGesture",new aO);m(this,"swipeGesture",new uO(this.layoutScroll,e=>{this.animateNextRender=e}));m(this,"swipePointerId",null);m(this,"swipeStartX",0);m(this,"swipeStartY",0);m(this,"swipeLastX",0);m(this,"swipeActive",!1);m(this,"swipeShouldSuppressClick",!1);m(this,"swipeListenersAttached",!1);m(this,"wheelIdleSnapTimer",null);m(this,"dragController",new sO);m(this,"dragState",null);m(this,"activeDragPointerId",null);m(this,"dragListenersAttached",!1);m(this,"dragFrame",0);m(this,"lastDragFrameTime",0);m(this,"lastPointerX",0);m(this,"lastPointerY",0);m(this,"pointerVelocityPxPerSec",0);m(this,"scrollVelocityPxPerSec",0);m(this,"motionSampleTime",0);m(this,"motionSampleX",0);m(this,"motionSampleY",0);m(this,"lastDragControllerStatus","idle");m(this,"lastProjectedDragLayoutSignature","");m(this,"lastDragDropIntent",null);m(this,"lastActivePlaceholderId",null);m(this,"draggedSlotElement",null);m(this,"draggedSlotContainingBlock",null);m(this,"currentDragPreviewSize",null);m(this,"dragTrackOffsetXPx",0);m(this,"previousProjectedLayoutForOffset",null);m(this,"resizeState",null);m(this,"resizeListenersAttached",!1);m(this,"_cards",new Map);m(this,"onDragControllerChange",()=>{const e=this.dragController.status;e!==this.lastDragControllerStatus&&(this.lastDragControllerStatus=e,e==="idle"&&(this.dragState=null,this.resetDragPreviewState()),this.scheduleRender())});m(this,"onDragControllerDrag",e=>{var c;const r=JSON.stringify(e.projectedLayout),i=Tg(e),s=yO(e.projectedLayout);if(r!==this.lastProjectedDragLayoutSignature||i!==this.lastDragDropIntent||s!==this.lastActivePlaceholderId){const u=kg(e.projectedLayout),h=this.shouldApplyTrackOffset(e.projectedLayout,e.source.parentId),p=e.source.parentId?this.getStackChildAnchorCardId(e.source.parentId,e.nodeId):null;this.dragTrackOffsetXPx=h?this.computeDragTrackOffset(this.previousProjectedLayoutForOffset,u,e.nodeId,e.source.parentId,p,this.dragTrackOffsetXPx):0,this.previousProjectedLayoutForOffset=u,this.lastProjectedDragLayoutSignature=r,this.lastDragDropIntent=i,this.lastActivePlaceholderId=s,this.dragState={nodeId:e.nodeId,source:e.source,grabOffset:e.grabOffset,pointer:e.pointer,size:e.size,projectedLayout:e.projectedLayout},this.scheduleRender();return}this.dragState={nodeId:e.nodeId,source:e.source,grabOffset:e.grabOffset,pointer:e.pointer,size:e.size,projectedLayout:((c=this.dragState)==null?void 0:c.projectedLayout)??e.projectedLayout};const a=this.getCachedDraggedSlotElement(e.nodeId);a&&this.writeDraggedSlotPosition(a,this.dragState)});m(this,"onDragControllerDrop",e=>{this.dragState=null,this.resetDragPreviewState(),this.commitLayout(e.layout)});m(this,"onLayoutScrollInternal",e=>{const i=e.scroll.x??0;Math.abs(i-this._scrollPosition)<ya||(this._scrollPosition=i,this.emitScrollPositionChanged(i),this.scheduleRender())});m(this,"handleKeyDown",e=>{if(e.key==="Escape"&&this.dragController.status!=="idle"){e.preventDefault(),this.stopDragFrameLoop(),this.releaseActiveDragPointerCapture(),this.dragController.cancel(),this.detachDragListeners();return}this.dragController.status==="idle"&&(e.key==="ArrowRight"?(e.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(1)):e.key==="ArrowLeft"&&(e.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(-1)))});m(this,"handleWheel",e=>{if(this._layout.length===0)return;const r=this.wheelGesture.decide({now:Date.now(),shiftKey:e.shiftKey,deltaX:e.deltaX,deltaY:e.deltaY,overArtifactContent:!1});r.type==="scroll-horizontal"&&(e.preventDefault(),this.applyHorizontalWheel(r.horizontalDelta))});m(this,"handleWindowMessage",e=>{if(this._layout.length===0)return;const r=this.findManagedArtifactFrame(e.source);if(r&&this.isTrustedArtifactFrameMessage(e,r)){if(sz(e.data)){const i=typeof performance<"u"?performance.now():Date.now();this.swipeGesture.status==="idle"&&this.swipeGesture.start(i),this.swipeGesture.move(i,e.data.deltaX);return}if(oz(e.data)){this.swipeGesture.status==="active"&&this.swipeGesture.end();return}}});m(this,"handleArtifactWheel",e=>{if(this._layout.length===0)return;const r=this.wheelGesture.decide({now:Date.now(),shiftKey:e.shiftKey,deltaX:e.deltaX,deltaY:e.deltaY,overArtifactContent:!0});if(r.type==="scroll-horizontal"){this.applyHorizontalWheel(r.horizontalDelta);return}r.type==="scroll-native"&&e.scrollNative(e.deltaY)});m(this,"handlePointerDown",e=>{if(e.button!==0||this.dragController.status!=="idle"||this.resizeState)return;const r=e.target;if(!(r instanceof Element))return;const i=r.closest("[data-resize-handle]");if(i){this.beginResize(e,i);return}const s=r.closest("[drag-handle]")!==null,o=r.closest("button, input, textarea, select, a, [role='button']")!==null;if(e.pointerType==="touch"&&!s&&!o&&this._layout.length>0){this.beginSwipeTracking(e);return}if(!s){if(!o){const p=r.closest(".node");if(p&&!p.hasAttribute("data-foreground")){const v=p.getAttribute("layout-node");if(v!==null){const g=parseInt(v,10);if(!isNaN(g)){const _=this.findViewspanContainingNode(g);if(_){this.clearWheelIdleSnap(),this.animateNextRender=!0,this.layoutScroll.scroll=xe({x:_.anchor}),e.preventDefault(),e.stopPropagation();return}}}}}return}if(o)return;const a=r.closest(".card-slot");if(!a)return;const c=a.getAttribute("data-layout-node-id");if(!c)return;const u=bO(this._layout,c);if(!u)return;const h=a.getBoundingClientRect();this.lastPointerX=e.clientX,this.lastPointerY=e.clientY,this.resetMotionTracking(e.clientX,e.clientY),this.focus(),this.dragController.start({nodeId:c,source:{index:u.topLevelIndex,parentId:u.sourceStackId},pointer:Ee({x:e.clientX,y:e.clientY}),grabOffset:Ee({x:e.clientX-h.left,y:e.clientY-h.top}),size:Ee({x:h.width,y:h.height}),layout:this._layout}),this.attachDragListeners(),this.activeDragPointerId=e.pointerId;try{this.setPointerCapture(e.pointerId)}catch{}e.preventDefault()});m(this,"handleResizePointerMove",e=>{const r=this.resizeState;if(!r||e.pointerId!==r.pointerId)return;const i=this.layoutGrid,s=((i==null?void 0:i.unit.x)??En)+le;if(s<=0)return;const o=e.clientX-r.startClientX,a=th(r.startWidth+o/s);a!==r.currentWidth&&(r.currentWidth=a,this.scheduleRender())});m(this,"handleResizePointerUp",e=>{const r=this.resizeState;if(!r||e.pointerId!==r.pointerId)return;const i=r.currentWidth,s=r.startWidth,o=r.cardId;this.endResize(e.pointerId),i!==s?this.commitLayout(Mz(this._layout,o,i)):this.scheduleRender()});m(this,"handleResizePointerCancel",e=>{!this.resizeState||e.pointerId!==this.resizeState.pointerId||(this.endResize(e.pointerId),this.scheduleRender())});m(this,"handleResizeWindowBlur",()=>{this.resizeState&&(this.endResize(this.resizeState.pointerId),this.scheduleRender())});m(this,"handleResizeKeyDown",e=>{this.resizeState&&e.key==="Escape"&&(e.preventDefault(),this.endResize(this.resizeState.pointerId),this.scheduleRender())});m(this,"handleSwipePointerMove",e=>{if(this.swipePointerId===null||e.pointerId!==this.swipePointerId)return;if(!this.swipeActive){const i=e.clientX-this.swipeStartX,s=e.clientY-this.swipeStartY,o=Math.abs(i),a=Math.abs(s);if(o<Rf&&a<Rf)return;if(a>=o){this.endSwipeTracking();return}this.swipeActive=!0,this.swipeShouldSuppressClick=!0;try{this.setPointerCapture(e.pointerId)}catch{}this.swipeGesture.start(e.timeStamp)}const r=e.clientX-this.swipeLastX;this.swipeLastX=e.clientX,this.swipeGesture.move(e.timeStamp,r),e.preventDefault()});m(this,"handleSwipePointerUp",e=>{this.swipePointerId===null||e.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.end(),this.releaseSwipePointerCapture(e.pointerId),this.endSwipeTracking())});m(this,"handleSwipePointerCancel",e=>{this.swipePointerId===null||e.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.cancel(),this.releaseSwipePointerCapture(e.pointerId),this.endSwipeTracking())});m(this,"handleSwipeWindowBlur",()=>{this.swipePointerId!==null&&this.swipeActive&&this.swipeGesture.cancel(),this.swipePointerId!==null&&this.releaseSwipePointerCapture(this.swipePointerId),this.endSwipeTracking()});m(this,"handleSwipeClick",e=>{this.swipeShouldSuppressClick&&(this.swipeShouldSuppressClick=!1,e.preventDefault(),e.stopPropagation(),typeof e.stopImmediatePropagation=="function"&&e.stopImmediatePropagation())});m(this,"handleWindowPointerMove",e=>{this.lastPointerX=e.clientX,this.lastPointerY=e.clientY,this.updatePointerVelocity(e.clientX,e.clientY),this.syncDragTargetForLatestPointer(),this.ensureDragFrameLoop()});m(this,"handleWindowPointerUp",e=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(e.pointerId),this.dragController.drop(),this.clearMotionTracking(),this.detachDragListeners()});m(this,"handleWindowPointerCancel",e=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(e.pointerId),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});m(this,"handleWindowBlur",()=>{this.releaseActiveDragPointerCapture(),this.stopDragFrameLoop(),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});m(this,"runDragFrame",e=>{if(this.dragController.status==="idle"){this.dragFrame=0;return}const r=Math.max(0,e-this.lastDragFrameTime)/Ig;this.lastDragFrameTime=e,this.samplePointerVelocityAt(e,this.lastPointerX,this.lastPointerY);const i=this.getBoundingClientRect(),s=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,i),o=this.getDragEdgeScrollDeltaPixels(s.x,i,r);this.scrollVelocityPxPerSec=r>ya?Math.abs(o)/r:0,Math.abs(o)>ya&&(this.animateNextRender=!1,this.layoutScroll.wheelPixels(Ee({x:o}))),this.dragController.status==="active"&&this.syncDragTarget(s.x,s.y,i),this.dragFrame=requestAnimationFrame(this.runDragFrame)});this.dragController.addEventListener("change",this.onDragControllerChange),this.dragController.addEventListener("drag",this.onDragControllerDrag),this.dragController.addEventListener("drop",this.onDragControllerDrop),this.layoutScroll.addEventListener("layout-scroll",this.onLayoutScrollInternal)}set cards(e){this._cards!==e&&(this._cards=e,this.scheduleRender())}get cards(){return this._cards}set layout(e){this._layout=[...e],this.stopDragFrameLoop(),this.dragController.cancel(),this.resizeState&&this.endResize(this.resizeState.pointerId),this.scrollModelKey="",this.syncScrollModel(),this.layoutScroll.scroll=xe({x:this._scrollPosition}),this.scheduleRender()}get layout(){return this._layout}commitLayout(e){this.layout=e,this.emitLayoutChanged()}set scrollPosition(e){Math.abs(e-this._scrollPosition)<ya||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=xe({x:e}))}get scrollPosition(){return this._scrollPosition}focusArtifact(e){const r=fr(this._layout),i=r.nodes.findIndex(o=>o.cards.some(a=>a.artifactID===e));if(i<0)return;let s=0;for(let o=0;o<i;o+=1)s+=r.nodes[o].width;this.scrollPosition=s,queueMicrotask(()=>{const o=this.querySelector(`.card-slot[data-layout-card-id="${Rg(e)}"]`);if(!o)return;o.classList.remove("card-focus-pulse"),o.offsetHeight,o.classList.add("card-focus-pulse");const a=()=>{o.classList.remove("card-focus-pulse"),o.removeEventListener("animationend",a)};o.addEventListener("animationend",a)})}connectedCallback(){this.hasAttribute("tabindex")||(this.tabIndex=0),this.focus(),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("wheel",this.handleWheel,{passive:!1}),this.addEventListener("pointerdown",this.handlePointerDown),this.addEventListener("artifact-wheel",this.handleArtifactWheel),window.addEventListener("message",this.handleWindowMessage),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>this.render()),this.resizeObserver.observe(this)),this.render()}disconnectedCallback(){var e;this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("wheel",this.handleWheel),this.removeEventListener("pointerdown",this.handlePointerDown),this.removeEventListener("artifact-wheel",this.handleArtifactWheel),window.removeEventListener("message",this.handleWindowMessage),(e=this.resizeObserver)==null||e.disconnect(),this.resizeObserver=null,this.clearWheelIdleSnap(),this.wheelGesture.reset(),this.detachDragListeners(),this.swipeGesture.status==="active"&&this.swipeGesture.cancel(),this.swipePointerId!==null&&this.releaseSwipePointerCapture(this.swipePointerId),this.endSwipeTracking(),this.dragController.removeEventListener("change",this.onDragControllerChange),this.dragController.removeEventListener("drag",this.onDragControllerDrag),this.dragController.removeEventListener("drop",this.onDragControllerDrop),this.layoutScroll.removeEventListener("layout-scroll",this.onLayoutScrollInternal),this.dragController.dispose(),this.stopDragFrameLoop(),this.resizeState&&this.endResize(this.resizeState.pointerId)}scheduleRender(){this.renderPending||(this.renderPending=!0,queueMicrotask(()=>{this.renderPending=!1,this.render()}))}createGrid(e,r){return new Sz({basis:Ee({x:En,y:En}),min:Ee({x:If,y:If}),viewport:Ee({x:e,y:r}),gap:Ee({x:le,y:le})})}syncScrollModel(){const e=eu(this),i=fr(this._layout).nodes.map(o=>o.width),s=`${e.width}x${e.height}:${i.join(",")}`;s===this.scrollModelKey&&this.layoutGrid||(this.scrollModelKey=s,this.layoutGrid=this.createGrid(e.width,e.height),this.layoutScroll.rebuild({grid:this.layoutGrid,nodeWidths:i.map(o=>xe({x:o})),snap:Cg}))}emitScrollPositionChanged(e){this.dispatchEvent(new gO(e))}emitLayoutChanged(){this.dispatchEvent(new Kb([...this._layout]))}shiftWindow(e){this.clearWheelIdleSnap(),this.syncScrollModel(),this.animateNextRender=!0,this.layoutScroll.step(e)}applyHorizontalWheel(e){this.syncScrollModel();const r=this.layoutGrid;if(!r)return;this.animateNextRender=!1;const i=r.toUnits(Ee({x:e}));this.layoutScroll.wheel(xe({x:i.x??0}))}scheduleWheelIdleSnap(){this.clearWheelIdleSnap(),this.wheelIdleSnapTimer=setTimeout(()=>{this.wheelIdleSnapTimer=null,this.animateNextRender=!0,this.layoutScroll.snap()},fO)}clearWheelIdleSnap(){this.wheelIdleSnapTimer!==null&&(clearTimeout(this.wheelIdleSnapTimer),this.wheelIdleSnapTimer=null)}findViewspanContainingNode(e){const r=this.layoutScroll.viewspans,i=this._scrollPosition;let s=null,o=Number.POSITIVE_INFINITY;for(const a of r)if(e>=a.nodeRange[0]&&e<=a.nodeRange[1]){const c=Math.abs(a.anchor-i);c<o&&(o=c,s=a)}return s}findManagedArtifactFrame(e){if(!e)return null;const r=this.querySelectorAll("iframe.artifact-frame");for(const i of r)if(i.contentWindow===e)return i;return null}isTrustedArtifactFrameMessage(e,r){if(e.origin==="null")return!0;const i=this.getArtifactFrameOrigin(r);return i===null||e.origin===i}getArtifactFrameOrigin(e){const r=e.getAttribute("src")??e.src;if(!r)return null;try{return new URL(r,window.location.href).origin}catch{return null}}beginResize(e,r){const i=r.getAttribute("data-resize-handle");if(!i)return;const s=this._layout.find(a=>a.type==="card"&&a.id===i);if(!s)return;const o=th(typeof s.width=="number"?s.width:gt);this.resizeState={cardId:i,pointerId:e.pointerId,startClientX:e.clientX,startWidth:o,currentWidth:o},this.attachResizeListeners();try{this.setPointerCapture(e.pointerId)}catch{}e.preventDefault(),e.stopPropagation()}attachResizeListeners(){this.resizeListenersAttached||(window.addEventListener("pointermove",this.handleResizePointerMove),window.addEventListener("pointerup",this.handleResizePointerUp),window.addEventListener("pointercancel",this.handleResizePointerCancel),window.addEventListener("blur",this.handleResizeWindowBlur),this.addEventListener("keydown",this.handleResizeKeyDown),this.resizeListenersAttached=!0)}detachResizeListeners(){this.resizeListenersAttached&&(window.removeEventListener("pointermove",this.handleResizePointerMove),window.removeEventListener("pointerup",this.handleResizePointerUp),window.removeEventListener("pointercancel",this.handleResizePointerCancel),window.removeEventListener("blur",this.handleResizeWindowBlur),this.removeEventListener("keydown",this.handleResizeKeyDown),this.resizeListenersAttached=!1)}endResize(e){this.resizeState=null,this.detachResizeListeners();try{this.hasPointerCapture(e)&&this.releasePointerCapture(e)}catch{}}beginSwipeTracking(e){this.swipePointerId=e.pointerId,this.swipeStartX=e.clientX,this.swipeStartY=e.clientY,this.swipeLastX=e.clientX,this.swipeActive=!1,this.swipeShouldSuppressClick=!1,this.attachSwipeListeners()}attachSwipeListeners(){this.swipeListenersAttached||(window.addEventListener("pointermove",this.handleSwipePointerMove),window.addEventListener("pointerup",this.handleSwipePointerUp),window.addEventListener("pointercancel",this.handleSwipePointerCancel),this.addEventListener("pointermove",this.handleSwipePointerMove),this.addEventListener("pointerup",this.handleSwipePointerUp),this.addEventListener("pointercancel",this.handleSwipePointerCancel),window.addEventListener("blur",this.handleSwipeWindowBlur),this.addEventListener("click",this.handleSwipeClick,{capture:!0}),this.swipeListenersAttached=!0)}detachSwipeListeners(){this.swipeListenersAttached&&(window.removeEventListener("pointermove",this.handleSwipePointerMove),window.removeEventListener("pointerup",this.handleSwipePointerUp),window.removeEventListener("pointercancel",this.handleSwipePointerCancel),this.removeEventListener("pointermove",this.handleSwipePointerMove),this.removeEventListener("pointerup",this.handleSwipePointerUp),this.removeEventListener("pointercancel",this.handleSwipePointerCancel),window.removeEventListener("blur",this.handleSwipeWindowBlur),this.removeEventListener("click",this.handleSwipeClick,{capture:!0}),this.swipeListenersAttached=!1)}endSwipeTracking(){this.swipePointerId=null,this.swipeActive=!1,this.detachSwipeListeners()}releaseSwipePointerCapture(e){try{this.hasPointerCapture(e)&&this.releasePointerCapture(e)}catch{}}releaseActiveDragPointerCapture(){this.activeDragPointerId!==null&&this.releasePointerCaptureForEvent(this.activeDragPointerId)}releasePointerCaptureForEvent(e){try{this.hasPointerCapture(e)&&this.releasePointerCapture(e)}catch{}}attachDragListeners(){this.dragListenersAttached||(window.addEventListener("pointermove",this.handleWindowPointerMove),window.addEventListener("pointerup",this.handleWindowPointerUp),window.addEventListener("pointercancel",this.handleWindowPointerCancel),this.addEventListener("pointermove",this.handleWindowPointerMove),this.addEventListener("pointerup",this.handleWindowPointerUp),this.addEventListener("pointercancel",this.handleWindowPointerCancel),window.addEventListener("blur",this.handleWindowBlur),this.dragListenersAttached=!0)}detachDragListeners(){this.dragListenersAttached&&(window.removeEventListener("pointermove",this.handleWindowPointerMove),window.removeEventListener("pointerup",this.handleWindowPointerUp),window.removeEventListener("pointercancel",this.handleWindowPointerCancel),this.removeEventListener("pointermove",this.handleWindowPointerMove),this.removeEventListener("pointerup",this.handleWindowPointerUp),this.removeEventListener("pointercancel",this.handleWindowPointerCancel),window.removeEventListener("blur",this.handleWindowBlur),this.dragListenersAttached=!1,this.activeDragPointerId=null)}getVisibleLayout(){return this.dragController.status!=="active"||!this.dragState?this.applyResizeOverride(this._layout):kg(this.dragState.projectedLayout)}applyResizeOverride(e){const r=this.resizeState;if(!r)return e;const i=e.findIndex(a=>a.type==="card"&&a.id===r.cardId);if(i===-1)return e;const s=e[i];if(!s||s.type!=="card"||s.width===r.currentWidth)return e;const o=[...e];return o[i]={...s,width:r.currentWidth},o}getGridSlotStyle(e){return`grid-column: ${e.col} / span ${e.width}; grid-row: ${e.row} / span ${e.height};`}findContainingBlock(e){let r=e.parentElement;for(;r;){const i=getComputedStyle(r);if(i.transform!=="none"||i.perspective!=="none"||i.filter!=="none")return r;const s=i.willChange;if(s.includes("transform")||s.includes("perspective")||s.includes("filter"))return r;const o=i.contain;if(o.includes("layout")||o.includes("paint")||o.includes("strict"))return r;r=r.parentElement}return document.documentElement}getDraggedSlotStyle(e){const r=this.currentDragPreviewSize??{width:e.size.x??0,height:e.size.y??0};return["position: fixed;",`width: ${r.width}px;`,`height: ${r.height}px;`,"pointer-events: none;","z-index: 10;"].join(" ")}writeDraggedSlotPosition(e,r){(!this.draggedSlotContainingBlock||!this.draggedSlotContainingBlock.isConnected||!this.draggedSlotContainingBlock.contains(e))&&(this.draggedSlotContainingBlock=this.findContainingBlock(e));const i=this.draggedSlotContainingBlock.getBoundingClientRect(),s=r.pointer.x??0,o=r.pointer.y??0,a=r.grabOffset.x??0,c=r.grabOffset.y??0,u=this.currentDragPreviewSize??{width:r.size.x??0,height:r.size.y??0},h=r.size.x??0,p=r.size.y??0,v=h>0?a*(u.width/h):a,g=p>0?c*(u.height/p):c;e.style.left=`${s-v-i.left}px`,e.style.top=`${o-g-i.top}px`,e.style.width=`${u.width}px`,e.style.height=`${u.height}px`}renderSlot(e,r){var o,a;if(e.kind==="placeholder")return e.placement?z`
190
+ */const $g=(n,t,e)=>{const r=new Map;for(let i=t;i<=e;i++)r.set(n[i],i);return r},Tg=Ql(class extends Sd{constructor(n){if(super(n),n.type!==wd.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 o=0;for(const a of n)i[o]=r?r(a,o):o,s[o]=e(a,o),o++;return{values:s,keys:i}}render(n,t,e){return this.dt(n,t,e).values}update(n,[t,e,r]){const i=z2(n),{values:s,keys:o}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=o,s;const a=this.ut??(this.ut=[]),c=[];let u,h,p=0,v=i.length-1,g=0,_=s.length-1;for(;p<=v&&g<=_;)if(i[p]===null)p++;else if(i[v]===null)v--;else if(a[p]===o[g])c[g]=ir(i[p],s[g]),p++,g++;else if(a[v]===o[_])c[_]=ir(i[v],s[_]),v--,_--;else if(a[p]===o[_])c[_]=ir(i[p],s[_]),fs(n,c[_+1],i[p]),p++,_--;else if(a[v]===o[g])c[g]=ir(i[v],s[g]),fs(n,i[p],i[v]),v--,g++;else if(u===void 0&&(u=$g(o,g,_),h=$g(a,p,v)),u.has(a[p]))if(u.has(a[v])){const k=h.get(o[g]),I=k!==void 0?i[k]:null;if(I===null){const P=fs(n,i[p]);ir(P,s[g]),c[g]=P}else c[g]=ir(I,s[g]),fs(n,i[p],I),i[k]=null;g++}else Qc(i[v]),v--;else Qc(i[p]),p++;for(;g<=_;){const k=fs(n,c[_+1]);ir(k,s[g]),c[g++]=k}for(;p<=v;){const k=i[p++];k!==null&&Qc(k)}return this.ut=o,L2(n,c),Nr}}),Ee=n=>({type:"px",...n}),xe=n=>({type:"unit",...n}),ya=2;class _z{constructor(t){m(this,"basis");m(this,"min");m(this,"_gap");m(this,"_viewport");m(this,"_unit");this.basis=t.basis,this.min=t.min,this._viewport=t.viewport,this._gap=t.gap??Ee({x:le,y:le});const e=this._viewport.x??zr,r=this._viewport.y??sl,i=this._gap.x??le,s=this._gap.y??le,o=e<=XA,a=o?e-i*ya:Math.min(zr,e-i*ya),c=o?r-s*ya:Math.min(sl,r-s*ya),u=(a-i*(gt-1))/gt,h=(c-s*(lt-1))/lt,p=this.basis.x??0,v=this.basis.y??0,g=this.min.x??0,_=this.min.y??0;this._unit=Ee(o?{x:Math.max(g,u),y:Math.max(_,h)}:{x:Math.max(g,Math.min(p,u)),y:Math.max(_,Math.min(v,h))})}get unit(){return this._unit}get viewport(){return this._viewport}get gap(){return this._gap}toUnits(t){return xe({x:t.x==null?void 0:t.x/(this._unit.x??1),y:t.y==null?void 0:t.y/(this._unit.y??1)})}toPixels(t){const e=this._unit.x??0,r=this._unit.y??0,i=this._gap.x??le,s=this._gap.y??le,o=t.x==null?void 0:t.x*e+Math.max(0,t.x-1)*i,a=t.y==null?void 0:t.y*r+Math.max(0,t.y-1)*s;return Ee({x:o,y:a})}}const Ur=1e-4,At=1e-6,kz=40,xz=24;function Gb(n,t){return Math.max(0,n-t*2)}function qb(n){const t=[0];for(const e of n)t.push((t[t.length-1]??0)+e);return t}function Yb(n){const t=[0];for(let e=0;e<n.length;e+=1){const r=t[e]??0;t.push(r+n[e]+le)}return t}function Xb(n,t,e){if(t<0||t>=n.length)return 0;let r=0,i=0;for(let s=t;s<n.length;s+=1){const o=n[s],a=i===0?o:r+le+o;if(a>e+Ur)break;r=a,i+=1}return Math.max(1,i)}function Ez(n,t,e){if(t<0||t>=n.length)return 0;let r=0,i=0;for(let s=t;s>=0;s-=1){const o=n[s],a=i===0?o:r+le+o;if(a>e+Ur)break;r=a,i+=1}return Math.max(1,i)}function Az(n,t){if(n.length===0)return 0;let e=0,r=0;for(let i=n.length-1;i>=0;i-=1){const s=n[i],o=r===0?s:e+le+s;if(o>t+Ur)break;e=o,r+=1}return Math.max(1,r)}function kd(n,t){if(n.length===0)return 0;const e=Az(n,t);return Math.max(0,n.length-e)}function Ig(n,t,e){if(n.length===0)return 0;const r=Xb(n,t,e),i=Math.min(n.length,t+r);if(i<=t)return 0;const s=n.slice(t,i);return s.reduce((o,a)=>o+a,0)+Math.max(0,s.length-1)*le}function ch(n,t,e){const r=n[t]??0;return e-r}function di(n,t,e,r,i){if(n.length===0)return 0;const s=kd(n,i),o=t[s]??0,a=Math.max(0,Math.min(o,e));let c=0;for(let F=0;F<s;F+=1){const Y=t[F]??0,j=t[F+1]??Y;if(a>=Y&&a<=j+Ur){c=F;break}c=F+1}const u=Math.min(c+1,s),h=t[c]??0,p=t[u]??h,v=Math.max(p-h,Ur),g=u===c?0:(a-h)/v,_=Yb(n),k=Ig(n,c,i),I=Ig(n,u,i),P=(r-k)/2,R=(r-I)/2,Z=ch(_,c,P),N=ch(_,u,R);return Z+(N-Z)*g}function $z(n,t,e,r,i){const s=kd(n,r),o=t[s]??0;let a=0,c=o;for(let u=0;u<kz;u+=1){const h=(a+c)/2;di(n,t,h,e,r)>i?a=h:c=h}return(a+c)/2}function Tz(n,t,e){const r=Yb(n),[i,s]=t,o=n.slice(i,s+1),a=o.reduce((u,h)=>u+h,0)+Math.max(0,o.length-1)*le,c=(e-a)/2;return ch(r,i,c)}function Iz(n,t,e){const r=Xb(n,t,e);return[t,Math.min(n.length-1,t+r-1)]}function Cz(n,t,e){const r=Ez(n,t,e);return[Math.max(0,t-r+1),t]}function Rz(n,t){return n[0]===t[0]&&n[1]===t[1]}function Pz(n){const{nodeCols:t,nodeWidthsPx:e,viewportWidthPx:r}=n;if(t.length===0||e.length===0)return{viewspans:[],minScroll:0,maxScroll:0};const i=e.length,s=n.gapPx??le,o=Gb(r,s),a=qb(t),c=kd(e,o),u=a[c]??0;function h(I){const P=Tz(e,I,r),R=$z(e,a,r,o,P);return{nodeRange:I,anchor:Math.max(0,Math.min(u,R))}}const p=[];for(let I=0;I<i;){const P=Iz(e,I,o);p.push(h(P)),I=P[1]+1}const v=h(Cz(e,i-1,o)),g=p.filter(I=>I.nodeRange[0]<v.nodeRange[0]),_=g[g.length-1];return{viewspans:_&&Rz(_.nodeRange,v.nodeRange)?g:[...g,v],minScroll:0,maxScroll:u}}function ri(n,t){var i;let e=0,r=Number.POSITIVE_INFINITY;for(let s=0;s<n.length;s+=1){const o=Math.abs((((i=n[s])==null?void 0:i.anchor)??0)-t);if(o+At<r){r=o,e=s;continue}Math.abs(o-r)<=At&&s<e&&(e=s)}return e}function Dz(n,t,e){return e<=0?0:Math.max(0,Math.min(e-1,n+t))}function sr(n,t,e){return Math.max(t,Math.min(e,n))}function Lz(n,t){var e;for(let r=0;r<n.length;r+=1)if(Math.abs((((e=n[r])==null?void 0:e.anchor)??0)-t)<=At)return r;return-1}function zz(n,t,e){var i,s;if(n.length===0)return t;const r=Lz(n,t);if(r>=0){const o=n[r+e];return(o==null?void 0:o.anchor)??n[e>0?n.length-1:0].anchor}if(e>0){for(const o of n)if(o.anchor>t+At)return o.anchor;return((i=n[n.length-1])==null?void 0:i.anchor)??t}for(let o=n.length-1;o>=0;o-=1){const a=n[o];if(a&&a.anchor<t-At)return a.anchor}return((s=n[0])==null?void 0:s.anchor)??t}class Oz extends tn{constructor(e){super();m(this,"_scroll",0);m(this,"_minScroll",0);m(this,"_maxScroll",0);m(this,"_viewspans",[]);m(this,"_activeViewspanIndex",0);m(this,"_nodeWidthsPx",[]);m(this,"_boundaryCols",[0]);m(this,"_viewportWidthPx",0);m(this,"_framedViewportWidthPx",0);this._scroll=(e==null?void 0:e.x)??0}get scroll(){return xe({x:this._scroll})}get translate(){return Ee({x:di(this._nodeWidthsPx,this._boundaryCols,this._scroll,this._viewportWidthPx,this._framedViewportWidthPx)})}get activeViewspan(){return this._viewspans[this._activeViewspanIndex]??null}get viewspans(){return this._viewspans}set scroll(e){const r=sr(e.x??this._scroll,this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=At||(this._scroll=r,this._activeViewspanIndex=ri(this._viewspans,this._scroll),this.dispatchEvent(new ni("layout-scroll",{scroll:this.scroll})))}rebuild(e){var v;const r=e.nodeWidths.map(g=>Math.max(0,g.x??0)),i=r.map(g=>e.grid.toPixels(xe({x:g})).x??0),s=e.grid.viewport.x??0,o=e.grid.gap.x??le,a=Pz({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this._nodeWidthsPx=i,this._boundaryCols=qb(r),this._viewportWidthPx=s,this._framedViewportWidthPx=Gb(s,o),this._viewspans=a.viewspans,this._minScroll=a.minScroll,this._maxScroll=a.maxScroll;const c=sr(this._scroll,this._minScroll,this._maxScroll);this._activeViewspanIndex=ri(this._viewspans,c);const h=e.snap!==!1?((v=this._viewspans[this._activeViewspanIndex])==null?void 0:v.anchor)??c:c,p=sr(h,this._minScroll,this._maxScroll);Math.abs(p-this._scroll)>At&&(this._scroll=p,this.dispatchEvent(new ni("layout-scroll",{scroll:this.scroll})))}step(e){var o;if(this._viewspans.length===0)return;const r=Dz(this._activeViewspanIndex,e,this._viewspans.length),i=((o=this._viewspans[r])==null?void 0:o.anchor)??this._scroll,s=sr(i,this._minScroll,this._maxScroll);this._activeViewspanIndex=r,!(Math.abs(s-this._scroll)<=At)&&(this._scroll=s,this.dispatchEvent(new ni("layout-scroll",{scroll:this.scroll})))}snap(e){var s;if(this._viewspans.length===0)return;const r=e===void 0?((s=this._viewspans[ri(this._viewspans,this._scroll)])==null?void 0:s.anchor)??this._scroll:zz(this._viewspans,this._scroll,e),i=sr(r,this._minScroll,this._maxScroll);this._activeViewspanIndex=ri(this._viewspans,i),!(Math.abs(i-this._scroll)<=At)&&(this._scroll=i,this.dispatchEvent(new ni("layout-scroll",{scroll:this.scroll})))}wheel(e){const r=sr(this._scroll+(e.x??0),this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=At||(this._scroll=r,this._activeViewspanIndex=ri(this._viewspans,this._scroll),this.dispatchEvent(new ni("layout-scroll",{scroll:this.scroll})))}wheelPixels(e){const r=e.x??0;if(Math.abs(r)<=Ur)return;const i=di(this._nodeWidthsPx,this._boundaryCols,this._scroll,this._viewportWidthPx,this._framedViewportWidthPx),s=i-r,o=di(this._nodeWidthsPx,this._boundaryCols,this._maxScroll,this._viewportWidthPx,this._framedViewportWidthPx),a=di(this._nodeWidthsPx,this._boundaryCols,this._minScroll,this._viewportWidthPx,this._framedViewportWidthPx),c=Math.max(o,Math.min(a,s));if(Math.abs(c-i)<=Ur)return;let u=this._minScroll,h=this._maxScroll;for(let v=0;v<xz;v+=1){const g=(u+h)/2;di(this._nodeWidthsPx,this._boundaryCols,g,this._viewportWidthPx,this._framedViewportWidthPx)>c?u=g:h=g}const p=sr((u+h)/2,this._minScroll,this._maxScroll);Math.abs(p-this._scroll)<=At||(this._scroll=p,this._activeViewspanIndex=ri(this._viewspans,this._scroll),this.dispatchEvent(new ni("layout-scroll",{scroll:this.scroll})))}}const ru={"stack-above":{left:.25,top:0,width:.5,height:.5},"stack-below":{left:.25,top:.5,width:.5,height:.5},"reorder-before":{left:0,top:0,width:.25,height:1},"reorder-after":{left:.75,top:0,width:.25,height:1}},Mz=["stack-above","stack-below","reorder-before","reorder-after"];function iu(n,t){return{left:n.left+n.width*t.left,top:n.top+n.height*t.top,width:n.width*t.width,height:n.height*t.height}}function or(n,t,e){return n>=e.left&&n<e.left+e.width&&t>=e.top&&t<e.top+e.height}function uh(n){return Number.isFinite(n)?Math.max(Us,Math.min(sd,Math.round(n))):Us}function Nz(n,t,e){const r=n.findIndex(a=>a.type==="card"&&a.id===t);if(r===-1)return n;const i=n[r];if(!i||i.type!=="card")return n;const s=uh(e);if(i.width===s)return n;const o=[...n];return o[r]={...i,width:s},o}function Kb(n,t){for(const e of n){if(e.type==="card"&&e.id===t)return e;if(e.type==="stack")for(const r of e.children){if(r.type==="card"&&r.id===t)return r;if(r.type==="row"){for(const i of r.children)if(i.id===t)return i}}}return null}function hh(n){return n.height===lt||n.height===Vn?{...n,height:Vn}:n}function dh(n){return n.height===Vn?{...n,height:lt}:n}function Uz(n,t,e,r){const i=n.findIndex(h=>h.type==="stack"&&h.id===t);if(i===-1)return n;const s=n[i];if(!s||s.type!=="stack")return n;const o=s.children.find(h=>h.type==="card"&&h.id===e);if(!o||o.type!=="card")return n;const a=s.children.filter(h=>h.id!==e);if(a.length===s.children.length||a.length<1)return n;const c=[...n];if(a.length===1){const[h]=a;c[i]=h.type==="card"?dh(h):h}else c[i]={...s,children:a};const u=Math.max(0,Math.min(r,c.length));return c.splice(u,0,dh(o)),c}const Fz=Fe(),Hz=Fe(),Zz=50;function Wz(n,t){if(n.type!==t.type)return!1;switch(n.type){case"reorder":return t.index===n.index;case"stack":return t.targetCardId===n.targetCardId&&t.position===n.position;case"stack-child-noop":return!0;case"stack-child-extract":return t.toIndex===n.toIndex;case"stack-child-reorder":return t.position===n.position;default:return!1}}function qo(n){return{id:n.id,type:"drop-target",width:n.width,height:n.height}}function Cg(n){return n.map(Bz)}function Vz(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function Bz(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n.type==="stack"?{...n,children:n.children.map(Vz)}:n}function Jb(n,t){return n.find(r=>r.type==="card"&&r.id===t)??null}function Rg(n,t){return n.find(r=>r.type==="stack"&&r.id===t)??null}function jz(n,t){const e=[...t],r=e.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(r===-1)return null;const i=e[r];if(!i||i.type!=="card")return null;e.splice(r,1);const s=Math.max(0,Math.min(n.lastReorderIndex,e.length));e.splice(s,0,i);const o=e.findIndex(a=>a.type==="card"&&a.id===n.nodeId);return o===-1?null:{base:e,visualDraggedIndex:o}}function Gz(n,t,e,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(v=>v.type==="card"&&v.id===e.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=Jb(r,t.nodeId);if(!a)return null;const c=hh(a),u=hh(o),h=qo(c),p=e.position==="above"?[h,u]:[u,h];return i[s]={id:o.id,type:"stack",children:p},i}function su(n,t){return n.parentStackId?Yz(n,t):qz(n,t)}function qz(n,t){const e=n.hitTarget;if(e.type==="reorder"){const r=t[n.sourceIndex];if(!r||r.type!=="card")return[...t];const i=[...t];return i.splice(n.sourceIndex,1),i.splice(e.index,0,qo(r)),i}if(e.type==="stack"){const r=jz(n,t);return r?Gz(r,n,e,t)??[...t]:[...t]}return[...t]}function Yz(n,t){const e=n.hitTarget;switch(e.type){case"stack-child-reorder":return Xz(n,t,e.position);case"stack-child-extract":return Kz(n,t,e.toIndex);case"stack-child-noop":return Jz(n,t);default:return[...t]}}function Xz(n,t,e){const r=t.findIndex(v=>v.type==="stack"&&v.id===n.parentStackId);if(r===-1)return[...t];const i=t[r];if(!i||i.type!=="stack")return[...t];if(!i.children.every(v=>v.type==="card"))return[...t];const s=i.children,o=s.findIndex(v=>v.id===n.nodeId);if(o===-1)return[...t];const a=s[o],c=s.filter(v=>v.id!==n.nodeId),u=qo(a),h=e==="above"?[u,...c]:[...c,u],p=[...t];return p[r]={...i,children:h},p}function Kz(n,t,e){if(!n.parentStackId)return[...t];const r=Uz(t,n.parentStackId,n.nodeId,e);if(r===t)return[...t];const i=r.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(i===-1)return[...t];const s=r[i];if(!s||s.type!=="card")return[...t];const o=[...r];return o[i]=qo(s),o}function Jz(n,t){const e=t.findIndex(c=>c.type==="stack"&&c.id===n.parentStackId);if(e===-1)return[...t];const r=t[e];if(!r||r.type!=="stack")return[...t];const i=r.children.findIndex(c=>c.type==="card"&&c.id===n.nodeId);if(i===-1)return[...t];const s=r.children[i];if(!s||s.type!=="card")return[...t];const o=[...t],a=[...r.children];return a[i]=qo(s),o[e]={...r,children:a},o}function Qz(n,t){return t.find(r=>r.type==="stack"&&r.id===n.id)?n.id:Zl()}function eO(n,t,e){if(n.type==="drop-target"){const r=Kb(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return hh(r)}return n}function tO(n,t,e){const r=n.children.map(s=>eO(s,t,e));return{id:Qz(n,t),type:"stack",children:r}}function nO(n,t,e){if(n.type==="drop-target"){const r=Kb(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return Jb(t,e)!==null?r:dh(r)}return n.type==="card"||n.type==="row"?n:tO(n,t,e)}function rO(n,t,e){return n.map(r=>nO(r,t,e))}function iO(n,t){return JSON.stringify(n)===JSON.stringify(t)}const sO=jo(tn);class oO extends sO{constructor(e={}){super();m(this,"pending",null);m(this,"active",null)}start(e){if(this.pending||this.active)return;const r=e.pointer.x??0,i=e.pointer.y??0;this.pending={startX:r,startY:i,grabOffsetX:e.grabOffset.x??0,grabOffsetY:e.grabOffset.y??0,nodeId:e.nodeId,sourceIndex:e.source.index,parentStackId:e.source.parentId,width:e.size.x??0,height:e.size.y??0,baseLayout:e.layout}}update(e){const r=e.pointer.x??0,i=e.pointer.y??0,s=this.pending;if(s){const u=r-s.startX,h=i-s.startY;Math.hypot(u,h)>=JA&&(this.pending=null,this.active={...s,pointerX:r,pointerY:i,hitTarget:{type:"reorder",index:s.sourceIndex},lastReorderIndex:s.sourceIndex},this.emitDrag(),this.dispatchEvent(new ae("change")));return}if(!this.active)return;const o=su(this.active,this.active.baseLayout),a=this.getHitTargetForPointer(r,i,e,o),c=a.type==="reorder"?a.index:this.active.lastReorderIndex;this.active.pointerX===r&&this.active.pointerY===i&&Wz(this.active.hitTarget,a)&&this.active.lastReorderIndex===c||(this.active={...this.active,pointerX:r,pointerY:i,hitTarget:a,lastReorderIndex:c},this.emitDrag(),this.dispatchEvent(new ae("change")))}drop(){if(this.pending){this.cancel();return}if(!this.active)return;const e=this.active.baseLayout;let r=null;try{const i=su(this.active,e),s=rO(i,e,this.active.nodeId);iO(s,e)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new Hz("drop",{layout:r})),this.dispatchEvent(new ae("change"))}cancel(){!this.pending&&!this.active||(this.reset(),this.dispatchEvent(new ae("change")))}dispose(){this.reset()}get status(){return this.active?"active":this.pending?"pending":"idle"}reset(){this.pending=null,this.active=null}emitDrag(){if(!this.active)return;const e=su(this.active,this.active.baseLayout);this.dispatchEvent(new Fz("drag",{nodeId:this.active.nodeId,source:{index:this.active.sourceIndex,parentId:this.active.parentStackId},grabOffset:Ee({x:this.active.grabOffsetX,y:this.active.grabOffsetY}),pointer:Ee({x:this.active.pointerX,y:this.active.pointerY}),size:Ee({x:this.active.width,y:this.active.height}),projectedLayout:e}))}getHitTargetForPointer(e,r,i,s){return this.active?this.isPointerInsideDragBounds(e,r,i.viewport)?this.active.parentStackId?this.getStackChildHitTarget(e,r,i,s):this.getTopLevelCardHitTarget(e,r,i,s):{type:"reorder",index:this.active.sourceIndex}:{type:"reorder",index:0}}getStackChildHitTarget(e,r,i,s){var u;if(!((u=this.active)!=null&&u.parentStackId))return{type:"stack-child-noop"};const o=this.getSourceStackInteractionRect(i.geometry);if(o&&or(e,r,o)){const h=o.top+o.height/2;return{type:"stack-child-reorder",position:r<h?"above":"below"}}const a=this.getSourceRemainingSiblingRect(i.geometry);if(a&&or(e,r,a)){const h=a.top+a.height/2;return{type:"stack-child-reorder",position:r<h?"above":"below"}}return{type:"stack-child-extract",toIndex:this.getTopLevelReorderIndexForPointer(e,r,i,s)}}getSourceRemainingSiblingRect(e){var s,o;if(!((s=this.active)!=null&&s.parentStackId))return;const r=Rg(this.active.baseLayout,this.active.parentStackId);if(!r)return;const i=r.children.find(a=>{var c;return a.type==="card"&&a.id!==((c=this.active)==null?void 0:c.nodeId)});if(i)return(o=e.find(a=>a.id===i.id))==null?void 0:o.rect}getSourceStackInteractionRect(e){var o;if(!((o=this.active)!=null&&o.parentStackId))return;const r=e.find(a=>{var c;return a.id===((c=this.active)==null?void 0:c.parentStackId)});if(r)return this.active.sourceStackRect=r.rect,r.rect;const i=Rg(this.active.baseLayout,this.active.parentStackId);if(!i)return this.active.sourceStackRect;const s=i.children.find(a=>{var c;return a.type==="card"&&a.id!==((c=this.active)==null?void 0:c.nodeId)});if(s){const a=e.find(c=>c.id===s.id);if(a)return a.rect}return this.active.sourceStackRect}getTopLevelCardHitTarget(e,r,i,s){var g,_,k;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return{type:"reorder",index:((g=this.active)==null?void 0:g.sourceIndex)??0};const c=(i.effectiveVelocity??0)<=Zz;for(const I of o){const P=I.rect;if(!or(e,r,P))continue;const R=this.resolveTopLevelTargetForCard(e,r,I,I.logicalIndex,c);if(R)return R;if(!c&&((_=this.active)!=null&&_.hitTarget))return this.active.hitTarget}const u=this.getNearestTargetableZone(e,o);if(!u)return{type:"reorder",index:((k=this.active)==null?void 0:k.sourceIndex)??0};const h=Math.max(u.rect.left,Math.min(u.rect.left+u.rect.width,e)),p=this.resolveTopLevelTargetForCard(h,r,u,u.logicalIndex,c);if(p)return p;const v=u.rect.left+u.rect.width/2;return{type:"reorder",index:e<v?u.logicalIndex:u.logicalIndex+1}}getTopLevelReorderIndexForPointer(e,r,i,s){var u,h;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return((u=this.active)==null?void 0:u.sourceIndex)??0;for(const p of o){if(!or(e,r,p.rect))continue;const v=iu(p.rect,ru["reorder-before"]);if(or(e,r,v))return p.logicalIndex;const g=iu(p.rect,ru["reorder-after"]);if(or(e,r,g))return p.logicalIndex+1}const a=this.getNearestTargetableZone(e,o);if(!a)return((h=this.active)==null?void 0:h.sourceIndex)??0;const c=a.rect.left+a.rect.width/2;return e<c?a.logicalIndex:a.logicalIndex+1}getTopLevelZoneNodes(e,r){const i=new Map(r.map(a=>[a.id,a])),s=[];let o=0;for(const a of e){const c=i.get(a.id);c&&c.type!=="drop-target"&&(c.type==="card"||c.type==="stack")&&(s.push({id:c.id,rect:a.rect,logicalIndex:o}),o+=1)}return s}resolveTopLevelTargetForCard(e,r,i,s,o){const a=i.rect;for(const c of Mz){if(!o&&(c==="stack-above"||c==="stack-below"))continue;const u=ru[c],h=iu(a,u);if(or(e,r,h))return c==="stack-above"?{type:"stack",targetCardId:i.id,position:"above"}:c==="stack-below"?{type:"stack",targetCardId:i.id,position:"below"}:c==="reorder-before"?{type:"reorder",index:s}:{type:"reorder",index:s+1}}return null}getNearestTargetableZone(e,r){let i=null,s=Number.POSITIVE_INFINITY;for(const o of r){const a=o.rect.left,c=o.rect.left+o.rect.width,u=e<a?a-e:e>c?e-c:0;u<s&&(s=u,i=o)}return i}isPointerInsideDragBounds(e,r,i){return e>=i.left&&e<=i.left+i.width&&r>=i.top&&r<=i.top+i.height}}const Pg=60,aO=80,Dg=.5,Lg=10;class lO{constructor(){m(this,"awaitingFreshWheelGesture",!1);m(this,"lastWheelEventAt",Number.NEGATIVE_INFINITY);m(this,"lastWheelDeltaX",0);m(this,"activeGestureType","none");m(this,"lastWheelGestureAt",Number.NEGATIVE_INFINITY)}markKeyboardNavigation(t){this.awaitingFreshWheelGesture=!0,this.lastWheelEventAt=t,this.activeGestureType="none"}reset(){this.awaitingFreshWheelGesture=!1,this.lastWheelEventAt=Number.NEGATIVE_INFINITY,this.lastWheelDeltaX=0,this.activeGestureType="none",this.lastWheelGestureAt=Number.NEGATIVE_INFINITY}decide(t){const{now:e,shiftKey:r,deltaX:i,deltaY:s,overArtifactContent:o}=t;e-this.lastWheelGestureAt>=Pg&&(this.activeGestureType="none");const c=r&&s!==0,u=c?s:i,h=Math.abs(u),p=Math.abs(s);return this.activeGestureType==="vertical-artifact"&&o?h>=Dg&&h>=p*Lg?this.classifyHorizontal(e,u):(this.lastWheelGestureAt=e,{type:"scroll-native"}):this.activeGestureType==="horizontal-filmstrip"?!c&&o&&p>0&&p>=h*Lg?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=e,{type:"scroll-native"}):this.classifyHorizontal(e,u):h<Dg?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=e,{type:"scroll-native"}):c||h>p?this.classifyHorizontal(e,u):p>h?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=e,{type:"scroll-native"}):o?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=e,{type:"scroll-native"}):this.classifyHorizontal(e,u)}classifyHorizontal(t,e){const r=t-this.lastWheelEventAt,i=Math.sign(this.lastWheelDeltaX),s=Math.sign(e),o=i!==0&&s!==0&&i!==s,a=i!==0&&Math.abs(e)>=Math.abs(this.lastWheelDeltaX)+aO;return this.awaitingFreshWheelGesture&&r<Pg&&!o&&!a?{type:"ignore"}:(this.lastWheelEventAt=t,this.lastWheelDeltaX=e,this.lastWheelGestureAt=t,this.awaitingFreshWheelGesture=!1,this.activeGestureType="horizontal-filmstrip",{type:"scroll-horizontal",horizontalDelta:e})}}const cO=100,uO=1e3;class hO{constructor(t,e){m(this,"_status","idle");m(this,"cumulativeOffset",0);m(this,"samples",[]);m(this,"scroll");m(this,"setAnimating");this.scroll=t,this.setAnimating=e}get status(){return this._status}start(t){this._status="active",this.cumulativeOffset=0,this.samples=[{time:t,offset:0}]}move(t,e){this._status==="active"&&(this.cumulativeOffset+=e,this.samples.push({time:t,offset:this.cumulativeOffset}),this.pruneSamples(t),this.setAnimating(!1),this.scroll.wheelPixels(Ee({x:-e})))}end(){if(this._status!=="active")return;const t=this.computeVelocityPxPerSec();this.setAnimating(!0),Math.abs(t)<e1?this.scroll.snap():this.scroll.snap(t>0?-1:1),this.reset()}cancel(){this._status==="active"&&(this.setAnimating(!0),this.scroll.snap(),this.reset())}reset(){this._status="idle",this.cumulativeOffset=0,this.samples=[]}pruneSamples(t){const e=t-cO;let r=0;for(let i=0;i<this.samples.length;i+=1){if(this.samples[i].time>=e){r=i;break}r=i+1}if(r>0){const i=Math.max(0,r-1);this.samples=this.samples.slice(i)}}computeVelocityPxPerSec(){if(this.samples.length<2)return 0;const t=this.samples[0],e=this.samples[this.samples.length-1],r=e.time-t.time;return r<=0?0:(e.offset-t.offset)/r*uO}}function dO({baseLayout:n,visibleLayout:t,resolved:e,cardsByID:r,grid:i,dragState:s,isForeground:o}){var _;const a=new Map(t.map(k=>[k.id,k])),c=e.nodes.map((k,I)=>{const P=a.get(k.id),R=[];for(const N of k.cards){if(s&&N.id===s.nodeId){R.push({key:`placeholder:${N.id}`,kind:"placeholder",card:null,placement:N,isTopLevelCard:!1,isDragged:!1,sourceStackId:s.source.parentId??null});continue}const F=r.get(N.id);F&&R.push({key:F.id,kind:"card",card:F,placement:N,isTopLevelCard:(P==null?void 0:P.type)==="card",isDragged:!1,sourceStackId:null})}if(s!=null&&s.source.parentId&&k.id===s.source.parentId){const N=r.get(s.nodeId);if(N){const F={key:N.id,kind:"card",card:N,placement:null,isTopLevelCard:!1,isDragged:!0,sourceStackId:s.source.parentId},Y=pO(n,s.source.parentId,s.nodeId),j=Y<0?R.length:Math.min(Y,R.length);R.splice(j,0,F)}}const Z=!!(s&&(P==null?void 0:P.type)==="card"&&P.id===s.nodeId&&P.artifactID===s.nodeId);return{key:Z?`placeholder:${k.id}`:k.id,kind:"visible",nodeId:k.id,widthPx:i.toPixels(xe({x:k.width})).x??0,widthUnits:k.width,layoutIndex:I,isForeground:o(I),isPlaceholder:Z,slots:R}});if(!s||s.source.parentId&&a.has(s.source.parentId))return c;const u=r.get(s.nodeId);if(!u)return c;const h=s.source.parentId??s.nodeId,p=((_=gr(n).nodes[s.source.index])==null?void 0:_.width)??gt,v={key:h,kind:"ghost",nodeId:h,widthPx:0,widthUnits:p,layoutIndex:null,isForeground:!1,isPlaceholder:!1,slots:[{key:u.id,kind:"card",card:u,placement:null,isTopLevelCard:!s.source.parentId,isDragged:!0,sourceStackId:s.source.parentId??null}]},g=Math.max(0,Math.min(s.source.index,c.length));return c.splice(g,0,v),c}function zg(n){if(!n)return null;const t=n.projectedLayout,e=n.source.parentId;for(const i of t){if(i.type!=="stack")continue;const s=i.children.findIndex(u=>u.type==="drop-target");if(s===-1)continue;const o=s===0?"above":"below";if(e&&e===i.id)return`stack-child-reorder:${o}`;const a=i.children.find(u=>u.type!=="drop-target");return`stack:${(a==null?void 0:a.type)==="card"?a.artifactID:(a==null?void 0:a.id)??""}:${o}`}const r=t.findIndex(i=>i.type==="drop-target");return r===-1?"none":e?`stack-child-extract:${r}`:`reorder:${r}`}function pO(n,t,e){const r=n.find(i=>i.type==="stack"&&i.id===t);return!r||r.type!=="stack"?-1:r.children.findIndex(i=>i.type==="card"&&i.id===e)}const fO=2,Og=1e3,ba=1e-4,gO=120,Mg=!1;function Ng(n){return n.replace(/["\\]/g,"\\$&")}function Ug(n,t,e){if(n===0)return 0;const r=t.toPixels(xe({y:lt})).y??0;return(e-r)/fO}function ou(n){const t=n.clientWidth>0?n.clientWidth:zr,e=n.clientHeight>0?n.clientHeight:sl;let r=0,i=0;if(n.isConnected){const o=getComputedStyle(n);r=parseFloat(o.paddingTop)||0,i=parseFloat(o.paddingBottom)||0}const s=Math.max(1,e-r-i);return{width:t,height:s,offsetY:r}}class mO extends Event{constructor(e){super("scroll",{bubbles:!0,composed:!0});m(this,"scrollPosition");this.scrollPosition=e}}class Qb extends Event{constructor(e){super("layout-change",{bubbles:!0,composed:!0});m(this,"layout");this.layout=e}}class vO extends HTMLElement{constructor(){super();m(this,"_layout",[]);m(this,"_scrollPosition",0);m(this,"layoutGrid",null);m(this,"layoutScroll",new Oz(xe({x:0})));m(this,"scrollModelKey","");m(this,"resizeObserver",null);m(this,"renderPending",!1);m(this,"animateNextRender",!0);m(this,"wheelGesture",new lO);m(this,"swipeGesture",new hO(this.layoutScroll,e=>{this.animateNextRender=e}));m(this,"swipePointerId",null);m(this,"swipeStartX",0);m(this,"swipeStartY",0);m(this,"swipeLastX",0);m(this,"swipeActive",!1);m(this,"swipeShouldSuppressClick",!1);m(this,"swipeListenersAttached",!1);m(this,"wheelIdleSnapTimer",null);m(this,"dragController",new oO);m(this,"dragState",null);m(this,"activeDragPointerId",null);m(this,"dragListenersAttached",!1);m(this,"dragFrame",0);m(this,"lastDragFrameTime",0);m(this,"lastPointerX",0);m(this,"lastPointerY",0);m(this,"pointerVelocityPxPerSec",0);m(this,"scrollVelocityPxPerSec",0);m(this,"motionSampleTime",0);m(this,"motionSampleX",0);m(this,"motionSampleY",0);m(this,"lastDragControllerStatus","idle");m(this,"lastProjectedDragLayoutSignature","");m(this,"lastDragDropIntent",null);m(this,"lastActivePlaceholderId",null);m(this,"draggedSlotElement",null);m(this,"draggedSlotContainingBlock",null);m(this,"currentDragPreviewSize",null);m(this,"dragTrackOffsetXPx",0);m(this,"previousProjectedLayoutForOffset",null);m(this,"resizeState",null);m(this,"resizeListenersAttached",!1);m(this,"_cards",new Map);m(this,"onDragControllerChange",()=>{const e=this.dragController.status;e!==this.lastDragControllerStatus&&(this.lastDragControllerStatus=e,e==="idle"&&(this.dragState=null,this.resetDragPreviewState()),this.scheduleRender())});m(this,"onDragControllerDrag",e=>{var c;const r=JSON.stringify(e.projectedLayout),i=zg(e),s=bO(e.projectedLayout);if(r!==this.lastProjectedDragLayoutSignature||i!==this.lastDragDropIntent||s!==this.lastActivePlaceholderId){const u=Cg(e.projectedLayout),h=this.shouldApplyTrackOffset(e.projectedLayout,e.source.parentId),p=e.source.parentId?this.getStackChildAnchorCardId(e.source.parentId,e.nodeId):null;this.dragTrackOffsetXPx=h?this.computeDragTrackOffset(this.previousProjectedLayoutForOffset,u,e.nodeId,e.source.parentId,p,this.dragTrackOffsetXPx):0,this.previousProjectedLayoutForOffset=u,this.lastProjectedDragLayoutSignature=r,this.lastDragDropIntent=i,this.lastActivePlaceholderId=s,this.dragState={nodeId:e.nodeId,source:e.source,grabOffset:e.grabOffset,pointer:e.pointer,size:e.size,projectedLayout:e.projectedLayout},this.scheduleRender();return}this.dragState={nodeId:e.nodeId,source:e.source,grabOffset:e.grabOffset,pointer:e.pointer,size:e.size,projectedLayout:((c=this.dragState)==null?void 0:c.projectedLayout)??e.projectedLayout};const a=this.getCachedDraggedSlotElement(e.nodeId);a&&this.writeDraggedSlotPosition(a,this.dragState)});m(this,"onDragControllerDrop",e=>{this.dragState=null,this.resetDragPreviewState(),this.commitLayout(e.layout)});m(this,"onLayoutScrollInternal",e=>{const i=e.scroll.x??0;Math.abs(i-this._scrollPosition)<ba||(this._scrollPosition=i,this.emitScrollPositionChanged(i),this.scheduleRender())});m(this,"handleKeyDown",e=>{if(e.key==="Escape"&&this.dragController.status!=="idle"){e.preventDefault(),this.stopDragFrameLoop(),this.releaseActiveDragPointerCapture(),this.dragController.cancel(),this.detachDragListeners();return}this.dragController.status==="idle"&&(e.key==="ArrowRight"?(e.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(1)):e.key==="ArrowLeft"&&(e.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(-1)))});m(this,"handleWheel",e=>{if(this._layout.length===0)return;const r=this.wheelGesture.decide({now:Date.now(),shiftKey:e.shiftKey,deltaX:e.deltaX,deltaY:e.deltaY,overArtifactContent:!1});r.type==="scroll-horizontal"&&(e.preventDefault(),this.applyHorizontalWheel(r.horizontalDelta))});m(this,"handleWindowMessage",e=>{if(this._layout.length===0)return;const r=this.findManagedArtifactFrame(e.source);if(r&&this.isTrustedArtifactFrameMessage(e,r)){if(oz(e.data)){const i=typeof performance<"u"?performance.now():Date.now();this.swipeGesture.status==="idle"&&this.swipeGesture.start(i),this.swipeGesture.move(i,e.data.deltaX);return}if(az(e.data)){this.swipeGesture.status==="active"&&this.swipeGesture.end();return}}});m(this,"handleArtifactWheel",e=>{if(this._layout.length===0)return;const r=this.wheelGesture.decide({now:Date.now(),shiftKey:e.shiftKey,deltaX:e.deltaX,deltaY:e.deltaY,overArtifactContent:!0});if(r.type==="scroll-horizontal"){this.applyHorizontalWheel(r.horizontalDelta);return}r.type==="scroll-native"&&e.scrollNative(e.deltaY)});m(this,"handlePointerDown",e=>{if(e.button!==0||this.dragController.status!=="idle"||this.resizeState)return;const r=e.target;if(!(r instanceof Element))return;const i=r.closest("[data-resize-handle]");if(i){this.beginResize(e,i);return}const s=r.closest("[drag-handle]")!==null,o=r.closest("button, input, textarea, select, a, [role='button']")!==null;if(e.pointerType==="touch"&&!s&&!o&&this._layout.length>0){this.beginSwipeTracking(e);return}if(!s){if(!o){const p=r.closest(".node");if(p&&!p.hasAttribute("data-foreground")){const v=p.getAttribute("layout-node");if(v!==null){const g=parseInt(v,10);if(!isNaN(g)){const _=this.findViewspanContainingNode(g);if(_){this.clearWheelIdleSnap(),this.animateNextRender=!0,this.layoutScroll.scroll=xe({x:_.anchor}),e.preventDefault(),e.stopPropagation();return}}}}}return}if(o)return;const a=r.closest(".card-slot");if(!a)return;const c=a.getAttribute("data-layout-node-id");if(!c)return;const u=wO(this._layout,c);if(!u)return;const h=a.getBoundingClientRect();this.lastPointerX=e.clientX,this.lastPointerY=e.clientY,this.resetMotionTracking(e.clientX,e.clientY),this.focus(),this.dragController.start({nodeId:c,source:{index:u.topLevelIndex,parentId:u.sourceStackId},pointer:Ee({x:e.clientX,y:e.clientY}),grabOffset:Ee({x:e.clientX-h.left,y:e.clientY-h.top}),size:Ee({x:h.width,y:h.height}),layout:this._layout}),this.attachDragListeners(),this.activeDragPointerId=e.pointerId;try{this.setPointerCapture(e.pointerId)}catch{}e.preventDefault()});m(this,"handleResizePointerMove",e=>{const r=this.resizeState;if(!r||e.pointerId!==r.pointerId)return;const i=this.layoutGrid,s=((i==null?void 0:i.unit.x)??Tn)+le;if(s<=0)return;const o=e.clientX-r.startClientX,a=uh(r.startWidth+o/s);a!==r.currentWidth&&(r.currentWidth=a,this.scheduleRender())});m(this,"handleResizePointerUp",e=>{const r=this.resizeState;if(!r||e.pointerId!==r.pointerId)return;const i=r.currentWidth,s=r.startWidth,o=r.cardId;this.endResize(e.pointerId),i!==s?this.commitLayout(Nz(this._layout,o,i)):this.scheduleRender()});m(this,"handleResizePointerCancel",e=>{!this.resizeState||e.pointerId!==this.resizeState.pointerId||(this.endResize(e.pointerId),this.scheduleRender())});m(this,"handleResizeWindowBlur",()=>{this.resizeState&&(this.endResize(this.resizeState.pointerId),this.scheduleRender())});m(this,"handleResizeKeyDown",e=>{this.resizeState&&e.key==="Escape"&&(e.preventDefault(),this.endResize(this.resizeState.pointerId),this.scheduleRender())});m(this,"handleSwipePointerMove",e=>{if(this.swipePointerId===null||e.pointerId!==this.swipePointerId)return;if(!this.swipeActive){const i=e.clientX-this.swipeStartX,s=e.clientY-this.swipeStartY,o=Math.abs(i),a=Math.abs(s);if(o<Uf&&a<Uf)return;if(a>=o){this.endSwipeTracking();return}this.swipeActive=!0,this.swipeShouldSuppressClick=!0;try{this.setPointerCapture(e.pointerId)}catch{}this.swipeGesture.start(e.timeStamp)}const r=e.clientX-this.swipeLastX;this.swipeLastX=e.clientX,this.swipeGesture.move(e.timeStamp,r),e.preventDefault()});m(this,"handleSwipePointerUp",e=>{this.swipePointerId===null||e.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.end(),this.releaseSwipePointerCapture(e.pointerId),this.endSwipeTracking())});m(this,"handleSwipePointerCancel",e=>{this.swipePointerId===null||e.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.cancel(),this.releaseSwipePointerCapture(e.pointerId),this.endSwipeTracking())});m(this,"handleSwipeWindowBlur",()=>{this.swipePointerId!==null&&this.swipeActive&&this.swipeGesture.cancel(),this.swipePointerId!==null&&this.releaseSwipePointerCapture(this.swipePointerId),this.endSwipeTracking()});m(this,"handleSwipeClick",e=>{this.swipeShouldSuppressClick&&(this.swipeShouldSuppressClick=!1,e.preventDefault(),e.stopPropagation(),typeof e.stopImmediatePropagation=="function"&&e.stopImmediatePropagation())});m(this,"handleWindowPointerMove",e=>{this.lastPointerX=e.clientX,this.lastPointerY=e.clientY,this.updatePointerVelocity(e.clientX,e.clientY),this.syncDragTargetForLatestPointer(),this.ensureDragFrameLoop()});m(this,"handleWindowPointerUp",e=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(e.pointerId),this.dragController.drop(),this.clearMotionTracking(),this.detachDragListeners()});m(this,"handleWindowPointerCancel",e=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(e.pointerId),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});m(this,"handleWindowBlur",()=>{this.releaseActiveDragPointerCapture(),this.stopDragFrameLoop(),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});m(this,"runDragFrame",e=>{if(this.dragController.status==="idle"){this.dragFrame=0;return}const r=Math.max(0,e-this.lastDragFrameTime)/Og;this.lastDragFrameTime=e,this.samplePointerVelocityAt(e,this.lastPointerX,this.lastPointerY);const i=this.getBoundingClientRect(),s=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,i),o=this.getDragEdgeScrollDeltaPixels(s.x,i,r);this.scrollVelocityPxPerSec=r>ba?Math.abs(o)/r:0,Math.abs(o)>ba&&(this.animateNextRender=!1,this.layoutScroll.wheelPixels(Ee({x:o}))),this.dragController.status==="active"&&this.syncDragTarget(s.x,s.y,i),this.dragFrame=requestAnimationFrame(this.runDragFrame)});this.dragController.addEventListener("change",this.onDragControllerChange),this.dragController.addEventListener("drag",this.onDragControllerDrag),this.dragController.addEventListener("drop",this.onDragControllerDrop),this.layoutScroll.addEventListener("layout-scroll",this.onLayoutScrollInternal)}set cards(e){this._cards!==e&&(this._cards=e,this.scheduleRender())}get cards(){return this._cards}set layout(e){this._layout=[...e],this.stopDragFrameLoop(),this.dragController.cancel(),this.resizeState&&this.endResize(this.resizeState.pointerId),this.scrollModelKey="",this.syncScrollModel(),this.layoutScroll.scroll=xe({x:this._scrollPosition}),this.scheduleRender()}get layout(){return this._layout}commitLayout(e){this.layout=e,this.emitLayoutChanged()}set scrollPosition(e){Math.abs(e-this._scrollPosition)<ba||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=xe({x:e}))}get scrollPosition(){return this._scrollPosition}focusArtifact(e){const r=gr(this._layout),i=r.nodes.findIndex(o=>o.cards.some(a=>a.artifactID===e));if(i<0)return;let s=0;for(let o=0;o<i;o+=1)s+=r.nodes[o].width;this.scrollPosition=s,queueMicrotask(()=>{const o=this.querySelector(`.card-slot[data-layout-card-id="${Ng(e)}"]`);if(!o)return;o.classList.remove("card-focus-pulse"),o.offsetHeight,o.classList.add("card-focus-pulse");const a=()=>{o.classList.remove("card-focus-pulse"),o.removeEventListener("animationend",a)};o.addEventListener("animationend",a)})}connectedCallback(){this.hasAttribute("tabindex")||(this.tabIndex=0),this.focus(),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("wheel",this.handleWheel,{passive:!1}),this.addEventListener("pointerdown",this.handlePointerDown),this.addEventListener("artifact-wheel",this.handleArtifactWheel),window.addEventListener("message",this.handleWindowMessage),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>this.render()),this.resizeObserver.observe(this)),this.render()}disconnectedCallback(){var e;this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("wheel",this.handleWheel),this.removeEventListener("pointerdown",this.handlePointerDown),this.removeEventListener("artifact-wheel",this.handleArtifactWheel),window.removeEventListener("message",this.handleWindowMessage),(e=this.resizeObserver)==null||e.disconnect(),this.resizeObserver=null,this.clearWheelIdleSnap(),this.wheelGesture.reset(),this.detachDragListeners(),this.swipeGesture.status==="active"&&this.swipeGesture.cancel(),this.swipePointerId!==null&&this.releaseSwipePointerCapture(this.swipePointerId),this.endSwipeTracking(),this.dragController.removeEventListener("change",this.onDragControllerChange),this.dragController.removeEventListener("drag",this.onDragControllerDrag),this.dragController.removeEventListener("drop",this.onDragControllerDrop),this.layoutScroll.removeEventListener("layout-scroll",this.onLayoutScrollInternal),this.dragController.dispose(),this.stopDragFrameLoop(),this.resizeState&&this.endResize(this.resizeState.pointerId)}scheduleRender(){this.renderPending||(this.renderPending=!0,queueMicrotask(()=>{this.renderPending=!1,this.render()}))}createGrid(e,r){return new _z({basis:Ee({x:Tn,y:Tn}),min:Ee({x:Mf,y:Mf}),viewport:Ee({x:e,y:r}),gap:Ee({x:le,y:le})})}syncScrollModel(){const e=ou(this),i=gr(this._layout).nodes.map(o=>o.width),s=`${e.width}x${e.height}:${i.join(",")}`;s===this.scrollModelKey&&this.layoutGrid||(this.scrollModelKey=s,this.layoutGrid=this.createGrid(e.width,e.height),this.layoutScroll.rebuild({grid:this.layoutGrid,nodeWidths:i.map(o=>xe({x:o})),snap:Mg}))}emitScrollPositionChanged(e){this.dispatchEvent(new mO(e))}emitLayoutChanged(){this.dispatchEvent(new Qb([...this._layout]))}shiftWindow(e){this.clearWheelIdleSnap(),this.syncScrollModel(),this.animateNextRender=!0,this.layoutScroll.step(e)}applyHorizontalWheel(e){this.syncScrollModel();const r=this.layoutGrid;if(!r)return;this.animateNextRender=!1;const i=r.toUnits(Ee({x:e}));this.layoutScroll.wheel(xe({x:i.x??0}))}scheduleWheelIdleSnap(){this.clearWheelIdleSnap(),this.wheelIdleSnapTimer=setTimeout(()=>{this.wheelIdleSnapTimer=null,this.animateNextRender=!0,this.layoutScroll.snap()},gO)}clearWheelIdleSnap(){this.wheelIdleSnapTimer!==null&&(clearTimeout(this.wheelIdleSnapTimer),this.wheelIdleSnapTimer=null)}findViewspanContainingNode(e){const r=this.layoutScroll.viewspans,i=this._scrollPosition;let s=null,o=Number.POSITIVE_INFINITY;for(const a of r)if(e>=a.nodeRange[0]&&e<=a.nodeRange[1]){const c=Math.abs(a.anchor-i);c<o&&(o=c,s=a)}return s}findManagedArtifactFrame(e){if(!e)return null;const r=this.querySelectorAll("iframe.artifact-frame");for(const i of r)if(i.contentWindow===e)return i;return null}isTrustedArtifactFrameMessage(e,r){if(e.origin==="null")return!0;const i=this.getArtifactFrameOrigin(r);return i===null||e.origin===i}getArtifactFrameOrigin(e){const r=e.getAttribute("src")??e.src;if(!r)return null;try{return new URL(r,window.location.href).origin}catch{return null}}beginResize(e,r){const i=r.getAttribute("data-resize-handle");if(!i)return;const s=this._layout.find(a=>a.type==="card"&&a.id===i);if(!s)return;const o=uh(typeof s.width=="number"?s.width:gt);this.resizeState={cardId:i,pointerId:e.pointerId,startClientX:e.clientX,startWidth:o,currentWidth:o},this.attachResizeListeners();try{this.setPointerCapture(e.pointerId)}catch{}e.preventDefault(),e.stopPropagation()}attachResizeListeners(){this.resizeListenersAttached||(window.addEventListener("pointermove",this.handleResizePointerMove),window.addEventListener("pointerup",this.handleResizePointerUp),window.addEventListener("pointercancel",this.handleResizePointerCancel),window.addEventListener("blur",this.handleResizeWindowBlur),this.addEventListener("keydown",this.handleResizeKeyDown),this.resizeListenersAttached=!0)}detachResizeListeners(){this.resizeListenersAttached&&(window.removeEventListener("pointermove",this.handleResizePointerMove),window.removeEventListener("pointerup",this.handleResizePointerUp),window.removeEventListener("pointercancel",this.handleResizePointerCancel),window.removeEventListener("blur",this.handleResizeWindowBlur),this.removeEventListener("keydown",this.handleResizeKeyDown),this.resizeListenersAttached=!1)}endResize(e){this.resizeState=null,this.detachResizeListeners();try{this.hasPointerCapture(e)&&this.releasePointerCapture(e)}catch{}}beginSwipeTracking(e){this.swipePointerId=e.pointerId,this.swipeStartX=e.clientX,this.swipeStartY=e.clientY,this.swipeLastX=e.clientX,this.swipeActive=!1,this.swipeShouldSuppressClick=!1,this.attachSwipeListeners()}attachSwipeListeners(){this.swipeListenersAttached||(window.addEventListener("pointermove",this.handleSwipePointerMove),window.addEventListener("pointerup",this.handleSwipePointerUp),window.addEventListener("pointercancel",this.handleSwipePointerCancel),this.addEventListener("pointermove",this.handleSwipePointerMove),this.addEventListener("pointerup",this.handleSwipePointerUp),this.addEventListener("pointercancel",this.handleSwipePointerCancel),window.addEventListener("blur",this.handleSwipeWindowBlur),this.addEventListener("click",this.handleSwipeClick,{capture:!0}),this.swipeListenersAttached=!0)}detachSwipeListeners(){this.swipeListenersAttached&&(window.removeEventListener("pointermove",this.handleSwipePointerMove),window.removeEventListener("pointerup",this.handleSwipePointerUp),window.removeEventListener("pointercancel",this.handleSwipePointerCancel),this.removeEventListener("pointermove",this.handleSwipePointerMove),this.removeEventListener("pointerup",this.handleSwipePointerUp),this.removeEventListener("pointercancel",this.handleSwipePointerCancel),window.removeEventListener("blur",this.handleSwipeWindowBlur),this.removeEventListener("click",this.handleSwipeClick,{capture:!0}),this.swipeListenersAttached=!1)}endSwipeTracking(){this.swipePointerId=null,this.swipeActive=!1,this.detachSwipeListeners()}releaseSwipePointerCapture(e){try{this.hasPointerCapture(e)&&this.releasePointerCapture(e)}catch{}}releaseActiveDragPointerCapture(){this.activeDragPointerId!==null&&this.releasePointerCaptureForEvent(this.activeDragPointerId)}releasePointerCaptureForEvent(e){try{this.hasPointerCapture(e)&&this.releasePointerCapture(e)}catch{}}attachDragListeners(){this.dragListenersAttached||(window.addEventListener("pointermove",this.handleWindowPointerMove),window.addEventListener("pointerup",this.handleWindowPointerUp),window.addEventListener("pointercancel",this.handleWindowPointerCancel),this.addEventListener("pointermove",this.handleWindowPointerMove),this.addEventListener("pointerup",this.handleWindowPointerUp),this.addEventListener("pointercancel",this.handleWindowPointerCancel),window.addEventListener("blur",this.handleWindowBlur),this.dragListenersAttached=!0)}detachDragListeners(){this.dragListenersAttached&&(window.removeEventListener("pointermove",this.handleWindowPointerMove),window.removeEventListener("pointerup",this.handleWindowPointerUp),window.removeEventListener("pointercancel",this.handleWindowPointerCancel),this.removeEventListener("pointermove",this.handleWindowPointerMove),this.removeEventListener("pointerup",this.handleWindowPointerUp),this.removeEventListener("pointercancel",this.handleWindowPointerCancel),window.removeEventListener("blur",this.handleWindowBlur),this.dragListenersAttached=!1,this.activeDragPointerId=null)}getVisibleLayout(){return this.dragController.status!=="active"||!this.dragState?this.applyResizeOverride(this._layout):Cg(this.dragState.projectedLayout)}applyResizeOverride(e){const r=this.resizeState;if(!r)return e;const i=e.findIndex(a=>a.type==="card"&&a.id===r.cardId);if(i===-1)return e;const s=e[i];if(!s||s.type!=="card"||s.width===r.currentWidth)return e;const o=[...e];return o[i]={...s,width:r.currentWidth},o}getGridSlotStyle(e){return`grid-column: ${e.col} / span ${e.width}; grid-row: ${e.row} / span ${e.height};`}findContainingBlock(e){let r=e.parentElement;for(;r;){const i=getComputedStyle(r);if(i.transform!=="none"||i.perspective!=="none"||i.filter!=="none")return r;const s=i.willChange;if(s.includes("transform")||s.includes("perspective")||s.includes("filter"))return r;const o=i.contain;if(o.includes("layout")||o.includes("paint")||o.includes("strict"))return r;r=r.parentElement}return document.documentElement}getDraggedSlotStyle(e){const r=this.currentDragPreviewSize??{width:e.size.x??0,height:e.size.y??0};return["position: fixed;",`width: ${r.width}px;`,`height: ${r.height}px;`,"pointer-events: none;","z-index: 10;"].join(" ")}writeDraggedSlotPosition(e,r){(!this.draggedSlotContainingBlock||!this.draggedSlotContainingBlock.isConnected||!this.draggedSlotContainingBlock.contains(e))&&(this.draggedSlotContainingBlock=this.findContainingBlock(e));const i=this.draggedSlotContainingBlock.getBoundingClientRect(),s=r.pointer.x??0,o=r.pointer.y??0,a=r.grabOffset.x??0,c=r.grabOffset.y??0,u=this.currentDragPreviewSize??{width:r.size.x??0,height:r.size.y??0},h=r.size.x??0,p=r.size.y??0,v=h>0?a*(u.width/h):a,g=p>0?c*(u.height/p):c;e.style.left=`${s-v-i.left}px`,e.style.top=`${o-g-i.top}px`,e.style.width=`${u.width}px`,e.style.height=`${u.height}px`}renderSlot(e,r){var o,a;if(e.kind==="placeholder")return e.placement?z`
191
191
  <div
192
192
  class="card-slot card-placeholder"
193
193
  data-layout-placeholder-for=${(r==null?void 0:r.nodeId)??""}
@@ -223,14 +223,14 @@ ${r.documentElement.outerHTML}`],{type:mz});return URL.createObjectURL(o)}const
223
223
  style=${e.kind==="visible"?`width: ${e.widthPx}px; --card-width-px: ${e.widthPx};`:""}
224
224
  >
225
225
  <div class="node-inner" style=${`grid-template-columns: repeat(${e.widthUnits}, var(--layout-unit-x));`}>
226
- ${Sg(e.slots,i=>i.key,i=>this.renderSlot(i,r))}
226
+ ${Tg(e.slots,i=>i.key,i=>this.renderSlot(i,r))}
227
227
  </div>
228
228
  </div>
229
- `}render(){var Y;const e=eu(this),r=this.createGrid(e.width,e.height);this.layoutGrid=r;const i=this.getVisibleLayout(),s=this.dragController.status==="active",o=fr(i),a=o.nodes.map(j=>j.width),c=`${e.width}x${e.height}:${a.join(",")}`;!s&&c!==this.scrollModelKey&&(this.scrollModelKey=c,this.layoutScroll.rebuild({grid:r,nodeWidths:a.map(j=>xe({x:j})),snap:Cg}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const u=vO(this._layout),h=r.unit.x??En,p=r.unit.y??En,v=s?this.dragTrackOffsetXPx:0,g=(this.layoutScroll.translate.x??0)+v,_=Pg(o.nodes.length,r,e.height),k=this.animateNextRender&&!s,T=[`transform: translate(${g}px, ${_}px);`,`transition-duration: ${k?KA:0}ms;`,`pointer-events: ${s?"none":"auto"};`].join(" ");this.animateNextRender=!0,this.style.setProperty("--layout-unit-x",`${h}px`),this.style.setProperty("--layout-unit-y",`${p}px`),this.style.setProperty("--layout-gap",`${le}px`);const P=this.dragState,R=new Set;{let j=g;for(let oe=0;oe<o.nodes.length;oe+=1){const wt=r.toPixels(xe({x:o.nodes[oe].width})).x??0,Jn=j+wt;j>=-1&&Jn<=e.width+1&&R.add(oe),j=Jn+le}}const Z=j=>R.has(j),N=hO({baseLayout:this._layout,visibleLayout:i,resolved:o,cardsByID:u,grid:r,dragState:this.dragState,isForeground:Z}),F=Tg(this.dragState);if(F?this.setAttribute("data-test-drop-intent",F):this.removeAttribute("data-test-drop-intent"),this.dragState){let j=null;for(const oe of o.nodes){for(const wt of oe.cards)if(wt.id===this.dragState.nodeId){j={width:r.toPixels(xe({x:wt.width})).x??0,height:r.toPixels(xe({y:wt.height})).y??0};break}if(j)break}this.currentDragPreviewSize=j??{width:this.dragState.size.x??0,height:this.dragState.size.y??0}}else this.currentDragPreviewSize=null;Ce(z`
230
- <div class="track" style=${T}>
231
- ${Sg(N,j=>j.key,j=>this.renderNode(j,P))}
229
+ `}render(){var Y;const e=ou(this),r=this.createGrid(e.width,e.height);this.layoutGrid=r;const i=this.getVisibleLayout(),s=this.dragController.status==="active",o=gr(i),a=o.nodes.map(j=>j.width),c=`${e.width}x${e.height}:${a.join(",")}`;!s&&c!==this.scrollModelKey&&(this.scrollModelKey=c,this.layoutScroll.rebuild({grid:r,nodeWidths:a.map(j=>xe({x:j})),snap:Mg}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const u=yO(this._layout),h=r.unit.x??Tn,p=r.unit.y??Tn,v=s?this.dragTrackOffsetXPx:0,g=(this.layoutScroll.translate.x??0)+v,_=Ug(o.nodes.length,r,e.height),k=this.animateNextRender&&!s,I=[`transform: translate(${g}px, ${_}px);`,`transition-duration: ${k?KA:0}ms;`,`pointer-events: ${s?"none":"auto"};`].join(" ");this.animateNextRender=!0,this.style.setProperty("--layout-unit-x",`${h}px`),this.style.setProperty("--layout-unit-y",`${p}px`),this.style.setProperty("--layout-gap",`${le}px`);const P=this.dragState,R=new Set;{let j=g;for(let oe=0;oe<o.nodes.length;oe+=1){const wt=r.toPixels(xe({x:o.nodes[oe].width})).x??0,Qn=j+wt;j>=-1&&Qn<=e.width+1&&R.add(oe),j=Qn+le}}const Z=j=>R.has(j),N=dO({baseLayout:this._layout,visibleLayout:i,resolved:o,cardsByID:u,grid:r,dragState:this.dragState,isForeground:Z}),F=zg(this.dragState);if(F?this.setAttribute("data-test-drop-intent",F):this.removeAttribute("data-test-drop-intent"),this.dragState){let j=null;for(const oe of o.nodes){for(const wt of oe.cards)if(wt.id===this.dragState.nodeId){j={width:r.toPixels(xe({x:wt.width})).x??0,height:r.toPixels(xe({y:wt.height})).y??0};break}if(j)break}this.currentDragPreviewSize=j??{width:this.dragState.size.x??0,height:this.dragState.size.y??0}}else this.currentDragPreviewSize=null;Ce(z`
230
+ <div class="track" style=${I}>
231
+ ${Tg(N,j=>j.key,j=>this.renderNode(j,P))}
232
232
  </div>
233
- `,this),this.syncCardElements(u,P?((Y=u.get(P.nodeId))==null?void 0:Y.artifactID)??null:null),this.syncDraggedSlotElement(P)}syncCardElements(e,r){var o;const i=new Map;for(const a of this.querySelectorAll(".card-content-mount[data-mount-for]")){const c=a.getAttribute("data-mount-for");c&&i.set(c,a)}const s=new Set;for(const a of e.values()){const c=this._cards.get(a.artifactID);if(!c)continue;s.add(a.artifactID);const u=i.get(a.id);if(!u){c.removeAttribute("data-dragging");continue}const h=(o=u.parentElement)==null?void 0:o.getAttribute("data-layout-node-id");console.assert(h===a.id,`layout-view: mount mismatch for ${a.id}`),c.parentElement!==u&&u.appendChild(c),console.assert(u.children.length<=1,`layout-view: multiple children for ${a.id}`),c.toggleAttribute("data-dragging",a.artifactID===r)}for(const[a,c]of this._cards)s.has(a)||c.removeAttribute("data-dragging")}ensureDragFrameLoop(){this.dragFrame!==0||this.dragController.status==="idle"||(this.lastDragFrameTime=performance.now(),this.dragFrame=requestAnimationFrame(this.runDragFrame))}stopDragFrameLoop(){this.dragFrame!==0&&(cancelAnimationFrame(this.dragFrame),this.dragFrame=0,this.scrollVelocityPxPerSec=0)}syncDragTargetForLatestPointer(){if(this.dragController.status==="idle")return;const e=this.getBoundingClientRect();if(this.dragController.status==="active"){const i=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,e);this.syncDragTarget(i.x,i.y,e);return}if(this.syncDragTarget(this.lastPointerX,this.lastPointerY,e),this.dragController.status==="pending")return;const r=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,e);(r.x!==this.lastPointerX||r.y!==this.lastPointerY)&&this.syncDragTarget(r.x,r.y,e)}syncDragTarget(e,r,i=this.getBoundingClientRect()){if(this.dragController.status==="idle")return;const s=this.getVisibleLayout(),o=this.dragController.status==="active"?this.dragTrackOffsetXPx:0,a=this.measureLayoutGeometry(s,o);this.dragController.update({pointer:Ee({x:e,y:r}),viewport:{left:i.left,top:i.top,width:i.width,height:i.height},geometry:a,effectiveVelocity:Math.max(this.pointerVelocityPxPerSec,this.scrollVelocityPxPerSec)})}resetMotionTracking(e,r){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=performance.now(),this.motionSampleX=e,this.motionSampleY=r}clearMotionTracking(){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=0}updatePointerVelocity(e,r){this.samplePointerVelocityAt(performance.now(),e,r)}samplePointerVelocityAt(e,r,i){if(this.motionSampleTime===0){this.motionSampleTime=e,this.motionSampleX=r,this.motionSampleY=i,this.pointerVelocityPxPerSec=0;return}const s=e-this.motionSampleTime;if(s<100)return;const o=r-this.motionSampleX;this.pointerVelocityPxPerSec=Math.abs(o)/s*Ig,this.motionSampleTime=e,this.motionSampleX=r,this.motionSampleY=i}clampPointerToViewport(e,r,i){return{x:Math.max(i.left,Math.min(i.left+i.width,e)),y:Math.max(i.top,Math.min(i.top+i.height,r))}}getDragEdgeScrollDeltaPixels(e,r,i){var u;const s=r.left+da,o=r.left+r.width-da,a=((u=this.layoutGrid)==null?void 0:u.unit.x)??En,c=QA*a;if(e<s){const h=Math.max(0,Math.min(1,(s-e)/da));return-(c*h**Cf)*i}if(e>o){const h=Math.max(0,Math.min(1,(e-o)/da));return c*h**Cf*i}return 0}measureLayoutGeometry(e,r=0){const i=this.layoutGrid;if(!i)return[];const s=fr(e),o=new Map(s.nodes.map(_=>[_.id,_.width])),a=i.toPixels(xe({y:lt})).y??nl,c=eu(this),u=(this.layoutScroll.translate.x??0)+r,h=Pg(s.nodes.length,i,c.height),p=c.offsetY+h,v=[];let g=u;for(const _ of e){const k=o.get(_.id)??gt,T=i.toPixels(xe({x:k})).x??zr,P={left:g,top:p,width:T,height:a};v.push({id:_.id,rect:P}),g+=T+le}return v}resetDragPreviewState(){this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null,this.lastProjectedDragLayoutSignature="",this.lastDragDropIntent=null,this.lastActivePlaceholderId=null,this.draggedSlotElement=null,this.draggedSlotContainingBlock=null,this.currentDragPreviewSize=null}getCachedDraggedSlotElement(e){var r;return(r=this.draggedSlotElement)!=null&&r.isConnected&&this.draggedSlotElement.getAttribute("data-layout-node-id")===e&&this.draggedSlotElement.getAttribute("data-layout-drag-source")==="true"?this.draggedSlotElement:(this.draggedSlotElement=this.querySelector(`.card-slot[data-layout-node-id="${Rg(e)}"][data-layout-drag-source="true"]`),this.draggedSlotElement)}syncDraggedSlotElement(e){if(!e||this.dragController.status!=="active"){this.draggedSlotElement=null;return}const r=this.getCachedDraggedSlotElement(e.nodeId);r&&this.writeDraggedSlotPosition(r,e)}shouldApplyTrackOffset(e,r){if(r)return!0;for(const i of e){if(i.type!=="stack")continue;if(i.children.some(o=>o.type==="drop-target")&&r!==i.id)return!0}return!1}computeDragTrackOffset(e,r,i,s,o,a){if(!e)return a;const c=s?o??this.getStableAnchorCardId(e,r,i):this.getStableAnchorNodeId(e,r,i);if(!c)return a;const u=s?Lg(e,c,this.layoutGrid):zg(e,c,this.layoutGrid),h=s?Lg(r,c,this.layoutGrid):zg(r,c,this.layoutGrid);return u===null||h===null?a:a+(u-h)}getStableAnchorCardId(e,r,i){const s=Dg(e),o=new Set(Dg(r));for(const a of s)if(a!==i&&o.has(a))return a;return null}getStableAnchorNodeId(e,r,i){const s=new Set(r.map(o=>o.id));for(const o of e)if(o.id!==i&&s.has(o.id))return o.id;return null}getStackChildAnchorCardId(e,r){const i=this._layout.find(o=>o.type==="stack"&&o.id===e);if(!i||i.type!=="stack")return null;const s=i.children.find(o=>o.type==="card"&&o.id!==r);return(s==null?void 0:s.id)??null}}function vO(n){const t=new Map;for(const e of n){if(e.type==="card"){t.set(e.id,e);continue}for(const r of e.children)if(r.type==="card")t.set(r.id,r);else for(const i of r.children)t.set(i.id,i)}return t}function yO(n){for(const t of n)if(t.type==="drop-target"||t.type==="stack"&&t.children.some(e=>e.type==="drop-target"))return t.id;return null}function bO(n,t){const e=n.findIndex(r=>r.type==="card"&&r.id===t);if(e!==-1)return{topLevelIndex:e};for(let r=0;r<n.length;r+=1){const i=n[r];if(!(!i||i.type!=="stack")&&i.children.some(s=>s.type==="card"&&s.id===t))return{topLevelIndex:r,sourceStackId:i.id}}return null}function Dg(n){const t=[];for(const e of n){if(e.type==="card"){t.push(e.id);continue}if(e.type==="stack"){const r=e.children.find(i=>i.type==="card");r&&t.push(r.id)}}return t}function Lg(n,t,e){if(!e)return null;const r=fr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.type==="card"&&o.id===t||o.type==="stack"&&o.children.some(u=>u.type==="card"&&u.id===t))return s;const a=i.get(o.id)??gt,c=e.toPixels(xe({x:a})).x??zr;s+=c+le}return null}function zg(n,t,e){if(!e)return null;const r=fr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.id===t)return s;const a=i.get(o.id)??gt,c=e.toPixels(xe({x:a})).x??zr;s+=c+le}return null}customElements.get("layout-view")||customElements.define("layout-view",mO);class wO extends HTMLElement{constructor(){super(...arguments);m(this,"screenManager",Kt.resolve("ScreenManager"));m(this,"boundModel",null);m(this,"cardEls",new Map);m(this,"handleActiveScreenChanged",()=>{this.rebindModel(),this.render()});m(this,"handleModelChange",()=>{this.render()});m(this,"handleCloseArtifact",e=>{e instanceof Vb&&this.screenManager.activeScreen&&this.screenManager.activeScreen.removeArtifact(e.artifactID)});m(this,"handleScrollPositionChanged",e=>{const r=e;typeof r.scrollPosition=="number"&&Number.isFinite(r.scrollPosition)&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setScrollPosition(r.scrollPosition)});m(this,"handleLayoutChanged",e=>{e instanceof Kb&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setLayout(e.layout)});m(this,"handleServerEvent",e=>{const r=e.event;if(r.type!=="artifact-focus"||!this.boundModel||r.screenID!==this.boundModel.id)return;const i=this.querySelector("layout-view");i&&i.focusArtifact(r.artifactID)})}connectedCallback(){this.screenManager.addEventListener("active-screen-changed",this.handleActiveScreenChanged),this.rebindModel(),this.render()}disconnectedCallback(){this.screenManager.removeEventListener("active-screen-changed",this.handleActiveScreenChanged),this.unbindModel(),this.disposeCardElements()}rebindModel(){const e=this.screenManager.activeScreen;this.boundModel!==e&&(this.unbindModel(),this.boundModel=e,e&&(e.addEventListener("change",this.handleModelChange),e.server.addEventListener("server-event",this.handleServerEvent)))}unbindModel(){this.boundModel&&(this.boundModel.removeEventListener("change",this.handleModelChange),this.boundModel.server.removeEventListener("server-event",this.handleServerEvent),this.boundModel=null)}buildCards(e){if(!e)return this.disposeCardElements(),new Map;const r=new Map;for(const i of e.artifacts.values()){let s=this.cardEls.get(i.id);s||(s=document.createElement("artifact-view"),this.cardEls.set(i.id,s)),s.artifact=i,s.screen=e,s.viewURL=e.server.getViewURL(i),s.contentURL=e.server.getContentURL(i),r.set(i.id,s)}for(const[i,s]of this.cardEls)r.has(i)||(s.remove(),this.cardEls.delete(i));return r}disposeCardElements(){for(const e of this.cardEls.values())e.remove();this.cardEls.clear()}render(){const e=this.screenManager.activeScreen,r=(e==null?void 0:e.layout)??[],i=this.buildCards(e);if(r.length===0){Ce(z``,this);return}Ce(z`
233
+ `,this),this.syncCardElements(u,P?((Y=u.get(P.nodeId))==null?void 0:Y.artifactID)??null:null),this.syncDraggedSlotElement(P)}syncCardElements(e,r){var o;const i=new Map;for(const a of this.querySelectorAll(".card-content-mount[data-mount-for]")){const c=a.getAttribute("data-mount-for");c&&i.set(c,a)}const s=new Set;for(const a of e.values()){const c=this._cards.get(a.artifactID);if(!c)continue;s.add(a.artifactID);const u=i.get(a.id);if(!u){c.removeAttribute("data-dragging");continue}const h=(o=u.parentElement)==null?void 0:o.getAttribute("data-layout-node-id");console.assert(h===a.id,`layout-view: mount mismatch for ${a.id}`),c.parentElement!==u&&u.appendChild(c),console.assert(u.children.length<=1,`layout-view: multiple children for ${a.id}`),c.toggleAttribute("data-dragging",a.artifactID===r)}for(const[a,c]of this._cards)s.has(a)||c.removeAttribute("data-dragging")}ensureDragFrameLoop(){this.dragFrame!==0||this.dragController.status==="idle"||(this.lastDragFrameTime=performance.now(),this.dragFrame=requestAnimationFrame(this.runDragFrame))}stopDragFrameLoop(){this.dragFrame!==0&&(cancelAnimationFrame(this.dragFrame),this.dragFrame=0,this.scrollVelocityPxPerSec=0)}syncDragTargetForLatestPointer(){if(this.dragController.status==="idle")return;const e=this.getBoundingClientRect();if(this.dragController.status==="active"){const i=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,e);this.syncDragTarget(i.x,i.y,e);return}if(this.syncDragTarget(this.lastPointerX,this.lastPointerY,e),this.dragController.status==="pending")return;const r=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,e);(r.x!==this.lastPointerX||r.y!==this.lastPointerY)&&this.syncDragTarget(r.x,r.y,e)}syncDragTarget(e,r,i=this.getBoundingClientRect()){if(this.dragController.status==="idle")return;const s=this.getVisibleLayout(),o=this.dragController.status==="active"?this.dragTrackOffsetXPx:0,a=this.measureLayoutGeometry(s,o);this.dragController.update({pointer:Ee({x:e,y:r}),viewport:{left:i.left,top:i.top,width:i.width,height:i.height},geometry:a,effectiveVelocity:Math.max(this.pointerVelocityPxPerSec,this.scrollVelocityPxPerSec)})}resetMotionTracking(e,r){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=performance.now(),this.motionSampleX=e,this.motionSampleY=r}clearMotionTracking(){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=0}updatePointerVelocity(e,r){this.samplePointerVelocityAt(performance.now(),e,r)}samplePointerVelocityAt(e,r,i){if(this.motionSampleTime===0){this.motionSampleTime=e,this.motionSampleX=r,this.motionSampleY=i,this.pointerVelocityPxPerSec=0;return}const s=e-this.motionSampleTime;if(s<100)return;const o=r-this.motionSampleX;this.pointerVelocityPxPerSec=Math.abs(o)/s*Og,this.motionSampleTime=e,this.motionSampleX=r,this.motionSampleY=i}clampPointerToViewport(e,r,i){return{x:Math.max(i.left,Math.min(i.left+i.width,e)),y:Math.max(i.top,Math.min(i.top+i.height,r))}}getDragEdgeScrollDeltaPixels(e,r,i){var u;const s=r.left+pa,o=r.left+r.width-pa,a=((u=this.layoutGrid)==null?void 0:u.unit.x)??Tn,c=QA*a;if(e<s){const h=Math.max(0,Math.min(1,(s-e)/pa));return-(c*h**Nf)*i}if(e>o){const h=Math.max(0,Math.min(1,(e-o)/pa));return c*h**Nf*i}return 0}measureLayoutGeometry(e,r=0){const i=this.layoutGrid;if(!i)return[];const s=gr(e),o=new Map(s.nodes.map(_=>[_.id,_.width])),a=i.toPixels(xe({y:lt})).y??sl,c=ou(this),u=(this.layoutScroll.translate.x??0)+r,h=Ug(s.nodes.length,i,c.height),p=c.offsetY+h,v=[];let g=u;for(const _ of e){const k=o.get(_.id)??gt,I=i.toPixels(xe({x:k})).x??zr,P={left:g,top:p,width:I,height:a};v.push({id:_.id,rect:P}),g+=I+le}return v}resetDragPreviewState(){this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null,this.lastProjectedDragLayoutSignature="",this.lastDragDropIntent=null,this.lastActivePlaceholderId=null,this.draggedSlotElement=null,this.draggedSlotContainingBlock=null,this.currentDragPreviewSize=null}getCachedDraggedSlotElement(e){var r;return(r=this.draggedSlotElement)!=null&&r.isConnected&&this.draggedSlotElement.getAttribute("data-layout-node-id")===e&&this.draggedSlotElement.getAttribute("data-layout-drag-source")==="true"?this.draggedSlotElement:(this.draggedSlotElement=this.querySelector(`.card-slot[data-layout-node-id="${Ng(e)}"][data-layout-drag-source="true"]`),this.draggedSlotElement)}syncDraggedSlotElement(e){if(!e||this.dragController.status!=="active"){this.draggedSlotElement=null;return}const r=this.getCachedDraggedSlotElement(e.nodeId);r&&this.writeDraggedSlotPosition(r,e)}shouldApplyTrackOffset(e,r){if(r)return!0;for(const i of e){if(i.type!=="stack")continue;if(i.children.some(o=>o.type==="drop-target")&&r!==i.id)return!0}return!1}computeDragTrackOffset(e,r,i,s,o,a){if(!e)return a;const c=s?o??this.getStableAnchorCardId(e,r,i):this.getStableAnchorNodeId(e,r,i);if(!c)return a;const u=s?Hg(e,c,this.layoutGrid):Zg(e,c,this.layoutGrid),h=s?Hg(r,c,this.layoutGrid):Zg(r,c,this.layoutGrid);return u===null||h===null?a:a+(u-h)}getStableAnchorCardId(e,r,i){const s=Fg(e),o=new Set(Fg(r));for(const a of s)if(a!==i&&o.has(a))return a;return null}getStableAnchorNodeId(e,r,i){const s=new Set(r.map(o=>o.id));for(const o of e)if(o.id!==i&&s.has(o.id))return o.id;return null}getStackChildAnchorCardId(e,r){const i=this._layout.find(o=>o.type==="stack"&&o.id===e);if(!i||i.type!=="stack")return null;const s=i.children.find(o=>o.type==="card"&&o.id!==r);return(s==null?void 0:s.id)??null}}function yO(n){const t=new Map;for(const e of n){if(e.type==="card"){t.set(e.id,e);continue}for(const r of e.children)if(r.type==="card")t.set(r.id,r);else for(const i of r.children)t.set(i.id,i)}return t}function bO(n){for(const t of n)if(t.type==="drop-target"||t.type==="stack"&&t.children.some(e=>e.type==="drop-target"))return t.id;return null}function wO(n,t){const e=n.findIndex(r=>r.type==="card"&&r.id===t);if(e!==-1)return{topLevelIndex:e};for(let r=0;r<n.length;r+=1){const i=n[r];if(!(!i||i.type!=="stack")&&i.children.some(s=>s.type==="card"&&s.id===t))return{topLevelIndex:r,sourceStackId:i.id}}return null}function Fg(n){const t=[];for(const e of n){if(e.type==="card"){t.push(e.id);continue}if(e.type==="stack"){const r=e.children.find(i=>i.type==="card");r&&t.push(r.id)}}return t}function Hg(n,t,e){if(!e)return null;const r=gr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.type==="card"&&o.id===t||o.type==="stack"&&o.children.some(u=>u.type==="card"&&u.id===t))return s;const a=i.get(o.id)??gt,c=e.toPixels(xe({x:a})).x??zr;s+=c+le}return null}function Zg(n,t,e){if(!e)return null;const r=gr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.id===t)return s;const a=i.get(o.id)??gt,c=e.toPixels(xe({x:a})).x??zr;s+=c+le}return null}customElements.get("layout-view")||customElements.define("layout-view",vO);class SO extends HTMLElement{constructor(){super(...arguments);m(this,"screenManager",en.resolve("ScreenManager"));m(this,"boundModel",null);m(this,"cardEls",new Map);m(this,"handleActiveScreenChanged",()=>{this.rebindModel(),this.render()});m(this,"handleModelChange",()=>{this.render()});m(this,"handleCloseArtifact",e=>{e instanceof jb&&this.screenManager.activeScreen&&this.screenManager.activeScreen.removeArtifact(e.artifactID)});m(this,"handleScrollPositionChanged",e=>{const r=e;typeof r.scrollPosition=="number"&&Number.isFinite(r.scrollPosition)&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setScrollPosition(r.scrollPosition)});m(this,"handleLayoutChanged",e=>{e instanceof Qb&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setLayout(e.layout)});m(this,"handleServerEvent",e=>{const r=e.event;if(r.type!=="artifact-focus"||!this.boundModel||r.screenID!==this.boundModel.id)return;const i=this.querySelector("layout-view");i&&i.focusArtifact(r.artifactID)})}connectedCallback(){this.screenManager.addEventListener("active-screen-changed",this.handleActiveScreenChanged),this.rebindModel(),this.render()}disconnectedCallback(){this.screenManager.removeEventListener("active-screen-changed",this.handleActiveScreenChanged),this.unbindModel(),this.disposeCardElements()}rebindModel(){const e=this.screenManager.activeScreen;this.boundModel!==e&&(this.unbindModel(),this.boundModel=e,e&&(e.addEventListener("change",this.handleModelChange),e.server.addEventListener("server-event",this.handleServerEvent)))}unbindModel(){this.boundModel&&(this.boundModel.removeEventListener("change",this.handleModelChange),this.boundModel.server.removeEventListener("server-event",this.handleServerEvent),this.boundModel=null)}buildCards(e){if(!e)return this.disposeCardElements(),new Map;const r=new Map;for(const i of e.artifacts.values()){let s=this.cardEls.get(i.id);s||(s=document.createElement("artifact-view"),this.cardEls.set(i.id,s)),s.artifact=i,s.screen=e,s.viewURL=e.server.getViewURL(i),s.contentURL=e.server.getContentURL(i),r.set(i.id,s)}for(const[i,s]of this.cardEls)r.has(i)||(s.remove(),this.cardEls.delete(i));return r}disposeCardElements(){for(const e of this.cardEls.values())e.remove();this.cardEls.clear()}render(){const e=this.screenManager.activeScreen,r=(e==null?void 0:e.layout)??[],i=this.buildCards(e);if(r.length===0){Ce(z``,this);return}Ce(z`
234
234
  <layout-view
235
235
  .layout=${r}
236
236
  .cards=${i}
@@ -239,33 +239,33 @@ ${r.documentElement.outerHTML}`],{type:mz});return URL.createObjectURL(o)}const
239
239
  @layout-change=${this.handleLayoutChanged}
240
240
  @close-artifact=${this.handleCloseArtifact}
241
241
  ></layout-view>
242
- `,this)}}customElements.define("screen-view",wO);function hl(n){return typeof n=="object"&&n!==null}const tu=new WeakMap,Og=Object.prototype.hasOwnProperty,SO=(()=>{const n=new Set;let t=HTMLElement.prototype;for(;t;){for(const e of Object.getOwnPropertyNames(t))n.add(e);if(t===Node.prototype)break;t=Object.getPrototypeOf(t)}return n})();function _O(n,t){if(hl(n))return t===null?void 0:n.parse(t);if(n===Boolean)return t!==null;if(t!==null)return n===Number?Number(t):t}function kO(n,t){return hl(n)?t==null?null:n.serialize(t):n===Boolean?t?"":null:t==null?null:String(t)}var ko,ih,Ir,ct,Bt,Pi,Cr,Di,we,pi,Jb,Qb,ew,tw,Ha;const hr=class hr extends HTMLElement{constructor(){var i;super();w(this,we);w(this,Ir,new Map);w(this,ct,new Map);w(this,Bt,new Map);w(this,Pi,!1);w(this,Cr,!1);w(this,Di,!1);const e=f(i=hr,ko,ih).call(i,this.constructor),r=this;for(const s of e.properties)Og.call(r,s)&&(l(this,Bt).set(s,r[s]),delete r[s])}static get observedAttributes(){var e;return f(e=hr,ko,ih).call(e,this).observedAttributes}connected(){}disconnected(){}changed(e){}connectedCallback(){if(f(this,we,tw).call(this),!l(this,Cr))for(const e of f(this,we,pi).call(this).properties)l(this,ct).has(e)||l(this,ct).set(e,void 0);this.dispatchEvent(new Event("reactive:connect")),this.connected(),f(this,we,Ha).call(this)}disconnectedCallback(){this.dispatchEvent(new Event("reactive:disconnect")),this.disconnected()}attributeChangedCallback(e,r,i){if(r===i)return;const s=f(this,we,pi).call(this).byAttr.get(e);s&&(l(this,Bt).has(s.property)||(this[s.property]=_O(s.type,i)))}};ko=new WeakSet,ih=function(e){const r=tu.get(e);if(r)return r;const i=[...e.properties??[]],s=e.attributes??{},o=new Map,a=new Map;for(const u of i)if(SO.has(u))throw new Error(`Reactive property "${u}" collides with a built-in DOM property. Rename it to avoid shadowing the platform API.`);for(const[u,h]of Object.entries(s)){if(u.includes("-")&&h.property===void 0)throw new Error(`Attribute "${u}" must declare a "property" name because kebab-case cannot be a property.`);const p=h.property??u;if(!i.includes(p))throw new Error(`Attribute '${u}' references property '${p}', which isn't declared in \`static properties\`. Add it to \`properties\` to make it reactive.`);if(hl(h.type)){if(typeof h.type.parse!="function")throw new Error(`Attribute "${u}" custom coercer is missing a \`parse\` function.`);if(typeof h.type.serialize!="function")throw new Error(`Attribute "${u}" custom coercer is missing a \`serialize\` function.`)}const v={attribute:u,property:p,type:h.type};o.set(u,v),a.set(p,v)}for(const u of i){const h=Object.getOwnPropertyDescriptor(e.prototype,u);if((h==null?void 0:h.get)!==void 0||(h==null?void 0:h.set)!==void 0)throw new Error(`Observed property "${u}" cannot define a custom getter/setter. Use changed() for side effects instead.`);h===void 0&&Object.defineProperty(e.prototype,u,{configurable:!0,enumerable:!0,get(){return l(this,Ir).get(u)},set(p){f(this,we,Jb).call(this,u,p)}})}const c={properties:i,observedAttributes:Object.keys(s),byAttr:o,byProp:a};return tu.set(e,c),c},Ir=new WeakMap,ct=new WeakMap,Bt=new WeakMap,Pi=new WeakMap,Cr=new WeakMap,Di=new WeakMap,we=new WeakSet,pi=function(){return tu.get(this.constructor)},Jb=function(e,r){if(!l(this,Di)&&l(this,Bt).has(e))return;const i=l(this,Ir).get(e);f(this,we,Qb).call(this,e,i,r)||(l(this,ct).has(e)||l(this,ct).set(e,i),l(this,Ir).set(e,r),l(this,Bt).delete(e),f(this,we,ew).call(this,e,r),this.isConnected&&f(this,we,Ha).call(this))},Qb=function(e,r,i){if(Object.is(r,i))return!0;const s=f(this,we,pi).call(this).byProp.get(e);if(!s||!hl(s.type))return!1;const o=r==null,a=i==null;if(o||a)return o&&a;try{return s.type.serialize(r)===s.type.serialize(i)}catch{return!1}},ew=function(e,r){const i=f(this,we,pi).call(this).byProp.get(e);if(!i)return;const{attribute:s,type:o}=i;if(o===Boolean){const c=this.hasAttribute(s);r&&!c?this.setAttribute(s,""):!r&&c&&this.removeAttribute(s);return}const a=kO(o,r);if(a===null){this.hasAttribute(s)&&this.removeAttribute(s);return}this.getAttribute(s)!==a&&this.setAttribute(s,a)},tw=function(){const e=this,r=f(this,we,pi).call(this);for(const i of r.properties){if(!Og.call(e,i))continue;const s=e[i];delete e[i],!(l(this,Bt).has(i)||l(this,Ir).has(i))&&(e[i]=s)}S(this,Di,!0);try{for(const[i,s]of l(this,Bt))e[i]=s;l(this,Bt).clear()}finally{S(this,Di,!1)}},Ha=function(){l(this,Pi)||!this.isConnected||l(this,Cr)&&l(this,ct).size===0||(S(this,Pi,!0),queueMicrotask(()=>{if(S(this,Pi,!1),!this.isConnected||l(this,Cr)&&l(this,ct).size===0)return;const e=new Map(l(this,ct));l(this,ct).clear(),S(this,Cr,!0);try{this.changed(e)}catch(r){console.error(r)}this.isConnected&&l(this,ct).size>0&&f(this,we,Ha).call(this)}))},w(hr,ko),m(hr,"properties"),m(hr,"attributes");let Gi=hr;var de,fn,Mn,Li,zi,gn,xo,ke,Oi,jt,W,nw,Eo,Ao,$o,To,sh,oh,ah,rw,iw,sw,ow,Sl,_l,kl,xl,lh,aw,Za,El,Wa,Al,lw,cw,uw,hw,dw,ot;class xO extends Gi{constructor(){super(...arguments);w(this,W);w(this,de,Kt.resolve("ScreenManager"));w(this,fn,Kt.resolve("ServerManager"));w(this,Mn,null);w(this,Li,new DisposableStack);w(this,zi,Oa());w(this,gn,Oa());w(this,xo,Oa());w(this,ke,{kind:"none"});w(this,Oi,!1);w(this,jt,[]);w(this,Eo,()=>{f(this,W,sh).call(this),S(this,ke,{kind:"none"}),l(this,ot).call(this)});w(this,Ao,()=>{l(this,ot).call(this)});w(this,$o,()=>{l(this,ot).call(this)});w(this,To,()=>{l(this,ot).call(this)});w(this,Sl,()=>{var i,s;if(l(this,ke).kind==="picker"){f(this,W,Wa).call(this);return}S(this,jt,f(this,W,aw).call(this));const e=((i=l(this,de).activeScreen)==null?void 0:i.id)??null,r=e&&l(this,jt).some(o=>o.screenID===e)?e:((s=l(this,jt)[0])==null?void 0:s.screenID)??null;S(this,ke,{kind:"picker",filter:"",highlightedID:r}),l(this,ot).call(this),queueMicrotask(()=>{var o;(o=l(this,xo).value)==null||o.focus()})});w(this,_l,e=>{var u;const r=l(this,ke);if(r.kind!=="picker")return;const i=e.target;if(!(i instanceof HTMLInputElement))return;const s=i.value,o=f(this,W,Za).call(this,l(this,jt),s),c=r.highlightedID!==null&&o.some(h=>h.screenID===r.highlightedID)?r.highlightedID:((u=o[0])==null?void 0:u.screenID)??null;S(this,ke,{kind:"picker",filter:s,highlightedID:c}),l(this,ot).call(this)});w(this,kl,e=>{var s;const r=l(this,ke);if(r.kind!=="picker")return;if(e.key==="Escape"){e.preventDefault(),f(this,W,Wa).call(this),(s=l(this,zi).value)==null||s.focus();return}const i=f(this,W,Za).call(this,l(this,jt),r.filter);if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(e.preventDefault(),i.length===0)return;const o=i.findIndex(u=>u.screenID===r.highlightedID),a=e.key==="ArrowDown"?1:-1,c=o<0?0:Math.max(0,Math.min(i.length-1,o+a));S(this,ke,{kind:"picker",filter:r.filter,highlightedID:i[c].screenID}),l(this,ot).call(this);return}if(e.key==="Enter"){e.preventDefault();const o=i.find(a=>a.screenID===r.highlightedID);o&&f(this,W,lh).call(this,o)}});w(this,xl,e=>{f(this,W,lh).call(this,e)});w(this,El,e=>{l(this,ke).kind==="picker"&&e.target===l(this,gn).value&&(S(this,ke,{kind:"none"}),l(this,ot).call(this))});w(this,Al,async()=>{if(l(this,Oi))return;const e=f(this,W,lw).call(this);if(e){S(this,Oi,!0);try{const r=await e.createScreen(EO(new Date));l(this,de).addTab(e.url,r.id),l(this,de).setActive(e.url,r.id)}catch{}finally{S(this,Oi,!1)}}});w(this,ot,()=>{const e=f(this,W,sw).call(this);Ce(z`
243
- ${f(this,W,cw).call(this)}
242
+ `,this)}}customElements.define("screen-view",SO);function fl(n){return typeof n=="object"&&n!==null}const au=new WeakMap,Wg=Object.prototype.hasOwnProperty,_O=(()=>{const n=new Set;let t=HTMLElement.prototype;for(;t;){for(const e of Object.getOwnPropertyNames(t))n.add(e);if(t===Node.prototype)break;t=Object.getPrototypeOf(t)}return n})();function kO(n,t){if(fl(n))return t===null?void 0:n.parse(t);if(n===Boolean)return t!==null;if(t!==null)return n===Number?Number(t):t}function xO(n,t){return fl(n)?t==null?null:n.serialize(t):n===Boolean?t?"":null:t==null?null:String(t)}var xo,ph,Ir,ct,qt,Di,Cr,Li,we,pi,ew,tw,nw,rw,Va;const dr=class dr extends HTMLElement{constructor(){var i;super();w(this,we);w(this,Ir,new Map);w(this,ct,new Map);w(this,qt,new Map);w(this,Di,!1);w(this,Cr,!1);w(this,Li,!1);const e=f(i=dr,xo,ph).call(i,this.constructor),r=this;for(const s of e.properties)Wg.call(r,s)&&(l(this,qt).set(s,r[s]),delete r[s])}static get observedAttributes(){var e;return f(e=dr,xo,ph).call(e,this).observedAttributes}connected(){}disconnected(){}changed(e){}connectedCallback(){if(f(this,we,rw).call(this),!l(this,Cr))for(const e of f(this,we,pi).call(this).properties)l(this,ct).has(e)||l(this,ct).set(e,void 0);this.dispatchEvent(new Event("reactive:connect")),this.connected(),f(this,we,Va).call(this)}disconnectedCallback(){this.dispatchEvent(new Event("reactive:disconnect")),this.disconnected()}attributeChangedCallback(e,r,i){if(r===i)return;const s=f(this,we,pi).call(this).byAttr.get(e);s&&(l(this,qt).has(s.property)||(this[s.property]=kO(s.type,i)))}};xo=new WeakSet,ph=function(e){const r=au.get(e);if(r)return r;const i=[...e.properties??[]],s=e.attributes??{},o=new Map,a=new Map;for(const u of i)if(_O.has(u))throw new Error(`Reactive property "${u}" collides with a built-in DOM property. Rename it to avoid shadowing the platform API.`);for(const[u,h]of Object.entries(s)){if(u.includes("-")&&h.property===void 0)throw new Error(`Attribute "${u}" must declare a "property" name because kebab-case cannot be a property.`);const p=h.property??u;if(!i.includes(p))throw new Error(`Attribute '${u}' references property '${p}', which isn't declared in \`static properties\`. Add it to \`properties\` to make it reactive.`);if(fl(h.type)){if(typeof h.type.parse!="function")throw new Error(`Attribute "${u}" custom coercer is missing a \`parse\` function.`);if(typeof h.type.serialize!="function")throw new Error(`Attribute "${u}" custom coercer is missing a \`serialize\` function.`)}const v={attribute:u,property:p,type:h.type};o.set(u,v),a.set(p,v)}for(const u of i){const h=Object.getOwnPropertyDescriptor(e.prototype,u);if((h==null?void 0:h.get)!==void 0||(h==null?void 0:h.set)!==void 0)throw new Error(`Observed property "${u}" cannot define a custom getter/setter. Use changed() for side effects instead.`);h===void 0&&Object.defineProperty(e.prototype,u,{configurable:!0,enumerable:!0,get(){return l(this,Ir).get(u)},set(p){f(this,we,ew).call(this,u,p)}})}const c={properties:i,observedAttributes:Object.keys(s),byAttr:o,byProp:a};return au.set(e,c),c},Ir=new WeakMap,ct=new WeakMap,qt=new WeakMap,Di=new WeakMap,Cr=new WeakMap,Li=new WeakMap,we=new WeakSet,pi=function(){return au.get(this.constructor)},ew=function(e,r){if(!l(this,Li)&&l(this,qt).has(e))return;const i=l(this,Ir).get(e);f(this,we,tw).call(this,e,i,r)||(l(this,ct).has(e)||l(this,ct).set(e,i),l(this,Ir).set(e,r),l(this,qt).delete(e),f(this,we,nw).call(this,e,r),this.isConnected&&f(this,we,Va).call(this))},tw=function(e,r,i){if(Object.is(r,i))return!0;const s=f(this,we,pi).call(this).byProp.get(e);if(!s||!fl(s.type))return!1;const o=r==null,a=i==null;if(o||a)return o&&a;try{return s.type.serialize(r)===s.type.serialize(i)}catch{return!1}},nw=function(e,r){const i=f(this,we,pi).call(this).byProp.get(e);if(!i)return;const{attribute:s,type:o}=i;if(o===Boolean){const c=this.hasAttribute(s);r&&!c?this.setAttribute(s,""):!r&&c&&this.removeAttribute(s);return}const a=xO(o,r);if(a===null){this.hasAttribute(s)&&this.removeAttribute(s);return}this.getAttribute(s)!==a&&this.setAttribute(s,a)},rw=function(){const e=this,r=f(this,we,pi).call(this);for(const i of r.properties){if(!Wg.call(e,i))continue;const s=e[i];delete e[i],!(l(this,qt).has(i)||l(this,Ir).has(i))&&(e[i]=s)}S(this,Li,!0);try{for(const[i,s]of l(this,qt))e[i]=s;l(this,qt).clear()}finally{S(this,Li,!1)}},Va=function(){l(this,Di)||!this.isConnected||l(this,Cr)&&l(this,ct).size===0||(S(this,Di,!0),queueMicrotask(()=>{if(S(this,Di,!1),!this.isConnected||l(this,Cr)&&l(this,ct).size===0)return;const e=new Map(l(this,ct));l(this,ct).clear(),S(this,Cr,!0);try{this.changed(e)}catch(r){console.error(r)}this.isConnected&&l(this,ct).size>0&&f(this,we,Va).call(this)}))},w(dr,xo),m(dr,"properties"),m(dr,"attributes");let qi=dr;var de,vn,Nn,zi,Oi,yn,Eo,ke,Mi,Yt,W,iw,Ao,$o,To,Io,fh,gh,mh,sw,ow,aw,lw,xl,El,Al,$l,vh,cw,Ba,Tl,ja,Il,uw,hw,dw,pw,fw,ot;class EO extends qi{constructor(){super(...arguments);w(this,W);w(this,de,en.resolve("ScreenManager"));w(this,vn,en.resolve("ServerManager"));w(this,Nn,null);w(this,zi,new DisposableStack);w(this,Oi,Ua());w(this,yn,Ua());w(this,Eo,Ua());w(this,ke,{kind:"none"});w(this,Mi,!1);w(this,Yt,[]);w(this,Ao,()=>{f(this,W,fh).call(this),S(this,ke,{kind:"none"}),l(this,ot).call(this)});w(this,$o,()=>{l(this,ot).call(this)});w(this,To,()=>{l(this,ot).call(this)});w(this,Io,()=>{l(this,ot).call(this)});w(this,xl,()=>{var i,s;if(l(this,ke).kind==="picker"){f(this,W,ja).call(this);return}S(this,Yt,f(this,W,cw).call(this));const e=((i=l(this,de).activeScreen)==null?void 0:i.id)??null,r=e&&l(this,Yt).some(o=>o.screenID===e)?e:((s=l(this,Yt)[0])==null?void 0:s.screenID)??null;S(this,ke,{kind:"picker",filter:"",highlightedID:r}),l(this,ot).call(this),queueMicrotask(()=>{var o;(o=l(this,Eo).value)==null||o.focus()})});w(this,El,e=>{var u;const r=l(this,ke);if(r.kind!=="picker")return;const i=e.target;if(!(i instanceof HTMLInputElement))return;const s=i.value,o=f(this,W,Ba).call(this,l(this,Yt),s),c=r.highlightedID!==null&&o.some(h=>h.screenID===r.highlightedID)?r.highlightedID:((u=o[0])==null?void 0:u.screenID)??null;S(this,ke,{kind:"picker",filter:s,highlightedID:c}),l(this,ot).call(this)});w(this,Al,e=>{var s;const r=l(this,ke);if(r.kind!=="picker")return;if(e.key==="Escape"){e.preventDefault(),f(this,W,ja).call(this),(s=l(this,Oi).value)==null||s.focus();return}const i=f(this,W,Ba).call(this,l(this,Yt),r.filter);if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(e.preventDefault(),i.length===0)return;const o=i.findIndex(u=>u.screenID===r.highlightedID),a=e.key==="ArrowDown"?1:-1,c=o<0?0:Math.max(0,Math.min(i.length-1,o+a));S(this,ke,{kind:"picker",filter:r.filter,highlightedID:i[c].screenID}),l(this,ot).call(this);return}if(e.key==="Enter"){e.preventDefault();const o=i.find(a=>a.screenID===r.highlightedID);o&&f(this,W,vh).call(this,o)}});w(this,$l,e=>{f(this,W,vh).call(this,e)});w(this,Tl,e=>{l(this,ke).kind==="picker"&&e.target===l(this,yn).value&&(S(this,ke,{kind:"none"}),l(this,ot).call(this))});w(this,Il,async()=>{if(l(this,Mi))return;const e=f(this,W,uw).call(this);if(e){S(this,Mi,!0);try{const r=await e.createScreen(AO(new Date));l(this,de).addTab(e.url,r.id),l(this,de).setActive(e.url,r.id)}catch{}finally{S(this,Mi,!1)}}});w(this,ot,()=>{const e=f(this,W,aw).call(this);Ce(z`
243
+ ${f(this,W,hw).call(this)}
244
244
  <div class="pills" role="group" aria-label="Open tabs">
245
- ${e.map(r=>f(this,W,uw).call(this,r))}
245
+ ${e.map(r=>f(this,W,dw).call(this,r))}
246
246
  </div>
247
- ${f(this,W,hw).call(this)}
248
- `,this),l(this,gn).value&&(l(this,gn).value.anchor=l(this,zi).value??null)})}connected(){l(this,de).addEventListener("active-screen-changed",l(this,Eo)),l(this,de).addEventListener("tabs-changed",l(this,Ao)),l(this,fn).addEventListener("screens-changed",l(this,$o)),f(this,W,sh).call(this),l(this,ot).call(this),f(this,W,nw).call(this),l(this,Li).defer(()=>{l(this,de).removeEventListener("active-screen-changed",l(this,Eo)),l(this,de).removeEventListener("tabs-changed",l(this,Ao)),l(this,fn).removeEventListener("screens-changed",l(this,$o)),f(this,W,oh).call(this)})}disconnected(){l(this,Li).dispose(),S(this,Li,new DisposableStack)}}de=new WeakMap,fn=new WeakMap,Mn=new WeakMap,Li=new WeakMap,zi=new WeakMap,gn=new WeakMap,xo=new WeakMap,ke=new WeakMap,Oi=new WeakMap,jt=new WeakMap,W=new WeakSet,nw=async function(){const e=await iv(this);this.setAttribute("tone",e)},Eo=new WeakMap,Ao=new WeakMap,$o=new WeakMap,To=new WeakMap,sh=function(){var r;const e=l(this,de).activeScreen;l(this,Mn)!==e&&(f(this,W,oh).call(this),S(this,Mn,e),(r=l(this,Mn))==null||r.addEventListener("change",l(this,To)))},oh=function(){var e;(e=l(this,Mn))==null||e.removeEventListener("change",l(this,To)),S(this,Mn,null)},ah=function(e,r){l(this,de).setActive(e,r)},rw=function(e,r,i){i.stopPropagation();const s=l(this,de).getTabs(e),o=f(this,W,ow).call(this,s,r),a=l(this,de).activeScreen,c=(a==null?void 0:a.id)===r&&a.server.url===e;l(this,de).removeTab(e,r),c&&(o?l(this,de).setActive(e,o):l(this,de).clearActive())},iw=function(e,r,i){const s=l(this,de).activeScreen;if((s==null?void 0:s.id)===r){s.rename(i.value);return}const o=l(this,fn).servers.get(e),a=o==null?void 0:o.screens.get(r);!o||!a||o.client.screens.update({screenID:r,name:i.value}).catch(()=>{})},sw=function(){const e=l(this,de).activeScreen,r=[];for(const i of l(this,fn).servers.values())for(const s of l(this,de).getTabs(i.url)){const o=i.screens.get(s);o&&r.push({serverURL:i.url,screenID:o.id,name:o.name,isActive:(e==null?void 0:e.id)===o.id&&e.server.url===i.url})}return r},ow=function(e,r){const i=e.indexOf(r);if(i<0)return null;const s=e.filter(a=>a!==r);if(s.length===0)return null;const o=Math.max(0,i-1);return s[o]??null},Sl=new WeakMap,_l=new WeakMap,kl=new WeakMap,xl=new WeakMap,lh=function(e){l(this,de).addTab(e.serverURL,e.screenID),l(this,de).setActive(e.serverURL,e.screenID),f(this,W,Wa).call(this)},aw=function(){const e=[];for(const r of l(this,fn).servers.values())for(const i of r.screens.values())e.push({serverURL:r.url,screenID:i.id,name:i.name});return e},Za=function(e,r){const i=r.trim().toLowerCase();return i.length===0?e:e.filter(s=>s.name.toLowerCase().includes(i))},El=new WeakMap,Wa=function(){l(this,ke).kind==="picker"&&(l(this,gn).value&&(l(this,gn).value.open=!1),S(this,ke,{kind:"none"}),l(this,ot).call(this))},Al=new WeakMap,lw=function(){for(const e of l(this,fn).servers.values())return e;return null},cw=function(){return z`
247
+ ${f(this,W,pw).call(this)}
248
+ `,this),l(this,yn).value&&(l(this,yn).value.anchor=l(this,Oi).value??null)})}connected(){l(this,de).addEventListener("active-screen-changed",l(this,Ao)),l(this,de).addEventListener("tabs-changed",l(this,$o)),l(this,vn).addEventListener("screens-changed",l(this,To)),f(this,W,fh).call(this),l(this,ot).call(this),f(this,W,iw).call(this),l(this,zi).defer(()=>{l(this,de).removeEventListener("active-screen-changed",l(this,Ao)),l(this,de).removeEventListener("tabs-changed",l(this,$o)),l(this,vn).removeEventListener("screens-changed",l(this,To)),f(this,W,gh).call(this)})}disconnected(){l(this,zi).dispose(),S(this,zi,new DisposableStack)}}de=new WeakMap,vn=new WeakMap,Nn=new WeakMap,zi=new WeakMap,Oi=new WeakMap,yn=new WeakMap,Eo=new WeakMap,ke=new WeakMap,Mi=new WeakMap,Yt=new WeakMap,W=new WeakSet,iw=async function(){const e=await cv(this);this.setAttribute("tone",e)},Ao=new WeakMap,$o=new WeakMap,To=new WeakMap,Io=new WeakMap,fh=function(){var r;const e=l(this,de).activeScreen;l(this,Nn)!==e&&(f(this,W,gh).call(this),S(this,Nn,e),(r=l(this,Nn))==null||r.addEventListener("change",l(this,Io)))},gh=function(){var e;(e=l(this,Nn))==null||e.removeEventListener("change",l(this,Io)),S(this,Nn,null)},mh=function(e,r){l(this,de).setActive(e,r)},sw=function(e,r,i){i.stopPropagation();const s=l(this,de).getTabs(e),o=f(this,W,lw).call(this,s,r),a=l(this,de).activeScreen,c=(a==null?void 0:a.id)===r&&a.server.url===e;l(this,de).removeTab(e,r),c&&(o?l(this,de).setActive(e,o):l(this,de).clearActive())},ow=function(e,r,i){const s=l(this,de).activeScreen;if((s==null?void 0:s.id)===r){s.rename(i.value);return}const o=l(this,vn).servers.get(e),a=o==null?void 0:o.screens.get(r);!o||!a||o.client.screens.update({screenID:r,name:i.value}).catch(()=>{})},aw=function(){const e=l(this,de).activeScreen,r=[];for(const i of l(this,vn).servers.values())for(const s of l(this,de).getTabs(i.url)){const o=i.screens.get(s);o&&r.push({serverURL:i.url,screenID:o.id,name:o.name,isActive:(e==null?void 0:e.id)===o.id&&e.server.url===i.url})}return r},lw=function(e,r){const i=e.indexOf(r);if(i<0)return null;const s=e.filter(a=>a!==r);if(s.length===0)return null;const o=Math.max(0,i-1);return s[o]??null},xl=new WeakMap,El=new WeakMap,Al=new WeakMap,$l=new WeakMap,vh=function(e){l(this,de).addTab(e.serverURL,e.screenID),l(this,de).setActive(e.serverURL,e.screenID),f(this,W,ja).call(this)},cw=function(){const e=[];for(const r of l(this,vn).servers.values())for(const i of r.screens.values())e.push({serverURL:r.url,screenID:i.id,name:i.name});return e},Ba=function(e,r){const i=r.trim().toLowerCase();return i.length===0?e:e.filter(s=>s.name.toLowerCase().includes(i))},Tl=new WeakMap,ja=function(){l(this,ke).kind==="picker"&&(l(this,yn).value&&(l(this,yn).value.open=!1),S(this,ke,{kind:"none"}),l(this,ot).call(this))},Il=new WeakMap,uw=function(){for(const e of l(this,vn).servers.values())return e;return null},hw=function(){return z`
249
249
  <segmented-control variant="glass" role="group" aria-label="Screens">
250
250
  <button
251
251
  type="button"
252
252
  ?icon-only=${!0}
253
253
  aria-label="Choose screen"
254
- @click=${l(this,Sl)}
255
- ${Ma(l(this,zi))}
254
+ @click=${l(this,xl)}
255
+ ${Fa(l(this,Oi))}
256
256
  >
257
- ${V2({size:16,weight:"regular"})}
257
+ ${B2({size:16,weight:"regular"})}
258
258
  </button>
259
259
  <button
260
260
  type="button"
261
261
  ?icon-only=${!0}
262
262
  aria-label="New screen"
263
- @click=${l(this,Al)}
263
+ @click=${l(this,Il)}
264
264
  >
265
- ${B2({size:16,weight:"regular"})}
265
+ ${j2({size:16,weight:"regular"})}
266
266
  </button>
267
267
  </segmented-control>
268
- `},uw=function(e){return z`
268
+ `},dw=function(e){return z`
269
269
  <span class="tab" ?data-active=${e.isActive}>
270
270
  <button
271
271
  type="button"
@@ -274,16 +274,16 @@ ${r.documentElement.outerHTML}`],{type:mz});return URL.createObjectURL(o)}const
274
274
  aria-pressed=${e.isActive?"true":"false"}
275
275
  aria-current=${e.isActive?"page":se}
276
276
  aria-label=${e.isActive?`Current tab: ${e.name}`:`Switch to ${e.name}`}
277
- @mousedown=${r=>{r.button===0&&f(this,W,ah).call(this,e.serverURL,e.screenID)}}
278
- @click=${()=>f(this,W,ah).call(this,e.serverURL,e.screenID)}
277
+ @mousedown=${r=>{r.button===0&&f(this,W,mh).call(this,e.serverURL,e.screenID)}}
278
+ @click=${()=>f(this,W,mh).call(this,e.serverURL,e.screenID)}
279
279
  >
280
280
  <span class="tab-leading">
281
- ${W2({weight:"bold"})}
281
+ ${V2({weight:"bold"})}
282
282
  </span>
283
283
  <editable-text
284
284
  class="tab-name"
285
285
  .value=${e.name}
286
- @rename=${r=>f(this,W,iw).call(this,e.serverURL,e.screenID,r)}
286
+ @rename=${r=>f(this,W,ow).call(this,e.serverURL,e.screenID,r)}
287
287
  ></editable-text>
288
288
  </button>
289
289
  <button
@@ -293,19 +293,19 @@ ${r.documentElement.outerHTML}`],{type:mz});return URL.createObjectURL(o)}const
293
293
  icon-only
294
294
  class="tab-close"
295
295
  aria-label=${`Close ${e.name}`}
296
- @click=${r=>f(this,W,rw).call(this,e.serverURL,e.screenID,r)}
296
+ @click=${r=>f(this,W,sw).call(this,e.serverURL,e.screenID,r)}
297
297
  >
298
- ${pd({weight:"bold"})}
298
+ ${_d({weight:"bold"})}
299
299
  </button>
300
300
  </span>
301
- `},hw=function(){var o;const e=l(this,ke).kind==="picker"?l(this,ke).filter:"",r=l(this,ke).kind==="picker"?l(this,ke).highlightedID:null,i=((o=l(this,de).activeScreen)==null?void 0:o.id)??null,s=f(this,W,Za).call(this,l(this,jt),e);return z`
301
+ `},pw=function(){var o;const e=l(this,ke).kind==="picker"?l(this,ke).filter:"",r=l(this,ke).kind==="picker"?l(this,ke).highlightedID:null,i=((o=l(this,de).activeScreen)==null?void 0:o.id)??null,s=f(this,W,Ba).call(this,l(this,Yt),e);return z`
302
302
  <ui-popover
303
303
  class="picker-popover"
304
304
  material="glass-frosted"
305
305
  ?open=${l(this,ke).kind==="picker"}
306
- @close=${l(this,El)}
307
- @keydown=${l(this,kl)}
308
- ${Ma(l(this,gn))}
306
+ @close=${l(this,Tl)}
307
+ @keydown=${l(this,Al)}
308
+ ${Fa(l(this,yn))}
309
309
  >
310
310
  <div class="picker">
311
311
  <input
@@ -314,15 +314,15 @@ ${r.documentElement.outerHTML}`],{type:mz});return URL.createObjectURL(o)}const
314
314
  placeholder="Filter screens"
315
315
  aria-label="Filter screens"
316
316
  .value=${e}
317
- @input=${l(this,_l)}
318
- ${Ma(l(this,xo))}
317
+ @input=${l(this,El)}
318
+ ${Fa(l(this,Eo))}
319
319
  />
320
320
  ${s.length===0?z`<p class="picker-empty">
321
- ${l(this,jt).length===0?"No screens":"No matches"}
322
- </p>`:f(this,W,dw).call(this,s,r,i)}
321
+ ${l(this,Yt).length===0?"No screens":"No matches"}
322
+ </p>`:f(this,W,fw).call(this,s,r,i)}
323
323
  </div>
324
324
  </ui-popover>
325
- `},dw=function(e,r,i){return z`
325
+ `},fw=function(e,r,i){return z`
326
326
  <ul class="picker-list" role="listbox">
327
327
  <li class="picker-section-label" role="presentation">Recent</li>
328
328
  ${e.map(s=>{const o=s.screenID===i;return z`
@@ -333,19 +333,19 @@ ${r.documentElement.outerHTML}`],{type:mz});return URL.createObjectURL(o)}const
333
333
  aria-current=${o?"true":se}
334
334
  ?data-highlighted=${s.screenID===r}
335
335
  ?data-active=${o}
336
- @click=${()=>l(this,xl).call(this,s)}
336
+ @click=${()=>l(this,$l).call(this,s)}
337
337
  >
338
338
  <span class="picker-name">${s.name}</span>
339
339
  </li>
340
340
  `})}
341
341
  </ul>
342
- `},ot=new WeakMap;customElements.define("screen-select",xO);function EO(n){const t=n.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}),e=12,r=n.getHours(),i=r%e===0?e:r%e,s=n.getMinutes().toString().padStart(2,"0"),o=r>=e?"pm":"am";return`${t} at ${i}:${s}${o}`}const nu=6e4;var Nn,Rr,Mi,Va;class AO extends HTMLElement{constructor(){super(...arguments);w(this,Mi);w(this,Nn,null);w(this,Rr,null)}connectedCallback(){this.hasAttribute("material")||this.setAttribute("material","glass"),f(this,Mi,Va).call(this);const e=nu-Date.now()%nu;S(this,Nn,window.setTimeout(()=>{S(this,Nn,null),f(this,Mi,Va).call(this),S(this,Rr,window.setInterval(()=>f(this,Mi,Va).call(this),nu))},e))}disconnectedCallback(){l(this,Nn)!==null&&clearTimeout(l(this,Nn)),l(this,Rr)!==null&&clearInterval(l(this,Rr)),S(this,Nn,null),S(this,Rr,null)}}Nn=new WeakMap,Rr=new WeakMap,Mi=new WeakSet,Va=function(){const e=new Date,r=new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric"}).format(e),i=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(e);Ce(z`<span class="date">${r}</span><span class="time">${i}</span>`,this)};customElements.get("menu-bar-clock")||customElements.define("menu-bar-clock",AO);/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:pw,setPrototypeOf:Mg,isFrozen:$O,getPrototypeOf:TO,getOwnPropertyDescriptor:IO}=Object;let{freeze:Ge,seal:mt,create:Ba}=Object,{apply:ch,construct:uh}=typeof Reflect<"u"&&Reflect;Ge||(Ge=function(t){return t});mt||(mt=function(t){return t});ch||(ch=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)});uh||(uh=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 ba=qe(Array.prototype.forEach),CO=qe(Array.prototype.lastIndexOf),Ng=qe(Array.prototype.pop),fs=qe(Array.prototype.push),RO=qe(Array.prototype.splice),ja=qe(String.prototype.toLowerCase),ru=qe(String.prototype.toString),iu=qe(String.prototype.match),gs=qe(String.prototype.replace),PO=qe(String.prototype.indexOf),DO=qe(String.prototype.trim),it=qe(Object.prototype.hasOwnProperty),He=qe(RegExp.prototype.test),ms=LO(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 ch(n,t,r)}}function LO(n){return function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return uh(n,e)}}function G(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ja;Mg&&Mg(n,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const s=e(i);s!==i&&($O(t)||(t[r]=s),i=s)}n[i]=!0}return n}function zO(n){for(let t=0;t<n.length;t++)it(n,t)||(n[t]=null);return n}function Lt(n){const t=Ba(null);for(const[e,r]of pw(n))it(n,e)&&(Array.isArray(r)?t[e]=zO(r):r&&typeof r=="object"&&r.constructor===Object?t[e]=Lt(r):t[e]=r);return t}function vs(n,t){for(;n!==null;){const r=IO(n,t);if(r){if(r.get)return qe(r.get);if(typeof r.value=="function")return qe(r.value)}n=TO(n)}function e(){return null}return e}const Ug=Ge(["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"]),su=Ge(["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"]),ou=Ge(["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"]),OO=Ge(["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"]),au=Ge(["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"]),MO=Ge(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Fg=Ge(["#text"]),Hg=Ge(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),lu=Ge(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Zg=Ge(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),wa=Ge(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),NO=mt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),UO=mt(/<%[\w\W]*|[\w\W]*%>/gm),FO=mt(/\$\{[\w\W]*/gm),HO=mt(/^data-[\-\w.\u00B7-\uFFFF]+$/),ZO=mt(/^aria-[\-\w]+$/),fw=mt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),WO=mt(/^(?:\w+script|data):/i),VO=mt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),gw=mt(/^html$/i),BO=mt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Wg=Object.freeze({__proto__:null,ARIA_ATTR:ZO,ATTR_WHITESPACE:VO,CUSTOM_ELEMENT:BO,DATA_ATTR:HO,DOCTYPE_NAME:gw,ERB_EXPR:UO,IS_ALLOWED_URI:fw,IS_SCRIPT_OR_DATA:WO,MUSTACHE_EXPR:NO,TMPLIT_EXPR:FO});const ys={element:1,text:3,progressingInstruction:7,comment:8,document:9},jO=function(){return typeof window>"u"?null:window},GO=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(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Vg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function mw(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:jO();const t=U=>mw(U);if(t.version="3.3.3",t.removed=[],!n||!n.document||n.document.nodeType!==ys.document||!n.Element)return t.isSupported=!1,t;let{document:e}=n;const r=e,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:c,NodeFilter:u,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:p,DOMParser:v,trustedTypes:g}=n,_=c.prototype,k=vs(_,"cloneNode"),T=vs(_,"remove"),P=vs(_,"nextSibling"),R=vs(_,"childNodes"),Z=vs(_,"parentNode");if(typeof o=="function"){const U=e.createElement("template");U.content&&U.content.ownerDocument&&(e=U.content.ownerDocument)}let N,F="";const{implementation:Y,createNodeIterator:j,createDocumentFragment:oe,getElementsByTagName:wt}=e,{importNode:Jn}=r;let Re=Vg();t.isSupported=typeof pw=="function"&&typeof Z=="function"&&Y&&Y.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Qn,ERB_EXPR:It,TMPLIT_EXPR:_n,DATA_ATTR:ec,ARIA_ATTR:Yo,IS_SCRIPT_OR_DATA:Mw,ATTR_WHITESPACE:$d,CUSTOM_ELEMENT:Nw}=Wg;let{IS_ALLOWED_URI:Td}=Wg,$e=null;const Id=G({},[...Ug,...su,...ou,...au,...Fg]);let Pe=null;const Cd=G({},[...Hg,...lu,...Zg,...wa]);let ve=Object.seal(Ba(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}})),os=null,Xo=null;const kn=Object.seal(Ba(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Rd=!0,tc=!0,Pd=!1,Dd=!0,jr=!1,Ko=!0,er=!1,nc=!1,rc=!1,Gr=!1,Jo=!1,Qo=!1,Ld=!0,zd=!1;const Uw="user-content-";let ic=!0,as=!1,qr={},Ct=null;const sc=G({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Od=null;const Md=G({},["audio","video","img","source","image","track"]);let oc=null;const Nd=G({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ea="http://www.w3.org/1998/Math/MathML",ta="http://www.w3.org/2000/svg",en="http://www.w3.org/1999/xhtml";let Yr=en,ac=!1,lc=null;const Fw=G({},[ea,ta,en],ru);let na=G({},["mi","mo","mn","ms","mtext"]),ra=G({},["annotation-xml"]);const Hw=G({},["title","style","font","a","script"]);let ls=null;const Zw=["application/xhtml+xml","text/html"],Ww="text/html";let _e=null,Xr=null;const Vw=e.createElement("form"),Ud=function(b){return b instanceof RegExp||b instanceof Function},cc=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Xr&&Xr===b)){if((!b||typeof b!="object")&&(b={}),b=Lt(b),ls=Zw.indexOf(b.PARSER_MEDIA_TYPE)===-1?Ww:b.PARSER_MEDIA_TYPE,_e=ls==="application/xhtml+xml"?ru:ja,$e=it(b,"ALLOWED_TAGS")?G({},b.ALLOWED_TAGS,_e):Id,Pe=it(b,"ALLOWED_ATTR")?G({},b.ALLOWED_ATTR,_e):Cd,lc=it(b,"ALLOWED_NAMESPACES")?G({},b.ALLOWED_NAMESPACES,ru):Fw,oc=it(b,"ADD_URI_SAFE_ATTR")?G(Lt(Nd),b.ADD_URI_SAFE_ATTR,_e):Nd,Od=it(b,"ADD_DATA_URI_TAGS")?G(Lt(Md),b.ADD_DATA_URI_TAGS,_e):Md,Ct=it(b,"FORBID_CONTENTS")?G({},b.FORBID_CONTENTS,_e):sc,os=it(b,"FORBID_TAGS")?G({},b.FORBID_TAGS,_e):Lt({}),Xo=it(b,"FORBID_ATTR")?G({},b.FORBID_ATTR,_e):Lt({}),qr=it(b,"USE_PROFILES")?b.USE_PROFILES:!1,Rd=b.ALLOW_ARIA_ATTR!==!1,tc=b.ALLOW_DATA_ATTR!==!1,Pd=b.ALLOW_UNKNOWN_PROTOCOLS||!1,Dd=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,jr=b.SAFE_FOR_TEMPLATES||!1,Ko=b.SAFE_FOR_XML!==!1,er=b.WHOLE_DOCUMENT||!1,Gr=b.RETURN_DOM||!1,Jo=b.RETURN_DOM_FRAGMENT||!1,Qo=b.RETURN_TRUSTED_TYPE||!1,rc=b.FORCE_BODY||!1,Ld=b.SANITIZE_DOM!==!1,zd=b.SANITIZE_NAMED_PROPS||!1,ic=b.KEEP_CONTENT!==!1,as=b.IN_PLACE||!1,Td=b.ALLOWED_URI_REGEXP||fw,Yr=b.NAMESPACE||en,na=b.MATHML_TEXT_INTEGRATION_POINTS||na,ra=b.HTML_INTEGRATION_POINTS||ra,ve=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&Ud(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ve.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&Ud(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ve.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ve.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),jr&&(tc=!1),Jo&&(Gr=!0),qr&&($e=G({},Fg),Pe=Ba(null),qr.html===!0&&(G($e,Ug),G(Pe,Hg)),qr.svg===!0&&(G($e,su),G(Pe,lu),G(Pe,wa)),qr.svgFilters===!0&&(G($e,ou),G(Pe,lu),G(Pe,wa)),qr.mathMl===!0&&(G($e,au),G(Pe,Zg),G(Pe,wa))),it(b,"ADD_TAGS")||(kn.tagCheck=null),it(b,"ADD_ATTR")||(kn.attributeCheck=null),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?kn.tagCheck=b.ADD_TAGS:($e===Id&&($e=Lt($e)),G($e,b.ADD_TAGS,_e))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?kn.attributeCheck=b.ADD_ATTR:(Pe===Cd&&(Pe=Lt(Pe)),G(Pe,b.ADD_ATTR,_e))),b.ADD_URI_SAFE_ATTR&&G(oc,b.ADD_URI_SAFE_ATTR,_e),b.FORBID_CONTENTS&&(Ct===sc&&(Ct=Lt(Ct)),G(Ct,b.FORBID_CONTENTS,_e)),b.ADD_FORBID_CONTENTS&&(Ct===sc&&(Ct=Lt(Ct)),G(Ct,b.ADD_FORBID_CONTENTS,_e)),ic&&($e["#text"]=!0),er&&G($e,["html","head","body"]),$e.table&&(G($e,["tbody"]),delete os.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw ms('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ms('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');N=b.TRUSTED_TYPES_POLICY,F=N.createHTML("")}else N===void 0&&(N=GO(g,i)),N!==null&&typeof F=="string"&&(F=N.createHTML(""));Ge&&Ge(b),Xr=b}},Fd=G({},[...su,...ou,...OO]),Hd=G({},[...au,...MO]),Bw=function(b){let I=Z(b);(!I||!I.tagName)&&(I={namespaceURI:Yr,tagName:"template"});const D=ja(b.tagName),ce=ja(I.tagName);return lc[b.namespaceURI]?b.namespaceURI===ta?I.namespaceURI===en?D==="svg":I.namespaceURI===ea?D==="svg"&&(ce==="annotation-xml"||na[ce]):!!Fd[D]:b.namespaceURI===ea?I.namespaceURI===en?D==="math":I.namespaceURI===ta?D==="math"&&ra[ce]:!!Hd[D]:b.namespaceURI===en?I.namespaceURI===ta&&!ra[ce]||I.namespaceURI===ea&&!na[ce]?!1:!Hd[D]&&(Hw[D]||!Fd[D]):!!(ls==="application/xhtml+xml"&&lc[b.namespaceURI]):!1},Rt=function(b){fs(t.removed,{element:b});try{Z(b).removeChild(b)}catch{T(b)}},tr=function(b,I){try{fs(t.removed,{attribute:I.getAttributeNode(b),from:I})}catch{fs(t.removed,{attribute:null,from:I})}if(I.removeAttribute(b),b==="is")if(Gr||Jo)try{Rt(I)}catch{}else try{I.setAttribute(b,"")}catch{}},Zd=function(b){let I=null,D=null;if(rc)b="<remove></remove>"+b;else{const ye=iu(b,/^[\r\n\t ]+/);D=ye&&ye[0]}ls==="application/xhtml+xml"&&Yr===en&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const ce=N?N.createHTML(b):b;if(Yr===en)try{I=new v().parseFromString(ce,ls)}catch{}if(!I||!I.documentElement){I=Y.createDocument(Yr,"template",null);try{I.documentElement.innerHTML=ac?F:ce}catch{}}const Ne=I.body||I.documentElement;return b&&D&&Ne.insertBefore(e.createTextNode(D),Ne.childNodes[0]||null),Yr===en?wt.call(I,er?"html":"body")[0]:er?I.documentElement:Ne},Wd=function(b){return j.call(b.ownerDocument||b,b,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},uc=function(b){return b instanceof p&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof h)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},Vd=function(b){return typeof a=="function"&&b instanceof a};function tn(U,b,I){ba(U,D=>{D.call(t,b,I,Xr)})}const Bd=function(b){let I=null;if(tn(Re.beforeSanitizeElements,b,null),uc(b))return Rt(b),!0;const D=_e(b.nodeName);if(tn(Re.uponSanitizeElement,b,{tagName:D,allowedTags:$e}),Ko&&b.hasChildNodes()&&!Vd(b.firstElementChild)&&He(/<[/\w!]/g,b.innerHTML)&&He(/<[/\w!]/g,b.textContent)||b.nodeType===ys.progressingInstruction||Ko&&b.nodeType===ys.comment&&He(/<[/\w]/g,b.data))return Rt(b),!0;if(!(kn.tagCheck instanceof Function&&kn.tagCheck(D))&&(!$e[D]||os[D])){if(!os[D]&&Gd(D)&&(ve.tagNameCheck instanceof RegExp&&He(ve.tagNameCheck,D)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(D)))return!1;if(ic&&!Ct[D]){const ce=Z(b)||b.parentNode,Ne=R(b)||b.childNodes;if(Ne&&ce){const ye=Ne.length;for(let Ye=ye-1;Ye>=0;--Ye){const nn=k(Ne[Ye],!0);nn.__removalCount=(b.__removalCount||0)+1,ce.insertBefore(nn,P(b))}}}return Rt(b),!0}return b instanceof c&&!Bw(b)||(D==="noscript"||D==="noembed"||D==="noframes")&&He(/<\/no(script|embed|frames)/i,b.innerHTML)?(Rt(b),!0):(jr&&b.nodeType===ys.text&&(I=b.textContent,ba([Qn,It,_n],ce=>{I=gs(I,ce," ")}),b.textContent!==I&&(fs(t.removed,{element:b.cloneNode()}),b.textContent=I)),tn(Re.afterSanitizeElements,b,null),!1)},jd=function(b,I,D){if(Xo[I]||Ld&&(I==="id"||I==="name")&&(D in e||D in Vw))return!1;if(!(tc&&!Xo[I]&&He(ec,I))){if(!(Rd&&He(Yo,I))){if(!(kn.attributeCheck instanceof Function&&kn.attributeCheck(I,b))){if(!Pe[I]||Xo[I]){if(!(Gd(b)&&(ve.tagNameCheck instanceof RegExp&&He(ve.tagNameCheck,b)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(b))&&(ve.attributeNameCheck instanceof RegExp&&He(ve.attributeNameCheck,I)||ve.attributeNameCheck instanceof Function&&ve.attributeNameCheck(I,b))||I==="is"&&ve.allowCustomizedBuiltInElements&&(ve.tagNameCheck instanceof RegExp&&He(ve.tagNameCheck,D)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(D))))return!1}else if(!oc[I]){if(!He(Td,gs(D,$d,""))){if(!((I==="src"||I==="xlink:href"||I==="href")&&b!=="script"&&PO(D,"data:")===0&&Od[b])){if(!(Pd&&!He(Mw,gs(D,$d,"")))){if(D)return!1}}}}}}}return!0},Gd=function(b){return b!=="annotation-xml"&&iu(b,Nw)},qd=function(b){tn(Re.beforeSanitizeAttributes,b,null);const{attributes:I}=b;if(!I||uc(b))return;const D={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Pe,forceKeepAttr:void 0};let ce=I.length;for(;ce--;){const Ne=I[ce],{name:ye,namespaceURI:Ye,value:nn}=Ne,Kr=_e(ye),hc=nn;let De=ye==="value"?hc:DO(hc);if(D.attrName=Kr,D.attrValue=De,D.keepAttr=!0,D.forceKeepAttr=void 0,tn(Re.uponSanitizeAttribute,b,D),De=D.attrValue,zd&&(Kr==="id"||Kr==="name")&&(tr(ye,b),De=Uw+De),Ko&&He(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,De)){tr(ye,b);continue}if(Kr==="attributename"&&iu(De,"href")){tr(ye,b);continue}if(D.forceKeepAttr)continue;if(!D.keepAttr){tr(ye,b);continue}if(!Dd&&He(/\/>/i,De)){tr(ye,b);continue}jr&&ba([Qn,It,_n],Xd=>{De=gs(De,Xd," ")});const Yd=_e(b.nodeName);if(!jd(Yd,Kr,De)){tr(ye,b);continue}if(N&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!Ye)switch(g.getAttributeType(Yd,Kr)){case"TrustedHTML":{De=N.createHTML(De);break}case"TrustedScriptURL":{De=N.createScriptURL(De);break}}if(De!==hc)try{Ye?b.setAttributeNS(Ye,ye,De):b.setAttribute(ye,De),uc(b)?Rt(b):Ng(t.removed)}catch{tr(ye,b)}}tn(Re.afterSanitizeAttributes,b,null)},jw=function U(b){let I=null;const D=Wd(b);for(tn(Re.beforeSanitizeShadowDOM,b,null);I=D.nextNode();)tn(Re.uponSanitizeShadowNode,I,null),Bd(I),qd(I),I.content instanceof s&&U(I.content);tn(Re.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(U){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=null,D=null,ce=null,Ne=null;if(ac=!U,ac&&(U="<!-->"),typeof U!="string"&&!Vd(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw ms("dirty is not a string, aborting")}else throw ms("toString is not a function");if(!t.isSupported)return U;if(nc||cc(b),t.removed=[],typeof U=="string"&&(as=!1),as){if(U.nodeName){const nn=_e(U.nodeName);if(!$e[nn]||os[nn])throw ms("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof a)I=Zd("<!---->"),D=I.ownerDocument.importNode(U,!0),D.nodeType===ys.element&&D.nodeName==="BODY"||D.nodeName==="HTML"?I=D:I.appendChild(D);else{if(!Gr&&!jr&&!er&&U.indexOf("<")===-1)return N&&Qo?N.createHTML(U):U;if(I=Zd(U),!I)return Gr?null:Qo?F:""}I&&rc&&Rt(I.firstChild);const ye=Wd(as?U:I);for(;ce=ye.nextNode();)Bd(ce),qd(ce),ce.content instanceof s&&jw(ce.content);if(as)return U;if(Gr){if(Jo)for(Ne=oe.call(I.ownerDocument);I.firstChild;)Ne.appendChild(I.firstChild);else Ne=I;return(Pe.shadowroot||Pe.shadowrootmode)&&(Ne=Jn.call(r,Ne,!0)),Ne}let Ye=er?I.outerHTML:I.innerHTML;return er&&$e["!doctype"]&&I.ownerDocument&&I.ownerDocument.doctype&&I.ownerDocument.doctype.name&&He(gw,I.ownerDocument.doctype.name)&&(Ye="<!DOCTYPE "+I.ownerDocument.doctype.name+`>
343
- `+Ye),jr&&ba([Qn,It,_n],nn=>{Ye=gs(Ye,nn," ")}),N&&Qo?N.createHTML(Ye):Ye},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};cc(U),nc=!0},t.clearConfig=function(){Xr=null,nc=!1},t.isValidAttribute=function(U,b,I){Xr||cc({});const D=_e(U),ce=_e(b);return jd(D,ce,I)},t.addHook=function(U,b){typeof b=="function"&&fs(Re[U],b)},t.removeHook=function(U,b){if(b!==void 0){const I=CO(Re[U],b);return I===-1?void 0:RO(Re[U],I,1)[0]}return Ng(Re[U])},t.removeHooks=function(U){Re[U]=[]},t.removeAllHooks=function(){Re=Vg()},t}var vw=mw();function gd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Br=gd();function yw(n){Br=n}var ur={exec:()=>null};function K(n,t=""){let e=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(je.caret,"$1"),e=e.replace(i,o),r},getRegex:()=>new RegExp(e,t)};return r}var qO=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),je={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}>`)},YO=/^(?:[ \t]*(?:\n|$))+/,XO=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,KO=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,qo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,JO=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,md=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,bw=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ww=K(bw).replace(/bull/g,md).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),QO=K(bw).replace(/bull/g,md).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(),vd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,eM=/^[^\n]+/,yd=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,tM=K(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",yd).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),nM=K(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,md).getRegex(),Jl="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",bd=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,rM=K("^ {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",bd).replace("tag",Jl).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Sw=K(vd).replace("hr",qo).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",Jl).getRegex(),iM=K(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Sw).getRegex(),wd={blockquote:iM,code:XO,def:tM,fences:KO,heading:JO,hr:qo,html:rM,lheading:ww,list:nM,newline:YO,paragraph:Sw,table:ur,text:eM},Bg=K("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",qo).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",Jl).getRegex(),sM={...wd,lheading:QO,table:Bg,paragraph:K(vd).replace("hr",qo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Bg).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",Jl).getRegex()},oM={...wd,html:K(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",bd).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:ur,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:K(vd).replace("hr",qo).replace("heading",` *#{1,6} *[^
344
- ]`).replace("lheading",ww).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},aM=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,lM=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,_w=/^( {2,}|\\)\n(?!\s*$)/,cM=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ss=/[\p{P}\p{S}]/u,Ql=/[\s\p{P}\p{S}]/u,Sd=/[^\s\p{P}\p{S}]/u,uM=K(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ql).getRegex(),kw=/(?!~)[\p{P}\p{S}]/u,hM=/(?!~)[\s\p{P}\p{S}]/u,dM=/(?:[^\s\p{P}\p{S}]|~)/u,pM=K(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",qO?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),xw=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,fM=K(xw,"u").replace(/punct/g,ss).getRegex(),gM=K(xw,"u").replace(/punct/g,kw).getRegex(),Ew="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",mM=K(Ew,"gu").replace(/notPunctSpace/g,Sd).replace(/punctSpace/g,Ql).replace(/punct/g,ss).getRegex(),vM=K(Ew,"gu").replace(/notPunctSpace/g,dM).replace(/punctSpace/g,hM).replace(/punct/g,kw).getRegex(),yM=K("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Sd).replace(/punctSpace/g,Ql).replace(/punct/g,ss).getRegex(),bM=K(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ss).getRegex(),wM="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",SM=K(wM,"gu").replace(/notPunctSpace/g,Sd).replace(/punctSpace/g,Ql).replace(/punct/g,ss).getRegex(),_M=K(/\\(punct)/,"gu").replace(/punct/g,ss).getRegex(),kM=K(/^<(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(),xM=K(bd).replace("(?:-->|$)","-->").getRegex(),EM=K("^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",xM).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),dl=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,AM=K(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",dl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Aw=K(/^!?\[(label)\]\[(ref)\]/).replace("label",dl).replace("ref",yd).getRegex(),$w=K(/^!?\[(ref)\](?:\[\])?/).replace("ref",yd).getRegex(),$M=K("reflink|nolink(?!\\()","g").replace("reflink",Aw).replace("nolink",$w).getRegex(),jg=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,_d={_backpedal:ur,anyPunctuation:_M,autolink:kM,blockSkip:pM,br:_w,code:lM,del:ur,delLDelim:ur,delRDelim:ur,emStrongLDelim:fM,emStrongRDelimAst:mM,emStrongRDelimUnd:yM,escape:aM,link:AM,nolink:$w,punctuation:uM,reflink:Aw,reflinkSearch:$M,tag:EM,text:cM,url:ur},TM={..._d,link:K(/^!?\[(label)\]\((.*?)\)/).replace("label",dl).getRegex(),reflink:K(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",dl).getRegex()},hh={..._d,emStrongRDelimAst:vM,emStrongLDelim:gM,delLDelim:bM,delRDelim:SM,url:K(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",jg).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:K(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",jg).getRegex()},IM={...hh,br:K(_w).replace("{2,}","*").getRegex(),text:K(hh.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Sa={normal:wd,gfm:sM,pedantic:oM},bs={normal:_d,gfm:hh,breaks:IM,pedantic:TM},CM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Gg=n=>CM[n];function zt(n,t){if(t){if(je.escapeTest.test(n))return n.replace(je.escapeReplace,Gg)}else if(je.escapeTestNoEncode.test(n))return n.replace(je.escapeReplaceNoEncode,Gg);return n}function qg(n){try{n=encodeURI(n).replace(je.percentDecode,"%")}catch{return null}return n}function Yg(n,t){var s;let e=n.replace(je.findPipe,(o,a,c)=>{let u=!1,h=a;for(;--h>=0&&c[h]==="\\";)u=!u;return u?"|":" |"}),r=e.split(je.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(je.slashPipe,"|");return r}function ws(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 RM(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 PM(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 Xg(n,t,e,r,i){let s=t.href,o=t.title||null,a=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:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,c}function DM(n,t,e){let r=n.match(e.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
342
+ `},ot=new WeakMap;customElements.define("screen-select",EO);function AO(n){const t=n.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}),e=12,r=n.getHours(),i=r%e===0?e:r%e,s=n.getMinutes().toString().padStart(2,"0"),o=r>=e?"pm":"am";return`${t} at ${i}:${s}${o}`}const lu=6e4;var Un,Rr,Ni,Ga;class $O extends HTMLElement{constructor(){super(...arguments);w(this,Ni);w(this,Un,null);w(this,Rr,null)}connectedCallback(){this.hasAttribute("material")||this.setAttribute("material","glass"),f(this,Ni,Ga).call(this);const e=lu-Date.now()%lu;S(this,Un,window.setTimeout(()=>{S(this,Un,null),f(this,Ni,Ga).call(this),S(this,Rr,window.setInterval(()=>f(this,Ni,Ga).call(this),lu))},e))}disconnectedCallback(){l(this,Un)!==null&&clearTimeout(l(this,Un)),l(this,Rr)!==null&&clearInterval(l(this,Rr)),S(this,Un,null),S(this,Rr,null)}}Un=new WeakMap,Rr=new WeakMap,Ni=new WeakSet,Ga=function(){const e=new Date,r=new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric"}).format(e),i=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(e);Ce(z`<span class="date">${r}</span><span class="time">${i}</span>`,this)};customElements.get("menu-bar-clock")||customElements.define("menu-bar-clock",$O);/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:gw,setPrototypeOf:Vg,isFrozen:TO,getPrototypeOf:IO,getOwnPropertyDescriptor:CO}=Object;let{freeze:Ge,seal:mt,create:qa}=Object,{apply:yh,construct:bh}=typeof Reflect<"u"&&Reflect;Ge||(Ge=function(t){return t});mt||(mt=function(t){return t});yh||(yh=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)});bh||(bh=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 wa=qe(Array.prototype.forEach),RO=qe(Array.prototype.lastIndexOf),Bg=qe(Array.prototype.pop),gs=qe(Array.prototype.push),PO=qe(Array.prototype.splice),Ya=qe(String.prototype.toLowerCase),cu=qe(String.prototype.toString),uu=qe(String.prototype.match),ms=qe(String.prototype.replace),DO=qe(String.prototype.indexOf),LO=qe(String.prototype.trim),it=qe(Object.prototype.hasOwnProperty),He=qe(RegExp.prototype.test),vs=zO(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 yh(n,t,r)}}function zO(n){return function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return bh(n,e)}}function G(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ya;Vg&&Vg(n,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const s=e(i);s!==i&&(TO(t)||(t[r]=s),i=s)}n[i]=!0}return n}function OO(n){for(let t=0;t<n.length;t++)it(n,t)||(n[t]=null);return n}function Lt(n){const t=qa(null);for(const[e,r]of gw(n))it(n,e)&&(Array.isArray(r)?t[e]=OO(r):r&&typeof r=="object"&&r.constructor===Object?t[e]=Lt(r):t[e]=r);return t}function ys(n,t){for(;n!==null;){const r=CO(n,t);if(r){if(r.get)return qe(r.get);if(typeof r.value=="function")return qe(r.value)}n=IO(n)}function e(){return null}return e}const jg=Ge(["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"]),hu=Ge(["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"]),du=Ge(["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"]),MO=Ge(["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"]),pu=Ge(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),NO=Ge(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Gg=Ge(["#text"]),qg=Ge(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),fu=Ge(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Yg=Ge(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Sa=Ge(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),UO=mt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),FO=mt(/<%[\w\W]*|[\w\W]*%>/gm),HO=mt(/\$\{[\w\W]*/gm),ZO=mt(/^data-[\-\w.\u00B7-\uFFFF]+$/),WO=mt(/^aria-[\-\w]+$/),mw=mt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),VO=mt(/^(?:\w+script|data):/i),BO=mt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),vw=mt(/^html$/i),jO=mt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Xg=Object.freeze({__proto__:null,ARIA_ATTR:WO,ATTR_WHITESPACE:BO,CUSTOM_ELEMENT:jO,DATA_ATTR:ZO,DOCTYPE_NAME:vw,ERB_EXPR:FO,IS_ALLOWED_URI:mw,IS_SCRIPT_OR_DATA:VO,MUSTACHE_EXPR:UO,TMPLIT_EXPR:HO});const bs={element:1,text:3,progressingInstruction:7,comment:8,document:9},GO=function(){return typeof window>"u"?null:window},qO=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(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Kg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function yw(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:GO();const t=U=>yw(U);if(t.version="3.3.3",t.removed=[],!n||!n.document||n.document.nodeType!==bs.document||!n.Element)return t.isSupported=!1,t;let{document:e}=n;const r=e,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:c,NodeFilter:u,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:p,DOMParser:v,trustedTypes:g}=n,_=c.prototype,k=ys(_,"cloneNode"),I=ys(_,"remove"),P=ys(_,"nextSibling"),R=ys(_,"childNodes"),Z=ys(_,"parentNode");if(typeof o=="function"){const U=e.createElement("template");U.content&&U.content.ownerDocument&&(e=U.content.ownerDocument)}let N,F="";const{implementation:Y,createNodeIterator:j,createDocumentFragment:oe,getElementsByTagName:wt}=e,{importNode:Qn}=r;let Re=Kg();t.isSupported=typeof gw=="function"&&typeof Z=="function"&&Y&&Y.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:er,ERB_EXPR:It,TMPLIT_EXPR:En,DATA_ATTR:rc,ARIA_ATTR:Xo,IS_SCRIPT_OR_DATA:Uw,ATTR_WHITESPACE:Od,CUSTOM_ELEMENT:Fw}=Xg;let{IS_ALLOWED_URI:Md}=Xg,$e=null;const Nd=G({},[...jg,...hu,...du,...pu,...Gg]);let Pe=null;const Ud=G({},[...qg,...fu,...Yg,...Sa]);let ve=Object.seal(qa(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}})),as=null,Ko=null;const An=Object.seal(qa(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fd=!0,ic=!0,Hd=!1,Zd=!0,jr=!1,Jo=!0,tr=!1,sc=!1,oc=!1,Gr=!1,Qo=!1,ea=!1,Wd=!0,Vd=!1;const Hw="user-content-";let ac=!0,ls=!1,qr={},Ct=null;const lc=G({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Bd=null;const jd=G({},["audio","video","img","source","image","track"]);let cc=null;const Gd=G({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ta="http://www.w3.org/1998/Math/MathML",na="http://www.w3.org/2000/svg",rn="http://www.w3.org/1999/xhtml";let Yr=rn,uc=!1,hc=null;const Zw=G({},[ta,na,rn],cu);let ra=G({},["mi","mo","mn","ms","mtext"]),ia=G({},["annotation-xml"]);const Ww=G({},["title","style","font","a","script"]);let cs=null;const Vw=["application/xhtml+xml","text/html"],Bw="text/html";let _e=null,Xr=null;const jw=e.createElement("form"),qd=function(b){return b instanceof RegExp||b instanceof Function},dc=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Xr&&Xr===b)){if((!b||typeof b!="object")&&(b={}),b=Lt(b),cs=Vw.indexOf(b.PARSER_MEDIA_TYPE)===-1?Bw:b.PARSER_MEDIA_TYPE,_e=cs==="application/xhtml+xml"?cu:Ya,$e=it(b,"ALLOWED_TAGS")?G({},b.ALLOWED_TAGS,_e):Nd,Pe=it(b,"ALLOWED_ATTR")?G({},b.ALLOWED_ATTR,_e):Ud,hc=it(b,"ALLOWED_NAMESPACES")?G({},b.ALLOWED_NAMESPACES,cu):Zw,cc=it(b,"ADD_URI_SAFE_ATTR")?G(Lt(Gd),b.ADD_URI_SAFE_ATTR,_e):Gd,Bd=it(b,"ADD_DATA_URI_TAGS")?G(Lt(jd),b.ADD_DATA_URI_TAGS,_e):jd,Ct=it(b,"FORBID_CONTENTS")?G({},b.FORBID_CONTENTS,_e):lc,as=it(b,"FORBID_TAGS")?G({},b.FORBID_TAGS,_e):Lt({}),Ko=it(b,"FORBID_ATTR")?G({},b.FORBID_ATTR,_e):Lt({}),qr=it(b,"USE_PROFILES")?b.USE_PROFILES:!1,Fd=b.ALLOW_ARIA_ATTR!==!1,ic=b.ALLOW_DATA_ATTR!==!1,Hd=b.ALLOW_UNKNOWN_PROTOCOLS||!1,Zd=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,jr=b.SAFE_FOR_TEMPLATES||!1,Jo=b.SAFE_FOR_XML!==!1,tr=b.WHOLE_DOCUMENT||!1,Gr=b.RETURN_DOM||!1,Qo=b.RETURN_DOM_FRAGMENT||!1,ea=b.RETURN_TRUSTED_TYPE||!1,oc=b.FORCE_BODY||!1,Wd=b.SANITIZE_DOM!==!1,Vd=b.SANITIZE_NAMED_PROPS||!1,ac=b.KEEP_CONTENT!==!1,ls=b.IN_PLACE||!1,Md=b.ALLOWED_URI_REGEXP||mw,Yr=b.NAMESPACE||rn,ra=b.MATHML_TEXT_INTEGRATION_POINTS||ra,ia=b.HTML_INTEGRATION_POINTS||ia,ve=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&qd(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ve.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&qd(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ve.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ve.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),jr&&(ic=!1),Qo&&(Gr=!0),qr&&($e=G({},Gg),Pe=qa(null),qr.html===!0&&(G($e,jg),G(Pe,qg)),qr.svg===!0&&(G($e,hu),G(Pe,fu),G(Pe,Sa)),qr.svgFilters===!0&&(G($e,du),G(Pe,fu),G(Pe,Sa)),qr.mathMl===!0&&(G($e,pu),G(Pe,Yg),G(Pe,Sa))),it(b,"ADD_TAGS")||(An.tagCheck=null),it(b,"ADD_ATTR")||(An.attributeCheck=null),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?An.tagCheck=b.ADD_TAGS:($e===Nd&&($e=Lt($e)),G($e,b.ADD_TAGS,_e))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?An.attributeCheck=b.ADD_ATTR:(Pe===Ud&&(Pe=Lt(Pe)),G(Pe,b.ADD_ATTR,_e))),b.ADD_URI_SAFE_ATTR&&G(cc,b.ADD_URI_SAFE_ATTR,_e),b.FORBID_CONTENTS&&(Ct===lc&&(Ct=Lt(Ct)),G(Ct,b.FORBID_CONTENTS,_e)),b.ADD_FORBID_CONTENTS&&(Ct===lc&&(Ct=Lt(Ct)),G(Ct,b.ADD_FORBID_CONTENTS,_e)),ac&&($e["#text"]=!0),tr&&G($e,["html","head","body"]),$e.table&&(G($e,["tbody"]),delete as.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw vs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw vs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');N=b.TRUSTED_TYPES_POLICY,F=N.createHTML("")}else N===void 0&&(N=qO(g,i)),N!==null&&typeof F=="string"&&(F=N.createHTML(""));Ge&&Ge(b),Xr=b}},Yd=G({},[...hu,...du,...MO]),Xd=G({},[...pu,...NO]),Gw=function(b){let C=Z(b);(!C||!C.tagName)&&(C={namespaceURI:Yr,tagName:"template"});const D=Ya(b.tagName),ce=Ya(C.tagName);return hc[b.namespaceURI]?b.namespaceURI===na?C.namespaceURI===rn?D==="svg":C.namespaceURI===ta?D==="svg"&&(ce==="annotation-xml"||ra[ce]):!!Yd[D]:b.namespaceURI===ta?C.namespaceURI===rn?D==="math":C.namespaceURI===na?D==="math"&&ia[ce]:!!Xd[D]:b.namespaceURI===rn?C.namespaceURI===na&&!ia[ce]||C.namespaceURI===ta&&!ra[ce]?!1:!Xd[D]&&(Ww[D]||!Yd[D]):!!(cs==="application/xhtml+xml"&&hc[b.namespaceURI]):!1},Rt=function(b){gs(t.removed,{element:b});try{Z(b).removeChild(b)}catch{I(b)}},nr=function(b,C){try{gs(t.removed,{attribute:C.getAttributeNode(b),from:C})}catch{gs(t.removed,{attribute:null,from:C})}if(C.removeAttribute(b),b==="is")if(Gr||Qo)try{Rt(C)}catch{}else try{C.setAttribute(b,"")}catch{}},Kd=function(b){let C=null,D=null;if(oc)b="<remove></remove>"+b;else{const ye=uu(b,/^[\r\n\t ]+/);D=ye&&ye[0]}cs==="application/xhtml+xml"&&Yr===rn&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const ce=N?N.createHTML(b):b;if(Yr===rn)try{C=new v().parseFromString(ce,cs)}catch{}if(!C||!C.documentElement){C=Y.createDocument(Yr,"template",null);try{C.documentElement.innerHTML=uc?F:ce}catch{}}const Ne=C.body||C.documentElement;return b&&D&&Ne.insertBefore(e.createTextNode(D),Ne.childNodes[0]||null),Yr===rn?wt.call(C,tr?"html":"body")[0]:tr?C.documentElement:Ne},Jd=function(b){return j.call(b.ownerDocument||b,b,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},pc=function(b){return b instanceof p&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof h)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},Qd=function(b){return typeof a=="function"&&b instanceof a};function sn(U,b,C){wa(U,D=>{D.call(t,b,C,Xr)})}const ep=function(b){let C=null;if(sn(Re.beforeSanitizeElements,b,null),pc(b))return Rt(b),!0;const D=_e(b.nodeName);if(sn(Re.uponSanitizeElement,b,{tagName:D,allowedTags:$e}),Jo&&b.hasChildNodes()&&!Qd(b.firstElementChild)&&He(/<[/\w!]/g,b.innerHTML)&&He(/<[/\w!]/g,b.textContent)||b.nodeType===bs.progressingInstruction||Jo&&b.nodeType===bs.comment&&He(/<[/\w]/g,b.data))return Rt(b),!0;if(!(An.tagCheck instanceof Function&&An.tagCheck(D))&&(!$e[D]||as[D])){if(!as[D]&&np(D)&&(ve.tagNameCheck instanceof RegExp&&He(ve.tagNameCheck,D)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(D)))return!1;if(ac&&!Ct[D]){const ce=Z(b)||b.parentNode,Ne=R(b)||b.childNodes;if(Ne&&ce){const ye=Ne.length;for(let Ye=ye-1;Ye>=0;--Ye){const on=k(Ne[Ye],!0);on.__removalCount=(b.__removalCount||0)+1,ce.insertBefore(on,P(b))}}}return Rt(b),!0}return b instanceof c&&!Gw(b)||(D==="noscript"||D==="noembed"||D==="noframes")&&He(/<\/no(script|embed|frames)/i,b.innerHTML)?(Rt(b),!0):(jr&&b.nodeType===bs.text&&(C=b.textContent,wa([er,It,En],ce=>{C=ms(C,ce," ")}),b.textContent!==C&&(gs(t.removed,{element:b.cloneNode()}),b.textContent=C)),sn(Re.afterSanitizeElements,b,null),!1)},tp=function(b,C,D){if(Ko[C]||Wd&&(C==="id"||C==="name")&&(D in e||D in jw))return!1;if(!(ic&&!Ko[C]&&He(rc,C))){if(!(Fd&&He(Xo,C))){if(!(An.attributeCheck instanceof Function&&An.attributeCheck(C,b))){if(!Pe[C]||Ko[C]){if(!(np(b)&&(ve.tagNameCheck instanceof RegExp&&He(ve.tagNameCheck,b)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(b))&&(ve.attributeNameCheck instanceof RegExp&&He(ve.attributeNameCheck,C)||ve.attributeNameCheck instanceof Function&&ve.attributeNameCheck(C,b))||C==="is"&&ve.allowCustomizedBuiltInElements&&(ve.tagNameCheck instanceof RegExp&&He(ve.tagNameCheck,D)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(D))))return!1}else if(!cc[C]){if(!He(Md,ms(D,Od,""))){if(!((C==="src"||C==="xlink:href"||C==="href")&&b!=="script"&&DO(D,"data:")===0&&Bd[b])){if(!(Hd&&!He(Uw,ms(D,Od,"")))){if(D)return!1}}}}}}}return!0},np=function(b){return b!=="annotation-xml"&&uu(b,Fw)},rp=function(b){sn(Re.beforeSanitizeAttributes,b,null);const{attributes:C}=b;if(!C||pc(b))return;const D={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Pe,forceKeepAttr:void 0};let ce=C.length;for(;ce--;){const Ne=C[ce],{name:ye,namespaceURI:Ye,value:on}=Ne,Kr=_e(ye),fc=on;let De=ye==="value"?fc:LO(fc);if(D.attrName=Kr,D.attrValue=De,D.keepAttr=!0,D.forceKeepAttr=void 0,sn(Re.uponSanitizeAttribute,b,D),De=D.attrValue,Vd&&(Kr==="id"||Kr==="name")&&(nr(ye,b),De=Hw+De),Jo&&He(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,De)){nr(ye,b);continue}if(Kr==="attributename"&&uu(De,"href")){nr(ye,b);continue}if(D.forceKeepAttr)continue;if(!D.keepAttr){nr(ye,b);continue}if(!Zd&&He(/\/>/i,De)){nr(ye,b);continue}jr&&wa([er,It,En],sp=>{De=ms(De,sp," ")});const ip=_e(b.nodeName);if(!tp(ip,Kr,De)){nr(ye,b);continue}if(N&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!Ye)switch(g.getAttributeType(ip,Kr)){case"TrustedHTML":{De=N.createHTML(De);break}case"TrustedScriptURL":{De=N.createScriptURL(De);break}}if(De!==fc)try{Ye?b.setAttributeNS(Ye,ye,De):b.setAttribute(ye,De),pc(b)?Rt(b):Bg(t.removed)}catch{nr(ye,b)}}sn(Re.afterSanitizeAttributes,b,null)},qw=function U(b){let C=null;const D=Jd(b);for(sn(Re.beforeSanitizeShadowDOM,b,null);C=D.nextNode();)sn(Re.uponSanitizeShadowNode,C,null),ep(C),rp(C),C.content instanceof s&&U(C.content);sn(Re.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(U){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=null,D=null,ce=null,Ne=null;if(uc=!U,uc&&(U="<!-->"),typeof U!="string"&&!Qd(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw vs("dirty is not a string, aborting")}else throw vs("toString is not a function");if(!t.isSupported)return U;if(sc||dc(b),t.removed=[],typeof U=="string"&&(ls=!1),ls){if(U.nodeName){const on=_e(U.nodeName);if(!$e[on]||as[on])throw vs("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof a)C=Kd("<!---->"),D=C.ownerDocument.importNode(U,!0),D.nodeType===bs.element&&D.nodeName==="BODY"||D.nodeName==="HTML"?C=D:C.appendChild(D);else{if(!Gr&&!jr&&!tr&&U.indexOf("<")===-1)return N&&ea?N.createHTML(U):U;if(C=Kd(U),!C)return Gr?null:ea?F:""}C&&oc&&Rt(C.firstChild);const ye=Jd(ls?U:C);for(;ce=ye.nextNode();)ep(ce),rp(ce),ce.content instanceof s&&qw(ce.content);if(ls)return U;if(Gr){if(Qo)for(Ne=oe.call(C.ownerDocument);C.firstChild;)Ne.appendChild(C.firstChild);else Ne=C;return(Pe.shadowroot||Pe.shadowrootmode)&&(Ne=Qn.call(r,Ne,!0)),Ne}let Ye=tr?C.outerHTML:C.innerHTML;return tr&&$e["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&He(vw,C.ownerDocument.doctype.name)&&(Ye="<!DOCTYPE "+C.ownerDocument.doctype.name+`>
343
+ `+Ye),jr&&wa([er,It,En],on=>{Ye=ms(Ye,on," ")}),N&&ea?N.createHTML(Ye):Ye},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};dc(U),sc=!0},t.clearConfig=function(){Xr=null,sc=!1},t.isValidAttribute=function(U,b,C){Xr||dc({});const D=_e(U),ce=_e(b);return tp(D,ce,C)},t.addHook=function(U,b){typeof b=="function"&&gs(Re[U],b)},t.removeHook=function(U,b){if(b!==void 0){const C=RO(Re[U],b);return C===-1?void 0:PO(Re[U],C,1)[0]}return Bg(Re[U])},t.removeHooks=function(U){Re[U]=[]},t.removeAllHooks=function(){Re=Kg()},t}var bw=yw();function xd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Br=xd();function ww(n){Br=n}var hr={exec:()=>null};function K(n,t=""){let e=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(je.caret,"$1"),e=e.replace(i,o),r},getRegex:()=>new RegExp(e,t)};return r}var YO=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),je={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)}}>`)},XO=/^(?:[ \t]*(?:\n|$))+/,KO=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,JO=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Yo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,QO=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ed=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Sw=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_w=K(Sw).replace(/bull/g,Ed).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(),eM=K(Sw).replace(/bull/g,Ed).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(),Ad=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,tM=/^[^\n]+/,$d=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,nM=K(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",$d).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),rM=K(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ed).getRegex(),tc="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",Td=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,iM=K("^ {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",Td).replace("tag",tc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),kw=K(Ad).replace("hr",Yo).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",tc).getRegex(),sM=K(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",kw).getRegex(),Id={blockquote:sM,code:KO,def:nM,fences:JO,heading:QO,hr:Yo,html:iM,lheading:_w,list:rM,newline:XO,paragraph:kw,table:hr,text:tM},Jg=K("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Yo).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",tc).getRegex(),oM={...Id,lheading:eM,table:Jg,paragraph:K(Ad).replace("hr",Yo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Jg).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",tc).getRegex()},aM={...Id,html:K(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Td).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:hr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:K(Ad).replace("hr",Yo).replace("heading",` *#{1,6} *[^
344
+ ]`).replace("lheading",_w).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},lM=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,cM=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,xw=/^( {2,}|\\)\n(?!\s*$)/,uM=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,os=/[\p{P}\p{S}]/u,nc=/[\s\p{P}\p{S}]/u,Cd=/[^\s\p{P}\p{S}]/u,hM=K(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,nc).getRegex(),Ew=/(?!~)[\p{P}\p{S}]/u,dM=/(?!~)[\s\p{P}\p{S}]/u,pM=/(?:[^\s\p{P}\p{S}]|~)/u,fM=K(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",YO?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Aw=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,gM=K(Aw,"u").replace(/punct/g,os).getRegex(),mM=K(Aw,"u").replace(/punct/g,Ew).getRegex(),$w="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",vM=K($w,"gu").replace(/notPunctSpace/g,Cd).replace(/punctSpace/g,nc).replace(/punct/g,os).getRegex(),yM=K($w,"gu").replace(/notPunctSpace/g,pM).replace(/punctSpace/g,dM).replace(/punct/g,Ew).getRegex(),bM=K("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Cd).replace(/punctSpace/g,nc).replace(/punct/g,os).getRegex(),wM=K(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,os).getRegex(),SM="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",_M=K(SM,"gu").replace(/notPunctSpace/g,Cd).replace(/punctSpace/g,nc).replace(/punct/g,os).getRegex(),kM=K(/\\(punct)/,"gu").replace(/punct/g,os).getRegex(),xM=K(/^<(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(),EM=K(Td).replace("(?:-->|$)","-->").getRegex(),AM=K("^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",EM).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),gl=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,$M=K(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",gl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Tw=K(/^!?\[(label)\]\[(ref)\]/).replace("label",gl).replace("ref",$d).getRegex(),Iw=K(/^!?\[(ref)\](?:\[\])?/).replace("ref",$d).getRegex(),TM=K("reflink|nolink(?!\\()","g").replace("reflink",Tw).replace("nolink",Iw).getRegex(),Qg=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Rd={_backpedal:hr,anyPunctuation:kM,autolink:xM,blockSkip:fM,br:xw,code:cM,del:hr,delLDelim:hr,delRDelim:hr,emStrongLDelim:gM,emStrongRDelimAst:vM,emStrongRDelimUnd:bM,escape:lM,link:$M,nolink:Iw,punctuation:hM,reflink:Tw,reflinkSearch:TM,tag:AM,text:uM,url:hr},IM={...Rd,link:K(/^!?\[(label)\]\((.*?)\)/).replace("label",gl).getRegex(),reflink:K(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",gl).getRegex()},wh={...Rd,emStrongRDelimAst:yM,emStrongLDelim:mM,delLDelim:wM,delRDelim:_M,url:K(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Qg).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:K(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Qg).getRegex()},CM={...wh,br:K(xw).replace("{2,}","*").getRegex(),text:K(wh.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},_a={normal:Id,gfm:oM,pedantic:aM},ws={normal:Rd,gfm:wh,breaks:CM,pedantic:IM},RM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},em=n=>RM[n];function zt(n,t){if(t){if(je.escapeTest.test(n))return n.replace(je.escapeReplace,em)}else if(je.escapeTestNoEncode.test(n))return n.replace(je.escapeReplaceNoEncode,em);return n}function tm(n){try{n=encodeURI(n).replace(je.percentDecode,"%")}catch{return null}return n}function nm(n,t){var s;let e=n.replace(je.findPipe,(o,a,c)=>{let u=!1,h=a;for(;--h>=0&&c[h]==="\\";)u=!u;return u?"|":" |"}),r=e.split(je.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(je.slashPipe,"|");return r}function Ss(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 PM(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 DM(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 rm(n,t,e,r,i){let s=t.href,o=t.title||null,a=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:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,c}function LM(n,t,e){let r=n.match(e.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
345
345
  `).map(s=>{let o=s.match(e.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(`
346
- `)}var pl=class{constructor(n){m(this,"options");m(this,"rules");m(this,"lexer");this.options=n||Br}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:ws(e,`
347
- `)}}}fences(n){let t=this.rules.block.fences.exec(n);if(t){let e=t[0],r=DM(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=ws(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:ws(t[0],`
348
- `)}}blockquote(n){let t=this.rules.block.blockquote.exec(n);if(t){let e=ws(t[0],`
346
+ `)}var ml=class{constructor(n){m(this,"options");m(this,"rules");m(this,"lexer");this.options=n||Br}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:Ss(e,`
347
+ `)}}}fences(n){let t=this.rules.block.fences.exec(n);if(t){let e=t[0],r=LM(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=Ss(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:Ss(t[0],`
348
+ `)}}blockquote(n){let t=this.rules.block.blockquote.exec(n);if(t){let e=Ss(t[0],`
349
349
  `).split(`
350
350
  `),r="",i="",s=[];for(;e.length>0;){let o=!1,a=[],c;for(c=0;c<e.length;c++)if(this.rules.other.blockquoteStart.test(e[c]))a.push(e[c]),o=!0;else if(!o)a.push(e[c]);else break;e=e.slice(c);let u=a.join(`
351
351
  `),h=u.replace(this.rules.other.blockquoteSetextReplace,`
@@ -356,16 +356,16 @@ ${h}`:h;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
356
356
  `),k=this.blockquote(_);s[s.length-1]=k,r=r.substring(0,r.length-g.raw.length)+k.raw,i=i.substring(0,i.length-g.text.length)+k.text;break}else if((v==null?void 0:v.type)==="list"){let g=v,_=g.raw+`
357
357
  `+e.join(`
358
358
  `),k=this.list(_);s[s.length-1]=k,r=r.substring(0,r.length-v.raw.length)+k.raw,i=i.substring(0,i.length-g.raw.length)+k.raw,e=_.substring(s.at(-1).raw.length).split(`
359
- `);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,o={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let a=this.rules.other.listItemRegex(i),c=!1;for(;n;){let h=!1,p="",v="";if(!(t=a.exec(n))||this.rules.block.hr.test(n))break;p=t[0],n=n.substring(p.length);let g=PM(t[2].split(`
359
+ `);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,o={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let a=this.rules.other.listItemRegex(i),c=!1;for(;n;){let h=!1,p="",v="";if(!(t=a.exec(n))||this.rules.block.hr.test(n))break;p=t[0],n=n.substring(p.length);let g=DM(t[2].split(`
360
360
  `,1)[0],t[1].length),_=n.split(`
361
- `,1)[0],k=!g.trim(),T=0;if(this.options.pedantic?(T=2,v=g.trimStart()):k?T=t[1].length+1:(T=g.search(this.rules.other.nonSpaceChar),T=T>4?1:T,v=g.slice(T),T+=t[1].length),k&&this.rules.other.blankLine.test(_)&&(p+=_+`
362
- `,n=n.substring(_.length+1),h=!0),!h){let P=this.rules.other.nextBulletRegex(T),R=this.rules.other.hrRegex(T),Z=this.rules.other.fencesBeginRegex(T),N=this.rules.other.headingBeginRegex(T),F=this.rules.other.htmlBeginRegex(T),Y=this.rules.other.blockquoteBeginRegex(T);for(;n;){let j=n.split(`
363
- `,1)[0],oe;if(_=j,this.options.pedantic?(_=_.replace(this.rules.other.listReplaceNesting," "),oe=_):oe=_.replace(this.rules.other.tabCharGlobal," "),Z.test(_)||N.test(_)||F.test(_)||Y.test(_)||P.test(_)||R.test(_))break;if(oe.search(this.rules.other.nonSpaceChar)>=T||!_.trim())v+=`
364
- `+oe.slice(T);else{if(k||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Z.test(g)||N.test(g)||R.test(g))break;v+=`
361
+ `,1)[0],k=!g.trim(),I=0;if(this.options.pedantic?(I=2,v=g.trimStart()):k?I=t[1].length+1:(I=g.search(this.rules.other.nonSpaceChar),I=I>4?1:I,v=g.slice(I),I+=t[1].length),k&&this.rules.other.blankLine.test(_)&&(p+=_+`
362
+ `,n=n.substring(_.length+1),h=!0),!h){let P=this.rules.other.nextBulletRegex(I),R=this.rules.other.hrRegex(I),Z=this.rules.other.fencesBeginRegex(I),N=this.rules.other.headingBeginRegex(I),F=this.rules.other.htmlBeginRegex(I),Y=this.rules.other.blockquoteBeginRegex(I);for(;n;){let j=n.split(`
363
+ `,1)[0],oe;if(_=j,this.options.pedantic?(_=_.replace(this.rules.other.listReplaceNesting," "),oe=_):oe=_.replace(this.rules.other.tabCharGlobal," "),Z.test(_)||N.test(_)||F.test(_)||Y.test(_)||P.test(_)||R.test(_))break;if(oe.search(this.rules.other.nonSpaceChar)>=I||!_.trim())v+=`
364
+ `+oe.slice(I);else{if(k||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Z.test(g)||N.test(g)||R.test(g))break;v+=`
365
365
  `+_}k=!_.trim(),p+=j+`
366
- `,n=n.substring(j.length+1),g=oe.slice(T)}}o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(c=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(v),loose:!1,text:v,tokens:[]}),o.raw+=p}let u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let h of o.items){if(this.lexer.state.top=!1,h.tokens=this.lexer.blockTokens(h.text,[]),h.task){if(h.text=h.text.replace(this.rules.other.listReplaceTask,""),((e=h.tokens[0])==null?void 0:e.type)==="text"||((r=h.tokens[0])==null?void 0:r.type)==="paragraph"){h.tokens[0].raw=h.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),h.tokens[0].text=h.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let v=this.lexer.inlineQueue.length-1;v>=0;v--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[v].src)){this.lexer.inlineQueue[v].src=this.lexer.inlineQueue[v].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(h.raw);if(p){let v={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};h.checked=v.checked,o.loose?h.tokens[0]&&["paragraph","text"].includes(h.tokens[0].type)&&"tokens"in h.tokens[0]&&h.tokens[0].tokens?(h.tokens[0].raw=v.raw+h.tokens[0].raw,h.tokens[0].text=v.raw+h.tokens[0].text,h.tokens[0].tokens.unshift(v)):h.tokens.unshift({type:"paragraph",raw:v.raw,text:v.raw,tokens:[v]}):h.tokens.unshift(v)}}if(!o.loose){let p=h.tokens.filter(g=>g.type==="space"),v=p.length>0&&p.some(g=>this.rules.other.anyLine.test(g.raw));o.loose=v}}if(o.loose)for(let h of o.items){h.loose=!0;for(let p of h.tokens)p.type==="text"&&(p.type="paragraph")}return o}}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 o;let t=this.rules.block.table.exec(n);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let e=Yg(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(o=t[3])!=null&&o.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
367
- `):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(e.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<e.length;a++)s.header.push({text:e[a],tokens:this.lexer.inline(e[a]),header:!0,align:s.align[a]});for(let a of i)s.rows.push(Yg(a,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)===`
368
- `?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=ws(e.slice(0,-1),"\\");if((e.length-s.length)%2===0)return}else{let s=RM(t[2],"()");if(s===-2)return;if(s>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,o).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)),Xg(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 Xg(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,o,a=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(o=[...s].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&i%3&&!((i+o)%3)){c+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);let h=[...r[0]][0].length,p=n.slice(0,i+r.index+h+o);if(Math.min(i,o)%2){let g=p.slice(1,-1);return{type:"em",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}let v=p.slice(2,-2);return{type:"strong",raw:p,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(n){let t=this.rules.inline.code.exec(n);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(e),i=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return r&&i&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(n){let t=this.rules.inline.br.exec(n);if(t)return{type:"br",raw:t[0]}}del(n,t,e=""){let r=this.rules.inline.delLDelim.exec(n);if(r&&(!r[1]||!e||this.rules.inline.punctuation.exec(e))){let i=[...r[0]].length-1,s,o,a=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||(o=[...s].length,o!==i))continue;if(r[3]||r[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let u=[...r[0]][0].length,h=n.slice(0,i+r.index+u+o),p=h.slice(i,-i);return{type:"del",raw:h,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}}}},$t=class dh{constructor(t){m(this,"tokens");m(this,"options");m(this,"state");m(this,"inlineQueue");m(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Br,this.options.tokenizer=this.options.tokenizer||new pl,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:je,block:Sa.normal,inline:bs.normal};this.options.pedantic?(e.block=Sa.pedantic,e.inline=bs.pedantic):this.options.gfm&&(e.block=Sa.gfm,this.options.breaks?e.inline=bs.breaks:e.inline=bs.gfm),this.tokenizer.rules=e}static get rules(){return{block:Sa,inline:bs}}static lex(t,e){return new dh(e).lex(t)}static lexInline(t,e){return new dh(e).inlineTokens(t)}lex(t){t=t.replace(je.carriageReturn,`
366
+ `,n=n.substring(j.length+1),g=oe.slice(I)}}o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(c=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(v),loose:!1,text:v,tokens:[]}),o.raw+=p}let u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let h of o.items){if(this.lexer.state.top=!1,h.tokens=this.lexer.blockTokens(h.text,[]),h.task){if(h.text=h.text.replace(this.rules.other.listReplaceTask,""),((e=h.tokens[0])==null?void 0:e.type)==="text"||((r=h.tokens[0])==null?void 0:r.type)==="paragraph"){h.tokens[0].raw=h.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),h.tokens[0].text=h.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let v=this.lexer.inlineQueue.length-1;v>=0;v--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[v].src)){this.lexer.inlineQueue[v].src=this.lexer.inlineQueue[v].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(h.raw);if(p){let v={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};h.checked=v.checked,o.loose?h.tokens[0]&&["paragraph","text"].includes(h.tokens[0].type)&&"tokens"in h.tokens[0]&&h.tokens[0].tokens?(h.tokens[0].raw=v.raw+h.tokens[0].raw,h.tokens[0].text=v.raw+h.tokens[0].text,h.tokens[0].tokens.unshift(v)):h.tokens.unshift({type:"paragraph",raw:v.raw,text:v.raw,tokens:[v]}):h.tokens.unshift(v)}}if(!o.loose){let p=h.tokens.filter(g=>g.type==="space"),v=p.length>0&&p.some(g=>this.rules.other.anyLine.test(g.raw));o.loose=v}}if(o.loose)for(let h of o.items){h.loose=!0;for(let p of h.tokens)p.type==="text"&&(p.type="paragraph")}return o}}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 o;let t=this.rules.block.table.exec(n);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let e=nm(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(o=t[3])!=null&&o.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
367
+ `):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(e.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<e.length;a++)s.header.push({text:e[a],tokens:this.lexer.inline(e[a]),header:!0,align:s.align[a]});for(let a of i)s.rows.push(nm(a,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)===`
368
+ `?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=Ss(e.slice(0,-1),"\\");if((e.length-s.length)%2===0)return}else{let s=PM(t[2],"()");if(s===-2)return;if(s>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,o).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)),rm(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 rm(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,o,a=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(o=[...s].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&i%3&&!((i+o)%3)){c+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);let h=[...r[0]][0].length,p=n.slice(0,i+r.index+h+o);if(Math.min(i,o)%2){let g=p.slice(1,-1);return{type:"em",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}let v=p.slice(2,-2);return{type:"strong",raw:p,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(n){let t=this.rules.inline.code.exec(n);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(e),i=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return r&&i&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(n){let t=this.rules.inline.br.exec(n);if(t)return{type:"br",raw:t[0]}}del(n,t,e=""){let r=this.rules.inline.delLDelim.exec(n);if(r&&(!r[1]||!e||this.rules.inline.punctuation.exec(e))){let i=[...r[0]].length-1,s,o,a=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||(o=[...s].length,o!==i))continue;if(r[3]||r[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let u=[...r[0]][0].length,h=n.slice(0,i+r.index+u+o),p=h.slice(i,-i);return{type:"del",raw:h,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}}}},$t=class Sh{constructor(t){m(this,"tokens");m(this,"options");m(this,"state");m(this,"inlineQueue");m(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Br,this.options.tokenizer=this.options.tokenizer||new ml,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:je,block:_a.normal,inline:ws.normal};this.options.pedantic?(e.block=_a.pedantic,e.inline=ws.pedantic):this.options.gfm&&(e.block=_a.gfm,this.options.breaks?e.inline=ws.breaks:e.inline=ws.gfm),this.tokenizer.rules=e}static get rules(){return{block:_a,inline:ws}}static lex(t,e){return new Sh(e).lex(t)}static lexInline(t,e){return new Sh(e).inlineTokens(t)}lex(t){t=t.replace(je.carriageReturn,`
369
369
  `),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,o;for(this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(je.tabCharGlobal," ").replace(je.spaceLine,""));t;){let a;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(u=>(a=u.call({lexer:this},t,e))?(t=t.substring(a.raw.length),e.push(a),!0):!1))continue;if(a=this.tokenizer.space(t)){t=t.substring(a.raw.length);let u=e.at(-1);a.raw.length===1&&u!==void 0?u.raw+=`
370
370
  `:e.push(a);continue}if(a=this.tokenizer.code(t)){t=t.substring(a.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(`
371
371
  `)?"":`
@@ -379,7 +379,7 @@ ${h}`:h;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
379
379
  `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):e.push(a),r=c.length!==t.length,t=t.substring(a.raw.length);continue}if(a=this.tokenizer.text(t)){t=t.substring(a.raw.length);let u=e.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
380
380
  `)?"":`
381
381
  `)+a.raw,u.text+=`
382
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):e.push(a);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,h,p,v;this.tokenizer.lexer=this;let r=t,i=null;if(this.tokens.links){let g=Object.keys(this.tokens.links);if(g.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)g.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)s=i[2]?i[2].length:0,r=r.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((u=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:u.call({lexer:this},r))??r;let o=!1,a="";for(;t;){o||(a=""),o=!1;let g;if((p=(h=this.options.extensions)==null?void 0:h.inline)!=null&&p.some(k=>(g=k.call({lexer:this},t,e))?(t=t.substring(g.raw.length),e.push(g),!0):!1))continue;if(g=this.tokenizer.escape(t)){t=t.substring(g.raw.length),e.push(g);continue}if(g=this.tokenizer.tag(t)){t=t.substring(g.raw.length),e.push(g);continue}if(g=this.tokenizer.link(t)){t=t.substring(g.raw.length),e.push(g);continue}if(g=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(g.raw.length);let k=e.at(-1);g.type==="text"&&(k==null?void 0:k.type)==="text"?(k.raw+=g.raw,k.text+=g.text):e.push(g);continue}if(g=this.tokenizer.emStrong(t,r,a)){t=t.substring(g.raw.length),e.push(g);continue}if(g=this.tokenizer.codespan(t)){t=t.substring(g.raw.length),e.push(g);continue}if(g=this.tokenizer.br(t)){t=t.substring(g.raw.length),e.push(g);continue}if(g=this.tokenizer.del(t,r,a)){t=t.substring(g.raw.length),e.push(g);continue}if(g=this.tokenizer.autolink(t)){t=t.substring(g.raw.length),e.push(g);continue}if(!this.state.inLink&&(g=this.tokenizer.url(t))){t=t.substring(g.raw.length),e.push(g);continue}let _=t;if((v=this.options.extensions)!=null&&v.startInline){let k=1/0,T=t.slice(1),P;this.options.extensions.startInline.forEach(R=>{P=R.call({lexer:this},T),typeof P=="number"&&P>=0&&(k=Math.min(k,P))}),k<1/0&&k>=0&&(_=t.substring(0,k+1))}if(g=this.tokenizer.inlineText(_)){t=t.substring(g.raw.length),g.raw.slice(-1)!=="_"&&(a=g.raw.slice(-1)),o=!0;let k=e.at(-1);(k==null?void 0:k.type)==="text"?(k.raw+=g.raw,k.text+=g.text):e.push(g);continue}if(t){let k="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(k);break}else throw new Error(k)}}return e}},fl=class{constructor(n){m(this,"options");m(this,"parser");this.options=n||Br}space(n){return""}code({text:n,lang:t,escaped:e}){var s;let r=(s=(t||"").match(je.notSpaceStart))==null?void 0:s[0],i=n.replace(je.endingNewline,"")+`
382
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):e.push(a);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,h,p,v;this.tokenizer.lexer=this;let r=t,i=null;if(this.tokens.links){let g=Object.keys(this.tokens.links);if(g.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)g.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)s=i[2]?i[2].length:0,r=r.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((u=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:u.call({lexer:this},r))??r;let o=!1,a="";for(;t;){o||(a=""),o=!1;let g;if((p=(h=this.options.extensions)==null?void 0:h.inline)!=null&&p.some(k=>(g=k.call({lexer:this},t,e))?(t=t.substring(g.raw.length),e.push(g),!0):!1))continue;if(g=this.tokenizer.escape(t)){t=t.substring(g.raw.length),e.push(g);continue}if(g=this.tokenizer.tag(t)){t=t.substring(g.raw.length),e.push(g);continue}if(g=this.tokenizer.link(t)){t=t.substring(g.raw.length),e.push(g);continue}if(g=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(g.raw.length);let k=e.at(-1);g.type==="text"&&(k==null?void 0:k.type)==="text"?(k.raw+=g.raw,k.text+=g.text):e.push(g);continue}if(g=this.tokenizer.emStrong(t,r,a)){t=t.substring(g.raw.length),e.push(g);continue}if(g=this.tokenizer.codespan(t)){t=t.substring(g.raw.length),e.push(g);continue}if(g=this.tokenizer.br(t)){t=t.substring(g.raw.length),e.push(g);continue}if(g=this.tokenizer.del(t,r,a)){t=t.substring(g.raw.length),e.push(g);continue}if(g=this.tokenizer.autolink(t)){t=t.substring(g.raw.length),e.push(g);continue}if(!this.state.inLink&&(g=this.tokenizer.url(t))){t=t.substring(g.raw.length),e.push(g);continue}let _=t;if((v=this.options.extensions)!=null&&v.startInline){let k=1/0,I=t.slice(1),P;this.options.extensions.startInline.forEach(R=>{P=R.call({lexer:this},I),typeof P=="number"&&P>=0&&(k=Math.min(k,P))}),k<1/0&&k>=0&&(_=t.substring(0,k+1))}if(g=this.tokenizer.inlineText(_)){t=t.substring(g.raw.length),g.raw.slice(-1)!=="_"&&(a=g.raw.slice(-1)),o=!0;let k=e.at(-1);(k==null?void 0:k.type)==="text"?(k.raw+=g.raw,k.text+=g.text):e.push(g);continue}if(t){let k="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(k);break}else throw new Error(k)}}return e}},vl=class{constructor(n){m(this,"options");m(this,"parser");this.options=n||Br}space(n){return""}code({text:n,lang:t,escaped:e}){var s;let r=(s=(t||"").match(je.notSpaceStart))==null?void 0:s[0],i=n.replace(je.endingNewline,"")+`
383
383
  `;return r?'<pre><code class="language-'+zt(r)+'">'+(e?i:zt(i,!0))+`</code></pre>
384
384
  `:"<pre><code>"+(e?i:zt(i,!0))+`</code></pre>
385
385
  `}blockquote({tokens:n}){return`<blockquote>
@@ -397,8 +397,8 @@ ${this.parser.parse(n)}</blockquote>
397
397
  `}tablerow({text:n}){return`<tr>
398
398
  ${n}</tr>
399
399
  `}tablecell(n){let t=this.parser.parseInline(n.tokens),e=n.header?"th":"td";return(n.align?`<${e} align="${n.align}">`:`<${e}>`)+t+`</${e}>
400
- `}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>${zt(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=qg(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return t&&(s+=' title="'+zt(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=qg(n);if(i===null)return zt(e);n=i;let s=`<img src="${n}" alt="${zt(e)}"`;return t&&(s+=` title="${zt(t)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:zt(n.text)}},kd=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}},Tt=class ph{constructor(t){m(this,"options");m(this,"renderer");m(this,"textRenderer");this.options=t||Br,this.options.renderer=this.options.renderer||new fl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new kd}static parse(t,e){return new ph(e).parse(t)}static parseInline(t,e){return new ph(e).parseInline(t)}parse(t){var r,i;this.renderer.parser=this;let e="";for(let s=0;s<t.length;s++){let o=t[s];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){let c=o,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){e+=u||"";continue}}let a=o;switch(a.type){case"space":{e+=this.renderer.space(a);break}case"hr":{e+=this.renderer.hr(a);break}case"heading":{e+=this.renderer.heading(a);break}case"code":{e+=this.renderer.code(a);break}case"table":{e+=this.renderer.table(a);break}case"blockquote":{e+=this.renderer.blockquote(a);break}case"list":{e+=this.renderer.list(a);break}case"checkbox":{e+=this.renderer.checkbox(a);break}case"html":{e+=this.renderer.html(a);break}case"def":{e+=this.renderer.def(a);break}case"paragraph":{e+=this.renderer.paragraph(a);break}case"text":{e+=this.renderer.text(a);break}default:{let c='Token with "'+a.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 o=0;o<t.length;o++){let a=t[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){let u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=u||"";continue}}let c=a;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}},_a,Is=(_a=class{constructor(n){m(this,"options");m(this,"block");this.options=n||Br}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?$t.lex:$t.lexInline}provideParser(){return this.block?Tt.parse:Tt.parseInline}},m(_a,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),m(_a,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),_a),LM=class{constructor(...n){m(this,"defaults",gd());m(this,"options",this.setOptions);m(this,"parse",this.parseMarkdown(!0));m(this,"parseInline",this.parseMarkdown(!1));m(this,"Parser",Tt);m(this,"Renderer",fl);m(this,"TextRenderer",kd);m(this,"Lexer",$t);m(this,"Tokenizer",pl);m(this,"Hooks",Is);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 o=s;for(let a of o.header)e=e.concat(this.walkTokens(a.tokens,t));for(let a of o.rows)for(let c of a)e=e.concat(this.walkTokens(c.tokens,t));break}case"list":{let o=s;e=e.concat(this.walkTokens(o.items,t));break}default:{let o=s;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{let c=o[a].flat(1/0);e=e.concat(this.walkTokens(c,t))}):o.tokens&&(e=e.concat(this.walkTokens(o.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(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}: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 fl(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 o=s,a=e.renderer[o],c=i[o];i[o]=(...u)=>{let h=a.apply(i,u);return h===!1&&(h=c.apply(i,u)),h||""}}r.renderer=i}if(e.tokenizer){let i=this.defaults.tokenizer||new pl(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 o=s,a=e.tokenizer[o],c=i[o];i[o]=(...u)=>{let h=a.apply(i,u);return h===!1&&(h=c.apply(i,u)),h}}r.tokenizer=i}if(e.hooks){let i=this.defaults.hooks||new Is;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 o=s,a=e.hooks[o],c=i[o];Is.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&Is.passThroughHooksRespectAsync.has(s))return(async()=>{let p=await a.call(i,u);return c.call(i,p)})();let h=a.call(i,u);return c.call(i,h)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(i,u);return p===!1&&(p=await c.apply(i,u)),p})();let h=a.apply(i,u);return h===!1&&(h=c.apply(i,u)),h}}r.hooks=i}if(e.walkTokens){let i=this.defaults.walkTokens,s=e.walkTokens;r.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,t){return $t.lex(n,t??this.defaults)}parser(n,t){return Tt.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 o=i.hooks?await i.hooks.preprocess(t):t,a=await(i.hooks?await i.hooks.provideLexer():n?$t.lex:$t.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():n?Tt.parse:Tt.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let o=(i.hooks?i.hooks.provideLexer():n?$t.lex:$t.lexInline)(t,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser():n?Tt.parse:Tt.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return s(o)}}}onError(n,t){return e=>{if(e.message+=`
401
- Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+zt(e.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(e);throw e}}},Fr=new LM;function ee(n,t){return Fr.parse(n,t)}ee.options=ee.setOptions=function(n){return Fr.setOptions(n),ee.defaults=Fr.defaults,yw(ee.defaults),ee};ee.getDefaults=gd;ee.defaults=Br;ee.use=function(...n){return Fr.use(...n),ee.defaults=Fr.defaults,yw(ee.defaults),ee};ee.walkTokens=function(n,t){return Fr.walkTokens(n,t)};ee.parseInline=Fr.parseInline;ee.Parser=Tt;ee.parser=Tt.parse;ee.Renderer=fl;ee.TextRenderer=kd;ee.Lexer=$t;ee.lexer=$t.lex;ee.Tokenizer=pl;ee.Hooks=Is;ee.parse=ee;ee.options;ee.setOptions;ee.use;ee.walkTokens;ee.parseInline;Tt.parse;$t.lex;vw.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function zM(n){const t=ee.parse(n,{async:!1});return vw.sanitize(t,{USE_PROFILES:{html:!0}})}var Io,mn,Gt,qt,Hn,Tw,Ga;class fh extends Gi{constructor(){super(...arguments);w(this,Hn);m(this,"phase","thinking");m(this,"toolCalls",[]);m(this,"expanded",!1);m(this,"expandedTexts",new Set);w(this,Io,`agent-activity-panel-${++NM}`);m(this,"overflowingTexts",new Set);w(this,mn,null);w(this,Gt,null);w(this,qt,null);m(this,"handleToggle",()=>{this.toolCalls.length!==0&&(this.expanded=!this.expanded)})}changed(e){Ce(this.template(),this),f(this,Hn,Tw).call(this),l(this,Gt)!==null&&cancelAnimationFrame(l(this,Gt)),S(this,Gt,requestAnimationFrame(()=>{S(this,Gt,null),f(this,Hn,Ga).call(this)})),e.has("expanded")&&(l(this,qt)!==null&&clearTimeout(l(this,qt)),S(this,qt,window.setTimeout(()=>{S(this,qt,null),f(this,Hn,Ga).call(this)},MM)))}disconnected(){var e;(e=l(this,mn))==null||e.disconnect(),S(this,mn,null),l(this,Gt)!==null&&(cancelAnimationFrame(l(this,Gt)),S(this,Gt,null)),l(this,qt)!==null&&(clearTimeout(l(this,qt)),S(this,qt,null))}template(){const e=this.toolCalls.length>0;return z`
400
+ `}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>${zt(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=tm(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return t&&(s+=' title="'+zt(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=tm(n);if(i===null)return zt(e);n=i;let s=`<img src="${n}" alt="${zt(e)}"`;return t&&(s+=` title="${zt(t)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:zt(n.text)}},Pd=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}},Tt=class _h{constructor(t){m(this,"options");m(this,"renderer");m(this,"textRenderer");this.options=t||Br,this.options.renderer=this.options.renderer||new vl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Pd}static parse(t,e){return new _h(e).parse(t)}static parseInline(t,e){return new _h(e).parseInline(t)}parse(t){var r,i;this.renderer.parser=this;let e="";for(let s=0;s<t.length;s++){let o=t[s];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){let c=o,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){e+=u||"";continue}}let a=o;switch(a.type){case"space":{e+=this.renderer.space(a);break}case"hr":{e+=this.renderer.hr(a);break}case"heading":{e+=this.renderer.heading(a);break}case"code":{e+=this.renderer.code(a);break}case"table":{e+=this.renderer.table(a);break}case"blockquote":{e+=this.renderer.blockquote(a);break}case"list":{e+=this.renderer.list(a);break}case"checkbox":{e+=this.renderer.checkbox(a);break}case"html":{e+=this.renderer.html(a);break}case"def":{e+=this.renderer.def(a);break}case"paragraph":{e+=this.renderer.paragraph(a);break}case"text":{e+=this.renderer.text(a);break}default:{let c='Token with "'+a.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 o=0;o<t.length;o++){let a=t[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){let u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=u||"";continue}}let c=a;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}},ka,Cs=(ka=class{constructor(n){m(this,"options");m(this,"block");this.options=n||Br}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?$t.lex:$t.lexInline}provideParser(){return this.block?Tt.parse:Tt.parseInline}},m(ka,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),m(ka,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),ka),zM=class{constructor(...n){m(this,"defaults",xd());m(this,"options",this.setOptions);m(this,"parse",this.parseMarkdown(!0));m(this,"parseInline",this.parseMarkdown(!1));m(this,"Parser",Tt);m(this,"Renderer",vl);m(this,"TextRenderer",Pd);m(this,"Lexer",$t);m(this,"Tokenizer",ml);m(this,"Hooks",Cs);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 o=s;for(let a of o.header)e=e.concat(this.walkTokens(a.tokens,t));for(let a of o.rows)for(let c of a)e=e.concat(this.walkTokens(c.tokens,t));break}case"list":{let o=s;e=e.concat(this.walkTokens(o.items,t));break}default:{let o=s;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{let c=o[a].flat(1/0);e=e.concat(this.walkTokens(c,t))}):o.tokens&&(e=e.concat(this.walkTokens(o.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(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}: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 vl(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 o=s,a=e.renderer[o],c=i[o];i[o]=(...u)=>{let h=a.apply(i,u);return h===!1&&(h=c.apply(i,u)),h||""}}r.renderer=i}if(e.tokenizer){let i=this.defaults.tokenizer||new ml(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 o=s,a=e.tokenizer[o],c=i[o];i[o]=(...u)=>{let h=a.apply(i,u);return h===!1&&(h=c.apply(i,u)),h}}r.tokenizer=i}if(e.hooks){let i=this.defaults.hooks||new Cs;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 o=s,a=e.hooks[o],c=i[o];Cs.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&Cs.passThroughHooksRespectAsync.has(s))return(async()=>{let p=await a.call(i,u);return c.call(i,p)})();let h=a.call(i,u);return c.call(i,h)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(i,u);return p===!1&&(p=await c.apply(i,u)),p})();let h=a.apply(i,u);return h===!1&&(h=c.apply(i,u)),h}}r.hooks=i}if(e.walkTokens){let i=this.defaults.walkTokens,s=e.walkTokens;r.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,t){return $t.lex(n,t??this.defaults)}parser(n,t){return Tt.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 o=i.hooks?await i.hooks.preprocess(t):t,a=await(i.hooks?await i.hooks.provideLexer():n?$t.lex:$t.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():n?Tt.parse:Tt.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let o=(i.hooks?i.hooks.provideLexer():n?$t.lex:$t.lexInline)(t,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser():n?Tt.parse:Tt.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return s(o)}}}onError(n,t){return e=>{if(e.message+=`
401
+ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+zt(e.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(e);throw e}}},Fr=new zM;function ee(n,t){return Fr.parse(n,t)}ee.options=ee.setOptions=function(n){return Fr.setOptions(n),ee.defaults=Fr.defaults,ww(ee.defaults),ee};ee.getDefaults=xd;ee.defaults=Br;ee.use=function(...n){return Fr.use(...n),ee.defaults=Fr.defaults,ww(ee.defaults),ee};ee.walkTokens=function(n,t){return Fr.walkTokens(n,t)};ee.parseInline=Fr.parseInline;ee.Parser=Tt;ee.parser=Tt.parse;ee.Renderer=vl;ee.TextRenderer=Pd;ee.Lexer=$t;ee.lexer=$t.lex;ee.Tokenizer=ml;ee.Hooks=Cs;ee.parse=ee;ee.options;ee.setOptions;ee.use;ee.walkTokens;ee.parseInline;Tt.parse;$t.lex;bw.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function OM(n){const t=ee.parse(n,{async:!1});return bw.sanitize(t,{USE_PROFILES:{html:!0}})}var Co,bn,Xt,Kt,Zn,Cw,Xa;class kh extends qi{constructor(){super(...arguments);w(this,Zn);m(this,"phase","thinking");m(this,"toolCalls",[]);m(this,"expanded",!1);m(this,"expandedTexts",new Set);w(this,Co,`agent-activity-panel-${++UM}`);m(this,"overflowingTexts",new Set);w(this,bn,null);w(this,Xt,null);w(this,Kt,null);m(this,"handleToggle",()=>{this.toolCalls.length!==0&&(this.expanded=!this.expanded)})}changed(e){Ce(this.template(),this),f(this,Zn,Cw).call(this),l(this,Xt)!==null&&cancelAnimationFrame(l(this,Xt)),S(this,Xt,requestAnimationFrame(()=>{S(this,Xt,null),f(this,Zn,Xa).call(this)})),e.has("expanded")&&(l(this,Kt)!==null&&clearTimeout(l(this,Kt)),S(this,Kt,window.setTimeout(()=>{S(this,Kt,null),f(this,Zn,Xa).call(this)},NM)))}disconnected(){var e;(e=l(this,bn))==null||e.disconnect(),S(this,bn,null),l(this,Xt)!==null&&(cancelAnimationFrame(l(this,Xt)),S(this,Xt,null)),l(this,Kt)!==null&&(clearTimeout(l(this,Kt)),S(this,Kt,null))}template(){const e=this.toolCalls.length>0;return z`
402
402
  ${this.barTemplate()}
403
403
  ${e?this.panelTemplate():null}
404
404
  `}barTemplate(){return this.phase==="thinking"?z`<div class="bar bar-static" unselectable>${this.indicator()}${this.label({expanded:this.expanded})}</div>`:z`
@@ -408,7 +408,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
408
408
  class="bar"
409
409
  unselectable
410
410
  aria-expanded=${this.expanded?"true":"false"}
411
- aria-controls=${l(this,Io)}
411
+ aria-controls=${l(this,Co)}
412
412
  @click=${this.handleToggle}
413
413
  >
414
414
  ${this.indicator()}${this.label({expanded:this.expanded})}
@@ -416,7 +416,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
416
416
  `}panelTemplate(){return z`
417
417
  <div
418
418
  class="panel"
419
- id=${l(this,Io)}
419
+ id=${l(this,Co)}
420
420
  role="region"
421
421
  ?inert=${!this.expanded}
422
422
  aria-hidden=${this.expanded?"false":"true"}
@@ -433,7 +433,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
433
433
  class="tool-dot"
434
434
  data-status=${e.status}
435
435
  role="img"
436
- aria-label=${UM(e.status)}
436
+ aria-label=${FM(e.status)}
437
437
  ></span>
438
438
  <span class="tool-title">${e.title}</span>
439
439
  ${e.text?z`
@@ -450,21 +450,21 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
450
450
  @click=${()=>this.toggleTextExpand(e.toolCallId)}
451
451
  >
452
452
  <span>${s}</span>
453
- ${r?Z2({size:16}):ul({size:16})}
453
+ ${r?W2({size:16}):pl({size:16})}
454
454
  </button>`:null}
455
455
  </div>
456
456
  `:null}
457
457
  </li>
458
- `}toggleTextExpand(e){const r=new Set(this.expandedTexts);r.has(e)?r.delete(e):r.add(e),this.expandedTexts=r}indicator(){if(this.expanded)return z`<span class="indicator">${ul({size:16})}</span>`;const e=this.phase==="thinking"||this.phase==="using";return z`<span class=${e?"indicator indicator-active":"indicator"}
459
- >${e?wb({size:16}):j2({size:16})}</span>`}label(e){var s;if(this.phase==="thinking")return"Thinking…";const r=this.toolCalls.length;if(this.phase==="using"){if(e.expanded)return`Using ${r} ${r===1?"tool":"tools"}…`;const o=[...this.toolCalls].reverse().find(c=>c.status==="in_progress"),a=(o==null?void 0:o.toolKind)??((s=this.toolCalls.at(-1))==null?void 0:s.toolKind)??"other";return OM(a)}return`${e.expanded?"Showing":"Used"} ${r} ${r===1?"tool":"tools"}`}}Io=new WeakMap,mn=new WeakMap,Gt=new WeakMap,qt=new WeakMap,Hn=new WeakSet,Tw=function(){if(!(typeof ResizeObserver>"u")){l(this,mn)||S(this,mn,new ResizeObserver(()=>f(this,Hn,Ga).call(this))),l(this,mn).disconnect();for(const e of this.querySelectorAll(".tool-text"))l(this,mn).observe(e)}},Ga=function(){const e=new Set;for(const r of this.querySelectorAll(".tool-text")){const i=r.dataset.toolCallId;if(i){if(this.expandedTexts.has(i)){e.add(i);continue}r.scrollHeight>r.clientHeight+1&&e.add(i)}}FM(this.overflowingTexts,e)||(this.overflowingTexts=e)},m(fh,"properties",["phase","toolCalls","expanded","expandedTexts","overflowingTexts"]),m(fh,"attributes",{expanded:{type:Boolean}});function OM(n){switch(n){case"read":return"Reading files…";case"edit":return"Editing files…";case"delete":return"Deleting files…";case"move":return"Moving files…";case"search":return"Searching files…";case"execute":return"Running commands…";case"think":return"Thinking…";case"fetch":return"Fetching content…";case"switch_mode":return"Switching modes…";default:return"Working…"}}const MM=160;let NM=0;function UM(n){switch(n){case"completed":return"Completed";case"failed":return"Failed";case"in_progress":return"In progress";default:return"Pending"}}function FM(n,t){if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0}customElements.define("agent-activity",fh);function HM(n){const t=[];let e=0;for(;e<n.length;)if(n[e].kind==="tool_call"){const i=[];for(;e<n.length&&n[e].kind==="tool_call";)i.push(n[e]),e+=1;const s=e>=n.length;t.push({kind:"tool-run",toolCalls:i,live:s})}else t.push({kind:"message",message:n[e]}),e+=1;const r=n[n.length-1];return r&&r.kind==="user"&&t.push({kind:"thinking"}),t}const Kg=8,Jg=new WeakMap;function ZM(n){const t=Jg.get(n);if(t&&t.text===n.text)return t.html;const e=zM(n.text);return Jg.set(n,{text:n.text,html:e}),e}function Qg(n){for(let t=n.length-1;t>=0;t-=1){const e=n[t];if(e&&e.kind==="user")return e.id}return null}var ut,ht,Pr,Dr,Un,vt,Cw,gh,Rw,$l,Tl,mh;class Iw extends Gi{constructor(){super(...arguments);w(this,vt);m(this,"messages",[]);w(this,ut,!0);w(this,ht,null);w(this,Pr,null);w(this,Dr,null);w(this,Un,!1);w(this,$l,()=>{if(l(this,Un))return;const e=l(this,ht);if(!e)return;const i=e.scrollHeight-e.clientHeight-e.scrollTop<=Kg;i!==l(this,ut)&&(S(this,ut,i),this.toggleAttribute("data-pinned",i))});w(this,Tl,()=>{S(this,ut,!0),this.toggleAttribute("data-pinned",!0),f(this,vt,mh).call(this,!0)})}changed(e){let r=!1;if(e.has("messages")){const i=e.get("messages")??[],s=Qg(this.messages);r=s!==null&&s!==Qg(i),r&&S(this,ut,!0)}Ce(this.template(),this),l(this,ht)||(S(this,ht,this.querySelector(".history-scroll")),l(this,ht)&&f(this,vt,Cw).call(this)),this.toggleAttribute("data-pinned",l(this,ut)),f(this,vt,gh).call(this),f(this,vt,mh).call(this,r)}disconnected(){var e,r;(e=l(this,Pr))==null||e.disconnect(),S(this,Pr,null),(r=l(this,Dr))==null||r.disconnect(),S(this,Dr,null)}template(){const e=HM(this.messages);return z`
460
- <div class="history-scroll" @scroll=${l(this,$l)}>
458
+ `}toggleTextExpand(e){const r=new Set(this.expandedTexts);r.has(e)?r.delete(e):r.add(e),this.expandedTexts=r}indicator(){if(this.expanded)return z`<span class="indicator">${pl({size:16})}</span>`;const e=this.phase==="thinking"||this.phase==="using";return z`<span class=${e?"indicator indicator-active":"indicator"}
459
+ >${e?_b({size:16}):G2({size:16})}</span>`}label(e){var s;if(this.phase==="thinking")return"Thinking…";const r=this.toolCalls.length;if(this.phase==="using"){if(e.expanded)return`Using ${r} ${r===1?"tool":"tools"}…`;const o=[...this.toolCalls].reverse().find(c=>c.status==="in_progress"),a=(o==null?void 0:o.toolKind)??((s=this.toolCalls.at(-1))==null?void 0:s.toolKind)??"other";return MM(a)}return`${e.expanded?"Showing":"Used"} ${r} ${r===1?"tool":"tools"}`}}Co=new WeakMap,bn=new WeakMap,Xt=new WeakMap,Kt=new WeakMap,Zn=new WeakSet,Cw=function(){if(!(typeof ResizeObserver>"u")){l(this,bn)||S(this,bn,new ResizeObserver(()=>f(this,Zn,Xa).call(this))),l(this,bn).disconnect();for(const e of this.querySelectorAll(".tool-text"))l(this,bn).observe(e)}},Xa=function(){const e=new Set;for(const r of this.querySelectorAll(".tool-text")){const i=r.dataset.toolCallId;if(i){if(this.expandedTexts.has(i)){e.add(i);continue}r.scrollHeight>r.clientHeight+1&&e.add(i)}}HM(this.overflowingTexts,e)||(this.overflowingTexts=e)},m(kh,"properties",["phase","toolCalls","expanded","expandedTexts","overflowingTexts"]),m(kh,"attributes",{expanded:{type:Boolean}});function MM(n){switch(n){case"read":return"Reading files…";case"edit":return"Editing files…";case"delete":return"Deleting files…";case"move":return"Moving files…";case"search":return"Searching files…";case"execute":return"Running commands…";case"think":return"Thinking…";case"fetch":return"Fetching content…";case"switch_mode":return"Switching modes…";default:return"Working…"}}const NM=160;let UM=0;function FM(n){switch(n){case"completed":return"Completed";case"failed":return"Failed";case"in_progress":return"In progress";default:return"Pending"}}function HM(n,t){if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0}customElements.define("agent-activity",kh);function ZM(n){const t=[];let e=0;for(;e<n.length;)if(n[e].kind==="tool_call"){const i=[];for(;e<n.length&&n[e].kind==="tool_call";)i.push(n[e]),e+=1;const s=e>=n.length;t.push({kind:"tool-run",toolCalls:i,live:s})}else t.push({kind:"message",message:n[e]}),e+=1;const r=n[n.length-1];return r&&r.kind==="user"&&t.push({kind:"thinking"}),t}const im=8,sm=new WeakMap;function WM(n){const t=sm.get(n);if(t&&t.text===n.text)return t.html;const e=OM(n.text);return sm.set(n,{text:n.text,html:e}),e}function om(n){for(let t=n.length-1;t>=0;t-=1){const e=n[t];if(e&&e.kind==="user")return e.id}return null}var ut,ht,Pr,Dr,Fn,vt,Pw,xh,Dw,Cl,Rl,Eh;class Rw extends qi{constructor(){super(...arguments);w(this,vt);m(this,"messages",[]);w(this,ut,!0);w(this,ht,null);w(this,Pr,null);w(this,Dr,null);w(this,Fn,!1);w(this,Cl,()=>{if(l(this,Fn))return;const e=l(this,ht);if(!e)return;const i=e.scrollHeight-e.clientHeight-e.scrollTop<=im;i!==l(this,ut)&&(S(this,ut,i),this.toggleAttribute("data-pinned",i))});w(this,Rl,()=>{S(this,ut,!0),this.toggleAttribute("data-pinned",!0),f(this,vt,Eh).call(this,!0)})}changed(e){let r=!1;if(e.has("messages")){const i=e.get("messages")??[],s=om(this.messages);r=s!==null&&s!==om(i),r&&S(this,ut,!0)}Ce(this.template(),this),l(this,ht)||(S(this,ht,this.querySelector(".history-scroll")),l(this,ht)&&f(this,vt,Pw).call(this)),this.toggleAttribute("data-pinned",l(this,ut)),f(this,vt,xh).call(this),f(this,vt,Eh).call(this,r)}disconnected(){var e,r;(e=l(this,Pr))==null||e.disconnect(),S(this,Pr,null),(r=l(this,Dr))==null||r.disconnect(),S(this,Dr,null)}template(){const e=ZM(this.messages);return z`
460
+ <div class="history-scroll" @scroll=${l(this,Cl)}>
461
461
  ${e.map(r=>{if(r.kind==="tool-run")return z`<agent-activity
462
462
  .phase=${r.live?"using":"final"}
463
463
  .toolCalls=${r.toolCalls}
464
464
  ></agent-activity>`;if(r.kind==="thinking")return z`<agent-activity
465
465
  .phase=${"thinking"}
466
466
  .toolCalls=${[]}
467
- ></agent-activity>`;const i=r.message,s=i.kind==="assistant"?$2(ZM(i)):i.text;return z`<div
467
+ ></agent-activity>`;const i=r.message,s=i.kind==="assistant"?T2(WM(i)):i.text;return z`<div
468
468
  class="message message-${i.kind}"
469
469
  data-message-id=${i.id}
470
470
  >${s}</div>`})}
@@ -473,11 +473,11 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
473
473
  type="button"
474
474
  class="history-jump"
475
475
  aria-label="Jump to latest message"
476
- @click=${l(this,Tl)}
476
+ @click=${l(this,Rl)}
477
477
  >
478
- ${ul({size:16})}
478
+ ${pl({size:16})}
479
479
  </button>
480
- `}}ut=new WeakMap,ht=new WeakMap,Pr=new WeakMap,Dr=new WeakMap,Un=new WeakMap,vt=new WeakSet,Cw=function(){l(this,ht)&&(typeof ResizeObserver>"u"||(S(this,Pr,new ResizeObserver(()=>f(this,vt,Rw).call(this))),S(this,Dr,new MutationObserver(()=>f(this,vt,gh).call(this))),l(this,Dr).observe(l(this,ht),{childList:!0})))},gh=function(){const e=l(this,ht),r=l(this,Pr);if(!(!e||!r)){r.disconnect();for(const i of Array.from(e.children))r.observe(i)}},Rw=function(){const e=l(this,ht);if(!e)return;if(l(this,ut)){S(this,Un,!0),e.scrollTop=e.scrollHeight-e.clientHeight,requestAnimationFrame(()=>{S(this,Un,!1)});return}const i=e.scrollHeight-e.clientHeight-e.scrollTop<=Kg;i!==l(this,ut)&&(S(this,ut,i),this.toggleAttribute("data-pinned",i))},$l=new WeakMap,Tl=new WeakMap,mh=function(e){requestAnimationFrame(()=>{const r=l(this,ht);r&&(!l(this,ut)&&!e||(S(this,Un,!0),r.scrollTop=r.scrollHeight-r.clientHeight,requestAnimationFrame(()=>{S(this,Un,!1)})))})},m(Iw,"properties",["messages"]);customElements.define("message-history",Iw);var Et,Co,Ni,Yt,Ui,Fi,Ro,Hi,Il,Cl,Rl,dt,qa,Po,yh,bh,Do,Lo;class vh extends Gi{constructor(){super(...arguments);w(this,dt);m(this,"placeholder","What do you want to do?");m(this,"open",!1);m(this,"messages",[]);m(this,"status","disconnected");w(this,Et,Kt.resolve("ServerManager"));w(this,Co,Kt.resolve("ShortcutService"));w(this,Ni,null);w(this,Yt,null);w(this,Ui,()=>{var e;this.status=((e=l(this,Yt))==null?void 0:e.status)??"disconnected"});w(this,Fi,()=>{var e;this.messages=((e=l(this,Yt))==null?void 0:e.messages)??[]});w(this,Ro,()=>{var e,r;(e=l(this,Yt))==null||e.removeEventListener("status-changed",l(this,Ui)),(r=l(this,Yt))==null||r.removeEventListener("messages-changed",l(this,Fi)),S(this,Yt,null)});w(this,Hi,()=>{var r;const e=((r=l(this,Et).activeServer)==null?void 0:r.acpClient)??null;e!==l(this,Yt)&&(l(this,Ro).call(this),S(this,Yt,e),e==null||e.addEventListener("status-changed",l(this,Ui)),e==null||e.addEventListener("messages-changed",l(this,Fi)),l(this,Ui).call(this),l(this,Fi).call(this),e!=null&&e.enabled&&e.status==="disconnected"&&e.connect().catch(i=>{console.error("ACPClient.connect() failed",i)}))});m(this,"handleTriggerActivate",()=>{var r;const e=(r=l(this,Et).activeServer)==null?void 0:r.acpClient;e&&!e.enabled||(this.open=!0)});m(this,"handleKeydown",e=>{var o;if(e.key!=="Enter"||e.shiftKey)return;const r=e.currentTarget,i=r.value.trim();if(e.preventDefault(),!i)return;r.value="",f(this,dt,qa).call(this,r);const s=(o=l(this,Et).activeServer)==null?void 0:o.acpClient;s!=null&&s.enabled&&s.sendMessage({text:i}).catch(a=>{console.error("ACPClient.sendMessage() failed",a)})});w(this,Il,e=>{f(this,dt,qa).call(this,e.currentTarget)});w(this,Cl,e=>{var i;e.stopPropagation();const r=(i=l(this,Et).activeServer)==null?void 0:i.acpClient;r&&r.cancel().catch(s=>{console.error("ACPClient.cancel() failed",s)})});w(this,Rl,e=>{if(e.target instanceof HTMLTextAreaElement)return;const r=e.currentTarget.querySelector("textarea");r==null||r.focus()});w(this,Po,e=>{var s;if(e.shortcut!=="focusCommandInput")return;const r=(s=l(this,Et).activeServer)==null?void 0:s.acpClient;if(r&&!r.enabled)return;if(!this.open){this.open=!0;return}const i=this.querySelector("textarea");if(i){if(document.activeElement===i){this.open=!1;return}i.focus()}});w(this,Do,e=>{e.target instanceof Node&&(this.contains(e.target)||(this.open=!1))});w(this,Lo,e=>{e.key==="Escape"&&(this.open=!1)})}connected(){const e=new DisposableStack;S(this,Ni,e),l(this,Et).addEventListener("change",l(this,Hi)),e.defer(()=>{l(this,Et).removeEventListener("change",l(this,Hi)),l(this,Ro).call(this)}),l(this,Hi).call(this),l(this,Co).addEventListener("shortcut-triggered",l(this,Po)),e.defer(()=>l(this,Co).removeEventListener("shortcut-triggered",l(this,Po))),this.open&&f(this,dt,yh).call(this)}disconnected(){var e;(e=l(this,Ni))==null||e.dispose(),S(this,Ni,null),f(this,dt,bh).call(this)}changed(e){if(this.open&&this.status!=="disconnected"?(this.removeAttribute("material"),this.removeAttribute("tone"),this.removeAttribute("level")):(this.setAttribute("material","paper"),this.setAttribute("tone","dark"),this.setAttribute("level","overlay")),Ce(this.template(),this),e.has("open"))if(this.open){f(this,dt,yh).call(this);const r=this.querySelector("textarea");r&&(f(this,dt,qa).call(this,r),r.focus())}else f(this,dt,bh).call(this)}template(){var i;const e=(i=l(this,Et).activeServer)==null?void 0:i.acpClient;if(e&&!e.enabled||this.status==="disposed")return null;if(this.status==="disconnected")return z`
480
+ `}}ut=new WeakMap,ht=new WeakMap,Pr=new WeakMap,Dr=new WeakMap,Fn=new WeakMap,vt=new WeakSet,Pw=function(){l(this,ht)&&(typeof ResizeObserver>"u"||(S(this,Pr,new ResizeObserver(()=>f(this,vt,Dw).call(this))),S(this,Dr,new MutationObserver(()=>f(this,vt,xh).call(this))),l(this,Dr).observe(l(this,ht),{childList:!0})))},xh=function(){const e=l(this,ht),r=l(this,Pr);if(!(!e||!r)){r.disconnect();for(const i of Array.from(e.children))r.observe(i)}},Dw=function(){const e=l(this,ht);if(!e)return;if(l(this,ut)){S(this,Fn,!0),e.scrollTop=e.scrollHeight-e.clientHeight,requestAnimationFrame(()=>{S(this,Fn,!1)});return}const i=e.scrollHeight-e.clientHeight-e.scrollTop<=im;i!==l(this,ut)&&(S(this,ut,i),this.toggleAttribute("data-pinned",i))},Cl=new WeakMap,Rl=new WeakMap,Eh=function(e){requestAnimationFrame(()=>{const r=l(this,ht);r&&(!l(this,ut)&&!e||(S(this,Fn,!0),r.scrollTop=r.scrollHeight-r.clientHeight,requestAnimationFrame(()=>{S(this,Fn,!1)})))})},m(Rw,"properties",["messages"]);customElements.define("message-history",Rw);var Et,Ro,Ui,Jt,Fi,Hi,Po,Zi,Pl,Dl,Ll,dt,Ka,Do,$h,Th,Lo,zo;class Ah extends qi{constructor(){super(...arguments);w(this,dt);m(this,"placeholder","What do you want to do?");m(this,"open",!1);m(this,"messages",[]);m(this,"status","disconnected");w(this,Et,en.resolve("ServerManager"));w(this,Ro,en.resolve("ShortcutService"));w(this,Ui,null);w(this,Jt,null);w(this,Fi,()=>{var e;this.status=((e=l(this,Jt))==null?void 0:e.status)??"disconnected"});w(this,Hi,()=>{var e;this.messages=((e=l(this,Jt))==null?void 0:e.messages)??[]});w(this,Po,()=>{var e,r;(e=l(this,Jt))==null||e.removeEventListener("status-changed",l(this,Fi)),(r=l(this,Jt))==null||r.removeEventListener("messages-changed",l(this,Hi)),S(this,Jt,null)});w(this,Zi,()=>{var r;const e=((r=l(this,Et).activeServer)==null?void 0:r.acpClient)??null;e!==l(this,Jt)&&(l(this,Po).call(this),S(this,Jt,e),e==null||e.addEventListener("status-changed",l(this,Fi)),e==null||e.addEventListener("messages-changed",l(this,Hi)),l(this,Fi).call(this),l(this,Hi).call(this),e!=null&&e.enabled&&e.status==="disconnected"&&e.connect().catch(i=>{console.error("ACPClient.connect() failed",i)}))});m(this,"handleTriggerActivate",()=>{var r;const e=(r=l(this,Et).activeServer)==null?void 0:r.acpClient;e&&!e.enabled||(this.open=!0)});m(this,"handleKeydown",e=>{var o;if(e.key!=="Enter"||e.shiftKey)return;const r=e.currentTarget,i=r.value.trim();if(e.preventDefault(),!i)return;r.value="",f(this,dt,Ka).call(this,r);const s=(o=l(this,Et).activeServer)==null?void 0:o.acpClient;if(s!=null&&s.enabled){if(i==="/new"){s.startNewSession().catch(a=>{console.error("ACPClient.startNewSession() failed",a)});return}s.sendMessage({text:i}).catch(a=>{console.error("ACPClient.sendMessage() failed",a)})}});w(this,Pl,e=>{f(this,dt,Ka).call(this,e.currentTarget)});w(this,Dl,e=>{var i;e.stopPropagation();const r=(i=l(this,Et).activeServer)==null?void 0:i.acpClient;r&&r.cancel().catch(s=>{console.error("ACPClient.cancel() failed",s)})});w(this,Ll,e=>{if(e.target instanceof HTMLTextAreaElement)return;const r=e.currentTarget.querySelector("textarea");r==null||r.focus()});w(this,Do,e=>{var s;if(e.shortcut!=="focusCommandInput")return;const r=(s=l(this,Et).activeServer)==null?void 0:s.acpClient;if(r&&!r.enabled)return;if(!this.open){this.open=!0;return}const i=this.querySelector("textarea");if(i){if(document.activeElement===i){this.open=!1;return}i.focus()}});w(this,Lo,e=>{e.target instanceof Node&&(this.contains(e.target)||(this.open=!1))});w(this,zo,e=>{e.key==="Escape"&&(this.open=!1)})}connected(){const e=new DisposableStack;S(this,Ui,e),l(this,Et).addEventListener("change",l(this,Zi)),e.defer(()=>{l(this,Et).removeEventListener("change",l(this,Zi)),l(this,Po).call(this)}),l(this,Zi).call(this),l(this,Ro).addEventListener("shortcut-triggered",l(this,Do)),e.defer(()=>l(this,Ro).removeEventListener("shortcut-triggered",l(this,Do))),this.open&&f(this,dt,$h).call(this)}disconnected(){var e;(e=l(this,Ui))==null||e.dispose(),S(this,Ui,null),f(this,dt,Th).call(this)}changed(e){if(this.open&&this.status!=="disconnected"?(this.removeAttribute("material"),this.removeAttribute("tone"),this.removeAttribute("level")):(this.setAttribute("material","paper"),this.setAttribute("tone","dark"),this.setAttribute("level","overlay")),Ce(this.template(),this),e.has("open"))if(this.open){f(this,dt,$h).call(this);const r=this.querySelector("textarea");r&&(f(this,dt,Ka).call(this,r),r.focus())}else f(this,dt,Th).call(this)}template(){var i;const e=(i=l(this,Et).activeServer)==null?void 0:i.acpClient;if(e&&!e.enabled||this.status==="disposed")return null;if(this.status==="disconnected")return z`
481
481
  <div class="connecting" aria-disabled="true">
482
482
  <ui-spinner size="16" weight="bold"></ui-spinner>
483
483
  <span class="label">Connecting<span class="dots" aria-hidden="true"></span></span>
@@ -497,13 +497,13 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
497
497
  material="paper"
498
498
  tone="dark"
499
499
  level="overlay"
500
- @click=${l(this,Rl)}
500
+ @click=${l(this,Ll)}
501
501
  >
502
502
  <textarea
503
503
  class="textarea"
504
504
  rows="1"
505
505
  @keydown=${this.handleKeydown}
506
- @input=${l(this,Il)}
506
+ @input=${l(this,Pl)}
507
507
  ></textarea>
508
508
  ${s?z`
509
509
  <button
@@ -512,9 +512,9 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
512
512
  variant="ghost"
513
513
  aria-label=${o?"Cancelling…":"Stop generating"}
514
514
  ?disabled=${o}
515
- @click=${l(this,Cl)}
515
+ @click=${l(this,Dl)}
516
516
  >
517
- ${o?z`<ui-spinner size="16" weight="bold"></ui-spinner>`:H2({size:16})}
517
+ ${o?z`<ui-spinner size="16" weight="bold"></ui-spinner>`:Z2({size:16})}
518
518
  </button>
519
519
  `:null}
520
520
  </div>
@@ -530,13 +530,13 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
530
530
  <span class="label">${this.placeholder}</span>
531
531
  <span class="kbd" aria-hidden="true">⌘K</span>
532
532
  </div>
533
- `}}Et=new WeakMap,Co=new WeakMap,Ni=new WeakMap,Yt=new WeakMap,Ui=new WeakMap,Fi=new WeakMap,Ro=new WeakMap,Hi=new WeakMap,Il=new WeakMap,Cl=new WeakMap,Rl=new WeakMap,dt=new WeakSet,qa=function(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`},Po=new WeakMap,yh=function(){document.addEventListener("mousedown",l(this,Do)),document.addEventListener("keydown",l(this,Lo))},bh=function(){document.removeEventListener("mousedown",l(this,Do)),document.removeEventListener("keydown",l(this,Lo))},Do=new WeakMap,Lo=new WeakMap,m(vh,"properties",["placeholder","open","messages","status"]),m(vh,"attributes",{placeholder:{type:String},open:{type:Boolean}});customElements.define("command-panel",vh);const WM='<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"/>';class Pw extends Event{constructor(e){super("auth-submit",{bubbles:!0,composed:!0});m(this,"token");this.token=e}}class VM extends HTMLElement{constructor(){super(...arguments);m(this,"_invalid",!1);m(this,"_tokenValue","")}set invalid(e){this._invalid=e,this.render()}get invalid(){return this._invalid}set tokenValue(e){this._tokenValue=e,this.render()}get tokenValue(){return this._tokenValue}connectedCallback(){this.render()}handleInput(e){const r=e.currentTarget;this._tokenValue=r.value}handleSubmit(e){e.preventDefault();const r=this._tokenValue.trim();r&&this.dispatchEvent(new Pw(r))}render(){Ce(z`
533
+ `}}Et=new WeakMap,Ro=new WeakMap,Ui=new WeakMap,Jt=new WeakMap,Fi=new WeakMap,Hi=new WeakMap,Po=new WeakMap,Zi=new WeakMap,Pl=new WeakMap,Dl=new WeakMap,Ll=new WeakMap,dt=new WeakSet,Ka=function(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`},Do=new WeakMap,$h=function(){document.addEventListener("mousedown",l(this,Lo)),document.addEventListener("keydown",l(this,zo))},Th=function(){document.removeEventListener("mousedown",l(this,Lo)),document.removeEventListener("keydown",l(this,zo))},Lo=new WeakMap,zo=new WeakMap,m(Ah,"properties",["placeholder","open","messages","status"]),m(Ah,"attributes",{placeholder:{type:String},open:{type:Boolean}});customElements.define("command-panel",Ah);const VM='<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"/>';class Lw extends Event{constructor(e){super("auth-submit",{bubbles:!0,composed:!0});m(this,"token");this.token=e}}class BM extends HTMLElement{constructor(){super(...arguments);m(this,"_invalid",!1);m(this,"_tokenValue","")}set invalid(e){this._invalid=e,this.render()}get invalid(){return this._invalid}set tokenValue(e){this._tokenValue=e,this.render()}get tokenValue(){return this._tokenValue}connectedCallback(){this.render()}handleInput(e){const r=e.currentTarget;this._tokenValue=r.value}handleSubmit(e){e.preventDefault();const r=this._tokenValue.trim();r&&this.dispatchEvent(new Lw(r))}render(){Ce(z`
534
534
  <modal-overlay open>
535
535
  <system-modal material="glass-frosted" level="1" class="auth-modal">
536
536
  <form class="auth-form" @submit=${r=>this.handleSubmit(r)}>
537
537
  <header>
538
538
  <span class="auth-modal-icon" aria-hidden="true">
539
- <svg width="32" height="32" viewBox="0 0 256 256" fill="currentColor">${yb(WM)}</svg>
539
+ <svg width="32" height="32" viewBox="0 0 256 256" fill="currentColor">${wb(VM)}</svg>
540
540
  </span>
541
541
  <hgroup>
542
542
  <h2>Enter access token</h2>
@@ -565,7 +565,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
565
565
  </form>
566
566
  </system-modal>
567
567
  </modal-overlay>
568
- `,this)}}customElements.get("auth-modal")||customElements.define("auth-modal",VM);const BM=250,jM=1e3;class Dw extends HTMLElement{constructor(){super(...arguments);m(this,"_nextRetryAt",null);m(this,"_hasEverConnected",!1);m(this,"tickHandle",null)}set nextRetryAt(e){e!==this._nextRetryAt&&(this._nextRetryAt=e,this.updateTickerState(),this.render())}get nextRetryAt(){return this._nextRetryAt}set hasEverConnected(e){e!==this._hasEverConnected&&(this._hasEverConnected=e,this.render())}get hasEverConnected(){return this._hasEverConnected}connectedCallback(){if(this._nextRetryAt===null&&this.hasAttribute("next-retry-at")){const e=Number(this.getAttribute("next-retry-at"));this._nextRetryAt=Number.isFinite(e)?e:null}this.updateTickerState(),this.render()}disconnectedCallback(){this.stopTicker()}attributeChangedCallback(e,r,i){if(e==="next-retry-at"){if(i===null||i==="")this._nextRetryAt=null;else{const s=Number(i);this._nextRetryAt=Number.isFinite(s)?s:null}this.updateTickerState()}else e==="has-ever-connected"&&(this._hasEverConnected=i!==null&&i!=="false");this.render()}updateTickerState(){this._nextRetryAt!==null?this.startTicker():this.stopTicker()}startTicker(){this.tickHandle===null&&(this.tickHandle=setInterval(()=>{this.render()},BM))}stopTicker(){this.tickHandle!==null&&(clearInterval(this.tickHandle),this.tickHandle=null)}render(){const e=this._hasEverConnected,r=e?"Disconnected":"Connecting",i=this._nextRetryAt!==null?this.formatCountdown(this._nextRetryAt):"Reattempting now…";Ce(z`
568
+ `,this)}}customElements.get("auth-modal")||customElements.define("auth-modal",BM);const jM=250,GM=1e3;class zw extends HTMLElement{constructor(){super(...arguments);m(this,"_nextRetryAt",null);m(this,"_hasEverConnected",!1);m(this,"tickHandle",null)}set nextRetryAt(e){e!==this._nextRetryAt&&(this._nextRetryAt=e,this.updateTickerState(),this.render())}get nextRetryAt(){return this._nextRetryAt}set hasEverConnected(e){e!==this._hasEverConnected&&(this._hasEverConnected=e,this.render())}get hasEverConnected(){return this._hasEverConnected}connectedCallback(){if(this._nextRetryAt===null&&this.hasAttribute("next-retry-at")){const e=Number(this.getAttribute("next-retry-at"));this._nextRetryAt=Number.isFinite(e)?e:null}this.updateTickerState(),this.render()}disconnectedCallback(){this.stopTicker()}attributeChangedCallback(e,r,i){if(e==="next-retry-at"){if(i===null||i==="")this._nextRetryAt=null;else{const s=Number(i);this._nextRetryAt=Number.isFinite(s)?s:null}this.updateTickerState()}else e==="has-ever-connected"&&(this._hasEverConnected=i!==null&&i!=="false");this.render()}updateTickerState(){this._nextRetryAt!==null?this.startTicker():this.stopTicker()}startTicker(){this.tickHandle===null&&(this.tickHandle=setInterval(()=>{this.render()},jM))}stopTicker(){this.tickHandle!==null&&(clearInterval(this.tickHandle),this.tickHandle=null)}render(){const e=this._hasEverConnected,r=e?"Disconnected":"Connecting",i=this._nextRetryAt!==null?this.formatCountdown(this._nextRetryAt):"Reattempting now…";Ce(z`
569
569
  <modal-overlay open role="status" aria-live="polite">
570
570
  <system-modal material="glass-frosted" level="1" class="connecting-overlay-panel">
571
571
  <header>
@@ -577,7 +577,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
577
577
  </header>
578
578
  </system-modal>
579
579
  </modal-overlay>
580
- `,this)}formatCountdown(e){const r=e-Date.now();return r<=0?"Reattempting now…":`Reattempting in ${Math.ceil(r/jM)}s…`}}m(Dw,"observedAttributes",["next-retry-at","has-ever-connected"]);customElements.get("connecting-overlay")||customElements.define("connecting-overlay",Dw);class GM extends HTMLElement{constructor(){super(...arguments);m(this,"runtimeServerURL",hb());m(this,"electronMode",cd());m(this,"serverManager",Kt.resolve("ServerManager"));m(this,"screenManager",Kt.resolve("ScreenManager"));m(this,"connectError",null);m(this,"handleServerManagerChange",()=>{var e;this.connectError!==null&&((e=this.serverManager.activeServer)==null?void 0:e.status)==="connected"&&(this.connectError=null),this.render()});m(this,"handleScreenManagerChange",()=>{this.render()})}connectedCallback(){this.serverManager.addEventListener("change",this.handleServerManagerChange),this.screenManager.addEventListener("active-screen-changed",this.handleScreenManagerChange),this.screenManager.addEventListener("tabs-changed",this.handleScreenManagerChange),this.addEventListener("auth-submit",e=>{var i;const r=e instanceof Pw?e.token:e instanceof CustomEvent&&typeof((i=e.detail)==null?void 0:i.token)=="string"?e.detail.token:null;r&&this.handleAuthSubmit(r)}),this.initializeConnection(),this.render()}disconnectedCallback(){this.serverManager.removeEventListener("change",this.handleServerManagerChange),this.screenManager.removeEventListener("active-screen-changed",this.handleScreenManagerChange),this.screenManager.removeEventListener("tabs-changed",this.handleScreenManagerChange)}async initializeConnection(){if(this.electronMode){this.serverManager.connectConfiguredServers(this.runtimeServerURL,lg());return}if(this.serverManager.activeServer)return;const e=lg(),r=new ub({url:this.runtimeServerURL,name:"Server",token:e});this.serverManager.add(r),this.serverManager.setActive(r);try{await r.connect(e),this.connectError=null}catch(i){this.connectError=i instanceof Error&&!(i instanceof Ds)?i.message:null}this.render()}async handleAuthSubmit(e){const r=this.serverManager.activeServer;if(r){this.connectError=null,this.updateTokenQueryParam(e);try{await r.connect(e)}catch(i){i instanceof Ds||(this.connectError=i instanceof Error?i.message:String(i))}this.render()}}updateTokenQueryParam(e){const r=new URL(window.location.href);r.searchParams.set("token",e),window.history.replaceState({},"",`${r.pathname}${r.search}${r.hash}`)}render(){const e=this.serverManager.activeServer,r=(e==null?void 0:e.status)??null,i=this.screenManager.activeScreen,s=!!(e&&i&&this.screenManager.hasTab(e.url,i.id));if(r==="unauthorized"){const h=e;if(!h)return;Ce(z`
580
+ `,this)}formatCountdown(e){const r=e-Date.now();return r<=0?"Reattempting now…":`Reattempting in ${Math.ceil(r/GM)}s…`}}m(zw,"observedAttributes",["next-retry-at","has-ever-connected"]);customElements.get("connecting-overlay")||customElements.define("connecting-overlay",zw);class qM extends HTMLElement{constructor(){super(...arguments);m(this,"runtimeServerURL",pb());m(this,"electronMode",yd());m(this,"serverManager",en.resolve("ServerManager"));m(this,"screenManager",en.resolve("ScreenManager"));m(this,"connectError",null);m(this,"handleServerManagerChange",()=>{var e;this.connectError!==null&&((e=this.serverManager.activeServer)==null?void 0:e.status)==="connected"&&(this.connectError=null),this.render()});m(this,"handleScreenManagerChange",()=>{this.render()})}connectedCallback(){this.serverManager.addEventListener("change",this.handleServerManagerChange),this.screenManager.addEventListener("active-screen-changed",this.handleScreenManagerChange),this.screenManager.addEventListener("tabs-changed",this.handleScreenManagerChange),this.addEventListener("auth-submit",e=>{var i;const r=e instanceof Lw?e.token:e instanceof CustomEvent&&typeof((i=e.detail)==null?void 0:i.token)=="string"?e.detail.token:null;r&&this.handleAuthSubmit(r)}),this.initializeConnection(),this.render()}disconnectedCallback(){this.serverManager.removeEventListener("change",this.handleServerManagerChange),this.screenManager.removeEventListener("active-screen-changed",this.handleScreenManagerChange),this.screenManager.removeEventListener("tabs-changed",this.handleScreenManagerChange)}async initializeConnection(){if(this.electronMode){this.serverManager.connectConfiguredServers(this.runtimeServerURL,gg());return}if(this.serverManager.activeServer)return;const e=gg(),r=new db({url:this.runtimeServerURL,name:"Server",token:e});this.serverManager.add(r),this.serverManager.setActive(r);try{await r.connect(e),this.connectError=null}catch(i){this.connectError=i instanceof Error&&!(i instanceof Ls)?i.message:null}this.render()}async handleAuthSubmit(e){const r=this.serverManager.activeServer;if(r){this.connectError=null,this.updateTokenQueryParam(e);try{await r.connect(e)}catch(i){i instanceof Ls||(this.connectError=i instanceof Error?i.message:String(i))}this.render()}}updateTokenQueryParam(e){const r=new URL(window.location.href);r.searchParams.set("token",e),window.history.replaceState({},"",`${r.pathname}${r.search}${r.hash}`)}render(){const e=this.serverManager.activeServer,r=(e==null?void 0:e.status)??null,i=this.screenManager.activeScreen,s=!!(e&&i&&this.screenManager.hasTab(e.url,i.id));if(r==="unauthorized"){const h=e;if(!h)return;Ce(z`
581
581
  <main class="auth-gate">
582
582
  <auth-modal
583
583
  .invalid=${!!h.token}
@@ -603,4 +603,4 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
603
603
  .hasEverConnected=${(e==null?void 0:e.hasEverConnected)??!1}
604
604
  ></connecting-overlay>`:null}
605
605
  </main>
606
- `,this)}}customElements.get("television-app")||customElements.define("television-app",GM);const xd=cd(),Ed=hb(),Lw=new A1(xd?"television-electron":"television-browser",_1(Ed)),yn=new c2({localStore:Lw,localServerURL:Ed}),zw=new P1({localStore:Lw,serverManager:yn}),qM=new u2,Ow=()=>{const n=yn.activeServer;if(!n||n.status!=="connected"){el();return}n.client.display.get().then(t=>{if(!(yn.activeServer!==n||n.status!=="connected"))return db(t.activeThemeName,n)}).catch(()=>{yn.activeServer===n&&el()})};Ow();yn.addEventListener("change",Ow);yn.addEventListener("server-event",n=>{if(n.event.type!=="theme-changed")return;const t=yn.activeServer;!t||t.url!==n.serverURL||db(n.event.themeName,t)});Kt.register("ServerManager",()=>yn);Kt.register("ScreenManager",()=>zw);Kt.register("ShortcutService",()=>qM);globalThis.__telepath={screenManager:zw,serverManager:yn};const Ad=document.createElement("television-app");Ad.runtimeServerURL=Ed;Ad.electronMode=xd;xd&&document.body.classList.add("electron");document.body.appendChild(Ad);
606
+ `,this)}}customElements.get("television-app")||customElements.define("television-app",qM);const Dd=yd(),Ld=pb(),Ow=new A1(Dd?"television-electron":"television-browser",_1(Ld)),Sn=new u2({localStore:Ow,localServerURL:Ld}),Mw=new P1({localStore:Ow,serverManager:Sn}),YM=new h2,Nw=()=>{const n=Sn.activeServer;if(!n||n.status!=="connected"){rl();return}n.client.display.get().then(t=>{if(!(Sn.activeServer!==n||n.status!=="connected"))return fb(t.activeThemeName,n)}).catch(()=>{Sn.activeServer===n&&rl()})};Nw();Sn.addEventListener("change",Nw);Sn.addEventListener("server-event",n=>{if(n.event.type!=="theme-changed")return;const t=Sn.activeServer;!t||t.url!==n.serverURL||fb(n.event.themeName,t)});en.register("ServerManager",()=>Sn);en.register("ScreenManager",()=>Mw);en.register("ShortcutService",()=>YM);globalThis.__telepath={screenManager:Mw,serverManager:Sn};const zd=document.createElement("television-app");zd.runtimeServerURL=Ld;zd.electronMode=Dd;Dd&&document.body.classList.add("electron");document.body.appendChild(zd);