@telepath-computer/television 0.1.81 → 0.1.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +90 -22
- package/dist/skills/television/.skill-manifest.json +29 -0
- package/dist/skills/television/SKILL.md +77 -7
- package/dist/skills/television/artifact-types/calendar.md +4 -0
- package/dist/skills/television/artifact-types/table.md +4 -0
- package/dist/skills/television/artifact-workflow.md +280 -8
- package/dist/skills/television/cli-capabilities.md +145 -0
- package/dist/skills/television/html-house-style.md +4 -0
- package/dist/web/assets/{index-_1D4RyBM.js → index-BEXhHPow.js} +113 -113
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/skills/television/what-to-read.md +0 -27
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var Fb=Object.defineProperty;var cd=n=>{throw TypeError(n)};var Zb=(n,e,t)=>e in n?Fb(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var b=(n,e,t)=>Zb(n,typeof e!="symbol"?e+"":e,t),Rl=(n,e,t)=>e.has(n)||cd("Cannot "+t);var l=(n,e,t)=>(Rl(n,e,"read from private field"),t?t.call(n):e.get(n)),w=(n,e,t)=>e.has(n)?cd("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),x=(n,e,t,r)=>(Rl(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),f=(n,e,t)=>(Rl(n,e,"access private method"),t);var ud=(n,e,t,r)=>({set _(i){x(n,e,i,t)},get _(){return l(n,e,r)}});(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.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 t(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=t(i);fetch(i.href,s)}})();var Vn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wb(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var hd=Object.prototype.toString,ig=function(e){var t=hd.call(e),r=t==="[object Arguments]";return r||(r=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&hd.call(e.callee)==="[object Function]"),r},Dl,dd;function Hb(){if(dd)return Dl;dd=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=ig,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 m=v.constructor;return m&&m.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]&&e.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(m){var E=m!==null&&typeof m=="object",k=t.call(m)==="[object Function]",T=r(m),O=E&&t.call(m)==="[object String]",P=[];if(!E&&!k&&!T)throw new TypeError("Object.keys called on a non-object");var V=o&&k;if(O&&m.length>0&&!e.call(m,0))for(var F=0;F<m.length;++F)P.push(String(F));if(T&&m.length>0)for(var B=0;B<m.length;++B)P.push(String(B));else for(var U in m)!(V&&U==="prototype")&&e.call(m,U)&&P.push(String(U));if(s)for(var Q=p(m),j=0;j<a.length;++j)!(Q&&a[j]==="constructor")&&e.call(m,a[j])&&P.push(a[j]);return P}}return Dl=n,Dl}var Vb=Array.prototype.slice,Bb=ig,pd=Object.keys,qo=pd?function(e){return pd(e)}:Hb(),fd=Object.keys;qo.shim=function(){if(Object.keys){var e=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);e||(Object.keys=function(r){return Bb(r)?fd(Vb.call(r)):fd(r)})}else Object.keys=qo;return Object.keys||qo};var Gb=qo,Yo=Object.defineProperty||!1;if(Yo)try{Yo({},"a",{value:1})}catch{Yo=!1}var so=Yo,tn=SyntaxError,K=TypeError,jb=Object.getOwnPropertyDescriptor,Xo=jb;if(Xo)try{Xo([],"length")}catch{Xo=null}var Ai=Xo,gd=so,qb=tn,zr=K,md=Ai,sg=function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new zr("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new zr("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new zr("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new zr("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new zr("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new zr("`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=!!md&&md(e,t);if(gd)gd(e,t,{configurable:o===null&&c?c.configurable:!o,enumerable:i===null&&c?c.enumerable:!i,value:r,writable:s===null&&c?c.writable:!s});else if(a||!i&&!s&&!o)e[t]=r;else throw new qb("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Ic=so,og=function(){return!!Ic};og.hasArrayLengthDefineBug=function(){if(!Ic)return null;try{return Ic([],"length",{value:1}).length!==1}catch{return!0}};var el=og,Yb=Gb,Xb=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Kb=Object.prototype.toString,Jb=Array.prototype.concat,vd=sg,Qb=function(n){return typeof n=="function"&&Kb.call(n)==="[object Function]"},ag=el(),ew=function(n,e,t,r){if(e in n){if(r===!0){if(n[e]===t)return}else if(!Qb(r)||!r())return}ag?vd(n,e,t,!0):vd(n,e,t)},lg=function(n,e){var t=arguments.length>2?arguments[2]:{},r=Yb(e);Xb&&(r=Jb.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i<r.length;i+=1)ew(n,r[i],e[r[i]],t[r[i]])};lg.supportsDescriptors=!!ag;var xr=lg,Ko={exports:{}};typeof self<"u"?Ko.exports=self:typeof window<"u"?Ko.exports=window:Ko.exports=Function("return this")();var cg=Ko.exports,tw=cg,ug=function(){return typeof Vn!="object"||!Vn||Vn.Math!==Math||Vn.Array!==Array?tw:Vn},nw=xr,rw=Ai,iw=ug,sw=function(){var e=iw();if(nw.supportsDescriptors){var t=rw(e,"globalThis");(!t||t.configurable&&(t.enumerable||!t.writable||globalThis!==e))&&Object.defineProperty(e,"globalThis",{configurable:!0,enumerable:!1,value:e,writable:!0})}else(typeof globalThis!="object"||globalThis!==e)&&(e.globalThis=e);return e},ow=xr,aw=cg,hg=ug,lw=sw,cw=hg(),dg=function(){return cw};ow(dg,{getPolyfill:hg,implementation:aw,shim:lw});var Du=dg,nn=function(e){return!!e&&(typeof e=="function"||typeof e=="object")},Lu=Object,pg=Error,uw=EvalError,hw=RangeError,zu=ReferenceError,dw=URIError,pw=Math.abs,fw=Math.floor,gw=Math.max,mw=Math.min,vw=Math.pow,yw=Math.round,Ou=Number.isNaN||function(e){return e!==e},bw=Ou,ww=function(e){return bw(e)||e===0?e:e<0?-1:1},$i=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),r=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==i||a.enumerable!==!0)return!1}return!0},yd=typeof Symbol<"u"&&Symbol,Sw=$i,Mu=function(){return typeof yd!="function"||typeof Symbol!="function"||typeof yd("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Sw()},Ll,bd;function fg(){return bd||(bd=1,Ll=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Ll}var zl,wd;function gg(){if(wd)return zl;wd=1;var n=Lu;return zl=n.getPrototypeOf||null,zl}var _w="Function.prototype.bind called on incompatible ",kw=Object.prototype.toString,Ew=Math.max,xw="[object Function]",Sd=function(e,t){for(var r=[],i=0;i<e.length;i+=1)r[i]=e[i];for(var s=0;s<t.length;s+=1)r[s+e.length]=t[s];return r},Aw=function(e,t){for(var r=[],i=t,s=0;i<e.length;i+=1,s+=1)r[s]=e[i];return r},$w=function(n,e){for(var t="",r=0;r<n.length;r+=1)t+=n[r],r+1<n.length&&(t+=e);return t},Iw=function(e){var t=this;if(typeof t!="function"||kw.apply(t)!==xw)throw new TypeError(_w+t);for(var r=Aw(arguments,1),i,s=function(){if(this instanceof i){var h=t.apply(this,Sd(r,arguments));return Object(h)===h?h:this}return t.apply(e,Sd(r,arguments))},o=Ew(0,t.length-r.length),a=[],c=0;c<o;c++)a[c]="$"+c;if(i=Function("binder","return function ("+$w(a,",")+"){ return binder.apply(this,arguments); }")(s),t.prototype){var u=function(){};u.prototype=t.prototype,i.prototype=new u,u.prototype=null}return i},Tw=Iw,oo=Function.prototype.bind||Tw,Nu=Function.prototype.call,Uu=Function.prototype.apply,Cw=typeof Reflect<"u"&&Reflect&&Reflect.apply,Pw=oo,Rw=Uu,Dw=Nu,Lw=Cw,mg=Lw||Pw.call(Dw,Rw),zw=oo,Ow=K,Mw=Nu,Nw=mg,tl=function(e){if(e.length<1||typeof e[0]!="function")throw new Ow("a function is required");return Nw(zw,Mw,e)},Ol,_d;function Uw(){if(_d)return Ol;_d=1;var n=tl,e=Ai,t;try{t=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var r=!!t&&e&&e(Object.prototype,"__proto__"),i=Object,s=i.getPrototypeOf;return Ol=r&&typeof r.get=="function"?n([r.get]):typeof s=="function"?function(a){return s(a==null?a:i(a))}:!1,Ol}var Ml,kd;function vg(){if(kd)return Ml;kd=1;var n=fg(),e=gg(),t=Uw();return Ml=n?function(i){return n(i)}:e?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return e(i)}:t?function(i){return t(i)}:null,Ml}var Fw=Function.prototype.call,Zw=Object.prototype.hasOwnProperty,Ww=oo,rn=Ww.call(Fw,Zw),X,Hw=Lu,Vw=pg,Bw=uw,Gw=hw,jw=zu,wi=tn,Qr=K,qw=dw,Yw=pw,Xw=fw,Kw=gw,Jw=mw,Qw=vw,e0=yw,t0=ww,yg=Function,Nl=function(n){try{return yg('"use strict"; return ('+n+").constructor;")()}catch{}},hs=Ai,n0=so,Ul=function(){throw new Qr},r0=hs?function(){try{return arguments.callee,Ul}catch{try{return hs(arguments,"callee").get}catch{return Ul}}}():Ul,Or=Mu(),Ie=vg(),i0=gg(),s0=fg(),bg=Uu,ao=Nu,Zr={},o0=typeof Uint8Array>"u"||!Ie?X:Ie(Uint8Array),yr={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?X:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?X:ArrayBuffer,"%ArrayIteratorPrototype%":Or&&Ie?Ie([][Symbol.iterator]()):X,"%AsyncFromSyncIteratorPrototype%":X,"%AsyncFunction%":Zr,"%AsyncGenerator%":Zr,"%AsyncGeneratorFunction%":Zr,"%AsyncIteratorPrototype%":Zr,"%Atomics%":typeof Atomics>"u"?X:Atomics,"%BigInt%":typeof BigInt>"u"?X:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?X:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?X:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?X:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Vw,"%eval%":eval,"%EvalError%":Bw,"%Float16Array%":typeof Float16Array>"u"?X:Float16Array,"%Float32Array%":typeof Float32Array>"u"?X:Float32Array,"%Float64Array%":typeof Float64Array>"u"?X:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?X:FinalizationRegistry,"%Function%":yg,"%GeneratorFunction%":Zr,"%Int8Array%":typeof Int8Array>"u"?X:Int8Array,"%Int16Array%":typeof Int16Array>"u"?X:Int16Array,"%Int32Array%":typeof Int32Array>"u"?X:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Or&&Ie?Ie(Ie([][Symbol.iterator]())):X,"%JSON%":typeof JSON=="object"?JSON:X,"%Map%":typeof Map>"u"?X:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Or||!Ie?X:Ie(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Hw,"%Object.getOwnPropertyDescriptor%":hs,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?X:Promise,"%Proxy%":typeof Proxy>"u"?X:Proxy,"%RangeError%":Gw,"%ReferenceError%":jw,"%Reflect%":typeof Reflect>"u"?X:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?X:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Or||!Ie?X:Ie(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?X:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Or&&Ie?Ie(""[Symbol.iterator]()):X,"%Symbol%":Or?Symbol:X,"%SyntaxError%":wi,"%ThrowTypeError%":r0,"%TypedArray%":o0,"%TypeError%":Qr,"%Uint8Array%":typeof Uint8Array>"u"?X:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?X:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?X:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?X:Uint32Array,"%URIError%":qw,"%WeakMap%":typeof WeakMap>"u"?X:WeakMap,"%WeakRef%":typeof WeakRef>"u"?X:WeakRef,"%WeakSet%":typeof WeakSet>"u"?X:WeakSet,"%Function.prototype.call%":ao,"%Function.prototype.apply%":bg,"%Object.defineProperty%":n0,"%Object.getPrototypeOf%":i0,"%Math.abs%":Yw,"%Math.floor%":Xw,"%Math.max%":Kw,"%Math.min%":Jw,"%Math.pow%":Qw,"%Math.round%":e0,"%Math.sign%":t0,"%Reflect.getPrototypeOf%":s0};if(Ie)try{null.error}catch(n){var a0=Ie(Ie(n));yr["%Error.prototype%"]=a0}var l0=function n(e){var t;if(e==="%AsyncFunction%")t=Nl("async function () {}");else if(e==="%GeneratorFunction%")t=Nl("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Nl("async function* () {}");else if(e==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&Ie&&(t=Ie(i.prototype))}return yr[e]=t,t},Ed={__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"]},lo=oo,pa=rn,c0=lo.call(ao,Array.prototype.concat),u0=lo.call(bg,Array.prototype.splice),xd=lo.call(ao,String.prototype.replace),fa=lo.call(ao,String.prototype.slice),h0=lo.call(ao,RegExp.prototype.exec),d0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,p0=/\\(\\)?/g,f0=function(e){var t=fa(e,0,1),r=fa(e,-1);if(t==="%"&&r!=="%")throw new wi("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new wi("invalid intrinsic syntax, expected opening `%`");var i=[];return xd(e,d0,function(s,o,a,c){i[i.length]=a?xd(c,p0,"$1"):o||s}),i},g0=function(e,t){var r=e,i;if(pa(Ed,r)&&(i=Ed[r],r="%"+i[0]+"%"),pa(yr,r)){var s=yr[r];if(s===Zr&&(s=l0(r)),typeof s>"u"&&!t)throw new Qr("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new wi("intrinsic "+e+" does not exist!")},ut=function(e,t){if(typeof e!="string"||e.length===0)throw new Qr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Qr('"allowMissing" argument must be a boolean');if(h0(/^%?[^%]*%?$/,e)===null)throw new wi("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=f0(e),i=r.length>0?r[0]:"",s=g0("%"+i+"%",t),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],u0(r,c0([0,1],u)));for(var h=1,p=!0;h<r.length;h+=1){var v=r[h],m=fa(v,0,1),E=fa(v,-1);if((m==='"'||m==="'"||m==="`"||E==='"'||E==="'"||E==="`")&&m!==E)throw new wi("property names with quotes must have matching quotes");if((v==="constructor"||!p)&&(c=!0),i+="."+v,o="%"+i+"%",pa(yr,o))a=yr[o];else if(a!=null){if(!(v in a)){if(!t)throw new Qr("base intrinsic for "+e+" exists, but the property is not available.");return}if(hs&&h+1>=r.length){var k=hs(a,v);p=!!k,p&&"get"in k&&!("originalValue"in k.get)?a=k.get:a=a[v]}else p=pa(a,v),a=a[v];p&&!c&&(yr[o]=a)}}return a},Fl,Ad;function Pn(){if(Ad)return Fl;Ad=1;var n=ut,e=tl,t=e([n("%String.prototype.indexOf%")]);return Fl=function(i,s){var o=n(i,!!s);return typeof o=="function"&&t(i,".prototype.")>-1?e([o]):o},Fl}var Zl,$d;function Fu(){if($d)return Zl;$d=1;var n=ut,e=n("%Array%"),t=!e.isArray&&Pn()("Object.prototype.toString");return Zl=e.isArray||function(i){return t(i)==="[object Array]"},Zl}var m0=el,Id=so,wg=m0.hasArrayLengthDefineBug(),v0=wg&&Fu(),y0=Pn(),b0=y0("Object.prototype.propertyIsEnumerable"),Zu=function(e,t,r,i,s,o){if(!Id){if(!e(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&b0(i,s)!==!!o["[[Enumerable]]"])return!1;var a=o["[[Value]]"];return i[s]=a,t(i[s],a)}return wg&&s==="length"&&"[[Value]]"in o&&v0(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(Id(i,s,r(o)),!0)},w0=K,Zi=rn,S0={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},Ii=function(e){if(!e||typeof e!="object")return!1;for(var t in e)if(Zi(e,t)&&!S0[t])return!1;var r=Zi(e,"[[Value]]")||Zi(e,"[[Writable]]"),i=Zi(e,"[[Get]]")||Zi(e,"[[Set]]");if(r&&i)throw new w0("Property Descriptors may not be both accessor and data descriptors");return!0},Sg=function(e){if(typeof e>"u")return e;var t={};return"[[Value]]"in e&&(t.value=e["[[Value]]"]),"[[Writable]]"in e&&(t.writable=!!e["[[Writable]]"]),"[[Get]]"in e&&(t.get=e["[[Get]]"]),"[[Set]]"in e&&(t.set=e["[[Set]]"]),"[[Enumerable]]"in e&&(t.enumerable=!!e["[[Enumerable]]"]),"[[Configurable]]"in e&&(t.configurable=!!e["[[Configurable]]"]),t},_0=K,k0=Ii,E0=Sg,_g=function(e){if(typeof e<"u"&&!k0(e))throw new _0("Assertion failed: `Desc` must be a Property Descriptor");return E0(e)},x0=K,Td=rn,A0=Ii,kg=function(e){if(typeof e>"u")return!1;if(!A0(e))throw new x0("Assertion failed: `Desc` must be a Property Descriptor");return!(!Td(e,"[[Value]]")&&!Td(e,"[[Writable]]"))},Ti=function(e){return typeof e=="string"||typeof e=="symbol"},Cd=Ou,Eg=function(e,t){return e===t?e===0?1/e===1/t:!0:Cd(e)&&Cd(t)},Pd=K,$0=nn,I0=Zu,T0=_g,C0=kg,P0=Ti,R0=Eg,Wu=function(e,t,r){if(!$0(e))throw new Pd("Assertion failed: Type(O) is not Object");if(!P0(t))throw new Pd("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return I0(C0,R0,T0,e,t,i)},xg=Function.prototype.toString,Yr=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Tc,Jo;if(typeof Yr=="function"&&typeof Object.defineProperty=="function")try{Tc=Object.defineProperty({},"length",{get:function(){throw Jo}}),Jo={},Yr(function(){throw 42},null,Tc)}catch(n){n!==Jo&&(Yr=null)}else Yr=null;var D0=/^\s*class\b/,Cc=function(e){try{var t=xg.call(e);return D0.test(t)}catch{return!1}},Wl=function(e){try{return Cc(e)?!1:(xg.call(e),!0)}catch{return!1}},Qo=Object.prototype.toString,L0="[object Object]",z0="[object Function]",O0="[object GeneratorFunction]",M0="[object HTMLAllCollection]",N0="[object HTML document.all class]",U0="[object HTMLCollection]",F0=typeof Symbol=="function"&&!!Symbol.toStringTag,Z0=!(0 in[,]),Pc=function(){return!1};if(typeof document=="object"){var W0=document.all;Qo.call(W0)===Qo.call(document.all)&&(Pc=function(e){if((Z0||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=Qo.call(e);return(t===M0||t===N0||t===U0||t===L0)&&e("")==null}catch{}return!1})}var Ag=Yr?function(e){if(Pc(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Yr(e,null,Tc)}catch(t){if(t!==Jo)return!1}return!Cc(e)&&Wl(e)}:function(e){if(Pc(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(F0)return Wl(e);if(Cc(e))return!1;var t=Qo.call(e);return t!==z0&&t!==O0&&!/^\[object HTML/.test(t)?!1:Wl(e)},H0=Ag,V0=function(e){return!!e},Et=rn,To=K,B0=nn,Rd=H0,Hl=V0,G0=function(e){if(!B0(e))throw new To("ToPropertyDescriptor requires an object");var t={};if(Et(e,"enumerable")&&(t["[[Enumerable]]"]=Hl(e.enumerable)),Et(e,"configurable")&&(t["[[Configurable]]"]=Hl(e.configurable)),Et(e,"value")&&(t["[[Value]]"]=e.value),Et(e,"writable")&&(t["[[Writable]]"]=Hl(e.writable)),Et(e,"get")){var r=e.get;if(typeof r<"u"&&!Rd(r))throw new To("getter must be a function");t["[[Get]]"]=r}if(Et(e,"set")){var i=e.set;if(typeof i<"u"&&!Rd(i))throw new To("setter must be a function");t["[[Set]]"]=i}if((Et(t,"[[Get]]")||Et(t,"[[Set]]"))&&(Et(t,"[[Value]]")||Et(t,"[[Writable]]")))throw new To("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},Vl=K,j0=nn,Dd=Ii,q0=Zu,Y0=_g,X0=kg,K0=Ti,J0=Eg,Q0=G0,eS=function(e,t,r){if(!j0(e))throw new Vl("Assertion failed: Type(O) is not Object");if(!K0(t))throw new Vl("Assertion failed: P is not a Property Key");var i=Dd(r)?r:Q0(r);if(!Dd(i))throw new Vl("Assertion failed: Desc is not a valid Property Descriptor");return q0(X0,J0,Y0,e,t,i)},Ld=K,tS=nn,nS=eS,rS=Ti,iS=function(e,t,r){if(!tS(e))throw new Ld("Assertion failed: Type(O) is not Object");if(!rS(t))throw new Ld("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return nS(e,t,i)},sS=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,oS=Lu,aS=oS.setPrototypeOf||null,lS=tl,zd=Ai,cS=K,$g={};try{$g.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var uS=!("toString"in $g),Bl=zd&&zd(Object.prototype,"__proto__"),hS=uS&&(!!Bl&&typeof Bl.set=="function"&&lS([Bl.set])||function(e,t){if(e==null)throw new cS("set Object.prototype.__proto__ called on null or undefined");return e.__proto__=t,t}),Od=sS,dS=aS,Md=hS,pS=K,fS=Od?function(e,t){if(Od(e,t))return e;throw new pS("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:dS||(Md?function(e,t){return Md(e,t),e}:null),Nd=K,gS=nn,Ud=vg(),mS=function(e){if(!gS(e))throw new Nd("Assertion failed: O must be an Object");if(!Ud)throw new Nd("This environment does not support fetching prototypes.");return Ud(e)},vS=K,yS=fS,bS=nn,wS=mS,SS=function(e,t){if(t!==null&&!bS(t))throw new vS("Assertion failed: V must be Object or Null");try{yS(e,t)}catch{return!1}return wS(e)===t},Gl=Wu,Fd=iS,Ig=SS,_S=el(),Hu=pg;function co(n,e,t){var r=new Hu(t);return Ig(r,ea),delete r.constructor,Fd(r,"error",n),Fd(r,"suppressed",e),r}_S&&Object.defineProperty(co,"prototype",{writable:!1});var ea=co.prototype;if(!Gl(ea,"constructor",co)||!Gl(ea,"message","")||!Gl(ea,"name","SuppressedError"))throw new Hu("unable to install SuppressedError.prototype properties; please report this!");Ig(co.prototype,Hu.prototype);var kS=co,ES=kS,Tg=function(){return typeof SuppressedError=="function"?SuppressedError:ES},xS=xr,Zd=Du(),AS=Tg,$S=function(){var e=AS();return xS(Zd,{SuppressedError:e},{SuppressedError:function(){return Zd.SuppressedError!==e}}),e};$S();var IS=K,TS=Ii,CS=Sg,PS=function(e){if(typeof e<"u"&&!TS(e))throw new IS("Assertion failed: `Desc` must be a Property Descriptor");return CS(e)},RS=K,Wd=rn,DS=Ii,LS=function(e){if(typeof e>"u")return!1;if(!DS(e))throw new RS("Assertion failed: `Desc` must be a Property Descriptor");return!(!Wd(e,"[[Value]]")&&!Wd(e,"[[Writable]]"))},Hd=Ou,zS=function(e,t){return e===t?e===0?1/e===1/t:!0:Hd(e)&&Hd(t)},Ci=Ag,OS=function(e){return!!e},xt=rn,Co=K,MS=nn,Vd=Ci,jl=OS,NS=function(e){if(!MS(e))throw new Co("ToPropertyDescriptor requires an object");var t={};if(xt(e,"enumerable")&&(t["[[Enumerable]]"]=jl(e.enumerable)),xt(e,"configurable")&&(t["[[Configurable]]"]=jl(e.configurable)),xt(e,"value")&&(t["[[Value]]"]=e.value),xt(e,"writable")&&(t["[[Writable]]"]=jl(e.writable)),xt(e,"get")){var r=e.get;if(typeof r<"u"&&!Vd(r))throw new Co("getter must be a function");t["[[Get]]"]=r}if(xt(e,"set")){var i=e.set;if(typeof i<"u"&&!Vd(i))throw new Co("setter must be a function");t["[[Set]]"]=i}if((xt(t,"[[Get]]")||xt(t,"[[Set]]"))&&(xt(t,"[[Value]]")||xt(t,"[[Writable]]")))throw new Co("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},ql=K,US=nn,Bd=Ii,FS=Zu,ZS=PS,WS=LS,HS=Ti,VS=zS,BS=NS,uo=function(e,t,r){if(!US(e))throw new ql("Assertion failed: Type(O) is not Object");if(!HS(t))throw new ql("Assertion failed: P is not a Property Key");var i=Bd(r)?r:BS(r);if(!Bd(i))throw new ql("Assertion failed: Desc is not a valid Property Descriptor");return FS(WS,VS,ZS,e,t,i)},GS=$i(),jS=GS?Symbol.dispose||Symbol("Symbol.dispose"):null,qS=$i,YS=jS,Vu=function(){return qS()&&Symbol.dispose||YS},XS=Mu,KS=uo,JS=Vu,QS=function(){var e=JS();return XS()&&KS(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},e_=$i(),t_=e_?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,n_=$i,r_=t_,Bu=function(){return n_()&&Symbol.asyncDispose||r_},i_=Mu,s_=uo,o_=Bu,a_=function(){var e=o_();return i_()&&s_(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},l_=Fu(),c_=ut,u_=Pn(),h_=K,d_=l_,p_=c_("%Reflect.apply%",!0)||u_("Function.prototype.apply"),nl=function(e,t){var r=arguments.length>2?arguments[2]:[];if(!d_(r))throw new h_("Assertion failed: optional `argumentsList`, if provided, must be a List");return p_(e,t,r)};const f_={},g_=Object.freeze(Object.defineProperty({__proto__:null,default:f_},Symbol.toStringTag,{value:"Module"})),m_=Wb(g_);var Gu=typeof Map=="function"&&Map.prototype,Yl=Object.getOwnPropertyDescriptor&&Gu?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ga=Gu&&Yl&&typeof Yl.get=="function"?Yl.get:null,Gd=Gu&&Map.prototype.forEach,ju=typeof Set=="function"&&Set.prototype,Xl=Object.getOwnPropertyDescriptor&&ju?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ma=ju&&Xl&&typeof Xl.get=="function"?Xl.get:null,jd=ju&&Set.prototype.forEach,v_=typeof WeakMap=="function"&&WeakMap.prototype,os=v_?WeakMap.prototype.has:null,y_=typeof WeakSet=="function"&&WeakSet.prototype,as=y_?WeakSet.prototype.has:null,b_=typeof WeakRef=="function"&&WeakRef.prototype,qd=b_?WeakRef.prototype.deref:null,w_=Boolean.prototype.valueOf,S_=Object.prototype.toString,__=Function.prototype.toString,k_=String.prototype.match,qu=String.prototype.slice,En=String.prototype.replace,E_=String.prototype.toUpperCase,Yd=String.prototype.toLowerCase,Cg=RegExp.prototype.test,Xd=Array.prototype.concat,Lt=Array.prototype.join,x_=Array.prototype.slice,Kd=Math.floor,Rc=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Kl=Object.getOwnPropertySymbols,Dc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Si=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ls=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Si||!0)?Symbol.toStringTag:null,Pg=Object.prototype.propertyIsEnumerable,Jd=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function Qd(n,e){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||Cg.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-Kd(-n):Kd(n);if(r!==n){var i=String(r),s=qu.call(e,i.length+1);return En.call(i,t,"$&_")+"."+En.call(En.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return En.call(e,t,"$&_")}var Lc=m_,ep=Lc.custom,tp=Lg(ep)?ep:null,Rg={__proto__:null,double:'"',single:"'"},A_={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Pi=function n(e,t,r,i){var s=t||{};if(Vt(s,"quoteStyle")&&!Vt(Rg,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Vt(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=Vt(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(Vt(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(Vt(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Og(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return a?Qd(e,c):c}if(typeof e=="bigint"){var u=String(e)+"n";return a?Qd(e,u):u}var h=typeof s.depth>"u"?5:s.depth;if(typeof r>"u"&&(r=0),r>=h&&h>0&&typeof e=="object")return zc(e)?"[Array]":"[Object]";var p=V_(s,r);if(typeof i>"u")i=[];else if(zg(i,e)>=0)return"[Circular]";function v(St,on,wl){if(on&&(i=x_.call(i),i.push(on)),wl){var wo={depth:s.depth};return Vt(s,"quoteStyle")&&(wo.quoteStyle=s.quoteStyle),n(St,wo,r+1,i)}return n(St,s,r+1,i)}if(typeof e=="function"&&!np(e)){var m=z_(e),E=Po(e,v);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(E.length>0?" { "+Lt.call(E,", ")+" }":"")}if(Lg(e)){var k=Si?En.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Dc.call(e);return typeof e=="object"&&!Si?Wi(k):k}if(Z_(e)){for(var T="<"+Yd.call(String(e.nodeName)),O=e.attributes||[],P=0;P<O.length;P++)T+=" "+O[P].name+"="+Dg($_(O[P].value),"double",s);return T+=">",e.childNodes&&e.childNodes.length&&(T+="..."),T+="</"+Yd.call(String(e.nodeName))+">",T}if(zc(e)){if(e.length===0)return"[]";var V=Po(e,v);return p&&!H_(V)?"["+Oc(V,p)+"]":"[ "+Lt.call(V,", ")+" ]"}if(T_(e)){var F=Po(e,v);return!("cause"in Error.prototype)&&"cause"in e&&!Pg.call(e,"cause")?"{ ["+String(e)+"] "+Lt.call(Xd.call("[cause]: "+v(e.cause),F),", ")+" }":F.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Lt.call(F,", ")+" }"}if(typeof e=="object"&&o){if(tp&&typeof e[tp]=="function"&&Lc)return Lc(e,{depth:h-r});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(O_(e)){var B=[];return Gd&&Gd.call(e,function(St,on){B.push(v(on,e,!0)+" => "+v(St,e))}),rp("Map",ga.call(e),B,p)}if(U_(e)){var U=[];return jd&&jd.call(e,function(St){U.push(v(St,e))}),rp("Set",ma.call(e),U,p)}if(M_(e))return Jl("WeakMap");if(F_(e))return Jl("WeakSet");if(N_(e))return Jl("WeakRef");if(P_(e))return Wi(v(Number(e)));if(D_(e))return Wi(v(Rc.call(e)));if(R_(e))return Wi(w_.call(e));if(C_(e))return Wi(v(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof Vn<"u"&&e===Vn)return"{ [object globalThis] }";if(!I_(e)&&!np(e)){var Q=Po(e,v),j=Jd?Jd(e)===Object.prototype:e instanceof Object||e.constructor===Object,rt=e instanceof Object?"":"null prototype",Mt=!j&&ls&&Object(e)===e&&ls in e?qu.call(Rn(e),8,-1):rt?"Object":"",ke=j||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",zn=ke+(Mt||rt?"["+Lt.call(Xd.call([],Mt||[],rt||[]),": ")+"] ":"");return Q.length===0?zn+"{}":p?zn+"{"+Oc(Q,p)+"}":zn+"{ "+Lt.call(Q,", ")+" }"}return String(e)};function Dg(n,e,t){var r=t.quoteStyle||e,i=Rg[r];return i+n+i}function $_(n){return En.call(String(n),/"/g,""")}function Ar(n){return!ls||!(typeof n=="object"&&(ls in n||typeof n[ls]<"u"))}function zc(n){return Rn(n)==="[object Array]"&&Ar(n)}function I_(n){return Rn(n)==="[object Date]"&&Ar(n)}function np(n){return Rn(n)==="[object RegExp]"&&Ar(n)}function T_(n){return Rn(n)==="[object Error]"&&Ar(n)}function C_(n){return Rn(n)==="[object String]"&&Ar(n)}function P_(n){return Rn(n)==="[object Number]"&&Ar(n)}function R_(n){return Rn(n)==="[object Boolean]"&&Ar(n)}function Lg(n){if(Si)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!Dc)return!1;try{return Dc.call(n),!0}catch{}return!1}function D_(n){if(!n||typeof n!="object"||!Rc)return!1;try{return Rc.call(n),!0}catch{}return!1}var L_=Object.prototype.hasOwnProperty||function(n){return n in this};function Vt(n,e){return L_.call(n,e)}function Rn(n){return S_.call(n)}function z_(n){if(n.name)return n.name;var e=k_.call(__.call(n),/^function\s*([\w$]+)/);return e?e[1]:null}function zg(n,e){if(n.indexOf)return n.indexOf(e);for(var t=0,r=n.length;t<r;t++)if(n[t]===e)return t;return-1}function O_(n){if(!ga||!n||typeof n!="object")return!1;try{ga.call(n);try{ma.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function M_(n){if(!os||!n||typeof n!="object")return!1;try{os.call(n,os);try{as.call(n,as)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function N_(n){if(!qd||!n||typeof n!="object")return!1;try{return qd.call(n),!0}catch{}return!1}function U_(n){if(!ma||!n||typeof n!="object")return!1;try{ma.call(n);try{ga.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function F_(n){if(!as||!n||typeof n!="object")return!1;try{as.call(n,as);try{os.call(n,os)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function Z_(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function Og(n,e){if(n.length>e.maxStringLength){var t=n.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return Og(qu.call(n,0,e.maxStringLength),e)+r}var i=A_[e.quoteStyle||"single"];i.lastIndex=0;var s=En.call(En.call(n,i,"\\$1"),/[\x00-\x1f]/g,W_);return Dg(s,"single",e)}function W_(n){var e=n.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+E_.call(e.toString(16))}function Wi(n){return"Object("+n+")"}function Jl(n){return n+" { ? }"}function rp(n,e,t,r){var i=r?Oc(t,r):Lt.call(t,", ");return n+" ("+e+") {"+i+"}"}function H_(n){for(var e=0;e<n.length;e++)if(zg(n[e],`
|
|
2
|
-
`)>=0)return!1;return!0}function
|
|
1
|
+
var Zb=Object.defineProperty;var ud=n=>{throw TypeError(n)};var Wb=(n,e,t)=>e in n?Zb(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var b=(n,e,t)=>Wb(n,typeof e!="symbol"?e+"":e,t),Dl=(n,e,t)=>e.has(n)||ud("Cannot "+t);var l=(n,e,t)=>(Dl(n,e,"read from private field"),t?t.call(n):e.get(n)),w=(n,e,t)=>e.has(n)?ud("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),k=(n,e,t,r)=>(Dl(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),f=(n,e,t)=>(Dl(n,e,"access private method"),t);var hd=(n,e,t,r)=>({set _(i){k(n,e,i,t)},get _(){return l(n,e,r)}});(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.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 t(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=t(i);fetch(i.href,s)}})();var Vn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Hb(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var dd=Object.prototype.toString,sg=function(e){var t=dd.call(e),r=t==="[object Arguments]";return r||(r=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&dd.call(e.callee)==="[object Function]"),r},Ll,pd;function Vb(){if(pd)return Ll;pd=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=sg,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 m=v.constructor;return m&&m.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]&&e.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(m){var x=m!==null&&typeof m=="object",E=t.call(m)==="[object Function]",T=r(m),O=x&&t.call(m)==="[object String]",P=[];if(!x&&!E&&!T)throw new TypeError("Object.keys called on a non-object");var V=o&&E;if(O&&m.length>0&&!e.call(m,0))for(var F=0;F<m.length;++F)P.push(String(F));if(T&&m.length>0)for(var B=0;B<m.length;++B)P.push(String(B));else for(var U in m)!(V&&U==="prototype")&&e.call(m,U)&&P.push(String(U));if(s)for(var Q=p(m),j=0;j<a.length;++j)!(Q&&a[j]==="constructor")&&e.call(m,a[j])&&P.push(a[j]);return P}}return Ll=n,Ll}var Bb=Array.prototype.slice,Gb=sg,fd=Object.keys,Yo=fd?function(e){return fd(e)}:Vb(),gd=Object.keys;Yo.shim=function(){if(Object.keys){var e=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);e||(Object.keys=function(r){return Gb(r)?gd(Bb.call(r)):gd(r)})}else Object.keys=Yo;return Object.keys||Yo};var jb=Yo,Xo=Object.defineProperty||!1;if(Xo)try{Xo({},"a",{value:1})}catch{Xo=!1}var oo=Xo,tn=SyntaxError,K=TypeError,qb=Object.getOwnPropertyDescriptor,Ko=qb;if(Ko)try{Ko([],"length")}catch{Ko=null}var $i=Ko,md=oo,Yb=tn,zr=K,vd=$i,og=function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new zr("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new zr("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new zr("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new zr("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new zr("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new zr("`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=!!vd&&vd(e,t);if(md)md(e,t,{configurable:o===null&&c?c.configurable:!o,enumerable:i===null&&c?c.enumerable:!i,value:r,writable:s===null&&c?c.writable:!s});else if(a||!i&&!s&&!o)e[t]=r;else throw new Yb("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Tc=oo,ag=function(){return!!Tc};ag.hasArrayLengthDefineBug=function(){if(!Tc)return null;try{return Tc([],"length",{value:1}).length!==1}catch{return!0}};var tl=ag,Xb=jb,Kb=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Jb=Object.prototype.toString,Qb=Array.prototype.concat,yd=og,ew=function(n){return typeof n=="function"&&Jb.call(n)==="[object Function]"},lg=tl(),tw=function(n,e,t,r){if(e in n){if(r===!0){if(n[e]===t)return}else if(!ew(r)||!r())return}lg?yd(n,e,t,!0):yd(n,e,t)},cg=function(n,e){var t=arguments.length>2?arguments[2]:{},r=Xb(e);Kb&&(r=Qb.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i<r.length;i+=1)tw(n,r[i],e[r[i]],t[r[i]])};cg.supportsDescriptors=!!lg;var xr=cg,Jo={exports:{}};typeof self<"u"?Jo.exports=self:typeof window<"u"?Jo.exports=window:Jo.exports=Function("return this")();var ug=Jo.exports,nw=ug,hg=function(){return typeof Vn!="object"||!Vn||Vn.Math!==Math||Vn.Array!==Array?nw:Vn},rw=xr,iw=$i,sw=hg,ow=function(){var e=sw();if(rw.supportsDescriptors){var t=iw(e,"globalThis");(!t||t.configurable&&(t.enumerable||!t.writable||globalThis!==e))&&Object.defineProperty(e,"globalThis",{configurable:!0,enumerable:!1,value:e,writable:!0})}else(typeof globalThis!="object"||globalThis!==e)&&(e.globalThis=e);return e},aw=xr,lw=ug,dg=hg,cw=ow,uw=dg(),pg=function(){return uw};aw(pg,{getPolyfill:dg,implementation:lw,shim:cw});var Lu=pg,nn=function(e){return!!e&&(typeof e=="function"||typeof e=="object")},zu=Object,fg=Error,hw=EvalError,dw=RangeError,Ou=ReferenceError,pw=URIError,fw=Math.abs,gw=Math.floor,mw=Math.max,vw=Math.min,yw=Math.pow,bw=Math.round,Mu=Number.isNaN||function(e){return e!==e},ww=Mu,Sw=function(e){return ww(e)||e===0?e:e<0?-1:1},Ii=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),r=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==i||a.enumerable!==!0)return!1}return!0},bd=typeof Symbol<"u"&&Symbol,_w=Ii,Nu=function(){return typeof bd!="function"||typeof Symbol!="function"||typeof bd("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:_w()},zl,wd;function gg(){return wd||(wd=1,zl=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),zl}var Ol,Sd;function mg(){if(Sd)return Ol;Sd=1;var n=zu;return Ol=n.getPrototypeOf||null,Ol}var kw="Function.prototype.bind called on incompatible ",Ew=Object.prototype.toString,xw=Math.max,Aw="[object Function]",_d=function(e,t){for(var r=[],i=0;i<e.length;i+=1)r[i]=e[i];for(var s=0;s<t.length;s+=1)r[s+e.length]=t[s];return r},$w=function(e,t){for(var r=[],i=t,s=0;i<e.length;i+=1,s+=1)r[s]=e[i];return r},Iw=function(n,e){for(var t="",r=0;r<n.length;r+=1)t+=n[r],r+1<n.length&&(t+=e);return t},Tw=function(e){var t=this;if(typeof t!="function"||Ew.apply(t)!==Aw)throw new TypeError(kw+t);for(var r=$w(arguments,1),i,s=function(){if(this instanceof i){var h=t.apply(this,_d(r,arguments));return Object(h)===h?h:this}return t.apply(e,_d(r,arguments))},o=xw(0,t.length-r.length),a=[],c=0;c<o;c++)a[c]="$"+c;if(i=Function("binder","return function ("+Iw(a,",")+"){ return binder.apply(this,arguments); }")(s),t.prototype){var u=function(){};u.prototype=t.prototype,i.prototype=new u,u.prototype=null}return i},Cw=Tw,ao=Function.prototype.bind||Cw,Uu=Function.prototype.call,Fu=Function.prototype.apply,Pw=typeof Reflect<"u"&&Reflect&&Reflect.apply,Rw=ao,Dw=Fu,Lw=Uu,zw=Pw,vg=zw||Rw.call(Lw,Dw),Ow=ao,Mw=K,Nw=Uu,Uw=vg,nl=function(e){if(e.length<1||typeof e[0]!="function")throw new Mw("a function is required");return Uw(Ow,Nw,e)},Ml,kd;function Fw(){if(kd)return Ml;kd=1;var n=nl,e=$i,t;try{t=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var r=!!t&&e&&e(Object.prototype,"__proto__"),i=Object,s=i.getPrototypeOf;return Ml=r&&typeof r.get=="function"?n([r.get]):typeof s=="function"?function(a){return s(a==null?a:i(a))}:!1,Ml}var Nl,Ed;function yg(){if(Ed)return Nl;Ed=1;var n=gg(),e=mg(),t=Fw();return Nl=n?function(i){return n(i)}:e?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return e(i)}:t?function(i){return t(i)}:null,Nl}var Zw=Function.prototype.call,Ww=Object.prototype.hasOwnProperty,Hw=ao,rn=Hw.call(Zw,Ww),X,Vw=zu,Bw=fg,Gw=hw,jw=dw,qw=Ou,Si=tn,Qr=K,Yw=pw,Xw=fw,Kw=gw,Jw=mw,Qw=vw,e0=yw,t0=bw,n0=Sw,bg=Function,Ul=function(n){try{return bg('"use strict"; return ('+n+").constructor;")()}catch{}},ds=$i,r0=oo,Fl=function(){throw new Qr},i0=ds?function(){try{return arguments.callee,Fl}catch{try{return ds(arguments,"callee").get}catch{return Fl}}}():Fl,Or=Nu(),Ie=yg(),s0=mg(),o0=gg(),wg=Fu,lo=Uu,Zr={},a0=typeof Uint8Array>"u"||!Ie?X:Ie(Uint8Array),yr={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?X:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?X:ArrayBuffer,"%ArrayIteratorPrototype%":Or&&Ie?Ie([][Symbol.iterator]()):X,"%AsyncFromSyncIteratorPrototype%":X,"%AsyncFunction%":Zr,"%AsyncGenerator%":Zr,"%AsyncGeneratorFunction%":Zr,"%AsyncIteratorPrototype%":Zr,"%Atomics%":typeof Atomics>"u"?X:Atomics,"%BigInt%":typeof BigInt>"u"?X:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?X:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?X:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?X:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Bw,"%eval%":eval,"%EvalError%":Gw,"%Float16Array%":typeof Float16Array>"u"?X:Float16Array,"%Float32Array%":typeof Float32Array>"u"?X:Float32Array,"%Float64Array%":typeof Float64Array>"u"?X:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?X:FinalizationRegistry,"%Function%":bg,"%GeneratorFunction%":Zr,"%Int8Array%":typeof Int8Array>"u"?X:Int8Array,"%Int16Array%":typeof Int16Array>"u"?X:Int16Array,"%Int32Array%":typeof Int32Array>"u"?X:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Or&&Ie?Ie(Ie([][Symbol.iterator]())):X,"%JSON%":typeof JSON=="object"?JSON:X,"%Map%":typeof Map>"u"?X:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Or||!Ie?X:Ie(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Vw,"%Object.getOwnPropertyDescriptor%":ds,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?X:Promise,"%Proxy%":typeof Proxy>"u"?X:Proxy,"%RangeError%":jw,"%ReferenceError%":qw,"%Reflect%":typeof Reflect>"u"?X:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?X:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Or||!Ie?X:Ie(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?X:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Or&&Ie?Ie(""[Symbol.iterator]()):X,"%Symbol%":Or?Symbol:X,"%SyntaxError%":Si,"%ThrowTypeError%":i0,"%TypedArray%":a0,"%TypeError%":Qr,"%Uint8Array%":typeof Uint8Array>"u"?X:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?X:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?X:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?X:Uint32Array,"%URIError%":Yw,"%WeakMap%":typeof WeakMap>"u"?X:WeakMap,"%WeakRef%":typeof WeakRef>"u"?X:WeakRef,"%WeakSet%":typeof WeakSet>"u"?X:WeakSet,"%Function.prototype.call%":lo,"%Function.prototype.apply%":wg,"%Object.defineProperty%":r0,"%Object.getPrototypeOf%":s0,"%Math.abs%":Xw,"%Math.floor%":Kw,"%Math.max%":Jw,"%Math.min%":Qw,"%Math.pow%":e0,"%Math.round%":t0,"%Math.sign%":n0,"%Reflect.getPrototypeOf%":o0};if(Ie)try{null.error}catch(n){var l0=Ie(Ie(n));yr["%Error.prototype%"]=l0}var c0=function n(e){var t;if(e==="%AsyncFunction%")t=Ul("async function () {}");else if(e==="%GeneratorFunction%")t=Ul("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Ul("async function* () {}");else if(e==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&Ie&&(t=Ie(i.prototype))}return yr[e]=t,t},xd={__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"]},co=ao,fa=rn,u0=co.call(lo,Array.prototype.concat),h0=co.call(wg,Array.prototype.splice),Ad=co.call(lo,String.prototype.replace),ga=co.call(lo,String.prototype.slice),d0=co.call(lo,RegExp.prototype.exec),p0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,f0=/\\(\\)?/g,g0=function(e){var t=ga(e,0,1),r=ga(e,-1);if(t==="%"&&r!=="%")throw new Si("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new Si("invalid intrinsic syntax, expected opening `%`");var i=[];return Ad(e,p0,function(s,o,a,c){i[i.length]=a?Ad(c,f0,"$1"):o||s}),i},m0=function(e,t){var r=e,i;if(fa(xd,r)&&(i=xd[r],r="%"+i[0]+"%"),fa(yr,r)){var s=yr[r];if(s===Zr&&(s=c0(r)),typeof s>"u"&&!t)throw new Qr("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new Si("intrinsic "+e+" does not exist!")},ut=function(e,t){if(typeof e!="string"||e.length===0)throw new Qr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Qr('"allowMissing" argument must be a boolean');if(d0(/^%?[^%]*%?$/,e)===null)throw new Si("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=g0(e),i=r.length>0?r[0]:"",s=m0("%"+i+"%",t),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],h0(r,u0([0,1],u)));for(var h=1,p=!0;h<r.length;h+=1){var v=r[h],m=ga(v,0,1),x=ga(v,-1);if((m==='"'||m==="'"||m==="`"||x==='"'||x==="'"||x==="`")&&m!==x)throw new Si("property names with quotes must have matching quotes");if((v==="constructor"||!p)&&(c=!0),i+="."+v,o="%"+i+"%",fa(yr,o))a=yr[o];else if(a!=null){if(!(v in a)){if(!t)throw new Qr("base intrinsic for "+e+" exists, but the property is not available.");return}if(ds&&h+1>=r.length){var E=ds(a,v);p=!!E,p&&"get"in E&&!("originalValue"in E.get)?a=E.get:a=a[v]}else p=fa(a,v),a=a[v];p&&!c&&(yr[o]=a)}}return a},Zl,$d;function Pn(){if($d)return Zl;$d=1;var n=ut,e=nl,t=e([n("%String.prototype.indexOf%")]);return Zl=function(i,s){var o=n(i,!!s);return typeof o=="function"&&t(i,".prototype.")>-1?e([o]):o},Zl}var Wl,Id;function Zu(){if(Id)return Wl;Id=1;var n=ut,e=n("%Array%"),t=!e.isArray&&Pn()("Object.prototype.toString");return Wl=e.isArray||function(i){return t(i)==="[object Array]"},Wl}var v0=tl,Td=oo,Sg=v0.hasArrayLengthDefineBug(),y0=Sg&&Zu(),b0=Pn(),w0=b0("Object.prototype.propertyIsEnumerable"),Wu=function(e,t,r,i,s,o){if(!Td){if(!e(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&w0(i,s)!==!!o["[[Enumerable]]"])return!1;var a=o["[[Value]]"];return i[s]=a,t(i[s],a)}return Sg&&s==="length"&&"[[Value]]"in o&&y0(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(Td(i,s,r(o)),!0)},S0=K,Wi=rn,_0={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},Ti=function(e){if(!e||typeof e!="object")return!1;for(var t in e)if(Wi(e,t)&&!_0[t])return!1;var r=Wi(e,"[[Value]]")||Wi(e,"[[Writable]]"),i=Wi(e,"[[Get]]")||Wi(e,"[[Set]]");if(r&&i)throw new S0("Property Descriptors may not be both accessor and data descriptors");return!0},_g=function(e){if(typeof e>"u")return e;var t={};return"[[Value]]"in e&&(t.value=e["[[Value]]"]),"[[Writable]]"in e&&(t.writable=!!e["[[Writable]]"]),"[[Get]]"in e&&(t.get=e["[[Get]]"]),"[[Set]]"in e&&(t.set=e["[[Set]]"]),"[[Enumerable]]"in e&&(t.enumerable=!!e["[[Enumerable]]"]),"[[Configurable]]"in e&&(t.configurable=!!e["[[Configurable]]"]),t},k0=K,E0=Ti,x0=_g,kg=function(e){if(typeof e<"u"&&!E0(e))throw new k0("Assertion failed: `Desc` must be a Property Descriptor");return x0(e)},A0=K,Cd=rn,$0=Ti,Eg=function(e){if(typeof e>"u")return!1;if(!$0(e))throw new A0("Assertion failed: `Desc` must be a Property Descriptor");return!(!Cd(e,"[[Value]]")&&!Cd(e,"[[Writable]]"))},Ci=function(e){return typeof e=="string"||typeof e=="symbol"},Pd=Mu,xg=function(e,t){return e===t?e===0?1/e===1/t:!0:Pd(e)&&Pd(t)},Rd=K,I0=nn,T0=Wu,C0=kg,P0=Eg,R0=Ci,D0=xg,Hu=function(e,t,r){if(!I0(e))throw new Rd("Assertion failed: Type(O) is not Object");if(!R0(t))throw new Rd("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return T0(P0,D0,C0,e,t,i)},Ag=Function.prototype.toString,Yr=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Cc,Qo;if(typeof Yr=="function"&&typeof Object.defineProperty=="function")try{Cc=Object.defineProperty({},"length",{get:function(){throw Qo}}),Qo={},Yr(function(){throw 42},null,Cc)}catch(n){n!==Qo&&(Yr=null)}else Yr=null;var L0=/^\s*class\b/,Pc=function(e){try{var t=Ag.call(e);return L0.test(t)}catch{return!1}},Hl=function(e){try{return Pc(e)?!1:(Ag.call(e),!0)}catch{return!1}},ea=Object.prototype.toString,z0="[object Object]",O0="[object Function]",M0="[object GeneratorFunction]",N0="[object HTMLAllCollection]",U0="[object HTML document.all class]",F0="[object HTMLCollection]",Z0=typeof Symbol=="function"&&!!Symbol.toStringTag,W0=!(0 in[,]),Rc=function(){return!1};if(typeof document=="object"){var H0=document.all;ea.call(H0)===ea.call(document.all)&&(Rc=function(e){if((W0||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=ea.call(e);return(t===N0||t===U0||t===F0||t===z0)&&e("")==null}catch{}return!1})}var $g=Yr?function(e){if(Rc(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Yr(e,null,Cc)}catch(t){if(t!==Qo)return!1}return!Pc(e)&&Hl(e)}:function(e){if(Rc(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(Z0)return Hl(e);if(Pc(e))return!1;var t=ea.call(e);return t!==O0&&t!==M0&&!/^\[object HTML/.test(t)?!1:Hl(e)},V0=$g,B0=function(e){return!!e},Et=rn,Co=K,G0=nn,Dd=V0,Vl=B0,j0=function(e){if(!G0(e))throw new Co("ToPropertyDescriptor requires an object");var t={};if(Et(e,"enumerable")&&(t["[[Enumerable]]"]=Vl(e.enumerable)),Et(e,"configurable")&&(t["[[Configurable]]"]=Vl(e.configurable)),Et(e,"value")&&(t["[[Value]]"]=e.value),Et(e,"writable")&&(t["[[Writable]]"]=Vl(e.writable)),Et(e,"get")){var r=e.get;if(typeof r<"u"&&!Dd(r))throw new Co("getter must be a function");t["[[Get]]"]=r}if(Et(e,"set")){var i=e.set;if(typeof i<"u"&&!Dd(i))throw new Co("setter must be a function");t["[[Set]]"]=i}if((Et(t,"[[Get]]")||Et(t,"[[Set]]"))&&(Et(t,"[[Value]]")||Et(t,"[[Writable]]")))throw new Co("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},Bl=K,q0=nn,Ld=Ti,Y0=Wu,X0=kg,K0=Eg,J0=Ci,Q0=xg,eS=j0,tS=function(e,t,r){if(!q0(e))throw new Bl("Assertion failed: Type(O) is not Object");if(!J0(t))throw new Bl("Assertion failed: P is not a Property Key");var i=Ld(r)?r:eS(r);if(!Ld(i))throw new Bl("Assertion failed: Desc is not a valid Property Descriptor");return Y0(K0,Q0,X0,e,t,i)},zd=K,nS=nn,rS=tS,iS=Ci,sS=function(e,t,r){if(!nS(e))throw new zd("Assertion failed: Type(O) is not Object");if(!iS(t))throw new zd("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return rS(e,t,i)},oS=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,aS=zu,lS=aS.setPrototypeOf||null,cS=nl,Od=$i,uS=K,Ig={};try{Ig.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var hS=!("toString"in Ig),Gl=Od&&Od(Object.prototype,"__proto__"),dS=hS&&(!!Gl&&typeof Gl.set=="function"&&cS([Gl.set])||function(e,t){if(e==null)throw new uS("set Object.prototype.__proto__ called on null or undefined");return e.__proto__=t,t}),Md=oS,pS=lS,Nd=dS,fS=K,gS=Md?function(e,t){if(Md(e,t))return e;throw new fS("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:pS||(Nd?function(e,t){return Nd(e,t),e}:null),Ud=K,mS=nn,Fd=yg(),vS=function(e){if(!mS(e))throw new Ud("Assertion failed: O must be an Object");if(!Fd)throw new Ud("This environment does not support fetching prototypes.");return Fd(e)},yS=K,bS=gS,wS=nn,SS=vS,_S=function(e,t){if(t!==null&&!wS(t))throw new yS("Assertion failed: V must be Object or Null");try{bS(e,t)}catch{return!1}return SS(e)===t},jl=Hu,Zd=sS,Tg=_S,kS=tl(),Vu=fg;function uo(n,e,t){var r=new Vu(t);return Tg(r,ta),delete r.constructor,Zd(r,"error",n),Zd(r,"suppressed",e),r}kS&&Object.defineProperty(uo,"prototype",{writable:!1});var ta=uo.prototype;if(!jl(ta,"constructor",uo)||!jl(ta,"message","")||!jl(ta,"name","SuppressedError"))throw new Vu("unable to install SuppressedError.prototype properties; please report this!");Tg(uo.prototype,Vu.prototype);var ES=uo,xS=ES,Cg=function(){return typeof SuppressedError=="function"?SuppressedError:xS},AS=xr,Wd=Lu(),$S=Cg,IS=function(){var e=$S();return AS(Wd,{SuppressedError:e},{SuppressedError:function(){return Wd.SuppressedError!==e}}),e};IS();var TS=K,CS=Ti,PS=_g,RS=function(e){if(typeof e<"u"&&!CS(e))throw new TS("Assertion failed: `Desc` must be a Property Descriptor");return PS(e)},DS=K,Hd=rn,LS=Ti,zS=function(e){if(typeof e>"u")return!1;if(!LS(e))throw new DS("Assertion failed: `Desc` must be a Property Descriptor");return!(!Hd(e,"[[Value]]")&&!Hd(e,"[[Writable]]"))},Vd=Mu,OS=function(e,t){return e===t?e===0?1/e===1/t:!0:Vd(e)&&Vd(t)},Pi=$g,MS=function(e){return!!e},xt=rn,Po=K,NS=nn,Bd=Pi,ql=MS,US=function(e){if(!NS(e))throw new Po("ToPropertyDescriptor requires an object");var t={};if(xt(e,"enumerable")&&(t["[[Enumerable]]"]=ql(e.enumerable)),xt(e,"configurable")&&(t["[[Configurable]]"]=ql(e.configurable)),xt(e,"value")&&(t["[[Value]]"]=e.value),xt(e,"writable")&&(t["[[Writable]]"]=ql(e.writable)),xt(e,"get")){var r=e.get;if(typeof r<"u"&&!Bd(r))throw new Po("getter must be a function");t["[[Get]]"]=r}if(xt(e,"set")){var i=e.set;if(typeof i<"u"&&!Bd(i))throw new Po("setter must be a function");t["[[Set]]"]=i}if((xt(t,"[[Get]]")||xt(t,"[[Set]]"))&&(xt(t,"[[Value]]")||xt(t,"[[Writable]]")))throw new Po("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},Yl=K,FS=nn,Gd=Ti,ZS=Wu,WS=RS,HS=zS,VS=Ci,BS=OS,GS=US,ho=function(e,t,r){if(!FS(e))throw new Yl("Assertion failed: Type(O) is not Object");if(!VS(t))throw new Yl("Assertion failed: P is not a Property Key");var i=Gd(r)?r:GS(r);if(!Gd(i))throw new Yl("Assertion failed: Desc is not a valid Property Descriptor");return ZS(HS,BS,WS,e,t,i)},jS=Ii(),qS=jS?Symbol.dispose||Symbol("Symbol.dispose"):null,YS=Ii,XS=qS,Bu=function(){return YS()&&Symbol.dispose||XS},KS=Nu,JS=ho,QS=Bu,e_=function(){var e=QS();return KS()&&JS(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},t_=Ii(),n_=t_?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,r_=Ii,i_=n_,Gu=function(){return r_()&&Symbol.asyncDispose||i_},s_=Nu,o_=ho,a_=Gu,l_=function(){var e=a_();return s_()&&o_(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},c_=Zu(),u_=ut,h_=Pn(),d_=K,p_=c_,f_=u_("%Reflect.apply%",!0)||h_("Function.prototype.apply"),rl=function(e,t){var r=arguments.length>2?arguments[2]:[];if(!p_(r))throw new d_("Assertion failed: optional `argumentsList`, if provided, must be a List");return f_(e,t,r)};const g_={},m_=Object.freeze(Object.defineProperty({__proto__:null,default:g_},Symbol.toStringTag,{value:"Module"})),v_=Hb(m_);var ju=typeof Map=="function"&&Map.prototype,Xl=Object.getOwnPropertyDescriptor&&ju?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ma=ju&&Xl&&typeof Xl.get=="function"?Xl.get:null,jd=ju&&Map.prototype.forEach,qu=typeof Set=="function"&&Set.prototype,Kl=Object.getOwnPropertyDescriptor&&qu?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,va=qu&&Kl&&typeof Kl.get=="function"?Kl.get:null,qd=qu&&Set.prototype.forEach,y_=typeof WeakMap=="function"&&WeakMap.prototype,as=y_?WeakMap.prototype.has:null,b_=typeof WeakSet=="function"&&WeakSet.prototype,ls=b_?WeakSet.prototype.has:null,w_=typeof WeakRef=="function"&&WeakRef.prototype,Yd=w_?WeakRef.prototype.deref:null,S_=Boolean.prototype.valueOf,__=Object.prototype.toString,k_=Function.prototype.toString,E_=String.prototype.match,Yu=String.prototype.slice,En=String.prototype.replace,x_=String.prototype.toUpperCase,Xd=String.prototype.toLowerCase,Pg=RegExp.prototype.test,Kd=Array.prototype.concat,Lt=Array.prototype.join,A_=Array.prototype.slice,Jd=Math.floor,Dc=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Jl=Object.getOwnPropertySymbols,Lc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,_i=typeof Symbol=="function"&&typeof Symbol.iterator=="object",cs=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===_i||!0)?Symbol.toStringTag:null,Rg=Object.prototype.propertyIsEnumerable,Qd=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function ep(n,e){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||Pg.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-Jd(-n):Jd(n);if(r!==n){var i=String(r),s=Yu.call(e,i.length+1);return En.call(i,t,"$&_")+"."+En.call(En.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return En.call(e,t,"$&_")}var zc=v_,tp=zc.custom,np=zg(tp)?tp:null,Dg={__proto__:null,double:'"',single:"'"},$_={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Ri=function n(e,t,r,i){var s=t||{};if(Vt(s,"quoteStyle")&&!Vt(Dg,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Vt(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=Vt(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(Vt(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(Vt(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Mg(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return a?ep(e,c):c}if(typeof e=="bigint"){var u=String(e)+"n";return a?ep(e,u):u}var h=typeof s.depth>"u"?5:s.depth;if(typeof r>"u"&&(r=0),r>=h&&h>0&&typeof e=="object")return Oc(e)?"[Array]":"[Object]";var p=B_(s,r);if(typeof i>"u")i=[];else if(Og(i,e)>=0)return"[Circular]";function v(St,on,Sl){if(on&&(i=A_.call(i),i.push(on)),Sl){var So={depth:s.depth};return Vt(s,"quoteStyle")&&(So.quoteStyle=s.quoteStyle),n(St,So,r+1,i)}return n(St,s,r+1,i)}if(typeof e=="function"&&!rp(e)){var m=O_(e),x=Ro(e,v);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(x.length>0?" { "+Lt.call(x,", ")+" }":"")}if(zg(e)){var E=_i?En.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Lc.call(e);return typeof e=="object"&&!_i?Hi(E):E}if(W_(e)){for(var T="<"+Xd.call(String(e.nodeName)),O=e.attributes||[],P=0;P<O.length;P++)T+=" "+O[P].name+"="+Lg(I_(O[P].value),"double",s);return T+=">",e.childNodes&&e.childNodes.length&&(T+="..."),T+="</"+Xd.call(String(e.nodeName))+">",T}if(Oc(e)){if(e.length===0)return"[]";var V=Ro(e,v);return p&&!V_(V)?"["+Mc(V,p)+"]":"[ "+Lt.call(V,", ")+" ]"}if(C_(e)){var F=Ro(e,v);return!("cause"in Error.prototype)&&"cause"in e&&!Rg.call(e,"cause")?"{ ["+String(e)+"] "+Lt.call(Kd.call("[cause]: "+v(e.cause),F),", ")+" }":F.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Lt.call(F,", ")+" }"}if(typeof e=="object"&&o){if(np&&typeof e[np]=="function"&&zc)return zc(e,{depth:h-r});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(M_(e)){var B=[];return jd&&jd.call(e,function(St,on){B.push(v(on,e,!0)+" => "+v(St,e))}),ip("Map",ma.call(e),B,p)}if(F_(e)){var U=[];return qd&&qd.call(e,function(St){U.push(v(St,e))}),ip("Set",va.call(e),U,p)}if(N_(e))return Ql("WeakMap");if(Z_(e))return Ql("WeakSet");if(U_(e))return Ql("WeakRef");if(R_(e))return Hi(v(Number(e)));if(L_(e))return Hi(v(Dc.call(e)));if(D_(e))return Hi(S_.call(e));if(P_(e))return Hi(v(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof Vn<"u"&&e===Vn)return"{ [object globalThis] }";if(!T_(e)&&!rp(e)){var Q=Ro(e,v),j=Qd?Qd(e)===Object.prototype:e instanceof Object||e.constructor===Object,rt=e instanceof Object?"":"null prototype",Mt=!j&&cs&&Object(e)===e&&cs in e?Yu.call(Rn(e),8,-1):rt?"Object":"",ke=j||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",zn=ke+(Mt||rt?"["+Lt.call(Kd.call([],Mt||[],rt||[]),": ")+"] ":"");return Q.length===0?zn+"{}":p?zn+"{"+Mc(Q,p)+"}":zn+"{ "+Lt.call(Q,", ")+" }"}return String(e)};function Lg(n,e,t){var r=t.quoteStyle||e,i=Dg[r];return i+n+i}function I_(n){return En.call(String(n),/"/g,""")}function Ar(n){return!cs||!(typeof n=="object"&&(cs in n||typeof n[cs]<"u"))}function Oc(n){return Rn(n)==="[object Array]"&&Ar(n)}function T_(n){return Rn(n)==="[object Date]"&&Ar(n)}function rp(n){return Rn(n)==="[object RegExp]"&&Ar(n)}function C_(n){return Rn(n)==="[object Error]"&&Ar(n)}function P_(n){return Rn(n)==="[object String]"&&Ar(n)}function R_(n){return Rn(n)==="[object Number]"&&Ar(n)}function D_(n){return Rn(n)==="[object Boolean]"&&Ar(n)}function zg(n){if(_i)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!Lc)return!1;try{return Lc.call(n),!0}catch{}return!1}function L_(n){if(!n||typeof n!="object"||!Dc)return!1;try{return Dc.call(n),!0}catch{}return!1}var z_=Object.prototype.hasOwnProperty||function(n){return n in this};function Vt(n,e){return z_.call(n,e)}function Rn(n){return __.call(n)}function O_(n){if(n.name)return n.name;var e=E_.call(k_.call(n),/^function\s*([\w$]+)/);return e?e[1]:null}function Og(n,e){if(n.indexOf)return n.indexOf(e);for(var t=0,r=n.length;t<r;t++)if(n[t]===e)return t;return-1}function M_(n){if(!ma||!n||typeof n!="object")return!1;try{ma.call(n);try{va.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function N_(n){if(!as||!n||typeof n!="object")return!1;try{as.call(n,as);try{ls.call(n,ls)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function U_(n){if(!Yd||!n||typeof n!="object")return!1;try{return Yd.call(n),!0}catch{}return!1}function F_(n){if(!va||!n||typeof n!="object")return!1;try{va.call(n);try{ma.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function Z_(n){if(!ls||!n||typeof n!="object")return!1;try{ls.call(n,ls);try{as.call(n,as)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function W_(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function Mg(n,e){if(n.length>e.maxStringLength){var t=n.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return Mg(Yu.call(n,0,e.maxStringLength),e)+r}var i=$_[e.quoteStyle||"single"];i.lastIndex=0;var s=En.call(En.call(n,i,"\\$1"),/[\x00-\x1f]/g,H_);return Lg(s,"single",e)}function H_(n){var e=n.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+x_.call(e.toString(16))}function Hi(n){return"Object("+n+")"}function Ql(n){return n+" { ? }"}function ip(n,e,t,r){var i=r?Mc(t,r):Lt.call(t,", ");return n+" ("+e+") {"+i+"}"}function V_(n){for(var e=0;e<n.length;e++)if(Og(n[e],`
|
|
2
|
+
`)>=0)return!1;return!0}function B_(n,e){var t;if(n.indent===" ")t=" ";else if(typeof n.indent=="number"&&n.indent>0)t=Lt.call(Array(n.indent+1)," ");else return null;return{base:t,prev:Lt.call(Array(e+1),t)}}function Mc(n,e){if(n.length===0)return"";var t=`
|
|
3
3
|
`+e.prev+e.base;return t+Lt.call(n,","+t)+`
|
|
4
|
-
`+e.prev}function Po(n,e){var t=zc(n),r=[];if(t){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=Vt(n,i)?e(n[i],n):""}var s=typeof Kl=="function"?Kl(n):[],o;if(Si){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var c in n)Vt(n,c)&&(t&&String(Number(c))===c&&c<n.length||Si&&o["$"+c]instanceof Symbol||(Cg.call(/[^\w$]/,c)?r.push(e(c,n)+": "+e(n[c],n)):r.push(c+": "+e(n[c],n))));if(typeof Kl=="function")for(var u=0;u<s.length;u++)Pg.call(n,s[u])&&r.push("["+e(s[u])+"]: "+e(n[s[u]],n));return r}var B_=Pi,G_=K,rl=function(n,e,t){for(var r=n,i;(i=r.next)!=null;r=i)if(i.key===e)return r.next=i.next,t||(i.next=n.next,n.next=i),i},j_=function(n,e){if(n){var t=rl(n,e);return t&&t.value}},q_=function(n,e,t){var r=rl(n,e);r?r.value=t:n.next={key:e,next:n.next,value:t}},Y_=function(n,e){return n?!!rl(n,e):!1},X_=function(n,e){if(n)return rl(n,e,!0)},K_=function(){var e,t={assert:function(r){if(!t.has(r))throw new G_("Side channel does not contain "+B_(r))},delete:function(r){var i=e&&e.next,s=X_(e,r);return s&&i&&i===s&&(e=void 0),!!s},get:function(r){return j_(e,r)},has:function(r){return Y_(e,r)},set:function(r,i){e||(e={next:void 0}),q_(e,r,i)}};return t},J_=ut,ho=Pn(),Q_=Pi,ek=K,ip=J_("%Map%",!0),tk=ho("Map.prototype.get",!0),nk=ho("Map.prototype.set",!0),rk=ho("Map.prototype.has",!0),ik=ho("Map.prototype.delete",!0),sk=ho("Map.prototype.size",!0),Mg=!!ip&&function(){var e,t={assert:function(r){if(!t.has(r))throw new ek("Side channel does not contain "+Q_(r))},delete:function(r){if(e){var i=ik(e,r);return sk(e)===0&&(e=void 0),i}return!1},get:function(r){if(e)return tk(e,r)},has:function(r){return e?rk(e,r):!1},set:function(r,i){e||(e=new ip),nk(e,r,i)}};return t},ok=ut,il=Pn(),ak=Pi,Ro=Mg,lk=K,Mr=ok("%WeakMap%",!0),ck=il("WeakMap.prototype.get",!0),uk=il("WeakMap.prototype.set",!0),hk=il("WeakMap.prototype.has",!0),dk=il("WeakMap.prototype.delete",!0),pk=Mr?function(){var e,t,r={assert:function(i){if(!r.has(i))throw new lk("Side channel does not contain "+ak(i))},delete:function(i){if(Mr&&i&&(typeof i=="object"||typeof i=="function")){if(e)return dk(e,i)}else if(Ro&&t)return t.delete(i);return!1},get:function(i){return Mr&&i&&(typeof i=="object"||typeof i=="function")&&e?ck(e,i):t&&t.get(i)},has:function(i){return Mr&&i&&(typeof i=="object"||typeof i=="function")&&e?hk(e,i):!!t&&t.has(i)},set:function(i,s){Mr&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Mr),uk(e,i,s)):Ro&&(t||(t=Ro()),t.set(i,s))}};return r}:Ro,fk=K,gk=Pi,mk=K_,vk=Mg,yk=pk,bk=yk||vk||mk,wk=function(){var e,t={assert:function(r){if(!t.has(r))throw new fk("Side channel does not contain "+gk(r))},delete:function(r){return!!e&&e.delete(r)},get:function(r){return e&&e.get(r)},has:function(r){return!!e&&e.has(r)},set:function(r,i){e||(e=bk()),e.set(r,i)}};return t},Sk=rn,Hi=wk(),Zt=K,Yu={assert:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Zt("`O` is not an object");if(typeof e!="string")throw new Zt("`slot` must be a string");if(Hi.assert(n),!Yu.has(n,e))throw new Zt("`"+e+"` is not present on `O`")},get:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Zt("`O` is not an object");if(typeof e!="string")throw new Zt("`slot` must be a string");var t=Hi.get(n);return t&&t["$"+e]},has:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Zt("`O` is not an object");if(typeof e!="string")throw new Zt("`slot` must be a string");var t=Hi.get(n);return!!t&&Sk(t,"$"+e)},set:function(n,e,t){if(!n||typeof n!="object"&&typeof n!="function")throw new Zt("`O` is not an object");if(typeof e!="string")throw new Zt("`slot` must be a string");var r=Hi.get(n);r||(r={},Hi.set(n,r)),r["$"+e]=t}};Object.freeze&&Object.freeze(Yu);var Xu=Yu,Ng=tn,xn=Xu,po=function n(e,t){if(!(this instanceof n))return new n(e,t);if(e!=="normal"&&e!=="break"&&e!=="continue"&&e!=="return"&&e!=="throw")throw new Ng('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');xn.set(this,"[[Type]]",e),xn.set(this,"[[Value]]",t)};po.prototype.type=function(){return xn.get(this,"[[Type]]")};po.prototype.value=function(){return xn.get(this,"[[Value]]")};po.prototype["?"]=function(){var e=xn.get(this,"[[Type]]"),t=xn.get(this,"[[Value]]");if(e==="throw")throw t;return t};po.prototype["!"]=function(){var e=xn.get(this,"[[Type]]");if(e!=="normal")throw new Ng('Assertion failed: Completion Record is not of type "normal"');return xn.get(this,"[[Value]]")};var Ku=po,_k=Ku,Ju=function(e){return new _k("normal",e)},Ql,sp;function kk(){if(sp)return Ql;sp=1;var n=$i;return Ql=function(){return n()&&!!Symbol.toStringTag},Ql}var Ek=ut,op=Ek("%Object.defineProperty%",!0),xk=kk()(),Ak=rn,$k=K,Do=xk?Symbol.toStringTag:null,Ug=function(e,t){var r=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof r<"u"&&typeof r!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new $k("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Do&&(r||!Ak(e,Do))&&(op?op(e,Do,{configurable:!i,enumerable:!1,value:t,writable:!1}):e[Do]=t)},Fg={exports:{}},Ik=ut,ap=sg,Tk=el(),lp=Ai,cp=K,Ck=Ik("%Math.floor%"),Pk=function(e,t){if(typeof e!="function")throw new cp("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||Ck(t)!==t)throw new cp("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&lp){var o=lp(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(Tk?ap(e,"length",t,!0,!0):ap(e,"length",t)),e},Rk=oo,Dk=Uu,Lk=mg,zk=function(){return Lk(Rk,Dk,arguments)};(function(n){var e=Pk,t=so,r=tl,i=zk;n.exports=function(o){var a=r(arguments),c=1+o.length-(arguments.length-1);return e(a,c>0?c:0,!0)},t?t(n.exports,"apply",{value:i}):n.exports.apply=i})(Fg);var Qu=Fg.exports,Ok=function(e,t){for(var r=0;r<e.length;r+=1)if(!t(e[r],r,e))return!1;return!0},Mk=Object,Nk=function(e){return e&&typeof e=="object"&&(typeof e["[[ResourceValue]]"]>"u"||Mk(e["[[ResourceValue]]"])===e["[[ResourceValue]]"])&&(e["[[Hint]]"]==="SYNC-DISPOSE"||e["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof e["[[DisposeMethod]]"]=="function"||typeof e["[[DisposeMethod]]"]>"u")},Uk=rn,Fk=Fu(),Zk=Ok,Wk=Nk,Hk=function(e){return e&&typeof e=="object"&&Uk(e,"[[DisposableResourceStack]]")&&Fk(e["[[DisposableResourceStack]]"])&&(e["[[DisposableResourceStack]]"].length===0||Zk(e["[[DisposableResourceStack]]"],Wk))},Vk=nn,Bk=function(e){if(e===null)return"Null";if(typeof e>"u")return"Undefined";if(Vk(e))return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"},Gk=Bk,eh=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":Gk(e)},jk=K,qk=Pi,Yk=Ti,Xk=function(e,t){if(!Yk(t))throw new jk("Assertion failed: P is not a Property Key, got "+qk(t));return e[t]},up=K,Kk=Xk,Jk=Ci,Qk=Ti,hp=Pi,eE=function(e,t){if(!Qk(t))throw new up("Assertion failed: P is not a Property Key");var r=Kk(e,t);if(r!=null){if(!Jk(r))throw new up(hp(t)+" is not a function: "+hp(r));return r}},Mc={exports:{}},tE=ut,nE=tE,dp=nE("%Reflect.construct%",!0),va=uo;try{va({},"",{"[[Get]]":function(){}})}catch{va=null}if(va&&dp){var pp={},fp={};va(fp,"length",{"[[Get]]":function(){throw pp},"[[Enumerable]]":!0}),Mc.exports=function(e){try{dp(e,fp)}catch(t){return t===pp}}}else Mc.exports=function(e){return typeof e=="function"&&!!e.prototype};var rE=Mc.exports,ec=K,gp=Ci,iE=rE,sE=function(e){if(!iE(e))throw new ec("C must be a constructor");var t={"[[Resolve]]":void 0,"[[Reject]]":void 0},r=new e(function(i,s){if(typeof t["[[Resolve]]"]<"u"||typeof t["[[Reject]]"]<"u")throw new ec("executor has already been called");t["[[Resolve]]"]=i,t["[[Reject]]"]=s});if(!gp(t["[[Resolve]]"])||!gp(t["[[Reject]]"]))throw new ec("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":t["[[Resolve]]"],"[[Reject]]":t["[[Reject]]"]}},mp=tn,oE=K,tc=nl,vp=eE,aE=sE,lE=eh,yp=Vu(),bp=Bu(),cE=function(e,t){if(lE(e)!=="Object")throw new oE("`V` must be an Object");if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new mp("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(t==="ASYNC-DISPOSE"&&bp&&(r=vp(e,bp)),!r){if(!yp)throw new mp("`Symbol.dispose` is not supported");if(r=vp(e,yp),typeof r<"u")return function(){var i=this;if(t==="ASYNC-DISPOSE"){var s=aE(Promise);try{tc(r,i),tc(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}tc(r,i)}}return r},uE=tn,nc=K,hE=Ci,dE=eh,pE=cE,fE=function(e,t){if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new uE("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(arguments.length<3)if(e==null)e=void 0,r=void 0;else{if(typeof e<"u"&&dE(e)!=="Object")throw new nc("`V` must be an Object, or `null` or `undefined`");if(r=pE(e,t),typeof r>"u")throw new nc("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!hE(r))throw new nc("`method`, when provided, must be a function");return{"[[ResourceValue]]":e,"[[Hint]]":t,"[[DisposeMethod]]":r}},gE=tn,Lo=K,mE=Hk,wp=fE,vE=Pn(),yE=vE("Array.prototype.push"),Zg=function(e,t,r){if(!mE(e))throw new Lo("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new gE("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 Lo("Assertion failed: `method`, when present, must be a function");if(!e["[[DisposableResourceStack]]"])throw new Lo("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(t==null&&r==="SYNC_DISPOSE")return"UNUSED";s=wp(t,r)}else{if(typeof t<"u")throw new Lo("Assertion failed: `V` must be undefined when `method` is present");s=wp(void 0,r,i)}return yE(e["[[DisposableResourceStack]]"],s),"UNUSED"},rc,Sp;function th(){if(Sp)return rc;Sp=1;var n=ut,e=Qu,t=tn,r=n("%Promise.resolve%",!0),i=r&&e(r);return rc=function(o,a){if(!i)throw new t("This environment does not support Promises.");return i(o,a)},rc}var ic,_p;function bE(){if(_p)return ic;_p=1;var n=ut,e=tn,t=n("%Promise%",!0),r=nl,i=th(),s=eh;return ic=function(a,c,u){if(typeof a<"u"&&s(a)!=="Object")throw new e("Assertion failed: `V` must be `undefined` or an Object");if(c!=="SYNC-DISPOSE"&&c!=="ASYNC-DISPOSE")throw new e("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");if(typeof u<"u"&&typeof u!="function")throw new e("Assertion failed: `method` must be `undefined` or a function");var h=typeof u>"u"?u:r(u,a);if(c==="ASYNC-DISPOSE")return i(t,h)},ic}var sc,kp;function wE(){if(kp)return sc;kp=1;var n=Ku;return sc=function(t){return new n("throw",t)},sc}var SE=ut,oc=tn,Ep=K,_E=SE("%Promise%",!0),kE=Pn(),xp=kE("Promise.prototype.then",!0),EE=Ku,Ap=bE(),xE=Ju,AE=th(),$p=wE(),$E=Tg(),Wg=function(e,t){if(!(t instanceof EE))throw new Ep("`completion` must be a Completion Record");var r=e["[[DisposableResourceStack]]"];if(!r)throw new Ep("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 oc("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&AE(_E,t),a=function(v){if(t.type()==="throw"){var m=t.value(),E=new $E(v,m);t=$p(E)}else t=$p(v)},c=i==="ASYNC-DISPOSE"&&function(m){return xp(o,function(){var E=Ap(m["[[ResourceValue]]"],m["[[Hint]]"],m["[[DisposeMethod]]"]);if(!E)throw new oc("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return xp(E,xE)},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=Ap(h["[[ResourceValue]]"],h["[[Hint]]"],h["[[DisposeMethod]]"]);if(p)throw new oc("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(v){a(v)}}return e["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:t},Hg=function(){var e=[];return{"[[DisposableResourceStack]]":e}},sl=zu,nh=K,IE=nl,Ri=Wu,TE=uo,Vg=Ci,CE=Ju,Ye=Xu,PE=Ug,Bg=xr.supportsDescriptors,RE=Qu,rh=Zg,DE=Wg,Gg=Hg,Ip=Vu(),at=function n(){if(!(this instanceof n)||Ye.has(this,"[[DisposableState]]")||Ye.has(this,"[[DisposeCapability]]"))throw new nh("can only be used with new");Ye.set(this,"[[DisposableState]]","PENDING"),Ye.set(this,"[[DisposeCapability]]",Gg())},jg=function(){var e=this;return Ye.assert(e,"[[DisposableState]]"),Ye.get(e,"[[DisposableState]]")==="DISPOSED"},fo=RE(jg);Bg?TE(at.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":jg}):at.prototype.disposed=!1;var qg=function(e){Ye.set(e,"[[DisposableState]]","DISPOSED"),Bg||(e.disposed=!0)};Ri(at.prototype,"dispose",function(){var e=this;if(!fo(e))return qg(e),DE(Ye.get(e,"[[DisposeCapability]]"),CE())["?"]()});Ri(at.prototype,"use",function(e){var t=this;if(fo(t))throw new sl("a disposed stack can not use anything new");return rh(Ye.get(t,"[[DisposeCapability]]"),e,"SYNC-DISPOSE"),e});Ri(at.prototype,"adopt",function(e,t){var r=this;if(fo(r))throw new sl("a disposed stack can not use anything new");if(!Vg(t))throw new nh("`onDispose` must be a function");var i=function(){return IE(t,void 0,[e])};return rh(Ye.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),e});Ri(at.prototype,"defer",function(e){var t=this;if(fo(t))throw new sl("a disposed stack can not defer anything new");if(!Vg(e))throw new nh("`onDispose` must be a function");rh(Ye.get(t,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",e)});Ri(at.prototype,"move",function(){var e=this;if(fo(e))throw new sl("a disposed stack can not use anything new");var t=new at;return Ye.set(t,"[[DisposeCapability]]",Ye.get(e,"[[DisposeCapability]]")),Ye.set(e,"[[DisposeCapability]]",Gg()),qg(e),t});Ip&&Ri(at.prototype,Ip,at.prototype.dispose);PE(at.prototype,"DisposableStack");var LE=at,zE=LE,OE=function(){return typeof DisposableStack=="function"?DisposableStack:zE},ME=xr,NE=Du(),UE=OE,FE=function(){var e=UE();return ME(NE,{DisposableStack:e},{DisposableStack:!0}),e},ZE=ut,ol=zu,ih=K,Tp=ZE("%Promise%",!0),sh=Zg,WE=nl,Di=Wu,HE=uo,VE=Wg,Yg=Ci,Xg=Hg,BE=Ju,Cp=th(),Xe=Xu,GE=Ug,Kg=xr.supportsDescriptors,jE=Qu,qE=Pn(),YE=qE("Promise.prototype.then",!0),Pp=Bu(),lt=function n(){if(!(this instanceof n)||Xe.has(this,"[[AsyncDisposableState]]")||Xe.has(this,"[[DisposeCapability]]"))throw new ih("can only be used with new");Xe.set(this,"[[AsyncDisposableState]]","pending"),Xe.set(this,"[[DisposeCapability]]",Xg())},Jg=function(){var e=this;return Xe.assert(e,"[[AsyncDisposableState]]"),Xe.get(e,"[[AsyncDisposableState]]")==="disposed"},go=jE(Jg);Kg?HE(lt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Jg}):lt.prototype.disposed=!1;var Qg=function(e){Xe.set(e,"[[AsyncDisposableState]]","disposed"),Kg||(e.disposed=!0)};Di(lt.prototype,"disposeAsync",function(){var e=this;return go(e)?Cp(Tp):(Qg(e),YE(Cp(Tp,VE(Xe.get(e,"[[DisposeCapability]]"),BE())),function(t){return t["?"]()}))});Di(lt.prototype,"use",function(e){var t=this;if(go(t))throw new ol("a disposed stack can not use anything new");return sh(Xe.get(t,"[[DisposeCapability]]"),e,"ASYNC-DISPOSE"),e});Di(lt.prototype,"adopt",function(e,t){var r=this;if(go(r))throw new ol("a disposed stack can not use anything new");if(!Yg(t))throw new ih("`onDisposeAsync` must be a function");var i=function(){return WE(t,void 0,[e])};return i.value=e,sh(Xe.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),e});Di(lt.prototype,"defer",function(e){var t=this;if(go(t))throw new ol("a disposed stack can not defer anything new");if(!Yg(e))throw new ih("`onDispose` must be a function");sh(Xe.get(t,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",e)});Di(lt.prototype,"move",function(){var e=this;if(go(e))throw new ol("a disposed stack can not use anything new");var t=new lt;return Xe.set(t,"[[DisposeCapability]]",Xe.get(e,"[[DisposeCapability]]")),Xe.set(e,"[[DisposeCapability]]",Xg()),Qg(e),t});Pp&&Di(lt.prototype,Pp,lt.prototype.disposeAsync);GE(lt.prototype,"AsyncDisposableStack");var XE=lt,KE=XE,JE=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:KE},QE=xr,ex=Du(),tx=JE,nx=function(){var e=tx();return QE(ex,{AsyncDisposableStack:e},{AsyncDisposableStack:!0}),e},rx=QS,ix=a_,sx=FE,ox=nx,ax=function(){rx(),ix(),sx(),ox()};ax();const Rp=new WeakMap;function lx(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function Nr(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function Dp(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function cx(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class ux{constructor(){b(this,"entries",new Map);b(this,"constructionStack",[])}register(e,t){if(t===void 0){if(typeof e!="function")throw Dp();this.validateClassRegistration(e),this.storeFactory(e,()=>this.instantiateClass(e));return}if(typeof t!="function")throw Dp();if(t.constructor.name==="AsyncFunction")throw cx();this.storeFactory(e,t)}has(e){var t;return((t=this.entries.get(e))==null?void 0:t.factory)!==void 0}resolve(e){return this.resolveAny(e)}storeFactory(e,t){const r=this.getOrCreateEntry(e);r.factory=t,r.instance=void 0,r.error=void 0}validateClassRegistration(e){const t=Rp.get(e);if(t){if(e.length!==t.length)throw new Error(`${Nr(e)} cannot be registered with register(Class). @injectable(...) declared ${t.length} dependencies but constructor arity is ${e.length}. Use register(Key, () => value) instead.`);return}if(e.length!==0)throw new Error(`${Nr(e)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(e){const t=Rp.get(e);if(!t)return new e;const r=t.map(i=>this.resolveAny(i));return new e(...r)}resolveAny(e){return this.getOrCreateEntry(e).proxy}getOrCreateEntry(e){let t=this.entries.get(e);return t||(t={key:e},t.proxy=this.createProxy(t),this.entries.set(e,t),t)}createProxy(e){return new Proxy({},{get:(t,r)=>{if(r==="then")return;const i=this.getInstance(e),s=Reflect.get(i,r,i);return typeof s=="function"?s.bind(i):s},set:(t,r,i)=>{const s=this.getInstance(e);return Reflect.set(s,r,i,s)},has:(t,r)=>{const i=this.getInstance(e);return r in i}})}getInstance(e){if(e.instance)return e.instance;if(e.error)throw e.error;if(!e.factory)throw new Error(`${Nr(e.key)} was resolved but never registered`);const t=this.constructionStack.indexOf(e.key);if(t!==-1){const r=[...this.constructionStack.slice(t),e.key].map(i=>Nr(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(e.key);try{const r=e.factory();if(lx(r))throw new Error(`Factory for ${Nr(e.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${Nr(e.key)} returned a non-object value. Wrap primitives in an object.`);return e.instance=r,r}catch(r){throw e.error=r,r}finally{this.constructionStack.pop()}}}const zt=new ux,hx=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function dx(n){for(const e of Object.keys(n))if(hx.has(e))throw new Error(`Event payload key "${e}" is reserved; choose a different property name`)}function px(n,e){dx(e);for(const t of Object.keys(e))Object.defineProperty(n,t,{value:e[t],writable:!0,enumerable:!0,configurable:!0})}function nt(){class n extends Event{constructor(t,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(t,{bubbles:s,cancelable:o,composed:a}),px(this,c)}}return n}class Ot extends globalThis.EventTarget{}function fx(n,e,t){const r=n.dispose.bind(n);n.dispose=()=>{if(!e())return t(),r()}}function mo(n){var t;class e extends n{constructor(...s){super(...s);w(this,t,!1);fx(this,()=>l(this,t),()=>{x(this,t,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return l(this,t)}}return t=new WeakMap,e}const gx=nt(),mx=nt(),ta=nt(),em="0123456789ABCDEFGHJKMNPQRSTVWXYZ",ya=32,vx=16,tm=10,Lp=0xffffffffffff;var qn;(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"})(qn||(qn={}));class Ji extends Error{constructor(e,t){super(`${t} (${e})`),this.name="ULIDError",this.code=e}}function yx(n){const e=Math.floor(n()*ya)%ya;return em.charAt(e)}function bx(n){const e=wx(),t=e&&(e.crypto||e.msCrypto)||null;if(typeof(t==null?void 0:t.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return t.getRandomValues(r),r[0]/256};if(typeof(t==null?void 0:t.randomBytes)=="function")return()=>t.randomBytes(1).readUInt8()/256;throw new Ji(qn.PRNGDetectFailure,"Failed to find a reliable PRNG")}function wx(){return kx()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function Sx(n,e){let t="";for(;n>0;n--)t=yx(e)+t;return t}function _x(n,e=tm){if(isNaN(n))throw new Ji(qn.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>Lp)throw new Ji(qn.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Lp}: ${n}`);if(n<0)throw new Ji(qn.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Ji(qn.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let t,r="";for(let i=e;i>0;i--)t=n%ya,r=em.charAt(t)+r,n=(n-t)/ya;return r}function kx(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function al(n,e){const t=bx(),r=Date.now();return _x(r,tm)+Sx(vx,t)}const wt=4,tt=6,ds=2,Nc=2,oh=8,Ex=tt,ah="auto",An="auto",hn=120,zp=50,ce=16,br=hn*wt+ce*(wt-1),ba=hn*tt+ce*(tt-1),xx=br+ce*2,Ax=200,$x=4,zo=150,Ix=10,Op=2,Mp=8,Tx=300,Cx=4;function nm(n){return sm(n)}function rm(n,e){return sm(n.flatMap(t=>am(t,e)))}function im(n){const e=[],t=new Set;for(const r of n){if(r.type==="row"){e.push(`Top-level rows are invalid: ${r.id}`);continue}lm(r,"strip",e,t)}return{valid:e.length===0,errors:e}}function Xr(n){const e=nm(n),t=im(e);if(!t.valid)throw new Error(`Invalid layout: ${t.errors.join("; ")}`);return{totalNodes:e.length,nodes:e.filter(r=>r.type!=="row").map(Lx)}}function sm(n){const e=[];for(const t of n){const r=om(t);for(const i of r){if(i.type==="row"){e.push(...i.children.map(en));continue}e.push(i)}}return e}function om(n){switch(n.type){case"card":return[en(n)];case"row":{const e=n.children.map(en);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=[];for(const t of n.children){const r=om(t);for(const i of r){if(i.type==="stack"){e.push(...i.children.map(Uc));continue}if(i.type==="row"){e.push({...i,children:i.children.map(en)});continue}e.push(en(i))}}return e.length===0?[]:e.length===1?[Uc(e[0])]:[{...n,children:e}]}}}function am(n,e){switch(n.type){case"card":return n.artifactID===e?[]:[en(n)];case"row":{const t=n.children.filter(r=>r.artifactID!==e).map(en);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=n.children.flatMap(r=>am(r,e).filter(s=>s.type!=="stack"));return t.length===0?[]:t.length===1?[Uc(t[0])]:[{...n,children:t}]}}}function lm(n,e,t,r){switch(n.type){case"card":cm(n,e,t,r);return;case"row":Px(n,e,t,r);return;case"stack":Rx(n,e,t,r);return}}function cm(n,e,t,r){lh(n.id,t),typeof n.artifactID!="string"||n.artifactID.length===0?t.push(`Card ${n.id} is missing artifactID`):r.has(n.artifactID)?t.push(`Duplicate artifactID in layout: ${n.artifactID}`):r.add(n.artifactID),Dx(n.width)||t.push(`Card ${n.id} width must be an integer in the range ${ds}-${oh}`),um(n.height)||t.push(`Card ${n.id} height must be an integer in the range 2-6 or "auto"`);const i=Bn(n.width);e==="row"&&i<ds&&t.push(`Row child ${n.id} must be at least 2 columns wide`)}function Px(n,e,t,r){if(lh(n.id,t),e!=="stack"&&t.push(`Row ${n.id} may only appear inside a stack`),um(n.height,Cx)||t.push(`Row ${n.id} height must be an integer in the range 2-4 or "auto"`),!Array.isArray(n.children)||n.children.length===0){t.push(`Row ${n.id} must contain card nodes`);return}let i=0;for(const s of n.children){if(s.type!=="card"){t.push(`Row ${n.id} must contain only card nodes`);continue}cm(s,"row",t,r),i+=Bn(s.width)}i!==wt&&t.push(`Row ${n.id} children must sum to 4 columns`)}function Rx(n,e,t,r){if(lh(n.id,t),e!=="strip"&&t.push(`Invalid nested stack at ${n.id}; stack children cannot contain another nested stack`),!Array.isArray(n.children)||n.children.length===0){t.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"){t.push(`Stack ${n.id} cannot contain another nested stack`);continue}if(lm(a,"stack",t,r),a.height===An){s+=1;continue}i+=a.height}if(i>tt&&t.push(`Stack ${n.id} exceeds the 6-row budget`),s===0)return;const o=tt-i;if(o<s*Nc||o%s!==0){t.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<Nc&&t.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function lh(n,e){(typeof n!="string"||n.length===0)&&e.push(`Node id must be a non-empty string: ${String(n)}`)}function Dx(n){return n===ah||Number.isInteger(n)&&n>=ds&&n<=oh}function um(n,e=Ex){return n===An||Number.isInteger(n)&&n>=Nc&&n<=e}function Bn(n){return n===ah?wt:n}function Lx(n){if(n.type==="card")return{id:n.id,type:"card",width:Bn(n.width),cards:[{id:n.id,artifactID:n.artifactID,col:1,row:1,width:Bn(n.width),height:hm(n.height,tt)}]};const e=zx(n.children),t=[];let r=1;for(let i=0;i<n.children.length;i+=1){const s=n.children[i],o=e[i];if(s.type==="card")t.push({id:s.id,artifactID:s.artifactID,col:1,row:r,width:Math.min(wt,Bn(s.width)),height:o});else{let a=1;for(const c of s.children)t.push({id:c.id,artifactID:c.artifactID,col:a,row:r,width:Bn(c.width),height:o}),a+=Bn(c.width)}r+=o}return{id:n.id,type:"stack",width:t.reduce((i,s)=>Math.max(i,s.col+s.width-1),1),cards:t}}function zx(n){let e=0,t=0;for(const i of n)i.height===An?t+=1:e+=i.height;const r=t>0?(tt-e)/t:0;return n.map(i=>hm(i.height,r))}function hm(n,e){return n===An?e:n}function en(n){return{...n}}function Uc(n){return n.type==="card"?en(n):{...n,children:n.children.map(en)}}function dm(n,e={}){return{id:e.id??al(),type:"card",artifactID:n,width:e.width??ah,height:e.height??An}}function pm(n,e){return n.some(t=>fm(t,e))}function fm(n,e){switch(n.type){case"card":return n.artifactID===e;case"row":return n.children.some(t=>t.artifactID===e);case"stack":return n.children.some(t=>fm(t,e))}}function Np(n){return n.layout.flatMap(gm)}function gm(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(e=>e.artifactID);case"stack":return n.children.flatMap(gm)}}const ie=nt(),mm=nt(),Ur=nt(),Ox=nt();function Mx(n){class e extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return e}const Nx=Mx("RequestError"),Ux=200,Fx=300;class Zx{constructor(e,t){b(this,"serverURL");b(this,"token");this.serverURL=e.replace(/\/$/,""),this.token=t.token}async requestJSON(e,t,r){const i=await this.request(e,t,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0),s=await Wx(i);if(!i.ok||i.status<Ux||i.status>=Fx)throw this.createError(typeof s.error=="string"?s.error:i.statusText,i.status);return s}async requestVoid(e,t){const r=await this.request(e,t);if(!r.ok)throw this.createError(await ac(r,r.statusText),r.status)}async requestText(e,t){const r=await this.request(e,t);if(!r.ok)throw this.createError(await ac(r,r.statusText),r.status);return r.text()}async requestRawVoid(e,t,r){const i=await this.request(e,t,r,{"content-type":"text/plain"});if(!i.ok)throw this.createError(await ac(i,i.statusText),i.status)}createError(e,t){const r={serverURL:this.serverURL};return t!==void 0&&(r.status=t),new Nx(e,r)}async request(e,t,r,i){const s=`${this.serverURL}${t}`;try{return await fetch(s,{method:e,headers:this.buildHeaders(i),body:r})}catch(o){throw this.createError(o instanceof Error?o.message:"Failed to reach server")}}buildHeaders(e){const t={...e??{}};return this.token&&(t.Authorization=`Bearer ${this.token}`),Object.keys(t).length>0?t:void 0}}async function Wx(n){try{return await n.json()}catch{const e=await n.text().catch(()=>"");return e?{message:e}:{}}}async function ac(n,e){try{const t=await n.json();if(typeof t.error=="string")return t.error;if(typeof t.message=="string")return t.message}catch{}return e}function Hx(n){return n.map(e=>`${e.name} (${e.id})`).join(", ")}var It,Ra,vm;class Vx{constructor(e){w(this,Ra);w(this,It);x(this,It,e)}list(){return l(this,It).requestJSON("GET","/screens")}async get(e={}){const t=await f(this,Ra,vm).call(this,e.screenID);return l(this,It).requestJSON("GET",`/screens/${encodeURIComponent(t)}`)}create(e){const t={name:e.name};return e.id!==void 0&&(t.id=e.id),l(this,It).requestJSON("POST","/screens",t)}update(e){const{screenID:t,...r}=e;return l(this,It).requestJSON("PATCH",`/screens/${encodeURIComponent(t)}`,r)}remove(e){return l(this,It).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}`)}}It=new WeakMap,Ra=new WeakSet,vm=async function(e){if(e!==void 0)return e;const{screens:t}=await this.list();if(t.length===1)return t[0].id;throw l(this,It).createError(`screenID is required when multiple screens exist. Available screens: ${Hx(t)}`)};var Le;class Bx{constructor(e){w(this,Le);x(this,Le,e)}create(e){const t={type:e.type,title:e.title};return e.externalFilePath!==void 0&&(t.externalFilePath=e.externalFilePath),e.externalURL!==void 0&&(t.externalURL=e.externalURL),e.screenID!==void 0&&(t.screenID=e.screenID),l(this,Le).requestJSON("POST","/artifacts",t)}list(e={}){const t=new URLSearchParams;e.screenID!==void 0&&t.set("screenID",e.screenID),e.unplaced&&t.set("unplaced","true");const r=t.toString();return l(this,Le).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(e){return l(this,Le).requestJSON("GET",`/artifacts/${encodeURIComponent(e.artifactID)}`)}update(e){const t={};return e.title!==void 0&&(t.title=e.title),l(this,Le).requestJSON("PATCH",`/artifacts/${encodeURIComponent(e.artifactID)}`,t)}edit(e){return l(this,Le).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/edit`)}commitPending(e){return l(this,Le).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/commit`)}abandonPending(e){return l(this,Le).requestVoid("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/abandon`)}attach(e){return l(this,Le).requestJSON("POST",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}detach(e){return l(this,Le).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}delete(e){return l(this,Le).requestJSON("DELETE",`/artifacts/${encodeURIComponent(e.artifactID)}`)}getContent(e){return l(this,Le).requestText("GET",`/artifacts/${encodeURIComponent(e.artifactID)}/content`)}putContent(e){return l(this,Le).requestRawVoid("PUT",`/artifacts/${encodeURIComponent(e.artifactID)}/content`,e.content)}}Le=new WeakMap;var Kn;class Gx{constructor(e){w(this,Kn);x(this,Kn,e)}state(){return l(this,Kn).requestJSON("GET","/viewer/state")}setActive(e){return l(this,Kn).requestJSON("PUT","/viewer/active-screen",{screenID:e.screenID})}focus(e){const t={artifactID:e.artifactID};return e.screenID!==void 0&&(t.screenID=e.screenID),l(this,Kn).requestJSON("POST","/viewer/focus",t)}}Kn=new WeakMap;var bs;class jx{constructor(e){w(this,bs);x(this,bs,e)}async list(){const{views:e}=await l(this,bs).requestJSON("GET","/views");return e}}bs=new WeakMap;var Bt;class qx{constructor(e,t={}){b(this,"screens");b(this,"artifacts");b(this,"viewer");b(this,"views");w(this,Bt);x(this,Bt,new Zx(e,t)),this.screens=new Vx(l(this,Bt)),this.artifacts=new Bx(l(this,Bt)),this.viewer=new Gx(l(this,Bt)),this.views=new jx(l(this,Bt))}health(){return l(this,Bt).requestJSON("GET","/health")}}Bt=new WeakMap;const Yx={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},Xx=mo(Ot);var Jn,Be,Qn,Ne,pt,pn,fn,re,Zn,ym,ws,bm,wm,Sm,_m,Fc,Zc,Wc,km;class Kx extends Xx{constructor(t){var i;super();w(this,re);b(this,"id");b(this,"server");w(this,Jn);w(this,Be,new Map);w(this,Qn);w(this,Ne);w(this,pt);w(this,pn);w(this,fn,null);w(this,ws,t=>{if(this.disposed)return;const r=t.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&f(this,re,bm).call(this,r.screen);break;case"artifact-created":break;case"artifact-attached":r.screenID===this.id&&f(this,re,wm).call(this,r.cardID,r.artifact);break;case"artifact-updated":f(this,re,Sm).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&f(this,re,_m).call(this,r.artifactID);break;case"artifact-content-changed":l(this,Be).has(r.artifactID)&&this.dispatchEvent(new Ox("artifact-content-changed",{artifactID:r.artifactID}));break}});this.id=t.screen.id,this.server=t.server,x(this,Jn,t.localStore),x(this,Qn,t.screen.name),x(this,Ne,structuredClone(t.screen.layout)),x(this,pt,t.screen.pinned);const r=((i=l(this,Jn).get().screens[this.id])==null?void 0:i.scrollPosition)??0;x(this,pn,Math.max(0,r)),this.server.addEventListener("server-event",l(this,ws)),f(this,re,ym).call(this)}get name(){return l(this,Qn)}get layout(){return l(this,Ne)}get pinned(){return l(this,pt)}get scrollPosition(){return l(this,pn)}get artifacts(){return l(this,Be)}setScrollPosition(t){f(this,re,Zn).call(this);const r=Math.max(0,t);r!==l(this,pn)&&(x(this,pn,r),f(this,re,km).call(this),this.dispatchEvent(new ie("change")))}setLayout(t){f(this,re,Zn).call(this);const r=nm(t);if(!im(r).valid)return;const s=f(this,re,Zc).call(this);x(this,Ne,r),x(this,fn,{layout:r,snapshot:s}),this.dispatchEvent(new ie("change")),this.server.client.screens.update({screenID:this.id,layout:r.map(o=>structuredClone(o))}).catch(()=>{var o;this.disposed||((o=l(this,fn))==null?void 0:o.layout)===r&&(x(this,fn,null),f(this,re,Wc).call(this,s),this.dispatchEvent(new ie("change")))})}rename(t){f(this,re,Zn).call(this),x(this,Qn,t),this.dispatchEvent(new ie("change")),this.server.client.screens.update({screenID:this.id,name:t}).catch(()=>{})}setPinned(t){if(f(this,re,Zn).call(this),l(this,pt)===t)return;const r=l(this,pt);x(this,pt,t),this.dispatchEvent(new ie("change")),this.server.client.screens.update({screenID:this.id,pinned:t}).catch(()=>{this.disposed||l(this,pt)===t&&(x(this,pt,r),this.dispatchEvent(new ie("change")))})}async remove(){f(this,re,Zn).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(t){if(f(this,re,Zn).call(this),!l(this,Be).has(t))return;const r=f(this,re,Zc).call(this);f(this,re,Fc).call(this,t),this.dispatchEvent(new ie("change")),this.server.client.artifacts.detach({artifactID:t,screenID:this.id}).catch(()=>{this.disposed||(f(this,re,Wc).call(this,r),this.dispatchEvent(new ie("change")))})}dispose(){this.server.removeEventListener("server-event",l(this,ws))}}Jn=new WeakMap,Be=new WeakMap,Qn=new WeakMap,Ne=new WeakMap,pt=new WeakMap,pn=new WeakMap,fn=new WeakMap,re=new WeakSet,Zn=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},ym=async function(){try{const t=await this.server.client.screens.get({screenID:this.id});if(this.disposed)return;for(const r of t.artifacts)l(this,Be).set(r.id,r);this.dispatchEvent(new ie("change"))}catch{}},ws=new WeakMap,bm=function(t){l(this,fn)&&x(this,fn,null),x(this,Qn,t.name),x(this,Ne,structuredClone(t.layout)),x(this,pt,t.pinned),this.dispatchEvent(new ie("change"))},wm=function(t,r){pm(l(this,Ne),r.id)||x(this,Ne,[...l(this,Ne),dm(r.id,{id:t})]),l(this,Be).set(r.id,r),this.dispatchEvent(new ie("change"))},Sm=function(t){const r=l(this,Be).get(t.id);r&&(l(this,Be).set(t.id,{...r,...t}),this.dispatchEvent(new ie("change")))},_m=function(t){f(this,re,Fc).call(this,t)&&this.dispatchEvent(new ie("change"))},Fc=function(t){const r=l(this,Be).delete(t),i=Np({layout:l(this,Ne)}).length,s=rm(l(this,Ne),t),o=Np({layout:s}).length;return x(this,Ne,s),r||i!==o},Zc=function(){return{layout:structuredClone(l(this,Ne)),artifacts:new Map([...l(this,Be).entries()].map(([t,r])=>[t,structuredClone(r)]))}},Wc=function(t){x(this,Ne,structuredClone(t.layout)),l(this,Be).clear();for(const[r,i]of t.artifacts)l(this,Be).set(r,structuredClone(i))},km=function(){const t=l(this,Jn).get();l(this,Jn).set({...t,screens:{...t.screens,[this.id]:{scrollPosition:l(this,pn)}}})};const Jx=mo(Ot);var it,Tt,ft,Ss,_s,ks,ti,na;class Qx extends Jx{constructor(t){super();w(this,ti);w(this,it);w(this,Tt);w(this,ft,null);w(this,Ss,()=>{this.disposed||f(this,ti,na).call(this)});w(this,_s,()=>{this.disposed||f(this,ti,na).call(this)});w(this,ks,t=>{var i;if(this.disposed)return;const r=t.event;if(r.type==="screen-removed"&&((i=l(this,ft))==null?void 0:i.id)===r.screenID&&this.clearActive(),r.type==="viewer-active-screen-changed"){const s=l(this,Tt).servers.get(t.serverURL);s&&s.screens.has(r.screenID)&&this.setActive(t.serverURL,r.screenID)}});x(this,it,t.localStore),x(this,Tt,t.serverManager),l(this,it).addEventListener("change",l(this,Ss)),l(this,Tt).addEventListener("change",l(this,_s)),l(this,Tt).addEventListener("server-event",l(this,ks)),f(this,ti,na).call(this)}get activeScreen(){return l(this,ft)}setActive(t,r){const i=l(this,it).get();i.activeServerURL===t&&i.activeScreenID===r||l(this,it).set({...i,activeServerURL:t,activeScreenID:r})}clearActive(){const t=l(this,it).get();t.activeScreenID!==null&&l(this,it).set({...t,activeScreenID:null})}dispose(){var t;l(this,it).removeEventListener("change",l(this,Ss)),l(this,Tt).removeEventListener("change",l(this,_s)),l(this,Tt).removeEventListener("server-event",l(this,ks)),(t=l(this,ft))==null||t.dispose(),x(this,ft,null)}}it=new WeakMap,Tt=new WeakMap,ft=new WeakMap,Ss=new WeakMap,_s=new WeakMap,ks=new WeakMap,ti=new WeakSet,na=function(){var c,u,h;const{activeServerURL:t,activeScreenID:r}=l(this,it).get(),i=t?l(this,Tt).servers.get(t)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((c=l(this,ft))==null?void 0:c.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=l(this,ft))==null?void 0:u.server)===i||((h=l(this,ft))==null||h.dispose(),x(this,ft,i&&s?new Kx({screen:s,server:i,localStore:l(this,it)}):null),i&&i.acpClient.setScreenContext(s?{screenID:s.id,screenName:s.name}:null),this.dispatchEvent(new gx("active-screen-changed")))};const e1="Local",t1="store-";function dt(n){return new URL(n).origin}function n1(n){return{servers:[{url:dt(n),name:e1}],activeServerURL:null,activeScreenID:null,screens:{}}}var er,tr,nr;class r1 extends Ot{constructor(t,r,i={}){super();w(this,er);w(this,tr);w(this,nr);x(this,er,`${t1}${t}`),x(this,tr,i.storage??i1());const s=l(this,tr).getItem(l(this,er));s===null?(x(this,nr,r),l(this,tr).setItem(l(this,er),JSON.stringify(r))):x(this,nr,JSON.parse(s))}get(){return l(this,nr)}set(t){x(this,nr,t),l(this,tr).setItem(l(this,er),JSON.stringify(t)),this.dispatchEvent(new ie("change"))}}er=new WeakMap,tr=new WeakMap,nr=new WeakMap;function i1(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function A(n,e,t){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),e(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=(t==null?void 0:t.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function o(a){var c;const u=t!=null&&t.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 t!=null&&t.Parent&&a instanceof t.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 ei extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Em extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const xm={};function $n(n){return xm}function Am(n){const e=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function Hc(n,e){return typeof e=="bigint"?e.toString():e}function ch(n){return{get value(){{const e=n();return Object.defineProperty(this,"value",{value:e}),e}}}}function uh(n){return n==null}function hh(n){const e=n.startsWith("^")?1:0,t=n.endsWith("$")?n.length-1:n.length;return n.slice(e,t)}function s1(n,e){const t=(n.toString().split(".")[1]||"").length,r=e.toString();let i=(r.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c!=null&&c[1]&&(i=Number.parseInt(c[1]))}const s=t>i?t:i,o=Number.parseInt(n.toFixed(s).replace(".","")),a=Number.parseInt(e.toFixed(s).replace(".",""));return o%a/10**s}const Up=Symbol("evaluating");function oe(n,e,t){let r;Object.defineProperty(n,e,{get(){if(r!==Up)return r===void 0&&(r=Up,r=t()),r},set(i){Object.defineProperty(n,e,{value:i})},configurable:!0})}function $r(n,e,t){Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function Dn(...n){const e={};for(const t of n){const r=Object.getOwnPropertyDescriptors(t);Object.assign(e,r)}return Object.defineProperties({},e)}function Fp(n){return JSON.stringify(n)}function o1(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const $m="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function wa(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const a1=ch(()=>{var n;if(typeof navigator<"u"&&((n=navigator==null?void 0:navigator.userAgent)!=null&&n.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function _i(n){if(wa(n)===!1)return!1;const e=n.constructor;if(e===void 0||typeof e!="function")return!0;const t=e.prototype;return!(wa(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function Im(n){return _i(n)?{...n}:Array.isArray(n)?[...n]:n}const l1=new Set(["string","number","symbol"]);function ki(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ln(n,e,t){const r=new n._zod.constr(e??n._zod.def);return(!e||t!=null&&t.parent)&&(r._zod.parent=n),r}function z(n){const e=n;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function c1(n){return Object.keys(n).filter(e=>n[e]._zod.optin==="optional"&&n[e]._zod.optout==="optional")}const u1={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 h1(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=Dn(n._zod.def,{get shape(){const o={};for(const a in e){if(!(a in t.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(o[a]=t.shape[a])}return $r(this,"shape",o),o},checks:[]});return Ln(n,s)}function d1(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=Dn(n._zod.def,{get shape(){const o={...n._zod.def.shape};for(const a in e){if(!(a in t.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete o[a]}return $r(this,"shape",o),o},checks:[]});return Ln(n,s)}function p1(n,e){if(!_i(e))throw new Error("Invalid input to extend: expected a plain object");const t=n._zod.def.checks;if(t&&t.length>0){const s=n._zod.def.shape;for(const o in e)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=Dn(n._zod.def,{get shape(){const s={...n._zod.def.shape,...e};return $r(this,"shape",s),s}});return Ln(n,i)}function f1(n,e){if(!_i(e))throw new Error("Invalid input to safeExtend: expected a plain object");const t=Dn(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e};return $r(this,"shape",r),r}});return Ln(n,t)}function g1(n,e){const t=Dn(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e._zod.def.shape};return $r(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return Ln(n,t)}function m1(n,e,t){const i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=Dn(e._zod.def,{get shape(){const a=e._zod.def.shape,c={...a};if(t)for(const u in t){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);t[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 $r(this,"shape",c),c},checks:[]});return Ln(e,o)}function v1(n,e,t){const r=Dn(e._zod.def,{get shape(){const i=e._zod.def.shape,s={...i};if(t)for(const o in t){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(s[o]=new n({type:"nonoptional",innerType:i[o]}))}else for(const o in i)s[o]=new n({type:"nonoptional",innerType:i[o]});return $r(this,"shape",s),s}});return Ln(e,r)}function Kr(n,e=0){var t;if(n.aborted===!0)return!0;for(let r=e;r<n.issues.length;r++)if(((t=n.issues[r])==null?void 0:t.continue)!==!0)return!0;return!1}function Jr(n,e){return e.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(n),t})}function Oo(n){return typeof n=="string"?n:n==null?void 0:n.message}function In(n,e,t){var i,s,o,a,c,u;const r={...n,path:n.path??[]};if(!n.message){const h=Oo((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??Oo((a=e==null?void 0:e.error)==null?void 0:a.call(e,n))??Oo((c=t.customError)==null?void 0:c.call(t,n))??Oo((u=t.localeError)==null?void 0:u.call(t,n))??"Invalid input";r.message=h}return delete r.inst,delete r.continue,e!=null&&e.reportInput||delete r.input,r}function dh(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function ps(...n){const[e,t,r]=n;return typeof e=="string"?{message:e,code:"custom",input:t,inst:r}:{...e}}const Tm=(n,e)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:e,enumerable:!1}),n.message=JSON.stringify(e,Hc,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},Cm=A("$ZodError",Tm),Pm=A("$ZodError",Tm,{Parent:Error});function y1(n,e=t=>t.message){const t={},r=[];for(const i of n.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:t}}function b1(n,e=t=>t.message){const t={_errors:[]},r=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(o=>r({issues:o}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)t._errors.push(e(s));else{let o=t,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(e(s))):o[c]=o[c]||{_errors:[]},o=o[c],a++}}};return r(n),t}const ph=n=>(e,t,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},o=e._zod.run({value:t,issues:[]},s);if(o instanceof Promise)throw new ei;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>In(c,s,$n())));throw $m(a,i==null?void 0:i.callee),a}return o.value},fh=n=>async(e,t,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=e._zod.run({value:t,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>In(c,s,$n())));throw $m(a,i==null?void 0:i.callee),a}return o.value},ll=n=>(e,t,r)=>{const i=r?{...r,async:!1}:{async:!1},s=e._zod.run({value:t,issues:[]},i);if(s instanceof Promise)throw new ei;return s.issues.length?{success:!1,error:new(n??Cm)(s.issues.map(o=>In(o,i,$n())))}:{success:!0,data:s.value}},w1=ll(Pm),cl=n=>async(e,t,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=e._zod.run({value:t,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new n(s.issues.map(o=>In(o,i,$n())))}:{success:!0,data:s.value}},S1=cl(Pm),_1=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ph(n)(e,t,i)},k1=n=>(e,t,r)=>ph(n)(e,t,r),E1=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return fh(n)(e,t,i)},x1=n=>async(e,t,r)=>fh(n)(e,t,r),A1=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ll(n)(e,t,i)},$1=n=>(e,t,r)=>ll(n)(e,t,r),I1=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return cl(n)(e,t,i)},T1=n=>async(e,t,r)=>cl(n)(e,t,r),C1=/^[cC][^\s-]{8,}$/,P1=/^[0-9a-z]+$/,R1=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,D1=/^[0-9a-vA-V]{20}$/,L1=/^[A-Za-z0-9]{27}$/,z1=/^[a-zA-Z0-9_-]{21}$/,O1=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,M1=/^([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})$/,Zp=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)$/,N1=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,U1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function F1(){return new RegExp(U1,"u")}const Z1=/^(?:(?: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])$/,W1=/^(([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}|:))$/,H1=/^((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])$/,V1=/^(([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])$/,B1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Rm=/^[A-Za-z0-9_-]*$/,G1=/^\+[1-9]\d{6,14}$/,Dm="(?:(?:\\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])))",j1=new RegExp(`^${Dm}$`);function Lm(n){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${e}`:n.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${n.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function q1(n){return new RegExp(`^${Lm(n)}$`)}function Y1(n){const e=Lm({precision:n.precision}),t=["Z"];n.local&&t.push(""),n.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${t.join("|")})`;return new RegExp(`^${Dm}T(?:${r})$`)}const X1=n=>{const e=n?`[\\s\\S]{${(n==null?void 0:n.minimum)??0},${(n==null?void 0:n.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},K1=/^-?\d+$/,zm=/^-?\d+(?:\.\d+)?$/,J1=/^(?:true|false)$/i,Q1=/^[^A-Z]*$/,eA=/^[^a-z]*$/,Ke=A("$ZodCheck",(n,e)=>{var t;n._zod??(n._zod={}),n._zod.def=e,(t=n._zod).onattach??(t.onattach=[])}),Om={number:"number",bigint:"bigint",object:"date"},Mm=A("$ZodCheckLessThan",(n,e)=>{Ke.init(n,e);const t=Om[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:t,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),Nm=A("$ZodCheckGreaterThan",(n,e)=>{Ke.init(n,e);const t=Om[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:t,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),tA=A("$ZodCheckMultipleOf",(n,e)=>{Ke.init(n,e),n._zod.onattach.push(t=>{var r;(r=t._zod.bag).multipleOf??(r.multipleOf=e.value)}),n._zod.check=t=>{if(typeof t.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof t.value=="bigint"?t.value%e.value===BigInt(0):s1(t.value,e.value)===0)||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:e.value,input:t.value,inst:n,continue:!e.abort})}}),nA=A("$ZodCheckNumberFormat",(n,e)=>{var o;Ke.init(n,e),e.format=e.format||"float64";const t=(o=e.format)==null?void 0:o.includes("int"),r=t?"int":"number",[i,s]=u1[e.format];n._zod.onattach.push(a=>{const c=a._zod.bag;c.format=e.format,c.minimum=i,c.maximum=s,t&&(c.pattern=K1)}),n._zod.check=a=>{const c=a.value;if(t){if(!Number.isInteger(c)){a.issues.push({expected:r,format:e.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:!e.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:!e.abort});return}}c<i&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!e.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:n,continue:!e.abort})}}),rA=A("$ZodCheckMaxLength",(n,e)=>{var t;Ke.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!uh(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),n._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const o=dh(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),iA=A("$ZodCheckMinLength",(n,e)=>{var t;Ke.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!uh(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),n._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const o=dh(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),sA=A("$ZodCheckLengthEquals",(n,e)=>{var t;Ke.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!uh(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),n._zod.check=r=>{const i=r.value,s=i.length;if(s===e.length)return;const o=dh(i),a=s>e.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!e.abort})}}),ul=A("$ZodCheckStringFormat",(n,e)=>{var t,r;Ke.init(n,e),n._zod.onattach.push(i=>{const s=i._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(t=n._zod).check??(t.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:n,continue:!e.abort})}):(r=n._zod).check??(r.check=()=>{})}),oA=A("$ZodCheckRegex",(n,e)=>{ul.init(n,e),n._zod.check=t=>{e.pattern.lastIndex=0,!e.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:n,continue:!e.abort})}}),aA=A("$ZodCheckLowerCase",(n,e)=>{e.pattern??(e.pattern=Q1),ul.init(n,e)}),lA=A("$ZodCheckUpperCase",(n,e)=>{e.pattern??(e.pattern=eA),ul.init(n,e)}),cA=A("$ZodCheckIncludes",(n,e)=>{Ke.init(n,e);const t=ki(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${t}`:t);e.pattern=r,n._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),n._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:n,continue:!e.abort})}}),uA=A("$ZodCheckStartsWith",(n,e)=>{Ke.init(n,e);const t=new RegExp(`^${ki(e.prefix)}.*`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:n,continue:!e.abort})}}),hA=A("$ZodCheckEndsWith",(n,e)=>{Ke.init(n,e);const t=new RegExp(`.*${ki(e.suffix)}$`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:n,continue:!e.abort})}}),dA=A("$ZodCheckOverwrite",(n,e)=>{Ke.init(n,e),n._zod.check=t=>{t.value=e.tx(t.value)}});class pA{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
4
|
+
`+e.prev}function Ro(n,e){var t=Oc(n),r=[];if(t){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=Vt(n,i)?e(n[i],n):""}var s=typeof Jl=="function"?Jl(n):[],o;if(_i){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var c in n)Vt(n,c)&&(t&&String(Number(c))===c&&c<n.length||_i&&o["$"+c]instanceof Symbol||(Pg.call(/[^\w$]/,c)?r.push(e(c,n)+": "+e(n[c],n)):r.push(c+": "+e(n[c],n))));if(typeof Jl=="function")for(var u=0;u<s.length;u++)Rg.call(n,s[u])&&r.push("["+e(s[u])+"]: "+e(n[s[u]],n));return r}var G_=Ri,j_=K,il=function(n,e,t){for(var r=n,i;(i=r.next)!=null;r=i)if(i.key===e)return r.next=i.next,t||(i.next=n.next,n.next=i),i},q_=function(n,e){if(n){var t=il(n,e);return t&&t.value}},Y_=function(n,e,t){var r=il(n,e);r?r.value=t:n.next={key:e,next:n.next,value:t}},X_=function(n,e){return n?!!il(n,e):!1},K_=function(n,e){if(n)return il(n,e,!0)},J_=function(){var e,t={assert:function(r){if(!t.has(r))throw new j_("Side channel does not contain "+G_(r))},delete:function(r){var i=e&&e.next,s=K_(e,r);return s&&i&&i===s&&(e=void 0),!!s},get:function(r){return q_(e,r)},has:function(r){return X_(e,r)},set:function(r,i){e||(e={next:void 0}),Y_(e,r,i)}};return t},Q_=ut,po=Pn(),ek=Ri,tk=K,sp=Q_("%Map%",!0),nk=po("Map.prototype.get",!0),rk=po("Map.prototype.set",!0),ik=po("Map.prototype.has",!0),sk=po("Map.prototype.delete",!0),ok=po("Map.prototype.size",!0),Ng=!!sp&&function(){var e,t={assert:function(r){if(!t.has(r))throw new tk("Side channel does not contain "+ek(r))},delete:function(r){if(e){var i=sk(e,r);return ok(e)===0&&(e=void 0),i}return!1},get:function(r){if(e)return nk(e,r)},has:function(r){return e?ik(e,r):!1},set:function(r,i){e||(e=new sp),rk(e,r,i)}};return t},ak=ut,sl=Pn(),lk=Ri,Do=Ng,ck=K,Mr=ak("%WeakMap%",!0),uk=sl("WeakMap.prototype.get",!0),hk=sl("WeakMap.prototype.set",!0),dk=sl("WeakMap.prototype.has",!0),pk=sl("WeakMap.prototype.delete",!0),fk=Mr?function(){var e,t,r={assert:function(i){if(!r.has(i))throw new ck("Side channel does not contain "+lk(i))},delete:function(i){if(Mr&&i&&(typeof i=="object"||typeof i=="function")){if(e)return pk(e,i)}else if(Do&&t)return t.delete(i);return!1},get:function(i){return Mr&&i&&(typeof i=="object"||typeof i=="function")&&e?uk(e,i):t&&t.get(i)},has:function(i){return Mr&&i&&(typeof i=="object"||typeof i=="function")&&e?dk(e,i):!!t&&t.has(i)},set:function(i,s){Mr&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Mr),hk(e,i,s)):Do&&(t||(t=Do()),t.set(i,s))}};return r}:Do,gk=K,mk=Ri,vk=J_,yk=Ng,bk=fk,wk=bk||yk||vk,Sk=function(){var e,t={assert:function(r){if(!t.has(r))throw new gk("Side channel does not contain "+mk(r))},delete:function(r){return!!e&&e.delete(r)},get:function(r){return e&&e.get(r)},has:function(r){return!!e&&e.has(r)},set:function(r,i){e||(e=wk()),e.set(r,i)}};return t},_k=rn,Vi=Sk(),Zt=K,Xu={assert:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Zt("`O` is not an object");if(typeof e!="string")throw new Zt("`slot` must be a string");if(Vi.assert(n),!Xu.has(n,e))throw new Zt("`"+e+"` is not present on `O`")},get:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Zt("`O` is not an object");if(typeof e!="string")throw new Zt("`slot` must be a string");var t=Vi.get(n);return t&&t["$"+e]},has:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Zt("`O` is not an object");if(typeof e!="string")throw new Zt("`slot` must be a string");var t=Vi.get(n);return!!t&&_k(t,"$"+e)},set:function(n,e,t){if(!n||typeof n!="object"&&typeof n!="function")throw new Zt("`O` is not an object");if(typeof e!="string")throw new Zt("`slot` must be a string");var r=Vi.get(n);r||(r={},Vi.set(n,r)),r["$"+e]=t}};Object.freeze&&Object.freeze(Xu);var Ku=Xu,Ug=tn,xn=Ku,fo=function n(e,t){if(!(this instanceof n))return new n(e,t);if(e!=="normal"&&e!=="break"&&e!=="continue"&&e!=="return"&&e!=="throw")throw new Ug('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');xn.set(this,"[[Type]]",e),xn.set(this,"[[Value]]",t)};fo.prototype.type=function(){return xn.get(this,"[[Type]]")};fo.prototype.value=function(){return xn.get(this,"[[Value]]")};fo.prototype["?"]=function(){var e=xn.get(this,"[[Type]]"),t=xn.get(this,"[[Value]]");if(e==="throw")throw t;return t};fo.prototype["!"]=function(){var e=xn.get(this,"[[Type]]");if(e!=="normal")throw new Ug('Assertion failed: Completion Record is not of type "normal"');return xn.get(this,"[[Value]]")};var Ju=fo,kk=Ju,Qu=function(e){return new kk("normal",e)},ec,op;function Ek(){if(op)return ec;op=1;var n=Ii;return ec=function(){return n()&&!!Symbol.toStringTag},ec}var xk=ut,ap=xk("%Object.defineProperty%",!0),Ak=Ek()(),$k=rn,Ik=K,Lo=Ak?Symbol.toStringTag:null,Fg=function(e,t){var r=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof r<"u"&&typeof r!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new Ik("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Lo&&(r||!$k(e,Lo))&&(ap?ap(e,Lo,{configurable:!i,enumerable:!1,value:t,writable:!1}):e[Lo]=t)},Zg={exports:{}},Tk=ut,lp=og,Ck=tl(),cp=$i,up=K,Pk=Tk("%Math.floor%"),Rk=function(e,t){if(typeof e!="function")throw new up("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||Pk(t)!==t)throw new up("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&cp){var o=cp(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(Ck?lp(e,"length",t,!0,!0):lp(e,"length",t)),e},Dk=ao,Lk=Fu,zk=vg,Ok=function(){return zk(Dk,Lk,arguments)};(function(n){var e=Rk,t=oo,r=nl,i=Ok;n.exports=function(o){var a=r(arguments),c=1+o.length-(arguments.length-1);return e(a,c>0?c:0,!0)},t?t(n.exports,"apply",{value:i}):n.exports.apply=i})(Zg);var eh=Zg.exports,Mk=function(e,t){for(var r=0;r<e.length;r+=1)if(!t(e[r],r,e))return!1;return!0},Nk=Object,Uk=function(e){return e&&typeof e=="object"&&(typeof e["[[ResourceValue]]"]>"u"||Nk(e["[[ResourceValue]]"])===e["[[ResourceValue]]"])&&(e["[[Hint]]"]==="SYNC-DISPOSE"||e["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof e["[[DisposeMethod]]"]=="function"||typeof e["[[DisposeMethod]]"]>"u")},Fk=rn,Zk=Zu(),Wk=Mk,Hk=Uk,Vk=function(e){return e&&typeof e=="object"&&Fk(e,"[[DisposableResourceStack]]")&&Zk(e["[[DisposableResourceStack]]"])&&(e["[[DisposableResourceStack]]"].length===0||Wk(e["[[DisposableResourceStack]]"],Hk))},Bk=nn,Gk=function(e){if(e===null)return"Null";if(typeof e>"u")return"Undefined";if(Bk(e))return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"},jk=Gk,th=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":jk(e)},qk=K,Yk=Ri,Xk=Ci,Kk=function(e,t){if(!Xk(t))throw new qk("Assertion failed: P is not a Property Key, got "+Yk(t));return e[t]},hp=K,Jk=Kk,Qk=Pi,eE=Ci,dp=Ri,tE=function(e,t){if(!eE(t))throw new hp("Assertion failed: P is not a Property Key");var r=Jk(e,t);if(r!=null){if(!Qk(r))throw new hp(dp(t)+" is not a function: "+dp(r));return r}},Nc={exports:{}},nE=ut,rE=nE,pp=rE("%Reflect.construct%",!0),ya=ho;try{ya({},"",{"[[Get]]":function(){}})}catch{ya=null}if(ya&&pp){var fp={},gp={};ya(gp,"length",{"[[Get]]":function(){throw fp},"[[Enumerable]]":!0}),Nc.exports=function(e){try{pp(e,gp)}catch(t){return t===fp}}}else Nc.exports=function(e){return typeof e=="function"&&!!e.prototype};var iE=Nc.exports,tc=K,mp=Pi,sE=iE,oE=function(e){if(!sE(e))throw new tc("C must be a constructor");var t={"[[Resolve]]":void 0,"[[Reject]]":void 0},r=new e(function(i,s){if(typeof t["[[Resolve]]"]<"u"||typeof t["[[Reject]]"]<"u")throw new tc("executor has already been called");t["[[Resolve]]"]=i,t["[[Reject]]"]=s});if(!mp(t["[[Resolve]]"])||!mp(t["[[Reject]]"]))throw new tc("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":t["[[Resolve]]"],"[[Reject]]":t["[[Reject]]"]}},vp=tn,aE=K,nc=rl,yp=tE,lE=oE,cE=th,bp=Bu(),wp=Gu(),uE=function(e,t){if(cE(e)!=="Object")throw new aE("`V` must be an Object");if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new vp("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(t==="ASYNC-DISPOSE"&&wp&&(r=yp(e,wp)),!r){if(!bp)throw new vp("`Symbol.dispose` is not supported");if(r=yp(e,bp),typeof r<"u")return function(){var i=this;if(t==="ASYNC-DISPOSE"){var s=lE(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},hE=tn,rc=K,dE=Pi,pE=th,fE=uE,gE=function(e,t){if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new hE("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(arguments.length<3)if(e==null)e=void 0,r=void 0;else{if(typeof e<"u"&&pE(e)!=="Object")throw new rc("`V` must be an Object, or `null` or `undefined`");if(r=fE(e,t),typeof r>"u")throw new rc("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!dE(r))throw new rc("`method`, when provided, must be a function");return{"[[ResourceValue]]":e,"[[Hint]]":t,"[[DisposeMethod]]":r}},mE=tn,zo=K,vE=Vk,Sp=gE,yE=Pn(),bE=yE("Array.prototype.push"),Wg=function(e,t,r){if(!vE(e))throw new zo("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new mE("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 zo("Assertion failed: `method`, when present, must be a function");if(!e["[[DisposableResourceStack]]"])throw new zo("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(t==null&&r==="SYNC_DISPOSE")return"UNUSED";s=Sp(t,r)}else{if(typeof t<"u")throw new zo("Assertion failed: `V` must be undefined when `method` is present");s=Sp(void 0,r,i)}return bE(e["[[DisposableResourceStack]]"],s),"UNUSED"},ic,_p;function nh(){if(_p)return ic;_p=1;var n=ut,e=eh,t=tn,r=n("%Promise.resolve%",!0),i=r&&e(r);return ic=function(o,a){if(!i)throw new t("This environment does not support Promises.");return i(o,a)},ic}var sc,kp;function wE(){if(kp)return sc;kp=1;var n=ut,e=tn,t=n("%Promise%",!0),r=rl,i=nh(),s=th;return sc=function(a,c,u){if(typeof a<"u"&&s(a)!=="Object")throw new e("Assertion failed: `V` must be `undefined` or an Object");if(c!=="SYNC-DISPOSE"&&c!=="ASYNC-DISPOSE")throw new e("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");if(typeof u<"u"&&typeof u!="function")throw new e("Assertion failed: `method` must be `undefined` or a function");var h=typeof u>"u"?u:r(u,a);if(c==="ASYNC-DISPOSE")return i(t,h)},sc}var oc,Ep;function SE(){if(Ep)return oc;Ep=1;var n=Ju;return oc=function(t){return new n("throw",t)},oc}var _E=ut,ac=tn,xp=K,kE=_E("%Promise%",!0),EE=Pn(),Ap=EE("Promise.prototype.then",!0),xE=Ju,$p=wE(),AE=Qu,$E=nh(),Ip=SE(),IE=Cg(),Hg=function(e,t){if(!(t instanceof xE))throw new xp("`completion` must be a Completion Record");var r=e["[[DisposableResourceStack]]"];if(!r)throw new xp("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 ac("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&$E(kE,t),a=function(v){if(t.type()==="throw"){var m=t.value(),x=new IE(v,m);t=Ip(x)}else t=Ip(v)},c=i==="ASYNC-DISPOSE"&&function(m){return Ap(o,function(){var x=$p(m["[[ResourceValue]]"],m["[[Hint]]"],m["[[DisposeMethod]]"]);if(!x)throw new ac("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return Ap(x,AE)},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=$p(h["[[ResourceValue]]"],h["[[Hint]]"],h["[[DisposeMethod]]"]);if(p)throw new ac("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(v){a(v)}}return e["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:t},Vg=function(){var e=[];return{"[[DisposableResourceStack]]":e}},ol=Ou,rh=K,TE=rl,Di=Hu,CE=ho,Bg=Pi,PE=Qu,Xe=Ku,RE=Fg,Gg=xr.supportsDescriptors,DE=eh,ih=Wg,LE=Hg,jg=Vg,Tp=Bu(),at=function n(){if(!(this instanceof n)||Xe.has(this,"[[DisposableState]]")||Xe.has(this,"[[DisposeCapability]]"))throw new rh("can only be used with new");Xe.set(this,"[[DisposableState]]","PENDING"),Xe.set(this,"[[DisposeCapability]]",jg())},qg=function(){var e=this;return Xe.assert(e,"[[DisposableState]]"),Xe.get(e,"[[DisposableState]]")==="DISPOSED"},go=DE(qg);Gg?CE(at.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":qg}):at.prototype.disposed=!1;var Yg=function(e){Xe.set(e,"[[DisposableState]]","DISPOSED"),Gg||(e.disposed=!0)};Di(at.prototype,"dispose",function(){var e=this;if(!go(e))return Yg(e),LE(Xe.get(e,"[[DisposeCapability]]"),PE())["?"]()});Di(at.prototype,"use",function(e){var t=this;if(go(t))throw new ol("a disposed stack can not use anything new");return ih(Xe.get(t,"[[DisposeCapability]]"),e,"SYNC-DISPOSE"),e});Di(at.prototype,"adopt",function(e,t){var r=this;if(go(r))throw new ol("a disposed stack can not use anything new");if(!Bg(t))throw new rh("`onDispose` must be a function");var i=function(){return TE(t,void 0,[e])};return ih(Xe.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),e});Di(at.prototype,"defer",function(e){var t=this;if(go(t))throw new ol("a disposed stack can not defer anything new");if(!Bg(e))throw new rh("`onDispose` must be a function");ih(Xe.get(t,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",e)});Di(at.prototype,"move",function(){var e=this;if(go(e))throw new ol("a disposed stack can not use anything new");var t=new at;return Xe.set(t,"[[DisposeCapability]]",Xe.get(e,"[[DisposeCapability]]")),Xe.set(e,"[[DisposeCapability]]",jg()),Yg(e),t});Tp&&Di(at.prototype,Tp,at.prototype.dispose);RE(at.prototype,"DisposableStack");var zE=at,OE=zE,ME=function(){return typeof DisposableStack=="function"?DisposableStack:OE},NE=xr,UE=Lu(),FE=ME,ZE=function(){var e=FE();return NE(UE,{DisposableStack:e},{DisposableStack:!0}),e},WE=ut,al=Ou,sh=K,Cp=WE("%Promise%",!0),oh=Wg,HE=rl,Li=Hu,VE=ho,BE=Hg,Xg=Pi,Kg=Vg,GE=Qu,Pp=nh(),Ke=Ku,jE=Fg,Jg=xr.supportsDescriptors,qE=eh,YE=Pn(),XE=YE("Promise.prototype.then",!0),Rp=Gu(),lt=function n(){if(!(this instanceof n)||Ke.has(this,"[[AsyncDisposableState]]")||Ke.has(this,"[[DisposeCapability]]"))throw new sh("can only be used with new");Ke.set(this,"[[AsyncDisposableState]]","pending"),Ke.set(this,"[[DisposeCapability]]",Kg())},Qg=function(){var e=this;return Ke.assert(e,"[[AsyncDisposableState]]"),Ke.get(e,"[[AsyncDisposableState]]")==="disposed"},mo=qE(Qg);Jg?VE(lt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Qg}):lt.prototype.disposed=!1;var em=function(e){Ke.set(e,"[[AsyncDisposableState]]","disposed"),Jg||(e.disposed=!0)};Li(lt.prototype,"disposeAsync",function(){var e=this;return mo(e)?Pp(Cp):(em(e),XE(Pp(Cp,BE(Ke.get(e,"[[DisposeCapability]]"),GE())),function(t){return t["?"]()}))});Li(lt.prototype,"use",function(e){var t=this;if(mo(t))throw new al("a disposed stack can not use anything new");return oh(Ke.get(t,"[[DisposeCapability]]"),e,"ASYNC-DISPOSE"),e});Li(lt.prototype,"adopt",function(e,t){var r=this;if(mo(r))throw new al("a disposed stack can not use anything new");if(!Xg(t))throw new sh("`onDisposeAsync` must be a function");var i=function(){return HE(t,void 0,[e])};return i.value=e,oh(Ke.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),e});Li(lt.prototype,"defer",function(e){var t=this;if(mo(t))throw new al("a disposed stack can not defer anything new");if(!Xg(e))throw new sh("`onDispose` must be a function");oh(Ke.get(t,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",e)});Li(lt.prototype,"move",function(){var e=this;if(mo(e))throw new al("a disposed stack can not use anything new");var t=new lt;return Ke.set(t,"[[DisposeCapability]]",Ke.get(e,"[[DisposeCapability]]")),Ke.set(e,"[[DisposeCapability]]",Kg()),em(e),t});Rp&&Li(lt.prototype,Rp,lt.prototype.disposeAsync);jE(lt.prototype,"AsyncDisposableStack");var KE=lt,JE=KE,QE=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:JE},ex=xr,tx=Lu(),nx=QE,rx=function(){var e=nx();return ex(tx,{AsyncDisposableStack:e},{AsyncDisposableStack:!0}),e},ix=e_,sx=l_,ox=ZE,ax=rx,lx=function(){ix(),sx(),ox(),ax()};lx();const Dp=new WeakMap;function cx(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function Nr(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function Lp(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function ux(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class hx{constructor(){b(this,"entries",new Map);b(this,"constructionStack",[])}register(e,t){if(t===void 0){if(typeof e!="function")throw Lp();this.validateClassRegistration(e),this.storeFactory(e,()=>this.instantiateClass(e));return}if(typeof t!="function")throw Lp();if(t.constructor.name==="AsyncFunction")throw ux();this.storeFactory(e,t)}has(e){var t;return((t=this.entries.get(e))==null?void 0:t.factory)!==void 0}resolve(e){return this.resolveAny(e)}storeFactory(e,t){const r=this.getOrCreateEntry(e);r.factory=t,r.instance=void 0,r.error=void 0}validateClassRegistration(e){const t=Dp.get(e);if(t){if(e.length!==t.length)throw new Error(`${Nr(e)} cannot be registered with register(Class). @injectable(...) declared ${t.length} dependencies but constructor arity is ${e.length}. Use register(Key, () => value) instead.`);return}if(e.length!==0)throw new Error(`${Nr(e)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(e){const t=Dp.get(e);if(!t)return new e;const r=t.map(i=>this.resolveAny(i));return new e(...r)}resolveAny(e){return this.getOrCreateEntry(e).proxy}getOrCreateEntry(e){let t=this.entries.get(e);return t||(t={key:e},t.proxy=this.createProxy(t),this.entries.set(e,t),t)}createProxy(e){return new Proxy({},{get:(t,r)=>{if(r==="then")return;const i=this.getInstance(e),s=Reflect.get(i,r,i);return typeof s=="function"?s.bind(i):s},set:(t,r,i)=>{const s=this.getInstance(e);return Reflect.set(s,r,i,s)},has:(t,r)=>{const i=this.getInstance(e);return r in i}})}getInstance(e){if(e.instance)return e.instance;if(e.error)throw e.error;if(!e.factory)throw new Error(`${Nr(e.key)} was resolved but never registered`);const t=this.constructionStack.indexOf(e.key);if(t!==-1){const r=[...this.constructionStack.slice(t),e.key].map(i=>Nr(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(e.key);try{const r=e.factory();if(cx(r))throw new Error(`Factory for ${Nr(e.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${Nr(e.key)} returned a non-object value. Wrap primitives in an object.`);return e.instance=r,r}catch(r){throw e.error=r,r}finally{this.constructionStack.pop()}}}const zt=new hx,dx=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function px(n){for(const e of Object.keys(n))if(dx.has(e))throw new Error(`Event payload key "${e}" is reserved; choose a different property name`)}function fx(n,e){px(e);for(const t of Object.keys(e))Object.defineProperty(n,t,{value:e[t],writable:!0,enumerable:!0,configurable:!0})}function nt(){class n extends Event{constructor(t,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(t,{bubbles:s,cancelable:o,composed:a}),fx(this,c)}}return n}class Ot extends globalThis.EventTarget{}function gx(n,e,t){const r=n.dispose.bind(n);n.dispose=()=>{if(!e())return t(),r()}}function vo(n){var t;class e extends n{constructor(...s){super(...s);w(this,t,!1);gx(this,()=>l(this,t),()=>{k(this,t,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return l(this,t)}}return t=new WeakMap,e}const mx=nt(),vx=nt(),na=nt(),tm="0123456789ABCDEFGHJKMNPQRSTVWXYZ",ba=32,yx=16,nm=10,zp=0xffffffffffff;var qn;(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"})(qn||(qn={}));class Qi extends Error{constructor(e,t){super(`${t} (${e})`),this.name="ULIDError",this.code=e}}function bx(n){const e=Math.floor(n()*ba)%ba;return tm.charAt(e)}function wx(n){const e=Sx(),t=e&&(e.crypto||e.msCrypto)||null;if(typeof(t==null?void 0:t.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return t.getRandomValues(r),r[0]/256};if(typeof(t==null?void 0:t.randomBytes)=="function")return()=>t.randomBytes(1).readUInt8()/256;throw new Qi(qn.PRNGDetectFailure,"Failed to find a reliable PRNG")}function Sx(){return Ex()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function _x(n,e){let t="";for(;n>0;n--)t=bx(e)+t;return t}function kx(n,e=nm){if(isNaN(n))throw new Qi(qn.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>zp)throw new Qi(qn.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${zp}: ${n}`);if(n<0)throw new Qi(qn.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Qi(qn.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let t,r="";for(let i=e;i>0;i--)t=n%ba,r=tm.charAt(t)+r,n=(n-t)/ba;return r}function Ex(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function ll(n,e){const t=wx(),r=Date.now();return kx(r,nm)+_x(yx,t)}const wt=4,tt=6,ps=2,Uc=2,ah=8,xx=tt,lh="auto",An="auto",hn=120,Op=50,ce=16,br=hn*wt+ce*(wt-1),wa=hn*tt+ce*(tt-1),Ax=br+ce*2,$x=200,Ix=4,Oo=150,Tx=10,Mp=2,Np=8,Cx=300,Px=4;function rm(n){return om(n)}function im(n,e){return om(n.flatMap(t=>lm(t,e)))}function sm(n){const e=[],t=new Set;for(const r of n){if(r.type==="row"){e.push(`Top-level rows are invalid: ${r.id}`);continue}cm(r,"strip",e,t)}return{valid:e.length===0,errors:e}}function Xr(n){const e=rm(n),t=sm(e);if(!t.valid)throw new Error(`Invalid layout: ${t.errors.join("; ")}`);return{totalNodes:e.length,nodes:e.filter(r=>r.type!=="row").map(zx)}}function om(n){const e=[];for(const t of n){const r=am(t);for(const i of r){if(i.type==="row"){e.push(...i.children.map(en));continue}e.push(i)}}return e}function am(n){switch(n.type){case"card":return[en(n)];case"row":{const e=n.children.map(en);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=[];for(const t of n.children){const r=am(t);for(const i of r){if(i.type==="stack"){e.push(...i.children.map(Fc));continue}if(i.type==="row"){e.push({...i,children:i.children.map(en)});continue}e.push(en(i))}}return e.length===0?[]:e.length===1?[Fc(e[0])]:[{...n,children:e}]}}}function lm(n,e){switch(n.type){case"card":return n.artifactID===e?[]:[en(n)];case"row":{const t=n.children.filter(r=>r.artifactID!==e).map(en);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=n.children.flatMap(r=>lm(r,e).filter(s=>s.type!=="stack"));return t.length===0?[]:t.length===1?[Fc(t[0])]:[{...n,children:t}]}}}function cm(n,e,t,r){switch(n.type){case"card":um(n,e,t,r);return;case"row":Rx(n,e,t,r);return;case"stack":Dx(n,e,t,r);return}}function um(n,e,t,r){ch(n.id,t),typeof n.artifactID!="string"||n.artifactID.length===0?t.push(`Card ${n.id} is missing artifactID`):r.has(n.artifactID)?t.push(`Duplicate artifactID in layout: ${n.artifactID}`):r.add(n.artifactID),Lx(n.width)||t.push(`Card ${n.id} width must be an integer in the range ${ps}-${ah}`),hm(n.height)||t.push(`Card ${n.id} height must be an integer in the range 2-6 or "auto"`);const i=Bn(n.width);e==="row"&&i<ps&&t.push(`Row child ${n.id} must be at least 2 columns wide`)}function Rx(n,e,t,r){if(ch(n.id,t),e!=="stack"&&t.push(`Row ${n.id} may only appear inside a stack`),hm(n.height,Px)||t.push(`Row ${n.id} height must be an integer in the range 2-4 or "auto"`),!Array.isArray(n.children)||n.children.length===0){t.push(`Row ${n.id} must contain card nodes`);return}let i=0;for(const s of n.children){if(s.type!=="card"){t.push(`Row ${n.id} must contain only card nodes`);continue}um(s,"row",t,r),i+=Bn(s.width)}i!==wt&&t.push(`Row ${n.id} children must sum to 4 columns`)}function Dx(n,e,t,r){if(ch(n.id,t),e!=="strip"&&t.push(`Invalid nested stack at ${n.id}; stack children cannot contain another nested stack`),!Array.isArray(n.children)||n.children.length===0){t.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"){t.push(`Stack ${n.id} cannot contain another nested stack`);continue}if(cm(a,"stack",t,r),a.height===An){s+=1;continue}i+=a.height}if(i>tt&&t.push(`Stack ${n.id} exceeds the 6-row budget`),s===0)return;const o=tt-i;if(o<s*Uc||o%s!==0){t.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<Uc&&t.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function ch(n,e){(typeof n!="string"||n.length===0)&&e.push(`Node id must be a non-empty string: ${String(n)}`)}function Lx(n){return n===lh||Number.isInteger(n)&&n>=ps&&n<=ah}function hm(n,e=xx){return n===An||Number.isInteger(n)&&n>=Uc&&n<=e}function Bn(n){return n===lh?wt:n}function zx(n){if(n.type==="card")return{id:n.id,type:"card",width:Bn(n.width),cards:[{id:n.id,artifactID:n.artifactID,col:1,row:1,width:Bn(n.width),height:dm(n.height,tt)}]};const e=Ox(n.children),t=[];let r=1;for(let i=0;i<n.children.length;i+=1){const s=n.children[i],o=e[i];if(s.type==="card")t.push({id:s.id,artifactID:s.artifactID,col:1,row:r,width:Math.min(wt,Bn(s.width)),height:o});else{let a=1;for(const c of s.children)t.push({id:c.id,artifactID:c.artifactID,col:a,row:r,width:Bn(c.width),height:o}),a+=Bn(c.width)}r+=o}return{id:n.id,type:"stack",width:t.reduce((i,s)=>Math.max(i,s.col+s.width-1),1),cards:t}}function Ox(n){let e=0,t=0;for(const i of n)i.height===An?t+=1:e+=i.height;const r=t>0?(tt-e)/t:0;return n.map(i=>dm(i.height,r))}function dm(n,e){return n===An?e:n}function en(n){return{...n}}function Fc(n){return n.type==="card"?en(n):{...n,children:n.children.map(en)}}function pm(n,e={}){return{id:e.id??ll(),type:"card",artifactID:n,width:e.width??lh,height:e.height??An}}function fm(n,e){return n.some(t=>gm(t,e))}function gm(n,e){switch(n.type){case"card":return n.artifactID===e;case"row":return n.children.some(t=>t.artifactID===e);case"stack":return n.children.some(t=>gm(t,e))}}function Up(n){return n.layout.flatMap(mm)}function mm(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(e=>e.artifactID);case"stack":return n.children.flatMap(mm)}}const ie=nt(),vm=nt(),Ur=nt(),Mx=nt();function Nx(n){class e extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return e}const Ux=Nx("RequestError"),Fx=200,Zx=300;class Wx{constructor(e,t){b(this,"serverURL");b(this,"token");this.serverURL=e.replace(/\/$/,""),this.token=t.token}async requestJSON(e,t,r){const i=await this.request(e,t,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0),s=await Hx(i);if(!i.ok||i.status<Fx||i.status>=Zx)throw this.createError(typeof s.error=="string"?s.error:i.statusText,i.status);return s}async requestVoid(e,t){const r=await this.request(e,t);if(!r.ok)throw this.createError(await lc(r,r.statusText),r.status)}async requestText(e,t){const r=await this.request(e,t);if(!r.ok)throw this.createError(await lc(r,r.statusText),r.status);return r.text()}async requestRawVoid(e,t,r){const i=await this.request(e,t,r,{"content-type":"text/plain"});if(!i.ok)throw this.createError(await lc(i,i.statusText),i.status)}createError(e,t){const r={serverURL:this.serverURL};return t!==void 0&&(r.status=t),new Ux(e,r)}async request(e,t,r,i){const s=`${this.serverURL}${t}`;try{return await fetch(s,{method:e,headers:this.buildHeaders(i),body:r})}catch(o){throw this.createError(o instanceof Error?o.message:"Failed to reach server")}}buildHeaders(e){const t={...e??{}};return this.token&&(t.Authorization=`Bearer ${this.token}`),Object.keys(t).length>0?t:void 0}}async function Hx(n){try{return await n.json()}catch{const e=await n.text().catch(()=>"");return e?{message:e}:{}}}async function lc(n,e){try{const t=await n.json();if(typeof t.error=="string")return t.error;if(typeof t.message=="string")return t.message}catch{}return e}function Vx(n){return n.map(e=>`${e.name} (${e.id})`).join(", ")}var It,Da,ym;class Bx{constructor(e){w(this,Da);w(this,It);k(this,It,e)}list(){return l(this,It).requestJSON("GET","/screens")}async get(e={}){const t=await f(this,Da,ym).call(this,e.screenID);return l(this,It).requestJSON("GET",`/screens/${encodeURIComponent(t)}`)}create(e){const t={name:e.name};return e.id!==void 0&&(t.id=e.id),l(this,It).requestJSON("POST","/screens",t)}update(e){const{screenID:t,...r}=e;return l(this,It).requestJSON("PATCH",`/screens/${encodeURIComponent(t)}`,r)}remove(e){return l(this,It).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}`)}}It=new WeakMap,Da=new WeakSet,ym=async function(e){if(e!==void 0)return e;const{screens:t}=await this.list();if(t.length===1)return t[0].id;throw l(this,It).createError(`screenID is required when multiple screens exist. Available screens: ${Vx(t)}`)};var Le;class Gx{constructor(e){w(this,Le);k(this,Le,e)}create(e){const t={type:e.type,title:e.title};return e.externalFilePath!==void 0&&(t.externalFilePath=e.externalFilePath),e.externalURL!==void 0&&(t.externalURL=e.externalURL),e.screenID!==void 0&&(t.screenID=e.screenID),l(this,Le).requestJSON("POST","/artifacts",t)}list(e={}){const t=new URLSearchParams;e.screenID!==void 0&&t.set("screenID",e.screenID),e.unplaced&&t.set("unplaced","true");const r=t.toString();return l(this,Le).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(e){return l(this,Le).requestJSON("GET",`/artifacts/${encodeURIComponent(e.artifactID)}`)}update(e){const t={};return e.title!==void 0&&(t.title=e.title),l(this,Le).requestJSON("PATCH",`/artifacts/${encodeURIComponent(e.artifactID)}`,t)}edit(e){return l(this,Le).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/edit`)}commitPending(e){return l(this,Le).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/commit`)}abandonPending(e){return l(this,Le).requestVoid("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/abandon`)}attach(e){return l(this,Le).requestJSON("POST",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}detach(e){return l(this,Le).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}delete(e){return l(this,Le).requestJSON("DELETE",`/artifacts/${encodeURIComponent(e.artifactID)}`)}getContent(e){return l(this,Le).requestText("GET",`/artifacts/${encodeURIComponent(e.artifactID)}/content`)}putContent(e){return l(this,Le).requestRawVoid("PUT",`/artifacts/${encodeURIComponent(e.artifactID)}/content`,e.content)}}Le=new WeakMap;var Kn;class jx{constructor(e){w(this,Kn);k(this,Kn,e)}state(){return l(this,Kn).requestJSON("GET","/viewer/state")}setActive(e){return l(this,Kn).requestJSON("PUT","/viewer/active-screen",{screenID:e.screenID})}focus(e){const t={artifactID:e.artifactID};return e.screenID!==void 0&&(t.screenID=e.screenID),l(this,Kn).requestJSON("POST","/viewer/focus",t)}}Kn=new WeakMap;var ws;class qx{constructor(e){w(this,ws);k(this,ws,e)}async list(){const{views:e}=await l(this,ws).requestJSON("GET","/views");return e}}ws=new WeakMap;var Bt;class Yx{constructor(e,t={}){b(this,"screens");b(this,"artifacts");b(this,"viewer");b(this,"views");w(this,Bt);k(this,Bt,new Wx(e,t)),this.screens=new Bx(l(this,Bt)),this.artifacts=new Gx(l(this,Bt)),this.viewer=new jx(l(this,Bt)),this.views=new qx(l(this,Bt))}health(){return l(this,Bt).requestJSON("GET","/health")}}Bt=new WeakMap;const Xx={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},Kx=vo(Ot);var Jn,Be,Qn,Ne,pt,pn,fn,re,Zn,bm,Ss,wm,Sm,_m,km,Zc,Wc,Hc,Em;class Jx extends Kx{constructor(t){var i;super();w(this,re);b(this,"id");b(this,"server");w(this,Jn);w(this,Be,new Map);w(this,Qn);w(this,Ne);w(this,pt);w(this,pn);w(this,fn,null);w(this,Ss,t=>{if(this.disposed)return;const r=t.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&f(this,re,wm).call(this,r.screen);break;case"artifact-created":break;case"artifact-attached":r.screenID===this.id&&f(this,re,Sm).call(this,r.cardID,r.artifact);break;case"artifact-updated":f(this,re,_m).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&f(this,re,km).call(this,r.artifactID);break;case"artifact-content-changed":l(this,Be).has(r.artifactID)&&this.dispatchEvent(new Mx("artifact-content-changed",{artifactID:r.artifactID}));break}});this.id=t.screen.id,this.server=t.server,k(this,Jn,t.localStore),k(this,Qn,t.screen.name),k(this,Ne,structuredClone(t.screen.layout)),k(this,pt,t.screen.pinned);const r=((i=l(this,Jn).get().screens[this.id])==null?void 0:i.scrollPosition)??0;k(this,pn,Math.max(0,r)),this.server.addEventListener("server-event",l(this,Ss)),f(this,re,bm).call(this)}get name(){return l(this,Qn)}get layout(){return l(this,Ne)}get pinned(){return l(this,pt)}get scrollPosition(){return l(this,pn)}get artifacts(){return l(this,Be)}setScrollPosition(t){f(this,re,Zn).call(this);const r=Math.max(0,t);r!==l(this,pn)&&(k(this,pn,r),f(this,re,Em).call(this),this.dispatchEvent(new ie("change")))}setLayout(t){f(this,re,Zn).call(this);const r=rm(t);if(!sm(r).valid)return;const s=f(this,re,Wc).call(this);k(this,Ne,r),k(this,fn,{layout:r,snapshot:s}),this.dispatchEvent(new ie("change")),this.server.client.screens.update({screenID:this.id,layout:r.map(o=>structuredClone(o))}).catch(()=>{var o;this.disposed||((o=l(this,fn))==null?void 0:o.layout)===r&&(k(this,fn,null),f(this,re,Hc).call(this,s),this.dispatchEvent(new ie("change")))})}rename(t){f(this,re,Zn).call(this),k(this,Qn,t),this.dispatchEvent(new ie("change")),this.server.client.screens.update({screenID:this.id,name:t}).catch(()=>{})}setPinned(t){if(f(this,re,Zn).call(this),l(this,pt)===t)return;const r=l(this,pt);k(this,pt,t),this.dispatchEvent(new ie("change")),this.server.client.screens.update({screenID:this.id,pinned:t}).catch(()=>{this.disposed||l(this,pt)===t&&(k(this,pt,r),this.dispatchEvent(new ie("change")))})}async remove(){f(this,re,Zn).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(t){if(f(this,re,Zn).call(this),!l(this,Be).has(t))return;const r=f(this,re,Wc).call(this);f(this,re,Zc).call(this,t),this.dispatchEvent(new ie("change")),this.server.client.artifacts.detach({artifactID:t,screenID:this.id}).catch(()=>{this.disposed||(f(this,re,Hc).call(this,r),this.dispatchEvent(new ie("change")))})}dispose(){this.server.removeEventListener("server-event",l(this,Ss))}}Jn=new WeakMap,Be=new WeakMap,Qn=new WeakMap,Ne=new WeakMap,pt=new WeakMap,pn=new WeakMap,fn=new WeakMap,re=new WeakSet,Zn=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},bm=async function(){try{const t=await this.server.client.screens.get({screenID:this.id});if(this.disposed)return;for(const r of t.artifacts)l(this,Be).set(r.id,r);this.dispatchEvent(new ie("change"))}catch{}},Ss=new WeakMap,wm=function(t){l(this,fn)&&k(this,fn,null),k(this,Qn,t.name),k(this,Ne,structuredClone(t.layout)),k(this,pt,t.pinned),this.dispatchEvent(new ie("change"))},Sm=function(t,r){fm(l(this,Ne),r.id)||k(this,Ne,[...l(this,Ne),pm(r.id,{id:t})]),l(this,Be).set(r.id,r),this.dispatchEvent(new ie("change"))},_m=function(t){const r=l(this,Be).get(t.id);r&&(l(this,Be).set(t.id,{...r,...t}),this.dispatchEvent(new ie("change")))},km=function(t){f(this,re,Zc).call(this,t)&&this.dispatchEvent(new ie("change"))},Zc=function(t){const r=l(this,Be).delete(t),i=Up({layout:l(this,Ne)}).length,s=im(l(this,Ne),t),o=Up({layout:s}).length;return k(this,Ne,s),r||i!==o},Wc=function(){return{layout:structuredClone(l(this,Ne)),artifacts:new Map([...l(this,Be).entries()].map(([t,r])=>[t,structuredClone(r)]))}},Hc=function(t){k(this,Ne,structuredClone(t.layout)),l(this,Be).clear();for(const[r,i]of t.artifacts)l(this,Be).set(r,structuredClone(i))},Em=function(){const t=l(this,Jn).get();l(this,Jn).set({...t,screens:{...t.screens,[this.id]:{scrollPosition:l(this,pn)}}})};const Qx=vo(Ot);var it,Tt,ft,_s,ks,Es,ti,ra;class e1 extends Qx{constructor(t){super();w(this,ti);w(this,it);w(this,Tt);w(this,ft,null);w(this,_s,()=>{this.disposed||f(this,ti,ra).call(this)});w(this,ks,()=>{this.disposed||f(this,ti,ra).call(this)});w(this,Es,t=>{var i;if(this.disposed)return;const r=t.event;if(r.type==="screen-removed"&&((i=l(this,ft))==null?void 0:i.id)===r.screenID&&this.clearActive(),r.type==="viewer-active-screen-changed"){const s=l(this,Tt).servers.get(t.serverURL);s&&s.screens.has(r.screenID)&&this.setActive(t.serverURL,r.screenID)}});k(this,it,t.localStore),k(this,Tt,t.serverManager),l(this,it).addEventListener("change",l(this,_s)),l(this,Tt).addEventListener("change",l(this,ks)),l(this,Tt).addEventListener("server-event",l(this,Es)),f(this,ti,ra).call(this)}get activeScreen(){return l(this,ft)}setActive(t,r){const i=l(this,it).get();i.activeServerURL===t&&i.activeScreenID===r||l(this,it).set({...i,activeServerURL:t,activeScreenID:r})}clearActive(){const t=l(this,it).get();t.activeScreenID!==null&&l(this,it).set({...t,activeScreenID:null})}dispose(){var t;l(this,it).removeEventListener("change",l(this,_s)),l(this,Tt).removeEventListener("change",l(this,ks)),l(this,Tt).removeEventListener("server-event",l(this,Es)),(t=l(this,ft))==null||t.dispose(),k(this,ft,null)}}it=new WeakMap,Tt=new WeakMap,ft=new WeakMap,_s=new WeakMap,ks=new WeakMap,Es=new WeakMap,ti=new WeakSet,ra=function(){var c,u,h;const{activeServerURL:t,activeScreenID:r}=l(this,it).get(),i=t?l(this,Tt).servers.get(t)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((c=l(this,ft))==null?void 0:c.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=l(this,ft))==null?void 0:u.server)===i||((h=l(this,ft))==null||h.dispose(),k(this,ft,i&&s?new Jx({screen:s,server:i,localStore:l(this,it)}):null),i&&i.acpClient.setScreenContext(s?{screenID:s.id,screenName:s.name}:null),this.dispatchEvent(new mx("active-screen-changed")))};const t1="Local",n1="store-";function dt(n){return new URL(n).origin}function r1(n){return{servers:[{url:dt(n),name:t1}],activeServerURL:null,activeScreenID:null,screens:{}}}var er,tr,nr;class i1 extends Ot{constructor(t,r,i={}){super();w(this,er);w(this,tr);w(this,nr);k(this,er,`${n1}${t}`),k(this,tr,i.storage??s1());const s=l(this,tr).getItem(l(this,er));s===null?(k(this,nr,r),l(this,tr).setItem(l(this,er),JSON.stringify(r))):k(this,nr,JSON.parse(s))}get(){return l(this,nr)}set(t){k(this,nr,t),l(this,tr).setItem(l(this,er),JSON.stringify(t)),this.dispatchEvent(new ie("change"))}}er=new WeakMap,tr=new WeakMap,nr=new WeakMap;function s1(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function A(n,e,t){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),e(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=(t==null?void 0:t.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function o(a){var c;const u=t!=null&&t.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 t!=null&&t.Parent&&a instanceof t.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 ei extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class xm extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Am={};function $n(n){return Am}function $m(n){const e=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function Vc(n,e){return typeof e=="bigint"?e.toString():e}function uh(n){return{get value(){{const e=n();return Object.defineProperty(this,"value",{value:e}),e}}}}function hh(n){return n==null}function dh(n){const e=n.startsWith("^")?1:0,t=n.endsWith("$")?n.length-1:n.length;return n.slice(e,t)}function o1(n,e){const t=(n.toString().split(".")[1]||"").length,r=e.toString();let i=(r.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c!=null&&c[1]&&(i=Number.parseInt(c[1]))}const s=t>i?t:i,o=Number.parseInt(n.toFixed(s).replace(".","")),a=Number.parseInt(e.toFixed(s).replace(".",""));return o%a/10**s}const Fp=Symbol("evaluating");function oe(n,e,t){let r;Object.defineProperty(n,e,{get(){if(r!==Fp)return r===void 0&&(r=Fp,r=t()),r},set(i){Object.defineProperty(n,e,{value:i})},configurable:!0})}function $r(n,e,t){Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function Dn(...n){const e={};for(const t of n){const r=Object.getOwnPropertyDescriptors(t);Object.assign(e,r)}return Object.defineProperties({},e)}function Zp(n){return JSON.stringify(n)}function a1(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Im="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function Sa(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const l1=uh(()=>{var n;if(typeof navigator<"u"&&((n=navigator==null?void 0:navigator.userAgent)!=null&&n.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ki(n){if(Sa(n)===!1)return!1;const e=n.constructor;if(e===void 0||typeof e!="function")return!0;const t=e.prototype;return!(Sa(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function Tm(n){return ki(n)?{...n}:Array.isArray(n)?[...n]:n}const c1=new Set(["string","number","symbol"]);function Ei(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ln(n,e,t){const r=new n._zod.constr(e??n._zod.def);return(!e||t!=null&&t.parent)&&(r._zod.parent=n),r}function z(n){const e=n;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function u1(n){return Object.keys(n).filter(e=>n[e]._zod.optin==="optional"&&n[e]._zod.optout==="optional")}const h1={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 d1(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=Dn(n._zod.def,{get shape(){const o={};for(const a in e){if(!(a in t.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(o[a]=t.shape[a])}return $r(this,"shape",o),o},checks:[]});return Ln(n,s)}function p1(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=Dn(n._zod.def,{get shape(){const o={...n._zod.def.shape};for(const a in e){if(!(a in t.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete o[a]}return $r(this,"shape",o),o},checks:[]});return Ln(n,s)}function f1(n,e){if(!ki(e))throw new Error("Invalid input to extend: expected a plain object");const t=n._zod.def.checks;if(t&&t.length>0){const s=n._zod.def.shape;for(const o in e)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=Dn(n._zod.def,{get shape(){const s={...n._zod.def.shape,...e};return $r(this,"shape",s),s}});return Ln(n,i)}function g1(n,e){if(!ki(e))throw new Error("Invalid input to safeExtend: expected a plain object");const t=Dn(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e};return $r(this,"shape",r),r}});return Ln(n,t)}function m1(n,e){const t=Dn(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e._zod.def.shape};return $r(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return Ln(n,t)}function v1(n,e,t){const i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=Dn(e._zod.def,{get shape(){const a=e._zod.def.shape,c={...a};if(t)for(const u in t){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);t[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 $r(this,"shape",c),c},checks:[]});return Ln(e,o)}function y1(n,e,t){const r=Dn(e._zod.def,{get shape(){const i=e._zod.def.shape,s={...i};if(t)for(const o in t){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(s[o]=new n({type:"nonoptional",innerType:i[o]}))}else for(const o in i)s[o]=new n({type:"nonoptional",innerType:i[o]});return $r(this,"shape",s),s}});return Ln(e,r)}function Kr(n,e=0){var t;if(n.aborted===!0)return!0;for(let r=e;r<n.issues.length;r++)if(((t=n.issues[r])==null?void 0:t.continue)!==!0)return!0;return!1}function Jr(n,e){return e.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(n),t})}function Mo(n){return typeof n=="string"?n:n==null?void 0:n.message}function In(n,e,t){var i,s,o,a,c,u;const r={...n,path:n.path??[]};if(!n.message){const h=Mo((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??Mo((a=e==null?void 0:e.error)==null?void 0:a.call(e,n))??Mo((c=t.customError)==null?void 0:c.call(t,n))??Mo((u=t.localeError)==null?void 0:u.call(t,n))??"Invalid input";r.message=h}return delete r.inst,delete r.continue,e!=null&&e.reportInput||delete r.input,r}function ph(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function fs(...n){const[e,t,r]=n;return typeof e=="string"?{message:e,code:"custom",input:t,inst:r}:{...e}}const Cm=(n,e)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:e,enumerable:!1}),n.message=JSON.stringify(e,Vc,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},Pm=A("$ZodError",Cm),Rm=A("$ZodError",Cm,{Parent:Error});function b1(n,e=t=>t.message){const t={},r=[];for(const i of n.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:t}}function w1(n,e=t=>t.message){const t={_errors:[]},r=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(o=>r({issues:o}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)t._errors.push(e(s));else{let o=t,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(e(s))):o[c]=o[c]||{_errors:[]},o=o[c],a++}}};return r(n),t}const fh=n=>(e,t,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},o=e._zod.run({value:t,issues:[]},s);if(o instanceof Promise)throw new ei;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>In(c,s,$n())));throw Im(a,i==null?void 0:i.callee),a}return o.value},gh=n=>async(e,t,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=e._zod.run({value:t,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>In(c,s,$n())));throw Im(a,i==null?void 0:i.callee),a}return o.value},cl=n=>(e,t,r)=>{const i=r?{...r,async:!1}:{async:!1},s=e._zod.run({value:t,issues:[]},i);if(s instanceof Promise)throw new ei;return s.issues.length?{success:!1,error:new(n??Pm)(s.issues.map(o=>In(o,i,$n())))}:{success:!0,data:s.value}},S1=cl(Rm),ul=n=>async(e,t,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=e._zod.run({value:t,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new n(s.issues.map(o=>In(o,i,$n())))}:{success:!0,data:s.value}},_1=ul(Rm),k1=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return fh(n)(e,t,i)},E1=n=>(e,t,r)=>fh(n)(e,t,r),x1=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return gh(n)(e,t,i)},A1=n=>async(e,t,r)=>gh(n)(e,t,r),$1=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return cl(n)(e,t,i)},I1=n=>(e,t,r)=>cl(n)(e,t,r),T1=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ul(n)(e,t,i)},C1=n=>async(e,t,r)=>ul(n)(e,t,r),P1=/^[cC][^\s-]{8,}$/,R1=/^[0-9a-z]+$/,D1=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,L1=/^[0-9a-vA-V]{20}$/,z1=/^[A-Za-z0-9]{27}$/,O1=/^[a-zA-Z0-9_-]{21}$/,M1=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,N1=/^([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})$/,Wp=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)$/,U1=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,F1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Z1(){return new RegExp(F1,"u")}const W1=/^(?:(?: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])$/,H1=/^(([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}|:))$/,V1=/^((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])$/,B1=/^(([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])$/,G1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Dm=/^[A-Za-z0-9_-]*$/,j1=/^\+[1-9]\d{6,14}$/,Lm="(?:(?:\\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])))",q1=new RegExp(`^${Lm}$`);function zm(n){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${e}`:n.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${n.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Y1(n){return new RegExp(`^${zm(n)}$`)}function X1(n){const e=zm({precision:n.precision}),t=["Z"];n.local&&t.push(""),n.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${t.join("|")})`;return new RegExp(`^${Lm}T(?:${r})$`)}const K1=n=>{const e=n?`[\\s\\S]{${(n==null?void 0:n.minimum)??0},${(n==null?void 0:n.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},J1=/^-?\d+$/,Om=/^-?\d+(?:\.\d+)?$/,Q1=/^(?:true|false)$/i,eA=/^[^A-Z]*$/,tA=/^[^a-z]*$/,Je=A("$ZodCheck",(n,e)=>{var t;n._zod??(n._zod={}),n._zod.def=e,(t=n._zod).onattach??(t.onattach=[])}),Mm={number:"number",bigint:"bigint",object:"date"},Nm=A("$ZodCheckLessThan",(n,e)=>{Je.init(n,e);const t=Mm[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:t,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),Um=A("$ZodCheckGreaterThan",(n,e)=>{Je.init(n,e);const t=Mm[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:t,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),nA=A("$ZodCheckMultipleOf",(n,e)=>{Je.init(n,e),n._zod.onattach.push(t=>{var r;(r=t._zod.bag).multipleOf??(r.multipleOf=e.value)}),n._zod.check=t=>{if(typeof t.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof t.value=="bigint"?t.value%e.value===BigInt(0):o1(t.value,e.value)===0)||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:e.value,input:t.value,inst:n,continue:!e.abort})}}),rA=A("$ZodCheckNumberFormat",(n,e)=>{var o;Je.init(n,e),e.format=e.format||"float64";const t=(o=e.format)==null?void 0:o.includes("int"),r=t?"int":"number",[i,s]=h1[e.format];n._zod.onattach.push(a=>{const c=a._zod.bag;c.format=e.format,c.minimum=i,c.maximum=s,t&&(c.pattern=J1)}),n._zod.check=a=>{const c=a.value;if(t){if(!Number.isInteger(c)){a.issues.push({expected:r,format:e.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:!e.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:!e.abort});return}}c<i&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!e.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:n,continue:!e.abort})}}),iA=A("$ZodCheckMaxLength",(n,e)=>{var t;Je.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!hh(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),n._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const o=ph(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),sA=A("$ZodCheckMinLength",(n,e)=>{var t;Je.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!hh(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),n._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const o=ph(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),oA=A("$ZodCheckLengthEquals",(n,e)=>{var t;Je.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!hh(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),n._zod.check=r=>{const i=r.value,s=i.length;if(s===e.length)return;const o=ph(i),a=s>e.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!e.abort})}}),hl=A("$ZodCheckStringFormat",(n,e)=>{var t,r;Je.init(n,e),n._zod.onattach.push(i=>{const s=i._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(t=n._zod).check??(t.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:n,continue:!e.abort})}):(r=n._zod).check??(r.check=()=>{})}),aA=A("$ZodCheckRegex",(n,e)=>{hl.init(n,e),n._zod.check=t=>{e.pattern.lastIndex=0,!e.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:n,continue:!e.abort})}}),lA=A("$ZodCheckLowerCase",(n,e)=>{e.pattern??(e.pattern=eA),hl.init(n,e)}),cA=A("$ZodCheckUpperCase",(n,e)=>{e.pattern??(e.pattern=tA),hl.init(n,e)}),uA=A("$ZodCheckIncludes",(n,e)=>{Je.init(n,e);const t=Ei(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${t}`:t);e.pattern=r,n._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),n._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:n,continue:!e.abort})}}),hA=A("$ZodCheckStartsWith",(n,e)=>{Je.init(n,e);const t=new RegExp(`^${Ei(e.prefix)}.*`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:n,continue:!e.abort})}}),dA=A("$ZodCheckEndsWith",(n,e)=>{Je.init(n,e);const t=new RegExp(`.*${Ei(e.suffix)}$`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:n,continue:!e.abort})}}),pA=A("$ZodCheckOverwrite",(n,e)=>{Je.init(n,e),n._zod.check=t=>{t.value=e.tx(t.value)}});class fA{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
5
5
|
`).filter(o=>o),i=Math.min(...r.map(o=>o.length-o.trimStart().length)),s=r.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(const o of s)this.content.push(o)}compile(){const e=Function,t=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new e(...t,i.join(`
|
|
6
|
-
`))}}const
|
|
6
|
+
`))}}const gA={major:4,minor:3,patch:6},fe=A("$ZodType",(n,e)=>{var i;var t;n??(n={}),n._zod.def=e,n._zod.bag=n._zod.bag||{},n._zod.version=gA;const r=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&r.unshift(n);for(const s of r)for(const o of s._zod.onattach)o(n);if(r.length===0)(t=n._zod).deferred??(t.deferred=[]),(i=n._zod.deferred)==null||i.push(()=>{n._zod.run=n._zod.parse});else{const s=(a,c,u)=>{let h=Kr(a),p;for(const v of c){if(v._zod.def.when){if(!v._zod.def.when(a))continue}else if(h)continue;const m=a.issues.length,x=v._zod.check(a);if(x instanceof Promise&&(u==null?void 0:u.async)===!1)throw new ei;if(p||x instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await x,a.issues.length!==m&&(h||(h=Kr(a,m)))});else{if(a.issues.length===m)continue;h||(h=Kr(a,m))}}return p?p.then(()=>a):a},o=(a,c,u)=>{if(Kr(a))return a.aborted=!0,a;const h=s(c,r,u);if(h instanceof Promise){if(u.async===!1)throw new ei;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 ei;return u.then(h=>s(h,r,c))}return s(u,r,c)}}oe(n,"~standard",()=>({validate:s=>{var o;try{const a=S1(n,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return _1(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}))}),mh=A("$ZodString",(n,e)=>{var t;fe.init(n,e),n._zod.pattern=[...((t=n==null?void 0:n._zod.bag)==null?void 0:t.patterns)??[]].pop()??K1(n._zod.bag),n._zod.parse=(r,i)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:n}),r}}),de=A("$ZodStringFormat",(n,e)=>{hl.init(n,e),mh.init(n,e)}),mA=A("$ZodGUID",(n,e)=>{e.pattern??(e.pattern=N1),de.init(n,e)}),vA=A("$ZodUUID",(n,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Wp(r))}else e.pattern??(e.pattern=Wp());de.init(n,e)}),yA=A("$ZodEmail",(n,e)=>{e.pattern??(e.pattern=U1),de.init(n,e)}),bA=A("$ZodURL",(n,e)=>{de.init(n,e),n._zod.check=t=>{try{const r=t.value.trim(),i=new URL(r);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:t.value,inst:n,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:t.value,inst:n,continue:!e.abort})),e.normalize?t.value=i.href:t.value=r;return}catch{t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:n,continue:!e.abort})}}}),wA=A("$ZodEmoji",(n,e)=>{e.pattern??(e.pattern=Z1()),de.init(n,e)}),SA=A("$ZodNanoID",(n,e)=>{e.pattern??(e.pattern=O1),de.init(n,e)}),_A=A("$ZodCUID",(n,e)=>{e.pattern??(e.pattern=P1),de.init(n,e)}),kA=A("$ZodCUID2",(n,e)=>{e.pattern??(e.pattern=R1),de.init(n,e)}),EA=A("$ZodULID",(n,e)=>{e.pattern??(e.pattern=D1),de.init(n,e)}),xA=A("$ZodXID",(n,e)=>{e.pattern??(e.pattern=L1),de.init(n,e)}),AA=A("$ZodKSUID",(n,e)=>{e.pattern??(e.pattern=z1),de.init(n,e)}),$A=A("$ZodISODateTime",(n,e)=>{e.pattern??(e.pattern=X1(e)),de.init(n,e)}),IA=A("$ZodISODate",(n,e)=>{e.pattern??(e.pattern=q1),de.init(n,e)}),TA=A("$ZodISOTime",(n,e)=>{e.pattern??(e.pattern=Y1(e)),de.init(n,e)}),CA=A("$ZodISODuration",(n,e)=>{e.pattern??(e.pattern=M1),de.init(n,e)}),PA=A("$ZodIPv4",(n,e)=>{e.pattern??(e.pattern=W1),de.init(n,e),n._zod.bag.format="ipv4"}),RA=A("$ZodIPv6",(n,e)=>{e.pattern??(e.pattern=H1),de.init(n,e),n._zod.bag.format="ipv6",n._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:n,continue:!e.abort})}}}),DA=A("$ZodCIDRv4",(n,e)=>{e.pattern??(e.pattern=V1),de.init(n,e)}),LA=A("$ZodCIDRv6",(n,e)=>{e.pattern??(e.pattern=B1),de.init(n,e),n._zod.check=t=>{const r=t.value.split("/");try{if(r.length!==2)throw new Error;const[i,s]=r;if(!s)throw new Error;const o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${i}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:n,continue:!e.abort})}}});function Fm(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const zA=A("$ZodBase64",(n,e)=>{e.pattern??(e.pattern=G1),de.init(n,e),n._zod.bag.contentEncoding="base64",n._zod.check=t=>{Fm(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:n,continue:!e.abort})}});function OA(n){if(!Dm.test(n))return!1;const e=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return Fm(t)}const MA=A("$ZodBase64URL",(n,e)=>{e.pattern??(e.pattern=Dm),de.init(n,e),n._zod.bag.contentEncoding="base64url",n._zod.check=t=>{OA(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:n,continue:!e.abort})}}),NA=A("$ZodE164",(n,e)=>{e.pattern??(e.pattern=j1),de.init(n,e)});function UA(n,e=null){try{const t=n.split(".");if(t.length!==3)return!1;const[r]=t;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const FA=A("$ZodJWT",(n,e)=>{de.init(n,e),n._zod.check=t=>{UA(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:n,continue:!e.abort})}}),Zm=A("$ZodNumber",(n,e)=>{fe.init(n,e),n._zod.pattern=n._zod.bag.pattern??Om,n._zod.parse=(t,r)=>{if(e.coerce)try{t.value=Number(t.value)}catch{}const i=t.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return t;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:i,inst:n,...s?{received:s}:{}}),t}}),ZA=A("$ZodNumberFormat",(n,e)=>{rA.init(n,e),Zm.init(n,e)}),WA=A("$ZodBoolean",(n,e)=>{fe.init(n,e),n._zod.pattern=Q1,n._zod.parse=(t,r)=>{if(e.coerce)try{t.value=!!t.value}catch{}const i=t.value;return typeof i=="boolean"||t.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:n}),t}}),HA=A("$ZodUnknown",(n,e)=>{fe.init(n,e),n._zod.parse=t=>t}),VA=A("$ZodNever",(n,e)=>{fe.init(n,e),n._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:n}),t)});function Hp(n,e,t){n.issues.length&&e.issues.push(...Jr(t,n.issues)),e.value[t]=n.value}const BA=A("$ZodArray",(n,e)=>{fe.init(n,e),n._zod.parse=(t,r)=>{const i=t.value;if(!Array.isArray(i))return t.issues.push({expected:"array",code:"invalid_type",input:i,inst:n}),t;t.value=Array(i.length);const s=[];for(let o=0;o<i.length;o++){const a=i[o],c=e.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Hp(u,t,o))):Hp(c,t,o)}return s.length?Promise.all(s).then(()=>t):t}});function _a(n,e,t,r,i){if(n.issues.length){if(i&&!(t in r))return;e.issues.push(...Jr(t,n.issues))}n.value===void 0?t in r&&(e.value[t]=void 0):e.value[t]=n.value}function Wm(n){var r,i,s,o;const e=Object.keys(n.shape);for(const a of e)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 t=u1(n.shape);return{...n,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}function Hm(n,e,t,r,i,s){const o=[],a=i.keySet,c=i.catchall._zod,u=c.def.type,h=c.optout==="optional";for(const p in e){if(a.has(p))continue;if(u==="never"){o.push(p);continue}const v=c.run({value:e[p],issues:[]},r);v instanceof Promise?n.push(v.then(m=>_a(m,t,p,e,h))):_a(v,t,p,e,h)}return o.length&&t.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:s}),n.length?Promise.all(n).then(()=>t):t}const GA=A("$ZodObject",(n,e)=>{fe.init(n,e);const t=Object.getOwnPropertyDescriptor(e,"shape");if(!(t!=null&&t.get)){const a=e.shape;Object.defineProperty(e,"shape",{get:()=>{const c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}const r=uh(()=>Wm(e));oe(n._zod,"propValues",()=>{const a=e.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=Sa,s=e.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 m=p[v],x=m._zod.optout==="optional",E=m._zod.run({value:u[v],issues:[]},c);E instanceof Promise?h.push(E.then(T=>_a(T,a,v,u,x))):_a(E,a,v,u,x)}return s?Hm(h,u,a,c,r.value,n):h.length?Promise.all(h).then(()=>a):a}}),jA=A("$ZodObjectJIT",(n,e)=>{GA.init(n,e);const t=n._zod.parse,r=uh(()=>Wm(e)),i=v=>{var V;const m=new fA(["shape","payload","ctx"]),x=r.value,E=F=>{const B=Zp(F);return`shape[${B}]._zod.run({ value: input[${B}], issues: [] }, ctx)`};m.write("const input = payload.value;");const T=Object.create(null);let O=0;for(const F of x.keys)T[F]=`key_${O++}`;m.write("const newResult = {};");for(const F of x.keys){const B=T[F],U=Zp(F),Q=v[F],j=((V=Q==null?void 0:Q._zod)==null?void 0:V.optout)==="optional";m.write(`const ${B} = ${E(F)};`),j?m.write(`
|
|
7
7
|
if (${B}.issues.length) {
|
|
8
8
|
if (${U} in input) {
|
|
9
9
|
payload.issues = payload.issues.concat(${B}.issues.map(iss => ({
|
|
@@ -37,91 +37,91 @@ var Fb=Object.defineProperty;var cd=n=>{throw TypeError(n)};var Zb=(n,e,t)=>e in
|
|
|
37
37
|
newResult[${U}] = ${B}.value;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
`)}m.write("payload.value = newResult;"),m.write("return payload;");const P=m.compile();return(F,B)=>P(v,F,B)};let s;const o=wa,a=!xm.jitless,u=a&&a1.value,h=e.catchall;let p;n._zod.parse=(v,m)=>{p??(p=r.value);const E=v.value;return o(E)?a&&u&&(m==null?void 0:m.async)===!1&&m.jitless!==!0?(s||(s=i(e.shape)),v=s(v,m),h?Wm([],E,v,m,p,n):v):t(v,m):(v.issues.push({expected:"object",code:"invalid_type",input:E,inst:n}),v)}});function Hp(n,e,t,r){for(const s of n)if(s.issues.length===0)return e.value=s.value,e;const i=n.filter(s=>!Kr(s));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:n.map(s=>s.issues.map(o=>In(o,r,$n())))}),e)}const jA=A("$ZodUnion",(n,e)=>{fe.init(n,e),oe(n._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),oe(n._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),oe(n._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),oe(n._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){const i=e.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>hh(s.source)).join("|")})$`)}});const t=e.options.length===1,r=e.options[0]._zod.run;n._zod.parse=(i,s)=>{if(t)return r(i,s);let o=!1;const a=[];for(const c of e.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=>Hp(c,i,n,s)):Hp(a,i,n,s)}}),qA=A("$ZodIntersection",(n,e)=>{fe.init(n,e),n._zod.parse=(t,r)=>{const i=t.value,s=e.left._zod.run({value:i,issues:[]},r),o=e.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([c,u])=>Vp(t,c,u)):Vp(t,s,o)}});function Vc(n,e){if(n===e)return{valid:!0,data:n};if(n instanceof Date&&e instanceof Date&&+n==+e)return{valid:!0,data:n};if(_i(n)&&_i(e)){const t=Object.keys(e),r=Object.keys(n).filter(s=>t.indexOf(s)!==-1),i={...n,...e};for(const s of r){const o=Vc(n[s],e[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let r=0;r<n.length;r++){const i=n[r],s=e[r],o=Vc(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};t.push(o.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Vp(n,e,t){const r=new Map;let i;for(const a of e.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 t.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}),Kr(n))return n;const o=Vc(e.value,t.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return n.value=o.data,n}const YA=A("$ZodRecord",(n,e)=>{fe.init(n,e),n._zod.parse=(t,r)=>{const i=t.value;if(!_i(i))return t.issues.push({expected:"record",code:"invalid_type",input:i,inst:n}),t;const s=[],o=e.keyType._zod.values;if(o){t.value={};const 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=e.valueType._zod.run({value:i[u],issues:[]},r);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&t.issues.push(...Jr(u,p.issues)),t.value[u]=p.value})):(h.issues.length&&t.issues.push(...Jr(u,h.issues)),t.value[u]=h.value)}let c;for(const u in i)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&t.issues.push({code:"unrecognized_keys",input:i,inst:n,keys:c})}else{t.value={};for(const a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let c=e.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"&&zm.test(a)&&c.issues.length){const p=e.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){e.mode==="loose"?t.value[a]=i[a]:t.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>In(p,r,$n())),input:a,path:[a],inst:n});continue}const h=e.valueType._zod.run({value:i[a],issues:[]},r);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&t.issues.push(...Jr(a,p.issues)),t.value[c.value]=p.value})):(h.issues.length&&t.issues.push(...Jr(a,h.issues)),t.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>t):t}}),XA=A("$ZodEnum",(n,e)=>{fe.init(n,e);const t=Am(e.entries),r=new Set(t);n._zod.values=r,n._zod.pattern=new RegExp(`^(${t.filter(i=>l1.has(typeof i)).map(i=>typeof i=="string"?ki(i):i.toString()).join("|")})$`),n._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:t,input:o,inst:n}),i}}),KA=A("$ZodLiteral",(n,e)=>{if(fe.init(n,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const t=new Set(e.values);n._zod.values=t,n._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?ki(r):r?ki(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,i)=>{const s=r.value;return t.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:n}),r}}),JA=A("$ZodTransform",(n,e)=>{fe.init(n,e),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new Em(n.constructor.name);const i=e.transform(t.value,t);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(t.value=o,t));if(i instanceof Promise)throw new ei;return t.value=i,t}});function Bp(n,e){return n.issues.length&&e===void 0?{issues:[],value:void 0}:n}const Hm=A("$ZodOptional",(n,e)=>{fe.init(n,e),n._zod.optin="optional",n._zod.optout="optional",oe(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),oe(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${hh(t.source)})?$`):void 0}),n._zod.parse=(t,r)=>{if(e.innerType._zod.optin==="optional"){const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>Bp(s,t.value)):Bp(i,t.value)}return t.value===void 0?t:e.innerType._zod.run(t,r)}}),QA=A("$ZodExactOptional",(n,e)=>{Hm.init(n,e),oe(n._zod,"values",()=>e.innerType._zod.values),oe(n._zod,"pattern",()=>e.innerType._zod.pattern),n._zod.parse=(t,r)=>e.innerType._zod.run(t,r)}),e$=A("$ZodNullable",(n,e)=>{fe.init(n,e),oe(n._zod,"optin",()=>e.innerType._zod.optin),oe(n._zod,"optout",()=>e.innerType._zod.optout),oe(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${hh(t.source)}|null)$`):void 0}),oe(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),n._zod.parse=(t,r)=>t.value===null?t:e.innerType._zod.run(t,r)}),t$=A("$ZodDefault",(n,e)=>{fe.init(n,e),n._zod.optin="optional",oe(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);if(t.value===void 0)return t.value=e.defaultValue,t;const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>Gp(s,e)):Gp(i,e)}});function Gp(n,e){return n.value===void 0&&(n.value=e.defaultValue),n}const n$=A("$ZodPrefault",(n,e)=>{fe.init(n,e),n._zod.optin="optional",oe(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>(r.direction==="backward"||t.value===void 0&&(t.value=e.defaultValue),e.innerType._zod.run(t,r))}),r$=A("$ZodNonOptional",(n,e)=>{fe.init(n,e),oe(n._zod,"values",()=>{const t=e.innerType._zod.values;return t?new Set([...t].filter(r=>r!==void 0)):void 0}),n._zod.parse=(t,r)=>{const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>jp(s,n)):jp(i,n)}});function jp(n,e){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:e}),n}const i$=A("$ZodCatch",(n,e)=>{fe.init(n,e),oe(n._zod,"optin",()=>e.innerType._zod.optin),oe(n._zod,"optout",()=>e.innerType._zod.optout),oe(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>(t.value=s.value,s.issues.length&&(t.value=e.catchValue({...t,error:{issues:s.issues.map(o=>In(o,r,$n()))},input:t.value}),t.issues=[]),t)):(t.value=i.value,i.issues.length&&(t.value=e.catchValue({...t,error:{issues:i.issues.map(s=>In(s,r,$n()))},input:t.value}),t.issues=[]),t)}}),s$=A("$ZodPipe",(n,e)=>{fe.init(n,e),oe(n._zod,"values",()=>e.in._zod.values),oe(n._zod,"optin",()=>e.in._zod.optin),oe(n._zod,"optout",()=>e.out._zod.optout),oe(n._zod,"propValues",()=>e.in._zod.propValues),n._zod.parse=(t,r)=>{if(r.direction==="backward"){const s=e.out._zod.run(t,r);return s instanceof Promise?s.then(o=>Mo(o,e.in,r)):Mo(s,e.in,r)}const i=e.in._zod.run(t,r);return i instanceof Promise?i.then(s=>Mo(s,e.out,r)):Mo(i,e.out,r)}});function Mo(n,e,t){return n.issues.length?(n.aborted=!0,n):e._zod.run({value:n.value,issues:n.issues},t)}const o$=A("$ZodReadonly",(n,e)=>{fe.init(n,e),oe(n._zod,"propValues",()=>e.innerType._zod.propValues),oe(n._zod,"values",()=>e.innerType._zod.values),oe(n._zod,"optin",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optin}),oe(n._zod,"optout",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optout}),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(qp):qp(i)}});function qp(n){return n.value=Object.freeze(n.value),n}const a$=A("$ZodCustom",(n,e)=>{Ke.init(n,e),fe.init(n,e),n._zod.parse=(t,r)=>t,n._zod.check=t=>{const r=t.value,i=e.fn(r);if(i instanceof Promise)return i.then(s=>Yp(s,t,r,n));Yp(i,t,r,n)}});function Yp(n,e,t,r){if(!n){const i={code:"custom",input:t,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(ps(i))}}var Xp;class l${constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function c$(){return new l$}(Xp=globalThis).__zod_globalRegistry??(Xp.__zod_globalRegistry=c$());const Qi=globalThis.__zod_globalRegistry;function u$(n,e){return new n({type:"string",...z(e)})}function h$(n,e){return new n({type:"string",format:"email",check:"string_format",abort:!1,...z(e)})}function Kp(n,e){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...z(e)})}function d$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...z(e)})}function p$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(e)})}function f$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(e)})}function g$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(e)})}function m$(n,e){return new n({type:"string",format:"url",check:"string_format",abort:!1,...z(e)})}function v$(n,e){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...z(e)})}function y$(n,e){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(e)})}function b$(n,e){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...z(e)})}function w$(n,e){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(e)})}function S$(n,e){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...z(e)})}function _$(n,e){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...z(e)})}function k$(n,e){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(e)})}function E$(n,e){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(e)})}function x$(n,e){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(e)})}function A$(n,e){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(e)})}function $$(n,e){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(e)})}function I$(n,e){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...z(e)})}function T$(n,e){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...z(e)})}function C$(n,e){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...z(e)})}function P$(n,e){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...z(e)})}function R$(n,e){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(e)})}function D$(n,e){return new n({type:"string",format:"date",check:"string_format",...z(e)})}function L$(n,e){return new n({type:"string",format:"time",check:"string_format",precision:null,...z(e)})}function z$(n,e){return new n({type:"string",format:"duration",check:"string_format",...z(e)})}function O$(n,e){return new n({type:"number",checks:[],...z(e)})}function M$(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...z(e)})}function N$(n,e){return new n({type:"boolean",...z(e)})}function U$(n){return new n({type:"unknown"})}function F$(n,e){return new n({type:"never",...z(e)})}function Jp(n,e){return new Mm({check:"less_than",...z(e),value:n,inclusive:!1})}function lc(n,e){return new Mm({check:"less_than",...z(e),value:n,inclusive:!0})}function Qp(n,e){return new Nm({check:"greater_than",...z(e),value:n,inclusive:!1})}function cc(n,e){return new Nm({check:"greater_than",...z(e),value:n,inclusive:!0})}function ef(n,e){return new tA({check:"multiple_of",...z(e),value:n})}function Vm(n,e){return new rA({check:"max_length",...z(e),maximum:n})}function _a(n,e){return new iA({check:"min_length",...z(e),minimum:n})}function Bm(n,e){return new sA({check:"length_equals",...z(e),length:n})}function Z$(n,e){return new oA({check:"string_format",format:"regex",...z(e),pattern:n})}function W$(n){return new aA({check:"string_format",format:"lowercase",...z(n)})}function H$(n){return new lA({check:"string_format",format:"uppercase",...z(n)})}function V$(n,e){return new cA({check:"string_format",format:"includes",...z(e),includes:n})}function B$(n,e){return new uA({check:"string_format",format:"starts_with",...z(e),prefix:n})}function G$(n,e){return new hA({check:"string_format",format:"ends_with",...z(e),suffix:n})}function Li(n){return new dA({check:"overwrite",tx:n})}function j$(n){return Li(e=>e.normalize(n))}function q$(){return Li(n=>n.trim())}function Y$(){return Li(n=>n.toLowerCase())}function X$(){return Li(n=>n.toUpperCase())}function K$(){return Li(n=>o1(n))}function J$(n,e,t){return new n({type:"array",element:e,...z(t)})}function Q$(n,e,t){return new n({type:"custom",check:"custom",fn:e,...z(t)})}function eI(n){const e=tI(t=>(t.addIssue=r=>{if(typeof r=="string")t.issues.push(ps(r,t.value,e._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=t.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),t.issues.push(ps(i))}},n(t.value,t)));return e}function tI(n,e){const t=new Ke({check:"custom",...z(e)});return t._zod.check=n,t}function Gm(n){let e=(n==null?void 0:n.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:n.processors??{},metadataRegistry:(n==null?void 0:n.metadata)??Qi,target:e,unrepresentable:(n==null?void 0:n.unrepresentable)??"throw",override:(n==null?void 0:n.override)??(()=>{}),io:(n==null?void 0:n.io)??"output",counter:0,seen:new Map,cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0}}function _e(n,e,t={path:[],schemaPath:[]}){var h,p;var r;const i=n._zod.def,s=e.seen.get(n);if(s)return s.count++,t.schemaPath.includes(n)&&(s.cycle=t.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:t.path};e.seen.set(n,o);const a=(p=(h=n._zod).toJSONSchema)==null?void 0:p.call(h);if(a)o.schema=a;else{const v={...t,schemaPath:[...t.schemaPath,n],path:t.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(e,o.schema,v);else{const E=o.schema,k=e.processors[i.type];if(!k)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);k(n,e,E,v)}const m=n._zod.parent;m&&(o.ref||(o.ref=m),_e(m,e,v),e.seen.get(m).isParent=!0)}const c=e.metadataRegistry.get(n);return c&&Object.assign(o.schema,c),e.io==="input"&&Me(n)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(n).schema}function jm(n,e){var o,a,c,u;const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const 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,O=n.external.uri??(V=>V);if(T)return{ref:O(T)};const P=h[1].defId??h[1].schema.id??`schema${n.counter++}`;return h[1].defId=P,{defId:P,ref:`${O("__shared")}#/${p}/${P}`}}if(h[1]===t)return{ref:"#"};const m=`#/${p}/`,E=h[1].schema.id??`__schema${n.counter++}`;return{defId:E,ref:m+E}},s=h=>{if(h[1].schema.$ref)return;const p=h[1],{ref:v,defId:m}=i(h);p.def={...p.schema},m&&(p.defId=m);const E=p.schema;for(const k in E)delete E[k];E.$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
|
+
`)}m.write("payload.value = newResult;"),m.write("return payload;");const P=m.compile();return(F,B)=>P(v,F,B)};let s;const o=Sa,a=!Am.jitless,u=a&&l1.value,h=e.catchall;let p;n._zod.parse=(v,m)=>{p??(p=r.value);const x=v.value;return o(x)?a&&u&&(m==null?void 0:m.async)===!1&&m.jitless!==!0?(s||(s=i(e.shape)),v=s(v,m),h?Hm([],x,v,m,p,n):v):t(v,m):(v.issues.push({expected:"object",code:"invalid_type",input:x,inst:n}),v)}});function Vp(n,e,t,r){for(const s of n)if(s.issues.length===0)return e.value=s.value,e;const i=n.filter(s=>!Kr(s));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:n.map(s=>s.issues.map(o=>In(o,r,$n())))}),e)}const qA=A("$ZodUnion",(n,e)=>{fe.init(n,e),oe(n._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),oe(n._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),oe(n._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),oe(n._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){const i=e.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>dh(s.source)).join("|")})$`)}});const t=e.options.length===1,r=e.options[0]._zod.run;n._zod.parse=(i,s)=>{if(t)return r(i,s);let o=!1;const a=[];for(const c of e.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=>Vp(c,i,n,s)):Vp(a,i,n,s)}}),YA=A("$ZodIntersection",(n,e)=>{fe.init(n,e),n._zod.parse=(t,r)=>{const i=t.value,s=e.left._zod.run({value:i,issues:[]},r),o=e.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([c,u])=>Bp(t,c,u)):Bp(t,s,o)}});function Bc(n,e){if(n===e)return{valid:!0,data:n};if(n instanceof Date&&e instanceof Date&&+n==+e)return{valid:!0,data:n};if(ki(n)&&ki(e)){const t=Object.keys(e),r=Object.keys(n).filter(s=>t.indexOf(s)!==-1),i={...n,...e};for(const s of r){const o=Bc(n[s],e[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let r=0;r<n.length;r++){const i=n[r],s=e[r],o=Bc(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};t.push(o.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Bp(n,e,t){const r=new Map;let i;for(const a of e.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 t.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}),Kr(n))return n;const o=Bc(e.value,t.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return n.value=o.data,n}const XA=A("$ZodRecord",(n,e)=>{fe.init(n,e),n._zod.parse=(t,r)=>{const i=t.value;if(!ki(i))return t.issues.push({expected:"record",code:"invalid_type",input:i,inst:n}),t;const s=[],o=e.keyType._zod.values;if(o){t.value={};const 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=e.valueType._zod.run({value:i[u],issues:[]},r);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&t.issues.push(...Jr(u,p.issues)),t.value[u]=p.value})):(h.issues.length&&t.issues.push(...Jr(u,h.issues)),t.value[u]=h.value)}let c;for(const u in i)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&t.issues.push({code:"unrecognized_keys",input:i,inst:n,keys:c})}else{t.value={};for(const a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let c=e.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"&&Om.test(a)&&c.issues.length){const p=e.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){e.mode==="loose"?t.value[a]=i[a]:t.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>In(p,r,$n())),input:a,path:[a],inst:n});continue}const h=e.valueType._zod.run({value:i[a],issues:[]},r);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&t.issues.push(...Jr(a,p.issues)),t.value[c.value]=p.value})):(h.issues.length&&t.issues.push(...Jr(a,h.issues)),t.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>t):t}}),KA=A("$ZodEnum",(n,e)=>{fe.init(n,e);const t=$m(e.entries),r=new Set(t);n._zod.values=r,n._zod.pattern=new RegExp(`^(${t.filter(i=>c1.has(typeof i)).map(i=>typeof i=="string"?Ei(i):i.toString()).join("|")})$`),n._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:t,input:o,inst:n}),i}}),JA=A("$ZodLiteral",(n,e)=>{if(fe.init(n,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const t=new Set(e.values);n._zod.values=t,n._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Ei(r):r?Ei(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,i)=>{const s=r.value;return t.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:n}),r}}),QA=A("$ZodTransform",(n,e)=>{fe.init(n,e),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new xm(n.constructor.name);const i=e.transform(t.value,t);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(t.value=o,t));if(i instanceof Promise)throw new ei;return t.value=i,t}});function Gp(n,e){return n.issues.length&&e===void 0?{issues:[],value:void 0}:n}const Vm=A("$ZodOptional",(n,e)=>{fe.init(n,e),n._zod.optin="optional",n._zod.optout="optional",oe(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),oe(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${dh(t.source)})?$`):void 0}),n._zod.parse=(t,r)=>{if(e.innerType._zod.optin==="optional"){const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>Gp(s,t.value)):Gp(i,t.value)}return t.value===void 0?t:e.innerType._zod.run(t,r)}}),e$=A("$ZodExactOptional",(n,e)=>{Vm.init(n,e),oe(n._zod,"values",()=>e.innerType._zod.values),oe(n._zod,"pattern",()=>e.innerType._zod.pattern),n._zod.parse=(t,r)=>e.innerType._zod.run(t,r)}),t$=A("$ZodNullable",(n,e)=>{fe.init(n,e),oe(n._zod,"optin",()=>e.innerType._zod.optin),oe(n._zod,"optout",()=>e.innerType._zod.optout),oe(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${dh(t.source)}|null)$`):void 0}),oe(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),n._zod.parse=(t,r)=>t.value===null?t:e.innerType._zod.run(t,r)}),n$=A("$ZodDefault",(n,e)=>{fe.init(n,e),n._zod.optin="optional",oe(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);if(t.value===void 0)return t.value=e.defaultValue,t;const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>jp(s,e)):jp(i,e)}});function jp(n,e){return n.value===void 0&&(n.value=e.defaultValue),n}const r$=A("$ZodPrefault",(n,e)=>{fe.init(n,e),n._zod.optin="optional",oe(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>(r.direction==="backward"||t.value===void 0&&(t.value=e.defaultValue),e.innerType._zod.run(t,r))}),i$=A("$ZodNonOptional",(n,e)=>{fe.init(n,e),oe(n._zod,"values",()=>{const t=e.innerType._zod.values;return t?new Set([...t].filter(r=>r!==void 0)):void 0}),n._zod.parse=(t,r)=>{const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>qp(s,n)):qp(i,n)}});function qp(n,e){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:e}),n}const s$=A("$ZodCatch",(n,e)=>{fe.init(n,e),oe(n._zod,"optin",()=>e.innerType._zod.optin),oe(n._zod,"optout",()=>e.innerType._zod.optout),oe(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>(t.value=s.value,s.issues.length&&(t.value=e.catchValue({...t,error:{issues:s.issues.map(o=>In(o,r,$n()))},input:t.value}),t.issues=[]),t)):(t.value=i.value,i.issues.length&&(t.value=e.catchValue({...t,error:{issues:i.issues.map(s=>In(s,r,$n()))},input:t.value}),t.issues=[]),t)}}),o$=A("$ZodPipe",(n,e)=>{fe.init(n,e),oe(n._zod,"values",()=>e.in._zod.values),oe(n._zod,"optin",()=>e.in._zod.optin),oe(n._zod,"optout",()=>e.out._zod.optout),oe(n._zod,"propValues",()=>e.in._zod.propValues),n._zod.parse=(t,r)=>{if(r.direction==="backward"){const s=e.out._zod.run(t,r);return s instanceof Promise?s.then(o=>No(o,e.in,r)):No(s,e.in,r)}const i=e.in._zod.run(t,r);return i instanceof Promise?i.then(s=>No(s,e.out,r)):No(i,e.out,r)}});function No(n,e,t){return n.issues.length?(n.aborted=!0,n):e._zod.run({value:n.value,issues:n.issues},t)}const a$=A("$ZodReadonly",(n,e)=>{fe.init(n,e),oe(n._zod,"propValues",()=>e.innerType._zod.propValues),oe(n._zod,"values",()=>e.innerType._zod.values),oe(n._zod,"optin",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optin}),oe(n._zod,"optout",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optout}),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(Yp):Yp(i)}});function Yp(n){return n.value=Object.freeze(n.value),n}const l$=A("$ZodCustom",(n,e)=>{Je.init(n,e),fe.init(n,e),n._zod.parse=(t,r)=>t,n._zod.check=t=>{const r=t.value,i=e.fn(r);if(i instanceof Promise)return i.then(s=>Xp(s,t,r,n));Xp(i,t,r,n)}});function Xp(n,e,t,r){if(!n){const i={code:"custom",input:t,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(fs(i))}}var Kp;class c${constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function u$(){return new c$}(Kp=globalThis).__zod_globalRegistry??(Kp.__zod_globalRegistry=u$());const es=globalThis.__zod_globalRegistry;function h$(n,e){return new n({type:"string",...z(e)})}function d$(n,e){return new n({type:"string",format:"email",check:"string_format",abort:!1,...z(e)})}function Jp(n,e){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...z(e)})}function p$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...z(e)})}function f$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(e)})}function g$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(e)})}function m$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(e)})}function v$(n,e){return new n({type:"string",format:"url",check:"string_format",abort:!1,...z(e)})}function y$(n,e){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...z(e)})}function b$(n,e){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(e)})}function w$(n,e){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...z(e)})}function S$(n,e){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(e)})}function _$(n,e){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...z(e)})}function k$(n,e){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...z(e)})}function E$(n,e){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(e)})}function x$(n,e){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(e)})}function A$(n,e){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(e)})}function $$(n,e){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(e)})}function I$(n,e){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(e)})}function T$(n,e){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...z(e)})}function C$(n,e){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...z(e)})}function P$(n,e){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...z(e)})}function R$(n,e){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...z(e)})}function D$(n,e){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(e)})}function L$(n,e){return new n({type:"string",format:"date",check:"string_format",...z(e)})}function z$(n,e){return new n({type:"string",format:"time",check:"string_format",precision:null,...z(e)})}function O$(n,e){return new n({type:"string",format:"duration",check:"string_format",...z(e)})}function M$(n,e){return new n({type:"number",checks:[],...z(e)})}function N$(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...z(e)})}function U$(n,e){return new n({type:"boolean",...z(e)})}function F$(n){return new n({type:"unknown"})}function Z$(n,e){return new n({type:"never",...z(e)})}function Qp(n,e){return new Nm({check:"less_than",...z(e),value:n,inclusive:!1})}function cc(n,e){return new Nm({check:"less_than",...z(e),value:n,inclusive:!0})}function ef(n,e){return new Um({check:"greater_than",...z(e),value:n,inclusive:!1})}function uc(n,e){return new Um({check:"greater_than",...z(e),value:n,inclusive:!0})}function tf(n,e){return new nA({check:"multiple_of",...z(e),value:n})}function Bm(n,e){return new iA({check:"max_length",...z(e),maximum:n})}function ka(n,e){return new sA({check:"min_length",...z(e),minimum:n})}function Gm(n,e){return new oA({check:"length_equals",...z(e),length:n})}function W$(n,e){return new aA({check:"string_format",format:"regex",...z(e),pattern:n})}function H$(n){return new lA({check:"string_format",format:"lowercase",...z(n)})}function V$(n){return new cA({check:"string_format",format:"uppercase",...z(n)})}function B$(n,e){return new uA({check:"string_format",format:"includes",...z(e),includes:n})}function G$(n,e){return new hA({check:"string_format",format:"starts_with",...z(e),prefix:n})}function j$(n,e){return new dA({check:"string_format",format:"ends_with",...z(e),suffix:n})}function zi(n){return new pA({check:"overwrite",tx:n})}function q$(n){return zi(e=>e.normalize(n))}function Y$(){return zi(n=>n.trim())}function X$(){return zi(n=>n.toLowerCase())}function K$(){return zi(n=>n.toUpperCase())}function J$(){return zi(n=>a1(n))}function Q$(n,e,t){return new n({type:"array",element:e,...z(t)})}function eI(n,e,t){return new n({type:"custom",check:"custom",fn:e,...z(t)})}function tI(n){const e=nI(t=>(t.addIssue=r=>{if(typeof r=="string")t.issues.push(fs(r,t.value,e._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=t.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),t.issues.push(fs(i))}},n(t.value,t)));return e}function nI(n,e){const t=new Je({check:"custom",...z(e)});return t._zod.check=n,t}function jm(n){let e=(n==null?void 0:n.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:n.processors??{},metadataRegistry:(n==null?void 0:n.metadata)??es,target:e,unrepresentable:(n==null?void 0:n.unrepresentable)??"throw",override:(n==null?void 0:n.override)??(()=>{}),io:(n==null?void 0:n.io)??"output",counter:0,seen:new Map,cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0}}function _e(n,e,t={path:[],schemaPath:[]}){var h,p;var r;const i=n._zod.def,s=e.seen.get(n);if(s)return s.count++,t.schemaPath.includes(n)&&(s.cycle=t.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:t.path};e.seen.set(n,o);const a=(p=(h=n._zod).toJSONSchema)==null?void 0:p.call(h);if(a)o.schema=a;else{const v={...t,schemaPath:[...t.schemaPath,n],path:t.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(e,o.schema,v);else{const x=o.schema,E=e.processors[i.type];if(!E)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);E(n,e,x,v)}const m=n._zod.parent;m&&(o.ref||(o.ref=m),_e(m,e,v),e.seen.get(m).isParent=!0)}const c=e.metadataRegistry.get(n);return c&&Object.assign(o.schema,c),e.io==="input"&&Me(n)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(n).schema}function qm(n,e){var o,a,c,u;const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const 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 E;const p=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const T=(E=n.external.registry.get(h[0]))==null?void 0:E.id,O=n.external.uri??(V=>V);if(T)return{ref:O(T)};const P=h[1].defId??h[1].schema.id??`schema${n.counter++}`;return h[1].defId=P,{defId:P,ref:`${O("__shared")}#/${p}/${P}`}}if(h[1]===t)return{ref:"#"};const m=`#/${p}/`,x=h[1].schema.id??`__schema${n.counter++}`;return{defId:x,ref:m+x}},s=h=>{if(h[1].schema.$ref)return;const p=h[1],{ref:v,defId:m}=i(h);p.def={...p.schema},m&&(p.defId=m);const x=p.schema;for(const E in x)delete x[E];x.$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(e===h[0]){s(h);continue}if(n.external){const m=(c=n.external.registry.get(h[0]))==null?void 0:c.id;if(e!==h[0]&&m){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 qm(n,e){var o,a,c;const t=n.seen.get(e);if(!t)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},m=h.ref;if(h.ref=null,m){r(m);const k=n.seen.get(m),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===m)for(const P in p)P==="$ref"||P==="allOf"||P in v||delete p[P];if(T.$ref&&k.def)for(const P in p)P==="$ref"||P==="allOf"||P in k.def&&JSON.stringify(p[P])===JSON.stringify(k.def[P])&&delete p[P]}const E=u._zod.parent;if(E&&E!==m){r(E);const k=n.seen.get(E);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(e))==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,t.def??t.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:{...e["~standard"],jsonSchema:{input:ka(e,"input",n.processors),output:ka(e,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Me(n,e){const t=e??{seen:new Set};if(t.seen.has(n))return!1;t.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Me(r.element,t);if(r.type==="set")return Me(r.valueType,t);if(r.type==="lazy")return Me(r.getter(),t);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Me(r.innerType,t);if(r.type==="intersection")return Me(r.left,t)||Me(r.right,t);if(r.type==="record"||r.type==="map")return Me(r.keyType,t)||Me(r.valueType,t);if(r.type==="pipe")return Me(r.in,t)||Me(r.out,t);if(r.type==="object"){for(const i in r.shape)if(Me(r.shape[i],t))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Me(i,t))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Me(i,t))return!0;return!!(r.rest&&Me(r.rest,t))}return!1}const nI=(n,e={})=>t=>{const r=Gm({...t,processors:e});return _e(n,r),jm(r,n),qm(r,n)},ka=(n,e,t={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=Gm({...i??{},target:s,io:e,processors:t});return _e(n,o),jm(o,n),qm(o,n)},rI={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},iI=(n,e,t,r)=>{const i=t;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=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},sI=(n,e,t,r)=>{const i=t,{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"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h),typeof s=="number"&&(i.minimum=s,typeof h=="number"&&e.target!=="draft-04"&&(h>=s?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof o=="number"&&(i.maximum=o,typeof u=="number"&&e.target!=="draft-04"&&(u<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},oI=(n,e,t,r)=>{t.type="boolean"},aI=(n,e,t,r)=>{t.not={}},lI=(n,e,t,r)=>{},cI=(n,e,t,r)=>{const i=n._zod.def,s=Am(i.entries);s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),t.enum=s},uI=(n,e,t,r)=>{const i=n._zod.def,s=[];for(const o of i.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){const o=s[0];t.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[o]:t.const=o}else s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),s.every(o=>typeof o=="boolean")&&(t.type="boolean"),s.every(o=>o===null)&&(t.type="null"),t.enum=s},hI=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},dI=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},pI=(n,e,t,r)=>{const i=t,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=_e(s.element,e,{...r,path:[...r.path,"items"]})},fI=(n,e,t,r)=>{var u;const i=t,s=n._zod.def;i.type="object",i.properties={};const o=s.shape;for(const h in o)i.properties[h]=_e(o[h],e,{...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 e.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=_e(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},gI=(n,e,t,r)=>{const i=n._zod.def,s=i.inclusive===!1,o=i.options.map((a,c)=>_e(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?t.oneOf=o:t.anyOf=o},mI=(n,e,t,r)=>{const i=n._zod.def,s=_e(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=_e(i.right,e,{...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]];t.allOf=c},vI=(n,e,t,r)=>{const i=t,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=_e(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const p of c)i.patternProperties[p.source]=h}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=_e(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=_e(s.valueType,e,{...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)}},yI=(n,e,t,r)=>{const i=n._zod.def,s=_e(i.innerType,e,r),o=e.seen.get(n);e.target==="openapi-3.0"?(o.ref=i.innerType,t.nullable=!0):t.anyOf=[s,{type:"null"}]},bI=(n,e,t,r)=>{const i=n._zod.def;_e(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},wI=(n,e,t,r)=>{const i=n._zod.def;_e(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.default=JSON.parse(JSON.stringify(i.defaultValue))},SI=(n,e,t,r)=>{const i=n._zod.def;_e(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,e.io==="input"&&(t._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},_I=(n,e,t,r)=>{const i=n._zod.def;_e(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=o},kI=(n,e,t,r)=>{const i=n._zod.def,s=e.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;_e(s,e,r);const o=e.seen.get(n);o.ref=s},EI=(n,e,t,r)=>{const i=n._zod.def;_e(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.readOnly=!0},Ym=(n,e,t,r)=>{const i=n._zod.def;_e(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},xI=A("ZodISODateTime",(n,e)=>{AA.init(n,e),me.init(n,e)});function AI(n){return R$(xI,n)}const $I=A("ZodISODate",(n,e)=>{$A.init(n,e),me.init(n,e)});function II(n){return D$($I,n)}const TI=A("ZodISOTime",(n,e)=>{IA.init(n,e),me.init(n,e)});function CI(n){return L$(TI,n)}const PI=A("ZodISODuration",(n,e)=>{TA.init(n,e),me.init(n,e)});function RI(n){return z$(PI,n)}const Xm=(n,e)=>{Cm.init(n,e),n.name="ZodError",Object.defineProperties(n,{format:{value:t=>b1(n,t)},flatten:{value:t=>y1(n,t)},addIssue:{value:t=>{n.issues.push(t),n.message=JSON.stringify(n.issues,Hc,2)}},addIssues:{value:t=>{n.issues.push(...t),n.message=JSON.stringify(n.issues,Hc,2)}},isEmpty:{get(){return n.issues.length===0}}})},tf=A("ZodError",Xm),ht=A("ZodError",Xm,{Parent:Error}),DI=ph(ht),LI=fh(ht),zI=ll(ht),OI=cl(ht),MI=_1(ht),NI=k1(ht),UI=E1(ht),FI=x1(ht),ZI=A1(ht),WI=$1(ht),HI=I1(ht),VI=T1(ht),ge=A("ZodType",(n,e)=>(fe.init(n,e),Object.assign(n["~standard"],{jsonSchema:{input:ka(n,"input"),output:ka(n,"output")}}),n.toJSONSchema=nI(n,{}),n.def=e,n.type=e.type,Object.defineProperty(n,"_def",{value:e}),n.check=(...t)=>n.clone(Dn(e,{checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),n.with=n.check,n.clone=(t,r)=>Ln(n,t,r),n.brand=()=>n,n.register=(t,r)=>(t.add(n,r),n),n.parse=(t,r)=>DI(n,t,r,{callee:n.parse}),n.safeParse=(t,r)=>zI(n,t,r),n.parseAsync=async(t,r)=>LI(n,t,r,{callee:n.parseAsync}),n.safeParseAsync=async(t,r)=>OI(n,t,r),n.spa=n.safeParseAsync,n.encode=(t,r)=>MI(n,t,r),n.decode=(t,r)=>NI(n,t,r),n.encodeAsync=async(t,r)=>UI(n,t,r),n.decodeAsync=async(t,r)=>FI(n,t,r),n.safeEncode=(t,r)=>ZI(n,t,r),n.safeDecode=(t,r)=>WI(n,t,r),n.safeEncodeAsync=async(t,r)=>HI(n,t,r),n.safeDecodeAsync=async(t,r)=>VI(n,t,r),n.refine=(t,r)=>n.check(zT(t,r)),n.superRefine=t=>n.check(OT(t)),n.overwrite=t=>n.check(Li(t)),n.optional=()=>sf(n),n.exactOptional=()=>_T(n),n.nullable=()=>of(n),n.nullish=()=>sf(of(n)),n.nonoptional=t=>IT(n,t),n.array=()=>D(n),n.or=t=>G([n,t]),n.and=t=>hl(n,t),n.transform=t=>af(n,wT(t)),n.default=t=>xT(n,t),n.prefault=t=>$T(n,t),n.catch=t=>CT(n,t),n.pipe=t=>af(n,t),n.readonly=()=>DT(n),n.describe=t=>{const r=n.clone();return Qi.add(r,{description:t}),r},Object.defineProperty(n,"description",{get(){var t;return(t=Qi.get(n))==null?void 0:t.description},configurable:!0}),n.meta=(...t)=>{if(t.length===0)return Qi.get(n);const r=n.clone();return Qi.add(r,t[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=t=>t(n),n)),Km=A("_ZodString",(n,e)=>{gh.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(r,i,s)=>iI(n,r,i);const t=n._zod.bag;n.format=t.format??null,n.minLength=t.minimum??null,n.maxLength=t.maximum??null,n.regex=(...r)=>n.check(Z$(...r)),n.includes=(...r)=>n.check(V$(...r)),n.startsWith=(...r)=>n.check(B$(...r)),n.endsWith=(...r)=>n.check(G$(...r)),n.min=(...r)=>n.check(_a(...r)),n.max=(...r)=>n.check(Vm(...r)),n.length=(...r)=>n.check(Bm(...r)),n.nonempty=(...r)=>n.check(_a(1,...r)),n.lowercase=r=>n.check(W$(r)),n.uppercase=r=>n.check(H$(r)),n.trim=()=>n.check(q$()),n.normalize=(...r)=>n.check(j$(...r)),n.toLowerCase=()=>n.check(Y$()),n.toUpperCase=()=>n.check(X$()),n.slugify=()=>n.check(K$())}),BI=A("ZodString",(n,e)=>{gh.init(n,e),Km.init(n,e),n.email=t=>n.check(h$(GI,t)),n.url=t=>n.check(m$(jI,t)),n.jwt=t=>n.check(P$(lT,t)),n.emoji=t=>n.check(v$(qI,t)),n.guid=t=>n.check(Kp(nf,t)),n.uuid=t=>n.check(d$(No,t)),n.uuidv4=t=>n.check(p$(No,t)),n.uuidv6=t=>n.check(f$(No,t)),n.uuidv7=t=>n.check(g$(No,t)),n.nanoid=t=>n.check(y$(YI,t)),n.guid=t=>n.check(Kp(nf,t)),n.cuid=t=>n.check(b$(XI,t)),n.cuid2=t=>n.check(w$(KI,t)),n.ulid=t=>n.check(S$(JI,t)),n.base64=t=>n.check(I$(sT,t)),n.base64url=t=>n.check(T$(oT,t)),n.xid=t=>n.check(_$(QI,t)),n.ksuid=t=>n.check(k$(eT,t)),n.ipv4=t=>n.check(E$(tT,t)),n.ipv6=t=>n.check(x$(nT,t)),n.cidrv4=t=>n.check(A$(rT,t)),n.cidrv6=t=>n.check($$(iT,t)),n.e164=t=>n.check(C$(aT,t)),n.datetime=t=>n.check(AI(t)),n.date=t=>n.check(II(t)),n.time=t=>n.check(CI(t)),n.duration=t=>n.check(RI(t))});function d(n){return u$(BI,n)}const me=A("ZodStringFormat",(n,e)=>{de.init(n,e),Km.init(n,e)}),GI=A("ZodEmail",(n,e)=>{vA.init(n,e),me.init(n,e)}),nf=A("ZodGUID",(n,e)=>{gA.init(n,e),me.init(n,e)}),No=A("ZodUUID",(n,e)=>{mA.init(n,e),me.init(n,e)}),jI=A("ZodURL",(n,e)=>{yA.init(n,e),me.init(n,e)}),qI=A("ZodEmoji",(n,e)=>{bA.init(n,e),me.init(n,e)}),YI=A("ZodNanoID",(n,e)=>{wA.init(n,e),me.init(n,e)}),XI=A("ZodCUID",(n,e)=>{SA.init(n,e),me.init(n,e)}),KI=A("ZodCUID2",(n,e)=>{_A.init(n,e),me.init(n,e)}),JI=A("ZodULID",(n,e)=>{kA.init(n,e),me.init(n,e)}),QI=A("ZodXID",(n,e)=>{EA.init(n,e),me.init(n,e)}),eT=A("ZodKSUID",(n,e)=>{xA.init(n,e),me.init(n,e)}),tT=A("ZodIPv4",(n,e)=>{CA.init(n,e),me.init(n,e)}),nT=A("ZodIPv6",(n,e)=>{PA.init(n,e),me.init(n,e)}),rT=A("ZodCIDRv4",(n,e)=>{RA.init(n,e),me.init(n,e)}),iT=A("ZodCIDRv6",(n,e)=>{DA.init(n,e),me.init(n,e)}),sT=A("ZodBase64",(n,e)=>{LA.init(n,e),me.init(n,e)}),oT=A("ZodBase64URL",(n,e)=>{OA.init(n,e),me.init(n,e)}),aT=A("ZodE164",(n,e)=>{MA.init(n,e),me.init(n,e)}),lT=A("ZodJWT",(n,e)=>{UA.init(n,e),me.init(n,e)}),Jm=A("ZodNumber",(n,e)=>{Fm.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(r,i,s)=>sI(n,r,i),n.gt=(r,i)=>n.check(Qp(r,i)),n.gte=(r,i)=>n.check(cc(r,i)),n.min=(r,i)=>n.check(cc(r,i)),n.lt=(r,i)=>n.check(Jp(r,i)),n.lte=(r,i)=>n.check(lc(r,i)),n.max=(r,i)=>n.check(lc(r,i)),n.int=r=>n.check(rf(r)),n.safe=r=>n.check(rf(r)),n.positive=r=>n.check(Qp(0,r)),n.nonnegative=r=>n.check(cc(0,r)),n.negative=r=>n.check(Jp(0,r)),n.nonpositive=r=>n.check(lc(0,r)),n.multipleOf=(r,i)=>n.check(ef(r,i)),n.step=(r,i)=>n.check(ef(r,i)),n.finite=()=>n;const t=n._zod.bag;n.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),n.isFinite=!0,n.format=t.format??null});function W(n){return O$(Jm,n)}const cT=A("ZodNumberFormat",(n,e)=>{FA.init(n,e),Jm.init(n,e)});function rf(n){return M$(cT,n)}const uT=A("ZodBoolean",(n,e)=>{ZA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>oI(n,t,r)});function Te(n){return N$(uT,n)}const hT=A("ZodUnknown",(n,e)=>{WA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>lI()});function S(){return U$(hT)}const dT=A("ZodNever",(n,e)=>{HA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>aI(n,t,r)});function pT(n){return F$(dT,n)}const fT=A("ZodArray",(n,e)=>{VA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>pI(n,t,r,i),n.element=e.element,n.min=(t,r)=>n.check(_a(t,r)),n.nonempty=t=>n.check(_a(1,t)),n.max=(t,r)=>n.check(Vm(t,r)),n.length=(t,r)=>n.check(Bm(t,r)),n.unwrap=()=>n.element});function D(n,e){return J$(fT,n,e)}const Qm=A("ZodObject",(n,e)=>{GA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>fI(n,t,r,i),oe(n,"shape",()=>e.shape),n.keyof=()=>Ea(Object.keys(n._zod.def.shape)),n.catchall=t=>n.clone({...n._zod.def,catchall:t}),n.passthrough=()=>n.clone({...n._zod.def,catchall:S()}),n.loose=()=>n.clone({...n._zod.def,catchall:S()}),n.strict=()=>n.clone({...n._zod.def,catchall:pT()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=t=>p1(n,t),n.safeExtend=t=>f1(n,t),n.merge=t=>g1(n,t),n.pick=t=>h1(n,t),n.omit=t=>d1(n,t),n.partial=(...t)=>m1(tv,n,t[0]),n.required=(...t)=>v1(nv,n,t[0])});function ev(n,e){const t={type:"object",shape:n??{},...z(e)};return new Qm(t)}function g(n,e){return new Qm({type:"object",shape:n,catchall:S(),...z(e)})}const gT=A("ZodUnion",(n,e)=>{jA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>gI(n,t,r,i),n.options=e.options});function G(n,e){return new gT({type:"union",options:n,...z(e)})}const mT=A("ZodIntersection",(n,e)=>{qA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>mI(n,t,r,i)});function hl(n,e){return new mT({type:"intersection",left:n,right:e})}const vT=A("ZodRecord",(n,e)=>{YA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>vI(n,t,r,i),n.keyType=e.keyType,n.valueType=e.valueType});function _(n,e,t){return new vT({type:"record",keyType:n,valueType:e,...z(t)})}const Bc=A("ZodEnum",(n,e)=>{XA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(r,i,s)=>cI(n,r,i),n.enum=e.entries,n.options=Object.values(e.entries);const t=new Set(Object.keys(e.entries));n.extract=(r,i)=>{const s={};for(const o of r)if(t.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Bc({...e,checks:[],...z(i),entries:s})},n.exclude=(r,i)=>{const s={...e.entries};for(const o of r)if(t.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new Bc({...e,checks:[],...z(i),entries:s})}});function Ea(n,e){const t=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new Bc({type:"enum",entries:t,...z(e)})}const yT=A("ZodLiteral",(n,e)=>{KA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>uI(n,t,r),n.values=new Set(e.values),Object.defineProperty(n,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function $(n,e){return new yT({type:"literal",values:Array.isArray(n)?n:[n],...z(e)})}const bT=A("ZodTransform",(n,e)=>{JA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>dI(n,t),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new Em(n.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(ps(s,t.value,e));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),t.issues.push(ps(o))}};const i=e.transform(t.value,t);return i instanceof Promise?i.then(s=>(t.value=s,t)):(t.value=i,t)}});function wT(n){return new bT({type:"transform",transform:n})}const tv=A("ZodOptional",(n,e)=>{Hm.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Ym(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function sf(n){return new tv({type:"optional",innerType:n})}const ST=A("ZodExactOptional",(n,e)=>{QA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Ym(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function _T(n){return new ST({type:"optional",innerType:n})}const kT=A("ZodNullable",(n,e)=>{e$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>yI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function of(n){return new kT({type:"nullable",innerType:n})}const ET=A("ZodDefault",(n,e)=>{t$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>wI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function xT(n,e){return new ET({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():Im(e)}})}const AT=A("ZodPrefault",(n,e)=>{n$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>SI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function $T(n,e){return new AT({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():Im(e)}})}const nv=A("ZodNonOptional",(n,e)=>{r$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>bI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function IT(n,e){return new nv({type:"nonoptional",innerType:n,...z(e)})}const TT=A("ZodCatch",(n,e)=>{i$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>_I(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function CT(n,e){return new TT({type:"catch",innerType:n,catchValue:typeof e=="function"?e:()=>e})}const PT=A("ZodPipe",(n,e)=>{s$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>kI(n,t,r,i),n.in=e.in,n.out=e.out});function af(n,e){return new PT({type:"pipe",in:n,out:e})}const RT=A("ZodReadonly",(n,e)=>{o$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>EI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function DT(n){return new RT({type:"readonly",innerType:n})}const LT=A("ZodCustom",(n,e)=>{a$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>hI(n,t)});function zT(n,e={}){return Q$(LT,n,e)}function OT(n){return eI(n)}const uc={custom:"custom"},MT=["text/markdown","text/html"],NT=["committed","pending"];function UT(n){let e;try{e=new URL(n)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}ev({id:d().min(1),type:Ea(MT),title:d(),status:Ea(NT),externalFilePath:d().optional(),externalURL:d().optional()}).superRefine((n,e)=>{n.externalFilePath!==void 0&&n.externalURL!==void 0&&e.addIssue({code:uc.custom,message:"externalFilePath and externalURL are mutually exclusive",path:["externalURL"]}),n.externalURL!==void 0&&(UT(n.externalURL)||e.addIssue({code:uc.custom,message:"externalURL must be an http(s) URL",path:["externalURL"]}),n.status!=="committed"&&e.addIssue({code:uc.custom,message:"URL-backed artifacts must have status committed",path:["status"]}))});ev({name:d().min(1),description:d(),accepts:D(d().min(1)).min(1)});function rv(n){return typeof n=="object"&&n!==null}function FT(n){return!rv(n)||n.type!=="ready"?!1:!("id"in n)}function ZT(n){return!(!rv(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}function WT(n,e){if(n===e)return 2;if(n==="*/*")return 0;const t=n.indexOf("/");if(t>0&&n.slice(t+1)==="*"){const r=n.slice(0,t),i=e.indexOf("/");if(i>0&&e.slice(0,i)===r)return 1}return null}function HT(n,e){let t=null;for(const r of n.accepts){const i=WT(r,e);i!==null&&(t===null||i>t)&&(t=i)}return t}function VT(n,e){let t=-1,r=null;for(const i of e){const s=HT(i,n);s!==null&&(s>t||s===t&&r!==null&&i.id<r.id)&&(t=s,r=i)}return r}const he={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"},Wt={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"},BT=1,GT=g({_meta:_(d(),S()).nullish(),terminal:Te().optional().default(!1)}),jT=g({_meta:_(d(),S()).nullish(),label:d().nullish(),name:d(),optional:Te().optional().default(!1),secret:Te().optional().default(!0)}),qT=g({_meta:_(d(),S()).nullish(),description:d().nullish(),id:d(),name:d()}),YT=g({_meta:_(d(),S()).nullish(),description:d().nullish(),id:d(),link:d().nullish(),name:d(),vars:D(jT)}),XT=g({_meta:_(d(),S()).nullish(),args:D(d()).optional(),description:d().nullish(),env:_(d(),d()).optional(),id:d(),name:d()}),KT=G([YT.and(g({type:$("env_var")})),XT.and(g({type:$("terminal")})),qT]),JT=g({_meta:_(d(),S()).nullish(),methodId:d()}),QT=g({_meta:_(d(),S()).nullish()}),eC=g({_meta:_(d(),S()).nullish(),blob:d(),mimeType:d().nullish(),uri:d()}),tC=g({default:Te().nullish(),description:d().nullish(),title:d().nullish()}),nC=g({_meta:_(d(),S()).nullish()}),rC=g({_meta:_(d(),S()).nullish()}),iC=g({amount:W(),currency:d()}),sC=g({_meta:_(d(),S()).nullish(),terminalId:d()}),oC=g({_meta:_(d(),S()).nullish(),newText:d(),oldText:d().nullish(),path:d()}),aC=G([d(),W(),W(),Te(),D(d())]),lC=g({content:_(d(),aC).nullish()}),cC=G([lC.and(g({action:$("accept")})),g({action:$("decline")}),g({action:$("cancel")})]),uC=g({_meta:_(d(),S()).nullish()}),iv=d(),hC=g({_meta:_(d(),S()).nullish(),elicitationId:iv}),dC=g({_meta:_(d(),S()).nullish(),action:cC}),pC=$("object"),fC=$("string"),gC=g({_meta:_(d(),S()).nullish()}),mC=g({_meta:_(d(),S()).nullish(),form:uC.nullish(),url:gC.nullish()}),vC=g({elicitationId:iv,url:d().url()}),sv=g({const:d(),title:d()}),ov=g({_meta:_(d(),S()).nullish(),name:d(),value:d()}),yC=G([$(-32700),$(-32600),$(-32601),$(-32602),$(-32603),$(-32800),$(-32e3),$(-32002),$(-32042),W().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),av=g({code:yC,data:S().optional(),message:d()}),lv=S(),cv=S(),uv=S(),bC=g({_meta:_(d(),S()).nullish(),readTextFile:Te().optional().default(!1),writeTextFile:Te().optional().default(!1)}),hv=g({_meta:_(d(),S()).nullish(),name:d(),value:d()}),dv=g({_meta:_(d(),S()).nullish(),name:d(),title:d().nullish(),version:d()}),wC=g({default:W().nullish(),description:d().nullish(),maximum:W().nullish(),minimum:W().nullish(),title:d().nullish()}),SC=g({_meta:_(d(),S()).nullish()}),_C=g({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cursor:d().nullish(),cwd:d().nullish()}),kC=g({_meta:_(d(),S()).nullish()}),EC=g({_meta:_(d(),S()).nullish(),logout:kC.nullish()}),xC=g({_meta:_(d(),S()).nullish()}),AC=g({_meta:_(d(),S()).nullish()}),$C=g({_meta:_(d(),S()).nullish(),http:Te().optional().default(!1),sse:Te().optional().default(!1)}),IC=g({_meta:_(d(),S()).nullish(),headers:D(hv),name:d(),url:d()}),TC=g({_meta:_(d(),S()).nullish(),headers:D(hv),name:d(),url:d()}),CC=g({_meta:_(d(),S()).nullish(),args:D(d()),command:d(),env:D(ov),name:d()}),dl=G([IC.and(g({type:$("http")})),TC.and(g({type:$("sse")})),CC]),mh=d(),PC=g({_meta:_(d(),S()).nullish(),description:d().nullish(),modelId:mh,name:d()}),RC=G([$("error"),$("warning"),$("information"),$("hint")]),DC=g({_meta:_(d(),S()).nullish()}),LC=g({_meta:_(d(),S()).nullish()}),zC=g({_meta:_(d(),S()).nullish()}),OC=g({_meta:_(d(),S()).nullish()}),MC=g({_meta:_(d(),S()).nullish()}),NC=g({_meta:_(d(),S()).nullish(),maxCount:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),UC=g({diff:d(),uri:d()}),FC=g({endLine:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:d()}),ZC=g({_meta:_(d(),S()).nullish()}),WC=g({_meta:_(d(),S()).nullish()}),HC=g({languageId:d(),text:d(),uri:d()}),VC=g({_meta:_(d(),S()).nullish(),maxCount:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),BC=G([$("rejected"),$("ignored"),$("replaced"),$("cancelled")]),GC=g({excerpts:D(FC),uri:d()}),jC=g({_meta:_(d(),S()).nullish()}),qC=g({_meta:_(d(),S()).nullish()}),YC=g({name:d(),owner:d(),remoteUrl:d()}),XC=g({_meta:_(d(),S()).nullish()}),KC=g({_meta:_(d(),S()).nullish(),jump:ZC.nullish(),rename:qC.nullish(),searchAndReplace:XC.nullish()}),JC=g({id:d(),isRegex:Te().nullish(),replace:d(),search:d(),uri:d()}),QC=G([$("automatic"),$("diagnostic"),$("manual")]),eP=g({_meta:_(d(),S()).nullish(),maxCount:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),tP=g({_meta:_(d(),S()).nullish(),diagnostics:DC.nullish(),editHistory:NC.nullish(),openFiles:WC.nullish(),recentFiles:VC.nullish(),relatedSnippets:jC.nullish(),userActions:eP.nullish()}),nP=g({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(dl)}),rP=g({default:W().nullish(),description:d().nullish(),maximum:W().nullish(),minimum:W().nullish(),title:d().nullish()}),pv=d(),iP=G([$("allow_once"),$("allow_always"),$("reject_once"),$("reject_always")]),sP=g({_meta:_(d(),S()).nullish(),kind:iP,name:d(),optionId:pv}),oP=G([$("high"),$("medium"),$("low")]),aP=G([$("pending"),$("in_progress"),$("completed")]),lP=g({_meta:_(d(),S()).nullish(),content:d(),priority:oP,status:aP}),cP=g({_meta:_(d(),S()).nullish(),entries:D(lP)}),Tn=g({character:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),uP=g({id:d(),position:Tn,uri:d()}),hP=g({id:d(),newName:d(),position:Tn,uri:d()}),dP=g({action:d(),position:Tn,timestampMs:W(),uri:d()}),fv=G([$("utf-16"),$("utf-32"),$("utf-8")]),pP=g({_meta:_(d(),S()).nullish(),auth:GT.optional().default({terminal:!1}),elicitation:mC.nullish(),fs:bC.optional().default({readTextFile:!1,writeTextFile:!1}),nes:KC.nullish(),positionEncodings:D(fv).optional(),terminal:Te().optional().default(!1)}),fP=g({_meta:_(d(),S()).nullish(),audio:Te().optional().default(!1),embeddedContext:Te().optional().default(!1),image:Te().optional().default(!1)}),gv=W().int().gte(0).lte(65535),gP=g({_meta:_(d(),S()).nullish(),clientCapabilities:pP.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:dv.nullish(),protocolVersion:gv}),zi=g({end:Tn,start:Tn}),mP=g({message:d(),range:zi,severity:RC,uri:d()}),vP=g({languageId:d(),lastFocusedMs:W().nullish(),uri:d(),visibleRange:zi.nullish()}),yP=g({_meta:_(d(),S()).nullish(),diagnostics:D(mP).nullish(),editHistory:D(UC).nullish(),openFiles:D(vP).nullish(),recentFiles:D(HC).nullish(),relatedSnippets:D(GC).nullish(),userActions:D(dP).nullish()}),bP=g({newText:d(),range:zi}),wP=g({cursorPosition:Tn.nullish(),edits:D(bP),id:d(),uri:d()}),SP=G([wP.and(g({kind:$("edit")})),uP.and(g({kind:$("jump")})),hP.and(g({kind:$("rename")})),JC.and(g({kind:$("searchAndReplace")}))]),_P=g({_meta:_(d(),S()).nullish(),content:d()}),kP=g({_meta:_(d(),S()).nullish()}),wr=G([W(),d()]).nullable();g({_meta:_(d(),S()).nullish(),requestId:wr});const EP=Ea(["assistant","user"]),vo=g({_meta:_(d(),S()).nullish(),audience:D(EP).nullish(),lastModified:d().nullish(),priority:W().nullish()}),xP=g({_meta:_(d(),S()).nullish(),annotations:vo.nullish(),data:d(),mimeType:d()}),AP=g({_meta:_(d(),S()).nullish(),annotations:vo.nullish(),data:d(),mimeType:d(),uri:d().nullish()}),$P=g({_meta:_(d(),S()).nullish(),annotations:vo.nullish(),description:d().nullish(),mimeType:d().nullish(),name:d(),size:W().nullish(),title:d().nullish(),uri:d()}),IP=g({_meta:_(d(),S()).nullish(),optionId:pv}),TP=G([g({outcome:$("cancelled")}),IP.and(g({outcome:$("selected")}))]),CP=g({_meta:_(d(),S()).nullish(),outcome:TP}),PP=g({_meta:_(d(),S()).nullish()}),RP=g({_meta:_(d(),S()).nullish()}),DP=g({currentValue:Te()}),LP=d(),mv=d(),zP=G([$("mode"),$("model"),$("thought_level"),d()]),vh=d(),vv=g({_meta:_(d(),S()).nullish(),description:d().nullish(),name:d(),value:vh}),OP=g({_meta:_(d(),S()).nullish(),group:LP,name:d(),options:D(vv)}),MP=G([D(vv),D(OP)]),NP=g({currentValue:vh,options:MP}),Oi=hl(G([NP.and(g({type:$("select")})),DP.and(g({type:$("boolean")}))]),g({_meta:_(d(),S()).nullish(),category:zP.nullish(),description:d().nullish(),id:mv,name:d()})),UP=g({_meta:_(d(),S()).nullish(),configOptions:D(Oi)}),FP=g({_meta:_(d(),S()).nullish()}),te=d(),ZP=g({_meta:_(d(),S()).nullish(),id:d(),sessionId:te}),WP=g({_meta:_(d(),S()).nullish(),sessionId:te}),HP=g({_meta:_(d(),S()).nullish(),sessionId:te}),VP=g({_meta:_(d(),S()).nullish(),sessionId:te}),yv=g({_meta:_(d(),S()).nullish(),args:D(d()).optional(),command:d(),cwd:d().nullish(),env:D(ov).optional(),outputByteLimit:W().nullish(),sessionId:te}),BP=g({_meta:_(d(),S()).nullish(),sessionId:te,uri:d()}),GP=g({_meta:_(d(),S()).nullish(),position:Tn,sessionId:te,uri:d(),version:W(),visibleRange:zi}),jP=g({_meta:_(d(),S()).nullish(),languageId:d(),sessionId:te,text:d(),uri:d(),version:W()}),qP=g({_meta:_(d(),S()).nullish(),sessionId:te,uri:d()}),YP=g({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(dl).optional(),sessionId:te}),bv=g({_meta:_(d(),S()).nullish(),sessionId:te,terminalId:d()}),XP=g({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(dl),sessionId:te}),wv=g({_meta:_(d(),S()).nullish(),limit:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d(),sessionId:te}),KP=g({_meta:_(d(),S()).nullish(),id:d(),reason:BC.nullish(),sessionId:te}),Sv=g({_meta:_(d(),S()).nullish(),sessionId:te,terminalId:d()}),JP=g({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(dl).optional(),sessionId:te}),QP=g({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),sessionId:te,title:d().nullish(),updatedAt:d().nullish()}),eR=g({_meta:_(d(),S()).nullish(),nextCursor:d().nullish(),sessions:D(QP)}),tR=g({_meta:_(d(),S()).nullish(),title:d().nullish(),updatedAt:d().nullish()}),nR=g({_meta:_(d(),S()).nullish()}),pl=d(),rR=g({_meta:_(d(),S()).nullish(),currentModeId:pl}),iR=g({_meta:_(d(),S()).nullish(),description:d().nullish(),id:pl,name:d()}),fl=g({_meta:_(d(),S()).nullish(),availableModes:D(iR),currentModeId:pl}),gl=g({_meta:_(d(),S()).nullish(),availableModels:D(PC),currentModelId:mh}),sR=g({_meta:_(d(),S()).nullish(),configOptions:D(Oi).nullish(),models:gl.nullish(),modes:fl.nullish(),sessionId:te}),oR=g({_meta:_(d(),S()).nullish(),configOptions:D(Oi).nullish(),models:gl.nullish(),modes:fl.nullish()}),aR=g({_meta:_(d(),S()).nullish(),configOptions:D(Oi).nullish(),models:gl.nullish(),modes:fl.nullish(),sessionId:te}),lR=g({_meta:_(d(),S()).nullish(),configOptions:D(Oi).nullish(),models:gl.nullish(),modes:fl.nullish()}),cR=g({_meta:_(d(),S()).nullish()}),uR=g({_meta:_(d(),S()).nullish(),additionalDirectories:PP.nullish(),close:RP.nullish(),fork:FP.nullish(),list:nR.nullish(),resume:cR.nullish()}),hR=hl(G([g({type:$("boolean"),value:Te()}),g({value:vh})]),g({_meta:_(d(),S()).nullish(),configId:mv,sessionId:te})),dR=g({_meta:_(d(),S()).nullish(),configOptions:D(Oi)}),pR=g({_meta:_(d(),S()).nullish(),modeId:pl,sessionId:te}),fR=g({_meta:_(d(),S()).nullish()}),gR=g({_meta:_(d(),S()).nullish(),modelId:mh,sessionId:te}),mR=g({_meta:_(d(),S()).nullish()}),vR=g({_meta:_(d(),S()).nullish(),sessionId:te}),yR=G([$("end_turn"),$("max_tokens"),$("max_turn_requests"),$("refusal"),$("cancelled")]),bR=G([$("email"),$("uri"),$("date"),$("date-time")]),wR=g({default:d().nullish(),description:d().nullish(),enum:D(d()).nullish(),format:bR.nullish(),maxLength:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:D(sv).nullish(),pattern:d().nullish(),title:d().nullish()}),SR=g({_meta:_(d(),S()).nullish(),context:yP.nullish(),position:Tn,selection:zi.nullish(),sessionId:te,triggerKind:QC,uri:d(),version:W()}),_R=g({_meta:_(d(),S()).nullish(),suggestions:D(SP)}),kR=g({_meta:_(d(),S()).nullish(),terminalId:d()}),ER=g({_meta:_(d(),S()).nullish(),exitCode:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),_v=g({_meta:_(d(),S()).nullish(),sessionId:te,terminalId:d()}),xR=g({_meta:_(d(),S()).nullish(),exitStatus:ER.nullish(),output:d(),truncated:Te()}),AR=g({_meta:_(d(),S()).nullish(),annotations:vo.nullish(),text:d()}),$R=g({range:zi.nullish(),text:d()}),IR=g({_meta:_(d(),S()).nullish(),contentChanges:D($R),sessionId:te,uri:d(),version:W()});g({method:d(),params:G([WP,jP,IR,BP,qP,GP,ZP,KP,lv]).nullish()});const TR=G([$("full"),$("incremental")]),CR=g({_meta:_(d(),S()).nullish(),syncKind:TR}),PR=g({_meta:_(d(),S()).nullish(),didChange:CR.nullish(),didClose:LC.nullish(),didFocus:zC.nullish(),didOpen:OC.nullish(),didSave:MC.nullish()}),RR=g({_meta:_(d(),S()).nullish(),document:PR.nullish()}),DR=g({_meta:_(d(),S()).nullish(),context:tP.nullish(),events:RR.nullish()}),LR=g({_meta:_(d(),S()).nullish(),auth:EC.optional().default({}),loadSession:Te().optional().default(!1),mcpCapabilities:$C.optional().default({http:!1,sse:!1}),nes:DR.nullish(),positionEncoding:fv.nullish(),promptCapabilities:fP.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:uR.optional().default({})}),zR=g({_meta:_(d(),S()).nullish(),agentCapabilities:LR.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:dv.nullish(),authMethods:D(KT).optional().default([]),protocolVersion:gv}),OR=g({_meta:_(d(),S()).nullish(),mimeType:d().nullish(),text:d(),uri:d()}),MR=G([OR,eC]),NR=g({_meta:_(d(),S()).nullish(),annotations:vo.nullish(),resource:MR}),yh=G([AR.and(g({type:$("text")})),AP.and(g({type:$("image")})),xP.and(g({type:$("audio")})),$P.and(g({type:$("resource_link")})),NR.and(g({type:$("resource")}))]),UR=g({_meta:_(d(),S()).nullish(),content:yh}),hc=g({_meta:_(d(),S()).nullish(),content:yh,messageId:d().nullish()}),FR=g({_meta:_(d(),S()).nullish(),messageId:d().nullish(),prompt:D(yh),sessionId:te}),ZR=g({anyOf:D(sv)}),kv=G([UR.and(g({type:$("content")})),oC.and(g({type:$("diff")})),kR.and(g({type:$("terminal")}))]),Ev=d(),xv=g({_meta:_(d(),S()).nullish(),line:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d()}),Av=G([$("pending"),$("in_progress"),$("completed"),$("failed")]),$v=G([$("read"),$("edit"),$("delete"),$("move"),$("search"),$("execute"),$("think"),$("fetch"),$("switch_mode"),$("other")]),WR=g({_meta:_(d(),S()).nullish(),content:D(kv).optional(),kind:$v.optional(),locations:D(xv).optional(),rawInput:S().optional(),rawOutput:S().optional(),status:Av.optional(),title:d(),toolCallId:Ev}),Iv=g({_meta:_(d(),S()).nullish(),content:D(kv).nullish(),kind:$v.nullish(),locations:D(xv).nullish(),rawInput:S().optional(),rawOutput:S().optional(),status:Av.nullish(),title:d().nullish(),toolCallId:Ev}),Tv=g({_meta:_(d(),S()).nullish(),options:D(sP),sessionId:te,toolCall:Iv}),HR=g({_meta:_(d(),S()).nullish(),hint:d()}),VR=HR,BR=g({_meta:_(d(),S()).nullish(),description:d(),input:VR.nullish(),name:d()}),GR=g({_meta:_(d(),S()).nullish(),availableCommands:D(BR)}),jR=g({enum:D(d()),type:fC}),qR=G([jR,ZR]),YR=g({default:D(d()).nullish(),description:d().nullish(),items:qR,maxItems:W().nullish(),minItems:W().nullish(),title:d().nullish()}),XR=G([wR.and(g({type:$("string")})),rP.and(g({type:$("number")})),wC.and(g({type:$("integer")})),tC.and(g({type:$("boolean")})),YR.and(g({type:$("array")}))]),KR=g({description:d().nullish(),properties:_(d(),XR).optional().default({}),required:D(d()).nullish(),title:d().nullish(),type:pC.optional().default("object")}),JR=g({requestedSchema:KR}),QR=hl(G([JR.and(g({mode:$("form")})),vC.and(g({mode:$("url")}))]),g({_meta:_(d(),S()).nullish(),message:d(),sessionId:te})),eD=g({cachedReadTokens:W().nullish(),cachedWriteTokens:W().nullish(),inputTokens:W(),outputTokens:W(),thoughtTokens:W().nullish(),totalTokens:W()}),tD=g({_meta:_(d(),S()).nullish(),stopReason:yR,usage:eD.nullish(),userMessageId:d().nullish()});G([g({id:wr,result:G([zR,QT,AC,aR,oR,eR,sR,lR,rC,fR,dR,tD,mR,vR,_R,nC,uv])}),g({error:av,id:wr})]);const nD=g({_meta:_(d(),S()).nullish(),cost:iC.nullish(),size:W(),used:W()}),rD=G([hc.and(g({sessionUpdate:$("user_message_chunk")})),hc.and(g({sessionUpdate:$("agent_message_chunk")})),hc.and(g({sessionUpdate:$("agent_thought_chunk")})),WR.and(g({sessionUpdate:$("tool_call")})),Iv.and(g({sessionUpdate:$("tool_call_update")})),cP.and(g({sessionUpdate:$("plan")})),GR.and(g({sessionUpdate:$("available_commands_update")})),rR.and(g({sessionUpdate:$("current_mode_update")})),UP.and(g({sessionUpdate:$("config_option_update")})),tR.and(g({sessionUpdate:$("session_info_update")})),nD.and(g({sessionUpdate:$("usage_update")}))]),Cv=g({_meta:_(d(),S()).nullish(),sessionId:te,update:rD});g({method:d(),params:G([Cv,hC,lv]).nullish()});const Pv=g({_meta:_(d(),S()).nullish(),sessionId:te,terminalId:d()}),iD=g({_meta:_(d(),S()).nullish(),exitCode:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),sD=g({name:d(),uri:d()}),oD=g({_meta:_(d(),S()).nullish(),repository:YC.nullish(),workspaceFolders:D(sD).nullish(),workspaceUri:d().nullish()});g({id:wr,method:d(),params:G([gP,JT,xC,nP,XP,_C,YP,JP,VP,pR,hR,FR,gR,oD,SR,HP,cv]).nullish()});const Rv=g({_meta:_(d(),S()).nullish(),content:d(),path:d(),sessionId:te});g({id:wr,method:d(),params:G([Rv,wv,Tv,yv,_v,Sv,Pv,bv,QR,cv]).nullish()});const aD=g({_meta:_(d(),S()).nullish()});G([g({id:wr,result:G([aD,_P,CP,sC,xR,kP,iD,SC,dC,uv])}),g({error:av,id:wr})]);var ee;class lD{constructor(e,t){w(this,ee);const r=e(this),i=async(o,a)=>{var c,u,h,p,v,m,E;switch(o){case Wt.fs_write_text_file:{const k=Rv.parse(a);return(c=r.writeTextFile)==null?void 0:c.call(r,k)}case Wt.fs_read_text_file:{const k=wv.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,k)}case Wt.session_request_permission:{const k=Tv.parse(a);return r.requestPermission(k)}case Wt.terminal_create:{const k=yv.parse(a);return(h=r.createTerminal)==null?void 0:h.call(r,k)}case Wt.terminal_output:{const k=_v.parse(a);return(p=r.terminalOutput)==null?void 0:p.call(r,k)}case Wt.terminal_release:{const k=Sv.parse(a);return await((v=r.releaseTerminal)==null?void 0:v.call(r,k))??{}}case Wt.terminal_wait_for_exit:{const k=Pv.parse(a);return(m=r.waitForTerminalExit)==null?void 0:m.call(r,k)}case Wt.terminal_kill:{const k=bv.parse(a);return await((E=r.killTerminal)==null?void 0:E.call(r,k))??{}}default:if(r.extMethod)return r.extMethod(o,a);throw Ae.methodNotFound(o)}},s=async(o,a)=>{switch(o){case Wt.session_update:{const c=Cv.parse(a);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(o,a);throw Ae.methodNotFound(o)}};x(this,ee,new cD(i,s,t))}async initialize(e){return await l(this,ee).sendRequest(he.initialize,e)}async newSession(e){return await l(this,ee).sendRequest(he.session_new,e)}async loadSession(e){return await l(this,ee).sendRequest(he.session_load,e)??{}}async unstable_forkSession(e){return await l(this,ee).sendRequest(he.session_fork,e)}async listSessions(e){return await l(this,ee).sendRequest(he.session_list,e)}async unstable_resumeSession(e){return await l(this,ee).sendRequest(he.session_resume,e)}async unstable_closeSession(e){return await l(this,ee).sendRequest(he.session_close,e)}async setSessionMode(e){return await l(this,ee).sendRequest(he.session_set_mode,e)??{}}async unstable_setSessionModel(e){return await l(this,ee).sendRequest(he.session_set_model,e)??{}}async setSessionConfigOption(e){return await l(this,ee).sendRequest(he.session_set_config_option,e)}async authenticate(e){return await l(this,ee).sendRequest(he.authenticate,e)??{}}async unstable_logout(e){return await l(this,ee).sendRequest(he.logout,e)??{}}async prompt(e){return await l(this,ee).sendRequest(he.session_prompt,e)}async cancel(e){return await l(this,ee).sendNotification(he.session_cancel,e)}async unstable_startNes(e){return await l(this,ee).sendRequest(he.nes_start,e)}async unstable_suggestNes(e){return await l(this,ee).sendRequest(he.nes_suggest,e)}async unstable_closeNes(e){return await l(this,ee).sendRequest(he.nes_close,e)??{}}async unstable_didOpenDocument(e){return await l(this,ee).sendNotification(he.document_did_open,e)}async unstable_didChangeDocument(e){return await l(this,ee).sendNotification(he.document_did_change,e)}async unstable_didCloseDocument(e){return await l(this,ee).sendNotification(he.document_did_close,e)}async unstable_didSaveDocument(e){return await l(this,ee).sendNotification(he.document_did_save,e)}async unstable_didFocusDocument(e){return await l(this,ee).sendNotification(he.document_did_focus,e)}async unstable_acceptNes(e){return await l(this,ee).sendNotification(he.nes_accept,e)}async unstable_rejectNes(e){return await l(this,ee).sendNotification(he.nes_reject,e)}async extMethod(e,t){return await l(this,ee).sendRequest(e,t)}async extNotification(e,t){return await l(this,ee).sendNotification(e,t)}get signal(){return l(this,ee).signal}get closed(){return l(this,ee).closed}}ee=new WeakMap;var gn,Da,Es,xs,ni,ri,Ct,As,pe,Dv,Gc,Lv,zv,Ov,Mv,jc,es;class cD{constructor(e,t,r){w(this,pe);w(this,gn,new Map);w(this,Da,0);w(this,Es);w(this,xs);w(this,ni);w(this,ri,Promise.resolve());w(this,Ct,new AbortController);w(this,As);x(this,Es,e),x(this,xs,t),x(this,ni,r),x(this,As,new Promise(i=>{l(this,Ct).signal.addEventListener("abort",()=>i())})),f(this,pe,Dv).call(this)}get signal(){return l(this,Ct).signal}get closed(){return l(this,As)}async sendRequest(e,t){f(this,pe,jc).call(this);const r=ud(this,Da)._++,i=new Promise((s,o)=>{l(this,gn).set(r,{resolve:s,reject:o})});return await f(this,pe,es).call(this,{jsonrpc:"2.0",id:r,method:e,params:t}),i}async sendNotification(e,t){f(this,pe,jc).call(this),await f(this,pe,es).call(this,{jsonrpc:"2.0",method:e,params:t})}}gn=new WeakMap,Da=new WeakMap,Es=new WeakMap,xs=new WeakMap,ni=new WeakMap,ri=new WeakMap,Ct=new WeakMap,As=new WeakMap,pe=new WeakSet,Dv=async function(){let e;try{const t=l(this,ni).readable.getReader();try{for(;!l(this,Ct).signal.aborted;){const{value:r,done:i}=await t.read();if(i)break;if(r)try{f(this,pe,Lv).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&f(this,pe,es).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{t.releaseLock()}}catch(t){e=t}finally{f(this,pe,Gc).call(this,e)}},Gc=function(e){if(l(this,Ct).signal.aborted)return;const t=e??new Error("ACP connection closed");for(const r of l(this,gn).values())r.reject(t);l(this,gn).clear(),l(this,Ct).abort(t)},Lv=async function(e){if("method"in e&&"id"in e){const t=await f(this,pe,zv).call(this,e.method,e.params);"error"in t&&console.error("Error handling request",e,t.error),await f(this,pe,es).call(this,{jsonrpc:"2.0",id:e.id,...t})}else if("method"in e){const t=await f(this,pe,Ov).call(this,e.method,e.params);"error"in t&&console.error("Error handling notification",e,t.error)}else"id"in e?f(this,pe,Mv).call(this,e):console.error("Invalid message",{message:e})},zv=async function(e,t){try{return{result:await l(this,Es).call(this,e,t)??null}}catch(r){if(r instanceof Ae)return r.toResult();if(r instanceof tf)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()}}},Ov=async function(e,t){try{return await l(this,xs).call(this,e,t),{result:null}}catch(r){if(r instanceof Ae)return r.toResult();if(r instanceof tf)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()}}},Mv=function(e){const t=l(this,gn).get(e.id);if(t){if("result"in e)t.resolve(e.result);else if("error"in e){const{code:r,message:i,data:s}=e.error;t.reject(new Ae(r,i,s))}l(this,gn).delete(e.id)}else console.error("Got response to unknown request",e.id)},jc=function(){if(l(this,Ct).signal.aborted)throw l(this,Ct).signal.reason??new Error("ACP connection closed")},es=async function(e){return x(this,ri,l(this,ri).then(async()=>{const t=l(this,ni).writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(t=>{f(this,pe,Gc).call(this,t)})),l(this,ri)};class Ae extends Error{constructor(t,r,i){super(r);b(this,"code");b(this,"data");this.code=t,this.name="RequestError",this.data=i}static parseError(t,r){return new Ae(-32700,`Parse error${r?`: ${r}`:""}`,t)}static invalidRequest(t,r){return new Ae(-32600,`Invalid request${r?`: ${r}`:""}`,t)}static methodNotFound(t){return new Ae(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,r){return new Ae(-32602,`Invalid params${r?`: ${r}`:""}`,t)}static internalError(t,r){return new Ae(-32603,`Internal error${r?`: ${r}`:""}`,t)}static authRequired(t,r){return new Ae(-32e3,`Authentication required${r?`: ${r}`:""}`,t)}static resourceNotFound(t){return new Ae(-32002,`Resource not found${t?`: ${t}`:""}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}}const uD=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,hD=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,dD=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,pD=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,fD="single_session",gD={name:"television-acp-client",version:"0.0.0"},Nv="agent:main:television",mD=mo(Ot);var ae,Gt,ii,jt,rr,ir,sr,or,mn,si,Pt,Qe,qt,ar,Yt,vn,$s,Xt,gt,La,Kt,I,Uv,Fv,Zv,qc,Wv,Hv,Vv,Bv,Gv,jv,qv,Wn,Wr,Hr,Ve,Yv,Vr,Yc,Xc,ra,Xv,Kv,Is,Ts,Kc,Br,Jv,Qv;class vD extends mD{constructor(t){super();w(this,I);w(this,ae,bD());w(this,Gt,null);w(this,ii,null);w(this,jt,null);w(this,rr,null);w(this,ir,null);w(this,sr,null);w(this,or);w(this,mn,null);w(this,si,1);w(this,Pt,null);w(this,Qe,null);w(this,qt,!1);w(this,ar,!1);w(this,Yt,null);w(this,vn,new Set);w(this,$s);w(this,Xt);w(this,gt);w(this,La,t=>{f(this,I,Fv).call(this,t)});w(this,Kt,null);w(this,Is,()=>{f(this,I,Br).call(this,"ACP bridge websocket closed")});w(this,Ts,()=>{f(this,I,Br).call(this,"ACP bridge websocket error")});x(this,Xt,t),x(this,gt,t.sessionMode??fD),x(this,or,t.mappedSessionStore??yD()),x(this,$s,t.createSocket??(r=>new WebSocket(r)))}getState(){return l(this,ae)}get messages(){return l(this,ae).messageOrder.map(t=>l(this,ae).messagesById[t]).filter(t=>t!==void 0)}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(l(this,ae).lifecycle.status!=="ready"){f(this,I,Ve).call(this,{lifecycle:{status:"connecting"}}),l(this,ii)??x(this,ii,f(this,I,Uv).call(this));try{await l(this,ii),await f(this,I,qc).call(this)}catch(t){throw f(this,I,Br).call(this,Uo(t)),t}}}dispose(){f(this,I,Kc).call(this),f(this,I,Ve).call(this,{lifecycle:{status:"disposed"},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null})}async sendMessage(t){if(await this.connect(),l(this,ae).lifecycle.status!=="ready"||l(this,ae).run.status==="running"||l(this,ae).run.status==="cancelling")throw new Error("ACPClient is not ready to send a new message");const r=t.text.trim();if(!r)throw new Error("Cannot send an empty message");f(this,I,Wr).call(this,{id:f(this,I,Vr).call(this,"user"),kind:"user",text:r,status:"final"}),f(this,I,Ve).call(this,{run:{status:"running",stopReason:null,canCancel:!0,error:null}});try{const i=await f(this,I,ra).call(this).prompt({sessionId:f(this,I,Xc).call(this),prompt:[{type:"text",text:f(this,I,Yv).call(this,r)}]});f(this,I,Wn).call(this,i.stopReason==="cancelled"?"cancelled":"final"),f(this,I,Ve).call(this,{run:{status:i.stopReason==="cancelled"?"cancelled":"completed",stopReason:i.stopReason,canCancel:!1,error:null}})}catch(i){throw f(this,I,Qv).call(this)||(f(this,I,Wn).call(this,"error"),f(this,I,Ve).call(this,{run:{status:"error",stopReason:null,canCancel:!1,error:Uo(i)}})),i}}async cancel(){if(await this.connect(),!l(this,ae).run.canCancel||l(this,ae).run.status!=="running")throw new Error("No active cancellable run");f(this,I,Ve).call(this,{run:{...l(this,ae).run,status:"cancelling"}}),await f(this,I,ra).call(this).cancel({sessionId:f(this,I,Xc).call(this)})}setScreenContext(t){var s,o,a;if(t===null){if(l(this,Qe)===null)return;x(this,Qe,null),x(this,qt,!1);return}const r={screenID:t.screenID,screenName:t.screenName};if(((s=l(this,Qe))==null?void 0:s.screenID)===r.screenID&&((o=l(this,Qe))==null?void 0:o.screenName)===r.screenName)return;const i=((a=l(this,Qe))==null?void 0:a.screenID)??null;if(x(this,Qe,r),l(this,gt)==="single_session"){(!l(this,mn)||i!==r.screenID)&&x(this,qt,!0);return}l(this,mn)!==lf(l(this,gt),r.screenID,l(this,Xt).clientGUID??"default-client")&&(x(this,jt,null),x(this,rr,null),l(this,Gt)&&l(this,ae).run.status==="idle"&&f(this,I,qc).call(this).catch(c=>{f(this,I,Br).call(this,Uo(c))}))}}ae=new WeakMap,Gt=new WeakMap,ii=new WeakMap,jt=new WeakMap,rr=new WeakMap,ir=new WeakMap,sr=new WeakMap,or=new WeakMap,mn=new WeakMap,si=new WeakMap,Pt=new WeakMap,Qe=new WeakMap,qt=new WeakMap,ar=new WeakMap,Yt=new WeakMap,vn=new WeakMap,$s=new WeakMap,Xt=new WeakMap,gt=new WeakMap,La=new WeakMap,Kt=new WeakMap,I=new WeakSet,Uv=async function(){try{f(this,I,Ve).call(this,{lifecycle:{status:"connecting"}});const{stream:t,socket:r,metadata:i}=await _D({serverURL:l(this,Xt).serverURL,token:l(this,Xt).token,createSocket:l(this,$s),onDisconnect:l(this,La)});x(this,sr,i),f(this,I,Ve).call(this,{bridge:i}),x(this,Kt,r),r.addEventListener("close",l(this,Is)),r.addEventListener("error",l(this,Ts)),x(this,Gt,new lD(s=>({connection:s,sessionUpdate:async o=>{await f(this,I,Hv).call(this,o)},requestPermission:async o=>f(this,I,Vv).call(this,o)}),t)),await l(this,Gt).initialize({protocolVersion:BT,clientCapabilities:{},clientInfo:gD})}catch(t){throw t}},Fv=function(t){f(this,I,Br).call(this,Uo(t))},Zv=function(t){const r=t==null?void 0:t.models;if(!(r!=null&&r.currentModelId))return;const i=r.availableModels.find(s=>s.modelId===r.currentModelId);console.info("[ACPClient] Current model:",(i==null?void 0:i.name)??r.currentModelId,`(${r.currentModelId})`)},qc=async function(){const t=f(this,I,Kv).call(this);if(l(this,jt)&&l(this,rr)===t){await l(this,jt);return}x(this,rr,t),x(this,jt,f(this,I,Wv).call(this,t)),await l(this,jt)},Wv=async function(t){var c;const r=f(this,I,ra).call(this);f(this,I,Jv).call(this);let i,s=!1,o=null;const a={cwd:f(this,I,Xv).call(this),mcpServers:[],_meta:{sessionKey:t}};try{if(x(this,ar,!0),x(this,Yt,null),((c=l(this,sr))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=l(this,or).getActualSessionId(t);if(u)try{const h=await r.loadSession({...a,sessionId:u});if(wD(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,or).setActualSessionId(t,i),s=!1}else{const h=await r.newSession(a);o=h,i=h.sessionId,l(this,or).setActualSessionId(t,i),s=!1}}else try{o=await r.loadSession({...a,sessionId:t}),i=t,s=l(this,ae).messageOrder.length>0}catch{const u=await r.newSession(a);o=u,i=u.sessionId,s=!1}}finally{x(this,ar,!1),x(this,Yt,null),f(this,I,Wn).call(this,"final")}f(this,I,Zv).call(this,o),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),x(this,ir,i),x(this,mn,t),s?(l(this,vn).add(t),l(this,gt)==="single_session"&&x(this,qt,!1)):(l(this,vn).delete(t),x(this,qt,l(this,gt)==="single_session")),f(this,I,Ve).call(this,{lifecycle:{status:"ready"}})},Hv=async function(t){const r=t.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&f(this,I,qv).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&f(this,I,Bv).call(this,r.content.text);return;case"tool_call":f(this,I,Gv).call(this,r);return;case"tool_call_update":f(this,I,jv).call(this,r);return;case"agent_thought_chunk":return;default:return}},Vv=async function(t){return{outcome:{outcome:"cancelled"}}},Bv=function(t){x(this,Yt,null);const r=SD(t);if(!r)return;if(!l(this,Pt)){const s={id:f(this,I,Vr).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};x(this,Pt,s.id),f(this,I,Wr).call(this,s);return}const i=l(this,ae).messagesById[l(this,Pt)];if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");f(this,I,Hr).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},Gv=function(t){f(this,I,Wn).call(this,"final");const r=f(this,I,Yc).call(this,t.toolCallId),i=uf("content"in t?t.content:void 0),s={id:(r==null?void 0:r.id)??f(this,I,Vr).call(this,"tool"),kind:"tool_call",toolCallId:t.toolCallId,title:t.title,toolKind:t.kind??"other",status:t.status==="failed"?"failed":t.status==="completed"?"completed":"in_progress",text:(r==null?void 0:r.text)??i,locations:t.locations??(r==null?void 0:r.locations)};if(r){f(this,I,Hr).call(this,s);return}f(this,I,Wr).call(this,s)},jv=function(t){const r=f(this,I,Yc).call(this,t.toolCallId),i=(r==null?void 0:r.text)??"",s=uf(t.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??f(this,I,Vr).call(this,"tool"),kind:"tool_call",toolCallId:t.toolCallId,title:(r==null?void 0:r.title)??t.toolCallId,toolKind:(r==null?void 0:r.toolKind)??"other",status:t.status==="failed"?"failed":t.status==="completed"?"completed":"in_progress",text:o,locations:t.locations??(r==null?void 0:r.locations)};if(r){f(this,I,Hr).call(this,a);return}f(this,I,Wr).call(this,a)},qv=function(t){if(f(this,I,Wn).call(this,"final"),!t)return;const r=l(this,ar)?l(this,Yt):null;if(!r){const s=cf(t);if(!s)return;const o={id:f(this,I,Vr).call(this,"user"),kind:"user",text:s,status:"final"};f(this,I,Wr).call(this,o),l(this,ar)&&x(this,Yt,o.id);return}const i=l(this,ae).messagesById[r];if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");f(this,I,Hr).call(this,{...i,text:cf(`${i.text}${t}`)})},Wn=function(t){if(!l(this,Pt))return;const r=l(this,ae).messagesById[l(this,Pt)];(r==null?void 0:r.kind)==="assistant"&&f(this,I,Hr).call(this,{...r,status:t}),x(this,Pt,null)},Wr=function(t){f(this,I,Ve).call(this,{messagesById:{...l(this,ae).messagesById,[t.id]:t},messageOrder:[...l(this,ae).messageOrder,t.id]})},Hr=function(t){f(this,I,Ve).call(this,{messagesById:{...l(this,ae).messagesById,[t.id]:t}})},Ve=function(t){const r={...l(this,ae),...t};x(this,ae,{...r,sendDisabled:r.lifecycle.status!=="ready"||r.run.status==="running"||r.run.status==="cancelling",cancelDisabled:!(r.run.status==="running"||r.run.status==="cancelling")||!r.run.canCancel}),this.dispatchEvent(new ie("change"))},Yv=function(t){const r=l(this,mn);return!l(this,Qe)||!r||!(l(this,gt)==="single_session"?l(this,qt)||!l(this,vn).has(r):!l(this,vn).has(r))?t:(x(this,qt,!1),l(this,vn).add(r),["[Television screen context]","This chat session is coming from a Television client in the screen below.",`screen_id: ${l(this,Qe).screenID}`,`screen_name: ${l(this,Qe).screenName??""}`,"When the user asks to inspect or change Television state with the tv CLI, use this screen ID with the --screen argument.","[/Television screen context]","",t].join(`
|
|
43
|
-
`))},Vr=function(t){const r=`${t}-${l(this,si)}`;return x(this,si,l(this,si)+1),r},Yc=function(t){for(const r of l(this,ae).messageOrder){const i=l(this,ae).messagesById[r];if((i==null?void 0:i.kind)==="tool_call"&&i.toolCallId===t)return i}return null},Xc=function(){if(!l(this,ir))throw new Error("ACP session is not ready");return l(this,ir)},ra=function(){if(!l(this,Gt))throw new Error("ACP connection is not ready");return l(this,Gt)},Xv=function(){var r;const t=(r=l(this,sr))==null?void 0:r.sessionCwd;if(!t)throw new Error("ACP bridge session cwd is not ready");return t},Kv=function(){var r;if(l(this,gt)==="single_session")return`${Nv}-${(l(this,Xt).clientGUID??"default-client").toLowerCase()}`;const t=(r=l(this,Qe))==null?void 0:r.screenID;if(!t)throw new Error("Screen context is required for per-screen session mode");return lf(l(this,gt),t,l(this,Xt).clientGUID??"default-client")},Is=new WeakMap,Ts=new WeakMap,Kc=function(){x(this,Gt,null),x(this,ii,null),x(this,jt,null),x(this,rr,null),x(this,ir,null),x(this,mn,null),x(this,sr,null),l(this,Kt)&&(l(this,Kt).removeEventListener("close",l(this,Is)),l(this,Kt).removeEventListener("error",l(this,Ts)),l(this,Kt).close(),x(this,Kt,null))},Br=function(t){this.disposed||l(this,ae).lifecycle.status==="disconnected"||(f(this,I,Wn).call(this,"error"),f(this,I,Kc).call(this),f(this,I,Ve).call(this,{lifecycle:{status:"disconnected",...t?{error:t}:{}},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null}))},Jv=function(){x(this,Pt,null),x(this,Yt,null),x(this,si,1),f(this,I,Ve).call(this,{run:{status:"idle",stopReason:null,canCancel:!1,error:null},messagesById:{},messageOrder:[]})},Qv=function(){return l(this,ae).lifecycle.status==="disconnected"};function yD(){const n=new Map;return{getActualSessionId(e){return n.get(e)??null},setActualSessionId(e,t){n.set(e,t)},clearActualSessionId(e){n.delete(e)}}}function bD(){return{lifecycle:{status:"connecting"},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null,messagesById:{},messageOrder:[],sendDisabled:!0,cancelDisabled:!0}}function wD(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function lf(n,e,t){return n==="single_session"?`${Nv}-${t.toLowerCase()}`:`agent:main:television-${t.toLowerCase()}-${e.toLowerCase()}`}function ey(n){return n.replace(/^(?:\s*\n)+/,"")}function cf(n){let e=n;return e=e.replace(uD,""),e=e.replace(hD,""),e=e.replace(dD,""),e=ey(e),e}function SD(n){let e=n;return e=e.replace(pD,""),e=ey(e),e}function uf(n){return!n||n.length===0?"":n.flatMap(e=>e.type==="content"&&e.content.type==="text"?[e.content.text]:[]).join("")}async function _D(n){const e=n.createSocket(xD(n.serverURL,n.token));let t=!1,r,i;const s=new Promise((u,h)=>{r=u,i=h}),o=new ReadableStream({start(u){let h=!1;const p=()=>{e.send(JSON.stringify({type:"acp-bridge-connect"}))},v=k=>{const T=ED(k);if(!T)return;let O;try{O=JSON.parse(T)}catch(P){const V=P instanceof Error?P:new Error(String(P));i(V),u.error(V);return}switch(O.type){case"acp-bridge-status":if(O.status==="ready"){let P;try{P=kD(O)}catch(V){const F=V instanceof Error?V:new Error(String(V));t||i(F),u.error(F);return}t||(t=!0,r(P));return}if(O.status==="error"||O.status==="exited"){const P=new Error(O.error??`ACP bridge ${O.status}`);t||i(P),u.error(P)}return;case"acp-bridge-message":u.enqueue(O.message);return}},m=()=>{var T;if(h)return;h=!0;const k=new Error("ACP bridge websocket closed");t||i(k),(T=n.onDisconnect)==null||T.call(n,k),u.close()},E=()=>{var T;if(h)return;h=!0;const k=new Error("ACP bridge websocket error");t||i(k),(T=n.onDisconnect)==null||T.call(n,k),u.error(k)};e.addEventListener("open",p),e.addEventListener("message",v),e.addEventListener("close",m),e.addEventListener("error",E)}}),a=new WritableStream({async write(u){await s,e.send(JSON.stringify({type:"acp-bridge-message",message:u}))},close(){e.close()},abort(){e.close()}}),c=await s;return{stream:{readable:o,writable:a},socket:e,metadata:c}}function kD(n){const{agent:e,sessionIdStrategy:t,sessionCwd:r}=n;if((e==="openclaw"||e==="hermes")&&(t==="deterministic"||t==="mapped")&&typeof r=="string"&&r.length>0)return{agent:e,sessionIdStrategy:t,sessionCwd:r};throw new Error("ACP bridge ready status missing bootstrap metadata")}function ED(n){if(typeof n=="string")return n;if(n instanceof Uint8Array)return new TextDecoder().decode(n);if(typeof Buffer<"u"&&n instanceof Buffer)return n.toString("utf8");if(typeof n=="object"&&n!==null&&"data"in n){const e=n.data;if(typeof e=="string")return e;if(e instanceof Uint8Array)return new TextDecoder().decode(e);if(Array.isArray(e))return Buffer.concat(e).toString("utf8")}return null}function xD(n,e){const t=new URL(n);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/acp",t.search="",t.searchParams.set("token",e),t.hash="",t.toString()}function Uo(n){return n instanceof Error?n.message:String(n)}const hf="television.acpClientGUID",df="television.acpMappedSessions",pf=1;var oi;class AD{constructor(){w(this,oi,new Map)}getActualSessionId(e){return l(this,oi).get(e)??null}setActualSessionId(e,t){l(this,oi).set(e,t)}clearActualSessionId(e){l(this,oi).delete(e)}}oi=new WeakMap;var ai,Cs,et,ia,sa,Jc;class $D{constructor(e,t){w(this,et);w(this,ai);w(this,Cs);x(this,ai,e),x(this,Cs,t)}getActualSessionId(e){const t=f(this,et,sa).call(this)[f(this,et,ia).call(this,e)];return typeof t=="string"&&t.length>0?t:null}setActualSessionId(e,t){const r=f(this,et,sa).call(this);r[f(this,et,ia).call(this,e)]=t,f(this,et,Jc).call(this,r)}clearActualSessionId(e){const t=f(this,et,sa).call(this);delete t[f(this,et,ia).call(this,e)],f(this,et,Jc).call(this,t)}}ai=new WeakMap,Cs=new WeakMap,et=new WeakSet,ia=function(e){return JSON.stringify([l(this,Cs),e])},sa=function(){const e=l(this,ai).getItem(df);if(!e)return{};let t;try{t=JSON.parse(e)}catch{return{}}if(typeof t!="object"||t===null||Array.isArray(t))return{};const r=t;return r.version!==pf?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},Jc=function(e){const t={version:pf,entries:e};l(this,ai).setItem(df,JSON.stringify(t))};function ID(){return typeof window>"u"?null:window.localStorage}function TD(n){const e=n.getItem(hf);if(e)return e;const t=al().toLowerCase();return n.setItem(hf,t),t}const CD=4401;class Qc extends Error{constructor(e="Authentication required"){super(e),this.name="AuthError"}}class ty extends Ot{constructor(t){super();b(this,"url");b(this,"name");b(this,"token");b(this,"status","disconnected");b(this,"screens",new Map);b(this,"views",[]);b(this,"client");b(this,"acpClient");b(this,"createSocket");b(this,"createClient");b(this,"socket",null);b(this,"connectAttempt",0);this.url=dt(t.url),this.name=t.name,this.token=t.token??null,this.createSocket=t.createSocket??(i=>new WebSocket(i)),this.createClient=t.createClient??((i,s)=>new qx(i,{token:s??void 0})),this.client=this.createClient(this.url,this.token);const r=t.mappedSessionStore??(t.acpStorage?new $D(t.acpStorage,this.url):new AD);this.acpClient=new vD({serverURL:this.url,token:this.token??"",...t.createACPSocket?{createSocket:t.createACPSocket}:t.createSocket?{createSocket:t.createSocket}:{},...t.clientGUID?{clientGUID:t.clientGUID}:{},mappedSessionStore:r})}async connect(){var i;this.connectAttempt+=1;const t=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this.token),this.status="connecting",this.dispatchEvent(new ie("change"));const r=this.createSocket(PD(this.url,this.token));return this.socket=r,await new Promise((s,o)=>{let a=!1;const c=()=>{a||this.connectAttempt!==t||(a=!0,this.status="connected",this.dispatchEvent(new ie("change")),s())},u=p=>{a||this.connectAttempt!==t||(a=!0,this.status="disconnected",this.dispatchEvent(new ie("change")),o(p))},h=async()=>{try{const[{screens:p},v]=await Promise.all([this.client.screens.list(),this.client.views.list()]);this.screens=new Map(p.map(m=>[m.id,structuredClone(m)])),this.views=v,this.dispatchEvent(new ie("change")),c()}catch(p){u(p instanceof Error?p:new Error(String(p)))}};r.addEventListener("open",()=>{h()}),r.addEventListener("message",p=>{const v=DD(p);v&&(this.applyServerEvent(v),this.dispatchEvent(new mm("server-event",{serverURL:this.url,event:v})))}),r.addEventListener("close",p=>{if(this.connectAttempt===t){if(this.socket=null,RD(p)===CD){u(new Qc);return}if(!a){u(new Error("Connection closed before initialization"));return}this.status="disconnected",this.dispatchEvent(new ie("change"))}}),r.addEventListener("error",()=>{u(new Error("WebSocket connection failed"))})})}disconnect(){var t;this.connectAttempt+=1,(t=this.socket)==null||t.close(),this.socket=null,this.status="disconnected",this.dispatchEvent(new ie("change"))}dispose(){this.disconnect(),this.acpClient.dispose()}getViewURL(t){const r=VT(t.type,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(t){const r=`${this.url}/artifacts/${encodeURIComponent(t)}/content`;return this.token===null?r:`${r}?token=${encodeURIComponent(this.token)}`}async createScreen(t){const{screen:r}=await this.client.screens.create({name:t});return this.screens.set(r.id,structuredClone(r)),r}applyServerEvent(t){switch(t.type){case"screen-created":this.screens.set(t.screen.id,structuredClone(t.screen)),this.dispatchEvent(new ta("screens-changed"));break;case"screen-updated":this.screens.set(t.screen.id,structuredClone(t.screen)),this.dispatchEvent(new ta("screens-changed"));break;case"screen-removed":this.screens.delete(t.screenID),this.dispatchEvent(new ta("screens-changed"));break;case"artifact-created":break;case"artifact-attached":{const r=this.screens.get(t.screenID);r&&!pm(r.layout,t.artifact.id)&&(r.layout=[...r.layout,dm(t.artifact.id,{id:t.cardID})]);break}case"artifact-removed":{const r=this.screens.get(t.screenID);r&&(r.layout=rm(r.layout,t.artifactID));break}}}}function PD(n,e){const t=new URL(n);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/events",t.search="",e&&t.searchParams.set("token",e),t.hash="",t.toString()}function RD(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}function DD(n){const e=typeof n=="string"?n:typeof n=="object"&&n!==null&&"data"in n&&typeof n.data=="string"?n.data:"";if(!e)return null;try{return JSON.parse(e)}catch{return null}}const LD="Local";var Ps,eu;class zD extends Ot{constructor(t){super();w(this,Ps);b(this,"servers",new Map);b(this,"localServerURL");b(this,"clientGUID");b(this,"acpStorage");b(this,"localStore");b(this,"createSocket");b(this,"lastActiveServerURL");b(this,"serverListeners",new Map);b(this,"handleLocalStoreChange",()=>{const t=this.localStore.get().activeServerURL;t!==this.lastActiveServerURL&&(this.lastActiveServerURL=t,this.dispatchEvent(new ie("change")))});this.localStore=t.localStore,this.localServerURL=t.localServerURL?dt(t.localServerURL):null,this.createSocket=t.createSocket??(i=>new WebSocket(i)),this.lastActiveServerURL=this.localStore.get().activeServerURL;const r=t.acpStorage===void 0?ID():t.acpStorage;this.acpStorage=r,this.clientGUID=t.clientGUID??(r?TD(r):al().toLowerCase()),this.localStore.addEventListener("change",this.handleLocalStoreChange)}get activeServer(){const t=this.localStore.get().activeServerURL;return t===null?null:this.servers.get(t)??null}add(t){const r=dt(t.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,t);const s=()=>{this.dispatchEvent(new ie("change"))},o=c=>{this.dispatchEvent(new mm("server-event",{serverURL:c.serverURL,event:c.event}))},a=()=>{this.dispatchEvent(new ta("screens-changed"))};t.addEventListener("change",s),t.addEventListener("server-event",o),t.addEventListener("screens-changed",a),this.serverListeners.set(r,{onServerChange:s,onServerEvent:o,onScreensChanged:a}),this.dispatchEvent(new ie("change"))}remove(t){const r=dt(t);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 ie("change"))}setActive(t){const r=this.localStore.get(),i=t?dt(t.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(t,r){const i=t?dt(t):null;if(i){const a=this.localStore.get();a.servers.some(u=>dt(u.url)===i)||this.localStore.set({...a,servers:[...a.servers,{url:i,name:LD}]})}const s=this.localStore.get().servers;for(const a of s){const c=dt(a.url),u=i!==null&&c===i,h=f(this,Ps,eu).call(this,{url:a.url,name:a.name,token:u?r??null:null});this.add(h),h.connect().catch(()=>{})}const o=i?this.servers.get(i)??null:null;this.setActive(o??this.servers.values().next().value??null)}addServer(t,r){const i=dt(t);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>dt(a.url)!==i),{url:i,name:r}]});const o=f(this,Ps,eu).call(this,{url:i,name:r,token:null});this.add(o),this.setActive(o),o.connect().catch(()=>{})}removeServer(t){this.remove(t)}}Ps=new WeakSet,eu=function(t){return new ty({url:t.url,name:t.name,token:t.token,createSocket:this.createSocket,clientGUID:this.clientGUID,acpStorage:this.acpStorage})};var Rs;class OD extends Ot{constructor(){super();w(this,Rs,t=>{const r=MD(t);r!==null&&(t.preventDefault(),this.dispatchEvent(new mx("shortcut-triggered",{shortcut:r})))});document.addEventListener("keydown",l(this,Rs))}dispose(){document.removeEventListener("keydown",l(this,Rs))}}Rs=new WeakMap;function MD(n){for(const[e,t]of Object.entries(Yx))if(ND(n,t.trigger))return e;return null}function ND(n,e){return!(n.key.toLowerCase()!==e.key.toLowerCase()||n.metaKey!==!!e.meta||n.ctrlKey!==!!e.ctrl||n.shiftKey!==!!e.shift||n.altKey!==!!e.alt)}const UD="serverURL",FD="token",ZD="mode",WD="electron";function ny(n=window.location.search,e=window.location.origin){const r=new URLSearchParams(n).get(UD);return r?new URL(r).origin:new URL(e).origin}function ff(n=window.location.search){return new URLSearchParams(n).get(FD)}function bh(n=window.location.search){return new URLSearchParams(n).get(ZD)===WD}/**
|
|
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(e===h[0]){s(h);continue}if(n.external){const m=(c=n.external.registry.get(h[0]))==null?void 0:c.id;if(e!==h[0]&&m){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 Ym(n,e){var o,a,c;const t=n.seen.get(e);if(!t)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},m=h.ref;if(h.ref=null,m){r(m);const E=n.seen.get(m),T=E.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===m)for(const P in p)P==="$ref"||P==="allOf"||P in v||delete p[P];if(T.$ref&&E.def)for(const P in p)P==="$ref"||P==="allOf"||P in E.def&&JSON.stringify(p[P])===JSON.stringify(E.def[P])&&delete p[P]}const x=u._zod.parent;if(x&&x!==m){r(x);const E=n.seen.get(x);if(E!=null&&E.schema.$ref&&(p.$ref=E.schema.$ref,E.def))for(const T in p)T==="$ref"||T==="allOf"||T in E.def&&JSON.stringify(p[T])===JSON.stringify(E.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(e))==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,t.def??t.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:{...e["~standard"],jsonSchema:{input:Ea(e,"input",n.processors),output:Ea(e,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Me(n,e){const t=e??{seen:new Set};if(t.seen.has(n))return!1;t.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Me(r.element,t);if(r.type==="set")return Me(r.valueType,t);if(r.type==="lazy")return Me(r.getter(),t);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Me(r.innerType,t);if(r.type==="intersection")return Me(r.left,t)||Me(r.right,t);if(r.type==="record"||r.type==="map")return Me(r.keyType,t)||Me(r.valueType,t);if(r.type==="pipe")return Me(r.in,t)||Me(r.out,t);if(r.type==="object"){for(const i in r.shape)if(Me(r.shape[i],t))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Me(i,t))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Me(i,t))return!0;return!!(r.rest&&Me(r.rest,t))}return!1}const rI=(n,e={})=>t=>{const r=jm({...t,processors:e});return _e(n,r),qm(r,n),Ym(r,n)},Ea=(n,e,t={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=jm({...i??{},target:s,io:e,processors:t});return _e(n,o),qm(o,n),Ym(o,n)},iI={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},sI=(n,e,t,r)=>{const i=t;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=iI[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=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},oI=(n,e,t,r)=>{const i=t,{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"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h),typeof s=="number"&&(i.minimum=s,typeof h=="number"&&e.target!=="draft-04"&&(h>=s?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof o=="number"&&(i.maximum=o,typeof u=="number"&&e.target!=="draft-04"&&(u<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},aI=(n,e,t,r)=>{t.type="boolean"},lI=(n,e,t,r)=>{t.not={}},cI=(n,e,t,r)=>{},uI=(n,e,t,r)=>{const i=n._zod.def,s=$m(i.entries);s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),t.enum=s},hI=(n,e,t,r)=>{const i=n._zod.def,s=[];for(const o of i.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){const o=s[0];t.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[o]:t.const=o}else s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),s.every(o=>typeof o=="boolean")&&(t.type="boolean"),s.every(o=>o===null)&&(t.type="null"),t.enum=s},dI=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},pI=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},fI=(n,e,t,r)=>{const i=t,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=_e(s.element,e,{...r,path:[...r.path,"items"]})},gI=(n,e,t,r)=>{var u;const i=t,s=n._zod.def;i.type="object",i.properties={};const o=s.shape;for(const h in o)i.properties[h]=_e(o[h],e,{...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 e.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=_e(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},mI=(n,e,t,r)=>{const i=n._zod.def,s=i.inclusive===!1,o=i.options.map((a,c)=>_e(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?t.oneOf=o:t.anyOf=o},vI=(n,e,t,r)=>{const i=n._zod.def,s=_e(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=_e(i.right,e,{...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]];t.allOf=c},yI=(n,e,t,r)=>{const i=t,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=_e(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const p of c)i.patternProperties[p.source]=h}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=_e(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=_e(s.valueType,e,{...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)}},bI=(n,e,t,r)=>{const i=n._zod.def,s=_e(i.innerType,e,r),o=e.seen.get(n);e.target==="openapi-3.0"?(o.ref=i.innerType,t.nullable=!0):t.anyOf=[s,{type:"null"}]},wI=(n,e,t,r)=>{const i=n._zod.def;_e(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},SI=(n,e,t,r)=>{const i=n._zod.def;_e(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.default=JSON.parse(JSON.stringify(i.defaultValue))},_I=(n,e,t,r)=>{const i=n._zod.def;_e(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,e.io==="input"&&(t._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},kI=(n,e,t,r)=>{const i=n._zod.def;_e(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=o},EI=(n,e,t,r)=>{const i=n._zod.def,s=e.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;_e(s,e,r);const o=e.seen.get(n);o.ref=s},xI=(n,e,t,r)=>{const i=n._zod.def;_e(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.readOnly=!0},Xm=(n,e,t,r)=>{const i=n._zod.def;_e(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},AI=A("ZodISODateTime",(n,e)=>{$A.init(n,e),me.init(n,e)});function $I(n){return D$(AI,n)}const II=A("ZodISODate",(n,e)=>{IA.init(n,e),me.init(n,e)});function TI(n){return L$(II,n)}const CI=A("ZodISOTime",(n,e)=>{TA.init(n,e),me.init(n,e)});function PI(n){return z$(CI,n)}const RI=A("ZodISODuration",(n,e)=>{CA.init(n,e),me.init(n,e)});function DI(n){return O$(RI,n)}const Km=(n,e)=>{Pm.init(n,e),n.name="ZodError",Object.defineProperties(n,{format:{value:t=>w1(n,t)},flatten:{value:t=>b1(n,t)},addIssue:{value:t=>{n.issues.push(t),n.message=JSON.stringify(n.issues,Vc,2)}},addIssues:{value:t=>{n.issues.push(...t),n.message=JSON.stringify(n.issues,Vc,2)}},isEmpty:{get(){return n.issues.length===0}}})},nf=A("ZodError",Km),ht=A("ZodError",Km,{Parent:Error}),LI=fh(ht),zI=gh(ht),OI=cl(ht),MI=ul(ht),NI=k1(ht),UI=E1(ht),FI=x1(ht),ZI=A1(ht),WI=$1(ht),HI=I1(ht),VI=T1(ht),BI=C1(ht),ge=A("ZodType",(n,e)=>(fe.init(n,e),Object.assign(n["~standard"],{jsonSchema:{input:Ea(n,"input"),output:Ea(n,"output")}}),n.toJSONSchema=rI(n,{}),n.def=e,n.type=e.type,Object.defineProperty(n,"_def",{value:e}),n.check=(...t)=>n.clone(Dn(e,{checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),n.with=n.check,n.clone=(t,r)=>Ln(n,t,r),n.brand=()=>n,n.register=(t,r)=>(t.add(n,r),n),n.parse=(t,r)=>LI(n,t,r,{callee:n.parse}),n.safeParse=(t,r)=>OI(n,t,r),n.parseAsync=async(t,r)=>zI(n,t,r,{callee:n.parseAsync}),n.safeParseAsync=async(t,r)=>MI(n,t,r),n.spa=n.safeParseAsync,n.encode=(t,r)=>NI(n,t,r),n.decode=(t,r)=>UI(n,t,r),n.encodeAsync=async(t,r)=>FI(n,t,r),n.decodeAsync=async(t,r)=>ZI(n,t,r),n.safeEncode=(t,r)=>WI(n,t,r),n.safeDecode=(t,r)=>HI(n,t,r),n.safeEncodeAsync=async(t,r)=>VI(n,t,r),n.safeDecodeAsync=async(t,r)=>BI(n,t,r),n.refine=(t,r)=>n.check(OT(t,r)),n.superRefine=t=>n.check(MT(t)),n.overwrite=t=>n.check(zi(t)),n.optional=()=>of(n),n.exactOptional=()=>kT(n),n.nullable=()=>af(n),n.nullish=()=>of(af(n)),n.nonoptional=t=>TT(n,t),n.array=()=>D(n),n.or=t=>G([n,t]),n.and=t=>dl(n,t),n.transform=t=>lf(n,ST(t)),n.default=t=>AT(n,t),n.prefault=t=>IT(n,t),n.catch=t=>PT(n,t),n.pipe=t=>lf(n,t),n.readonly=()=>LT(n),n.describe=t=>{const r=n.clone();return es.add(r,{description:t}),r},Object.defineProperty(n,"description",{get(){var t;return(t=es.get(n))==null?void 0:t.description},configurable:!0}),n.meta=(...t)=>{if(t.length===0)return es.get(n);const r=n.clone();return es.add(r,t[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=t=>t(n),n)),Jm=A("_ZodString",(n,e)=>{mh.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(r,i,s)=>sI(n,r,i);const t=n._zod.bag;n.format=t.format??null,n.minLength=t.minimum??null,n.maxLength=t.maximum??null,n.regex=(...r)=>n.check(W$(...r)),n.includes=(...r)=>n.check(B$(...r)),n.startsWith=(...r)=>n.check(G$(...r)),n.endsWith=(...r)=>n.check(j$(...r)),n.min=(...r)=>n.check(ka(...r)),n.max=(...r)=>n.check(Bm(...r)),n.length=(...r)=>n.check(Gm(...r)),n.nonempty=(...r)=>n.check(ka(1,...r)),n.lowercase=r=>n.check(H$(r)),n.uppercase=r=>n.check(V$(r)),n.trim=()=>n.check(Y$()),n.normalize=(...r)=>n.check(q$(...r)),n.toLowerCase=()=>n.check(X$()),n.toUpperCase=()=>n.check(K$()),n.slugify=()=>n.check(J$())}),GI=A("ZodString",(n,e)=>{mh.init(n,e),Jm.init(n,e),n.email=t=>n.check(d$(jI,t)),n.url=t=>n.check(v$(qI,t)),n.jwt=t=>n.check(R$(cT,t)),n.emoji=t=>n.check(y$(YI,t)),n.guid=t=>n.check(Jp(rf,t)),n.uuid=t=>n.check(p$(Uo,t)),n.uuidv4=t=>n.check(f$(Uo,t)),n.uuidv6=t=>n.check(g$(Uo,t)),n.uuidv7=t=>n.check(m$(Uo,t)),n.nanoid=t=>n.check(b$(XI,t)),n.guid=t=>n.check(Jp(rf,t)),n.cuid=t=>n.check(w$(KI,t)),n.cuid2=t=>n.check(S$(JI,t)),n.ulid=t=>n.check(_$(QI,t)),n.base64=t=>n.check(T$(oT,t)),n.base64url=t=>n.check(C$(aT,t)),n.xid=t=>n.check(k$(eT,t)),n.ksuid=t=>n.check(E$(tT,t)),n.ipv4=t=>n.check(x$(nT,t)),n.ipv6=t=>n.check(A$(rT,t)),n.cidrv4=t=>n.check($$(iT,t)),n.cidrv6=t=>n.check(I$(sT,t)),n.e164=t=>n.check(P$(lT,t)),n.datetime=t=>n.check($I(t)),n.date=t=>n.check(TI(t)),n.time=t=>n.check(PI(t)),n.duration=t=>n.check(DI(t))});function d(n){return h$(GI,n)}const me=A("ZodStringFormat",(n,e)=>{de.init(n,e),Jm.init(n,e)}),jI=A("ZodEmail",(n,e)=>{yA.init(n,e),me.init(n,e)}),rf=A("ZodGUID",(n,e)=>{mA.init(n,e),me.init(n,e)}),Uo=A("ZodUUID",(n,e)=>{vA.init(n,e),me.init(n,e)}),qI=A("ZodURL",(n,e)=>{bA.init(n,e),me.init(n,e)}),YI=A("ZodEmoji",(n,e)=>{wA.init(n,e),me.init(n,e)}),XI=A("ZodNanoID",(n,e)=>{SA.init(n,e),me.init(n,e)}),KI=A("ZodCUID",(n,e)=>{_A.init(n,e),me.init(n,e)}),JI=A("ZodCUID2",(n,e)=>{kA.init(n,e),me.init(n,e)}),QI=A("ZodULID",(n,e)=>{EA.init(n,e),me.init(n,e)}),eT=A("ZodXID",(n,e)=>{xA.init(n,e),me.init(n,e)}),tT=A("ZodKSUID",(n,e)=>{AA.init(n,e),me.init(n,e)}),nT=A("ZodIPv4",(n,e)=>{PA.init(n,e),me.init(n,e)}),rT=A("ZodIPv6",(n,e)=>{RA.init(n,e),me.init(n,e)}),iT=A("ZodCIDRv4",(n,e)=>{DA.init(n,e),me.init(n,e)}),sT=A("ZodCIDRv6",(n,e)=>{LA.init(n,e),me.init(n,e)}),oT=A("ZodBase64",(n,e)=>{zA.init(n,e),me.init(n,e)}),aT=A("ZodBase64URL",(n,e)=>{MA.init(n,e),me.init(n,e)}),lT=A("ZodE164",(n,e)=>{NA.init(n,e),me.init(n,e)}),cT=A("ZodJWT",(n,e)=>{FA.init(n,e),me.init(n,e)}),Qm=A("ZodNumber",(n,e)=>{Zm.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(r,i,s)=>oI(n,r,i),n.gt=(r,i)=>n.check(ef(r,i)),n.gte=(r,i)=>n.check(uc(r,i)),n.min=(r,i)=>n.check(uc(r,i)),n.lt=(r,i)=>n.check(Qp(r,i)),n.lte=(r,i)=>n.check(cc(r,i)),n.max=(r,i)=>n.check(cc(r,i)),n.int=r=>n.check(sf(r)),n.safe=r=>n.check(sf(r)),n.positive=r=>n.check(ef(0,r)),n.nonnegative=r=>n.check(uc(0,r)),n.negative=r=>n.check(Qp(0,r)),n.nonpositive=r=>n.check(cc(0,r)),n.multipleOf=(r,i)=>n.check(tf(r,i)),n.step=(r,i)=>n.check(tf(r,i)),n.finite=()=>n;const t=n._zod.bag;n.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),n.isFinite=!0,n.format=t.format??null});function W(n){return M$(Qm,n)}const uT=A("ZodNumberFormat",(n,e)=>{ZA.init(n,e),Qm.init(n,e)});function sf(n){return N$(uT,n)}const hT=A("ZodBoolean",(n,e)=>{WA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>aI(n,t,r)});function Te(n){return U$(hT,n)}const dT=A("ZodUnknown",(n,e)=>{HA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>cI()});function S(){return F$(dT)}const pT=A("ZodNever",(n,e)=>{VA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>lI(n,t,r)});function fT(n){return Z$(pT,n)}const gT=A("ZodArray",(n,e)=>{BA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>fI(n,t,r,i),n.element=e.element,n.min=(t,r)=>n.check(ka(t,r)),n.nonempty=t=>n.check(ka(1,t)),n.max=(t,r)=>n.check(Bm(t,r)),n.length=(t,r)=>n.check(Gm(t,r)),n.unwrap=()=>n.element});function D(n,e){return Q$(gT,n,e)}const ev=A("ZodObject",(n,e)=>{jA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>gI(n,t,r,i),oe(n,"shape",()=>e.shape),n.keyof=()=>xa(Object.keys(n._zod.def.shape)),n.catchall=t=>n.clone({...n._zod.def,catchall:t}),n.passthrough=()=>n.clone({...n._zod.def,catchall:S()}),n.loose=()=>n.clone({...n._zod.def,catchall:S()}),n.strict=()=>n.clone({...n._zod.def,catchall:fT()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=t=>f1(n,t),n.safeExtend=t=>g1(n,t),n.merge=t=>m1(n,t),n.pick=t=>d1(n,t),n.omit=t=>p1(n,t),n.partial=(...t)=>v1(nv,n,t[0]),n.required=(...t)=>y1(rv,n,t[0])});function tv(n,e){const t={type:"object",shape:n??{},...z(e)};return new ev(t)}function g(n,e){return new ev({type:"object",shape:n,catchall:S(),...z(e)})}const mT=A("ZodUnion",(n,e)=>{qA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>mI(n,t,r,i),n.options=e.options});function G(n,e){return new mT({type:"union",options:n,...z(e)})}const vT=A("ZodIntersection",(n,e)=>{YA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>vI(n,t,r,i)});function dl(n,e){return new vT({type:"intersection",left:n,right:e})}const yT=A("ZodRecord",(n,e)=>{XA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>yI(n,t,r,i),n.keyType=e.keyType,n.valueType=e.valueType});function _(n,e,t){return new yT({type:"record",keyType:n,valueType:e,...z(t)})}const Gc=A("ZodEnum",(n,e)=>{KA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(r,i,s)=>uI(n,r,i),n.enum=e.entries,n.options=Object.values(e.entries);const t=new Set(Object.keys(e.entries));n.extract=(r,i)=>{const s={};for(const o of r)if(t.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Gc({...e,checks:[],...z(i),entries:s})},n.exclude=(r,i)=>{const s={...e.entries};for(const o of r)if(t.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new Gc({...e,checks:[],...z(i),entries:s})}});function xa(n,e){const t=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new Gc({type:"enum",entries:t,...z(e)})}const bT=A("ZodLiteral",(n,e)=>{JA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>hI(n,t,r),n.values=new Set(e.values),Object.defineProperty(n,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function $(n,e){return new bT({type:"literal",values:Array.isArray(n)?n:[n],...z(e)})}const wT=A("ZodTransform",(n,e)=>{QA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>pI(n,t),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new xm(n.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(fs(s,t.value,e));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),t.issues.push(fs(o))}};const i=e.transform(t.value,t);return i instanceof Promise?i.then(s=>(t.value=s,t)):(t.value=i,t)}});function ST(n){return new wT({type:"transform",transform:n})}const nv=A("ZodOptional",(n,e)=>{Vm.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Xm(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function of(n){return new nv({type:"optional",innerType:n})}const _T=A("ZodExactOptional",(n,e)=>{e$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Xm(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function kT(n){return new _T({type:"optional",innerType:n})}const ET=A("ZodNullable",(n,e)=>{t$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>bI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function af(n){return new ET({type:"nullable",innerType:n})}const xT=A("ZodDefault",(n,e)=>{n$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>SI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function AT(n,e){return new xT({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():Tm(e)}})}const $T=A("ZodPrefault",(n,e)=>{r$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>_I(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function IT(n,e){return new $T({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():Tm(e)}})}const rv=A("ZodNonOptional",(n,e)=>{i$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>wI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function TT(n,e){return new rv({type:"nonoptional",innerType:n,...z(e)})}const CT=A("ZodCatch",(n,e)=>{s$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>kI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function PT(n,e){return new CT({type:"catch",innerType:n,catchValue:typeof e=="function"?e:()=>e})}const RT=A("ZodPipe",(n,e)=>{o$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>EI(n,t,r,i),n.in=e.in,n.out=e.out});function lf(n,e){return new RT({type:"pipe",in:n,out:e})}const DT=A("ZodReadonly",(n,e)=>{a$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>xI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function LT(n){return new DT({type:"readonly",innerType:n})}const zT=A("ZodCustom",(n,e)=>{l$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>dI(n,t)});function OT(n,e={}){return eI(zT,n,e)}function MT(n){return tI(n)}const hc={custom:"custom"},NT=["text/markdown","text/html"],UT=["committed","pending"];function FT(n){let e;try{e=new URL(n)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}tv({id:d().min(1),type:xa(NT),title:d(),status:xa(UT),externalFilePath:d().optional(),externalURL:d().optional()}).superRefine((n,e)=>{n.externalFilePath!==void 0&&n.externalURL!==void 0&&e.addIssue({code:hc.custom,message:"externalFilePath and externalURL are mutually exclusive",path:["externalURL"]}),n.externalURL!==void 0&&(FT(n.externalURL)||e.addIssue({code:hc.custom,message:"externalURL must be an http(s) URL",path:["externalURL"]}),n.status!=="committed"&&e.addIssue({code:hc.custom,message:"URL-backed artifacts must have status committed",path:["status"]}))});tv({name:d().min(1),description:d(),accepts:D(d().min(1)).min(1)});function iv(n){return typeof n=="object"&&n!==null}function ZT(n){return!iv(n)||n.type!=="ready"?!1:!("id"in n)}function WT(n){return!(!iv(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}function HT(n,e){if(n===e)return 2;if(n==="*/*")return 0;const t=n.indexOf("/");if(t>0&&n.slice(t+1)==="*"){const r=n.slice(0,t),i=e.indexOf("/");if(i>0&&e.slice(0,i)===r)return 1}return null}function VT(n,e){let t=null;for(const r of n.accepts){const i=HT(r,e);i!==null&&(t===null||i>t)&&(t=i)}return t}function BT(n,e){let t=-1,r=null;for(const i of e){const s=VT(i,n);s!==null&&(s>t||s===t&&r!==null&&i.id<r.id)&&(t=s,r=i)}return r}const he={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"},Wt={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"},GT=1,jT=g({_meta:_(d(),S()).nullish(),terminal:Te().optional().default(!1)}),qT=g({_meta:_(d(),S()).nullish(),label:d().nullish(),name:d(),optional:Te().optional().default(!1),secret:Te().optional().default(!0)}),YT=g({_meta:_(d(),S()).nullish(),description:d().nullish(),id:d(),name:d()}),XT=g({_meta:_(d(),S()).nullish(),description:d().nullish(),id:d(),link:d().nullish(),name:d(),vars:D(qT)}),KT=g({_meta:_(d(),S()).nullish(),args:D(d()).optional(),description:d().nullish(),env:_(d(),d()).optional(),id:d(),name:d()}),JT=G([XT.and(g({type:$("env_var")})),KT.and(g({type:$("terminal")})),YT]),QT=g({_meta:_(d(),S()).nullish(),methodId:d()}),eC=g({_meta:_(d(),S()).nullish()}),tC=g({_meta:_(d(),S()).nullish(),blob:d(),mimeType:d().nullish(),uri:d()}),nC=g({default:Te().nullish(),description:d().nullish(),title:d().nullish()}),rC=g({_meta:_(d(),S()).nullish()}),iC=g({_meta:_(d(),S()).nullish()}),sC=g({amount:W(),currency:d()}),oC=g({_meta:_(d(),S()).nullish(),terminalId:d()}),aC=g({_meta:_(d(),S()).nullish(),newText:d(),oldText:d().nullish(),path:d()}),lC=G([d(),W(),W(),Te(),D(d())]),cC=g({content:_(d(),lC).nullish()}),uC=G([cC.and(g({action:$("accept")})),g({action:$("decline")}),g({action:$("cancel")})]),hC=g({_meta:_(d(),S()).nullish()}),sv=d(),dC=g({_meta:_(d(),S()).nullish(),elicitationId:sv}),pC=g({_meta:_(d(),S()).nullish(),action:uC}),fC=$("object"),gC=$("string"),mC=g({_meta:_(d(),S()).nullish()}),vC=g({_meta:_(d(),S()).nullish(),form:hC.nullish(),url:mC.nullish()}),yC=g({elicitationId:sv,url:d().url()}),ov=g({const:d(),title:d()}),av=g({_meta:_(d(),S()).nullish(),name:d(),value:d()}),bC=G([$(-32700),$(-32600),$(-32601),$(-32602),$(-32603),$(-32800),$(-32e3),$(-32002),$(-32042),W().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),lv=g({code:bC,data:S().optional(),message:d()}),cv=S(),uv=S(),hv=S(),wC=g({_meta:_(d(),S()).nullish(),readTextFile:Te().optional().default(!1),writeTextFile:Te().optional().default(!1)}),dv=g({_meta:_(d(),S()).nullish(),name:d(),value:d()}),pv=g({_meta:_(d(),S()).nullish(),name:d(),title:d().nullish(),version:d()}),SC=g({default:W().nullish(),description:d().nullish(),maximum:W().nullish(),minimum:W().nullish(),title:d().nullish()}),_C=g({_meta:_(d(),S()).nullish()}),kC=g({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cursor:d().nullish(),cwd:d().nullish()}),EC=g({_meta:_(d(),S()).nullish()}),xC=g({_meta:_(d(),S()).nullish(),logout:EC.nullish()}),AC=g({_meta:_(d(),S()).nullish()}),$C=g({_meta:_(d(),S()).nullish()}),IC=g({_meta:_(d(),S()).nullish(),http:Te().optional().default(!1),sse:Te().optional().default(!1)}),TC=g({_meta:_(d(),S()).nullish(),headers:D(dv),name:d(),url:d()}),CC=g({_meta:_(d(),S()).nullish(),headers:D(dv),name:d(),url:d()}),PC=g({_meta:_(d(),S()).nullish(),args:D(d()),command:d(),env:D(av),name:d()}),pl=G([TC.and(g({type:$("http")})),CC.and(g({type:$("sse")})),PC]),vh=d(),RC=g({_meta:_(d(),S()).nullish(),description:d().nullish(),modelId:vh,name:d()}),DC=G([$("error"),$("warning"),$("information"),$("hint")]),LC=g({_meta:_(d(),S()).nullish()}),zC=g({_meta:_(d(),S()).nullish()}),OC=g({_meta:_(d(),S()).nullish()}),MC=g({_meta:_(d(),S()).nullish()}),NC=g({_meta:_(d(),S()).nullish()}),UC=g({_meta:_(d(),S()).nullish(),maxCount:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),FC=g({diff:d(),uri:d()}),ZC=g({endLine:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:d()}),WC=g({_meta:_(d(),S()).nullish()}),HC=g({_meta:_(d(),S()).nullish()}),VC=g({languageId:d(),text:d(),uri:d()}),BC=g({_meta:_(d(),S()).nullish(),maxCount:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),GC=G([$("rejected"),$("ignored"),$("replaced"),$("cancelled")]),jC=g({excerpts:D(ZC),uri:d()}),qC=g({_meta:_(d(),S()).nullish()}),YC=g({_meta:_(d(),S()).nullish()}),XC=g({name:d(),owner:d(),remoteUrl:d()}),KC=g({_meta:_(d(),S()).nullish()}),JC=g({_meta:_(d(),S()).nullish(),jump:WC.nullish(),rename:YC.nullish(),searchAndReplace:KC.nullish()}),QC=g({id:d(),isRegex:Te().nullish(),replace:d(),search:d(),uri:d()}),eP=G([$("automatic"),$("diagnostic"),$("manual")]),tP=g({_meta:_(d(),S()).nullish(),maxCount:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),nP=g({_meta:_(d(),S()).nullish(),diagnostics:LC.nullish(),editHistory:UC.nullish(),openFiles:HC.nullish(),recentFiles:BC.nullish(),relatedSnippets:qC.nullish(),userActions:tP.nullish()}),rP=g({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(pl)}),iP=g({default:W().nullish(),description:d().nullish(),maximum:W().nullish(),minimum:W().nullish(),title:d().nullish()}),fv=d(),sP=G([$("allow_once"),$("allow_always"),$("reject_once"),$("reject_always")]),oP=g({_meta:_(d(),S()).nullish(),kind:sP,name:d(),optionId:fv}),aP=G([$("high"),$("medium"),$("low")]),lP=G([$("pending"),$("in_progress"),$("completed")]),cP=g({_meta:_(d(),S()).nullish(),content:d(),priority:aP,status:lP}),uP=g({_meta:_(d(),S()).nullish(),entries:D(cP)}),Tn=g({character:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),hP=g({id:d(),position:Tn,uri:d()}),dP=g({id:d(),newName:d(),position:Tn,uri:d()}),pP=g({action:d(),position:Tn,timestampMs:W(),uri:d()}),gv=G([$("utf-16"),$("utf-32"),$("utf-8")]),fP=g({_meta:_(d(),S()).nullish(),auth:jT.optional().default({terminal:!1}),elicitation:vC.nullish(),fs:wC.optional().default({readTextFile:!1,writeTextFile:!1}),nes:JC.nullish(),positionEncodings:D(gv).optional(),terminal:Te().optional().default(!1)}),gP=g({_meta:_(d(),S()).nullish(),audio:Te().optional().default(!1),embeddedContext:Te().optional().default(!1),image:Te().optional().default(!1)}),mv=W().int().gte(0).lte(65535),mP=g({_meta:_(d(),S()).nullish(),clientCapabilities:fP.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:pv.nullish(),protocolVersion:mv}),Oi=g({end:Tn,start:Tn}),vP=g({message:d(),range:Oi,severity:DC,uri:d()}),yP=g({languageId:d(),lastFocusedMs:W().nullish(),uri:d(),visibleRange:Oi.nullish()}),bP=g({_meta:_(d(),S()).nullish(),diagnostics:D(vP).nullish(),editHistory:D(FC).nullish(),openFiles:D(yP).nullish(),recentFiles:D(VC).nullish(),relatedSnippets:D(jC).nullish(),userActions:D(pP).nullish()}),wP=g({newText:d(),range:Oi}),SP=g({cursorPosition:Tn.nullish(),edits:D(wP),id:d(),uri:d()}),_P=G([SP.and(g({kind:$("edit")})),hP.and(g({kind:$("jump")})),dP.and(g({kind:$("rename")})),QC.and(g({kind:$("searchAndReplace")}))]),kP=g({_meta:_(d(),S()).nullish(),content:d()}),EP=g({_meta:_(d(),S()).nullish()}),wr=G([W(),d()]).nullable();g({_meta:_(d(),S()).nullish(),requestId:wr});const xP=xa(["assistant","user"]),yo=g({_meta:_(d(),S()).nullish(),audience:D(xP).nullish(),lastModified:d().nullish(),priority:W().nullish()}),AP=g({_meta:_(d(),S()).nullish(),annotations:yo.nullish(),data:d(),mimeType:d()}),$P=g({_meta:_(d(),S()).nullish(),annotations:yo.nullish(),data:d(),mimeType:d(),uri:d().nullish()}),IP=g({_meta:_(d(),S()).nullish(),annotations:yo.nullish(),description:d().nullish(),mimeType:d().nullish(),name:d(),size:W().nullish(),title:d().nullish(),uri:d()}),TP=g({_meta:_(d(),S()).nullish(),optionId:fv}),CP=G([g({outcome:$("cancelled")}),TP.and(g({outcome:$("selected")}))]),PP=g({_meta:_(d(),S()).nullish(),outcome:CP}),RP=g({_meta:_(d(),S()).nullish()}),DP=g({_meta:_(d(),S()).nullish()}),LP=g({currentValue:Te()}),zP=d(),vv=d(),OP=G([$("mode"),$("model"),$("thought_level"),d()]),yh=d(),yv=g({_meta:_(d(),S()).nullish(),description:d().nullish(),name:d(),value:yh}),MP=g({_meta:_(d(),S()).nullish(),group:zP,name:d(),options:D(yv)}),NP=G([D(yv),D(MP)]),UP=g({currentValue:yh,options:NP}),Mi=dl(G([UP.and(g({type:$("select")})),LP.and(g({type:$("boolean")}))]),g({_meta:_(d(),S()).nullish(),category:OP.nullish(),description:d().nullish(),id:vv,name:d()})),FP=g({_meta:_(d(),S()).nullish(),configOptions:D(Mi)}),ZP=g({_meta:_(d(),S()).nullish()}),te=d(),WP=g({_meta:_(d(),S()).nullish(),id:d(),sessionId:te}),HP=g({_meta:_(d(),S()).nullish(),sessionId:te}),VP=g({_meta:_(d(),S()).nullish(),sessionId:te}),BP=g({_meta:_(d(),S()).nullish(),sessionId:te}),bv=g({_meta:_(d(),S()).nullish(),args:D(d()).optional(),command:d(),cwd:d().nullish(),env:D(av).optional(),outputByteLimit:W().nullish(),sessionId:te}),GP=g({_meta:_(d(),S()).nullish(),sessionId:te,uri:d()}),jP=g({_meta:_(d(),S()).nullish(),position:Tn,sessionId:te,uri:d(),version:W(),visibleRange:Oi}),qP=g({_meta:_(d(),S()).nullish(),languageId:d(),sessionId:te,text:d(),uri:d(),version:W()}),YP=g({_meta:_(d(),S()).nullish(),sessionId:te,uri:d()}),XP=g({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(pl).optional(),sessionId:te}),wv=g({_meta:_(d(),S()).nullish(),sessionId:te,terminalId:d()}),KP=g({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(pl),sessionId:te}),Sv=g({_meta:_(d(),S()).nullish(),limit:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d(),sessionId:te}),JP=g({_meta:_(d(),S()).nullish(),id:d(),reason:GC.nullish(),sessionId:te}),_v=g({_meta:_(d(),S()).nullish(),sessionId:te,terminalId:d()}),QP=g({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(pl).optional(),sessionId:te}),eR=g({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),sessionId:te,title:d().nullish(),updatedAt:d().nullish()}),tR=g({_meta:_(d(),S()).nullish(),nextCursor:d().nullish(),sessions:D(eR)}),nR=g({_meta:_(d(),S()).nullish(),title:d().nullish(),updatedAt:d().nullish()}),rR=g({_meta:_(d(),S()).nullish()}),fl=d(),iR=g({_meta:_(d(),S()).nullish(),currentModeId:fl}),sR=g({_meta:_(d(),S()).nullish(),description:d().nullish(),id:fl,name:d()}),gl=g({_meta:_(d(),S()).nullish(),availableModes:D(sR),currentModeId:fl}),ml=g({_meta:_(d(),S()).nullish(),availableModels:D(RC),currentModelId:vh}),oR=g({_meta:_(d(),S()).nullish(),configOptions:D(Mi).nullish(),models:ml.nullish(),modes:gl.nullish(),sessionId:te}),aR=g({_meta:_(d(),S()).nullish(),configOptions:D(Mi).nullish(),models:ml.nullish(),modes:gl.nullish()}),lR=g({_meta:_(d(),S()).nullish(),configOptions:D(Mi).nullish(),models:ml.nullish(),modes:gl.nullish(),sessionId:te}),cR=g({_meta:_(d(),S()).nullish(),configOptions:D(Mi).nullish(),models:ml.nullish(),modes:gl.nullish()}),uR=g({_meta:_(d(),S()).nullish()}),hR=g({_meta:_(d(),S()).nullish(),additionalDirectories:RP.nullish(),close:DP.nullish(),fork:ZP.nullish(),list:rR.nullish(),resume:uR.nullish()}),dR=dl(G([g({type:$("boolean"),value:Te()}),g({value:yh})]),g({_meta:_(d(),S()).nullish(),configId:vv,sessionId:te})),pR=g({_meta:_(d(),S()).nullish(),configOptions:D(Mi)}),fR=g({_meta:_(d(),S()).nullish(),modeId:fl,sessionId:te}),gR=g({_meta:_(d(),S()).nullish()}),mR=g({_meta:_(d(),S()).nullish(),modelId:vh,sessionId:te}),vR=g({_meta:_(d(),S()).nullish()}),yR=g({_meta:_(d(),S()).nullish(),sessionId:te}),bR=G([$("end_turn"),$("max_tokens"),$("max_turn_requests"),$("refusal"),$("cancelled")]),wR=G([$("email"),$("uri"),$("date"),$("date-time")]),SR=g({default:d().nullish(),description:d().nullish(),enum:D(d()).nullish(),format:wR.nullish(),maxLength:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:D(ov).nullish(),pattern:d().nullish(),title:d().nullish()}),_R=g({_meta:_(d(),S()).nullish(),context:bP.nullish(),position:Tn,selection:Oi.nullish(),sessionId:te,triggerKind:eP,uri:d(),version:W()}),kR=g({_meta:_(d(),S()).nullish(),suggestions:D(_P)}),ER=g({_meta:_(d(),S()).nullish(),terminalId:d()}),xR=g({_meta:_(d(),S()).nullish(),exitCode:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),kv=g({_meta:_(d(),S()).nullish(),sessionId:te,terminalId:d()}),AR=g({_meta:_(d(),S()).nullish(),exitStatus:xR.nullish(),output:d(),truncated:Te()}),$R=g({_meta:_(d(),S()).nullish(),annotations:yo.nullish(),text:d()}),IR=g({range:Oi.nullish(),text:d()}),TR=g({_meta:_(d(),S()).nullish(),contentChanges:D(IR),sessionId:te,uri:d(),version:W()});g({method:d(),params:G([HP,qP,TR,GP,YP,jP,WP,JP,cv]).nullish()});const CR=G([$("full"),$("incremental")]),PR=g({_meta:_(d(),S()).nullish(),syncKind:CR}),RR=g({_meta:_(d(),S()).nullish(),didChange:PR.nullish(),didClose:zC.nullish(),didFocus:OC.nullish(),didOpen:MC.nullish(),didSave:NC.nullish()}),DR=g({_meta:_(d(),S()).nullish(),document:RR.nullish()}),LR=g({_meta:_(d(),S()).nullish(),context:nP.nullish(),events:DR.nullish()}),zR=g({_meta:_(d(),S()).nullish(),auth:xC.optional().default({}),loadSession:Te().optional().default(!1),mcpCapabilities:IC.optional().default({http:!1,sse:!1}),nes:LR.nullish(),positionEncoding:gv.nullish(),promptCapabilities:gP.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:hR.optional().default({})}),OR=g({_meta:_(d(),S()).nullish(),agentCapabilities:zR.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:pv.nullish(),authMethods:D(JT).optional().default([]),protocolVersion:mv}),MR=g({_meta:_(d(),S()).nullish(),mimeType:d().nullish(),text:d(),uri:d()}),NR=G([MR,tC]),UR=g({_meta:_(d(),S()).nullish(),annotations:yo.nullish(),resource:NR}),bh=G([$R.and(g({type:$("text")})),$P.and(g({type:$("image")})),AP.and(g({type:$("audio")})),IP.and(g({type:$("resource_link")})),UR.and(g({type:$("resource")}))]),FR=g({_meta:_(d(),S()).nullish(),content:bh}),dc=g({_meta:_(d(),S()).nullish(),content:bh,messageId:d().nullish()}),ZR=g({_meta:_(d(),S()).nullish(),messageId:d().nullish(),prompt:D(bh),sessionId:te}),WR=g({anyOf:D(ov)}),Ev=G([FR.and(g({type:$("content")})),aC.and(g({type:$("diff")})),ER.and(g({type:$("terminal")}))]),xv=d(),Av=g({_meta:_(d(),S()).nullish(),line:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d()}),$v=G([$("pending"),$("in_progress"),$("completed"),$("failed")]),Iv=G([$("read"),$("edit"),$("delete"),$("move"),$("search"),$("execute"),$("think"),$("fetch"),$("switch_mode"),$("other")]),HR=g({_meta:_(d(),S()).nullish(),content:D(Ev).optional(),kind:Iv.optional(),locations:D(Av).optional(),rawInput:S().optional(),rawOutput:S().optional(),status:$v.optional(),title:d(),toolCallId:xv}),Tv=g({_meta:_(d(),S()).nullish(),content:D(Ev).nullish(),kind:Iv.nullish(),locations:D(Av).nullish(),rawInput:S().optional(),rawOutput:S().optional(),status:$v.nullish(),title:d().nullish(),toolCallId:xv}),Cv=g({_meta:_(d(),S()).nullish(),options:D(oP),sessionId:te,toolCall:Tv}),VR=g({_meta:_(d(),S()).nullish(),hint:d()}),BR=VR,GR=g({_meta:_(d(),S()).nullish(),description:d(),input:BR.nullish(),name:d()}),jR=g({_meta:_(d(),S()).nullish(),availableCommands:D(GR)}),qR=g({enum:D(d()),type:gC}),YR=G([qR,WR]),XR=g({default:D(d()).nullish(),description:d().nullish(),items:YR,maxItems:W().nullish(),minItems:W().nullish(),title:d().nullish()}),KR=G([SR.and(g({type:$("string")})),iP.and(g({type:$("number")})),SC.and(g({type:$("integer")})),nC.and(g({type:$("boolean")})),XR.and(g({type:$("array")}))]),JR=g({description:d().nullish(),properties:_(d(),KR).optional().default({}),required:D(d()).nullish(),title:d().nullish(),type:fC.optional().default("object")}),QR=g({requestedSchema:JR}),eD=dl(G([QR.and(g({mode:$("form")})),yC.and(g({mode:$("url")}))]),g({_meta:_(d(),S()).nullish(),message:d(),sessionId:te})),tD=g({cachedReadTokens:W().nullish(),cachedWriteTokens:W().nullish(),inputTokens:W(),outputTokens:W(),thoughtTokens:W().nullish(),totalTokens:W()}),nD=g({_meta:_(d(),S()).nullish(),stopReason:bR,usage:tD.nullish(),userMessageId:d().nullish()});G([g({id:wr,result:G([OR,eC,$C,lR,aR,tR,oR,cR,iC,gR,pR,nD,vR,yR,kR,rC,hv])}),g({error:lv,id:wr})]);const rD=g({_meta:_(d(),S()).nullish(),cost:sC.nullish(),size:W(),used:W()}),iD=G([dc.and(g({sessionUpdate:$("user_message_chunk")})),dc.and(g({sessionUpdate:$("agent_message_chunk")})),dc.and(g({sessionUpdate:$("agent_thought_chunk")})),HR.and(g({sessionUpdate:$("tool_call")})),Tv.and(g({sessionUpdate:$("tool_call_update")})),uP.and(g({sessionUpdate:$("plan")})),jR.and(g({sessionUpdate:$("available_commands_update")})),iR.and(g({sessionUpdate:$("current_mode_update")})),FP.and(g({sessionUpdate:$("config_option_update")})),nR.and(g({sessionUpdate:$("session_info_update")})),rD.and(g({sessionUpdate:$("usage_update")}))]),Pv=g({_meta:_(d(),S()).nullish(),sessionId:te,update:iD});g({method:d(),params:G([Pv,dC,cv]).nullish()});const Rv=g({_meta:_(d(),S()).nullish(),sessionId:te,terminalId:d()}),sD=g({_meta:_(d(),S()).nullish(),exitCode:W().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),oD=g({name:d(),uri:d()}),aD=g({_meta:_(d(),S()).nullish(),repository:XC.nullish(),workspaceFolders:D(oD).nullish(),workspaceUri:d().nullish()});g({id:wr,method:d(),params:G([mP,QT,AC,rP,KP,kC,XP,QP,BP,fR,dR,ZR,mR,aD,_R,VP,uv]).nullish()});const Dv=g({_meta:_(d(),S()).nullish(),content:d(),path:d(),sessionId:te});g({id:wr,method:d(),params:G([Dv,Sv,Cv,bv,kv,_v,Rv,wv,eD,uv]).nullish()});const lD=g({_meta:_(d(),S()).nullish()});G([g({id:wr,result:G([lD,kP,PP,oC,AR,EP,sD,_C,pC,hv])}),g({error:lv,id:wr})]);var ee;class cD{constructor(e,t){w(this,ee);const r=e(this),i=async(o,a)=>{var c,u,h,p,v,m,x;switch(o){case Wt.fs_write_text_file:{const E=Dv.parse(a);return(c=r.writeTextFile)==null?void 0:c.call(r,E)}case Wt.fs_read_text_file:{const E=Sv.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,E)}case Wt.session_request_permission:{const E=Cv.parse(a);return r.requestPermission(E)}case Wt.terminal_create:{const E=bv.parse(a);return(h=r.createTerminal)==null?void 0:h.call(r,E)}case Wt.terminal_output:{const E=kv.parse(a);return(p=r.terminalOutput)==null?void 0:p.call(r,E)}case Wt.terminal_release:{const E=_v.parse(a);return await((v=r.releaseTerminal)==null?void 0:v.call(r,E))??{}}case Wt.terminal_wait_for_exit:{const E=Rv.parse(a);return(m=r.waitForTerminalExit)==null?void 0:m.call(r,E)}case Wt.terminal_kill:{const E=wv.parse(a);return await((x=r.killTerminal)==null?void 0:x.call(r,E))??{}}default:if(r.extMethod)return r.extMethod(o,a);throw Ae.methodNotFound(o)}},s=async(o,a)=>{switch(o){case Wt.session_update:{const c=Pv.parse(a);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(o,a);throw Ae.methodNotFound(o)}};k(this,ee,new uD(i,s,t))}async initialize(e){return await l(this,ee).sendRequest(he.initialize,e)}async newSession(e){return await l(this,ee).sendRequest(he.session_new,e)}async loadSession(e){return await l(this,ee).sendRequest(he.session_load,e)??{}}async unstable_forkSession(e){return await l(this,ee).sendRequest(he.session_fork,e)}async listSessions(e){return await l(this,ee).sendRequest(he.session_list,e)}async unstable_resumeSession(e){return await l(this,ee).sendRequest(he.session_resume,e)}async unstable_closeSession(e){return await l(this,ee).sendRequest(he.session_close,e)}async setSessionMode(e){return await l(this,ee).sendRequest(he.session_set_mode,e)??{}}async unstable_setSessionModel(e){return await l(this,ee).sendRequest(he.session_set_model,e)??{}}async setSessionConfigOption(e){return await l(this,ee).sendRequest(he.session_set_config_option,e)}async authenticate(e){return await l(this,ee).sendRequest(he.authenticate,e)??{}}async unstable_logout(e){return await l(this,ee).sendRequest(he.logout,e)??{}}async prompt(e){return await l(this,ee).sendRequest(he.session_prompt,e)}async cancel(e){return await l(this,ee).sendNotification(he.session_cancel,e)}async unstable_startNes(e){return await l(this,ee).sendRequest(he.nes_start,e)}async unstable_suggestNes(e){return await l(this,ee).sendRequest(he.nes_suggest,e)}async unstable_closeNes(e){return await l(this,ee).sendRequest(he.nes_close,e)??{}}async unstable_didOpenDocument(e){return await l(this,ee).sendNotification(he.document_did_open,e)}async unstable_didChangeDocument(e){return await l(this,ee).sendNotification(he.document_did_change,e)}async unstable_didCloseDocument(e){return await l(this,ee).sendNotification(he.document_did_close,e)}async unstable_didSaveDocument(e){return await l(this,ee).sendNotification(he.document_did_save,e)}async unstable_didFocusDocument(e){return await l(this,ee).sendNotification(he.document_did_focus,e)}async unstable_acceptNes(e){return await l(this,ee).sendNotification(he.nes_accept,e)}async unstable_rejectNes(e){return await l(this,ee).sendNotification(he.nes_reject,e)}async extMethod(e,t){return await l(this,ee).sendRequest(e,t)}async extNotification(e,t){return await l(this,ee).sendNotification(e,t)}get signal(){return l(this,ee).signal}get closed(){return l(this,ee).closed}}ee=new WeakMap;var gn,La,xs,As,ni,ri,Ct,$s,pe,Lv,jc,zv,Ov,Mv,Nv,qc,ts;class uD{constructor(e,t,r){w(this,pe);w(this,gn,new Map);w(this,La,0);w(this,xs);w(this,As);w(this,ni);w(this,ri,Promise.resolve());w(this,Ct,new AbortController);w(this,$s);k(this,xs,e),k(this,As,t),k(this,ni,r),k(this,$s,new Promise(i=>{l(this,Ct).signal.addEventListener("abort",()=>i())})),f(this,pe,Lv).call(this)}get signal(){return l(this,Ct).signal}get closed(){return l(this,$s)}async sendRequest(e,t){f(this,pe,qc).call(this);const r=hd(this,La)._++,i=new Promise((s,o)=>{l(this,gn).set(r,{resolve:s,reject:o})});return await f(this,pe,ts).call(this,{jsonrpc:"2.0",id:r,method:e,params:t}),i}async sendNotification(e,t){f(this,pe,qc).call(this),await f(this,pe,ts).call(this,{jsonrpc:"2.0",method:e,params:t})}}gn=new WeakMap,La=new WeakMap,xs=new WeakMap,As=new WeakMap,ni=new WeakMap,ri=new WeakMap,Ct=new WeakMap,$s=new WeakMap,pe=new WeakSet,Lv=async function(){let e;try{const t=l(this,ni).readable.getReader();try{for(;!l(this,Ct).signal.aborted;){const{value:r,done:i}=await t.read();if(i)break;if(r)try{f(this,pe,zv).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&f(this,pe,ts).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{t.releaseLock()}}catch(t){e=t}finally{f(this,pe,jc).call(this,e)}},jc=function(e){if(l(this,Ct).signal.aborted)return;const t=e??new Error("ACP connection closed");for(const r of l(this,gn).values())r.reject(t);l(this,gn).clear(),l(this,Ct).abort(t)},zv=async function(e){if("method"in e&&"id"in e){const t=await f(this,pe,Ov).call(this,e.method,e.params);"error"in t&&console.error("Error handling request",e,t.error),await f(this,pe,ts).call(this,{jsonrpc:"2.0",id:e.id,...t})}else if("method"in e){const t=await f(this,pe,Mv).call(this,e.method,e.params);"error"in t&&console.error("Error handling notification",e,t.error)}else"id"in e?f(this,pe,Nv).call(this,e):console.error("Invalid message",{message:e})},Ov=async function(e,t){try{return{result:await l(this,xs).call(this,e,t)??null}}catch(r){if(r instanceof Ae)return r.toResult();if(r instanceof nf)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()}}},Mv=async function(e,t){try{return await l(this,As).call(this,e,t),{result:null}}catch(r){if(r instanceof Ae)return r.toResult();if(r instanceof nf)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()}}},Nv=function(e){const t=l(this,gn).get(e.id);if(t){if("result"in e)t.resolve(e.result);else if("error"in e){const{code:r,message:i,data:s}=e.error;t.reject(new Ae(r,i,s))}l(this,gn).delete(e.id)}else console.error("Got response to unknown request",e.id)},qc=function(){if(l(this,Ct).signal.aborted)throw l(this,Ct).signal.reason??new Error("ACP connection closed")},ts=async function(e){return k(this,ri,l(this,ri).then(async()=>{const t=l(this,ni).writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(t=>{f(this,pe,jc).call(this,t)})),l(this,ri)};class Ae extends Error{constructor(t,r,i){super(r);b(this,"code");b(this,"data");this.code=t,this.name="RequestError",this.data=i}static parseError(t,r){return new Ae(-32700,`Parse error${r?`: ${r}`:""}`,t)}static invalidRequest(t,r){return new Ae(-32600,`Invalid request${r?`: ${r}`:""}`,t)}static methodNotFound(t){return new Ae(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,r){return new Ae(-32602,`Invalid params${r?`: ${r}`:""}`,t)}static internalError(t,r){return new Ae(-32603,`Internal error${r?`: ${r}`:""}`,t)}static authRequired(t,r){return new Ae(-32e3,`Authentication required${r?`: ${r}`:""}`,t)}static resourceNotFound(t){return new Ae(-32002,`Resource not found${t?`: ${t}`:""}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}}const hD=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,dD=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,pD=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,fD=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,gD="single_session",mD={name:"television-acp-client",version:"0.0.0"},Uv="agent:main:television",vD=vo(Ot);var ae,Gt,ii,jt,rr,ir,sr,or,mn,si,Pt,Ge,qt,oi,ar,Yt,vn,Is,Xt,gt,za,Kt,I,Fv,Zv,Wv,Yc,Hv,Vv,Bv,Gv,jv,qv,Yv,Wn,Wr,Hr,Ve,Xv,Vr,Xc,Kc,ia,Kv,Jv,Ts,Cs,Jc,Br,Qv,ey;class yD extends vD{constructor(t){super();w(this,I);w(this,ae,wD());w(this,Gt,null);w(this,ii,null);w(this,jt,null);w(this,rr,null);w(this,ir,null);w(this,sr,null);w(this,or);w(this,mn,null);w(this,si,1);w(this,Pt,null);w(this,Ge,null);w(this,qt,!1);w(this,oi,!1);w(this,ar,!1);w(this,Yt,null);w(this,vn,new Set);w(this,Is);w(this,Xt);w(this,gt);w(this,za,t=>{f(this,I,Zv).call(this,t)});w(this,Kt,null);w(this,Ts,()=>{f(this,I,Br).call(this,"ACP bridge websocket closed")});w(this,Cs,()=>{f(this,I,Br).call(this,"ACP bridge websocket error")});k(this,Xt,t),k(this,gt,t.sessionMode??gD),k(this,or,t.mappedSessionStore??bD()),k(this,Is,t.createSocket??(r=>new WebSocket(r)))}getState(){return l(this,ae)}get messages(){return l(this,ae).messageOrder.map(t=>l(this,ae).messagesById[t]).filter(t=>t!==void 0)}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(l(this,ae).lifecycle.status!=="ready"){f(this,I,Ve).call(this,{lifecycle:{status:"connecting"}}),l(this,ii)??k(this,ii,f(this,I,Fv).call(this));try{await l(this,ii),await f(this,I,Yc).call(this)}catch(t){throw f(this,I,Br).call(this,Fo(t)),t}}}dispose(){f(this,I,Jc).call(this),f(this,I,Ve).call(this,{lifecycle:{status:"disposed"},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null})}async sendMessage(t){if(await this.connect(),l(this,ae).lifecycle.status!=="ready"||l(this,ae).run.status==="running"||l(this,ae).run.status==="cancelling")throw new Error("ACPClient is not ready to send a new message");const r=t.text.trim();if(!r)throw new Error("Cannot send an empty message");f(this,I,Wr).call(this,{id:f(this,I,Vr).call(this,"user"),kind:"user",text:r,status:"final"}),f(this,I,Ve).call(this,{run:{status:"running",stopReason:null,canCancel:!0,error:null}});try{const i=await f(this,I,ia).call(this).prompt({sessionId:f(this,I,Kc).call(this),prompt:[{type:"text",text:f(this,I,Xv).call(this,r)}]});f(this,I,Wn).call(this,i.stopReason==="cancelled"?"cancelled":"final"),f(this,I,Ve).call(this,{run:{status:i.stopReason==="cancelled"?"cancelled":"completed",stopReason:i.stopReason,canCancel:!1,error:null}})}catch(i){throw f(this,I,ey).call(this)||(f(this,I,Wn).call(this,"error"),f(this,I,Ve).call(this,{run:{status:"error",stopReason:null,canCancel:!1,error:Fo(i)}})),i}}async cancel(){if(await this.connect(),!l(this,ae).run.canCancel||l(this,ae).run.status!=="running")throw new Error("No active cancellable run");f(this,I,Ve).call(this,{run:{...l(this,ae).run,status:"cancelling"}}),await f(this,I,ia).call(this).cancel({sessionId:f(this,I,Kc).call(this)})}setScreenContext(t){var s,o,a;if(t===null){if(l(this,Ge)===null)return;k(this,Ge,null),k(this,qt,!1);return}const r={screenID:t.screenID,screenName:t.screenName};if(((s=l(this,Ge))==null?void 0:s.screenID)===r.screenID&&((o=l(this,Ge))==null?void 0:o.screenName)===r.screenName)return;const i=((a=l(this,Ge))==null?void 0:a.screenID)??null;if(k(this,Ge,r),l(this,gt)==="single_session"){(!l(this,mn)||i!==r.screenID)&&k(this,qt,!0);return}l(this,mn)!==cf(l(this,gt),r.screenID,l(this,Xt).clientGUID??"default-client")&&(k(this,jt,null),k(this,rr,null),l(this,Gt)&&l(this,ae).run.status==="idle"&&f(this,I,Yc).call(this).catch(c=>{f(this,I,Br).call(this,Fo(c))}))}}ae=new WeakMap,Gt=new WeakMap,ii=new WeakMap,jt=new WeakMap,rr=new WeakMap,ir=new WeakMap,sr=new WeakMap,or=new WeakMap,mn=new WeakMap,si=new WeakMap,Pt=new WeakMap,Ge=new WeakMap,qt=new WeakMap,oi=new WeakMap,ar=new WeakMap,Yt=new WeakMap,vn=new WeakMap,Is=new WeakMap,Xt=new WeakMap,gt=new WeakMap,za=new WeakMap,Kt=new WeakMap,I=new WeakSet,Fv=async function(){try{f(this,I,Ve).call(this,{lifecycle:{status:"connecting"}});const{stream:t,socket:r,metadata:i}=await kD({serverURL:l(this,Xt).serverURL,token:l(this,Xt).token,createSocket:l(this,Is),onDisconnect:l(this,za)});k(this,sr,i),f(this,I,Ve).call(this,{bridge:i}),k(this,Kt,r),r.addEventListener("close",l(this,Ts)),r.addEventListener("error",l(this,Cs)),k(this,Gt,new cD(s=>({connection:s,sessionUpdate:async o=>{await f(this,I,Vv).call(this,o)},requestPermission:async o=>f(this,I,Bv).call(this,o)}),t)),await l(this,Gt).initialize({protocolVersion:GT,clientCapabilities:{},clientInfo:mD})}catch(t){throw t}},Zv=function(t){f(this,I,Br).call(this,Fo(t))},Wv=function(t){const r=t==null?void 0:t.models;if(!(r!=null&&r.currentModelId))return;const i=r.availableModels.find(s=>s.modelId===r.currentModelId);console.info("[ACPClient] Current model:",(i==null?void 0:i.name)??r.currentModelId,`(${r.currentModelId})`)},Yc=async function(){const t=f(this,I,Jv).call(this);if(l(this,jt)&&l(this,rr)===t){await l(this,jt);return}k(this,rr,t),k(this,jt,f(this,I,Hv).call(this,t)),await l(this,jt)},Hv=async function(t){var c;const r=f(this,I,ia).call(this);f(this,I,Qv).call(this);let i,s=!1,o=null;const a={cwd:f(this,I,Kv).call(this),mcpServers:[],_meta:{sessionKey:t}};try{if(k(this,ar,!0),k(this,Yt,null),((c=l(this,sr))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=l(this,or).getActualSessionId(t);if(u)try{const h=await r.loadSession({...a,sessionId:u});if(SD(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,or).setActualSessionId(t,i),s=!1}else{const h=await r.newSession(a);o=h,i=h.sessionId,l(this,or).setActualSessionId(t,i),s=!1}}else try{o=await r.loadSession({...a,sessionId:t}),i=t,s=l(this,ae).messageOrder.length>0}catch{const u=await r.newSession(a);o=u,i=u.sessionId,s=!1}}finally{k(this,ar,!1),k(this,Yt,null),f(this,I,Wn).call(this,"final")}f(this,I,Wv).call(this,o),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),k(this,ir,i),k(this,mn,t),k(this,oi,!0),s?(l(this,vn).add(t),l(this,gt)==="single_session"&&k(this,qt,!1)):(l(this,vn).delete(t),k(this,qt,l(this,gt)==="single_session")),f(this,I,Ve).call(this,{lifecycle:{status:"ready"}})},Vv=async function(t){const r=t.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&f(this,I,Yv).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&f(this,I,Gv).call(this,r.content.text);return;case"tool_call":f(this,I,jv).call(this,r);return;case"tool_call_update":f(this,I,qv).call(this,r);return;case"agent_thought_chunk":return;default:return}},Bv=async function(t){return{outcome:{outcome:"cancelled"}}},Gv=function(t){k(this,Yt,null);const r=_D(t);if(!r)return;if(!l(this,Pt)){const s={id:f(this,I,Vr).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};k(this,Pt,s.id),f(this,I,Wr).call(this,s);return}const i=l(this,ae).messagesById[l(this,Pt)];if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");f(this,I,Hr).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},jv=function(t){f(this,I,Wn).call(this,"final");const r=f(this,I,Xc).call(this,t.toolCallId),i=hf("content"in t?t.content:void 0),s={id:(r==null?void 0:r.id)??f(this,I,Vr).call(this,"tool"),kind:"tool_call",toolCallId:t.toolCallId,title:t.title,toolKind:t.kind??"other",status:t.status==="failed"?"failed":t.status==="completed"?"completed":"in_progress",text:(r==null?void 0:r.text)??i,locations:t.locations??(r==null?void 0:r.locations)};if(r){f(this,I,Hr).call(this,s);return}f(this,I,Wr).call(this,s)},qv=function(t){const r=f(this,I,Xc).call(this,t.toolCallId),i=(r==null?void 0:r.text)??"",s=hf(t.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??f(this,I,Vr).call(this,"tool"),kind:"tool_call",toolCallId:t.toolCallId,title:(r==null?void 0:r.title)??t.toolCallId,toolKind:(r==null?void 0:r.toolKind)??"other",status:t.status==="failed"?"failed":t.status==="completed"?"completed":"in_progress",text:o,locations:t.locations??(r==null?void 0:r.locations)};if(r){f(this,I,Hr).call(this,a);return}f(this,I,Wr).call(this,a)},Yv=function(t){if(f(this,I,Wn).call(this,"final"),!t)return;const r=l(this,ar)?l(this,Yt):null;if(!r){const s=uf(t);if(!s)return;const o={id:f(this,I,Vr).call(this,"user"),kind:"user",text:s,status:"final"};f(this,I,Wr).call(this,o),l(this,ar)&&k(this,Yt,o.id);return}const i=l(this,ae).messagesById[r];if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");f(this,I,Hr).call(this,{...i,text:uf(`${i.text}${t}`)})},Wn=function(t){if(!l(this,Pt))return;const r=l(this,ae).messagesById[l(this,Pt)];(r==null?void 0:r.kind)==="assistant"&&f(this,I,Hr).call(this,{...r,status:t}),k(this,Pt,null)},Wr=function(t){f(this,I,Ve).call(this,{messagesById:{...l(this,ae).messagesById,[t.id]:t},messageOrder:[...l(this,ae).messageOrder,t.id]})},Hr=function(t){f(this,I,Ve).call(this,{messagesById:{...l(this,ae).messagesById,[t.id]:t}})},Ve=function(t){const r={...l(this,ae),...t};k(this,ae,{...r,sendDisabled:r.lifecycle.status!=="ready"||r.run.status==="running"||r.run.status==="cancelling",cancelDisabled:!(r.run.status==="running"||r.run.status==="cancelling")||!r.run.canCancel}),this.dispatchEvent(new ie("change"))},Xv=function(t){const r=l(this,mn);if(!r)return t;const i=l(this,Ge)?l(this,gt)==="single_session"?l(this,qt)||!l(this,vn).has(r):!l(this,vn).has(r):!1;if(!(l(this,oi)||i))return t;k(this,oi,!1),k(this,qt,!1),l(this,vn).add(r);const o=["[Television screen context]","This chat session is coming from a Television client.","Load/read the installed `television` skill before Television work. Start with `SKILL.md` for the mental model and the artifact-vs-chat decision; then `cli-capabilities.md` for commands and focus, and `artifact-workflow.md` for artifact lifecycle work.","If the skill is not installed, use `tv skills show` to list bundled skill files or print one directly."];return l(this,Ge)?(o.push("This conversation is currently attached to the screen below."),o.push(`screen_id: ${l(this,Ge).screenID}`),o.push(`screen_name: ${l(this,Ge).screenName??""}`),o.push("When the user asks to inspect or change Television state with the tv CLI, use this screen ID with the --screen argument.")):o.push("There is currently no active Television screen."),o.push("[/Television screen context]","",t),o.join(`
|
|
43
|
+
`)},Vr=function(t){const r=`${t}-${l(this,si)}`;return k(this,si,l(this,si)+1),r},Xc=function(t){for(const r of l(this,ae).messageOrder){const i=l(this,ae).messagesById[r];if((i==null?void 0:i.kind)==="tool_call"&&i.toolCallId===t)return i}return null},Kc=function(){if(!l(this,ir))throw new Error("ACP session is not ready");return l(this,ir)},ia=function(){if(!l(this,Gt))throw new Error("ACP connection is not ready");return l(this,Gt)},Kv=function(){var r;const t=(r=l(this,sr))==null?void 0:r.sessionCwd;if(!t)throw new Error("ACP bridge session cwd is not ready");return t},Jv=function(){var r;if(l(this,gt)==="single_session")return`${Uv}-${(l(this,Xt).clientGUID??"default-client").toLowerCase()}`;const t=(r=l(this,Ge))==null?void 0:r.screenID;if(!t)throw new Error("Screen context is required for per-screen session mode");return cf(l(this,gt),t,l(this,Xt).clientGUID??"default-client")},Ts=new WeakMap,Cs=new WeakMap,Jc=function(){k(this,Gt,null),k(this,ii,null),k(this,jt,null),k(this,rr,null),k(this,ir,null),k(this,mn,null),k(this,sr,null),l(this,Kt)&&(l(this,Kt).removeEventListener("close",l(this,Ts)),l(this,Kt).removeEventListener("error",l(this,Cs)),l(this,Kt).close(),k(this,Kt,null))},Br=function(t){this.disposed||l(this,ae).lifecycle.status==="disconnected"||(f(this,I,Wn).call(this,"error"),f(this,I,Jc).call(this),f(this,I,Ve).call(this,{lifecycle:{status:"disconnected",...t?{error:t}:{}},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null}))},Qv=function(){k(this,Pt,null),k(this,Yt,null),k(this,si,1),f(this,I,Ve).call(this,{run:{status:"idle",stopReason:null,canCancel:!1,error:null},messagesById:{},messageOrder:[]})},ey=function(){return l(this,ae).lifecycle.status==="disconnected"};function bD(){const n=new Map;return{getActualSessionId(e){return n.get(e)??null},setActualSessionId(e,t){n.set(e,t)},clearActualSessionId(e){n.delete(e)}}}function wD(){return{lifecycle:{status:"connecting"},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null,messagesById:{},messageOrder:[],sendDisabled:!0,cancelDisabled:!0}}function SD(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function cf(n,e,t){return n==="single_session"?`${Uv}-${t.toLowerCase()}`:`agent:main:television-${t.toLowerCase()}-${e.toLowerCase()}`}function ty(n){return n.replace(/^(?:\s*\n)+/,"")}function uf(n){let e=n;return e=e.replace(hD,""),e=e.replace(dD,""),e=e.replace(pD,""),e=ty(e),e}function _D(n){let e=n;return e=e.replace(fD,""),e=ty(e),e}function hf(n){return!n||n.length===0?"":n.flatMap(e=>e.type==="content"&&e.content.type==="text"?[e.content.text]:[]).join("")}async function kD(n){const e=n.createSocket(AD(n.serverURL,n.token));let t=!1,r,i;const s=new Promise((u,h)=>{r=u,i=h}),o=new ReadableStream({start(u){let h=!1;const p=()=>{e.send(JSON.stringify({type:"acp-bridge-connect"}))},v=E=>{const T=xD(E);if(!T)return;let O;try{O=JSON.parse(T)}catch(P){const V=P instanceof Error?P:new Error(String(P));i(V),u.error(V);return}switch(O.type){case"acp-bridge-status":if(O.status==="ready"){let P;try{P=ED(O)}catch(V){const F=V instanceof Error?V:new Error(String(V));t||i(F),u.error(F);return}t||(t=!0,r(P));return}if(O.status==="error"||O.status==="exited"){const P=new Error(O.error??`ACP bridge ${O.status}`);t||i(P),u.error(P)}return;case"acp-bridge-message":u.enqueue(O.message);return}},m=()=>{var T;if(h)return;h=!0;const E=new Error("ACP bridge websocket closed");t||i(E),(T=n.onDisconnect)==null||T.call(n,E),u.close()},x=()=>{var T;if(h)return;h=!0;const E=new Error("ACP bridge websocket error");t||i(E),(T=n.onDisconnect)==null||T.call(n,E),u.error(E)};e.addEventListener("open",p),e.addEventListener("message",v),e.addEventListener("close",m),e.addEventListener("error",x)}}),a=new WritableStream({async write(u){await s,e.send(JSON.stringify({type:"acp-bridge-message",message:u}))},close(){e.close()},abort(){e.close()}}),c=await s;return{stream:{readable:o,writable:a},socket:e,metadata:c}}function ED(n){const{agent:e,sessionIdStrategy:t,sessionCwd:r}=n;if((e==="openclaw"||e==="hermes")&&(t==="deterministic"||t==="mapped")&&typeof r=="string"&&r.length>0)return{agent:e,sessionIdStrategy:t,sessionCwd:r};throw new Error("ACP bridge ready status missing bootstrap metadata")}function xD(n){if(typeof n=="string")return n;if(n instanceof Uint8Array)return new TextDecoder().decode(n);if(typeof Buffer<"u"&&n instanceof Buffer)return n.toString("utf8");if(typeof n=="object"&&n!==null&&"data"in n){const e=n.data;if(typeof e=="string")return e;if(e instanceof Uint8Array)return new TextDecoder().decode(e);if(Array.isArray(e))return Buffer.concat(e).toString("utf8")}return null}function AD(n,e){const t=new URL(n);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/acp",t.search="",t.searchParams.set("token",e),t.hash="",t.toString()}function Fo(n){return n instanceof Error?n.message:String(n)}const df="television.acpClientGUID",pf="television.acpMappedSessions",ff=1;var ai;class $D{constructor(){w(this,ai,new Map)}getActualSessionId(e){return l(this,ai).get(e)??null}setActualSessionId(e,t){l(this,ai).set(e,t)}clearActualSessionId(e){l(this,ai).delete(e)}}ai=new WeakMap;var li,Ps,et,sa,oa,Qc;class ID{constructor(e,t){w(this,et);w(this,li);w(this,Ps);k(this,li,e),k(this,Ps,t)}getActualSessionId(e){const t=f(this,et,oa).call(this)[f(this,et,sa).call(this,e)];return typeof t=="string"&&t.length>0?t:null}setActualSessionId(e,t){const r=f(this,et,oa).call(this);r[f(this,et,sa).call(this,e)]=t,f(this,et,Qc).call(this,r)}clearActualSessionId(e){const t=f(this,et,oa).call(this);delete t[f(this,et,sa).call(this,e)],f(this,et,Qc).call(this,t)}}li=new WeakMap,Ps=new WeakMap,et=new WeakSet,sa=function(e){return JSON.stringify([l(this,Ps),e])},oa=function(){const e=l(this,li).getItem(pf);if(!e)return{};let t;try{t=JSON.parse(e)}catch{return{}}if(typeof t!="object"||t===null||Array.isArray(t))return{};const r=t;return r.version!==ff?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},Qc=function(e){const t={version:ff,entries:e};l(this,li).setItem(pf,JSON.stringify(t))};function TD(){return typeof window>"u"?null:window.localStorage}function CD(n){const e=n.getItem(df);if(e)return e;const t=ll().toLowerCase();return n.setItem(df,t),t}const PD=4401;class eu extends Error{constructor(e="Authentication required"){super(e),this.name="AuthError"}}class ny extends Ot{constructor(t){super();b(this,"url");b(this,"name");b(this,"token");b(this,"status","disconnected");b(this,"screens",new Map);b(this,"views",[]);b(this,"client");b(this,"acpClient");b(this,"createSocket");b(this,"createClient");b(this,"socket",null);b(this,"connectAttempt",0);this.url=dt(t.url),this.name=t.name,this.token=t.token??null,this.createSocket=t.createSocket??(i=>new WebSocket(i)),this.createClient=t.createClient??((i,s)=>new Yx(i,{token:s??void 0})),this.client=this.createClient(this.url,this.token);const r=t.mappedSessionStore??(t.acpStorage?new ID(t.acpStorage,this.url):new $D);this.acpClient=new yD({serverURL:this.url,token:this.token??"",...t.createACPSocket?{createSocket:t.createACPSocket}:t.createSocket?{createSocket:t.createSocket}:{},...t.clientGUID?{clientGUID:t.clientGUID}:{},mappedSessionStore:r})}async connect(){var i;this.connectAttempt+=1;const t=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this.token),this.status="connecting",this.dispatchEvent(new ie("change"));const r=this.createSocket(RD(this.url,this.token));return this.socket=r,await new Promise((s,o)=>{let a=!1;const c=()=>{a||this.connectAttempt!==t||(a=!0,this.status="connected",this.dispatchEvent(new ie("change")),s())},u=p=>{a||this.connectAttempt!==t||(a=!0,this.status="disconnected",this.dispatchEvent(new ie("change")),o(p))},h=async()=>{try{const[{screens:p},v]=await Promise.all([this.client.screens.list(),this.client.views.list()]);this.screens=new Map(p.map(m=>[m.id,structuredClone(m)])),this.views=v,this.dispatchEvent(new ie("change")),c()}catch(p){u(p instanceof Error?p:new Error(String(p)))}};r.addEventListener("open",()=>{h()}),r.addEventListener("message",p=>{const v=LD(p);v&&(this.applyServerEvent(v),this.dispatchEvent(new vm("server-event",{serverURL:this.url,event:v})))}),r.addEventListener("close",p=>{if(this.connectAttempt===t){if(this.socket=null,DD(p)===PD){u(new eu);return}if(!a){u(new Error("Connection closed before initialization"));return}this.status="disconnected",this.dispatchEvent(new ie("change"))}}),r.addEventListener("error",()=>{u(new Error("WebSocket connection failed"))})})}disconnect(){var t;this.connectAttempt+=1,(t=this.socket)==null||t.close(),this.socket=null,this.status="disconnected",this.dispatchEvent(new ie("change"))}dispose(){this.disconnect(),this.acpClient.dispose()}getViewURL(t){const r=BT(t.type,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(t){const r=`${this.url}/artifacts/${encodeURIComponent(t)}/content`;return this.token===null?r:`${r}?token=${encodeURIComponent(this.token)}`}async createScreen(t){const{screen:r}=await this.client.screens.create({name:t});return this.screens.set(r.id,structuredClone(r)),r}applyServerEvent(t){switch(t.type){case"screen-created":this.screens.set(t.screen.id,structuredClone(t.screen)),this.dispatchEvent(new na("screens-changed"));break;case"screen-updated":this.screens.set(t.screen.id,structuredClone(t.screen)),this.dispatchEvent(new na("screens-changed"));break;case"screen-removed":this.screens.delete(t.screenID),this.dispatchEvent(new na("screens-changed"));break;case"artifact-created":break;case"artifact-attached":{const r=this.screens.get(t.screenID);r&&!fm(r.layout,t.artifact.id)&&(r.layout=[...r.layout,pm(t.artifact.id,{id:t.cardID})]);break}case"artifact-removed":{const r=this.screens.get(t.screenID);r&&(r.layout=im(r.layout,t.artifactID));break}}}}function RD(n,e){const t=new URL(n);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/events",t.search="",e&&t.searchParams.set("token",e),t.hash="",t.toString()}function DD(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}function LD(n){const e=typeof n=="string"?n:typeof n=="object"&&n!==null&&"data"in n&&typeof n.data=="string"?n.data:"";if(!e)return null;try{return JSON.parse(e)}catch{return null}}const zD="Local";var Rs,tu;class OD extends Ot{constructor(t){super();w(this,Rs);b(this,"servers",new Map);b(this,"localServerURL");b(this,"clientGUID");b(this,"acpStorage");b(this,"localStore");b(this,"createSocket");b(this,"lastActiveServerURL");b(this,"serverListeners",new Map);b(this,"handleLocalStoreChange",()=>{const t=this.localStore.get().activeServerURL;t!==this.lastActiveServerURL&&(this.lastActiveServerURL=t,this.dispatchEvent(new ie("change")))});this.localStore=t.localStore,this.localServerURL=t.localServerURL?dt(t.localServerURL):null,this.createSocket=t.createSocket??(i=>new WebSocket(i)),this.lastActiveServerURL=this.localStore.get().activeServerURL;const r=t.acpStorage===void 0?TD():t.acpStorage;this.acpStorage=r,this.clientGUID=t.clientGUID??(r?CD(r):ll().toLowerCase()),this.localStore.addEventListener("change",this.handleLocalStoreChange)}get activeServer(){const t=this.localStore.get().activeServerURL;return t===null?null:this.servers.get(t)??null}add(t){const r=dt(t.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,t);const s=()=>{this.dispatchEvent(new ie("change"))},o=c=>{this.dispatchEvent(new vm("server-event",{serverURL:c.serverURL,event:c.event}))},a=()=>{this.dispatchEvent(new na("screens-changed"))};t.addEventListener("change",s),t.addEventListener("server-event",o),t.addEventListener("screens-changed",a),this.serverListeners.set(r,{onServerChange:s,onServerEvent:o,onScreensChanged:a}),this.dispatchEvent(new ie("change"))}remove(t){const r=dt(t);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 ie("change"))}setActive(t){const r=this.localStore.get(),i=t?dt(t.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(t,r){const i=t?dt(t):null;if(i){const a=this.localStore.get();a.servers.some(u=>dt(u.url)===i)||this.localStore.set({...a,servers:[...a.servers,{url:i,name:zD}]})}const s=this.localStore.get().servers;for(const a of s){const c=dt(a.url),u=i!==null&&c===i,h=f(this,Rs,tu).call(this,{url:a.url,name:a.name,token:u?r??null:null});this.add(h),h.connect().catch(()=>{})}const o=i?this.servers.get(i)??null:null;this.setActive(o??this.servers.values().next().value??null)}addServer(t,r){const i=dt(t);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>dt(a.url)!==i),{url:i,name:r}]});const o=f(this,Rs,tu).call(this,{url:i,name:r,token:null});this.add(o),this.setActive(o),o.connect().catch(()=>{})}removeServer(t){this.remove(t)}}Rs=new WeakSet,tu=function(t){return new ny({url:t.url,name:t.name,token:t.token,createSocket:this.createSocket,clientGUID:this.clientGUID,acpStorage:this.acpStorage})};var Ds;class MD extends Ot{constructor(){super();w(this,Ds,t=>{const r=ND(t);r!==null&&(t.preventDefault(),this.dispatchEvent(new vx("shortcut-triggered",{shortcut:r})))});document.addEventListener("keydown",l(this,Ds))}dispose(){document.removeEventListener("keydown",l(this,Ds))}}Ds=new WeakMap;function ND(n){for(const[e,t]of Object.entries(Xx))if(UD(n,t.trigger))return e;return null}function UD(n,e){return!(n.key.toLowerCase()!==e.key.toLowerCase()||n.metaKey!==!!e.meta||n.ctrlKey!==!!e.ctrl||n.shiftKey!==!!e.shift||n.altKey!==!!e.alt)}const FD="serverURL",ZD="token",WD="mode",HD="electron";function ry(n=window.location.search,e=window.location.origin){const r=new URLSearchParams(n).get(FD);return r?new URL(r).origin:new URL(e).origin}function gf(n=window.location.search){return new URLSearchParams(n).get(ZD)}function wh(n=window.location.search){return new URLSearchParams(n).get(WD)===HD}/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
|
-
*/const
|
|
48
|
-
\f\r]`,
|
|
49
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),bf=/'/g,wf=/"/g,sy=/^(?:script|style|textarea|title)$/i,BD=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),N=BD(1),Ei=Symbol.for("lit-noChange"),ne=Symbol.for("lit-nothing"),Sf=new WeakMap,Yn=Sr.createTreeWalker(Sr,129);function oy(n,e){if(!wh(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return mf!==void 0?mf.createHTML(e):e}const GD=(n,e)=>{const t=n.length-1,r=[];let i,s=e===2?"<svg>":e===3?"<math>":"",o=Vi;for(let a=0;a<t;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===Vi?h[1]==="!--"?o=vf:h[1]!==void 0?o=yf:h[2]!==void 0?(sy.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=Nn):h[3]!==void 0&&(o=Nn):o===Nn?h[0]===">"?(o=i??Vi,p=-1):h[1]===void 0?p=-2:(p=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?Nn:h[3]==='"'?wf:bf):o===wf||o===bf?o=Nn:o===vf||o===yf?o=Vi:(o=Nn,i=void 0);const m=o===Nn&&n[a+1].startsWith("/>")?" ":"";s+=o===Vi?c+HD:p>=0?(r.push(u),c.slice(0,p)+ry+c.slice(p)+dn+m):c+dn+(p===-2?a:m)}return[oy(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class ms{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,o=0;const a=e.length-1,c=this.parts,[u,h]=GD(e,t);if(this.el=ms.createElement(u,r),Yn.currentNode=this.el.content,t===2||t===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=Yn.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(ry)){const v=h[o++],m=i.getAttribute(p).split(dn),E=/([.?@])?(.*)/.exec(v);c.push({type:1,index:s,name:E[2],strings:m,ctor:E[1]==="."?qD:E[1]==="?"?YD:E[1]==="@"?XD:ml}),i.removeAttribute(p)}else p.startsWith(dn)&&(c.push({type:6,index:s}),i.removeAttribute(p));if(sy.test(i.tagName)){const p=i.textContent.split(dn),v=p.length-1;if(v>0){i.textContent=xa?xa.emptyScript:"";for(let m=0;m<v;m++)i.append(p[m],fs()),Yn.nextNode(),c.push({type:2,index:++s});i.append(p[v],fs())}}}else if(i.nodeType===8)if(i.data===iy)c.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(dn,p+1))!==-1;)c.push({type:7,index:s}),p+=dn.length-1}s++}}static createElement(e,t){const r=Sr.createElement("template");return r.innerHTML=e,r}}function xi(n,e,t=n,r){var o,a;if(e===Ei)return e;let i=r!==void 0?(o=t._$Co)==null?void 0:o[r]:t._$Cl;const s=gs(e)?void 0:e._$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,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=i:t._$Cl=i),i!==void 0&&(e=xi(n,i._$AS(n,e.values),i,r)),e}class jD{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,i=((e==null?void 0:e.creationScope)??Sr).importNode(t,!0);Yn.currentNode=i;let s=Yn.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Sh(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new KD(s,this,e)),this._$AV.push(u),c=r[++a]}o!==(c==null?void 0:c.index)&&(s=Yn.nextNode(),o++)}return Yn.currentNode=Sr,i}p(e){let t=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}let Sh=class ay{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=ne,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=xi(this,e,t),gs(e)?e===ne||e==null||e===""?(this._$AH!==ne&&this._$AR(),this._$AH=ne):e!==this._$AH&&e!==Ei&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):VD(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==ne&&gs(this._$AH)?this._$AA.nextSibling.data=e:this.T(Sr.createTextNode(e)),this._$AH=e}$(e){var s;const{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=ms.createElement(oy(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(t);else{const o=new jD(i,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Sf.get(e.strings);return t===void 0&&Sf.set(e.strings,t=new ms(e)),t}k(e){wh(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,i=0;for(const s of e)i===t.length?t.push(r=new ay(this.O(fs()),this.O(fs()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,t);e!==this._$AB;){const i=gf(e).nextSibling;gf(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},ml=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=ne,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=ne}_$AI(e,t=this,r,i){const s=this.strings;let o=!1;if(s===void 0)e=xi(this,e,t,0),o=!gs(e)||e!==this._$AH&&e!==Ei,o&&(this._$AH=e);else{const a=e;let c,u;for(e=s[0],c=0;c<s.length-1;c++)u=xi(this,a[r+c],t,c),u===Ei&&(u=this._$AH[c]),o||(o=!gs(u)||u!==this._$AH[c]),u===ne?e=ne:e!==ne&&(e+=(u??"")+s[c+1]),this._$AH[c]=u}o&&!i&&this.j(e)}j(e){e===ne?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},qD=class extends ml{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ne?void 0:e}},YD=class extends ml{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ne)}},XD=class extends ml{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=xi(this,e,t,0)??ne)===Ei)return;const r=this._$AH,i=e===ne&&r!==ne||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==ne&&(r===ne||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}};class KD{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){xi(this,e)}}const pc=cs.litHtmlPolyfillSupport;pc==null||pc(ms,Sh),(cs.litHtmlVersions??(cs.litHtmlVersions=[])).push("3.3.2");const Fe=(n,e,t)=>{const r=e;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new Sh(e.insertBefore(fs(),null),null,void 0,{})),i._$AI(n),i},JD=.5,_f=.1,kf=8,QD=4,ly=3,cy=3,e2=4,Xn=255,uy=.2126,hy=.7152,dy=.0722;async function py(n){const e=t2(n);if(!e)return"light";try{return await i2(n,e)>=JD?"light":"dark"}catch{return"light"}}function t2(n){if(typeof document.elementsFromPoint!="function")return null;const e=n.getBoundingClientRect(),t=e.left+e.width/2,r=e.top+e.height/2,i=document.elementsFromPoint(t,r);for(const s of i){if(!(s instanceof HTMLElement)||s===n||n.contains(s))continue;const o=window.getComputedStyle(s);if(n2(o))return s}return null}function n2(n){return n.backgroundImage&&n.backgroundImage!=="none"?!0:r2(n.backgroundColor)>0}function r2(n){if(!n)return 0;const e=n.match(/rgba?\(([^)]+)\)/);if(!e)return 0;const t=e[1].split(/[\s,/]+/).filter(Boolean);return t.length===e2?parseFloat(t[ly]):t.length===cy?1:0}async function i2(n,e){const t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i={x:Fo((t.left-r.left)/r.width),y:Fo((t.top-r.top)/r.height),width:Fo(t.width/r.width),height:Fo(t.height/r.height)},s=window.getComputedStyle(e),o=s2(s.backgroundImage);return o?a2({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):l2(s.backgroundColor)}function s2(n){const e=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return e?e[1]:null}const Ef=new Map;function o2(n){let e=Ef.get(n);return e||(e=new Promise((t,r)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=()=>t(i),i.onerror=()=>r(new Error(`Failed to load ${n}`)),i.src=n}),Ef.set(n,e),e)}async function a2(n){const e=await o2(n.url),t=Math.max(kf,Math.ceil(n.surfaceWidth*_f)),r=Math.max(kf,Math.ceil(n.surfaceHeight*_f)),i=document.createElement("canvas");i.width=t,i.height=r;const s=i.getContext("2d",{willReadFrequently:!0});if(!s)return 1;const o=n.surfaceWidth/n.surfaceHeight,a=e.naturalWidth/e.naturalHeight;let c,u;a>o?(u=r,c=r*a):(c=t,u=t/a);const h=(t-c)/2,p=(r-u)/2;s.drawImage(e,h,p,c,u);const v=Math.max(0,Math.floor(n.region.x*t)),m=Math.max(0,Math.floor(n.region.y*r)),E=Math.max(1,Math.min(t-v,Math.floor(n.region.width*t))),k=Math.max(1,Math.min(r-m,Math.floor(n.region.height*r))),T=s.getImageData(v,m,E,k).data;let O=0,P=0;for(let V=0;V<T.length;V+=QD){const F=T[V]/Xn,B=T[V+1]/Xn,U=T[V+2]/Xn,Q=T[V+ly]/Xn;O+=Q*(uy*F+hy*B+dy*U),P+=1}return P>0?O/P:1}function l2(n){const e=n.match(/rgba?\(([^)]+)\)/);if(!e)return 1;const t=e[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(t.length<cy)return 1;const r=t[0]/Xn,i=t[1]/Xn,s=t[2]/Xn;return uy*r+hy*i+dy*s}function Fo(n){return n<0?0:n>1?1:n}const c2=["ghost","glass"],vs=c2.flatMap(n=>[`button[variant="${n}"]`,`segmented-control[variant="${n}"]`]).join(", "),Zo=new WeakSet,xf=new WeakSet;function fy(n){if(xf.has(n))return;xf.add(n);for(const t of n.querySelectorAll(vs))fc(t);if(typeof MutationObserver!="function")return;new MutationObserver(t=>{for(const r of t)if(r.type==="childList")for(const i of r.addedNodes)u2(i,fc);else r.type==="attributes"&&r.target instanceof HTMLElement&&r.target.matches(vs)&&fc(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant"]})}function u2(n,e){if(n instanceof Element){n instanceof HTMLElement&&n.matches(vs)&&e(n);for(const t of n.querySelectorAll(vs))e(t)}}async function fc(n){if(Zo.has(n)||n.hasAttribute("tone"))return;Zo.add(n);const e=await py(n);if(!n.matches(vs)){Zo.delete(n);return}if(n.hasAttribute("tone")){Zo.delete(n);return}n.setAttribute("tone",e)}const h2="*,*: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-sm: 24px;--control-height-md: 28px;--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;--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-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-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-md);padding:0 10px}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(--color-overlay-hover)}button[variant=ghost]:active:not(:disabled){background:var(--color-overlay-active);box-shadow:none}button[variant=ghost][data-active]:not(:disabled),button[variant=ghost][data-active]: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);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);backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5);box-shadow:none}button[variant=glass]:hover:not(:disabled){background:linear-gradient(var(--color-overlay-hover),var(--color-overlay-hover))}button[variant=glass]:active:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}[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}: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[icon-only]{width:var(--control-height-md);padding:0}[data-ui-icon]{display:inline-block;vertical-align:middle}.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-200), transparent);--color-overlay-active: color-mix(in srgb, var(--white) var(--alpha-300), 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-100), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-200), 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)}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:var(--color-overlay-backdrop)}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([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(: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>[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: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-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)}',_h=new CSSStyleSheet;_h.replaceSync(h2);try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,_h]}catch{}fy(document);function gy(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,_h]}catch{}fy(n)}/**
|
|
47
|
+
*/const us=globalThis,mf=n=>n,Aa=us.trustedTypes,vf=Aa?Aa.createPolicy("lit-html",{createHTML:n=>n}):void 0,iy="$lit$",dn=`lit$${Math.random().toFixed(9).slice(2)}$`,sy="?"+dn,VD=`<${sy}>`,Sr=document,gs=()=>Sr.createComment(""),ms=n=>n===null||typeof n!="object"&&typeof n!="function",Sh=Array.isArray,BD=n=>Sh(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",pc=`[
|
|
48
|
+
\f\r]`,Bi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,yf=/-->/g,bf=/>/g,Nn=RegExp(`>|${pc}(?:([^\\s"'>=/]+)(${pc}*=${pc}*(?:[^
|
|
49
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),wf=/'/g,Sf=/"/g,oy=/^(?:script|style|textarea|title)$/i,GD=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),N=GD(1),xi=Symbol.for("lit-noChange"),ne=Symbol.for("lit-nothing"),_f=new WeakMap,Yn=Sr.createTreeWalker(Sr,129);function ay(n,e){if(!Sh(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return vf!==void 0?vf.createHTML(e):e}const jD=(n,e)=>{const t=n.length-1,r=[];let i,s=e===2?"<svg>":e===3?"<math>":"",o=Bi;for(let a=0;a<t;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===Bi?h[1]==="!--"?o=yf:h[1]!==void 0?o=bf:h[2]!==void 0?(oy.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=Nn):h[3]!==void 0&&(o=Nn):o===Nn?h[0]===">"?(o=i??Bi,p=-1):h[1]===void 0?p=-2:(p=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?Nn:h[3]==='"'?Sf:wf):o===Sf||o===wf?o=Nn:o===yf||o===bf?o=Bi:(o=Nn,i=void 0);const m=o===Nn&&n[a+1].startsWith("/>")?" ":"";s+=o===Bi?c+VD:p>=0?(r.push(u),c.slice(0,p)+iy+c.slice(p)+dn+m):c+dn+(p===-2?a:m)}return[ay(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class vs{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,o=0;const a=e.length-1,c=this.parts,[u,h]=jD(e,t);if(this.el=vs.createElement(u,r),Yn.currentNode=this.el.content,t===2||t===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=Yn.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(iy)){const v=h[o++],m=i.getAttribute(p).split(dn),x=/([.?@])?(.*)/.exec(v);c.push({type:1,index:s,name:x[2],strings:m,ctor:x[1]==="."?YD:x[1]==="?"?XD:x[1]==="@"?KD:vl}),i.removeAttribute(p)}else p.startsWith(dn)&&(c.push({type:6,index:s}),i.removeAttribute(p));if(oy.test(i.tagName)){const p=i.textContent.split(dn),v=p.length-1;if(v>0){i.textContent=Aa?Aa.emptyScript:"";for(let m=0;m<v;m++)i.append(p[m],gs()),Yn.nextNode(),c.push({type:2,index:++s});i.append(p[v],gs())}}}else if(i.nodeType===8)if(i.data===sy)c.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(dn,p+1))!==-1;)c.push({type:7,index:s}),p+=dn.length-1}s++}}static createElement(e,t){const r=Sr.createElement("template");return r.innerHTML=e,r}}function Ai(n,e,t=n,r){var o,a;if(e===xi)return e;let i=r!==void 0?(o=t._$Co)==null?void 0:o[r]:t._$Cl;const s=ms(e)?void 0:e._$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,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=i:t._$Cl=i),i!==void 0&&(e=Ai(n,i._$AS(n,e.values),i,r)),e}class qD{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,i=((e==null?void 0:e.creationScope)??Sr).importNode(t,!0);Yn.currentNode=i;let s=Yn.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new _h(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new JD(s,this,e)),this._$AV.push(u),c=r[++a]}o!==(c==null?void 0:c.index)&&(s=Yn.nextNode(),o++)}return Yn.currentNode=Sr,i}p(e){let t=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}let _h=class ly{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=ne,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ai(this,e,t),ms(e)?e===ne||e==null||e===""?(this._$AH!==ne&&this._$AR(),this._$AH=ne):e!==this._$AH&&e!==xi&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):BD(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==ne&&ms(this._$AH)?this._$AA.nextSibling.data=e:this.T(Sr.createTextNode(e)),this._$AH=e}$(e){var s;const{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=vs.createElement(ay(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(t);else{const o=new qD(i,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=_f.get(e.strings);return t===void 0&&_f.set(e.strings,t=new vs(e)),t}k(e){Sh(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,i=0;for(const s of e)i===t.length?t.push(r=new ly(this.O(gs()),this.O(gs()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,t);e!==this._$AB;){const i=mf(e).nextSibling;mf(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},vl=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=ne,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=ne}_$AI(e,t=this,r,i){const s=this.strings;let o=!1;if(s===void 0)e=Ai(this,e,t,0),o=!ms(e)||e!==this._$AH&&e!==xi,o&&(this._$AH=e);else{const a=e;let c,u;for(e=s[0],c=0;c<s.length-1;c++)u=Ai(this,a[r+c],t,c),u===xi&&(u=this._$AH[c]),o||(o=!ms(u)||u!==this._$AH[c]),u===ne?e=ne:e!==ne&&(e+=(u??"")+s[c+1]),this._$AH[c]=u}o&&!i&&this.j(e)}j(e){e===ne?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},YD=class extends vl{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ne?void 0:e}},XD=class extends vl{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ne)}},KD=class extends vl{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=Ai(this,e,t,0)??ne)===xi)return;const r=this._$AH,i=e===ne&&r!==ne||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==ne&&(r===ne||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}};class JD{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Ai(this,e)}}const fc=us.litHtmlPolyfillSupport;fc==null||fc(vs,_h),(us.litHtmlVersions??(us.litHtmlVersions=[])).push("3.3.2");const Fe=(n,e,t)=>{const r=e;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new _h(e.insertBefore(gs(),null),null,void 0,{})),i._$AI(n),i},QD=.5,kf=.1,Ef=8,e2=4,cy=3,uy=3,t2=4,Xn=255,hy=.2126,dy=.7152,py=.0722;async function fy(n){const e=n2(n);if(!e)return"light";try{return await s2(n,e)>=QD?"light":"dark"}catch{return"light"}}function n2(n){if(typeof document.elementsFromPoint!="function")return null;const e=n.getBoundingClientRect(),t=e.left+e.width/2,r=e.top+e.height/2,i=document.elementsFromPoint(t,r);for(const s of i){if(!(s instanceof HTMLElement)||s===n||n.contains(s))continue;const o=window.getComputedStyle(s);if(r2(o))return s}return null}function r2(n){return n.backgroundImage&&n.backgroundImage!=="none"?!0:i2(n.backgroundColor)>0}function i2(n){if(!n)return 0;const e=n.match(/rgba?\(([^)]+)\)/);if(!e)return 0;const t=e[1].split(/[\s,/]+/).filter(Boolean);return t.length===t2?parseFloat(t[cy]):t.length===uy?1:0}async function s2(n,e){const t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i={x:Zo((t.left-r.left)/r.width),y:Zo((t.top-r.top)/r.height),width:Zo(t.width/r.width),height:Zo(t.height/r.height)},s=window.getComputedStyle(e),o=o2(s.backgroundImage);return o?l2({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):c2(s.backgroundColor)}function o2(n){const e=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return e?e[1]:null}const xf=new Map;function a2(n){let e=xf.get(n);return e||(e=new Promise((t,r)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=()=>t(i),i.onerror=()=>r(new Error(`Failed to load ${n}`)),i.src=n}),xf.set(n,e),e)}async function l2(n){const e=await a2(n.url),t=Math.max(Ef,Math.ceil(n.surfaceWidth*kf)),r=Math.max(Ef,Math.ceil(n.surfaceHeight*kf)),i=document.createElement("canvas");i.width=t,i.height=r;const s=i.getContext("2d",{willReadFrequently:!0});if(!s)return 1;const o=n.surfaceWidth/n.surfaceHeight,a=e.naturalWidth/e.naturalHeight;let c,u;a>o?(u=r,c=r*a):(c=t,u=t/a);const h=(t-c)/2,p=(r-u)/2;s.drawImage(e,h,p,c,u);const v=Math.max(0,Math.floor(n.region.x*t)),m=Math.max(0,Math.floor(n.region.y*r)),x=Math.max(1,Math.min(t-v,Math.floor(n.region.width*t))),E=Math.max(1,Math.min(r-m,Math.floor(n.region.height*r))),T=s.getImageData(v,m,x,E).data;let O=0,P=0;for(let V=0;V<T.length;V+=e2){const F=T[V]/Xn,B=T[V+1]/Xn,U=T[V+2]/Xn,Q=T[V+cy]/Xn;O+=Q*(hy*F+dy*B+py*U),P+=1}return P>0?O/P:1}function c2(n){const e=n.match(/rgba?\(([^)]+)\)/);if(!e)return 1;const t=e[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(t.length<uy)return 1;const r=t[0]/Xn,i=t[1]/Xn,s=t[2]/Xn;return hy*r+dy*i+py*s}function Zo(n){return n<0?0:n>1?1:n}const u2=["ghost","glass"],ys=u2.flatMap(n=>[`button[variant="${n}"]`,`segmented-control[variant="${n}"]`]).join(", "),Wo=new WeakSet,Af=new WeakSet;function gy(n){if(Af.has(n))return;Af.add(n);for(const t of n.querySelectorAll(ys))gc(t);if(typeof MutationObserver!="function")return;new MutationObserver(t=>{for(const r of t)if(r.type==="childList")for(const i of r.addedNodes)h2(i,gc);else r.type==="attributes"&&r.target instanceof HTMLElement&&r.target.matches(ys)&&gc(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant"]})}function h2(n,e){if(n instanceof Element){n instanceof HTMLElement&&n.matches(ys)&&e(n);for(const t of n.querySelectorAll(ys))e(t)}}async function gc(n){if(Wo.has(n)||n.hasAttribute("tone"))return;Wo.add(n);const e=await fy(n);if(!n.matches(ys)){Wo.delete(n);return}if(n.hasAttribute("tone")){Wo.delete(n);return}n.setAttribute("tone",e)}const d2="*,*: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-sm: 24px;--control-height-md: 28px;--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;--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-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-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-md);padding:0 10px}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(--color-overlay-hover)}button[variant=ghost]:active:not(:disabled){background:var(--color-overlay-active);box-shadow:none}button[variant=ghost][data-active]:not(:disabled),button[variant=ghost][data-active]: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);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);backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5);box-shadow:none}button[variant=glass]:hover:not(:disabled){background:linear-gradient(var(--color-overlay-hover),var(--color-overlay-hover))}button[variant=glass]:active:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}[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}: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[icon-only]{width:var(--control-height-md);padding:0}[data-ui-icon]{display:inline-block;vertical-align:middle}.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-200), transparent);--color-overlay-active: color-mix(in srgb, var(--white) var(--alpha-300), 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-100), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-200), 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)}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:var(--color-overlay-backdrop)}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([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(: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>[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: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-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)}',kh=new CSSStyleSheet;kh.replaceSync(d2);try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,kh]}catch{}gy(document);function my(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,kh]}catch{}gy(n)}/**
|
|
50
50
|
* @license
|
|
51
51
|
* Copyright 2017 Google LLC
|
|
52
52
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
53
|
-
*/const
|
|
53
|
+
*/const vy={CHILD:2},Eh=n=>(...e)=>({_$litDirective$:n,values:e});class yy{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
|
|
54
54
|
* @license
|
|
55
55
|
* Copyright 2017 Google LLC
|
|
56
56
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
57
|
-
*/let
|
|
57
|
+
*/let $a=class extends yy{constructor(e){if(super(e),this.it=ne,e.type!==vy.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===ne||e==null)return this._t=void 0,this.it=e;if(e===xi)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};$a.directiveName="unsafeHTML",$a.resultType=1;const p2=Eh($a);/**
|
|
58
58
|
* @license
|
|
59
59
|
* Copyright 2017 Google LLC
|
|
60
60
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
61
|
-
*/class
|
|
61
|
+
*/class nu extends $a{}nu.directiveName="unsafeSVG",nu.resultType=2;const f2=Eh(nu),g2={size:16,color:"currentColor",weight:"regular"};function m2(n){return typeof n=="string"?{regular:n}:n}function sn(n,e="0 0 256 256"){const t=m2(n);return r=>{const{size:i,color:s,weight:o}={...g2,...r},a=t[o]??t.regular;return N`<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="${e}"
|
|
67
67
|
fill="${s}"
|
|
68
|
-
>${
|
|
68
|
+
>${f2(a)}</svg>`}}/**
|
|
69
69
|
* @license
|
|
70
70
|
* Copyright 2020 Google LLC
|
|
71
71
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
72
|
-
*/const
|
|
72
|
+
*/const v2=n=>n.strings===void 0;/**
|
|
73
73
|
* @license
|
|
74
74
|
* Copyright 2017 Google LLC
|
|
75
75
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
76
|
-
*/const
|
|
76
|
+
*/const hs=(n,e)=>{var r;const t=n._$AN;if(t===void 0)return!1;for(const i of t)(r=i._$AO)==null||r.call(i,e,!1),hs(i,e);return!0},Ia=n=>{let e,t;do{if((e=n._$AM)===void 0)break;t=e._$AN,t.delete(n),n=e}while((t==null?void 0:t.size)===0)},by=n=>{for(let e;e=n._$AM;n=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(n))break;t.add(n),w2(e)}};function y2(n){this._$AN!==void 0?(Ia(this),this._$AM=n,by(this)):this._$AM=n}function b2(n,e=!1,t=0){const r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let s=t;s<r.length;s++)hs(r[s],!1),Ia(r[s]);else r!=null&&(hs(r,!1),Ia(r));else hs(this,n)}const w2=n=>{n.type==vy.CHILD&&(n._$AP??(n._$AP=b2),n._$AQ??(n._$AQ=y2))};class S2 extends yy{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),by(this),this.isConnected=e._$AU}_$AO(e,t=!0){var r,i;e!==this.isConnected&&(this.isConnected=e,e?(r=this.reconnected)==null||r.call(this):(i=this.disconnected)==null||i.call(this)),t&&(hs(this,e),Ia(this))}setValue(e){if(v2(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}/**
|
|
77
77
|
* @license
|
|
78
78
|
* Copyright 2020 Google LLC
|
|
79
79
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
80
|
-
*/const ln=()=>new S2;class S2{}const gc=new WeakMap,cn=kh(class extends w2{render(n){return ne}update(n,[e]){var r;const t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=(r=n.options)==null?void 0:r.host,this.rt(this.ct=n.element)),ne}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=gc.get(e);t===void 0&&(t=new WeakMap,gc.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){var n,e;return typeof this.G=="function"?(n=gc.get(this.ht??globalThis))==null?void 0:n.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),_2=sn('<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"/>'),by=sn('<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"/>'),wy=sn('<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"/>'),k2=sn({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"/>'}),E2=sn('<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"/>'),x2=sn({regular:'<path d="M219.31,108.68l-80-80a16,16,0,0,0-22.62,0l-80,80A15.87,15.87,0,0,0,32,120v96a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V160h32v56a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V120A15.87,15.87,0,0,0,219.31,108.68ZM208,208H160V152a8,8,0,0,0-8-8H104a8,8,0,0,0-8,8v56H48V120l80-80,80,80Z"/>',bold:'<path d="M222.14,105.85l-80-80a20,20,0,0,0-28.28,0l-80,80A19.86,19.86,0,0,0,28,120v96a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V164h24v52a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V120A19.86,19.86,0,0,0,222.14,105.85ZM204,204H164V152a12,12,0,0,0-12-12H104a12,12,0,0,0-12,12v52H52V121.65l76-76,76,76Z"/>',fill:'<path d="M224,120v96a8,8,0,0,1-8,8H160a8,8,0,0,1-8-8V164a4,4,0,0,0-4-4H108a4,4,0,0,0-4,4v52a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V120a16,16,0,0,1,4.69-11.31l80-80a16,16,0,0,1,22.62,0l80,80A16,16,0,0,1,224,120Z"/>'}),A2=sn({regular:'<path d="M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM51.31,160,136,75.31,152.69,92,68,176.68ZM48,179.31,76.69,208H48Zm48,25.38L79.31,188,164,103.31,180.69,120Zm96-96L147.31,64l24-24L216,84.68Z"/>',bold:'<path d="M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM93,180l71-71,11,11-71,71ZM76,163,65,152l71-71,11,11ZM52,173l15.51,15.51h0L83,204H52ZM192,103,153,64l18.34-18.34,39,39Z"/>'}),$2=sn({regular:'<path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"/>',bold:'<path d="M216,44H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v4H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V68h4a12,12,0,0,0,0-24ZM104,40h48v4H104Zm84,164H68V68H188Zm-84-48V120a12,12,0,0,1,24,0v36a12,12,0,0,1-24,0Zm40,0V120a12,12,0,0,1,24,0v36a12,12,0,0,1-24,0Z"/>'}),I2=sn({regular:'<path d="M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z"/>',bold:'<path d="M238.15,78.54,177.46,17.86a20,20,0,0,0-28.3,0L97.2,70c-12.43-3.33-36.68-5.72-61.74,14.5a20,20,0,0,0-1.6,29.73l45.46,45.47-39.8,39.8a12,12,0,0,0,17,17l39.8-39.81,45.47,45.46A20,20,0,0,0,155.91,228c.46,0,.93,0,1.4-.05A20,20,0,0,0,171.87,220c4.69-6.23,11-16.13,14.44-28s3.45-22.88.16-33.4l51.7-51.87A20,20,0,0,0,238.15,78.54Zm-74.26,68.79a12,12,0,0,0-2.23,13.84c3.43,6.86,6.9,21-6.28,40.65L54.08,100.53c21.09-14.59,39.53-6.64,41-6a11.67,11.67,0,0,0,13.81-2.29l54.43-54.61,55,55Z"/>',fill:'<path d="M235.33,104l-53.47,53.65c4.56,12.67,6.45,33.89-13.19,60A15.93,15.93,0,0,1,157,224c-.38,0-.75,0-1.13,0a16,16,0,0,1-11.32-4.69L96.29,171,53.66,213.66a8,8,0,0,1-11.32-11.32L85,159.71l-48.3-48.3A16,16,0,0,1,38,87.63c25.42-20.51,49.75-16.48,60.4-13.14L152,20.7a16,16,0,0,1,22.63,0l60.69,60.68A16,16,0,0,1,235.33,104Z"/>'});class T2 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}const Af='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',mc=4;var ze,Jt,lr,Ge,Ds,li,ci,Y,nu,_y,oa,ky,ru,iu,Ls,zs,cr,Ey,su,xy,Ay,aa,Gr;class Sy extends HTMLElement{constructor(){super();w(this,Y);w(this,ze,!1);w(this,Jt,null);w(this,lr);w(this,Ge,null);w(this,Ds,"bottom-start");w(this,li,!1);w(this,ci,!1);w(this,Ls,t=>{l(this,ze)&&(l(this,li)||t.composedPath().includes(this)||(this.open=!1))});w(this,zs,t=>{if(l(this,ze)){if(t.key==="Escape"){t.preventDefault(),this.open=!1;return}t.key==="Tab"&&f(this,Y,Ey).call(this,t)}});w(this,cr,()=>{l(this,ze)&&f(this,Y,aa).call(this)});x(this,lr,this.attachShadow({mode:"open"})),gy(l(this,lr)),f(this,Y,nu).call(this,"anchor")}connectedCallback(){this.removeAttribute("popover"),this.hasAttribute("tone")||this.setAttribute("tone","light"),f(this,Y,nu).call(this,"open"),f(this,Y,Gr).call(this),l(this,ze)&&(f(this,Y,ru).call(this),f(this,Y,oa).call(this))}disconnectedCallback(){f(this,Y,iu).call(this)}attributeChangedCallback(t){t==="open"?f(this,Y,_y).call(this,this.hasAttribute("open")):t==="material"&&l(this,ze)&&(f(this,Y,Gr).call(this),f(this,Y,oa).call(this))}get open(){return l(this,ze)}set open(t){this.toggleAttribute("open",t)}get anchor(){return l(this,Jt)}set anchor(t){l(this,Jt)!==t&&(x(this,Jt,t),l(this,ze)&&f(this,Y,aa).call(this))}}ze=new WeakMap,Jt=new WeakMap,lr=new WeakMap,Ge=new WeakMap,Ds=new WeakMap,li=new WeakMap,ci=new WeakMap,Y=new WeakSet,nu=function(t){if(!Object.prototype.hasOwnProperty.call(this,t))return;const r=this,i=r[t];delete r[t],r[t]=i},_y=function(t){var r,i,s;if(l(this,ze)!==t){if(x(this,ze,t),!this.isConnected){f(this,Y,Gr).call(this);return}t?(x(this,li,!0),setTimeout(()=>{x(this,li,!1)},0),f(this,Y,Gr).call(this),f(this,Y,ru).call(this),f(this,Y,oa).call(this)):(f(this,Y,iu).call(this),(i=(r=l(this,Ge))==null?void 0:r.hidePopover)==null||i.call(r),f(this,Y,Gr).call(this),(s=l(this,Jt))==null||s.focus(),this.dispatchEvent(new T2))}},oa=function(){l(this,ci)||(x(this,ci,!0),queueMicrotask(()=>{x(this,ci,!1),!(!l(this,ze)||!this.isConnected)&&(f(this,Y,ky).call(this),f(this,Y,Ay).call(this))}))},ky=function(){var t,r;if(l(this,Ge)){try{(r=(t=l(this,Ge)).showPopover)==null||r.call(t)}catch{}f(this,Y,aa).call(this)}},ru=function(){document.addEventListener("click",l(this,Ls)),document.addEventListener("keydown",l(this,zs),!0),window.addEventListener("resize",l(this,cr)),window.addEventListener("scroll",l(this,cr),!0)},iu=function(){document.removeEventListener("click",l(this,Ls)),document.removeEventListener("keydown",l(this,zs),!0),window.removeEventListener("resize",l(this,cr)),window.removeEventListener("scroll",l(this,cr),!0)},Ls=new WeakMap,zs=new WeakMap,cr=new WeakMap,Ey=function(t){const r=f(this,Y,su).call(this);if(r.length===0){t.preventDefault();return}const i=r[0],s=r[r.length-1],o=f(this,Y,xy).call(this),a=o instanceof HTMLElement&&r.includes(o);t.shiftKey?(!a||o===i)&&(t.preventDefault(),s.focus()):(!a||o===s)&&(t.preventDefault(),i.focus())},su=function(){if(!l(this,Ge))return[];const t=l(this,Ge).querySelector("slot");if(!(t instanceof HTMLSlotElement))return[];const r=[];for(const i of t.assignedElements({flatten:!0}))if(i instanceof HTMLElement){i.matches(Af)&&r.push(i);for(const s of i.querySelectorAll(Af))r.push(s)}return r},xy=function(){var r;let t=document.activeElement;for(;t&&((r=t.shadowRoot)!=null&&r.activeElement);)t=t.shadowRoot.activeElement;return t},Ay=function(){var r;const t=f(this,Y,su).call(this);t.length>0?t[0].focus():(r=l(this,Ge))==null||r.focus()},aa=function(){if(!l(this,ze)||!l(this,Jt)||!l(this,Ge))return;const t=l(this,Jt).getBoundingClientRect(),r=l(this,Ge).getBoundingClientRect(),s=window.innerHeight-t.bottom,o=r.height+mc,a=s<o&&t.top>o?"top-start":"bottom-start";x(this,Ds,a);const c=a==="bottom-start"?t.bottom+mc:t.top-r.height-mc,u=t.left;l(this,Ge).style.transform=`translate(${u}px, ${c}px)`,l(this,Ge).setAttribute("data-placement",a)},Gr=function(){this.toggleAttribute("open",l(this,ze));const t=this.getAttribute("material")??"paper";Fe(l(this,ze)?N`<div
|
|
80
|
+
*/const ln=()=>new _2;class _2{}const mc=new WeakMap,cn=Eh(class extends S2{render(n){return ne}update(n,[e]){var r;const t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=(r=n.options)==null?void 0:r.host,this.rt(this.ct=n.element)),ne}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=mc.get(e);t===void 0&&(t=new WeakMap,mc.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){var n,e;return typeof this.G=="function"?(n=mc.get(this.ht??globalThis))==null?void 0:n.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),k2=sn('<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"/>'),wy=sn('<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"/>'),Sy=sn('<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"/>'),E2=sn({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"/>'}),x2=sn('<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"/>'),A2=sn({regular:'<path d="M219.31,108.68l-80-80a16,16,0,0,0-22.62,0l-80,80A15.87,15.87,0,0,0,32,120v96a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V160h32v56a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V120A15.87,15.87,0,0,0,219.31,108.68ZM208,208H160V152a8,8,0,0,0-8-8H104a8,8,0,0,0-8,8v56H48V120l80-80,80,80Z"/>',bold:'<path d="M222.14,105.85l-80-80a20,20,0,0,0-28.28,0l-80,80A19.86,19.86,0,0,0,28,120v96a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V164h24v52a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V120A19.86,19.86,0,0,0,222.14,105.85ZM204,204H164V152a12,12,0,0,0-12-12H104a12,12,0,0,0-12,12v52H52V121.65l76-76,76,76Z"/>',fill:'<path d="M224,120v96a8,8,0,0,1-8,8H160a8,8,0,0,1-8-8V164a4,4,0,0,0-4-4H108a4,4,0,0,0-4,4v52a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V120a16,16,0,0,1,4.69-11.31l80-80a16,16,0,0,1,22.62,0l80,80A16,16,0,0,1,224,120Z"/>'}),$2=sn({regular:'<path d="M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM51.31,160,136,75.31,152.69,92,68,176.68ZM48,179.31,76.69,208H48Zm48,25.38L79.31,188,164,103.31,180.69,120Zm96-96L147.31,64l24-24L216,84.68Z"/>',bold:'<path d="M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM93,180l71-71,11,11-71,71ZM76,163,65,152l71-71,11,11ZM52,173l15.51,15.51h0L83,204H52ZM192,103,153,64l18.34-18.34,39,39Z"/>'}),I2=sn({regular:'<path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"/>',bold:'<path d="M216,44H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v4H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V68h4a12,12,0,0,0,0-24ZM104,40h48v4H104Zm84,164H68V68H188Zm-84-48V120a12,12,0,0,1,24,0v36a12,12,0,0,1-24,0Zm40,0V120a12,12,0,0,1,24,0v36a12,12,0,0,1-24,0Z"/>'}),T2=sn({regular:'<path d="M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z"/>',bold:'<path d="M238.15,78.54,177.46,17.86a20,20,0,0,0-28.3,0L97.2,70c-12.43-3.33-36.68-5.72-61.74,14.5a20,20,0,0,0-1.6,29.73l45.46,45.47-39.8,39.8a12,12,0,0,0,17,17l39.8-39.81,45.47,45.46A20,20,0,0,0,155.91,228c.46,0,.93,0,1.4-.05A20,20,0,0,0,171.87,220c4.69-6.23,11-16.13,14.44-28s3.45-22.88.16-33.4l51.7-51.87A20,20,0,0,0,238.15,78.54Zm-74.26,68.79a12,12,0,0,0-2.23,13.84c3.43,6.86,6.9,21-6.28,40.65L54.08,100.53c21.09-14.59,39.53-6.64,41-6a11.67,11.67,0,0,0,13.81-2.29l54.43-54.61,55,55Z"/>',fill:'<path d="M235.33,104l-53.47,53.65c4.56,12.67,6.45,33.89-13.19,60A15.93,15.93,0,0,1,157,224c-.38,0-.75,0-1.13,0a16,16,0,0,1-11.32-4.69L96.29,171,53.66,213.66a8,8,0,0,1-11.32-11.32L85,159.71l-48.3-48.3A16,16,0,0,1,38,87.63c25.42-20.51,49.75-16.48,60.4-13.14L152,20.7a16,16,0,0,1,22.63,0l60.69,60.68A16,16,0,0,1,235.33,104Z"/>'});class C2 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}const $f='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',vc=4;var ze,Jt,lr,je,Ls,ci,ui,Y,ru,ky,aa,Ey,iu,su,zs,Os,cr,xy,ou,Ay,$y,la,Gr;class _y extends HTMLElement{constructor(){super();w(this,Y);w(this,ze,!1);w(this,Jt,null);w(this,lr);w(this,je,null);w(this,Ls,"bottom-start");w(this,ci,!1);w(this,ui,!1);w(this,zs,t=>{l(this,ze)&&(l(this,ci)||t.composedPath().includes(this)||(this.open=!1))});w(this,Os,t=>{if(l(this,ze)){if(t.key==="Escape"){t.preventDefault(),this.open=!1;return}t.key==="Tab"&&f(this,Y,xy).call(this,t)}});w(this,cr,()=>{l(this,ze)&&f(this,Y,la).call(this)});k(this,lr,this.attachShadow({mode:"open"})),my(l(this,lr)),f(this,Y,ru).call(this,"anchor")}connectedCallback(){this.removeAttribute("popover"),this.hasAttribute("tone")||this.setAttribute("tone","light"),f(this,Y,ru).call(this,"open"),f(this,Y,Gr).call(this),l(this,ze)&&(f(this,Y,iu).call(this),f(this,Y,aa).call(this))}disconnectedCallback(){f(this,Y,su).call(this)}attributeChangedCallback(t){t==="open"?f(this,Y,ky).call(this,this.hasAttribute("open")):t==="material"&&l(this,ze)&&(f(this,Y,Gr).call(this),f(this,Y,aa).call(this))}get open(){return l(this,ze)}set open(t){this.toggleAttribute("open",t)}get anchor(){return l(this,Jt)}set anchor(t){l(this,Jt)!==t&&(k(this,Jt,t),l(this,ze)&&f(this,Y,la).call(this))}}ze=new WeakMap,Jt=new WeakMap,lr=new WeakMap,je=new WeakMap,Ls=new WeakMap,ci=new WeakMap,ui=new WeakMap,Y=new WeakSet,ru=function(t){if(!Object.prototype.hasOwnProperty.call(this,t))return;const r=this,i=r[t];delete r[t],r[t]=i},ky=function(t){var r,i,s;if(l(this,ze)!==t){if(k(this,ze,t),!this.isConnected){f(this,Y,Gr).call(this);return}t?(k(this,ci,!0),setTimeout(()=>{k(this,ci,!1)},0),f(this,Y,Gr).call(this),f(this,Y,iu).call(this),f(this,Y,aa).call(this)):(f(this,Y,su).call(this),(i=(r=l(this,je))==null?void 0:r.hidePopover)==null||i.call(r),f(this,Y,Gr).call(this),(s=l(this,Jt))==null||s.focus(),this.dispatchEvent(new C2))}},aa=function(){l(this,ui)||(k(this,ui,!0),queueMicrotask(()=>{k(this,ui,!1),!(!l(this,ze)||!this.isConnected)&&(f(this,Y,Ey).call(this),f(this,Y,$y).call(this))}))},Ey=function(){var t,r;if(l(this,je)){try{(r=(t=l(this,je)).showPopover)==null||r.call(t)}catch{}f(this,Y,la).call(this)}},iu=function(){document.addEventListener("click",l(this,zs)),document.addEventListener("keydown",l(this,Os),!0),window.addEventListener("resize",l(this,cr)),window.addEventListener("scroll",l(this,cr),!0)},su=function(){document.removeEventListener("click",l(this,zs)),document.removeEventListener("keydown",l(this,Os),!0),window.removeEventListener("resize",l(this,cr)),window.removeEventListener("scroll",l(this,cr),!0)},zs=new WeakMap,Os=new WeakMap,cr=new WeakMap,xy=function(t){const r=f(this,Y,ou).call(this);if(r.length===0){t.preventDefault();return}const i=r[0],s=r[r.length-1],o=f(this,Y,Ay).call(this),a=o instanceof HTMLElement&&r.includes(o);t.shiftKey?(!a||o===i)&&(t.preventDefault(),s.focus()):(!a||o===s)&&(t.preventDefault(),i.focus())},ou=function(){if(!l(this,je))return[];const t=l(this,je).querySelector("slot");if(!(t instanceof HTMLSlotElement))return[];const r=[];for(const i of t.assignedElements({flatten:!0}))if(i instanceof HTMLElement){i.matches($f)&&r.push(i);for(const s of i.querySelectorAll($f))r.push(s)}return r},Ay=function(){var r;let t=document.activeElement;for(;t&&((r=t.shadowRoot)!=null&&r.activeElement);)t=t.shadowRoot.activeElement;return t},$y=function(){var r;const t=f(this,Y,ou).call(this);t.length>0?t[0].focus():(r=l(this,je))==null||r.focus()},la=function(){if(!l(this,ze)||!l(this,Jt)||!l(this,je))return;const t=l(this,Jt).getBoundingClientRect(),r=l(this,je).getBoundingClientRect(),s=window.innerHeight-t.bottom,o=r.height+vc,a=s<o&&t.top>o?"top-start":"bottom-start";k(this,Ls,a);const c=a==="bottom-start"?t.bottom+vc:t.top-r.height-vc,u=t.left;l(this,je).style.transform=`translate(${u}px, ${c}px)`,l(this,je).setAttribute("data-placement",a)},Gr=function(){this.toggleAttribute("open",l(this,ze));const t=this.getAttribute("material")??"paper";Fe(l(this,ze)?N`<div
|
|
81
81
|
class="panel"
|
|
82
82
|
part="panel"
|
|
83
83
|
popover="manual"
|
|
84
|
-
data-placement=${l(this,
|
|
84
|
+
data-placement=${l(this,Ls)}
|
|
85
85
|
tabindex="-1"
|
|
86
86
|
role="dialog"
|
|
87
87
|
material=${t}
|
|
88
88
|
level="1"
|
|
89
89
|
>
|
|
90
90
|
<slot></slot>
|
|
91
|
-
</div>`:ne,l(this,lr)),
|
|
92
|
-
<slot name="trigger" @slotchange=${l(this,
|
|
91
|
+
</div>`:ne,l(this,lr)),k(this,je,l(this,lr).querySelector(".panel"))},b(_y,"observedAttributes",["open","material"]);customElements.get("ui-popover")||customElements.define("ui-popover",_y);class Iy extends Event{constructor(t){super("dropdown-item-select",{bubbles:!0,composed:!0});b(this,"value");this.value=t}}class P2 extends Event{constructor(t){super("select",{bubbles:!0,composed:!0});b(this,"value");this.value=t}}var qe,mt,yn,bn,le,Ms,Ns,L,Cy,ns,Py,Ry,au,Dy,rs,Hn,ur,Us,Oa,Fs,Ma,Ly,zy,lu,is,cu,uu,Ht;class Ty extends HTMLElement{constructor(){super();w(this,L);w(this,qe,!1);w(this,mt,null);w(this,yn,null);w(this,bn);w(this,le,null);w(this,Ms,ln());w(this,Ns,new MutationObserver(t=>f(this,L,Ly).call(this,t)));w(this,ur,()=>{f(this,L,rs).call(this,!l(this,qe))});w(this,Us,t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),l(this,ur).call(this))});w(this,Oa,()=>{l(this,qe)&&f(this,L,rs).call(this,!1)});w(this,Fs,t=>{t instanceof Iy&&(t.stopPropagation(),k(this,qe,!1),f(this,L,ns).call(this,t.value),f(this,L,Ht).call(this),this.dispatchEvent(new P2(t.value)))});w(this,Ma,()=>{f(this,L,lu).call(this)});k(this,bn,this.attachShadow({mode:"open"})),my(l(this,bn))}connectedCallback(){this.addEventListener("dropdown-item-select",l(this,Fs)),f(this,L,Cy).call(this),l(this,Ns).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["selected","value","slot"]}),f(this,L,Ht).call(this)}disconnectedCallback(){this.removeEventListener("dropdown-item-select",l(this,Fs)),l(this,Ns).disconnect(),f(this,L,uu).call(this)}attributeChangedCallback(t){if(t==="open"){f(this,L,rs).call(this,this.hasAttribute("open"));return}f(this,L,Ht).call(this)}get open(){return l(this,qe)}set open(t){this.toggleAttribute("open",t)}get title(){return this.getAttribute("title")??""}get value(){return l(this,mt)}set value(t){t===null?(f(this,L,Hn).call(this,null,null),f(this,L,Py).call(this)):f(this,L,ns).call(this,t),f(this,L,Ht).call(this)}close(){f(this,L,rs).call(this,!1)}}qe=new WeakMap,mt=new WeakMap,yn=new WeakMap,bn=new WeakMap,le=new WeakMap,Ms=new WeakMap,Ns=new WeakMap,L=new WeakSet,Cy=function(){var r;const t=this.querySelector("dropdown-item[selected]");t&&f(this,L,Hn).call(this,t.value,((r=t.textContent)==null?void 0:r.trim())??null)},ns=function(t){var r;for(const i of l(this,L,au))i.value===t?(f(this,L,Hn).call(this,t,((r=i.textContent)==null?void 0:r.trim())??null),i.hasAttribute("selected")||i.setAttribute("selected","")):i.hasAttribute("selected")&&i.removeAttribute("selected")},Py=function(){const t=this.querySelectorAll("dropdown-item[selected]");for(const r of t)r.removeAttribute("selected")},Ry=function(t){for(const r of l(this,L,au))if(r.value===t)return r;return null},au=function(){return this.querySelectorAll("dropdown-item")},Dy=function(){return l(this,yn)??this.title},rs=function(t){l(this,qe)!==t&&(k(this,qe,t),f(this,L,Ht).call(this))},Hn=function(t,r){k(this,mt,t),k(this,yn,r)},ur=new WeakMap,Us=new WeakMap,Oa=new WeakMap,Fs=new WeakMap,Ma=new WeakMap,Ly=function(t){t.every(i=>i.target instanceof Element?i.target.closest('[slot="trigger"]')!==null:!1)||f(this,L,zy).call(this)},zy=function(){var r,i;const t=this.querySelector("dropdown-item[selected]");if(t){const s=t.value,o=((r=t.textContent)==null?void 0:r.trim())??null,a=l(this,mt)!==s||l(this,yn)!==o;f(this,L,Hn).call(this,s,o),f(this,L,ns).call(this,s),a?f(this,L,Ht).call(this):f(this,L,is).call(this);return}if(l(this,mt)!==null){const s=f(this,L,Ry).call(this,l(this,mt));if(s){const o=((i=s.textContent)==null?void 0:i.trim())??null,a=l(this,yn)!==o;f(this,L,Hn).call(this,l(this,mt),o),f(this,L,ns).call(this,l(this,mt)),a?f(this,L,Ht).call(this):f(this,L,is).call(this);return}}if(l(this,mt)!==null||l(this,yn)!==null){f(this,L,Hn).call(this,null,null),f(this,L,Ht).call(this);return}f(this,L,is).call(this)},lu=function(){const t=l(this,bn).querySelector('slot[name="trigger"]'),r=t instanceof HTMLSlotElement?t.assignedElements()[0]??null:null;l(this,le)!==r&&(f(this,L,uu).call(this),k(this,le,r),l(this,le)&&(l(this,le).addEventListener("click",l(this,ur)),l(this,le)instanceof HTMLButtonElement?l(this,le).hasAttribute("type")||(l(this,le).type="button"):(l(this,le).hasAttribute("role")||l(this,le).setAttribute("role","button"),l(this,le).hasAttribute("tabindex")||(l(this,le).tabIndex=0),l(this,le).addEventListener("keydown",l(this,Us))))),f(this,L,is).call(this),f(this,L,cu).call(this)},is=function(){l(this,le)&&(l(this,le).setAttribute("data-dropdown-trigger",""),l(this,le).setAttribute("aria-haspopup","listbox"),l(this,le).setAttribute("aria-expanded",l(this,qe)?"true":"false"))},cu=function(){const t=l(this,Ms).value;if(!t)return;const r=l(this,bn).querySelector("button.fallback-trigger");t.anchor=l(this,le)??r??null},uu=function(){l(this,le)&&(l(this,le).removeEventListener("click",l(this,ur)),l(this,le).removeEventListener("keydown",l(this,Us)),l(this,le).removeAttribute("data-dropdown-trigger"),l(this,le).removeAttribute("aria-haspopup"),l(this,le).removeAttribute("aria-expanded"),k(this,le,null))},Ht=function(){this.toggleAttribute("open",l(this,qe)),Fe(N`
|
|
92
|
+
<slot name="trigger" @slotchange=${l(this,Ma)}>
|
|
93
93
|
<button
|
|
94
94
|
class="fallback-trigger"
|
|
95
95
|
part="trigger"
|
|
96
96
|
type="button"
|
|
97
97
|
aria-haspopup="listbox"
|
|
98
|
-
aria-expanded=${l(this,
|
|
98
|
+
aria-expanded=${l(this,qe)?"true":"false"}
|
|
99
99
|
@click=${l(this,ur)}
|
|
100
100
|
>
|
|
101
|
-
<span class="trigger-label" part="trigger-label">${l(this,L,
|
|
101
|
+
<span class="trigger-label" part="trigger-label">${l(this,L,Dy)}</span>
|
|
102
102
|
<span class="trigger-icon" part="trigger-icon" aria-hidden="true">
|
|
103
|
-
${
|
|
103
|
+
${Sy({size:16})}
|
|
104
104
|
</span>
|
|
105
105
|
</button>
|
|
106
106
|
</slot>
|
|
107
107
|
<ui-popover
|
|
108
108
|
class="dropdown-popover"
|
|
109
109
|
material="glass-frosted"
|
|
110
|
-
?open=${l(this,
|
|
111
|
-
@close=${l(this,
|
|
112
|
-
${cn(l(this,
|
|
110
|
+
?open=${l(this,qe)}
|
|
111
|
+
@close=${l(this,Oa)}
|
|
112
|
+
${cn(l(this,Ms))}
|
|
113
113
|
>
|
|
114
|
-
${l(this,
|
|
114
|
+
${l(this,qe)?N`<div class="dropdown-list" part="list" role="listbox">
|
|
115
115
|
<slot></slot>
|
|
116
116
|
</div>`:ne}
|
|
117
117
|
</ui-popover>
|
|
118
|
-
`,l(this,bn)),f(this,L,
|
|
118
|
+
`,l(this,bn)),f(this,L,cu).call(this),queueMicrotask(()=>f(this,L,lu).call(this))},b(Ty,"observedAttributes",["title","open"]);class R2 extends HTMLElement{}class D2 extends HTMLElement{}class L2 extends HTMLElement{}var Er,hu,My,Zs,Ws;class Oy extends HTMLElement{constructor(){super(...arguments);w(this,Er);w(this,Zs,()=>{this.action||f(this,Er,My).call(this)});w(this,Ws,t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.click())})}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","option"),this.hasAttribute("tabindex")||(this.tabIndex=0),this.addEventListener("click",l(this,Zs)),this.addEventListener("keydown",l(this,Ws)),f(this,Er,hu).call(this)}disconnectedCallback(){this.removeEventListener("click",l(this,Zs)),this.removeEventListener("keydown",l(this,Ws))}attributeChangedCallback(){f(this,Er,hu).call(this)}get value(){return this.getAttribute("value")??""}get selected(){return this.hasAttribute("selected")}get action(){return this.hasAttribute("action")}}Er=new WeakSet,hu=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")},My=function(){this.dispatchEvent(new Iy(this.value))},Zs=new WeakMap,Ws=new WeakMap,b(Oy,"observedAttributes",["action","selected","value"]);customElements.get("dropdown-menu")||customElements.define("dropdown-menu",Ty);customElements.get("dropdown-group")||customElements.define("dropdown-group",R2);customElements.get("dropdown-label")||customElements.define("dropdown-label",D2);customElements.get("dropdown-divider")||customElements.define("dropdown-divider",L2);customElements.get("dropdown-item")||customElements.define("dropdown-item",Oy);class z2 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}var Hs,Cn,du,Na,Vs,pu;class Ny extends HTMLElement{constructor(){super();w(this,Cn);w(this,Hs);w(this,Na,t=>{t.target===t.currentTarget&&f(this,Cn,du).call(this)});w(this,Vs,t=>{this.open&&t.key==="Escape"&&f(this,Cn,du).call(this)});k(this,Hs,this.attachShadow({mode:"open"}))}connectedCallback(){document.addEventListener("keydown",l(this,Vs)),f(this,Cn,pu).call(this)}disconnectedCallback(){document.removeEventListener("keydown",l(this,Vs))}attributeChangedCallback(){f(this,Cn,pu).call(this)}get open(){return this.hasAttribute("open")}}Hs=new WeakMap,Cn=new WeakSet,du=function(){this.dispatchEvent(new z2)},Na=new WeakMap,Vs=new WeakMap,pu=function(){Fe(N`
|
|
119
119
|
${this.open?N`
|
|
120
|
-
<div class="backdrop" part="backdrop" @click=${l(this,
|
|
120
|
+
<div class="backdrop" part="backdrop" @click=${l(this,Na)}>
|
|
121
121
|
<slot></slot>
|
|
122
122
|
</div>
|
|
123
123
|
`:null}
|
|
124
|
-
`,l(this,
|
|
124
|
+
`,l(this,Hs))},b(Ny,"observedAttributes",["open"]);customElements.get("modal-overlay")||customElements.define("modal-overlay",Ny);class O2 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}class M2 extends HTMLElement{}var Bs,Gs,fu;class Uy extends HTMLElement{constructor(){super();w(this,Gs);w(this,Bs);k(this,Bs,this.attachShadow({mode:"open"}))}connectedCallback(){f(this,Gs,fu).call(this)}attributeChangedCallback(){f(this,Gs,fu).call(this)}get closable(){return this.hasAttribute("closable")}}Bs=new WeakMap,Gs=new WeakSet,fu=function(){const t=this.querySelector("panel-page");Fe(N`
|
|
125
125
|
<section class="panel" part="panel">
|
|
126
126
|
<header class="title-bar" part="header">
|
|
127
127
|
<h2 class="title" part="title">${(t==null?void 0:t.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
|
|
134
|
+
@click=${()=>this.dispatchEvent(new O2)}
|
|
135
135
|
>
|
|
136
|
-
<span class="close-icon" part="icon close-icon">${
|
|
136
|
+
<span class="close-icon" part="icon close-icon">${wy({size:16})}</span>
|
|
137
137
|
</button>
|
|
138
138
|
`:null}
|
|
139
139
|
</header>
|
|
140
140
|
<slot></slot>
|
|
141
141
|
</section>
|
|
142
|
-
`,l(this,
|
|
143
|
-
${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(o)}const
|
|
142
|
+
`,l(this,Bs))},b(Uy,"observedAttributes",["closable"]);customElements.get("panel-view")||customElements.define("panel-view",Uy);customElements.get("panel-page")||customElements.define("panel-page",M2);function yl(n){return typeof n=="object"&&n!==null}function N2(n){return!yl(n)||n.type!=="wheel"||typeof n.deltaX!="number"||typeof n.deltaY!="number"||typeof n.shiftKey!="boolean"?!1:!("id"in n)}function U2(n){return!yl(n)||n.type!=="swipe-move"||typeof n.deltaX!="number"?!1:!("id"in n)}function F2(n){return!yl(n)||n.type!=="swipe-end"||typeof n.velocityX!="number"?!1:!("id"in n)}function Fy(n){return!yl(n)||n.type!=="open-artifact"||typeof n.artifactID!="string"?!1:!("id"in n)}function Z2(n=window){if(n.parent===n)return;let e=0,t=0;n.document.documentElement&&(n.document.documentElement.style.touchAction="pan-y"),n.addEventListener("wheel",u=>{const h=u;e=h.clientX,t=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 E=h.clientX-p.startX,T=h.clientY-p.startY,O=Math.abs(E),P=Math.abs(T);if(O<r&&P<r)return;if(P>=O){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 m=h.timeStamp-i;let x=0;for(let E=0;E<p.samples.length;E+=1){if(p.samples[E].time>=m){x=E;break}x=E+1}if(x>0){const E=Math.max(0,x-1);p.samples.splice(0,E)}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 m=p.samples[0],x=p.samples[p.samples.length-1],E=x.time-m.time;E>0&&(v=(x.offset-m.offset)/E*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 E,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,m=typeof p.deltaY=="number"?p.deltaY:0;let x=((T=(E=n.document).elementFromPoint)==null?void 0:T.call(E,e,t))??null;for(;x!==null;){const O=n.getComputedStyle(x);if(m!==0){const P=(O.overflowY==="auto"||O.overflowY==="scroll")&&x.scrollHeight>x.clientHeight,V=m>0?x.scrollTop+x.clientHeight<x.scrollHeight:x.scrollTop>0;if(P&&V){x.scrollBy(v,m);return}}if(v!==0){const P=(O.overflowX==="auto"||O.overflowX==="scroll")&&x.scrollWidth>x.clientWidth,V=v>0?x.scrollLeft+x.clientWidth<x.scrollWidth:x.scrollLeft>0;if(P&&V){x.scrollBy(v,m);return}}x=x.parentElement}n.scrollBy(v,m)});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 E of p)if(E instanceof HTMLAnchorElement||E&&E.tagName==="A"){v=E;break}if(v===null)return;const m=v.getAttribute("href");if(m===null)return;let x;try{x=new URL(m,n.document.baseURI).toString()}catch{return}a(x)&&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 W2(){return`(${Z2.toString()})(window);`}const H2=nt(),V2=nt(),B2="No handler registered for update-content",G2="handleUpdateContent: handler already registered";function j2(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const q2=vo(Ot);var hi,di,pi,hr,dr,js,Re,gu,Zy,Wy,ss,mu,ig;let Y2=(ig=class extends q2{constructor(t){super();w(this,Re);w(this,hi);w(this,di);w(this,pi);w(this,hr,null);w(this,dr,null);w(this,js,!1);k(this,hi,t);const r=t.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");k(this,di,r),k(this,pi,i=>f(this,Re,Zy).call(this,i)),l(this,di).addEventListener("message",l(this,pi))}get content(){return l(this,dr)}set content(t){f(this,Re,mu).call(this),k(this,dr,t),l(this,js)&&f(this,Re,gu).call(this,t)}handleUpdateContent(t){if(f(this,Re,mu).call(this),l(this,hr)!==null)throw new Error(G2);k(this,hr,t)}dispose(){l(this,di).removeEventListener("message",l(this,pi)),k(this,hr,null)}},hi=new WeakMap,di=new WeakMap,pi=new WeakMap,hr=new WeakMap,dr=new WeakMap,js=new WeakMap,Re=new WeakSet,gu=function(t){const r={type:"content-updated",content:t};f(this,Re,ss).call(this,r)},Zy=function(t){if(this.disposed||t.source!==l(this,hi).contentWindow)return;const r=t.data;if(ZT(r)){k(this,js,!0),this.dispatchEvent(new H2("ready")),l(this,dr)!==null&&f(this,Re,gu).call(this,l(this,dr));return}if(WT(r)){f(this,Re,Wy).call(this,r);return}if(Fy(r)){this.dispatchEvent(new V2("open-artifact",{artifactID:r.artifactID}));return}},Wy=async function(t){const r=l(this,hr);if(r===null){f(this,Re,ss).call(this,{type:"response",id:t.id,error:{message:B2}});return}try{await r(t.content)}catch(i){if(this.disposed)return;f(this,Re,ss).call(this,{type:"response",id:t.id,error:{message:j2(i)}});return}this.disposed||f(this,Re,ss).call(this,{type:"response",id:t.id,result:{}})},ss=function(t){const r=l(this,hi).contentWindow;r&&r.postMessage(t,"*")},mu=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},ig);async function X2(n){const e=await fetch(n);if(!e.ok)throw new Error(`Failed to fetch artifact content: ${e.status}`);const t=await e.text(),r=new DOMParser().parseFromString(t,"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=W2(),r.head.appendChild(s);const o=new Blob([`<!DOCTYPE html>
|
|
143
|
+
${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(o)}const If="television-artifact-bridge",Hy=nt(),K2=nt();class J2 extends HTMLElement{constructor(){super(...arguments);b(this,"_artifact",null);b(this,"_viewURL",null);b(this,"_contentURL",null);b(this,"_screen",null);b(this,"_subscribedScreen",null);b(this,"_activeView",null);b(this,"_contentState",{kind:"idle"});b(this,"_fetchSequence",0);b(this,"_blobSequence",0);b(this,"_mountedViewURL",null);b(this,"_directRender",!1);b(this,"_blobURL",null);b(this,"_subscribedWebview",null);b(this,"_directRenderMessageListener",null);b(this,"handleScreenContentChanged",t=>{!this._artifact||t.artifactID!==this._artifact.id||this._activeView!==null&&this.refetchContent()});b(this,"handleOpenArtifact",t=>{this.requestFocus(t.artifactID)});b(this,"handleIframeMessage",t=>{const r=this.querySelector("iframe.artifact-frame");!r||r.contentWindow!==t.source||N2(t.data)&&this.dispatchArtifactWheel({deltaX:t.data.deltaX,deltaY:t.data.deltaY,shiftKey:t.data.shiftKey},i=>{var o;const s={type:"scroll",deltaX:0,deltaY:i};(o=r.contentWindow)==null||o.postMessage(s,this.iframeTargetOrigin(r))})});b(this,"handleWebviewIpcMessage",t=>{var o;const r=t.detail??t;if(!r||r.channel!==If)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,If,{type:"scroll",deltaX:0,deltaY:a})})})}set artifact(t){const r=this._artifact;this._artifact=t,this.render(),r!==null&&r!==t&&this.syncView()}get artifact(){return this._artifact}set viewURL(t){this._viewURL!==t&&(this._viewURL=t,this.syncView())}get viewURL(){return this._viewURL}set contentURL(t){this._contentURL!==t&&(this._contentURL=t,this.syncView())}get contentURL(){return this._contentURL}set screen(t){this._screen!==t&&(this._screen=t,this.syncScreenSubscription())}get screen(){return this._screen}set dragging(t){t?this.setAttribute("dragging","true"):this.removeAttribute("dragging")}get dragging(){return this.getAttribute("dragging")==="true"}get activeView(){return this._activeView}connectedCallback(){this.setAttribute("level","2"),this.render(),this.syncView(),this.syncScreenSubscription(),window.addEventListener("message",this.handleIframeMessage)}disconnectedCallback(){this.teardownView(),this.unsubscribeFromScreen(),window.removeEventListener("message",this.handleIframeMessage),this.unsubscribeFromWebview()}handleClose(){this._artifact&&this.dispatchEvent(new Hy("close-artifact",{artifactID:this._artifact.id,bubbles:!0,composed:!0}))}syncView(){var t,r;if(this.isConnected){if((t=this._artifact)!=null&&t.externalURL){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 i=this.querySelector("iframe.artifact-frame");if(!i){this._contentState={kind:"error"},this.render();return}this._activeView=new Y2(i),this._activeView.handleUpdateContent(async s=>{await this.saveContent(s)}),this._activeView.addEventListener("open-artifact",this.handleOpenArtifact),this.loadBlobFrame(this._viewURL),this.startContentFetch();return}this._activeView!==null&&this.startContentFetch();return}if(this._contentURL!==null){this.teardownView(),this._directRender=!0,this._contentState={kind:"idle"},this.render(),this.installDirectRenderMessageListener(),((r=this._artifact)==null?void 0:r.status)==="committed"&&this.loadBlobFrame(this._contentURL);return}this.teardownView(),this._contentState={kind:"idle"},this.render()}}async saveContent(t){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:t})}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))}unsubscribeFromScreen(){this._subscribedScreen!==null&&(this._subscribedScreen.removeEventListener("artifact-content-changed",this.handleScreenContentChanged),this._subscribedScreen=null)}startContentFetch(){this._fetchSequence+=1;const t=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(t!==this._fetchSequence)return;if(!s.ok){this._contentState={kind:"error"},this.teardownView(),this.render();return}const o=await s.text();if(t!==this._fetchSequence||this._activeView!==i)return;this._activeView.content=o,this._contentState={kind:"ready"}}catch{if(t!==this._fetchSequence)return;this._contentState={kind:"error"},this.teardownView(),this.render()}})()}refetchContent(){this._fetchSequence+=1;const t=this._fetchSequence,r=this._contentURL,i=this._activeView;!i||r===null||(async()=>{try{const s=await fetch(r);if(t!==this._fetchSequence||!s.ok)return;const o=await s.text();if(t!==this._fetchSequence||this._activeView!==i)return;this._activeView.content=o}catch{}})()}loadBlobFrame(t){this._blobSequence+=1;const r=this._blobSequence;(async()=>{try{const i=await X2(t);if(r!==this._blobSequence){URL.revokeObjectURL(i);return}this._blobURL=i,this.render();const s=this.querySelector("iframe.artifact-frame");s&&(s.src=i)}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._directRender=!1,this._fetchSequence+=1,this._blobSequence+=1}installDirectRenderMessageListener(){if(this._directRenderMessageListener!==null)return;const t=r=>{const i=this.querySelector("iframe.artifact-frame");i&&r.source===i.contentWindow&&Fy(r.data)&&this.requestFocus(r.data.artifactID)};this._directRenderMessageListener=t,window.addEventListener("message",t)}removeDirectRenderMessageListener(){this._directRenderMessageListener!==null&&(window.removeEventListener("message",this._directRenderMessageListener),this._directRenderMessageListener=null)}requestFocus(t){const r=this._screen;r&&r.server.client.viewer.focus({artifactID:t}).catch(i=>{console.warn("artifact-view: viewer.focus failed",i)})}contentTemplate(){var t;if((t=this._artifact)!=null&&t.externalURL){const r=this._artifact.externalURL;return wh()?N`
|
|
144
144
|
<webview
|
|
145
145
|
class="artifact-frame artifact-content"
|
|
146
146
|
src=${r}
|
|
@@ -170,7 +170,7 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
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">${
|
|
173
|
+
<span class="artifact-title-icon">${k2({size:16})}</span>
|
|
174
174
|
<span class="artifact-title">${t.title}</span>
|
|
175
175
|
</div>
|
|
176
176
|
<button
|
|
@@ -180,10 +180,10 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
180
180
|
@click=${()=>this.handleClose()}
|
|
181
181
|
aria-label="Close"
|
|
182
182
|
>
|
|
183
|
-
${
|
|
183
|
+
${wy({size:16})}
|
|
184
184
|
</button>
|
|
185
185
|
</footer>
|
|
186
|
-
`}render(){this._artifact&&(this.setAttribute("type",this._artifact.type),Fe(this.template(),this),this.syncWebviewSubscription())}dispatchArtifactWheel(t,r){this.dispatchEvent(new X2("artifact-wheel",{bubbles:!0,composed:!0,deltaX:t.deltaX,deltaY:t.deltaY,shiftKey:t.shiftKey,scrollNative:r}))}syncWebviewSubscription(){const t=this.querySelector("webview");t!==this._subscribedWebview&&(this.unsubscribeFromWebview(),t&&(t.addEventListener("ipc-message",this.handleWebviewIpcMessage),this._subscribedWebview=t))}unsubscribeFromWebview(){this._subscribedWebview&&(this._subscribedWebview.removeEventListener("ipc-message",this.handleWebviewIpcMessage),this._subscribedWebview=null)}iframeTargetOrigin(t){const r=t.getAttribute("sandbox")??"";if(!new Set(r.split(/\s+/).filter(Boolean)).has("allow-same-origin"))return"*";const s=t.getAttribute("src")??t.src;if(!s)return"*";try{return new URL(s,window.location.href).origin}catch{return"*"}}}customElements.define("artifact-view",K2);const xe=n=>({type:"px",...n}),ye=n=>({type:"unit",...n}),Wo=2;class J2{constructor(e){b(this,"basis");b(this,"min");b(this,"_gap");b(this,"_viewport");b(this,"_unit");this.basis=e.basis,this.min=e.min,this._viewport=e.viewport,this._gap=e.gap??xe({x:ce,y:ce});const t=this._viewport.x??br,r=this._viewport.y??ba,i=this._gap.x??ce,s=this._gap.y??ce,o=t<=xx,a=o?t-i*Wo:Math.min(br,t-i*Wo),c=o?r-s*Wo:Math.min(ba,r-s*Wo),u=(a-i*(wt-1))/wt,h=(c-s*(tt-1))/tt,p=this.basis.x??0,v=this.basis.y??0,m=this.min.x??0,E=this.min.y??0;this._unit=xe(o?{x:Math.max(m,u),y:Math.max(E,h)}:{x:Math.max(m,Math.min(p,u)),y:Math.max(E,Math.min(v,h))})}get unit(){return this._unit}get viewport(){return this._viewport}get gap(){return this._gap}toUnits(e){return ye({x:e.x==null?void 0:e.x/(this._unit.x??1),y:e.y==null?void 0:e.y/(this._unit.y??1)})}toPixels(e){const t=this._unit.x??0,r=this._unit.y??0,i=this._gap.x??ce,s=this._gap.y??ce,o=e.x==null?void 0:e.x*t+Math.max(0,e.x-1)*i,a=e.y==null?void 0:e.y*r+Math.max(0,e.y-1)*s;return xe({x:o,y:a})}}const _r=1e-4,vt=1e-6,Q2=40,eL=24;function Hy(n,e){return Math.max(0,n-e*2)}function Vy(n){const e=[0];for(const t of n)e.push((e[e.length-1]??0)+t);return e}function By(n){const e=[0];for(let t=0;t<n.length;t+=1){const r=e[t]??0;e.push(r+n[t]+ce)}return e}function Gy(n,e,t){if(e<0||e>=n.length)return 0;let r=0,i=0;for(let s=e;s<n.length;s+=1){const o=n[s],a=i===0?o:r+ce+o;if(a>t+_r)break;r=a,i+=1}return Math.max(1,i)}function tL(n,e,t){if(e<0||e>=n.length)return 0;let r=0,i=0;for(let s=e;s>=0;s-=1){const o=n[s],a=i===0?o:r+ce+o;if(a>t+_r)break;r=a,i+=1}return Math.max(1,i)}function nL(n,e){if(n.length===0)return 0;let t=0,r=0;for(let i=n.length-1;i>=0;i-=1){const s=n[i],o=r===0?s:t+ce+s;if(o>e+_r)break;t=o,r+=1}return Math.max(1,r)}function Eh(n,e){if(n.length===0)return 0;const t=nL(n,e);return Math.max(0,n.length-t)}function If(n,e,t){if(n.length===0)return 0;const r=Gy(n,e,t),i=Math.min(n.length,e+r);if(i<=e)return 0;const s=n.slice(e,i);return s.reduce((o,a)=>o+a,0)+Math.max(0,s.length-1)*ce}function mu(n,e,t){const r=n[e]??0;return t-r}function jr(n,e,t,r,i){if(n.length===0)return 0;const s=Eh(n,i),o=e[s]??0,a=Math.max(0,Math.min(o,t));let c=0;for(let B=0;B<s;B+=1){const U=e[B]??0,Q=e[B+1]??U;if(a>=U&&a<=Q+_r){c=B;break}c=B+1}const u=Math.min(c+1,s),h=e[c]??0,p=e[u]??h,v=Math.max(p-h,_r),m=u===c?0:(a-h)/v,E=By(n),k=If(n,c,i),T=If(n,u,i),O=(r-k)/2,P=(r-T)/2,V=mu(E,c,O),F=mu(E,u,P);return V+(F-V)*m}function rL(n,e,t,r,i){const s=Eh(n,r),o=e[s]??0;let a=0,c=o;for(let u=0;u<Q2;u+=1){const h=(a+c)/2;jr(n,e,h,t,r)>i?a=h:c=h}return(a+c)/2}function iL(n,e,t){const r=By(n),[i,s]=e,o=n.slice(i,s+1),a=o.reduce((u,h)=>u+h,0)+Math.max(0,o.length-1)*ce,c=(t-a)/2;return mu(r,i,c)}function sL(n,e,t){const r=Gy(n,e,t);return[e,Math.min(n.length-1,e+r-1)]}function oL(n,e,t){const r=tL(n,e,t);return[Math.max(0,e-r+1),e]}function aL(n,e){return n[0]===e[0]&&n[1]===e[1]}function lL(n){const{nodeCols:e,nodeWidthsPx:t,viewportWidthPx:r}=n;if(e.length===0||t.length===0)return{viewspans:[],minScroll:0,maxScroll:0};const i=t.length,s=n.gapPx??ce,o=Hy(r,s),a=Vy(e),c=Eh(t,o),u=a[c]??0;function h(T){const O=iL(t,T,r),P=rL(t,a,r,o,O);return{nodeRange:T,anchor:Math.max(0,Math.min(u,P))}}const p=[];for(let T=0;T<i;){const O=sL(t,T,o);p.push(h(O)),T=O[1]+1}const v=h(oL(t,i-1,o)),m=p.filter(T=>T.nodeRange[0]<v.nodeRange[0]),E=m[m.length-1];return{viewspans:E&&aL(E.nodeRange,v.nodeRange)?m:[...m,v],minScroll:0,maxScroll:u}}function Fr(n,e){var i;let t=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)-e);if(o+vt<r){r=o,t=s;continue}Math.abs(o-r)<=vt&&s<t&&(t=s)}return t}function cL(n,e,t){return t<=0?0:Math.max(0,Math.min(t-1,n+e))}function Un(n,e,t){return Math.max(e,Math.min(t,n))}function uL(n,e){var t;for(let r=0;r<n.length;r+=1)if(Math.abs((((t=n[r])==null?void 0:t.anchor)??0)-e)<=vt)return r;return-1}function hL(n,e,t){var i,s;if(n.length===0)return e;const r=uL(n,e);if(r>=0){const o=n[r+t];return(o==null?void 0:o.anchor)??n[t>0?n.length-1:0].anchor}if(t>0){for(const o of n)if(o.anchor>e+vt)return o.anchor;return((i=n[n.length-1])==null?void 0:i.anchor)??e}for(let o=n.length-1;o>=0;o-=1){const a=n[o];if(a&&a.anchor<e-vt)return a.anchor}return((s=n[0])==null?void 0:s.anchor)??e}class dL extends Ot{constructor(t){super();b(this,"_scroll",0);b(this,"_minScroll",0);b(this,"_maxScroll",0);b(this,"_viewspans",[]);b(this,"_activeViewspanIndex",0);b(this,"_nodeWidthsPx",[]);b(this,"_boundaryCols",[0]);b(this,"_viewportWidthPx",0);b(this,"_framedViewportWidthPx",0);this._scroll=(t==null?void 0:t.x)??0}get scroll(){return ye({x:this._scroll})}get translate(){return xe({x:jr(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(t){const r=Un(t.x??this._scroll,this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=vt||(this._scroll=r,this._activeViewspanIndex=Fr(this._viewspans,this._scroll),this.dispatchEvent(new Ur("layout-scroll",{scroll:this.scroll})))}rebuild(t){var v;const r=t.nodeWidths.map(m=>Math.max(0,m.x??0)),i=r.map(m=>t.grid.toPixels(ye({x:m})).x??0),s=t.grid.viewport.x??0,o=t.grid.gap.x??ce,a=lL({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this._nodeWidthsPx=i,this._boundaryCols=Vy(r),this._viewportWidthPx=s,this._framedViewportWidthPx=Hy(s,o),this._viewspans=a.viewspans,this._minScroll=a.minScroll,this._maxScroll=a.maxScroll;const c=Un(this._scroll,this._minScroll,this._maxScroll);this._activeViewspanIndex=Fr(this._viewspans,c);const h=t.snap!==!1?((v=this._viewspans[this._activeViewspanIndex])==null?void 0:v.anchor)??c:c,p=Un(h,this._minScroll,this._maxScroll);Math.abs(p-this._scroll)>vt&&(this._scroll=p,this.dispatchEvent(new Ur("layout-scroll",{scroll:this.scroll})))}step(t){var o;if(this._viewspans.length===0)return;const r=cL(this._activeViewspanIndex,t,this._viewspans.length),i=((o=this._viewspans[r])==null?void 0:o.anchor)??this._scroll,s=Un(i,this._minScroll,this._maxScroll);this._activeViewspanIndex=r,!(Math.abs(s-this._scroll)<=vt)&&(this._scroll=s,this.dispatchEvent(new Ur("layout-scroll",{scroll:this.scroll})))}snap(t){var s;if(this._viewspans.length===0)return;const r=t===void 0?((s=this._viewspans[Fr(this._viewspans,this._scroll)])==null?void 0:s.anchor)??this._scroll:hL(this._viewspans,this._scroll,t),i=Un(r,this._minScroll,this._maxScroll);this._activeViewspanIndex=Fr(this._viewspans,i),!(Math.abs(i-this._scroll)<=vt)&&(this._scroll=i,this.dispatchEvent(new Ur("layout-scroll",{scroll:this.scroll})))}wheel(t){const r=Un(this._scroll+(t.x??0),this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=vt||(this._scroll=r,this._activeViewspanIndex=Fr(this._viewspans,this._scroll),this.dispatchEvent(new Ur("layout-scroll",{scroll:this.scroll})))}wheelPixels(t){const r=t.x??0;if(Math.abs(r)<=_r)return;const i=jr(this._nodeWidthsPx,this._boundaryCols,this._scroll,this._viewportWidthPx,this._framedViewportWidthPx),s=i-r,o=jr(this._nodeWidthsPx,this._boundaryCols,this._maxScroll,this._viewportWidthPx,this._framedViewportWidthPx),a=jr(this._nodeWidthsPx,this._boundaryCols,this._minScroll,this._viewportWidthPx,this._framedViewportWidthPx),c=Math.max(o,Math.min(a,s));if(Math.abs(c-i)<=_r)return;let u=this._minScroll,h=this._maxScroll;for(let v=0;v<eL;v+=1){const m=(u+h)/2;jr(this._nodeWidthsPx,this._boundaryCols,m,this._viewportWidthPx,this._framedViewportWidthPx)>c?u=m:h=m}const p=Un((u+h)/2,this._minScroll,this._maxScroll);Math.abs(p-this._scroll)<=vt||(this._scroll=p,this._activeViewspanIndex=Fr(this._viewspans,this._scroll),this.dispatchEvent(new Ur("layout-scroll",{scroll:this.scroll})))}}const vc={"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}},pL=["stack-above","stack-below","reorder-before","reorder-after"];function yc(n,e){return{left:n.left+n.width*e.left,top:n.top+n.height*e.top,width:n.width*e.width,height:n.height*e.height}}function Fn(n,e,t){return n>=t.left&&n<t.left+t.width&&e>=t.top&&e<t.top+t.height}function vu(n){return Number.isFinite(n)?Math.max(ds,Math.min(oh,Math.round(n))):ds}function fL(n,e,t){const r=n.findIndex(a=>a.type==="card"&&a.id===e);if(r===-1)return n;const i=n[r];if(!i||i.type!=="card")return n;const s=vu(t);if(i.width===s)return n;const o=[...n];return o[r]={...i,width:s},o}function xh(n,e){for(const t of n){if(t.type==="card"&&t.id===e)return t;if(t.type==="stack")for(const r of t.children){if(r.type==="card"&&r.id===e)return r;if(r.type==="row"){for(const i of r.children)if(i.id===e)return i}}}return null}function yu(n){return n.height===tt||n.height===An?{...n,height:An}:n}function bu(n){return n.height===An?{...n,height:tt}:n}function gL(n,e,t,r){const i=n.findIndex(h=>h.type==="stack"&&h.id===e);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===t);if(!o||o.type!=="card")return n;const a=s.children.filter(h=>h.id!==t);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"?bu(h):h}else c[i]={...s,children:a};const u=Math.max(0,Math.min(r,c.length));return c.splice(u,0,bu(o)),c}const mL=nt(),vL=nt(),yL=50;function bL(n,e){if(n.type!==e.type)return!1;switch(n.type){case"reorder":return e.index===n.index;case"stack":return e.targetCardId===n.targetCardId&&e.position===n.position;case"stack-child-noop":return!0;case"stack-child-extract":return e.toIndex===n.toIndex;case"stack-child-reorder":return e.position===n.position;default:return!1}}function yo(n){return{id:n.id,type:"drop-target",width:n.width,height:n.height}}function Tf(n){return n.map(SL)}function wL(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function SL(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(wL)}:n}function jy(n,e){return n.find(r=>r.type==="card"&&r.id===e)??null}function Cf(n,e){return n.find(r=>r.type==="stack"&&r.id===e)??null}function _L(n,e){const t=[...e],r=t.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(r===-1)return null;const i=t[r];if(!i||i.type!=="card")return null;t.splice(r,1);const s=Math.max(0,Math.min(n.lastReorderIndex,t.length));t.splice(s,0,i);const o=t.findIndex(a=>a.type==="card"&&a.id===n.nodeId);return o===-1?null:{base:t,visualDraggedIndex:o}}function kL(n,e,t,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(v=>v.type==="card"&&v.id===t.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=jy(r,e.nodeId);if(!a)return null;const c=yu(a),u=yu(o),h=yo(c),p=t.position==="above"?[h,u]:[u,h];return i[s]={id:o.id,type:"stack",children:p},i}function bc(n,e){return n.parentStackId?xL(n,e):EL(n,e)}function EL(n,e){const t=n.hitTarget;if(t.type==="reorder"){const r=e[n.sourceIndex];if(!r||r.type!=="card")return[...e];const i=[...e];return i.splice(n.sourceIndex,1),i.splice(t.index,0,yo(r)),i}if(t.type==="stack"){const r=_L(n,e);return r?kL(r,n,t,e)??[...e]:[...e]}return[...e]}function xL(n,e){const t=n.hitTarget;switch(t.type){case"stack-child-reorder":return AL(n,e,t.position);case"stack-child-extract":return $L(n,e,t.toIndex);case"stack-child-noop":return IL(n,e);default:return[...e]}}function AL(n,e,t){const r=e.findIndex(v=>v.type==="stack"&&v.id===n.parentStackId);if(r===-1)return[...e];const i=e[r];if(!i||i.type!=="stack")return[...e];if(!i.children.every(v=>v.type==="card"))return[...e];const s=i.children,o=s.findIndex(v=>v.id===n.nodeId);if(o===-1)return[...e];const a=s[o],c=s.filter(v=>v.id!==n.nodeId),u=yo(a),h=t==="above"?[u,...c]:[...c,u],p=[...e];return p[r]={...i,children:h},p}function $L(n,e,t){if(!n.parentStackId)return[...e];const r=gL(e,n.parentStackId,n.nodeId,t);if(r===e)return[...e];const i=r.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(i===-1)return[...e];const s=r[i];if(!s||s.type!=="card")return[...e];const o=[...r];return o[i]=yo(s),o}function IL(n,e){const t=e.findIndex(c=>c.type==="stack"&&c.id===n.parentStackId);if(t===-1)return[...e];const r=e[t];if(!r||r.type!=="stack")return[...e];const i=r.children.findIndex(c=>c.type==="card"&&c.id===n.nodeId);if(i===-1)return[...e];const s=r.children[i];if(!s||s.type!=="card")return[...e];const o=[...e],a=[...r.children];return a[i]=yo(s),o[t]={...r,children:a},o}function TL(n,e){return e.find(r=>r.type==="stack"&&r.id===n.id)?n.id:al()}function CL(n,e,t){if(n.type==="drop-target"){const r=xh(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return yu(r)}return n}function PL(n,e,t){const r=n.children.map(s=>CL(s,e,t));return{id:TL(n,e),type:"stack",children:r}}function RL(n,e,t){if(n.type==="drop-target"){const r=xh(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return jy(e,t)!==null?r:bu(r)}return n.type==="card"||n.type==="row"?n:PL(n,e,t)}function DL(n,e,t){return n.map(r=>RL(r,e,t))}function LL(n,e){return JSON.stringify(n)===JSON.stringify(e)}const zL=mo(Ot);class OL extends zL{constructor(t={}){super();b(this,"pending",null);b(this,"active",null)}start(t){if(this.pending||this.active)return;const r=t.pointer.x??0,i=t.pointer.y??0;this.pending={startX:r,startY:i,grabOffsetX:t.grabOffset.x??0,grabOffsetY:t.grabOffset.y??0,nodeId:t.nodeId,sourceIndex:t.source.index,parentStackId:t.source.parentId,width:t.size.x??0,height:t.size.y??0,baseLayout:t.layout}}update(t){const r=t.pointer.x??0,i=t.pointer.y??0,s=this.pending;if(s){const u=r-s.startX,h=i-s.startY;Math.hypot(u,h)>=$x&&(this.pending=null,this.active={...s,pointerX:r,pointerY:i,hitTarget:{type:"reorder",index:s.sourceIndex},lastReorderIndex:s.sourceIndex},this.emitDrag(),this.dispatchEvent(new ie("change")));return}if(!this.active)return;const o=bc(this.active,this.active.baseLayout),a=this.getHitTargetForPointer(r,i,t,o),c=a.type==="reorder"?a.index:this.active.lastReorderIndex;this.active.pointerX===r&&this.active.pointerY===i&&bL(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 ie("change")))}drop(){if(this.pending){this.cancel();return}if(!this.active)return;const t=this.active.baseLayout;let r=null;try{const i=bc(this.active,t),s=DL(i,t,this.active.nodeId);LL(s,t)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new vL("drop",{layout:r})),this.dispatchEvent(new ie("change"))}cancel(){!this.pending&&!this.active||(this.reset(),this.dispatchEvent(new ie("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 t=bc(this.active,this.active.baseLayout);this.dispatchEvent(new mL("drag",{nodeId:this.active.nodeId,source:{index:this.active.sourceIndex,parentId:this.active.parentStackId},grabOffset:xe({x:this.active.grabOffsetX,y:this.active.grabOffsetY}),pointer:xe({x:this.active.pointerX,y:this.active.pointerY}),size:xe({x:this.active.width,y:this.active.height}),projectedLayout:t}))}getHitTargetForPointer(t,r,i,s){return this.active?this.isPointerInsideDragBounds(t,r,i.viewport)?this.active.parentStackId?this.getStackChildHitTarget(t,r,i,s):this.getTopLevelCardHitTarget(t,r,i,s):{type:"reorder",index:this.active.sourceIndex}:{type:"reorder",index:0}}getStackChildHitTarget(t,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&&Fn(t,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&&Fn(t,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(t,r,i,s)}}getSourceRemainingSiblingRect(t){var s,o;if(!((s=this.active)!=null&&s.parentStackId))return;const r=Cf(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=t.find(a=>a.id===i.id))==null?void 0:o.rect}getSourceStackInteractionRect(t){var o;if(!((o=this.active)!=null&&o.parentStackId))return;const r=t.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=Cf(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=t.find(c=>c.id===s.id);if(a)return a.rect}return this.active.sourceStackRect}getTopLevelCardHitTarget(t,r,i,s){var m,E,k;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return{type:"reorder",index:((m=this.active)==null?void 0:m.sourceIndex)??0};const c=(i.effectiveVelocity??0)<=yL;for(const T of o){const O=T.rect;if(!Fn(t,r,O))continue;const P=this.resolveTopLevelTargetForCard(t,r,T,T.logicalIndex,c);if(P)return P;if(!c&&((E=this.active)!=null&&E.hitTarget))return this.active.hitTarget}const u=this.getNearestTargetableZone(t,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,t)),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:t<v?u.logicalIndex:u.logicalIndex+1}}getTopLevelReorderIndexForPointer(t,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(!Fn(t,r,p.rect))continue;const v=yc(p.rect,vc["reorder-before"]);if(Fn(t,r,v))return p.logicalIndex;const m=yc(p.rect,vc["reorder-after"]);if(Fn(t,r,m))return p.logicalIndex+1}const a=this.getNearestTargetableZone(t,o);if(!a)return((h=this.active)==null?void 0:h.sourceIndex)??0;const c=a.rect.left+a.rect.width/2;return t<c?a.logicalIndex:a.logicalIndex+1}getTopLevelZoneNodes(t,r){const i=new Map(r.map(a=>[a.id,a])),s=[];let o=0;for(const a of t){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(t,r,i,s,o){const a=i.rect;for(const c of pL){if(!o&&(c==="stack-above"||c==="stack-below"))continue;const u=vc[c],h=yc(a,u);if(Fn(t,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(t,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=t<a?a-t:t>c?t-c:0;u<s&&(s=u,i=o)}return i}isPointerInsideDragBounds(t,r,i){return t>=i.left&&t<=i.left+i.width&&r>=i.top&&r<=i.top+i.height}}const Pf=60,ML=80,Rf=.5,Df=10;class NL{constructor(){b(this,"awaitingFreshWheelGesture",!1);b(this,"lastWheelEventAt",Number.NEGATIVE_INFINITY);b(this,"lastWheelDeltaX",0);b(this,"activeGestureType","none");b(this,"lastWheelGestureAt",Number.NEGATIVE_INFINITY)}markKeyboardNavigation(e){this.awaitingFreshWheelGesture=!0,this.lastWheelEventAt=e,this.activeGestureType="none"}reset(){this.awaitingFreshWheelGesture=!1,this.lastWheelEventAt=Number.NEGATIVE_INFINITY,this.lastWheelDeltaX=0,this.activeGestureType="none",this.lastWheelGestureAt=Number.NEGATIVE_INFINITY}decide(e){const{now:t,shiftKey:r,deltaX:i,deltaY:s,overArtifactContent:o}=e;t-this.lastWheelGestureAt>=Pf&&(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>=Rf&&h>=p*Df?this.classifyHorizontal(t,u):(this.lastWheelGestureAt=t,{type:"scroll-native"}):this.activeGestureType==="horizontal-filmstrip"?!c&&o&&p>0&&p>=h*Df?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=t,{type:"scroll-native"}):this.classifyHorizontal(t,u):h<Rf?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=t,{type:"scroll-native"}):c||h>p?this.classifyHorizontal(t,u):p>h?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=t,{type:"scroll-native"}):o?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=t,{type:"scroll-native"}):this.classifyHorizontal(t,u)}classifyHorizontal(e,t){const r=e-this.lastWheelEventAt,i=Math.sign(this.lastWheelDeltaX),s=Math.sign(t),o=i!==0&&s!==0&&i!==s,a=i!==0&&Math.abs(t)>=Math.abs(this.lastWheelDeltaX)+ML;return this.awaitingFreshWheelGesture&&r<Pf&&!o&&!a?{type:"ignore"}:(this.lastWheelEventAt=e,this.lastWheelDeltaX=t,this.lastWheelGestureAt=e,this.awaitingFreshWheelGesture=!1,this.activeGestureType="horizontal-filmstrip",{type:"scroll-horizontal",horizontalDelta:t})}}const UL=100,FL=1e3;class ZL{constructor(e,t){b(this,"_status","idle");b(this,"cumulativeOffset",0);b(this,"samples",[]);b(this,"scroll");b(this,"setAnimating");this.scroll=e,this.setAnimating=t}get status(){return this._status}start(e){this._status="active",this.cumulativeOffset=0,this.samples=[{time:e,offset:0}]}move(e,t){this._status==="active"&&(this.cumulativeOffset+=t,this.samples.push({time:e,offset:this.cumulativeOffset}),this.pruneSamples(e),this.setAnimating(!1),this.scroll.wheelPixels(xe({x:-t})))}end(){if(this._status!=="active")return;const e=this.computeVelocityPxPerSec();this.setAnimating(!0),Math.abs(e)<Tx?this.scroll.snap():this.scroll.snap(e>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(e){const t=e-UL;let r=0;for(let i=0;i<this.samples.length;i+=1){if(this.samples[i].time>=t){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 e=this.samples[0],t=this.samples[this.samples.length-1],r=t.time-e.time;return r<=0?0:(t.offset-e.offset)/r*FL}}const WL=2,Lf=1e3,Ho=1e-4,HL=120,zf=!1;function VL(n){return n.replace(/["\\]/g,"\\$&")}function Of(n,e,t){if(n===0)return 0;const r=e.toPixels(ye({y:tt})).y??0;return(t-r)/WL}function wc(n){const e=n.clientWidth>0?n.clientWidth:br,t=n.clientHeight>0?n.clientHeight:ba;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,t-r-i);return{width:e,height:s,offsetY:r}}class BL extends Event{constructor(t){super("scroll",{bubbles:!0,composed:!0});b(this,"scrollPosition");this.scrollPosition=t}}class qy extends Event{constructor(t){super("layout-change",{bubbles:!0,composed:!0});b(this,"layout");this.layout=t}}class GL extends HTMLElement{constructor(){super();b(this,"_layout",[]);b(this,"_scrollPosition",0);b(this,"layoutGrid",null);b(this,"layoutScroll",new dL(ye({x:0})));b(this,"scrollModelKey","");b(this,"resizeObserver",null);b(this,"renderPending",!1);b(this,"animateNextRender",!0);b(this,"wheelGesture",new NL);b(this,"swipeGesture",new ZL(this.layoutScroll,t=>{this.animateNextRender=t}));b(this,"swipePointerId",null);b(this,"swipeStartX",0);b(this,"swipeStartY",0);b(this,"swipeLastX",0);b(this,"swipeActive",!1);b(this,"swipeShouldSuppressClick",!1);b(this,"swipeListenersAttached",!1);b(this,"wheelIdleSnapTimer",null);b(this,"dragController",new OL);b(this,"dragState",null);b(this,"activeDragPointerId",null);b(this,"dragListenersAttached",!1);b(this,"dragFrame",0);b(this,"lastDragFrameTime",0);b(this,"lastPointerX",0);b(this,"lastPointerY",0);b(this,"pointerVelocityPxPerSec",0);b(this,"scrollVelocityPxPerSec",0);b(this,"motionSampleTime",0);b(this,"motionSampleX",0);b(this,"motionSampleY",0);b(this,"dragTrackOffsetXPx",0);b(this,"previousProjectedLayoutForOffset",null);b(this,"resizeState",null);b(this,"resizeListenersAttached",!1);b(this,"renderContent",()=>N``);b(this,"onDragControllerChange",()=>{this.dragController.status==="idle"&&(this.dragState=null,this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null),this.scheduleRender()});b(this,"onDragControllerDrag",t=>{const r=Tf(t.projectedLayout),i=this.shouldApplyTrackOffset(t.projectedLayout,t.source.parentId),s=t.source.parentId?this.getStackChildAnchorCardId(t.source.parentId,t.nodeId):null;this.dragTrackOffsetXPx=i?this.computeDragTrackOffset(this.previousProjectedLayoutForOffset,r,t.nodeId,t.source.parentId,s,this.dragTrackOffsetXPx):0,this.previousProjectedLayoutForOffset=r,this.dragState={nodeId:t.nodeId,source:t.source,grabOffset:t.grabOffset,pointer:t.pointer,size:t.size,projectedLayout:t.projectedLayout},this.scheduleRender()});b(this,"onDragControllerDrop",t=>{this.dragState=null,this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null,this.commitLayout(t.layout)});b(this,"onLayoutScrollInternal",t=>{const i=t.scroll.x??0;Math.abs(i-this._scrollPosition)<Ho||(this._scrollPosition=i,this.emitScrollPositionChanged(i),this.scheduleRender())});b(this,"handleKeyDown",t=>{if(t.key==="Escape"&&this.dragController.status!=="idle"){t.preventDefault(),this.stopDragFrameLoop(),this.releaseActiveDragPointerCapture(),this.dragController.cancel(),this.detachDragListeners();return}this.dragController.status==="idle"&&(t.key==="ArrowRight"?(t.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(1)):t.key==="ArrowLeft"&&(t.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(-1)))});b(this,"handleWheel",t=>{if(this._layout.length===0)return;const r=this.wheelGesture.decide({now:Date.now(),shiftKey:t.shiftKey,deltaX:t.deltaX,deltaY:t.deltaY,overArtifactContent:!1});r.type==="scroll-horizontal"&&(t.preventDefault(),this.applyHorizontalWheel(r.horizontalDelta))});b(this,"handleWindowMessage",t=>{if(this._layout.length===0)return;const r=this.findManagedArtifactFrame(t.source);if(r&&this.isTrustedArtifactFrameMessage(t,r)){if(N2(t.data)){const i=typeof performance<"u"?performance.now():Date.now();this.swipeGesture.status==="idle"&&this.swipeGesture.start(i),this.swipeGesture.move(i,t.data.deltaX);return}if(U2(t.data)){this.swipeGesture.status==="active"&&this.swipeGesture.end();return}}});b(this,"handleArtifactWheel",t=>{if(this._layout.length===0)return;const r=this.wheelGesture.decide({now:Date.now(),shiftKey:t.shiftKey,deltaX:t.deltaX,deltaY:t.deltaY,overArtifactContent:!0});if(r.type==="scroll-horizontal"){this.applyHorizontalWheel(r.horizontalDelta);return}r.type==="scroll-native"&&t.scrollNative(t.deltaY)});b(this,"handlePointerDown",t=>{if(t.button!==0||this.dragController.status!=="idle"||this.resizeState)return;const r=t.target;if(!(r instanceof Element))return;const i=r.closest("[data-resize-handle]");if(i){this.beginResize(t,i);return}const s=r.closest("[drag-handle]")!==null,o=r.closest("button, input, textarea, select, a, [role='button']")!==null;if(t.pointerType==="touch"&&!s&&!o&&this._layout.length>0){this.beginSwipeTracking(t);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 m=parseInt(v,10);if(!isNaN(m)){const E=this.findViewspanContainingNode(m);if(E){this.clearWheelIdleSnap(),this.animateNextRender=!0,this.layoutScroll.scroll=ye({x:E.anchor}),t.preventDefault(),t.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=qL(this._layout,c);if(!u)return;const h=a.getBoundingClientRect();this.lastPointerX=t.clientX,this.lastPointerY=t.clientY,this.resetMotionTracking(t.clientX,t.clientY),this.focus(),this.dragController.start({nodeId:c,source:{index:u.topLevelIndex,parentId:u.sourceStackId},pointer:xe({x:t.clientX,y:t.clientY}),grabOffset:xe({x:t.clientX-h.left,y:t.clientY-h.top}),size:xe({x:h.width,y:h.height}),layout:this._layout}),this.attachDragListeners(),this.activeDragPointerId=t.pointerId;try{this.setPointerCapture(t.pointerId)}catch{}t.preventDefault()});b(this,"handleResizePointerMove",t=>{const r=this.resizeState;if(!r||t.pointerId!==r.pointerId)return;const i=this.layoutGrid,s=((i==null?void 0:i.unit.x)??hn)+ce;if(s<=0)return;const o=t.clientX-r.startClientX,a=vu(r.startWidth+o/s);a!==r.currentWidth&&(r.currentWidth=a,this.scheduleRender())});b(this,"handleResizePointerUp",t=>{const r=this.resizeState;if(!r||t.pointerId!==r.pointerId)return;const i=r.currentWidth,s=r.startWidth,o=r.cardId;this.endResize(t.pointerId),i!==s?this.commitLayout(fL(this._layout,o,i)):this.scheduleRender()});b(this,"handleResizePointerCancel",t=>{!this.resizeState||t.pointerId!==this.resizeState.pointerId||(this.endResize(t.pointerId),this.scheduleRender())});b(this,"handleResizeWindowBlur",()=>{this.resizeState&&(this.endResize(this.resizeState.pointerId),this.scheduleRender())});b(this,"handleResizeKeyDown",t=>{this.resizeState&&t.key==="Escape"&&(t.preventDefault(),this.endResize(this.resizeState.pointerId),this.scheduleRender())});b(this,"handleSwipePointerMove",t=>{if(this.swipePointerId===null||t.pointerId!==this.swipePointerId)return;if(!this.swipeActive){const i=t.clientX-this.swipeStartX,s=t.clientY-this.swipeStartY,o=Math.abs(i),a=Math.abs(s);if(o<Mp&&a<Mp)return;if(a>=o){this.endSwipeTracking();return}this.swipeActive=!0,this.swipeShouldSuppressClick=!0;try{this.setPointerCapture(t.pointerId)}catch{}this.swipeGesture.start(t.timeStamp)}const r=t.clientX-this.swipeLastX;this.swipeLastX=t.clientX,this.swipeGesture.move(t.timeStamp,r),t.preventDefault()});b(this,"handleSwipePointerUp",t=>{this.swipePointerId===null||t.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.end(),this.releaseSwipePointerCapture(t.pointerId),this.endSwipeTracking())});b(this,"handleSwipePointerCancel",t=>{this.swipePointerId===null||t.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.cancel(),this.releaseSwipePointerCapture(t.pointerId),this.endSwipeTracking())});b(this,"handleSwipeWindowBlur",()=>{this.swipePointerId!==null&&this.swipeActive&&this.swipeGesture.cancel(),this.swipePointerId!==null&&this.releaseSwipePointerCapture(this.swipePointerId),this.endSwipeTracking()});b(this,"handleSwipeClick",t=>{this.swipeShouldSuppressClick&&(this.swipeShouldSuppressClick=!1,t.preventDefault(),t.stopPropagation(),typeof t.stopImmediatePropagation=="function"&&t.stopImmediatePropagation())});b(this,"handleWindowPointerMove",t=>{this.lastPointerX=t.clientX,this.lastPointerY=t.clientY,this.updatePointerVelocity(t.clientX,t.clientY),this.syncDragTargetForLatestPointer(),this.ensureDragFrameLoop()});b(this,"handleWindowPointerUp",t=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(t.pointerId),this.dragController.drop(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"handleWindowPointerCancel",t=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(t.pointerId),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"handleWindowBlur",()=>{this.releaseActiveDragPointerCapture(),this.stopDragFrameLoop(),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"runDragFrame",t=>{if(this.dragController.status==="idle"){this.dragFrame=0;return}const r=Math.max(0,t-this.lastDragFrameTime)/Lf;this.lastDragFrameTime=t,this.samplePointerVelocityAt(t,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>Ho?Math.abs(o)/r:0,Math.abs(o)>Ho&&(this.animateNextRender=!1,this.layoutScroll.wheelPixels(xe({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 layout(t){this._layout=[...t],this.stopDragFrameLoop(),this.dragController.cancel(),this.resizeState&&this.endResize(this.resizeState.pointerId),this.scrollModelKey="",this.syncScrollModel(),this.layoutScroll.scroll=ye({x:this._scrollPosition}),this.scheduleRender()}get layout(){return this._layout}commitLayout(t){this.layout=t,this.emitLayoutChanged()}set scrollPosition(t){Math.abs(t-this._scrollPosition)<Ho||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=ye({x:t}))}get scrollPosition(){return this._scrollPosition}focusArtifact(t){const r=Xr(this._layout),i=r.nodes.findIndex(o=>o.cards.some(a=>a.artifactID===t));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="${VL(t)}"]`);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 t;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),(t=this.resizeObserver)==null||t.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(t,r){return new J2({basis:xe({x:hn,y:hn}),min:xe({x:zp,y:zp}),viewport:xe({x:t,y:r}),gap:xe({x:ce,y:ce})})}syncScrollModel(){const t=wc(this),i=Xr(this._layout).nodes.map(o=>o.width),s=`${t.width}x${t.height}:${i.join(",")}`;s===this.scrollModelKey&&this.layoutGrid||(this.scrollModelKey=s,this.layoutGrid=this.createGrid(t.width,t.height),this.layoutScroll.rebuild({grid:this.layoutGrid,nodeWidths:i.map(o=>ye({x:o})),snap:zf}))}emitScrollPositionChanged(t){this.dispatchEvent(new BL(t))}emitLayoutChanged(){this.dispatchEvent(new qy([...this._layout]))}shiftWindow(t){this.clearWheelIdleSnap(),this.syncScrollModel(),this.animateNextRender=!0,this.layoutScroll.step(t)}applyHorizontalWheel(t){this.syncScrollModel();const r=this.layoutGrid;if(!r)return;this.animateNextRender=!1;const i=r.toUnits(xe({x:t}));this.layoutScroll.wheel(ye({x:i.x??0}))}scheduleWheelIdleSnap(){this.clearWheelIdleSnap(),this.wheelIdleSnapTimer=setTimeout(()=>{this.wheelIdleSnapTimer=null,this.animateNextRender=!0,this.layoutScroll.snap()},HL)}clearWheelIdleSnap(){this.wheelIdleSnapTimer!==null&&(clearTimeout(this.wheelIdleSnapTimer),this.wheelIdleSnapTimer=null)}findViewspanContainingNode(t){const r=this.layoutScroll.viewspans,i=this._scrollPosition;let s=null,o=Number.POSITIVE_INFINITY;for(const a of r)if(t>=a.nodeRange[0]&&t<=a.nodeRange[1]){const c=Math.abs(a.anchor-i);c<o&&(o=c,s=a)}return s}findManagedArtifactFrame(t){if(!t)return null;const r=this.querySelectorAll("iframe.artifact-frame");for(const i of r)if(i.contentWindow===t)return i;return null}isTrustedArtifactFrameMessage(t,r){if(t.origin==="null")return!0;const i=this.getArtifactFrameOrigin(r);return i===null||t.origin===i}getArtifactFrameOrigin(t){const r=t.getAttribute("src")??t.src;if(!r)return null;try{return new URL(r,window.location.href).origin}catch{return null}}beginResize(t,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=vu(typeof s.width=="number"?s.width:wt);this.resizeState={cardId:i,pointerId:t.pointerId,startClientX:t.clientX,startWidth:o,currentWidth:o},this.attachResizeListeners();try{this.setPointerCapture(t.pointerId)}catch{}t.preventDefault(),t.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(t){this.resizeState=null,this.detachResizeListeners();try{this.hasPointerCapture(t)&&this.releasePointerCapture(t)}catch{}}beginSwipeTracking(t){this.swipePointerId=t.pointerId,this.swipeStartX=t.clientX,this.swipeStartY=t.clientY,this.swipeLastX=t.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(t){try{this.hasPointerCapture(t)&&this.releasePointerCapture(t)}catch{}}releaseActiveDragPointerCapture(){this.activeDragPointerId!==null&&this.releasePointerCaptureForEvent(this.activeDragPointerId)}releasePointerCaptureForEvent(t){try{this.hasPointerCapture(t)&&this.releasePointerCapture(t)}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)}getDisplayModel(){if(this.dragController.status!=="active"||!this.dragState)return{layout:this.applyResizeOverride(this._layout),activePlaceholderId:null,placeholdersById:new Map};const t=new Map;return t.set(this.dragState.nodeId,{id:this.dragState.nodeId,sourceCardId:this.dragState.nodeId}),{layout:Tf(this.dragState.projectedLayout),activePlaceholderId:this.dragState.nodeId,placeholdersById:t}}applyResizeOverride(t){const r=this.resizeState;if(!r)return t;const i=t.findIndex(a=>a.type==="card"&&a.id===r.cardId);if(i===-1)return t;const s=t[i];if(!s||s.type!=="card"||s.width===r.currentWidth)return t;const o=[...t];return o[i]={...s,width:r.currentWidth},o}render(){const t=wc(this),r=this.createGrid(t.width,t.height);this.layoutGrid=r;const i=this.getDisplayModel(),s=i.layout,o=this.dragController.status==="active",a=Xr(s),c=a.nodes.map(U=>U.width),u=`${t.width}x${t.height}:${c.join(",")}`;!o&&u!==this.scrollModelKey&&(this.scrollModelKey=u,this.layoutScroll.rebuild({grid:r,nodeWidths:c.map(U=>ye({x:U})),snap:zf}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const h=jL(s),p=r.unit.x??hn,v=r.unit.y??hn,m=o?this.dragTrackOffsetXPx:0,E=(this.layoutScroll.translate.x??0)+m,k=Of(a.nodes.length,r,t.height),T=this.animateNextRender&&!o,O=[`transform: translate(${E}px, ${k}px);`,`transition-duration: ${T?Ax:0}ms;`,`pointer-events: ${o?"none":"auto"};`].join(" ");this.animateNextRender=!0,this.style.setProperty("--layout-unit-x",`${p}px`),this.style.setProperty("--layout-unit-y",`${v}px`),this.style.setProperty("--layout-gap",`${ce}px`);const P=this.dragState,V={width:(P==null?void 0:P.size.x)??0,height:(P==null?void 0:P.size.y)??0},F=new Set;{for(let Q=0;Q<a.nodes.length;Q+=1)r.toPixels(ye({x:a.nodes[Q].width})).x;let U=E;for(let Q=0;Q<a.nodes.length;Q+=1){const j=r.toPixels(ye({x:a.nodes[Q].width})).x??0,rt=U+j;U>=-1&&rt<=t.width+1&&F.add(Q),U=rt+ce}}const B=U=>F.has(U);Fe(N`
|
|
186
|
+
`}render(){this._artifact&&(this.setAttribute("type",this._artifact.type),Fe(this.template(),this),this.syncWebviewSubscription())}dispatchArtifactWheel(t,r){this.dispatchEvent(new K2("artifact-wheel",{bubbles:!0,composed:!0,deltaX:t.deltaX,deltaY:t.deltaY,shiftKey:t.shiftKey,scrollNative:r}))}syncWebviewSubscription(){const t=this.querySelector("webview");t!==this._subscribedWebview&&(this.unsubscribeFromWebview(),t&&(t.addEventListener("ipc-message",this.handleWebviewIpcMessage),this._subscribedWebview=t))}unsubscribeFromWebview(){this._subscribedWebview&&(this._subscribedWebview.removeEventListener("ipc-message",this.handleWebviewIpcMessage),this._subscribedWebview=null)}iframeTargetOrigin(t){const r=t.getAttribute("sandbox")??"";if(!new Set(r.split(/\s+/).filter(Boolean)).has("allow-same-origin"))return"*";const s=t.getAttribute("src")??t.src;if(!s)return"*";try{return new URL(s,window.location.href).origin}catch{return"*"}}}customElements.define("artifact-view",J2);const xe=n=>({type:"px",...n}),ye=n=>({type:"unit",...n}),Ho=2;class Q2{constructor(e){b(this,"basis");b(this,"min");b(this,"_gap");b(this,"_viewport");b(this,"_unit");this.basis=e.basis,this.min=e.min,this._viewport=e.viewport,this._gap=e.gap??xe({x:ce,y:ce});const t=this._viewport.x??br,r=this._viewport.y??wa,i=this._gap.x??ce,s=this._gap.y??ce,o=t<=Ax,a=o?t-i*Ho:Math.min(br,t-i*Ho),c=o?r-s*Ho:Math.min(wa,r-s*Ho),u=(a-i*(wt-1))/wt,h=(c-s*(tt-1))/tt,p=this.basis.x??0,v=this.basis.y??0,m=this.min.x??0,x=this.min.y??0;this._unit=xe(o?{x:Math.max(m,u),y:Math.max(x,h)}:{x:Math.max(m,Math.min(p,u)),y:Math.max(x,Math.min(v,h))})}get unit(){return this._unit}get viewport(){return this._viewport}get gap(){return this._gap}toUnits(e){return ye({x:e.x==null?void 0:e.x/(this._unit.x??1),y:e.y==null?void 0:e.y/(this._unit.y??1)})}toPixels(e){const t=this._unit.x??0,r=this._unit.y??0,i=this._gap.x??ce,s=this._gap.y??ce,o=e.x==null?void 0:e.x*t+Math.max(0,e.x-1)*i,a=e.y==null?void 0:e.y*r+Math.max(0,e.y-1)*s;return xe({x:o,y:a})}}const _r=1e-4,vt=1e-6,eL=40,tL=24;function Vy(n,e){return Math.max(0,n-e*2)}function By(n){const e=[0];for(const t of n)e.push((e[e.length-1]??0)+t);return e}function Gy(n){const e=[0];for(let t=0;t<n.length;t+=1){const r=e[t]??0;e.push(r+n[t]+ce)}return e}function jy(n,e,t){if(e<0||e>=n.length)return 0;let r=0,i=0;for(let s=e;s<n.length;s+=1){const o=n[s],a=i===0?o:r+ce+o;if(a>t+_r)break;r=a,i+=1}return Math.max(1,i)}function nL(n,e,t){if(e<0||e>=n.length)return 0;let r=0,i=0;for(let s=e;s>=0;s-=1){const o=n[s],a=i===0?o:r+ce+o;if(a>t+_r)break;r=a,i+=1}return Math.max(1,i)}function rL(n,e){if(n.length===0)return 0;let t=0,r=0;for(let i=n.length-1;i>=0;i-=1){const s=n[i],o=r===0?s:t+ce+s;if(o>e+_r)break;t=o,r+=1}return Math.max(1,r)}function xh(n,e){if(n.length===0)return 0;const t=rL(n,e);return Math.max(0,n.length-t)}function Tf(n,e,t){if(n.length===0)return 0;const r=jy(n,e,t),i=Math.min(n.length,e+r);if(i<=e)return 0;const s=n.slice(e,i);return s.reduce((o,a)=>o+a,0)+Math.max(0,s.length-1)*ce}function vu(n,e,t){const r=n[e]??0;return t-r}function jr(n,e,t,r,i){if(n.length===0)return 0;const s=xh(n,i),o=e[s]??0,a=Math.max(0,Math.min(o,t));let c=0;for(let B=0;B<s;B+=1){const U=e[B]??0,Q=e[B+1]??U;if(a>=U&&a<=Q+_r){c=B;break}c=B+1}const u=Math.min(c+1,s),h=e[c]??0,p=e[u]??h,v=Math.max(p-h,_r),m=u===c?0:(a-h)/v,x=Gy(n),E=Tf(n,c,i),T=Tf(n,u,i),O=(r-E)/2,P=(r-T)/2,V=vu(x,c,O),F=vu(x,u,P);return V+(F-V)*m}function iL(n,e,t,r,i){const s=xh(n,r),o=e[s]??0;let a=0,c=o;for(let u=0;u<eL;u+=1){const h=(a+c)/2;jr(n,e,h,t,r)>i?a=h:c=h}return(a+c)/2}function sL(n,e,t){const r=Gy(n),[i,s]=e,o=n.slice(i,s+1),a=o.reduce((u,h)=>u+h,0)+Math.max(0,o.length-1)*ce,c=(t-a)/2;return vu(r,i,c)}function oL(n,e,t){const r=jy(n,e,t);return[e,Math.min(n.length-1,e+r-1)]}function aL(n,e,t){const r=nL(n,e,t);return[Math.max(0,e-r+1),e]}function lL(n,e){return n[0]===e[0]&&n[1]===e[1]}function cL(n){const{nodeCols:e,nodeWidthsPx:t,viewportWidthPx:r}=n;if(e.length===0||t.length===0)return{viewspans:[],minScroll:0,maxScroll:0};const i=t.length,s=n.gapPx??ce,o=Vy(r,s),a=By(e),c=xh(t,o),u=a[c]??0;function h(T){const O=sL(t,T,r),P=iL(t,a,r,o,O);return{nodeRange:T,anchor:Math.max(0,Math.min(u,P))}}const p=[];for(let T=0;T<i;){const O=oL(t,T,o);p.push(h(O)),T=O[1]+1}const v=h(aL(t,i-1,o)),m=p.filter(T=>T.nodeRange[0]<v.nodeRange[0]),x=m[m.length-1];return{viewspans:x&&lL(x.nodeRange,v.nodeRange)?m:[...m,v],minScroll:0,maxScroll:u}}function Fr(n,e){var i;let t=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)-e);if(o+vt<r){r=o,t=s;continue}Math.abs(o-r)<=vt&&s<t&&(t=s)}return t}function uL(n,e,t){return t<=0?0:Math.max(0,Math.min(t-1,n+e))}function Un(n,e,t){return Math.max(e,Math.min(t,n))}function hL(n,e){var t;for(let r=0;r<n.length;r+=1)if(Math.abs((((t=n[r])==null?void 0:t.anchor)??0)-e)<=vt)return r;return-1}function dL(n,e,t){var i,s;if(n.length===0)return e;const r=hL(n,e);if(r>=0){const o=n[r+t];return(o==null?void 0:o.anchor)??n[t>0?n.length-1:0].anchor}if(t>0){for(const o of n)if(o.anchor>e+vt)return o.anchor;return((i=n[n.length-1])==null?void 0:i.anchor)??e}for(let o=n.length-1;o>=0;o-=1){const a=n[o];if(a&&a.anchor<e-vt)return a.anchor}return((s=n[0])==null?void 0:s.anchor)??e}class pL extends Ot{constructor(t){super();b(this,"_scroll",0);b(this,"_minScroll",0);b(this,"_maxScroll",0);b(this,"_viewspans",[]);b(this,"_activeViewspanIndex",0);b(this,"_nodeWidthsPx",[]);b(this,"_boundaryCols",[0]);b(this,"_viewportWidthPx",0);b(this,"_framedViewportWidthPx",0);this._scroll=(t==null?void 0:t.x)??0}get scroll(){return ye({x:this._scroll})}get translate(){return xe({x:jr(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(t){const r=Un(t.x??this._scroll,this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=vt||(this._scroll=r,this._activeViewspanIndex=Fr(this._viewspans,this._scroll),this.dispatchEvent(new Ur("layout-scroll",{scroll:this.scroll})))}rebuild(t){var v;const r=t.nodeWidths.map(m=>Math.max(0,m.x??0)),i=r.map(m=>t.grid.toPixels(ye({x:m})).x??0),s=t.grid.viewport.x??0,o=t.grid.gap.x??ce,a=cL({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this._nodeWidthsPx=i,this._boundaryCols=By(r),this._viewportWidthPx=s,this._framedViewportWidthPx=Vy(s,o),this._viewspans=a.viewspans,this._minScroll=a.minScroll,this._maxScroll=a.maxScroll;const c=Un(this._scroll,this._minScroll,this._maxScroll);this._activeViewspanIndex=Fr(this._viewspans,c);const h=t.snap!==!1?((v=this._viewspans[this._activeViewspanIndex])==null?void 0:v.anchor)??c:c,p=Un(h,this._minScroll,this._maxScroll);Math.abs(p-this._scroll)>vt&&(this._scroll=p,this.dispatchEvent(new Ur("layout-scroll",{scroll:this.scroll})))}step(t){var o;if(this._viewspans.length===0)return;const r=uL(this._activeViewspanIndex,t,this._viewspans.length),i=((o=this._viewspans[r])==null?void 0:o.anchor)??this._scroll,s=Un(i,this._minScroll,this._maxScroll);this._activeViewspanIndex=r,!(Math.abs(s-this._scroll)<=vt)&&(this._scroll=s,this.dispatchEvent(new Ur("layout-scroll",{scroll:this.scroll})))}snap(t){var s;if(this._viewspans.length===0)return;const r=t===void 0?((s=this._viewspans[Fr(this._viewspans,this._scroll)])==null?void 0:s.anchor)??this._scroll:dL(this._viewspans,this._scroll,t),i=Un(r,this._minScroll,this._maxScroll);this._activeViewspanIndex=Fr(this._viewspans,i),!(Math.abs(i-this._scroll)<=vt)&&(this._scroll=i,this.dispatchEvent(new Ur("layout-scroll",{scroll:this.scroll})))}wheel(t){const r=Un(this._scroll+(t.x??0),this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=vt||(this._scroll=r,this._activeViewspanIndex=Fr(this._viewspans,this._scroll),this.dispatchEvent(new Ur("layout-scroll",{scroll:this.scroll})))}wheelPixels(t){const r=t.x??0;if(Math.abs(r)<=_r)return;const i=jr(this._nodeWidthsPx,this._boundaryCols,this._scroll,this._viewportWidthPx,this._framedViewportWidthPx),s=i-r,o=jr(this._nodeWidthsPx,this._boundaryCols,this._maxScroll,this._viewportWidthPx,this._framedViewportWidthPx),a=jr(this._nodeWidthsPx,this._boundaryCols,this._minScroll,this._viewportWidthPx,this._framedViewportWidthPx),c=Math.max(o,Math.min(a,s));if(Math.abs(c-i)<=_r)return;let u=this._minScroll,h=this._maxScroll;for(let v=0;v<tL;v+=1){const m=(u+h)/2;jr(this._nodeWidthsPx,this._boundaryCols,m,this._viewportWidthPx,this._framedViewportWidthPx)>c?u=m:h=m}const p=Un((u+h)/2,this._minScroll,this._maxScroll);Math.abs(p-this._scroll)<=vt||(this._scroll=p,this._activeViewspanIndex=Fr(this._viewspans,this._scroll),this.dispatchEvent(new Ur("layout-scroll",{scroll:this.scroll})))}}const yc={"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}},fL=["stack-above","stack-below","reorder-before","reorder-after"];function bc(n,e){return{left:n.left+n.width*e.left,top:n.top+n.height*e.top,width:n.width*e.width,height:n.height*e.height}}function Fn(n,e,t){return n>=t.left&&n<t.left+t.width&&e>=t.top&&e<t.top+t.height}function yu(n){return Number.isFinite(n)?Math.max(ps,Math.min(ah,Math.round(n))):ps}function gL(n,e,t){const r=n.findIndex(a=>a.type==="card"&&a.id===e);if(r===-1)return n;const i=n[r];if(!i||i.type!=="card")return n;const s=yu(t);if(i.width===s)return n;const o=[...n];return o[r]={...i,width:s},o}function Ah(n,e){for(const t of n){if(t.type==="card"&&t.id===e)return t;if(t.type==="stack")for(const r of t.children){if(r.type==="card"&&r.id===e)return r;if(r.type==="row"){for(const i of r.children)if(i.id===e)return i}}}return null}function bu(n){return n.height===tt||n.height===An?{...n,height:An}:n}function wu(n){return n.height===An?{...n,height:tt}:n}function mL(n,e,t,r){const i=n.findIndex(h=>h.type==="stack"&&h.id===e);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===t);if(!o||o.type!=="card")return n;const a=s.children.filter(h=>h.id!==t);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"?wu(h):h}else c[i]={...s,children:a};const u=Math.max(0,Math.min(r,c.length));return c.splice(u,0,wu(o)),c}const vL=nt(),yL=nt(),bL=50;function wL(n,e){if(n.type!==e.type)return!1;switch(n.type){case"reorder":return e.index===n.index;case"stack":return e.targetCardId===n.targetCardId&&e.position===n.position;case"stack-child-noop":return!0;case"stack-child-extract":return e.toIndex===n.toIndex;case"stack-child-reorder":return e.position===n.position;default:return!1}}function bo(n){return{id:n.id,type:"drop-target",width:n.width,height:n.height}}function Cf(n){return n.map(_L)}function SL(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function _L(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(SL)}:n}function qy(n,e){return n.find(r=>r.type==="card"&&r.id===e)??null}function Pf(n,e){return n.find(r=>r.type==="stack"&&r.id===e)??null}function kL(n,e){const t=[...e],r=t.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(r===-1)return null;const i=t[r];if(!i||i.type!=="card")return null;t.splice(r,1);const s=Math.max(0,Math.min(n.lastReorderIndex,t.length));t.splice(s,0,i);const o=t.findIndex(a=>a.type==="card"&&a.id===n.nodeId);return o===-1?null:{base:t,visualDraggedIndex:o}}function EL(n,e,t,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(v=>v.type==="card"&&v.id===t.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=qy(r,e.nodeId);if(!a)return null;const c=bu(a),u=bu(o),h=bo(c),p=t.position==="above"?[h,u]:[u,h];return i[s]={id:o.id,type:"stack",children:p},i}function wc(n,e){return n.parentStackId?AL(n,e):xL(n,e)}function xL(n,e){const t=n.hitTarget;if(t.type==="reorder"){const r=e[n.sourceIndex];if(!r||r.type!=="card")return[...e];const i=[...e];return i.splice(n.sourceIndex,1),i.splice(t.index,0,bo(r)),i}if(t.type==="stack"){const r=kL(n,e);return r?EL(r,n,t,e)??[...e]:[...e]}return[...e]}function AL(n,e){const t=n.hitTarget;switch(t.type){case"stack-child-reorder":return $L(n,e,t.position);case"stack-child-extract":return IL(n,e,t.toIndex);case"stack-child-noop":return TL(n,e);default:return[...e]}}function $L(n,e,t){const r=e.findIndex(v=>v.type==="stack"&&v.id===n.parentStackId);if(r===-1)return[...e];const i=e[r];if(!i||i.type!=="stack")return[...e];if(!i.children.every(v=>v.type==="card"))return[...e];const s=i.children,o=s.findIndex(v=>v.id===n.nodeId);if(o===-1)return[...e];const a=s[o],c=s.filter(v=>v.id!==n.nodeId),u=bo(a),h=t==="above"?[u,...c]:[...c,u],p=[...e];return p[r]={...i,children:h},p}function IL(n,e,t){if(!n.parentStackId)return[...e];const r=mL(e,n.parentStackId,n.nodeId,t);if(r===e)return[...e];const i=r.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(i===-1)return[...e];const s=r[i];if(!s||s.type!=="card")return[...e];const o=[...r];return o[i]=bo(s),o}function TL(n,e){const t=e.findIndex(c=>c.type==="stack"&&c.id===n.parentStackId);if(t===-1)return[...e];const r=e[t];if(!r||r.type!=="stack")return[...e];const i=r.children.findIndex(c=>c.type==="card"&&c.id===n.nodeId);if(i===-1)return[...e];const s=r.children[i];if(!s||s.type!=="card")return[...e];const o=[...e],a=[...r.children];return a[i]=bo(s),o[t]={...r,children:a},o}function CL(n,e){return e.find(r=>r.type==="stack"&&r.id===n.id)?n.id:ll()}function PL(n,e,t){if(n.type==="drop-target"){const r=Ah(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return bu(r)}return n}function RL(n,e,t){const r=n.children.map(s=>PL(s,e,t));return{id:CL(n,e),type:"stack",children:r}}function DL(n,e,t){if(n.type==="drop-target"){const r=Ah(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return qy(e,t)!==null?r:wu(r)}return n.type==="card"||n.type==="row"?n:RL(n,e,t)}function LL(n,e,t){return n.map(r=>DL(r,e,t))}function zL(n,e){return JSON.stringify(n)===JSON.stringify(e)}const OL=vo(Ot);class ML extends OL{constructor(t={}){super();b(this,"pending",null);b(this,"active",null)}start(t){if(this.pending||this.active)return;const r=t.pointer.x??0,i=t.pointer.y??0;this.pending={startX:r,startY:i,grabOffsetX:t.grabOffset.x??0,grabOffsetY:t.grabOffset.y??0,nodeId:t.nodeId,sourceIndex:t.source.index,parentStackId:t.source.parentId,width:t.size.x??0,height:t.size.y??0,baseLayout:t.layout}}update(t){const r=t.pointer.x??0,i=t.pointer.y??0,s=this.pending;if(s){const u=r-s.startX,h=i-s.startY;Math.hypot(u,h)>=Ix&&(this.pending=null,this.active={...s,pointerX:r,pointerY:i,hitTarget:{type:"reorder",index:s.sourceIndex},lastReorderIndex:s.sourceIndex},this.emitDrag(),this.dispatchEvent(new ie("change")));return}if(!this.active)return;const o=wc(this.active,this.active.baseLayout),a=this.getHitTargetForPointer(r,i,t,o),c=a.type==="reorder"?a.index:this.active.lastReorderIndex;this.active.pointerX===r&&this.active.pointerY===i&&wL(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 ie("change")))}drop(){if(this.pending){this.cancel();return}if(!this.active)return;const t=this.active.baseLayout;let r=null;try{const i=wc(this.active,t),s=LL(i,t,this.active.nodeId);zL(s,t)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new yL("drop",{layout:r})),this.dispatchEvent(new ie("change"))}cancel(){!this.pending&&!this.active||(this.reset(),this.dispatchEvent(new ie("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 t=wc(this.active,this.active.baseLayout);this.dispatchEvent(new vL("drag",{nodeId:this.active.nodeId,source:{index:this.active.sourceIndex,parentId:this.active.parentStackId},grabOffset:xe({x:this.active.grabOffsetX,y:this.active.grabOffsetY}),pointer:xe({x:this.active.pointerX,y:this.active.pointerY}),size:xe({x:this.active.width,y:this.active.height}),projectedLayout:t}))}getHitTargetForPointer(t,r,i,s){return this.active?this.isPointerInsideDragBounds(t,r,i.viewport)?this.active.parentStackId?this.getStackChildHitTarget(t,r,i,s):this.getTopLevelCardHitTarget(t,r,i,s):{type:"reorder",index:this.active.sourceIndex}:{type:"reorder",index:0}}getStackChildHitTarget(t,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&&Fn(t,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&&Fn(t,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(t,r,i,s)}}getSourceRemainingSiblingRect(t){var s,o;if(!((s=this.active)!=null&&s.parentStackId))return;const r=Pf(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=t.find(a=>a.id===i.id))==null?void 0:o.rect}getSourceStackInteractionRect(t){var o;if(!((o=this.active)!=null&&o.parentStackId))return;const r=t.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=Pf(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=t.find(c=>c.id===s.id);if(a)return a.rect}return this.active.sourceStackRect}getTopLevelCardHitTarget(t,r,i,s){var m,x,E;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return{type:"reorder",index:((m=this.active)==null?void 0:m.sourceIndex)??0};const c=(i.effectiveVelocity??0)<=bL;for(const T of o){const O=T.rect;if(!Fn(t,r,O))continue;const P=this.resolveTopLevelTargetForCard(t,r,T,T.logicalIndex,c);if(P)return P;if(!c&&((x=this.active)!=null&&x.hitTarget))return this.active.hitTarget}const u=this.getNearestTargetableZone(t,o);if(!u)return{type:"reorder",index:((E=this.active)==null?void 0:E.sourceIndex)??0};const h=Math.max(u.rect.left,Math.min(u.rect.left+u.rect.width,t)),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:t<v?u.logicalIndex:u.logicalIndex+1}}getTopLevelReorderIndexForPointer(t,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(!Fn(t,r,p.rect))continue;const v=bc(p.rect,yc["reorder-before"]);if(Fn(t,r,v))return p.logicalIndex;const m=bc(p.rect,yc["reorder-after"]);if(Fn(t,r,m))return p.logicalIndex+1}const a=this.getNearestTargetableZone(t,o);if(!a)return((h=this.active)==null?void 0:h.sourceIndex)??0;const c=a.rect.left+a.rect.width/2;return t<c?a.logicalIndex:a.logicalIndex+1}getTopLevelZoneNodes(t,r){const i=new Map(r.map(a=>[a.id,a])),s=[];let o=0;for(const a of t){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(t,r,i,s,o){const a=i.rect;for(const c of fL){if(!o&&(c==="stack-above"||c==="stack-below"))continue;const u=yc[c],h=bc(a,u);if(Fn(t,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(t,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=t<a?a-t:t>c?t-c:0;u<s&&(s=u,i=o)}return i}isPointerInsideDragBounds(t,r,i){return t>=i.left&&t<=i.left+i.width&&r>=i.top&&r<=i.top+i.height}}const Rf=60,NL=80,Df=.5,Lf=10;class UL{constructor(){b(this,"awaitingFreshWheelGesture",!1);b(this,"lastWheelEventAt",Number.NEGATIVE_INFINITY);b(this,"lastWheelDeltaX",0);b(this,"activeGestureType","none");b(this,"lastWheelGestureAt",Number.NEGATIVE_INFINITY)}markKeyboardNavigation(e){this.awaitingFreshWheelGesture=!0,this.lastWheelEventAt=e,this.activeGestureType="none"}reset(){this.awaitingFreshWheelGesture=!1,this.lastWheelEventAt=Number.NEGATIVE_INFINITY,this.lastWheelDeltaX=0,this.activeGestureType="none",this.lastWheelGestureAt=Number.NEGATIVE_INFINITY}decide(e){const{now:t,shiftKey:r,deltaX:i,deltaY:s,overArtifactContent:o}=e;t-this.lastWheelGestureAt>=Rf&&(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>=Df&&h>=p*Lf?this.classifyHorizontal(t,u):(this.lastWheelGestureAt=t,{type:"scroll-native"}):this.activeGestureType==="horizontal-filmstrip"?!c&&o&&p>0&&p>=h*Lf?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=t,{type:"scroll-native"}):this.classifyHorizontal(t,u):h<Df?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=t,{type:"scroll-native"}):c||h>p?this.classifyHorizontal(t,u):p>h?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=t,{type:"scroll-native"}):o?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=t,{type:"scroll-native"}):this.classifyHorizontal(t,u)}classifyHorizontal(e,t){const r=e-this.lastWheelEventAt,i=Math.sign(this.lastWheelDeltaX),s=Math.sign(t),o=i!==0&&s!==0&&i!==s,a=i!==0&&Math.abs(t)>=Math.abs(this.lastWheelDeltaX)+NL;return this.awaitingFreshWheelGesture&&r<Rf&&!o&&!a?{type:"ignore"}:(this.lastWheelEventAt=e,this.lastWheelDeltaX=t,this.lastWheelGestureAt=e,this.awaitingFreshWheelGesture=!1,this.activeGestureType="horizontal-filmstrip",{type:"scroll-horizontal",horizontalDelta:t})}}const FL=100,ZL=1e3;class WL{constructor(e,t){b(this,"_status","idle");b(this,"cumulativeOffset",0);b(this,"samples",[]);b(this,"scroll");b(this,"setAnimating");this.scroll=e,this.setAnimating=t}get status(){return this._status}start(e){this._status="active",this.cumulativeOffset=0,this.samples=[{time:e,offset:0}]}move(e,t){this._status==="active"&&(this.cumulativeOffset+=t,this.samples.push({time:e,offset:this.cumulativeOffset}),this.pruneSamples(e),this.setAnimating(!1),this.scroll.wheelPixels(xe({x:-t})))}end(){if(this._status!=="active")return;const e=this.computeVelocityPxPerSec();this.setAnimating(!0),Math.abs(e)<Cx?this.scroll.snap():this.scroll.snap(e>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(e){const t=e-FL;let r=0;for(let i=0;i<this.samples.length;i+=1){if(this.samples[i].time>=t){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 e=this.samples[0],t=this.samples[this.samples.length-1],r=t.time-e.time;return r<=0?0:(t.offset-e.offset)/r*ZL}}const HL=2,zf=1e3,Vo=1e-4,VL=120,Of=!1;function BL(n){return n.replace(/["\\]/g,"\\$&")}function Mf(n,e,t){if(n===0)return 0;const r=e.toPixels(ye({y:tt})).y??0;return(t-r)/HL}function Sc(n){const e=n.clientWidth>0?n.clientWidth:br,t=n.clientHeight>0?n.clientHeight:wa;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,t-r-i);return{width:e,height:s,offsetY:r}}class GL extends Event{constructor(t){super("scroll",{bubbles:!0,composed:!0});b(this,"scrollPosition");this.scrollPosition=t}}class Yy extends Event{constructor(t){super("layout-change",{bubbles:!0,composed:!0});b(this,"layout");this.layout=t}}class jL extends HTMLElement{constructor(){super();b(this,"_layout",[]);b(this,"_scrollPosition",0);b(this,"layoutGrid",null);b(this,"layoutScroll",new pL(ye({x:0})));b(this,"scrollModelKey","");b(this,"resizeObserver",null);b(this,"renderPending",!1);b(this,"animateNextRender",!0);b(this,"wheelGesture",new UL);b(this,"swipeGesture",new WL(this.layoutScroll,t=>{this.animateNextRender=t}));b(this,"swipePointerId",null);b(this,"swipeStartX",0);b(this,"swipeStartY",0);b(this,"swipeLastX",0);b(this,"swipeActive",!1);b(this,"swipeShouldSuppressClick",!1);b(this,"swipeListenersAttached",!1);b(this,"wheelIdleSnapTimer",null);b(this,"dragController",new ML);b(this,"dragState",null);b(this,"activeDragPointerId",null);b(this,"dragListenersAttached",!1);b(this,"dragFrame",0);b(this,"lastDragFrameTime",0);b(this,"lastPointerX",0);b(this,"lastPointerY",0);b(this,"pointerVelocityPxPerSec",0);b(this,"scrollVelocityPxPerSec",0);b(this,"motionSampleTime",0);b(this,"motionSampleX",0);b(this,"motionSampleY",0);b(this,"dragTrackOffsetXPx",0);b(this,"previousProjectedLayoutForOffset",null);b(this,"resizeState",null);b(this,"resizeListenersAttached",!1);b(this,"renderContent",()=>N``);b(this,"onDragControllerChange",()=>{this.dragController.status==="idle"&&(this.dragState=null,this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null),this.scheduleRender()});b(this,"onDragControllerDrag",t=>{const r=Cf(t.projectedLayout),i=this.shouldApplyTrackOffset(t.projectedLayout,t.source.parentId),s=t.source.parentId?this.getStackChildAnchorCardId(t.source.parentId,t.nodeId):null;this.dragTrackOffsetXPx=i?this.computeDragTrackOffset(this.previousProjectedLayoutForOffset,r,t.nodeId,t.source.parentId,s,this.dragTrackOffsetXPx):0,this.previousProjectedLayoutForOffset=r,this.dragState={nodeId:t.nodeId,source:t.source,grabOffset:t.grabOffset,pointer:t.pointer,size:t.size,projectedLayout:t.projectedLayout},this.scheduleRender()});b(this,"onDragControllerDrop",t=>{this.dragState=null,this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null,this.commitLayout(t.layout)});b(this,"onLayoutScrollInternal",t=>{const i=t.scroll.x??0;Math.abs(i-this._scrollPosition)<Vo||(this._scrollPosition=i,this.emitScrollPositionChanged(i),this.scheduleRender())});b(this,"handleKeyDown",t=>{if(t.key==="Escape"&&this.dragController.status!=="idle"){t.preventDefault(),this.stopDragFrameLoop(),this.releaseActiveDragPointerCapture(),this.dragController.cancel(),this.detachDragListeners();return}this.dragController.status==="idle"&&(t.key==="ArrowRight"?(t.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(1)):t.key==="ArrowLeft"&&(t.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(-1)))});b(this,"handleWheel",t=>{if(this._layout.length===0)return;const r=this.wheelGesture.decide({now:Date.now(),shiftKey:t.shiftKey,deltaX:t.deltaX,deltaY:t.deltaY,overArtifactContent:!1});r.type==="scroll-horizontal"&&(t.preventDefault(),this.applyHorizontalWheel(r.horizontalDelta))});b(this,"handleWindowMessage",t=>{if(this._layout.length===0)return;const r=this.findManagedArtifactFrame(t.source);if(r&&this.isTrustedArtifactFrameMessage(t,r)){if(U2(t.data)){const i=typeof performance<"u"?performance.now():Date.now();this.swipeGesture.status==="idle"&&this.swipeGesture.start(i),this.swipeGesture.move(i,t.data.deltaX);return}if(F2(t.data)){this.swipeGesture.status==="active"&&this.swipeGesture.end();return}}});b(this,"handleArtifactWheel",t=>{if(this._layout.length===0)return;const r=this.wheelGesture.decide({now:Date.now(),shiftKey:t.shiftKey,deltaX:t.deltaX,deltaY:t.deltaY,overArtifactContent:!0});if(r.type==="scroll-horizontal"){this.applyHorizontalWheel(r.horizontalDelta);return}r.type==="scroll-native"&&t.scrollNative(t.deltaY)});b(this,"handlePointerDown",t=>{if(t.button!==0||this.dragController.status!=="idle"||this.resizeState)return;const r=t.target;if(!(r instanceof Element))return;const i=r.closest("[data-resize-handle]");if(i){this.beginResize(t,i);return}const s=r.closest("[drag-handle]")!==null,o=r.closest("button, input, textarea, select, a, [role='button']")!==null;if(t.pointerType==="touch"&&!s&&!o&&this._layout.length>0){this.beginSwipeTracking(t);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 m=parseInt(v,10);if(!isNaN(m)){const x=this.findViewspanContainingNode(m);if(x){this.clearWheelIdleSnap(),this.animateNextRender=!0,this.layoutScroll.scroll=ye({x:x.anchor}),t.preventDefault(),t.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=YL(this._layout,c);if(!u)return;const h=a.getBoundingClientRect();this.lastPointerX=t.clientX,this.lastPointerY=t.clientY,this.resetMotionTracking(t.clientX,t.clientY),this.focus(),this.dragController.start({nodeId:c,source:{index:u.topLevelIndex,parentId:u.sourceStackId},pointer:xe({x:t.clientX,y:t.clientY}),grabOffset:xe({x:t.clientX-h.left,y:t.clientY-h.top}),size:xe({x:h.width,y:h.height}),layout:this._layout}),this.attachDragListeners(),this.activeDragPointerId=t.pointerId;try{this.setPointerCapture(t.pointerId)}catch{}t.preventDefault()});b(this,"handleResizePointerMove",t=>{const r=this.resizeState;if(!r||t.pointerId!==r.pointerId)return;const i=this.layoutGrid,s=((i==null?void 0:i.unit.x)??hn)+ce;if(s<=0)return;const o=t.clientX-r.startClientX,a=yu(r.startWidth+o/s);a!==r.currentWidth&&(r.currentWidth=a,this.scheduleRender())});b(this,"handleResizePointerUp",t=>{const r=this.resizeState;if(!r||t.pointerId!==r.pointerId)return;const i=r.currentWidth,s=r.startWidth,o=r.cardId;this.endResize(t.pointerId),i!==s?this.commitLayout(gL(this._layout,o,i)):this.scheduleRender()});b(this,"handleResizePointerCancel",t=>{!this.resizeState||t.pointerId!==this.resizeState.pointerId||(this.endResize(t.pointerId),this.scheduleRender())});b(this,"handleResizeWindowBlur",()=>{this.resizeState&&(this.endResize(this.resizeState.pointerId),this.scheduleRender())});b(this,"handleResizeKeyDown",t=>{this.resizeState&&t.key==="Escape"&&(t.preventDefault(),this.endResize(this.resizeState.pointerId),this.scheduleRender())});b(this,"handleSwipePointerMove",t=>{if(this.swipePointerId===null||t.pointerId!==this.swipePointerId)return;if(!this.swipeActive){const i=t.clientX-this.swipeStartX,s=t.clientY-this.swipeStartY,o=Math.abs(i),a=Math.abs(s);if(o<Np&&a<Np)return;if(a>=o){this.endSwipeTracking();return}this.swipeActive=!0,this.swipeShouldSuppressClick=!0;try{this.setPointerCapture(t.pointerId)}catch{}this.swipeGesture.start(t.timeStamp)}const r=t.clientX-this.swipeLastX;this.swipeLastX=t.clientX,this.swipeGesture.move(t.timeStamp,r),t.preventDefault()});b(this,"handleSwipePointerUp",t=>{this.swipePointerId===null||t.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.end(),this.releaseSwipePointerCapture(t.pointerId),this.endSwipeTracking())});b(this,"handleSwipePointerCancel",t=>{this.swipePointerId===null||t.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.cancel(),this.releaseSwipePointerCapture(t.pointerId),this.endSwipeTracking())});b(this,"handleSwipeWindowBlur",()=>{this.swipePointerId!==null&&this.swipeActive&&this.swipeGesture.cancel(),this.swipePointerId!==null&&this.releaseSwipePointerCapture(this.swipePointerId),this.endSwipeTracking()});b(this,"handleSwipeClick",t=>{this.swipeShouldSuppressClick&&(this.swipeShouldSuppressClick=!1,t.preventDefault(),t.stopPropagation(),typeof t.stopImmediatePropagation=="function"&&t.stopImmediatePropagation())});b(this,"handleWindowPointerMove",t=>{this.lastPointerX=t.clientX,this.lastPointerY=t.clientY,this.updatePointerVelocity(t.clientX,t.clientY),this.syncDragTargetForLatestPointer(),this.ensureDragFrameLoop()});b(this,"handleWindowPointerUp",t=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(t.pointerId),this.dragController.drop(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"handleWindowPointerCancel",t=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(t.pointerId),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"handleWindowBlur",()=>{this.releaseActiveDragPointerCapture(),this.stopDragFrameLoop(),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"runDragFrame",t=>{if(this.dragController.status==="idle"){this.dragFrame=0;return}const r=Math.max(0,t-this.lastDragFrameTime)/zf;this.lastDragFrameTime=t,this.samplePointerVelocityAt(t,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>Vo?Math.abs(o)/r:0,Math.abs(o)>Vo&&(this.animateNextRender=!1,this.layoutScroll.wheelPixels(xe({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 layout(t){this._layout=[...t],this.stopDragFrameLoop(),this.dragController.cancel(),this.resizeState&&this.endResize(this.resizeState.pointerId),this.scrollModelKey="",this.syncScrollModel(),this.layoutScroll.scroll=ye({x:this._scrollPosition}),this.scheduleRender()}get layout(){return this._layout}commitLayout(t){this.layout=t,this.emitLayoutChanged()}set scrollPosition(t){Math.abs(t-this._scrollPosition)<Vo||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=ye({x:t}))}get scrollPosition(){return this._scrollPosition}focusArtifact(t){const r=Xr(this._layout),i=r.nodes.findIndex(o=>o.cards.some(a=>a.artifactID===t));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="${BL(t)}"]`);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 t;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),(t=this.resizeObserver)==null||t.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(t,r){return new Q2({basis:xe({x:hn,y:hn}),min:xe({x:Op,y:Op}),viewport:xe({x:t,y:r}),gap:xe({x:ce,y:ce})})}syncScrollModel(){const t=Sc(this),i=Xr(this._layout).nodes.map(o=>o.width),s=`${t.width}x${t.height}:${i.join(",")}`;s===this.scrollModelKey&&this.layoutGrid||(this.scrollModelKey=s,this.layoutGrid=this.createGrid(t.width,t.height),this.layoutScroll.rebuild({grid:this.layoutGrid,nodeWidths:i.map(o=>ye({x:o})),snap:Of}))}emitScrollPositionChanged(t){this.dispatchEvent(new GL(t))}emitLayoutChanged(){this.dispatchEvent(new Yy([...this._layout]))}shiftWindow(t){this.clearWheelIdleSnap(),this.syncScrollModel(),this.animateNextRender=!0,this.layoutScroll.step(t)}applyHorizontalWheel(t){this.syncScrollModel();const r=this.layoutGrid;if(!r)return;this.animateNextRender=!1;const i=r.toUnits(xe({x:t}));this.layoutScroll.wheel(ye({x:i.x??0}))}scheduleWheelIdleSnap(){this.clearWheelIdleSnap(),this.wheelIdleSnapTimer=setTimeout(()=>{this.wheelIdleSnapTimer=null,this.animateNextRender=!0,this.layoutScroll.snap()},VL)}clearWheelIdleSnap(){this.wheelIdleSnapTimer!==null&&(clearTimeout(this.wheelIdleSnapTimer),this.wheelIdleSnapTimer=null)}findViewspanContainingNode(t){const r=this.layoutScroll.viewspans,i=this._scrollPosition;let s=null,o=Number.POSITIVE_INFINITY;for(const a of r)if(t>=a.nodeRange[0]&&t<=a.nodeRange[1]){const c=Math.abs(a.anchor-i);c<o&&(o=c,s=a)}return s}findManagedArtifactFrame(t){if(!t)return null;const r=this.querySelectorAll("iframe.artifact-frame");for(const i of r)if(i.contentWindow===t)return i;return null}isTrustedArtifactFrameMessage(t,r){if(t.origin==="null")return!0;const i=this.getArtifactFrameOrigin(r);return i===null||t.origin===i}getArtifactFrameOrigin(t){const r=t.getAttribute("src")??t.src;if(!r)return null;try{return new URL(r,window.location.href).origin}catch{return null}}beginResize(t,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=yu(typeof s.width=="number"?s.width:wt);this.resizeState={cardId:i,pointerId:t.pointerId,startClientX:t.clientX,startWidth:o,currentWidth:o},this.attachResizeListeners();try{this.setPointerCapture(t.pointerId)}catch{}t.preventDefault(),t.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(t){this.resizeState=null,this.detachResizeListeners();try{this.hasPointerCapture(t)&&this.releasePointerCapture(t)}catch{}}beginSwipeTracking(t){this.swipePointerId=t.pointerId,this.swipeStartX=t.clientX,this.swipeStartY=t.clientY,this.swipeLastX=t.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(t){try{this.hasPointerCapture(t)&&this.releasePointerCapture(t)}catch{}}releaseActiveDragPointerCapture(){this.activeDragPointerId!==null&&this.releasePointerCaptureForEvent(this.activeDragPointerId)}releasePointerCaptureForEvent(t){try{this.hasPointerCapture(t)&&this.releasePointerCapture(t)}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)}getDisplayModel(){if(this.dragController.status!=="active"||!this.dragState)return{layout:this.applyResizeOverride(this._layout),activePlaceholderId:null,placeholdersById:new Map};const t=new Map;return t.set(this.dragState.nodeId,{id:this.dragState.nodeId,sourceCardId:this.dragState.nodeId}),{layout:Cf(this.dragState.projectedLayout),activePlaceholderId:this.dragState.nodeId,placeholdersById:t}}applyResizeOverride(t){const r=this.resizeState;if(!r)return t;const i=t.findIndex(a=>a.type==="card"&&a.id===r.cardId);if(i===-1)return t;const s=t[i];if(!s||s.type!=="card"||s.width===r.currentWidth)return t;const o=[...t];return o[i]={...s,width:r.currentWidth},o}render(){const t=Sc(this),r=this.createGrid(t.width,t.height);this.layoutGrid=r;const i=this.getDisplayModel(),s=i.layout,o=this.dragController.status==="active",a=Xr(s),c=a.nodes.map(U=>U.width),u=`${t.width}x${t.height}:${c.join(",")}`;!o&&u!==this.scrollModelKey&&(this.scrollModelKey=u,this.layoutScroll.rebuild({grid:r,nodeWidths:c.map(U=>ye({x:U})),snap:Of}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const h=qL(s),p=r.unit.x??hn,v=r.unit.y??hn,m=o?this.dragTrackOffsetXPx:0,x=(this.layoutScroll.translate.x??0)+m,E=Mf(a.nodes.length,r,t.height),T=this.animateNextRender&&!o,O=[`transform: translate(${x}px, ${E}px);`,`transition-duration: ${T?$x:0}ms;`,`pointer-events: ${o?"none":"auto"};`].join(" ");this.animateNextRender=!0,this.style.setProperty("--layout-unit-x",`${p}px`),this.style.setProperty("--layout-unit-y",`${v}px`),this.style.setProperty("--layout-gap",`${ce}px`);const P=this.dragState,V={width:(P==null?void 0:P.size.x)??0,height:(P==null?void 0:P.size.y)??0},F=new Set;{for(let Q=0;Q<a.nodes.length;Q+=1)r.toPixels(ye({x:a.nodes[Q].width})).x;let U=x;for(let Q=0;Q<a.nodes.length;Q+=1){const j=r.toPixels(ye({x:a.nodes[Q].width})).x??0,rt=U+j;U>=-1&&rt<=t.width+1&&F.add(Q),U=rt+ce}}const B=U=>F.has(U);Fe(N`
|
|
187
187
|
<div class="track" style=${O}>
|
|
188
188
|
${a.nodes.map((U,Q)=>N`
|
|
189
189
|
<div
|
|
@@ -234,7 +234,7 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
234
234
|
${this.renderDraggedPreview(P.nodeId)}
|
|
235
235
|
</div>
|
|
236
236
|
`})():null}
|
|
237
|
-
`,this)}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 t=this.getBoundingClientRect();if(this.dragController.status==="active"){const i=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,t);this.syncDragTarget(i.x,i.y,t);return}if(this.syncDragTarget(this.lastPointerX,this.lastPointerY,t),this.dragController.status==="pending")return;const r=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,t);(r.x!==this.lastPointerX||r.y!==this.lastPointerY)&&this.syncDragTarget(r.x,r.y,t)}syncDragTarget(t,r,i=this.getBoundingClientRect()){if(this.dragController.status==="idle")return;const s=this.getDisplayModel(),o=new Set(s.placeholdersById.keys()),a=this.dragController.status==="active"?this.dragTrackOffsetXPx:0,c=this.measureLayoutGeometry(s.layout,o,a);this.dragController.update({pointer:xe({x:t,y:r}),viewport:{left:i.left,top:i.top,width:i.width,height:i.height},geometry:c,effectiveVelocity:Math.max(this.pointerVelocityPxPerSec,this.scrollVelocityPxPerSec)})}resetMotionTracking(t,r){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=performance.now(),this.motionSampleX=t,this.motionSampleY=r}clearMotionTracking(){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=0}updatePointerVelocity(t,r){this.samplePointerVelocityAt(performance.now(),t,r)}samplePointerVelocityAt(t,r,i){if(this.motionSampleTime===0){this.motionSampleTime=t,this.motionSampleX=r,this.motionSampleY=i,this.pointerVelocityPxPerSec=0;return}const s=t-this.motionSampleTime;if(s<100)return;const o=r-this.motionSampleX;this.pointerVelocityPxPerSec=Math.abs(o)/s*
|
|
237
|
+
`,this)}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 t=this.getBoundingClientRect();if(this.dragController.status==="active"){const i=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,t);this.syncDragTarget(i.x,i.y,t);return}if(this.syncDragTarget(this.lastPointerX,this.lastPointerY,t),this.dragController.status==="pending")return;const r=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,t);(r.x!==this.lastPointerX||r.y!==this.lastPointerY)&&this.syncDragTarget(r.x,r.y,t)}syncDragTarget(t,r,i=this.getBoundingClientRect()){if(this.dragController.status==="idle")return;const s=this.getDisplayModel(),o=new Set(s.placeholdersById.keys()),a=this.dragController.status==="active"?this.dragTrackOffsetXPx:0,c=this.measureLayoutGeometry(s.layout,o,a);this.dragController.update({pointer:xe({x:t,y:r}),viewport:{left:i.left,top:i.top,width:i.width,height:i.height},geometry:c,effectiveVelocity:Math.max(this.pointerVelocityPxPerSec,this.scrollVelocityPxPerSec)})}resetMotionTracking(t,r){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=performance.now(),this.motionSampleX=t,this.motionSampleY=r}clearMotionTracking(){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=0}updatePointerVelocity(t,r){this.samplePointerVelocityAt(performance.now(),t,r)}samplePointerVelocityAt(t,r,i){if(this.motionSampleTime===0){this.motionSampleTime=t,this.motionSampleX=r,this.motionSampleY=i,this.pointerVelocityPxPerSec=0;return}const s=t-this.motionSampleTime;if(s<100)return;const o=r-this.motionSampleX;this.pointerVelocityPxPerSec=Math.abs(o)/s*zf,this.motionSampleTime=t,this.motionSampleX=r,this.motionSampleY=i}clampPointerToViewport(t,r,i){return{x:Math.max(i.left,Math.min(i.left+i.width,t)),y:Math.max(i.top,Math.min(i.top+i.height,r))}}isPointerOutsideViewport(t,r,i){return t<i.left||t>i.left+i.width||r<i.top||r>i.top+i.height}getDragEdgeScrollDeltaPixels(t,r,i){var u;const s=r.left+Oo,o=r.left+r.width-Oo,a=((u=this.layoutGrid)==null?void 0:u.unit.x)??hn,c=Tx*a;if(t<s){const h=Math.max(0,Math.min(1,(s-t)/Oo));return-(c*h**Mp)*i}if(t>o){const h=Math.max(0,Math.min(1,(t-o)/Oo));return c*h**Mp*i}return 0}measureLayoutGeometry(t,r,i=0){const s=this.layoutGrid;if(!s)return[];const o=Xr(t),a=new Map(o.nodes.map(E=>[E.id,E.width])),c=s.toPixels(ye({y:tt})).y??wa,u=Sc(this),h=(this.layoutScroll.translate.x??0)+i,p=Mf(o.nodes.length,s,u.height),v=u.offsetY+p,m=[];let x=h;for(const E of t){const T=a.get(E.id)??wt,O=s.toPixels(ye({x:T})).x??br,P={left:x,top:v,width:O,height:c};m.push({id:E.id,rect:P}),x+=O+ce}return m}getPlaceholderPixelSize(t,r,i,s){if(!r)return s;for(const o of t.nodes)for(const a of o.cards)if(a.id===r)return{width:i.toPixels(ye({x:a.width})).x??s.width,height:i.toPixels(ye({y:a.height})).y??s.height};return s}renderDraggedPreview(t){const r=Ah(this._layout,t);return r?this.renderContent(r,{isDragging:!0}):N``}shouldApplyTrackOffset(t,r){if(r)return!0;for(const i of t){if(i.type!=="stack")continue;if(i.children.some(o=>o.type==="drop-target")&&r!==i.id)return!0}return!1}computeDragTrackOffset(t,r,i,s,o,a){if(!t)return a;const c=s?o??this.getStableAnchorCardId(t,r,i):this.getStableAnchorNodeId(t,r,i);if(!c)return a;const u=s?Uf(t,c,this.layoutGrid):Ff(t,c,this.layoutGrid),h=s?Uf(r,c,this.layoutGrid):Ff(r,c,this.layoutGrid);return u===null||h===null?a:a+(u-h)}getStableAnchorCardId(t,r,i){const s=Nf(t),o=new Set(Nf(r));for(const a of s)if(a!==i&&o.has(a))return a;return null}getStableAnchorNodeId(t,r,i){const s=new Set(r.map(o=>o.id));for(const o of t)if(o.id!==i&&s.has(o.id))return o.id;return null}getStackChildAnchorCardId(t,r){const i=this._layout.find(o=>o.type==="stack"&&o.id===t);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 qL(n){const e=new Map;for(const t of n){if(t.type==="card"){e.set(t.id,t);continue}for(const r of t.children)if(r.type==="card")e.set(r.id,r);else for(const i of r.children)e.set(i.id,i)}return e}function YL(n,e){const t=n.findIndex(r=>r.type==="card"&&r.id===e);if(t!==-1)return{topLevelIndex:t};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===e))return{topLevelIndex:r,sourceStackId:i.id}}return null}function Nf(n){const e=[];for(const t of n){if(t.type==="card"){e.push(t.id);continue}if(t.type==="stack"){const r=t.children.find(i=>i.type==="card");r&&e.push(r.id)}}return e}function Uf(n,e,t){if(!t)return null;const r=Xr(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===e||o.type==="stack"&&o.children.some(u=>u.type==="card"&&u.id===e))return s;const a=i.get(o.id)??wt,c=t.toPixels(ye({x:a})).x??br;s+=c+ce}return null}function Ff(n,e,t){if(!t)return null;const r=Xr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.id===e)return s;const a=i.get(o.id)??wt,c=t.toPixels(ye({x:a})).x??br;s+=c+ce}return null}customElements.get("layout-view")||customElements.define("layout-view",jL);class XL extends HTMLElement{constructor(){super(...arguments);b(this,"screenManager",zt.resolve("ScreenManager"));b(this,"boundModel",null);b(this,"handleActiveScreenChanged",()=>{this.rebindModel(),this.render()});b(this,"handleModelChange",()=>{this.render()});b(this,"handleCloseArtifact",t=>{t instanceof Hy&&this.screenManager.activeScreen&&this.screenManager.activeScreen.removeArtifact(t.artifactID)});b(this,"handleScrollPositionChanged",t=>{const r=t;typeof r.scrollPosition=="number"&&Number.isFinite(r.scrollPosition)&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setScrollPosition(r.scrollPosition)});b(this,"handleLayoutChanged",t=>{t instanceof Yy&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setLayout(t.layout)});b(this,"handleServerEvent",t=>{const r=t.event;if(r.type!=="viewer-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()}rebindModel(){const t=this.screenManager.activeScreen;this.boundModel!==t&&(this.unbindModel(),this.boundModel=t,t&&(t.addEventListener("change",this.handleModelChange),t.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)}buildArtifactMap(){const t=this.screenManager.activeScreen;return t?new Map(t.artifacts):new Map}render(){const t=this.screenManager.activeScreen,r=(t==null?void 0:t.layout)??[],i=this.buildArtifactMap();if(r.length===0){Fe(N`<p data-testid="empty-screen" class="empty">
|
|
238
238
|
No artifacts yet. Create one by asking for something.
|
|
239
239
|
</p>`,this);return}Fe(N`
|
|
240
240
|
<layout-view
|
|
@@ -251,42 +251,42 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
251
251
|
@layout-change=${this.handleLayoutChanged}
|
|
252
252
|
@close-artifact=${this.handleCloseArtifact}
|
|
253
253
|
></layout-view>
|
|
254
|
-
`,this)}}customElements.define("screen-view",
|
|
255
|
-
${f(this,Z,
|
|
254
|
+
`,this)}}customElements.define("screen-view",XL);class KL extends HTMLElement{connectedCallback(){}}customElements.get("home-screen")||customElements.define("home-screen",KL);function Ta(n){return typeof n=="object"&&n!==null}const _c=new WeakMap,Zf=Object.prototype.hasOwnProperty,JL=(()=>{const n=new Set;let e=HTMLElement.prototype;for(;e;){for(const t of Object.getOwnPropertyNames(e))n.add(t);if(e===Node.prototype)break;e=Object.getPrototypeOf(e)}return n})();function QL(n,e){if(Ta(n))return e===null?void 0:n.parse(e);if(n===Boolean)return e!==null;if(e!==null)return n===Number?Number(e):e}function ez(n,e){return Ta(n)?e==null?null:n.serialize(e):n===Boolean?e?"":null:e==null?null:String(e)}var qs,Su,pr,st,Rt,fi,fr,gi,Se,qr,Xy,Ky,Jy,Qy,ca;const jn=class jn extends HTMLElement{constructor(){var i;super();w(this,Se);w(this,pr,new Map);w(this,st,new Map);w(this,Rt,new Map);w(this,fi,!1);w(this,fr,!1);w(this,gi,!1);const t=f(i=jn,qs,Su).call(i,this.constructor),r=this;for(const s of t.properties)Zf.call(r,s)&&(l(this,Rt).set(s,r[s]),delete r[s])}static get observedAttributes(){var t;return f(t=jn,qs,Su).call(t,this).observedAttributes}connected(){}disconnected(){}changed(t){}connectedCallback(){if(f(this,Se,Qy).call(this),!l(this,fr))for(const t of f(this,Se,qr).call(this).properties)l(this,st).has(t)||l(this,st).set(t,void 0);this.dispatchEvent(new Event("reactive:connect")),this.connected(),f(this,Se,ca).call(this)}disconnectedCallback(){this.dispatchEvent(new Event("reactive:disconnect")),this.disconnected()}attributeChangedCallback(t,r,i){if(r===i)return;const s=f(this,Se,qr).call(this).byAttr.get(t);s&&(l(this,Rt).has(s.property)||(this[s.property]=QL(s.type,i)))}};qs=new WeakSet,Su=function(t){const r=_c.get(t);if(r)return r;const i=[...t.properties??[]],s=t.attributes??{},o=new Map,a=new Map;for(const u of i)if(JL.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(Ta(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(t.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(t.prototype,u,{configurable:!0,enumerable:!0,get(){return l(this,pr).get(u)},set(p){f(this,Se,Xy).call(this,u,p)}})}const c={properties:i,observedAttributes:Object.keys(s),byAttr:o,byProp:a};return _c.set(t,c),c},pr=new WeakMap,st=new WeakMap,Rt=new WeakMap,fi=new WeakMap,fr=new WeakMap,gi=new WeakMap,Se=new WeakSet,qr=function(){return _c.get(this.constructor)},Xy=function(t,r){if(!l(this,gi)&&l(this,Rt).has(t))return;const i=l(this,pr).get(t);f(this,Se,Ky).call(this,t,i,r)||(l(this,st).has(t)||l(this,st).set(t,i),l(this,pr).set(t,r),l(this,Rt).delete(t),f(this,Se,Jy).call(this,t,r),this.isConnected&&f(this,Se,ca).call(this))},Ky=function(t,r,i){if(Object.is(r,i))return!0;const s=f(this,Se,qr).call(this).byProp.get(t);if(!s||!Ta(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}},Jy=function(t,r){const i=f(this,Se,qr).call(this).byProp.get(t);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=ez(o,r);if(a===null){this.hasAttribute(s)&&this.removeAttribute(s);return}this.getAttribute(s)!==a&&this.setAttribute(s,a)},Qy=function(){const t=this,r=f(this,Se,qr).call(this);for(const i of r.properties){if(!Zf.call(t,i))continue;const s=t[i];delete t[i],!(l(this,Rt).has(i)||l(this,pr).has(i))&&(t[i]=s)}k(this,gi,!0);try{for(const[i,s]of l(this,Rt))t[i]=s;l(this,Rt).clear()}finally{k(this,gi,!1)}},ca=function(){l(this,fi)||!this.isConnected||l(this,fr)&&l(this,st).size===0||(k(this,fi,!0),queueMicrotask(()=>{if(k(this,fi,!1),!this.isConnected||l(this,fr)&&l(this,st).size===0)return;const t=new Map(l(this,st));l(this,st).clear(),k(this,fr,!0);try{this.changed(t)}catch(r){console.error(r)}this.isConnected&&l(this,st).size>0&&f(this,Se,ca).call(this)}))},w(jn,qs),b(jn,"properties"),b(jn,"attributes");let bs=jn;var we,gr,wn,mi,mr,Ys,vi,Sn,_n,kn,Xs,H,yi,Dt,Z,eb,Ks,Js,_u,ku,Ua,Fa,Za,Wa,Ha,Va,Ba,Qs,bi,Ga,ja,qa,Ya,Eu,tb,ua,Xa,nb,un,rb,ib,sb,ob,ab,lb,cb,ub,hb,Ye;class tz extends bs{constructor(){super(...arguments);w(this,Z);w(this,we,zt.resolve("ScreenManager"));w(this,gr,zt.resolve("ServerManager"));w(this,wn,null);w(this,mi,new DisposableStack);w(this,mr,ln());w(this,Ys,ln());w(this,vi,ln());w(this,Sn,ln());w(this,_n,ln());w(this,kn,ln());w(this,Xs,ln());w(this,H,{kind:"none"});w(this,yi,!1);w(this,Dt,[]);w(this,Ks,()=>{f(this,Z,_u).call(this),k(this,H,{kind:"none"}),l(this,Ye).call(this)});w(this,Js,()=>{l(this,Ye).call(this)});w(this,Ua,t=>{l(this,H).kind==="none"||l(this,H).kind==="picker"||(t.stopImmediatePropagation(),f(this,Z,un).call(this))});w(this,Fa,()=>{var r;const t=l(this,we).activeScreen;t&&((r=l(this,mr).value)==null||r.close(),t.setPinned(!t.pinned))});w(this,Za,()=>{var r;const t=l(this,we).activeScreen;t&&((r=l(this,mr).value)==null||r.close(),k(this,H,{kind:"rename",draft:t.name}),l(this,Ye).call(this))});w(this,Wa,()=>{var t;l(this,we).activeScreen&&((t=l(this,mr).value)==null||t.close(),k(this,H,{kind:"delete",error:null}),l(this,Ye).call(this))});w(this,Ha,t=>{if(l(this,H).kind!=="rename")return;const r=t.target;r instanceof HTMLInputElement&&k(this,H,{kind:"rename",draft:r.value})});w(this,Va,t=>{if(t.preventDefault(),l(this,H).kind!=="rename")return;const r=l(this,we).activeScreen;if(!r)return;const i=l(this,H).draft.trim();i.length>0&&i!==r.name&&r.rename(i),f(this,Z,un).call(this)});w(this,Ba,async()=>{if(l(this,H).kind!=="delete")return;const t=l(this,we).activeScreen;if(t){k(this,H,{kind:"delete",error:null});try{await t.remove(),l(this,we).clearActive(),f(this,Z,un).call(this)}catch(r){k(this,H,{kind:"delete",error:r instanceof Error?r.message:"Failed to delete screen."}),l(this,Ye).call(this)}}});w(this,Qs,()=>{f(this,Z,un).call(this)});w(this,bi,t=>{const r=t.target;(l(this,H).kind==="rename"&&r===l(this,Sn).value||l(this,H).kind==="delete"&&r===l(this,_n).value||l(this,H).kind==="picker"&&r===l(this,kn).value)&&(k(this,H,{kind:"none"}),l(this,Ye).call(this))});w(this,Ga,()=>{var i,s;if(l(this,H).kind==="picker"){f(this,Z,un).call(this);return}k(this,Dt,f(this,Z,tb).call(this));const t=((i=l(this,we).activeScreen)==null?void 0:i.id)??null,r=t&&l(this,Dt).some(o=>o.screenID===t)?t:((s=l(this,Dt)[0])==null?void 0:s.screenID)??null;k(this,H,{kind:"picker",filter:"",highlightedID:r}),l(this,Ye).call(this),queueMicrotask(()=>{var o;(o=l(this,Xs).value)==null||o.focus()})});w(this,ja,t=>{var u;const r=l(this,H);if(r.kind!=="picker")return;const i=t.target;if(!(i instanceof HTMLInputElement))return;const s=i.value,o=f(this,Z,ua).call(this,l(this,Dt),s),c=r.highlightedID!==null&&o.some(h=>h.screenID===r.highlightedID)?r.highlightedID:((u=o[0])==null?void 0:u.screenID)??null;k(this,H,{kind:"picker",filter:s,highlightedID:c}),l(this,Ye).call(this)});w(this,qa,t=>{var s;const r=l(this,H);if(r.kind!=="picker")return;if(t.key==="Escape"){t.preventDefault(),f(this,Z,un).call(this),(s=l(this,vi).value)==null||s.focus();return}const i=f(this,Z,ua).call(this,l(this,Dt),r.filter);if(t.key==="ArrowDown"||t.key==="ArrowUp"){if(t.preventDefault(),i.length===0)return;const o=i.findIndex(u=>u.screenID===r.highlightedID),a=t.key==="ArrowDown"?1:-1,c=o<0?0:Math.max(0,Math.min(i.length-1,o+a));k(this,H,{kind:"picker",filter:r.filter,highlightedID:i[c].screenID}),l(this,Ye).call(this);return}if(t.key==="Enter"){t.preventDefault();const o=i.find(a=>a.screenID===r.highlightedID);o&&f(this,Z,Eu).call(this,o)}});w(this,Ya,t=>{f(this,Z,Eu).call(this,t)});w(this,Xa,async()=>{if(l(this,yi))return;const t=f(this,Z,nb).call(this);if(t){k(this,yi,!0);try{const r=await t.createScreen(nz(new Date));l(this,we).setActive(t.url,r.id)}catch{}finally{k(this,yi,!1)}}});w(this,Ye,()=>{var s;const t=l(this,we).activeScreen,r=f(this,Z,ob).call(this);Fe(N`
|
|
255
|
+
${f(this,Z,rb).call(this)}
|
|
256
256
|
<div class="pills">
|
|
257
|
-
${r.map(o=>o.isActive&&t?f(this,Z,
|
|
257
|
+
${r.map(o=>o.isActive&&t?f(this,Z,lb).call(this,t):f(this,Z,cb).call(this,o.serverURL,o.screenID,o.name))}
|
|
258
258
|
</div>
|
|
259
|
-
${f(this,Z,
|
|
260
|
-
${t?f(this,Z,
|
|
261
|
-
${t?f(this,Z,
|
|
262
|
-
`,this);const i=l(this,
|
|
259
|
+
${f(this,Z,ib).call(this)}
|
|
260
|
+
${t?f(this,Z,ub).call(this):ne}
|
|
261
|
+
${t?f(this,Z,hb).call(this,t):ne}
|
|
262
|
+
`,this);const i=l(this,Ys).value??null;l(this,Sn).value&&(l(this,Sn).value.anchor=i),l(this,_n).value&&(l(this,_n).value.anchor=i),l(this,kn).value&&(l(this,kn).value.anchor=l(this,vi).value??null),(s=i==null?void 0:i.scrollIntoView)==null||s.call(i,{block:"nearest",inline:"nearest"})})}connected(){l(this,we).addEventListener("active-screen-changed",l(this,Ks)),f(this,Z,_u).call(this),l(this,Ye).call(this),f(this,Z,eb).call(this),l(this,mi).defer(()=>{l(this,we).removeEventListener("active-screen-changed",l(this,Ks)),f(this,Z,ku).call(this)})}disconnected(){l(this,mi).dispose(),k(this,mi,new DisposableStack)}}we=new WeakMap,gr=new WeakMap,wn=new WeakMap,mi=new WeakMap,mr=new WeakMap,Ys=new WeakMap,vi=new WeakMap,Sn=new WeakMap,_n=new WeakMap,kn=new WeakMap,Xs=new WeakMap,H=new WeakMap,yi=new WeakMap,Dt=new WeakMap,Z=new WeakSet,eb=async function(){const t=await fy(this);this.setAttribute("tone",t)},Ks=new WeakMap,Js=new WeakMap,_u=function(){var r;const t=l(this,we).activeScreen;l(this,wn)!==t&&(f(this,Z,ku).call(this),k(this,wn,t),(r=l(this,wn))==null||r.addEventListener("change",l(this,Js)))},ku=function(){var t;(t=l(this,wn))==null||t.removeEventListener("change",l(this,Js)),k(this,wn,null)},Ua=new WeakMap,Fa=new WeakMap,Za=new WeakMap,Wa=new WeakMap,Ha=new WeakMap,Va=new WeakMap,Ba=new WeakMap,Qs=new WeakMap,bi=new WeakMap,Ga=new WeakMap,ja=new WeakMap,qa=new WeakMap,Ya=new WeakMap,Eu=function(t){l(this,we).setActive(t.serverURL,t.screenID),f(this,Z,un).call(this)},tb=function(){const t=[];for(const r of l(this,gr).servers.values())for(const i of r.screens.values())t.push({serverURL:r.url,screenID:i.id,name:i.name,pinned:i.pinned});return t.sort((r,i)=>r.pinned!==i.pinned?r.pinned?-1:1:r.name.localeCompare(i.name,void 0,{sensitivity:"base"}))},ua=function(t,r){const i=r.trim().toLowerCase();return i.length===0?t:t.filter(s=>s.name.toLowerCase().includes(i))},Xa=new WeakMap,nb=function(){for(const t of l(this,gr).servers.values())return t;return null},un=function(){let t;l(this,H).kind==="rename"?t=l(this,Sn).value:l(this,H).kind==="delete"?t=l(this,_n).value:l(this,H).kind==="picker"&&(t=l(this,kn).value),t&&(t.open=!1),k(this,H,{kind:"none"}),l(this,Ye).call(this)},rb=function(){return N`
|
|
263
263
|
<segmented-control variant="glass" role="group" aria-label="Screens">
|
|
264
264
|
<button
|
|
265
265
|
type="button"
|
|
266
266
|
?icon-only=${!0}
|
|
267
267
|
aria-label="Choose screen"
|
|
268
268
|
?data-active=${l(this,H).kind==="picker"}
|
|
269
|
-
@click=${l(this,
|
|
270
|
-
${cn(l(this,
|
|
269
|
+
@click=${l(this,Ga)}
|
|
270
|
+
${cn(l(this,vi))}
|
|
271
271
|
>
|
|
272
|
-
${
|
|
272
|
+
${E2({size:16,weight:"regular"})}
|
|
273
273
|
</button>
|
|
274
274
|
<button
|
|
275
275
|
type="button"
|
|
276
276
|
?icon-only=${!0}
|
|
277
277
|
aria-label="New screen"
|
|
278
|
-
@click=${l(this,
|
|
278
|
+
@click=${l(this,Xa)}
|
|
279
279
|
>
|
|
280
|
-
${
|
|
280
|
+
${x2({size:16,weight:"regular"})}
|
|
281
281
|
</button>
|
|
282
282
|
</segmented-control>
|
|
283
|
-
`},
|
|
283
|
+
`},ib=function(){var o;const t=l(this,H).kind==="picker"?l(this,H).filter:"",r=l(this,H).kind==="picker"?l(this,H).highlightedID:null,i=((o=l(this,we).activeScreen)==null?void 0:o.id)??null,s=f(this,Z,ua).call(this,l(this,Dt),t);return N`
|
|
284
284
|
<ui-popover
|
|
285
285
|
class="picker-popover"
|
|
286
286
|
material="glass-frosted"
|
|
287
287
|
?open=${l(this,H).kind==="picker"}
|
|
288
|
-
@close=${l(this,
|
|
289
|
-
@keydown=${l(this,
|
|
288
|
+
@close=${l(this,bi)}
|
|
289
|
+
@keydown=${l(this,qa)}
|
|
290
290
|
${cn(l(this,kn))}
|
|
291
291
|
>
|
|
292
292
|
<div class="picker">
|
|
@@ -296,15 +296,15 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
296
296
|
placeholder="Filter screens"
|
|
297
297
|
aria-label="Filter screens"
|
|
298
298
|
.value=${t}
|
|
299
|
-
@input=${l(this,
|
|
300
|
-
${cn(l(this,
|
|
299
|
+
@input=${l(this,ja)}
|
|
300
|
+
${cn(l(this,Xs))}
|
|
301
301
|
/>
|
|
302
302
|
${s.length===0?N`<p class="picker-empty">
|
|
303
303
|
${l(this,Dt).length===0?"No other screens":"No matches"}
|
|
304
|
-
</p>`:f(this,Z,
|
|
304
|
+
</p>`:f(this,Z,sb).call(this,s,r,i)}
|
|
305
305
|
</div>
|
|
306
306
|
</ui-popover>
|
|
307
|
-
`},
|
|
307
|
+
`},sb=function(t,r,i){const s=t.filter(c=>c.pinned),o=t.filter(c=>!c.pinned),a=c=>{const u=c.screenID===i;return N`
|
|
308
308
|
<li
|
|
309
309
|
class="picker-row"
|
|
310
310
|
role="option"
|
|
@@ -312,7 +312,7 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
312
312
|
aria-current=${u?"true":ne}
|
|
313
313
|
?data-highlighted=${c.screenID===r}
|
|
314
314
|
?data-active=${u}
|
|
315
|
-
@click=${()=>l(this,
|
|
315
|
+
@click=${()=>l(this,Ya).call(this,c)}
|
|
316
316
|
>
|
|
317
317
|
<span class="picker-name">${c.name}</span>
|
|
318
318
|
</li>
|
|
@@ -327,7 +327,7 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
327
327
|
${o.map(a)}
|
|
328
328
|
`:ne}
|
|
329
329
|
</ul>
|
|
330
|
-
`},
|
|
330
|
+
`},ob=function(){var o;const t=((o=l(this,we).activeScreen)==null?void 0:o.id)??null,r=[];let i=!1;for(const a of l(this,gr).servers.values())for(const c of a.screens.values()){if(!c.pinned)continue;const u=c.id===t;u&&(i=!0),r.push({serverURL:a.url,screenID:c.id,name:c.name,isActive:u})}const s=l(this,we).activeScreen;if(s&&!i){let a=null;for(const c of l(this,gr).servers.values())if(c.screens.has(s.id)){a=c.url;break}a!==null&&r.push({serverURL:a,screenID:s.id,name:s.name,isActive:!0})}return r},ab=function(t,r){l(this,we).setActive(t,r)},lb=function(t){return N`
|
|
331
331
|
<dropdown-menu ${cn(l(this,mr))}>
|
|
332
332
|
<button
|
|
333
333
|
slot="trigger"
|
|
@@ -337,104 +337,104 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
337
337
|
aria-current="page"
|
|
338
338
|
aria-label=${`Screen actions for ${t.name}`}
|
|
339
339
|
?data-active=${l(this,H).kind==="rename"||l(this,H).kind==="delete"}
|
|
340
|
-
@click=${l(this,
|
|
341
|
-
${cn(l(this,
|
|
340
|
+
@click=${l(this,Ua)}
|
|
341
|
+
${cn(l(this,Ys))}
|
|
342
342
|
>
|
|
343
343
|
${t.name}
|
|
344
344
|
</button>
|
|
345
345
|
<dropdown-group>
|
|
346
|
-
<dropdown-item action @click=${l(this,Ua)}>
|
|
347
|
-
${I2()} ${t.pinned?"Unpin screen":"Pin screen"}
|
|
348
|
-
</dropdown-item>
|
|
349
346
|
<dropdown-item action @click=${l(this,Fa)}>
|
|
350
|
-
${
|
|
347
|
+
${T2()} ${t.pinned?"Unpin screen":"Pin screen"}
|
|
348
|
+
</dropdown-item>
|
|
349
|
+
<dropdown-item action @click=${l(this,Za)}>
|
|
350
|
+
${$2()} Rename
|
|
351
351
|
</dropdown-item>
|
|
352
|
-
<dropdown-item action danger @click=${l(this,
|
|
353
|
-
${
|
|
352
|
+
<dropdown-item action danger @click=${l(this,Wa)}>
|
|
353
|
+
${I2()} Delete
|
|
354
354
|
</dropdown-item>
|
|
355
355
|
</dropdown-group>
|
|
356
356
|
</dropdown-menu>
|
|
357
|
-
`},
|
|
357
|
+
`},cb=function(t,r,i){return N`
|
|
358
358
|
<button
|
|
359
359
|
type="button"
|
|
360
360
|
variant="glass"
|
|
361
361
|
class="screen-name"
|
|
362
362
|
aria-label=${`Switch to ${i}`}
|
|
363
|
-
@click=${()=>f(this,Z,
|
|
363
|
+
@click=${()=>f(this,Z,ab).call(this,t,r)}
|
|
364
364
|
>
|
|
365
365
|
${i}
|
|
366
366
|
</button>
|
|
367
|
-
`},
|
|
367
|
+
`},ub=function(){const t=l(this,H).kind==="rename"?l(this,H).draft:"";return N`
|
|
368
368
|
<ui-popover
|
|
369
369
|
class="rename-popover"
|
|
370
370
|
?open=${l(this,H).kind==="rename"}
|
|
371
|
-
@close=${l(this,
|
|
371
|
+
@close=${l(this,bi)}
|
|
372
372
|
${cn(l(this,Sn))}
|
|
373
373
|
>
|
|
374
|
-
<form class="screen-form" @submit=${l(this,
|
|
374
|
+
<form class="screen-form" @submit=${l(this,Va)}>
|
|
375
375
|
<label class="field">
|
|
376
376
|
<span>Screen name</span>
|
|
377
377
|
<input
|
|
378
378
|
type="text"
|
|
379
379
|
.value=${t}
|
|
380
|
-
@input=${l(this,
|
|
380
|
+
@input=${l(this,Ha)}
|
|
381
381
|
/>
|
|
382
382
|
</label>
|
|
383
383
|
<div class="actions">
|
|
384
|
-
<button type="button" @click=${l(this,
|
|
384
|
+
<button type="button" @click=${l(this,Qs)}>Cancel</button>
|
|
385
385
|
<button type="submit" variant="primary">Save</button>
|
|
386
386
|
</div>
|
|
387
387
|
</form>
|
|
388
388
|
</ui-popover>
|
|
389
|
-
`},
|
|
389
|
+
`},hb=function(t){const r=l(this,H).kind==="delete"?l(this,H).error:null;return N`
|
|
390
390
|
<ui-popover
|
|
391
391
|
class="delete-popover"
|
|
392
392
|
?open=${l(this,H).kind==="delete"}
|
|
393
|
-
@close=${l(this,
|
|
393
|
+
@close=${l(this,bi)}
|
|
394
394
|
${cn(l(this,_n))}
|
|
395
395
|
>
|
|
396
396
|
<div class="screen-form">
|
|
397
397
|
<p class="confirm-text">Delete "${t.name}"?</p>
|
|
398
398
|
${r?N`<p class="error">${r}</p>`:ne}
|
|
399
399
|
<div class="actions">
|
|
400
|
-
<button type="button" @click=${l(this,
|
|
400
|
+
<button type="button" @click=${l(this,Qs)}>Cancel</button>
|
|
401
401
|
<button
|
|
402
402
|
type="button"
|
|
403
403
|
variant="danger"
|
|
404
|
-
@click=${l(this,
|
|
404
|
+
@click=${l(this,Ba)}
|
|
405
405
|
>
|
|
406
406
|
Delete
|
|
407
407
|
</button>
|
|
408
408
|
</div>
|
|
409
409
|
</div>
|
|
410
410
|
</ui-popover>
|
|
411
|
-
`},qe=new WeakMap;customElements.define("screen-select",ez);function tz(n){const e=n.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}),t=12,r=n.getHours(),i=r%t===0?t:r%t,s=n.getMinutes().toString().padStart(2,"0"),o=r>=t?"pm":"am";return`${e} at ${i}:${s}${o}`}function nz(n,e){let t=null;const r=()=>e((t==null?void 0:t.messages)??[]),i=()=>{var a;const o=((a=n.activeServer)==null?void 0:a.acpClient)??null;o!==t&&(t==null||t.removeEventListener("change",r),t=o,t&&(t.addEventListener("change",r),t.connect().catch(c=>{console.error("ACPClient.connect() failed",c)})),r())};n.addEventListener("change",i),i();const s=()=>{n.removeEventListener("change",i),t==null||t.removeEventListener("change",r),t=null};return{dispose:s,[Symbol.dispose](){s()}}}/*! @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:hb,setPrototypeOf:Zf,isFrozen:rz,getPrototypeOf:iz,getOwnPropertyDescriptor:sz}=Object;let{freeze:Ze,seal:ct,create:ua}=Object,{apply:Eu,construct:xu}=typeof Reflect<"u"&&Reflect;Ze||(Ze=function(e){return e});ct||(ct=function(e){return e});Eu||(Eu=function(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(t,i)});xu||(xu=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return new e(...r)});const Vo=We(Array.prototype.forEach),oz=We(Array.prototype.lastIndexOf),Wf=We(Array.prototype.pop),Bi=We(Array.prototype.push),az=We(Array.prototype.splice),ha=We(String.prototype.toLowerCase),_c=We(String.prototype.toString),kc=We(String.prototype.match),Gi=We(String.prototype.replace),lz=We(String.prototype.indexOf),cz=We(String.prototype.trim),Je=We(Object.prototype.hasOwnProperty),Oe=We(RegExp.prototype.test),ji=uz(TypeError);function We(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return Eu(n,e,r)}}function uz(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return xu(n,t)}}function q(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ha;Zf&&Zf(n,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=t(i);s!==i&&(rz(e)||(e[r]=s),i=s)}n[i]=!0}return n}function hz(n){for(let e=0;e<n.length;e++)Je(n,e)||(n[e]=null);return n}function At(n){const e=ua(null);for(const[t,r]of hb(n))Je(n,t)&&(Array.isArray(r)?e[t]=hz(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=At(r):e[t]=r);return e}function qi(n,e){for(;n!==null;){const r=sz(n,e);if(r){if(r.get)return We(r.get);if(typeof r.value=="function")return We(r.value)}n=iz(n)}function t(){return null}return t}const Hf=Ze(["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"]),Ec=Ze(["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"]),xc=Ze(["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"]),dz=Ze(["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"]),Ac=Ze(["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"]),pz=Ze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Vf=Ze(["#text"]),Bf=Ze(["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"]),$c=Ze(["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"]),Gf=Ze(["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"]),Bo=Ze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),fz=ct(/\{\{[\w\W]*|[\w\W]*\}\}/gm),gz=ct(/<%[\w\W]*|[\w\W]*%>/gm),mz=ct(/\$\{[\w\W]*/gm),vz=ct(/^data-[\-\w.\u00B7-\uFFFF]+$/),yz=ct(/^aria-[\-\w]+$/),db=ct(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),bz=ct(/^(?:\w+script|data):/i),wz=ct(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),pb=ct(/^html$/i),Sz=ct(/^[a-z][.\w]*(-[.\w]+)+$/i);var jf=Object.freeze({__proto__:null,ARIA_ATTR:yz,ATTR_WHITESPACE:wz,CUSTOM_ELEMENT:Sz,DATA_ATTR:vz,DOCTYPE_NAME:pb,ERB_EXPR:gz,IS_ALLOWED_URI:db,IS_SCRIPT_OR_DATA:bz,MUSTACHE_EXPR:fz,TMPLIT_EXPR:mz});const Yi={element:1,text:3,progressingInstruction:7,comment:8,document:9},_z=function(){return typeof window>"u"?null:window},kz=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(r=t.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},qf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function fb(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_z();const e=M=>fb(M);if(e.version="3.3.3",e.removed=[],!n||!n.document||n.document.nodeType!==Yi.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const r=t,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:c,NodeFilter:u,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:p,DOMParser:v,trustedTypes:m}=n,E=c.prototype,k=qi(E,"cloneNode"),T=qi(E,"remove"),O=qi(E,"nextSibling"),P=qi(E,"childNodes"),V=qi(E,"parentNode");if(typeof o=="function"){const M=t.createElement("template");M.content&&M.content.ownerDocument&&(t=M.content.ownerDocument)}let F,B="";const{implementation:U,createNodeIterator:Q,createDocumentFragment:j,getElementsByTagName:rt}=t,{importNode:Mt}=r;let ke=qf();e.isSupported=typeof hb=="function"&&typeof V=="function"&&U&&U.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:zn,ERB_EXPR:St,TMPLIT_EXPR:on,DATA_ATTR:wl,ARIA_ATTR:wo,IS_SCRIPT_OR_DATA:Cb,ATTR_WHITESPACE:Uh,CUSTOM_ELEMENT:Pb}=jf;let{IS_ALLOWED_URI:Fh}=jf,$e=null;const Zh=q({},[...Hf,...Ec,...xc,...Ac,...Vf]);let Ce=null;const Wh=q({},[...Bf,...$c,...Gf,...Bo]);let ve=Object.seal(ua(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}})),Ni=null,So=null;const an=Object.seal(ua(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Hh=!0,Sl=!0,Vh=!1,Bh=!0,Tr=!1,_o=!0,On=!1,_l=!1,kl=!1,Cr=!1,ko=!1,Eo=!1,Gh=!0,jh=!1;const Rb="user-content-";let El=!0,Ui=!1,Pr={},_t=null;const xl=q({},["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 qh=null;const Yh=q({},["audio","video","img","source","image","track"]);let Al=null;const Xh=q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),xo="http://www.w3.org/1998/Math/MathML",Ao="http://www.w3.org/2000/svg",Nt="http://www.w3.org/1999/xhtml";let Rr=Nt,$l=!1,Il=null;const Db=q({},[xo,Ao,Nt],_c);let $o=q({},["mi","mo","mn","ms","mtext"]),Io=q({},["annotation-xml"]);const Lb=q({},["title","style","font","a","script"]);let Fi=null;const zb=["application/xhtml+xml","text/html"],Ob="text/html";let Ee=null,Dr=null;const Mb=t.createElement("form"),Kh=function(y){return y instanceof RegExp||y instanceof Function},Tl=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Dr&&Dr===y)){if((!y||typeof y!="object")&&(y={}),y=At(y),Fi=zb.indexOf(y.PARSER_MEDIA_TYPE)===-1?Ob:y.PARSER_MEDIA_TYPE,Ee=Fi==="application/xhtml+xml"?_c:ha,$e=Je(y,"ALLOWED_TAGS")?q({},y.ALLOWED_TAGS,Ee):Zh,Ce=Je(y,"ALLOWED_ATTR")?q({},y.ALLOWED_ATTR,Ee):Wh,Il=Je(y,"ALLOWED_NAMESPACES")?q({},y.ALLOWED_NAMESPACES,_c):Db,Al=Je(y,"ADD_URI_SAFE_ATTR")?q(At(Xh),y.ADD_URI_SAFE_ATTR,Ee):Xh,qh=Je(y,"ADD_DATA_URI_TAGS")?q(At(Yh),y.ADD_DATA_URI_TAGS,Ee):Yh,_t=Je(y,"FORBID_CONTENTS")?q({},y.FORBID_CONTENTS,Ee):xl,Ni=Je(y,"FORBID_TAGS")?q({},y.FORBID_TAGS,Ee):At({}),So=Je(y,"FORBID_ATTR")?q({},y.FORBID_ATTR,Ee):At({}),Pr=Je(y,"USE_PROFILES")?y.USE_PROFILES:!1,Hh=y.ALLOW_ARIA_ATTR!==!1,Sl=y.ALLOW_DATA_ATTR!==!1,Vh=y.ALLOW_UNKNOWN_PROTOCOLS||!1,Bh=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Tr=y.SAFE_FOR_TEMPLATES||!1,_o=y.SAFE_FOR_XML!==!1,On=y.WHOLE_DOCUMENT||!1,Cr=y.RETURN_DOM||!1,ko=y.RETURN_DOM_FRAGMENT||!1,Eo=y.RETURN_TRUSTED_TYPE||!1,kl=y.FORCE_BODY||!1,Gh=y.SANITIZE_DOM!==!1,jh=y.SANITIZE_NAMED_PROPS||!1,El=y.KEEP_CONTENT!==!1,Ui=y.IN_PLACE||!1,Fh=y.ALLOWED_URI_REGEXP||db,Rr=y.NAMESPACE||Nt,$o=y.MATHML_TEXT_INTEGRATION_POINTS||$o,Io=y.HTML_INTEGRATION_POINTS||Io,ve=y.CUSTOM_ELEMENT_HANDLING||{},y.CUSTOM_ELEMENT_HANDLING&&Kh(y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ve.tagNameCheck=y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),y.CUSTOM_ELEMENT_HANDLING&&Kh(y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ve.attributeNameCheck=y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),y.CUSTOM_ELEMENT_HANDLING&&typeof y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ve.allowCustomizedBuiltInElements=y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Tr&&(Sl=!1),ko&&(Cr=!0),Pr&&($e=q({},Vf),Ce=ua(null),Pr.html===!0&&(q($e,Hf),q(Ce,Bf)),Pr.svg===!0&&(q($e,Ec),q(Ce,$c),q(Ce,Bo)),Pr.svgFilters===!0&&(q($e,xc),q(Ce,$c),q(Ce,Bo)),Pr.mathMl===!0&&(q($e,Ac),q(Ce,Gf),q(Ce,Bo))),Je(y,"ADD_TAGS")||(an.tagCheck=null),Je(y,"ADD_ATTR")||(an.attributeCheck=null),y.ADD_TAGS&&(typeof y.ADD_TAGS=="function"?an.tagCheck=y.ADD_TAGS:($e===Zh&&($e=At($e)),q($e,y.ADD_TAGS,Ee))),y.ADD_ATTR&&(typeof y.ADD_ATTR=="function"?an.attributeCheck=y.ADD_ATTR:(Ce===Wh&&(Ce=At(Ce)),q(Ce,y.ADD_ATTR,Ee))),y.ADD_URI_SAFE_ATTR&&q(Al,y.ADD_URI_SAFE_ATTR,Ee),y.FORBID_CONTENTS&&(_t===xl&&(_t=At(_t)),q(_t,y.FORBID_CONTENTS,Ee)),y.ADD_FORBID_CONTENTS&&(_t===xl&&(_t=At(_t)),q(_t,y.ADD_FORBID_CONTENTS,Ee)),El&&($e["#text"]=!0),On&&q($e,["html","head","body"]),$e.table&&(q($e,["tbody"]),delete Ni.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw ji('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ji('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');F=y.TRUSTED_TYPES_POLICY,B=F.createHTML("")}else F===void 0&&(F=kz(m,i)),F!==null&&typeof B=="string"&&(B=F.createHTML(""));Ze&&Ze(y),Dr=y}},Jh=q({},[...Ec,...xc,...dz]),Qh=q({},[...Ac,...pz]),Nb=function(y){let C=V(y);(!C||!C.tagName)&&(C={namespaceURI:Rr,tagName:"template"});const R=ha(y.tagName),ue=ha(C.tagName);return Il[y.namespaceURI]?y.namespaceURI===Ao?C.namespaceURI===Nt?R==="svg":C.namespaceURI===xo?R==="svg"&&(ue==="annotation-xml"||$o[ue]):!!Jh[R]:y.namespaceURI===xo?C.namespaceURI===Nt?R==="math":C.namespaceURI===Ao?R==="math"&&Io[ue]:!!Qh[R]:y.namespaceURI===Nt?C.namespaceURI===Ao&&!Io[ue]||C.namespaceURI===xo&&!$o[ue]?!1:!Qh[R]&&(Lb[R]||!Jh[R]):!!(Fi==="application/xhtml+xml"&&Il[y.namespaceURI]):!1},kt=function(y){Bi(e.removed,{element:y});try{V(y).removeChild(y)}catch{T(y)}},Mn=function(y,C){try{Bi(e.removed,{attribute:C.getAttributeNode(y),from:C})}catch{Bi(e.removed,{attribute:null,from:C})}if(C.removeAttribute(y),y==="is")if(Cr||ko)try{kt(C)}catch{}else try{C.setAttribute(y,"")}catch{}},ed=function(y){let C=null,R=null;if(kl)y="<remove></remove>"+y;else{const be=kc(y,/^[\r\n\t ]+/);R=be&&be[0]}Fi==="application/xhtml+xml"&&Rr===Nt&&(y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+y+"</body></html>");const ue=F?F.createHTML(y):y;if(Rr===Nt)try{C=new v().parseFromString(ue,Fi)}catch{}if(!C||!C.documentElement){C=U.createDocument(Rr,"template",null);try{C.documentElement.innerHTML=$l?B:ue}catch{}}const De=C.body||C.documentElement;return y&&R&&De.insertBefore(t.createTextNode(R),De.childNodes[0]||null),Rr===Nt?rt.call(C,On?"html":"body")[0]:On?C.documentElement:De},td=function(y){return Q.call(y.ownerDocument||y,y,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Cl=function(y){return y instanceof p&&(typeof y.nodeName!="string"||typeof y.textContent!="string"||typeof y.removeChild!="function"||!(y.attributes instanceof h)||typeof y.removeAttribute!="function"||typeof y.setAttribute!="function"||typeof y.namespaceURI!="string"||typeof y.insertBefore!="function"||typeof y.hasChildNodes!="function")},nd=function(y){return typeof a=="function"&&y instanceof a};function Ut(M,y,C){Vo(M,R=>{R.call(e,y,C,Dr)})}const rd=function(y){let C=null;if(Ut(ke.beforeSanitizeElements,y,null),Cl(y))return kt(y),!0;const R=Ee(y.nodeName);if(Ut(ke.uponSanitizeElement,y,{tagName:R,allowedTags:$e}),_o&&y.hasChildNodes()&&!nd(y.firstElementChild)&&Oe(/<[/\w!]/g,y.innerHTML)&&Oe(/<[/\w!]/g,y.textContent)||y.nodeType===Yi.progressingInstruction||_o&&y.nodeType===Yi.comment&&Oe(/<[/\w]/g,y.data))return kt(y),!0;if(!(an.tagCheck instanceof Function&&an.tagCheck(R))&&(!$e[R]||Ni[R])){if(!Ni[R]&&sd(R)&&(ve.tagNameCheck instanceof RegExp&&Oe(ve.tagNameCheck,R)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(R)))return!1;if(El&&!_t[R]){const ue=V(y)||y.parentNode,De=P(y)||y.childNodes;if(De&&ue){const be=De.length;for(let He=be-1;He>=0;--He){const Ft=k(De[He],!0);Ft.__removalCount=(y.__removalCount||0)+1,ue.insertBefore(Ft,O(y))}}}return kt(y),!0}return y instanceof c&&!Nb(y)||(R==="noscript"||R==="noembed"||R==="noframes")&&Oe(/<\/no(script|embed|frames)/i,y.innerHTML)?(kt(y),!0):(Tr&&y.nodeType===Yi.text&&(C=y.textContent,Vo([zn,St,on],ue=>{C=Gi(C,ue," ")}),y.textContent!==C&&(Bi(e.removed,{element:y.cloneNode()}),y.textContent=C)),Ut(ke.afterSanitizeElements,y,null),!1)},id=function(y,C,R){if(So[C]||Gh&&(C==="id"||C==="name")&&(R in t||R in Mb))return!1;if(!(Sl&&!So[C]&&Oe(wl,C))){if(!(Hh&&Oe(wo,C))){if(!(an.attributeCheck instanceof Function&&an.attributeCheck(C,y))){if(!Ce[C]||So[C]){if(!(sd(y)&&(ve.tagNameCheck instanceof RegExp&&Oe(ve.tagNameCheck,y)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(y))&&(ve.attributeNameCheck instanceof RegExp&&Oe(ve.attributeNameCheck,C)||ve.attributeNameCheck instanceof Function&&ve.attributeNameCheck(C,y))||C==="is"&&ve.allowCustomizedBuiltInElements&&(ve.tagNameCheck instanceof RegExp&&Oe(ve.tagNameCheck,R)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(R))))return!1}else if(!Al[C]){if(!Oe(Fh,Gi(R,Uh,""))){if(!((C==="src"||C==="xlink:href"||C==="href")&&y!=="script"&&lz(R,"data:")===0&&qh[y])){if(!(Vh&&!Oe(Cb,Gi(R,Uh,"")))){if(R)return!1}}}}}}}return!0},sd=function(y){return y!=="annotation-xml"&&kc(y,Pb)},od=function(y){Ut(ke.beforeSanitizeAttributes,y,null);const{attributes:C}=y;if(!C||Cl(y))return;const R={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ce,forceKeepAttr:void 0};let ue=C.length;for(;ue--;){const De=C[ue],{name:be,namespaceURI:He,value:Ft}=De,Lr=Ee(be),Pl=Ft;let Pe=be==="value"?Pl:cz(Pl);if(R.attrName=Lr,R.attrValue=Pe,R.keepAttr=!0,R.forceKeepAttr=void 0,Ut(ke.uponSanitizeAttribute,y,R),Pe=R.attrValue,jh&&(Lr==="id"||Lr==="name")&&(Mn(be,y),Pe=Rb+Pe),_o&&Oe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Pe)){Mn(be,y);continue}if(Lr==="attributename"&&kc(Pe,"href")){Mn(be,y);continue}if(R.forceKeepAttr)continue;if(!R.keepAttr){Mn(be,y);continue}if(!Bh&&Oe(/\/>/i,Pe)){Mn(be,y);continue}Tr&&Vo([zn,St,on],ld=>{Pe=Gi(Pe,ld," ")});const ad=Ee(y.nodeName);if(!id(ad,Lr,Pe)){Mn(be,y);continue}if(F&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!He)switch(m.getAttributeType(ad,Lr)){case"TrustedHTML":{Pe=F.createHTML(Pe);break}case"TrustedScriptURL":{Pe=F.createScriptURL(Pe);break}}if(Pe!==Pl)try{He?y.setAttributeNS(He,be,Pe):y.setAttribute(be,Pe),Cl(y)?kt(y):Wf(e.removed)}catch{Mn(be,y)}}Ut(ke.afterSanitizeAttributes,y,null)},Ub=function M(y){let C=null;const R=td(y);for(Ut(ke.beforeSanitizeShadowDOM,y,null);C=R.nextNode();)Ut(ke.uponSanitizeShadowNode,C,null),rd(C),od(C),C.content instanceof s&&M(C.content);Ut(ke.afterSanitizeShadowDOM,y,null)};return e.sanitize=function(M){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=null,R=null,ue=null,De=null;if($l=!M,$l&&(M="<!-->"),typeof M!="string"&&!nd(M))if(typeof M.toString=="function"){if(M=M.toString(),typeof M!="string")throw ji("dirty is not a string, aborting")}else throw ji("toString is not a function");if(!e.isSupported)return M;if(_l||Tl(y),e.removed=[],typeof M=="string"&&(Ui=!1),Ui){if(M.nodeName){const Ft=Ee(M.nodeName);if(!$e[Ft]||Ni[Ft])throw ji("root node is forbidden and cannot be sanitized in-place")}}else if(M instanceof a)C=ed("<!---->"),R=C.ownerDocument.importNode(M,!0),R.nodeType===Yi.element&&R.nodeName==="BODY"||R.nodeName==="HTML"?C=R:C.appendChild(R);else{if(!Cr&&!Tr&&!On&&M.indexOf("<")===-1)return F&&Eo?F.createHTML(M):M;if(C=ed(M),!C)return Cr?null:Eo?B:""}C&&kl&&kt(C.firstChild);const be=td(Ui?M:C);for(;ue=be.nextNode();)rd(ue),od(ue),ue.content instanceof s&&Ub(ue.content);if(Ui)return M;if(Cr){if(ko)for(De=j.call(C.ownerDocument);C.firstChild;)De.appendChild(C.firstChild);else De=C;return(Ce.shadowroot||Ce.shadowrootmode)&&(De=Mt.call(r,De,!0)),De}let He=On?C.outerHTML:C.innerHTML;return On&&$e["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&Oe(pb,C.ownerDocument.doctype.name)&&(He="<!DOCTYPE "+C.ownerDocument.doctype.name+`>
|
|
412
|
-
`+He),Tr&&
|
|
413
|
-
]`).replace("lheading",
|
|
411
|
+
`},Ye=new WeakMap;customElements.define("screen-select",tz);function nz(n){const e=n.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}),t=12,r=n.getHours(),i=r%t===0?t:r%t,s=n.getMinutes().toString().padStart(2,"0"),o=r>=t?"pm":"am";return`${e} at ${i}:${s}${o}`}function rz(n,e){let t=null;const r=()=>e((t==null?void 0:t.messages)??[]),i=()=>{var a;const o=((a=n.activeServer)==null?void 0:a.acpClient)??null;o!==t&&(t==null||t.removeEventListener("change",r),t=o,t&&(t.addEventListener("change",r),t.connect().catch(c=>{console.error("ACPClient.connect() failed",c)})),r())};n.addEventListener("change",i),i();const s=()=>{n.removeEventListener("change",i),t==null||t.removeEventListener("change",r),t=null};return{dispose:s,[Symbol.dispose](){s()}}}/*! @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:db,setPrototypeOf:Wf,isFrozen:iz,getPrototypeOf:sz,getOwnPropertyDescriptor:oz}=Object;let{freeze:Ze,seal:ct,create:ha}=Object,{apply:xu,construct:Au}=typeof Reflect<"u"&&Reflect;Ze||(Ze=function(e){return e});ct||(ct=function(e){return e});xu||(xu=function(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(t,i)});Au||(Au=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return new e(...r)});const Bo=We(Array.prototype.forEach),az=We(Array.prototype.lastIndexOf),Hf=We(Array.prototype.pop),Gi=We(Array.prototype.push),lz=We(Array.prototype.splice),da=We(String.prototype.toLowerCase),kc=We(String.prototype.toString),Ec=We(String.prototype.match),ji=We(String.prototype.replace),cz=We(String.prototype.indexOf),uz=We(String.prototype.trim),Qe=We(Object.prototype.hasOwnProperty),Oe=We(RegExp.prototype.test),qi=hz(TypeError);function We(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return xu(n,e,r)}}function hz(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Au(n,t)}}function q(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:da;Wf&&Wf(n,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=t(i);s!==i&&(iz(e)||(e[r]=s),i=s)}n[i]=!0}return n}function dz(n){for(let e=0;e<n.length;e++)Qe(n,e)||(n[e]=null);return n}function At(n){const e=ha(null);for(const[t,r]of db(n))Qe(n,t)&&(Array.isArray(r)?e[t]=dz(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=At(r):e[t]=r);return e}function Yi(n,e){for(;n!==null;){const r=oz(n,e);if(r){if(r.get)return We(r.get);if(typeof r.value=="function")return We(r.value)}n=sz(n)}function t(){return null}return t}const Vf=Ze(["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"]),xc=Ze(["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"]),Ac=Ze(["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"]),pz=Ze(["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"]),$c=Ze(["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"]),fz=Ze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Bf=Ze(["#text"]),Gf=Ze(["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"]),Ic=Ze(["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"]),jf=Ze(["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"]),Go=Ze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),gz=ct(/\{\{[\w\W]*|[\w\W]*\}\}/gm),mz=ct(/<%[\w\W]*|[\w\W]*%>/gm),vz=ct(/\$\{[\w\W]*/gm),yz=ct(/^data-[\-\w.\u00B7-\uFFFF]+$/),bz=ct(/^aria-[\-\w]+$/),pb=ct(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),wz=ct(/^(?:\w+script|data):/i),Sz=ct(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fb=ct(/^html$/i),_z=ct(/^[a-z][.\w]*(-[.\w]+)+$/i);var qf=Object.freeze({__proto__:null,ARIA_ATTR:bz,ATTR_WHITESPACE:Sz,CUSTOM_ELEMENT:_z,DATA_ATTR:yz,DOCTYPE_NAME:fb,ERB_EXPR:mz,IS_ALLOWED_URI:pb,IS_SCRIPT_OR_DATA:wz,MUSTACHE_EXPR:gz,TMPLIT_EXPR:vz});const Xi={element:1,text:3,progressingInstruction:7,comment:8,document:9},kz=function(){return typeof window>"u"?null:window},Ez=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(r=t.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Yf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function gb(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:kz();const e=M=>gb(M);if(e.version="3.3.3",e.removed=[],!n||!n.document||n.document.nodeType!==Xi.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const r=t,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:c,NodeFilter:u,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:p,DOMParser:v,trustedTypes:m}=n,x=c.prototype,E=Yi(x,"cloneNode"),T=Yi(x,"remove"),O=Yi(x,"nextSibling"),P=Yi(x,"childNodes"),V=Yi(x,"parentNode");if(typeof o=="function"){const M=t.createElement("template");M.content&&M.content.ownerDocument&&(t=M.content.ownerDocument)}let F,B="";const{implementation:U,createNodeIterator:Q,createDocumentFragment:j,getElementsByTagName:rt}=t,{importNode:Mt}=r;let ke=Yf();e.isSupported=typeof db=="function"&&typeof V=="function"&&U&&U.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:zn,ERB_EXPR:St,TMPLIT_EXPR:on,DATA_ATTR:Sl,ARIA_ATTR:So,IS_SCRIPT_OR_DATA:Pb,ATTR_WHITESPACE:Fh,CUSTOM_ELEMENT:Rb}=qf;let{IS_ALLOWED_URI:Zh}=qf,$e=null;const Wh=q({},[...Vf,...xc,...Ac,...$c,...Bf]);let Ce=null;const Hh=q({},[...Gf,...Ic,...jf,...Go]);let ve=Object.seal(ha(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}})),Ui=null,_o=null;const an=Object.seal(ha(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Vh=!0,_l=!0,Bh=!1,Gh=!0,Tr=!1,ko=!0,On=!1,kl=!1,El=!1,Cr=!1,Eo=!1,xo=!1,jh=!0,qh=!1;const Db="user-content-";let xl=!0,Fi=!1,Pr={},_t=null;const Al=q({},["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 Yh=null;const Xh=q({},["audio","video","img","source","image","track"]);let $l=null;const Kh=q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ao="http://www.w3.org/1998/Math/MathML",$o="http://www.w3.org/2000/svg",Nt="http://www.w3.org/1999/xhtml";let Rr=Nt,Il=!1,Tl=null;const Lb=q({},[Ao,$o,Nt],kc);let Io=q({},["mi","mo","mn","ms","mtext"]),To=q({},["annotation-xml"]);const zb=q({},["title","style","font","a","script"]);let Zi=null;const Ob=["application/xhtml+xml","text/html"],Mb="text/html";let Ee=null,Dr=null;const Nb=t.createElement("form"),Jh=function(y){return y instanceof RegExp||y instanceof Function},Cl=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Dr&&Dr===y)){if((!y||typeof y!="object")&&(y={}),y=At(y),Zi=Ob.indexOf(y.PARSER_MEDIA_TYPE)===-1?Mb:y.PARSER_MEDIA_TYPE,Ee=Zi==="application/xhtml+xml"?kc:da,$e=Qe(y,"ALLOWED_TAGS")?q({},y.ALLOWED_TAGS,Ee):Wh,Ce=Qe(y,"ALLOWED_ATTR")?q({},y.ALLOWED_ATTR,Ee):Hh,Tl=Qe(y,"ALLOWED_NAMESPACES")?q({},y.ALLOWED_NAMESPACES,kc):Lb,$l=Qe(y,"ADD_URI_SAFE_ATTR")?q(At(Kh),y.ADD_URI_SAFE_ATTR,Ee):Kh,Yh=Qe(y,"ADD_DATA_URI_TAGS")?q(At(Xh),y.ADD_DATA_URI_TAGS,Ee):Xh,_t=Qe(y,"FORBID_CONTENTS")?q({},y.FORBID_CONTENTS,Ee):Al,Ui=Qe(y,"FORBID_TAGS")?q({},y.FORBID_TAGS,Ee):At({}),_o=Qe(y,"FORBID_ATTR")?q({},y.FORBID_ATTR,Ee):At({}),Pr=Qe(y,"USE_PROFILES")?y.USE_PROFILES:!1,Vh=y.ALLOW_ARIA_ATTR!==!1,_l=y.ALLOW_DATA_ATTR!==!1,Bh=y.ALLOW_UNKNOWN_PROTOCOLS||!1,Gh=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Tr=y.SAFE_FOR_TEMPLATES||!1,ko=y.SAFE_FOR_XML!==!1,On=y.WHOLE_DOCUMENT||!1,Cr=y.RETURN_DOM||!1,Eo=y.RETURN_DOM_FRAGMENT||!1,xo=y.RETURN_TRUSTED_TYPE||!1,El=y.FORCE_BODY||!1,jh=y.SANITIZE_DOM!==!1,qh=y.SANITIZE_NAMED_PROPS||!1,xl=y.KEEP_CONTENT!==!1,Fi=y.IN_PLACE||!1,Zh=y.ALLOWED_URI_REGEXP||pb,Rr=y.NAMESPACE||Nt,Io=y.MATHML_TEXT_INTEGRATION_POINTS||Io,To=y.HTML_INTEGRATION_POINTS||To,ve=y.CUSTOM_ELEMENT_HANDLING||{},y.CUSTOM_ELEMENT_HANDLING&&Jh(y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ve.tagNameCheck=y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),y.CUSTOM_ELEMENT_HANDLING&&Jh(y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ve.attributeNameCheck=y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),y.CUSTOM_ELEMENT_HANDLING&&typeof y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ve.allowCustomizedBuiltInElements=y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Tr&&(_l=!1),Eo&&(Cr=!0),Pr&&($e=q({},Bf),Ce=ha(null),Pr.html===!0&&(q($e,Vf),q(Ce,Gf)),Pr.svg===!0&&(q($e,xc),q(Ce,Ic),q(Ce,Go)),Pr.svgFilters===!0&&(q($e,Ac),q(Ce,Ic),q(Ce,Go)),Pr.mathMl===!0&&(q($e,$c),q(Ce,jf),q(Ce,Go))),Qe(y,"ADD_TAGS")||(an.tagCheck=null),Qe(y,"ADD_ATTR")||(an.attributeCheck=null),y.ADD_TAGS&&(typeof y.ADD_TAGS=="function"?an.tagCheck=y.ADD_TAGS:($e===Wh&&($e=At($e)),q($e,y.ADD_TAGS,Ee))),y.ADD_ATTR&&(typeof y.ADD_ATTR=="function"?an.attributeCheck=y.ADD_ATTR:(Ce===Hh&&(Ce=At(Ce)),q(Ce,y.ADD_ATTR,Ee))),y.ADD_URI_SAFE_ATTR&&q($l,y.ADD_URI_SAFE_ATTR,Ee),y.FORBID_CONTENTS&&(_t===Al&&(_t=At(_t)),q(_t,y.FORBID_CONTENTS,Ee)),y.ADD_FORBID_CONTENTS&&(_t===Al&&(_t=At(_t)),q(_t,y.ADD_FORBID_CONTENTS,Ee)),xl&&($e["#text"]=!0),On&&q($e,["html","head","body"]),$e.table&&(q($e,["tbody"]),delete Ui.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw qi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw qi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');F=y.TRUSTED_TYPES_POLICY,B=F.createHTML("")}else F===void 0&&(F=Ez(m,i)),F!==null&&typeof B=="string"&&(B=F.createHTML(""));Ze&&Ze(y),Dr=y}},Qh=q({},[...xc,...Ac,...pz]),ed=q({},[...$c,...fz]),Ub=function(y){let C=V(y);(!C||!C.tagName)&&(C={namespaceURI:Rr,tagName:"template"});const R=da(y.tagName),ue=da(C.tagName);return Tl[y.namespaceURI]?y.namespaceURI===$o?C.namespaceURI===Nt?R==="svg":C.namespaceURI===Ao?R==="svg"&&(ue==="annotation-xml"||Io[ue]):!!Qh[R]:y.namespaceURI===Ao?C.namespaceURI===Nt?R==="math":C.namespaceURI===$o?R==="math"&&To[ue]:!!ed[R]:y.namespaceURI===Nt?C.namespaceURI===$o&&!To[ue]||C.namespaceURI===Ao&&!Io[ue]?!1:!ed[R]&&(zb[R]||!Qh[R]):!!(Zi==="application/xhtml+xml"&&Tl[y.namespaceURI]):!1},kt=function(y){Gi(e.removed,{element:y});try{V(y).removeChild(y)}catch{T(y)}},Mn=function(y,C){try{Gi(e.removed,{attribute:C.getAttributeNode(y),from:C})}catch{Gi(e.removed,{attribute:null,from:C})}if(C.removeAttribute(y),y==="is")if(Cr||Eo)try{kt(C)}catch{}else try{C.setAttribute(y,"")}catch{}},td=function(y){let C=null,R=null;if(El)y="<remove></remove>"+y;else{const be=Ec(y,/^[\r\n\t ]+/);R=be&&be[0]}Zi==="application/xhtml+xml"&&Rr===Nt&&(y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+y+"</body></html>");const ue=F?F.createHTML(y):y;if(Rr===Nt)try{C=new v().parseFromString(ue,Zi)}catch{}if(!C||!C.documentElement){C=U.createDocument(Rr,"template",null);try{C.documentElement.innerHTML=Il?B:ue}catch{}}const De=C.body||C.documentElement;return y&&R&&De.insertBefore(t.createTextNode(R),De.childNodes[0]||null),Rr===Nt?rt.call(C,On?"html":"body")[0]:On?C.documentElement:De},nd=function(y){return Q.call(y.ownerDocument||y,y,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Pl=function(y){return y instanceof p&&(typeof y.nodeName!="string"||typeof y.textContent!="string"||typeof y.removeChild!="function"||!(y.attributes instanceof h)||typeof y.removeAttribute!="function"||typeof y.setAttribute!="function"||typeof y.namespaceURI!="string"||typeof y.insertBefore!="function"||typeof y.hasChildNodes!="function")},rd=function(y){return typeof a=="function"&&y instanceof a};function Ut(M,y,C){Bo(M,R=>{R.call(e,y,C,Dr)})}const id=function(y){let C=null;if(Ut(ke.beforeSanitizeElements,y,null),Pl(y))return kt(y),!0;const R=Ee(y.nodeName);if(Ut(ke.uponSanitizeElement,y,{tagName:R,allowedTags:$e}),ko&&y.hasChildNodes()&&!rd(y.firstElementChild)&&Oe(/<[/\w!]/g,y.innerHTML)&&Oe(/<[/\w!]/g,y.textContent)||y.nodeType===Xi.progressingInstruction||ko&&y.nodeType===Xi.comment&&Oe(/<[/\w]/g,y.data))return kt(y),!0;if(!(an.tagCheck instanceof Function&&an.tagCheck(R))&&(!$e[R]||Ui[R])){if(!Ui[R]&&od(R)&&(ve.tagNameCheck instanceof RegExp&&Oe(ve.tagNameCheck,R)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(R)))return!1;if(xl&&!_t[R]){const ue=V(y)||y.parentNode,De=P(y)||y.childNodes;if(De&&ue){const be=De.length;for(let He=be-1;He>=0;--He){const Ft=E(De[He],!0);Ft.__removalCount=(y.__removalCount||0)+1,ue.insertBefore(Ft,O(y))}}}return kt(y),!0}return y instanceof c&&!Ub(y)||(R==="noscript"||R==="noembed"||R==="noframes")&&Oe(/<\/no(script|embed|frames)/i,y.innerHTML)?(kt(y),!0):(Tr&&y.nodeType===Xi.text&&(C=y.textContent,Bo([zn,St,on],ue=>{C=ji(C,ue," ")}),y.textContent!==C&&(Gi(e.removed,{element:y.cloneNode()}),y.textContent=C)),Ut(ke.afterSanitizeElements,y,null),!1)},sd=function(y,C,R){if(_o[C]||jh&&(C==="id"||C==="name")&&(R in t||R in Nb))return!1;if(!(_l&&!_o[C]&&Oe(Sl,C))){if(!(Vh&&Oe(So,C))){if(!(an.attributeCheck instanceof Function&&an.attributeCheck(C,y))){if(!Ce[C]||_o[C]){if(!(od(y)&&(ve.tagNameCheck instanceof RegExp&&Oe(ve.tagNameCheck,y)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(y))&&(ve.attributeNameCheck instanceof RegExp&&Oe(ve.attributeNameCheck,C)||ve.attributeNameCheck instanceof Function&&ve.attributeNameCheck(C,y))||C==="is"&&ve.allowCustomizedBuiltInElements&&(ve.tagNameCheck instanceof RegExp&&Oe(ve.tagNameCheck,R)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(R))))return!1}else if(!$l[C]){if(!Oe(Zh,ji(R,Fh,""))){if(!((C==="src"||C==="xlink:href"||C==="href")&&y!=="script"&&cz(R,"data:")===0&&Yh[y])){if(!(Bh&&!Oe(Pb,ji(R,Fh,"")))){if(R)return!1}}}}}}}return!0},od=function(y){return y!=="annotation-xml"&&Ec(y,Rb)},ad=function(y){Ut(ke.beforeSanitizeAttributes,y,null);const{attributes:C}=y;if(!C||Pl(y))return;const R={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ce,forceKeepAttr:void 0};let ue=C.length;for(;ue--;){const De=C[ue],{name:be,namespaceURI:He,value:Ft}=De,Lr=Ee(be),Rl=Ft;let Pe=be==="value"?Rl:uz(Rl);if(R.attrName=Lr,R.attrValue=Pe,R.keepAttr=!0,R.forceKeepAttr=void 0,Ut(ke.uponSanitizeAttribute,y,R),Pe=R.attrValue,qh&&(Lr==="id"||Lr==="name")&&(Mn(be,y),Pe=Db+Pe),ko&&Oe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Pe)){Mn(be,y);continue}if(Lr==="attributename"&&Ec(Pe,"href")){Mn(be,y);continue}if(R.forceKeepAttr)continue;if(!R.keepAttr){Mn(be,y);continue}if(!Gh&&Oe(/\/>/i,Pe)){Mn(be,y);continue}Tr&&Bo([zn,St,on],cd=>{Pe=ji(Pe,cd," ")});const ld=Ee(y.nodeName);if(!sd(ld,Lr,Pe)){Mn(be,y);continue}if(F&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!He)switch(m.getAttributeType(ld,Lr)){case"TrustedHTML":{Pe=F.createHTML(Pe);break}case"TrustedScriptURL":{Pe=F.createScriptURL(Pe);break}}if(Pe!==Rl)try{He?y.setAttributeNS(He,be,Pe):y.setAttribute(be,Pe),Pl(y)?kt(y):Hf(e.removed)}catch{Mn(be,y)}}Ut(ke.afterSanitizeAttributes,y,null)},Fb=function M(y){let C=null;const R=nd(y);for(Ut(ke.beforeSanitizeShadowDOM,y,null);C=R.nextNode();)Ut(ke.uponSanitizeShadowNode,C,null),id(C),ad(C),C.content instanceof s&&M(C.content);Ut(ke.afterSanitizeShadowDOM,y,null)};return e.sanitize=function(M){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=null,R=null,ue=null,De=null;if(Il=!M,Il&&(M="<!-->"),typeof M!="string"&&!rd(M))if(typeof M.toString=="function"){if(M=M.toString(),typeof M!="string")throw qi("dirty is not a string, aborting")}else throw qi("toString is not a function");if(!e.isSupported)return M;if(kl||Cl(y),e.removed=[],typeof M=="string"&&(Fi=!1),Fi){if(M.nodeName){const Ft=Ee(M.nodeName);if(!$e[Ft]||Ui[Ft])throw qi("root node is forbidden and cannot be sanitized in-place")}}else if(M instanceof a)C=td("<!---->"),R=C.ownerDocument.importNode(M,!0),R.nodeType===Xi.element&&R.nodeName==="BODY"||R.nodeName==="HTML"?C=R:C.appendChild(R);else{if(!Cr&&!Tr&&!On&&M.indexOf("<")===-1)return F&&xo?F.createHTML(M):M;if(C=td(M),!C)return Cr?null:xo?B:""}C&&El&&kt(C.firstChild);const be=nd(Fi?M:C);for(;ue=be.nextNode();)id(ue),ad(ue),ue.content instanceof s&&Fb(ue.content);if(Fi)return M;if(Cr){if(Eo)for(De=j.call(C.ownerDocument);C.firstChild;)De.appendChild(C.firstChild);else De=C;return(Ce.shadowroot||Ce.shadowrootmode)&&(De=Mt.call(r,De,!0)),De}let He=On?C.outerHTML:C.innerHTML;return On&&$e["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&Oe(fb,C.ownerDocument.doctype.name)&&(He="<!DOCTYPE "+C.ownerDocument.doctype.name+`>
|
|
412
|
+
`+He),Tr&&Bo([zn,St,on],Ft=>{He=ji(He,Ft," ")}),F&&xo?F.createHTML(He):He},e.setConfig=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Cl(M),kl=!0},e.clearConfig=function(){Dr=null,kl=!1},e.isValidAttribute=function(M,y,C){Dr||Cl({});const R=Ee(M),ue=Ee(y);return sd(R,ue,C)},e.addHook=function(M,y){typeof y=="function"&&Gi(ke[M],y)},e.removeHook=function(M,y){if(y!==void 0){const C=az(ke[M],y);return C===-1?void 0:lz(ke[M],C,1)[0]}return Hf(ke[M])},e.removeHooks=function(M){ke[M]=[]},e.removeAllHooks=function(){ke=Yf()},e}var mb=gb();function $h(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ir=$h();function vb(n){Ir=n}var Gn={exec:()=>null};function J(n,e=""){let t=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Ue.caret,"$1"),t=t.replace(i,o),r},getRegex:()=>new RegExp(t,e)};return r}var xz=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ue={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)}}>`)},Az=/^(?:[ \t]*(?:\n|$))+/,$z=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Iz=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,wo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Tz=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ih=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,yb=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,bb=J(yb).replace(/bull/g,Ih).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(),Cz=J(yb).replace(/bull/g,Ih).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(),Th=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Pz=/^[^\n]+/,Ch=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Rz=J(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ch).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Dz=J(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ih).getRegex(),bl="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",Ph=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Lz=J("^ {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",Ph).replace("tag",bl).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),wb=J(Th).replace("hr",wo).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",bl).getRegex(),zz=J(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",wb).getRegex(),Rh={blockquote:zz,code:$z,def:Rz,fences:Iz,heading:Tz,hr:wo,html:Lz,lheading:bb,list:Dz,newline:Az,paragraph:wb,table:Gn,text:Pz},Xf=J("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",wo).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",bl).getRegex(),Oz={...Rh,lheading:Cz,table:Xf,paragraph:J(Th).replace("hr",wo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Xf).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",bl).getRegex()},Mz={...Rh,html:J(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ph).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:Gn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:J(Th).replace("hr",wo).replace("heading",` *#{1,6} *[^
|
|
413
|
+
]`).replace("lheading",bb).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Nz=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Uz=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Sb=/^( {2,}|\\)\n(?!\s*$)/,Fz=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ni=/[\p{P}\p{S}]/u,wl=/[\s\p{P}\p{S}]/u,Dh=/[^\s\p{P}\p{S}]/u,Zz=J(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,wl).getRegex(),_b=/(?!~)[\p{P}\p{S}]/u,Wz=/(?!~)[\s\p{P}\p{S}]/u,Hz=/(?:[^\s\p{P}\p{S}]|~)/u,Vz=J(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",xz?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),kb=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Bz=J(kb,"u").replace(/punct/g,Ni).getRegex(),Gz=J(kb,"u").replace(/punct/g,_b).getRegex(),Eb="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",jz=J(Eb,"gu").replace(/notPunctSpace/g,Dh).replace(/punctSpace/g,wl).replace(/punct/g,Ni).getRegex(),qz=J(Eb,"gu").replace(/notPunctSpace/g,Hz).replace(/punctSpace/g,Wz).replace(/punct/g,_b).getRegex(),Yz=J("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Dh).replace(/punctSpace/g,wl).replace(/punct/g,Ni).getRegex(),Xz=J(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Ni).getRegex(),Kz="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Jz=J(Kz,"gu").replace(/notPunctSpace/g,Dh).replace(/punctSpace/g,wl).replace(/punct/g,Ni).getRegex(),Qz=J(/\\(punct)/,"gu").replace(/punct/g,Ni).getRegex(),eO=J(/^<(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(),tO=J(Ph).replace("(?:-->|$)","-->").getRegex(),nO=J("^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",tO).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ca=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,rO=J(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Ca).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),xb=J(/^!?\[(label)\]\[(ref)\]/).replace("label",Ca).replace("ref",Ch).getRegex(),Ab=J(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ch).getRegex(),iO=J("reflink|nolink(?!\\()","g").replace("reflink",xb).replace("nolink",Ab).getRegex(),Kf=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Lh={_backpedal:Gn,anyPunctuation:Qz,autolink:eO,blockSkip:Vz,br:Sb,code:Uz,del:Gn,delLDelim:Gn,delRDelim:Gn,emStrongLDelim:Bz,emStrongRDelimAst:jz,emStrongRDelimUnd:Yz,escape:Nz,link:rO,nolink:Ab,punctuation:Zz,reflink:xb,reflinkSearch:iO,tag:nO,text:Fz,url:Gn},sO={...Lh,link:J(/^!?\[(label)\]\((.*?)\)/).replace("label",Ca).getRegex(),reflink:J(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ca).getRegex()},$u={...Lh,emStrongRDelimAst:qz,emStrongLDelim:Gz,delLDelim:Xz,delRDelim:Jz,url:J(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Kf).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:J(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Kf).getRegex()},oO={...$u,br:J(Sb).replace("{2,}","*").getRegex(),text:J($u.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},jo={normal:Rh,gfm:Oz,pedantic:Mz},Ki={normal:Lh,gfm:$u,breaks:oO,pedantic:sO},aO={"&":"&","<":"<",">":">",'"':""","'":"'"},Jf=n=>aO[n];function $t(n,e){if(e){if(Ue.escapeTest.test(n))return n.replace(Ue.escapeReplace,Jf)}else if(Ue.escapeTestNoEncode.test(n))return n.replace(Ue.escapeReplaceNoEncode,Jf);return n}function Qf(n){try{n=encodeURI(n).replace(Ue.percentDecode,"%")}catch{return null}return n}function eg(n,e){var s;let t=n.replace(Ue.findPipe,(o,a,c)=>{let u=!1,h=a;for(;--h>=0&&c[h]==="\\";)u=!u;return u?"|":" |"}),r=t.split(Ue.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Ue.slashPipe,"|");return r}function Ji(n,e,t){let r=n.length;if(r===0)return"";let i=0;for(;i<r&&n.charAt(r-i-1)===e;)i++;return n.slice(0,r-i)}function lO(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===e[0])t++;else if(n[r]===e[1]&&(t--,t<0))return r;return t>0?-2:-1}function cO(n,e=0){let t=e,r="";for(let i of n)if(i===" "){let s=4-t%4;r+=" ".repeat(s),t+=s}else r+=i,t++;return r}function tg(n,e,t,r,i){let s=e.href,o=e.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,c}function uO(n,e,t){let r=n.match(t.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
|
|
414
414
|
`).map(s=>{let o=s.match(t.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(`
|
|
415
|
-
`)}var
|
|
416
|
-
`)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=
|
|
417
|
-
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=
|
|
415
|
+
`)}var Pa=class{constructor(n){b(this,"options");b(this,"rules");b(this,"lexer");this.options=n||Ir}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:Ji(t,`
|
|
416
|
+
`)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=uO(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let r=Ji(t,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(t=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:Ji(e[0],`
|
|
417
|
+
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=Ji(e[0],`
|
|
418
418
|
`).split(`
|
|
419
419
|
`),r="",i="",s=[];for(;t.length>0;){let o=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),o=!0;else if(!o)a.push(t[c]);else break;t=t.slice(c);let u=a.join(`
|
|
420
420
|
`),h=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
421
421
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
422
422
|
${u}`:u,i=i?`${i}
|
|
423
|
-
${h}`:h;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,s,!0),this.lexer.state.top=p,t.length===0)break;let v=s.at(-1);if((v==null?void 0:v.type)==="code")break;if((v==null?void 0:v.type)==="blockquote"){let m=v,
|
|
423
|
+
${h}`:h;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,s,!0),this.lexer.state.top=p,t.length===0)break;let v=s.at(-1);if((v==null?void 0:v.type)==="code")break;if((v==null?void 0:v.type)==="blockquote"){let m=v,x=m.raw+`
|
|
424
424
|
`+t.join(`
|
|
425
|
-
`),
|
|
425
|
+
`),E=this.blockquote(x);s[s.length-1]=E,r=r.substring(0,r.length-m.raw.length)+E.raw,i=i.substring(0,i.length-m.text.length)+E.text;break}else if((v==null?void 0:v.type)==="list"){let m=v,x=m.raw+`
|
|
426
426
|
`+t.join(`
|
|
427
|
-
`),
|
|
428
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(n){var t,r;let e=this.rules.block.list.exec(n);if(e){let i=e[1].trim(),s=i.length>1,o={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let a=this.rules.other.listItemRegex(i),c=!1;for(;n;){let h=!1,p="",v="";if(!(e=a.exec(n))||this.rules.block.hr.test(n))break;p=e[0],n=n.substring(p.length);let m=
|
|
429
|
-
`,1)[0],e[1].length),
|
|
430
|
-
`,1)[0],
|
|
431
|
-
`,n=n.substring(
|
|
432
|
-
`,1)[0],j;if(
|
|
433
|
-
`+j.slice(T);else{if(
|
|
434
|
-
`+E
|
|
435
|
-
`,n=n.substring(Q.length+1),m=j.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,""),((t=h.tokens[0])==null?void 0:t.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(m=>m.type==="space"),v=p.length>0&&p.some(m=>this.rules.other.anyLine.test(m.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 e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:r,title:i}}}table(n){var o;let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=
|
|
436
|
-
`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.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<t.length;a++)s.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:s.align[a]});for(let a of i)s.rows.push(
|
|
437
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=
|
|
427
|
+
`),E=this.list(x);s[s.length-1]=E,r=r.substring(0,r.length-v.raw.length)+E.raw,i=i.substring(0,i.length-m.raw.length)+E.raw,t=x.substring(s.at(-1).raw.length).split(`
|
|
428
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(n){var t,r;let e=this.rules.block.list.exec(n);if(e){let i=e[1].trim(),s=i.length>1,o={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let a=this.rules.other.listItemRegex(i),c=!1;for(;n;){let h=!1,p="",v="";if(!(e=a.exec(n))||this.rules.block.hr.test(n))break;p=e[0],n=n.substring(p.length);let m=cO(e[2].split(`
|
|
429
|
+
`,1)[0],e[1].length),x=n.split(`
|
|
430
|
+
`,1)[0],E=!m.trim(),T=0;if(this.options.pedantic?(T=2,v=m.trimStart()):E?T=e[1].length+1:(T=m.search(this.rules.other.nonSpaceChar),T=T>4?1:T,v=m.slice(T),T+=e[1].length),E&&this.rules.other.blankLine.test(x)&&(p+=x+`
|
|
431
|
+
`,n=n.substring(x.length+1),h=!0),!h){let O=this.rules.other.nextBulletRegex(T),P=this.rules.other.hrRegex(T),V=this.rules.other.fencesBeginRegex(T),F=this.rules.other.headingBeginRegex(T),B=this.rules.other.htmlBeginRegex(T),U=this.rules.other.blockquoteBeginRegex(T);for(;n;){let Q=n.split(`
|
|
432
|
+
`,1)[0],j;if(x=Q,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),j=x):j=x.replace(this.rules.other.tabCharGlobal," "),V.test(x)||F.test(x)||B.test(x)||U.test(x)||O.test(x)||P.test(x))break;if(j.search(this.rules.other.nonSpaceChar)>=T||!x.trim())v+=`
|
|
433
|
+
`+j.slice(T);else{if(E||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||V.test(m)||F.test(m)||P.test(m))break;v+=`
|
|
434
|
+
`+x}E=!x.trim(),p+=Q+`
|
|
435
|
+
`,n=n.substring(Q.length+1),m=j.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,""),((t=h.tokens[0])==null?void 0:t.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(m=>m.type==="space"),v=p.length>0&&p.some(m=>this.rules.other.anyLine.test(m.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 e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:r,title:i}}}table(n){var o;let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=eg(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
436
|
+
`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.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<t.length;a++)s.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:s.align[a]});for(let a of i)s.rows.push(eg(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 e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
437
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=Ji(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=lO(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?r=r.slice(1):r=r.slice(1,-1)),tg(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let r=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){let s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return tg(t,i,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...r[0]].length-1,s,o,a=i,c=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*n.length+i);(r=u.exec(e))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(o=[...s].length,r[3]||r[4]){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 m=p.slice(1,-1);return{type:"em",raw:p,text:m,tokens:this.lexer.inlineTokens(m)}}let v=p.slice(2,-2);return{type:"strong",raw:p,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return r&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let r=this.rules.inline.delLDelim.exec(n);if(r&&(!r[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...r[0]].length-1,s,o,a=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*n.length+i);(r=c.exec(e))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(o=[...s].length,o!==i))continue;if(r[3]||r[4]){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 e=this.rules.inline.autolink.exec(n);if(e){let t,r;return e[2]==="@"?(t=e[1],r="mailto:"+t):(t=e[1],r=t),{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(n){var t;let e;if(e=this.rules.inline.url.exec(n)){let r,i;if(e[2]==="@")r=e[0],i="mailto:"+r;else{let s;do s=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(s!==e[0]);r=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},yt=class Iu{constructor(e){b(this,"tokens");b(this,"options");b(this,"state");b(this,"inlineQueue");b(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ir,this.options.tokenizer=this.options.tokenizer||new Pa,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Ue,block:jo.normal,inline:Ki.normal};this.options.pedantic?(t.block=jo.pedantic,t.inline=Ki.pedantic):this.options.gfm&&(t.block=jo.gfm,this.options.breaks?t.inline=Ki.breaks:t.inline=Ki.gfm),this.tokenizer.rules=t}static get rules(){return{block:jo,inline:Ki}}static lex(e,t){return new Iu(t).lex(e)}static lexInline(e,t){return new Iu(t).inlineTokens(e)}lex(e){e=e.replace(Ue.carriageReturn,`
|
|
438
438
|
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){var i,s,o;for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Ue.tabCharGlobal," ").replace(Ue.spaceLine,""));e;){let a;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(u=>(a=u.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let u=t.at(-1);a.raw.length===1&&u!==void 0?u.raw+=`
|
|
439
439
|
`:t.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
|
|
440
440
|
`)?"":`
|
|
@@ -448,7 +448,7 @@ ${h}`:h;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
448
448
|
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(a),r=c.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
|
|
449
449
|
`)?"":`
|
|
450
450
|
`)+a.raw,u.text+=`
|
|
451
|
-
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(a);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var c,u,h,p,v;this.tokenizer.lexer=this;let r=e,i=null;if(this.tokens.links){let m=Object.keys(this.tokens.links);if(m.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)m.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(;e;){o||(a=""),o=!1;let m;if((p=(h=this.options.extensions)==null?void 0:h.inline)!=null&&p.some(
|
|
451
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(a);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var c,u,h,p,v;this.tokenizer.lexer=this;let r=e,i=null;if(this.tokens.links){let m=Object.keys(this.tokens.links);if(m.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)m.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(;e;){o||(a=""),o=!1;let m;if((p=(h=this.options.extensions)==null?void 0:h.inline)!=null&&p.some(E=>(m=E.call({lexer:this},e,t))?(e=e.substring(m.raw.length),t.push(m),!0):!1))continue;if(m=this.tokenizer.escape(e)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.tag(e)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.link(e)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(m.raw.length);let E=t.at(-1);m.type==="text"&&(E==null?void 0:E.type)==="text"?(E.raw+=m.raw,E.text+=m.text):t.push(m);continue}if(m=this.tokenizer.emStrong(e,r,a)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.codespan(e)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.br(e)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.del(e,r,a)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.autolink(e)){e=e.substring(m.raw.length),t.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(e))){e=e.substring(m.raw.length),t.push(m);continue}let x=e;if((v=this.options.extensions)!=null&&v.startInline){let E=1/0,T=e.slice(1),O;this.options.extensions.startInline.forEach(P=>{O=P.call({lexer:this},T),typeof O=="number"&&O>=0&&(E=Math.min(E,O))}),E<1/0&&E>=0&&(x=e.substring(0,E+1))}if(m=this.tokenizer.inlineText(x)){e=e.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(a=m.raw.slice(-1)),o=!0;let E=t.at(-1);(E==null?void 0:E.type)==="text"?(E.raw+=m.raw,E.text+=m.text):t.push(m);continue}if(e){let E="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(E);break}else throw new Error(E)}}return t}},Ra=class{constructor(n){b(this,"options");b(this,"parser");this.options=n||Ir}space(n){return""}code({text:n,lang:e,escaped:t}){var s;let r=(s=(e||"").match(Ue.notSpaceStart))==null?void 0:s[0],i=n.replace(Ue.endingNewline,"")+`
|
|
452
452
|
`;return r?'<pre><code class="language-'+$t(r)+'">'+(t?i:$t(i,!0))+`</code></pre>
|
|
453
453
|
`:"<pre><code>"+(t?i:$t(i,!0))+`</code></pre>
|
|
454
454
|
`}blockquote({tokens:n}){return`<blockquote>
|
|
@@ -466,16 +466,16 @@ ${this.parser.parse(n)}</blockquote>
|
|
|
466
466
|
`}tablerow({text:n}){return`<tr>
|
|
467
467
|
${n}</tr>
|
|
468
468
|
`}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
|
|
469
|
-
`}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>${$t(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let r=this.parser.parseInline(t),i=
|
|
470
|
-
Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+$t(t.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(t);throw t}}},kr=new
|
|
469
|
+
`}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>${$t(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let r=this.parser.parseInline(t),i=Qf(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return e&&(s+=' title="'+$t(e)+'"'),s+=">"+r+"</a>",s}image({href:n,title:e,text:t,tokens:r}){r&&(t=this.parser.parseInline(r,this.parser.textRenderer));let i=Qf(n);if(i===null)return $t(t);n=i;let s=`<img src="${n}" alt="${$t(t)}"`;return e&&(s+=` title="${$t(e)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:$t(n.text)}},zh=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}},bt=class Tu{constructor(e){b(this,"options");b(this,"renderer");b(this,"textRenderer");this.options=e||Ir,this.options.renderer=this.options.renderer||new Ra,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new zh}static parse(e,t){return new Tu(t).parse(e)}static parseInline(e,t){return new Tu(t).parseInline(e)}parse(e){var r,i;this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let o=e[s];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){let c=o,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){t+=u||"";continue}}let a=o;switch(a.type){case"space":{t+=this.renderer.space(a);break}case"hr":{t+=this.renderer.hr(a);break}case"heading":{t+=this.renderer.heading(a);break}case"code":{t+=this.renderer.code(a);break}case"table":{t+=this.renderer.table(a);break}case"blockquote":{t+=this.renderer.blockquote(a);break}case"list":{t+=this.renderer.list(a);break}case"checkbox":{t+=this.renderer.checkbox(a);break}case"html":{t+=this.renderer.html(a);break}case"def":{t+=this.renderer.def(a);break}case"paragraph":{t+=this.renderer.paragraph(a);break}case"text":{t+=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 t}parseInline(e,t=this.renderer){var i,s;this.renderer.parser=this;let r="";for(let o=0;o<e.length;o++){let a=e[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+=t.text(c);break}case"html":{r+=t.html(c);break}case"link":{r+=t.link(c);break}case"image":{r+=t.image(c);break}case"checkbox":{r+=t.checkbox(c);break}case"strong":{r+=t.strong(c);break}case"em":{r+=t.em(c);break}case"codespan":{r+=t.codespan(c);break}case"br":{r+=t.br(c);break}case"del":{r+=t.del(c);break}case"text":{r+=t.text(c);break}default:{let u='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},qo,os=(qo=class{constructor(n){b(this,"options");b(this,"block");this.options=n||Ir}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?yt.lex:yt.lexInline}provideParser(){return this.block?bt.parse:bt.parseInline}},b(qo,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),b(qo,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),qo),hO=class{constructor(...n){b(this,"defaults",$h());b(this,"options",this.setOptions);b(this,"parse",this.parseMarkdown(!0));b(this,"parseInline",this.parseMarkdown(!1));b(this,"Parser",bt);b(this,"Renderer",Ra);b(this,"TextRenderer",zh);b(this,"Lexer",yt);b(this,"Tokenizer",Pa);b(this,"Hooks",os);this.use(...n)}walkTokens(n,e){var r,i;let t=[];for(let s of n)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let o=s;for(let a of o.header)t=t.concat(this.walkTokens(a.tokens,e));for(let a of o.rows)for(let c of a)t=t.concat(this.walkTokens(c.tokens,e));break}case"list":{let o=s;t=t.concat(this.walkTokens(o.items,e));break}default:{let o=s;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{let c=o[a].flat(1/0);t=t.concat(this.walkTokens(c,e))}):o.tokens&&(t=t.concat(this.walkTokens(o.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let r={...t};if(r.async=this.defaults.async||r.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),t.renderer){let i=this.defaults.renderer||new Ra(this.defaults);for(let s in t.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=t.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(t.tokenizer){let i=this.defaults.tokenizer||new Pa(this.defaults);for(let s in t.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=t.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(t.hooks){let i=this.defaults.hooks||new os;for(let s in t.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=t.hooks[o],c=i[o];os.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&os.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(t.walkTokens){let i=this.defaults.walkTokens,s=t.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,e){return yt.lex(n,e??this.defaults)}parser(n,e){return bt.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let r={...t},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=n),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer():n?yt.lex:yt.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?bt.parse:bt.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer():n?yt.lex:yt.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser():n?bt.parse:bt.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return s(o)}}}onError(n,e){return t=>{if(t.message+=`
|
|
470
|
+
Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+$t(t.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(t);throw t}}},kr=new hO;function se(n,e){return kr.parse(n,e)}se.options=se.setOptions=function(n){return kr.setOptions(n),se.defaults=kr.defaults,vb(se.defaults),se};se.getDefaults=$h;se.defaults=Ir;se.use=function(...n){return kr.use(...n),se.defaults=kr.defaults,vb(se.defaults),se};se.walkTokens=function(n,e){return kr.walkTokens(n,e)};se.parseInline=kr.parseInline;se.Parser=bt;se.parser=bt.parse;se.Renderer=Ra;se.TextRenderer=zh;se.Lexer=yt;se.lexer=yt.lex;se.Tokenizer=Pa;se.Hooks=os;se.parse=se;se.options;se.setOptions;se.use;se.walkTokens;se.parseInline;bt.parse;yt.lex;mb.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function dO(n){const e=se.parse(n,{async:!1});return mb.sanitize(e,{USE_PROFILES:{html:!0}})}const pO=8,ng=new WeakMap;function fO(n){const e=ng.get(n);if(e&&e.text===n.text)return e.html;const t=dO(n.text);return ng.set(n,{text:n.text,html:t}),t}function gO(n){return n.replace(/_/g," ")}function mO(n){return N`
|
|
471
471
|
<div class="tool-call-header">
|
|
472
472
|
<span class="tool-call-title">${n.title}</span>
|
|
473
|
-
<span class="tool-call-meta">${n.toolKind} · ${
|
|
473
|
+
<span class="tool-call-meta">${n.toolKind} · ${gO(n.status)}</span>
|
|
474
474
|
</div>
|
|
475
475
|
${n.text?N`<pre class="tool-call-text">${n.text}</pre>`:null}
|
|
476
|
-
`}function
|
|
477
|
-
<div class="history-scroll" @scroll=${l(this,
|
|
478
|
-
${this.messages.map(t=>{const r=t.kind==="assistant"?
|
|
476
|
+
`}function rg(n){for(let e=n.length-1;e>=0;e-=1){const t=n[e];if(t&&t.kind==="user")return t.id}return null}var Qt,vr,Ka,Ja,eo,Cu;class $b extends bs{constructor(){super(...arguments);w(this,eo);b(this,"messages",[]);w(this,Qt,!0);w(this,vr,null);w(this,Ka,()=>{const t=l(this,vr);if(!t)return;const i=t.scrollHeight-t.clientHeight-t.scrollTop<=pO;i!==l(this,Qt)&&(k(this,Qt,i),this.toggleAttribute("data-pinned",i))});w(this,Ja,()=>{k(this,Qt,!0),this.toggleAttribute("data-pinned",!0),f(this,eo,Cu).call(this,!0)})}changed(t){let r=!1;if(t.has("messages")){const i=t.get("messages")??[],s=rg(this.messages);r=s!==null&&s!==rg(i),r&&k(this,Qt,!0)}Fe(this.template(),this),l(this,vr)||k(this,vr,this.querySelector(".history-scroll")),this.toggleAttribute("data-pinned",l(this,Qt)),f(this,eo,Cu).call(this,r)}template(){return N`
|
|
477
|
+
<div class="history-scroll" @scroll=${l(this,Ka)}>
|
|
478
|
+
${this.messages.map(t=>{const r=t.kind==="assistant"?p2(fO(t)):t.kind==="tool_call"?mO(t):t.text;return N`<div
|
|
479
479
|
class="message message-${t.kind}"
|
|
480
480
|
data-message-id=${t.id}
|
|
481
481
|
>${r}</div>`})}
|
|
@@ -484,11 +484,11 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
484
484
|
type="button"
|
|
485
485
|
class="history-jump"
|
|
486
486
|
aria-label="Jump to latest message"
|
|
487
|
-
@click=${l(this,
|
|
487
|
+
@click=${l(this,Ja)}
|
|
488
488
|
>
|
|
489
|
-
${
|
|
489
|
+
${Sy({size:16})}
|
|
490
490
|
</button>
|
|
491
|
-
`}}Qt=new WeakMap,vr=new WeakMap,
|
|
491
|
+
`}}Qt=new WeakMap,vr=new WeakMap,Ka=new WeakMap,Ja=new WeakMap,eo=new WeakSet,Cu=function(t){requestAnimationFrame(()=>{const r=l(this,vr);r&&(!l(this,Qt)&&!t||(r.scrollTop=r.scrollHeight-r.clientHeight))})},b($b,"properties",["messages"]);customElements.define("message-history",$b);var to,no,wi,Qa,el,ot,pa,ro,Ru,Du,io,so;class Pu extends bs{constructor(){super(...arguments);w(this,ot);b(this,"placeholder","What do you want to do?");b(this,"open",!1);b(this,"messages",[]);w(this,to,zt.resolve("ServerManager"));w(this,no,zt.resolve("ShortcutService"));w(this,wi,null);b(this,"handleTriggerActivate",()=>{this.open=!0});b(this,"handleKeydown",t=>{var o;if(t.key!=="Enter"||t.shiftKey)return;const r=t.currentTarget,i=r.value.trim();if(t.preventDefault(),!i)return;r.value="",f(this,ot,pa).call(this,r);const s=(o=l(this,to).activeServer)==null?void 0:o.acpClient;s&&s.sendMessage({text:i}).catch(a=>{console.error("ACPClient.sendMessage() failed",a)})});w(this,Qa,t=>{f(this,ot,pa).call(this,t.currentTarget)});w(this,el,t=>{if(t.target instanceof HTMLTextAreaElement)return;const r=t.currentTarget.querySelector("textarea");r==null||r.focus()});w(this,ro,t=>{if(t.shortcut!=="focusCommandInput")return;if(!this.open){this.open=!0;return}const r=this.querySelector("textarea");if(r){if(document.activeElement===r){this.open=!1;return}r.focus()}});w(this,io,t=>{t.target instanceof Node&&(this.contains(t.target)||(this.open=!1))});w(this,so,t=>{t.key==="Escape"&&(this.open=!1)})}connected(){const t=new DisposableStack;k(this,wi,t);const r=rz(l(this,to),i=>{this.messages=i});t.defer(()=>r.dispose()),l(this,no).addEventListener("shortcut-triggered",l(this,ro)),t.defer(()=>l(this,no).removeEventListener("shortcut-triggered",l(this,ro))),this.open&&f(this,ot,Ru).call(this)}disconnected(){var t;(t=l(this,wi))==null||t.dispose(),k(this,wi,null),f(this,ot,Du).call(this)}changed(t){if(this.open?(this.removeAttribute("material"),this.removeAttribute("tone"),this.removeAttribute("level")):(this.setAttribute("material","paper"),this.setAttribute("tone","dark"),this.setAttribute("level","overlay")),Fe(this.template(),this),t.has("open"))if(this.open){f(this,ot,Ru).call(this);const r=this.querySelector("textarea");r&&(f(this,ot,pa).call(this,r),r.focus())}else f(this,ot,Du).call(this)}template(){return this.open?N`
|
|
492
492
|
${this.messages.length>0?N`
|
|
493
493
|
<div
|
|
494
494
|
class="chat"
|
|
@@ -504,13 +504,13 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
504
504
|
material="paper"
|
|
505
505
|
tone="dark"
|
|
506
506
|
level="overlay"
|
|
507
|
-
@click=${l(this,
|
|
507
|
+
@click=${l(this,el)}
|
|
508
508
|
>
|
|
509
509
|
<textarea
|
|
510
510
|
class="textarea"
|
|
511
511
|
rows="1"
|
|
512
512
|
@keydown=${this.handleKeydown}
|
|
513
|
-
@input=${l(this,
|
|
513
|
+
@input=${l(this,Qa)}
|
|
514
514
|
></textarea>
|
|
515
515
|
</div>
|
|
516
516
|
`:N`
|
|
@@ -524,7 +524,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
524
524
|
<span class="label">${this.placeholder}</span>
|
|
525
525
|
<span class="kbd" aria-hidden="true">⌘K</span>
|
|
526
526
|
</div>
|
|
527
|
-
`}}
|
|
527
|
+
`}}to=new WeakMap,no=new WeakMap,wi=new WeakMap,Qa=new WeakMap,el=new WeakMap,ot=new WeakSet,pa=function(t){t.style.height="auto",t.style.height=`${t.scrollHeight}px`},ro=new WeakMap,Ru=function(){document.addEventListener("mousedown",l(this,io)),document.addEventListener("keydown",l(this,so))},Du=function(){document.removeEventListener("mousedown",l(this,io)),document.removeEventListener("keydown",l(this,so))},io=new WeakMap,so=new WeakMap,b(Pu,"properties",["placeholder","open","messages"]),b(Pu,"attributes",{placeholder:{type:String},open:{type:Boolean}});customElements.define("command-panel",Pu);class Ib extends Event{constructor(t){super("auth-submit",{bubbles:!0,composed:!0});b(this,"token");this.token=t}}class vO extends HTMLElement{constructor(){super(...arguments);b(this,"_invalid",!1);b(this,"_tokenValue","")}set invalid(t){this._invalid=t,this.render()}get invalid(){return this._invalid}set tokenValue(t){this._tokenValue=t,this.render()}get tokenValue(){return this._tokenValue}connectedCallback(){this.render()}handleInput(t){const r=t.currentTarget;this._tokenValue=r.value}handleSubmit(t){t.preventDefault();const r=this._tokenValue.trim();r&&this.dispatchEvent(new Ib(r))}render(){Fe(N`
|
|
528
528
|
<modal-overlay open>
|
|
529
529
|
<section class="auth-modal">
|
|
530
530
|
<form class="auth-form" @submit=${t=>this.handleSubmit(t)}>
|
|
@@ -545,7 +545,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
545
545
|
</form>
|
|
546
546
|
</section>
|
|
547
547
|
</modal-overlay>
|
|
548
|
-
`,this)}}customElements.get("auth-modal")||customElements.define("auth-modal",
|
|
548
|
+
`,this)}}customElements.get("auth-modal")||customElements.define("auth-modal",vO);class yO extends HTMLElement{constructor(){super(...arguments);b(this,"runtimeServerURL",ry());b(this,"electronMode",wh());b(this,"serverManager",zt.resolve("ServerManager"));b(this,"screenManager",zt.resolve("ScreenManager"));b(this,"connectError",null);b(this,"handleServerManagerChange",()=>{this.render()});b(this,"handleActiveScreenChanged",()=>{this.render()})}connectedCallback(){this.serverManager.addEventListener("change",this.handleServerManagerChange),this.screenManager.addEventListener("active-screen-changed",this.handleActiveScreenChanged),this.addEventListener("auth-submit",t=>{var i;const r=t instanceof Ib?t.token:t instanceof CustomEvent&&typeof((i=t.detail)==null?void 0:i.token)=="string"?t.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.handleActiveScreenChanged)}async initializeConnection(){if(this.electronMode){this.serverManager.connectConfiguredServers(this.runtimeServerURL,gf());return}if(this.serverManager.activeServer)return;const t=new ny({url:this.runtimeServerURL,name:"Server",token:gf()});this.serverManager.add(t),this.serverManager.setActive(t);try{await t.connect(),this.connectError=null}catch(r){this.connectError=r instanceof Error&&!(r instanceof eu)?r.message:null}this.render()}async handleAuthSubmit(t){const r=this.serverManager.activeServer;if(r){this.connectError=null,r.token=t,this.updateTokenQueryParam(t);try{await r.connect()}catch(i){i instanceof eu||(this.connectError=i instanceof Error?i.message:String(i))}this.render()}}updateTokenQueryParam(t){const r=new URL(window.location.href);r.searchParams.set("token",t),window.history.replaceState({},"",`${r.pathname}${r.search}${r.hash}`)}render(){const t=this.serverManager.activeServer,r=(t==null?void 0:t.status)??null;if(r==="connecting"){Fe(N`
|
|
549
549
|
<main class="auth-gate"><p>Connecting...</p></main>
|
|
550
550
|
`,this);return}if(r==="disconnected"){const o=t;if(!o)return;Fe(N`
|
|
551
551
|
<main class="auth-gate">
|
|
@@ -568,7 +568,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
568
568
|
aria-label="Home"
|
|
569
569
|
@click=${()=>this.screenManager.clearActive()}
|
|
570
570
|
>
|
|
571
|
-
${
|
|
571
|
+
${A2({size:16,weight:"regular"})}
|
|
572
572
|
</button>
|
|
573
573
|
<screen-select></screen-select>
|
|
574
574
|
</div>
|
|
@@ -577,4 +577,4 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
577
577
|
`:null}
|
|
578
578
|
`}
|
|
579
579
|
</main>
|
|
580
|
-
`,this)}}customElements.get("television-app")||customElements.define("television-app",
|
|
580
|
+
`,this)}}customElements.get("television-app")||customElements.define("television-app",yO);const Oh=wh(),Mh=ry(),Tb=new i1(Oh?"television-electron":"television-browser",r1(Mh)),Nh=new OD({localStore:Tb,localServerURL:Mh}),Cb=new e1({localStore:Tb,serverManager:Nh}),bO=new MD;zt.register("ServerManager",()=>Nh);zt.register("ScreenManager",()=>Cb);zt.register("ShortcutService",()=>bO);globalThis.__telepath={screenManager:Cb,serverManager:Nh};const Uh=document.createElement("television-app");Uh.runtimeServerURL=Mh;Uh.electronMode=Oh;Oh&&document.body.classList.add("electron");document.body.appendChild(Uh);
|